充电优化

This commit is contained in:
psh
2024-07-04 14:34:06 +08:00
parent 2a013c4613
commit ecf4bac4ae
2 changed files with 15 additions and 2 deletions

View File

@@ -200,9 +200,17 @@ public class NDCAgvServiceImpl implements NDCAgvService {
//分配车辆
List<Dict> dictList= dictService.getDictByName("station");
int satation=0;
Dict temp=new Dict();
for(Dict dict : dictList){
if ("1".equals(dict.getValue())&&carno.equals(dict.getPara2())){
log.info("当前车辆{}已分配充电桩{},退出后续判断",carno,dict.getPara1());
return;
}
}
for(Dict dict : dictList){
if ("0".equals(dict.getValue())){
satation = Integer.parseInt(dict.getPara1());
temp=dict;
break;
}
}
@@ -242,6 +250,11 @@ public class NDCAgvServiceImpl implements NDCAgvService {
} catch (Exception e){
log.error("下发充电任务失败{}{}",e,e.getMessage());
}
temp.setValue("1");
temp.setPara2(String.valueOf(carno));
dictService.updateDetail(temp);
}else{
log.error("目前暂无可使用充电桩充电桩,暂不分配{}充电任务",carno);
}

View File

@@ -328,8 +328,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
//agv电量
electric_qty = ikey;
int electric = Integer.parseInt(paramService.findByCode(AcsConfig.ELECTRIC).getValue());
if (electric_qty < electric && !isCharge) {
log.info("当前车辆{}电量为{}低于40,开始充电!", this.device_code, electric_qty);
if (electric_qty < electric) {
log.info("当前车辆{}电量为{}低于{},开始判断是否需要充电!", this.device_code, electric_qty,electric);
NDCAgvService.charge(this.device_code);
isCharge =true;
}