private void Meat_Input() { try { if (cmb_meatkind.SelectedValue == null || cmb_meatkind.SelectedValue.Equals("")) { MessageBox.Show("지육을 선택하여 주십시오."); return; } if (txt_meat_amount.Text == null || txt_meat_amount.Text.ToString().Equals("") || int.Parse(txt_meat_amount.Text.ToString()) < 1) { MessageBox.Show("입고 수량을 1두 이상 입력하여 주십시오."); return; } if (txt_meat_weight.Text == null || txt_meat_weight.Text.ToString().Equals("") || double.Parse(txt_meat_weight.Text.ToString()) < 0) { MessageBox.Show("총 중량을 입력하여 주십시오."); return; } if (txt_meat_weight.Text == null || txt_meat_weight.Text.ToString().Equals("") || double.Parse(txt_meat_weight.Text.ToString()) < 0) { MessageBox.Show("총 중량을 입력하여 주십시오."); return; } if (txt_meat_price.Text == null || txt_meat_price.Text.ToString().Equals("") || int.Parse(txt_meat_price.Text.ToString()) < 0) { MessageBox.Show("매입가를 입력하여 주십시오."); return; } if (txt_comment.Text == null) { txt_comment.Text = ""; } if (txt_cust_cd.Text == null || txt_cust_cd.Text.ToString().Equals("")) { MessageBox.Show("구매처를 입력해 주십시오."); return; } if (txt_slauhouse_cd.Text == null || txt_slauhouse_cd.Text.ToString().Equals("")) { MessageBox.Show("도축장을 입력해 주십시오."); return; } if (chk_input_yn.Checked == true) { StringBuilder sb = new StringBuilder(); sb.AppendLine("※ 공정 완료 ※"); sb.AppendLine("이미 공정이 완료되어 수정할 수 없습니다."); ComInfo comInfo = new ComInfo(); MessageBox.Show(sb.ToString()); } Console.WriteLine("combo : " + cmb_meatkind.SelectedValue); Console.WriteLine("cmb_text: " + cmb_meatkind.GetItemText(cmb_meatkind.SelectedItem).ToString()); Console.WriteLine("amount : " + txt_meat_amount.Text.ToString()); Console.WriteLine("weight : " + txt_meat_weight.Text.ToString()); Console.WriteLine("price : " + txt_meat_price.Text.ToString()); Console.WriteLine("date : " + txt_input_date.Text.ToString()); Console.WriteLine("comment : " + txt_comment.Text.ToString()); Console.WriteLine("cust : " + txt_cust_nm.Text.ToString()); Console.WriteLine("chk : " + chk_input_yn.Checked.ToString()); wnDm wDm = new wnDm(); int rsNum = 1; if (lbl_input_gbn.Text.Equals("")) { rsNum = wDm.insert_Meat_Input( cmb_meatkind.SelectedValue.ToString() , cmb_meatkind.GetItemText(cmb_meatkind.SelectedItem).ToString() , txt_meat_amount.Text.ToString() , txt_meat_weight.Text.ToString() , txt_meat_price.Text.ToString().Replace(",", "") , txt_input_date.Text.ToString() , txt_comment.Text.ToString() , txt_cust_cd.Text.ToString() , chk_input_yn.Checked.ToString().Equals("True") ? "1" : "0" , txt_mf_date.Text.ToString() , txt_union_cd.Text.ToString() , cmb_grade_gubun.SelectedValue.ToString() , cmb_fgubun.SelectedValue.ToString() , txt_slauhouse_cd.Text.ToString() , sourceRawGrid ); } else {//2019-10-31 이재원 도입기업의 요구에 따라 테이블 구조를 수정하였음 // 그에 따른 로직 변경 rsNum = wDm.Update_Meat_Input( cmb_meatkind.SelectedValue.ToString() , cmb_meatkind.GetItemText(cmb_meatkind.SelectedItem).ToString() , txt_meat_amount.Text.ToString() , txt_meat_weight.Text.ToString() , txt_meat_price.Text.ToString().Replace(",", "") , txt_input_date.Text.ToString() , txt_input_cd.Text.ToString() , txt_comment.Text.ToString() , txt_cust_cd.Text.ToString() , chk_input_yn.Checked.ToString().Equals("True") ? "1" : "0" , txt_mf_date.Text.ToString() , txt_union_cd.Text.ToString() , cmb_grade_gubun.SelectedValue.ToString() , cmb_fgubun.SelectedValue.ToString() , txt_slauhouse_cd.Text.ToString() , sourceRawGrid ); } if (rsNum == 0) { if (lbl_input_gbn.Text.Equals("")) { resetSetting(); input_list(tdInputGrid, "where convert(varchar(10), A.INTIME, 120) = convert(varchar(10), getDate(), 120) "); MessageBox.Show("성공적으로 등록하였습니다."); } else { resetSetting(); input_list(tdInputGrid, "where convert(varchar(10), A.INTIME, 120) = convert(varchar(10), getDate(), 120) "); input_list(inputGrid, "where A.INPUT_DATE >= '" + start_date.Text.ToString() + "' and A.INPUT_DATE <= '" + end_date.Text.ToString() + "'"); MessageBox.Show("성공적으로 수정하였습니다."); } } else if (rsNum == 1) { MessageBox.Show("저장에 실패하였습니다"); } else if (rsNum == 2) { MessageBox.Show("SQL COMMAND 에러"); } else if (rsNum == 3) { MessageBox.Show("기존 코드가 있으니 \n 다른 코드로 입력 바랍니다."); } else { MessageBox.Show("Exception 에러"); } } catch (Exception e) { MessageBox.Show("시스템 에러: " + e.Message.ToString()); } }