From 84b36c79f37d9d3abad3bba4ff7ea99b2cc17942 Mon Sep 17 00:00:00 2001
From: 肖洋 <cathay_xy@163.com>
Date: 星期三, 18 十二月 2024 23:19:51 +0800
Subject: [PATCH] 合并

---
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs |  121 ++++++++++++++++++++++++++++++----------
 1 files changed, 90 insertions(+), 31 deletions(-)

diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs
index 08c60dc..268d844 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs
@@ -1,4 +1,5 @@
-锘縰sing Masuit.Tools;
+锘縰sing log4net.Core;
+using Masuit.Tools;
 using WIDESEA_Core.Const;
 using WIDESEA_DTO.MOM;
 using WIDESEA_DTO.WMS;
@@ -365,6 +366,7 @@
 
     #region 搴撲綅鍒嗛厤
 
+    #region 鑾峰彇璐т綅
     /// <summary>
     ///
     /// </summary>
@@ -373,8 +375,6 @@
     /// <returns></returns>
     private async Task<DtLocationInfo> RequestLocation(RequestTaskDto requestTask, bool isCheckRequest = false)
     {
-        #region 鑾峰彇璐т綅
-
         try
         {
             List<DtLocationInfo> locations;
@@ -400,8 +400,9 @@
             return null;
         }
 
-        #endregion 鑾峰彇璐т綅
     }
+    #endregion 鑾峰彇璐т綅
+
 
     #endregion 搴撲綅鍒嗛厤
 
@@ -493,19 +494,63 @@
     {
         try
         {
+            if (stationManager.stationType == 15) throw new Exception("");
+
             // 鍒涘缓涓�涓猅rayCellsStatusDto瀵硅薄锛屽苟璧嬪��
             TrayCellsStatusDto trayCells = new TrayCellsStatusDto()
             {
                 Software = "WMS",
                 TrayBarcode = input.PalletCode,
                 //EquipmentCode = "EQ_CWJZ01"
-                EquipmentCode = input.EquiCodeMOM
+                EquipmentCode = input.EquiCodeMOM,
+                SceneType = "1",
             };
 
             // 璋冪敤GetTrayCellStatusAsync鏂规硶锛岃幏鍙栨暣鐩樼數鑺�
             WebResponseContent content = await GetTrayCellStatusAsync(trayCells);
             // 濡傛灉鐘舵�佷负false锛屽垯杩斿洖content
-            if (!content.Status) throw new Exception(content.Message);
+            if (!content.Status)  //鍏堢敤瀹炴姝e父鑾峰彇鏁寸洏鐢佃姱鏁版嵁锛� 濡傚紓甯� 鍦ㄦ浣跨敤绌烘绫诲瀷鍐嶆鑾峰彇 鍐嶆湁寮傚父鍒欐姏鍑�
+            {
+
+                TrayCellsStatusDto trayCells_Empty = new TrayCellsStatusDto()
+                {
+                    Software = "WMS",
+                    TrayBarcode = input.PalletCode,
+                    //EquipmentCode = "EQ_CWJZ01"
+                    EquipmentCode = input.EquiCodeMOM,
+                    SceneType = "4"
+                };
+                content = await GetTrayCellStatusAsync(trayCells);
+
+                if (!content.Status) throw new Exception(content.Message);
+
+                if (content.Status)   //褰撳仛绌烘鍏ュ簱
+                {
+                    DtLocationInfo EmptylocationInfo = await RequestLocation(input);
+
+                    if (EmptylocationInfo == null) throw new Exception("搴撲綅宸叉弧");
+
+                    var Epmtytask = new Dt_Task
+                    {
+                        CurrentAddress = input.Position,
+                        Grade = 3,  //浼樺厛澶勭悊寮傚父鎺掑嚭鍙g殑浠诲姟 闃叉姝e父闇�鎺掑嚭寮傚父鍙g殑浠诲姟鍫电嚎
+                        Roadway = input.Roadways,
+                        TargetAddress = EmptylocationInfo.LocationCode,
+                        Dispatchertime = DateTime.Now,
+                        MaterialNo = "",
+                        NextAddress = input.Roadways,
+                        OrderNo = null,
+                        PalletCode = input.PalletCode,
+                        SourceAddress = stationManager.stationLocation,
+                        TaskState = (int)TaskInStatusEnum.Line_InFinish,
+                        TaskType = (int)TaskInboundTypeEnum.Inbound,
+                        TaskNum = await BaseDal.GetTaskNo(),
+                        Creater = "Systeam"
+                    };
+
+                    return Epmtytask;
+                }
+            }
 
             // 娣诲姞缁勭洏淇℃伅
             // 灏哻ontent.Data杞崲涓篟esultTrayCellsStatus瀵硅薄
@@ -513,24 +558,25 @@
             if (result.SerialNos.Count <= 0)
             {
                 ConsoleHelper.WriteErrorLine(result.MOMMessage);
-                var taskNG = new Dt_Task
-                {
-                    CurrentAddress = input.Position,
-                    Grade = 1,
-                    Roadway = input.Roadways,
-                    TargetAddress = stationManager.stationNGLocation,
-                    Dispatchertime = DateTime.Now,
-                    MaterialNo = "",
-                    NextAddress = stationManager.stationNGChildCode,
-                    OrderNo = null,
-                    PalletCode = input.PalletCode,
-                    SourceAddress = stationManager.stationLocation,
-                    TaskState = (int)TaskInStatusEnum.Line_InFinish,
-                    TaskType = (int)TaskOutboundTypeEnum.InToOut,
-                    TaskNum = await BaseDal.GetTaskNo(),
-                    Creater = "Systeam"
-                };
-                return taskNG;
+                throw new Exception("鏃犵數鑺暟鎹�");
+                //var taskNG = new Dt_Task
+                //{
+                //    CurrentAddress = input.Position,
+                //    Grade = 1,
+                //    Roadway = input.Roadways,
+                //    TargetAddress = stationManager.stationNGLocation,
+                //    Dispatchertime = DateTime.Now,
+                //    MaterialNo = "",
+                //    NextAddress = stationManager.stationNGChildCode,
+                //    OrderNo = null,
+                //    PalletCode = input.PalletCode,
+                //    SourceAddress = stationManager.stationLocation,
+                //    TaskState = (int)TaskInStatusEnum.Line_InFinish,
+                //    TaskType = (int)TaskOutboundTypeEnum.InToOut,
+                //    TaskNum = await BaseDal.GetTaskNo(),
+                //    Creater = "Systeam"
+                //};
+                //return taskNG;
             }
 
             //Console.WriteLine(result);
@@ -559,20 +605,33 @@
             ////var processResponse = await GetProcessResponseAsync(process, input.Position);
             var isBox = await _boxingInfoRepository.AddDataNavAsync(boxing);
 
+            DtLocationInfo locationInfo = null;
+            if (stationManager.Roadway.Contains("FR"))
+            {
+                locationInfo = await RequestLocation(input, true);
+            }
+            else
+            {
+                locationInfo = await RequestLocation(input);
+            }
+            //DtLocationInfo locationInfo = await RequestLocation(input);
+
+            if (locationInfo == null) throw new Exception("搴撲綅宸叉弧");
+
             var task = new Dt_Task
             {
                 CurrentAddress = input.Position,
-                Grade = 1,
+                Grade = 3,  //浼樺厛澶勭悊寮傚父鎺掑嚭鍙g殑浠诲姟 闃叉姝e父闇�鎺掑嚭寮傚父鍙g殑浠诲姟鍫电嚎
                 Roadway = input.Roadways,
-                TargetAddress = stationManager.stationLocation,
+                TargetAddress = locationInfo.LocationCode,
                 Dispatchertime = DateTime.Now,
                 MaterialNo = "",
                 NextAddress = input.Roadways,
                 OrderNo = null,
-                //PalletCode = stockinfo.PalletCode,
-                //SourceAddress = stockinfo.LocationCode,
-                TaskState = (int)TaskOutStatusEnum.OutNew,
-                TaskType = (int)TaskOutboundTypeEnum.OutTray,
+                PalletCode = input.PalletCode,
+                SourceAddress = stationManager.stationLocation,
+                TaskState = (int)TaskInStatusEnum.Line_InFinish,
+                TaskType = (int)TaskInboundTypeEnum.Inbound,
                 TaskNum = await BaseDal.GetTaskNo(),
                 Creater = "Systeam"
             };
@@ -767,7 +826,7 @@
         {
             Dt_StationManager station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == json.Position);
 
-            DtStockInfo stockInfo = _stockInfoRepository.QueryFirst(X => X.IsFull && X.AreaCode == "CWSC3" && X.ProductionLine == "ZJ-7");
+            DtStockInfo stockInfo = _stockInfoRepository.QueryFirst(X => X.IsFull && X.AreaCode == "CWSC3" && X.ProductionLine == station.productLine);
             if (stockInfo == null) throw new Exception("搴撳唴鏃犳弧瓒虫潯浠剁殑搴撳瓨鍙嚭搴�");
 
             Dt_StationManager OutStation = _stationManagerRepository.QueryFirst(x => x.stationPLC == "1016" && x.stationType == 10);

--
Gitblit v1.9.3