From 34bafb439a438c0f4e85ef7006dac590140d155c Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期五, 01 十一月 2024 14:50:15 +0800
Subject: [PATCH] 联调程序变动

---
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs |   73 ++++++++++++++++++++++++++++++------
 1 files changed, 61 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 dd1a96c..e4f3339 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,9 @@
 锘縰sing Mapster;
+using System.Collections.Generic;
+using WIDESEA_DTO.MOM;
+using WIDESEA_DTO.WMS;
+using WIDESEA_IStoragIntegrationServices;
+using WIDESEA_StoragIntegrationServices;
 namespace WIDESEA_StorageOutTaskServices; 
 
 public class Dt_TaskService : ServiceBase<Dt_Task, IDt_TaskRepository>, IDt_TaskService
@@ -18,6 +23,8 @@
     private readonly ITaskExecuteDetailRepository _taskExecuteDetailRepository;
     private readonly ILocationStatusChangeRecordRepository _locationStatusChangeRecordRepository;
     private readonly IBoxingInfoRepository _boxingInfoRepository;
+    private readonly ICellStateService _cellStateService;
+    private readonly IProcessApplyService _processApplyService;
 
     public Dt_TaskService(IDt_TaskRepository BaseDal,
                                 IUnitOfWorkManage unitOfWorkManage,
@@ -33,7 +40,9 @@
                                 IPointStackerRelationRepository pointStackerRelationRepository,
                                 ITaskExecuteDetailRepository taskExecuteDetailRepository,
                                 ILocationStatusChangeRecordRepository locationStatusChangeRecordRepository,
-                                IBoxingInfoRepository boxingInfoRepository) : base(BaseDal)
+                                IBoxingInfoRepository boxingInfoRepository,
+                                ICellStateService cellStateService,
+                                IProcessApplyService processApplyService) : base(BaseDal)
     {
         _unitOfWorkManage = unitOfWorkManage;
         _outOrderRepository = outOrderRepository;
@@ -49,6 +58,8 @@
         _taskExecuteDetailRepository = taskExecuteDetailRepository;
         _locationStatusChangeRecordRepository = locationStatusChangeRecordRepository;
         _boxingInfoRepository = boxingInfoRepository;
+        _cellStateService = cellStateService;
+        _processApplyService = processApplyService
     }
 
     #region 澶栭儴鎺ュ彛鏂规硶
@@ -75,7 +86,7 @@
             });
 
             // 鏇存柊浠诲姟鐘舵��
-            task.TaskState = OutTaskStatusEnum.SC_OutFinish.ObjToInt();
+            task.TaskState = TaskOutStatusEnum.SC_OutFinish.ObjToInt();
             task.CurrentAddress = task.NextAddress;
             task.NextAddress = task.TargetAddress;
 
@@ -246,7 +257,7 @@
         if (task.TaskType == (int)TaskTypeEnum.Outbound)
         {
             LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "鍑哄簱浠诲姟", "");
-            if (task.TaskState == OutTaskStatusEnum.SC_OutExecuting.ObjToInt())
+            if (task.TaskState == TaskOutStatusEnum.SC_OutExecuting.ObjToInt())
             {
                 LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "鍫嗗灈鏈哄嚭搴撳畬鎴�", "");
                 return await CompleteStackTaskAsync(task, stock);
@@ -285,7 +296,31 @@
         try
         {
             // 鏍规嵁鎵樼洏鑾峰彇搴撳瓨淇℃伅
-            var stockInfo = await _stockInfoRepository.QueryFirstAsync(x => x.PalletCode == input.PalletCode);
+            //var stockInfo = await _stockInfoRepository.QueryFirstAsync(x => x.PalletCode == input.PalletCode);
+            TrayCellsStatusDto trayCells = new TrayCellsStatusDto()
+            {
+                TrayBarcode = input.PalletCode
+            };
+            content = await _cellStateService.GetTrayCellStatusAsync(trayCells);
+            if (content.Status)
+            {
+                ResultTrayCellsStatus result = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(content.Data.ToString());
+
+                ProcessApplyDto process = new ProcessApplyDto()
+                {
+                    WipOrderNo = result.BindCode,
+                    SerialNos = result.SerialNos.Select(item => new SerialNos
+                    {
+                        SerialNo = item.SerialNo
+                    }).ToList()
+                };
+                content = await _processApplyService.GetProcessApplyAsync(process);
+                if (content.Status)
+                {
+                    var X = SqlSugarHelper.Db.Queryable<Dt_EquipmentProcess>().Where(x => x.EquipmentType == "CH").ToList();
+                }
+
+            }
 
             // 鑾峰彇浠撳簱鍖哄煙淇℃伅
             var areaInfo = await _wareAreaInfoRepository.QueryFirstAsync(x => x.WareAreaCode == input.AreaCode);
@@ -505,7 +540,7 @@
     private Dt_Task_Hty CreateHistoricalTask(Dt_Task task)
     {
         // 鏇存柊浠诲姟鐘舵��
-        task.TaskState = OutTaskStatusEnum.OutFinish.ObjToInt();
+        task.TaskState = TaskOutStatusEnum.OutFinish.ObjToInt();
         task.CurrentAddress = task.NextAddress;
 
         // 鍒涘缓鍘嗗彶浠诲姟
@@ -514,7 +549,7 @@
         taskHty.TaskId = 0;
         taskHty.OperateType = (int)OperateTypeEnum.鑷姩瀹屾垚;
         taskHty.SourceId = task.TaskId;
-        taskHty.TaskState = OutTaskStatusEnum.OutFinish.ObjToInt();
+        taskHty.TaskState = TaskOutStatusEnum.OutFinish.ObjToInt();
         return taskHty;
     }
 
@@ -621,14 +656,14 @@
         {
             // 澶勭悊鍑哄簱浠诲姟
             toAddress = await GetRoadWayAsync(areaId, task.Roadway, input.Direction, input.Area, input.Type);
-            taskState = (int)OutTaskStatusEnum.SC_OutFinish;
+            taskState = (int)TaskOutStatusEnum.SC_OutFinish;
         }
         else
         {
             // 澶勭悊鍏ュ簱浠诲姟
             location = await GetLocationDistributeAsync(areaId, task.Roadway);
             toAddress = location.LocationCode;
-            taskState = (int)InTaskStatusEnum.Line_InFinish;
+            taskState = (int)TaskInStatusEnum.Line_InFinish;
             beforeStatus = location.LocationStatus;
 
             // 鏇存柊璐т綅淇℃伅
@@ -650,7 +685,7 @@
 
         // 灏濊瘯鏇存柊浠诲姟
         bool isResult = await BaseDal.UpdateDataAsync(task);
-        bool isTaskDetail = await _taskExecuteDetailRepository.AddDetailAsync(task, false, TaskDescription.GetTaskUpdateDescription(task.PalletCode, original, input.Position, InTaskStatusEnum.Line_InFinish.GetIntegralRuleTypeEnumDesc()));
+        bool isTaskDetail = await _taskExecuteDetailRepository.AddDetailAsync(task, false, TaskDescription.GetTaskUpdateDescription(task.PalletCode, original, input.Position, TaskInStatusEnum.Line_InFinish.GetIntegralRuleTypeEnumDesc()));
         if (input.Type != (int)TaskTypeEnum.Outbound)
         {
             // 鍒涘缓LocationChangeRecordDto瀵硅薄
@@ -710,7 +745,7 @@
             OrderNo = null,
             PalletCode = input.PalletCode,
             SourceAddress = input.Position,
-            TaskState = (int)InTaskStatusEnum.InNew,
+            TaskState = (int)TaskInStatusEnum.InNew,
             TaskType = (int)TaskTypeEnum.Inbound,
             TaskNum = await BaseDal.GetTaskNo(),
             Creater = "Systeam"
@@ -721,9 +756,23 @@
         if (isResult)
         {
             task.TaskId = taskId;
-            isResult = await _taskExecuteDetailRepository.AddDetailAsync(task, false, TaskDescription.GetTaskUpdateDescription(input.PalletCode, input.Position, ToAddress, InTaskStatusEnum.InNew.GetIntegralRuleTypeEnumDesc()));
+            isResult = await _taskExecuteDetailRepository.AddDetailAsync(task, false, TaskDescription.GetTaskUpdateDescription(input.PalletCode, input.Position, ToAddress, TaskInStatusEnum.InNew.GetIntegralRuleTypeEnumDesc()));
             if (isResult)
-                content.OK(data: task);
+            {
+                WMSTaskDTO taskDTO = new WMSTaskDTO()
+                {
+                    TaskNum = 0,
+                    Grade = 1,
+                    PalletCode = DateTime.Now.ToString("MMddHHmmss"),
+                    RoadWay = task.Roadway,
+                    SourceAddress = "001-001-001",
+                    TargetAddress = task.Roadway,
+                    TaskState = (int)TaskInStatusEnum.InNew,
+                    Id = 0,
+                    TaskType = (int)TaskInboundTypeEnum.Inbound,
+                };
+                content.OK(data: taskDTO);
+            }
             else
                 content.Error("娣诲姞浠诲姟澶辫触");
         }

--
Gitblit v1.9.3