From b5fe109b08ce6e1e78696bb7cf41f415dc6a4587 Mon Sep 17 00:00:00 2001
From: 肖洋 <cathay_xy@163.com>
Date: 星期四, 05 十二月 2024 13:33:35 +0800
Subject: [PATCH] 添加任务历史

---
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs |   54 ++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 42 insertions(+), 12 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 d6fe226..3caf61c 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,4 +1,5 @@
 锘�
+using AngleSharp.Io;
 using Mapster;
 using Masuit.Tools;
 using WIDESEA_Core.Const;
@@ -88,7 +89,7 @@
                     content = await _agingInOrOutInputService.GetOCVOutputAsync(agingOutputDto);
                     //ValidateResponse(content);
                     var result = JsonConvert.DeserializeObject<BasicResult>(content.Data.ToString());
-                    if (!result.Success)
+                    if (!result.Success || !agingOutputDto.SerialNos[0].SerialNoResult)
                     {
                         task.Remark = "NG";
                     }
@@ -104,8 +105,8 @@
                 await UpdateLocationAsync(loc);
                 await DeleteStockInfoAsync(stock.Id);
                 await DeleteStockInfoDetailsAsync(stock.StockInfoDetails);
-                if (task.Roadway.Contains("FR") || task.Roadway.Contains("GW"))   //濡傛灉鏄垎瀹规垨楂樻俯鍑哄簱 灏嗕换鍔″垹闄�
-                    await DeleteTaskAsync(task.TaskId);
+                //if (task.Roadway.Contains("FR") || task.Roadway.Contains("GW") || task.TaskType == (int)TaskOutboundTypeEnum.OutTray)   //濡傛灉鏄垎瀹规垨楂樻俯鍑哄簱 灏嗕换鍔″垹闄�
+                await DeleteTaskAsync(task.TaskId);
             });
 
             return content.OK("浠诲姟瀹屾垚鎴愬姛", task.Remark);
@@ -154,7 +155,7 @@
             {
                 SlotNo = x.OrderNo.ToInt32(),
                 SerialNo = x.SerialNumber,
-                SerialNoResult = true,
+                SerialNoResult = isNG,
                 ParameterInfo = new List<ParameterInfoOutput> {
                     new ParameterInfoOutput() {
                         Value = outHours.ToString(),
@@ -397,13 +398,22 @@
             throw new Exception("鏈壘鍒板搴斾綅缃俊鎭�");
 
         var area = new Dt_AreaInfo();
-        var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.SourceAddress);
-        if (station.stationPLC == "1017")
-            area = _areaInfoRepository.QueryFirst(x => x.AreaID == Convert.ToInt32(station.stationNGLocation));
-        else
+        if (task.Roadway.Contains("FR"))
+        {
             area = _areaInfoRepository.QueryFirst(x => x.AreaID == loation.AreaId);
-        if (area == null)
-            throw new Exception("鏈壘鍒板搴斿尯鍩熶俊鎭�");
+        }
+        else
+        {
+            var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.SourceAddress);
+            if (station.stationPLC == "1017")
+                area = _areaInfoRepository.QueryFirst(x => x.AreaID == Convert.ToInt32(station.stationNGLocation));
+            else
+                area = _areaInfoRepository.QueryFirst(x => x.AreaID == loation.AreaId);
+            if (area == null)
+                throw new Exception("鏈壘鍒板搴斿尯鍩熶俊鎭�");
+        }
+
+
         var boxDetail = boxing.BoxingInfoDetails.Adapt<List<DtStockInfoDetail>>();
         boxDetail.ForEach(x => { x.Status = (int)StockStateEmun.宸插叆搴�; });
         var stock = new DtStockInfo()
@@ -429,6 +439,7 @@
             EquipmentCode = area.Spare2,
             Software = area.Spare3
         };
+
         var result = _agingInOrOutInputService.GetOCVInputAsync(agingInputDto).Result;
         var respone = JsonConvert.DeserializeObject<ResponeAgingInputDto>(result.Data.ToString());
         stock.LinedProcessFeedbackTime = respone.LinedProcessFeedbackTime;
@@ -482,11 +493,13 @@
         {
             case (int)TaskInboundTypeEnum.Inbound:
             case (int)TaskInboundTypeEnum.InTray:
+            case (int)TaskInboundTypeEnum.InNG:
                 LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "鍏ュ簱浠诲姟", "");
                 return await CompleteInboundTaskAsync(task);
 
             case (int)TaskOutboundTypeEnum.OutTray:
             case (int)TaskOutboundTypeEnum.Outbound:
+            case (int)TaskOutboundTypeEnum.OutNG:
                 LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "鍑哄簱浠诲姟", "");
                 return await CompleteStackTaskAsync(task, stock);
 
@@ -780,7 +793,7 @@
             if (result.SerialNos.Count <= 0)
             {
                 // 绌烘墭鐩樺叆搴撻�昏緫
-                return await RequestTrayInTaskAsync(input);     
+                return await RequestTrayInTaskAsync(input);
             }
 
             var boxing = CreateBoxingInfo(result, input.PalletCode);
@@ -1365,6 +1378,18 @@
 
             }
 
+            var stocks = _stockInfoRepository.QueryData(x => x.AreaCode == stock.AreaCode && x.ProductionLine == stock.ProductionLine && x.SpecialParameterDuration != stock.SpecialParameterDuration);
+            if (stocks != null && stocks.Count > 0)
+            {
+                foreach (var item in stocks)
+                {
+                    item.SpecialParameterDuration = stock.SpecialParameterDuration;
+                    item.ParameterInfos = stock.ParameterInfos;
+                    item.OutboundTime = Convert.ToDateTime(item.LinedProcessFeedbackTime == null ? item.CreateDate : item.LinedProcessFeedbackTime).AddHours(Convert.ToDouble(stock.SpecialParameterDuration));
+                }
+                var isUpdates = await _stockInfoRepository.UpdateDataAsync(stocks);
+            }
+
             // 娣诲姞鍘嗗彶浠诲姟
             var isTaskHtyAdd = await _task_HtyRepository.AddDataAsync(taskHty) > 0;
 
@@ -1538,6 +1563,11 @@
         {
             task.TaskId = taskId;
             isResult = await _taskExecuteDetailRepository.AddDetailAsync(task, false, TaskDescription.GetTaskUpdateDescription(input.PalletCode, input.Position, ToAddress, TaskInStatusEnum.InNew.GetIntegralRuleTypeEnumDesc()));
+
+            //var location = _locationRepository.QueryFirst(x => x.RoadwayNo == task.Roadway && x.LocationCode == task.TargetAddress);
+            //location.LocationStatus = (int)LocationEnum.Lock;
+            //var isLocation = _locationRepository.UpdateData(location);
+
             if (isResult)
             {
                 // 鍒涘缓WMS浠诲姟
@@ -1612,7 +1642,7 @@
              .OrderByDescending(g => g.Count()) // 鏍规嵁姣忎釜缁勭殑鍏冪礌鏁伴噺鎺掑簭
              .ToList(); // 鍙栧嚭鏁伴噺鏈�澶氱殑缁�
 
-        Dictionary<string,int> result = new Dictionary<string,int>();
+        Dictionary<string, int> result = new Dictionary<string, int>();
         foreach (var item in minGroup)
         {
             var number = BaseDal.QueryData(x => x.TargetAddress == item.Key).Count();

--
Gitblit v1.9.3