This commit is contained in:
2022-12-07 16:34:01 +08:00
parent 60cb32dc7e
commit 533073eb11
8 changed files with 630 additions and 149 deletions

View File

@@ -22,6 +22,7 @@ import org.nl.acs.device.service.*;
import org.nl.acs.device.service.dto.*; import org.nl.acs.device.service.dto.*;
import org.nl.acs.device_driver.DeviceDriverDefination; import org.nl.acs.device_driver.DeviceDriverDefination;
import org.nl.acs.device_driver.ScannerDeviceDriver; import org.nl.acs.device_driver.ScannerDeviceDriver;
import org.nl.acs.device_driver.basedriver.slit_two_manipulator.SlitTwoManipulatorDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver; import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver; import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver; import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
@@ -868,6 +869,7 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
throw new BadRequestException("未找到对应设备:" + device_code); throw new BadRequestException("未找到对应设备:" + device_code);
} }
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver; StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
SlitTwoManipulatorDeviceDriver slitTwoManipulatorDeviceDriver;
//检测站点 //检测站点
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
@@ -926,6 +928,9 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
standardInspectSiteDeviceDriver.setBatch(batch); standardInspectSiteDeviceDriver.setBatch(batch);
device.setMaterial_type(material_type); device.setMaterial_type(material_type);
device.setBatch(batch); device.setBatch(batch);
} else if (device.getDeviceDriver() instanceof SlitTwoManipulatorDeviceDriver){
slitTwoManipulatorDeviceDriver = (SlitTwoManipulatorDeviceDriver) device.getDeviceDriver();
slitTwoManipulatorDeviceDriver.setDeviceStatus(form);
} }
} }

View File

@@ -99,6 +99,12 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
String device_code; String device_code;
//0 无任务执行 1更新指令状态 2下发电气信号 3允许取货 允许放货 5放货完成
int now_steps_type = 0;
String notCreateTaskMessage = "";
String notCreateInstMessage = "";
String feedMessage = "";
@Override @Override
public Device getDevice() { public Device getDevice() {
@@ -180,11 +186,40 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
hongXiangConveyorDeviceDriver.writing("to_open_door", "1"); hongXiangConveyorDeviceDriver.writing("to_open_door", "1");
if (hongXiangConveyorDeviceDriver.getDoor() == 1 && hongXiangConveyorDeviceDriver.getAction() == 1 && hongXiangConveyorDeviceDriver.getError1() == 0) { if (hongXiangConveyorDeviceDriver.getDoor() == 1 && hongXiangConveyorDeviceDriver.getAction() == 1 && hongXiangConveyorDeviceDriver.getError1() == 0) {
this.writing("to_command", "2"); this.writing("to_command", "2");
this.setNow_steps_type(3);
}else {
if (this.getNow_steps_type() == 2){
feedMessage = "请检查烘箱door=1&&action==1&&error1=0";
}
} }
} else { } else {
this.writing("to_command", "2"); this.writing("to_command", "2");
this.setNow_steps_type(3);
} }
} }
} else {
if (this.getNow_steps_type() == 2){
feedMessage = "请检查mode == 3 && action == 1 && move == 0 && task > 0";
}
}
//取货完成关闭烘箱门
if (mode == 3 && action == 2 && move == 1 && task > 0){
Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task));
if (ObjectUtil.isNotEmpty(inst2)) {
String start_device_code = inst2.getStart_device_code();
Device device = deviceAppService.findDeviceByCode(start_device_code);
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
if (device.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) device.getDeviceDriver();
hongXiangConveyorDeviceDriver.writing("to_close_door", "1");
}
this.setNow_steps_type(4);
}
}else {
if (this.getNow_steps_type() == 3){
feedMessage = "请检查mode == 3 && action == 2 && move == 1 && task > 0";
}
} }
//申请放货 //申请放货
@@ -198,9 +233,17 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
hongXiangConveyorDeviceDriver.writing("to_open_door", "1"); hongXiangConveyorDeviceDriver.writing("to_open_door", "1");
if (hongXiangConveyorDeviceDriver.getDoor() == 1 && hongXiangConveyorDeviceDriver.getAction() == 1 && hongXiangConveyorDeviceDriver.getError1() == 0) { if (hongXiangConveyorDeviceDriver.getDoor() == 1 && hongXiangConveyorDeviceDriver.getAction() == 1 && hongXiangConveyorDeviceDriver.getError1() == 0) {
this.writing("to_command", "3"); this.writing("to_command", "3");
this.setNow_steps_type(5);
}else {
feedMessage = "请检查烘箱door=1&&action==1&&error1=0";
} }
} else { } else {
this.writing("to_command", "3"); this.writing("to_command", "3");
this.setNow_steps_type(5);
}
}else {
if (this.getNow_steps_type() == 4){
feedMessage = "请检查mode == 3 && action == 3 && move == 1 && task > 0";
} }
} }
@@ -226,24 +269,31 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
} }
} }
String next_device_code = taskDto.getNext_device_code(); String next_device_code = taskDto.getNext_device_code();
String start_device_code = taskDto.getStart_device_code(); //String start_device_code = taskDto.getStart_device_code();
Device startDevice = deviceAppService.findDeviceByCode(start_device_code); //Device startDevice = deviceAppService.findDeviceByCode(start_device_code);
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code); Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
if (startDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { // if (startDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startDevice.getDeviceDriver(); // hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startDevice.getDeviceDriver();
hongXiangConveyorDeviceDriver.writing("to_close_door", "1"); // hongXiangConveyorDeviceDriver.writing("to_close_door", "1");
} // }
if (nextDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { if (nextDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextDevice.getDeviceDriver(); hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextDevice.getDeviceDriver();
hongXiangConveyorDeviceDriver.writing("to_close_door", "1"); hongXiangConveyorDeviceDriver.writing("to_close_door", "1");
} }
this.writing("to_command", "0"); this.writing("to_command", "4");
this.writing("to_onset", "0"); this.setNow_steps_type(6);
this.writing("to_target", "0"); this.setNow_steps_type(0);
this.writing("to_task", "0"); feedMessage = "";
// this.writing("to_onset", "0");
// this.writing("to_target", "0");
// this.writing("to_task", "0");
} }
} }
}else {
if (this.getNow_steps_type() == 5){
feedMessage = "请检查mode == 3 && action == 4 && move == 0 && task > 0";
}
} }
} catch (Exception var17) { } catch (Exception var17) {
@@ -275,6 +325,20 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
//行架机械手申请任务 //行架机械手申请任务
if (mode == 2 && move == 0 && task == 0 && !requireSucess) { if (mode == 2 && move == 0 && task == 0 && !requireSucess) {
applyTask(); applyTask();
}else {
if (!requireSucess) {
String remark = "";
if (mode != 2) {
remark = remark + "mode不为2,";
}
if (move != 0) {
remark = remark + "move不为0,";
}
if (task != 0) {
remark = remark + "task不为0,";
}
this.setNotCreateTaskMessage(remark);
}
} }
} }
@@ -318,15 +382,13 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
String startDeviceCode = getDeviceCodeList.get(i); String startDeviceCode = getDeviceCodeList.get(i);
List<TaskDto> taskDtos = taskserver.queryTaskByDeviceCodeAndStatus(startDeviceCode); List<TaskDto> taskDtos = taskserver.queryTaskByDeviceCodeAndStatus(startDeviceCode);
if (ObjectUtil.isNotEmpty(taskDtos)) { if (ObjectUtil.isNotEmpty(taskDtos)) {
//按照优先级排序 优先级相等按照创建时间排序
taskDtos = this.sortTask(taskDtos);
TaskDto taskDto = taskDtos.get(0); TaskDto taskDto = taskDtos.get(0);
Instruction instruction = instructionService.findByTaskcode(taskDto.getTask_code()); Instruction instruction = instructionService.findByTaskcode(taskDto.getTask_code());
instruction.setInstruction_status("1"); instruction.setInstruction_status("1");
instruction.setUpdate_time(DateUtil.now()); instruction.setUpdate_time(DateUtil.now());
instructionService.update(instruction); instructionService.update(instruction);
// int start_addrIndex = getDeviceCodeList.indexOf(instruction.getStart_device_code());
// int next_addrIndex = putDeviceCodeList.indexOf(instruction.getNext_device_code());
// writing("to_onset", String.valueOf(start_addrIndex + 1));
// writing("to_target", String.valueOf(next_addrIndex + 1));
Device startDevice = deviceAppService.findDeviceByCode(instruction.getStart_device_code()); Device startDevice = deviceAppService.findDeviceByCode(instruction.getStart_device_code());
Device nextDevice = deviceAppService.findDeviceByCode(instruction.getNext_device_code()); Device nextDevice = deviceAppService.findDeviceByCode(instruction.getNext_device_code());
if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))){ if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))){
@@ -341,11 +403,14 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
this.writing("to_target", next_addr); this.writing("to_target", next_addr);
this.writing("to_task", instruction.getInstruction_code()); this.writing("to_task", instruction.getInstruction_code());
this.writing("to_command", "1"); this.writing("to_command", "1");
this.setNow_steps_type(2);
this.setRequireSucess(true); this.setRequireSucess(true);
return true; return true;
} else { } else {
List<TaskDto> taskDtoList = taskserver.queryTaskByDeviceCode(startDeviceCode); List<TaskDto> taskDtoList = taskserver.queryTaskByDeviceCode(startDeviceCode);
if (ObjectUtil.isNotEmpty(taskDtoList)) { if (ObjectUtil.isNotEmpty(taskDtoList)) {
//按照优先级排序 优先级相等按照创建时间排序
taskDtoList = this.sortTask(taskDtoList);
task = taskDtoList.get(0); task = taskDtoList.get(0);
} }
if (ObjectUtil.isNotEmpty(task)) break; if (ObjectUtil.isNotEmpty(task)) break;
@@ -385,23 +450,22 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
try { try {
instructionService.create(instdto); instructionService.create(instdto);
} catch (Exception e) { } catch (Exception e) {
notCreateInstMessage = e.getMessage();
e.printStackTrace(); e.printStackTrace();
return false;
} }
//创建指令后修改任务状态 //创建指令后修改任务状态
task.setTask_status("1"); task.setTask_status("1");
task.setUpdate_time(DateUtil.now()); task.setUpdate_time(DateUtil.now());
taskserver.update(task); taskserver.update(task);
//根据获取托盘信息返回的结果 得到对应抓取工位/放货工位设备编码所在的索引位置
// int start_addrIndex = getDeviceCodeList.indexOf(start_device_code);
// int next_addrIndex = putDeviceCodeList.indexOf(next_device_code);
// writing("to_onset", String.valueOf(start_addrIndex + 1));
// writing("to_target", String.valueOf(next_addrIndex + 1));
Device startDevice = deviceAppService.findDeviceByCode(instdto.getStart_device_code()); Device startDevice = deviceAppService.findDeviceByCode(instdto.getStart_device_code());
Device nextDevice = deviceAppService.findDeviceByCode(instdto.getNext_device_code()); Device nextDevice = deviceAppService.findDeviceByCode(instdto.getNext_device_code());
if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))){ if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))){
notCreateInstMessage = "设备:" + startDevice.getDevice_code() + "未设置电气调度号!";
throw new BadRequestException("设备:" + startDevice.getDevice_code() + "未设置电气调度号!"); throw new BadRequestException("设备:" + startDevice.getDevice_code() + "未设置电气调度号!");
} }
if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))){ if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))){
notCreateInstMessage = "设备:" + nextDevice.getDevice_code() + "未设置电气调度号!";
throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!"); throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
} }
String start_addr = startDevice.getExtraValue().get("address").toString(); String start_addr = startDevice.getExtraValue().get("address").toString();
@@ -410,7 +474,12 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
this.writing("to_target", next_addr); this.writing("to_target", next_addr);
this.writing("to_task", instdto.getInstruction_code()); this.writing("to_task", instdto.getInstruction_code());
this.writing("to_command", "1"); this.writing("to_command", "1");
this.setNow_steps_type(2);
this.setRequireSucess(true); this.setRequireSucess(true);
notCreateInstMessage = "";
notCreateTaskMessage = "";
} else {
notCreateInstMessage = "未找到关联设备的任务,指令无法创建";
} }
return true; return true;
} }
@@ -464,6 +533,23 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
return devicesList; return devicesList;
} }
public List<TaskDto> sortTask(List<TaskDto> taskDtos){
Collections.sort(taskDtos, new Comparator<TaskDto>() {
@Override
public int compare(TaskDto t1, TaskDto t2) {
//优先级从大到小
int i = t2.getPriority().compareTo(t1.getPriority());
//如果优先级相等
if (i == 0){
//时间从早到晚
i = t1.getCreate_time().compareTo(t2.getCreate_time());
}
return i;
}
});
return taskDtos;
}
@Override @Override
public JSONObject getDeviceStatusName() { public JSONObject getDeviceStatusName() {

View File

@@ -58,6 +58,9 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
//分切行架机械手是否禁用 0否 1是
private int is_disable = 0;
//工作模式 //工作模式
int mode = 0; int mode = 0;
int last_mode = 0; int last_mode = 0;
@@ -103,16 +106,33 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
//暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域 //暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域
int flag; int flag;
//前工位任务执行当前步骤
//0未执行 1更改指令状态 2下发电气任务信息 3前工位允许取货 4前工位允许放货 5放货完成
int now_steps_type1 = 0;
//后工位当前执行步骤
//0未执行 1更改指令状态 2下发电气任务信息 3后工位允许取货 4后工位允许放货 5放货完成
int now_steps_type2 = 0;
//双工位任务当前执行步骤
//0未执行 1更改指令状态 2下发电气任务信息 3后工位允许取货 4前工位允许取货 5后工位允许放货 6后工位放货完成 7前工位允许放货 8前工位放货完成
int now_steps_type3 = 0;
String device_code; String device_code;
//请求超时时间 //请求超时时间
private int instruction_require_time_out = 3000; private int instruction_require_time_out = 3000;
//后工位申请任务请求时间 //后工位申请任务请求时间
private Date instruction_require_time = new Date(); private Date instruction_require_time = new Date();
//前工位申请任务请求时间 //前工位申请任务请求时间
private Date instruction_head_time = new Date(); private Date instruction_head_time = new Date();
String notCreateTaskMessage = "";
String notCreateInstMessage = "";
String feedMessage = "";
@Override @Override
public Device getDevice() { public Device getDevice() {
return this.device; return this.device;
@@ -189,6 +209,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task1)); Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task1));
if (inst1 != null) { if (inst1 != null) {
if (StrUtil.equals(inst1.getInstruction_status(), "0")) { if (StrUtil.equals(inst1.getInstruction_status(), "0")) {
//当前执行步骤为更新任务状态
inst1.setInstruction_status("1"); inst1.setInstruction_status("1");
instructionService.update(inst1); instructionService.update(inst1);
TaskDto taskDto = taskserver.findByCodeFromCache(inst1.getTask_code()); TaskDto taskDto = taskserver.findByCodeFromCache(inst1.getTask_code());
@@ -203,6 +224,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
} }
} }
; ;
//this.setNow_steps_type1(1);
} }
} }
} }
@@ -213,6 +235,8 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task2)); Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task2));
if (inst2 != null) { if (inst2 != null) {
if (StrUtil.equals(inst2.getInstruction_status(), "0")) { if (StrUtil.equals(inst2.getInstruction_status(), "0")) {
//当前指令更新状态
now_steps_type2 = 1;
inst2.setInstruction_status("1"); inst2.setInstruction_status("1");
instructionService.update(inst2); instructionService.update(inst2);
TaskDto taskDto = taskserver.findByCodeFromCache(inst2.getTask_code()); TaskDto taskDto = taskserver.findByCodeFromCache(inst2.getTask_code());
@@ -227,6 +251,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
} }
} }
; ;
// this.setNow_steps_type2(1);
} }
} }
} }
@@ -237,6 +262,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task1)); Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task1));
if (inst2 != null) { if (inst2 != null) {
if (StrUtil.equals(inst2.getInstruction_status(), "0")) { if (StrUtil.equals(inst2.getInstruction_status(), "0")) {
//当前指令更新状态
inst2.setInstruction_status("1"); inst2.setInstruction_status("1");
instructionService.update(inst2); instructionService.update(inst2);
TaskDto taskDto = taskserver.findByCodeFromCache(inst2.getTask_code()); TaskDto taskDto = taskserver.findByCodeFromCache(inst2.getTask_code());
@@ -251,6 +277,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
} }
} }
; ;
// this.setNow_steps_type3(1);
} }
} }
} }
@@ -275,12 +302,18 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
} }
; ;
this.writing("to_command1", "4"); this.writing("to_command1", "4");
this.setNow_steps_type1(5);
this.setNow_steps_type1(0);
// this.writing("to_onset1", "0"); // this.writing("to_onset1", "0");
// this.writing("to_target1", "0"); // this.writing("to_target1", "0");
// this.writing("to_task1", "0"); // this.writing("to_task1", "0");
// this.writing("to_type", "0"); // this.writing("to_type", "0");
} }
} }
} else {
if (this.getNow_steps_type1() == 4) {
feedMessage = "请检查:mode == 3 && action1 == 4 && move1 == 0 && task1 > 0 && type == 1";
}
} }
//单任务 后工位放货完成 任务完成 //单任务 后工位放货完成 任务完成
@@ -303,17 +336,28 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
} }
; ;
this.writing("to_command2", "4"); this.writing("to_command2", "4");
this.writing("to_onset2", "0"); this.setNow_steps_type2(5);
this.writing("to_target2", "0"); this.setNow_steps_type2(0);
this.writing("to_task2", "0"); // this.writing("to_onset2", "0");
this.writing("to_type", "0"); // this.writing("to_target2", "0");
// this.writing("to_task2", "0");
// this.writing("to_type", "0");
} }
} }
} else {
if (this.getNow_steps_type2() == 4) {
feedMessage = "请检查:mode == 3 && action2 == 4 && move2 == 0 && task2 > 0 && type == 2";
}
} }
//双任务后工位反馈4 //双任务后工位反馈4
if (mode == 3 && action2 == 4 && move2 == 0 && task1 > 0 && task2 > 0 && type == 3 ){ if (mode == 3 && action2 == 4 && move2 == 0 && task1 > 0 && task2 > 0 && type == 3) {
this.writing("to_command2", "4"); this.writing("to_command2", "4");
this.setNow_steps_type3(6);
} else {
if (this.getNow_steps_type3() == 5) {
feedMessage = "请检查mode == 3 && action2 == 4 && move2 == 0 && task1 > 0 && task2 > 0 && type == 3";
}
} }
//双工位 任务完成 前工位反馈4 //双工位 任务完成 前工位反馈4
@@ -333,8 +377,11 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
array.add(map); array.add(map);
acsToWmsService.feedbackTaskStatusToWms(array); acsToWmsService.feedbackTaskStatusToWms(array);
} }
}; }
;
this.writing("to_command1", "4"); this.writing("to_command1", "4");
this.setNow_steps_type3(8);
this.setNow_steps_type3(0);
// this.writing("to_onset1", "0"); // this.writing("to_onset1", "0");
// this.writing("to_target1", "0"); // this.writing("to_target1", "0");
// this.writing("to_task1", "0"); // this.writing("to_task1", "0");
@@ -344,6 +391,10 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
// this.writing("to_type", "0"); // this.writing("to_type", "0");
} }
} }
} else {
if (this.getNow_steps_type3() == 7) {
feedMessage = "请检查mode == 3 && action1 == 4 && move1 == 0 && task1 > 0 && task2 > 0 && type == 3";
}
} }
@@ -351,10 +402,10 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
if (mode == 3 && action2 == 1 && move2 == 0 && task2 > 0) { if (mode == 3 && action2 == 1 && move2 == 0 && task2 > 0) {
Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task2)); Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task2));
String start_device_code = ""; String start_device_code = "";
if (type == 2){ if (type == 2) {
start_device_code = inst1.getStart_device_code(); start_device_code = inst1.getStart_device_code();
} }
if (type == 3){ if (type == 3) {
start_device_code = inst1.getStart_device_code2(); start_device_code = inst1.getStart_device_code2();
} }
Device startDevice = deviceAppservice.findDeviceByCode(start_device_code); Device startDevice = deviceAppservice.findDeviceByCode(start_device_code);
@@ -365,20 +416,50 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
int mode = siemensConveyorDeviceDriver.getMode(); int mode = siemensConveyorDeviceDriver.getMode();
if (mode == 2 && move == 1) { if (mode == 2 && move == 1) {
this.writing("to_command2", "2"); this.writing("to_command2", "2");
if (type == 2) {
this.setNow_steps_type2(3);
} else if (type == 3) {
this.setNow_steps_type3(3);
}
} else { } else {
log.warn("前工位取货位无货,取货位:{},mode:{},move:{}", start_device_code, mode, move); log.warn("前工位取货位无货,取货位:{},mode:{},move:{}", start_device_code, mode, move);
if (this.getNow_steps_type2() == 2 || this.getNow_steps_type3() == 2) {
feedMessage = "请检查输送线mode == 2 && move == 1";
}
} }
} }
} else {
if (this.getNow_steps_type2() == 2 || this.getNow_steps_type3() == 2) {
feedMessage = "请检查mode == 3 && action2 == 1 && move2 == 0 && task2 > 0";
}
} }
//后工位允许放货 //后工位允许放货
if (mode == 3 && action2 == 3 && move2 == 1 && task2 > 0) { if (mode == 3 && action2 == 3 && move2 == 1 && task2 > 0) {
this.writing("to_command2", "3"); this.writing("to_command2", "3");
if (type == 2) {
this.setNow_steps_type2(4);
} else if (type == 3) {
this.setNow_steps_type3(5);
}
} else {
if (this.getNow_steps_type2() == 3 || this.getNow_steps_type3() == 4) {
feedMessage = "请检查mode == 3 && action2 == 3 && move2 == 1 && task2 > 0";
}
} }
//前工位允许取货 //前工位允许取货
if (mode == 3 && action1 == 1 && move1 == 0 && task1 > 0) { if (mode == 3 && action1 == 1 && move1 == 0 && task1 > 0) {
this.writing("to_command1", "2"); this.writing("to_command1", "2");
if (type == 1) {
this.setNow_steps_type1(3);
} else if (type == 2) {
this.setNow_steps_type3(4);
}
} else {
if (this.getNow_steps_type1() == 2 || this.getNow_steps_type3() == 3) {
feedMessage = "请检查mode == 3 && action1 == 1 && move1 == 0 && task1 > 0";
}
} }
//前工位放货时判断放货位光电信号 //前工位放货时判断放货位光电信号
@@ -393,10 +474,22 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
int mode = siemensConveyorDeviceDriver.getMode(); int mode = siemensConveyorDeviceDriver.getMode();
if (move == 0 && mode == 2) { if (move == 0 && mode == 2) {
this.writing("to_command1", "3"); this.writing("to_command1", "3");
if (type == 1) {
this.setNow_steps_type1(4);
} else if (type == 2) {
this.setNow_steps_type3(7);
}
} else { } else {
log.warn("后工位放货位有货,放货位:{},mode:{},move:{}", next_device_code, mode, move); log.warn("后工位放货位有货,放货位:{},mode:{},move:{}", next_device_code, mode, move);
if (this.getNow_steps_type1() == 3 || this.getNow_steps_type3() == 6) {
feedMessage = "请检查输送线move == 0 && mode == 2";
}
} }
} }
} else {
if (this.getNow_steps_type1() == 3 || this.getNow_steps_type3() == 6) {
feedMessage = "请检查mode == 3 && action1 == 3 && move1 == 1 && task1 > 0";
}
} }
} catch (Exception var17) { } catch (Exception var17) {
@@ -428,8 +521,58 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
case 2: case 2:
//申请任务 //申请任务
if (mode == 2 && move1 == 0 && move2 == 0 && action1 == 0 && action2 == 0 && task1 == 0 && task2 == 0 && !requireSucess) { if (mode == 2 && move1 == 0 && move2 == 0 && action1 == 0 && action2 == 0 && task1 == 0 && task2 == 0 && !requireSucess) {
//获取关联设备驱动信息 判断关联设备是否禁用
Device device = deviceAppservice.findDeviceByCode(device_code);
SlitTwoManipulatorDeviceDriver slitTwoManipulatorDeviceDriver;
if (device.getDeviceDriver() instanceof SlitTwoManipulatorDeviceDriver) {
slitTwoManipulatorDeviceDriver = (SlitTwoManipulatorDeviceDriver) device.getDeviceDriver();
//如果禁用
if (slitTwoManipulatorDeviceDriver.getIs_disable() == 1) {
boolean flag = false;
try {
//就去走关联设备异常取放货工位的任务 任务生成成功返回true 就不会走下面正常生成任务的逻辑
flag = instruction_require2();
} catch (Exception e) {
flag = false;
}
if (flag) {
break;
}
}
}
//没有生成异常取放货工位的任务 就生成正常关联取放货工位的任务
instruction_require(); instruction_require();
feedMessage = "";
logServer.deviceExecuteLog(device_code, "", String.valueOf(task1), "move2:" + move2 + ",action2:" + action2 + ",move1:" + move1 + ",action1:" + action1 + ",requireSucess:" + requireSucess); logServer.deviceExecuteLog(device_code, "", String.valueOf(task1), "move2:" + move2 + ",action2:" + action2 + ",move1:" + move1 + ",action1:" + action1 + ",requireSucess:" + requireSucess);
} else {
// if (!requireSucess) {
// remark = remark + "请求标记为true,请检查mode是否由其他值变为2";
// }
if (!requireSucess) {
String remark = "";
if (mode != 2) {
remark = remark + "mode不为2,";
}
if (move1 != 0) {
remark = remark + "move1不为0,";
}
if (move2 != 0) {
remark = remark + "move2不为0,";
}
if (action1 != 0) {
remark = remark + "action1不为0,";
}
if (action2 != 0) {
remark = remark + "action2不为0,";
}
if (task1 != 0) {
remark = remark + "task1不为0,";
}
if (task2 != 0) {
remark = remark + "task2不为0,";
}
this.setNotCreateTaskMessage(remark);
}
} }
break; break;
case 3: case 3:
@@ -450,8 +593,82 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
last_task2 = task2; last_task2 = task2;
} }
//申请任务 //关联设备异常申请任务
public synchronized boolean instruction_require2() {
Boolean flag = false;
Date date = new Date();
if (date.getTime() - this.instruction_head_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_head_time);
return false;
} else {
this.instruction_head_time = date;
//前工位取货关联设备
List<String> getDeviceCodeList = this.getExtraDeviceCodes("error_head_get_device_code");
//后工位取货关联设备
List<String> backGetDeviceCodeList = this.getExtraDeviceCodes("error_back_get_device_code");
TaskDto taskDto = null;
//遍历前工位取货点设备
for (String getDeviceCode : getDeviceCodeList) {
//去任务表中查询是否有前工位关联设备的重新创建指令的任务
List<TaskDto> taskDtos = taskserver.queryTaskByStartAndIntStatus(getDeviceCode);
//如果有
if (ObjectUtil.isNotEmpty(taskDtos)) {
//按照优先级排序 优先级相等按照创建时间排序
taskDtos = this.sortTask(taskDtos);
taskDto = taskDtos.get(0);
flag = this.executeBusiness(taskDto, getDeviceCodeList, backGetDeviceCodeList);
return flag;
} else {
//去任务表中查询是否有前工位关联设备的就绪状态下的任务
taskDtos = taskserver.queryTaskByStartDeviceCode(getDeviceCode);
if (ObjectUtil.isNotEmpty(taskDtos)) {
//按照优先级排序 优先级相等按照创建时间排序
taskDtos = this.sortTask(taskDtos);
taskDto = taskDtos.get(0);
break;
}
}
}
//如果任务表中起点1或起点2中 无前工位取货点关联设备
//就去查询任务表中查找起点1或起点2为后工位取货点关联设备的任务
if (ObjectUtil.isEmpty(taskDto)) {
for (String backGetDeviceCode : backGetDeviceCodeList) {
//去任务表中查询是否有前工位关联设备的重新创建指令的任务
List<TaskDto> taskDtos = taskserver.queryTaskByNextAndIntStatus(backGetDeviceCode);
if (ObjectUtil.isNotEmpty(taskDtos)) {
//按照优先级排序 优先级相等按照创建时间排序
taskDtos = this.sortTask(taskDtos);
taskDto = taskDtos.get(0);
flag = this.executeBusiness(taskDto, getDeviceCodeList, backGetDeviceCodeList);
return flag;
} else {
//去任务表中查询是否有后工位关联设备的就绪状态下的任务
taskDtos = taskserver.queryTaskByStartDeviceCode(backGetDeviceCode);
if (ObjectUtil.isNotEmpty(taskDtos)) {
//按照优先级排序 优先级相等按照创建时间排序
taskDtos = this.sortTask(taskDtos);
taskDto = taskDtos.get(0);
break;
}
}
}
}
if (!ObjectUtil.isEmpty(taskDto)) {
flag = this.executeReadyBusiness(taskDto, getDeviceCodeList, backGetDeviceCodeList);
if (flag) {
notCreateInstMessage = "";
}
} else {
notCreateTaskMessage = "";
notCreateInstMessage = "未找到关联设备禁用的任务!";
}
}
return flag;
}
//正常申请任务
public synchronized boolean instruction_require() { public synchronized boolean instruction_require() {
boolean flag = false;
Date date = new Date(); Date date = new Date();
if (date.getTime() - this.instruction_head_time.getTime() < (long) this.instruction_require_time_out) { if (date.getTime() - this.instruction_head_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_head_time); log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_head_time);
@@ -469,13 +686,17 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
List<TaskDto> taskDtos = taskserver.queryTaskByStartAndIntStatus(getDeviceCode); List<TaskDto> taskDtos = taskserver.queryTaskByStartAndIntStatus(getDeviceCode);
//如果有 //如果有
if (ObjectUtil.isNotEmpty(taskDtos)) { if (ObjectUtil.isNotEmpty(taskDtos)) {
//按照优先级排序 优先级相等按照创建时间排序
taskDtos = this.sortTask(taskDtos);
taskDto = taskDtos.get(0); taskDto = taskDtos.get(0);
this.executeBusiness(taskDto, getDeviceCodeList, backGetDeviceCodeList); flag = this.executeBusiness(taskDto, getDeviceCodeList, backGetDeviceCodeList);
return true; return flag;
} else { } else {
//去任务表中查询是否有前工位关联设备的就绪状态下的任务 //去任务表中查询是否有前工位关联设备的就绪状态下的任务
taskDtos = taskserver.queryTaskByStartDeviceCode(getDeviceCode); taskDtos = taskserver.queryTaskByStartDeviceCode(getDeviceCode);
if (ObjectUtil.isNotEmpty(taskDtos)) { if (ObjectUtil.isNotEmpty(taskDtos)) {
//按照优先级排序 优先级相等按照创建时间排序
taskDtos = this.sortTask(taskDtos);
taskDto = taskDtos.get(0); taskDto = taskDtos.get(0);
break; break;
} }
@@ -488,28 +709,40 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
//去任务表中查询是否有前工位关联设备的重新创建指令的任务 //去任务表中查询是否有前工位关联设备的重新创建指令的任务
List<TaskDto> taskDtos = taskserver.queryTaskByNextAndIntStatus(backGetDeviceCode); List<TaskDto> taskDtos = taskserver.queryTaskByNextAndIntStatus(backGetDeviceCode);
if (ObjectUtil.isNotEmpty(taskDtos)) { if (ObjectUtil.isNotEmpty(taskDtos)) {
//按照优先级排序 优先级相等按照创建时间排序
taskDtos = this.sortTask(taskDtos);
taskDto = taskDtos.get(0); taskDto = taskDtos.get(0);
this.executeBusiness(taskDto, getDeviceCodeList, backGetDeviceCodeList); flag = this.executeBusiness(taskDto, getDeviceCodeList, backGetDeviceCodeList);
return true; return flag;
} else { } else {
//去任务表中查询是否有后工位关联设备的就绪状态下的任务 //去任务表中查询是否有后工位关联设备的就绪状态下的任务
taskDtos = taskserver.queryTaskByStartDeviceCode(backGetDeviceCode); taskDtos = taskserver.queryTaskByStartDeviceCode(backGetDeviceCode);
if (ObjectUtil.isNotEmpty(taskDtos)) { if (ObjectUtil.isNotEmpty(taskDtos)) {
//按照优先级排序 优先级相等按照创建时间排序
taskDtos = this.sortTask(taskDtos);
taskDto = taskDtos.get(0); taskDto = taskDtos.get(0);
break; break;
} }
} }
} }
} }
if (!ObjectUtil.isEmpty(taskDto)) { if (!ObjectUtil.isEmpty(taskDto)) {
this.executeReadyBusiness(taskDto, getDeviceCodeList, backGetDeviceCodeList); flag = this.executeReadyBusiness(taskDto, getDeviceCodeList, backGetDeviceCodeList);
if (flag) {
notCreateInstMessage = "";
}
} else {
notCreateTaskMessage = "";
notCreateInstMessage = "未找到正常关联设备的任务!";
} }
} }
return true; return flag;
} }
//执行重新生成指令的任务 //执行重新生成指令的任务
public void executeBusiness(TaskDto taskDto, List<String> getDeviceCodeList, List<String> backGetDeviceCodeList) { public synchronized boolean executeBusiness(TaskDto taskDto, List<String> getDeviceCodeList, List<String> backGetDeviceCodeList) {
boolean flag = false;
//任务类型 1.前工位任务 2.后工位任务 3.双工位任务 //任务类型 1.前工位任务 2.后工位任务 3.双工位任务
String type = ""; String type = "";
//获取指令信息 //获取指令信息
@@ -552,17 +785,33 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
//修改指令状态 //修改指令状态
instructionDto.setInstruction_status("1"); instructionDto.setInstruction_status("1");
instructionDto.setUpdate_time(DateUtil.now()); instructionDto.setUpdate_time(DateUtil.now());
instructionService.update(instructionDto); try {
instructionService.update(instructionDto);
if (StrUtil.equals(type, "1")) {
this.setNow_steps_type1(1);
}
if (StrUtil.equals(type, "2")) {
this.setNow_steps_type2(1);
}
if (StrUtil.equals(type, "3")) {
this.setNow_steps_type3(1);
}
flag = true;
} catch (Exception e) {
logServer.deviceExecuteLog(device_code, "", instructionDto.getInstruction_code(), "执行重新生成指令的任务失败,原因->" + e.getMessage());
}
//下发电气信号 //下发电气信号
this.sendSignalType(instructionDto, type); this.sendSignalType(instructionDto, type);
//请求任务成功 //请求任务成功
this.setRequireSucess(true); this.setRequireSucess(true);
return flag;
} }
//执行就绪状态下的任务 //执行就绪状态下的任务
public void executeReadyBusiness(TaskDto taskDto, List<String> getDeviceCodeList, List<String> backGetDeviceCodeList) { public synchronized boolean executeReadyBusiness(TaskDto taskDto, List<String> getDeviceCodeList, List<String> backGetDeviceCodeList) {
boolean flag = false;
//任务类型 1.前工位任务 2.后工位任务 3.双工位任务 //任务类型 1.前工位任务 2.后工位任务 3.双工位任务
String type = ""; String type = "";
//获取任务表中的取货点1 //获取任务表中的取货点1
@@ -639,8 +888,9 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
try { try {
instructionService.create(instdto); instructionService.create(instdto);
flag = true;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); notCreateInstMessage = e.getMessage();
logServer.deviceExecuteLog(device_code, "", instdto.getInstruction_code(), "指令创建失败,原因->" + e.getMessage()); logServer.deviceExecuteLog(device_code, "", instdto.getInstruction_code(), "指令创建失败,原因->" + e.getMessage());
} }
@@ -654,10 +904,11 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
//请求任务成功 //请求任务成功
this.setRequireSucess(true); this.setRequireSucess(true);
return flag;
} }
//下发电气信号 //下发电气信号
public void sendSignalType(Instruction dto, String type) { public synchronized void sendSignalType(Instruction dto, String type) {
String start_device_code = dto.getStart_device_code(); String start_device_code = dto.getStart_device_code();
String next_device_code = dto.getNext_device_code(); String next_device_code = dto.getNext_device_code();
Device startDevice = deviceAppservice.findDeviceByCode(start_device_code); Device startDevice = deviceAppservice.findDeviceByCode(start_device_code);
@@ -670,12 +921,14 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
this.writing("to_task1", dto.getInstruction_code()); this.writing("to_task1", dto.getInstruction_code());
this.writing("to_command1", "1"); this.writing("to_command1", "1");
this.writing("to_type", "1"); this.writing("to_type", "1");
this.setNow_steps_type1(2);
} else if (StrUtil.equals(type, "2")) { } else if (StrUtil.equals(type, "2")) {
this.writing("to_onset2", start_addr); this.writing("to_onset2", start_addr);
this.writing("to_target2", next_addr); this.writing("to_target2", next_addr);
this.writing("to_task2", dto.getInstruction_code()); this.writing("to_task2", dto.getInstruction_code());
this.writing("to_command2", "1"); this.writing("to_command2", "1");
this.writing("to_type", "2"); this.writing("to_type", "2");
this.setNow_steps_type2(2);
} else if (StrUtil.equals(type, "3")) { } else if (StrUtil.equals(type, "3")) {
String start_device_code2 = dto.getStart_device_code2(); String start_device_code2 = dto.getStart_device_code2();
String next_device_code2 = dto.getNext_device_code2(); String next_device_code2 = dto.getNext_device_code2();
@@ -692,6 +945,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
this.writing("to_task2", dto.getInstruction_code()); this.writing("to_task2", dto.getInstruction_code());
this.writing("to_command2", "1"); this.writing("to_command2", "1");
this.writing("to_type", "3"); this.writing("to_type", "3");
this.setNow_steps_type3(2);
} }
} }
@@ -699,6 +953,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
public void isSetAddress(Device device) { public void isSetAddress(Device device) {
if (ObjectUtil.isEmpty(device.getExtraValue().get("address"))) { if (ObjectUtil.isEmpty(device.getExtraValue().get("address"))) {
logServer.deviceExecuteLog(device_code, "", "task1:" + task1 + ",task2:" + task2, "设备:" + device.getDevice_code() + "未设置电气调度号!"); logServer.deviceExecuteLog(device_code, "", "task1:" + task1 + ",task2:" + task2, "设备:" + device.getDevice_code() + "未设置电气调度号!");
notCreateInstMessage = "设备:" + device.getDevice_code() + "未设置电气调度号!";
throw new BadRequestException("设备:" + device.getDevice_code() + "未设置电气调度号!"); throw new BadRequestException("设备:" + device.getDevice_code() + "未设置电气调度号!");
} }
} }
@@ -795,16 +1050,35 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
return devicesList; return devicesList;
} }
public List<TaskDto> sortTask(List<TaskDto> taskDtos){
Collections.sort(taskDtos, new Comparator<TaskDto>() {
@Override
public int compare(TaskDto t1, TaskDto t2) {
//优先级从大到小
int i = t2.getPriority().compareTo(t1.getPriority());
//如果优先级相等
if (i == 0){
//时间从早到晚
i = t1.getCreate_time().compareTo(t2.getCreate_time());
}
return i;
}
});
return taskDtos;
}
@Override @Override
public JSONObject getDeviceStatusName() { public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject(); JSONObject jo = new JSONObject();
String move1 = ""; String move_1 = "";
String move2 = ""; String move_2 = "";
String action1 = ""; String action1 = "";
String action2 = ""; String action2 = "";
String walk_y = ""; String walk_y = "";
String mode = ""; String mode = "";
String status = ""; String status = "";
String is_disable = "";
if (this.getMode() == 0) { if (this.getMode() == 0) {
mode = "脱机"; mode = "脱机";
@@ -816,7 +1090,9 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
mode = "运行中"; mode = "运行中";
} }
if (this.getStatus() == 1) { if (this.getStatus() == 0) {
status = "0";
} else if (this.getStatus() == 1) {
status = "待机"; status = "待机";
} else if (this.getStatus() == 2) { } else if (this.getStatus() == 2) {
status = "生产中"; status = "生产中";
@@ -825,15 +1101,15 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
} }
if (this.getMove1() == 0) { if (this.getMove1() == 0) {
move1 = "无货"; move_1 = "无货";
} else if (this.getMove1() == 1) { } else if (this.getMove1() == 1) {
move1 = "有货"; move_1 = "有货";
} }
if (this.getMove2() == 0) { if (this.getMove2() == 0) {
move2 = "无货"; move_2 = "无货";
} else if (this.getMove2() == 1) { } else if (this.getMove2() == 1) {
move2 = "有货"; move_2 = "有货";
} }
if (this.getAction1() == 1) { if (this.getAction1() == 1) {
@@ -862,25 +1138,41 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
walk_y = "非原位"; walk_y = "非原位";
} }
if (this.getIs_disable() == 0) {
is_disable = "正常";
} else if (this.getIs_disable() == 1) {
is_disable = "禁用";
}
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("status", status); jo.put("status", status);
jo.put("move1", move1); jo.put("move_1", move_1);
jo.put("move2", move2); jo.put("move_2", move_2);
jo.put("action1", action1); jo.put("action_1", action1);
jo.put("action2", action2); jo.put("action_2", action2);
jo.put("walk_y", walk_y); jo.put("walk_y", walk_y);
jo.put("error", this.getError()); jo.put("error", this.getError());
jo.put("task1", this.getTask1()); jo.put("task1", this.getTask1());
jo.put("task2", this.getTask2()); jo.put("task2", this.getTask2());
jo.put("isOnline", this.getIsonline()); jo.put("isOnline", this.getIsonline());
jo.put("isError", this.getIserror()); jo.put("isError", this.getIserror());
jo.put("is_disable1", this.getIs_disable());
jo.put("is_disable", is_disable);
jo.put("message", this.getMessage()); jo.put("message", this.getMessage());
jo.put("is_click", true);
jo.put("driver_type", "slit_two_manipulator");
jo.put("notCreateTaskMessage", notCreateTaskMessage);
jo.put("notCreateInstMessage", notCreateInstMessage);
jo.put("feedMessage", feedMessage);
return jo; return jo;
} }
@Override @Override
public void setDeviceStatus(JSONObject data) { public void setDeviceStatus(JSONObject data) {
String is_disable = data.getString("is_disable");
if (StrUtil.isNotEmpty(is_disable)) {
this.setIs_disable(Integer.parseInt(is_disable));
}
} }
} }

View File

@@ -2,6 +2,6 @@ ENV = 'production'
# 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇Nginx 配置 # 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇Nginx 配置
# 接口地址,注意协议,如果你没有配置 ssl需要将 https 改为 http # 接口地址,注意协议,如果你没有配置 ssl需要将 https 改为 http
VUE_APP_BASE_API = 'http://47.97.157.227:8010' VUE_APP_BASE_API = 'http://127.0.0.1:8010'
# 如果接口是 http 形式, wss 需要改为 ws # 如果接口是 http 形式, wss 需要改为 ws
VUE_APP_WS_API = 'ws://47.97.157.227:8010' VUE_APP_WS_API = 'ws://127.0.0.1:8010'

View File

@@ -101,7 +101,6 @@
<el-select <el-select
v-model="form.link_device_code" v-model="form.link_device_code"
filterable filterable
multiple
placeholder="请选择" placeholder="请选择"
> >
<el-option <el-option
@@ -174,7 +173,6 @@
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="后工位取货点" prop="device_code" label-width="200"> <el-form-item label="后工位取货点" prop="device_code" label-width="200">
<el-select <el-select
@@ -211,6 +209,82 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row>
<el-col :span="8">
<el-form-item label="关联设备异常时前工位取货点" prop="device_code" label-width="200">
<el-select
v-model="form.error_head_get_device_code"
multiple
filterable
reserve-keyword
placeholder="请选择"
>
<el-option
v-for="item in deviceList"
:label="item.device_name"
:value="item.device_code"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="关联设备异常时前工位放货点" prop="device_code" label-width="200">
<el-select
v-model="form.error_head_put_device_code"
filterable
reserve-keyword
multiple
placeholder="请选择"
>
<el-option
v-for="item in deviceList"
:key="item.device_code"
:label="item.device_name"
:value="item.device_code"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="关联设备异常时后工位取货点" prop="device_code" label-width="200">
<el-select
v-model="form.error_back_get_device_code"
filterable
reserve-keyword
multiple
placeholder="请选择"
>
<el-option
v-for="item in deviceList"
:label="item.device_name"
:value="item.device_code"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="关联设备异常时后工位放货点" prop="device_code" label-width="200">
<el-select
v-model="form.error_back_put_device_code"
filterable
reserve-keyword
multiple
placeholder="请选择"
>
<el-option
v-for="item in deviceList"
:key="item.device_code"
:label="item.device_name"
:value="item.device_code"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form> </el-form>
</el-card> </el-card>
@@ -377,7 +451,11 @@ export default {
head_get_device_code: [], head_get_device_code: [],
back_get_device_code: [], back_get_device_code: [],
head_put_device_code: [], head_put_device_code: [],
back_put_device_code: [] back_put_device_code: [],
error_head_get_device_code: [],
error_back_get_device_code: [],
error_head_put_device_code: [],
error_back_put_device_code: []
}, },
rules: {} rules: {}
} }

View File

@@ -485,6 +485,9 @@ export default {
} else if (val === 'error_num') { } else if (val === 'error_num') {
const obj = { name: '故障次数', value: data[val] } const obj = { name: '故障次数', value: data[val] }
arr.push(obj) arr.push(obj)
} else if (val === 'is_disable') {
const obj = { name: '是否禁用', value: data[val] }
arr.push(obj)
} }
} }
return arr return arr

View File

@@ -485,6 +485,9 @@ export default {
} else if (val === 'error_num') { } else if (val === 'error_num') {
const obj = { name: '故障次数', value: data[val] } const obj = { name: '故障次数', value: data[val] }
arr.push(obj) arr.push(obj)
} else if (val === 'is_disable') {
const obj = { name: '是否禁用', value: data[val] }
arr.push(obj)
} }
} }
return arr return arr

View File

@@ -1,7 +1,7 @@
<template> <template>
<div style="overflow: hidden"> <div style="overflow: hidden">
<el-row> <el-row>
<div id="container" className="container" style="min-height: 100%" /> <div id="container" className="container" style="min-height: 100%"/>
</el-row> </el-row>
<!--点击设备显示信息--> <!--点击设备显示信息-->
<el-dialog <el-dialog
@@ -33,7 +33,7 @@
<el-dialog title="设备设置" :visible.sync="dialogFormVisible" width="35%"> <el-dialog title="设备设置" :visible.sync="dialogFormVisible" width="35%">
<el-form :model="form" size="small"> <el-form :model="form" size="small">
<el-form-item label="设备编号" prop="device_code" label-width="80px"> <el-form-item label="设备编号" prop="device_code" label-width="80px">
<el-input v-model="form.device_code" :disabled="true" /> <el-input v-model="form.device_code" :disabled="true"/>
</el-form-item> </el-form-item>
<el-form-item label="设备状态" label-width="80px"> <el-form-item label="设备状态" label-width="80px">
@@ -54,7 +54,7 @@
<el-dialog title="设备设置" :visible.sync="dialogFormVisible3" width="35%"> <el-dialog title="设备设置" :visible.sync="dialogFormVisible3" width="35%">
<el-form :model="form" size="small"> <el-form :model="form" size="small">
<el-form-item label="设备编号" prop="device_code" label-width="80px"> <el-form-item label="设备编号" prop="device_code" label-width="80px">
<el-input v-model="form.device_code" :disabled="true" /> <el-input v-model="form.device_code" :disabled="true"/>
</el-form-item> </el-form-item>
<el-form-item label="设备状态" label-width="80px"> <el-form-item label="设备状态" label-width="80px">
<el-radio-group v-model="form.hasGoodStatus"> <el-radio-group v-model="form.hasGoodStatus">
@@ -64,7 +64,7 @@
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="物料编码" prop="material_type" label-width="80px"> <el-form-item label="物料编码" prop="material_type" label-width="80px">
<el-input v-model="form.material_type" /> <el-input v-model="form.material_type"/>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
@@ -77,18 +77,12 @@
<el-dialog title="设备设置" :visible.sync="dialogFormVisible4" width="35%"> <el-dialog title="设备设置" :visible.sync="dialogFormVisible4" width="35%">
<el-form :model="form" size="small"> <el-form :model="form" size="small">
<el-form-item label="设备编号" prop="device_code" label-width="120px"> <el-form-item label="设备编号" prop="device_code" label-width="120px">
<el-input v-model="form.device_code" :disabled="true" /> <el-input v-model="form.device_code" :disabled="true"/>
</el-form-item> </el-form-item>
<el-form-item label="缺料请求成功" prop="requireSucess" label-width="120px"> <el-form-item label="禁用机械手" prop="is_disable" label-width="120px">
<el-radio-group v-model="form.requireSucess"> <el-radio-group v-model="form.is_disable">
<el-radio-button :label="0"></el-radio-button> <el-radio-button :label="0">正常</el-radio-button>
<el-radio-button :label="1"></el-radio-button> <el-radio-button :label="1">禁用</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item label="空想请求成功" prop="fullrequireSucess" label-width="120px">
<el-radio-group v-model="form.fullrequireSucess">
<el-radio-button :label="0"></el-radio-button>
<el-radio-button :label="1"></el-radio-button>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-form> </el-form>
@@ -102,11 +96,11 @@
<el-dialog title="设备设置" :visible.sync="dialogFormVisible1" width="35%"> <el-dialog title="设备设置" :visible.sync="dialogFormVisible1" width="35%">
<el-form :model="form" size="small"> <el-form :model="form" size="small">
<el-form-item label="设备编号" prop="device_code" label-width="80px"> <el-form-item label="设备编号" prop="device_code" label-width="80px">
<el-input v-model="form.device_code" :disabled="true" /> <el-input v-model="form.device_code" :disabled="true"/>
</el-form-item> </el-form-item>
<el-form-item label="条码" label-width="80px"> <el-form-item label="条码" label-width="80px">
<el-input v-model="form.barcode" :disabled="false" /> <el-input v-model="form.barcode" :disabled="false"/>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
@@ -121,12 +115,13 @@
import crudStage from '@/api/logicflow/stage' import crudStage from '@/api/logicflow/stage'
import paramCrud from '@/api/system/param' import paramCrud from '@/api/system/param'
import deviceCrud from '@/api/acs/device/device' import deviceCrud from '@/api/acs/device/device'
import { getDeviceByCodes } from '@/api/acs/device/deviceStageMonitor' import {getDeviceByCodes} from '@/api/acs/device/deviceStageMonitor'
import '@logicflow/core/dist/style/index.css' import '@logicflow/core/dist/style/index.css'
import '@logicflow/extension/lib/style/index.css' import '@logicflow/extension/lib/style/index.css'
import { LogicFlow } from '@logicflow/core' import {LogicFlow} from '@logicflow/core'
import { registerCustomElement } from '@/views/system/logicflow/editor/components/node' import {registerCustomElement} from '@/views/system/logicflow/editor/components/node'
let data = {} let data = {}
let lf = '' let lf = ''
export default { export default {
@@ -152,7 +147,8 @@ export default {
suspended: null, suspended: null,
material_type: '', material_type: '',
requireSucess: '', requireSucess: '',
fullrequireSucess: '' fullrequireSucess: '',
is_disable: ''
}, },
allDeviceMsg: [], allDeviceMsg: [],
msgTop: '200px', msgTop: '200px',
@@ -197,10 +193,10 @@ export default {
}) })
lf.setTheme( lf.setTheme(
{ {
baseEdge: { strokeWidth: 1 }, baseEdge: {strokeWidth: 1},
baseNode: { strokeWidth: 1 }, baseNode: {strokeWidth: 1},
nodeText: { overflowMode: 'autoWrap', lineHeight: 1.5 }, nodeText: {overflowMode: 'autoWrap', lineHeight: 1.5},
edgeText: { overflowMode: 'autoWrap', lineHeight: 1.5 } edgeText: {overflowMode: 'autoWrap', lineHeight: 1.5}
} }
) )
// 注册自定义元素 // 注册自定义元素
@@ -280,6 +276,8 @@ export default {
this.dialogFormVisible4 = true this.dialogFormVisible4 = true
} else if (clickObj.data.driver_type === 'hailiang_xj_plc_test') { } else if (clickObj.data.driver_type === 'hailiang_xj_plc_test') {
this.$refs.child1.setForm(clickObj) this.$refs.child1.setForm(clickObj)
} else if (clickObj.data.driver_type === 'slit_two_manipulator') {
this.dialogFormVisible4 = true
} else { } else {
this.dialogFormVisible = true this.dialogFormVisible = true
} }
@@ -291,6 +289,7 @@ export default {
this.form.material_type = clickObj.data.material_type this.form.material_type = clickObj.data.material_type
this.form.requireSucess = clickObj.data.requireSucess this.form.requireSucess = clickObj.data.requireSucess
this.form.fullrequireSucess = clickObj.data.fullrequireSucess this.form.fullrequireSucess = clickObj.data.fullrequireSucess
this.form.is_disable = clickObj.data.is_disable1
}, },
moveShow(nodeData) { // 点击之后显示出来的数据----只需要设备信息 moveShow(nodeData) { // 点击之后显示出来的数据----只需要设备信息
let item = '' let item = ''
@@ -304,8 +303,8 @@ export default {
if (item.device_code && item.data) { if (item.device_code && item.data) {
// console.log('item', item) // console.log('item', item)
this.arr = [ this.arr = [
{ name: '设备编号', value: item.device_code }, {name: '设备编号', value: item.device_code},
{ name: '设备名称', value: item.device_name } {name: '设备名称', value: item.device_name}
] ]
const data = item.data const data = item.data
for (const val in data) { for (const val in data) {
@@ -313,197 +312,209 @@ export default {
continue continue
} }
if (val === 'message' && data.isError === true) { if (val === 'message' && data.isError === true) {
const obj = { name: '设备信息', value: data[val] } const obj = {name: '设备信息', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} }
if (val === 'message' && data.isError === 'false') { if (val === 'message' && data.isError === 'false') {
const obj = { name: '异常信息', value: data[val] } const obj = {name: '异常信息', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} }
if (val === 'move') { if (val === 'move') {
const obj = { name: '光电信号', value: data[val] } const obj = {name: '光电信号', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'mode') { } else if (val === 'mode') {
const obj = { name: '模式', value: data[val] } const obj = {name: '模式', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'error') { } else if (val === 'error') {
const obj = { name: '报警', value: data[val] } const obj = {name: '报警', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'ip') { } else if (val === 'ip') {
const obj = { name: 'IP地址', value: data[val] } const obj = {name: 'IP地址', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'number') { } else if (val === 'number') {
const obj = { name: '托盘数量', value: data[val] } const obj = {name: '托盘数量', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'instruction_message') { } else if (val === 'instruction_message') {
const obj = { name: '指令信息', value: data[val] } const obj = {name: '指令信息', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'last_instruction_message') { } else if (val === 'last_instruction_message') {
const obj = { name: '上次指令信息', value: data[val] } const obj = {name: '上次指令信息', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'container') { } else if (val === 'container') {
const obj = { name: '载具号', value: data[val] } const obj = {name: '载具号', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'last_container') { } else if (val === 'last_container') {
const obj = { name: '上次载具号', value: data[val] } const obj = {name: '上次载具号', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'instruction_code') { } else if (val === 'instruction_code') {
const obj = { name: '指令号', value: data[val] } const obj = {name: '指令号', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'last_instruction_code') { } else if (val === 'last_instruction_code') {
const obj = { name: '上次指令号', value: data[val] } const obj = {name: '上次指令号', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'action') { } else if (val === 'action') {
const obj = { name: '动作信号', value: data[val] } const obj = {name: '动作信号', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'io_action') { } else if (val === 'io_action') {
const obj = { name: '允许进出信号', value: data[val] } const obj = {name: '允许进出信号', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'material') { } else if (val === 'material') {
const obj = { name: '物料', value: data[val] } const obj = {name: '物料', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'batch') { } else if (val === 'batch') {
const obj = { name: '批次', value: data[val] } const obj = {name: '批次', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'requestSucess') { } else if (val === 'requestSucess') {
const obj = { name: '是否请求任务', value: data[val] } const obj = {name: '是否请求任务', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'applySucess') { } else if (val === 'applySucess') {
const obj = { name: '是否申请指令', value: data[val] } const obj = {name: '是否申请指令', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'message') { } else if (val === 'message') {
const obj = { name: '说明', value: data[val] } const obj = {name: '说明', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'status') { } else if (val === 'status') {
const obj = { name: '设备状态', value: data[val] } const obj = {name: '设备状态', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'open_time') { } else if (val === 'open_time') {
const obj = { name: '开机时间', value: data[val] } const obj = {name: '开机时间', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'close_time') { } else if (val === 'close_time') {
const obj = { name: '关机时间', value: data[val] } const obj = {name: '关机时间', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'standby_time') { } else if (val === 'standby_time') {
const obj = { name: '待机时间', value: data[val] } const obj = {name: '待机时间', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'production_time') { } else if (val === 'production_time') {
const obj = { name: '生产时间', value: data[val] } const obj = {name: '生产时间', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'error_time') { } else if (val === 'error_time') {
const obj = { name: '故障时间', value: data[val] } const obj = {name: '故障时间', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'weight') { } else if (val === 'weight') {
const obj = { name: '生产重量', value: data[val] } const obj = {name: '生产重量', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'order_No') { } else if (val === 'order_No') {
const obj = { name: '工单号', value: data[val] } const obj = {name: '工单号', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'mix_num') { } else if (val === 'mix_num') {
const obj = { name: '碾次', value: data[val] } const obj = {name: '碾次', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'barcode') { } else if (val === 'barcode') {
const obj = { name: '条码', value: data[val] } const obj = {name: '条码', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'qualified') { } else if (val === 'qualified') {
const obj = { name: '合格数量', value: data[val] } const obj = {name: '合格数量', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'unqualified') { } else if (val === 'unqualified') {
const obj = { name: '不合格数量', value: data[val] } const obj = {name: '不合格数量', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'put_station') { } else if (val === 'put_station') {
const obj = { name: '当前码盘工位', value: data[val] } const obj = {name: '当前码盘工位', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'encoder_qty') { } else if (val === 'encoder_qty') {
const obj = { name: '码盘数量', value: data[val] } const obj = {name: '码盘数量', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'outKiln_move') { } else if (val === 'outKiln_move') {
const obj = { name: '出窑光电', value: data[val] } const obj = {name: '出窑光电', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'outKiln_barcode') { } else if (val === 'outKiln_barcode') {
const obj = { name: '出窑条码', value: data[val] } const obj = {name: '出窑条码', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'outKiln_device') { } else if (val === 'outKiln_device') {
const obj = { name: '出窑设备', value: data[val] } const obj = {name: '出窑设备', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'car_sum') { } else if (val === 'car_sum') {
const obj = { name: '窑车总数', value: data[val] } const obj = {name: '窑车总数', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'nullCar_qty') { } else if (val === 'nullCar_qty') {
const obj = { name: '空窑车数', value: data[val] } const obj = {name: '空窑车数', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'burning_car_qty') { } else if (val === 'burning_car_qty') {
const obj = { name: '在烧窑车数', value: data[val] } const obj = {name: '在烧窑车数', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'container_qty') { } else if (val === 'container_qty') {
const obj = { name: '托盘数', value: data[val] } const obj = {name: '托盘数', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'tray_crib_qty') { } else if (val === 'tray_crib_qty') {
const obj = { name: '托盘垛数', value: data[val] } const obj = {name: '托盘垛数', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'total_container') { } else if (val === 'total_container') {
const obj = { name: '托盘总数量', value: data[val] } const obj = {name: '托盘总数量', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'total_split') { } else if (val === 'total_split') {
const obj = { name: '累计拆垛数量', value: data[val] } const obj = {name: '累计拆垛数量', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'getStation') { } else if (val === 'getStation') {
const obj = { name: '当前抓取工位', value: data[val] } const obj = {name: '当前抓取工位', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'putStation') { } else if (val === 'putStation') {
const obj = { name: '当前码盘工位', value: data[val] } const obj = {name: '当前码盘工位', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'move_1') { } else if (val === 'move_1') {
const obj = { name: '前工位光电信号', value: data[val] } const obj = {name: '前工位光电信号', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'move_2') { } else if (val === 'move_2') {
const obj = { name: '后工位光电信号', value: data[val] } const obj = {name: '后工位光电信号', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'action_1') { } else if (val === 'action_1') {
const obj = { name: '前工位动作信号', value: data[val] } const obj = {name: '前工位动作信号', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'action_2') { } else if (val === 'action_2') {
const obj = { name: '后工位动作信号', value: data[val] } const obj = {name: '后工位动作信号', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'walk_y') { } else if (val === 'walk_y') {
const obj = { name: '行走列', value: data[val] } const obj = {name: '行走列', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'task1') { } else if (val === 'task1') {
const obj = { name: '前工位任务号', value: data[val] } const obj = {name: '前工位任务号', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'task2') { } else if (val === 'task2') {
const obj = { name: '后工位任务号', value: data[val] } const obj = {name: '后工位任务号', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'labeling_qty') { } else if (val === 'labeling_qty') {
const obj = { name: '贴标数量', value: data[val] } const obj = {name: '贴标数量', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'container_type') { } else if (val === 'container_type') {
const obj = { name: '托盘类型', value: data[val] } const obj = {name: '托盘类型', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'specifications') { } else if (val === 'specifications') {
const obj = { name: '规格', value: data[val] } const obj = {name: '规格', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'onoff_status') { } else if (val === 'onoff_status') {
const obj = { name: '开关机状态', value: data[val] } const obj = {name: '开关机状态', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'task_qty') { } else if (val === 'task_qty') {
const obj = { name: '当前任务数量', value: data[val] } const obj = {name: '当前任务数量', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'finishTask_qty') { } else if (val === 'finishTask_qty') {
const obj = { name: '完成任务数量', value: data[val] } const obj = {name: '完成任务数量', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'AlongSide') { } else if (val === 'AlongSide') {
const obj = { name: 'A长边', value: data[val] } const obj = {name: 'A长边', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'BshortSide') { } else if (val === 'BshortSide') {
const obj = { name: 'B短边', value: data[val] } const obj = {name: 'B短边', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'Htrapezoidal') { } else if (val === 'Htrapezoidal') {
const obj = { name: 'H梯形高', value: data[val] } const obj = {name: 'H梯形高', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} else if (val === 'Wthickness') { } else if (val === 'Wthickness') {
const obj = { name: 'W厚度', value: data[val] } const obj = {name: 'W厚度', value: data[val]}
this.arr.push(obj)
} else if (val === 'is_disable') {
const obj = {name: '是否禁用', value: data[val]}
this.arr.push(obj)
} else if (val === 'notCreateTaskMessage') {
const obj = {name: '任务创建失败原因', value: data[val]}
this.arr.push(obj)
} else if (val === 'notCreateInstMessage') {
const obj = {name: '指令创建失败原因', value: data[val]}
this.arr.push(obj)
} else if (val === 'feedMessage') {
const obj = {name: '未反馈电气信号原因', value: data[val]}
this.arr.push(obj) this.arr.push(obj)
} }
} }
@@ -512,7 +523,7 @@ export default {
}, },
initStatus() { // 初始化所有节点的设备信息通过节点id对应设备编号 initStatus() { // 初始化所有节点的设备信息通过节点id对应设备编号
let resion = {} let resion = {}
resion = lf.getGraphData().nodes.map(item => ({ id: item.id, device_code: item.properties.device })) resion = lf.getGraphData().nodes.map(item => ({id: item.id, device_code: item.properties.device}))
getDeviceByCodes(resion).then(res => { getDeviceByCodes(resion).then(res => {
console.log(res) console.log(res)
this.allDeviceMsg = res // 拿到所有节点的设备数据 this.allDeviceMsg = res // 拿到所有节点的设备数据
@@ -538,7 +549,7 @@ export default {
} }
} }
// 设置动态实时显示设备信息 // 设置动态实时显示设备信息
const { nodes } = lf.getSelectElements() // 获取选中的节点 const {nodes} = lf.getSelectElements() // 获取选中的节点
// console.log(nodes) // console.log(nodes)
if (nodes.length === 1) { // 因为是定时器,没有选中则不用实时更新显示数据 if (nodes.length === 1) { // 因为是定时器,没有选中则不用实时更新显示数据
this.moveShow(nodes[0]) // 监控模式下不可能托选,因此就只有一个数据 this.moveShow(nodes[0]) // 监控模式下不可能托选,因此就只有一个数据
@@ -547,7 +558,7 @@ export default {
}, },
dialogSave() { dialogSave() {
deviceCrud.changeDeviceStatus(this.form).then(res => { deviceCrud.changeDeviceStatus(this.form).then(res => {
this.$notify({ title: '操作成功', message: '', type: 'success' }) this.$notify({title: '操作成功', message: '', type: 'success'})
this.dialogFormVisible = false this.dialogFormVisible = false
this.dialogFormVisible3 = false this.dialogFormVisible3 = false
this.dialogFormVisible4 = false this.dialogFormVisible4 = false
@@ -588,12 +599,15 @@ body {
background-color: #f8f9fa; background-color: #f8f9fa;
height: 100%; height: 100%;
} }
.newDialog /deep/ .el-dialog__header { .newDialog /deep/ .el-dialog__header {
padding: 1vh 1vw 0 1vw; padding: 1vh 1vw 0 1vw;
} }
.newDialog /deep/ .el-dialog__body { .newDialog /deep/ .el-dialog__body {
padding: 1vh 1vw; padding: 1vh 1vw;
} }
.toolbar-sty { .toolbar-sty {
position: absolute; position: absolute;
margin-top: 5px; margin-top: 5px;