public List <Model_圆片仓库> ReadList() { List <Model_圆片仓库> data = new List <Model_圆片仓库>(); string sql = "Select sum(a.Quantity),b.* " + "from T_Warehouse_Wafer a " + "Left Join T_ProductInfo_Wafer b ON a.WaferGuid=b.Guid " + "Where b.Guid IS NOT NULL " + "Group By WaferGuid "; DataSet ds = new DataSet(); if (new Helper.SQLite.DBHelper().QueryData(sql, out ds)) { int rowid = 1; foreach (DataRow dr in ds.Tables[0].Rows) { Model_圆片仓库 m = new Model_圆片仓库(); m.Guid = dr.Field <Guid>("Guid"); m.序号 = rowid++; m.编号 = dr.Field <string>("Number"); m.直径 = dr.Field <string>("Diameter"); m.厚度 = dr.Field <string>("Thickness"); m.数量 = dr.Field <Int64>("sum(a.Quantity)"); data.Add(m); } } return(data); }
private void DataGrid_List_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { string newValue = (e.EditingElement as TextBox).Text.Trim(); if (string.IsNullOrWhiteSpace(newValue)) { return; } string header = e.Column.Header.ToString(); Model_圆片仓库 m = this.DataGrid_List.SelectedCells[0].Item as Model_圆片仓库; if (header == this.DataGridTextColumn_编号.Header.ToString()) { Model_圆片资料 w = new ViewModel.MeansOfProduction.Vm_圆片().ReadInfo(newValue); if (w != null) { m.Guid = w.Guid; m.编号 = w.编号; m.直径 = w.直径; m.厚度 = w.厚度; } else { MessageBox.Show("找不到编号对应的品名"); m.编号 = ""; this.DataGrid_List.CurrentCell = new DataGridCellInfo(this.DataGrid_List.SelectedCells[0].Item, this.DataGrid_List.Columns[0]); } } else if (header == this.DataGridTextColumn_数量.Header.ToString()) { Int64 quantity = 0; Int64.TryParse(newValue, out quantity); m.数量 = quantity; } else if (header == this.DataGridTextColumn_入库半成品编号.Header.ToString()) { Model_ProductionManagement_OutsideProcessBatch pm = new OutsideProcessBatchInputConsole().ReadProductInfo(newValue); if (pm.ProductGuid != new Guid()) { m.半成品Guid = pm.ProductGuid; m.半成品品名 = pm.ProductName; } else { MessageBox.Show("找不到编号对应的品名"); m.入库半成品编号 = ""; this.DataGrid_List.CurrentCell = new DataGridCellInfo(this.DataGrid_List.SelectedCells[0].Item, this.DataGrid_List.Columns[5]); } } else if (header == this.DataGridTextColumn_半成品数量.Header.ToString()) { Int64 quantity = 0; Int64.TryParse(newValue, out quantity); m.半成品数量 = quantity; } }