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) {
|
||||
// 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("agvphase:" + phase + "反馈:" + data)
|
||||
.content("AGV取货点1取货完成,反馈:" + 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);
|
||||
}
|
||||
} 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) {
|
||||
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("agvphase:" + phase + "反馈:" + data)
|
||||
.content("AGV放货点1放货完成反馈:" + 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);
|
||||
}
|
||||
} 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)
|
||||
.content("AGV取货点2取货完成反馈:" + 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);
|
||||
}
|
||||
|
||||
} 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) {
|
||||
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("agvphase:" + phase + "反馈:" + data)
|
||||
.content("AGV放货点2放货完成反馈:" + 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);
|
||||
}
|
||||
} else {
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
@@ -879,12 +909,7 @@ 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);
|
||||
@@ -926,7 +951,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//上报车状态
|
||||
else if (phase == 0x74) {
|
||||
//三色灯状态
|
||||
@@ -1005,10 +1029,8 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -636,12 +636,21 @@ 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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user