From 68dbe298a5c67d8755cb4379e5106de7c54608c6 Mon Sep 17 00:00:00 2001
From: 肖洋 <cathay_xy@163.com>
Date: 星期三, 11 十二月 2024 14:39:03 +0800
Subject: [PATCH] 添加childDeviceCode至多个任务类,优化代码逻辑

---
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs             |    1 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs |    3 +
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/WIDESEA_Core.csproj                                      |    4 +-
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs            |   78 +++------------------------------------
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs             |   11 ++---
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs       |    3 +
 6 files changed, 18 insertions(+), 82 deletions(-)

diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
index ade5a33..c1b02d2 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
@@ -188,6 +188,7 @@
 
                 object obj = new
                 {
+                    childDeviceCode,
                     command,
                     commandWrite
                 };
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs
index 368e323..bd8efa5 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs
@@ -115,6 +115,7 @@
 
                         object obj = new
                         {
+                            childDeviceCode = station.stationChildCode,
                             commandAfter = command,
                         };
                         _noticeService.StackerData(userIds?.FirstOrDefault(), userTokenIds, new { conveyorLine.DeviceName, data = obj });
@@ -266,7 +267,7 @@
 
             var result = await HttpHelper.PostAsync(wmsIpAddrss, new { palletCode = "", EquiCodeMOM = stationManager.stationEquipMOM, Roadways = stationManager.Roadway, area = stationManager.stationArea, Position = stationManager.stationChildCode }.ToJsonString());
             WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result);
-            if(!content.Status)
+            if (!content.Status)
             {
                 //ConsoleHelper.WriteErrorLine($"鍒嗗鍛煎彨绌烘墭鐩樺け璐content.Message}");
                 return;
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs
index 530f02e..7d03d72 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs
@@ -178,6 +178,7 @@
 
                         object obj = new
                         {
+                            childDeviceCode,
                             commandAfter = command,
                         };
                         _noticeService.StackerData(userIds?.FirstOrDefault(), userTokenIds, new { conveyorLine.DeviceName, data = obj });
@@ -216,7 +217,7 @@
                 var task = _taskService.QueryBarCodeConveyorLineTask(command.ConveyorLineBarcode, childDeviceCode);
                 //HandleTaskOut(conveyorLine, command, childDeviceCode, task);
                 // && command.ConveyorLineBarcode != "NoRead" && !command.ConveyorLineBarcode.IsNotEmptyOrNull()
-
+                ConsoleHelper.WriteSuccessLine($"銆恵conveyorLine.DeviceName}銆戞墭鐩樺彿锛氥�恵command.ConveyorLineBarcode}銆戣澶囩紪鐮侊細銆恵childDeviceCode}銆�");
                 if (task == null)
                 {
                     HandleNewTask(conveyorLine, command, childDeviceCode);
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
index 6d678cd..c867fad 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
@@ -142,10 +142,9 @@
                 {
                     //Console.Out.WriteLine("TaskCompleted" + e.TaskNum);
                     ConsoleHelper.WriteColorLine($"銆恵commonStackerCrane.DeviceName}銆戜换鍔″畬鎴�,浠诲姟鍙凤細銆恵e.TaskNum}銆�", ConsoleColor.Blue);
-                    if (commonStackerCrane.DeviceCode.Contains("GW"))
+                    var task = _taskRepository.QueryFirst(x => x.TaskNum == e.TaskNum);
+                    if (commonStackerCrane.DeviceCode.Contains("GW") && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
                     {
-                        var task = _taskRepository.QueryFirst(x => x.TaskNum == e.TaskNum);
-
                         var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.TargetAddress);
 
                         IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == station.stationPLC);
@@ -156,7 +155,7 @@
                             if (!isResult)
                             {
                                 var result = conveyorLine.GetValue<ConveyorLineDBName_After, string>(ConveyorLineDBName_After.ConveyorLineBarcode, task.TargetAddress);
-                                if(result!= task.PalletCode)
+                                if (result != task.PalletCode)
                                 {
                                     conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineBarcode, task.PalletCode, task.TargetAddress);
                                 }
@@ -255,7 +254,7 @@
                         }
                         else
                         {
-                            _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鏈壘鍒板嚭搴撶珯鍙般�恵task.TargetAddress}銆戝搴旂殑閫氳瀵硅薄锛屾棤娉曞垽鏂嚭搴撶珯鍙版槸鍚﹁鍗犵敤");
+                            _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鏈壘鍒板嚭搴撶珯鍙般�恵task.NextAddress}銆戝搴旂殑閫氳瀵硅薄锛屾棤娉曞垽鏂嚭搴撶珯鍙版槸鍚﹁鍗犵敤");
                         }
                     }
                 }
@@ -278,7 +277,7 @@
                             _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鏈壘鍒板嚭搴撶珯鍙般�恵task.TargetAddress}銆戝搴旂殑閫氳瀵硅薄锛屾棤娉曞垽鏂嚭搴撶珯鍙版槸鍚﹁鍗犵敤");
                         }
                     }
-                    _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鏈壘鍒扮珯鍙般�恵task.NextAddress}銆戜俊鎭紝鏃犳硶鏍¢獙绔欏彴");
+                    _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鏈壘鍒扮珯鍙般�恵task.TargetAddress}銆戜俊鎭紝鏃犳硶鏍¢獙绔欏彴");
                 }
             }
             else
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/WIDESEA_Core.csproj b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/WIDESEA_Core.csproj
index fbebee4..ebc0ae3 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/WIDESEA_Core.csproj
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/WIDESEA_Core.csproj
@@ -16,8 +16,8 @@
     <PackageReference Include="AutoMapper" Version="13.0.1" />
     <PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="4.9.5.8" />
     <PackageReference Include="log4net" Version="2.0.17" />
-    <PackageReference Include="Magicodes.IE.EPPlus" Version="2.7.5.1" />
-    <PackageReference Include="Magicodes.IE.Excel" Version="2.7.5.1" />
+    <PackageReference Include="Magicodes.IE.EPPlus" Version="2.7.5.2" />
+    <PackageReference Include="Magicodes.IE.Excel" Version="2.7.5.2" />
     <PackageReference Include="MailKit" Version="4.7.1.1" />
     <PackageReference Include="Masuit.Tools.Core" Version="2024.5.6" />
     <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.29" />
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 c4046ca..c50b4d1 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
@@ -391,61 +391,9 @@
                 }
             }
 
-            //if (input.area != 3)
-            //{
-            //    if (input.PalletCode == null || input.PalletCode.Trim() == "")
-            //        return content.Error("鎵樼洏鏉$爜涓虹┖");
-            //}
-            //鍒涘缓涓�涓猅rayCellsStatusDto瀵硅薄锛屽苟璧嬪��
-            //TrayCellsStatusDto trayCells = new TrayCellsStatusDto()
-            //{
-            //    Software = "WMS",
-            //    TrayBarcode = input.PalletCode,
-            //    //EquipmentCode = "EQ_CWJZ01"
-            //    EquipmentCode = input.EquiCodeMOM
-            //};
-
-            // 璋冪敤GetTrayCellStatusAsync鏂规硶锛岃幏鍙栨暣鐩樼數鑺�
-            //content = await GetTrayCellStatusAsync(trayCells);
-            // 濡傛灉鐘舵�佷负false锛屽垯杩斿洖content
-            //if (!content.Status) return content;
-
-            // 娣诲姞缁勭洏淇℃伅
-            // 灏哻ontent.Data杞崲涓篟esultTrayCellsStatus瀵硅薄
-            //var result = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(content.Data.ToString());
-            //if (result.SerialNos.Count <= 0)
-            //    return content.Error(result.MOMMessage);
-
-            //Console.WriteLine(result);
-            //// TODO 鑾峰彇鏈湴鏂欐灞炴�т笌鏁寸洏鐢佃姱灞炴�ц幏鍙栫殑鍊艰繘琛屽姣旓紝濡傛灉涓�鑷村垯缁х画锛屽惁鍒欒繑鍥為敊璇俊鎭�
-            ////var productions = await _productionRepository.QueryDataAsync(x => result.TrayBarcodePropertys.Select(x => x.TrayBarcodeProperty).ToList().Contains(x.TrayBarcodeProperty));
-            ////if (productions.Count <= 0)
-            ////    return content.Error("鏂欐灞炴�т笉瀛樺湪");
-
-            //// 璋冪敤CreateBoxingInfo鏂规硶锛屽垱寤虹粍鐩樹俊鎭�
-            //var boxing = CreateBoxingInfo(result, input.PalletCode);
-            //if (boxing == null) return content.Error("缁勭洏澶辫触");
-
-            //// 璋冪敤GetProcessApplyAsync鏂规硶锛岃幏鍙栧伐鑹鸿矾绾�
-            //ProcessApplyDto process = await GetProcessApplyAsync(input, result);
-
-            //// 濡傛灉process涓簄ull锛屽垯杩斿洖content
-            //if (process == null) return content;
-
-            //// 璋冪敤_processApplyService.GetProcessApplyAsync鏂规硶锛岃幏鍙栧伐鑹虹敵璇�
-            //content = await _processApplyService.GetProcessApplyAsync(process);
-
-            //// 濡傛灉鐘舵�佷负false锛屽垯杩斿洖null
-            //if (!content.Status) return content.Error("宸ヨ壓鐢宠澶辫触");
-
-            ////// 璋冪敤GetProcessResponseAsync鏂规硶锛岃幏鍙栧伐鑹哄搷搴�
-            ////var processResponse = await GetProcessResponseAsync(process, input.Position);
+            
             // 璋冪敤CreateNewTask鏂规硶锛屽垱寤烘柊浠诲姟
             content = await CreateNewTask(input);
-            //if (content.Status)
-            //{
-            //    var isBox = await _boxingInfoRepository.AddDataNavAsync(boxing);
-            //}
         }
         catch (Exception err)
         {
@@ -482,26 +430,8 @@
         }
         var task = await CreateNewTaskByStation(input, stationinfo);
 
-        // 鍒涘缓鏂颁换鍔″疄渚�
-        //var task = new Dt_Task
-        //{
-        //    CurrentAddress = input.Position,
-        //    Grade = 1,
-        //    Roadway = input.Roadways,
-        //    TargetAddress = locationInfo.LocationCode,
-        //    Dispatchertime = DateTime.Now,
-        //    MaterialNo = "",
-        //    NextAddress = input.Roadways,
-        //    OrderNo = null,
-        //    PalletCode = input.PalletCode,
-        //    SourceAddress = stationinfo.stationLocation,
-        //    TaskState = (int)TaskInStatusEnum.Line_InFinish,
-        //    TaskType = (int)TaskInboundTypeEnum.Inbound,
-        //    TaskNum = await BaseDal.GetTaskNo(),
-        //    Creater = "Systeam"
-        //};
-
         // 灏濊瘯娣诲姞鏂颁换鍔�
+        if (task == null) return content.Error() ;
         var taskId = await BaseDal.AddDataAsync(task);
         bool isResult = taskId > 0;
         if (isResult)
@@ -605,6 +535,10 @@
                 };
                 return taskNG;
             }
+            else
+            {
+                return null;
+            }
         }
 
         // 澶勭悊寮傚父鐢佃姱鎯呭喌

--
Gitblit v1.9.3