1041 lines
		
	
	
		
			40 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			1041 lines
		
	
	
		
			40 KiB
		
	
	
	
		
			C#
		
	
	
	
|  | using System; | |||
|  | using System.Collections.Generic; | |||
|  | using System.ComponentModel; | |||
|  | using System.Data; | |||
|  | using System.Drawing; | |||
|  | using System.Text; | |||
|  | using System.Linq; | |||
|  | using System.Windows.Forms; | |||
|  | using DevExpress.XtraBars; | |||
|  | using DevExpress.XtraGrid.Views.Base; | |||
|  | //using DeiNiu.wms.Logical; | |||
|  | using DeiNiu.wms.Data; | |||
|  | using DevExpress.XtraGrid.Columns; | |||
|  |   | |||
|  | using System.Threading; | |||
|  | using DevExpress.XtraGrid.Views.Grid; | |||
|  | using DevExpress.XtraEditors.DXErrorProvider; | |||
|  | using DeiNiu.wms.Data.Model; | |||
|  | using DevExpress.XtraEditors; | |||
|  | using DevExpress.XtraEditors.Controls; | |||
|  | using DeiNiu.Utils; | |||
|  | using DeiNiu.wms.win.ServiceReferenceStockOutRequest; | |||
|  | using DeiNiu.wms.win.ServiceReferenceStockOutPickRequest; | |||
|  | using DeiNiu.Controls.pager; | |||
|  | 
 | |||
|  | namespace DeiNiu.wms.win | |||
|  | { | |||
|  |     public partial class GoodsOutJiHuo : BasicRibbonForm | |||
|  |     { | |||
|  |          | |||
|  |   | |||
|  |         private string lastQuery = "";  | |||
|  |         private int selectedRowIndex = -1; | |||
|  |   | |||
|  |         string currentGoods = ""; | |||
|  |         int currentSkuId = 0; | |||
|  |         enumOutStockRequestStatus currentState; | |||
|  |         DataTable dtDetail; | |||
|  | 
 | |||
|  | 
 | |||
|  | 
 | |||
|  | 
 | |||
|  |         public GoodsOutJiHuo() | |||
|  |         { | |||
|  |             InitializeComponent(); | |||
|  |             initialControls(); | |||
|  | 
 | |||
|  |             //initialBackGroundTasks(); | |||
|  |             //    loadData(); | |||
|  |         } | |||
|  |         #region initialControls | |||
|  |         private void initialControls() | |||
|  |         { | |||
|  |             setDatePiker(dateEditFrom, dateEditFrom); | |||
|  |             initialComboBoxes(); | |||
|  |             initialPagerControls(); | |||
|  |             initialDataGrid(); | |||
|  |             initialQueryInput();  | |||
|  |             setValidationRule(); | |||
|  |             | |||
|  |          //   swAutoOrder.IsOn = WmsConstants.AUTO_SYNC_SALE_ORDER; | |||
|  |         } | |||
|  |         /* | |||
|  |         private void initialBackGroundTasks() | |||
|  |         { | |||
|  |             lgOutReq.UpdateUIDelegate += updatePreOutStatus; | |||
|  |             lgOutReq.TaskCallBack += preOutFinished; | |||
|  |               | |||
|  |             lgt.UpdateUIDelegate += updatePickDetails; | |||
|  |             lgt.TaskCallBack += waveFinished; | |||
|  |           | |||
|  |             newWave(); | |||
|  |             preErpOrders();  | |||
|  |         } | |||
|  | 
 | |||
|  |         */ | |||
|  | 
 | |||
|  |         private void initialComboBoxes() | |||
|  |         { | |||
|  |             this.comboState.Properties.TextEditStyle = TextEditStyles.DisableTextEditor; | |||
|  |            // this.dateEditFrom.EditValue = DateTime.Now.AddDays(+1); | |||
|  |             //this.dateEditTo.EditValue = DateTime.Now.AddDays(2) ; | |||
|  | 
 | |||
|  |          //   this.comOrderType.Properties.TextEditStyle = TextEditStyles.DisableTextEditor; | |||
|  |           //  this.comOrderType.SelectedIndex = 0; | |||
|  | 
 | |||
|  |         //    initialComboBoxs(comOrderType, this.outRequestType,false); | |||
|  | 
 | |||
|  |             Dictionary<int, string> orderStatus = new Dictionary<int, string>();// pickRequestStatus; | |||
|  | 
 | |||
|  |             orderStatus.Add((int)enumOutStockRequestStatus.待出库, enumOutStockRequestStatus.待出库.ToString()); | |||
|  |             orderStatus.Add((int)enumOutStockRequestStatus.待审核, enumOutStockRequestStatus.待审核.ToString()); | |||
|  |             orderStatus.Add((int)enumOutStockRequestStatus.订单驳回, enumOutStockRequestStatus.订单驳回.ToString()); | |||
|  |             orderStatus.Add((int)enumOutStockRequestStatus.订单作废, enumOutStockRequestStatus.订单作废.ToString());  | |||
|  | 
 | |||
|  |             initialComboBoxs(comboState,orderStatus); | |||
|  |             try | |||
|  |             { | |||
|  |                 DataRow[] drs = Park.getDictionary(true).Select("flag >0"); | |||
|  | 
 | |||
|  |                 foreach (DataRow dr in drs) | |||
|  |                 { | |||
|  |                     int flag = Convert.ToInt32(dr["flag"].ToString()); | |||
|  |                     int parentId = Convert.ToInt32(dr["id"].ToString()); | |||
|  |                     DataRow[] drss = Park.getDictionary(false).Select("parentId =" + parentId); | |||
|  |                     switch (flag) | |||
|  |                     { | |||
|  |                         case 6003: | |||
|  | 
 | |||
|  |                             initialComboBoxs(comPickgroup, drss); | |||
|  |                             break; | |||
|  | 
 | |||
|  |                         case 6004: | |||
|  |                             initialComboBoxs(comStartOn, drss); | |||
|  | 
 | |||
|  |                             break; | |||
|  | 
 | |||
|  | 
 | |||
|  |                     } | |||
|  |                 } | |||
|  |             } | |||
|  |             catch (Exception er) | |||
|  |             { | |||
|  |                 showErrorMsg(er, ""); | |||
|  |             }  | |||
|  | 
 | |||
|  |            // this.comOrderType.SelectedIndex = 0;   | |||
|  |         } | |||
|  |        | |||
|  |         private void setValidationRule() | |||
|  |         { | |||
|  |           //  dxValidationProvider.SetValidationRule(comWarehouse, ValidationRules.notEmptyValidationRule); | |||
|  |             //txtGoodType.Properties.MaxLength = 40; | |||
|  |             //txtGoodDesc.Properties.MaxLength = 250; | |||
|  |             //textEdit1.Properties.MaxLength = txtGoodType.Properties.MaxLength; | |||
|  |         } | |||
|  | 
 | |||
|  |         private void initialQueryInput() | |||
|  |         { | |||
|  | 
 | |||
|  |         } | |||
|  | 
 | |||
|  |         private void initialGridView2Columns(GridView gridview)  | |||
|  |         { | |||
|  |           //  setupGridView(gridView1,false); | |||
|  |             //setupGridView(gridView2, false,false); | |||
|  |             //setupGridView(gridView3, false,false); | |||
|  |             //   gridviewGoodsType.PopulateColumns(); | |||
|  |             gridview.Columns.Clear(); | |||
|  |             // gridviewGoodsType.Columns.Remove(gridviewGoodsType.Columns["DealerPrice"]);  | |||
|  |             GridColumn myCol0 = new GridColumn() { Caption = "ID", Visible = true, FieldName = "id" }; | |||
|  |             myCol0.Visible = false; | |||
|  |             gridview.Columns.Add(myCol0); | |||
|  |             GridColumn colChk = new GridColumn() { Caption = CheckBoxField, Visible = true, FieldName = CheckBoxField }; | |||
|  |            // gridview.Columns.Add(colChk); | |||
|  |             GridColumn myCol1 = new GridColumn() { Caption = "单号", Visible = true, FieldName =  "orderNo" }; | |||
|  |             GridColumn myCol2 = new GridColumn() { Caption = "类别", Visible = true, FieldName = WmsOutPickRequest.fields.orderTypeName.ToString() }; | |||
|  |             GridColumn myCol3 = new GridColumn() { Caption = "状态", Visible = true, FieldName = WmsOutPickRequest.fields.state.ToString() }; | |||
|  | 
 | |||
|  |             GridColumn myCol4 = new GridColumn() { Caption = "客户", Visible = true, FieldName = WmsOutPickRequest.fields.customerName. ToString() }; | |||
|  |             GridColumn myCol5 = new GridColumn() { Caption = "备注", Visible = true, FieldName = WmsOutPickRequest.fields.description.ToString() }; | |||
|  |             GridColumn myCol6 = new GridColumn() { Caption = "日期", Visible = true, FieldName = WmsOutPickRequest.fields.dueDate.ToString() }; | |||
|  |             GridColumn myCol7 = new GridColumn() { Caption = "播种单", Visible = true, FieldName = "seedsPickNo" }; | |||
|  |             GridColumn myCol8 = new GridColumn() { Caption = "计划数量", Visible = true, FieldName = "planCount" }; | |||
|  | 
 | |||
|  |              gridview.Columns.Add(myCol4); | |||
|  |              gridview.Columns.Add(myCol1);   | |||
|  |              gridview.Columns.Add(myCol8); | |||
|  |              gridview.Columns.Add(myCol3);  | |||
|  |              gridview.Columns.Add(myCol5);   | |||
|  |   | |||
|  |             //to show bottom scroll bar | |||
|  |             gridview.OptionsView.ColumnAutoWidth = false; | |||
|  |             gridview.BestFitColumns(); | |||
|  |             gridview.Focus(); | |||
|  | 
 | |||
|  | 
 | |||
|  |         //    initialGridView2Columns(); | |||
|  |       //      gridControlDetail.DataSource = null; | |||
|  |             | |||
|  |         } | |||
|  |         private void  initialGridViewColumns(GridView gridview) | |||
|  |         { | |||
|  |             setupGridView(gridview, false ); | |||
|  |          //  gridview.FocusRectStyle = DrawFocusRectStyle.None; | |||
|  |             //   gridviewGoodsType.PopulateColumns(); | |||
|  |             gridview.Columns.Clear(); | |||
|  |             // gridviewGoodsType.Columns.Remove(gridviewGoodsType.Columns["DealerPrice"]);  | |||
|  |             GridColumn myCol0 = new GridColumn() { Caption = "ID", Visible = true, FieldName = "id" }; | |||
|  |             myCol0.Visible = false; | |||
|  |             gridview.Columns.Add(myCol0);  | |||
|  |             GridColumn myCol1 = new GridColumn() { Caption = "商品编码", Visible = true, FieldName = WmsGoods.fields.goodsId.ToString() }; | |||
|  |             GridColumn myCol2 = new GridColumn() { Caption = "商品名称", Visible = true, FieldName = WmsGoods.exfields.goodsName.ToString() }; | |||
|  |             GridColumn myCol3 = new GridColumn() { Caption = "厂家", Visible = true, FieldName = WmsGoods.exfields.manufacturer.ToString() }; | |||
|  |             GridColumn myCol4 = new GridColumn() { Caption = "规格", Visible = true, FieldName = WmsGoods.exfields.spec.ToString() }; | |||
|  |             GridColumn myCol5 = new GridColumn() { Caption = "单位", Visible = true, FieldName = WmsGoods.exfields.unit.ToString() }; | |||
|  |             GridColumn myCol6 = new GridColumn() { Caption = "大包装数量", Visible = true, FieldName = WmsGoods.exfields.bigCount.ToString() }; | |||
|  |             GridColumn myCol7 = new GridColumn() { Caption = "剂型", Visible = true, FieldName = WmsGoods.exfields.type.ToString() }; | |||
|  |             GridColumn myCol8 = new GridColumn() { Caption = "商品类型", Visible = true, FieldName = WmsGoods.exfields.goodsTypeName.ToString() }; | |||
|  |           //  GridColumn myCol9 = new GridColumn() { Caption = "大零", Visible = true, FieldName = WmsGoods.fields.bulkMax.ToString() }; | |||
|  |         //    GridColumn myCol10 = new GridColumn() { Caption = "小整", Visible = true, FieldName = WmsGoods.fields.batchMax1.ToString() }; | |||
|  |         //    GridColumn myCol11 = new GridColumn() { Caption = "大整", Visible = true, FieldName = WmsGoods.fields.batchMax2.ToString() }; | |||
|  |             GridColumn myCol12 = new GridColumn() { Caption = "国药准字", Visible = true, FieldName = WmsGoods.exfields.regeditCode.ToString() }; | |||
|  | 
 | |||
|  |             GridColumn myCol100 = new GridColumn() { Caption = "总计划数", Visible = true, FieldName = WmsOutDetail.fields.count.ToString() }; | |||
|  |             GridColumn myCol101 = new GridColumn() { Caption = "计划零货", Visible = true, FieldName = WmsOutDetail.fields.bulkCount.ToString() }; | |||
|  |             GridColumn myCol102 = new GridColumn() { Caption = "计划整货", Visible = true, FieldName = WmsOutDetail.fields.batch1Count.ToString() }; | |||
|  |             GridColumn myCol103 = new GridColumn() { Caption = "大整", Visible = true, FieldName = WmsOutDetail.fields.batch2Count.ToString() }; | |||
|  |             GridColumn myCol104 = new GridColumn() { Caption = "箱", Visible = true, FieldName = WmsOutDetail.fields.boxcnt.ToString() }; | |||
|  |             GridColumn myCol14 = new GridColumn() { Caption = "批号", Visible = true, FieldName = WmsOutDetail.fields.batch.ToString() }; | |||
|  |           //  GridColumn myCol15 = new GridColumn() { Caption = "生产日期", Visible = true, FieldName = WmsOutDetail.fields.productDate.ToString() }; | |||
|  |           //  GridColumn myCol16 = new GridColumn() { Caption = "有效期", Visible = true, FieldName = WmsOutDetail.fields.validDate.ToString() }; | |||
|  |             GridColumn myCol18 = new GridColumn() { Caption = "说明", Visible = true, FieldName = WmsOutDetail.fields.description.ToString() }; | |||
|  | 
 | |||
|  |        //     GridColumn myCol119 = new GridColumn() { Caption = "拣货单", Visible = true, FieldName = WmsOutPickRequest.fields.pickOrderNo.ToString() }; | |||
|  |             GridColumn myCol1191 = new GridColumn() { Caption = "销售单", Visible = true, FieldName = WmsOutDetail.fields.orderNo.ToString() }; | |||
|  | 
 | |||
|  |           //  GridColumn myCol17 = new GridColumn() { Caption = "订单状态", Visible = true, FieldName = WmsOutDetail.fields.state.ToString() }; | |||
|  |          //   GridColumn myCol171 = new GridColumn() { Caption = "订单状态", Visible = true, FieldName = "pickOrderState" }; | |||
|  |         //     GridColumn myCol172 = new GridColumn() { Caption = "商品状态", Visible = true, FieldName = "goodsPickState" }; | |||
|  |             GridColumn myCol173 = new GridColumn() { Caption = "订单状态", Visible = true, FieldName = "orderState" }; | |||
|  |          //   GridColumn myCol174 = new GridColumn() { Caption = "商品状态", Visible = true, FieldName = "detailState" }; | |||
|  | 
 | |||
|  |             GridColumn myCol130 = new GridColumn() { Caption = "skuId", Visible = true, FieldName = "skuId" }; | |||
|  |       //      GridColumn myCol131 = new GridColumn() { Caption = "sku", Visible = true, FieldName = "skuCode" }; | |||
|  |             GridColumn myCol132 = new GridColumn() { Caption = "货主", Visible = true, FieldName = "ownerName" }; | |||
|  | 
 | |||
|  |             GridColumn myc200 = new GridColumn() { Caption = "订单数", Visible = true, FieldName = "custcount" }; | |||
|  |             GridColumn myc201 = new GridColumn() { Caption = "货期", Visible = true, FieldName = "dueDate" };  | |||
|  |             GridColumn myc203 = new GridColumn() { Caption = "状态", Visible = true, FieldName = "state" }; | |||
|  |             GridColumn myc204 = new GridColumn() { Caption = "库存数", Visible = true, FieldName = "avCount" }; | |||
|  |             GridColumn myc205 = new GridColumn() { Caption = "分拣单", Visible = true, FieldName = "pickOrderNo" }; | |||
|  | 
 | |||
|  |             gridview.Columns.Add(myc205); | |||
|  |             gridview.Columns.Add(myc201); | |||
|  | 
 | |||
|  |             gridview.Columns.Add(myCol2);  | |||
|  |             gridview.Columns.Add(myCol130); | |||
|  |             gridview.Columns.Add(myCol14);  | |||
|  |             gridview.Columns.Add(myCol100); | |||
|  |             gridview.Columns.Add(myc204); | |||
|  |             gridview.Columns.Add(myc200); | |||
|  |             | |||
|  |         //    gridview.Columns.Add(myCol131); | |||
|  |   | |||
|  |           | |||
|  |             gridview.Columns.Add(myCol101); | |||
|  |             gridview.Columns.Add(myCol102); | |||
|  |              | |||
|  |             gridview.Columns.Add(myCol132);  | |||
|  |             gridview.Columns.Add(myCol3); | |||
|  |            // gridview.Columns.Add(myCol103); | |||
|  |             gridview.Columns.Add(myCol104); | |||
|  |             gridview.Columns.Add(myCol6); | |||
|  |             gridview.Columns.Add(myCol5); | |||
|  |          | |||
|  |          //   gridview.Columns.Add(myCol15); | |||
|  |        //     gridview.Columns.Add(myCol16); | |||
|  |             gridview.Columns.Add(myCol3); | |||
|  |              | |||
|  | 
 | |||
|  | 
 | |||
|  | 
 | |||
|  | 
 | |||
|  |             gridview.Columns.Add(myCol8); | |||
|  |             //gridview.Columns.Add(myCol9); | |||
|  |        | |||
|  | 
 | |||
|  |             gridview.Columns.Add(myCol2); | |||
|  |          //   gridview.Columns.Add(myCol6); | |||
|  | 
 | |||
|  |             | |||
|  |             gridview.Columns.Add(myCol4); | |||
|  | 
 | |||
|  | 
 | |||
|  |             gridview.Columns.Add(myCol7);  | |||
|  | 
 | |||
|  |             gridview.Columns.Add(myCol12); | |||
|  |             gridview.Columns.Add(myCol1); | |||
|  |    | |||
|  |             gridview.Columns.Add(myCol18); | |||
|  |          //   gridview.Columns.Add(myCol173); | |||
|  |             //to show bottom scroll bar | |||
|  |             gridview.OptionsView.ColumnAutoWidth = false; | |||
|  |             gridview.BestFitColumns(); | |||
|  |           //  gridView2.Focus(); | |||
|  |         } | |||
|  | 
 | |||
|  | 
 | |||
|  |         private void initialDataGridLogColumns(GridView gridview) | |||
|  |         { | |||
|  |             setupGridView(gridview, false); | |||
|  |             //setupGridView(gridView2, false,false); | |||
|  |             //setupGridView(gridView3, false,false); | |||
|  |             //   gridviewGoodsType.PopulateColumns(); | |||
|  |             gridview.Columns.Clear(); | |||
|  |             // gridviewGoodsType.Columns.Remove(gridviewGoodsType.Columns["DealerPrice"]);  | |||
|  |             GridColumn myCol0 = new GridColumn() { Caption = "ID", Visible = true, FieldName = "id" }; | |||
|  |             myCol0.Visible = false; | |||
|  |             this.gridView1.Columns.Add(myCol0); | |||
|  |             GridColumn myCol1 = new GridColumn() { Caption = "单号", Visible = true, FieldName = orderFieldName }; | |||
|  |             GridColumn myCol2 = new GridColumn() { Caption = "状态", Visible = true, FieldName = WmsOutLog.fields.orderState.ToString() }; | |||
|  |             GridColumn myCol3 = new GridColumn() { Caption = "捡货状态", Visible = true, FieldName = WmsOutLog.fields.pickState.ToString() }; | |||
|  |             GridColumn myCol4 = new GridColumn() { Caption = "操作人", Visible = true, FieldName = Employee .fields.operater.ToString() }; | |||
|  |             GridColumn myCol5 = new GridColumn() { Caption = "时间", Visible = true, FieldName = "lastmodified"  }; | |||
|  |          | |||
|  |             GridColumn myCol6 = new GridColumn() { Caption = "拣货单", Visible = true, FieldName = "orderNo" }; | |||
|  |             GridColumn myCol7 = new GridColumn() { Caption = "商品名称", Visible = true, FieldName = "goodsName" }; | |||
|  |             GridColumn myCol8 = new GridColumn() { Caption = "批号", Visible = true, FieldName = "batch" }; | |||
|  |             GridColumn myCol9 = new GridColumn() { Caption = "待出数量", Visible = true, FieldName = "countOuting" }; | |||
|  |             GridColumn myCol10 = new GridColumn() { Caption = "已出数量", Visible = true, FieldName = "count" }; | |||
|  |             GridColumn myCol11 = new GridColumn() { Caption = "货位", Visible = true, FieldName = "locationId" }; | |||
|  |             GridColumn myCol12 = new GridColumn() { Caption = "操作人", Visible = true, FieldName = Employee.fields.em_account.ToString() }; | |||
|  | 
 | |||
|  |             | |||
|  |                 gridview.Columns.Add(myCol1); | |||
|  |                 gridview.Columns.Add(myCol2); | |||
|  |                 //gridview.Columns.Add(myCol3); | |||
|  |                 gridview.Columns.Add(myCol4);   | |||
|  |                | |||
|  |               | |||
|  |             gridview.Columns.Add(myCol5); | |||
|  |             //to show bottom scroll bar | |||
|  |             gridview.OptionsView.ColumnAutoWidth = false; | |||
|  |             gridview.BestFitColumns(); | |||
|  |             gridview.Focus(); | |||
|  |   | |||
|  |         } | |||
|  | 
 | |||
|  |          | |||
|  |         #endregion | |||
|  | 
 | |||
|  | 
 | |||
|  |         string orderFieldName | |||
|  |         { | |||
|  |             get | |||
|  |             { | |||
|  |                 return "orderNo"; | |||
|  |             } | |||
|  |         } | |||
|  | 
 | |||
|  |          | |||
|  |         /// <summary>   | |||
|  |         /// loading data | |||
|  |         /// </summary>   | |||
|  |         private int loadData() | |||
|  |         { | |||
|  |             // initialRequestOrders(); | |||
|  |             //this.gridviewGoodsType.DataSource = lgt.GetAllActiveData().Tables[0].DefaultView; | |||
|  |             showWaitForm(); | |||
|  |             string orderNoField =  orderFieldName; | |||
|  |             try | |||
|  |             { | |||
|  |                 string orderNo = this.txtOrderNo.Text.Trim(); | |||
|  |                 string query = (string.IsNullOrEmpty(orderNo) ? "" | |||
|  |                     : string.Format("{0} =#'{1}';", "pickOrderNo", filtRiskChar(txtOrderNo.Text.Trim()))); | |||
|  |                      | |||
|  |                  //   + (orderType == enumOutOrderType.播种拣货单  | |||
|  |                  //   ?  " seedsPickNo is not null;" | |||
|  |                 //    :   orderType != enumOutOrderType.销售订单 ? string.Format("{0} =#'{1}';", WmsOutRequest.fields.orderType.ToString(), (int)orderType) | |||
|  |                 //                                                : ""); | |||
|  | 
 | |||
|  |                 string whereNoStock = string.Format("{0} > #{1};", "count", "avCount") + string.Format("{0} = #{1};", "isZhitong", "0"); | |||
|  |                 string whereIsZhitong= string.Format("{0} = #{1};", "isZhitong", "1"); | |||
|  |                 | |||
|  |                 if (string.IsNullOrEmpty(orderNo)) | |||
|  |                 { | |||
|  | 
 | |||
|  |                     query += (this.dateEditFrom.Text.Trim().Length == 0 ? "" : string.Format("{0}  > # '{1}';", WmsOutRequest.fields.dueDate.ToString(), dateEditFrom.DateTime.ToShortDateString())); | |||
|  |                          // + (this.dateEditTo.Text.Trim().Length == 0 ? "" : string.Format("{0}  <= # '{1}';", WmsOutRequest.fields.dueDate.ToString(), dateEditTo.DateTime)); | |||
|  |                        | |||
|  |                     query += (this.comboState.SelectedIndex <= 0 ? "" : string.Format("{0} = #{1};", "pickRequestState", ((Colitem)this.comboState.SelectedItem).key)); | |||
|  |                     query += (this.comPickgroup.SelectedIndex <= 0 ? "" : string.Format("{0} = #{1};", WmsOutRequest.fields.pickgroup, ((Node)this.comPickgroup.SelectedItem).ID)); | |||
|  |                     query += (this.comStartOn.SelectedIndex <= 0 ? "" : string.Format("{0} = #{1};", WmsOutRequest.fields.pickStartOn, ((Node)this.comStartOn.SelectedItem).ID)); | |||
|  | 
 | |||
|  |                    | |||
|  |                     if (chkZhitong.Checked) | |||
|  |                     { | |||
|  |                         query += whereIsZhitong; | |||
|  |                         whereNoStock =string.Format("{0} > #{1};", "count", "avCount")  ; | |||
|  |                     }  | |||
|  |                     if (chkStock.Checked) | |||
|  |                     { | |||
|  |                         query += whereNoStock; | |||
|  |                     } | |||
|  |                 } | |||
|  |                  | |||
|  |                 bool isQueryNotChanged = lastQuery.Equals(query); | |||
|  |                 this.pager1.PageCurrent = isQueryNotChanged ? this.pager1.PageCurrent : 1; //根据查询条件的变化给pager赋值 | |||
|  |                 this.pager1.PageCurrent= this.pager1.PageCurrent  > 0 ? this.pager1.PageCurrent : 1; | |||
|  |                 int start = (pager1.PageSize * (pager1.PageCurrent - 1) + 1); | |||
|  |                 int end = (pager1.PageSize * pager1.PageCurrent); | |||
|  |                 lastQuery = query; | |||
|  | 
 | |||
|  |                 //DataSet ds = orderType == enumOutOrderType.销售订单 ? this.outClient.Query(query, start, end) : pickClient.Query(query, start, end); | |||
|  |                 DataSet ds = this.outClient.getSeedsSumDetail( query, start, end); | |||
|  |                   | |||
|  |                   | |||
|  | 
 | |||
|  |                 closeClient(); | |||
|  |                 | |||
|  |                 DtGv = ds.Tables[0]; | |||
|  |                 int cnt = Convert.ToInt32(ds.Tables[1].Rows[0][0].ToString()); | |||
|  |                 //dt = lgt.Query(query, start, end); //string.IsNullOrEmpty(query) ? lgt.GetGoodType.getAllData(start, end) : lgt.g; | |||
|  |                 addCheckField(DtGv);//add checkbox | |||
|  |               | |||
|  |                 DtGv.PrimaryKey = new DataColumn[] { DtGv.Columns[orderFieldName] }; | |||
|  |                 bool firstLoad = !isQueryNotChanged || this.gridControl1.DataSource == null; | |||
|  |                 this.gridControl1.DataSource = DtGv.DefaultView; | |||
|  |                 initialGridViewColumns(gridView1); | |||
|  |                 //update selected row index to the last updated one. | |||
|  | 
 | |||
|  |                 if (false && !string.IsNullOrEmpty(currentGoods)) | |||
|  |                 { | |||
|  |                     selectedRowIndex = -1; | |||
|  |                     DataRow dr = DtGv.Rows.Find(currentGoods); | |||
|  |                     if (dr != null) | |||
|  |                     { | |||
|  |                         selectedRowIndex = DtGv.Rows.IndexOf(dr); | |||
|  |                     } | |||
|  | 
 | |||
|  |                     if (selectedRowIndex >= 0 && DtGv.Rows.Count > selectedRowIndex) | |||
|  |                     { | |||
|  |                         // gridView1.SelectRow(selectedRowIndex); | |||
|  |                         gridView1.FocusedRowHandle = selectedRowIndex; | |||
|  |                         //  gridView1.MakeRowVisible(selectedRowIndex); | |||
|  | 
 | |||
|  |                     } | |||
|  | 
 | |||
|  |                     //gridView1.FocusedRowHandle = selectedRowIndex; | |||
|  |                 } | |||
|  |                 else | |||
|  |                 // if (firstLoad) | |||
|  |                 { | |||
|  |                     gridView1.FocusedRowHandle = 0; | |||
|  |                     gridView1.SelectRow(0); | |||
|  |                     setCurrentRequestDetail(); | |||
|  |                 } | |||
|  |                 closeWaitForm(); | |||
|  |                 return cnt; | |||
|  |             } | |||
|  |             catch (Exception e) | |||
|  |             { | |||
|  |                 showErrorMsg(e.Message); | |||
|  |             } | |||
|  | 
 | |||
|  |             closeWaitForm(); | |||
|  |             return 0;// lgt.getRowCount(query); | |||
|  |             // return lgt.GetGoodType.QueryCount();  | |||
|  | 
 | |||
|  |         } | |||
|  | 
 | |||
|  |            | |||
|  | 
 | |||
|  |         /// <summary>   | |||
|  |         /// 分页控件产生的事件   | |||
|  |         /// </summary>   | |||
|  |         private int pager_EventPaging(DeiNiu.Controls.pager.EventPagingArg e) | |||
|  |         { | |||
|  |             selectedRowIndex = 0; //reset currentRowIndex | |||
|  |             return loadData(); | |||
|  |         } | |||
|  | 
 | |||
|  |         private void initialPagerControls() | |||
|  |         { | |||
|  | 
 | |||
|  |             pager1.MaximumSize = new Size(0, 20); | |||
|  |             pager1.EventPaging += new DeiNiu.Controls.pager.EventPagingHandler(pager_EventPaging); | |||
|  |             #region DataGridView与Pager控件绑定 | |||
|  |             this.pager1.PageCurrent = 1;//当前页为第一页   | |||
|  |             pager1.PageSize = Utils.WmsConstants.PAGER_SIZE;//每页行数   | |||
|  |             this.pager1.Bind();//绑定   | |||
|  |             #endregion | |||
|  | 
 | |||
|  |         } | |||
|  |          | |||
|  |          | |||
|  |         private void gridView1_FocusedRowObjectChanged(object sender, FocusedRowObjectChangedEventArgs e) | |||
|  |         { | |||
|  |             if (gridView1.FocusedRowHandle <0 || gridView1.FocusedRowHandle == selectedRowIndex) | |||
|  |             { | |||
|  |                 if (gridView1.IsGroupRow(e.RowHandle)) //set first row of group selected | |||
|  |                 { | |||
|  |                     selectedRowIndex = gridView1.GetChildRowHandle(e.RowHandle, 0); | |||
|  |                     setCurrentRequestDetail(); | |||
|  |                 } | |||
|  |                   | |||
|  |                     return; ; | |||
|  |                  | |||
|  |             } | |||
|  |             selectedRowIndex = gridView1.FocusedRowHandle; | |||
|  |             // showErrorMsg("selection:"+ selectedRowIndex); | |||
|  |             setCurrentRequestDetail(); | |||
|  |         } | |||
|  | 
 | |||
|  |         private void gridView1_DataSourceChanged(object sender, EventArgs e) | |||
|  |         { | |||
|  |             if (selectedRowIndex >= 0 && DtGv.Rows.Count > selectedRowIndex) | |||
|  |             { | |||
|  |                 gridView1.FocusedRowHandle = selectedRowIndex; | |||
|  |                 gridView1.MakeRowVisible(selectedRowIndex); | |||
|  | 
 | |||
|  |             } | |||
|  |         } | |||
|  |   | |||
|  | 
 | |||
|  |         protected void query() | |||
|  |         { | |||
|  |             pager1.Bind(); | |||
|  |         } | |||
|  | 
 | |||
|  | 
 | |||
|  |         private void queryGoods() | |||
|  |         { | |||
|  | 
 | |||
|  |             showWaitForm(); | |||
|  |             try | |||
|  |             { | |||
|  |                 query();// loadData();   | |||
|  |             } | |||
|  |             catch (Exception e) | |||
|  |             { | |||
|  |                 showErrorMsg(e.Message); | |||
|  |             } | |||
|  |             finally | |||
|  |             { | |||
|  |                 // WaitFormService.Close(); | |||
|  |                 closeWaitForm(); | |||
|  |                 bbQuery.Enabled = true; | |||
|  |             } | |||
|  | 
 | |||
|  |         } | |||
|  |           | |||
|  |         private void bbQuery_ItemClick_1(object sender, ItemClickEventArgs e) | |||
|  |         { | |||
|  |             this.bbQuery.Enabled = false; | |||
|  |             queryGoods(); | |||
|  |         } | |||
|  | 
 | |||
|  |         | |||
|  | 
 | |||
|  |         private void updateObjects(List<WmsGoods> goods) | |||
|  |         {  | |||
|  |             showWaitForm(); | |||
|  |             //WaitFormService.Show(this);  | |||
|  |             try | |||
|  |             { | |||
|  |              //   lgt.update(goods); | |||
|  | 
 | |||
|  |                 //get updated data  | |||
|  |                 query(); | |||
|  | 
 | |||
|  |             } | |||
|  |             catch (Exception e) | |||
|  |             { | |||
|  |                 showErrorMsg(e.Message); | |||
|  |             } | |||
|  |             finally | |||
|  |             { | |||
|  |                 // WaitFormService.Close(); | |||
|  |                 closeWaitForm(); | |||
|  |               | |||
|  |             } | |||
|  |               | |||
|  | 
 | |||
|  |         } | |||
|  |          | |||
|  |         private bool getCurrentObject() | |||
|  |         { | |||
|  |               | |||
|  | 
 | |||
|  | 
 | |||
|  |             if (selectedRowIndex <0 || selectedRowIndex >= DtGv.Rows.Count) | |||
|  |             { | |||
|  |                 return false; | |||
|  |             } | |||
|  |             | |||
|  |           //  DataRow currentRow = dt.Rows[selectedRowIndex]; | |||
|  |             DataRowView dr = (DataRowView)(GetGridViewFilteredAndSortedData(gridView1)[selectedRowIndex]); | |||
|  |             currentGoods = dr["goodsId"].ToString(); | |||
|  |             currentSkuId = dr["skuId"] is DBNull  ? -1 : Convert.ToInt32( dr["skuId"].ToString()); | |||
|  |             currentState = (enumOutStockRequestStatus)Convert.ToInt16( dr["state"].ToString()); | |||
|  |              | |||
|  |             return true; | |||
|  | 
 | |||
|  |         } | |||
|  |         | |||
|  |         | |||
|  | 
 | |||
|  | 
 | |||
|  |         private void btnQuery_Click(object sender, EventArgs e) | |||
|  |         { | |||
|  |             queryGoods(); | |||
|  |         } | |||
|  | 
 | |||
|  |         private void gridView1_SelectionChanged(object sender, DevExpress.Data.SelectionChangedEventArgs e) | |||
|  |         { | |||
|  |             if (gridView1.FocusedRowHandle <0 || gridView1.FocusedRowHandle == selectedRowIndex) | |||
|  |             { | |||
|  |                 return; | |||
|  |             } | |||
|  |             selectedRowIndex = gridView1.FocusedRowHandle; | |||
|  |             // showErrorMsg("selection:"+ selectedRowIndex); | |||
|  |             setCurrentRequestDetail(); | |||
|  |         } | |||
|  | 
 | |||
|  |         private void initialDataGrid() | |||
|  |         { | |||
|  |             gridView1.OptionsSelection.MultiSelect = true;//按shift / control 多选 | |||
|  |             this.gridView1.OptionsBehavior.AutoPopulateColumns = false; | |||
|  |             this.gridView1.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus; | |||
|  |             this.gridView1.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.CellFocus; | |||
|  |             this.gridView1.OptionsBehavior.Editable = false; | |||
|  |             //    this.gridView1.OptionsSelection.EnableAppearanceFocusedCell = false; | |||
|  | 
 | |||
|  |             this.gridView1.FocusedRowObjectChanged += new DevExpress.XtraGrid.Views.Base.FocusedRowObjectChangedEventHandler(this.gridView1_FocusedRowObjectChanged); | |||
|  |             this.gridView1.DataSourceChanged += new System.EventHandler(this.gridView1_DataSourceChanged); | |||
|  | 
 | |||
|  |             //show line number | |||
|  |             this.gridView1.IndicatorWidth = 40; | |||
|  |             this.gridView1.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler(gridView_CustomDrawRowIndicator); | |||
|  |             this.gridView2.IndicatorWidth = 40; | |||
|  |             this.gridView2.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler(gridView_CustomDrawRowIndicator); | |||
|  |           | |||
|  |            | |||
|  |             gridView2.CustomDrawCell += gridView_CustomDrawCell; | |||
|  |            // gridView2.RowCellStyle += gridView_RowCellStyle; | |||
|  |             gridView1.RowCellStyle += gridView_RowCellStyle; | |||
|  | 
 | |||
|  |              gridView1.CustomColumnDisplayText += gridView2_CustomColumnDisplayText; | |||
|  |              gridView2.CustomColumnDisplayText += gridView2_CustomColumnDisplayText; | |||
|  |             | |||
|  | 
 | |||
|  |              this.gridView2.FocusedRowObjectChanged += new DevExpress.XtraGrid.Views.Base.FocusedRowObjectChangedEventHandler(this.gridView1_FocusedRowObjectChanged); | |||
|  |              this.gridView2.DataSourceChanged += new System.EventHandler(this.gridView1_DataSourceChanged); | |||
|  |              this.initialGridViewColumns(gridView1) ; | |||
|  |             // GridCheckEdit(gridView1, CheckBoxField, 50); | |||
|  |         } | |||
|  |      | |||
|  |        private void gridView2_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e) | |||
|  |         { | |||
|  |             if (string.IsNullOrEmpty(e.DisplayText)) | |||
|  |             { | |||
|  |                 return; | |||
|  |             } | |||
|  |             | |||
|  |                 if (e.Column.FieldName == "goodsPickState") | |||
|  |                 { | |||
|  | 
 | |||
|  |                     if (!pickDetailStatus.ContainsValue(e.DisplayText)) | |||
|  |                     { | |||
|  |                          | |||
|  |                         int display = -100; | |||
|  |                         string disTxt = e.DisplayText; | |||
|  |                 | |||
|  |                         try | |||
|  |                         { | |||
|  |                               display = Convert.ToInt16(e.DisplayText); | |||
|  | 
 | |||
|  |                               e.DisplayText =  pickDetailStatus[display] ; | |||
|  | 
 | |||
|  |                         } | |||
|  |                         catch | |||
|  |                         { | |||
|  |                             return; | |||
|  |                         } | |||
|  | 
 | |||
|  |                     } | |||
|  |                       | |||
|  | 
 | |||
|  |                 //    e.DisplayText = pickDetailStatus.ContainsKey(display) ? pickDetailStatus[display] : display+""; | |||
|  | 
 | |||
|  |                 } | |||
|  |                 else if (e.Column.FieldName == "detailState") | |||
|  |                 { | |||
|  | 
 | |||
|  |                     if (!pickDetailStatus.ContainsValue(e.DisplayText)) | |||
|  |                     { | |||
|  | 
 | |||
|  |                         int display = -100; | |||
|  |                         string disTxt = e.DisplayText; | |||
|  | 
 | |||
|  |                         try | |||
|  |                         { | |||
|  |                             display = Convert.ToInt16(e.DisplayText); | |||
|  | 
 | |||
|  |                             e.DisplayText = pickDetailStatus[display]; | |||
|  | 
 | |||
|  |                         } | |||
|  |                         catch | |||
|  |                         { | |||
|  |                             return; | |||
|  |                         } | |||
|  | 
 | |||
|  |                     } | |||
|  | 
 | |||
|  | 
 | |||
|  |                     //    e.DisplayText = pickDetailStatus.ContainsKey(display) ? pickDetailStatus[display] : display+""; | |||
|  | 
 | |||
|  |                 } | |||
|  |                 else if (e.Column.FieldName == "pickState" || e.Column.FieldName == "orderState" || e.Column.FieldName == "state" || e.Column.FieldName == "pickOrderState") | |||
|  |                 { | |||
|  |                     if (!pickRequestStatus.ContainsValue(e.DisplayText)) | |||
|  |                     { | |||
|  | 
 | |||
|  |                         int display = -100; | |||
|  |                         string disTxt = e.DisplayText; | |||
|  | 
 | |||
|  |                         try | |||
|  |                         { | |||
|  |                             display = Convert.ToInt16(e.DisplayText); | |||
|  | 
 | |||
|  |                             e.DisplayText = pickRequestStatus[display]; | |||
|  | 
 | |||
|  |                         } | |||
|  |                         catch | |||
|  |                         { | |||
|  |                             return; | |||
|  |                         } | |||
|  | 
 | |||
|  |                     }  | |||
|  |                    // e.DisplayText = pickRequestStatus.ContainsKey(display) ? pickRequestStatus[display] : display+""; | |||
|  | 
 | |||
|  |                 } | |||
|  |                 else if (e.Column.FieldName == "lastmodified") | |||
|  |                 { | |||
|  |                     e.Column.DisplayFormat.FormatString = "yyyy-MM-dd HH:mm:ss"; | |||
|  |                 } | |||
|  | 
 | |||
|  |                   | |||
|  |              | |||
|  |         } | |||
|  |        void gridView_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) | |||
|  |        { | |||
|  |            //var currentView = sender as GridView; | |||
|  |            //if (currentView != null && e.RowHandle == currentView.FocusedRowHandle) return; | |||
|  |            Rectangle r = e.Bounds; | |||
|  |            if (e.Column.FieldName == "state") | |||
|  |            { | |||
|  |                string a = e.CellValue.ToString(); | |||
|  |                string b = e.DisplayText; | |||
|  |                if (b.Equals("未分配货位")) | |||
|  |                { | |||
|  |                    e.Appearance.ForeColor = Color.Red; | |||
|  |                    e.Appearance.DrawString(e.Cache, e.DisplayText, r); | |||
|  |                    e.Handled = true; | |||
|  |                } | |||
|  | 
 | |||
|  |            } | |||
|  |        } | |||
|  | 
 | |||
|  |        void gridView_RowCellStyle(object sender,DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e) | |||
|  |        { | |||
|  | 
 | |||
|  |             var currentView = sender as GridView; | |||
|  |            if( currentView == null){return;} | |||
|  |            string state = currentView.GetDataRow(e.RowHandle)["state"].ToString().Trim(); | |||
|  |             | |||
|  |            if (state == "0") | |||
|  |            { | |||
|  |             //   return; | |||
|  |            } | |||
|  | 
 | |||
|  |            enumOutStockRequestStatus status = (enumOutStockRequestStatus)Convert.ToInt16(state); | |||
|  | 
 | |||
|  |            bool isFocused = e.RowHandle == currentView.FocusedRowHandle; | |||
|  |            DevExpress.Utils.AppearanceDefault rowStyle = null; | |||
|  |             DevExpress.Utils.AppearanceDefault appBlueRed =  | |||
|  |                new DevExpress.Utils.AppearanceDefault (Color.White, Color.Red, Color.Empty, Color.Blue, System.Drawing.Drawing2D.LinearGradientMode.Horizontal); | |||
|  |            DevExpress.Utils.AppearanceDefault appYB = | |||
|  |             new DevExpress.Utils.AppearanceDefault(Color.White, Color.Red, Color.Green); | |||
|  | 
 | |||
|  |            DevExpress.Utils.AppearanceDefault alertFocus = new DevExpress.Utils.AppearanceDefault(Color.White, Color.Red, Color.Green,  Color.Yellow); | |||
|  |            DevExpress.Utils.AppearanceDefault alert  = new DevExpress.Utils.AppearanceDefault(Color.Red, Color.White ); | |||
|  | 
 | |||
|  |            DevExpress.Utils.AppearanceDefault passedFocus = new DevExpress.Utils.AppearanceDefault(Color.White, Color.Gray); | |||
|  |            DevExpress.Utils.AppearanceDefault passed  = new DevExpress.Utils.AppearanceDefault(Color.Gray,Color.White); | |||
|  |            /* | |||
|  |            if (state == "1") | |||
|  |            { | |||
|  |                rowStyle = isFocused ? passedFocus : passed; | |||
|  |            } | |||
|  |            else if (state == "2") | |||
|  |            { | |||
|  |                rowStyle = isFocused ? alertFocus : alert; | |||
|  |            } | |||
|  |            */ | |||
|  |            if (status == enumOutStockRequestStatus.订单驳回 || status == enumOutStockRequestStatus.订单作废) | |||
|  |            { | |||
|  |                rowStyle = isFocused ? alertFocus : alert; | |||
|  |                | |||
|  |            } | |||
|  |            else if (status == enumOutStockRequestStatus.定位完成) | |||
|  |            { | |||
|  |               rowStyle = isFocused ? passedFocus : passed; | |||
|  |            } | |||
|  | 
 | |||
|  |            DevExpress.Utils.AppearanceHelper.Apply(e.Appearance, rowStyle); | |||
|  |            /* | |||
|  |            if (sender == this.gridView2) | |||
|  |            { | |||
|  |                if (this.gridView2.GetDataRow(e.RowHandle)["state"].ToString().Trim() == "2") | |||
|  |                { | |||
|  |                    DevExpress.Utils.AppearanceHelper.Apply(e.Appearance, alert); | |||
|  |                } | |||
|  |            }else if(sender == this.gridView1){ | |||
|  |                  | |||
|  |                if ( state == "2") | |||
|  |                { | |||
|  |                    if (currentView != null && e.RowHandle == currentView.FocusedRowHandle) | |||
|  |                    { | |||
|  |                        DevExpress.Utils.AppearanceHelper.Apply(e.Appearance, alertFocus); | |||
|  |                    } | |||
|  |                    else | |||
|  |                    { | |||
|  |                        DevExpress.Utils.AppearanceHelper.Apply(e.Appearance, alert); | |||
|  |                    } | |||
|  |                } | |||
|  |                else if (state == "1") | |||
|  |                { | |||
|  |                    DevExpress.Utils.AppearanceHelper.Apply(e.Appearance, passed); | |||
|  |                }  | |||
|  |            } | |||
|  |            */ | |||
|  |        } | |||
|  | 
 | |||
|  |         private void setCurrentRequestDetail() | |||
|  |         { | |||
|  |             gridControlDetail.DataSource = null; | |||
|  |             if (!getCurrentObject() || string.IsNullOrEmpty(  currentGoods)   ) | |||
|  |             { | |||
|  |                 return; | |||
|  |             } | |||
|  |            /// gridView1.FocusedRowHandle = selectedRowIndex;// | |||
|  |           //  gridView1.SelectRow(selectedRowIndex); | |||
|  |             showWaitForm(); | |||
|  | 
 | |||
|  |             try | |||
|  |             { | |||
|  | 
 | |||
|  |               //  dtDetail = outClient.getSeedsDetailByGoods(currentGoods); //currentSkuId | |||
|  |                 if (currentSkuId > 0) | |||
|  |                 { | |||
|  |                     dtDetail = outClient.getSeedsDetailBySku(currentSkuId); //currentSkuId | |||
|  |                 } | |||
|  |                 else | |||
|  |                 { | |||
|  |                     dtDetail = outClient.getSeedsDetailByGoods(currentGoods); //currentSkuId | |||
|  |                 } | |||
|  |                 closeClient();  | |||
|  |                   | |||
|  |                 this.gridControlDetail.DataSource = dtDetail; | |||
|  |                 initialGridView2Columns(gridView2); | |||
|  | 
 | |||
|  |               //   DataTable dt2 = pickClient.getOrderLogs(currentGoods, (int)orderType); | |||
|  |               //   closeClient(); | |||
|  |                 | |||
|  |                   | |||
|  |             } | |||
|  |             catch (Exception e) | |||
|  |             { | |||
|  |                 showErrorMsg(e.Message); | |||
|  |             } | |||
|  |             closeWaitForm(); | |||
|  | 
 | |||
|  |         } | |||
|  | 
 | |||
|  | 
 | |||
|  |         int selectedDetailRowIndex = -1; | |||
|  | 
 | |||
|  |         private void gridView2_FocusedRowObjectChanged(object sender, FocusedRowObjectChangedEventArgs e) | |||
|  |         { | |||
|  |             if (gridView2.FocusedRowHandle < 0 || gridView2.FocusedRowHandle == selectedDetailRowIndex) | |||
|  |             { | |||
|  |                 if (gridView2.IsGroupRow(e.RowHandle)) //set first row of group selected | |||
|  |                 { | |||
|  |                     selectedDetailRowIndex = gridView1.GetChildRowHandle(e.RowHandle, 0); | |||
|  |                     setCurrentRequestDetailLog(); | |||
|  |                 } | |||
|  | 
 | |||
|  |                 return; ; | |||
|  | 
 | |||
|  |             } | |||
|  |             selectedDetailRowIndex = gridView2.FocusedRowHandle; | |||
|  |             // showErrorMsg("selection:"+ selectedRowIndex); | |||
|  |             setCurrentRequestDetailLog(); | |||
|  |         } | |||
|  | 
 | |||
|  |         private void gridView2_DataSourceChanged(object sender, EventArgs e) | |||
|  |         { | |||
|  |             if (selectedDetailRowIndex >= 0 && dtDetail.Rows.Count > selectedDetailRowIndex) | |||
|  |             { | |||
|  |                 gridView2.FocusedRowHandle = selectedDetailRowIndex; | |||
|  |                 gridView2.MakeRowVisible(selectedDetailRowIndex); | |||
|  | 
 | |||
|  |             } | |||
|  |         } | |||
|  | 
 | |||
|  | 
 | |||
|  |         string currentGoodsId = string.Empty; | |||
|  |         string currentBatch = string.Empty; | |||
|  |         private bool getCurrentDetailObject() | |||
|  |         { | |||
|  | 
 | |||
|  |             if (selectedDetailRowIndex < 0 || selectedDetailRowIndex >= dtDetail.Rows.Count) | |||
|  |             { | |||
|  |                 return false; | |||
|  |             } | |||
|  | 
 | |||
|  |             //  DataRow currentRow = dt.Rows[selectedRowIndex]; | |||
|  |             DataRowView dr = (DataRowView)(GetGridViewFilteredAndSortedData(gridView2)[selectedDetailRowIndex]); | |||
|  |             currentGoodsId = dr["goodsId"].ToString(); | |||
|  |             currentBatch = dr["batch"].ToString();  | |||
|  | 
 | |||
|  | 
 | |||
|  |             return true; | |||
|  | 
 | |||
|  |         } | |||
|  |         | |||
|  |         | |||
|  | 
 | |||
|  |         private void setCurrentRequestDetailLog() | |||
|  |         { | |||
|  |             if (!getCurrentDetailObject() || string.IsNullOrEmpty(currentGoods)) | |||
|  |             { | |||
|  |                 return; | |||
|  |             } | |||
|  |             /// gridView1.FocusedRowHandle = selectedRowIndex;// | |||
|  |             //  gridView1.SelectRow(selectedRowIndex); | |||
|  |             showWaitForm(); | |||
|  | 
 | |||
|  |             try | |||
|  |             { | |||
|  | 
 | |||
|  |                 //DataTable dt2 = lgt.getOrderLogDetail(currentOrder, | |||
|  | 
 | |||
|  |                 //gridControlDetail.DataSource = null; | |||
|  | 
 | |||
|  | 
 | |||
|  |             } | |||
|  |             catch { } | |||
|  | 
 | |||
|  |         } | |||
|  | 
 | |||
|  | 
 | |||
|  |         private void btnIn_Click(object sender, EventArgs e) | |||
|  |         { | |||
|  |            | |||
|  |             showWaitForm(); | |||
|  |             try | |||
|  |             { | |||
|  |                // lgOutReq.requestOutStock(selectedRequest.pickOrderNo); | |||
|  |                 query(); | |||
|  |             } | |||
|  |             catch (Exception er) | |||
|  |             { | |||
|  |                 setCurrentRequestDetail(); | |||
|  |                 showErrorMsg(er,er.Message); | |||
|  |             } | |||
|  | 
 | |||
|  |               | |||
|  |            | |||
|  | 
 | |||
|  |             closeWaitForm(); | |||
|  |         } | |||
|  | 
 | |||
|  |         private void GoodsOutQueryForm_FormClosing(object sender, FormClosingEventArgs e) | |||
|  |         {  | |||
|  |             // closeClient(); | |||
|  |           //  closeClient(); | |||
|  |         } | |||
|  | 
 | |||
|  |           | |||
|  |          | |||
|  |         private void loadPickOrders() | |||
|  |         { | |||
|  | 
 | |||
|  |             //  showWaitForm(); | |||
|  |             try | |||
|  |             { | |||
|  |                 query();// loadData();   | |||
|  |             } | |||
|  |             catch (Exception e) | |||
|  |             { | |||
|  |                 showErrorMsg(e.Message); | |||
|  |             } | |||
|  |             finally | |||
|  |             { | |||
|  |                 // WaitFormService.Close(); | |||
|  |                 //   closeWaitForm(); | |||
|  |                 bbQuery.Enabled = true; | |||
|  |             } | |||
|  | 
 | |||
|  |         }   | |||
|  |          | |||
|  |         private void swAutoOrder_Toggled(object sender, EventArgs e) | |||
|  |         {  | |||
|  |              | |||
|  |         } | |||
|  | 
 | |||
|  |         private void btnPickOut_Click(object sender, EventArgs e) | |||
|  |         { | |||
|  |             showWaitForm(); | |||
|  |             try | |||
|  |             { | |||
|  |                 outClient.createSeedsOrder(12368, 12372, dateEditFrom.DateTime.ToShortDateString()); | |||
|  |                 closeClient(); | |||
|  | 
 | |||
|  |                 pickClient.createPDAPickTasks(enumOutStoreType.配货汇总拣货出库);  | |||
|  |                 closeClient(); | |||
|  |                  | |||
|  |                 pickClient.createPickWaves();  | |||
|  |                 closeClient(); | |||
|  |                // query(); | |||
|  |             } | |||
|  |             catch (Exception er) | |||
|  |             { | |||
|  |                 closeClient(); | |||
|  |                 closeWaitForm(); | |||
|  |                 showErrorMsg(er, er.Message); | |||
|  |                 setCurrentRequestDetail(); | |||
|  |                 | |||
|  |             } | |||
|  |                | |||
|  |             closeWaitForm(); | |||
|  |             query(); | |||
|  |         } | |||
|  |          | |||
|  |         private void chkStock_CheckedChanged(object sender, EventArgs e) | |||
|  |         { | |||
|  |             query(); | |||
|  |         } | |||
|  | 
 | |||
|  |         private void chkZhitong_CheckedChanged(object sender, EventArgs e) | |||
|  |         { | |||
|  |             query(); | |||
|  |         } | |||
|  |   | |||
|  |       | |||
|  |     } | |||
|  | } |