From 970d9c5c36d526a587138232ae9dae719dbcd16d Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期一, 14 四月 2025 16:43:16 +0800
Subject: [PATCH] WCS添加获取设备信息

---
 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/ConveyorLineExtend/ConveyorLineExtend.cs |   50 +++++++++++++++++++++-----------------------------
 1 files changed, 21 insertions(+), 29 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/ConveyorLineExtend/ConveyorLineExtend.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/ConveyorLineExtend/ConveyorLineExtend.cs"
index 1ee935b..f6d095f 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/ConveyorLineExtend/ConveyorLineExtend.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/ConveyorLineExtend/ConveyorLineExtend.cs"
@@ -32,6 +32,7 @@
                 try
                 {
                     ConveyorLineTaskCommandR command = conveyorLine.ReadCustomer<ConveyorLineTaskCommandR>(childDeviceCode);
+                    _cacheService.AddOrUpdate(childDeviceCode, command);
                     if (command != null)
                     {
                         if (childDeviceCode == "1002" && command.Status == (ushort)ConveyorStatus.Wait)
@@ -44,36 +45,26 @@
                         }
                         else if (childDeviceCode == "1008" && command.Status == (ushort)ConveyorStatus.Stored)
                         {
-                            ConveyorLineOutFinish(conveyorLine, command, childDeviceCode);
+                            Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
+                            if (task != null)
+                            {
+                                List<Dt_Router> routers = _routerRepository.QueryData(x => x.StartPosi == task.NextAddress && x.ChildPosiDeviceCode == "AGV" && x.Remark == "鏈崰鐢�");
+                                if (routers != null && routers.Count > 0)
+                                {
+                                    var router = routers.FirstOrDefault();
+                                    if (router != null)
+                                    {
+                                        task.TaskState = TaskOutStatusEnum.Line_OutFinish.ObjToInt();
+                                        task.CurrentAddress = childDeviceCode;
+                                        task.NextAddress = router.NextPosi;
+                                        router.Remark = "鍗犵敤";
+                                        _routerRepository.UpdateData(router);
+                                        _taskService.UpdateData(task);
+                                    }
+                                }
+                            }
                         }
                     }
-                    #region MyRegion
-
-                    //if (command != null && command.Status == (ushort)ConveyorStatus.Stored)//娣诲姞杈撻�佺嚎鐘舵�丆onveyorLineStatus enum
-                    //{
-                    //    switch (childDeviceCode)
-                    //    {
-                    //        case "1002":
-                    //            {
-                    //                RequestInbound(conveyorLine, command, childDeviceCode);
-                    //            }
-                    //            break;
-                    //        case "1004":
-                    //            ConveyorLineInFinish(conveyorLine, command, childDeviceCode);
-                    //            break;
-                    //        //case "105":
-                    //        //    RequestOutbound(conveyorLine, command, childDeviceCode);
-                    //        //    break;
-                    //        case "1008":
-                    //            ConveyorLineOutFinish(conveyorLine, command, childDeviceCode);
-                    //            break;
-                    //            //default:
-                    //            //    RequestInNextAddress(conveyorLine, command, childDeviceCode);
-                    //            //    RequestOutNextAddress(conveyorLine, command, childDeviceCode);
-                    //            //    break;
-                    //    }
-                    //}
-                    #endregion
                 }
                 catch (Exception ex)
                 {
@@ -120,6 +111,7 @@
                 {
                     task.ExceptionMessage = content?.Message;
                     _taskService.UpdateData(task);
+                    return;
                 }
                 //if (content.Status)
                 //{
@@ -185,7 +177,7 @@
             Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.Barcode, childDeviceCode);
             if (task != null) _taskService.UpdateTaskStatusToNext(task);
 
-            task = _taskService.QueryCompletedConveyorLineTask(command.TaskNum, childDeviceCode);
+            task = _taskService.QueryCompletedConveyorLineTask(command.Barcode, childDeviceCode);
             if (task != null && string.IsNullOrEmpty(task.TargetAddress))
             {
                 _taskService.StackerCraneRequestInbound(task);

--
Gitblit v1.9.3