/// <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="sender"></param> /// <param name="e"></param> private void DMButton_Delete_Click(object sender, RoutedEventArgs e) { foreach (var no in selectStockName) { WMS_Stock_Bll.Delete_Stock(" SN = '" + no + "'"); } Page_Frush(); }
/// <summary> /// 保存按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DMButton_Save_Click(object sender, RoutedEventArgs e) { if (editFlag == 1) { WMS_Stock_Bll.Insert_Stock(wms_Stock_Model); } else if (editFlag == 2) { WMS_Stock_Bll.Update_Stock(wms_Stock_Model, " SN = '" + stockName + "'"); } editFlag = 0; Page_Frush(); StockDataGrid.CanUserAddRows = false; StockDataGrid.IsReadOnly = true; }
/// <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> /// <returns></returns> public static List <WMS_StoreDisplay_Model> GetStoreDisplayList() { List <WMS_StoreDisplay_Model> list = new List <WMS_StoreDisplay_Model>(); DataTable dataTable = WMS_Stock_Bll.Select_StockDisplay(); DataTable shelfDt = WMS_Shelf_Bll.Select_Shelf("ORDER"); for (int i = 0; i < shelfDt.Rows.Count; i++) //货架数 { DataTable dt = new DataTable(); dt = dataTable.AsEnumerable().Where(o => o.Field <string>("AreaNo").ToString() == shelfDt.Rows[i]["AreaNo"].ToString()).CopyToDataTable(); int f = 1; for (int m = 0; m < dt.Rows.Count; m++) //已存PACK { for (int j = 1; j <= int.Parse(dt.Rows[m]["ShelfNo"].ToString().Substring(2)); j++) //以空补足未存位置--竖 { if (int.Parse(dt.Rows[m]["LocationNo"].ToString().Substring(2)) == j) { for (int n = f; n < int.Parse(dt.Rows[m]["ShelfNo"].ToString().Substring(0, 2)); n++)//以空补足未存位置--横 { if (int.Parse(dt.Rows[m]["LocationNo"].ToString().Substring(0, 2)) == f) { SetColumn(f, dt.Rows[m]["SN"].ToString()); } f++; if (f == int.Parse(dt.Rows[m]["ShelfNo"].ToString().Substring(0, 2))) { f = 1; } } } list.Add(wMS_StoreDisplay_Model); wMS_StoreDisplay_Model = new WMS_StoreDisplay_Model(); } } } return(list); }