From fe2a1e74780259605cd230e6f9c629c3dd7fdf15 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期五, 10 四月 2026 20:19:06 +0800
Subject: [PATCH] feat: 添加消防任务支持并修复堆垛机状态处理
---
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/DeviceBase/DeviceCommand.cs | 23 +++++++++++++++--------
1 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/DeviceBase/DeviceCommand.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/DeviceBase/DeviceCommand.cs
index 1c0e868..f81c8e3 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/DeviceBase/DeviceCommand.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/DeviceBase/DeviceCommand.cs
@@ -23,6 +23,7 @@
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
+using WIDESEAWCS_Core.LogHelper;
namespace WIDESEAWCS_QuartzJob.DeviceBase
{
@@ -160,17 +161,23 @@
case TypeCode.String:
ushort dataLength = CheckStringAttribute(propertyInfo);
- //if (dataLength - 2 != Content[index])
- //{
- // throw new Exception($"璇诲彇PLC瀛楃涓插畾涔夐暱搴︺�恵Content[index]}銆戜笌瀵硅薄銆恵GetType().Name}銆戝睘鎬с�恵propertyInfo.Name}銆戠壒鎬у畾涔夊瓧绗︿覆闀垮害銆恵dataLength}銆戜笉涓�鑷�");
- //}
+ if (dataLength - 2 != Content[index])
+ {
+ //throw new Exception($"璇诲彇PLC瀛楃涓插畾涔夐暱搴︺�恵Content[index]}銆戜笌瀵硅薄銆恵GetType().Name}銆戝睘鎬с�恵propertyInfo.Name}銆戠壒鎬у畾涔夊瓧绗︿覆闀垮害銆恵dataLength}銆戜笉涓�鑷�");
+ //QuartzLogger.Debug($"璇诲彇PLC瀛楃涓插畾涔夐暱搴︺�恵Content[index]}銆戜笌瀵硅薄銆恵GetType().Name}銆戝睘鎬с�恵propertyInfo.Name}銆戠壒鎬у畾涔夊瓧绗︿覆闀垮害銆恵dataLength}銆戜笉涓�鑷�");
- //if (Content[index + 1] > Content.Length - index - 2)
- //{
- // throw new Exception($"璇诲彇PLC瀛楃涓插疄闄呴暱搴︺�恵Content[index + 1]}銆戣秴鍑哄綋鍓峛yte鏁扮粍闀垮害锛岀储寮曪細銆恵index}銆戯紝瀛楃涓茶捣濮嬬储寮曪細銆恵index + 2}銆戯紝鏁扮粍闀垮害锛氥�恵Content.Length}銆戯紝瑙f瀽闀垮害锛氥�恵Content.Length - index - 2}銆�");
- //}
+ propertyInfo.SetValue(this, Encoding.Default.GetString(Content, index, dataLength).Trim().Replace("\0", "").Replace("\\u000","").Trim());
+ index += dataLength;
+ break;
+ }
+
+ if (Content[index + 1] > Content.Length - index - 2)
+ {
+ throw new Exception($"璇诲彇PLC瀛楃涓插疄闄呴暱搴︺�恵Content[index + 1]}銆戣秴鍑哄綋鍓峛yte鏁扮粍闀垮害锛岀储寮曪細銆恵index}銆戯紝瀛楃涓茶捣濮嬬储寮曪細銆恵index + 2}銆戯紝鏁扮粍闀垮害锛氥�恵Content.Length}銆戯紝瑙f瀽闀垮害锛氥�恵Content.Length - index - 2}銆�");
+ }
propertyInfo.SetValue(this, Encoding.Default.GetString(Content, index + 2, Content[index + 1] > 0 ? Content[index + 1] : dataLength - 2));
+ //propertyInfo.SetValue(this, Encoding.Default.GetString(Content, index, dataLength - 2));
index += dataLength;
break;
default:
--
Gitblit v1.9.3