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 DeiNiu.wms.win.ServiceReferenceOutRequest; //远程
|
|
|
|
|
using DeiNiu.wms.win.ServiceReferenceStockOutRequest;
|
|
|
|
|
using DeiNiu.wms.win.ServiceReferenceStockOutPickRequest;
|
|
|
|
|
using Deiniu.win.elelab;
|
|
|
|
|
using DNLightSvr;
|
|
|
|
|
using System.ServiceModel;
|
|
|
|
|
using System.ServiceModel.Description; //开发环境
|
2023-11-21 19:18:23 +08:00
|
|
|
|
using DeiNiu.wms.win.utils.print;
|
2023-05-23 16:13:17 +08:00
|
|
|
|
// using DeiNiu.wms.win.ServiceReferenceOutRequestLocal;//本地
|
|
|
|
|
|
|
|
|
|
namespace DeiNiu.wms.win
|
|
|
|
|
{
|
|
|
|
|
public partial class GoodsOutServiceForm : BasicRibbonForm
|
|
|
|
|
{
|
|
|
|
|
|
2023-11-21 19:18:23 +08:00
|
|
|
|
|
|
|
|
|
bool autoWave =true;
|
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
DataTable dtBulks;
|
2023-11-21 19:18:23 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String oCom = "";
|
|
|
|
|
Dictionary<String, int> mapComs = new Dictionary<String, int>();
|
2023-05-23 16:13:17 +08:00
|
|
|
|
public GoodsOutServiceForm()
|
|
|
|
|
{
|
|
|
|
|
|
2023-11-21 19:18:23 +08:00
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
lightPart.lightOffEvent += partFinished;
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
initialControls();
|
|
|
|
|
initialBackGroundTasks();
|
|
|
|
|
isLoading = false;
|
2023-11-21 19:18:23 +08:00
|
|
|
|
if (lightPart.activeComports.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
lbLightsInfo.Text = "拣选设备连接错误";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
initComs();
|
|
|
|
|
lbLightsInfo.Text = "拣选设备连接正常";
|
|
|
|
|
}
|
2023-05-23 16:13:17 +08:00
|
|
|
|
startHost();
|
2023-11-21 19:18:23 +08:00
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
}
|
|
|
|
|
#region initialControls
|
|
|
|
|
bool isLoading = true;
|
|
|
|
|
private void initialControls()
|
2024-02-06 19:36:47 +08:00
|
|
|
|
{
|
|
|
|
|
dateEditFrom.EditValue = DateTime.Now;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
initialComboBoxes();
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
// initialPagerControls();
|
|
|
|
|
initialDataGrid();
|
|
|
|
|
initialQueryInput();
|
|
|
|
|
setValidationRule();
|
|
|
|
|
initialTimer();
|
|
|
|
|
// updateLightsStatus();
|
2024-02-06 19:36:47 +08:00
|
|
|
|
// getPartFinishIds();
|
2023-05-23 16:13:17 +08:00
|
|
|
|
|
|
|
|
|
}
|
2024-02-06 19:36:47 +08:00
|
|
|
|
private void initialComboBoxes()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Node[] nds = { };
|
|
|
|
|
|
|
|
|
|
DataRow[] drs = Park.getDictionary(true).Select("flag >0");
|
|
|
|
|
foreach (DataRow dr in drs)
|
|
|
|
|
{
|
|
|
|
|
int flag = Convert.ToInt32(dr["flag"].ToString());
|
|
|
|
|
int parentId = Convert.ToInt32(dr["id"].ToString());
|
|
|
|
|
DataRow[] drss = Park.getDictionary(false).Select("parentId =" + parentId);
|
|
|
|
|
switch (flag)
|
|
|
|
|
{
|
|
|
|
|
case 2005:
|
|
|
|
|
initialComboBoxs(this.comPartQuery, drss);//分区
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 3001:
|
|
|
|
|
initialComboBoxsByValue(this.comLine, drss ,3);//线路
|
|
|
|
|
break;
|
|
|
|
|
case 2001:
|
|
|
|
|
|
|
|
|
|
initialComboBoxs(this.comWarehouseQuery, drss);//库房
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected void initialComboBoxsByValue(ComboBoxEdit combo, DataRow[] drss, int itemCnt, bool isForQuery = true,string title = "请选择")
|
|
|
|
|
{
|
|
|
|
|
combo.Properties.TextEditStyle = TextEditStyles.DisableTextEditor;
|
|
|
|
|
combo.Properties.Items.Clear();
|
|
|
|
|
List<Node> nds = new List<Node>();
|
|
|
|
|
|
|
|
|
|
foreach (DataRow dr in drss)
|
|
|
|
|
{
|
|
|
|
|
nds.Add(new Node(dr));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ComboBoxItemCollection coll = combo.Properties.Items;
|
|
|
|
|
coll.BeginUpdate();
|
|
|
|
|
int i = 0;
|
|
|
|
|
if (isForQuery)
|
|
|
|
|
{
|
|
|
|
|
coll.Add(title);
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (Node nd in nds)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
coll.Add(nd);
|
|
|
|
|
if(i > itemCnt)
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
coll.EndUpdate();
|
|
|
|
|
}
|
|
|
|
|
combo.SelectedIndex = 0;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
private void initialBackGroundTasks()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lightAllLabels();
|
|
|
|
|
|
2023-11-21 19:18:23 +08:00
|
|
|
|
/*
|
2023-05-23 16:13:17 +08:00
|
|
|
|
Thread threadPreProcess = new Thread(searchLight);
|
|
|
|
|
threadPreProcess.IsBackground = true;
|
|
|
|
|
threadPreProcess.Start();
|
2023-11-21 19:18:23 +08:00
|
|
|
|
*/
|
2023-05-23 16:13:17 +08:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void lightAllLabels()
|
|
|
|
|
{
|
|
|
|
|
loadWaveDetails();
|
|
|
|
|
initLights();
|
|
|
|
|
string result = lightPart.lightsUp(pickClient.getPartPickedData((int)enumPickState.未拣), enumLabelPickType.pick);
|
|
|
|
|
closeClient();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
2024-02-06 19:36:47 +08:00
|
|
|
|
|
|
|
|
|
private void initialGridView2Columns(GridView gridview)
|
|
|
|
|
{
|
|
|
|
|
setupGridView(gridview, false, true, false);
|
|
|
|
|
gridview.FocusRectStyle = DrawFocusRectStyle.None;
|
|
|
|
|
// gridviewGoodsType.PopulateColumns();
|
|
|
|
|
gridview.Columns.Clear();
|
|
|
|
|
// gridviewGoodsType.Columns.Remove(gridviewGoodsType.Columns["DealerPrice"]);
|
|
|
|
|
GridColumn myCol0 = new GridColumn() { Caption = "ID", Visible = true, FieldName = "id" };
|
|
|
|
|
myCol0.Visible = false;
|
|
|
|
|
gridview.Columns.Add(myCol0);
|
|
|
|
|
GridColumn myCol1 = new GridColumn() { Caption = "商品名称", Visible = true, FieldName = WmsGoods.exfields.goodsName.ToString() };
|
|
|
|
|
GridColumn myCol2 = new GridColumn() { Caption = "货位", Visible = true, FieldName = WmsOutPickLable.fields.locationId.ToString() };
|
|
|
|
|
GridColumn myCol3 = new GridColumn() { Caption = "状态", Visible = true, FieldName = "state" };
|
|
|
|
|
|
|
|
|
|
GridColumn myCol5 = new GridColumn() { Caption = "拣货件数", Visible = true, FieldName = "pcs" };
|
|
|
|
|
GridColumn myCol6 = new GridColumn() { Caption = "单位", Visible = true, FieldName = WmsGoods.exfields.unit.ToString() };
|
|
|
|
|
|
|
|
|
|
GridColumn myCol8 = new GridColumn() { Caption = "分拣单", Visible = true, FieldName = "pickOrderNo" };
|
|
|
|
|
GridColumn myCol9 = new GridColumn() { Caption = "集货区", Visible = true, FieldName = "tranAreaName" };
|
|
|
|
|
|
|
|
|
|
GridColumn myCol14 = new GridColumn() { Caption = "货位分区", Visible = true, FieldName = "partName2" };
|
|
|
|
|
GridColumn myCol15 = new GridColumn() { Caption = "波次号", Visible = true, FieldName = "waveOrder" };
|
|
|
|
|
GridColumn myCol16 = new GridColumn() { Caption = "任务编号", Visible = true, FieldName = "jobNo" };
|
|
|
|
|
GridColumn myCol21 = new GridColumn() { Caption = "客户", Visible = true, FieldName = "customerName" };
|
|
|
|
|
GridColumn myCol22 = new GridColumn() { Caption = "线路", Visible = true, FieldName = "lineName" };
|
|
|
|
|
GridColumn myCol23 = new GridColumn() { Caption = "sku", Visible = true, FieldName = "skus" };
|
|
|
|
|
|
|
|
|
|
GridColumn myCol24 = new GridColumn() { Caption = "分拣任务", Visible = true, FieldName = "jobNo" };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// gridview.Columns.Add(myCol24);
|
|
|
|
|
// gridview.Columns.Add(myCol1);
|
|
|
|
|
// gridview.Columns.Add(myCol2);
|
|
|
|
|
// gridview.Columns.Add(myCol3);
|
|
|
|
|
//gridview.Columns.Add(myCol3);
|
|
|
|
|
|
|
|
|
|
gridview.Columns.Add(myCol21);
|
|
|
|
|
gridview.Columns.Add(myCol5);
|
|
|
|
|
|
|
|
|
|
//gridview.Columns.Add(myCol6);
|
|
|
|
|
gridview.Columns.Add(myCol23);
|
|
|
|
|
gridview.Columns.Add(myCol24);
|
|
|
|
|
gridview.Columns.Add(myCol8);
|
|
|
|
|
gridview.Columns.Add(myCol9);
|
|
|
|
|
gridview.Columns.Add(myCol14);
|
|
|
|
|
|
|
|
|
|
gridview.Columns.Add(myCol22);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//to show bottom scroll bar
|
|
|
|
|
gridview.OptionsView.ColumnAutoWidth = false;
|
|
|
|
|
gridview.BestFitColumns();
|
|
|
|
|
// gridView2.Focus();
|
|
|
|
|
}
|
2023-05-23 16:13:17 +08:00
|
|
|
|
|
|
|
|
|
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 myCol011 = new GridColumn() { Caption = "分区", Visible = true, FieldName = "partName" };
|
|
|
|
|
gridview.Columns.Add(myCol011);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GridColumn myCol1 = new GridColumn() { Caption = "商品编码", Visible = true, FieldName = WmsGoods.fields.goodsId.ToString() };
|
|
|
|
|
GridColumn myCol2 = new GridColumn() { Caption = "商品名称", Visible = true, FieldName = WmsGoods.exfields.goodsName.ToString() };
|
|
|
|
|
GridColumn myCol3 = new GridColumn() { Caption = "厂家", Visible = true, FieldName = WmsGoods.exfields.manufacturer.ToString() };
|
|
|
|
|
GridColumn myCol4 = new GridColumn() { Caption = "规格", Visible = true, FieldName = WmsGoods.exfields.spec.ToString() };
|
2023-11-21 19:18:23 +08:00
|
|
|
|
GridColumn myCol5 = new GridColumn() { Caption = "单位", Visible = true, FieldName = "minOperateUnit" };
|
2023-05-23 16:13:17 +08:00
|
|
|
|
// GridColumn myCol6 = new GridColumn() { Caption = "大包装数量", Visible = true, FieldName = WmsGoods.exfields.bigCount.ToString() };
|
|
|
|
|
GridColumn myCol7 = new GridColumn() { Caption = "剂型", Visible = true, FieldName = WmsGoods.exfields.type.ToString() };
|
|
|
|
|
GridColumn myCol8 = new GridColumn() { Caption = "商品类型", Visible = true, FieldName = WmsGoods.exfields.goodsTypeName.ToString() };
|
|
|
|
|
// GridColumn myCol9 = new GridColumn() { Caption = "大零", Visible = true, FieldName = WmsGoods.fields.bulkMax.ToString() };
|
|
|
|
|
// GridColumn myCol10 = new GridColumn() { Caption = "小整", Visible = true, FieldName = WmsGoods.fields.batchMax1.ToString() };
|
|
|
|
|
// GridColumn myCol11 = new GridColumn() { Caption = "大整", Visible = true, FieldName = WmsGoods.fields.batchMax2.ToString() };
|
|
|
|
|
GridColumn myCol12 = new GridColumn() { Caption = "国药准字", Visible = true, FieldName = WmsGoods.exfields.regeditCode.ToString() };
|
|
|
|
|
|
|
|
|
|
GridColumn myCol100 = new GridColumn() { Caption = "数量", Visible = true, FieldName = WmsOutDetail.fields.count.ToString() };
|
2023-11-21 19:18:23 +08:00
|
|
|
|
GridColumn myCol101 = new GridColumn() { Caption = "件数", Visible = true, FieldName = WmsOutDetail.fields.count.ToString() };
|
2023-05-23 16:13:17 +08:00
|
|
|
|
// GridColumn myCol102 = new GridColumn() { Caption = "整货", Visible = true, FieldName = WmsOutDetail.fields.batch1Count.ToString() };
|
|
|
|
|
// GridColumn myCol103 = new GridColumn() { Caption = "大整", Visible = true, FieldName = WmsOutDetail.fields.batch2Count.ToString() };
|
|
|
|
|
// GridColumn myCol104 = new GridColumn() { Caption = "箱", Visible = true, FieldName = WmsOutDetail.fields.boxcnt.ToString() };
|
|
|
|
|
GridColumn myCol14 = new GridColumn() { Caption = "批号", Visible = true, FieldName = WmsOutDetail.fields.batch.ToString() };
|
|
|
|
|
GridColumn myCol15 = new GridColumn() { Caption = "生产日期", Visible = true, FieldName = WmsOutDetail.fields.productDate.ToString() };
|
|
|
|
|
GridColumn myCol16 = new GridColumn() { Caption = "有效期", Visible = true, FieldName = WmsOutDetail.fields.validDate.ToString() };
|
|
|
|
|
|
|
|
|
|
GridColumn myCol17 = new GridColumn() { Caption = "状态", Visible = true, FieldName = WmsOutDetail.fields.state.ToString() };
|
|
|
|
|
GridColumn myCol18 = new GridColumn() { Caption = "说明", Visible = true, FieldName = WmsOutDetail.fields.description.ToString() };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GridColumn myCol20 = new GridColumn() { Caption = "波次", Visible = true, FieldName = WmsOutPickLable.fields.dpsOrder.ToString() };
|
|
|
|
|
GridColumn myCol21 = new GridColumn() { Caption = "颜色", Visible = true, FieldName = "colorName" };
|
|
|
|
|
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 = "desk" };
|
2023-11-21 19:18:23 +08:00
|
|
|
|
//GridColumn myCol32 = new GridColumn() { Caption = "库区", Visible = true, FieldName = "partName" };
|
2023-05-23 16:13:17 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
myCol29.ColumnEdit = ri; //绑定到GridColumn
|
|
|
|
|
|
|
|
|
|
myCol30.ColumnEdit = ri;
|
|
|
|
|
|
|
|
|
|
|
2023-11-21 19:18:23 +08:00
|
|
|
|
gridview.Columns.Add(myCol24);
|
|
|
|
|
gridview.Columns.Add(myCol22);
|
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
if (WmsConstants.OUT_LIGHT_ENABLE)
|
|
|
|
|
{
|
|
|
|
|
gridview.Columns.Add(myCol29);
|
|
|
|
|
gridview.Columns.Add(myCol30);
|
|
|
|
|
}
|
2023-11-21 19:18:23 +08:00
|
|
|
|
gridview.Columns.Add(myCol2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
gridview.Columns.Add(myCol23);
|
|
|
|
|
|
|
|
|
|
gridview.Columns.Add(myCol101);
|
|
|
|
|
gridview.Columns.Add(myCol5);
|
|
|
|
|
// gridview.Columns.Add(myCol17);
|
2023-11-21 19:18:23 +08:00
|
|
|
|
gridview.Columns.Add(myCol15);
|
|
|
|
|
|
|
|
|
|
gridview.Columns.Add(myCol4);
|
2023-05-23 16:13:17 +08:00
|
|
|
|
|
2023-11-21 19:18:23 +08:00
|
|
|
|
gridview.Columns.Add(myCol14);
|
2023-05-23 16:13:17 +08:00
|
|
|
|
gridview.Columns.Add(myCol3);
|
|
|
|
|
gridview.Columns.Add(myCol16);
|
2023-11-21 19:18:23 +08:00
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
gridview.Columns.Add(myCol8);
|
|
|
|
|
//gridview.Columns.Add(myCol9);
|
2023-11-21 19:18:23 +08:00
|
|
|
|
gridview.Columns.Add(myCol31);
|
|
|
|
|
gridview.Columns.Add(myCol20);
|
2023-05-23 16:13:17 +08:00
|
|
|
|
// gridview.Columns.Add(myCol6);
|
|
|
|
|
|
2023-11-21 19:18:23 +08:00
|
|
|
|
|
|
|
|
|
gridview.Columns.Add(myCol21);
|
|
|
|
|
// gridview.Columns.Add(myCol12);
|
2023-05-23 16:13:17 +08:00
|
|
|
|
gridview.Columns.Add(myCol1);
|
|
|
|
|
|
|
|
|
|
gridview.Columns.Add(myCol18);
|
|
|
|
|
//to show bottom scroll bar
|
|
|
|
|
gridview.OptionsView.ColumnAutoWidth = false;
|
2023-11-21 19:18:23 +08:00
|
|
|
|
|
|
|
|
|
gridview.Columns.Add(myCol3);
|
2023-05-23 16:13:17 +08:00
|
|
|
|
// gridView2.Focus();
|
2023-11-21 19:18:23 +08:00
|
|
|
|
gridview.BestFitColumns();
|
2023-05-23 16:13:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DateTime lastRefreshTime;
|
|
|
|
|
int refreshInterval = 15;
|
|
|
|
|
//完成任务时需要调用
|
|
|
|
|
delegate void loadNewPickOrders();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <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();
|
|
|
|
|
TimeSpan ts = DateTime.Now - lastWaveRequestTime;
|
|
|
|
|
if (ts.TotalDays >10)
|
|
|
|
|
{
|
|
|
|
|
lastWaveRequestTime = DateTime.Now;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
int sleepTime = 5;// (int)spinWave.Value;//波次间隔 5s
|
|
|
|
|
if (ts.TotalSeconds < sleepTime)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!canNewWave) // if (!lgt.canNewWave)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (autoWave)
|
|
|
|
|
{
|
|
|
|
|
// 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
|
|
|
|
|
{
|
|
|
|
|
// dtBulks = lgt.getWmsOutPickRequest.getBulkDetailInCurrentWave().Tables[0];
|
|
|
|
|
dtBulks = pickClient.getPartionBulkDetailInCurrentWave();
|
|
|
|
|
closeClient();
|
|
|
|
|
gridControl2.DataSource = null;
|
|
|
|
|
updateLableStatus(dtBulks);
|
|
|
|
|
debug(string.Format("load bulk details in current wave,count {0} ", dtBulks.Rows.Count));
|
|
|
|
|
gridControl3.DataSource = dtBulks.DefaultView;
|
|
|
|
|
initialGridView3Columns(gridView3);
|
|
|
|
|
// btnRelight.Enabled = dtBulks.Rows.Count > 0;
|
|
|
|
|
WmsConstants.WAVE_CURRENT_ORDER = "";
|
|
|
|
|
// btnNewWave.Enabled = dtBulks.Rows.Count == 0;
|
|
|
|
|
if (dtBulks.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
WmsConstants.WAVE_LAST_FREE_TIME = DateTime.MinValue;
|
|
|
|
|
//if (string.IsNullOrEmpty(WmsConstants.WAVE_CURRENT_ORDER))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
string waveStarTime = dtBulks.Rows[0]["createtime"].ToString();
|
|
|
|
|
DateTime lastWaveTime = Convert.ToDateTime(waveStarTime);
|
|
|
|
|
string currentWaveOrder = dtBulks.Rows[0]["dpsOrder"].ToString();
|
|
|
|
|
WmsConstants.WAVE_LAST_TIME = lastWaveTime;
|
|
|
|
|
WmsConstants.WAVE_CURRENT_ORDER = currentWaveOrder; //只显示有零货的波次
|
|
|
|
|
}
|
|
|
|
|
debug("start getPickDetailByWaveOrder.....");
|
|
|
|
|
//DataTable dtBatch = lgt.getWmsOutPickRequest.getPickDetailByWaveOrder(WmsConstants.WAVE_CURRENT_ORDER).Tables[0];
|
|
|
|
|
/*
|
|
|
|
|
DataTable dtBatch = pickClient.getPickDetailByWaveOrder(WmsConstants.WAVE_CURRENT_ORDER);
|
|
|
|
|
closeClient();
|
|
|
|
|
debug("end getPickDetailByWaveOrder.....1");
|
|
|
|
|
DataView dv = dtBatch.DefaultView;
|
|
|
|
|
dv.RowFilter = "volType >0";
|
|
|
|
|
|
|
|
|
|
gridControl2.DataSource = dv;
|
|
|
|
|
debug("end getPickDetailByWaveOrder.....2");
|
|
|
|
|
* */
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (WmsConstants.WAVE_LAST_FREE_TIME == DateTime.MinValue)
|
|
|
|
|
{
|
|
|
|
|
WmsConstants.WAVE_LAST_FREE_TIME = DateTime.Now;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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 = 1000;
|
|
|
|
|
timer.Interval = intTime;//设置间隔时间,为毫秒;
|
|
|
|
|
timer.Elapsed += new System.Timers.ElapsedEventHandler(showWaveSpan);//到达时间的时候执行事件;
|
|
|
|
|
timer.AutoReset = true;//设置是执行一次(false)还是一直执行(true);
|
|
|
|
|
timer.Enabled = true;//是否执行System.Timers.Timer.Elapsed事件;
|
|
|
|
|
// timer.Start();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void showWaveSpan(object source, System.Timers.ElapsedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
// debug(string.Format(" timer loop begin .... " ));
|
|
|
|
|
TimeSpan ts = DateTime.Now - WmsConstants.WAVE_LAST_TIME;// WmsConstants.WAVE_LAST_TIME;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (InvokeRequired)
|
|
|
|
|
{
|
|
|
|
|
this.Invoke(new loadNewCurrentWave(delegate()
|
|
|
|
|
{
|
|
|
|
|
// lbLightsInfo.Text = (lights.Count > 0 ? "" : "未检测到通道灯");
|
|
|
|
|
//refreshOrderList();
|
|
|
|
|
|
|
|
|
|
updateLableStatus();
|
|
|
|
|
// waveStart();
|
|
|
|
|
/*
|
|
|
|
|
if (string.IsNullOrEmpty(WmsConstants.WAVE_CURRENT_ORDER)) //start new wave
|
|
|
|
|
{
|
|
|
|
|
lbWaveSpan.ForeColor = Color.Green;
|
|
|
|
|
|
|
|
|
|
TimeSpan ts1 = DateTime.Now - WmsConstants.WAVE_LAST_FREE_TIME;
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//lbLightsInfo.Text = (lights.Count > 0 ? "" : "未检测到通道灯");
|
|
|
|
|
updateLableStatus();
|
|
|
|
|
// waveStart();
|
|
|
|
|
/*
|
|
|
|
|
if (string.IsNullOrEmpty(WmsConstants.WAVE_CURRENT_ORDER)) //start new wave
|
|
|
|
|
{
|
|
|
|
|
lbWaveSpan.ForeColor = Color.Green;
|
|
|
|
|
TimeSpan ts1 = DateTime.Now - WmsConstants.WAVE_LAST_FREE_TIME;
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
* */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception er)
|
|
|
|
|
{
|
|
|
|
|
LogHelper.WriteLog(typeof(GoodsOutForm), er);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// debug(string.Format(" timer loop end .... "));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void btnDelete_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void initialDataGrid()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.gridView2.IndicatorWidth = 40;
|
|
|
|
|
this.gridView2.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler(gridView_CustomDrawRowIndicator);
|
|
|
|
|
|
|
|
|
|
this.gridView3.IndicatorWidth = 40;
|
|
|
|
|
this.gridView3.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler(gridView_CustomDrawRowIndicator);
|
2024-02-06 19:36:47 +08:00
|
|
|
|
|
|
|
|
|
this.gridView1.IndicatorWidth = 40;
|
|
|
|
|
this.gridView1.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler(gridView_CustomDrawRowIndicator);
|
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
//this.gridView3.IndicatorWidth = 40;
|
|
|
|
|
//this.gridView3.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler(gridView_CustomDrawRowIndicator);
|
|
|
|
|
|
2024-02-06 19:36:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-06 19:36:47 +08:00
|
|
|
|
private void gridView2_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
|
2023-05-23 16:13:17 +08:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (sender == gridView2)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (e.Column.FieldName == "state")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
switch (e.DisplayText)
|
|
|
|
|
{
|
|
|
|
|
case "1" :
|
|
|
|
|
e.DisplayText = "已出货";
|
|
|
|
|
break;
|
|
|
|
|
case "0":
|
|
|
|
|
e.DisplayText = "待出货";
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case "2":
|
|
|
|
|
e.DisplayText = "出现错误";
|
|
|
|
|
break;
|
|
|
|
|
case "":
|
|
|
|
|
e.DisplayText = "待出货";
|
|
|
|
|
break;
|
|
|
|
|
//default:
|
|
|
|
|
// e.DisplayText = "未分配货位";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
/*
|
|
|
|
|
if (sender == this.gridView2)
|
|
|
|
|
{
|
|
|
|
|
if (this.gridView2.GetDataRow(e.RowHandle)["state"].ToString().Trim() == "2")
|
|
|
|
|
{
|
|
|
|
|
DevExpress.Utils.AppearanceHelper.Apply(e.Appearance, alert);
|
|
|
|
|
}
|
|
|
|
|
}else if(sender == this.gridView1){
|
|
|
|
|
|
|
|
|
|
if ( state == "2")
|
|
|
|
|
{
|
|
|
|
|
if (currentView != null && e.RowHandle == currentView.FocusedRowHandle)
|
|
|
|
|
{
|
|
|
|
|
DevExpress.Utils.AppearanceHelper.Apply(e.Appearance, alertFocus);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
DevExpress.Utils.AppearanceHelper.Apply(e.Appearance, alert);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (state == "1")
|
|
|
|
|
{
|
|
|
|
|
DevExpress.Utils.AppearanceHelper.Apply(e.Appearance, passed);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
private void setCurrentRequestDetail()
|
|
|
|
|
{
|
|
|
|
|
if (!getCurrentObject() || selectedRequest == null )
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
showWaitForm();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
showErrorMsg(e.Message);
|
|
|
|
|
}
|
|
|
|
|
closeWaitForm();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
private void btnNewWave_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
clearWaveData();
|
|
|
|
|
btnNewWave.Enabled = false;
|
|
|
|
|
newWave();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void turnOffLights()
|
|
|
|
|
{
|
|
|
|
|
if (lights.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
//searchLight();
|
|
|
|
|
// return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Model.dis_id_comment id;
|
|
|
|
|
Model.dis_id id;
|
2023-09-04 22:41:19 +08:00
|
|
|
|
//id.ele_id = Convert.ToInt32(new_id.Text);
|
2023-05-23 16:13:17 +08:00
|
|
|
|
id.order = 1;
|
|
|
|
|
id.ele_id = 65535;
|
|
|
|
|
id.state = 1;
|
|
|
|
|
//id.
|
|
|
|
|
|
|
|
|
|
foreach (int port in light.activeComports)
|
|
|
|
|
{
|
|
|
|
|
if (port == 0)
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2023-11-21 19:18:23 +08:00
|
|
|
|
// unart_manage.com_manage[port].write_reset_device(); 复位各个硬件,通道灯,标签。。。
|
2023-05-23 16:13:17 +08:00
|
|
|
|
|
2023-11-21 19:18:23 +08:00
|
|
|
|
Deiniu.win.elelab.coms.com_manage[port].init_port.write_clear_comment(id);
|
2023-05-23 16:13:17 +08:00
|
|
|
|
|
|
|
|
|
if (!lights.ContainsKey(port))
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (int lt in lights[port])
|
|
|
|
|
{
|
|
|
|
|
Model.close_channel_led idx;
|
|
|
|
|
idx.channel_id = lt;
|
|
|
|
|
idx.state = 1;
|
2023-11-21 19:18:23 +08:00
|
|
|
|
Deiniu.win.elelab.coms.com_manage[port].init_port.write_close_channel_led(idx);
|
2023-05-23 16:13:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 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 light.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;
|
2023-11-21 19:18:23 +08:00
|
|
|
|
bool ret = Deiniu.win.elelab.coms.com_manage[port].init_port.search_light_id(id);
|
2023-05-23 16:13:17 +08:00
|
|
|
|
if (ret)
|
|
|
|
|
{
|
|
|
|
|
if (!lights.ContainsKey(port))
|
|
|
|
|
{
|
|
|
|
|
lights[port] = new List<int>();
|
|
|
|
|
}
|
|
|
|
|
lights[port].Add(i);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void endWave(bool isForce=false)
|
|
|
|
|
{
|
|
|
|
|
showWaitForm();
|
|
|
|
|
if (isForce)
|
|
|
|
|
{
|
|
|
|
|
// pick.init_port(enumLabelPickType.pick);
|
|
|
|
|
turnOffLights();
|
|
|
|
|
}
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
pickClient.finishCurrentWave(WmsConstants.WAVE_CURRENT_ORDER,isForce);
|
|
|
|
|
closeClient();
|
|
|
|
|
}
|
|
|
|
|
catch(Exception e)
|
|
|
|
|
{
|
|
|
|
|
closeWaitForm();
|
|
|
|
|
showErrorMsg(e.Message);
|
|
|
|
|
}
|
|
|
|
|
clearWaveData();
|
|
|
|
|
// waveStart();
|
|
|
|
|
// btnEndWave.Enabled = false;
|
|
|
|
|
// btnRelight.Enabled = false;
|
|
|
|
|
_canNewWave = true;
|
|
|
|
|
closeWaitForm();
|
|
|
|
|
}
|
|
|
|
|
private void clearWaveData()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
WmsConstants.WAVE_CURRENT_ORDER = "";
|
|
|
|
|
// lbWaveNo.Text = "空闲";
|
|
|
|
|
// WmsConstants.WAVE_LAST_FREE_TIME = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
// timer.Stop();
|
|
|
|
|
//lbWaveSpan.Text = "00:00:00";
|
|
|
|
|
//lbWaveSpan.Text = string.Format(" ");
|
|
|
|
|
// loadPickOrdersInWave();
|
|
|
|
|
//gridControl3.DataSource =null;
|
|
|
|
|
if (dtBulks != null)
|
|
|
|
|
{
|
|
|
|
|
// dtBulks.Clear();
|
|
|
|
|
}
|
|
|
|
|
// gridControl3.DataSource = null;
|
|
|
|
|
gridControl2.DataSource = null;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void btnRefresh_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
showWaitForm();
|
|
|
|
|
// elelab.pick.init_port(enumLabelPickType.pick);
|
|
|
|
|
loadPickOrdersInWave();
|
|
|
|
|
closeWaitForm();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnRelight_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
// turnOffLights();
|
|
|
|
|
//lightLabelsCurrentWave();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void lightLabelsCurrentWave(int[] parts)
|
|
|
|
|
{
|
|
|
|
|
if (!WmsConstants.OUT_LIGHT_ENABLE)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
debug("start relightCurrentWave.....");
|
|
|
|
|
//Thread light = new Thread(lgt.lightLables);
|
|
|
|
|
//light.IsBackground = true;
|
|
|
|
|
//light.Start();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
closeWaitForm();
|
|
|
|
|
|
|
|
|
|
if (parts.Length == 0)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//showWaitForm("正在点亮标签...");
|
|
|
|
|
if (InvokeRequired)
|
|
|
|
|
{
|
|
|
|
|
this.Invoke(new loadNewCurrentWave(delegate()
|
|
|
|
|
{ loadWaveDetails();
|
|
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
loadWaveDetails();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
lightLables(parts); // lgt.lightLables();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch(Exception er)
|
|
|
|
|
{
|
|
|
|
|
closeWaitForm();
|
|
|
|
|
showErrorMsg(er,er.Message);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
closeWaitForm();
|
|
|
|
|
}
|
|
|
|
|
debug("end relightCurrentWave.....");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//private void checkAuto_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
//{
|
|
|
|
|
// spinOrder.Enabled = checkAuto.Checked;
|
|
|
|
|
//}
|
|
|
|
|
|
2024-02-06 19:36:47 +08:00
|
|
|
|
|
|
|
|
|
string currentCustName = "";
|
2023-05-23 16:13:17 +08:00
|
|
|
|
|
|
|
|
|
private void updateLableStatus(DataTable dt = null)
|
|
|
|
|
{
|
|
|
|
|
if (!WmsConstants.OUT_LIGHT_ENABLE)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
string key = "";
|
|
|
|
|
|
|
|
|
|
if (dt != null)
|
|
|
|
|
{
|
|
|
|
|
foreach (DataRow dr in dt.Rows)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (dr["state"].ToString().Equals("1"))
|
|
|
|
|
{
|
2023-09-04 22:41:19 +08:00
|
|
|
|
key = Util.getLightKey(Convert.ToInt32(dr["color"].ToString()), Convert.ToInt32(dr["elabId"].ToString()), Convert.ToInt32(dr["elabAddress"].ToString()));
|
2023-05-23 16:13:17 +08:00
|
|
|
|
|
|
|
|
|
WmsConstants.WAVE_CURRENT_PICK_STATUS[key] = true;
|
|
|
|
|
|
2024-02-06 19:36:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
|
|
2023-11-21 19:18:23 +08:00
|
|
|
|
// endWave();
|
|
|
|
|
// return;
|
2023-05-23 16:13:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (DataRow dr in dtBulks.Rows)
|
|
|
|
|
{
|
|
|
|
|
label = new WmsOutPickLable(dr);
|
|
|
|
|
key = Util.getLightKey(label.color, label.elabId, label.elabAddress);
|
|
|
|
|
if( WmsConstants.WAVE_CURRENT_LIGHTS_STATUS.ContainsKey(key)){
|
|
|
|
|
dr["isLightUp"] = WmsConstants.WAVE_CURRENT_LIGHTS_STATUS[key] ? 1 : 0;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (WmsConstants.WAVE_CURRENT_PICK_STATUS.ContainsKey(key))
|
|
|
|
|
{
|
|
|
|
|
dr["isPicked"] = WmsConstants.WAVE_CURRENT_PICK_STATUS[key] ? 1 : 0;
|
|
|
|
|
|
2024-02-06 19:36:47 +08:00
|
|
|
|
}
|
|
|
|
|
currentCustName = dr["customerName"].ToString();
|
2023-05-23 16:13:17 +08:00
|
|
|
|
}
|
|
|
|
|
dv.RowFilter = ""; // 如果 dv.RowFilter ="isPicked =0"; 则已拣的不再显示
|
|
|
|
|
gridControl3.DataSource = dtBulks.DefaultView;
|
2024-02-06 19:36:47 +08:00
|
|
|
|
lbCustName.Text = currentCustName;
|
2023-05-23 16:13:17 +08:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void GoodsOutForm_FormClosing(object sender, FormClosingEventArgs e)
|
|
|
|
|
{
|
2024-05-27 10:40:55 +08:00
|
|
|
|
// outClient.Close();
|
|
|
|
|
// closeClient();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
host.Close();
|
|
|
|
|
autoWave = false;
|
|
|
|
|
timer.Enabled = false;
|
|
|
|
|
turnOffLights();// elelab.pick.init_port(enumLabelPickType.pick);
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//-------------below moved from logic layer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WmsOutPickRequest outRequest = new WmsOutPickRequest();
|
|
|
|
|
WmsStockRecord stkRecord = new WmsStockRecord();
|
|
|
|
|
WmsOutPickLable pickLabelDetail = new WmsOutPickLable();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 点亮待拣选标签
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void lightLablesInSvc()
|
|
|
|
|
{
|
|
|
|
|
pickClient.lightLables();
|
|
|
|
|
closeClient();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 点亮待拣选标签
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void lightLables(int[] parts)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// lightLablesInSvc();
|
|
|
|
|
|
|
|
|
|
//lightLabelsInWinformSvc();
|
|
|
|
|
|
|
|
|
|
if (!WmsConstants.OUT_LIGHT_ENABLE)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (parts.Length == 0)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
initLights();
|
|
|
|
|
|
|
|
|
|
// turnOffLights();
|
|
|
|
|
|
|
|
|
|
lastWave = DateTime.Now;
|
|
|
|
|
WmsConstants.WAVE_CURRENT_LIGHTS_STATUS.Clear();
|
|
|
|
|
|
|
|
|
|
bool exist = pickClient.getCurrentPickList((int)enumPickState.未拣).Rows.Count > 0;
|
|
|
|
|
closeClient();
|
|
|
|
|
if (!exist)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
showWaitForm("正在点亮标签...");
|
|
|
|
|
string result = lightPart.lightsUp(pickClient.getPartsPickList( parts,(int)enumPickState.未拣), enumLabelPickType.pick);
|
|
|
|
|
closeClient();
|
|
|
|
|
|
|
|
|
|
//#if DEBUG
|
|
|
|
|
closeWaitForm();
|
|
|
|
|
/*
|
|
|
|
|
if (!string.IsNullOrEmpty(result))
|
|
|
|
|
{
|
|
|
|
|
// lbLightsInfo.Text = result;
|
|
|
|
|
if (WmsConstants.OUT_SPEAK_WAVE)
|
|
|
|
|
{
|
|
|
|
|
speak(errorMsg);
|
|
|
|
|
}
|
|
|
|
|
// showErrorMsg(result);
|
|
|
|
|
}
|
|
|
|
|
else if ( light.activeComports.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
if ( WmsConstants.OUT_SPEAK_WAVE)
|
|
|
|
|
{
|
|
|
|
|
speak(errorMsg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//#endif
|
|
|
|
|
//speak(WmsConstants.WAVE_CURRENT_ORDER);
|
|
|
|
|
if (WmsConstants.WAVE_CURRENT_ORDER.Length > 0)
|
|
|
|
|
{
|
|
|
|
|
if (WmsConstants.OUT_SPEAK_WAVE)
|
|
|
|
|
{
|
|
|
|
|
speak(WmsConstants.WAVE_CURRENT_ORDER + " 开始捡货啦");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
LogHelper.debug(typeof(GoodsOutForm), "开始拣货 :" + WmsConstants.WAVE_CURRENT_ORDER);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
// speak("Go! Go! Go!");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
void initLights()
|
|
|
|
|
{
|
|
|
|
|
string errorMsg = "灯光设备连接错误";
|
|
|
|
|
if (InvokeRequired)
|
|
|
|
|
{
|
|
|
|
|
this.Invoke(new loadNewCurrentWave(delegate()
|
|
|
|
|
{
|
|
|
|
|
lbLightsInfo.Text = "连接正常";
|
|
|
|
|
lightPart.initPort(enumLabelPickType.pick);
|
|
|
|
|
if (lightPart.activeComports.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
lbLightsInfo.Text = errorMsg;
|
|
|
|
|
// showErrorMsg("拣选设备连接错误,请检查设备连接");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
lbLightsInfo.Text = "连接正常";
|
|
|
|
|
lightPart.initPort(enumLabelPickType.pick);
|
|
|
|
|
if (lightPart.activeComports.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
lbLightsInfo.Text = errorMsg;
|
|
|
|
|
// showErrorMsg("拣选设备连接错误,请检查设备连接");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
if (ts.TotalMilliseconds > WmsConstants.MAX_SECONDS_BETWEEN_WAVES) //强制开始新波次,有可能会有再次发送亮灯数据时
|
|
|
|
|
{
|
|
|
|
|
_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 (!canNewWave)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
int[] lstPartion ;
|
|
|
|
|
_canNewWave = false;
|
|
|
|
|
// bool exist = false;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
showWaitForm("正在配置新波次");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lstPartion= pickClient.newPartPickWave();
|
|
|
|
|
closeClient();
|
|
|
|
|
// WmsConstants.WAVE_CURRENT_PICK_STATUS.Clear();
|
|
|
|
|
lightLabelsCurrentWave(lstPartion);
|
|
|
|
|
LogHelper.debug(typeof(GoodsOutForm), "开始新波次 :" + WmsConstants.WAVE_CURRENT_ORDER);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception er)
|
|
|
|
|
{
|
|
|
|
|
LogHelper.WriteLog(this.GetType(), er);
|
|
|
|
|
#if debug
|
|
|
|
|
showErrorMsg(er.Message);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
lastWaveRequestTime = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
//_canNewWave = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void label1_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void gridView1_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(e.DisplayText))
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (e.Column.FieldName == WmsOutPickRequest.fields.priority.ToString())
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (!pickDetailStatus.ContainsValue(e.DisplayText))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
int display = -100;
|
|
|
|
|
string disTxt = e.DisplayText;
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
2023-09-04 22:41:19 +08:00
|
|
|
|
display = Convert.ToInt32(e.DisplayText);
|
2023-05-23 16:13:17 +08:00
|
|
|
|
|
|
|
|
|
e.DisplayText = this.pickPriority[display];
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// e.DisplayText = pickDetailStatus.ContainsKey(display) ? pickDetailStatus[display] : display+"";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void partFinished(int eleId)
|
|
|
|
|
{
|
|
|
|
|
int partion = eleId;// -WmsConstants.PART_FINISH_LABLE_ID_PLUS;
|
|
|
|
|
// see if all lights data picked
|
|
|
|
|
int[] parts = {partion};
|
|
|
|
|
DataTable dt = pickClient.getPartsPickList(parts,(int)enumPickState.未拣);
|
|
|
|
|
if (dt.Rows.Count > 0) //未完成,则重新点亮本区域任务
|
|
|
|
|
{
|
|
|
|
|
Thread.Sleep(2000);
|
|
|
|
|
// WmsConstants.partStatus[eleId] = true;
|
|
|
|
|
lightLables(parts);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
pickClient.finishPartWave(partion, false);
|
|
|
|
|
closeClient();
|
|
|
|
|
newWave();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void getPartFinishIds()
|
|
|
|
|
{
|
|
|
|
|
WmsConstants.PART_FINISH_LABLE_IDS = pickClient.getPartsFinishIds();
|
|
|
|
|
closeClient();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//---------------------service
|
|
|
|
|
|
|
|
|
|
private ServiceHost host = null;
|
|
|
|
|
public static List<ELabel> labelPool = new List<ELabel>();
|
|
|
|
|
string svrUrl = WmsConstants.LIGHT_SVR_ADDRESS;
|
|
|
|
|
string wmsUrl = "";
|
|
|
|
|
string postUrl = "";
|
|
|
|
|
|
|
|
|
|
delegate void showStatus();
|
|
|
|
|
void startHost()
|
|
|
|
|
{
|
|
|
|
|
// lbStatus.Text = "服务启动失败";
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
// svrUrl = System.Configuration.ConfigurationManager.AppSettings["BaseUri"];
|
2023-11-21 19:18:23 +08:00
|
|
|
|
// wmsUrl = System.Configuration.ConfigurationManager.AppSettings["WMSuri"];
|
|
|
|
|
svrUrl = "http://127.0.0.1:9998/DNLight";
|
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
Uri baseAddress = new Uri(svrUrl);
|
|
|
|
|
LightService service = new LightService();
|
|
|
|
|
service.lightOd += this.lightByOrder;
|
2023-11-21 19:18:23 +08:00
|
|
|
|
service.lightJd += this.lightByJob;
|
|
|
|
|
service.prtOutTaskCode += this.printOutTaskCode;
|
|
|
|
|
// service.lightUp += this.lightUp;
|
2023-05-23 16:13:17 +08:00
|
|
|
|
|
|
|
|
|
host = new ServiceHost(service, baseAddress);
|
|
|
|
|
// elelab.DNLights.lightOffEvent += testPicked;
|
|
|
|
|
|
|
|
|
|
WebHttpBinding binding = new WebHttpBinding();
|
|
|
|
|
ServiceEndpoint endpoint = host.AddServiceEndpoint(typeof(ILightService), binding, baseAddress);
|
|
|
|
|
WebHttpBehavior httpBehavior = new WebHttpBehavior();
|
|
|
|
|
endpoint.Behaviors.Add(httpBehavior);
|
2023-11-21 19:18:23 +08:00
|
|
|
|
List<string> lstIp = Util.GetLocalIpAddress("InterNetwork");
|
|
|
|
|
string showSvr = "127.0.0.1:9998";
|
|
|
|
|
if (lstIp.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
showSvr = showSvr.Replace("127.0.0.1", lstIp[0]);
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
host.Opened += delegate
|
2023-11-21 19:18:23 +08:00
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
{
|
2023-11-21 19:18:23 +08:00
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
if (InvokeRequired)
|
|
|
|
|
{
|
2023-11-21 19:18:23 +08:00
|
|
|
|
this.Invoke(new showStatus(delegate ()
|
2023-05-23 16:13:17 +08:00
|
|
|
|
{
|
|
|
|
|
lbStatus.Text = "服务已启动";
|
2023-11-21 19:18:23 +08:00
|
|
|
|
lbUrl.Text = lstIp[0];
|
|
|
|
|
// lbIp.Text =Util.getCode128( showSvr);
|
|
|
|
|
picBarcode.Image = Util.getQrCode(showSvr);
|
|
|
|
|
lbUrl.Text = showSvr;
|
2023-05-23 16:13:17 +08:00
|
|
|
|
}));
|
2023-11-21 19:18:23 +08:00
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
lbStatus.Text = "服务已启动";
|
2023-11-21 19:18:23 +08:00
|
|
|
|
lbUrl.Text = lstIp[0];
|
|
|
|
|
// lbIp.Text = Util.getCode128(showSvr);
|
|
|
|
|
lbUrl.Text = showSvr;
|
|
|
|
|
picBarcode.Image = Util.getQrCode(showSvr);
|
|
|
|
|
// lbStatus.Text = "服务启动失败";
|
|
|
|
|
// lbUrl.Text ="";
|
2023-05-23 16:13:17 +08:00
|
|
|
|
}
|
|
|
|
|
};
|
2023-11-21 19:18:23 +08:00
|
|
|
|
|
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
host.Open();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
// addLog("启动服务失败: " + e.Message);
|
|
|
|
|
MessageBox.Show("启动服务失败: " + e.Message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-06 19:36:47 +08:00
|
|
|
|
private string lightByJob(int userId, string jobNo, bool isValid)
|
2023-11-21 19:18:23 +08:00
|
|
|
|
{
|
|
|
|
|
this.Invoke(new showStatus(delegate ()
|
|
|
|
|
{
|
|
|
|
|
// clearInput();
|
2024-02-06 19:36:47 +08:00
|
|
|
|
addLog(string.Format("用户ID {2}, 亮灯请求:{0} , 是否反查:{1} ", jobNo, isValid, userId));
|
|
|
|
|
lbCustName.Text = "";
|
2023-11-21 19:18:23 +08:00
|
|
|
|
}));
|
|
|
|
|
try
|
2024-02-06 19:36:47 +08:00
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrEmpty(jobNo) && jobNo.IndexOf(".")>0 && jobNo.Split('.').Length>2) // scan locationId, to check stock
|
|
|
|
|
{
|
|
|
|
|
return checkStock(jobNo);
|
|
|
|
|
}
|
|
|
|
|
lightPart.currentJobNo = "";
|
|
|
|
|
lightPart.userId = userId;
|
|
|
|
|
DataTable dt = pickClient.lightByJob(userId,jobNo, isValid);
|
|
|
|
|
|
|
|
|
|
pickClient.Close();
|
2023-11-21 19:18:23 +08:00
|
|
|
|
|
|
|
|
|
dtBulks = pickClient.getPartionBulkDetailInCurrentWave();
|
|
|
|
|
closeClient();
|
|
|
|
|
updateLableStatus(dtBulks);
|
|
|
|
|
debug(string.Format("load bulk details in current wave,count {0} ", dtBulks.Rows.Count));
|
|
|
|
|
gridControl3.DataSource = dtBulks.DefaultView;
|
|
|
|
|
initialGridView3Columns(gridView3);
|
2024-02-06 19:36:47 +08:00
|
|
|
|
if(dtBulks.Rows.Count>0)
|
|
|
|
|
{
|
|
|
|
|
currentCustName = dtBulks.Rows[0]["customerName"].ToString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.Invoke(new showStatus(delegate ()
|
|
|
|
|
{
|
|
|
|
|
lbCustName.Text = currentCustName;
|
|
|
|
|
}));
|
2023-11-21 19:18:23 +08:00
|
|
|
|
if (String.IsNullOrEmpty(jobNo))
|
|
|
|
|
{
|
|
|
|
|
return "请输入任务号";
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-06 19:36:47 +08:00
|
|
|
|
|
2023-11-21 19:18:23 +08:00
|
|
|
|
|
|
|
|
|
if (dt.Rows.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
return "没有数据";
|
|
|
|
|
}
|
|
|
|
|
List<ELabel> lables = new List<ELabel>();
|
|
|
|
|
int i = 0;
|
|
|
|
|
foreach (DataRow dr in dt.Rows)
|
|
|
|
|
{
|
|
|
|
|
ELabel lb = new ELabel();
|
|
|
|
|
WmsOutPickLable_tmp wp = new WmsOutPickLable_tmp(dr);
|
|
|
|
|
if(isValid && wp.state == 0)
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (!isValid && wp.state == 1)
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
i++;
|
|
|
|
|
lb.labelId = wp.elabId;
|
|
|
|
|
|
2024-02-06 19:36:47 +08:00
|
|
|
|
lb.address = wp.elabAddress;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lb.color = wp.color;
|
2023-11-21 19:18:23 +08:00
|
|
|
|
lb.port = wp.port == 0 ? currentPort : wp.port;
|
|
|
|
|
lb.color = isValid? lb.color +1 : lb.color;
|
2024-02-06 19:36:47 +08:00
|
|
|
|
lb.count = (int) wp.count ;
|
|
|
|
|
//lb.count = (int)(wp.count / wp.minOperateCount);
|
2023-11-21 19:18:23 +08:00
|
|
|
|
lables.Add(lb);
|
|
|
|
|
}
|
|
|
|
|
if (lables.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
return "已全部完成分拣";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lightPart.currentJobNo = jobNo;
|
|
|
|
|
|
|
|
|
|
WmsConstants.WAVE_CURRENT_PICK_STATUS.Clear();
|
|
|
|
|
WmsConstants.WAVE_CURRENT_LIGHTS_STATUS.Clear();
|
|
|
|
|
if (dt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
initLights();
|
|
|
|
|
showWaitForm("正在点亮标签...");
|
|
|
|
|
bool result = lightPart.lightLabels2(lables, currentPort, 1, enumLabelPickType.pick);
|
|
|
|
|
closeWaitForm();
|
|
|
|
|
|
|
|
|
|
}
|
2024-02-06 19:36:47 +08:00
|
|
|
|
return currentCustName +" 数量 "+lables.Count;
|
2023-11-21 19:18:23 +08:00
|
|
|
|
}
|
|
|
|
|
catch (Exception er)
|
|
|
|
|
{
|
|
|
|
|
showErrorMsg(er);
|
|
|
|
|
return er.Message;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
|
2024-02-06 19:36:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private string checkStock(string jobNo)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
DataTable dt = stkLocClient.getElbPartStks(jobNo); closeClient();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<ELabel> lables = new List<ELabel>();
|
|
|
|
|
int i = 0;
|
|
|
|
|
foreach (DataRow dr in dt.Rows)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
ELabel lb = new ELabel();
|
|
|
|
|
WmsStock stk = new WmsStock(dr);
|
|
|
|
|
|
|
|
|
|
if (stk.countOuting<=0 /*stk.count - stk.countOut <= 0*/)
|
|
|
|
|
{
|
|
|
|
|
// continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
i++;
|
|
|
|
|
|
|
|
|
|
int cnt = 0;
|
|
|
|
|
stk.goodsId = stk.goodsId.Substring(stk.goodsId.Length - 2);
|
|
|
|
|
try {
|
|
|
|
|
lb.labelId = Convert.ToInt32(dr["elabId"].ToString());
|
|
|
|
|
lb.address = Convert.ToUInt16(stk.goodsId.Substring(0, 2));
|
|
|
|
|
|
|
|
|
|
// cnt = (int)(stk.count - stk.countOut); // 可用库存
|
|
|
|
|
cnt = (int)(stk.countOuting); //待发任务数
|
|
|
|
|
string op = dr["minOperateCount"].ToString();
|
|
|
|
|
int minOp=(int) Convert.ToDecimal(op) ;
|
|
|
|
|
cnt = cnt / minOp;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch(Exception er)
|
|
|
|
|
{
|
|
|
|
|
//showErrorMsg(er.Message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lb.color = 1;
|
|
|
|
|
lb.port = currentPort;
|
|
|
|
|
|
|
|
|
|
lb.color = lb.color +1;
|
|
|
|
|
if (stk.count-stk.countOut-stk.countOuting < 0)
|
|
|
|
|
{
|
|
|
|
|
lb.color = 4; //红闪
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lb.count = Math.Abs( cnt);
|
|
|
|
|
lables.Add(lb);
|
|
|
|
|
}
|
|
|
|
|
this.Invoke(new showStatus(delegate ()
|
|
|
|
|
{
|
|
|
|
|
lbCustName.Text = "";
|
|
|
|
|
}));
|
|
|
|
|
if (lables.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
return "没有库存";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lightPart.currentJobNo = "库存检查";
|
|
|
|
|
this.Invoke(new showStatus(delegate ()
|
|
|
|
|
{
|
|
|
|
|
lbCustName.Text = "库存检查";
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
// WmsConstants.WAVE_CURRENT_PICK_STATUS.Clear();
|
|
|
|
|
// WmsConstants.WAVE_CURRENT_LIGHTS_STATUS.Clear();
|
|
|
|
|
if (dt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
initLights();
|
|
|
|
|
showWaitForm("正在点亮标签...");
|
|
|
|
|
bool result = lightPart.lightLabels2(lables, currentPort, 1, enumLabelPickType.pick);
|
|
|
|
|
closeWaitForm();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return "库存检查 ,数量 " + lables.Count;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception er)
|
|
|
|
|
{
|
|
|
|
|
showErrorMsg(er, er.Message);
|
|
|
|
|
closeClient();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return " 错误 ";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-11-21 19:18:23 +08:00
|
|
|
|
}
|
2023-05-23 16:13:17 +08:00
|
|
|
|
|
|
|
|
|
public int lightByOrder(string orderNo,bool isPickOrder, int partion)
|
|
|
|
|
{
|
|
|
|
|
DataTable dt = pickClient.getOrderPickList(orderNo, isPickOrder, partion);
|
|
|
|
|
closeClient();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (dt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
initLights();
|
|
|
|
|
showWaitForm("正在点亮标签...");
|
|
|
|
|
string result = lightPart.lightsUp(dt, enumLabelPickType.pick);
|
|
|
|
|
closeWaitForm();
|
2024-02-06 19:36:47 +08:00
|
|
|
|
loadWaveDetails();
|
2023-05-23 16:13:17 +08:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2023-11-21 19:18:23 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//---print ....
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int taskTakeBy = 0, taskPartion = 0, taskLineId = 0, taskOrderType = 0;
|
|
|
|
|
public int printOutTaskCode(int userId, int partion, int lineId, int orderType)
|
|
|
|
|
{
|
|
|
|
|
this.Invoke(new showStatus(delegate ()
|
|
|
|
|
{
|
|
|
|
|
// clearInput();
|
|
|
|
|
addLog(string.Format("打印 扫码用户ID:{0} , 货区:{1} ,线路:{2} ,类型:{3} ", userId, partion, lineId, orderType));
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
taskTakeBy = userId;
|
|
|
|
|
taskPartion = partion;
|
|
|
|
|
taskLineId = lineId;
|
|
|
|
|
taskOrderType = orderType;
|
|
|
|
|
print();
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void print()
|
|
|
|
|
{
|
|
|
|
|
// taskTakeBy = 278;
|
|
|
|
|
// taskPartion = 13;
|
|
|
|
|
showWaitForm();
|
|
|
|
|
DataTable dtPrint = null;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
printIn reqportPrint = new printIn();
|
|
|
|
|
dtPrint = pickClient.getPickLightTasks(taskTakeBy, taskPartion, taskOrderType);
|
|
|
|
|
reqportPrint.printSeedsLightCode(dtPrint);
|
|
|
|
|
closeClient();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception er)
|
|
|
|
|
{
|
|
|
|
|
showErrorMsg(er, er.Message);
|
|
|
|
|
closeClient();
|
|
|
|
|
}
|
|
|
|
|
closeWaitForm();
|
|
|
|
|
if (dtPrint == null || dtPrint.Rows.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
addLog("没有任务需要打印");
|
|
|
|
|
// showErrorMsg("没有任务需要打印");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void initComs()
|
|
|
|
|
{
|
|
|
|
|
String[] Portname = System.IO.Ports.SerialPort.GetPortNames();
|
|
|
|
|
mapComs.Clear();
|
|
|
|
|
combComs.Properties.TextEditStyle = TextEditStyles.DisableTextEditor;
|
|
|
|
|
combComs.Properties.Items.Clear();
|
|
|
|
|
ComboBoxItemCollection col = combComs.Properties.Items;
|
|
|
|
|
col.BeginUpdate();
|
|
|
|
|
|
|
|
|
|
oCom = System.Configuration.ConfigurationManager.AppSettings["Com"];
|
2024-02-06 19:36:47 +08:00
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(oCom))
|
|
|
|
|
{
|
|
|
|
|
oCom = WmsConstants.LIGHT_COM_1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2023-11-21 19:18:23 +08:00
|
|
|
|
int oldIndex = 0;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < Portname.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
String comText = Portname[i];
|
|
|
|
|
//col.Add(i);
|
|
|
|
|
col.Add(comText);
|
2024-02-06 19:36:47 +08:00
|
|
|
|
if (!string.IsNullOrEmpty(oCom) && oCom.ToUpper() == Portname[i].ToUpper())
|
2023-11-21 19:18:23 +08:00
|
|
|
|
{
|
|
|
|
|
oldIndex = i;
|
|
|
|
|
}
|
|
|
|
|
mapComs.Add(comText, getConfigIntValue(comText));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
col.EndUpdate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
combComs.SelectedIndex = oldIndex;
|
|
|
|
|
|
|
|
|
|
if (combComs.Properties.Items.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
initialCom();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
protected int getConfigIntValue(string key)
|
|
|
|
|
{
|
|
|
|
|
String text = System.Configuration.ConfigurationManager.AppSettings[key];
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
return Convert.ToInt32(text);
|
|
|
|
|
}
|
|
|
|
|
catch { }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dictionary<int, dnwms> coms = new Dictionary<int, dnwms>();
|
|
|
|
|
dnwms activePort;
|
|
|
|
|
int currentPort = 0;
|
|
|
|
|
bool showId;
|
|
|
|
|
private void btnShowId_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (currentPort == 0)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (showId)
|
|
|
|
|
{
|
|
|
|
|
lightPart.displayLabels(currentPort);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
lightPart.clearLabels(currentPort);
|
|
|
|
|
}
|
|
|
|
|
showId = !showId;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void initialCom()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if(string.IsNullOrEmpty(combComs.Text))
|
|
|
|
|
{ return; }
|
|
|
|
|
int port = Convert.ToInt32(combComs.Text.Substring(3));
|
|
|
|
|
resetLights();
|
|
|
|
|
if (coms.Keys.Contains(port))
|
|
|
|
|
{
|
|
|
|
|
if (String.IsNullOrEmpty(oCom) || !oCom.Equals(combComs.Text))
|
|
|
|
|
{
|
|
|
|
|
writeConfig("Com", combComs.Text);
|
|
|
|
|
oCom = combComs.Text;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
currentPort = port;
|
|
|
|
|
this.lbComstatus.Text = string.Format(combComs.Text + " 打开{0}", "成功");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
this.lbComstatus.Text = string.Format(combComs.Text + " 打开{0}", "失败");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
lbComstatus.Text = string.Format(e.Message);
|
|
|
|
|
}
|
|
|
|
|
btnShowId.Enabled = currentPort > 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void resetLights()
|
|
|
|
|
{
|
|
|
|
|
int port = Convert.ToInt32(combComs.Text.Substring(3));
|
|
|
|
|
if (Deiniu.win.elelab.coms.com_manage[port] == null)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
activePort = Deiniu.win.elelab.coms.com_manage[port].init_port;
|
|
|
|
|
//activePort.check_state = true;
|
|
|
|
|
if (lightPart.reset_device(port))
|
|
|
|
|
{
|
|
|
|
|
coms[port] = activePort;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void resetAllLights()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
foreach (string key in mapComs.Keys)
|
|
|
|
|
{
|
|
|
|
|
int port = Convert.ToInt32(key.Substring(3));
|
|
|
|
|
if (Deiniu.win.elelab.coms.com_manage[port] == null)
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
activePort = Deiniu.win.elelab.coms.com_manage[port].init_port;
|
|
|
|
|
//activePort.check_state = true;
|
|
|
|
|
if (lightPart.reset_device(port))
|
|
|
|
|
{
|
|
|
|
|
coms[port] = activePort;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
Thread.Sleep(500);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnInitialCom_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
initialCom();
|
|
|
|
|
|
|
|
|
|
|
2024-02-06 19:36:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void simpleButton1_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
queryTasks();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string lastQuery;
|
|
|
|
|
private void queryTasks()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
this.gridControl1.DataSource =getTasks();
|
|
|
|
|
closeClient();
|
|
|
|
|
initialGridView2Columns(gridView1);
|
|
|
|
|
|
|
|
|
|
closeWaitForm();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
showErrorMsg(e, e.Message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
closeWaitForm();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnPrintCode_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
showWaitForm();
|
|
|
|
|
DataTable dtPrint = null;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
printIn reqportPrint = new printIn();
|
|
|
|
|
|
|
|
|
|
dtPrint = getTasks();
|
|
|
|
|
reqportPrint.printSeedsLightCode(dtPrint);
|
|
|
|
|
closeClient();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception er)
|
|
|
|
|
{
|
|
|
|
|
showErrorMsg(er, er.Message);
|
|
|
|
|
closeClient();
|
|
|
|
|
}
|
|
|
|
|
closeWaitForm();
|
|
|
|
|
if (dtPrint == null || dtPrint.Rows.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
addLog("没有任务需要打印");
|
|
|
|
|
// showErrorMsg("没有任务需要打印");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DataTable getTasks()
|
|
|
|
|
{
|
|
|
|
|
int partion = this.comPartQuery.SelectedIndex == 0 ? 0 : ((Node)this.comPartQuery.SelectedItem).ID;
|
|
|
|
|
int lineId = this.comLine.SelectedIndex == 0 ? 0 : ((Node)this.comLine.SelectedItem).ID;
|
|
|
|
|
int wareHouse = this.comWarehouseQuery.SelectedIndex == 0 ? 0 : ((Node)this.comWarehouseQuery.SelectedItem).ID;
|
|
|
|
|
|
|
|
|
|
string date = string.Format("{0}-{1:D2}-{2:D}", dateEditFrom.DateTime.Year, dateEditFrom.DateTime.Month, dateEditFrom.DateTime.Day);
|
|
|
|
|
return pickClient.getLightTasks("",wareHouse,partion, lineId, 0, date,chkLight.Checked);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnChck_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
2023-11-21 19:18:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
delegate void showLog();
|
|
|
|
|
void addLog(string info)
|
|
|
|
|
{
|
|
|
|
|
if (InvokeRequired)
|
|
|
|
|
{
|
|
|
|
|
this.Invoke(new showLog(delegate ()
|
|
|
|
|
{
|
|
|
|
|
doLogTxt(info);
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
doLogTxt(info);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void doLogTxt(string info)
|
|
|
|
|
{
|
|
|
|
|
lbInfo.Text = info;
|
|
|
|
|
LogHelper.debug(this.GetType(), info);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
}
|
|
|
|
|
}
|