From 56538e602b927c232ac5b991ef84175edd2ce3ce Mon Sep 17 00:00:00 2001
From: xiazhengtongxue <133085197+xiazhengtongxue@users.noreply.github.com>
Date: 星期五, 24 四月 2026 14:20:20 +0800
Subject: [PATCH] feat(WMS/WCS): 增加机器人历史信息记录 fix(WMS/WCS): 修复前端bug

---
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoRepository/RobotStateRepository.cs |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoRepository/RobotStateRepository.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoRepository/RobotStateRepository.cs
index 012d9ad..bd0ee02 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoRepository/RobotStateRepository.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoRepository/RobotStateRepository.cs
@@ -1,6 +1,7 @@
 using Newtonsoft.Json;
 using SqlSugar;
 using WIDESEAWCS_Core.BaseRepository;
+using WIDESEAWCS_Core.Helper;
 using WIDESEAWCS_ITaskInfoRepository;
 using WIDESEAWCS_Model.Models;
 
@@ -18,7 +19,7 @@
         public Dt_RobotState? GetByIp(string ipAddress)
         {
             return Db.Queryable<Dt_RobotState>()
-                .Where(x => x.IPAddress == ipAddress)
+                .Where(x => x.IpAddress == ipAddress)
                 .First();
         }
 
@@ -32,7 +33,7 @@
 
             var newState = new Dt_RobotState
             {
-                IPAddress = ipAddress,
+                IpAddress = ipAddress,
                 Version = DateTime.UtcNow.Ticks,
                 RobotCraneJson = JsonConvert.SerializeObject(robotCrane),
                 CreateDate = DateTime.Now,
@@ -49,7 +50,7 @@
 
             // 涔愯閿侊細WHERE IPAddress = @ip AND Version = @expectedVersion锛岀増鏈尮閰嶆墠鏇存柊
             var affectedRows = Db.Updateable<Dt_RobotState>(newState)
-                .Where(x => x.IPAddress == ipAddress && x.Version == expectedVersion)
+                .Where(x => x.IpAddress == ipAddress)
                 .ExecuteCommand();
 
             return affectedRows > 0;
@@ -59,7 +60,7 @@
         {
             var state = new RobotSocketState
             {
-                IPAddress = entity.IPAddress,
+                IPAddress = entity.IpAddress,
                 Version = entity.Version,
                 IsEventSubscribed = entity.IsEventSubscribed,
                 RobotRunMode = entity.RobotRunMode,
@@ -111,7 +112,7 @@
         {
             var entity = new Dt_RobotState
             {
-                IPAddress = state.IPAddress,
+                IpAddress = state.IPAddress,
                 IsEventSubscribed = state.IsEventSubscribed,
                 RobotRunMode = state.RobotRunMode,
                 RobotControlMode = state.RobotControlMode,
@@ -126,7 +127,11 @@
                 CurrentBatchIndex = state.CurrentBatchIndex,
                 ChangePalletPhase = state.ChangePalletPhase,
                 IsScanNG = state.IsScanNG,
-                BatteryArrived = state.BatteryArrived
+                BatteryArrived = state.BatteryArrived,
+                CellBarcodeJson = state.CellBarcode.ToJson(),
+                LastPickPositionsJson = state.LastPickPositions.ToJson(),
+                CurrentTaskJson = state.CurrentTask.ToJson(),
+                LastPutPositionsJson = state.LastPutPositions.ToJson(),
             };
 
             // 搴忓垪鍖栧鏉傚璞′负 JSON

--
Gitblit v1.9.3