From 29cf70e7b7cffea11956fd99ff559239744bb2bf Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期四, 12 六月 2025 21:49:18 +0800
Subject: [PATCH] 1

---
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/油墨仓/CommonHoisterJob.cs |   29 ++++++++++++++++++++++++-----
 1 files changed, 24 insertions(+), 5 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\262\271\345\242\250\344\273\223/CommonHoisterJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\262\271\345\242\250\344\273\223/CommonHoisterJob.cs"
index 48878a9..b9049d6 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\262\271\345\242\250\344\273\223/CommonHoisterJob.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\262\271\345\242\250\344\273\223/CommonHoisterJob.cs"
@@ -4,6 +4,7 @@
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using WIDESEAWCS_Common;
 using WIDESEAWCS_Common.TaskEnum;
 using WIDESEAWCS_Core.Helper;
 using WIDESEAWCS_IBasicInfoRepository;
@@ -93,8 +94,11 @@
                                 task.NextAddress = locationCode;
                                 task.DeviceCode = stationManger.StackerCraneCode;
                                 task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt();
-                                _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, deviceCode: task.DeviceCode, targetAddress: task.TargetAddress, currentAddress: task.CurrentAddress, nextAddress: task.NextAddress);
                                 bool isWrite = hoister.SetValue(HoisterDBName.RequestIn, false, deviceChildCode);
+                                if (isWrite)
+                                {
+                                    _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, deviceCode: task.DeviceCode, targetAddress: task.TargetAddress, currentAddress: task.CurrentAddress, nextAddress: task.NextAddress);
+                                }
                             }
                             else
                             {
@@ -103,12 +107,25 @@
                         }
                         else if (leisure && !tray && !requestIn && !inbounding && !requestOut && !outbounding)
                         {
-                            Dt_Task task = _taskRepository.QueryFirst(x => x.TaskState == TaskStatusEnum.New.ObjToInt() && string.IsNullOrEmpty(x.TargetAddress) && _taskService.TaskOutboundTypes.Contains(x.TaskType) && x.TaskType != TaskTypeEnum.MesOutbound.ObjToInt());
+                            Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationCode == deviceChildCode);
+                            if (stationManger == null)
+                            {
+                                WriteError(hoister.DeviceName, $"鏈壘鍒板搴旂珯鍙颁俊鎭�,璁惧缂栧彿:{deviceChildCode}");
+                                break;
+                            }
+                            if (stationManger.StationType != StationTypeEnum.StationType_InboundAndOutbound.ObjToInt())
+                            {
+                                continue;
+                            }
+                            Dt_Task task = _taskRepository.QueryFirst(x => x.TaskState == TaskStatusEnum.New.ObjToInt() && string.IsNullOrEmpty(x.TargetAddress) && _taskService.TaskOutboundTypes.Contains(x.TaskType) && x.TaskType != TaskTypeEnum.MesOutbound.ObjToInt() && x.Roadway== stationManger.StackerCraneCode);
                             if (task != null)
                             {
                                 task.TaskState=TaskStatusEnum.HT_Executing.ObjToInt();
-                                _taskService.UpdateTask(task, TaskStatusEnum.HT_Executing);
                                 bool isWrite = hoister.SetValue(HoisterDBName.RequestOut, true, deviceChildCode);
+                                if (isWrite)
+                                {
+                                    _taskService.UpdateTask(task, TaskStatusEnum.HT_Executing);
+                                }
                                 WriteError(hoister.DeviceName, $"璇锋眰鍑哄簱,璁惧缂栧彿:{deviceChildCode},浠诲姟鍙�:{task.TaskNum}");
                             }
                         }
@@ -128,9 +145,11 @@
                                 task.NextAddress = stationManger.StackerCraneStationCode; ;
                                 task.DeviceCode = stationManger.StackerCraneCode;
                                 task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt();
-                                _taskRepository.UpdateData(task);
-
                                 bool isWrite = hoister.SetValue(HoisterDBName.RequestOut, false, deviceChildCode);
+                                if (isWrite)
+                                {
+                                    _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, deviceCode: task.DeviceCode, targetAddress: task.TargetAddress, nextAddress: task.NextAddress);
+                                }
                             }
                             else
                             {

--
Gitblit v1.9.3