using System; using System.Windows; using System.Data; using SSWMS.Common; using System.Collections.Generic; namespace SSWMS.Client { public partial class MANAGE_OUT_CELL : AvalonDock.DocumentContent { private string MANAGE_TYPE = string.Empty; private string MANAGE_TYPE_CONTENT = string.Empty; public MANAGE_OUT_CELL(string sManageType) { InitializeComponent(); DocumentContent_Loaded(null, null); this.MANAGE_TYPE = sManageType; if (this.MANAGE_TYPE == SystemCode.MANAGE_TYPE.OutPick) { this.MANAGE_TYPE_CONTENT = "盘点出库"; } else { this.MANAGE_TYPE_CONTENT = "立库出库"; } this.bOutCell.Content = this.MANAGE_TYPE_CONTENT; } private void DocumentContent_Loaded(object sender, RoutedEventArgs e) { try { this.cbEndDevice.ItemsSource = SystemCodeData.DicDataView["CELL_CODE_OUT"]; //if (this.cbEndDevice.Items.Count > 0) //{ // this.cbEndDevice.SelectedIndex = 0; //} //this.cbStockType.ItemsSource = SystemCodeData.DicDataView["GOODS_ID_STOCK"]; //if (this.cbStockType.Items.Count > 0) //{ // this.cbStockType.SelectedIndex = 0; //} this.ucStorage.dgData.U_WindowName = "COMMON"; this.ucStorage.dgData.U_XmlTableName = "V_STORAGE_LIST"; this.ucStorage.dgData.U_TableName = "V_STORAGE_LIST_CELL_OUT"; this.ucStorage.dgData.U_OrderField = "GOODS_CLASS,STORAGE_ID,STORAGE_LIST_ID"; //this.ucStorage.dgData.U_TotalColumnName = "STORAGE_LIST_QUANTITY"; this.ucStorage.dgData.U_AllowOperatData = false; this.ucStorage.dgData.U_AllowChecked = true; this.ucStorage.U_InitControl(); } catch (Exception ex) { MessageDialog.ShowException(ex); } } private void bOutCell_Click(object sender, RoutedEventArgs e) { try { if (this.cbEndDevice.SelectedIndex == -1) { MessageDialog.ShowException("请选择目标位置"); return; } DataRowView[] drvArray = this.ucStorage.dgData.U_GetCheckDataRow(); if (drvArray.Length == 0) { MessageDialog.ShowException("请选择库存"); return; } if (MessageDialog.ShowDialog($"确认执行{this.MANAGE_TYPE_CONTENT}")) { List lStockBarcode = new List(); foreach (DataRowView drv in drvArray) { string sStockBarcode = drv["STOCK_BARCODE"].ToString(); if (!string.IsNullOrWhiteSpace(sStockBarcode) && drv["FORK_TYPE"].ToString() != SystemCode.FORK_TYPE.CellFar && !lStockBarcode.Contains(sStockBarcode)) { lStockBarcode.Add(sStockBarcode); } } foreach (DataRowView drv in drvArray) { string sStockBarcode = drv["STOCK_BARCODE"].ToString(); if (!string.IsNullOrWhiteSpace(sStockBarcode) && drv["FORK_TYPE"].ToString() == SystemCode.FORK_TYPE.CellFar && !lStockBarcode.Contains(sStockBarcode)) { lStockBarcode.Add(sStockBarcode); } } string sResult = string.Empty; bool bResult = WCFChannel._I_ManageService.ManageOutCellMulti(lStockBarcode, this.cbEndDevice.SelectedValue as string, 0, this.MANAGE_TYPE, MainApp._USER.USER_NAME, out sResult); if (bResult) { //this.bRefresh_Click(null, null); this.ucStorage.U_InitControlData(); } MessageDialog.ShowResult(bResult, sResult); } } catch (Exception ex) { MessageDialog.ShowException(ex); } } //private void bStockOutCell_Click(object sender, RoutedEventArgs e) //{ // try // { // if (this.cbEndDevice.SelectedIndex == -1) // { // MessageDialog.ShowException("请选择目标位置"); // return; // } // if (this.cbStockType.SelectedIndex == -1) // { // MessageDialog.ShowException("请选择托盘类型"); // return; // } // if (this.ucStorage.dgData.U_GetCheckDataRow().Length > 0) // { // MessageDialog.ShowException("请清空选择库存"); // return; // } // if (MessageDialog.ShowDialog("确认执行空托盘出库")) // { // string sResult = string.Empty; // bool bResult = WCFChannel._I_ManageService.ManageOutCell(string.Empty, // this.cbEndDevice.SelectedValue as string, Convert.ToInt32(this.cbStockType.SelectedValue), // 0, 0, SystemCode.MANAGE_TYPE.OutCell, MainApp._USER.USER_NAME, out sResult); // if (bResult) // { // this.ucStorage.U_InitControlData(true); // } // MessageDialog.ShowResult(bResult, sResult); // } // } // catch (Exception ex) // { // MessageDialog.ShowException(ex); // } //} private void bRefresh_Click(object sender, RoutedEventArgs e) { this.ucStorage.U_InitControl(); //this.cbEndDevice.SelectedIndex = -1; //this.cbStockType.SelectedIndex = -1; } } }