From d78b5a2c4fa691df7471f7ec1a52b6d38d96bedb Mon Sep 17 00:00:00 2001 From: dengjunjie <dengjunjie@hnkhzn.com> Date: 星期一, 13 一月 2025 23:51:15 +0800 Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/MeiRuiAn/HuaiAn --- 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/板材仓/StackerCraneJob_BC.cs | 57 ++++++++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 44 insertions(+), 13 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\235\277\346\235\220\344\273\223/StackerCraneJob_BC.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\235\277\346\235\220\344\273\223/StackerCraneJob_BC.cs" index b79bd18..b688792 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\235\277\346\235\220\344\273\223/StackerCraneJob_BC.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\235\277\346\235\220\344\273\223/StackerCraneJob_BC.cs" @@ -26,6 +26,9 @@ using WIDESEAWCS_Core.Caches; using Newtonsoft.Json; using WIDESEAWCS_TaskInfoService; +using WIDESEAWCS_Tasks.ConveyorLineJob; +using WIDESEAWCS_QuartzJob.Repository; +using Autofac.Core; namespace WIDESEAWCS_Tasks { @@ -38,9 +41,11 @@ private readonly ITaskRepository _taskRepository; private readonly IRouterService _routerService; private readonly IStationMangerRepository _stationMangerRepository; + private readonly IRouterRepository _routerRepository; private List<Dt_ApiInfo> apiInfos; + private readonly List<Dt_WarehouseDevice> warehouseDevices; - public StackerCraneJob_BC(ITaskService taskService, ICacheService cacheService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, IStationMangerRepository stationMangerRepository) + public StackerCraneJob_BC(ITaskService taskService, ICacheService cacheService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository) { _taskService = taskService; _taskExecuteDetailService = taskExecuteDetailService; @@ -48,6 +53,7 @@ _routerService = routerService; _stationMangerRepository = stationMangerRepository; _cacheService = cacheService; + _routerRepository = routerRepository; string? apiInfoStr = _cacheService.Get("apiInfos"); if (!string.IsNullOrEmpty(apiInfoStr)) @@ -62,6 +68,17 @@ apiInfos = infos; } } + + + string? warehouseDevicesStr = _cacheService.Get<string>(nameof(Dt_WarehouseDevice)); + if (!string.IsNullOrEmpty(warehouseDevicesStr)) + { + warehouseDevices = JsonConvert.DeserializeObject<List<Dt_WarehouseDevice>>(warehouseDevicesStr) ?? new List<Dt_WarehouseDevice>(); + } + else + { + warehouseDevices = new List<Dt_WarehouseDevice>(); + } } public Task Execute(IJobExecutionContext context) @@ -71,6 +88,13 @@ CommonStackerCrane commonStackerCrane = (CommonStackerCrane)context.JobDetail.JobDataMap.Get("JobParams"); if (commonStackerCrane != null) { + Dt_WarehouseDevice? warehouseDevice = warehouseDevices.FirstOrDefault(x => x.DeviceCode == commonStackerCrane.DeviceCode); + if (warehouseDevice == null) + { + WriteError(commonStackerCrane.DeviceName, $"璇烽厤缃粨搴撹澶囦俊鎭�"); + return Task.CompletedTask; + } + if (!commonStackerCrane.IsEventSubscribed) { commonStackerCrane.StackerCraneTaskCompletedEventHandler += CommonStackerCrane_StackerCraneTaskCompletedEventHandler;//璁㈤槄浠诲姟瀹屾垚浜嬩欢 @@ -138,7 +162,15 @@ _taskService.UpdateTaskExceptionMessage(taskNum, $"杈撻�佺嚎鍑哄簱绔欑偣鏈厤缃�,{task.NextAddress}"); return WebResponseContent.Instance.Error($"杈撻�佺嚎鍑哄簱绔欑偣鏈厤缃�,{task.NextAddress}"); } - _taskService.UpdateTask(task, TaskStatusEnum.Line_Execute, deviceCode: stationManger.StationDeviceCode, currentAddress: stationManger.StationCode, nextAddress: task.TargetAddress); + Dt_Router router = _routerRepository.QueryFirst(x => x.InOutType == task.TaskType && x.StartPosi == stationManger.StationCode); + if (router == null) + { + _taskExecuteDetailService.AddTaskExecuteDetail(taskNum, $"鏈壘鍒拌矾鐢变俊鎭�,{task.NextAddress}"); + _taskService.UpdateTaskExceptionMessage(taskNum, $"鏈壘鍒拌矾鐢变俊鎭�,{task.NextAddress}"); + return WebResponseContent.Instance.Error($"鏈壘鍒拌矾鐢变俊鎭�,{task.NextAddress}"); + } + + _taskService.UpdateTask(task, TaskStatusEnum.Line_Execute, deviceCode: stationManger.StationDeviceCode, currentAddress: stationManger.StationCode, nextAddress: router.NextPosi, targetAddress: router.NextPosi); } else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup || task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup) { @@ -222,15 +254,15 @@ if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) { - string? url = apiInfos.FirstOrDefault(x => x.ApiCode == APIEnum.FeedBackWMSTaskCompleted.ToString())?.ApiAddress; - if (string.IsNullOrEmpty(url)) - { - _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"鏈壘鍒癢MS绉诲簱鍒ゆ柇鎺ュ彛"); - WriteError(commonStackerCrane.DeviceCode, $"鏈壘鍒癢MS绉诲簱鍒ゆ柇鎺ュ彛"); - _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鏈壘鍒癢MS绉诲簱鍒ゆ柇鎺ュ彛"); - return null; - } - HttpHelper.Post($"{url}?taskNum={task.TaskNum}&locationCode={task.NextAddress}", "");//todo 璋冪敤WMS浠诲姟瀹屾垚鏂规硶 + //string? url = apiInfos.FirstOrDefault(x => x.ApiCode == APIEnum.WMSIsReloaction.ToString())?.ApiAddress; + //if (string.IsNullOrEmpty(url)) + //{ + // _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"鏈壘鍒癢MS绉诲簱鍒ゆ柇鎺ュ彛"); + // WriteError(commonStackerCrane.DeviceCode, $"鏈壘鍒癢MS绉诲簱鍒ゆ柇鎺ュ彛"); + // _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鏈壘鍒癢MS绉诲簱鍒ゆ柇鎺ュ彛"); + // return null; + //} + //HttpHelper.Post($"{url}?taskNum={task.TaskNum}&locationCode={task.NextAddress}", "");//todo 璋冪敤WMS浠诲姟瀹屾垚鏂规硶 } return task; @@ -250,11 +282,10 @@ if (device != null) { OtherDevice client = (OtherDevice)device; - if (client.GetValue<GroundStationDBName, bool>(GroundStationDBName.R_IsCanPut, stationManger.StationCode))//鍑哄簱绔欏彴鏈鍗犵敤 + if (!client.GetValue<R_ConveyorLineDB, bool>(R_ConveyorLineDB.Goods, stationManger.StationCode))//鍑哄簱绔欏彴鏈鍗犵敤 { task.NextAddress = stationManger.StackerCraneStationCode; _taskRepository.UpdateData(task); - client.SetValue(GroundStationDBName.R_IsCanPut, true, stationManger.StationCode); return task; } } -- Gitblit v1.9.3