From 7d1286b7a7d99a5dafaef51f740db364d2d2c131 Mon Sep 17 00:00:00 2001 From: LGram16 Date: Sat, 11 Oct 2025 14:31:24 +0900 Subject: [PATCH] =?UTF-8?q?=ED=95=84=EB=93=9C=EC=97=86=EA=B3=A0=20?= =?UTF-8?q?=EC=A7=80=EC=8B=9C=EA=B8=B0=ED=98=B8=EB=A7=8C=20=EC=9E=88?= =?UTF-8?q?=EB=8A=94=EB=8D=B0=EC=9D=B4=ED=84=B0=EB=8F=84=20=ED=95=84?= =?UTF-8?q?=ED=84=B0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .claude/settings.local.json | 5 +- unimarc/unimarc/Properties/AssemblyInfo.cs | 4 +- unimarc/unimarc/Skill.cs | 23 +++- unimarc/unimarc/마크/CD_LP.cs | 2 +- unimarc/unimarc/마크/CD_LP_List.cs | 2 +- unimarc/unimarc/마크/Marc_Plan.cs | 124 +++++++++++++-------- unimarc/unimarc/마크/Marc_mkList.cs | 2 +- 7 files changed, 105 insertions(+), 57 deletions(-) diff --git a/.claude/settings.local.json b/.claude/settings.local.json index 745f082..7f38cd6 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -8,7 +8,10 @@ "Bash(echo $OS)", "Bash(claude mcp:*)", "WebSearch", - "WebSearch" + "WebSearch", + "Bash(git commit:*)", + "Bash(git config:*)", + "Bash(git push:*)" ], "deny": [], "ask": [] diff --git a/unimarc/unimarc/Properties/AssemblyInfo.cs b/unimarc/unimarc/Properties/AssemblyInfo.cs index 5c08229..3aebae2 100644 --- a/unimarc/unimarc/Properties/AssemblyInfo.cs +++ b/unimarc/unimarc/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를 // 기본값으로 할 수 있습니다. // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2025.10.11.0100")] -[assembly: AssemblyFileVersion("2025.10.11.0100")] +[assembly: AssemblyVersion("2025.10.11.1430")] +[assembly: AssemblyFileVersion("2025.10.11.1430")] diff --git a/unimarc/unimarc/Skill.cs b/unimarc/unimarc/Skill.cs index 6b62a44..1b619ca 100644 --- a/unimarc/unimarc/Skill.cs +++ b/unimarc/unimarc/Skill.cs @@ -2155,9 +2155,14 @@ namespace WindowsFormsApp1 /// /// 한줄짜리 마크 /// - public string ConvertMarcType(string Marc) + public string ConvertMarcType(string Marc, out string errmessage) { - if (Marc.Length < 3) return ""; + errmessage = string.Empty; + if (Marc.Length < 3) + { + errmessage = "MARC 데이터길이가 너무 짧습니다."; + return ""; + } string result = ""; @@ -2189,8 +2194,20 @@ namespace WindowsFormsApp1 else if (res.StartsWith("00")) { res += "\t \t" + Field[a]; } else { - if (Field[a].Replace("▲","").Trim().isEmpty()) //no data + var fieldValue = Field[a].Trim(); + bool isEmpty = false; + if (fieldValue.IndexOf("▼") != -1) { + var dataArea = fieldValue.Substring(fieldValue.IndexOf("▼") + 1); + isEmpty = dataArea.ToString().isEmpty(); + } + else + { + isEmpty = fieldValue.Replace("▲", "").Trim().isEmpty(); + } + if (isEmpty) //no data + { + errmessage = (errmessage.isEmpty() == false ? "\n" : "") + "태그 " + TagNum[a] + " 에 데이터가 없습니다."; Console.WriteLine("field length error"); res = string.Empty; } diff --git a/unimarc/unimarc/마크/CD_LP.cs b/unimarc/unimarc/마크/CD_LP.cs index 42f4139..8d834df 100644 --- a/unimarc/unimarc/마크/CD_LP.cs +++ b/unimarc/unimarc/마크/CD_LP.cs @@ -255,7 +255,7 @@ namespace UniMarc.마크 String_Text st = new String_Text(); - string ViewMarc = st.ConvertMarcType(SelectMarc); + string ViewMarc = st.ConvertMarcType(SelectMarc,out string errmesage); List Tmp = new List(ViewMarc.Split('\n')); for (int a = 0; a < Tmp.Count; a++) { diff --git a/unimarc/unimarc/마크/CD_LP_List.cs b/unimarc/unimarc/마크/CD_LP_List.cs index 3311550..89eeb83 100644 --- a/unimarc/unimarc/마크/CD_LP_List.cs +++ b/unimarc/unimarc/마크/CD_LP_List.cs @@ -272,7 +272,7 @@ namespace UniMarc.마크 else return; - richTextBox1.Text = st.ConvertMarcType(dataGridView1.Rows[row].Cells["Marc"].Value.ToString()); + richTextBox1.Text = st.ConvertMarcType(dataGridView1.Rows[row].Cells["Marc"].Value.ToString(),out string errmesage); } private void Btn_Excel_Click(object sender, EventArgs e) diff --git a/unimarc/unimarc/마크/Marc_Plan.cs b/unimarc/unimarc/마크/Marc_Plan.cs index 2870dc4..623e6a7 100644 --- a/unimarc/unimarc/마크/Marc_Plan.cs +++ b/unimarc/unimarc/마크/Marc_Plan.cs @@ -1,4 +1,5 @@ -using ExcelTest; +using AR; +using ExcelTest; using System; using System.Collections.Generic; using System.ComponentModel; @@ -106,11 +107,13 @@ namespace WindowsFormsApp1.Mac for (int a = 0; a < ary.Length; a++) { if (a % 16 == 00) { Grid[00] = ary[a]; } // idx - if (a % 16 == 01) { Grid[01] = ary[a]; - if (ary[a] == "") Grid[02] = tCnt.ToString(); + if (a % 16 == 01) + { + Grid[01] = ary[a]; + if (ary[a] == "") Grid[02] = tCnt.ToString(); tCnt++; } // num - if (a % 16 == 02) { Grid[02] = ary[a];} // r_num + if (a % 16 == 02) { Grid[02] = ary[a]; } // r_num if (a % 16 == 03) { Grid[03] = ary[a]; } // class_symbol if (a % 16 == 04) { Grid[04] = ary[a]; } // author_symbol if (a % 16 == 05) { Grid[09] = ary[a]; } // ISBN @@ -123,7 +126,9 @@ namespace WindowsFormsApp1.Mac 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 + if (a % 16 == 15) + { + Grid[19] = ary[a]; // marc string[] vcf = st.Take_Tag(ary[a], GetTag); Grid[5] = vcf[0]; @@ -189,7 +194,8 @@ namespace WindowsFormsApp1.Mac private void checkBox1_CheckedChanged(object sender, EventArgs e) { - foreach (DataGridViewRow r in dataGridView1.Rows) { + foreach (DataGridViewRow r in dataGridView1.Rows) + { if (((CheckBox)sender).Checked) r.Cells["colCheck"].Value = "T"; else @@ -204,7 +210,8 @@ namespace WindowsFormsApp1.Mac if (row < 0) return; - if (dataGridView1.Rows[row].Cells[col].ReadOnly) { + if (dataGridView1.Rows[row].Cells[col].ReadOnly) + { string[] Marc = { dataGridView1.Rows[row].Cells["marc"].Value.ToString(), dataGridView1.Rows[row].Cells["midx"].Value.ToString(), @@ -253,7 +260,8 @@ namespace WindowsFormsApp1.Mac private void tb_SearchTag_KeyDown(object sender, KeyEventArgs e) { - if (e.KeyCode == Keys.Enter) { + if (e.KeyCode == Keys.Enter) + { Search_Tag(); } } @@ -269,7 +277,7 @@ namespace WindowsFormsApp1.Mac 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,true); + string[] tag = st.Take_Tag(marc, SearchTag, true); dataGridView1.Rows[a].Cells["search_tag2"].Value = tag[0]; BackUpTag.Add(tag[0]); } @@ -296,10 +304,10 @@ namespace WindowsFormsApp1.Mac for (int a = 0; a < dataGridView1.Rows.Count; a++) { string Content = string.Empty; - if(dataGridView1.Rows[a].Cells["search_tag2"].Value!=null) + if (dataGridView1.Rows[a].Cells["search_tag2"].Value != null) Content = dataGridView1.Rows[a].Cells["search_tag2"].Value.ToString(); - else if(dataGridView1.Rows[a].Cells["search_tag2"].Value == null) - Content = "delete"; + else if (dataGridView1.Rows[a].Cells["search_tag2"].Value == null) + Content = "delete"; if (Content == "") continue; string marc = dataGridView1.Rows[a].Cells["marc"].Value.ToString(); string viewMarc = split_Marc(marc); @@ -319,7 +327,7 @@ namespace WindowsFormsApp1.Mac string newTag = string.Format("▼{0}{1}", TagName, Content); if (ConvertTag == 8) { - oldTag = BackUpTag[a]; + oldTag = BackUpTag[a]; newTag = Content; } // 해당 식별기호가 존재할 경우 @@ -435,7 +443,7 @@ namespace WindowsFormsApp1.Mac private void btn_Save_Click(object sender, EventArgs e) { string table = "Specs_Marc"; - string[] Edit_Col = { "marc", "r_num", "class_symbol", "author_symbol", "prefix","price", "user", "editDate" }; + string[] Edit_Col = { "marc", "r_num", "class_symbol", "author_symbol", "prefix", "price", "user", "editDate" }; string[] Where_Col = { "idx" }; for (int a = 0; a < dataGridView1.Rows.Count; a++) @@ -530,6 +538,7 @@ namespace WindowsFormsApp1.Mac default: break; } + string totalerrmsg = ""; for (int a = 0; a < dataGridView1.Rows.Count; a++) { if (dataGridView1.Rows[a].Cells["marc"].Value.ToString() == "" && @@ -539,14 +548,17 @@ namespace WindowsFormsApp1.Mac if (dataGridView1.Rows[a].Cells["colCheck"].Value.ToString() != "T") continue; - if (a==825) Console.WriteLine( "test" ); + if (a == 825) Console.WriteLine("test"); string marc = dataGridView1.Rows[a].Cells["Marc"].Value.ToString().Replace("₩", "\\"); - marc = st.ConvertMarcType(marc); + marc = st.ConvertMarcType(marc, out string errmesage); marc = st.made_Ori_marc(marc, FileEncodingType); - Marc_data += marc; + if (errmesage.isEmpty() == false) totalerrmsg += (totalerrmsg.isEmpty() ? "\n" : "") + errmesage; } + if (totalerrmsg.isEmpty() == false) + UTIL.MsgI("경고 발생\n"+totalerrmsg); + string FileName; SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Title = "저장 경로를 지정하세요."; @@ -555,15 +567,18 @@ namespace WindowsFormsApp1.Mac if (saveFileDialog.ShowDialog() == DialogResult.OK) { - if (FileEncodingType == "ANSI") { + if (FileEncodingType == "ANSI") + { FileName = saveFileDialog.FileName; System.IO.File.WriteAllText(FileName, Marc_data, Encoding.Default); } - else if (FileEncodingType == "UTF-8") { + else if (FileEncodingType == "UTF-8") + { FileName = saveFileDialog.FileName; System.IO.File.WriteAllText(FileName, Marc_data, Encoding.UTF8); } - else if (FileEncodingType == "UniCode") { + else if (FileEncodingType == "UniCode") + { FileName = saveFileDialog.FileName; System.IO.File.WriteAllText(FileName, Marc_data, Encoding.Unicode); } @@ -575,12 +590,17 @@ namespace WindowsFormsApp1.Mac private void btn_ApplyMacro_Click(object sender, EventArgs e) { Set_Macro sm = new Set_Macro(this, dataGridView1); - sm.ViewMarcArray = Make_MarcArray(); + sm.ViewMarcArray = Make_MarcArray(out string errmessage); sm.Show(); + if(errmessage.isEmpty() == false) + UTIL.MsgI("경고 발생\n" + errmessage); } private void btnTag040_Click(object sender, EventArgs e) { - string[] tData = Make_MarcArray(); + string[] tData = Make_MarcArray(out string errmessage); + if (errmessage.isEmpty() == false) + UTIL.MsgI("경고 발생\n" + errmessage); + string tNewTagData = tbTag040.Text; List tSplitMarc; for (int i = 0; i < tData.Length; i++) @@ -662,7 +682,7 @@ namespace WindowsFormsApp1.Mac tField.Add(data[a] + "▲"); } tTag008IDX = tTagNum.FindIndex(x => x == "008"); - if (tTag008IDX == -1 ) continue; + if (tTag008IDX == -1) continue; string tData = tField[tTag008IDX]; List tListData = tData.ToCharArray().ToList().ConvertAll(x => x.ToString()); if (tListData.Count < 40) continue; @@ -678,9 +698,10 @@ namespace WindowsFormsApp1.Mac MessageBox.Show("태그 일괄 적용 완료!"); } - - private string[] Make_MarcArray() + + private string[] Make_MarcArray(out string totalerrmsg) { + totalerrmsg = string.Empty; String_Text st = new String_Text(); string[] MarcArray = new string[dataGridView1.RowCount]; for (int a = 0; a < dataGridView1.Rows.Count; a++) @@ -693,8 +714,8 @@ namespace WindowsFormsApp1.Mac continue; string marc = dataGridView1.Rows[a].Cells["Marc"].Value.ToString().Replace("₩", "\\"); - marc = st.ConvertMarcType(marc); - + marc = st.ConvertMarcType(marc, out string errmesage); + if (errmesage.isEmpty() == false) totalerrmsg += (totalerrmsg.isEmpty() ? "\n" : "") + errmesage; MarcArray[a] = marc; } return MarcArray; @@ -754,7 +775,7 @@ namespace WindowsFormsApp1.Mac int row = e.RowIndex; int col = dataGridView1.CurrentCell.ColumnIndex; - if (col == 2 || col == 3 || col == 4 || col == 5 || col == 6 || col == 7|| col==17) + if (col == 2 || col == 3 || col == 4 || col == 5 || col == 6 || col == 7 || col == 17) { if (dataGridView1.Rows[row].Cells["num"].Value == null) { @@ -765,7 +786,7 @@ namespace WindowsFormsApp1.Mac { MessageBox.Show("저장된 마크가 없습니다!"); return; - } + } if (dataGridView1.Rows[row].Cells["marc"].Value.ToString() == "") { MessageBox.Show("저장된 마크가 없습니다!"); @@ -788,24 +809,26 @@ namespace WindowsFormsApp1.Mac string C = dataGridView1.Rows[row].Cells[6].Value.ToString(); string F = dataGridView1.Rows[row].Cells[7].Value.ToString(); - if (L != "") - L = string.Format("▼l{0}", L); + if (L != "") + L = string.Format("▼l{0}", L); - if (V != "") - V = string.Format("▼v{0}", V); + if (V != "") + V = string.Format("▼v{0}", V); - if (C != "") - C = string.Format("▼c{0}", C); + if (C != "") + C = string.Format("▼c{0}", C); - if (F != "") - F = string.Format("▼f{0}", F); + if (F != "") + F = string.Format("▼f{0}", F); - AddTag = string.Format("049\t \t{0}{1}{2}{3}▲", L, V, C, F); + AddTag = string.Format("049\t \t{0}{1}{2}{3}▲", L, V, C, F); - if (L == "" && V == "" && C == "" && F == "") { + if (L == "" && V == "" && C == "" && F == "") + { TypeView = st.RemoveTagNumber(TypeView, "049"); } - else { + else + { TypeView = AddTagInMarc(AddTag, TypeView); } } @@ -819,7 +842,8 @@ namespace WindowsFormsApp1.Mac string B = dataGridView1.Rows[row].Cells[4].Value.ToString(); string V = dataGridView1.Rows[row].Cells[5].Value.ToString(); - if (A != "") { + if (A != "") + { A = string.Format("▼a{0}", A); TypeView = st.ChangeTagInMarc("056a", A, TypeView); } @@ -832,10 +856,12 @@ namespace WindowsFormsApp1.Mac AddTag = string.Format("090\t \t{0}{1}{2}▲", A, B, V); - if (A == "" && B == "" && V == "") { + if (A == "" && B == "" && V == "") + { TypeView = st.RemoveTagNumber(TypeView, "090"); } - else { + else + { TypeView = AddTagInMarc(AddTag, TypeView); } } @@ -878,7 +904,7 @@ namespace WindowsFormsApp1.Mac List TagNum = new List(); // 태그번호 저장용 List Field = new List(); // 가변길이필드 저장용 - + // 특수기호 육안으로 확인하기 쉽게 변환 Marc = Marc.Replace("", "▼"); Marc = Marc.Replace("", "▲"); @@ -1018,7 +1044,7 @@ namespace WindowsFormsApp1.Mac int startCount = Convert.ToInt32(tb_StartPosition.Text); if (isMorePage) startCount = 0; - + int GridCount = 0; for (int SeroCount = 0; SeroCount < Sero; SeroCount++) { @@ -1037,7 +1063,7 @@ namespace WindowsFormsApp1.Mac UxPos += mmToInch(8); e.Graphics.DrawString(GridData[Cnt], F, Brushes.Black, UxPos + mmToInch(6), yPos + mmToInch(2), format); - + if (!chk_Num.Checked) e.Graphics.DrawString( dataGridView1.Rows[Cnt].Cells["reg_num"].Value.ToString(), @@ -1235,7 +1261,8 @@ namespace WindowsFormsApp1.Mac for (int b = 0; b < CheckList.GetLength(0); b++) { - if (WorkFix.IndexOf(CheckList[b, 0]) > -1) { + if (WorkFix.IndexOf(CheckList[b, 0]) > -1) + { dataGridView1.Rows[a].Cells[col].Style.BackColor = ColorList[Convert.ToInt32(CheckList[b, 1])]; break; } @@ -1360,7 +1387,8 @@ namespace WindowsFormsApp1.Mac { if (t == "") continue; - if (Target.IndexOf(t.TrimStart().TrimEnd()) > -1) { + if (Target.IndexOf(t.TrimStart().TrimEnd()) > -1) + { dataGridView1.Rows[a].Cells["search_tag2"].Style.BackColor = Color.Yellow; break; } diff --git a/unimarc/unimarc/마크/Marc_mkList.cs b/unimarc/unimarc/마크/Marc_mkList.cs index 3a99f06..e522bb2 100644 --- a/unimarc/unimarc/마크/Marc_mkList.cs +++ b/unimarc/unimarc/마크/Marc_mkList.cs @@ -189,7 +189,7 @@ namespace UniMarc.마크 if (Author_res[3].IndexOf("[외]") > -1) Author[0] = Marc[5]; - string tmp_ViewMarc = st.ConvertMarcType(insert_marc_data[14]); + string tmp_ViewMarc = st.ConvertMarcType(insert_marc_data[14],out string errmessage); // 마크에서 추출한 데이터 DB에 적용하기 위한 반복문 for (int b = 0; b < Marc.Length; b++)