fix: device_driver

This commit is contained in:
yanps
2023-12-08 14:22:13 +08:00
parent 322f8c5d4f
commit 535f241642
16 changed files with 88 additions and 25 deletions

View File

@@ -11,6 +11,9 @@ import org.nl.acs.common.base.CommonFinalParam;
* https://blog.csdn.net/moneyshi/article/details/82978073
*/
public enum RequestMethodEnum {
/**
* 请求类型
*/
order_verify(1, "order_verify", "人工排产确认", "0"),
order_finish(2, "order_finish", "工单完成", "0"),

View File

@@ -235,6 +235,7 @@ public class BoxPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDriv
* @param extraName
* @return
*/
@Override
public List<String> getExtraDeviceCodes(String extraName) {
String extraValue = (String) this.getDevice().getExtraValue().get(extraName);
if (StrUtil.isEmpty(extraValue)) {

View File

@@ -299,14 +299,18 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
String nextDeviceCode = inst.get(0).getNext_device_code();
Device nextDevice = deviceAppService.findDeviceByCode(nextDeviceCode);
//指令为执行
if (unloadCheck(nextDevice)) return;
if (unloadCheck(nextDevice)) {
return;
}
map.put("to_command", 3);
requireSucess = true;
}
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)) return;
if (unloadCheck(nextDevice)) {
return;
}
map.put("to_command", 3);
requireSucess = true;
}
@@ -476,7 +480,9 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
List<Instruction> instructions = instructionService.findByDeviceCodes(instruction1, false);
List<Instruction> instructionList = new ArrayList<>();
//根据路由过滤指令
if (checkRute(instructions, instructionList)) return false;
if (checkRute(instructions, instructionList)) {
return false;
}
if (CollUtil.isEmpty(instructionList) || instructionList.size() < 1) {
return false;
}
@@ -486,11 +492,15 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
LinkedList<Instruction> instructionsAll = new LinkedList<>();
//找出有相邻的列的指令,如果没有按照单叉走,有按照双叉走
if (findInstruction(instructionList, inst, instructionsAll)) return false;
if (findInstruction(instructionList, inst, instructionsAll)) {
return false;
}
//写信号
if (wirteData(instructionsAll)) return false;
if (wirteData(instructionsAll)) {
return false;
}
@@ -625,7 +635,9 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
List<DeviceExtra> backX = deviceExtras.stream().filter(item -> "no_back_x".equals(item.getExtra_name())).collect(Collectors.toList());
List<DeviceExtra> sort = deviceExtras.stream().filter(item -> "sort".equals(item.getExtra_name())).collect(Collectors.toList());
//存在配置的禁止前排列
if (checkY(splitFront, frontY)) return true;
if (checkY(splitFront, frontY)) {
return true;
}
if (checkX(splitFront, frontX)) {
return true;
}
@@ -646,8 +658,12 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
List<Instruction> instructionNextPointList = instructionList.stream().filter(item -> item.getNext_point_code().equals(finalNextPointCodeDown)).collect(Collectors.toList());
if (instructionNextPointList.size()>0){
String[] splitBack = instructionNextPointList.get(0).getNext_point_code().split(commonFinalParam.getBARRE());
if (checkY(splitBack, backY)) return true;
if (checkX(splitBack, backX)) return true;
if (checkY(splitBack, backY)) {
return true;
}
if (checkX(splitBack, backX)) {
return true;
}
instructionsAll.add(instructionNextPointList.get(0));
}
}else {
@@ -658,19 +674,31 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
if (instructionNextPointList1.size()>0){
String[] splitBack = instructionNextPointList1.get(0).getNext_point_code().split(commonFinalParam.getBARRE());
if (checkY(splitBack, backY)) return true;
if (checkX(splitBack, backX)) return true;
if (checkY(splitBack, backY)) {
return true;
}
if (checkX(splitBack, backX)) {
return true;
}
instructionsAll.add(instructionNextPointList1.get(0));
return false;
}
if (instructionNextPointList2.size()>0){
//前叉的上一列有指令,此时前叉变成后叉,重新校验
String[] splitBack = instructionNextPointList2.get(0).getNext_point_code().split(commonFinalParam.getBARRE());
if (checkY(splitBack, frontY)) return true;
if (checkX(splitBack, frontX)) return true;
if (checkY(splitBack, frontY)) {
return true;
}
if (checkX(splitBack, frontX)) {
return true;
}
instructionsAll.addFirst(null);
if (checkY(splitFront, backY)) return true;
if (checkX(splitFront, backX)) return true;
if (checkY(splitFront, backY)) {
return true;
}
if (checkX(splitFront, backX)) {
return true;
}
instructionsAll.removeFirst();
instructionsAll.addFirst(instructionNextPointList2.get(0));
return false;

View File

@@ -10,6 +10,9 @@ import lombok.Getter;
@Getter
@AllArgsConstructor
public enum CommandEnum {
/**
* 动作信号
*/
STANDY(0,"待机"),
PICKUP(1,"取货中"),
PICKUP_COMPLETE(2,"取货完成"),

View File

@@ -11,6 +11,9 @@ import org.nl.acs.common.base.CommonFinalParam;
@Getter
@AllArgsConstructor
public enum SortEnum {
/**
* 排序
*/
PRONT("1","正序"),
BACK("2","倒序");

View File

@@ -157,6 +157,7 @@ public class HongXiangStationDeviceDriver extends AbstractOpcDeviceDriver implem
/**
* 将扩展表中的字符串数据转换成集合
*/
@Override
public List<String> getExtraDeviceCodes(String extraName) {
String extraValue = (String) this.getDevice().getExtraValue().get(extraName);
if (StrUtil.isEmpty(extraValue)) {

View File

@@ -547,6 +547,7 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
*
* @param
*/
@Override
public synchronized boolean apply_take_empty_vehicle() {
// if(move == 1) {
// ApplyTaskRequest request = new ApplyTaskRequest();

View File

@@ -763,6 +763,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
/**
* 将扩展表中的字符串数据转换成集合
*/
@Override
public List<String> getExtraDeviceCodes(String extraName) {
String extraValue = (String) this.getDevice().getExtraValue().get(extraName);
if (StrUtil.isEmpty(extraValue)) {

View File

@@ -163,6 +163,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
/**
* 将扩展表中的字符串数据转换成集合
*/
@Override
public List<String> getExtraDeviceCodes(String extraName) {
String extraValue = (String) this.getDevice().getExtraValue().get(extraName);
if (StrUtil.isEmpty(extraValue)) {

View File

@@ -81,27 +81,27 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
*/
Instruction inst = null;
/**
/**
* 工作模式
*/
int mode = 0;
int last_mode = 0;
/**
/**
* 光电信号
*/
int move = 0;
int last_move = 0;
/**
/**
* 托盘方向
*/
int carrier_direction = 0;
int last_carrier_direction = 0;
/**
/**
* 报警
*/
int error = 0;
int last_error = 0;
/**
/**
* 任务号
*/
int task = 0;
@@ -278,6 +278,9 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
break;
case 8:
break;
default:
break;
}
}
last_mode = mode;

View File

@@ -293,8 +293,8 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver
break;
case 5:
/**
* 申请贴标
*/
* 申请贴标
*/
if (move > 0 && !requireSucess) {
applyLabeling();
}
@@ -320,6 +320,8 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver
applyAgvTask();
}
break;
default:
break;
}
}
last_mode = mode;

View File

@@ -766,6 +766,8 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
break;
case 3:
break;
default:
break;
}
}
@@ -1368,6 +1370,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
//将扩展表中的字符串数组数据转换成集合
@Override
public List<String> getExtraDeviceCodes(String extraName) {
String extraValue = (String) this.getDevice().getExtraValue().get(extraName);
if (StrUtil.isEmpty(extraValue)) {

View File

@@ -257,6 +257,8 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
apply_InEmpty();
}
break;
default:
break;
}
@@ -269,7 +271,8 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
case 2:
writing(3);
break;
default:
break;
}
}

View File

@@ -239,6 +239,9 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp
if (hasGoods > 0 && !StrUtil.equals("0", barcode) && height > 0 && !applySucess) {
instruction_apply(barcode);
}
break;
default:
break;
}
switch (flag) {
//取货完成
@@ -249,7 +252,8 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp
case 2:
writing(3);
break;
default:
break;
}
}
last_mode = mode;

View File

@@ -295,6 +295,8 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
if (move > 0 && !StrUtil.isEmpty(newBarcode) && !applySucess) {
instruction_apply(newBarcode.trim());
}
default:
break;
}
switch (flag) {
//取货完成
@@ -305,7 +307,8 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
case 2:
writing(3);
break;
default:
break;
}
}
last_mode = mode;

View File

@@ -239,6 +239,8 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
apply(7);
}
break;
default:
break;
}
switch (flag) {
@@ -250,7 +252,8 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
case 2:
writing(3);
return;
default:
break;
}
}