| 
									
										
										
										
											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.ServiceReferenceLot; | 
					
						
							|  |  |  |  | using DeiNiu.wms.win.ServiceCustomer; | 
					
						
							|  |  |  |  | using DeiNiu.wms.win.ServiceReferenceLot; | 
					
						
							|  |  |  |  | using DeiNiu.wms.win.waveRuleService; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | namespace DeiNiu.wms.win | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     public partial class WaveRule : BasicRibbonForm | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |        | 
					
						
							|  |  |  |  |         private string lastQuery = "";  | 
					
						
							|  |  |  |  |   | 
					
						
							|  |  |  |  |         private int selectedRowIndex = -1; | 
					
						
							|  |  |  |  |           | 
					
						
							|  |  |  |  |         private bool isShowingInRequest = true; | 
					
						
							|  |  |  |  |         public WaveRule() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |           | 
					
						
							| 
									
										
										
										
											2023-12-03 22:13:49 +08:00
										 |  |  |  |             InitializeComponent(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             try | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 initialControls(); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             catch (Exception er) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 showErrorMsg(er); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |             //    loadData(); | 
					
						
							| 
									
										
										
										
											2023-12-03 22:13:49 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |         } | 
					
						
							|  |  |  |  |         #region initialControls | 
					
						
							|  |  |  |  |         private void initialControls() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             initialComboBoxes(); | 
					
						
							|  |  |  |  |             initialPagerControls(); | 
					
						
							|  |  |  |  |             initialDataGrid(); | 
					
						
							|  |  |  |  |             initialQueryInput();  | 
					
						
							|  |  |  |  |             setValidationRule(); | 
					
						
							|  |  |  |  |             | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         private void initialComboBoxes() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             Node[] nds = { }; | 
					
						
							|  |  |  |  |             DataTable dt = Park.getDictionary(false); | 
					
						
							|  |  |  |  |             if (dt.Rows.Count == 0) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             DataRow[] drs = dt.Select("flag >0"); | 
					
						
							|  |  |  |  |             foreach (DataRow dr in drs) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 int flag = Convert.ToInt32(dr["flag"].ToString()); | 
					
						
							|  |  |  |  |                 int parentId = Convert.ToInt32(dr["id"].ToString()); | 
					
						
							|  |  |  |  |                 DataRow[] drss = Park.getDictionary(false).Select("parentId =" + parentId); | 
					
						
							|  |  |  |  |                 switch (flag) | 
					
						
							|  |  |  |  |                 {  | 
					
						
							|  |  |  |  |                     case 3001: | 
					
						
							|  |  |  |  |                         initialComboBoxs(this.comBoxLines, drss, true); | 
					
						
							|  |  |  |  |                         break; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |              | 
					
						
							|  |  |  |  |             DataTable dtSales = null;  | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             dtSales = outClient.getSalesMen();  | 
					
						
							|  |  |  |  |             //closeClient(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             string[] sales = new string[dtSales.Rows.Count]; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             int i = 0; | 
					
						
							|  |  |  |  |             foreach (DataRow dr in dtSales.Rows) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 sales[i] = dr[0].ToString(); | 
					
						
							|  |  |  |  |                 i++; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             this.initialComboBoxs(this.comSales, sales, "全部"); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             initialComboBoxs(this.comOwner, getOwners()); | 
					
						
							|  |  |  |  |             initialComboBoxs(this.comType, waveRuleType); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |        | 
					
						
							|  |  |  |  |         private void setValidationRule() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |           //  dxValidationProvider.SetValidationRule(comWarehouse, ValidationRules.notEmptyValidationRule); | 
					
						
							|  |  |  |  |             //txtGooDtGvype.Properties.MaxLength = 40; | 
					
						
							|  |  |  |  |             //txtGoodDesc.Properties.MaxLength = 250; | 
					
						
							|  |  |  |  |             //textEdit1.Properties.MaxLength = txtGooDtGvype.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 colChk = new GridColumn() { Caption = CheckBoxField, Visible = true, FieldName = CheckBoxField }; | 
					
						
							|  |  |  |  |             this.gridView1.Columns.Add(colChk); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (gridView == gridView1) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 GridColumn myCol1 = new GridColumn() { Caption = "名称", Visible = true, FieldName ="ruleName" }; | 
					
						
							|  |  |  |  |                 GridColumn myCol2 = new GridColumn() { Caption = "线路", Visible = true, FieldName = "lineName" }; | 
					
						
							|  |  |  |  |                 GridColumn myCol3 = new GridColumn() { Caption = "销售", Visible = true, FieldName = "sales" }; | 
					
						
							|  |  |  |  |                 GridColumn myCol4 = new GridColumn() { Caption = "货主", Visible = true, FieldName = "ownerName" }; | 
					
						
							|  |  |  |  |                 GridColumn myCol5 = new GridColumn() { Caption = "类型", Visible = true, FieldName = "type" }; | 
					
						
							|  |  |  |  |                 GridColumn myCol6 = new GridColumn() { Caption = "启用", Visible = true, FieldName ="active" }; | 
					
						
							|  |  |  |  |              | 
					
						
							|  |  |  |  |                 gridView.Columns.Add(myCol1); | 
					
						
							|  |  |  |  |                 gridView.Columns.Add(myCol2);  | 
					
						
							|  |  |  |  |                 gridView1.Columns.Add(myCol3); | 
					
						
							|  |  |  |  |                 gridView.Columns.Add(myCol4); | 
					
						
							|  |  |  |  |                 gridView.Columns.Add(myCol5); | 
					
						
							|  |  |  |  |                 gridView.Columns.Add(myCol6); | 
					
						
							|  |  |  |  |                 | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |                | 
					
						
							|  |  |  |  |             //to show bottom scroll bar | 
					
						
							|  |  |  |  |             gridView.OptionsView.ColumnAutoWidth = false; | 
					
						
							|  |  |  |  |             gridView.BestFitColumns(); | 
					
						
							|  |  |  |  |           | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |           | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void initialRequestOrders() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             showWaitForm(); | 
					
						
							|  |  |  |  |             try{ | 
					
						
							|  |  |  |  |                 //custClient.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(); | 
					
						
							|  |  |  |  |             | 
					
						
							|  |  |  |  |             try | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 // this.splashScreenManager1.ShowWaitForm(); | 
					
						
							|  |  |  |  |                 string query = (this.txtRuleNameQuery.Text.Trim().Length == 0 ? "" : string.Format("{0} =#'{1}';", "ruleName", filtRiskChar(txtRuleNameQuery.Text.Trim()))) | 
					
						
							|  |  |  |  |                                | 
					
						
							|  |  |  |  |                             ; | 
					
						
							|  |  |  |  |                 bool isQueryNotChanged = lastQuery.Equals(query); | 
					
						
							|  |  |  |  |                 this.pager1.PageCurrent = isQueryNotChanged ? this.pager1.PageCurrent : 1; //根据查询条件的变化给pager赋值 | 
					
						
							|  |  |  |  |                 this.pager1.PageCurrent = this.pager1.PageCurrent <= 0 ? 1 : this.pager1.PageCurrent; | 
					
						
							|  |  |  |  |                 int start = (pager1.PageSize * (pager1.PageCurrent - 1) + 1); | 
					
						
							|  |  |  |  |                 int end = (pager1.PageSize * pager1.PageCurrent); | 
					
						
							|  |  |  |  |                 lastQuery = query; | 
					
						
							|  |  |  |  |                 DataSet ds = wrClient.query(query, start, end);// lgt.Query(query, start, end); | 
					
						
							|  |  |  |  |                 closeClient(); | 
					
						
							|  |  |  |  |                 DtGv = ds.Tables[0]; | 
					
						
							|  |  |  |  |                 int cnt = Convert.ToInt32(ds.Tables[1].Rows[0][0].ToString()); | 
					
						
							|  |  |  |  |                 //DtGv = lgt.Query(query, start, end); //string.IsNullOrEmpty(query) ? lgt.GetGooDtGvype.getAllData(start, end) : lgt.g; | 
					
						
							|  |  |  |  |                 addCheckField(DtGv);//add checkbox | 
					
						
							|  |  |  |  |                 DtGv.PrimaryKey = new DataColumn[] { DtGv.Columns["ID"] }; | 
					
						
							|  |  |  |  |                 bool firstLoad = !isQueryNotChanged || this.gridControl1.DataSource == null; | 
					
						
							|  |  |  |  |                 this.gridControl1.DataSource = DtGv.DefaultView; | 
					
						
							|  |  |  |  |               //  initialDataGridColumns(gridView1); | 
					
						
							|  |  |  |  |                 //update selected row index to the last updated one. | 
					
						
							|  |  |  |  |                 gridView1.BestFitColumns(); | 
					
						
							|  |  |  |  |                 | 
					
						
							|  |  |  |  |                | 
					
						
							|  |  |  |  |                 closeWaitForm(); | 
					
						
							|  |  |  |  |                 return cnt; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             catch (Exception e) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 showErrorMsg(e,e.Message); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             closeWaitForm(); | 
					
						
							|  |  |  |  |             return 0;// lgt.getRowCount(query); | 
					
						
							|  |  |  |  |             // return lgt.GetGooDtGvype.QueryCount();  | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |           | 
					
						
							|  |  |  |  |         private void bindDetail() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         private void setDataBack() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         private bool validData() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             bool isvalid = dxValidationProvider1.Validate(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             // MessageBox.Show("gooDtGvype is " + txtGooDtGvype.Text +", is valid ? " + isvalid); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             return isvalid; | 
					
						
							|  |  |  |  |             | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |           | 
					
						
							|  |  |  |  |         | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <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); | 
					
						
							|  |  |  |  |                     | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 if (isCheckedIn) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     isCheckedIn = false; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                     return; | 
					
						
							|  |  |  |  |                  | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             selectedRowIndex = gridView1.FocusedRowHandle; | 
					
						
							|  |  |  |  |             // showErrorMsg("selection:"+ selectedRowIndex); | 
					
						
							|  |  |  |  |             | 
					
						
							|  |  |  |  |              | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void clearInputs() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |         private void gridView1_DataSourceChanged(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (selectedRowIndex >= 0 && DtGv.Rows.Count > selectedRowIndex) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 gridView1.FocusedRowHandle = selectedRowIndex; | 
					
						
							|  |  |  |  |                 gridView1.MakeRowVisible(selectedRowIndex); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   | 
					
						
							|  |  |  |  |   | 
					
						
							|  |  |  |  |    | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         int selectedInShipId = 0; | 
					
						
							|  |  |  |  |         int selectedShipIndex; | 
					
						
							|  |  |  |  |         string shipDate; | 
					
						
							|  |  |  |  |         | 
					
						
							|  |  |  |  |         string selectedShipDriver = ""; | 
					
						
							|  |  |  |  |            | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |         | 
					
						
							|  |  |  |  |           | 
					
						
							|  |  |  |  |         private void btnDelete_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         {  | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         protected void query() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             pager1.Bind(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void queryGoods() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             showWaitForm(); | 
					
						
							|  |  |  |  |             try | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 query();// loadData();   | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             catch (Exception e) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 showErrorMsg(e.Message); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             finally | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 // WaitFormService.Close(); | 
					
						
							|  |  |  |  |                 closeWaitForm(); | 
					
						
							|  |  |  |  |                 bbQuery.Enabled = true; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |           | 
					
						
							|  |  |  |  |         private void bbQuery_ItemClick_1(object sender, ItemClickEventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             this.bbQuery.Enabled = false; | 
					
						
							|  |  |  |  |             queryGoods(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void updateObjects(List<WmsGoods> goods) | 
					
						
							|  |  |  |  |         {  | 
					
						
							|  |  |  |  |             showWaitForm(); | 
					
						
							|  |  |  |  |             //WaitFormService.Show(this);  | 
					
						
							|  |  |  |  |             try | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |              //   lgt.update(goods); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 //get updated data  | 
					
						
							|  |  |  |  |                 query(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             catch (Exception e) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 showErrorMsg(e.Message); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             finally | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 // WaitFormService.Close(); | 
					
						
							|  |  |  |  |                 closeWaitForm(); | 
					
						
							|  |  |  |  |               | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |               | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         string lastSelectedId = ""; | 
					
						
							|  |  |  |  |         private bool getCurrentObject() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (selectedRowIndex <0 || selectedRowIndex >= DtGv.Rows.Count) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return false; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             | 
					
						
							|  |  |  |  |           //  DataRow currentRow = DtGv.Rows[selectedRowIndex]; | 
					
						
							|  |  |  |  |             DataRowView dr = (DataRowView)(GetGridViewFilteredAndSortedData(gridView1)[selectedRowIndex]); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |           | 
					
						
							|  |  |  |  |      | 
					
						
							|  |  |  |  |             return true; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void btnQuery_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             queryGoods(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void gridView1_SelectionChanged(object sender, DevExpress.Data.SelectionChangedEventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (gridView1.FocusedRowHandle <0 || gridView1.FocusedRowHandle == selectedRowIndex) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             selectedRowIndex = gridView1.FocusedRowHandle; | 
					
						
							|  |  |  |  |      | 
					
						
							|  |  |  |  |             | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         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); | 
					
						
							|  |  |  |  |             gridView1.CustomColumnDisplayText += gridView2_CustomColumnDisplayText; | 
					
						
							|  |  |  |  |             initialDataGridColumns(gridView1); | 
					
						
							|  |  |  |  |             GridCheckEdit(gridView1, CheckBoxField, 50); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void gridView2_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             //   if (sender == gridView2) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 if (e.Column.FieldName == "custType") | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                     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.customerTypes[display]; | 
					
						
							|  |  |  |  |                              | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                         catch | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             return; | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         List<string> selectedIds = new List<string>(); | 
					
						
							|  |  |  |  |         private bool getSelectedIds() | 
					
						
							|  |  |  |  |         {  | 
					
						
							|  |  |  |  |             foreach (DataRow dr in DtGv.Rows) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 string v = dr[CheckBoxField].ToString(); | 
					
						
							|  |  |  |  |                 bool b = String.IsNullOrEmpty(v) ? false : Convert.ToBoolean(v); | 
					
						
							|  |  |  |  |                 if (b) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                     selectedIds.Add(dr["ID"].ToString()); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             if (selectedIds.Count == 0) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 showErrorMsg(null, "请至少选择一个条目"); | 
					
						
							|  |  |  |  |                 return false; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             return true; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |           | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void GoodsInForm_FormClosing(object sender, FormClosingEventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             //closeClient(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |           | 
					
						
							|  |  |  |  |           | 
					
						
							|  |  |  |  |         bool validOwner( ) | 
					
						
							|  |  |  |  |         {  | 
					
						
							|  |  |  |  |               | 
					
						
							|  |  |  |  |             return true; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void btnUpdateOwner_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (getSelectedIds()) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 custClient.updateJdGroup(selectedIds.ToArray(), ((Node)comBoxLines.SelectedItem).ID); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             query(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void btnUpdateHour_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (getSelectedIds()) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 custClient.updateJdHourPoint(selectedIds.ToArray(), ((Node)comSales.SelectedItem).ID); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             query(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void btnNew_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (!validInput()) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             WcfWaveRule ruleObj = new WcfWaveRule(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             string ruleName = textRuleName.Text; | 
					
						
							|  |  |  |  |             ruleName = filtRiskChar(ruleName); | 
					
						
							|  |  |  |  |             ruleObj.ruleName = ruleName; | 
					
						
							|  |  |  |  |             if(this.comBoxLines.SelectedIndex>0){ | 
					
						
							|  |  |  |  |                 ruleObj.lineId = ((Node)comBoxLines.SelectedItem).ID;    | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (this.comOwner.SelectedIndex > 0) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 ruleObj.owner =((Colitem) comOwner.SelectedItem).code; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (this.comSales.SelectedIndex > 0) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 ruleObj.sales =  comSales.Text; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (this.comType.SelectedIndex > 0) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 ruleObj.type = ((Colitem)comType.SelectedItem).key; | 
					
						
							|  |  |  |  |             }  | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             wrClient.add(ruleObj); | 
					
						
							|  |  |  |  |             closeClient(); | 
					
						
							|  |  |  |  |             query(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         bool validInput() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             string ruleName = textRuleName.Text; | 
					
						
							|  |  |  |  |             ruleName = filtRiskChar(ruleName); | 
					
						
							|  |  |  |  |             if (ruleName.Trim().Length < 2) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 showErrorMsg("请输入规则名称"); | 
					
						
							|  |  |  |  |                 textRuleName.Focus(); | 
					
						
							|  |  |  |  |                 return false; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             return true; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | } |