海量三个新驱动创建,导出smartCSV文件更新

This commit is contained in:
loujf
2022-08-02 19:34:14 +08:00
parent 59d9c19764
commit 7f27dbd120
22 changed files with 3030 additions and 10 deletions

View File

@@ -0,0 +1,52 @@
package org.nl.acs.common;
import com.alibaba.fastjson.JSONObject;
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_elevator_wiring.HailiangElevatorWiringDeviceDriver;
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_engraving_cache.HailiangEngravingCacheDeviceDriver;
import org.nl.acs.opc.Device;
import org.nl.acs.stage.service.utils.StageActorUtil;
import org.springframework.stereotype.Service;
@Service("hailiang_elevator_wiring")
public class HailiangElevatorWiringDevice extends AbstractDriverService {
@Override
public JSONObject getDeviceInfo(Device device) {
HailiangElevatorWiringDeviceDriver hailiangElevatorWiringDeviceDriver = (HailiangElevatorWiringDeviceDriver) device.getDeviceDriver();
JSONObject jo = super.getCommonDeviceInfo(hailiangElevatorWiringDeviceDriver);
String mode = "";
String move = "";
String action = "";
if (hailiangElevatorWiringDeviceDriver.getMode() == 0) {
mode = "脱机";
} else if (hailiangElevatorWiringDeviceDriver.getMode() == 2) {
mode = "待机";
} else if (hailiangElevatorWiringDeviceDriver.getMode() == 3) {
mode = "运行中";
}
if (hailiangElevatorWiringDeviceDriver.getMove() == 0) {
move = "无货";
} else if (hailiangElevatorWiringDeviceDriver.getMove() == 1) {
move = "有货";
}
if (hailiangElevatorWiringDeviceDriver.getAction() == 0) {
action = "禁止取放";
} else if (hailiangElevatorWiringDeviceDriver.getAction() == 1) {
action = "允许取货";
} else if (hailiangElevatorWiringDeviceDriver.getAction() == 2) {
action = "允许放货";
} else if (hailiangElevatorWiringDeviceDriver.getAction() == 3) {
action = "允许取放";
}
jo.put("mode", mode);
jo.put("move", move);
jo.put("action", action);
jo.put("hasGoods", hailiangElevatorWiringDeviceDriver.getHasGoods());
jo.put("isOnline", hailiangElevatorWiringDeviceDriver.getIsonline());
jo.put("error", hailiangElevatorWiringDeviceDriver.getError());
jo.put("isError", hailiangElevatorWiringDeviceDriver.getIserror());
jo.put("message", hailiangElevatorWiringDeviceDriver.getMessage());
return jo;
}
}

View File

@@ -0,0 +1,42 @@
package org.nl.acs.common;
import com.alibaba.fastjson.JSONObject;
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_elevator_wiring.HailiangElevatorWiringDeviceDriver;
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_foldingDisc_smart.HailiangFoldingDiscSmartDeviceDriver;
import org.nl.acs.opc.Device;
import org.springframework.stereotype.Service;
@Service("hailiang_foldingDisc_smart")
public class HailiangFoldingDiscSmartDevice extends AbstractDriverService {
@Override
public JSONObject getDeviceInfo(Device device) {
HailiangFoldingDiscSmartDeviceDriver hailiangFoldingDiscSmartDeviceDriver = (HailiangFoldingDiscSmartDeviceDriver) device.getDeviceDriver();
JSONObject jo = super.getCommonDeviceInfo(hailiangFoldingDiscSmartDeviceDriver);
String mode = "";
String move = "";
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 = "有货";
}
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("message", hailiangFoldingDiscSmartDeviceDriver.getMessage());
return jo;
}
}

View File

@@ -0,0 +1,51 @@
package org.nl.acs.common;
import com.alibaba.fastjson.JSONObject;
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_elevator_wiring.HailiangElevatorWiringDeviceDriver;
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_threestation_smart")
public class HailiangThreestationSmartDevice extends AbstractDriverService {
@Override
public JSONObject getDeviceInfo(Device device) {
HailiangThreestationSmartDeviceDriver threestationSmartDeviceDriver = (HailiangThreestationSmartDeviceDriver) device.getDeviceDriver();
JSONObject jo = super.getCommonDeviceInfo(threestationSmartDeviceDriver);
String mode = "";
String move = "";
String action = "";
if (threestationSmartDeviceDriver.getMode() == 0) {
mode = "脱机";
} else if (threestationSmartDeviceDriver.getMode() == 2) {
mode = "待机";
} else if (threestationSmartDeviceDriver.getMode() == 3) {
mode = "运行中";
}
if (threestationSmartDeviceDriver.getMove() == 0) {
move = "无货";
} else if (threestationSmartDeviceDriver.getMove() == 1) {
move = "有货";
}
if (threestationSmartDeviceDriver.getAction() == 0) {
action = "禁止取放";
} else if (threestationSmartDeviceDriver.getAction() == 1) {
action = "允许取货";
} else if (threestationSmartDeviceDriver.getAction() == 2) {
action = "允许放货";
} else if (threestationSmartDeviceDriver.getAction() == 3) {
action = "允许取放";
}
jo.put("mode", mode);
jo.put("move", move);
jo.put("action", action);
jo.put("hasGoods", threestationSmartDeviceDriver.getHasGoods());
jo.put("isOnline", threestationSmartDeviceDriver.getIsonline());
jo.put("error", threestationSmartDeviceDriver.getError());
jo.put("isError", threestationSmartDeviceDriver.getIserror());
jo.put("message", threestationSmartDeviceDriver.getMessage());
return jo;
}
}

View File

@@ -63,9 +63,13 @@ public enum DriverTypeEnum {
HAILIANG_XJ_PLC_TEST(27, "hailiang_xj_plc_test", "海亮-信捷PLC", "conveyor"),
HAILIANG_SMART_PLC_TEST(28, "hailiang_smart_plc_test", "海亮-西门子SMART200PLC", "conveyor");
HAILIANG_SMART_PLC_TEST(28, "hailiang_smart_plc_test", "海亮-西门子SMART200PLC", "conveyor"),
HAILIANG_THREESTATION_SMART(29, "hailiang_threestation_smart", "海亮-三工位Smart200", "conveyor"),
HAILIANG_FOLDINGDISC_SMART(30, "hailiang_foldingDisc_smart", "海亮-叠盘位Smart200", "conveyor"),
HAILIANG_ELEVATOR_WIRING(31, "hailiang_elevator_wiring", "海亮-货梯对接线", "conveyor");
//驱动索引
private int index;

View File

@@ -73,12 +73,12 @@ public class DeviceController {
deviceService.downDeviceDBloadCSV(deviceService.queryDeviceProtocol(whereJson), response);
}
@Log("导出欧姆龙设备协议CSV")
@ApiOperation("导出欧姆龙设备协议CSV")
@GetMapping(value = "/protocol/downloadoumulongCSV")
@Log("导出Smart设备协议CSV")
@ApiOperation("导出Smart设备协议CSV")
@GetMapping(value = "/protocol/downloadSmartCSV")
//@PreAuthorize("@el.check('device:list')")
public void downDeviceDBloadOumulongCSV(HttpServletResponse response, @RequestParam Map whereJson) throws IOException {
deviceService.downDeviceDBloadOumulongCSV(deviceService.queryDeviceProtocol(whereJson), response);
deviceService.downDeviceDBloadSmartCSV(deviceService.queryDeviceProtocol(whereJson), response);
}
@PostMapping

View File

@@ -240,7 +240,7 @@ public interface DeviceService {
void downDeviceDBloadCSV(JSONArray queryDeviceProtocol, HttpServletResponse response);
void downDeviceDBloadOumulongCSV(JSONArray queryDeviceProtocol, HttpServletResponse response);
void downDeviceDBloadSmartCSV(JSONArray queryDeviceProtocol, HttpServletResponse response);
JSONArray selectDeviceListByType(String type);

View File

@@ -1455,7 +1455,7 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
}
@Override
public void downDeviceDBloadOumulongCSV(JSONArray jsonarr, HttpServletResponse response) {
public void downDeviceDBloadSmartCSV(JSONArray jsonarr, HttpServletResponse response) {
List<Object[]> cellList = new ArrayList<>();
for (int i = 0; i < jsonarr.size(); i++) {
List item = new ArrayList();
@@ -1473,8 +1473,13 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
item.add(jo.get("extra_name"));
String datatype = jo.getString("extra_name");
//西门子200
if (datatype.indexOf(".") == -1) {
datatype = "Word";
if (!datatype.contains(".")) {
String[] split = datatype.split("");
if (split[1].equals("W")) {
datatype = "Word";
} else if (split[1].equals("D")) {
datatype = "DWord";
}
} else {
datatype = "Boolean";
}

View File

@@ -0,0 +1,73 @@
package org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_elevator_wiring;
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 HailiangElevatorWiringDefination implements OpcDeviceDriverDefination {
@Override
public String getDriverCode() {
return "hailiang_elevator_wiring";
}
@Override
public String getDriverName() {
return "海亮-货梯对接线";
}
@Override
public String getDriverDescription() {
return "海亮-货梯对接线";
}
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new HailiangElevatorWiringDeviceDriver()).setDevice(device).setDriverDefination(this);
}
@Override
public Class<? extends DeviceDriver> getDeviceDriverType() {
return HailiangElevatorWiringDeviceDriver.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, "心跳", "VW0"));
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_action, "取放信号", "VW6"));
list.add(new ItemDto(ItemProtocol.item_error, "报警信号", "VW8"));
list.add(new ItemDto(ItemProtocol.item_task, "任务号", "VD10"));
return list;
}
@Override
public List<ItemDto> getWriteableItemDtos() {
return ItemProtocol.getWriteableItemDtos();
}
}

View File

@@ -0,0 +1,252 @@
package org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_elevator_wiring;
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 HailiangElevatorWiringDeviceDriver 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 container;
String container_type_desc;
String last_container_type_desc;
String last_container;
//放货准备锁
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 last_mode = 0;
int last_error = 0;
int last_move = 0;
int last_task = 0;
int last_action = 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();
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);
}
} 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;
}
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);
}
}

View File

@@ -0,0 +1,107 @@
package org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_elevator_wiring;
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_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 HailiangElevatorWiringDeviceDriver driver;
public ItemProtocol(HailiangElevatorWiringDeviceDriver 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 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, "心跳", "VW0"));
list.add(new ItemDto(item_mode, "工作状态", "VW2", Boolean.valueOf(true)));
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"));
return list;
}
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"));
return list;
}
}

View File

@@ -0,0 +1,73 @@
package org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_foldingDisc_smart;
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;
/**
* 海亮-叠盘位Smart200
*/
@Service
public class HailiangFoldingDiscSmartDefination implements OpcDeviceDriverDefination {
@Override
public String getDriverCode() {
return "hailiang_foldingDisc_smart";
}
@Override
public String getDriverName() {
return "海亮-叠盘位Smart200";
}
@Override
public String getDriverDescription() {
return "海亮-叠盘位Smart200";
}
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new HailiangFoldingDiscSmartDeviceDriver()).setDevice(device).setDriverDefination(this);
}
@Override
public Class<? extends DeviceDriver> getDeviceDriverType() {
return HailiangFoldingDiscSmartDeviceDriver.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, "心跳", "VW0"));
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_error, "报警信号", "VW10"));
list.add(new ItemDto(ItemProtocol.item_task, "任务号", "VD12"));
return list;
}
@Override
public List<ItemDto> getWriteableItemDtos() {
return ItemProtocol.getWriteableItemDtos();
}
}

View File

@@ -0,0 +1,252 @@
package org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_foldingDisc_smart;
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;
/**
* 海亮-叠盘位Smart200
*/
@Slf4j
@Data
@RequiredArgsConstructor
public class HailiangFoldingDiscSmartDeviceDriver 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 container;
String container_type_desc;
String last_container_type_desc;
String last_container;
//放货准备锁
String putReadyLock = null;
//有货标记
protected boolean has_goods_tag = false;
int mode = 0;
int error = 0;
int move = 0;
int task = 0;
int number = 0;
int last_mode = 0;
int last_error = 0;
int last_move = 0;
int last_task = 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();
number = this.itemProtocol.getNumber();
move = this.itemProtocol.getMove();
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 (number != last_number) {
logServer.deviceLog(this.device_code,"action" ,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_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);
}
}

View File

@@ -0,0 +1,107 @@
package org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_foldingDisc_smart;
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_number = "number";
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";
public static String item_weight = "weight";
private HailiangFoldingDiscSmartDeviceDriver driver;
public ItemProtocol(HailiangFoldingDiscSmartDeviceDriver 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 getNumber() {
return this.getOpcIntegerValue(item_number);
}
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;
}
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, "心跳", "VW0"));
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_error, "报警信号", "VW10"));
list.add(new ItemDto(item_task, "任务号", "VD12"));
return list;
}
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"));
return list;
}
}

View File

@@ -0,0 +1,73 @@
package org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_threeStation_smart;
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;
/**
* 海亮-三工位Smart200
*/
@Service
public class HailiangThreestationSmartDefination implements OpcDeviceDriverDefination {
@Override
public String getDriverCode() {
return "hailiang_threestation_smart";
}
@Override
public String getDriverName() {
return "海亮-三工位Smart200";
}
@Override
public String getDriverDescription() {
return "海亮-三工位Smart200";
}
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new HailiangThreestationSmartDeviceDriver()).setDevice(device).setDriverDefination(this);
}
@Override
public Class<? extends DeviceDriver> getDeviceDriverType() {
return HailiangThreestationSmartDeviceDriver.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, "心跳", "VW0"));
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_action, "取放信号", "VW6"));
list.add(new ItemDto(ItemProtocol.item_error, "报警信号", "VW8"));
list.add(new ItemDto(ItemProtocol.item_task, "任务号", "VD10"));
return list;
}
@Override
public List<ItemDto> getWriteableItemDtos() {
return ItemProtocol.getWriteableItemDtos();
}
}

View File

@@ -0,0 +1,263 @@
package org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_threeStation_smart;
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.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.opc.DeviceAppService;
import org.nl.acs.opc.DeviceAppServiceImpl;
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.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.modules.system.util.CodeUtil;
import org.nl.utils.SpringContextHolder;
import org.nl.wql.core.bean.WQLObject;
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;
/**
* 海亮-三工位Smart200
*/
@Slf4j
@Data
@RequiredArgsConstructor
public class HailiangThreestationSmartDeviceDriver 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 container;
String container_type_desc;
String last_container_type_desc;
String last_container;
//放货准备锁
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 last_mode = 0;
int last_error = 0;
int last_move = 0;
int last_task = 0;
int last_action = 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();
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);
}
} 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;
}
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);
}
}

View File

@@ -0,0 +1,107 @@
package org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_threeStation_smart;
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_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 HailiangThreestationSmartDeviceDriver driver;
public ItemProtocol(HailiangThreestationSmartDeviceDriver 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 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, "心跳", "VW0"));
list.add(new ItemDto(item_mode, "工作状态", "VW2", Boolean.valueOf(true)));
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"));
return list;
}
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"));
return list;
}
}

View File

@@ -22,14 +22,17 @@ import org.nl.acs.device_driver.basedriver.agv.utils.IAgv;
import org.nl.acs.device_driver.basedriver.agv.utils.OneAgvPhase;
import org.nl.acs.device_driver.basedriver.agv.utils.TwoAgvPhase;
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_cleaning_machine_storage_station.HailiangCleaningMachineStorageStationDeviceDriver;
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_elevator_wiring.HailiangElevatorWiringDeviceDriver;
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_engraving_cache.HailiangEngravingCacheDeviceDriver;
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_engraving_machine.HailiangEngravingMachineDeviceDriver;
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_foldingDisc_smart.HailiangFoldingDiscSmartDeviceDriver;
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_packer_station.HailiangPackerStationDeviceDriver;
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_special_device.HailiangSpecialDeviceDriver;
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_special_empty_station.HailiangSpecialEmptyStationDeviceDriver;
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_special_full_station.HailiangSpecialFullStationDeviceDriver;
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_special_pick_station.HailiangSpecialPickStationDeviceDriver;
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_special_pour_station.HailiangSpecialPourStationDeviceDriver;
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_threeStation_smart.HailiangThreestationSmartDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_autodoor.StandardAutodoorDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_conveyor_control.StandardCoveyorControlDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_plcscanner.StandardCoveyorControlWithPlcScannerDeviceDriver;
@@ -271,6 +274,77 @@ public class StageActorServiceImpl implements StageActorService {
if (ObjectUtil.isNull(device)) {
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());