287 lines
11 KiB
C#
287 lines
11 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using UniMarc.마크;
|
|
|
|
namespace WindowsFormsApp1.Mac
|
|
{
|
|
public partial class Marc_Plan : Form
|
|
{
|
|
Main main;
|
|
Helper_DB db = new Helper_DB();
|
|
public Marc_Plan(Main _main)
|
|
{
|
|
InitializeComponent();
|
|
main = _main;
|
|
}
|
|
|
|
private void Marc_Plan_Load(object sender, EventArgs e)
|
|
{
|
|
db.DBcon();
|
|
|
|
AuthorSymbol.Symbol sb = new AuthorSymbol.Symbol();
|
|
cb_FirstAuthor.Items.AddRange(sb.authorBook);
|
|
cb_authorType.Items.AddRange(sb.authorType);
|
|
cb_FirstBook.Items.AddRange(sb.authorFirst);
|
|
|
|
string[] divType = { "KDC", "DDC" };
|
|
cb_divType.Items.AddRange(divType);
|
|
|
|
string[] divNum = { "4", "5", "6" };
|
|
cb_divNum.Items.AddRange(divNum);
|
|
|
|
}
|
|
|
|
private void btn_Select_List_Click(object sender, EventArgs e)
|
|
{
|
|
tb_ISBN.Text = "";
|
|
|
|
Marc_Plan_Sub_SelectList sub = new Marc_Plan_Sub_SelectList(this);
|
|
sub.TopMost = true;
|
|
sub.Show();
|
|
}
|
|
#region SelectList_Sub
|
|
public void mk_Grid(string ListName, string date)
|
|
{
|
|
btn_Select_List.Text = ListName;
|
|
dataGridView1.Rows.Clear();
|
|
|
|
string Table = "Specs_Marc";
|
|
|
|
// idx
|
|
// 연번 등록번호 분류기호 저자기호 V(049v,볼륨)
|
|
// C(049c,복본) F(049f,별치) 구분(이용자) ISBN 도서명
|
|
// 총서명 총서번호 총서명1 총서명1 저자
|
|
// 출판사 정가 midx 마크
|
|
|
|
// idx
|
|
// 연번 등록번호 분류기호 저자기호 ISBN
|
|
// 도서명 총서명1 총서번호1 총서명2 총서번호2
|
|
// 저자 출판사 정가 midx 마크데이터
|
|
string Area = "`idx`, "
|
|
+ "`num`, `r_num`, `class_symbol`, `author_symbol`, `ISBN`, "
|
|
+ "`book_name`, `s_book_name1`, `s_book_num1`, `s_book_name2`, `s_book_num2`, "
|
|
+ "`author`, `book_comp`, `price`, `midx`, `marc`";
|
|
|
|
string[] Search_col = { "work_list", "date" };
|
|
string[] Search_data = { ListName, date };
|
|
|
|
string cmd = db.More_DB_Search(Table, Search_col, Search_data, Area);
|
|
string res = db.DB_Send_CMD_Search(cmd);
|
|
|
|
string[] ary = res.Split('|');
|
|
string[] grid = {
|
|
"", "", "", "", "",
|
|
"", "", "", "", "",
|
|
"", "", "", "", "",
|
|
"", "", "", "", "",
|
|
"", "T" };
|
|
|
|
for (int a = 0; a < ary.Length; a++)
|
|
{
|
|
if (a % 16 == 0) grid[0] = ary[a]; // idx
|
|
if (a % 16 == 1) grid[1] = ary[a]; // num
|
|
if (a % 16 == 2) grid[2] = ary[a]; // r_num
|
|
if (a % 16 == 3) grid[3] = ary[a]; // class_symbol
|
|
if (a % 16 == 4) grid[4] = ary[a]; // author_symbol
|
|
if (a % 16 == 5) grid[9] = ary[a]; // ISBN
|
|
if (a % 16 == 6) grid[10] = ary[a]; // book_name
|
|
if (a % 16 == 7) grid[11] = ary[a]; // s_book_name1
|
|
if (a % 16 == 8) grid[12] = ary[a]; // s_book_num1
|
|
if (a % 16 == 9) grid[13] = ary[a]; // s_book_name2
|
|
if (a % 16 == 10) grid[14] = ary[a]; // s_book_num2
|
|
if (a % 16 == 11) grid[15] = ary[a]; // author
|
|
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
|
|
dataGridView1.Rows.Add(grid);
|
|
}
|
|
}
|
|
|
|
}
|
|
public void mk_Panel(string idx, string ListName, string date)
|
|
{
|
|
string Table = "Specs_List";
|
|
string Area = "`first_Author`, `symbol_Author`, `book_Author`, `divType`, `divNum`";
|
|
string[] Search_col = { "idx", "work_list", "date" };
|
|
string[] Search_data = { idx, ListName, date };
|
|
|
|
string cmd = db.More_DB_Search(Table, Search_col, Search_data, Area);
|
|
string res = db.DB_Send_CMD_Search(cmd);
|
|
|
|
string[] ary = res.Split('|');
|
|
|
|
cb_FirstAuthor.SelectedItem = ary[0];
|
|
cb_authorType.SelectedItem = ary[1];
|
|
cb_FirstBook.SelectedItem = ary[2];
|
|
cb_divType.SelectedItem = ary[3];
|
|
cb_divNum.SelectedItem = ary[4];
|
|
}
|
|
#endregion
|
|
|
|
private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
|
|
{
|
|
Skill_Grid sg = new Skill_Grid();
|
|
sg.Print_Grid_Num(sender, e);
|
|
}
|
|
|
|
private void checkBox1_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
foreach (DataGridViewRow r in dataGridView1.Rows) {
|
|
r.Cells["colCheck"].Value = ((CheckBox)sender).Checked;
|
|
}
|
|
}
|
|
|
|
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
int row = e.RowIndex;
|
|
int col = e.ColumnIndex;
|
|
|
|
if (dataGridView1.Rows[row].Cells[col].ReadOnly) {
|
|
string[] Marc = {
|
|
dataGridView1.Rows[row].Cells["marc"].Value.ToString(),
|
|
dataGridView1.Rows[row].Cells["midx"].Value.ToString(),
|
|
dataGridView1.Rows[row].Cells["num"].Value.ToString(),
|
|
dataGridView1.Rows[row].Cells["idx"].Value.ToString()
|
|
};
|
|
string[] symbol_Type = {
|
|
cb_FirstAuthor.Text, cb_authorType.Text, cb_FirstBook.Text,
|
|
cb_divType.Text, cb_divNum.Text
|
|
};
|
|
|
|
Marc_Plan_Sub_MarcEdit me = new Marc_Plan_Sub_MarcEdit(this);
|
|
me.row = row;
|
|
me.Init(Marc, symbol_Type);
|
|
me.Show();
|
|
}
|
|
}
|
|
|
|
private void cb_divType_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
cb_divNum.Items.Clear();
|
|
|
|
string value = cb_divType.SelectedItem.ToString();
|
|
if (value == "KDC")
|
|
{
|
|
string[] data = { "4", "5", "6" };
|
|
cb_divNum.Items.AddRange(data);
|
|
}
|
|
else
|
|
{
|
|
string[] data = { "21", "22", "23" };
|
|
cb_divNum.Items.AddRange(data);
|
|
}
|
|
}
|
|
|
|
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
int row = dataGridView1.CurrentRow.Index;
|
|
string isbn = dataGridView1.Rows[row].Cells["isbn"].Value.ToString();
|
|
|
|
tb_ISBN.Text = isbn;
|
|
}
|
|
|
|
private void tb_SearchTag_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.Enter) {
|
|
Search_Tag();
|
|
}
|
|
}
|
|
#region SearchTag_KeyDown_Sub
|
|
List<string> BackUpTag = new List<string>();
|
|
private void Search_Tag()
|
|
{
|
|
BackUpTag.Clear();
|
|
string[] SearchTag = { tb_SearchTag.Text };
|
|
String_Text st = new String_Text();
|
|
|
|
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);
|
|
dataGridView1.Rows[a].Cells["search_tag"].Value = tag[0];
|
|
BackUpTag.Add(tag[0]);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
private void btn_ChangeTag_Click(object sender, EventArgs e)
|
|
{
|
|
string msg = string.Format("『{0}』 태그를 변경하시겠습니까?", tb_SearchTag.Text);
|
|
// 아니오 선택시 아래코드 실행되지않음.
|
|
if (MessageBox.Show(msg, "태그변경", MessageBoxButtons.YesNo) == DialogResult.No) return;
|
|
|
|
for (int a = 0; a < dataGridView1.Rows.Count; a++)
|
|
{
|
|
string marc = dataGridView1.Rows[a].Cells["marc"].Value.ToString();
|
|
string changeTag = dataGridView1.Rows[a].Cells["search_tag"].Value.ToString();
|
|
if (dataGridView1.Rows[a].Cells["colCheck"].Value.ToString() == "T")
|
|
dataGridView1.Rows[a].Cells["marc"].Value = marc.Replace(BackUpTag[a], changeTag);
|
|
}
|
|
MessageBox.Show("변경되었습니다!", "태그변경");
|
|
}
|
|
|
|
private void btn_Close_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
|
|
private void btn_Excel_Click(object sender, EventArgs e)
|
|
{
|
|
if (dataGridView1.RowCount <= 0) return;
|
|
|
|
string[] Tag = { "245n", "245p", "260c" };
|
|
|
|
String_Text st = new String_Text();
|
|
Excel_text et = new Excel_text();
|
|
string[] Title = {
|
|
"연번", "등록번호", "분류기호", "저자기호", "볼륨",
|
|
"복본", "별치", "도서명", "원서명", "권차명",
|
|
"권차서명", "총서명", "총서번호", "총서명", "총서번호",
|
|
"저자", "출판사", "출판년", "정가", "ISBN"
|
|
};
|
|
string[,] Content = new string[dataGridView1.RowCount, 20];
|
|
|
|
for (int a = 0; a < dataGridView1.RowCount; a++)
|
|
{
|
|
string Marc = dataGridView1.Rows[a].Cells["marc"].Value.ToString();
|
|
string[] SearchTag = st.Take_Tag(Marc, Tag);
|
|
string oriBookName = st.TakeTag_FilterJisi(Marc, "246a", "19");
|
|
|
|
Content[a, 00] = dataGridView1.Rows[a].Cells["num"].Value.ToString();
|
|
Content[a, 01] = dataGridView1.Rows[a].Cells["reg_num"].Value.ToString();
|
|
Content[a, 02] = dataGridView1.Rows[a].Cells["class_code"].Value.ToString();
|
|
Content[a, 03] = dataGridView1.Rows[a].Cells["author_code"].Value.ToString();
|
|
Content[a, 04] = dataGridView1.Rows[a].Cells["volume"].Value.ToString();
|
|
|
|
Content[a, 05] = dataGridView1.Rows[a].Cells["copy"].Value.ToString();
|
|
Content[a, 06] = dataGridView1.Rows[a].Cells["prefix"].Value.ToString();
|
|
Content[a, 07] = dataGridView1.Rows[a].Cells["book_name"].Value.ToString();
|
|
Content[a, 08] = oriBookName;
|
|
Content[a, 09] = SearchTag[0];
|
|
|
|
Content[a, 10] = SearchTag[1];
|
|
Content[a, 11] = dataGridView1.Rows[a].Cells["s_book_name1"].Value.ToString();
|
|
Content[a, 12] = dataGridView1.Rows[a].Cells["s_book_num1"].Value.ToString();
|
|
Content[a, 13] = dataGridView1.Rows[a].Cells["s_book_name2"].Value.ToString();
|
|
Content[a, 14] = dataGridView1.Rows[a].Cells["s_book_num2"].Value.ToString();
|
|
|
|
Content[a, 15] = dataGridView1.Rows[a].Cells["author"].Value.ToString();
|
|
Content[a, 16] = dataGridView1.Rows[a].Cells["book_comp"].Value.ToString();
|
|
Content[a, 17] = SearchTag[2];
|
|
Content[a, 18] = dataGridView1.Rows[a].Cells["price"].Value.ToString();
|
|
Content[a, 19] = dataGridView1.Rows[a].Cells["ISBN"].Value.ToString();
|
|
}
|
|
|
|
et.Mk_Excel(Title, Content);
|
|
}
|
|
}
|
|
}
|