From 663d9d2e658ab99a0c3598becd23b00b34b3e3d9 Mon Sep 17 00:00:00 2001
From: 肖洋 <cathay_xy@163.com>
Date: 星期五, 29 十一月 2024 13:55:22 +0800
Subject: [PATCH] 高常温逻辑

---
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs |   93 ++++++++++++++++------------------------------
 1 files changed, 33 insertions(+), 60 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 69b11ac..311ccd4 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
@@ -1,7 +1,9 @@
-锘縰sing Mapster;
+锘�
+using Mapster;
 using Masuit.Tools;
 using WIDESEA_DTO.MOM;
 using WIDESEA_DTO.WMS;
+using WIDESEA_IServices;
 using WIDESEA_IStoragIntegrationServices;
 using WIDESEA_StorageBasicRepository;
 using WIDESEAWCS_BasicInfoRepository;
@@ -12,17 +14,11 @@
 {
     private readonly LogFactory LogFactory = new LogFactory();
     private readonly IUnitOfWorkManage _unitOfWorkManage;
-    private readonly IDt_OutOrderRepository _outOrderRepository;
     private readonly IStockInfoRepository _stockInfoRepository;
     private readonly IStockInfoDetailRepository _stockInfoDetailRepository;
     private readonly IDt_Task_HtyRepository _task_HtyRepository;
-    private readonly IDt_OutOrderAndStockRepository _outOrderAndStockRepository;
-    private readonly IDt_OutOrderAndStock_HtyRepository _outOrderAndStock_HtyRepository;
     private readonly IMapper _mapper;
-    private readonly IDt_MaterielInfoRepository _materielInfoRepository;
     private readonly ILocationInfoRepository _locationRepository;
-    private readonly IDt_WareAreaInfoRepository _wareAreaInfoRepository;
-    private readonly IPointStackerRelationRepository _pointStackerRelationRepository;
     private readonly ITaskExecuteDetailRepository _taskExecuteDetailRepository;
     private readonly ILocationStatusChangeRecordRepository _locationStatusChangeRecordRepository;
     private readonly IBoxingInfoRepository _boxingInfoRepository; //缁勭洏
@@ -30,21 +26,16 @@
     private readonly IProcessApplyService _processApplyService; //宸ヨ壓璺嚎
     private readonly IDt_AreaInfoRepository _areaInfoRepository; //鍖哄煙
     private readonly IAgingInOrOutInputService _agingInOrOutInputService; //闈欑疆\闄堝寲
-    private readonly IProductionRepository _productionRepository; //鐢熶骇
     private readonly IDt_StationManagerRepository _stationManagerRepository;
+    private readonly ISys_ConfigService _configService;
 
     public Dt_TaskService(IDt_TaskRepository BaseDal,
                                 IUnitOfWorkManage unitOfWorkManage,
                                 IDt_OutOrderRepository outOrderRepository,
                                 IStockInfoRepository stockInfoRepository,
-                                IDt_OutOrderAndStockRepository dt_OutOrderAndStockRepository,
-                                IDt_OutOrderAndStock_HtyRepository dt_OutOrderAndStock_HtyRepository,
                                 IDt_Task_HtyRepository task_HtyRepository,
                                 IMapper mapper,
-                                IDt_MaterielInfoRepository materielInfoRepository,
                                 ILocationInfoRepository locationRepository,
-                                IDt_WareAreaInfoRepository wareAreaInfoRepository,
-                                IPointStackerRelationRepository pointStackerRelationRepository,
                                 ITaskExecuteDetailRepository taskExecuteDetailRepository,
                                 ILocationStatusChangeRecordRepository locationStatusChangeRecordRepository,
                                 IBoxingInfoRepository boxingInfoRepository,
@@ -53,20 +44,14 @@
                                 IDt_AreaInfoRepository areaInfoRepository,
                                 IAgingInOrOutInputService agingInOrOutInputService,
                                 IStockInfoDetailRepository stockInfoDetailRepository,
-                                IProductionRepository productionRepository,
-                                IDt_StationManagerRepository stationManagerRepository) : base(BaseDal)
+                                IDt_StationManagerRepository stationManagerRepository,
+                                ISys_ConfigService configService) : base(BaseDal)
     {
         _unitOfWorkManage = unitOfWorkManage;
-        _outOrderRepository = outOrderRepository;
         _stockInfoRepository = stockInfoRepository;
-        _outOrderAndStockRepository = dt_OutOrderAndStockRepository;
-        _outOrderAndStock_HtyRepository = dt_OutOrderAndStock_HtyRepository;
         _task_HtyRepository = task_HtyRepository;
         _mapper = mapper;
-        _materielInfoRepository = materielInfoRepository;
         _locationRepository = locationRepository;
-        _wareAreaInfoRepository = wareAreaInfoRepository;
-        _pointStackerRelationRepository = pointStackerRelationRepository;
         _taskExecuteDetailRepository = taskExecuteDetailRepository;
         _locationStatusChangeRecordRepository = locationStatusChangeRecordRepository;
         _boxingInfoRepository = boxingInfoRepository;
@@ -75,8 +60,8 @@
         _areaInfoRepository = areaInfoRepository;
         _agingInOrOutInputService = agingInOrOutInputService;
         _stockInfoDetailRepository = stockInfoDetailRepository;
-        _productionRepository = productionRepository;
         _stationManagerRepository = stationManagerRepository;
+        _configService = configService;
     }
 
     #region 澶栭儴鎺ュ彛鏂规硶
@@ -141,8 +126,19 @@
         var parameterInfo = JsonConvert.DeserializeObject<List<ParameterInfo>>(stock.ParameterInfos).FirstOrDefault(y => y.Description.Contains("鏃堕棿"));
         if (parameterInfo == null) throw new Exception("");
 
-        var outHours = (DateTime.Now - stock.OutboundTime.Value).TotalHours;
+        var outHours = (DateTime.Now - (stock.LinedProcessFeedbackTime == null ? stock.CreateDate : stock.LinedProcessFeedbackTime.ToDateTime())).TotalHours;
+
+        //if (stock.LinedProcessFeedbackTime == null)
+        //{
+        //    outHours = (DateTime.Now - stock.CreateDate).TotalHours;
+        //}
+        //else
+        //{
+        //    outHours = (DateTime.Now - stock.LinedProcessFeedbackTime.ToDateTime()).TotalHours;
+        //}
+
         var isNG = outHours > parameterInfo.LowerSpecificationsLimit.ToDouble() && outHours < parameterInfo.UpperSpecificationsLimit.ToDouble();
+
         var defectCode = string.Empty;
         if (!isNG) defectCode = "TQCK";
         return new AgingOutputDto
@@ -617,11 +613,18 @@
 
             // 濡傛灉鐘舵�佷负false锛屽垯杩斿洖null
             if (!content.Status) return content.Error("宸ヨ壓鐢宠澶辫触");
+            var resultProcessApply = JsonConvert.DeserializeObject<ResultProcessApply>(content.Data.ToString());
+            if ((resultProcessApply.Success)) return content.Error("宸ヨ壓鐢宠澶辫触");
 
-            //// 璋冪敤GetProcessResponseAsync鏂规硶锛岃幏鍙栧伐鑹哄搷搴�
+            var par = resultProcessApply.ProcessInfo.Where(x => x.ProcessCode == boxing.ProcessCode).FirstOrDefault().Number.ToInt32();
+
+
+            // 璋冪敤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" };
+            Console.WriteLine(area.AreaCode+"-----------------------");
+            Console.WriteLine(input.Position + "-----------------------");
             var stationManagers = _stationManagerRepository.QueryData(x => x.stationType == 1 && x.stationChildCode == input.Position && x.stationArea == area.AreaCode).ToList();
             if (stationManagers.Count <= 0)
             {
@@ -734,6 +737,7 @@
         {
             PalletCode = palletCode,
             IsFull = true,
+            ProcessCode = result.ProcessCode,
             BoxingInfoDetails = result.SerialNos.Select(serialNoObj => new DtBoxingInfoDetail
             {
                 SerialNumber = serialNoObj.SerialNo,
@@ -791,7 +795,7 @@
             if (hasTask != null)
             {
                 WMSTaskDTO taskDTO1 = CreateTaskDTO(hasTask);
-                return content.OK("宸插瓨鍦ㄧ┖鐩樺嚭搴撲换鍔�", data: taskDTO1);
+                return content.OK("宸插瓨鍦ㄥ嚭搴撲换鍔�", data: taskDTO1);
             }
 
             // 鍒涘缓鏂颁换鍔″疄渚�
@@ -885,7 +889,9 @@
             TaskState = (int)TaskOutStatusEnum.OutNew,
             TaskType = tag == (int)TaskOutboundTypeEnum.Outbound ? (int)TaskOutboundTypeEnum.Outbound : (int)TaskOutboundTypeEnum.OutTray,
             TaskNum = BaseDal.GetTaskNo().Result,
-            Creater = "System" // 淇鎷煎啓閿欒
+            Creater = "System", // 淇鎷煎啓閿欒
+            CreateDate = DateTime.Now,
+            TaskId = 0,
         };
     }
 
@@ -1134,39 +1140,6 @@
     #endregion 鍐呴儴璋冪敤鏂规硶
 
     #region private 鍐呴儴鏂规硶
-
-    /// <summary>
-    /// 鏇存柊鍑哄簱璁㈠崟鍜屽簱瀛樹俊鎭�
-    /// </summary>
-    /// <param name="stock">搴撳瓨瀹炰緥</param>
-    /// <param name="barCode">鏉$爜</param>
-    /// <returns>鏇存柊鍚庣殑璁㈠崟鍜屽簱瀛樹俊鎭�</returns>
-    private async Task<Dt_OutOrderAndStock> UpdateOrderAndStockAsync(DtStockInfo stock, string barCode)
-    {
-        //鏍规嵁PalletCode鑾峰彇璁㈠崟鍜屽簱瀛樹俊鎭�
-        var orderStock = await _outOrderAndStockRepository.GetOrderAndStock(palletCode: barCode);
-
-        //瀹屾垚鏁伴噺澧炲姞
-        orderStock.CompletedQuantity += stock.StockInfoDetails.Sum(x => x.StockQuantity);
-
-        //璁㈠崟璇︽儏瀹屾垚鏁伴噺澧炲姞
-        orderStock.OrderList.OrderDetailList.CompletedQuantity += stock.StockInfoDetails.Sum(x => x.StockQuantity);
-
-        //杩斿洖鏇存柊鍚庣殑璁㈠崟鍜屽簱瀛樹俊鎭�
-        return orderStock;
-    }
-
-    /// <summary>
-    /// 鍒ゆ柇璁㈠崟鏄惁瀹屾垚
-    /// </summary>
-    /// <param name="orderStock">璁㈠崟鍜屽簱瀛樹俊鎭�</param>
-    /// <returns>鏄惁瀹屾垚</returns>
-    // 鍒ゆ柇璁㈠崟鏄惁瀹屾垚
-    private bool IsOrderComplete(Dt_OutOrderAndStock orderStock)
-    {
-        // 濡傛灉鍑哄簱鏁伴噺绛変簬瀹屾垚鍑哄簱鏁伴噺锛屽垯璁㈠崟瀹屾垚
-        return orderStock.CompletedQuantity == orderStock.OutboundQuantity;
-    }
 
     /// <summary>
     /// 鍒涘缓鍘嗗彶浠诲姟璁板綍

--
Gitblit v1.9.3