using ClientLib; using ClientLib.CommonService; 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.Reflection; using System.Text; using System.Threading; using System.Windows.Forms; namespace HANMI_J_SALE { partial class SelectRoutingForm : XtraForm { public string m_ROUT_CD; public string m_ITEM_CD; public string m_ITEM_NM; public SelectRoutingForm(string item_cd) { InitializeComponent(); try { SerializedSqlParam[] aParam = new SerializedSqlParam[] { ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD) }; ResultData result = ClientClass.GetData("U3GetRoutingManager", aParam); if (result.isError) { throw new Exception(result.ResultValue); } gridControl_Main.DataSource = result.TableData; if (item_cd != "") { SerializedSqlParam[] bParam = new SerializedSqlParam[] { ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD), ClientClass.CreateSqlParameter("ROUT_CD", SqlDbType.NVarChar, ""), ClientClass.CreateSqlParameter("ITEM_CD", SqlDbType.NVarChar, item_cd) }; result = ClientClass.GetData("U3GetRoutingPopup", bParam); if (result.isError) { throw new Exception(result.ResultValue); } string Temp_ROUT_CD = result.TableData.Rows[0].ItemArray[0].ToString(); string Temp_ITEM_CD = result.TableData.Rows[0].ItemArray[1].ToString(); string Temp_ITEM_NM = result.TableData.Rows[0].ItemArray[2].ToString(); textEdit_Search.Text = result.TableData.Rows[0].ItemArray[2].ToString(); bParam = new SerializedSqlParam[] { ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD), ClientClass.CreateSqlParameter("ROUT_CD", SqlDbType.NVarChar, result.TableData.Rows[0].ItemArray[0].ToString()), ClientClass.CreateSqlParameter("ITEM_CD", SqlDbType.NVarChar, "") }; result = ClientClass.GetData("U3GetRoutingPopup", bParam); if (result.isError) { throw new Exception(result.ResultValue); } result = ClientClass.GetData("U3GetRoutingPopup", bParam); gridControl_Sub.DataSource = result.TableData; m_ROUT_CD = Temp_ROUT_CD; m_ITEM_CD = Temp_ITEM_CD; m_ITEM_NM = Temp_ITEM_NM; }else { SerializedSqlParam[] bParam = new SerializedSqlParam[] { ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD), ClientClass.CreateSqlParameter("ROUT_CD", SqlDbType.NVarChar, ""), ClientClass.CreateSqlParameter("ITEM_CD", SqlDbType.NVarChar, "") }; result = ClientClass.GetData("U3GetRoutingPopup", bParam); if (result.isError) { throw new Exception(result.ResultValue); } gridControl_Sub.DataSource = result.TableData; string Temp_ROUT_CD = result.TableData.Rows[0].ItemArray[0].ToString(); string Temp_ITEM_CD = result.TableData.Rows[0].ItemArray[1].ToString(); string Temp_ITEM_NM = result.TableData.Rows[0].ItemArray[2].ToString(); textEdit_Search.Text = result.TableData.Rows[0].ItemArray[2].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } gridView_Main.FocusedRowChanged += (sender, e) => { DataRow row = gridView_Main.GetFocusedDataRow(); if (row != null) { SerializedSqlParam[] aParam = new SerializedSqlParam[] { ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD), ClientClass.CreateSqlParameter("ROUT_CD", SqlDbType.NVarChar, UtilClass.toStr(row["ROUT_CD"])), ClientClass.CreateSqlParameter("ITEM_CD", SqlDbType.NVarChar, "") }; ResultData result = ClientClass.GetData("U3GetRoutingPopup", aParam); if (result.isError) { throw new Exception(result.ResultValue); } gridControl_Sub.DataSource = result.TableData; } }; gridView_Sub.FocusedRowChanged += (sender, e) => { DataRow row = gridView_Sub.GetFocusedDataRow(); if (row != null) { textEdit_Search.Text = UtilClass.toStr(row["ITEM_NM"]); m_ROUT_CD = UtilClass.toStr(row["ROUT_CD"]); m_ITEM_CD = UtilClass.toStr(row["ITEM_CD"]); m_ITEM_NM = UtilClass.toStr(row["ITEM_NM"]); } }; this.Shown += (sender, e) => { searchProc(); }; textEdit_Search.KeyPress += (sender, e) => { if (e.KeyChar == '\r') { searchProc(); } }; gridView_Sub.DoubleClick += (sender, e) => { DataRow row = gridView_Sub.GetFocusedDataRow(); if (row != null) { m_ROUT_CD = UtilClass.toStr(row["ROUT_CD"]); m_ITEM_CD = UtilClass.toStr(row["ITEM_CD"]); m_ITEM_NM = UtilClass.toStr(row["ITEM_NM"]); this.DialogResult = DialogResult.Yes; this.Close(); } }; simpleButton_OK.Click += (sender, e) => { DataRow row = gridView_Sub.GetFocusedDataRow(); if (row != null) { this.DialogResult = DialogResult.Yes; this.Close(); } }; simpleButton_Cancel.Click += (sender, e) => { this.DialogResult = DialogResult.Cancel; this.Close(); }; } public void searchProc() { //try //{ // this.Cursor = Cursors.WaitCursor; // gridControl_Main.DataSource = null; // SerializedSqlParam[] aParam = new SerializedSqlParam[] { // ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD), // }; // ResultData resultData = ClientClass.GetData("U3GetItemSelectPopup", aParam); // if (resultData.isError) // { // throw new Exception(resultData.ResultValue); // } // gridControl_Main.DataSource = resultData.TableData; // gridView_Main.Focus(); // this.Cursor = Cursors.Arrow; //} //catch (Exception ex) //{ // this.Cursor = Cursors.Arrow; // XtraMessageBox.Show(ex.Message); //} } } }