From d6325e442b0443ae33650b58ff8d7181dacb463c Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期日, 19 四月 2026 19:24:53 +0800
Subject: [PATCH] feat(RobotState): 新增 Dt_RobotState 数据库实体,使用 RowVersion 乐观锁

---
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/RobotState/Dt_RobotState.cs |  163 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 163 insertions(+), 0 deletions(-)

diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/RobotState/Dt_RobotState.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/RobotState/Dt_RobotState.cs
new file mode 100644
index 0000000..efcaac0
--- /dev/null
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/RobotState/Dt_RobotState.cs
@@ -0,0 +1,163 @@
+using Newtonsoft.Json;
+using SqlSugar;
+using WIDESEAWCS_Core.DB.Models;
+
+namespace WIDESEAWCS_Model.Models
+{
+    /// <summary>
+    /// 鏈烘鎵嬬姸鎬佹暟鎹簱瀹炰綋
+    /// </summary>
+    /// <remarks>
+    /// 瀵瑰簲鏁版嵁搴撹〃 Dt_RobotState锛屼娇鐢� RowVersion 瀹炵幇涔愯骞跺彂鎺у埗銆�
+    /// 澶嶆潅瀵硅薄锛圧obotCrane銆丆urrentTask銆佹暟缁勭瓑锛変互 JSON 瀛楃涓插瓨鍌ㄣ��
+    /// </remarks>
+    [SugarTable(nameof(Dt_RobotState), "鏈烘鎵嬬姸鎬佽〃")]
+    public class Dt_RobotState : BaseEntity
+    {
+        /// <summary>
+        /// 涓婚敭 ID
+        /// </summary>
+        [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "涓婚敭ID")]
+        public int Id { get; set; }
+
+        /// <summary>
+        /// 鏈烘鎵� IP 鍦板潃锛屽敮涓�绱㈠紩
+        /// </summary>
+        [SugarColumn(Length = 50, ColumnDescription = "鏈烘鎵婭P鍦板潃", IsJsonKey = true)]
+        public string IPAddress { get; set; } = string.Empty;
+
+        /// <summary>
+        /// 琛岀増鏈紝鐢ㄤ簬涔愯骞跺彂鎺у埗
+        /// </summary>
+        /// <remarks>
+        /// SqlSugar 浼氳嚜鍔ㄧ鐞嗘瀛楁锛屾瘡娆℃洿鏂版椂鏁版嵁搴撹嚜鍔ㄩ�掑銆�
+        /// 鏇存柊鏃� WHERE RowVersion = @expectedRowVersion锛屾鏌ュ奖鍝嶈鏁板垽鏂槸鍚﹀啿绐併��
+        /// </remarks>
+        [SugarColumn(ColumnDescription = "琛岀増鏈紙涔愯閿侊級", IsJsonKey = true)]
+        public byte[] RowVersion { get; set; } = Array.Empty<byte>();
+
+        /// <summary>
+        /// 鏄惁宸茶闃呮秷鎭簨浠�
+        /// </summary>
+        [SugarColumn(ColumnDescription = "鏄惁宸茶闃呮秷鎭簨浠�", IsJsonKey = true)]
+        public bool IsEventSubscribed { get; set; }
+
+        /// <summary>
+        /// 鏈烘鎵嬭繍琛屾ā寮�
+        /// </summary>
+        /// <remarks>1: 鎵嬪姩妯″紡, 2: 鑷姩妯″紡</remarks>
+        [SugarColumn(ColumnDescription = "杩愯妯″紡", IsNullable = true, IsJsonKey = true)]
+        public int? RobotRunMode { get; set; }
+
+        /// <summary>
+        /// 鏈烘鎵嬫帶鍒舵ā寮�
+        /// </summary>
+        /// <remarks>1: 瀹㈡埛绔帶鍒�, 2: 鍏朵粬</remarks>
+        [SugarColumn(ColumnDescription = "鎺у埗妯″紡", IsNullable = true, IsJsonKey = true)]
+        public int? RobotControlMode { get; set; }
+
+        /// <summary>
+        /// 鏈烘鎵嬫墜鑷傛姄鍙栧璞$姸鎬�
+        /// </summary>
+        /// <remarks>0: 鏃犵墿鏂欙紙鎵嬭噦绌洪棽锛�, 1: 鏈夌墿鏂欙紙宸叉姄鍙栬揣鐗╋級</remarks>
+        [SugarColumn(ColumnDescription = "鎵嬭噦鎶撳彇鐘舵��", IsNullable = true, IsJsonKey = true)]
+        public int? RobotArmObject { get; set; }
+
+        /// <summary>
+        /// 鏈烘鎵嬭澶囧熀纭�淇℃伅锛圝SON 搴忓垪鍖栵級
+        /// </summary>
+        [SugarColumn(Length = 2000, ColumnDescription = "璁惧淇℃伅JSON", IsJsonKey = true)]
+        public string RobotCraneJson { get; set; } = string.Empty;
+
+        /// <summary>
+        /// 鏈烘鎵嬪垵濮嬪寲瀹屾垚鍥炲埌寰呮満浣嶇姸鎬�
+        /// </summary>
+        /// <remarks>Possible values: "Homed", "Homing"</remarks>
+        [SugarColumn(Length = 50, ColumnDescription = "鍥為浂鐘舵��", IsNullable = true, IsJsonKey = true)]
+        public string? Homed { get; set; }
+
+        /// <summary>
+        /// 鏈烘鎵嬪綋鍓嶆鍦ㄦ墽琛岀殑鍔ㄤ綔
+        /// </summary>
+        [SugarColumn(Length = 50, ColumnDescription = "褰撳墠鍔ㄤ綔", IsNullable = true, IsJsonKey = true)]
+        public string? CurrentAction { get; set; }
+
+        /// <summary>
+        /// 鏈烘鎵嬪綋鍓嶈繍琛岀姸鎬�
+        /// </summary>
+        [SugarColumn(Length = 50, ColumnDescription = "杩愯鐘舵��", IsNullable = true, IsJsonKey = true)]
+        public string? OperStatus { get; set; }
+
+        /// <summary>
+        /// 鏈�杩戜竴娆″彇璐у畬鎴愮殑浣嶇疆鏁扮粍锛圝SON锛�
+        /// </summary>
+        [SugarColumn(Length = 500, ColumnDescription = "鍙栬揣浣嶇疆鏁扮粍JSON", IsNullable = true, IsJsonKey = true)]
+        public string? LastPickPositionsJson { get; set; }
+
+        /// <summary>
+        /// 鏈�杩戜竴娆℃斁璐у畬鎴愮殑浣嶇疆鏁扮粍锛圝SON锛�
+        /// </summary>
+        [SugarColumn(Length = 500, ColumnDescription = "鏀捐揣浣嶇疆鏁扮粍JSON", IsNullable = true, IsJsonKey = true)]
+        public string? LastPutPositionsJson { get; set; }
+
+        /// <summary>
+        /// 鐢垫睜/璐т綅鏉$爜鍒楄〃锛圝SON锛�
+        /// </summary>
+        [SugarColumn(Length = 2000, ColumnDescription = "鐢佃姱鏉$爜鍒楄〃JSON", IsNullable = true, IsJsonKey = true)]
+        public string? CellBarcodeJson { get; set; }
+
+        /// <summary>
+        /// 鏈烘鎵嬪綋鍓嶆鍦ㄦ墽琛岀殑浠诲姟锛圝SON 搴忓垪鍖栵級
+        /// </summary>
+        [SugarColumn(Length = 2000, ColumnDescription = "褰撳墠浠诲姟JSON", IsNullable = true, IsJsonKey = true)]
+        public string? CurrentTaskJson { get; set; }
+
+        /// <summary>
+        /// 鏄惁闇�瑕佹墽琛屾媶鐩樹换鍔�
+        /// </summary>
+        [SugarColumn(ColumnDescription = "鏄惁鎷嗙洏浠诲姟", IsJsonKey = true)]
+        public bool IsSplitPallet { get; set; }
+
+        /// <summary>
+        /// 鏄惁闇�瑕佹墽琛岀粍鐩樹换鍔�
+        /// </summary>
+        [SugarColumn(ColumnDescription = "鏄惁缁勭洏浠诲姟", IsJsonKey = true)]
+        public bool IsGroupPallet { get; set; }
+
+        /// <summary>
+        /// 鏈哄櫒浜哄凡澶勭悊鐨勪换鍔℃�绘暟
+        /// </summary>
+        [SugarColumn(ColumnDescription = "宸插鐞嗕换鍔℃�绘暟", IsJsonKey = true)]
+        public int RobotTaskTotalNum { get; set; }
+
+        /// <summary>
+        /// 鏄惁澶勪簬鍋囩數鑺ˉ鍏呮ā寮�
+        /// </summary>
+        [SugarColumn(ColumnDescription = "鏄惁鍋囩數鑺ā寮�", IsJsonKey = true)]
+        public bool IsInFakeBatteryMode { get; set; }
+
+        /// <summary>
+        /// 褰撳墠鎵规璧峰缂栧彿
+        /// </summary>
+        [SugarColumn(ColumnDescription = "褰撳墠鎵规缂栧彿", IsJsonKey = true)]
+        public int CurrentBatchIndex { get; set; } = 1;
+
+        /// <summary>
+        /// 鎹㈢洏浠诲姟褰撳墠闃舵
+        /// </summary>
+        [SugarColumn(ColumnDescription = "鎹㈢洏闃舵", IsJsonKey = true)]
+        public int ChangePalletPhase { get; set; }
+
+        /// <summary>
+        /// 鏄惁鎵爜NG
+        /// </summary>
+        [SugarColumn(ColumnDescription = "鏄惁鎵爜NG", IsJsonKey = true)]
+        public bool IsScanNG { get; set; }
+
+        /// <summary>
+        /// 鏄惁鐢佃姱鍒颁綅
+        /// </summary>
+        [SugarColumn(ColumnDescription = "鐢佃姱鏄惁鍒颁綅", IsJsonKey = true)]
+        public bool BatteryArrived { get; set; }
+    }
+}
\ No newline at end of file

--
Gitblit v1.9.3