From f7f1f176f931f5ad54056df7b8e8a9f028eea100 Mon Sep 17 00:00:00 2001
From: 刘磊 <1161824510@qq.com>
Date: 星期二, 17 十二月 2024 19:50:38 +0800
Subject: [PATCH] 合并

---
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs |   32 +++++++++++++++++++++++++-------
 1 files changed, 25 insertions(+), 7 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 1a90a5c..edccca3 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
@@ -180,17 +180,19 @@
                 var tokenInfos = _cacheService.Get<List<UserInfo>>("Cache_UserToken");
                 if (tokenInfos == null || !tokenInfos.Any())
                 {
-                    throw new Exception(conveyorLine.DeviceName + "缂撳瓨涓湭鎵惧埌Token缂撳瓨");
+                    //throw new Exception(conveyorLine.DeviceName + "缂撳瓨涓湭鎵惧埌Token缂撳瓨");
+                    return;
                 }
                 var userTokenIds = tokenInfos?.Select(x => x.Token_ID).ToList();
                 var userIds = tokenInfos?.Select(x => x.UserId).ToList();
 
                 object obj = new
                 {
+                    childDeviceCode,
                     command,
                     commandWrite
                 };
-                _noticeService.StackerData(userIds?.FirstOrDefault(), userTokenIds, new { conveyorLine.DeviceName, data = obj });
+                _noticeService.LineData(userIds?.FirstOrDefault(), userTokenIds, new { conveyorLine.DeviceName, data = obj });
 
                 #endregion 璋冪敤浜嬩欢鎬荤嚎閫氱煡鍓嶇
             }
@@ -270,9 +272,25 @@
                 ConsoleHelper.WriteWarningLine($"銆恵conveyorLine._deviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣緭閫佺嚎鍏ュ簱瀹屾垚,涓嬩竴鐩爣鍦板潃銆愮瓑寰呭垎閰嶈揣浣嶃��");
                 ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
 
-                WebResponseContent content = _taskService.UpdateTaskStatusToNext(task);
+                if (task.TaskType == (int)TaskInboundTypeEnum.InNG)
+                {
+                    int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskInStatusEnum>();
 
-                Console.Out.WriteLine(content.Serialize());
+                    var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.SourceAddress);
+                    task.CurrentAddress = station.stationLocation;
+                    task.NextAddress = station.stationNGLocation;
+                    task.TargetAddress = task.NextAddress;
+                    task.TaskState = nextStatus; 
+                    task.ModifyDate = DateTime.Now;
+                    task.Modifier = "System";
+                    _taskRepository.UpdateData(task);
+                }
+                else
+                {
+                    WebResponseContent content = _taskService.UpdateTaskStatusToNext(task);
+                    Console.Out.WriteLine(content.ToJsonString());
+                }
+
             }
         }
 
@@ -416,7 +434,7 @@
                     taskOutboundTypeEnum = TaskOutboundTypeEnum.OutTray;
                 else
                     taskOutboundTypeEnum = TaskOutboundTypeEnum.Outbound;
-                await CheckAndCreateTask(taskOutboundTypeEnum, childDeviceCode, index, platform.Stacker);
+                await CheckAndCreateTask(taskOutboundTypeEnum, childDeviceCode, index, platform.Stacker, platform);
             }
             catch (Exception)
             {
@@ -426,7 +444,7 @@
         /// <summary>
         /// 妫�鏌ヤ换鍔″苟鍒涘缓鏂颁换鍔�
         /// </summary>
-        private async Task CheckAndCreateTask(TaskOutboundTypeEnum taskType, string childDeviceCode, int index, string roadWay, List<string> roadways = null)
+        private async Task CheckAndCreateTask(TaskOutboundTypeEnum taskType, string childDeviceCode, int index, string roadWay, Platform platform)
         {
             var tasks = _taskRepository.QueryData(x => x.TaskType == (int)taskType && x.TargetAddress == childDeviceCode);
             if (tasks.Count < index)
@@ -447,7 +465,7 @@
                 var wmsIpAddress = wmsBase + requestTrayOutTask;
 
 
-                var result = await HttpHelper.PostAsync(wmsIpAddress, new { position = childDeviceCode, tag = (int)taskType, areaCdoe = roadWay, roadways = roadways }.ToJsonString());
+                var result = await HttpHelper.PostAsync(wmsIpAddress, new { position = childDeviceCode, tag = (int)taskType, areaCdoe = roadWay, platform.ProductionLine }.ToJsonString());
                 //var result = await HttpHelper.PostAsync("http://localhost:5000/api/Task/RequestTrayOutTaskAsync", dynamic.ToJsonString());
 
                 WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result);

--
Gitblit v1.9.3