From d4b0b578752a1478f6c11b352fbb8d2bad1f9e1d Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期三, 22 十月 2025 17:18:49 +0800
Subject: [PATCH] 1

---
 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs |   69 ++++++++++------------------------
 1 files changed, 21 insertions(+), 48 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs"
index fb047f2..ede4e60 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs"
@@ -23,7 +23,9 @@
 using WIDESEA_Core.Enums;
 using WIDESEA_DTO.ERP;
 using WIDESEA_DTO.Location;
+using WIDESEA_DTO.Stock;
 using WIDESEA_DTO.WMS;
+using WIDESEA_IOrderRepository;
 using WIDESEA_IServices;
 using WIDESEA_Model.Models;
 using WIDESEA_Model.Models.Basic;
@@ -49,6 +51,8 @@
     private readonly IDt_AreaInfoRepository _areaInfoRepository; //鍖哄煙
     private readonly IDt_StationManagerRepository _stationManagerRepository;
     private readonly ISys_ConfigService _configService;
+    private readonly IDt_OutboundOrderRepository _outorderRepository;
+    private readonly IDt_OutboundOrderDetailRepository _outorderdetailRepository;
 
     public Dt_TaskService(IDt_TaskRepository BaseDal,
                                 IUnitOfWorkManage unitOfWorkManage,
@@ -62,7 +66,9 @@
                                 IDt_AreaInfoRepository areaInfoRepository,
                                 IStockInfoDetailRepository stockInfoDetailRepository,
                                 IDt_StationManagerRepository stationManagerRepository,
-                                ISys_ConfigService configService) : base(BaseDal)
+                                ISys_ConfigService configService,
+                                IDt_OutboundOrderRepository outorderRepository,
+                                IDt_OutboundOrderDetailRepository outorderdetailRepository) : base(BaseDal)
     {
         _unitOfWorkManage = unitOfWorkManage;
         _stockInfoRepository = stockInfoRepository;
@@ -76,6 +82,8 @@
         _stockInfoDetailRepository = stockInfoDetailRepository;
         _stationManagerRepository = stationManagerRepository;
         _configService = configService;
+        _outorderRepository = outorderRepository;
+        _outorderdetailRepository = outorderdetailRepository;
     }
 
     #region 澶栭儴鎺ュ彛鏂规硶
@@ -181,18 +189,16 @@
         WebResponseContent content = new WebResponseContent();
         try
         {
-            var boxing = await _boxingInfoRepository.QueryFirstNavAsync(x => x.PalletCode == task.PalletCode);
+            var stock = await _stockInfoRepository.QueryFirstNavAsync(x => x.PalletCode == task.PalletCode && x.StockStatus == (int)StockStateEmun.缁勭洏鏆傚瓨);
             var locationStart = await _locationRepository.QueryFirstAsync(x => x.LocationCode == task.SourceAddress);
             var locationEnd = await _locationRepository.QueryFirstAsync(x => x.LocationCode == task.TargetAddress);
 
-            if (boxing == null)
+            if (stock == null)
             {
                 return content.Error("鏈壘鍒扮粍鐩樻暟鎹�");
             }
-
-            DtStockInfo stock = CreatePalletStock(task, boxing);
-            DtBoxingInfo_Hty boxingInfo_Hty = boxing.Adapt<DtBoxingInfo_Hty>();
-            boxingInfo_Hty.ModifyDate = DateTime.Now;
+            stock.LocationCode = task.TargetAddress;
+            stock.StockStatus = (int)StockStateEmun.宸插叆搴�;
 
             task.TaskState = (int)TaskInStatusEnum.InFinish;
             var taskHty = task.Adapt<Dt_Task_Hty>();
@@ -202,15 +208,11 @@
 
             await _unitOfWorkManage.UseTranAsync(async () =>
             {
-                await _stockInfoRepository.AddDataNavAsync(stock);
+                await _stockInfoRepository.UpdateDataAsync(stock);
                 await DeleteTaskAsync(task.TaskId);
                 await AddTaskHtyAsync(taskHty);
-                await _boxingInfoRepository.Db.DeleteNav<DtBoxingInfo>(x => x.Id == boxing.Id)
-                                        .Include(x => x.BoxingInfoDetails)
-                                        .ExecuteCommandAsync();
                 UpdateLocationStatus(locationStart, LocationEnum.Free, task.TaskNum.Value, (int)StatusChangeTypeEnum.AutomaticInbound);
                 UpdateLocationStatus(locationEnd, LocationEnum.InStock, task.TaskNum.Value, (int)StatusChangeTypeEnum.AutomaticInbound);
-                await AddBoxingHtyAsync(boxingInfo_Hty);
             });
             content.OK("鍏ュ簱瀹屾垚");
         }
@@ -370,8 +372,8 @@
         WebResponseContent content = new WebResponseContent();
         try
         {
-            var boxingInfo = await _boxingInfoRepository.QueryFirstNavAsync(x => x.PalletCode == taskDto.PalletCode);
-            if (boxingInfo == null)
+            var stock = await _stockInfoRepository.QueryFirstNavAsync(x => x.PalletCode == taskDto.PalletCode && x.StockStatus == (int)StockStateEmun.缁勭洏鏆傚瓨);
+            if (stock == null)
             {
                 return content.Error("鎵樼洏淇℃伅涓嶅瓨鍦紝璇风‘璁ゆ墭鐩樺凡缁勭洏鎴愬姛");
             }
@@ -399,7 +401,7 @@
                 switch (taskDto.AreaId)
                 {
                     case 1:
-                        return await InboundStakerArea(taskDto, StartAddress, await GetEmptyLocation("SC1"));
+                        return await InboundStakerArea(taskDto, StartAddress);
                     case 2:
                     case 3:
                     case 4:
@@ -418,7 +420,7 @@
                     switch (location.AreaId)
                     {
                         case 1:
-                            return await InboundStakerArea(taskDto, StartAddress, location);
+                            return await InboundStakerArea(taskDto, StartAddress);
                         case 2:
                         case 3:
                         case 4:
@@ -445,22 +447,18 @@
         }
     }
 
-    public async Task<WebResponseContent> InboundStakerArea(RequestTaskDto taskDto,DtLocationInfo StartAddress, DtLocationInfo location)
+    public async Task<WebResponseContent> InboundStakerArea(RequestTaskDto taskDto,DtLocationInfo StartAddress)
     {
         WebResponseContent content = new WebResponseContent();
         try
         {
             var station = _stationManagerRepository.QueryFirst(x => x.stationType == 1 && x.Roadway == "SC1");
 
-            if (location == null)
-            {
-                return content.Error("缁堢偣鍖哄煙鏈壘鍒扮┖闂插簱浣�");
-            }
             Dt_Task taskNew = new Dt_Task
             {
                 Grade = 1,
                 Roadway = "SC1",
-                TargetAddress = location.LocationCode,
+                TargetAddress = "SC1",
                 Dispatchertime = DateTime.Now,
                 MaterialNo = "",
                 NextAddress = station.stationChildCode,
@@ -481,10 +479,8 @@
             BaseDal.AddData(taskNew);
 
             UpdateLocationStatus(StartAddress, LocationEnum.InStockDisable, taskNew.TaskNum.Value, (int)StatusChangeTypeEnum.AutomaticInbound);
-            UpdateLocationStatus(location, LocationEnum.Lock, taskNew.TaskNum.Value, (int)StatusChangeTypeEnum.AutomaticInbound);
+            //UpdateLocationStatus(location, LocationEnum.Lock, taskNew.TaskNum.Value, (int)StatusChangeTypeEnum.AutomaticInbound);
             
-            
-
             //return content.OK();
             return content = await SendWCSTask(taskDTO);
         }
@@ -1850,29 +1846,6 @@
         }
     }
 
-    private DtStockInfo CreatePalletStock(Dt_Task task, DtBoxingInfo boxing)
-    {
-        var loation = _locationRepository.QueryFirst(x => x.RoadwayNo == task.Roadway && x.LocationCode == task.TargetAddress);
-        if (loation == null)
-            throw new Exception("鏈壘鍒板搴斾綅缃俊鎭�");
-
-
-        var boxDetail = boxing.BoxingInfoDetails.Adapt<List<DtStockInfoDetail>>();
-        boxDetail.ForEach(x => { x.Status = (int)StockStateEmun.宸插叆搴�; });
-        var stock = new DtStockInfo()
-        {
-            PalletCode = task.PalletCode,
-            LocationCode = task.TargetAddress,
-            CreateDate = DateTime.Now,
-            Creater = "system",
-            IsFull = boxing.IsFull,
-            StockInfoDetails = boxDetail,
-        };
-
-        stock.StockStatus = 1;
-
-        return stock;
-    }
 
     #endregion 浠诲姟璇锋眰鏂规硶
 

--
Gitblit v1.9.3