Browse Source

master备份1

master2
涂强 1 month ago
parent
commit
f966c662f0
  1. 555
      acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java

555
acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java

@ -169,17 +169,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
//普通站点 //普通站点
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver; StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
//纸管抓取位
PaperTubePickSiteDeviceDriver paperTubePickSiteDeviceDriver;
//标准-光电检测
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
//烘箱对接位
HongXiangStationDeviceDriver hongXiangStationDeviceDriver;
//行架-agv对接位
ManipulatorAgvStationDeviceDriver manipulatorAgvStationDeviceDriver;
//废箔称重位
WasteFoilWeighingStationDriver wasteFoilWeighingStationDriver;
if (phase == 0x02) { if (phase == 0x02) {
if (ObjectUtil.isEmpty(inst)) { if (ObjectUtil.isEmpty(inst)) {
@ -320,223 +309,18 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
log.info("日志检查!" + device.getExtraValue().get("wait") + standardOrdinarySiteDeviceDriver.getOption()); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
if (ObjectUtil.isNotEmpty(device.getExtraValue().get("wait")) LuceneLogDto logDto = LuceneLogDto.builder()
&& StrUtil.equals("true", device.getExtraValue().get("wait").toString())) { .device_code(this.getDeviceCode())
if (standardOrdinarySiteDeviceDriver.getOption() == 1) { .content("agvphase:" + phase + "反馈:" + data)
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); .build();
LuceneLogDto logDto = LuceneLogDto.builder() logDto.setLog_level(4);
.device_code(this.getDeviceCode()) luceneExecuteLogService.deviceExecuteLog(logDto);
.content("agvphase:" + phase + "反馈:" + data) standardOrdinarySiteDeviceDriver.setAgvphase(phase);
.build(); standardOrdinarySiteDeviceDriver.setIndex(index);
logDto.setLog_level(4); standardOrdinarySiteDeviceDriver.setInst(inst);
luceneExecuteLogService.deviceExecuteLog(logDto);
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
standardOrdinarySiteDeviceDriver.setIndex(index);
standardOrdinarySiteDeviceDriver.setInst(inst);
}
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} }
} }
// 取货完毕
//(Itype=1、3,需要WCS反馈)
// else if (phase == 0x0A) {
// if (agvaddr == 0) {
// agvaddr = agvaddr_copy;
// }
// if (agvaddr < 1) {
// LuceneLogDto logDto = LuceneLogDto.builder()
// .device_code(device_code)
// .content("agv地址参数有误,phase:" + phase)
// .build();
// logDto.setLog_level(4);
// luceneExecuteLogService.deviceExecuteLog(logDto);
// return;
// }
// if (agvaddr != 0) {
// CommonFinalParam commonFinalParam = new CommonFinalParam();
// old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
// if (StrUtil.contains(old_device_code, commonFinalParam.getBARRE())) {
// String[] point = old_device_code.split(commonFinalParam.getBARRE());
// device_code = point[0];
// } else if (StrUtil.contains(old_device_code, commonFinalParam.getPOINT())) {
// String[] point = old_device_code.split("\\.");
// device_code = point[0];
// emptyNum = point[1];
// } else {
// device_code = old_device_code;
// }
// }
//
// device = deviceAppService.findDeviceByCode(device_code);
// if (ObjectUtil.isEmpty(device_code)) {
// log.info(agvaddr + "对应设备号为空!");
// return;
// }
// if (ObjectUtil.isEmpty(inst)) {
// log.info("未找到指令号{}对应的指令", ikey);
// return;
// }
// String agv_inst_type = inst.getAgv_inst_type();
// if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
// standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
// if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait"))
// && StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString())) {
// standardOrdinarySiteDeviceDriver.setOption(0);
// } else {
// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
// LuceneLogDto logDto = LuceneLogDto.builder()
// .device_code(this.getDeviceCode())
// .content("agvphase:" + phase + "反馈:" + data)
// .build();
// logDto.setLog_level(4);
// luceneExecuteLogService.deviceExecuteLog(logDto);
// }
// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
// standardOrdinarySiteDeviceDriver.setAgvphase(phase);
// standardOrdinarySiteDeviceDriver.setIndex(index);
// standardOrdinarySiteDeviceDriver.setInst(inst);
// LuceneLogDto logDto = LuceneLogDto.builder()
// .device_code(this.getDeviceCode())
// .content("agvphase:" + phase + "反馈:" + data)
// .build();
// logDto.setLog_level(4);
// luceneExecuteLogService.deviceExecuteLog(logDto);
// String task_code = inst.getTask_code();
// if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("feedbackToLms"))
// && StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("feedbackToLms").toString())) {
// JSONObject jsonObject = new JSONObject();
// jsonObject.put("task_code", task_code);
// LuceneLogDto logDto1 = LuceneLogDto.builder()
// .device_code(standardOrdinarySiteDeviceDriver.getDevice_code())
// .content("取货完成反馈:" + jsonObject.toJSONString() + ";设备:" + standardOrdinarySiteDeviceDriver.getDeviceCode())
// .build();
// logDto1.setLog_level(4);
// luceneExecuteLogService.deviceExecuteLog(logDto1);
// acsToWmsService.actionFinishRequest2(jsonObject);
// }
//
// } else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) {
// hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver();
// try {
// hongXiangStationDeviceDriver.writing(0);
// } catch (Exception e) {
// e.printStackTrace();
// }
// if (hongXiangStationDeviceDriver.getMove() == 0) {
// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
// LuceneLogDto logDto = LuceneLogDto.builder()
// .device_code(this.getDeviceCode())
// .content("agvphase:" + phase + "反馈:" + data)
// .build();
// logDto.setLog_level(4);
// luceneExecuteLogService.deviceExecuteLog(logDto);
// } else {
// message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",指令号:" + ikey + "不满足取货条件";
// LuceneLogDto logDto = LuceneLogDto.builder()
// .device_code(this.getDeviceCode())
// .content(message)
// .build();
// logDto.setLog_level(4);
// luceneExecuteLogService.deviceExecuteLog(logDto);
// }
// } else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
// manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver();
// try {
// manipulatorAgvStationDeviceDriver.writing(3);
// } catch (Exception e) {
// e.printStackTrace();
// }
// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
// LuceneLogDto logDto = LuceneLogDto.builder()
// .device_code(this.getDeviceCode())
// .content("agvphase:" + phase + "反馈:" + data)
// .build();
// logDto.setLog_level(4);
// luceneExecuteLogService.deviceExecuteLog(logDto);
// String task_code = inst.getTask_code();
// if (ObjectUtil.isNotEmpty(manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("feedbackToLms"))
// && StrUtil.equals("true", manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("feedbackToLms").toString())) {
// JSONObject jsonObject = new JSONObject();
// jsonObject.put("task_code", task_code);
// LuceneLogDto logDto1 = LuceneLogDto.builder()
// .device_code(manipulatorAgvStationDeviceDriver.getDevice_code())
// .content("取货完成反馈:" + jsonObject.toJSONString() + ";设备:" + manipulatorAgvStationDeviceDriver.getDeviceCode())
// .build();
// logDto1.setLog_level(4);
// luceneExecuteLogService.deviceExecuteLog(logDto1);
// acsToWmsService.actionFinishRequest2(jsonObject);
// }
// } else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) {
// paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver();
// try {
// paperTubePickSiteDeviceDriver.writing(3);
// } catch (Exception e) {
// e.printStackTrace();
// }
// if (paperTubePickSiteDeviceDriver.getAction() == 1
// && paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) {
// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
// LuceneLogDto logDto = LuceneLogDto.builder()
// .device_code(this.getDeviceCode())
// .content("agvphase:" + phase + "反馈:" + data)
// .build();
// logDto.setLog_level(4);
// luceneExecuteLogService.deviceExecuteLog(logDto);
// } else {
// message = "设备号:" + device_code + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
// LuceneLogDto logDto = LuceneLogDto.builder()
// .device_code(this.getDeviceCode())
// .content(message)
// .build();
// logDto.setLog_level(4);
// luceneExecuteLogService.deviceExecuteLog(logDto);
// }
// } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
// standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
//
// try {
// standardInspectSiteDeviceDriver.writing(1);
// } catch (Exception e) {
// e.printStackTrace();
// }
// if ((standardInspectSiteDeviceDriver.getMove() == 1 && standardInspectSiteDeviceDriver.getAction() == 1 && standardInspectSiteDeviceDriver.getError() == 0)) {
// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
// LuceneLogDto logDto = LuceneLogDto.builder()
// .device_code(this.getDeviceCode())
// .content("agvphase:" + phase + "反馈:" + data)
// .build();
// logDto.setLog_level(4);
// luceneExecuteLogService.deviceExecuteLog(logDto);
// } else {
// message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction() + "报警信号:" + standardInspectSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
// LuceneLogDto logDto = LuceneLogDto.builder()
// .device_code(this.getDeviceCode())
// .content(message)
// .build();
// logDto.setLog_level(4);
// luceneExecuteLogService.deviceExecuteLog(logDto);
// }
// } else {
// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
// LuceneLogDto logDto = LuceneLogDto.builder()
// .device_code(this.getDeviceCode())
// .content("agvphase:" + phase + "反馈:" + data)
// .build();
// logDto.setLog_level(4);
// luceneExecuteLogService.deviceExecuteLog(logDto);
// }
//
// }
// 到达放货点 // 到达放货点
//(Itype=1/2/3,需要WCS反馈) //(Itype=1/2/3,需要WCS反馈)
@ -579,39 +363,8 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
} }
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
log.info("日志检查!" + device.getExtraValue().get("wait") + standardOrdinarySiteDeviceDriver.getOption()); //卸货确认
if (ObjectUtil.isNotEmpty(device.getExtraValue().get("wait")) if (standardOrdinarySiteDeviceDriver.getOption() == 2) {
&& StrUtil.equals("true", device.getExtraValue().get("wait").toString())) {
if (standardOrdinarySiteDeviceDriver.getOption() == 1) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
standardOrdinarySiteDeviceDriver.setIndex(index);
standardOrdinarySiteDeviceDriver.setInst(inst);
}
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) {
paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver();
try {
paperTubePickSiteDeviceDriver.writing(4);
} catch (Exception e) {
e.printStackTrace();
}
if (paperTubePickSiteDeviceDriver.getAction() == 1
&& paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder() LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode()) .device_code(this.getDeviceCode())
@ -619,120 +372,18 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
.build(); .build();
logDto.setLog_level(4); logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto); luceneExecuteLogService.deviceExecuteLog(logDto);
standardOrdinarySiteDeviceDriver.setOption(0);
} else { } else {
message = "设备号:" + device_code + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("等待一体机进行卸货确认,设备号{},option值{}", standardOrdinarySiteDeviceDriver.getDevice_code(), standardOrdinarySiteDeviceDriver.getOption());
log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},设备状态{},不满足放货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction() logServer.deviceExecuteLog(this.device_code, "", "", "等待一体机进行卸货确认,设备号" + device.getDevice_code() + ",指令号" + ikey);
, paperTubePickSiteDeviceDriver.getError(), paperTubePickSiteDeviceDriver.getMode(), ikey);
LuceneLogDto logDto = LuceneLogDto.builder() LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode()) .device_code(standardOrdinarySiteDeviceDriver.getDevice_code())
.content(message) .content("等待一体机进行卸货确认,设备号" + standardOrdinarySiteDeviceDriver.getDevice_code() + ",option当前值" + standardOrdinarySiteDeviceDriver.getOption())
.build(); .build();
logDto.setLog_level(4); logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto); luceneExecuteLogService.deviceExecuteLog(logDto);
} }
} else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver();
try {
manipulatorAgvStationDeviceDriver.writing(4);
} catch (Exception e) {
e.printStackTrace();
}
if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
} else {
message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件";
log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", device_code, manipulatorAgvStationDeviceDriver.getAction(), ikey);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(manipulatorAgvStationDeviceDriver.getDeviceCode())
.content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1")
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) {
hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver();
try {
hongXiangStationDeviceDriver.writing(1);
} catch (Exception e) {
e.printStackTrace();
}
if (hongXiangStationDeviceDriver.getMove() == 0) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
} else {
message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",动作信号:" + hongXiangStationDeviceDriver.getAction() + "报警信号:" + hongXiangStationDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, hongXiangStationDeviceDriver.getMove(), hongXiangStationDeviceDriver.getAction()
, hongXiangStationDeviceDriver.getError(), ikey);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content(message)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
standardInspectSiteDeviceDriver.writing(1);
if ((standardInspectSiteDeviceDriver.getMove() == 0 && standardInspectSiteDeviceDriver.getAction() == 1 && standardInspectSiteDeviceDriver.getError() == 0)) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
} else {
message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction() + "报警信号:" + standardInspectSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足放货条件";
log.info("设备{}当前光电信号{},动作信号{} ,报警信号{},不满足放货条件,指令号{}", device_code, standardInspectSiteDeviceDriver.getMove(), standardInspectSiteDeviceDriver.getAction()
, standardInspectSiteDeviceDriver.getError(), ikey);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content(message)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else if (device.getDeviceDriver() instanceof WasteFoilWeighingStationDriver) {
wasteFoilWeighingStationDriver = (WasteFoilWeighingStationDriver) device.getDeviceDriver();
if (wasteFoilWeighingStationDriver.getMove() == 0 && wasteFoilWeighingStationDriver.getAction() == 1
&& wasteFoilWeighingStationDriver.getError() == 0 && wasteFoilWeighingStationDriver.getMode() == 2) {
try {
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", "4");
wasteFoilWeighingStationDriver.writing(map);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
} catch (Exception e) {
e.printStackTrace();
}
} else {
message = "设备号:" + device_code + "光电信号:" + wasteFoilWeighingStationDriver.getMove() + ",动作信号:" + wasteFoilWeighingStationDriver.getAction() + "报警信号:" + wasteFoilWeighingStationDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},设备状态{},不满足取货条件,指令号{}", device_code, wasteFoilWeighingStationDriver.getMove(), wasteFoilWeighingStationDriver.getAction()
, wasteFoilWeighingStationDriver.getError(), wasteFoilWeighingStationDriver.getMode(), ikey);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content(message)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else { } else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder() LuceneLogDto logDto = LuceneLogDto.builder()
@ -742,7 +393,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
logDto.setLog_level(4); logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto); luceneExecuteLogService.deviceExecuteLog(logDto);
} }
} else if (phase == 0x4D) { }
//放货完成
//(Itype=1/2/3,需要WCS反馈)
else if (phase == 0x09) {
if (agvaddr == 0) { if (agvaddr == 0) {
agvaddr = agvaddr_copy; agvaddr = agvaddr_copy;
} }
@ -779,24 +435,23 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
log.info("未找到指令号{}对应的指令", ikey); log.info("未找到指令号{}对应的指令", ikey);
return; return;
} }
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
//通道1 standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
Region region = regionService.findByCode("1"); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
if (StrUtil.equals(region.getIs_charge(), CommonFinalParam.ZERO)) { LuceneLogDto logDto = LuceneLogDto.builder()
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); .device_code(this.getDeviceCode())
LuceneLogDto logDto = LuceneLogDto.builder() .content("agvphase:" + phase + "反馈:" + data)
.device_code(this.getDeviceCode()) .build();
.content("agvphase:" + phase + "反馈:" + data) logDto.setLog_level(4);
.build(); luceneExecuteLogService.deviceExecuteLog(logDto);
logDto.setLog_level(4); standardOrdinarySiteDeviceDriver.setAgvphase(phase);
luceneExecuteLogService.deviceExecuteLog(logDto); standardOrdinarySiteDeviceDriver.setIndex(index);
region.setIs_charge("1"); standardOrdinarySiteDeviceDriver.setInst(inst);
region.setHas_agv("1");
regionService.updateById(region);
}
} }
} else if (phase == 0x4E) { }
//todo 待完善
else if (phase == 0x4D) {
if (agvaddr == 0) { if (agvaddr == 0) {
agvaddr = agvaddr_copy; agvaddr = agvaddr_copy;
} }
@ -835,24 +490,25 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
} }
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
//通道1
Region region = regionService.findByCode("1"); Region region = regionService.findByCode("1");
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); if (StrUtil.equals(region.getIs_charge(), CommonFinalParam.ZERO)) {
LuceneLogDto logDto = LuceneLogDto.builder() data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
.device_code(this.getDeviceCode()) LuceneLogDto logDto = LuceneLogDto.builder()
.content("agvphase:" + phase + "反馈:" + data) .device_code(this.getDeviceCode())
.build(); .content("agvphase:" + phase + "反馈:" + data)
logDto.setLog_level(4); .build();
luceneExecuteLogService.deviceExecuteLog(logDto); logDto.setLog_level(4);
region.setIs_charge("0"); luceneExecuteLogService.deviceExecuteLog(logDto);
region.setHas_agv("0"); region.setIs_charge("1");
regionService.updateById(region); region.setHas_agv("1");
regionService.updateById(region);
}
} }
} }
//todo 待完善
//放货完成 else if (phase == 0x4E) {
//(Itype=1/2/3,需要WCS反馈)
else if (phase == 0x09) {
if (agvaddr == 0) { if (agvaddr == 0) {
agvaddr = agvaddr_copy; agvaddr = agvaddr_copy;
} }
@ -889,30 +545,9 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
log.info("未找到指令号{}对应的指令", ikey); log.info("未找到指令号{}对应的指令", ikey);
return; return;
} }
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
//卸货确认
if (standardOrdinarySiteDeviceDriver.getOption() == 2) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
standardOrdinarySiteDeviceDriver.setOption(0);
} else {
log.info("等待一体机进行卸货确认,设备号{},option值{}", standardOrdinarySiteDeviceDriver.getDevice_code(), standardOrdinarySiteDeviceDriver.getOption());
logServer.deviceExecuteLog(this.device_code, "", "", "等待一体机进行卸货确认,设备号" + device.getDevice_code() + ",指令号" + ikey);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(standardOrdinarySiteDeviceDriver.getDevice_code())
.content("等待一体机进行卸货确认,设备号" + standardOrdinarySiteDeviceDriver.getDevice_code() + ",option当前值" + standardOrdinarySiteDeviceDriver.getOption())
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else { if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
Region region = regionService.findByCode("1");
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder() LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode()) .device_code(this.getDeviceCode())
@ -920,8 +555,13 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
.build(); .build();
logDto.setLog_level(4); logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto); luceneExecuteLogService.deviceExecuteLog(logDto);
region.setIs_charge("0");
region.setHas_agv("0");
regionService.updateById(region);
} }
} else if (phase == 0x70) { }
else if (phase == 0x70) {
//x坐标 //x坐标
x = ikey; x = ikey;
LuceneLogDto logDto = LuceneLogDto.builder() LuceneLogDto logDto = LuceneLogDto.builder()
@ -992,82 +632,9 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
last_status = status; last_status = status;
} //进入区域(phase值) } //进入区域(phase值)
else if (phase == 0x50) { else if (phase == 0x50) {
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
Region region = regionService.findByCode("1");
if (ObjectUtil.isNotEmpty(device.getExtraValue().get("open"))
&& StrUtil.equals("true", device.getExtraValue().get("open").toString())) {
if (StrUtil.equals(region.getIs_charge(), CommonFinalParam.ZERO)) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
if (standardOrdinarySiteDeviceDriver.getOpenCount() == 0) {
region.setIs_charge("1");
region.setHas_agv("1");
regionService.updateById(region);
standardOrdinarySiteDeviceDriver.setOpenCount(standardOrdinarySiteDeviceDriver.getOpenCount() + 1);
}
if (standardOrdinarySiteDeviceDriver.getOpenCount() == 1) {
region.setIs_charge("0");
region.setHas_agv("0");
regionService.updateById(region);
standardOrdinarySiteDeviceDriver.setOpenCount(0);
}
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content(region.getRegion_name() + "被管制!")
.build();
logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2);
}
}
}
} }
//离开区域(phase值) //离开区域(phase值)
else if (phase == 0x51) { else if (phase == 0x51) {
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
Region region = regionService.findByCode("1");
if (ObjectUtil.isNotEmpty(device.getExtraValue().get("close"))
&& StrUtil.equals("true", device.getExtraValue().get("close").toString())) {
if (StrUtil.equals(region.getIs_charge(), CommonFinalParam.ZERO)) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
if (standardOrdinarySiteDeviceDriver.getCloseCount() == 0) {
region.setIs_charge("0");
region.setHas_agv("0");
regionService.updateById(region);
standardOrdinarySiteDeviceDriver.setOpenCount(standardOrdinarySiteDeviceDriver.getOpenCount() + 1);
}
if (standardOrdinarySiteDeviceDriver.getCloseCount() == 1) {
region.setIs_charge("1");
region.setHas_agv("1");
regionService.updateById(region);
standardOrdinarySiteDeviceDriver.setCloseCount(0);
}
} else {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content(region.getRegion_name() + "被管制!")
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
}
}
} }
//上报异常信息 //上报异常信息
//(不需要WCS反馈) //(不需要WCS反馈)

Loading…
Cancel
Save