/// <summary> /// 搜索按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DMButton_Search_Click(object sender, RoutedEventArgs e) { stockBase.StockList.Clear(); List <WMS_Stock_Model> list = new List <WMS_Stock_Model>(); DataTable dt = WMS_Stock_Bll.Select_Stock(" SN = '" + SearchText.Text.Trim() + "'"); for (int i = 0; i < dt.Rows.Count; i++) { WMS_Stock_Model wMS_Stock_Model = new WMS_Stock_Model { ShelfNo = dt.Rows[i]["ShelfNo"].ToString(), AreaNo = dt.Rows[i]["AreaNo"].ToString(), WarehouseNo = dt.Rows[i]["WarehouseNo"].ToString(), SN = dt.Rows[i]["SN"].ToString(), ProductionNo = dt.Rows[i]["ProductionNo"].ToString(), PutInNo = dt.Rows[i]["PutInNo"].ToString() }; list.Add(wMS_Stock_Model); } foreach (var model in list) { stockBase.StockList.Add(model); } this.StockDataGrid.ItemsSource = stockBase.StockList; }
/// <summary> /// 更新库存 /// </summary> /// <param name="wms_Stock_Model"></param> /// <param name="condition"></param> /// <returns></returns> public static int Update_Stock(WMS_Stock_Model wms_Stock_Model, string condition) { using (var con = GetOpenConnection()) { return(con.Execute(WMS_Stock_Dal.Update_Stock(wms_Stock_Model, condition))); } }
/// <summary> /// 插入库存 /// </summary> /// <param name="wms_Stock_Model"></param> /// <returns></returns> public static int Insert_Stock(WMS_Stock_Model wms_Stock_Model) { using (var con = GetOpenConnection()) { return(con.Execute(WMS_Stock_Dal.Insert_Stock(wms_Stock_Model))); } }
/// <summary> /// 插入库存 /// </summary> /// <param name="wms_Stock_Model"></param> /// <returns></returns> public static string Insert_Stock(WMS_Stock_Model wms_Stock_Model) { string _insertSql = "INSERT INTO [WMS].[dbo].[WMS_Stock]" + "([ShelfNo],[AreaNo],[WarehouseNo],[SN],[ProductionNo]" + ",[PutInNo],[LocationNo],[Status])VALUES('" + wms_Stock_Model.ShelfNo + "','" + wms_Stock_Model.AreaNo + "','" + wms_Stock_Model.WarehouseNo + "','" + wms_Stock_Model.SN + "','" + wms_Stock_Model.ProductionNo + "','" + wms_Stock_Model.PutInNo + "','" + wms_Stock_Model.LocationNo + "'," + wms_Stock_Model.Status + ")"; return(_insertSql); }
/// <summary> /// 更新库存 /// </summary> /// <param name="wms_Stock_Model"></param> /// <param name="condition"></param> /// <returns></returns> public static string Update_Stock(WMS_Stock_Model wms_Stock_Model, string condition) { string _updateSql = "UPDATE [WMS].[dbo].[WMS_Stock]" + "SET[ShelfNo] = '" + wms_Stock_Model.ShelfNo + "',[AreaNo] = '" + wms_Stock_Model.AreaNo + "',[WarehouseNo] = '" + wms_Stock_Model.WarehouseNo + "',[SN] = '" + wms_Stock_Model.SN + "',[ProductionNo] = '" + wms_Stock_Model.ProductionNo + "',[PutInNo] = '" + wms_Stock_Model.PutInNo + "',[LocationNo] = '" + wms_Stock_Model.LocationNo + "',[Status] = " + wms_Stock_Model.Status + " WHERE " + condition; return(_updateSql); }
/// <summary> /// 获取列表 /// </summary> /// <returns></returns> public static List <WMS_Stock_Model> GetStockList() { List <WMS_Stock_Model> list = new List <WMS_Stock_Model>(); DataTable dt = WMS_Stock_Bll.Select_Stock(string.Empty); for (int i = 0; i < dt.Rows.Count; i++) { WMS_Stock_Model wms_Stock_Model = new WMS_Stock_Model { ShelfNo = dt.Rows[i]["ShelfNo"].ToString(), AreaNo = dt.Rows[i]["AreaNo"].ToString(), WarehouseNo = dt.Rows[i]["WarehouseNo"].ToString(), SN = dt.Rows[i]["SN"].ToString(), ProductionNo = dt.Rows[i]["ProductionNo"].ToString(), PutInNo = dt.Rows[i]["PutInNo"].ToString() }; list.Add(wms_Stock_Model); } return(list); }
/// <summary> /// 编辑事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void StockDataGrid_RowEditEnding(object sender, DataGridRowEditEndingEventArgs e) { wms_Stock_Model = e.Row.Item as WMS_Stock_Model; stockName = wms_Stock_Model.SN; }