From 06f5f3e474bb8d9e255a899b62d16f671cfdb940 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期四, 26 六月 2025 17:34:33 +0800
Subject: [PATCH] 代码更新

---
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGV_CSJExtend.cs |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGV_CSJExtend.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGV_CSJExtend.cs"
index a38d496..eb4e385 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGV_CSJExtend.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGV_CSJExtend.cs"
@@ -12,6 +12,7 @@
 using WIDESEAWCS_QuartzJob;
 using WIDESEAWCS_DTO.Agv;
 using SqlSugar;
+using static Dm.net.buffer.ByteArrayBuffer;
 
 namespace WIDESEAWCS_Tasks
 {
@@ -106,7 +107,7 @@
         {
             try
             {
-                var WaitToTasks = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == TaskStatusEnum.AGV_WaitToExecute.ObjToInt() && nameof(AGV_CSJJob).Contains(x.DeviceCode)).ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList();
+                var WaitToTasks = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == TaskStatusEnum.AGV_WaitToExecute.ObjToInt() && nameof(AGV_CSJJob).Contains(x.DeviceCode)).OrderBy(x => x.CreateDate).ToList();
                 foreach (var WaitToTask in WaitToTasks)
                 {
                     if (WaitToTask.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)
@@ -189,6 +190,25 @@
                     }
                 }
                 _taskService.UpdateData(WaitToTasks);
+                Dt_Task? TakeErroeTask = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == TaskStatusEnum.AGV_TakeError.ObjToInt() && nameof(AGV_CSJJob).Contains(x.DeviceCode)).First();
+                if (TakeErroeTask!=null)
+                {
+                    Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == TakeErroeTask.CurrentAddress);
+                    if (stationManger == null)
+                    {
+                        throw new Exception($"鏈壘鍒扮珯鍙伴厤缃�");
+                    }
+                    IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode);
+                    if (device == null)
+                    {
+                        throw new Exception($"鏈壘鍒板搴旇澶�");
+                    }
+                    OtherDevice otherDevice = (OtherDevice)device;
+                    otherDevice.SetValue(GroundStationDBName.W_TakeFinish, true, stationManger.StationCode);
+                    Thread.Sleep(1000);
+                    otherDevice.SetValue(GroundStationDBName.W_TakeFinish, false, stationManger.StationCode);
+                    _taskService.TaskCompleted(TakeErroeTask.TaskNum);
+                }
             }
             catch (Exception ex)
             {

--
Gitblit v1.9.3