| | |
| | | { |
| | | lock (_CarTaskObject) |
| | | { |
| | | #region è·åæ°å»ºç§»è½¦å
çµä»»å¡ |
| | | Dt_Task dt_Task = GetTask((int)CarChargingTaskEnum.CarNew, (int)TaskOtherTypeEnum.RelocationCarCharging); |
| | | if (dt_Task != null && dt_Task.ShuttleCarCode == shuttleCar.DeviceCode) |
| | | { |
| | | if (!string.IsNullOrEmpty(dt_Task.SourceAddress) && !string.IsNullOrEmpty(dt_Task.TargetAddress) && !string.IsNullOrEmpty(dt_Task.ShuttleCarCode)) |
| | | { |
| | | SendTask(dt_Task); |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region è·åæ°å»ºç§»è½¦ä»»å¡ |
| | | Dt_Task dt_Task = GetTask((int)TaskCarStatusEnum.CarNew, (int)TaskOtherTypeEnum.RelocationCar); |
| | | if (dt_Task != null) |
| | | dt_Task = GetTask((int)TaskCarStatusEnum.CarNew, (int)TaskOtherTypeEnum.RelocationCar); |
| | | if (dt_Task != null && dt_Task.ShuttleCarCode == shuttleCar.DeviceCode) |
| | | { |
| | | if (string.IsNullOrEmpty(dt_Task.SourceAddress)) |
| | | { |
| | |
| | | else if (string.IsNullOrEmpty(dt_Task.TargetAddress)) |
| | | { |
| | | #region åWMSç³è¯· |
| | | var ShuttleCar = _shuttleCarService.QueryNoCode(dt_Task.ShuttleCarCode); |
| | | WebResponseContent content = new WebResponseContent(); |
| | | var ResultData = HttpHelper.PostAsync(WMSInterfaceAddress.GetPosition + $"?position={dt_Task.SourceAddress}", "", headers: new Dictionary<string, string>()); |
| | | var ResultData = HttpHelper.PostAsync(WMSInterfaceAddress.GetPosition + $"?position={dt_Task.SourceAddress}&&position1={ShuttleCar.ShuttleCarPosition}", "", headers: new Dictionary<string, string>()); |
| | | if (ResultData.Result != null) |
| | | { |
| | | content = JsonConvert.DeserializeObject<WebResponseContent>(ResultData.Result); |
| | |
| | | if (shuttleCar != null) |
| | | { |
| | | ShuttleCarTaskCommandR command = ReadCustomer<ShuttleCarTaskCommandR>(shuttleCar, shuttleCar.DeviceCode);//读åç©¿æ¢è½¦ä¿¡æ¯ |
| | | if (command != null && command.Status == (short)ShuttleCarStatus.Standby && command.TaskTypeComplete == (short)ShuttleCarTaskComplete.Standby && command.Err_Status == (short)ShuttleCarErr.Normal) |
| | | if (command != null && command.Status == (short)ShuttleCarStatus.Standby && command.TaskTypeComplete == (short)ShuttleCarTaskComplete.Standby && (command.Err_Status == (short)ShuttleCarErr.Normal || command.Err_Status == (short)ShuttleCarErr.LowBattery)) |
| | | { |
| | | #region 夿å°è½¦ä½ç½®æ ABé¢ä¸ä¸åä»»å¡ |
| | | short Position = 0; |
| | |
| | | { |
| | | var Message = $"{shuttleCar.DeviceName}æ ABé¢"; |
| | | if (task.ExceptionMessage != Message) |
| | | { |
| | | task.ExceptionMessage = Message; |
| | | _taskService.UpdateData(task); |
| | | } |
| | | return; |
| | | } |
| | | #endregion |
| | |
| | | } |
| | | else if (task.TaskType == (int)TaskOtherTypeEnum.RelocationCarCharging) |
| | | { |
| | | shuttleCarTaskCommand.TaskType = (short)GetCarTaskType(ShuttleCarTaskType.Charging.ToString()); |
| | | shuttleCarTaskCommand.TaskType = task.TaskState == CarChargingTaskEnum.CarNew.ObjToInt() ? |
| | | (short)GetCarTaskType(task.TaskType, shuttleCarTaskCommand.Direction) : |
| | | (short)GetCarTaskType(ShuttleCarTaskType.Charging.ToString()); |
| | | } |
| | | else |
| | | shuttleCarTaskCommand.TaskType = (short)GetCarTaskType(task.TaskType, shuttleCarTaskCommand.Direction); |
| | |
| | | { |
| | | if (shuttleCar.SendCommand(shuttleCarTaskCommand, shuttleCar.DeviceCode)) |
| | | { |
| | | if (!string.IsNullOrEmpty(task.Remark)) task.Remark = task.Remark + "å·²ä¸å"; |
| | | task.TaskState = GetTaskState(task.TaskType); |
| | | if (!string.IsNullOrEmpty(task.Remark) && task.TaskState == CarChargingTaskEnum.CarNew.ObjToInt()) |
| | | task.Remark = task.Remark + "å·²ä¸å"; |
| | | task.TaskState = GetTaskState(task.TaskType, task.TaskState); |
| | | _taskService.UpdateData(task); |
| | | } |
| | | } |
| | |
| | | /// </summary> |
| | | /// <param name="TaskType"></param> |
| | | /// <returns></returns> |
| | | int GetTaskState(int TaskType) |
| | | int GetTaskState(int TaskType, int state) |
| | | { |
| | | int state = 0; |
| | | switch (TaskType) |
| | | { |
| | | case (int)TaskInboundTypeEnum.Inbound: |
| | |
| | | state = (int)TaskCarStatusEnum.ShuttleCar_Executing; |
| | | break; |
| | | case (int)TaskOtherTypeEnum.RelocationCarCharging: |
| | | state = (int)CarChargingTaskEnum.ShuttleCar_Charging; |
| | | state = state < (int)CarChargingTaskEnum.SC_CarFinish ? |
| | | (int)CarChargingTaskEnum.ShuttleCar_Executing : |
| | | (int)CarChargingTaskEnum.ShuttleCar_Charging; |
| | | break; |
| | | default: |
| | | break; |