|
|
|
|
@@ -68,7 +68,7 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
|
|
|
|
public static final Integer MAX_Y = 6;
|
|
|
|
|
public static final Integer MIN_Y = 1;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
/**
|
|
|
|
|
* 心跳
|
|
|
|
|
*/
|
|
|
|
|
Integer heartbeat = 0;
|
|
|
|
|
@@ -78,18 +78,18 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
|
|
|
|
*/
|
|
|
|
|
Integer itemDeviceCode = 0;
|
|
|
|
|
Integer lastItemDeviceCode = 0;
|
|
|
|
|
/**
|
|
|
|
|
/**
|
|
|
|
|
* 工作模式
|
|
|
|
|
*/
|
|
|
|
|
Integer mode = 0;
|
|
|
|
|
Integer lastMode = 0;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
/**
|
|
|
|
|
* 行走开关信号
|
|
|
|
|
*/
|
|
|
|
|
Float move = 0F;
|
|
|
|
|
Float lastMove = 0F;
|
|
|
|
|
/**
|
|
|
|
|
/**
|
|
|
|
|
* 行走动作信号
|
|
|
|
|
*/
|
|
|
|
|
Float action = 0F;
|
|
|
|
|
@@ -105,24 +105,24 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
|
|
|
|
Integer frontTask = 0;
|
|
|
|
|
Integer lastFrontTask = 0;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
/**
|
|
|
|
|
* 行走激光数值
|
|
|
|
|
*/
|
|
|
|
|
Integer distanceX = 0;
|
|
|
|
|
Integer lastDistanceX = 0;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
/**
|
|
|
|
|
* 特殊开关量1
|
|
|
|
|
*/
|
|
|
|
|
Float special1 = 0F;
|
|
|
|
|
Float lastSpecial1 = 0F;
|
|
|
|
|
/**
|
|
|
|
|
/**
|
|
|
|
|
* 特殊开关量2
|
|
|
|
|
*/
|
|
|
|
|
Float special2 = 0F;
|
|
|
|
|
Float lastSpecial2 = 0F;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
/**
|
|
|
|
|
* 水箱和消防缓存位有无货
|
|
|
|
|
*/
|
|
|
|
|
Float storageCache = 0F;
|
|
|
|
|
@@ -151,7 +151,7 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
|
|
|
|
Integer backZerror = 0;
|
|
|
|
|
Integer lastBackZerror = 0;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
/**
|
|
|
|
|
* 前叉行走排号
|
|
|
|
|
*/
|
|
|
|
|
Integer frontZ = 0;
|
|
|
|
|
@@ -236,6 +236,19 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
|
|
|
|
*/
|
|
|
|
|
Boolean requireSucess = false;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 禁止入库
|
|
|
|
|
*/
|
|
|
|
|
private boolean prohibitInWarehouse = false;
|
|
|
|
|
/**
|
|
|
|
|
* 禁止出库
|
|
|
|
|
*/
|
|
|
|
|
private boolean prohibitOutWarehouse = false;
|
|
|
|
|
/**
|
|
|
|
|
* 停止接收任务
|
|
|
|
|
*/
|
|
|
|
|
private boolean stopReceiveTask = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Device getDevice() {
|
|
|
|
|
@@ -264,38 +277,38 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
|
|
|
|
message = "有报警";
|
|
|
|
|
} else {
|
|
|
|
|
Map<String, Object> map = new LinkedHashMap<>();
|
|
|
|
|
if (CommandEnum.STANDY.getStatus().equals(frontCommand) || backCommand.equals(CommandEnum.STANDY.getStatus())){
|
|
|
|
|
if (CommandEnum.STANDY.getStatus().equals(frontCommand) || backCommand.equals(CommandEnum.STANDY.getStatus())) {
|
|
|
|
|
applyTask();
|
|
|
|
|
requireSucess = true;
|
|
|
|
|
}
|
|
|
|
|
if (CommandEnum.PICKUP.getStatus().equals(frontCommand) || backCommand.equals(CommandEnum.PICKUP.getStatus())){
|
|
|
|
|
if (CommandEnum.PICKUP.getStatus().equals(frontCommand) || backCommand.equals(CommandEnum.PICKUP.getStatus())) {
|
|
|
|
|
message = "取货中";
|
|
|
|
|
}
|
|
|
|
|
if (CommandEnum.PICKUP_COMPLETE.getStatus().equals(frontCommand) || backCommand.equals(CommandEnum.PICKUP_COMPLETE.getStatus())){
|
|
|
|
|
if (CommandEnum.PICKUP_COMPLETE.getStatus().equals(frontCommand) || backCommand.equals(CommandEnum.PICKUP_COMPLETE.getStatus())) {
|
|
|
|
|
message = "取货完成";
|
|
|
|
|
LinkedList<Instruction> inst = new LinkedList<>();
|
|
|
|
|
getIns(inst);
|
|
|
|
|
if (CollectionUtil.isNotEmpty(inst)&&ObjectUtil.isNotEmpty(inst.get(0))) {
|
|
|
|
|
if (CollectionUtil.isNotEmpty(inst) && ObjectUtil.isNotEmpty(inst.get(0))) {
|
|
|
|
|
String startDeviceCode = inst.get(0).getStart_device_code();
|
|
|
|
|
Device startDevice = deviceAppService.findDeviceByCode(startDeviceCode);
|
|
|
|
|
writeStorageOrConveyor(inst,startDeviceCode,startDevice,map);
|
|
|
|
|
writeStorageOrConveyor(inst, startDeviceCode, startDevice, map);
|
|
|
|
|
}
|
|
|
|
|
if (CollectionUtil.isNotEmpty(inst)&&ObjectUtil.isEmpty(inst.get(0))) {
|
|
|
|
|
if (CollectionUtil.isNotEmpty(inst) && ObjectUtil.isEmpty(inst.get(0))) {
|
|
|
|
|
String startDeviceCode = inst.get(1).getStart_device_code();
|
|
|
|
|
Device startDevice = deviceAppService.findDeviceByCode(startDeviceCode);
|
|
|
|
|
writeStorageOrConveyor(inst,startDeviceCode,startDevice,map);
|
|
|
|
|
writeStorageOrConveyor(inst, startDeviceCode, startDevice, map);
|
|
|
|
|
}
|
|
|
|
|
map.put("to_command", CommandEnum.PICKUP_COMPLETE.getStatus());
|
|
|
|
|
requireSucess = true;
|
|
|
|
|
}
|
|
|
|
|
if (CommandEnum.RELEASE.getStatus().equals(frontCommand) || backCommand.equals(CommandEnum.RELEASE.getStatus())){
|
|
|
|
|
if (CommandEnum.RELEASE.getStatus().equals(frontCommand) || backCommand.equals(CommandEnum.RELEASE.getStatus())) {
|
|
|
|
|
message = "放货中";
|
|
|
|
|
}
|
|
|
|
|
if (CommandEnum.UNLOAD.getStatus().equals(frontCommand) || backCommand.equals(CommandEnum.UNLOAD.getStatus())){
|
|
|
|
|
if (CommandEnum.UNLOAD.getStatus().equals(frontCommand) || backCommand.equals(CommandEnum.UNLOAD.getStatus())) {
|
|
|
|
|
message = "请求卸货(申请卸货)";
|
|
|
|
|
LinkedList<Instruction> inst = new LinkedList<>();
|
|
|
|
|
getIns(inst);
|
|
|
|
|
if (CollectionUtil.isNotEmpty(inst)&&ObjectUtil.isNotEmpty(inst.get(0))) {
|
|
|
|
|
if (CollectionUtil.isNotEmpty(inst) && ObjectUtil.isNotEmpty(inst.get(0))) {
|
|
|
|
|
String nextDeviceCode = inst.get(0).getNext_device_code();
|
|
|
|
|
Device nextDevice = deviceAppService.findDeviceByCode(nextDeviceCode);
|
|
|
|
|
//指令为执行
|
|
|
|
|
@@ -305,7 +318,7 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
|
|
|
|
map.put("to_command", 3);
|
|
|
|
|
requireSucess = true;
|
|
|
|
|
}
|
|
|
|
|
if (CollectionUtil.isNotEmpty(inst)&&ObjectUtil.isEmpty(inst.get(0))) {
|
|
|
|
|
if (CollectionUtil.isNotEmpty(inst) && ObjectUtil.isEmpty(inst.get(0))) {
|
|
|
|
|
String nextDeviceCode = inst.get(1).getNext_device_code();
|
|
|
|
|
Device nextDevice = deviceAppService.findDeviceByCode(nextDeviceCode);
|
|
|
|
|
if (unloadCheck(nextDevice)) {
|
|
|
|
|
@@ -315,13 +328,13 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
|
|
|
|
requireSucess = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (CommandEnum.UNLOAD_COMPLETE.getStatus().equals(frontCommand) || backCommand.equals(CommandEnum.UNLOAD_COMPLETE.getStatus())){
|
|
|
|
|
if (CommandEnum.UNLOAD_COMPLETE.getStatus().equals(frontCommand) || backCommand.equals(CommandEnum.UNLOAD_COMPLETE.getStatus())) {
|
|
|
|
|
message = "放货完成";
|
|
|
|
|
map.put("to_command", 5);
|
|
|
|
|
LinkedList<Instruction> inst = new LinkedList<>();
|
|
|
|
|
getIns(inst);
|
|
|
|
|
try {
|
|
|
|
|
if (CollectionUtil.isNotEmpty(inst)){
|
|
|
|
|
if (CollectionUtil.isNotEmpty(inst)) {
|
|
|
|
|
for (Instruction instruction : inst) {
|
|
|
|
|
finishInstruction(instruction);
|
|
|
|
|
}
|
|
|
|
|
@@ -333,17 +346,17 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (CommandEnum.PICKUP_PREPARATION.getStatus().equals(frontCommand) || backCommand.equals(CommandEnum.PICKUP_PREPARATION.getStatus())){
|
|
|
|
|
if (CommandEnum.PICKUP_PREPARATION.getStatus().equals(frontCommand) || backCommand.equals(CommandEnum.PICKUP_PREPARATION.getStatus())) {
|
|
|
|
|
message = "取货准备(会库位台)";
|
|
|
|
|
map.put("to_command", 6);
|
|
|
|
|
requireSucess = true;
|
|
|
|
|
}
|
|
|
|
|
if (CommandEnum.RECALL.getStatus().equals(frontCommand) || backCommand.equals(CommandEnum.RECALL.getStatus())){
|
|
|
|
|
if (CommandEnum.RECALL.getStatus().equals(frontCommand) || backCommand.equals(CommandEnum.RECALL.getStatus())) {
|
|
|
|
|
message = "召回";
|
|
|
|
|
map.put("to_command", 7);
|
|
|
|
|
requireSucess = true;
|
|
|
|
|
}
|
|
|
|
|
if (CommandEnum.STOP.getStatus().equals(frontCommand) || backCommand.equals(CommandEnum.STOP.getStatus())){
|
|
|
|
|
if (CommandEnum.STOP.getStatus().equals(frontCommand) || backCommand.equals(CommandEnum.STOP.getStatus())) {
|
|
|
|
|
message = "急停";
|
|
|
|
|
map.put("to_command", 8);
|
|
|
|
|
requireSucess = true;
|
|
|
|
|
@@ -398,15 +411,16 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
|
|
|
|
private void getIns(LinkedList<Instruction> inst) {
|
|
|
|
|
if (ObjectUtil.isNotEmpty(this.frontTask)) {
|
|
|
|
|
Instruction instructionFront = instructionService.findByCodeFromCache(String.valueOf(frontTask));
|
|
|
|
|
if (ObjectUtil.isNotEmpty(instructionFront)){
|
|
|
|
|
if (ObjectUtil.isNotEmpty(instructionFront)) {
|
|
|
|
|
inst.add(instructionFront);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (ObjectUtil.isNotEmpty(this.backTask)) {
|
|
|
|
|
Instruction instructionBack = instructionService.findByCodeFromCache(String.valueOf(backTask));
|
|
|
|
|
if (CollectionUtil.isNotEmpty(inst) && ObjectUtil.isNotEmpty(instructionBack)){
|
|
|
|
|
if (CollectionUtil.isNotEmpty(inst) && ObjectUtil.isNotEmpty(instructionBack)) {
|
|
|
|
|
inst.add(instructionBack);
|
|
|
|
|
}if (CollectionUtil.isEmpty(inst) && ObjectUtil.isNotEmpty(instructionBack)){
|
|
|
|
|
}
|
|
|
|
|
if (CollectionUtil.isEmpty(inst) && ObjectUtil.isNotEmpty(instructionBack)) {
|
|
|
|
|
inst.add(null);
|
|
|
|
|
inst.add(instructionBack);
|
|
|
|
|
}
|
|
|
|
|
@@ -465,7 +479,6 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 申请任务
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
public synchronized boolean applyTask() {
|
|
|
|
|
Date date = new Date();
|
|
|
|
|
@@ -503,7 +516,6 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
@@ -556,17 +568,16 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
|
|
|
|
}
|
|
|
|
|
//前叉信号写入
|
|
|
|
|
HashMap<String, Object> map = new HashMap<>();
|
|
|
|
|
if (inst.size()==1&& ObjectUtil.isNotEmpty(inst.get(0))) {
|
|
|
|
|
if (inst.size() == 1 && ObjectUtil.isNotEmpty(inst.get(0))) {
|
|
|
|
|
map.put("to_device_code", this.getDevice().getAddress());
|
|
|
|
|
map.put("to_command", CommandEnum.PICKUP.getStatus().toString());
|
|
|
|
|
map.put("to_front_task", inst.get(0).getInstruction_code());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (inst.size()>1 && ObjectUtil.isEmpty(inst.get(1))) {
|
|
|
|
|
} else if (inst.size() > 1 && ObjectUtil.isEmpty(inst.get(1))) {
|
|
|
|
|
map.put("to_device_code", this.getDevice().getAddress());
|
|
|
|
|
map.put("to_command", CommandEnum.PICKUP.getStatus().toString());
|
|
|
|
|
map.put("to_back_task", inst.get(1).getInstruction_code());
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
map.put("to_device_code", this.getDevice().getAddress());
|
|
|
|
|
map.put("to_command", CommandEnum.PICKUP.getStatus().toString());
|
|
|
|
|
map.put("to_front_task", inst.get(0).getInstruction_code());
|
|
|
|
|
@@ -604,16 +615,16 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
|
|
|
|
map.put("to_z", inst.get(0).getFrom_x());
|
|
|
|
|
}
|
|
|
|
|
map.put("to_x", inst.get(0).getFrom_y());
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
//只存在后叉的情况
|
|
|
|
|
map.put("to_y", Integer.parseInt(inst.get(0).getFrom_z())+1);
|
|
|
|
|
map.put("to_y", Integer.parseInt(inst.get(0).getFrom_z()) + 1);
|
|
|
|
|
if (inst.get(0).getFrom_x().length() > 1) {
|
|
|
|
|
String substring = inst.get(0).getFrom_x().substring(1);
|
|
|
|
|
map.put("to_z", Integer.parseInt(substring)+1);
|
|
|
|
|
map.put("to_z", Integer.parseInt(substring) + 1);
|
|
|
|
|
} else {
|
|
|
|
|
map.put("to_z", Integer.parseInt(inst.get(0).getFrom_x())+1);
|
|
|
|
|
map.put("to_z", Integer.parseInt(inst.get(0).getFrom_x()) + 1);
|
|
|
|
|
}
|
|
|
|
|
map.put("to_x", Integer.parseInt(inst.get(0).getFrom_y())+1);
|
|
|
|
|
map.put("to_x", Integer.parseInt(inst.get(0).getFrom_y()) + 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -621,14 +632,14 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
|
|
|
|
private boolean findInstruction(List<Instruction> instructionList, Instruction inst, LinkedList<Instruction> instructionsAll) {
|
|
|
|
|
LambdaQueryWrapper<DeviceExtra> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
CommonFinalParam commonFinalParam = new CommonFinalParam();
|
|
|
|
|
wrapper.in(DeviceExtra::getExtra_name,"no_front_y","no_front_x","no_back_y","no_back_x","sort");
|
|
|
|
|
wrapper.in(DeviceExtra::getExtra_name, "no_front_y", "no_front_x", "no_back_y", "no_back_x", "sort");
|
|
|
|
|
List<DeviceExtra> deviceExtras = deviceExtraMapper.selectList(wrapper);
|
|
|
|
|
//默认第一条指令为前叉判断是否符合
|
|
|
|
|
if (StringUtils.isEmpty(inst.getNext_point_code())&&!StringUtils.contains(inst.getNext_point_code(),commonFinalParam.getBARRE())){
|
|
|
|
|
if (StringUtils.isEmpty(inst.getNext_point_code()) && !StringUtils.contains(inst.getNext_point_code(), commonFinalParam.getBARRE())) {
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
String[] splitFront = inst.getNext_point_code().split(commonFinalParam.getBARRE());
|
|
|
|
|
List<DeviceExtra> frontY = deviceExtras.stream().filter(item -> "no_front_y".equals(item.getExtra_name())).collect(Collectors.toList());
|
|
|
|
|
List<DeviceExtra> frontX = deviceExtras.stream().filter(item -> "no_front_x".equals(item.getExtra_name())).collect(Collectors.toList());
|
|
|
|
|
@@ -643,30 +654,30 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Integer.valueOf(splitFront[1]).equals(MIN_Y)){
|
|
|
|
|
if (Integer.valueOf(splitFront[1]).equals(MIN_Y)) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
String x1 ;
|
|
|
|
|
String x2 ;
|
|
|
|
|
if (Integer.parseInt(splitFront[1])<10){
|
|
|
|
|
x1 = "0"+(Integer.parseInt(splitFront[1]) - 1);
|
|
|
|
|
x2 = "0"+(Integer.parseInt(splitFront[1]) + 1);
|
|
|
|
|
}else {
|
|
|
|
|
x1 = ""+(Integer.parseInt(splitFront[1]) - 1);
|
|
|
|
|
x2 = ""+(Integer.parseInt(splitFront[1]) + 1);
|
|
|
|
|
String x1;
|
|
|
|
|
String x2;
|
|
|
|
|
if (Integer.parseInt(splitFront[1]) < 10) {
|
|
|
|
|
x1 = "0" + (Integer.parseInt(splitFront[1]) - 1);
|
|
|
|
|
x2 = "0" + (Integer.parseInt(splitFront[1]) + 1);
|
|
|
|
|
} else {
|
|
|
|
|
x1 = "" + (Integer.parseInt(splitFront[1]) - 1);
|
|
|
|
|
x2 = "" + (Integer.parseInt(splitFront[1]) + 1);
|
|
|
|
|
}
|
|
|
|
|
//根据排序进行加减
|
|
|
|
|
String nextPointCodeDown = splitFront[0] + commonFinalParam.getBARRE() + x1 + commonFinalParam.getBARRE() + splitFront[2];
|
|
|
|
|
String nextPointCodeUp = splitFront[0] + commonFinalParam.getBARRE() + x2 + commonFinalParam.getBARRE() + splitFront[2];
|
|
|
|
|
if (CollectionUtil.isNotEmpty(sort)&& SortEnum.BACK.getCode().equals(sort.get(0).getExtra_value())){
|
|
|
|
|
if (CollectionUtil.isNotEmpty(sort) && SortEnum.BACK.getCode().equals(sort.get(0).getExtra_value())) {
|
|
|
|
|
nextPointCodeDown = splitFront[0] + commonFinalParam.getBARRE() + x2 + commonFinalParam.getBARRE() + splitFront[2];
|
|
|
|
|
nextPointCodeUp = splitFront[0] + commonFinalParam.getBARRE() + x1 + commonFinalParam.getBARRE() + splitFront[2];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Integer.valueOf(splitFront[1]).equals(MAX_Y)){
|
|
|
|
|
if (Integer.valueOf(splitFront[1]).equals(MAX_Y)) {
|
|
|
|
|
String finalNextPointCodeDown = nextPointCodeDown;
|
|
|
|
|
List<Instruction> instructionNextPointList = instructionList.stream().filter(item -> item.getNext_point_code().equals(finalNextPointCodeDown)).collect(Collectors.toList());
|
|
|
|
|
if (instructionNextPointList.size()>0){
|
|
|
|
|
if (instructionNextPointList.size() > 0) {
|
|
|
|
|
String[] splitBack = instructionNextPointList.get(0).getNext_point_code().split(commonFinalParam.getBARRE());
|
|
|
|
|
if (checkY(splitBack, backY)) {
|
|
|
|
|
return true;
|
|
|
|
|
@@ -676,13 +687,13 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
|
|
|
|
}
|
|
|
|
|
instructionsAll.add(instructionNextPointList.get(0));
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
String finalNextPointCodeDown1 = nextPointCodeDown;
|
|
|
|
|
List<Instruction> instructionNextPointList1 = instructionList.stream().filter(item -> item.getNext_point_code().equals(finalNextPointCodeDown1)).collect(Collectors.toList());
|
|
|
|
|
String finalNextPointCodeUp = nextPointCodeUp;
|
|
|
|
|
List<Instruction> instructionNextPointList2 = instructionList.stream().filter(item -> item.getNext_point_code().equals(finalNextPointCodeUp)).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
if (instructionNextPointList1.size()>0){
|
|
|
|
|
if (instructionNextPointList1.size() > 0) {
|
|
|
|
|
String[] splitBack = instructionNextPointList1.get(0).getNext_point_code().split(commonFinalParam.getBARRE());
|
|
|
|
|
if (checkY(splitBack, backY)) {
|
|
|
|
|
return true;
|
|
|
|
|
@@ -693,7 +704,7 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
|
|
|
|
instructionsAll.add(instructionNextPointList1.get(0));
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (instructionNextPointList2.size()>0){
|
|
|
|
|
if (instructionNextPointList2.size() > 0) {
|
|
|
|
|
//前叉的上一列有指令,此时前叉变成后叉,重新校验
|
|
|
|
|
String[] splitBack = instructionNextPointList2.get(0).getNext_point_code().split(commonFinalParam.getBARRE());
|
|
|
|
|
if (checkY(splitBack, frontY)) {
|
|
|
|
|
@@ -720,7 +731,7 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private boolean checkX(String[] split, List<DeviceExtra> x) {
|
|
|
|
|
if (x.size()!=0&& StringUtils.isNotEmpty(x.get(0).getExtra_value())){
|
|
|
|
|
if (x.size() != 0 && StringUtils.isNotEmpty(x.get(0).getExtra_value())) {
|
|
|
|
|
String[] splitValue = x.get(0).getExtra_value().split(",");
|
|
|
|
|
Set<String> set = new HashSet<>(Arrays.asList(splitValue));
|
|
|
|
|
return set.contains(split[0]);
|
|
|
|
|
@@ -729,7 +740,7 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private boolean checkY(String[] split, List<DeviceExtra> y) {
|
|
|
|
|
if (y.size()!=0&& StringUtils.isNotEmpty(y.get(0).getExtra_value())){
|
|
|
|
|
if (y.size() != 0 && StringUtils.isNotEmpty(y.get(0).getExtra_value())) {
|
|
|
|
|
String[] splitValue = y.get(0).getExtra_value().split(",");
|
|
|
|
|
Set<String> set = new HashSet<>(Arrays.asList(splitValue));
|
|
|
|
|
return set.contains(split[1]);
|
|
|
|
|
@@ -759,14 +770,37 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject getDeviceStatusName() {
|
|
|
|
|
return null;
|
|
|
|
|
JSONObject jo = new JSONObject();
|
|
|
|
|
jo.put("device_name", this.getDevice().getDevice_name());
|
|
|
|
|
jo.put("prohibitInWarehouse", this.prohibitInWarehouse);
|
|
|
|
|
jo.put("prohibitOutWarehouse", this.prohibitOutWarehouse);
|
|
|
|
|
jo.put("stopReceiveTask", this.stopReceiveTask);
|
|
|
|
|
jo.put("is_click", true);
|
|
|
|
|
jo.put("driver_type", "double_station_stacker");
|
|
|
|
|
return jo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void setDeviceStatus(JSONObject data) {
|
|
|
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(data)) {
|
|
|
|
|
//监控大屏下发作业命令清警-5、召回-7、急停-8
|
|
|
|
|
Integer toCommand = data.getInteger("toCommand");
|
|
|
|
|
if (toCommand != null) {
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
map.put("to_command", toCommand);
|
|
|
|
|
this.writing(map);
|
|
|
|
|
}
|
|
|
|
|
//ACS监控大屏设置禁止入库、禁止出库、停止接收任务
|
|
|
|
|
Boolean prohibitInWarehouse = data.getBoolean("prohibitInWarehouse");
|
|
|
|
|
this.prohibitInWarehouse = prohibitInWarehouse;
|
|
|
|
|
Boolean prohibitOutWarehouse = data.getBoolean("prohibitOutWarehouse");
|
|
|
|
|
this.prohibitOutWarehouse = prohibitOutWarehouse;
|
|
|
|
|
Boolean stopReceiveTask = data.getBoolean("stopReceiveTask");
|
|
|
|
|
this.stopReceiveTask = stopReceiveTask;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 完成指令
|
|
|
|
|
*
|
|
|
|
|
@@ -824,6 +858,7 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 将扩展表中的字符串数据转换成集合
|
|
|
|
|
*
|
|
|
|
|
* @param extraName
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@@ -846,7 +881,7 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
|
|
|
|
private void setData() {
|
|
|
|
|
device_code = this.getDeviceCode();
|
|
|
|
|
heartbeat = this.itemProtocol.getItem_heartbeat();
|
|
|
|
|
itemDeviceCode= this.itemProtocol.getItem_device_Code();
|
|
|
|
|
itemDeviceCode = this.itemProtocol.getItem_device_Code();
|
|
|
|
|
mode = this.itemProtocol.getItem_mode();
|
|
|
|
|
move = this.itemProtocol.getItem_move();
|
|
|
|
|
frontCommand = this.itemProtocol.getItem_front_command();
|
|
|
|
|
|