From b698a2085fd090e90abedb1e91266ec496574b29 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期四, 16 四月 2026 23:31:35 +0800
Subject: [PATCH] 1

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

diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_RecordService/LocationStatusChangeRecordService.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_RecordService/LocationStatusChangeRecordService.cs
index d159a29..a46a6b4 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_RecordService/LocationStatusChangeRecordService.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_RecordService/LocationStatusChangeRecordService.cs
@@ -1,16 +1,60 @@
-锘縰sing WIDESEA_Core.BaseRepository;
+using WIDESEA_Common.LocationEnum;
+using WIDESEA_Core.BaseRepository;
 using WIDESEA_Core.BaseServices;
 using WIDESEA_IRecordService;
 using WIDESEA_Model.Models;
 
 namespace WIDESEA_RecordService
 {
+    /// <summary>
+    /// 璐т綅鐘舵�佸彉鏇磋褰曟湇鍔″疄鐜扮被
+    /// </summary>
     public partial class LocationStatusChangeRecordService : ServiceBase<Dt_LocationStatusChangeRecord, IRepository<Dt_LocationStatusChangeRecord>>, ILocationStatusChangeRecordService
     {
-        public LocationStatusChangeRecordService(IRepository<Dt_LocationStatusChangeRecord> BaseDal) : base(BaseDal)
+        /// <summary>
+        /// 鏋勯�犲嚱鏁�
+        /// </summary>
+        public LocationStatusChangeRecordService(IRepository<Dt_LocationStatusChangeRecord> baseDal) : base(baseDal)
         {
         }
 
+        /// <summary>
+        /// 鑾峰彇璐т綅鐘舵�佸彉鏇磋褰曚粨鍌ㄦ帴鍙�
+        /// </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