| | |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_DTO.WMSInfo; |
| | | using WIDESEAWCS_IShuttleCar; |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | |
| | | partial class CommonShuttleCarJob : JobBase, IJob |
| | | { |
| | | private readonly ITaskService _taskService; |
| | | private readonly ITaskRepository _taskRepository; |
| | | private readonly ITaskHtyService _taskHtyService; |
| | | private readonly IShuttleCarService _shuttleCarService; |
| | | private readonly ITaskExecuteDetailService _taskExecuteDetailService; |
| | | private readonly IRouterService _routerService; |
| | | private readonly IMapper _mapper; |
| | | |
| | | public CommonShuttleCarJob(ITaskService taskService, ITaskHtyService taskHtyService, IShuttleCarService shuttleCarService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper) |
| | | public CommonShuttleCarJob(ITaskService taskService, ITaskRepository taskRepository, ITaskHtyService taskHtyService, IShuttleCarService shuttleCarService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper) |
| | | { |
| | | _taskService = taskService; |
| | | _taskRepository = taskRepository; |
| | | _taskHtyService = taskHtyService; |
| | | _shuttleCarService = shuttleCarService; |
| | | _taskExecuteDetailService = taskExecuteDetailService; |
| | |
| | | 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); |
| | | _taskService.ShuttleCarTaskCompleted(command.number, command.TaskTypeComplete); |
| | | shuttleCar.SetValue(ShuttleCarDBName.ConfirmComplete, true, 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()); |
| | | //çæå åæºç§»è½¦ä»»å¡&ç©¿æ¢è½¦å
çµä»»å¡,夿æ¯å¦æç©¿æ¢è½¦å¨å
çµ |
| | | Dt_Task _Task = _taskRepository.QueryFirst(x => x.TaskType == TaskOtherTypeEnum.RelocationCarCharging.ObjToInt()); |
| | | if (_Task != null) |
| | | { |
| | | if (_Task.ShuttleCarCode != shuttleCar.DeviceCode) |
| | | { |
| | | ShuttleCar shuttleCar1 = Storage.Devices.Where(x => x.DeviceCode.Equals(_Task.ShuttleCarCode)).FirstOrDefault() as ShuttleCar; |
| | | ShuttleCarTaskCommandR command1 = ReadCustomer<ShuttleCarTaskCommandR>(shuttleCar1, shuttleCar1.DeviceCode);//读åç©¿æ¢è½¦ä¿¡æ¯ |
| | | if (command1 != null && command1.JoinStatus == 1) |
| | | { |
| | | if (command1.Status == (short)ShuttleCarStatus.Charging && command1.ElectricQuantity >= 50) |
| | | { |
| | | var ShuttleCar = QueryCode(shuttleCar1.DeviceCode); |
| | | _taskService.AddRelocationCarTask(ShuttleCar.ShuttleCarPosition, "", ShuttleCar.ShuttleCarCode); |
| | | shuttleCar1.SetValue(ShuttleCarDBName.TaskType, (short)ShuttleCarStatus.QuitCharging); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | var ShuttleCar = QueryCode(shuttleCar.DeviceCode); |
| | | _taskService.AddRelocationCarTask(ShuttleCar.ShuttleCarPosition, "003-002-001", ShuttleCar.ShuttleCarCode, ShuttleCarTaskType.Charging.ToString()); |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region è·åå åæºç§»è½¦å®æä»»å¡ |
| | | #region è·åå åæºç§»è½¦/ç§»åºå®æä»»å¡ |
| | | GetSC_CarFinish(); |
| | | #endregion |
| | | |
| | | #region è·å移车/åºå
¥åºä»»å¡ |
| | | Get_CarTask(shuttleCar, command); |
| | | #endregion |
| | | |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Console.Out.WriteLine(nameof(CommonShuttleCarJob) + ":" + ex.ToString()); |
| | | } |
| | | finally |
| | | { |
| | | |
| | | //Console.Out.WriteLine(nameof(CommonShuttleCarJob) + ":" + ex.ToString()); |
| | | } |
| | | return Task.CompletedTask; |
| | | } |