| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  | 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; | 
					
						
							|  |  |  |  | using DeiNiu.wms.win.portalService; | 
					
						
							|  |  |  |  | using DeiNiu.wms.win.ServiceReferenceLot; | 
					
						
							|  |  |  |  | using DevExpress.XtraLayout;//debug  | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | namespace DeiNiu.wms.win | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     public partial class GoodsValidationByPreNo : 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; | 
					
						
							|  |  |  |  |         private decimal bigcount; | 
					
						
							|  |  |  |  |         decimal seedsCount = 0; | 
					
						
							|  |  |  |  |         bool isDoubleChk = false; | 
					
						
							|  |  |  |  |       //  DataTable dtIndetail; | 
					
						
							|  |  |  |  |         private int selectedRowIndex = -1; | 
					
						
							|  |  |  |  |         private Erp_purch currentRequest; | 
					
						
							|  |  |  |  |         private bool isShowingInRequest = true; | 
					
						
							|  |  |  |  |         Dictionary<string, string> isDoublChk = new Dictionary<string, string>(); | 
					
						
							|  |  |  |  |         public GoodsValidationByPreNo() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |           | 
					
						
							|  |  |  |  |             InitializeComponent();  | 
					
						
							|  |  |  |  |            | 
					
						
							|  |  |  |  |             initialControls(); | 
					
						
							|  |  |  |  |             initailErpData(); | 
					
						
							|  |  |  |  |             //    loadData(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             isDoublChk.Add("N", "否"); | 
					
						
							|  |  |  |  |             isDoublChk.Add("Y", "是"); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #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); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         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.已拒收); | 
					
						
							|  |  |  |  |             */ | 
					
						
							|  |  |  |  |             Dictionary<int, string> dic = new Dictionary<int, string>(); | 
					
						
							|  |  |  |  |            // dic.Add((int)enumInStockOrderStatus.待验收, enumInStockOrderStatus.待验收.ToString()); | 
					
						
							|  |  |  |  |            // initialComboBoxs(comboState, dic,true); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             string[] result = new string[2]{"合格","不合格"};  | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             initialComboBoxs(comValidResult, result); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             dic = Utils.Util.convertEnumToDic(typeof(enumWhType)); | 
					
						
							|  |  |  |  |             dic.Remove((int)enumWhType.越仓收货区); | 
					
						
							|  |  |  |  |             dic.Remove((int)enumWhType.集货库); | 
					
						
							|  |  |  |  |             initialComboBoxs(comValidResult, dic, false); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             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); //缓存分区 | 
					
						
							|  |  |  |  |                         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); | 
					
						
							|  |  |  |  |             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 = "venderName" }; | 
					
						
							|  |  |  |  |             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 = Erp_purch.fields.shipDate.ToString() }; | 
					
						
							|  |  |  |  |             GridColumn myCol7 = new GridColumn() { Caption = "状态", Visible = true, FieldName = Erp_purch.fields.wms_state.ToString() }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             gridView.Columns.Add(myCol1); | 
					
						
							|  |  |  |  |             gridView.Columns.Add(myCol6); | 
					
						
							|  |  |  |  |             gridView1.Columns.Add(myCol2);  | 
					
						
							|  |  |  |  |             gridView.Columns.Add(myCol7);   | 
					
						
							|  |  |  |  |             gridView.Columns.Add(myCol3); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |          //   this.gridView1.Columns.Add(myCol4); | 
					
						
							|  |  |  |  |             gridView.Columns.Add(myCol5); | 
					
						
							|  |  |  |  |             | 
					
						
							|  |  |  |  |             //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 myCol135 = new GridColumn() { Caption = "验收数量", Visible = true, FieldName = Erp_purch_d.fields.validCount.ToString() }; | 
					
						
							|  |  |  |  |            | 
					
						
							|  |  |  |  |             GridColumn myCol136 = new GridColumn() { Caption = "抽样数量", Visible = true, FieldName = Erp_receiveValidDetail.fields.seeds_count.ToString() }; | 
					
						
							|  |  |  |  |              | 
					
						
							|  |  |  |  |             GridColumn myCol137 = new GridColumn() { Caption = "验收人1", Visible = true, FieldName = "validByName" }; | 
					
						
							|  |  |  |  |             GridColumn myCol138 = new GridColumn() { Caption = "验收人2", Visible = true, FieldName = "validByName1" }; | 
					
						
							|  |  |  |  |             GridColumn myCol139 = new GridColumn() { Caption = "验收数量", Visible = true, FieldName = Erp_receiveValidDetail.fields.valid_count.ToString() }; | 
					
						
							|  |  |  |  |             GridColumn myCol140 = new GridColumn() { Caption = "验收结果", Visible = true, FieldName = Erp_receiveValidDetail.fields.validResult.ToString() }; | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |              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" }; | 
					
						
							|  |  |  |  |             GridColumn myCol18 = new GridColumn() { Caption = "说明", Visible = true, FieldName = Erp_purch_d.fields.receiveRemark.ToString() }; | 
					
						
							|  |  |  |  |             GridColumn myCol181 = new GridColumn() { Caption = "说明", Visible = true, FieldName = "reason" }; | 
					
						
							|  |  |  |  |              | 
					
						
							|  |  |  |  |               GridColumn myCol19 = new GridColumn() { Caption = "双人验收", Visible = true, FieldName = "isDouChk" }; | 
					
						
							|  |  |  |  |         //    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 = "em_name" }; | 
					
						
							|  |  |  |  |       //      GridColumn myCol26 = new GridColumn() { Caption = "操作时间", Visible = true, FieldName = "createtime" }; | 
					
						
							|  |  |  |  |               GridColumn myCol150 = new GridColumn() { Caption = "skuId", Visible = true, FieldName = "skuId" }; | 
					
						
							|  |  |  |  |               GridColumn myCol151 = new GridColumn() { Caption = "sku", Visible = true, FieldName = "skuCode" }; | 
					
						
							|  |  |  |  |               GridColumn myCol152 = new GridColumn() { Caption = "货主", Visible = true, FieldName = "ownerName" }; | 
					
						
							|  |  |  |  |               GridColumn myCol153 = new GridColumn() { Caption = "拼音", Visible = true, FieldName = "pinYin" }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             gridview.Columns.Add(myCol2); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             | 
					
						
							|  |  |  |  |                 gridview.Columns.Add(myCol17); | 
					
						
							|  |  |  |  |             //    gridview.Columns.Add(myCol14);  | 
					
						
							|  |  |  |  |            //     gridview.Columns.Add(myCol152); | 
					
						
							|  |  |  |  |                 if (gridview == gridView2) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     gridview.Columns.Add(myCol13); | 
					
						
							|  |  |  |  |                     //   gridview.Columns.Add(myCol132); | 
					
						
							|  |  |  |  |                     //   gridview.Columns.Add(myCol134); | 
					
						
							|  |  |  |  |                     gridview.Columns.Add(myCol131); | 
					
						
							|  |  |  |  |                     gridview.Columns.Add(myCol135); | 
					
						
							|  |  |  |  |                   | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 else | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                     gridview.Columns.Add(myCol150); | 
					
						
							|  |  |  |  |                     | 
					
						
							|  |  |  |  |                     gridview.Columns.Add(myCol151); | 
					
						
							|  |  |  |  |                     gridview.Columns.Add(myCol14);  | 
					
						
							|  |  |  |  |                     gridview.Columns.Add(myCol139); | 
					
						
							|  |  |  |  |                     gridview.Columns.Add(myCol136); | 
					
						
							|  |  |  |  |                     gridview.Columns.Add(myCol140); | 
					
						
							|  |  |  |  |                     gridview.Columns.Add(myCol137); | 
					
						
							|  |  |  |  |                     gridview.Columns.Add(myCol138); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |              //   gridview.Columns.Add(myCol133); | 
					
						
							|  |  |  |  |             //    gridview.Columns.Add(myCol23); | 
					
						
							|  |  |  |  |                   | 
					
						
							|  |  |  |  |                     gridview.Columns.Add(myCol5); | 
					
						
							|  |  |  |  |                     gridview.Columns.Add(myCol19); | 
					
						
							|  |  |  |  |                    // gridview.Columns.Add(myCol14); | 
					
						
							|  |  |  |  |                    // gridview.Columns.Add(myCol13); | 
					
						
							|  |  |  |  |                    // gridview.Columns.Add(myCol5); | 
					
						
							|  |  |  |  |                     gridview.Columns.Add(myCol3); | 
					
						
							|  |  |  |  |               //      gridview.Columns.Add(myCol15); | 
					
						
							|  |  |  |  |                //     gridview.Columns.Add(myCol16); | 
					
						
							|  |  |  |  |                     gridview.Columns.Add(myCol3); | 
					
						
							|  |  |  |  |                | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                // gridview.Columns.Add(myCol8); | 
					
						
							|  |  |  |  |               //  gridview.Columns.Add(myCol9); | 
					
						
							|  |  |  |  |               //  gridview.Columns.Add(myCol10); | 
					
						
							|  |  |  |  |               //  gridview.Columns.Add(myCol11); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 gridview.Columns.Add(myCol2); | 
					
						
							|  |  |  |  |                 gridview.Columns.Add(myCol6); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 gridview.Columns.Add(myCol4); | 
					
						
							|  |  |  |  |                 gridview.Columns.Add(myCol7); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 gridview.Columns.Add(myCol12); | 
					
						
							|  |  |  |  |                 gridview.Columns.Add(myCol1); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 if (gridview == gridView2) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     gridview.Columns.Add(myCol18); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 else | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     gridview.Columns.Add(myCol181); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 gridview.Columns.Add(myCol153); | 
					
						
							|  |  |  |  |             | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             //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() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |              | 
					
						
							|  |  |  |  |             //this.gridviewGoodsType.DataSource = lgt.GetAllActiveData().Tables[0].DefaultView; | 
					
						
							|  |  |  |  |             showWaitForm(); | 
					
						
							|  |  |  |  |             lbVender.Text = ""; | 
					
						
							|  |  |  |  |               | 
					
						
							|  |  |  |  |             try | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 // this.splashScreenManager1.ShowWaitForm(); | 
					
						
							|  |  |  |  |             //    string query = (this.txtOrderNo.Text.Trim().Length == 0 ? "" : string.Format("{0} =#'{1}';","preInOrder" ,filtRiskChar( txtOrderNo.Text.Trim()))); | 
					
						
							| 
									
										
										
										
											2023-09-04 22:41:19 +08:00
										 |  |  |  |                //  query = !string.IsNullOrEmpty(query) ? query : (this.txtOrderNo.Text.Trim().Length == 0 ? "" : string.Format("{0} =#'{1}';", WmsInRequest.fields.preInOrder.ToString(), filtRiskChar(txtOrderNo.Text.Trim()))); | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |                        /*       | 
					
						
							|  |  |  |  |                                + (this.txtVender.Text.Trim().Length == 0 ? "" : string.Format("{0} like # '%{1}%';", "venderName", filtRiskChar(txtVender.Text.Trim()))) | 
					
						
							|  |  |  |  |                                + (this.dateEditFrom.Text.Trim().Length == 0 ? "" : string.Format("{0} >= # '{1}';", Erp_purch.fields.shipDate.ToString(), dateEditFrom.DateTime)) | 
					
						
							|  |  |  |  |                                + (this.dateEditTo.Text.Trim().Length == 0 ? "" : string.Format("{0} <= # '{1}';", Erp_purch.fields.shipDate.ToString(), dateEditTo.DateTime)); | 
					
						
							|  |  |  |  |                             */ | 
					
						
							|  |  |  |  |                 //  + (this.comboState.SelectedIndex < 0 ? "" : string.Format("{0} = #{1};", Erp_purch.fields.wms_state.ToString(),(int)enumInStockOrderStatus.待验收 ));// ((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.queryValidation(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 = inClient.getReceiveDetailByPreInOrder(this.txtOrderNo.Text.Trim());  | 
					
						
							|  |  |  |  |                 dt.PrimaryKey = new DataColumn[] { dt.Columns["ID"] }; | 
					
						
							|  |  |  |  |                 DataView dv = dt.DefaultView; | 
					
						
							|  |  |  |  |                 //bool firstLoad = !isQueryNotChanged || this.gridControl1.DataSource == null; | 
					
						
							|  |  |  |  |                 this.gridControl1.DataSource = dv; | 
					
						
							|  |  |  |  |                 initialDataGridColumns(gridView1); | 
					
						
							|  |  |  |  |                 //update selected row index to the last updated one. | 
					
						
							|  |  |  |  |                 | 
					
						
							|  |  |  |  |                 if (currentRequest !=null) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     selectedRowIndex = -1; | 
					
						
							|  |  |  |  |                     DataRow dr = dt.Rows.Find(currentRequest.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); | 
					
						
							|  |  |  |  |                      | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 setCurrentRequest4ValidateDetail(); | 
					
						
							|  |  |  |  |                 closeWaitForm(); | 
					
						
							|  |  |  |  |                // return cnt; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             catch (Exception e) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 showErrorMsg(e,e.Message); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             closeWaitForm(); | 
					
						
							|  |  |  |  |             return 0;// lgt.getRowCount(query); | 
					
						
							|  |  |  |  |             // return lgt.GetGoodType.QueryCount();  | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         string currrentPreNo = ""; | 
					
						
							|  |  |  |  |         string currrentVenderPinyin = ""; | 
					
						
							|  |  |  |  |         void queryPre() | 
					
						
							|  |  |  |  |         {  | 
					
						
							|  |  |  |  |             lbVender.Text = ""; | 
					
						
							|  |  |  |  |             if (this.txtVender.Text.Trim().Length == 0) | 
					
						
							|  |  |  |  |             {  | 
					
						
							|  |  |  |  |                 return; | 
					
						
							|  |  |  |  |             }  | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             showWaitForm(); | 
					
						
							|  |  |  |  |           //  currrentPreNo = txtOrderNo.Text.Trim(); | 
					
						
							|  |  |  |  |             currrentVenderPinyin = this.txtVender.Text.Trim(); | 
					
						
							|  |  |  |  |             try | 
					
						
							|  |  |  |  |             {  | 
					
						
							|  |  |  |  |              //   dt = inClient.getReceiveDetailByPreInOrder(this.txtOrderNo.Text.Trim()); | 
					
						
							|  |  |  |  |                 dt = inClient.getReceiveDetailByPreInOrder(this.txtOrderNo.Text.Trim()); | 
					
						
							|  |  |  |  |                 dt.PrimaryKey = new DataColumn[] { dt.Columns["ID"] }; | 
					
						
							|  |  |  |  |                 //bool firstLoad = !isQueryNotChanged || this.gridControl1.DataSource == null; | 
					
						
							|  |  |  |  |                | 
					
						
							|  |  |  |  |                 DataView dv = dt.DefaultView; | 
					
						
							|  |  |  |  |                 dv.Sort = "wms_state"; | 
					
						
							|  |  |  |  |                 this.gridControl2.DataSource = dv; | 
					
						
							|  |  |  |  |                 this.initialGridView2Columns(gridView2); | 
					
						
							|  |  |  |  |                 //update selected row index to the last updated one. | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 selectedInIndex = 0; | 
					
						
							|  |  |  |  |                 setCurrentRequest4ValidateDetail(); | 
					
						
							|  |  |  |  |                 closeWaitForm(); | 
					
						
							|  |  |  |  |               | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             catch (Exception e) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 showErrorMsg(e, e.Message); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             closeWaitForm(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |           | 
					
						
							|  |  |  |  |         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); | 
					
						
							|  |  |  |  |                     setCurrentRequest4ValidateDetail(); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 if (isCheckedIn) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     isCheckedIn = false; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                     return; | 
					
						
							|  |  |  |  |                  | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             selectedRowIndex = gridView1.FocusedRowHandle; | 
					
						
							|  |  |  |  |             // showErrorMsg("selection:"+ selectedRowIndex); | 
					
						
							|  |  |  |  |             setCurrentRequest4ValidateDetail(); | 
					
						
							|  |  |  |  |              | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         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 selectedInGoodsName = ""; | 
					
						
							|  |  |  |  |         int selectedId = -1; | 
					
						
							|  |  |  |  |         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; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             */ | 
					
						
							|  |  |  |  |             clearDetail(); | 
					
						
							|  |  |  |  |             if (selectedInIndex < 0)// || selectedInIndex >= dtIndetail.Rows.Count) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return false; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             //  DataRow currentRow = dt.Rows[selectedRowIndex]; | 
					
						
							|  |  |  |  |             DataRowView dr = (DataRowView)(GetGridViewFilteredAndSortedData(gridView2)[selectedInIndex]); | 
					
						
							|  |  |  |  |             selectedInGoodsName = dr["goodsName"].ToString(); | 
					
						
							|  |  |  |  |             selectedId =Convert.ToInt32( dr["id"].ToString()); | 
					
						
							|  |  |  |  |             lbGoodType.Text = dr["type"].ToString(); | 
					
						
							|  |  |  |  |             lbManufacturer.Text = dr["manufacturer"].ToString(); | 
					
						
							|  |  |  |  |             lbUnit.Text = dr["unit"].ToString(); | 
					
						
							|  |  |  |  |              | 
					
						
							|  |  |  |  |             bigcount = Convert.ToDecimal(dr["bigCount"].ToString()); | 
					
						
							|  |  |  |  |             currentDetail = new Erp_purch_d(dr.Row); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             createSKUinputs(currentDetail.goods_id); | 
					
						
							|  |  |  |  |               | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             lbBox.Text =  ((currentDetail.receiveCount - currentDetail.validCount) / bigcount ).ToString("f2"); | 
					
						
							|  |  |  |  |             isDoubleChk =! "0".Equals( dr["IsDouChk"].ToString().Trim()); | 
					
						
							|  |  |  |  |              | 
					
						
							|  |  |  |  |             lgDoulbeChk.Visibility = isDoubleChk ? DevExpress.XtraLayout.Utils.LayoutVisibility.Always | 
					
						
							|  |  |  |  |                     : DevExpress.XtraLayout.Utils.LayoutVisibility.Never;   | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             return true; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void setCurrentInDetail() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             try | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 if (!getCurrentInObject() || selectedInGoodsName == null) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     return; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 /// gridView1.FocusedRowHandle = selectedRowIndex;// | 
					
						
							|  |  |  |  |                 //  gridView1.SelectRow(selectedRowIndex); | 
					
						
							|  |  |  |  |                 showWaitForm(); | 
					
						
							|  |  |  |  |                 | 
					
						
							|  |  |  |  |                 decimal avCnt = currentDetail.receiveCount - currentDetail.validCount; | 
					
						
							|  |  |  |  |                 lbGoodsName.Text = selectedInGoodsName; | 
					
						
							|  |  |  |  |                 lb4ValidateCount.Text = Convert.ToInt32(avCnt) + ""; | 
					
						
							|  |  |  |  |                 this.txtBulkCnt.Text = Convert.ToInt32(avCnt % bigcount) + ""; | 
					
						
							|  |  |  |  |                 textEditSeedsCount.Text = "0"; | 
					
						
							|  |  |  |  |                 txtBatchCount.Text = Convert.ToInt32(avCnt / bigcount) + "";// (currentDetail.receiveCount - currentDetail.validCount).ToString("f0"); | 
					
						
							|  |  |  |  |                 | 
					
						
							|  |  |  |  |                  | 
					
						
							|  |  |  |  |                 btnValidateItem.Enabled = true; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             catch (Exception e) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 showErrorMsg(e.Message); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             closeWaitForm(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |           | 
					
						
							|  |  |  |  |         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(); | 
					
						
							|  |  |  |  |               | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |               | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private bool getCurrentObject() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (selectedRowIndex <0 || selectedRowIndex >= dt.Rows.Count) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return false; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             | 
					
						
							|  |  |  |  |           //  DataRow currentRow = dt.Rows[selectedRowIndex]; | 
					
						
							|  |  |  |  |             DataRowView dr = (DataRowView)(GetGridViewFilteredAndSortedData(gridView2)[selectedRowIndex]); | 
					
						
							|  |  |  |  |             currentRequest = new Erp_purch(dr.Row);  | 
					
						
							|  |  |  |  |           | 
					
						
							|  |  |  |  |             this.gridControl2.DataSource = null; | 
					
						
							|  |  |  |  |           //  btnIn.Enabled = false; | 
					
						
							|  |  |  |  |            | 
					
						
							|  |  |  |  |             lbVender.Text = "";  | 
					
						
							|  |  |  |  |             clearDetail(); | 
					
						
							|  |  |  |  |             return true; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         void clearDetail() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             selectedInGoodsName ="";              | 
					
						
							|  |  |  |  |             lbGoodType.Text = ""; | 
					
						
							|  |  |  |  |             lbManufacturer.Text = ""; | 
					
						
							|  |  |  |  |             txtBatch.Text = ""; | 
					
						
							|  |  |  |  |             txtBatchCount.Text = ""; | 
					
						
							|  |  |  |  |             txtProductDate.Text = ""; | 
					
						
							|  |  |  |  |            txtBulkCnt.Text= lbBox.Text = this.textEditBarcode.Text = lbGoodsName.Text = textEditSeedsCount.Text = | 
					
						
							|  |  |  |  |             this.lb4ValidateCount.Text =    this.textEditValidtionRemark.Text = txtBatch.Text | 
					
						
							|  |  |  |  |             = this.txtProductDate.Text = this.txtValidDate.Text = lbUnit.Text = txtValidDate.Text = "";  | 
					
						
							|  |  |  |  |             seedsCount = 0; | 
					
						
							|  |  |  |  |             bigcount = 0; | 
					
						
							|  |  |  |  |             isDoubleChk = false; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             lgDoulbeChk.Visibility =  DevExpress.XtraLayout.Utils.LayoutVisibility.Never; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             txtAccount.Text = ""; | 
					
						
							|  |  |  |  |             txtPasswd.Text = ""; | 
					
						
							|  |  |  |  |             this.comValidResult.SelectedIndex = 0; | 
					
						
							|  |  |  |  |             btnValidateItem.Enabled = false; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void btnQuery_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             queryPre(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void gridView1_SelectionChanged(object sender, DevExpress.Data.SelectionChangedEventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (gridView1.FocusedRowHandle <0 || gridView1.FocusedRowHandle == selectedRowIndex) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             selectedRowIndex = gridView1.FocusedRowHandle; | 
					
						
							|  |  |  |  |             // showErrorMsg("selection:"+ selectedRowIndex); | 
					
						
							|  |  |  |  |             setCurrentRequest4ValidateDetail(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         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); | 
					
						
							|  |  |  |  |             gridView3.CustomColumnDisplayText += gridView2_CustomColumnDisplayText; | 
					
						
							|  |  |  |  |          //   gridView3.CustomDrawCell += gridView_CustomDrawCell; | 
					
						
							|  |  |  |  |           //  gridView3.RowCellStyle += gridView_RowCellStyle;  | 
					
						
							|  |  |  |  |             this.gridView3.FocusedRowObjectChanged += new DevExpress.XtraGrid.Views.Base.FocusedRowObjectChangedEventHandler(this.gridView2_FocusedRowObjectChanged); | 
					
						
							|  |  |  |  |             this.gridView3.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler(gridView_CustomDrawRowIndicator); | 
					
						
							|  |  |  |  |             this.gridView3.IndicatorWidth = 40; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             gridView1.CustomColumnDisplayText += gridView2_CustomColumnDisplayText; | 
					
						
							|  |  |  |  |             gridView1.CustomDrawCell += gridView_CustomDrawCell; | 
					
						
							|  |  |  |  |           | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         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 | 
					
						
							|  |  |  |  |                         { | 
					
						
							| 
									
										
										
										
											2023-09-04 22:41:19 +08:00
										 |  |  |  |                             display = Convert.ToInt32(e.DisplayText); | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |                             if (sender == gridView2) | 
					
						
							|  |  |  |  |                             { | 
					
						
							|  |  |  |  |                                 e.DisplayText = this.enumReceiveDetailStatus[display]; | 
					
						
							|  |  |  |  |                             } | 
					
						
							|  |  |  |  |                             else | 
					
						
							|  |  |  |  |                             { | 
					
						
							|  |  |  |  |                                 e.DisplayText = this.inRequestStatus[display]; | 
					
						
							|  |  |  |  |                             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                         catch | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             return; | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                     // e.DisplayText = stockInLocationStatus.ContainsKey(display) ? stockInLocationStatus[display] : display+""; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 else if (e.Column.FieldName == "validResult") | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     if (!stockInLocationStatus.ContainsValue(e.DisplayText)) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                         int display = -100; | 
					
						
							|  |  |  |  |                         string disTxt = e.DisplayText; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                         try | 
					
						
							|  |  |  |  |                         { | 
					
						
							| 
									
										
										
										
											2023-09-04 22:41:19 +08:00
										 |  |  |  |                             display = Convert.ToInt32(e.DisplayText); | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |                             e.DisplayText = this.whType[display]; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                         catch | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             return; | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 else if (e.Column.FieldName == "IsDouChk") | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                     if (!isDoublChk.ContainsValue(e.DisplayText)) | 
					
						
							|  |  |  |  |                     {  | 
					
						
							|  |  |  |  |                         string disTxt = e.DisplayText; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                         try | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                             e.DisplayText =  isDoublChk[disTxt]; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                         catch | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             return; | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |        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 == "IsDouChk" && 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; | 
					
						
							|  |  |  |  |                } | 
					
						
							|  |  |  |  |              | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |            } | 
					
						
							|  |  |  |  |        } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |        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; | 
					
						
							|  |  |  |  |            } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |            string state = 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 == "3"  ) | 
					
						
							|  |  |  |  |            { | 
					
						
							|  |  |  |  |                rowStyle = isFocused ? passedFocus : passed; | 
					
						
							|  |  |  |  |            } | 
					
						
							|  |  |  |  |            else  if (state == "1") | 
					
						
							|  |  |  |  |            { | 
					
						
							|  |  |  |  |                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 setCurrentRequest4ValidateDetail() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |              | 
					
						
							|  |  |  |  |             this.gridControl3.DataSource = null; | 
					
						
							|  |  |  |  |             if (  currentRequest == null) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             /// gridView1.FocusedRowHandle = selectedRowIndex;// | 
					
						
							|  |  |  |  |             //  gridView1.SelectRow(selectedRowIndex); | 
					
						
							|  |  |  |  |             showWaitForm(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             lbVender.Text = currentRequest.vender; | 
					
						
							|  |  |  |  |              | 
					
						
							|  |  |  |  |             try | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 isShowingInRequest = true;  | 
					
						
							|  |  |  |  |                 | 
					
						
							|  |  |  |  |                 selectedInIndex = gridView2.FocusedRowHandle; | 
					
						
							|  |  |  |  |                 setCurrentInDetail(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                //setCurrentRequestValidatedDetail(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 | 
					
						
							|  |  |  |  |   | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             catch (Exception e) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 showErrorMsg(e.Message); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             closeWaitForm(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void setCurrentRequestValidatedDetail() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             this.gridControl3.DataSource = null; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |           //  if (!getCurrentObject() || selectedRequest == null) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |              //   return; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             /// gridView1.FocusedRowHandle = selectedRowIndex;// | 
					
						
							|  |  |  |  |             //  gridView1.SelectRow(selectedRowIndex); | 
					
						
							|  |  |  |  |           //  showWaitForm(); | 
					
						
							|  |  |  |  |               | 
					
						
							|  |  |  |  |             try | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 isShowingInRequest = true; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 //  dtIndetail = inClient.getRequestInStockDetail(selectedRequest.orderNo); | 
					
						
							|  |  |  |  |                 //  closeClient(); | 
					
						
							|  |  |  |  |                 //selectedInIndex = -1; | 
					
						
							|  |  |  |  |             //    DataTable dt1 = inClient.getValidedInDetail(selectedRequest.pur_order, (int)enumReceiveStockDetailStatus.待入库); | 
					
						
							|  |  |  |  |                 DataTable dt1 = inClient.getValidedInDetail(currentRequest.pur_order,-1); | 
					
						
							|  |  |  |  |                 closeClient(); | 
					
						
							|  |  |  |  |                 this.gridControl3.DataSource = dt1; | 
					
						
							|  |  |  |  |                 initialGridView2Columns(gridView3); | 
					
						
							|  |  |  |  |                // selectedInIndex = gridView3.FocusedRowHandle; | 
					
						
							|  |  |  |  |               //  setCurrentInDetail(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             catch (Exception e) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 showErrorMsg(e.Message); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             closeWaitForm(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void btnIn_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             /* | 
					
						
							|  |  |  |  |             int lastSelectedIndex = 0; | 
					
						
							|  |  |  |  |             showWaitForm(); | 
					
						
							|  |  |  |  |             try | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |              //   lgt.requestInStock(selectedRequest.orderNo); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 decimal arriveNumber = Convert.ToDecimal(txtArrave.Text.ToString().Trim()); | 
					
						
							|  |  |  |  |                 decimal number = Convert.ToDecimal(textEditReceiveNum.Text.ToString().Trim()); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 if (arriveNumber < number) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     showErrorMsg("收货、拒收数量不能大于到货数量。"); | 
					
						
							|  |  |  |  |                     return; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 if (number + currentDetail.receiveCount > currentDetail.count) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     showInfoMsg("数量超收。"); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 int receiveType =this.comboPdStatus.SelectedIndex ; | 
					
						
							|  |  |  |  |                 inClient.receiveDetail(selectedId,arriveNumber, number, receiveType, filtRiskChar(memPdRemark.Text.Trim())); | 
					
						
							|  |  |  |  |                 closeClient(); | 
					
						
							|  |  |  |  |                 lastSelectedIndex = gridView2.FocusedRowHandle; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 isCheckedIn = true; | 
					
						
							|  |  |  |  |               //  query(); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             catch (Exception er) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |               //  setCurrentRequestDetail(); | 
					
						
							|  |  |  |  |                 showErrorMsg(er.Message); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             setCurrentRequest4ValidateDetail(); | 
					
						
							|  |  |  |  |             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.setCurrentRequest4ValidateDetail(); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 switchGridViewRowSelection(gridView1, true); | 
					
						
							|  |  |  |  |                 | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             | 
					
						
							|  |  |  |  |             else | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 switchGridViewRowSelection((GridView)sender, true); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |           | 
					
						
							|  |  |  |  |         void textEditBarcode_MouseUp(object sender, MouseEventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             //如果鼠标左键操作并且标记存在,则执行全选              | 
					
						
							|  |  |  |  |             if (e.Button == MouseButtons.Left && textEditBarcode.Tag != null && (bool)textEditBarcode.Tag == true) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 textEditBarcode.SelectAll(); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             //取消全选标记               | 
					
						
							|  |  |  |  |             textEditBarcode.Tag = false; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         void textEditBarcode_GotFocus(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             textEditBarcode.Tag = true;    //设置标记               | 
					
						
							|  |  |  |  |             textEditBarcode.SelectAll();   //注意1          | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void txtQuery_KeyDown(object sender, KeyEventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (e.KeyCode != Keys.Enter) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             string barcode = this.textEditBarcode.Text.Trim(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             DataView dv = dt.DefaultView; | 
					
						
							|  |  |  |  |             dv.RowFilter = ""; | 
					
						
							|  |  |  |  |             this.gridControl2.DataSource = dv; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (string.IsNullOrEmpty(barcode)) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             dv.RowFilter = string.Format("pinYin like'%{0}%'", barcode); | 
					
						
							|  |  |  |  |            | 
					
						
							|  |  |  |  |             if (dv.Count == 0) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 clearDetail(); | 
					
						
							|  |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             setCurrentInDetail(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         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 bool isValidInput(StructsValideIn svi) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (String.IsNullOrEmpty(svi.flowNo.Trim())) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                // showErrorMsg("请输入验收托盘码"); | 
					
						
							|  |  |  |  |               //  txtFlowNo.Focus(); | 
					
						
							|  |  |  |  |                 svi.flowNo = currrentPreNo; | 
					
						
							|  |  |  |  |                // return false; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (svi.seeds_count <=0  ) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 showErrorMsg("请输入抽样数量"); | 
					
						
							|  |  |  |  |                 textEditSeedsCount.Focus(); | 
					
						
							|  |  |  |  |                 return false; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (svi.seeds_count > svi.valid_count) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 showErrorMsg("抽样数量不能大于验收数量"); | 
					
						
							|  |  |  |  |                 textEditSeedsCount.Focus(); | 
					
						
							|  |  |  |  |                 return false; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             if (svi.valid_count <= 0 ||svi.valid_count > currentDetail.receiveCount - currentDetail.validCount) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 showErrorMsg("请输入正确的验收数量"); | 
					
						
							|  |  |  |  |                 txtBatchCount.Focus(); | 
					
						
							|  |  |  |  |                 return false; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |              /* | 
					
						
							|  |  |  |  |             if (String.IsNullOrEmpty(svi.batch)) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 showErrorMsg("请输入批号信息");  | 
					
						
							|  |  |  |  |                 return false; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |              | 
					
						
							|  |  |  |  |             if (string.IsNullOrEmpty(svi.product_date)) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 showErrorMsg("请输入生产日期"); | 
					
						
							|  |  |  |  |                  | 
					
						
							|  |  |  |  |                 return false; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             if (string.IsNullOrEmpty(svi.save_date)) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 showErrorMsg("请输入失效日期"); | 
					
						
							|  |  |  |  |                 | 
					
						
							|  |  |  |  |                 return false; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |            DateTime prdDate = DateTime.ParseExact(svi.product_date, WmsConstants.GOODS_VALID_DATE_FORMAT, System.Globalization.CultureInfo.CurrentCulture); | 
					
						
							|  |  |  |  |            DateTime vldDate = DateTime.ParseExact(svi.save_date, WmsConstants.GOODS_VALID_DATE_FORMAT, System.Globalization.CultureInfo.CurrentCulture); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |            if (prdDate >= DateTime.Now) | 
					
						
							|  |  |  |  |            { | 
					
						
							|  |  |  |  |                showErrorMsg("生产日期错误"); | 
					
						
							|  |  |  |  |              //txtProductDate.Focus(); | 
					
						
							|  |  |  |  |                return false; | 
					
						
							|  |  |  |  |            } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |            if (vldDate <= DateTime.Now) | 
					
						
							|  |  |  |  |            { | 
					
						
							|  |  |  |  |                showErrorMsg("产品过期"); | 
					
						
							|  |  |  |  |               // txtValidDate.Focus(); | 
					
						
							|  |  |  |  |                return false; | 
					
						
							|  |  |  |  |            } | 
					
						
							|  |  |  |  |            if (vldDate <= prdDate) | 
					
						
							|  |  |  |  |            { | 
					
						
							|  |  |  |  |                showErrorMsg("效期错误,请检查输入的效期、生产日期"); | 
					
						
							|  |  |  |  |                //txtValidDate.Focus(); | 
					
						
							|  |  |  |  |                return false; | 
					
						
							|  |  |  |  |            } | 
					
						
							|  |  |  |  |             */ | 
					
						
							|  |  |  |  |             if (isDoubleChk ) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 if( string.IsNullOrEmpty(txtAccount.Text) || string.IsNullOrEmpty(txtPasswd.Text.Trim())){ | 
					
						
							|  |  |  |  |                     showErrorMsg("重点商品,需要双人验收!"); | 
					
						
							|  |  |  |  |                     this.txtAccount.Focus(); | 
					
						
							|  |  |  |  |                     return false; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 if (!checkPermission(WmsConstants.SPECIAL_AUTHS_DOUBLE_CHECK)) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     showErrorMsg(LoginInfo.Account + " 权限不足,需要特殊权限:" + WmsConstants.SPECIAL_AUTHS_DOUBLE_CHECK); | 
					
						
							|  |  |  |  |                     return false; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                | 
					
						
							|  |  |  |  |                  | 
					
						
							|  |  |  |  |                 if ( checkPermission(svi.validAccount1, txtPasswd.Text, WmsConstants.SPECIAL_AUTHS_DOUBLE_CHECK)<=0) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     showErrorMsg(svi.validAccount1 + " 权限不足,需要特殊权限:" + WmsConstants.SPECIAL_AUTHS_DOUBLE_CHECK); | 
					
						
							|  |  |  |  |                     return false; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 }  | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             return true; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void btnValidateItem_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             doValidation(); | 
					
						
							|  |  |  |  |              | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         void doValidation() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             try | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 showWaitForm(); | 
					
						
							|  |  |  |  |                 txtProductDate.Text = getValidDate(txtProductDate.Text); | 
					
						
							|  |  |  |  |                 txtValidDate.Text = getValidDate(txtValidDate.Text); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 StructsValideIn svi = new StructsValideIn(); | 
					
						
							|  |  |  |  |                 svi.preInOrder = currrentPreNo; | 
					
						
							|  |  |  |  |                 svi.flowNo = txtFlowNo.Text; | 
					
						
							|  |  |  |  |                 //  svi.batch = txtBatch.Text; | 
					
						
							|  |  |  |  |                 svi.goods_id = currentDetail.goods_id; | 
					
						
							|  |  |  |  |                 // svi.product_date = txtProductDate.Text; | 
					
						
							|  |  |  |  |                 // svi.save_date = txtValidDate.Text; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-04 22:41:19 +08:00
										 |  |  |  |                 decimal count = Convert.ToInt32(txtBatchCount.Text) * bigcount + Convert.ToInt32(this.txtBulkCnt.Text); | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 svi.seeds_count = Convert.ToDecimal(textEditSeedsCount.Text); | 
					
						
							|  |  |  |  |                 svi.valid_count = count; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 svi.validby = LoginInfo.UserId; | 
					
						
							|  |  |  |  |                 svi.validAccount = LoginInfo.Account; | 
					
						
							|  |  |  |  |                 svi.validAccount1 = ""; | 
					
						
							|  |  |  |  |                 // svi.validby1 = -1; | 
					
						
							|  |  |  |  |                 if (isDoubleChk) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     svi.validby1 = validUser(svi.validAccount1, txtPasswd.Text); | 
					
						
							|  |  |  |  |                     svi.validAccount1 = filtRiskChar(txtAccount.Text); | 
					
						
							|  |  |  |  |                     //   svi.validPasswd = Util.Encrypt(txtPasswd.Text); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 svi.reason = filtRiskChar(textEditValidtionRemark.Text.Trim()); | 
					
						
							|  |  |  |  |                 | 
					
						
							|  |  |  |  |                 svi.receive_order = currentDetail.pur_order; | 
					
						
							|  |  |  |  |                 svi.purch_d_id = currentDetail.ID; | 
					
						
							|  |  |  |  |                 svi.wms_state = (int)enumReceiveStockDetailStatus.已验收; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 if (!validSkus()) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     closeWaitForm(); | 
					
						
							|  |  |  |  |                     return; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 svi.batch = ""; | 
					
						
							|  |  |  |  |                 svi.product_date = ""; | 
					
						
							|  |  |  |  |                 svi.save_date = ""; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |               | 
					
						
							|  |  |  |  |                 if (skuValues.ContainsKey(WmsConstants.SKU_RESEVRED_BATCH_ATTNAME)) | 
					
						
							|  |  |  |  |                     svi.batch = skuValues[WmsConstants.SKU_RESEVRED_BATCH_ATTNAME]; | 
					
						
							|  |  |  |  |                 if (skuValues.ContainsKey(WmsConstants.SKU_RESEVRED_PRDDATE_ATTNAME)) | 
					
						
							|  |  |  |  |                     svi.product_date = skuValues[WmsConstants.SKU_RESEVRED_PRDDATE_ATTNAME]; | 
					
						
							|  |  |  |  |                 if (skuValues.ContainsKey(WmsConstants.SKU_RESEVRED_EXPIREDATE_ATTNAME)) | 
					
						
							|  |  |  |  |                     svi.save_date = skuValues[WmsConstants.SKU_RESEVRED_EXPIREDATE_ATTNAME];  | 
					
						
							|  |  |  |  |                 if (skuValues.ContainsKey(WmsConstants.SKU_RESEVRED_ENTI_ATTNAME)) | 
					
						
							|  |  |  |  |                     svi.entId = skuValues[WmsConstants.SKU_RESEVRED_ENTI_ATTNAME]; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                  /*if (comValidResult.SelectedIndex == 0 && tbDest.SelectedTabPageIndex == 1)//越仓 | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     svi.cachePartion = ((Node)this.combCache.SelectedItem).ID; | 
					
						
							|  |  |  |  |                     svi.validResult = (int)enumWhType.越仓收货区; | 
					
						
							|  |  |  |  |                 }*/ | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 string[] skuKeys = { WmsConstants.SKU_RESEVRED_PRDDATE_ATTNAME, WmsConstants.SKU_RESEVRED_EXPIREDATE_ATTNAME, WmsConstants.SKU_RESEVRED_BATCH_ATTNAME }; | 
					
						
							|  |  |  |  |                 string[] skuValuess = { svi.product_date, svi.save_date, svi.batch }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 if (comValidResult.SelectedIndex == 0) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     svi.validResult = (int)enumWhType.合格库; | 
					
						
							|  |  |  |  |                     if (currentDetail.storeType == 1)//越仓 | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         svi.zhitongPartion = currentDetail.zhitongPartion; | 
					
						
							|  |  |  |  |                         svi.validResult = (int)enumWhType.越仓收货区; | 
					
						
							|  |  |  |  |                         svi.whType = svi.validResult; | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 else | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     svi.validResult = (int)enumWhType.不合格库; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 if (!isValidInput(svi)) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     closeWaitForm(); | 
					
						
							|  |  |  |  |                     return; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 if (string.IsNullOrEmpty(svi.flowNo)) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     svi.flowNo = svi.preInOrder; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 bool checkExp = !checkPermission(WmsConstants.SPECIAL_VALID_NEAR_EXPIRED); | 
					
						
							|  |  |  |  |               enumValidInResult result =  inClient.validIn(svi.preInOrder, svi.flowNo, svi.goods_id, | 
					
						
							| 
									
										
										
										
											2023-11-21 19:18:23 +08:00
										 |  |  |  |                     svi.valid_count, svi.seeds_count, skuKeys, skuValuess, true, true,false, svi.validby1,0, checkExp); | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |               if (result != enumValidInResult.成功) | 
					
						
							|  |  |  |  |               { | 
					
						
							|  |  |  |  |                   throw new Exception(result.ToString()); | 
					
						
							|  |  |  |  |               } | 
					
						
							|  |  |  |  |               this.queryPre(); | 
					
						
							|  |  |  |  |                // closeClient(); | 
					
						
							|  |  |  |  |                // setCurrentRequest4ValidateDetail();// this.setCurrentInDetail(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 closeWaitForm(); | 
					
						
							|  |  |  |  |                 //  query(); | 
					
						
							|  |  |  |  |               clearDetail(); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             catch (Exception er) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 closeClient(); | 
					
						
							|  |  |  |  |                 closeWaitForm(); | 
					
						
							|  |  |  |  |                 showErrorMsg(er.Message); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |              | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         private void txtBatchCount_EditValueChanged(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             setSeedCnt(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         void setSeedCnt() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             try | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 if (string.IsNullOrEmpty(txtBatchCount.Text)) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     txtBatchCount.Text = ""; | 
					
						
							|  |  |  |  |                     return; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 decimal batchCount = Convert.ToDecimal(txtBatchCount.Text.Trim()); | 
					
						
							|  |  |  |  |                 decimal bulkcnt = Convert.ToDecimal(this.txtBulkCnt.Text.Trim()); | 
					
						
							|  |  |  |  |                 decimal boxcnt = batchCount; | 
					
						
							|  |  |  |  |                 decimal seedsStep = WmsConstants.GOODS_IN_VALID_SEEDS_BOXS_STEP; | 
					
						
							|  |  |  |  |                 decimal minStep = WmsConstants.GOODS_IN_VALID_SEEDS_BOXS_STEP_MIN; ; | 
					
						
							|  |  |  |  |                 decimal stepFactor = WmsConstants.GOODS_IN_VALID_SEEDS_BOXS_STEP_FACTOR; ; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 if (batchCount +bulkcnt > currentDetail.receiveCount - currentDetail.validCount) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     throw new Exception("验收数量不能大于可用数量"); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 if (boxcnt < seedsStep) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     if (boxcnt > minStep) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         seedsCount = minStep; | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                     else | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         seedsCount = boxcnt; | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 else | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     seedsCount = minStep + Math.Ceiling((boxcnt - seedsStep) / seedsStep) * stepFactor; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 seedsCount = seedsCount * bigcount + bulkcnt; | 
					
						
							|  |  |  |  |                 textEditSeedsCount.Text = seedsCount + ""; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             catch (Exception er) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 showErrorMsg(er.Message); | 
					
						
							|  |  |  |  |                 txtBatchCount.Focus(); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         string getValidDate(string strDate,bool isLeft = true) | 
					
						
							|  |  |  |  |         {   | 
					
						
							|  |  |  |  |             string[] invailidChars = { ".", "-", "/" }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             foreach (string s in invailidChars) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 if (WmsConstants.GOODS_VALID_DATE_FORMAT.IndexOf(s) == -1) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     strDate = strDate.Replace(s, ""); | 
					
						
							|  |  |  |  |                   | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (strDate.Length < 6 || strDate.Length > 8 ) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 if (WmsConstants.IN_STOCK_CHECK_DATE) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     return ""; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             if (isLeft) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 strDate += strDate.Length == 6 ? "01" : ""; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             else | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 strDate += strDate.Length == 6 ? "28" : ""; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             return strDate; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         //-----------create sku input controls | 
					
						
							|  |  |  |  |       //  List<LotAtt> ATTs = new List<LotAtt>(); | 
					
						
							|  |  |  |  |         Dictionary<LotAtt, BaseEdit> SKUs = new Dictionary<LotAtt, BaseEdit>(); | 
					
						
							|  |  |  |  |         int lastLotId =0; | 
					
						
							|  |  |  |  |         private void createSKUinputs(string goodsId) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |              | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             DataTable lotAtts =null; | 
					
						
							|  |  |  |  |             using (LotServiceClient client = new LotServiceClient("BasicHttpBinding_ILotService", | 
					
						
							|  |  |  |  |           buildSvrAddress("LotService.svc"))) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 try | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     showWaitForm(); | 
					
						
							|  |  |  |  |                     lotAtts = client.getLotAtts(goodsId); | 
					
						
							|  |  |  |  |                     closeWaitForm(); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 catch (Exception e) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     closeWaitForm(); | 
					
						
							|  |  |  |  |                     showErrorMsg(e, "出错了"); | 
					
						
							|  |  |  |  |                     return; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             List<LayoutControlItem> liSKU = new List<LayoutControlItem>(); | 
					
						
							|  |  |  |  |             | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             int pjCount = lotAtts.Rows.Count; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (pjCount == 0) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 lastLotId  = 0; | 
					
						
							|  |  |  |  |                 lcgSKUGroup.BeginUpdate(); | 
					
						
							|  |  |  |  |                 lcgSKUGroup.Clear(); | 
					
						
							|  |  |  |  |                 lcgSKUGroup.Items.Clear(); | 
					
						
							|  |  |  |  |                 lcgSKUGroup.EndUpdate(); | 
					
						
							|  |  |  |  |                 SKUs.Clear(); | 
					
						
							|  |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-04 22:41:19 +08:00
										 |  |  |  |           int lotId = Convert.ToInt32( lotAtts.Rows[0]["lotId"].ToString()); | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |           if (lastLotId == lotId) //批次定义相同,不需从新创建sku控件 | 
					
						
							|  |  |  |  |           { | 
					
						
							|  |  |  |  |               foreach (LotAtt la in SKUs.Keys) | 
					
						
							|  |  |  |  |               { | 
					
						
							|  |  |  |  |                   if (la.isList && la.listId > 0) | 
					
						
							|  |  |  |  |                   { | 
					
						
							|  |  |  |  |                       ((ComboBoxEdit)SKUs[la]).SelectedIndex = 0; | 
					
						
							|  |  |  |  |                   } | 
					
						
							|  |  |  |  |                   else | 
					
						
							|  |  |  |  |                   { | 
					
						
							|  |  |  |  |                       ((TextEdit)SKUs[la]).Text = ""; | 
					
						
							|  |  |  |  |                   } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |               } | 
					
						
							|  |  |  |  |               return; | 
					
						
							|  |  |  |  |           } | 
					
						
							|  |  |  |  |           lastLotId = lotId; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             lcgSKUGroup.BeginUpdate(); | 
					
						
							|  |  |  |  |             lcgSKUGroup.Clear(); | 
					
						
							|  |  |  |  |             lcgSKUGroup.Items.Clear(); | 
					
						
							|  |  |  |  |             lcgSKUGroup.EndUpdate(); | 
					
						
							|  |  |  |  |             SKUs.Clear(); | 
					
						
							|  |  |  |  |              | 
					
						
							|  |  |  |  |             LayoutControlItem lastItem = null; | 
					
						
							|  |  |  |  |             int i = 0; | 
					
						
							|  |  |  |  |             foreach (DataRow dr in lotAtts.Rows) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                | 
					
						
							|  |  |  |  |                 BaseEdit be; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 LotAtt la = new LotAtt(dr); | 
					
						
							|  |  |  |  |                 enumLotAttType enLt = (enumLotAttType)la.attType; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 if (la.isList && la.listId >0) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                     be = new ComboBoxEdit(); | 
					
						
							|  |  |  |  |                     initialSkuComs((ComboBoxEdit)be, la.listId); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 else | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     be = new TextEdit(); | 
					
						
							|  |  |  |  |                       | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                     switch (enLt) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         case enumLotAttType.数字: | 
					
						
							|  |  |  |  |                             ((TextEdit)be).Properties.Mask.EditMask = "n2"; | 
					
						
							|  |  |  |  |                             ((TextEdit)be).Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; | 
					
						
							|  |  |  |  |                             break; | 
					
						
							|  |  |  |  |                         case enumLotAttType.字符: | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                             break; | 
					
						
							|  |  |  |  |                         case enumLotAttType.日期: | 
					
						
							|  |  |  |  |                            // be = new DateEdit(); | 
					
						
							|  |  |  |  |                               be.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 20F); | 
					
						
							|  |  |  |  |                               be.Properties.Appearance.Options.UseFont = true; | 
					
						
							|  |  |  |  |                               be.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.DateTime; | 
					
						
							|  |  |  |  |                                 be.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.DateTime; | 
					
						
							|  |  |  |  |                                ((TextEdit) be).Properties.Mask.AutoComplete = DevExpress.XtraEditors.Mask.AutoCompleteType.None; | 
					
						
							|  |  |  |  |                                ((TextEdit)be).Properties.Mask.EditMask = "([123][0-9])?[0-9][0-9](0?[1-9]|1[012])([012]?[1-9]|[123]0|31)"; | 
					
						
							|  |  |  |  |                                ((TextEdit)be).Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.RegEx; | 
					
						
							|  |  |  |  |                                  | 
					
						
							|  |  |  |  |                                // be.StyleController = this.layoutControl1; | 
					
						
							|  |  |  |  |                                 be.TabIndex = 44; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                             break; | 
					
						
							|  |  |  |  |                         default: | 
					
						
							|  |  |  |  |                             break; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 be.Name = "SKU" + la.ID; | 
					
						
							|  |  |  |  |                 be.TabIndex = 40 + (i * 8); | 
					
						
							|  |  |  |  |                 be.Properties.Appearance.Font = new System.Drawing.Font("微软雅黑", 16F); | 
					
						
							|  |  |  |  |                 if (!la.isOptional) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     be.Properties.Appearance.ForeColor = Color.Red; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 be.Properties.Appearance.Options.UseFont = true; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 LayoutControlItem item = lcgSKUGroup.AddItem(la.attName, be) as LayoutControlItem; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 item.MaxSize = new System.Drawing.Size(270, 44); | 
					
						
							|  |  |  |  |                 item.MinSize = new System.Drawing.Size(270, 44); | 
					
						
							|  |  |  |  |                 item.Name = "lci" + la.attName; | 
					
						
							|  |  |  |  |                 item.Padding = new DevExpress.XtraLayout.Utils.Padding(20, 2, 2, 2); | 
					
						
							|  |  |  |  |                 item.Size = new System.Drawing.Size(839, 44); | 
					
						
							|  |  |  |  |                 item.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom; | 
					
						
							|  |  |  |  |                // this.layoutControlItem2.Text = "批次信息"; | 
					
						
							|  |  |  |  |                 item.TextSize = new System.Drawing.Size(51, 14); | 
					
						
							|  |  |  |  |                   | 
					
						
							|  |  |  |  |                 if (lastItem != null && i%4!=0) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     item.Move(lastItem, DevExpress.XtraLayout.Utils.InsertType.Right); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 lastItem = item;  | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 SKUs.Add(la, be); | 
					
						
							|  |  |  |  |                 i++; | 
					
						
							|  |  |  |  |                  | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             lcgSKUGroup.EndUpdate(); | 
					
						
							|  |  |  |  |                                     /*liSKU.Add(item); | 
					
						
							|  |  |  |  |                                     DevExpress.XtraEditors.TextEdit txtSKU = new DevExpress.XtraEditors.TextEdit(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                                     txtSKU.Anchor = System.Windows.Forms.AnchorStyles.None; | 
					
						
							|  |  |  |  |                                     txtSKU.Location = new System.Drawing.Point(4, 30 + (i * 30)); | 
					
						
							|  |  |  |  |                                     txtSKU.Name = "txtSKU" + (SerialNum + (i * 8)); | 
					
						
							|  |  |  |  |                                     txtSKU.Properties.Appearance.Font = new System.Drawing.Font("微软雅黑", 10F); | 
					
						
							|  |  |  |  |                                     txtSKU.Properties.Appearance.Options.UseFont = true; | 
					
						
							|  |  |  |  |                                     txtSKU.Size = new System.Drawing.Size(129, 26); | 
					
						
							|  |  |  |  |                                     txtSKU.TabIndex = 40 + (i * 8); | 
					
						
							|  |  |  |  |                                     txtSKU.Text = textEdit18.Text.Trim(); | 
					
						
							|  |  |  |  |                                     tableLayoutPanel4.Controls.Add(txtSKU, 0, i + 2); | 
					
						
							|  |  |  |  |                                     liSKU.Add(txtSKU); | 
					
						
							|  |  |  |  |                                 } | 
					
						
							|  |  |  |  |              | 
					
						
							|  |  |  |  |              | 
					
						
							|  |  |  |  |                             for (int i = 0; i < liSKU.Count; i++) | 
					
						
							|  |  |  |  |                             { | 
					
						
							|  |  |  |  |                                 StrSKU = StrSKU + ",{\"sku\":\"" + liSKU[i].Text + "\",\"CNNAME\":\"" + liCNNAME[i].Text + "\",\"ENNAME\":\"" + liENNAME[i].Text + "\",\"MATERIALQUANTITY\":\"" + liMATERIALQUANTITY[i].Text + "\",\"WEIGHT\":\"" + liWEIGHTS[i].Text + "\",\"PRICE\":\"" + liPRICE[i].Text + "\",\"CUSTOMCCODE\":\"" + liCUSTOMCCODE[i].Text + "\",\"PRODUCINGAREA\":\"" + liPRODUCINGAREA[i].Text + "\"}"; | 
					
						
							|  |  |  |  |                             } | 
					
						
							|  |  |  |  |                             */ | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         void initialSkuComs(ComboBoxEdit combo, int listId) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             DataRow[] drs = Park.getDictionary().Select("flag = 7000"); | 
					
						
							|  |  |  |  |             foreach (DataRow dr in drs) | 
					
						
							|  |  |  |  |             {  | 
					
						
							|  |  |  |  |                 /* | 
					
						
							|  |  |  |  |                  * int flag = Convert.ToInt32(dr["flag"].ToString()); | 
					
						
							|  |  |  |  |                 if (flag != 7000) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     continue; | 
					
						
							|  |  |  |  |                 } */ | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 int parentId = Convert.ToInt32(dr["id"].ToString()); | 
					
						
							|  |  |  |  |                 DataRow[] drss = Park.getDictionary(false).Select("parentId =" + parentId +" and flag =" +listId); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 foreach (DataRow dr1 in drss) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     parentId = Convert.ToInt32(dr1["id"].ToString()); | 
					
						
							|  |  |  |  |                     DataRow[] drsss = Park.getDictionary(false).Select("parentId =" + parentId  );   | 
					
						
							|  |  |  |  |                     initialComboBoxs( combo, drsss,true,"请选择" ); | 
					
						
							|  |  |  |  |                     break; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                   | 
					
						
							|  |  |  |  |                 break; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             }  | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         string skuCode = ""; | 
					
						
							|  |  |  |  |         Dictionary<string, string> skuValues = new Dictionary<string, string>(); | 
					
						
							|  |  |  |  |         | 
					
						
							|  |  |  |  |         private bool validSkus() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             skuCode = ""; | 
					
						
							|  |  |  |  |             skuValues.Clear(); | 
					
						
							|  |  |  |  |             Dictionary<string, string> skuCodes = new Dictionary<string, string>(); | 
					
						
							|  |  |  |  |             bool isOptional = false; | 
					
						
							|  |  |  |  |             foreach (LotAtt la in SKUs.Keys) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 isOptional = la.isOptional; | 
					
						
							|  |  |  |  |                 if (la.isList && la.listId > 0) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     ComboBoxEdit co = (ComboBoxEdit)SKUs[la]; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                     if (co.SelectedIndex == 0) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         if (!la.isOptional) | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             showErrorMsg("请选择" + la.attName); | 
					
						
							|  |  |  |  |                             co.Focus(); | 
					
						
							|  |  |  |  |                             return false; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                         else | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             continue; | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                     skuValues.Add(la.attName, ((Node)co.SelectedItem).ID + ""); | 
					
						
							|  |  |  |  |                     skuCodes.Add(la.attName, co.Text); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 else | 
					
						
							|  |  |  |  |                 {  | 
					
						
							|  |  |  |  |                     TextEdit txt = (TextEdit)SKUs[la]; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                     if (string.IsNullOrEmpty(txt.Text)) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         if (!la.isOptional) | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             showErrorMsg("请输入" + la.attName); | 
					
						
							|  |  |  |  |                             txt.Focus(); | 
					
						
							|  |  |  |  |                             return false; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                         else | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             continue; | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                     enumLotAttType enLt = (enumLotAttType)la.attType; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                     switch (enLt) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         case enumLotAttType.数字: | 
					
						
							|  |  |  |  |                             skuValues.Add(la.attName, filtRiskChar(txt.Text)); | 
					
						
							|  |  |  |  |                             break; | 
					
						
							|  |  |  |  |                         case enumLotAttType.字符: | 
					
						
							|  |  |  |  |                             skuValues.Add(la.attName, filtRiskChar(txt.Text)); | 
					
						
							|  |  |  |  |                             break; | 
					
						
							|  |  |  |  |                         case enumLotAttType.日期: | 
					
						
							|  |  |  |  |                             DateTime date = DateTime.ParseExact(txt.Text, WmsConstants.GOODS_VALID_DATE_FORMAT, System.Globalization.CultureInfo.CurrentCulture); | 
					
						
							|  |  |  |  |                              | 
					
						
							|  |  |  |  |                             //  skuValues.Add(la.attName, date.ToString()); | 
					
						
							|  |  |  |  |                             skuValues.Add(la.attName, txt.Text); | 
					
						
							|  |  |  |  |                             break; | 
					
						
							|  |  |  |  |                         default: | 
					
						
							|  |  |  |  |                             break; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                     skuCodes.Add(la.attName, filtRiskChar(txt.Text)); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 if (!isOptional) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     skuCode += string.Format("{0}:{1};", la.attName, skuCodes[la.attName]); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             skuCode = string.Format("{0}:{1};", "goodsId", currentDetail.goods_id) + skuCode; | 
					
						
							|  |  |  |  |             return true; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void btnCache_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             doValidation(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void txtOrderNo_KeyDown(object sender, KeyEventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (e.KeyCode != Keys.Enter) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             queryPre();   | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void textEdit1_KeyUp(object sender, KeyEventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (e.KeyCode != Keys.Enter) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             queryPre();  | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | } |