From 0bfe24ddf438636aeef8c1e6989d5c8c28b0bb1a Mon Sep 17 00:00:00 2001
From: Huangxiaoqiang-03 <1247017146@qq.com>
Date: 星期四, 31 十月 2024 16:56:13 +0800
Subject: [PATCH] 1

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs |   53 +++++++++++++++++------------------------------------
 1 files changed, 17 insertions(+), 36 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs"
index d2c5191..d6807a3 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs"
@@ -8,6 +8,7 @@
 using WIDESEA_Core;
 using WIDESEA_Model.Models;
 using WIDESEA_Core.Helper;
+using Microsoft.Extensions.Logging;
 
 namespace WIDESEA_TaskInfoService
 {
@@ -72,7 +73,7 @@
             WebResponseContent content = new WebResponseContent();
             try
             {
-                Dt_StockInfo stockInfo = _stockInfoService.Repository.GetStockInfo(palletCode);
+                Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(palletCode);
                 (bool, string) result = CheckRequestInbound(stationCode, palletCode, true, stockInfo);
                 if (!result.Item1) return content = WebResponseContent.Instance.Error(result.Item2);
                 content = AssignLocUpdateData(stationCode, TaskTypeEnum.Inbound.ObjToInt(), palletCode, true, stockInfo);
@@ -99,7 +100,8 @@
             WebResponseContent content = new WebResponseContent();
             try
             {
-                Dt_LocationInfo? locationInfo = _locationInfoService.AssignLocation(stationCode, taskType);
+                Dt_LocationInfo? locationInfo = _basicService.LocationInfoService.AssignLocation(stationCode, taskType);
+                //Dt_LocationInfo dt_LocationInfo = null;
                 if (locationInfo != null)
                 {
                     Dt_Task task = new()
@@ -117,24 +119,32 @@
                     BaseDal.AddData(task);
                     int beforeStatus = locationInfo.LocationStatus;
 
-                    locationInfo.LocationStatus = LocationStatusEnum.PalletLock.ObjToInt();
+
+                    
                     if (isUpdateStock)
                     {
                         locationInfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt();
+                        _basicService.LocationInfoService.UpdateLocationLock(locationInfo, task.TaskNum, StockChangeType.Inbound.ObjToInt(), false);
+
                         if (stockInfo != null && stockInfo.Details != null && stockInfo.Details.Count > 0)
                         {
                             orderNo = stockInfo.Details.FirstOrDefault()?.OrderNo ?? "";
 
                             stockInfo.StockStatus = StockStatusEmun.鍏ュ簱纭.ObjToInt();
-                            _stockInfoService.Repository.UpdateData(stockInfo);
+                            _stockService.StockInfoService.Repository.UpdateData(stockInfo);
                         }
                         else
                         {
                             return content = WebResponseContent.Instance.Error("鏈壘鍒板簱瀛樹俊鎭�");
                         }
                     }
-                    _locationInfoService.Repository.UpdateData(locationInfo);
-                    _locationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Inbound.ObjToInt(), orderNo, task.TaskNum);
+                    else
+                    {
+                        locationInfo.LocationStatus = LocationStatusEnum.PalletLock.ObjToInt();
+                        _basicService.LocationInfoService.UpdateLocationLock(locationInfo, task.TaskNum, StockChangeType.Inbound.ObjToInt(), false);
+                    }
+                    _basicService.LocationInfoService.Repository.UpdateData(locationInfo);
+                    _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Inbound.ObjToInt(), orderNo, task.TaskNum);
 
                     return content = WebResponseContent.Instance.OK();
                 }
@@ -186,7 +196,7 @@
             }
             else
             {
-                if (_stockInfoService.Repository.QueryFirst(x => x.PalletCode == palletCode) != null)
+                if (_stockService.StockInfoService.Repository.QueryFirst(x => x.PalletCode == palletCode) != null)
                 {
                     return (false, "璇ユ墭鐩樺凡瀛樺湪搴撳唴");
                 }
@@ -195,35 +205,6 @@
             return (true, "鎴愬姛");
         }
 
-        /// <summary>
-        /// 绌烘墭鐩樺叆搴撳畬鎴愬鐞�
-        /// </summary>
-        /// <param name="task">浠诲姟瀹炰綋瀵硅薄</param>
-        /// <returns>杩斿洖澶勭悊缁撴灉</returns>
-        public WebResponseContent PalletInboundTaskCompleted(Dt_Task task)
-        {
-            Dt_StockInfo stockInfo = new Dt_StockInfo()
-            {
-                PalletCode = task.PalletCode,
-                LocationCode = task.TargetAddress,
-                StockStatus = StockStatusEmun.宸插叆搴�.ObjToInt()
-            };
-            Dt_LocationInfo locationInfo = _locationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress);
 
-            CheckInboundCompleted(stockInfo, locationInfo);
-
-            _stockInfoService.Repository.AddData(stockInfo);
-
-            int beforeStatus = locationInfo.LocationStatus;
-            locationInfo.LocationStatus = LocationStatusEnum.Pallet.ObjToInt();
-            _locationInfoService.Repository.UpdateData(locationInfo);
-
-
-            BaseDal.DeleteData(task);
-
-            _locationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Inbound.ObjToInt(), "", task.TaskNum);
-
-            return WebResponseContent.Instance.OK();
-        }
     }
 }

--
Gitblit v1.9.3