| | |
| | | using AutoMapper; |
| | | using HslCommunication; |
| | | using Newtonsoft.Json; |
| | | using OfficeOpenXml.Drawing.Chart; |
| | | using Quartz; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Common.ShuttleCarEnum; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_DTO.WMSInfo; |
| | | using WIDESEAWCS_IShuttleCar; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_QuartzJob.DTO; |
| | | using WIDESEAWCS_QuartzJob.Service; |
| | | using WIDESEAWCS_QuartzJob.StackerCrane.Enum; |
| | | using WIDESEAWCS_TaskInfoService; |
| | | using WIDESEAWCS_Tasks.ConveyorLineJob; |
| | | using WIDESEAWCS_Tasks.ShuttleCarJob; |
| | | using WIDESEAWCS_Tasks.StackerCraneJob; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | | [DisallowConcurrentExecution] |
| | | public class ShuttleCarJob : IJob |
| | | partial class CommonShuttleCarJob : JobBase, IJob |
| | | { |
| | | private readonly ITaskService _taskService; |
| | | private readonly ITaskHtyService _taskHtyService; |
| | | private readonly IShuttleCarService _shuttleCarService; |
| | | private readonly ITaskExecuteDetailService _taskExecuteDetailService; |
| | | private readonly IRouterService _routerService; |
| | | private readonly IMapper _mapper; |
| | | |
| | | public ShuttleCarJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper) |
| | | public CommonShuttleCarJob(ITaskService taskService, ITaskHtyService taskHtyService, IShuttleCarService shuttleCarService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper) |
| | | { |
| | | _taskService = taskService; |
| | | _taskHtyService = taskHtyService; |
| | | _shuttleCarService = shuttleCarService; |
| | | _taskExecuteDetailService = taskExecuteDetailService; |
| | | _routerService = routerService; |
| | | _mapper = mapper; |
| | |
| | | ShuttleCar shuttleCar = (ShuttleCar)context.JobDetail.JobDataMap.Get("JobParams"); |
| | | if (shuttleCar != null) |
| | | { |
| | | |
| | | shuttleCar.Communicator.IsReadAfterWrite = false; |
| | | ShuttleCarTaskCommandR command = ReadCustomer<ShuttleCarTaskCommandR>(shuttleCar, shuttleCar.DeviceCode);//读åç©¿æ¢è½¦ä¿¡æ¯ |
| | | if (command != null && command.JoinStatus == 1) |
| | | { |
| | | #region ç©¿æ¢è½¦ä»»å¡å®æ |
| | | var complete = shuttleCar.GetValue<ShuttleCarDBName, bool>(ShuttleCarDBName.TaskComplete); |
| | | if (complete && command.TaskTypeComplete > (short)ShuttleCarTaskComplete.Standby && command.Status == command.TaskTypeComplete) |
| | | { |
| | | var Status = _taskService.ShuttleCarTaskCompleted(command.number, command.TaskTypeComplete).Status; |
| | | shuttleCar.SetValue(ShuttleCarDBName.ConfirmComplete, Status, shuttleCar.DeviceCode); |
| | | } |
| | | #endregion |
| | | |
| | | #region å建移车å
çµä»»å¡ |
| | | if (command.Err_Status == (short)ShuttleCarErr.LowBattery || command.ElectricQuantity <= (short)ShuttleCarErr.LowBattery) |
| | | { |
| | | //çæå åæºç§»è½¦ä»»å¡&ç©¿æ¢è½¦å
çµä»»å¡ |
| | | var ShuttleCar = QueryCode(shuttleCar.DeviceCode); |
| | | _taskService.AddRelocationCarTask(ShuttleCar.ShuttleCarPosition, "002-002-001", ShuttleCar.ShuttleCarCode, ShuttleCarTaskType.Charging.ToString()); |
| | | } |
| | | #endregion |
| | | |
| | | #region è·åå åæºç§»è½¦å®æä»»å¡ |
| | | GetSC_CarFinish(); |
| | | #endregion |
| | | |
| | | #region è·å移车/åºå
¥åºä»»å¡ |
| | | Get_CarTask(shuttleCar, command); |
| | | #endregion |
| | | |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | Console.Out.WriteLine(nameof(CommonShuttleCarJob) + ":" + ex.ToString()); |
| | | } |
| | | finally |
| | | { |