1498 lines
		
	
	
		
			55 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			1498 lines
		
	
	
		
			55 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.wms.win.TMService;
 | |
| 
 | |
| 
 | |
| namespace DeiNiu.wms.win
 | |
| {
 | |
|     public partial class CreateTransForm : BasicRibbonForm
 | |
|     {
 | |
|          
 | |
|         
 | |
|         //  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;
 | |
|         int lineId = 0;
 | |
|          
 | |
|         public CreateTransForm()
 | |
|         {
 | |
|             InitializeComponent();
 | |
|             initialControls();
 | |
| 
 | |
|             //initialBackGroundTasks();
 | |
|             //    loadData();
 | |
|         }
 | |
|         #region initialControls
 | |
|         private void initialControls()
 | |
|         {
 | |
|             initialComboBoxes();
 | |
|             initialPagerControls();
 | |
|             initialDataGrid();
 | |
|             initialQueryInput(); 
 | |
|             setValidationRule();
 | |
|             bindLookup();
 | |
|            
 | |
| 
 | |
|         }
 | |
|         /*
 | |
|         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(-3);
 | |
|             //this.dateEditTo.EditValue = DateTime.Now;
 | |
| 
 | |
|             this.comLines.Properties.TextEditStyle = TextEditStyles.DisableTextEditor;
 | |
|           //  this.comOrderType.SelectedIndex = 0;
 | |
| 
 | |
|             DataTable dt = Park.getDictionary(false);
 | |
|             if (dt.Rows.Count == 0)
 | |
|             {
 | |
|                 return;
 | |
|             }
 | |
|             DataRow[] drs = dt.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 3001:
 | |
|                         initialComboBoxs(this.comLines, drss); // lines
 | |
|                       
 | |
|                         break;
 | |
|                     case 3004:
 | |
|                         initialComboBoxs(this.comThird, drss,false); // lines
 | |
| 
 | |
|                         break;
 | |
|                 }
 | |
| 
 | |
|             }
 | |
| 
 | |
|             initialComboBoxs(comboState, this.goodsCollection);
 | |
|             this.comLines.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 = WmsOutPickRequest.fields.pickOrderNo.ToString() };
 | |
|           //  GridColumn myCol2 = new GridColumn() { Caption = "类别", Visible = true, FieldName = WmsOutPickRequest.fields.orderTypeName.ToString() };
 | |
|             GridColumn myCol2 = new GridColumn() { Caption = "集货货位", Visible = true, FieldName = WmsOutPickRequest.fields.tranLocationId.ToString() };
 | |
|            // GridColumn myCol21 = new GridColumn() { Caption = "货位类型", Visible = true, FieldName = Wmslocation.fields.volType.ToString() };
 | |
| 
 | |
| 
 | |
|             GridColumn myCol3 = new GridColumn() { Caption = "拣货单状态", Visible = true, FieldName = WmsOutPickRequest.fields.state.ToString() };
 | |
|             GridColumn myCol31 = new GridColumn() { Caption = "运单", Visible = true, FieldName = WmsOutPickRequest.fields.transNo.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 = "select", Visible = true};
 | |
|             GridColumn myCol8 = new GridColumn() { Caption = "线路", Visible = true, FieldName = "lineName" };
 | |
|             GridColumn myCol9 = new GridColumn() { Caption = "体积(立方米)", Visible = true, FieldName = "sumVol" };
 | |
|             GridColumn myCol10 = new GridColumn() { Caption = "重量(千克)", Visible = true, FieldName = "sumWeight" };
 | |
| 
 | |
|             GridColumn myCol11 = new GridColumn() { Caption = "整货件数", Visible = true, FieldName = WmsOutPickRequest.fields.boxCnt.ToString() };
 | |
|             GridColumn myCol12 = new GridColumn() { Caption = "散货拼箱", Visible = true, FieldName = WmsOutPickRequest.fields.bulkBox.ToString() };
 | |
|             GridColumn myCol13 = new GridColumn() { Caption = "散货拼袋", Visible = true, FieldName = WmsOutPickRequest.fields.bulkBag.ToString() };
 | |
| 
 | |
|             this.gridView1.Columns.Add(myCol1);
 | |
|            
 | |
|             this.gridView1.Columns.Add(myCol3);
 | |
|             this.gridView1.Columns.Add(myCol31); 
 | |
| 
 | |
|             this.gridView1.Columns.Add(myCol4);
 | |
| 
 | |
|             this.gridView1.Columns.Add(myCol8);
 | |
|             this.gridView1.Columns.Add(myCol2);
 | |
|             this.gridView1.Columns.Add(myCol9);
 | |
|             this.gridView1.Columns.Add(myCol10);
 | |
|             this.gridView1.Columns.Add(myCol11);
 | |
|             this.gridView1.Columns.Add(myCol12);
 | |
|             this.gridView1.Columns.Add(myCol13); 
 | |
|           //  this.gridView1.Columns.Add(myCol6);
 | |
|             this.gridView1.Columns.Add(myCol5);  
 | |
|  
 | |
|             //to show bottom scroll bar
 | |
|             gridView1.OptionsView.ColumnAutoWidth = false;
 | |
|             gridView1.BestFitColumns();
 | |
|             gridView1.Focus();
 | |
| 
 | |
| 
 | |
|         //    initialGridView2Columns();
 | |
|             gridControlDetail.DataSource = null;
 | |
|             this.gcBulks.DataSource = null;
 | |
|             gcBatch.DataSource = null;
 | |
| 
 | |
|         }
 | |
| 
 | |
|         private void initialDataGridTransColumns()
 | |
|         {
 | |
|             setupGridView(gvtrans, false);
 | |
|             //setupGridView(gridView2, false,false);
 | |
|             //setupGridView(gridView3, false,false);
 | |
|             //   gridviewGoodsType.PopulateColumns();
 | |
|             gvtrans.Columns.Clear();
 | |
|             // gridviewGoodsType.Columns.Remove(gridviewGoodsType.Columns["DealerPrice"]); 
 | |
|             GridColumn myCol0 = new GridColumn() { Caption = "ID", Visible = true, FieldName = "id" };
 | |
|             myCol0.Visible = false;
 | |
|             this.gvtrans.Columns.Add(myCol0);
 | |
|             GridColumn myCol1 = new GridColumn() { Caption = "单号", Visible = true, FieldName = TmsTranRequest.fields.transNo.ToString() };
 | |
|             GridColumn myCol2 = new GridColumn() { Caption = "类别", Visible = true, FieldName = TmsTranRequest.fields.tranType.ToString() };
 | |
|             GridColumn myCol3 = new GridColumn() { Caption = "状态", Visible = true, FieldName = TmsTranRequest.fields.state.ToString() };
 | |
| 
 | |
|             GridColumn myCol4 = new GridColumn() { Caption = "车辆", Visible = true, FieldName = TmsTranRequest.fields.viechleNo.ToString() };
 | |
|             GridColumn myCol5 = new GridColumn() { Caption = "联系人", Visible = true, FieldName = TmsTranRequest.fields.contact.ToString() };
 | |
|             GridColumn myCol6 = new GridColumn() { Caption = "电话", Visible = true, FieldName = TmsTranRequest.fields.phone.ToString() };
 | |
|             GridColumn myCol7 = new GridColumn() { Caption = "第三方物流", Visible = true, FieldName = "thirdPartName" };
 | |
|             GridColumn myCol8 = new GridColumn() { Caption = "线路", Visible = true, FieldName = "lineName" };
 | |
|             GridColumn myCol9 = new GridColumn() { Caption = "体积(立方米)", Visible = true, FieldName = TmsTranRequest.fields.sumVol.ToString() };
 | |
|             GridColumn myCol10 = new GridColumn() { Caption = "重量(千克)", Visible = true, FieldName = TmsTranRequest.fields.sumWeight.ToString() };
 | |
| 
 | |
|             GridColumn myCol11 = new GridColumn() { Caption = "整货件数", Visible = true, FieldName = TmsTranRequest.fields.boxCnt.ToString() };
 | |
|             GridColumn myCol12 = new GridColumn() { Caption = "散货拼箱", Visible = true, FieldName = TmsTranRequest.fields.bulkBox.ToString() };
 | |
|             GridColumn myCol13 = new GridColumn() { Caption = "散货拼袋", Visible = true, FieldName = TmsTranRequest.fields.bulkBag.ToString() };
 | |
| 
 | |
|             this.gvtrans.Columns.Add(myCol1);
 | |
|             this.gvtrans.Columns.Add(myCol2); 
 | |
|             this.gvtrans.Columns.Add(myCol3);
 | |
|             this.gvtrans.Columns.Add(myCol4);
 | |
| 
 | |
|             this.gvtrans.Columns.Add(myCol8);
 | |
|             this.gvtrans.Columns.Add(myCol9);
 | |
|             this.gvtrans.Columns.Add(myCol10);
 | |
|             this.gvtrans.Columns.Add(myCol11);
 | |
|             this.gvtrans.Columns.Add(myCol12);
 | |
|             this.gvtrans.Columns.Add(myCol13);
 | |
|             //  this.gvtrans.Columns.Add(myCol6);
 | |
|             this.gvtrans.Columns.Add(myCol5);
 | |
|             this.gvtrans.Columns.Add(myCol7);
 | |
|             //to show bottom scroll bar
 | |
|             gvtrans.OptionsView.ColumnAutoWidth = false;
 | |
|             gvtrans.BestFitColumns();
 | |
|             gvtrans.Focus();
 | |
| 
 | |
| 
 | |
|             //    initialGridView2Columns();
 | |
|         //    gridControlDetail.DataSource = null;
 | |
|           //  this.gcBulks.DataSource = null;
 | |
|           //  gcBatch.DataSource = null;
 | |
| 
 | |
|         }
 | |
| 
 | |
| 
 | |
|         private void initialGridView2Columns(GridView gridview)
 | |
|         {
 | |
|             setupGridView(gridview, false, true, 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" };
 | |
| 
 | |
|             
 | |
| 
 | |
|           
 | |
|           gridview.Columns.Add(myCol1191); 
 | |
|  
 | |
|             gridview.Columns.Add(myCol2);
 | |
|           //  gridview.Columns.Add(myCol17);
 | |
|             gridview.Columns.Add(myCol171);
 | |
|             gridview.Columns.Add(myCol172);
 | |
| 
 | |
|             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);
 | |
|             //to show bottom scroll bar
 | |
|             gridview.OptionsView.ColumnAutoWidth = false;
 | |
|             gridview.BestFitColumns();
 | |
|           //  gridView2.Focus();
 | |
|         }
 | |
| 
 | |
| 
 | |
|         private void initialDataGridBulkColumns(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 = WmsOutPickRequest.fields.pickOrderNo.ToString() };
 | |
|             GridColumn myCol2 = new GridColumn() { Caption = "货位", Visible = true, FieldName = TmsStock.fields.locationId.ToString() };
 | |
|             GridColumn myCol3 = new GridColumn() { Caption = "打包类型", Visible = true, FieldName = WmsLocation.fields.volType.ToString() };
 | |
|             GridColumn myCol4 = new GridColumn() { Caption = "数量", Visible = true, FieldName = TmsStock.fields.count.ToString() };
 | |
|           
 | |
| 
 | |
| 
 | |
|             gridview.Columns.Add(myCol1);
 | |
|             gridview.Columns.Add(myCol2);
 | |
|             gridview.Columns.Add(myCol3);
 | |
|             gridview.Columns.Add(myCol4); 
 | |
|             //to show bottom scroll bar
 | |
|             gridview.OptionsView.ColumnAutoWidth = false;
 | |
|             gridview.BestFitColumns();
 | |
|             gridview.Focus();
 | |
|  
 | |
|         }
 | |
| 
 | |
| 
 | |
|         private void initialDataGridBatchColumns(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 = WmsOutPickRequest.fields.pickOrderNo.ToString() };
 | |
|             GridColumn myCol2 = new GridColumn() { Caption = "货位", Visible = true, FieldName = WmsOutPickRequest.fields.tranLocationId.ToString() };
 | |
|             GridColumn myCol3 = new GridColumn() { Caption = "货位类型", Visible = true, FieldName = WmsLocation.fields.volType.ToString() };
 | |
|             GridColumn myCol31 = new GridColumn() { Caption = "数量", Visible = true, FieldName = WmsStock.fields.count.ToString() };
 | |
|             GridColumn myCol4 = new GridColumn() { Caption = "件数", Visible = true, FieldName = "boxCnt" };
 | |
|             GridColumn myCol5 = new GridColumn() { Caption = "商品名称", Visible = true, FieldName = WmsGoods.exfields.goodsName.ToString() };
 | |
|             GridColumn myCol6 = new GridColumn() { Caption = "批号", Visible = true, FieldName =WmsStock.fields.batch.ToString() };
 | |
|             GridColumn myCol7 = new GridColumn() { Caption = "厂家", Visible = true, FieldName = WmsGoods.exfields.manufacturer.ToString() };
 | |
|             GridColumn myCol8 = new GridColumn() { Caption = "单位", Visible = true, FieldName = WmsGoods.exfields.unit.ToString() };
 | |
|             GridColumn myCol9 = new GridColumn() { Caption = "大包装", Visible = true, FieldName = WmsGoods.exfields.bigCount.ToString() };
 | |
|             GridColumn myCol10 = new GridColumn() { Caption = "货物状态", Visible = true, FieldName = WmsOutPickRequest.fields.batchPickState.ToString() };
 | |
|             gridview.Columns.Add(myCol1);
 | |
|         //    gridview.Columns.Add(myCol2); 
 | |
|           //  gridview.Columns.Add(myCol3);
 | |
|             gridview.Columns.Add(myCol31);
 | |
|             gridview.Columns.Add(myCol9);
 | |
|             gridview.Columns.Add(myCol4);
 | |
|             gridview.Columns.Add(myCol10);
 | |
|             gridview.Columns.Add(myCol5);
 | |
|             gridview.Columns.Add(myCol6);           
 | |
|             gridview.Columns.Add(myCol7);
 | |
|             gridview.Columns.Add(myCol8);
 | |
|           
 | |
|             //to show bottom scroll bar
 | |
|             gridview.OptionsView.ColumnAutoWidth = false;
 | |
|             gridview.BestFitColumns();
 | |
|             gridview.Focus();
 | |
| 
 | |
|         }
 | |
| 
 | |
|         
 | |
|         #endregion
 | |
| 
 | |
|  
 | |
|        
 | |
| 
 | |
| 
 | |
|         /// <summary>  
 | |
|         /// loading data
 | |
|         /// </summary>  
 | |
|         private int loadData()
 | |
|         {
 | |
|            // initialRequestOrders();
 | |
|             //this.gridviewGoodsType.DataSource = lgt.GetAllActiveData().Tables[0].DefaultView;
 | |
|             showWaitForm();
 | |
| 
 | |
|             try
 | |
|             {
 | |
|                 string orderNo = this.txtOrderNo.Text.Trim();
 | |
| 
 | |
|                 string query = !string.IsNullOrEmpty(orderNo) ? string.Format("{0} =#'{1}';", WmsOutPickRequest.fields.pickOrderNo.ToString(), filtRiskChar(orderNo)) : 
 | |
|                                 (this.txtVender.Text.Trim().Length == 0 ? "" : string.Format("{0} like # '%{1}%';", WmsOutRequest.fields.customerName.ToString(), filtRiskChar(txtVender.Text.Trim())))
 | |
|                           
 | |
|                                  +(this.comboState.SelectedIndex <= 0 ? "" : 
 | |
|                                  this.comboState.SelectedIndex == 1? string.Format("{0} <=#{1};", WmsOutRequest.fields.state.ToString(), ((Colitem)this.comboState.SelectedItem).key) 
 | |
|                                  : string.Format("{0} = #{1};", WmsOutRequest.fields.state.ToString(), ((Colitem)this.comboState.SelectedItem).key))
 | |
|                                  + (this.comLines.SelectedIndex <= 0 ? "" : string.Format("{0} =#{1};", "lineId", ((Node)this.comLines.SelectedItem).ID))
 | |
|                                  //+ string.Format("{0} = #{1};", WmsOutPickRequest.fields.outStoreType.ToString(), (int)enumOutStoreType.拣货出库)
 | |
|                                  ;
 | |
|               
 | |
|                 //    、、  + (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 = tmsClient.queryPickRequests(query, start, end); 
 | |
|                 closeClient();
 | |
|                 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[WmsOutPickRequest.fields.pickOrderNo.ToString()] };
 | |
|                 bool firstLoad = !isQueryNotChanged || this.gridControl1.DataSource == null;
 | |
|                 this.gridControl1.DataSource = dt.DefaultView;
 | |
|                 initialDataGridColumns();
 | |
|                 //update selected row index to the last updated one.
 | |
| 
 | |
| 
 | |
|                 lbSumVolume.Text = "0.00";
 | |
|                 lbSumWeight.Text = "0.00";
 | |
|                 lbBoxCount.Text = "0";
 | |
|                 lbBulkBagCnt.Text = "0";
 | |
|                 lbBulkBoxCnt.Text = "0";
 | |
| 
 | |
| 
 | |
| 
 | |
|                 DataTable sumDt = ds.Tables[2];
 | |
| 
 | |
|                 foreach (DataRow dr in sumDt.Rows)
 | |
|                 {
 | |
|                     lbSumVolume.Text = dr["sumVol"].ToString();
 | |
|                     lbSumWeight.Text = dr["sumWeight"].ToString();
 | |
|                     lbBoxCount.Text = dr["boxCnt"].ToString(); ;
 | |
|                     lbBulkBagCnt.Text = dr["bulkBag"].ToString(); ;
 | |
|                     lbBulkBoxCnt.Text = dr["bulkBox"].ToString(); ;
 | |
|                 }
 | |
| 
 | |
| 
 | |
|                 setSelectedSum();
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|                 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();
 | |
|                 }
 | |
|                 queryTranRequests();
 | |
|                 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();
 | |
|             bindLookup();
 | |
|            
 | |
| 
 | |
|         }
 | |
| 
 | |
|         private void queryTranRequests()
 | |
|         {
 | |
| 
 | |
|             try
 | |
|             {
 | |
|                 DataTable dt = tmsClient.getTransRequests((int)enumTranStatus.装车启运);
 | |
|                
 | |
| 
 | |
|                 gcTrans.DataSource = dt;
 | |
|                 initialDataGridTransColumns();  
 | |
| 
 | |
|             }
 | |
|             catch (Exception er)
 | |
|             {
 | |
|                  
 | |
|             }
 | |
| 
 | |
| 
 | |
|             closeClient();
 | |
| 
 | |
| 
 | |
|         }
 | |
| 
 | |
| 
 | |
|         private void queryGoods()
 | |
|         {
 | |
| 
 | |
|             showWaitForm();
 | |
|             try
 | |
|             {
 | |
|                 query();// loadData();  
 | |
|             }
 | |
|             catch (Exception e)
 | |
|             {
 | |
|                 showErrorMsg(e,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,e.Message);
 | |
|             }
 | |
|             finally
 | |
|             {
 | |
|                 // WaitFormService.Close();
 | |
|                 closeWaitForm();
 | |
|              
 | |
|             }
 | |
|              
 | |
| 
 | |
|         }
 | |
| 
 | |
|         private bool getCurrentObject()
 | |
|         {
 | |
|  
 | |
| 
 | |
|             if (selectedRowIndex <0 || selectedRowIndex >= dt.Rows.Count)
 | |
|             {
 | |
|                 return false;
 | |
|             }
 | |
|            
 | |
|           //  DataRow currentRow = dt.Rows[selectedRowIndex];
 | |
|             DataRowView dr = (DataRowView)(GetGridViewFilteredAndSortedData(gridView1)[selectedRowIndex]);
 | |
|             currentOrder = dr[WmsOutPickRequest.fields.pickOrderNo.ToString()].ToString();
 | |
|  
 | |
|              
 | |
|             return true;
 | |
| 
 | |
|         }
 | |
|        
 | |
|        
 | |
| 
 | |
| 
 | |
|         private void btnQuery_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             queryGoods();
 | |
|         }
 | |
| 
 | |
|         private void gridView1_SelectionChanged(object sender, DevExpress.Data.SelectionChangedEventArgs e)
 | |
|         {
 | |
|             setSelectedSum();
 | |
|             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.gvBulks.IndicatorWidth = 40;
 | |
|              this.gvBulks.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler(gridView_CustomDrawRowIndicator);
 | |
| 
 | |
|              this.gvBatch.IndicatorWidth = 40;
 | |
|              this.gvBatch.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;
 | |
|              gvBulks.CustomColumnDisplayText += gridView2_CustomColumnDisplayText; 
 | |
|              gvBatch.CustomColumnDisplayText += gridView2_CustomColumnDisplayText; 
 | |
|              gvtrans.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 == "batchPickState")
 | |
|             {
 | |
| 
 | |
|                 if (!pickStatus.ContainsValue(e.DisplayText))
 | |
|                 {
 | |
| 
 | |
|                     int display = -100;
 | |
|                     string disTxt = e.DisplayText;
 | |
| 
 | |
|                     try
 | |
|                     {
 | |
|                         display = Convert.ToInt32(e.DisplayText);
 | |
| 
 | |
|                         e.DisplayText = pickStatus[display];
 | |
| 
 | |
|                     }
 | |
|                     catch
 | |
|                     {
 | |
|                         return;
 | |
|                     }
 | |
| 
 | |
|                 }
 | |
| 
 | |
| 
 | |
|                 //    e.DisplayText = pickDetailStatus.ContainsKey(display) ? pickDetailStatus[display] : display+"";
 | |
| 
 | |
|             }
 | |
|             else if (e.Column.FieldName == "volType")
 | |
|             {
 | |
| 
 | |
|                 if (!locVolType.ContainsValue(e.DisplayText))
 | |
|                 {
 | |
| 
 | |
|                     int display = -100;
 | |
|                     string disTxt = e.DisplayText;
 | |
| 
 | |
|                     try
 | |
|                     {
 | |
|                         display = Convert.ToInt32(e.DisplayText);
 | |
| 
 | |
|                         e.DisplayText = locVolType[display];
 | |
| 
 | |
|                     }
 | |
|                     catch
 | |
|                     {
 | |
|                         return;
 | |
|                     }
 | |
| 
 | |
|                 }
 | |
| 
 | |
| 
 | |
|                 //    e.DisplayText = pickDetailStatus.ContainsKey(display) ? pickDetailStatus[display] : display+"";
 | |
| 
 | |
|             }
 | |
|             else if (e.Column.FieldName == "tranType")
 | |
|             {
 | |
| 
 | |
|                 if (!tranType.ContainsValue(e.DisplayText))
 | |
|                 {
 | |
| 
 | |
|                     int display = -100;
 | |
|                     string disTxt = e.DisplayText;
 | |
| 
 | |
|                     try
 | |
|                     {
 | |
|                         display = Convert.ToInt32(e.DisplayText);
 | |
| 
 | |
|                         e.DisplayText = tranType[display];
 | |
| 
 | |
|                     }
 | |
|                     catch
 | |
|                     {
 | |
|                         return;
 | |
|                     }
 | |
| 
 | |
|                 }
 | |
| 
 | |
| 
 | |
|                 //    e.DisplayText = pickDetailStatus.ContainsKey(display) ? pickDetailStatus[display] : display+"";
 | |
| 
 | |
|             }
 | |
|             else if (sender == gvtrans && e.Column.FieldName == "state")
 | |
|             {
 | |
|                 if (!tranStatus.ContainsValue(e.DisplayText))
 | |
|                 {
 | |
| 
 | |
|                     int display = -100;
 | |
|                     string disTxt = e.DisplayText;
 | |
| 
 | |
|                     try
 | |
|                     {
 | |
|                         display = Convert.ToInt32(e.DisplayText);
 | |
| 
 | |
|                         e.DisplayText = tranStatus[display];
 | |
| 
 | |
|                     }
 | |
|                     catch
 | |
|                     {
 | |
|                         return;
 | |
|                     }
 | |
| 
 | |
|                 }
 | |
|                 // e.DisplayText = pickRequestStatus.ContainsKey(display) ? pickRequestStatus[display] : display+"";
 | |
| 
 | |
|             }
 | |
|             else if (e.Column.FieldName == "goodsPickState")
 | |
|             {
 | |
|                 if (!pickDetailStatus.ContainsValue(e.DisplayText))
 | |
|                 {
 | |
| 
 | |
|                     int display = -100;
 | |
|                     string disTxt = e.DisplayText;
 | |
| 
 | |
|                     try
 | |
|                     {
 | |
|                         display = Convert.ToInt32(e.DisplayText);
 | |
| 
 | |
|                         e.DisplayText = pickDetailStatus[display];
 | |
| 
 | |
|                     }
 | |
|                     catch
 | |
|                     {
 | |
|                         return;
 | |
|                     }
 | |
| 
 | |
|                 }
 | |
|                 // e.DisplayText = pickRequestStatus.ContainsKey(display) ? pickRequestStatus[display] : display+"";
 | |
| 
 | |
|             }
 | |
|             else if (sender == gridView1 && e.Column.FieldName == "state" || e.Column.FieldName == "batchPickState" || e.Column.FieldName == "pickOrderState")
 | |
|             {
 | |
|                 if (!pickRequestStatus.ContainsValue(e.DisplayText))
 | |
|                 {
 | |
| 
 | |
|                     int display = -100;
 | |
|                     string disTxt = e.DisplayText;
 | |
| 
 | |
|                     try
 | |
|                     {
 | |
|                         display = Convert.ToInt32(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";
 | |
|             }
 | |
|             else if (e.Column.FieldName == TmsTranRequest.fields.sumWeight.ToString())
 | |
|             {
 | |
|                  //e.Column.DisplayFormat.FormatString = "{N2}";
 | |
|                  e.DisplayText = string.Format("{0:N2}", e.DisplayText);
 | |
|             }
 | |
|             */
 | |
| 
 | |
| 
 | |
| 
 | |
|         }
 | |
|        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
 | |
|             { 
 | |
| 
 | |
|                 dtDetail = pickClient.getPickDetails(currentOrder,true);
 | |
|                 closeClient();
 | |
|                 this.gridControlDetail.DataSource = dtDetail;
 | |
|                  initialGridView2Columns(gridView2);
 | |
| 
 | |
| 
 | |
|                  DataSet pickDetail = tmsClient.getPickRequestDetail(currentOrder); closeClient();
 | |
|                  this.gcBulks.DataSource = pickDetail.Tables[1]; 
 | |
|                  initialDataGridBulkColumns(gvBulks); 
 | |
|                  this.gcBatch.DataSource = pickDetail.Tables[0]; 
 | |
|                  initialDataGridBatchColumns(gvBatch);  
 | |
|             }
 | |
|             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.Message);
 | |
|             }
 | |
| 
 | |
|              
 | |
|           
 | |
| 
 | |
|             closeWaitForm();
 | |
|         }
 | |
| */ 
 | |
|         private void GoodsOutQueryForm_FormClosing(object sender, FormClosingEventArgs e)
 | |
|         {
 | |
|            // outClient.Close();
 | |
|           //  closeClient();
 | |
|         }
 | |
| 
 | |
|         private void lbOrderNo_Click(object sender, EventArgs e)
 | |
|         {
 | |
| 
 | |
|         }
 | |
| 
 | |
|         //绑定可用车辆
 | |
|         private void bindLookup()
 | |
|         {
 | |
| 
 | |
|  
 | |
|             // Bind the edit value to the ProductID field of the "Order Details" table;
 | |
|             // the edit value matches the value of the ValueMember field.
 | |
|             // comViechles.DataBindings.Add("EditValue", dvMain, "ProductID");
 | |
| 
 | |
|             // Prevent columns from being automatically created when a data source is assigned.
 | |
|             comViechles.Properties.View.OptionsBehavior.AutoPopulateColumns = false;
 | |
|             // The data source for the dropdown rows
 | |
|             comViechles.Properties.DataSource = tmsClient.getFreeViechles(); closeClient();
 | |
|             // The field for the editor's display text.
 | |
|             comViechles.Properties.DisplayMember = "viechleId";
 | |
|             // The field matching the edit value.
 | |
|             comViechles.Properties.ValueMember = "viechleId";
 | |
| 
 | |
|             // Add two columns in the dropdown:
 | |
|             // A column to display the values of the ProductID field;
 | |
|             comViechles.Properties.View.Columns.Clear();
 | |
|             GridColumn col1 = comViechles.Properties.View.Columns.AddField("viechleId");
 | |
|             col1.VisibleIndex = 0;
 | |
|             col1.Caption = "车牌";
 | |
|             // A column to display the values of the ProductName field.
 | |
|             GridColumn col2 = comViechles.Properties.View.Columns.AddField("volumeName");
 | |
|             col2.VisibleIndex = 1;
 | |
|             col2.Caption = "车辆容积";
 | |
| 
 | |
|             GridColumn col3 = comViechles.Properties.View.Columns.AddField("loadName");
 | |
|             col3.VisibleIndex = 2;
 | |
|             col3.Caption = "车辆载货量";
 | |
| 
 | |
|             GridColumn col4 = comViechles.Properties.View.Columns.AddField("airConditionName");
 | |
|             col4.VisibleIndex = 3;
 | |
|             col4.Caption = "温控类型";
 | |
| 
 | |
|             // Set column widths according to their contents.
 | |
|             comViechles.Properties.View.BestFitColumns();
 | |
|             // Specify the total dropdown width.
 | |
|             comViechles.Properties.PopupFormWidth = 330;
 | |
| 
 | |
|         }
 | |
| 
 | |
|         int subBoxCnt = 0;
 | |
|         int bulksBoxCnt = 0;
 | |
|         int bulkBagCnt = 0;
 | |
|         decimal vol = 0.0m;
 | |
|         decimal weight = 0.0m;
 | |
|         void setSelectedSum()
 | |
|         {
 | |
| 
 | |
|             int[] selectedRows = gridView1.GetSelectedRows();
 | |
| 
 | |
| 
 | |
|            // IList<Object> selectedRows = (IList<Object>)GetGridViewFilteredAndSortedData(gridView1);
 | |
| 
 | |
| 
 | |
| 
 | |
|             lbsubBoxcnt.Text = 
 | |
|             lbsubBulkBags.Text=
 | |
|             lbsubBulkBoxCnt.Text =
 | |
|            // lbsubCustCnt.Text=           "0";
 | |
| 
 | |
|             lbsubVol.Text =
 | |
|             lbsubWeight.Text = "0.0";
 | |
|           
 | |
|              subBoxCnt = 0;
 | |
|              bulksBoxCnt = 0;
 | |
|              bulkBagCnt = 0;
 | |
|              vol = 0.0m;
 | |
|              weight = 0.0m;
 | |
| 
 | |
|             int j = 0;
 | |
|             
 | |
|             foreach (int i in selectedRows)
 | |
|             {
 | |
|                 j = i;
 | |
|                 if (gridView1.IsGroupRow(i)) //set first row of group selected
 | |
|                 {
 | |
|                     j = gridView1.GetChildRowHandle(i, 0); 
 | |
|                 }
 | |
| 
 | |
| 
 | |
|                 DataRow dr = dt.Rows[j];
 | |
|                 try
 | |
|                 {
 | |
|                     subBoxCnt += Convert.ToInt32(dr["boxCnt"].ToString());
 | |
|                 }
 | |
|                 catch { }
 | |
|                 try
 | |
|                 {
 | |
|                     bulksBoxCnt += Convert.ToInt32(dr["bulkBox"].ToString());
 | |
| 
 | |
|                 }
 | |
|                 catch { }
 | |
|                 try
 | |
|                 {
 | |
|                     bulkBagCnt += Convert.ToInt32(dr["bulkBag"].ToString());
 | |
|                 }
 | |
|                 catch { }
 | |
|                 try
 | |
|                 {
 | |
|                     vol += Convert.ToDecimal(dr["sumVol"].ToString());
 | |
| 
 | |
|                 }
 | |
|                 catch
 | |
|                 {
 | |
|                 }
 | |
|                 try
 | |
|                 {
 | |
|                     weight += Convert.ToDecimal(dr["sumWeight"].ToString()); 
 | |
| 
 | |
|                 }
 | |
|                 catch
 | |
|                 {
 | |
|                 }
 | |
|                 
 | |
|             }
 | |
| 
 | |
|             /*
 | |
|             foreach (DataRowView dr in selectedRows)
 | |
|             {
 | |
|                 //  DataRow currentRow = dt.Rows[i]; 
 | |
|                   subBoxCnt +=  Convert.ToInt32(dr["boxCnt"].ToString());
 | |
|                   bulksBoxCnt = Convert.ToInt32(dr["bulkBox"].ToString());
 | |
|                   bulkBagCnt = Convert.ToInt32(dr["bulkBag"].ToString());
 | |
|                   vol = Convert.ToDecimal(dr["sumVol"].ToString());
 | |
|                   weight = Convert.ToDecimal(dr["sumWeight"].ToString()); 
 | |
| 
 | |
|             }
 | |
|             */
 | |
| 
 | |
| 
 | |
|             lbsubBoxcnt.Text = subBoxCnt+"";
 | |
|             lbsubBulkBags.Text = bulkBagCnt + "";
 | |
|             lbsubBulkBoxCnt.Text = bulksBoxCnt + "";
 | |
|          //   lbsubCustCnt.Text = selectedRows.Count + "";
 | |
| 
 | |
|             lbsubVol.Text = vol + "";
 | |
|             lbsubWeight.Text = weight + "";
 | |
| 
 | |
| 
 | |
| 
 | |
|         }
 | |
| 
 | |
|         private bool getCurrentObjects()
 | |
|         {
 | |
|             // 
 | |
| 
 | |
|             /*
 | |
|              * IList<Object> selectedRows = (IList<Object>)GetGridViewFilteredAndSortedData(gridView1);
 | |
| 
 | |
| 
 | |
|             selectedPickOrders = new List<String>();
 | |
|             foreach (DataRowView  dr in selectedRows)
 | |
|             {
 | |
|                 //  DataRow currentRow = dt.Rows[i];
 | |
|                 selectedPickOrders.Add(dr["pickOrderNo"].ToString());
 | |
|                  
 | |
| 
 | |
|             }
 | |
| 
 | |
|             */
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|             int[] selectedRows = gridView1.GetSelectedRows();
 | |
|             selectedPickOrders = new List<String>();
 | |
|             int j = 0;
 | |
| 
 | |
|             foreach (int i in selectedRows)
 | |
|             {
 | |
|                 j = i;
 | |
|                 if (gridView1.IsGroupRow(i)) //set first row of group selected
 | |
|                 {
 | |
|                     j = gridView1.GetChildRowHandle(i, 0);
 | |
|                 }
 | |
| 
 | |
|                 DataRow currentRow = dt.Rows[j];
 | |
| 
 | |
|                 try
 | |
|                 {
 | |
|                   
 | |
|                     enumOutStockRequestStatus ost = (enumOutStockRequestStatus)Convert.ToInt32(dt.Rows[j]["state"].ToString());
 | |
| 
 | |
|                     if (ost == enumOutStockRequestStatus.集货完成)
 | |
|                     {
 | |
|                         selectedPickOrders.Add(dt.Rows[j]["pickOrderNo"].ToString());
 | |
|                     }
 | |
|                 }catch {
 | |
|                 }
 | |
|                 lineId = string.IsNullOrEmpty(dt.Rows[j]["lineId"].ToString()) ? 0 : Convert.ToInt32(dt.Rows[j]["lineId"].ToString().Trim());
 | |
|             }
 | |
| 
 | |
| 
 | |
|             if (selectedPickOrders.Count == 0)
 | |
|             {
 | |
|                 showErrorMsg("请选择集货完成待运输的订单");
 | |
|                 return false;
 | |
|             }
 | |
|             return true;
 | |
| 
 | |
|         }
 | |
|  
 | |
|         private void btnNewTrans_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             if (!getCurrentObjects())
 | |
|             {
 | |
|                 return;
 | |
|             }
 | |
|             string viechleNo = "";
 | |
|             string orderNo = "";
 | |
|             int tranType =(int)enumTranType.自营配送;
 | |
|             int driver = 0;
 | |
|           
 | |
|           //  int status = (int)enumTranStatus.装车启运;
 | |
|             string contact = "";
 | |
|             string phone = "";
 | |
|             int thirdPart = 0;
 | |
|             if (activeTabIndex ==0 )
 | |
|             {
 | |
|                 if (string.IsNullOrEmpty(comViechles.Text))
 | |
|                 {
 | |
|                     MessageBox.Show("请选择车辆");
 | |
|                     return;
 | |
|                 }
 | |
|                 viechleNo = comViechles.Text;
 | |
| 
 | |
|             }
 | |
|             else if (activeTabIndex == 1)
 | |
|             {
 | |
|                 if (string.IsNullOrEmpty(txtTransOrderNo.Text.Trim()))
 | |
|                 {
 | |
|                     MessageBox.Show("请填写物流单号");
 | |
|                     return;
 | |
|                 }
 | |
|                 orderNo = txtTransOrderNo.Text.Trim();
 | |
|                 tranType =(int)enumTranType.第三方物流;
 | |
|                 thirdPart = ((Node)(this.comThird.SelectedItem)).ID;
 | |
| 
 | |
|             }
 | |
|             else if (activeTabIndex == 2)
 | |
|             {
 | |
|                 if (string.IsNullOrEmpty(txtOwner.Text.Trim()))
 | |
|                 {
 | |
|                     MessageBox.Show("请填写物流单号");
 | |
|                     return;
 | |
|                 }
 | |
|                contact = txtOwner.Text;
 | |
|                phone = txtphone.Text;
 | |
|                 orderNo = txtTransOrderNo.Text.Trim();
 | |
|                 tranType = (int)enumTranType.自提;
 | |
|                 //status = (int)enumTranStatus.配送结束;
 | |
|             }
 | |
|             string mem = memoEdit1.Text.Trim();
 | |
|             if (mem.Length > 200)
 | |
|             {
 | |
|                 mem = mem.Substring(0, 200);
 | |
|             }
 | |
|              
 | |
|            
 | |
|             wcfTranRequest tmsTran = new wcfTranRequest();
 | |
| 
 | |
| 
 | |
|             tmsTran.boxCnt = subBoxCnt;
 | |
|             tmsTran.bulkBag = bulkBagCnt;
 | |
|             tmsTran.bulkBox = bulksBoxCnt;
 | |
|             tmsTran.contact = contact;
 | |
| 
 | |
|             tmsTran.description = mem;
 | |
|             tmsTran.driver = driver;
 | |
|           
 | |
|             tmsTran.lineId = lineId;
 | |
| 
 | |
|             tmsTran.phone = phone; 
 | |
|             tmsTran.sumVol = vol;
 | |
|             tmsTran.sumWeight = weight;
 | |
|             tmsTran.thirdPart = thirdPart;
 | |
|             tmsTran.transNo = orderNo;
 | |
| 
 | |
|             tmsTran.tranType = tranType;
 | |
| 
 | |
|             tmsTran.viechleNo = viechleNo;
 | |
|              
 | |
|             showWaitForm();
 | |
|             try
 | |
|             {
 | |
|               //string result =  tmsClient.creatTrans(selectedPickOrders.ToArray(), orderNo,thirdPart, status, lineId, viechleNo, tranType, driver, contact, phone, mem);
 | |
| 
 | |
|                 string result = tmsClient.creatTrans(selectedPickOrders.ToArray(), tmsTran);
 | |
| 
 | |
|                 closeClient();
 | |
|               closeWaitForm();
 | |
|               MessageBox.Show(result);
 | |
| 
 | |
|               comViechles.Text = 
 | |
|               txtOwner.Text=
 | |
|               txtphone.Text=
 | |
|               txtTransOrderNo.Text ="";
 | |
| 
 | |
| 
 | |
| 
 | |
|             }
 | |
|             catch (Exception er)
 | |
|             {
 | |
|                 showErrorMsg(er.Message);
 | |
|             } 
 | |
|             closeClient();
 | |
|             query();                
 | |
|             bindLookup();
 | |
|           
 | |
|             closeWaitForm();
 | |
| 
 | |
|         }
 | |
| 
 | |
|         List<string> selectedPickOrders { get; set; }
 | |
|         int activeTabIndex = 0;
 | |
|         private void layoutControlGroup8_Shown(object sender, EventArgs e)
 | |
|         {
 | |
|             activeTabIndex = 0;
 | |
|               
 | |
|         }
 | |
| 
 | |
|         private void layoutControlGroup7_Shown(object sender, EventArgs e)
 | |
|         {
 | |
|             activeTabIndex =1;
 | |
|         }
 | |
| 
 | |
|         private void layoutControlGroup9_Shown(object sender, EventArgs e)
 | |
|         {
 | |
|             activeTabIndex =2;
 | |
|         }
 | |
| 
 | |
|         private void CreateTransForm_Load(object sender, EventArgs e)
 | |
|         {
 | |
| 
 | |
|         }
 | |
| 
 | |
|         private void simpleButton1_Click(object sender, EventArgs e)
 | |
|         {
 | |
| 
 | |
|         }
 | |
|  
 | |
| 
 | |
|     }
 | |
| } |