using ClientLib; using ClientLib.CommonService2; using DevExpress.XtraEditors; using PublicLib; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.IO; using System.Linq; using System.Net; using System.Reflection; using System.Text; using System.Threading; using System.Windows.Forms; namespace HANMI_MACH { partial class MachASManagerPopup : PublicLib.CommonPopup { private string m_Type, m_comp_cd, m_mach_cd; public MachASManagerPopup(string comp_cd, string mach_cd) { InitializeComponent(); this.Icon = ConstClass._MAIN.Icon; m_Type = "I"; m_comp_cd = comp_cd; m_mach_cd = mach_cd; //AS일자 dateEdit_AS_DT.DateTime = DateTime.Now; //AS종류 DataView asKindCD = new DataView(ConstClass._DATA); asKindCD.RowFilter = "CATE_CD = 'E' and GRP_CD = 'E02'"; UtilClass.SetLookup(lookUpEdit_ASKIND_CD, asKindCD, "NO_CD", "NO_CD_NM", true); this.Shown += (sender, e) => { try { //설비 SerializedSqlParam[] aParam = new SerializedSqlParam[] { ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar,m_comp_cd) }; ResultData resultMACH = ClientClass.GetData("getMachineForLookup", aParam); if (resultMACH.isError) { throw new Exception(resultMACH.ResultValue); } UtilClass.SetLookup(lookUpEdit_MACH_CD, resultMACH.DataList.Tables[1], "MACH_CD", "MACH_NM", true); if (m_mach_cd != "ALL") { lookUpEdit_MACH_CD.EditValue = m_mach_cd; } } catch (Exception ex) { MessageBox.Show(ex.Message); this.Close(); } }; //보수품 lookUpEdit_MACH_CD.EditValueChanged += (sender, e) => { SerializedSqlParam[] aParam1 = new SerializedSqlParam[] { ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar,m_comp_cd), ClientClass.CreateSqlParameter("MACH_CD", SqlDbType.NVarChar,UtilClass.toStr(lookUpEdit_MACH_CD.EditValue)) }; ResultData resultMACHMAT = ClientClass.GetData("getMachineMATForLookup", aParam1); if (resultMACHMAT.isError) { throw new Exception(resultMACHMAT.ResultValue); } UtilClass.SetLookup(lookUpEdit_MAT_CD, resultMACHMAT.DataList.Tables[1], "MAT_CD", "MAT_NM", true); }; this.simpleButton_CANCEL.Click += (sender, e) => { this.DialogResult = DialogResult.Cancel; this.Close(); }; this.simpleButton_Save.Click += (sender, e) => { saveProc(false); }; this.simpleButton_SaveClose.Click += (sender, e) => { saveProc(true); }; this.Shown += (sender, e) => { lookUpEdit_MACH_CD.Focus(); }; } private void saveProc(bool candClose) { try { this.Cursor = Cursors.WaitCursor; if (UtilClass.isNull(lookUpEdit_ASKIND_CD.Text)) { lookUpEdit_ASKIND_CD.Focus(); throw new Exception("AS 구분을 선택하십시오."); } if (UtilClass.isNull(lookUpEdit_MACH_CD.Text)) { lookUpEdit_MACH_CD.Focus(); throw new Exception("설비를 선택하십시오."); } if (UtilClass.isNull(lookUpEdit_MAT_CD.EditValue)) { lookUpEdit_MAT_CD.Focus(); throw new Exception("보수품을 선택하십시오."); } if (UtilClass.isNull(textEdit_WORK_DESC.EditValue)) { textEdit_WORK_DESC.Focus(); throw new Exception("작업내용을 입력하십시오."); } //m_ITEM_CD = UtilClass.toStr(lookUpEdit_TYPE_CD.EditValue) + // UtilClass.toStr(lookUpEdit_NAME_CD.EditValue) + // UtilClass.toStr(lookUpEdit_COLOR_CD.EditValue) + // UtilClass.toFloat(textEdit_THICK_mm.Text).ToString("n2") + // UtilClass.toFloat(textEdit_WIDTH_mm.Text).ToString("n0"); SerializedSqlParam[] aParam = new SerializedSqlParam[] { ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, m_comp_cd), ClientClass.CreateSqlParameter("MACH_CD", SqlDbType.NVarChar, lookUpEdit_MACH_CD.EditValue), ClientClass.CreateSqlParameter("AS_DT", SqlDbType.NVarChar, dateEdit_AS_DT.DateTime.ToString("yyyy-MM-dd")), ClientClass.CreateSqlParameter("AS_SEQ", SqlDbType.Int, 0), ClientClass.CreateSqlParameter("AS_KIND_CD", SqlDbType.NVarChar, lookUpEdit_ASKIND_CD.EditValue), ClientClass.CreateSqlParameter("MAT_CD", SqlDbType.NVarChar, lookUpEdit_MAT_CD.EditValue), ClientClass.CreateSqlParameter("AS_CUSTNM", SqlDbType.NVarChar, textEdit_AS_CUSTNM.Text), ClientClass.CreateSqlParameter("AS_TEL", SqlDbType.NVarChar, textEdit_AS_TEL.Text), ClientClass.CreateSqlParameter("AS_MANAGER", SqlDbType.NVarChar, textEdit_ASMANAGER.Text), ClientClass.CreateSqlParameter("AS_MANAGERTEL", SqlDbType.NVarChar, textEdit_MANAGERTEL.Text), ClientClass.CreateSqlParameter("AS_MY", SqlDbType.Float, UtilClass.toFloat(textEdit_AS_MY.Text)), ClientClass.CreateSqlParameter("AS_VAT_MY", SqlDbType.Float, UtilClass.toFloat(textEdit_AS_VAT_MY.Text)), ClientClass.CreateSqlParameter("AS_SUM_MY", SqlDbType.Float, UtilClass.toFloat(textEdit_AS_SUM_MY.Text)), ClientClass.CreateSqlParameter("AS_WORK_DESC", SqlDbType.NVarChar, textEdit_WORK_DESC.Text), ClientClass.CreateSqlParameter("AS_M_RMK", SqlDbType.NVarChar, textEdit_M_RMK.Text), ClientClass.CreateSqlParameter("REG_ID", SqlDbType.NVarChar, ConstClass._USR_ID), ClientClass.CreateSqlParameter("TYPE", SqlDbType.NVarChar, m_Type), ClientClass.CreateSqlParameter("RUN_RESULT", SqlDbType.NVarChar, "", ParameterDirection.Output, 1000) }; ResultData result = ClientClass.SetData("SaveMachineASManagerPopup", aParam); if (result.isError || !UtilClass.isNull(result.ResultValue)) { throw new Exception(result.ResultValue); } this.Cursor = Cursors.Arrow; MessageBox.Show("정상적으로 저장하였습니다."); if (candClose) { this.DialogResult = DialogResult.Yes; this.Close(); } } catch (Exception ex) { this.Cursor = Cursors.Arrow; MessageBox.Show(ex.Message); } } } }