| | |
| | | private readonly ITaskService _taskService; |
| | | private readonly ITaskRepository _taskRepository; |
| | | private readonly ITaskHtyService _taskHtyService; |
| | | private readonly IShuttleCarService _shuttleCarService; |
| | | private readonly WIDESEAWCS_IShuttleCar.IShuttleCarService _shuttleCarService; |
| | | private readonly ITaskExecuteDetailService _taskExecuteDetailService; |
| | | private readonly IRouterService _routerService; |
| | | private readonly ICacheService _cacheService; |
| | | private readonly IMapper _mapper; |
| | | |
| | | public CommonShuttleCarJob(ITaskService taskService, ITaskRepository taskRepository, ITaskHtyService taskHtyService, IShuttleCarService shuttleCarService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, ICacheService cacheService, IMapper mapper) |
| | | public CommonShuttleCarJob(ITaskService taskService, ITaskRepository taskRepository, ITaskHtyService taskHtyService, WIDESEAWCS_IShuttleCar.IShuttleCarService shuttleCarService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, ICacheService cacheService, IMapper mapper) |
| | | { |
| | | _taskService = taskService; |
| | | _taskRepository = taskRepository; |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region è·åå åæºç§»è½¦/ç§»åºå®æä»»å¡ |
| | | GetSC_CarFinish(); |
| | | #endregion |
| | | GetSC_CarFinish();//å åæºå®æç§»è½¦/移车å
çµ/ç§»åº/å
¥åºä»»å¡ |
| | | |
| | | #region å建移车å
çµä»»å¡ |
| | | if (command.Err_Status == (short)ShuttleCarErr.LowBattery || command.ElectricQuantity <= (short)ShuttleCarErr.LowBattery) |
| | |
| | | ShuttleCarTaskCommandR command1 = ReadCustomer<ShuttleCarTaskCommandR>(shuttleCar1, shuttleCar1.DeviceCode);//读åç©¿æ¢è½¦ä¿¡æ¯ |
| | | if (command1 != null && command1.JoinStatus == 1) |
| | | { |
| | | if (command1.Status == (short)ShuttleCarStatus.Charging && command1.ElectricQuantity /*> command.ElectricQuantity*/ >= 50) |
| | | if (command1.Status == (short)ShuttleCarStatus.Charging && command1.ElectricQuantity >= 50) |
| | | { |
| | | shuttleCar1.SetValue(ShuttleCarDBName.TaskType, (short)ShuttleCarStatus.QuitCharging); |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | string CarChargingStation = AppSettings.Configuration[nameof(CarChargingStation)];//å
çµä½ |
| | | //夿å
çµä½æ¯å¦æè½¦ |
| | | string CarChargingStation = AppSettings.Configuration[nameof(CarChargingStation)];//夿å
çµä½æ¯å¦æè½¦ |
| | | var ShuttleCar1 = _shuttleCarService.QueryShuttleCar(CarChargingStation); |
| | | if (ShuttleCar1 != null && ShuttleCar1.ShuttleCarCode != shuttleCar.DeviceCode) |
| | | { |
| | | #region 夿æ¯å¦å卿°å»ºç§»è½¦ä»»å¡ |
| | | if (_taskRepository.QueryFirst(x => x.ShuttleCarCode == ShuttleCar1.ShuttleCarCode) == null) |
| | | _taskService.AddRelocationCarTask(ShuttleCar1.ShuttleCarPosition, "", ShuttleCar1.ShuttleCarCode); |
| | | { |
| | | var dt_Task = GetTask((int)TaskCarStatusEnum.CarNew, (int)TaskOtherTypeEnum.RelocationCar); |
| | | if (dt_Task != null && string.IsNullOrEmpty(dt_Task.SourceAddress)) |
| | | { |
| | | dt_Task.SourceAddress = ShuttleCar1.ShuttleCarPosition; |
| | | dt_Task.CurrentAddress = dt_Task.SourceAddress; |
| | | dt_Task.ShuttleCarCode = ShuttleCar1.ShuttleCarCode; |
| | | _taskService.UpdateData(dt_Task); |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(dt_Task.TaskNum, "æ´æ°ç§»è½¦ä»»å¡èµ·å§å°å"); |
| | | } |
| | | else |
| | | _taskService.AddRelocationCarTask(ShuttleCar1.ShuttleCarPosition, "", ShuttleCar1.ShuttleCarCode); |
| | | } |
| | | #endregion |
| | | } |
| | | else |
| | | { |
| | |
| | | |
| | | #region è·å移车/åºå
¥åºä»»å¡ |
| | | if (command != null && |
| | | (command.Status == (short)ShuttleCarStatus.Standby || |
| | | command.Status == (short)ShuttleCarStatus.Charging) && |
| | | (command.Status == (short)ShuttleCarStatus.Standby || command.Status == (short)ShuttleCarStatus.Charging) && |
| | | command.TaskTypeComplete == (short)ShuttleCarTaskComplete.Standby && |
| | | (command.Err_Status == (short)ShuttleCarErr.Normal || |
| | | command.Err_Status == (short)ShuttleCarErr.LowBattery) |
| | | ) |
| | | (command.Err_Status == (short)ShuttleCarErr.Normal || command.Err_Status == (short)ShuttleCarErr.LowBattery)) |
| | | { |
| | | var dt_Task = GetTask(TaskRelocationStatusEnum.SC_RelocationFinish.ObjToInt(), TaskRelocationTypeEnum.Relocation.ObjToInt());//ç§»åºä»»å¡ |
| | | if (dt_Task != null && shuttleCar.DeviceCode == dt_Task.ShuttleCarCode) |
| | | SendTask(dt_Task); |
| | | else |
| | | Get_CarTask(shuttleCar, command); |
| | | //Get_CarTask(shuttleCar, command); |
| | | GetShuttleCarTask(shuttleCar, command); |
| | | } |
| | | #endregion |
| | | } |