add: 功能添加
This commit is contained in:
@@ -212,52 +212,14 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
|||||||
agvNdcOneDeviceDriver.setInstruction(null);
|
agvNdcOneDeviceDriver.setInstruction(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//普通站点
|
|
||||||
// StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
|
|
||||||
// if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
|
||||||
// standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
|
||||||
// //废泊处理的时候要判断是否允许任务完成
|
|
||||||
// if (ObjectUtil.isNotEmpty(device.getExtraValue().get("finish_task"))
|
|
||||||
// && StrUtil.equals("true", device.getExtraValue().get("finish_task").toString())) {
|
|
||||||
// if (standardOrdinarySiteDeviceDriver.getOption() == 3) {
|
|
||||||
// inst.setInstruction_status("2");
|
|
||||||
// try {
|
|
||||||
// instructionService.finish(inst);
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
|
|
||||||
// } else {
|
|
||||||
// log.info("等待LMS系统进行确认允许任务完成信号,设备号{},option值{}", standardOrdinarySiteDeviceDriver.getDevice_code(), standardOrdinarySiteDeviceDriver.getOption());
|
|
||||||
// logServer.deviceExecuteLog(device.getDevice_code(), "", "", "等待LMS系统进行确认允许取货,设备号" + device.getDevice_code() + ",指令号" + ikey);
|
|
||||||
// LuceneLogDto logDto = LuceneLogDto.builder()
|
|
||||||
// .device_code(standardOrdinarySiteDeviceDriver.getDevice_code())
|
|
||||||
// .content("等待LMS系统进行确认允许任务完成信号,设备号" + standardOrdinarySiteDeviceDriver.getDevice_code() + ",option当前值" + standardOrdinarySiteDeviceDriver.getOption())
|
|
||||||
// .build();
|
|
||||||
// logDto.setLog_level(4);
|
|
||||||
// luceneExecuteLogService.deviceExecuteLog(logDto);
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// inst.setInstruction_status("2");
|
|
||||||
// try {
|
|
||||||
// instructionService.finish(inst);
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
inst.setInstruction_status("2");
|
inst.setInstruction_status("2");
|
||||||
try {
|
try {
|
||||||
instructionService.finish(inst);
|
instructionService.finish(inst);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
|
|
||||||
}
|
}
|
||||||
|
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
|
||||||
}
|
}
|
||||||
//请求删除任务
|
//请求删除任务
|
||||||
//(需要WCS反馈)
|
//(需要WCS反馈)
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
|
|||||||
//requireSucess = false;
|
//requireSucess = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (finish == 1 && !requireSucess) {
|
if (finish == 1 && move == 1 && !requireSucess) {
|
||||||
//烘箱完成反馈LMS
|
//烘箱完成反馈LMS
|
||||||
apply_finish();
|
apply_finish();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -232,7 +232,9 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
List toInstructions;
|
List toInstructions;
|
||||||
|
|
||||||
//行架机械手申请任务
|
//行架机械手申请任务
|
||||||
if (mode == 2 && move == 0 && task == 0 && !requireSucess) {
|
// todo :其他行架异常信号判断
|
||||||
|
// todo: 同行烘箱们关闭
|
||||||
|
if (mode == 2 && move == 0 && task == 0 && !requireSucess && error == 0) {
|
||||||
boolean res = applyTask();
|
boolean res = applyTask();
|
||||||
if (res) {
|
if (res) {
|
||||||
notCreateInstMessage = "";
|
notCreateInstMessage = "";
|
||||||
@@ -349,24 +351,28 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
OvenInspectSiteDeviceDriver ovenInspectSiteDeviceDriver;
|
OvenInspectSiteDeviceDriver ovenInspectSiteDeviceDriver;
|
||||||
if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
||||||
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver();
|
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver();
|
||||||
if (hongXiangConveyorDeviceDriver.getMode() == 0 || hongXiangConveyorDeviceDriver.getMove() == 0) {
|
if (hongXiangConveyorDeviceDriver.getMode() == 0 || hongXiangConveyorDeviceDriver.getMove() == 0 || hongXiangConveyorDeviceDriver.getError() != 0 || hongXiangConveyorDeviceDriver.getError1() != 0) {
|
||||||
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code() + "未联机或无货,无法或者为开门下发指令!指令号:" + instruction.getInstruction_code();
|
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code() + "未联机或无货,无法或者为开门下发指令!指令号:" + instruction.getInstruction_code();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// 判断相邻烘箱是否有货有异常
|
||||||
|
// if (filterNeighbors(startdevice)) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (nextdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
if (nextdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
||||||
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextdevice.getDeviceDriver();
|
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextdevice.getDeviceDriver();
|
||||||
if (hongXiangConveyorDeviceDriver.getMode() == 0 || hongXiangConveyorDeviceDriver.getMove() == 1) {
|
if (hongXiangConveyorDeviceDriver.getMode() == 0 || hongXiangConveyorDeviceDriver.getMove() == 1 || hongXiangConveyorDeviceDriver.getError() != 0 || hongXiangConveyorDeviceDriver.getError1() != 0) {
|
||||||
notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code() + "未联机或者有货或者未开门,无法下发指令!指令号:" + instruction.getInstruction_code();
|
notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code() + "未联机或者有货或者未开门,无法下发指令!指令号:" + instruction.getInstruction_code();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// 判断相邻烘箱是否有货有异常
|
||||||
|
// if (filterNeighbors(nextdevice)) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||||
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver();
|
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver();
|
||||||
if ( standardInspectSiteDeviceDriver.getMove() == 1 ) {
|
if (standardInspectSiteDeviceDriver.getMove() == 1) {
|
||||||
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱缓存位:" + standardInspectSiteDeviceDriver.getDevice_code() + "无货,无法下发指令!指令号:" + instruction.getInstruction_code();
|
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱缓存位:" + standardInspectSiteDeviceDriver.getDevice_code() + "无货,无法下发指令!指令号:" + instruction.getInstruction_code();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -375,7 +381,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
|
|
||||||
if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||||
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver();
|
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver();
|
||||||
if ( standardInspectSiteDeviceDriver.getMove() == 0) {
|
if (standardInspectSiteDeviceDriver.getMove() == 0) {
|
||||||
notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱缓存位:" + standardInspectSiteDeviceDriver.getDevice_code() + "有货,无法下发指令!指令号:" + instruction.getInstruction_code();
|
notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱缓存位:" + standardInspectSiteDeviceDriver.getDevice_code() + "有货,无法下发指令!指令号:" + instruction.getInstruction_code();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -383,7 +389,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
|
|
||||||
if (startdevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
|
if (startdevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
|
||||||
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) startdevice.getDeviceDriver();
|
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) startdevice.getDeviceDriver();
|
||||||
if ( manipulatorAgvStationDeviceDriver.getMove() == 1 ) {
|
if (manipulatorAgvStationDeviceDriver.getMove() == 1) {
|
||||||
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱对接位:" + manipulatorAgvStationDeviceDriver.getDevice_code() + "无货,无法下发指令!指令号:" + instruction.getInstruction_code();
|
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱对接位:" + manipulatorAgvStationDeviceDriver.getDevice_code() + "无货,无法下发指令!指令号:" + instruction.getInstruction_code();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -392,15 +398,13 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
|
|
||||||
if (nextdevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
|
if (nextdevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
|
||||||
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) nextdevice.getDeviceDriver();
|
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) nextdevice.getDeviceDriver();
|
||||||
if ( manipulatorAgvStationDeviceDriver.getMove() == 0) {
|
if (manipulatorAgvStationDeviceDriver.getMove() == 0) {
|
||||||
notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱对接位:" + manipulatorAgvStationDeviceDriver.getDevice_code() + "有货,无法下发指令!指令号:" + instruction.getInstruction_code();
|
notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱对接位:" + manipulatorAgvStationDeviceDriver.getDevice_code() + "有货,无法下发指令!指令号:" + instruction.getInstruction_code();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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);
|
||||||
if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) {
|
if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) {
|
||||||
@@ -462,6 +466,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
if (!ObjectUtil.isEmpty(task)) {
|
if (!ObjectUtil.isEmpty(task)) {
|
||||||
Device nextdevice = deviceAppService.findDeviceByCode(task.getNext_device_code());
|
Device nextdevice = deviceAppService.findDeviceByCode(task.getNext_device_code());
|
||||||
Device startdevice = deviceAppService.findDeviceByCode(task.getStart_device_code());
|
Device startdevice = deviceAppService.findDeviceByCode(task.getStart_device_code());
|
||||||
|
|
||||||
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
|
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
|
||||||
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
|
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
|
||||||
ManipulatorAgvStationDeviceDriver manipulatorAgvStationDeviceDriver;
|
ManipulatorAgvStationDeviceDriver manipulatorAgvStationDeviceDriver;
|
||||||
@@ -469,24 +474,28 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
||||||
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver();
|
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver();
|
||||||
if (hongXiangConveyorDeviceDriver.getMode() == 0 || hongXiangConveyorDeviceDriver.getMove() == 0 || hongXiangConveyorDeviceDriver.getError() != 0 || hongXiangConveyorDeviceDriver.getError1() != 0) {
|
if (hongXiangConveyorDeviceDriver.getMode() == 0 || hongXiangConveyorDeviceDriver.getMove() == 0 || hongXiangConveyorDeviceDriver.getError() != 0 || hongXiangConveyorDeviceDriver.getError1() != 0) {
|
||||||
notCreateInstMessage = "就绪任务未创建指令原因->取货位-烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code() + "光电无货,无法生成指令!" + hongXiangConveyorDeviceDriver.getError() + "异常" + + hongXiangConveyorDeviceDriver.getError1() + "异常,无法生成指令!";
|
notCreateInstMessage = "就绪任务未创建指令原因->取货位-烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code() + "光电无货,无法生成指令!" + hongXiangConveyorDeviceDriver.getError() + "异常" + +hongXiangConveyorDeviceDriver.getError1() + "异常,无法生成指令!";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// 判断相邻烘箱是否有货有异常
|
||||||
|
// if (filterNeighbors(startdevice)) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nextdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
if (nextdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
||||||
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextdevice.getDeviceDriver();
|
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextdevice.getDeviceDriver();
|
||||||
if (hongXiangConveyorDeviceDriver.getMode() == 0 || hongXiangConveyorDeviceDriver.getMove() == 1 || hongXiangConveyorDeviceDriver.getError() != 0 || hongXiangConveyorDeviceDriver.getError1() != 0) {
|
if (hongXiangConveyorDeviceDriver.getMode() == 0 || hongXiangConveyorDeviceDriver.getMove() == 1 || hongXiangConveyorDeviceDriver.getError() != 0 || hongXiangConveyorDeviceDriver.getError1() != 0) {
|
||||||
notCreateInstMessage = "就绪任务未创建指令原因->放货位-烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code() + "光电有货,无法生成指令!" + hongXiangConveyorDeviceDriver.getError() + "异常" + + hongXiangConveyorDeviceDriver.getError1() + "异常,无法生成指令!";
|
notCreateInstMessage = "就绪任务未创建指令原因->放货位-烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code() + "光电有货,无法生成指令!" + hongXiangConveyorDeviceDriver.getError() + "异常" + +hongXiangConveyorDeviceDriver.getError1() + "异常,无法生成指令!";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// 判断相邻烘箱是否有货有异常
|
||||||
|
// if (filterNeighbors(nextdevice)) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||||
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver();
|
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver();
|
||||||
if ( standardInspectSiteDeviceDriver.getMove() == 1 ) {
|
if (standardInspectSiteDeviceDriver.getMove() == 1) {
|
||||||
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱缓存位:" + standardInspectSiteDeviceDriver.getDevice_code() + "无货,无法下发指令!指令号:" ;
|
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱缓存位:" + standardInspectSiteDeviceDriver.getDevice_code() + "无货,无法下发指令!指令号:";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -494,16 +503,16 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
|
|
||||||
if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||||
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver();
|
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver();
|
||||||
if ( standardInspectSiteDeviceDriver.getMove() == 0) {
|
if (standardInspectSiteDeviceDriver.getMove() == 0) {
|
||||||
notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱缓存位:" + standardInspectSiteDeviceDriver.getDevice_code() + "有货,无法下发指令!" ;
|
notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱缓存位:" + standardInspectSiteDeviceDriver.getDevice_code() + "有货,无法下发指令!";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startdevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
|
if (startdevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
|
||||||
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) startdevice.getDeviceDriver();
|
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) startdevice.getDeviceDriver();
|
||||||
if ( manipulatorAgvStationDeviceDriver.getMove() == 1 ) {
|
if (manipulatorAgvStationDeviceDriver.getMove() == 1) {
|
||||||
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱对接位:" + manipulatorAgvStationDeviceDriver.getDevice_code() + "无货,无法下发指令!" ;
|
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱对接位:" + manipulatorAgvStationDeviceDriver.getDevice_code() + "无货,无法下发指令!";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -511,15 +520,13 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
|
|
||||||
if (nextdevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
|
if (nextdevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
|
||||||
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) nextdevice.getDeviceDriver();
|
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) nextdevice.getDeviceDriver();
|
||||||
if ( manipulatorAgvStationDeviceDriver.getMove() == 0) {
|
if (manipulatorAgvStationDeviceDriver.getMove() == 0) {
|
||||||
notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱对接位:" + manipulatorAgvStationDeviceDriver.getDevice_code() + "有货,无法下发指令!" ;
|
notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱对接位:" + manipulatorAgvStationDeviceDriver.getDevice_code() + "有货,无法下发指令!";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
String taskid = task.getTask_id();
|
String taskid = task.getTask_id();
|
||||||
String taskcode = task.getTask_code();
|
String taskcode = task.getTask_code();
|
||||||
String vehiclecode = task.getVehicle_code();
|
String vehiclecode = task.getVehicle_code();
|
||||||
@@ -631,6 +638,52 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean filterNeighbors(Device device) {
|
||||||
|
Integer serial = Integer.parseInt(device.getAddress());
|
||||||
|
List<String> neighbors = getNeighbors(serial);
|
||||||
|
if (CollUtil.isNotEmpty(neighbors)){
|
||||||
|
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriverNeighbor;
|
||||||
|
for (String neighbor : neighbors) {
|
||||||
|
Device deviceByAddress = deviceAppService.findDeviceByAddress(neighbor);
|
||||||
|
hongXiangConveyorDeviceDriverNeighbor = (HongXiangConveyorDeviceDriver) deviceByAddress.getDeviceDriver();
|
||||||
|
if (hongXiangConveyorDeviceDriverNeighbor.getMode() == 0 || hongXiangConveyorDeviceDriverNeighbor.getMove() == 0 || hongXiangConveyorDeviceDriverNeighbor.getError() != 0 || hongXiangConveyorDeviceDriverNeighbor.getError1() != 0) {
|
||||||
|
notCreateInstMessage = "就绪任务未创建指令原因->-烘箱:" + hongXiangConveyorDeviceDriverNeighbor.getDevice_code() + "光电无货,无法生成指令!" + hongXiangConveyorDeviceDriverNeighbor.getError() + "异常" + +hongXiangConveyorDeviceDriverNeighbor.getError1() + "异常,无法生成指令!";
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取数字的左右邻居
|
||||||
|
* @param num 要获取邻居的数字(1-7之间)
|
||||||
|
* @return 包含邻居的列表
|
||||||
|
*/
|
||||||
|
public List<String> getNeighbors(int num) {
|
||||||
|
List<String> neighbors = new ArrayList<>();
|
||||||
|
|
||||||
|
// 检查数字是否在有效范围内
|
||||||
|
if (num < 1 || num > 7) {
|
||||||
|
return neighbors; // 返回空列表表示无效数字
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理左边的邻居
|
||||||
|
if (num > 1) {
|
||||||
|
neighbors.add(String.valueOf(num - 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理右边的邻居
|
||||||
|
if (num < 7) {
|
||||||
|
neighbors.add(String.valueOf(num + 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
return neighbors;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void toOpenDoor(Device nextdevice) {
|
private void toOpenDoor(Device nextdevice) {
|
||||||
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
|
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
|
||||||
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextdevice.getDeviceDriver();
|
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextdevice.getDeviceDriver();
|
||||||
@@ -645,99 +698,30 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
hongXiangConveyorDeviceDriver.writing("to_close_door", "1");
|
hongXiangConveyorDeviceDriver.writing("to_close_door", "1");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 判断经过的烘箱是否关门
|
|
||||||
*/
|
|
||||||
private boolean hongxiangCloseDoor(String start_device_code, String next_device_code) {
|
|
||||||
boolean flag = true;
|
|
||||||
List<String> ovenDeviceCodeList = null;
|
|
||||||
Device startDevice = deviceAppService.findDeviceByCode(start_device_code);
|
|
||||||
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
|
|
||||||
OvenInspectSiteDeviceDriver ovenInspectSiteDeviceDriver;
|
|
||||||
if (ObjectUtil.isEmpty(ovenDeviceCodeList) && startDevice.getDeviceDriver() instanceof OvenInspectSiteDeviceDriver) {
|
|
||||||
ovenInspectSiteDeviceDriver = (OvenInspectSiteDeviceDriver) startDevice.getDeviceDriver();
|
|
||||||
ovenDeviceCodeList = ovenInspectSiteDeviceDriver.getExtraDeviceCodes("link_device_code");
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isEmpty(ovenDeviceCodeList) && nextDevice.getDeviceDriver() instanceof OvenInspectSiteDeviceDriver) {
|
|
||||||
ovenInspectSiteDeviceDriver = (OvenInspectSiteDeviceDriver) nextDevice.getDeviceDriver();
|
|
||||||
ovenDeviceCodeList = ovenInspectSiteDeviceDriver.getExtraDeviceCodes("link_device_code");
|
|
||||||
}
|
|
||||||
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
|
|
||||||
if (CollUtil.isNotEmpty(ovenDeviceCodeList)) {
|
|
||||||
for (String s : ovenDeviceCodeList) {
|
|
||||||
Device device = deviceAppService.findDeviceByCode(s);
|
|
||||||
if (device.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
|
||||||
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) device.getDeviceDriver();
|
|
||||||
//判断关联设备是否开门
|
|
||||||
if (hongXiangConveyorDeviceDriver.getDoor() != 2) {
|
|
||||||
notCreateInstMessage = "关联设备->" + device + "烘箱门未关闭!";
|
|
||||||
flag = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return flag;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断取货位或放货位为烘箱设备时关联的同一列烘箱设备是否有开门
|
* 判断取货位或放货位为烘箱设备时关联的同一排烘箱设备是否有开门
|
||||||
*
|
*
|
||||||
* @param start_device_code
|
* @param device_code
|
||||||
* @param next_device_code
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean judgeCloseDoor(String start_device_code, String next_device_code) {
|
public boolean judgeCloseDoor(String device_code) {
|
||||||
Boolean isClose = false;
|
Boolean isClose = false;
|
||||||
try {
|
try {
|
||||||
Device startDevice = deviceAppService.findDeviceByCode(start_device_code);
|
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||||
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
|
|
||||||
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
|
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
|
||||||
if (ObjectUtil.isEmpty(startDevice)) {
|
if (device.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
||||||
throw new BadRequestException("设备号:" + start_device_code + "不存在!");
|
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) device.getDeviceDriver();
|
||||||
}
|
|
||||||
if (startDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
|
||||||
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startDevice.getDeviceDriver();
|
|
||||||
List<String> deviceCodes = hongXiangConveyorDeviceDriver.getExtraDeviceCodes("link_device_code");
|
List<String> deviceCodes = hongXiangConveyorDeviceDriver.getExtraDeviceCodes("link_device_code");
|
||||||
if (ObjectUtil.isNotEmpty(deviceCodes)) {
|
if (ObjectUtil.isNotEmpty(deviceCodes)) {
|
||||||
for (String deviceCode : deviceCodes) {
|
for (String deviceCode : deviceCodes) {
|
||||||
Device linkDevice = deviceAppService.findDeviceByCode(deviceCode);
|
Device linkDevice = deviceAppService.findDeviceByCode(deviceCode);
|
||||||
if (ObjectUtil.isEmpty(linkDevice)) {
|
|
||||||
throw new BadRequestException("设备:" + start_device_code + "关联设备->" + deviceCode + "为空!");
|
|
||||||
}
|
|
||||||
if (linkDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
if (linkDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
||||||
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) linkDevice.getDeviceDriver();
|
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) linkDevice.getDeviceDriver();
|
||||||
//判断关联设备是否开门
|
//判断关联设备是否开门
|
||||||
if (hongXiangConveyorDeviceDriver.getDoor() != 2 || hongXiangConveyorDeviceDriver.getError1() != 0
|
if (hongXiangConveyorDeviceDriver.getDoor() != 2) {
|
||||||
|| hongXiangConveyorDeviceDriver.getError() != 0) {
|
|
||||||
isClose = true;
|
isClose = true;
|
||||||
notCreateInstMessage = start_device_code + "关联设备->" + deviceCode + "烘箱门未关闭!";
|
notCreateInstMessage = device + "关联设备->" + deviceCode + "烘箱门未关闭!";
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return isClose;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isEmpty(nextDevice)) {
|
|
||||||
throw new BadRequestException("设备号:" + next_device_code + "不存在!");
|
|
||||||
}
|
|
||||||
if (nextDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
|
||||||
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextDevice.getDeviceDriver();
|
|
||||||
List<String> deviceCodes = hongXiangConveyorDeviceDriver.getExtraDeviceCodes("link_device_code");
|
|
||||||
if (ObjectUtil.isNotEmpty(deviceCodes)) {
|
|
||||||
for (String deviceCode : deviceCodes) {
|
|
||||||
Device linkDevice = deviceAppService.findDeviceByCode(deviceCode);
|
|
||||||
if (ObjectUtil.isEmpty(linkDevice)) {
|
|
||||||
throw new BadRequestException("设备:" + next_device_code + "关联设备->" + deviceCode + "为空!");
|
|
||||||
}
|
|
||||||
if (linkDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
|
||||||
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) linkDevice.getDeviceDriver();
|
|
||||||
//判断关联设备是否开门
|
|
||||||
if (hongXiangConveyorDeviceDriver.getDoor() != 2 || hongXiangConveyorDeviceDriver.getError1() != 0
|
|
||||||
|| hongXiangConveyorDeviceDriver.getError() != 0) {
|
|
||||||
isClose = true;
|
|
||||||
notCreateInstMessage = next_device_code + "关联设备->" + deviceCode + "烘箱门未关闭!";
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -811,6 +795,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
|
|
||||||
//申请取货
|
//申请取货
|
||||||
if (mode == 3 && action == 1 && move == 0 && task > 0) {
|
if (mode == 3 && action == 1 && move == 0 && task > 0) {
|
||||||
|
|
||||||
|
|
||||||
Instruction inst2 = checkInst();
|
Instruction inst2 = checkInst();
|
||||||
if (ObjectUtil.isNotEmpty(inst2)) {
|
if (ObjectUtil.isNotEmpty(inst2)) {
|
||||||
String start_device_code = inst2.getStart_device_code();
|
String start_device_code = inst2.getStart_device_code();
|
||||||
@@ -819,6 +805,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
if (device.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
if (device.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
||||||
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) device.getDeviceDriver();
|
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) device.getDeviceDriver();
|
||||||
// EXECUTOR.execute(() -> {
|
// EXECUTOR.execute(() -> {
|
||||||
|
//开门前先判断阻挡的门是否全部关到位
|
||||||
|
if (!judgeCloseDoor(hongXiangConveyorDeviceDriver.getDevice_code())) {
|
||||||
toOpenDoor(device);
|
toOpenDoor(device);
|
||||||
// });
|
// });
|
||||||
int mode = hongXiangConveyorDeviceDriver.getMode();
|
int mode = hongXiangConveyorDeviceDriver.getMode();
|
||||||
@@ -851,6 +839,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
feedMessage = feedMessage + "故障(error1)信号出现故障,故障值:" + error1 + "。";
|
feedMessage = feedMessage + "故障(error1)信号出现故障,故障值:" + error1 + "。";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
map.put("code", "to_command");
|
map.put("code", "to_command");
|
||||||
map.put("value", "2");
|
map.put("value", "2");
|
||||||
@@ -875,6 +864,44 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mode == 3 && action == 10 && task > 0 ){
|
||||||
|
Instruction inst2 = checkInst();
|
||||||
|
String deviceCode;
|
||||||
|
String start_device_code = inst2.getStart_device_code();
|
||||||
|
String next_device_code = inst2.getNext_device_code();
|
||||||
|
Device device = deviceAppService.findDeviceByCode(start_device_code);
|
||||||
|
Device device2 = deviceAppService.findDeviceByCode(next_device_code);
|
||||||
|
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
|
||||||
|
if (device.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver){
|
||||||
|
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) device.getDeviceDriver();
|
||||||
|
}else {
|
||||||
|
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) device2.getDeviceDriver();
|
||||||
|
}
|
||||||
|
//开门前先判断阻挡的门是否全部关到位
|
||||||
|
if (!judgeCloseDoor(hongXiangConveyorDeviceDriver.getDevice_code())) {
|
||||||
|
map.put("code", "to_command");
|
||||||
|
map.put("value", "10");
|
||||||
|
list.add(map);
|
||||||
|
this.writing(list);
|
||||||
|
this.setRequireActionSucess(true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
feedMessage = "行架机械手:";
|
||||||
|
if (mode != 3) {
|
||||||
|
feedMessage = feedMessage + "工作模式(mode)不为运行中状态,";
|
||||||
|
}
|
||||||
|
if (action != 10) {
|
||||||
|
feedMessage = feedMessage + "动作信号(action)不为取放货校验状态,";
|
||||||
|
}
|
||||||
|
if (move != 1) {
|
||||||
|
feedMessage = feedMessage + "光电信号(move)不为有货状态,";
|
||||||
|
}
|
||||||
|
if (task == 0) {
|
||||||
|
feedMessage = feedMessage + "当前上报任务号(task)不应该为0。";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//取货完成关闭烘箱门
|
//取货完成关闭烘箱门
|
||||||
if (mode == 3 && action == 2 && move == 1 && task > 0 && walk_y == 1) {
|
if (mode == 3 && action == 2 && move == 1 && task > 0 && walk_y == 1) {
|
||||||
Instruction inst2 = checkInst();
|
Instruction inst2 = checkInst();
|
||||||
@@ -951,6 +978,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
if (nextDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
if (nextDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
||||||
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextDevice.getDeviceDriver();
|
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextDevice.getDeviceDriver();
|
||||||
// EXECUTOR.submit(() -> {
|
// EXECUTOR.submit(() -> {
|
||||||
|
|
||||||
|
if (!judgeCloseDoor(hongXiangConveyorDeviceDriver.getDevice_code())) {
|
||||||
toOpenDoor(nextDevice);
|
toOpenDoor(nextDevice);
|
||||||
// });
|
// });
|
||||||
int mode = hongXiangConveyorDeviceDriver.getMode();
|
int mode = hongXiangConveyorDeviceDriver.getMode();
|
||||||
@@ -983,6 +1012,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
feedMessage = feedMessage + "故障(error1)信号出现故障。";
|
feedMessage = feedMessage + "故障(error1)信号出现故障。";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
map.put("code", "to_command");
|
map.put("code", "to_command");
|
||||||
map.put("value", "4");
|
map.put("value", "4");
|
||||||
@@ -1121,7 +1151,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public synchronized boolean finish_instruction(Instruction inst) throws Exception {
|
public synchronized boolean finish_instruction(Instruction inst) throws Exception {
|
||||||
instructionService.finish(inst);
|
instructionService.finish(inst);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -0,0 +1,81 @@
|
|||||||
|
package org.nl.acs.device_driver.two_conveyor.slitting_cache;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Data
|
||||||
|
public class ItemProtocol {
|
||||||
|
|
||||||
|
public static String item_heartbeat = "heartbeat";
|
||||||
|
public static String item_move1 = "move1";
|
||||||
|
public static String item_move2 = "move2";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private SlittingCacheDeviceDriver driver;
|
||||||
|
|
||||||
|
public ItemProtocol(SlittingCacheDeviceDriver driver) {
|
||||||
|
this.driver = driver;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHeartbeat() {
|
||||||
|
return this.getOpcIntegerValue(item_heartbeat);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public int getMove1() {
|
||||||
|
return this.getOpcIntegerValue(item_move1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMove2() {
|
||||||
|
return this.getOpcIntegerValue(item_move2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*是否有货
|
||||||
|
*/
|
||||||
|
public int hasGoods(int move) {
|
||||||
|
return move;
|
||||||
|
}
|
||||||
|
|
||||||
|
Boolean isonline;
|
||||||
|
|
||||||
|
public int getOpcIntegerValue(String protocol) {
|
||||||
|
Integer value = this.driver.getIntegeregerValue(protocol);
|
||||||
|
if (value == null) {
|
||||||
|
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
|
||||||
|
setIsonline(false);
|
||||||
|
} else {
|
||||||
|
setIsonline(true);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<ItemDto> getReadableItemDtos() {
|
||||||
|
ArrayList list = new ArrayList();
|
||||||
|
list.add(new ItemDto(item_heartbeat, "心跳", "DB600.B0"));
|
||||||
|
list.add(new ItemDto(item_move1, "光电开关信号1", "DB600.B3"));
|
||||||
|
list.add(new ItemDto(item_move2, "光电开关信号2", "DB600.B3"));
|
||||||
|
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<ItemDto> getWriteableItemDtos() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package org.nl.acs.device_driver.two_conveyor.slitting_cache;
|
||||||
|
|
||||||
|
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||||
|
import org.nl.acs.device.domain.Device;
|
||||||
|
import org.nl.acs.device.enums.DeviceType;
|
||||||
|
import org.nl.acs.device_driver.DeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分切缓存架光电检测点位
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SlittingCacheDefination implements OpcDeviceDriverDefination {
|
||||||
|
@Override
|
||||||
|
public String getDriverCode() {
|
||||||
|
return "cutpointivt_type_site";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDriverName() {
|
||||||
|
return "分切下料-分切缓存架光电检测点位";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDriverDescription() {
|
||||||
|
return "分切下料-分切缓存架光电检测点位";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DeviceDriver getDriverInstance(Device device) {
|
||||||
|
return (new SlittingCacheDeviceDriver()).setDevice(device).setDriverDefination(this);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends DeviceDriver> getDeviceDriverType() {
|
||||||
|
return SlittingCacheDeviceDriver.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DeviceType> getFitDeviceTypes() {
|
||||||
|
List<DeviceType> types = new LinkedList();
|
||||||
|
types.add(DeviceType.conveyor);
|
||||||
|
return types;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ItemDto> getReadableItemDtos() {
|
||||||
|
return ItemProtocol.getReadableItemDtos();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ItemDto> getWriteableItemDtos() {
|
||||||
|
return ItemProtocol.getWriteableItemDtos();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,251 @@
|
|||||||
|
package org.nl.acs.device_driver.two_conveyor.slitting_cache;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.acs.device.domain.Device;
|
||||||
|
import org.nl.acs.device.service.DeviceService;
|
||||||
|
import org.nl.acs.device_driver.DeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||||
|
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||||
|
import org.nl.acs.instruction.domain.Instruction;
|
||||||
|
import org.nl.acs.instruction.service.InstructionService;
|
||||||
|
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||||
|
import org.nl.acs.opc.WcsConfig;
|
||||||
|
import org.nl.acs.route.service.RouteLineService;
|
||||||
|
import org.nl.acs.route.service.dto.RouteLineDto;
|
||||||
|
import org.nl.acs.task.domain.Task;
|
||||||
|
import org.nl.acs.task.enums.TaskStatusEnum;
|
||||||
|
import org.nl.acs.task.service.TaskService;
|
||||||
|
import org.nl.acs.task.service.dto.TaskDto;
|
||||||
|
import org.nl.acs.task.service.mapper.TaskMapper;
|
||||||
|
import org.nl.acs.utils.ConvertUtil;
|
||||||
|
import org.nl.common.utils.CodeUtil;
|
||||||
|
import org.nl.config.SpringContextHolder;
|
||||||
|
import org.nl.config.lucene.service.LuceneExecuteLogService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测站点驱动
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Data
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class SlittingCacheDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
|
||||||
|
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||||
|
|
||||||
|
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
|
||||||
|
|
||||||
|
DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl");
|
||||||
|
|
||||||
|
RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl");
|
||||||
|
|
||||||
|
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
|
||||||
|
|
||||||
|
TaskMapper taskMapper;
|
||||||
|
|
||||||
|
AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl");
|
||||||
|
@Autowired
|
||||||
|
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
|
||||||
|
|
||||||
|
|
||||||
|
String container;
|
||||||
|
String container_type_desc;
|
||||||
|
String last_container_type_desc;
|
||||||
|
String last_container;
|
||||||
|
/**
|
||||||
|
* 放货准备锁
|
||||||
|
*/
|
||||||
|
String putReadyLock = null;
|
||||||
|
/**
|
||||||
|
* 有货标记
|
||||||
|
*/
|
||||||
|
protected boolean has_goods_tag = false;
|
||||||
|
|
||||||
|
private Date time = new Date();
|
||||||
|
|
||||||
|
|
||||||
|
int move1 = 0;
|
||||||
|
int move2 = 0;
|
||||||
|
int move3 = 0;
|
||||||
|
int move4 = 0;
|
||||||
|
|
||||||
|
Boolean isonline = true;
|
||||||
|
int hasGoods = 0;
|
||||||
|
String message = null;
|
||||||
|
Boolean iserror = false;
|
||||||
|
|
||||||
|
|
||||||
|
int option = 0;
|
||||||
|
|
||||||
|
|
||||||
|
boolean hasVehicle = false;
|
||||||
|
boolean isReady = false;
|
||||||
|
protected int instruction_num = 0;
|
||||||
|
protected int instruction_num_truth = 0;
|
||||||
|
boolean isFold = false;
|
||||||
|
private String assemble_check_tag;
|
||||||
|
|
||||||
|
protected String current_stage_instruction_message;
|
||||||
|
protected String last_stage_instruction_message;
|
||||||
|
Integer heartbeat_tag;
|
||||||
|
private Date instruction_require_time = new Date();
|
||||||
|
private Date instruction_finished_time = new Date();
|
||||||
|
|
||||||
|
private int instruction_require_time_out;
|
||||||
|
boolean requireSucess = false;
|
||||||
|
|
||||||
|
private int instruction_finished_time_out;
|
||||||
|
|
||||||
|
int branchProtocol = 0;
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
String remark;
|
||||||
|
/**
|
||||||
|
* 数量
|
||||||
|
*/
|
||||||
|
String qty;
|
||||||
|
/**
|
||||||
|
* 物料
|
||||||
|
*/
|
||||||
|
String material;
|
||||||
|
/**
|
||||||
|
* 批次
|
||||||
|
*/
|
||||||
|
String batch;
|
||||||
|
/**
|
||||||
|
* 当前指令
|
||||||
|
*/
|
||||||
|
Instruction inst = null;
|
||||||
|
/**
|
||||||
|
* 上次指令
|
||||||
|
*/
|
||||||
|
Instruction last_inst = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 触摸屏手动触发任务
|
||||||
|
*/
|
||||||
|
private Boolean is_has_task = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 满盅入库请求标记
|
||||||
|
*/
|
||||||
|
boolean Sucess = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域
|
||||||
|
*/
|
||||||
|
int flag;
|
||||||
|
|
||||||
|
String devicecode;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Device getDevice() {
|
||||||
|
return this.device;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
String message = null;
|
||||||
|
|
||||||
|
devicecode = this.getDeviceCode();
|
||||||
|
|
||||||
|
move1 = this.itemProtocol.getMove1();
|
||||||
|
move2 = this.itemProtocol.getMove2();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean instruction_require(String container_code) {
|
||||||
|
return instruction_require(container_code, WcsConfig.task_container_type_default_desc);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求指令
|
||||||
|
*
|
||||||
|
* @param container_code
|
||||||
|
* @param container_type
|
||||||
|
*/
|
||||||
|
public synchronized boolean instruction_require(String container_code, String container_type) {
|
||||||
|
Date date = new Date();
|
||||||
|
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
|
||||||
|
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
this.instruction_require_time = date;
|
||||||
|
TaskDto dto = new TaskDto();
|
||||||
|
String now = DateUtil.now();
|
||||||
|
dto.setTask_id(IdUtil.simpleUUID());
|
||||||
|
dto.setCreate_by(this.getDevice().getDevice_code());
|
||||||
|
dto.setUpdate_by(this.getDevice().getDevice_code());
|
||||||
|
dto.setStart_point_code(this.getDevice().getDevice_code());
|
||||||
|
dto.setVehicle_code(container_code);
|
||||||
|
dto.setVehicle_type(container_type);
|
||||||
|
|
||||||
|
String taskcode = CodeUtil.getNewCode("TASK_NO");
|
||||||
|
dto.setTask_code("-" + taskcode);
|
||||||
|
dto.setTask_status(TaskStatusEnum.READY.getIndex());
|
||||||
|
dto.setPriority("101");
|
||||||
|
RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code());
|
||||||
|
String next_device_codecode = jo.getNext_device_code();
|
||||||
|
if (StrUtil.isEmpty(next_device_codecode)) {
|
||||||
|
throw new RuntimeException("该设备未找到对应路由");
|
||||||
|
}
|
||||||
|
dto.setNext_point_code(next_device_codecode);
|
||||||
|
dto.setUpdate_time(now);
|
||||||
|
dto.setCreate_time(now);
|
||||||
|
|
||||||
|
// WQLObject wo = WQLObject.getWQLObject("acs_task");
|
||||||
|
// JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||||
|
//
|
||||||
|
// wo.insert(json);
|
||||||
|
|
||||||
|
Task entity = ConvertUtil.convert(dto, Task.class);
|
||||||
|
taskMapper.insert(entity);
|
||||||
|
requireSucess = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONObject getDeviceStatusName() {
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
String mode = "";
|
||||||
|
String action = "";
|
||||||
|
jo.put("device_name", this.getDevice().getDevice_name());
|
||||||
|
jo.put("mode", mode);
|
||||||
|
jo.put("move1", move1);
|
||||||
|
|
||||||
|
return jo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setDeviceStatus(JSONObject data) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* lms申请任务
|
||||||
|
*
|
||||||
|
* @param
|
||||||
|
*/
|
||||||
|
public synchronized boolean apply(Integer type) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -269,32 +269,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
route_plan_code = "normal";
|
route_plan_code = "normal";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StrUtil.equals(task_type, "5")) {
|
|
||||||
Device device = deviceAppService.findDeviceByCode(next_device_code);
|
|
||||||
SiemensConveyorDeviceDriver siemensConveyorDeviceDriver;
|
|
||||||
if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
|
|
||||||
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver();
|
|
||||||
if (ObjectUtil.equal("true", siemensConveyorDeviceDriver.getExtraValue().get("inspect_in_stock"))) {
|
|
||||||
if (siemensConveyorDeviceDriver.getMove() == 1) {
|
|
||||||
JSONObject json = new JSONObject();
|
|
||||||
json.put("task_code", task_code);
|
|
||||||
json.put("ext_task_id", ext_task_id);
|
|
||||||
json.put("message", "终点" + siemensConveyorDeviceDriver.getDevice_code() + "有货无法生成任务");
|
|
||||||
errArr.add(json);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (taskserver.querySameDeviceReadyTask(start_device_code, next_device_code, "0") > 1) {
|
|
||||||
JSONObject json = new JSONObject();
|
|
||||||
json.put("task_code", task_code);
|
|
||||||
json.put("ext_task_id", ext_task_id);
|
|
||||||
json.put("message", "已存在相同的起点:" + start_device_code + "终点:" + next_device_code + "未执行的输送任务");
|
|
||||||
errArr.add(json);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TaskDto taskDto = taskserver.findByCodeFromCache(task_code);
|
TaskDto taskDto = taskserver.findByCodeFromCache(task_code);
|
||||||
if (taskDto != null) {
|
if (taskDto != null) {
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
|||||||
}
|
}
|
||||||
|
|
||||||
//手动维护母卷和状态信息
|
//手动维护母卷和状态信息
|
||||||
if (ObjectUtil.isNotEmpty(pointStatus) && ObjectUtil.isNotEmpty(entity.getRemark()) && (pointStatus.equals(PointStatusEnum.WAIT_SLITTING.getCode())||pointStatus.equals(PointStatusEnum.WAIT_BIND.getCode()))){
|
if (ObjectUtil.isNotEmpty(pointStatus) && ObjectUtil.isNotEmpty(entity.getRemark()) && (pointStatus.equals(PointStatusEnum.WAIT_SLITTING.getCode())||pointStatus.equals(PointStatusEnum.WAIT_BIND.getCode())||pointStatus.equals(PointStatusEnum.WAIT_INSPACTION.getCode()))){
|
||||||
//查看是否有工单,如果没有新建一个,如果有则更新
|
//查看是否有工单,如果没有新建一个,如果有则更新
|
||||||
PdmBiRawfoilworkorder order = rawfoilworkorderService.getByContainerName(entity.getRemark());
|
PdmBiRawfoilworkorder order = rawfoilworkorderService.getByContainerName(entity.getRemark());
|
||||||
if (ObjectUtil.isNotEmpty(order)) {
|
if (ObjectUtil.isNotEmpty(order)) {
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ public enum PointStatusEnum {
|
|||||||
// 空载具/有货
|
// 空载具/有货
|
||||||
EMPTY_VEHICLE("2", "空载具/有货"),
|
EMPTY_VEHICLE("2", "空载具/有货"),
|
||||||
WAIT_SLITTING("4", "待分切"),
|
WAIT_SLITTING("4", "待分切"),
|
||||||
|
WAIT_INSPACTION("3", "待质检"),
|
||||||
WAIT_BIND("5", "待绑定");
|
WAIT_BIND("5", "待绑定");
|
||||||
|
|
||||||
private final String code;
|
private final String code;
|
||||||
|
|||||||
@@ -103,7 +103,8 @@ public class SlitterDownAGVTask extends AbstractTask {
|
|||||||
List<BstIvtCutpointivt> areaEmptyNotTaskPoint = bstIvtCutpointivtService.getAreaNotTaskPointByStatus("1",
|
List<BstIvtCutpointivt> areaEmptyNotTaskPoint = bstIvtCutpointivtService.getAreaNotTaskPointByStatus("1",
|
||||||
"1", "0", "1");
|
"1", "0", "1");
|
||||||
if (areaEmptyNotTaskPoint.size() == 0) {
|
if (areaEmptyNotTaskPoint.size() == 0) {
|
||||||
throw new BadRequestException("请求搬运失败,内包间没有可存放位置!");
|
throw new BadRequestException("请求搬运失败," +
|
||||||
|
"内包间没有可存放位置!");
|
||||||
}
|
}
|
||||||
BstIvtCutpointivt endPoint = null;
|
BstIvtCutpointivt endPoint = null;
|
||||||
JSONArray acsArray = new JSONArray();
|
JSONArray acsArray = new JSONArray();
|
||||||
@@ -150,7 +151,7 @@ public class SlitterDownAGVTask extends AbstractTask {
|
|||||||
if (message.containsKey(bstIvtCutpointivt.getPoint_code())) {
|
if (message.containsKey(bstIvtCutpointivt.getPoint_code())) {
|
||||||
//起点和终点轴类型不相等,或者终点轴类型与实际光电不相等都不满足条件
|
//起点和终点轴类型不相等,或者终点轴类型与实际光电不相等都不满足条件
|
||||||
if (!bstIvtCutpointivt.getPlan().equals(message.get(bstIvtCutpointivt.getPoint_code()))){
|
if (!bstIvtCutpointivt.getPlan().equals(message.get(bstIvtCutpointivt.getPoint_code()))){
|
||||||
throw new BadRequestException("请求搬运失败,缓存架气涨轴类型与实际光电检测类型不匹配!");
|
throw new BadRequestException("请求搬运失败,缓存架气涨轴类型与实际光电检测类型不匹配,请人工纠正缓存架!");
|
||||||
}
|
}
|
||||||
if (!stIvtCutpointivt.getPlan().equals(bstIvtCutpointivt.getPlan())) {
|
if (!stIvtCutpointivt.getPlan().equals(bstIvtCutpointivt.getPlan())) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user