驱动更新
This commit is contained in:
@@ -21,8 +21,6 @@ public class HailiangFoldingDiscSmartDevice extends AbstractDriverService {
|
||||
mode = "脱机";
|
||||
} else if (hailiangFoldingDiscSmartDeviceDriver.getMode() == 2) {
|
||||
mode = "待机";
|
||||
} else if (hailiangFoldingDiscSmartDeviceDriver.getMode() == 3) {
|
||||
mode = "运行中";
|
||||
}
|
||||
if (hailiangFoldingDiscSmartDeviceDriver.getMove() == 0) {
|
||||
move = "无货";
|
||||
@@ -32,6 +30,7 @@ public class HailiangFoldingDiscSmartDevice extends AbstractDriverService {
|
||||
jo.put("mode", mode);
|
||||
jo.put("move", move);
|
||||
jo.put("number", hailiangFoldingDiscSmartDeviceDriver.getNumber());
|
||||
jo.put("container_type", hailiangFoldingDiscSmartDeviceDriver.getContainer_type());
|
||||
jo.put("hasGoods", hailiangFoldingDiscSmartDeviceDriver.getHasGoods());
|
||||
jo.put("isOnline", hailiangFoldingDiscSmartDeviceDriver.getIsonline());
|
||||
jo.put("error", hailiangFoldingDiscSmartDeviceDriver.getError());
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
package org.nl.acs.common;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_paint_line.HailiangPaintLineDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_threeStation_smart.HailiangThreestationSmartDeviceDriver;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service("hailiang_paint_line")
|
||||
public class HailiangPaintLineDevice extends AbstractDriverService {
|
||||
|
||||
@Override
|
||||
public JSONObject getDeviceInfo(Device device) {
|
||||
HailiangPaintLineDeviceDriver hailiangPaintLineDeviceDriver = (HailiangPaintLineDeviceDriver) device.getDeviceDriver();
|
||||
JSONObject jo = super.getCommonDeviceInfo(hailiangPaintLineDeviceDriver);
|
||||
|
||||
String mode = "";
|
||||
String move = "";
|
||||
String action = "";
|
||||
if (hailiangPaintLineDeviceDriver.getMode() == 0) {
|
||||
mode = "脱机";
|
||||
} else if (hailiangPaintLineDeviceDriver.getMode() == 2) {
|
||||
mode = "待机";
|
||||
} else if (hailiangPaintLineDeviceDriver.getMode() == 3) {
|
||||
mode = "运行中";
|
||||
} else if (hailiangPaintLineDeviceDriver.getMode() == 5) {
|
||||
mode = "下料位申请空盘";
|
||||
} else if (hailiangPaintLineDeviceDriver.getMode() == 6) {
|
||||
mode = "下料位满拖申请";
|
||||
} else if (hailiangPaintLineDeviceDriver.getMode() == 7) {
|
||||
mode = "上料位满拖申请";
|
||||
} else if (hailiangPaintLineDeviceDriver.getMode() == 8) {
|
||||
mode = "上料位空托入库";
|
||||
} else if (hailiangPaintLineDeviceDriver.getMode() == 9) {
|
||||
mode = "强制满垛入库请求";
|
||||
}
|
||||
if (hailiangPaintLineDeviceDriver.getMove() == 0) {
|
||||
move = "无货";
|
||||
} else if (hailiangPaintLineDeviceDriver.getMove() == 1) {
|
||||
move = "有货";
|
||||
}
|
||||
if (hailiangPaintLineDeviceDriver.getAction() == 1) {
|
||||
action = "允许取货";
|
||||
} else if (hailiangPaintLineDeviceDriver.getAction() == 2) {
|
||||
action = "允许放货";
|
||||
} else if (hailiangPaintLineDeviceDriver.getAction() == 3) {
|
||||
action = "允许取放";
|
||||
}
|
||||
jo.put("mode", mode);
|
||||
jo.put("move", move);
|
||||
jo.put("action", action);
|
||||
jo.put("number", hailiangPaintLineDeviceDriver.getNumber());
|
||||
jo.put("hasGoods", hailiangPaintLineDeviceDriver.getHasGoods());
|
||||
jo.put("isOnline", hailiangPaintLineDeviceDriver.getIsonline());
|
||||
jo.put("error", hailiangPaintLineDeviceDriver.getError());
|
||||
jo.put("isError", hailiangPaintLineDeviceDriver.getIserror());
|
||||
jo.put("message", hailiangPaintLineDeviceDriver.getMessage());
|
||||
return jo;
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,8 @@ public class HailiangThreestationSmartDevice extends AbstractDriverService {
|
||||
mode = "待机";
|
||||
} else if (threestationSmartDeviceDriver.getMode() == 3) {
|
||||
mode = "运行中";
|
||||
} else if (threestationSmartDeviceDriver.getMode() == 4) {
|
||||
mode = "申请空盘";
|
||||
}
|
||||
if (threestationSmartDeviceDriver.getMove() == 0) {
|
||||
move = "无货";
|
||||
@@ -41,6 +43,8 @@ public class HailiangThreestationSmartDevice extends AbstractDriverService {
|
||||
jo.put("mode", mode);
|
||||
jo.put("move", move);
|
||||
jo.put("action", action);
|
||||
jo.put("number", threestationSmartDeviceDriver.getNumber());
|
||||
jo.put("container_type", threestationSmartDeviceDriver.getContainer_type());
|
||||
jo.put("hasGoods", threestationSmartDeviceDriver.getHasGoods());
|
||||
jo.put("isOnline", threestationSmartDeviceDriver.getIsonline());
|
||||
jo.put("error", threestationSmartDeviceDriver.getError());
|
||||
|
||||
@@ -69,7 +69,9 @@ public enum DriverTypeEnum {
|
||||
|
||||
HAILIANG_FOLDINGDISC_SMART(30, "hailiang_foldingDisc_smart", "海亮-叠盘位Smart200", "conveyor"),
|
||||
|
||||
HAILIANG_ELEVATOR_WIRING(31, "hailiang_elevator_wiring", "海亮-货梯对接线", "conveyor");
|
||||
HAILIANG_ELEVATOR_WIRING(31, "hailiang_elevator_wiring", "海亮-货梯对接线", "conveyor"),
|
||||
|
||||
HAILIANG_PAINT_LINE(32, "hailiang_paint_line", "海亮-油漆线", "conveyor");
|
||||
|
||||
//驱动索引
|
||||
private int index;
|
||||
|
||||
@@ -60,6 +60,7 @@ public class HailiangFoldingDiscSmartDefination implements OpcDeviceDriverDefina
|
||||
list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "VW2", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(ItemProtocol.item_move, "光电信号", "VW4"));
|
||||
list.add(new ItemDto(ItemProtocol.item_number, "数量", "VW6"));
|
||||
list.add(new ItemDto(ItemProtocol.item_container_type, "托盘类型", "VW8"));
|
||||
list.add(new ItemDto(ItemProtocol.item_error, "报警信号", "VW10"));
|
||||
list.add(new ItemDto(ItemProtocol.item_task, "任务号", "VD12"));
|
||||
return list;
|
||||
|
||||
@@ -42,10 +42,7 @@ public class HailiangFoldingDiscSmartDeviceDriver extends AbstractOpcDeviceDrive
|
||||
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
|
||||
@Autowired
|
||||
LogServer logServer = SpringContextHolder.getBean(LogServer.class);
|
||||
String container;
|
||||
String container_type_desc;
|
||||
String last_container_type_desc;
|
||||
String last_container;
|
||||
|
||||
//放货准备锁
|
||||
String putReadyLock = null;
|
||||
//有货标记
|
||||
@@ -56,11 +53,13 @@ public class HailiangFoldingDiscSmartDeviceDriver extends AbstractOpcDeviceDrive
|
||||
int move = 0;
|
||||
int task = 0;
|
||||
int number = 0;
|
||||
int container_type = 0;
|
||||
int last_mode = 0;
|
||||
int last_error = 0;
|
||||
int last_move = 0;
|
||||
int last_task = 0;
|
||||
int last_number = 0;
|
||||
int last_container_type = 0;
|
||||
Boolean isonline = true;
|
||||
int hasGoods = 0;
|
||||
String message = null;
|
||||
@@ -125,6 +124,7 @@ public class HailiangFoldingDiscSmartDeviceDriver extends AbstractOpcDeviceDrive
|
||||
move = this.itemProtocol.getMove();
|
||||
task = this.itemProtocol.getTask();
|
||||
hasGoods = this.itemProtocol.getMove();
|
||||
container_type = this.itemProtocol.getContainer_type();
|
||||
|
||||
if (mode != last_mode) {
|
||||
this.setRequireSucess(false);
|
||||
@@ -140,9 +140,13 @@ public class HailiangFoldingDiscSmartDeviceDriver extends AbstractOpcDeviceDrive
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号error:" + last_error + "->" + error);
|
||||
}
|
||||
if (number != last_number) {
|
||||
logServer.deviceLog(this.device_code,"action" ,String.valueOf(number));
|
||||
logServer.deviceLog(this.device_code,"number" ,String.valueOf(number));
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号number:" + last_number + "->" + number);
|
||||
}
|
||||
if (container_type != last_container_type) {
|
||||
logServer.deviceLog(this.device_code,"container_type" ,String.valueOf(container_type));
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号container_type:" + last_container_type + "->" + container_type);
|
||||
}
|
||||
|
||||
} catch (Exception var17) {
|
||||
return;
|
||||
@@ -195,6 +199,7 @@ public class HailiangFoldingDiscSmartDeviceDriver extends AbstractOpcDeviceDrive
|
||||
last_move = move;
|
||||
last_task = task;
|
||||
last_number = number;
|
||||
last_container_type = container_type;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ public class ItemProtocol {
|
||||
public static String item_mode = "mode";
|
||||
public static String item_move = "move";
|
||||
public static String item_number = "number";
|
||||
public static String item_container_type = "container_type";
|
||||
public static String item_error = "error";
|
||||
public static String item_task = "task";
|
||||
public static String item_to_command = "to_command";
|
||||
@@ -44,6 +45,10 @@ public class ItemProtocol {
|
||||
return this.getOpcIntegerValue(item_number);
|
||||
}
|
||||
|
||||
public int getContainer_type() {
|
||||
return this.getOpcIntegerValue(item_container_type);
|
||||
}
|
||||
|
||||
public int getError() {
|
||||
return this.getOpcIntegerValue(item_error);
|
||||
}
|
||||
@@ -90,6 +95,7 @@ public class ItemProtocol {
|
||||
list.add(new ItemDto(item_mode, "工作状态", "VW2", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_move, "光电信号", "VW4"));
|
||||
list.add(new ItemDto(item_number, "数量", "VW6"));
|
||||
list.add(new ItemDto(item_container_type, "托盘类型", "VW8"));
|
||||
list.add(new ItemDto(item_error, "报警信号", "VW10"));
|
||||
list.add(new ItemDto(item_task, "任务号", "VD12"));
|
||||
return list;
|
||||
@@ -97,9 +103,9 @@ public class ItemProtocol {
|
||||
|
||||
public static List<ItemDto> getWriteableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_to_command, "作业命令", "VW102", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_to_target, "目标站", "VW104"));
|
||||
list.add(new ItemDto(item_to_task, "任务号", "VD108"));
|
||||
list.add(new ItemDto(item_to_command, "作业命令", "VW52", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_to_target, "目标站", "VW54"));
|
||||
list.add(new ItemDto(item_to_task, "任务号", "VD58"));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
package org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_paint_line;
|
||||
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.opc.DeviceType;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 海亮-油漆线
|
||||
*/
|
||||
@Service
|
||||
public class HailiangPaintLineDefination implements OpcDeviceDriverDefination {
|
||||
@Override
|
||||
public String getDriverCode() {
|
||||
return "hailiang_paint_line";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverName() {
|
||||
return "海亮-油漆线";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverDescription() {
|
||||
return "海亮-油漆线";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceDriver getDriverInstance(Device device) {
|
||||
return (new HailiangPaintLineDeviceDriver()).setDevice(device).setDriverDefination(this);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends DeviceDriver> getDeviceDriverType() {
|
||||
return HailiangPaintLineDeviceDriver.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceType> getFitDeviceTypes() {
|
||||
List<DeviceType> types = new LinkedList();
|
||||
types.add(DeviceType.conveyor);
|
||||
return types;
|
||||
}
|
||||
|
||||
@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", Boolean.valueOf(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_error, "报警信号", "DB600.B6"));
|
||||
list.add(new ItemDto(ItemProtocol.item_number, "数量", "DB600.B7"));
|
||||
list.add(new ItemDto(ItemProtocol.item_task, "任务号", "DB600.D8"));
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemDto> getWriteableItemDtos() {
|
||||
return ItemProtocol.getWriteableItemDtos();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,257 @@
|
||||
package org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_paint_line;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
|
||||
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.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
import org.nl.acs.log.service.LogServer;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.utils.SpringContextHolder;
|
||||
import org.openscada.opc.lib.da.Server;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 海亮-油漆线
|
||||
*/
|
||||
@Slf4j
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
public class HailiangPaintLineDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
|
||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||
@Autowired
|
||||
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
|
||||
@Autowired
|
||||
DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl");
|
||||
@Autowired
|
||||
RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl");
|
||||
@Autowired
|
||||
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
|
||||
@Autowired
|
||||
LogServer logServer = SpringContextHolder.getBean(LogServer.class);
|
||||
|
||||
//放货准备锁
|
||||
String putReadyLock = null;
|
||||
//有货标记
|
||||
protected boolean has_goods_tag = false;
|
||||
|
||||
int mode = 0;
|
||||
int error = 0;
|
||||
int move = 0;
|
||||
int task = 0;
|
||||
int action = 0;
|
||||
int number = 0;
|
||||
int last_mode = 0;
|
||||
int last_error = 0;
|
||||
int last_move = 0;
|
||||
int last_task = 0;
|
||||
int last_action = 0;
|
||||
int last_number = 0;
|
||||
Boolean isonline = true;
|
||||
int hasGoods = 0;
|
||||
String message = null;
|
||||
Boolean iserror = false;
|
||||
|
||||
|
||||
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 material;
|
||||
//当前指令
|
||||
Instruction inst = null;
|
||||
//上次指令
|
||||
Instruction last_inst = null;
|
||||
|
||||
//触摸屏手动触发任务
|
||||
private Boolean is_has_task = false;
|
||||
|
||||
//申请搬运任务
|
||||
private Boolean apply_handling = false;
|
||||
//申请物料
|
||||
private Boolean apply_material = false;
|
||||
|
||||
//暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域
|
||||
int flag;
|
||||
|
||||
String device_code;
|
||||
|
||||
@Override
|
||||
public Device getDevice() {
|
||||
return this.device;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
String message = null;
|
||||
try {
|
||||
device_code = this.getDeviceCode();
|
||||
mode = this.itemProtocol.getMode();
|
||||
error = this.itemProtocol.getError();
|
||||
action = this.itemProtocol.getAction();
|
||||
move = this.itemProtocol.getMove();
|
||||
number = this.itemProtocol.getNumber();
|
||||
task = this.itemProtocol.getTask();
|
||||
hasGoods = this.itemProtocol.getMove();
|
||||
|
||||
if (mode != last_mode) {
|
||||
this.setRequireSucess(false);
|
||||
logServer.deviceLog(this.device_code,"mode" ,String.valueOf(mode));
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号mode:" + last_mode + "->" + mode);
|
||||
}
|
||||
if (move != last_move) {
|
||||
logServer.deviceLog(this.device_code,"move" ,String.valueOf(move));
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号move:" + last_move + "->" + move);
|
||||
}
|
||||
if (error != last_error) {
|
||||
logServer.deviceLog(this.device_code,"error" ,String.valueOf(error));
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号error:" + last_error + "->" + error);
|
||||
}
|
||||
if (action != last_action) {
|
||||
logServer.deviceLog(this.device_code,"action" ,String.valueOf(action));
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号action:" + last_action + "->" + action);
|
||||
}
|
||||
if (number != last_number) {
|
||||
logServer.deviceLog(this.device_code,"number" ,String.valueOf(number));
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号number:" + last_number + "->" + number);
|
||||
}
|
||||
|
||||
} catch (Exception var17) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.itemProtocol.getIsonline()) {
|
||||
this.setIsonline(false);
|
||||
this.setIserror(true);
|
||||
message = "信号量同步异常";
|
||||
//未联机
|
||||
} else if (mode == 0) {
|
||||
this.setIsonline(false);
|
||||
this.setIserror(true);
|
||||
message = "未联机";
|
||||
//有报警
|
||||
} else if (error != 0) {
|
||||
this.setIsonline(false);
|
||||
this.setIserror(true);
|
||||
message = "有报警";
|
||||
//无报警
|
||||
} else {
|
||||
this.setIsonline(true);
|
||||
this.setIserror(false);
|
||||
message = "";
|
||||
Instruction instruction = null;
|
||||
List toInstructions;
|
||||
switch (mode) {
|
||||
case 1:
|
||||
log.debug("设备运转模式:等待工作");
|
||||
return;
|
||||
case 2:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (flag) {
|
||||
//取货完成
|
||||
case 1:
|
||||
writing(2);
|
||||
return;
|
||||
//放货完成
|
||||
case 2:
|
||||
writing(3);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
last_mode = mode;
|
||||
last_error = error;
|
||||
last_move = move;
|
||||
last_task = task;
|
||||
last_action = action;
|
||||
last_number = number;
|
||||
}
|
||||
|
||||
|
||||
public boolean exe_error() {
|
||||
if (this.error == 0) {
|
||||
return true;
|
||||
} else {
|
||||
log.debug("设备报警");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean exe_business() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void executing(Server server, Map<String, Object> itemMap) {
|
||||
ReadUtil.write(itemMap, server);
|
||||
}
|
||||
|
||||
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);
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
itemMap.put(to_command, command);
|
||||
ReadUtil.write(itemMap, server);
|
||||
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
package org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_paint_line;
|
||||
|
||||
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_mode = "mode";
|
||||
public static String item_move = "move";
|
||||
public static String item_action = "action";
|
||||
public static String item_error = "error";
|
||||
public static String item_number = "number";
|
||||
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";
|
||||
public static String item_weight = "weight";
|
||||
|
||||
private HailiangPaintLineDeviceDriver driver;
|
||||
|
||||
public ItemProtocol(HailiangPaintLineDeviceDriver driver) {
|
||||
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 getNumber() {
|
||||
return this.getOpcIntegerValue(item_number);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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_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_error, "报警信号", "DB600.B6"));
|
||||
list.add(new ItemDto(item_number, "数量", "DB600.B7"));
|
||||
list.add(new ItemDto(item_task, "任务号", "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)));
|
||||
list.add(new ItemDto(item_to_target, "目标站", "DB601.W4"));
|
||||
list.add(new ItemDto(item_to_task, "任务号", "DB601.D8"));
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -61,7 +61,9 @@ public class HailiangThreestationSmartDefination implements OpcDeviceDriverDefin
|
||||
list.add(new ItemDto(ItemProtocol.item_move, "光电信号", "VW4"));
|
||||
list.add(new ItemDto(ItemProtocol.item_action, "取放信号", "VW6"));
|
||||
list.add(new ItemDto(ItemProtocol.item_error, "报警信号", "VW8"));
|
||||
list.add(new ItemDto(ItemProtocol.item_task, "任务号", "VD10"));
|
||||
list.add(new ItemDto(ItemProtocol.item_number, "数量", "VW10"));
|
||||
list.add(new ItemDto(ItemProtocol.item_container_type, "托盘类型", "VW12"));
|
||||
list.add(new ItemDto(ItemProtocol.item_task, "任务号", "VD14"));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,10 +53,8 @@ public class HailiangThreestationSmartDeviceDriver extends AbstractOpcDeviceDriv
|
||||
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
|
||||
@Autowired
|
||||
LogServer logServer = SpringContextHolder.getBean(LogServer.class);
|
||||
String container;
|
||||
String container_type_desc;
|
||||
String last_container_type_desc;
|
||||
String last_container;
|
||||
//放货准备锁
|
||||
String putReadyLock = null;
|
||||
//有货标记
|
||||
@@ -67,11 +65,15 @@ public class HailiangThreestationSmartDeviceDriver extends AbstractOpcDeviceDriv
|
||||
int move = 0;
|
||||
int task = 0;
|
||||
int action = 0;
|
||||
int number = 0;
|
||||
int container_type = 0;
|
||||
int last_mode = 0;
|
||||
int last_error = 0;
|
||||
int last_move = 0;
|
||||
int last_task = 0;
|
||||
int last_action = 0;
|
||||
int last_number = 0;
|
||||
int last_container_type = 0;
|
||||
Boolean isonline = true;
|
||||
int hasGoods = 0;
|
||||
String message = null;
|
||||
@@ -134,6 +136,8 @@ public class HailiangThreestationSmartDeviceDriver extends AbstractOpcDeviceDriv
|
||||
error = this.itemProtocol.getError();
|
||||
action = this.itemProtocol.getAction();
|
||||
move = this.itemProtocol.getMove();
|
||||
number = this.itemProtocol.getNumber();
|
||||
container_type = this.itemProtocol.getContainer_type();
|
||||
task = this.itemProtocol.getTask();
|
||||
hasGoods = this.itemProtocol.getMove();
|
||||
|
||||
@@ -154,6 +158,14 @@ public class HailiangThreestationSmartDeviceDriver extends AbstractOpcDeviceDriv
|
||||
logServer.deviceLog(this.device_code,"action" ,String.valueOf(action));
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号action:" + last_action + "->" + action);
|
||||
}
|
||||
if (container_type != last_container_type) {
|
||||
logServer.deviceLog(this.device_code,"container_type" ,String.valueOf(container_type));
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号container_type:" + last_container_type + "->" + container_type);
|
||||
}
|
||||
if (number != last_number) {
|
||||
logServer.deviceLog(this.device_code,"number" ,String.valueOf(number));
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号number:" + last_number + "->" + number);
|
||||
}
|
||||
|
||||
} catch (Exception var17) {
|
||||
return;
|
||||
@@ -206,6 +218,8 @@ public class HailiangThreestationSmartDeviceDriver extends AbstractOpcDeviceDriv
|
||||
last_move = move;
|
||||
last_task = task;
|
||||
last_action = action;
|
||||
last_number = number;
|
||||
last_container_type = container_type;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ public class ItemProtocol {
|
||||
public static String item_move = "move";
|
||||
public static String item_action = "action";
|
||||
public static String item_error = "error";
|
||||
public static String item_number = "number";
|
||||
public static String item_container_type = "container_type";
|
||||
public static String item_task = "task";
|
||||
public static String item_to_command = "to_command";
|
||||
public static String item_to_target = "to_target";
|
||||
@@ -48,6 +50,14 @@ public class ItemProtocol {
|
||||
return this.getOpcIntegerValue(item_error);
|
||||
}
|
||||
|
||||
public int getNumber() {
|
||||
return this.getOpcIntegerValue(item_number);
|
||||
}
|
||||
|
||||
public int getContainer_type() {
|
||||
return this.getOpcIntegerValue(item_container_type);
|
||||
}
|
||||
|
||||
public int getTask() {
|
||||
return this.getOpcIntegerValue(item_task);
|
||||
}
|
||||
@@ -91,7 +101,9 @@ public class ItemProtocol {
|
||||
list.add(new ItemDto(item_move, "光电信号", "VW4"));
|
||||
list.add(new ItemDto(item_action, "取放信号", "VW6"));
|
||||
list.add(new ItemDto(item_error, "报警信号", "VW8"));
|
||||
list.add(new ItemDto(item_task, "任务号", "VD10"));
|
||||
list.add(new ItemDto(item_number, "数量", "VW10"));
|
||||
list.add(new ItemDto(item_container_type, "托盘类型", "VW12"));
|
||||
list.add(new ItemDto(item_task, "任务号", "VD14"));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -275,76 +275,6 @@ public class StageActorServiceImpl implements StageActorService {
|
||||
continue;
|
||||
}
|
||||
|
||||
String move = "";
|
||||
String mode = "";
|
||||
String action = "";
|
||||
|
||||
//海亮-三工位Smart200
|
||||
HailiangThreestationSmartDeviceDriver hailiangThreestationSmartDeviceDriver;
|
||||
//海亮-叠盘位Smart200
|
||||
HailiangFoldingDiscSmartDeviceDriver hailiangFoldingDiscSmartDeviceDriver;
|
||||
//海亮-货梯对接线
|
||||
HailiangElevatorWiringDeviceDriver hailiangElevatorWiringDeviceDriver;
|
||||
|
||||
if (device.getDeviceDriver() instanceof HailiangThreestationSmartDeviceDriver) {
|
||||
hailiangThreestationSmartDeviceDriver = (HailiangThreestationSmartDeviceDriver) device.getDeviceDriver();
|
||||
if (hailiangThreestationSmartDeviceDriver.getMode() == 0) {
|
||||
mode = "脱机";
|
||||
} else if (hailiangThreestationSmartDeviceDriver.getMode() == 2) {
|
||||
mode = "待机";
|
||||
} else if (hailiangThreestationSmartDeviceDriver.getMode() == 3) {
|
||||
mode = "运行中";
|
||||
}
|
||||
if (hailiangThreestationSmartDeviceDriver.getMove() == 0) {
|
||||
move = "无货";
|
||||
} else if (hailiangThreestationSmartDeviceDriver.getMove() == 1) {
|
||||
move = "有货";
|
||||
}
|
||||
if (hailiangThreestationSmartDeviceDriver.getAction() == 0) {
|
||||
action = "禁止取放";
|
||||
} else if (hailiangThreestationSmartDeviceDriver.getAction() == 1) {
|
||||
action = "允许取货";
|
||||
} else if (hailiangThreestationSmartDeviceDriver.getAction() == 2) {
|
||||
action = "允许放货";
|
||||
} else if (hailiangThreestationSmartDeviceDriver.getAction() == 3) {
|
||||
action = "允许取放";
|
||||
}
|
||||
obj.put("device_name", hailiangThreestationSmartDeviceDriver.getDevice().getDevice_name());
|
||||
jo.put("mode", mode);
|
||||
jo.put("move", move);
|
||||
jo.put("action", action);
|
||||
jo.put("hasGoods", hailiangThreestationSmartDeviceDriver.getHasGoods());
|
||||
jo.put("isOnline", hailiangThreestationSmartDeviceDriver.getIsonline());
|
||||
jo.put("error", hailiangThreestationSmartDeviceDriver.getError());
|
||||
jo.put("isError", hailiangThreestationSmartDeviceDriver.getIserror());
|
||||
jo.put("container", hailiangThreestationSmartDeviceDriver.getContainer());
|
||||
jo.put("message", hailiangThreestationSmartDeviceDriver.getMessage());
|
||||
} else if (device.getDeviceDriver() instanceof HailiangFoldingDiscSmartDeviceDriver) {
|
||||
hailiangFoldingDiscSmartDeviceDriver = (HailiangFoldingDiscSmartDeviceDriver) device.getDeviceDriver();
|
||||
if (hailiangFoldingDiscSmartDeviceDriver.getMode() == 0) {
|
||||
mode = "脱机";
|
||||
} else if (hailiangFoldingDiscSmartDeviceDriver.getMode() == 2) {
|
||||
mode = "待机";
|
||||
} else if (hailiangFoldingDiscSmartDeviceDriver.getMode() == 3) {
|
||||
mode = "运行中";
|
||||
}
|
||||
if (hailiangFoldingDiscSmartDeviceDriver.getMove() == 0) {
|
||||
move = "无货";
|
||||
} else if (hailiangFoldingDiscSmartDeviceDriver.getMove() == 1) {
|
||||
move = "有货";
|
||||
}
|
||||
|
||||
obj.put("device_name", hailiangFoldingDiscSmartDeviceDriver.getDevice().getDevice_name());
|
||||
jo.put("mode", mode);
|
||||
jo.put("move", move);
|
||||
jo.put("number", hailiangFoldingDiscSmartDeviceDriver.getNumber());
|
||||
jo.put("hasGoods", hailiangFoldingDiscSmartDeviceDriver.getHasGoods());
|
||||
jo.put("isOnline", hailiangFoldingDiscSmartDeviceDriver.getIsonline());
|
||||
jo.put("error", hailiangFoldingDiscSmartDeviceDriver.getError());
|
||||
jo.put("isError", hailiangFoldingDiscSmartDeviceDriver.getIserror());
|
||||
jo.put("container", hailiangFoldingDiscSmartDeviceDriver.getContainer());
|
||||
jo.put("message", hailiangFoldingDiscSmartDeviceDriver.getMessage());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(device.getDeviceDriver())) {
|
||||
IDriverService driverService = applicationContext.getBean(device.getDeviceDriverDefination().getDriverCode(), IDriverService.class);
|
||||
obj.put("device_name", device.getDevice_name());
|
||||
|
||||
Reference in New Issue
Block a user