add: 烘箱对接位
This commit is contained in:
@@ -63,40 +63,14 @@ public class HongXiangStationDeviceDriver extends AbstractOpcDeviceDriver implem
|
||||
public int move = 0;
|
||||
public int action = 0;
|
||||
public int error = 0;
|
||||
public int door = 0;
|
||||
public int temperature = 0;
|
||||
public int countdown = 0;
|
||||
public int finish = 0;
|
||||
public int task = 0;
|
||||
public int error1 = 0;
|
||||
public int material = 0;
|
||||
public int consumption = 0;
|
||||
public int voltageA = 0;
|
||||
public int voltageB = 0;
|
||||
public int voltageC = 0;
|
||||
public int currentA = 0;
|
||||
public int currentB = 0;
|
||||
public int currentC = 0;
|
||||
public String task = null;
|
||||
|
||||
public int last_heartbeat = 0;
|
||||
public int last_mode = 0;
|
||||
public int last_move = 0;
|
||||
public int last_action = 0;
|
||||
public int last_error = 0;
|
||||
public int last_door = 0;
|
||||
public int last_temperature = 0;
|
||||
public int last_countdown = 0;
|
||||
public int last_finish = 0;
|
||||
public int last_task = 0;
|
||||
public int last_error1 = 0;
|
||||
public int last_material = 0;
|
||||
public int last_consumption = 0;
|
||||
public int last_voltageA = 0;
|
||||
public int last_voltageB = 0;
|
||||
public int last_voltageC = 0;
|
||||
public int last_currentA = 0;
|
||||
public int last_currentB = 0;
|
||||
public int last_currentC = 0;
|
||||
public String last_task = null;
|
||||
|
||||
Boolean isonline = true;
|
||||
|
||||
@@ -122,23 +96,17 @@ public class HongXiangStationDeviceDriver extends AbstractOpcDeviceDriver implem
|
||||
@Override
|
||||
public void execute() {
|
||||
String message = null;
|
||||
|
||||
device_code = this.getDeviceCode();
|
||||
heartbeat = itemProtocol.getItem_heartbeat();
|
||||
mode = itemProtocol.getItem_mode();
|
||||
move = itemProtocol.getItem_move();
|
||||
task = itemProtocol.getItem_task();
|
||||
error = itemProtocol.getItem_error();
|
||||
action = itemProtocol.getItem_action();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public synchronized boolean instruction_apply(String container_code) throws Exception {
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
return false;
|
||||
} else {
|
||||
this.instruction_apply_time = date;
|
||||
requireSucess = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
protected void thingToNothing() {
|
||||
this.setRequireSucess(false);
|
||||
@@ -147,8 +115,8 @@ public class HongXiangStationDeviceDriver extends AbstractOpcDeviceDriver implem
|
||||
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;
|
||||
//String opcservcerid = this.getDevice().getOpc_server_id();
|
||||
//Server server = ReadUtil.getServer(opcservcerid);
|
||||
// String opcservcerid = this.getDevice().getOpc_server_id();
|
||||
// Server server = ReadUtil.getServer(opcservcerid);
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
itemMap.put(to_command, command);
|
||||
this.control(itemMap);
|
||||
@@ -177,12 +145,9 @@ public class HongXiangStationDeviceDriver extends AbstractOpcDeviceDriver implem
|
||||
|
||||
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);
|
||||
// itemMap.put(to_param, Integer.parseInt(value));
|
||||
this.control(itemMap);
|
||||
}
|
||||
|
||||
@@ -190,12 +155,9 @@ public class HongXiangStationDeviceDriver extends AbstractOpcDeviceDriver implem
|
||||
@Override
|
||||
public JSONObject getDeviceStatusName() {
|
||||
JSONObject jo = new JSONObject();
|
||||
String mode = "";
|
||||
String action = "";
|
||||
String move = "";
|
||||
jo.put("device_name", this.getDevice().getDevice_name());
|
||||
jo.put("mode", "联机");
|
||||
jo.put("action", action);
|
||||
jo.put("mode", mode ==2 ? "待机": "脱机");
|
||||
jo.put("action", action == 1 ? "允许取放": "不允许取放");
|
||||
jo.put("isOnline", true);
|
||||
jo.put("error", this.getError());
|
||||
jo.put("isError", this.getIserror());
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.acs.device_driver.two_conveyor.hongxiang_conveyor;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||
@@ -11,10 +12,24 @@ 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_task = "task";
|
||||
|
||||
public static String item_to_command = "to_command";
|
||||
|
||||
public static String item_target = "target";
|
||||
|
||||
public static String item_to_task = "task";
|
||||
|
||||
private HongXiangStationDeviceDriver driver;
|
||||
|
||||
public ItemProtocol(HongXiangStationDeviceDriver driver) {
|
||||
@@ -22,11 +37,42 @@ public class ItemProtocol {
|
||||
}
|
||||
|
||||
|
||||
public int getItem_heartbeat() {
|
||||
return this.getOpcIntegerValue(item_heartbeat);
|
||||
}
|
||||
|
||||
public int getItem_mode() {
|
||||
return this.getOpcIntegerValue(item_mode);
|
||||
}
|
||||
|
||||
public int getItem_move() {
|
||||
return this.getOpcIntegerValue(item_move);
|
||||
}
|
||||
|
||||
public int getItem_error() {
|
||||
return this.getOpcIntegerValue(item_error);
|
||||
}
|
||||
|
||||
public String getItem_task() {
|
||||
return this.getOpcStringValue(item_task);
|
||||
}
|
||||
|
||||
public int getItem_action() {
|
||||
return this.getOpcIntegerValue(item_action);
|
||||
}
|
||||
|
||||
;
|
||||
public int getItem_to_command() {
|
||||
return this.getOpcIntegerValue(item_to_command);
|
||||
}
|
||||
|
||||
public int getItem_target() {
|
||||
return this.getOpcIntegerValue(item_target);
|
||||
}
|
||||
|
||||
public String getItem_to_task() {
|
||||
return this.getOpcStringValue(item_to_task);
|
||||
}
|
||||
|
||||
|
||||
Boolean isonline;
|
||||
|
||||
@@ -42,17 +88,34 @@ public class ItemProtocol {
|
||||
|
||||
}
|
||||
|
||||
public String getOpcStringValue(String protocol) {
|
||||
String stringValue = this.driver.getStringValue(protocol);
|
||||
if (StrUtil.isEmpty(stringValue)) {
|
||||
setIsonline(false);
|
||||
} else {
|
||||
setIsonline(true);
|
||||
return stringValue;
|
||||
}
|
||||
return "0";
|
||||
|
||||
}
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
|
||||
list.add(new ItemDto(item_action, "动作信号", "450"));
|
||||
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB100.10"));
|
||||
list.add(new ItemDto(item_mode, "模式", "DB100.12"));
|
||||
list.add(new ItemDto(item_move, "光电信号", "DB100.13"));
|
||||
list.add(new ItemDto(item_error, "error", "DB100.14"));
|
||||
list.add(new ItemDto(item_task, "任务号", "DB100.15"));
|
||||
list.add(new ItemDto(item_action, "取放信号", "DB100.11 "));
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ItemDto> getWriteableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_to_command, "下发命令", "226"));
|
||||
list.add(new ItemDto(item_to_command, "下发命令", "DB101.11"));
|
||||
list.add(new ItemDto(item_target, "下发目标站", "DB101.12"));
|
||||
list.add(new ItemDto(item_to_task, "下发任务号", "DB101.13"));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -348,17 +348,9 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
String next_device_code = instruction.getNext_device_code();
|
||||
Device nextdevice = deviceAppService.findDeviceByCode(next_device_code);
|
||||
Device startdevice = deviceAppService.findDeviceByCode(start_device_code);
|
||||
//PhotoelectricInspectionSiteDeviceDriver photoelectricInspectionSiteDeviceDriver;
|
||||
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
|
||||
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
|
||||
OvenInspectSiteDeviceDriver ovenInspectSiteDeviceDriver;
|
||||
// if (startdevice.getDeviceDriver() instanceof PhotoelectricInspectionSiteDeviceDriver) {
|
||||
// photoelectricInspectionSiteDeviceDriver = (PhotoelectricInspectionSiteDeviceDriver) startdevice.getDeviceDriver();
|
||||
// if (photoelectricInspectionSiteDeviceDriver.getMove() != 1) {
|
||||
// notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱对接位:" + photoelectricInspectionSiteDeviceDriver.getDevice_code() + "无货,无法下发指令!指令号:" + instruction.getInstruction_code();
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
if(startdevice.getDeviceDriver() instanceof OvenInspectSiteDeviceDriver && nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
|
||||
ovenInspectSiteDeviceDriver = (OvenInspectSiteDeviceDriver) startdevice.getDeviceDriver();
|
||||
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver();
|
||||
@@ -485,13 +477,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
|
||||
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
|
||||
OvenInspectSiteDeviceDriver ovenInspectSiteDeviceDriver;
|
||||
// if (startdevice.getDeviceDriver() instanceof PhotoelectricInspectionSiteDeviceDriver) {
|
||||
// photoelectricInspectionSiteDeviceDriver = (PhotoelectricInspectionSiteDeviceDriver) startdevice.getDeviceDriver();
|
||||
// if (photoelectricInspectionSiteDeviceDriver.getMove() != 1) {
|
||||
// notCreateInstMessage = "就绪任务未创建指令原因->取货位-烘箱对接位:" + photoelectricInspectionSiteDeviceDriver.getDevice_code() + "光电无货,无法生成指令!";
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
if(startdevice.getDeviceDriver() instanceof OvenInspectSiteDeviceDriver && nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
|
||||
ovenInspectSiteDeviceDriver = (OvenInspectSiteDeviceDriver) startdevice.getDeviceDriver();
|
||||
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver();
|
||||
@@ -544,13 +529,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// if (nextdevice.getDeviceDriver() instanceof PhotoelectricInspectionSiteDeviceDriver) {
|
||||
// photoelectricInspectionSiteDeviceDriver = (PhotoelectricInspectionSiteDeviceDriver) nextdevice.getDeviceDriver();
|
||||
// if (photoelectricInspectionSiteDeviceDriver.getMove() != 0) {
|
||||
// notCreateInstMessage = "就绪任务未创建指令原因->放货位-烘箱对接位:" + photoelectricInspectionSiteDeviceDriver.getDevice_code() + "光电有货,无法生成指令!";
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver();
|
||||
if (standardInspectSiteDeviceDriver.getMove() != 0) {
|
||||
@@ -699,7 +677,12 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
return flag;
|
||||
}
|
||||
|
||||
//判断取货位或放货位为烘箱设备时关联的同一列烘箱设备是否有开门
|
||||
/**
|
||||
* 判断取货位或放货位为烘箱设备时关联的同一列烘箱设备是否有开门
|
||||
* @param start_device_code
|
||||
* @param next_device_code
|
||||
* @return
|
||||
*/
|
||||
public boolean judgeCloseDoor(String start_device_code, String next_device_code) {
|
||||
Boolean isClose = false;
|
||||
try {
|
||||
@@ -774,7 +757,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
this.instruction_update_time = date;
|
||||
//更改任务状态
|
||||
if (task > 0) {
|
||||
//inst_message
|
||||
Instruction inst1 = checkInst();
|
||||
if (inst1 != null) {
|
||||
if (StrUtil.equals(inst1.getInstruction_status(), "0")) {
|
||||
@@ -794,7 +776,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
|
||||
if (device.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
||||
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) device.getDeviceDriver();
|
||||
//hongXiangConveyorDeviceDriver.writing("to_open_door", "1");
|
||||
int mode = hongXiangConveyorDeviceDriver.getMode();
|
||||
int door = hongXiangConveyorDeviceDriver.getDoor();
|
||||
int action = hongXiangConveyorDeviceDriver.getAction();
|
||||
@@ -804,8 +785,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
if (this.getNow_steps_type() == 2) {
|
||||
this.writing("to_command", "2");
|
||||
this.setNow_steps_type(3);
|
||||
} else {
|
||||
//logServer.deviceExecuteLog(this.device_code, "", "", "未反馈电气信号原因:当前步骤不为下发电气信号(now_steps_type!=2)");
|
||||
}
|
||||
} else {
|
||||
if (this.getNow_steps_type() == 2) {
|
||||
@@ -831,8 +810,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
if (this.getNow_steps_type() == 2) {
|
||||
this.writing("to_command", "2");
|
||||
this.setNow_steps_type(3);
|
||||
} else {
|
||||
//logServer.deviceExecuteLog(this.device_code, "", "", "未反馈电气信号原因:当前步骤不为下发电气信号(now_steps_type!=2)\")");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -868,8 +845,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
if (this.getNow_steps_type() == 3) {
|
||||
this.writing("to_command", "3");
|
||||
this.setNow_steps_type(4);
|
||||
} else {
|
||||
//logServer.deviceExecuteLog(this.device_code, "", "", "未反馈电气信号原因:当前步骤不为允许取货(now_steps_type!=3)");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -899,7 +874,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
|
||||
if (nextDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
||||
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextDevice.getDeviceDriver();
|
||||
//hongXiangConveyorDeviceDriver.writing("to_open_door", "1");
|
||||
int mode = hongXiangConveyorDeviceDriver.getMode();
|
||||
int door = hongXiangConveyorDeviceDriver.getDoor();
|
||||
int action = hongXiangConveyorDeviceDriver.getAction();
|
||||
@@ -911,7 +885,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
this.setNow_steps_type(5);
|
||||
} else {
|
||||
feedMessage = "未反馈电气信号原因:当前步骤不为允许放货(now_steps_type!=4)";
|
||||
//logServer.deviceExecuteLog(this.device_code, "", "", "未反馈电气信号原因:当前步骤不为允许放货(now_steps_type!=4)");
|
||||
}
|
||||
} else {
|
||||
if (this.getNow_steps_type() == 4) {
|
||||
@@ -937,10 +910,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
if (this.getNow_steps_type() == 4) {
|
||||
this.writing("to_command", "4");
|
||||
this.setNow_steps_type(5);
|
||||
} else {
|
||||
//logServer.deviceExecuteLog(this.device_code, "", "", "未反馈电气信号原因:当前步骤不为允许放货(now_steps_type!=4)");
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
if (this.getNow_steps_type() == 4) {
|
||||
@@ -965,20 +935,12 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
Instruction inst2 = checkInst();
|
||||
if (inst2 != null) {
|
||||
if (StrUtil.equals(inst2.getInstruction_status(), "1")) {
|
||||
|
||||
TaskDto taskDto = taskserver.findByCode(inst2.getTask_code());
|
||||
|
||||
String next_device_code = inst2.getNext_device_code();
|
||||
//String start_device_code = taskDto.getStart_device_code();
|
||||
//Device startDevice = deviceAppService.findDeviceByCode(start_device_code);
|
||||
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
|
||||
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
|
||||
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
|
||||
LampThreecolorDeviceDriver lampThreecolorDeviceDriver;
|
||||
// if (startDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
||||
// hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startDevice.getDeviceDriver();
|
||||
// hongXiangConveyorDeviceDriver.writing("to_close_door", "1");
|
||||
// }
|
||||
if (nextDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
||||
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextDevice.getDeviceDriver();
|
||||
hongXiangConveyorDeviceDriver.writing("to_close_door", "1");
|
||||
@@ -994,8 +956,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
|
||||
if (nextDevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextDevice.getDeviceDriver();
|
||||
// hongXiangConveyorDeviceDriver.writing("to_close_door", "1");
|
||||
|
||||
if (!StrUtil.startWith(taskDto.getTask_code(), "-")) {
|
||||
if (ObjectUtil.isNotEmpty(nextDevice.getExtraValue().get("link_three_lamp"))) {
|
||||
String lamp = nextDevice.getExtraValue().get("link_three_lamp").toString();
|
||||
|
||||
Reference in New Issue
Block a user