From c827fe7b0c5b3b444d76ba0d96a2649c764630dd Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期四, 14 十一月 2024 16:36:08 +0800
Subject: [PATCH] 修改WCS、WMS出入库逻辑

---
 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs |   68 +++++++++++++++++++---------------
 1 files changed, 38 insertions(+), 30 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs"
index 3ea01ce..d3776e2 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs"
@@ -66,29 +66,36 @@
                     List<Task> tasks = new List<Task>();
                     foreach (string childDeviceCode in childDeviceCodes)
                     {
-                        ConveyorLineTaskCommandR command = conveyorLine.ReadCustomer<ConveyorLineTaskCommandR>(childDeviceCode);
-                        if (command != null && command.Status == (ushort)ConveyorStatus.Stored)//娣诲姞杈撻�佺嚎鐘舵�丆onveyorLineStatus enum
+                        try
                         {
-                            switch (childDeviceCode)
+                            ConveyorLineTaskCommandR command = conveyorLine.ReadCustomer<ConveyorLineTaskCommandR>(childDeviceCode);
+                            if (command != null && command.Status == (ushort)ConveyorStatus.Stored)//娣诲姞杈撻�佺嚎鐘舵�丆onveyorLineStatus enum
                             {
-                                case "102":
-                                    RequestInbound(conveyorLine, command, childDeviceCode);
-                                    break;
-                                case "104":
-                                    ConveyorLineInFinish(conveyorLine, command, childDeviceCode);
-                                    break;
-                                //case "105":
-                                //    RequestOutbound(conveyorLine, command, childDeviceCode);
-                                //    break;
-                                case "108":
-                                    ConveyorLineOutFinish(conveyorLine, command, childDeviceCode);
-                                    break;
-                                    //default:
-                                    //    RequestInNextAddress(conveyorLine, command, childDeviceCode);
-                                    //    RequestOutNextAddress(conveyorLine, command, childDeviceCode);
+                                switch (childDeviceCode)
+                                {
+                                    case "102":
+                                        RequestInbound(conveyorLine, command, childDeviceCode);
+                                        break;
+                                    case "104":
+                                        ConveyorLineInFinish(conveyorLine, command, childDeviceCode);
+                                        break;
+                                    //case "105":
+                                    //    RequestOutbound(conveyorLine, command, childDeviceCode);
                                     //    break;
+                                    case "108":
+                                        ConveyorLineOutFinish(conveyorLine, command, childDeviceCode);
+                                        break;
+                                        //default:
+                                        //    RequestInNextAddress(conveyorLine, command, childDeviceCode);
+                                        //    RequestOutNextAddress(conveyorLine, command, childDeviceCode);
+                                        //    break;
+                                }
                             }
                         }
+                        catch (Exception ex)
+                        {
+                            continue;
+                        } 
                     }
                     Task.WaitAll(tasks.ToArray());
                 }
@@ -117,7 +124,7 @@
             {
                 ConveyorLineDTO lineDTO = new ConveyorLineDTO()
                 {
-                    //TaskNum = task.TaskNum,
+                    TaskNum = task.TaskNum,
                     stationCode = childDeviceCode,
                     Barcode = command.Barcode,
                     Spec = command.Spec,
@@ -127,8 +134,9 @@
 
                 if (content.Status)
                 {
-                    task.TargetAddress = AppSettings.Configuration["OKAddress"];
-                    task.NextAddress = task.TargetAddress;
+                    task.CurrentAddress = childDeviceCode;
+                    task.NextAddress = AppSettings.Configuration["OKAddress"];
+                    task.ExceptionMessage = null;
                     ConveyorLineTaskCommandW taskCommand = _mapper.Map<ConveyorLineTaskCommandW>(task);
 
                     if (conveyorLine.SendCommand(taskCommand, childDeviceCode))
@@ -136,15 +144,15 @@
                 }
                 else
                 {
-                    if (content.Code == 404)//淇敼缁堢偣鍦板潃
-                    {
-                        task.TargetAddress = AppSettings.Configuration["NGAddress"];
-                        task.NextAddress = task.TargetAddress;
-                        task.ExceptionMessage = content.Message;
-                        task.TaskState = (int)TaskInStatusEnum.InException;
-                        ConveyorLineTaskCommandW taskCommand = _mapper.Map<ConveyorLineTaskCommandW>(task);
-                        if (conveyorLine.SendCommand(taskCommand, childDeviceCode)) _taskService.UpdateData(task);
-                    }
+                    //if (content.Code == 404)//淇敼缁堢偣鍦板潃
+                    //{
+                    task.CurrentAddress = childDeviceCode;
+                    task.NextAddress = AppSettings.Configuration["NGAddress"];
+                    task.ExceptionMessage = content.Message;
+                    task.TaskState = (int)TaskInStatusEnum.InException;
+                    ConveyorLineTaskCommandW taskCommand = _mapper.Map<ConveyorLineTaskCommandW>(task);
+                    if (conveyorLine.SendCommand(taskCommand, childDeviceCode)) _taskService.UpdateData(task);
+                    //}
                 }
             }
         }

--
Gitblit v1.9.3