This commit is contained in:
2022-11-30 20:13:33 +08:00
parent 1bcf3bd93f
commit 56369014a9
7 changed files with 200 additions and 108 deletions

View File

@@ -45,21 +45,21 @@
<artifactId>commons-io</artifactId> <artifactId>commons-io</artifactId>
<version>2.8.0</version> <version>2.8.0</version>
</dependency> </dependency>
<!-- <dependency>--> <dependency>
<!-- <groupId>org.apache.poi</groupId>--> <groupId>org.apache.poi</groupId>
<!-- <artifactId>poi</artifactId>--> <artifactId>poi</artifactId>
<!-- <version>4.0.0</version>--> <version>4.1.2</version>
<!-- </dependency>--> </dependency>
<!-- <dependency>--> <dependency>
<!-- <groupId>org.apache.poi</groupId>--> <groupId>org.apache.poi</groupId>
<!-- <artifactId>poi-ooxml</artifactId>--> <artifactId>poi-ooxml</artifactId>
<!-- <version>4.0.0</version>--> <version>4.1.2</version>
<!-- </dependency>--> </dependency>
<!-- <dependency>--> <dependency>
<!-- <groupId>org.apache.poi</groupId>--> <groupId>org.apache.poi</groupId>
<!-- <artifactId>poi-ooxml-schemas</artifactId>--> <artifactId>poi-ooxml-schemas</artifactId>
<!-- <version>4.0.0</version>--> <version>4.1.2</version>
<!-- </dependency>--> </dependency>
<dependency> <dependency>
<groupId>org.openscada.jinterop</groupId> <groupId>org.openscada.jinterop</groupId>
<artifactId>org.openscada.jinterop.core</artifactId> <artifactId>org.openscada.jinterop.core</artifactId>
@@ -341,16 +341,16 @@
</dependency> </dependency>
<!-- excel工具 --> <!-- excel工具 -->
<dependency> <!-- <dependency>-->
<groupId>org.apache.poi</groupId> <!-- <groupId>org.apache.poi</groupId>-->
<artifactId>poi</artifactId> <!-- <artifactId>poi</artifactId>-->
<version>3.17</version> <!-- <version>3.17</version>-->
</dependency> <!-- </dependency>-->
<dependency> <!-- <dependency>-->
<groupId>org.apache.poi</groupId> <!-- <groupId>org.apache.poi</groupId>-->
<artifactId>poi-ooxml</artifactId> <!-- <artifactId>poi-ooxml</artifactId>-->
<version>3.17</version> <!-- <version>3.17</version>-->
</dependency> <!-- </dependency>-->
<dependency> <dependency>
<groupId>xerces</groupId> <groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId> <artifactId>xercesImpl</artifactId>

View File

@@ -182,7 +182,7 @@ public class TwoNDC2SocketConnectionAutoRun extends AbstractAutoRunnable {
log.info("未找到指令号{}对应的指令", ikey); log.info("未找到指令号{}对应的指令", ikey);
break; break;
} }
instructionService.cancel(inst.getInstruction_id()); instructionService.cancelNOSendAgv(inst.getInstruction_id());
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} else { } else {
//上报异常信息 //上报异常信息

View File

@@ -184,7 +184,7 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
log.info("未找到指令号{}对应的指令", ikey); log.info("未找到指令号{}对应的指令", ikey);
break; break;
} }
instructionService.cancel(inst.getInstruction_id()); instructionService.cancelNOSendAgv(inst.getInstruction_id());
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} else { } else {
//上报异常信息 //上报异常信息

View File

@@ -1590,16 +1590,23 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
Integer deviceCode = device_code + i; Integer deviceCode = device_code + i;
for (int j = 0; j <= rss.size(); j++) { for (int j = 0; j <= rss.size(); j++) {
Map<String,Object> map = new ListOrderedMap<>(); Map<String,Object> map = new ListOrderedMap<>();
if (j == rss.size()){ if (wss.size() > rss.size()){
map.put("设备编码",""); if (j == rss.size()){
map.put("读取地址",""); continue;
map.put("读取意义",""); }
map.put("",""); } else {
map.put("写入地址",""); if (j == rss.size()){
map.put("写入意义",""); map.put("设备编码","");
list.add(map); map.put("读取地址","");
continue; map.put("读取意义","");
map.put("","");
map.put("写入地址","");
map.put("写入意义","");
list.add(map);
continue;
}
} }
if (i == 0 && j ==0){ if (i == 0 && j ==0){
map.put("设备编码",""); map.put("设备编码","");
}else { }else {
@@ -1627,6 +1634,28 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
list.add(map); list.add(map);
System.out.println(map); System.out.println(map);
} }
if (wss.size() > rss.size()){
int s = wss.size() - rss.size();
for (int l = 0; l <= s + 1; l++) {
Map<String,Object> map = new ListOrderedMap<>();
if (l == s + 1){
map.put("设备编码","");
map.put("读取地址","");
map.put("读取意义","");
map.put("","");
map.put("写入地址","");
map.put("写入意义","");
list.add(map);
continue;
}
map.put("设备编码",deviceCode);
map.put("读取地址","");
map.put("读取意义","");
Map<String, Object> value = getValue(wss, rss.size() + l, dbInterval,i);
map.putAll(value);
list.add(map);
}
}
} }
}else if (type.equals("v")){ }else if (type.equals("v")){
for (int i = 0; i < numberSize; i++) { for (int i = 0; i < numberSize; i++) {

View File

@@ -27,6 +27,7 @@ import org.nl.acs.opc.DeviceAppServiceImpl;
import org.nl.acs.route.service.RouteLineService; import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService; import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto; import org.nl.acs.task.service.dto.TaskDto;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.util.SpringContextHolder; import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server; import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -54,7 +55,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
@Autowired @Autowired
AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl"); AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl");
@Autowired @Autowired
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
//工作模式 //工作模式
int mode = 0; int mode = 0;
@@ -168,7 +169,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task)); Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task));
if (ObjectUtil.isNotEmpty(inst2)) { if (ObjectUtil.isNotEmpty(inst2)) {
String start_device_code = inst2.getStart_device_code(); String start_device_code = inst2.getStart_device_code();
Device device = appService.findDeviceByCode(start_device_code); Device device = deviceAppService.findDeviceByCode(start_device_code);
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
if (device.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { if (device.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) device.getDeviceDriver(); hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) device.getDeviceDriver();
@@ -186,7 +187,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
if (mode == 3 && action == 3 && move == 1 && task > 0) { if (mode == 3 && action == 3 && move == 1 && task > 0) {
Instruction instructionDto = instructionService.findByCode(String.valueOf(task)); Instruction instructionDto = instructionService.findByCode(String.valueOf(task));
String next_device_code = instructionDto.getNext_device_code(); String next_device_code = instructionDto.getNext_device_code();
Device nextDevice = appService.findDeviceByCode(next_device_code); Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
if (nextDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { if (nextDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextDevice.getDeviceDriver(); hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextDevice.getDeviceDriver();
@@ -218,8 +219,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
acsToWmsService.feedbackTaskStatusToWms(array); acsToWmsService.feedbackTaskStatusToWms(array);
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 = appService.findDeviceByCode(start_device_code); Device startDevice = deviceAppService.findDeviceByCode(start_device_code);
Device nextDevice = appService.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();
@@ -314,12 +315,24 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
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 start_addrIndex = getDeviceCodeList.indexOf(instruction.getStart_device_code());
int next_addrIndex = putDeviceCodeList.indexOf(instruction.getNext_device_code()); // int next_addrIndex = putDeviceCodeList.indexOf(instruction.getNext_device_code());
writing("to_onset", String.valueOf(start_addrIndex + 1)); // writing("to_onset", String.valueOf(start_addrIndex + 1));
writing("to_target", String.valueOf(next_addrIndex + 1)); // writing("to_target", String.valueOf(next_addrIndex + 1));
writing("to_task", instruction.getInstruction_code()); Device startDevice = deviceAppService.findDeviceByCode(instruction.getStart_device_code());
writing("to_command", "1"); Device nextDevice = deviceAppService.findDeviceByCode(instruction.getNext_device_code());
if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))){
throw new BadRequestException("设备:" + startDevice.getDevice_code() + "未设置电气调度号!");
}
if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))){
throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
}
String start_addr = startDevice.getExtraValue().get("address").toString();
String next_addr = nextDevice.getExtraValue().get("address").toString();
this.writing("to_onset", start_addr);
this.writing("to_target", next_addr);
this.writing("to_task", instruction.getInstruction_code());
this.writing("to_command", "1");
this.setRequireSucess(true); this.setRequireSucess(true);
return true; return true;
} else { } else {
@@ -371,12 +384,24 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
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 start_addrIndex = getDeviceCodeList.indexOf(start_device_code);
int next_addrIndex = putDeviceCodeList.indexOf(next_device_code); // int next_addrIndex = putDeviceCodeList.indexOf(next_device_code);
writing("to_onset", String.valueOf(start_addrIndex + 1)); // writing("to_onset", String.valueOf(start_addrIndex + 1));
writing("to_target", String.valueOf(next_addrIndex + 1)); // writing("to_target", String.valueOf(next_addrIndex + 1));
writing("to_task", instdto.getInstruction_code()); Device startDevice = deviceAppService.findDeviceByCode(instdto.getStart_device_code());
writing("to_command", "1"); Device nextDevice = deviceAppService.findDeviceByCode(instdto.getNext_device_code());
if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))){
throw new BadRequestException("设备:" + startDevice.getDevice_code() + "未设置电气调度号!");
}
if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))){
throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
}
String start_addr = startDevice.getExtraValue().get("address").toString();
String next_addr = nextDevice.getExtraValue().get("address").toString();
this.writing("to_onset", start_addr);
this.writing("to_target", next_addr);
this.writing("to_task", instdto.getInstruction_code());
this.writing("to_command", "1");
this.setRequireSucess(true); this.setRequireSucess(true);
} }
return true; return true;

View File

@@ -6,6 +6,7 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ;
import lombok.Data; import lombok.Data;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@@ -27,6 +28,7 @@ import org.nl.acs.opc.DeviceAppServiceImpl;
import org.nl.acs.route.service.RouteLineService; import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService; import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto; import org.nl.acs.task.service.dto.TaskDto;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.util.SpringContextHolder; import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server; import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -54,11 +56,6 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
@Autowired @Autowired
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppServiceImpl.class); DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
//当前指令1
Instruction inst1 = null;
//当前指令2
Instruction inst2 = null;
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
//工作模式 //工作模式
@@ -138,6 +135,10 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
task2 = this.itemProtocol.getTask2(); task2 = this.itemProtocol.getTask2();
if (mode != last_mode) { if (mode != last_mode) {
if (mode == 2) {
this.setRequireHeadSucess(false);
this.setRequireBackSucess(false);
}
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode)); logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode); logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
} }
@@ -245,11 +246,10 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
if (StrUtil.equals(inst2.getInstruction_status(), "1")) { if (StrUtil.equals(inst2.getInstruction_status(), "1")) {
finish_instruction(inst2); finish_instruction(inst2);
JSONArray array = new JSONArray(); JSONArray array = new JSONArray();
TaskDto taskDto = taskserver.findByCode(inst1.getTask_code()); TaskDto taskDto = taskserver.findByCode(inst2.getTask_code());
JSONObject map = new JSONObject(); JSONObject map = new JSONObject();
map.put("task_id", taskDto.getExt_task_id()); map.put("task_id", taskDto.getExt_task_id());
map.put("task_status", "2"); map.put("task_status", "2");
map.put("finished_type", "1");
array.add(map); array.add(map);
acsToWmsService.feedbackTaskStatusToWms(array); acsToWmsService.feedbackTaskStatusToWms(array);
writing("to_command2", "0"); writing("to_command2", "0");
@@ -260,9 +260,9 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
} }
} }
//双任务 - 工位取货时判断取货位光电信号 //双任务 - 工位取货时判断取货位光电信号
if (mode == 3 && action1 == 1 && move1 == 0 && task1 > 0 && task2 > 0) { if (mode == 3 && action2 == 1 && move2 == 0 && task1 > 0 && task2 > 0) {
Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task1)); Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task2));
String start_device_code = inst1.getStart_device_code(); String start_device_code = inst1.getStart_device_code();
Device startDevice = deviceAppservice.findDeviceByCode(start_device_code); Device startDevice = deviceAppservice.findDeviceByCode(start_device_code);
SiemensConveyorDeviceDriver siemensConveyorDeviceDriver; SiemensConveyorDeviceDriver siemensConveyorDeviceDriver;
@@ -278,24 +278,24 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
} }
} }
//单任务 - 工位直接允许取货 //单任务 - 工位直接允许取货
if (mode == 3 && action1 == 1 && move1 == 0 && task1 > 0 && task2 == 0) { if (mode == 3 && action2 == 1 && move2 == 0 && task2 > 0 && task1 == 0) {
this.writing("to_command1", "2"); this.writing("to_command1", "2");
} }
//后工位允许放货
if (mode == 3 && action2 == 3 && move2 == 1 && task2 > 0) {
this.writing("to_command1", "3");
}
//前工位允许放货
if (mode == 3 && action1 == 1 && move1 == 0 && task1 > 0) {
this.writing("to_command2", "2");
}
//前工位放货时判断放货位光电信号 //前工位放货时判断放货位光电信号
if (mode == 3 && action1 == 3 && move1 == 1 && task1 > 0) { if (mode == 3 && action1 == 3 && move1 == 1 && task1 > 0) {
this.writing("to_command1", "3"); Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task1));
}
//后工位取货时判断取货位光电信号
if (mode == 3 && action2 == 2 && move2 == 0 && task2 > 0) {
this.writing("to_command2", "2");
}
//后工位放货时判断放货位光电信号
if (mode == 3 && action2 == 3 && move2 == 1 && task2 > 0) {
Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task2));
String next_device_code = inst1.getNext_device_code(); String next_device_code = inst1.getNext_device_code();
Device nextDevice = deviceAppservice.findDeviceByCode(next_device_code); Device nextDevice = deviceAppservice.findDeviceByCode(next_device_code);
SiemensConveyorDeviceDriver siemensConveyorDeviceDriver; SiemensConveyorDeviceDriver siemensConveyorDeviceDriver;
@@ -306,7 +306,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
if (move == 0 && mode == 2) { if (move == 0 && mode == 2) {
this.writing("to_command2", "3"); this.writing("to_command2", "3");
} else { } else {
log.warn("后工位放货位有货,放货位:{},mode:{},moce:{}", next_device_code, mode, move); log.warn("后工位放货位有货,放货位:{},mode:{},move:{}", next_device_code, mode, move);
} }
} }
} }
@@ -342,22 +342,26 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
return; return;
case 2: case 2:
//后工位申请任务 取空放空 //后工位申请任务 取空放空
if (move2 == 0 && action2 == 0 && task2 == 0 && !requireHeadSucess) { //mode == 2 && move2 == 0 && action2 == 0 && !requireBackSucess
if (move2 == 0 && action2 == 0 && !requireBackSucess) {
instruction_require2(); instruction_require2();
logServer.deviceExecuteLog(device_code, "", String.valueOf(task1), "move1:" + move1 + ",action1:" + action1 + ",move2:" + move2 + ",task1:" + task1 + ",requireHeadSucess:" + requireHeadSucess); logServer.deviceExecuteLog(device_code, "", String.valueOf(task1), "move1:" + move1 + ",action1:" + action1 + ",move2:" + move2 + ",task1:" + task1 + ",requireHeadSucess:" + requireHeadSucess);
} }
//前工位申请任务 取满放满 //前工位申请任务 取满放满
if (move1 == 0 && action1 == 0 && task1 == 0 && move2 == 0 && task2 > 0 && !requireBackSucess) { //mode == 2 && move2 == 0 && action2 == 0 && task2 == 0 && move1 == 0 && !requireHeadSucess
if (move1 == 0 && action1 == 0 && !requireHeadSucess) {
instruction_require(); instruction_require();
logServer.deviceExecuteLog(device_code, "", String.valueOf(task1), "move2:" + move2 + ",action2:" + action2 + ",move1:" + move1 + ",task2:" + task2 + ",requireBackSucess:" + requireBackSucess); logServer.deviceExecuteLog(device_code, "", String.valueOf(task1), "move2:" + move2 + ",action2:" + action2 + ",move1:" + move1 + ",task2:" + task2 + ",requireBackSucess:" + requireBackSucess);
} }
break; break;
case 3: case 3:
//前工位申请任务 取满放满 //前工位申请任务 取满放满
if (task2 > 0 && move2 == 1 && action2 == 1 && move1 == 0 && action1 == 0 && !requireBackSucess) { //mode == 3 && move2 == 1 && action2 == 1 && move1 == 0 && !requireHeadSucess
instruction_require(); // if (mode == 3 && move2 == 1 && action2 == 1 && move1 == 0 && !requireHeadSucess) {
logServer.deviceExecuteLog(device_code, "", String.valueOf(task1), "move2:" + move2 + ",action2:" + action2 + ",move1:" + move1 + ",task2:" + task2 + ",requireBackSucess:" + requireBackSucess); // instruction_require();
} // logServer.deviceExecuteLog(device_code, "", String.valueOf(task1), "move2:" + move2 + ",action2:" + action2 + ",move1:" + move1 + ",task2:" + task2 + ",requireBackSucess:" + requireBackSucess);
// }
break;
} }
} }
@@ -395,10 +399,18 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
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()); Device startDevice = deviceAppservice.findDeviceByCode(instruction.getStart_device_code());
int next_addrIndex = putDeviceCodeList.indexOf(instruction.getNext_device_code()); Device nextDevice = deviceAppservice.findDeviceByCode(instruction.getNext_device_code());
this.writing("to_onset1", String.valueOf(start_addrIndex + 1)); if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) {
this.writing("to_target1", String.valueOf(next_addrIndex + 1)); throw new BadRequestException("设备:" + startDevice.getDevice_code() + "未设置电气调度号!");
}
if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))) {
throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
}
String start_addr = startDevice.getExtraValue().get("address").toString();
String next_addr = nextDevice.getExtraValue().get("address").toString();
this.writing("to_onset1", start_addr);
this.writing("to_target1", next_addr);
this.writing("to_task1", instruction.getInstruction_code()); this.writing("to_task1", instruction.getInstruction_code());
this.writing("to_command1", "1"); this.writing("to_command1", "1");
requireHeadSucess = true; requireHeadSucess = true;
@@ -454,11 +466,19 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
task.setUpdate_time(DateUtil.now()); task.setUpdate_time(DateUtil.now());
taskserver.update(task); taskserver.update(task);
//根据查询的任务起始点位 得出取放工位的索引值 写入后工位电气中 //根据查询的任务起始点位 得出取放工位的电气值 写入后工位电气中
int start_addrIndex = getDeviceCodeList.indexOf(start_device_code); Device startDevice = deviceAppservice.findDeviceByCode(instdto.getStart_device_code());
int next_addrIndex = putDeviceCodeList.indexOf(next_device_code); Device nextDevice = deviceAppservice.findDeviceByCode(instdto.getNext_device_code());
this.writing("to_onset1", String.valueOf(start_addrIndex + 1)); if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) {
this.writing("to_target1", String.valueOf(next_addrIndex + 1)); throw new BadRequestException("设备:" + startDevice.getDevice_code() + "未设置电气调度号!");
}
if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))) {
throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
}
String start_addr = startDevice.getExtraValue().get("address").toString();
String next_addr = nextDevice.getExtraValue().get("address").toString();
this.writing("to_onset1", start_addr);
this.writing("to_target1", next_addr);
this.writing("to_task1", instdto.getInstruction_code()); this.writing("to_task1", instdto.getInstruction_code());
this.writing("to_command1", "1"); this.writing("to_command1", "1");
requireHeadSucess = true; requireHeadSucess = true;
@@ -491,10 +511,18 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
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()); Device startDevice = deviceAppservice.findDeviceByCode(instruction.getStart_device_code());
int next_addrIndex = putDeviceCodeList.indexOf(instruction.getNext_device_code()); Device nextDevice = deviceAppservice.findDeviceByCode(instruction.getNext_device_code());
this.writing("to_onset2", String.valueOf(start_addrIndex + 1)); if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) {
this.writing("to_target2", String.valueOf(next_addrIndex + 1)); throw new BadRequestException("设备:" + startDevice.getDevice_code() + "未设置电气调度号!");
}
if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))) {
throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
}
String start_addr = startDevice.getExtraValue().get("address").toString();
String next_addr = nextDevice.getExtraValue().get("address").toString();
this.writing("to_onset2", start_addr);
this.writing("to_target2", next_addr);
this.writing("to_task2", instruction.getInstruction_code()); this.writing("to_task2", instruction.getInstruction_code());
this.writing("to_command2", "1"); this.writing("to_command2", "1");
requireBackSucess = true; requireBackSucess = true;
@@ -549,11 +577,19 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
task.setTask_status("1"); task.setTask_status("1");
taskserver.update(task); taskserver.update(task);
//根据查询的任务起始点位 得出取放工位的索引值 写入后工位电气中 //根据查询的任务起始点位 得出取放工位的电气值 写入后工位电气中
int start_addrIndex = getDeviceCodeList.indexOf(start_device_code); Device startDevice = deviceAppservice.findDeviceByCode(instdto.getStart_device_code());
int next_addrIndex = putDeviceCodeList.indexOf(next_device_code); Device nextDevice = deviceAppservice.findDeviceByCode(instdto.getNext_device_code());
this.writing("to_onset2", String.valueOf(start_addrIndex + 1)); if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) {
this.writing("to_target2", String.valueOf(next_addrIndex + 1)); throw new BadRequestException("设备:" + startDevice.getDevice_code() + "未设置电气调度号!");
}
if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))) {
throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
}
String start_addr = startDevice.getExtraValue().get("address").toString();
String next_addr = nextDevice.getExtraValue().get("address").toString();
this.writing("to_onset2", start_addr);
this.writing("to_target2", next_addr);
this.writing("to_task2", instdto.getInstruction_code()); this.writing("to_task2", instdto.getInstruction_code());
this.writing("to_command2", "1"); this.writing("to_command2", "1");
requireBackSucess = true; requireBackSucess = true;

View File

@@ -366,8 +366,8 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
} }
try { try {
String start_device_code = task.getStart_device_code(); String start_device_code = dto.getStart_device_code();
String next_device_code = task.getNext_device_code(); String next_device_code = dto.getNext_device_code();
String route_plan_code = task.getRoute_plan_code(); String route_plan_code = task.getRoute_plan_code();
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code); List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
RouteLineDto route = null; RouteLineDto route = null;
@@ -383,12 +383,14 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
if (ObjectUtil.isEmpty(route)) { if (ObjectUtil.isEmpty(route)) {
throw new BadRequestException("未查询到相关路由!"); throw new BadRequestException("未查询到相关路由!");
} }
String agvType = paramService.findByCode("agvType").getValue(); if (StrUtil.equals(shortPathsList.get(0).getType(), "1")){
if (StrUtil.equals(agvType, "2")) { String agvType = paramService.findByCode("agvType").getValue();
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class); if (StrUtil.equals(agvType, "2")) {
ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(),dto); NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
} ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(),dto);
}
}
} catch (Exception e) { } catch (Exception e) {
dto.setSend_status("2"); dto.setSend_status("2");
e.printStackTrace(); e.printStackTrace();