| 
									
										
										
										
											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 DevExpress.XtraEditors.Repository;  | 
					
						
							|  |  |  |  | using elelab; | 
					
						
							|  |  |  |  | using DeiNiu.wms.Logical; | 
					
						
							|  |  |  |  | using Model; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | namespace DeiNiu.wms.win | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     public partial class GoodsOutForm : BasicRibbonForm | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |   | 
					
						
							|  |  |  |  |       //  lWmsStock ls = new lWmsStock(); | 
					
						
							|  |  |  |  |         lWmsOutPickLable lgt = new lWmsOutPickLable(); | 
					
						
							|  |  |  |  |       //  WmsOutPickRequest outRequest = new WmsOutPickRequest(); | 
					
						
							|  |  |  |  |      //   lWmsOutRequest lgOutReq = new lWmsOutRequest(); | 
					
						
							|  |  |  |  |        // lWmsOutPickRequest outPickRequest = new lWmsOutPickRequest(); | 
					
						
							|  |  |  |  |         private string lastQuery = ""; | 
					
						
							|  |  |  |  |         private DataTable dtPickOrders; | 
					
						
							|  |  |  |  |         private int selectedRowIndex = -1; | 
					
						
							|  |  |  |  |      //   private WmsOutPickRequest selectedRequest; | 
					
						
							|  |  |  |  |         int preCnt = 0; | 
					
						
							|  |  |  |  |         Thread threadPreProcess; | 
					
						
							|  |  |  |  |         bool autoOrder, autoWave; | 
					
						
							|  |  |  |  |         bool isManualRefreshPickList = false; | 
					
						
							|  |  |  |  |      //   string currentWaveOrder = ""; | 
					
						
							|  |  |  |  |         DataTable dtException; | 
					
						
							|  |  |  |  |         DataTable dtBulks; | 
					
						
							|  |  |  |  |         string oInterval, oIsAuto; | 
					
						
							|  |  |  |  |     //    WmsOutPickDetail_tmp exceptionDetail; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         public GoodsOutForm() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |           debug("start 出库。。。。。。"); | 
					
						
							|  |  |  |  |               | 
					
						
							|  |  |  |  |             InitializeComponent(); | 
					
						
							|  |  |  |  |             initialControls(); | 
					
						
							|  |  |  |  |             initialBackGroundTasks(); | 
					
						
							|  |  |  |  |             lgt.updateWaveFlag(); | 
					
						
							|  |  |  |  |             debug("end 出库。。。。。。"); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #region initialControls | 
					
						
							|  |  |  |  |         private void initialControls() | 
					
						
							|  |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2023-09-04 22:41:19 +08:00
										 |  |  |  |             pickConstants.MAX_COLORS = Convert.ToInt16(spinColors.Value); | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |             initialDataGrid(); | 
					
						
							|  |  |  |  |             initialQueryInput();  | 
					
						
							|  |  |  |  |             setValidationRule(); | 
					
						
							|  |  |  |  |             initialTimer(); | 
					
						
							|  |  |  |  |            // setProgressbar(); | 
					
						
							|  |  |  |  |             getConfigration(); | 
					
						
							|  |  |  |  |             | 
					
						
							|  |  |  |  |             spinWave.Text = oInterval; | 
					
						
							|  |  |  |  |             swAutoWave.IsOn = Convert.ToBoolean(oIsAuto); | 
					
						
							|  |  |  |  |             setAutoHint(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         void getConfigration() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             try | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 oInterval = System.Configuration.ConfigurationManager.AppSettings["Interval"]; | 
					
						
							|  |  |  |  |                 oIsAuto = System.Configuration.ConfigurationManager.AppSettings["IsAuto"]; | 
					
						
							| 
									
										
										
										
											2023-09-04 22:41:19 +08:00
										 |  |  |  |                 pickConstants.HISTORY_REC_KEEP_DAYS = 14 + Convert.ToInt16(System.Configuration.ConfigurationManager.AppSettings["hisKeepDays"]); | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |             }catch(Exception er) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 LogHelper.debug(this.GetType(),er.StackTrace.ToString()); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         private void initialBackGroundTasks() | 
					
						
							|  |  |  |  |         {  | 
					
						
							|  |  |  |  |             //lgOutReq.UpdateUIDelegate += updatePreOutStatus; | 
					
						
							|  |  |  |  |             //lgOutReq.TaskCallBack += preOutFinished; | 
					
						
							|  |  |  |  |             if (autoOrder) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 preErpOrders(); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |            | 
					
						
							|  |  |  |  |            // swAutoWave.IsOn = WmsConstants.AUTO_NEW_WAVE; | 
					
						
							|  |  |  |  |             //lgt.UpdateUIDelegate +=  updatePickDetails; | 
					
						
							|  |  |  |  |             //lgt.TaskCallBack += loadWaveDetails;// waveStart; | 
					
						
							|  |  |  |  |            // lightLabelsCurrentWave(); | 
					
						
							|  |  |  |  |             loadWaveDetails(); | 
					
						
							|  |  |  |  |             if (autoWave) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |               //  newWave(); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             else | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                | 
					
						
							|  |  |  |  |              //   lightLabelsCurrentWave(); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             //Thread threadPreProcess = new Thread(searchLight); | 
					
						
							|  |  |  |  |             // threadPreProcess.IsBackground = true; | 
					
						
							|  |  |  |  |             // threadPreProcess.Start(); | 
					
						
							|  |  |  |  |   | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |        | 
					
						
							|  |  |  |  |         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 initialGridView3Columns(GridView gridview) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |               | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 setupGridView(gridview, true, 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 myCol17 = new GridColumn() { Caption = "状态", Visible = true, FieldName ="state" }; | 
					
						
							|  |  |  |  |             GridColumn myCol18 = new GridColumn() { Caption = "说明", Visible = true, FieldName ="description" }; | 
					
						
							|  |  |  |  |             GridColumn myCol100 = new GridColumn() { Caption = "数量", Visible = true, FieldName = "count" }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             GridColumn myCol20 = new GridColumn() { Caption = "波次", Visible = true, FieldName = WmsOutPickLable.fields.waveOrder.ToString() }; | 
					
						
							|  |  |  |  |             GridColumn myCol21 = new GridColumn() { Caption = "颜色", Visible = true, FieldName = "color" }; | 
					
						
							|  |  |  |  |             GridColumn myCol22 = new GridColumn() { Caption = "货位", Visible = true, FieldName = WmsOutPickLable.fields.locationId.ToString() }; | 
					
						
							|  |  |  |  |             GridColumn myCol23 = new GridColumn() { Caption = "标签", Visible = true, FieldName = WmsOutPickLable.fields.elabId.ToString() }; | 
					
						
							|  |  |  |  |            /* | 
					
						
							|  |  |  |  |             GridColumn myCol24 = new GridColumn() { Caption = "客户", Visible = true, FieldName = WmsOutPickRequest.fields.customerName.ToString() }; | 
					
						
							|  |  |  |  |             GridColumn myCol25 = new GridColumn() { Caption = "出库单", Visible = true, FieldName = WmsOutPickRequest.fields.pickOrderNo.ToString() }; | 
					
						
							|  |  |  |  |             GridColumn myCol26 = new GridColumn() { Caption = "复核异常", Visible = true, FieldName = "exception" }; | 
					
						
							|  |  |  |  |             GridColumn myCol27 = new GridColumn() { Caption = "复核数量", Visible = true, FieldName = WmsOutPickDetail.fields.confirmedCount.ToString() }; | 
					
						
							|  |  |  |  |             GridColumn myCol28 = new GridColumn() { Caption = "说明", Visible = true, FieldName = WmsOutPickDetail.fields.validRemark.ToString() }; | 
					
						
							|  |  |  |  |             GridColumn myCol281 = new GridColumn() { Caption = "复核台", Visible = true, FieldName = "desk" }; | 
					
						
							|  |  |  |  |             */ | 
					
						
							|  |  |  |  |             GridColumn myCol29 = new GridColumn() { Caption = "标签点亮", Visible = true, FieldName = "isLightUp" }; | 
					
						
							|  |  |  |  |             GridColumn myCol30 = new GridColumn() { Caption = "拣货状态", Visible = true, FieldName = "isPicked" }; | 
					
						
							|  |  |  |  |             GridColumn myCol31 = new GridColumn() { Caption = "端口", Visible = true, FieldName = "port" }; | 
					
						
							|  |  |  |  |             GridColumn myCol32 = new GridColumn() { Caption = "坐标", Visible = true, FieldName = "elabAddress" }; | 
					
						
							|  |  |  |  |            // GridColumn myCol25 = new GridColumn() { Caption = "拣货单", Visible = true, FieldName = "pickOrderNo" }; | 
					
						
							|  |  |  |  |   | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             RepositoryItemImageComboBox repositoryImageComboBox2 = new RepositoryItemImageComboBox();//新建一个RepositoryItemImageComboBox   | 
					
						
							|  |  |  |  |             repositoryImageComboBox2.GlyphAlignment = DevExpress.Utils.HorzAlignment.Center; | 
					
						
							|  |  |  |  |             repositoryImageComboBox2.SmallImages = imageList1; //指定一组图片   | 
					
						
							|  |  |  |  |             string[] s = new String[] {"1","0"}; | 
					
						
							|  |  |  |  |             for (int i = 0; i < s.Length; i++) | 
					
						
							|  |  |  |  |                 repositoryImageComboBox2.Items.Add(new ImageComboBoxItem(s[i], i + 1, i));//对应值绑定对应的图片   | 
					
						
							|  |  |  |  |             RepositoryItem ri = repositoryImageComboBox2 as RepositoryItem; | 
					
						
							|  |  |  |  |             gridControl1.RepositoryItems.Add(ri); | 
					
						
							|  |  |  |  |             myCol29.ColumnEdit = ri;      //绑定到GridColumn   | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             myCol30.ColumnEdit = ri; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (gridview == gridView1) | 
					
						
							|  |  |  |  |             {  | 
					
						
							|  |  |  |  |                 gridview.Columns.Add(myCol22); | 
					
						
							|  |  |  |  |                 gridview.OptionsView.ColumnAutoWidth = false; | 
					
						
							|  |  |  |  |                 gridview.BestFitColumns(); | 
					
						
							|  |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |           //  gridview.Columns.Add(myCol25); | 
					
						
							|  |  |  |  |             gridview.Columns.Add(myCol29); | 
					
						
							|  |  |  |  |             gridview.Columns.Add(myCol30);  | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |             gridview.Columns.Add(myCol22); | 
					
						
							|  |  |  |  |             gridview.Columns.Add(myCol100); | 
					
						
							|  |  |  |  |             gridview.Columns.Add(myCol21); | 
					
						
							|  |  |  |  |             | 
					
						
							|  |  |  |  |             gridview.Columns.Add(myCol23); | 
					
						
							|  |  |  |  |          /* | 
					
						
							|  |  |  |  |             gridview.Columns.Add(myCol25); | 
					
						
							|  |  |  |  |             gridview.Columns.Add(myCol101); | 
					
						
							|  |  |  |  |             gridview.Columns.Add(myCol5); | 
					
						
							|  |  |  |  |           //  gridview.Columns.Add(myCol17); | 
					
						
							|  |  |  |  |             gridview.Columns.Add(myCol24); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             gridview.Columns.Add(myCol7); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             gridview.Columns.Add(myCol14); | 
					
						
							|  |  |  |  |             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(myCol2); | 
					
						
							|  |  |  |  |             //   gridview.Columns.Add(myCol6); | 
					
						
							|  |  |  |  |               | 
					
						
							|  |  |  |  |             gridview.Columns.Add(myCol4); | 
					
						
							|  |  |  |  |               | 
					
						
							|  |  |  |  |             gridview.Columns.Add(myCol12); | 
					
						
							|  |  |  |  |             gridview.Columns.Add(myCol1); | 
					
						
							|  |  |  |  |            */ | 
					
						
							|  |  |  |  |             gridview.Columns.Add(myCol32); | 
					
						
							|  |  |  |  |             gridview.Columns.Add(myCol31); | 
					
						
							|  |  |  |  |             gridview.Columns.Add(myCol18); | 
					
						
							|  |  |  |  |             //to show bottom scroll bar | 
					
						
							|  |  |  |  |             gridview.OptionsView.ColumnAutoWidth = false; | 
					
						
							|  |  |  |  |             gridview.BestFitColumns(); | 
					
						
							|  |  |  |  |             //  gridView2.Focus(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 预处理,按客户分拆订单,生成分拣单,并出库 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         private void preErpOrders() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |    | 
					
						
							|  |  |  |  |            | 
					
						
							|  |  |  |  |             this.loadPickOrders(); | 
					
						
							|  |  |  |  |              | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |           //  client.Close(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |      | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         delegate void AsynUpdateUI(int step); | 
					
						
							|  |  |  |  |         | 
					
						
							|  |  |  |  |         private void updatePreOutStatus(int i) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (InvokeRequired) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 this.Invoke(new AsynUpdateUI(delegate(int s) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                      | 
					
						
							|  |  |  |  |                 }), i); | 
					
						
							|  |  |  |  |                 if (i == dtPickOrders.Rows.Count) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                  //   loadData();//更新界面列表 | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             else | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 | 
					
						
							|  |  |  |  |                 if (i == dtPickOrders.Rows.Count) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                  //   loadData();//更新界面列表 | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         DateTime lastRefreshTime; | 
					
						
							|  |  |  |  |         int refreshInterval = 5; | 
					
						
							|  |  |  |  |         //完成任务时需要调用 | 
					
						
							|  |  |  |  |         delegate void loadNewPickOrders(); | 
					
						
							|  |  |  |  |         private void refreshOrderList() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             //还可以进行其他的一些完任务完成之后的逻辑处理 | 
					
						
							|  |  |  |  |   | 
					
						
							|  |  |  |  |             //swAutoOrder.Enabled = true; | 
					
						
							|  |  |  |  |             //btnPickOrders.Enabled = !autoOrder;  | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (!autoOrder && !this.isManualRefreshPickList) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             TimeSpan ts = DateTime.Now - lastRefreshTime; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (ts.TotalSeconds < refreshInterval) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             | 
					
						
							|  |  |  |  |             this.isManualRefreshPickList = false; //手动刷新 只单独自动刷一次 | 
					
						
							|  |  |  |  |               | 
					
						
							|  |  |  |  |             lastRefreshTime = DateTime.Now; | 
					
						
							|  |  |  |  |             if (InvokeRequired) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 this.Invoke(new loadNewPickOrders(delegate() | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                      | 
					
						
							|  |  |  |  |                     this.loadPickOrders(); | 
					
						
							|  |  |  |  |                     if (autoOrder) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         setPreOrderInterVal(); | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                 })); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             else | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                | 
					
						
							|  |  |  |  |                 this.loadPickOrders(); | 
					
						
							|  |  |  |  |                 if (autoOrder) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     setPreOrderInterVal(); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |   | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void setPreOrderInterVal() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |              | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 更新拣选明细 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         private void   updatePickDetails() { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         DateTime lastWaveRequestTime; | 
					
						
							|  |  |  |  |         delegate void loadNewCurrentWave(); | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// start new wave | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         public void waveStart() { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             //swAutoWave.Enabled = true; | 
					
						
							|  |  |  |  |             //btnNewWave.Enabled = !autoWave; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |           //  loadWaveDetails(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-04 22:41:19 +08:00
										 |  |  |  |             if (pickConstants.WAVE_LAST_END == null) | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |             { | 
					
						
							| 
									
										
										
										
											2023-09-04 22:41:19 +08:00
										 |  |  |  |                 pickConstants.WAVE_LAST_END = DateTime.Now; | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |             } | 
					
						
							|  |  |  |  |             else | 
					
						
							|  |  |  |  |             { | 
					
						
							| 
									
										
										
										
											2023-09-04 22:41:19 +08:00
										 |  |  |  |                 TimeSpan ts = DateTime.Now - pickConstants.WAVE_LAST_END; | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |                 int sleepTime = (int)spinWave.Value;//波次间隔 5s | 
					
						
							|  |  |  |  |                 if (ts.TotalSeconds < sleepTime) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     return; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |            | 
					
						
							|  |  |  |  |            /* if (lastWaveRequestTime == null) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 lastWaveRequestTime = DateTime.Now; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             else | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 TimeSpan ts = DateTime.Now - lastWaveRequestTime; | 
					
						
							|  |  |  |  |                 int sleepTime = (int) spinWave.Value ;//波次间隔 5s | 
					
						
							|  |  |  |  |                 if (ts.TotalSeconds < sleepTime) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     return; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             }*/ | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (!canNewWave) // if (!lgt.canNewWave) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                  | 
					
						
							|  |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (swAutoWave.IsOn) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 // int sleepTime = (int) spinWave.Value * 1000;//波次间隔 5s | 
					
						
							|  |  |  |  |                 //while (!lgt.canNewWave) | 
					
						
							|  |  |  |  |                 //{  | 
					
						
							|  |  |  |  |                 //    Thread.CurrentThread.Join(1000);  | 
					
						
							|  |  |  |  |                 //} | 
					
						
							|  |  |  |  |                 // Thread.CurrentThread.Join(sleepTime);   | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 this.clearWaveData(); | 
					
						
							|  |  |  |  |                 newWave(); | 
					
						
							|  |  |  |  |                 lastWaveRequestTime = DateTime.Now; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             else | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 btnNewWave.Enabled = dtBulks== null || dtBulks.Rows.Count == 0 ; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         void loadWaveDetails() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             debug("start to loadWaveDetails....."); | 
					
						
							|  |  |  |  |             if (InvokeRequired) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 this.Invoke(new loadNewCurrentWave(delegate() | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     swAutoWave.Enabled = true; | 
					
						
							|  |  |  |  |                     btnNewWave.Enabled = !autoWave; | 
					
						
							|  |  |  |  |                     this.loadPickOrdersInWave(); | 
					
						
							|  |  |  |  |                   //  this.loadPickOrders();//更新等待订单列表 | 
					
						
							|  |  |  |  |                  //   btnEndWave.Enabled = true; | 
					
						
							|  |  |  |  |                 })); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             else | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 swAutoWave.Enabled = true; | 
					
						
							|  |  |  |  |                 btnNewWave.Enabled = !autoWave; | 
					
						
							|  |  |  |  |                 this.loadPickOrdersInWave(); | 
					
						
							|  |  |  |  |              //   btnEndWave.Enabled = true; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             debug("end loadWaveDetails...."); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |        // Thread threadNewWave; | 
					
						
							|  |  |  |  |         private void newWave() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             try | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 debug("start to create new wave ....."); | 
					
						
							|  |  |  |  |                 Thread threadNewWave = new Thread(newPickWave); | 
					
						
							|  |  |  |  |                 threadNewWave.IsBackground = true; | 
					
						
							|  |  |  |  |                 threadNewWave.Start(); | 
					
						
							|  |  |  |  |                // loadWaveDetails(); | 
					
						
							|  |  |  |  |                 // lgt.newPickWave(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 debug(" create new wave in new thread....."); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             catch (DeiNiuException de) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 showErrorMsg(de.Message); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             catch (Exception er) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 showErrorMsg(er.Message); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |   | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |         private void loadPickOrdersInWave() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             debug("start loadPickOrdersInWave....."); | 
					
						
							|  |  |  |  |             showWaitForm(); | 
					
						
							|  |  |  |  |             try | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 DataSet ds = lgt.getWmsOutPickLable.getCurrentWavePick(); | 
					
						
							|  |  |  |  |                 dtBulks = ds .Tables[0]; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 gridControl1.DataSource = ds.Tables[1].DefaultView; | 
					
						
							|  |  |  |  |                 initialGridView3Columns(gridView1); | 
					
						
							|  |  |  |  |                 updateLableStatus(dtBulks); | 
					
						
							|  |  |  |  |                 debug(string.Format("load bulk details in current wave,count {0} ", dtBulks.Rows.Count)); | 
					
						
							|  |  |  |  |                 gridControl2.DataSource = dtBulks.DefaultView; | 
					
						
							|  |  |  |  |                 initialGridView3Columns(gridView3); | 
					
						
							|  |  |  |  |                 btnRelight.Enabled = dtBulks.Rows.Count > 0; | 
					
						
							| 
									
										
										
										
											2023-09-04 22:41:19 +08:00
										 |  |  |  |                 pickConstants.WAVE_CURRENT_ORDER = ""; | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |                 btnNewWave.Enabled = dtBulks.Rows.Count == 0; | 
					
						
							|  |  |  |  |                 if (dtBulks.Rows.Count > 0) | 
					
						
							|  |  |  |  |                 { | 
					
						
							| 
									
										
										
										
											2023-09-04 22:41:19 +08:00
										 |  |  |  |                     pickConstants.WAVE_LAST_FREE_TIME = DateTime.MinValue; | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |                     //if (string.IsNullOrEmpty(WmsConstants.WAVE_CURRENT_ORDER)) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                         string waveStarTime = dtBulks.Rows[0]["createtime"].ToString(); | 
					
						
							|  |  |  |  |                         DateTime lastWaveTime = Convert.ToDateTime(waveStarTime); | 
					
						
							|  |  |  |  |                         string currentWaveOrder = dtBulks.Rows[0]["waveOrder"].ToString(); | 
					
						
							| 
									
										
										
										
											2023-09-04 22:41:19 +08:00
										 |  |  |  |                         pickConstants.WAVE_LAST_TIME = lastWaveTime; | 
					
						
							|  |  |  |  |                         pickConstants.WAVE_CURRENT_ORDER = currentWaveOrder; //只显示有零货的波次 | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |                     } | 
					
						
							|  |  |  |  |                      | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 else | 
					
						
							|  |  |  |  |                 { | 
					
						
							| 
									
										
										
										
											2023-09-04 22:41:19 +08:00
										 |  |  |  |                     if (pickConstants.WAVE_LAST_FREE_TIME == DateTime.MinValue) | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |                     { | 
					
						
							| 
									
										
										
										
											2023-09-04 22:41:19 +08:00
										 |  |  |  |                         pickConstants.WAVE_LAST_FREE_TIME = DateTime.Now; | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |                     } | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 debug("initialGridView2Columns .....1"); | 
					
						
							|  |  |  |  |                 | 
					
						
							| 
									
										
										
										
											2023-09-04 22:41:19 +08:00
										 |  |  |  |                 lbWaveNo.Text = string.IsNullOrEmpty(pickConstants.WAVE_CURRENT_ORDER) ? "空闲" : pickConstants.WAVE_CURRENT_ORDER; | 
					
						
							|  |  |  |  |                 btnEndWave.Enabled = !string.IsNullOrEmpty(pickConstants.WAVE_CURRENT_ORDER); | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |                 //get validaiton exception list | 
					
						
							|  |  |  |  |                 debug("initialGridView2Columns .....2"); | 
					
						
							|  |  |  |  |                 | 
					
						
							|  |  |  |  |   | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |               | 
					
						
							|  |  |  |  |             catch (Exception er) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 //  setCurrentRequestDetail(); | 
					
						
							|  |  |  |  |                // showErrorMsg(er.Message); | 
					
						
							|  |  |  |  |             }  | 
					
						
							|  |  |  |  |             closeWaitForm(); | 
					
						
							|  |  |  |  |             debug("end loadPickOrdersInWave....."); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |         private void clearInputs() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |         | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         System.Timers.Timer timer = new System.Timers.Timer();//实例化Timer类 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         //private void timeCnt() | 
					
						
							|  |  |  |  |         //{ | 
					
						
							|  |  |  |  |         //    timer.Start(); ; | 
					
						
							|  |  |  |  |         //} | 
					
						
							|  |  |  |  |         private void initialTimer() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             int intTime = 2000; | 
					
						
							|  |  |  |  |             timer.Interval = intTime;//设置间隔时间,为毫秒; | 
					
						
							|  |  |  |  |             timer.Elapsed += new System.Timers.ElapsedEventHandler(showWaveSpan);//到达时间的时候执行事件; | 
					
						
							|  |  |  |  |             timer.AutoReset = true;//设置是执行一次(false)还是一直执行(true); | 
					
						
							|  |  |  |  |             timer.Enabled = true;//是否执行System.Timers.Timer.Elapsed事件; | 
					
						
							|  |  |  |  |              timer.Start();  | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         bool isShowing = false; | 
					
						
							|  |  |  |  |         private void showWaveSpan(object source, System.Timers.ElapsedEventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (isShowing) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             isShowing = true; | 
					
						
							|  |  |  |  |          //   debug(string.Format(" timer loop begin .... " )); | 
					
						
							| 
									
										
										
										
											2023-09-04 22:41:19 +08:00
										 |  |  |  |             TimeSpan ts = DateTime.Now - pickConstants.WAVE_LAST_TIME;// WmsConstants.WAVE_LAST_TIME;  | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |             try | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 if (InvokeRequired) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     this.Invoke(new loadNewCurrentWave(delegate() | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                       //  lbLightsInfo.Text = (lights.Count > 0 ? "" : "未检测到通道灯"); | 
					
						
							|  |  |  |  |                         //refreshOrderList(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                         updateLableStatus(); | 
					
						
							| 
									
										
										
										
											2023-09-04 22:41:19 +08:00
										 |  |  |  |                         if (string.IsNullOrEmpty(pickConstants.WAVE_CURRENT_ORDER)) //start new wave | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |                         { | 
					
						
							|  |  |  |  |                             lbWaveSpan.ForeColor = Color.Green; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-04 22:41:19 +08:00
										 |  |  |  |                             TimeSpan ts1 = DateTime.Now - pickConstants.WAVE_LAST_END; // WmsConstants.WAVE_LAST_FREE_TIME; | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |                             lbWaveSpan.Text = string.Format("{0:D2}:{1:D2}:{2:D2}", ts1.Hours, ts1.Minutes, ts1.Seconds); | 
					
						
							|  |  |  |  |                            // debug(string.Format(" timer loop to start new wave.... ")); | 
					
						
							|  |  |  |  |                           //  this.clearWaveData(); | 
					
						
							|  |  |  |  |                             waveStart();// newWave(); | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                         else | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             lbWaveSpan.ForeColor = Color.Black; | 
					
						
							|  |  |  |  |                             lbWaveSpan.Text = string.Format("{0:D2}:{1:D2}:{2:D2}", ts.Hours, ts.Minutes, ts.Seconds+2); | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                         if (isToReLight()) | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             lightLables(); | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                     }));  | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 else | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     //lbLightsInfo.Text = (lights.Count > 0 ? "" : "未检测到通道灯"); | 
					
						
							|  |  |  |  |                     updateLableStatus(); | 
					
						
							| 
									
										
										
										
											2023-09-04 22:41:19 +08:00
										 |  |  |  |                     if (string.IsNullOrEmpty(pickConstants.WAVE_CURRENT_ORDER)) //start new wave | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |                     { | 
					
						
							|  |  |  |  |                         lbWaveSpan.ForeColor = Color.Green; | 
					
						
							| 
									
										
										
										
											2023-09-04 22:41:19 +08:00
										 |  |  |  |                         TimeSpan ts1 = DateTime.Now - pickConstants.WAVE_LAST_FREE_TIME; | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |                         lbWaveSpan.Text = string.Format("{0:D2}:{1:D2}:{2:D2}", ts1.Hours, ts1.Minutes, ts1.Seconds); | 
					
						
							|  |  |  |  |                        // this.clearWaveData(); | 
					
						
							|  |  |  |  |                         waveStart();// newWave(); | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                     else | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         lbWaveSpan.ForeColor = Color.Black; | 
					
						
							|  |  |  |  |                         lbWaveSpan.Text = string.Format("{0:D2}:{1:D2}:{2:D2}", ts.Hours, ts.Minutes, ts.Seconds); | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                     if (isToReLight()) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         lightLables(); | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             catch (Exception er) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 LogHelper.WriteLog(typeof(GoodsOutForm), er); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             isShowing = false; | 
					
						
							|  |  |  |  |          //   debug(string.Format(" timer loop end .... ")); | 
					
						
							|  |  |  |  |              | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void btnDelete_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         {  | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         protected void query() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |              | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void loadPickOrders() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |           //  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; | 
					
						
							|  |  |  |  |             loadPickOrders(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         | 
					
						
							|  |  |  |  |   | 
					
						
							|  |  |  |  |         private bool getCurrentObject() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (selectedRowIndex <0 || selectedRowIndex >= dtPickOrders.Rows.Count) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return false; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             | 
					
						
							|  |  |  |  |             //DataRow currentRow = dtPickOrders.Rows[selectedRowIndex]; | 
					
						
							|  |  |  |  |             //selectedRequest = new WmsOutPickRequest(currentRow);  | 
					
						
							|  |  |  |  |              return true; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         | 
					
						
							|  |  |  |  |               | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |        | 
					
						
							|  |  |  |  |         private void initialDataGrid() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             this.gridView3.IndicatorWidth = 40; | 
					
						
							|  |  |  |  |             this.gridView3.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler(gridView_CustomDrawRowIndicator); | 
					
						
							|  |  |  |  |      | 
					
						
							|  |  |  |  |             this.gridView1.IndicatorWidth = 40; | 
					
						
							|  |  |  |  |             this.gridView1.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler(gridView_CustomDrawRowIndicator); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |              | 
					
						
							|  |  |  |  |             gridView3.CustomColumnDisplayText += gridView3_CustomColumnDisplayText; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |     | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |        void gridView_RowCellStyle(object sender,DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e) | 
					
						
							|  |  |  |  |        { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             var currentView = sender as GridView; | 
					
						
							|  |  |  |  |            if( currentView == null){return;} | 
					
						
							|  |  |  |  |            string state = currentView.GetDataRow(e.RowHandle)["priority"].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 highPriorityFocus = new DevExpress.Utils.AppearanceDefault(Color.White, Color.Green); | 
					
						
							|  |  |  |  |            DevExpress.Utils.AppearanceDefault highPriority = new DevExpress.Utils.AppearanceDefault(Color.Green, Color.White); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |            if (state == "1") | 
					
						
							|  |  |  |  |            { | 
					
						
							|  |  |  |  |                rowStyle = isFocused ? highPriorityFocus : highPriority; | 
					
						
							|  |  |  |  |            } | 
					
						
							|  |  |  |  |            else if (state == "2") | 
					
						
							|  |  |  |  |            { | 
					
						
							|  |  |  |  |                rowStyle = isFocused ? alertFocus : alert; | 
					
						
							|  |  |  |  |            } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |              | 
					
						
							|  |  |  |  |            DevExpress.Utils.AppearanceHelper.Apply(e.Appearance, rowStyle); | 
					
						
							|  |  |  |  |             | 
					
						
							|  |  |  |  |        } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |   | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void btnNewWave_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             clearWaveData(); | 
					
						
							|  |  |  |  |             btnNewWave.Enabled = false; | 
					
						
							|  |  |  |  |             newWave(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private bool isShowId=true; | 
					
						
							|  |  |  |  |         private void showId() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             foreach (int port in pick.activeComports) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 if (port == 0) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     continue; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 if (isShowId) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     pick.displayLabels(port); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 else | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     pick.clearLabels(port); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                    | 
					
						
							|  |  |  |  |             }  | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             isShowId = !isShowId; | 
					
						
							|  |  |  |  |             btnShowId.Text = isShowId ? "关闭显示" : "显示ID"; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |   | 
					
						
							|  |  |  |  |   | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void btnEndWave_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |            | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (MessageBox.Show("确定确认货物已经拣选完毕,并强制结束本轮拣货吗?", "强制结束", MessageBoxButtons.OKCancel) == DialogResult.Cancel) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return; | 
					
						
							|  |  |  |  |                  | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             endWave(true); | 
					
						
							|  |  |  |  |             resetDevice(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         void turnOffLights() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (lights.Count == 0) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 //searchLight(); | 
					
						
							|  |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |                | 
					
						
							|  |  |  |  |            // Model.dis_id_comment id; | 
					
						
							|  |  |  |  |             dis_id id; | 
					
						
							|  |  |  |  |             //id.ele_id = Convert.ToInt16(new_id.Text); | 
					
						
							|  |  |  |  |             id.order = 1; | 
					
						
							|  |  |  |  |             id.ele_id = 65535;  | 
					
						
							|  |  |  |  |             id.state = 1; | 
					
						
							|  |  |  |  |             //id. | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             foreach (int port in pick.activeComports) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 if (port == 0) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     continue; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |               //  unart_manage.com_manage[port].write_reset_device(); 复位各个硬件,通道灯,标签。。。 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 unart_manage.com_manage[port].init_port.write_clear_comment(id); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 if (!lights.ContainsKey(port)) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     continue; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 foreach (int light in lights[port]) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     channel_led idx = new channel_led(); | 
					
						
							|  |  |  |  |                     idx.channel_id = light;   | 
					
						
							|  |  |  |  |                     idx.state = 1; | 
					
						
							|  |  |  |  |                     unart_manage.com_manage[port].init_port.write_close_channel_led(idx); | 
					
						
							|  |  |  |  |                 }  | 
					
						
							|  |  |  |  |                | 
					
						
							|  |  |  |  |                // a.write_clear_comment(id); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         Dictionary<int, List<int>> lights = new Dictionary<int, List<int>>(); | 
					
						
							|  |  |  |  |         void searchLight() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             Model.modify_id id; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |          //   System.Threading.Thread.Sleep(50); | 
					
						
							|  |  |  |  |             foreach (int port in pick.activeComports) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 if (port == 0) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     continue; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 for (int i = 5000; i <= 5100; i++) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     id.order = 0; | 
					
						
							|  |  |  |  |                     id.new_ele_id = 0; | 
					
						
							|  |  |  |  |                     id.old_ele_id = i; | 
					
						
							|  |  |  |  |                     id.state = 1; | 
					
						
							|  |  |  |  |                     bool ret = unart_manage.com_manage[port].init_port.search_light_id(id); | 
					
						
							|  |  |  |  |                     if (ret) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         if (!lights.ContainsKey(port)) | 
					
						
							|  |  |  |  |                         {                            | 
					
						
							|  |  |  |  |                             lights[port] = new List<int>(); | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                         lights[port].Add(i); | 
					
						
							|  |  |  |  |                         | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |               | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         void endWave(bool isForce=false) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (isForce)                | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |               //  pick.init_port(enumLabelPickType.pick); | 
					
						
							|  |  |  |  |                 turnOffLights(); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             try | 
					
						
							|  |  |  |  |             { | 
					
						
							| 
									
										
										
										
											2023-09-04 22:41:19 +08:00
										 |  |  |  |                 lgt.finishCurrentWave( pickConstants.WAVE_CURRENT_ORDER, isForce); | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |                   | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             catch(Exception e) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 showErrorMsg(e.Message); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             clearWaveData(); | 
					
						
							|  |  |  |  |             waveStart(); | 
					
						
							|  |  |  |  |             btnEndWave.Enabled = false; | 
					
						
							|  |  |  |  |             btnRelight.Enabled = false; | 
					
						
							|  |  |  |  |             _canNewWave = true; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         private void clearWaveData() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-04 22:41:19 +08:00
										 |  |  |  |             pickConstants.WAVE_CURRENT_ORDER = ""; | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |             lbWaveNo.Text = "空闲"; | 
					
						
							|  |  |  |  |      | 
					
						
							|  |  |  |  |             if (dtBulks != null) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 dtBulks.Clear(); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |        //     gridControl3.DataSource = null; | 
					
						
							|  |  |  |  |              | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         private void swAutoOrder_Toggled(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |           | 
					
						
							|  |  |  |  |             if (autoOrder) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 preErpOrders(); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void swAutoWave_Toggled(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             autoWave = swAutoWave.IsOn; | 
					
						
							|  |  |  |  |             btnNewWave.Enabled = !autoWave; | 
					
						
							|  |  |  |  |             btnNewWave.Enabled =!autoWave &&( dtBulks == null || dtBulks.Rows.Count == 0); | 
					
						
							|  |  |  |  |            | 
					
						
							|  |  |  |  |             if (autoWave) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 newWave(); | 
					
						
							|  |  |  |  |                 | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             setAutoHint(); | 
					
						
							|  |  |  |  |             WriteConfig("IsAuto", autoWave.ToString());  | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         void setAutoHint() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (!swAutoWave.IsOn) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 lbAutoWave.Text = "自动波次关"; | 
					
						
							|  |  |  |  |                 lbAutoWave.ForeColor = Color.Gray; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             else | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 lbAutoWave.Text = "自动波次开"; | 
					
						
							|  |  |  |  |                 lbAutoWave.ForeColor = Color.Red; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void btnRefresh_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             loadPickOrdersInWave(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void btnRelight_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             turnOffLights(); | 
					
						
							|  |  |  |  |             lightLabelsCurrentWave(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void lightLabelsCurrentWave() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |              | 
					
						
							|  |  |  |  |             debug("start relightCurrentWave....."); | 
					
						
							|  |  |  |  |             //Thread light = new Thread(lgt.lightLables); | 
					
						
							|  |  |  |  |             //light.IsBackground = true; | 
					
						
							|  |  |  |  |             //light.Start(); | 
					
						
							|  |  |  |  |             | 
					
						
							|  |  |  |  |             loadWaveDetails(); | 
					
						
							|  |  |  |  |             closeWaitForm(); | 
					
						
							|  |  |  |  |             showWaitForm("正在点亮标签..."); | 
					
						
							|  |  |  |  |             try | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 lightLables(); // lgt.lightLables(); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             catch(Exception er) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 closeWaitForm(); | 
					
						
							|  |  |  |  |                 showErrorMsg(er.Message); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             finally | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |              closeWaitForm(); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |              debug("end relightCurrentWave....."); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         //private void checkAuto_CheckedChanged(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         //{ | 
					
						
							|  |  |  |  |         //    spinOrder.Enabled = checkAuto.Checked; | 
					
						
							|  |  |  |  |         //} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |         private void updateLableStatus(DataTable dt = null) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |            string key = ""; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (dt != null) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 foreach (DataRow dr in dt.Rows) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                     if (dr["state"].ToString().Equals("1")) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                        key = Util.getLightKey(Convert.ToInt16(dr["color"].ToString()), Convert.ToInt16(dr["elabId"].ToString()), Convert.ToInt16(dr["elabAddress"].ToString())); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-04 22:41:19 +08:00
										 |  |  |  |                        pickConstants.WAVE_CURRENT_PICK_STATUS[key] = true; | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |                     }  | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                   | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (dtBulks == null || dtBulks.Rows.Count == 0) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |            | 
					
						
							|  |  |  |  |             WmsOutPickLable label; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             DataView dv = dtBulks.DefaultView; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             dv.RowFilter = "isPicked =0"; | 
					
						
							|  |  |  |  |             dv.Sort = "isPicked"; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (dv.Count ==0) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 //all picked, wave end | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |                 endWave(); | 
					
						
							|  |  |  |  |                 return; | 
					
						
							|  |  |  |  |             }  | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             foreach (DataRow dr in dtBulks.Rows) | 
					
						
							|  |  |  |  |             {  | 
					
						
							|  |  |  |  |                 label = new  WmsOutPickLable(dr);  | 
					
						
							|  |  |  |  |                 key = Util.getLightKey(label.color, label.elabId, label.elabAddress); | 
					
						
							| 
									
										
										
										
											2023-09-04 22:41:19 +08:00
										 |  |  |  |                 if( pickConstants.WAVE_CURRENT_LIGHTS_STATUS.ContainsKey(key)){ | 
					
						
							|  |  |  |  |                     dr["isLightUp"] = pickConstants.WAVE_CURRENT_LIGHTS_STATUS[key] ? 1 : 0; | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |                       | 
					
						
							|  |  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2023-09-04 22:41:19 +08:00
										 |  |  |  |                 if (pickConstants.WAVE_CURRENT_PICK_STATUS.ContainsKey(key)) | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |                 { | 
					
						
							| 
									
										
										
										
											2023-09-04 22:41:19 +08:00
										 |  |  |  |                     dr["isPicked"] = pickConstants.WAVE_CURRENT_PICK_STATUS[key] ? 1 : 0; | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |                 }   | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             dv.RowFilter = ""; // 如果   dv.RowFilter ="isPicked =0"; 则已拣的不再显示 | 
					
						
							|  |  |  |  |             gridControl2.DataSource = dtBulks.DefaultView; | 
					
						
							|  |  |  |  |              | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void GoodsOutForm_FormClosing(object sender, FormClosingEventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             timer.Stop(); | 
					
						
							|  |  |  |  |             timer.Dispose(); | 
					
						
							|  |  |  |  |           //  pickClient.Close(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         //-------------below moved from logic layer | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |          /// <summary> | 
					
						
							|  |  |  |  |         /// 点亮待拣选标签 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         private void lightLablesInSvc() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         bool isLighting = false; | 
					
						
							|  |  |  |  |         private void doLightLabels() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (InvokeRequired) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 this.Invoke(new loadNewCurrentWave(delegate() | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     lbLightsInfo.Text = "连接正常"; | 
					
						
							|  |  |  |  |                     elelab.pick.init_port(enumLabelPickType.pick); | 
					
						
							|  |  |  |  |                     if (elelab.pick.activeComports.Count == 0) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         lbLightsInfo.Text = "拣选设备连接错误"; | 
					
						
							|  |  |  |  |                         // showErrorMsg("拣选设备连接错误,请检查设备连接"); | 
					
						
							|  |  |  |  |                         return; | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 })); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             else | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 lbLightsInfo.Text = "连接正常"; | 
					
						
							|  |  |  |  |                 elelab.pick.init_port(enumLabelPickType.pick); | 
					
						
							|  |  |  |  |                 if (elelab.pick.activeComports.Count == 0) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     lbLightsInfo.Text = "拣选设备连接错误"; | 
					
						
							|  |  |  |  |                     // showErrorMsg("拣选设备连接错误,请检查设备连接"); | 
					
						
							|  |  |  |  |                     return; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             lastWave = DateTime.Now; | 
					
						
							| 
									
										
										
										
											2023-09-04 22:41:19 +08:00
										 |  |  |  |             pickConstants.WAVE_CURRENT_LIGHTS_STATUS.Clear();  | 
					
						
							|  |  |  |  |             string result = elelab.pick.send_data_pick(lgt.getWmsOutPickLable.getData4Pick(pickConstants.WAVE_CURRENT_ORDER).Tables[0], enumLabelPickType.pick); | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |   | 
					
						
							|  |  |  |  |             closeWaitForm(); | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(result)) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 if (InvokeRequired) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     this.Invoke(new loadNewCurrentWave(delegate() | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         lbLightsInfo.Text = result; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                     })); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 else | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     lbLightsInfo.Text = result; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |   | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 点亮待拣选标签 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         private void lightLables() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             LogHelper.debug(this.GetType(), "begin to light up labels....isLighting: " + isLighting); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (isLighting) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             isLighting = true; | 
					
						
							|  |  |  |  |             try | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 doLightLabels(); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             catch (Exception er) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 LogHelper.debug(this.GetType(), "lighting exception: " + er.StackTrace.ToString()); | 
					
						
							|  |  |  |  |                 showErrorMsg(er.Message); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             closeWaitForm(); | 
					
						
							|  |  |  |  |             isLighting = false; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             LogHelper.debug(this.GetType(), "lighting is done ,isLighting: " + isLighting); | 
					
						
							|  |  |  |  |   | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private static bool _canNewWave = true; | 
					
						
							|  |  |  |  |         //Int64 lastWave =0; | 
					
						
							|  |  |  |  |         DateTime lastWave; | 
					
						
							|  |  |  |  |         public bool canNewWave | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             get | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                   | 
					
						
							|  |  |  |  |               //  _canNewWave = _canNewWave && outRequest.canNewWave(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 if (!autoWave) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     return true; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 if (_canNewWave) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     lastWave = DateTime.Now; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 else | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     TimeSpan ts = DateTime.Now - lastWave; | 
					
						
							| 
									
										
										
										
											2023-09-04 22:41:19 +08:00
										 |  |  |  |                     if (ts.TotalMilliseconds > pickConstants.MAX_SECONDS_BETWEEN_WAVES) //强制开始新波次,有可能会有再次发送亮灯数据时 | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |                     { | 
					
						
							|  |  |  |  |                         _canNewWave = true; | 
					
						
							|  |  |  |  |                         lastWave = DateTime.Now; | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 return _canNewWave;//|| outRequest.canNewWave() ;//|| true; | 
					
						
							|  |  |  |  |                 //  return _canNewWave; // pickLabelDetail.getCurrentPickList(enumLabelPickState.notPicked).Tables[0].Rows.Count > 0; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         public void newPickWave() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (((main)this.ParentForm).validStatus == enumOnlineStatus.过期) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (!canNewWave) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             _canNewWave = false; | 
					
						
							|  |  |  |  |             bool exist = false; | 
					
						
							|  |  |  |  |             try | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 exist = lgt.getWmsOutPickLable.getCurrentPickList().Tables[0].Rows.Count > 0; | 
					
						
							|  |  |  |  |                 | 
					
						
							|  |  |  |  |               | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 // bool exist = outRequest.getRequests(enumOutOrderType.pickOrder, enumOutStockRequestStatus.picking).Tables[0].Rows.Count >0; | 
					
						
							|  |  |  |  |                 if (exist) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     if (isNeedRelight()) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         lightLables(); | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                     // TaskCallBack(); | 
					
						
							|  |  |  |  |                     loadWaveDetails(); | 
					
						
							|  |  |  |  |                     return; | 
					
						
							|  |  |  |  |                     //  throw new DeiNiuException("当前波次还未处理完毕,不能开始新的波次。"); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 // List<WmsOutPickRequest> requests = outRequest.getRequestObjects(enumOutOrderType.拣货单, enumOutStockRequestStatus.波次处理); | 
					
						
							|  |  |  |  |                /* int cnt = lgt.getRequests4WaveCnt((int)enumOutOrderType.拣货单, (int)enumOutStockRequestStatus.波次处理); | 
					
						
							|  |  |  |  |                  | 
					
						
							|  |  |  |  |                 if (cnt == 0) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     _canNewWave = true; | 
					
						
							|  |  |  |  |                     //   TaskCallBack(); | 
					
						
							|  |  |  |  |                     return; | 
					
						
							|  |  |  |  |                     //throw new DeiNiuException("没有待出库数据需要处理的。"); | 
					
						
							|  |  |  |  |                 }*/ | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 //to call client for new wave | 
					
						
							|  |  |  |  |                 showWaitForm("正在配置新波次"); | 
					
						
							|  |  |  |  |                 lgt.newPickWave(); | 
					
						
							|  |  |  |  |                  | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             catch (Exception er) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 LogHelper.WriteLog(this.GetType(), er); | 
					
						
							|  |  |  |  | #if debug | 
					
						
							|  |  |  |  |                 showErrorMsg(er.Message); | 
					
						
							|  |  |  |  | #endif | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             lastWaveRequestTime = DateTime.Now; | 
					
						
							| 
									
										
										
										
											2023-09-04 22:41:19 +08:00
										 |  |  |  |             pickConstants.WAVE_CURRENT_PICK_STATUS.Clear(); | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |             lightLabelsCurrentWave(); | 
					
						
							|  |  |  |  |             _canNewWave = true; | 
					
						
							|  |  |  |  |             closeWaitForm(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         bool isNeedRelight() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             return dtBulks.Rows.Count>0  | 
					
						
							|  |  |  |  |                 &&( | 
					
						
							| 
									
										
										
										
											2023-09-04 22:41:19 +08:00
										 |  |  |  |                 pickConstants.WAVE_CURRENT_LIGHTS_STATUS.ContainsValue(false)  | 
					
						
							|  |  |  |  |                 || pickConstants.WAVE_CURRENT_LIGHTS_STATUS.Count == 0 | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |                 ); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         bool isToReLight() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             int i = 0; | 
					
						
							| 
									
										
										
										
											2023-09-04 22:41:19 +08:00
										 |  |  |  |             foreach (bool bl in pickConstants.WAVE_CURRENT_LIGHTS_STATUS.Values) | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |             { | 
					
						
							|  |  |  |  |                 if (!bl) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     i++; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             int k = 0; | 
					
						
							| 
									
										
										
										
											2023-09-04 22:41:19 +08:00
										 |  |  |  |              foreach (bool bl in pickConstants.WAVE_CURRENT_PICK_STATUS.Values) | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |             { | 
					
						
							|  |  |  |  |                 if (bl) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     k++; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-04 22:41:19 +08:00
										 |  |  |  |              bool ret= dtBulks.Rows.Count>0 && (pickConstants.WAVE_CURRENT_LIGHTS_STATUS.Count==0 || | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |                  i > 0 && k + i == dtBulks.Rows.Count | 
					
						
							|  |  |  |  |                  ); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |              LogHelper.debug(this.GetType(), " can relight:  " + ret); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |              return ret; | 
					
						
							|  |  |  |  |                | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void label1_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |       //  bool isPriorityQuery = false; | 
					
						
							|  |  |  |  |         private void btnQuery_Click_1(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |           //  isPriorityQuery = true; | 
					
						
							|  |  |  |  |             this.query(); | 
					
						
							|  |  |  |  |           //  isPriorityQuery = false; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |           | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void lgPriority_CustomButtonChecked(object sender, DevExpress.XtraBars.Docking2010.BaseButtonEventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             lastQuery = ""; | 
					
						
							|  |  |  |  |              query(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void lgPriority_CustomButtonUnchecked(object sender, DevExpress.XtraBars.Docking2010.BaseButtonEventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void btnExport_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             exportExcel("",gridView1); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         string[] colors = new string[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" }; | 
					
						
							|  |  |  |  |         private void gridView3_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (string.IsNullOrEmpty(e.DisplayText)) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (e.Column.FieldName == "color") | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 if (colors.Contains(e.DisplayText)) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                     int display = -100; | 
					
						
							|  |  |  |  |                     string disTxt = e.DisplayText; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                     try | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         display = Convert.ToInt16(e.DisplayText); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                         e.DisplayText =getColor(display); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                     catch | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         return; | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         string getColor(int color) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             string colorName = ""; | 
					
						
							|  |  |  |  |             switch (color) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 case 1: | 
					
						
							|  |  |  |  |                     colorName = "红"; | 
					
						
							|  |  |  |  |                     break; | 
					
						
							|  |  |  |  |                 case 2: | 
					
						
							|  |  |  |  |                     colorName = "绿"; | 
					
						
							|  |  |  |  |                     break; | 
					
						
							|  |  |  |  |                 case 3: | 
					
						
							|  |  |  |  |                     colorName = "蓝"; | 
					
						
							|  |  |  |  |                     break; | 
					
						
							|  |  |  |  |                 case 4: | 
					
						
							|  |  |  |  |                     colorName = "红闪"; | 
					
						
							|  |  |  |  |                     break; | 
					
						
							|  |  |  |  |                 case 5: | 
					
						
							|  |  |  |  |                     colorName = "绿闪"; | 
					
						
							|  |  |  |  |                     break; | 
					
						
							|  |  |  |  |                 case 6: | 
					
						
							|  |  |  |  |                     colorName = "蓝闪"; | 
					
						
							|  |  |  |  |                     break; | 
					
						
							|  |  |  |  |                 case 7: | 
					
						
							|  |  |  |  |                     colorName = "红绿"; | 
					
						
							|  |  |  |  |                     break; | 
					
						
							|  |  |  |  |                 case 8: | 
					
						
							|  |  |  |  |                     colorName = "红蓝"; | 
					
						
							|  |  |  |  |                     break; | 
					
						
							|  |  |  |  |                 case 9: | 
					
						
							|  |  |  |  |                     colorName = "绿蓝"; | 
					
						
							|  |  |  |  |                     break; | 
					
						
							|  |  |  |  |                 case 10: | 
					
						
							|  |  |  |  |                     colorName = "红绿蓝"; | 
					
						
							|  |  |  |  |                     break; | 
					
						
							|  |  |  |  |                | 
					
						
							|  |  |  |  |                 default: | 
					
						
							|  |  |  |  |                     colorName = "红"; | 
					
						
							|  |  |  |  |                     break; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             return colorName; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void GoodsOutForm_Load(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void spinColors_EditValueChanged(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2023-09-04 22:41:19 +08:00
										 |  |  |  |             pickConstants.MAX_COLORS = Convert.ToInt16( spinColors.Value) ; | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void spinWave_EditValueChanged(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             spinWave.Value = spinWave.Value > 15 ? spinWave.Value : 15; | 
					
						
							|  |  |  |  |             WriteConfig("Interval", spinWave.Text) ; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void simpleButton1_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             resetDevice(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         void resetDevice() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             foreach (int port in pick.activeComports) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 if (port == 0) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     continue; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 unart_manage.com_manage[port].write_reset_device(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void btnShowId_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             showId(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | } |