From b6c983ac19c0c80744795e122575f4b9ac145414 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期日, 19 四月 2026 18:53:40 +0800
Subject: [PATCH] feat: 更新机器人任务处理逻辑和接口配置

---
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/DeviceBase/DeviceCommand.cs |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/DeviceBase/DeviceCommand.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/DeviceBase/DeviceCommand.cs
index f81c8e3..61b3377 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/DeviceBase/DeviceCommand.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/DeviceBase/DeviceCommand.cs
@@ -166,7 +166,14 @@
                             //throw new Exception($"璇诲彇PLC瀛楃涓插畾涔夐暱搴︺�恵Content[index]}銆戜笌瀵硅薄銆恵GetType().Name}銆戝睘鎬с�恵propertyInfo.Name}銆戠壒鎬у畾涔夊瓧绗︿覆闀垮害銆恵dataLength}銆戜笉涓�鑷�");
                             //QuartzLogger.Debug($"璇诲彇PLC瀛楃涓插畾涔夐暱搴︺�恵Content[index]}銆戜笌瀵硅薄銆恵GetType().Name}銆戝睘鎬с�恵propertyInfo.Name}銆戠壒鎬у畾涔夊瓧绗︿覆闀垮害銆恵dataLength}銆戜笉涓�鑷�");
 
-                            propertyInfo.SetValue(this, Encoding.Default.GetString(Content, index, dataLength).Trim().Replace("\0", "").Replace("\\u000","").Trim());
+                            try
+                            {
+                                propertyInfo.SetValue(this, Encoding.Default.GetString(Content, index + 2, Content[index + 1] > 0 ? Content[index + 1] : dataLength - 2).Trim().Replace("\0", "").Replace("\\u000", "").Trim());
+                            }
+                            catch
+                            {
+                                propertyInfo.SetValue(this, Encoding.Default.GetString(Content, index, dataLength).Trim().Replace("\0", "").Replace("\\u000", "").Trim());
+                            }
                             index += dataLength;
                             break;
                         }

--
Gitblit v1.9.3