更新
This commit is contained in:
@@ -20,7 +20,7 @@ public enum DriverTypeEnum {
|
||||
|
||||
SPECIAL_SITE(6, "standard_special_inspect_site", "专机设备交互站点", "conveyor"),
|
||||
|
||||
MANIPULATOR_SITE(7, "standard_manipulator_inspect_site", "区域管制设备交互站点", "conveyor"),
|
||||
MANIPULATOR_SITE(7, "standard_manipulator_inspect_site", "洛耐院-接料位", "conveyor"),
|
||||
|
||||
NON_LINE_MANIPULATOR_SITE(8, "non_line_manipulator_inspect_site", "区域管制设备交互站点-无PLC", "conveyor"),
|
||||
|
||||
|
||||
@@ -12,14 +12,8 @@ import java.util.List;
|
||||
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_ioaction = "ioaction";
|
||||
public static String item_error = "error";
|
||||
public static String item_task = "task";
|
||||
public static String item_to_command = "to_command";
|
||||
public static String item_to_target = "to_target";
|
||||
public static String item_to_task = "to_task";
|
||||
|
||||
|
||||
Boolean isonline;
|
||||
@@ -38,38 +32,14 @@ public class ItemProtocol {
|
||||
return this.getOpcIntegerValue(item_mode);
|
||||
}
|
||||
|
||||
public int getMove() {
|
||||
return this.getOpcIntegerValue(item_move);
|
||||
}
|
||||
|
||||
public int getAction() {
|
||||
return this.getOpcIntegerValue(item_action);
|
||||
}
|
||||
|
||||
public int getIoAction() {
|
||||
return this.getOpcIntegerValue(item_ioaction);
|
||||
}
|
||||
|
||||
public int getError() {
|
||||
return this.getOpcIntegerValue(item_error);
|
||||
}
|
||||
|
||||
public int getTask() {
|
||||
return this.getOpcIntegerValue(item_task);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
//是否有货
|
||||
public int hasGoods(int move) {
|
||||
return move;
|
||||
@@ -92,20 +62,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_ioaction, "进出信号", "DB600.B5"));
|
||||
list.add(new ItemDto(item_error, "报警信号", "DB600.B7"));
|
||||
list.add(new ItemDto(item_task, "任务号", "DB600.D10"));
|
||||
list.add(new ItemDto(item_mode, "工作状态", "DB600.B1", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_action, "取放信号", "DB600.B2"));
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ItemDto> getWriteableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_to_command, "作业命令", "DB601.W2", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_to_target, "目标站", "DB601.W4"));
|
||||
list.add(new ItemDto(item_to_task, "任务号", "DB601.D8"));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,12 +24,12 @@ public class StandardManipulatorInspectSiteDefination implements OpcDeviceDriver
|
||||
|
||||
@Override
|
||||
public String getDriverName() {
|
||||
return "标准版-区域管制设备-检测站点";
|
||||
return "标准版-洛耐院下料位";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverDescription() {
|
||||
return "标准版-区域管制设备-检测站点";
|
||||
return "标准版-洛耐院下料位";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -52,19 +52,7 @@ public class StandardManipulatorInspectSiteDefination implements OpcDeviceDriver
|
||||
|
||||
@Override
|
||||
public List<ItemDto> getReadableItemDtos() {
|
||||
return getReadableItemDtos2();
|
||||
}
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos2() {
|
||||
List<ItemDto> list = new ArrayList();
|
||||
list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB600.B0"));
|
||||
list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB600.B2", true));
|
||||
list.add(new ItemDto(ItemProtocol.item_move, "光电开关信号", "DB600.B3"));
|
||||
list.add(new ItemDto(ItemProtocol.item_action, "取放信号", "DB600.B4"));
|
||||
list.add(new ItemDto(ItemProtocol.item_ioaction, "进出信号", "DB600.B5"));
|
||||
list.add(new ItemDto(ItemProtocol.item_error, "报警信号", "DB600.B7"));
|
||||
list.add(new ItemDto(ItemProtocol.item_task, "任务号", "DB600.D10"));
|
||||
return list;
|
||||
return ItemProtocol.getReadableItemDtos();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -129,11 +129,6 @@ public class StandardManipulatorInspectSiteDeviceDriver extends AbstractOpcDevic
|
||||
String device_code = this.getDeviceCode();
|
||||
|
||||
mode = this.itemProtocol.getMode();
|
||||
error = this.itemProtocol.getError();
|
||||
move = this.itemProtocol.getMove();
|
||||
task = this.itemProtocol.getTask();
|
||||
hasGoods = this.itemProtocol.getMove();
|
||||
io_action = this.itemProtocol.getIoAction();
|
||||
actoin = this.itemProtocol.getAction();
|
||||
|
||||
if (mode != last_mode) {
|
||||
@@ -141,17 +136,6 @@ public class StandardManipulatorInspectSiteDeviceDriver extends AbstractOpcDevic
|
||||
this.execute_log.setResource(this.devicecode, this.device.getDevice_name());
|
||||
this.execute_log.log("设备:" + device_code + ",last_mode -> mode:" + last_mode + "->" + mode);
|
||||
}
|
||||
if (move != last_move) {
|
||||
this.execute_log.setResource(this.devicecode, this.device.getDevice_name());
|
||||
this.execute_log.log("设备:" + device_code + ",last_move -> move:" + last_mode + "->" + move);
|
||||
if (move == 0) {
|
||||
thingToNothing();
|
||||
}
|
||||
}
|
||||
if (error != last_error) {
|
||||
this.execute_log.setResource(this.devicecode, this.device.getDevice_name());
|
||||
this.execute_log.log("设备:" + device_code + ",last_error -> error:" + last_error + "->" + error);
|
||||
}
|
||||
|
||||
} catch (Exception var17) {
|
||||
return;
|
||||
@@ -447,10 +431,6 @@ public class StandardManipulatorInspectSiteDeviceDriver extends AbstractOpcDevic
|
||||
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 = "";
|
||||
}
|
||||
@@ -461,7 +441,6 @@ public class StandardManipulatorInspectSiteDeviceDriver extends AbstractOpcDevic
|
||||
Server server = ReadUtil.getServer(opcservcerid);
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
itemMap.put(to_command, 1);
|
||||
itemMap.put(to_task, instruction_num);
|
||||
ReadUtil.write(itemMap, server);
|
||||
|
||||
}
|
||||
@@ -521,20 +500,11 @@ public class StandardManipulatorInspectSiteDeviceDriver extends AbstractOpcDevic
|
||||
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);
|
||||
}
|
||||
ReadUtil.write(itemMap, server);
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ 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.device_driver.standard_emptypallet_site.StandardEmptyPalletSiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.standard_inspect_site.StandardInspectSiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.standard_manipulator_inspect_site.StandardManipulatorInspectSiteDeviceDriver;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
import org.nl.acs.opc.Device;
|
||||
@@ -180,17 +182,32 @@ public class StandardRGVDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
|
||||
}
|
||||
|
||||
switch (flag) {
|
||||
//取货完成
|
||||
case 1:
|
||||
writing(2);
|
||||
return;
|
||||
//放货完成
|
||||
case 2:
|
||||
writing(3);
|
||||
return;
|
||||
|
||||
if (task > 0) {
|
||||
//inst_message
|
||||
inst = instructionService.findByCodeFromCache(String.valueOf(task));
|
||||
if (inst != null) {
|
||||
if (StrUtil.equals(inst.getInstruction_status(), "0")) {
|
||||
inst.setInstruction_status("1");
|
||||
instructionService.update(inst);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( action == 4 && move == 0 && task > 0) {
|
||||
//inst_message
|
||||
inst = instructionService.findByCodeFromCache(String.valueOf(task));
|
||||
if (inst != null) {
|
||||
if (StrUtil.equals(inst.getInstruction_status(), "1")) {
|
||||
finish_instruction(inst);
|
||||
writing("to_command","0");
|
||||
writing("to_onset","0");
|
||||
writing("to_target","0");
|
||||
writing("to_task","0");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
last_mode = mode;
|
||||
last_error = error;
|
||||
last_move = move;
|
||||
@@ -224,6 +241,11 @@ public class StandardRGVDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
public void set_last_container_type_desc(String type) {
|
||||
}
|
||||
|
||||
public synchronized boolean finish_instruction(Instruction inst) throws Exception {
|
||||
instructionService.finish(inst);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean exe_business() {
|
||||
return true;
|
||||
}
|
||||
@@ -306,6 +328,18 @@ public class StandardRGVDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
this.execute_log.log("设备:{},下发作业命令:{},起始站{},目标站:{},任务号:{}", device_code, to_command,to_onset ,to_target, to_task);
|
||||
}
|
||||
|
||||
public void writing(String param, String value) {
|
||||
|
||||
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + param;
|
||||
String opcservcerid = this.getDevice().getOpc_server_id();
|
||||
Server server = ReadUtil.getServer(opcservcerid);
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
itemMap.put(to_param, value);
|
||||
|
||||
ReadUtil.write(itemMap, server);
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求指令
|
||||
*/
|
||||
@@ -334,8 +368,17 @@ public class StandardRGVDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
String priority = task.getPriority();
|
||||
String start_point_code = task.getStart_point_code();
|
||||
String start_device_code = task.getStart_device_code();
|
||||
String route_plan_code = task.getRoute_plan_code();
|
||||
|
||||
Device startdevice = appService.findDeviceByCode(start_device_code);
|
||||
|
||||
StandardManipulatorInspectSiteDeviceDriver standardManipulatorInspectSiteDeviceDriver;
|
||||
if (startdevice.getDeviceDriver() instanceof StandardManipulatorInspectSiteDeviceDriver) {
|
||||
standardManipulatorInspectSiteDeviceDriver = (StandardManipulatorInspectSiteDeviceDriver) startdevice.getDeviceDriver();
|
||||
if(standardManipulatorInspectSiteDeviceDriver.getMode() !=2 && standardManipulatorInspectSiteDeviceDriver.getActoin() !=0){
|
||||
break;
|
||||
}
|
||||
}
|
||||
String route_plan_code = task.getRoute_plan_code();
|
||||
Instruction instdto = new Instruction();
|
||||
instdto.setInstruction_id(IdUtil.simpleUUID());
|
||||
instdto.setRoute_plan_code(route_plan_code);
|
||||
|
||||
Reference in New Issue
Block a user