From c2cdf0b95d4c9214646c860609b8c838d6ffa779 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期五, 15 八月 2025 13:42:10 +0800
Subject: [PATCH] AGV,成品库代码更新上传
---
项目代码/WCS/WCSServices/WIDESEAWCS_Tasks/成品仓/StackerCraneJob_CP.cs | 40 +++++++++++++++++++++++++++-------------
1 files changed, 27 insertions(+), 13 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/StackerCraneJob_CP.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/StackerCraneJob_CP.cs"
index 067c53d..87c5655 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/StackerCraneJob_CP.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/StackerCraneJob_CP.cs"
@@ -22,6 +22,7 @@
using WIDESEAWCS_Core;
using SqlSugar.Extensions;
using WIDESEAWCS_Tasks.ConveyorLineJob;
+using WIDESEAWCS_QuartzJob.Repository;
namespace WIDESEAWCS_Tasks
{
@@ -32,15 +33,17 @@
private readonly ITaskExecuteDetailService _taskExecuteDetailService;
private readonly ITaskRepository _taskRepository;
private readonly IRouterService _routerService;
+ private readonly IRouterRepository _routerRepository;
private readonly IStationMangerRepository _stationMangerRepository;
- public StackerCraneJob_CP(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, IStationMangerRepository stationMangerRepository)
+ public StackerCraneJob_CP(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, IStationMangerRepository stationMangerRepository,IRouterRepository routerRepository)
{
_taskService = taskService;
_taskExecuteDetailService = taskExecuteDetailService;
_taskRepository = taskRepository;
_routerService = routerService;
_stationMangerRepository = stationMangerRepository;
+ _routerRepository = routerRepository;
}
public Task Execute(IJobExecutionContext context)
@@ -114,21 +117,31 @@
{
if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
{
- Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StackerCraneStationCode == task.NextAddress);
+ Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StackerCraneStationCode == task.NextAddress && x.StackerCraneCode==deviceCode);
if (stationManger == null)
{
_taskExecuteDetailService.AddTaskExecuteDetail(taskNum, $"杈撻�佺嚎鍑哄簱绔欑偣鏈厤缃�,{task.NextAddress}");
_taskService.UpdateTaskExceptionMessage(taskNum, $"杈撻�佺嚎鍑哄簱绔欑偣鏈厤缃�,{task.NextAddress}");
return WebResponseContent.Instance.Error($"杈撻�佺嚎鍑哄簱绔欑偣鏈厤缃�,{task.NextAddress}");
}
-
+ Dt_Router router = _routerRepository.QueryFirst(x => x.InOutType == task.TaskType && x.StartPosi == stationManger.StationCode && x.ChildPosi == stationManger.StationDeviceCode);
+ if (router == null)
+ {
+ _taskService.UpdateTaskExceptionMessage(taskNum, $"鏈壘鍒拌矾鐢变俊鎭�,{task.NextAddress}");
+ WriteError(deviceCode, $"鏈壘鍒拌矾鐢变俊鎭�,{task.NextAddress}");
+ return WebResponseContent.Instance.Error($"鏈壘鍒拌矾鐢变俊鎭�,{task.NextAddress}");
+ }
int oldStatus = task.TaskState;
task.DeviceCode = stationManger.StationDeviceCode;
task.TaskState = TaskStatusEnum.Line_Execute.ObjToInt();
task.CurrentAddress = stationManger.StationCode;
+ task.NextAddress = router.NextPosi;
+ task.TargetAddress = router.NextPosi;
_taskRepository.UpdateData(task);
+ //todo 鍫嗗灈鏈哄畬鎴愬畬鎴�
+ //_taskService.UpdateTask(task, TaskStatusEnum.Line_Execute, deviceCode: stationManger.StationDeviceCode, currentAddress: stationManger.StationCode, nextAddress: router.NextPosi, targetAddress: router.NextPosi);
_taskExecuteDetailService.AddTaskExecuteDetail(taskNum, $"绯荤粺鑷姩娴佺▼,浠诲姟鐘舵�佷粠銆恵oldStatus}銆戣浆鍒般�恵task.TaskState}銆�");
- //todo 瀹屾垚
+ WriteInfo(deviceCode, $"鍫嗗灈鏈轰换鍔″畬鎴�,浠诲姟鍙�:{taskNum}");
}
else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup || task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup)
{
@@ -192,22 +205,23 @@
if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
{
- if (OutTaskStationIsOccupied(task) != null || true)
+ if (OutTaskStationIsOccupied(task) == null)
{
- return task;
- }
- else
- {
- List<string> otherOutStaionCodes = _routerService.QueryNextRoutes(commonStackerCrane.DeviceCode, task.NextAddress).Select(x => x.ChildPosi).ToList();
+ bool flag = false;
+ List<string> otherOutStaionCodes = _routerService.QueryNextRoutes(commonStackerCrane.DeviceCode, task.NextAddress, task.TaskType).Select(x => x.ChildPosi).ToList();
List<Dt_Task> tasks = _taskService.QueryStackerCraneOutTasks(commonStackerCrane.DeviceCode, otherOutStaionCodes);
foreach (var item in tasks)
{
if (OutTaskStationIsOccupied(task) != null)
{
- return task;
+ flag = true;
+ break;
}
}
- task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode);
+ if (!flag)
+ {
+ task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode);
+ }
}
}
@@ -221,7 +235,7 @@
/// <returns>濡傛灉鏈鍗犵敤锛岃繑鍥炰紶鍏ョ殑浠诲姟淇℃伅锛屽惁鍒欙紝杩斿洖null</returns>
private Dt_Task? OutTaskStationIsOccupied([NotNull] Dt_Task task)
{
- Dt_StationManger? stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == task.TargetAddress && x.StackerCraneCode == task.DeviceCode);
+ Dt_StationManger? stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == task.NextAddress && x.StackerCraneCode == task.DeviceCode);
if (stationManger != null)
{
IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode);
--
Gitblit v1.9.3