From 24b202e031752ec82bc216a8213d7d345f1ea4aa Mon Sep 17 00:00:00 2001
From: 肖洋 <cathay_xy@163.com>
Date: 星期一, 25 十一月 2024 16:18:24 +0800
Subject: [PATCH] 2

---
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs |   51 +++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 43 insertions(+), 8 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 fa3ef06..a1e0369 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
@@ -2,6 +2,7 @@
 using Mapster;
 using Masuit.Tools;
 using Masuit.Tools.Models;
+using Microsoft.EntityFrameworkCore;
 using System.Linq;
 using System.Threading.Tasks;
 using WIDESEA_DTO.MOM;
@@ -12,6 +13,7 @@
 using WIDESEA_StorageBasicRepository;
 using WIDESEA_StorageTaskRepository;
 using WIDESEA_StoragIntegrationServices;
+using WIDESEAWCS_BasicInfoRepository;
 
 namespace WIDESEA_StorageOutTaskServices;
 
@@ -38,6 +40,7 @@
     private readonly IDt_AreaInfoRepository _areaInfoRepository; //鍖哄煙
     private readonly IAgingInOrOutInputService _agingInOrOutInputService; //闈欑疆\闄堝寲
     private readonly IProductionRepository _productionRepository; //鐢熶骇
+    private readonly IDt_StationManagerRepository _stationManagerRepository;
 
     public Dt_TaskService(IDt_TaskRepository BaseDal,
                                 IUnitOfWorkManage unitOfWorkManage,
@@ -59,7 +62,8 @@
                                 IDt_AreaInfoRepository areaInfoRepository,
                                 IAgingInOrOutInputService agingInOrOutInputService,
                                 IStockInfoDetailRepository stockInfoDetailRepository,
-                                IProductionRepository productionRepository) : base(BaseDal)
+                                IProductionRepository productionRepository,
+                                IDt_StationManagerRepository stationManagerRepository) : base(BaseDal)
     {
         _unitOfWorkManage = unitOfWorkManage;
         _outOrderRepository = outOrderRepository;
@@ -81,6 +85,7 @@
         _agingInOrOutInputService = agingInOrOutInputService;
         _stockInfoDetailRepository = stockInfoDetailRepository;
         _productionRepository = productionRepository;
+        _stationManagerRepository = stationManagerRepository;
     }
 
     #region 澶栭儴鎺ュ彛鏂规硶
@@ -98,10 +103,12 @@
                 //var process = await SqlSugarHelper.Db.Queryable<Dt_EquipmentProcess>()
                 //    .FirstAsync(x => x.EquipmentName == task.Roadway);
                 //var info = JsonConvert.DeserializeObject<ResponseEqptRunDto>(process.ProcessValue);
-
-                var agingOutputDto = MapToAgingOutputDto(stock);
-                content = await _agingInOrOutInputService.GetOCVOutputAsync(agingOutputDto);
-                ValidateResponse(content);
+                if (!task.Roadway.Contains("FR"))  //闈炲垎瀹瑰簱鍖哄潎涓婃姤MOM鍑哄叆绔�
+                {
+                    var agingOutputDto = MapToAgingOutputDto(stock);
+                    content = await _agingInOrOutInputService.GetOCVOutputAsync(agingOutputDto);
+                    ValidateResponse(content);
+                }
             }
 
             // 鏇存柊搴撳瓨鐘舵�佸拰浠诲姟鐘舵��
@@ -434,6 +441,11 @@
         }
         LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "楠岃瘉浠诲姟鏄惁瀛樺湪", JsonConvert.SerializeObject(task));
 
+        if(task.TaskType == (int)TaskOutboundTypeEnum.InToOut)
+        {
+           return await CompleteInToOutTaskAsync(task);
+        }
+
         // 楠岃瘉搴撳瓨鏄惁瀛樺湪
         var stock = await _stockInfoRepository.QueryFirstNavAsync(x => x.PalletCode == task.PalletCode);
 
@@ -530,7 +542,17 @@
             if (serialNosError.Count > 0)
             {
                 // TODO 鍒涘缓浠诲姟閫佽嚦NG鎺掑嚭鍙�
-                List<string> NGStation = input.Position == "1088" ? new List<string>() { "1020" } : new List<string>() { "JZSC01" };
+                var efg = _stationManagerRepository.QueryData(x => x.stationType == 1 && x.stationChildCode == input.Position && x.stationArea == area.AreaCode).ToList();
+                //List<string> NGStation = input.Position == "1088" ? new List<string>() { "1020" } : new List<string>() { "JZSC01" };
+                if(efg.Count <= 0)
+                {
+                    throw new Exception("鏈壘鍒癗G鍏ュ簱绔欏彴閰嶇疆");
+                }
+                List<string> NGStation = efg.Select(x => x.stationNGLocation).ToList();
+                if (NGStation.Count <= 0)
+                {
+                    NGStation = efg.Select(x => x.stationNGChildCode).ToList();
+                }
                 content = await CreateNewTask(input, NGStation, 2);
                 return content.Error("瀛樺湪寮傚父鐢佃姱");
             }
@@ -573,7 +595,13 @@
             //// 璋冪敤GetProcessResponseAsync鏂规硶锛岃幏鍙栧伐鑹哄搷搴�
             //var processResponse = await GetProcessResponseAsync(process, input.Position);
 
-            List<string> strings = input.Position == "1088" ? new List<string>() { "CHSC01" } : new List<string>() { "JZSC01" };
+            //List<string> strings = input.Position == "1088" ? new List<string>() { "CHSC01" } : new List<string>() { "JZSC01" };
+            var stationManagers = _stationManagerRepository.QueryData(x => x.stationType == 1 && x.stationChildCode == input.Position && x.stationArea == area.AreaCode).ToList();
+            if (stationManagers.Count <= 0)
+            {
+                throw new Exception("鏈壘鍒癗G鍏ュ簱绔欏彴閰嶇疆");
+            }
+            List<string> strings = stationManagers.Select(x=>x.Roadway).ToList();
             // 璋冪敤CreateNewTask鏂规硶锛屽垱寤烘柊浠诲姟
             content = await CreateNewTask(input, strings);
             if (content.Status)
@@ -647,8 +675,15 @@
                 return content.OK(data: task);
             }
 
+            var stationManagers = _stationManagerRepository.QueryData(x => x.stationType == 1 && x.stationChildCode == input.Position).ToList();
+            if (stationManagers.Count <= 0)
+            {
+                throw new Exception("鏈壘鍒扮┖鎵樼洏鍏ュ簱绔欏彴閰嶇疆");
+            }
+
+
             // 鑾峰彇鐩爣鍦板潃
-            List<string> strings = input.Position == "1016" ? new List<string>() { "CHSC01" } : new List<string>() { "JZSC01" };
+            List<string> strings = stationManagers.Select(x => x.Roadway).ToList();
 
             return await CreateNewTask(input, strings, 1);
         }

--
Gitblit v1.9.3