From 4ba2eba294e2e32d4e09cd29f4162e72eae4ef9e Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期二, 10 六月 2025 23:29:56 +0800
Subject: [PATCH] 2
---
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/阻焊仓/AGV_ZHExtend.cs | 99 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 98 insertions(+), 1 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\351\230\273\347\204\212\344\273\223/AGV_ZHExtend.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\351\230\273\347\204\212\344\273\223/AGV_ZHExtend.cs"
index 83d05a6..066b355 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\351\230\273\347\204\212\344\273\223/AGV_ZHExtend.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\351\230\273\347\204\212\344\273\223/AGV_ZHExtend.cs"
@@ -9,6 +9,7 @@
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.Helper;
using WIDESEAWCS_Model.Models;
+using WIDESEAWCS_QuartzJob;
using WIDESEAWCS_Tasks.StackerCraneJob;
namespace WIDESEAWCS_Tasks
@@ -19,7 +20,7 @@
{
try
{
- var newTasks = _taskService.Db.Queryable<Dt_Task>().Where(x => (x.TaskState == TaskStatusEnum.New.ObjToInt() || x.TaskState == TaskStatusEnum.AGV_Execute.ObjToInt()) && nameof(AGV_PPJob).Contains(x.DeviceCode) && !string.IsNullOrEmpty(x.DeviceCode)).ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList();
+ var newTasks = _taskService.Db.Queryable<Dt_Task>().Where(x => (x.TaskState == TaskStatusEnum.AGV_Execute.ObjToInt()) && nameof(AGV_PPJob).Contains(x.DeviceCode) && !string.IsNullOrEmpty(x.DeviceCode)).ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList();
foreach (var task in newTasks)
{
try
@@ -61,5 +62,101 @@
WriteError(nameof(AGV_FLJob), ex.Message, ex);
}
}
+ /// <summary>
+ /// 涓嬪彂AGV缁х画鎵ц浠诲姟
+ /// </summary>
+ public void SendAGVWaitToTask()
+ {
+ 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();
+ foreach (var WaitToTask in WaitToTasks)
+ {
+ if (WaitToTask.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)
+ {
+ if (WaitToTasks.FirstOrDefault(x => x.TaskState == TaskStatusEnum.AGV_Puting.ObjToInt() || x.TaskState == TaskStatusEnum.Finish.ObjToInt()) != null)
+ {
+ continue;
+ }
+ Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == WaitToTask.NextAddress);
+ if (stationManger == null)
+ {
+ continue;
+ }
+ IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode);
+ if (device == null)
+ {
+ continue;
+ }
+ OtherDevice otherDevice = (OtherDevice)device;
+ bool canPut = otherDevice.GetValue<GroundStationDBName, bool>(GroundStationDBName.R_IsCanPut, stationManger.StationCode);
+ bool requestPut = otherDevice.GetValue<GroundStationDBName, bool>(GroundStationDBName.W_PutRequest, stationManger.StationCode);
+ if (!requestPut)
+ {
+ otherDevice.SetValue(GroundStationDBName.W_PutRequest, true, stationManger.StationCode);
+ continue;
+ }
+ else if (!canPut)
+ {
+ continue;
+ }
+ }
+ else
+ {
+ Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == WaitToTask.CurrentAddress);
+ if (stationManger == null)
+ {
+ continue;
+ }
+ IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode);
+ if (device == null)
+ {
+ continue;
+ }
+ OtherDevice otherDevice = (OtherDevice)device;
+ bool canTake = otherDevice.GetValue<GroundStationDBName, bool>(GroundStationDBName.R_IsCanTake, stationManger.StationCode);
+ bool requestTake = otherDevice.GetValue<GroundStationDBName, bool>(GroundStationDBName.W_TakeRequest, stationManger.StationCode);
+ if (!requestTake)
+ {
+ otherDevice.SetValue(GroundStationDBName.W_TakeRequest, true, stationManger.StationCode);
+ continue;
+ }
+ else if (!canTake)
+ {
+ continue;
+ }
+ }
+
+ AgvSecureReplyDTO replyDTO = new AgvSecureReplyDTO()
+ {
+ ReqCode = Guid.NewGuid().ToString().Replace("-", ""), //WaitToTask.TaskNum.ToString(),
+ taskCode = WaitToTask.AgvTaskNum,
+ };
+ WebResponseContent content = _taskService.AgvSecureReply(replyDTO);
+ if (content.Status && WaitToTask.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)
+ {
+ WaitToTask.TaskState = TaskStatusEnum.AGV_Puting.ObjToInt();
+ _taskService.UpdateTask(WaitToTask, TaskStatusEnum.AGV_Puting);
+ break;
+ }
+ else if (content.Status && WaitToTask.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
+ {
+ WaitToTask.TaskState = TaskStatusEnum.AGV_Executing.ObjToInt();
+ _taskService.UpdateTask(WaitToTask, TaskStatusEnum.AGV_Executing);
+ }
+ else
+ {
+ WaitToTask.TaskState = TaskStatusEnum.Exception.ObjToInt();
+ WaitToTask.ExceptionMessage = content.Message;
+ _taskService.UpdateTask(WaitToTask, TaskStatusEnum.Exception);
+ }
+ }
+ _taskService.UpdateData(WaitToTasks);
+ }
+ catch (Exception ex)
+ {
+ Console.Out.WriteLine(nameof(AGV_CSJJob) + ":" + ex.Message);
+ }
+ }
}
}
--
Gitblit v1.9.3