=====* UniMarc [0.0130] 버전 업데이트 내용 *===== ** ERP 작업 전면 중단 (마크우선) ** *** 마크작성 - 칸채우기 버그 수정을 위해 테스트 계정 제외하고 잠금*** 1. 퀵메뉴 ㄴ> ERP 작업 중단으로 인해 퀵메뉴 설정 잠금. 2. 마크 작성 ㄴ> 칸채우기에서 메모장으로 변환시 순서 변경되던 버그 수정. ㄴ> 메모장에 없는 태그를 칸채우기에서 넣을경우 메모장에 적용되지않는 버그 발견. (수정중에 다른 작업 진행중) 3. 마크 정리 ㄴ> 인코딩값 설정하여 저장기능 추가. (ANSI, UTF-8, UniCode) ㄴ> 반출 성공/실패 메시지박스 알림 추가. ㄴ> 태그변경 버그 수정. ㄴ> 체크창 적용되지 않는 버그 수정. ㄴ> Grid의 푸른부분 수정시 마크에 반영되게 수정. ㄴ> 구두점 자동으로 적용하여 반출되게 소스코드 추가. 4. 마크 반출 ㄴ> 인코딩값 설정하여 저장기능 추가. (ANSI, UTF-8, UniCode) ㄴ> 구두점 자동으로 적용하여 반출되게 소스코드 추가. 5. 마크 작성 ㄴ> 등급, 외부데이터 등 색상이 변경함에 따라 INSERT, UPDATE를 해야하는 부분 수정.
525 lines
20 KiB
C#
525 lines
20 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.ComponentModel;
|
||
using System.Data;
|
||
using System.Drawing;
|
||
using System.IO;
|
||
using System.Linq;
|
||
using System.Text;
|
||
using System.Threading.Tasks;
|
||
using System.Windows.Forms;
|
||
using UniMarc.마크;
|
||
|
||
namespace WindowsFormsApp1.Mac
|
||
{
|
||
public partial class Marc_Plan : Form
|
||
{
|
||
Main main;
|
||
Helper_DB db = new Helper_DB();
|
||
public Marc_Plan(Main _main)
|
||
{
|
||
InitializeComponent();
|
||
main = _main;
|
||
}
|
||
|
||
private void Marc_Plan_Load(object sender, EventArgs e)
|
||
{
|
||
db.DBcon();
|
||
|
||
AuthorSymbol.Symbol sb = new AuthorSymbol.Symbol();
|
||
cb_FirstAuthor.Items.AddRange(sb.authorBook);
|
||
cb_authorType.Items.AddRange(sb.authorType);
|
||
cb_FirstBook.Items.AddRange(sb.authorFirst);
|
||
|
||
string[] divType = { "KDC", "DDC" };
|
||
cb_divType.Items.AddRange(divType);
|
||
|
||
string[] divNum = { "4", "5", "6" };
|
||
cb_divNum.Items.AddRange(divNum);
|
||
|
||
string[] Encoding = { "ANSI", "UTF-8", "UniCode" };
|
||
cb_EncodingType.Items.AddRange(Encoding);
|
||
cb_EncodingType.SelectedIndex = 0;
|
||
|
||
}
|
||
|
||
private void btn_Select_List_Click(object sender, EventArgs e)
|
||
{
|
||
tb_ISBN.Text = "";
|
||
|
||
Marc_Plan_Sub_SelectList sub = new Marc_Plan_Sub_SelectList(this);
|
||
sub.TopMost = true;
|
||
sub.Show();
|
||
dataGridView1.CellValueChanged += new DataGridViewCellEventHandler(dataGridView1_CellValueChanged);
|
||
}
|
||
|
||
private void Btn_Search_Click(object sender, EventArgs e)
|
||
{
|
||
throw new NotImplementedException();
|
||
}
|
||
#region SelectList_Sub
|
||
public void mk_Grid(string ListName, string date)
|
||
{
|
||
btn_Select_List.Text = ListName;
|
||
dataGridView1.Rows.Clear();
|
||
|
||
string Table = "Specs_Marc";
|
||
|
||
// idx
|
||
// 연번 등록번호 분류기호 저자기호 V(049v,볼륨)
|
||
// C(049c,복본) F(049f,별치) 구분(이용자) ISBN 도서명
|
||
// 총서명 총서번호 총서명1 총서명1 저자
|
||
// 출판사 정가 midx 마크
|
||
|
||
// idx
|
||
// 연번 등록번호 분류기호 저자기호 ISBN
|
||
// 도서명 총서명1 총서번호1 총서명2 총서번호2
|
||
// 저자 출판사 정가 midx 마크데이터
|
||
string Area = "`idx`, "
|
||
+ "`num`, `r_num`, `class_symbol`, `author_symbol`, `ISBN`, "
|
||
+ "`book_name`, `s_book_name1`, `s_book_num1`, `s_book_name2`, `s_book_num2`, "
|
||
+ "`author`, `book_comp`, `price`, `midx`, `marc`";
|
||
|
||
string[] Search_col = { "work_list", "date" };
|
||
string[] Search_data = { ListName, date };
|
||
|
||
string cmd = db.More_DB_Search(Table, Search_col, Search_data, Area);
|
||
string res = db.DB_Send_CMD_Search(cmd);
|
||
|
||
string[] ary = res.Split('|');
|
||
string[] grid = {
|
||
"", "", "", "", "",
|
||
"", "", "", "", "",
|
||
"", "", "", "", "",
|
||
"", "", "", "", "",
|
||
"", "T" };
|
||
|
||
for (int a = 0; a < ary.Length; a++)
|
||
{
|
||
if (a % 16 == 0) grid[0] = ary[a]; // idx
|
||
if (a % 16 == 1) grid[1] = ary[a]; // num
|
||
if (a % 16 == 2) grid[2] = ary[a]; // r_num
|
||
if (a % 16 == 3) grid[3] = ary[a]; // class_symbol
|
||
if (a % 16 == 4) grid[4] = ary[a]; // author_symbol
|
||
if (a % 16 == 5) grid[9] = ary[a]; // ISBN
|
||
if (a % 16 == 6) grid[10] = ary[a]; // book_name
|
||
if (a % 16 == 7) grid[11] = ary[a]; // s_book_name1
|
||
if (a % 16 == 8) grid[12] = ary[a]; // s_book_num1
|
||
if (a % 16 == 9) grid[13] = ary[a]; // s_book_name2
|
||
if (a % 16 == 10) grid[14] = ary[a]; // s_book_num2
|
||
if (a % 16 == 11) grid[15] = ary[a]; // author
|
||
if (a % 16 == 12) grid[16] = ary[a]; // book_comp
|
||
if (a % 16 == 13) grid[17] = ary[a]; // price
|
||
if (a % 16 == 14) grid[18] = ary[a]; // midx
|
||
if (a % 16 == 15) { grid[19] = ary[a]; // marc
|
||
dataGridView1.Rows.Add(grid);
|
||
}
|
||
}
|
||
|
||
}
|
||
public void mk_Panel(string idx, string ListName, string date)
|
||
{
|
||
string Table = "Specs_List";
|
||
string Area = "`first_Author`, `symbol_Author`, `book_Author`, `divType`, `divNum`";
|
||
string[] Search_col = { "idx", "work_list", "date" };
|
||
string[] Search_data = { idx, ListName, date };
|
||
|
||
string cmd = db.More_DB_Search(Table, Search_col, Search_data, Area);
|
||
string res = db.DB_Send_CMD_Search(cmd);
|
||
|
||
string[] ary = res.Split('|');
|
||
|
||
cb_FirstAuthor.SelectedItem = ary[0];
|
||
cb_authorType.SelectedItem = ary[1];
|
||
cb_FirstBook.SelectedItem = ary[2];
|
||
cb_divType.SelectedItem = ary[3];
|
||
cb_divNum.SelectedItem = ary[4];
|
||
}
|
||
#endregion
|
||
|
||
private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
|
||
{
|
||
Skill_Grid sg = new Skill_Grid();
|
||
sg.Print_Grid_Num(sender, e);
|
||
}
|
||
|
||
private void checkBox1_CheckedChanged(object sender, EventArgs e)
|
||
{
|
||
foreach (DataGridViewRow r in dataGridView1.Rows) {
|
||
r.Cells["colCheck"].Value = ((CheckBox)sender).Checked;
|
||
}
|
||
}
|
||
|
||
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
|
||
{
|
||
int row = e.RowIndex;
|
||
int col = e.ColumnIndex;
|
||
|
||
if (row < 0) return;
|
||
|
||
string idx = dataGridView1.Rows[row].Cells["idx"].Value.ToString();
|
||
|
||
if (dataGridView1.Rows[row].Cells[col].ReadOnly) {
|
||
string[] Marc = {
|
||
dataGridView1.Rows[row].Cells["marc"].Value.ToString(),
|
||
dataGridView1.Rows[row].Cells["midx"].Value.ToString(),
|
||
dataGridView1.Rows[row].Cells["num"].Value.ToString(),
|
||
idx,
|
||
dataGridView1.Rows[row].Cells["ISBN"].Value.ToString()
|
||
};
|
||
string[] symbol_Type = {
|
||
cb_FirstAuthor.Text, cb_authorType.Text, cb_FirstBook.Text,
|
||
cb_divType.Text, cb_divNum.Text
|
||
};
|
||
|
||
Marc_Plan_Sub_MarcEdit me = new Marc_Plan_Sub_MarcEdit(this);
|
||
me.row = row;
|
||
me.UserName = main.botUserLabel.Text;
|
||
me.Init(Marc);
|
||
me.SetSymbolType(symbol_Type);
|
||
me.Show();
|
||
}
|
||
}
|
||
|
||
private void cb_divType_SelectedIndexChanged(object sender, EventArgs e)
|
||
{
|
||
cb_divNum.Items.Clear();
|
||
|
||
string value = cb_divType.SelectedItem.ToString();
|
||
if (value == "KDC")
|
||
{
|
||
string[] data = { "4", "5", "6" };
|
||
cb_divNum.Items.AddRange(data);
|
||
}
|
||
else
|
||
{
|
||
string[] data = { "21", "22", "23" };
|
||
cb_divNum.Items.AddRange(data);
|
||
}
|
||
}
|
||
|
||
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
|
||
{
|
||
int row = dataGridView1.CurrentRow.Index;
|
||
string isbn = dataGridView1.Rows[row].Cells["isbn"].Value.ToString();
|
||
|
||
tb_ISBN.Text = isbn;
|
||
}
|
||
|
||
private void tb_SearchTag_KeyDown(object sender, KeyEventArgs e)
|
||
{
|
||
if (e.KeyCode == Keys.Enter) {
|
||
Search_Tag();
|
||
}
|
||
}
|
||
#region SearchTag_KeyDown_Sub
|
||
List<string> BackUpTag = new List<string>();
|
||
private void Search_Tag()
|
||
{
|
||
BackUpTag.Clear();
|
||
string[] SearchTag = { tb_SearchTag.Text };
|
||
String_Text st = new String_Text();
|
||
|
||
for (int a = 0; a < dataGridView1.Rows.Count; a++)
|
||
{
|
||
string marc = dataGridView1.Rows[a].Cells["marc"].Value.ToString();
|
||
string[] tag = st.Take_Tag(marc, SearchTag);
|
||
dataGridView1.Rows[a].Cells["search_tag"].Value = tag[0];
|
||
BackUpTag.Add(tag[0]);
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
private void btn_ChangeTag_Click(object sender, EventArgs e)
|
||
{
|
||
string msg = string.Format("『{0}』 태그를 변경하시겠습니까?", tb_SearchTag.Text);
|
||
// 아니오 선택시 아래코드 실행되지않음.
|
||
if (MessageBox.Show(msg, "태그변경", MessageBoxButtons.YesNo) == DialogResult.No) return;
|
||
|
||
for (int a = 0; a < dataGridView1.Rows.Count; a++)
|
||
{
|
||
string marc = dataGridView1.Rows[a].Cells["marc"].Value.ToString();
|
||
string changeTag = dataGridView1.Rows[a].Cells["search_tag"].Value.ToString();
|
||
|
||
if (changeTag == "")
|
||
continue;
|
||
|
||
if (dataGridView1.Rows[a].Cells["colCheck"].Value.ToString() == "T")
|
||
dataGridView1.Rows[a].Cells["marc"].Value = marc.Replace(BackUpTag[a], changeTag);
|
||
}
|
||
MessageBox.Show("변경되었습니다!", "태그변경");
|
||
}
|
||
|
||
private void btn_Close_Click(object sender, EventArgs e)
|
||
{
|
||
this.Close();
|
||
}
|
||
|
||
private void btn_Excel_Click(object sender, EventArgs e)
|
||
{
|
||
if (dataGridView1.RowCount <= 0) return;
|
||
|
||
string[] Tag = { "245n", "245p", "260c" };
|
||
|
||
String_Text st = new String_Text();
|
||
Excel_text et = new Excel_text();
|
||
string[] Title = {
|
||
"연번", "등록번호", "분류기호", "저자기호", "볼륨",
|
||
"복본", "별치", "도서명", "원서명", "권차명",
|
||
"권차서명", "총서명", "총서번호", "총서명", "총서번호",
|
||
"저자", "출판사", "출판년", "정가", "ISBN"
|
||
};
|
||
string[,] Content = new string[dataGridView1.RowCount, 20];
|
||
|
||
for (int a = 0; a < dataGridView1.RowCount; a++)
|
||
{
|
||
string Marc = dataGridView1.Rows[a].Cells["marc"].Value.ToString();
|
||
string[] SearchTag = st.Take_Tag(Marc, Tag);
|
||
string oriBookName = st.TakeTag_FilterJisi(Marc, "246a", "19");
|
||
|
||
Content[a, 00] = dataGridView1.Rows[a].Cells["num"].Value.ToString();
|
||
Content[a, 01] = dataGridView1.Rows[a].Cells["reg_num"].Value.ToString();
|
||
Content[a, 02] = dataGridView1.Rows[a].Cells["class_code"].Value.ToString();
|
||
Content[a, 03] = dataGridView1.Rows[a].Cells["author_code"].Value.ToString();
|
||
Content[a, 04] = dataGridView1.Rows[a].Cells["volume"].Value.ToString();
|
||
|
||
Content[a, 05] = dataGridView1.Rows[a].Cells["copy"].Value.ToString();
|
||
Content[a, 06] = dataGridView1.Rows[a].Cells["prefix"].Value.ToString();
|
||
Content[a, 07] = dataGridView1.Rows[a].Cells["book_name"].Value.ToString();
|
||
Content[a, 08] = oriBookName;
|
||
Content[a, 09] = SearchTag[0];
|
||
|
||
Content[a, 10] = SearchTag[1];
|
||
Content[a, 11] = dataGridView1.Rows[a].Cells["s_book_name1"].Value.ToString();
|
||
Content[a, 12] = dataGridView1.Rows[a].Cells["s_book_num1"].Value.ToString();
|
||
Content[a, 13] = dataGridView1.Rows[a].Cells["s_book_name2"].Value.ToString();
|
||
Content[a, 14] = dataGridView1.Rows[a].Cells["s_book_num2"].Value.ToString();
|
||
|
||
Content[a, 15] = dataGridView1.Rows[a].Cells["author"].Value.ToString();
|
||
Content[a, 16] = dataGridView1.Rows[a].Cells["book_comp"].Value.ToString();
|
||
Content[a, 17] = SearchTag[2];
|
||
Content[a, 18] = dataGridView1.Rows[a].Cells["price"].Value.ToString();
|
||
Content[a, 19] = dataGridView1.Rows[a].Cells["ISBN"].Value.ToString();
|
||
}
|
||
|
||
et.Mk_Excel(Title, Content);
|
||
}
|
||
|
||
private void btn_Output_Click(object sender, EventArgs e)
|
||
{
|
||
String_Text st = new String_Text();
|
||
string Marc_data = string.Empty;
|
||
|
||
for (int a = 0; a < dataGridView1.Rows.Count; a++)
|
||
{
|
||
if (dataGridView1.Rows[a].Cells["marc"].Value.ToString() == "" &&
|
||
dataGridView1.Rows[a].Cells["marc"].Value == null)
|
||
continue;
|
||
|
||
if (dataGridView1.Rows[a].Cells["colCheck"].Value.ToString() != "T")
|
||
continue;
|
||
|
||
string marc = dataGridView1.Rows[a].Cells["Marc"].Value.ToString();
|
||
marc = st.ConvertMarcType(marc);
|
||
marc = st.ApplyMark(marc);
|
||
marc = st.made_Ori_marc(marc);
|
||
|
||
Marc_data += marc.Replace("₩", "\\");
|
||
}
|
||
|
||
string FileName;
|
||
SaveFileDialog saveFileDialog = new SaveFileDialog();
|
||
saveFileDialog.Title = "저장 경로를 지정하세요.";
|
||
saveFileDialog.OverwritePrompt = true;
|
||
saveFileDialog.Filter = "마크 파일 (*.mrc)|*.mrc|모든 파일 (*.*)|*.*";
|
||
|
||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||
{
|
||
if (cb_EncodingType.SelectedIndex == 0) {
|
||
FileName = saveFileDialog.FileName;
|
||
File.WriteAllText(FileName, Marc_data, Encoding.Default);
|
||
}
|
||
else if (cb_EncodingType.SelectedIndex == 1) {
|
||
FileName = saveFileDialog.FileName;
|
||
File.WriteAllText(FileName, Marc_data, Encoding.UTF8);
|
||
}
|
||
else if (cb_EncodingType.SelectedIndex == 2) {
|
||
FileName = saveFileDialog.FileName;
|
||
File.WriteAllText(FileName, Marc_data, Encoding.Unicode);
|
||
}
|
||
}
|
||
|
||
MessageBox.Show("반출되었습니다!");
|
||
}
|
||
|
||
#region Grid 드래그 앤 드랍 함수 (현재 사용 중지) (사용하려면 dataGridView1의 AllowDrop 활성화해야함)
|
||
|
||
Skill_Grid sg = new Skill_Grid();
|
||
|
||
private void dataGridView1_MouseDown(object sender, MouseEventArgs e)
|
||
{
|
||
sg.MouseDown(sender, e);
|
||
}
|
||
|
||
private void dataGridView1_MouseMove(object sender, MouseEventArgs e)
|
||
{
|
||
sg.MouseMove(sender, e);
|
||
}
|
||
|
||
private void dataGridView1_DragDrop(object sender, DragEventArgs e)
|
||
{
|
||
sg.DragDrop(sender, e);
|
||
}
|
||
|
||
private void dataGridView1_DragOver(object sender, DragEventArgs e)
|
||
{
|
||
sg.DragOver(sender, e);
|
||
}
|
||
#endregion
|
||
|
||
private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
|
||
{
|
||
int row = e.RowIndex;
|
||
int col = dataGridView1.CurrentCell.ColumnIndex;
|
||
|
||
if (col < 2 && col > 7)
|
||
return;
|
||
|
||
if (dataGridView1.Rows[row].Cells["marc"].Value.ToString() == "" &&
|
||
dataGridView1.Rows[row].Cells["marc"].Value == null)
|
||
{
|
||
MessageBox.Show("저장된 마크가 없습니다!");
|
||
return;
|
||
}
|
||
|
||
string Marc = dataGridView1.Rows[row].Cells["marc"].Value.ToString();
|
||
|
||
string AddTag = "";
|
||
if (col == 2 || col == 5 || col == 6 || col == 7)
|
||
{
|
||
string I = dataGridView1.Rows[row].Cells[2].Value.ToString();
|
||
string V = dataGridView1.Rows[row].Cells[5].Value.ToString();
|
||
string C = dataGridView1.Rows[row].Cells[6].Value.ToString();
|
||
string F = dataGridView1.Rows[row].Cells[7].Value.ToString();
|
||
|
||
if (I != "")
|
||
I = string.Format("▼i{0}", I);
|
||
|
||
if (V != "")
|
||
V = string.Format("▼v{0}", V);
|
||
|
||
if (C != "")
|
||
C = string.Format("▼c{0}", C);
|
||
|
||
if (F != "")
|
||
F = string.Format("▼f{0}", F);
|
||
|
||
AddTag = string.Format("049\t \t{0}{1}{2}{3}▲", I, V, C, F);
|
||
}
|
||
else if (col == 3 || col == 4)
|
||
{
|
||
string A = dataGridView1.Rows[row].Cells[3].Value.ToString();
|
||
string B = dataGridView1.Rows[row].Cells[4].Value.ToString();
|
||
|
||
if (A != "")
|
||
A = string.Format("▼a{0}", A);
|
||
|
||
if (B != "")
|
||
B = string.Format("▼b{0}", B);
|
||
|
||
AddTag = string.Format("090\t \t{0}{1}▲", A, B);
|
||
}
|
||
string TypeView = ConvertMarcType(Marc);
|
||
|
||
string AddMarc = AddTagInMarc(AddTag, TypeView);
|
||
|
||
String_Text st = new String_Text();
|
||
dataGridView1.Rows[row].Cells["marc"].Value = st.made_Ori_marc(AddMarc);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 한줄짜리 마크를 보기 쉬운 형태로 변환
|
||
/// </summary>
|
||
/// <param name="Marc">한줄짜리 마크</param>
|
||
/// <returns></returns>
|
||
string ConvertMarcType(string Marc)
|
||
{
|
||
if (Marc.Length < 3) return "";
|
||
|
||
string result = "";
|
||
|
||
List<string> TagNum = new List<string>(); // 태그번호 저장용
|
||
List<string> Field = new List<string>(); // 가변길이필드 저장용
|
||
|
||
// 특수기호 육안으로 확인하기 쉽게 변환
|
||
Marc = Marc.Replace("", "▼");
|
||
Marc = Marc.Replace("", "▲");
|
||
Marc = Marc.Replace("₩", "\\");
|
||
|
||
int StartIdx = 0;
|
||
|
||
// 리더부를 제외한 디렉토리, 가변길이필드 저장
|
||
string[] data = Marc.Substring(24).Split('▲');
|
||
for (int a = 1; a < data.Length - 1; a++)
|
||
{
|
||
TagNum.Add(data[0].Substring(StartIdx, 3));
|
||
StartIdx += 12;
|
||
Field.Add(data[a] + "▲");
|
||
}
|
||
|
||
// List에 들어간 데이터를 메모장에 출력
|
||
for (int a = 0; a < TagNum.Count; a++)
|
||
{
|
||
string res = TagNum[a];
|
||
if (Field[a].IndexOf("▼") == -1)
|
||
{
|
||
res += "\t \t" + Field[a];
|
||
}
|
||
else
|
||
{
|
||
string temp = Field[a].Insert(2, "\t");
|
||
res += "\t" + temp;
|
||
}
|
||
result += res + "\n";
|
||
}
|
||
return result;
|
||
}
|
||
|
||
string AddTagInMarc(string Tag, string TypeView)
|
||
{
|
||
if (Tag.Length < 3) return "";
|
||
|
||
int TargetTagNum = Convert.ToInt32(Tag.Substring(0, 3));
|
||
|
||
string[] SplitView = TypeView.Split('\n');
|
||
List<string> View = new List<string>(SplitView);
|
||
|
||
int ViewCount = 0;
|
||
foreach (string LineMarc in View)
|
||
{
|
||
string LineTag = LineMarc.Substring(0, 3);
|
||
int TagNum = Convert.ToInt32(LineTag);
|
||
|
||
if (TargetTagNum == TagNum)
|
||
{
|
||
View[ViewCount] = Tag;
|
||
break;
|
||
}
|
||
else if (TargetTagNum < TagNum)
|
||
{
|
||
View.Insert(ViewCount, Tag);
|
||
break;
|
||
}
|
||
ViewCount++;
|
||
}
|
||
return string.Join("\n", View);
|
||
}
|
||
|
||
private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
|
||
{
|
||
Skill_Grid sg = new Skill_Grid();
|
||
sg.Excel_to_DataGridView(sender, e);
|
||
}
|
||
}
|
||
}
|