미소장 전체가져오기 기능 정상화

This commit is contained in:
2026-02-20 16:17:17 +09:00
parent ed60319978
commit 82aa5a21d9
10 changed files with 163 additions and 158 deletions

View File

@@ -1582,32 +1582,20 @@ namespace UniMarc
if (fb.ShowDialog() == DialogResult.OK) if (fb.ShowDialog() == DialogResult.OK)
{ {
String_Text st = new String_Text(); String_Text st = new String_Text();
if (fb.BulkMarcResults.Count > 0) if (fb.FillBlankItems.Any(t => !string.IsNullOrEmpty(t.BookMarc)))
{ {
foreach (var kvp in fb.BulkMarcResults) foreach (var fbItem in fb.FillBlankItems)
{ {
int targetListIdx = kvp.Key; if (string.IsNullOrEmpty(fbItem.BookMarc)) continue;
foreach (DataGridViewRow r in List_Book.Rows)
{
// In legacy Marc.cs, finding row by index logic might be similar?
// Marc_FillBlank used 'idx' from 'List_idx' column in legacy logic too?
// Legacy code: int idx = Convert.ToInt32(dataGridView1.Rows[a].Cells["List_idx"].Value.ToString());
// And then: this.marc.List_Book.Rows[idx].Cells["db_marc"].Value = ...
// Wait, legacy used `Rows[idx]`. This implies `idx` IS the row index in List_Book?
// Let's assume it matches if we use the same index logic.
// In my refactor, I passed 'a' as first element of GridData if 'List_idx' col missing?
// In Marc.cs line 1579: `a.ToString()` is passed as first element.
// So `idx` in `BulkMarcResults` IS `a` (the row index).
// So we can directly access `List_Book.Rows[targetListIdx]`.
int targetListIdx = int.Parse(fbItem.Idx);
if (targetListIdx >= 0 && targetListIdx < List_Book.Rows.Count) if (targetListIdx >= 0 && targetListIdx < List_Book.Rows.Count)
{ {
List_Book.Rows[targetListIdx].Cells["db_marc"].Value = kvp.Value; List_Book.Rows[targetListIdx].Cells["db_marc"].Value = fbItem.BookMarc;
List_Book.Rows[targetListIdx].DefaultCellStyle.ForeColor = Color.Blue; List_Book.Rows[targetListIdx].DefaultCellStyle.ForeColor = Color.Blue;
} }
} }
} }
}
else if (!string.IsNullOrEmpty(fb.SingleMarcResult)) else if (!string.IsNullOrEmpty(fb.SingleMarcResult))
{ {
richTextBox1.Text = fb.SingleMarcResult; richTextBox1.Text = fb.SingleMarcResult;

View File

@@ -233,17 +233,23 @@ namespace UniMarc
if (Chk_Arr.Length < 2) //마크DB에서 데이터가 없다면? if (Chk_Arr.Length < 2) //마크DB에서 데이터가 없다면?
{ {
dr.Grade = "3"; //List_Book.Rows[a].Cells["grade"].Value = "3"; dr.Grade = "3"; //List_Book.Rows[a].Cells["grade"].Value = "3";
dr.ForeColor = Color.Red;//List_Book.Rows[a].DefaultCellStyle.ForeColor = Color.Red; dr.Status = MarcRecordStatus.None;
continue; continue;
} }
if (Chk_Arr[1] != mCompidx) if (Chk_Arr[1] != mCompidx)
{
isMyData = false; isMyData = false;
dr.Status = MarcRecordStatus.OtherCompany;
}
else
{
dr.Status = MarcRecordStatus.MyCompany;
}
string[] MarcData = { Chk_Arr[2], Chk_Arr[4], Chk_Arr[6] }; string[] MarcData = { Chk_Arr[2], Chk_Arr[4], Chk_Arr[6] };
string[] CheckData = { Chk_Arr[3], Chk_Arr[5], Chk_Arr[7] }; string[] CheckData = { Chk_Arr[3], Chk_Arr[5], Chk_Arr[7] };
dr.ForeColor = SetGradeColor(Chk_Arr[8], isMyData); // Temporary, chk_Marc updates item below
dr.MarcIdx = Chk_Arr[0]; //List_Book.Rows[a].Cells["marc_idx"].Value = Chk_Arr[0]; dr.MarcIdx = Chk_Arr[0]; //List_Book.Rows[a].Cells["marc_idx"].Value = Chk_Arr[0];
dr.DbMarc = MarcData[0];// List_Book.Rows[a].Cells["db_marc"].Value = MarcData[0];//NewestMarc(MarcData, CheckData); dr.DbMarc = MarcData[0];// List_Book.Rows[a].Cells["db_marc"].Value = MarcData[0];//NewestMarc(MarcData, CheckData);
dr.Grade = Chk_Arr[8];// List_Book.Rows[a].Cells["grade"].Value = Chk_Arr[8]; dr.Grade = Chk_Arr[8];// List_Book.Rows[a].Cells["grade"].Value = Chk_Arr[8];
@@ -251,12 +257,6 @@ namespace UniMarc
dr.User = Chk_Arr[10];// List_Book.Rows[a].Cells["user"].Value = Chk_Arr[10]; dr.User = Chk_Arr[10];// List_Book.Rows[a].Cells["user"].Value = Chk_Arr[10];
dr.SaveDate = Chk_Arr[11];// List_Book.Rows[a].Cells["SaveDate"].Value = Chk_Arr[11]; dr.SaveDate = Chk_Arr[11];// List_Book.Rows[a].Cells["SaveDate"].Value = Chk_Arr[11];
//var item = List_Book.Rows[a].DataBoundItem as MarcBookItem;
Color gradeColor = SetGradeColor(Chk_Arr[8], isMyData);
dr.ForeColor = gradeColor;
//if (item != null) item.ForeColor = gradeColor;
//List_Book.Rows[a].DefaultCellStyle.ForeColor = gradeColor;
if (isMyData) if (isMyData)
{ {
Color saveColor = GetSaveDateColor(Chk_Arr[11]); Color saveColor = GetSaveDateColor(Chk_Arr[11]);
@@ -285,30 +285,6 @@ namespace UniMarc
return result; return result;
} }
private Color SetGradeColor(string Grade, bool isMyData = true)
{
if (!isMyData)
return Color.Orange;
switch (Grade)
{
case "0": // A
return Color.Blue;
case "1": // B
return Color.Black;
case "2": // C
return Color.Gray;
case "3": // D
return Color.DarkViolet;
default:
return Color.Black;
}
}
/// <summary> /// <summary>
/// 마지막 저장시각 14일이전일 경우 배경 색 변경 /// 마지막 저장시각 14일이전일 경우 배경 색 변경
/// </summary> /// </summary>
@@ -549,7 +525,7 @@ namespace UniMarc
row.DbMarc = GridData[6]; row.DbMarc = GridData[6];
mOldMarc = GridData[6]; mOldMarc = GridData[6];
row.ForeColor = SetGradeColor(row.Grade); // row.ForeColor = SetGradeColor(row.Grade); // Handled by MarcBookItem automatically
row.BackColor = Color.Yellow; row.BackColor = Color.Yellow;
var currentitem = this.bs1.Current as MarcBookItem; var currentitem = this.bs1.Current as MarcBookItem;
@@ -570,14 +546,14 @@ namespace UniMarc
string newsavedMarc = e.DBMarc; string newsavedMarc = e.DBMarc;
//string Midx = item.MarcIdx; //string Midx = item.MarcIdx;
// 1. DB 작업 (저장 전략 결정: Foreground 색상 기준) // 1. DB 작업 (저장 전략 결정: Status 기준)
if (item.ForeColor == Color.Orange || item.ForeColor == Color.Red) if (item.Status == MarcRecordStatus.OtherCompany || item.Status == MarcRecordStatus.None)
{ {
string[] Insert_tbl = { "ISBN", "서명", "저자", "출판사", "가격", "marc", "비고1", "비고2", "url", "grade", "marc_chk", "user", "division", "008tag", "date", "compidx" }; string[] Insert_tbl = { "ISBN", "서명", "저자", "출판사", "가격", "marc", "비고1", "비고2", "url", "grade", "marc_chk", "user", "division", "008tag", "date", "compidx" };
string[] Insert_col = { e.Param.ISBN13, e.Param.BookName, e.Param.Author, e.Param.Publisher, e.Param.Price, newsavedMarc, e.Param.Remark1, e.Param.Remark2, e.Param.URL, e.Param.Grade, "1", mUserName, e.Param.tag056, e.Param.text008, date, mCompidx }; string[] Insert_col = { e.Param.ISBN13, e.Param.BookName, e.Param.Author, e.Param.Publisher, e.Param.Price, newsavedMarc, e.Param.Remark1, e.Param.Remark2, e.Param.URL, e.Param.Grade, "1", mUserName, e.Param.tag056, e.Param.text008, date, mCompidx };
string Incmd = db.DB_INSERT(table_name, Insert_tbl, Insert_col); string Incmd = db.DB_INSERT(table_name, Insert_tbl, Insert_col);
PUB.log.Add("INSERT", string.Format("{0}({1},{2}) : {3}", mUserName, mCompidx, item.ForeColor, Incmd)); PUB.log.Add("INSERT", string.Format("{0}({1},{2}) : {3}", mUserName, mCompidx, item.Status, Incmd));
long newIdx = db.DB_Send_CMD_Insert_GetIdx(Incmd); long newIdx = db.DB_Send_CMD_Insert_GetIdx(Incmd);
if (newIdx > 0) if (newIdx > 0)
@@ -595,16 +571,12 @@ namespace UniMarc
if (string.IsNullOrEmpty(e.Param.ISBN13)) { MessageBox.Show("ISBN 데이터가 없습니다."); return; } if (string.IsNullOrEmpty(e.Param.ISBN13)) { MessageBox.Show("ISBN 데이터가 없습니다."); return; }
string U_cmd = db.More_Update(table_name, Edit_tbl, Edit_col, Sear_tbl, Sear_col); string U_cmd = db.More_Update(table_name, Edit_tbl, Edit_col, Sear_tbl, Sear_col);
PUB.log.Add("Update", string.Format("{0}({1},{2}) : {3}", mUserName, mCompidx, item.ForeColor, U_cmd.Replace("\r", " ").Replace("\n", " "))); PUB.log.Add("Update", string.Format("{0}({1},{2}) : {3}", mUserName, mCompidx, item.Status, U_cmd.Replace("\r", " ").Replace("\n", " ")));
Helper_DB.ExcuteNonQuery(U_cmd); Helper_DB.ExcuteNonQuery(U_cmd);
} }
// 2. 객체 데이터 업데이트 및 시각적 상태 계산 // 2. 객체 데이터 업데이트 및 시각적 상태 계산
item.Grade = e.Param.Grade; item.Status = MarcRecordStatus.MyCompany;
item.SaveDate = date;
item.User = mUserName;
item.DbMarc = e.DBMarc;
item.ForeColor = SetGradeColor(item.Grade);
item.BackColor = GetSaveDateColor(date); item.BackColor = GetSaveDateColor(date);
// 3. 목록 인덱스 연동 업데이트 (Obj_List_Book) // 3. 목록 인덱스 연동 업데이트 (Obj_List_Book)
@@ -658,47 +630,40 @@ namespace UniMarc
} }
var fb = new Marc_FillBlank(); var fb = new Marc_FillBlank();
for (int a = 0; a < List_Book.Rows.Count; a++) for (int a = 0; a < bs1.Count; a++)
{ {
if (List_Book.Rows[a].DefaultCellStyle.ForeColor == Color.Red) var item = bs1.List[a] as MarcBookItem;
if (item != null && item.Status == MarcRecordStatus.None)
{ {
var item = new FillBlankItem var fbItem = new FillBlankItem
{ {
Idx = a.ToString(), Idx = item.ListIdx,
Isbn = List_Book.Rows[a].Cells["ISBN13"].Value?.ToString() ?? "", Isbn = item.ISBN13 ?? "",
BookName = List_Book.Rows[a].Cells["book_name"].Value?.ToString() ?? "", BookName = item.BookName ?? "",
Author = List_Book.Rows[a].Cells["author"].Value?.ToString() ?? "", Author = item.Author ?? "",
Publisher = List_Book.Rows[a].Cells["book_comp"].Value?.ToString() ?? "", Publisher = item.BookComp ?? "",
Price = List_Book.Rows[a].Cells["pay"].Value?.ToString() ?? "" Price = item.Pay ?? ""
}; };
fb.InitFillBlank(item); fb.InitFillBlank(fbItem);
} }
} }
fb.ISBN = ISBN; fb.ISBN = ISBN;
if (fb.ShowDialog() == DialogResult.OK) if (fb.ShowDialog() == DialogResult.OK)
{ {
String_Text st = new String_Text(); String_Text st = new String_Text();
if (fb.BulkMarcResults.Count > 0) if (fb.FillBlankItems.Any(t => !string.IsNullOrEmpty(t.BookMarc)))
{ {
foreach (var kvp in fb.BulkMarcResults) foreach (var fbItem in fb.FillBlankItems)
{ {
// Use list_idx to find row? Or assume key matches? if (string.IsNullOrEmpty(fbItem.BookMarc)) continue;
// Marc_FillBlank used 'idx' from 'List_idx' column.
// We need to iterate List_Book to find matching List_idx or if key is row index? int targetListIdx = int.Parse(fbItem.Idx);
// In Marc_FillBlank, I stored 'idx' which was from 'List_idx'. foreach (MarcBookItem item in this.dataList)
// Key = List_idx.
int targetListIdx = kvp.Key;
// Find row with this list_idx
foreach (DataGridViewRow r in List_Book.Rows)
{ {
if (r.Cells["List_idx"].Value != null && Convert.ToInt32(r.Cells["List_idx"].Value) == targetListIdx) if (item.ListIdx != null && Convert.ToInt32(item.ListIdx) == targetListIdx)
{ {
r.Cells["db_marc"].Value = kvp.Value; item.DbMarc = fbItem.BookMarc;
// Update color etc? item.Status = MarcRecordStatus.NewFetched;
r.DefaultCellStyle.ForeColor = Color.Blue;
// Need to update 'item' too if bound
var item = r.DataBoundItem as MarcBookItem;
if (item != null) item.ForeColor = Color.Blue;
break; break;
} }
} }
@@ -731,7 +696,8 @@ namespace UniMarc
/// <returns></returns> /// <returns></returns>
public bool Check_BackColor(int row) public bool Check_BackColor(int row)
{ {
if (List_Book.Rows[row].DefaultCellStyle.ForeColor != Color.Red) var item = bs1.List[row] as MarcBookItem;
if (item != null && item.Status != MarcRecordStatus.None)
return true; return true;
return false; return false;

View File

@@ -5,6 +5,14 @@ using System.Text;
namespace UniMarc namespace UniMarc
{ {
public enum MarcRecordStatus
{
None, // No record in DB (Red)
OtherCompany, // Found but not ours (Orange)
MyCompany, // Found and ours (Black/Blue etc.)
NewFetched // Temporary status after external search (Blue)
}
public class MarcBookItem public class MarcBookItem
{ {
public string ListIdx { get; set; } public string ListIdx { get; set; }
@@ -18,12 +26,62 @@ namespace UniMarc
public string Url { get; set; } public string Url { get; set; }
public string MarcIdx { get; set; } public string MarcIdx { get; set; }
public string DbMarc { get; set; } public string DbMarc { get; set; }
public string Grade { get; set; } private MarcRecordStatus _status = MarcRecordStatus.None;
public MarcRecordStatus Status
{
get => _status;
set { _status = value; ApplySyncColor(); }
}
private string _grade = "";
public string Grade
{
get => _grade;
set { _grade = value; ApplySyncColor(); }
}
public string ColCheck { get; set; } = "V"; public string ColCheck { get; set; } = "V";
public string User { get; set; } public string User { get; set; }
public string SaveDate { get; set; } public string SaveDate { get; set; }
public System.Drawing.Color ForeColor { get; set; } = System.Drawing.Color.Black; public System.Drawing.Color ForeColor { get; set; } = System.Drawing.Color.Black;
public System.Drawing.Color BackColor { get; set; } = System.Drawing.Color.White; public System.Drawing.Color BackColor { get; set; } = System.Drawing.Color.White;
private void ApplySyncColor()
{
if (Status == MarcRecordStatus.None)
{
ForeColor = System.Drawing.Color.Red;
}
else if (Status == MarcRecordStatus.OtherCompany)
{
ForeColor = System.Drawing.Color.Orange;
}
else if (Status == MarcRecordStatus.NewFetched)
{
ForeColor = System.Drawing.Color.Blue;
}
else if (Status == MarcRecordStatus.MyCompany)
{
switch (Grade)
{
case "0": // A
ForeColor = System.Drawing.Color.Blue;
break;
case "1": // B
ForeColor = System.Drawing.Color.Black;
break;
case "2": // C
ForeColor = System.Drawing.Color.Gray;
break;
case "3": // D
ForeColor = System.Drawing.Color.DarkViolet;
break;
default:
ForeColor = System.Drawing.Color.Black;
break;
}
}
}
} }
} }

View File

@@ -54,10 +54,9 @@ namespace UniMarc
this.BookComp = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.BookComp = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Price = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Price = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.BookMarc = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.BookMarc = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.panel2 = new System.Windows.Forms.Panel();
this.bs1 = new System.Windows.Forms.BindingSource(this.components);
this.bn1 = new System.Windows.Forms.BindingNavigator(this.components); this.bn1 = new System.Windows.Forms.BindingNavigator(this.components);
this.bindingNavigatorAddNewItem = new System.Windows.Forms.ToolStripButton(); this.bindingNavigatorAddNewItem = new System.Windows.Forms.ToolStripButton();
this.bs1 = new System.Windows.Forms.BindingSource(this.components);
this.bindingNavigatorCountItem = new System.Windows.Forms.ToolStripLabel(); this.bindingNavigatorCountItem = new System.Windows.Forms.ToolStripLabel();
this.bindingNavigatorDeleteItem = new System.Windows.Forms.ToolStripButton(); this.bindingNavigatorDeleteItem = new System.Windows.Forms.ToolStripButton();
this.bindingNavigatorMoveFirstItem = new System.Windows.Forms.ToolStripButton(); this.bindingNavigatorMoveFirstItem = new System.Windows.Forms.ToolStripButton();
@@ -68,16 +67,17 @@ namespace UniMarc
this.bindingNavigatorMoveNextItem = new System.Windows.Forms.ToolStripButton(); this.bindingNavigatorMoveNextItem = new System.Windows.Forms.ToolStripButton();
this.bindingNavigatorMoveLastItem = new System.Windows.Forms.ToolStripButton(); this.bindingNavigatorMoveLastItem = new System.Windows.Forms.ToolStripButton();
this.bindingNavigatorSeparator2 = new System.Windows.Forms.ToolStripSeparator(); this.bindingNavigatorSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.panel2 = new System.Windows.Forms.Panel();
this.panel6.SuspendLayout(); this.panel6.SuspendLayout();
this.panel3.SuspendLayout(); this.panel3.SuspendLayout();
this.panel4.SuspendLayout(); this.panel4.SuspendLayout();
this.panel7.SuspendLayout(); this.panel7.SuspendLayout();
this.panel5.SuspendLayout(); this.panel5.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.bs1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.bn1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.bn1)).BeginInit();
this.bn1.SuspendLayout(); this.bn1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.bs1)).BeginInit();
this.panel2.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// panel6 // panel6
@@ -249,7 +249,7 @@ namespace UniMarc
this.dataGridView1.Name = "dataGridView1"; this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.ReadOnly = true; this.dataGridView1.ReadOnly = true;
this.dataGridView1.RowTemplate.Height = 23; this.dataGridView1.RowTemplate.Height = 23;
this.dataGridView1.Size = new System.Drawing.Size(531, 677); this.dataGridView1.Size = new System.Drawing.Size(425, 542);
this.dataGridView1.TabIndex = 0; this.dataGridView1.TabIndex = 0;
this.dataGridView1.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellClick); this.dataGridView1.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellClick);
// //
@@ -301,17 +301,6 @@ namespace UniMarc
this.BookMarc.ReadOnly = true; this.BookMarc.ReadOnly = true;
this.BookMarc.Visible = false; this.BookMarc.Visible = false;
// //
// panel2
//
this.panel2.Controls.Add(this.panel4);
this.panel2.Controls.Add(this.panel3);
this.panel2.Controls.Add(this.panel6);
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel2.Location = new System.Drawing.Point(0, 0);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(1316, 733);
this.panel2.TabIndex = 311;
//
// bn1 // bn1
// //
this.bn1.AddNewItem = this.bindingNavigatorAddNewItem; this.bn1.AddNewItem = this.bindingNavigatorAddNewItem;
@@ -351,6 +340,10 @@ namespace UniMarc
this.bindingNavigatorAddNewItem.Size = new System.Drawing.Size(23, 22); this.bindingNavigatorAddNewItem.Size = new System.Drawing.Size(23, 22);
this.bindingNavigatorAddNewItem.Text = "새로 추가"; this.bindingNavigatorAddNewItem.Text = "새로 추가";
// //
// bs1
//
this.bs1.CurrentChanged += new System.EventHandler(this.bs1_CurrentChanged);
//
// bindingNavigatorCountItem // bindingNavigatorCountItem
// //
this.bindingNavigatorCountItem.Name = "bindingNavigatorCountItem"; this.bindingNavigatorCountItem.Name = "bindingNavigatorCountItem";
@@ -428,6 +421,17 @@ namespace UniMarc
this.bindingNavigatorSeparator2.Name = "bindingNavigatorSeparator2"; this.bindingNavigatorSeparator2.Name = "bindingNavigatorSeparator2";
this.bindingNavigatorSeparator2.Size = new System.Drawing.Size(6, 25); this.bindingNavigatorSeparator2.Size = new System.Drawing.Size(6, 25);
// //
// panel2
//
this.panel2.Controls.Add(this.panel4);
this.panel2.Controls.Add(this.panel3);
this.panel2.Controls.Add(this.panel6);
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel2.Location = new System.Drawing.Point(0, 0);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(1316, 733);
this.panel2.TabIndex = 311;
//
// Marc_FillBlank // Marc_FillBlank
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
@@ -446,11 +450,11 @@ namespace UniMarc
this.panel5.ResumeLayout(false); this.panel5.ResumeLayout(false);
this.panel5.PerformLayout(); this.panel5.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
this.panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.bs1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.bn1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.bn1)).EndInit();
this.bn1.ResumeLayout(false); this.bn1.ResumeLayout(false);
this.bn1.PerformLayout(); this.bn1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.bs1)).EndInit();
this.panel2.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
} }

View File

@@ -15,7 +15,7 @@ namespace UniMarc
{ {
public string ISBN; public string ISBN;
public string SingleMarcResult { get; private set; } public string SingleMarcResult { get; private set; }
public Dictionary<int, string> BulkMarcResults { get; private set; } = new Dictionary<int, string>(); public List<FillBlankItem> FillBlankItems => _items;
bool isAll; bool isAll;
bool isBreak; bool isBreak;
List<FillBlankItem> _items = new List<FillBlankItem>(); List<FillBlankItem> _items = new List<FillBlankItem>();
@@ -207,7 +207,7 @@ namespace UniMarc
if (tb_URL.Text.Contains(isbn)) if (tb_URL.Text.Contains(isbn))
{ {
item.BookMarc = SplitText(Text); item.BookMarc = st.made_Ori_marc(MakeMarc(SplitText(Text)));
bs1.ResetBindings(false); // Update grid view bs1.ResetBindings(false); // Update grid view
isBreak = true; isBreak = true;
} }
@@ -279,7 +279,6 @@ namespace UniMarc
progressBar1.Maximum = dataGridView1.Rows.Count; progressBar1.Maximum = dataGridView1.Rows.Count;
isAll = true; isAll = true;
BulkMarcResults.Clear();
for (int a = 0; a < bs1.Count; a++) for (int a = 0; a < bs1.Count; a++)
{ {
@@ -306,18 +305,14 @@ namespace UniMarc
// 검색이 다 될때까지 기다림 // 검색이 다 될때까지 기다림
while (!isBreak) while (!isBreak)
{ {
Delay(300); Delay(500);
} }
string marc = item.BookMarc; if (string.IsNullOrEmpty(item.BookMarc))
if (string.IsNullOrEmpty(marc))
dataGridView1.Rows[a].DefaultCellStyle.ForeColor = Color.Red; dataGridView1.Rows[a].DefaultCellStyle.ForeColor = Color.Red;
else else
{ {
dataGridView1.Rows[a].DefaultCellStyle.ForeColor = Color.Blue; dataGridView1.Rows[a].DefaultCellStyle.ForeColor = Color.Blue;
string processedMarc = st.made_Ori_marc(MakeMarc(marc));
if (!BulkMarcResults.ContainsKey(idx))
BulkMarcResults.Add(idx, processedMarc);
} }
dataGridView1.Rows[a].DefaultCellStyle.BackColor = Color.White; dataGridView1.Rows[a].DefaultCellStyle.BackColor = Color.White;
@@ -368,13 +363,19 @@ namespace UniMarc
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{ {
if (e.RowIndex < 0) }
return;
int row = e.RowIndex; private void bs1_CurrentChanged(object sender, EventArgs e)
{
var item = (FillBlankItem)bs1.Current; //bookmark 데이터를 tbBookMark 에 표시
if (bs1.Current is FillBlankItem item)
{
richTextBox1.Text = item.BookMarc; richTextBox1.Text = item.BookMarc;
} }
else
{
richTextBox1.Text = "";
}
}
} }
} }

View File

@@ -145,7 +145,7 @@
<data name="bindingNavigatorAddNewItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="bindingNavigatorAddNewItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wAAADsABataJCQAAAVdJREFUOE/Nz0tLAmEUBmB3kWRoCUVEISFUJGb1OywiKrDsIpZdkJAkDUvDQkij vgAADr4B6kKxwAAAAVdJREFUOE/Nz0tLAmEUBmB3kWRoCUVEISFUJGb1OywiKrDsIpZdkJAkDUvDQkij
UKSbVIvatKhNi9oERRAGEQXhjJdp7Hd83/eGs2jhLGQ20QtndTgP71Gp/m0KZ1XInlTjM6XG+4EG5fuK UKSbVIvatKhNi9oERRAGEQXhjJdp7Hd83/eGs2jhLGQ20QtndTgP71Gp/m0KZ1XInlTjM6XG+4EG5fuK
yaTUIN8bIMUQ0gmtcuBtX/MLPMT0yoHnuA6kuA4iruI20lAZ+DiswWuyFum4Dk+7dbiP6kHEFVDBg+tQ yaTUIN8bIMUQ0gmtcuBtX/MLPMT0yoHnuA6kuA4iruI20lAZ+DiswWuyFum4Dk+7dbiP6kHEFVDBg+tQ
My4DLbjwG3DqbcORxygHXxJakGIQRFwDEf0gwjKI4AYtzIHmHaA5Oxg/CsYPIb7YIQced+qluvTLCyIs My4DLbjwG3DqbcORxygHXxJakGIQRFwDEf0gwjKI4AYtzIHmHaA5Oxg/CsYPIb7YIQced+qluvTLCyIs
@@ -160,7 +160,7 @@
<data name="bindingNavigatorDeleteItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="bindingNavigatorDeleteItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wAAADsABataJCQAAAWtJREFUOE+1kE0ow2Ecx/9X5a2UiwtKOSCTmJBMhuQlMo3IvCUHDouEXHZwIOVC vgAADr4B6kKxwAAAAWtJREFUOE+1kE0ow2Ecx/9X5a2UiwtKOSCTmJBMhuQlMo3IvCUHDouEXHZwIOVC
DrhIDiQl5USy07zNa2tKf2laaRf84/J8xBCetab4XL/f76fn+SnKX4DrGLqrwbHDzywkWJlHdJYjLEbY DrhIDiQl5USy07zNa2tKf2laaRf84/J8xBCetab4XL/f76fn+SnKX4DrGLqrwbHDzywkWJlHdJYjLEbY
Wg8q4eYKlma+d1hbgF4TotWIaC+FuYmAktcXCksx2HrknBOHX1KbiTDngrXhW0kMdSBM2TA5Io+/wuI0 Wg8q4eYKlma+d1hbgF4TotWIaC+FuYmAktcXCksx2HrknBOHX1KbiTDngrXhW0kMdSBM2TA5Io+/wuI0
oiz5TcRwB7hPYazfLx3rDz7+gCsXNBb4v1SdgajTQ19TaOMP2NtFmPSIilSo0v1y7FHBnAdZMWi6aO51 oiz5TcRwB7hPYazfLx3rDz7+gCsXNBb4v1SdgajTQ19TaOMP2NtFmPSIilSo0v1y7FHBnAdZMWi6aO51
@@ -172,7 +172,7 @@
<data name="bindingNavigatorMoveFirstItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="bindingNavigatorMoveFirstItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wAAADsABataJCQAAATFJREFUOE9jYBg0oHDW8/9NC57/z5z4+D+6HAyEtz/AKceQO/PZ/1VH3v/HpSi+ vgAADr4B6kKxwAAAATFJREFUOE9jYBg0oHDW8/9NC57/z5z4+D+6HAyEtz/AKceQO/PZ/1VH3v/HpSi+
+8H/4IZrWOXAIGPK0/8L933Aqii+5+H/pfv///evvoAhBwcJPU/+T9vyHkNRRPt9sObMWf//e5WewG1A +8H/4IZrWOXAIGPK0/8L933Aqii+5+H/pfv///evvoAhBwcJPU/+T9vyHkNRRPt9sObMWf//e5WewG1A
ZNej/72rP6AoCm29B9bcuu7/f//Ov/9d8g/gNiCw+eH/uvnv4IqCW+7+X7T3//+Odf//Z8z5+d+u7ud/ ZNej/72rP6AoCm29B9bcuu7/f//Ov/9d8g/gNiCw+eH/uvnv4IqCW+7+X7T3//+Odf//Z8z5+d+u7ud/
+4ztuA3wqLr/P3/aGxRFdsW3/6fP+f3fv+vbf53Cd/8tEtbjNsC+9O7/7MmvMRTpp5z/b1L04r9K1qf/ +4ztuA3wqLr/P3/aGxRFdsW3/6fP+f3fv+vbf53Cd/8tEtbjNsC+9O7/7MmvMRTpp5z/b1L04r9K1qf/
@@ -183,7 +183,7 @@
<data name="bindingNavigatorMovePreviousItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="bindingNavigatorMovePreviousItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wAAADsABataJCQAAALtJREFUOE9jYBgyILz9wX90MaJBfPeD/8EN18gzIL7n4f+l+///96++QLoBEe33 vgAADr4B6kKxwAAAALtJREFUOE9jYBgyILz9wX90MaJBfPeD/8EN18gzIL7n4f+l+///96++QLoBEe33
wZozZ/3/71V6gjQDQlvvgTW3rvv/37/z73+X/APEGxDccvf/or3//3es+/8/Y87P/3Z1P//bZ2wn3gAQ wZozZ/3/71V6gjQDQlvvgTW3rvv/37/z73+X/APEGxDccvf/or3//3es+/8/Y87P/3Z1P//bZ2wn3gAQ
sCu+/T99zu///l3f/usUvvtvkbCeNANAQD/l/H+Tohf/VbI+/TeOXEa6ASBgkHTiv2za1/+6wfPIMwAE sCu+/T99zu///l3f/usUvvtvkbCeNANAQD/l/H+Tohf/VbI+/TeOXEa6ASBgkHTiv2za1/+6wfPIMwAE
9FMv/9fwnUa+ASCg4jGBMgMGLwAA0BRgmCws/7cAAAAASUVORK5CYII= 9FMv/9fwnUa+ASCg4jGBMgMGLwAA0BRgmCws/7cAAAAASUVORK5CYII=
@@ -192,7 +192,7 @@
<data name="bindingNavigatorMoveNextItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="bindingNavigatorMoveNextItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wAAADsABataJCQAAAKRJREFUOE9jYBh0oHDW8//oYiSB3JnP/id03yPfkIwpT//P2//7f0LXHfIMSeh5 vgAADr4B6kKxwAAAAKRJREFUOE9jYBh0oHDW8//oYiSB3JnP/id03yPfkIwpT//P2//7f0LXHfIMSeh5
8n/2vl//O7f+/e9Wepl0QyK7Hv2fsu3X/5Klf/8nTP/73yb3LGmGBDY//N+69j1Ys3HJl//S0df+G0cu 8n/2vl//O7f+/e9Wepl0QyK7Hv2fsu3X/5Klf/8nTP/73yb3LGmGBDY//N+69j1Ys3HJl//S0df+G0cu
I94Qj6r7/0vmvoNrVnTpIV4zCNiX3v0f2PKMPM0gYJF3579NwRXyNIOAYdZt8jWDgE7aDfI1D00AAKB+ I94Qj6r7/0vmvoNrVnTpIV4zCNiX3v0f2PKMPM0gYJF3579NwRXyNIOAYdZt8jWDgE7aDfI1D00AAKB+
X6Bjq5qXAAAAAElFTkSuQmCC X6Bjq5qXAAAAAElFTkSuQmCC
@@ -201,7 +201,7 @@
<data name="bindingNavigatorMoveLastItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="bindingNavigatorMoveLastItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wAAADsABataJCQAAAStJREFUOE9jYBhUoHDW8//oYjAAkmta8Px/5sTHONUw5M589j+h+x5WBSC5VUfe vgAADr4B6kKxwAAAAStJREFUOE9jYBhUoHDW8//oYjAAkmta8Px/5sTHONUw5M589j+h+x5WBSC5VUfe
/w9vf4BVHgwypjz9P2//7/8JXXcwFIHkFu778D+44RqGHBwk9Dz5P3vfr/+dW//+dyu9jKIQJDdty/v/ /w9vf4BVHgwypjz9P2//7/8JXXcwFIHkFu778D+44RqGHBwk9Dz5P3vfr/+dW//+dyu9jKIQJDdty/v/
/tUXcBsQ2fXo/5Rtv/6XLP37P2H63/82uWfhikFyvas//PcqPYHbgMDmh/9b174HazYu+fJfOvraf+PI /tUXcBsQ2fXo/5Rtv/6XLP37P2H63/82uWfhikFyvas//PcqPYHbgMDmh/9b174HazYu+fJfOvraf+PI
ZWANILm6+e/+u+QfwG2AR9X9/yVz38E1K7r0wBWD5PKnvflvn7EdtwH2pXf/B7Y8w9AMk8ue/Pq/RcJ6 ZWANILm6+e/+u+QfwG2AR9X9/yVz38E1K7r0wBWD5PKnvflvn7EdtwH2pXf/B7Y8w9AMk8ue/Pq/RcJ6

View File

@@ -413,17 +413,15 @@ namespace UniMarc
f.BulkBooksUpdated += (s, args) => f.BulkBooksUpdated += (s, args) =>
{ {
foreach (var kvp in args.Updates) foreach (var fbItem in args.Updates)
{ {
int rowIdx = kvp.Key; if (string.IsNullOrEmpty(fbItem.BookMarc)) continue;
string newMarc = kvp.Value;
// Ensure rowIdx is valid int rowIdx = int.Parse(fbItem.Idx);
if (rowIdx >= 0 && rowIdx < bs1.Count) if (rowIdx >= 0 && rowIdx < bs1.Count)
{ {
var mItem = (MarcPlanItem)bs1.List[rowIdx]; var mItem = (MarcPlanItem)bs1.List[rowIdx];
mItem.Marc = newMarc; mItem.Marc = fbItem.BookMarc;
// We might want to refresh specific rows or all, simpler to reset item or all
} }
} }
bs1.ResetBindings(false); // Refresh all to reflect changes bs1.ResetBindings(false); // Refresh all to reflect changes

View File

@@ -76,23 +76,13 @@ namespace UniMarc
if (fb.ShowDialog() == DialogResult.OK) if (fb.ShowDialog() == DialogResult.OK)
{ {
// Handle results BulkBooksUpdated?.Invoke(this, new BulkBookUpdatedEventArgs { Updates = fb.FillBlankItems });
// We don't have direct access to 'BulkMarcResults' here easily unless we iterate.
// But wait, BookUpdated event is for single update.
// Marc_Plan expects 'RequestFillBlankData' to handle the *opening*, but it doesn't handle the *return* logic for bulk updates within Marc_Plan.
// The current architecture: Marc_Plan_Sub_MarcEdit2 raises RequestFillBlankData -> Marc_Plan calls OpenFillBlank.
// So now OpenFillBlank is running. When it returns, we have data.
// We need to pass this data BACK to Marc_Plan.
// I will add a 'BulkBooksUpdated' event or reuse 'BookUpdated' (but BookUpdated is single).
// Let's create 'BulkBooksUpdated'.
BulkBooksUpdated?.Invoke(this, new BulkBookUpdatedEventArgs { Updates = fb.BulkMarcResults });
} }
} }
public class BulkBookUpdatedEventArgs : EventArgs public class BulkBookUpdatedEventArgs : EventArgs
{ {
public Dictionary<int, string> Updates { get; set; } public List<FillBlankItem> Updates { get; set; }
} }
public event EventHandler<BulkBookUpdatedEventArgs> BulkBooksUpdated; public event EventHandler<BulkBookUpdatedEventArgs> BulkBooksUpdated;

View File

@@ -382,7 +382,7 @@ namespace UniMarc
foreach (MarcBookItem item in marc2.dataList) // for (int a = 0; a < marc2.List_Book.Rows.Count; a++) foreach (MarcBookItem item in marc2.dataList) // for (int a = 0; a < marc2.List_Book.Rows.Count; a++)
{ {
bool isSuccess = true; bool isSuccess = true;
if (item.ForeColor == Color.Red && item.ColCheck=="V")// marc2.Check_List_V(a)) //빨간색이고 체크된거는 제외? if (item.Status == MarcRecordStatus.None && item.ColCheck == "V")
isSuccess = false; isSuccess = false;
if (isSuccess) if (isSuccess)

View File

@@ -437,15 +437,15 @@ namespace UniMarc
me.BulkBooksUpdated += (s, args) => me.BulkBooksUpdated += (s, args) =>
{ {
foreach (var kvp in args.Updates) foreach (var fbItem in args.Updates)
{ {
int rowIdx = kvp.Key; if (string.IsNullOrEmpty(fbItem.BookMarc)) continue;
string newMarc = kvp.Value;
int rowIdx = int.Parse(fbItem.Idx);
if (rowIdx >= 0 && rowIdx < bs1.Count) if (rowIdx >= 0 && rowIdx < bs1.Count)
{ {
var mItem = (SearchInforItem)bs1.List[rowIdx]; var mItem = (SearchInforItem)bs1.List[rowIdx];
mItem.Marc = newMarc; mItem.Marc = fbItem.BookMarc;
} }
} }
bs1.ResetBindings(false); bs1.ResetBindings(false);
@@ -675,15 +675,15 @@ namespace UniMarc
me.BulkBooksUpdated += (s, args) => me.BulkBooksUpdated += (s, args) =>
{ {
foreach (var kvp in args.Updates) foreach (var fbItem in args.Updates)
{ {
int rowIdx = kvp.Key; if (string.IsNullOrEmpty(fbItem.BookMarc)) continue;
string newMarc = kvp.Value;
int rowIdx = int.Parse(fbItem.Idx);
if (rowIdx >= 0 && rowIdx < bs1.Count) if (rowIdx >= 0 && rowIdx < bs1.Count)
{ {
var mItem = (SearchInforItem)bs1.List[rowIdx]; var mItem = (SearchInforItem)bs1.List[rowIdx];
mItem.marc2 = newMarc; mItem.marc2 = fbItem.BookMarc;
} }
} }
bs1.ResetBindings(false); bs1.ResetBindings(false);