From 8b63566684809e8f3e9eb38022b26505d3fa782d Mon Sep 17 00:00:00 2001 From: SeungHo Yang Date: Mon, 7 Jul 2025 23:28:22 +0900 Subject: [PATCH] =?UTF-8?q?2025-07-07=2022:00~23:00=20*=20=EB=B3=B5?= =?UTF-8?q?=EB=B3=B8=EA=B2=80=EC=82=AC=20=09=EA=B2=80=EC=83=89=EB=8C=80?= =?UTF-8?q?=EC=83=81(=EB=8F=84=EC=84=9C=EA=B4=80)=20:=20=EA=B8=B0=EB=B3=B8?= =?UTF-8?q?=EC=9E=85=EB=A0=A5=EC=9D=84=20=ED=95=9C=EA=B8=80=EB=A1=9C=20=09?= =?UTF-8?q?=EA=B2=80=EC=83=89=EC=8B=9C=20=EA=B2=80=EC=83=89=EC=9C=88?= =?UTF-8?q?=EB=8F=84=EC=9A=B0=20=EC=B5=9C=EC=86=8C=ED=99=94=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=9D=BC=EC=8B=9C=20=EC=A4=91=EC=A7=80=20=09?= =?UTF-8?q?=EA=B2=80=EC=83=89=EC=98=B5=EC=85=98=EC=B6=94=EA=B0=80=20(?= =?UTF-8?q?=EC=A0=84=EC=B2=B4,=20=EC=98=A4=EB=A5=98+=EC=97=86=EC=9D=8C,=20?= =?UTF-8?q?=EC=98=A4=EB=A5=98,=20=EC=97=86=EC=9D=8C)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- unimarc/unimarc/Program.cs | 1 + .../SearchModel/KwangjuCityLibrarySearcher.cs | 19 +-- .../SearchModel/NamguLibrarySearcher.cs | 17 +- unimarc/unimarc/obj/Debug/Interop.SHDocVw.dll | Bin 154112 -> 154112 bytes unimarc/unimarc/마크/Check_copy.Designer.cs | 148 +++++++++++++----- unimarc/unimarc/마크/Check_copy.cs | 36 +++-- unimarc/unimarc/마크/Check_copy.resx | 3 + 7 files changed, 163 insertions(+), 61 deletions(-) diff --git a/unimarc/unimarc/Program.cs b/unimarc/unimarc/Program.cs index 20d10a6..4f629f6 100644 --- a/unimarc/unimarc/Program.cs +++ b/unimarc/unimarc/Program.cs @@ -16,6 +16,7 @@ namespace WindowsFormsApp1 { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); + //AR.UTIL.MsgE("unitmarc"); DB_InitSetting(); UpdaterCheck(); diff --git a/unimarc/unimarc/SearchModel/KwangjuCityLibrarySearcher.cs b/unimarc/unimarc/SearchModel/KwangjuCityLibrarySearcher.cs index ea0dd63..ab641e1 100644 --- a/unimarc/unimarc/SearchModel/KwangjuCityLibrarySearcher.cs +++ b/unimarc/unimarc/SearchModel/KwangjuCityLibrarySearcher.cs @@ -96,7 +96,7 @@ namespace BokBonCheck options.AddArgument("--no-sandbox"); options.AddArgument("--disable-dev-shm-usage"); options.AddArgument("--disable-gpu"); - options.AddArgument("--window-size=1920,1080"); + options.AddArgument("--window-size=640,700"); options.AddArgument("--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36"); options.AddArgument("--disable-blink-features=AutomationControlled"); options.AddExcludedArgument("enable-automation"); @@ -158,11 +158,12 @@ namespace BokBonCheck var wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(15)); // 모든 감지 방법이 끝나면 크롬창 최소화 - IntPtr chromeWindow = FindWindow("Chrome_WidgetWin_1", null); - if (chromeWindow != IntPtr.Zero) - { - ShowWindow(chromeWindow, SW_MINIMIZE); - } + // whale 브라우저가 최소화되어 우선해제 + //IntPtr chromeWindow = FindWindow("Chrome_WidgetWin_1", null); + //if (chromeWindow != IntPtr.Zero) + //{ + // ShowWindow(chromeWindow, SW_MINIMIZE); + //} //대상도서관 선택 SelectLibrary(wait); @@ -304,11 +305,11 @@ namespace BokBonCheck // 방법 5: 특정 텍스트가 페이지에 나타날 때까지 대기 wait.Until(d => { - var pageText = d.FindElement(By.TagName("body")).Text; + var elm = d.FindElement(By.TagName("body")); + if (elm == null) return false; + var pageText = elm.Text; return pageText.Contains("전체") || pageText.Contains("건") || pageText.Contains("검색결과"); }); - - } catch (Exception ex) { diff --git a/unimarc/unimarc/SearchModel/NamguLibrarySearcher.cs b/unimarc/unimarc/SearchModel/NamguLibrarySearcher.cs index 0e005f9..d7d0e1b 100644 --- a/unimarc/unimarc/SearchModel/NamguLibrarySearcher.cs +++ b/unimarc/unimarc/SearchModel/NamguLibrarySearcher.cs @@ -212,7 +212,7 @@ namespace BokBonCheck options.AddArgument("--no-sandbox"); options.AddArgument("--disable-dev-shm-usage"); options.AddArgument("--disable-gpu"); - options.AddArgument("--window-size=1920,1080"); + options.AddArgument("--window-size=640,700"); options.AddArgument("--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36"); options.AddArgument("--disable-blink-features=AutomationControlled"); options.AddExcludedArgument("enable-automation"); @@ -277,11 +277,12 @@ namespace BokBonCheck var wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(15)); // 모든 감지 방법이 끝나면 크롬창 최소화 - IntPtr chromeWindow = FindWindow("Chrome_WidgetWin_1", null); - if (chromeWindow != IntPtr.Zero) - { - ShowWindow(chromeWindow, SW_MINIMIZE); - } + // whale 브라우저가 최소화되어 우선해제 + //IntPtr chromeWindow = FindWindow("Chrome_WidgetWin_1", null); + //if (chromeWindow != IntPtr.Zero) + //{ + // ShowWindow(chromeWindow, SW_MINIMIZE); + //} //대상도서관 선택 SelectLibrary(wait); @@ -425,7 +426,9 @@ namespace BokBonCheck // 방법 5: 특정 텍스트가 페이지에 나타날 때까지 대기 wait.Until(d => { - var pageText = d.FindElement(By.TagName("body")).Text; + var elm = d.FindElement(By.TagName("body")); + if (elm == null) return false; + var pageText = elm.Text; return pageText.Contains("전체") || pageText.Contains("건") || pageText.Contains("검색결과"); }); diff --git a/unimarc/unimarc/obj/Debug/Interop.SHDocVw.dll b/unimarc/unimarc/obj/Debug/Interop.SHDocVw.dll index 3791978b52910dca1762c90ea07bd08a22e1c7ed..82a5c7a89c28d269ffc43919c0482a90c3f9252b 100644 GIT binary patch delta 45 zcmV+|0Mh?}vC$U~i-n5;wTl7)IuO}Z=9VDyRZgaNnKpBlpYykzIs#-L D*5MRh delta 45 zcmV+|0Mh?}v`qZO^xyIs#-L DtJxDF diff --git a/unimarc/unimarc/마크/Check_copy.Designer.cs b/unimarc/unimarc/마크/Check_copy.Designer.cs index 7fd6bf0..79ec431 100644 --- a/unimarc/unimarc/마크/Check_copy.Designer.cs +++ b/unimarc/unimarc/마크/Check_copy.Designer.cs @@ -45,9 +45,6 @@ this.lbl_PW = new System.Windows.Forms.Label(); this.lbl_ID = new System.Windows.Forms.Label(); this.dataGridView1 = new System.Windows.Forms.DataGridView(); - this.book_name = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.book_comp = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.Count = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.btn_ApplyFilter = new System.Windows.Forms.Button(); this.panel3 = new System.Windows.Forms.Panel(); this.panel6 = new System.Windows.Forms.Panel(); @@ -60,6 +57,15 @@ this.btn_OpenMemo = new System.Windows.Forms.Button(); this.chk_spChar = new System.Windows.Forms.CheckBox(); this.panel5 = new System.Windows.Forms.Panel(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.radTargetAll = new System.Windows.Forms.RadioButton(); + this.radTargetErrEmpty = new System.Windows.Forms.RadioButton(); + this.radTargetEmpty = new System.Windows.Forms.RadioButton(); + this.radTargetErr = new System.Windows.Forms.RadioButton(); + this.book_name = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.book_comp = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Count = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.dvc_remark = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.webBrowser1 = new System.Windows.Forms.WebBrowser(); this.panel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.SearchCount)).BeginInit(); @@ -70,11 +76,13 @@ this.statusStrip1.SuspendLayout(); this.panel4.SuspendLayout(); this.panel5.SuspendLayout(); + this.groupBox1.SuspendLayout(); this.SuspendLayout(); // // panel1 // this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.panel1.Controls.Add(this.groupBox1); this.panel1.Controls.Add(this.rb_isNumber); this.panel1.Controls.Add(this.rb_isHave); this.panel1.Controls.Add(this.btn_SearchList); @@ -83,7 +91,7 @@ this.panel1.Dock = System.Windows.Forms.DockStyle.Top; this.panel1.Location = new System.Drawing.Point(0, 34); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(629, 34); + this.panel1.Size = new System.Drawing.Size(629, 83); this.panel1.TabIndex = 0; // // rb_isNumber @@ -113,7 +121,7 @@ // this.btn_SearchList.Location = new System.Drawing.Point(4, 4); this.btn_SearchList.Name = "btn_SearchList"; - this.btn_SearchList.Size = new System.Drawing.Size(305, 24); + this.btn_SearchList.Size = new System.Drawing.Size(305, 69); this.btn_SearchList.TabIndex = 3; this.btn_SearchList.Text = "목록 검색"; this.btn_SearchList.UseVisualStyleBackColor = true; @@ -173,6 +181,7 @@ // // tb_SearchTarget // + this.tb_SearchTarget.ImeMode = System.Windows.Forms.ImeMode.Hangul; this.tb_SearchTarget.Location = new System.Drawing.Point(66, 6); this.tb_SearchTarget.Name = "tb_SearchTarget"; this.tb_SearchTarget.Size = new System.Drawing.Size(243, 21); @@ -252,37 +261,17 @@ this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.book_name, this.book_comp, - this.Count}); + this.Count, + this.dvc_remark}); this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill; this.dataGridView1.Location = new System.Drawing.Point(0, 0); this.dataGridView1.Name = "dataGridView1"; this.dataGridView1.RowTemplate.Height = 23; - this.dataGridView1.Size = new System.Drawing.Size(629, 614); + this.dataGridView1.Size = new System.Drawing.Size(629, 565); this.dataGridView1.TabIndex = 1; this.dataGridView1.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(this.dataGridView1_RowPostPaint); this.dataGridView1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.dataGridView1_KeyDown); // - // book_name - // - this.book_name.HeaderText = "도서명(총서명)"; - this.book_name.Name = "book_name"; - this.book_name.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; - this.book_name.Width = 350; - // - // book_comp - // - this.book_comp.HeaderText = "출판사"; - this.book_comp.Name = "book_comp"; - this.book_comp.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; - this.book_comp.Width = 150; - // - // Count - // - this.Count.HeaderText = "검색 수"; - this.Count.Name = "Count"; - this.Count.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; - this.Count.Width = 70; - // // btn_ApplyFilter // this.btn_ApplyFilter.Location = new System.Drawing.Point(317, 4); @@ -310,16 +299,16 @@ this.panel6.Controls.Add(this.dataGridView1); this.panel6.Controls.Add(this.statusStrip1); this.panel6.Dock = System.Windows.Forms.DockStyle.Fill; - this.panel6.Location = new System.Drawing.Point(0, 102); + this.panel6.Location = new System.Drawing.Point(0, 151); this.panel6.Name = "panel6"; - this.panel6.Size = new System.Drawing.Size(629, 636); + this.panel6.Size = new System.Drawing.Size(629, 587); this.panel6.TabIndex = 3; // // statusStrip1 // this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.lblStatus}); - this.statusStrip1.Location = new System.Drawing.Point(0, 614); + this.statusStrip1.Location = new System.Drawing.Point(0, 565); this.statusStrip1.Name = "statusStrip1"; this.statusStrip1.Size = new System.Drawing.Size(629, 22); this.statusStrip1.TabIndex = 2; @@ -341,7 +330,7 @@ this.panel4.Controls.Add(this.btn_ApplyFilter); this.panel4.Controls.Add(this.chk_spChar); this.panel4.Dock = System.Windows.Forms.DockStyle.Top; - this.panel4.Location = new System.Drawing.Point(0, 68); + this.panel4.Location = new System.Drawing.Point(0, 117); this.panel4.Name = "panel4"; this.panel4.Size = new System.Drawing.Size(629, 34); this.panel4.TabIndex = 2; @@ -405,6 +394,87 @@ this.panel5.Size = new System.Drawing.Size(662, 738); this.panel5.TabIndex = 4; // + // groupBox1 + // + this.groupBox1.Controls.Add(this.radTargetErr); + this.groupBox1.Controls.Add(this.radTargetEmpty); + this.groupBox1.Controls.Add(this.radTargetErrEmpty); + this.groupBox1.Controls.Add(this.radTargetAll); + this.groupBox1.Location = new System.Drawing.Point(318, 34); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(305, 39); + this.groupBox1.TabIndex = 6; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "검색대상"; + // + // radTargetAll + // + this.radTargetAll.AutoSize = true; + this.radTargetAll.Checked = true; + this.radTargetAll.Location = new System.Drawing.Point(8, 16); + this.radTargetAll.Name = "radTargetAll"; + this.radTargetAll.Size = new System.Drawing.Size(47, 16); + this.radTargetAll.TabIndex = 6; + this.radTargetAll.Text = "전체"; + this.radTargetAll.UseVisualStyleBackColor = true; + // + // radTargetErrEmpty + // + this.radTargetErrEmpty.AutoSize = true; + this.radTargetErrEmpty.Location = new System.Drawing.Point(61, 17); + this.radTargetErrEmpty.Name = "radTargetErrEmpty"; + this.radTargetErrEmpty.Size = new System.Drawing.Size(77, 16); + this.radTargetErrEmpty.TabIndex = 7; + this.radTargetErrEmpty.Text = "오류+없음"; + this.radTargetErrEmpty.UseVisualStyleBackColor = true; + // + // radTargetEmpty + // + this.radTargetEmpty.AutoSize = true; + this.radTargetEmpty.Location = new System.Drawing.Point(144, 16); + this.radTargetEmpty.Name = "radTargetEmpty"; + this.radTargetEmpty.Size = new System.Drawing.Size(47, 16); + this.radTargetEmpty.TabIndex = 8; + this.radTargetEmpty.Text = "없음"; + this.radTargetEmpty.UseVisualStyleBackColor = true; + // + // radTargetErr + // + this.radTargetErr.AutoSize = true; + this.radTargetErr.Location = new System.Drawing.Point(197, 16); + this.radTargetErr.Name = "radTargetErr"; + this.radTargetErr.Size = new System.Drawing.Size(47, 16); + this.radTargetErr.TabIndex = 9; + this.radTargetErr.Text = "오류"; + this.radTargetErr.UseVisualStyleBackColor = true; + // + // book_name + // + this.book_name.HeaderText = "도서명(총서명)"; + this.book_name.Name = "book_name"; + this.book_name.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; + this.book_name.Width = 300; + // + // book_comp + // + this.book_comp.HeaderText = "출판사"; + this.book_comp.Name = "book_comp"; + this.book_comp.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; + this.book_comp.Width = 120; + // + // Count + // + this.Count.HeaderText = "검색 수"; + this.Count.Name = "Count"; + this.Count.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; + this.Count.Width = 50; + // + // dvc_remark + // + this.dvc_remark.HeaderText = "비고"; + this.dvc_remark.Name = "dvc_remark"; + this.dvc_remark.Width = 110; + // // webBrowser1 // this.webBrowser1.Dock = System.Windows.Forms.DockStyle.Fill; @@ -440,6 +510,8 @@ this.panel4.ResumeLayout(false); this.panel4.PerformLayout(); this.panel5.ResumeLayout(false); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); this.ResumeLayout(false); } @@ -469,14 +541,20 @@ private System.Windows.Forms.Button btn_GridReset; private System.Windows.Forms.Button btn_OpenMemo; private System.Windows.Forms.Button btn_ResultEmpty; - private System.Windows.Forms.DataGridViewTextBoxColumn book_name; - private System.Windows.Forms.DataGridViewTextBoxColumn book_comp; - private System.Windows.Forms.DataGridViewTextBoxColumn Count; public System.Windows.Forms.Label lbl_PW; public System.Windows.Forms.Label lbl_ID; private System.Windows.Forms.Button btn_SiteDenote; private System.Windows.Forms.WebBrowser webBrowser1; private System.Windows.Forms.StatusStrip statusStrip1; private System.Windows.Forms.ToolStripLabel lblStatus; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.RadioButton radTargetAll; + private System.Windows.Forms.RadioButton radTargetErr; + private System.Windows.Forms.RadioButton radTargetEmpty; + private System.Windows.Forms.RadioButton radTargetErrEmpty; + private System.Windows.Forms.DataGridViewTextBoxColumn book_name; + private System.Windows.Forms.DataGridViewTextBoxColumn book_comp; + private System.Windows.Forms.DataGridViewTextBoxColumn Count; + private System.Windows.Forms.DataGridViewTextBoxColumn dvc_remark; } } \ No newline at end of file diff --git a/unimarc/unimarc/마크/Check_copy.cs b/unimarc/unimarc/마크/Check_copy.cs index 447fcfd..22e634f 100644 --- a/unimarc/unimarc/마크/Check_copy.cs +++ b/unimarc/unimarc/마크/Check_copy.cs @@ -282,7 +282,7 @@ namespace WindowsFormsApp1.Mac } else { - if(DateTime.Now > new DateTime(2025,08,31)) + if (DateTime.Now > new DateTime(2025, 08, 31)) { UTIL.MsgE("테스트 기간이 종료되었습니다\n개발자 문의 하세요"); return; @@ -305,6 +305,7 @@ namespace WindowsFormsApp1.Mac return; } + var intSearchCnt = 0; this._isSearching = true; btn_Start.Enabled = false; btn_Stop.Enabled = false; @@ -313,7 +314,7 @@ namespace WindowsFormsApp1.Mac { if (this._isSearching == false) { - drow.Cells["Count"].Value = "SKIP"; + drow.Cells["dvc_remark"].Value = "Cancel"; continue; } @@ -322,49 +323,64 @@ namespace WindowsFormsApp1.Mac var bookName = drow.Cells["book_name"].Value?.ToString() ?? string.Empty; if (bookName.isEmpty()) { + drow.Cells["dvc_remark"].Value = "No Title"; drow.DefaultCellStyle.BackColor = Color.HotPink; drow.DefaultCellStyle.ForeColor = Color.Blue; continue; } var cntValue = drow.Cells["Count"].Value?.ToString() ?? string.Empty; - if (cntValue.Equals("SKIP")) + cntValue = cntValue.ToLower().Trim(); + + if (radTargetErr.Checked) //오류데이터만 처리 { - drow.DefaultCellStyle.BackColor = Color.LightSkyBlue; - drow.DefaultCellStyle.ForeColor = Color.Black; - continue; + if (cntValue.StartsWith("err") == false) + continue; + } + else if (radTargetEmpty.Checked) //빈데이터만 처리 + { + if (int.TryParse(cntValue,out int cntvalue) && cntvalue > 0) + continue; + } + else if (radTargetErrEmpty.Checked) //오류+빈데이터처리 + { + if (cntValue.StartsWith("err") == false && int.TryParse(cntValue, out int cntvalue) && cntvalue > 0) + continue; } - + intSearchCnt += 1; var rlt = await searcher.SearchAsync(bookName); if (rlt.IsSuccess) { drow.Cells["Count"].Value = $"{rlt.BookCount}"; if (rlt.BookCount == 0) { + drow.Cells["dvc_remark"].Value = "No Data"; drow.DefaultCellStyle.BackColor = Color.LightGray; drow.DefaultCellStyle.ForeColor = Color.Red; } else { + drow.Cells["dvc_remark"].Value = ""; drow.DefaultCellStyle.BackColor = Color.Yellow; drow.DefaultCellStyle.ForeColor = Color.Blue; } } else { + drow.Cells["dvc_remark"].Value = "Error"; drow.DefaultCellStyle.BackColor = Color.HotPink; drow.DefaultCellStyle.ForeColor = Color.Blue; } - + } searcher.StopDriver(); - UTIL.MsgI("검색 완료"); + UTIL.MsgI($"검색 완료({intSearchCnt})건"); } catch (Exception ex) { - UTIL.MsgE("Web Driver Error\n"+ex.Message); + UTIL.MsgE("Web Driver Error\n" + ex.Message); } finally { diff --git a/unimarc/unimarc/마크/Check_copy.resx b/unimarc/unimarc/마크/Check_copy.resx index feaaebf..3f8392d 100644 --- a/unimarc/unimarc/마크/Check_copy.resx +++ b/unimarc/unimarc/마크/Check_copy.resx @@ -126,6 +126,9 @@ True + + True + 17, 17