a. 팩스전송 완료. b. 마크목록 폼 작성중 1. 엑셀반출 기능 추가중 사용 모듈상의 이유로 작업중지 2. 마크편집 폼 수정 중 (마크 반출 test프로젝트 진행완료, 본 프로젝트에 적용중. / 저장기능활성화 작업완료) 2-1. 기존의 칸채우기에서 예상되지 못한 버그가 발생하여 칸채우기 숨김. 2-2. 008태크 재배치 => TextBox에 적용완료. 변경사항 메모장으로 넘기는 작업 진행해야함. 2-3. 현재 TODO : 저장기능 TODOLIST 1. 팩스로 전송될 엑셀파일 밑작업 -> skill.cs에서 360줄 오류발생.
314 lines
13 KiB
C#
314 lines
13 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Diagnostics;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace WindowsFormsApp1.Delivery
|
|
{
|
|
public partial class Order_input : Form
|
|
{
|
|
Helper_DB db = new Helper_DB();
|
|
Skill_Grid grid = new Skill_Grid();
|
|
Main main;
|
|
public string compidx = "";
|
|
public int grididx;
|
|
int ColumnIndex;
|
|
string chk_mkdate = "";
|
|
bool chk_V = false;
|
|
bool chk_O = false;
|
|
public Order_input(Main _main)
|
|
{
|
|
InitializeComponent();
|
|
main = _main;
|
|
}
|
|
|
|
private void Order_input_Load(object sender, EventArgs e)
|
|
{
|
|
db.DBcon();
|
|
compidx = main.com_idx;
|
|
|
|
dataGridView1.Columns["book_name"].DefaultCellStyle.Font = new Font("굴림", 8, FontStyle.Regular);
|
|
dataGridView1.Columns["author"].DefaultCellStyle.Font = new Font("굴림", 8, FontStyle.Regular);
|
|
dataGridView1.Columns["list_name"].DefaultCellStyle.Font = new Font("굴림", 8, FontStyle.Regular);
|
|
|
|
// 데이터 그리드 뷰 수정
|
|
for(int a = 0; a < dataGridView1.Columns.Count; a++)
|
|
{
|
|
if (a != 1 && a != 6 && a != 13 && a != 16) {
|
|
dataGridView1.Columns[a].ReadOnly = true;
|
|
}
|
|
}
|
|
|
|
// 사용자 구분
|
|
cb_user.Items.Add("전체");
|
|
string[] user_tmp = main.DB_User_Data.Split('|');
|
|
string cmd = db.self_Made_Cmd("SELECT `name` FROM `User_Data` WHERE `affil` = '" + user_tmp[5] + "';");
|
|
string[] user_name = cmd.Split('|');
|
|
for (int a = 0; a < user_name.Length; a++)
|
|
{
|
|
if (a == user_name.Length - 1) { break; }
|
|
cb_user.Items.Add(user_name[a]);
|
|
}
|
|
cb_user.SelectedIndex = 0;
|
|
|
|
// 상태 구분
|
|
string[] state = { "미입고", "입고", "전체" };
|
|
cb_state.Items.AddRange(state);
|
|
cb_state.SelectedIndex = 0;
|
|
|
|
// 보기 구분
|
|
string[] order = { "주문중", "미주문", "전체" };
|
|
cb_order.Items.AddRange(order);
|
|
cb_order.SelectedIndex = 0;
|
|
|
|
|
|
// 주문서 구분
|
|
string[] order_send = { "팩스", "메일" };
|
|
cb_ordersend.Items.AddRange(order_send);
|
|
cb_ordersend.SelectedIndex = 0;
|
|
}
|
|
private void btn_lookup_Click(object sender, EventArgs e)
|
|
{
|
|
string[] tmp_col = { "compidx" };
|
|
string[] tmp_data = { compidx };
|
|
string takedata = "`order`, `order_stat`, `isbn`, `book_name`, `author`, " +
|
|
"`book_comp`, `order_count`, `count`, `pay`, `total`, " +
|
|
"`etc`, `list_name`, `order_date`, `send_date`, `header`, " +
|
|
"`num`";
|
|
string cmd = db.More_DB_Search("Obj_List_Book", tmp_col, tmp_data, takedata);
|
|
made_grid(cmd, true);
|
|
date_Substring();
|
|
}
|
|
/// <summary>
|
|
/// Grid내의 주문일자와 송금일자를 날짜까지만 표시하게 해주는 함수.
|
|
/// </summary>
|
|
private void date_Substring()
|
|
{
|
|
for(int a = 0; a < dataGridView1.Rows.Count; a++)
|
|
{
|
|
if (dataGridView1.Rows[a].Cells["order_date"].Value.ToString() != "") {
|
|
dataGridView1.Rows[a].Cells["order_date"].Value =
|
|
dataGridView1.Rows[a].Cells["order_date"].Value.ToString().Substring(0, 10);
|
|
}
|
|
if (dataGridView1.Rows[a].Cells["send_date"].Value.ToString() != "") {
|
|
dataGridView1.Rows[a].Cells["send_date"].Value =
|
|
dataGridView1.Rows[a].Cells["send_date"].Value.ToString().Substring(0, 10);
|
|
}
|
|
if (dataGridView1.Rows[a].Cells["book_comp"].Value.ToString().Contains("(주)") == true) {
|
|
dataGridView1.Rows[a].Cells["book_comp"].Value =
|
|
dataGridView1.Rows[a].Cells["book_comp"].Value.ToString().Replace("(주)", "");
|
|
}
|
|
}
|
|
}
|
|
public void made_grid(string strValue, bool chk = false)
|
|
{
|
|
dataGridView1.Rows.Clear();
|
|
string[] data = strValue.Split('|');
|
|
string[] mkgrid = {"", "", "", "", "",
|
|
"", "", "", "", "",
|
|
"", "", "", "", "",
|
|
"" };
|
|
/* 선택 / o주문처 / oM / o도서명 / o저자 /
|
|
* o출판사 / o주문수 / o원주문 / o정가 / o합계 /
|
|
* o비고 / o납품처 / o주문일자 / o송금일자 / oo번호 /
|
|
* 목록번호
|
|
*/
|
|
for (int a = 0; a < data.Length; a++)
|
|
{
|
|
if (a % 16 == 0) { mkgrid[1] = data[a]; } // 주문처
|
|
if (a % 16 == 1) { // M
|
|
if (data[a] == "0") { data[a] = data[a].Replace("0", ""); }
|
|
if (data[a] == "1") { data[a] = data[a].Replace("1", "V"); }
|
|
mkgrid[2] = data[a];
|
|
}
|
|
if (a % 16 == 2) { mkgrid[3] = data[a]; } // ISBN
|
|
if (a % 16 == 3) { mkgrid[4] = data[a]; } // 도서명
|
|
if (a % 16 == 4) { mkgrid[5] = data[a]; } // 저자
|
|
if (a % 16 == 5) { mkgrid[6] = data[a]; } // 출판사
|
|
if (a % 16 == 6) { mkgrid[7] = data[a]; } // 주문수
|
|
if (a % 16 == 7) { mkgrid[8] = data[a]; } // 원주문
|
|
if (a % 16 == 8) { mkgrid[9] = data[a]; } // 정가
|
|
if (a % 16 == 9) { mkgrid[10] = data[a]; } // 합계
|
|
if (a % 16 == 10) { mkgrid[11] = data[a]; } // 비고
|
|
if (a % 16 == 11) { mkgrid[12] = data[a]; } // 납품처
|
|
if (a % 16 == 12) { mkgrid[13] = data[a]; } // 주문일자
|
|
if (a % 16 == 13) { mkgrid[14] = data[a]; } // 송금일자
|
|
if (a % 16 == 14) { mkgrid[15] = data[a]; } // 번호
|
|
if (a % 16 == 15) { // 번호
|
|
mkgrid[15] += " " + data[a];
|
|
if (chk == false) { dataGridView1.Rows.Add(mkgrid); }
|
|
else {
|
|
if(Array_Inspection(mkgrid) == true)
|
|
{
|
|
dataGridView1.Rows.Add(mkgrid);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 작업명단 검색중 상위 텍스트박스 및 콤보박스의 값에 따라 출력할지 안할지 분류.
|
|
/// </summary>
|
|
/// <param name="strValues"></param>
|
|
/// <returns></returns>
|
|
private bool Array_Inspection(string[] strValues)
|
|
{
|
|
if (tb_search_order.Text != "") {
|
|
if(strValues[1].Contains(tb_search_order.Text) == false) {
|
|
return false;
|
|
}
|
|
}
|
|
if (tb_search_book_name.Text != "") {
|
|
if (strValues[3].Contains(tb_search_book_name.Text) == false) {
|
|
return false;
|
|
}
|
|
}
|
|
if (tb_search_book_comp.Text != "") {
|
|
if (strValues[5].Contains(tb_search_book_comp.Text) == false) {
|
|
return false;
|
|
}
|
|
}
|
|
if (cb_state.SelectedIndex == 0) {
|
|
// TODO: 입고 상태 체크해야함. (방법 찾아볼것)
|
|
}
|
|
if (cb_order.SelectedIndex == 2) {
|
|
if(strValues[12] == "") {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
private void tb_search_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.Enter) {
|
|
btn_lookup_Click(null, null);
|
|
}
|
|
}
|
|
private void btn_close_Click(object sender, EventArgs e)
|
|
{
|
|
Close();
|
|
}
|
|
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
if (e.RowIndex >= 0 && e.ColumnIndex == 0)
|
|
{
|
|
grididx = e.RowIndex;
|
|
ColumnIndex = e.ColumnIndex;
|
|
CheckBox check;
|
|
foreach(DataGridViewRow row in dataGridView1.Rows)
|
|
{
|
|
check = (CheckBox)(row.Cells[16].Value);
|
|
}
|
|
}
|
|
}
|
|
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
grididx = e.RowIndex;
|
|
ColumnIndex = e.ColumnIndex;
|
|
if (e.ColumnIndex == 1 || e.ColumnIndex == 14 || e.ColumnIndex == 13 ||
|
|
e.ColumnIndex == 6 || e.ColumnIndex == 15 || e.ColumnIndex == 16)
|
|
{ return; }
|
|
if(e.ColumnIndex == 3 || e.ColumnIndex == 4 || e.ColumnIndex == 5)
|
|
{
|
|
Book_Lookup bl = new Book_Lookup(this);
|
|
bl.TopMost = true;
|
|
string book_name = ((DataGridView)sender).Rows[e.RowIndex].Cells["Book_name"].Value.ToString();
|
|
string author = ((DataGridView)sender).Rows[e.RowIndex].Cells["author"].Value.ToString();
|
|
string book_comp = ((DataGridView)sender).Rows[e.RowIndex].Cells["Book_comp"].Value.ToString();
|
|
string list_name = ((DataGridView)sender).Rows[e.RowIndex].Cells["list_name"].Value.ToString();
|
|
bl.Lookup_Load(book_name, author, book_comp, list_name);
|
|
bl.Show();
|
|
return;
|
|
}
|
|
if (e.ColumnIndex == 0 && chk_O == false)
|
|
{
|
|
dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = "O";
|
|
chk_O = true;
|
|
}
|
|
else if (e.ColumnIndex == 0 && chk_O == true)
|
|
{
|
|
dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = "";
|
|
chk_O = false;
|
|
}
|
|
else if (e.ColumnIndex == 2 && chk_V == false)
|
|
{
|
|
dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = "V";
|
|
chk_V = true;
|
|
}
|
|
else if (e.ColumnIndex == 2 && chk_V == true)
|
|
{
|
|
dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = "";
|
|
chk_V = false;
|
|
}
|
|
else if (chk_mkdate.Contains("." + e.RowIndex + ", ") == true)
|
|
{
|
|
dataGridView1.Rows[e.RowIndex].Cells[12].Value = "";
|
|
chk_mkdate = chk_mkdate.Replace("." + e.RowIndex + ", ", "");
|
|
}
|
|
else if (chk_mkdate.Contains("." + e.RowIndex + " , ") == false)
|
|
{
|
|
dataGridView1.Rows[e.RowIndex].Cells[12].Value = System.DateTime.Now.ToString("d");
|
|
chk_mkdate += "." + e.RowIndex + ", ";
|
|
}
|
|
}
|
|
private void tb_search_book_list_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
// 폼 새로 띄워서 검색기능활성화해야함.
|
|
if(e.KeyCode == Keys.Enter)
|
|
{
|
|
Order_input_Search search = new Order_input_Search(this);
|
|
search.Where_Open = "book_list";
|
|
search.TopMost = true;
|
|
search.Show();
|
|
}
|
|
}
|
|
private void tb_orderText_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.Enter)
|
|
{
|
|
Order_input_Search search = new Order_input_Search(this);
|
|
search.Where_Open = "Order";
|
|
search.TopMost = true;
|
|
search.Show();
|
|
}
|
|
}
|
|
private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if(ColumnIndex == 1)
|
|
{
|
|
tb_orderText_KeyDown(null, e);
|
|
}
|
|
}
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
{
|
|
List<int> chkIdx = new List<int>();
|
|
for(int a = 0; a < dataGridView1.Rows.Count; a++)
|
|
{
|
|
if (dataGridView1.Rows[a].Cells["chk"].Value.ToString() == "V")
|
|
{
|
|
chkIdx.Add(a);
|
|
}
|
|
}
|
|
string[][] inputExcel = new string[chkIdx.Count][];
|
|
for(int a = 0; a < chkIdx.Count; a++)
|
|
{
|
|
inputExcel[a][0] = dataGridView1.Rows[chkIdx[0]].Cells["book_comp"].Value.ToString(); // 출판사
|
|
inputExcel[a][1] = dataGridView1.Rows[chkIdx[1]].Cells["book_name"].Value.ToString(); // 도서명
|
|
inputExcel[a][2] = dataGridView1.Rows[chkIdx[2]].Cells["author"].Value.ToString(); // 저자
|
|
inputExcel[a][3] = dataGridView1.Rows[chkIdx[3]].Cells["order_count"].Value.ToString(); // 주문수
|
|
inputExcel[a][4] = dataGridView1.Rows[chkIdx[4]].Cells["pay"].Value.ToString(); // 정가
|
|
inputExcel[a][5] = dataGridView1.Rows[chkIdx[5]].Cells["list_name"].Value.ToString(); // 납품목록명
|
|
inputExcel[a][6] = dataGridView1.Rows[chkIdx[6]].Cells["isbn"].Value.ToString(); // ISBN
|
|
}
|
|
Excel_text ex = new Excel_text();
|
|
ex.mk_Excel_Order(inputExcel);
|
|
}
|
|
}
|
|
} |