2300 lines
		
	
	
		
			79 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			2300 lines
		
	
	
		
			79 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.utils.print;
 | |
| //using DeiNiu.wms.win.ServiceReferenceInRequest; 
 | |
| //using DeiNiu.wms.win.ServiceReferenceInRequestLocal;
 | |
|  using DeiNiu.wms.win.ServiceReferenceStockInRequest;//debug 
 | |
| using System.ServiceModel;
 | |
| using DNLightSvr;
 | |
| using System.ServiceModel.Description;
 | |
| 
 | |
| namespace DeiNiu.wms.win
 | |
| {
 | |
|     public partial class GoodsPreReceiveMultiDetails : BasicRibbonForm
 | |
|     {
 | |
| 
 | |
|          
 | |
|         printIn reportPrint = new printIn() ;
 | |
| 
 | |
|       //  lWmsStock ls = new lWmsStock();
 | |
|       //  lWmsInRequest lgt = new lWmsInRequest();
 | |
|         private string fieldName = WmsLocation.fields.locationId.ToString();
 | |
|         private string fieldGoodType = WmsLocation.fields.whGoodsType.ToString();
 | |
|         private string lastQuery = "";
 | |
|         private DataTable dt;
 | |
|         private DataTable dtship;
 | |
|       //  DataTable dtIndetail;
 | |
|         private int selectedRowIndex = -1;
 | |
|         private Erp_purch selectedRequest;
 | |
|         private bool isShowingInRequest = true;
 | |
| 
 | |
|         int shipid;
 | |
|         public GoodsPreReceiveMultiDetails()
 | |
|         {
 | |
|          
 | |
|             InitializeComponent();
 | |
| 
 | |
|             try
 | |
|             {
 | |
|                 initialControls();
 | |
|             }
 | |
|             catch (Exception er)
 | |
|             {
 | |
|                 showErrorMsg(er);
 | |
|             }
 | |
|             layoutControlGroup6.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; 
 | |
| #if DEBUG 
 | |
|         layoutControlGroup6.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
 | |
| #endif
 | |
| 
 | |
|         }
 | |
|         #region initialControls
 | |
|         private void initialControls()
 | |
|         {
 | |
|             setDatePiker(dateEditFrom, dateEditTo);
 | |
|             initialComboBoxes();
 | |
|             initialPagerControls();
 | |
|             initialDataGrid();
 | |
|             initialQueryInput(); 
 | |
|             setValidationRule();
 | |
|             //   textEditBarcode.GotFocus += new EventHandler(textEditBarcode_GotFocus);
 | |
|             //    textEditBarcode.MouseUp += new MouseEventHandler(textEditBarcode_MouseUp);
 | |
| 
 | |
|             startHost();
 | |
|         }
 | |
|         private void initialComboBoxes()
 | |
|         {
 | |
|             this.comboState.Properties.TextEditStyle = TextEditStyles.DisableTextEditor;
 | |
|              
 | |
|             Dictionary<int, string> dic = Utils.Util.convertEnumToDic(typeof(enumInStockOrderStatus));
 | |
|             dic.Remove((int)enumInStockOrderStatus.订单明细日期错误);
 | |
|             dic.Remove((int)enumInStockOrderStatus.待上架);
 | |
|             dic.Remove((int)enumInStockOrderStatus.货位不足);
 | |
|             dic.Remove((int)enumInStockOrderStatus.已入库);
 | |
|             initialComboBoxs(comboState, dic,true); //默认选待收货状态
 | |
|             comboState.SelectedIndex = dic.Count > 0 ? 1 : 0;
 | |
| 
 | |
|             /*
 | |
|             Node[] nds = { };
 | |
|             DataRow[] drs = Park.getDictionary(true).Select("flag >0");
 | |
|             foreach (DataRow dr in drs)
 | |
|             {
 | |
|                 int flag = Convert.ToInt32(dr["flag"].ToString());
 | |
|                 int parentId = Convert.ToInt32(dr["id"].ToString());
 | |
|                 DataRow[] drss = Park.getDictionary(false).Select("parentId =" + parentId);
 | |
|                 switch (flag)
 | |
|                 {
 | |
|                     case 2017:
 | |
|                       //  initialComboBoxs(this.combCache, drss,false); //缓存分区
 | |
|                         break; 
 | |
| 
 | |
|                 } 
 | |
|             }*/
 | |
| 
 | |
|         }
 | |
|       
 | |
|         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(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;
 | |
|             gridView.Columns.Add(myCol0);
 | |
| 
 | |
| 
 | |
|             if (gridView == gridView1)
 | |
|             {
 | |
|                 GridColumn myCol1 = new GridColumn() { Caption = "计划单号", Visible = true, FieldName = Erp_purch.fields.pur_order.ToString() };
 | |
|                 GridColumn myCol2 = new GridColumn() { Caption = "订单类别", Visible = true, FieldName = Erp_purch.fields.order_typeName.ToString() };
 | |
|                 GridColumn myCol3 = new GridColumn() { Caption = "供货商编码", Visible = true, FieldName = "vender" };
 | |
|                 GridColumn myCol4 = new GridColumn() { Caption = "货主", Visible = true, FieldName = WmsInRequest.fields.owner.ToString() };
 | |
|                 GridColumn myCol5 = new GridColumn() { Caption = "备注", Visible = true, FieldName = WmsInRequest.fields.description.ToString() };
 | |
|                 GridColumn myCol6 = new GridColumn() { Caption = "订单日期", Visible = true, FieldName =  "createtime"  };
 | |
|                 GridColumn myCol7 = new GridColumn() { Caption = "状态", Visible = true, FieldName = Erp_purch.fields.wms_state.ToString(),MinWidth=100 };
 | |
|                 GridColumn myCol8 = new GridColumn() { Caption = "供货商", Visible = true, FieldName = "venderName"};
 | |
|                  
 | |
|                 gridView.Columns.Add(myCol8);
 | |
|          
 | |
|               
 | |
|                 gridView.Columns.Add(myCol7);
 | |
|                 gridView.Columns.Add(myCol6);
 | |
|                 gridView.Columns.Add(myCol1);
 | |
|                 gridView1.Columns.Add(myCol2);
 | |
|                 gridView.Columns.Add(myCol3);
 | |
|                 gridView.Columns.Add(myCol5);
 | |
|             }
 | |
|            /* else if (gridView == gridviewShip)
 | |
|             {
 | |
|                 setupGridView(gridView, false, false);
 | |
|                 GridColumn myCol12 = new GridColumn() { Caption = "运输单号", Visible = true, FieldName = Erp_purch_ship.fields.shipOrder.ToString() };
 | |
|                 GridColumn myCol13 = new GridColumn() { Caption = "车辆牌号", Visible = true, FieldName = Erp_purch_ship.fields.veNumber.ToString() };
 | |
|                 GridColumn myCol14 = new GridColumn() { Caption = "箱内温度", Visible = true, FieldName = Erp_purch_ship.fields.temperature.ToString() };
 | |
|                 GridColumn myCol15 = new GridColumn() { Caption = "送货电话", Visible = true, FieldName = Erp_purch_ship.fields.driverPhone.ToString() };
 | |
|                 GridColumn myCol16 = new GridColumn() { Caption = "送货公司", Visible = true, FieldName = Erp_purch_ship.fields.company.ToString() };
 | |
|                 GridColumn myCol18 = new GridColumn() { Caption = "送货人", Visible = true, FieldName = Erp_purch_ship.fields.driverName.ToString() };
 | |
|                 GridColumn myCol20 = new GridColumn() { Caption = "送货备注", Visible = true, FieldName = Erp_purch_ship.fields.remark.ToString() };
 | |
|                  
 | |
|                 gridView.Columns.Add(myCol12);
 | |
|                 gridView.Columns.Add(myCol13);
 | |
|                 gridView1.Columns.Add(myCol18);
 | |
|                 gridView.Columns.Add(myCol16);
 | |
|                 gridView.Columns.Add(myCol15);
 | |
|                 gridView.Columns.Add(myCol14);
 | |
|                 gridView1.Columns.Add(myCol20);
 | |
|             }
 | |
|             */
 | |
| 
 | |
| 
 | |
|          //   this.gridView1.Columns.Add(myCol4);
 | |
|         
 | |
|            
 | |
|             //to show bottom scroll bar
 | |
|             gridView.OptionsView.ColumnAutoWidth = false;
 | |
|             gridView.BestFitColumns();
 | |
|            // gridView.Focus();
 | |
| 
 | |
|             //if (gridView1 == gridView)
 | |
|             //{
 | |
|             //    this.gridView1.Focus(); ;
 | |
|             //}
 | |
| 
 | |
| 
 | |
|         //    initialGridView2Columns();
 | |
|         //    gridControl2.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 = Erp_purch_d.fields.goods_id.ToString() };
 | |
|             GridColumn myCol2 = new GridColumn() { Caption = "商品名称", Visible = true, FieldName = "goodsName"};
 | |
|             GridColumn myCol3 = new GridColumn() { Caption = "厂家", Visible = true, FieldName ="manufacturer"};
 | |
|             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 myCol13 = new GridColumn() { Caption = "订单数量", Visible = true, FieldName = Erp_purch_d.fields.count.ToString() };
 | |
|             GridColumn myCol132 = new GridColumn() { Caption = "应收数量", Visible = true, FieldName = "count1" };
 | |
| 
 | |
|          //   GridColumn myCol131 = new GridColumn() { Caption = "收货数量", Visible = true, FieldName = Erp_purch_d.fields.receiveCount.ToString() };
 | |
|             GridColumn myCol133 = new GridColumn() { Caption = "拒收数量", Visible = true, FieldName = Erp_purch_d.fields.rejectCount.ToString() };
 | |
|             GridColumn myCol134 = new GridColumn() { Caption = "到货数量", Visible = true, FieldName = Erp_purch_d.fields.arriveCount.ToString() };
 | |
|             GridColumn myCol1342= new GridColumn() { Caption = "条码", Visible = true, FieldName = "barCode" };
 | |
|             GridColumn myCol1341 = new GridColumn() { Caption = "到货数量", Visible = true, FieldName = "newArriveCount" };
 | |
|             GridColumn myCol1343 = new GridColumn() { Caption = "收货数量", Visible = true, FieldName = "newReceiveCount" }; 
 | |
|             GridColumn myCol1344 = new GridColumn() { Caption = "验收数量", Visible = true, FieldName = "valid_count" };
 | |
|             GridColumn myCol1345= new GridColumn() { Caption = "上架数量", Visible = true, FieldName = "upShelfCount" };
 | |
|            
 | |
|            
 | |
|           
 | |
|          
 | |
| 
 | |
|           //  GridColumn myCol14 = new GridColumn() { Caption = "批号", Visible = true, FieldName = WmsInRequestDetail.fields.batch.ToString() };
 | |
|          //   GridColumn myCol15 = new GridColumn() { Caption = "生产日期", Visible = true, FieldName = WmsInRequestDetail.fields.productDate.ToString() };
 | |
|          //   GridColumn myCol16 = new GridColumn() { Caption = "有效期", Visible = true, FieldName = WmsInRequestDetail.fields.validDate.ToString() };
 | |
| 
 | |
|             GridColumn myCol17 = new GridColumn() { Caption = "状态", Visible = true, FieldName = "wms_state",MinWidth=120};
 | |
|             GridColumn myCol18 = new GridColumn() { Caption = "说明", Visible = true, FieldName = Erp_purch_d.fields.receiveRemark.ToString() };
 | |
|            
 | |
|         //    GridColumn myCol19 = new GridColumn() { Caption = "货位", Visible = true, FieldName = WmsOutPickLable.fields.locationId.ToString() };
 | |
|         //    GridColumn myCol20 = new GridColumn() { Caption = "入库数量", Visible = true, FieldName = WmsOutPickLable.fields.count.ToString() };
 | |
|         //    GridColumn myCol21 = new GridColumn() { Caption = "上架数量", Visible = true, FieldName = WmsInUpPort.fields.upCount.ToString() };
 | |
|         //    GridColumn myCol22 = new GridColumn() { Caption = "上架说明", Visible = true, FieldName =  WmsInUpPort.fields.description.ToString() };
 | |
|       //      GridColumn myCol23 = new GridColumn() { Caption = "ABC", Visible = true, FieldName = "goodsABC" };
 | |
|       //      GridColumn myCol24 = new GridColumn() { Caption = "箱", Visible = true, FieldName = "box" };
 | |
|               GridColumn myCol25 = new GridColumn() { Caption = "操作人", Visible = true, FieldName = "validByName" };
 | |
|              GridColumn myCol26 = new GridColumn() { Caption = "到货时间", Visible = true, FieldName = "validbyTime" ,MinWidth=120};
 | |
|              GridColumn myCol27 = new GridColumn() { Caption = "需质检", Visible = true, FieldName = WmsGoods.exfields.isQc.ToString() };
 | |
|              GridColumn myCol28 = new GridColumn() { Caption = "直通商品", Visible = true, FieldName = WmsGoods.exfields.isZhitong.ToString() };
 | |
|              GridColumn myCol29 = new GridColumn() { Caption = "销售订单", Visible = true, FieldName = Erp_purch_d.fields.custPoNo.ToString() };
 | |
|              GridColumn myCol30 = new GridColumn() { Caption = "销售数量", Visible = true, FieldName = Erp_purch_d.fields.custQty.ToString() };
 | |
|              GridColumn myCol31 = new GridColumn() { Caption = "销售客户", Visible = true, FieldName = "custName" };
 | |
|              GridColumn myCol32 = new GridColumn() { Caption = "到货通知单", Visible = true, FieldName = "preInOrderNo" };
 | |
|              GridColumn myCol33 = new GridColumn() { Caption = "双人验收", Visible = true, FieldName = "isDouChk" };
 | |
|             GridColumn myCol34 = new GridColumn() { Caption = "直通商品", Visible = true, FieldName = "isZhitong" };
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|             if (gridview == gridviewRecs)
 | |
| 
 | |
|             {   
 | |
|                 gridview.Columns.Add(myCol2); 
 | |
|                 gridview.Columns.Add(myCol25);
 | |
|                 gridview.Columns.Add(myCol26);
 | |
|               
 | |
|             
 | |
|                
 | |
|                 gridview.Columns.Add(myCol34); 
 | |
|                 gridview.Columns.Add(myCol1);
 | |
| 
 | |
|              //   gridview.Columns.Add(myCol1341);
 | |
|              // gridview.Columns.Add(myCol1343);
 | |
|                 gridview.Columns.Add(myCol1344);
 | |
|                 gridview.Columns.Add(myCol1345);
 | |
| 
 | |
|                 gridview.Columns.Add(myCol5);
 | |
|                 gridview.Columns.Add(myCol3);
 | |
|                
 | |
|                 gridview.Columns.Add(myCol6);
 | |
|                 gridview.Columns.Add(myCol4);
 | |
|                 gridview.Columns.Add(myCol7);
 | |
|                 gridview.Columns.Add(myCol12);
 | |
|                 gridview.Columns.Add(myCol18);
 | |
|                gridview.Columns.Add(myCol32);
 | |
| 
 | |
|             }
 | |
|             else if (gridview == gridView3)
 | |
|             {
 | |
|         
 | |
|            
 | |
|              //  gridview.Columns.Add(myCol32); 
 | |
|                 gridview.Columns.Add(myCol2);
 | |
|                 gridview.Columns.Add(myCol1341);
 | |
|                 gridview.Columns.Add(myCol1342);
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 gridview.Columns.Add(myCol2);
 | |
|                     gridview.Columns.Add(myCol17);
 | |
|                     //    gridview.Columns.Add(myCol14);
 | |
|                     gridview.Columns.Add(myCol13);
 | |
|                     gridview.Columns.Add(myCol132);
 | |
|                   
 | |
|                    // gridview.Columns.Add(myCol131);
 | |
| 
 | |
|                    // gridview.Columns.Add(myCol133);
 | |
|                     //    gridview.Columns.Add(myCol23);
 | |
|                     gridview.Columns.Add(myCol5);
 | |
| 
 | |
|                     gridview.Columns.Add(myCol27);
 | |
|                     gridview.Columns.Add(myCol33); 
 | |
|                     gridview.Columns.Add(myCol28);
 | |
|                     gridview.Columns.Add(myCol29);
 | |
|                     gridview.Columns.Add(myCol30);
 | |
|                     gridview.Columns.Add(myCol31);
 | |
|                     gridview.Columns.Add(myCol3);
 | |
|                     gridview.Columns.Add(myCol3);
 | |
|                    
 | |
|                     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();
 | |
|         }
 | |
|         
 | |
|         #endregion
 | |
| 
 | |
| 
 | |
|         private void initialRequestOrders()
 | |
|         {
 | |
|             showWaitForm();
 | |
|             try{
 | |
|                 //inClient.getInRequests();
 | |
|                // getInValidOrders();
 | |
|             }
 | |
|             //catch (DeiNiuTimeOutException te)
 | |
|             //{
 | |
|             //     
 | |
|             //}
 | |
|             catch(Exception e){
 | |
|                 showErrorMsg(e.Message);
 | |
|                 }
 | |
|             finally{
 | |
|                 closeWaitForm();
 | |
|             }
 | |
|           
 | |
|         }
 | |
| 
 | |
|         /// <summary>  
 | |
|         /// loading data
 | |
|         /// </summary>  
 | |
|         private int loadData()
 | |
|         {
 | |
|             if (this.txtVender.Text.Trim().Length == 0)
 | |
|             {
 | |
|               //  return 0;
 | |
|             }
 | |
|             //this.gridviewGoodsType.DataSource = lgt.GetAllActiveData().Tables[0].DefaultView;
 | |
|             showWaitForm();
 | |
|             lbVender.Text = "";
 | |
|          //   lbOrderNo.Text = "";
 | |
|             clearShipInfo();
 | |
|             try
 | |
|             {
 | |
|                 // this.splashScreenManager1.ShowWaitForm();
 | |
|                 string query = (this.txtOrderNo.Text.Trim().Length == 0 ? "" : string.Format("{0} =#'{1}';", "pur_order", filtRiskChar(txtOrderNo.Text.Trim())));
 | |
|                 query = !string.IsNullOrEmpty(query) ? query :  (this.txtOrderNo.Text.Trim().Length == 0 ? "" : string.Format("{0} =#'{1}';", WmsInRequest.fields.preInOrder.ToString(), filtRiskChar(txtOrderNo.Text.Trim())))
 | |
|                              //  + (this.txtVender.Text.Trim().Length == 0 ? "" : string.Format("{0} like # '%{1}%';", "venderName", filtRiskChar(txtVender.Text.Trim())))
 | |
|                                + (this.txtVender.Text.Trim().Length == 0 ? "" : string.Format("{0} = # '{1}';", "vender", filtRiskChar(txtVender.Text.Trim())))
 | |
|                                + (this.txtVenderName.Text.Trim().Length == 0 ? "" : string.Format("{0} like # '%{1}%';", "venderName", filtRiskChar(txtVenderName.Text.Trim())))
 | |
|                                + (this.dateEditFrom.Text.Trim().Length == 0 ? "" : string.Format("{0} >= # '{1}';" ,"createtime",   dateEditFrom.DateTime ))
 | |
|                                + (this.dateEditTo.Text.Trim().Length == 0 ? "" : string.Format("{0} <= # '{1}';", "createtime", dateEditTo.DateTime))
 | |
|                                + (this.comboState.SelectedIndex <=0 ? "" : string.Format("{0} = #{1};", Erp_purch.fields.wms_state.ToString(), ((Colitem)this.comboState.SelectedItem).key));
 | |
|                 //    、、  + (this.txtGoodName.Text.Trim().Length == 0 ? "" : string.Format("{0} like # '%{1}%';", WmsInRequest.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 = inClient.queryReceives(query, start, end);// lgt.Query(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["ID"] };
 | |
|                 bool firstLoad = !isQueryNotChanged || this.gridControl1.DataSource == null;
 | |
|                 this.gridControl1.DataSource = dt.DefaultView;
 | |
|                 initialDataGridColumns(gridView1);
 | |
|                 //update selected row index to the last updated one.
 | |
|                
 | |
|                 if (selectedRequest !=null)
 | |
|                 {
 | |
|                     selectedRowIndex = -1;
 | |
|                     DataRow dr = dt.Rows.Find(selectedRequest.ID);
 | |
|                     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)
 | |
|                 {
 | |
|                     selectedRowIndex = 0;
 | |
|                     gridView1.FocusedRowHandle = 0;
 | |
|                     gridView1.SelectRow(0);
 | |
|                     
 | |
|                 }
 | |
|                 setCurrentRequestDetail();
 | |
|                 closeWaitForm();
 | |
|                 return cnt;
 | |
|             }
 | |
|             catch (Exception e)
 | |
|             {
 | |
|                 showErrorMsg(e,e.Message);
 | |
|             }
 | |
| 
 | |
|             closeWaitForm();
 | |
|             return 0;// lgt.getRowCount(query);
 | |
|             // return lgt.GetGoodType.QueryCount(); 
 | |
| 
 | |
|         }
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|          
 | |
|         private void bindDetail()
 | |
|         {
 | |
| 
 | |
|         }
 | |
|         private void setDataBack()
 | |
|         {
 | |
| 
 | |
| 
 | |
|         }
 | |
|         private bool validData()
 | |
|         {
 | |
|             bool isvalid = dxValidationProvider1.Validate();
 | |
| 
 | |
|             // MessageBox.Show("goodtype is " + txtGoodType.Text +", is valid ? " + isvalid);
 | |
| 
 | |
|             return isvalid;
 | |
|             //String gdtype = txtGoodType.Text.Trim();
 | |
|             //if (gdtype.Length == 0)
 | |
|             //{
 | |
| 
 | |
|             //    dxValidationProvider.Validate();
 | |
|             //    return false;
 | |
|             //} 
 | |
| 
 | |
|             //return true;
 | |
|         }
 | |
|          
 | |
|        
 | |
| 
 | |
|         /// <summary>  
 | |
|         /// 分页控件产生的事件  
 | |
|         /// </summary>  
 | |
|         private int pager_EventPaging(DeiNiu.Controls.pager.EventPagingArg e)
 | |
|         {
 | |
|             selectedRowIndex = -1; //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
 | |
| 
 | |
|         }
 | |
| 
 | |
|         bool isCheckedIn = false;
 | |
|         private void gridView1_FocusedRowObjectChanged(object sender, FocusedRowObjectChangedEventArgs e)
 | |
|         {
 | |
|             if (gridView1.FocusedRowHandle < 0 || gridView1.FocusedRowHandle == selectedRowIndex || gridView1.FocusedRowHandle==0 && isCheckedIn)
 | |
|             {
 | |
|                 isCheckedIn = gridView1.FocusedRowHandle > 0;
 | |
|                 if (gridView1.IsGroupRow(e.RowHandle)) //set first row of group selected
 | |
|                 {
 | |
|                     selectedRowIndex = gridView1.GetChildRowHandle(e.RowHandle, 0);
 | |
|                     setCurrentRequestDetail();
 | |
|                 }
 | |
|                 if (isCheckedIn)
 | |
|                 {
 | |
|                     isCheckedIn = false;
 | |
|                 }
 | |
|                     return;
 | |
|                 
 | |
|             }
 | |
|             selectedRowIndex = gridView1.FocusedRowHandle;
 | |
|             // showErrorMsg("selection:"+ selectedRowIndex);
 | |
|             setCurrentRequestDetail();
 | |
|             
 | |
|         }
 | |
| 
 | |
|         private void clearInputs()
 | |
|         {
 | |
| 
 | |
|         }
 | |
| 
 | |
|         
 | |
|         private void gridView1_DataSourceChanged(object sender, EventArgs e)
 | |
|         {
 | |
|             if (selectedRowIndex >= 0 && dt.Rows.Count > selectedRowIndex)
 | |
|             {
 | |
|                 gridView1.FocusedRowHandle = selectedRowIndex;
 | |
|                 gridView1.MakeRowVisible(selectedRowIndex);
 | |
| 
 | |
|             }
 | |
|         }
 | |
| 
 | |
| 
 | |
|        
 | |
|         //to show in detail
 | |
|         int selectedInIndex = -1;
 | |
|         string goodsName;
 | |
|         int selectedPdId;
 | |
|         int selectedPurDetailId = -1;
 | |
|         Erp_purch_d currentDetail = null;
 | |
|         private void gridView2_FocusedRowObjectChanged(object sender, FocusedRowObjectChangedEventArgs e)
 | |
|         {
 | |
|             if (!isShowingInRequest)
 | |
|             {
 | |
|                 return;
 | |
|             }
 | |
| 
 | |
|             if (gridView2.FocusedRowHandle < 0 || gridView2.FocusedRowHandle == selectedInIndex)
 | |
|             {
 | |
|                 if (gridView2.IsGroupRow(e.RowHandle)) //set first row of group selected
 | |
|                 {
 | |
|                     selectedInIndex = gridView2.GetChildRowHandle(e.RowHandle, 0);
 | |
|                     setCurrentInDetail();
 | |
|                 }
 | |
| 
 | |
|                 return;
 | |
| 
 | |
|             }
 | |
|             selectedInIndex = gridView2.FocusedRowHandle;
 | |
|             // showErrorMsg("selection:"+ selectedRowIndex);
 | |
|             setCurrentInDetail();
 | |
| 
 | |
|         }
 | |
| 
 | |
| 
 | |
| 
 | |
|         private void gridView2_DataSourceChanged(object sender, EventArgs e)
 | |
|         {
 | |
|             if (!isShowingInRequest)
 | |
|             {
 | |
|                 return;
 | |
|             }
 | |
| 
 | |
|             if (selectedInIndex >= 0)// && dtIndetail.Rows.Count > selectedInIndex)
 | |
|             {
 | |
|                 gridView2.FocusedRowHandle = selectedInIndex;
 | |
|                 gridView2.MakeRowVisible(selectedInIndex);
 | |
| 
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         private bool getCurrentInObject()
 | |
|         {/*
 | |
|             if (!isShowingInRequest)
 | |
|             {
 | |
|                 return false;
 | |
|             }
 | |
|             */
 | |
|             if (selectedInIndex < 0)// || selectedInIndex >= dtIndetail.Rows.Count)
 | |
|             {
 | |
|                 return false;
 | |
|             }
 | |
| 
 | |
|             //  DataRow currentRow = dt.Rows[selectedRowIndex];
 | |
|             DataRowView dr = (DataRowView)(GetGridViewFilteredAndSortedData(gridView2)[selectedInIndex]);
 | |
|             goodsName = dr["GoodsName"].ToString();
 | |
|             selectedPdId = Convert.ToInt32(dr["id"].ToString());
 | |
|             currentDetail = new Erp_purch_d(dr.Row);
 | |
| 
 | |
|             return true;
 | |
| 
 | |
|         }
 | |
|         private void setCurrentInDetail()
 | |
|         {
 | |
| 
 | |
|             if (!getCurrentInObject() || string.IsNullOrEmpty( goodsName))
 | |
|             {
 | |
|                 return;
 | |
|             }
 | |
|             /// gridView1.FocusedRowHandle = selectedRowIndex;//
 | |
|             //  gridView1.SelectRow(selectedRowIndex);
 | |
|             showWaitForm();
 | |
| 
 | |
|             try
 | |
|             {
 | |
|                 lbPGoodsName.Text = goodsName;
 | |
|                 txtArrave.Text = currentDetail.count - currentDetail.receiveCount - currentDetail.rejectCount + "";
 | |
|                 
 | |
|             }
 | |
|             catch (Exception e)
 | |
|             {
 | |
|                 showErrorMsg(e.Message);
 | |
|             }
 | |
|             closeWaitForm();
 | |
|         }
 | |
| 
 | |
| 
 | |
|         int selectedInShipId = 0;
 | |
|         int selectedShipIndex;
 | |
|         string shipDate;
 | |
|        
 | |
|         string selectedShipDriver = "";
 | |
|         /*  
 | |
|         private void gridViewship_FocusedRowObjectChanged(object sender, FocusedRowObjectChangedEventArgs e)
 | |
|         {
 | |
| 
 | |
| 
 | |
|             if (gridviewShip.FocusedRowHandle < 0 || gridviewShip.FocusedRowHandle == selectedShipIndex)
 | |
|             {
 | |
|                 if (gridviewShip.IsGroupRow(e.RowHandle)) //set first row of group selected
 | |
|                 {
 | |
|                     selectedShipIndex = gridviewShip.GetChildRowHandle(e.RowHandle, 0);
 | |
|                     setCurrentShipDetail();
 | |
|                 }
 | |
| 
 | |
|                 return;
 | |
| 
 | |
|             }
 | |
|             selectedShipIndex = gridviewShip.FocusedRowHandle;
 | |
|             // showErrorMsg("selection:"+ selectedRowIndex);
 | |
|             setCurrentShipDetail();
 | |
| 
 | |
|         }
 | |
|         */
 | |
|        
 | |
|         /*
 | |
|         private void setCurrentShipDetail()
 | |
|         {
 | |
| 
 | |
|             if (!getCurrentShipObject() || selectedInShipId <=0)
 | |
|             {
 | |
|                 return;
 | |
|             }
 | |
|             /// gridView1.FocusedRowHandle = selectedRowIndex;//
 | |
|             //  gridView1.SelectRow(selectedRowIndex);
 | |
|             showWaitForm();
 | |
| 
 | |
|             try
 | |
|             {
 | |
|                // lbPGoodsName.Text = selectedShipDriver; 
 | |
|                 lbShipInfo.Text = string.Format("【运输人】:{0}    【记录时间】:{1}", selectedShipDriver,shipDate);
 | |
|                  
 | |
|             }
 | |
|             catch (Exception e)
 | |
|             {
 | |
|                 showErrorMsg(e.Message);
 | |
|             }
 | |
|             closeWaitForm();
 | |
|         }
 | |
|         
 | |
|         private bool getCurrentShipObject()
 | |
|         {
 | |
|             if (selectedShipIndex < 0)// || selectedInIndex >= dtIndetail.Rows.Count)
 | |
|             {
 | |
|                 return false;
 | |
|             }
 | |
| 
 | |
|             //  DataRow currentRow = dt.Rows[selectedRowIndex];
 | |
|             DataRowView dr = (DataRowView)(GetGridViewFilteredAndSortedData(gridviewShip)[selectedShipIndex]);
 | |
|              selectedShipDriver = dr["driverName"].ToString();
 | |
|              selectedInShipId = Convert.ToInt32(dr["id"].ToString());
 | |
|             shipDate = dr["createtime"].ToString();
 | |
|             return true;
 | |
| 
 | |
|         }
 | |
|          */
 | |
|         private void btnDelete_Click(object sender, EventArgs e)
 | |
|         { 
 | |
| 
 | |
|         }
 | |
| 
 | |
|         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();
 | |
|              
 | |
|             }
 | |
|              
 | |
| 
 | |
|         }
 | |
|         string lastSelectedPurOrder = "";
 | |
|         string fileLocation = "";
 | |
|         private bool getCurrentObject()
 | |
|         {
 | |
|             fileLocation =lastSelectedPurOrder= "";
 | |
|             if (selectedRowIndex <0 || selectedRowIndex >= dt.Rows.Count)
 | |
|             {
 | |
|                 return false;
 | |
|             }
 | |
|            
 | |
|           //  DataRow currentRow = dt.Rows[selectedRowIndex];
 | |
|             DataRowView dr = (DataRowView)(GetGridViewFilteredAndSortedData(gridView1)[selectedRowIndex]);
 | |
| 
 | |
|             lastSelectedPurOrder = selectedRequest ==null? "" : selectedRequest.pur_order;
 | |
|             fileLocation =dr["fileLocation"].ToString();
 | |
|             selectedRequest = new Erp_purch(dr.Row);
 | |
|              
 | |
|             this.gridControl2.DataSource = null;
 | |
|             btnIn.Enabled = false; 
 | |
|             return true;
 | |
| 
 | |
|         }
 | |
| 
 | |
| 
 | |
|        
 | |
| 
 | |
| 
 | |
|         private void btnQuery_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             queryGoods();
 | |
|         }
 | |
| 
 | |
|         private void gridView1_SelectionChanged(object sender, DevExpress.Data.SelectionChangedEventArgs e)
 | |
|         {
 | |
|             if (gridView1.FocusedRowHandle <0 || gridView1.FocusedRowHandle == selectedRowIndex)
 | |
|             {
 | |
|                 return;
 | |
|             }
 | |
|             selectedRowIndex = gridView1.FocusedRowHandle;
 | |
|             // showErrorMsg("selection:"+ selectedRowIndex);
 | |
|             setCurrentRequestDetail();
 | |
|         }
 | |
| 
 | |
|         private void initialDataGrid()
 | |
|         {
 | |
|             gridView1.OptionsSelection.MultiSelect = true;//按shift / control 多选
 | |
|             this.gridView1.OptionsBehavior.AutoPopulateColumns = false;
 | |
|             this.gridView1.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus;
 | |
|             this.gridView1.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.CellFocus;
 | |
|             this.gridView1.OptionsBehavior.Editable = false;
 | |
|             //    this.gridView1.OptionsSelection.EnableAppearanceFocusedCell = false;
 | |
| 
 | |
|             this.gridView1.FocusedRowObjectChanged += new DevExpress.XtraGrid.Views.Base.FocusedRowObjectChangedEventHandler(this.gridView1_FocusedRowObjectChanged);
 | |
|             this.gridView1.DataSourceChanged += new System.EventHandler(this.gridView1_DataSourceChanged);
 | |
| 
 | |
|             //show line number
 | |
|             this.gridView1.IndicatorWidth = 40;
 | |
|             this.gridView1.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler(gridView_CustomDrawRowIndicator);
 | |
|             this.gridView2.IndicatorWidth = 40;
 | |
|             this.gridView2.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler(gridView_CustomDrawRowIndicator);
 | |
|           
 | |
|             gridView2.CustomColumnDisplayText += gridView2_CustomColumnDisplayText;
 | |
|             gridView2.CustomDrawCell += gridView_CustomDrawCell;
 | |
|             gridView2.RowCellStyle += gridView_RowCellStyle;
 | |
|             gridView1.RowCellStyle += gridView_RowCellStyle;
 | |
| 
 | |
|             this.gridView2.FocusedRowObjectChanged += new DevExpress.XtraGrid.Views.Base.FocusedRowObjectChangedEventHandler(this.gridView2_FocusedRowObjectChanged);
 | |
|            // this.gridviewShip.FocusedRowObjectChanged +=
 | |
|            //     new DevExpress.XtraGrid.Views.Base.FocusedRowObjectChangedEventHandler(this.gridViewship_FocusedRowObjectChanged);
 | |
| 
 | |
| 
 | |
|             gridView1.CustomColumnDisplayText += gridView2_CustomColumnDisplayText;
 | |
|             gridView1.CustomDrawCell += gridView_CustomDrawCell;
 | |
| 
 | |
|             this.gridviewRecs.IndicatorWidth = 40;
 | |
|             this.gridviewRecs.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler(gridView_CustomDrawRowIndicator);
 | |
| 
 | |
|             gridviewRecs.CustomColumnDisplayText += gridView2_CustomColumnDisplayText;
 | |
|         }
 | |
|    
 | |
| 
 | |
| 
 | |
| 
 | |
|        private void gridView2_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
 | |
|         {
 | |
| 
 | |
|          //   if (sender == gridView2)
 | |
|             { 
 | |
|                 if (e.Column.FieldName == "wms_state")
 | |
|                 {
 | |
| 
 | |
|                     if (!stockInLocationStatus.ContainsValue(e.DisplayText))
 | |
|                     {
 | |
| 
 | |
|                         int display = -100;
 | |
|                         string disTxt = e.DisplayText;
 | |
| 
 | |
|                         try
 | |
|                         {
 | |
|                             display = Convert.ToInt32(e.DisplayText);
 | |
|                             if (sender == gridView2)
 | |
|                             {
 | |
|                                 e.DisplayText = this.enumReceiveDetailStatus[display];
 | |
|                             }
 | |
|                             else
 | |
|                             {
 | |
|                                 e.DisplayText = this.inRequestStatus[display];
 | |
|                             }
 | |
|                         }
 | |
|                         catch
 | |
|                         {
 | |
|                             return;
 | |
|                         }
 | |
|                     }
 | |
| 
 | |
|                     return;
 | |
|                    // e.DisplayText = stockInLocationStatus.ContainsKey(display) ? stockInLocationStatus[display] : display+"";
 | |
| 
 | |
|                 }else
 | |
| 
 | |
| 
 | |
| 
 | |
|                 if (e.Column.FieldName == "isQc" || e.Column.FieldName == "isZhitong")
 | |
|                 {
 | |
|                     int display = -100;
 | |
|                     string disTxt = e.DisplayText;
 | |
| 
 | |
|                     try
 | |
|                     {
 | |
|                         display = Convert.ToInt32(e.DisplayText);
 | |
|                         if (sender == gridView2)
 | |
|                         {
 | |
|                             e.DisplayText = (display == 1) ? "是" : "否";
 | |
|                         }
 | |
| 
 | |
|                     }
 | |
|                     catch
 | |
|                     {
 | |
|                         return;
 | |
|                     }
 | |
|                 }
 | |
|                 else
 | |
|            if (e.Column.FieldName == "validbyTime")
 | |
|                 {
 | |
|                     e.Column.DisplayFormat.FormatString = "yyyy-MM-dd HH:mm:ss";
 | |
|                 }
 | |
|                 else if (e.Column.FieldName == "createtime")
 | |
|                 {
 | |
|                     e.Column.DisplayFormat.FormatString = "yyyy-MM-dd HH:mm:ss";
 | |
|                 }
 | |
|                 else if (e.Column.FieldName == "lastmodified")
 | |
|                 {
 | |
|                     e.Column.DisplayFormat.FormatString = "yyyy-MM-dd HH:mm:ss";
 | |
|                 }
 | |
| 
 | |
|                 else if (e.Column.FieldName.Contains("数量"))
 | |
|                 {
 | |
|                     e.Column.DisplayFormat.FormatString = "{0:N0}"; ;
 | |
|                 }
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|             }
 | |
|         }
 | |
|        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 == "wms_state" && e.CellValue !=null)
 | |
|            {
 | |
|                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;
 | |
|                }
 | |
|                else if(b.Equals("已收货"))
 | |
|                {
 | |
|                    e.Appearance.ForeColor = Color.Gray;
 | |
|                    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;}
 | |
|            if (!currentView.GetDataRow(e.RowHandle).Table.Columns.Contains("wms_state"))
 | |
|            {
 | |
|                return;
 | |
|            }
 | |
| 
 | |
|            int state = Convert.ToInt32( currentView.GetDataRow(e.RowHandle)["wms_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 >=  (int) enumReceiveStockDetailStatus.已验收  )
 | |
|            {
 | |
|                rowStyle = isFocused ? passedFocus : passed;
 | |
|            }
 | |
|            else if (state == (int)enumReceiveStockDetailStatus.拒收  )
 | |
|            {
 | |
|                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()
 | |
|         {
 | |
|            
 | |
|             this.gridControl2.DataSource = null;
 | |
|          
 | |
|             if (!getCurrentObject() || selectedRequest == null)
 | |
|             {
 | |
|                 return;
 | |
|             }
 | |
|              lbVender.Text = selectedRequest.venderName +" " + selectedRequest.vender;
 | |
|             /// gridView1.FocusedRowHandle = selectedRowIndex;//
 | |
|             //  gridView1.SelectRow(selectedRowIndex);
 | |
|             showWaitForm();
 | |
|              
 | |
|             try
 | |
|             {
 | |
|                 txtPreInNo.Text = "";
 | |
|                 isShowingInRequest = true;
 | |
| 
 | |
|                 DataTable dtLog = inClient.getReceiveMuiltiHistory(selectedRequest.pur_order);
 | |
|                 closeClient();
 | |
| 
 | |
|                 DataView dv = dtLog.DefaultView;
 | |
|                 dv.Sort = "preInOrderNo desc";
 | |
| 
 | |
| 
 | |
|                 this.gridcontrolRecords.DataSource = dv;
 | |
| 
 | |
|                 if (dv.Count > 0)
 | |
|                 {
 | |
|                     txtPreInNo.Text = dv[0]["preInOrderNo"].ToString();
 | |
|                 }
 | |
| 
 | |
| 
 | |
|                 initialGridView2Columns(gridviewRecs);
 | |
| 
 | |
| 
 | |
|                 DataTable dt1 = inClient.getRequestInDetail(selectedRequest.pur_order, -1);
 | |
|                 closeClient();
 | |
|                 DataView dv2 = dt1.DefaultView;
 | |
|               //  dv.RowFilter = "wms_state <=1";
 | |
|                 this.gridControl2.DataSource = dv2;
 | |
|                 initialGridView2Columns(gridView2);
 | |
|                 selectedInIndex = gridView2.FocusedRowHandle;
 | |
|                 setCurrentInDetail();
 | |
| 
 | |
|                 setCurrentVenderPreIn();
 | |
|                
 | |
|                 btnIn.Enabled = selectedRequest.wms_state < (int)enumInStockOrderStatus.已验收;
 | |
|               
 | |
| 
 | |
|                // clearShipInfo();
 | |
| 
 | |
| 
 | |
|             }
 | |
|             catch (Exception e)
 | |
|             {
 | |
|                 showErrorMsg(e.Message);
 | |
|             }
 | |
|             finally
 | |
|             {
 | |
|                 closeClient();
 | |
|             }
 | |
|             closeWaitForm();
 | |
|         }
 | |
|         string currentPreNo="";
 | |
|         void setCurrentVenderPreIn()
 | |
|         {
 | |
|             currentPreNo = "";
 | |
|             DataTable dt2 = inClient.getReceivePreTmpSumByVender(selectedRequest.vender);
 | |
|             closeClient(); 
 | |
|             initialGridView2Columns(gridView3);
 | |
|              DataView dv = dt2.DefaultView;
 | |
|              if (dv.Count > 0)
 | |
|              {
 | |
|                  currentPreNo = dv[0]["preInOrderNo"].ToString();
 | |
|              }
 | |
|              dv.RowFilter = "preInOrderNo is null";
 | |
|             
 | |
|              //btnPrint.Enabled = !btnPreOk.Enabled;
 | |
|              //this.btnShipIn .Enabled = shipid==0;
 | |
| 
 | |
| 
 | |
|              //dv.RowFilter = "";
 | |
|              this.gridControl3.DataSource = dt2 ;
 | |
|              setBtnPreEnable();
 | |
|         }
 | |
| 
 | |
|         void setBtnPreEnable()
 | |
|         {
 | |
|             btnPreOk.Enabled = (gridView3.DataRowCount > 0) ;//&& shipid > 0;
 | |
|         }
 | |
|         void clearShipInfo()
 | |
|         {
 | |
|             /*
 | |
|             if (selectedRequest ==null || lastSelectedPurOrder.Equals(selectedRequest.pur_order))
 | |
|             {
 | |
|                 return;
 | |
|             }
 | |
|             */
 | |
|           //  gridcontrolShip.DataSource = null;
 | |
| 
 | |
|             selectedInShipId = 0;
 | |
|             selectedShipIndex = -1; 
 | |
|             shipDate =""; 
 | |
|             selectedShipDriver = "";
 | |
|             shipid = 0;
 | |
|              
 | |
| 
 | |
|             lbShipId.Text = txtShipNo.Text = txtCompany.Text = txtDriverPhone.Text = txtTemp.Text = txtVeNumber.Text = "";
 | |
| 
 | |
|                
 | |
|           // lbShipInfo.Text = ""; 
 | |
| 
 | |
|         }
 | |
|         private void btnIn_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             
 | |
|             doReceive();
 | |
|             query();
 | |
|          
 | |
|         }
 | |
|         void doReceive()
 | |
|         {
 | |
|             if (shipid <= 0)
 | |
|             {
 | |
|              //   showErrorMsg("请设置运输信息。");
 | |
|               //  return;
 | |
|             }
 | |
| 
 | |
|             lastSelectedPurOrder = selectedRequest.pur_order;
 | |
|             /*  if (tbReceive.SelectedTabPageIndex == 0)
 | |
|               {
 | |
|                   receiveByItem();
 | |
|               }
 | |
|               else
 | |
|               {
 | |
|                   takeAllOrder();
 | |
|               }
 | |
|               */
 | |
|             takeAllOrder();
 | |
|             setCurrentRequestDetail()  ;
 | |
|            // query();
 | |
|         }
 | |
|         void receiveByItem()
 | |
|         {
 | |
|             int lastSelectedIndex = 0;
 | |
|             showWaitForm();
 | |
|             try
 | |
|             {
 | |
|                 //   lgt.requestInStock(selectedRequest.orderNo);
 | |
| 
 | |
|                decimal number= currentDetail.count - currentDetail.receiveCount - currentDetail.rejectCount;
 | |
|                 decimal arriveNumber = Convert.ToDecimal(txtArrave.Text.ToString().Trim());
 | |
|               //  decimal number = Convert.ToDecimal(textEditReceiveNum.Text.ToString().Trim());
 | |
| 
 | |
|                 if (arriveNumber > number)
 | |
|                 {
 | |
|                     showErrorMsg("到货数量不能大于应收数量。");
 | |
|                     return;
 | |
|                 }
 | |
| 
 | |
|                 inClient.receiveDetailPre(selectedRequest.pur_order,selectedRequest.orderType, selectedPdId, arriveNumber, filtRiskChar(memPdRemark.Text.Trim()), shipid);
 | |
|                 closeClient();
 | |
|                 lastSelectedIndex = gridView2.FocusedRowHandle;
 | |
|                 memPdRemark.Text = "";
 | |
|                 isCheckedIn = true;
 | |
|                // query();
 | |
|             }
 | |
|             catch (Exception er)
 | |
|             {
 | |
|                 //  setCurrentRequestDetail();
 | |
|                 showErrorMsg(er.Message);
 | |
|             }
 | |
| 
 | |
|             setCurrentRequestDetail();
 | |
|             gridView2.FocusedRowHandle = lastSelectedIndex;
 | |
| 
 | |
|             closeWaitForm();
 | |
|         }
 | |
|  
 | |
|          
 | |
| 
 | |
|         private void GoodsInForm_FormClosing(object sender, FormClosingEventArgs e)
 | |
|         {
 | |
|             //closeClient();
 | |
|         }
 | |
| 
 | |
|         protected new void gridview_GotFocus(object sender, EventArgs e)
 | |
|         {
 | |
|             if (sender == gridView1)
 | |
|             {
 | |
|                 //grid4Valid.ForeColor = Color.Blue;
 | |
|                 // gridView4Valid.OptionsSelection.EnableAppearanceHideSelection = true;
 | |
|                 if (!isShowingInRequest)
 | |
|                 {
 | |
|                     this.setCurrentRequestDetail();
 | |
|                 }
 | |
|                 switchGridViewRowSelection(gridView1, true);
 | |
|                
 | |
|             }
 | |
|            
 | |
|             else
 | |
|             {
 | |
|                 switchGridViewRowSelection((GridView)sender, true);
 | |
|             }
 | |
| 
 | |
|         }
 | |
| 
 | |
|          
 | |
|        
 | |
|        
 | |
|         private void barBiSyncGoods_ItemClick(object sender, ItemClickEventArgs e)
 | |
|         {
 | |
|             initailErpData();
 | |
|         }
 | |
|         /// <summary>
 | |
|         /// 同步erp 信息
 | |
|         /// </summary>
 | |
|         private void initailErpData()
 | |
|         {
 | |
| 
 | |
|             showWaitForm("正在同步商品信息");
 | |
|             try
 | |
|             {
 | |
|                 //同步商品信息
 | |
|                 //lWmsGoods lg = new lWmsGoods();
 | |
|                 //lg.getWmsGoods.syncGoods();
 | |
|                  
 | |
|                     goodClient.syncGoods();
 | |
|                     closeClient();
 | |
|                  
 | |
|                 closeWaitForm();
 | |
| 
 | |
|             }
 | |
|             catch (Exception e)
 | |
|             {
 | |
|                 LogHelper.WriteLog(this.GetType(), e);
 | |
|                 // showErrorMsg(e.Message);
 | |
|                 closeWaitForm();
 | |
| 
 | |
|             }
 | |
| 
 | |
|         }
 | |
| 
 | |
|         private void takeAllOrder()
 | |
|         {
 | |
|             int lastSelectedIndex = 0;
 | |
|             showWaitForm();
 | |
|             try
 | |
|             {
 | |
|                 //   lgt.requestInStock(selectedRequest.orderNo);
 | |
| 
 | |
|                 currentPreNo = inClient.receiveByOrderPre(selectedRequest.pur_order, selectedRequest.vender,selectedRequest.orderType, filtRiskChar(mePhRemark.Text.Trim()),  shipid);
 | |
| 
 | |
|                 txtPreInNo.Text = currentPreNo;
 | |
| 
 | |
|                 printPreOrder(currentPreNo);
 | |
| 
 | |
|                 closeClient();
 | |
|                 lastSelectedIndex = gridView2.FocusedRowHandle;
 | |
|                 mePhRemark.Text = "";
 | |
|                 isCheckedIn = true;
 | |
|                 //  query();
 | |
|             }
 | |
|             catch (Exception er)
 | |
|             {
 | |
|                 //  setCurrentRequestDetail();
 | |
|                 showErrorMsg(er.Message);
 | |
|             }
 | |
| 
 | |
|             setCurrentRequestDetail();
 | |
|             gridView2.FocusedRowHandle = lastSelectedIndex;
 | |
| 
 | |
|             closeWaitForm();
 | |
|         }
 | |
| 
 | |
|         
 | |
|        
 | |
| 
 | |
|         int setShipDetails()
 | |
|         {
 | |
|             structShip ship = new structShip();
 | |
|             ship.shipOrder = filtRiskChar(this.txtShipNo.Text);
 | |
|             ship.company = filtRiskChar(this.txtCompany.Text);  
 | |
|             ship.driverPhone = filtRiskChar(this.txtDriverPhone.Text);
 | |
|            
 | |
|              if (txtTemp.Text.Length > 0)
 | |
|             {
 | |
|                 try
 | |
|                 {
 | |
|                     ship.temperature = Convert.ToDecimal(this.txtTemp.Text.Trim());
 | |
|                 }
 | |
|                 catch (Exception er)
 | |
|                 {
 | |
|                     showErrorMsg(er, "请输入正确的温度");
 | |
|                     return -1;
 | |
|                 }
 | |
|             }
 | |
| 
 | |
|             ship.veNumber = filtRiskChar(this.txtVeNumber.Text);
 | |
| 
 | |
|             if (string.IsNullOrEmpty(ship.shipOrder))
 | |
|             {
 | |
|                 showErrorMsg("请输入单号");
 | |
|                 txtShipNo.Focus();
 | |
|                 return -1;
 | |
|             }
 | |
|             int shipId = 0;
 | |
| 
 | |
|             try
 | |
|             {
 | |
|                shipId= inClient.newShipInfo(ship);
 | |
|                 closeClient();
 | |
|             }
 | |
|             catch (Exception er)
 | |
|             {
 | |
|                 showErrorMsg(er, "");
 | |
|                 closeClient();
 | |
|                
 | |
|             }
 | |
|             return shipId;
 | |
|         }
 | |
|         private void btnPrint_Click_1(object sender, EventArgs e)
 | |
|         {
 | |
|          
 | |
| 
 | |
|         }
 | |
|         void printPreOrder(string preOrder="")
 | |
|         {
 | |
| 
 | |
|             if (String.IsNullOrEmpty(WmsConstants.PRINTER_NAME_CODE))
 | |
|             {
 | |
|                 string msg = String.Format("没有定义条码打印机,请先设条码打印机");
 | |
|                 showErrorMsg(msg);
 | |
|                 return;
 | |
| 
 | |
|             }
 | |
| 
 | |
|             if (string.IsNullOrEmpty(preOrder) && string.IsNullOrEmpty(currentPreNo))
 | |
|             { 
 | |
|                 showErrorMsg("请在收货记录选择要打印的到货通知单");
 | |
|                 return;
 | |
|             }
 | |
|             string toPrintNo = currentPreNo;
 | |
|             if (!string.IsNullOrEmpty(preOrder))
 | |
|             {
 | |
|                 toPrintNo = preOrder;
 | |
|             }
 | |
| 
 | |
| 
 | |
| 
 | |
|             showWaitForm();
 | |
| 
 | |
|             if (chkPrint.Checked)
 | |
|             {
 | |
|                 try
 | |
|                 { //只打印未完成收货的明细,一张预到可对应一个采购单的多次收货
 | |
|                     printIn.printStockPreInItemsCode(toPrintNo);
 | |
|                 }
 | |
|                 catch (Exception er)
 | |
|                 {
 | |
|                     closeWaitForm();
 | |
|                     showErrorMsg(er);
 | |
|                 }
 | |
| 
 | |
|             }  
 | |
| 
 | |
|             try
 | |
|             { //只打印未完成收货的明细,一张预到可对应一个采购单的多次收货
 | |
|                 printIn.printStockPreInCode(toPrintNo,lbVender.Text);
 | |
|             }
 | |
|             catch (Exception er)
 | |
|             {
 | |
|                 closeWaitForm();
 | |
|                 showErrorMsg(er);
 | |
|             }
 | |
| 
 | |
|           
 | |
| 
 | |
| 
 | |
|             closeWaitForm();
 | |
|         }
 | |
| 
 | |
|         private void btnPreOk_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             if (String.IsNullOrEmpty(WmsConstants.PRINTER_NAME_A4))
 | |
|             {
 | |
|                 string msg = String.Format("没有定义A4打印机,请先设置A4打印机");
 | |
|                 showErrorMsg(msg);
 | |
|                 return;
 | |
|             }
 | |
|            
 | |
|             if (shipid <= 0)
 | |
|             {
 | |
|              //   return;
 | |
|             }
 | |
|             showWaitForm();
 | |
|             try
 | |
|             {
 | |
|                 string preNo = inClient.postPreIn(selectedRequest.vender, shipid);
 | |
|                 query();
 | |
|                 closeClient();
 | |
|                 printPreOrder(preNo);
 | |
|                 setCurrentVenderPreIn();
 | |
|             }
 | |
|             catch (Exception er)
 | |
|             {              
 | |
|                 showErrorMsg(er);
 | |
|                 closeClient();
 | |
|             }
 | |
|             closeWaitForm(); 
 | |
|             
 | |
|             shipid = 0;
 | |
|             clearShipInfo();
 | |
|         }
 | |
| 
 | |
|         string token = "EC-F6-D5-8A-4E-C5-9F-24-AB-51-E4-2B-D8-87-83-AA";
 | |
|         ServiceReferenceMobileTest.MobileClient _testClient;
 | |
|         ServiceReferenceMobileTest.MobileClient testClient
 | |
|         {
 | |
|             get
 | |
|             {
 | |
|                 if(_testClient==null){
 | |
|                 _testClient = new ServiceReferenceMobileTest.MobileClient("BasicHttpBinding_IMobile",
 | |
|             buildSvrAddress("MobileService.svc"));
 | |
|                 }
 | |
|                 return _testClient;
 | |
|             }
 | |
|         }
 | |
|         void closTestClient()
 | |
|         {
 | |
|             _testClient.Close();
 | |
|             _testClient = null;
 | |
|         }
 | |
| 
 | |
|         private void btnTestReceive_Click(object sender, EventArgs e)
 | |
|         {
 | |
| 
 | |
| 
 | |
|             bool rt = testClient.receiveDetail("PE2021073100000624", "0000103010", 1200, 1200, 0, "", 1, false, 0,
 | |
|                     LoginInfo.UserId, LoginInfo.Token);
 | |
| 
 | |
|             //DataTable dt = testClient.getPreInDetail("PE2021073000000580", 278, "32-D5-EB-5F-6D-D8-0E-0D-1A-6F-2B-DA-76-02-4A-56");
 | |
| 
 | |
|                 closTestClient();
 | |
|        
 | |
|         }
 | |
| 
 | |
|         private void btnValidTest_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             
 | |
|                 bool pass = true;
 | |
|                 bool issueLocations = true;
 | |
|                 string[] skuKeys = { "生产日期", "到期日期", "厂家批次" };
 | |
|                 string[] skuValues = { "2023-1-16", "2024-1-11", "21016" };
 | |
|                 try
 | |
|                 {
 | |
|                     decimal seedsNum = testClient.getValidSeedsCnt("0000100001 ", 1000);
 | |
| 
 | |
|                     enumValidInResult rt = (enumValidInResult)testClient.validIn("PE23041300004", "100012", "P00856", 150, 1, skuKeys, skuValues, pass, issueLocations, 282, LoginInfo.UserId, LoginInfo.Token);
 | |
| 
 | |
|                   //  enumValidInResult valid = rt;
 | |
|                     closTestClient();
 | |
|                 }
 | |
|                 catch (Exception er)
 | |
|                 {
 | |
|                     showErrorMsg(er);
 | |
|                 }
 | |
|         }
 | |
| 
 | |
|         private void btnInPlateTest_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             enumRepResult result = (enumRepResult)
 | |
|                 testClient.repItemIn("A011160411", "8262", 5756, "210208", 54, 1161, LoginInfo.UserId, LoginInfo.Token);
 | |
| 
 | |
|           
 | |
|             
 | |
|             // DataTable dt = testClient.taskAssign(0, 0, true, 3, LoginInfo.UserId, LoginInfo.Token);
 | |
| 
 | |
| 
 | |
|          //   enumRepResult result = (enumRepResult)testClient.finishUpShelfItem("1", 3, 800,
 | |
|           //         "B02.06.01.13", "货位不可用", 278, LoginInfo.Token);
 | |
|            // enumRepResult result = (enumRepResult)testClient.finishUpShelfItem("10001",2, 120,
 | |
|             //      "YL.01.01.15", "", LoginInfo.UserId, LoginInfo.Token);
 | |
| 
 | |
|             //  enumRepResult valid = result;
 | |
|             // closTestClient();
 | |
| 
 | |
| 
 | |
|             using (scheduledServiceTest.ScheduledServiceClient client = new scheduledServiceTest.ScheduledServiceClient())
 | |
|             {
 | |
|                 /*
 | |
|                 try
 | |
|                 {
 | |
| 
 | |
|                     client.syncAndCreatePickRequest(enumOutStockRequestStatus.准备分拣);
 | |
| 
 | |
|                     client.createPDAPickTasks();
 | |
| 
 | |
|                     client.createPickWaves();
 | |
|                      
 | |
| 
 | |
|                 }
 | |
|                 catch (Exception er)
 | |
|                 {
 | |
|                     showErrorMsg(er.Message);
 | |
|                 }
 | |
|                     */
 | |
|             }
 | |
|          
 | |
| 
 | |
| 
 | |
|        //  DataTable dt=   testClient.getTaskAssigned(278, -1, -1, true, 0);
 | |
| 
 | |
|      //   int i= dt.Rows.Count;
 | |
|      //   i++;
 | |
|         }
 | |
| 
 | |
|         private void simpleButton1_Click(object sender, EventArgs e)
 | |
|         {
 | |
| 
 | |
|             bool rt = testClient.finishPickItem("100012", "WV2021072800058147",
 | |
|                 "PK2021072800058146", 3, 120, 278, "CC-15-91-CD-2D-85-B7-51-E1-B5-97-C3-EB-0E-6F-5D");
 | |
|                bool val = rt;
 | |
|               closTestClient();
 | |
|         }
 | |
| 
 | |
|         private void simpleButton2_Click(object sender, EventArgs e)
 | |
|         {
 | |
|                // DataTable dt = testClient.repTodayDetails4Pick();
 | |
| 
 | |
|                 bool rt = testClient.finishPickItem("000000011", "",
 | |
|                  "RP020000048114", 2676, 300, 278, "0C-52-BD-F7-31-BD-F0-C9-47-DF-7E-1C-CE-AF-C7-66");
 | |
|                 bool val = rt;
 | |
|                 closTestClient();
 | |
| 
 | |
|               //  enumRepResult result = (enumRepResult)testClient.repItemIn("YL.24.10.43", "G2199Y5WDIJ", 3463, "160401", 80, 2111,
 | |
|               //      282, token);
 | |
| 
 | |
|                // int re = (int)result;
 | |
|                // closTestClient();
 | |
|         }
 | |
| 
 | |
|         private void simpleButton3_Click(object sender, EventArgs e)
 | |
|         {
 | |
|            
 | |
|                 try
 | |
|                 {
 | |
|                     DataTable dtLocs = testClient.getLocations(3463, "", "G2199Y5WDIJ", "160401", 80);
 | |
|                     int cnt = dtLocs.Rows.Count;
 | |
|                 }
 | |
|                 catch (Exception er)
 | |
|                 {
 | |
|                     showErrorMsg(er.Message);
 | |
|                 }
 | |
|                 closTestClient();
 | |
|         }
 | |
| 
 | |
|         private void simpleButton4_Click(object sender, EventArgs e)
 | |
|         { 
 | |
|                 try
 | |
|                 {
 | |
|                     DataTable dtLocs = testClient.getData4Maintain("YL.26.06.45").Tables[0];
 | |
|                     int cnt = dtLocs.Rows.Count;
 | |
|                 }
 | |
|                 catch (Exception er)
 | |
|                 {
 | |
|                     showErrorMsg(er.Message);
 | |
|                 }
 | |
|                 closTestClient();
 | |
|         }
 | |
| 
 | |
|         private void simpleButton5_Click(object sender, EventArgs e)
 | |
|         {
 | |
|            
 | |
|                 try
 | |
|                 {
 | |
|                     bool result = testClient.newPandianItem("PAN070000005224", "YL.26.06.45", 0, "6902015000001",
 | |
|                         "2020-6-1", "2020-6-1", 1, 282, token);
 | |
|                 }
 | |
|                 catch (Exception er)
 | |
|                 {
 | |
|                     showErrorMsg(er.Message);
 | |
|                 }
 | |
|                 closTestClient();
 | |
|         }
 | |
| 
 | |
|         private void simpleButton6_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             using (scheduledServiceTest.ScheduledServiceClient client = new scheduledServiceTest.ScheduledServiceClient())
 | |
|             {
 | |
|                 try
 | |
|                 {
 | |
|                    
 | |
|                    client.syncAndCreatePickRequest(enumOutStockRequestStatus.准备分拣);
 | |
|                   
 | |
|                    client.createPDAPickTasks();
 | |
|                 
 | |
|                    client.createPickWaves();
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|                 }
 | |
|                 catch (Exception er)
 | |
|                 {
 | |
|                     showErrorMsg(er.Message);
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
| 
 | |
|        
 | |
| 
 | |
|         private void simpleButton7_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             outClient.updateTestData();
 | |
|             closeClient();
 | |
|         }
 | |
| 
 | |
|         private void simpleButton8_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             try
 | |
|             {
 | |
|                 DataTable dt = testClient.getTasks(1,-1,282,282, token);
 | |
|                 int cnt = dt.Rows.Count;
 | |
|                 showErrorMsg(cnt+"");
 | |
|             }
 | |
|             catch (Exception er)
 | |
|             {
 | |
|                 showErrorMsg(er.Message);
 | |
|             }
 | |
|             closTestClient();
 | |
|         }
 | |
| 
 | |
|         private void simpleButton9_Click(object sender, EventArgs e)
 | |
|         {
 | |
|            
 | |
| 
 | |
|             try
 | |
|             {
 | |
|                 bool b_result = testClient.newMaintain(15568, 300, 300, "翻跺;除尘;", LoginInfo.UserId, LoginInfo.Token);
 | |
| 
 | |
|                 showErrorMsg(b_result + "");
 | |
|             }
 | |
|             catch (Exception er)
 | |
|             {
 | |
|                 showErrorMsg(er.Message);
 | |
|             } 
 | |
|             closTestClient();
 | |
|         }
 | |
| 
 | |
|         private void 解锁养护_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             try
 | |
|             {
 | |
| 
 | |
|                 bool b_result = testClient.fixIssueData(1797, LoginInfo.UserId, token);
 | |
| 
 | |
|                 showErrorMsg(b_result + "");
 | |
|             }
 | |
|             catch (Exception er)
 | |
|             {
 | |
|                 showErrorMsg(er.Message);
 | |
|             }
 | |
|             closTestClient();
 | |
|         }
 | |
| 
 | |
|         private void simpleButton10_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             try
 | |
|             {
 | |
| 
 | |
|                 DataTable b_result = testClient.getTransRequestsWithBulks();
 | |
| 
 | |
|                 
 | |
|             }
 | |
|             catch (Exception er)
 | |
|             {
 | |
|                 showErrorMsg(er.Message);
 | |
|             }
 | |
|             closTestClient();
 | |
|         }
 | |
| 
 | |
|         private void simpleButton11_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             try
 | |
|             {
 | |
|                 int result = testClient.regSeedsPlate("H-1-3-202", 1); showErrorMsg("" + (enumRegPlateResult)result);
 | |
|                 result = testClient.regSeedsPlate("H-1-3-203", 1); showErrorMsg("" + (enumRegPlateResult)result);
 | |
|                 result = testClient.regSeedsPlate("H-1-3-204", 1); showErrorMsg("" + (enumRegPlateResult)result);
 | |
|                 result = testClient.regSeedsPlate("H-1-3-205", 1); showErrorMsg("" + (enumRegPlateResult)result);
 | |
|                 result = testClient.regSeedsPlate("H-1-3-206", 1); showErrorMsg("" + (enumRegPlateResult)result);
 | |
|                 result = testClient.regSeedsPlate("H-1-3-207", 2); showErrorMsg("" + (enumRegPlateResult)result);
 | |
|                 result = testClient.regSeedsPlate("H-1-3-208", 2); showErrorMsg("" + (enumRegPlateResult)result);
 | |
|                 result = testClient.regSeedsPlate("H-1-3-209", 2); showErrorMsg("" + (enumRegPlateResult)result);
 | |
|                 result = testClient.regSeedsPlate("H-1-3-210", 2); showErrorMsg("" + (enumRegPlateResult)result);
 | |
|                 result = testClient.regSeedsPlate("H-1-3-211", 3); showErrorMsg("" + (enumRegPlateResult)result);
 | |
|                 result = testClient.regSeedsPlate("H-1-3-212", 3); showErrorMsg("" + (enumRegPlateResult)result);
 | |
|                 result = testClient.regSeedsPlate("H-1-3-213", 3); showErrorMsg("" + (enumRegPlateResult)result);
 | |
|                 result = testClient.regSeedsPlate("H-1-3-214", 4); showErrorMsg("" + (enumRegPlateResult)result);
 | |
|                 result = testClient.regSeedsPlate("H-1-3-215", 4); showErrorMsg("" + (enumRegPlateResult)result);
 | |
|                 showErrorMsg("" + (enumRegPlateResult)result);
 | |
|             }
 | |
|             catch (Exception er)
 | |
|             {
 | |
|                 showErrorMsg(er.Message);
 | |
|             }
 | |
|             closTestClient();
 | |
|         }
 | |
| 
 | |
|         private void button1_Click(object sender, EventArgs e)
 | |
|         {
 | |
|            
 | |
|         }
 | |
| 
 | |
|         private void simpleButton12_Click(object sender, EventArgs e)
 | |
|         {
 | |
| 
 | |
|             try
 | |
|             {
 | |
| 
 | |
|               string[] lst = testClient.getPartions(278);
 | |
|               foreach (string s in lst)
 | |
|               {
 | |
| 
 | |
|               }
 | |
| 
 | |
|             }
 | |
|             catch (Exception er)
 | |
|             {
 | |
|                 showErrorMsg(er.Message);
 | |
|             }
 | |
|             closTestClient();
 | |
|         }
 | |
| 
 | |
|         private void simpleButton13_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             try
 | |
|             {
 | |
|                 DataTable dt = testClient.getTaskAssigned(LoginInfo.UserId,  0, 0, true,0); 
 | |
| 
 | |
|             }
 | |
|             catch (Exception er)
 | |
|             {
 | |
|                 showErrorMsg(er.Message);
 | |
|             }
 | |
|             closTestClient();
 | |
|            
 | |
|         }
 | |
| 
 | |
|         private void simpleButton14_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             try
 | |
|             {
 | |
|                 DataTable dt = testClient.taskAssign(0, 0, true,0, 278, token);
 | |
|                 //dt = testClient.repTodayDetails4Pick( );
 | |
|             }
 | |
|             catch (Exception er)
 | |
|             {
 | |
|                 showErrorMsg(er.Message);
 | |
|             }
 | |
|             closTestClient();
 | |
|         }
 | |
| 
 | |
|         private void simpleButton15_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             try
 | |
|             {
 | |
|                 bool b = testClient.finishBatchValidateItem("PK2021072700058089", 1, 278, 278,LoginInfo.Token);
 | |
|                string s= b.ToString();
 | |
|             }
 | |
|             catch (Exception er)
 | |
|             {
 | |
|                 showErrorMsg(er.Message);
 | |
|             }
 | |
|             closTestClient();
 | |
|         
 | |
|         }
 | |
| 
 | |
|         private void simpleButton16_Click(object sender, EventArgs e)
 | |
|         {
 | |
|            
 | |
|             try
 | |
|             {
 | |
|                 string[] b;
 | |
| 
 | |
|                  b = testClient.getPortAuths(282, "EF-AC-BD-1A-C1-41-67-17-FB-B7-CF-03-DA-25-76-AD");
 | |
|                 string s = b.ToString();
 | |
|             }
 | |
|             catch (Exception er)
 | |
|             {
 | |
|                 showErrorMsg(er.Message);
 | |
|             }
 | |
|             closTestClient();
 | |
|         }
 | |
|         int selectedVenderRowIndex;
 | |
|         private void gridView3_SelectionChanged(object sender, DevExpress.Data.SelectionChangedEventArgs e)
 | |
|         {
 | |
|             if (gridView3.FocusedRowHandle < 0 || gridView3.FocusedRowHandle == selectedVenderRowIndex)
 | |
|             {
 | |
|                 return;
 | |
|             }
 | |
|             selectedVenderRowIndex = gridView3.FocusedRowHandle; 
 | |
| 
 | |
|             DataRowView dr = (DataRowView)(GetGridViewFilteredAndSortedData(gridView3)[selectedVenderRowIndex]);
 | |
| 
 | |
|             currentPreNo = dr["preInOrderNo"].ToString();
 | |
|         }
 | |
| 
 | |
|         private void barButtonItem1_ItemClick(object sender, ItemClickEventArgs e)
 | |
|         {
 | |
|             printPreOrder();
 | |
|         }
 | |
| 
 | |
|         private void gridviewRecs_SelectionChanged(object sender, DevExpress.Data.SelectionChangedEventArgs e)
 | |
|         {
 | |
|             if (gridviewRecs.FocusedRowHandle < 0  )
 | |
|             {
 | |
|                 return;
 | |
|             } 
 | |
| 
 | |
|             DataRowView dr = (DataRowView)(GetGridViewFilteredAndSortedData(gridviewRecs)[gridviewRecs.FocusedRowHandle]);
 | |
| 
 | |
|             currentPreNo = dr["preInOrderNo"].ToString();
 | |
|         }
 | |
| 
 | |
|         private void btnShipIn_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             shipid = setShipDetails();
 | |
|             setBtnPreEnable();
 | |
|             lbShipId.Text = shipid+"";
 | |
|         }
 | |
| 
 | |
|         private void btnPic_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             showWaitForm();
 | |
|             Form frm = ((main)this.ParentForm).getOpenedForm("留存模板");
 | |
|             ImageViewForm spdf = frm == null ? new ImageViewForm()
 | |
|                                 : (ImageViewForm)((main)this.ParentForm).getOpenedForm("留存模板");
 | |
| 
 | |
|             spdf.Location1 = "https://iknow-pic.cdn.bcebos.com/a9d3fd1f4134970a9ad5dafe99cad1c8a6865db9?x-bce-process%3Dimage%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_jpg";
 | |
|             spdf.Location2 = "https://img2.baidu.com/it/u=2161036217,2729633347&fm=26&fmt=auto&gp=0.jpg";
 | |
|             string file1 ="";
 | |
|              string file2 ="";
 | |
|             if (!string.IsNullOrEmpty(fileLocation))
 | |
|             {
 | |
|                 string[] ss =fileLocation.Split(';');
 | |
| 
 | |
|                 if (ss.Length > 0)
 | |
|                 {
 | |
|                     file1 = ss[0];
 | |
|                 }
 | |
| 
 | |
|                 if (ss.Length > 1)
 | |
|                 {
 | |
|                     file2 = ss[1];
 | |
|                 }
 | |
| 
 | |
|                 spdf.Location1 =WmsConstants.FILE_SVR_PIC+ file1;
 | |
|                 spdf.Location2 = WmsConstants.FILE_SVR_PIC + file2;
 | |
|             }
 | |
| 
 | |
|             spdf.Vender = lbVender.Text;
 | |
|             spdf.setVender();
 | |
| 
 | |
|             if (frm == null)
 | |
|             {
 | |
|                 if (this.ParentForm != null)
 | |
|                 {
 | |
|                     ((main)this.ParentForm).OpenLink(spdf, "留存模板");
 | |
|                 }
 | |
|             }
 | |
|             closeWaitForm();
 | |
|         }
 | |
| 
 | |
|         private void btnInPlateTest_Click_1(object sender, EventArgs e)
 | |
|         {
 | |
| 
 | |
|         }
 | |
| 
 | |
|         private void barButtonItem1_ItemClick_1(object sender, ItemClickEventArgs e)
 | |
|         {
 | |
| 
 | |
|         }
 | |
| 
 | |
|         private void simpleButton16_Click_1(object sender, EventArgs e)
 | |
|         {
 | |
| 
 | |
|         }
 | |
| 
 | |
|         private void txtVender_KeyUp(object sender, KeyEventArgs e)
 | |
|         {
 | |
|             if(e.KeyCode == Keys.Enter)
 | |
|             {
 | |
|                 if (txtVender.Text.Length > 3)
 | |
|                 {
 | |
|                     query();
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         private void btnPrint_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             if (txtPreInNo.Text.Length > 3)
 | |
|             {
 | |
|                 printPreOrder(txtPreInNo.Text);
 | |
|             }
 | |
|          
 | |
|         }
 | |
| 
 | |
|         private void simpleButton17_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             showWaitForm();
 | |
|             string vender = "GY0014";
 | |
|             int itemCnt = 500;
 | |
|             decimal batchCnt = 5;
 | |
|             decimal bulkCnt = 5;
 | |
|             inClient.testPuchIn(vender, itemCnt, batchCnt, bulkCnt,0);
 | |
|             closeClient();
 | |
|             closeWaitForm();
 | |
|             showInfoMsg("create done");
 | |
|         }
 | |
| 
 | |
|         private void simpleButton18_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             showWaitForm();
 | |
| 
 | |
|             inClient.autoValidIn();
 | |
|             closeClient();
 | |
|             closeWaitForm();
 | |
|             showInfoMsg(" auto validIn done");
 | |
|         }
 | |
| 
 | |
|         private void simpleButton19_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             showWaitForm();
 | |
| 
 | |
|             string preNo= inClient.autoPreIn("GY0014");
 | |
|             closeClient();
 | |
|             closeWaitForm();
 | |
|             showInfoMsg(preNo);
 | |
|         }
 | |
| 
 | |
|         private void simpleButton20_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             showWaitForm();
 | |
|             string preNo = "";
 | |
|             string flowNo = "r8288";
 | |
|             bool showAllusers = false;
 | |
|             bool rt = inClient.autoOnShelf(preNo,flowNo, showAllusers);
 | |
|             closeClient();
 | |
|             closeWaitForm();
 | |
|             showInfoMsg("auto on shelf:" +rt);
 | |
|         }
 | |
| 
 | |
|         private void simpleButton21_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             showWaitForm();
 | |
|             string custId = null;
 | |
|             bool rt = outClient.testCreateSalesOut(custId);
 | |
|             closeClient();
 | |
|             closeWaitForm();
 | |
|             showInfoMsg(" create sales out done....result is  " + rt);
 | |
|         }
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|         void printRecievReport(string preOrder = "")
 | |
|         {
 | |
| 
 | |
| 
 | |
|             if (String.IsNullOrEmpty(WmsConstants.PRINTER_NAME_PIN))
 | |
|             {
 | |
|                 string msg = String.Format("没有定义多联打印机,请先设置多联打印机");
 | |
|                 showErrorMsg(msg);
 | |
| 
 | |
| 
 | |
|             }
 | |
| 
 | |
|             if (string.IsNullOrEmpty(preOrder) && string.IsNullOrEmpty(currentPreNo))
 | |
|             {
 | |
|                 showErrorMsg("没有到货通知打印");
 | |
|                 return;
 | |
|             }
 | |
|             string toPrintNo = currentPreNo;
 | |
|             if (!string.IsNullOrEmpty(preOrder))
 | |
|             {
 | |
|                 toPrintNo = preOrder;
 | |
|             }
 | |
| 
 | |
| 
 | |
| 
 | |
|             showWaitForm();
 | |
|             try
 | |
|             { //只打印未完成收货的明细,一张预到可对应一个采购单的多次收货
 | |
|                 printIn.printStockReceiveMulti(toPrintNo);
 | |
|             }
 | |
|             catch (Exception er)
 | |
|             {
 | |
|                 showErrorMsg(er);
 | |
|             }
 | |
|             closeWaitForm();
 | |
|         }
 | |
| 
 | |
|         private ServiceHost host = null;
 | |
| 
 | |
|         string svrUrl = WmsConstants.LIGHT_SVR_ADDRESS;
 | |
|         delegate void showStatus();
 | |
|         void startHost()
 | |
|         {
 | |
|             //  lbStatus.Text = "服务启动失败";
 | |
|             try
 | |
|             {
 | |
|                 //   svrUrl = System.Configuration.ConfigurationManager.AppSettings["BaseUri"];
 | |
|                 //  wmsUrl = System.Configuration.ConfigurationManager.AppSettings["WMSuri"];
 | |
|                 svrUrl = "http://127.0.0.1:9997/DNLight";
 | |
| 
 | |
|                 Uri baseAddress = new Uri(svrUrl);
 | |
|                 LightService service = new LightService();
 | |
| 
 | |
|                 service.printPreInd += this.printPreInNo;
 | |
|                 service.prinOutTransd += this.prinOutTrans;
 | |
|                 //  service.lightUp += this.lightUp;
 | |
| 
 | |
|                 host = new ServiceHost(service, baseAddress);
 | |
|                 //  elelab.DNLights.lightOffEvent += testPicked;
 | |
| 
 | |
|                 WebHttpBinding binding = new WebHttpBinding();
 | |
|                 ServiceEndpoint endpoint = host.AddServiceEndpoint(typeof(ILightService), binding, baseAddress);
 | |
|                 WebHttpBehavior httpBehavior = new WebHttpBehavior();
 | |
|                 endpoint.Behaviors.Add(httpBehavior);
 | |
|                 List<string> lstIp = Util.GetLocalIpAddress("InterNetwork");
 | |
|                 string showSvr = "127.0.0.1:9997";
 | |
|                 if (lstIp.Count > 0)
 | |
|                 {
 | |
|                     showSvr = showSvr.Replace("127.0.0.1", lstIp[0]);
 | |
|                 }
 | |
|                 lbUrl.Text = "打印服务未启动 ";
 | |
|                 host.Opened += delegate
 | |
| 
 | |
|                 {
 | |
| 
 | |
|                     if (InvokeRequired)
 | |
|                     {
 | |
|                         this.Invoke(new showStatus(delegate ()
 | |
|                         {
 | |
|                             lbUrl.Text = "服务已启动 " + showSvr;
 | |
| 
 | |
|                             ;
 | |
|                         }));
 | |
| 
 | |
|                     }
 | |
|                     else
 | |
|                     {
 | |
| 
 | |
|                         lbUrl.Text = "服务已启动 " + showSvr;
 | |
| 
 | |
| 
 | |
|                     }
 | |
|                 };
 | |
| 
 | |
| 
 | |
|                 host.Open();
 | |
| 
 | |
|             }
 | |
|             catch (Exception e)
 | |
|             {
 | |
|                 // addLog("启动服务失败:  " + e.Message);
 | |
|                 MessageBox.Show("启动服务失败:  " + e.Message);
 | |
|             }
 | |
| 
 | |
| 
 | |
|         }
 | |
|         delegate void showLog();
 | |
|         private string printPreInNo(int userId, string preInNo)
 | |
|         {
 | |
|             if (String.IsNullOrEmpty(WmsConstants.PRINTER_NAME_PIN))
 | |
|             {
 | |
|                 string msg = String.Format("没有定义多联打印机");
 | |
|                 //  showErrorMsg(msg);
 | |
|                 return msg;
 | |
| 
 | |
|             }
 | |
| 
 | |
|             if (InvokeRequired)
 | |
|             {
 | |
|                 this.Invoke(new showLog(delegate ()
 | |
|                 {
 | |
|                     lbInfo.Text = String.Format("用户 {0}, 打印单号 {1}", userId, preInNo);
 | |
|                 }));
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 lbInfo.Text = String.Format("用户 {0}, 打印单号 {1}", userId, preInNo);
 | |
|             }
 | |
| 
 | |
| 
 | |
| 
 | |
|             if (string.IsNullOrEmpty(preInNo.ToString()))
 | |
|             {
 | |
|                 // showErrorMsg("车辆为空,打印失败");
 | |
|                 return " 请输入到货单,打印失败";
 | |
|             }
 | |
| 
 | |
|             Thread threadPreProcess = new Thread(new ParameterizedThreadStart(doPrint));
 | |
|             threadPreProcess.IsBackground = true;
 | |
|             threadPreProcess.Start(preInNo);
 | |
| 
 | |
|             return "打印命令已发送";
 | |
|         }
 | |
| 
 | |
|         private void doPrint(Object preInNo)
 | |
|         {
 | |
| 
 | |
|             showWaitForm();
 | |
|             try
 | |
|             { //只打印未完成收货的明细,一张预到可对应一个采购单的多次收货
 | |
|                 if (WmsConstants.IS_PRINT_PRENO)
 | |
|                 {
 | |
|                     printIn.printStockReceiveMulti(preInNo.ToString());
 | |
|                 }
 | |
|                
 | |
| 
 | |
|             }
 | |
|             catch (Exception er)
 | |
|             {
 | |
|                 showErrorMsg(er);
 | |
|             }
 | |
|             closeWaitForm();
 | |
|         }
 | |
| 
 | |
|        
 | |
| 
 | |
|          
 | |
| 
 | |
|         private void btnTestService_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             //  DataTable dt = testClient.taskAssign(0, 0, true, 3, LoginInfo.UserId, LoginInfo.Token);
 | |
| 
 | |
| 
 | |
|         }
 | |
|         private string prinOutTrans(string plateId)
 | |
|         {
 | |
|             if (String.IsNullOrEmpty(WmsConstants.PRINTER_NAME_PIN))
 | |
|             {
 | |
|                 string msg = String.Format("没有定义多联打印机");
 | |
|                 //  showErrorMsg(msg);
 | |
|                 return msg;
 | |
| 
 | |
|             }
 | |
| 
 | |
|             if (string.IsNullOrEmpty(plateId))
 | |
|             {
 | |
|                 // showErrorMsg("车辆为空,打印失败");
 | |
|                 return "车辆为空,打印失败";
 | |
|             }
 | |
|             if (InvokeRequired)
 | |
|             {
 | |
|                 this.Invoke(new showLog(delegate ()
 | |
|                 {
 | |
|                     lbInfo.Text = String.Format(" 打印装车 {0}", plateId);
 | |
|                 }));
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 lbInfo.Text = String.Format(" 打印装车 {0}", plateId);
 | |
|             }
 | |
| 
 | |
|             Thread threadPreProcess = new Thread(new ParameterizedThreadStart(doPrintTran));
 | |
|             threadPreProcess.IsBackground = true;
 | |
|             threadPreProcess.Start(plateId);
 | |
| 
 | |
|             return "打印命令已发送";
 | |
|         }
 | |
| 
 | |
|         private void doPrintTran(object plateId)
 | |
|         {
 | |
| 
 | |
|             showWaitForm();
 | |
|             try
 | |
|             {
 | |
| 
 | |
|                 DataTable dt = tmsClient.getLatestPickRequestsByViechole(plateId.ToString());
 | |
|                 closeClient();
 | |
|                 foreach (DataRow dr in dt.Rows)
 | |
|                 {
 | |
|                     doPrintEachTran(new WmsOutPickRequest(dr));
 | |
| 
 | |
|                 }
 | |
| 
 | |
|             }
 | |
|             catch (Exception er)
 | |
|             {
 | |
|                 debug(er.StackTrace);
 | |
|                 //  showErrorMsg(er);
 | |
|             }
 | |
|             finally
 | |
|             {
 | |
|                 closeClient();
 | |
|             }
 | |
|             closeWaitForm();
 | |
|         }
 | |
| 
 | |
|         void doPrintEachTran(WmsOutPickRequest wpr)
 | |
|         {
 | |
| 
 | |
|             try
 | |
|             {
 | |
|                 DataTable dtDetail = tmsClient.queryPickRequests4Report(wpr.pickOrderNo);
 | |
|                 if (dtDetail.Rows.Count == 0)
 | |
|                 {
 | |
|                     return;
 | |
|                 }
 | |
| 
 | |
|                 wpr = new WmsOutPickRequest(dtDetail.Rows[0]);
 | |
| 
 | |
|                 wpr.sumPrice = wpr.sumPrice > 0 ? wpr.sumPrice : 100;
 | |
|                 string sumPrice = "壹佰元整";//= Utils.Util.convertToChinese(wpr.sumPrice);// "壹佰贰拾伍元整";
 | |
|                 printIn.printStockOutInvoice(dtDetail, sumPrice);
 | |
|                 tmsClient.updatePickInvoice(wpr.pickOrderNo, wpr.invoiceNo);
 | |
|                 closeClient();
 | |
| 
 | |
|             }
 | |
|             catch (Exception er)
 | |
|             {
 | |
|                 debug(er.StackTrace);
 | |
|                 // showErrorMsg(er);
 | |
|                 // continue;
 | |
| 
 | |
| 
 | |
|             }
 | |
|             finally
 | |
|             {
 | |
|                 closeClient();
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         private void GoodsPreReceiveMultiDetails_FormClosing(object sender, FormClosingEventArgs e)
 | |
|         {
 | |
|             try
 | |
|             {
 | |
|                   host.Close();
 | |
|             }catch(Exception er)
 | |
|             {
 | |
| 
 | |
|             }
 | |
|          
 | |
|         }
 | |
| 
 | |
|         private void btnPrintMuiti_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             try
 | |
|             {
 | |
|                 printRecievReport(txtPreInNo.Text);
 | |
|             }
 | |
|             catch (Exception er)
 | |
|             {
 | |
|                 showErrorMsg(er);
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| } |