* unimarc

a. 팩스전송 완료.
 b. 마크목록 폼 작성중
  1. 엑셀반출 기능 추가중 사용 작업중
  2. 마크편집 폼 수정 중 (마크 반출 test프로젝트 진행완료, 본 프로젝트에 적용중. / 저장기능활성화 작업완료)
   2-1. 기존의 칸채우기에서 예상되지 못한 버그가 발생하여 칸채우기 숨김.
   2-2. 008태크 재배치 => TextBox에 적용완료. 변경사항 메모장으로 넘기는 작업 진행해야함.
   2-3. 현재 TODO : 저장기능

TODOLIST
1. 팩스로 전송될 엑셀파일 밑작업마무리 (입력될 파라미터만 적용하면 실사용가능)
2. 알라딘API, 네이버 API연동중 자잘한 버그 수정작업 필요.
This commit is contained in:
SeungHo Yang
2021-03-29 18:56:10 +09:00
parent ed04bc56c3
commit 7e802070bf
20 changed files with 278 additions and 157 deletions

View File

@@ -19,8 +19,10 @@ namespace ISBN_Check_test
}
private void Form1_Load(object sender, EventArgs e)
{
string[] com_list = { "제목+저자", "제목", "저자", "출판사" };
comboBox1.Items.AddRange(com_list);
string[] api_list = { "알라딘", "네이버" };
string[] filter_list = { "제목+저자", "제목", "저자", "출판사" };
cb_api.Items.AddRange(api_list);
cb_filter.Items.AddRange(filter_list);
}
private void button2_Click(object sender, EventArgs e)
{
@@ -34,19 +36,46 @@ namespace ISBN_Check_test
}
private void button1_Click(object sender, EventArgs e)
{
if(comboBox1.SelectedIndex == -1) { MessageBox.Show("조건이 선택되지 않았습니다."); return; }
int start = Convert.ToInt32(start_idx.Text) - 1;
int end = Convert.ToInt32(end_idx.Text) - 1;
if(start_idx.Text!="1" || end_idx.Text != dataGridView1.Rows.Count.ToString()) {
start = Convert.ToInt32(start_idx.Text) - 1;
end = Convert.ToInt32(end_idx.Text) - 1;
}
if(cb_api.SelectedIndex == -1) { MessageBox.Show("조건이 선택되지 않았습니다."); return; }
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
int start = Convert.ToInt32(start_idx.Text) - 1;
int end = Convert.ToInt32(end_idx.Text) - 1;
if (start_idx.Text != "1" || end_idx.Text != dataGridView1.Rows.Count.ToString()) {
start = Convert.ToInt32(start_idx.Text) - 1;
end = Convert.ToInt32(end_idx.Text) - 1;
}
switch (cb_api.SelectedIndex)
{
case 0:
if(cb_filter.SelectedIndex == -1) { MessageBox.Show("조건이 선택되지 않았습니다."); return; }
Aladin_API(dataGridView1, start, end);
break;
case 1:
Naver_API(dataGridView1, start, end);
break;
}
stopwatch.Stop();
TimeSpan ts = stopwatch.Elapsed;
string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10);
label1.Text = elapsedTime;
// 총 검색 횟수, 일치, 중복
MessageBox.Show("검색이 완료되었습니다!");
}
/// <summary>
/// 알라딘 API
/// </summary>
/// <param name="gridview"></param>
private void Aladin_API(DataGridView gridview, int start, int end)
{
string temp = string.Empty;
string type = string.Empty;
string query = string.Empty;
@@ -55,7 +84,7 @@ namespace ISBN_Check_test
string[] param = { "title", "author", "publisher", "isbn13", "priceStandard",
"pubDate", "categoryName", "stockStatus" };
API api = new API();
switch (comboBox1.SelectedIndex)
switch (cb_filter.SelectedIndex)
{
case 0: // 제목+저자
type = "Keyword";
@@ -72,24 +101,31 @@ namespace ISBN_Check_test
}
for (int a = start; a < end; a++)
{
if (dataGridView1.Rows[a].DefaultCellStyle.BackColor == Color.Yellow)
if (gridview.Rows[a].DefaultCellStyle.BackColor == Color.Yellow)
continue;
else if (dataGridView1.Rows[a].DefaultCellStyle.BackColor == Color.LightGray){
dataGridView1.Rows[a].DefaultCellStyle.BackColor = Color.Empty;
}
else if (gridview.Rows[a].DefaultCellStyle.BackColor == Color.LightGray)
gridview.Rows[a].DefaultCellStyle.BackColor = Color.Empty;
query = Set_query(type, a);
insert_API(api.Aladin(query, type, param), a);
insert_By_Aladin(api.Aladin(query, type, param), a);
}
stopwatch.Stop();
}
private void Naver_API(DataGridView gridview, int start, int end)
{
API api = new API();
// 도서명 / 저자 / 출판사 / isbn / 정가
// 발행일 / 도서분류 / 재고
string[] param = { "title", "author", "publisher", "isbn", "price",
"pubdate", "discount" };
TimeSpan ts = stopwatch.Elapsed;
string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10);
label1.Text = elapsedTime;
// 총 검색 횟수, 일치, 중복
MessageBox.Show("검색이 완료되었습니다!");
for(int a = start; a < end; a++)
{
string[] ArrayValue = { gridview.Rows[a].Cells["book_name"].Value.ToString(),
gridview.Rows[a].Cells["author"].Value.ToString(),
gridview.Rows[a].Cells["book_comp"].Value.ToString() };
string result = api.Naver(ArrayValue, param);
insert_By_Naver(result, a);
}
}
string Set_query(string type, int idx)
{
@@ -110,7 +146,7 @@ namespace ISBN_Check_test
return result;
}
void insert_API(string data, int row)
void insert_By_Aladin(string data, int row)
{
if (row > 0) { dataGridView1.Rows[row - 1].Selected = false; }
dataGridView1.Rows[row].Selected = true;
@@ -158,6 +194,70 @@ namespace ISBN_Check_test
dataGridView1.Rows[row].DefaultCellStyle.BackColor = Color.Yellow;
}
}
void insert_By_Naver(string value, int row)
{
value = value.Replace("<b>", "");
value = value.Replace("</b>", "");
if (row > 0) { dataGridView1.Rows[row - 1].Selected = false; }
dataGridView1.Rows[row].Selected = true;
if (value.Length > 0) {
dataGridView1.Rows[row].Cells["Column1"].Value = value;
dataGridView1.Rows[row].DefaultCellStyle.BackColor = Color.LightGray;
}
if (value == "") return;
bool[] chk = { false, false, false };
string book_name = dataGridView1.Rows[row].Cells["book_name"].Value.ToString();
string author = dataGridView1.Rows[row].Cells["author"].Value.ToString();
string book_comp = dataGridView1.Rows[row].Cells["book_comp"].Value.ToString();
string[] sp_data = value.Split('\t');
if (sp_data.Length > 1) return;
/// TODO: 밑에 작업하세요
#region
// title author publisher isbn price pubdate / discount
// title author publisher isbn price pubdate discount
string[] grid = { "", "", "", "", "", "", "", "" };
for (int a = 0; a < sp_data.Length; a++)
{
string[] data = sp_data[a].Split('|');
int idx = data.Length - 2;
grid[0] = data[0];
grid[1] = data[1];
for (int b = 2; b < idx - 4; b++)
{
grid[1] += ", " + data[b];
}
grid[2] = data[idx - 4];
if (data[idx - 3].Contains(" ") == true)
{
string[] isbn = data[idx - 3].Split(' ');
grid[3] = isbn[1];
}
else
grid[3] = data[idx - 3];
grid[5] = data[idx - 2];
grid[6] = data[idx - 1];
if (data[idx] == "")
grid[8] = "절판";
else
grid[8] = "";
for(int b = 0; b < 9; b++) {
grid[9] += grid[b];
}
}
#endregion
}
private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
{
Skill_Grid sg = new Skill_Grid();
@@ -189,6 +289,7 @@ namespace ISBN_Check_test
if(dataGridView1.Rows[e.RowIndex].Cells["Column1"].Value == null) { return; }
Form2 f2 = new Form2(this);
f2.row = e.RowIndex;
f2.Call_API = cb_api.Text;
f2.Show();
}
@@ -199,5 +300,12 @@ namespace ISBN_Check_test
e.Handled = true;
}
}
private void cb_api_SelectedIndexChanged(object sender, EventArgs e)
{
if(cb_api.SelectedIndex == 1)
cb_filter.Enabled = false;
else cb_filter.Enabled = true;
}
}
}