| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ghgande.j2mod.modbus.facade.ModbusTCPMaster; |
| | | import com.zy.acs.charge.ChargeCoreService; |
| | | import com.zy.acs.common.constant.RedisConstant; |
| | | import com.zy.acs.common.enums.AgvStatusType; |
| | | import com.zy.acs.common.utils.RedisSupport; |
| | |
| | | import com.zy.acs.manager.common.domain.PageResult; |
| | | import com.zy.acs.manager.core.cache.CoreCache; |
| | | import com.zy.acs.manager.core.domain.VehicleDto; |
| | | import com.zy.acs.manager.core.service.ChargeService; |
| | | import com.zy.acs.manager.core.service.astart.MapDataDispatcher; |
| | | import com.zy.acs.manager.manager.controller.result.AgvResult; |
| | | import com.zy.acs.manager.manager.entity.*; |
| | | import com.zy.acs.manager.manager.enums.FuncStaType; |
| | | import com.zy.acs.manager.manager.entity.Agv; |
| | | import com.zy.acs.manager.manager.entity.AgvDetail; |
| | | import com.zy.acs.manager.manager.entity.AgvModel; |
| | | import com.zy.acs.manager.manager.entity.Segment; |
| | | import com.zy.acs.manager.manager.enums.SegmentStateType; |
| | | import com.zy.acs.manager.manager.mapper.AgvMapper; |
| | | import com.zy.acs.manager.manager.service.*; |
| | |
| | | private AreaAgvService areaAgvService; |
| | | @Autowired |
| | | private MapDataDispatcher mapDataDispatcher; |
| | | @Autowired |
| | | private FuncStaService funcStaService; |
| | | @Autowired |
| | | private ChargeService chargeService; |
| | | @Autowired |
| | | private ChargeCoreService chargeCoreService; |
| | | @Autowired |
| | | private AgvService agvService; |
| | | |
| | | |
| | | @PostConstruct |
| | | public void init() { |
| | |
| | | return false; |
| | | } |
| | | } |
| | | if (judgeAutoStopCharge(agvModel, agvDetail,agvService.getById(agvId))) { |
| | | log.warn("[{}]号Agv需要断充操作,无法执行任务......", agvNo); |
| | | return false; |
| | | } |
| | | if (agvDetail.getAgvStatus().equals(AgvStatusType.CHARGE)) { |
| | | if (agvDetail.getSoc() < agvModel.getQuaBattery()) { |
| | | return false; |
| | |
| | | |
| | | AgvModel agvModel = agvModelService.getByAgvId(agvId); |
| | | return Math.max(agvModel.getBackpack() - usedSlots, 0); // if less than zero, then return zero |
| | | } |
| | | |
| | | /** |
| | | * 判断充电过程,自动断开 |
| | | * @param agvModel |
| | | * @param agvDetail |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Boolean judgeAutoStopCharge(AgvModel agvModel, AgvDetail agvDetail, Agv agv ) { |
| | | if (redis.getMap(RedisConstant.AGV_CHARGE_FLAG, agv.getUuid()) != null){ |
| | | return true; |
| | | } |
| | | // 手动充电模式,跳过 |
| | | // if (agvModel.getNeedUndocking() != null && agvModel.getNeedUndockingBool()) { |
| | | // FuncSta funcSta = funcStaService.getByCodeAndType(agvDetail.getCode(), FuncStaType.CHARGE.toString()); |
| | | // ModbusTCPMaster modbusTCPMaster = chargeService.get(funcSta.getUuid()); |
| | | // // 手动充电模式,跳过 |
| | | // if (modbusTCPMaster != null && chargeCoreService.getChargeMode(modbusTCPMaster) == 1) { |
| | | // return true; |
| | | // } |
| | | // } |
| | | return false; |
| | | } |
| | | |
| | | } |