1
dengjunjie
2025-05-08 092971a8ba7848f024427694c642959d0fbc8599
ÏîÄ¿´úÂë/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ShuttleCarJob/ShuttleCarJob.cs
@@ -14,6 +14,7 @@
using WIDESEAWCS_Core.Caches;
using WIDESEAWCS_Core.Helper;
using WIDESEAWCS_DTO.System;
using WIDESEAWCS_DTO.TaskInfo;
using WIDESEAWCS_DTO.WMSInfo;
using WIDESEAWCS_IShuttleCar;
using WIDESEAWCS_ITaskInfoRepository;
@@ -68,7 +69,7 @@
                    {
                        #region ç©¿æ¢­è½¦ä»»åŠ¡å®Œæˆ
                        var complete = shuttleCar.GetValue<ShuttleCarDBName, bool>(ShuttleCarDBName.TaskComplete);
                        if (complete && command.TaskTypeComplete > (short)ShuttleCarTaskComplete.Standby && command.Status == command.TaskTypeComplete)
                        if (complete && command.TaskTypeComplete > (short)ShuttleCarTaskComplete.Standby)
                        {
                            _taskService.ShuttleCarTaskCompleted(command.number, command.TaskTypeComplete);
                            shuttleCar.SetValue(ShuttleCarDBName.ConfirmComplete, true, shuttleCar.DeviceCode);
@@ -93,7 +94,7 @@
                                    ShuttleCarTaskCommandR command1 = ReadCustomer<ShuttleCarTaskCommandR>(shuttleCar1, shuttleCar1.DeviceCode);//读取穿梭车信息
                                    if (command1 != null && command1.JoinStatus == 1)
                                    {
                                        if (command1.Status == (short)ShuttleCarStatus.Charging && command1.ElectricQuantity >= 50)
                                        if (command1.Status == (short)ShuttleCarStatus.Charging && command1.ElectricQuantity /*> command.ElectricQuantity*/ >= 50)
                                        {
                                            shuttleCar1.SetValue(ShuttleCarDBName.TaskType, (short)ShuttleCarStatus.QuitCharging);
                                        }
@@ -102,22 +103,37 @@
                            }
                            else
                            {
                                string CarChargingStation = AppSettings.Configuration[nameof(CarChargingStation)];//充电位
                                //判断充电位是否有车
                                var ShuttleCar1 = _shuttleCarService.QueryShuttleCar("003-002-001");
                                var ShuttleCar1 = _shuttleCarService.QueryShuttleCar(CarChargingStation);
                                if (ShuttleCar1 != null && ShuttleCar1.ShuttleCarCode != shuttleCar.DeviceCode)
                                {
                                    _taskService.AddRelocationCarTask(ShuttleCar1.ShuttleCarPosition, "", ShuttleCar1.ShuttleCarCode);
                                    if (_taskRepository.QueryFirst(x => x.ShuttleCarCode == ShuttleCar1.ShuttleCarCode) == null)
                                        _taskService.AddRelocationCarTask(ShuttleCar1.ShuttleCarPosition, "", ShuttleCar1.ShuttleCarCode);
                                }
                                else
                                {
                                    _taskService.AddRelocationCarTask(ShuttleCar.ShuttleCarPosition, "003-002-001", ShuttleCar.ShuttleCarCode, ShuttleCarTaskType.Charging.ToString());
                                    _taskService.AddRelocationCarTask(ShuttleCar.ShuttleCarPosition, CarChargingStation, ShuttleCar.ShuttleCarCode, ShuttleCarTaskType.Charging.ToString());
                                }
                            }
                        }
                        #endregion
                        #region èŽ·å–ç§»è½¦/出入库任务
                        Get_CarTask(shuttleCar, command);
                        if (command != null &&
                            (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)
                            )
                        {
                            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);
                        }
                        #endregion
                    }
                }