1
dengjunjie
2025-01-11 8c32980cde3f526553cf1bdf8c40a19d5e9f9a0b
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/°å²Ä²Ö/StackerCraneJob_BC.cs
@@ -26,6 +26,8 @@
using WIDESEAWCS_Core.Caches;
using Newtonsoft.Json;
using WIDESEAWCS_TaskInfoService;
using WIDESEAWCS_Tasks.ConveyorLineJob;
using WIDESEAWCS_QuartzJob.Repository;
namespace WIDESEAWCS_Tasks
{
@@ -38,9 +40,10 @@
        private readonly ITaskRepository _taskRepository;
        private readonly IRouterService _routerService;
        private readonly IStationMangerRepository _stationMangerRepository;
        private readonly IRouterRepository _routerRepository;
        private List<Dt_ApiInfo> apiInfos;
        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 +51,7 @@
            _routerService = routerService;
            _stationMangerRepository = stationMangerRepository;
            _cacheService = cacheService;
            _routerRepository = routerRepository;
            string? apiInfoStr = _cacheService.Get("apiInfos");
            if (!string.IsNullOrEmpty(apiInfoStr))
@@ -138,6 +142,14 @@
                            _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);
                        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: task.TargetAddress);
                    }
                    else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup || task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup)
@@ -250,11 +262,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;
                    }
                }