From 9b77acb859f0866f3a854d2a2842072b2fe9cca8 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期二, 31 三月 2026 16:43:27 +0800
Subject: [PATCH] feat(wms): 完善库存三维看板与库存/货位变更追踪

---
 Code/WMS/WIDESEA_WMSServer/WIDESEA_RecordService/LocationStatusChangeRecordService.cs |   38 ++++++++++++++++++++++++++++++++++++--
 1 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_RecordService/LocationStatusChangeRecordService.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_RecordService/LocationStatusChangeRecordService.cs
index 28b3d83..a46a6b4 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_RecordService/LocationStatusChangeRecordService.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_RecordService/LocationStatusChangeRecordService.cs
@@ -1,4 +1,5 @@
-锘縰sing WIDESEA_Core.BaseRepository;
+using WIDESEA_Common.LocationEnum;
+using WIDESEA_Core.BaseRepository;
 using WIDESEA_Core.BaseServices;
 using WIDESEA_IRecordService;
 using WIDESEA_Model.Models;
@@ -13,7 +14,6 @@
         /// <summary>
         /// 鏋勯�犲嚱鏁�
         /// </summary>
-        /// <param name="baseDal">鍩虹鏁版嵁璁块棶瀵硅薄</param>
         public LocationStatusChangeRecordService(IRepository<Dt_LocationStatusChangeRecord> baseDal) : base(baseDal)
         {
         }
@@ -22,5 +22,39 @@
         /// 鑾峰彇璐т綅鐘舵�佸彉鏇磋褰曚粨鍌ㄦ帴鍙�
         /// </summary>
         public IRepository<Dt_LocationStatusChangeRecord> Repository => BaseDal;
+
+        /// <summary>
+        /// 璁板綍璐т綅鐘舵�佸彉鏇淬��
+        /// </summary>
+        public async Task<bool> AddChangeRecordAsync(
+            Dt_LocationInfo beforeLocation,
+            Dt_LocationInfo afterLocation,
+            LocationChangeType changeType,
+            int? taskNum = null,
+            string? orderNo = null,
+            int? orderId = null,
+            string? remark = null)
+        {
+            if (beforeLocation == null || afterLocation == null)
+                return false;
+
+            if (beforeLocation.LocationStatus == afterLocation.LocationStatus)
+                return true;
+
+            Dt_LocationStatusChangeRecord record = new Dt_LocationStatusChangeRecord
+            {
+                LocationId = afterLocation.Id,
+                LocationCode = afterLocation.LocationCode,
+                BeforeStatus = beforeLocation.LocationStatus,
+                AfterStatus = afterLocation.LocationStatus,
+                ChangeType = (int)changeType,
+                OrderId = orderId,
+                OrderNo = orderNo,
+                TaskNum = taskNum,
+                Remark = remark
+            };
+
+            return await BaseDal.AddDataAsync(record) > 0;
+        }
     }
 }

--
Gitblit v1.9.3