#region << 版 本 注 释 >>
|
/*----------------------------------------------------------------
|
* 命名空间:WIDESEAWCS_Tasks.ConveyorLineJob
|
* 创建者:胡童庆
|
* 创建时间:2024/8/2 16:13:36
|
* 版本:V1.0.0
|
* 描述:
|
*
|
* ----------------------------------------------------------------
|
* 修改人:
|
* 修改时间:
|
* 版本:V1.0.1
|
* 修改说明:
|
*
|
*----------------------------------------------------------------*/
|
#endregion << 版 本 注 释 >>
|
|
using Quartz;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using WIDESEAWCS_Core.Helper;
|
using WIDESEAWCS_ITaskInfoService;
|
using WIDESEAWCS_Model.Models;
|
using WIDESEAWCS_QuartzJob;
|
using WIDESEAWCS_QuartzJob.DTO;
|
using WIDESEAWCS_Tasks.ConveyorLineJob;
|
|
namespace WIDESEAWCS_Tasks
|
{
|
[DisallowConcurrentExecution]
|
public class CommonConveyorLineJob : IJob
|
{
|
private readonly ITaskService _taskService;
|
private readonly ITaskExecuteDetailService _taskExecuteDetailService;
|
|
public CommonConveyorLineJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService)
|
{
|
_taskService = taskService;
|
_taskExecuteDetailService = taskExecuteDetailService;
|
}
|
|
public Task Execute(IJobExecutionContext context)
|
{
|
try
|
{
|
CommonConveyorLine conveyorLine = (CommonConveyorLine)context.JobDetail.JobDataMap.Get("JobParams");
|
// List<Dt_StationManager> stationManagers = _stationManagerService.GetStationManagers();
|
// foreach (var item in stationManagers)
|
// {
|
// try
|
// {
|
// ushort value = conveyorLine.GetValue<ConveyorLineDBName, ushort>(ConveyorLineDBName.InteractiveSignal, item.StationCode);
|
|
// DeviceProtocolDetailDTO? deviceProtocolDetail = conveyorLine.DeviceProtocolDetailDTOs.FirstOrDefault(x => x.ProtocalDetailValue == value.ToString());
|
|
// if (deviceProtocolDetail != null)
|
// {
|
// ConveyorLineTaskCommand? command = new ConveyorLineTaskCommand()
|
// {
|
// InteractiveSignal = 0,
|
// Barcode = "",
|
// TargetAddress = Convert.ToInt32(item.DeviceCode),
|
// TaskNum = 9988,
|
// TrayType = 3
|
// };
|
|
// SignalType signalType = Enum.Parse<SignalType>(deviceProtocolDetail.ProtocolDetailType);
|
// switch (signalType)
|
// {
|
// case SignalType.InEntranceRequest:
|
// command.Barcode = "InEntranceRequest";
|
// break;
|
// case SignalType.InEntranceResponse:
|
// command.Barcode = "InEntranceResponse";
|
// break;
|
// case SignalType.InEntranceRequestReset:
|
// command.Barcode = "InEntranceRequestReset";
|
// break;
|
// case SignalType.OutEntranceRequest:
|
// command.Barcode = "OutEntranceRequest";
|
// break;
|
// case SignalType.OutEntranceResponse:
|
// command.Barcode = "OutEntranceResponse";
|
// break;
|
// case SignalType.OutEntranceRequestReset:
|
// command.Barcode = "OutEntranceRequestReset";
|
// break;
|
// case SignalType.InStationRequest:
|
// command.Barcode = "InStationRequest";
|
// break;
|
// case SignalType.InStationResponse:
|
// command.Barcode = "InStationResponse";
|
// break;
|
// case SignalType.InStationRequestReset:
|
// command.Barcode = "InStationRequestReset";
|
// break;
|
// case SignalType.OutStationRequest:
|
// command.Barcode = "OutStationRequest";
|
// break;
|
// case SignalType.OutStationResponse:
|
// command.Barcode = "OutStationResponse";
|
// break;
|
// case SignalType.OutStationRequestReset:
|
// command.Barcode = "OutStationRequestReset";
|
// break;
|
// default:
|
// command = null;
|
// break;
|
// }
|
// if (command != null)
|
// {
|
// conveyorLine.SendCommand(command, item.StationCode);
|
// Console.Out.WriteLine(command.Serialize());
|
// }
|
|
// }
|
|
// }
|
// catch (Exception ex)
|
// {
|
// Console.Out.WriteLine(item.StationCode + ":" + ex.ToString());
|
// }
|
// }
|
}
|
catch (Exception ex)
|
{
|
Console.Out.WriteLine(nameof(CommonConveyorLineJob) + ":" + ex.ToString());
|
}
|
|
return Task.CompletedTask;
|
}
|
}
|
}
|