using System; using System.Windows; using System.Data; using SSWMS.Common; using System.Collections.Generic; namespace SSWMS.Client { public partial class PLAN_OUT_STATION : AvalonDock.DocumentContent { private int PlanID = 0; public PLAN_OUT_STATION(int iPlanID) { InitializeComponent(); this.PlanID = iPlanID; this.Title = $"暂存出库-[{this.PlanID}]"; DocumentContent_Loaded(null, null); } private void DocumentContent_Loaded(object sender, RoutedEventArgs e) { try { this.dgStorageList.U_WindowName = "COMMON"; this.dgStorageList.U_XmlTableName = "V_STORAGE_LIST_OUT"; this.dgStorageList.U_TableName = "V_STORAGE_LIST_STATION_OUT"; this.dgStorageList.U_OrderField = "STORAGE_LIST_ID"; //this.dgStorageList.U_TotalColumnName = "STORAGE_LIST_QUANTITY"; this.dgStorageList.U_Where = "1<>1"; this.dgStorageList.U_AllowOperatData = false; this.dgStorageList.U_AllowChecked = true; this.dgStorageList.U_InitControl(); this.dgPlan.U_WindowName = "COMMON"; this.dgPlan.U_XmlTableName = "V_PLAN_LIST"; this.dgPlan.U_TableName = "V_PLAN_LIST"; this.dgPlan.U_Where = $"PLAN_ID={this.PlanID}"; this.dgPlan.U_OrderField = "PLAN_LIST_ID"; this.dgPlan.U_AllowOperatData = false; this.dgPlan.U_SelectedChanged += () => { DataRowView drv = this.dgPlan.gridApp.SelectedItem as DataRowView; if (drv == null) { this.dgStorageList.U_Where = "1<>1"; } else { string sStorageProperty01 = drv["STORAGE_PROPERTY_01"].ToString(); string sStorageProperty02 = drv["STORAGE_PROPERTY_02"].ToString(); string sStorageProperty03 = drv["STORAGE_PROPERTY_03"].ToString(); string sStorageProperty04 = drv["STORAGE_PROPERTY_04"].ToString(); string sStorageProperty05 = drv["STORAGE_PROPERTY_05"].ToString(); string sStorageProperty06 = drv["STORAGE_PROPERTY_06"].ToString(); string sStorageProperty07 = drv["STORAGE_PROPERTY_07"].ToString(); string sStorageProperty08 = drv["STORAGE_PROPERTY_08"].ToString(); string sStorageProperty09 = drv["STORAGE_PROPERTY_09"].ToString(); string sStorageProperty10 = drv["STORAGE_PROPERTY_10"].ToString(); string sBoxBarcode = drv["BOX_BARCODE"].ToString(); string sGoodsBarcode = drv["GOODS_BARCODE"].ToString(); string sWhere = $"GOODS_ID={drv["GOODS_ID"]}"; if (!string.IsNullOrWhiteSpace(sStorageProperty01)) { sWhere += $" and STORAGE_PROPERTY_01='{sStorageProperty01}'"; } if (!string.IsNullOrWhiteSpace(sStorageProperty02)) { sWhere += $" and STORAGE_PROPERTY_02='{sStorageProperty02}'"; } if (!string.IsNullOrWhiteSpace(sStorageProperty03)) { sWhere += $" and STORAGE_PROPERTY_03='{sStorageProperty03}'"; } if (!string.IsNullOrWhiteSpace(sStorageProperty04)) { sWhere += $" and STORAGE_PROPERTY_04='{sStorageProperty04}'"; } if (!string.IsNullOrWhiteSpace(sStorageProperty05)) { sWhere += $" and STORAGE_PROPERTY_05='{sStorageProperty05}'"; } if (!string.IsNullOrWhiteSpace(sStorageProperty06)) { sWhere += $" and STORAGE_PROPERTY_06='{sStorageProperty06}'"; } if (!string.IsNullOrWhiteSpace(sStorageProperty07)) { sWhere += $" and STORAGE_PROPERTY_07='{sStorageProperty07}'"; } if (!string.IsNullOrWhiteSpace(sStorageProperty08)) { sWhere += $" and STORAGE_PROPERTY_08='{sStorageProperty08}'"; } if (!string.IsNullOrWhiteSpace(sStorageProperty09)) { sWhere += $" and STORAGE_PROPERTY_09='{sStorageProperty09}'"; } if (!string.IsNullOrWhiteSpace(sStorageProperty10)) { sWhere += $" and STORAGE_PROPERTY_10='{sStorageProperty10}'"; } if (!string.IsNullOrWhiteSpace(sBoxBarcode)) { sWhere += $" and BOX_BARCODE='{sBoxBarcode}'"; } if (!string.IsNullOrWhiteSpace(sGoodsBarcode)) { sWhere += $" and GOODS_BARCODE='{sGoodsBarcode}'"; } this.dgStorageList.U_Where = sWhere; } this.dgStorageList.U_InitControl(); }; this.dgPlan.U_InitControl(); PLAN_MAIN pm = WCFChannel._I_PlanService.GetPlanMain(this.PlanID); if (pm == null) { MessageDialog.ShowException(string.Format("未找到计划 {0}", this.PlanID)); return; } else { this.cbPlanType.ItemsSource = SystemCodeData.DicDataView["PLAN_TYPE"]; this.cbPlanType.SelectedValue = pm.PLAN_TYPE; //if (pm.PLAN_TYPE == SystemCode.PLAN_TYPE.PlanIn) //{ // this.cbPlanStation.ItemsSource = SystemCodeData.DicDataView["CELL_CODE_IN"]; //} //else if (pm.PLAN_TYPE == SystemCode.PLAN_TYPE.PlanOut) //{ // this.cbPlanStation.ItemsSource = SystemCodeData.DicDataView["CELL_CODE_OUT"]; //} //this.cbPlanStation.SelectedValue = pm.PLAN_STATION; this.tbPlanStation.Text = pm.PLAN_STATION; this.tbPlanCode.Text = pm.PLAN_CODE; this.tbRemark.Text = pm.PLAN_REMARK; } } catch (Exception ex) { MessageDialog.ShowException(ex); } } private void bOutPlan_Click(object sender, RoutedEventArgs e) { try { DataRowView[] drvArray = this.dgStorageList.U_GetCheckDataRow(); if (drvArray.Length == 0) { MessageDialog.ShowException("请选择库存"); return; } if (MessageDialog.ShowDialog("确认执行计划暂存出库")) { List lStorageList = new List(); Dictionary dStorageStockBarcode = new Dictionary(); foreach (DataRowView drv in drvArray) { decimal dManageListQuantity = Convert.ToDecimal(drv["MANAGE_LIST_QUANTITY"]); if (dManageListQuantity <= 0) { continue; } int iStorageID = Convert.ToInt32(drv["STORAGE_ID"]); string sStockBarcode = drv["STOCK_BARCODE"].ToString(); lStorageList.Add(new STORAGE_LIST() { STORAGE_ID = iStorageID, STORAGE_LIST_ID = Convert.ToInt32(drv["STORAGE_LIST_ID"]), STORAGE_LIST_QUANTITY = dManageListQuantity }); if (!dStorageStockBarcode.ContainsKey(iStorageID)) { dStorageStockBarcode.Add(iStorageID, sStockBarcode); } } if (lStorageList.Count == 0) { MessageDialog.ShowException("请输入出库数量"); return; } string sResult = string.Empty; bool bResult = WCFChannel._I_ManageService.ManageOutStationMulti( dStorageStockBarcode, lStorageList, this.PlanID, MainApp._USER.USER_NAME, out sResult); if (bResult) { //this.bRefresh_Click(null, null); this.dgPlan.U_InitControl(true); } MessageDialog.ShowResult(bResult, sResult); } } catch (Exception ex) { MessageDialog.ShowException(ex); } } private void bRefresh_Click(object sender, RoutedEventArgs e) { this.dgPlan.U_InitControl(); } } }