From 7202fced2a265369f83f1557d3db7525bb62d41b Mon Sep 17 00:00:00 2001
From: 肖洋 <cathay_xy@163.com>
Date: 星期一, 25 十一月 2024 16:21:30 +0800
Subject: [PATCH] 3

---
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs |   53 ++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 42 insertions(+), 11 deletions(-)

diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
index a1e0369..a54dac6 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
@@ -184,7 +184,7 @@
 
     private (DtLocationInfo, Dt_Task) UpdateStockAndTaskStatus(DtStockInfo stock, Dt_Task task)
     {
-        var location = _locationRepository.QueryFirst(x => x.LocationCode == task.SourceAddress);
+        var location = _locationRepository.QueryFirst(x => x.LocationCode == task.SourceAddress && x.RoadwayNo == task.Roadway);
         //var details = _stockInfoDetailRepository.QueryData(x => x.StockId == stock.Id);
 
         location.LocationStatus = (int)LocationEnum.Free;
@@ -315,6 +315,7 @@
             // 鏍规嵁鏄惁鏈夌粍鐩樹俊鎭垱寤哄簱瀛樺疄渚嬫ā鍨�
             DtStockInfo stock = boxing == null ? CreateEmptyPalletStock(task, locationInf) : CreateFullPalletStock(task, locationInf, boxing);
 
+
             // 鎵ц鏁版嵁搴撲簨鍔�
             bool isResult = await ExecuteTransaction(stock, taskHty, locationInf, task.TaskId);
             if (isResult)
@@ -350,13 +351,41 @@
             CreateDate = DateTime.Now,
             Creater = "system",
             IsFull = false,
-            AreaCode = area.AreaCode,
+            AreaCode = area.AreaCode ?? "",
             LocationId = loation.Id,
             StockInfoDetails = new List<DtStockInfoDetail>()
             {
                 new DtStockInfoDetail()
                 {
                     MaterielCode = "绌烘墭鐩�",
+                    Id = 0,
+                    Status = (int)StockStateEmun.宸插叆搴�
+                }
+            }
+        };
+    }
+
+    /// <summary>
+    /// 鍒涘缓鍒嗗鐨勫疄鎵樼洏鐨勫簱瀛樺疄渚嬫ā鍨�
+    /// </summary>
+    private DtStockInfo CreateFullPalletStockByFR(Dt_Task task, DtLocationInfo locationInf)
+    {
+        var loation = _locationRepository.QueryFirst(x => x.RoadwayNo == task.Roadway && x.LocationCode == task.TargetAddress);
+        var area = _areaInfoRepository.QueryFirst(x => x.AreaID == loation.AreaId);
+        return new DtStockInfo()
+        {
+            PalletCode = task.PalletCode,
+            LocationCode = task.TargetAddress,
+            CreateDate = DateTime.Now,
+            Creater = "system",
+            IsFull = false,
+            AreaCode = area.AreaCode ?? "",
+            LocationId = loation.Id,
+            StockInfoDetails = new List<DtStockInfoDetail>()
+            {
+                new DtStockInfoDetail()
+                {
+                    MaterielCode = "瀹炴墭鐩�",
                     Id = 0,
                     Status = (int)StockStateEmun.宸插叆搴�
                 }
@@ -441,9 +470,9 @@
         }
         LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "楠岃瘉浠诲姟鏄惁瀛樺湪", JsonConvert.SerializeObject(task));
 
-        if(task.TaskType == (int)TaskOutboundTypeEnum.InToOut)
+        if (task.TaskType == (int)TaskOutboundTypeEnum.InToOut)
         {
-           return await CompleteInToOutTaskAsync(task);
+            return await CompleteInToOutTaskAsync(task);
         }
 
         // 楠岃瘉搴撳瓨鏄惁瀛樺湪
@@ -571,7 +600,7 @@
 
             // 璋冪敤CreateBoxingInfo鏂规硶锛屽垱寤虹粍鐩樹俊鎭�
 
-            var boxing = await CreateBoxingInfo(result, input.PalletCode);
+            var boxing = CreateBoxingInfo(result, input.PalletCode);
             if (boxing == null) return content.Error("缁勭洏澶辫触");
 
             // 璋冪敤GetProcessApplyAsync鏂规硶锛岃幏鍙栧伐鑹鸿矾绾�
@@ -702,7 +731,7 @@
     }
 
     // 鑾峰彇缁勭洏淇℃伅
-    private async Task<DtBoxingInfo> CreateBoxingInfo(ResultTrayCellsStatus result, string palletCode)
+    private DtBoxingInfo CreateBoxingInfo(ResultTrayCellsStatus result, string palletCode)
     {
         return new DtBoxingInfo
         {
@@ -1208,12 +1237,14 @@
             {
                 // 娣诲姞搴撳瓨
                 isUpdateStock = await _stockInfoRepository.AddDataNavAsync(stock);
-                isDeleteBoxing = await _boxingInfoRepository.Db.DeleteNav<DtBoxingInfo>(x => x.Id == boxingInfo.Id)
-                   .Include(x => x.BoxingInfoDetails)
-                   .ExecuteCommandAsync();
+                if (boxingInfo != null)
+                {
+                    isDeleteBoxing = await _boxingInfoRepository.Db.DeleteNav<DtBoxingInfo>(x => x.Id == boxingInfo.Id)
+                .Include(x => x.BoxingInfoDetails)
+                .ExecuteCommandAsync();
+                }
+
             }
-
-
 
             // 娣诲姞鍘嗗彶浠诲姟
             var isTaskHtyAdd = await _task_HtyRepository.AddDataAsync(taskHty) > 0;

--
Gitblit v1.9.3