diff --git a/acs/hd/README.en.md b/acs/hd/README.en.md index 5b25fda..f2070da 100644 --- a/acs/hd/README.en.md +++ b/acs/hd/README.en.md @@ -1,4 +1,4 @@ -# llsh_acs +# hl_two_acs #### Description {**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**} diff --git a/acs/hd/README.md b/acs/hd/README.md index 0e060cf..e5da157 100644 --- a/acs/hd/README.md +++ b/acs/hd/README.md @@ -1,3 +1,3 @@ -# llsh_acs +# hl_two_acs -辽宁晟华车间自动化项目 \ No newline at end of file +海亮老车间项目 \ No newline at end of file diff --git a/acs/hd/nladmin-system/pom.xml b/acs/hd/nladmin-system/pom.xml index a6dc1ef..8f66398 100644 --- a/acs/hd/nladmin-system/pom.xml +++ b/acs/hd/nladmin-system/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - llsh_acs + hl_two_acs org.nl 1.0-SNAPSHOT diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java index 0340429..3c2bbf1 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java @@ -19,8 +19,6 @@ public enum DriverTypeEnum { LAMP_THREE_COLOR(11, "lamp_three_color", "标准版-三色灯", "alarmLamp"), - SPECIAL_ORDINARY_SITE(12, "special_ordinary_site", "特殊版-普通站点-关联锁定", "station"), - STORAGE(13, "standard_storage", "标准版-货架", "storage"), SCANNER(14, "standard_scanner", "标准版-扫码器", "scanner"), @@ -35,47 +33,8 @@ public enum DriverTypeEnum { INSPECT_CONVEYOR_CONTROL_WITH_PLCSCANNER(27, "standard_conveyor_control_with_plcscanner", "标准版-输送机-控制点-PLC扫码", "conveyor"), - ELECTRIC_FENCE(32, "electric_fence", "标准版-电子围栏", "safetydoor"), + ELECTRIC_FENCE(32, "electric_fence", "标准版-电子围栏", "safetydoor"); - OUMULONGPLC(33, "oumulong_plc", "标准版-自动门-欧姆龙plc", "autodoor"), - - TRAFFIC_LIGHT(34, "traffic_light", "标准版-交通灯-欧姆龙plc", "alarmLamp"), - - STANDARD_RGV(35, "standard_rgv", "标准版-RGV", "rgv"), - - LNSH_MIXING_MILL(37, "lnsh_mixing_mill", "晟华-混碾机", "station"), - - LNSH_PRESS(38, "lnsh_press", "晟华-压力机", "station"), - - LNSH_PALLETIZING_MANIPULATOR(39, "lnsh_palletizing_manipulator", "晟华-码垛机械手", "station"), - - LNSH_KILN_TRUSS(40, "lnsh_kiln_truss", "晟华-入出窑桁架", "station"), - - LNSH_OUT_KILN_TRUSS(41, "lnsh_out_kiln_truss", "晟华-出窑桁架", "station"), - - LNSH_KILN_LANE(42, "lnsh_kiln_lane", "晟华-窑车道", "station"), - - LNSH_FOLD_DISC_SITE(43, "lnsh_fold_disc_site", "晟华-叠盘机", "station"), - - LNSH_PALLET_STORAGE(44, "lnsh_pallet_storage", "晟华-托盘存储线", "station"), - - LNSH_PACKAGE_PALLET_MANIPULATOR(45, "lnsh_package_pallet_manipulator", "晟华-包装码垛机械手", "station"), - - LNSH_LABELING_MACHINE(46, "lnsh_labeling_machine", "晟华-贴标机", "station"), - - LNSH_SPLIT_MANIPULATOR(47, "lnsh_split_manipulator", "晟华-拆垛机械手", "station"), - - LNSH_RGV(48, "lnsh_rgv", "晟华-RGV", "rgv"), - - LNSH_PACKAGE_LINE(49, "lnsh_package_line", "晟华-包装机", "station"), - - LNSH_STATION(50, "lnsh_station", "晟华-工位(交互模板)", "station"), - - LNSH_LAMINATING_MACHINE(51, "lnsh_Laminating_machine", "晟华-覆膜机", "station"), - - LNSH_PACKAGE_SITE(52, "lnsh_package_site", "晟华-包装线工位", "station"), - - LNSH_CRUSHER(52, "lnsh_crusher", "晟华-破碎机", "station"); //驱动索引 diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_Laminating_machine/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_Laminating_machine/ItemProtocol.java deleted file mode 100644 index c2f7287..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_Laminating_machine/ItemProtocol.java +++ /dev/null @@ -1,122 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_Laminating_machine; - -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_container_type = "container_type"; - 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_to_barcode = "to_barcode"; - - private LnshLaminatingMachineDeviceDriver driver; - - public ItemProtocol(LnshLaminatingMachineDeviceDriver 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 getContainer_type() { - return this.getOpcIntegerValue(item_container_type); - } - - 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 String getTo_barcode() { - return this.getOpcStringValue(item_to_barcode); - } - - //是否有货 - 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 String getOpcStringValue(String protocol) { - String value = this.driver.getStringValue(protocol); - if (value == null) { -// log.error("读取错误!"); - } else { - return value; - } - return "0"; - } - - public static List getReadableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_heartbeat, "心跳", "DB32.B0")); - list.add(new ItemDto(item_mode, "工作状态", "DB32.B2", Boolean.valueOf(true))); - list.add(new ItemDto(item_move, "光电开关信号", "DB32.B3")); - list.add(new ItemDto(item_container_type, "托盘类型", "DB32.B6")); - list.add(new ItemDto(item_error, "报警信号", "DB32.B7")); - list.add(new ItemDto(item_task, "任务号", "DB32.D10")); - return list; - } - - public static List getWriteableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_command, "作业命令", "DB33.W2", Boolean.valueOf(true))); - list.add(new ItemDto(item_to_target, "目标站", "DB33.W4")); - list.add(new ItemDto(item_to_task, "任务号", "DB33.D8")); - list.add(new ItemDto(item_to_barcode, "条码", "DB33.S12")); - return list; - } - -} - diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_Laminating_machine/LnshLaminatingMachineDefination.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_Laminating_machine/LnshLaminatingMachineDefination.java deleted file mode 100644 index 22ec6e8..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_Laminating_machine/LnshLaminatingMachineDefination.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_Laminating_machine; - -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 LnshLaminatingMachineDefination implements OpcDeviceDriverDefination { - @Override - public String getDriverCode() { - return "lnsh_Laminating_machine"; - } - - @Override - public String getDriverName() { - return "晟华-覆膜机"; - } - - @Override - public String getDriverDescription() { - return "晟华-覆膜机"; - } - - @Override - public DeviceDriver getDriverInstance(Device device) { - return (new LnshLaminatingMachineDeviceDriver()).setDevice(device).setDriverDefination(this); - - } - - @Override - public Class getDeviceDriverType() { - return LnshLaminatingMachineDeviceDriver.class; - } - - @Override - public List getFitDeviceTypes() { - List types = new LinkedList(); - types.add(DeviceType.station); - return types; - } - - @Override - public List getReadableItemDtos() { - return getReadableItemDtos2(); - } - - public static List getReadableItemDtos2() { - List list = new ArrayList(); - list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB32.B0")); - list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB32.B1", true)); - list.add(new ItemDto(ItemProtocol.item_move, "光电开关信号", "DB32.B2")); - list.add(new ItemDto(ItemProtocol.item_container_type, "托盘类型", "DB32.B6")); - list.add(new ItemDto(ItemProtocol.item_error, "报警信号", "DB32.B7")); - list.add(new ItemDto(ItemProtocol.item_task, "任务号", "DB32.D8")); - return list; - } - - @Override - public List getWriteableItemDtos() { - return ItemProtocol.getWriteableItemDtos(); - } - -} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_Laminating_machine/LnshLaminatingMachineDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_Laminating_machine/LnshLaminatingMachineDeviceDriver.java deleted file mode 100644 index 5e79f72..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_Laminating_machine/LnshLaminatingMachineDeviceDriver.java +++ /dev/null @@ -1,334 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_Laminating_machine; - -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.ext.wms.service.AcsToWmsService; -import org.nl.acs.instruction.service.InstructionService; -import org.nl.acs.instruction.service.dto.Instruction; - -import org.nl.acs.log.service.DeviceExecuteLogService; -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.lang.reflect.Field; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * 晟华-覆膜机 - */ -@Slf4j -@Data -@RequiredArgsConstructor -public class LnshLaminatingMachineDeviceDriver 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 - DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); - @Autowired - AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl"); - - //放货准备锁 - String putReadyLock = null; - //有货标记 - protected boolean has_goods_tag = false; - - int mode = 0; - int error = 0; - int move = 0; - int task = 0; - int container_type = 0; - int last_mode = 0; - int last_error = 0; - int last_move = 0; - int last_task = 0; - int last_container_type = 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; - 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; - //当前指令 - Instruction inst = null; - //上次指令 - Instruction last_inst = null; - - //触摸屏手动触发任务 - private Boolean is_has_task = 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(); - 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); - logServer.deviceItemValue(this.device_code,"mode" ,String.valueOf(mode)); - logServer.deviceExecuteLog(this.device_code,"","","信号mode:" + last_mode + "->" + mode); - } - if (move != last_move) { - logServer.deviceItemValue(this.device_code,"move" ,String.valueOf(move)); - logServer.deviceExecuteLog(this.device_code,"","","信号move:" + last_move + "->" + move); - } - if (error != last_error) { - logServer.deviceItemValue(this.device_code,"error" ,String.valueOf(error)); - logServer.deviceExecuteLog(this.device_code,"","","信号error:" + last_error + "->" + error); - } - if (task != last_task) { - logServer.deviceItemValue(this.device_code,"task",String.valueOf(task)); - logServer.deviceExecuteLog(this.device_code,"","","信号task:" + last_task + "->" + task); - } - if (container_type != last_container_type) { - logServer.deviceItemValue(this.device_code,"container_type",String.valueOf(container_type)); - logServer.deviceExecuteLog(this.device_code,"","","信号container_type:" + last_container_type + "->" + container_type); - } - - } catch (Exception var17) { - return; - } - - 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; - case 4: - if (!requireSucess) { - getVehicle_code(); - } - 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_container_type = container_type; - } - - - public boolean exe_error() { - if (this.error == 0) { - return true; - } else { - log.debug("设备报警"); - return false; - } - } - - public boolean exe_business() { - return true; - } - - protected void executing(Instruction instruction) { - this.executing(1, instruction, ""); - } - - public void executing(int command, Instruction instruction, String appendMessage) { - String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_command; - String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_target; - String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_task; - String to_barcode = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_barcode; - if (appendMessage == null) { - appendMessage = ""; - } - if (instruction != null) { - instruction_num = Integer.parseInt(instruction.getInstruction_code()); - } - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(to_command, 1); - itemMap.put(to_task, instruction_num); - ReadUtil.write(itemMap, server); - - } - - /** - * 获取托盘号 - * - * @param - */ - public synchronized boolean getVehicle_code() { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - JSONObject jo = acsToWmsService.getVehicleCode(this.device_code); - if (jo.getInteger("status") == 200) { - String vehicle_code = jo.getString("vehicle_code"); - this.writing("to_barcode",vehicle_code); - this.writing(this.mode); - requireSucess = true; - } - - return true; - } - } - - public void executing(Server server, Map 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 itemMap = new HashMap(); - 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 itemMap = new HashMap(); - 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); - - } - - public void writing(String param, String value) { - - String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + param; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(to_param,value); - - ReadUtil.write(itemMap, server); - } - - public static Boolean isExistFieldName(String fieldName, Object obj) throws NoSuchFieldException { - if (obj == null || StrUtil.isEmpty(fieldName)) { - return null; - } - //获取这个类的所有属性 - Field[] fields = obj.getClass().getDeclaredFields(); - boolean flag = false; - //循环遍历所有的fields - for (int i = 0; i < fields.length; i++) { - if (fields[i].getName().equals(fieldName)) { - flag = true; - break; - } - } - return flag; - } -} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_crusher/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_crusher/ItemProtocol.java deleted file mode 100644 index d817123..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_crusher/ItemProtocol.java +++ /dev/null @@ -1,145 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_crusher; - -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_status = "status"; - public static String item_error = "error"; - public static String item_open_time = "open_time"; - public static String item_standby_time = "standby_time"; - public static String item_production_time = "production_time"; - public static String item_error_time = "error_time"; - public static String item_close_time = "close_time"; - public static String item_material = "material"; - public static String item_waitBroken_weight = "waitBroken_weight"; - public static String item_alreadyBroken_weight = "alreadyBroken_weight"; - public static String item_to_command = "to_command"; - public static String item_to_error = "to_error"; - Boolean isonline; - - private LnshCrusherDeviceDriver driver; - - public ItemProtocol(LnshCrusherDeviceDriver driver) { - this.driver = driver; - } - - public int getHeartbeat() { - return this.getOpcIntegerValue(item_heartbeat); - } - - public int getMode() { - return this.getOpcIntegerValue(item_mode); - } - - public int getStatus() { - return this.getOpcIntegerValue(item_status); - } - - public int getError() { - return this.getOpcIntegerValue(item_error); - } - - public int getOpen_time() { - return this.getOpcIntegerValue(item_open_time); - } - - public int getStandby_time() { - return this.getOpcIntegerValue(item_standby_time); - } - - public int getProduction_time() { - return this.getOpcIntegerValue(item_production_time); - } - - public int getError_time() { - return this.getOpcIntegerValue(item_error_time); - } - - public int getClose_time() { - return this.getOpcIntegerValue(item_close_time); - } - - public String getMaterial() { - return this.getOpcStringValue(item_material); - } - - public int getWaitBroken_weight() { - return this.getOpcIntegerValue(item_waitBroken_weight); - } - - public int getAlreadyBroken_weight() { - return this.getOpcIntegerValue(item_alreadyBroken_weight); - } - - public int getTo_command() { - return this.getOpcIntegerValue(item_to_command); - } - - public int getTo_error() { - return this.getOpcIntegerValue(item_to_error); - } - - - //是否有货 - public int hasGoods(int move) { - return move; - } - - - 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 String getOpcStringValue(String protocol) { - String value = this.driver.getStringValue(protocol); - if (value == null) { -// log.error("读取错误!"); - } else { - return value; - } - return "0"; - } - - public static List getReadableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_heartbeat, "心跳", "DB1.B0")); - list.add(new ItemDto(item_mode, "工作状态", "DB1.B1", Boolean.valueOf(true))); - list.add(new ItemDto(item_status, "设备状态", "DB1.B2")); - list.add(new ItemDto(item_error, "故障", "DB1.B3")); - list.add(new ItemDto(item_open_time, "开机时间", "DB1.D4")); - list.add(new ItemDto(item_standby_time, "待机时间", "DB1.D8")); - list.add(new ItemDto(item_production_time, "生产时间", "DB1.D12")); - list.add(new ItemDto(item_error_time, "故障时间", "DB1.D16")); - list.add(new ItemDto(item_close_time, "关机时间", "DB1.D20")); - list.add(new ItemDto(item_material, "当前生产物料", "DB1.S24")); - list.add(new ItemDto(item_waitBroken_weight, "待破碎重量", "DB1.D280")); - list.add(new ItemDto(item_alreadyBroken_weight, "已破碎重量", "DB1.D284")); - return list; - } - - public static List getWriteableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_command, "下发命令", "DB2.W0", Boolean.valueOf(true))); - list.add(new ItemDto(item_to_error, "下发故障", "DB2.W2")); - return list; - } - -} - diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_crusher/LnshCrusherDefination.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_crusher/LnshCrusherDefination.java deleted file mode 100644 index 0ec7ac4..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_crusher/LnshCrusherDefination.java +++ /dev/null @@ -1,78 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_crusher; - -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 LnshCrusherDefination implements OpcDeviceDriverDefination { - @Override - public String getDriverCode() { - return "lnsh_crusher"; - } - - @Override - public String getDriverName() { - return "晟华-破碎机"; - } - - @Override - public String getDriverDescription() { - return "晟华-破碎机"; - } - - @Override - public DeviceDriver getDriverInstance(Device device) { - return (new LnshCrusherDeviceDriver()).setDevice(device).setDriverDefination(this); - } - - @Override - public Class getDeviceDriverType() { - return LnshCrusherDeviceDriver.class; - } - - @Override - public List getFitDeviceTypes() { - List types = new LinkedList(); - types.add(DeviceType.station); - return types; - } - - @Override - public List getReadableItemDtos() { - return getReadableItemDtos2(); - } - - public static List getReadableItemDtos2() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB1.B0")); - list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB1.B1", Boolean.valueOf(true))); - list.add(new ItemDto(ItemProtocol.item_status, "设备状态", "DB1.B2")); - list.add(new ItemDto(ItemProtocol.item_error, "故障", "DB1.B3")); - list.add(new ItemDto(ItemProtocol.item_open_time, "开机时间", "DB1.D4")); - list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "DB1.D8")); - list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "DB1.D12")); - list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "DB1.D16")); - list.add(new ItemDto(ItemProtocol.item_close_time, "关机时间", "DB1.D20")); - list.add(new ItemDto(ItemProtocol.item_material, "当前生产物料", "DB1.S24")); - list.add(new ItemDto(ItemProtocol.item_waitBroken_weight, "待破碎重量", "DB1.D280")); - list.add(new ItemDto(ItemProtocol.item_alreadyBroken_weight, "已破碎重量", "DB1.D284")); - return list; - } - - @Override - public List getWriteableItemDtos() { - return ItemProtocol.getWriteableItemDtos(); - } - -} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_crusher/LnshCrusherDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_crusher/LnshCrusherDeviceDriver.java deleted file mode 100644 index 8b5214d..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_crusher/LnshCrusherDeviceDriver.java +++ /dev/null @@ -1,251 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_crusher; - -import cn.hutool.core.util.StrUtil; -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.DeviceExecuteLogService; -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 LnshCrusherDeviceDriver 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 - DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); - - String device_code; - int mode = 0; - int error = 0; - int last_mode = 0; - int last_error = 0; - Boolean isonline = true; - Boolean iserror = false; - - boolean requireSucess = false; - - int heartbeat; - int last_heartbeat; - private Date checkHeartbeattime = new Date(); - private Date last_checkHeartbeattime = new Date(); - - String message; - int status = 0; - int last_status = 0; - //开机时间 - int open_time = 0; - int last_open_time = 0; - //待机时间 - int standby_time = 0; - int last_standby_time = 0; - //生产时间 - int production_time = 0; - int last_production_time = 0; - //故障时间 - int error_time = 0; - int last_error_time = 0; - //关机时间 - int close_time = 0; - int last_close_time = 0; - //待破碎重量 - int waitBroken_weight = 0; - int last_waitBroken_weight = 0; - - //已破碎重量 - int alreadyBroken_weight = 0; - int last_alreadyBroken_weight = 0; - - String material; - String last_material; - - @Override - public Device getDevice() { - return this.device; - } - - - @Override - public void execute() { - String message = null; - try { - device_code = this.getDeviceCode(); - mode = this.itemProtocol.getMode(); - status = this.itemProtocol.getStatus(); - error = this.itemProtocol.getError(); - open_time = this.itemProtocol.getOpen_time(); - standby_time = this.itemProtocol.getStandby_time(); - production_time = this.itemProtocol.getProduction_time(); - error_time = this.itemProtocol.getError_time(); - close_time = this.itemProtocol.getClose_time(); - material = this.itemProtocol.getMaterial(); - waitBroken_weight = this.itemProtocol.getWaitBroken_weight(); - alreadyBroken_weight = this.itemProtocol.getAlreadyBroken_weight(); - - if (mode != last_mode) { - this.setRequireSucess(false); - logServer.deviceItemValue(this.device_code,"mode" ,String.valueOf(mode)); - logServer.deviceExecuteLog(this.device_code,"","","信号mode:" + last_mode + "->" + mode); - } - if (status != last_status) { - logServer.deviceItemValue(this.device_code,"status" ,String.valueOf(status)); - logServer.deviceExecuteLog(this.device_code,"","","信号status:" + last_status + "->" + status); - } - if (error != last_error) { - logServer.deviceItemValue(this.device_code,"error" ,String.valueOf(error)); - logServer.deviceExecuteLog(this.device_code,"","","信号error:" + last_error + "->" + error); - } - if (open_time != last_open_time) { - logServer.deviceItemValue(this.device_code,"open_time" ,String.valueOf(open_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号open_time:" + last_open_time + "->" + open_time); - } - if (standby_time != last_standby_time) { - logServer.deviceItemValue(this.device_code,"standby_time" ,String.valueOf(standby_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号standby_time:" + last_standby_time + "->" + standby_time); - } - if (production_time != last_production_time) { - logServer.deviceItemValue(this.device_code,"production_time" ,String.valueOf(production_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号production_time:" + last_production_time + "->" + production_time); - } - if (error_time != last_error_time) { - logServer.deviceItemValue(this.device_code,"error_time" ,String.valueOf(error_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号error_time:" + last_error_time + "->" + error_time); - } - if (close_time != last_close_time) { - logServer.deviceItemValue(this.device_code,"close_time" ,String.valueOf(close_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号close_time:" + last_close_time + "->" + close_time); - } - if (!StrUtil.equals(material,last_material)) { - logServer.deviceItemValue(this.device_code,"barcode", material); - logServer.deviceExecuteLog(this.device_code,"","","信号material:" + last_material + "->" + material); - } - if (waitBroken_weight != last_waitBroken_weight) { - logServer.deviceItemValue(this.device_code,"waitBroken_weight" ,String.valueOf(waitBroken_weight)); - logServer.deviceExecuteLog(this.device_code,"","","信号waitBroken_weight:" + last_waitBroken_weight + "->" + waitBroken_weight); - } - if (alreadyBroken_weight != last_alreadyBroken_weight) { - logServer.deviceItemValue(this.device_code,"alreadyBroken_weight" ,String.valueOf(alreadyBroken_weight)); - logServer.deviceExecuteLog(this.device_code,"","","信号alreadyBroken_weight:" + last_alreadyBroken_weight + "->" + alreadyBroken_weight); - } - - } catch (Exception var17) { - return; - } - - //急停 - if (this.isStop()) { - - //未在线无心跳 - } else 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("设备运转模式:等待工作"); - break; - case 2: - - break; - case 3: - - break; - case 4: - break; - } - } - - last_mode = mode; - last_status = status; - last_error = error; - last_open_time = open_time; - last_standby_time = standby_time; - last_production_time = production_time; - last_error_time = error_time; - last_close_time = close_time; - last_material = material; - last_waitBroken_weight = waitBroken_weight; - last_alreadyBroken_weight = alreadyBroken_weight; - } - - - protected void thingToNothing() throws Exception { - this.setRequireSucess(false); - } - - 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 itemMap) { - ReadUtil.write(itemMap, server); - } - - public void writing(String param, String value) { - - String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + param; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - - itemMap.put(to_param, value); - ReadUtil.write(itemMap, server); - } - -} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_fold_disc_site/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_fold_disc_site/ItemProtocol.java deleted file mode 100644 index 0b7c531..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_fold_disc_site/ItemProtocol.java +++ /dev/null @@ -1,123 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_fold_disc_site; - -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_status = "status"; - public static String item_open_time = "open_time"; - public static String item_close_time = "close_time"; - public static String item_standby_time = "standby_time"; - public static String item_production_time = "production_time"; - public static String item_error_time = "error_time"; - public static String item_container_qty = "container_qty"; - public static String item_to_command = "to_command"; - public static String item_to_target = "to_target"; - public static String item_to_task = "to_task"; - Boolean isonline; - - private LnshFoldDiscSiteDeviceDriver driver; - - public ItemProtocol(LnshFoldDiscSiteDeviceDriver driver) { - this.driver = driver; - } - - public int getHeartbeat() { - return this.getOpcIntegerValue(item_heartbeat); - } - - public int getMode() { - return this.getOpcIntegerValue(item_mode); - } - - public int getStatus() { - return this.getOpcIntegerValue(item_status); - } - - public int getOpen_time() { - return this.getOpcIntegerValue(item_open_time); - } - - public int getClose_time() { - return this.getOpcIntegerValue(item_close_time); - } - - public int getStandby_time() { - return this.getOpcIntegerValue(item_standby_time); - } - - public int getProduction_time() { - return this.getOpcIntegerValue(item_production_time); - } - - public int getError_time() { - return this.getOpcIntegerValue(item_error_time); - } - - public int getContainer_qty() { - return this.getOpcIntegerValue(item_container_qty); - } - - 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; - } - - - 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 getReadableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_heartbeat, "心跳", "DB49.B0")); - list.add(new ItemDto(item_mode, "工作状态", "DB49.B1", Boolean.valueOf(true))); - list.add(new ItemDto(item_status, "设备状态", "DB49.B2")); - list.add(new ItemDto(item_open_time, "开机时间", "DB49.D4")); - list.add(new ItemDto(item_close_time, "关机时间", "DB49.D8")); - list.add(new ItemDto(item_standby_time, "待机时间", "DB49.D12")); - list.add(new ItemDto(item_production_time, "生产时间", "DB49.D16")); - list.add(new ItemDto(item_error_time, "故障时间", "DB49.D20")); - list.add(new ItemDto(item_container_qty, "托盘数", "DB49.D24")); - return list; - } - - public static List getWriteableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_command, "下发命令反馈", "DB50.W0", Boolean.valueOf(true))); - list.add(new ItemDto(item_to_target, "下发目标站", "DB50.W2")); - list.add(new ItemDto(item_to_task, "下发任务号", "DB50.D4")); - return list; - } - -} - diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_fold_disc_site/LnshFoldDiscSiteDefination.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_fold_disc_site/LnshFoldDiscSiteDefination.java deleted file mode 100644 index 272ab51..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_fold_disc_site/LnshFoldDiscSiteDefination.java +++ /dev/null @@ -1,75 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_fold_disc_site; - -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 LnshFoldDiscSiteDefination implements OpcDeviceDriverDefination { - @Override - public String getDriverCode() { - return "lnsh_fold_disc_site"; - } - - @Override - public String getDriverName() { - return "晟华-叠盘机"; - } - - @Override - public String getDriverDescription() { - return "晟华-叠盘机"; - } - - @Override - public DeviceDriver getDriverInstance(Device device) { - return (new LnshFoldDiscSiteDeviceDriver()).setDevice(device).setDriverDefination(this); - } - - @Override - public Class getDeviceDriverType() { - return LnshFoldDiscSiteDeviceDriver.class; - } - - @Override - public List getFitDeviceTypes() { - List types = new LinkedList(); - types.add(DeviceType.station); - return types; - } - - @Override - public List getReadableItemDtos() { - return getReadableItemDtos2(); - } - - public static List getReadableItemDtos2() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB49.B0")); - list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB49.B1", Boolean.valueOf(true))); - list.add(new ItemDto(ItemProtocol.item_status, "设备状态", "DB49.B2")); - list.add(new ItemDto(ItemProtocol.item_open_time, "开机时间", "DB49.D4")); - list.add(new ItemDto(ItemProtocol.item_close_time, "关机时间", "DB49.D8")); - list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "DB49.D12")); - list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "DB49.D16")); - list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "DB49.D20")); - list.add(new ItemDto(ItemProtocol.item_container_qty, "托盘数", "DB49.D24")); - return list; - } - - @Override - public List getWriteableItemDtos() { - return ItemProtocol.getWriteableItemDtos(); - } - -} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_fold_disc_site/LnshFoldDiscSiteDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_fold_disc_site/LnshFoldDiscSiteDeviceDriver.java deleted file mode 100644 index ad57956..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_fold_disc_site/LnshFoldDiscSiteDeviceDriver.java +++ /dev/null @@ -1,268 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_fold_disc_site; - -import cn.hutool.core.date.DateUtil; -import cn.hutool.core.util.IdUtil; -import cn.hutool.core.util.StrUtil; -import cn.hutool.http.HttpResponse; -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.ext.wms.service.AcsToWmsService; -import org.nl.acs.instruction.service.InstructionService; -import org.nl.acs.instruction.service.dto.Instruction; - -import org.nl.acs.log.service.DeviceExecuteLogService; -import org.nl.acs.opc.Device; -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.*; - -/** - * 晟华叠盘机 - */ -@Slf4j -@Data -@RequiredArgsConstructor -public class LnshFoldDiscSiteDeviceDriver 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 - DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); - @Autowired - AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl"); - String device_code; - int mode = 0; - int error = 0; - int move = 0; - int last_mode = 0; - int last_error = 0; - int last_move = 0; - Boolean isonline = true; - int hasGoods = 0; - Boolean iserror = false; - - boolean requireSucess = false; - - int heartbeat; - int last_heartbeat; - private Date checkHeartbeattime = new Date(); - private Date last_checkHeartbeattime = new Date(); - - int branchProtocol = 0; - - private Date instruction_require_time = new Date(); - private Date instruction_finished_time = new Date(); - - private int instruction_require_time_out; - private int instruction_finished_time_out; - - String message; - int status = 0; - int last_status = 0; - //开机时间 - int open_time = 0; - int last_open_time = 0; - int close_time = 0; - int last_close_time = 0; - //待机时间 - int standby_time = 0; - int last_standby_time = 0; - //生产时间 - int production_time = 0; - int last_production_time = 0; - //故障时间 - int error_time = 0; - int last_error_time = 0; - int container_qty = 0; - int last_container_qty = 0; - - @Override - public Device getDevice() { - return this.device; - } - - - @Override - public void execute() { - String message = null; - try { - device_code = this.getDeviceCode(); - mode = this.itemProtocol.getMode(); - status = this.itemProtocol.getStatus(); - open_time = this.itemProtocol.getOpen_time(); - close_time = this.itemProtocol.getClose_time(); - standby_time = this.itemProtocol.getStandby_time(); - production_time = this.itemProtocol.getProduction_time(); - error_time = this.itemProtocol.getError_time(); - container_qty = this.itemProtocol.getContainer_qty(); - - if (mode != last_mode) { - this.setRequireSucess(false); - logServer.deviceItemValue(this.device_code,"mode" ,String.valueOf(mode)); - logServer.deviceExecuteLog(this.device_code,"","","信号mode:" + last_mode + "->" + mode); - } - if (status != last_status) { - logServer.deviceItemValue(this.device_code,"status" ,String.valueOf(status)); - logServer.deviceExecuteLog(this.device_code,"","","信号status:" + last_status + "->" + status); - } - if (open_time != last_open_time) { - logServer.deviceItemValue(this.device_code,"open_time" ,String.valueOf(open_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号open_time:" + last_open_time + "->" + open_time); - } - if (close_time != last_close_time) { - logServer.deviceItemValue(this.device_code,"close_time" ,String.valueOf(close_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号close_time:" + last_close_time + "->" + close_time); - } - if (standby_time != last_standby_time) { - logServer.deviceItemValue(this.device_code,"standby_time" ,String.valueOf(standby_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号standby_time:" + last_standby_time + "->" + standby_time); - } - if (production_time != last_production_time) { - logServer.deviceItemValue(this.device_code,"production_time" ,String.valueOf(production_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号production_time:" + last_production_time + "->" + production_time); - } - if (error_time != last_error_time) { - logServer.deviceItemValue(this.device_code,"error_time" ,String.valueOf(error_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号error_time:" + last_error_time + "->" + error_time); - } - if (container_qty != last_container_qty) { - logServer.deviceItemValue(this.device_code,"container_qty" ,String.valueOf(container_qty)); - logServer.deviceExecuteLog(this.device_code,"","","信号container_qty:" + last_container_qty + "->" + container_qty); - } - - } catch (Exception var17) { - return; - } - - //急停 - if (this.isStop()) { - - //未在线无心跳 - } else 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("设备运转模式:等待工作"); - break; - case 2: - - break; - case 3: - if (!requireSucess) { - palletizing(); - } - break; - case 4: - break; - } - } - - last_mode = mode; - last_status = status; - last_open_time = open_time; - last_close_time = close_time; - last_standby_time = standby_time; - last_production_time = production_time; - last_error_time = error_time; - last_container_qty = container_qty; - } - - - /** - * 拆垛完成 - * - * @param - */ - public synchronized boolean palletizing() { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - JSONObject json = new JSONObject(); - json.put("device_code",device_code); - json.put("type","3"); - HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); - if (result.getStatus() == 200) { - this.writing(this.mode); - requireSucess = true; - } - return true; - } - } - - public void writing(String param, String value) { - - String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + param; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - if (value instanceof String) { - itemMap.put(to_param, value); - } else { - itemMap.put(to_param, Integer.parseInt(value)); - } - ReadUtil.write(itemMap, server); - } - - public void executing(Server server, Map 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 itemMap = new HashMap(); - itemMap.put(to_command, command); - ReadUtil.write(itemMap, server); - - } - -} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_lane/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_lane/ItemProtocol.java deleted file mode 100644 index 06146cf..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_lane/ItemProtocol.java +++ /dev/null @@ -1,123 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_kiln_lane; - -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_status = "status"; - public static String item_open_time = "open_time"; - public static String item_standby_time = "standby_time"; - public static String item_production_time = "production_time"; - public static String item_error_time = "error_time"; - public static String item_car_sum = "car_sum"; - public static String item_nullCar_qty = "nullCar_qty"; - public static String item_burning_car_qty = "burning_car_qty"; - public static String item_to_command = "to_command"; - public static String item_to_material_code = "to_material_code"; - Boolean isonline; - - private LnshKilnLaneDeviceDriver driver; - - public ItemProtocol(LnshKilnLaneDeviceDriver driver) { - this.driver = driver; - } - - public int getHeartbeat() { - return this.getOpcIntegerValue(item_heartbeat); - } - - public int getMode() { - return this.getOpcIntegerValue(item_mode); - } - - public int getStatus() { - return this.getOpcIntegerValue(item_status); - } - - public int getOpen_time() { - return this.getOpcIntegerValue(item_open_time); - } - - public int getStandby_time() { - return this.getOpcIntegerValue(item_standby_time); - } - - public int getProduction_time() { - return this.getOpcIntegerValue(item_production_time); - } - - public int getError_time() { - return this.getOpcIntegerValue(item_error_time); - } - - public int getCar_sum() { - return this.getOpcIntegerValue(item_car_sum); - } - - public int getNullCar_qty() { - return this.getOpcIntegerValue(item_nullCar_qty); - } - - public int getBurning_car_qty() { - return this.getOpcIntegerValue(item_burning_car_qty); - } - - public int getToCommand() { - return this.getOpcIntegerValue(item_to_command); - } - - public int getTo_material_code() { - return this.getOpcIntegerValue(item_to_material_code); - } - - //是否有货 - public int hasGoods(int move) { - return move; - } - - - 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 getReadableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_heartbeat, "心跳", "DB3.B0")); - list.add(new ItemDto(item_mode, "工作状态", "DB3.B1", Boolean.valueOf(true))); - list.add(new ItemDto(item_status, "设备状态", "DB3.B2")); - list.add(new ItemDto(item_open_time, "开机时间", "DB3.D4")); - list.add(new ItemDto(item_standby_time, "待机时间", "DB3.D8")); - list.add(new ItemDto(item_production_time, "生产时间", "DB3.D12")); - list.add(new ItemDto(item_error_time, "故障时间", "DB3.D16")); - list.add(new ItemDto(item_car_sum, "窑车总数", "DB3.D20")); - list.add(new ItemDto(item_nullCar_qty, "空窑车数", "DB3.D24")); - list.add(new ItemDto(item_burning_car_qty, "在烧窑车数", "DB3.D28")); - return list; - } - - public static List getWriteableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_command, "下发命令", "DB4.W0", Boolean.valueOf(true))); - list.add(new ItemDto(item_to_material_code, "下发物料编号", "DB4.D2")); - return list; - } - -} - diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_lane/LnshKilnLaneDefination.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_lane/LnshKilnLaneDefination.java deleted file mode 100644 index a39a4f1..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_lane/LnshKilnLaneDefination.java +++ /dev/null @@ -1,76 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_kiln_lane; - -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 LnshKilnLaneDefination implements OpcDeviceDriverDefination { - @Override - public String getDriverCode() { - return "lnsh_kiln_lane"; - } - - @Override - public String getDriverName() { - return "晟华-窑车道"; - } - - @Override - public String getDriverDescription() { - return "晟华-窑车道"; - } - - @Override - public DeviceDriver getDriverInstance(Device device) { - return (new LnshKilnLaneDeviceDriver()).setDevice(device).setDriverDefination(this); - } - - @Override - public Class getDeviceDriverType() { - return LnshKilnLaneDeviceDriver.class; - } - - @Override - public List getFitDeviceTypes() { - List types = new LinkedList(); - types.add(DeviceType.station); - return types; - } - - @Override - public List getReadableItemDtos() { - return getReadableItemDtos2(); - } - - public static List getReadableItemDtos2() { - List list = new ArrayList(); - list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB3.B0")); - list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB3.B1", Boolean.valueOf(true))); - list.add(new ItemDto(ItemProtocol.item_status, "设备状态", "DB3.B2")); - list.add(new ItemDto(ItemProtocol.item_open_time, "开机时间", "DB3.D4")); - list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "DB3.D8")); - list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "DB3.D12")); - list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "DB3.D16")); - list.add(new ItemDto(ItemProtocol.item_car_sum, "窑车总数", "DB3.D20")); - list.add(new ItemDto(ItemProtocol.item_nullCar_qty, "空窑车数", "DB3.D24")); - list.add(new ItemDto(ItemProtocol.item_burning_car_qty, "在烧窑车数", "DB3.D28")); - return list; - } - - @Override - public List getWriteableItemDtos() { - return ItemProtocol.getWriteableItemDtos(); - } - -} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_lane/LnshKilnLaneDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_lane/LnshKilnLaneDeviceDriver.java deleted file mode 100644 index 3ce998e..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_lane/LnshKilnLaneDeviceDriver.java +++ /dev/null @@ -1,252 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_kiln_lane; - -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.DeviceExecuteLogService; -import org.nl.acs.opc.Device; -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.*; - -/** - * 晟华窑车道 - */ -@Slf4j -@Data -@RequiredArgsConstructor -public class LnshKilnLaneDeviceDriver 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 - DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); - - String device_code; - int mode = 0; - int error = 0; - int move = 0; - int last_mode = 0; - int last_error = 0; - int last_move = 0; - Boolean isonline = true; - int hasGoods = 0; - Boolean iserror = false; - - boolean requireSucess = false; - - int heartbeat; - int last_heartbeat; - - int branchProtocol = 0; - - - String message; - int status = 0; - int last_status = 0; - //开机时间 - int open_time = 0; - int last_open_time = 0; - //待机时间 - int standby_time = 0; - int last_standby_time = 0; - //生产时间 - int production_time = 0; - int last_production_time = 0; - //故障时间 - int error_time = 0; - int last_error_time = 0; - //窑车总数 - int car_sum = 0; - int last_car_sum = 0; - //空窑车数 - int nullCar_qty = 0; - int last_nullCar_qty = 0; - //在烧窑车数 - int burning_car_qty = 0; - int last_burning_car_qty = 0; - - @Override - public Device getDevice() { - return this.device; - } - - - @Override - public void execute() { - String message = null; - try { - device_code = this.getDeviceCode(); - mode = this.itemProtocol.getMode(); - status = this.itemProtocol.getStatus(); - open_time = this.itemProtocol.getOpen_time(); - standby_time = this.itemProtocol.getStandby_time(); - production_time = this.itemProtocol.getProduction_time(); - error_time = this.itemProtocol.getError_time(); - car_sum = this.itemProtocol.getCar_sum(); - nullCar_qty = this.itemProtocol.getNullCar_qty(); - burning_car_qty = this.itemProtocol.getBurning_car_qty(); - - if (mode != last_mode) { - this.setRequireSucess(false); - logServer.deviceItemValue(this.device_code,"mode" ,String.valueOf(mode)); - logServer.deviceExecuteLog(this.device_code,"","","信号mode:" + last_mode + "->" + mode); - } - if (status != last_status) { - logServer.deviceItemValue(this.device_code,"status" ,String.valueOf(status)); - logServer.deviceExecuteLog(this.device_code,"","","信号status:" + last_status + "->" + status); - } - if (open_time != last_open_time) { - logServer.deviceItemValue(this.device_code,"open_time" ,String.valueOf(open_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号open_time:" + last_open_time + "->" + open_time); - } - if (standby_time != last_standby_time) { - logServer.deviceItemValue(this.device_code,"standby_time" ,String.valueOf(standby_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号standby_time:" + last_standby_time + "->" + standby_time); - } - if (production_time != last_production_time) { - logServer.deviceItemValue(this.device_code,"production_time" ,String.valueOf(production_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号production_time:" + last_production_time + "->" + production_time); - } - if (error_time != last_error_time) { - logServer.deviceItemValue(this.device_code,"error_time" ,String.valueOf(error_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号error_time:" + last_error_time + "->" + error_time); - } - if (car_sum != last_car_sum) { - logServer.deviceItemValue(this.device_code,"car_sum" ,String.valueOf(car_sum)); - logServer.deviceExecuteLog(this.device_code,"","","信号car_sum:" + last_car_sum + "->" + car_sum); - } - if (nullCar_qty != last_nullCar_qty) { - logServer.deviceItemValue(this.device_code,"nullCar_qty" ,String.valueOf(nullCar_qty)); - logServer.deviceExecuteLog(this.device_code,"","","信号nullCar_qty:" + last_nullCar_qty + "->" + nullCar_qty); - } - if (burning_car_qty != last_burning_car_qty) { - logServer.deviceItemValue(this.device_code,"burning_car_qty" ,String.valueOf(burning_car_qty)); - logServer.deviceExecuteLog(this.device_code,"","","信号burning_car_qty:" + last_burning_car_qty + "->" + burning_car_qty); - } - - } catch (Exception var17) { - return; - } - - //急停 - if (this.isStop()) { - - //未在线无心跳 - } else 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("设备运转模式:等待工作"); - break; - case 2: - - break; - case 3: - - break; - case 4: - break; - } - } - - last_mode = mode; - last_status = status; - last_open_time = open_time; - last_standby_time = standby_time; - last_production_time = production_time; - last_error_time = error_time; - last_car_sum = car_sum; - last_nullCar_qty = nullCar_qty; - last_burning_car_qty = burning_car_qty; - } - - - public boolean exe_error() { - if (this.error == 0) { - return true; - } else { - log.debug("设备报警"); - return false; - } - } - - public void writing(String param, String value) { - - String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + param; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - if (value instanceof String) { - itemMap.put(to_param, value); - } else { - itemMap.put(to_param, Integer.parseInt(value)); - } - ReadUtil.write(itemMap, server); - } - - public void executing(Server server, Map 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() - + "." + org.nl.acs.device_driver.lnsh.lnsh_fold_disc_site.ItemProtocol.item_to_command; - - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(to_command, command); - ReadUtil.write(itemMap, server); - - } - -} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_truss/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_truss/ItemProtocol.java deleted file mode 100644 index ea0390b..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_truss/ItemProtocol.java +++ /dev/null @@ -1,111 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_kiln_truss; - -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_status = "status"; - public static String item_open_time = "open_time"; - public static String item_standby_time = "standby_time"; - public static String item_production_time = "production_time"; - public static String item_error_time = "error_time"; - public static String item_to_command = "to_command"; - public static String item_to_target = "to_target"; - public static String item_to_task = "to_task"; - Boolean isonline; - - private LnshKilnTrussDeviceDriver driver; - - public ItemProtocol(LnshKilnTrussDeviceDriver driver) { - this.driver = driver; - } - - public int getHeartbeat() { - return this.getOpcIntegerValue(item_heartbeat); - } - - public int getMode() { - return this.getOpcIntegerValue(item_mode); - } - - public int getStatus() { - return this.getOpcIntegerValue(item_status); - } - - public int getOpen_time() { - return this.getOpcIntegerValue(item_open_time); - } - - public int getStandby_time() { - return this.getOpcIntegerValue(item_standby_time); - } - - public int getProduction_time() { - return this.getOpcIntegerValue(item_production_time); - } - - public int getError_time() { - return this.getOpcIntegerValue(item_error_time); - } - - public int getTo_command() { - return this.getOpcIntegerValue(item_to_command); - } - - public int getTo_target() { - return this.getOpcIntegerValue(item_to_target); - } - - public int getTo_task() { - return this.getOpcIntegerValue(item_to_task); - } - - //是否有货 - public int hasGoods(int move) { - return move; - } - - - 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 getReadableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_heartbeat, "心跳", "DB1.B0")); - list.add(new ItemDto(item_mode, "工作状态", "DB1.B1", Boolean.valueOf(true))); - list.add(new ItemDto(item_status, "设备状态", "DB1.B2")); - list.add(new ItemDto(item_open_time, "开机时间", "DB1.D4")); - list.add(new ItemDto(item_standby_time, "待机时间", "DB1.D8")); - list.add(new ItemDto(item_production_time, "生产时间", "DB1.D12")); - list.add(new ItemDto(item_error_time, "故障时间", "DB1.D16")); - return list; - } - - public static List getWriteableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_command, "下发命令反馈", "DB2.W0", Boolean.valueOf(true))); - list.add(new ItemDto(item_to_target, "下发目标站", "DB2.W2")); - list.add(new ItemDto(item_to_task, "下发任务号", "DB2.D4")); - return list; - } - -} - diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_truss/LnshKilnTrussDefination.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_truss/LnshKilnTrussDefination.java deleted file mode 100644 index 99882aa..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_truss/LnshKilnTrussDefination.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_kiln_truss; - -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 LnshKilnTrussDefination implements OpcDeviceDriverDefination { - @Override - public String getDriverCode() { - return "lnsh_kiln_truss"; - } - - @Override - public String getDriverName() { - return "晟华-入出窑桁架"; - } - - @Override - public String getDriverDescription() { - return "晟华-入出窑桁架"; - } - - @Override - public DeviceDriver getDriverInstance(Device device) { - return (new LnshKilnTrussDeviceDriver()).setDevice(device).setDriverDefination(this); - } - - @Override - public Class getDeviceDriverType() { - return LnshKilnTrussDeviceDriver.class; - } - - @Override - public List getFitDeviceTypes() { - List types = new LinkedList(); - types.add(DeviceType.station); - return types; - } - - @Override - public List getReadableItemDtos() { - return getReadableItemDtos2(); - } - - public static List getReadableItemDtos2() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB1.B0")); - list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB1.B1", Boolean.valueOf(true))); - list.add(new ItemDto(ItemProtocol.item_status, "设备状态", "DB1.B2")); - list.add(new ItemDto(ItemProtocol.item_open_time, "开机时间", "DB1.D4")); - list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "DB1.D8")); - list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "DB1.D12")); - list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "DB1.D16")); - return list; - } - - @Override - public List getWriteableItemDtos() { - return ItemProtocol.getWriteableItemDtos(); - } - -} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_truss/LnshKilnTrussDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_truss/LnshKilnTrussDeviceDriver.java deleted file mode 100644 index 9822ef3..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_truss/LnshKilnTrussDeviceDriver.java +++ /dev/null @@ -1,192 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_kiln_truss; - -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.DeviceExecuteLogService; -import org.nl.acs.opc.Device; -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.*; - -/** - * 晟华入出窑桁架 - */ -@Slf4j -@Data -@RequiredArgsConstructor -public class LnshKilnTrussDeviceDriver 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 - DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); - - String device_code; - int mode = 0; - int error = 0; - int move = 0; - int last_mode = 0; - int last_error = 0; - int last_move = 0; - Boolean isonline = true; - int hasGoods = 0; - Boolean iserror = false; - - boolean requireSucess = false; - - private Date checkHeartbeattime = new Date(); - private Date last_checkHeartbeattime = new Date(); - - int branchProtocol = 0; - - //触摸屏手动触发任务 - private Boolean is_has_task = false; - - String message; - int status = 0; - int last_status = 0; - - int open_time = 0; - int last_open_time = 0; - int standby_time = 0; - int last_standby_time = 0; - int production_time = 0; - int last_production_time = 0; - int error_time = 0; - int last_error_time = 0; - - @Override - public Device getDevice() { - return this.device; - } - - - @Override - public void execute() { - String message = null; - try { - device_code = this.getDeviceCode(); - mode = this.itemProtocol.getMode(); - status = this.itemProtocol.getStatus(); - open_time = this.itemProtocol.getOpen_time(); - standby_time = this.itemProtocol.getStandby_time(); - production_time = this.itemProtocol.getProduction_time(); - error_time = this.itemProtocol.getError_time(); - - if (mode != last_mode) { - this.setRequireSucess(false); - logServer.deviceItemValue(this.device_code,"mode" ,String.valueOf(mode)); - logServer.deviceExecuteLog(this.device_code,"","","信号mode:" + last_mode + "->" + mode); - } - if (status != last_status) { - logServer.deviceItemValue(this.device_code,"status" ,String.valueOf(status)); - logServer.deviceExecuteLog(this.device_code,"","","信号status:" + last_status + "->" + status); - } - if (open_time != last_open_time) { - logServer.deviceItemValue(this.device_code,"open_time" ,String.valueOf(open_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号open_time:" + last_open_time + "->" + open_time); - } - if (standby_time != last_standby_time) { - logServer.deviceItemValue(this.device_code,"standby_time" ,String.valueOf(standby_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号standby_time:" + last_standby_time + "->" + standby_time); - } - if (production_time != last_production_time) { - logServer.deviceItemValue(this.device_code,"production_time" ,String.valueOf(production_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号production_time:" + last_production_time + "->" + production_time); - } - if (error_time != last_error_time) { - logServer.deviceItemValue(this.device_code,"error_time" ,String.valueOf(error_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号error_time:" + last_error_time + "->" + error_time); - } - - } catch (Exception var17) { - return; - } - - //急停 - if (this.isStop()) { - - //未在线无心跳 - } else 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("设备运转模式:等待工作"); - break; - case 2: - - break; - case 3: - - break; - case 4: - break; - } - } - - last_mode = mode; - last_status = status; - last_open_time = open_time; - last_standby_time = standby_time; - last_production_time = production_time; - last_error_time = error_time; - } - - public boolean exe_error() { - if (this.error == 0) { - return true; - } else { - log.debug("设备报警"); - return false; - } - } - -} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_labeling_machine/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_labeling_machine/ItemProtocol.java deleted file mode 100644 index 861b53f..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_labeling_machine/ItemProtocol.java +++ /dev/null @@ -1,117 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_labeling_machine; - -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_status = "status"; - public static String item_open_time = "open_time"; - public static String item_close_time = "close_time"; - public static String item_standby_time = "standby_time"; - public static String item_production_time = "production_time"; - public static String item_error_time = "error_time"; - public static String item_labeling_qty = "labeling_qty"; - public static String item_to_command = "to_command"; - public static String item_to_material_code = "to_material_code"; - Boolean isonline; - - private LnshLabelingMachineDeviceDriver driver; - - public ItemProtocol(LnshLabelingMachineDeviceDriver driver) { - this.driver = driver; - } - - public int getHeartbeat() { - return this.getOpcIntegerValue(item_heartbeat); - } - - public int getMode() { - return this.getOpcIntegerValue(item_mode); - } - - public int getStatus() { - return this.getOpcIntegerValue(item_status); - } - - public int getOpen_time() { - return this.getOpcIntegerValue(item_open_time); - } - - public int getClose_time() { - return this.getOpcIntegerValue(item_close_time); - } - - public int getStandby_time() { - return this.getOpcIntegerValue(item_standby_time); - } - - public int getProduction_time() { - return this.getOpcIntegerValue(item_production_time); - } - - public int getError_time() { - return this.getOpcIntegerValue(item_error_time); - } - - public int getLabeling_qty() { - return this.getOpcIntegerValue(item_labeling_qty); - } - - public int getToCommand() { - return this.getOpcIntegerValue(item_to_command); - } - - public int getTo_material_code() { - return this.getOpcIntegerValue(item_to_material_code); - } - - //是否有货 - public int hasGoods(int move) { - return move; - } - - - 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 getReadableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_heartbeat, "心跳", "DB600.B0")); - list.add(new ItemDto(item_mode, "工作状态", "DB600.B1", Boolean.valueOf(true))); - list.add(new ItemDto(item_status, "设备状态", "DB600.B2")); - list.add(new ItemDto(item_open_time, "开机时间", "DB600.D4")); - list.add(new ItemDto(item_close_time, "关机时间", "DB600.D8")); - list.add(new ItemDto(item_standby_time, "待机时间", "DB600.D12")); - list.add(new ItemDto(item_production_time, "生产时间", "DB600.D16")); - list.add(new ItemDto(item_error_time, "故障时间", "DB600.D20")); - list.add(new ItemDto(item_labeling_qty, "贴标数量", "DB600.D24")); - return list; - } - - public static List getWriteableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_command, "下发命令", "DB601.W0", Boolean.valueOf(true))); - list.add(new ItemDto(item_to_material_code, "下发物料编号", "DB601.D2")); - return list; - } - -} - diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_labeling_machine/LnshLabelingMachineDefination.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_labeling_machine/LnshLabelingMachineDefination.java deleted file mode 100644 index 7d79242..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_labeling_machine/LnshLabelingMachineDefination.java +++ /dev/null @@ -1,75 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_labeling_machine; - -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 LnshLabelingMachineDefination implements OpcDeviceDriverDefination { - @Override - public String getDriverCode() { - return "lnsh_labeling_machine"; - } - - @Override - public String getDriverName() { - return "晟华-贴标机"; - } - - @Override - public String getDriverDescription() { - return "晟华-贴标机"; - } - - @Override - public DeviceDriver getDriverInstance(Device device) { - return (new LnshLabelingMachineDeviceDriver()).setDevice(device).setDriverDefination(this); - } - - @Override - public Class getDeviceDriverType() { - return LnshLabelingMachineDeviceDriver.class; - } - - @Override - public List getFitDeviceTypes() { - List types = new LinkedList(); - types.add(DeviceType.station); - return types; - } - - @Override - public List getReadableItemDtos() { - return getReadableItemDtos2(); - } - - public static List getReadableItemDtos2() { - ArrayList 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_status, "设备状态", "DB600.B3")); - list.add(new ItemDto(ItemProtocol.item_open_time, "开机时间", "DB600.D6")); - list.add(new ItemDto(ItemProtocol.item_close_time, "关机时间", "DB600.D10")); - list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "DB600.D14")); - list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "DB600.D18")); - list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "DB600.D22")); - list.add(new ItemDto(ItemProtocol.item_labeling_qty, "贴标数量", "DB600.D26")); - return list; - } - - @Override - public List getWriteableItemDtos() { - return ItemProtocol.getWriteableItemDtos(); - } - -} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_labeling_machine/LnshLabelingMachineDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_labeling_machine/LnshLabelingMachineDeviceDriver.java deleted file mode 100644 index b7b38b0..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_labeling_machine/LnshLabelingMachineDeviceDriver.java +++ /dev/null @@ -1,239 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_labeling_machine; - -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.ext.wms.service.AcsToWmsService; -import org.nl.acs.instruction.service.InstructionService; -import org.nl.acs.instruction.service.dto.Instruction; -import org.nl.acs.log.service.DeviceExecuteLogService; -import org.nl.acs.opc.Device; -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.*; - -/** - * 晟华贴标机 - */ -@Slf4j -@Data -@RequiredArgsConstructor -public class LnshLabelingMachineDeviceDriver 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 - DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); - @Autowired - AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl"); - - String device_code; - int mode = 0; - int error = 0; - int last_mode = 0; - int last_error = 0; - Boolean isonline = true; - Boolean iserror = false; - boolean requireSucess = false; - - int heartbeat; - private Date checkHeartbeattime = new Date(); - private Date last_checkHeartbeattime = new Date(); - - String message; - int status = 0; - int last_status = 0; - //开机时间 - int open_time = 0; - int last_open_time = 0; - int close_time = 0; - int last_close_time = 0; - //待机时间 - int standby_time = 0; - int last_standby_time = 0; - //生产时间 - int production_time = 0; - int last_production_time = 0; - //故障时间 - int error_time = 0; - int last_error_time = 0; - //贴标数量 - int labeling_qty = 0; - int last_labeling_qty = 0; - - - @Override - public Device getDevice() { - return this.device; - } - - - @Override - public void execute() { - String message = null; - try { - device_code = this.getDeviceCode(); - mode = this.itemProtocol.getMode(); - status = this.itemProtocol.getStatus(); - open_time = this.itemProtocol.getOpen_time(); - close_time = this.itemProtocol.getClose_time(); - standby_time = this.itemProtocol.getStandby_time(); - production_time = this.itemProtocol.getProduction_time(); - error_time = this.itemProtocol.getError_time(); - labeling_qty = this.itemProtocol.getLabeling_qty(); - - if (mode != last_mode) { - this.setRequireSucess(false); - logServer.deviceItemValue(this.device_code,"mode" ,String.valueOf(mode)); - logServer.deviceExecuteLog(this.device_code,"","","信号mode:" + last_mode + "->" + mode); - } - if (status != last_status) { - logServer.deviceItemValue(this.device_code,"status" ,String.valueOf(status)); - logServer.deviceExecuteLog(this.device_code,"","","信号status:" + last_status + "->" + status); - } - if (open_time != last_open_time) { - logServer.deviceItemValue(this.device_code,"open_time" ,String.valueOf(open_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号open_time:" + last_open_time + "->" + open_time); - } - if (close_time != last_close_time) { - logServer.deviceItemValue(this.device_code,"close_time" ,String.valueOf(close_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号close_time:" + last_close_time + "->" + close_time); - } - if (standby_time != last_standby_time) { - logServer.deviceItemValue(this.device_code,"standby_time" ,String.valueOf(standby_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号standby_time:" + last_standby_time + "->" + standby_time); - } - if (production_time != last_production_time) { - logServer.deviceItemValue(this.device_code,"production_time" ,String.valueOf(production_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号production_time:" + last_production_time + "->" + production_time); - } - if (error_time != last_error_time) { - logServer.deviceItemValue(this.device_code,"error_time" ,String.valueOf(error_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号error_time:" + last_error_time + "->" + error_time); - } - if (labeling_qty != last_labeling_qty) { - logServer.deviceItemValue(this.device_code,"labeling_qty" ,String.valueOf(labeling_qty)); - logServer.deviceExecuteLog(this.device_code,"","","信号labeling_qty:" + last_labeling_qty + "->" + labeling_qty); - } - - } catch (Exception var17) { - return; - } - - //急停 - if (this.isStop()) { - - //未在线无心跳 - } else 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("设备运转模式:等待工作"); - break; - case 2: - - break; - case 3: - - break; - case 4: - break; - } - } - last_mode = mode; - last_status = status; - last_open_time = open_time; - last_close_time = close_time; - last_standby_time = standby_time; - last_production_time = production_time; - last_error_time = error_time; - last_labeling_qty = labeling_qty; - } - - - protected void thingToNothing() throws Exception { - this.setRequireSucess(false); - } - - 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 itemMap) { - ReadUtil.write(itemMap, server); - } - - public void writing(int command) { - - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - ReadUtil.write(itemMap, server); - - } - - public void writing(String param, String value) { - - String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + param; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(to_param, value); - - ReadUtil.write(itemMap, server); - } -} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/ItemProtocol.java deleted file mode 100644 index 40b13b4..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/ItemProtocol.java +++ /dev/null @@ -1,163 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_mixing_mill; - -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_status = "status"; - public static String item_error = "error"; - public static String item_open_time = "open_time"; - public static String item_standby_time = "standby_time"; - public static String item_production_time = "production_time"; - public static String item_error_time = "error_time"; - public static String item_weight = "weight"; - public static String item_order_No = "order_No"; - public static String item_mix_num = "mix_num"; - public static String item_material = "material"; - public static String item_to_command = "to_command"; - public static String item_to_error = "to_error"; - public static String item_to_order_No = "to_order_No"; - public static String item_to_weight = "to_weight"; - public static String item_to_material_code = "to_material_code"; - - - private LnshMixingMillDeviceDriver driver; - - public ItemProtocol(LnshMixingMillDeviceDriver driver) { - this.driver = driver; - } - - public int getHeartbeat() { - return this.getOpcIntegerValue(item_heartbeat); - } - - public int getMode() { - return this.getOpcIntegerValue(item_mode); - } - - public int getStatus() { - return this.getOpcIntegerValue(item_status); - } - - public int getError() { - return this.getOpcIntegerValue(item_error); - } - - public int getOpen_time() { - return this.getOpcIntegerValue(item_open_time); - } - - public int getWeight() { - return this.getOpcIntegerValue(item_weight); - } - - public int getStandby_time() { - return this.getOpcIntegerValue(item_standby_time); - } - - public int getProduction_time() { - return this.getOpcIntegerValue(item_production_time); - } - - public int getError_time() { - return this.getOpcIntegerValue(item_error_time); - } - - public String getMaterial() { - return this.getOpcStringValue(item_material); - } - - public String getOrder_No() { - return this.getOpcStringValue(item_order_No); - } - - public int getMix_num() { - return this.getOpcIntegerValue(item_mix_num); - } - - public int getTo_error() { - return this.getOpcIntegerValue(item_to_error); - } - - public String getTo_order_No() { - return this.getOpcStringValue(item_to_order_No); - } - - public int getTo_command() { - return this.getOpcIntegerValue(item_to_command); - } - - public int getTo_weight() { - return this.getOpcIntegerValue(item_to_weight); - } - - public String getTo_material_code() { - return this.getOpcStringValue(item_to_material_code); - } - - //是否有货 - 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 String getOpcStringValue(String protocol) { - String value = this.driver.getStringValue(protocol); - if (value == null) { -// log.error("读取错误!"); - } else { - return value; - } - return "0"; - } - - public static List getReadableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_heartbeat, "心跳", "DB4.B0")); - list.add(new ItemDto(item_mode, "工作状态", "DB4.B1", Boolean.valueOf(true))); - list.add(new ItemDto(item_status, "设备状态", "DB4.B2")); - list.add(new ItemDto(item_error, "故障代码", "DB4.B3")); - list.add(new ItemDto(item_open_time, "开机时间", "DB4.D4")); - list.add(new ItemDto(item_standby_time, "待机时间", "DB4.D8")); - list.add(new ItemDto(item_production_time, "生产时间", "DB4.D12")); - list.add(new ItemDto(item_error_time, "故障时间", "DB4.D16")); - list.add(new ItemDto(item_weight, "当前生产重量", "DB4.D20")); - list.add(new ItemDto(item_order_No, "工单号", "DB4.S24")); - list.add(new ItemDto(item_mix_num, "碾次", "DB4.D280")); - list.add(new ItemDto(item_material, "当前生产物料", "DB4.S284")); - return list; - } - - public static List getWriteableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_command, "反馈", "DB5.W0", Boolean.valueOf(true))); - list.add(new ItemDto(item_to_error, "error", "DB5.W2")); - list.add(new ItemDto(item_to_order_No, "工单号", "DB5.S4")); - list.add(new ItemDto(item_to_weight, "生产重量", "DB5.D260")); - list.add(new ItemDto(item_to_material_code, "下发物料编号", "DB5.S264")); - return list; - } - -} - diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/LnshMixingMillDefination.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/LnshMixingMillDefination.java deleted file mode 100644 index 224d258..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/LnshMixingMillDefination.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_mixing_mill; - -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 LnshMixingMillDefination implements OpcDeviceDriverDefination { - @Override - public String getDriverCode() { - return "lnsh_mixing_mill"; - } - - @Override - public String getDriverName() { - return "晟华-混碾机"; - } - - @Override - public String getDriverDescription() { - return "晟华-混碾机"; - } - - @Override - public DeviceDriver getDriverInstance(Device device) { - return (new LnshMixingMillDeviceDriver()).setDevice(device).setDriverDefination(this); - - } - - @Override - public Class getDeviceDriverType() { - return LnshMixingMillDeviceDriver.class; - } - - @Override - public List getFitDeviceTypes() { - List types = new LinkedList(); - types.add(DeviceType.station); - return types; - } - - @Override - public List getReadableItemDtos() { - return getReadableItemDtos2(); - } - - public static List getReadableItemDtos2() { - List list = new ArrayList(); - list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB4.B0")); - list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB4.B1", Boolean.valueOf(true))); - list.add(new ItemDto(ItemProtocol.item_status, "设备状态", "DB4.B2")); - list.add(new ItemDto(ItemProtocol.item_error, "故障代码", "DB4.B3")); - list.add(new ItemDto(ItemProtocol.item_open_time, "开机时间", "DB4.D4")); - list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "DB4.D8")); - list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "DB4.D12")); - list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "DB4.D16")); - list.add(new ItemDto(ItemProtocol.item_weight, "当前生产重量", "DB4.D20")); - list.add(new ItemDto(ItemProtocol.item_order_No, "工单号", "DB4.S24")); - list.add(new ItemDto(ItemProtocol.item_mix_num, "碾次", "DB4.D280")); - list.add(new ItemDto(ItemProtocol.item_material, "当前生产物料", "DB4.S284")); - return list; - } - - @Override - public List getWriteableItemDtos() { - return ItemProtocol.getWriteableItemDtos(); - } - -} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/LnshMixingMillDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/LnshMixingMillDeviceDriver.java deleted file mode 100644 index 5b2481a..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/LnshMixingMillDeviceDriver.java +++ /dev/null @@ -1,421 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_mixing_mill; - -import cn.hutool.core.date.DateUtil; -import cn.hutool.core.util.IdUtil; -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -import cn.hutool.http.HttpResponse; -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.ext.wms.service.AcsToWmsService; -import org.nl.acs.instruction.service.InstructionService; -import org.nl.acs.instruction.service.dto.Instruction; - -import org.nl.acs.log.service.DeviceExecuteLogService; -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.order.service.ProduceshiftorderService; -import org.nl.acs.order.service.dto.ProduceshiftorderDto; -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.lang.reflect.Field; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * 晟华混碾机 - */ -@Slf4j -@Data -@RequiredArgsConstructor -public class LnshMixingMillDeviceDriver 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 - DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); - @Autowired - AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl"); - @Autowired - ProduceshiftorderService produceshiftorderService = SpringContextHolder.getBean("produceshiftorderServiceImpl"); - - int mode = 0; - int error = 0; - int last_mode = 0; - int last_error = 0; - Boolean isonline = true; - int hasGoods = 0; - String message = null; - Boolean iserror = false; - - 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; - - //触摸屏手动触发任务 - private Boolean is_has_task = false; - - //暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域 - int flag; - - String device_code; - - int status = 0; - int last_status = 0; - - int open_time = 0; - int last_open_time = 0; - int standby_time = 0; - int last_standby_time = 0; - int production_time = 0; - int last_production_time = 0; - int error_time = 0; - int last_error_time = 0; - int weight = 0; - int last_weight = 0; - String order_No = "0"; - String last_order_No = "0"; - int mix_num = 0; - int last_mix_num = 0; - String material; - String last_material; - - - @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(); - status = this.itemProtocol.getStatus(); - open_time = this.itemProtocol.getOpen_time(); - standby_time = this.itemProtocol.getStandby_time(); - production_time = this.itemProtocol.getProduction_time(); - error_time = this.itemProtocol.getError_time(); - weight = this.itemProtocol.getWeight(); - order_No = this.itemProtocol.getOrder_No(); - material = this.itemProtocol.getMaterial(); - mix_num = this.itemProtocol.getMix_num(); - - if (mode != last_mode) { - this.setRequireSucess(false); - logServer.deviceItemValue(this.device_code,"mode" ,String.valueOf(mode)); - logServer.deviceExecuteLog(this.device_code,"","","信号mode:" + last_mode + "->" + mode); - } - if (error != last_error) { - logServer.deviceItemValue(this.device_code,"error" ,String.valueOf(error)); - logServer.deviceExecuteLog(this.device_code,"","","信号error:" + last_error + "->" + error); - } - if (status != last_status) { - logServer.deviceItemValue(this.device_code,"status" ,String.valueOf(status)); - logServer.deviceExecuteLog(this.device_code,"","","信号status:" + last_status + "->" + status); - } - if (open_time != last_open_time) { - logServer.deviceItemValue(this.device_code,"open_time" ,String.valueOf(open_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号open_time:" + last_open_time + "->" + open_time); - } - if (standby_time != last_standby_time) { - logServer.deviceItemValue(this.device_code,"standby_time" ,String.valueOf(standby_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号standby_time:" + last_standby_time + "->" + standby_time); - } - if (production_time != last_production_time) { - logServer.deviceItemValue(this.device_code,"production_time" ,String.valueOf(production_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号production_time:" + last_production_time + "->" + production_time); - } - if (error_time != last_error_time) { - logServer.deviceItemValue(this.device_code,"error_time" ,String.valueOf(error_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号error_time:" + last_error_time + "->" + error_time); - } - if (weight != last_weight) { - logServer.deviceItemValue(this.device_code,"weight" ,String.valueOf(weight)); - logServer.deviceExecuteLog(this.device_code,"","","信号weight:" + last_weight + "->" + weight); - } - if (!StrUtil.equals(material,last_material)) { - logServer.deviceItemValue(this.device_code,"material" ,String.valueOf(material)); - logServer.deviceExecuteLog(this.device_code,"","","信号material:" + last_material + "->" + material); - } - if (!StrUtil.equals(order_No,last_order_No)) { - logServer.deviceItemValue(this.device_code,"order_No" ,order_No); - logServer.deviceExecuteLog(this.device_code,"","","信号order_No:" + last_order_No + "->" + order_No); - } - if (mix_num != last_mix_num) { - logServer.deviceItemValue(this.device_code,"mix_num" ,String.valueOf(mix_num)); - logServer.deviceExecuteLog(this.device_code,"","","信号mix_num:" + last_mix_num + "->" + mix_num); - } - - } catch (Exception var17) { - return; - } - - 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; - case 3: - //排产单确认 - if (!requireSucess && !StrUtil.equals(order_No,"0")) { - JSONObject json = new JSONObject(); - json.put("producetask_code",order_No); - json.put("device_code",this.device_code); - json.put("material_code",material); - json.put("qty",weight); - json.put("type","1"); - enterProduction(json); - } - break; - case 4: - //工单完成 - if (!requireSucess && !StrUtil.equals(order_No,"0")) { - JSONObject json = new JSONObject(); - json.put("producetask_code",order_No); - json.put("device_code",this.device_code); - json.put("material_code",material); - json.put("qty",weight); - json.put("type","2"); - enterProduction(json); - } - break; - } - - switch (flag) { - //取货完成 - case 3: - writing(3); - return; - //放货完成 - case 4: - writing(4); - return; - } - - } - last_mode = mode; - last_status = status; - last_error = error; - last_open_time = open_time; - last_standby_time = standby_time; - last_production_time = production_time; - last_error_time = error_time; - last_material = material; - last_weight = weight; - last_order_No = order_No; - last_mix_num = mix_num; - } - - /** - * 排产单确认 - * - * @param - */ - public synchronized boolean enterProduction(JSONObject json) { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - HttpResponse result = acsToWmsService.enterOrder(json); - if (ObjectUtil.isNotEmpty(result)) { - JSONObject jsonObject = JSONObject.parseObject(result.body()); - if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) { - ProduceshiftorderDto dto = produceshiftorderService.findByCode(order_No); - if (this.mode == 3) { - dto.setOrder_status("1"); - } else if (this.mode == 4) { - dto.setOrder_status("2"); - } - produceshiftorderService.update(dto); - this.writing(this.mode); - this.setRequireSucess(true); - } - } - return true; - } - } - - - 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 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 itemMap = new HashMap(); - 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_order_No = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_order_No; - String to_weight = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_weight; - String to_material_code = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_material_code; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - if (type == 1) { - itemMap.put(to_command, command); - } else if (type == 2) { - itemMap.put(to_material_code, command); - } - ReadUtil.write(itemMap, server); - } - - public void writing(String param, String value) { - - String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + param; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - - itemMap.put(to_param, value); -// itemMap.put(to_param, Integer.parseInt(value)); - ReadUtil.write(itemMap, server); - } - - public boolean instruction_require(String container_code) { - return instruction_require(container_code, WcsConfig.task_container_type_default_desc); - } - - /** - * 请求指令 - * - * @param container_code - * @param container_type - */ - public synchronized boolean instruction_require(String container_code, String container_type) { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - TaskDto dto = new TaskDto(); - String now = DateUtil.now(); - dto.setTask_id(IdUtil.simpleUUID()); - dto.setCreate_by(this.getDevice().getDevice_code()); - dto.setUpdate_by(this.getDevice().getDevice_code()); - dto.setStart_point_code(this.getDevice().getDevice_code()); - dto.setVehicle_code(container_code); - dto.setVehicle_type(container_type); - - String taskcode = CodeUtil.getNewCode("TASK_NO"); - dto.setTask_code("-" + taskcode); - dto.setTask_status("0"); - dto.setPriority("101"); - RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code()); - String next_device_codecode = jo.getNext_device_code(); - if (StrUtil.isEmpty(next_device_codecode)) { - throw new RuntimeException("该设备未找到对应路由"); - } - dto.setNext_point_code(next_device_codecode); - dto.setUpdate_time(now); - dto.setCreate_time(now); - - WQLObject wo = WQLObject.getWQLObject("acs_task"); - JSONObject json = (JSONObject) JSONObject.toJSON(dto); - - wo.insert(json); - requireSucess = false; - return true; - } - } - - public static Boolean isExistFieldName(String fieldName, Object obj) throws NoSuchFieldException { - if (obj == null || StrUtil.isEmpty(fieldName)) { - return null; - } - //获取这个类的所有属性 - Field[] fields = obj.getClass().getDeclaredFields(); - boolean flag = false; - //循环遍历所有的fields - for (int i = 0; i < fields.length; i++) { - if (fields[i].getName().equals("item_" + fieldName)) { - flag = true; - break; - } - } - return flag; - } -} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_one_rgv/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_one_rgv/ItemProtocol.java deleted file mode 100644 index 81c6620..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_one_rgv/ItemProtocol.java +++ /dev/null @@ -1,165 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_one_rgv; - -import cn.hutool.core.util.StrUtil; -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_status = "status"; - public static String item_move_1 = "move_1"; - public static String item_action_1 = "action_1"; - public static String item_walk_y = "walk_y"; - public static String item_error = "error"; - public static String item_task1 = "task1"; - public static String item_task_qty = "task_qty"; - public static String item_finishTask_qty = "finishTask_qty"; - public static String item_batch = "batch"; - public static String item_specifications = "specifications"; - public static String item_qty = "qty"; - public static String item_to_command1 = "to_command1"; - public static String item_to_onset1 = "to_onset1"; - public static String item_to_target1 = "to_target1"; - public static String item_to_task1 = "to_task1"; - - private LnshOneRGVDeviceDriver driver; - - public ItemProtocol(LnshOneRGVDeviceDriver driver) { - this.driver = driver; - } - - public int getHeartbeat() { - return this.getOpcIntegerValue(item_heartbeat); - } - - public int getMode() { - return this.getOpcIntegerValue(item_mode); - } - - public int getStatus() { - return this.getOpcIntegerValue(item_status); - } - - public int getError() { - return this.getOpcIntegerValue(item_error); - } - - public int getMove_1() { - return this.getOpcIntegerValue(item_move_1); - } - - public int getAction_1() { - return this.getOpcIntegerValue(item_action_1); - } - - public int getWalk_y() { - return this.getOpcIntegerValue(item_walk_y); - } - - public int getTask1() { - return this.getOpcIntegerValue(item_task1); - } - - public int getTask_qty() { - return this.getOpcIntegerValue(item_task_qty); - } - - public int getFinishTask_qty() { - return this.getOpcIntegerValue(item_finishTask_qty); - } - - public int getBatch() { - return this.getOpcIntegerValue(item_batch); - } - - public String getSpecifications() { - return this.getOpcStringValue(item_specifications); - } - - public int getQty() { - return this.getOpcIntegerValue(item_qty); - } - - public int getTo_command1() { - return this.getOpcIntegerValue(item_to_command1); - } - - public int getTo_onset1() { - return this.getOpcIntegerValue(item_to_onset1); - } - - public int getTo_target1() { - return this.getOpcIntegerValue(item_to_target1); - } - - public int getTo_task1() { - return this.getOpcIntegerValue(item_to_task1); - } - - //是否有货 - 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 String getOpcStringValue(String protocol) { - String value = this.driver.getStringValue(protocol); - if (StrUtil.isEmpty(value)) { - - } else { - return value; - } - return "0"; - } - - public static List getReadableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_heartbeat, "心跳", "DB1.B0")); - list.add(new ItemDto(item_mode, "工作状态", "DB1.B1", Boolean.valueOf(true))); - list.add(new ItemDto(item_status, "设备状态", "DB1.B2")); - list.add(new ItemDto(item_move_1, "前工位光电信号", "DB1.B3")); - list.add(new ItemDto(item_action_1, "前工位动作信号", "DB1.B4")); - list.add(new ItemDto(item_walk_y, "行走列", "DB1.B5")); - list.add(new ItemDto(item_error, "车体报警", "DB1.B6")); - list.add(new ItemDto(item_task1, "前工位任务号", "DB1.D8")); - list.add(new ItemDto(item_task_qty, "当前任务数量", "DB1.D12")); - list.add(new ItemDto(item_finishTask_qty, "完成任务数量", "DB1.D16")); - list.add(new ItemDto(item_batch, "批次", "DB1.D20")); - list.add(new ItemDto(item_qty, "数量", "DB1.D24")); - list.add(new ItemDto(item_specifications, "规格", "DB1.S28")); - return list; - } - - public static List getWriteableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_command1, "前工位下发命令", "DB2.W0")); - list.add(new ItemDto(item_to_onset1, "下发起始站", "DB2.W2")); - list.add(new ItemDto(item_to_target1, "下发目标站", "DB2.W4")); - list.add(new ItemDto(item_to_task1, "下发任务号", "DB2.D6")); - return list; - } - -} - diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_one_rgv/LnshOneRGVDefination.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_one_rgv/LnshOneRGVDefination.java deleted file mode 100644 index dda9711..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_one_rgv/LnshOneRGVDefination.java +++ /dev/null @@ -1,81 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_one_rgv; - -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; - -/** - * 嘉耐单工位RGV - * - */ -@Service -public class LnshOneRGVDefination implements OpcDeviceDriverDefination { - @Override - public String getDriverCode() { - return "lnsh_one_rgv"; - } - - @Override - public String getDriverName() { - return "嘉耐单工位RGV"; - } - - @Override - public String getDriverDescription() { - return "嘉耐单工位RGV"; - } - - @Override - public DeviceDriver getDriverInstance(Device device) { - return (new LnshOneRGVDeviceDriver()).setDevice(device).setDriverDefination(this); - - } - - @Override - public Class getDeviceDriverType() { - return LnshOneRGVDeviceDriver.class; - } - - @Override - public List getFitDeviceTypes() { - List types = new LinkedList(); - types.add(DeviceType.station); - return types; - } - - @Override - public List getReadableItemDtos() { - return getReadableItemDtos2(); - } - - public static List getReadableItemDtos2() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB1.B0")); - list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB1.B1", Boolean.valueOf(true))); - list.add(new ItemDto(ItemProtocol.item_status, "设备状态", "DB1.B2")); - list.add(new ItemDto(ItemProtocol.item_move_1, "前工位光电信号", "DB1.B3")); - list.add(new ItemDto(ItemProtocol.item_action_1, "前工位动作信号", "DB1.B4")); - list.add(new ItemDto(ItemProtocol.item_walk_y, "行走列", "DB1.B5")); - list.add(new ItemDto(ItemProtocol.item_error, "车体报警", "DB1.B6")); - list.add(new ItemDto(ItemProtocol.item_task1, "前工位任务号", "DB1.D8")); - list.add(new ItemDto(ItemProtocol.item_task_qty, "当前任务数量", "DB1.D12")); - list.add(new ItemDto(ItemProtocol.item_finishTask_qty, "完成任务数量", "DB1.D16")); - list.add(new ItemDto(ItemProtocol.item_batch, "批次", "DB1.D20")); - list.add(new ItemDto(ItemProtocol.item_qty, "数量", "DB1.D24")); - list.add(new ItemDto(ItemProtocol.item_specifications, "规格", "DB1.S28")); - return list; - } - - @Override - public List getWriteableItemDtos() { - return ItemProtocol.getWriteableItemDtos(); - } - -} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_one_rgv/LnshOneRGVDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_one_rgv/LnshOneRGVDeviceDriver.java deleted file mode 100644 index e596796..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_one_rgv/LnshOneRGVDeviceDriver.java +++ /dev/null @@ -1,481 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_one_rgv; - -import cn.hutool.core.date.DateUtil; -import cn.hutool.core.util.IdUtil; -import cn.hutool.core.util.ObjectUtil; -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.DeviceExecuteLogService; -import org.nl.acs.monitor.DeviceStageMonitor; -import org.nl.acs.opc.Device; -import org.nl.acs.opc.DeviceAppService; -import org.nl.acs.opc.DeviceAppServiceImpl; -import org.nl.acs.route.service.RouteLineService; -import org.nl.acs.task.service.TaskService; -import org.nl.acs.task.service.dto.TaskDto; -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.*; - -/** - * 嘉耐单工位RGV - */ -@Slf4j -@Data -@RequiredArgsConstructor -public class LnshOneRGVDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor { - 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 - DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); - @Autowired - DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppServiceImpl.class); - - int mode = 0; - int error = 0; - int last_mode = 0; - int last_error = 0; - Boolean isonline = true; - Boolean requireSucess = false; - int hasGoods = 0; - String message = null; - Boolean iserror = false; - - int branchProtocol = 0; - - //暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域 - int flag; - - String device_code; - int status = 0; - int last_status = 0; - int move_1 = 0; - int last_move_1 = 0; - int action_1 = 0; - int last_action_1 = 0; - int walk_y = 0; - int last_walk_y = 0; - int task1 = 0; - int last_task1 = 0; - //当前任务数量 - int task_qty = 0; - int last_task_qty = 0; - //完成任务数量 - int finishTask_qty = 0; - int last_finishTask_qty = 0; - - int batch = 0; - int last_batch = 0; - - int qty = 0; - int last_qty = 0; - - private Date instruction_require_time = new Date(); - private Date instruction_finished_time = new Date(); - private Date instruction_apply_time = new Date(); - private int instruction_require_time_out = 3000; - - String specifications = ""; - String last_specifications = ""; - - //当前指令 - Instruction inst = null; - //上次指令 - Instruction last_inst = null; - - @Override - public Device getDevice() { - return this.device; - } - - - @Override - public void execute() throws Exception { - String message = null; - try { - device_code = this.getDeviceCode(); - mode = this.itemProtocol.getMode(); - status = this.itemProtocol.getStatus(); - move_1 = this.itemProtocol.getMove_1(); - action_1 = this.itemProtocol.getAction_1(); - walk_y = this.itemProtocol.getWalk_y(); - error = this.itemProtocol.getError(); - task1 = this.itemProtocol.getTask1(); - task_qty = this.itemProtocol.getTask_qty(); - finishTask_qty = this.itemProtocol.getFinishTask_qty(); - batch = this.itemProtocol.getBatch(); - specifications = this.itemProtocol.getSpecifications(); - qty = this.itemProtocol.getQty(); - - if (mode != last_mode) { - this.setRequireSucess(false); - logServer.deviceItemValue(this.device_code,"mode" ,String.valueOf(mode)); - logServer.deviceExecuteLog(this.device_code,"","","信号mode:" + last_mode + "->" + mode); - } - if (error != last_error) { - logServer.deviceItemValue(this.device_code,"error" ,String.valueOf(error)); - logServer.deviceExecuteLog(this.device_code,"","","信号error:" + last_error + "->" + error); - } - if (status != last_status) { - logServer.deviceItemValue(this.device_code,"status" ,String.valueOf(status)); - logServer.deviceExecuteLog(this.device_code,"","","信号status:" + last_status + "->" + status); - } - if (move_1 != last_move_1) { - logServer.deviceItemValue(this.device_code,"move_1" ,String.valueOf(move_1)); - logServer.deviceExecuteLog(this.device_code,"","","信号move_1:" + last_move_1 + "->" + move_1); - } - if (action_1 != last_action_1) { - logServer.deviceItemValue(this.device_code,"action_1" ,String.valueOf(action_1)); - logServer.deviceExecuteLog(this.device_code,"","","信号action_1:" + last_action_1 + "->" + action_1); - } - if (walk_y != last_walk_y) { - logServer.deviceItemValue(this.device_code,"walk_y" ,String.valueOf(walk_y)); - logServer.deviceExecuteLog(this.device_code,"","","信号walk_y:" + last_walk_y + "->" + walk_y); - } - if (task1 != last_task1) { - logServer.deviceItemValue(this.device_code,"task1" ,String.valueOf(task1)); - logServer.deviceExecuteLog(this.device_code,"","","信号task1:" + last_task1 + "->" + task1); - } - if (task_qty != last_task_qty) { - logServer.deviceItemValue(this.device_code,"task_qty" ,String.valueOf(task_qty)); - logServer.deviceExecuteLog(this.device_code,"","","信号task_qty:" + last_task_qty + "->" + task_qty); - } - if (finishTask_qty != last_finishTask_qty) { - logServer.deviceItemValue(this.device_code,"finishTask_qty" ,String.valueOf(finishTask_qty)); - logServer.deviceExecuteLog(this.device_code,"","","信号finishTask_qty:" + last_finishTask_qty + "->" + finishTask_qty); - } - if (batch != last_batch) { - logServer.deviceItemValue(this.device_code,"batch" ,String.valueOf(batch)); - logServer.deviceExecuteLog(this.device_code,"","","信号batch:" + last_batch + "->" + batch); - } - if (qty != last_qty) { - logServer.deviceItemValue(this.device_code,"qty" ,String.valueOf(qty)); - logServer.deviceExecuteLog(this.device_code,"","","信号qty:" + last_qty + "->" + qty); - } - if (!StrUtil.equals(specifications,last_specifications)) { - logServer.deviceItemValue(this.device_code,"specifications" ,specifications); - logServer.deviceExecuteLog(this.device_code,"","","信号specifications:" + last_specifications + "->" + specifications); - } - - if ( action_1 == 1 && move_1 != 0 && task1 > 0) { - //inst_message - inst = instructionService.findByCodeFromCache(String.valueOf(task1)); - if (inst != null) { - if (StrUtil.equals(inst.getInstruction_status(), "0")) { - inst.setInstruction_status("1"); - instructionService.update(inst); - } - } - - } - if ( action_1 == 4 && task1 > 0) { - //inst_message - inst = instructionService.findByCodeFromCache(String.valueOf(task1)); - if (inst != null) { - if (StrUtil.equals(inst.getInstruction_status(), "1")) { - finish_instruction(); - } - } - - } - - } 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: - if (mode == 2 && move_1 == 0 && action_1 == 0 && !requireSucess) { - instruction_require(); - } - break; - } - - switch (flag) { - //取货完成 - case 1: - writing1(2); - return; - //放货完成 - case 2: - writing1(3); - return; - - } - - } - last_mode = mode; - last_error = error; - last_status = status; - last_move_1 = move_1; - last_action_1 = action_1; - last_walk_y = walk_y; - last_task1 = task1; - last_task_qty = task_qty; - last_finishTask_qty = finishTask_qty; - last_specifications = specifications; - last_batch = batch; - last_qty = qty; - } - - - public boolean exe_error() { - if (this.error == 0) { - return true; - } else { - log.debug("设备报警"); - return false; - } - } - - public boolean exe_business() { - return true; - } - - protected void executing(Instruction instruction) { - this.executing(1, instruction, ""); - } - - public void executing(int command, Instruction instruction, String appendMessage) { - - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - ReadUtil.write(itemMap, server); - - } - - - public void writing1(int command) { - String to_command1 = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_command1; - - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(to_command1, command); - ReadUtil.write(itemMap, server); - - } - public void executing(Server server, Map itemMap) { - ReadUtil.write(itemMap, server); - } - - public void writing(String type,String value) { - String to_command1 = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_command1; - - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(type, value); - ReadUtil.write(itemMap, server); - - } - - public synchronized boolean finish_instruction() throws Exception { - instructionService.finish(inst); - return true; - } - - - public synchronized boolean instruction_require() 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; - String linkobj = (String)this.getDevice().getExtraValue().get("get_device_code"); - String demosub = linkobj.substring(1,linkobj.length()-1); - String demoArray[] = demosub.split(","); - List device_code_list = Arrays.asList(demoArray); - TaskDto task = null; - for(int i=0;i getReadableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_heartbeat, "心跳", "DB1.B0")); - list.add(new ItemDto(item_mode, "工作状态", "DB1.B1", Boolean.valueOf(true))); - list.add(new ItemDto(item_status, "设备状态", "DB1.B2")); - list.add(new ItemDto(item_outKiln_move, "出窑光电", "DB1.B3")); - list.add(new ItemDto(item_outKiln_barcode, "出窑条码", "DB1.S4")); - list.add(new ItemDto(item_outKiln_device, "出窑设备", "DB1.D260")); - list.add(new ItemDto(item_open_time, "开机时间", "DB1.D264")); - list.add(new ItemDto(item_standby_time, "待机时间", "DB1.D268")); - list.add(new ItemDto(item_production_time, "生产时间", "DB1.D272")); - list.add(new ItemDto(item_error_time, "故障时间", "DB1.D276")); - return list; - } - - public static List getWriteableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_command, "下发命令反馈", "DB1.W0", Boolean.valueOf(true))); - list.add(new ItemDto(item_to_target, "下发目标站", "DB1.W2")); - list.add(new ItemDto(item_to_task, "下发任务号", "DB1.D4")); - return list; - } - -} - diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_out_kiln_truss/LnshOutKilnTrussDefination.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_out_kiln_truss/LnshOutKilnTrussDefination.java deleted file mode 100644 index 7c5fdc7..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_out_kiln_truss/LnshOutKilnTrussDefination.java +++ /dev/null @@ -1,76 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_out_kiln_truss; - -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 LnshOutKilnTrussDefination implements OpcDeviceDriverDefination { - @Override - public String getDriverCode() { - return "lnsh_out_kiln_truss"; - } - - @Override - public String getDriverName() { - return "晟华-出窑桁架"; - } - - @Override - public String getDriverDescription() { - return "晟华-出窑桁架"; - } - - @Override - public DeviceDriver getDriverInstance(Device device) { - return (new LnshOutKilnTrussDeviceDriver()).setDevice(device).setDriverDefination(this); - } - - @Override - public Class getDeviceDriverType() { - return LnshOutKilnTrussDeviceDriver.class; - } - - @Override - public List getFitDeviceTypes() { - List types = new LinkedList(); - types.add(DeviceType.station); - return types; - } - - @Override - public List getReadableItemDtos() { - return getReadableItemDtos2(); - } - - public static List getReadableItemDtos2() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB1.B0")); - list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB1.B1", Boolean.valueOf(true))); - list.add(new ItemDto(ItemProtocol.item_status, "设备状态", "DB1.B2")); - list.add(new ItemDto(ItemProtocol.item_outKiln_move, "出窑光电", "DB1.B3")); - list.add(new ItemDto(ItemProtocol.item_outKiln_barcode, "出窑条码", "DB1.S4")); - list.add(new ItemDto(ItemProtocol.item_outKiln_device, "出窑设备", "DB1.D260")); - list.add(new ItemDto(ItemProtocol.item_open_time, "开机时间", "DB1.D264")); - list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "DB1.D268")); - list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "DB1.D272")); - list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "DB1.D276")); - return list; - } - - @Override - public List getWriteableItemDtos() { - return ItemProtocol.getWriteableItemDtos(); - } - -} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_out_kiln_truss/LnshOutKilnTrussDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_out_kiln_truss/LnshOutKilnTrussDeviceDriver.java deleted file mode 100644 index 12a0ce5..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_out_kiln_truss/LnshOutKilnTrussDeviceDriver.java +++ /dev/null @@ -1,286 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_out_kiln_truss; - -import cn.hutool.core.date.DateUtil; -import cn.hutool.core.util.IdUtil; -import cn.hutool.core.util.StrUtil; -import cn.hutool.http.HttpResponse; -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.ext.wms.service.AcsToWmsService; -import org.nl.acs.instruction.service.InstructionService; -import org.nl.acs.instruction.service.dto.Instruction; - -import org.nl.acs.log.service.DeviceExecuteLogService; -import org.nl.acs.opc.Device; -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.*; - -/** - * 晟华出窑桁架 - */ -@Slf4j -@Data -@RequiredArgsConstructor -public class LnshOutKilnTrussDeviceDriver 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 - DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); - @Autowired - AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl"); - - String device_code; - int mode = 0; - int error = 0; - int move = 0; - int last_mode = 0; - int last_error = 0; - int last_move = 0; - Boolean isonline = true; - int hasGoods = 0; - Boolean iserror = false; - - private Date instruction_require_time = new Date(); - private Date instruction_finished_time = new Date(); - - boolean requireSucess = false; - - - int heartbeat; - int last_heartbeat; - private Date checkHeartbeattime = new Date(); - private Date last_checkHeartbeattime = new Date(); - private int instruction_require_time_out = 3000; - - int branchProtocol = 0; - - //触摸屏手动触发任务 - private Boolean is_has_task = false; - - String message; - int status = 0; - int last_status = 0; - - int open_time = 0; - int last_open_time = 0; - int standby_time = 0; - int last_standby_time = 0; - int production_time = 0; - int last_production_time = 0; - int error_time = 0; - int last_error_time = 0; - //出窑光电 - int outKiln_move = 0; - int last_outKiln_move = 0; - //出窑条码 - String outKiln_barcode; - String last_outKiln_barcode; - //出窑设备 - int outKiln_device = 0; - int last_outKiln_device = 0; - - @Override - public Device getDevice() { - return this.device; - } - - - @Override - public void execute() { - String message = null; - try { - device_code = this.getDeviceCode(); - mode = this.itemProtocol.getMode(); - status = this.itemProtocol.getStatus(); - open_time = this.itemProtocol.getOpen_time(); - standby_time = this.itemProtocol.getStandby_time(); - production_time = this.itemProtocol.getProduction_time(); - error_time = this.itemProtocol.getError_time(); - outKiln_move = this.itemProtocol.getOutKiln_move(); - outKiln_barcode = this.itemProtocol.getOutKiln_barcode(); - outKiln_device = this.itemProtocol.getOutKiln_device(); - - if (mode != last_mode) { - this.setRequireSucess(false); - logServer.deviceItemValue(this.device_code,"mode" ,String.valueOf(mode)); - logServer.deviceExecuteLog(this.device_code,"","","信号mode:" + last_mode + "->" + mode); - } - if (status != last_status) { - logServer.deviceItemValue(this.device_code,"status" ,String.valueOf(status)); - logServer.deviceExecuteLog(this.device_code,"","","信号status:" + last_status + "->" + status); - } - if (open_time != last_open_time) { - logServer.deviceItemValue(this.device_code,"open_time" ,String.valueOf(open_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号open_time:" + last_open_time + "->" + open_time); - } - if (standby_time != last_standby_time) { - logServer.deviceItemValue(this.device_code,"standby_time" ,String.valueOf(standby_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号standby_time:" + last_standby_time + "->" + standby_time); - } - if (production_time != last_production_time) { - logServer.deviceItemValue(this.device_code,"production_time" ,String.valueOf(production_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号production_time:" + last_production_time + "->" + production_time); - } - if (error_time != last_error_time) { - logServer.deviceItemValue(this.device_code,"error_time" ,String.valueOf(error_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号error_time:" + last_error_time + "->" + error_time); - } - if (outKiln_move != last_outKiln_move) { - logServer.deviceItemValue(this.device_code,"outKiln_move" ,String.valueOf(outKiln_move)); - logServer.deviceExecuteLog(this.device_code,"","","信号outKiln_move:" + last_outKiln_move + "->" + outKiln_move); - } - if (!StrUtil.equals(outKiln_barcode,last_outKiln_barcode)) { - logServer.deviceItemValue(this.device_code,"outKiln_barcode" ,outKiln_barcode); - logServer.deviceExecuteLog(this.device_code,"","","信号outKiln_barcode:" + last_outKiln_barcode + "->" + outKiln_barcode); - } - if (outKiln_device != last_outKiln_device) { - logServer.deviceItemValue(this.device_code,"outKiln_device" ,String.valueOf(outKiln_device)); - logServer.deviceExecuteLog(this.device_code,"","","信号outKiln_device:" + last_outKiln_device + "->" + outKiln_device); - } - - } catch (Exception var17) { - return; - } - - //急停 - if (this.isStop()) { - - //未在线无心跳 - } else 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("设备运转模式:等待工作"); - break; - case 2: - - break; - case 3: - - break; - case 5: - if (!requireSucess) { - outKiln(); - } - break; - } - } - - last_mode = mode; - last_status = status; - last_open_time = open_time; - last_standby_time = standby_time; - last_production_time = production_time; - last_error_time = error_time; - last_outKiln_move = outKiln_move; - last_outKiln_barcode = outKiln_barcode; - last_outKiln_device = outKiln_device; - } - - - protected void thingToNothing() throws Exception { - this.setRequireSucess(false); - } - - public boolean exe_error() { - if (this.error == 0) { - return true; - } else { - log.debug("设备报警"); - return false; - } - } - - /** - * 出窑请求 - * - * @param - */ - public synchronized boolean outKiln() { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - -// JSONObject jo = acsToWmsService.outKiln(this.device_code); -// if (jo.getInteger("status") == 200) { -// String code = jo.getString("code"); -// -// this.writing(this.mode); -// this.writing("to_target",code); -// } - - requireSucess = true; - return true; - } - } - - public void writing(int command) { - - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - ReadUtil.write(itemMap, server); - - } - - public void writing(String param, String value) { - - String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + param; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(to_param, value); - - ReadUtil.write(itemMap, server); - } - - -} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_line/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_line/ItemProtocol.java deleted file mode 100644 index ac0e701..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_line/ItemProtocol.java +++ /dev/null @@ -1,137 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_package_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_status = "status"; - public static String item_open_time = "open_time"; - public static String item_standby_time = "standby_time"; - public static String item_production_time = "production_time"; - public static String item_error_time = "error_time"; - public static String item_barcode = "barcode"; - 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_to_code_message = "to_code_message"; - public static String item_to_isPackage = "to_isPackage"; - Boolean isonline; - - private LnshPackageLineDeviceDriver driver; - - public ItemProtocol(LnshPackageLineDeviceDriver driver) { - this.driver = driver; - } - - public int getHeartbeat() { - return this.getOpcIntegerValue(item_heartbeat); - } - - public int getMode() { - return this.getOpcIntegerValue(item_mode); - } - - public int getStatus() { - return this.getOpcIntegerValue(item_status); - } - - public int getOpen_time() { - return this.getOpcIntegerValue(item_open_time); - } - - public int getStandby_time() { - return this.getOpcIntegerValue(item_standby_time); - } - - public int getProduction_time() { - return this.getOpcIntegerValue(item_production_time); - } - - public int getError_time() { - return this.getOpcIntegerValue(item_error_time); - } - - public String getBarcode() { - return this.getOpcStringValue(item_barcode); - } - - public int getTo_command() { - return this.getOpcIntegerValue(item_to_command); - } - - public int getTo_target() { - return this.getOpcIntegerValue(item_to_target); - } - - public int getTo_task() { - return this.getOpcIntegerValue(item_to_task); - } - - public int getTo_code_message() { - return this.getOpcIntegerValue(item_to_code_message); - } - - public String getTo_isPackage() { - return this.getOpcStringValue(item_to_isPackage); - } - - //是否有货 - public int hasGoods(int move) { - return move; - } - - - 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 String getOpcStringValue(String protocol) { - String value = this.driver.getStringValue(protocol); - if (value == null) { -// log.error("读取错误!"); - } else { - return value; - } - return "0"; - } - - public static List getReadableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_heartbeat, "心跳", "DB1.B0")); - list.add(new ItemDto(item_mode, "工作状态", "DB1.B1", Boolean.valueOf(true))); - list.add(new ItemDto(item_status, "设备状态", "DB1.B2")); - list.add(new ItemDto(item_open_time, "开机时间", "DB1.D4")); - list.add(new ItemDto(item_standby_time, "待机时间", "DB1.D8")); - list.add(new ItemDto(item_production_time, "生产时间", "DB1.D12")); - list.add(new ItemDto(item_error_time, "故障时间", "DB1.D16")); - list.add(new ItemDto(item_barcode, "条码", "DB1.S20")); - return list; - } - - public static List getWriteableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_command, "下发命令", "DB2.W0", Boolean.valueOf(true))); - list.add(new ItemDto(item_to_target, "下发目标站", "DB2.W2")); - list.add(new ItemDto(item_to_task, "下发任务号", "DB2.D4")); - list.add(new ItemDto(item_to_code_message, "打码信息", "DB2.D8")); - return list; - } - -} - diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_line/LnshPackageLineDefination.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_line/LnshPackageLineDefination.java deleted file mode 100644 index 4e43998..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_line/LnshPackageLineDefination.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_package_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 LnshPackageLineDefination implements OpcDeviceDriverDefination { - @Override - public String getDriverCode() { - return "lnsh_package_line"; - } - - @Override - public String getDriverName() { - return "晟华-包装机"; - } - - @Override - public String getDriverDescription() { - return "晟华-包装机"; - } - - @Override - public DeviceDriver getDriverInstance(Device device) { - return (new LnshPackageLineDeviceDriver()).setDevice(device).setDriverDefination(this); - } - - @Override - public Class getDeviceDriverType() { - return LnshPackageLineDeviceDriver.class; - } - - @Override - public List getFitDeviceTypes() { - List types = new LinkedList(); - types.add(DeviceType.station); - return types; - } - - @Override - public List getReadableItemDtos() { - return getReadableItemDtos2(); - } - - public static List getReadableItemDtos2() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB1.B0")); - list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB1.B1", Boolean.valueOf(true))); - list.add(new ItemDto(ItemProtocol.item_status, "设备状态", "DB1.B2")); - list.add(new ItemDto(ItemProtocol.item_open_time, "开机时间", "DB1.D4")); - list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "DB1.D8")); - list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "DB1.D12")); - list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "DB1.D16")); - list.add(new ItemDto(ItemProtocol.item_barcode, "条码", "DB1.S20")); - return list; - } - - @Override - public List getWriteableItemDtos() { - return ItemProtocol.getWriteableItemDtos(); - } - -} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_line/LnshPackageLineDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_line/LnshPackageLineDeviceDriver.java deleted file mode 100644 index 2d43a32..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_line/LnshPackageLineDeviceDriver.java +++ /dev/null @@ -1,223 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_package_line; - -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.DeviceExecuteLogService; -import org.nl.acs.opc.Device; -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.*; - -/** - * 晟华包装机 - */ -@Slf4j -@Data -@RequiredArgsConstructor -public class LnshPackageLineDeviceDriver 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 - DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); - - String device_code; - int mode = 0; - int error = 0; - int last_mode = 0; - int last_error = 0; - Boolean isonline = true; - Boolean iserror = false; - - boolean requireSucess = false; - - int heartbeat; - int last_heartbeat; - private Date checkHeartbeattime = new Date(); - private Date last_checkHeartbeattime = new Date(); - - String message; - int status = 0; - int last_status = 0; - //开机时间 - int open_time = 0; - int last_open_time = 0; - //待机时间 - int standby_time = 0; - int last_standby_time = 0; - //生产时间 - int production_time = 0; - int last_production_time = 0; - //故障时间 - int error_time = 0; - int last_error_time = 0; - //条码 - String barcode; - String last_barcode; - - @Override - public Device getDevice() { - return this.device; - } - - - @Override - public void execute() { - String message = null; - try { - device_code = this.getDeviceCode(); - mode = this.itemProtocol.getMode(); - status = this.itemProtocol.getStatus(); - open_time = this.itemProtocol.getOpen_time(); - standby_time = this.itemProtocol.getStandby_time(); - production_time = this.itemProtocol.getProduction_time(); - error_time = this.itemProtocol.getError_time(); - barcode = this.itemProtocol.getBarcode(); - - if (mode != last_mode) { - this.setRequireSucess(false); - logServer.deviceItemValue(this.device_code,"mode" ,String.valueOf(mode)); - logServer.deviceExecuteLog(this.device_code,"","","信号mode:" + last_mode + "->" + mode); - } - if (status != last_status) { - logServer.deviceItemValue(this.device_code,"status" ,String.valueOf(status)); - logServer.deviceExecuteLog(this.device_code,"","","信号status:" + last_status + "->" + status); - } - if (open_time != last_open_time) { - logServer.deviceItemValue(this.device_code,"open_time" ,String.valueOf(open_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号open_time:" + last_open_time + "->" + open_time); - } - if (standby_time != last_standby_time) { - logServer.deviceItemValue(this.device_code,"standby_time" ,String.valueOf(standby_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号standby_time:" + last_standby_time + "->" + standby_time); - } - if (production_time != last_production_time) { - logServer.deviceItemValue(this.device_code,"production_time" ,String.valueOf(production_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号production_time:" + last_production_time + "->" + production_time); - } - if (error_time != last_error_time) { - logServer.deviceItemValue(this.device_code,"error_time" ,String.valueOf(error_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号error_time:" + last_error_time + "->" + error_time); - } - if (!StrUtil.equals(barcode,last_barcode)) { - logServer.deviceItemValue(this.device_code,"barcode", barcode); - logServer.deviceExecuteLog(this.device_code,"","","信号barcode:" + last_barcode + "->" + barcode); - } - - } catch (Exception var17) { - return; - } - - //急停 - if (this.isStop()) { - - //未在线无心跳 - } else 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("设备运转模式:等待工作"); - break; - case 2: - - break; - case 3: - - break; - case 4: - break; - } - } - - last_mode = mode; - last_status = status; - last_open_time = open_time; - last_standby_time = standby_time; - last_production_time = production_time; - last_error_time = error_time; - last_barcode = barcode; - } - - - protected void thingToNothing() throws Exception { - this.setRequireSucess(false); - } - - 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 itemMap) { - ReadUtil.write(itemMap, server); - } - - public void writing(String param, String value) { - - String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + param; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - - itemMap.put(to_param, value); - ReadUtil.write(itemMap, server); - } - -} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/ItemProtocol.java deleted file mode 100644 index 1b947cf..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/ItemProtocol.java +++ /dev/null @@ -1,896 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_package_pallet_manipulator; - -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -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_status = "status"; - public static String item_error = "error"; - public static String item_putStation = "putStation"; - public static String item_barcode = "barcode"; - public static String item_material = "material"; - public static String item_qty = "qty"; - public static String item_open_time = "open_time"; - public static String item_standby_time = "standby_time"; - public static String item_production_time = "production_time"; - public static String item_error_time = "error_time"; - public static String item_order_No = "order_No"; - - public static String item_product_code = "product_code"; - public static String item_AlongSide = "AlongSide"; - public static String item_BshortSide = "BshortSide"; - public static String item_Htrapezoidal = "Htrapezoidal"; - public static String item_Wthickness = "Wthickness"; - public static String item_tray_qty = "tray_qty"; - public static String item_tray_high = "tray_high"; - public static String item_crib_category = "crib_category"; - public static String item_palletX1_line = "palletX1_line"; - public static String item_palletY1_row = "palletY1_row"; - public static String item_palletA1_angle = "palletA1_angle"; - public static String item_palletX2_line = "palletX2_line"; - public static String item_palletY2_row = "palletY2_row"; - public static String item_palletA2_angle = "palletA2_angle"; - public static String item_palletX3_line = "palletX3_line"; - public static String item_palletY3_row = "palletY3_row"; - public static String item_palletA3_angle = "palletA3_angle"; - public static String item_pressCribX1_line = "pressCribX1_line"; - public static String item_pressCribY1_row = "pressCribY1_row"; - public static String item_pressCribA1_angle = "pressCribA1_angle"; - public static String item_pressCribX2_line = "pressCribX2_line"; - public static String item_pressCribY2_row = "pressCribY2_row"; - public static String item_pressCribA2_angle = "pressCribA2_angle"; - public static String item_pressCribX3_line = "pressCribX3_line"; - public static String item_pressCribY3_row = "pressCribY3_row"; - public static String item_pressCribA3_angle = "pressCribA3_angle"; - public static String item_Zoffset = "Zoffset"; - public static String item_pallet_layerQty = "pallet_layerQty"; - public static String item_pressCrib_layerQty = "pressCrib_layerQty"; - public static String item_codeLayerX1_interval = "codeLayerX1_interval"; - public static String item_codeLayerY1_interval = "codeLayerY1_interval"; - public static String item_codeLayerX2_interval = "codeLayerX2_interval"; - public static String item_codeLayerY2_interval = "codeLayerY2_interval"; - public static String item_codeLayerX3_interval = "codeLayerX3_interval"; - public static String item_codeLayerY3_interval = "codeLayerY3_interval"; - public static String item_codeLayerX1_offset = "codeLayerX1_offset"; - public static String item_codeLayerY1_offset = "codeLayerY1_offset"; - public static String item_codeLayerX2_offset = "codeLayerX2_offset"; - public static String item_codeLayerY2_offset = "codeLayerY2_offset"; - public static String item_codeLayerX3_offset = "codeLayerX3_offset"; - public static String item_codeLayerY3_offset = "codeLayerY3_offset"; - public static String item_pressLayerX1_interval = "pressLayerX1_interval"; - public static String item_pressLayerY1_interval = "pressLayerY1_interval"; - public static String item_pressLayerX2_interval = "pressLayerX2_interval"; - public static String item_pressLayerY2_interval = "pressLayerY2_interval"; - public static String item_pressLayerX3_interval = "pressLayerX3_interval"; - public static String item_pressLayerY3_interval = "pressLayerY3_interval"; - public static String item_pressLayerX1_offset = "pressLayerX1_offset"; - public static String item_pressLayerY1_offset = "pressLayerY1_offset"; - public static String item_pressLayerX2_offset = "pressLayerX2_offset"; - public static String item_pressLayerY2_offset = "pressLayerY2_offset"; - public static String item_pressLayerX3_offset = "pressLayerX3_offset"; - public static String item_pressLayerY3_offset = "pressLayerY3_offset"; - public static String item_one_cribTotal = "one_cribTotal"; - public static String item_two_cribTotal = "two_cribTotal"; - public static String item_one_qty = "one_qty"; - public static String item_two_qty = "two_qty"; - public static String item_tool_coordinate = "tool_coordinate"; - - public static String item_to_feedback = "to_feedback"; - public static String item_to_error = "to_error"; - public static String item_to_material_qty = "to_material_qty"; - public static String item_to_allow_pallet_qty = "to_allow_pallet_qty"; - public static String item_to_material_type = "to_material_type"; - public static String item_to_material_code = "to_material_code"; - public static String item_to_order_No = "to_order_No"; - - public static String item_to_product_code = "to_product_code"; - public static String item_to_AlongSide = "to_AlongSide"; - public static String item_to_BshortSide = "to_BshortSide"; - public static String item_to_Htrapezoidal = "to_Htrapezoidal"; - public static String item_to_Wthickness = "to_Wthickness"; - public static String item_to_tray_qty = "to_tray_qty"; - public static String item_to_tray_high = "to_tray_high"; - public static String item_to_crib_category = "to_crib_category"; - public static String item_to_palletX1_line = "to_palletX1_line"; - public static String item_to_palletY1_row = "to_palletY1_row"; - public static String item_to_palletA1_angle = "to_palletA1_angle"; - public static String item_to_palletX2_line = "to_palletX2_line"; - public static String item_to_palletY2_row = "to_palletY2_row"; - public static String item_to_palletA2_angle = "to_palletA2_angle"; - public static String item_to_palletX3_line = "to_palletX3_line"; - public static String item_to_palletY3_row = "to_palletY3_row"; - public static String item_to_palletA3_angle = "to_palletA3_angle"; - public static String item_to_pressCribX1_line = "to_pressCribX1_line"; - public static String item_to_pressCribY1_row = "to_pressCribY1_row"; - public static String item_to_pressCribA1_angle = "to_pressCribA1_angle"; - public static String item_to_pressCribX2_line = "to_pressCribX2_line"; - public static String item_to_pressCribY2_row = "to_pressCribY2_row"; - public static String item_to_pressCribA2_angle = "to_pressCribA2_angle"; - public static String item_to_pressCribX3_line = "to_pressCribX3_line"; - public static String item_to_pressCribY3_row = "to_pressCribY3_row"; - public static String item_to_pressCribA3_angle = "to_pressCribA3_angle"; - public static String item_to_Zoffset = "to_Zoffset"; - public static String item_to_pallet_layerQty = "to_pallet_layerQty"; - public static String item_to_pressCrib_layerQty = "to_pressCrib_layerQty"; - public static String item_to_codeLayerX1_interval = "to_codeLayerX1_interval"; - public static String item_to_codeLayerY1_interval = "to_codeLayerY1_interval"; - public static String item_to_codeLayerX2_interval = "to_codeLayerX2_interval"; - public static String item_to_codeLayerY2_interval = "to_codeLayerY2_interval"; - public static String item_to_codeLayerX3_interval = "to_codeLayerX3_interval"; - public static String item_to_codeLayerY3_interval = "to_codeLayerY3_interval"; - public static String item_to_codeLayerX1_offset = "to_codeLayerX1_offset"; - public static String item_to_codeLayerY1_offset = "to_codeLayerY1_offset"; - public static String item_to_codeLayerX2_offset = "to_codeLayerX2_offset"; - public static String item_to_codeLayerY2_offset = "to_codeLayerY2_offset"; - public static String item_to_codeLayerX3_offset = "to_codeLayerX3_offset"; - public static String item_to_codeLayerY3_offset = "to_codeLayerY3_offset"; - public static String item_to_pressLayerX1_interval = "to_pressLayerX1_interval"; - public static String item_to_pressLayerY1_interval = "to_pressLayerY1_interval"; - public static String item_to_pressLayerX2_interval = "to_pressLayerX2_interval"; - public static String item_to_pressLayerY2_interval = "to_pressLayerY2_interval"; - public static String item_to_pressLayerX3_interval = "to_pressLayerX3_interval"; - public static String item_to_pressLayerY3_interval = "to_pressLayerY3_interval"; - public static String item_to_pressLayerX1_offset = "to_pressLayerX1_offset"; - public static String item_to_pressLayerY1_offset = "to_pressLayerY1_offset"; - public static String item_to_pressLayerX2_offset = "to_pressLayerX2_offset"; - public static String item_to_pressLayerY2_offset = "to_pressLayerY2_offset"; - public static String item_to_pressLayerX3_offset = "to_pressLayerX3_offset"; - public static String item_to_pressLayerY3_offset = "to_pressLayerY3_offset"; - public static String item_to_one_cribTotal = "to_one_cribTotal"; - public static String item_to_two_cribTotal = "to_two_cribTotal"; - public static String item_to_one_qty = "to_one_qty"; - public static String item_to_two_qty = "to_two_qty"; - public static String item_to_tool_coordinate = "to_tool_coordinate"; - - - private LnshPackagePalletManipulatorDeviceDriver driver; - - public ItemProtocol(LnshPackagePalletManipulatorDeviceDriver driver) { - this.driver = driver; - } - - public int getHeartbeat() { - return this.getOpcIntegerValue(item_heartbeat); - } - - public int getMode() { - return this.getOpcIntegerValue(item_mode); - } - - public int getStatus() { - return this.getOpcIntegerValue(item_status); - } - - public int getError() { - return this.getOpcIntegerValue(item_error); - } - - public int getPutStation() { - return this.getOpcIntegerValue(item_putStation); - } - - public String getBarcode() { - return this.getOpcStringValue(item_barcode); - } - - public String getMaterial() { - return this.getOpcStringValue(item_material); - } - - public int getQty() { - return this.getOpcIntegerValue(item_qty); - } - - public int getOpen_time() { - return this.getOpcIntegerValue(item_open_time); - } - - public int getStandby_time() { - return this.getOpcIntegerValue(item_standby_time); - } - - public int getProduction_time() { - return this.getOpcIntegerValue(item_production_time); - } - - public int getError_time() { - return this.getOpcIntegerValue(item_error_time); - } - - public String getOrder_No() { - return this.getOpcStringValue(item_order_No); - } - - public int getProduct_code() { - return this.getOpcIntegerValue(item_product_code); - } - - public int getAlongSide() { - return this.getOpcIntegerValue(item_AlongSide); - } - - public int getBshortSide() { - return this.getOpcIntegerValue(item_BshortSide); - } - - public int getHtrapezoidal() { - return this.getOpcIntegerValue(item_Htrapezoidal); - } - - public int getWthickness() { - return this.getOpcIntegerValue(item_Wthickness); - } - - public int getTray_qty() { - return this.getOpcIntegerValue(item_tray_qty); - } - - public int getTray_high() { - return this.getOpcIntegerValue(item_tray_high); - } - - public int getCrib_category() { - return this.getOpcIntegerValue(item_crib_category); - } - - public Float getPalletX1_line() { - return this.getOpcFloatValue(item_palletX1_line); - } - - public Float getPalletY1_row() { - return this.getOpcFloatValue(item_palletY1_row); - } - - public Float getPalletA1_angle() { - return this.getOpcFloatValue(item_palletA1_angle); - } - - public Float getPalletX2_line() { - return this.getOpcFloatValue(item_palletX2_line); - } - - public Float getPalletY2_row() { - return this.getOpcFloatValue(item_palletY2_row); - } - - public Float getPalletA2_angle() { - return this.getOpcFloatValue(item_palletA2_angle); - } - - public Float getPalletX3_line() { - return this.getOpcFloatValue(item_palletX3_line); - } - - public Float getPalletY3_row() { - return this.getOpcFloatValue(item_palletY3_row); - } - - public Float getPalletA3_angle() { - return this.getOpcFloatValue(item_palletA3_angle); - } - - public Float getPressCribX1_line() { - return this.getOpcFloatValue(item_pressCribX1_line); - } - - public Float getPressCribY1_row() { - return this.getOpcFloatValue(item_pressCribY1_row); - } - - public Float getPressCribA1_angle() { - return this.getOpcFloatValue(item_pressCribA1_angle); - } - - public Float getPressCribX2_line() { - return this.getOpcFloatValue(item_pressCribX2_line); - } - - public Float getPressCribY2_row() { - return this.getOpcFloatValue(item_pressCribY2_row); - } - - public Float getPressCribA2_angle() { - return this.getOpcFloatValue(item_pressCribA2_angle); - } - - public Float getPressCribX3_line() { - return this.getOpcFloatValue(item_pressCribX3_line); - } - - public Float getPressCribY3_row() { - return this.getOpcFloatValue(item_pressCribY3_row); - } - - public Float getPressCribA3_angle() { - return this.getOpcFloatValue(item_pressCribA3_angle); - } - - public Float getZoffset() { - return this.getOpcFloatValue(item_Zoffset); - } - - public int getPallet_layerQty() { - return this.getOpcIntegerValue(item_pallet_layerQty); - } - - public int getPressCrib_layerQty() { - return this.getOpcIntegerValue(item_pressCrib_layerQty); - } - - public Float getCodeLayerX1_interval() { - return this.getOpcFloatValue(item_codeLayerX1_interval); - } - - public Float getCodeLayerY1_interval() { - return this.getOpcFloatValue(item_codeLayerY1_interval); - } - - public Float getCodeLayerX2_interval() { - return this.getOpcFloatValue(item_codeLayerX2_interval); - } - - public Float getCodeLayerY2_interval() { - return this.getOpcFloatValue(item_codeLayerY2_interval); - } - - public Float getCodeLayerX3_interval() { - return this.getOpcFloatValue(item_codeLayerX3_interval); - } - - public Float getcodeLayerY3_interval() { - return this.getOpcFloatValue(item_codeLayerY3_interval); - } - - public Float getCodeLayerX1_offset() { - return this.getOpcFloatValue(item_codeLayerX1_offset); - } - - public Float getCodeLayerY1_offset() { - return this.getOpcFloatValue(item_codeLayerY1_offset); - } - - public Float getCodeLayerX2_offset() { - return this.getOpcFloatValue(item_codeLayerX2_offset); - } - - public Float getCodeLayerY2_offset() { - return this.getOpcFloatValue(item_codeLayerY2_offset); - } - - public Float getCodeLayerX3_offset() { - return this.getOpcFloatValue(item_codeLayerX3_offset); - } - - public Float getCodeLayerY3_offset() { - return this.getOpcFloatValue(item_codeLayerY3_offset); - } - - public Float getPressLayerX1_interval() { - return this.getOpcFloatValue(item_pressLayerX1_interval); - } - - public Float getPressLayerY1_interval() { - return this.getOpcFloatValue(item_pressLayerY1_interval); - } - - public Float getPressLayerX2_interval() { - return this.getOpcFloatValue(item_pressLayerX2_interval); - } - - public Float getPressLayerY2_interval() { - return this.getOpcFloatValue(item_pressLayerY2_interval); - } - - public Float getPressLayerX3_interval() { - return this.getOpcFloatValue(item_pressLayerX3_interval); - } - - public Float getPressLayerY3_interval() { - return this.getOpcFloatValue(item_pressLayerY3_interval); - } - - public Float getPressLayerX1_offset() { - return this.getOpcFloatValue(item_pressLayerX1_offset); - } - - public Float getPressLayerY1_offset() { - return this.getOpcFloatValue(item_pressLayerY1_offset); - } - - public Float getPressLayerX2_offset() { - return this.getOpcFloatValue(item_pressLayerX2_offset); - } - - public Float getPressLayerY2_offset() { - return this.getOpcFloatValue(item_pressLayerY2_offset); - } - - public Float getPressLayerX3_offset() { - return this.getOpcFloatValue(item_pressLayerX3_offset); - } - - public Float getPressLayerY3_offset() { - return this.getOpcFloatValue(item_pressLayerY3_offset); - } - - public int getOne_cribTotal() { - return this.getOpcIntegerValue(item_one_cribTotal); - } - - public int getTwo_cribTotal() { - return this.getOpcIntegerValue(item_two_cribTotal); - } - - public int getOne_qty() { - return this.getOpcIntegerValue(item_one_qty); - } - - public int getTwo_qty() { - return this.getOpcIntegerValue(item_two_qty); - } - - public int getTool_coordinate() { - return this.getOpcIntegerValue(item_tool_coordinate); - } - - public int getTo_feedback() { - return this.getOpcIntegerValue(item_to_feedback); - } - - public int getTo_error() { - return this.getOpcIntegerValue(item_to_error); - } - - public int getTo_material_qty() { - return this.getOpcIntegerValue(item_to_material_qty); - } - - public int getTo_allow_pallet_qty() { - return this.getOpcIntegerValue(item_to_allow_pallet_qty); - } - - public int getTo_material_type() { - return this.getOpcIntegerValue(item_to_material_type); - } - - public int getTo_material_code() { - return this.getOpcIntegerValue(item_to_material_code); - } - - public String getTo_order_No() { - return this.getOpcStringValue(item_to_order_No); - } - - public int getToProduct_code() { - return this.getOpcIntegerValue(item_to_product_code); - } - - public int getToAlongSide() { - return this.getOpcIntegerValue(item_to_AlongSide); - } - - public int getToBshortSide() { - return this.getOpcIntegerValue(item_to_BshortSide); - } - - public int getToHtrapezoidal() { - return this.getOpcIntegerValue(item_to_Htrapezoidal); - } - - public int getToWthickness() { - return this.getOpcIntegerValue(item_to_Wthickness); - } - - public int getToTray_qty() { - return this.getOpcIntegerValue(item_to_tray_qty); - } - - public int getToTray_high() { - return this.getOpcIntegerValue(item_to_tray_high); - } - - public int getToCrib_category() { - return this.getOpcIntegerValue(item_to_crib_category); - } - - public Float getToPalletX1_line() { - return this.getOpcFloatValue(item_to_palletX1_line); - } - - public Float getToPalletY1_row() { - return this.getOpcFloatValue(item_to_palletY1_row); - } - - public Float getToPalletA1_angle() { - return this.getOpcFloatValue(item_to_palletA1_angle); - } - - public Float getToPalletX2_line() { - return this.getOpcFloatValue(item_to_palletX2_line); - } - - public Float getToPalletY2_row() { - return this.getOpcFloatValue(item_to_palletY2_row); - } - - public Float getToPalletA2_angle() { - return this.getOpcFloatValue(item_to_palletA2_angle); - } - - public Float getToPalletX3_line() { - return this.getOpcFloatValue(item_to_palletX3_line); - } - - public Float getToPalletY3_row() { - return this.getOpcFloatValue(item_to_palletY3_row); - } - - public Float getToPalletA3_angle() { - return this.getOpcFloatValue(item_to_palletA3_angle); - } - - public Float getToPressCribX1_line() { - return this.getOpcFloatValue(item_to_pressCribX1_line); - } - - public Float getToPressCribY1_row() { - return this.getOpcFloatValue(item_to_pressCribY1_row); - } - - public Float getToPressCribA1_angle() { - return this.getOpcFloatValue(item_to_pressCribA1_angle); - } - - public Float getToPressCribX2_line() { - return this.getOpcFloatValue(item_to_pressCribX2_line); - } - - public Float getToPressCribY2_row() { - return this.getOpcFloatValue(item_to_pressCribY2_row); - } - - public Float getToPressCribA2_angle() { - return this.getOpcFloatValue(item_to_pressCribA2_angle); - } - - public Float getToPressCribX3_line() { - return this.getOpcFloatValue(item_to_pressCribX3_line); - } - - public Float getToPressCribY3_row() { - return this.getOpcFloatValue(item_to_pressCribY3_row); - } - - public Float getToPressCribA3_angle() { - return this.getOpcFloatValue(item_to_pressCribA3_angle); - } - - public Float getToZoffset() { - return this.getOpcFloatValue(item_to_Zoffset); - } - - public int getToPallet_layerQty() { - return this.getOpcIntegerValue(item_to_pallet_layerQty); - } - - public int getToPressCrib_layerQty() { - return this.getOpcIntegerValue(item_to_pressCrib_layerQty); - } - - public Float getToCodeLayerX1_interval() { - return this.getOpcFloatValue(item_to_codeLayerX1_interval); - } - - public Float getToCodeLayerY1_interval() { - return this.getOpcFloatValue(item_to_codeLayerY1_interval); - } - - public Float getToCodeLayerX2_interval() { - return this.getOpcFloatValue(item_to_codeLayerX2_interval); - } - - public Float getToCodeLayerY2_interval() { - return this.getOpcFloatValue(item_to_codeLayerY2_interval); - } - - public Float getToCodeLayerX3_interval() { - return this.getOpcFloatValue(item_to_codeLayerX3_interval); - } - - public Float getTocodeLayerY3_interval() { - return this.getOpcFloatValue(item_to_codeLayerY3_interval); - } - - public Float getToCodeLayerX1_offset() { - return this.getOpcFloatValue(item_to_codeLayerX1_offset); - } - - public Float getToCodeLayerY1_offset() { - return this.getOpcFloatValue(item_to_codeLayerY1_offset); - } - - public Float getToCodeLayerX2_offset() { - return this.getOpcFloatValue(item_to_codeLayerX2_offset); - } - - public Float getToCodeLayerY2_offset() { - return this.getOpcFloatValue(item_to_codeLayerY2_offset); - } - - public Float getToCodeLayerX3_offset() { - return this.getOpcFloatValue(item_to_codeLayerX3_offset); - } - - public Float getToCodeLayerY3_offset() { - return this.getOpcFloatValue(item_to_codeLayerY3_offset); - } - - public Float getToPressLayerX1_interval() { - return this.getOpcFloatValue(item_to_pressLayerX1_interval); - } - - public Float getToPressLayerY1_interval() { - return this.getOpcFloatValue(item_to_pressLayerY1_interval); - } - - public Float getToPressLayerX2_interval() { - return this.getOpcFloatValue(item_to_pressLayerX2_interval); - } - - public Float getToPressLayerY2_interval() { - return this.getOpcFloatValue(item_to_pressLayerY2_interval); - } - - public Float getToPressLayerX3_interval() { - return this.getOpcFloatValue(item_to_pressLayerX3_interval); - } - - public Float getToPressLayerY3_interval() { - return this.getOpcFloatValue(item_to_pressLayerY3_interval); - } - - public Float getToPressLayerX1_offset() { - return this.getOpcFloatValue(item_to_pressLayerX1_offset); - } - - public Float getToPressLayerY1_offset() { - return this.getOpcFloatValue(item_to_pressLayerY1_offset); - } - - public Float getToPressLayerX2_offset() { - return this.getOpcFloatValue(item_to_pressLayerX2_offset); - } - - public Float getToPressLayerY2_offset() { - return this.getOpcFloatValue(item_to_pressLayerY2_offset); - } - - public Float getToPressLayerX3_offset() { - return this.getOpcFloatValue(item_to_pressLayerX3_offset); - } - - public Float getToPressLayerY3_offset() { - return this.getOpcFloatValue(item_to_pressLayerY3_offset); - } - - public int getToOne_cribTotal() { - return this.getOpcIntegerValue(item_to_one_cribTotal); - } - - public int getToTwo_cribTotal() { - return this.getOpcIntegerValue(item_to_two_cribTotal); - } - - public int getToOne_qty() { - return this.getOpcIntegerValue(item_to_one_qty); - } - - public int getToTwo_qty() { - return this.getOpcIntegerValue(item_to_two_qty); - } - - public int getToTool_coordinate() { - return this.getOpcIntegerValue(item_to_tool_coordinate); - } - - //是否有货 - 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 Float getOpcFloatValue(String protocol) { - Float value = this.driver.getFloatValue(protocol); - if (ObjectUtil.isEmpty(value)) { -// log.error("读取错误!"); - } else { - return value; - } - return 0.0f; - } - - public String getOpcStringValue(String protocol) { - String value = this.driver.getStringValue(protocol); - if (StrUtil.isEmpty(value)) { -// log.error("读取错误!"); - } else { - return value; - } - return "0"; - } - - public static List getReadableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_heartbeat, "心跳", "DB1.B0")); - list.add(new ItemDto(item_mode, "工作状态", "DB1.B1", Boolean.valueOf(true))); - list.add(new ItemDto(item_status, "设备状态", "DB1.B2")); - list.add(new ItemDto(item_error, "故障代码", "DB1.B3")); - list.add(new ItemDto(item_putStation, "当前码盘工位", "DB1.D4")); - list.add(new ItemDto(item_barcode, "当前码盘工位条码", "DB1.S8")); - list.add(new ItemDto(item_material, "码盘工位当前物料", "DB1.S264")); - list.add(new ItemDto(item_qty, "数量", "DB1.D520")); - list.add(new ItemDto(item_open_time, "开机时间", "DB1.D524")); - list.add(new ItemDto(item_standby_time, "待机时间", "DB1.D528")); - list.add(new ItemDto(item_production_time, "生产时间", "DB1.D532")); - list.add(new ItemDto(item_error_time, "故障时间", "DB1.D536")); - list.add(new ItemDto(item_order_No, "工单号", "DB1.S540")); - - list.add(new ItemDto(item_product_code, "产品编号", "DB1.D796")); - list.add(new ItemDto(item_AlongSide, "A长边", "DB1.D800")); - list.add(new ItemDto(item_BshortSide, "B短边", "DB1.D804")); - list.add(new ItemDto(item_Htrapezoidal, "H梯形高", "DB1.D808")); - list.add(new ItemDto(item_Wthickness, "W厚度", "DB1.D812")); - list.add(new ItemDto(item_tray_qty, "当前垛盘数", "DB1.D816")); - list.add(new ItemDto(item_tray_high, "垛盘高度", "DB1.D820")); - list.add(new ItemDto(item_crib_category, "垛型类别", "DB1.D824")); - list.add(new ItemDto(item_palletX1_line, "码垛X1行", "DB1.REAL828")); - list.add(new ItemDto(item_palletY1_row, "码垛Y1列", "DB1.REAL832")); - list.add(new ItemDto(item_palletA1_angle, "码垛A1角度", "DB1.REAL836")); - list.add(new ItemDto(item_palletX2_line, "码垛X2行", "DB1.REAL840")); - list.add(new ItemDto(item_palletY2_row, "码垛Y2列", "DB1.REAL844")); - list.add(new ItemDto(item_palletA2_angle, "码垛A2角度", "DB1.REAL848")); - list.add(new ItemDto(item_palletX3_line, "码垛X3行", "DB1.REAL852")); - list.add(new ItemDto(item_palletY3_row, "码垛Y3列", "DB1.REAL856")); - list.add(new ItemDto(item_palletA3_angle, "码垛A3角度", "DB1.REAL860")); - list.add(new ItemDto(item_pressCribX1_line, "压垛X1行", "DB1.REAL864")); - list.add(new ItemDto(item_pressCribY1_row, "压垛Y1列", "DB1.REAL868")); - list.add(new ItemDto(item_pressCribA1_angle, "压垛A1角度", "DB1.REAL872")); - list.add(new ItemDto(item_pressCribX2_line, "压垛X2行", "DB1.REAL876")); - list.add(new ItemDto(item_pressCribY2_row, "压垛Y2列", "DB1.REAL880")); - list.add(new ItemDto(item_pressCribA2_angle, "压垛A2角度", "DB1.REAL884")); - list.add(new ItemDto(item_pressCribX3_line, "压垛X3行", "DB1.REAL888")); - list.add(new ItemDto(item_pressCribY3_row, "压垛Y3列", "DB1.REAL892")); - list.add(new ItemDto(item_pressCribA3_angle, "压垛A3角度", "DB1.REAL896")); - list.add(new ItemDto(item_Zoffset, "Z轴偏移", "DB1.REAL900")); - list.add(new ItemDto(item_pallet_layerQty, "码垛层数", "DB1.D904")); - list.add(new ItemDto(item_pressCrib_layerQty, "压垛层数", "DB1.D908")); - list.add(new ItemDto(item_codeLayerX1_interval, "码层X1间隔", "DB1.REAL912")); - list.add(new ItemDto(item_codeLayerY1_interval, "码层Y1间隔", "DB1.REAL916")); - list.add(new ItemDto(item_codeLayerX2_interval, "码层X2间隔", "DB1.REAL920")); - list.add(new ItemDto(item_codeLayerY2_interval, "码层Y2间隔", "DB1.REAL924")); - list.add(new ItemDto(item_codeLayerX3_interval, "码层X3间隔", "DB1.REAL928")); - list.add(new ItemDto(item_codeLayerY3_interval, "码层Y3间隔", "DB1.REAL932")); - list.add(new ItemDto(item_codeLayerX1_offset, "码层X1偏移", "DB1.REAL936")); - list.add(new ItemDto(item_codeLayerY1_offset, "码层Y1偏移", "DB1.REAL940")); - list.add(new ItemDto(item_codeLayerX2_offset, "码层X2偏移", "DB1.REAL944")); - list.add(new ItemDto(item_codeLayerY2_offset, "码层Y2偏移", "DB1.REAL948")); - list.add(new ItemDto(item_codeLayerX3_offset, "码层X3偏移", "DB1.REAL952")); - list.add(new ItemDto(item_codeLayerY3_offset, "码层Y3偏移", "DB1.REAL956")); - list.add(new ItemDto(item_pressLayerX1_interval, "压层X1间隔", "DB1.REAL960")); - list.add(new ItemDto(item_pressLayerY1_interval, "压层Y1间隔", "DB1.REAL964")); - list.add(new ItemDto(item_pressLayerX2_interval, "压层X2间隔", "DB1.REAL968")); - list.add(new ItemDto(item_pressLayerY2_interval, "压层Y2间隔", "DB1.REAL972")); - list.add(new ItemDto(item_pressLayerX3_interval, "压层X3间隔", "DB1.REAL976")); - list.add(new ItemDto(item_pressLayerY3_interval, "压层Y3间隔", "DB1.REAL980")); - list.add(new ItemDto(item_pressLayerX1_offset, "压层X1偏移", "DB1.REAL984")); - list.add(new ItemDto(item_pressLayerY1_offset, "压层Y1偏移", "DB1.REAL988")); - list.add(new ItemDto(item_pressLayerX2_offset, "压层X2偏移", "DB1.REAL992")); - list.add(new ItemDto(item_pressLayerY2_offset, "压层Y2偏移", "DB1.REAL996")); - list.add(new ItemDto(item_pressLayerX3_offset, "压层X3偏移", "DB1.REAL1000")); - list.add(new ItemDto(item_pressLayerY3_offset, "压层Y3偏移", "DB1.REAL1004")); - list.add(new ItemDto(item_one_cribTotal, "1#垛总数", "DB1.D1008")); - list.add(new ItemDto(item_two_cribTotal, "2#垛总数", "DB1.D1012")); - list.add(new ItemDto(item_one_qty, "1#垛当前数", "DB1.D1016")); - list.add(new ItemDto(item_two_qty, "2#垛当前数", "DB1.D1020")); - list.add(new ItemDto(item_tool_coordinate, "工具坐标", "DB1.D1024")); - return list; - } - - public static List getWriteableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_feedback, "机器人动作反馈", "DB2.B0")); - list.add(new ItemDto(item_to_error, "故障代码", "DB2.B1")); - list.add(new ItemDto(item_to_material_qty, "托盘上数量", "DB2.W2")); - list.add(new ItemDto(item_to_allow_pallet_qty, "允许码垛数量", "DB2.W4")); - list.add(new ItemDto(item_to_material_type, "托盘类型", "DB2.D6")); - list.add(new ItemDto(item_to_material_code, "下发物料编号", "DB2.D10")); - list.add(new ItemDto(item_to_order_No, "工单号", "DB2.S14")); - - list.add(new ItemDto(item_to_product_code, "产品编号", "DB2.D270")); - list.add(new ItemDto(item_to_AlongSide, "A长边", "DB2.D274")); - list.add(new ItemDto(item_to_BshortSide, "B短边", "DB2.D278")); - list.add(new ItemDto(item_to_Htrapezoidal, "H梯形高", "DB2.D282")); - list.add(new ItemDto(item_to_Wthickness, "W厚度", "DB2.D286")); - list.add(new ItemDto(item_to_tray_qty, "当前垛盘数", "DB2.D290")); - list.add(new ItemDto(item_to_tray_high, "垛盘高度", "DB2.D294")); - list.add(new ItemDto(item_to_crib_category, "垛型类别", "DB2.D298")); - list.add(new ItemDto(item_to_palletX1_line, "码垛X1行", "DB2.REAL302")); - list.add(new ItemDto(item_to_palletY1_row, "码垛Y1列", "DB2.REAL306")); - list.add(new ItemDto(item_to_palletA1_angle, "码垛A1角度", "DB2.REAL310")); - list.add(new ItemDto(item_to_palletX2_line, "码垛X2行", "DB2.REAL314")); - list.add(new ItemDto(item_to_palletY2_row, "码垛Y2列", "DB2.REAL318")); - list.add(new ItemDto(item_to_palletA2_angle, "码垛A2角度", "DB2.REAL322")); - list.add(new ItemDto(item_to_palletX3_line, "码垛X3行", "DB2.REAL326")); - list.add(new ItemDto(item_to_palletY3_row, "码垛Y3列", "DB2.REAL330")); - list.add(new ItemDto(item_to_palletA3_angle, "码垛A3角度", "DB2.REAL334")); - list.add(new ItemDto(item_to_pressCribX1_line, "压垛X1行", "DB2.REAL338")); - list.add(new ItemDto(item_to_pressCribY1_row, "压垛Y1列", "DB2.REAL342")); - list.add(new ItemDto(item_to_pressCribA1_angle, "压垛A1角度", "DB2.REAL346")); - list.add(new ItemDto(item_to_pressCribX2_line, "压垛X2行", "DB2.REAL350")); - list.add(new ItemDto(item_to_pressCribY2_row, "压垛Y2列", "DB2.REAL354")); - list.add(new ItemDto(item_to_pressCribA2_angle, "压垛A2角度", "DB2.REAL358")); - list.add(new ItemDto(item_to_pressCribX3_line, "压垛X3行", "DB2.REAL362")); - list.add(new ItemDto(item_to_pressCribY3_row, "压垛Y3列", "DB2.REAL366")); - list.add(new ItemDto(item_to_pressCribA3_angle, "压垛A3角度", "DB2.REAL370")); - list.add(new ItemDto(item_to_Zoffset, "Z轴偏移", "DB2.REAL374")); - list.add(new ItemDto(item_to_pallet_layerQty, "码垛层数", "DB2.D378")); - list.add(new ItemDto(item_to_pressCrib_layerQty, "压垛层数", "DB2.D382")); - list.add(new ItemDto(item_to_codeLayerX1_interval, "码层X1间隔", "DB2.REAL386")); - list.add(new ItemDto(item_to_codeLayerY1_interval, "码层Y1间隔", "DB2.REAL390")); - list.add(new ItemDto(item_to_codeLayerX2_interval, "码层X2间隔", "DB2.REAL394")); - list.add(new ItemDto(item_to_codeLayerY2_interval, "码层Y2间隔", "DB2.REAL398")); - list.add(new ItemDto(item_to_codeLayerX3_interval, "码层X3间隔", "DB2.REAL402")); - list.add(new ItemDto(item_to_codeLayerY3_interval, "码层Y3间隔", "DB2.REAL406")); - list.add(new ItemDto(item_to_codeLayerX1_offset, "码层X1偏移", "DB2.REAL410")); - list.add(new ItemDto(item_to_codeLayerY1_offset, "码层Y1偏移", "DB2.REAL414")); - list.add(new ItemDto(item_to_codeLayerX2_offset, "码层X2偏移", "DB2.REAL418")); - list.add(new ItemDto(item_to_codeLayerY2_offset, "码层Y2偏移", "DB2.REAL422")); - list.add(new ItemDto(item_to_codeLayerX3_offset, "码层X3偏移", "DB2.REAL426")); - list.add(new ItemDto(item_to_codeLayerY3_offset, "码层Y3偏移", "DB2.REAL430")); - list.add(new ItemDto(item_to_pressLayerX1_interval, "压层X1间隔", "DB2.REAL434")); - list.add(new ItemDto(item_to_pressLayerY1_interval, "压层Y1间隔", "DB2.REAL438")); - list.add(new ItemDto(item_to_pressLayerX2_interval, "压层X2间隔", "DB2.REAL442")); - list.add(new ItemDto(item_to_pressLayerY2_interval, "压层Y2间隔", "DB2.REAL446")); - list.add(new ItemDto(item_to_pressLayerX3_interval, "压层X3间隔", "DB2.REAL450")); - list.add(new ItemDto(item_to_pressLayerY3_interval, "压层Y3间隔", "DB2.REAL454")); - list.add(new ItemDto(item_to_pressLayerX1_offset, "压层X1偏移", "DB2.REAL458")); - list.add(new ItemDto(item_to_pressLayerY1_offset, "压层Y1偏移", "DB2.REAL462")); - list.add(new ItemDto(item_to_pressLayerX2_offset, "压层X2偏移", "DB2.REAL466")); - list.add(new ItemDto(item_to_pressLayerY2_offset, "压层Y2偏移", "DB2.REAL470")); - list.add(new ItemDto(item_to_pressLayerX3_offset, "压层X3偏移", "DB2.REAL474")); - list.add(new ItemDto(item_to_pressLayerY3_offset, "压层Y3偏移", "DB2.REAL478")); - list.add(new ItemDto(item_to_one_cribTotal, "1#垛总数", "DB2.D482")); - list.add(new ItemDto(item_to_two_cribTotal, "2#垛总数", "DB2.D486")); - list.add(new ItemDto(item_to_one_qty, "1#垛当前数", "DB2.D490")); - list.add(new ItemDto(item_to_two_qty, "2#垛当前数", "DB2.D494")); - list.add(new ItemDto(item_to_tool_coordinate, "工具坐标", "DB2. D498")); - return list; - } - -} - diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDefination.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDefination.java deleted file mode 100644 index 922e038..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDefination.java +++ /dev/null @@ -1,140 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_package_pallet_manipulator; - -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 LnshPackagePalletManipulatorDefination implements OpcDeviceDriverDefination { - @Override - public String getDriverCode() { - return "lnsh_package_pallet_manipulator"; - } - - @Override - public String getDriverName() { - return "晟华-包装码垛机械手"; - } - - @Override - public String getDriverDescription() { - return "晟华-包装码垛机械手"; - } - - @Override - public DeviceDriver getDriverInstance(Device device) { - return (new LnshPackagePalletManipulatorDeviceDriver()).setDevice(device).setDriverDefination(this); - - } - - @Override - public Class getDeviceDriverType() { - return LnshPackagePalletManipulatorDeviceDriver.class; - } - - @Override - public List getFitDeviceTypes() { - List types = new LinkedList(); - types.add(DeviceType.station); - return types; - } - - @Override - public List getReadableItemDtos() { - return getReadableItemDtos2(); - } - - public static List getReadableItemDtos2() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB1.B0")); - list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB1.B1", Boolean.valueOf(true))); - list.add(new ItemDto(ItemProtocol.item_status, "设备状态", "DB1.B2")); - list.add(new ItemDto(ItemProtocol.item_error, "故障代码", "DB1.B3")); - list.add(new ItemDto(ItemProtocol.item_putStation, "当前码盘工位", "DB1.D4")); - list.add(new ItemDto(ItemProtocol.item_barcode, "当前码盘工位条码", "DB1.S8")); - list.add(new ItemDto(ItemProtocol.item_material, "码盘工位当前物料", "DB1.S264")); - list.add(new ItemDto(ItemProtocol.item_qty, "数量", "DB1.D520")); - list.add(new ItemDto(ItemProtocol.item_open_time, "开机时间", "DB1.D524")); - list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "DB1.D528")); - list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "DB1.D532")); - list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "DB1.D536")); - list.add(new ItemDto(ItemProtocol.item_order_No, "工单号", "DB1.S540")); - - list.add(new ItemDto(ItemProtocol.item_product_code, "产品编号", "DB1.D796")); - list.add(new ItemDto(ItemProtocol.item_AlongSide, "A长边", "DB1.D800")); - list.add(new ItemDto(ItemProtocol.item_BshortSide, "B短边", "DB1.D804")); - list.add(new ItemDto(ItemProtocol.item_Htrapezoidal, "H梯形高", "DB1.D808")); - list.add(new ItemDto(ItemProtocol.item_Wthickness, "W厚度", "DB1.D812")); - list.add(new ItemDto(ItemProtocol.item_tray_qty, "当前垛盘数", "DB1.D816")); - list.add(new ItemDto(ItemProtocol.item_tray_high, "垛盘高度", "DB1.D820")); - list.add(new ItemDto(ItemProtocol.item_crib_category, "垛型类别", "DB1.D824")); - list.add(new ItemDto(ItemProtocol.item_palletX1_line, "码垛X1行", "DB1.REAL828")); - list.add(new ItemDto(ItemProtocol.item_palletY1_row, "码垛Y1列", "DB1.REAL832")); - list.add(new ItemDto(ItemProtocol.item_palletA1_angle, "码垛A1角度", "DB1.REAL836")); - list.add(new ItemDto(ItemProtocol.item_palletX2_line, "码垛X2行", "DB1.REAL840")); - list.add(new ItemDto(ItemProtocol.item_palletY2_row, "码垛Y2列", "DB1.REAL844")); - list.add(new ItemDto(ItemProtocol.item_palletA2_angle, "码垛A2角度", "DB1.REAL848")); - list.add(new ItemDto(ItemProtocol.item_palletX3_line, "码垛X3行", "DB1.REAL852")); - list.add(new ItemDto(ItemProtocol.item_palletY3_row, "码垛Y3列", "DB1.REAL856")); - list.add(new ItemDto(ItemProtocol.item_palletA3_angle, "码垛A3角度", "DB1.REAL860")); - list.add(new ItemDto(ItemProtocol.item_pressCribX1_line, "压垛X1行", "DB1.REAL864")); - list.add(new ItemDto(ItemProtocol.item_pressCribY1_row, "压垛Y1列", "DB1.REAL868")); - list.add(new ItemDto(ItemProtocol.item_pressCribA1_angle, "压垛A1角度", "DB1.REAL872")); - list.add(new ItemDto(ItemProtocol.item_pressCribX2_line, "压垛X2行", "DB1.REAL876")); - list.add(new ItemDto(ItemProtocol.item_pressCribY2_row, "压垛Y2列", "DB1.REAL880")); - list.add(new ItemDto(ItemProtocol.item_pressCribA2_angle, "压垛A2角度", "DB1.REAL884")); - list.add(new ItemDto(ItemProtocol.item_pressCribX3_line, "压垛X3行", "DB1.REAL888")); - list.add(new ItemDto(ItemProtocol.item_pressCribY3_row, "压垛Y3列", "DB1.REAL892")); - list.add(new ItemDto(ItemProtocol.item_pressCribA3_angle, "压垛A3角度", "DB1.REAL896")); - list.add(new ItemDto(ItemProtocol.item_Zoffset, "Z轴偏移", "DB1.REAL900")); - list.add(new ItemDto(ItemProtocol.item_pallet_layerQty, "码垛层数", "DB1.D904")); - list.add(new ItemDto(ItemProtocol.item_pressCrib_layerQty, "压垛层数", "DB1.D908")); - list.add(new ItemDto(ItemProtocol.item_codeLayerX1_interval, "码层X1间隔", "DB1.REAL912")); - list.add(new ItemDto(ItemProtocol.item_codeLayerY1_interval, "码层Y1间隔", "DB1.REAL916")); - list.add(new ItemDto(ItemProtocol.item_codeLayerX2_interval, "码层X2间隔", "DB1.REAL920")); - list.add(new ItemDto(ItemProtocol.item_codeLayerY2_interval, "码层Y2间隔", "DB1.REAL924")); - list.add(new ItemDto(ItemProtocol.item_codeLayerX3_interval, "码层X3间隔", "DB1.REAL928")); - list.add(new ItemDto(ItemProtocol.item_codeLayerY3_interval, "码层Y3间隔", "DB1.REAL932")); - list.add(new ItemDto(ItemProtocol.item_codeLayerX1_offset, "码层X1偏移", "DB1.REAL936")); - list.add(new ItemDto(ItemProtocol.item_codeLayerY1_offset, "码层Y1偏移", "DB1.REAL940")); - list.add(new ItemDto(ItemProtocol.item_codeLayerX2_offset, "码层X2偏移", "DB1.REAL944")); - list.add(new ItemDto(ItemProtocol.item_codeLayerY2_offset, "码层Y2偏移", "DB1.REAL948")); - list.add(new ItemDto(ItemProtocol.item_codeLayerX3_offset, "码层X3偏移", "DB1.REAL952")); - list.add(new ItemDto(ItemProtocol.item_codeLayerY3_offset, "码层Y3偏移", "DB1.REAL956")); - list.add(new ItemDto(ItemProtocol.item_pressLayerX1_interval, "压层X1间隔", "DB1.REAL960")); - list.add(new ItemDto(ItemProtocol.item_pressLayerY1_interval, "压层Y1间隔", "DB1.REAL964")); - list.add(new ItemDto(ItemProtocol.item_pressLayerX2_interval, "压层X2间隔", "DB1.REAL968")); - list.add(new ItemDto(ItemProtocol.item_pressLayerY2_interval, "压层Y2间隔", "DB1.REAL972")); - list.add(new ItemDto(ItemProtocol.item_pressLayerX3_interval, "压层X3间隔", "DB1.REAL976")); - list.add(new ItemDto(ItemProtocol.item_pressLayerY3_interval, "压层Y3间隔", "DB1.REAL980")); - list.add(new ItemDto(ItemProtocol.item_pressLayerX1_offset, "压层X1偏移", "DB1.REAL984")); - list.add(new ItemDto(ItemProtocol.item_pressLayerY1_offset, "压层Y1偏移", "DB1.REAL988")); - list.add(new ItemDto(ItemProtocol.item_pressLayerX2_offset, "压层X2偏移", "DB1.REAL992")); - list.add(new ItemDto(ItemProtocol.item_pressLayerY2_offset, "压层Y2偏移", "DB1.REAL996")); - list.add(new ItemDto(ItemProtocol.item_pressLayerX3_offset, "压层X3偏移", "DB1.REAL1000")); - list.add(new ItemDto(ItemProtocol.item_pressLayerY3_offset, "压层Y3偏移", "DB1.REAL1004")); - list.add(new ItemDto(ItemProtocol.item_one_cribTotal, "1#垛总数", "DB1.D1008")); - list.add(new ItemDto(ItemProtocol.item_two_cribTotal, "2#垛总数", "DB1.D1012")); - list.add(new ItemDto(ItemProtocol.item_one_qty, "1#垛当前数", "DB1.D1016")); - list.add(new ItemDto(ItemProtocol.item_two_qty, "2#垛当前数", "DB1.D1020")); - list.add(new ItemDto(ItemProtocol.item_tool_coordinate, "工具坐标", "DB1.D1024")); - return list; - } - - @Override - public List getWriteableItemDtos() { - return ItemProtocol.getWriteableItemDtos(); - } - -} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDeviceDriver.java deleted file mode 100644 index d1747d6..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDeviceDriver.java +++ /dev/null @@ -1,1206 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_package_pallet_manipulator; - -import cn.hutool.core.date.DateUtil; -import cn.hutool.core.util.IdUtil; -import cn.hutool.core.util.StrUtil; -import cn.hutool.http.HttpResponse; -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.ext.wms.service.AcsToWmsService; -import org.nl.acs.instruction.service.InstructionService; -import org.nl.acs.instruction.service.dto.Instruction; - -import org.nl.acs.log.service.DeviceExecuteLogService; -import org.nl.acs.opc.Device; -import org.nl.acs.opc.WcsConfig; -import org.nl.acs.order.service.ProduceshiftorderService; -import org.nl.acs.order.service.dto.ProduceshiftorderDto; -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.lang.reflect.Field; -import java.util.*; - -/** - * 晟华-包装码垛机械手 - */ -@Slf4j -@Data -@RequiredArgsConstructor -public class LnshPackagePalletManipulatorDeviceDriver 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 - DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); - @Autowired - AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl"); - @Autowired - ProduceshiftorderService produceshiftorderService = SpringContextHolder.getBean("produceshiftorderServiceImpl"); - - int mode = 0; - int error = 0; - int last_mode = 0; - int last_error = 0; - Boolean isonline = true; - int hasGoods = 0; - String message = null; - Boolean iserror = false; - - 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; - //当前指令 - Instruction inst = null; - //上次指令 - Instruction last_inst = null; - - - //暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域 - int flag; - - String device_code; - int status = 0; - int last_status = 0; - //开机时间 - int open_time = 0; - int last_open_time = 0; - //待机时间 - int standby_time = 0; - int last_standby_time = 0; - //生产时间 - int production_time = 0; - int last_production_time = 0; - //故障时间 - int error_time = 0; - int last_error_time = 0; - int put_station = 0; - int last_put_station = 0; - String barcode; - String last_barcode; - String material; - String last_material; - String order_No = "0"; - String last_order_No = "0"; - int qty = 0; - int last_qty = 0; - - //垛型参数 - int product_code = 0; - int AlongSide = 0; - int BshortSide = 0; - int Htrapezoidal = 0; - int Wthickness = 0; - int tray_qty = 0; - int tray_high = 0; - int crib_category = 0; - float palletX1_line = 0f; - float palletY1_row = 0f; - float palletA1_angle = 0f; - float palletX2_line = 0f; - float palletY2_row = 0f; - float palletA2_angle = 0f; - float palletX3_line = 0f; - float palletY3_row = 0f; - float palletA3_angle = 0f; - float pressCribX1_line = 0f; - float pressCribY1_row = 0f; - float pressCribA1_angle = 0f; - float pressCribX2_line = 0f; - float pressCribY2_row = 0f; - float pressCribA2_angle = 0f; - float pressCribX3_line = 0f; - float pressCribY3_row = 0f; - float pressCribA3_angle = 0f; - float Zoffset = 0f; - int pallet_layerQty = 0; - int pressCrib_layerQty = 0; - float codeLayerX1_interval = 0f; - float codeLayerY1_interval = 0f; - float codeLayerX2_interval = 0f; - float codeLayerY2_interval = 0f; - float codeLayerX3_interval = 0f; - float codeLayerY3_interval = 0f; - float codeLayerX1_offset = 0f; - float codeLayerY1_offset = 0f; - float codeLayerX2_offset = 0f; - float codeLayerY2_offset = 0f; - float codeLayerX3_offset = 0f; - float codeLayerY3_offset = 0f; - float pressLayerX1_interval = 0f; - float pressLayerY1_interval = 0f; - float pressLayerX2_interval = 0f; - float pressLayerY2_interval = 0f; - float pressLayerX3_interval = 0f; - float pressLayerY3_interval = 0f; - float pressLayerX1_offset = 0f; - float pressLayerY1_offset = 0f; - float pressLayerX2_offset = 0f; - float pressLayerY2_offset = 0f; - float pressLayerX3_offset = 0f; - float pressLayerY3_offset = 0f; - int one_cribTotal = 0; - int two_cribTotal = 0; - int one_qty = 0; - int two_qty = 0; - int tool_coordinate = 0; - - int last_product_code = 0; - int last_AlongSide = 0; - int last_BshortSide = 0; - int last_Htrapezoidal = 0; - int last_Wthickness = 0; - int last_tray_qty = 0; - int last_tray_high = 0; - int last_crib_category = 0; - float last_palletX1_line = 0f; - float last_palletY1_row = 0f; - float last_palletA1_angle = 0f; - float last_palletX2_line = 0f; - float last_palletY2_row = 0f; - float last_palletA2_angle = 0f; - float last_palletX3_line = 0f; - float last_palletY3_row = 0f; - float last_palletA3_angle = 0f; - float last_pressCribX1_line = 0f; - float last_pressCribY1_row = 0f; - float last_pressCribA1_angle = 0f; - float last_pressCribX2_line = 0f; - float last_pressCribY2_row = 0f; - float last_pressCribA2_angle = 0f; - float last_pressCribX3_line = 0f; - float last_pressCribY3_row = 0f; - float last_pressCribA3_angle = 0f; - float last_Zoffset = 0f; - int last_pallet_layerQty = 0; - int last_pressCrib_layerQty = 0; - float last_codeLayerX1_interval = 0f; - float last_codeLayerY1_interval = 0f; - float last_codeLayerX2_interval = 0f; - float last_codeLayerY2_interval = 0f; - float last_codeLayerX3_interval = 0f; - float last_codeLayerY3_interval = 0f; - float last_codeLayerX1_offset = 0f; - float last_codeLayerY1_offset = 0f; - float last_codeLayerX2_offset = 0f; - float last_codeLayerY2_offset = 0f; - float last_codeLayerX3_offset = 0f; - float last_codeLayerY3_offset = 0f; - float last_pressLayerX1_interval = 0f; - float last_pressLayerY1_interval = 0f; - float last_pressLayerX2_interval = 0f; - float last_pressLayerY2_interval = 0f; - float last_pressLayerX3_interval = 0f; - float last_pressLayerY3_interval = 0f; - float last_pressLayerX1_offset = 0f; - float last_pressLayerY1_offset = 0f; - float last_pressLayerX2_offset = 0f; - float last_pressLayerY2_offset = 0f; - float last_pressLayerX3_offset = 0f; - float last_pressLayerY3_offset = 0f; - int last_one_cribTotal = 0; - int last_two_cribTotal = 0; - int last_one_qty = 0; - int last_two_qty = 0; - int last_tool_coordinate = 0; - - @Override - public Device getDevice() { - return this.device; - } - - - @Override - public void execute() { - String message = null; - try { - device_code = this.getDeviceCode(); - mode = this.itemProtocol.getMode(); - status = this.itemProtocol.getStatus(); - error = this.itemProtocol.getError(); - put_station = this.itemProtocol.getPutStation(); - barcode = this.itemProtocol.getBarcode(); - material = this.itemProtocol.getMaterial(); - open_time = this.itemProtocol.getOpen_time(); - standby_time = this.itemProtocol.getStandby_time(); - production_time = this.itemProtocol.getProduction_time(); - error_time = this.itemProtocol.getError_time(); - order_No = this.itemProtocol.getOrder_No(); - qty = this.itemProtocol.getQty(); - - product_code = this.itemProtocol.getProduct_code(); - AlongSide = this.itemProtocol.getAlongSide(); - BshortSide = this.itemProtocol.getBshortSide(); - Htrapezoidal = this.itemProtocol.getHtrapezoidal(); - Wthickness = this.itemProtocol.getWthickness(); - tray_qty = this.itemProtocol.getTray_qty(); - tray_high = this.itemProtocol.getTray_high(); - crib_category = this.itemProtocol.getCrib_category(); - palletX1_line = this.itemProtocol.getPalletX1_line(); - palletY1_row = this.itemProtocol.getPalletY1_row(); - palletA1_angle = this.itemProtocol.getPalletA1_angle(); - palletX2_line = this.itemProtocol.getPalletX2_line(); - palletY2_row = this.itemProtocol.getPalletY2_row(); - palletA2_angle = this.itemProtocol.getPalletA2_angle(); - palletX3_line = this.itemProtocol.getPalletX3_line(); - palletY3_row = this.itemProtocol.getPalletY3_row(); - palletA3_angle = this.itemProtocol.getPalletA3_angle(); - pressCribX1_line = this.itemProtocol.getPressCribX1_line(); - pressCribY1_row = this.itemProtocol.getPressCribY1_row(); - pressCribA1_angle = this.itemProtocol.getPressCribA1_angle(); - pressCribX2_line = this.itemProtocol.getPressCribX2_line(); - pressCribY2_row = this.itemProtocol.getPressCribY2_row(); - pressCribA2_angle = this.itemProtocol.getPressCribA2_angle(); - pressCribX3_line = this.itemProtocol.getPressCribX3_line(); - pressCribY3_row = this.itemProtocol.getPressCribY3_row(); - pressCribA3_angle = this.itemProtocol.getPressCribA3_angle(); - Zoffset = this.itemProtocol.getZoffset(); - pallet_layerQty = this.itemProtocol.getPallet_layerQty(); - pressCrib_layerQty = this.itemProtocol.getPressCrib_layerQty(); - codeLayerX1_interval = this.itemProtocol.getCodeLayerX1_interval(); - codeLayerY1_interval = this.itemProtocol.getCodeLayerY1_interval(); - codeLayerX2_interval = this.itemProtocol.getCodeLayerX2_interval(); - codeLayerY2_interval = this.itemProtocol.getCodeLayerY2_interval(); - codeLayerX3_interval = this.itemProtocol.getCodeLayerX3_interval(); - codeLayerY3_interval = this.itemProtocol.getcodeLayerY3_interval(); - codeLayerX1_offset = this.itemProtocol.getCodeLayerX1_offset(); - codeLayerY1_offset = this.itemProtocol.getCodeLayerY1_offset(); - codeLayerX2_offset = this.itemProtocol.getCodeLayerX2_offset(); - codeLayerY2_offset = this.itemProtocol.getCodeLayerY2_offset(); - codeLayerX3_offset = this.itemProtocol.getCodeLayerX3_offset(); - codeLayerY3_offset = this.itemProtocol.getCodeLayerY3_offset(); - pressLayerX1_interval = this.itemProtocol.getPressLayerX1_interval(); - pressLayerY1_interval = this.itemProtocol.getPressLayerY1_interval(); - pressLayerX2_interval = this.itemProtocol.getPressLayerX2_interval(); - pressLayerY2_interval = this.itemProtocol.getPressLayerY2_interval(); - pressLayerX3_interval = this.itemProtocol.getPressLayerX3_interval(); - pressLayerY3_interval = this.itemProtocol.getPressLayerY3_interval(); - pressLayerX1_offset = this.itemProtocol.getPressLayerX1_offset(); - pressLayerY1_offset = this.itemProtocol.getPressLayerY1_offset(); - pressLayerX2_offset = this.itemProtocol.getPressLayerX2_offset(); - pressLayerY2_offset = this.itemProtocol.getPressLayerY2_offset(); - pressLayerX3_offset = this.itemProtocol.getPressLayerX3_offset(); - pressLayerY3_offset = this.itemProtocol.getPressLayerY3_offset(); - one_cribTotal = this.itemProtocol.getOne_cribTotal(); - two_cribTotal = this.itemProtocol.getTwo_cribTotal(); - one_qty = this.itemProtocol.getOne_qty(); - two_qty = this.itemProtocol.getTwo_qty(); - tool_coordinate = this.itemProtocol.getTool_coordinate(); - - if (mode != last_mode) { - this.setRequireSucess(false); - logServer.deviceItemValue(this.device_code,"mode" ,String.valueOf(mode)); - logServer.deviceExecuteLog(this.device_code,"","","信号mode:" + last_mode + "->" + mode); - } - if (status != last_status) { - logServer.deviceItemValue(this.device_code,"status" ,String.valueOf(status)); - logServer.deviceExecuteLog(this.device_code,"","","信号status:" + last_status + "->" + status); - } - if (put_station != last_put_station) { - logServer.deviceItemValue(this.device_code,"put_station" ,String.valueOf(put_station)); - logServer.deviceExecuteLog(this.device_code,"","","信号put_station:" + last_put_station + "->" + put_station); - } - if (error != last_error) { - logServer.deviceItemValue(this.device_code,"error" ,String.valueOf(error)); - logServer.deviceExecuteLog(this.device_code,"","","信号error:" + last_error + "->" + error); - } - if (open_time != last_open_time) { - logServer.deviceItemValue(this.device_code,"open_time" ,String.valueOf(open_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号open_time:" + last_open_time + "->" + open_time); - } - if (standby_time != last_standby_time) { - logServer.deviceItemValue(this.device_code,"standby_time" ,String.valueOf(standby_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号standby_time:" + last_standby_time + "->" + standby_time); - } - if (production_time != last_production_time) { - logServer.deviceItemValue(this.device_code,"production_time" ,String.valueOf(production_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号production_time:" + last_production_time + "->" + production_time); - } - if (error_time != last_error_time) { - logServer.deviceItemValue(this.device_code,"error_time" ,String.valueOf(error_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号error_time:" + last_error_time + "->" + error_time); - } - if (!StrUtil.equals(barcode,last_barcode)) { - logServer.deviceItemValue(this.device_code,"barcode", barcode); - logServer.deviceExecuteLog(this.device_code,"","","信号barcode:" + last_barcode + "->" + barcode); - } - if (!StrUtil.equals(material,last_material)) { - logServer.deviceItemValue(this.device_code,"material", material); - logServer.deviceExecuteLog(this.device_code,"","","信号material:" + last_material + "->" + material); - } - if (qty != last_qty) { - logServer.deviceItemValue(this.device_code,"qty" ,String.valueOf(qty)); - logServer.deviceExecuteLog(this.device_code,"","","信号qty:" + last_qty + "->" + qty); - } - if (!StrUtil.equals(order_No,last_order_No)) { - logServer.deviceItemValue(this.device_code,"order_No" ,order_No); - logServer.deviceExecuteLog(this.device_code,"","","信号order_No:" + last_order_No + "->" + order_No); - } - if (product_code != last_product_code) { - logServer.deviceItemValue(this.device_code,"product_code" ,String.valueOf(product_code)); - logServer.deviceExecuteLog(this.device_code,"","","信号product_code:" + last_product_code + "->" + product_code); - } - if (AlongSide != last_AlongSide) { - logServer.deviceItemValue(this.device_code,"AlongSide" ,String.valueOf(AlongSide)); - logServer.deviceExecuteLog(this.device_code,"","","信号AlongSide:" + last_AlongSide + "->" + AlongSide); - } - if (BshortSide != last_BshortSide) { - logServer.deviceItemValue(this.device_code,"BshortSide" ,String.valueOf(BshortSide)); - logServer.deviceExecuteLog(this.device_code,"","","信号BshortSide:" + last_BshortSide + "->" + BshortSide); - } - if (Htrapezoidal != last_Htrapezoidal) { - logServer.deviceItemValue(this.device_code,"Htrapezoidal" ,String.valueOf(Htrapezoidal)); - logServer.deviceExecuteLog(this.device_code,"","","信号Htrapezoidal:" + last_Htrapezoidal + "->" + Htrapezoidal); - } - if (Wthickness != last_Wthickness) { - logServer.deviceItemValue(this.device_code,"Wthickness" ,String.valueOf(Wthickness)); - logServer.deviceExecuteLog(this.device_code,"","","信号Wthickness:" + last_Wthickness + "->" + Wthickness); - } - if (tray_qty != last_tray_qty) { - logServer.deviceItemValue(this.device_code,"tray_qty" ,String.valueOf(tray_qty)); - logServer.deviceExecuteLog(this.device_code,"","","信号tray_qty:" + last_tray_qty + "->" + tray_qty); - } - if (tray_high != last_tray_high) { - logServer.deviceItemValue(this.device_code,"tray_high" ,String.valueOf(tray_high)); - logServer.deviceExecuteLog(this.device_code,"","","信号tray_high:" + last_tray_high + "->" + tray_high); - } - if (crib_category != last_crib_category) { - logServer.deviceItemValue(this.device_code,"crib_category" ,String.valueOf(crib_category)); - logServer.deviceExecuteLog(this.device_code,"","","信号crib_category:" + last_crib_category + "->" + crib_category); - } - if (palletX1_line != last_palletX1_line) { - logServer.deviceItemValue(this.device_code,"palletX1_line" ,String.valueOf(palletX1_line)); - logServer.deviceExecuteLog(this.device_code,"","","信号palletX1_line:" + last_palletX1_line + "->" + palletX1_line); - } - if (palletY1_row != last_palletY1_row) { - logServer.deviceItemValue(this.device_code,"palletY1_row" ,String.valueOf(palletY1_row)); - logServer.deviceExecuteLog(this.device_code,"","","信号palletY1_row:" + last_palletY1_row + "->" + palletY1_row); - } - if (palletA1_angle != last_palletA1_angle) { - logServer.deviceItemValue(this.device_code,"palletA1_angle" ,String.valueOf(palletA1_angle)); - logServer.deviceExecuteLog(this.device_code,"","","信号palletA1_angle:" + last_palletA1_angle + "->" + palletA1_angle); - } - if (palletX2_line != last_palletX2_line) { - logServer.deviceItemValue(this.device_code,"palletX2_line" ,String.valueOf(palletX2_line)); - logServer.deviceExecuteLog(this.device_code,"","","信号palletX2_line:" + last_palletX2_line + "->" + palletX2_line); - } - if (palletY2_row != last_palletY2_row) { - logServer.deviceItemValue(this.device_code,"palletY2_row" ,String.valueOf(palletY2_row)); - logServer.deviceExecuteLog(this.device_code,"","","信号palletY2_row:" + last_palletY2_row + "->" + palletY2_row); - } - if (palletA2_angle != last_palletA2_angle) { - logServer.deviceItemValue(this.device_code,"palletA2_angle" ,String.valueOf(palletA2_angle)); - logServer.deviceExecuteLog(this.device_code,"","","信号palletA2_angle:" + last_palletA2_angle + "->" + palletA2_angle); - } - if (palletX3_line != last_palletX3_line) { - logServer.deviceItemValue(this.device_code,"palletX3_line" ,String.valueOf(palletX3_line)); - logServer.deviceExecuteLog(this.device_code,"","","信号palletX3_line:" + last_palletX3_line + "->" + palletX3_line); - } - if (palletY3_row != last_palletY3_row) { - logServer.deviceItemValue(this.device_code,"palletY3_row" ,String.valueOf(palletY3_row)); - logServer.deviceExecuteLog(this.device_code,"","","信号palletY3_row:" + last_palletY3_row + "->" + palletY3_row); - } - if (palletA3_angle != last_palletA3_angle) { - logServer.deviceItemValue(this.device_code,"palletA3_angle" ,String.valueOf(palletA3_angle)); - logServer.deviceExecuteLog(this.device_code,"","","信号palletA3_angle:" + last_palletA3_angle + "->" + palletA3_angle); - } - if (pressCribX1_line != last_pressCribX1_line) { - logServer.deviceItemValue(this.device_code,"pressCribX1_line" ,String.valueOf(pressCribX1_line)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCribX1_line:" + last_pressCribX1_line + "->" + pressCribX1_line); - } - if (pressCribY1_row != last_pressCribY1_row) { - logServer.deviceItemValue(this.device_code,"pressCribY1_row" ,String.valueOf(pressCribY1_row)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCribY1_row:" + last_pressCribY1_row + "->" + pressCribY1_row); - } - if (pressCribA1_angle != last_pressCribA1_angle) { - logServer.deviceItemValue(this.device_code,"pressCribA1_angle" ,String.valueOf(pressCribA1_angle)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCribA1_angle:" + last_pressCribA1_angle + "->" + pressCribA1_angle); - } - if (pressCribX2_line != last_pressCribX2_line) { - logServer.deviceItemValue(this.device_code,"pressCribX2_line" ,String.valueOf(pressCribX2_line)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCribX2_line:" + last_pressCribX2_line + "->" + pressCribX2_line); - } - if (pressCribY2_row != last_pressCribY2_row) { - logServer.deviceItemValue(this.device_code,"pressCribY2_row" ,String.valueOf(pressCribY2_row)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCribY2_row:" + last_pressCribY2_row + "->" + pressCribY2_row); - } - if (pressCribA2_angle != last_pressCribA2_angle) { - logServer.deviceItemValue(this.device_code,"pressCribA2_angle" ,String.valueOf(pressCribA2_angle)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCribA2_angle:" + last_pressCribA2_angle + "->" + pressCribA2_angle); - } - if (pressCribX3_line != last_pressCribX3_line) { - logServer.deviceItemValue(this.device_code,"pressCribX3_line" ,String.valueOf(pressCribX3_line)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCribX3_line:" + last_pressCribX3_line + "->" + pressCribX3_line); - } - if (pressCribY3_row != last_pressCribY3_row) { - logServer.deviceItemValue(this.device_code,"pressCribY3_row" ,String.valueOf(pressCribY3_row)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCribY3_row:" + last_pressCribY3_row + "->" + pressCribY3_row); - } - if (pressCribA3_angle != last_pressCribA3_angle) { - logServer.deviceItemValue(this.device_code,"pressCribA3_angle" ,String.valueOf(pressCribA3_angle)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCribA3_angle:" + last_pressCribA3_angle + "->" + pressCribA3_angle); - } - if (Zoffset != last_Zoffset) { - logServer.deviceItemValue(this.device_code,"Zoffset" ,String.valueOf(Zoffset)); - logServer.deviceExecuteLog(this.device_code,"","","信号Zoffset:" + last_Zoffset + "->" + Zoffset); - } - if (pallet_layerQty != last_pallet_layerQty) { - logServer.deviceItemValue(this.device_code,"pallet_layerQty" ,String.valueOf(pallet_layerQty)); - logServer.deviceExecuteLog(this.device_code,"","","信号pallet_layerQty:" + last_pallet_layerQty + "->" + pallet_layerQty); - } - if (pressCrib_layerQty != last_pressCrib_layerQty) { - logServer.deviceItemValue(this.device_code,"pressCrib_layerQty" ,String.valueOf(pressCrib_layerQty)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCrib_layerQty:" + last_pressCrib_layerQty + "->" + pressCrib_layerQty); - } - if (codeLayerX1_interval != last_codeLayerX1_interval) { - logServer.deviceItemValue(this.device_code,"codeLayerX1_interval" ,String.valueOf(codeLayerX1_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerX1_interval:" + last_codeLayerX1_interval + "->" + codeLayerX1_interval); - } - if (codeLayerY1_interval != last_codeLayerY1_interval) { - logServer.deviceItemValue(this.device_code,"codeLayerY1_interval" ,String.valueOf(codeLayerY1_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerY1_interval:" + last_codeLayerY1_interval + "->" + codeLayerY1_interval); - } - if (codeLayerX2_interval != last_codeLayerX2_interval) { - logServer.deviceItemValue(this.device_code,"codeLayerX2_interval" ,String.valueOf(codeLayerX2_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerX2_interval:" + last_codeLayerX2_interval + "->" + codeLayerX2_interval); - } - if (codeLayerY2_interval != last_codeLayerY2_interval) { - logServer.deviceItemValue(this.device_code,"codeLayerY2_interval" ,String.valueOf(codeLayerY2_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerY2_interval:" + last_codeLayerY2_interval + "->" + codeLayerY2_interval); - } - if (codeLayerX3_interval != last_codeLayerX3_interval) { - logServer.deviceItemValue(this.device_code,"codeLayerX3_interval" ,String.valueOf(codeLayerX3_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerX3_interval:" + last_codeLayerX3_interval + "->" + codeLayerX3_interval); - } - if (codeLayerY3_interval != last_codeLayerY3_interval) { - logServer.deviceItemValue(this.device_code,"codeLayerY3_interval" ,String.valueOf(codeLayerY3_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerY3_interval:" + last_codeLayerY3_interval + "->" + codeLayerY3_interval); - } - if (codeLayerX1_offset != last_codeLayerX1_offset) { - logServer.deviceItemValue(this.device_code,"codeLayerX1_offset" ,String.valueOf(codeLayerX1_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerX1_offset:" + last_codeLayerX1_offset + "->" + codeLayerX1_offset); - } - if (codeLayerY1_offset != last_codeLayerY1_offset) { - logServer.deviceItemValue(this.device_code,"codeLayerY1_offset" ,String.valueOf(codeLayerY1_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerY1_offset:" + last_codeLayerY1_offset + "->" + codeLayerY1_offset); - } - if (codeLayerX2_offset != last_codeLayerX2_offset) { - logServer.deviceItemValue(this.device_code,"codeLayerX2_offset" ,String.valueOf(codeLayerX2_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerX2_offset:" + last_codeLayerX2_offset + "->" + codeLayerX2_offset); - } - if (codeLayerY2_offset != last_codeLayerY2_offset) { - logServer.deviceItemValue(this.device_code,"codeLayerY2_offset" ,String.valueOf(codeLayerY2_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerY2_offset:" + last_codeLayerY2_offset + "->" + codeLayerY2_offset); - } - if (codeLayerX3_offset != last_codeLayerX3_offset) { - logServer.deviceItemValue(this.device_code,"codeLayerX3_offset" ,String.valueOf(codeLayerX3_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerX3_offset:" + last_codeLayerX3_offset + "->" + codeLayerX3_offset); - } - if (codeLayerY3_offset != last_codeLayerY3_offset) { - logServer.deviceItemValue(this.device_code,"codeLayerY3_offset" ,String.valueOf(codeLayerY3_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerY3_offset:" + last_codeLayerY3_offset + "->" + codeLayerY3_offset); - } - if (pressLayerX1_interval != last_pressLayerX1_interval) { - logServer.deviceItemValue(this.device_code,"pressLayerX1_interval" ,String.valueOf(pressLayerX1_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerX1_interval:" + last_pressLayerX1_interval + "->" + pressLayerX1_interval); - } - if (pressLayerY1_interval != last_pressLayerY1_interval) { - logServer.deviceItemValue(this.device_code,"pressLayerY1_interval" ,String.valueOf(pressLayerY1_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerY1_interval:" + last_pressLayerY1_interval + "->" + pressLayerY1_interval); - } - if (pressLayerX2_interval != last_pressLayerX2_interval) { - logServer.deviceItemValue(this.device_code,"pressLayerX2_interval" ,String.valueOf(pressLayerX2_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerX2_interval:" + last_pressLayerX2_interval + "->" + pressLayerX2_interval); - } - if (pressLayerY2_interval != last_pressLayerY2_interval) { - logServer.deviceItemValue(this.device_code,"pressLayerY2_interval" ,String.valueOf(pressLayerY2_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerY2_interval:" + last_pressLayerY2_interval + "->" + pressLayerY2_interval); - } - if (pressLayerX3_interval != last_pressLayerX3_interval) { - logServer.deviceItemValue(this.device_code,"pressLayerX3_interval" ,String.valueOf(pressLayerX3_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerX3_interval:" + last_pressLayerX3_interval + "->" + pressLayerX3_interval); - } - if (pressLayerY3_interval != last_pressLayerY3_interval) { - logServer.deviceItemValue(this.device_code,"pressLayerY3_interval" ,String.valueOf(pressLayerY3_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerY3_interval:" + last_pressLayerY3_interval + "->" + pressLayerY3_interval); - } - if (pressLayerX1_offset != last_pressLayerX1_offset) { - logServer.deviceItemValue(this.device_code,"pressLayerX1_offset" ,String.valueOf(pressLayerX1_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerX1_offset:" + last_pressLayerX1_offset + "->" + pressLayerX1_offset); - } - if (pressLayerY1_offset != last_pressLayerY1_offset) { - logServer.deviceItemValue(this.device_code,"pressLayerY1_offset" ,String.valueOf(pressLayerY1_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerY1_offset:" + last_pressLayerY1_offset + "->" + pressLayerY1_offset); - } - if (pressLayerX2_offset != last_pressLayerX2_offset) { - logServer.deviceItemValue(this.device_code,"pressLayerX2_offset" ,String.valueOf(pressLayerX2_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerX2_offset:" + last_pressLayerX2_offset + "->" + pressLayerX2_offset); - } - if (pressLayerY2_offset != last_pressLayerY2_offset) { - logServer.deviceItemValue(this.device_code,"pressLayerY2_offset" ,String.valueOf(pressLayerY2_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerY2_offset:" + last_pressLayerY2_offset + "->" + pressLayerY2_offset); - } - if (pressLayerX3_offset != last_pressLayerX3_offset) { - logServer.deviceItemValue(this.device_code,"pressLayerX3_offset" ,String.valueOf(pressLayerX3_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerX3_offset:" + last_pressLayerX3_offset + "->" + pressLayerX3_offset); - } - if (pressLayerY3_offset != last_pressLayerY3_offset) { - logServer.deviceItemValue(this.device_code,"pressLayerY3_offset" ,String.valueOf(pressLayerY3_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerY3_offset:" + last_pressLayerY3_offset + "->" + pressLayerY3_offset); - } - if (one_cribTotal != last_one_cribTotal) { - logServer.deviceItemValue(this.device_code,"one_cribTotal" ,String.valueOf(one_cribTotal)); - logServer.deviceExecuteLog(this.device_code,"","","信号one_cribTotal:" + last_one_cribTotal + "->" + one_cribTotal); - } - if (two_cribTotal != last_two_cribTotal) { - logServer.deviceItemValue(this.device_code,"two_cribTotal" ,String.valueOf(two_cribTotal)); - logServer.deviceExecuteLog(this.device_code,"","","信号two_cribTotal:" + last_two_cribTotal + "->" + two_cribTotal); - } - if (one_qty != last_one_qty) { - logServer.deviceItemValue(this.device_code,"one_qty" ,String.valueOf(one_qty)); - logServer.deviceExecuteLog(this.device_code,"","","信号one_qty:" + last_one_qty + "->" + one_qty); - } - if (two_qty != last_two_qty) { - logServer.deviceItemValue(this.device_code,"two_qty" ,String.valueOf(two_qty)); - logServer.deviceExecuteLog(this.device_code,"","","信号two_qty:" + last_two_qty + "->" + two_qty); - } - if (tool_coordinate != last_tool_coordinate) { - logServer.deviceItemValue(this.device_code,"tool_coordinate" ,String.valueOf(tool_coordinate)); - logServer.deviceExecuteLog(this.device_code,"","","信号tool_coordinate:" + last_tool_coordinate + "->" + tool_coordinate); - } - - } catch (Exception var17) { - return; - } - - 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; - case 4: - //排产单确认 - if (!requireSucess && !order_No.equals("0")) { - JSONObject json = new JSONObject(); - json.put("producetask_code",order_No); - json.put("device_code",this.device_code); - json.put("material_code",material); - json.put("qty",qty); - json.put("type","1"); - enterProduction(json); - } - break; - case 5: - //获取托盘信息 - if (!requireSucess) { - getVehicle(); - } - break; - case 6: - //码垛完成 - if (!requireSucess) { - applyEmpty(); - palletizing(); - } - break; - case 7: - //码垛强制完成 - if (!requireSucess) { - mandatoryPalletizing(); - } - break; - case 8: - //申请空盘 - if (!requireSucess) { - applyEmpty(); - } - break; - case 9: - //工单完成 - if (!requireSucess && !order_No.equals("0")) { - JSONObject json = new JSONObject(); - json.put("producetask_code",order_No); - json.put("device_code",this.device_code); - json.put("material_code",material); - json.put("qty",qty); - json.put("type","3"); - enterProduction(json); - } - break; - } - - switch (flag) { - //取货完成 - case 1: - return; - //放货完成 - case 2: - return; - - } - - } - last_mode = mode; - last_status = status; - last_error = error; - last_put_station = put_station; - last_barcode = barcode; - last_material = material; - last_qty = qty; - last_open_time = open_time; - last_standby_time = standby_time; - last_production_time = production_time; - last_error_time = error_time; - last_order_No = order_No; - - last_product_code = product_code; - last_AlongSide = AlongSide; - last_BshortSide = BshortSide; - last_Htrapezoidal = Htrapezoidal; - last_Wthickness = Wthickness; - last_tray_qty = tray_qty; - last_tray_high = tray_high; - last_crib_category = crib_category; - last_palletX1_line = palletX1_line; - last_palletY1_row = palletY1_row; - last_palletA1_angle = palletA1_angle; - last_palletX2_line = palletX2_line; - last_palletY2_row = palletY2_row; - last_palletA2_angle = palletA2_angle; - last_palletX3_line = palletX3_line; - last_palletY3_row = palletY3_row; - last_palletA3_angle = palletA3_angle; - last_pressCribX1_line = pressCribX1_line; - last_pressCribY1_row = pressCribY1_row; - last_pressCribA1_angle = pressCribA1_angle; - last_pressCribX2_line = pressCribX2_line; - last_pressCribY2_row = pressCribY2_row; - last_pressCribA2_angle = pressCribA2_angle; - last_pressCribX3_line = pressCribX3_line; - last_pressCribY3_row = pressCribY3_row; - last_pressCribA3_angle = pressCribA3_angle; - last_Zoffset = Zoffset; - last_pallet_layerQty = pallet_layerQty; - last_pressCrib_layerQty = pressCrib_layerQty; - last_codeLayerX1_interval = codeLayerX1_interval; - last_codeLayerY1_interval = codeLayerY1_interval; - last_codeLayerX2_interval = codeLayerX2_interval; - last_codeLayerY2_interval = codeLayerY2_interval; - last_codeLayerX3_interval = codeLayerX3_interval; - last_codeLayerY3_interval = codeLayerY3_interval; - last_codeLayerX1_offset = codeLayerX1_offset; - last_codeLayerY1_offset = codeLayerY1_offset; - last_codeLayerX2_offset = codeLayerX2_offset; - last_codeLayerY2_offset = codeLayerY2_offset; - last_codeLayerX3_offset = codeLayerX3_offset; - last_codeLayerY3_offset = codeLayerY3_offset; - last_pressLayerX1_interval = pressLayerX1_interval; - last_pressLayerY1_interval = pressLayerY1_interval; - last_pressLayerX2_interval = pressLayerX2_interval; - last_pressLayerY2_interval = pressLayerY2_interval; - last_pressLayerX3_interval = pressLayerX3_interval; - last_pressLayerY3_interval = pressLayerY3_interval; - last_pressLayerX1_offset = pressLayerX1_offset; - last_pressLayerY1_offset = pressLayerY1_offset; - last_pressLayerX2_offset = pressLayerX2_offset; - last_pressLayerY2_offset = pressLayerY2_offset; - last_pressLayerX3_offset = pressLayerX3_offset; - last_pressLayerY3_offset = pressLayerY3_offset; - last_one_cribTotal = one_cribTotal; - last_two_cribTotal = two_cribTotal; - last_one_qty = one_qty; - last_two_qty = two_qty; - last_tool_coordinate = tool_coordinate; - - } - - - public boolean exe_error() { - if (this.error == 0) { - return true; - } else { - log.debug("设备报警"); - return false; - } - } - - /** - * 排产单确认 - * - * @param - */ - public synchronized boolean enterProduction(JSONObject json) { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - HttpResponse result = acsToWmsService.enterOrder(json); - if (result.getStatus() == 200) { - this.writing(this.mode); - ProduceshiftorderDto dto = produceshiftorderService.findByCode(order_No); - if (this.mode == 4) { - dto.setOrder_status("1"); - } else if (this.mode == 9){ - dto.setOrder_status("2"); - } - produceshiftorderService.update(dto); - requireSucess = true; - } - return true; - } - } - - /** - * 获取托盘信息 - * - * @param - */ - public synchronized boolean getVehicle() { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - JSONObject json = new JSONObject(); - String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code"); - String demosub = linkobj.substring(1,linkobj.length()-1); - String demoArray[] = demosub.split(","); - List demoList = Arrays.asList(demoArray); - json.put("device_code",demoList.get(put_station-1).replace("\"","")); - json.put("vehicle_code",barcode); - JSONObject jo = acsToWmsService.getVehicle(json); - - if (jo.getInteger("status") == 200) { - JSONObject content = jo.getJSONObject("content"); - String qty = content.getString("qty"); - String material_code = content.getString("material_code"); - String material_name = content.getString("material_name"); - String product_code = content.getString("product_code"); - String AlongSide = content.getString("AlongSide"); - String BshortSide = content.getString("BshortSide"); - String Htrapezoidal = content.getString("Htrapezoidal"); - String Wthickness = content.getString("Wthickness"); - String tray_qty = content.getString("tray_qty"); - String tray_high = content.getString("tray_high"); - String crib_category = content.getString("crib_category"); - String palletX1_line = content.getString("palletX1_line"); - String palletY1_row = content.getString("palletY1_row"); - String palletA1_angle = content.getString("palletA1_angle"); - String palletX2_line = content.getString("palletX2_line"); - String palletY2_row = content.getString("palletY2_row"); - String palletA2_angle = content.getString("palletA2_angle"); - String palletX3_line = content.getString("palletX3_line"); - String palletY3_row = content.getString("palletY3_row"); - String palletA3_angle = content.getString("palletA3_angle"); - String pressCribX1_line = content.getString("pressCribX1_line"); - String pressCribY1_row = content.getString("pressCribY1_row"); - String pressCribA1_angle = content.getString("pressCribA1_angle"); - String pressCribX2_line = content.getString("pressCribX2_line"); - String pressCribY2_row = content.getString("pressCribY2_row"); - String pressCribA2_angle = content.getString("pressCribA2_angle"); - String pressCribX3_line = content.getString("pressCribX3_line"); - String pressCribY3_row = content.getString("pressCribY3_row"); - String pressCribA3_angle = content.getString("pressCribA3_angle"); - String Zoffset = content.getString("Zoffset"); - String pallet_layerQty = content.getString("pallet_layerQty"); - String pressCrib_layerQty = content.getString("pressCrib_layerQty"); - String codeLayerX1_interval = content.getString("codeLayerX1_interval"); - String codeLayerY1_interval = content.getString("codeLayerY1_interval"); - String codeLayerX2_interval = content.getString("codeLayerX2_interval"); - String codeLayerY2_interval = content.getString("codeLayerY2_interval"); - String codeLayerX3_interval = content.getString("codeLayerX3_interval"); - String codeLayerY3_interval = content.getString("codeLayerY3_interval"); - String codeLayerX1_offset = content.getString("codeLayerX1_offset"); - String codeLayerY1_offset = content.getString("codeLayerY1_offset"); - String codeLayerX2_offset = content.getString("codeLayerX2_offset"); - String codeLayerY2_offset = content.getString("codeLayerY2_offset"); - String codeLayerX3_offset = content.getString("codeLayerX3_offset"); - String codeLayerY3_offset = content.getString("codeLayerY3_offset"); - String pressLayerX1_interval = content.getString("pressLayerX1_interval"); - String pressLayerY1_interval = content.getString("pressLayerY1_interval"); - String pressLayerX2_interval = content.getString("pressLayerX2_interval"); - String pressLayerY2_interval = content.getString("pressLayerY2_interval"); - String pressLayerX3_interval = content.getString("pressLayerX3_interval"); - String pressLayerY3_interval = content.getString("pressLayerY3_interval"); - String pressLayerX1_offset = content.getString("pressLayerX1_offset"); - String pressLayerY1_offset = content.getString("pressLayerY1_offset"); - String pressLayerX2_offset = content.getString("pressLayerX2_offset"); - String pressLayerY2_offset = content.getString("pressLayerY2_offset"); - String pressLayerX3_offset = content.getString("pressLayerX3_offset"); - String pressLayerY3_offset = content.getString("pressLayerY3_offset"); - String one_cribTotal = content.getString("one_cribTotal"); - String two_cribTotal = content.getString("two_cribTotal"); - String one_qty = content.getString("one_qty"); - String two_qty = content.getString("two_qty"); - String tool_coordinate = content.getString("tool_coordinate"); - - this.writing("to_material_qty",qty); - this.writing("to_material_code",material_code); - this.writing("to_product_code",product_code); - this.writing("to_AlongSide",AlongSide); - this.writing("to_BshortSide",BshortSide); - this.writing("to_Htrapezoidal",Htrapezoidal); - this.writing("to_Wthickness",Wthickness); - this.writing("to_tray_qty",tray_qty); - this.writing("to_tray_high",tray_high); - this.writing("to_crib_category",crib_category); - this.writing("to_palletX1_line",palletX1_line); - this.writing("to_palletY1_row",palletY1_row); - this.writing("to_palletA1_angle",palletA1_angle); - this.writing("to_palletX2_line",palletX2_line); - this.writing("to_palletY2_row",palletY2_row); - this.writing("to_palletA2_angle",palletA2_angle); - this.writing("to_palletX3_line",palletX3_line); - this.writing("to_palletY3_row",palletY3_row); - this.writing("to_palletA3_angle",palletA3_angle); - this.writing("to_pressCribX1_line",pressCribX1_line); - this.writing("to_pressCribY1_row",pressCribY1_row); - this.writing("to_pressCribA1_angle",pressCribA1_angle); - this.writing("to_pressCribX2_line",pressCribX2_line); - this.writing("to_pressCribY2_row",pressCribY2_row); - this.writing("to_pressCribA2_angle",pressCribA2_angle); - this.writing("to_pressCribX3_line",pressCribX3_line); - this.writing("to_pressCribY3_row",pressCribY3_row); - this.writing("to_pressCribA3_angle",pressCribA3_angle); - this.writing("to_Zoffset",Zoffset); - this.writing("to_pallet_layerQty",pallet_layerQty); - this.writing("to_pressCrib_layerQty",pressCrib_layerQty); - this.writing("to_codeLayerX1_interval",codeLayerX1_interval); - this.writing("to_codeLayerY1_interval",codeLayerY1_interval); - this.writing("to_codeLayerX2_interval",codeLayerX2_interval); - this.writing("to_codeLayerY2_interval",codeLayerY2_interval); - this.writing("to_codeLayerX3_interval",codeLayerX3_interval); - this.writing("to_codeLayerY3_interval",codeLayerY3_interval); - this.writing("to_codeLayerX1_offset",codeLayerX1_offset); - this.writing("to_codeLayerY1_offset",codeLayerY1_offset); - this.writing("to_codeLayerX2_offset",codeLayerX2_offset); - this.writing("to_codeLayerY2_offset",codeLayerY2_offset); - this.writing("to_codeLayerX3_offset",codeLayerX3_offset); - this.writing("to_codeLayerY3_offset",codeLayerY3_offset); - this.writing("to_pressLayerX1_interval",pressLayerX1_interval); - this.writing("to_pressLayerY1_interval",pressLayerY1_interval); - this.writing("to_pressLayerX2_interval",pressLayerX2_interval); - this.writing("to_pressLayerY2_interval",pressLayerY2_interval); - this.writing("to_pressLayerX3_interval",pressLayerX3_interval); - this.writing("to_pressLayerY3_interval",pressLayerY3_interval); - this.writing("to_pressLayerX1_offset",pressLayerX1_offset); - this.writing("to_pressLayerY1_offset",pressLayerY1_offset); - this.writing("to_pressLayerX2_offset",pressLayerX2_offset); - this.writing("to_pressLayerY2_offset",pressLayerY2_offset); - this.writing("to_pressLayerX3_offset",pressLayerX3_offset); - this.writing("to_pressLayerY3_offset",pressLayerY3_offset); - this.writing("to_one_cribTotal",one_cribTotal); - this.writing("to_two_cribTotal",two_cribTotal); - this.writing("to_one_qty",one_qty); - this.writing("to_two_qty",two_qty); - this.writing("to_tool_coordinate",tool_coordinate); - this.writing(this.mode); - requireSucess = true; - - } - return true; - } - } - - /** - * 码垛完成 - * - * @param - */ - public synchronized boolean palletizing() { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - JSONObject json = new JSONObject(); - String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code"); - String demosub = linkobj.substring(1,linkobj.length()-1); - String demoArray[] = demosub.split(","); - List demoList = Arrays.asList(demoArray); - json.put("device_code",demoList.get(put_station-1).replace("\"","")); - json.put("qty",qty); - json.put("vehicle_code",barcode); - json.put("is_full","1"); - json.put("product_code",product_code); - json.put("AlongSide",AlongSide); - json.put("BshortSide",BshortSide); - json.put("Htrapezoidal",Htrapezoidal); - json.put("Wthickness",Wthickness); - json.put("tray_qty",tray_qty); - json.put("tray_high",tray_high); - json.put("crib_category",crib_category); - json.put("palletX1_line",palletX1_line); - json.put("palletY1_row",palletY1_row); - json.put("palletA1_angle",palletA1_angle); - json.put("palletX2_line",palletX2_line); - json.put("palletY2_row",palletY2_row); - json.put("palletA2_angle",palletA2_angle); - json.put("palletX3_line",palletX3_line); - json.put("palletY3_row",palletY3_row); - json.put("palletA3_angle",palletA3_angle); - json.put("pressCribX1_line",pressCribX1_line); - json.put("pressCribY1_row",pressCribY1_row); - json.put("pressCribA1_angle",pressCribA1_angle); - json.put("pressCribX2_line",pressCribX2_line); - json.put("pressCribY2_row",pressCribY2_row); - json.put("pressCribA2_angle",pressCribA2_angle); - json.put("pressCribX3_line",pressCribX3_line); - json.put("pressCribY3_row",pressCribY3_row); - json.put("pressCribA3_angle",pressCribA3_angle); - json.put("Zoffset",Zoffset); - json.put("pallet_layerQty",pallet_layerQty); - json.put("pressCrib_layerQty",pressCrib_layerQty); - json.put("codeLayerX1_interval",codeLayerX1_interval); - json.put("codeLayerY1_interval",codeLayerY1_interval); - json.put("codeLayerX2_interval",codeLayerX2_interval); - json.put("codeLayerY2_interval",codeLayerY2_interval); - json.put("codeLayerX3_interval",codeLayerX3_interval); - json.put("codeLayerY3_interval",codeLayerY3_interval); - json.put("codeLayerX1_offset",codeLayerX1_offset); - json.put("codeLayerY1_offset",codeLayerY1_offset); - json.put("codeLayerX2_offset",codeLayerX2_offset); - json.put("codeLayerY2_offset",codeLayerY2_offset); - json.put("codeLayerX3_offset",codeLayerX3_offset); - json.put("codeLayerY3_offset",codeLayerY3_offset); - json.put("pressLayerX1_interval",pressLayerX1_interval); - json.put("pressLayerY1_interval",pressLayerY1_interval); - json.put("pressLayerX2_interval",pressLayerX2_interval); - json.put("pressLayerY2_interval",pressLayerY2_interval); - json.put("pressLayerX3_interval",pressLayerX3_interval); - json.put("pressLayerY3_interval",pressLayerY3_interval); - json.put("pressLayerX1_offset",pressLayerX1_offset); - json.put("pressLayerY1_offset",pressLayerY1_offset); - json.put("pressLayerX2_offset",pressLayerX2_offset); - json.put("pressLayerY2_offset",pressLayerY2_offset); - json.put("pressLayerX3_offset",pressLayerX3_offset); - json.put("pressLayerY3_offset",pressLayerY3_offset); - json.put("one_cribTotal",one_cribTotal); - json.put("two_cribTotal",two_cribTotal); - json.put("one_qty",one_qty); - json.put("two_qty",two_qty); - json.put("tool_coordinate",tool_coordinate); - - HttpResponse result = acsToWmsService.applyTaskManipulatorToWms(json); - if (result.getStatus() == 200) { - this.writing(this.mode); - requireSucess = true; - } - return true; - } - } - - /** - * 码垛强制完成 - * - * @param - */ - public synchronized boolean mandatoryPalletizing() { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - JSONObject json = new JSONObject(); - String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code"); - String demosub = linkobj.substring(1,linkobj.length()-1); - String demoArray[] = demosub.split(","); - List demoList = Arrays.asList(demoArray); - json.put("device_code",demoList.get(put_station-1).replace("\"","")); - json.put("qty",qty); - json.put("vehicle_code",barcode); - json.put("is_full","0"); - json.put("product_code",product_code); - json.put("AlongSide",AlongSide); - json.put("BshortSide",BshortSide); - json.put("Htrapezoidal",Htrapezoidal); - json.put("Wthickness",Wthickness); - json.put("tray_qty",tray_qty); - json.put("tray_high",tray_high); - json.put("crib_category",crib_category); - json.put("palletX1_line",palletX1_line); - json.put("palletY1_row",palletY1_row); - json.put("palletA1_angle",palletA1_angle); - json.put("palletX2_line",palletX2_line); - json.put("palletY2_row",palletY2_row); - json.put("palletA2_angle",palletA2_angle); - json.put("palletX3_line",palletX3_line); - json.put("palletY3_row",palletY3_row); - json.put("palletA3_angle",palletA3_angle); - json.put("pressCribX1_line",pressCribX1_line); - json.put("pressCribY1_row",pressCribY1_row); - json.put("pressCribA1_angle",pressCribA1_angle); - json.put("pressCribX2_line",pressCribX2_line); - json.put("pressCribY2_row",pressCribY2_row); - json.put("pressCribA2_angle",pressCribA2_angle); - json.put("pressCribX3_line",pressCribX3_line); - json.put("pressCribY3_row",pressCribY3_row); - json.put("pressCribA3_angle",pressCribA3_angle); - json.put("Zoffset",Zoffset); - json.put("pallet_layerQty",pallet_layerQty); - json.put("pressCrib_layerQty",pressCrib_layerQty); - json.put("codeLayerX1_interval",codeLayerX1_interval); - json.put("codeLayerY1_interval",codeLayerY1_interval); - json.put("codeLayerX2_interval",codeLayerX2_interval); - json.put("codeLayerY2_interval",codeLayerY2_interval); - json.put("codeLayerX3_interval",codeLayerX3_interval); - json.put("codeLayerY3_interval",codeLayerY3_interval); - json.put("codeLayerX1_offset",codeLayerX1_offset); - json.put("codeLayerY1_offset",codeLayerY1_offset); - json.put("codeLayerX2_offset",codeLayerX2_offset); - json.put("codeLayerY2_offset",codeLayerY2_offset); - json.put("codeLayerX3_offset",codeLayerX3_offset); - json.put("codeLayerY3_offset",codeLayerY3_offset); - json.put("pressLayerX1_interval",pressLayerX1_interval); - json.put("pressLayerY1_interval",pressLayerY1_interval); - json.put("pressLayerX2_interval",pressLayerX2_interval); - json.put("pressLayerY2_interval",pressLayerY2_interval); - json.put("pressLayerX3_interval",pressLayerX3_interval); - json.put("pressLayerY3_interval",pressLayerY3_interval); - json.put("pressLayerX1_offset",pressLayerX1_offset); - json.put("pressLayerY1_offset",pressLayerY1_offset); - json.put("pressLayerX2_offset",pressLayerX2_offset); - json.put("pressLayerY2_offset",pressLayerY2_offset); - json.put("pressLayerX3_offset",pressLayerX3_offset); - json.put("pressLayerY3_offset",pressLayerY3_offset); - json.put("one_cribTotal",one_cribTotal); - json.put("two_cribTotal",two_cribTotal); - json.put("one_qty",one_qty); - json.put("two_qty",two_qty); - json.put("tool_coordinate",tool_coordinate); - - HttpResponse result = acsToWmsService.applyTaskManipulatorToWms(json); - if (result.getStatus() == 200) { - this.writing(this.mode); - requireSucess = true; - } - return true; - } - } - - /** - * 申请空盘 - * - * @param - */ - public synchronized boolean applyEmpty() { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - JSONObject json = new JSONObject(); - String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code"); - String demosub = linkobj.substring(1,linkobj.length()-1); - String demoArray[] = demosub.split(","); - List demoList = Arrays.asList(demoArray); - json.put("device_code",demoList.get(put_station-1).replace("\"","")); - json.put("type","4"); - HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); - if (result.getStatus() == 200) { - this.writing(this.mode); - requireSucess = true; - } - return true; - } - } - - public boolean exe_business() { - return true; - } - - public void executing(Server server, Map itemMap) { - ReadUtil.write(itemMap, server); - } - - public static Boolean isExistFieldName(String fieldName, Object obj) throws NoSuchFieldException { - if (obj == null || StrUtil.isEmpty(fieldName)) { - return null; - } - //获取这个类的所有属性 - Field[] fields = obj.getClass().getDeclaredFields(); - boolean flag = false; - //循环遍历所有的fields - for (int i = 0; i < fields.length; i++) { - if (fields[i].getName().equals("item_" + fieldName)) { - flag = true; - break; - } - } - return flag; - } - - public void writing(int command) { - String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + org.nl.acs.device_driver.lnsh.lnsh_fold_disc_site.ItemProtocol.item_to_command; - - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(to_command, command); - ReadUtil.write(itemMap, server); - - } - - public void writing(String param, String value) { - - String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + param; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(to_param, value); - - ReadUtil.write(itemMap, server); - } -} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_site/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_site/ItemProtocol.java deleted file mode 100644 index 50421f7..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_site/ItemProtocol.java +++ /dev/null @@ -1,146 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_package_site; - -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_ioaction = "ioaction"; - public static String item_error = "error"; - public static String item_task = "task"; - public static String item_weight = "weight"; - public static String item_material = "material"; - public static String item_barcode = "barcode"; - 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_to_isPackage = "to_isPackage"; - - - Boolean isonline; - - private LnshPackageSiteDeviceDriver driver; - - public ItemProtocol(LnshPackageSiteDeviceDriver 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 getIoAction() { - return this.getOpcIntegerValue(item_ioaction); - } - - public int getError() { - return this.getOpcIntegerValue(item_error); - } - - public int getTask() { - return this.getOpcIntegerValue(item_task); - } - - public int getWeight() { - return this.getOpcIntegerValue(item_weight); - } - - public String getMaterial() { - return this.getOpcStringValue(item_material); - } - - public String getBarcode() { - return this.getOpcStringValue(item_barcode); - } - - public int getToCommand() { - return this.getOpcIntegerValue(item_to_command); - } - - public int getToTarget() { - return this.getOpcIntegerValue(item_to_target); - } - - public int getToTask() { - return this.getOpcIntegerValue(item_to_task); - } - - public int getTo_isPackage() { - return this.getOpcIntegerValue(item_to_isPackage); - } - - //是否有货 - public int hasGoods(int move) { - return move; - } - - - 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 String getOpcStringValue(String protocol) { - String value = this.driver.getStringValue(protocol); - if (value == null) { -// log.error("读取错误!"); - } else { - return value; - } - return "0"; - } - - public static List getReadableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_heartbeat, "心跳", "DB3.B0")); - list.add(new ItemDto(item_mode, "工作状态", "DB3.B1", Boolean.valueOf(true))); - list.add(new ItemDto(item_move, "光电开关信号", "DB3.B2")); - list.add(new ItemDto(item_action, "取放信号", "DB3.B3")); - list.add(new ItemDto(item_ioaction, "进出信号", "DB3.B4")); - list.add(new ItemDto(item_error, "报警信号", "DB3.B5")); - list.add(new ItemDto(item_task, "任务号", "DB3.D6")); - list.add(new ItemDto(item_weight, "重量", "DB3.D10")); - list.add(new ItemDto(item_material, "物料", "DB3.S14")); - list.add(new ItemDto(item_barcode, "条码", "DB3.S270")); - return list; - } - - public static List getWriteableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_command, "作业命令", "DB4.W0", Boolean.valueOf(true))); - list.add(new ItemDto(item_to_target, "目标站", "DB4.W2")); - list.add(new ItemDto(item_to_task, "任务号", "DB4.D4")); - list.add(new ItemDto(item_to_isPackage, "是否包装", "DB4.D8")); - return list; - } - -} - diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_site/LnshPackageSiteDefination.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_site/LnshPackageSiteDefination.java deleted file mode 100644 index b9b219c..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_site/LnshPackageSiteDefination.java +++ /dev/null @@ -1,78 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_package_site; - -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 LnshPackageSiteDefination implements OpcDeviceDriverDefination { - @Override - public String getDriverCode() { - return "lnsh_package_site"; - } - - @Override - public String getDriverName() { - return "晟华-包装线工位"; - } - - @Override - public String getDriverDescription() { - return "晟华-包装线工位"; - } - - @Override - public DeviceDriver getDriverInstance(Device device) { - return (new LnshPackageSiteDeviceDriver()).setDevice(device).setDriverDefination(this); - - } - - @Override - public Class getDeviceDriverType() { - return LnshPackageSiteDeviceDriver.class; - } - - @Override - public List getFitDeviceTypes() { - List types = new LinkedList(); - types.add(DeviceType.station); - return types; - } - - @Override - public List getReadableItemDtos() { - return getReadableItemDtos2(); - } - - public static List getReadableItemDtos2() { - List list = new ArrayList(); - list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB3.B0")); - list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB3.B1", Boolean.valueOf(true))); - list.add(new ItemDto(ItemProtocol.item_move, "光电开关信号", "DB3.B2")); - list.add(new ItemDto(ItemProtocol.item_action, "取放信号", "DB3.B3")); - list.add(new ItemDto(ItemProtocol.item_ioaction, "进出信号", "DB3.B4")); - list.add(new ItemDto(ItemProtocol.item_error, "报警信号", "DB3.B5")); - list.add(new ItemDto(ItemProtocol.item_task, "任务号", "DB3.D6")); - list.add(new ItemDto(ItemProtocol.item_weight, "重量", "DB3.D10")); - list.add(new ItemDto(ItemProtocol.item_material, "物料", "DB3.S14")); - list.add(new ItemDto(ItemProtocol.item_barcode, "条码", "DB3.S270")); - return list; - } - - @Override - public List getWriteableItemDtos() { - return ItemProtocol.getWriteableItemDtos(); - } - -} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_site/LnshPackageSiteDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_site/LnshPackageSiteDeviceDriver.java deleted file mode 100644 index 685af1c..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_site/LnshPackageSiteDeviceDriver.java +++ /dev/null @@ -1,378 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_package_site; - -import cn.hutool.core.date.DateUtil; -import cn.hutool.core.util.IdUtil; -import cn.hutool.core.util.StrUtil; -import cn.hutool.http.HttpResponse; -import com.alibaba.fastjson.JSONArray; -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.device_driver.standard_emptypallet_site.StandardEmptyPalletSiteDeviceDriver; -import org.nl.acs.device_driver.standard_inspect_site.StandardInspectSiteDeviceDriver; -import org.nl.acs.ext.wms.service.AcsToWmsService; -import org.nl.acs.instruction.service.InstructionService; -import org.nl.acs.instruction.service.dto.Instruction; - -import org.nl.acs.log.service.DeviceExecuteLogService; -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.*; - -/** - * 晟华-包装线工位 - */ -@Slf4j -@Data -@RequiredArgsConstructor -public class LnshPackageSiteDeviceDriver 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 - DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); - @Autowired - AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl"); - //放货准备锁 - String putReadyLock = null; - //有货标记 - protected boolean has_goods_tag = false; - String device_code; - int mode = 0; - int error = 0; - int move = 0; - int action; - int io_action; - int task = 0; - int last_mode = 0; - int last_error = 0; - int last_move = 0; - int last_task = 0; - int last_action = 0; - int last_ioaction = 0; - Boolean isonline = true; - int hasGoods = 0; - Boolean iserror = false; - - boolean hasVehicle = false; - boolean isReady = false; - protected int instruction_num = 0; - protected int instruction_num_truth = 0; - private Date instruction_require_time = new Date(); - private Date instruction_finished_time = new Date(); - - private int instruction_require_time_out = 3000; - boolean requireSucess = false; - - private int instruction_finished_time_out; - - int heartbeat; - int last_heartbeat; - private Date checkHeartbeattime = new Date(); - private Date last_checkHeartbeattime = new Date(); - - - int branchProtocol = 0; - //当前指令 - Instruction inst = null; - //上次指令 - Instruction last_inst = null; - - //触摸屏手动触发任务 - private Boolean is_has_task = false; - - //暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域 - int flag; - - String message; - int weight = 0; - int last_weight = 0; - String material; - String last_material; - String barcode; - String last_barcode; - - @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(); - move = this.itemProtocol.getMove(); - task = this.itemProtocol.getTask(); - hasGoods = this.itemProtocol.getMove(); - io_action = this.itemProtocol.getIoAction(); - action = this.itemProtocol.getAction(); - weight = this.itemProtocol.getWeight(); - material = this.itemProtocol.getMaterial(); - barcode = this.itemProtocol.getBarcode(); - - if (mode != last_mode) { - this.setRequireSucess(false); - logServer.deviceItemValue(this.device_code,"mode" ,String.valueOf(mode)); - logServer.deviceExecuteLog(this.device_code,"","","信号mode:" + last_mode + "->" + mode); - } - if (move != last_move) { - logServer.deviceItemValue(this.device_code,"move" ,String.valueOf(move)); - logServer.deviceExecuteLog(this.device_code,"","","信号move:" + last_move + "->" + move); - } - if (error != last_error) { - logServer.deviceItemValue(this.device_code,"error" ,String.valueOf(error)); - logServer.deviceExecuteLog(this.device_code,"","","信号error:" + last_error + "->" + error); - } - if (task != last_task) { - logServer.deviceItemValue(this.device_code,"task",String.valueOf(task)); - logServer.deviceExecuteLog(this.device_code,"","","信号task:" + last_task + "->" + task); - } - if (action != last_action) { - logServer.deviceItemValue(this.device_code,"action",String.valueOf(action)); - logServer.deviceExecuteLog(this.device_code,"","","信号action:" + last_action + "->" + action); - } - if (io_action != last_ioaction) { - logServer.deviceItemValue(this.device_code,"io_action",String.valueOf(io_action)); - logServer.deviceExecuteLog(this.device_code,"","","信号io_action: " + last_ioaction + "->" + io_action); - } - if (weight != last_weight) { - logServer.deviceItemValue(this.device_code,"weight",String.valueOf(weight)); - logServer.deviceExecuteLog(this.device_code,"","","信号weight: " + last_weight + "->" + weight); - } - if (!StrUtil.equals(material,last_material)) { - logServer.deviceItemValue(this.device_code,"material", material); - logServer.deviceExecuteLog(this.device_code,"","","信号material:" + last_material + "->" + material); - } - if (!StrUtil.equals(barcode,last_barcode)) { - logServer.deviceItemValue(this.device_code,"barcode", barcode); - logServer.deviceExecuteLog(this.device_code,"","","信号barcode:" + last_barcode + "->" + barcode); - } - - } catch (Exception var17) { - return; - } - - 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("设备运转模式:等待工作"); - break; - case 2: - break; - case 3: - - break; - case 4: - //申请贴标 - if (!requireSucess && this.move != 0 && !StrUtil.equals("0",barcode)) { - applyBarcode(); - } - break; - case 5: - break; - } - } - - last_mode = mode; - last_error = error; - last_move = move; - last_task = task; - last_action = action; - last_ioaction = io_action; - last_weight = weight; - last_material = material; - last_barcode = barcode; - } - - /** - * 申请贴标 - * - * @return - */ - public synchronized boolean applyBarcode() { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - JSONObject json = new JSONObject(); - json.put("device_code",this.device_code); - json.put("vehicle_code",barcode); - HttpResponse result = acsToWmsService.applyBarcode(json); - if (result.getStatus() == 200) { - this.writing(this.mode); - requireSucess = true; - } - - return true; - } - - } - - - public void finish_instruction(Instruction instruction) throws Exception { - instruction_finished(instruction); - } - - /** - * 完成指令 - * - * @param instruction - * @return - */ - public boolean instruction_finished(Instruction instruction) throws Exception { - Date date = new Date(); - if (date.getTime() - this.instruction_finished_time.getTime() < (long) this.instruction_finished_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_finished_time_out); - return false; - } else { - instructionService.finish(instruction.getInstruction_id()); - this.instruction_finished_time = date; - return true; - } - } - - /** - * 完成并创建下一条指令 - * - * @param instruction - * @param needCreateNext - * @return - */ - public boolean instruction_finished(Instruction instruction, boolean needCreateNext) { - Date date = new Date(); - if (date.getTime() - this.instruction_finished_time.getTime() < (long) this.instruction_finished_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_finished_time_out); - return false; - } else { - this.instruction_finished_time = date; - return true; - } - } - - public boolean exe_error() { - if (this.error == 0) { - return true; - } else { - log.debug("设备报警"); - return false; - } - } - - public boolean exe_business() { - return true; - } - - protected void executing(Instruction instruction) { - this.executing(1, instruction, ""); - } - - public void executing(int command, Instruction instruction, String appendMessage) { - String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_command; - String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_target; - String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_task; - if (appendMessage == null) { - appendMessage = ""; - } - if (instruction != null) { - instruction_num = Integer.parseInt(instruction.getInstruction_code()); - } - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(to_command, 1); - itemMap.put(to_task, instruction_num); - ReadUtil.write(itemMap, server); - - } - - public void executing(Server server, Map 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() - + "." + org.nl.acs.device_driver.lnsh.lnsh_station.ItemProtocol.item_to_command; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - 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 itemMap = new HashMap(); - 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); - - } - - public String toString() { - return ""; - } - -} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_pallet_storage/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_pallet_storage/ItemProtocol.java deleted file mode 100644 index f99cb9d..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_pallet_storage/ItemProtocol.java +++ /dev/null @@ -1,129 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_pallet_storage; - -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_status = "status"; - public static String item_open_time = "open_time"; - public static String item_close_time = "close_time"; - public static String item_standby_time = "standby_time"; - public static String item_production_time = "production_time"; - public static String item_error_time = "error_time"; - public static String item_tray_crib_qty = "tray_crib_qty"; - public static String item_total_container = "total_container"; - public static String item_to_command = "to_command"; - public static String item_to_target = "to_target"; - public static String item_to_task = "to_task"; - Boolean isonline; - - private LnshPalletStorageDeviceDriver driver; - - public ItemProtocol(LnshPalletStorageDeviceDriver driver) { - this.driver = driver; - } - - public int getHeartbeat() { - return this.getOpcIntegerValue(item_heartbeat); - } - - public int getMode() { - return this.getOpcIntegerValue(item_mode); - } - - public int getStatus() { - return this.getOpcIntegerValue(item_status); - } - - public int getOpen_time() { - return this.getOpcIntegerValue(item_open_time); - } - - public int getClose_time() { - return this.getOpcIntegerValue(item_close_time); - } - - public int getStandby_time() { - return this.getOpcIntegerValue(item_standby_time); - } - - public int getProduction_time() { - return this.getOpcIntegerValue(item_production_time); - } - - public int getError_time() { - return this.getOpcIntegerValue(item_error_time); - } - - public int getTray_crib_qty() { - return this.getOpcIntegerValue(item_tray_crib_qty); - } - - public int getTotal_container() { - return this.getOpcIntegerValue(item_total_container); - } - - 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; - } - - - 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 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_status, "设备状态", "DB600.B3")); - list.add(new ItemDto(item_open_time, "开机时间", "DB600.D6")); - list.add(new ItemDto(item_close_time, "关机时间", "DB600.D10")); - list.add(new ItemDto(item_standby_time, "待机时间", "DB600.D14")); - list.add(new ItemDto(item_production_time, "生产时间", "DB600.D18")); - list.add(new ItemDto(item_error_time, "故障时间", "DB600.D22")); - list.add(new ItemDto(item_tray_crib_qty, "托盘垛数", "DB600.D26")); - list.add(new ItemDto(item_total_container, "托盘总数量", "DB600.D30")); - return list; - } - - public static List 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; - } - -} - diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_pallet_storage/LnshPalletStorageDefination.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_pallet_storage/LnshPalletStorageDefination.java deleted file mode 100644 index 0b1ccf7..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_pallet_storage/LnshPalletStorageDefination.java +++ /dev/null @@ -1,76 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_pallet_storage; - -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 LnshPalletStorageDefination implements OpcDeviceDriverDefination { - @Override - public String getDriverCode() { - return "lnsh_pallet_storage"; - } - - @Override - public String getDriverName() { - return "晟华-托盘存储线"; - } - - @Override - public String getDriverDescription() { - return "晟华-托盘存储线"; - } - - @Override - public DeviceDriver getDriverInstance(Device device) { - return (new LnshPalletStorageDeviceDriver()).setDevice(device).setDriverDefination(this); - } - - @Override - public Class getDeviceDriverType() { - return LnshPalletStorageDeviceDriver.class; - } - - @Override - public List getFitDeviceTypes() { - List types = new LinkedList(); - types.add(DeviceType.station); - return types; - } - - @Override - public List getReadableItemDtos() { - return getReadableItemDtos2(); - } - - public static List getReadableItemDtos2() { - ArrayList 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_status, "设备状态", "DB600.B3")); - list.add(new ItemDto(ItemProtocol.item_open_time, "开机时间", "DB600.D6")); - list.add(new ItemDto(ItemProtocol.item_close_time, "关机时间", "DB600.D10")); - list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "DB600.D14")); - list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "DB600.D18")); - list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "DB600.D22")); - list.add(new ItemDto(ItemProtocol.item_tray_crib_qty, "托盘垛数", "DB600.D26")); - list.add(new ItemDto(ItemProtocol.item_total_container, "托盘总数量", "DB600.D30")); - return list; - } - - @Override - public List getWriteableItemDtos() { - return ItemProtocol.getWriteableItemDtos(); - } - -} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_pallet_storage/LnshPalletStorageDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_pallet_storage/LnshPalletStorageDeviceDriver.java deleted file mode 100644 index 719e9f4..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_pallet_storage/LnshPalletStorageDeviceDriver.java +++ /dev/null @@ -1,229 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_pallet_storage; - -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.DeviceExecuteLogService; -import org.nl.acs.opc.Device; -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.*; - -/** - * 晟华托盘存储线 - */ -@Slf4j -@Data -@RequiredArgsConstructor -public class LnshPalletStorageDeviceDriver 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 - DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); - - String device_code; - int mode = 0; - int error = 0; - int last_mode = 0; - int last_error = 0; - Boolean isonline = true; - Boolean iserror = false; - - boolean requireSucess = false; - - private int instruction_finished_time_out; - - int heartbeat; - int last_heartbeat; - private Date checkHeartbeattime = new Date(); - private Date last_checkHeartbeattime = new Date(); - - //触摸屏手动触发任务 - private Boolean is_has_task = false; - - String message; - int status = 0; - int last_status = 0; - //开机时间 - int open_time = 0; - int last_open_time = 0; - int close_time = 0; - int last_close_time = 0; - //待机时间 - int standby_time = 0; - int last_standby_time = 0; - //生产时间 - int production_time = 0; - int last_production_time = 0; - //故障时间 - int error_time = 0; - int last_error_time = 0; - //托盘垛数 - int tray_crib_qty = 0; - int last_tray_crib_qty = 0; - //托盘总数量 - int total_container = 0; - int last_total_container = 0; - - - @Override - public Device getDevice() { - return this.device; - } - - - @Override - public void execute() { - String message = null; - try { - device_code = this.getDeviceCode(); - mode = this.itemProtocol.getMode(); - status = this.itemProtocol.getStatus(); - open_time = this.itemProtocol.getOpen_time(); - close_time = this.itemProtocol.getClose_time(); - standby_time = this.itemProtocol.getStandby_time(); - production_time = this.itemProtocol.getProduction_time(); - error_time = this.itemProtocol.getError_time(); - tray_crib_qty = this.itemProtocol.getTray_crib_qty(); - total_container = this.itemProtocol.getTotal_container(); - - if (mode != last_mode) { - this.setRequireSucess(false); - logServer.deviceItemValue(this.device_code,"mode" ,String.valueOf(mode)); - logServer.deviceExecuteLog(this.device_code,"","","信号mode:" + last_mode + "->" + mode); - } - if (status != last_status) { - logServer.deviceItemValue(this.device_code,"status" ,String.valueOf(status)); - logServer.deviceExecuteLog(this.device_code,"","","信号status:" + last_status + "->" + status); - } - if (open_time != last_open_time) { - logServer.deviceItemValue(this.device_code,"open_time" ,String.valueOf(open_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号open_time:" + last_open_time + "->" + open_time); - } - if (close_time != last_close_time) { - logServer.deviceItemValue(this.device_code,"close_time" ,String.valueOf(close_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号close_time:" + last_close_time + "->" + close_time); - } - if (standby_time != last_standby_time) { - logServer.deviceItemValue(this.device_code,"standby_time" ,String.valueOf(standby_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号standby_time:" + last_standby_time + "->" + standby_time); - } - if (production_time != last_production_time) { - logServer.deviceItemValue(this.device_code,"production_time" ,String.valueOf(production_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号production_time:" + last_production_time + "->" + production_time); - } - if (error_time != last_error_time) { - logServer.deviceItemValue(this.device_code,"error_time" ,String.valueOf(error_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号error_time:" + last_error_time + "->" + error_time); - } - if (tray_crib_qty != last_tray_crib_qty) { - logServer.deviceItemValue(this.device_code,"tray_crib_qty" ,String.valueOf(tray_crib_qty)); - logServer.deviceExecuteLog(this.device_code,"","","信号tray_crib_qty:" + last_tray_crib_qty + "->" + tray_crib_qty); - } - if (total_container != last_total_container) { - logServer.deviceItemValue(this.device_code,"total_container" ,String.valueOf(total_container)); - logServer.deviceExecuteLog(this.device_code,"","","信号total_container:" + last_total_container + "->" + total_container); - } - - } catch (Exception var17) { - return; - } - - //急停 - if (this.isStop()) { - - //未在线无心跳 - } else 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("设备运转模式:等待工作"); - break; - case 2: - - break; - case 3: - - break; - case 4: - break; - } - } - - last_mode = mode; - last_status = status; - last_open_time = open_time; - last_close_time = close_time; - last_standby_time = standby_time; - last_production_time = production_time; - last_error_time = error_time; - last_tray_crib_qty = tray_crib_qty; - last_total_container = total_container; - } - - 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 itemMap) { - ReadUtil.write(itemMap, server); - } - -} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/ItemProtocol.java deleted file mode 100644 index 8eeb682..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/ItemProtocol.java +++ /dev/null @@ -1,879 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator; - -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -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_status = "status"; - public static String item_action = "action"; - public static String item_error = "error"; - public static String item_put_station = "put_station"; - public static String item_barcode = "barcode"; - public static String item_material = "material"; - public static String item_encoder_qty = "encoder_qty"; - public static String item_open_time = "open_time"; - public static String item_standby_time = "standby_time"; - public static String item_production_time = "production_time"; - public static String item_error_time = "error_time"; - public static String item_product_code = "product_code"; - public static String item_AlongSide = "AlongSide"; - public static String item_BshortSide = "BshortSide"; - public static String item_Htrapezoidal = "Htrapezoidal"; - public static String item_Wthickness = "Wthickness"; - public static String item_tray_qty = "tray_qty"; - public static String item_tray_high = "tray_high"; - public static String item_crib_category = "crib_category"; - public static String item_palletX1_line = "palletX1_line"; - public static String item_palletY1_row = "palletY1_row"; - public static String item_palletA1_angle = "palletA1_angle"; - public static String item_palletX2_line = "palletX2_line"; - public static String item_palletY2_row = "palletY2_row"; - public static String item_palletA2_angle = "palletA2_angle"; - public static String item_palletX3_line = "palletX3_line"; - public static String item_palletY3_row = "palletY3_row"; - public static String item_palletA3_angle = "palletA3_angle"; - public static String item_pressCribX1_line = "pressCribX1_line"; - public static String item_pressCribY1_row = "pressCribY1_row"; - public static String item_pressCribA1_angle = "pressCribA1_angle"; - public static String item_pressCribX2_line = "pressCribX2_line"; - public static String item_pressCribY2_row = "pressCribY2_row"; - public static String item_pressCribA2_angle = "pressCribA2_angle"; - public static String item_pressCribX3_line = "pressCribX3_line"; - public static String item_pressCribY3_row = "pressCribY3_row"; - public static String item_pressCribA3_angle = "pressCribA3_angle"; - public static String item_Zoffset = "Zoffset"; - public static String item_pallet_layerQty = "pallet_layerQty"; - public static String item_pressCrib_layerQty = "pressCrib_layerQty"; - public static String item_codeLayerX1_interval = "codeLayerX1_interval"; - public static String item_codeLayerY1_interval = "codeLayerY1_interval"; - public static String item_codeLayerX2_interval = "codeLayerX2_interval"; - public static String item_codeLayerY2_interval = "codeLayerY2_interval"; - public static String item_codeLayerX3_interval = "codeLayerX3_interval"; - public static String item_codeLayerY3_interval = "codeLayerY3_interval"; - public static String item_codeLayerX1_offset = "codeLayerX1_offset"; - public static String item_codeLayerY1_offset = "codeLayerY1_offset"; - public static String item_codeLayerX2_offset = "codeLayerX2_offset"; - public static String item_codeLayerY2_offset = "codeLayerY2_offset"; - public static String item_codeLayerX3_offset = "codeLayerX3_offset"; - public static String item_codeLayerY3_offset = "codeLayerY3_offset"; - public static String item_pressLayerX1_interval = "pressLayerX1_interval"; - public static String item_pressLayerY1_interval = "pressLayerY1_interval"; - public static String item_pressLayerX2_interval = "pressLayerX2_interval"; - public static String item_pressLayerY2_interval = "pressLayerY2_interval"; - public static String item_pressLayerX3_interval = "pressLayerX3_interval"; - public static String item_pressLayerY3_interval = "pressLayerY3_interval"; - public static String item_pressLayerX1_offset = "pressLayerX1_offset"; - public static String item_pressLayerY1_offset = "pressLayerY1_offset"; - public static String item_pressLayerX2_offset = "pressLayerX2_offset"; - public static String item_pressLayerY2_offset = "pressLayerY2_offset"; - public static String item_pressLayerX3_offset = "pressLayerX3_offset"; - public static String item_pressLayerY3_offset = "pressLayerY3_offset"; - public static String item_one_cribTotal = "one_cribTotal"; - public static String item_two_cribTotal = "two_cribTotal"; - public static String item_one_qty = "one_qty"; - public static String item_two_qty = "two_qty"; - public static String item_tool_coordinate = "tool_coordinate"; - - public static String item_to_heartbeat = "to_heartbeat"; - public static String item_to_feedback = "to_feedback"; - public static String item_to_error = "to_error"; - public static String item_to_materialQty = "to_materialQty"; - public static String item_to_material_type = "to_material_type"; - public static String item_to_material_code = "to_material_code"; - - public static String item_to_product_code = "to_product_code"; - public static String item_to_AlongSide = "to_AlongSide"; - public static String item_to_BshortSide = "to_BshortSide"; - public static String item_to_Htrapezoidal = "to_Htrapezoidal"; - public static String item_to_Wthickness = "to_Wthickness"; - public static String item_to_tray_qty = "to_tray_qty"; - public static String item_to_tray_high = "to_tray_high"; - public static String item_to_crib_category = "to_crib_category"; - public static String item_to_palletX1_line = "to_palletX1_line"; - public static String item_to_palletY1_row = "to_palletY1_row"; - public static String item_to_palletA1_angle = "to_palletA1_angle"; - public static String item_to_palletX2_line = "to_palletX2_line"; - public static String item_to_palletY2_row = "to_palletY2_row"; - public static String item_to_palletA2_angle = "to_palletA2_angle"; - public static String item_to_palletX3_line = "to_palletX3_line"; - public static String item_to_palletY3_row = "to_palletY3_row"; - public static String item_to_palletA3_angle = "to_palletA3_angle"; - public static String item_to_pressCribX1_line = "to_pressCribX1_line"; - public static String item_to_pressCribY1_row = "to_pressCribY1_row"; - public static String item_to_pressCribA1_angle = "to_pressCribA1_angle"; - public static String item_to_pressCribX2_line = "to_pressCribX2_line"; - public static String item_to_pressCribY2_row = "to_pressCribY2_row"; - public static String item_to_pressCribA2_angle = "to_pressCribA2_angle"; - public static String item_to_pressCribX3_line = "to_pressCribX3_line"; - public static String item_to_pressCribY3_row = "to_pressCribY3_row"; - public static String item_to_pressCribA3_angle = "to_pressCribA3_angle"; - public static String item_to_Zoffset = "to_Zoffset"; - public static String item_to_pallet_layerQty = "to_pallet_layerQty"; - public static String item_to_pressCrib_layerQty = "to_pressCrib_layerQty"; - public static String item_to_codeLayerX1_interval = "to_codeLayerX1_interval"; - public static String item_to_codeLayerY1_interval = "to_codeLayerY1_interval"; - public static String item_to_codeLayerX2_interval = "to_codeLayerX2_interval"; - public static String item_to_codeLayerY2_interval = "to_codeLayerY2_interval"; - public static String item_to_codeLayerX3_interval = "to_codeLayerX3_interval"; - public static String item_to_codeLayerY3_interval = "to_codeLayerY3_interval"; - public static String item_to_codeLayerX1_offset = "to_codeLayerX1_offset"; - public static String item_to_codeLayerY1_offset = "to_codeLayerY1_offset"; - public static String item_to_codeLayerX2_offset = "to_codeLayerX2_offset"; - public static String item_to_codeLayerY2_offset = "to_codeLayerY2_offset"; - public static String item_to_codeLayerX3_offset = "to_codeLayerX3_offset"; - public static String item_to_codeLayerY3_offset = "to_codeLayerY3_offset"; - public static String item_to_pressLayerX1_interval = "to_pressLayerX1_interval"; - public static String item_to_pressLayerY1_interval = "to_pressLayerY1_interval"; - public static String item_to_pressLayerX2_interval = "to_pressLayerX2_interval"; - public static String item_to_pressLayerY2_interval = "to_pressLayerY2_interval"; - public static String item_to_pressLayerX3_interval = "to_pressLayerX3_interval"; - public static String item_to_pressLayerY3_interval = "to_pressLayerY3_interval"; - public static String item_to_pressLayerX1_offset = "to_pressLayerX1_offset"; - public static String item_to_pressLayerY1_offset = "to_pressLayerY1_offset"; - public static String item_to_pressLayerX2_offset = "to_pressLayerX2_offset"; - public static String item_to_pressLayerY2_offset = "to_pressLayerY2_offset"; - public static String item_to_pressLayerX3_offset = "to_pressLayerX3_offset"; - public static String item_to_pressLayerY3_offset = "to_pressLayerY3_offset"; - public static String item_to_one_cribTotal = "to_one_cribTotal"; - public static String item_to_two_cribTotal = "to_two_cribTotal"; - public static String item_to_one_qty = "to_one_qty"; - public static String item_to_two_qty = "to_two_qty"; - public static String item_to_tool_coordinate = "to_tool_coordinate"; - - - private LnshPalletizingManipulatorDeviceDriver driver; - - public ItemProtocol(LnshPalletizingManipulatorDeviceDriver driver) { - this.driver = driver; - } - - public int getHeartbeat() { - return this.getOpcIntegerValue(item_heartbeat); - } - - public int getMode() { - return this.getOpcIntegerValue(item_mode); - } - - public int getStatus() { - return this.getOpcIntegerValue(item_status); - } - - public int getAction() { - return this.getOpcIntegerValue(item_action); - } - - public int getError() { - return this.getOpcIntegerValue(item_error); - } - - public int getPut_station() { - return this.getOpcIntegerValue(item_put_station); - } - - public String getBarcode() { - return this.getOpcStringValue(item_barcode); - } - - public String getMaterial() { - return this.getOpcStringValue(item_material); - } - - public int getEncoder_qty() { - return this.getOpcIntegerValue(item_encoder_qty); - } - - public int getOpen_time() { - return this.getOpcIntegerValue(item_open_time); - } - - public int getStandby_time() { - return this.getOpcIntegerValue(item_standby_time); - } - - public int getProduction_time() { - return this.getOpcIntegerValue(item_production_time); - } - - public int getError_time() { - return this.getOpcIntegerValue(item_error_time); - } - - public int getProduct_code() { - return this.getOpcIntegerValue(item_product_code); - } - - public int getAlongSide() { - return this.getOpcIntegerValue(item_AlongSide); - } - - public int getBshortSide() { - return this.getOpcIntegerValue(item_BshortSide); - } - - public int getHtrapezoidal() { - return this.getOpcIntegerValue(item_Htrapezoidal); - } - - public int getWthickness() { - return this.getOpcIntegerValue(item_Wthickness); - } - - public int getTray_qty() { - return this.getOpcIntegerValue(item_tray_qty); - } - - public int getTray_high() { - return this.getOpcIntegerValue(item_tray_high); - } - - public int getCrib_category() { - return this.getOpcIntegerValue(item_crib_category); - } - - public Float getPalletX1_line() { - return this.getOpcFloatValue(item_palletX1_line); - } - - public Float getPalletY1_row() { - return this.getOpcFloatValue(item_palletY1_row); - } - - public Float getPalletA1_angle() { - return this.getOpcFloatValue(item_palletA1_angle); - } - - public Float getPalletX2_line() { - return this.getOpcFloatValue(item_palletX2_line); - } - - public Float getPalletY2_row() { - return this.getOpcFloatValue(item_palletY2_row); - } - - public Float getPalletA2_angle() { - return this.getOpcFloatValue(item_palletA2_angle); - } - - public Float getPalletX3_line() { - return this.getOpcFloatValue(item_palletX3_line); - } - - public Float getPalletY3_row() { - return this.getOpcFloatValue(item_palletY3_row); - } - - public Float getPalletA3_angle() { - return this.getOpcFloatValue(item_palletA3_angle); - } - - public Float getPressCribX1_line() { - return this.getOpcFloatValue(item_pressCribX1_line); - } - - public Float getPressCribY1_row() { - return this.getOpcFloatValue(item_pressCribY1_row); - } - - public Float getPressCribA1_angle() { - return this.getOpcFloatValue(item_pressCribA1_angle); - } - - public Float getPressCribX2_line() { - return this.getOpcFloatValue(item_pressCribX2_line); - } - - public Float getPressCribY2_row() { - return this.getOpcFloatValue(item_pressCribY2_row); - } - - public Float getPressCribA2_angle() { - return this.getOpcFloatValue(item_pressCribA2_angle); - } - - public Float getPressCribX3_line() { - return this.getOpcFloatValue(item_pressCribX3_line); - } - - public Float getPressCribY3_row() { - return this.getOpcFloatValue(item_pressCribY3_row); - } - - public Float getPressCribA3_angle() { - return this.getOpcFloatValue(item_pressCribA3_angle); - } - - public Float getZoffset() { - return this.getOpcFloatValue(item_Zoffset); - } - - public int getPallet_layerQty() { - return this.getOpcIntegerValue(item_pallet_layerQty); - } - - public int getPressCrib_layerQty() { - return this.getOpcIntegerValue(item_pressCrib_layerQty); - } - - public Float getCodeLayerX1_interval() { - return this.getOpcFloatValue(item_codeLayerX1_interval); - } - - public Float getCodeLayerY1_interval() { - return this.getOpcFloatValue(item_codeLayerY1_interval); - } - - public Float getCodeLayerX2_interval() { - return this.getOpcFloatValue(item_codeLayerX2_interval); - } - - public Float getCodeLayerY2_interval() { - return this.getOpcFloatValue(item_codeLayerY2_interval); - } - - public Float getCodeLayerX3_interval() { - return this.getOpcFloatValue(item_codeLayerX3_interval); - } - - public Float getcodeLayerY3_interval() { - return this.getOpcFloatValue(item_codeLayerY3_interval); - } - - public Float getCodeLayerX1_offset() { - return this.getOpcFloatValue(item_codeLayerX1_offset); - } - - public Float getCodeLayerY1_offset() { - return this.getOpcFloatValue(item_codeLayerY1_offset); - } - - public Float getCodeLayerX2_offset() { - return this.getOpcFloatValue(item_codeLayerX2_offset); - } - - public Float getCodeLayerY2_offset() { - return this.getOpcFloatValue(item_codeLayerY2_offset); - } - - public Float getCodeLayerX3_offset() { - return this.getOpcFloatValue(item_codeLayerX3_offset); - } - - public Float getCodeLayerY3_offset() { - return this.getOpcFloatValue(item_codeLayerY3_offset); - } - - public Float getPressLayerX1_interval() { - return this.getOpcFloatValue(item_pressLayerX1_interval); - } - - public Float getPressLayerY1_interval() { - return this.getOpcFloatValue(item_pressLayerY1_interval); - } - - public Float getPressLayerX2_interval() { - return this.getOpcFloatValue(item_pressLayerX2_interval); - } - - public Float getPressLayerY2_interval() { - return this.getOpcFloatValue(item_pressLayerY2_interval); - } - - public Float getPressLayerX3_interval() { - return this.getOpcFloatValue(item_pressLayerX3_interval); - } - - public Float getPressLayerY3_interval() { - return this.getOpcFloatValue(item_pressLayerY3_interval); - } - - public Float getPressLayerX1_offset() { - return this.getOpcFloatValue(item_pressLayerX1_offset); - } - - public Float getPressLayerY1_offset() { - return this.getOpcFloatValue(item_pressLayerY1_offset); - } - - public Float getPressLayerX2_offset() { - return this.getOpcFloatValue(item_pressLayerX2_offset); - } - - public Float getPressLayerY2_offset() { - return this.getOpcFloatValue(item_pressLayerY2_offset); - } - - public Float getPressLayerX3_offset() { - return this.getOpcFloatValue(item_pressLayerX3_offset); - } - - public Float getPressLayerY3_offset() { - return this.getOpcFloatValue(item_pressLayerY3_offset); - } - - public int getOne_cribTotal() { - return this.getOpcIntegerValue(item_one_cribTotal); - } - - public int getTwo_cribTotal() { - return this.getOpcIntegerValue(item_two_cribTotal); - } - - public int getOne_qty() { - return this.getOpcIntegerValue(item_one_qty); - } - - public int getTwo_qty() { - return this.getOpcIntegerValue(item_two_qty); - } - - public int getTool_coordinate() { - return this.getOpcIntegerValue(item_tool_coordinate); - } - - public int getTo_feedback() { - return this.getOpcIntegerValue(item_to_feedback); - } - - public int getTo_error() { - return this.getOpcIntegerValue(item_to_error); - } - - public int getTo_materialQty() { - return this.getOpcIntegerValue(item_to_materialQty); - } - - public int getTo_material_type() { - return this.getOpcIntegerValue(item_to_material_type); - } - - public String getTo_material_code() { - return this.getOpcStringValue(item_to_material_code); - } - - public int getToProduct_code() { - return this.getOpcIntegerValue(item_to_product_code); - } - - public int getToAlongSide() { - return this.getOpcIntegerValue(item_to_AlongSide); - } - - public int getToBshortSide() { - return this.getOpcIntegerValue(item_to_BshortSide); - } - - public int getToHtrapezoidal() { - return this.getOpcIntegerValue(item_to_Htrapezoidal); - } - - public int getToWthickness() { - return this.getOpcIntegerValue(item_to_Wthickness); - } - - public int getToTray_qty() { - return this.getOpcIntegerValue(item_to_tray_qty); - } - - public int getToTray_high() { - return this.getOpcIntegerValue(item_to_tray_high); - } - - public int getToCrib_category() { - return this.getOpcIntegerValue(item_to_crib_category); - } - - public Float getToPalletX1_line() { - return this.getOpcFloatValue(item_to_palletX1_line); - } - - public Float getToPalletY1_row() { - return this.getOpcFloatValue(item_to_palletY1_row); - } - - public Float getToPalletA1_angle() { - return this.getOpcFloatValue(item_to_palletA1_angle); - } - - public Float getToPalletX2_line() { - return this.getOpcFloatValue(item_to_palletX2_line); - } - - public Float getToPalletY2_row() { - return this.getOpcFloatValue(item_to_palletY2_row); - } - - public Float getToPalletA2_angle() { - return this.getOpcFloatValue(item_to_palletA2_angle); - } - - public Float getToPalletX3_line() { - return this.getOpcFloatValue(item_to_palletX3_line); - } - - public Float getToPalletY3_row() { - return this.getOpcFloatValue(item_to_palletY3_row); - } - - public Float getToPalletA3_angle() { - return this.getOpcFloatValue(item_to_palletA3_angle); - } - - public Float getToPressCribX1_line() { - return this.getOpcFloatValue(item_to_pressCribX1_line); - } - - public Float getToPressCribY1_row() { - return this.getOpcFloatValue(item_to_pressCribY1_row); - } - - public Float getToPressCribA1_angle() { - return this.getOpcFloatValue(item_to_pressCribA1_angle); - } - - public Float getToPressCribX2_line() { - return this.getOpcFloatValue(item_to_pressCribX2_line); - } - - public Float getToPressCribY2_row() { - return this.getOpcFloatValue(item_to_pressCribY2_row); - } - - public Float getToPressCribA2_angle() { - return this.getOpcFloatValue(item_to_pressCribA2_angle); - } - - public Float getToPressCribX3_line() { - return this.getOpcFloatValue(item_to_pressCribX3_line); - } - - public Float getToPressCribY3_row() { - return this.getOpcFloatValue(item_to_pressCribY3_row); - } - - public Float getToPressCribA3_angle() { - return this.getOpcFloatValue(item_to_pressCribA3_angle); - } - - public Float getToZoffset() { - return this.getOpcFloatValue(item_to_Zoffset); - } - - public int getToPallet_layerQty() { - return this.getOpcIntegerValue(item_to_pallet_layerQty); - } - - public int getToPressCrib_layerQty() { - return this.getOpcIntegerValue(item_to_pressCrib_layerQty); - } - - public Float getToCodeLayerX1_interval() { - return this.getOpcFloatValue(item_to_codeLayerX1_interval); - } - - public Float getToCodeLayerY1_interval() { - return this.getOpcFloatValue(item_to_codeLayerY1_interval); - } - - public Float getToCodeLayerX2_interval() { - return this.getOpcFloatValue(item_to_codeLayerX2_interval); - } - - public Float getToCodeLayerY2_interval() { - return this.getOpcFloatValue(item_to_codeLayerY2_interval); - } - - public Float getToCodeLayerX3_interval() { - return this.getOpcFloatValue(item_to_codeLayerX3_interval); - } - - public Float getTocodeLayerY3_interval() { - return this.getOpcFloatValue(item_to_codeLayerY3_interval); - } - - public Float getToCodeLayerX1_offset() { - return this.getOpcFloatValue(item_to_codeLayerX1_offset); - } - - public Float getToCodeLayerY1_offset() { - return this.getOpcFloatValue(item_to_codeLayerY1_offset); - } - - public Float getToCodeLayerX2_offset() { - return this.getOpcFloatValue(item_to_codeLayerX2_offset); - } - - public Float getToCodeLayerY2_offset() { - return this.getOpcFloatValue(item_to_codeLayerY2_offset); - } - - public Float getToCodeLayerX3_offset() { - return this.getOpcFloatValue(item_to_codeLayerX3_offset); - } - - public Float getToCodeLayerY3_offset() { - return this.getOpcFloatValue(item_to_codeLayerY3_offset); - } - - public Float getToPressLayerX1_interval() { - return this.getOpcFloatValue(item_to_pressLayerX1_interval); - } - - public Float getToPressLayerY1_interval() { - return this.getOpcFloatValue(item_to_pressLayerY1_interval); - } - - public Float getToPressLayerX2_interval() { - return this.getOpcFloatValue(item_to_pressLayerX2_interval); - } - - public Float getToPressLayerY2_interval() { - return this.getOpcFloatValue(item_to_pressLayerY2_interval); - } - - public Float getToPressLayerX3_interval() { - return this.getOpcFloatValue(item_to_pressLayerX3_interval); - } - - public Float getToPressLayerY3_interval() { - return this.getOpcFloatValue(item_to_pressLayerY3_interval); - } - - public Float getToPressLayerX1_offset() { - return this.getOpcFloatValue(item_to_pressLayerX1_offset); - } - - public Float getToPressLayerY1_offset() { - return this.getOpcFloatValue(item_to_pressLayerY1_offset); - } - - public Float getToPressLayerX2_offset() { - return this.getOpcFloatValue(item_to_pressLayerX2_offset); - } - - public Float getToPressLayerY2_offset() { - return this.getOpcFloatValue(item_to_pressLayerY2_offset); - } - - public Float getToPressLayerX3_offset() { - return this.getOpcFloatValue(item_to_pressLayerX3_offset); - } - - public Float getToPressLayerY3_offset() { - return this.getOpcFloatValue(item_to_pressLayerY3_offset); - } - - public int getToOne_cribTotal() { - return this.getOpcIntegerValue(item_to_one_cribTotal); - } - - public int getToTwo_cribTotal() { - return this.getOpcIntegerValue(item_to_two_cribTotal); - } - - public int getToOne_qty() { - return this.getOpcIntegerValue(item_to_one_qty); - } - - public int getToTwo_qty() { - return this.getOpcIntegerValue(item_to_two_qty); - } - - public int getToTool_coordinate() { - return this.getOpcIntegerValue(item_to_tool_coordinate); - } - - 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 Float getOpcFloatValue(String protocol) { - Float value = this.driver.getFloatValue(protocol); - if (ObjectUtil.isEmpty(value)) { -// log.error("读取错误!"); - } else { - return value; - } - return 0.0f; - } - - public String getOpcStringValue(String protocol) { - String value = this.driver.getStringValue(protocol); - if (StrUtil.isEmpty(value)) { -// log.error("读取错误!"); - } else { - return value; - } - return "0"; - } - - public static List getReadableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_heartbeat, "心跳", "DB1.B0")); - list.add(new ItemDto(item_mode, "工作状态", "DB1.B1", Boolean.valueOf(true))); - list.add(new ItemDto(item_status, "设备状态", "DB1.B2")); - list.add(new ItemDto(item_action, "动作", "DB1.B3")); - list.add(new ItemDto(item_error, "故障代码", "DB1.B4")); - list.add(new ItemDto(item_put_station, "当前码盘工位", "DB1.B5")); - list.add(new ItemDto(item_barcode, "当前码盘工位条码", "DB1.S6")); - list.add(new ItemDto(item_material, "码盘工位当前物料", "DB1.S262")); - list.add(new ItemDto(item_encoder_qty, "码盘位当前码盘数量", "DB1.D518")); - list.add(new ItemDto(item_open_time, "开机时间", "DB1.D522")); - list.add(new ItemDto(item_standby_time, "待机时间", "DB1.D526")); - list.add(new ItemDto(item_production_time, "生产时间", "DB1.D530")); - list.add(new ItemDto(item_error_time, "故障时间", "DB1.D534")); - - list.add(new ItemDto(item_product_code, "产品编号", "DB1.D538")); - list.add(new ItemDto(item_AlongSide, "A长边", "DB1.D542")); - list.add(new ItemDto(item_BshortSide, "B短边", "DB1.D546")); - list.add(new ItemDto(item_Htrapezoidal, "H梯形高", "DB1.D550")); - list.add(new ItemDto(item_Wthickness, "W厚度", "DB1.D554")); - list.add(new ItemDto(item_tray_qty, "当前垛盘数", "DB1.D558")); - list.add(new ItemDto(item_tray_high, "垛盘高度", "DB1.D562")); - list.add(new ItemDto(item_crib_category, "垛型类别", "DB1.D566")); - list.add(new ItemDto(item_palletX1_line, "码垛X1行", "DB1.REAL570")); - list.add(new ItemDto(item_palletY1_row, "码垛Y1列", "DB1.REAL1574")); - list.add(new ItemDto(item_palletA1_angle, "码垛A1角度", "DB1.REAL578")); - list.add(new ItemDto(item_palletX2_line, "码垛X2行", "DB1.REAL582")); - list.add(new ItemDto(item_palletY2_row, "码垛Y2列", "DB1.REAL586")); - list.add(new ItemDto(item_palletA2_angle, "码垛A2角度", "DB1.REAL590")); - list.add(new ItemDto(item_palletX3_line, "码垛X3行", "DB1.REAL594")); - list.add(new ItemDto(item_palletY3_row, "码垛Y3列", "DB1.REAL598")); - list.add(new ItemDto(item_palletA3_angle, "码垛A3角度", "DB1.REAL602")); - list.add(new ItemDto(item_pressCribX1_line, "压垛X1行", "DB1.REAL606")); - list.add(new ItemDto(item_pressCribY1_row, "压垛Y1列", "DB1.REAL610")); - list.add(new ItemDto(item_pressCribA1_angle, "压垛A1角度", "DB1.REAL614")); - list.add(new ItemDto(item_pressCribX2_line, "压垛X2行", "DB1.REAL618")); - list.add(new ItemDto(item_pressCribY2_row, "压垛Y2列", "DB1.REAL622")); - list.add(new ItemDto(item_pressCribA2_angle, "压垛A2角度", "DB1.REAL626")); - list.add(new ItemDto(item_pressCribX3_line, "压垛X3行", "DB1.REAL630")); - list.add(new ItemDto(item_pressCribY3_row, "压垛Y3列", "DB1.REAL634")); - list.add(new ItemDto(item_pressCribA3_angle, "压垛A3角度", "DB1.REAL638")); - list.add(new ItemDto(item_Zoffset, "Z轴偏移", "DB1.REAL642")); - list.add(new ItemDto(item_pallet_layerQty, "码垛层数", "DB1.D646")); - list.add(new ItemDto(item_pressCrib_layerQty, "压垛层数", "DB1.D650")); - list.add(new ItemDto(item_codeLayerX1_interval, "码层X1间隔", "DB1.REAL654")); - list.add(new ItemDto(item_codeLayerY1_interval, "码层Y1间隔", "DB1.REAL658")); - list.add(new ItemDto(item_codeLayerX2_interval, "码层X2间隔", "DB1.REAL662")); - list.add(new ItemDto(item_codeLayerY2_interval, "码层Y2间隔", "DB1.REAL666")); - list.add(new ItemDto(item_codeLayerX3_interval, "码层X3间隔", "DB1.REAL670")); - list.add(new ItemDto(item_codeLayerY3_interval, "码层Y3间隔", "DB1.REAL674")); - list.add(new ItemDto(item_codeLayerX1_offset, "码层X1偏移", "DB1.REAL678")); - list.add(new ItemDto(item_codeLayerY1_offset, "码层Y1偏移", "DB1.REAL682")); - list.add(new ItemDto(item_codeLayerX2_offset, "码层X2偏移", "DB1.REAL686")); - list.add(new ItemDto(item_codeLayerY2_offset, "码层Y2偏移", "DB1.REAL690")); - list.add(new ItemDto(item_codeLayerX3_offset, "码层X3偏移", "DB1.REAL694")); - list.add(new ItemDto(item_codeLayerY3_offset, "码层Y3偏移", "DB1.REAL698")); - list.add(new ItemDto(item_pressLayerX1_interval, "压层X1间隔", "DB1.REAL702")); - list.add(new ItemDto(item_pressLayerY1_interval, "压层Y1间隔", "DB1.REAL706")); - list.add(new ItemDto(item_pressLayerX2_interval, "压层X2间隔", "DB1.REAL710")); - list.add(new ItemDto(item_pressLayerY2_interval, "压层Y2间隔", "DB1.REAL714")); - list.add(new ItemDto(item_pressLayerX3_interval, "压层X3间隔", "DB1.REAL718")); - list.add(new ItemDto(item_pressLayerY3_interval, "压层Y3间隔", "DB1.REAL722")); - list.add(new ItemDto(item_pressLayerX1_offset, "压层X1偏移", "DB1.REAL726")); - list.add(new ItemDto(item_pressLayerY1_offset, "压层Y1偏移", "DB1.REAL730")); - list.add(new ItemDto(item_pressLayerX2_offset, "压层X2偏移", "DB1.REAL734")); - list.add(new ItemDto(item_pressLayerY2_offset, "压层Y2偏移", "DB1.REAL738")); - list.add(new ItemDto(item_pressLayerX3_offset, "压层X3偏移", "DB1.REAL742")); - list.add(new ItemDto(item_pressLayerY3_offset, "压层Y3偏移", "DB1.REAL746")); - list.add(new ItemDto(item_one_cribTotal, "1#垛总数", "DB1.D750")); - list.add(new ItemDto(item_two_cribTotal, "2#垛总数", "DB1.D754")); - list.add(new ItemDto(item_one_qty, "1#垛当前数", "DB1.D758")); - list.add(new ItemDto(item_two_qty, "2#垛当前数", "DB1.D762")); - list.add(new ItemDto(item_tool_coordinate, "工具坐标", "DB1.D766")); - return list; - } - - public static List getWriteableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_feedback, "机器人动作反馈", "DB2.B0")); - list.add(new ItemDto(item_to_error, "故障代码", "DB2.B1")); - list.add(new ItemDto(item_to_materialQty, "托盘砖数量", "DB2.W2")); - list.add(new ItemDto(item_to_material_type, "箱型", "DB2.W4")); - list.add(new ItemDto(item_to_material_code, "下发物料编号", "DB2.S6")); - - list.add(new ItemDto(item_to_product_code, "产品编号", "DB2.D262")); - list.add(new ItemDto(item_to_AlongSide, "A长边", "DB2.D266")); - list.add(new ItemDto(item_to_BshortSide, "B短边", "DB2.D270")); - list.add(new ItemDto(item_to_Htrapezoidal, "H梯形高", "DB2.D274")); - list.add(new ItemDto(item_to_Wthickness, "W厚度", "DB2.D278")); - list.add(new ItemDto(item_to_tray_qty, "当前垛盘数", "DB2.D282")); - list.add(new ItemDto(item_to_tray_high, "垛盘高度", "DB2.D286")); - list.add(new ItemDto(item_to_crib_category, "垛型类别", "DB2.D290")); - list.add(new ItemDto(item_to_palletX1_line, "码垛X1行", "DB2.REAL294")); - list.add(new ItemDto(item_to_palletY1_row, "码垛Y1列", "DB2.REAL298")); - list.add(new ItemDto(item_to_palletA1_angle, "码垛A1角度", "DB2.REAL302")); - list.add(new ItemDto(item_to_palletX2_line, "码垛X2行", "DB2.REAL306")); - list.add(new ItemDto(item_to_palletY2_row, "码垛Y2列", "DB2.REAL310")); - list.add(new ItemDto(item_to_palletA2_angle, "码垛A2角度", "DB2.REAL314")); - list.add(new ItemDto(item_to_palletX3_line, "码垛X3行", "DB2.REAL318")); - list.add(new ItemDto(item_to_palletY3_row, "码垛Y3列", "DB2.REAL322")); - list.add(new ItemDto(item_to_palletA3_angle, "码垛A3角度", "DB2.REAL326")); - list.add(new ItemDto(item_to_pressCribX1_line, "压垛X1行", "DB2.REAL330")); - list.add(new ItemDto(item_to_pressCribY1_row, "压垛Y1列", "DB2.REAL334")); - list.add(new ItemDto(item_to_pressCribA1_angle, "压垛A1角度", "DB2.REAL338")); - list.add(new ItemDto(item_to_pressCribX2_line, "压垛X2行", "DB2.REAL342")); - list.add(new ItemDto(item_to_pressCribY2_row, "压垛Y2列", "DB2.REAL346")); - list.add(new ItemDto(item_to_pressCribA2_angle, "压垛A2角度", "DB2.REAL350")); - list.add(new ItemDto(item_to_pressCribX3_line, "压垛X3行", "DB2.REAL354")); - list.add(new ItemDto(item_to_pressCribY3_row, "压垛Y3列", "DB2.REAL358")); - list.add(new ItemDto(item_to_pressCribA3_angle, "压垛A3角度", "DB2.REAL362")); - list.add(new ItemDto(item_to_Zoffset, "Z轴偏移", "DB2.REAL366")); - list.add(new ItemDto(item_to_pallet_layerQty, "码垛层数", "DB2.D370")); - list.add(new ItemDto(item_to_pressCrib_layerQty, "压垛层数", "DB2.D374")); - list.add(new ItemDto(item_to_codeLayerX1_interval, "码层X1间隔", "DB2.REAL378")); - list.add(new ItemDto(item_to_codeLayerY1_interval, "码层Y1间隔", "DB2.REAL382")); - list.add(new ItemDto(item_to_codeLayerX2_interval, "码层X2间隔", "DB2.REAL386")); - list.add(new ItemDto(item_to_codeLayerY2_interval, "码层Y2间隔", "DB2.REAL390")); - list.add(new ItemDto(item_to_codeLayerX3_interval, "码层X3间隔", "DB2.REAL394")); - list.add(new ItemDto(item_to_codeLayerY3_interval, "码层Y3间隔", "DB2.REAL398")); - list.add(new ItemDto(item_to_codeLayerX1_offset, "码层X1偏移", "DB2.REAL402")); - list.add(new ItemDto(item_to_codeLayerY1_offset, "码层Y1偏移", "DB2.REAL406")); - list.add(new ItemDto(item_to_codeLayerX2_offset, "码层X2偏移", "DB2.REAL410")); - list.add(new ItemDto(item_to_codeLayerY2_offset, "码层Y2偏移", "DB2.REAL414")); - list.add(new ItemDto(item_to_codeLayerX3_offset, "码层X3偏移", "DB2.REAL418")); - list.add(new ItemDto(item_to_codeLayerY3_offset, "码层Y3偏移", "DB2.REAL422")); - list.add(new ItemDto(item_to_pressLayerX1_interval, "压层X1间隔", "DB2.REAL426")); - list.add(new ItemDto(item_to_pressLayerY1_interval, "压层Y1间隔", "DB2.REAL430")); - list.add(new ItemDto(item_to_pressLayerX2_interval, "压层X2间隔", "DB2.REAL434")); - list.add(new ItemDto(item_to_pressLayerY2_interval, "压层Y2间隔", "DB2.REAL438")); - list.add(new ItemDto(item_to_pressLayerX3_interval, "压层X3间隔", "DB2.REAL442")); - list.add(new ItemDto(item_to_pressLayerY3_interval, "压层Y3间隔", "DB2.REAL446")); - list.add(new ItemDto(item_to_pressLayerX1_offset, "压层X1偏移", "DB2.REAL450")); - list.add(new ItemDto(item_to_pressLayerY1_offset, "压层Y1偏移", "DB2.REAL454")); - list.add(new ItemDto(item_to_pressLayerX2_offset, "压层X2偏移", "DB2.REAL458")); - list.add(new ItemDto(item_to_pressLayerY2_offset, "压层Y2偏移", "DB2.REAL462")); - list.add(new ItemDto(item_to_pressLayerX3_offset, "压层X3偏移", "DB2.REAL466")); - list.add(new ItemDto(item_to_pressLayerY3_offset, "压层Y3偏移", "DB2.REAL470")); - list.add(new ItemDto(item_to_one_cribTotal, "1#垛总数", "DB2.D474")); - list.add(new ItemDto(item_to_two_cribTotal, "2#垛总数", "DB2.D478")); - list.add(new ItemDto(item_to_one_qty, "1#垛当前数", "DB2.D482")); - list.add(new ItemDto(item_to_two_qty, "2#垛当前数", "DB2.D486")); - list.add(new ItemDto(item_to_tool_coordinate, "工具坐标", "DB2.D490")); - return list; - } - -} - diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/LnshPalletizingManipulatorDefination.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/LnshPalletizingManipulatorDefination.java deleted file mode 100644 index 421ef12..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/LnshPalletizingManipulatorDefination.java +++ /dev/null @@ -1,140 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator; - -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 LnshPalletizingManipulatorDefination implements OpcDeviceDriverDefination { - @Override - public String getDriverCode() { - return "lnsh_palletizing_manipulator"; - } - - @Override - public String getDriverName() { - return "晟华-码垛机械手"; - } - - @Override - public String getDriverDescription() { - return "晟华-码垛机械手"; - } - - @Override - public DeviceDriver getDriverInstance(Device device) { - return (new LnshPalletizingManipulatorDeviceDriver()).setDevice(device).setDriverDefination(this); - - } - - @Override - public Class getDeviceDriverType() { - return LnshPalletizingManipulatorDeviceDriver.class; - } - - @Override - public List getFitDeviceTypes() { - List types = new LinkedList(); - types.add(DeviceType.station); - return types; - } - - @Override - public List getReadableItemDtos() { - return getReadableItemDtos2(); - } - - public static List getReadableItemDtos2() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB1.B0")); - list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB1.B1", Boolean.valueOf(true))); - list.add(new ItemDto(ItemProtocol.item_status, "设备状态", "DB1.B2")); - list.add(new ItemDto(ItemProtocol.item_action, "动作", "DB1.B3")); - list.add(new ItemDto(ItemProtocol.item_error, "故障代码", "DB1.B4")); - list.add(new ItemDto(ItemProtocol.item_put_station, "当前码盘工位", "DB1.B5")); - list.add(new ItemDto(ItemProtocol.item_barcode, "当前码盘工位条码", "DB1.S6")); - list.add(new ItemDto(ItemProtocol.item_material, "码盘工位当前物料", "DB1.S262")); - list.add(new ItemDto(ItemProtocol.item_encoder_qty, "码盘位当前码盘数量", "DB1.D518")); - list.add(new ItemDto(ItemProtocol.item_open_time, "开机时间", "DB1.D522")); - list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "DB1.D526")); - list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "DB1.D530")); - list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "DB1.D534")); - - list.add(new ItemDto(ItemProtocol.item_product_code, "产品编号", "DB1.D538")); - list.add(new ItemDto(ItemProtocol.item_AlongSide, "A长边", "DB1.D542")); - list.add(new ItemDto(ItemProtocol.item_BshortSide, "B短边", "DB1.D546")); - list.add(new ItemDto(ItemProtocol.item_Htrapezoidal, "H梯形高", "DB1.D550")); - list.add(new ItemDto(ItemProtocol.item_Wthickness, "W厚度", "DB1.D554")); - list.add(new ItemDto(ItemProtocol.item_tray_qty, "当前垛盘数", "DB1.D558")); - list.add(new ItemDto(ItemProtocol.item_tray_high, "垛盘高度", "DB1.D562")); - list.add(new ItemDto(ItemProtocol.item_crib_category, "垛型类别", "DB1.D566")); - list.add(new ItemDto(ItemProtocol.item_palletX1_line, "码垛X1行", "DB1.REAL570")); - list.add(new ItemDto(ItemProtocol.item_palletY1_row, "码垛Y1列", "DB1.REAL1574")); - list.add(new ItemDto(ItemProtocol.item_palletA1_angle, "码垛A1角度", "DB1.REAL578")); - list.add(new ItemDto(ItemProtocol.item_palletX2_line, "码垛X2行", "DB1.REAL582")); - list.add(new ItemDto(ItemProtocol.item_palletY2_row, "码垛Y2列", "DB1.REAL586")); - list.add(new ItemDto(ItemProtocol.item_palletA2_angle, "码垛A2角度", "DB1.REAL590")); - list.add(new ItemDto(ItemProtocol.item_palletX3_line, "码垛X3行", "DB1.REAL594")); - list.add(new ItemDto(ItemProtocol.item_palletY3_row, "码垛Y3列", "DB1.REAL598")); - list.add(new ItemDto(ItemProtocol.item_palletA3_angle, "码垛A3角度", "DB1.REAL602")); - list.add(new ItemDto(ItemProtocol.item_pressCribX1_line, "压垛X1行", "DB1.REAL606")); - list.add(new ItemDto(ItemProtocol.item_pressCribY1_row, "压垛Y1列", "DB1.REAL610")); - list.add(new ItemDto(ItemProtocol.item_pressCribA1_angle, "压垛A1角度", "DB1.REAL614")); - list.add(new ItemDto(ItemProtocol.item_pressCribX2_line, "压垛X2行", "DB1.REAL618")); - list.add(new ItemDto(ItemProtocol.item_pressCribY2_row, "压垛Y2列", "DB1.REAL622")); - list.add(new ItemDto(ItemProtocol.item_pressCribA2_angle, "压垛A2角度", "DB1.REAL626")); - list.add(new ItemDto(ItemProtocol.item_pressCribX3_line, "压垛X3行", "DB1.REAL630")); - list.add(new ItemDto(ItemProtocol.item_pressCribY3_row, "压垛Y3列", "DB1.REAL634")); - list.add(new ItemDto(ItemProtocol.item_pressCribA3_angle, "压垛A3角度", "DB1.REAL638")); - list.add(new ItemDto(ItemProtocol.item_Zoffset, "Z轴偏移", "DB1.REAL642")); - list.add(new ItemDto(ItemProtocol.item_pallet_layerQty, "码垛层数", "DB1.D646")); - list.add(new ItemDto(ItemProtocol.item_pressCrib_layerQty, "压垛层数", "DB1.D650")); - list.add(new ItemDto(ItemProtocol.item_codeLayerX1_interval, "码层X1间隔", "DB1.REAL654")); - list.add(new ItemDto(ItemProtocol.item_codeLayerY1_interval, "码层Y1间隔", "DB1.REAL658")); - list.add(new ItemDto(ItemProtocol.item_codeLayerX2_interval, "码层X2间隔", "DB1.REAL662")); - list.add(new ItemDto(ItemProtocol.item_codeLayerY2_interval, "码层Y2间隔", "DB1.REAL666")); - list.add(new ItemDto(ItemProtocol.item_codeLayerX3_interval, "码层X3间隔", "DB1.REAL670")); - list.add(new ItemDto(ItemProtocol.item_codeLayerY3_interval, "码层Y3间隔", "DB1.REAL674")); - list.add(new ItemDto(ItemProtocol.item_codeLayerX1_offset, "码层X1偏移", "DB1.REAL678")); - list.add(new ItemDto(ItemProtocol.item_codeLayerY1_offset, "码层Y1偏移", "DB1.REAL682")); - list.add(new ItemDto(ItemProtocol.item_codeLayerX2_offset, "码层X2偏移", "DB1.REAL686")); - list.add(new ItemDto(ItemProtocol.item_codeLayerY2_offset, "码层Y2偏移", "DB1.REAL690")); - list.add(new ItemDto(ItemProtocol.item_codeLayerX3_offset, "码层X3偏移", "DB1.REAL694")); - list.add(new ItemDto(ItemProtocol.item_codeLayerY3_offset, "码层Y3偏移", "DB1.REAL698")); - list.add(new ItemDto(ItemProtocol.item_pressLayerX1_interval, "压层X1间隔", "DB1.REAL702")); - list.add(new ItemDto(ItemProtocol.item_pressLayerY1_interval, "压层Y1间隔", "DB1.REAL706")); - list.add(new ItemDto(ItemProtocol.item_pressLayerX2_interval, "压层X2间隔", "DB1.REAL710")); - list.add(new ItemDto(ItemProtocol.item_pressLayerY2_interval, "压层Y2间隔", "DB1.REAL714")); - list.add(new ItemDto(ItemProtocol.item_pressLayerX3_interval, "压层X3间隔", "DB1.REAL718")); - list.add(new ItemDto(ItemProtocol.item_pressLayerY3_interval, "压层Y3间隔", "DB1.REAL722")); - list.add(new ItemDto(ItemProtocol.item_pressLayerX1_offset, "压层X1偏移", "DB1.REAL726")); - list.add(new ItemDto(ItemProtocol.item_pressLayerY1_offset, "压层Y1偏移", "DB1.REAL730")); - list.add(new ItemDto(ItemProtocol.item_pressLayerX2_offset, "压层X2偏移", "DB1.REAL734")); - list.add(new ItemDto(ItemProtocol.item_pressLayerY2_offset, "压层Y2偏移", "DB1.REAL738")); - list.add(new ItemDto(ItemProtocol.item_pressLayerX3_offset, "压层X3偏移", "DB1.REAL742")); - list.add(new ItemDto(ItemProtocol.item_pressLayerY3_offset, "压层Y3偏移", "DB1.REAL746")); - list.add(new ItemDto(ItemProtocol.item_one_cribTotal, "1#垛总数", "DB1.D750")); - list.add(new ItemDto(ItemProtocol.item_two_cribTotal, "2#垛总数", "DB1.D754")); - list.add(new ItemDto(ItemProtocol.item_one_qty, "1#垛当前数", "DB1.D758")); - list.add(new ItemDto(ItemProtocol.item_two_qty, "2#垛当前数", "DB1.D762")); - list.add(new ItemDto(ItemProtocol.item_tool_coordinate, "工具坐标", "DB1.D766")); - return list; - } - - @Override - public List getWriteableItemDtos() { - return ItemProtocol.getWriteableItemDtos(); - } - -} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/LnshPalletizingManipulatorDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/LnshPalletizingManipulatorDeviceDriver.java deleted file mode 100644 index 306baf9..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/LnshPalletizingManipulatorDeviceDriver.java +++ /dev/null @@ -1,1143 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator; - -import cn.hutool.core.date.DateUtil; -import cn.hutool.core.util.IdUtil; -import cn.hutool.core.util.StrUtil; -import cn.hutool.http.HttpResponse; -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.ext.wms.service.AcsToWmsService; -import org.nl.acs.instruction.service.InstructionService; -import org.nl.acs.instruction.service.dto.Instruction; - -import org.nl.acs.log.service.DeviceExecuteLogService; -import org.nl.acs.opc.Device; -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.*; - -/** - * 晟华码垛机械手 - */ -@Slf4j -@Data -@RequiredArgsConstructor -public class LnshPalletizingManipulatorDeviceDriver 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 - DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); - @Autowired - AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl"); - - int mode = 0; - int error = 0; - int action = 0; - int last_action = 0; - int last_mode = 0; - int last_error = 0; - Boolean isonline = true; - int hasGoods = 0; - String message = null; - Boolean iserror = false; - - 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; - - float a = 0f; - float b = 0f; - - - - //暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域 - int flag; - - String device_code; - int status = 0; - int last_status = 0; - //开机时间 - int open_time = 0; - int last_open_time = 0; - //待机时间 - int standby_time = 0; - int last_standby_time = 0; - //生产时间 - int production_time = 0; - int last_production_time = 0; - //故障时间 - int error_time = 0; - int last_error_time = 0; - int put_station = 0; - int last_put_station = 0; - String barcode; - String last_barcode; - String material; - String last_material; - int encoder_qty = 0; - int last_encoder_qty = 0; - - //垛型参数 - int product_code = 0; - int AlongSide = 0; - int BshortSide = 0; - int Htrapezoidal = 0; - int Wthickness = 0; - int tray_qty = 0; - int tray_high = 0; - int crib_category = 0; - float palletX1_line = 0f; - float palletY1_row = 0f; - float palletA1_angle = 0f; - float palletX2_line = 0f; - float palletY2_row = 0f; - float palletA2_angle = 0f; - float palletX3_line = 0f; - float palletY3_row = 0f; - float palletA3_angle = 0f; - float pressCribX1_line = 0f; - float pressCribY1_row = 0f; - float pressCribA1_angle = 0f; - float pressCribX2_line = 0f; - float pressCribY2_row = 0f; - float pressCribA2_angle = 0f; - float pressCribX3_line = 0f; - float pressCribY3_row = 0f; - float pressCribA3_angle = 0f; - float Zoffset = 0f; - int pallet_layerQty = 0; - int pressCrib_layerQty = 0; - float codeLayerX1_interval = 0f; - float codeLayerY1_interval = 0f; - float codeLayerX2_interval = 0f; - float codeLayerY2_interval = 0f; - float codeLayerX3_interval = 0f; - float codeLayerY3_interval = 0f; - float codeLayerX1_offset = 0f; - float codeLayerY1_offset = 0f; - float codeLayerX2_offset = 0f; - float codeLayerY2_offset = 0f; - float codeLayerX3_offset = 0f; - float codeLayerY3_offset = 0f; - float pressLayerX1_interval = 0f; - float pressLayerY1_interval = 0f; - float pressLayerX2_interval = 0f; - float pressLayerY2_interval = 0f; - float pressLayerX3_interval = 0f; - float pressLayerY3_interval = 0f; - float pressLayerX1_offset = 0f; - float pressLayerY1_offset = 0f; - float pressLayerX2_offset = 0f; - float pressLayerY2_offset = 0f; - float pressLayerX3_offset = 0f; - float pressLayerY3_offset = 0f; - int one_cribTotal = 0; - int two_cribTotal = 0; - int one_qty = 0; - int two_qty = 0; - int tool_coordinate = 0; - - int last_product_code = 0; - int last_AlongSide = 0; - int last_BshortSide = 0; - int last_Htrapezoidal = 0; - int last_Wthickness = 0; - int last_tray_qty = 0; - int last_tray_high = 0; - int last_crib_category = 0; - float last_palletX1_line = 0f; - float last_palletY1_row = 0f; - float last_palletA1_angle = 0f; - float last_palletX2_line = 0f; - float last_palletY2_row = 0f; - float last_palletA2_angle = 0f; - float last_palletX3_line = 0f; - float last_palletY3_row = 0f; - float last_palletA3_angle = 0f; - float last_pressCribX1_line = 0f; - float last_pressCribY1_row = 0f; - float last_pressCribA1_angle = 0f; - float last_pressCribX2_line = 0f; - float last_pressCribY2_row = 0f; - float last_pressCribA2_angle = 0f; - float last_pressCribX3_line = 0f; - float last_pressCribY3_row = 0f; - float last_pressCribA3_angle = 0f; - float last_Zoffset = 0f; - int last_pallet_layerQty = 0; - int last_pressCrib_layerQty = 0; - float last_codeLayerX1_interval = 0f; - float last_codeLayerY1_interval = 0f; - float last_codeLayerX2_interval = 0f; - float last_codeLayerY2_interval = 0f; - float last_codeLayerX3_interval = 0f; - float last_codeLayerY3_interval = 0f; - float last_codeLayerX1_offset = 0f; - float last_codeLayerY1_offset = 0f; - float last_codeLayerX2_offset = 0f; - float last_codeLayerY2_offset = 0f; - float last_codeLayerX3_offset = 0f; - float last_codeLayerY3_offset = 0f; - float last_pressLayerX1_interval = 0f; - float last_pressLayerY1_interval = 0f; - float last_pressLayerX2_interval = 0f; - float last_pressLayerY2_interval = 0f; - float last_pressLayerX3_interval = 0f; - float last_pressLayerY3_interval = 0f; - float last_pressLayerX1_offset = 0f; - float last_pressLayerY1_offset = 0f; - float last_pressLayerX2_offset = 0f; - float last_pressLayerY2_offset = 0f; - float last_pressLayerX3_offset = 0f; - float last_pressLayerY3_offset = 0f; - int last_one_cribTotal = 0; - int last_two_cribTotal = 0; - int last_one_qty = 0; - int last_two_qty = 0; - int last_tool_coordinate = 0; - - @Override - public Device getDevice() { - return this.device; - } - - - @Override - public void execute() { - String message = null; - try { - device_code = this.getDeviceCode(); - mode = this.itemProtocol.getMode(); - status = this.itemProtocol.getStatus(); - action = this.itemProtocol.getAction(); - error = this.itemProtocol.getError(); - put_station = this.itemProtocol.getPut_station(); - barcode = this.itemProtocol.getBarcode(); - material = this.itemProtocol.getMaterial(); - open_time = this.itemProtocol.getOpen_time(); - standby_time = this.itemProtocol.getStandby_time(); - production_time = this.itemProtocol.getProduction_time(); - error_time = this.itemProtocol.getError_time(); - encoder_qty = this.itemProtocol.getEncoder_qty(); - - product_code = this.itemProtocol.getProduct_code(); - AlongSide = this.itemProtocol.getAlongSide(); - BshortSide = this.itemProtocol.getBshortSide(); - Htrapezoidal = this.itemProtocol.getHtrapezoidal(); - Wthickness = this.itemProtocol.getWthickness(); - tray_qty = this.itemProtocol.getTray_qty(); - tray_high = this.itemProtocol.getTray_high(); - crib_category = this.itemProtocol.getCrib_category(); - palletX1_line = this.itemProtocol.getPalletX1_line(); - palletY1_row = this.itemProtocol.getPalletY1_row(); - palletA1_angle = this.itemProtocol.getPalletA1_angle(); - palletX2_line = this.itemProtocol.getPalletX2_line(); - palletY2_row = this.itemProtocol.getPalletY2_row(); - palletA2_angle = this.itemProtocol.getPalletA2_angle(); - palletX3_line = this.itemProtocol.getPalletX3_line(); - palletY3_row = this.itemProtocol.getPalletY3_row(); - palletA3_angle = this.itemProtocol.getPalletA3_angle(); - pressCribX1_line = this.itemProtocol.getPressCribX1_line(); - pressCribY1_row = this.itemProtocol.getPressCribY1_row(); - pressCribA1_angle = this.itemProtocol.getPressCribA1_angle(); - pressCribX2_line = this.itemProtocol.getPressCribX2_line(); - pressCribY2_row = this.itemProtocol.getPressCribY2_row(); - pressCribA2_angle = this.itemProtocol.getPressCribA2_angle(); - pressCribX3_line = this.itemProtocol.getPressCribX3_line(); - pressCribY3_row = this.itemProtocol.getPressCribY3_row(); - pressCribA3_angle = this.itemProtocol.getPressCribA3_angle(); - Zoffset = this.itemProtocol.getZoffset(); - pallet_layerQty = this.itemProtocol.getPallet_layerQty(); - pressCrib_layerQty = this.itemProtocol.getPressCrib_layerQty(); - codeLayerX1_interval = this.itemProtocol.getCodeLayerX1_interval(); - codeLayerY1_interval = this.itemProtocol.getCodeLayerY1_interval(); - codeLayerX2_interval = this.itemProtocol.getCodeLayerX2_interval(); - codeLayerY2_interval = this.itemProtocol.getCodeLayerY2_interval(); - codeLayerX3_interval = this.itemProtocol.getCodeLayerX3_interval(); - codeLayerY3_interval = this.itemProtocol.getcodeLayerY3_interval(); - codeLayerX1_offset = this.itemProtocol.getCodeLayerX1_offset(); - codeLayerY1_offset = this.itemProtocol.getCodeLayerY1_offset(); - codeLayerX2_offset = this.itemProtocol.getCodeLayerX2_offset(); - codeLayerY2_offset = this.itemProtocol.getCodeLayerY2_offset(); - codeLayerX3_offset = this.itemProtocol.getCodeLayerX3_offset(); - codeLayerY3_offset = this.itemProtocol.getCodeLayerY3_offset(); - pressLayerX1_interval = this.itemProtocol.getPressLayerX1_interval(); - pressLayerY1_interval = this.itemProtocol.getPressLayerY1_interval(); - pressLayerX2_interval = this.itemProtocol.getPressLayerX2_interval(); - pressLayerY2_interval = this.itemProtocol.getPressLayerY2_interval(); - pressLayerX3_interval = this.itemProtocol.getPressLayerX3_interval(); - pressLayerY3_interval = this.itemProtocol.getPressLayerY3_interval(); - pressLayerX1_offset = this.itemProtocol.getPressLayerX1_offset(); - pressLayerY1_offset = this.itemProtocol.getPressLayerY1_offset(); - pressLayerX2_offset = this.itemProtocol.getPressLayerX2_offset(); - pressLayerY2_offset = this.itemProtocol.getPressLayerY2_offset(); - pressLayerX3_offset = this.itemProtocol.getPressLayerX3_offset(); - pressLayerY3_offset = this.itemProtocol.getPressLayerY3_offset(); - one_cribTotal = this.itemProtocol.getOne_cribTotal(); - two_cribTotal = this.itemProtocol.getTwo_cribTotal(); - one_qty = this.itemProtocol.getOne_qty(); - two_qty = this.itemProtocol.getTwo_qty(); - tool_coordinate = this.itemProtocol.getTool_coordinate(); - - if (mode != last_mode) { - this.setRequireSucess(false); - logServer.deviceItemValue(this.device_code,"mode" ,String.valueOf(mode)); - logServer.deviceExecuteLog(this.device_code,"","","信号mode:" + last_mode + "->" + mode); - } - if (status != last_status) { - logServer.deviceItemValue(this.device_code,"status" ,String.valueOf(status)); - logServer.deviceExecuteLog(this.device_code,"","","信号status:" + last_status + "->" + status); - } - if (action != last_action) { - logServer.deviceItemValue(this.device_code,"action" ,String.valueOf(action)); - logServer.deviceExecuteLog(this.device_code,"","","信号action:" + last_action + "->" + action); - } - if (error != last_error) { - logServer.deviceItemValue(this.device_code,"error" ,String.valueOf(error)); - logServer.deviceExecuteLog(this.device_code,"","","信号error:" + last_error + "->" + error); - } - if (put_station != last_put_station) { - logServer.deviceItemValue(this.device_code,"put_station" ,String.valueOf(put_station)); - logServer.deviceExecuteLog(this.device_code,"","","信号put_station:" + last_put_station + "->" + put_station); - } - if (encoder_qty != last_encoder_qty) { - logServer.deviceItemValue(this.device_code,"encoder_qty" ,String.valueOf(encoder_qty)); - logServer.deviceExecuteLog(this.device_code,"","","信号encoder_qty:" + last_encoder_qty + "->" + encoder_qty); - } - if (open_time != last_open_time) { - logServer.deviceItemValue(this.device_code,"open_time" ,String.valueOf(open_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号open_time:" + last_open_time + "->" + open_time); - } - if (standby_time != last_standby_time) { - logServer.deviceItemValue(this.device_code,"standby_time" ,String.valueOf(standby_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号standby_time:" + last_standby_time + "->" + standby_time); - } - if (production_time != last_production_time) { - logServer.deviceItemValue(this.device_code,"production_time" ,String.valueOf(production_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号production_time:" + last_production_time + "->" + production_time); - } - if (error_time != last_error_time) { - logServer.deviceItemValue(this.device_code,"error_time" ,String.valueOf(error_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号error_time:" + last_error_time + "->" + error_time); - } - if (!StrUtil.equals(barcode,last_barcode)) { - logServer.deviceItemValue(this.device_code,"barcode", barcode); - logServer.deviceExecuteLog(this.device_code,"","","信号barcode:" + last_barcode + "->" + barcode); - } - if (!StrUtil.equals(material,last_material)) { - logServer.deviceItemValue(this.device_code,"material", material); - logServer.deviceExecuteLog(this.device_code,"","","信号material:" + last_material + "->" + material); - } - if (product_code != last_product_code) { - logServer.deviceItemValue(this.device_code,"product_code" ,String.valueOf(product_code)); - logServer.deviceExecuteLog(this.device_code,"","","信号product_code:" + last_product_code + "->" + product_code); - } - if (AlongSide != last_AlongSide) { - logServer.deviceItemValue(this.device_code,"AlongSide" ,String.valueOf(AlongSide)); - logServer.deviceExecuteLog(this.device_code,"","","信号AlongSide:" + last_AlongSide + "->" + AlongSide); - } - if (BshortSide != last_BshortSide) { - logServer.deviceItemValue(this.device_code,"BshortSide" ,String.valueOf(BshortSide)); - logServer.deviceExecuteLog(this.device_code,"","","信号BshortSide:" + last_BshortSide + "->" + BshortSide); - } - if (Htrapezoidal != last_Htrapezoidal) { - logServer.deviceItemValue(this.device_code,"Htrapezoidal" ,String.valueOf(Htrapezoidal)); - logServer.deviceExecuteLog(this.device_code,"","","信号Htrapezoidal:" + last_Htrapezoidal + "->" + Htrapezoidal); - } - if (Wthickness != last_Wthickness) { - logServer.deviceItemValue(this.device_code,"Wthickness" ,String.valueOf(Wthickness)); - logServer.deviceExecuteLog(this.device_code,"","","信号Wthickness:" + last_Wthickness + "->" + Wthickness); - } - if (tray_qty != last_tray_qty) { - logServer.deviceItemValue(this.device_code,"tray_qty" ,String.valueOf(tray_qty)); - logServer.deviceExecuteLog(this.device_code,"","","信号tray_qty:" + last_tray_qty + "->" + tray_qty); - } - if (tray_high != last_tray_high) { - logServer.deviceItemValue(this.device_code,"tray_high" ,String.valueOf(tray_high)); - logServer.deviceExecuteLog(this.device_code,"","","信号tray_high:" + last_tray_high + "->" + tray_high); - } - if (crib_category != last_crib_category) { - logServer.deviceItemValue(this.device_code,"crib_category" ,String.valueOf(crib_category)); - logServer.deviceExecuteLog(this.device_code,"","","信号crib_category:" + last_crib_category + "->" + crib_category); - } - if (palletX1_line != last_palletX1_line) { - logServer.deviceItemValue(this.device_code,"palletX1_line" ,String.valueOf(palletX1_line)); - logServer.deviceExecuteLog(this.device_code,"","","信号palletX1_line:" + last_palletX1_line + "->" + palletX1_line); - } - if (palletY1_row != last_palletY1_row) { - logServer.deviceItemValue(this.device_code,"palletY1_row" ,String.valueOf(palletY1_row)); - logServer.deviceExecuteLog(this.device_code,"","","信号palletY1_row:" + last_palletY1_row + "->" + palletY1_row); - } - if (palletA1_angle != last_palletA1_angle) { - logServer.deviceItemValue(this.device_code,"palletA1_angle" ,String.valueOf(palletA1_angle)); - logServer.deviceExecuteLog(this.device_code,"","","信号palletA1_angle:" + last_palletA1_angle + "->" + palletA1_angle); - } - if (palletX2_line != last_palletX2_line) { - logServer.deviceItemValue(this.device_code,"palletX2_line" ,String.valueOf(palletX2_line)); - logServer.deviceExecuteLog(this.device_code,"","","信号palletX2_line:" + last_palletX2_line + "->" + palletX2_line); - } - if (palletY2_row != last_palletY2_row) { - logServer.deviceItemValue(this.device_code,"palletY2_row" ,String.valueOf(palletY2_row)); - logServer.deviceExecuteLog(this.device_code,"","","信号palletY2_row:" + last_palletY2_row + "->" + palletY2_row); - } - if (palletA2_angle != last_palletA2_angle) { - logServer.deviceItemValue(this.device_code,"palletA2_angle" ,String.valueOf(palletA2_angle)); - logServer.deviceExecuteLog(this.device_code,"","","信号palletA2_angle:" + last_palletA2_angle + "->" + palletA2_angle); - } - if (palletX3_line != last_palletX3_line) { - logServer.deviceItemValue(this.device_code,"palletX3_line" ,String.valueOf(palletX3_line)); - logServer.deviceExecuteLog(this.device_code,"","","信号palletX3_line:" + last_palletX3_line + "->" + palletX3_line); - } - if (palletY3_row != last_palletY3_row) { - logServer.deviceItemValue(this.device_code,"palletY3_row" ,String.valueOf(palletY3_row)); - logServer.deviceExecuteLog(this.device_code,"","","信号palletY3_row:" + last_palletY3_row + "->" + palletY3_row); - } - if (palletA3_angle != last_palletA3_angle) { - logServer.deviceItemValue(this.device_code,"palletA3_angle" ,String.valueOf(palletA3_angle)); - logServer.deviceExecuteLog(this.device_code,"","","信号palletA3_angle:" + last_palletA3_angle + "->" + palletA3_angle); - } - if (pressCribX1_line != last_pressCribX1_line) { - logServer.deviceItemValue(this.device_code,"pressCribX1_line" ,String.valueOf(pressCribX1_line)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCribX1_line:" + last_pressCribX1_line + "->" + pressCribX1_line); - } - if (pressCribY1_row != last_pressCribY1_row) { - logServer.deviceItemValue(this.device_code,"pressCribY1_row" ,String.valueOf(pressCribY1_row)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCribY1_row:" + last_pressCribY1_row + "->" + pressCribY1_row); - } - if (pressCribA1_angle != last_pressCribA1_angle) { - logServer.deviceItemValue(this.device_code,"pressCribA1_angle" ,String.valueOf(pressCribA1_angle)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCribA1_angle:" + last_pressCribA1_angle + "->" + pressCribA1_angle); - } - if (pressCribX2_line != last_pressCribX2_line) { - logServer.deviceItemValue(this.device_code,"pressCribX2_line" ,String.valueOf(pressCribX2_line)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCribX2_line:" + last_pressCribX2_line + "->" + pressCribX2_line); - } - if (pressCribY2_row != last_pressCribY2_row) { - logServer.deviceItemValue(this.device_code,"pressCribY2_row" ,String.valueOf(pressCribY2_row)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCribY2_row:" + last_pressCribY2_row + "->" + pressCribY2_row); - } - if (pressCribA2_angle != last_pressCribA2_angle) { - logServer.deviceItemValue(this.device_code,"pressCribA2_angle" ,String.valueOf(pressCribA2_angle)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCribA2_angle:" + last_pressCribA2_angle + "->" + pressCribA2_angle); - } - if (pressCribX3_line != last_pressCribX3_line) { - logServer.deviceItemValue(this.device_code,"pressCribX3_line" ,String.valueOf(pressCribX3_line)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCribX3_line:" + last_pressCribX3_line + "->" + pressCribX3_line); - } - if (pressCribY3_row != last_pressCribY3_row) { - logServer.deviceItemValue(this.device_code,"pressCribY3_row" ,String.valueOf(pressCribY3_row)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCribY3_row:" + last_pressCribY3_row + "->" + pressCribY3_row); - } - if (pressCribA3_angle != last_pressCribA3_angle) { - logServer.deviceItemValue(this.device_code,"pressCribA3_angle" ,String.valueOf(pressCribA3_angle)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCribA3_angle:" + last_pressCribA3_angle + "->" + pressCribA3_angle); - } - if (Zoffset != last_Zoffset) { - logServer.deviceItemValue(this.device_code,"Zoffset" ,String.valueOf(Zoffset)); - logServer.deviceExecuteLog(this.device_code,"","","信号Zoffset:" + last_Zoffset + "->" + Zoffset); - } - if (pallet_layerQty != last_pallet_layerQty) { - logServer.deviceItemValue(this.device_code,"pallet_layerQty" ,String.valueOf(pallet_layerQty)); - logServer.deviceExecuteLog(this.device_code,"","","信号pallet_layerQty:" + last_pallet_layerQty + "->" + pallet_layerQty); - } - if (pressCrib_layerQty != last_pressCrib_layerQty) { - logServer.deviceItemValue(this.device_code,"pressCrib_layerQty" ,String.valueOf(pressCrib_layerQty)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCrib_layerQty:" + last_pressCrib_layerQty + "->" + pressCrib_layerQty); - } - if (codeLayerX1_interval != last_codeLayerX1_interval) { - logServer.deviceItemValue(this.device_code,"codeLayerX1_interval" ,String.valueOf(codeLayerX1_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerX1_interval:" + last_codeLayerX1_interval + "->" + codeLayerX1_interval); - } - if (codeLayerY1_interval != last_codeLayerY1_interval) { - logServer.deviceItemValue(this.device_code,"codeLayerY1_interval" ,String.valueOf(codeLayerY1_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerY1_interval:" + last_codeLayerY1_interval + "->" + codeLayerY1_interval); - } - if (codeLayerX2_interval != last_codeLayerX2_interval) { - logServer.deviceItemValue(this.device_code,"codeLayerX2_interval" ,String.valueOf(codeLayerX2_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerX2_interval:" + last_codeLayerX2_interval + "->" + codeLayerX2_interval); - } - if (codeLayerY2_interval != last_codeLayerY2_interval) { - logServer.deviceItemValue(this.device_code,"codeLayerY2_interval" ,String.valueOf(codeLayerY2_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerY2_interval:" + last_codeLayerY2_interval + "->" + codeLayerY2_interval); - } - if (codeLayerX3_interval != last_codeLayerX3_interval) { - logServer.deviceItemValue(this.device_code,"codeLayerX3_interval" ,String.valueOf(codeLayerX3_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerX3_interval:" + last_codeLayerX3_interval + "->" + codeLayerX3_interval); - } - if (codeLayerY3_interval != last_codeLayerY3_interval) { - logServer.deviceItemValue(this.device_code,"codeLayerY3_interval" ,String.valueOf(codeLayerY3_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerY3_interval:" + last_codeLayerY3_interval + "->" + codeLayerY3_interval); - } - if (codeLayerX1_offset != last_codeLayerX1_offset) { - logServer.deviceItemValue(this.device_code,"codeLayerX1_offset" ,String.valueOf(codeLayerX1_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerX1_offset:" + last_codeLayerX1_offset + "->" + codeLayerX1_offset); - } - if (codeLayerY1_offset != last_codeLayerY1_offset) { - logServer.deviceItemValue(this.device_code,"codeLayerY1_offset" ,String.valueOf(codeLayerY1_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerY1_offset:" + last_codeLayerY1_offset + "->" + codeLayerY1_offset); - } - if (codeLayerX2_offset != last_codeLayerX2_offset) { - logServer.deviceItemValue(this.device_code,"codeLayerX2_offset" ,String.valueOf(codeLayerX2_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerX2_offset:" + last_codeLayerX2_offset + "->" + codeLayerX2_offset); - } - if (codeLayerY2_offset != last_codeLayerY2_offset) { - logServer.deviceItemValue(this.device_code,"codeLayerY2_offset" ,String.valueOf(codeLayerY2_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerY2_offset:" + last_codeLayerY2_offset + "->" + codeLayerY2_offset); - } - if (codeLayerX3_offset != last_codeLayerX3_offset) { - logServer.deviceItemValue(this.device_code,"codeLayerX3_offset" ,String.valueOf(codeLayerX3_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerX3_offset:" + last_codeLayerX3_offset + "->" + codeLayerX3_offset); - } - if (codeLayerY3_offset != last_codeLayerY3_offset) { - logServer.deviceItemValue(this.device_code,"codeLayerY3_offset" ,String.valueOf(codeLayerY3_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerY3_offset:" + last_codeLayerY3_offset + "->" + codeLayerY3_offset); - } - if (pressLayerX1_interval != last_pressLayerX1_interval) { - logServer.deviceItemValue(this.device_code,"pressLayerX1_interval" ,String.valueOf(pressLayerX1_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerX1_interval:" + last_pressLayerX1_interval + "->" + pressLayerX1_interval); - } - if (pressLayerY1_interval != last_pressLayerY1_interval) { - logServer.deviceItemValue(this.device_code,"pressLayerY1_interval" ,String.valueOf(pressLayerY1_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerY1_interval:" + last_pressLayerY1_interval + "->" + pressLayerY1_interval); - } - if (pressLayerX2_interval != last_pressLayerX2_interval) { - logServer.deviceItemValue(this.device_code,"pressLayerX2_interval" ,String.valueOf(pressLayerX2_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerX2_interval:" + last_pressLayerX2_interval + "->" + pressLayerX2_interval); - } - if (pressLayerY2_interval != last_pressLayerY2_interval) { - logServer.deviceItemValue(this.device_code,"pressLayerY2_interval" ,String.valueOf(pressLayerY2_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerY2_interval:" + last_pressLayerY2_interval + "->" + pressLayerY2_interval); - } - if (pressLayerX3_interval != last_pressLayerX3_interval) { - logServer.deviceItemValue(this.device_code,"pressLayerX3_interval" ,String.valueOf(pressLayerX3_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerX3_interval:" + last_pressLayerX3_interval + "->" + pressLayerX3_interval); - } - if (pressLayerY3_interval != last_pressLayerY3_interval) { - logServer.deviceItemValue(this.device_code,"pressLayerY3_interval" ,String.valueOf(pressLayerY3_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerY3_interval:" + last_pressLayerY3_interval + "->" + pressLayerY3_interval); - } - if (pressLayerX1_offset != last_pressLayerX1_offset) { - logServer.deviceItemValue(this.device_code,"pressLayerX1_offset" ,String.valueOf(pressLayerX1_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerX1_offset:" + last_pressLayerX1_offset + "->" + pressLayerX1_offset); - } - if (pressLayerY1_offset != last_pressLayerY1_offset) { - logServer.deviceItemValue(this.device_code,"pressLayerY1_offset" ,String.valueOf(pressLayerY1_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerY1_offset:" + last_pressLayerY1_offset + "->" + pressLayerY1_offset); - } - if (pressLayerX2_offset != last_pressLayerX2_offset) { - logServer.deviceItemValue(this.device_code,"pressLayerX2_offset" ,String.valueOf(pressLayerX2_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerX2_offset:" + last_pressLayerX2_offset + "->" + pressLayerX2_offset); - } - if (pressLayerY2_offset != last_pressLayerY2_offset) { - logServer.deviceItemValue(this.device_code,"pressLayerY2_offset" ,String.valueOf(pressLayerY2_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerY2_offset:" + last_pressLayerY2_offset + "->" + pressLayerY2_offset); - } - if (pressLayerX3_offset != last_pressLayerX3_offset) { - logServer.deviceItemValue(this.device_code,"pressLayerX3_offset" ,String.valueOf(pressLayerX3_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerX3_offset:" + last_pressLayerX3_offset + "->" + pressLayerX3_offset); - } - if (pressLayerY3_offset != last_pressLayerY3_offset) { - logServer.deviceItemValue(this.device_code,"pressLayerY3_offset" ,String.valueOf(pressLayerY3_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerY3_offset:" + last_pressLayerY3_offset + "->" + pressLayerY3_offset); - } - if (one_cribTotal != last_one_cribTotal) { - logServer.deviceItemValue(this.device_code,"one_cribTotal" ,String.valueOf(one_cribTotal)); - logServer.deviceExecuteLog(this.device_code,"","","信号one_cribTotal:" + last_one_cribTotal + "->" + one_cribTotal); - } - if (two_cribTotal != last_two_cribTotal) { - logServer.deviceItemValue(this.device_code,"two_cribTotal" ,String.valueOf(two_cribTotal)); - logServer.deviceExecuteLog(this.device_code,"","","信号two_cribTotal:" + last_two_cribTotal + "->" + two_cribTotal); - } - if (one_qty != last_one_qty) { - logServer.deviceItemValue(this.device_code,"one_qty" ,String.valueOf(one_qty)); - logServer.deviceExecuteLog(this.device_code,"","","信号one_qty:" + last_one_qty + "->" + one_qty); - } - if (two_qty != last_two_qty) { - logServer.deviceItemValue(this.device_code,"two_qty" ,String.valueOf(two_qty)); - logServer.deviceExecuteLog(this.device_code,"","","信号two_qty:" + last_two_qty + "->" + two_qty); - } - if (tool_coordinate != last_tool_coordinate) { - logServer.deviceItemValue(this.device_code,"tool_coordinate" ,String.valueOf(tool_coordinate)); - logServer.deviceExecuteLog(this.device_code,"","","信号tool_coordinate:" + last_tool_coordinate + "->" + tool_coordinate); - } - - } catch (Exception var17) { - return; - } - - 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; - case 3: - break; - case 4: - //获取托盘信息 - if (!requireSucess) { - getVehicle(); - } - break; - case 5: - //码垛完成 - if (!requireSucess) { - palletizing(); - } - break; - case 6: - //码垛强制完成 - if (!requireSucess) { - mandatoryPalletizing(); - } - break; - case 7: - //申请空盘 - if (!requireSucess) { - applyEmpty(); - } - break; - } - - switch (flag) { - //取货完成 - case 1: - writing(2); - return; - //放货完成 - case 2: - writing(3); - return; - - } - - } - last_mode = mode; - last_status = status; - last_action = action; - last_error = error; - last_put_station = put_station; - last_barcode = barcode; - last_material = material; - last_encoder_qty = encoder_qty; - last_open_time = open_time; - last_standby_time = standby_time; - last_production_time = production_time; - last_error_time = error_time; - - last_product_code = product_code; - last_AlongSide = AlongSide; - last_BshortSide = BshortSide; - last_Htrapezoidal = Htrapezoidal; - last_Wthickness = Wthickness; - last_tray_qty = tray_qty; - last_tray_high = tray_high; - last_crib_category = crib_category; - last_palletX1_line = palletX1_line; - last_palletY1_row = palletY1_row; - last_palletA1_angle = palletA1_angle; - last_palletX2_line = palletX2_line; - last_palletY2_row = palletY2_row; - last_palletA2_angle = palletA2_angle; - last_palletX3_line = palletX3_line; - last_palletY3_row = palletY3_row; - last_palletA3_angle = palletA3_angle; - last_pressCribX1_line = pressCribX1_line; - last_pressCribY1_row = pressCribY1_row; - last_pressCribA1_angle = pressCribA1_angle; - last_pressCribX2_line = pressCribX2_line; - last_pressCribY2_row = pressCribY2_row; - last_pressCribA2_angle = pressCribA2_angle; - last_pressCribX3_line = pressCribX3_line; - last_pressCribY3_row = pressCribY3_row; - last_pressCribA3_angle = pressCribA3_angle; - last_Zoffset = Zoffset; - last_pallet_layerQty = pallet_layerQty; - last_pressCrib_layerQty = pressCrib_layerQty; - last_codeLayerX1_interval = codeLayerX1_interval; - last_codeLayerY1_interval = codeLayerY1_interval; - last_codeLayerX2_interval = codeLayerX2_interval; - last_codeLayerY2_interval = codeLayerY2_interval; - last_codeLayerX3_interval = codeLayerX3_interval; - last_codeLayerY3_interval = codeLayerY3_interval; - last_codeLayerX1_offset = codeLayerX1_offset; - last_codeLayerY1_offset = codeLayerY1_offset; - last_codeLayerX2_offset = codeLayerX2_offset; - last_codeLayerY2_offset = codeLayerY2_offset; - last_codeLayerX3_offset = codeLayerX3_offset; - last_codeLayerY3_offset = codeLayerY3_offset; - last_pressLayerX1_interval = pressLayerX1_interval; - last_pressLayerY1_interval = pressLayerY1_interval; - last_pressLayerX2_interval = pressLayerX2_interval; - last_pressLayerY2_interval = pressLayerY2_interval; - last_pressLayerX3_interval = pressLayerX3_interval; - last_pressLayerY3_interval = pressLayerY3_interval; - last_pressLayerX1_offset = pressLayerX1_offset; - last_pressLayerY1_offset = pressLayerY1_offset; - last_pressLayerX2_offset = pressLayerX2_offset; - last_pressLayerY2_offset = pressLayerY2_offset; - last_pressLayerX3_offset = pressLayerX3_offset; - last_pressLayerY3_offset = pressLayerY3_offset; - last_one_cribTotal = one_cribTotal; - last_two_cribTotal = two_cribTotal; - last_one_qty = one_qty; - last_two_qty = two_qty; - last_tool_coordinate = tool_coordinate; - - } - - /** - * 获取托盘信息 - * - * @param - */ - public synchronized boolean getVehicle() { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - JSONObject json = new JSONObject(); - json.put("device_code",this.device_code); - json.put("vehicle_code",barcode); - JSONObject jo = acsToWmsService.getVehicle(json); - - if (jo.getInteger("status") == 200) { - JSONObject content = jo.getJSONObject("content"); - String qty = content.getString("qty"); - String material_code = content.getString("material_code"); - String material_name = content.getString("material_name"); - String product_code = content.getString("product_code"); - String AlongSide = content.getString("AlongSide"); - String BshortSide = content.getString("BshortSide"); - String Htrapezoidal = content.getString("Htrapezoidal"); - String Wthickness = content.getString("Wthickness"); - String tray_qty = content.getString("tray_qty"); - String tray_high = content.getString("tray_high"); - String crib_category = content.getString("crib_category"); - String palletX1_line = content.getString("palletX1_line"); - String palletY1_row = content.getString("palletY1_row"); - String palletA1_angle = content.getString("palletA1_angle"); - String palletX2_line = content.getString("palletX2_line"); - String palletY2_row = content.getString("palletY2_row"); - String palletA2_angle = content.getString("palletA2_angle"); - String palletX3_line = content.getString("palletX3_line"); - String palletY3_row = content.getString("palletY3_row"); - String palletA3_angle = content.getString("palletA3_angle"); - String pressCribX1_line = content.getString("pressCribX1_line"); - String pressCribY1_row = content.getString("pressCribY1_row"); - String pressCribA1_angle = content.getString("pressCribA1_angle"); - String pressCribX2_line = content.getString("pressCribX2_line"); - String pressCribY2_row = content.getString("pressCribY2_row"); - String pressCribA2_angle = content.getString("pressCribA2_angle"); - String pressCribX3_line = content.getString("pressCribX3_line"); - String pressCribY3_row = content.getString("pressCribY3_row"); - String pressCribA3_angle = content.getString("pressCribA3_angle"); - String Zoffset = content.getString("Zoffset"); - String pallet_layerQty = content.getString("pallet_layerQty"); - String pressCrib_layerQty = content.getString("pressCrib_layerQty"); - String codeLayerX1_interval = content.getString("codeLayerX1_interval"); - String codeLayerY1_interval = content.getString("codeLayerY1_interval"); - String codeLayerX2_interval = content.getString("codeLayerX2_interval"); - String codeLayerY2_interval = content.getString("codeLayerY2_interval"); - String codeLayerX3_interval = content.getString("codeLayerX3_interval"); - String codeLayerY3_interval = content.getString("codeLayerY3_interval"); - String codeLayerX1_offset = content.getString("codeLayerX1_offset"); - String codeLayerY1_offset = content.getString("codeLayerY1_offset"); - String codeLayerX2_offset = content.getString("codeLayerX2_offset"); - String codeLayerY2_offset = content.getString("codeLayerY2_offset"); - String codeLayerX3_offset = content.getString("codeLayerX3_offset"); - String codeLayerY3_offset = content.getString("codeLayerY3_offset"); - String pressLayerX1_interval = content.getString("pressLayerX1_interval"); - String pressLayerY1_interval = content.getString("pressLayerY1_interval"); - String pressLayerX2_interval = content.getString("pressLayerX2_interval"); - String pressLayerY2_interval = content.getString("pressLayerY2_interval"); - String pressLayerX3_interval = content.getString("pressLayerX3_interval"); - String pressLayerY3_interval = content.getString("pressLayerY3_interval"); - String pressLayerX1_offset = content.getString("pressLayerX1_offset"); - String pressLayerY1_offset = content.getString("pressLayerY1_offset"); - String pressLayerX2_offset = content.getString("pressLayerX2_offset"); - String pressLayerY2_offset = content.getString("pressLayerY2_offset"); - String pressLayerX3_offset = content.getString("pressLayerX3_offset"); - String pressLayerY3_offset = content.getString("pressLayerY3_offset"); - String one_cribTotal = content.getString("one_cribTotal"); - String two_cribTotal = content.getString("two_cribTotal"); - String one_qty = content.getString("one_qty"); - String two_qty = content.getString("two_qty"); - String tool_coordinate = content.getString("tool_coordinate"); - - this.writing(this.mode); - this.writing("to_materialQty",qty); - this.writing("to_material_code",material_code); - this.writing("to_AlongSide",AlongSide); - this.writing("to_BshortSide",BshortSide); - this.writing("to_Htrapezoidal",Htrapezoidal); - this.writing("to_Wthickness",Wthickness); - this.writing("to_tray_qty",tray_qty); - this.writing("to_tray_high",tray_high); - this.writing("to_crib_category",crib_category); - this.writing("to_palletX1_line",palletX1_line); - this.writing("to_palletY1_row",palletY1_row); - this.writing("to_palletA1_angle",palletA1_angle); - this.writing("to_palletX2_line",palletX2_line); - this.writing("to_palletY2_row",palletY2_row); - this.writing("to_palletA2_angle",palletA2_angle); - this.writing("to_palletX3_line",palletX3_line); - this.writing("to_palletY3_row",palletY3_row); - this.writing("to_palletA3_angle",palletA3_angle); - this.writing("to_pressCribX1_line",pressCribX1_line); - this.writing("to_pressCribY1_row",pressCribY1_row); - this.writing("to_pressCribA1_angle",pressCribA1_angle); - this.writing("to_pressCribX2_line",pressCribX2_line); - this.writing("to_pressCribY2_row",pressCribY2_row); - this.writing("to_pressCribA2_angle",pressCribA2_angle); - this.writing("to_pressCribX3_line",pressCribX3_line); - this.writing("to_pressCribY3_row",pressCribY3_row); - this.writing("to_pressCribA3_angle",pressCribA3_angle); - this.writing("to_Zoffset",Zoffset); - this.writing("to_pallet_layerQty",pallet_layerQty); - this.writing("to_pressCrib_layerQty",pressCrib_layerQty); - this.writing("to_codeLayerX1_interval",codeLayerX1_interval); - this.writing("to_codeLayerY1_interval",codeLayerY1_interval); - this.writing("to_codeLayerX2_interval",codeLayerX2_interval); - this.writing("to_codeLayerY2_interval",codeLayerY2_interval); - this.writing("to_codeLayerX3_interval",codeLayerX3_interval); - this.writing("to_codeLayerY3_interval",codeLayerY3_interval); - this.writing("to_codeLayerX1_offset",codeLayerX1_offset); - this.writing("to_codeLayerY1_offset",codeLayerY1_offset); - this.writing("to_codeLayerX2_offset",codeLayerX2_offset); - this.writing("to_codeLayerY2_offset",codeLayerY2_offset); - this.writing("to_codeLayerX3_offset",codeLayerX3_offset); - this.writing("to_codeLayerY3_offset",codeLayerY3_offset); - this.writing("to_pressLayerX1_interval",pressLayerX1_interval); - this.writing("to_pressLayerY1_interval",pressLayerY1_interval); - this.writing("to_pressLayerX2_interval",pressLayerX2_interval); - this.writing("to_pressLayerY2_interval",pressLayerY2_interval); - this.writing("to_pressLayerX3_interval",pressLayerX3_interval); - this.writing("to_pressLayerY3_interval",pressLayerY3_interval); - this.writing("to_pressLayerX1_offset",pressLayerX1_offset); - this.writing("to_pressLayerY1_offset",pressLayerY1_offset); - this.writing("to_pressLayerX2_offset",pressLayerX2_offset); - this.writing("to_pressLayerY2_offset",pressLayerY2_offset); - this.writing("to_pressLayerX3_offset",pressLayerX3_offset); - this.writing("to_pressLayerY3_offset",pressLayerY3_offset); - this.writing("to_one_cribTotal",one_cribTotal); - this.writing("to_two_cribTotal",two_cribTotal); - this.writing("to_one_qty",one_qty); - this.writing("to_two_qty",two_qty); - this.writing("to_tool_coordinate",tool_coordinate); - requireSucess = true; - - } - return true; - } - } - - /** - * 码垛完成 - * - * @param - */ - public synchronized boolean palletizing() { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - JSONObject json = new JSONObject(); - String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code"); - String demosub = linkobj.substring(1,linkobj.length()-1); - String demoArray[] = demosub.split(","); - List demoList = Arrays.asList(demoArray); - json.put("device_code",demoList.get(put_station-1).replace("\"","")); - json.put("qty",encoder_qty); - json.put("vehicle_code",barcode); - json.put("is_full","1"); - json.put("product_code",product_code); - json.put("AlongSide",AlongSide); - json.put("BshortSide",BshortSide); - json.put("Htrapezoidal",Htrapezoidal); - json.put("Wthickness",Wthickness); - json.put("tray_qty",tray_qty); - json.put("tray_high",tray_high); - json.put("crib_category",crib_category); - json.put("palletX1_line",palletX1_line); - json.put("palletY1_row",palletY1_row); - json.put("palletA1_angle",palletA1_angle); - json.put("palletX2_line",palletX2_line); - json.put("palletY2_row",palletY2_row); - json.put("palletA2_angle",palletA2_angle); - json.put("palletX3_line",palletX3_line); - json.put("palletY3_row",palletY3_row); - json.put("palletA3_angle",palletA3_angle); - json.put("pressCribX1_line",pressCribX1_line); - json.put("pressCribY1_row",pressCribY1_row); - json.put("pressCribA1_angle",pressCribA1_angle); - json.put("pressCribX2_line",pressCribX2_line); - json.put("pressCribY2_row",pressCribY2_row); - json.put("pressCribA2_angle",pressCribA2_angle); - json.put("pressCribX3_line",pressCribX3_line); - json.put("pressCribY3_row",pressCribY3_row); - json.put("pressCribA3_angle",pressCribA3_angle); - json.put("Zoffset",Zoffset); - json.put("pallet_layerQty",pallet_layerQty); - json.put("pressCrib_layerQty",pressCrib_layerQty); - json.put("codeLayerX1_interval",codeLayerX1_interval); - json.put("codeLayerY1_interval",codeLayerY1_interval); - json.put("codeLayerX2_interval",codeLayerX2_interval); - json.put("codeLayerY2_interval",codeLayerY2_interval); - json.put("codeLayerX3_interval",codeLayerX3_interval); - json.put("codeLayerY3_interval",codeLayerY3_interval); - json.put("codeLayerX1_offset",codeLayerX1_offset); - json.put("codeLayerY1_offset",codeLayerY1_offset); - json.put("codeLayerX2_offset",codeLayerX2_offset); - json.put("codeLayerY2_offset",codeLayerY2_offset); - json.put("codeLayerX3_offset",codeLayerX3_offset); - json.put("codeLayerY3_offset",codeLayerY3_offset); - json.put("pressLayerX1_interval",pressLayerX1_interval); - json.put("pressLayerY1_interval",pressLayerY1_interval); - json.put("pressLayerX2_interval",pressLayerX2_interval); - json.put("pressLayerY2_interval",pressLayerY2_interval); - json.put("pressLayerX3_interval",pressLayerX3_interval); - json.put("pressLayerY3_interval",pressLayerY3_interval); - json.put("pressLayerX1_offset",pressLayerX1_offset); - json.put("pressLayerY1_offset",pressLayerY1_offset); - json.put("pressLayerX2_offset",pressLayerX2_offset); - json.put("pressLayerY2_offset",pressLayerY2_offset); - json.put("pressLayerX3_offset",pressLayerX3_offset); - json.put("pressLayerY3_offset",pressLayerY3_offset); - json.put("one_cribTotal",one_cribTotal); - json.put("two_cribTotal",two_cribTotal); - json.put("one_qty",one_qty); - json.put("two_qty",two_qty); - json.put("tool_coordinate",tool_coordinate); - - HttpResponse result = acsToWmsService.applyTaskManipulatorToWms(json); - if (result.getStatus() == 200) { - this.writing(this.mode); - requireSucess = true; - } - return true; - } - } - - /** - * 码垛强制完成 - * - * @param - */ - public synchronized boolean mandatoryPalletizing() { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - JSONObject json = new JSONObject(); - json.put("device_code",this.device_code); - json.put("qty",encoder_qty); - json.put("vehicle_code",barcode); - json.put("is_full","0"); - json.put("product_code",product_code); - json.put("AlongSide",AlongSide); - json.put("BshortSide",BshortSide); - json.put("Htrapezoidal",Htrapezoidal); - json.put("Wthickness",Wthickness); - json.put("tray_qty",tray_qty); - json.put("tray_high",tray_high); - json.put("crib_category",crib_category); - json.put("palletX1_line",palletX1_line); - json.put("palletY1_row",palletY1_row); - json.put("palletA1_angle",palletA1_angle); - json.put("palletX2_line",palletX2_line); - json.put("palletY2_row",palletY2_row); - json.put("palletA2_angle",palletA2_angle); - json.put("palletX3_line",palletX3_line); - json.put("palletY3_row",palletY3_row); - json.put("palletA3_angle",palletA3_angle); - json.put("pressCribX1_line",pressCribX1_line); - json.put("pressCribY1_row",pressCribY1_row); - json.put("pressCribA1_angle",pressCribA1_angle); - json.put("pressCribX2_line",pressCribX2_line); - json.put("pressCribY2_row",pressCribY2_row); - json.put("pressCribA2_angle",pressCribA2_angle); - json.put("pressCribX3_line",pressCribX3_line); - json.put("pressCribY3_row",pressCribY3_row); - json.put("pressCribA3_angle",pressCribA3_angle); - json.put("Zoffset",Zoffset); - json.put("pallet_layerQty",pallet_layerQty); - json.put("pressCrib_layerQty",pressCrib_layerQty); - json.put("codeLayerX1_interval",codeLayerX1_interval); - json.put("codeLayerY1_interval",codeLayerY1_interval); - json.put("codeLayerX2_interval",codeLayerX2_interval); - json.put("codeLayerY2_interval",codeLayerY2_interval); - json.put("codeLayerX3_interval",codeLayerX3_interval); - json.put("codeLayerY3_interval",codeLayerY3_interval); - json.put("codeLayerX1_offset",codeLayerX1_offset); - json.put("codeLayerY1_offset",codeLayerY1_offset); - json.put("codeLayerX2_offset",codeLayerX2_offset); - json.put("codeLayerY2_offset",codeLayerY2_offset); - json.put("codeLayerX3_offset",codeLayerX3_offset); - json.put("codeLayerY3_offset",codeLayerY3_offset); - json.put("pressLayerX1_interval",pressLayerX1_interval); - json.put("pressLayerY1_interval",pressLayerY1_interval); - json.put("pressLayerX2_interval",pressLayerX2_interval); - json.put("pressLayerY2_interval",pressLayerY2_interval); - json.put("pressLayerX3_interval",pressLayerX3_interval); - json.put("pressLayerY3_interval",pressLayerY3_interval); - json.put("pressLayerX1_offset",pressLayerX1_offset); - json.put("pressLayerY1_offset",pressLayerY1_offset); - json.put("pressLayerX2_offset",pressLayerX2_offset); - json.put("pressLayerY2_offset",pressLayerY2_offset); - json.put("pressLayerX3_offset",pressLayerX3_offset); - json.put("pressLayerY3_offset",pressLayerY3_offset); - json.put("one_cribTotal",one_cribTotal); - json.put("two_cribTotal",two_cribTotal); - json.put("one_qty",one_qty); - json.put("two_qty",two_qty); - json.put("tool_coordinate",tool_coordinate); - - HttpResponse result = acsToWmsService.applyTaskManipulatorToWms(json); - if (result.getStatus() == 200) { - this.writing(this.mode); - requireSucess = true; - - } - return true; - } - } - - /** - * 申请空盘 - * - * @param - */ - public synchronized boolean applyEmpty() { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - JSONObject json = new JSONObject(); - String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code"); - String demosub = linkobj.substring(1,linkobj.length()-1); - String demoArray[] = demosub.split(","); - List demoList = Arrays.asList(demoArray); - json.put("device_code",demoList.get(put_station-1).replace("\"","")); - json.put("type","4"); - json.put("qty",encoder_qty); - json.put("vehicle_code",barcode); - HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); - if (result.getStatus() == 200) { - this.writing(this.mode); - requireSucess = true; - } - - return true; - } - } - - public boolean exe_error() { - if (this.error == 0) { - return true; - } else { - log.debug("设备报警"); - return false; - } - } - - public boolean exe_business() { - return true; - } - - public void writing(String param, String value) { - - String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + param; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - - itemMap.put(to_param, value); -// itemMap.put(to_param, Integer.parseInt(value)); - ReadUtil.write(itemMap, server); - } - - public void executing(Server server, Map itemMap) { - ReadUtil.write(itemMap, server); - } - - public void writing(int command) { - - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - ReadUtil.write(itemMap, server); - - } - - public void writing(int type, int command) { - String to_material_code = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_material_code; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - if (type == 2) { - itemMap.put(to_material_code, command); - - } - ReadUtil.write(itemMap, server); - - } - -} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/ItemProtocol.java deleted file mode 100644 index b04f516..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/ItemProtocol.java +++ /dev/null @@ -1,256 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator_site; - -import cn.hutool.core.util.StrUtil; -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_ioaction = "ioaction"; - public static String item_error = "error"; - public static String item_task = "task"; - public static String item_weight = "weight"; - public static String item_material = "material"; - public static String item_barcode = "barcode"; - public static String item_specifications = "specifications"; - public static String item_batch = "batch"; - public static String item_AlongSide = "AlongSide"; - public static String item_BshortSide = "BshortSide"; - public static String item_Htrapezoidal = "Htrapezoidal"; - public static String item_Wthickness = "Wthickness"; - public static String item_status = "status"; - public static String item_unqualified_qty = "unqualified_qty"; - public static String item_encoder_qty = "encoder_qty"; - public static String item_order_No = "order_No"; - public static String item_order_qty = "order_qty"; - - 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_to_barcode = "to_barcode"; - public static String item_to_error = "to_error"; - public static String item_to_allow_pallet_qty = "to_allow_pallet_qty"; - public static String item_to_material_type = "to_material_type"; - public static String item_to_material_code = "to_material_code"; - public static String item_to_order_No = "to_order_No"; - public static String item_to_product_code = "to_product_code"; - public static String item_to_order_qty = "to_order_qty"; - - - Boolean isonline; - - private LnshPalletizingManipulatorSiteDeviceDriver driver; - - public ItemProtocol(LnshPalletizingManipulatorSiteDeviceDriver 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 getIoAction() { - return this.getOpcIntegerValue(item_ioaction); - } - - public int getError() { - return this.getOpcIntegerValue(item_error); - } - - public int getTask() { - return this.getOpcIntegerValue(item_task); - } - - public int getWeight() { - return this.getOpcIntegerValue(item_weight); - } - - public String getMaterial() { - return this.getOpcStringValue(item_material); - } - - public String getBarcode() { - return this.getOpcStringValue(item_barcode); - } - - public String getSpecifications() { - return this.getOpcStringValue(item_specifications); - } - - public int getBatch() { - return this.getOpcIntegerValue(item_batch); - } - - public int getAlongSide() { - return this.getOpcIntegerValue(item_AlongSide); - } - - public int getBshortSide() { - return this.getOpcIntegerValue(item_BshortSide); - } - - public int getHtrapezoidal() { - return this.getOpcIntegerValue(item_Htrapezoidal); - } - - public int getWthickness() { - return this.getOpcIntegerValue(item_Wthickness); - } - - public int getStatus() { - return this.getOpcIntegerValue(item_status); - } - - public int getEncoder_qty() { - return this.getOpcIntegerValue(item_encoder_qty); - } - - public int getUnqualified_qty() { - return this.getOpcIntegerValue(item_unqualified_qty); - } - - public int getOrder_qty() { - return this.getOpcIntegerValue(item_order_qty); - } - - public String getOrder_No() { - return this.getOpcStringValue(item_order_No); - } - - 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 getTo_barcode() { - return this.getOpcIntegerValue(item_to_barcode); - } - - public int getTo_error() { - return this.getOpcIntegerValue(item_to_error); - } - - public int getTo_allow_pallet_qty() { - return this.getOpcIntegerValue(item_to_allow_pallet_qty); - } - - public int getTo_material_type() { - return this.getOpcIntegerValue(item_to_material_type); - } - - public int getTo_material_code() { - return this.getOpcIntegerValue(item_to_material_code); - } - - public String getTo_order_No() { - return this.getOpcStringValue(item_to_order_No); - } - - public int getTo_Product_code() { - return this.getOpcIntegerValue(item_to_product_code); - } - - public int getTo_order_qty() { - return this.getOpcIntegerValue(item_to_order_qty); - } - - //是否有货 - public int hasGoods(int move) { - return move; - } - - - 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 String getOpcStringValue(String protocol) { - String value = this.driver.getStringValue(protocol); - if (StrUtil.isEmpty(value)) { - - } else { - return value; - } - return ""; - } - - public static List getReadableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_heartbeat, "心跳", "DB112.B0")); - list.add(new ItemDto(item_mode, "工作状态", "DB112.B1", Boolean.valueOf(true))); - list.add(new ItemDto(item_move, "光电开关信号", "DB112.B2")); - list.add(new ItemDto(item_action, "取放信号", "DB112.B3")); - list.add(new ItemDto(item_ioaction, "进出信号", "DB112.B4")); - list.add(new ItemDto(item_error, "报警信号", "DB112.B5")); - list.add(new ItemDto(item_task, "任务号", "DB112.D6")); - list.add(new ItemDto(item_weight, "重量", "DB112.D10")); - list.add(new ItemDto(item_batch, "批次", "DB112.D14")); - list.add(new ItemDto(item_specifications, "规格", "DB112.S18")); - list.add(new ItemDto(item_material, "物料", "DB112.S274")); - list.add(new ItemDto(item_barcode, "条码", "DB112.S530")); - list.add(new ItemDto(item_AlongSide, "A长边", "DB112.W786")); - list.add(new ItemDto(item_BshortSide, "B短边", "DB112.W788")); - list.add(new ItemDto(item_Htrapezoidal, "H梯形高", "DB112.W790")); - list.add(new ItemDto(item_Wthickness, "W厚度", "DB112.W792")); - list.add(new ItemDto(item_status, "设备状态", "DB112.B795")); - list.add(new ItemDto(item_unqualified_qty, "不合格数量", "DB112.D796")); - list.add(new ItemDto(item_encoder_qty, "码盘位当前码盘数量", "DB112.D800")); - list.add(new ItemDto(item_order_qty, "当前工单数量", "DB112.D804")); - list.add(new ItemDto(item_order_No, "工单号", "DB112.S808")); - return list; - } - - public static List getWriteableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_command, "作业命令", "DB113.W0", Boolean.valueOf(true))); - list.add(new ItemDto(item_to_target, "目标站", "DB113.W2")); - list.add(new ItemDto(item_to_task, "任务号", "DB113.D4")); - list.add(new ItemDto(item_to_barcode, "条码", "DB113.S8")); - list.add(new ItemDto(item_to_error, "故障代码", "DB113.B265")); - list.add(new ItemDto(item_to_allow_pallet_qty, "允许码垛数量", "DB113.W266")); - list.add(new ItemDto(item_to_material_type, "托盘类型", "DB113.D268")); - list.add(new ItemDto(item_to_material_code, "下发物料编号", "DB113.D272")); - list.add(new ItemDto(item_to_order_qty, "下发工单数量", "DB113.D276")); - list.add(new ItemDto(item_to_product_code, "产品编号", "DB113.D280")); - list.add(new ItemDto(item_to_order_No, "工单号", "DB113.S284")); - return list; - } - -} - diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/LnshPalletizingManipulatorSiteDefination.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/LnshPalletizingManipulatorSiteDefination.java deleted file mode 100644 index 7d74837..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/LnshPalletizingManipulatorSiteDefination.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator_site; - -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 LnshPalletizingManipulatorSiteDefination implements OpcDeviceDriverDefination { - @Override - public String getDriverCode() { - return "lnsh_palletizing_manipulator_site"; - } - - @Override - public String getDriverName() { - return "嘉耐-码垛机械手工位"; - } - - @Override - public String getDriverDescription() { - return "嘉耐-码垛机械手工位"; - } - - @Override - public DeviceDriver getDriverInstance(Device device) { - return (new LnshPalletizingManipulatorSiteDeviceDriver()).setDevice(device).setDriverDefination(this); - - } - - @Override - public Class getDeviceDriverType() { - return LnshPalletizingManipulatorSiteDeviceDriver.class; - } - - @Override - public List getFitDeviceTypes() { - List types = new LinkedList(); - types.add(DeviceType.station); - return types; - } - - @Override - public List getReadableItemDtos() { - return getReadableItemDtos2(); - } - - public static List getReadableItemDtos2() { - List list = new ArrayList(); - list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB112.B0")); - list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB112.B1", Boolean.valueOf(true))); - list.add(new ItemDto(ItemProtocol.item_move, "光电开关信号", "DB112.B2")); - list.add(new ItemDto(ItemProtocol.item_action, "取放信号", "DB112.B3")); - list.add(new ItemDto(ItemProtocol.item_ioaction, "进出信号", "DB112.B4")); - list.add(new ItemDto(ItemProtocol.item_error, "报警信号", "DB112.B5")); - list.add(new ItemDto(ItemProtocol.item_task, "任务号", "DB112.D6")); - list.add(new ItemDto(ItemProtocol.item_weight, "重量", "DB112.D10")); - list.add(new ItemDto(ItemProtocol.item_batch, "批次", "DB112.D14")); - list.add(new ItemDto(ItemProtocol.item_specifications, "规格", "DB112.S18")); - list.add(new ItemDto(ItemProtocol.item_material, "物料", "DB112.S274")); - list.add(new ItemDto(ItemProtocol.item_barcode, "条码", "DB112.S530")); - list.add(new ItemDto(ItemProtocol.item_AlongSide, "A长边", "DB112.W786")); - list.add(new ItemDto(ItemProtocol.item_BshortSide, "B短边", "DB112.W788")); - list.add(new ItemDto(ItemProtocol.item_Htrapezoidal, "H梯形高", "DB112.W790")); - list.add(new ItemDto(ItemProtocol.item_Wthickness, "W厚度", "DB112.W792")); - list.add(new ItemDto(ItemProtocol.item_status, "设备状态", "DB112.B795")); - list.add(new ItemDto(ItemProtocol.item_unqualified_qty, "不合格数量", "DB112.D796")); - list.add(new ItemDto(ItemProtocol.item_encoder_qty, "码盘位当前码盘数量", "DB112.D800")); - list.add(new ItemDto(ItemProtocol.item_order_qty, "当前工单数量", "DB112.D804")); - list.add(new ItemDto(ItemProtocol.item_order_No, "工单号", "DB112.S808")); - return list; - } - - @Override - public List getWriteableItemDtos() { - return ItemProtocol.getWriteableItemDtos(); - } - -} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/LnshPalletizingManipulatorSiteDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/LnshPalletizingManipulatorSiteDeviceDriver.java deleted file mode 100644 index 8b51941..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/LnshPalletizingManipulatorSiteDeviceDriver.java +++ /dev/null @@ -1,717 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator_site; - -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -import cn.hutool.http.HttpResponse; -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.ext.wms.service.AcsToWmsService; -import org.nl.acs.instruction.service.InstructionService; -import org.nl.acs.instruction.service.dto.Instruction; -import org.nl.acs.log.service.DeviceExecuteLogService; -import org.nl.acs.monitor.DeviceStageMonitor; -import org.nl.acs.opc.Device; -import org.nl.acs.order.service.ProduceshiftorderService; -import org.nl.acs.order.service.dto.ProduceshiftorderDto; -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.*; - -/** - * 嘉耐-码垛机械手工位 - */ -@Slf4j -@Data -@RequiredArgsConstructor -public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor { - 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 - DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); - @Autowired - AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl"); - @Autowired - ProduceshiftorderService produceshiftorderService = SpringContextHolder.getBean("produceshiftorderServiceImpl"); - - String device_code; - int mode = 0; - int error = 0; - int move = 0; - int action; - int io_action; - int task = 0; - int last_mode = 0; - int last_error = 0; - int last_move = 0; - int last_task = 0; - int last_action = 0; - int last_ioaction = 0; - Boolean isonline = true; - int hasGoods = 0; - Boolean iserror = false; - - protected int instruction_num = 0; - protected int instruction_num_truth = 0; - Integer heartbeat_tag; - private Date instruction_require_time = new Date(); - private Date instruction_finished_time = new Date(); - - private int instruction_require_time_out = 3000; - boolean requireSucess = false; - - private int instruction_finished_time_out; - - int heartbeat; - int last_heartbeat; - private Date checkHeartbeattime = new Date(); - private Date last_checkHeartbeattime = new Date(); - - - int branchProtocol = 0; - //当前指令 - Instruction inst = null; - //上次指令 - Instruction last_inst = null; - - //触摸屏手动触发任务 - private Boolean is_has_task = false; - - //暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域 - int flag; - - String message; - int weight = 0; - int last_weight = 0; - String material; - String last_material; - String barcode; - String last_barcode; - String specifications = ""; - String last_specifications = ""; - int AlongSide = 0; - int last_AlongSide = 0; - int BshortSide = 0; - int last_BshortSide = 0; - int Htrapezoidal = 0; - int last_Htrapezoidal = 0; - int Wthickness = 0; - int last_Wthickness = 0; - int batch = 0; - int last_batch = 0; - - int status = 0; - int last_status = 0; - - int unqualified_qty = 0; - int last_unqualified_qty = 0; - int encoder_qty = 0; - int last_encoder_qty = 0; - int order_qty = 0; - int last_order_qty = 0; - - String order_No = ""; - String last_order_No = ""; - - @Override - public Device getDevice() { - return this.device; - } - - - @Override - public void execute() throws Exception { - String message = null; - try { - device_code = this.getDeviceCode(); - - mode = this.itemProtocol.getMode(); - error = this.itemProtocol.getError(); - move = this.itemProtocol.getMove(); - task = this.itemProtocol.getTask(); - hasGoods = this.itemProtocol.getMove(); - io_action = this.itemProtocol.getIoAction(); - action = this.itemProtocol.getAction(); - weight = this.itemProtocol.getWeight(); - material = this.itemProtocol.getMaterial(); - barcode = this.itemProtocol.getBarcode(); - batch = this.itemProtocol.getBatch(); - specifications = this.itemProtocol.getSpecifications(); - AlongSide = this.itemProtocol.getAlongSide(); - BshortSide = this.itemProtocol.getBshortSide(); - Htrapezoidal = this.itemProtocol.getHtrapezoidal(); - Wthickness = this.itemProtocol.getWthickness(); - order_qty = this.itemProtocol.getOrder_qty(); - order_No = this.itemProtocol.getOrder_No(); - encoder_qty = this.itemProtocol.getEncoder_qty(); - status = this.itemProtocol.getStatus(); - unqualified_qty = this.itemProtocol.getUnqualified_qty(); - - if (mode != last_mode) { - this.setRequireSucess(false); - logServer.deviceItemValue(this.device_code,"mode" ,String.valueOf(mode)); - logServer.deviceExecuteLog(this.device_code,"","","信号mode:" + last_mode + "->" + mode); - } - if (move != last_move) { - logServer.deviceItemValue(this.device_code,"move" ,String.valueOf(move)); - logServer.deviceExecuteLog(this.device_code,"","","信号move:" + last_move + "->" + move); - } - if (error != last_error) { - logServer.deviceItemValue(this.device_code,"error" ,String.valueOf(error)); - logServer.deviceExecuteLog(this.device_code,"","","信号error:" + last_error + "->" + error); - } - if (task != last_task) { - logServer.deviceItemValue(this.device_code,"task",String.valueOf(task)); - logServer.deviceExecuteLog(this.device_code,"","","信号task:" + last_task + "->" + task); - } - if (action != last_action) { - logServer.deviceItemValue(this.device_code,"action",String.valueOf(action)); - logServer.deviceExecuteLog(this.device_code,"","","信号action:" + last_action + "->" + action); - } - if (io_action != last_ioaction) { - logServer.deviceItemValue(this.device_code,"io_action",String.valueOf(io_action)); - logServer.deviceExecuteLog(this.device_code,"","","信号io_action: " + last_ioaction + "->" + io_action); - } - if (weight != last_weight) { - logServer.deviceItemValue(this.device_code,"weight",String.valueOf(weight)); - logServer.deviceExecuteLog(this.device_code,"","","信号weight: " + last_weight + "->" + weight); - } - if (batch != last_batch) { - logServer.deviceItemValue(this.device_code,"batch",String.valueOf(batch)); - logServer.deviceExecuteLog(this.device_code,"","","信号batch: " + last_batch + "->" + batch); - } - if (!StrUtil.equals(material,last_material)) { - logServer.deviceItemValue(this.device_code,"material", material); - logServer.deviceExecuteLog(this.device_code,"","","信号material:" + last_material + "->" + material); - } - if (!StrUtil.equals(barcode,last_barcode)) { - logServer.deviceItemValue(this.device_code,"barcode", barcode); - logServer.deviceExecuteLog(this.device_code,"","","信号barcode:" + last_barcode + "->" + barcode); - } - if (!StrUtil.equals(specifications,last_specifications)) { - logServer.deviceItemValue(this.device_code,"specifications", specifications); - logServer.deviceExecuteLog(this.device_code,"","","信号specifications:" + last_specifications + "->" + specifications); - } - if (AlongSide != last_AlongSide) { - logServer.deviceItemValue(this.device_code,"AlongSide",String.valueOf(AlongSide)); - logServer.deviceExecuteLog(this.device_code,"","","信号AlongSide: " + last_AlongSide + "->" + AlongSide); - } - if (BshortSide != last_BshortSide) { - logServer.deviceItemValue(this.device_code,"BshortSide",String.valueOf(BshortSide)); - logServer.deviceExecuteLog(this.device_code,"","","信号BshortSide: " + last_BshortSide + "->" + BshortSide); - } - if (Htrapezoidal != last_Htrapezoidal) { - logServer.deviceItemValue(this.device_code,"Htrapezoidal",String.valueOf(Htrapezoidal)); - logServer.deviceExecuteLog(this.device_code,"","","信号Htrapezoidal: " + last_Htrapezoidal + "->" + Htrapezoidal); - } - if (Wthickness != last_Wthickness) { - logServer.deviceItemValue(this.device_code,"Wthickness",String.valueOf(Wthickness)); - logServer.deviceExecuteLog(this.device_code,"","","信号Wthickness: " + last_Wthickness + "->" + Wthickness); - } - if (status != last_status) { - logServer.deviceItemValue(this.device_code,"status" ,String.valueOf(status)); - logServer.deviceExecuteLog(this.device_code,"","","信号status:" + last_status + "->" + status); - } - if (encoder_qty != last_encoder_qty) { - logServer.deviceItemValue(this.device_code,"encoder_qty" ,String.valueOf(encoder_qty)); - logServer.deviceExecuteLog(this.device_code,"","","信号encoder_qty:" + last_encoder_qty + "->" + encoder_qty); - } - if (!StrUtil.equals(order_No,last_order_No)) { - logServer.deviceItemValue(this.device_code,"order_No", order_No); - logServer.deviceExecuteLog(this.device_code,"","","信号order_No:" + last_order_No + "->" + order_No); - } - if (order_qty != last_order_qty) { - logServer.deviceItemValue(this.device_code,"order_qty" ,String.valueOf(order_qty)); - logServer.deviceExecuteLog(this.device_code,"","","信号order_qty:" + last_order_qty + "->" + order_qty); - } - if (unqualified_qty != last_unqualified_qty) { - logServer.deviceItemValue(this.device_code,"unqualified_qty" ,String.valueOf(unqualified_qty)); - logServer.deviceExecuteLog(this.device_code,"","","信号unqualified_qty:" + last_unqualified_qty + "->" + unqualified_qty); - } - - } catch (Exception var17) { - return; - } - - //急停 - if (this.isStop()) { - - //未在线无心跳 - } else 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("设备运转模式:等待工作"); - break; - case 2: - break; - case 4: - //排产单确认 - if (!requireSucess && !order_No.equals("0")) { - JSONObject json = new JSONObject(); - json.put("producetask_code",order_No); - json.put("device_code",this.device_code); - json.put("material_code",material); - json.put("qty",encoder_qty); - json.put("type","1"); - enterProduction(json); - } - break; - case 5: - //申请空盘 - if (!requireSucess && this.move == 0) { - applyEmpty(); - } - break; - case 6: - //申请入库 - if (!requireSucess && this.move != 0) { - putStorage(); - } - break; - case 7: - //码垛完成 - if (!requireSucess) { - palletizing(); - } - break; - case 8: - //码垛强制完成 - if (!requireSucess) { - mandatoryPalletizing(); - } - break; - case 9: - //工单完成 - if (!requireSucess && !order_No.equals("0")) { - JSONObject json = new JSONObject(); - json.put("producetask_code",order_No); - json.put("device_code",this.device_code); - json.put("material_code",material); - json.put("qty",encoder_qty); - json.put("type","2"); - enterProduction(json); - } - break; - - } - - switch (flag) { - //取货完成 - case 2: - writing(2); - return; - //放货完成 - case 4: - writing(3); - return; - } - } - - last_mode = mode; - last_error = error; - last_move = move; - last_task = task; - last_action = action; - last_ioaction = io_action; - last_weight = weight; - last_material = material; - last_barcode = barcode; - last_specifications = specifications; - last_batch = batch; - last_AlongSide = AlongSide; - last_BshortSide = BshortSide; - last_Htrapezoidal = Htrapezoidal; - last_Wthickness = Wthickness; - last_order_No = order_No; - last_order_qty = order_qty; - last_encoder_qty = encoder_qty; - last_status = status; - last_unqualified_qty = unqualified_qty; - } - - - /** - * 申请空盘 - * - * @param - */ - public synchronized boolean applyEmpty() { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - JSONObject json = new JSONObject(); - json.put("device_code",this.device_code); - json.put("type","4"); - json.put("vehicle_code",barcode); - HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); - if (ObjectUtil.isNotEmpty(result)) { - JSONObject jsonObject = JSONObject.parseObject(result.body()); - if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) { - this.writing(this.mode); - this.setRequireSucess(true); - } - } - return true; - } - } - - /** - * 排产单确认 - * - * @param - */ - public synchronized boolean enterProduction(JSONObject json) { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - HttpResponse result = acsToWmsService.enterOrder(json); - if (ObjectUtil.isNotEmpty(result)) { - JSONObject jsonObject = JSONObject.parseObject(result.body()); - if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) { - ProduceshiftorderDto dto = produceshiftorderService.findByCode(order_No); - if (this.mode == 4) { - dto.setOrder_status("1"); - } else if (this.mode == 9) { - dto.setOrder_status("2"); - } - produceshiftorderService.update(dto); - this.writing(this.mode); - this.setRequireSucess(true); - } - } - return true; - } - } - - /** - * 码垛完成 - * - * @param - */ - public synchronized boolean palletizing() { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - JSONObject json = new JSONObject(); -// String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code"); -// String demosub = linkobj.substring(1,linkobj.length()-1); -// String demoArray[] = demosub.split(","); -// List demoList = Arrays.asList(demoArray); - json.put("device_code",this.device_code); - json.put("material_code",material); - json.put("qty",encoder_qty); - json.put("batch",batch); - json.put("producetask_code",order_No); - json.put("is_full","1"); - HttpResponse result = acsToWmsService.applyTaskManipulatorToWms(json); - if (ObjectUtil.isNotEmpty(result)) { - JSONObject jsonObject = JSONObject.parseObject(result.body()); - if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) { - this.writing(this.mode); - this.setRequireSucess(true); - } - } - return true; - } - } - - /** - * 码垛强制完成 - * - * @param - */ - public synchronized boolean mandatoryPalletizing() { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - JSONObject json = new JSONObject(); -// String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code"); -// String demosub = linkobj.substring(1,linkobj.length()-1); -// String demoArray[] = demosub.split(","); -// List demoList = Arrays.asList(demoArray); - json.put("device_code",this.device_code); - json.put("material_code",material); - json.put("qty",encoder_qty); - json.put("batch",batch); - json.put("producetask_code",order_No); - json.put("is_full","1"); - - HttpResponse result = acsToWmsService.applyTaskManipulatorToWms(json); - if (ObjectUtil.isNotEmpty(result)) { - JSONObject jsonObject = JSONObject.parseObject(result.body()); - if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) { - this.writing(this.mode); - this.setRequireSucess(true); - } - } - return true; - } - } - - /** - * 申请入库 - * - * @param - */ - public synchronized boolean putStorage() { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - JSONObject json = new JSONObject(); - json.put("device_code",this.device_code); - json.put("type","1"); - json.put("material_code",material); - json.put("vehicle_code",barcode); - json.put("qty",encoder_qty); - json.put("is_full","1"); - HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); - if (ObjectUtil.isNotEmpty(result)) { - JSONObject jsonObject = JSONObject.parseObject(result.body()); - if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) { - this.writing(this.mode); - this.setRequireSucess(true); - } - } - return true; - } - } - - - - - public boolean exe_error() { - if (this.error == 0) { - return true; - } else { - log.debug("设备报警"); - return false; - } - } - - public boolean exe_business() { - return true; - } - - protected void executing(Instruction instruction) { - this.executing(1, instruction, ""); - } - - public void executing(int command, Instruction instruction, String appendMessage) { - String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_command; - String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_target; - String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_task; - if (appendMessage == null) { - appendMessage = ""; - } - if (instruction != null) { - instruction_num = Integer.parseInt(instruction.getInstruction_code()); - } - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(to_command, 1); - itemMap.put(to_task, instruction_num); - ReadUtil.write(itemMap, server); - - } - - public void executing(Server server, Map itemMap) { - 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 itemMap = new HashMap(); - 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); - - } - - 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 itemMap = new HashMap(); - itemMap.put(to_command, command); - ReadUtil.write(itemMap, server); - } - - public synchronized void OpenOrClose(String type) { - - //进入区域 - if ("1".equals(type)) { - writing(5); - } else { - //离开区域 - writing(6); - } - } - - public String toString() { - return ""; - } - - @Override - public JSONObject getDeviceStatusName() { - JSONObject jo = new JSONObject(); - String mode = ""; - String action = ""; - String io_action = ""; - String move = ""; - String status = ""; - if (this.getMode() == 0) { - mode = "未联机"; - } else if (this.getMode() == 1) { - mode = "单机"; - } else if (this.getMode() == 2) { - mode = "联机"; - } else if (this.getMode() == 4) { - mode = "人工排产确认"; - } else if (this.getMode() == 5) { - mode = "申请空盘"; - } else if (this.getMode() == 6) { - mode = "申请入库"; - } else if (this.getMode() == 7) { - mode = "码垛完成"; - } else if (this.getMode() == 8) { - mode = "码垛强制完成"; - } else if (this.getMode() == 9) { - mode = "工单完成"; - } - - if (this.getAction() == 0) { - action = "禁止取放"; - } else if (this.getAction() == 1) { - action = "允许取货"; - } else if (this.getAction() == 2) { - action = "允许放货"; - } else if (this.getAction() == 3) { - action = "允许取放"; - } - if (this.getIo_action() == 0) { - io_action = "禁止进出"; - } else if (this.getIo_action() == 1) { - io_action = "允许进入"; - } else if (this.getIo_action() == 2) { - io_action = "允许离开"; - } else if (this.getIo_action() == 3) { - io_action = "允许进出"; - } - - if (this.getStatus() == 1) { - status = "待机"; - } else if (this.getStatus() == 2) { - status = "生产中"; - } else if (this.getStatus() == 3) { - status = "故障"; - } - - if (this.getMove() == 0) { - move = "无货"; - } else if (this.getMove() == 1) { - move = "有货"; - } else if (this.getMove() == 2) { - move = "有托盘有货"; - } - jo.put("device_name", this.getDevice().getDevice_name()); - jo.put("mode", mode); - jo.put("move", move); - jo.put("action", action); - jo.put("status", status); - jo.put("io_action", io_action); - jo.put("hasGoods", this.getHasGoods()); - jo.put("isOnline", this.getIsonline()); - jo.put("error", this.getError()); - jo.put("isError", this.getIserror()); - jo.put("message", this.getMessage()); - jo.put("task", this.getTask()); - jo.put("weight", this.getWeight()); - jo.put("material", this.getMaterial()); - jo.put("barcode", this.getBarcode()); - jo.put("specifications", this.getSpecifications()); - jo.put("AlongSide", this.getAlongSide()); - jo.put("BshortSide", this.getBshortSide()); - jo.put("Htrapezoidal", this.getHtrapezoidal()); - jo.put("Wthickness", this.getWthickness()); - jo.put("batch", this.getBatch()); - jo.put("order_No", this.getOrder_No()); - jo.put("order_qty", this.getOrder_qty()); - return jo; - } - - @Override - public void setDeviceStatus(JSONObject data) { - - } -} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_press/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_press/ItemProtocol.java deleted file mode 100644 index cac4883..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_press/ItemProtocol.java +++ /dev/null @@ -1,176 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_press; - -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_status = "status"; - public static String item_error = "error"; - public static String item_open_time = "open_time"; - public static String item_standby_time = "standby_time"; - public static String item_production_time = "production_time"; - public static String item_error_time = "error_time"; - public static String item_material = "material"; - public static String item_qty = "qty"; - public static String item_weight = "weight"; - public static String item_qualified = "qualified"; - public static String item_unqualified = "unqualified"; - public static String item_order_No = "order_No"; - public static String item_to_command = "to_command"; - public static String item_to_error = "to_error"; - public static String item_to_order_No = "to_order_No"; - public static String item_to_qty = "to_qty"; - public static String item_to_material_code = "to_material_code"; - - - private LnshPressDeviceDriver driver; - - public ItemProtocol(LnshPressDeviceDriver driver) { - this.driver = driver; - } - - public int getHeartbeat() { - return this.getOpcIntegerValue(item_heartbeat); - } - - public int getStatus() { - return this.getOpcIntegerValue(item_status); - } - - public int getMode() { - return this.getOpcIntegerValue(item_mode); - } - - public int getError() { - return this.getOpcIntegerValue(item_error); - } - - public int getOpen_time() { - return this.getOpcIntegerValue(item_open_time); - } - - public int getStandby_time() { - return this.getOpcIntegerValue(item_standby_time); - } - - public int getProduction_time() { - return this.getOpcIntegerValue(item_production_time); - } - - public int getError_time() { - return this.getOpcIntegerValue(item_error_time); - } - - public String getMaterial() { - return this.getOpcStringValue(item_material); - } - - public int getQty() { - return this.getOpcIntegerValue(item_qty); - } - - public int getWeight() { - return this.getOpcIntegerValue(item_weight); - } - - public int getQualified() { - return this.getOpcIntegerValue(item_qualified); - } - - public int getUnqualified() { - return this.getOpcIntegerValue(item_unqualified); - } - - public String getOrder_No() { - return this.getOpcStringValue(item_order_No); - } - - public int getTo_command() { - return this.getOpcIntegerValue(item_to_command); - } - - public int getTo_error() { - return this.getOpcIntegerValue(item_to_error); - } - - public String getTo_order_No() { - return this.getOpcStringValue(item_to_order_No); - } - - public int getTo_qty() { - return this.getOpcIntegerValue(item_to_qty); - } - - public String getTo_material_code() { - return this.getOpcStringValue(item_to_material_code); - } - - //是否有货 - 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 String getOpcStringValue(String protocol) { - String value = this.driver.getStringValue(protocol); - if (value == null) { -// log.error("读取错误!"); - } else { - return value; - } - return "0"; - } - - public static List getReadableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_heartbeat, "心跳", "DB8.B0")); - list.add(new ItemDto(item_mode, "工作状态", "DB8.B1", Boolean.valueOf(true))); - list.add(new ItemDto(item_status, "设备状态", "DB8.B2")); - list.add(new ItemDto(item_error, "故障", "DB8.B3")); - list.add(new ItemDto(item_open_time, "开机时间", "DB8.D4")); - list.add(new ItemDto(item_standby_time, "待机时间", "DB8.D8")); - list.add(new ItemDto(item_production_time, "生产时间", "DB8.D12")); - list.add(new ItemDto(item_error_time, "故障时间", "DB8.D16")); - list.add(new ItemDto(item_material, "当前生产物料", "DB8.S20")); - list.add(new ItemDto(item_qty, "当前已生产数量", "DB8.D276")); - list.add(new ItemDto(item_weight, "当前已生产重量", "DB8.D280")); - list.add(new ItemDto(item_qualified, "当前已生产合格数", "DB8.D284")); - list.add(new ItemDto(item_unqualified, "当前已生产不合格数", "DB8.D288")); - list.add(new ItemDto(item_order_No, "工单号", "DB8.S292")); - return list; - } - - public static List getWriteableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_command, "反馈", "DB9.W0", Boolean.valueOf(true))); - list.add(new ItemDto(item_to_error, "error", "DB9.W2")); - list.add(new ItemDto(item_to_order_No, "工单号", "DB9.S4")); - list.add(new ItemDto(item_to_qty, "生产重量", "DB9.D260")); - list.add(new ItemDto(item_to_material_code, "下发物料编号", "DB9.S264")); - return list; - } - -} - diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_press/LnshPressDefination.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_press/LnshPressDefination.java deleted file mode 100644 index db1223d..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_press/LnshPressDefination.java +++ /dev/null @@ -1,82 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_press; - -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 LnshPressDefination implements OpcDeviceDriverDefination { - @Override - public String getDriverCode() { - return "lnsh_press"; - } - - @Override - public String getDriverName() { - return "晟华-压力机"; - } - - @Override - public String getDriverDescription() { - return "晟华-压力机"; - } - - @Override - public DeviceDriver getDriverInstance(Device device) { - return (new LnshPressDeviceDriver()).setDevice(device).setDriverDefination(this); - - } - - @Override - public Class getDeviceDriverType() { - return LnshPressDeviceDriver.class; - } - - @Override - public List getFitDeviceTypes() { - List types = new LinkedList(); - types.add(DeviceType.station); - return types; - } - - @Override - public List getReadableItemDtos() { - return getReadableItemDtos2(); - } - - public static List getReadableItemDtos2() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB8.B0")); - list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB8.B1", Boolean.valueOf(true))); - list.add(new ItemDto(ItemProtocol.item_status, "设备状态", "DB8.B2")); - list.add(new ItemDto(ItemProtocol.item_error, "故障", "DB8.B3")); - list.add(new ItemDto(ItemProtocol.item_open_time, "开机时间", "DB8.D4")); - list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "DB8.D8")); - list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "DB8.D12")); - list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "DB8.D16")); - list.add(new ItemDto(ItemProtocol.item_material, "当前生产物料", "DB8.S20")); - list.add(new ItemDto(ItemProtocol.item_qty, "当前已生产数量", "DB8.D276")); - list.add(new ItemDto(ItemProtocol.item_weight, "当前已生产重量", "DB8.D280")); - list.add(new ItemDto(ItemProtocol.item_qualified, "当前已生产合格数", "DB8.D284")); - list.add(new ItemDto(ItemProtocol.item_unqualified, "当前已生产不合格数", "DB8.D288")); - list.add(new ItemDto(ItemProtocol.item_order_No, "工单号", "DB8.S292")); - return list; - } - - @Override - public List getWriteableItemDtos() { - return ItemProtocol.getWriteableItemDtos(); - } - -} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_press/LnshPressDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_press/LnshPressDeviceDriver.java deleted file mode 100644 index a8a7cf4..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_press/LnshPressDeviceDriver.java +++ /dev/null @@ -1,387 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_press; - -import cn.hutool.core.date.DateUtil; -import cn.hutool.core.util.IdUtil; -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -import cn.hutool.http.HttpResponse; -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.ext.wms.service.AcsToWmsService; -import org.nl.acs.instruction.service.InstructionService; -import org.nl.acs.instruction.service.dto.Instruction; -import org.nl.acs.log.service.DeviceExecuteLogService; - -import org.nl.acs.opc.Device; -import org.nl.acs.opc.WcsConfig; -import org.nl.acs.order.service.ProduceshiftorderService; -import org.nl.acs.order.service.dto.ProduceshiftorderDto; -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.lang.reflect.Field; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * 晟华压力机 - */ -@Slf4j -@Data -@RequiredArgsConstructor -public class LnshPressDeviceDriver 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 - DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); - @Autowired - AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl"); - @Autowired - ProduceshiftorderService produceshiftorderService = SpringContextHolder.getBean("produceshiftorderServiceImpl"); - - //放货准备锁 - String putReadyLock = null; - //有货标记 - protected boolean has_goods_tag = false; - - int mode = 0; - int error = 0; - int last_mode = 0; - int last_error = 0; - Boolean isonline = true; - int hasGoods = 0; - String message = null; - Boolean iserror = false; - - 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; - - //暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域 - int flag; - - String device_code; - int status = 0; - int last_status = 0; - - int open_time = 0; - int last_open_time = 0; - int standby_time = 0; - int last_standby_time = 0; - int production_time = 0; - int last_production_time = 0; - int error_time = 0; - int last_error_time = 0; - String material; - String last_material; - int qty = 0; - int last_qty = 0; - int weight = 0; - int last_weight = 0; - int qualified = 0; - int last_qualified = 0; - int unqualified = 0; - int last_unqualified = 0; - String order_No = "0"; - String last_order_No = "0"; - - @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(); - status = this.itemProtocol.getStatus(); - open_time = this.itemProtocol.getOpen_time(); - standby_time = this.itemProtocol.getStandby_time(); - production_time = this.itemProtocol.getProduction_time(); - error_time = this.itemProtocol.getError_time(); - weight = this.itemProtocol.getWeight(); - order_No = this.itemProtocol.getOrder_No(); - qualified = this.itemProtocol.getQualified(); - unqualified = this.itemProtocol.getUnqualified(); - qty = this.itemProtocol.getQty(); - material = this.itemProtocol.getMaterial(); - - if (mode != last_mode) { - this.setRequireSucess(false); - logServer.deviceItemValue(this.device_code,"mode" ,String.valueOf(mode)); - logServer.deviceExecuteLog(this.device_code,"","","信号mode:" + last_mode + "->" + mode); - } - if (error != last_error) { - logServer.deviceItemValue(this.device_code,"error" ,String.valueOf(error)); - logServer.deviceExecuteLog(this.device_code,"","","信号error:" + last_error + "->" + error); - } - if (status != last_status) { - logServer.deviceItemValue(this.device_code,"status" ,String.valueOf(status)); - logServer.deviceExecuteLog(this.device_code,"","","信号status:" + last_status + "->" + status); - } - if (open_time != last_open_time) { - logServer.deviceItemValue(this.device_code,"open_time" ,String.valueOf(open_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号open_time:" + last_open_time + "->" + open_time); - } - if (standby_time != last_standby_time) { - logServer.deviceItemValue(this.device_code,"standby_time" ,String.valueOf(standby_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号standby_time:" + last_standby_time + "->" + standby_time); - } - if (production_time != last_production_time) { - logServer.deviceItemValue(this.device_code,"production_time" ,String.valueOf(production_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号production_time:" + last_production_time + "->" + production_time); - } - if (error_time != last_error_time) { - logServer.deviceItemValue(this.device_code,"error_time" ,String.valueOf(error_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号error_time:" + last_error_time + "->" + error_time); - } - if (weight != last_weight) { - logServer.deviceItemValue(this.device_code,"weight" ,String.valueOf(weight)); - logServer.deviceExecuteLog(this.device_code,"","","信号weight:" + last_weight + "->" + weight); - } - if (!StrUtil.equals(material,last_material)) { - logServer.deviceItemValue(this.device_code,"material" ,material); - logServer.deviceExecuteLog(this.device_code,"","","信号material:" + last_material + "->" + material); - } - if (qty != last_qty) { - logServer.deviceItemValue(this.device_code,"qty" ,String.valueOf(qty)); - logServer.deviceExecuteLog(this.device_code,"","","信号qty:" + last_qty + "->" + qty); - } - if (qualified != last_qualified) { - logServer.deviceItemValue(this.device_code,"qualified" ,String.valueOf(qualified)); - logServer.deviceExecuteLog(this.device_code,"","","信号qualified:" + last_qualified + "->" + qualified); - } - if (unqualified != last_unqualified) { - logServer.deviceItemValue(this.device_code,"unqualified" ,String.valueOf(unqualified)); - logServer.deviceExecuteLog(this.device_code,"","","信号unqualified:" + last_unqualified + "->" + unqualified); - } - if (!StrUtil.equals(order_No,last_order_No)) { - logServer.deviceItemValue(this.device_code,"order_No" ,order_No); - logServer.deviceExecuteLog(this.device_code,"","","信号order_No:" + last_order_No + "->" + order_No); - } - - } catch (Exception var17) { - return; - } - - //未联机 - 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; - case 3: - //排产单确认 - if (!requireSucess && !order_No.equals("0")) { - JSONObject json = new JSONObject(); - json.put("producetask_code",order_No); - json.put("device_code",this.device_code); - json.put("material_code",material); - json.put("weight",weight); - json.put("qty",qualified); - json.put("type","1"); - enterProduction(json); - } - break; - case 4: - //工单完成反馈 - if (!requireSucess && !order_No.equals("0")) { - JSONObject json = new JSONObject(); - json.put("producetask_code",order_No); - json.put("device_code",this.device_code); - json.put("material_code",material); - json.put("weight",weight); - json.put("qty",qualified); - json.put("type","2"); - enterProduction(json); - } - break; - } - - switch (flag) { - //取货完成 - case 1: - writing(2); - return; - //放货完成 - case 2: - writing(3); - return; - - } - - } - last_mode = mode; - last_status = status; - last_error = error; - last_open_time = open_time; - last_standby_time = standby_time; - last_production_time = production_time; - last_error_time = error_time; - last_material = material; - last_qty = qty; - last_weight = weight; - last_qualified = qualified; - last_unqualified = unqualified; - last_order_No = order_No; - } - - - public boolean exe_error() { - if (this.error == 0) { - return true; - } else { - log.debug("设备报警"); - return false; - } - } - - /** - * 排产单确认 - * - * @param - */ - public synchronized boolean enterProduction(JSONObject json) { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - HttpResponse result = acsToWmsService.enterOrder(json); - if (ObjectUtil.isNotEmpty(result)) { - JSONObject jsonObject = JSONObject.parseObject(result.body()); - if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) { - ProduceshiftorderDto dto = produceshiftorderService.findByCode(order_No); - if (this.mode == 3) { - dto.setOrder_status("1"); - } else if (this.mode == 4) { - dto.setOrder_status("2"); - } - produceshiftorderService.update(dto); - this.writing(this.mode); - this.setRequireSucess(true); - } - } - return true; - } - } - - public boolean exe_business() { - return true; - } - - protected void executing(Instruction instruction) { - this.executing(1, instruction, ""); - } - - public void executing(int command, Instruction instruction, String appendMessage) { - String to_material_code = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_material_code; - if (appendMessage == null) { - appendMessage = ""; - } - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - ReadUtil.write(itemMap, server); - - } - - public void writing(String param, String value) { - - String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + param; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(to_param, value); - - ReadUtil.write(itemMap, server); - } - - public void executing(Server server, Map 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() - + "." + org.nl.acs.device_driver.lnsh.lnsh_fold_disc_site.ItemProtocol.item_to_command; - - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(to_command, command); - ReadUtil.write(itemMap, server); - - } - - public static Boolean isExistFieldName(String fieldName, Object obj) throws NoSuchFieldException { - if (obj == null || StrUtil.isEmpty(fieldName)) { - return null; - } - //获取这个类的所有属性 - Field[] fields = obj.getClass().getDeclaredFields(); - boolean flag = false; - //循环遍历所有的fields - for (int i = 0; i < fields.length; i++) { - if (fields[i].getName().equals("item_" + fieldName)) { - flag = true; - break; - } - } - return flag; - } - -} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_rgv/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_rgv/ItemProtocol.java deleted file mode 100644 index e1c0203..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_rgv/ItemProtocol.java +++ /dev/null @@ -1,193 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_rgv; - -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_status = "status"; - public static String item_move_1 = "move_1"; - public static String item_move_2 = "move_2"; - public static String item_action_1 = "action_1"; - public static String item_action_2 = "action_2"; - public static String item_walk_y = "walk_y"; - public static String item_error = "error"; - public static String item_task1 = "task1"; - public static String item_task2 = "task2"; - public static String item_open_time = "open_time"; - public static String item_standby_time = "standby_time"; - public static String item_production_time = "production_time"; - public static String item_error_time = "error_time"; - - public static String item_to_command1 = "to_command1"; - public static String item_to_onset1 = "to_onset1"; - public static String item_to_target1 = "to_target1"; - public static String item_to_task1 = "to_task1"; - public static String item_to_command2 = "to_command2"; - public static String item_to_task2 = "to_task2"; - public static String item_to_onset2 = "to_onset2"; - public static String item_to_target2 = "to_target2"; - - - private LnshRGVDeviceDriver driver; - - public ItemProtocol(LnshRGVDeviceDriver driver) { - this.driver = driver; - } - - public int getHeartbeat() { - return this.getOpcIntegerValue(item_heartbeat); - } - - public int getMode() { - return this.getOpcIntegerValue(item_mode); - } - - public int getStatus() { - return this.getOpcIntegerValue(item_status); - } - - public int getError() { - return this.getOpcIntegerValue(item_error); - } - - public int getOpen_time() { - return this.getOpcIntegerValue(item_open_time); - } - - public int getStandby_time() { - return this.getOpcIntegerValue(item_standby_time); - } - - public int getProduction_time() { - return this.getOpcIntegerValue(item_production_time); - } - - public int getError_time() { - return this.getOpcIntegerValue(item_error_time); - } - - public int getMove_1() { - return this.getOpcIntegerValue(item_move_1); - } - - public int getMove_2() { - return this.getOpcIntegerValue(item_move_2); - } - - public int getAction_1() { - return this.getOpcIntegerValue(item_action_1); - } - - public int getAction_2() { - return this.getOpcIntegerValue(item_action_2); - } - - public int getWalk_y() { - return this.getOpcIntegerValue(item_walk_y); - } - - public int getTask1() { - return this.getOpcIntegerValue(item_task1); - } - - public int getTask2() { - return this.getOpcIntegerValue(item_task2); - } - - public int getTo_command1() { - return this.getOpcIntegerValue(item_to_command1); - } - - public int getTo_onset1() { - return this.getOpcIntegerValue(item_to_onset1); - } - - public int getTo_onset2() { - return this.getOpcIntegerValue(item_to_onset2); - } - - public int getTo_target1() { - return this.getOpcIntegerValue(item_to_target1); - } - - public int getTo_target2() { - return this.getOpcIntegerValue(item_to_target2); - } - - public int getTo_command2() { - return this.getOpcIntegerValue(item_to_command2); - } - - public int getTo_task1() { - return this.getOpcIntegerValue(item_to_task1); - } - - public int getTo_task2() { - return this.getOpcIntegerValue(item_to_task2); - } - - - //是否有货 - 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 getReadableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_heartbeat, "心跳", "DB1.B0")); - list.add(new ItemDto(item_mode, "工作状态", "DB1.B1", Boolean.valueOf(true))); - list.add(new ItemDto(item_status, "设备状态", "DB1.B2")); - list.add(new ItemDto(item_move_1, "前工位光电信号", "DB1.B3")); - list.add(new ItemDto(item_move_2, "后工位光电信号", "DB1.B4")); - list.add(new ItemDto(item_action_1, "前工位动作信号", "DB1.B5")); - list.add(new ItemDto(item_action_2, "后工位动作信号", "DB1.B6")); - list.add(new ItemDto(item_walk_y, "行走列", "DB1.B7")); - list.add(new ItemDto(item_error, "车体报警", "DB1.B8")); - list.add(new ItemDto(item_task1, "前工位任务号", "DB1.D10")); - list.add(new ItemDto(item_task2, "后工位任务号", "DB1.D14")); - list.add(new ItemDto(item_open_time, "开机时间", "DB1.D18")); - list.add(new ItemDto(item_standby_time, "待机时间", "DB1.D22")); - list.add(new ItemDto(item_production_time, "生产时间", "DB1.D26")); - list.add(new ItemDto(item_error_time, "故障时间", "DB1.D30")); - return list; - } - - public static List getWriteableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_command1, "前工位下发命令", "DB51.W0")); - list.add(new ItemDto(item_to_onset1, "下发起始站", "DB51.W2")); - list.add(new ItemDto(item_to_target1, "下发目标站", "DB51.W4")); - list.add(new ItemDto(item_to_task1, "下发任务号", "DB51.D6")); - list.add(new ItemDto(item_to_command2, "后工位下发命令", "DB51.W10")); - list.add(new ItemDto(item_to_onset2, "下发起始站2", "DB51.W12")); - list.add(new ItemDto(item_to_target2, "下发目标站2", "DB51.W14")); - list.add(new ItemDto(item_to_task2, "下发任务号2", "DB51.D16")); - return list; - } - -} - diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_rgv/LnshRGVDefination.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_rgv/LnshRGVDefination.java deleted file mode 100644 index f019ec2..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_rgv/LnshRGVDefination.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_rgv; - -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; - -/** - * 晟华RGV - * - */ -@Service -public class LnshRGVDefination implements OpcDeviceDriverDefination { - @Override - public String getDriverCode() { - return "lnsh_rgv"; - } - - @Override - public String getDriverName() { - return "晟华-RGV"; - } - - @Override - public String getDriverDescription() { - return "晟华-RGV"; - } - - @Override - public DeviceDriver getDriverInstance(Device device) { - return (new LnshRGVDeviceDriver()).setDevice(device).setDriverDefination(this); - - } - - @Override - public Class getDeviceDriverType() { - return LnshRGVDeviceDriver.class; - } - - @Override - public List getFitDeviceTypes() { - List types = new LinkedList(); - types.add(DeviceType.station); - return types; - } - - @Override - public List getReadableItemDtos() { - return getReadableItemDtos2(); - } - - public static List getReadableItemDtos2() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB1.B0")); - list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB1.B1", Boolean.valueOf(true))); - list.add(new ItemDto(ItemProtocol.item_status, "设备状态", "DB1.B2")); - list.add(new ItemDto(ItemProtocol.item_move_1, "前工位光电信号", "DB1.B3")); - list.add(new ItemDto(ItemProtocol.item_move_2, "后工位光电信号", "DB1.B4")); - list.add(new ItemDto(ItemProtocol.item_action_1, "前工位动作信号", "DB1.B5")); - list.add(new ItemDto(ItemProtocol.item_action_2, "后工位动作信号", "DB1.B6")); - list.add(new ItemDto(ItemProtocol.item_walk_y, "行走列", "DB1.B7")); - list.add(new ItemDto(ItemProtocol.item_error, "车体报警", "DB1.B8")); - list.add(new ItemDto(ItemProtocol.item_task1, "前工位任务号", "DB1.D10")); - list.add(new ItemDto(ItemProtocol.item_task2, "后工位任务号", "DB1.D14")); - list.add(new ItemDto(ItemProtocol.item_open_time, "开机时间", "DB1.D18")); - list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "DB1.D22")); - list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "DB1.D26")); - list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "DB1.D30")); - return list; - } - - @Override - public List getWriteableItemDtos() { - return ItemProtocol.getWriteableItemDtos(); - } - -} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_rgv/LnshRGVDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_rgv/LnshRGVDeviceDriver.java deleted file mode 100644 index 84c9a87..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_rgv/LnshRGVDeviceDriver.java +++ /dev/null @@ -1,567 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_rgv; - -import cn.hutool.core.date.DateUtil; -import cn.hutool.core.util.IdUtil; -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -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.DeviceExecuteLogService; - -import org.nl.acs.opc.Device; -import org.nl.acs.opc.DeviceAppService; -import org.nl.acs.opc.DeviceAppServiceImpl; -import org.nl.acs.route.service.RouteLineService; -import org.nl.acs.task.service.TaskService; -import org.nl.acs.task.service.dto.TaskDto; -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.*; - -/** - * 晟华RGV - */ -@Slf4j -@Data -@RequiredArgsConstructor -public class LnshRGVDeviceDriver 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 - DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); - @Autowired - DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); - @Autowired - DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppServiceImpl.class); - - //当前指令1 - Instruction inst1 = null; - //当前指令2 - Instruction inst2 = null; - - int mode = 0; - int error = 0; - int last_mode = 0; - int last_error = 0; - Boolean isonline = true; - Boolean requireSucess = false; - int hasGoods = 0; - String message = null; - Boolean iserror = false; - - private Date instruction_require_time = new Date(); - private Date instruction_finished_time = new Date(); - private Date instruction_apply_time = new Date(); - private int instruction_require_time_out = 3000; - - int branchProtocol = 0; - - //暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域 - int flag; - - Boolean requireSucess1 = false; - Boolean requireSucess2 = false; - - String device_code; - int status = 0; - int last_status = 0; - int move_1 = 0; - int last_move_1 = 0; - int move_2 = 0; - int last_move_2 = 0; - int action_1 = 0; - int last_action_1 = 0; - int action_2 = 0; - int last_action_2 = 0; - int walk_y = 0; - int last_walk_y = 0; - int task1 = 0; - int last_task1 = 0; - int task2 = 0; - int last_task2 = 0; - //开机时间 - int open_time = 0; - int last_open_time = 0; - //待机时间 - int standby_time = 0; - int last_standby_time = 0; - //生产时间 - int production_time = 0; - int last_production_time = 0; - //故障时间 - int error_time = 0; - int last_error_time = 0; - - @Override - public Device getDevice() { - return this.device; - } - - - @Override - public void execute() throws Exception { - String message = null; - try { - device_code = this.getDeviceCode(); - mode = this.itemProtocol.getMode(); - status = this.itemProtocol.getStatus(); - move_1 = this.itemProtocol.getMove_1(); - move_2 = this.itemProtocol.getMove_2(); - action_1 = this.itemProtocol.getAction_1(); - action_2 = this.itemProtocol.getAction_2(); - walk_y = this.itemProtocol.getWalk_y(); - error = this.itemProtocol.getError(); - task1 = this.itemProtocol.getTask1(); - task2 = this.itemProtocol.getTask2(); - open_time = this.itemProtocol.getOpen_time(); - standby_time = this.itemProtocol.getStandby_time(); - production_time = this.itemProtocol.getProduction_time(); - error_time = this.itemProtocol.getError_time(); - - if (mode != last_mode) { - this.setRequireSucess(false); - logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode); - } - if (error != last_error) { - logServer.deviceItemValue(this.device_code, "error", String.valueOf(error)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号error:" + last_error + "->" + error); - } - if (status != last_status) { - logServer.deviceItemValue(this.device_code, "status", String.valueOf(status)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号status:" + last_status + "->" + status); - } - if (move_1 != last_move_1) { - logServer.deviceItemValue(this.device_code, "move_1", String.valueOf(move_1)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号move_1:" + last_move_1 + "->" + move_1); - } - if (move_2 != last_move_2) { - logServer.deviceItemValue(this.device_code, "move_2", String.valueOf(move_2)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号move_2:" + last_move_2 + "->" + move_2); - } - if (action_1 != last_action_1) { - logServer.deviceItemValue(this.device_code, "action_1", String.valueOf(action_1)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号action_1:" + last_action_1 + "->" + action_1); - } - if (action_2 != last_action_2) { - logServer.deviceItemValue(this.device_code, "action_2", String.valueOf(action_2)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号action_2:" + last_action_2 + "->" + action_2); - } - if (walk_y != last_walk_y) { - logServer.deviceItemValue(this.device_code, "walk_y", String.valueOf(walk_y)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号walk_y:" + last_walk_y + "->" + walk_y); - } - if (task1 != last_task1) { - logServer.deviceItemValue(this.device_code, "task1", String.valueOf(task1)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号task1:" + last_task1 + "->" + task1); - } - if (task2 != last_task2) { - logServer.deviceItemValue(this.device_code, "task2", String.valueOf(task2)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号task2:" + last_task2 + "->" + task2); - } - if (open_time != last_open_time) { - logServer.deviceItemValue(this.device_code, "open_time", String.valueOf(open_time)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号open_time:" + last_open_time + "->" + open_time); - } - if (standby_time != last_standby_time) { - logServer.deviceItemValue(this.device_code, "standby_time", String.valueOf(standby_time)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号standby_time:" + last_standby_time + "->" + standby_time); - } - if (production_time != last_production_time) { - logServer.deviceItemValue(this.device_code, "production_time", String.valueOf(production_time)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号production_time:" + last_production_time + "->" + production_time); - } - if (error_time != last_error_time) { - logServer.deviceItemValue(this.device_code, "error_time", String.valueOf(error_time)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号error_time:" + last_error_time + "->" + error_time); - } - - } catch (Exception var17) { - return; - } - - if (task1 > 0) { - //inst_message - inst1 = instructionService.findByCodeFromCache(String.valueOf(task1)); - if (inst1 != null) { - if (StrUtil.equals(inst1.getInstruction_status(), "0")) { - inst1.setInstruction_status("1"); - instructionService.update(inst1); - } - } - } - if (action_1 == 4 && move_1 == 0 && task1 > 0) { - //inst_message - inst1 = instructionService.findByCodeFromCache(String.valueOf(task1)); - if (inst1 != null) { - if (StrUtil.equals(inst1.getInstruction_status(), "1")) { - finish_instruction(inst1); - } - } - } - - if (task2 > 0) { - //inst_message - inst2 = instructionService.findByCodeFromCache(String.valueOf(task2)); - if (inst2 != null) { - if (StrUtil.equals(inst2.getInstruction_status(), "0")) { - inst2.setInstruction_status("1"); - instructionService.update(inst2); - } - } - } - if (action_2 == 4 && move_2 == 0 && task2 > 0) { - //inst_message - inst2 = instructionService.findByCodeFromCache(String.valueOf(task2)); - if (inst2 != null) { - if (StrUtil.equals(inst2.getInstruction_status(), "1")) { - finish_instruction(inst2); - } - } - } - - //给后工位下发空盘放货信号 - if (mode == 3 && action_1 == 2 && action_2 == 2 && move_1 == 1 && move_2 == 1 && task1 > 0 && task2 > 0) { - writing("to_command2", "2"); - } - - - //给前工位下发放货信号 - if (mode == 3 && action_2 == 4 && move_1 == 1 && move_2 == 0 && task1 > 0) { - writing("to_command1", "2"); - } - - 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: - //后工位申请任务 - if (mode == 2 && move_2 == 0 && action_2 == 0 && !requireSucess2) { - instruction_require2(); - } - break; - case 3: - //前工位申请任务 - if (mode == 3 && move_2 == 1 && action_2 == 1 && move_1 == 0 && !requireSucess1) { - instruction_require(); - } - } - - switch (flag) { - //取货完成 - case 1: - writing1(2); - return; - //放货完成 - case 2: - writing1(3); - return; - - } - } - last_mode = mode; - last_error = error; - last_status = status; - last_move_1 = move_1; - last_move_2 = move_2; - last_action_1 = action_1; - last_action_2 = action_2; - last_walk_y = walk_y; - last_task1 = task1; - last_task2 = task2; - last_open_time = open_time; - last_standby_time = standby_time; - last_production_time = production_time; - last_error_time = error_time; - } - - - public boolean exe_error() { - if (this.error == 0) { - return true; - } else { - log.debug("设备报警"); - return false; - } - } - - - public void writing1(int command) { - String to_command1 = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_command1; - - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(to_command1, command); - ReadUtil.write(itemMap, server); - - } - - public synchronized boolean finish_instruction(Instruction inst) throws Exception { - instructionService.finish(inst); - return true; - } - - //申请前工位任务 - public synchronized boolean instruction_require() 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; - String linkobj = (String)this.getDevice().getExtraValue().get("get_device_code1"); - String demosub = linkobj.substring(1,linkobj.length()-1); - String demoArray[] = demosub.split(","); - List device_code_list = Arrays.asList(demoArray); - TaskDto task = null; - for(int i=0;i device_code_list = Arrays.asList(demoArray); - TaskDto task = null; - for(int i=0;i itemMap = new HashMap(); - ReadUtil.write(itemMap, server); - - } - - public void executing(Server server, Map itemMap) { - ReadUtil.write(itemMap, server); - } - - public void writing(int command) { - - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - ReadUtil.write(itemMap, server); - - } - - public void writing(Instruction inst) { - String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + org.nl.acs.device_driver.standard_rgv.ItemProtocol.item_to_command; - String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + org.nl.acs.device_driver.standard_rgv.ItemProtocol.item_to_target; - String to_onset = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + org.nl.acs.device_driver.standard_rgv.ItemProtocol.item_to_onset; - String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + org.nl.acs.device_driver.standard_rgv.ItemProtocol.item_to_task; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(to_command, 1); - itemMap.put(to_onset,appService.findDeviceByCode(inst.getStart_device_code()).getAddress()); - itemMap.put(to_target,appService.findDeviceByCode(inst.getNext_device_code()).getAddress()); - itemMap.put(to_task, inst.getInstruction_code()); - ReadUtil.write(itemMap, server); - log.info("设备:{},下发作业命令:{},起始站{},目标站:{},任务号:{}", device_code, to_command,to_onset ,to_target, to_task); - } - - - public void writing(String param, String value) { - - String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + param; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(to_param, value); - - ReadUtil.write(itemMap, server); - } -} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_split_manipulator/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_split_manipulator/ItemProtocol.java deleted file mode 100644 index c6a6935..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_split_manipulator/ItemProtocol.java +++ /dev/null @@ -1,858 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_split_manipulator; - -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -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_error = "error"; - public static String item_getStation = "getStation"; - public static String item_barcode = "barcode"; - public static String item_open_time = "open_time"; - public static String item_standby_time = "standby_time"; - public static String item_production_time = "production_time"; - public static String item_error_time = "error_time"; - public static String item_material = "material"; - public static String item_total_split = "total_split"; - public static String item_product_code = "product_code"; - public static String item_AlongSide = "AlongSide"; - public static String item_BshortSide = "BshortSide"; - public static String item_Htrapezoidal = "Htrapezoidal"; - public static String item_Wthickness = "Wthickness"; - public static String item_tray_qty = "tray_qty"; - public static String item_tray_high = "tray_high"; - public static String item_crib_category = "crib_category"; - public static String item_palletX1_line = "palletX1_line"; - public static String item_palletY1_row = "palletY1_row"; - public static String item_palletA1_angle = "palletA1_angle"; - public static String item_palletX2_line = "palletX2_line"; - public static String item_palletY2_row = "palletY2_row"; - public static String item_palletA2_angle = "palletA2_angle"; - public static String item_palletX3_line = "palletX3_line"; - public static String item_palletY3_row = "palletY3_row"; - public static String item_palletA3_angle = "palletA3_angle"; - public static String item_pressCribX1_line = "pressCribX1_line"; - public static String item_pressCribY1_row = "pressCribY1_row"; - public static String item_pressCribA1_angle = "pressCribA1_angle"; - public static String item_pressCribX2_line = "pressCribX2_line"; - public static String item_pressCribY2_row = "pressCribY2_row"; - public static String item_pressCribA2_angle = "pressCribA2_angle"; - public static String item_pressCribX3_line = "pressCribX3_line"; - public static String item_pressCribY3_row = "pressCribY3_row"; - public static String item_pressCribA3_angle = "pressCribA3_angle"; - public static String item_Zoffset = "Zoffset"; - public static String item_pallet_layerQty = "pallet_layerQty"; - public static String item_pressCrib_layerQty = "pressCrib_layerQty"; - public static String item_codeLayerX1_interval = "codeLayerX1_interval"; - public static String item_codeLayerY1_interval = "codeLayerY1_interval"; - public static String item_codeLayerX2_interval = "codeLayerX2_interval"; - public static String item_codeLayerY2_interval = "codeLayerY2_interval"; - public static String item_codeLayerX3_interval = "codeLayerX3_interval"; - public static String item_codeLayerY3_interval = "codeLayerY3_interval"; - public static String item_codeLayerX1_offset = "codeLayerX1_offset"; - public static String item_codeLayerY1_offset = "codeLayerY1_offset"; - public static String item_codeLayerX2_offset = "codeLayerX2_offset"; - public static String item_codeLayerY2_offset = "codeLayerY2_offset"; - public static String item_codeLayerX3_offset = "codeLayerX3_offset"; - public static String item_codeLayerY3_offset = "codeLayerY3_offset"; - public static String item_pressLayerX1_interval = "pressLayerX1_interval"; - public static String item_pressLayerY1_interval = "pressLayerY1_interval"; - public static String item_pressLayerX2_interval = "pressLayerX2_interval"; - public static String item_pressLayerY2_interval = "pressLayerY2_interval"; - public static String item_pressLayerX3_interval = "pressLayerX3_interval"; - public static String item_pressLayerY3_interval = "pressLayerY3_interval"; - public static String item_pressLayerX1_offset = "pressLayerX1_offset"; - public static String item_pressLayerY1_offset = "pressLayerY1_offset"; - public static String item_pressLayerX2_offset = "pressLayerX2_offset"; - public static String item_pressLayerY2_offset = "pressLayerY2_offset"; - public static String item_pressLayerX3_offset = "pressLayerX3_offset"; - public static String item_pressLayerY3_offset = "pressLayerY3_offset"; - public static String item_one_cribTotal = "one_cribTotal"; - public static String item_two_cribTotal = "two_cribTotal"; - public static String item_one_qty = "one_qty"; - public static String item_two_qty = "two_qty"; - public static String item_tool_coordinate = "tool_coordinate"; - - public static String item_to_feedback = "to_feedback"; - public static String item_to_error = "to_error"; - public static String item_to_material = "to_material"; - - public static String item_to_product_code = "to_product_code"; - public static String item_to_AlongSide = "to_AlongSide"; - public static String item_to_BshortSide = "to_BshortSide"; - public static String item_to_Htrapezoidal = "to_Htrapezoidal"; - public static String item_to_Wthickness = "to_Wthickness"; - public static String item_to_tray_qty = "to_tray_qty"; - public static String item_to_tray_high = "to_tray_high"; - public static String item_to_crib_category = "to_crib_category"; - public static String item_to_palletX1_line = "to_palletX1_line"; - public static String item_to_palletY1_row = "to_palletY1_row"; - public static String item_to_palletA1_angle = "to_palletA1_angle"; - public static String item_to_palletX2_line = "to_palletX2_line"; - public static String item_to_palletY2_row = "to_palletY2_row"; - public static String item_to_palletA2_angle = "to_palletA2_angle"; - public static String item_to_palletX3_line = "to_palletX3_line"; - public static String item_to_palletY3_row = "to_palletY3_row"; - public static String item_to_palletA3_angle = "to_palletA3_angle"; - public static String item_to_pressCribX1_line = "to_pressCribX1_line"; - public static String item_to_pressCribY1_row = "to_pressCribY1_row"; - public static String item_to_pressCribA1_angle = "to_pressCribA1_angle"; - public static String item_to_pressCribX2_line = "to_pressCribX2_line"; - public static String item_to_pressCribY2_row = "to_pressCribY2_row"; - public static String item_to_pressCribA2_angle = "to_pressCribA2_angle"; - public static String item_to_pressCribX3_line = "to_pressCribX3_line"; - public static String item_to_pressCribY3_row = "to_pressCribY3_row"; - public static String item_to_pressCribA3_angle = "to_pressCribA3_angle"; - public static String item_to_Zoffset = "to_Zoffset"; - public static String item_to_pallet_layerQty = "to_pallet_layerQty"; - public static String item_to_pressCrib_layerQty = "to_pressCrib_layerQty"; - public static String item_to_codeLayerX1_interval = "to_codeLayerX1_interval"; - public static String item_to_codeLayerY1_interval = "to_codeLayerY1_interval"; - public static String item_to_codeLayerX2_interval = "to_codeLayerX2_interval"; - public static String item_to_codeLayerY2_interval = "to_codeLayerY2_interval"; - public static String item_to_codeLayerX3_interval = "to_codeLayerX3_interval"; - public static String item_to_codeLayerY3_interval = "to_codeLayerY3_interval"; - public static String item_to_codeLayerX1_offset = "to_codeLayerX1_offset"; - public static String item_to_codeLayerY1_offset = "to_codeLayerY1_offset"; - public static String item_to_codeLayerX2_offset = "to_codeLayerX2_offset"; - public static String item_to_codeLayerY2_offset = "to_codeLayerY2_offset"; - public static String item_to_codeLayerX3_offset = "to_codeLayerX3_offset"; - public static String item_to_codeLayerY3_offset = "to_codeLayerY3_offset"; - public static String item_to_pressLayerX1_interval = "to_pressLayerX1_interval"; - public static String item_to_pressLayerY1_interval = "to_pressLayerY1_interval"; - public static String item_to_pressLayerX2_interval = "to_pressLayerX2_interval"; - public static String item_to_pressLayerY2_interval = "to_pressLayerY2_interval"; - public static String item_to_pressLayerX3_interval = "to_pressLayerX3_interval"; - public static String item_to_pressLayerY3_interval = "to_pressLayerY3_interval"; - public static String item_to_pressLayerX1_offset = "to_pressLayerX1_offset"; - public static String item_to_pressLayerY1_offset = "to_pressLayerY1_offset"; - public static String item_to_pressLayerX2_offset = "to_pressLayerX2_offset"; - public static String item_to_pressLayerY2_offset = "to_pressLayerY2_offset"; - public static String item_to_pressLayerX3_offset = "to_pressLayerX3_offset"; - public static String item_to_pressLayerY3_offset = "to_pressLayerY3_offset"; - public static String item_to_one_cribTotal = "to_one_cribTotal"; - public static String item_to_two_cribTotal = "to_two_cribTotal"; - public static String item_to_one_qty = "to_one_qty"; - public static String item_to_two_qty = "to_two_qty"; - public static String item_to_tool_coordinate = "to_tool_coordinate"; - - private LnshSplitManipulatorDeviceDriver driver; - - public ItemProtocol(LnshSplitManipulatorDeviceDriver driver) { - this.driver = driver; - } - - public int getHeartbeat() { - return this.getOpcIntegerValue(item_heartbeat); - } - - public int getMode() { - return this.getOpcIntegerValue(item_mode); - } - - public int getError() { - return this.getOpcIntegerValue(item_error); - } - - public String getBarcode() { - return this.getOpcStringValue(item_barcode); - } - - public int getOpen_time() { - return this.getOpcIntegerValue(item_open_time); - } - - public int getStandby_time() { - return this.getOpcIntegerValue(item_standby_time); - } - - public int getProduction_time() { - return this.getOpcIntegerValue(item_production_time); - } - - public int getError_time() { - return this.getOpcIntegerValue(item_error_time); - } - - public int getGetStation() { - return this.getOpcIntegerValue(item_getStation); - } - - public String getMaterial() { - return this.getOpcStringValue(item_material); - } - - public int getTotal_split() { - return this.getOpcIntegerValue(item_total_split); - } - - public int getProduct_code() { - return this.getOpcIntegerValue(item_product_code); - } - - public int getAlongSide() { - return this.getOpcIntegerValue(item_AlongSide); - } - - public int getBshortSide() { - return this.getOpcIntegerValue(item_BshortSide); - } - - public int getHtrapezoidal() { - return this.getOpcIntegerValue(item_Htrapezoidal); - } - - public int getWthickness() { - return this.getOpcIntegerValue(item_Wthickness); - } - - public int getTray_qty() { - return this.getOpcIntegerValue(item_tray_qty); - } - - public int getTray_high() { - return this.getOpcIntegerValue(item_tray_high); - } - - public int getCrib_category() { - return this.getOpcIntegerValue(item_crib_category); - } - - public Float getPalletX1_line() { - return this.getOpcFloatValue(item_palletX1_line); - } - - public Float getPalletY1_row() { - return this.getOpcFloatValue(item_palletY1_row); - } - - public Float getPalletA1_angle() { - return this.getOpcFloatValue(item_palletA1_angle); - } - - public Float getPalletX2_line() { - return this.getOpcFloatValue(item_palletX2_line); - } - - public Float getPalletY2_row() { - return this.getOpcFloatValue(item_palletY2_row); - } - - public Float getPalletA2_angle() { - return this.getOpcFloatValue(item_palletA2_angle); - } - - public Float getPalletX3_line() { - return this.getOpcFloatValue(item_palletX3_line); - } - - public Float getPalletY3_row() { - return this.getOpcFloatValue(item_palletY3_row); - } - - public Float getPalletA3_angle() { - return this.getOpcFloatValue(item_palletA3_angle); - } - - public Float getPressCribX1_line() { - return this.getOpcFloatValue(item_pressCribX1_line); - } - - public Float getPressCribY1_row() { - return this.getOpcFloatValue(item_pressCribY1_row); - } - - public Float getPressCribA1_angle() { - return this.getOpcFloatValue(item_pressCribA1_angle); - } - - public Float getPressCribX2_line() { - return this.getOpcFloatValue(item_pressCribX2_line); - } - - public Float getPressCribY2_row() { - return this.getOpcFloatValue(item_pressCribY2_row); - } - - public Float getPressCribA2_angle() { - return this.getOpcFloatValue(item_pressCribA2_angle); - } - - public Float getPressCribX3_line() { - return this.getOpcFloatValue(item_pressCribX3_line); - } - - public Float getPressCribY3_row() { - return this.getOpcFloatValue(item_pressCribY3_row); - } - - public Float getPressCribA3_angle() { - return this.getOpcFloatValue(item_pressCribA3_angle); - } - - public Float getZoffset() { - return this.getOpcFloatValue(item_Zoffset); - } - - public int getPallet_layerQty() { - return this.getOpcIntegerValue(item_pallet_layerQty); - } - - public int getPressCrib_layerQty() { - return this.getOpcIntegerValue(item_pressCrib_layerQty); - } - - public Float getCodeLayerX1_interval() { - return this.getOpcFloatValue(item_codeLayerX1_interval); - } - - public Float getCodeLayerY1_interval() { - return this.getOpcFloatValue(item_codeLayerY1_interval); - } - - public Float getCodeLayerX2_interval() { - return this.getOpcFloatValue(item_codeLayerX2_interval); - } - - public Float getCodeLayerY2_interval() { - return this.getOpcFloatValue(item_codeLayerY2_interval); - } - - public Float getCodeLayerX3_interval() { - return this.getOpcFloatValue(item_codeLayerX3_interval); - } - - public Float getcodeLayerY3_interval() { - return this.getOpcFloatValue(item_codeLayerY3_interval); - } - - public Float getCodeLayerX1_offset() { - return this.getOpcFloatValue(item_codeLayerX1_offset); - } - - public Float getCodeLayerY1_offset() { - return this.getOpcFloatValue(item_codeLayerY1_offset); - } - - public Float getCodeLayerX2_offset() { - return this.getOpcFloatValue(item_codeLayerX2_offset); - } - - public Float getCodeLayerY2_offset() { - return this.getOpcFloatValue(item_codeLayerY2_offset); - } - - public Float getCodeLayerX3_offset() { - return this.getOpcFloatValue(item_codeLayerX3_offset); - } - - public Float getCodeLayerY3_offset() { - return this.getOpcFloatValue(item_codeLayerY3_offset); - } - - public Float getPressLayerX1_interval() { - return this.getOpcFloatValue(item_pressLayerX1_interval); - } - - public Float getPressLayerY1_interval() { - return this.getOpcFloatValue(item_pressLayerY1_interval); - } - - public Float getPressLayerX2_interval() { - return this.getOpcFloatValue(item_pressLayerX2_interval); - } - - public Float getPressLayerY2_interval() { - return this.getOpcFloatValue(item_pressLayerY2_interval); - } - - public Float getPressLayerX3_interval() { - return this.getOpcFloatValue(item_pressLayerX3_interval); - } - - public Float getPressLayerY3_interval() { - return this.getOpcFloatValue(item_pressLayerY3_interval); - } - - public Float getPressLayerX1_offset() { - return this.getOpcFloatValue(item_pressLayerX1_offset); - } - - public Float getPressLayerY1_offset() { - return this.getOpcFloatValue(item_pressLayerY1_offset); - } - - public Float getPressLayerX2_offset() { - return this.getOpcFloatValue(item_pressLayerX2_offset); - } - - public Float getPressLayerY2_offset() { - return this.getOpcFloatValue(item_pressLayerY2_offset); - } - - public Float getPressLayerX3_offset() { - return this.getOpcFloatValue(item_pressLayerX3_offset); - } - - public Float getPressLayerY3_offset() { - return this.getOpcFloatValue(item_pressLayerY3_offset); - } - - public int getOne_cribTotal() { - return this.getOpcIntegerValue(item_one_cribTotal); - } - - public int getTwo_cribTotal() { - return this.getOpcIntegerValue(item_two_cribTotal); - } - - public int getOne_qty() { - return this.getOpcIntegerValue(item_one_qty); - } - - public int getTwo_qty() { - return this.getOpcIntegerValue(item_two_qty); - } - - public int getTool_coordinate() { - return this.getOpcIntegerValue(item_tool_coordinate); - } - - public int getTo_feedback() { - return this.getOpcIntegerValue(item_to_feedback); - } - - public int getTo_error() { - return this.getOpcIntegerValue(item_to_error); - } - - public String getTo_material() { - return this.getOpcStringValue(item_to_material); - } - - public int getToProduct_code() { - return this.getOpcIntegerValue(item_to_product_code); - } - - public int getToAlongSide() { - return this.getOpcIntegerValue(item_to_AlongSide); - } - - public int getToBshortSide() { - return this.getOpcIntegerValue(item_to_BshortSide); - } - - public int getToHtrapezoidal() { - return this.getOpcIntegerValue(item_to_Htrapezoidal); - } - - public int getToWthickness() { - return this.getOpcIntegerValue(item_to_Wthickness); - } - - public int getToTray_qty() { - return this.getOpcIntegerValue(item_to_tray_qty); - } - - public int getToTray_high() { - return this.getOpcIntegerValue(item_to_tray_high); - } - - public int getToCrib_category() { - return this.getOpcIntegerValue(item_to_crib_category); - } - - public Float getToPalletX1_line() { - return this.getOpcFloatValue(item_to_palletX1_line); - } - - public Float getToPalletY1_row() { - return this.getOpcFloatValue(item_to_palletY1_row); - } - - public Float getToPalletA1_angle() { - return this.getOpcFloatValue(item_to_palletA1_angle); - } - - public Float getToPalletX2_line() { - return this.getOpcFloatValue(item_to_palletX2_line); - } - - public Float getToPalletY2_row() { - return this.getOpcFloatValue(item_to_palletY2_row); - } - - public Float getToPalletA2_angle() { - return this.getOpcFloatValue(item_to_palletA2_angle); - } - - public Float getToPalletX3_line() { - return this.getOpcFloatValue(item_to_palletX3_line); - } - - public Float getToPalletY3_row() { - return this.getOpcFloatValue(item_to_palletY3_row); - } - - public Float getToPalletA3_angle() { - return this.getOpcFloatValue(item_to_palletA3_angle); - } - - public Float getToPressCribX1_line() { - return this.getOpcFloatValue(item_to_pressCribX1_line); - } - - public Float getToPressCribY1_row() { - return this.getOpcFloatValue(item_to_pressCribY1_row); - } - - public Float getToPressCribA1_angle() { - return this.getOpcFloatValue(item_to_pressCribA1_angle); - } - - public Float getToPressCribX2_line() { - return this.getOpcFloatValue(item_to_pressCribX2_line); - } - - public Float getToPressCribY2_row() { - return this.getOpcFloatValue(item_to_pressCribY2_row); - } - - public Float getToPressCribA2_angle() { - return this.getOpcFloatValue(item_to_pressCribA2_angle); - } - - public Float getToPressCribX3_line() { - return this.getOpcFloatValue(item_to_pressCribX3_line); - } - - public Float getToPressCribY3_row() { - return this.getOpcFloatValue(item_to_pressCribY3_row); - } - - public Float getToPressCribA3_angle() { - return this.getOpcFloatValue(item_to_pressCribA3_angle); - } - - public Float getToZoffset() { - return this.getOpcFloatValue(item_to_Zoffset); - } - - public int getToPallet_layerQty() { - return this.getOpcIntegerValue(item_to_pallet_layerQty); - } - - public int getToPressCrib_layerQty() { - return this.getOpcIntegerValue(item_to_pressCrib_layerQty); - } - - public Float getToCodeLayerX1_interval() { - return this.getOpcFloatValue(item_to_codeLayerX1_interval); - } - - public Float getToCodeLayerY1_interval() { - return this.getOpcFloatValue(item_to_codeLayerY1_interval); - } - - public Float getToCodeLayerX2_interval() { - return this.getOpcFloatValue(item_to_codeLayerX2_interval); - } - - public Float getToCodeLayerY2_interval() { - return this.getOpcFloatValue(item_to_codeLayerY2_interval); - } - - public Float getToCodeLayerX3_interval() { - return this.getOpcFloatValue(item_to_codeLayerX3_interval); - } - - public Float getTocodeLayerY3_interval() { - return this.getOpcFloatValue(item_to_codeLayerY3_interval); - } - - public Float getToCodeLayerX1_offset() { - return this.getOpcFloatValue(item_to_codeLayerX1_offset); - } - - public Float getToCodeLayerY1_offset() { - return this.getOpcFloatValue(item_to_codeLayerY1_offset); - } - - public Float getToCodeLayerX2_offset() { - return this.getOpcFloatValue(item_to_codeLayerX2_offset); - } - - public Float getToCodeLayerY2_offset() { - return this.getOpcFloatValue(item_to_codeLayerY2_offset); - } - - public Float getToCodeLayerX3_offset() { - return this.getOpcFloatValue(item_to_codeLayerX3_offset); - } - - public Float getToCodeLayerY3_offset() { - return this.getOpcFloatValue(item_to_codeLayerY3_offset); - } - - public Float getToPressLayerX1_interval() { - return this.getOpcFloatValue(item_to_pressLayerX1_interval); - } - - public Float getToPressLayerY1_interval() { - return this.getOpcFloatValue(item_to_pressLayerY1_interval); - } - - public Float getToPressLayerX2_interval() { - return this.getOpcFloatValue(item_to_pressLayerX2_interval); - } - - public Float getToPressLayerY2_interval() { - return this.getOpcFloatValue(item_to_pressLayerY2_interval); - } - - public Float getToPressLayerX3_interval() { - return this.getOpcFloatValue(item_to_pressLayerX3_interval); - } - - public Float getToPressLayerY3_interval() { - return this.getOpcFloatValue(item_to_pressLayerY3_interval); - } - - public Float getToPressLayerX1_offset() { - return this.getOpcFloatValue(item_to_pressLayerX1_offset); - } - - public Float getToPressLayerY1_offset() { - return this.getOpcFloatValue(item_to_pressLayerY1_offset); - } - - public Float getToPressLayerX2_offset() { - return this.getOpcFloatValue(item_to_pressLayerX2_offset); - } - - public Float getToPressLayerY2_offset() { - return this.getOpcFloatValue(item_to_pressLayerY2_offset); - } - - public Float getToPressLayerX3_offset() { - return this.getOpcFloatValue(item_to_pressLayerX3_offset); - } - - public Float getToPressLayerY3_offset() { - return this.getOpcFloatValue(item_to_pressLayerY3_offset); - } - - public int getToOne_cribTotal() { - return this.getOpcIntegerValue(item_to_one_cribTotal); - } - - public int getToTwo_cribTotal() { - return this.getOpcIntegerValue(item_to_two_cribTotal); - } - - public int getToOne_qty() { - return this.getOpcIntegerValue(item_to_one_qty); - } - - public int getToTwo_qty() { - return this.getOpcIntegerValue(item_to_two_qty); - } - - public int getToTool_coordinate() { - return this.getOpcIntegerValue(item_to_tool_coordinate); - } - - //是否有货 - 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 Float getOpcFloatValue(String protocol) { - Float value = this.driver.getFloatValue(protocol); - if (ObjectUtil.isEmpty(value)) { -// log.error("读取错误!"); - } else { - return value; - } - return 0.0f; - } - - public String getOpcStringValue(String protocol) { - String value = this.driver.getStringValue(protocol); - if (StrUtil.isEmpty(value)) { -// log.error("读取错误!"); - } else { - return value; - } - return "0"; - } - - public static List getReadableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_heartbeat, "心跳", "DB7.B0")); - list.add(new ItemDto(item_mode, "工作状态", "DB7.B1", Boolean.valueOf(true))); - list.add(new ItemDto(item_error, "故障", "DB7.B3")); - list.add(new ItemDto(item_getStation, "当前抓取工位", "DB7.D4")); - list.add(new ItemDto(item_barcode, "条码", "DB7.S8")); - list.add(new ItemDto(item_open_time, "开机时间", "DB7.D264")); - list.add(new ItemDto(item_standby_time, "待机时间", "DB7.D520")); - list.add(new ItemDto(item_production_time, "生产时间", "DB7.D524")); - list.add(new ItemDto(item_error_time, "故障时间", "DB7.D528")); - list.add(new ItemDto(item_material, "物料", "DB7.D532")); - list.add(new ItemDto(item_total_split, "累计拆垛数量", "DB7.D536")); - - list.add(new ItemDto(item_product_code, "产品编号", "DB7.D544")); - list.add(new ItemDto(item_AlongSide, "A长边", "DB7.D548")); - list.add(new ItemDto(item_BshortSide, "B短边", "DB7.D552")); - list.add(new ItemDto(item_Htrapezoidal, "H梯形高", "DB7.D556")); - list.add(new ItemDto(item_Wthickness, "W厚度", "DB7.D560")); - list.add(new ItemDto(item_tray_qty, "当前垛盘数", "DB7.D564")); - list.add(new ItemDto(item_tray_high, "垛盘高度", "DB7.D568")); - list.add(new ItemDto(item_crib_category, "垛型类别", "DB7.D572")); - list.add(new ItemDto(item_palletX1_line, "码垛X1行", "DB7.REAL576")); - list.add(new ItemDto(item_palletY1_row, "码垛Y1列", "DB7.REAL580")); - list.add(new ItemDto(item_palletA1_angle, "码垛A1角度", "DB7.REAL584")); - list.add(new ItemDto(item_palletX2_line, "码垛X2行", "DB7.REAL588")); - list.add(new ItemDto(item_palletY2_row, "码垛Y2列", "DB7.REAL592")); - list.add(new ItemDto(item_palletA2_angle, "码垛A2角度", "DB7.REAL596")); - list.add(new ItemDto(item_palletX3_line, "码垛X3行", "DB7.REAL600")); - list.add(new ItemDto(item_palletY3_row, "码垛Y3列", "DB7.REAL604")); - list.add(new ItemDto(item_palletA3_angle, "码垛A3角度", "DB7.REAL608")); - list.add(new ItemDto(item_pressCribX1_line, "压垛X1行", "DB7.REAL612")); - list.add(new ItemDto(item_pressCribY1_row, "压垛Y1列", "DB7.REAL616")); - list.add(new ItemDto(item_pressCribA1_angle, "压垛A1角度", "DB7.REAL620")); - list.add(new ItemDto(item_pressCribX2_line, "压垛X2行", "DB7.REAL624")); - list.add(new ItemDto(item_pressCribY2_row, "压垛Y2列", "DB7.REAL628")); - list.add(new ItemDto(item_pressCribA2_angle, "压垛A2角度", "DB7.REAL632")); - list.add(new ItemDto(item_pressCribX3_line, "压垛X3行", "DB7.REAL636")); - list.add(new ItemDto(item_pressCribY3_row, "压垛Y3列", "DB7.REAL640")); - list.add(new ItemDto(item_pressCribA3_angle, "压垛A3角度", "DB7.REAL644")); - list.add(new ItemDto(item_Zoffset, "Z轴偏移", "DB7.REAL648")); - list.add(new ItemDto(item_pallet_layerQty, "码垛层数", "DB7.D652")); - list.add(new ItemDto(item_pressCrib_layerQty, "压垛层数", "DB7.D656")); - list.add(new ItemDto(item_codeLayerX1_interval, "码层X1间隔", "DB7.REAL660")); - list.add(new ItemDto(item_codeLayerY1_interval, "码层Y1间隔", "DB7.REAL664")); - list.add(new ItemDto(item_codeLayerX2_interval, "码层X2间隔", "DB7.REAL668")); - list.add(new ItemDto(item_codeLayerY2_interval, "码层Y2间隔", "DB7.REAL672")); - list.add(new ItemDto(item_codeLayerX3_interval, "码层X3间隔", "DB7.REAL676")); - list.add(new ItemDto(item_codeLayerY3_interval, "码层Y3间隔", "DB7.REAL680")); - list.add(new ItemDto(item_codeLayerX1_offset, "码层X1偏移", "DB7.REAL684")); - list.add(new ItemDto(item_codeLayerY1_offset, "码层Y1偏移", "DB7.REAL688")); - list.add(new ItemDto(item_codeLayerX2_offset, "码层X2偏移", "DB7.REAL692")); - list.add(new ItemDto(item_codeLayerY2_offset, "码层Y2偏移", "DB7.REAL696")); - list.add(new ItemDto(item_codeLayerX3_offset, "码层X3偏移", "DB7.REAL700")); - list.add(new ItemDto(item_codeLayerY3_offset, "码层Y3偏移", "DB7.REAL704")); - list.add(new ItemDto(item_pressLayerX1_interval, "压层X1间隔", "DB7.REAL708")); - list.add(new ItemDto(item_pressLayerY1_interval, "压层Y1间隔", "DB7.REAL712")); - list.add(new ItemDto(item_pressLayerX2_interval, "压层X2间隔", "DB7.REAL716")); - list.add(new ItemDto(item_pressLayerY2_interval, "压层Y2间隔", "DB7.REAL720")); - list.add(new ItemDto(item_pressLayerX3_interval, "压层X3间隔", "DB7.REAL724")); - list.add(new ItemDto(item_pressLayerY3_interval, "压层Y3间隔", "DB7.REAL728")); - list.add(new ItemDto(item_pressLayerX1_offset, "压层X1偏移", "DB7.REAL732")); - list.add(new ItemDto(item_pressLayerY1_offset, "压层Y1偏移", "DB7.REAL736")); - list.add(new ItemDto(item_pressLayerX2_offset, "压层X2偏移", "DB7.REAL740")); - list.add(new ItemDto(item_pressLayerY2_offset, "压层Y2偏移", "DB7.REAL744")); - list.add(new ItemDto(item_pressLayerX3_offset, "压层X3偏移", "DB7.REAL748")); - list.add(new ItemDto(item_pressLayerY3_offset, "压层Y3偏移", "DB7.REAL752")); - list.add(new ItemDto(item_one_cribTotal, "1#垛总数", "DB7.D756")); - list.add(new ItemDto(item_two_cribTotal, "2#垛总数", "DB7.D760")); - list.add(new ItemDto(item_one_qty, "1#垛当前数", "DB7.D764")); - list.add(new ItemDto(item_two_qty, "2#垛当前数", "DB7.D768")); - list.add(new ItemDto(item_tool_coordinate, "工具坐标", "DB7.D772")); - return list; - } - - public static List getWriteableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_feedback, "机器人动作反馈", "DB8.W0")); - list.add(new ItemDto(item_to_error, "故障代码", "DB8.W1")); - list.add(new ItemDto(item_to_material, "物料", "DB8.S2")); - - list.add(new ItemDto(item_to_product_code, "产品编号", "DB8.D258")); - list.add(new ItemDto(item_to_AlongSide, "A长边", "DB8.D262")); - list.add(new ItemDto(item_to_BshortSide, "B短边", "DB8.D266")); - list.add(new ItemDto(item_to_Htrapezoidal, "H梯形高", "DB8.D270")); - list.add(new ItemDto(item_to_Wthickness, "W厚度", "DB8.D274")); - list.add(new ItemDto(item_to_tray_qty, "当前垛盘数", "DB8.D278")); - list.add(new ItemDto(item_to_tray_high, "垛盘高度", "DB8.D282")); - list.add(new ItemDto(item_to_crib_category, "垛型类别", "DB8.D286")); - list.add(new ItemDto(item_to_palletX1_line, "码垛X1行", "DB8.REAL290")); - list.add(new ItemDto(item_to_palletY1_row, "码垛Y1列", "DB8.REAL294")); - list.add(new ItemDto(item_to_palletA1_angle, "码垛A1角度", "DB8.REAL298")); - list.add(new ItemDto(item_to_palletX2_line, "码垛X2行", "DB8.REAL302")); - list.add(new ItemDto(item_to_palletY2_row, "码垛Y2列", "DB8.REAL306")); - list.add(new ItemDto(item_to_palletA2_angle, "码垛A2角度", "DB8.REAL310")); - list.add(new ItemDto(item_to_palletX3_line, "码垛X3行", "DB8.REAL314")); - list.add(new ItemDto(item_to_palletY3_row, "码垛Y3列", "DB8.REAL318")); - list.add(new ItemDto(item_to_palletA3_angle, "码垛A3角度", "DB8.REAL322")); - list.add(new ItemDto(item_to_pressCribX1_line, "压垛X1行", "DB8.REAL326")); - list.add(new ItemDto(item_to_pressCribY1_row, "压垛Y1列", "DB8.REAL330")); - list.add(new ItemDto(item_to_pressCribA1_angle, "压垛A1角度", "DB8.REAL334")); - list.add(new ItemDto(item_to_pressCribX2_line, "压垛X2行", "DB8.REAL338")); - list.add(new ItemDto(item_to_pressCribY2_row, "压垛Y2列", "DB8.REAL342")); - list.add(new ItemDto(item_to_pressCribA2_angle, "压垛A2角度", "DB8.REAL346")); - list.add(new ItemDto(item_to_pressCribX3_line, "压垛X3行", "DB8.REAL350")); - list.add(new ItemDto(item_to_pressCribY3_row, "压垛Y3列", "DB8.REAL354")); - list.add(new ItemDto(item_to_pressCribA3_angle, "压垛A3角度", "DB8.REAL358")); - list.add(new ItemDto(item_to_Zoffset, "Z轴偏移", "DB8.REAL362")); - list.add(new ItemDto(item_to_pallet_layerQty, "码垛层数", "DB8.D366")); - list.add(new ItemDto(item_to_pressCrib_layerQty, "压垛层数", "DB8.D370")); - list.add(new ItemDto(item_to_codeLayerX1_interval, "码层X1间隔", "DB8.REAL374")); - list.add(new ItemDto(item_to_codeLayerY1_interval, "码层Y1间隔", "DB8.REAL378")); - list.add(new ItemDto(item_to_codeLayerX2_interval, "码层X2间隔", "DB8.REAL382")); - list.add(new ItemDto(item_to_codeLayerY2_interval, "码层Y2间隔", "DB8.REAL386")); - list.add(new ItemDto(item_to_codeLayerX3_interval, "码层X3间隔", "DB8.REAL390")); - list.add(new ItemDto(item_to_codeLayerY3_interval, "码层Y3间隔", "DB8.REAL394")); - list.add(new ItemDto(item_to_codeLayerX1_offset, "码层X1偏移", "DB8.REAL398")); - list.add(new ItemDto(item_to_codeLayerY1_offset, "码层Y1偏移", "DB8.REAL402")); - list.add(new ItemDto(item_to_codeLayerX2_offset, "码层X2偏移", "DB8.REAL406")); - list.add(new ItemDto(item_to_codeLayerY2_offset, "码层Y2偏移", "DB8.REAL410")); - list.add(new ItemDto(item_to_codeLayerX3_offset, "码层X3偏移", "DB8.REAL414")); - list.add(new ItemDto(item_to_codeLayerY3_offset, "码层Y3偏移", "DB8.REAL418")); - list.add(new ItemDto(item_to_pressLayerX1_interval, "压层X1间隔", "DB8.REAL422")); - list.add(new ItemDto(item_to_pressLayerY1_interval, "压层Y1间隔", "DB8.REAL426")); - list.add(new ItemDto(item_to_pressLayerX2_interval, "压层X2间隔", "DB8.REAL430")); - list.add(new ItemDto(item_to_pressLayerY2_interval, "压层Y2间隔", "DB8.REAL434")); - list.add(new ItemDto(item_to_pressLayerX3_interval, "压层X3间隔", "DB8.REAL438")); - list.add(new ItemDto(item_to_pressLayerY3_interval, "压层Y3间隔", "DB8.REAL442")); - list.add(new ItemDto(item_to_pressLayerX1_offset, "压层X1偏移", "DB8.REAL446")); - list.add(new ItemDto(item_to_pressLayerY1_offset, "压层Y1偏移", "DB8.REAL450")); - list.add(new ItemDto(item_to_pressLayerX2_offset, "压层X2偏移", "DB8.REAL454")); - list.add(new ItemDto(item_to_pressLayerY2_offset, "压层Y2偏移", "DB8.REAL458")); - list.add(new ItemDto(item_to_pressLayerX3_offset, "压层X3偏移", "DB8.REAL462")); - list.add(new ItemDto(item_to_pressLayerY3_offset, "压层Y3偏移", "DB8.REAL466")); - list.add(new ItemDto(item_to_one_cribTotal, "1#垛总数", "DB8.D470")); - list.add(new ItemDto(item_to_two_cribTotal, "2#垛总数", "DB8.D474")); - list.add(new ItemDto(item_to_one_qty, "1#垛当前数", "DB8.D478")); - list.add(new ItemDto(item_to_two_qty, "2#垛当前数", "DB8.D482")); - list.add(new ItemDto(item_to_tool_coordinate, "工具坐标", "DB8.D486")); - return list; - } - -} - diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_split_manipulator/LnshSplitManipulatorDefination.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_split_manipulator/LnshSplitManipulatorDefination.java deleted file mode 100644 index 84498b6..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_split_manipulator/LnshSplitManipulatorDefination.java +++ /dev/null @@ -1,138 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_split_manipulator; - -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 LnshSplitManipulatorDefination implements OpcDeviceDriverDefination { - @Override - public String getDriverCode() { - return "lnsh_split_manipulator"; - } - - @Override - public String getDriverName() { - return "晟华-拆垛机械手"; - } - - @Override - public String getDriverDescription() { - return "晟华-拆垛机械手"; - } - - @Override - public DeviceDriver getDriverInstance(Device device) { - return (new LnshSplitManipulatorDeviceDriver()).setDevice(device).setDriverDefination(this); - - } - - @Override - public Class getDeviceDriverType() { - return LnshSplitManipulatorDeviceDriver.class; - } - - @Override - public List getFitDeviceTypes() { - List types = new LinkedList(); - types.add(DeviceType.station); - return types; - } - - @Override - public List getReadableItemDtos() { - return getReadableItemDtos2(); - } - - public static List getReadableItemDtos2() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB7.B0")); - list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB7.B1", Boolean.valueOf(true))); - list.add(new ItemDto(ItemProtocol.item_error, "故障", "DB7.B3")); - list.add(new ItemDto(ItemProtocol.item_getStation, "当前抓取工位", "DB7.D4")); - list.add(new ItemDto(ItemProtocol.item_barcode, "条码", "DB7.S8")); - list.add(new ItemDto(ItemProtocol.item_open_time, "开机时间", "DB7.D264")); - list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "DB7.D520")); - list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "DB7.D524")); - list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "DB7.D528")); - list.add(new ItemDto(ItemProtocol.item_material, "物料", "DB7.S532")); - list.add(new ItemDto(ItemProtocol.item_total_split, "累计拆垛数量", "DB7.D536")); - - list.add(new ItemDto(ItemProtocol.item_product_code, "产品编号", "DB7.D544")); - list.add(new ItemDto(ItemProtocol.item_AlongSide, "A长边", "DB7.D548")); - list.add(new ItemDto(ItemProtocol.item_BshortSide, "B短边", "DB7.D552")); - list.add(new ItemDto(ItemProtocol.item_Htrapezoidal, "H梯形高", "DB7.D556")); - list.add(new ItemDto(ItemProtocol.item_Wthickness, "W厚度", "DB7.D560")); - list.add(new ItemDto(ItemProtocol.item_tray_qty, "当前垛盘数", "DB7.D564")); - list.add(new ItemDto(ItemProtocol.item_tray_high, "垛盘高度", "DB7.D568")); - list.add(new ItemDto(ItemProtocol.item_crib_category, "垛型类别", "DB7.D572")); - list.add(new ItemDto(ItemProtocol.item_palletX1_line, "码垛X1行", "DB7.REAL576")); - list.add(new ItemDto(ItemProtocol.item_palletY1_row, "码垛Y1列", "DB7.REAL580")); - list.add(new ItemDto(ItemProtocol.item_palletA1_angle, "码垛A1角度", "DB7.REAL584")); - list.add(new ItemDto(ItemProtocol.item_palletX2_line, "码垛X2行", "DB7.REAL588")); - list.add(new ItemDto(ItemProtocol.item_palletY2_row, "码垛Y2列", "DB7.REAL592")); - list.add(new ItemDto(ItemProtocol.item_palletA2_angle, "码垛A2角度", "DB7.REAL596")); - list.add(new ItemDto(ItemProtocol.item_palletX3_line, "码垛X3行", "DB7.REAL600")); - list.add(new ItemDto(ItemProtocol.item_palletY3_row, "码垛Y3列", "DB7.REAL604")); - list.add(new ItemDto(ItemProtocol.item_palletA3_angle, "码垛A3角度", "DB7.REAL608")); - list.add(new ItemDto(ItemProtocol.item_pressCribX1_line, "压垛X1行", "DB7.REAL612")); - list.add(new ItemDto(ItemProtocol.item_pressCribY1_row, "压垛Y1列", "DB7.REAL616")); - list.add(new ItemDto(ItemProtocol.item_pressCribA1_angle, "压垛A1角度", "DB7.REAL620")); - list.add(new ItemDto(ItemProtocol.item_pressCribX2_line, "压垛X2行", "DB7.REAL624")); - list.add(new ItemDto(ItemProtocol.item_pressCribY2_row, "压垛Y2列", "DB7.REAL628")); - list.add(new ItemDto(ItemProtocol.item_pressCribA2_angle, "压垛A2角度", "DB7.REAL632")); - list.add(new ItemDto(ItemProtocol.item_pressCribX3_line, "压垛X3行", "DB7.REAL636")); - list.add(new ItemDto(ItemProtocol.item_pressCribY3_row, "压垛Y3列", "DB7.REAL640")); - list.add(new ItemDto(ItemProtocol.item_pressCribA3_angle, "压垛A3角度", "DB7.REAL644")); - list.add(new ItemDto(ItemProtocol.item_Zoffset, "Z轴偏移", "DB7.REAL648")); - list.add(new ItemDto(ItemProtocol.item_pallet_layerQty, "码垛层数", "DB7.D652")); - list.add(new ItemDto(ItemProtocol.item_pressCrib_layerQty, "压垛层数", "DB7.D656")); - list.add(new ItemDto(ItemProtocol.item_codeLayerX1_interval, "码层X1间隔", "DB7.REAL660")); - list.add(new ItemDto(ItemProtocol.item_codeLayerY1_interval, "码层Y1间隔", "DB7.REAL664")); - list.add(new ItemDto(ItemProtocol.item_codeLayerX2_interval, "码层X2间隔", "DB7.REAL668")); - list.add(new ItemDto(ItemProtocol.item_codeLayerY2_interval, "码层Y2间隔", "DB7.REAL672")); - list.add(new ItemDto(ItemProtocol.item_codeLayerX3_interval, "码层X3间隔", "DB7.REAL676")); - list.add(new ItemDto(ItemProtocol.item_codeLayerY3_interval, "码层Y3间隔", "DB7.REAL680")); - list.add(new ItemDto(ItemProtocol.item_codeLayerX1_offset, "码层X1偏移", "DB7.REAL684")); - list.add(new ItemDto(ItemProtocol.item_codeLayerY1_offset, "码层Y1偏移", "DB7.REAL688")); - list.add(new ItemDto(ItemProtocol.item_codeLayerX2_offset, "码层X2偏移", "DB7.REAL692")); - list.add(new ItemDto(ItemProtocol.item_codeLayerY2_offset, "码层Y2偏移", "DB7.REAL696")); - list.add(new ItemDto(ItemProtocol.item_codeLayerX3_offset, "码层X3偏移", "DB7.REAL700")); - list.add(new ItemDto(ItemProtocol.item_codeLayerY3_offset, "码层Y3偏移", "DB7.REAL704")); - list.add(new ItemDto(ItemProtocol.item_pressLayerX1_interval, "压层X1间隔", "DB7.REAL708")); - list.add(new ItemDto(ItemProtocol.item_pressLayerY1_interval, "压层Y1间隔", "DB7.REAL712")); - list.add(new ItemDto(ItemProtocol.item_pressLayerX2_interval, "压层X2间隔", "DB7.REAL716")); - list.add(new ItemDto(ItemProtocol.item_pressLayerY2_interval, "压层Y2间隔", "DB7.REAL720")); - list.add(new ItemDto(ItemProtocol.item_pressLayerX3_interval, "压层X3间隔", "DB7.REAL724")); - list.add(new ItemDto(ItemProtocol.item_pressLayerY3_interval, "压层Y3间隔", "DB7.REAL728")); - list.add(new ItemDto(ItemProtocol.item_pressLayerX1_offset, "压层X1偏移", "DB7.REAL732")); - list.add(new ItemDto(ItemProtocol.item_pressLayerY1_offset, "压层Y1偏移", "DB7.REAL736")); - list.add(new ItemDto(ItemProtocol.item_pressLayerX2_offset, "压层X2偏移", "DB7.REAL740")); - list.add(new ItemDto(ItemProtocol.item_pressLayerY2_offset, "压层Y2偏移", "DB7.REAL744")); - list.add(new ItemDto(ItemProtocol.item_pressLayerX3_offset, "压层X3偏移", "DB7.REAL748")); - list.add(new ItemDto(ItemProtocol.item_pressLayerY3_offset, "压层Y3偏移", "DB7.REAL752")); - list.add(new ItemDto(ItemProtocol.item_one_cribTotal, "1#垛总数", "DB7.D756")); - list.add(new ItemDto(ItemProtocol.item_two_cribTotal, "2#垛总数", "DB7.D760")); - list.add(new ItemDto(ItemProtocol.item_one_qty, "1#垛当前数", "DB7.D764")); - list.add(new ItemDto(ItemProtocol.item_two_qty, "2#垛当前数", "DB7.D768")); - list.add(new ItemDto(ItemProtocol.item_tool_coordinate, "工具坐标", "DB7.D772")); - return list; - } - - @Override - public List getWriteableItemDtos() { - return ItemProtocol.getWriteableItemDtos(); - } - -} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_split_manipulator/LnshSplitManipulatorDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_split_manipulator/LnshSplitManipulatorDeviceDriver.java deleted file mode 100644 index e89d1dd..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_split_manipulator/LnshSplitManipulatorDeviceDriver.java +++ /dev/null @@ -1,1022 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_split_manipulator; - -import cn.hutool.core.date.DateUtil; -import cn.hutool.core.util.IdUtil; -import cn.hutool.core.util.StrUtil; -import cn.hutool.http.HttpResponse; -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.ext.wms.service.AcsToWmsService; -import org.nl.acs.instruction.service.InstructionService; -import org.nl.acs.instruction.service.dto.Instruction; -import org.nl.acs.log.service.DeviceExecuteLogService; - -import org.nl.acs.opc.Device; -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.*; - -/** - * 晟华拆垛机械手 - */ -@Slf4j -@Data -@RequiredArgsConstructor -public class LnshSplitManipulatorDeviceDriver 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 - DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); - @Autowired - AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl"); - - int mode = 0; - int error = 0; - int last_mode = 0; - int last_error = 0; - Boolean isonline = true; - int hasGoods = 0; - String message = null; - Boolean iserror = false; - - 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; - - //触摸屏手动触发任务 - 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; - - //开机时间 - int open_time = 0; - int last_open_time = 0; - //待机时间 - int standby_time = 0; - int last_standby_time = 0; - //生产时间 - int production_time = 0; - int last_production_time = 0; - //故障时间 - int error_time = 0; - int last_error_time = 0; - int getStation = 0; - int last_getStation = 0; - String barcode; - String last_barcode; - String material; - String last_material; - int total_split = 0; - int last_total_split = 0; - - //垛型参数 - int product_code = 0; - int AlongSide = 0; - int BshortSide = 0; - int Htrapezoidal = 0; - int Wthickness = 0; - int tray_qty = 0; - int tray_high = 0; - int crib_category = 0; - float palletX1_line = 0f; - float palletY1_row = 0f; - float palletA1_angle = 0f; - float palletX2_line = 0f; - float palletY2_row = 0f; - float palletA2_angle = 0f; - float palletX3_line = 0f; - float palletY3_row = 0f; - float palletA3_angle = 0f; - float pressCribX1_line = 0f; - float pressCribY1_row = 0f; - float pressCribA1_angle = 0f; - float pressCribX2_line = 0f; - float pressCribY2_row = 0f; - float pressCribA2_angle = 0f; - float pressCribX3_line = 0f; - float pressCribY3_row = 0f; - float pressCribA3_angle = 0f; - float Zoffset = 0f; - int pallet_layerQty = 0; - int pressCrib_layerQty = 0; - float codeLayerX1_interval = 0f; - float codeLayerY1_interval = 0f; - float codeLayerX2_interval = 0f; - float codeLayerY2_interval = 0f; - float codeLayerX3_interval = 0f; - float codeLayerY3_interval = 0f; - float codeLayerX1_offset = 0f; - float codeLayerY1_offset = 0f; - float codeLayerX2_offset = 0f; - float codeLayerY2_offset = 0f; - float codeLayerX3_offset = 0f; - float codeLayerY3_offset = 0f; - float pressLayerX1_interval = 0f; - float pressLayerY1_interval = 0f; - float pressLayerX2_interval = 0f; - float pressLayerY2_interval = 0f; - float pressLayerX3_interval = 0f; - float pressLayerY3_interval = 0f; - float pressLayerX1_offset = 0f; - float pressLayerY1_offset = 0f; - float pressLayerX2_offset = 0f; - float pressLayerY2_offset = 0f; - float pressLayerX3_offset = 0f; - float pressLayerY3_offset = 0f; - int one_cribTotal = 0; - int two_cribTotal = 0; - int one_qty = 0; - int two_qty = 0; - int tool_coordinate = 0; - - int last_product_code = 0; - int last_AlongSide = 0; - int last_BshortSide = 0; - int last_Htrapezoidal = 0; - int last_Wthickness = 0; - int last_tray_qty = 0; - int last_tray_high = 0; - int last_crib_category = 0; - float last_palletX1_line = 0f; - float last_palletY1_row = 0f; - float last_palletA1_angle = 0f; - float last_palletX2_line = 0f; - float last_palletY2_row = 0f; - float last_palletA2_angle = 0f; - float last_palletX3_line = 0f; - float last_palletY3_row = 0f; - float last_palletA3_angle = 0f; - float last_pressCribX1_line = 0f; - float last_pressCribY1_row = 0f; - float last_pressCribA1_angle = 0f; - float last_pressCribX2_line = 0f; - float last_pressCribY2_row = 0f; - float last_pressCribA2_angle = 0f; - float last_pressCribX3_line = 0f; - float last_pressCribY3_row = 0f; - float last_pressCribA3_angle = 0f; - float last_Zoffset = 0f; - int last_pallet_layerQty = 0; - int last_pressCrib_layerQty = 0; - float last_codeLayerX1_interval = 0f; - float last_codeLayerY1_interval = 0f; - float last_codeLayerX2_interval = 0f; - float last_codeLayerY2_interval = 0f; - float last_codeLayerX3_interval = 0f; - float last_codeLayerY3_interval = 0f; - float last_codeLayerX1_offset = 0f; - float last_codeLayerY1_offset = 0f; - float last_codeLayerX2_offset = 0f; - float last_codeLayerY2_offset = 0f; - float last_codeLayerX3_offset = 0f; - float last_codeLayerY3_offset = 0f; - float last_pressLayerX1_interval = 0f; - float last_pressLayerY1_interval = 0f; - float last_pressLayerX2_interval = 0f; - float last_pressLayerY2_interval = 0f; - float last_pressLayerX3_interval = 0f; - float last_pressLayerY3_interval = 0f; - float last_pressLayerX1_offset = 0f; - float last_pressLayerY1_offset = 0f; - float last_pressLayerX2_offset = 0f; - float last_pressLayerY2_offset = 0f; - float last_pressLayerX3_offset = 0f; - float last_pressLayerY3_offset = 0f; - int last_one_cribTotal = 0; - int last_two_cribTotal = 0; - int last_one_qty = 0; - int last_two_qty = 0; - int last_tool_coordinate = 0; - - @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(); - getStation = this.itemProtocol.getGetStation(); - barcode = this.itemProtocol.getBarcode(); - material = this.itemProtocol.getMaterial(); - open_time = this.itemProtocol.getOpen_time(); - standby_time = this.itemProtocol.getStandby_time(); - production_time = this.itemProtocol.getProduction_time(); - error_time = this.itemProtocol.getError_time(); - total_split = this.itemProtocol.getTotal_split(); - - product_code = this.itemProtocol.getProduct_code(); - AlongSide = this.itemProtocol.getAlongSide(); - BshortSide = this.itemProtocol.getBshortSide(); - Htrapezoidal = this.itemProtocol.getHtrapezoidal(); - Wthickness = this.itemProtocol.getWthickness(); - tray_qty = this.itemProtocol.getTray_qty(); - tray_high = this.itemProtocol.getTray_high(); - crib_category = this.itemProtocol.getCrib_category(); - palletX1_line = this.itemProtocol.getPalletX1_line(); - palletY1_row = this.itemProtocol.getPalletY1_row(); - palletA1_angle = this.itemProtocol.getPalletA1_angle(); - palletX2_line = this.itemProtocol.getPalletX2_line(); - palletY2_row = this.itemProtocol.getPalletY2_row(); - palletA2_angle = this.itemProtocol.getPalletA2_angle(); - palletX3_line = this.itemProtocol.getPalletX3_line(); - palletY3_row = this.itemProtocol.getPalletY3_row(); - palletA3_angle = this.itemProtocol.getPalletA3_angle(); - pressCribX1_line = this.itemProtocol.getPressCribX1_line(); - pressCribY1_row = this.itemProtocol.getPressCribY1_row(); - pressCribA1_angle = this.itemProtocol.getPressCribA1_angle(); - pressCribX2_line = this.itemProtocol.getPressCribX2_line(); - pressCribY2_row = this.itemProtocol.getPressCribY2_row(); - pressCribA2_angle = this.itemProtocol.getPressCribA2_angle(); - pressCribX3_line = this.itemProtocol.getPressCribX3_line(); - pressCribY3_row = this.itemProtocol.getPressCribY3_row(); - pressCribA3_angle = this.itemProtocol.getPressCribA3_angle(); - Zoffset = this.itemProtocol.getZoffset(); - pallet_layerQty = this.itemProtocol.getPallet_layerQty(); - pressCrib_layerQty = this.itemProtocol.getPressCrib_layerQty(); - codeLayerX1_interval = this.itemProtocol.getCodeLayerX1_interval(); - codeLayerY1_interval = this.itemProtocol.getCodeLayerY1_interval(); - codeLayerX2_interval = this.itemProtocol.getCodeLayerX2_interval(); - codeLayerY2_interval = this.itemProtocol.getCodeLayerY2_interval(); - codeLayerX3_interval = this.itemProtocol.getCodeLayerX3_interval(); - codeLayerY3_interval = this.itemProtocol.getcodeLayerY3_interval(); - codeLayerX1_offset = this.itemProtocol.getCodeLayerX1_offset(); - codeLayerY1_offset = this.itemProtocol.getCodeLayerY1_offset(); - codeLayerX2_offset = this.itemProtocol.getCodeLayerX2_offset(); - codeLayerY2_offset = this.itemProtocol.getCodeLayerY2_offset(); - codeLayerX3_offset = this.itemProtocol.getCodeLayerX3_offset(); - codeLayerY3_offset = this.itemProtocol.getCodeLayerY3_offset(); - pressLayerX1_interval = this.itemProtocol.getPressLayerX1_interval(); - pressLayerY1_interval = this.itemProtocol.getPressLayerY1_interval(); - pressLayerX2_interval = this.itemProtocol.getPressLayerX2_interval(); - pressLayerY2_interval = this.itemProtocol.getPressLayerY2_interval(); - pressLayerX3_interval = this.itemProtocol.getPressLayerX3_interval(); - pressLayerY3_interval = this.itemProtocol.getPressLayerY3_interval(); - pressLayerX1_offset = this.itemProtocol.getPressLayerX1_offset(); - pressLayerY1_offset = this.itemProtocol.getPressLayerY1_offset(); - pressLayerX2_offset = this.itemProtocol.getPressLayerX2_offset(); - pressLayerY2_offset = this.itemProtocol.getPressLayerY2_offset(); - pressLayerX3_offset = this.itemProtocol.getPressLayerX3_offset(); - pressLayerY3_offset = this.itemProtocol.getPressLayerY3_offset(); - one_cribTotal = this.itemProtocol.getOne_cribTotal(); - two_cribTotal = this.itemProtocol.getTwo_cribTotal(); - one_qty = this.itemProtocol.getOne_qty(); - two_qty = this.itemProtocol.getTwo_qty(); - tool_coordinate = this.itemProtocol.getTool_coordinate(); - - if (mode != last_mode) { - this.setRequireSucess(false); - logServer.deviceItemValue(this.device_code,"mode" ,String.valueOf(mode)); - logServer.deviceExecuteLog(this.device_code,"","","信号mode:" + last_mode + "->" + mode); - } - if (getStation != last_getStation) { - logServer.deviceItemValue(this.device_code,"getStation" ,String.valueOf(getStation)); - logServer.deviceExecuteLog(this.device_code,"","","信号getStation:" + last_getStation + "->" + getStation); - } - if (error != last_error) { - logServer.deviceItemValue(this.device_code,"error" ,String.valueOf(error)); - logServer.deviceExecuteLog(this.device_code,"","","信号error:" + last_error + "->" + error); - } - if (open_time != last_open_time) { - logServer.deviceItemValue(this.device_code,"open_time" ,String.valueOf(open_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号open_time:" + last_open_time + "->" + open_time); - } - if (standby_time != last_standby_time) { - logServer.deviceItemValue(this.device_code,"standby_time" ,String.valueOf(standby_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号standby_time:" + last_standby_time + "->" + standby_time); - } - if (production_time != last_production_time) { - logServer.deviceItemValue(this.device_code,"production_time" ,String.valueOf(production_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号production_time:" + last_production_time + "->" + production_time); - } - if (error_time != last_error_time) { - logServer.deviceItemValue(this.device_code,"error_time" ,String.valueOf(error_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号error_time:" + last_error_time + "->" + error_time); - } - if (!StrUtil.equals(barcode,last_barcode)) { - logServer.deviceItemValue(this.device_code,"barcode", barcode); - logServer.deviceExecuteLog(this.device_code,"","","信号barcode:" + last_barcode + "->" + barcode); - } - if (!StrUtil.equals(material,last_material)) { - logServer.deviceItemValue(this.device_code,"material", material); - logServer.deviceExecuteLog(this.device_code,"","","信号material:" + last_material + "->" + material); - } - if (total_split != last_total_split) { - logServer.deviceItemValue(this.device_code,"total_split" ,String.valueOf(total_split)); - logServer.deviceExecuteLog(this.device_code,"","","信号total_split:" + last_total_split + "->" + total_split); - } - if (product_code != last_product_code) { - logServer.deviceItemValue(this.device_code,"product_code" ,String.valueOf(product_code)); - logServer.deviceExecuteLog(this.device_code,"","","信号product_code:" + last_product_code + "->" + product_code); - } - if (AlongSide != last_AlongSide) { - logServer.deviceItemValue(this.device_code,"AlongSide" ,String.valueOf(AlongSide)); - logServer.deviceExecuteLog(this.device_code,"","","信号AlongSide:" + last_AlongSide + "->" + AlongSide); - } - if (BshortSide != last_BshortSide) { - logServer.deviceItemValue(this.device_code,"BshortSide" ,String.valueOf(BshortSide)); - logServer.deviceExecuteLog(this.device_code,"","","信号BshortSide:" + last_BshortSide + "->" + BshortSide); - } - if (Htrapezoidal != last_Htrapezoidal) { - logServer.deviceItemValue(this.device_code,"Htrapezoidal" ,String.valueOf(Htrapezoidal)); - logServer.deviceExecuteLog(this.device_code,"","","信号Htrapezoidal:" + last_Htrapezoidal + "->" + Htrapezoidal); - } - if (Wthickness != last_Wthickness) { - logServer.deviceItemValue(this.device_code,"Wthickness" ,String.valueOf(Wthickness)); - logServer.deviceExecuteLog(this.device_code,"","","信号Wthickness:" + last_Wthickness + "->" + Wthickness); - } - if (tray_qty != last_tray_qty) { - logServer.deviceItemValue(this.device_code,"tray_qty" ,String.valueOf(tray_qty)); - logServer.deviceExecuteLog(this.device_code,"","","信号tray_qty:" + last_tray_qty + "->" + tray_qty); - } - if (tray_high != last_tray_high) { - logServer.deviceItemValue(this.device_code,"tray_high" ,String.valueOf(tray_high)); - logServer.deviceExecuteLog(this.device_code,"","","信号tray_high:" + last_tray_high + "->" + tray_high); - } - if (crib_category != last_crib_category) { - logServer.deviceItemValue(this.device_code,"crib_category" ,String.valueOf(crib_category)); - logServer.deviceExecuteLog(this.device_code,"","","信号crib_category:" + last_crib_category + "->" + crib_category); - } - if (palletX1_line != last_palletX1_line) { - logServer.deviceItemValue(this.device_code,"palletX1_line" ,String.valueOf(palletX1_line)); - logServer.deviceExecuteLog(this.device_code,"","","信号palletX1_line:" + last_palletX1_line + "->" + palletX1_line); - } - if (palletY1_row != last_palletY1_row) { - logServer.deviceItemValue(this.device_code,"palletY1_row" ,String.valueOf(palletY1_row)); - logServer.deviceExecuteLog(this.device_code,"","","信号palletY1_row:" + last_palletY1_row + "->" + palletY1_row); - } - if (palletA1_angle != last_palletA1_angle) { - logServer.deviceItemValue(this.device_code,"palletA1_angle" ,String.valueOf(palletA1_angle)); - logServer.deviceExecuteLog(this.device_code,"","","信号palletA1_angle:" + last_palletA1_angle + "->" + palletA1_angle); - } - if (palletX2_line != last_palletX2_line) { - logServer.deviceItemValue(this.device_code,"palletX2_line" ,String.valueOf(palletX2_line)); - logServer.deviceExecuteLog(this.device_code,"","","信号palletX2_line:" + last_palletX2_line + "->" + palletX2_line); - } - if (palletY2_row != last_palletY2_row) { - logServer.deviceItemValue(this.device_code,"palletY2_row" ,String.valueOf(palletY2_row)); - logServer.deviceExecuteLog(this.device_code,"","","信号palletY2_row:" + last_palletY2_row + "->" + palletY2_row); - } - if (palletA2_angle != last_palletA2_angle) { - logServer.deviceItemValue(this.device_code,"palletA2_angle" ,String.valueOf(palletA2_angle)); - logServer.deviceExecuteLog(this.device_code,"","","信号palletA2_angle:" + last_palletA2_angle + "->" + palletA2_angle); - } - if (palletX3_line != last_palletX3_line) { - logServer.deviceItemValue(this.device_code,"palletX3_line" ,String.valueOf(palletX3_line)); - logServer.deviceExecuteLog(this.device_code,"","","信号palletX3_line:" + last_palletX3_line + "->" + palletX3_line); - } - if (palletY3_row != last_palletY3_row) { - logServer.deviceItemValue(this.device_code,"palletY3_row" ,String.valueOf(palletY3_row)); - logServer.deviceExecuteLog(this.device_code,"","","信号palletY3_row:" + last_palletY3_row + "->" + palletY3_row); - } - if (palletA3_angle != last_palletA3_angle) { - logServer.deviceItemValue(this.device_code,"palletA3_angle" ,String.valueOf(palletA3_angle)); - logServer.deviceExecuteLog(this.device_code,"","","信号palletA3_angle:" + last_palletA3_angle + "->" + palletA3_angle); - } - if (pressCribX1_line != last_pressCribX1_line) { - logServer.deviceItemValue(this.device_code,"pressCribX1_line" ,String.valueOf(pressCribX1_line)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCribX1_line:" + last_pressCribX1_line + "->" + pressCribX1_line); - } - if (pressCribY1_row != last_pressCribY1_row) { - logServer.deviceItemValue(this.device_code,"pressCribY1_row" ,String.valueOf(pressCribY1_row)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCribY1_row:" + last_pressCribY1_row + "->" + pressCribY1_row); - } - if (pressCribA1_angle != last_pressCribA1_angle) { - logServer.deviceItemValue(this.device_code,"pressCribA1_angle" ,String.valueOf(pressCribA1_angle)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCribA1_angle:" + last_pressCribA1_angle + "->" + pressCribA1_angle); - } - if (pressCribX2_line != last_pressCribX2_line) { - logServer.deviceItemValue(this.device_code,"pressCribX2_line" ,String.valueOf(pressCribX2_line)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCribX2_line:" + last_pressCribX2_line + "->" + pressCribX2_line); - } - if (pressCribY2_row != last_pressCribY2_row) { - logServer.deviceItemValue(this.device_code,"pressCribY2_row" ,String.valueOf(pressCribY2_row)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCribY2_row:" + last_pressCribY2_row + "->" + pressCribY2_row); - } - if (pressCribA2_angle != last_pressCribA2_angle) { - logServer.deviceItemValue(this.device_code,"pressCribA2_angle" ,String.valueOf(pressCribA2_angle)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCribA2_angle:" + last_pressCribA2_angle + "->" + pressCribA2_angle); - } - if (pressCribX3_line != last_pressCribX3_line) { - logServer.deviceItemValue(this.device_code,"pressCribX3_line" ,String.valueOf(pressCribX3_line)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCribX3_line:" + last_pressCribX3_line + "->" + pressCribX3_line); - } - if (pressCribY3_row != last_pressCribY3_row) { - logServer.deviceItemValue(this.device_code,"pressCribY3_row" ,String.valueOf(pressCribY3_row)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCribY3_row:" + last_pressCribY3_row + "->" + pressCribY3_row); - } - if (pressCribA3_angle != last_pressCribA3_angle) { - logServer.deviceItemValue(this.device_code,"pressCribA3_angle" ,String.valueOf(pressCribA3_angle)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCribA3_angle:" + last_pressCribA3_angle + "->" + pressCribA3_angle); - } - if (Zoffset != last_Zoffset) { - logServer.deviceItemValue(this.device_code,"Zoffset" ,String.valueOf(Zoffset)); - logServer.deviceExecuteLog(this.device_code,"","","信号Zoffset:" + last_Zoffset + "->" + Zoffset); - } - if (pallet_layerQty != last_pallet_layerQty) { - logServer.deviceItemValue(this.device_code,"pallet_layerQty" ,String.valueOf(pallet_layerQty)); - logServer.deviceExecuteLog(this.device_code,"","","信号pallet_layerQty:" + last_pallet_layerQty + "->" + pallet_layerQty); - } - if (pressCrib_layerQty != last_pressCrib_layerQty) { - logServer.deviceItemValue(this.device_code,"pressCrib_layerQty" ,String.valueOf(pressCrib_layerQty)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCrib_layerQty:" + last_pressCrib_layerQty + "->" + pressCrib_layerQty); - } - if (codeLayerX1_interval != last_codeLayerX1_interval) { - logServer.deviceItemValue(this.device_code,"codeLayerX1_interval" ,String.valueOf(codeLayerX1_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerX1_interval:" + last_codeLayerX1_interval + "->" + codeLayerX1_interval); - } - if (codeLayerY1_interval != last_codeLayerY1_interval) { - logServer.deviceItemValue(this.device_code,"codeLayerY1_interval" ,String.valueOf(codeLayerY1_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerY1_interval:" + last_codeLayerY1_interval + "->" + codeLayerY1_interval); - } - if (codeLayerX2_interval != last_codeLayerX2_interval) { - logServer.deviceItemValue(this.device_code,"codeLayerX2_interval" ,String.valueOf(codeLayerX2_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerX2_interval:" + last_codeLayerX2_interval + "->" + codeLayerX2_interval); - } - if (codeLayerY2_interval != last_codeLayerY2_interval) { - logServer.deviceItemValue(this.device_code,"codeLayerY2_interval" ,String.valueOf(codeLayerY2_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerY2_interval:" + last_codeLayerY2_interval + "->" + codeLayerY2_interval); - } - if (codeLayerX3_interval != last_codeLayerX3_interval) { - logServer.deviceItemValue(this.device_code,"codeLayerX3_interval" ,String.valueOf(codeLayerX3_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerX3_interval:" + last_codeLayerX3_interval + "->" + codeLayerX3_interval); - } - if (codeLayerY3_interval != last_codeLayerY3_interval) { - logServer.deviceItemValue(this.device_code,"codeLayerY3_interval" ,String.valueOf(codeLayerY3_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerY3_interval:" + last_codeLayerY3_interval + "->" + codeLayerY3_interval); - } - if (codeLayerX1_offset != last_codeLayerX1_offset) { - logServer.deviceItemValue(this.device_code,"codeLayerX1_offset" ,String.valueOf(codeLayerX1_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerX1_offset:" + last_codeLayerX1_offset + "->" + codeLayerX1_offset); - } - if (codeLayerY1_offset != last_codeLayerY1_offset) { - logServer.deviceItemValue(this.device_code,"codeLayerY1_offset" ,String.valueOf(codeLayerY1_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerY1_offset:" + last_codeLayerY1_offset + "->" + codeLayerY1_offset); - } - if (codeLayerX2_offset != last_codeLayerX2_offset) { - logServer.deviceItemValue(this.device_code,"codeLayerX2_offset" ,String.valueOf(codeLayerX2_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerX2_offset:" + last_codeLayerX2_offset + "->" + codeLayerX2_offset); - } - if (codeLayerY2_offset != last_codeLayerY2_offset) { - logServer.deviceItemValue(this.device_code,"codeLayerY2_offset" ,String.valueOf(codeLayerY2_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerY2_offset:" + last_codeLayerY2_offset + "->" + codeLayerY2_offset); - } - if (codeLayerX3_offset != last_codeLayerX3_offset) { - logServer.deviceItemValue(this.device_code,"codeLayerX3_offset" ,String.valueOf(codeLayerX3_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerX3_offset:" + last_codeLayerX3_offset + "->" + codeLayerX3_offset); - } - if (codeLayerY3_offset != last_codeLayerY3_offset) { - logServer.deviceItemValue(this.device_code,"codeLayerY3_offset" ,String.valueOf(codeLayerY3_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerY3_offset:" + last_codeLayerY3_offset + "->" + codeLayerY3_offset); - } - if (pressLayerX1_interval != last_pressLayerX1_interval) { - logServer.deviceItemValue(this.device_code,"pressLayerX1_interval" ,String.valueOf(pressLayerX1_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerX1_interval:" + last_pressLayerX1_interval + "->" + pressLayerX1_interval); - } - if (pressLayerY1_interval != last_pressLayerY1_interval) { - logServer.deviceItemValue(this.device_code,"pressLayerY1_interval" ,String.valueOf(pressLayerY1_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerY1_interval:" + last_pressLayerY1_interval + "->" + pressLayerY1_interval); - } - if (pressLayerX2_interval != last_pressLayerX2_interval) { - logServer.deviceItemValue(this.device_code,"pressLayerX2_interval" ,String.valueOf(pressLayerX2_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerX2_interval:" + last_pressLayerX2_interval + "->" + pressLayerX2_interval); - } - if (pressLayerY2_interval != last_pressLayerY2_interval) { - logServer.deviceItemValue(this.device_code,"pressLayerY2_interval" ,String.valueOf(pressLayerY2_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerY2_interval:" + last_pressLayerY2_interval + "->" + pressLayerY2_interval); - } - if (pressLayerX3_interval != last_pressLayerX3_interval) { - logServer.deviceItemValue(this.device_code,"pressLayerX3_interval" ,String.valueOf(pressLayerX3_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerX3_interval:" + last_pressLayerX3_interval + "->" + pressLayerX3_interval); - } - if (pressLayerY3_interval != last_pressLayerY3_interval) { - logServer.deviceItemValue(this.device_code,"pressLayerY3_interval" ,String.valueOf(pressLayerY3_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerY3_interval:" + last_pressLayerY3_interval + "->" + pressLayerY3_interval); - } - if (pressLayerX1_offset != last_pressLayerX1_offset) { - logServer.deviceItemValue(this.device_code,"pressLayerX1_offset" ,String.valueOf(pressLayerX1_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerX1_offset:" + last_pressLayerX1_offset + "->" + pressLayerX1_offset); - } - if (pressLayerY1_offset != last_pressLayerY1_offset) { - logServer.deviceItemValue(this.device_code,"pressLayerY1_offset" ,String.valueOf(pressLayerY1_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerY1_offset:" + last_pressLayerY1_offset + "->" + pressLayerY1_offset); - } - if (pressLayerX2_offset != last_pressLayerX2_offset) { - logServer.deviceItemValue(this.device_code,"pressLayerX2_offset" ,String.valueOf(pressLayerX2_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerX2_offset:" + last_pressLayerX2_offset + "->" + pressLayerX2_offset); - } - if (pressLayerY2_offset != last_pressLayerY2_offset) { - logServer.deviceItemValue(this.device_code,"pressLayerY2_offset" ,String.valueOf(pressLayerY2_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerY2_offset:" + last_pressLayerY2_offset + "->" + pressLayerY2_offset); - } - if (pressLayerX3_offset != last_pressLayerX3_offset) { - logServer.deviceItemValue(this.device_code,"pressLayerX3_offset" ,String.valueOf(pressLayerX3_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerX3_offset:" + last_pressLayerX3_offset + "->" + pressLayerX3_offset); - } - if (pressLayerY3_offset != last_pressLayerY3_offset) { - logServer.deviceItemValue(this.device_code,"pressLayerY3_offset" ,String.valueOf(pressLayerY3_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerY3_offset:" + last_pressLayerY3_offset + "->" + pressLayerY3_offset); - } - if (one_cribTotal != last_one_cribTotal) { - logServer.deviceItemValue(this.device_code,"one_cribTotal" ,String.valueOf(one_cribTotal)); - logServer.deviceExecuteLog(this.device_code,"","","信号one_cribTotal:" + last_one_cribTotal + "->" + one_cribTotal); - } - if (two_cribTotal != last_two_cribTotal) { - logServer.deviceItemValue(this.device_code,"two_cribTotal" ,String.valueOf(two_cribTotal)); - logServer.deviceExecuteLog(this.device_code,"","","信号two_cribTotal:" + last_two_cribTotal + "->" + two_cribTotal); - } - if (one_qty != last_one_qty) { - logServer.deviceItemValue(this.device_code,"one_qty" ,String.valueOf(one_qty)); - logServer.deviceExecuteLog(this.device_code,"","","信号one_qty:" + last_one_qty + "->" + one_qty); - } - if (two_qty != last_two_qty) { - logServer.deviceItemValue(this.device_code,"two_qty" ,String.valueOf(two_qty)); - logServer.deviceExecuteLog(this.device_code,"","","信号two_qty:" + last_two_qty + "->" + two_qty); - } - if (tool_coordinate != last_tool_coordinate) { - logServer.deviceItemValue(this.device_code,"tool_coordinate" ,String.valueOf(tool_coordinate)); - logServer.deviceExecuteLog(this.device_code,"","","信号tool_coordinate:" + last_tool_coordinate + "->" + tool_coordinate); - } - - } 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; - case 5: - //获取托盘信息 - if (!requireSucess) { - getVehicle(); - } - break; - case 6: - //拆垛完成 - if (!requireSucess) { - palletizing(); - } - break; - case 7: - //申请出库 - if (!requireSucess) { - callMaterial(); - } - break; - case 8: - //申请空盘 - if (!requireSucess) { - applyEmpty(); - } - break; - } - - switch (flag) { - //取货完成 - case 1: - writing(2); - return; - //放货完成 - case 2: - writing(3); - return; - - } - - } - last_mode = mode; - last_error = error; - last_getStation = getStation; - last_barcode = barcode; - last_material = material; - last_open_time = open_time; - last_standby_time = standby_time; - last_production_time = production_time; - last_error_time = error_time; - last_total_split = total_split; - - last_product_code = product_code; - last_AlongSide = AlongSide; - last_BshortSide = BshortSide; - last_Htrapezoidal = Htrapezoidal; - last_Wthickness = Wthickness; - last_tray_qty = tray_qty; - last_tray_high = tray_high; - last_crib_category = crib_category; - last_palletX1_line = palletX1_line; - last_palletY1_row = palletY1_row; - last_palletA1_angle = palletA1_angle; - last_palletX2_line = palletX2_line; - last_palletY2_row = palletY2_row; - last_palletA2_angle = palletA2_angle; - last_palletX3_line = palletX3_line; - last_palletY3_row = palletY3_row; - last_palletA3_angle = palletA3_angle; - last_pressCribX1_line = pressCribX1_line; - last_pressCribY1_row = pressCribY1_row; - last_pressCribA1_angle = pressCribA1_angle; - last_pressCribX2_line = pressCribX2_line; - last_pressCribY2_row = pressCribY2_row; - last_pressCribA2_angle = pressCribA2_angle; - last_pressCribX3_line = pressCribX3_line; - last_pressCribY3_row = pressCribY3_row; - last_pressCribA3_angle = pressCribA3_angle; - last_Zoffset = Zoffset; - last_pallet_layerQty = pallet_layerQty; - last_pressCrib_layerQty = pressCrib_layerQty; - last_codeLayerX1_interval = codeLayerX1_interval; - last_codeLayerY1_interval = codeLayerY1_interval; - last_codeLayerX2_interval = codeLayerX2_interval; - last_codeLayerY2_interval = codeLayerY2_interval; - last_codeLayerX3_interval = codeLayerX3_interval; - last_codeLayerY3_interval = codeLayerY3_interval; - last_codeLayerX1_offset = codeLayerX1_offset; - last_codeLayerY1_offset = codeLayerY1_offset; - last_codeLayerX2_offset = codeLayerX2_offset; - last_codeLayerY2_offset = codeLayerY2_offset; - last_codeLayerX3_offset = codeLayerX3_offset; - last_codeLayerY3_offset = codeLayerY3_offset; - last_pressLayerX1_interval = pressLayerX1_interval; - last_pressLayerY1_interval = pressLayerY1_interval; - last_pressLayerX2_interval = pressLayerX2_interval; - last_pressLayerY2_interval = pressLayerY2_interval; - last_pressLayerX3_interval = pressLayerX3_interval; - last_pressLayerY3_interval = pressLayerY3_interval; - last_pressLayerX1_offset = pressLayerX1_offset; - last_pressLayerY1_offset = pressLayerY1_offset; - last_pressLayerX2_offset = pressLayerX2_offset; - last_pressLayerY2_offset = pressLayerY2_offset; - last_pressLayerX3_offset = pressLayerX3_offset; - last_pressLayerY3_offset = pressLayerY3_offset; - last_one_cribTotal = one_cribTotal; - last_two_cribTotal = two_cribTotal; - last_one_qty = one_qty; - last_two_qty = two_qty; - last_tool_coordinate = tool_coordinate; - } - - - public boolean exe_error() { - if (this.error == 0) { - return true; - } else { - log.debug("设备报警"); - return false; - } - } - - /** - * 获取托盘信息 - * - * @param - */ - public synchronized boolean getVehicle() { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - JSONObject json = new JSONObject(); - String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code"); - String demosub = linkobj.substring(1,linkobj.length()-1); - String demoArray[] = demosub.split(","); - List demoList = Arrays.asList(demoArray); - json.put("device_code",demoList.get(getStation-1).replace("\"","")); - json.put("vehicle_code",barcode); - JSONObject jo = acsToWmsService.getVehicle(json); - - if (jo.getInteger("status") == 200) { - JSONObject content = jo.getJSONObject("data"); - String qty = content.getString("qty"); - String material_code = content.getString("material_code"); - String material_name = content.getString("material_name"); - String product_code = content.getString("product_code"); - String AlongSide = content.getString("AlongSide"); - String BshortSide = content.getString("BshortSide"); - String Htrapezoidal = content.getString("Htrapezoidal"); - String Wthickness = content.getString("Wthickness"); - String tray_qty = content.getString("tray_qty"); - String tray_high = content.getString("tray_high"); - String crib_category = content.getString("crib_category"); - String palletX1_line = content.getString("palletX1_line"); - String palletY1_row = content.getString("palletY1_row"); - String palletA1_angle = content.getString("palletA1_angle"); - String palletX2_line = content.getString("palletX2_line"); - String palletY2_row = content.getString("palletY2_row"); - String palletA2_angle = content.getString("palletA2_angle"); - String palletX3_line = content.getString("palletX3_line"); - String palletY3_row = content.getString("palletY3_row"); - String palletA3_angle = content.getString("palletA3_angle"); - String pressCribX1_line = content.getString("pressCribX1_line"); - String pressCribY1_row = content.getString("pressCribY1_row"); - String pressCribA1_angle = content.getString("pressCribA1_angle"); - String pressCribX2_line = content.getString("pressCribX2_line"); - String pressCribY2_row = content.getString("pressCribY2_row"); - String pressCribA2_angle = content.getString("pressCribA2_angle"); - String pressCribX3_line = content.getString("pressCribX3_line"); - String pressCribY3_row = content.getString("pressCribY3_row"); - String pressCribA3_angle = content.getString("pressCribA3_angle"); - String Zoffset = content.getString("Zoffset"); - String pallet_layerQty = content.getString("pallet_layerQty"); - String pressCrib_layerQty = content.getString("pressCrib_layerQty"); - String codeLayerX1_interval = content.getString("codeLayerX1_interval"); - String codeLayerY1_interval = content.getString("codeLayerY1_interval"); - String codeLayerX2_interval = content.getString("codeLayerX2_interval"); - String codeLayerY2_interval = content.getString("codeLayerY2_interval"); - String codeLayerX3_interval = content.getString("codeLayerX3_interval"); - String codeLayerY3_interval = content.getString("codeLayerY3_interval"); - String codeLayerX1_offset = content.getString("codeLayerX1_offset"); - String codeLayerY1_offset = content.getString("codeLayerY1_offset"); - String codeLayerX2_offset = content.getString("codeLayerX2_offset"); - String codeLayerY2_offset = content.getString("codeLayerY2_offset"); - String codeLayerX3_offset = content.getString("codeLayerX3_offset"); - String codeLayerY3_offset = content.getString("codeLayerY3_offset"); - String pressLayerX1_interval = content.getString("pressLayerX1_interval"); - String pressLayerY1_interval = content.getString("pressLayerY1_interval"); - String pressLayerX2_interval = content.getString("pressLayerX2_interval"); - String pressLayerY2_interval = content.getString("pressLayerY2_interval"); - String pressLayerX3_interval = content.getString("pressLayerX3_interval"); - String pressLayerY3_interval = content.getString("pressLayerY3_interval"); - String pressLayerX1_offset = content.getString("pressLayerX1_offset"); - String pressLayerY1_offset = content.getString("pressLayerY1_offset"); - String pressLayerX2_offset = content.getString("pressLayerX2_offset"); - String pressLayerY2_offset = content.getString("pressLayerY2_offset"); - String pressLayerX3_offset = content.getString("pressLayerX3_offset"); - String pressLayerY3_offset = content.getString("pressLayerY3_offset"); - String one_cribTotal = content.getString("one_cribTotal"); - String two_cribTotal = content.getString("two_cribTotal"); - String one_qty = content.getString("one_qty"); - String two_qty = content.getString("two_qty"); - String tool_coordinate = content.getString("tool_coordinate"); - - this.writing("to_material",material_code); - this.writing("to_AlongSide",AlongSide); - this.writing("to_BshortSide",BshortSide); - this.writing("to_Htrapezoidal",Htrapezoidal); - this.writing("to_Wthickness",Wthickness); - this.writing("to_tray_qty",tray_qty); - this.writing("to_tray_high",tray_high); - this.writing("to_crib_category",crib_category); - this.writing("to_palletX1_line",palletX1_line); - this.writing("to_palletY1_row",palletY1_row); - this.writing("to_palletA1_angle",palletA1_angle); - this.writing("to_palletX2_line",palletX2_line); - this.writing("to_palletY2_row",palletY2_row); - this.writing("to_palletA2_angle",palletA2_angle); - this.writing("to_palletX3_line",palletX3_line); - this.writing("to_palletY3_row",palletY3_row); - this.writing("to_palletA3_angle",palletA3_angle); - this.writing("to_pressCribX1_line",pressCribX1_line); - this.writing("to_pressCribY1_row",pressCribY1_row); - this.writing("to_pressCribA1_angle",pressCribA1_angle); - this.writing("to_pressCribX2_line",pressCribX2_line); - this.writing("to_pressCribY2_row",pressCribY2_row); - this.writing("to_pressCribA2_angle",pressCribA2_angle); - this.writing("to_pressCribX3_line",pressCribX3_line); - this.writing("to_pressCribY3_row",pressCribY3_row); - this.writing("to_pressCribA3_angle",pressCribA3_angle); - this.writing("to_Zoffset",Zoffset); - this.writing("to_pallet_layerQty",pallet_layerQty); - this.writing("to_pressCrib_layerQty",pressCrib_layerQty); - this.writing("to_codeLayerX1_interval",codeLayerX1_interval); - this.writing("to_codeLayerY1_interval",codeLayerY1_interval); - this.writing("to_codeLayerX2_interval",codeLayerX2_interval); - this.writing("to_codeLayerY2_interval",codeLayerY2_interval); - this.writing("to_codeLayerX3_interval",codeLayerX3_interval); - this.writing("to_codeLayerY3_interval",codeLayerY3_interval); - this.writing("to_codeLayerX1_offset",codeLayerX1_offset); - this.writing("to_codeLayerY1_offset",codeLayerY1_offset); - this.writing("to_codeLayerX2_offset",codeLayerX2_offset); - this.writing("to_codeLayerY2_offset",codeLayerY2_offset); - this.writing("to_codeLayerX3_offset",codeLayerX3_offset); - this.writing("to_codeLayerY3_offset",codeLayerY3_offset); - this.writing("to_pressLayerX1_interval",pressLayerX1_interval); - this.writing("to_pressLayerY1_interval",pressLayerY1_interval); - this.writing("to_pressLayerX2_interval",pressLayerX2_interval); - this.writing("to_pressLayerY2_interval",pressLayerY2_interval); - this.writing("to_pressLayerX3_interval",pressLayerX3_interval); - this.writing("to_pressLayerY3_interval",pressLayerY3_interval); - this.writing("to_pressLayerX1_offset",pressLayerX1_offset); - this.writing("to_pressLayerY1_offset",pressLayerY1_offset); - this.writing("to_pressLayerX2_offset",pressLayerX2_offset); - this.writing("to_pressLayerY2_offset",pressLayerY2_offset); - this.writing("to_pressLayerX3_offset",pressLayerX3_offset); - this.writing("to_pressLayerY3_offset",pressLayerY3_offset); - this.writing("to_one_cribTotal",one_cribTotal); - this.writing("to_two_cribTotal",two_cribTotal); - this.writing("to_one_qty",one_qty); - this.writing("to_two_qty",two_qty); - this.writing("to_tool_coordinate",tool_coordinate); - this.writing(this.mode); - requireSucess = true; - } - return true; - } - } - - /** - * 拆垛完成 - * - * @param - */ - public synchronized boolean palletizing() { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - JSONObject json = new JSONObject(); - String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code"); - String demosub = linkobj.substring(1,linkobj.length()-1); - String demoArray[] = demosub.split(","); - List demoList = Arrays.asList(demoArray); - json.put("device_code",demoList.get(getStation-1).replace("\"","")); - json.put("type","3"); - json.put("qty",total_split); - json.put("vehicle_code",barcode); - HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); - if (result.getStatus() == 200) { - this.writing(this.mode); - requireSucess = true; - } - return true; - } - } - - /** - * 叫料 - * - * @param - */ - public synchronized boolean callMaterial() { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - JSONObject json = new JSONObject(); - String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code"); - String demosub = linkobj.substring(1,linkobj.length()-1); - String demoArray[] = demosub.split(","); - List demoList = Arrays.asList(demoArray); - json.put("device_code",demoList.get(getStation-1).replace("\"","")); json.put("type","2"); - json.put("is_full","1"); - HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); - if (result.getStatus() == 200) { - this.writing(this.mode); - requireSucess = true; - } - return true; - } - } - - /** - * 申请空盘 - * - * @param - */ - public synchronized boolean applyEmpty() { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - JSONObject json = new JSONObject(); - String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code"); - String demosub = linkobj.substring(1,linkobj.length()-1); - String demoArray[] = demosub.split(","); - List demoList = Arrays.asList(demoArray); - json.put("device_code",demoList.get(getStation-1).replace("\"","")); - json.put("type","4"); - json.put("qty",total_split); - json.put("vehicle_code",barcode); - HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); - if (result.getStatus() == 200) { - this.writing(this.mode); - } - - requireSucess = true; - return true; - } - } - - public boolean exe_business() { - return true; - } - - protected void executing(Instruction instruction) { - this.executing(1, instruction, ""); - } - - public void executing(int command, Instruction instruction, String appendMessage) { - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - ReadUtil.write(itemMap, server); - - } - - public void executing(Server server, Map itemMap) { - ReadUtil.write(itemMap, server); - } - - public void writing(int command) { - - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - ReadUtil.write(itemMap, server); - - } - - public void writing(int type, int command) { - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - ReadUtil.write(itemMap, server); - - } - - public void writing(String param, String value) { - - String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + param; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(to_param, value); - - ReadUtil.write(itemMap, server); - } -} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/ItemProtocol.java deleted file mode 100644 index a4fbf83..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/ItemProtocol.java +++ /dev/null @@ -1,142 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_station; - -import cn.hutool.core.util.StrUtil; -import lombok.Data; -import lombok.extern.slf4j.Slf4j; -import org.nl.acs.device.device_driver.standard_inspect.ItemDto; -import org.springframework.beans.factory.annotation.Autowired; - -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_ioaction = "ioaction"; - public static String item_error = "error"; - public static String item_task = "task"; - public static String item_weight = "weight"; - public static String item_material = "material"; - public static String item_barcode = "barcode"; - public static String item_to_command = "to_command"; - public static String item_to_target = "to_target"; - public static String item_to_task = "to_task"; - - - Boolean isonline; - - private LnshStationDeviceDriver driver; - - public ItemProtocol(LnshStationDeviceDriver 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 getIoAction() { - return this.getOpcIntegerValue(item_ioaction); - } - - public int getError() { - return this.getOpcIntegerValue(item_error); - } - - public int getTask() { - return this.getOpcIntegerValue(item_task); - } - - public int getWeight() { - return this.getOpcIntegerValue(item_weight); - } - - public String getMaterial() { - return this.getOpcStringValue(item_material); - } - - public String getBarcode() { - return this.getOpcStringValue(item_barcode); - } - - public int getToCommand() { - return this.getOpcIntegerValue(item_to_command); - } - - public int getToTarget() { - return this.getOpcIntegerValue(item_to_target); - } - - public int getToTask() { - return this.getOpcIntegerValue(item_to_task); - } - - //是否有货 - public int hasGoods(int move) { - return move; - } - - - 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 String getOpcStringValue(String protocol) { - String value = this.driver.getStringValue(protocol); - if (StrUtil.isEmpty(value)) { -// log.error("读取错误!"); - } else { - return value; - } - return "0"; - } - - public static List getReadableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_heartbeat, "心跳", "DB4.B0")); - list.add(new ItemDto(item_mode, "工作状态", "DB4.B1", Boolean.valueOf(true))); - list.add(new ItemDto(item_move, "光电开关信号", "DB4.B2")); - list.add(new ItemDto(item_action, "取放信号", "DB4.B3")); - list.add(new ItemDto(item_ioaction, "进出信号", "DB4.B4")); - list.add(new ItemDto(item_error, "报警信号", "DB4.B5")); - list.add(new ItemDto(item_task, "任务号", "DB4.D6")); - list.add(new ItemDto(item_weight, "重量", "DB4.D10")); - list.add(new ItemDto(item_material, "物料", "DB4.S14")); - list.add(new ItemDto(item_barcode, "条码", "DB4.S270")); - return list; - } - - public static List getWriteableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_command, "作业命令", "DB5.W0", Boolean.valueOf(true))); - list.add(new ItemDto(item_to_target, "目标站", "DB5.W2")); - list.add(new ItemDto(item_to_task, "任务号", "DB5.D4")); - return list; - } - -} - diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDefination.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDefination.java deleted file mode 100644 index 65b0310..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDefination.java +++ /dev/null @@ -1,78 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_station; - -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 LnshStationDefination implements OpcDeviceDriverDefination { - @Override - public String getDriverCode() { - return "lnsh_station"; - } - - @Override - public String getDriverName() { - return "晟华-工位(交互模板)"; - } - - @Override - public String getDriverDescription() { - return "晟华-工位(交互模板)"; - } - - @Override - public DeviceDriver getDriverInstance(Device device) { - return (new LnshStationDeviceDriver()).setDevice(device).setDriverDefination(this); - - } - - @Override - public Class getDeviceDriverType() { - return LnshStationDeviceDriver.class; - } - - @Override - public List getFitDeviceTypes() { - List types = new LinkedList(); - types.add(DeviceType.station); - return types; - } - - @Override - public List getReadableItemDtos() { - return getReadableItemDtos2(); - } - - public static List getReadableItemDtos2() { - List list = new ArrayList(); - list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB4.B0")); - list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB4.B1", Boolean.valueOf(true))); - list.add(new ItemDto(ItemProtocol.item_move, "光电开关信号", "DB4.B2")); - list.add(new ItemDto(ItemProtocol.item_action, "取放信号", "DB4.B3")); - list.add(new ItemDto(ItemProtocol.item_ioaction, "进出信号", "DB4.B4")); - list.add(new ItemDto(ItemProtocol.item_error, "报警信号", "DB4.B5")); - list.add(new ItemDto(ItemProtocol.item_task, "任务号", "DB4.D6")); - list.add(new ItemDto(ItemProtocol.item_weight, "重量", "DB4.D10")); - list.add(new ItemDto(ItemProtocol.item_material, "物料", "DB4.S14")); - list.add(new ItemDto(ItemProtocol.item_barcode, "条码", "DB4.S270")); - return list; - } - - @Override - public List getWriteableItemDtos() { - return ItemProtocol.getWriteableItemDtos(); - } - -} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDeviceDriver.java deleted file mode 100644 index 737f3bc..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDeviceDriver.java +++ /dev/null @@ -1,455 +0,0 @@ -package org.nl.acs.device_driver.lnsh.lnsh_station; - -import cn.hutool.core.date.DateUtil; -import cn.hutool.core.util.IdUtil; -import cn.hutool.core.util.StrUtil; -import cn.hutool.http.HttpResponse; -import com.alibaba.fastjson.JSONArray; -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.device_driver.standard_emptypallet_site.StandardEmptyPalletSiteDeviceDriver; -import org.nl.acs.device_driver.standard_inspect_site.StandardInspectSiteDeviceDriver; -import org.nl.acs.ext.wms.service.AcsToWmsService; -import org.nl.acs.instruction.service.InstructionService; -import org.nl.acs.instruction.service.dto.Instruction; -import org.nl.acs.log.service.DeviceExecuteLogService; - -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.*; - -/** - * 晟华-工位(交互模板) - */ -@Slf4j -@Data -@RequiredArgsConstructor -public class LnshStationDeviceDriver 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 - DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); - @Autowired - AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl"); - - String device_code; - int mode = 0; - int error = 0; - int move = 0; - int action; - int io_action; - int task = 0; - int last_mode = 0; - int last_error = 0; - int last_move = 0; - int last_task = 0; - int last_action = 0; - int last_ioaction = 0; - Boolean isonline = true; - int hasGoods = 0; - Boolean iserror = false; - - protected int instruction_num = 0; - protected int instruction_num_truth = 0; - Integer heartbeat_tag; - private Date instruction_require_time = new Date(); - private Date instruction_finished_time = new Date(); - - private int instruction_require_time_out = 3000; - boolean requireSucess = false; - - private int instruction_finished_time_out; - - int heartbeat; - int last_heartbeat; - private Date checkHeartbeattime = new Date(); - private Date last_checkHeartbeattime = new Date(); - - - int branchProtocol = 0; - //当前指令 - Instruction inst = null; - //上次指令 - Instruction last_inst = null; - - //触摸屏手动触发任务 - private Boolean is_has_task = false; - - //暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域 - int flag; - - String message; - int weight = 0; - int last_weight = 0; - String material; - String last_material; - String barcode; - String last_barcode; - - @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(); - move = this.itemProtocol.getMove(); - task = this.itemProtocol.getTask(); - hasGoods = this.itemProtocol.getMove(); - io_action = this.itemProtocol.getIoAction(); - action = this.itemProtocol.getAction(); - weight = this.itemProtocol.getWeight(); - material = this.itemProtocol.getMaterial(); - barcode = this.itemProtocol.getBarcode(); - - if (mode != last_mode) { - this.setRequireSucess(false); - logServer.deviceItemValue(this.device_code,"mode" ,String.valueOf(mode)); - logServer.deviceExecuteLog(this.device_code,"","","信号mode:" + last_mode + "->" + mode); - } - if (move != last_move) { - logServer.deviceItemValue(this.device_code,"move" ,String.valueOf(move)); - logServer.deviceExecuteLog(this.device_code,"","","信号move:" + last_move + "->" + move); - } - if (error != last_error) { - logServer.deviceItemValue(this.device_code,"error" ,String.valueOf(error)); - logServer.deviceExecuteLog(this.device_code,"","","信号error:" + last_error + "->" + error); - } - if (task != last_task) { - logServer.deviceItemValue(this.device_code,"task",String.valueOf(task)); - logServer.deviceExecuteLog(this.device_code,"","","信号task:" + last_task + "->" + task); - } - if (action != last_action) { - logServer.deviceItemValue(this.device_code,"action",String.valueOf(action)); - logServer.deviceExecuteLog(this.device_code,"","","信号action:" + last_action + "->" + action); - } - if (io_action != last_ioaction) { - logServer.deviceItemValue(this.device_code,"io_action",String.valueOf(io_action)); - logServer.deviceExecuteLog(this.device_code,"","","信号io_action: " + last_ioaction + "->" + io_action); - } - if (weight != last_weight) { - logServer.deviceItemValue(this.device_code,"weight",String.valueOf(weight)); - logServer.deviceExecuteLog(this.device_code,"","","信号weight: " + last_weight + "->" + weight); - } - if (!StrUtil.equals(material,last_material)) { - logServer.deviceItemValue(this.device_code,"material", material); - logServer.deviceExecuteLog(this.device_code,"","","信号material:" + last_material + "->" + material); - } - if (!StrUtil.equals(barcode,last_barcode)) { - logServer.deviceItemValue(this.device_code,"barcode", barcode); - logServer.deviceExecuteLog(this.device_code,"","","信号barcode:" + last_barcode + "->" + barcode); - } - - } catch (Exception var17) { - return; - } - - //急停 - if (this.isStop()) { - - //未联机 - } 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("设备运转模式:等待工作"); - break; - case 2: - break; - case 4: - //叫料 - if (!requireSucess && this.move == 0) { - callMaterial(); - } - break; - case 5: - //申请空盘 - if (!requireSucess && this.move == 0) { - applyEmpty(); - } - break; - case 6: - //申请入库 - if (!requireSucess && this.move != 0) { - putStorage(); - } - break; - case 7: - //申请出窑分配 - if (!requireSucess && this.move != 0) { - applyOuttoKiln(); - } - break; - } - - switch (flag) { - //取货完成 - case 2: - writing(2); - return; - //放货完成 - case 4: - writing(3); - return; - } - } - - last_mode = mode; - last_error = error; - last_move = move; - last_task = task; - last_action = action; - last_ioaction = io_action; - last_weight = weight; - last_material = material; - last_barcode = barcode; - } - - - /** - * 申请空盘 - * - * @param - */ - public synchronized boolean applyEmpty() { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - JSONObject json = new JSONObject(); - json.put("device_code",this.device_code); - json.put("type","4"); - HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); - if (result.getStatus() == 200) { - this.writing(this.mode); - requireSucess = true; - } - return true; - } - } - - /** - * 叫料 - * - * @param - */ - public synchronized boolean callMaterial() { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - JSONObject json = new JSONObject(); - json.put("device_code",this.device_code); - json.put("type","2"); - json.put("weight",weight); - json.put("vehicle_code",barcode); - json.put("is_full","1"); - HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); - if (result.getStatus() == 200) { - this.writing(this.mode); - requireSucess = true; - } - return true; - } - } - - /** - * 申请入库 - * - * @param - */ - public synchronized boolean putStorage() { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - JSONObject json = new JSONObject(); - json.put("device_code",this.device_code); - json.put("type","1"); - json.put("qty",weight); - json.put("vehicle_code",barcode); - json.put("is_full","1"); - HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); - if (result.getStatus() == 200) { - this.writing(this.mode); - requireSucess = true; - } - - return true; - } - } - - - /** - * 申请出窑去包装 - * - * @param - */ - public synchronized boolean applyOuttoKiln() { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - JSONObject json = new JSONObject(); - json.put("device_code",this.device_code); - json.put("vehicle_code",barcode); - HttpResponse result = acsToWmsService.applyOuttoKiln(json); - if (result.getStatus() == 200) { - JSONObject jo = JSONObject.parseObject(result.body()); - String is_package = jo.getString("is_package"); - this.writing(2,Integer.parseInt(is_package)); - this.writing(this.mode); - requireSucess = true; - } - - return true; - } - } - - public boolean exe_error() { - if (this.error == 0) { - return true; - } else { - log.debug("设备报警"); - return false; - } - } - - public boolean exe_business() { - return true; - } - - protected void executing(Instruction instruction) { - this.executing(1, instruction, ""); - } - - public void executing(int command, Instruction instruction, String appendMessage) { - String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_command; - String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_target; - String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_task; - if (appendMessage == null) { - appendMessage = ""; - } - if (instruction != null) { - instruction_num = Integer.parseInt(instruction.getInstruction_code()); - } - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(to_command, 1); - itemMap.put(to_task, instruction_num); - ReadUtil.write(itemMap, server); - - } - - public void executing(Server server, Map itemMap) { - 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 itemMap = new HashMap(); - 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); - - } - - 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 itemMap = new HashMap(); - itemMap.put(to_command, command); - ReadUtil.write(itemMap, server); - } - - public synchronized void OpenOrClose(String type) { - - //进入区域 - if ("1".equals(type)) { - writing(5); - } else { - //离开区域 - writing(6); - } - } - - public String toString() { - return ""; - } - -} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/rljn_package_palletSplit_manipulator/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/rljn_package_palletSplit_manipulator/ItemProtocol.java deleted file mode 100644 index 01b2721..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/rljn_package_palletSplit_manipulator/ItemProtocol.java +++ /dev/null @@ -1,989 +0,0 @@ -package org.nl.acs.device_driver.lnsh.rljn_package_palletSplit_manipulator; - -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -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_status = "status"; - public static String item_error = "error"; - public static String item_onoff_status = "onoff_status"; - public static String item_putStation = "putStation"; - public static String item_getStation = "getStation"; - public static String item_barcode = "barcode"; - public static String item_material = "material"; - public static String item_qty = "qty"; - public static String item_batch = "batch"; - public static String item_specifications = "specifications"; - public static String item_open_time = "open_time"; - public static String item_standby_time = "standby_time"; - public static String item_production_time = "production_time"; - public static String item_error_time = "error_time"; - public static String item_order_No = "order_No"; - public static String item_order_qty = "order_qty"; - public static String item_total_split = "total_split"; - public static String item_xContainer_length = "xContainer_length"; - public static String item_yContainer_length = "yContainer_length"; - public static String item_container_getQty = "container_getQty"; - public static String item_getX_offset = "getX_offset"; - public static String item_getY_offset = "getY_offset"; - - public static String item_product_code = "product_code"; - public static String item_AlongSide = "AlongSide"; - public static String item_BshortSide = "BshortSide"; - public static String item_Htrapezoidal = "Htrapezoidal"; - public static String item_Wthickness = "Wthickness"; - public static String item_tray_qty = "tray_qty"; - public static String item_tray_high = "tray_high"; - public static String item_crib_category = "crib_category"; - public static String item_palletX1_line = "palletX1_line"; - public static String item_palletY1_row = "palletY1_row"; - public static String item_palletA1_angle = "palletA1_angle"; - public static String item_palletX2_line = "palletX2_line"; - public static String item_palletY2_row = "palletY2_row"; - public static String item_palletA2_angle = "palletA2_angle"; - public static String item_palletX3_line = "palletX3_line"; - public static String item_palletY3_row = "palletY3_row"; - public static String item_palletA3_angle = "palletA3_angle"; - public static String item_pressCribX1_line = "pressCribX1_line"; - public static String item_pressCribY1_row = "pressCribY1_row"; - public static String item_pressCribA1_angle = "pressCribA1_angle"; - public static String item_pressCribX2_line = "pressCribX2_line"; - public static String item_pressCribY2_row = "pressCribY2_row"; - public static String item_pressCribA2_angle = "pressCribA2_angle"; - public static String item_pressCribX3_line = "pressCribX3_line"; - public static String item_pressCribY3_row = "pressCribY3_row"; - public static String item_pressCribA3_angle = "pressCribA3_angle"; - public static String item_Zoffset = "Zoffset"; - public static String item_pallet_layerQty = "pallet_layerQty"; - public static String item_pressCrib_layerQty = "pressCrib_layerQty"; - public static String item_codeLayerX1_interval = "codeLayerX1_interval"; - public static String item_codeLayerY1_interval = "codeLayerY1_interval"; - public static String item_codeLayerX2_interval = "codeLayerX2_interval"; - public static String item_codeLayerY2_interval = "codeLayerY2_interval"; - public static String item_codeLayerX3_interval = "codeLayerX3_interval"; - public static String item_codeLayerY3_interval = "codeLayerY3_interval"; - public static String item_codeLayerX1_offset = "codeLayerX1_offset"; - public static String item_codeLayerY1_offset = "codeLayerY1_offset"; - public static String item_codeLayerX2_offset = "codeLayerX2_offset"; - public static String item_codeLayerY2_offset = "codeLayerY2_offset"; - public static String item_codeLayerX3_offset = "codeLayerX3_offset"; - public static String item_codeLayerY3_offset = "codeLayerY3_offset"; - public static String item_pressLayerX1_interval = "pressLayerX1_interval"; - public static String item_pressLayerY1_interval = "pressLayerY1_interval"; - public static String item_pressLayerX2_interval = "pressLayerX2_interval"; - public static String item_pressLayerY2_interval = "pressLayerY2_interval"; - public static String item_pressLayerX3_interval = "pressLayerX3_interval"; - public static String item_pressLayerY3_interval = "pressLayerY3_interval"; - public static String item_pressLayerX1_offset = "pressLayerX1_offset"; - public static String item_pressLayerY1_offset = "pressLayerY1_offset"; - public static String item_pressLayerX2_offset = "pressLayerX2_offset"; - public static String item_pressLayerY2_offset = "pressLayerY2_offset"; - public static String item_pressLayerX3_offset = "pressLayerX3_offset"; - public static String item_pressLayerY3_offset = "pressLayerY3_offset"; - public static String item_one_cribTotal = "one_cribTotal"; - public static String item_two_cribTotal = "two_cribTotal"; - public static String item_one_qty = "one_qty"; - public static String item_two_qty = "two_qty"; - public static String item_tool_coordinate = "tool_coordinate"; - - public static String item_to_feedback = "to_feedback"; - public static String item_to_error = "to_error"; - public static String item_to_material_qty = "to_material_qty"; - public static String item_to_allow_pallet_qty = "to_allow_pallet_qty"; - public static String item_to_material_type = "to_material_type"; - public static String item_to_material_code = "to_material_code"; - public static String item_to_order_No = "to_order_No"; - public static String item_to_order_qty = "to_order_qty"; - - public static String item_to_product_code = "to_product_code"; - public static String item_to_AlongSide = "to_AlongSide"; - public static String item_to_BshortSide = "to_BshortSide"; - public static String item_to_Htrapezoidal = "to_Htrapezoidal"; - public static String item_to_Wthickness = "to_Wthickness"; - public static String item_to_tray_qty = "to_tray_qty"; - public static String item_to_tray_high = "to_tray_high"; - public static String item_to_crib_category = "to_crib_category"; - public static String item_to_palletX1_line = "to_palletX1_line"; - public static String item_to_palletY1_row = "to_palletY1_row"; - public static String item_to_palletA1_angle = "to_palletA1_angle"; - public static String item_to_palletX2_line = "to_palletX2_line"; - public static String item_to_palletY2_row = "to_palletY2_row"; - public static String item_to_palletA2_angle = "to_palletA2_angle"; - public static String item_to_palletX3_line = "to_palletX3_line"; - public static String item_to_palletY3_row = "to_palletY3_row"; - public static String item_to_palletA3_angle = "to_palletA3_angle"; - public static String item_to_pressCribX1_line = "to_pressCribX1_line"; - public static String item_to_pressCribY1_row = "to_pressCribY1_row"; - public static String item_to_pressCribA1_angle = "to_pressCribA1_angle"; - public static String item_to_pressCribX2_line = "to_pressCribX2_line"; - public static String item_to_pressCribY2_row = "to_pressCribY2_row"; - public static String item_to_pressCribA2_angle = "to_pressCribA2_angle"; - public static String item_to_pressCribX3_line = "to_pressCribX3_line"; - public static String item_to_pressCribY3_row = "to_pressCribY3_row"; - public static String item_to_pressCribA3_angle = "to_pressCribA3_angle"; - public static String item_to_Zoffset = "to_Zoffset"; - public static String item_to_pallet_layerQty = "to_pallet_layerQty"; - public static String item_to_pressCrib_layerQty = "to_pressCrib_layerQty"; - public static String item_to_codeLayerX1_interval = "to_codeLayerX1_interval"; - public static String item_to_codeLayerY1_interval = "to_codeLayerY1_interval"; - public static String item_to_codeLayerX2_interval = "to_codeLayerX2_interval"; - public static String item_to_codeLayerY2_interval = "to_codeLayerY2_interval"; - public static String item_to_codeLayerX3_interval = "to_codeLayerX3_interval"; - public static String item_to_codeLayerY3_interval = "to_codeLayerY3_interval"; - public static String item_to_codeLayerX1_offset = "to_codeLayerX1_offset"; - public static String item_to_codeLayerY1_offset = "to_codeLayerY1_offset"; - public static String item_to_codeLayerX2_offset = "to_codeLayerX2_offset"; - public static String item_to_codeLayerY2_offset = "to_codeLayerY2_offset"; - public static String item_to_codeLayerX3_offset = "to_codeLayerX3_offset"; - public static String item_to_codeLayerY3_offset = "to_codeLayerY3_offset"; - public static String item_to_pressLayerX1_interval = "to_pressLayerX1_interval"; - public static String item_to_pressLayerY1_interval = "to_pressLayerY1_interval"; - public static String item_to_pressLayerX2_interval = "to_pressLayerX2_interval"; - public static String item_to_pressLayerY2_interval = "to_pressLayerY2_interval"; - public static String item_to_pressLayerX3_interval = "to_pressLayerX3_interval"; - public static String item_to_pressLayerY3_interval = "to_pressLayerY3_interval"; - public static String item_to_pressLayerX1_offset = "to_pressLayerX1_offset"; - public static String item_to_pressLayerY1_offset = "to_pressLayerY1_offset"; - public static String item_to_pressLayerX2_offset = "to_pressLayerX2_offset"; - public static String item_to_pressLayerY2_offset = "to_pressLayerY2_offset"; - public static String item_to_pressLayerX3_offset = "to_pressLayerX3_offset"; - public static String item_to_pressLayerY3_offset = "to_pressLayerY3_offset"; - public static String item_to_one_cribTotal = "to_one_cribTotal"; - public static String item_to_two_cribTotal = "to_two_cribTotal"; - public static String item_to_one_qty = "to_one_qty"; - public static String item_to_two_qty = "to_two_qty"; - public static String item_to_tool_coordinate = "to_tool_coordinate"; - public static String item_to_xContainer_length = "to_xContainer_length"; - public static String item_to_yContainer_length = "to_yContainer_length"; - public static String item_to_container_getQty = "to_container_getQty"; - public static String item_to_getX_offset = "to_getX_offset"; - public static String item_to_getY_offset = "to_getY_offset"; - - - private RljnPackagePalletSplitManipulatorDeviceDriver driver; - - public ItemProtocol(RljnPackagePalletSplitManipulatorDeviceDriver driver) { - this.driver = driver; - } - - public int getHeartbeat() { - return this.getOpcIntegerValue(item_heartbeat); - } - - public int getMode() { - return this.getOpcIntegerValue(item_mode); - } - - public int getStatus() { - return this.getOpcIntegerValue(item_status); - } - - public int getError() { - return this.getOpcIntegerValue(item_error); - } - - public int getOnoff_status() { - return this.getOpcIntegerValue(item_onoff_status); - } - - public int getPutStation() { - return this.getOpcIntegerValue(item_putStation); - } - - public int getGetStation() { - return this.getOpcIntegerValue(item_getStation); - } - - public String getBarcode() { - return this.getOpcStringValue(item_barcode); - } - - public String getMaterial() { - return this.getOpcStringValue(item_material); - } - - public int getQty() { - return this.getOpcIntegerValue(item_qty); - } - - public String getSpecifications() { - return this.getOpcStringValue(item_specifications); - } - - public int getBatch() { - return this.getOpcIntegerValue(item_batch); - } - - public int getOpen_time() { - return this.getOpcIntegerValue(item_open_time); - } - - public int getStandby_time() { - return this.getOpcIntegerValue(item_standby_time); - } - - public int getProduction_time() { - return this.getOpcIntegerValue(item_production_time); - } - - public int getError_time() { - return this.getOpcIntegerValue(item_error_time); - } - - public String getOrder_No() { - return this.getOpcStringValue(item_order_No); - } - - public int getTotal_split() { - return this.getOpcIntegerValue(item_total_split); - } - - public int getOrder_qty() { - return this.getOpcIntegerValue(item_order_qty); - } - - public int getXContainer_length() { - return this.getOpcIntegerValue(item_xContainer_length); - } - - public int getYContainer_length() { - return this.getOpcIntegerValue(item_yContainer_length); - } - - public int getContainer_getQty() { - return this.getOpcIntegerValue(item_container_getQty); - } - - public int getGetX_offset() { - return this.getOpcIntegerValue(item_getX_offset); - } - - public int getGetY_offset() { - return this.getOpcIntegerValue(item_getY_offset); - } - - public int getProduct_code() { - return this.getOpcIntegerValue(item_product_code); - } - - public int getAlongSide() { - return this.getOpcIntegerValue(item_AlongSide); - } - - public int getBshortSide() { - return this.getOpcIntegerValue(item_BshortSide); - } - - public int getHtrapezoidal() { - return this.getOpcIntegerValue(item_Htrapezoidal); - } - - public int getWthickness() { - return this.getOpcIntegerValue(item_Wthickness); - } - - public int getTray_qty() { - return this.getOpcIntegerValue(item_tray_qty); - } - - public int getTray_high() { - return this.getOpcIntegerValue(item_tray_high); - } - - public int getCrib_category() { - return this.getOpcIntegerValue(item_crib_category); - } - - public int getPalletX1_line() { - return this.getOpcIntegerValue(item_palletX1_line); - } - - public int getPalletY1_row() { - return this.getOpcIntegerValue(item_palletY1_row); - } - - public int getPalletA1_angle() { - return this.getOpcIntegerValue(item_palletA1_angle); - } - - public int getPalletX2_line() { - return this.getOpcIntegerValue(item_palletX2_line); - } - - public int getPalletY2_row() { - return this.getOpcIntegerValue(item_palletY2_row); - } - - public int getPalletA2_angle() { - return this.getOpcIntegerValue(item_palletA2_angle); - } - - public int getPalletX3_line() { - return this.getOpcIntegerValue(item_palletX3_line); - } - - public int getPalletY3_row() { - return this.getOpcIntegerValue(item_palletY3_row); - } - - public int getPalletA3_angle() { - return this.getOpcIntegerValue(item_palletA3_angle); - } - - public int getPressCribX1_line() { - return this.getOpcIntegerValue(item_pressCribX1_line); - } - - public int getPressCribY1_row() { - return this.getOpcIntegerValue(item_pressCribY1_row); - } - - public int getPressCribA1_angle() { - return this.getOpcIntegerValue(item_pressCribA1_angle); - } - - public int getPressCribX2_line() { - return this.getOpcIntegerValue(item_pressCribX2_line); - } - - public int getPressCribY2_row() { - return this.getOpcIntegerValue(item_pressCribY2_row); - } - - public int getPressCribA2_angle() { - return this.getOpcIntegerValue(item_pressCribA2_angle); - } - - public int getPressCribX3_line() { - return this.getOpcIntegerValue(item_pressCribX3_line); - } - - public int getPressCribY3_row() { - return this.getOpcIntegerValue(item_pressCribY3_row); - } - - public int getPressCribA3_angle() { - return this.getOpcIntegerValue(item_pressCribA3_angle); - } - - public int getZoffset() { - return this.getOpcIntegerValue(item_Zoffset); - } - - public int getPallet_layerQty() { - return this.getOpcIntegerValue(item_pallet_layerQty); - } - - public int getPressCrib_layerQty() { - return this.getOpcIntegerValue(item_pressCrib_layerQty); - } - - public int getCodeLayerX1_interval() { - return this.getOpcIntegerValue(item_codeLayerX1_interval); - } - - public int getCodeLayerY1_interval() { - return this.getOpcIntegerValue(item_codeLayerY1_interval); - } - - public int getCodeLayerX2_interval() { - return this.getOpcIntegerValue(item_codeLayerX2_interval); - } - - public int getCodeLayerY2_interval() { - return this.getOpcIntegerValue(item_codeLayerY2_interval); - } - - public int getCodeLayerX3_interval() { - return this.getOpcIntegerValue(item_codeLayerX3_interval); - } - - public int getcodeLayerY3_interval() { - return this.getOpcIntegerValue(item_codeLayerY3_interval); - } - - public int getCodeLayerX1_offset() { - return this.getOpcIntegerValue(item_codeLayerX1_offset); - } - - public int getCodeLayerY1_offset() { - return this.getOpcIntegerValue(item_codeLayerY1_offset); - } - - public int getCodeLayerX2_offset() { - return this.getOpcIntegerValue(item_codeLayerX2_offset); - } - - public int getCodeLayerY2_offset() { - return this.getOpcIntegerValue(item_codeLayerY2_offset); - } - - public int getCodeLayerX3_offset() { - return this.getOpcIntegerValue(item_codeLayerX3_offset); - } - - public int getCodeLayerY3_offset() { - return this.getOpcIntegerValue(item_codeLayerY3_offset); - } - - public int getPressLayerX1_interval() { - return this.getOpcIntegerValue(item_pressLayerX1_interval); - } - - public int getPressLayerY1_interval() { - return this.getOpcIntegerValue(item_pressLayerY1_interval); - } - - public int getPressLayerX2_interval() { - return this.getOpcIntegerValue(item_pressLayerX2_interval); - } - - public int getPressLayerY2_interval() { - return this.getOpcIntegerValue(item_pressLayerY2_interval); - } - - public int getPressLayerX3_interval() { - return this.getOpcIntegerValue(item_pressLayerX3_interval); - } - - public int getPressLayerY3_interval() { - return this.getOpcIntegerValue(item_pressLayerY3_interval); - } - - public int getPressLayerX1_offset() { - return this.getOpcIntegerValue(item_pressLayerX1_offset); - } - - public int getPressLayerY1_offset() { - return this.getOpcIntegerValue(item_pressLayerY1_offset); - } - - public int getPressLayerX2_offset() { - return this.getOpcIntegerValue(item_pressLayerX2_offset); - } - - public int getPressLayerY2_offset() { - return this.getOpcIntegerValue(item_pressLayerY2_offset); - } - - public int getPressLayerX3_offset() { - return this.getOpcIntegerValue(item_pressLayerX3_offset); - } - - public int getPressLayerY3_offset() { - return this.getOpcIntegerValue(item_pressLayerY3_offset); - } - - public int getOne_cribTotal() { - return this.getOpcIntegerValue(item_one_cribTotal); - } - - public int getTwo_cribTotal() { - return this.getOpcIntegerValue(item_two_cribTotal); - } - - public int getOne_qty() { - return this.getOpcIntegerValue(item_one_qty); - } - - public int getTwo_qty() { - return this.getOpcIntegerValue(item_two_qty); - } - - public int getTool_coordinate() { - return this.getOpcIntegerValue(item_tool_coordinate); - } - - public int getTo_feedback() { - return this.getOpcIntegerValue(item_to_feedback); - } - - public int getTo_error() { - return this.getOpcIntegerValue(item_to_error); - } - - public int getTo_material_qty() { - return this.getOpcIntegerValue(item_to_material_qty); - } - - public int getTo_allow_pallet_qty() { - return this.getOpcIntegerValue(item_to_allow_pallet_qty); - } - - public int getTo_material_type() { - return this.getOpcIntegerValue(item_to_material_type); - } - - public int getTo_material_code() { - return this.getOpcIntegerValue(item_to_material_code); - } - - public String getTo_order_No() { - return this.getOpcStringValue(item_to_order_No); - } - - public int getToProduct_code() { - return this.getOpcIntegerValue(item_to_product_code); - } - - public int getToAlongSide() { - return this.getOpcIntegerValue(item_to_AlongSide); - } - - public int getToBshortSide() { - return this.getOpcIntegerValue(item_to_BshortSide); - } - - public int getToHtrapezoidal() { - return this.getOpcIntegerValue(item_to_Htrapezoidal); - } - - public int getToWthickness() { - return this.getOpcIntegerValue(item_to_Wthickness); - } - - public int getToTray_qty() { - return this.getOpcIntegerValue(item_to_tray_qty); - } - - public int getToTray_high() { - return this.getOpcIntegerValue(item_to_tray_high); - } - - public int getToCrib_category() { - return this.getOpcIntegerValue(item_to_crib_category); - } - - public int getToPalletX1_line() { - return this.getOpcIntegerValue(item_to_palletX1_line); - } - - public int getToPalletY1_row() { - return this.getOpcIntegerValue(item_to_palletY1_row); - } - - public int getToPalletA1_angle() { - return this.getOpcIntegerValue(item_to_palletA1_angle); - } - - public int getToPalletX2_line() { - return this.getOpcIntegerValue(item_to_palletX2_line); - } - - public int getToPalletY2_row() { - return this.getOpcIntegerValue(item_to_palletY2_row); - } - - public int getToPalletA2_angle() { - return this.getOpcIntegerValue(item_to_palletA2_angle); - } - - public int getToPalletX3_line() { - return this.getOpcIntegerValue(item_to_palletX3_line); - } - - public int getToPalletY3_row() { - return this.getOpcIntegerValue(item_to_palletY3_row); - } - - public int getToPalletA3_angle() { - return this.getOpcIntegerValue(item_to_palletA3_angle); - } - - public int getToPressCribX1_line() { - return this.getOpcIntegerValue(item_to_pressCribX1_line); - } - - public int getToPressCribY1_row() { - return this.getOpcIntegerValue(item_to_pressCribY1_row); - } - - public int getToPressCribA1_angle() { - return this.getOpcIntegerValue(item_to_pressCribA1_angle); - } - - public int getToPressCribX2_line() { - return this.getOpcIntegerValue(item_to_pressCribX2_line); - } - - public int getToPressCribY2_row() { - return this.getOpcIntegerValue(item_to_pressCribY2_row); - } - - public int getToPressCribA2_angle() { - return this.getOpcIntegerValue(item_to_pressCribA2_angle); - } - - public int getToPressCribX3_line() { - return this.getOpcIntegerValue(item_to_pressCribX3_line); - } - - public int getToPressCribY3_row() { - return this.getOpcIntegerValue(item_to_pressCribY3_row); - } - - public int getToPressCribA3_angle() { - return this.getOpcIntegerValue(item_to_pressCribA3_angle); - } - - public int getToZoffset() { - return this.getOpcIntegerValue(item_to_Zoffset); - } - - public int getToPallet_layerQty() { - return this.getOpcIntegerValue(item_to_pallet_layerQty); - } - - public int getToPressCrib_layerQty() { - return this.getOpcIntegerValue(item_to_pressCrib_layerQty); - } - - public int getToCodeLayerX1_interval() { - return this.getOpcIntegerValue(item_to_codeLayerX1_interval); - } - - public int getToCodeLayerY1_interval() { - return this.getOpcIntegerValue(item_to_codeLayerY1_interval); - } - - public int getToCodeLayerX2_interval() { - return this.getOpcIntegerValue(item_to_codeLayerX2_interval); - } - - public int getToCodeLayerY2_interval() { - return this.getOpcIntegerValue(item_to_codeLayerY2_interval); - } - - public int getToCodeLayerX3_interval() { - return this.getOpcIntegerValue(item_to_codeLayerX3_interval); - } - - public int getTocodeLayerY3_interval() { - return this.getOpcIntegerValue(item_to_codeLayerY3_interval); - } - - public int getToCodeLayerX1_offset() { - return this.getOpcIntegerValue(item_to_codeLayerX1_offset); - } - - public int getToCodeLayerY1_offset() { - return this.getOpcIntegerValue(item_to_codeLayerY1_offset); - } - - public int getToCodeLayerX2_offset() { - return this.getOpcIntegerValue(item_to_codeLayerX2_offset); - } - - public int getToCodeLayerY2_offset() { - return this.getOpcIntegerValue(item_to_codeLayerY2_offset); - } - - public int getToCodeLayerX3_offset() { - return this.getOpcIntegerValue(item_to_codeLayerX3_offset); - } - - public int getToCodeLayerY3_offset() { - return this.getOpcIntegerValue(item_to_codeLayerY3_offset); - } - - public int getToPressLayerX1_interval() { - return this.getOpcIntegerValue(item_to_pressLayerX1_interval); - } - - public int getToPressLayerY1_interval() { - return this.getOpcIntegerValue(item_to_pressLayerY1_interval); - } - - public int getToPressLayerX2_interval() { - return this.getOpcIntegerValue(item_to_pressLayerX2_interval); - } - - public int getToPressLayerY2_interval() { - return this.getOpcIntegerValue(item_to_pressLayerY2_interval); - } - - public int getToPressLayerX3_interval() { - return this.getOpcIntegerValue(item_to_pressLayerX3_interval); - } - - public int getToPressLayerY3_interval() { - return this.getOpcIntegerValue(item_to_pressLayerY3_interval); - } - - public int getToPressLayerX1_offset() { - return this.getOpcIntegerValue(item_to_pressLayerX1_offset); - } - - public int getToPressLayerY1_offset() { - return this.getOpcIntegerValue(item_to_pressLayerY1_offset); - } - - public int getToPressLayerX2_offset() { - return this.getOpcIntegerValue(item_to_pressLayerX2_offset); - } - - public int getToPressLayerY2_offset() { - return this.getOpcIntegerValue(item_to_pressLayerY2_offset); - } - - public int getToPressLayerX3_offset() { - return this.getOpcIntegerValue(item_to_pressLayerX3_offset); - } - - public int getToPressLayerY3_offset() { - return this.getOpcIntegerValue(item_to_pressLayerY3_offset); - } - - public int getToOne_cribTotal() { - return this.getOpcIntegerValue(item_to_one_cribTotal); - } - - public int getToTwo_cribTotal() { - return this.getOpcIntegerValue(item_to_two_cribTotal); - } - - public int getToOne_qty() { - return this.getOpcIntegerValue(item_to_one_qty); - } - - public int getToTwo_qty() { - return this.getOpcIntegerValue(item_to_two_qty); - } - - public int getToTool_coordinate() { - return this.getOpcIntegerValue(item_to_tool_coordinate); - } - - public int getTo_order_qty() { - return this.getOpcIntegerValue(item_to_order_qty); - } - - public int getToXContainer_length() { - return this.getOpcIntegerValue(item_to_xContainer_length); - } - - public int getToYContainer_length() { - return this.getOpcIntegerValue(item_to_yContainer_length); - } - - public int getToContainer_getQty() { - return this.getOpcIntegerValue(item_to_container_getQty); - } - - public int getToGetX_offset() { - return this.getOpcIntegerValue(item_to_getX_offset); - } - - public int getToGetY_offset() { - return this.getOpcIntegerValue(item_to_getY_offset); - } - - //是否有货 - 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 String getOpcStringValue(String protocol) { - String value = this.driver.getStringValue(protocol); - if (StrUtil.isEmpty(value)) { - - } else { - return value; - } - return ""; - } - - public static List getReadableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_heartbeat, "心跳", "DB13.B0")); - list.add(new ItemDto(item_mode, "工作状态", "DB13.B1", Boolean.valueOf(true))); - list.add(new ItemDto(item_status, "设备状态", "DB13.B2")); - list.add(new ItemDto(item_error, "故障代码", "DB13.B3")); - list.add(new ItemDto(item_onoff_status, "开关机状态", "DB13.B4")); - list.add(new ItemDto(item_putStation, "当前码盘工位", "DB13.D6")); - list.add(new ItemDto(item_getStation, "当前抓取工位", "DB13.D10")); - list.add(new ItemDto(item_barcode, "当前码盘工位条码", "DB13.S14")); - list.add(new ItemDto(item_material, "码盘工位当前物料", "DB13.S270")); - list.add(new ItemDto(item_specifications, "规格", "DB13.S526")); - list.add(new ItemDto(item_batch, "批次", "DB13.D782")); - list.add(new ItemDto(item_qty, "数量", "DB13.D786")); - list.add(new ItemDto(item_open_time, "开机时间", "DB13.D790")); - list.add(new ItemDto(item_standby_time, "待机时间", "DB13.D794")); - list.add(new ItemDto(item_production_time, "生产时间", "DB13.D798")); - list.add(new ItemDto(item_error_time, "故障时间", "DB13.D802")); - list.add(new ItemDto(item_total_split, "累计拆垛数量", "DB13.D806")); - list.add(new ItemDto(item_order_No, "工单号", "DB13.S810")); - - list.add(new ItemDto(item_product_code, "产品编号", "DB13.W1066")); - list.add(new ItemDto(item_AlongSide, "A长边", "DB13.W1068")); - list.add(new ItemDto(item_BshortSide, "B短边", "DB13.W1070")); - list.add(new ItemDto(item_Htrapezoidal, "H梯形高", "DB13.W1072")); - list.add(new ItemDto(item_Wthickness, "W厚度", "DB13.W1074")); - list.add(new ItemDto(item_tray_qty, "当前垛盘数", "DB13.W1076")); - list.add(new ItemDto(item_tray_high, "垛盘高度", "DB13.W1078")); - list.add(new ItemDto(item_crib_category, "垛型类别", "DB13.W1080")); - list.add(new ItemDto(item_palletX1_line, "码垛X1行", "DB13.W1082")); - list.add(new ItemDto(item_palletY1_row, "码垛Y1列", "DB13.W1084")); - list.add(new ItemDto(item_palletA1_angle, "码垛A1角度", "DB13.W1086")); - list.add(new ItemDto(item_palletX2_line, "码垛X2行", "DB13.W1088")); - list.add(new ItemDto(item_palletY2_row, "码垛Y2列", "DB13.W1090")); - list.add(new ItemDto(item_palletA2_angle, "码垛A2角度", "DB13.W1092")); - list.add(new ItemDto(item_palletX3_line, "码垛X3行", "DB13.W1094")); - list.add(new ItemDto(item_palletY3_row, "码垛Y3列", "DB13.W1096")); - list.add(new ItemDto(item_palletA3_angle, "码垛A3角度", "DB13.W1098")); - list.add(new ItemDto(item_pressCribX1_line, "压垛X1行", "DB13.W1100")); - list.add(new ItemDto(item_pressCribY1_row, "压垛Y1列", "DB13.W1102")); - list.add(new ItemDto(item_pressCribA1_angle, "压垛A1角度", "DB13.W1104")); - list.add(new ItemDto(item_pressCribX2_line, "压垛X2行", "DB13.W1106")); - list.add(new ItemDto(item_pressCribY2_row, "压垛Y2列", "DB13.W1108")); - list.add(new ItemDto(item_pressCribA2_angle, "压垛A2角度", "DB13.W1110")); - list.add(new ItemDto(item_pressCribX3_line, "压垛X3行", "DB13.W1112")); - list.add(new ItemDto(item_pressCribY3_row, "压垛Y3列", "DB13.W1114")); - list.add(new ItemDto(item_pressCribA3_angle, "压垛A3角度", "DB13.W1116")); - list.add(new ItemDto(item_Zoffset, "Z轴偏移", "DB13.W1118")); - list.add(new ItemDto(item_pallet_layerQty, "码垛层数", "DB13.W1120")); - list.add(new ItemDto(item_pressCrib_layerQty, "压垛层数", "DB13.W1122")); - list.add(new ItemDto(item_codeLayerX1_interval, "码层X1间隔", "DB13.W1124")); - list.add(new ItemDto(item_codeLayerY1_interval, "码层Y1间隔", "DB13.W1126")); - list.add(new ItemDto(item_codeLayerX2_interval, "码层X2间隔", "DB13.W1128")); - list.add(new ItemDto(item_codeLayerY2_interval, "码层Y2间隔", "DB13.W1130")); - list.add(new ItemDto(item_codeLayerX3_interval, "码层X3间隔", "DB13.W1132")); - list.add(new ItemDto(item_codeLayerY3_interval, "码层Y3间隔", "DB13.W1134")); - list.add(new ItemDto(item_codeLayerX1_offset, "码层X1偏移", "DB13.W1136")); - list.add(new ItemDto(item_codeLayerY1_offset, "码层Y1偏移", "DB13.W1138")); - list.add(new ItemDto(item_codeLayerX2_offset, "码层X2偏移", "DB13.W1140")); - list.add(new ItemDto(item_codeLayerY2_offset, "码层Y2偏移", "DB13.W1142")); - list.add(new ItemDto(item_codeLayerX3_offset, "码层X3偏移", "DB13.W1144")); - list.add(new ItemDto(item_codeLayerY3_offset, "码层Y3偏移", "DB13.W1146")); - list.add(new ItemDto(item_pressLayerX1_interval, "压层X1间隔", "DB13.W1148")); - list.add(new ItemDto(item_pressLayerY1_interval, "压层Y1间隔", "DB13.W1150")); - list.add(new ItemDto(item_pressLayerX2_interval, "压层X2间隔", "DB13.W1152")); - list.add(new ItemDto(item_pressLayerY2_interval, "压层Y2间隔", "DB13.W1154")); - list.add(new ItemDto(item_pressLayerX3_interval, "压层X3间隔", "DB13.W1156")); - list.add(new ItemDto(item_pressLayerY3_interval, "压层Y3间隔", "DB13.W1158")); - list.add(new ItemDto(item_pressLayerX1_offset, "压层X1偏移", "DB13.W1160")); - list.add(new ItemDto(item_pressLayerY1_offset, "压层Y1偏移", "DB13.W1162")); - list.add(new ItemDto(item_pressLayerX2_offset, "压层X2偏移", "DB13.W1164")); - list.add(new ItemDto(item_pressLayerY2_offset, "压层Y2偏移", "DB13.W1166")); - list.add(new ItemDto(item_pressLayerX3_offset, "压层X3偏移", "DB13.W1168")); - list.add(new ItemDto(item_pressLayerY3_offset, "压层Y3偏移", "DB13.W1170")); - list.add(new ItemDto(item_one_cribTotal, "1#垛总数", "DB13.W1172")); - list.add(new ItemDto(item_two_cribTotal, "2#垛总数", "DB13.W1174")); - list.add(new ItemDto(item_one_qty, "1#垛当前数", "DB13.W1176")); - list.add(new ItemDto(item_two_qty, "2#垛当前数", "DB13.W1178")); - list.add(new ItemDto(item_xContainer_length, "1#X托盘长度", "DB13.W1180")); - list.add(new ItemDto(item_yContainer_length, "1#Y托盘长度", "DB13.W1182")); - list.add(new ItemDto(item_container_getQty, "1#托盘抓取数", "DB13.W1184")); - list.add(new ItemDto(item_getX_offset, "1#抓取X偏移", "DB13.W1186")); - list.add(new ItemDto(item_getY_offset, "1#抓取Y偏移", "DB13.W1188")); - list.add(new ItemDto(item_tool_coordinate, "工具坐标", "DB13.W1190")); - list.add(new ItemDto(item_order_qty, "工单数量", "DB13.W1192")); - return list; - } - - public static List getWriteableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_feedback, "机器人动作反馈", "DB14.B0")); - list.add(new ItemDto(item_to_error, "故障代码", "DB14.W2")); - list.add(new ItemDto(item_to_material_qty, "托盘上数量", "DB14.W4")); - list.add(new ItemDto(item_to_allow_pallet_qty, "允许码垛数量", "DB14.W6")); - list.add(new ItemDto(item_to_material_type, "托盘类型", "DB14.D8")); - list.add(new ItemDto(item_to_material_code, "下发物料编号", "DB14.D12")); - list.add(new ItemDto(item_to_order_No, "工单号", "DB14.S16")); - - list.add(new ItemDto(item_to_product_code, "产品编号", "DB14.W272")); - list.add(new ItemDto(item_to_AlongSide, "A长边", "DB14.W274")); - list.add(new ItemDto(item_to_BshortSide, "B短边", "DB14.W276")); - list.add(new ItemDto(item_to_Htrapezoidal, "H梯形高", "DB14.W278")); - list.add(new ItemDto(item_to_Wthickness, "W厚度", "DB14.W280")); - list.add(new ItemDto(item_to_tray_qty, "当前垛盘数", "DB14.W282")); - list.add(new ItemDto(item_to_tray_high, "垛盘高度", "DB14.W284")); - list.add(new ItemDto(item_to_crib_category, "垛型类别", "DB14.W286")); - list.add(new ItemDto(item_to_palletX1_line, "码垛X1行", "DB14.W288")); - list.add(new ItemDto(item_to_palletY1_row, "码垛Y1列", "DB14.W290")); - list.add(new ItemDto(item_to_palletA1_angle, "码垛A1角度", "DB14.W292")); - list.add(new ItemDto(item_to_palletX2_line, "码垛X2行", "DB14.W294")); - list.add(new ItemDto(item_to_palletY2_row, "码垛Y2列", "DB14.W296")); - list.add(new ItemDto(item_to_palletA2_angle, "码垛A2角度", "DB14.W298")); - list.add(new ItemDto(item_to_palletX3_line, "码垛X3行", "DB14.W300")); - list.add(new ItemDto(item_to_palletY3_row, "码垛Y3列", "DB14.W302")); - list.add(new ItemDto(item_to_palletA3_angle, "码垛A3角度", "DB14.W304")); - list.add(new ItemDto(item_to_pressCribX1_line, "压垛X1行", "DB14.W306")); - list.add(new ItemDto(item_to_pressCribY1_row, "压垛Y1列", "DB14.W308")); - list.add(new ItemDto(item_to_pressCribA1_angle, "压垛A1角度", "DB14.W310")); - list.add(new ItemDto(item_to_pressCribX2_line, "压垛X2行", "DB14.W312")); - list.add(new ItemDto(item_to_pressCribY2_row, "压垛Y2列", "DB14.W314")); - list.add(new ItemDto(item_to_pressCribA2_angle, "压垛A2角度", "DB14.W316")); - list.add(new ItemDto(item_to_pressCribX3_line, "压垛X3行", "DB14.W318")); - list.add(new ItemDto(item_to_pressCribY3_row, "压垛Y3列", "DB14.W320")); - list.add(new ItemDto(item_to_pressCribA3_angle, "压垛A3角度", "DB14.W322")); - list.add(new ItemDto(item_to_Zoffset, "Z轴偏移", "DB14.W324")); - list.add(new ItemDto(item_to_pallet_layerQty, "码垛层数", "DB14.W326")); - list.add(new ItemDto(item_to_pressCrib_layerQty, "压垛层数", "DB14.W328")); - list.add(new ItemDto(item_to_codeLayerX1_interval, "码层X1间隔", "DB14.W330")); - list.add(new ItemDto(item_to_codeLayerY1_interval, "码层Y1间隔", "DB14.W332")); - list.add(new ItemDto(item_to_codeLayerX2_interval, "码层X2间隔", "DB14.W334")); - list.add(new ItemDto(item_to_codeLayerY2_interval, "码层Y2间隔", "DB14.W336")); - list.add(new ItemDto(item_to_codeLayerX3_interval, "码层X3间隔", "DB14.W338")); - list.add(new ItemDto(item_to_codeLayerY3_interval, "码层Y3间隔", "DB14.W340")); - list.add(new ItemDto(item_to_codeLayerX1_offset, "码层X1偏移", "DB14.W342")); - list.add(new ItemDto(item_to_codeLayerY1_offset, "码层Y1偏移", "DB14.W344")); - list.add(new ItemDto(item_to_codeLayerX2_offset, "码层X2偏移", "DB14.W346")); - list.add(new ItemDto(item_to_codeLayerY2_offset, "码层Y2偏移", "DB14.W348")); - list.add(new ItemDto(item_to_codeLayerX3_offset, "码层X3偏移", "DB14.W350")); - list.add(new ItemDto(item_to_codeLayerY3_offset, "码层Y3偏移", "DB14.W352")); - list.add(new ItemDto(item_to_pressLayerX1_interval, "压层X1间隔", "DB14.W354")); - list.add(new ItemDto(item_to_pressLayerY1_interval, "压层Y1间隔", "DB14.W356")); - list.add(new ItemDto(item_to_pressLayerX2_interval, "压层X2间隔", "DB14.W358")); - list.add(new ItemDto(item_to_pressLayerY2_interval, "压层Y2间隔", "DB14.W360")); - list.add(new ItemDto(item_to_pressLayerX3_interval, "压层X3间隔", "DB14.W362")); - list.add(new ItemDto(item_to_pressLayerY3_interval, "压层Y3间隔", "DB14.W364")); - list.add(new ItemDto(item_to_pressLayerX1_offset, "压层X1偏移", "DB14.W366")); - list.add(new ItemDto(item_to_pressLayerY1_offset, "压层Y1偏移", "DB14.W368")); - list.add(new ItemDto(item_to_pressLayerX2_offset, "压层X2偏移", "DB14.W370")); - list.add(new ItemDto(item_to_pressLayerY2_offset, "压层Y2偏移", "DB14.W372")); - list.add(new ItemDto(item_to_pressLayerX3_offset, "压层X3偏移", "DB14.W374")); - list.add(new ItemDto(item_to_pressLayerY3_offset, "压层Y3偏移", "DB14.W376")); - list.add(new ItemDto(item_to_one_cribTotal, "1#垛总数", "DB14.W378")); - list.add(new ItemDto(item_to_two_cribTotal, "2#垛总数", "DB14.W380")); - list.add(new ItemDto(item_to_one_qty, "1#垛当前数", "DB14.W382")); - list.add(new ItemDto(item_to_two_qty, "2#垛当前数", "DB14.W384")); - list.add(new ItemDto(item_to_tool_coordinate, "工具坐标", "DB14.W386")); - list.add(new ItemDto(item_to_order_qty, "工单数量", "DB14.W388")); - list.add(new ItemDto(item_to_xContainer_length, "1#X托盘长度", "DB14.W390")); - list.add(new ItemDto(item_to_yContainer_length, "1#Y托盘长度", "DB14.W392")); - list.add(new ItemDto(item_to_container_getQty, "1#托盘抓取数", "DB14.W394")); - list.add(new ItemDto(item_to_getX_offset, "1#抓取X偏移", "DB14.W396")); - list.add(new ItemDto(item_to_getY_offset, "1#抓取Y偏移", "DB14.W398")); - return list; - } - -} - diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/rljn_package_palletSplit_manipulator/RljnPackagePalletSplitManipulatorDefination.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/rljn_package_palletSplit_manipulator/RljnPackagePalletSplitManipulatorDefination.java deleted file mode 100644 index 4d57745..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/rljn_package_palletSplit_manipulator/RljnPackagePalletSplitManipulatorDefination.java +++ /dev/null @@ -1,151 +0,0 @@ -package org.nl.acs.device_driver.lnsh.rljn_package_palletSplit_manipulator; - -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 RljnPackagePalletSplitManipulatorDefination implements OpcDeviceDriverDefination { - @Override - public String getDriverCode() { - return "rljn_package_palletSplit_manipulator"; - } - - @Override - public String getDriverName() { - return "嘉耐-包装码拆垛机械手"; - } - - @Override - public String getDriverDescription() { - return "嘉耐-包装码拆垛机械手"; - } - - @Override - public DeviceDriver getDriverInstance(Device device) { - return (new RljnPackagePalletSplitManipulatorDeviceDriver()).setDevice(device).setDriverDefination(this); - - } - - @Override - public Class getDeviceDriverType() { - return RljnPackagePalletSplitManipulatorDeviceDriver.class; - } - - @Override - public List getFitDeviceTypes() { - List types = new LinkedList(); - types.add(DeviceType.station); - return types; - } - - @Override - public List getReadableItemDtos() { - return getReadableItemDtos2(); - } - - public static List getReadableItemDtos2() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB13.B0")); - list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB13.B1", Boolean.valueOf(true))); - list.add(new ItemDto(ItemProtocol.item_status, "设备状态", "DB13.B2")); - list.add(new ItemDto(ItemProtocol.item_error, "故障代码", "DB13.B3")); - list.add(new ItemDto(ItemProtocol.item_onoff_status, "开关机状态", "DB13.B4")); - list.add(new ItemDto(ItemProtocol.item_putStation, "当前码盘工位", "DB13.D6")); - list.add(new ItemDto(ItemProtocol.item_getStation, "当前抓取工位", "DB13.D10")); - list.add(new ItemDto(ItemProtocol.item_barcode, "当前码盘工位条码", "DB13.S14")); - list.add(new ItemDto(ItemProtocol.item_material, "码盘工位当前物料", "DB13.S270")); - list.add(new ItemDto(ItemProtocol.item_specifications, "规格", "DB13.S526")); - list.add(new ItemDto(ItemProtocol.item_batch, "批次", "DB13.D782")); - list.add(new ItemDto(ItemProtocol.item_qty, "数量", "DB13.D786")); - list.add(new ItemDto(ItemProtocol.item_open_time, "开机时间", "DB13.D790")); - list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "DB13.D794")); - list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "DB13.D798")); - list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "DB13.D802")); - list.add(new ItemDto(ItemProtocol.item_total_split, "累计拆垛数量", "DB13.D806")); - list.add(new ItemDto(ItemProtocol.item_order_No, "工单号", "DB13.S810")); - - list.add(new ItemDto(ItemProtocol.item_product_code, "产品编号", "DB13.W1066")); - list.add(new ItemDto(ItemProtocol.item_AlongSide, "A长边", "DB13.W1068")); - list.add(new ItemDto(ItemProtocol.item_BshortSide, "B短边", "DB13.W1070")); - list.add(new ItemDto(ItemProtocol.item_Htrapezoidal, "H梯形高", "DB13.W1072")); - list.add(new ItemDto(ItemProtocol.item_Wthickness, "W厚度", "DB13.W1074")); - list.add(new ItemDto(ItemProtocol.item_tray_qty, "当前垛盘数", "DB13.W1076")); - list.add(new ItemDto(ItemProtocol.item_tray_high, "垛盘高度", "DB13.W1078")); - list.add(new ItemDto(ItemProtocol.item_crib_category, "垛型类别", "DB13.W1080")); - list.add(new ItemDto(ItemProtocol.item_palletX1_line, "码垛X1行", "DB13.W1082")); - list.add(new ItemDto(ItemProtocol.item_palletY1_row, "码垛Y1列", "DB13.W1084")); - list.add(new ItemDto(ItemProtocol.item_palletA1_angle, "码垛A1角度", "DB13.W1086")); - list.add(new ItemDto(ItemProtocol.item_palletX2_line, "码垛X2行", "DB13.W1088")); - list.add(new ItemDto(ItemProtocol.item_palletY2_row, "码垛Y2列", "DB13.W1090")); - list.add(new ItemDto(ItemProtocol.item_palletA2_angle, "码垛A2角度", "DB13.W1092")); - list.add(new ItemDto(ItemProtocol.item_palletX3_line, "码垛X3行", "DB13.W1094")); - list.add(new ItemDto(ItemProtocol.item_palletY3_row, "码垛Y3列", "DB13.W1096")); - list.add(new ItemDto(ItemProtocol.item_palletA3_angle, "码垛A3角度", "DB13.W1098")); - list.add(new ItemDto(ItemProtocol.item_pressCribX1_line, "压垛X1行", "DB13.W1100")); - list.add(new ItemDto(ItemProtocol.item_pressCribY1_row, "压垛Y1列", "DB13.W1102")); - list.add(new ItemDto(ItemProtocol.item_pressCribA1_angle, "压垛A1角度", "DB13.W1104")); - list.add(new ItemDto(ItemProtocol.item_pressCribX2_line, "压垛X2行", "DB13.W1106")); - list.add(new ItemDto(ItemProtocol.item_pressCribY2_row, "压垛Y2列", "DB13.W1108")); - list.add(new ItemDto(ItemProtocol.item_pressCribA2_angle, "压垛A2角度", "DB13.W1110")); - list.add(new ItemDto(ItemProtocol.item_pressCribX3_line, "压垛X3行", "DB13.W1112")); - list.add(new ItemDto(ItemProtocol.item_pressCribY3_row, "压垛Y3列", "DB13.W1114")); - list.add(new ItemDto(ItemProtocol.item_pressCribA3_angle, "压垛A3角度", "DB13.W1116")); - list.add(new ItemDto(ItemProtocol.item_Zoffset, "Z轴偏移", "DB13.W1118")); - list.add(new ItemDto(ItemProtocol.item_pallet_layerQty, "码垛层数", "DB13.W1120")); - list.add(new ItemDto(ItemProtocol.item_pressCrib_layerQty, "压垛层数", "DB13.W1122")); - list.add(new ItemDto(ItemProtocol.item_codeLayerX1_interval, "码层X1间隔", "DB13.W1124")); - list.add(new ItemDto(ItemProtocol.item_codeLayerY1_interval, "码层Y1间隔", "DB13.W1126")); - list.add(new ItemDto(ItemProtocol.item_codeLayerX2_interval, "码层X2间隔", "DB13.W1128")); - list.add(new ItemDto(ItemProtocol.item_codeLayerY2_interval, "码层Y2间隔", "DB13.W1130")); - list.add(new ItemDto(ItemProtocol.item_codeLayerX3_interval, "码层X3间隔", "DB13.W1132")); - list.add(new ItemDto(ItemProtocol.item_codeLayerY3_interval, "码层Y3间隔", "DB13.W1134")); - list.add(new ItemDto(ItemProtocol.item_codeLayerX1_offset, "码层X1偏移", "DB13.W1136")); - list.add(new ItemDto(ItemProtocol.item_codeLayerY1_offset, "码层Y1偏移", "DB13.W1138")); - list.add(new ItemDto(ItemProtocol.item_codeLayerX2_offset, "码层X2偏移", "DB13.W1140")); - list.add(new ItemDto(ItemProtocol.item_codeLayerY2_offset, "码层Y2偏移", "DB13.W1142")); - list.add(new ItemDto(ItemProtocol.item_codeLayerX3_offset, "码层X3偏移", "DB13.W1144")); - list.add(new ItemDto(ItemProtocol.item_codeLayerY3_offset, "码层Y3偏移", "DB13.W1146")); - list.add(new ItemDto(ItemProtocol.item_pressLayerX1_interval, "压层X1间隔", "DB13.W1148")); - list.add(new ItemDto(ItemProtocol.item_pressLayerY1_interval, "压层Y1间隔", "DB13.W1150")); - list.add(new ItemDto(ItemProtocol.item_pressLayerX2_interval, "压层X2间隔", "DB13.W1152")); - list.add(new ItemDto(ItemProtocol.item_pressLayerY2_interval, "压层Y2间隔", "DB13.W1154")); - list.add(new ItemDto(ItemProtocol.item_pressLayerX3_interval, "压层X3间隔", "DB13.W1156")); - list.add(new ItemDto(ItemProtocol.item_pressLayerY3_interval, "压层Y3间隔", "DB13.W1158")); - list.add(new ItemDto(ItemProtocol.item_pressLayerX1_offset, "压层X1偏移", "DB13.W1160")); - list.add(new ItemDto(ItemProtocol.item_pressLayerY1_offset, "压层Y1偏移", "DB13.W1162")); - list.add(new ItemDto(ItemProtocol.item_pressLayerX2_offset, "压层X2偏移", "DB13.W1164")); - list.add(new ItemDto(ItemProtocol.item_pressLayerY2_offset, "压层Y2偏移", "DB13.W1166")); - list.add(new ItemDto(ItemProtocol.item_pressLayerX3_offset, "压层X3偏移", "DB13.W1168")); - list.add(new ItemDto(ItemProtocol.item_pressLayerY3_offset, "压层Y3偏移", "DB13.W1170")); - list.add(new ItemDto(ItemProtocol.item_one_cribTotal, "1#垛总数", "DB13.W1172")); - list.add(new ItemDto(ItemProtocol.item_two_cribTotal, "2#垛总数", "DB13.W1174")); - list.add(new ItemDto(ItemProtocol.item_one_qty, "1#垛当前数", "DB13.W1176")); - list.add(new ItemDto(ItemProtocol.item_two_qty, "2#垛当前数", "DB13.W1178")); - list.add(new ItemDto(ItemProtocol.item_xContainer_length, "1#X托盘长度", "DB13.W1180")); - list.add(new ItemDto(ItemProtocol.item_yContainer_length, "1#Y托盘长度", "DB13.W1182")); - list.add(new ItemDto(ItemProtocol.item_container_getQty, "1#托盘抓取数", "DB13.W1184")); - list.add(new ItemDto(ItemProtocol.item_getX_offset, "1#抓取X偏移", "DB13.W1186")); - list.add(new ItemDto(ItemProtocol.item_getY_offset, "1#抓取Y偏移", "DB13.W1188")); - list.add(new ItemDto(ItemProtocol.item_tool_coordinate, "工具坐标", "DB13.W1190")); - list.add(new ItemDto(ItemProtocol.item_order_qty, "工单数量", "DB13.W1192")); - return list; - } - - @Override - public List getWriteableItemDtos() { - return ItemProtocol.getWriteableItemDtos(); - } - -} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/rljn_package_palletSplit_manipulator/RljnPackagePalletSplitManipulatorDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/rljn_package_palletSplit_manipulator/RljnPackagePalletSplitManipulatorDeviceDriver.java deleted file mode 100644 index 7de860b..0000000 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/rljn_package_palletSplit_manipulator/RljnPackagePalletSplitManipulatorDeviceDriver.java +++ /dev/null @@ -1,1479 +0,0 @@ -package org.nl.acs.device_driver.lnsh.rljn_package_palletSplit_manipulator; - -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -import cn.hutool.http.HttpResponse; -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.ext.wms.service.AcsToWmsService; -import org.nl.acs.instruction.service.InstructionService; -import org.nl.acs.instruction.service.dto.Instruction; -import org.nl.acs.log.service.DeviceExecuteLogService; -import org.nl.acs.monitor.DeviceStageMonitor; -import org.nl.acs.opc.Device; -import org.nl.acs.order.service.ProduceshiftorderService; -import org.nl.acs.order.service.dto.ProduceshiftorderDto; -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.lang.reflect.Field; -import java.util.*; - -/** - * 荣力嘉耐-包装码拆垛机械手 - */ -@Slf4j -@Data -@RequiredArgsConstructor -public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor { - 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 - DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); - @Autowired - AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl"); - @Autowired - ProduceshiftorderService produceshiftorderService = SpringContextHolder.getBean("produceshiftorderServiceImpl"); - - int mode = 0; - int error = 0; - int last_mode = 0; - int last_error = 0; - Boolean isonline = true; - int hasGoods = 0; - String message = null; - Boolean iserror = false; - - 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; - //当前指令 - Instruction inst = null; - //上次指令 - Instruction last_inst = null; - - - //暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域 - int flag; - - String device_code; - int status = 0; - int last_status = 0; - //开机时间 - int open_time = 0; - int last_open_time = 0; - //待机时间 - int standby_time = 0; - int last_standby_time = 0; - //生产时间 - int production_time = 0; - int last_production_time = 0; - //故障时间 - int error_time = 0; - int last_error_time = 0; - int put_station = 0; - int last_put_station = 0; - String barcode; - String last_barcode; - String material; - String last_material; - String order_No = "0"; - String last_order_No = "0"; - int qty = 0; - int last_qty = 0; - //开关机状态 - int onoff_status = 0; - int last_onoff_status = 0; - //当前抓取工位 - int getStation = 0; - int last_getStation = 0; - //批次 - int batch = 0; - int last_batch = 0; - //规格 - String specifications = ""; - String last_specifications = ""; - //累计拆垛数量 - int total_split = 0; - int last_total_split = 0; - - int order_qty = 0; - int last_order_qty = 0; - - int xContainer_length = 0; - int last_xContainer_length = 0; - int yContainer_length = 0; - int last_yContainer_length = 0; - int container_getQty = 0; - int last_container_getQty = 0; - int getX_offset = 0; - int last_getX_offset = 0; - int getY_offset = 0; - int last_getY_offset = 0; - - //垛型参数 - int product_code = 0; - int AlongSide = 0; - int BshortSide = 0; - int Htrapezoidal = 0; - int Wthickness = 0; - int tray_qty = 0; - int tray_high = 0; - int crib_category = 0; - int palletX1_line = 0; - int palletY1_row = 0; - int palletA1_angle = 0; - int palletX2_line = 0; - int palletY2_row = 0; - int palletA2_angle = 0; - int palletX3_line = 0; - int palletY3_row = 0; - int palletA3_angle = 0; - int pressCribX1_line = 0; - int pressCribY1_row = 0; - int pressCribA1_angle = 0; - int pressCribX2_line = 0; - int pressCribY2_row = 0; - int pressCribA2_angle = 0; - int pressCribX3_line = 0; - int pressCribY3_row = 0; - int pressCribA3_angle = 0; - int Zoffset = 0; - int pallet_layerQty = 0; - int pressCrib_layerQty = 0; - int codeLayerX1_interval = 0; - int codeLayerY1_interval = 0; - int codeLayerX2_interval = 0; - int codeLayerY2_interval = 0; - int codeLayerX3_interval = 0; - int codeLayerY3_interval = 0; - int codeLayerX1_offset = 0; - int codeLayerY1_offset = 0; - int codeLayerX2_offset = 0; - int codeLayerY2_offset = 0; - int codeLayerX3_offset = 0; - int codeLayerY3_offset = 0; - int pressLayerX1_interval = 0; - int pressLayerY1_interval = 0; - int pressLayerX2_interval = 0; - int pressLayerY2_interval = 0; - int pressLayerX3_interval = 0; - int pressLayerY3_interval = 0; - int pressLayerX1_offset = 0; - int pressLayerY1_offset = 0; - int pressLayerX2_offset = 0; - int pressLayerY2_offset = 0; - int pressLayerX3_offset = 0; - int pressLayerY3_offset = 0; - int one_cribTotal = 0; - int two_cribTotal = 0; - int one_qty = 0; - int two_qty = 0; - int tool_coordinate = 0; - - int last_product_code = 0; - int last_AlongSide = 0; - int last_BshortSide = 0; - int last_Htrapezoidal = 0; - int last_Wthickness = 0; - int last_tray_qty = 0; - int last_tray_high = 0; - int last_crib_category = 0; - int last_palletX1_line = 0; - int last_palletY1_row = 0; - int last_palletA1_angle = 0; - int last_palletX2_line = 0; - int last_palletY2_row = 0; - int last_palletA2_angle = 0; - int last_palletX3_line = 0; - int last_palletY3_row = 0; - int last_palletA3_angle = 0; - int last_pressCribX1_line = 0; - int last_pressCribY1_row = 0; - int last_pressCribA1_angle = 0; - int last_pressCribX2_line = 0; - int last_pressCribY2_row = 0; - int last_pressCribA2_angle = 0; - int last_pressCribX3_line = 0; - int last_pressCribY3_row = 0; - int last_pressCribA3_angle = 0; - int last_Zoffset = 0; - int last_pallet_layerQty = 0; - int last_pressCrib_layerQty = 0; - int last_codeLayerX1_interval = 0; - int last_codeLayerY1_interval = 0; - int last_codeLayerX2_interval = 0; - int last_codeLayerY2_interval = 0; - int last_codeLayerX3_interval = 0; - int last_codeLayerY3_interval = 0; - int last_codeLayerX1_offset = 0; - int last_codeLayerY1_offset = 0; - int last_codeLayerX2_offset = 0; - int last_codeLayerY2_offset = 0; - int last_codeLayerX3_offset = 0; - int last_codeLayerY3_offset = 0; - int last_pressLayerX1_interval = 0; - int last_pressLayerY1_interval = 0; - int last_pressLayerX2_interval = 0; - int last_pressLayerY2_interval = 0; - int last_pressLayerX3_interval = 0; - int last_pressLayerY3_interval = 0; - int last_pressLayerX1_offset = 0; - int last_pressLayerY1_offset = 0; - int last_pressLayerX2_offset = 0; - int last_pressLayerY2_offset = 0; - int last_pressLayerX3_offset = 0; - int last_pressLayerY3_offset = 0; - int last_one_cribTotal = 0; - int last_two_cribTotal = 0; - int last_one_qty = 0; - int last_two_qty = 0; - int last_tool_coordinate = 0; - - @Override - public Device getDevice() { - return this.device; - } - - - @Override - public void execute() { - String message = null; - try { - device_code = this.getDeviceCode(); - mode = this.itemProtocol.getMode(); - status = this.itemProtocol.getStatus(); - error = this.itemProtocol.getError(); - put_station = this.itemProtocol.getPutStation(); - barcode = this.itemProtocol.getBarcode(); - material = this.itemProtocol.getMaterial(); - open_time = this.itemProtocol.getOpen_time(); - standby_time = this.itemProtocol.getStandby_time(); - production_time = this.itemProtocol.getProduction_time(); - error_time = this.itemProtocol.getError_time(); - order_No = this.itemProtocol.getOrder_No(); - qty = this.itemProtocol.getQty(); - onoff_status = this.itemProtocol.getOnoff_status(); - getStation = this.itemProtocol.getGetStation(); - specifications = this.itemProtocol.getSpecifications(); - batch = this.itemProtocol.getBatch(); - total_split = this.itemProtocol.getTotal_split(); - order_qty = this.itemProtocol.getOrder_qty(); - xContainer_length = this.itemProtocol.getXContainer_length(); - yContainer_length = this.itemProtocol.getYContainer_length(); - container_getQty = this.itemProtocol.getContainer_getQty(); - getX_offset = this.itemProtocol.getGetX_offset(); - getY_offset = this.itemProtocol.getGetY_offset(); - - product_code = this.itemProtocol.getProduct_code(); - AlongSide = this.itemProtocol.getAlongSide(); - BshortSide = this.itemProtocol.getBshortSide(); - Htrapezoidal = this.itemProtocol.getHtrapezoidal(); - Wthickness = this.itemProtocol.getWthickness(); - tray_qty = this.itemProtocol.getTray_qty(); - tray_high = this.itemProtocol.getTray_high(); - crib_category = this.itemProtocol.getCrib_category(); - palletX1_line = this.itemProtocol.getPalletX1_line(); - palletY1_row = this.itemProtocol.getPalletY1_row(); - palletA1_angle = this.itemProtocol.getPalletA1_angle(); - palletX2_line = this.itemProtocol.getPalletX2_line(); - palletY2_row = this.itemProtocol.getPalletY2_row(); - palletA2_angle = this.itemProtocol.getPalletA2_angle(); - palletX3_line = this.itemProtocol.getPalletX3_line(); - palletY3_row = this.itemProtocol.getPalletY3_row(); - palletA3_angle = this.itemProtocol.getPalletA3_angle(); - pressCribX1_line = this.itemProtocol.getPressCribX1_line(); - pressCribY1_row = this.itemProtocol.getPressCribY1_row(); - pressCribA1_angle = this.itemProtocol.getPressCribA1_angle(); - pressCribX2_line = this.itemProtocol.getPressCribX2_line(); - pressCribY2_row = this.itemProtocol.getPressCribY2_row(); - pressCribA2_angle = this.itemProtocol.getPressCribA2_angle(); - pressCribX3_line = this.itemProtocol.getPressCribX3_line(); - pressCribY3_row = this.itemProtocol.getPressCribY3_row(); - pressCribA3_angle = this.itemProtocol.getPressCribA3_angle(); - Zoffset = this.itemProtocol.getZoffset(); - pallet_layerQty = this.itemProtocol.getPallet_layerQty(); - pressCrib_layerQty = this.itemProtocol.getPressCrib_layerQty(); - codeLayerX1_interval = this.itemProtocol.getCodeLayerX1_interval(); - codeLayerY1_interval = this.itemProtocol.getCodeLayerY1_interval(); - codeLayerX2_interval = this.itemProtocol.getCodeLayerX2_interval(); - codeLayerY2_interval = this.itemProtocol.getCodeLayerY2_interval(); - codeLayerX3_interval = this.itemProtocol.getCodeLayerX3_interval(); - codeLayerY3_interval = this.itemProtocol.getcodeLayerY3_interval(); - codeLayerX1_offset = this.itemProtocol.getCodeLayerX1_offset(); - codeLayerY1_offset = this.itemProtocol.getCodeLayerY1_offset(); - codeLayerX2_offset = this.itemProtocol.getCodeLayerX2_offset(); - codeLayerY2_offset = this.itemProtocol.getCodeLayerY2_offset(); - codeLayerX3_offset = this.itemProtocol.getCodeLayerX3_offset(); - codeLayerY3_offset = this.itemProtocol.getCodeLayerY3_offset(); - pressLayerX1_interval = this.itemProtocol.getPressLayerX1_interval(); - pressLayerY1_interval = this.itemProtocol.getPressLayerY1_interval(); - pressLayerX2_interval = this.itemProtocol.getPressLayerX2_interval(); - pressLayerY2_interval = this.itemProtocol.getPressLayerY2_interval(); - pressLayerX3_interval = this.itemProtocol.getPressLayerX3_interval(); - pressLayerY3_interval = this.itemProtocol.getPressLayerY3_interval(); - pressLayerX1_offset = this.itemProtocol.getPressLayerX1_offset(); - pressLayerY1_offset = this.itemProtocol.getPressLayerY1_offset(); - pressLayerX2_offset = this.itemProtocol.getPressLayerX2_offset(); - pressLayerY2_offset = this.itemProtocol.getPressLayerY2_offset(); - pressLayerX3_offset = this.itemProtocol.getPressLayerX3_offset(); - pressLayerY3_offset = this.itemProtocol.getPressLayerY3_offset(); - one_cribTotal = this.itemProtocol.getOne_cribTotal(); - two_cribTotal = this.itemProtocol.getTwo_cribTotal(); - one_qty = this.itemProtocol.getOne_qty(); - two_qty = this.itemProtocol.getTwo_qty(); - tool_coordinate = this.itemProtocol.getTool_coordinate(); - - if (mode != last_mode) { - this.setRequireSucess(false); - logServer.deviceItemValue(this.device_code,"mode" ,String.valueOf(mode)); - logServer.deviceExecuteLog(this.device_code,"","","信号mode:" + last_mode + "->" + mode); - } - if (status != last_status) { - logServer.deviceItemValue(this.device_code,"status" ,String.valueOf(status)); - logServer.deviceExecuteLog(this.device_code,"","","信号status:" + last_status + "->" + status); - } - if (onoff_status != last_onoff_status) { - logServer.deviceItemValue(this.device_code,"onoff_status" ,String.valueOf(onoff_status)); - logServer.deviceExecuteLog(this.device_code,"","","信号onoff_status:" + last_onoff_status + "->" + onoff_status); - } - if (put_station != last_put_station) { - logServer.deviceItemValue(this.device_code,"put_station" ,String.valueOf(put_station)); - logServer.deviceExecuteLog(this.device_code,"","","信号put_station:" + last_put_station + "->" + put_station); - } - if (getStation != last_getStation) { - logServer.deviceItemValue(this.device_code,"getStation" ,String.valueOf(getStation)); - logServer.deviceExecuteLog(this.device_code,"","","信号getStation:" + last_getStation + "->" + getStation); - } - if (error != last_error) { - logServer.deviceItemValue(this.device_code,"error" ,String.valueOf(error)); - logServer.deviceExecuteLog(this.device_code,"","","信号error:" + last_error + "->" + error); - } - if (open_time != last_open_time) { - logServer.deviceItemValue(this.device_code,"open_time" ,String.valueOf(open_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号open_time:" + last_open_time + "->" + open_time); - } - if (standby_time != last_standby_time) { - logServer.deviceItemValue(this.device_code,"standby_time" ,String.valueOf(standby_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号standby_time:" + last_standby_time + "->" + standby_time); - } - if (production_time != last_production_time) { - logServer.deviceItemValue(this.device_code,"production_time" ,String.valueOf(production_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号production_time:" + last_production_time + "->" + production_time); - } - if (error_time != last_error_time) { - logServer.deviceItemValue(this.device_code,"error_time" ,String.valueOf(error_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号error_time:" + last_error_time + "->" + error_time); - } - if (!StrUtil.equals(barcode,last_barcode)) { - logServer.deviceItemValue(this.device_code,"barcode", barcode); - logServer.deviceExecuteLog(this.device_code,"","","信号barcode:" + last_barcode + "->" + barcode); - } - if (!StrUtil.equals(material,last_material)) { - logServer.deviceItemValue(this.device_code,"material", material); - logServer.deviceExecuteLog(this.device_code,"","","信号material:" + last_material + "->" + material); - } - if (qty != last_qty) { - logServer.deviceItemValue(this.device_code,"qty" ,String.valueOf(qty)); - logServer.deviceExecuteLog(this.device_code,"","","信号qty:" + last_qty + "->" + qty); - } - if (!StrUtil.equals(specifications,last_specifications)) { - logServer.deviceItemValue(this.device_code,"specifications" ,specifications); - logServer.deviceExecuteLog(this.device_code,"","","信号specifications:" + last_specifications + "->" + specifications); - } - if (batch != last_batch) { - logServer.deviceItemValue(this.device_code,"batch" ,String.valueOf(batch)); - logServer.deviceExecuteLog(this.device_code,"","","信号batch:" + last_batch + "->" + batch); - } - if (order_qty != last_order_qty) { - logServer.deviceItemValue(this.device_code,"order_qty" ,String.valueOf(order_qty)); - logServer.deviceExecuteLog(this.device_code,"","","信号order_qty:" + last_order_qty + "->" + order_qty); - } - if (!StrUtil.equals(order_No,last_order_No)) { - logServer.deviceItemValue(this.device_code,"order_No" ,order_No); - logServer.deviceExecuteLog(this.device_code,"","","信号order_No:" + last_order_No + "->" + order_No); - } - if (total_split != last_total_split) { - logServer.deviceItemValue(this.device_code,"total_split" ,String.valueOf(total_split)); - logServer.deviceExecuteLog(this.device_code,"","","信号total_split:" + last_total_split + "->" + total_split); - } - if (product_code != last_product_code) { - logServer.deviceItemValue(this.device_code,"product_code" ,String.valueOf(product_code)); - logServer.deviceExecuteLog(this.device_code,"","","信号product_code:" + last_product_code + "->" + product_code); - } - if (AlongSide != last_AlongSide) { - logServer.deviceItemValue(this.device_code,"AlongSide" ,String.valueOf(AlongSide)); - logServer.deviceExecuteLog(this.device_code,"","","信号AlongSide:" + last_AlongSide + "->" + AlongSide); - } - if (BshortSide != last_BshortSide) { - logServer.deviceItemValue(this.device_code,"BshortSide" ,String.valueOf(BshortSide)); - logServer.deviceExecuteLog(this.device_code,"","","信号BshortSide:" + last_BshortSide + "->" + BshortSide); - } - if (Htrapezoidal != last_Htrapezoidal) { - logServer.deviceItemValue(this.device_code,"Htrapezoidal" ,String.valueOf(Htrapezoidal)); - logServer.deviceExecuteLog(this.device_code,"","","信号Htrapezoidal:" + last_Htrapezoidal + "->" + Htrapezoidal); - } - if (Wthickness != last_Wthickness) { - logServer.deviceItemValue(this.device_code,"Wthickness" ,String.valueOf(Wthickness)); - logServer.deviceExecuteLog(this.device_code,"","","信号Wthickness:" + last_Wthickness + "->" + Wthickness); - } - if (tray_qty != last_tray_qty) { - logServer.deviceItemValue(this.device_code,"tray_qty" ,String.valueOf(tray_qty)); - logServer.deviceExecuteLog(this.device_code,"","","信号tray_qty:" + last_tray_qty + "->" + tray_qty); - } - if (tray_high != last_tray_high) { - logServer.deviceItemValue(this.device_code,"tray_high" ,String.valueOf(tray_high)); - logServer.deviceExecuteLog(this.device_code,"","","信号tray_high:" + last_tray_high + "->" + tray_high); - } - if (crib_category != last_crib_category) { - logServer.deviceItemValue(this.device_code,"crib_category" ,String.valueOf(crib_category)); - logServer.deviceExecuteLog(this.device_code,"","","信号crib_category:" + last_crib_category + "->" + crib_category); - } - if (palletX1_line != last_palletX1_line) { - logServer.deviceItemValue(this.device_code,"palletX1_line" ,String.valueOf(palletX1_line)); - logServer.deviceExecuteLog(this.device_code,"","","信号palletX1_line:" + last_palletX1_line + "->" + palletX1_line); - } - if (palletY1_row != last_palletY1_row) { - logServer.deviceItemValue(this.device_code,"palletY1_row" ,String.valueOf(palletY1_row)); - logServer.deviceExecuteLog(this.device_code,"","","信号palletY1_row:" + last_palletY1_row + "->" + palletY1_row); - } - if (palletA1_angle != last_palletA1_angle) { - logServer.deviceItemValue(this.device_code,"palletA1_angle" ,String.valueOf(palletA1_angle)); - logServer.deviceExecuteLog(this.device_code,"","","信号palletA1_angle:" + last_palletA1_angle + "->" + palletA1_angle); - } - if (palletX2_line != last_palletX2_line) { - logServer.deviceItemValue(this.device_code,"palletX2_line" ,String.valueOf(palletX2_line)); - logServer.deviceExecuteLog(this.device_code,"","","信号palletX2_line:" + last_palletX2_line + "->" + palletX2_line); - } - if (palletY2_row != last_palletY2_row) { - logServer.deviceItemValue(this.device_code,"palletY2_row" ,String.valueOf(palletY2_row)); - logServer.deviceExecuteLog(this.device_code,"","","信号palletY2_row:" + last_palletY2_row + "->" + palletY2_row); - } - if (palletA2_angle != last_palletA2_angle) { - logServer.deviceItemValue(this.device_code,"palletA2_angle" ,String.valueOf(palletA2_angle)); - logServer.deviceExecuteLog(this.device_code,"","","信号palletA2_angle:" + last_palletA2_angle + "->" + palletA2_angle); - } - if (palletX3_line != last_palletX3_line) { - logServer.deviceItemValue(this.device_code,"palletX3_line" ,String.valueOf(palletX3_line)); - logServer.deviceExecuteLog(this.device_code,"","","信号palletX3_line:" + last_palletX3_line + "->" + palletX3_line); - } - if (palletY3_row != last_palletY3_row) { - logServer.deviceItemValue(this.device_code,"palletY3_row" ,String.valueOf(palletY3_row)); - logServer.deviceExecuteLog(this.device_code,"","","信号palletY3_row:" + last_palletY3_row + "->" + palletY3_row); - } - if (palletA3_angle != last_palletA3_angle) { - logServer.deviceItemValue(this.device_code,"palletA3_angle" ,String.valueOf(palletA3_angle)); - logServer.deviceExecuteLog(this.device_code,"","","信号palletA3_angle:" + last_palletA3_angle + "->" + palletA3_angle); - } - if (pressCribX1_line != last_pressCribX1_line) { - logServer.deviceItemValue(this.device_code,"pressCribX1_line" ,String.valueOf(pressCribX1_line)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCribX1_line:" + last_pressCribX1_line + "->" + pressCribX1_line); - } - if (pressCribY1_row != last_pressCribY1_row) { - logServer.deviceItemValue(this.device_code,"pressCribY1_row" ,String.valueOf(pressCribY1_row)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCribY1_row:" + last_pressCribY1_row + "->" + pressCribY1_row); - } - if (pressCribA1_angle != last_pressCribA1_angle) { - logServer.deviceItemValue(this.device_code,"pressCribA1_angle" ,String.valueOf(pressCribA1_angle)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCribA1_angle:" + last_pressCribA1_angle + "->" + pressCribA1_angle); - } - if (pressCribX2_line != last_pressCribX2_line) { - logServer.deviceItemValue(this.device_code,"pressCribX2_line" ,String.valueOf(pressCribX2_line)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCribX2_line:" + last_pressCribX2_line + "->" + pressCribX2_line); - } - if (pressCribY2_row != last_pressCribY2_row) { - logServer.deviceItemValue(this.device_code,"pressCribY2_row" ,String.valueOf(pressCribY2_row)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCribY2_row:" + last_pressCribY2_row + "->" + pressCribY2_row); - } - if (pressCribA2_angle != last_pressCribA2_angle) { - logServer.deviceItemValue(this.device_code,"pressCribA2_angle" ,String.valueOf(pressCribA2_angle)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCribA2_angle:" + last_pressCribA2_angle + "->" + pressCribA2_angle); - } - if (pressCribX3_line != last_pressCribX3_line) { - logServer.deviceItemValue(this.device_code,"pressCribX3_line" ,String.valueOf(pressCribX3_line)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCribX3_line:" + last_pressCribX3_line + "->" + pressCribX3_line); - } - if (pressCribY3_row != last_pressCribY3_row) { - logServer.deviceItemValue(this.device_code,"pressCribY3_row" ,String.valueOf(pressCribY3_row)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCribY3_row:" + last_pressCribY3_row + "->" + pressCribY3_row); - } - if (pressCribA3_angle != last_pressCribA3_angle) { - logServer.deviceItemValue(this.device_code,"pressCribA3_angle" ,String.valueOf(pressCribA3_angle)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCribA3_angle:" + last_pressCribA3_angle + "->" + pressCribA3_angle); - } - if (Zoffset != last_Zoffset) { - logServer.deviceItemValue(this.device_code,"Zoffset" ,String.valueOf(Zoffset)); - logServer.deviceExecuteLog(this.device_code,"","","信号Zoffset:" + last_Zoffset + "->" + Zoffset); - } - if (pallet_layerQty != last_pallet_layerQty) { - logServer.deviceItemValue(this.device_code,"pallet_layerQty" ,String.valueOf(pallet_layerQty)); - logServer.deviceExecuteLog(this.device_code,"","","信号pallet_layerQty:" + last_pallet_layerQty + "->" + pallet_layerQty); - } - if (pressCrib_layerQty != last_pressCrib_layerQty) { - logServer.deviceItemValue(this.device_code,"pressCrib_layerQty" ,String.valueOf(pressCrib_layerQty)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressCrib_layerQty:" + last_pressCrib_layerQty + "->" + pressCrib_layerQty); - } - if (codeLayerX1_interval != last_codeLayerX1_interval) { - logServer.deviceItemValue(this.device_code,"codeLayerX1_interval" ,String.valueOf(codeLayerX1_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerX1_interval:" + last_codeLayerX1_interval + "->" + codeLayerX1_interval); - } - if (codeLayerY1_interval != last_codeLayerY1_interval) { - logServer.deviceItemValue(this.device_code,"codeLayerY1_interval" ,String.valueOf(codeLayerY1_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerY1_interval:" + last_codeLayerY1_interval + "->" + codeLayerY1_interval); - } - if (codeLayerX2_interval != last_codeLayerX2_interval) { - logServer.deviceItemValue(this.device_code,"codeLayerX2_interval" ,String.valueOf(codeLayerX2_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerX2_interval:" + last_codeLayerX2_interval + "->" + codeLayerX2_interval); - } - if (codeLayerY2_interval != last_codeLayerY2_interval) { - logServer.deviceItemValue(this.device_code,"codeLayerY2_interval" ,String.valueOf(codeLayerY2_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerY2_interval:" + last_codeLayerY2_interval + "->" + codeLayerY2_interval); - } - if (codeLayerX3_interval != last_codeLayerX3_interval) { - logServer.deviceItemValue(this.device_code,"codeLayerX3_interval" ,String.valueOf(codeLayerX3_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerX3_interval:" + last_codeLayerX3_interval + "->" + codeLayerX3_interval); - } - if (codeLayerY3_interval != last_codeLayerY3_interval) { - logServer.deviceItemValue(this.device_code,"codeLayerY3_interval" ,String.valueOf(codeLayerY3_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerY3_interval:" + last_codeLayerY3_interval + "->" + codeLayerY3_interval); - } - if (codeLayerX1_offset != last_codeLayerX1_offset) { - logServer.deviceItemValue(this.device_code,"codeLayerX1_offset" ,String.valueOf(codeLayerX1_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerX1_offset:" + last_codeLayerX1_offset + "->" + codeLayerX1_offset); - } - if (codeLayerY1_offset != last_codeLayerY1_offset) { - logServer.deviceItemValue(this.device_code,"codeLayerY1_offset" ,String.valueOf(codeLayerY1_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerY1_offset:" + last_codeLayerY1_offset + "->" + codeLayerY1_offset); - } - if (codeLayerX2_offset != last_codeLayerX2_offset) { - logServer.deviceItemValue(this.device_code,"codeLayerX2_offset" ,String.valueOf(codeLayerX2_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerX2_offset:" + last_codeLayerX2_offset + "->" + codeLayerX2_offset); - } - if (codeLayerY2_offset != last_codeLayerY2_offset) { - logServer.deviceItemValue(this.device_code,"codeLayerY2_offset" ,String.valueOf(codeLayerY2_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerY2_offset:" + last_codeLayerY2_offset + "->" + codeLayerY2_offset); - } - if (codeLayerX3_offset != last_codeLayerX3_offset) { - logServer.deviceItemValue(this.device_code,"codeLayerX3_offset" ,String.valueOf(codeLayerX3_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerX3_offset:" + last_codeLayerX3_offset + "->" + codeLayerX3_offset); - } - if (codeLayerY3_offset != last_codeLayerY3_offset) { - logServer.deviceItemValue(this.device_code,"codeLayerY3_offset" ,String.valueOf(codeLayerY3_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerY3_offset:" + last_codeLayerY3_offset + "->" + codeLayerY3_offset); - } - if (pressLayerX1_interval != last_pressLayerX1_interval) { - logServer.deviceItemValue(this.device_code,"pressLayerX1_interval" ,String.valueOf(pressLayerX1_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerX1_interval:" + last_pressLayerX1_interval + "->" + pressLayerX1_interval); - } - if (pressLayerY1_interval != last_pressLayerY1_interval) { - logServer.deviceItemValue(this.device_code,"pressLayerY1_interval" ,String.valueOf(pressLayerY1_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerY1_interval:" + last_pressLayerY1_interval + "->" + pressLayerY1_interval); - } - if (pressLayerX2_interval != last_pressLayerX2_interval) { - logServer.deviceItemValue(this.device_code,"pressLayerX2_interval" ,String.valueOf(pressLayerX2_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerX2_interval:" + last_pressLayerX2_interval + "->" + pressLayerX2_interval); - } - if (pressLayerY2_interval != last_pressLayerY2_interval) { - logServer.deviceItemValue(this.device_code,"pressLayerY2_interval" ,String.valueOf(pressLayerY2_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerY2_interval:" + last_pressLayerY2_interval + "->" + pressLayerY2_interval); - } - if (pressLayerX3_interval != last_pressLayerX3_interval) { - logServer.deviceItemValue(this.device_code,"pressLayerX3_interval" ,String.valueOf(pressLayerX3_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerX3_interval:" + last_pressLayerX3_interval + "->" + pressLayerX3_interval); - } - if (pressLayerY3_interval != last_pressLayerY3_interval) { - logServer.deviceItemValue(this.device_code,"pressLayerY3_interval" ,String.valueOf(pressLayerY3_interval)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerY3_interval:" + last_pressLayerY3_interval + "->" + pressLayerY3_interval); - } - if (pressLayerX1_offset != last_pressLayerX1_offset) { - logServer.deviceItemValue(this.device_code,"pressLayerX1_offset" ,String.valueOf(pressLayerX1_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerX1_offset:" + last_pressLayerX1_offset + "->" + pressLayerX1_offset); - } - if (pressLayerY1_offset != last_pressLayerY1_offset) { - logServer.deviceItemValue(this.device_code,"pressLayerY1_offset" ,String.valueOf(pressLayerY1_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerY1_offset:" + last_pressLayerY1_offset + "->" + pressLayerY1_offset); - } - if (pressLayerX2_offset != last_pressLayerX2_offset) { - logServer.deviceItemValue(this.device_code,"pressLayerX2_offset" ,String.valueOf(pressLayerX2_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerX2_offset:" + last_pressLayerX2_offset + "->" + pressLayerX2_offset); - } - if (pressLayerY2_offset != last_pressLayerY2_offset) { - logServer.deviceItemValue(this.device_code,"pressLayerY2_offset" ,String.valueOf(pressLayerY2_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerY2_offset:" + last_pressLayerY2_offset + "->" + pressLayerY2_offset); - } - if (pressLayerX3_offset != last_pressLayerX3_offset) { - logServer.deviceItemValue(this.device_code,"pressLayerX3_offset" ,String.valueOf(pressLayerX3_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerX3_offset:" + last_pressLayerX3_offset + "->" + pressLayerX3_offset); - } - if (pressLayerY3_offset != last_pressLayerY3_offset) { - logServer.deviceItemValue(this.device_code,"pressLayerY3_offset" ,String.valueOf(pressLayerY3_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerY3_offset:" + last_pressLayerY3_offset + "->" + pressLayerY3_offset); - } - if (one_cribTotal != last_one_cribTotal) { - logServer.deviceItemValue(this.device_code,"one_cribTotal" ,String.valueOf(one_cribTotal)); - logServer.deviceExecuteLog(this.device_code,"","","信号one_cribTotal:" + last_one_cribTotal + "->" + one_cribTotal); - } - if (two_cribTotal != last_two_cribTotal) { - logServer.deviceItemValue(this.device_code,"two_cribTotal" ,String.valueOf(two_cribTotal)); - logServer.deviceExecuteLog(this.device_code,"","","信号two_cribTotal:" + last_two_cribTotal + "->" + two_cribTotal); - } - if (one_qty != last_one_qty) { - logServer.deviceItemValue(this.device_code,"one_qty" ,String.valueOf(one_qty)); - logServer.deviceExecuteLog(this.device_code,"","","信号one_qty:" + last_one_qty + "->" + one_qty); - } - if (two_qty != last_two_qty) { - logServer.deviceItemValue(this.device_code,"two_qty" ,String.valueOf(two_qty)); - logServer.deviceExecuteLog(this.device_code,"","","信号two_qty:" + last_two_qty + "->" + two_qty); - } - if (tool_coordinate != last_tool_coordinate) { - logServer.deviceItemValue(this.device_code,"tool_coordinate" ,String.valueOf(tool_coordinate)); - logServer.deviceExecuteLog(this.device_code,"","","信号tool_coordinate:" + last_tool_coordinate + "->" + tool_coordinate); - } - if (xContainer_length != last_xContainer_length) { - logServer.deviceItemValue(this.device_code,"xContainer_length" ,String.valueOf(xContainer_length)); - logServer.deviceExecuteLog(this.device_code,"","","信号xContainer_length:" + last_xContainer_length + "->" + xContainer_length); - } - if (yContainer_length != last_yContainer_length) { - logServer.deviceItemValue(this.device_code,"yContainer_length" ,String.valueOf(yContainer_length)); - logServer.deviceExecuteLog(this.device_code,"","","信号yContainer_length:" + last_yContainer_length + "->" + yContainer_length); - } - if (container_getQty != last_container_getQty) { - logServer.deviceItemValue(this.device_code,"container_getQty" ,String.valueOf(container_getQty)); - logServer.deviceExecuteLog(this.device_code,"","","信号container_getQty:" + last_container_getQty + "->" + container_getQty); - } - if (getX_offset != last_getX_offset) { - logServer.deviceItemValue(this.device_code,"getX_offset" ,String.valueOf(getX_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号getX_offset:" + last_getX_offset + "->" + getX_offset); - } - if (getY_offset != last_getY_offset) { - logServer.deviceItemValue(this.device_code,"getY_offset" ,String.valueOf(getY_offset)); - logServer.deviceExecuteLog(this.device_code,"","","信号getY_offset:" + last_getY_offset + "->" + getY_offset); - } - - } 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; - case 4: - //排产单确认 - if (!requireSucess && !order_No.equals("0")) { - JSONObject json = new JSONObject(); - json.put("producetask_code",order_No); - json.put("device_code",this.device_code); - json.put("material_code",material); - json.put("qty",qty); - json.put("type","1"); - enterProduction(json); - } - break; - case 5: - //获取托盘信息 - if (!requireSucess) { - getVehicle(); - } - break; - case 6: - //码垛完成 - if (!requireSucess) { - applyEmpty(); - palletizing(); - } - break; - case 7: - //码垛强制完成 半托缓存 - if (!requireSucess) { - applyEmpty(); - mandatoryPalletizing("0"); - } - break; - case 8: - //申请空盘 - if (!requireSucess) { - applyEmpty(); - } - break; - case 9: - //工单完成 - if (!requireSucess && !order_No.equals("0")) { - JSONObject json = new JSONObject(); - json.put("producetask_code",order_No); - json.put("device_code",this.device_code); - json.put("material_code",material); - json.put("qty",qty); - json.put("type","3"); - enterProduction(json); - } - break; - case 10: - //叫料 - if (!requireSucess && getStation>0 && StrUtil.isNotEmpty(material)) { - callMaterial(); - } - break; - case 11: - //强制去包装 - if (!requireSucess) { - applyEmpty(); - mandatoryPalletizing("1"); - } - break; - case 12: - //申请空盘入库 - if (!requireSucess) { - applyEmptyIn(); - } - } - - switch (flag) { - //取货完成 - case 1: - return; - //放货完成 - case 2: - return; - - } - - } - last_mode = mode; - last_status = status; - last_error = error; - last_onoff_status = onoff_status; - last_put_station = put_station; - last_getStation = getStation; - last_barcode = barcode; - last_material = material; - last_specifications = specifications; - last_batch = batch; - last_qty = qty; - last_open_time = open_time; - last_standby_time = standby_time; - last_production_time = production_time; - last_error_time = error_time; - last_order_No = order_No; - last_total_split = total_split; - last_order_qty = order_qty; - - last_product_code = product_code; - last_AlongSide = AlongSide; - last_BshortSide = BshortSide; - last_Htrapezoidal = Htrapezoidal; - last_Wthickness = Wthickness; - last_tray_qty = tray_qty; - last_tray_high = tray_high; - last_crib_category = crib_category; - last_palletX1_line = palletX1_line; - last_palletY1_row = palletY1_row; - last_palletA1_angle = palletA1_angle; - last_palletX2_line = palletX2_line; - last_palletY2_row = palletY2_row; - last_palletA2_angle = palletA2_angle; - last_palletX3_line = palletX3_line; - last_palletY3_row = palletY3_row; - last_palletA3_angle = palletA3_angle; - last_pressCribX1_line = pressCribX1_line; - last_pressCribY1_row = pressCribY1_row; - last_pressCribA1_angle = pressCribA1_angle; - last_pressCribX2_line = pressCribX2_line; - last_pressCribY2_row = pressCribY2_row; - last_pressCribA2_angle = pressCribA2_angle; - last_pressCribX3_line = pressCribX3_line; - last_pressCribY3_row = pressCribY3_row; - last_pressCribA3_angle = pressCribA3_angle; - last_Zoffset = Zoffset; - last_pallet_layerQty = pallet_layerQty; - last_pressCrib_layerQty = pressCrib_layerQty; - last_codeLayerX1_interval = codeLayerX1_interval; - last_codeLayerY1_interval = codeLayerY1_interval; - last_codeLayerX2_interval = codeLayerX2_interval; - last_codeLayerY2_interval = codeLayerY2_interval; - last_codeLayerX3_interval = codeLayerX3_interval; - last_codeLayerY3_interval = codeLayerY3_interval; - last_codeLayerX1_offset = codeLayerX1_offset; - last_codeLayerY1_offset = codeLayerY1_offset; - last_codeLayerX2_offset = codeLayerX2_offset; - last_codeLayerY2_offset = codeLayerY2_offset; - last_codeLayerX3_offset = codeLayerX3_offset; - last_codeLayerY3_offset = codeLayerY3_offset; - last_pressLayerX1_interval = pressLayerX1_interval; - last_pressLayerY1_interval = pressLayerY1_interval; - last_pressLayerX2_interval = pressLayerX2_interval; - last_pressLayerY2_interval = pressLayerY2_interval; - last_pressLayerX3_interval = pressLayerX3_interval; - last_pressLayerY3_interval = pressLayerY3_interval; - last_pressLayerX1_offset = pressLayerX1_offset; - last_pressLayerY1_offset = pressLayerY1_offset; - last_pressLayerX2_offset = pressLayerX2_offset; - last_pressLayerY2_offset = pressLayerY2_offset; - last_pressLayerX3_offset = pressLayerX3_offset; - last_pressLayerY3_offset = pressLayerY3_offset; - last_one_cribTotal = one_cribTotal; - last_two_cribTotal = two_cribTotal; - last_one_qty = one_qty; - last_two_qty = two_qty; - last_tool_coordinate = tool_coordinate; - last_xContainer_length = xContainer_length; - last_yContainer_length = yContainer_length; - last_container_getQty = container_getQty; - last_getX_offset = getX_offset; - last_getY_offset = getY_offset; - } - - - public boolean exe_error() { - if (this.error == 0) { - return true; - } else { - log.debug("设备报警"); - return false; - } - } - - - /** - * 叫料 - * - * @param - */ - public synchronized boolean callMaterial() { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - JSONObject json = new JSONObject(); - String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code"); - String demosub = linkobj.substring(1,linkobj.length()-1); - String demoArray[] = demosub.split(","); - List demoList = Arrays.asList(demoArray); - json.put("device_code",demoList.get(getStation-1).replace("\"","")); - json.put("type","2"); - json.put("material_code",material); - json.put("vehicle_code",barcode); - json.put("is_full","1"); - HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); - if (ObjectUtil.isNotEmpty(result)) { - JSONObject jsonObject = JSONObject.parseObject(result.body()); - if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) { - this.writing(1); - } - this.setRequireSucess(true); - } - return true; - } - } - - - - /** - * 排产单确认 - * - * @param - */ - public synchronized boolean enterProduction(JSONObject json) { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - HttpResponse result = acsToWmsService.enterOrder(json); - if (ObjectUtil.isNotEmpty(result)) { - JSONObject jsonObject = JSONObject.parseObject(result.body()); - if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) { - ProduceshiftorderDto dto = produceshiftorderService.findByCode(order_No); - if (this.mode == 4) { - dto.setOrder_status("1"); - } else if (this.mode == 9){ - dto.setOrder_status("2"); - } - produceshiftorderService.update(dto); - this.writing(this.mode); - this.setRequireSucess(true); - } - } - - return true; - } - } - - /** - * 获取托盘信息 - * - * @param - */ - public synchronized boolean getVehicle() { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - JSONObject json = new JSONObject(); - String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code"); - String demosub = linkobj.substring(1,linkobj.length()-1); - String demoArray[] = demosub.split(","); - List demoList = Arrays.asList(demoArray); - json.put("device_code",demoList.get(put_station-1).replace("\"","")); - json.put("vehicle_code",barcode); - JSONObject jo = acsToWmsService.getVehicle(json); - - if (jo.getInteger("status") == 200) { - JSONObject content = jo.getJSONObject("content"); - String qty = content.getString("qty"); - String material_code = content.getString("material_code"); - String material_name = content.getString("material_name"); - String product_code = content.getString("product_code"); - String AlongSide = content.getString("AlongSide"); - String BshortSide = content.getString("BshortSide"); - String Htrapezoidal = content.getString("Htrapezoidal"); - String Wthickness = content.getString("Wthickness"); - String tray_qty = content.getString("tray_qty"); - String tray_high = content.getString("tray_high"); - String crib_category = content.getString("crib_category"); - String palletX1_line = content.getString("palletX1_line"); - String palletY1_row = content.getString("palletY1_row"); - String palletA1_angle = content.getString("palletA1_angle"); - String palletX2_line = content.getString("palletX2_line"); - String palletY2_row = content.getString("palletY2_row"); - String palletA2_angle = content.getString("palletA2_angle"); - String palletX3_line = content.getString("palletX3_line"); - String palletY3_row = content.getString("palletY3_row"); - String palletA3_angle = content.getString("palletA3_angle"); - String pressCribX1_line = content.getString("pressCribX1_line"); - String pressCribY1_row = content.getString("pressCribY1_row"); - String pressCribA1_angle = content.getString("pressCribA1_angle"); - String pressCribX2_line = content.getString("pressCribX2_line"); - String pressCribY2_row = content.getString("pressCribY2_row"); - String pressCribA2_angle = content.getString("pressCribA2_angle"); - String pressCribX3_line = content.getString("pressCribX3_line"); - String pressCribY3_row = content.getString("pressCribY3_row"); - String pressCribA3_angle = content.getString("pressCribA3_angle"); - String Zoffset = content.getString("Zoffset"); - String pallet_layerQty = content.getString("pallet_layerQty"); - String pressCrib_layerQty = content.getString("pressCrib_layerQty"); - String codeLayerX1_interval = content.getString("codeLayerX1_interval"); - String codeLayerY1_interval = content.getString("codeLayerY1_interval"); - String codeLayerX2_interval = content.getString("codeLayerX2_interval"); - String codeLayerY2_interval = content.getString("codeLayerY2_interval"); - String codeLayerX3_interval = content.getString("codeLayerX3_interval"); - String codeLayerY3_interval = content.getString("codeLayerY3_interval"); - String codeLayerX1_offset = content.getString("codeLayerX1_offset"); - String codeLayerY1_offset = content.getString("codeLayerY1_offset"); - String codeLayerX2_offset = content.getString("codeLayerX2_offset"); - String codeLayerY2_offset = content.getString("codeLayerY2_offset"); - String codeLayerX3_offset = content.getString("codeLayerX3_offset"); - String codeLayerY3_offset = content.getString("codeLayerY3_offset"); - String pressLayerX1_interval = content.getString("pressLayerX1_interval"); - String pressLayerY1_interval = content.getString("pressLayerY1_interval"); - String pressLayerX2_interval = content.getString("pressLayerX2_interval"); - String pressLayerY2_interval = content.getString("pressLayerY2_interval"); - String pressLayerX3_interval = content.getString("pressLayerX3_interval"); - String pressLayerY3_interval = content.getString("pressLayerY3_interval"); - String pressLayerX1_offset = content.getString("pressLayerX1_offset"); - String pressLayerY1_offset = content.getString("pressLayerY1_offset"); - String pressLayerX2_offset = content.getString("pressLayerX2_offset"); - String pressLayerY2_offset = content.getString("pressLayerY2_offset"); - String pressLayerX3_offset = content.getString("pressLayerX3_offset"); - String pressLayerY3_offset = content.getString("pressLayerY3_offset"); - String one_cribTotal = content.getString("one_cribTotal"); - String two_cribTotal = content.getString("two_cribTotal"); - String one_qty = content.getString("one_qty"); - String two_qty = content.getString("two_qty"); - String tool_coordinate = content.getString("tool_coordinate"); - - this.writing(this.mode); - this.writing("to_product_code",product_code); - this.writing("to_material_qty",qty); - this.writing("to_material_code",material_code); - this.writing("to_AlongSide",AlongSide); - this.writing("to_BshortSide",BshortSide); - this.writing("to_Htrapezoidal",Htrapezoidal); - this.writing("to_Wthickness",Wthickness); - this.writing("to_tray_qty",tray_qty); - this.writing("to_tray_high",tray_high); - this.writing("to_crib_category",crib_category); - this.writing("to_palletX1_line",palletX1_line); - this.writing("to_palletY1_row",palletY1_row); - this.writing("to_palletA1_angle",palletA1_angle); - this.writing("to_palletX2_line",palletX2_line); - this.writing("to_palletY2_row",palletY2_row); - this.writing("to_palletA2_angle",palletA2_angle); - this.writing("to_palletX3_line",palletX3_line); - this.writing("to_palletY3_row",palletY3_row); - this.writing("to_palletA3_angle",palletA3_angle); - this.writing("to_pressCribX1_line",pressCribX1_line); - this.writing("to_pressCribY1_row",pressCribY1_row); - this.writing("to_pressCribA1_angle",pressCribA1_angle); - this.writing("to_pressCribX2_line",pressCribX2_line); - this.writing("to_pressCribY2_row",pressCribY2_row); - this.writing("to_pressCribA2_angle",pressCribA2_angle); - this.writing("to_pressCribX3_line",pressCribX3_line); - this.writing("to_pressCribY3_row",pressCribY3_row); - this.writing("to_pressCribA3_angle",pressCribA3_angle); - this.writing("to_Zoffset",Zoffset); - this.writing("to_pallet_layerQty",pallet_layerQty); - this.writing("to_pressCrib_layerQty",pressCrib_layerQty); - this.writing("to_codeLayerX1_interval",codeLayerX1_interval); - this.writing("to_codeLayerY1_interval",codeLayerY1_interval); - this.writing("to_codeLayerX2_interval",codeLayerX2_interval); - this.writing("to_codeLayerY2_interval",codeLayerY2_interval); - this.writing("to_codeLayerX3_interval",codeLayerX3_interval); - this.writing("to_codeLayerY3_interval",codeLayerY3_interval); - this.writing("to_codeLayerX1_offset",codeLayerX1_offset); - this.writing("to_codeLayerY1_offset",codeLayerY1_offset); - this.writing("to_codeLayerX2_offset",codeLayerX2_offset); - this.writing("to_codeLayerY2_offset",codeLayerY2_offset); - this.writing("to_codeLayerX3_offset",codeLayerX3_offset); - this.writing("to_codeLayerY3_offset",codeLayerY3_offset); - this.writing("to_pressLayerX1_interval",pressLayerX1_interval); - this.writing("to_pressLayerY1_interval",pressLayerY1_interval); - this.writing("to_pressLayerX2_interval",pressLayerX2_interval); - this.writing("to_pressLayerY2_interval",pressLayerY2_interval); - this.writing("to_pressLayerX3_interval",pressLayerX3_interval); - this.writing("to_pressLayerY3_interval",pressLayerY3_interval); - this.writing("to_pressLayerX1_offset",pressLayerX1_offset); - this.writing("to_pressLayerY1_offset",pressLayerY1_offset); - this.writing("to_pressLayerX2_offset",pressLayerX2_offset); - this.writing("to_pressLayerY2_offset",pressLayerY2_offset); - this.writing("to_pressLayerX3_offset",pressLayerX3_offset); - this.writing("to_pressLayerY3_offset",pressLayerY3_offset); - this.writing("to_one_cribTotal",one_cribTotal); - this.writing("to_two_cribTotal",two_cribTotal); - this.writing("to_one_qty",one_qty); - this.writing("to_two_qty",two_qty); - this.writing("to_tool_coordinate",tool_coordinate); - - } - this.setRequireSucess(true); - return true; - } - } - - /** - * 码垛完成 - * - * @param - */ - public synchronized boolean palletizing() { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - JSONObject json = new JSONObject(); - this.instruction_require_time = date; - String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code"); - String demosub = linkobj.substring(1,linkobj.length()-1); - String demoArray[] = demosub.split(","); - List demoList = Arrays.asList(demoArray); - json.put("device_code",demoList.get(put_station-1).replace("\"","")); - json.put("qty",qty); - json.put("vehicle_code",barcode); - json.put("is_full","1"); - json.put("product_code",product_code); - json.put("AlongSide",AlongSide); - json.put("BshortSide",BshortSide); - json.put("Htrapezoidal",Htrapezoidal); - json.put("Wthickness",Wthickness); - json.put("tray_qty",tray_qty); - json.put("tray_high",tray_high); - json.put("crib_category",crib_category); - json.put("palletX1_line",palletX1_line); - json.put("palletY1_row",palletY1_row); - json.put("palletA1_angle",palletA1_angle); - json.put("palletX2_line",palletX2_line); - json.put("palletY2_row",palletY2_row); - json.put("palletA2_angle",palletA2_angle); - json.put("palletX3_line",palletX3_line); - json.put("palletY3_row",palletY3_row); - json.put("palletA3_angle",palletA3_angle); - json.put("pressCribX1_line",pressCribX1_line); - json.put("pressCribY1_row",pressCribY1_row); - json.put("pressCribA1_angle",pressCribA1_angle); - json.put("pressCribX2_line",pressCribX2_line); - json.put("pressCribY2_row",pressCribY2_row); - json.put("pressCribA2_angle",pressCribA2_angle); - json.put("pressCribX3_line",pressCribX3_line); - json.put("pressCribY3_row",pressCribY3_row); - json.put("pressCribA3_angle",pressCribA3_angle); - json.put("Zoffset",Zoffset); - json.put("pallet_layerQty",pallet_layerQty); - json.put("pressCrib_layerQty",pressCrib_layerQty); - json.put("codeLayerX1_interval",codeLayerX1_interval); - json.put("codeLayerY1_interval",codeLayerY1_interval); - json.put("codeLayerX2_interval",codeLayerX2_interval); - json.put("codeLayerY2_interval",codeLayerY2_interval); - json.put("codeLayerX3_interval",codeLayerX3_interval); - json.put("codeLayerY3_interval",codeLayerY3_interval); - json.put("codeLayerX1_offset",codeLayerX1_offset); - json.put("codeLayerY1_offset",codeLayerY1_offset); - json.put("codeLayerX2_offset",codeLayerX2_offset); - json.put("codeLayerY2_offset",codeLayerY2_offset); - json.put("codeLayerX3_offset",codeLayerX3_offset); - json.put("codeLayerY3_offset",codeLayerY3_offset); - json.put("pressLayerX1_interval",pressLayerX1_interval); - json.put("pressLayerY1_interval",pressLayerY1_interval); - json.put("pressLayerX2_interval",pressLayerX2_interval); - json.put("pressLayerY2_interval",pressLayerY2_interval); - json.put("pressLayerX3_interval",pressLayerX3_interval); - json.put("pressLayerY3_interval",pressLayerY3_interval); - json.put("pressLayerX1_offset",pressLayerX1_offset); - json.put("pressLayerY1_offset",pressLayerY1_offset); - json.put("pressLayerX2_offset",pressLayerX2_offset); - json.put("pressLayerY2_offset",pressLayerY2_offset); - json.put("pressLayerX3_offset",pressLayerX3_offset); - json.put("pressLayerY3_offset",pressLayerY3_offset); - json.put("one_cribTotal",one_cribTotal); - json.put("two_cribTotal",two_cribTotal); - json.put("one_qty",one_qty); - json.put("two_qty",two_qty); - json.put("tool_coordinate",tool_coordinate); - - HttpResponse result = acsToWmsService.applyTaskManipulatorToWms(json); - if (ObjectUtil.isNotEmpty(result)) { - JSONObject jsonObject = JSONObject.parseObject(result.body()); - if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) { - this.writing(this.mode); - } - } - this.setRequireSucess(true); - return true; - } - } - - /** - * 码垛强制完成 - * - * @param - */ - public synchronized boolean mandatoryPalletizing(String type) { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - JSONObject json = new JSONObject(); - String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code"); - String demosub = linkobj.substring(1,linkobj.length()-1); - String demoArray[] = demosub.split(","); - List demoList = Arrays.asList(demoArray); - json.put("device_code",demoList.get(put_station-1).replace("\"","")); - json.put("qty",qty); - json.put("vehicle_code",barcode); - json.put("material_code",material); - json.put("is_full",type); - json.put("product_code",product_code); - json.put("AlongSide",AlongSide); - json.put("BshortSide",BshortSide); - json.put("Htrapezoidal",Htrapezoidal); - json.put("Wthickness",Wthickness); - json.put("tray_qty",tray_qty); - json.put("tray_high",tray_high); - json.put("crib_category",crib_category); - json.put("palletX1_line",palletX1_line); - json.put("palletY1_row",palletY1_row); - json.put("palletA1_angle",palletA1_angle); - json.put("palletX2_line",palletX2_line); - json.put("palletY2_row",palletY2_row); - json.put("palletA2_angle",palletA2_angle); - json.put("palletX3_line",palletX3_line); - json.put("palletY3_row",palletY3_row); - json.put("palletA3_angle",palletA3_angle); - json.put("pressCribX1_line",pressCribX1_line); - json.put("pressCribY1_row",pressCribY1_row); - json.put("pressCribA1_angle",pressCribA1_angle); - json.put("pressCribX2_line",pressCribX2_line); - json.put("pressCribY2_row",pressCribY2_row); - json.put("pressCribA2_angle",pressCribA2_angle); - json.put("pressCribX3_line",pressCribX3_line); - json.put("pressCribY3_row",pressCribY3_row); - json.put("pressCribA3_angle",pressCribA3_angle); - json.put("Zoffset",Zoffset); - json.put("pallet_layerQty",pallet_layerQty); - json.put("pressCrib_layerQty",pressCrib_layerQty); - json.put("codeLayerX1_interval",codeLayerX1_interval); - json.put("codeLayerY1_interval",codeLayerY1_interval); - json.put("codeLayerX2_interval",codeLayerX2_interval); - json.put("codeLayerY2_interval",codeLayerY2_interval); - json.put("codeLayerX3_interval",codeLayerX3_interval); - json.put("codeLayerY3_interval",codeLayerY3_interval); - json.put("codeLayerX1_offset",codeLayerX1_offset); - json.put("codeLayerY1_offset",codeLayerY1_offset); - json.put("codeLayerX2_offset",codeLayerX2_offset); - json.put("codeLayerY2_offset",codeLayerY2_offset); - json.put("codeLayerX3_offset",codeLayerX3_offset); - json.put("codeLayerY3_offset",codeLayerY3_offset); - json.put("pressLayerX1_interval",pressLayerX1_interval); - json.put("pressLayerY1_interval",pressLayerY1_interval); - json.put("pressLayerX2_interval",pressLayerX2_interval); - json.put("pressLayerY2_interval",pressLayerY2_interval); - json.put("pressLayerX3_interval",pressLayerX3_interval); - json.put("pressLayerY3_interval",pressLayerY3_interval); - json.put("pressLayerX1_offset",pressLayerX1_offset); - json.put("pressLayerY1_offset",pressLayerY1_offset); - json.put("pressLayerX2_offset",pressLayerX2_offset); - json.put("pressLayerY2_offset",pressLayerY2_offset); - json.put("pressLayerX3_offset",pressLayerX3_offset); - json.put("pressLayerY3_offset",pressLayerY3_offset); - json.put("one_cribTotal",one_cribTotal); - json.put("two_cribTotal",two_cribTotal); - json.put("one_qty",one_qty); - json.put("two_qty",two_qty); - json.put("tool_coordinate",tool_coordinate); - - HttpResponse result = acsToWmsService.applyTaskManipulatorToWms(json); - if (ObjectUtil.isNotEmpty(result)) { - JSONObject jsonObject = JSONObject.parseObject(result.body()); - if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) { - this.writing(this.mode); - this.setRequireSucess(true); - } - } - return true; - } - } - - /** - * 申请空盘 - * - * @param - */ - public synchronized boolean applyEmpty() { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - JSONObject json = new JSONObject(); - String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code"); - String demosub = linkobj.substring(1,linkobj.length()-1); - String demoArray[] = demosub.split(","); - List demoList = Arrays.asList(demoArray); - json.put("device_code",demoList.get(put_station-1).replace("\"","")); - json.put("type","4"); - HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); - if (ObjectUtil.isNotEmpty(result)) { - JSONObject jsonObject = JSONObject.parseObject(result.body()); - if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) { - this.writing(this.mode); - this.setRequireSucess(true); - } - } - return true; - } - } - - /** - * 申请空盘入库 - * - * @param - */ - public synchronized boolean applyEmptyIn() { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - JSONObject json = new JSONObject(); - String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code"); - String demosub = linkobj.substring(1,linkobj.length()-1); - String demoArray[] = demosub.split(","); - List demoList = Arrays.asList(demoArray); - json.put("device_code",demoList.get(getStation-1).replace("\"","")); - json.put("type","3"); - - HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); - if (ObjectUtil.isNotEmpty(result)) { - JSONObject jsonObject = JSONObject.parseObject(result.body()); - if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) { - this.writing(this.mode); - this.setRequireSucess(true); - } - } - return true; - } - } - - public boolean exe_business() { - return true; - } - - public void executing(Server server, Map itemMap) { - ReadUtil.write(itemMap, server); - } - - public static Boolean isExistFieldName(String fieldName, Object obj) throws NoSuchFieldException { - if (obj == null || StrUtil.isEmpty(fieldName)) { - return null; - } - //获取这个类的所有属性 - Field[] fields = obj.getClass().getDeclaredFields(); - boolean flag = false; - //循环遍历所有的fields - for (int i = 0; i < fields.length; i++) { - if (fields[i].getName().equals("item_" + fieldName)) { - flag = true; - break; - } - } - return flag; - } - - 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_feedback; - - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(to_command, command); - ReadUtil.write(itemMap, server); - - } - - public void writing(String param, String value) { - - String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + param; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(to_param, value); - - ReadUtil.write(itemMap, server); - } - - @Override - public JSONObject getDeviceStatusName() { - JSONObject jo = new JSONObject(); - String mode = ""; - String status = ""; - if (this.getMode() == 0) { - mode = "未联机"; - } else if (this.getMode() == 1) { - mode = "单机"; - } else if (this.getMode() == 2) { - mode = "联机"; - } else if (this.getMode() == 3) { - mode = "运行中"; - } else if (this.getMode() == 4) { - mode = "人工排产确认"; - } else if (this.getMode() == 5) { - mode = "获取托盘信息"; - } else if (this.getMode() == 6) { - mode = "码垛完成"; - } else if (this.getMode() == 7) { - mode = "码垛强制完成"; - } else if (this.getMode() == 8) { - mode = "申请空盘"; - } else if (this.getMode() == 9) { - mode = "工单完成"; - } else if (this.getMode() == 10) { - mode = "叫料"; - } else if (this.getMode() == 11) { - mode = "强制去包装"; - } else if (this.getMode() == 12) { - mode = "申请空盘入库"; - } - - if (this.getStatus() == 1) { - status = "待机"; - } else if (this.getStatus() == 2) { - status = "生产中"; - } else if (this.getStatus() == 3) { - status = "故障"; - } - String onoff_status = ""; - - if (this.getOnoff_status() == 1) { - onoff_status = "关机"; - } else if (this.getOnoff_status() == 2) { - onoff_status = "开机"; - } - - jo.put("device_name", this.getDevice().getDevice_name()); - jo.put("mode", mode); - jo.put("status", status); - jo.put("onoff_status", onoff_status); - jo.put("isOnline", this.getIsonline()); - jo.put("error", this.getError()); - jo.put("putStation", this.getPut_station()); - jo.put("barcode", this.getBarcode()); - jo.put("material", this.getMaterial()); - jo.put("qty", this.getQty()); - jo.put("open_time", this.getOpen_time()); - jo.put("standby_time", this.getStandby_time()); - jo.put("production_time", this.getProduction_time()); - jo.put("error_time", this.getError_time()); - jo.put("order_No", this.getOrder_No()); - jo.put("getStation", this.getGetStation()); - jo.put("specifications", this.getSpecifications()); - jo.put("batch", this.getBatch()); - jo.put("total_split", this.getTotal_split()); - jo.put("isError", this.getIserror()); - jo.put("message", this.getMessage()); - return jo; - } - - @Override - public void setDeviceStatus(JSONObject data) { - - } -} diff --git a/acs/hd/nladmin-test/pom.xml b/acs/hd/nladmin-test/pom.xml index 5981e19..3408dbe 100644 --- a/acs/hd/nladmin-test/pom.xml +++ b/acs/hd/nladmin-test/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - llsh_acs + hl_two_acs org.nl 1.0-SNAPSHOT diff --git a/acs/hd/pom.xml b/acs/hd/pom.xml index ad6ab4b..f43c526 100644 --- a/acs/hd/pom.xml +++ b/acs/hd/pom.xml @@ -5,7 +5,7 @@ 4.0.0 org.nl - llsh_acs + hl_two_acs pom 1.0-SNAPSHOT 开发平台 diff --git a/acs/qd/src/views/acs/device/driver/lnsh/lnsh_rgv.vue b/acs/qd/src/views/acs/device/driver/lnsh/lnsh_rgv.vue index 5683d2f..39a7c28 100644 --- a/acs/qd/src/views/acs/device/driver/lnsh/lnsh_rgv.vue +++ b/acs/qd/src/views/acs/device/driver/lnsh/lnsh_rgv.vue @@ -62,7 +62,7 @@ v-model="form.get_device_code1" multiple filterable - reserveKeyword + reserve-keyword placeholder="请选择" > @@ -109,7 +109,7 @@ @@ -139,7 +139,7 @@