| | |
| | | using WIDESEAWCS_QuartzJob.Service; |
| | | using WIDESEAWCS_SignalR; |
| | | using WIDESEAWCS_Tasks.ConveyorLineJob; |
| | | using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database; |
| | | using ICacheService = WIDESEAWCS_Core.Caches.ICacheService; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | |
| | | public async Task Execute(IJobExecutionContext context) |
| | | { |
| | | string jobName = context.JobDetail.Key.Name; |
| | | if (MemoryLockManager.TryAcquireLock(jobName)) |
| | | { |
| | | //if (MemoryLockManager.TryAcquireLock(jobName)) |
| | | //{ |
| | | try |
| | | { |
| | | CommonConveyorLine conveyorLine = (CommonConveyorLine)context.JobDetail.JobDataMap.Get("JobParams"); |
| | |
| | | } |
| | | } |
| | | } |
| | | else if (station.stationType == 5) |
| | | { |
| | | ConveyorLineTaskCommand command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(station.stationChildCode); |
| | | ConveyorLineTaskCommandWrite commandWrite = conveyorLine.ReadCustomer<ConveyorLineTaskCommandWrite>(station.stationChildCode, "DeviceCommand"); |
| | | if (command != null && commandWrite != null) |
| | | { |
| | | var structs = BitConverter.GetBytes(commandWrite.WriteInteractiveSignal).Reverse().ToArray().ToBoolArray(); |
| | | if (structs[0] == true) |
| | | { |
| | | if (_taskRepository.QueryData(x => x.SourceAddress == station.stationChildCode).Count() > 0) |
| | | { |
| | | return; |
| | | } |
| | | ConsoleHelper.WriteWarningLine($"【{conveyorLine.DeviceName}】任务号:【{command.TaskNum}】,托盘条码:【{command.Barcode}】已到达【{station.stationChildCode}】异常口请求扫码入库"); |
| | | HandleNewTask(conveyorLine, command, station.stationChildCode, 0); |
| | | } |
| | | else |
| | | { |
| | | ConveyorLineSendFinish(conveyorLine, station.stationChildCode, 0, false); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | Console.Out.WriteLine(nameof(CommonConveyorLineJob) + ":" + ex.ToString()); |
| | | } |
| | | finally |
| | | { |
| | | MemoryLockManager.ReleaseLock(jobName); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | ConsoleHelper.WriteErrorLine($"[CommonConveyorLineJob]【{jobName}】任务已被锁定,无法处理"); |
| | | } |
| | | // finally |
| | | // { |
| | | // MemoryLockManager.ReleaseLock(jobName); |
| | | // } |
| | | //} |
| | | //else |
| | | //{ |
| | | // ConsoleHelper.WriteErrorLine($"[CommonConveyorLineJob]【{jobName}】任务已被锁定,无法处理"); |
| | | //} |
| | | return; |
| | | } |
| | | |
| | |
| | | { |
| | | if (command.Barcode == task.PalletCode && childDeviceCode == task.NextAddress) |
| | | { |
| | | conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTargetAddress, "1000", childDeviceCode); |
| | | //conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTargetAddress, "1000", childDeviceCode); |
| | | |
| | | ConsoleHelper.WriteWarningLine($"【{conveyorLine._deviceName}】任务号:【{command.TaskNum}】,托盘条码:【{command.Barcode}】已到达【{childDeviceCode}】输送线入库完成,下一目标地址【等待分配货位,并写入1000】"); |
| | | |