add:电器光电添加、任务校验

This commit is contained in:
ls
2025-05-23 14:03:08 +08:00
parent ede9c8a903
commit 299164fc4a
9 changed files with 103 additions and 142 deletions

View File

@@ -281,7 +281,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
try {
standardInspectSiteDeviceDriver.writing(1);
} catch (Exception e) {
e.printStackTrace();
}
@@ -688,7 +688,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
try {
standardInspectSiteDeviceDriver.writing(0);
} catch (Exception e) {
e.printStackTrace();
}
@@ -924,7 +923,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
try {
standardInspectSiteDeviceDriver.writing(1);
} catch (Exception e) {
e.printStackTrace();
}
@@ -1448,7 +1446,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
try {
standardInspectSiteDeviceDriver.writing(1);
} catch (Exception e) {
e.printStackTrace();
}
@@ -1707,7 +1704,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
}
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
standardInspectSiteDeviceDriver.writing(1);
if ((standardInspectSiteDeviceDriver.getMove() == 0 && standardInspectSiteDeviceDriver.getAction() == 1 && standardInspectSiteDeviceDriver.getError() == 0)) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
@@ -2052,7 +2048,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
}
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
standardInspectSiteDeviceDriver.writing(0);
if ((standardInspectSiteDeviceDriver.getMove() == 1)) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()

View File

@@ -11,17 +11,9 @@ import java.util.List;
@Data
public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
public static String item_mode = "mode";
public static String item_move = "move";
public static String item_action = "action";
public static String item_error = "error";
public static String item_to_command = "to_command";
public static String item_to_target = "to_target";
public static String item_to_task = "to_task";
public static String item_weight = "weight";
/*public static String item_material_type = "material_type";
public static String item_barcode = "barcode";*/
private StandardInspectSiteDeviceDriver driver;
@@ -29,25 +21,13 @@ public class ItemProtocol {
this.driver = driver;
}
public int getHeartbeat() {
return this.getOpcIntegerValue(item_heartbeat);
}
public int getMode() {
return this.getOpcIntegerValue(item_mode);
}
public int getMove() {
return this.getOpcIntegerValue(item_move);
}
public int getAction() {
return this.getOpcIntegerValue(item_action);
}
public int getError() {
return this.getOpcIntegerValue(item_error);
}
/*public int getMaterialType() {
@@ -58,17 +38,7 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_barcode);
}*/
public int getToCommand() {
return this.getOpcIntegerValue(item_to_command);
}
public int getToTarget() {
return this.getOpcIntegerValue(item_to_target);
}
public int getToTask() {
return this.getOpcIntegerValue(item_to_task);
}
/**
*是否有货
@@ -94,19 +64,14 @@ public class ItemProtocol {
public static List<ItemDto> getReadableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_heartbeat, "心跳", "DB600.B0"));
list.add(new ItemDto(item_mode, "工作状态", "DB600.B2", Boolean.valueOf(true)));
list.add(new ItemDto(item_move, "光电开关信号", "DB600.B3"));
list.add(new ItemDto(item_action, "取放信号", "DB600.B4"));
/*list.add(new ItemDto(item_material_type, "物料类型", "DB600.D6"));*/
list.add(new ItemDto(item_error, "报警信号", "DB600.B7"));
/*list.add(new ItemDto(item_barcode, "条码", "DB600.D8"));*/
return list;
}
public static List<ItemDto> getWriteableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_to_command, "作业命令", "DB601.W2", Boolean.valueOf(true)));
return list;
}

View File

@@ -162,7 +162,8 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
*/
int flag;
String devicecode;
String device_code;
@Override
public Device getDevice() {
@@ -174,24 +175,12 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
public void execute() {
String message = null;
try {
devicecode = this.getDeviceCode();
mode = this.itemProtocol.getMode();
error = this.itemProtocol.getError();
move = this.itemProtocol.getMove();
hasGoods = this.itemProtocol.getMove();
action = this.itemProtocol.getAction();
device_code = this.getDeviceCode();
/*material_type = this.itemProtocol.getMaterialType();
barcode = this.itemProtocol.getBarcode();*/
if (mode != last_mode) {
this.setRequireSucess(false);
if (mode == 2) {
this.writing(0);
}
}
if (move != last_move) {
}
if (error != last_error) {
}
} catch (Exception var17) {
@@ -252,18 +241,6 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
break;
}
switch (flag) {
//取货完成
case 1:
writing(2);
return;
//放货完成
case 2:
writing(3);
return;
default:
break;
}
}
last_mode = mode;
@@ -305,75 +282,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
return true;
}
protected void executing(Instruction instruction) {
this.executing(1, instruction, "");
}
public void executing(int command, Instruction instruction, String appendMessage) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_command;
String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_target;
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_task;
if (appendMessage == null) {
appendMessage = "";
}
if (instruction != null) {
instruction_num = Integer.parseInt(instruction.getInstruction_code());
}
//String opcservcerid = this.getDevice().getOpc_server_id();
//Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, 1);
itemMap.put(to_task, instruction_num);
this.control(itemMap);
}
public void executing(Server server, Map<String, Object> itemMap) {
this.control(itemMap);
}
public void writing(int command) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_command;
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, command);
try {
this.checkcontrol(itemMap);
} catch (Exception e) {
e.printStackTrace();
}
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(devicecode)
.content("下发多个电气信号" + itemMap)
.build();
logDto.setLog_level(3);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
public void writing(int type, int command) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_command;
String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_target;
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_task;
//String opcservcerid = this.getDevice().getOpc_server_id();
//Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
if (type == 1) {
itemMap.put(to_command, command);
} else if (type == 2) {
itemMap.put(to_target, command);
} else if (type == 3) {
itemMap.put(to_task, command);
}
this.control(itemMap);
}
public boolean instruction_require(String container_code) {
return instruction_require(container_code, WcsConfig.task_container_type_default_desc);

View File

@@ -364,6 +364,42 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
}
}
if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver();
if ( standardInspectSiteDeviceDriver.getMove() == 1 ) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱缓存位:" + standardInspectSiteDeviceDriver.getDevice_code() + "无货,无法下发指令!指令号:" + instruction.getInstruction_code();
return false;
}
}
if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver();
if ( standardInspectSiteDeviceDriver.getMove() == 0) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱缓存位:" + standardInspectSiteDeviceDriver.getDevice_code() + "有货,无法下发指令!指令号:" + instruction.getInstruction_code();
return false;
}
}
if (startdevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) startdevice.getDeviceDriver();
if ( manipulatorAgvStationDeviceDriver.getMove() == 1 ) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱对接位:" + manipulatorAgvStationDeviceDriver.getDevice_code() + "无货,无法下发指令!指令号:" + instruction.getInstruction_code();
return false;
}
}
if (nextdevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) nextdevice.getDeviceDriver();
if ( manipulatorAgvStationDeviceDriver.getMove() == 0) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱对接位:" + manipulatorAgvStationDeviceDriver.getDevice_code() + "有货,无法下发指令!指令号:" + instruction.getInstruction_code();
return false;
}
}
Device startDevice = deviceAppService.findDeviceByCode(start_device_code);
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
@@ -428,7 +464,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
Device startdevice = deviceAppService.findDeviceByCode(task.getStart_device_code());
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
OvenInspectSiteDeviceDriver ovenInspectSiteDeviceDriver;
ManipulatorAgvStationDeviceDriver manipulatorAgvStationDeviceDriver;
if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver();
@@ -447,6 +483,43 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
}
if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver();
if ( standardInspectSiteDeviceDriver.getMove() == 1 ) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱缓存位:" + standardInspectSiteDeviceDriver.getDevice_code() + "无货,无法下发指令!指令号:" ;
return false;
}
}
if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver();
if ( standardInspectSiteDeviceDriver.getMove() == 0) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱缓存位:" + standardInspectSiteDeviceDriver.getDevice_code() + "有货,无法下发指令!" ;
return false;
}
}
if (startdevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) startdevice.getDeviceDriver();
if ( manipulatorAgvStationDeviceDriver.getMove() == 1 ) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱对接位:" + manipulatorAgvStationDeviceDriver.getDevice_code() + "无货,无法下发指令!" ;
return false;
}
}
if (nextdevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) nextdevice.getDeviceDriver();
if ( manipulatorAgvStationDeviceDriver.getMove() == 0) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱对接位:" + manipulatorAgvStationDeviceDriver.getDevice_code() + "有货,无法下发指令!" ;
return false;
}
}
String taskid = task.getTask_id();
String taskcode = task.getTask_code();
String vehiclecode = task.getVehicle_code();

View File

@@ -181,10 +181,11 @@ public class AutoCreateInst {
//生箔四个点任务是生箔agv两个点是普通任务
if (StrUtil.isNotEmpty(instdto.getStart_device_code2())) {
instdto.setAgv_inst_type(CommonFinalParam.ONE);
instdto.setCarno("1");
}else {
instdto.setAgv_inst_type("2");
}
instdto.setCarno("1");
} else if (StrUtil.equals(task_type, "3")) {
instdto.setAgv_inst_type("2");
}else if (StrUtil.equals(task_type, "2")) {