2025-07-07 22:00~23:00

* 복본검사
	검색대상(도서관) : 기본입력을 한글로
	검색시 검색윈도우 최소화 기능 일시 중지
	검색옵션추가 (전체, 오류+없음, 오류, 없음)
This commit is contained in:
SeungHo Yang
2025-07-07 23:28:22 +09:00
parent b7c6e530dd
commit 8b63566684
7 changed files with 163 additions and 61 deletions

View File

@@ -16,6 +16,7 @@ namespace WindowsFormsApp1
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
//AR.UTIL.MsgE("unitmarc");
DB_InitSetting();
UpdaterCheck();

View File

@@ -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)
{

View File

@@ -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("검색결과");
});

View File

@@ -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;
}
}

View File

@@ -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
{

View File

@@ -126,6 +126,9 @@
<metadata name="Count.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dvc_remark.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>