| | |
| | | *----------------------------------------------------------------*/ |
| | | #endregion << 版 本 注 释 >> |
| | | |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; |
| | | using Quartz; |
| | | using System; |
| | | using System.Collections.Generic; |
| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_IBasicInfoService; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | |
| | | { |
| | | private readonly ITaskService _taskService; |
| | | private readonly ITaskExecuteDetailService _taskExecuteDetailService; |
| | | private readonly IRouterService _routerService; |
| | | |
| | | public CommonConveyorLineJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService) |
| | | public CommonConveyorLineJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService) |
| | | { |
| | | _taskService = taskService; |
| | | _taskExecuteDetailService = taskExecuteDetailService; |
| | | _routerService = routerService; |
| | | } |
| | | |
| | | 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) |
| | | //if (conveyorLine != null) |
| | | //{ |
| | | // List<string> childDeviceCodes = _routerService.QueryAllPositions(conveyorLine.DeviceCode); |
| | | |
| | | // foreach (string childDeviceCode in childDeviceCodes) |
| | | // { |
| | | // try |
| | | // ConveyorLineTaskCommand command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(childDeviceCode); |
| | | // if (command != null) |
| | | // { |
| | | // ushort value = conveyorLine.GetValue<ConveyorLineDBName, ushort>(ConveyorLineDBName.InteractiveSignal, item.StationCode); |
| | | |
| | | // DeviceProtocolDetailDTO? deviceProtocolDetail = conveyorLine.DeviceProtocolDetailDTOs.FirstOrDefault(x => x.ProtocalDetailValue == value.ToString()); |
| | | |
| | | // DeviceProtocolDetailDTO? deviceProtocolDetail = conveyorLine.DeviceProtocolDetailDTOs.FirstOrDefault(x => x.ProtocalDetailValue == command.InteractiveSignal.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) |
| | | { |