From 3f249ca4ce203ef0b985a2a800343a60ef6c7a2c Mon Sep 17 00:00:00 2001 From: 123 <123> Date: Sat, 29 Jun 2024 19:12:33 +0800 Subject: [PATCH 1/2] 123 --- WCS.BLL/Services/Service/OutstoreService.cs | 15 ++++--- WCS.BLL/Tool/Helper.cs | 49 ++++++++++++++++++++- 2 files changed, 57 insertions(+), 7 deletions(-) diff --git a/WCS.BLL/Services/Service/OutstoreService.cs b/WCS.BLL/Services/Service/OutstoreService.cs index 9946b4e..0d891ed 100644 --- a/WCS.BLL/Services/Service/OutstoreService.cs +++ b/WCS.BLL/Services/Service/OutstoreService.cs @@ -987,7 +987,8 @@ namespace WCS.BLL.Services.Service for (int i = 0; i < si.Count; i++) { TCPClient tCPClient = TCPClientManager.GetTCPClientByIPHost(si[i].ClientIp); - byte[] warnlightOn = Helper.OutstoreWarnLight(si[i].LightId, LightColor, 1, 0); + //byte[] warnlightOn = Helper.OutstoreWarnLight(si[i].LightId, LightColor, 1, 0); + byte[] warnlightOn = Helper.OutstoreWarnLight_1(si[i].LightId, LightColor, 1, 1); tCPClient.Send(warnlightOn); Logs.Write("出库,报警灯亮:" + BitConverter.ToString(warnlightOn)); Thread.Sleep(100); @@ -1269,8 +1270,7 @@ namespace WCS.BLL.Services.Service { DbHelp.db.Updateable().SetColumns(it => it.IsLocked == false).Where(it => it.MatSN == listdetail.MatSN).ExecuteCommand(); } - - DbHelp.db.Updateable().SetColumns(it => it.OrderNumber == null).Where(it => it.OrderNumber == request.OrderNumber).ExecuteCommand(); + //灭灯 //获取需要出库的物料明细 var outOrderMatDetails = DbHelp.db.Queryable() @@ -1350,15 +1350,18 @@ namespace WCS.BLL.Services.Service for (int i = 0; i < si.Count; i++) { TCPClient tCPClient = TCPClientManager.GetTCPClientByIPHost(si[i].ClientIp); - byte[] warnlightOn = Helper.OutstoreWarnLight(si[i].LightId, LightColor, 0, 0); + //byte[] warnlightOn = Helper.OutstoreWarnLight(si[i].LightId, LightColor, 0, 0); + byte[] warnlightOn = Helper.OutstoreWarnLight_1(si[i].LightId, LightColor, 0, 0); tCPClient.Send(warnlightOn); Logs.Write("出库,报警灯灭:" + BitConverter.ToString(warnlightOn)); Thread.Sleep(100); } } } - - + if (isComplete == true) + { + DbHelp.db.Updateable().SetColumns(it => it.OrderNumber == null).Where(it => it.OrderNumber == request.OrderNumber).ExecuteCommand(); + } return new ResponseCommon() { diff --git a/WCS.BLL/Tool/Helper.cs b/WCS.BLL/Tool/Helper.cs index f905102..6570705 100644 --- a/WCS.BLL/Tool/Helper.cs +++ b/WCS.BLL/Tool/Helper.cs @@ -354,6 +354,53 @@ namespace WCS.BLL.Tool } } - + public static byte[] OutstoreWarnLight_1(int lightid, string lightcolor, int status, int beestatus) + { + byte color = 0x00; + switch (lightcolor) + { + case "红": + color = 0x01; + break; + case "绿": + color = 0x02; + break; + case "黄": + color = 0x03; + break; + case "蓝": + color = 0x04; + break; + case "紫": + color = 0x05; + break; + case "青": + color = 0x06; + break; + case "白": + color = 0x07; + break; + case "无": + color = 0x00; + break; + } + byte[] data1 = new byte[5 + 3 * 7]; + data1[0] = 0xff; + data1[1] = 0x01; + data1[2] = 0x00; + data1[3] = (byte)(data1.Length + 2); + data1[4] = 0x07; + for (int i = 0; i < 6; i++) + { + data1[5 + i * 3] = (byte)(lightid + i); + data1[6 + i * 3] = (byte)status; + data1[7 + i * 3] = color; + } + data1[5 + 3 * 7 - 3] = (byte)(lightid + 6); + data1[5 + 3 * 7 - 2] =(byte)beestatus; + data1[5 + 3 * 7 - 1] = 0x00; + byte[] data2 = Crc16(data1, data1.Length, true); + return data2; + } } } From 743f114e62a5d0eff78b6b37e5f38df85c481306 Mon Sep 17 00:00:00 2001 From: 123 <123> Date: Sat, 29 Jun 2024 20:05:05 +0800 Subject: [PATCH 2/2] 123 --- WCS.BLL/Services/Service/OutstoreService.cs | 2 ++ WCS.BLL/Tool/Helper.cs | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/WCS.BLL/Services/Service/OutstoreService.cs b/WCS.BLL/Services/Service/OutstoreService.cs index 0d891ed..555721d 100644 --- a/WCS.BLL/Services/Service/OutstoreService.cs +++ b/WCS.BLL/Services/Service/OutstoreService.cs @@ -979,6 +979,8 @@ namespace WCS.BLL.Services.Service } } } + //发送间隔 + Thread.Sleep(300); foreach (string shelfcode in WarnLightShelfCode) { List si = DbHelp.db.Queryable().Where(it => it.ShelfCode == shelfcode).ToList(); diff --git a/WCS.BLL/Tool/Helper.cs b/WCS.BLL/Tool/Helper.cs index 6570705..47976a3 100644 --- a/WCS.BLL/Tool/Helper.cs +++ b/WCS.BLL/Tool/Helper.cs @@ -384,21 +384,21 @@ namespace WCS.BLL.Tool color = 0x00; break; } - byte[] data1 = new byte[5 + 3 * 7]; + byte[] data1 = new byte[5 + 3 * 6]; data1[0] = 0xff; data1[1] = 0x01; data1[2] = 0x00; data1[3] = (byte)(data1.Length + 2); - data1[4] = 0x07; + data1[4] = 0x06; for (int i = 0; i < 6; i++) { data1[5 + i * 3] = (byte)(lightid + i); data1[6 + i * 3] = (byte)status; data1[7 + i * 3] = color; } - data1[5 + 3 * 7 - 3] = (byte)(lightid + 6); - data1[5 + 3 * 7 - 2] =(byte)beestatus; - data1[5 + 3 * 7 - 1] = 0x00; + //data1[5 + 3 * 7 - 3] = (byte)(lightid + 6); + //data1[5 + 3 * 7 - 2] =(byte)beestatus; + //data1[5 + 3 * 7 - 1] = 0x00; byte[] data2 = Crc16(data1, data1.Length, true); return data2; }