From 960b33fa24c47a330e51a2c24859d681ae62caeb Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期四, 16 四月 2026 10:09:49 +0800
Subject: [PATCH] 重构任务与库存模型,增强日志管理与区域接口

---
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Boxing/BoxingInfoService.cs |   31 ++++++++++++++++++++++---------
 1 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Boxing/BoxingInfoService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Boxing/BoxingInfoService.cs
index f81c063..2ba7926 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Boxing/BoxingInfoService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Boxing/BoxingInfoService.cs
@@ -67,7 +67,22 @@
         WebResponseContent content = new WebResponseContent();
         try
         {
+            var boxingInfo = BaseDal.QueryFirst(x=>x.PalletCode == groupPlate.palletCode);
+            if(boxingInfo != null)
+            {
+                return content.Error($"鎵樼洏鍙枫�恵groupPlate.palletCode}銆戝瓨鍦ㄧ粍鐩樹俊鎭�");
+            }
 
+            var newBoxingInfo = new DtBoxingInfo
+            {
+                PalletCode = groupPlate.palletCode,
+                MaterielName = groupPlate.group,
+                StockStatus = (int)StockStateEmun.缁勭洏鏆傚瓨,
+                IsFull = groupPlate.IsFull,
+                Remark = string.Empty
+            };
+
+            await BaseDal.AddDataAsync(newBoxingInfo);
             return content.OK("缁勭洏鎴愬姛");
         }
         catch (Exception ex)
@@ -90,18 +105,16 @@
             {
                 return content.Error("鍙傛暟閿欒");
             }
-            var boxingInfo = await BaseDal.QueryFirstNavAsync(x => x.PalletCode == groupPlate.palletCode);
+            var boxingInfo = await BaseDal.QueryFirstAsync(x => x.PalletCode == groupPlate.palletCode);
             if (!boxingInfo.IsNullOrEmpty())
             {
-                boxingInfo.StockStatus = (int)StockStateEmun.缁勭洏鎾ら攢;
-                DtBoxingInfo_Hty stockhty = boxingInfo.Adapt<DtBoxingInfo_Hty>();
-                stockhty.ModifyDate = DateTime.Now;
+                DtBoxingInfo_Hty boxinghty = boxingInfo.Adapt<DtBoxingInfo_Hty>();
+                boxinghty.ModifyDate = DateTime.Now;
+                boxinghty.StockStatus = (int)StockStateEmun.缁勭洏鎾ら攢;
                 await _unitOfWorkManage.UseTranAsync(async () =>
                 {
-                    await BaseDal.Db.DeleteNav<DtBoxingInfo>(x => x.Id == boxingInfo.Id)
-                                            .Include(x => x.BoxingInfoDetails)
-                                            .ExecuteCommandAsync();
-                    await AddStockHtyAsync(stockhty);
+                    await BaseDal.Db.Deleteable<DtBoxingInfo>(x => x.Id == boxingInfo.Id).ExecuteCommandAsync();
+                    await AddBoxingHtyAsync(boxinghty);
                 });
                 content.OK("瑙g洏鎴愬姛");
             }
@@ -116,7 +129,7 @@
             return content.Error(ex.Message);
         }
     }
-    private async Task AddStockHtyAsync(DtBoxingInfo_Hty stockhty)
+    private async Task AddBoxingHtyAsync(DtBoxingInfo_Hty stockhty)
     {
         var isStockAdd = await SqlSugarHelper.DbWMS.InsertNav(stockhty).Include(x=>x.BoxingInfoDetails).ExecuteCommandAsync();
         if (!isStockAdd)

--
Gitblit v1.9.3