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.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace KHSCALE_TP { public partial class UcOrderList : Form { U3Database u3Database = new U3Database(); U3Config u3Config = new U3Config(); public string orderno; public string lot; public UcOrderList() { InitializeComponent(); u3Database.SetSqlServer(); DataView grpMach = new DataView(GetMachTable()); UtilClass.SetLookup(this.lookUpEdit_Mach, grpMach, "MACH_CD", "MACH_NM", true, true); dateEdit_ORDER_DT.DateTime = DateTime.Now; searchProc(); } public void searchProc() { try { this.Cursor = Cursors.WaitCursor; gridControl_Main.DataSource = null; string sDate = this.dateEdit_ORDER_DT.DateTime.ToString("yyyy-MM-dd"); DataTable resultData = null; resultData = u3Database.OpenSQL("select a.order_no, a.lot, a.resource_no, a.resource_name, a.date_sched_curr, a.demand_status_desc, a.operation, a.initial_name from T_KH_SAL_ORDER a where a.cost_center = '10' and a.date_sched_curr = '" + sDate + "' group by a.order_no, a.lot, a.resource_no, a.resource_name, a.date_sched_curr, a.demand_status_desc, a.operation, a.initial_name"); gridControl_Main.DataSource = resultData; //FilterSub(toggleSwitch_END.IsOn); this.Cursor = Cursors.Arrow; } catch (Exception ex) { this.Cursor = Cursors.Arrow; MessageBox.Show(ex.Message); } } private DataTable GetMachTable() { try { this.Cursor = Cursors.WaitCursor; return u3Database.OpenSQL("select 'N' as SEL_FIELD, a.MACH_CD, a.MACH_NO, a.MACH_NM from dbo.T_STD_MACH a where a.COMP_CD = '" + ConstClass._COMP_CD + "' and isnull(a.DEL_YN,'N') = 'N' order by a.MACH_CD"); } catch (Exception ex) { this.Cursor = Cursors.Arrow; XtraMessageBox.Show(ex.Message); } return null; } private void simpleButton_Pre_Click(object sender, EventArgs e) { try { dateEdit_ORDER_DT.DateTime = dateEdit_ORDER_DT.DateTime.AddDays(-1); searchProc(); } catch (Exception ex) { } } private void simpleButton_Next_Click(object sender, EventArgs e) { try { dateEdit_ORDER_DT.DateTime = dateEdit_ORDER_DT.DateTime.AddDays(1); searchProc(); } catch (Exception ex) { } } private void lookUpEdit_Mach_EditValueChanged(object sender, EventArgs e) { searchProc(); } private void simpleButton_Work_Click(object sender, EventArgs e) { DataRow row = gridView_Main.GetFocusedDataRow(); if (row != null) { orderno = UtilClass.toStr(row["ORDER_NO"]); lot = UtilClass.toStr(row["LOT"]); this.DialogResult = DialogResult.Yes; this.Close(); } } private void gridView_Main_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { DataRow row = gridView_Main.GetFocusedDataRow(); if (row == null) { return; } try { //txt_partno.Text = row["resource_no"].ToString(); //txt_partnm.Text = row["resource_name"].ToString(); } catch (Exception ex) { } } private void simpleButton_ReFresh_Click(object sender, EventArgs e) { searchProc(); } private void toggleSwitch_END_Toggled(object sender, EventArgs e) { FilterSub(toggleSwitch_END.IsOn); } private void FilterSub(bool toggle) { try { if (toggle) { gridView_Main.ActiveFilterString = ""; } else { gridView_Main.ActiveFilterString = "[demand_status_desc] != '완료'"; } } catch (Exception ex) { } } } }