681 lines
		
	
	
		
			24 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			681 lines
		
	
	
		
			24 KiB
		
	
	
	
		
			C#
		
	
	
	
| using System;
 | ||
| using System.Collections.Generic;
 | ||
| using System.ComponentModel;
 | ||
| using System.Data;
 | ||
| using System.Drawing;
 | ||
| using System.Text;
 | ||
| using System.Linq;
 | ||
| using System.Windows.Forms;
 | ||
| using DevExpress.XtraBars;
 | ||
| using DevExpress.XtraGrid.Views.Base;
 | ||
| //using DeiNiu.wms.Logical;
 | ||
| using DeiNiu.wms.Data;
 | ||
| using DevExpress.XtraGrid.Columns;
 | ||
|  
 | ||
| using System.Threading;
 | ||
| using DevExpress.XtraGrid.Views.Grid;
 | ||
| using DevExpress.XtraEditors.DXErrorProvider;
 | ||
| using DeiNiu.wms.Data.Model;
 | ||
| using DevExpress.XtraEditors;
 | ||
| using DevExpress.XtraEditors.Controls;
 | ||
| using DeiNiu.Utils; 
 | ||
| using DeiNiu.wms.win.ServiceReferenceStockInRequest;
 | ||
| 
 | ||
| 
 | ||
| namespace DeiNiu.wms.win
 | ||
| {
 | ||
|     public partial class ShipInRecords : BasicRibbonForm
 | ||
|     {
 | ||
|         
 | ||
|      
 | ||
|       //  lWmsGoods lgt = new lWmsGoods();
 | ||
|         private string fieldName = WmsLocation.fields.locationId.ToString();
 | ||
|         private string fieldGoodType = WmsLocation.fields.whGoodsType.ToString();
 | ||
|         private string lastQuery = "";
 | ||
|         private DataTable dtDiffs;
 | ||
|         private DataTable dtDetail;
 | ||
|         private int selectedRowIndex = -1;
 | ||
|         private int selectedShipId;
 | ||
|       
 | ||
| 
 | ||
|         public ShipInRecords()
 | ||
|         {
 | ||
|             InitializeComponent();
 | ||
|             initialControls();
 | ||
|             //    loadData();
 | ||
|         }
 | ||
|         #region initialControls
 | ||
|         private void initialControls()
 | ||
|         {
 | ||
|             initialComboBoxes();
 | ||
|             initialPagerControls();
 | ||
|             initialDataGrid();
 | ||
|             initialQueryInput(); 
 | ||
|             setValidationRule();
 | ||
|             
 | ||
| 
 | ||
|         }
 | ||
|         private void initialComboBoxes()
 | ||
|         {
 | ||
|           // initialComboBoxs(comboType, this.stkdiff,false);
 | ||
|              
 | ||
|    
 | ||
|         }
 | ||
|       
 | ||
|         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, true);
 | ||
|             //   gridviewGoodsType.PopulateColumns();
 | ||
|             gridview.Columns.Clear();
 | ||
|             // gridviewGoodsType.Columns.Remove(gridviewGoodsType.Columns["DealerPrice"]); 
 | ||
|             GridColumn myCol0 = new GridColumn() { Caption = "ID", Visible = true, FieldName = "id" };
 | ||
|             myCol0.Visible = false;
 | ||
| 
 | ||
|             GridColumn myCol17 = new GridColumn() { Caption = "采购单号码", Visible = true, FieldName = Erp_purch_receive_log.fields.pur_order.ToString() };
 | ||
|             GridColumn myCol1 = new GridColumn() { Caption = "商品编码", Visible = true, FieldName ="goodsId"};
 | ||
|             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 = "regeditCode" };
 | ||
|             GridColumn myCol7 = new GridColumn() { Caption = "剂型", Visible = true, FieldName = WmsGoods.exfields.type.ToString() };
 | ||
|             GridColumn myCol8 = new GridColumn() { Caption = "到货数量", Visible = true, FieldName = Erp_purch_receive_log .fields.arriveCount.ToString()};
 | ||
|             GridColumn myCol9 = new GridColumn() { Caption = "收货数量", Visible = true, FieldName = Erp_purch_receive_log.fields.receiveCount.ToString() };
 | ||
|             GridColumn myCol10 = new GridColumn() { Caption = "拒收数量", Visible = true, FieldName = Erp_purch_receive_log.fields.rejectCount.ToString() };
 | ||
|             GridColumn myCol11 = new GridColumn() { Caption = "收货备注", Visible = true, FieldName = Erp_purch_receive_log.fields.receiveRemark.ToString() };
 | ||
|             GridColumn myCol19 = new GridColumn() { Caption = "打单人", Visible = true, FieldName = "em_name" }; 
 | ||
|             
 | ||
|             GridColumn myCol12 = new GridColumn() { Caption = "运输单号", Visible = true, FieldName = Erp_purch_ship.fields.shipOrder.ToString() };
 | ||
|             GridColumn myCol13 = new GridColumn() { Caption = "车辆牌号", Visible = true, FieldName = Erp_purch_ship.fields.veNumber.ToString() };
 | ||
|             GridColumn myCol14 = new GridColumn() { Caption = "箱内温度", Visible = true, FieldName = Erp_purch_ship.fields.temperature.ToString() };
 | ||
|             GridColumn myCol15 = new GridColumn() { Caption = "送货电话", Visible = true, FieldName = Erp_purch_ship.fields.driverPhone.ToString() };
 | ||
|             GridColumn myCol16 = new GridColumn() { Caption = "送货公司", Visible = true, FieldName = Erp_purch_ship.fields.company.ToString() };
 | ||
|             GridColumn myCol18 = new GridColumn() { Caption = "送货人", Visible = true, FieldName = Erp_purch_ship.fields.driverName.ToString() };
 | ||
|             GridColumn myCol20 = new GridColumn() { Caption = "送货备注", Visible = true, FieldName = Erp_purch_ship.fields.remark.ToString() };
 | ||
|             GridColumn myCol21 = new GridColumn() { Caption = "日期", Visible = true, FieldName ="createtime" };
 | ||
|             GridColumn myCol22 = new GridColumn() { Caption = "采购订单", Visible = true, FieldName = Erp_purch_receive_pre.fields.pur_order.ToString() };
 | ||
|             GridColumn myCol23 = new GridColumn() { Caption = "入库通知单", Visible = true, FieldName = Erp_purch_receive_pre.fields.preInOrderNo.ToString() };
 | ||
|             if (gridview == gridView2)
 | ||
|             {
 | ||
|                
 | ||
|                 gridview.Columns.Add(myCol17);
 | ||
|                
 | ||
|                 gridview.Columns.Add(myCol2);
 | ||
|                
 | ||
|                 gridview.Columns.Add(myCol8);
 | ||
|                 gridview.Columns.Add(myCol9);
 | ||
|                 gridview.Columns.Add(myCol10);
 | ||
|                 gridview.Columns.Add(myCol5); 
 | ||
|                 gridview.Columns.Add(myCol11);
 | ||
|                 gridview.Columns.Add(myCol19);
 | ||
|                 gridview.Columns.Add(myCol20);
 | ||
| 
 | ||
|                 gridview.Columns.Add(myCol1);
 | ||
|                 gridview.Columns.Add(myCol3);
 | ||
|                 gridview.Columns.Add(myCol4);
 | ||
|              
 | ||
|                 gridview.Columns.Add(myCol7);
 | ||
|                 gridview.Columns.Add(myCol21);
 | ||
| 
 | ||
|             }else
 | ||
|                 if (gridview == gridView1 )
 | ||
|             {
 | ||
|                 gridview.Columns.Add(myCol23);
 | ||
|                 gridview.Columns.Add(myCol22);
 | ||
|                 gridview.Columns.Add(myCol12);
 | ||
|                 gridview.Columns.Add(myCol13); 
 | ||
|                 gridview.Columns.Add(myCol14);
 | ||
|                 gridview.Columns.Add(myCol15);  
 | ||
|                 gridview.Columns.Add(myCol16);
 | ||
|               //  gridview.Columns.Add(myCol17);
 | ||
|                 gridview.Columns.Add(myCol18);
 | ||
|                 gridview.Columns.Add(myCol20);
 | ||
|                 gridview.Columns.Add(myCol21);
 | ||
|             }
 | ||
|             
 | ||
|              
 | ||
|             //to show bottom scroll bar
 | ||
|             gridview.OptionsView.ColumnAutoWidth = false;
 | ||
|             gridview.BestFitColumns();
 | ||
|            // gridview.Focus();
 | ||
| 
 | ||
| 
 | ||
| 
 | ||
|             //自动列宽
 | ||
|             //gridView1.OptionsView.ColumnAutoWidth = false;
 | ||
|             //this.gridView1.BestFitColumns();
 | ||
|             //this.gridView1.Columns[2].MinWidth = 500;
 | ||
|             //this.gridView1.Columns[1].BestFit();
 | ||
|             //for (int I = 0; I < gridView1.Columns.Count; I++)
 | ||
|             //{
 | ||
| 
 | ||
|             //     this.gridView1.Columns[I].BestFit()
 | ||
|             //}
 | ||
|         }
 | ||
| 
 | ||
|        
 | ||
|         #endregion
 | ||
| 
 | ||
|         /// <summary>  
 | ||
|         /// loading data
 | ||
|         /// </summary>  
 | ||
|         private int loadData()
 | ||
|         {
 | ||
|             //this.gridviewGoodsType.DataSource = lgt.GetAllActiveData().Tables[0].DefaultView;
 | ||
| 
 | ||
|             showWaitForm();
 | ||
|             try
 | ||
|             {
 | ||
|                 
 | ||
|                 // this.splashScreenManager1.ShowWaitForm();
 | ||
|                 string query = (this.dateEditFrom.Text.Trim().Length == 0 ? "" : string.Format("{0} >= # '{1}';","createtime", dateEditFrom.DateTime))
 | ||
|                               + (this.dateEditTo.Text.Trim().Length == 0 ? "" : string.Format("{0} <= # '{1}';", "createtime", dateEditTo.DateTime));
 | ||
|                  
 | ||
| 
 | ||
|                  
 | ||
|                         query += (this.txtTransNoQ.Text.Trim().Length == 0 ? "" : string.Format("{0} = # '{1}';", Erp_purch_ship.fields.shipOrder.ToString(), filtRiskChar(txtTransNoQ.Text.Trim())))
 | ||
|                               + (this.txtVeNumberQ.Text.Trim().Length == 0 ? "" : string.Format("{0} = # '{1}';", Erp_purch_ship.fields.veNumber.ToString(), filtRiskChar(txtVeNumberQ.Text.Trim())))
 | ||
|                               + (this.txtDriverPhoneQ.Text.Trim().Length == 0 ? "" : string.Format("{0} =#'{1}';", Erp_purch_ship.fields.driverPhone.ToString(), filtRiskChar(txtDriverPhoneQ.Text.Trim())))
 | ||
|                               + (this.txtCompanyQ.Text.Trim().Length == 0 ? "" : string.Format("{0} like #'%{1}%';", Erp_purch_ship.fields.company.ToString(), filtRiskChar(txtCompanyQ.Text.Trim())))
 | ||
|                               + (this.txtPreNo.Text.Trim().Length == 0 ? "" : string.Format("{0} = # '{1}';",    Erp_purch_receive_pre.fields.preInOrderNo.ToString(), filtRiskChar(txtPreNo.Text.Trim())))
 | ||
|                               + (this.txtPurchNo.Text.Trim().Length == 0 ? "" : string.Format("{0} =#'{1}';", Erp_purch_receive_pre.fields.pur_order.ToString(), filtRiskChar(txtPurchNo.Text.Trim())));
 | ||
|                     
 | ||
| 
 | ||
|                 this.pager1.PageCurrent = lastQuery.Equals(query) ? this.pager1.PageCurrent : 1; //根据查询条件的变化给pager赋值
 | ||
|                 int start = (pager1.PageSize * (pager1.PageCurrent - 1) + 1);
 | ||
|                 int end = (pager1.PageSize * pager1.PageCurrent);
 | ||
|                 lastQuery = query;
 | ||
|                 DataSet ds = inClient.getShipRecs(query, start, end);
 | ||
|                              
 | ||
|                 closeClient();
 | ||
|                 dtDiffs = 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;
 | ||
| 
 | ||
|            //    dtDiffs.PrimaryKey = new DataColumn[] { dtDiffs.Columns["goodsId"], dtDiffs.Columns["batch"] };
 | ||
|                 this.gridControl1.DataSource = dtDiffs.DefaultView;
 | ||
|                 initialDataGridColumns(this.gridView1);
 | ||
|                 //update selected row index to the last updated one.
 | ||
| 
 | ||
|                 gridControl2.DataSource = null;
 | ||
|                 clearInputs();
 | ||
|                 if (  selectedShipId >0 )
 | ||
|                 {
 | ||
| 
 | ||
|                     DataRow[] drs = dtDiffs.Select(string.Format("id='{0}' ", selectedShipId ));
 | ||
| 
 | ||
|                     DataRow dr = null;
 | ||
|                     if (drs.Length > 0)
 | ||
|                     {
 | ||
|                         dr = drs[0];
 | ||
|                     }
 | ||
| 
 | ||
|                     if (dr != null)
 | ||
|                     {
 | ||
|                         selectedRowIndex = dtDiffs.Rows.IndexOf(dr);
 | ||
|                         if (selectedRowIndex > 0 && dtDiffs.Rows.Count > selectedRowIndex)
 | ||
|                         {
 | ||
|                             // gridView1.SelectRow(selectedRowIndex);
 | ||
|                             gridView1.FocusedRowHandle = selectedRowIndex;
 | ||
|                             //  gridView1.MakeRowVisible(selectedRowIndex);
 | ||
|                             setCurrentRequestDetail();
 | ||
|                         }
 | ||
|                     }
 | ||
|                     else
 | ||
|                     {
 | ||
|                         gridView1.FocusedRowHandle = 0;
 | ||
|                         gridView1.SelectRow(0);
 | ||
|                         setCurrentRequestDetail();
 | ||
|                     }
 | ||
| 
 | ||
|                   
 | ||
| 
 | ||
|                     //gridView1.FocusedRowHandle = selectedRowIndex;
 | ||
|                 }
 | ||
|                 else
 | ||
|                 {
 | ||
|                     gridView1.FocusedRowHandle = 0;
 | ||
|                     gridView1.SelectRow(0);
 | ||
|                     setCurrentRequestDetail();
 | ||
|                 }
 | ||
|                 closeWaitForm();
 | ||
|                 return cnt;// lgt.getRowCount(query);
 | ||
|                 // return lgt.GetGoodType.QueryCount(); 
 | ||
|             }
 | ||
|             catch (Exception er)
 | ||
|             {
 | ||
|                 showErrorMsg(er,er.Message);
 | ||
|             }
 | ||
| 
 | ||
|             return 0;
 | ||
| 
 | ||
|         }
 | ||
|          
 | ||
| 
 | ||
| 
 | ||
|         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 = 0; //reset currentRowIndex
 | ||
|             return loadData();
 | ||
|         }
 | ||
| 
 | ||
|         private void initialPagerControls()
 | ||
|         {
 | ||
| 
 | ||
|             pager1.MaximumSize = new Size(0, 20);
 | ||
|             pager1.EventPaging += new DeiNiu.Controls.pager.EventPagingHandler(pager_EventPaging);
 | ||
|             #region DataGridView与Pager控件绑定
 | ||
|             this.pager1.PageCurrent = 1;//当前页为第一页  
 | ||
|             pager1.PageSize = Utils.WmsConstants.PAGER_SIZE;//每页行数  
 | ||
|            // this.pager1.Bind();//绑定  
 | ||
|             #endregion
 | ||
| 
 | ||
|         }
 | ||
|         private void initialDataGrid()
 | ||
|         {
 | ||
|             gridView1.OptionsSelection.MultiSelect = true;//按shift / control 多选
 | ||
|             this.gridView1.OptionsBehavior.AutoPopulateColumns = false;
 | ||
|             this.gridView1.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus;
 | ||
|             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(gridView1_CustomDrawRowIndicator);
 | ||
|             this.gridView2.IndicatorWidth = 40;
 | ||
|             this.gridView2.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler(gridView1_CustomDrawRowIndicator);
 | ||
|             gridView1.CustomColumnDisplayText += gridView2_CustomColumnDisplayText;
 | ||
|             gridView2.CustomColumnDisplayText += gridView2_CustomColumnDisplayText;
 | ||
|         }
 | ||
|         private void gridView2_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
 | ||
|         {
 | ||
|             if (e.Column.FieldName.ToLower().Contains("日期"))
 | ||
|             {
 | ||
|                 e.Column.DisplayFormat.FormatString = "yyyy-MM-dd HH:mm:ss";
 | ||
|             }
 | ||
|             else if (e.Column.FieldName.Contains("数量"))
 | ||
|             {
 | ||
|                 e.Column.DisplayFormat.FormatString = "{0:N0}"; ;
 | ||
|             }
 | ||
|         }
 | ||
|         //显示行的序号    
 | ||
|         private void gridView1_CustomDrawRowIndicator(object sender, RowIndicatorCustomDrawEventArgs e)
 | ||
|         {
 | ||
|             if (e.Info.IsRowIndicator && e.RowHandle >= 0)
 | ||
|             {
 | ||
|                 e.Info.DisplayText = (e.RowHandle + 1).ToString();
 | ||
|             }
 | ||
|         }
 | ||
|         bool isDataSourceChanged = false;
 | ||
|         private void gridView1_DataSourceChanged(object sender, EventArgs e)
 | ||
|         {
 | ||
|             isDataSourceChanged = true;
 | ||
|             if (selectedRowIndex > 0 && dtDiffs.Rows.Count > selectedRowIndex)
 | ||
|             {
 | ||
|                 gridView1.FocusedRowHandle = selectedRowIndex;
 | ||
|                 gridView1.MakeRowVisible(selectedRowIndex);
 | ||
| 
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|         private void gridView1_FocusedRowObjectChanged(object sender, FocusedRowObjectChangedEventArgs e)
 | ||
|         {
 | ||
| 
 | ||
|             if (gridView1.FocusedRowHandle < 0 || gridView1.FocusedRowHandle == selectedRowIndex || isDataSourceChanged)
 | ||
|             {
 | ||
|                 isDataSourceChanged = false;
 | ||
|                 if (gridView1.IsGroupRow(e.RowHandle)) //set first row of group selected
 | ||
|                 {
 | ||
|                     selectedRowIndex = gridView1.GetChildRowHandle(e.RowHandle, 0);
 | ||
|                     setCurrentRequestDetail();
 | ||
|                 }
 | ||
| 
 | ||
|                 return;
 | ||
| 
 | ||
|             }
 | ||
|             selectedRowIndex = gridView1.FocusedRowHandle;
 | ||
|             // showErrorMsg("selection:"+ selectedRowIndex);
 | ||
|             this.gridControl2.DataSource = null;
 | ||
|             clearInputs();
 | ||
|             setCurrentRequestDetail();
 | ||
| 
 | ||
| 
 | ||
|         }
 | ||
|         
 | ||
|         private void setCurrentRequestDetail()
 | ||
|         {
 | ||
| 
 | ||
|             if (!getCurrentObject() || selectedShipId <=0)
 | ||
|             {
 | ||
|                 return;
 | ||
|             }
 | ||
|             
 | ||
|             showWaitForm();
 | ||
| 
 | ||
|             try
 | ||
|             {
 | ||
| 
 | ||
|                 dtDetail = inClient.getShipReceiveDetailByShipId(this.selectedShipId); closeClient();
 | ||
|                
 | ||
|                 
 | ||
|                 clearInputs();
 | ||
|                 this.gridControl2.DataSource = dtDetail;
 | ||
|                 initialDataGridColumns(gridView2);
 | ||
|               
 | ||
|                
 | ||
|                 
 | ||
|             }
 | ||
|             catch (Exception e)
 | ||
|             {
 | ||
|                 showErrorMsg(e,e.Message);
 | ||
|             }
 | ||
|             closeWaitForm();
 | ||
|         }
 | ||
| 
 | ||
|         private bool getCurrentObject()
 | ||
|         {
 | ||
|             if (selectedRowIndex < 0 || selectedRowIndex >= dtDiffs.Rows.Count)
 | ||
|             {
 | ||
|                 return false;
 | ||
|             }
 | ||
| 
 | ||
|             //  DataRow currentRow = dt.Rows[selectedRowIndex];
 | ||
|             DataRowView dr = (DataRowView)(GetGridViewFilteredAndSortedData(gridView1)[selectedRowIndex]);
 | ||
|             selectedShipId = Convert.ToInt32(dr["id"].ToString()); ;
 | ||
|              
 | ||
|             this.gridControl2.DataSource = null;
 | ||
|         
 | ||
|             return true;
 | ||
|         }
 | ||
| 
 | ||
| 
 | ||
| 
 | ||
| 
 | ||
|         private void gridView2_FocusedRowObjectChanged(object sender, FocusedRowObjectChangedEventArgs e)
 | ||
|         {
 | ||
| 
 | ||
|               
 | ||
| 
 | ||
|         }
 | ||
|         
 | ||
|       
 | ||
| 
 | ||
|         private void clearInputs()
 | ||
|         {
 | ||
|               this.txtShipOrder.Text =
 | ||
|              this.txtTemp.Text =
 | ||
|              this.txtCompany.Text =
 | ||
|              this.txtDriverId.Text =
 | ||
|             this.txtDriverName.Text= 
 | ||
|             this.txtDriverPhone.Text =
 | ||
|             this.txtRemark.Text= 
 | ||
|             this.txtVeNumber.Text ="";
 | ||
|             
 | ||
| 
 | ||
|         }
 | ||
| 
 | ||
|        
 | ||
| 
 | ||
|         private void gridView1_FocusedRowChanged(object sender, FocusedRowChangedEventArgs e)
 | ||
|         {
 | ||
| 
 | ||
|         }
 | ||
|         
 | ||
|     
 | ||
| 
 | ||
|         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,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(wgoods);
 | ||
| 
 | ||
|                 //get updated data 
 | ||
|                 query();
 | ||
| 
 | ||
|             }
 | ||
|             catch (Exception e)
 | ||
|             {
 | ||
|                 showErrorMsg(e,e.Message);
 | ||
|             }
 | ||
|             finally
 | ||
|             {
 | ||
|                 // WaitFormService.Close();
 | ||
|                 closeWaitForm();
 | ||
|              
 | ||
|             }
 | ||
|              
 | ||
| 
 | ||
|         }
 | ||
| 
 | ||
|      
 | ||
|         private void btnUpdateVol_Click(object sender, EventArgs e)
 | ||
|         {
 | ||
| 
 | ||
|              
 | ||
|                 DialogResult r = MessageBox.Show(string.Format("确定要更新选中的{0}条商品容积信息吗?", 1 , "确认修改", MessageBoxButtons.YesNo, MessageBoxIcon.Warning));
 | ||
|                 if (r == DialogResult.Yes)
 | ||
|                 { 
 | ||
|                   
 | ||
|                 }
 | ||
|             
 | ||
| 
 | ||
|         }
 | ||
|  
 | ||
|         private void btnUpdateGoodType_Click(object sender, EventArgs e)
 | ||
|         { 
 | ||
|         }
 | ||
| 
 | ||
|         
 | ||
|  
 | ||
| 
 | ||
|         private void btnQuery_Click(object sender, EventArgs e)
 | ||
|         {
 | ||
|             this.query();
 | ||
|         }
 | ||
| 
 | ||
|        
 | ||
| 
 | ||
| 
 | ||
|        
 | ||
| 
 | ||
|         private void txtpinyin_KeyUp(object sender, KeyEventArgs e)
 | ||
|         {
 | ||
|             if (e.KeyCode == Keys.Enter)
 | ||
|             {
 | ||
|                 loadData();
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
| 
 | ||
|       
 | ||
|         private void bbQuery_ItemClick(object sender, ItemClickEventArgs e)
 | ||
|         {
 | ||
|             query();
 | ||
|         }
 | ||
| 
 | ||
| 
 | ||
|       
 | ||
|         //值改变事件
 | ||
|         private void textLocation_EditValueChanged(object sender, EventArgs e)
 | ||
|         {
 | ||
|           //  string daID = this.textLocation.EditValue.ToString(); //是ookUpEdit.Properties.ValueMember的值
 | ||
|           //  string xm = this.textLocation.Text.Trim();
 | ||
|         }
 | ||
| 
 | ||
|         private void btnOkay_Click(object sender, EventArgs e)
 | ||
|         {
 | ||
| 
 | ||
|              
 | ||
| 
 | ||
| 
 | ||
|         }
 | ||
| 
 | ||
|         private void bbiExport_ItemClick(object sender, ItemClickEventArgs e)
 | ||
|         {
 | ||
|             exportExcel(gridView1);
 | ||
|         }
 | ||
| 
 | ||
|         private void btnNewShip_Click(object sender, EventArgs e)
 | ||
|         {
 | ||
| 
 | ||
|             structShip ship = new structShip();
 | ||
|             ship.shipOrder = filtRiskChar(this.txtShipOrder.Text);
 | ||
|             ship.company = filtRiskChar(this.txtCompany.Text);
 | ||
|             ship.driverID = filtRiskChar(this.txtDriverId.Text);
 | ||
|             ship.driverName = filtRiskChar(this.txtDriverName.Text);
 | ||
|             ship.driverPhone = filtRiskChar(this.txtDriverPhone.Text);
 | ||
|             ship.remark = filtRiskChar(this.txtRemark.Text);
 | ||
|             if (txtTemp.Text.Length > 0)
 | ||
|             {
 | ||
|                 try
 | ||
|                 {
 | ||
|                     ship.temperature = Convert.ToDecimal(this.txtTemp.Text.Trim());
 | ||
|                 }
 | ||
|                 catch (Exception er)
 | ||
|                 {
 | ||
|                     showErrorMsg(er,"请输入正确的温度");
 | ||
|                     return;
 | ||
|                 }
 | ||
|             }
 | ||
| 
 | ||
|             ship.veNumber = filtRiskChar(this.txtVeNumber.Text);
 | ||
| 
 | ||
|             if (string.IsNullOrEmpty(ship.shipOrder))
 | ||
|             {
 | ||
|                 showErrorMsg("请输入单号");
 | ||
|                 txtShipOrder.Focus();
 | ||
|                 return;
 | ||
|             }
 | ||
| 
 | ||
| 
 | ||
|             try
 | ||
|             {
 | ||
|                 inClient.newShipInfo(ship);
 | ||
|                 closeClient();
 | ||
|             }
 | ||
|             catch (Exception er)
 | ||
|             {
 | ||
|                 showErrorMsg(er, "");
 | ||
|                 closeClient();
 | ||
|                 return;
 | ||
|             }
 | ||
|           
 | ||
| 
 | ||
|             clearInputs();
 | ||
|             query();
 | ||
| 
 | ||
|         }
 | ||
| 
 | ||
|         private void txtVender_KeyUp(object sender, KeyEventArgs e)
 | ||
|         {
 | ||
|             if (e.KeyCode != Keys.Enter)
 | ||
|             {
 | ||
|                 return;
 | ||
|             }
 | ||
|             if (string.IsNullOrEmpty(txtVender.Text))
 | ||
|             {
 | ||
|                 return;
 | ||
|             }
 | ||
|             query();
 | ||
|         }
 | ||
|  
 | ||
| 
 | ||
| 
 | ||
| 
 | ||
|     }
 | ||
| } |