From 3e7d5e1f6b7df03cf0383a08c7333de6e37c84f5 Mon Sep 17 00:00:00 2001 From: itachilee <3050155685@qq.com> Date: Sat, 30 Apr 2022 13:01:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9E=9C=E6=B1=81=E6=9C=BA=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HBLConsole.Communication/ConnectHelper.cs | 8 +- HBLConsole.Communication/JaKaHelper.cs | 10 +- HBLConsole.Communication/JuicerHelper.cs | 2 + HBLConsole.Debug/Debug_MORKJC.xaml | 20 ++- HBLConsole.Debug/Debug_MORKJC.xaml.cs | 172 +++++++++++++++++++++- HBLConsole.MORKIC/Control_MORKIC.cs | 1 - HBLConsole.MORKJC/Control_MORKJC.cs | 148 ++++++++++--------- HBLConsole.MORKJC/PolymerBatching.cs | 1 + HBLConsole.MainConsole/Main.cs | 16 +- 9 files changed, 287 insertions(+), 91 deletions(-) diff --git a/HBLConsole.Communication/ConnectHelper.cs b/HBLConsole.Communication/ConnectHelper.cs index 97542ff..dd242fa 100644 --- a/HBLConsole.Communication/ConnectHelper.cs +++ b/HBLConsole.Communication/ConnectHelper.cs @@ -58,10 +58,10 @@ namespace HBLConsole.Communication } break; case EDeviceType.JAKA: - //if (item.Device is ModbusTcp tcp) - //{ - // LebaiHelper.GetInstance.Connect(tcp.IP); - //} + if (item.Device is ModbusTcp jaka) + { + JaKaHelper.GetInstance.Connect(jaka.IP); + } break; case EDeviceType.MCU: if (item.Device is SerialDeviceBase ser) diff --git a/HBLConsole.Communication/JaKaHelper.cs b/HBLConsole.Communication/JaKaHelper.cs index 6f8c297..280c665 100644 --- a/HBLConsole.Communication/JaKaHelper.cs +++ b/HBLConsole.Communication/JaKaHelper.cs @@ -17,22 +17,26 @@ namespace HBLConsole.Communication #region 果汁机设备 public const string SENCE_取咖啡杯 = "10000"; public const string SENCE_取果汁杯 = "10001"; - public const string SENCE_取茶杯 = "10002"; + public const string SENCE_取茶水杯 = "10002"; + public const string SENCE_取水杯 = "10003"; public const string SENCE_取咖啡杯检测 = "11000"; public const string SENCE_取果汁杯检测 = "11001"; - public const string SENCE_取茶杯检测 = "11002"; + public const string SENCE_取茶水杯检测 = "11002"; + public const string SENCE_取水杯检测 = "11003"; public const string SENCE_接咖啡 = "12000"; public const string SENCE_接果汁1 = "12001"; public const string SENCE_接果汁2 = "12002"; public const string SENCE_接果汁3 = "12003"; public const string SENCE_接果汁4 = "12004"; public const string SENCE_接茶 = "12005"; + public const string SENCE_接水 = "12006"; public const string SENCE_放咖啡杯 = "13000"; public const string SENCE_放果汁杯1 = "13001"; public const string SENCE_放果汁杯2 = "13002"; public const string SENCE_放果汁杯3 = "13003"; public const string SENCE_放果汁杯4 = "13004"; - public const string SENCE_放茶杯 = "13005"; + public const string SENCE_放茶水杯 = "13005"; + public const string SENCE_放水杯 = "13006"; #endregion public int rshd = -1; public bool login = false; diff --git a/HBLConsole.Communication/JuicerHelper.cs b/HBLConsole.Communication/JuicerHelper.cs index 2737f90..e340f6e 100644 --- a/HBLConsole.Communication/JuicerHelper.cs +++ b/HBLConsole.Communication/JuicerHelper.cs @@ -91,9 +91,11 @@ namespace HBLConsole.Communication if (comPort.IsOpen) { comPort.Write(buffers, 0, buffers.Length); + DateTime newDate = DateTime.Now; while (comPort.BytesToRead < 33) { Thread.Sleep(1); + if (DateTime.Now.Subtract(newDate).TotalSeconds >= 2) break; } byte[] receive = new byte[comPort.BytesToRead]; comPort.Read(receive, 0, receive.Length); diff --git a/HBLConsole.Debug/Debug_MORKJC.xaml b/HBLConsole.Debug/Debug_MORKJC.xaml index 5753799..7da63ca 100644 --- a/HBLConsole.Debug/Debug_MORKJC.xaml +++ b/HBLConsole.Debug/Debug_MORKJC.xaml @@ -1,12 +1,24 @@ - + Height="450" Width="800"> + - + + +