From d3055b8843869573277ba821e0428f1597d74291 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A6=82=E6=84=8F=20=E5=BD=AD?= <2417589739@qq.com> Date: Wed, 21 Jun 2023 18:01:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=98=E9=87=8F=E7=9B=91=E6=8E=A7=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../VariableMonitorAttribute.cs | 56 ++++- BPASmartClient.Tourism/GVL_MorkCL.cs | 194 ++++++++++++++++++ .../Model/Control/RobotMainTask.cs | 2 +- .../Server/FryingPanServer.cs | 2 +- 4 files changed, 251 insertions(+), 3 deletions(-) diff --git a/BPASmartClient.Device/VariableMonitorAttribute.cs b/BPASmartClient.Device/VariableMonitorAttribute.cs index 8d4ba870..7eb17b4b 100644 --- a/BPASmartClient.Device/VariableMonitorAttribute.cs +++ b/BPASmartClient.Device/VariableMonitorAttribute.cs @@ -28,7 +28,12 @@ namespace BPASmartClient.Device if (address.Length > 0) { address = address.Trim(); - if (address.ToUpper().Contains("M") && address.Length >= 4) + if (address.ToUpper().Contains("GM") && address.Length >= 3) + { + var res = address.Remove(0, 2); + if (res != null && res.Length > 0) return (int.Parse(res) + 4096).ToString(); + } + else if (address.ToUpper().Contains("M") && address.Length >= 4) { var res = address.Substring(1).Split('.'); if (res != null && res.Length == 2) @@ -42,6 +47,19 @@ namespace BPASmartClient.Device } } } + else if (address.ToUpper().Contains("GI") && address.Length >= 3) + { + var res = address.Remove(0, 2); + if (res != null && res.Length > 0) return res; + } + else if (address.ToUpper().Contains("LB") && address.Length >= 3) + { + var res = address.Substring(2); + if (res != null && res.Length > 0) + { + if (int.TryParse(res, out int firstAddress)) return firstAddress.ToString(); + } + } else if ((address.ToUpper().Contains("VW") || address.ToUpper().Contains("VD")) && address.Length >= 3) { var res = address.Substring(2); @@ -50,8 +68,44 @@ namespace BPASmartClient.Device return ((tempAddress / 2) + 100).ToString(); } } + else if (address.ToUpper().Contains("LW") && address.Length >= 3) + { + var res = address.Substring(2); + if (res != null && int.TryParse(res, out int LwAddress)) + { + return LwAddress.ToString(); + } + } } return ""; + //if (address == null) return ""; + //if (address.Length > 0) + //{ + // address = address.Trim(); + // if (address.ToUpper().Contains("M") && address.Length >= 4) + // { + // var res = address.Substring(1).Split('.'); + // if (res != null && res.Length == 2) + // { + // if (int.TryParse(res[0], out int firstAddress) && int.TryParse(res[1], out int ExitAddress)) + // { + // if (ExitAddress >= 0 && ExitAddress <= 7) + // { + // return ((firstAddress * 8) + 320 + ExitAddress).ToString(); + // } + // } + // } + // } + // else if ((address.ToUpper().Contains("VW") || address.ToUpper().Contains("VD")) && address.Length >= 3) + // { + // var res = address.Substring(2); + // if (res != null && int.TryParse(res, out int tempAddress)) + // { + // return ((tempAddress / 2) + 100).ToString(); + // } + // } + //} + //return ""; } /// diff --git a/BPASmartClient.Tourism/GVL_MorkCL.cs b/BPASmartClient.Tourism/GVL_MorkCL.cs index 5951a23c..45c07a9f 100644 --- a/BPASmartClient.Tourism/GVL_MorkCL.cs +++ b/BPASmartClient.Tourism/GVL_MorkCL.cs @@ -11,11 +11,139 @@ namespace BPASmartClient.MorkCL public ConcurrentQueue cds { get; set; } = new ConcurrentQueue(); #region 炒锅1 + /// + /// 初始化完成 + /// + [VariableMonitor("1号炒锅-初始化完成", "LB100")] + public bool InitComplete1 { get; set; } + /// + /// 手自动状态模式 + /// + [VariableMonitor("1号炒锅-手自动状态模式", "LB101")] + public bool StatusMode1 { get; set; } + + /// + /// 急停 + /// + [VariableMonitor("1号炒锅-急停", "LB102")] + public bool EStop1 { get; set; } + + /// + /// 炒制位置反馈(1-4) + /// + [VariableMonitor("1号炒锅-炒制位置反馈(1-4)", "LB103")] + public bool[] StirFryingLocFB1 { get; set; } = new bool[4]; + + /// + /// 炒锅在出餐位置反馈 + /// + [VariableMonitor("1号炒锅-炒锅在出餐位置反馈", "LB107")] + public bool DiningOutLocFB1 { get; set; } + + /// + /// 炒锅在投料位置反馈 + /// + [VariableMonitor("1号炒锅-炒锅在投料位置反馈", "LB108")] + public bool FeedingLocFB1 { get; set; } + + /// + /// 炒锅在洗锅位置反馈 + /// + [VariableMonitor("1号炒锅-炒锅在洗锅位置反馈", "LB109")] + public bool WashingPotLocFB1 { get; set; } + + /// + /// 通道出料完成反馈(1-3) + /// + [VariableMonitor("1号炒锅-通道出料完成反馈(1-3)", "LB110")] + public bool[] ChannelDisCom1 { get; set; } = new bool[3]; + + /// + /// 当前锅底温度 + /// + [VariableMonitor("1号炒锅-当前锅底温度", "LW20")] + public float CurrentTemperature1 { get; set; } + + /// + /// 当前炒锅搅拌转速 + /// + [VariableMonitor("1号炒锅-当前炒锅搅拌转速", "LW21")] + public ushort CurrentSpeed1 { get; set; } + + /// + /// 当前加热档位 + /// + [VariableMonitor("1号炒锅-当前加热档位", "LW22")] + public ushort HeatingGear1 { get; set; } #endregion #region 炒锅2 + /// + /// 初始化完成 + /// + [VariableMonitor("2号炒锅-初始化完成", "LB100")] + public bool InitComplete2 { get; set; } + + /// + /// 手自动状态模式 + /// + [VariableMonitor("2号炒锅-手自动状态模式", "LB101")] + public bool StatusMode2 { get; set; } + + /// + /// 急停 + /// + [VariableMonitor("2号炒锅-急停", "LB102")] + public bool EStop2 { get; set; } + + /// + /// 炒制位置反馈(1-4) + /// + [VariableMonitor("2号炒锅-炒制位置反馈(1-4)", "LB103")] + public bool[] StirFryingLocFB2 { get; set; } = new bool[4]; + + /// + /// 炒锅在出餐位置反馈 + /// + [VariableMonitor("2号炒锅-炒锅在出餐位置反馈", "LB107")] + public bool DiningOutLocFB2 { get; set; } + + /// + /// 炒锅在投料位置反馈 + /// + [VariableMonitor("2号炒锅-炒锅在投料位置反馈", "LB108")] + public bool FeedingLocFB2 { get; set; } + /// + /// 炒锅在洗锅位置反馈 + /// + [VariableMonitor("2号炒锅-炒锅在洗锅位置反馈", "LB109")] + public bool WashingPotLocFB2 { get; set; } + + /// + /// 通道出料完成反馈(1-3) + /// + [VariableMonitor("2号炒锅-通道出料完成反馈(1-3)", "LB110")] + public bool[] ChannelDisCom2 { get; set; } = new bool[3]; + + /// + /// 当前锅底温度 + /// + [VariableMonitor("2号炒锅-当前锅底温度", "LW20")] + public float CurrentTemperature2 { get; set; } + + /// + /// 当前炒锅搅拌转速 + /// + [VariableMonitor("2号炒锅-当前炒锅搅拌转速", "LW21")] + public ushort CurrentSpeed2 { get; set; } + + /// + /// 当前加热档位 + /// + [VariableMonitor("2号炒锅-当前加热档位", "LW22")] + public ushort HeatingGear2 { get; set; } #endregion #region 压力锅 @@ -23,7 +151,73 @@ namespace BPASmartClient.MorkCL #endregion #region 机器人 + /// + /// 倒料请求 + /// + [VariableMonitor("机器人-倒料请求-[1:1号炒锅,2:2号炒锅,3:高压锅]", "LW22")] + public bool[] MaterialPouringRequest = new bool[3]; + + /// + /// 倒料完成 + /// + [VariableMonitor("机器人-倒料完成-[1:1号炒锅,2:2号炒锅,3:高压锅]", "LW22")] + public bool[] MaterialPouringComplete = new bool[3]; + + /// + /// 出餐请求,机器人到位请求炒锅出餐 + /// + [VariableMonitor("机器人-出餐请求-[1:1号炒锅,2:2号炒锅,3:高压锅]", "LW22")] + public bool[] DiningOutRequest { get; set; } = new bool[3]; + + /// + /// 入库完成 + /// + [VariableMonitor("机器人-入库完成", "LW22")] + public bool[] WarehousingComplete { get; set; } = new bool[12]; + + /// + /// 机器人原点状态 + /// + [VariableMonitor("机器人-机器人原点状态", "LW22")] + public bool Home { get; set; } + + /// + /// 机器人使能状态 + /// + [VariableMonitor("机器人-机器人使能状态", "LW22")] + public bool EnableState { get; set; } + + /// + /// 机器人远程模式 + /// + [VariableMonitor("机器人-机器人远程模式", "LW22")] + public bool RemoteMode { get; set; } + + /// + /// 机器人程序运行中 + /// + [VariableMonitor("机器人-机器人程序运行中", "LW22")] + public bool ProgramRuning { get; set; } + + /// + /// 机器人任务反馈 + /// + [VariableMonitor("机器人-机器人任务反馈", "LW22")] + public RobotMainTask TaskFeedback { get; set; } + #endregion + + #region 其它外部设备 + /// + /// 电子秤当前重量 + /// + [VariableMonitor("电子秤当前重量", "0")] + public float CurrentWeight { get; set; } + /// + /// 空箱子检测 + /// + [VariableMonitor("出餐箱子在位检测", "0")] + public bool[] BoxDetection { get; set; } = new bool[4]; #endregion } } diff --git a/BPASmartClient.Tourism/Model/Control/RobotMainTask.cs b/BPASmartClient.Tourism/Model/Control/RobotMainTask.cs index f1cb1511..f3b6d7ad 100644 --- a/BPASmartClient.Tourism/Model/Control/RobotMainTask.cs +++ b/BPASmartClient.Tourism/Model/Control/RobotMainTask.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace BPASmartClient.MorkCL.Model.Control { - internal enum RobotMainTask : ushort + public enum RobotMainTask : ushort { 无任务 = 0, 库位1取主料 = 1, diff --git a/BPASmartClient.Tourism/Server/FryingPanServer.cs b/BPASmartClient.Tourism/Server/FryingPanServer.cs index d473becc..1c75626c 100644 --- a/BPASmartClient.Tourism/Server/FryingPanServer.cs +++ b/BPASmartClient.Tourism/Server/FryingPanServer.cs @@ -38,7 +38,7 @@ namespace BPASmartClient.MorkCL.Server var LW20 = MyModbus.Read("LW20".ToModbusAdd(), 3); if (LW20.IsSuccess) { - CurrentTemperature = LW20.Content[0]; + CurrentTemperature = LW20.Content[0] * 10.0F; CurrentSpeed = LW20.Content[1]; HeatingGear = LW20.Content[2]; }