rev:更改补空料框流程
This commit is contained in:
@@ -275,7 +275,7 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
(byte) 0X00, (byte) 0X6D,
|
||||
(byte) 0X00, (byte) 0X06,
|
||||
(byte) indexhigh, (byte) indexlow,
|
||||
(byte) 0X01, (byte) 0X10,
|
||||
(byte) 0X01, (byte) 0X12,
|
||||
(byte) phasehigh, (byte) phaselow
|
||||
};
|
||||
|
||||
@@ -368,7 +368,7 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
log.info("下发AGV充电任务--{}", str1);
|
||||
|
||||
try {
|
||||
// OneNDCSocketConnectionAutoRun.write(b);
|
||||
TwoNDCSocketConnectionAutoRun.write(b);
|
||||
} catch (Exception e) {
|
||||
log.error("下发充电任务失败{}{}", e, e.getMessage());
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.impl.InstructionServiceImpl;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.config.lucene.service.LuceneExecuteLogService;
|
||||
import org.nl.config.lucene.service.dto.LuceneLogDto;
|
||||
@@ -162,7 +163,7 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
//任务号
|
||||
int ikey = arr[26] * 256 + arr[27];
|
||||
//站点号
|
||||
int agvaddr = arr[18] * 256 + arr[19];
|
||||
int agvaddr = arr[24] * 256 + arr[25];
|
||||
//车号
|
||||
int carno = arr[20];
|
||||
//充电桩站点号
|
||||
@@ -406,6 +407,7 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
dos.flush();
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
throw new BadRequestException("下发数据失败:" + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ import org.nl.system.service.param.ISysParamService;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
|
||||
import java.time.LocalTime;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
/**
|
||||
@@ -107,7 +107,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
*/
|
||||
int ikey = arr[26] * 256 + arr[27];
|
||||
//站点号
|
||||
agvaddr = arr[18] * 256 + arr[19];
|
||||
agvaddr = arr[24] * 256 + arr[25];
|
||||
//车号
|
||||
int carno = arr[20];
|
||||
Instruction inst = null;
|
||||
@@ -231,11 +231,20 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
standardOrdinarySiteDeviceDriver.setOption(0);
|
||||
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
|
||||
if (standardInspectSiteDeviceDriver.getMove() != 0) {
|
||||
boolean flag = Optional.ofNullable(standardInspectSiteDeviceDriver.getExtraValue().get("ignore_pickup_check")).map(Object::toString).map(Boolean::parseBoolean).orElse(false);
|
||||
if (standardInspectSiteDeviceDriver.getMove() != 0 && !flag) {
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
.content("agvphase:" + phase + "反馈:" + data)
|
||||
.content("AGV到达取货点1,反馈:" + data)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
} else if (flag) {
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
.content("AGV到达取货点1,反馈:" + data)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
@@ -320,23 +329,27 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
standardOrdinarySiteDeviceDriver.setIndex(index);
|
||||
standardOrdinarySiteDeviceDriver.setInst(inst);
|
||||
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
|
||||
if (standardInspectSiteDeviceDriver.getMove() == 0 && standardInspectSiteDeviceDriver.getMode() > 0) {
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
.content("agvphase:" + phase + "反馈:" + data)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
} else {
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
.content("设备:" + device.getDevice_code() + "光电信号为" + standardInspectSiteDeviceDriver.getMove() + "工作模式为" + standardInspectSiteDeviceDriver.getMode() + ", 取货完成不允许离开")
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
}
|
||||
// standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
|
||||
// Map<String, Object> map = new HashMap<>();
|
||||
// map.put("to_command", 100);
|
||||
// try {
|
||||
// standardInspectSiteDeviceDriver.writing(map);
|
||||
// } catch (Exception e) {
|
||||
// LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
// .device_code(this.getDeviceCode())
|
||||
// .content("AGV取货点1取货完成反馈失败,失败原因:" + e.getMessage())
|
||||
// .build();
|
||||
// logDto.setLog_level(4);
|
||||
// luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
// return;
|
||||
// }
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
.content("AGV取货点1取货完成,反馈:" + data)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
} else {
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
@@ -404,7 +417,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
.content("agvphase:" + phase + "反馈:" + data)
|
||||
.content("AGV到达放货点1反馈:" + data)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
@@ -479,23 +492,33 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
standardOrdinarySiteDeviceDriver.setIndex(index);
|
||||
standardOrdinarySiteDeviceDriver.setInst(inst);
|
||||
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
|
||||
if (standardInspectSiteDeviceDriver.getMove() != 0) {
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
.content("agvphase:" + phase + "反馈:" + data)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
} else {
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
.content("设备:" + device.getDevice_code() + "光电信号为" + standardInspectSiteDeviceDriver.getMove() + ", 放货完成不允许离开")
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
if (StrUtil.isEmpty(inst.getStart_device_code2())) {
|
||||
Device start_device = deviceAppService.findDeviceByCode(inst.getStart_device_code());
|
||||
if (start_device != null && start_device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
|
||||
//如果是两点任务 当AGV放货完成的时候,给起点反馈放货完成
|
||||
StandardInspectSiteDeviceDriver start_standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) start_device.getDeviceDriver();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("to_command", 100);
|
||||
try {
|
||||
start_standardInspectSiteDeviceDriver.writing(map);
|
||||
} catch (Exception e) {
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
.content("AGV取货点1放货完成反馈失败,失败原因:" + e.getMessage())
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
.content("AGV放货点1放货完成反馈:" + data)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
} else {
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
@@ -564,11 +587,20 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
standardOrdinarySiteDeviceDriver.setOption(0);
|
||||
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
|
||||
if (standardInspectSiteDeviceDriver.getMove() != 0) {
|
||||
boolean flag = Optional.ofNullable(standardInspectSiteDeviceDriver.getExtraValue().get("ignore_pickup_check")).map(Object::toString).map(Boolean::parseBoolean).orElse(false);
|
||||
if (standardInspectSiteDeviceDriver.getMove() != 0 && !flag) {
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
.content("agvphase:" + phase + "反馈:" + data)
|
||||
.content("AGV到达取货点2反馈:" + data)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
} else if (flag) {
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
.content("AGV到达取货点2反馈:" + data)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
@@ -652,23 +684,14 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
standardOrdinarySiteDeviceDriver.setIndex(index);
|
||||
standardOrdinarySiteDeviceDriver.setInst(inst);
|
||||
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
|
||||
if (standardInspectSiteDeviceDriver.getMove() == 0 && standardInspectSiteDeviceDriver.getMode() > 0) {
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
.content("agvphase:" + phase + "反馈:" + data)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
} else {
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
.content("设备:" + device.getDevice_code() + "光电信号为" + standardInspectSiteDeviceDriver.getMove() + "工作模式为" + standardInspectSiteDeviceDriver.getMode() + ", 取货完毕,不允许离开")
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
}
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
.content("AGV取货点2取货完成反馈:" + data)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
|
||||
} else {
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
@@ -735,7 +758,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
.content("agvphase:" + phase + "反馈:" + data)
|
||||
.content("AGV到达放货点2反馈:" + data)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
@@ -806,25 +829,32 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
standardOrdinarySiteDeviceDriver.setOption(0);
|
||||
|
||||
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
|
||||
if (standardInspectSiteDeviceDriver.getMove() != 0) {
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
.content("agvphase:" + phase + "反馈:" + data)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
} else {
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
.content("设备:" + device.getDevice_code() + "光电信号为" + standardInspectSiteDeviceDriver.getMove() + ", 放货完成不允许离开")
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
Device start_device = deviceAppService.findDeviceByCode(inst.getStart_device_code());
|
||||
if (start_device != null && start_device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
|
||||
//如果是两点任务 当AGV放货完成的时候,给起点反馈放货完成
|
||||
StandardInspectSiteDeviceDriver start_standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) start_device.getDeviceDriver();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("to_command", 100);
|
||||
try {
|
||||
start_standardInspectSiteDeviceDriver.writing(map);
|
||||
} catch (Exception e) {
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
.content("AGV取货点1放货完成反馈失败,失败原因:" + e.getMessage())
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
return;
|
||||
}
|
||||
}
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
.content("AGV放货点2放货完成反馈:" + data)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
} else {
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
@@ -879,49 +909,43 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
//自动充电的车号
|
||||
String is_atuo_car = ISysParamService.findByCode(AcsConfig.IS_ATUO_CAR).getValue();
|
||||
//当前上报的车号
|
||||
String now_car = String.valueOf(this.agvaddr);
|
||||
//如果配置的车号是诺宝车号
|
||||
if (now_car.equals(is_atuo_car)) {
|
||||
//是否开启自动充电
|
||||
String is_atuo_electric = ISysParamService.findByCode(AcsConfig.IS_ATUO_ELECTRIC).getValue();
|
||||
log.info("接收agv上报信息,is_atuo_electric:" + is_atuo_electric);
|
||||
if ("1".equals(is_atuo_electric)) {
|
||||
String electric_begin = ISysParamService.findByCode(AcsConfig.ELECTRIC_BEGIN).getValue();
|
||||
String[] begins = electric_begin.split(":");
|
||||
String electric_end = ISysParamService.findByCode(AcsConfig.ELECTRIC_END).getValue();
|
||||
String[] ends = electric_end.split(":");
|
||||
// 定义时间段
|
||||
LocalTime startTime = LocalTime.of(Integer.parseInt(begins[0]), Integer.parseInt(begins[1])); // 上午8点
|
||||
LocalTime endTime = LocalTime.of(Integer.parseInt(ends[0]), Integer.parseInt(ends[1])); // 晚上22点
|
||||
// 获取当前时间
|
||||
LocalTime now = LocalTime.now();
|
||||
// 判断当前时间是否在时间段内
|
||||
boolean isInRange = !now.isBefore(startTime) && !now.isAfter(endTime);
|
||||
int electric = 0;
|
||||
//早上8-22点
|
||||
if (isInRange) {
|
||||
electric = Integer.parseInt(ISysParamService.findByCode(AcsConfig.ELECTRIC).getValue());
|
||||
//是否开启自动充电
|
||||
String is_atuo_electric = ISysParamService.findByCode(AcsConfig.IS_ATUO_ELECTRIC).getValue();
|
||||
log.info("接收agv上报信息,is_atuo_electric:" + is_atuo_electric);
|
||||
if ("1".equals(is_atuo_electric)) {
|
||||
String electric_begin = ISysParamService.findByCode(AcsConfig.ELECTRIC_BEGIN).getValue();
|
||||
String[] begins = electric_begin.split(":");
|
||||
String electric_end = ISysParamService.findByCode(AcsConfig.ELECTRIC_END).getValue();
|
||||
String[] ends = electric_end.split(":");
|
||||
// 定义时间段
|
||||
LocalTime startTime = LocalTime.of(Integer.parseInt(begins[0]), Integer.parseInt(begins[1])); // 上午8点
|
||||
LocalTime endTime = LocalTime.of(Integer.parseInt(ends[0]), Integer.parseInt(ends[1])); // 晚上22点
|
||||
// 获取当前时间
|
||||
LocalTime now = LocalTime.now();
|
||||
// 判断当前时间是否在时间段内
|
||||
boolean isInRange = !now.isBefore(startTime) && !now.isAfter(endTime);
|
||||
int electric = 0;
|
||||
//早上8-22点
|
||||
if (isInRange) {
|
||||
electric = Integer.parseInt(ISysParamService.findByCode(AcsConfig.ELECTRIC).getValue());
|
||||
} else {
|
||||
electric = Integer.parseInt(ISysParamService.findByCode(AcsConfig.ELECTRIC2).getValue());
|
||||
}
|
||||
if (electric_qty > 0 && electric_qty < electric) {
|
||||
log.info("当前车辆{}电量为{}低于{},开始判断是否需要充电!", this.agvaddr, electric_qty, electric);
|
||||
//判断是否已下发充电任务
|
||||
Dict dict1 = dictService.getDictByName3("station", String.valueOf(this.agvaddr), null);
|
||||
if (ObjectUtil.isNotEmpty(dict1)) {
|
||||
log.info("当前车辆{}已分配充电桩{},退出后续判断", this.agvaddr, dict1.getPara1());
|
||||
} else {
|
||||
electric = Integer.parseInt(ISysParamService.findByCode(AcsConfig.ELECTRIC2).getValue());
|
||||
}
|
||||
if (electric_qty > 0 && electric_qty < electric) {
|
||||
log.info("当前车辆{}电量为{}低于{},开始判断是否需要充电!", this.agvaddr, electric_qty, electric);
|
||||
//判断是否已下发充电任务
|
||||
Dict dict1 = dictService.getDictByName3("station", String.valueOf(this.agvaddr), null);
|
||||
if (ObjectUtil.isNotEmpty(dict1)) {
|
||||
log.info("当前车辆{}已分配充电桩{},退出后续判断", this.agvaddr, dict1.getPara1());
|
||||
//未下发,判断是否有空闲充电桩
|
||||
Dict dict = dictService.getDictByName2("station");
|
||||
if (ObjectUtil.isNotEmpty(dict)) {
|
||||
ndcAgvService.charge(String.valueOf(this.agvaddr));
|
||||
isCharge = true;
|
||||
} else {
|
||||
//未下发,判断是否有空闲充电桩
|
||||
Dict dict = dictService.getDictByName2("station");
|
||||
if (ObjectUtil.isNotEmpty(dict)) {
|
||||
ndcAgvService.charge(String.valueOf(this.agvaddr));
|
||||
isCharge = true;
|
||||
} else {
|
||||
log.info("当前车辆{}电量为{}低于{},但无空闲充电桩!", this.agvaddr, electric_qty, electric);
|
||||
}
|
||||
log.info("当前车辆{}电量为{}低于{},但无空闲充电桩!", this.agvaddr, electric_qty, electric);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1005,9 +1029,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
if (StrUtil.equals(inst.getAgv_system_type(), "2")) {
|
||||
TwoNDCSocketConnectionAutoRun.write(data);
|
||||
}
|
||||
TwoNDCSocketConnectionAutoRun.write(data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public class ItemProtocol {
|
||||
setIsonline(true);
|
||||
return value;
|
||||
}
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.nl.acs.task.enums.AgvSystemTypeEnum;
|
||||
import org.nl.acs.task.enums.TaskTypeEnum;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.config.lucene.service.LuceneExecuteLogService;
|
||||
import org.nl.config.lucene.service.dto.LuceneLogDto;
|
||||
@@ -114,7 +115,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.log_level(4)
|
||||
.content("信号: move由" + this.last_mode + "->" + this.mode)
|
||||
.content("信号: move由" + this.last_move + "->" + this.move)
|
||||
.build());
|
||||
}
|
||||
|
||||
@@ -122,7 +123,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.log_level(4)
|
||||
.content("信号: mix_code由" + this.last_mode + "->" + this.mode)
|
||||
.content("信号: mix_code由" + this.last_mix_code + "->" + this.mix_code)
|
||||
.build());
|
||||
}
|
||||
|
||||
@@ -211,10 +212,17 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
instructionService.cancelInstAndTaskByDeviceCode(this.device_code);
|
||||
} catch (Exception e) {
|
||||
this.message = "取消指令和任务时出现异常";
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("to_command", 400);
|
||||
this.writing(map);
|
||||
try {
|
||||
Thread.sleep(3000);
|
||||
} catch (InterruptedException ex) {
|
||||
}
|
||||
return;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("to_command", 200);
|
||||
map.put("to_command", 300);
|
||||
this.writing(map);
|
||||
this.requireSuccess = true;
|
||||
}
|
||||
@@ -252,7 +260,16 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
taskService.create(taskDto);
|
||||
} catch (Exception e) {
|
||||
this.message = "创建任务时出现异常";
|
||||
return;
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content(this.device_code + "创建任务异常:" + Arrays.toString(e.getStackTrace()))
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
try {
|
||||
Thread.sleep(3000);
|
||||
} catch (InterruptedException ex) {
|
||||
}
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("to_command", 200);
|
||||
@@ -275,7 +292,16 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
taskService.create(taskDto);
|
||||
} catch (Exception e) {
|
||||
this.message = "创建任务时出现异常";
|
||||
return;
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content(this.device_code + "创建任务异常:" + Arrays.toString(e.getStackTrace()))
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
try {
|
||||
Thread.sleep(3000);
|
||||
} catch (InterruptedException ex) {
|
||||
}
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("to_command", 200);
|
||||
@@ -289,31 +315,40 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
private void createXLKBKTask() {
|
||||
List<String> cxBkDeviceList = this.getExtraDeviceCodes("cxBkDeviceList");
|
||||
if (CollectionUtils.isEmpty(cxBkDeviceList)) {
|
||||
this.message = "未配置产线补空设备";
|
||||
this.message = "未配置产线补空终点设备设备";
|
||||
return;
|
||||
}
|
||||
String startDeviceCode = null;
|
||||
String nextDeviceCode = null;
|
||||
for (int i = 0; i < cxBkDeviceList.size(); i++) {
|
||||
String cxBkDeviceCode = cxBkDeviceList.get(i);
|
||||
Device cxBkDevice = deviceAppService.findDeviceByCode(cxBkDeviceCode);
|
||||
if (cxBkDevice != null && cxBkDevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) cxBkDevice.getDeviceDriver();
|
||||
if (standardInspectSiteDeviceDriver.getMove() > 0) {
|
||||
startDeviceCode = cxBkDeviceCode;
|
||||
if (standardInspectSiteDeviceDriver.getMove() == 0 && standardInspectSiteDeviceDriver.getMode() > 0) {
|
||||
nextDeviceCode = cxBkDeviceCode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (startDeviceCode == null) {
|
||||
if (nextDeviceCode == null) {
|
||||
this.message = "未找到符合条件的起点设备";
|
||||
return;
|
||||
}
|
||||
TaskDto taskDto = this.packageTaskDto(TaskTypeEnum.TWO_AGV_Task.getIndex(), startDeviceCode, this.device_code);
|
||||
TaskDto taskDto = this.packageTaskDto(TaskTypeEnum.TWO_AGV_Task.getIndex(), this.device_code, nextDeviceCode);
|
||||
try {
|
||||
taskService.create(taskDto);
|
||||
} catch (Exception e) {
|
||||
this.message = "创建任务时出现异常";
|
||||
return;
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content(this.device_code + "创建任务异常:" + Arrays.toString(e.getStackTrace()))
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
try {
|
||||
Thread.sleep(3000);
|
||||
} catch (InterruptedException ex) {
|
||||
}
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("to_command", 200);
|
||||
@@ -334,6 +369,15 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
for (int i = 0; i < rgBkDeviceList.size(); i++) {
|
||||
String rgBkDeviceCode = rgBkDeviceList.get(i);
|
||||
Device rgBkDevice = deviceAppService.findDeviceByCode(rgBkDeviceCode);
|
||||
|
||||
TaskDto satrtTaskDto = taskService.findByStartCode(rgBkDeviceCode);
|
||||
if (ObjectUtil.isNotEmpty(satrtTaskDto)) {
|
||||
continue;
|
||||
}
|
||||
TaskDto endTaskDto = taskService.findByNextCode(this.device_code);
|
||||
if (ObjectUtil.isNotEmpty(endTaskDto)) {
|
||||
break;
|
||||
}
|
||||
if (rgBkDevice != null && rgBkDevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) rgBkDevice.getDeviceDriver();
|
||||
if (standardInspectSiteDeviceDriver.getMove() > 0) {
|
||||
@@ -348,6 +392,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
}
|
||||
TaskDto taskDto = this.packageTaskDto(TaskTypeEnum.TWO_AGV_Task.getIndex(), startDeviceCode, this.device_code);
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
taskService.create(taskDto);
|
||||
} catch (Exception e) {
|
||||
this.message = "创建任务时出现异常";
|
||||
@@ -420,7 +465,16 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
taskService.create(taskDto);
|
||||
} catch (Exception e) {
|
||||
this.message = "创建任务时出现异常";
|
||||
return;
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content(this.device_code + "创建任务异常:" + Arrays.toString(e.getStackTrace()))
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
try {
|
||||
Thread.sleep(3000);
|
||||
} catch (InterruptedException ex) {
|
||||
}
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("to_command", 200);
|
||||
@@ -473,10 +527,18 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
this.checkcontrol(itemMap);
|
||||
} catch (Exception e) {
|
||||
this.message = "下发信号时出现异常";
|
||||
luceneExecuteLogService.deviceExecuteLog(new LuceneLogDto(this.getDeviceCode(), "下发多个电气信号 " + itemMap + "失败, 原因: " + Arrays.toString(e.getStackTrace())));
|
||||
return;
|
||||
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.log_level(4)
|
||||
.content("下发信号:" + itemMap + "失败, 原因:" + e.getMessage())
|
||||
.build());
|
||||
throw new BadRequestException(e.getMessage());
|
||||
}
|
||||
luceneExecuteLogService.deviceExecuteLog(new LuceneLogDto(this.getDeviceCode(), "下发多个电气信号 " + itemMap + "成功"));
|
||||
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.log_level(4)
|
||||
.content("下发信号:" + itemMap + "成功")
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -461,7 +461,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
}
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "2")) {
|
||||
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
|
||||
ndcAgvService.sendAgvInstToNDC( dto);
|
||||
ndcAgvService.sendAgvInstToNDC(dto);
|
||||
}
|
||||
//判断是否是仙工AGV
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) {
|
||||
@@ -636,18 +636,27 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
dto.setSend_status("1");
|
||||
}
|
||||
} else if (dto.getAgv_system_type().equals(AgvSystemTypeEnum.One_NDC_System_Type.getIndex())) {
|
||||
//一楼agv任务创建运单序列
|
||||
HttpResponse response = xiangGongAgvService.sendOrderSequencesToXZ(dto);
|
||||
if (ObjectUtils.isEmpty(response) || response.getStatus() != 200) {
|
||||
dto.setSend_status("2");
|
||||
} else {
|
||||
log.warn("下发AGV指令数据," + "指令号:" + dto.getInstruction_code() + ",AGV系统类型:" + dto.getAgv_system_type());
|
||||
try {
|
||||
ndcAgvService.sendAgvInstToNDC(dto);
|
||||
dto.setSend_status("1");
|
||||
} catch (Exception e) {
|
||||
dto.setSend_status("2");
|
||||
dto.setRemark(e.getMessage());
|
||||
e.printStackTrace();
|
||||
log.warn("下发AGV指令异常:" + e);
|
||||
LuceneLogDto logDto1 = LuceneLogDto.builder()
|
||||
.device_code(start_device_code)
|
||||
.content("下发AGV指令异常")
|
||||
.build();
|
||||
logDto1.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto1);
|
||||
}
|
||||
} else if (dto.getAgv_system_type().equals(AgvSystemTypeEnum.Two_NDC_System_Type.getIndex())) {
|
||||
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
|
||||
log.warn("下发AGV指令数据," + "指令号:" + dto.getInstruction_code() + ",AGV系统类型:" + dto.getAgv_system_type());
|
||||
try {
|
||||
ndcAgvService.sendAgvInstToNDC( dto);
|
||||
ndcAgvService.sendAgvInstToNDC(dto);
|
||||
dto.setSend_status("1");
|
||||
} catch (Exception e) {
|
||||
dto.setSend_status("2");
|
||||
|
||||
@@ -1040,7 +1040,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
this.feedWmsTaskStatus(entity);
|
||||
//关闭仙工运单序列
|
||||
if (StrUtil.equals(task.getTask_type(), TaskTypeEnum.Standard_AGV_Task.getCode()) && (StrUtil.equals(task.getAgv_system_type(), AgvSystemTypeEnum.One_NDC_System_Type.getCode()) || StrUtil.equals(task.getAgv_system_type(), AgvSystemTypeEnum.XG_System_Type.getCode()))) {
|
||||
this.markComplete(entity);
|
||||
//this.markComplete(entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ public class AutoCreateInst {
|
||||
* 创建指令前需要判断是否条件具备:起始位置是否有货、目标位置是否有货
|
||||
*/
|
||||
public void run() throws Exception {
|
||||
log.info("自动生成指令"+DateUtil.now());
|
||||
log.info("自动生成指令" + DateUtil.now());
|
||||
TaskService taskserver = SpringContextHolder.getBean(TaskService.class);
|
||||
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
|
||||
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class);
|
||||
@@ -115,7 +115,7 @@ public class AutoCreateInst {
|
||||
boolean flag = false;
|
||||
for (int m = 0; m < pathlist.size(); m++) {
|
||||
if (pathlist.get(m).equals(start_device_code)) {
|
||||
if("1".equals(acsTask.getTask_type()) && !pathlist.get(m+1).equals(next_device_code)){
|
||||
if ("1".equals(acsTask.getTask_type()) && !pathlist.get(m + 1).equals(next_device_code)) {
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
@@ -174,7 +174,7 @@ public class AutoCreateInst {
|
||||
instdto.setNext_height(next_height);
|
||||
instdto.setAgv_action_type(agvActionType);
|
||||
try {
|
||||
instructionService.create(instdto);
|
||||
instructionService.create(instdto);
|
||||
} catch (Exception e) {
|
||||
acsTask.setRemark(e.getMessage());
|
||||
taskserver.updateByCodeFromCache(acsTask);
|
||||
@@ -186,11 +186,11 @@ public class AutoCreateInst {
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
continue;
|
||||
}
|
||||
//创建指令后修改任务状态
|
||||
acsTask.setTask_status(TaskStatusEnum.BUSY.getIndex());
|
||||
acsTask.setUpdate_time(DateUtil.now());
|
||||
acsTask.setRemark(" ");
|
||||
taskserver.update(acsTask);
|
||||
//创建指令后修改任务状态
|
||||
acsTask.setTask_status(TaskStatusEnum.BUSY.getIndex());
|
||||
acsTask.setUpdate_time(DateUtil.now());
|
||||
acsTask.setRemark(" ");
|
||||
taskserver.update(acsTask);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user