using Autofac.Core; using Microsoft.AspNetCore.Components.Routing; using Newtonsoft.Json; using OfficeOpenXml.FormulaParsing.Excel.Functions.Math; using Quartz; using System.Reflection; using WIDESEAWCS_Common.TaskEnum; using WIDESEAWCS_Core; using WIDESEAWCS_IBasicInfoRepository; using WIDESEAWCS_IPackInfoRepository; using WIDESEAWCS_ITaskInfoRepository; using WIDESEAWCS_ITaskInfoService; using WIDESEAWCS_QuartzJob; using WIDESEAWCS_QuartzJob.DTO; using WIDESEAWCS_Tasks.ConveyorLineJob; using WIDESEAWCS_Tasks.StackPlateJob; using ICacheService = WIDESEAWCS_Core.Caches.ICacheService; namespace WIDESEAWCS_Tasks { [DisallowConcurrentExecution] public class ApartPlate : JobBase, IJob { private readonly ICacheService _cacheService; private readonly ITaskService _taskService; private readonly ITaskRepository _taskRepository; private readonly IStationMangerRepository _stationMangerRepository; private readonly IDt_PackaxisRepository _packaxisRepository; public ApartPlate(ICacheService cacheService, ITaskService taskService, ITaskRepository taskRepository, IStationMangerRepository stationMangerRepository, IDt_PackaxisRepository packaxisRepository) { _cacheService = cacheService; _taskService = taskService; _taskRepository = taskRepository; _stationMangerRepository = stationMangerRepository; _packaxisRepository = packaxisRepository; } public Task Execute(IJobExecutionContext context) { CommonConveyorLine device = (CommonConveyorLine)context.JobDetail.JobDataMap.Get("JobParams"); //获取当前设备对应的站台 StackPlateTaskCommandCommand command = device.ReadCustomer(device.DeviceCode); if (command != null && command.State == 2) { DeviceProtocolDetailDTO? deviceProtocolDetails = device.DeviceProtocolDetailDTOs.FirstOrDefault(x => x.DeviceProParamName == nameof(StackPlateTaskCommandCommand.InteractiveSignal) && x.ProtocalDetailValue == command.InteractiveSignal.ToString()); if (deviceProtocolDetails != null) { MethodInfo? method = GetType().GetMethod(deviceProtocolDetails.ProtocolDetailType); if (method != null) { method.Invoke(this, new object[] { device, command }); } } } return Task.CompletedTask; } /// /// 有料允许 /// /// /// public void InStockAllow(CommonConveyorLine device, StackPlateTaskCommandCommand command) { device.SetValue(StackPlateDBName.WriteInteractiveSignal, Convert.ToInt16(2), device.DeviceCode); //分配已拆分空托盘去向任务 } /// /// 空位允许,允许拆盘 /// /// /// public void EmptySeatAllow(CommonConveyorLine device, StackPlateTaskCommandCommand command) { var task = _taskRepository.QueryFirst(x => x.Roadway == device.DeviceCode && x.TargetAddress == device.DeviceCode); if (task == null) { //todo请求WMS下发空托出库任务 } } } }