private void simpleButton2_Click(object sender, EventArgs e) { DataTable _dt; string sql = ""; if (textEdit14.Text.Length == 14) { sql = string.Format("select ITEM,ITEM_DESC,BIN,QTY_BY_LOC,LOT from ERP.FSDBMR.dbo.StockDetail where ITEM = '{0}' AND LOT LIKE '{1}%'", textEdit10.Text, textEdit14.Text.Substring(0, textEdit14.Text.Length - 3)); } else if (textEdit14.Text.Length == 11) { sql = string.Format("select ITEM,ITEM_DESC,BIN,QTY_BY_LOC,LOT from ERP.FSDBMR.dbo.StockDetail where ITEM = '{0}' AND LOT LIKE '{1}%'", textEdit10.Text, textEdit14.Text); } _dt = DBhelp.Query(sql).Tables["ds"]; frmMaterialIn4Shift f = new frmMaterialIn4Shift(_dt); f.ShowDialog(); }
private void btn_serch_Click(object sender, EventArgs e) { DataTable _dt; string sql = string.Format("select ITEM_DESC,BIN,QTY_BY_LOC from ERP.FSDBMR.dbo.StockDetail where ITEM = '{0}' AND LOT = '{1}' AND BIN ='{2}'", textEdit10.Text, textEdit14.Text, textEdit12.Text); _dt = DBhelp.Query(sql).Tables["ds"]; textEdit28.DataBindings.Add("Text", _dt, "ITEM_DESC"); textEdit29.DataBindings.Add("Text", _dt, "QTY_BY_LOC"); textEdit30.DataBindings.Add("Text", _dt, "BIN"); if (_dt.Rows.Count <= 0) { textEdit28.Text = "无记录"; textEdit29.Text = "无记录"; textEdit30.Text = "无记录"; } this.btn_serch.Enabled = false; }
//获取并显示数据 private void LoadTask() { Task task1 = Task.Factory.StartNew(() => { string sql3 = "Select * from IRAPRIMCS..utb_MaterialStore"; if (materialdt != null) { materialdt.Clear(); } try { materialdt = DBhelp.Query(sql3).Tables["ds"]; } catch (Exception e) { MessageBox.Show(e.Message); WriteLog.Instance.Write(e.Message, "加载材料库存数据失败"); } }); splashScreenManager1.SetWaitFormDescription("获取数据中..."); if (maindt != null) { maindt.Clear(); } try { maindt = DBhelp.Query(mainsql).Tables["ds"]; } catch (Exception e) { MessageBox.Show(e.Message); WriteLog.Instance.Write(e.Message, "加载主数据失败!"); } splashScreenManager1.SetWaitFormDescription("显示数据中..."); maindt.PrimaryKey = new DataColumn[] { maindt.Columns["LogID"] }; maindt.Columns.Add("ItemNumber").SetOrdinal(4); maindt.Columns.Add("LotNumber").SetOrdinal(5); maindt.Columns.Add("BinFrom").SetOrdinal(6); maindt.Columns.Add("BinTo").SetOrdinal(7); maindt.Columns.Add("OrderNumber").SetOrdinal(8); maindt.Columns.Add("OLineNo"); maindt.Columns.Add("Quantity").SetOrdinal(8); maindt.Columns.Add("SKUID").SetOrdinal(9); //更改ExCode并为列赋值 for (int i = 0; i < maindt.Rows.Count; i++) { SetDTRow((long)maindt.Rows[i]["LogID"], 1); } gridControl1.UseEmbeddedNavigator = true; gridControl1.EmbeddedNavigator.Enabled = false; maindv = maindt.DefaultView; maindv.Sort = "LinkedLogID asc,LogID asc"; gridControl1.DataSource = maindv; gridControl1.MainView.PopulateColumns(); //隐藏gridView1无用属性 gridView1.Columns["ErrCode"].Visible = false; gridView1.Columns["Retried"].Visible = false; gridView1.Columns["LinkedLogID"].Visible = false; gridView1.Columns["ExChangeXML"].Visible = false; gridView1.Columns["ErrText"].Visible = false; gridView1.Columns["Properties"].Visible = false; gridView1.Columns["SKUID"].GroupIndex = 0; gridView1.BestFitColumns(); Task.WaitAll(task1); }