diff --git a/Aucma.Core.BoxFoam/ViewModels/FoamMonitorPageViewModel.cs b/Aucma.Core.BoxFoam/ViewModels/FoamMonitorPageViewModel.cs index 3a4fddb7..89d9dc47 100644 --- a/Aucma.Core.BoxFoam/ViewModels/FoamMonitorPageViewModel.cs +++ b/Aucma.Core.BoxFoam/ViewModels/FoamMonitorPageViewModel.cs @@ -359,7 +359,7 @@ namespace Aucma.Core.BoxFoam.ViewModels foreach (var item in list) { if (item.Status == 1) StatusColor.Add("Green"); - if (item.Status == 2) StatusColor.Add("Red"); + if (item.Status == 3) StatusColor.Add("Red"); if (!string.IsNullOrEmpty(item.FixtureBoxType)) FixtureName.Add(item.FixtureBoxType); if (!string.IsNullOrEmpty(item.Yield.ToString())) Production.Add(item.Yield.ToString()); // if (!string.IsNullOrEmpty(item.InternalTemperature.ToString())) InternalTemperature.Add(item.InternalTemperature.ToString()); diff --git a/Aucma.Core.CodeBinding/Business/GunBusiness.cs b/Aucma.Core.CodeBinding/Business/GunBusiness.cs index 3900e7f2..a21237f7 100644 --- a/Aucma.Core.CodeBinding/Business/GunBusiness.cs +++ b/Aucma.Core.CodeBinding/Business/GunBusiness.cs @@ -50,7 +50,7 @@ namespace Aucma.Core.CodeBinding.Business //忽略null字节 serialPort.DiscardNull = true; //接收事件 - serialPort.DataReceived += serialPort_DataReceived; + serialPort.DataReceived += new SerialDataReceivedEventHandler(serialPort_DataReceived); //开启串口 serialPort.Open(); } @@ -72,14 +72,20 @@ namespace Aucma.Core.CodeBinding.Business { SerialPort serialPort = (SerialPort)sender; + + string code = serialPort.ReadExisting(); + + if (string.IsNullOrEmpty(code)) + { + return; + } + //业务处理 + Console.WriteLine("获取数据:" + code.Trim()); - //开启接收数据线程 - Thread threadReceiveSub = new Thread(new ParameterizedThreadStart(ReceiveData)); - threadReceiveSub.Start(serialPort); } catch (Exception ex) { - throw; + Console.Write(ex.ToString()); } } private static void ReceiveData(object serialPortobj) diff --git a/Aucma.Core.Scanner/Helper/MvCodeHelper.cs b/Aucma.Core.Scanner/Helper/MvCodeHelper.cs index 8d86809c..6267ed39 100644 --- a/Aucma.Core.Scanner/Helper/MvCodeHelper.cs +++ b/Aucma.Core.Scanner/Helper/MvCodeHelper.cs @@ -74,6 +74,7 @@ namespace Aucma.Core.Scanner // (成功创建)连接上的设备和其ip(string)集合 public static Dictionary m_cMyDevices = new Dictionary(); + private static string lastCodeStr = string.Empty; #region 设备连接状态 /// @@ -342,11 +343,15 @@ namespace Aucma.Core.Scanner } string strCode = Encoding.GetEncoding("UTF-8").GetString(buffer).Trim().TrimEnd('\0'); log.Info("相机ip:" + hashmap.Value + " Get CodeNum: " + "CodeNum[" + i.ToString() + "], CodeString[" + strCode + "]"); - if (!string.IsNullOrEmpty(strCode)) + if (!string.IsNullOrEmpty(strCode) && !strCode.Equals(lastCodeStr)) { - DoorReceiveCodeDelegateEvent?.Invoke(strCode);//箱门匹配扫码器 - // 获取到条码处理业务 - Console.WriteLine(strCode,hashmap.Value); + // DoorReceiveCodeDelegateEvent?.Invoke(strCode);//箱门匹配扫码器 + // 获取到条码处理业务 + + Console.WriteLine(strCode,hashmap.Value); + // 泡前库业务处理 + // PQKReceiveCodeEvent(strCode); + lastCodeStr = strCode; } } }