** ERP 작업 전면 중단 (마크우선) ** 1. 마크 추가 ㄴ> 코리스에서 마크 가져오는 폼 새로 추가 (AddMarcFillBlank.cs) ㄴ> 저장쪽에서 생기는 이슈사항 하드코딩으로 임시 해결. 2. 코리스 마크 가져오는 폼 추가하면서 기존에 있던 버그 수정완료. 3. DB접속 방법 변경. 코드 내 명시되어있던 아이피가 거슬려서 감춘것뿐. 4. 매크로 (현재 55건) ㄴ> 기존에 그냥 반출하던 방식을 바꿔서 매크로를 적용후 반출하여 파일로 저장하는 방식으로 변경됨. ㄴ> 추가 요청사항시 업데이트가 필요함. 5. DLS 복본조사 ㄴ> DLS 접속방침이 변경됨에 따라 업데이트가 불가피하여 방식을 변경함. ㄴ> 바로 URL로 이동하는 방식을 웹페이지내 버튼을 클릭하여 이동하는 방식으로 변경함. 6. 마크 칸채우기 ㄴ> 검색시 여러건이 나옴에 따라 기존에 맨 윗목록만 클릭하던 방식을 변형하여 원하는 목록을 클릭하면 자동으로 마크창으로 이동시켜주게 변경.
230 lines
8.1 KiB
C#
230 lines
8.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using System.IO;
|
|
|
|
using UniMarc.마크;
|
|
|
|
namespace WindowsFormsApp1.Mac
|
|
{
|
|
public partial class Set_Macro : Form
|
|
{
|
|
Main main;
|
|
Helper_DB db = new Helper_DB();
|
|
Macro_Gudu gudu = new Macro_Gudu();
|
|
string compidx = UniMarc.Properties.Settings.Default.compidx;
|
|
public string[] ViewMarcArray { get; set; }
|
|
public string FileType { get; set; }
|
|
|
|
public Set_Macro(Main _main)
|
|
{
|
|
InitializeComponent();
|
|
main = _main;
|
|
}
|
|
|
|
public Set_Macro()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void Set_Macro_Load(object sender, EventArgs e)
|
|
{
|
|
db.DBcon();
|
|
|
|
string cmd = string.Format("SELECT `listname` FROM `Comp_SaveMacro` WHERE `compidx` = \"{0}\";", compidx);
|
|
string res = db.DB_Send_CMD_Search(cmd);
|
|
foreach (string l in res.Split('|'))
|
|
{
|
|
if (l == "")
|
|
continue;
|
|
cb_SearchList.Items.Add(l);
|
|
}
|
|
string[,] callGudu = gudu.MacroList;
|
|
|
|
for (int a = 0; a < callGudu.GetLength(0); a++)
|
|
{
|
|
string[] Grid = new string[] { callGudu[a, 0], callGudu[a, 1], callGudu[a, 2] };
|
|
MacroGrid.Rows.Add(Grid);
|
|
}
|
|
MacroGrid.Sort(TagNum, ListSortDirection.Ascending);
|
|
MakeGridCheckReload();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 표의 체크박스 초기화
|
|
/// </summary>
|
|
void MakeGridCheckReload()
|
|
{
|
|
for (int a = 0; a < MacroGrid.Rows.Count; a++)
|
|
{
|
|
MacroGrid.Rows[a].Cells["Check"].Value = "F";
|
|
}
|
|
}
|
|
|
|
private void cb_SearchList_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
string listname = cb_SearchList.SelectedItem.ToString();
|
|
string cmd = string.Format("SELECT `Macroidx` FROM `Comp_SaveMacro` WHERE `compidx` = \"{0}\" AND `listname` = \"{1}\";", compidx, listname);
|
|
string res = db.DB_Send_CMD_Search(cmd).Replace("|", "");
|
|
|
|
MakeGridCheckReload();
|
|
|
|
foreach (string l in res.Split('^'))
|
|
{
|
|
for (int a = 0; a < MacroGrid.Rows.Count; a++)
|
|
{
|
|
if (MacroGrid.Rows[a].Cells["idx"].Value.ToString() == l)
|
|
{
|
|
MacroGrid.Rows[a].Cells["Check"].Value = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private void btn_MakeFile_Click(object sender, EventArgs e)
|
|
{
|
|
Macro_Gudu macro = new Macro_Gudu(FileType);
|
|
string Marc_data = "";
|
|
List<string> idxArray = new List<string>();
|
|
|
|
for (int a = 0; a < MacroGrid.Rows.Count; a++)
|
|
{
|
|
if (MacroGrid.Rows[a].Cells["Check"].Value.ToString() == "T")
|
|
{
|
|
idxArray.Add(MacroGrid.Rows[a].Cells["idx"].Value.ToString());
|
|
}
|
|
}
|
|
|
|
foreach (string t in ViewMarcArray)
|
|
{
|
|
Marc_data += macro.MacroMarc(t, idxArray);
|
|
}
|
|
|
|
string FileName;
|
|
SaveFileDialog saveFileDialog = new SaveFileDialog();
|
|
saveFileDialog.Title = "저장 경로를 지정하세요.";
|
|
saveFileDialog.OverwritePrompt = true;
|
|
saveFileDialog.Filter = "마크 파일 (*.mrc)|*.mrc|모든 파일 (*.*)|*.*";
|
|
|
|
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
|
{
|
|
if (FileType == "ANSI")
|
|
{
|
|
FileName = saveFileDialog.FileName;
|
|
File.WriteAllText(FileName, Marc_data, Encoding.Default);
|
|
}
|
|
else if (FileType == "UTF-8")
|
|
{
|
|
FileName = saveFileDialog.FileName;
|
|
File.WriteAllText(FileName, Marc_data, Encoding.UTF8);
|
|
}
|
|
else if (FileType == "UniCode")
|
|
{
|
|
FileName = saveFileDialog.FileName;
|
|
File.WriteAllText(FileName, Marc_data, Encoding.Unicode);
|
|
}
|
|
}
|
|
|
|
MessageBox.Show("반출되었습니다!");
|
|
}
|
|
|
|
private void btn_AddList_Click(object sender, EventArgs e)
|
|
{
|
|
Skill_Search_Text sst = new Skill_Search_Text();
|
|
|
|
string value = "";
|
|
if (sst.InputBox("생성할 목록명을 입력해주세요.", "목록 생성", ref value) == DialogResult.OK)
|
|
{
|
|
string user = UniMarc.Properties.Settings.Default.User;
|
|
string compidx = UniMarc.Properties.Settings.Default.compidx;
|
|
|
|
string Table = "Comp_SaveMacro";
|
|
if (db.DB_Send_CMD_Search(string.Format("SELECT * FROM {0} WHERE \"compidx\" = {1} AND \"{2}\" = \"{3}\"", Table, compidx, "listname", value)).Length > 2)
|
|
{
|
|
MessageBox.Show("중복된 목록명이 있습니다!");
|
|
return;
|
|
}
|
|
string[] Insert_Tbl = { "compidx", "listname", "user" };
|
|
string[] Insert_Col = { compidx, value, user };
|
|
|
|
string cmd = db.DB_INSERT(Table, Insert_Tbl, Insert_Col);
|
|
db.DB_Send_CMD_reVoid(cmd);
|
|
cb_SearchList.Items.Add(value);
|
|
}
|
|
}
|
|
|
|
private void btn_ListSave_Click(object sender, EventArgs e)
|
|
{
|
|
string MacroIndex = "";
|
|
string compidx = UniMarc.Properties.Settings.Default.compidx;
|
|
string listname = cb_SearchList.Text;
|
|
for (int a = 0; a < MacroGrid.Rows.Count; a++)
|
|
{
|
|
MacroIndex += MacroGrid.Rows[a].Cells["idx"].Value.ToString() + "^";
|
|
}
|
|
MacroIndex.TrimEnd('^');
|
|
|
|
string Table = "Comp_SaveMacro";
|
|
string[] Search_T = { "compidx", "listname" };
|
|
string[] Search_C = { compidx, listname };
|
|
|
|
if (db.DB_Send_CMD_Search(db.More_DB_Search(Table, Search_T, Search_C)).Length < 2)
|
|
{
|
|
MessageBox.Show("선택된 목록이 없습니다!");
|
|
return;
|
|
}
|
|
|
|
string[] Update_T = { "Macroidx" };
|
|
string[] Update_C = { MacroIndex };
|
|
|
|
db.DB_Send_CMD_reVoid(db.More_Update(Table, Update_T, Update_C, Search_T, Search_C));
|
|
MessageBox.Show("저장되었습니다!");
|
|
}
|
|
|
|
private void btn_ListRemove_Click(object sender, EventArgs e)
|
|
{
|
|
if (DialogResult.Yes != MessageBox.Show("현재 목록을 삭제하시겠습니까?", "목록 삭제", MessageBoxButtons.YesNo))
|
|
return;
|
|
|
|
string compidx = UniMarc.Properties.Settings.Default.compidx;
|
|
string listname = cb_SearchList.Text;
|
|
|
|
string Table = "Comp_SaveMacro";
|
|
string[] Search_T = { "compidx", "listname" };
|
|
string[] Search_C = { compidx, listname };
|
|
|
|
if (db.DB_Send_CMD_Search(db.More_DB_Search(Table, Search_T, Search_C)).Length < 2)
|
|
{
|
|
MessageBox.Show("선택된 목록이 없습니다!");
|
|
return;
|
|
}
|
|
|
|
db.DB_Send_CMD_reVoid(db.DB_Delete_More_term(Table, "compidx", compidx, Search_T, Search_C));
|
|
MessageBox.Show("삭제되었습니다!");
|
|
}
|
|
|
|
private void btn_Close_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
|
|
private void MacroGrid_CellClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
if (e.RowIndex < 0)
|
|
return;
|
|
|
|
if (e.ColumnIndex == 3)
|
|
if (MacroGrid.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == "T")
|
|
MacroGrid.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = false;
|
|
else
|
|
MacroGrid.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = true;
|
|
}
|
|
}
|
|
}
|