opt: 行架联调优化

This commit is contained in:
yanps
2024-04-22 13:35:23 +08:00
parent 9b3980a71e
commit c48f46040a
8 changed files with 190 additions and 117 deletions

View File

@@ -421,7 +421,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
if ((standardInspectSiteDeviceDriver.getMove() == 1 && standardInspectSiteDeviceDriver.getAction() == 1 && standardInspectSiteDeviceDriver.getError() == 0)) { if ((standardInspectSiteDeviceDriver.getMove() != 1 && standardInspectSiteDeviceDriver.getAction() == 1 && standardInspectSiteDeviceDriver.getError() == 0)) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} else { } else {
message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction() + "报警信号:" + standardInspectSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction() + "报警信号:" + standardInspectSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";

View File

@@ -748,6 +748,12 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
if (this.move == 1) { if (this.move == 1) {
move = "有货"; move = "有货";
} }
String container_type = "";
if(this.container_type == 1){
container_type = "小托盘";
}else if (this.container_type == 2){
container_type = "大托盘";
}
jo.put("move", move); jo.put("move", move);
jo.put("task", task); jo.put("task", task);
jo.put("type", container_type); jo.put("type", container_type);

View File

@@ -513,7 +513,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
log.error("指令创建失败!", e.getMessage()); log.error("指令创建失败!", e.getMessage());
return false; return false;
} }
Device nextdevice = deviceAppservice.findDeviceByCode(taskdto.getNext_device_code()); Device nextdevice = deviceAppservice.findDeviceByCode(instdto.getNext_device_code());
//创建指令后修改任务状态 //创建指令后修改任务状态
taskdto.setTask_status(TaskStatusEnum.BUSY.getIndex()); taskdto.setTask_status(TaskStatusEnum.BUSY.getIndex());

View File

@@ -979,8 +979,31 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
if (this.requireSucess) { if (this.requireSucess) {
requireSucess = "1"; requireSucess = "1";
} }
String command = "";
if(this.command == 0){
command = "待机";
}else if(this.command == 1){
command = "取货中";
}else if(this.command == 2){
command = "取货完成";
}else if(this.command == 3){
command = "放货中";
}else if(this.command == 4){
command = "请求卸货(申请卸货)";
}else if(this.command == 5){
command = "放货完成";
}else if(this.command == 6){
command = "取货准备(回库台)";
}else if(this.command == 7){
command = "召回";
}else if(this.command == 8){
command = "急停";
}else if(this.command == 9){
command = "未知";
}
jo.put("mode", mode); jo.put("mode", mode);
jo.put("move", move); jo.put("move", move);
jo.put("command", command);
jo.put("action", action); jo.put("action", action);
jo.put("task", task); jo.put("task", task);
jo.put("error", this.getError()); jo.put("error", this.getError());

View File

@@ -282,6 +282,37 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
} }
} }
public void writing(List list) {
Map<String, Object> itemMap = new HashMap<String, Object>();
for (int i = 0; i < list.size(); i++) {
Object ob = list.get(i);
JSONObject json = (JSONObject) JSONObject.toJSON(ob);
if (!StrUtil.isEmpty(json.getString("value"))) {
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + json.getString("code");
itemMap.put(to_param, json.getString("value"));
}
}
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("下发电气信号:" + itemMap)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap);
try {
this.checkcontrol(itemMap);
} catch (Exception e) {
e.printStackTrace();
try {
this.checkcontrol(itemMap);
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
//将扩展表中的字符串数据转换成集合 //将扩展表中的字符串数据转换成集合
@Override @Override
public List<String> getExtraDeviceCodes(String extraName) { public List<String> getExtraDeviceCodes(String extraName) {

View File

@@ -128,6 +128,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
private int instruction_require_time_out = 3000; private int instruction_require_time_out = 3000;
//行架机械手申请任务成功标识 //行架机械手申请任务成功标识
boolean requireSucess = false; boolean requireSucess = false;
//行架机械手申请动作成功标识
boolean requireActionSucess = false;
private int instruction_finished_time_out; private int instruction_finished_time_out;
@@ -179,12 +181,16 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
y_position = this.itemProtocol.getY_position(); y_position = this.itemProtocol.getY_position();
iserror = this.itemProtocol.device_status; iserror = this.itemProtocol.device_status;
if(mode != last_mode){ if (mode != last_mode) {
requireSucess = false; requireSucess = false;
} }
if (action != last_action) {
requireActionSucess = false;
}
if (!requireActionSucess) {
update_instruction_status(); update_instruction_status();
}
} catch (Exception var17) { } catch (Exception var17) {
var17.printStackTrace(); var17.printStackTrace();
@@ -219,7 +225,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
} else { } else {
if (mode == 2) { if (mode == 2) {
//if (!requireSucess) { //if (!requireSucess) {
String remark = "";; String remark = "";
if (mode != 2) { if (mode != 2) {
remark = remark + "工作模式(mode)不是待机状态,"; remark = remark + "工作模式(mode)不是待机状态,";
} }
@@ -293,7 +299,9 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
if (ObjectUtil.isEmpty(putDeviceCodeList)) { if (ObjectUtil.isEmpty(putDeviceCodeList)) {
putDeviceCodeList = this.getExtraDeviceCodes("put_device_code"); putDeviceCodeList = this.getExtraDeviceCodes("put_device_code");
} }
if(CollUtil.isEmpty(getDeviceCodeList) || getDeviceCodeList.size() == 0){
notCreateInstMessage = "未设置取货点";
}
TaskDto task = null; TaskDto task = null;
for (int i = 0; i < getDeviceCodeList.size(); i++) { for (int i = 0; i < getDeviceCodeList.size(); i++) {
String startDeviceCode = getDeviceCodeList.get(i); String startDeviceCode = getDeviceCodeList.get(i);
@@ -431,7 +439,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextdevice.getDeviceDriver(); hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextdevice.getDeviceDriver();
hongXiangConveyorDeviceDriver.writing("to_open_door", "1"); hongXiangConveyorDeviceDriver.writing("to_open_door", "1");
} }
this.setNow_steps_type(2);
this.setRequireSucess(true); this.setRequireSucess(true);
return true; return true;
} else { } else {
@@ -593,7 +600,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
} }
String start_addr = startDevice.getExtraValue().get("address").toString(); String start_addr = startDevice.getExtraValue().get("address").toString();
String next_addr = nextDevice.getExtraValue().get("address").toString(); String next_addr = nextDevice.getExtraValue().get("address").toString();
if(ObjectUtil.isEmpty(start_addr) || ObjectUtil.isEmpty(next_addr)){ if (ObjectUtil.isEmpty(start_addr) || ObjectUtil.isEmpty(next_addr)) {
throw new BadRequestException("设备:" + startDevice.getDevice_code() + "或设备:" + nextDevice.getDevice_code() + "地址值!"); throw new BadRequestException("设备:" + startDevice.getDevice_code() + "或设备:" + nextDevice.getDevice_code() + "地址值!");
} }
String msg = "当前设备:" + device_code + ",下发指令:" String msg = "当前设备:" + device_code + ",下发指令:"
@@ -633,7 +640,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
hongXiangConveyorDeviceDriver.writing("to_open_door", "1"); hongXiangConveyorDeviceDriver.writing("to_open_door", "1");
hongXiangConveyorDeviceDriver.writing("to_open_door", "1"); hongXiangConveyorDeviceDriver.writing("to_open_door", "1");
} }
this.setNow_steps_type(2);
this.setRequireSucess(true); this.setRequireSucess(true);
notCreateInstMessage = ""; notCreateInstMessage = "";
notCreateTaskMessage = ""; notCreateTaskMessage = "";
@@ -822,15 +828,12 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
int error = hongXiangConveyorDeviceDriver.getError(); int error = hongXiangConveyorDeviceDriver.getError();
int move = hongXiangConveyorDeviceDriver.getMove(); int move = hongXiangConveyorDeviceDriver.getMove();
if (mode == 1 && door == 1 && action == 1 && error == 0 && error1 == 0 && move == 1) { if (mode == 1 && door == 1 && action == 1 && error == 0 && error1 == 0 && move == 1) {
if (this.getNow_steps_type() == 2) {
map.put("code", "to_command"); map.put("code", "to_command");
map.put("value", "2"); map.put("value", "2");
list.add(map); list.add(map);
this.writing(list); this.writing(list);
this.setNow_steps_type(3); this.setRequireActionSucess(true);
}
} else { } else {
if (this.getNow_steps_type() == 2) {
feedMessage = "烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code(); feedMessage = "烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code();
if (mode != 1) { if (mode != 1) {
feedMessage = feedMessage + "工作模式(mode)信号未联机,"; feedMessage = feedMessage + "工作模式(mode)信号未联机,";
@@ -848,19 +851,15 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
feedMessage = feedMessage + "故障(error1)信号出现故障,故障值:" + error1 + ""; feedMessage = feedMessage + "故障(error1)信号出现故障,故障值:" + error1 + "";
} }
} }
}
} else { } else {
if (this.getNow_steps_type() == 2) {
map.put("code", "to_command"); map.put("code", "to_command");
map.put("value", "2"); map.put("value", "2");
list.add(map); list.add(map);
this.writing(list); this.writing(list);
this.setNow_steps_type(3); this.setRequireActionSucess(true);
}
} }
} }
} else { } else {
if (this.getNow_steps_type() == 2) {
feedMessage = "行架机械手:"; feedMessage = "行架机械手:";
if (mode != 3) { if (mode != 3) {
feedMessage = feedMessage + "工作模式(mode)不为运行中状态,"; feedMessage = feedMessage + "工作模式(mode)不为运行中状态,";
@@ -875,7 +874,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
feedMessage = feedMessage + "当前上报任务号(task)不应该为0。"; feedMessage = feedMessage + "当前上报任务号(task)不应该为0。";
} }
} }
}
//取货完成关闭烘箱门 //取货完成关闭烘箱门
if (mode == 3 && action == 2 && move == 1 && task > 0) { if (mode == 3 && action == 2 && move == 1 && task > 0) {
@@ -886,19 +884,20 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
if (device.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { if (device.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) device.getDeviceDriver(); hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) device.getDeviceDriver();
map.put("to_close_door", "1"); Map map1 = new HashMap();
hongXiangConveyorDeviceDriver.writing(map); ArrayList list1 = new ArrayList();
map1.put("code", "to_close_door");
map1.put("value", "1");
list1.add(map1);
hongXiangConveyorDeviceDriver.writing(list1);
} }
if (this.getNow_steps_type() == 3) {
map.put("code", "to_command"); map.put("code", "to_command");
map.put("value", "3"); map.put("value", "3");
list.add(map); list.add(map);
this.writing(list); this.writing(list);
this.setNow_steps_type(4); this.setRequireActionSucess(true);
}
} }
} else { } else {
if (this.getNow_steps_type() == 3) {
feedMessage = "行架机械手:"; feedMessage = "行架机械手:";
if (mode != 3) { if (mode != 3) {
feedMessage = feedMessage + "工作模式(mode)不为运行中状态,"; feedMessage = feedMessage + "工作模式(mode)不为运行中状态,";
@@ -913,7 +912,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
feedMessage = feedMessage + "当前上报任务号(task)不应该为0。"; feedMessage = feedMessage + "当前上报任务号(task)不应该为0。";
} }
} }
}
//申请放货 //申请放货
if (mode == 3 && action == 3 && move == 1 && task > 0) { if (mode == 3 && action == 3 && move == 1 && task > 0) {
@@ -931,17 +929,12 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
int error = hongXiangConveyorDeviceDriver.getError(); int error = hongXiangConveyorDeviceDriver.getError();
int move = hongXiangConveyorDeviceDriver.getMove(); int move = hongXiangConveyorDeviceDriver.getMove();
if (mode == 1 && door == 1 && action == 1 && error == 0 && error1 == 0 && move == 0) { if (mode == 1 && door == 1 && action == 1 && error == 0 && error1 == 0 && move == 0) {
if (this.getNow_steps_type() == 4) {
map.put("code", "to_command"); map.put("code", "to_command");
map.put("value", "4"); map.put("value", "4");
list.add(map); list.add(map);
this.writing(list); this.writing(list);
this.setNow_steps_type(5); this.setRequireActionSucess(true);
} else { } else {
feedMessage = "未反馈电气信号原因:当前步骤不为允许放货now_steps_type=4";
}
} else {
if (this.getNow_steps_type() == 4) {
feedMessage = "烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code(); feedMessage = "烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code();
if (mode != 1) { if (mode != 1) {
feedMessage = feedMessage + "工作模式(mode)信号未联机,"; feedMessage = feedMessage + "工作模式(mode)信号未联机,";
@@ -959,18 +952,14 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
feedMessage = feedMessage + "故障(error1)信号出现故障。"; feedMessage = feedMessage + "故障(error1)信号出现故障。";
} }
} }
}
} else { } else {
if (this.getNow_steps_type() == 4) {
map.put("code", "to_command"); map.put("code", "to_command");
map.put("value", "4"); map.put("value", "4");
list.add(map); list.add(map);
this.writing(list); this.writing(list);
this.setNow_steps_type(5); this.setRequireActionSucess(true);
}
} }
} else { } else {
if (this.getNow_steps_type() == 4) {
feedMessage = "行架机械手:"; feedMessage = "行架机械手:";
if (mode != 3) { if (mode != 3) {
feedMessage = feedMessage + "工作模式(mode)不为运行中状态,"; feedMessage = feedMessage + "工作模式(mode)不为运行中状态,";
@@ -985,7 +974,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
feedMessage = feedMessage + "当前上报任务号(task)不应该为0。"; feedMessage = feedMessage + "当前上报任务号(task)不应该为0。";
} }
} }
}
//放货完成 //放货完成
if (mode == 3 && action == 4 && move == 0 && task > 0) { if (mode == 3 && action == 4 && move == 0 && task > 0) {
@@ -1000,7 +988,12 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
LampThreecolorDeviceDriver lampThreecolorDeviceDriver; LampThreecolorDeviceDriver lampThreecolorDeviceDriver;
if (nextDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { if (nextDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextDevice.getDeviceDriver(); hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextDevice.getDeviceDriver();
hongXiangConveyorDeviceDriver.writing("to_close_door", "1"); Map map1 = new HashMap();
ArrayList list1 = new ArrayList();
map1.put("code", "to_close_door");
map1.put("value", "1");
list1.add(map1);
hongXiangConveyorDeviceDriver.writing(list1);
if (StrUtil.isNotEmpty(taskDto.getOven_time())) { if (StrUtil.isNotEmpty(taskDto.getOven_time())) {
//下发烘箱时间 //下发烘箱时间
int time = Integer.parseInt(taskDto.getOven_time()); int time = Integer.parseInt(taskDto.getOven_time());
@@ -1038,8 +1031,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
map.put("value", "5"); map.put("value", "5");
list.add(map); list.add(map);
this.writing(list); this.writing(list);
this.setNow_steps_type(6); this.setRequireActionSucess(true);
this.setNow_steps_type(0);
try { try {
finish_instruction(inst2); finish_instruction(inst2);
} catch (Exception e) { } catch (Exception e) {
@@ -1049,7 +1041,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
} }
} }
} else { } else {
if (this.getNow_steps_type() == 5) {
feedMessage = "行架机械手:"; feedMessage = "行架机械手:";
if (mode != 3) { if (mode != 3) {
feedMessage = feedMessage + "工作模式(mode)不为运行中状态,"; feedMessage = feedMessage + "工作模式(mode)不为运行中状态,";
@@ -1066,7 +1057,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
} }
} }
} }
}
public synchronized boolean finish_instruction(Instruction inst) throws Exception { public synchronized boolean finish_instruction(Instruction inst) throws Exception {
instructionService.finish(inst); instructionService.finish(inst);
@@ -1113,6 +1103,10 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
if (error == 0 && iserror) { if (error == 0 && iserror) {
this.setMessage(LangProcess.msg("universal_message4")); this.setMessage(LangProcess.msg("universal_message4"));
} }
String requireActionSucess = "请求动作已复位";
if(this.requireActionSucess){
requireActionSucess = "请求动作未复位";
}
jo.put("device_name", this.getDevice().getDevice_name()); jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode); jo.put("mode", mode);
jo.put("move", move); jo.put("move", move);
@@ -1126,6 +1120,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
jo.put("notCreateTaskMessage", notCreateTaskMessage); jo.put("notCreateTaskMessage", notCreateTaskMessage);
jo.put("notCreateInstMessage", notCreateInstMessage); jo.put("notCreateInstMessage", notCreateInstMessage);
jo.put("feedMessage", feedMessage); jo.put("feedMessage", feedMessage);
jo.put("requireActionSucess", requireActionSucess);
jo.put("driver_type", "siemens_conveyor"); jo.put("driver_type", "siemens_conveyor");
jo.put("is_click", true); jo.put("is_click", true);
jo.put("x", x_position); jo.put("x", x_position);

View File

@@ -17,7 +17,7 @@ import java.util.List;
@Component @Component
@RequiredArgsConstructor @RequiredArgsConstructor
@Order(100) @Order(100)
@ConditionalOnProperty(value = "spring.profiles.active",havingValue = "dev") @ConditionalOnProperty(value = "spring.profiles.active",havingValue = "prod")
public class JobRunner implements ApplicationRunner { public class JobRunner implements ApplicationRunner {
private static final Logger log = LoggerFactory.getLogger(JobRunner.class); private static final Logger log = LoggerFactory.getLogger(JobRunner.class);
private final ISysQuartzJobService quartzJobService; private final ISysQuartzJobService quartzJobService;

View File

@@ -350,6 +350,24 @@ export default {
} else if (val === 'mode') { } else if (val === 'mode') {
const obj = { name: '模式', value: data[val] } const obj = { name: '模式', value: data[val] }
arr.push(obj) arr.push(obj)
} else if (val === 'container_type') {
const obj = { name: '托盘类型', value: data[val] }
this.arr.push(obj)
} else if (val === 'command') {
const obj = { name: '作业状态', value: data[val] }
this.arr.push(obj)
} else if (val === 'prohibitInWarehouse') {
const obj = { name: '禁止入库', value: data[val] }
this.arr.push(obj)
} else if (val === 'prohibitOutWarehouse') {
const obj = { name: '禁止出库', value: data[val] }
this.arr.push(obj)
} else if (val === 'stopReceiveTask') {
const obj = { name: '停止接收任务', value: data[val] }
this.arr.push(obj)
} else if (val === 'hand_barcode') {
const obj = { name: '条码', value: data[val] }
this.arr.push(obj)
} else if (val === 'error') { } else if (val === 'error') {
const obj = { name: '报警', value: data[val] } const obj = { name: '报警', value: data[val] }
arr.push(obj) arr.push(obj)