981 lines
		
	
	
		
			39 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			981 lines
		
	
	
		
			39 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 GoodsOutQueryFormbak : BasicRibbonForm | |||
|  |     { | |||
|  | 
 | |||
|  |         WmsOutRequestClient outClient | |||
|  |         { | |||
|  |             get | |||
|  |             { | |||
|  |                 return new WmsOutRequestClient("BasicHttpBinding_IWmsOutRequest", | |||
|  |                   buildSvrAddress("WmsOutRequestService.svc")); | |||
|  |             } | |||
|  |         } | |||
|  |         WmsOutPickRequestClient pickClient | |||
|  |         { | |||
|  |             get | |||
|  |             { | |||
|  |                 return new WmsOutPickRequestClient("BasicHttpBinding_IWmsOutPickRequest", | |||
|  |             buildSvrAddress("WmsOutPickRequestService.svc")); | |||
|  |             } | |||
|  |         } | |||
|  |          | |||
|  |          | |||
|  |         //  lWmsStock ls = new lWmsStock(); | |||
|  |       //  lWmsOutPickRequest lgt = new lWmsOutPickRequest(); | |||
|  |      //   lWmsOutRequest lgOutReq = new lWmsOutRequest(); | |||
|  |        // lWmsOutPickRequest outPickRequest = new lWmsOutPickRequest(); | |||
|  |         private string lastQuery = ""; | |||
|  |         private DataTable dt; | |||
|  |         private int selectedRowIndex = -1; | |||
|  |   | |||
|  |         string currentOrder = ""; | |||
|  | 
 | |||
|  |         DataTable dtDetail; | |||
|  | 
 | |||
|  | 
 | |||
|  | 
 | |||
|  | 
 | |||
|  |         public GoodsOutQueryFormbak() | |||
|  |         { | |||
|  |             InitializeComponent(); | |||
|  |             initialControls(); | |||
|  | 
 | |||
|  |             //initialBackGroundTasks(); | |||
|  |             //    loadData(); | |||
|  |         } | |||
|  |         #region initialControls | |||
|  |         private void initialControls() | |||
|  |         { | |||
|  |             initialComboBoxes(); | |||
|  |             initialPagerControls(); | |||
|  |             initialDataGrid(); | |||
|  |             initialQueryInput();  | |||
|  |             setValidationRule(); | |||
|  |             | |||
|  | 
 | |||
|  |         } | |||
|  |         /* | |||
|  |         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 * WmsConstants.DAYS_QUERY_BEFORE); | |||
|  |             this.dateEditTo.EditValue = DateTime.Now; | |||
|  | 
 | |||
|  |             this.comOrderType.Properties.TextEditStyle = TextEditStyles.DisableTextEditor; | |||
|  |           //  this.comOrderType.SelectedIndex = 0; | |||
|  | 
 | |||
|  |             initialComboBoxs(comOrderType, this.outRequestType,false); | |||
|  |             initialComboBoxs(comboState, this.pickRequestStatus); | |||
|  |             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 initialDataGridColumns() | |||
|  |         { | |||
|  |             setupGridView(gridView1,false); | |||
|  |             //setupGridView(gridView2, false,false); | |||
|  |             //setupGridView(gridView3, false,false); | |||
|  |             //   gridviewGoodsType.PopulateColumns(); | |||
|  |             gridView1.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 = 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.orderDate.ToString() }; | |||
|  |             GridColumn myCol7 = new GridColumn() { Caption = "播种单", Visible = true, FieldName = "seedsPickNo" }; | |||
|  | 
 | |||
|  | 
 | |||
|  |             this.gridView1.Columns.Add(myCol1); | |||
|  |             if (orderType == enumOutStoreType.播种拣货出库) | |||
|  |             { | |||
|  |                 this.gridView1.Columns.Add(myCol7); | |||
|  |             } | |||
|  |             this.gridView1.Columns.Add(myCol6); | |||
|  |             this.gridView1.Columns.Add(myCol3); | |||
|  |             if (orderType != enumOutStoreType.补货出库) | |||
|  |             { | |||
|  |                 this.gridView1.Columns.Add(myCol4); | |||
|  |             } | |||
|  |             this.gridView1.Columns.Add(myCol5);   | |||
|  |   | |||
|  |             //to show bottom scroll bar | |||
|  |             gridView1.OptionsView.ColumnAutoWidth = false; | |||
|  |             gridView1.BestFitColumns(); | |||
|  |             gridView1.Focus(); | |||
|  | 
 | |||
|  | 
 | |||
|  |         //    initialGridView2Columns(); | |||
|  |             gridControlDetail.DataSource = null; | |||
|  |             this.gridcontrolOderLogs.DataSource = null; | |||
|  | 
 | |||
|  |             this.gridcontrolStockRecord.DataSource = null; | |||
|  |             this.gridcontrolRequestOut.DataSource = null; | |||
|  |                       | |||
|  |         } | |||
|  |         private void initialGridView2Columns(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 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" }; | |||
|  | 
 | |||
|  |             if (orderType == enumOutStoreType.销售出库) | |||
|  |             { | |||
|  |                 gridview.Columns.Add(myCol119); | |||
|  |                 | |||
|  |                 gridview.Columns.Add(myCol2); | |||
|  |                 gridview.Columns.Add(myCol173); | |||
|  |             }else | |||
|  | 
 | |||
|  |           //  if (orderType == enumOutOrderType.拣货单) | |||
|  |             { | |||
|  |                 if (gridview == gridViewRequestOrders) | |||
|  |                 { | |||
|  |                     gridview.Columns.Add(myCol1191); | |||
|  |                     gridview.Columns.Add(myCol173); | |||
|  |                     gridview.Columns.Add(myCol2); | |||
|  |                 } | |||
|  |                 else | |||
|  |                 { | |||
|  |                     gridview.Columns.Add(myCol2); | |||
|  |                     gridview.Columns.Add(myCol171); | |||
|  |                     gridview.Columns.Add(myCol172); | |||
|  |                 } | |||
|  | 
 | |||
|  | 
 | |||
|  | 
 | |||
|  |             } | |||
|  | 
 | |||
|  |           //  gridview.Columns.Add(myCol17); | |||
|  | 
 | |||
|  |             gridview.Columns.Add(myCol130); | |||
|  |             gridview.Columns.Add(myCol131); | |||
|  |             gridview.Columns.Add(myCol132); | |||
|  |             gridview.Columns.Add(myCol14);  | |||
|  |             gridview.Columns.Add(myCol3); | |||
|  |             gridview.Columns.Add(myCol100); | |||
|  |             gridview.Columns.Add(myCol101); | |||
|  |             gridview.Columns.Add(myCol102); | |||
|  |            // 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() }; | |||
|  | 
 | |||
|  |             if (gridview == this.gridviewStockRecord) | |||
|  |             { | |||
|  |                 gridview.Columns.Add(myCol6); | |||
|  |                 gridview.Columns.Add(myCol11);  | |||
|  |                 gridview.Columns.Add(myCol7); | |||
|  |                 gridview.Columns.Add(myCol8); | |||
|  |                 gridview.Columns.Add(myCol9); | |||
|  |                 gridview.Columns.Add(myCol10); | |||
|  |                 gridview.Columns.Add(myCol12); | |||
|  | 
 | |||
|  |             } | |||
|  |             else | |||
|  |             { | |||
|  |                 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 orderType == enumOutStoreType.销售出库 ? | |||
|  |                     WmsOutRequest.fields.orderNo.ToString() : WmsOutPickRequest.fields.pickOrderNo.ToString(); | |||
|  |             } | |||
|  |         } | |||
|  | 
 | |||
|  |         enumOutStoreType orderType | |||
|  |         { | |||
|  |             get | |||
|  |             { | |||
|  |             | |||
|  |                 return comOrderType.SelectedIndex == 0 ?  enumOutStoreType.销售出库 : (enumOutStoreType)((Colitem)comOrderType.SelectedItem).key;// == 0 ? enumOutOrderType.salesOrder : enumOutOrderType.; | |||
|  |             } | |||
|  |         } | |||
|  | 
 | |||
|  | 
 | |||
|  |         /// <summary>   | |||
|  |         /// loading data | |||
|  |         /// </summary>   | |||
|  |         private int loadData() | |||
|  |         { | |||
|  |             // initialRequestOrders(); | |||
|  |             //this.gridviewGoodsType.DataSource = lgt.GetAllActiveData().Tables[0].DefaultView; | |||
|  |             showWaitForm(); | |||
|  |             string orderNoField = orderType == enumOutStoreType.播种拣货出库 ? WmsOutPickRequest.fields.seedsPickNo.ToString() : orderFieldName; | |||
|  |             try | |||
|  |             { | |||
|  |                 string orderNo = this.txtOrderNo.Text.Trim(); | |||
|  |                 string query = (string.IsNullOrEmpty(orderNo) ? "" | |||
|  |                     : string.Format("{0} =#'{1}';", orderNoField, filtRiskChar(txtOrderNo.Text.Trim()))) | |||
|  |                     + (orderType == enumOutStoreType.播种拣货出库 ?  " seedsPickNo is not null;":   orderType != enumOutStoreType.销售出库 ? string.Format("{0} =#'{1}';", WmsOutRequest.fields.orderType.ToString(), (int)orderType) : ""); | |||
|  | 
 | |||
|  | 
 | |||
|  |                 if (string.IsNullOrEmpty(orderNo)) | |||
|  |                 {  | |||
|  |                     query +=  (this.txtVender.Text.Trim().Length == 0 ? "" : string.Format("{0} like # '%{1}%';", WmsOutRequest.fields.customerName.ToString(), filtRiskChar(txtVender.Text.Trim()))); | |||
|  |                      | |||
|  |                     if (orderType == enumOutStoreType.补货出库) | |||
|  |                     { | |||
|  |                         query += (this.dateEditFrom.Text.Trim().Length == 0 ? "" : string.Format("{0} >= # '{1}';", WmsOutRequest.fields.orderDate.ToString(), dateEditFrom.DateTime)) | |||
|  |                           + (this.dateEditTo.Text.Trim().Length == 0 ? "" : string.Format("{0} <= # '{1}';", WmsOutRequest.fields.orderDate.ToString(), dateEditTo.DateTime)); | |||
|  |                     } | |||
|  |                      | |||
|  |                     else | |||
|  |                     { | |||
|  |                         query += (this.dateEditFrom.Text.Trim().Length == 0 ? "" : string.Format("{0} >= # '{1}';", "lastmodified", dateEditFrom.DateTime)) | |||
|  |                          + (this.dateEditTo.Text.Trim().Length == 0 ? "" : string.Format("{0} <= # '{1}';", "lastmodified", dateEditTo.DateTime)); | |||
|  |                     } | |||
|  |                     | |||
|  |                     query += (this.comboState.SelectedIndex <= 0 ? "" : string.Format("{0} = #{1};", WmsOutRequest.fields.state.ToString(), ((Colitem)this.comboState.SelectedItem).key)); | |||
|  |                 } | |||
|  |                 //    、、  + (this.txtGoodName.Text.Trim().Length == 0 ? "" : string.Format("{0} like # '%{1}%';", WmsOutRequest.exfields.goodName.ToString(), txtGoodName.Text))      | |||
|  |                 bool isQueryNotChanged = lastQuery.Equals(query); | |||
|  |                 this.pager1.PageCurrent = isQueryNotChanged ? this.pager1.PageCurrent : 1; //根据查询条件的变化给pager赋值 | |||
|  |                 int start = (pager1.PageSize * (pager1.PageCurrent - 1) + 1); | |||
|  |                 int end = (pager1.PageSize * pager1.PageCurrent); | |||
|  |                 lastQuery = query; | |||
|  | 
 | |||
|  |                 DataSet ds = orderType == enumOutStoreType.销售出库 ? this.outClient.Query(query, start, end) : pickClient.Query(query, start, end); | |||
|  |                 outClient.Close(); | |||
|  |                 pickClient.Close(); | |||
|  |                 dt = 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; | |||
|  | 
 | |||
|  | 
 | |||
|  | 
 | |||
|  |                 dt.PrimaryKey = new DataColumn[] { dt.Columns[orderFieldName] }; | |||
|  |                 bool firstLoad = !isQueryNotChanged || this.gridControl1.DataSource == null; | |||
|  |                 this.gridControl1.DataSource = dt.DefaultView; | |||
|  |                 initialDataGridColumns(); | |||
|  |                 //update selected row index to the last updated one. | |||
|  | 
 | |||
|  |                 if (false && !string.IsNullOrEmpty(currentOrder)) | |||
|  |                 { | |||
|  |                     selectedRowIndex = -1; | |||
|  |                     DataRow dr = dt.Rows.Find(currentOrder); | |||
|  |                     if (dr != null) | |||
|  |                     { | |||
|  |                         selectedRowIndex = dt.Rows.IndexOf(dr); | |||
|  |                     } | |||
|  | 
 | |||
|  |                     if (selectedRowIndex >= 0 && dt.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 && dt.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() | |||
|  |         { | |||
|  | 
 | |||
|  |             lbOrderNo.Text = ""; | |||
|  | 
 | |||
|  |             lbCustom.Text = ""; | |||
|  | 
 | |||
|  |             //lbaddress.Text = ""; | |||
|  | 
 | |||
|  | 
 | |||
|  |             if (selectedRowIndex <0 || selectedRowIndex >= dt.Rows.Count) | |||
|  |             { | |||
|  |                 return false; | |||
|  |             } | |||
|  |             | |||
|  |           //  DataRow currentRow = dt.Rows[selectedRowIndex]; | |||
|  |             DataRowView dr = (DataRowView)(GetGridViewFilteredAndSortedData(gridView1)[selectedRowIndex]); | |||
|  |             currentOrder = dr[orderFieldName].ToString(); | |||
|  | 
 | |||
|  |             lbOrderNo.Text = currentOrder; | |||
|  | 
 | |||
|  |             lbCustom.Text = dr["customerName"].ToString(); | |||
|  | 
 | |||
|  |         //    lbaddress.Text = dr["address"].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); | |||
|  |              this.gridViewOrderLog.IndicatorWidth = 40; | |||
|  |              this.gridViewOrderLog.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler(gridView_CustomDrawRowIndicator); | |||
|  | 
 | |||
|  |             gridView2.CustomColumnDisplayText += gridView2_CustomColumnDisplayText; | |||
|  |             gridView2.CustomDrawCell += gridView_CustomDrawCell; | |||
|  |            // gridView2.RowCellStyle += gridView_RowCellStyle; | |||
|  |             gridView1.RowCellStyle += gridView_RowCellStyle; | |||
|  | 
 | |||
|  |              gridView1.CustomColumnDisplayText += gridView2_CustomColumnDisplayText; | |||
|  |              gridViewOrderLog.CustomColumnDisplayText += gridView2_CustomColumnDisplayText; | |||
|  | 
 | |||
|  |              gridViewRequestOrders.CustomColumnDisplayText += gridView2_CustomColumnDisplayText; | |||
|  |              gridViewRequestOrders.CustomDrawCell += gridView_CustomDrawCell; | |||
|  |   | |||
|  |              this.gridviewStockRecord.IndicatorWidth = 40; | |||
|  |              this.gridviewStockRecord.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler(gridView_CustomDrawRowIndicator); | |||
|  |              gridviewStockRecord.CustomColumnDisplayText += gridView2_CustomColumnDisplayText; | |||
|  |            | |||
|  |              this.gridViewRequestOrders.IndicatorWidth = 40; | |||
|  |              this.gridViewRequestOrders.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler(gridView_CustomDrawRowIndicator); | |||
|  |              gridViewRequestOrders.CustomColumnDisplayText += gridView2_CustomColumnDisplayText; | |||
|  |            | |||
|  | 
 | |||
|  |            // this.gridView2.FocusedRowObjectChanged += new DevExpress.XtraGrid.Views.Base.FocusedRowObjectChangedEventHandler(this.gridView1_FocusedRowObjectChanged); | |||
|  |           //  this.gridView2.DataSourceChanged += new System.EventHandler(this.gridView1_DataSourceChanged); | |||
|  |               | |||
|  |         } | |||
|  |      | |||
|  |        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 == "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; | |||
|  |            } | |||
|  | 
 | |||
|  |            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; | |||
|  |            } | |||
|  | 
 | |||
|  | 
 | |||
|  |            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() | |||
|  |         { | |||
|  |             if (!getCurrentObject() || string.IsNullOrEmpty(  currentOrder)   ) | |||
|  |             { | |||
|  |                 return; | |||
|  |             } | |||
|  |            /// gridView1.FocusedRowHandle = selectedRowIndex;// | |||
|  |           //  gridView1.SelectRow(selectedRowIndex); | |||
|  |             showWaitForm(); | |||
|  | 
 | |||
|  |             try | |||
|  |             {   | |||
|  |                  lgRequestOrderno.Visibility = orderType != enumOutStoreType.销售出库 ? DevExpress.XtraLayout.Utils.LayoutVisibility.Always : DevExpress.XtraLayout.Utils.LayoutVisibility.Never; | |||
|  |                  lgStockRecord.Visibility = orderType != enumOutStoreType.销售出库 ?DevExpress.XtraLayout.Utils.LayoutVisibility.Always : DevExpress.XtraLayout.Utils.LayoutVisibility.Never; | |||
|  | 
 | |||
|  |                  if (orderType != enumOutStoreType.销售出库) | |||
|  |                  { | |||
|  |                      | |||
|  |                      DataSet ds = pickClient.getPickOrderDetails(currentOrder); | |||
|  |                      dtDetail = ds.Tables[0]; | |||
|  | 
 | |||
|  |                      this.gridcontrolStockRecord .DataSource = ds.Tables[2];  | |||
|  |                      this.gridcontrolRequestOut.DataSource = ds.Tables[1]; | |||
|  |                       | |||
|  |                      initialGridView2Columns(gridViewRequestOrders); | |||
|  |                      initialDataGridLogColumns(this.gridviewStockRecord); | |||
|  | 
 | |||
|  |                  } | |||
|  |                  else | |||
|  |                  { | |||
|  |                      dtDetail = pickClient.getPickDetails(currentOrder, (int)orderType); | |||
|  |                      pickClient.Close(); | |||
|  |                      | |||
|  |                  } | |||
|  | 
 | |||
|  |                   | |||
|  |                 this.gridControlDetail.DataSource = dtDetail; | |||
|  |                 initialGridView2Columns(gridView2); | |||
|  | 
 | |||
|  |                  DataTable dt2 = pickClient.getOrderLogs(currentOrder, (int)orderType); | |||
|  |                  pickClient.Close(); | |||
|  |                 this.gridcontrolOderLogs.DataSource = dt2; | |||
|  |                 initialDataGridLogColumns(gridViewOrderLog); | |||
|  |                   | |||
|  |             } | |||
|  |             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(currentOrder)) | |||
|  |             { | |||
|  |                 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) | |||
|  |         { | |||
|  |            // outClient.Close(); | |||
|  |           //  pickClient.Close(); | |||
|  |         } | |||
|  |   | |||
|  |       | |||
|  |     } | |||
|  | } |