diff --git a/acs/nladmin-system/pom.xml b/acs/nladmin-system/pom.xml
index 97f4309..ba11b96 100644
--- a/acs/nladmin-system/pom.xml
+++ b/acs/nladmin-system/pom.xml
@@ -388,6 +388,7 @@
UserAgentUtils
1.21
+
org.apache.lucene
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/NDCAgvService.java b/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/NDCAgvService.java
index 2cdb977..84cb853 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/NDCAgvService.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/NDCAgvService.java
@@ -68,4 +68,10 @@ public interface NDCAgvService {
void updateAgvFromCache(AgvDto dto);
+ /**
+ * 下发充电任务
+ * @param carno
+ * @return
+ */
+ public boolean createChargingTaskToNDC(String carno);
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java
index 1f85bb5..a3a4fef 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java
@@ -22,7 +22,9 @@ import org.nl.acs.opc.DeviceAppServiceImpl;
import org.nl.acs.opc.DeviceType;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.system.service.ParamService;
+import org.nl.modules.system.util.CodeUtil;
import org.nl.modules.wql.util.SpringContextHolder;
+import org.nl.start.auto.run.NDCSocketConnectionAutoRun;
import org.slf4j.MDC;
import org.springframework.stereotype.Service;
@@ -73,8 +75,7 @@ public class NDCAgvServiceImpl implements NDCAgvService {
};
log.info("下发删除AGV指令--{}", Bytes2HexString(b));
-// NDCSocketConnectionAutoRun.write(b);
- System.out.println("下发删除agv指令数据:" + Bytes2HexString(b));
+ NDCSocketConnectionAutoRun.write(b);
}
} finally {
MDC.remove(log_file_type);
@@ -113,7 +114,6 @@ public class NDCAgvServiceImpl implements NDCAgvService {
log.info("反馈agv动作数据--index:" + hexToString(indexhigh & 0xFF) + hexToString(indexlow & 0xFF) + ",phase:" + hexToString(phasehigh & 0xFF) + hexToString(phaselow & 0xFF));
//87CD 0008 000C 0001 006D 0008 0000 0114 000E 0000
//87CD 0008 000C 0001 006D 0008 0003 0114 008F 0000
- System.out.println("反馈agv动作数据:" + Bytes2HexString(b));
return b;
} finally {
MDC.remove(log_file_type);
@@ -162,9 +162,6 @@ public class NDCAgvServiceImpl implements NDCAgvService {
str += "/priority:" + (priority);
str1 += "/priority:" + hexToString(prioritylow & 0xFF);
- System.out.println(str);
- System.out.println(str1);
-
byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD,
(byte) 0X00, (byte) 0X08,
(byte) 0X00, (byte) 0X12,
@@ -179,10 +176,11 @@ public class NDCAgvServiceImpl implements NDCAgvService {
(byte) qhdhigh, (byte) qhdlow,
(byte) fhdhigh, (byte) fhdlow
};
+ log.info("下发AGV作业指令--{}", str);
log.info("下发AGV作业指令--{}", str1);
-// NDCSocketConnectionAutoRun.write(b);
- System.out.println("下发agv指令数据:" + Bytes2HexString(b));
+ NDCSocketConnectionAutoRun.write(b);
+ log.info("下发agv指令数据:" + Bytes2HexString(b));
}
} finally {
MDC.remove(log_file_type);
@@ -310,7 +308,6 @@ public class NDCAgvServiceImpl implements NDCAgvService {
}
log.info("反馈agv动作数据--index:" + hexToString(indexhigh & 0xFF) + hexToString(indexlow & 0xFF) + ",phase:" + hexToString(phasehigh & 0xFF) + hexToString(phaselow & 0xFF));
- System.out.println("反馈agv动作数据:" + Bytes2HexString(b));
return b;
} finally {
MDC.remove(log_file_type);
@@ -390,4 +387,53 @@ public class NDCAgvServiceImpl implements NDCAgvService {
AGVDeviceStatus.put(dto.getName(), dto);
}
+ @Override
+ public boolean createChargingTaskToNDC(String carno) {
+ try {
+ MDC.put(log_file_type, log_type);
+
+ byte carhigh = (byte) IntToHexHigh(Integer.parseInt(carno));
+ byte carlow = (byte) IntToHexLow(Integer.parseInt(carno));
+
+ String instcode = CodeUtil.getNewCode("INSTRUCT_NO");
+ byte instcodehigh = (byte) IntToHexHigh(Integer.parseInt(instcode));
+ byte instcodelow = (byte) IntToHexLow(Integer.parseInt(instcode));
+
+ String str = "十进制下发:";
+ String str1 = "十六进制下发:";
+ str += "carno:" + (Integer.parseInt(carno));
+ str1 += "carno:" + hexToString(carhigh & 0xFF) + hexToString(carlow & 0xFF);
+
+ str += "/instcode:" + (instcode);
+ str1 += "/instcode:" + hexToString(instcodehigh & 0xFF) + hexToString(instcodelow & 0xFF);
+
+ System.out.println(str);
+ System.out.println(str1);
+
+ byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD,
+ (byte) 0X00, (byte) 0X08,
+ (byte) 0X00, (byte) 0X0C,
+ (byte) 0X00, (byte) 0X01,
+ (byte) 0X00, (byte) 0X71,
+ (byte) 0X00, (byte) 0X08,
+ (byte) 0X64, (byte) 0X80,
+ (byte) 0X00, (byte) 0X01,
+ (byte) instcodehigh, (byte) instcodelow,
+ (byte) carhigh, (byte) carlow
+ };
+ log.info("下发AGV充电指令--{}", str);
+ log.info("下发AGV充电指令--{}", str1);
+
+ try {
+ NDCSocketConnectionAutoRun.write(b);
+ log.info("下发agv指令数据:" + Bytes2HexString(b));
+ } catch (Exception e) {
+ e.printStackTrace();
+ return false;
+ }
+ return true;
+ } finally {
+ MDC.remove(log_file_type);
+ }
+ }
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java b/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java
index 2090ecd..85dcc6d 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java
@@ -49,7 +49,7 @@ public enum DriverTypeEnum {
LNSH_PALLETIZING_MANIPULATOR(39, "lnsh_palletizing_manipulator", "晟华-码垛机械手", "station"),
- LNSH_KILN_TRUSS(40, "lnsh_kiln_truss", "晟华-入出窑桁架", "station"),
+ LNSH_KILN_TRUSS(40, "lnsh_kiln_truss", "晟华-进窑桁架", "station"),
LNSH_OUT_KILN_TRUSS(41, "lnsh_out_kiln_truss", "晟华-出窑桁架", "station"),
@@ -59,7 +59,7 @@ public enum DriverTypeEnum {
LNSH_PALLET_STORAGE(44, "lnsh_pallet_storage", "晟华-托盘存储线", "station"),
- LNSH_PACKAGE_PALLET_MANIPULATOR(45, "lnsh_package_pallet_manipulator", "晟华-包装码垛机械手", "station"),
+ LNSH_PACKAGE_PALLET_MANIPULATOR(45, "lnsh_package_pallet_manipulator", "晟华-分拣机械手", "station"),
LNSH_LABELING_MACHINE(46, "lnsh_labeling_machine", "晟华-贴标机", "station"),
@@ -77,7 +77,7 @@ public enum DriverTypeEnum {
LNSH_CRUSHER(53, "lnsh_crusher", "晟华-破碎机", "station"),
- LNSH_PALLETIZING_MANIPULATOR_SITE(54, "lnsh_palletizing_manipulator_site", "晟华-码垛机械手对接位", "station");
+ LNSH_PALLETIZING_MANIPULATOR_SITE(54, "lnsh_palletizing_manipulator_site", "晟华-机械手对接位", "station");
//驱动索引
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/standard_inspect/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/standard_inspect/ItemProtocol.java
index 66dff9e..e8a79ee 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/standard_inspect/ItemProtocol.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/standard_inspect/ItemProtocol.java
@@ -45,7 +45,7 @@ public class ItemProtocol {
public static List getReadableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_heartbeat, "心跳", "DB100.B0"));
- list.add(new ItemDto(item_mode, "工作状态", "DB100.B2", Boolean.valueOf(true)));
+ list.add(new ItemDto(item_mode, "工作模式", "DB100.B2", Boolean.valueOf(true)));
list.add(new ItemDto(item_move, "光电开关信号", "DB100.B3"));
list.add(new ItemDto(item_action, "动作信号", "DB100.B4"));
list.add(new ItemDto(item_error, "报警信号", "DB100.B5"));
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/standard_inspect/ReadUtil.java b/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/standard_inspect/ReadUtil.java
index 4ce2cde..244e493 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/standard_inspect/ReadUtil.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/standard_inspect/ReadUtil.java
@@ -159,23 +159,26 @@ public class ReadUtil {
public static void write(Map strings, Server server) {
try {
//Group group = this.opcServerService.getServer(opcServiceCode);
+ try {
+ server.connect();
+ } catch (AlreadyConnectedException ignored) {
+ }
Group group = server.addGroup();
- Iterator it = strings.keySet().iterator();
- while (it.hasNext()) {
- String key = (String) it.next();
+ for (String key : strings.keySet()) {
Item byteItem = group.addItem(key);
Object o = strings.get(key);
if (o == null || o.equals("")) {
break;
}
WriteRequest write1 = new WriteRequest(byteItem, new JIVariant(o.toString()));
- List list = new ArrayList();
+ List list = new ArrayList<>();
list.add(write1);
- OpcUtl.writeValue(group, (WriteRequest[]) list.toArray(new WriteRequest[0]));
+ OpcUtl.writeValue(group, list.toArray(new WriteRequest[0]));
}
- server.disconnect();
} catch (Exception e) {
- e.printStackTrace();
+ write(strings, server);
+ } finally {
+ server.disconnect();
}
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device/service/impl/ConveyorDevice.java b/acs/nladmin-system/src/main/java/org/nl/acs/device/service/impl/ConveyorDevice.java
index 961ebed..4d76f1d 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device/service/impl/ConveyorDevice.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device/service/impl/ConveyorDevice.java
@@ -44,8 +44,8 @@ public class ConveyorDevice {
@SneakyThrows
@Override
public void run() {
- System.out.println("test");
- String MODE = "RD1.RD1." + id + ".mode";
+// System.out.println("test");
+// String MODE = "RD1.RD1." + id + ".mode";
// String code = OpcUtl.read(MODE);
// if ("2".equals(code)) {
// TaskService taskserver = SpringContextHolder.getBean(TaskServiceImpl.class);
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/cargo_lift_conveyor/CargoLiftConveyorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/cargo_lift_conveyor/CargoLiftConveyorDeviceDriver.java
index 5888ae2..40b7100 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/cargo_lift_conveyor/CargoLiftConveyorDeviceDriver.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/cargo_lift_conveyor/CargoLiftConveyorDeviceDriver.java
@@ -5,7 +5,8 @@ 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.Getter;
+import lombok.Setter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
@@ -39,28 +40,29 @@ import java.util.*;
* 货梯对接线
*/
@Slf4j
-@Data
+@Getter
+@Setter
@RequiredArgsConstructor
public class CargoLiftConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
- @Autowired
+
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class);
- @Autowired
+
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
- @Autowired
+
DeviceService deviceservice = SpringContextHolder.getBean(DeviceService.class);
- @Autowired
+
TaskService taskserver = SpringContextHolder.getBean(TaskService.class);
- @Autowired
+
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class);
- @Autowired
+
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
- @Autowired
+
ParamService paramService = SpringContextHolder.getBean(ParamService.class);
- @Autowired
+
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
- @Autowired
+
AgvService agvService = SpringContextHolder.getBean(AgvService.class);
private Date instruction_require_time = new Date();
@@ -209,7 +211,7 @@ public class CargoLiftConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
* 开始平均分配
*/
String this_coevice_code = taskserver.queryAssignedByDevice(device_code, task.getNext_device_code());
- if (StrUtil.isEmpty(this_coevice_code)) {
+ if (StrUtil.isBlank(this_coevice_code)) {
List shortPathsList = routeLineService.getShortPathLines(start_device_code, task.getNext_device_code(), route_plan_code);
RouteLineDto routeLineDto = shortPathsList.get(0);
@@ -286,6 +288,9 @@ public class CargoLiftConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
Map itemMap = new HashMap();
itemMap.put(to_command, command);
ReadUtil.write(itemMap, server);
+ ReadUtil.write(itemMap, server);
+ server.disconnect();
+ logServer.deviceExecuteLog(this.device_code, "", "", "to_command 写入 " + command);
}
public void writing(int type, int command) {
@@ -300,17 +305,18 @@ public class CargoLiftConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
Map itemMap = new HashMap();
if (type == 1) {
itemMap.put(to_command, command);
- log.info("设备:" + device_code + ",下发PLC信号" + to_command + ",value:" + command);
+ logServer.deviceExecuteLog(this.device_code, "", "", "to_command 写入 " + command);
} else if (type == 2) {
itemMap.put(to_target, command);
- log.info("设备:" + device_code + ",下发PLC信号" + to_target + ",value:" + command);
+ logServer.deviceExecuteLog(this.device_code, "", "", "to_target 写入 " + command);
} else if (type == 3) {
itemMap.put(to_task, command);
- log.info("设备:" + device_code + ",下发PLC信号" + to_task + ",value:" + command);
+ logServer.deviceExecuteLog(this.device_code, "", "", "to_task 写入 " + command);
}
ReadUtil.write(itemMap, server);
+ server.disconnect();
}
@Override
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/cargo_lift_conveyor/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/cargo_lift_conveyor/ItemProtocol.java
index 9fde67b..c27bee2 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/cargo_lift_conveyor/ItemProtocol.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/cargo_lift_conveyor/ItemProtocol.java
@@ -1,6 +1,7 @@
package org.nl.acs.device_driver.basedriver.cargo_lift_conveyor;
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
@@ -8,7 +9,8 @@ import java.util.ArrayList;
import java.util.List;
@Slf4j
-@Data
+@Getter
+@Setter
public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
@@ -84,7 +86,7 @@ public class ItemProtocol {
public static List getWriteableItemDtos() {
ArrayList list = new ArrayList();
- list.add(new ItemDto(item_to_command, "下发命令", "VW102"));
+ list.add(new ItemDto(item_to_command, "下发指令", "VW102"));
list.add(new ItemDto(item_to_target, "下发目标站", "VW104"));
list.add(new ItemDto(item_to_task, "任务号", "VD108"));
list.add(new ItemDto(item_to_door, "门", "VD112"));
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/empty_vehicle_stacking_position/EmptyVehicleStackingPositionDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/empty_vehicle_stacking_position/EmptyVehicleStackingPositionDeviceDriver.java
index c132385..127cc43 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/empty_vehicle_stacking_position/EmptyVehicleStackingPositionDeviceDriver.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/empty_vehicle_stacking_position/EmptyVehicleStackingPositionDeviceDriver.java
@@ -1,7 +1,8 @@
package org.nl.acs.device_driver.basedriver.empty_vehicle_stacking_position;
import com.alibaba.fastjson.JSONObject;
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.agv.server.AgvService;
@@ -35,27 +36,28 @@ import java.util.Map;
* 空托盘叠盘位
*/
@Slf4j
-@Data
+@Getter
+@Setter
@RequiredArgsConstructor
public class EmptyVehicleStackingPositionDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
- @Autowired
+
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class);
- @Autowired
+
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
- @Autowired
+
DeviceService deviceservice = SpringContextHolder.getBean(DeviceService.class);
- @Autowired
+
TaskService taskserver = SpringContextHolder.getBean(TaskService.class);
- @Autowired
+
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class);
- @Autowired
+
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
- @Autowired
+
ParamService paramService = SpringContextHolder.getBean(ParamService.class);
- @Autowired
+
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
- @Autowired
+
AgvService agvService = SpringContextHolder.getBean(AgvService.class);
private Date instruction_require_time = new Date();
@@ -182,6 +184,9 @@ public class EmptyVehicleStackingPositionDeviceDriver extends AbstractOpcDeviceD
Map itemMap = new HashMap();
itemMap.put(to_command, command);
ReadUtil.write(itemMap, server);
+ ReadUtil.write(itemMap, server);
+ server.disconnect();
+ logServer.deviceExecuteLog(this.device_code, "", "", "to_command 写入 " + command);
}
public void writing(String key, String value) {
@@ -192,6 +197,8 @@ public class EmptyVehicleStackingPositionDeviceDriver extends AbstractOpcDeviceD
Map itemMap = new HashMap();
itemMap.put(to_command, value);
ReadUtil.write(itemMap, server);
+ server.disconnect();
+ logServer.deviceExecuteLog(this.device_code, "", "", key + " 写入 " + value);
}
@Override
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/empty_vehicle_stacking_position/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/empty_vehicle_stacking_position/ItemProtocol.java
index adc0f2a..a26c51d 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/empty_vehicle_stacking_position/ItemProtocol.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/empty_vehicle_stacking_position/ItemProtocol.java
@@ -1,6 +1,7 @@
package org.nl.acs.device_driver.basedriver.empty_vehicle_stacking_position;
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
@@ -8,7 +9,8 @@ import java.util.ArrayList;
import java.util.List;
@Slf4j
-@Data
+@Getter
+@Setter
public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
@@ -89,7 +91,7 @@ public class ItemProtocol {
public static List getWriteableItemDtos() {
ArrayList list = new ArrayList();
- list.add(new ItemDto(item_to_command, "下发命令", "VW52"));
+ list.add(new ItemDto(item_to_command, "下发指令", "VW52"));
list.add(new ItemDto(item_to_target , "下发目标站", "VW54"));
list.add(new ItemDto(item_to_task, "任务号", "VD58"));
return list;
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control/ItemProtocol.java
index 3e69b1e..1fc7f8a 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control/ItemProtocol.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control/ItemProtocol.java
@@ -1,6 +1,7 @@
package org.nl.acs.device_driver.basedriver.standard_conveyor_control;
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
@@ -8,7 +9,8 @@ import java.util.ArrayList;
import java.util.List;
@Slf4j
-@Data
+@Getter
+@Setter
public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
@@ -97,7 +99,7 @@ public class ItemProtocol {
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_mode, "工作模式", "DB600.B1", Boolean.valueOf(true)));
list.add(new ItemDto(item_move, "光电开关信号", "DB600.B2"));
list.add(new ItemDto(item_action, "取放信号", "DB600.B3"));
list.add(new ItemDto(item_ioaction, "进出类型", "DB600.B4"));
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control/StandardCoveyorControlDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control/StandardCoveyorControlDeviceDriver.java
index 75eeef2..4dbc2bb 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control/StandardCoveyorControlDeviceDriver.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control/StandardCoveyorControlDeviceDriver.java
@@ -4,7 +4,8 @@ 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.Getter;
+import lombok.Setter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
@@ -17,6 +18,7 @@ import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
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;
@@ -41,26 +43,30 @@ import java.util.Map;
* 输送机-控制点驱动
*/
@Slf4j
-@Data
+@Getter
+@Setter
@RequiredArgsConstructor
public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
- @Autowired
+
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class);
- @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
+
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class);
- @Autowired
+
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
- @Autowired
+
ParamService paramService = SpringContextHolder.getBean(ParamService.class);
+ DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
+
+
String container;
String container_type_desc;
String last_container_type_desc;
@@ -167,7 +173,7 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
//inst_message
inst = instructionService.findByCodeFromCache(String.valueOf(task));
if (inst != null) {
- inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code();
+ inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + " -> " + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code();
if (StrUtil.equals(inst.getInstruction_status(), "1") && StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) {
finish_instruction();
}
@@ -208,7 +214,7 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
break;
case 2:
//申请任务
- if (!StrUtil.isEmpty(material) && !StrUtil.isEmpty(qty) && material.length() > 0 && qty.length() > 0 && !requireSucess) {
+ if (!StrUtil.isBlank(material) && !StrUtil.isBlank(qty) && material.length() > 0 && qty.length() > 0 && !requireSucess) {
this.instruction_require(container);
}
break;
@@ -313,11 +319,13 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
itemMap.put(to_command, 1);
itemMap.put(to_task, instruction_num);
ReadUtil.write(itemMap, server);
+ server.disconnect();
}
public void executing(Server server, Map itemMap) {
ReadUtil.write(itemMap, server);
+ server.disconnect();
}
public void writing(int command) {
@@ -329,7 +337,9 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
Map itemMap = new HashMap();
itemMap.put(to_command, command);
ReadUtil.write(itemMap, server);
-
+ ReadUtil.write(itemMap, server);
+ server.disconnect();
+ logServer.deviceExecuteLog(this.device_code, "", "", "to_command 写入 " + command);
}
public void writing(int command, int target, int task) {
@@ -347,6 +357,7 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
itemMap.put(to_target, target);
itemMap.put(to_task, task);
ReadUtil.write(itemMap, server);
+ server.disconnect();
}
public void writing(int type, int command) {
@@ -368,6 +379,7 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
itemMap.put(to_task, command);
}
ReadUtil.write(itemMap, server);
+ server.disconnect();
}
@@ -407,7 +419,7 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
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)) {
+ if (StrUtil.isBlank(next_device_codecode)) {
throw new RuntimeException("该设备未找到对应路由");
}
dto.setNext_point_code(next_device_codecode);
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_plcscanner/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_plcscanner/ItemProtocol.java
index 6a4d8fc..1a7bfad 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_plcscanner/ItemProtocol.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_plcscanner/ItemProtocol.java
@@ -1,6 +1,7 @@
package org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_plcscanner;
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
@@ -8,7 +9,8 @@ import java.util.ArrayList;
import java.util.List;
@Slf4j
-@Data
+@Getter
+@Setter
public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
@@ -136,7 +138,7 @@ public class ItemProtocol {
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_mode, "工作模式", "DB600.B1", Boolean.valueOf(true)));
list.add(new ItemDto(item_move, "光电开关信号", "DB600.B2"));
list.add(new ItemDto(item_action, "取放信号", "DB600.B3"));
list.add(new ItemDto(item_ioaction, "进出类型", "DB600.B4"));
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_plcscanner/StandardCoveyorControlWithPlcScannerDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_plcscanner/StandardCoveyorControlWithPlcScannerDeviceDriver.java
index 370748e..34e6f5b 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_plcscanner/StandardCoveyorControlWithPlcScannerDeviceDriver.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_plcscanner/StandardCoveyorControlWithPlcScannerDeviceDriver.java
@@ -6,7 +6,8 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
@@ -20,6 +21,7 @@ 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.opc.DeviceAppService;
@@ -41,27 +43,29 @@ import java.util.*;
* 输送机控制点-带扫描驱动
*/
@Slf4j
-@Data
+@Getter
+@Setter
@RequiredArgsConstructor
public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
- @Autowired
+
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
- @Autowired
+
DeviceService deviceservice = SpringContextHolder.getBean(DeviceService.class);
- @Autowired
+
RouteLineService routelineserver = SpringContextHolder.getBean(RouteLineService.class);
- @Autowired
+
TaskService taskserver = SpringContextHolder.getBean(TaskService.class);
- @Autowired
+
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class);
- @Autowired
+
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class);
- @Autowired
+
ParamService paramService = SpringContextHolder.getBean(ParamService.class);
- @Autowired
+
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsService.class);
- ;
+ DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
+
String barcode = null;
String formatcode = null;
@@ -176,7 +180,7 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp
//inst_message
inst = instructionService.findByCodeFromCache(String.valueOf(task));
if (inst != null) {
- inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code();
+ inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + " -> " + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code();
if (StrUtil.equals(inst.getInstruction_status(), "0") && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) {
inst.setInstruction_status("1");
instructionService.update(inst);
@@ -538,11 +542,13 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp
itemMap.put(to_command, 1);
itemMap.put(to_task, instruction_num);
ReadUtil.write(itemMap, server);
+ server.disconnect();
}
public void executing(Server server, Map itemMap) {
ReadUtil.write(itemMap, server);
+ server.disconnect();
}
public void writing() {
@@ -560,6 +566,7 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp
itemMap.put(to_target, deviceAppservice.findDeviceByCode(inst.getNext_device_code()).getAddress());
itemMap.put(to_task, inst.getInstruction_code());
ReadUtil.write(itemMap, server);
+ server.disconnect();
}
public void writing(int command, int target, int task) {
@@ -578,6 +585,7 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp
itemMap.put(to_task, task);
ReadUtil.write(itemMap, server);
+ server.disconnect();
}
public void writing(int command) {
@@ -588,6 +596,9 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp
Map itemMap = new HashMap();
itemMap.put(to_command, command);
ReadUtil.write(itemMap, server);
+ ReadUtil.write(itemMap, server);
+ server.disconnect();
+ logServer.deviceExecuteLog(this.device_code, "", "", "to_command 写入 " + command);
}
public void writing(int type, int command) {
@@ -602,14 +613,17 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp
Map itemMap = new HashMap();
if (type == 1) {
itemMap.put(to_command, command);
+ logServer.deviceExecuteLog(this.device_code, "", "", "to_command 写入 " + command);
} else if (type == 2) {
itemMap.put(to_target, command);
-
+ logServer.deviceExecuteLog(this.device_code, "", "", "to_target 写入 " + command);
} else if (type == 3) {
itemMap.put(to_task, command);
+ logServer.deviceExecuteLog(this.device_code, "", "", "to_task 写入 " + command);
}
ReadUtil.write(itemMap, server);
+ server.disconnect();
}
public boolean instruction_require(String container_code) throws Exception {
@@ -640,7 +654,7 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp
* 开始平均分配
*/
String this_coevice_code = taskserver.queryAssignedByDevice(device_code, task.getNext_device_code());
- if (StrUtil.isEmpty(this_coevice_code)) {
+ if (StrUtil.isBlank(this_coevice_code)) {
List shortPathsList = routeLineService.getShortPathLines(start_device_code, task.getNext_device_code(), route_plan_code);
RouteLineDto routeLineDto = shortPathsList.get(0);
@@ -698,9 +712,9 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp
try {
instructionService.create(instdto);
} catch (Exception e) {
- task.setRemark("指令创建失败:" + e);
+ task.setRemark("指令创建失败:" + e);
taskserver.updateByCodeFromCache(task);
- throw new RuntimeException("指令创建失败:" + e);
+ throw new RuntimeException("指令创建失败:" + e);
}
//创建指令后修改任务状态
WQLObject taskwo = WQLObject.getWQLObject("acs_task");
@@ -746,7 +760,7 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp
* 开始平均分配
*/
String this_coevice_code = taskserver.queryAssignedByDevice(device_code, task.getNext_device_code());
- if (StrUtil.isEmpty(this_coevice_code)) {
+ if (StrUtil.isBlank(this_coevice_code)) {
List shortPathsList = routeLineService.getShortPathLines(start_device_code, task.getNext_device_code(), route_plan_code);
RouteLineDto routeLineDto = shortPathsList.get(0);
@@ -804,9 +818,9 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp
try {
instructionService.create(instdto);
} catch (Exception e) {
- task.setRemark("指令创建失败:" + e);
+ task.setRemark("指令创建失败:" + e);
taskserver.updateByCodeFromCache(task);
- throw new RuntimeException("指令创建失败:" + e);
+ throw new RuntimeException("指令创建失败:" + e);
}
//创建指令后修改任务状态
WQLObject taskwo = WQLObject.getWQLObject("acs_task");
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/ItemProtocol.java
index e9f32ef..88f825b 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/ItemProtocol.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/ItemProtocol.java
@@ -1,6 +1,7 @@
package org.nl.acs.device_driver.basedriver.standard_inspect_site;
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
@@ -8,7 +9,8 @@ import java.util.ArrayList;
import java.util.List;
@Slf4j
-@Data
+@Getter
+@Setter
public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
@@ -69,7 +71,7 @@ public class ItemProtocol {
return move;
}
- Boolean isonline;
+ Boolean isonline = true;
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
@@ -87,7 +89,7 @@ public class ItemProtocol {
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_mode, "工作模式", "DB600.B1", Boolean.valueOf(true)));
list.add(new ItemDto(item_move, "光电开关信号", "DB600.B2"));
list.add(new ItemDto(item_error, "报警信号", "DB600.B6"));
list.add(new ItemDto(item_task, "任务号", "DB600.D8"));
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDefination.java
index dd2e8d7..7c97c36 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDefination.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDefination.java
@@ -58,7 +58,7 @@ public class StandardInspectSiteDefination implements OpcDeviceDriverDefination
public static List getReadableItemDtos2() {
List list = new ArrayList();
list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB.B0"));
- list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB.B1", true));
+ list.add(new ItemDto(ItemProtocol.item_mode, "工作模式", "DB.B1", true));
list.add(new ItemDto(ItemProtocol.item_move, "光电开关信号", "DB.B2"));
list.add(new ItemDto(ItemProtocol.item_error, "报警信号", "DB.B3"));
list.add(new ItemDto(ItemProtocol.item_task, "任务号", "DB.D4"));
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java
index 032f77a..9219904 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java
@@ -4,7 +4,8 @@ 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.Getter;
+import lombok.Setter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
@@ -15,6 +16,7 @@ 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;
@@ -39,18 +41,22 @@ import java.util.Map;
* 检测站点驱动
*/
@Slf4j
-@Data
+@Getter
+@Setter
@RequiredArgsConstructor
public class StandardInspectSiteDeviceDriver 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");
+
+ DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
+
String container;
String container_type_desc;
String last_container_type_desc;
@@ -117,7 +123,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
//暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域
int flag;
- String devicecode;
+ String device_code;
@Override
public Device getDevice() {
@@ -129,67 +135,29 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
public void execute() {
String message = null;
try {
- String device_code = this.getDeviceCode();
+ device_code = this.getDeviceCode();
+
mode = this.itemProtocol.getMode();
- error = this.itemProtocol.getError();
move = this.itemProtocol.getMove();
+ error = this.itemProtocol.getError();
task = this.itemProtocol.getTask();
- hasGoods = this.itemProtocol.getMove();
if (mode != last_mode) {
- this.setRequireSucess(false);
+// 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 (this.getApply_handling()) {
- String link_device_code = this.getDevice().getExtraValue().get("link_device_code").toString();
- DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
- Device link_device = appService.findDeviceByCode(link_device_code);
- StandardInspectSiteDeviceDriver standardInspectSiteDevicedriver;
- if (link_device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
- standardInspectSiteDevicedriver = (StandardInspectSiteDeviceDriver) link_device.getDeviceDriver();
-// if(standardInspectSiteDevicedriver.getMode() != 2){
-// log.debug("设备未待机");
-// return;
-// }
-// if(standardInspectSiteDevicedriver.getMove() != 0){
-// log.debug("设备不满足放货条件");
-// return;
-// }
-
- //如果目标设备申请叫料 则允许生成任务
- if (standardInspectSiteDevicedriver.getApply_material()) {
- 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());
-
- 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(standardInspectSiteDevicedriver.getDevicecode());
- dto.setUpdate_time(now);
- dto.setCreate_time(now);
-
- WQLObject wo = WQLObject.getWQLObject("acs_task");
- JSONObject json = (JSONObject) JSONObject.toJSON(dto);
-
- wo.insert(json);
- standardInspectSiteDevicedriver.setApply_material(false);
- }
- }
- this.setApply_handling(false);
+ if (task != last_task) {
+ logServer.deviceItemValue(this.device_code, "task", String.valueOf(task));
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号task:" + last_task + " -> " + task);
}
} catch (Exception var17) {
@@ -222,78 +190,13 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
log.debug("设备运转模式:等待工作");
return;
case 2:
- //申请任务
-// if (this.getApply_handling()) {
-// String link_device_code = this.getDevice().getExtraValue().get("link_device_code").toString();
-// DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
-// Device link_device = appService.findDeviceByCode(link_device_code);
-// StandardInspectSiteDeviceDriver standardInspectSiteDevicedriver;
-// if(link_device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
-// standardInspectSiteDevicedriver = (StandardInspectSiteDeviceDriver) link_device.getDeviceDriver();
-// if(standardInspectSiteDevicedriver.getMode() != 2){
-// log.debug("设备未待机");
-// return;
-// }
-// if(standardInspectSiteDevicedriver.getMove() != 0){
-// log.debug("设备不满足放货条件");
-// return;
-// }
-//
-// //如果目标设备申请叫料 则允许生成任务
-// if(standardInspectSiteDevicedriver.getApply_material()){
-// 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());
-//
-// String taskcode = CodeGenerateUtil.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);
-// standardInspectSiteDevicedriver.setApply_material(false);
-// }
-// }
-// this.setApply_handling(false);
-// }
-
- if (material.length() > 0 && qty.length() > 0 && !requireSucess) {
- this.instruction_require(container);
- }
}
-
- 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_mode = mode;
+ last_move = move;
+ last_error = error;
+ last_task = task;
}
@@ -349,11 +252,13 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
itemMap.put(to_command, 1);
itemMap.put(to_task, instruction_num);
ReadUtil.write(itemMap, server);
+ server.disconnect();
}
public void executing(Server server, Map itemMap) {
ReadUtil.write(itemMap, server);
+ server.disconnect();
}
public void writing(int command) {
@@ -365,7 +270,9 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
Map itemMap = new HashMap();
itemMap.put(to_command, command);
ReadUtil.write(itemMap, server);
-
+ ReadUtil.write(itemMap, server);
+ server.disconnect();
+ logServer.deviceExecuteLog(this.device_code, "", "", "to_command 写入 " + command);
}
public void writing(int type, int command) {
@@ -380,13 +287,16 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
Map itemMap = new HashMap();
if (type == 1) {
itemMap.put(to_command, command);
+ logServer.deviceExecuteLog(this.device_code, "", "", "to_command 写入 " + command);
} else if (type == 2) {
itemMap.put(to_target, command);
-
+ logServer.deviceExecuteLog(this.device_code, "", "", "to_target 写入 " + command);
} else if (type == 3) {
itemMap.put(to_task, command);
+ logServer.deviceExecuteLog(this.device_code, "", "", "to_task 写入 " + command);
}
ReadUtil.write(itemMap, server);
+ server.disconnect();
}
@@ -422,7 +332,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
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)) {
+ if (StrUtil.isBlank(next_device_codecode)) {
throw new RuntimeException("该设备未找到对应路由");
}
dto.setNext_point_code(next_device_codecode);
@@ -441,37 +351,62 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
- String mode = "";
- String action = "";
- String move = "";
- if (this.getMode() == 0) {
- mode = "未联机";
- } else if (this.getMode() == 1) {
- mode = "单机";
- } else if (this.getMode() == 2) {
- mode = "联机";
- } else if (this.getMode() == 3) {
- mode = "运行中";
+ String mode;
+ String move;
+ boolean hasGoods;
+
+ switch (this.mode) {
+ case 0:
+ mode = "脱机";
+ break;
+ case 2:
+ mode = "待机";
+ break;
+ case 3:
+ mode = "运行中";
+ break;
+ default:
+ mode = String.valueOf(this.mode);
}
- if (this.getMove() == 0) {
+ if (this.move == 0) {
move = "无货";
- jo.put("hasGoods", false);
- } else if (this.getMove() == 1) {
+ hasGoods = false;
+ } else {
move = "有货";
- jo.put("hasGoods", true);
- } else if (this.getMove() == 2) {
- move = "有托盘有货";
- jo.put("hasGoods", true);
+ hasGoods = true;
}
+
+ String error;
+ switch (this.error) {
+ case 1:
+ error = "急停中";
+ break;
+ case 2:
+ error = "光幕报警";
+ break;
+ case 3:
+ error = "本体报警";
+ break;
+ case 4:
+ error = "未排产报警";
+ break;
+ case 5:
+ error = "扫码故障";
+ break;
+ default:
+ error = String.valueOf(this.error);
+ }
+
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("move", move);
- jo.put("action", action);
- jo.put("isOnline", this.getIsonline());
- jo.put("error", this.getError());
- jo.put("isError", this.getIserror());
- jo.put("task", this.getTask());
+ jo.put("error", error);
+ jo.put("task", task);
+ jo.put("isError", iserror);
+ jo.put("isOnline", isonline);
+ jo.put("hasGoods", hasGoods);
+ jo.put("message", message);
return jo;
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java
index 22ffd78..af3f895 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java
@@ -2,7 +2,8 @@ package org.nl.acs.device_driver.basedriver.standard_ordinary_site;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.agv.server.AgvService;
@@ -31,26 +32,27 @@ import java.util.Date;
* 普通站点
*/
@Slf4j
-@Data
+@Getter
+@Setter
@RequiredArgsConstructor
public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver , DeviceStageMonitor {
- @Autowired
+
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class);
- @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
+
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class);
- @Autowired
+
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
- @Autowired
+
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
- @Autowired
+
NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvService.class);
@@ -128,9 +130,9 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
agvphase = 0;
index = 0;
inst = null;
- logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "反馈成功");
+ logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "反馈成功");
} else {
- logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "等待反馈");
+ logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "等待反馈");
}
}
@@ -144,9 +146,9 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
agvphase = 0;
index = 0;
inst = null;
- logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "反馈成功");
+ logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "反馈成功");
} else {
- logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "等待反馈");
+ logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "等待反馈");
}
}
@@ -160,9 +162,9 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
agvphase = 0;
index = 0;
inst = null;
- logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "反馈成功");
+ logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "反馈成功");
} else {
- logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "等待反馈");
+ logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "等待反馈");
}
}
@@ -175,9 +177,9 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
agvphase = 0;
index = 0;
inst = null;
- logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "反馈成功");
+ logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "反馈成功");
} else {
- logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "等待反馈");
+ logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "等待反馈");
}
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_scanner/StandardScannerDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_scanner/StandardScannerDeviceDriver.java
index d36492a..6e0fbbc 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_scanner/StandardScannerDeviceDriver.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_scanner/StandardScannerDeviceDriver.java
@@ -2,7 +2,8 @@ package org.nl.acs.device_driver.basedriver.standard_scanner;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.ScannerDeviceDriver;
@@ -16,7 +17,8 @@ import org.nl.acs.udw.UnifiedDataAccessorFactory;
* 标准版扫码器
*/
@Slf4j
-@Data
+@Getter
+@Setter
public class StandardScannerDeviceDriver extends AbstractDeviceDriver implements ScannerDeviceDriver, DeviceDriver, DeviceStageMonitor {
UnifiedDataAccessor accessor_value;
@@ -27,13 +29,13 @@ public class StandardScannerDeviceDriver extends AbstractDeviceDriver implements
public String getIp() {
String ip = (String) this.getDevice().getExtraValue().get("scannerIP");
- return StrUtil.isEmpty(ip) ? null : ip;
+ return StrUtil.isBlank(ip) ? null : ip;
}
@Override
public String readBarcode() throws Exception {
String ip = this.getIp();
- if (StrUtil.isEmpty(ip)) {
+ if (StrUtil.isBlank(ip)) {
throw new Exception("ip未配置");
} else {
String result = (String) this.accessor_value.getValue(this.getIp());
@@ -44,7 +46,7 @@ public class StandardScannerDeviceDriver extends AbstractDeviceDriver implements
@Override
public void writeBarcode(String barcode) throws Exception {
String ip = this.getIp();
- if (StrUtil.isEmpty(ip)) {
+ if (StrUtil.isBlank(ip)) {
throw new Exception("ip未配置");
} else {
this.accessor_value.setValueWithPersistence(this.getIp(), barcode);
@@ -54,7 +56,7 @@ public class StandardScannerDeviceDriver extends AbstractDeviceDriver implements
@Override
public void cleanBarcode() throws Exception {
String ip = this.getIp();
- if (StrUtil.isEmpty(ip)) {
+ if (StrUtil.isBlank(ip)) {
throw new Exception("ip未配置");
} else {
this.accessor_value.setValueWithPersistence(this.getIp(), (Object) null);
@@ -70,7 +72,7 @@ public class StandardScannerDeviceDriver extends AbstractDeviceDriver implements
//点击弹出
jo.put("is_click", true);
jo.put("ip", this.getIp());
- jo.put("container", StrUtil.isEmpty(this.readBarcode()) ? "" : this.readBarcode());
+ jo.put("container", StrUtil.isBlank(this.readBarcode()) ? "" : this.readBarcode());
return jo;
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_storage/StandardStorageDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_storage/StandardStorageDeviceDriver.java
index d882563..b581780 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_storage/StandardStorageDeviceDriver.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_storage/StandardStorageDeviceDriver.java
@@ -1,6 +1,7 @@
package org.nl.acs.device_driver.basedriver.standard_storage;
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.RouteableDeviceDriver;
@@ -12,7 +13,8 @@ import org.nl.acs.device_driver.driver.AbstractDeviceDriver;
* 标准版货架
*/
@Slf4j
-@Data
+@Getter
+@Setter
public class StandardStorageDeviceDriver extends AbstractDeviceDriver implements RouteableDeviceDriver, StorageDeviceDriver, DeviceDriver {
public StandardStorageDeviceDriver() {
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/AbstractDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/AbstractDeviceDriver.java
index e0c58cf..f206bcf 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/AbstractDeviceDriver.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/AbstractDeviceDriver.java
@@ -1,11 +1,13 @@
package org.nl.acs.device_driver.driver;
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.DeviceDriverDefination;
import org.nl.acs.opc.Device;
-@Data
+@Getter
+@Setter
public class AbstractDeviceDriver implements DeviceDriver {
public Device device;
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/ExecutableDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/ExecutableDeviceDriver.java
index 0848800..e8510fa 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/ExecutableDeviceDriver.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/ExecutableDeviceDriver.java
@@ -7,7 +7,7 @@ public interface ExecutableDeviceDriver extends DeviceDriver {
try {
this.execute();
} catch (Throwable var6) {
- String message = "线程调用异常:" + var6.getMessage();
+ String message = "线程调用异常:" + var6.getMessage();
} finally {
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lamp_three_color/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lamp_three_color/ItemProtocol.java
index 7734926..e1de560 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lamp_three_color/ItemProtocol.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lamp_three_color/ItemProtocol.java
@@ -56,7 +56,7 @@ public class ItemProtocol {
public static List getReadableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_heartbeat, "心跳", "DB51.B0"));
- list.add(new ItemDto(item_mode, "工作状态", "DB51.B1", Boolean.valueOf(true)));
+ list.add(new ItemDto(item_mode, "工作模式", "DB51.B1", Boolean.valueOf(true)));
list.add(new ItemDto(item_action, "动作信号", "DB51.B2"));
list.add(new ItemDto(item_error, "报警信号", "DB51.B4"));
return list;
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lamp_three_color/LampThreecolorDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lamp_three_color/LampThreecolorDefination.java
index b1421f4..f5d6861 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lamp_three_color/LampThreecolorDefination.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lamp_three_color/LampThreecolorDefination.java
@@ -57,7 +57,7 @@ public class LampThreecolorDefination implements OpcDeviceDriverDefination {
public static List getReadableItemDtos2() {
List list = new ArrayList();
list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB600.B0"));
- list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB600.B1", true));
+ list.add(new ItemDto(ItemProtocol.item_mode, "工作模式", "DB600.B1", true));
list.add(new ItemDto(ItemProtocol.item_action, "动作信号", "DB600.B2"));
list.add(new ItemDto(ItemProtocol.item_error, "报警信号", "DB600.B4"));
return list;
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lamp_three_color/LampThreecolorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lamp_three_color/LampThreecolorDeviceDriver.java
index 92516fa..028173d 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lamp_three_color/LampThreecolorDeviceDriver.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lamp_three_color/LampThreecolorDeviceDriver.java
@@ -1,7 +1,8 @@
package org.nl.acs.device_driver.lamp_three_color;
import com.alibaba.fastjson.JSONObject;
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
@@ -25,17 +26,18 @@ import java.util.Map;
* 检测站点驱动
*/
@Slf4j
-@Data
+@Getter
+@Setter
@RequiredArgsConstructor
public class LampThreecolorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver {
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");
String container;
String container_type_desc;
@@ -142,8 +144,10 @@ public class LampThreecolorDeviceDriver extends AbstractOpcDeviceDriver implemen
Map itemMap = new HashMap();
itemMap.put(to_command, command);
ReadUtil.write(itemMap, server);
+ ReadUtil.write(itemMap, server);
+ server.disconnect();
log.info("下发PLC信号:{},{}", to_command, command);
- System.out.println("设备:" + devicecode + ",下发PLC信号:" + to_command + ",value:" + command);
+ System.out.println("设备:" + devicecode + ",下发PLC信号:" + to_command + ",value:" + command);
}
public synchronized void OpenOrClose(String type) {
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_Laminating_machine/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_Laminating_machine/ItemProtocol.java
index 3eafb84..ac22382 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_Laminating_machine/ItemProtocol.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_Laminating_machine/ItemProtocol.java
@@ -1,6 +1,7 @@
package org.nl.acs.device_driver.lnsh.lnsh_Laminating_machine;
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
@@ -8,7 +9,8 @@ import java.util.ArrayList;
import java.util.List;
@Slf4j
-@Data
+@Getter
+@Setter
public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
@@ -95,17 +97,17 @@ public class ItemProtocol {
} else {
return value;
}
- return "0";
+ return "";
}
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"));
+ list.add(new ItemDto(item_mode, "工作模式", "DB32.B1", Boolean.valueOf(true)));
+ list.add(new ItemDto(item_move, "光电开关信号", "DB32.B2"));
+ list.add(new ItemDto(item_container_type, "托盘类型", "DB32.B3"));
+ list.add(new ItemDto(item_error, "报警信号", "DB32.B4"));
+ list.add(new ItemDto(item_task, "任务号", "DB32.D6"));
return list;
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_Laminating_machine/LnshLaminatingMachineDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_Laminating_machine/LnshLaminatingMachineDefination.java
index 43be0fd..c4e9427 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_Laminating_machine/LnshLaminatingMachineDefination.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_Laminating_machine/LnshLaminatingMachineDefination.java
@@ -58,11 +58,11 @@ public class LnshLaminatingMachineDefination implements OpcDeviceDriverDefinatio
public static List getReadableItemDtos2() {
List list = new ArrayList();
list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB.B0"));
- list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB.B1", true));
+ list.add(new ItemDto(ItemProtocol.item_mode, "工作模式", "DB.B1", true));
list.add(new ItemDto(ItemProtocol.item_move, "光电开关信号", "DB.B2"));
list.add(new ItemDto(ItemProtocol.item_container_type, "托盘类型", "DB.B3"));
list.add(new ItemDto(ItemProtocol.item_error, "报警信号", "DB.B4"));
- list.add(new ItemDto(ItemProtocol.item_task, "任务号", "DB.D5"));
+ list.add(new ItemDto(ItemProtocol.item_task, "任务号", "DB.D6"));
return list;
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_Laminating_machine/LnshLaminatingMachineDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_Laminating_machine/LnshLaminatingMachineDeviceDriver.java
index 7935dc1..8e5be2e 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_Laminating_machine/LnshLaminatingMachineDeviceDriver.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_Laminating_machine/LnshLaminatingMachineDeviceDriver.java
@@ -1,8 +1,11 @@
package org.nl.acs.device_driver.lnsh.lnsh_Laminating_machine;
import cn.hutool.core.util.StrUtil;
+import cn.hutool.http.HttpResponse;
+import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
@@ -15,12 +18,14 @@ 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.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService;
import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
import java.lang.reflect.Field;
import java.util.Date;
@@ -32,21 +37,22 @@ import java.util.Map;
* 晟华-覆膜机
*/
@Slf4j
-@Data
+@Getter
+@Setter
@RequiredArgsConstructor
-public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
+public class LnshLaminatingMachineDeviceDriver 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");
//放货准备锁
@@ -77,7 +83,7 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
private Date instruction_require_time = new Date();
private Date instruction_finished_time = new Date();
- private int instruction_require_time_out;
+ private int instruction_require_time_out = 1000;
boolean requireSucess = false;
private int instruction_finished_time_out;
@@ -115,25 +121,33 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
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);
+ 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);
+ 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);
+ 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);
+ 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);
+ this.setRequireSucess(false);
+ logServer.deviceItemValue(this.device_code, "container_type", String.valueOf(container_type));
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号container_type:" + last_container_type + " -> " + container_type);
+ }
+
+ if ("true".equals(this.device.getExtraValue().get("inspect_in_stocck"))) {
+ if (!requireSucess) {
+ if (this.feedbackVehicleType(String.valueOf(container_type))) {
+ this.setRequireSucess(true);
+ }
+ }
}
} catch (Exception var17) {
@@ -169,17 +183,6 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
break;
}
- switch (flag) {
- //取货完成
- case 1:
- writing(2);
- return;
- //放货完成
- case 2:
- writing(3);
- return;
-
- }
}
last_mode = mode;
@@ -228,6 +231,7 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
itemMap.put(to_command, 1);
itemMap.put(to_task, instruction_num);
ReadUtil.write(itemMap, server);
+ server.disconnect();
}
@@ -246,7 +250,7 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
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("to_barcode", vehicle_code);
this.writing(this.mode);
requireSucess = true;
}
@@ -257,6 +261,7 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
public void executing(Server server, Map itemMap) {
ReadUtil.write(itemMap, server);
+ server.disconnect();
}
public void writing(int command) {
@@ -268,6 +273,8 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
Map itemMap = new HashMap();
itemMap.put(to_command, command);
ReadUtil.write(itemMap, server);
+ ReadUtil.write(itemMap, server);
+ server.disconnect();
}
@@ -290,7 +297,8 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
itemMap.put(to_task, command);
}
ReadUtil.write(itemMap, server);
-
+ server.disconnect();
+ logServer.deviceExecuteLog(this.device_code, "", "", "to_command 写入 " + command);
}
public void writing(String param, String value) {
@@ -300,13 +308,15 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
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, value);
ReadUtil.write(itemMap, server);
+ server.disconnect();
+ logServer.deviceExecuteLog(this.device_code, "", "", param + " 写入 " + value);
}
public static Boolean isExistFieldName(String fieldName, Object obj) throws NoSuchFieldException {
- if (obj == null || StrUtil.isEmpty(fieldName)) {
+ if (obj == null || StrUtil.isBlank(fieldName)) {
return null;
}
//获取这个类的所有属性
@@ -321,4 +331,92 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
}
return flag;
}
+
+ public synchronized boolean feedbackVehicleType(String vehicle_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 param = new JSONObject();
+ param.put("device_code", device_code);
+ param.put("vehicle_type", vehicle_type);
+
+ HttpResponse response = acsToWmsService.feedbackVehicleType(param);
+
+ if (response.getStatus() == HttpStatus.OK.value() && "200".equals(JSON.parseObject(response.body()).getString("status"))) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public JSONObject getDeviceStatusName() throws Exception {
+ String mode;
+ String move;
+ boolean hasGoods;
+
+ switch (this.mode) {
+ case 0:
+ mode = "脱机";
+ break;
+ case 2:
+ mode = "待机";
+ break;
+ case 3:
+ mode = "运行中";
+ break;
+ default:
+ mode = String.valueOf(this.mode);
+ }
+
+ if (this.move == 0) {
+ move = "无货";
+ hasGoods = false;
+ } else {
+ move = "有货";
+ hasGoods = true;
+ }
+
+ String error;
+ switch (this.error) {
+ case 1:
+ error = "急停中";
+ break;
+ case 2:
+ error = "光幕报警";
+ break;
+ case 3:
+ error = "本体报警";
+ break;
+ case 4:
+ error = "未排产报警";
+ break;
+ case 5:
+ error = "扫码故障";
+ break;
+ default:
+ error = String.valueOf(this.error);
+ }
+
+ JSONObject jo = new JSONObject();
+ jo.put("device_name", this.getDevice().getDevice_name());
+ jo.put("mode", mode);
+ jo.put("move", move);
+ jo.put("container_type", container_type);
+ jo.put("error", error);
+ jo.put("task", task);
+ jo.put("isError", iserror);
+ jo.put("isOnline", isonline);
+ jo.put("hasGoods", hasGoods);
+ jo.put("message", message);
+ return jo;
+ }
+
+ @Override
+ public void setDeviceStatus(JSONObject data) {
+
+ }
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_crusher/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_crusher/ItemProtocol.java
index d817123..560221d 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_crusher/ItemProtocol.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_crusher/ItemProtocol.java
@@ -1,6 +1,7 @@
package org.nl.acs.device_driver.lnsh.lnsh_crusher;
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
@@ -8,7 +9,8 @@ import java.util.ArrayList;
import java.util.List;
@Slf4j
-@Data
+@Getter
+@Setter
public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
public static String item_mode = "mode";
@@ -48,10 +50,9 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_error);
}
- public int getOpen_time() {
- return this.getOpcIntegerValue(item_open_time);
+ public String getOpen_time() {
+ return this.getOpcStringValue(item_open_time);
}
-
public int getStandby_time() {
return this.getOpcIntegerValue(item_standby_time);
}
@@ -114,13 +115,13 @@ public class ItemProtocol {
} else {
return value;
}
- return "0";
+ return "";
}
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_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"));
@@ -136,7 +137,7 @@ public class ItemProtocol {
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_command, "下发指令", "DB2.W0", Boolean.valueOf(true)));
list.add(new ItemDto(item_to_error, "下发故障", "DB2.W2"));
return list;
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_crusher/LnshCrusherDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_crusher/LnshCrusherDefination.java
index aaf7936..08854a0 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_crusher/LnshCrusherDefination.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_crusher/LnshCrusherDefination.java
@@ -56,7 +56,7 @@ public class LnshCrusherDefination implements OpcDeviceDriverDefination {
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_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"));
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_crusher/LnshCrusherDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_crusher/LnshCrusherDeviceDriver.java
index 4d56643..aad03b1 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_crusher/LnshCrusherDeviceDriver.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_crusher/LnshCrusherDeviceDriver.java
@@ -1,7 +1,8 @@
package org.nl.acs.device_driver.lnsh.lnsh_crusher;
import cn.hutool.core.util.StrUtil;
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
@@ -16,8 +17,8 @@ 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.modules.lucence.service.LuceneExecuteLogService;
-import org.nl.modules.lucence.service.dto.LuceneLogDto;
+import org.nl.modules.lucene.service.LuceneExecuteLogService;
+import org.nl.modules.lucene.service.dto.LuceneLogDto;
import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
@@ -31,21 +32,22 @@ import java.util.Map;
* 晟华破碎机
*/
@Slf4j
-@Data
+@Getter
+@Setter
@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");
- @Autowired
+
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean("luceneExecuteLogServiceImpl");
String device_code;
@@ -67,8 +69,8 @@ public class LnshCrusherDeviceDriver extends AbstractOpcDeviceDriver implements
int status = 0;
int last_status = 0;
//开机时间
- int open_time = 0;
- int last_open_time = 0;
+ String open_time = "0";
+ String last_open_time = "0";
//待机时间
int standby_time = 0;
int last_standby_time = 0;
@@ -117,50 +119,49 @@ public class LnshCrusherDeviceDriver extends AbstractOpcDeviceDriver implements
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);
- luceneExecuteLogService.deviceExecuteLog(
- new LuceneLogDto(this.getDevice().getOpc_server_code(),this.getDevice().getOpc_plc_code(),this.device_code,ItemProtocol.item_mode,this.last_mode,this.mode));
+ logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + " -> " + mode);
+ luceneExecuteLogService.deviceExecuteLog(new LuceneLogDto(this.getDevice().getOpc_server_code(), this.getDevice().getOpc_plc_code(), this.device_code, ItemProtocol.item_mode, String.valueOf(this.last_mode), String.valueOf(this.mode)));
}
if (status != last_status) {
- logServer.deviceItemValue(this.device_code,"status" ,String.valueOf(status));
- logServer.deviceExecuteLog(this.device_code,"","","信号status:" + last_status + "->" + 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);
+ 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 (!open_time.equals(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);
+ 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);
+ 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);
+ 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);
+ 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 (!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);
+ 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);
+ 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) {
@@ -240,6 +241,7 @@ public class LnshCrusherDeviceDriver extends AbstractOpcDeviceDriver implements
public void executing(Server server, Map itemMap) {
ReadUtil.write(itemMap, server);
+ server.disconnect();
}
public void writing(String param, String value) {
@@ -252,6 +254,8 @@ public class LnshCrusherDeviceDriver extends AbstractOpcDeviceDriver implements
itemMap.put(to_param, value);
ReadUtil.write(itemMap, server);
+ server.disconnect();
+ logServer.deviceExecuteLog(this.device_code, "", "", param + " 写入 " + value);
}
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_fold_disc_site/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_fold_disc_site/ItemProtocol.java
index 0b7c531..b08e5a4 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_fold_disc_site/ItemProtocol.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_fold_disc_site/ItemProtocol.java
@@ -1,6 +1,7 @@
package org.nl.acs.device_driver.lnsh.lnsh_fold_disc_site;
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
@@ -8,7 +9,8 @@ import java.util.ArrayList;
import java.util.List;
@Slf4j
-@Data
+@Getter
+@Setter
public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
public static String item_mode = "mode";
@@ -42,8 +44,8 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_status);
}
- public int getOpen_time() {
- return this.getOpcIntegerValue(item_open_time);
+ public String getOpen_time() {
+ return this.getOpcStringValue(item_open_time);
}
public int getClose_time() {
@@ -97,25 +99,35 @@ public class ItemProtocol {
}
+ public String getOpcStringValue(String protocol) {
+ String value = this.driver.getStringValue(protocol);
+ if (value == null) {
+// log.error("读取错误!");
+ } else {
+ return value;
+ }
+ return "";
+ }
+
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"));
+ list.add(new ItemDto(item_heartbeat, "心跳", "DB120.B0"));
+ list.add(new ItemDto(item_mode, "工作模式", "DB120.B1", Boolean.valueOf(true)));
+ list.add(new ItemDto(item_status, "设备状态", "DB120.B2"));
+ list.add(new ItemDto(item_open_time, "开机时间", "DB120.STRING4.50"));
+ list.add(new ItemDto(item_close_time, "关机时间", "DB120.D56"));
+ list.add(new ItemDto(item_standby_time, "待机时间", "DB120.D60"));
+ list.add(new ItemDto(item_production_time, "生产时间", "DB120.D64"));
+ list.add(new ItemDto(item_error_time, "故障时间", "DB120.D68"));
+ list.add(new ItemDto(item_container_qty, "托盘数", "DB120.D72"));
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"));
+ list.add(new ItemDto(item_to_command, "下发指令", "DB121.W0", Boolean.valueOf(true)));
+ list.add(new ItemDto(item_to_target, "下发目标站", "DB121.W2"));
+ list.add(new ItemDto(item_to_task, "下发任务号", "DB121.D4"));
return list;
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_fold_disc_site/LnshFoldDiscSiteDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_fold_disc_site/LnshFoldDiscSiteDefination.java
index 272ab51..96721ce 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_fold_disc_site/LnshFoldDiscSiteDefination.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_fold_disc_site/LnshFoldDiscSiteDefination.java
@@ -55,15 +55,15 @@ public class LnshFoldDiscSiteDefination implements OpcDeviceDriverDefination {
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"));
+ list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB120.B0"));
+ list.add(new ItemDto(ItemProtocol.item_mode, "工作模式", "DB120.B1", Boolean.valueOf(true)));
+ list.add(new ItemDto(ItemProtocol.item_status, "设备状态", "DB120.B2"));
+ list.add(new ItemDto(ItemProtocol.item_open_time, "开机时间", "DB120.STRING4.50"));
+ list.add(new ItemDto(ItemProtocol.item_close_time, "关机时间", "DB120.D56"));
+ list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "DB120.D60"));
+ list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "DB120.D64"));
+ list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "DB120.D68"));
+ list.add(new ItemDto(ItemProtocol.item_container_qty, "托盘数", "DB120.D72"));
return list;
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_fold_disc_site/LnshFoldDiscSiteDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_fold_disc_site/LnshFoldDiscSiteDeviceDriver.java
index f130984..3121fc0 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_fold_disc_site/LnshFoldDiscSiteDeviceDriver.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_fold_disc_site/LnshFoldDiscSiteDeviceDriver.java
@@ -1,10 +1,10 @@
package org.nl.acs.device_driver.lnsh.lnsh_fold_disc_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.Getter;
+import lombok.Setter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
@@ -17,12 +17,14 @@ 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.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService;
import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
import java.util.Date;
import java.util.HashMap;
@@ -33,21 +35,22 @@ import java.util.Map;
* 晟华叠盘机
*/
@Slf4j
-@Data
+@Getter
+@Setter
@RequiredArgsConstructor
-public class LnshFoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
+public class LnshFoldDiscSiteDeviceDriver 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");
String device_code;
int mode = 0;
@@ -61,6 +64,7 @@ public class LnshFoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implem
Boolean iserror = false;
boolean requireSucess = false;
+ boolean requireQtySuccess = false;
int heartbeat;
int last_heartbeat;
@@ -79,8 +83,8 @@ public class LnshFoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implem
int status = 0;
int last_status = 0;
//开机时间
- int open_time = 0;
- int last_open_time = 0;
+ String open_time = "0";
+ String last_open_time = "0";
int close_time = 0;
int last_close_time = 0;
//待机时间
@@ -106,6 +110,8 @@ public class LnshFoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implem
String message = null;
try {
device_code = this.getDeviceCode();
+
+ heartbeat = this.itemProtocol.getHeartbeat();
mode = this.itemProtocol.getMode();
status = this.itemProtocol.getStatus();
open_time = this.itemProtocol.getOpen_time();
@@ -115,39 +121,44 @@ public class LnshFoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implem
error_time = this.itemProtocol.getError_time();
container_qty = this.itemProtocol.getContainer_qty();
+// if (heartbeat != last_heartbeat) {
+// logServer.deviceItemValue(this.device_code, "heartbeat", String.valueOf(mode));
+// logServer.deviceExecuteLog(this.device_code, "", "", "信号heartbeat:" + last_mode + " -> " + mode);
+// }
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);
+ 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);
+ 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 (!open_time.equals(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);
+ 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);
+ 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);
+ 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);
+ 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) {
this.setRequireSucess(false);
- logServer.deviceItemValue(this.device_code,"container_qty" ,String.valueOf(container_qty));
- logServer.deviceExecuteLog(this.device_code,"","","信号container_qty:" + last_container_qty + "->" + container_qty);
+ this.setRequireQtySuccess(false);
+ 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) {
@@ -184,18 +195,11 @@ public class LnshFoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implem
log.debug("设备运转模式:等待工作");
break;
case 2:
- int max_emptypalletnum = Integer.parseInt(this.getDevice().getExtraValue().get("max_emptypalletnum").toString());
- //当前数量等于最大数量,则生成搬运任务
- if (!requireSucess && container_qty == max_emptypalletnum) {
- putStorage();
- }
- break;
- case 3:
- if (!requireSucess) {
- palletizing();
- }
- break;
- case 4:
+// int max_emptypalletnum = Integer.parseInt(this.getDevice().getExtraValue().get("max_emptypalletnum").toString());
+// //当前数量等于最大数量,则生成搬运任务
+// if (!requireSucess && container_qty >= max_emptypalletnum) {
+// putStorage();
+// }
break;
}
}
@@ -224,12 +228,17 @@ public class LnshFoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implem
} else {
this.instruction_require_time = date;
JSONObject json = new JSONObject();
- json.put("device_code",device_code);
- json.put("type","3");
+ 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;
+ if (ObjectUtil.isNotEmpty(result)) {
+ if (result.getStatus() == HttpStatus.OK.value()) {
+ JSONObject jsonObject = JSONObject.parseObject(result.body());
+ if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
+ this.writing(this.mode);
+ requireSucess = true;
+ }
+ }
}
return true;
}
@@ -245,13 +254,16 @@ public class LnshFoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implem
if (value instanceof String) {
itemMap.put(to_param, value);
} else {
- itemMap.put(to_param, Integer.parseInt(value));
+ itemMap.put(to_param, value);
}
ReadUtil.write(itemMap, server);
+ server.disconnect();
+ logServer.deviceExecuteLog(this.device_code, "", "", param + " 写入 " + value);
}
public void executing(Server server, Map itemMap) {
ReadUtil.write(itemMap, server);
+ server.disconnect();
}
public void writing(int command) {
@@ -263,7 +275,9 @@ public class LnshFoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implem
Map itemMap = new HashMap();
itemMap.put(to_command, command);
ReadUtil.write(itemMap, server);
-
+ ReadUtil.write(itemMap, server);
+ server.disconnect();
+ logServer.deviceExecuteLog(this.device_code, "", "", "to_command 写入 " + command);
}
/**
@@ -279,19 +293,98 @@ public class LnshFoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implem
} else {
this.instruction_require_time = date;
JSONObject json = new JSONObject();
- json.put("device_code",this.device_code);
+ json.put("device_code", this.device_code);
json.put("qty", container_qty);
- json.put("type","3");
+ 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);
+ if (result.getStatus() == HttpStatus.OK.value()) {
+ JSONObject jsonObject = JSONObject.parseObject(result.body());
+ if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
+ this.writing(this.mode);
+ this.setRequireSucess(true);
+ }
}
}
return true;
}
}
+ @Override
+ public JSONObject getDeviceStatusName() throws Exception {
+ String mode;
+ String status;
+
+ switch (this.mode) {
+ case 0:
+ mode = "脱机";
+ break;
+ case 2:
+ mode = "待机";
+ break;
+ case 3:
+ mode = "排产确认";
+ break;
+ case 4:
+ mode = "工单完成";
+ break;
+ default:
+ mode = String.valueOf(this.mode);
+ }
+
+ switch (this.status) {
+ case 1:
+ status = "待机";
+ break;
+ case 2:
+ status = "生产中";
+ break;
+ case 3:
+ status = "故障";
+ break;
+ default:
+ status = String.valueOf(this.status);
+ }
+
+ String error;
+ switch (this.error) {
+ case 1:
+ error = "急停中";
+ break;
+ case 2:
+ error = "光幕报警";
+ break;
+ case 3:
+ error = "本体报警";
+ break;
+ case 4:
+ error = "未排产报警";
+ break;
+ case 5:
+ error = "扫码故障";
+ break;
+ default:
+ error = String.valueOf(this.error);
+ }
+
+ JSONObject jo = new JSONObject();
+ jo.put("device_name", this.getDevice().getDevice_name());
+ jo.put("mode", mode);
+ jo.put("status", status);
+ jo.put("error", error);
+ jo.put("open_time", open_time);
+ jo.put("standby_time", standby_time);
+ jo.put("production_time", production_time);
+ jo.put("error_time", error_time);
+ jo.put("container_qty", container_qty);
+ jo.put("isError", iserror);
+ jo.put("isOnline", isonline);
+ jo.put("message", message);
+ return jo;
+ }
+
+ @Override
+ public void setDeviceStatus(JSONObject data) {
+
+ }
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_lane/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_lane/ItemProtocol.java
index 06146cf..2e19f59 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_lane/ItemProtocol.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_lane/ItemProtocol.java
@@ -1,6 +1,7 @@
package org.nl.acs.device_driver.lnsh.lnsh_kiln_lane;
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
@@ -8,7 +9,8 @@ import java.util.ArrayList;
import java.util.List;
@Slf4j
-@Data
+@Getter
+@Setter
public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
public static String item_mode = "mode";
@@ -42,10 +44,9 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_status);
}
- public int getOpen_time() {
- return this.getOpcIntegerValue(item_open_time);
+ public String getOpen_time() {
+ return this.getOpcStringValue(item_open_time);
}
-
public int getStandby_time() {
return this.getOpcIntegerValue(item_standby_time);
}
@@ -97,25 +98,35 @@ public class ItemProtocol {
}
+ public String getOpcStringValue(String protocol) {
+ String value = this.driver.getStringValue(protocol);
+ if (value == null) {
+// log.error("读取错误!");
+ } else {
+ return value;
+ }
+ return "";
+ }
+
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_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"));
+ list.add(new ItemDto(item_open_time, "开机时间", "DB3.STRING4.50"));
+ list.add(new ItemDto(item_standby_time, "待机时间", "DB3.D56"));
+ list.add(new ItemDto(item_production_time, "生产时间", "DB3.D60"));
+ list.add(new ItemDto(item_error_time, "故障时间", "DB3.D64"));
+ list.add(new ItemDto(item_car_sum, "窑车总数", "DB3.D68"));
+ list.add(new ItemDto(item_nullCar_qty, "空窑车数", "DB3.D72"));
+ list.add(new ItemDto(item_burning_car_qty, "在烧窑车数", "DB3.D76"));
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"));
+ list.add(new ItemDto(item_to_command, "下发指令", "DB4.W0", Boolean.valueOf(true)));
+ list.add(new ItemDto(item_to_material_code, "下发物料编号", "DB4.STRING2.50"));
return list;
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_lane/LnshKilnLaneDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_lane/LnshKilnLaneDefination.java
index a39a4f1..08bc1df 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_lane/LnshKilnLaneDefination.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_lane/LnshKilnLaneDefination.java
@@ -54,17 +54,17 @@ public class LnshKilnLaneDefination implements OpcDeviceDriverDefination {
}
public static List getReadableItemDtos2() {
- List list = new ArrayList();
+ ArrayList 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_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"));
+ list.add(new ItemDto(ItemProtocol.item_open_time, "开机时间", "DB3.STRING4.50"));
+ list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "DB3.D56"));
+ list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "DB3.D60"));
+ list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "DB3.D64"));
+ list.add(new ItemDto(ItemProtocol.item_car_sum, "窑车总数", "DB3.D68"));
+ list.add(new ItemDto(ItemProtocol.item_nullCar_qty, "空窑车数", "DB3.D72"));
+ list.add(new ItemDto(ItemProtocol.item_burning_car_qty, "在烧窑车数", "DB3.D76"));
return list;
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_lane/LnshKilnLaneDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_lane/LnshKilnLaneDeviceDriver.java
index 8e48418..77b01d0 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_lane/LnshKilnLaneDeviceDriver.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_lane/LnshKilnLaneDeviceDriver.java
@@ -1,6 +1,8 @@
package org.nl.acs.device_driver.lnsh.lnsh_kiln_lane;
-import lombok.Data;
+import com.alibaba.fastjson.JSONObject;
+import lombok.Getter;
+import lombok.Setter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
@@ -12,6 +14,7 @@ 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.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService;
@@ -27,19 +30,20 @@ import java.util.Map;
* 晟华窑车道
*/
@Slf4j
-@Data
+@Getter
+@Setter
@RequiredArgsConstructor
-public class LnshKilnLaneDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
+public class LnshKilnLaneDeviceDriver 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");
String device_code;
@@ -65,8 +69,8 @@ public class LnshKilnLaneDeviceDriver extends AbstractOpcDeviceDriver implements
int status = 0;
int last_status = 0;
//开机时间
- int open_time = 0;
- int last_open_time = 0;
+ String open_time = "0";
+ String last_open_time = "0";
//待机时间
int standby_time = 0;
int last_standby_time = 0;
@@ -110,39 +114,39 @@ public class LnshKilnLaneDeviceDriver extends AbstractOpcDeviceDriver implements
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);
+ 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);
+ logServer.deviceExecuteLog(this.device_code,"","","信号status:" + last_status + " -> " + status);
}
- if (open_time != last_open_time) {
+ if (!open_time.equals(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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ logServer.deviceExecuteLog(this.device_code,"","","信号burning_car_qty:" + last_burning_car_qty + " -> " + burning_car_qty);
}
} catch (Exception var17) {
@@ -220,13 +224,16 @@ public class LnshKilnLaneDeviceDriver extends AbstractOpcDeviceDriver implements
if (value instanceof String) {
itemMap.put(to_param, value);
} else {
- itemMap.put(to_param, Integer.parseInt(value));
+ itemMap.put(to_param, value);
}
ReadUtil.write(itemMap, server);
+ server.disconnect();
+ logServer.deviceExecuteLog(this.device_code, "", "", param + " 写入 " + value);
}
public void executing(Server server, Map itemMap) {
ReadUtil.write(itemMap, server);
+ server.disconnect();
}
public void writing(int command) {
@@ -238,7 +245,63 @@ public class LnshKilnLaneDeviceDriver extends AbstractOpcDeviceDriver implements
Map itemMap = new HashMap();
itemMap.put(to_command, command);
ReadUtil.write(itemMap, server);
-
+ ReadUtil.write(itemMap, server);
+ server.disconnect();
+ logServer.deviceExecuteLog(this.device_code, "", "", "to_command 写入 " + command);
}
+ @Override
+ public JSONObject getDeviceStatusName() throws Exception {
+ String mode;
+ String status;
+
+ switch (this.mode) {
+ case 0:
+ mode = "脱机";
+ break;
+ case 2:
+ mode = "待机";
+ break;
+ case 3:
+ mode = "运行中";
+ break;
+ default:
+ mode = String.valueOf(this.mode);
+ }
+
+ switch (this.status) {
+ case 1:
+ status = "待机";
+ break;
+ case 2:
+ status = "生产中";
+ break;
+ case 3:
+ status = "故障";
+ break;
+ default:
+ status = String.valueOf(this.status);
+ }
+
+ JSONObject jo = new JSONObject();
+ jo.put("device_name", this.getDevice().getDevice_name());
+ jo.put("mode", mode);
+ jo.put("status", status);
+ jo.put("open_time", open_time);
+ jo.put("standby_time", standby_time);
+ jo.put("production_time", production_time);
+ jo.put("error_time", error_time);
+ jo.put("car_sum", car_sum);
+ jo.put("nullCar_qty", nullCar_qty);
+ jo.put("burning_car_qty", burning_car_qty);
+ jo.put("isError", iserror);
+ jo.put("isOnline", isonline);
+ jo.put("message", message);
+ return jo;
+ }
+
+ @Override
+ public void setDeviceStatus(JSONObject data) {
+
+ }
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_truss/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_truss/ItemProtocol.java
index ea0390b..1a42043 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_truss/ItemProtocol.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_truss/ItemProtocol.java
@@ -1,6 +1,7 @@
package org.nl.acs.device_driver.lnsh.lnsh_kiln_truss;
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
@@ -8,7 +9,8 @@ import java.util.ArrayList;
import java.util.List;
@Slf4j
-@Data
+@Getter
+@Setter
public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
public static String item_mode = "mode";
@@ -40,10 +42,9 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_status);
}
- public int getOpen_time() {
- return this.getOpcIntegerValue(item_open_time);
+ public String getOpen_time() {
+ return this.getOpcStringValue(item_open_time);
}
-
public int getStandby_time() {
return this.getOpcIntegerValue(item_standby_time);
}
@@ -87,21 +88,31 @@ public class ItemProtocol {
}
+ public String getOpcStringValue(String protocol) {
+ String value = this.driver.getStringValue(protocol);
+ if (value == null) {
+// log.error("读取错误!");
+ } else {
+ return value;
+ }
+ return "";
+ }
+
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_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_open_time, "开机时间", "DB1.STRING4.50"));
+ list.add(new ItemDto(item_standby_time, "待机时间", "DB1.D56"));
+ list.add(new ItemDto(item_production_time, "生产时间", "DB1.D60"));
+ list.add(new ItemDto(item_error_time, "故障时间", "DB1.D64"));
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_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/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_truss/LnshKilnTrussDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_truss/LnshKilnTrussDefination.java
index 99882aa..5043ddd 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_truss/LnshKilnTrussDefination.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_truss/LnshKilnTrussDefination.java
@@ -56,12 +56,12 @@ public class LnshKilnTrussDefination implements OpcDeviceDriverDefination {
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_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_open_time, "开机时间", "DB1.STRING4.50"));
+ list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "DB1.D56"));
+ list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "DB1.D60"));
+ list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "DB1.D64"));
return list;
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_truss/LnshKilnTrussDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_truss/LnshKilnTrussDeviceDriver.java
index 68b94a2..cbec0bc 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_truss/LnshKilnTrussDeviceDriver.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_truss/LnshKilnTrussDeviceDriver.java
@@ -1,6 +1,8 @@
package org.nl.acs.device_driver.lnsh.lnsh_kiln_truss;
-import lombok.Data;
+import com.alibaba.fastjson.JSONObject;
+import lombok.Getter;
+import lombok.Setter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.service.DeviceService;
@@ -11,6 +13,7 @@ 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.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService;
@@ -24,19 +27,20 @@ import java.util.List;
* 晟华入出窑桁架
*/
@Slf4j
-@Data
+@Getter
+@Setter
@RequiredArgsConstructor
-public class LnshKilnTrussDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
+public class LnshKilnTrussDeviceDriver 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");
String device_code;
@@ -64,8 +68,8 @@ public class LnshKilnTrussDeviceDriver extends AbstractOpcDeviceDriver implement
int status = 0;
int last_status = 0;
- int open_time = 0;
- int last_open_time = 0;
+ String open_time = "0";
+ String last_open_time = "0";
int standby_time = 0;
int last_standby_time = 0;
int production_time = 0;
@@ -94,27 +98,27 @@ public class LnshKilnTrussDeviceDriver extends AbstractOpcDeviceDriver implement
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);
+ 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);
+ logServer.deviceExecuteLog(this.device_code,"","","信号status:" + last_status + " -> " + status);
}
- if (open_time != last_open_time) {
+ if (!open_time.equals(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);
+ 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);
+ 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);
+ 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);
+ logServer.deviceExecuteLog(this.device_code,"","","信号error_time:" + last_error_time + " -> " + error_time);
}
} catch (Exception var17) {
@@ -178,4 +182,55 @@ public class LnshKilnTrussDeviceDriver extends AbstractOpcDeviceDriver implement
}
}
+ @Override
+ public JSONObject getDeviceStatusName() throws Exception {
+ String mode;
+ String status;
+
+ switch (this.mode) {
+ case 0:
+ mode = "脱机";
+ break;
+ case 2:
+ mode = "待机";
+ break;
+ case 3:
+ mode = "运行中";
+ break;
+ default:
+ mode = String.valueOf(this.mode);
+ }
+
+ switch (this.status) {
+ case 1:
+ status = "待机";
+ break;
+ case 2:
+ status = "生产中";
+ break;
+ case 3:
+ status = "故障";
+ break;
+ default:
+ status = String.valueOf(this.status);
+ }
+
+ JSONObject jo = new JSONObject();
+ jo.put("device_name", this.getDevice().getDevice_name());
+ jo.put("mode", mode);
+ jo.put("status", status);
+ jo.put("open_time", open_time);
+ jo.put("standby_time", standby_time);
+ jo.put("production_time", production_time);
+ jo.put("error_time", error_time);
+ jo.put("isError", iserror);
+ jo.put("isOnline", isonline);
+ jo.put("message", message);
+ return jo;
+ }
+
+ @Override
+ public void setDeviceStatus(JSONObject data) {
+
+ }
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_labeling_machine/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_labeling_machine/ItemProtocol.java
index 861b53f..0c82a8d 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_labeling_machine/ItemProtocol.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_labeling_machine/ItemProtocol.java
@@ -1,6 +1,7 @@
package org.nl.acs.device_driver.lnsh.lnsh_labeling_machine;
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
@@ -8,7 +9,8 @@ import java.util.ArrayList;
import java.util.List;
@Slf4j
-@Data
+@Getter
+@Setter
public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
public static String item_mode = "mode";
@@ -41,10 +43,9 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_status);
}
- public int getOpen_time() {
- return this.getOpcIntegerValue(item_open_time);
+ public String getOpen_time() {
+ return this.getOpcStringValue(item_open_time);
}
-
public int getClose_time() {
return this.getOpcIntegerValue(item_close_time);
}
@@ -92,10 +93,20 @@ public class ItemProtocol {
}
+ public String getOpcStringValue(String protocol) {
+ String value = this.driver.getStringValue(protocol);
+ if (value == null) {
+// log.error("读取错误!");
+ } else {
+ return value;
+ }
+ return "";
+ }
+
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_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"));
@@ -108,7 +119,7 @@ public class ItemProtocol {
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_command, "下发指令", "DB601.W0", Boolean.valueOf(true)));
list.add(new ItemDto(item_to_material_code, "下发物料编号", "DB601.D2"));
return list;
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_labeling_machine/LnshLabelingMachineDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_labeling_machine/LnshLabelingMachineDefination.java
index 7d79242..f72f359 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_labeling_machine/LnshLabelingMachineDefination.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_labeling_machine/LnshLabelingMachineDefination.java
@@ -56,7 +56,7 @@ public class LnshLabelingMachineDefination implements OpcDeviceDriverDefination
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_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"));
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_labeling_machine/LnshLabelingMachineDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_labeling_machine/LnshLabelingMachineDeviceDriver.java
index 13f6d2d..54223d1 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_labeling_machine/LnshLabelingMachineDeviceDriver.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_labeling_machine/LnshLabelingMachineDeviceDriver.java
@@ -1,6 +1,7 @@
package org.nl.acs.device_driver.lnsh.lnsh_labeling_machine;
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
@@ -29,21 +30,22 @@ import java.util.Map;
* 晟华贴标机
*/
@Slf4j
-@Data
+@Getter
+@Setter
@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;
@@ -63,8 +65,8 @@ public class LnshLabelingMachineDeviceDriver extends AbstractOpcDeviceDriver imp
int status = 0;
int last_status = 0;
//开机时间
- int open_time = 0;
- int last_open_time = 0;
+ String open_time = "0";
+ String last_open_time = "0";
int close_time = 0;
int last_close_time = 0;
//待机时间
@@ -104,35 +106,35 @@ public class LnshLabelingMachineDeviceDriver extends AbstractOpcDeviceDriver imp
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);
+ 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);
+ logServer.deviceExecuteLog(this.device_code,"","","信号status:" + last_status + " -> " + status);
}
- if (open_time != last_open_time) {
+ if (!open_time.equals(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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ logServer.deviceExecuteLog(this.device_code,"","","信号labeling_qty:" + last_labeling_qty + " -> " + labeling_qty);
}
} catch (Exception var17) {
@@ -208,6 +210,7 @@ public class LnshLabelingMachineDeviceDriver extends AbstractOpcDeviceDriver imp
public void executing(Server server, Map itemMap) {
ReadUtil.write(itemMap, server);
+ server.disconnect();
}
public void writing(int command) {
@@ -216,7 +219,8 @@ public class LnshLabelingMachineDeviceDriver extends AbstractOpcDeviceDriver imp
Server server = ReadUtil.getServer(opcservcerid);
Map itemMap = new HashMap();
ReadUtil.write(itemMap, server);
-
+ server.disconnect();
+ logServer.deviceExecuteLog(this.device_code, "", "", "to_command 写入 " + command);
}
public void writing(String param, String value) {
@@ -229,5 +233,7 @@ public class LnshLabelingMachineDeviceDriver extends AbstractOpcDeviceDriver imp
itemMap.put(to_param, value);
ReadUtil.write(itemMap, server);
+ server.disconnect();
+ logServer.deviceExecuteLog(this.device_code, "", "", param + " 写入 " + value);
}
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/ItemProtocol.java
index 0901b09..3a9398b 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/ItemProtocol.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/ItemProtocol.java
@@ -1,6 +1,7 @@
package org.nl.acs.device_driver.lnsh.lnsh_mixing_mill;
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
@@ -8,7 +9,8 @@ import java.util.ArrayList;
import java.util.List;
@Slf4j
-@Data
+@Getter
+@Setter
public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
@@ -52,10 +54,9 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_error);
}
- public int getOpen_time() {
- return this.getOpcIntegerValue(item_open_time);
+ public String getOpen_time() {
+ return this.getOpcStringValue(item_open_time);
}
-
public int getWeight() {
return this.getOpcIntegerValue(item_weight);
}
@@ -129,34 +130,34 @@ public class ItemProtocol {
} else {
return value;
}
- return "0";
+ return "";
}
public static List getReadableItemDtos() {
- ArrayList list = new ArrayList();
+ 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_mode, "工作模式", "DB4.B1", Boolean.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.STRING24.50"));
- list.add(new ItemDto(item_mix_num, "碾次", "DB4.D74"));
- list.add(new ItemDto(item_material, "当前生产物料", "DB4.STRING78.50"));
+ list.add(new ItemDto(item_open_time, "开机时间", "DB4.STRING4.50"));
+ list.add(new ItemDto(item_standby_time, "待机时间", "DB4.D56"));
+ list.add(new ItemDto(item_production_time, "生产时间", "DB4.D60"));
+ list.add(new ItemDto(item_error_time, "故障时间", "DB4.D64"));
+ list.add(new ItemDto(item_weight, "当前生产重量", "DB4.D68"));
+ list.add(new ItemDto(item_order_No, "工单号", "DB4.STRING72.50"));
+ list.add(new ItemDto(item_mix_num, "碾次", "DB4.D124"));
+ list.add(new ItemDto(item_material, "当前生产物料", "DB4.STRING128.50"));
return list;
}
public static List getWriteableItemDtos() {
- ArrayList list = new ArrayList();
- list.add(new ItemDto(item_to_command, "反馈", "DB5.W0", Boolean.valueOf(true)));
+ ArrayList list = new ArrayList<>();
+ list.add(new ItemDto(item_to_command, "反馈", "DB5.W0", Boolean.TRUE));
list.add(new ItemDto(item_to_error, "error", "DB5.W2"));
list.add(new ItemDto(item_to_order_No, "工单号", "DB5.STRING4.50"));
- list.add(new ItemDto(item_to_weight, "生产重量", "DB5.D54"));
- list.add(new ItemDto(item_to_material_code, "下发物料编号", "DB5.STRING58.50"));
+ list.add(new ItemDto(item_to_weight, "生产重量", "DB5.D56"));
+ list.add(new ItemDto(item_to_material_code, "下发物料编号", "DB5.STRING60.50"));
return list;
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/LnshMixingMillDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/LnshMixingMillDefination.java
index d15d146..12bd454 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/LnshMixingMillDefination.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/LnshMixingMillDefination.java
@@ -56,19 +56,20 @@ public class LnshMixingMillDefination implements OpcDeviceDriverDefination {
}
public static List getReadableItemDtos2() {
- List list = new ArrayList();
+ ArrayList 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_mode, "工作模式", "DB4.B1", Boolean.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.STRING24.50"));
- list.add(new ItemDto(ItemProtocol.item_mix_num, "碾次", "DB4.D74"));
- list.add(new ItemDto(ItemProtocol.item_material, "当前生产物料", "DB4.STRING78.50"));
+ list.add(new ItemDto(ItemProtocol.item_open_time, "开机时间", "DB4.STRING4.50"));
+ list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "DB4.D56"));
+ list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "DB4.D60"));
+ list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "DB4.D64"));
+ list.add(new ItemDto(ItemProtocol.item_weight, "当前生产重量", "DB4.D68"));
+ list.add(new ItemDto(ItemProtocol.item_order_No, "工单号", "DB4.STRING72.50"));
+ list.add(new ItemDto(ItemProtocol.item_mix_num, "碾次", "DB4.D124"));
+ list.add(new ItemDto(ItemProtocol.item_material, "当前生产物料", "DB4.STRING128.50"));
+
return list;
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/LnshMixingMillDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/LnshMixingMillDeviceDriver.java
index 11956b8..394cb8c 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/LnshMixingMillDeviceDriver.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/LnshMixingMillDeviceDriver.java
@@ -4,7 +4,8 @@ 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.Getter;
+import lombok.Setter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
@@ -17,6 +18,7 @@ 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;
@@ -25,6 +27,7 @@ import org.nl.acs.task.service.TaskService;
import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
import java.lang.reflect.Field;
import java.util.Date;
@@ -36,23 +39,24 @@ import java.util.Map;
* 晟华混碾机
*/
@Slf4j
-@Data
+@Getter
+@Setter
@RequiredArgsConstructor
-public class LnshMixingMillDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
+public class LnshMixingMillDeviceDriver 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;
@@ -85,8 +89,8 @@ public class LnshMixingMillDeviceDriver extends AbstractOpcDeviceDriver implemen
int status = 0;
int last_status = 0;
- int open_time = 0;
- int last_open_time = 0;
+ String open_time = "0";
+ String last_open_time = "0";
int standby_time = 0;
int last_standby_time = 0;
int production_time = 0;
@@ -129,47 +133,47 @@ public class LnshMixingMillDeviceDriver extends AbstractOpcDeviceDriver implemen
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);
+ 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);
+ 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);
+ logServer.deviceExecuteLog(this.device_code,"","","信号status:" + last_status + " -> " + status);
}
- if (open_time != last_open_time) {
+ if (!open_time.equals(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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ logServer.deviceExecuteLog(this.device_code,"","","信号mix_num:" + last_mix_num + " -> " + mix_num);
}
} catch (Exception var17) {
@@ -200,25 +204,20 @@ public class LnshMixingMillDeviceDriver extends AbstractOpcDeviceDriver implemen
break;
case 3:
//排产单确认
- if (!requireSucess && !StrUtil.equals(order_No,"0")) {
+ if (!requireSucess && !"0".equals(order_No) && StrUtil.isNotBlank(order_No)) {
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");
+ json.put("workorder_code", order_No);
+ json.put("type", "1");
enterProduction(json);
}
break;
case 4:
- //工单完成
- if (!requireSucess && !StrUtil.equals(order_No,"0")) {
+ //工单完成反馈
+ if (!requireSucess && !"0".equals(order_No) && StrUtil.isNotBlank(order_No)) {
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");
+ json.put("workorder_code", order_No);
+ json.put("qty", weight);
+ json.put("type", "2");
enterProduction(json);
}
break;
@@ -263,17 +262,19 @@ public class LnshMixingMillDeviceDriver extends AbstractOpcDeviceDriver implemen
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");
+ if (result.getStatus() == HttpStatus.OK.value()) {
+ JSONObject jsonObject = JSONObject.parseObject(result.body());
+ if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
+// 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);
}
- produceshiftorderService.update(dto);
- this.writing(this.mode);
- this.setRequireSucess(true);
}
}
return true;
@@ -297,6 +298,7 @@ public class LnshMixingMillDeviceDriver extends AbstractOpcDeviceDriver implemen
public void executing(Server server, Map itemMap) {
ReadUtil.write(itemMap, server);
+ server.disconnect();
}
public void writing(int command) {
@@ -308,7 +310,9 @@ public class LnshMixingMillDeviceDriver extends AbstractOpcDeviceDriver implemen
Map itemMap = new HashMap();
itemMap.put(to_command, command);
ReadUtil.write(itemMap, server);
-
+ ReadUtil.write(itemMap, server);
+ server.disconnect();
+ logServer.deviceExecuteLog(this.device_code, "", "", "to_command 写入 " + command);
}
public void writing(int type, int command) {
@@ -329,6 +333,7 @@ public class LnshMixingMillDeviceDriver extends AbstractOpcDeviceDriver implemen
itemMap.put(to_material_code, command);
}
ReadUtil.write(itemMap, server);
+ server.disconnect();
}
public void writing(String param, String value) {
@@ -340,14 +345,16 @@ public class LnshMixingMillDeviceDriver extends AbstractOpcDeviceDriver implemen
Map itemMap = new HashMap();
itemMap.put(to_param, value);
-// itemMap.put(to_param, Integer.parseInt(value));
+// itemMap.put(to_param, value);
ReadUtil.write(itemMap, server);
+ server.disconnect();
+ logServer.deviceExecuteLog(this.device_code, "", "", param + " 写入 " + value);
}
public static Boolean isExistFieldName(String fieldName, Object obj) throws NoSuchFieldException {
- if (obj == null || StrUtil.isEmpty(fieldName)) {
+ if (obj == null || StrUtil.isBlank(fieldName)) {
return null;
}
//获取这个类的所有属性
@@ -362,4 +369,85 @@ public class LnshMixingMillDeviceDriver extends AbstractOpcDeviceDriver implemen
}
return flag;
}
+
+ @Override
+ public JSONObject getDeviceStatusName() throws Exception {
+ String mode;
+ String status;
+
+ switch (this.mode) {
+ case 0:
+ mode = "脱机";
+ break;
+ case 2:
+ mode = "待机";
+ break;
+ case 3:
+ mode = "排产确认";
+ break;
+ case 4:
+ mode = "工单完成";
+ break;
+ default:
+ mode = String.valueOf(this.mode);
+ }
+
+ switch (this.status) {
+ case 1:
+ status = "待机";
+ break;
+ case 2:
+ status = "生产中";
+ break;
+ case 3:
+ status = "故障";
+ break;
+ default:
+ status = String.valueOf(this.status);
+ }
+
+ String error;
+ switch (this.error) {
+ case 1:
+ error = "急停中";
+ break;
+ case 2:
+ error = "光幕报警";
+ break;
+ case 3:
+ error = "本体报警";
+ break;
+ case 4:
+ error = "未排产报警";
+ break;
+ case 5:
+ error = "扫码故障";
+ break;
+ default:
+ error = String.valueOf(this.error);
+ }
+
+ JSONObject jo = new JSONObject();
+ jo.put("device_name", this.getDevice().getDevice_name());
+ jo.put("mode", mode);
+ jo.put("status", status);
+ jo.put("error", error);
+ jo.put("open_time", open_time);
+ jo.put("standby_time", standby_time);
+ jo.put("production_time", production_time);
+ jo.put("error_time", error_time);
+ jo.put("message", message);
+ jo.put("weight", weight);
+ jo.put("order_No", order_No);
+ jo.put("mix_num", mix_num);
+ jo.put("material", material);
+ jo.put("isError", iserror);
+ jo.put("isOnline", isonline);
+ return jo;
+ }
+
+ @Override
+ public void setDeviceStatus(JSONObject data) {
+
+ }
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_out_kiln_truss/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_out_kiln_truss/ItemProtocol.java
index 5e60373..0d7eef3 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_out_kiln_truss/ItemProtocol.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_out_kiln_truss/ItemProtocol.java
@@ -1,6 +1,7 @@
package org.nl.acs.device_driver.lnsh.lnsh_out_kiln_truss;
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
@@ -8,7 +9,8 @@ import java.util.ArrayList;
import java.util.List;
@Slf4j
-@Data
+@Getter
+@Setter
public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
public static String item_mode = "mode";
@@ -55,10 +57,9 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_outKiln_device);
}
- public int getOpen_time() {
- return this.getOpcIntegerValue(item_open_time);
+ public String getOpen_time() {
+ return this.getOpcStringValue(item_open_time);
}
-
public int getStandby_time() {
return this.getOpcIntegerValue(item_standby_time);
}
@@ -108,27 +109,27 @@ public class ItemProtocol {
} else {
return value;
}
- return "0";
+ return "";
}
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_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.W4"));
list.add(new ItemDto(item_outKiln_device, "出窑设备", "DB1.D6"));
- list.add(new ItemDto(item_open_time, "开机时间", "DB1.D10"));
- list.add(new ItemDto(item_standby_time, "待机时间", "DB1.D14"));
- list.add(new ItemDto(item_production_time, "生产时间", "DB1.D18"));
- list.add(new ItemDto(item_error_time, "故障时间", "DB1.D22"));
+ list.add(new ItemDto(item_open_time, "开机时间", "DB1.STRING10.50"));
+ list.add(new ItemDto(item_standby_time, "待机时间", "DB1.D62"));
+ list.add(new ItemDto(item_production_time, "生产时间", "DB1.D66"));
+ list.add(new ItemDto(item_error_time, "故障时间", "DB1.D70"));
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_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/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_out_kiln_truss/LnshOutKilnTrussDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_out_kiln_truss/LnshOutKilnTrussDefination.java
index 1aa2f4e..668d493 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_out_kiln_truss/LnshOutKilnTrussDefination.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_out_kiln_truss/LnshOutKilnTrussDefination.java
@@ -56,15 +56,15 @@ public class LnshOutKilnTrussDefination implements OpcDeviceDriverDefination {
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_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.W4"));
list.add(new ItemDto(ItemProtocol.item_outKiln_device, "出窑设备", "DB1.D6"));
- list.add(new ItemDto(ItemProtocol.item_open_time, "开机时间", "DB1.D10"));
- list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "DB1.D14"));
- list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "DB1.D18"));
- list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "DB1.D22"));
+ list.add(new ItemDto(ItemProtocol.item_open_time, "开机时间", "DB1.STRING10.50"));
+ list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "DB1.D62"));
+ list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "DB1.D66"));
+ list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "DB1.D70"));
return list;
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_out_kiln_truss/LnshOutKilnTrussDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_out_kiln_truss/LnshOutKilnTrussDeviceDriver.java
index e79b264..7d7ed8b 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_out_kiln_truss/LnshOutKilnTrussDeviceDriver.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_out_kiln_truss/LnshOutKilnTrussDeviceDriver.java
@@ -1,6 +1,10 @@
package org.nl.acs.device_driver.lnsh.lnsh_out_kiln_truss;
-import lombok.Data;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.http.HttpResponse;
+import com.alibaba.fastjson.JSONObject;
+import lombok.Getter;
+import lombok.Setter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
@@ -13,12 +17,14 @@ 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.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService;
import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
import java.util.Date;
import java.util.HashMap;
@@ -29,21 +35,22 @@ import java.util.Map;
* 晟华出窑桁架
*/
@Slf4j
-@Data
+@Getter
+@Setter
@RequiredArgsConstructor
-public class LnshOutKilnTrussDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
+public class LnshOutKilnTrussDeviceDriver 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");
String device_code;
@@ -78,8 +85,8 @@ public class LnshOutKilnTrussDeviceDriver extends AbstractOpcDeviceDriver implem
int status = 0;
int last_status = 0;
- int open_time = 0;
- int last_open_time = 0;
+ String open_time = "0";
+ String last_open_time = "0";
int standby_time = 0;
int last_standby_time = 0;
int production_time = 0;
@@ -120,39 +127,39 @@ public class LnshOutKilnTrussDeviceDriver extends AbstractOpcDeviceDriver implem
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);
+ 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);
+ logServer.deviceExecuteLog(this.device_code,"","","信号status:" + last_status + " -> " + status);
}
- if (open_time != last_open_time) {
+ if (!open_time.equals(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);
+ 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);
+ 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);
+ 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);
+ 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);
+ logServer.deviceExecuteLog(this.device_code,"","","信号outKiln_move:" + last_outKiln_move + " -> " + outKiln_move);
}
if (outKiln_barcode != last_outKiln_barcode) {
logServer.deviceItemValue(this.device_code,"outKiln_barcode" ,String.valueOf(outKiln_barcode));
- logServer.deviceExecuteLog(this.device_code,"","","信号outKiln_barcode:" + last_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);
+ logServer.deviceExecuteLog(this.device_code,"","","信号outKiln_device:" + last_outKiln_device + " -> " + outKiln_device);
}
} catch (Exception var17) {
@@ -195,7 +202,7 @@ public class LnshOutKilnTrussDeviceDriver extends AbstractOpcDeviceDriver implem
break;
case 5:
- if (!requireSucess) {
+ if (!requireSucess && outKiln_move != 0) {
outKiln();
}
break;
@@ -240,25 +247,35 @@ public class LnshOutKilnTrussDeviceDriver extends AbstractOpcDeviceDriver implem
} 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;
+ JSONObject param = new JSONObject();
+ param.put("vehicle_code", outKiln_barcode);
+ HttpResponse result = acsToWmsService.outKiln(param);
+ if (ObjectUtil.isNotEmpty(result)) {
+ if (result.getStatus() == HttpStatus.OK.value()) {
+ JSONObject jsonObject = JSONObject.parseObject(result.body());
+ if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
+ this.writing(jsonObject.getBooleanValue("data") ? 22 : 23);
+ this.writing(jsonObject.getBooleanValue("data") ? 22 : 23);
+ this.setRequireSucess(true);
+ }
+ }
+ }
return true;
}
}
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_palletizing_manipulator_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);
+ ReadUtil.write(itemMap, server);
+ server.disconnect();
+ logServer.deviceExecuteLog(this.device_code, "", "", "to_command 写入 " + command);
}
@@ -272,7 +289,65 @@ public class LnshOutKilnTrussDeviceDriver extends AbstractOpcDeviceDriver implem
itemMap.put(to_param, value);
ReadUtil.write(itemMap, server);
+ server.disconnect();
+ logServer.deviceExecuteLog(this.device_code, "", "", param + " 写入 " + value);
}
+ @Override
+ public JSONObject getDeviceStatusName() throws Exception {
+ String mode;
+ String status;
+ switch (this.mode) {
+ case 0:
+ mode = "脱机";
+ break;
+ case 2:
+ mode = "待机";
+ break;
+ case 3:
+ mode = "运行中";
+ break;
+ case 5:
+ mode = "申请出窑分配";
+ break;
+ default:
+ mode = String.valueOf(this.mode);
+ }
+
+ switch (this.status) {
+ case 1:
+ status = "待机";
+ break;
+ case 2:
+ status = "生产中";
+ break;
+ case 3:
+ status = "故障";
+ break;
+ default:
+ status = String.valueOf(this.status);
+ }
+
+ JSONObject jo = new JSONObject();
+ jo.put("device_name", this.getDevice().getDevice_name());
+ jo.put("mode", mode);
+ jo.put("status", status);
+ jo.put("outKiln_move", outKiln_move);
+ jo.put("outKiln_barcode", outKiln_barcode);
+ jo.put("outKiln_device", outKiln_device);
+ jo.put("open_time", open_time);
+ jo.put("standby_time", standby_time);
+ jo.put("production_time", production_time);
+ jo.put("error_time", error_time);
+ jo.put("isError", iserror);
+ jo.put("isOnline", isonline);
+ jo.put("message", message);
+ return jo;
+ }
+
+ @Override
+ public void setDeviceStatus(JSONObject data) {
+
+ }
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_line/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_line/ItemProtocol.java
index 0e7b942..250756c 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_line/ItemProtocol.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_line/ItemProtocol.java
@@ -1,6 +1,7 @@
package org.nl.acs.device_driver.lnsh.lnsh_package_line;
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
@@ -8,7 +9,8 @@ import java.util.ArrayList;
import java.util.List;
@Slf4j
-@Data
+@Getter
+@Setter
public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
public static String item_mode = "mode";
@@ -17,12 +19,23 @@ public class ItemProtocol {
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_vehicle_code = "vehicle_code";
+ public static String item_vehicle_type = "vehicle_type";
+ public static String item_error = "error";
+
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";
+ public static String item_to_is_package = "to_is_package";
+ public static String item_to_order_code = "to_order_code";
+ public static String item_to_customer = "to_customer";
+ public static String item_to_product_name = "to_product_name";
+ public static String item_to_product_grade = "to_product_grade";
+ public static String item_to_single_weight = "to_single_weight";
+ public static String item_to_qty = "to_qty";
+ public static String item_to_weight = "to_weight";
+ public static String item_to_date = "to_date";
+ public static String item_to_material_code = "to_material_code";
+ public static String item_to_brick_type = "to_brick_type";
+
Boolean isonline;
private LnshPackageLineDeviceDriver driver;
@@ -31,6 +44,11 @@ public class ItemProtocol {
this.driver = driver;
}
+ //是否有货
+ public int hasGoods(int move) {
+ return move;
+ }
+
public int getHeartbeat() {
return this.getOpcIntegerValue(item_heartbeat);
}
@@ -43,8 +61,8 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_status);
}
- public int getOpen_time() {
- return this.getOpcIntegerValue(item_open_time);
+ public String getOpen_time() {
+ return this.getOpcStringValue(item_open_time);
}
public int getStandby_time() {
@@ -59,35 +77,65 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_error_time);
}
- public int getBarcode() {
- return this.getOpcIntegerValue(item_barcode);
+ public int getVehicle_code() {
+ return this.getOpcIntegerValue(item_vehicle_code);
+ }
+
+ public int getVehicle_type() {
+ return this.getOpcIntegerValue(item_vehicle_type);
+ }
+
+ public int getError() {
+ return this.getOpcIntegerValue(item_error);
}
public int getTo_command() {
return this.getOpcIntegerValue(item_to_command);
}
- public int getTo_target() {
- return this.getOpcIntegerValue(item_to_target);
+ public int getTo_is_package() {
+ return this.getOpcIntegerValue(item_to_is_package);
}
- public int getTo_task() {
- return this.getOpcIntegerValue(item_to_task);
+ public String getTo_order_code() {
+ return this.getOpcStringValue(item_to_order_code);
}
- public int getTo_code_message() {
- return this.getOpcIntegerValue(item_to_code_message);
+ public String getTo_customer() {
+ return this.getOpcStringValue(item_to_customer);
}
- public String getTo_isPackage() {
- return this.getOpcStringValue(item_to_isPackage);
+ public String getTo_product_name() {
+ return this.getOpcStringValue(item_to_product_name);
}
- //是否有货
- public int hasGoods(int move) {
- return move;
+ public String getTo_product_grade() {
+ return this.getOpcStringValue(item_to_product_grade);
}
+ public String getTo_single_weight() {
+ return this.getOpcStringValue(item_to_single_weight);
+ }
+
+ public String getTo_qty() {
+ return this.getOpcStringValue(item_to_qty);
+ }
+
+ public String getTo_weight() {
+ return this.getOpcStringValue(item_to_weight);
+ }
+
+ public String getTo_date() {
+ return this.getOpcStringValue(item_to_date);
+ }
+
+ public String getTo_material_code() {
+ return this.getOpcStringValue(item_to_material_code);
+ }
+
+ public String getTo_brick_type() {
+ return this.getOpcStringValue(item_to_brick_type);
+ }
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
@@ -108,28 +156,37 @@ public class ItemProtocol {
} else {
return value;
}
- return "0";
+ return "";
}
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.W20"));
+ ArrayList list = new ArrayList<>();
+ list.add(new ItemDto(item_heartbeat, "心跳", "VB6000"));
+ list.add(new ItemDto(item_mode, "工作模式", "VB6001", Boolean.TRUE));
+ list.add(new ItemDto(item_status, "设备状态", "VB6002"));
+ list.add(new ItemDto(item_open_time, "开机时间", "VB6010.20"));
+ list.add(new ItemDto(item_standby_time, "待机时间", "VD6030"));
+ list.add(new ItemDto(item_production_time, "生产时间", "VD6035"));
+ list.add(new ItemDto(item_error_time, "故障时间", "VD6040"));
+ list.add(new ItemDto(item_vehicle_code, "载具编码", "VW6005"));
+ list.add(new ItemDto(item_vehicle_type, "载具类型", "VB6003"));
+ list.add(new ItemDto(item_error, "故障类型", "VB6004"));
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"));
+ ArrayList list = new ArrayList<>();
+ list.add(new ItemDto(item_to_command, "下发指令", "VW6100", Boolean.TRUE));
+ list.add(new ItemDto(item_to_order_code, "下发订单编号", "VB6200.10"));
+ list.add(new ItemDto(item_to_customer, "下发客户名称", "VB6210.10"));
+ list.add(new ItemDto(item_to_product_name, "下发产品名称", "VB6220.20"));
+ list.add(new ItemDto(item_to_product_grade, "下发产品牌号", "VB6240.20"));
+ list.add(new ItemDto(item_to_single_weight, "下发单重", "VB6260.10"));
+ list.add(new ItemDto(item_to_qty, "下发数量", "VB6270.10"));
+ list.add(new ItemDto(item_to_weight, "下发净重", "VB6280.10"));
+ list.add(new ItemDto(item_to_date, "下发生产日期", "VB6290.10"));
+ list.add(new ItemDto(item_to_material_code, "下发产品编码", "VB6300.20"));
+ list.add(new ItemDto(item_to_brick_type, "下发砖型", "VB6320.10"));
return list;
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_line/LnshPackageLineDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_line/LnshPackageLineDefination.java
index 1a9d99e..acce576 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_line/LnshPackageLineDefination.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_line/LnshPackageLineDefination.java
@@ -43,7 +43,7 @@ public class LnshPackageLineDefination implements OpcDeviceDriverDefination {
@Override
public List getFitDeviceTypes() {
- List types = new LinkedList();
+ List types = new LinkedList<>();
types.add(DeviceType.station);
return types;
}
@@ -54,15 +54,17 @@ public class LnshPackageLineDefination implements OpcDeviceDriverDefination {
}
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.W20"));
+ ArrayList list = new ArrayList<>();
+ list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "VB6000"));
+ list.add(new ItemDto(ItemProtocol.item_mode, "工作模式", "VB6001", Boolean.TRUE));
+ list.add(new ItemDto(ItemProtocol.item_status, "设备状态", "VB6002"));
+ list.add(new ItemDto(ItemProtocol.item_open_time, "开机时间", "VB6010.20"));
+ list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "VD6030"));
+ list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "VD6035"));
+ list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "VD6040"));
+ list.add(new ItemDto(ItemProtocol.item_vehicle_code, "载具编码", "VW6005"));
+ list.add(new ItemDto(ItemProtocol.item_vehicle_type, "载具类型", "VB6003"));
+ list.add(new ItemDto(ItemProtocol.item_error, "故障类型", "VB6004"));
return list;
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_line/LnshPackageLineDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_line/LnshPackageLineDeviceDriver.java
index 2eafa3b..6f43b97 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_line/LnshPackageLineDeviceDriver.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_line/LnshPackageLineDeviceDriver.java
@@ -1,7 +1,11 @@
package org.nl.acs.device_driver.lnsh.lnsh_package_line;
-import lombok.Data;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.http.HttpResponse;
+import com.alibaba.fastjson.JSONObject;
+import lombok.Getter;
import lombok.RequiredArgsConstructor;
+import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
import org.nl.acs.device.service.DeviceService;
@@ -9,15 +13,17 @@ 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.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService;
import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
-import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
import java.util.Date;
import java.util.HashMap;
@@ -28,61 +34,108 @@ import java.util.Map;
* 晟华包装机
*/
@Slf4j
-@Data
+@Getter
+@Setter
@RequiredArgsConstructor
-public class LnshPackageLineDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
+public class LnshPackageLineDeviceDriver 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");
+ 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;
- int last_heartbeat;
private Date checkHeartbeattime = new Date();
private Date last_checkHeartbeattime = new Date();
+ private int instruction_require_time_out = 3000;
+ private Date instruction_require_time = new Date();
+
String message;
+
+ int heartbeat = 0;
+ int last_heartbeat = 0;
+
+ int mode = 0;
+ int last_mode = 0;
+
int status = 0;
int last_status = 0;
- //开机时间
- int open_time = 0;
- int last_open_time = 0;
- //待机时间
+
+ String open_time = "";
+ String last_open_time = "";
+
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 barcode;
- int last_barcode;
+
+ int vehicle_code = 0;
+ int last_vehicle_code = 0;
+
+ int vehicle_type = 0;
+ int last_vehicle_type = 0;
+
+ int error = 0;
+ int last_error = 0;
+
+ int to_command = 0;
+ int last_to_command = 0;
+
+ int to_is_package = 0;
+ int last_to_is_package = 0;
+
+ String to_order_code = "";
+ String last_to_order_code = "";
+
+ String to_customer = "";
+ String last_to_customer = "";
+
+ String to_product_name = "";
+ String last_to_product_name = "";
+
+ String to_product_grade = "";
+ String last_to_product_grade = "";
+
+ String to_single_weight = "";
+ String last_to_single_weight = "";
+
+ String to_qty = "";
+ String last_to_qty = "";
+
+ String to_weight = "";
+ String last_to_weight = "";
+
+ String to_date = "";
+ String last_to_date = "";
+
+ String to_material_code = "";
+ String last_to_material_code = "";
+
+ String to_brick_type = "";
+ String last_to_brick_type = "";
@Override
public Device getDevice() {
return this.device;
}
-
@Override
public void execute() {
String message = null;
@@ -94,36 +147,41 @@ public class LnshPackageLineDeviceDriver extends AbstractOpcDeviceDriver impleme
standby_time = this.itemProtocol.getStandby_time();
production_time = this.itemProtocol.getProduction_time();
error_time = this.itemProtocol.getError_time();
- barcode = this.itemProtocol.getBarcode();
+ vehicle_code = this.itemProtocol.getVehicle_code();
+ vehicle_type = this.itemProtocol.getVehicle_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);
+ 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);
+ 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 (!open_time.equals(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);
+ 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);
+ 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);
+ logServer.deviceItemValue(this.device_code, "error_time", String.valueOf(error_time));
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号error_time:" + last_error_time + " -> " + error_time);
}
- if (barcode != last_barcode) {
- logServer.deviceItemValue(this.device_code,"barcode" ,String.valueOf(barcode));
- logServer.deviceExecuteLog(this.device_code,"","","信号barcode:" + last_barcode + "->" + barcode);
+ if (vehicle_code != last_vehicle_code) {
+ logServer.deviceItemValue(this.device_code, "vehicle_code", String.valueOf(vehicle_code));
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号vehicle_code:" + last_vehicle_code + " -> " + vehicle_code);
+ }
+ if (vehicle_type != last_vehicle_type) {
+ logServer.deviceItemValue(this.device_code, "vehicle_type", String.valueOf(vehicle_type));
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号vehicle_type:" + last_vehicle_type + " -> " + vehicle_type);
}
} catch (Exception var17) {
@@ -158,15 +216,12 @@ public class LnshPackageLineDeviceDriver extends AbstractOpcDeviceDriver impleme
switch (mode) {
case 1:
log.debug("设备运转模式:等待工作");
- break;
- case 2:
-
- break;
- case 3:
-
break;
case 4:
- break;
+ // 请求打码
+ if (!requireSucess && vehicle_code != 0 && vehicle_type != 0) {
+ this.mark();
+ }
}
}
@@ -176,12 +231,21 @@ public class LnshPackageLineDeviceDriver extends AbstractOpcDeviceDriver impleme
last_standby_time = standby_time;
last_production_time = production_time;
last_error_time = error_time;
- last_barcode = barcode;
- }
+ last_vehicle_code = vehicle_code;
+ last_vehicle_type = vehicle_type;
-
- protected void thingToNothing() throws Exception {
- this.setRequireSucess(false);
+ last_to_command = to_command;
+ last_to_is_package = to_is_package;
+ last_to_order_code = to_order_code;
+ last_to_customer = to_customer;
+ last_to_product_name = to_product_name;
+ last_to_product_grade = to_product_grade;
+ last_to_single_weight = to_single_weight;
+ last_to_qty = to_qty;
+ last_to_weight = to_weight;
+ last_to_date = to_date;
+ last_to_material_code = to_material_code;
+ last_to_brick_type = to_brick_type;
}
public boolean exe_error() {
@@ -199,6 +263,7 @@ public class LnshPackageLineDeviceDriver extends AbstractOpcDeviceDriver impleme
public void executing(Server server, Map itemMap) {
ReadUtil.write(itemMap, server);
+ server.disconnect();
}
public void writing(String param, String value) {
@@ -211,6 +276,137 @@ public class LnshPackageLineDeviceDriver extends AbstractOpcDeviceDriver impleme
itemMap.put(to_param, value);
ReadUtil.write(itemMap, server);
+ server.disconnect();
+ logServer.deviceExecuteLog(this.device_code, "", "", param + " 写入 " + value);
}
+ 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);
+ ReadUtil.write(itemMap, server);
+ server.disconnect();
+ logServer.deviceExecuteLog(this.device_code, "", "", "to_command 写入 " + command);
+ }
+
+ /**
+ * 请求唛头信息
+ */
+ public synchronized void mark() {
+ 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);
+ } else {
+ this.instruction_require_time = date;
+ JSONObject json = new JSONObject();
+ json.put("vehicle_type", vehicle_type);
+ json.put("vehicle_code", vehicle_code);
+ HttpResponse result = acsToWmsService.mark(json);
+ if (ObjectUtil.isNotEmpty(result)) {
+ if (result.getStatus() == HttpStatus.OK.value()) {
+ JSONObject jsonObject = JSONObject.parseObject(result.body());
+ if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
+ JSONObject data = jsonObject.getJSONObject("data");
+
+// this.writing("to_is_package", data.getString("is_package"));
+// this.writing("to_is_package", data.getString("is_package"));
+
+ this.writing("to_order_code", data.getString("order_code"));
+ this.writing("to_order_code", data.getString("order_code"));
+
+ this.writing("to_customer", data.getString("customer"));
+ this.writing("to_customer", data.getString("customer"));
+
+ this.writing("to_product_name", data.getString("product_name"));
+ this.writing("to_product_name", data.getString("product_name"));
+
+ this.writing("to_product_grade", data.getString("product_grade"));
+ this.writing("to_product_grade", data.getString("product_grade"));
+
+ this.writing("to_single_weight", data.getString("single_weight"));
+ this.writing("to_single_weight", data.getString("single_weight"));
+
+ this.writing("to_qty", data.getString("qty"));
+ this.writing("to_qty", data.getString("qty"));
+
+ this.writing("to_weight", data.getString("weight"));
+ this.writing("to_weight", data.getString("weight"));
+
+ this.writing("to_date", data.getString("date"));
+ this.writing("to_date", data.getString("date"));
+
+ this.writing("to_material_code", data.getString("material_code"));
+ this.writing("to_material_code", data.getString("material_code"));
+
+ this.writing("to_brick_type", data.getString("brick_type"));
+ this.writing("to_brick_type", data.getString("brick_type"));
+
+ this.writing(this.mode);
+ this.writing(this.mode);
+
+ this.setRequireSucess(true);
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public JSONObject getDeviceStatusName() throws Exception {
+ String mode;
+ String status;
+
+ switch (this.mode) {
+ case 0:
+ mode = "脱机";
+ break;
+ case 2:
+ mode = "待机";
+ break;
+ case 3:
+ mode = "运行中";
+ break;
+ default:
+ mode = String.valueOf(this.mode);
+ }
+
+ switch (this.status) {
+ case 1:
+ status = "待机";
+ break;
+ case 2:
+ status = "生产中";
+ break;
+ case 3:
+ status = "故障";
+ break;
+ default:
+ status = String.valueOf(this.status);
+ }
+
+ JSONObject jo = new JSONObject();
+ jo.put("device_name", this.getDevice().getDevice_name());
+ jo.put("mode", mode);
+ jo.put("status", status);
+ jo.put("error", error);
+ jo.put("open_time", open_time);
+ jo.put("standby_time", standby_time);
+ jo.put("production_time", production_time);
+ jo.put("error_time", error_time);
+ jo.put("barcode", vehicle_code);
+ jo.put("container_type", vehicle_type);
+ jo.put("isError", iserror);
+ jo.put("isOnline", isonline);
+ jo.put("message", message);
+ return jo;
+ }
+
+ @Override
+ public void setDeviceStatus(JSONObject data) {
+
+ }
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/ItemProtocol.java
index b65b0dc..a5a4344 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/ItemProtocol.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/ItemProtocol.java
@@ -1,8 +1,8 @@
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.Getter;
+import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
@@ -10,7 +10,8 @@ import java.util.ArrayList;
import java.util.List;
@Slf4j
-@Data
+@Getter
+@Setter
public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
@@ -18,15 +19,14 @@ public class ItemProtocol {
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_order_qty = "order_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";
@@ -36,11 +36,9 @@ public class ItemProtocol {
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_material = "to_material";
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";
@@ -48,6 +46,8 @@ public class ItemProtocol {
public static String item_to_Htrapezoidal = "to_Htrapezoidal";
public static String item_to_Wthickness = "to_Wthickness";
+ public static String item_to_on_vehicle_qty = "to_on_vehicle_qty";
+ public static String item_to_vehicle_type = "to_vehicle_type";
private LnshPackagePalletManipulatorDeviceDriver driver;
@@ -75,10 +75,6 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_putStation);
}
- public String getBarcode() {
- return this.getOpcStringValue(item_barcode);
- }
-
public String getMaterial() {
return this.getOpcStringValue(item_material);
}
@@ -87,8 +83,12 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_qty);
}
- public int getOpen_time() {
- return this.getOpcIntegerValue(item_open_time);
+ public int getOrder_qty() {
+ return this.getOpcIntegerValue(item_order_qty);
+ }
+
+ public String getOpen_time() {
+ return this.getOpcStringValue(item_open_time);
}
public int getStandby_time() {
@@ -135,46 +135,46 @@ public class ItemProtocol {
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_material() {
+ return this.getOpcStringValue(item_to_material);
}
public String getTo_order_No() {
return this.getOpcStringValue(item_to_order_No);
}
- public int getToProduct_code() {
+ public int getTo_order_qty() {
+ return this.getOpcIntegerValue(item_to_order_qty);
+ }
+
+ public int getTo_product_code() {
return this.getOpcIntegerValue(item_to_product_code);
}
- public int getToAlongSide() {
+ public int getTo_AlongSide() {
return this.getOpcIntegerValue(item_to_AlongSide);
}
- public int getToBshortSide() {
+ public int getTo_BshortSide() {
return this.getOpcIntegerValue(item_to_BshortSide);
}
- public int getToHtrapezoidal() {
+ public int getTo_Htrapezoidal() {
return this.getOpcIntegerValue(item_to_Htrapezoidal);
}
- public int getToWthickness() {
+ public int getTo_Wthickness() {
return this.getOpcIntegerValue(item_to_Wthickness);
}
+ public int getTo_on_vehicle_qty() {
+ return this.getOpcIntegerValue(item_to_on_vehicle_qty);
+ }
+
+ public int getTo_vehicle_type() {
+ return this.getOpcIntegerValue(item_to_vehicle_type);
+ }
+
//是否有货
public int hasGoods(int move) {
return move;
@@ -197,7 +197,7 @@ public class ItemProtocol {
public String getOpcStringValue(String protocol) {
String value = this.driver.getStringValue(protocol);
- if (StrUtil.isEmpty(value)) {
+ if (StrUtil.isBlank(value)) {
// log.error("读取错误!");
} else {
return value;
@@ -208,24 +208,24 @@ public class ItemProtocol {
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_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_putStation, "当前工位", "DB1.D4"));
+ list.add(new ItemDto(item_material, "物料", "DB1.STRING8.50"));
+ list.add(new ItemDto(item_qty, "拆/码垛数量", "DB1.D60"));
+ list.add(new ItemDto(item_order_qty, "工单总数量", "DB1.D64"));
+ list.add(new ItemDto(item_open_time, "开机时间", "DB1.STRING68.50"));
+ list.add(new ItemDto(item_standby_time, "待机时间", "DB1.D120"));
+ list.add(new ItemDto(item_production_time, "生产时间", "DB1.D124"));
+ list.add(new ItemDto(item_error_time, "故障时间", "DB1.D128"));
+ list.add(new ItemDto(item_order_No, "工单号", "DB1.STRING132.50"));
- 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_product_code, "产品编号", "DB1.W184"));
+ list.add(new ItemDto(item_AlongSide, "A长边", "DB1.W186"));
+ list.add(new ItemDto(item_BshortSide, "B短边", "DB1.W188"));
+ list.add(new ItemDto(item_Htrapezoidal, "H梯形高", "DB1.W190"));
+ list.add(new ItemDto(item_Wthickness, "W厚度", "DB1.W192"));
return list;
}
@@ -233,17 +233,17 @@ public class ItemProtocol {
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_material, "物料", "DB2.STRING2.50"));
+ list.add(new ItemDto(item_to_order_No, "工单号", "DB2.STRING54.50"));
+ list.add(new ItemDto(item_to_order_qty, "工单数量", "DB2.D106"));
+ list.add(new ItemDto(item_to_product_code, "产品编号", "DB2.W110"));
+ list.add(new ItemDto(item_to_AlongSide, "A长边", "DB2.W112"));
+ list.add(new ItemDto(item_to_BshortSide, "B短边", "DB2.W114"));
+ list.add(new ItemDto(item_to_Htrapezoidal, "H梯形高", "DB2.W116"));
+ list.add(new ItemDto(item_to_Wthickness, "W厚度", "DB2.W118"));
+ list.add(new ItemDto(item_to_on_vehicle_qty, "托盘上数量", "DB2.W120"));
+ list.add(new ItemDto(item_to_vehicle_type, "托盘类型", "DB2.W122"));
- 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"));
return list;
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDefination.java
index 07866a2..8aaf6fc 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDefination.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDefination.java
@@ -24,12 +24,12 @@ public class LnshPackagePalletManipulatorDefination implements OpcDeviceDriverDe
@Override
public String getDriverName() {
- return "晟华-包装码垛机械手";
+ return "晟华-分拣机械手";
}
@Override
public String getDriverDescription() {
- return "晟华-包装码垛机械手";
+ return "晟华-分拣机械手";
}
@Override
@@ -58,24 +58,24 @@ public class LnshPackagePalletManipulatorDefination implements OpcDeviceDriverDe
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_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_putStation, "当前工位", "DB1.D4"));
+ list.add(new ItemDto(ItemProtocol.item_material, "物料", "DB1.STRING8.50"));
+ list.add(new ItemDto(ItemProtocol.item_qty, "拆/码垛数量", "DB1.D60"));
+ list.add(new ItemDto(ItemProtocol.item_order_qty, "工单总数量", "DB1.D64"));
+ list.add(new ItemDto(ItemProtocol.item_open_time, "开机时间", "DB1.STRING68.50"));
+ list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "DB1.D120"));
+ list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "DB1.D124"));
+ list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "DB1.D128"));
+ list.add(new ItemDto(ItemProtocol.item_order_No, "工单号", "DB1.STRING132.50"));
- 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_product_code, "产品编号", "DB1.W184"));
+ list.add(new ItemDto(ItemProtocol.item_AlongSide, "A长边", "DB1.W186"));
+ list.add(new ItemDto(ItemProtocol.item_BshortSide, "B短边", "DB1.W188"));
+ list.add(new ItemDto(ItemProtocol.item_Htrapezoidal, "H梯形高", "DB1.W190"));
+ list.add(new ItemDto(ItemProtocol.item_Wthickness, "W厚度", "DB1.W192"));
return list;
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDeviceDriver.java
index 27bd5b2..9396ad7 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDeviceDriver.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDeviceDriver.java
@@ -1,9 +1,11 @@
package org.nl.acs.device_driver.lnsh.lnsh_package_pallet_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.Getter;
+import lombok.Setter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
@@ -16,6 +18,7 @@ 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;
@@ -24,6 +27,7 @@ import org.nl.acs.task.service.TaskService;
import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
import java.lang.reflect.Field;
import java.util.*;
@@ -32,23 +36,24 @@ import java.util.*;
* 晟华-包装码垛机械手
*/
@Slf4j
-@Data
+@Getter
+@Setter
@RequiredArgsConstructor
-public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
+public class LnshPackagePalletManipulatorDeviceDriver 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;
@@ -82,8 +87,8 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
int status = 0;
int last_status = 0;
//开机时间
- int open_time = 0;
- int last_open_time = 0;
+ String open_time = "0";
+ String last_open_time = "0";
//待机时间
int standby_time = 0;
int last_standby_time = 0;
@@ -117,6 +122,9 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
int last_Htrapezoidal = 0;
int last_Wthickness = 0;
+ int order_qty = 0;
+ int last_order_qty = 0;
+
@Override
public Device getDevice() {
return this.device;
@@ -132,14 +140,14 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
status = this.itemProtocol.getStatus();
error = this.itemProtocol.getError();
put_station = this.itemProtocol.getPutStation();
- barcode = this.itemProtocol.getBarcode();
material = this.itemProtocol.getMaterial();
+ qty = this.itemProtocol.getQty();
+ order_qty = this.itemProtocol.getOrder_qty();
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();
@@ -150,71 +158,71 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
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);
+ 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);
+ 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);
+ 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 (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 (!StrUtil.equals(material,last_material)) {
logServer.deviceItemValue(this.device_code,"material", material);
- logServer.deviceExecuteLog(this.device_code,"","","信号material:" + last_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);
+ logServer.deviceExecuteLog(this.device_code,"","","信号qty:" + last_qty + " -> " + qty);
+ }
+ 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 (!open_time.equals(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(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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ logServer.deviceExecuteLog(this.device_code,"","","信号Wthickness:" + last_Wthickness + " -> " + Wthickness);
}
} catch (Exception var17) {
@@ -245,50 +253,45 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
break;
case 4:
//排产单确认
- if (!requireSucess && !order_No.equals("0")) {
+ if (!requireSucess && !"0".equals(order_No) && StrUtil.isNotBlank(order_No)) {
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");
+ json.put("workorder_code", order_No);
+ 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 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")) {
+ if (!requireSucess && !"0".equals(order_No) && StrUtil.isNotBlank(order_No)) {
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");
+ json.put("workorder_code", order_No);
+ json.put("qty", qty);
+ json.put("type", "2");
enterProduction(json);
}
break;
@@ -312,6 +315,7 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
last_barcode = barcode;
last_material = material;
last_qty = qty;
+ last_order_qty = order_qty;
last_open_time = open_time;
last_standby_time = standby_time;
last_production_time = production_time;
@@ -349,16 +353,21 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
} 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");
+ if (ObjectUtil.isNotEmpty(result)) {
+ if (result.getStatus() == HttpStatus.OK.value()) {
+ JSONObject jsonObject = JSONObject.parseObject(result.body());
+ if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
+// 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);
+ }
}
- produceshiftorderService.update(dto);
- requireSucess = true;
}
return true;
}
@@ -383,7 +392,7 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
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);
+ JSONObject jo = new JSONObject();
if (jo.getInteger("status") == 200) {
JSONObject content = jo.getJSONObject("content");
@@ -545,9 +554,11 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
json.put("Wthickness",Wthickness);
HttpResponse result = acsToWmsService.applyTaskManipulatorToWms(json);
- if (result.getStatus() == 200) {
- this.writing(this.mode);
- requireSucess = true;
+ if (ObjectUtil.isNotEmpty(result)) {
+ if (result.getStatus() == 200) {
+ this.writing(this.mode);
+ requireSucess = true;
+ }
}
return true;
}
@@ -581,9 +592,11 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
json.put("Wthickness",Wthickness);
HttpResponse result = acsToWmsService.applyTaskManipulatorToWms(json);
- if (result.getStatus() == 200) {
- this.writing(this.mode);
- requireSucess = true;
+ if (ObjectUtil.isNotEmpty(result)) {
+ if (result.getStatus() == 200) {
+ this.writing(this.mode);
+ requireSucess = true;
+ }
}
return true;
}
@@ -609,9 +622,11 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
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;
+ if (ObjectUtil.isNotEmpty(result)) {
+ if (result.getStatus() == 200) {
+ this.writing(this.mode);
+ requireSucess = true;
+ }
}
return true;
}
@@ -623,10 +638,11 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
public void executing(Server server, Map itemMap) {
ReadUtil.write(itemMap, server);
+ server.disconnect();
}
public static Boolean isExistFieldName(String fieldName, Object obj) throws NoSuchFieldException {
- if (obj == null || StrUtil.isEmpty(fieldName)) {
+ if (obj == null || StrUtil.isBlank(fieldName)) {
return null;
}
//获取这个类的所有属性
@@ -650,6 +666,8 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
Map itemMap = new HashMap();
itemMap.put(to_feedback, feedback);
ReadUtil.write(itemMap, server);
+ server.disconnect();
+ logServer.deviceExecuteLog(this.device_code, "", "", "to_feedback 写入 " + feedback);
}
public void writing(String param, String value) {
@@ -662,5 +680,94 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
itemMap.put(to_param, value);
ReadUtil.write(itemMap, server);
+ server.disconnect();
+ logServer.deviceExecuteLog(this.device_code, "", "", param + " 写入 " + value);
+ }
+
+ @Override
+ public JSONObject getDeviceStatusName() throws Exception {
+ String mode;
+ String status;
+
+ switch (this.mode) {
+ case 0:
+ mode = "脱机";
+ break;
+ case 2:
+ mode = "待机";
+ break;
+ case 4:
+ mode = "排产确认";
+ break;
+ case 9:
+ mode = "工单完成";
+ break;
+ default:
+ mode = String.valueOf(this.mode);
+ }
+
+ switch (this.status) {
+ case 1:
+ status = "待机";
+ break;
+ case 2:
+ status = "生产中";
+ break;
+ case 3:
+ status = "故障";
+ break;
+ default:
+ status = String.valueOf(this.status);
+ }
+
+ String error;
+ switch (this.error) {
+ case 1:
+ error = "急停中";
+ break;
+ case 2:
+ error = "光幕报警";
+ break;
+ case 3:
+ error = "本体报警";
+ break;
+ case 4:
+ error = "未排产报警";
+ break;
+ case 5:
+ error = "扫码故障";
+ break;
+ default:
+ error = String.valueOf(this.error);
+ }
+
+ JSONObject jo = new JSONObject();
+ jo.put("device_name", this.getDevice().getDevice_name());
+ jo.put("mode", mode);
+ jo.put("status", status);
+ jo.put("error", error);
+ jo.put("putStation", put_station);
+ jo.put("material", material);
+ jo.put("qty", qty);
+ jo.put("order_qty", order_qty);
+ jo.put("open_time", open_time);
+ jo.put("standby_time", standby_time);
+ jo.put("production_time", production_time);
+ jo.put("error_time", error_time);
+ jo.put("order_No", order_No);
+ jo.put("product_code", product_code);
+ jo.put("AlongSide", AlongSide);
+ jo.put("BshortSide", BshortSide);
+ jo.put("Htrapezoidal", Htrapezoidal);
+ jo.put("Wthickness", Wthickness);
+ jo.put("isError", iserror);
+ jo.put("isOnline", isonline);
+ jo.put("message", message);
+ return jo;
+ }
+
+ @Override
+ public void setDeviceStatus(JSONObject data) {
+
}
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_site/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_site/ItemProtocol.java
index 3ed6f29..f6b3944 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_site/ItemProtocol.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_site/ItemProtocol.java
@@ -1,6 +1,7 @@
package org.nl.acs.device_driver.lnsh.lnsh_package_site;
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
@@ -8,7 +9,8 @@ import java.util.ArrayList;
import java.util.List;
@Slf4j
-@Data
+@Getter
+@Setter
public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
public static String item_mode = "mode";
@@ -16,15 +18,13 @@ public class ItemProtocol {
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";
+ public static String item_vehicle_code = "vehicle_code";
+ public static String item_vehicle_type = "vehicle_type";
+ public static String item_to_command = "to_command";
+ public static String item_to_vehicle_code = "to_vehicle_code";
+ public static String item_to_vehicle_type = "to_vehicle_type";
+ public static String item_to_is_package = "to_is_package";
Boolean isonline;
@@ -50,7 +50,7 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_action);
}
- public int getIoAction() {
+ public int getIoaction() {
return this.getOpcIntegerValue(item_ioaction);
}
@@ -58,36 +58,24 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_error);
}
- public int getTask() {
- return this.getOpcIntegerValue(item_task);
+ public int getVehicle_code() {
+ return this.getOpcIntegerValue(item_vehicle_code);
}
- public int getWeight() {
- return this.getOpcIntegerValue(item_weight);
+ public int getVehicle_type() {
+ return this.getOpcIntegerValue(item_vehicle_type);
}
- public String getMaterial() {
- return this.getOpcStringValue(item_material);
- }
-
- public int getBarcode() {
- return this.getOpcIntegerValue(item_barcode);
- }
-
- public int getToCommand() {
+ public int getTo_command() {
return this.getOpcIntegerValue(item_to_command);
}
- public int getToTarget() {
- return this.getOpcIntegerValue(item_to_target);
+ public int getTo_vehicle_code() {
+ return this.getOpcIntegerValue(item_to_vehicle_code);
}
- public int getToTask() {
- return this.getOpcIntegerValue(item_to_task);
- }
-
- public int getTo_isPackage() {
- return this.getOpcIntegerValue(item_to_isPackage);
+ public int getTo_vehicle_type() {
+ return this.getOpcIntegerValue(item_to_vehicle_type);
}
//是否有货
@@ -115,30 +103,28 @@ public class ItemProtocol {
} else {
return value;
}
- return "0";
+ return "";
}
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.STRING14.50"));
- list.add(new ItemDto(item_barcode, "条码", "DB3.W64"));
+ ArrayList list = new ArrayList<>();
+ list.add(new ItemDto(item_heartbeat, "心跳", "VB6510"));
+ list.add(new ItemDto(item_mode, "工作模式", "VB6511", Boolean.TRUE));
+ list.add(new ItemDto(item_move, "光电开关信号", "VB6512"));
+ list.add(new ItemDto(item_action, "取放信号", "VB6513"));
+ list.add(new ItemDto(item_ioaction, "进出信号", "VB6514"));
+ list.add(new ItemDto(item_error, "报警信号", "VB6515"));
+ list.add(new ItemDto(item_vehicle_code, "载具编码", "VW6517"));
+ list.add(new ItemDto(item_vehicle_type, "载具类型", "VB6516"));
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"));
+ ArrayList list = new ArrayList<>();
+ list.add(new ItemDto(item_to_command, "下发指令", "VW6810", Boolean.TRUE));
+ list.add(new ItemDto(item_to_vehicle_code, "下发载具编码", "VW6812"));
+ list.add(new ItemDto(item_to_vehicle_type, "下发载具类型", "VB6814"));
+ list.add(new ItemDto(item_to_is_package, "下发是否包装", "VB6815"));
return list;
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_site/LnshPackageSiteDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_site/LnshPackageSiteDefination.java
index 11b62c9..c6795f9 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_site/LnshPackageSiteDefination.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_site/LnshPackageSiteDefination.java
@@ -56,17 +56,15 @@ public class LnshPackageSiteDefination implements OpcDeviceDriverDefination {
}
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.STRING14.50"));
- list.add(new ItemDto(ItemProtocol.item_barcode, "条码", "DB3.W64"));
+ ArrayList list = new ArrayList<>();
+ list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "VB6510"));
+ list.add(new ItemDto(ItemProtocol.item_mode, "工作模式", "VB6511", Boolean.TRUE));
+ list.add(new ItemDto(ItemProtocol.item_move, "光电开关信号", "VB6512"));
+ list.add(new ItemDto(ItemProtocol.item_action, "取放信号", "VB6513"));
+ list.add(new ItemDto(ItemProtocol.item_ioaction, "进出信号", "VB6514"));
+ list.add(new ItemDto(ItemProtocol.item_error, "报警信号", "VB6515"));
+ list.add(new ItemDto(ItemProtocol.item_vehicle_code, "载具编码", "VW6517"));
+ list.add(new ItemDto(ItemProtocol.item_vehicle_type, "载具类型", "VB6516"));
return list;
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_site/LnshPackageSiteDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_site/LnshPackageSiteDeviceDriver.java
index dc83b3d..0a543df 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_site/LnshPackageSiteDeviceDriver.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_site/LnshPackageSiteDeviceDriver.java
@@ -1,10 +1,9 @@
package org.nl.acs.device_driver.lnsh.lnsh_package_site;
-import cn.hutool.core.util.StrUtil;
-import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSONObject;
-import lombok.Data;
+import lombok.Getter;
import lombok.RequiredArgsConstructor;
+import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
import org.nl.acs.device.service.DeviceService;
@@ -16,12 +15,12 @@ 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.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService;
import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
-import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date;
import java.util.HashMap;
@@ -32,39 +31,29 @@ import java.util.Map;
* 晟华-包装线工位
*/
@Slf4j
-@Data
+@Getter
+@Setter
@RequiredArgsConstructor
-public class LnshPackageSiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
+public class LnshPackageSiteDeviceDriver 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");
//放货准备锁
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;
@@ -80,9 +69,6 @@ public class LnshPackageSiteDeviceDriver extends AbstractOpcDeviceDriver impleme
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();
@@ -100,12 +86,39 @@ public class LnshPackageSiteDeviceDriver extends AbstractOpcDeviceDriver impleme
int flag;
String message;
- int weight = 0;
- int last_weight = 0;
- String material;
- String last_material;
- int barcode;
- int last_barcode;
+
+ int heartbeat = 0;
+ int last_heartbeat = 0;
+
+ int mode = 0;
+ int last_mode = 0;
+
+ int move = 0;
+ int last_move = 0;
+
+ int action = 0;
+ int last_action = 0;
+
+ int ioaction = 0;
+ int last_ioaction = 0;
+
+ int error = 0;
+ int last_error = 0;
+
+ int vehicle_code = 0;
+ int last_vehicle_code = 0;
+
+ int vehicle_type = 0;
+ int last_vehicle_type = 0;
+
+ int to_command = 0;
+ int last_to_command = 0;
+
+ int to_vehicle_code = 0;
+ int last_to_vehicle_code = 0;
+
+ int to_vehicle_type = 0;
+ int last_to_vehicle_type = 0;
@Override
public Device getDevice() {
@@ -119,54 +132,42 @@ public class LnshPackageSiteDeviceDriver extends AbstractOpcDeviceDriver impleme
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();
+ ioaction = this.itemProtocol.getIoaction();
+ error = this.itemProtocol.getError();
+ vehicle_code = this.itemProtocol.getVehicle_code();
+ vehicle_type = this.itemProtocol.getVehicle_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);
+ 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);
+ logServer.deviceItemValue(this.device_code, "move", String.valueOf(move));
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号move:" + last_move + " -> " + move);
}
if (action != last_action) {
- logServer.deviceItemValue(this.device_code,"action",String.valueOf(action));
- logServer.deviceExecuteLog(this.device_code,"","","信号action:" + last_action + "->" + 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 (ioaction != last_ioaction) {
+ logServer.deviceItemValue(this.device_code, "ioaction", String.valueOf(ioaction));
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号ioaction:" + last_ioaction + " -> " + ioaction);
}
- if (weight != last_weight) {
- logServer.deviceItemValue(this.device_code,"weight",String.valueOf(weight));
- logServer.deviceExecuteLog(this.device_code,"","","信号weight: " + last_weight + "->" + weight);
+ if (error != last_error) {
+ logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号error:" + last_error + " -> " + error);
}
- if (!StrUtil.equals(material,last_material)) {
- logServer.deviceItemValue(this.device_code,"material", material);
- logServer.deviceExecuteLog(this.device_code,"","","信号material:" + last_material + "->" + material);
+ if (vehicle_code != last_vehicle_code) {
+ logServer.deviceItemValue(this.device_code, "vehicle_code", String.valueOf(vehicle_code));
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号vehicle_code:" + last_vehicle_code + " -> " + vehicle_code);
}
- if (barcode != last_barcode) {
- logServer.deviceItemValue(this.device_code,"barcode", String.valueOf(barcode));
- logServer.deviceExecuteLog(this.device_code,"","","信号barcode:" + last_barcode + "->" + barcode);
+ if (vehicle_type != last_vehicle_type) {
+ logServer.deviceItemValue(this.device_code, "vehicle_type", String.valueOf(vehicle_type));
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号vehicle_type:" + last_vehicle_type + " -> " + vehicle_type);
}
-
} catch (Exception var17) {
return;
}
@@ -193,139 +194,20 @@ public class LnshPackageSiteDeviceDriver extends AbstractOpcDeviceDriver impleme
break;
case 2:
break;
- case 3:
-
- break;
- case 4:
- //申请贴标
- if (!requireSucess && this.move != 0 && barcode != 0) {
- 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);
+ last_ioaction = ioaction;
+ last_error = error;
+ last_vehicle_code = vehicle_code;
+ last_vehicle_type = vehicle_type;
+ last_to_command = to_command;
+ last_to_vehicle_code = to_vehicle_code;
+ last_to_vehicle_type = to_vehicle_type;
}
@@ -337,32 +219,125 @@ public class LnshPackageSiteDeviceDriver extends AbstractOpcDeviceDriver impleme
Map itemMap = new HashMap();
itemMap.put(to_command, command);
ReadUtil.write(itemMap, server);
+ ReadUtil.write(itemMap, server);
+ server.disconnect();
+ logServer.deviceExecuteLog(this.device_code, "", "", "to_command 写入 " + command);
}
- 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;
+ 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 (type == 1) {
- itemMap.put(to_command, command);
- } else if (type == 2) {
- itemMap.put(to_target, command);
+ Map itemMap = new HashMap<>();
+ itemMap.put(to_param, value);
- } else if (type == 3) {
- itemMap.put(to_task, command);
- }
ReadUtil.write(itemMap, server);
-
+ logServer.deviceExecuteLog(this.device_code, "", "", param + " 写入 " + value);
}
public String toString() {
return "";
}
+ @Override
+ public JSONObject getDeviceStatusName() throws Exception {
+ String mode;
+ String move;
+ String action;
+ String io_action;
+ boolean hasGoods;
+
+ switch (this.mode) {
+ case 0:
+ mode = "脱机";
+ break;
+ case 2:
+ mode = "待机";
+ break;
+ case 3:
+ mode = "运行中";
+ break;
+ default:
+ mode = String.valueOf(this.mode);
+ }
+
+ if (this.move == 0) {
+ move = "无货";
+ hasGoods = false;
+ } else {
+ move = "有货";
+ hasGoods = true;
+ }
+
+ switch (this.action) {
+ case 1:
+ action = "允许取货";
+ break;
+ case 2:
+ action = "允许放货";
+ break;
+ case 3:
+ action = "允许取放";
+ break;
+ default:
+ action = "禁止取放";
+ }
+
+ switch (this.ioaction) {
+ case 1:
+ io_action = "允许进入";
+ break;
+ case 2:
+ io_action = "允许离开";
+ break;
+ case 3:
+ io_action = "允许进入离开";
+ break;
+ default:
+ io_action = "禁止进入离开";
+ }
+
+ String error;
+ switch (this.error) {
+ case 1:
+ error = "急停中";
+ break;
+ case 2:
+ error = "光幕报警";
+ break;
+ case 3:
+ error = "本体报警";
+ break;
+ case 4:
+ error = "未排产报警";
+ break;
+ case 5:
+ error = "扫码故障";
+ break;
+ default:
+ error = String.valueOf(this.error);
+ }
+
+ JSONObject jo = new JSONObject();
+ jo.put("device_name", this.getDevice().getDevice_name());
+ jo.put("mode", mode);
+ jo.put("move", move);
+ jo.put("action", action);
+ jo.put("io_action", io_action);
+ jo.put("error", error);
+ jo.put("barcode", vehicle_code);
+ jo.put("container_type", vehicle_type);
+ jo.put("isError", iserror);
+ jo.put("isOnline", isonline);
+ jo.put("hasGoods", hasGoods);
+ jo.put("message", message);
+ return jo;
+ }
+
+ @Override
+ public void setDeviceStatus(JSONObject data) {
+
+ }
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_pallet_storage/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_pallet_storage/ItemProtocol.java
index f99cb9d..031a4dc 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_pallet_storage/ItemProtocol.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_pallet_storage/ItemProtocol.java
@@ -1,6 +1,7 @@
package org.nl.acs.device_driver.lnsh.lnsh_pallet_storage;
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
@@ -8,7 +9,8 @@ import java.util.ArrayList;
import java.util.List;
@Slf4j
-@Data
+@Getter
+@Setter
public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
public static String item_mode = "mode";
@@ -43,10 +45,9 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_status);
}
- public int getOpen_time() {
- return this.getOpcIntegerValue(item_open_time);
+ public String getOpen_time() {
+ return this.getOpcStringValue(item_open_time);
}
-
public int getClose_time() {
return this.getOpcIntegerValue(item_close_time);
}
@@ -102,10 +103,20 @@ public class ItemProtocol {
}
+ public String getOpcStringValue(String protocol) {
+ String value = this.driver.getStringValue(protocol);
+ if (value == null) {
+// log.error("读取错误!");
+ } else {
+ return value;
+ }
+ return "";
+ }
+
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_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"));
@@ -119,7 +130,7 @@ public class ItemProtocol {
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_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/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_pallet_storage/LnshPalletStorageDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_pallet_storage/LnshPalletStorageDefination.java
index 0b1ccf7..74cc6aa 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_pallet_storage/LnshPalletStorageDefination.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_pallet_storage/LnshPalletStorageDefination.java
@@ -56,7 +56,7 @@ public class LnshPalletStorageDefination implements OpcDeviceDriverDefination {
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_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"));
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_pallet_storage/LnshPalletStorageDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_pallet_storage/LnshPalletStorageDeviceDriver.java
index 17c8631..38b1769 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_pallet_storage/LnshPalletStorageDeviceDriver.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_pallet_storage/LnshPalletStorageDeviceDriver.java
@@ -1,6 +1,7 @@
package org.nl.acs.device_driver.lnsh.lnsh_pallet_storage;
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
@@ -27,19 +28,20 @@ import java.util.Map;
* 晟华托盘存储线
*/
@Slf4j
-@Data
+@Getter
+@Setter
@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;
@@ -66,8 +68,8 @@ public class LnshPalletStorageDeviceDriver extends AbstractOpcDeviceDriver imple
int status = 0;
int last_status = 0;
//开机时间
- int open_time = 0;
- int last_open_time = 0;
+ String open_time = "0";
+ String last_open_time = "0";
int close_time = 0;
int last_close_time = 0;
//待机时间
@@ -111,39 +113,39 @@ public class LnshPalletStorageDeviceDriver extends AbstractOpcDeviceDriver imple
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);
+ 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);
+ logServer.deviceExecuteLog(this.device_code,"","","信号status:" + last_status + " -> " + status);
}
- if (open_time != last_open_time) {
+ if (!open_time.equals(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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ logServer.deviceExecuteLog(this.device_code,"","","信号total_container:" + last_total_container + " -> " + total_container);
}
} catch (Exception var17) {
@@ -216,6 +218,7 @@ public class LnshPalletStorageDeviceDriver extends AbstractOpcDeviceDriver imple
public void executing(Server server, Map itemMap) {
ReadUtil.write(itemMap, server);
+ server.disconnect();
}
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/ItemProtocol.java
index 2d724a3..fd44b07 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/ItemProtocol.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/ItemProtocol.java
@@ -2,7 +2,8 @@ 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.Getter;
+import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
@@ -10,7 +11,8 @@ import java.util.ArrayList;
import java.util.List;
@Slf4j
-@Data
+@Getter
+@Setter
public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
@@ -52,10 +54,9 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_error);
}
- public int getOpen_time() {
- return this.getOpcIntegerValue(item_open_time);
+ public String getOpen_time() {
+ return this.getOpcStringValue(item_open_time);
}
-
public int getStandby_time() {
return this.getOpcIntegerValue(item_standby_time);
}
@@ -89,7 +90,7 @@ public class ItemProtocol {
public String getOpcStringValue(String protocol) {
String value = this.driver.getStringValue(protocol);
- if (StrUtil.isEmpty(value)) {
+ if (StrUtil.isBlank(value)) {
// log.error("读取错误!");
} else {
return value;
@@ -100,20 +101,19 @@ public class ItemProtocol {
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_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_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_open_time, "开机时间", "DB1.STRING6.50"));
+ list.add(new ItemDto(item_standby_time, "待机时间", "DB1.D58"));
+ list.add(new ItemDto(item_production_time, "生产时间", "DB1.D62"));
+ list.add(new ItemDto(item_error_time, "故障时间", "DB1.D66"));
return list;
}
public static List getWriteableItemDtos() {
ArrayList list = new ArrayList();
- list.add(new ItemDto(item_to_feedback, "机器人动作反馈", "DB2.B0"));
return list;
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/LnshPalletizingManipulatorDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/LnshPalletizingManipulatorDefination.java
index 65cee44..24d095f 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/LnshPalletizingManipulatorDefination.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/LnshPalletizingManipulatorDefination.java
@@ -58,14 +58,14 @@ public class LnshPalletizingManipulatorDefination implements OpcDeviceDriverDefi
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_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_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_open_time, "开机时间", "DB1.STRING6.50"));
+ list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "DB1.D58"));
+ list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "DB1.D62"));
+ list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "DB1.D66"));
return list;
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/LnshPalletizingManipulatorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/LnshPalletizingManipulatorDeviceDriver.java
index 90d4779..5ea24a8 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/LnshPalletizingManipulatorDeviceDriver.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/LnshPalletizingManipulatorDeviceDriver.java
@@ -1,8 +1,10 @@
package org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator;
+import cn.hutool.core.util.ObjectUtil;
import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSONObject;
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
@@ -32,21 +34,22 @@ import java.util.Map;
* 晟华码垛机械手
*/
@Slf4j
-@Data
+@Getter
+@Setter
@RequiredArgsConstructor
public class LnshPalletizingManipulatorDeviceDriver 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");
int mode = 0;
@@ -83,8 +86,8 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
int status = 0;
int last_status = 0;
//开机时间
- int open_time = 0;
- int last_open_time = 0;
+ String open_time = "0";
+ String last_open_time = "0";
//待机时间
int standby_time = 0;
int last_standby_time = 0;
@@ -118,35 +121,35 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
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);
+ 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);
+ 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);
+ 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);
+ logServer.deviceExecuteLog(this.device_code,"","","信号error:" + last_error + " -> " + error);
}
- if (open_time != last_open_time) {
+ if (!open_time.equals(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);
+ 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);
+ 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);
+ 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);
+ logServer.deviceExecuteLog(this.device_code,"","","信号error_time:" + last_error_time + " -> " + error_time);
}
} catch (Exception var17) {
@@ -203,17 +206,7 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
// break;
}
- switch (flag) {
- //取货完成
- case 1:
- writing(2);
- return;
- //放货完成
- case 2:
- writing(3);
- return;
-
- }
+
}
last_mode = mode;
@@ -241,7 +234,7 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
this.instruction_require_time = date;
JSONObject json = new JSONObject();
json.put("device_code",this.device_code);
- JSONObject jo = acsToWmsService.getVehicle(json);
+ JSONObject jo = new JSONObject();
if (jo.getInteger("status") == 200) {
JSONObject content = jo.getJSONObject("content");
@@ -391,9 +384,11 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
json.put("is_full","1");
HttpResponse result = acsToWmsService.applyTaskManipulatorToWms(json);
- if (result.getStatus() == 200) {
- this.writing(this.mode);
- requireSucess = true;
+ if (ObjectUtil.isNotEmpty(result)) {
+ if (result.getStatus() == 200) {
+ this.writing(this.mode);
+ requireSucess = true;
+ }
}
return true;
}
@@ -416,10 +411,11 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
json.put("is_full","0");
HttpResponse result = acsToWmsService.applyTaskManipulatorToWms(json);
- if (result.getStatus() == 200) {
- this.writing(this.mode);
- requireSucess = true;
-
+ if (ObjectUtil.isNotEmpty(result)) {
+ if (result.getStatus() == 200) {
+ this.writing(this.mode);
+ requireSucess = true;
+ }
}
return true;
}
@@ -441,9 +437,11 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
json.put("device_code",device_code);
json.put("type","4");
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
- if (result.getStatus() == 200) {
- this.writing(this.mode);
- requireSucess = true;
+ if (ObjectUtil.isNotEmpty(result)) {
+ if (result.getStatus() == 200) {
+ this.writing(this.mode);
+ requireSucess = true;
+ }
}
return true;
@@ -472,63 +470,113 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
Map itemMap = new HashMap();
itemMap.put(to_param, value);
-// itemMap.put(to_param, Integer.parseInt(value));
+// itemMap.put(to_param, value);
ReadUtil.write(itemMap, server);
+ server.disconnect();
+ logServer.deviceExecuteLog(this.device_code, "", "", param + " 写入 " + value);
}
public void executing(Server server, Map itemMap) {
ReadUtil.write(itemMap, server);
+ server.disconnect();
}
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_mixing_mill.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);
-
+ ReadUtil.write(itemMap, server);
+ server.disconnect();
+ logServer.deviceExecuteLog(this.device_code, "", "", "to_command 写入 " + command);
}
@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 = "联机";
+ String mode;
+ String status;
+ String action;
+ switch (this.mode) {
+ case 0:
+ mode = "脱机";
+ break;
+ case 2:
+ mode = "待机";
+ break;
+ case 3:
+ mode = "运行中";
+ break;
+ default:
+ mode = String.valueOf(this.mode);
}
- if (this.getAction() == 0) {
- action = "禁止取放";
- } else if (this.getAction() == 1) {
- action = "允许取货";
- } else if (this.getAction() == 2) {
- action = "允许放货";
- } else if (this.getAction() == 3) {
- action = "允许取放";
+ switch (this.status) {
+ case 1:
+ status = "待机";
+ break;
+ case 2:
+ status = "生产中";
+ break;
+ case 3:
+ status = "故障";
+ break;
+ default:
+ status = String.valueOf(this.status);
+ }
+
+ switch (this.action) {
+ case 1:
+ action = "允许取货";
+ break;
+ case 2:
+ action = "允许放货";
+ break;
+ case 3:
+ action = "允许取放";
+ break;
+ default:
+ action = "禁止取放";
+ }
+
+ String error;
+ switch (this.error) {
+ case 1:
+ error = "急停中";
+ break;
+ case 2:
+ error = "光幕报警";
+ break;
+ case 3:
+ error = "本体报警";
+ break;
+ case 4:
+ error = "未排产报警";
+ break;
+ case 5:
+ error = "扫码故障";
+ break;
+ default:
+ error = String.valueOf(this.error);
}
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("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("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("action", action);
+ jo.put("error", error);
+ jo.put("open_time", open_time);
+ jo.put("standby_time", standby_time);
+ jo.put("production_time", production_time);
+ jo.put("error_time", error_time);
+ jo.put("message", message);
+ jo.put("isError", iserror);
+ jo.put("isOnline", isonline);
return jo;
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/ItemProtocol.java
index 24cdaec..ea72af4 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/ItemProtocol.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/ItemProtocol.java
@@ -1,7 +1,8 @@
package org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator_site;
import cn.hutool.core.util.StrUtil;
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
@@ -9,7 +10,8 @@ import java.util.ArrayList;
import java.util.List;
@Slf4j
-@Data
+@Getter
+@Setter
public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
@@ -659,7 +661,7 @@ public class ItemProtocol {
}
public String getOpcStringValue(String protocol) {
String value = this.driver.getStringValue(protocol);
- if (StrUtil.isEmpty(value)) {
+ if (StrUtil.isBlank(value)) {
} else {
return value;
@@ -670,7 +672,7 @@ public class ItemProtocol {
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_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"));
@@ -678,64 +680,64 @@ public class ItemProtocol {
list.add(new ItemDto(item_task, "任务号", "DB3.D6"));
list.add(new ItemDto(item_weight, "重量", "DB3.D10"));
list.add(new ItemDto(item_material, "物料", "DB3.STRING14.50"));
- list.add(new ItemDto(item_barcode, "条码", "DB3.STRING64.50"));
- list.add(new ItemDto(item_encoder_qty, "码盘位当前码盘数量", "DB3.W114"));
- list.add(new ItemDto(item_unqualified_qty, "不合格数量", "DB3.W116"));
+ list.add(new ItemDto(item_barcode, "条码", "DB3.W66"));
+ list.add(new ItemDto(item_encoder_qty, "码盘位当前码盘数量", "DB3.W68"));
+ list.add(new ItemDto(item_unqualified_qty, "不合格数量", "DB3.W70"));
- list.add(new ItemDto(item_product_code, "产品编号", "DB3.W118"));
- list.add(new ItemDto(item_AlongSide, "A长边", "DB3.W120"));
- list.add(new ItemDto(item_BshortSide, "B短边", "DB3.W122"));
- list.add(new ItemDto(item_Htrapezoidal, "H梯形高", "DB3.W124"));
- list.add(new ItemDto(item_Wthickness, "W厚度", "DB3.W126"));
- list.add(new ItemDto(item_tray_qty, "当前垛盘数", "DB3.W128"));
- list.add(new ItemDto(item_tray_high, "垛盘高度", "DB3.W130"));
- list.add(new ItemDto(item_crib_category, "垛型类别", "DB3.W132"));
- list.add(new ItemDto(item_palletX1_line, "码垛X1行", "DB3.W134"));
- list.add(new ItemDto(item_palletY1_row, "码垛Y1列", "DB3.W136"));
- list.add(new ItemDto(item_palletA1_angle, "码垛A1角度", "DB3.W138"));
- list.add(new ItemDto(item_palletX2_line, "码垛X2行", "DB3.W140"));
- list.add(new ItemDto(item_palletY2_row, "码垛Y2列", "DB3.W142"));
- list.add(new ItemDto(item_palletA2_angle, "码垛A2角度", "DB3.W144"));
- list.add(new ItemDto(item_palletX3_line, "码垛X3行", "DB3.W146"));
- list.add(new ItemDto(item_palletY3_row, "码垛Y3列", "DB3.W148"));
- list.add(new ItemDto(item_palletA3_angle, "码垛A3角度", "DB3.W150"));
- list.add(new ItemDto(item_pressCribX1_line, "压垛X1行", "DB3.W152"));
- list.add(new ItemDto(item_pressCribY1_row, "压垛Y1列", "DB3.W154"));
- list.add(new ItemDto(item_pressCribA1_angle, "压垛A1角度", "DB3.W156"));
- list.add(new ItemDto(item_pressCribX2_line, "压垛X2行", "DB3.W158"));
- list.add(new ItemDto(item_pressCribY2_row, "压垛Y2列", "DB3.W160"));
- list.add(new ItemDto(item_pressCribA2_angle, "压垛A2角度", "DB3.W162"));
- list.add(new ItemDto(item_pressCribX3_line, "压垛X3行", "DB3.W164"));
- list.add(new ItemDto(item_pressCribY3_row, "压垛Y3列", "DB3.W166"));
- list.add(new ItemDto(item_pressCribA3_angle, "压垛A3角度", "DB3.W168"));
- list.add(new ItemDto(item_Zoffset, "Z轴偏移", "DB3.W170"));
- list.add(new ItemDto(item_pallet_layerQty, "码垛层数", "DB3.W172"));
- list.add(new ItemDto(item_pressCrib_layerQty, "压垛层数", "DB3.W174"));
- list.add(new ItemDto(item_codeLayerX1_interval, "码层X1间隔", "DB3.W176"));
- list.add(new ItemDto(item_codeLayerY1_interval, "码层Y1间隔", "DB3.W178"));
- list.add(new ItemDto(item_codeLayerX2_interval, "码层X2间隔", "DB3.W180"));
- list.add(new ItemDto(item_codeLayerY2_interval, "码层Y2间隔", "DB3.W182"));
- list.add(new ItemDto(item_codeLayerX3_interval, "码层X3间隔", "DB3.W184"));
- list.add(new ItemDto(item_codeLayerY3_interval, "码层Y3间隔", "DB3.W186"));
- list.add(new ItemDto(item_codeLayerX1_offset, "码层X1偏移", "DB3.W188"));
- list.add(new ItemDto(item_codeLayerY1_offset, "码层Y1偏移", "DB3.W190"));
- list.add(new ItemDto(item_codeLayerX2_offset, "码层X2偏移", "DB3.W192"));
- list.add(new ItemDto(item_codeLayerY2_offset, "码层Y2偏移", "DB3.W194"));
- list.add(new ItemDto(item_codeLayerX3_offset, "码层X3偏移", "DB3.W196"));
- list.add(new ItemDto(item_codeLayerY3_offset, "码层Y3偏移", "DB3.W198"));
- list.add(new ItemDto(item_pressLayerX1_interval, "压层X1间隔", "DB3.W200"));
- list.add(new ItemDto(item_pressLayerY1_interval, "压层Y1间隔", "DB3.W202"));
- list.add(new ItemDto(item_pressLayerX2_interval, "压层X2间隔", "DB3.W204"));
- list.add(new ItemDto(item_pressLayerY2_interval, "压层Y2间隔", "DB3.W206"));
- list.add(new ItemDto(item_pressLayerX3_interval, "压层X3间隔", "DB3.W208"));
- list.add(new ItemDto(item_pressLayerY3_interval, "压层Y3间隔", "DB3.W210"));
- list.add(new ItemDto(item_pressLayerX1_offset, "压层X1偏移", "DB3.W212"));
- list.add(new ItemDto(item_pressLayerY1_offset, "压层Y1偏移", "DB3.W214"));
- list.add(new ItemDto(item_pressLayerX2_offset, "压层X2偏移", "DB3.W216"));
- list.add(new ItemDto(item_pressLayerY2_offset, "压层Y2偏移", "DB3.W218"));
- list.add(new ItemDto(item_pressLayerX3_offset, "压层X3偏移", "DB3.W220"));
- list.add(new ItemDto(item_pressLayerY3_offset, "压层Y3偏移", "DB3.W222"));
- list.add(new ItemDto(item_tool_coordinate, "工具坐标", "DB3.W224"));
+ list.add(new ItemDto(item_product_code, "产品编号", "DB3.W72"));
+ list.add(new ItemDto(item_AlongSide, "A长边", "DB3.W74"));
+ list.add(new ItemDto(item_BshortSide, "B短边", "DB3.W76"));
+ list.add(new ItemDto(item_Htrapezoidal, "H梯形高", "DB3.W78"));
+ list.add(new ItemDto(item_Wthickness, "W厚度", "DB3.W80"));
+ list.add(new ItemDto(item_tray_qty, "当前垛盘数", "DB3.W82"));
+ list.add(new ItemDto(item_tray_high, "垛盘高度", "DB3.W84"));
+ list.add(new ItemDto(item_crib_category, "垛型类别", "DB3.W86"));
+ list.add(new ItemDto(item_palletX1_line, "码垛X1行", "DB3.W88"));
+ list.add(new ItemDto(item_palletY1_row, "码垛Y1列", "DB3.W90"));
+ list.add(new ItemDto(item_palletA1_angle, "码垛A1角度", "DB3.W92"));
+ list.add(new ItemDto(item_palletX2_line, "码垛X2行", "DB3.W94"));
+ list.add(new ItemDto(item_palletY2_row, "码垛Y2列", "DB3.W96"));
+ list.add(new ItemDto(item_palletA2_angle, "码垛A2角度", "DB3.W98"));
+ list.add(new ItemDto(item_palletX3_line, "码垛X3行", "DB3.W100"));
+ list.add(new ItemDto(item_palletY3_row, "码垛Y3列", "DB3.W102"));
+ list.add(new ItemDto(item_palletA3_angle, "码垛A3角度", "DB3.W104"));
+ list.add(new ItemDto(item_pressCribX1_line, "压垛X1行", "DB3.W106"));
+ list.add(new ItemDto(item_pressCribY1_row, "压垛Y1列", "DB3.W108"));
+ list.add(new ItemDto(item_pressCribA1_angle, "压垛A1角度", "DB3.W110"));
+ list.add(new ItemDto(item_pressCribX2_line, "压垛X2行", "DB3.W112"));
+ list.add(new ItemDto(item_pressCribY2_row, "压垛Y2列", "DB3.W114"));
+ list.add(new ItemDto(item_pressCribA2_angle, "压垛A2角度", "DB3.W116"));
+ list.add(new ItemDto(item_pressCribX3_line, "压垛X3行", "DB3.W118"));
+ list.add(new ItemDto(item_pressCribY3_row, "压垛Y3列", "DB3.W120"));
+ list.add(new ItemDto(item_pressCribA3_angle, "压垛A3角度", "DB3.W122"));
+ list.add(new ItemDto(item_Zoffset, "Z轴偏移", "DB3.W124"));
+ list.add(new ItemDto(item_pallet_layerQty, "码垛层数", "DB3.W126"));
+ list.add(new ItemDto(item_pressCrib_layerQty, "压垛层数", "DB3.W128"));
+ list.add(new ItemDto(item_codeLayerX1_interval, "码层X1间隔", "DB3.W130"));
+ list.add(new ItemDto(item_codeLayerY1_interval, "码层Y1间隔", "DB3.W132"));
+ list.add(new ItemDto(item_codeLayerX2_interval, "码层X2间隔", "DB3.W134"));
+ list.add(new ItemDto(item_codeLayerY2_interval, "码层Y2间隔", "DB3.W136"));
+ list.add(new ItemDto(item_codeLayerX3_interval, "码层X3间隔", "DB3.W138"));
+ list.add(new ItemDto(item_codeLayerY3_interval, "码层Y3间隔", "DB3.W140"));
+ list.add(new ItemDto(item_codeLayerX1_offset, "码层X1偏移", "DB3.W142"));
+ list.add(new ItemDto(item_codeLayerY1_offset, "码层Y1偏移", "DB3.W144"));
+ list.add(new ItemDto(item_codeLayerX2_offset, "码层X2偏移", "DB3.W146"));
+ list.add(new ItemDto(item_codeLayerY2_offset, "码层Y2偏移", "DB3.W148"));
+ list.add(new ItemDto(item_codeLayerX3_offset, "码层X3偏移", "DB3.W150"));
+ list.add(new ItemDto(item_codeLayerY3_offset, "码层Y3偏移", "DB3.W152"));
+ list.add(new ItemDto(item_pressLayerX1_interval, "压层X1间隔", "DB3.W154"));
+ list.add(new ItemDto(item_pressLayerY1_interval, "压层Y1间隔", "DB3.W156"));
+ list.add(new ItemDto(item_pressLayerX2_interval, "压层X2间隔", "DB3.W158"));
+ list.add(new ItemDto(item_pressLayerY2_interval, "压层Y2间隔", "DB3.W160"));
+ list.add(new ItemDto(item_pressLayerX3_interval, "压层X3间隔", "DB3.W162"));
+ list.add(new ItemDto(item_pressLayerY3_interval, "压层Y3间隔", "DB3.W164"));
+ list.add(new ItemDto(item_pressLayerX1_offset, "压层X1偏移", "DB3.W166"));
+ list.add(new ItemDto(item_pressLayerY1_offset, "压层Y1偏移", "DB3.W168"));
+ list.add(new ItemDto(item_pressLayerX2_offset, "压层X2偏移", "DB3.W170"));
+ list.add(new ItemDto(item_pressLayerY2_offset, "压层Y2偏移", "DB3.W172"));
+ list.add(new ItemDto(item_pressLayerX3_offset, "压层X3偏移", "DB3.W174"));
+ list.add(new ItemDto(item_pressLayerY3_offset, "压层Y3偏移", "DB3.W176"));
+ list.add(new ItemDto(item_tool_coordinate, "工具坐标", "DB3.W178"));
return list;
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/LnshPalletizingManipulatorSiteDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/LnshPalletizingManipulatorSiteDefination.java
index c62a6d8..448dad3 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/LnshPalletizingManipulatorSiteDefination.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/LnshPalletizingManipulatorSiteDefination.java
@@ -56,9 +56,9 @@ public class LnshPalletizingManipulatorSiteDefination implements OpcDeviceDriver
}
public static List getReadableItemDtos2() {
- List list = new ArrayList();
+ ArrayList 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_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"));
@@ -66,64 +66,64 @@ public class LnshPalletizingManipulatorSiteDefination implements OpcDeviceDriver
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.STRING14.50"));
- list.add(new ItemDto(ItemProtocol.item_barcode, "条码", "DB3.STRING64.50"));
- list.add(new ItemDto(ItemProtocol.item_encoder_qty, "码盘位当前码盘数量", "DB3.W114"));
- list.add(new ItemDto(ItemProtocol.item_unqualified_qty, "不合格数量", "DB3.W116"));
+ list.add(new ItemDto(ItemProtocol.item_barcode, "条码", "DB3.W66"));
+ list.add(new ItemDto(ItemProtocol.item_encoder_qty, "码盘位当前码盘数量", "DB3.W68"));
+ list.add(new ItemDto(ItemProtocol.item_unqualified_qty, "不合格数量", "DB3.W70"));
- list.add(new ItemDto(ItemProtocol.item_product_code, "产品编号", "DB3.W118"));
- list.add(new ItemDto(ItemProtocol.item_AlongSide, "A长边", "DB3.W120"));
- list.add(new ItemDto(ItemProtocol.item_BshortSide, "B短边", "DB3.W122"));
- list.add(new ItemDto(ItemProtocol.item_Htrapezoidal, "H梯形高", "DB3.W124"));
- list.add(new ItemDto(ItemProtocol.item_Wthickness, "W厚度", "DB3.W126"));
- list.add(new ItemDto(ItemProtocol.item_tray_qty, "当前垛盘数", "DB3.W128"));
- list.add(new ItemDto(ItemProtocol.item_tray_high, "垛盘高度", "DB3.W130"));
- list.add(new ItemDto(ItemProtocol.item_crib_category, "垛型类别", "DB3.W132"));
- list.add(new ItemDto(ItemProtocol.item_palletX1_line, "码垛X1行", "DB3.W134"));
- list.add(new ItemDto(ItemProtocol.item_palletY1_row, "码垛Y1列", "DB3.W136"));
- list.add(new ItemDto(ItemProtocol.item_palletA1_angle, "码垛A1角度", "DB3.W138"));
- list.add(new ItemDto(ItemProtocol.item_palletX2_line, "码垛X2行", "DB3.W140"));
- list.add(new ItemDto(ItemProtocol.item_palletY2_row, "码垛Y2列", "DB3.W142"));
- list.add(new ItemDto(ItemProtocol.item_palletA2_angle, "码垛A2角度", "DB3.W144"));
- list.add(new ItemDto(ItemProtocol.item_palletX3_line, "码垛X3行", "DB3.W146"));
- list.add(new ItemDto(ItemProtocol.item_palletY3_row, "码垛Y3列", "DB3.W148"));
- list.add(new ItemDto(ItemProtocol.item_palletA3_angle, "码垛A3角度", "DB3.W150"));
- list.add(new ItemDto(ItemProtocol.item_pressCribX1_line, "压垛X1行", "DB3.W152"));
- list.add(new ItemDto(ItemProtocol.item_pressCribY1_row, "压垛Y1列", "DB3.W154"));
- list.add(new ItemDto(ItemProtocol.item_pressCribA1_angle, "压垛A1角度", "DB3.W156"));
- list.add(new ItemDto(ItemProtocol.item_pressCribX2_line, "压垛X2行", "DB3.W158"));
- list.add(new ItemDto(ItemProtocol.item_pressCribY2_row, "压垛Y2列", "DB3.W160"));
- list.add(new ItemDto(ItemProtocol.item_pressCribA2_angle, "压垛A2角度", "DB3.W162"));
- list.add(new ItemDto(ItemProtocol.item_pressCribX3_line, "压垛X3行", "DB3.W164"));
- list.add(new ItemDto(ItemProtocol.item_pressCribY3_row, "压垛Y3列", "DB3.W166"));
- list.add(new ItemDto(ItemProtocol.item_pressCribA3_angle, "压垛A3角度", "DB3.W168"));
- list.add(new ItemDto(ItemProtocol.item_Zoffset, "Z轴偏移", "DB3.W170"));
- list.add(new ItemDto(ItemProtocol.item_pallet_layerQty, "码垛层数", "DB3.W172"));
- list.add(new ItemDto(ItemProtocol.item_pressCrib_layerQty, "压垛层数", "DB3.W174"));
- list.add(new ItemDto(ItemProtocol.item_codeLayerX1_interval, "码层X1间隔", "DB3.W176"));
- list.add(new ItemDto(ItemProtocol.item_codeLayerY1_interval, "码层Y1间隔", "DB3.W178"));
- list.add(new ItemDto(ItemProtocol.item_codeLayerX2_interval, "码层X2间隔", "DB3.W180"));
- list.add(new ItemDto(ItemProtocol.item_codeLayerY2_interval, "码层Y2间隔", "DB3.W182"));
- list.add(new ItemDto(ItemProtocol.item_codeLayerX3_interval, "码层X3间隔", "DB3.W184"));
- list.add(new ItemDto(ItemProtocol.item_codeLayerY3_interval, "码层Y3间隔", "DB3.W186"));
- list.add(new ItemDto(ItemProtocol.item_codeLayerX1_offset, "码层X1偏移", "DB3.W188"));
- list.add(new ItemDto(ItemProtocol.item_codeLayerY1_offset, "码层Y1偏移", "DB3.W190"));
- list.add(new ItemDto(ItemProtocol.item_codeLayerX2_offset, "码层X2偏移", "DB3.W192"));
- list.add(new ItemDto(ItemProtocol.item_codeLayerY2_offset, "码层Y2偏移", "DB3.W194"));
- list.add(new ItemDto(ItemProtocol.item_codeLayerX3_offset, "码层X3偏移", "DB3.W196"));
- list.add(new ItemDto(ItemProtocol.item_codeLayerY3_offset, "码层Y3偏移", "DB3.W198"));
- list.add(new ItemDto(ItemProtocol.item_pressLayerX1_interval, "压层X1间隔", "DB3.W200"));
- list.add(new ItemDto(ItemProtocol.item_pressLayerY1_interval, "压层Y1间隔", "DB3.W202"));
- list.add(new ItemDto(ItemProtocol.item_pressLayerX2_interval, "压层X2间隔", "DB3.W204"));
- list.add(new ItemDto(ItemProtocol.item_pressLayerY2_interval, "压层Y2间隔", "DB3.W206"));
- list.add(new ItemDto(ItemProtocol.item_pressLayerX3_interval, "压层X3间隔", "DB3.W208"));
- list.add(new ItemDto(ItemProtocol.item_pressLayerY3_interval, "压层Y3间隔", "DB3.W210"));
- list.add(new ItemDto(ItemProtocol.item_pressLayerX1_offset, "压层X1偏移", "DB3.W212"));
- list.add(new ItemDto(ItemProtocol.item_pressLayerY1_offset, "压层Y1偏移", "DB3.W214"));
- list.add(new ItemDto(ItemProtocol.item_pressLayerX2_offset, "压层X2偏移", "DB3.W216"));
- list.add(new ItemDto(ItemProtocol.item_pressLayerY2_offset, "压层Y2偏移", "DB3.W218"));
- list.add(new ItemDto(ItemProtocol.item_pressLayerX3_offset, "压层X3偏移", "DB3.W220"));
- list.add(new ItemDto(ItemProtocol.item_pressLayerY3_offset, "压层Y3偏移", "DB3.W222"));
- list.add(new ItemDto(ItemProtocol.item_tool_coordinate, "工具坐标", "DB3.W224"));
+ list.add(new ItemDto(ItemProtocol.item_product_code, "产品编号", "DB3.W72"));
+ list.add(new ItemDto(ItemProtocol.item_AlongSide, "A长边", "DB3.W74"));
+ list.add(new ItemDto(ItemProtocol.item_BshortSide, "B短边", "DB3.W76"));
+ list.add(new ItemDto(ItemProtocol.item_Htrapezoidal, "H梯形高", "DB3.W78"));
+ list.add(new ItemDto(ItemProtocol.item_Wthickness, "W厚度", "DB3.W80"));
+ list.add(new ItemDto(ItemProtocol.item_tray_qty, "当前垛盘数", "DB3.W82"));
+ list.add(new ItemDto(ItemProtocol.item_tray_high, "垛盘高度", "DB3.W84"));
+ list.add(new ItemDto(ItemProtocol.item_crib_category, "垛型类别", "DB3.W86"));
+ list.add(new ItemDto(ItemProtocol.item_palletX1_line, "码垛X1行", "DB3.W88"));
+ list.add(new ItemDto(ItemProtocol.item_palletY1_row, "码垛Y1列", "DB3.W90"));
+ list.add(new ItemDto(ItemProtocol.item_palletA1_angle, "码垛A1角度", "DB3.W92"));
+ list.add(new ItemDto(ItemProtocol.item_palletX2_line, "码垛X2行", "DB3.W94"));
+ list.add(new ItemDto(ItemProtocol.item_palletY2_row, "码垛Y2列", "DB3.W96"));
+ list.add(new ItemDto(ItemProtocol.item_palletA2_angle, "码垛A2角度", "DB3.W98"));
+ list.add(new ItemDto(ItemProtocol.item_palletX3_line, "码垛X3行", "DB3.W100"));
+ list.add(new ItemDto(ItemProtocol.item_palletY3_row, "码垛Y3列", "DB3.W102"));
+ list.add(new ItemDto(ItemProtocol.item_palletA3_angle, "码垛A3角度", "DB3.W104"));
+ list.add(new ItemDto(ItemProtocol.item_pressCribX1_line, "压垛X1行", "DB3.W106"));
+ list.add(new ItemDto(ItemProtocol.item_pressCribY1_row, "压垛Y1列", "DB3.W108"));
+ list.add(new ItemDto(ItemProtocol.item_pressCribA1_angle, "压垛A1角度", "DB3.W110"));
+ list.add(new ItemDto(ItemProtocol.item_pressCribX2_line, "压垛X2行", "DB3.W112"));
+ list.add(new ItemDto(ItemProtocol.item_pressCribY2_row, "压垛Y2列", "DB3.W114"));
+ list.add(new ItemDto(ItemProtocol.item_pressCribA2_angle, "压垛A2角度", "DB3.W116"));
+ list.add(new ItemDto(ItemProtocol.item_pressCribX3_line, "压垛X3行", "DB3.W118"));
+ list.add(new ItemDto(ItemProtocol.item_pressCribY3_row, "压垛Y3列", "DB3.W120"));
+ list.add(new ItemDto(ItemProtocol.item_pressCribA3_angle, "压垛A3角度", "DB3.W122"));
+ list.add(new ItemDto(ItemProtocol.item_Zoffset, "Z轴偏移", "DB3.W124"));
+ list.add(new ItemDto(ItemProtocol.item_pallet_layerQty, "码垛层数", "DB3.W126"));
+ list.add(new ItemDto(ItemProtocol.item_pressCrib_layerQty, "压垛层数", "DB3.W128"));
+ list.add(new ItemDto(ItemProtocol.item_codeLayerX1_interval, "码层X1间隔", "DB3.W130"));
+ list.add(new ItemDto(ItemProtocol.item_codeLayerY1_interval, "码层Y1间隔", "DB3.W132"));
+ list.add(new ItemDto(ItemProtocol.item_codeLayerX2_interval, "码层X2间隔", "DB3.W134"));
+ list.add(new ItemDto(ItemProtocol.item_codeLayerY2_interval, "码层Y2间隔", "DB3.W136"));
+ list.add(new ItemDto(ItemProtocol.item_codeLayerX3_interval, "码层X3间隔", "DB3.W138"));
+ list.add(new ItemDto(ItemProtocol.item_codeLayerY3_interval, "码层Y3间隔", "DB3.W140"));
+ list.add(new ItemDto(ItemProtocol.item_codeLayerX1_offset, "码层X1偏移", "DB3.W142"));
+ list.add(new ItemDto(ItemProtocol.item_codeLayerY1_offset, "码层Y1偏移", "DB3.W144"));
+ list.add(new ItemDto(ItemProtocol.item_codeLayerX2_offset, "码层X2偏移", "DB3.W146"));
+ list.add(new ItemDto(ItemProtocol.item_codeLayerY2_offset, "码层Y2偏移", "DB3.W148"));
+ list.add(new ItemDto(ItemProtocol.item_codeLayerX3_offset, "码层X3偏移", "DB3.W150"));
+ list.add(new ItemDto(ItemProtocol.item_codeLayerY3_offset, "码层Y3偏移", "DB3.W152"));
+ list.add(new ItemDto(ItemProtocol.item_pressLayerX1_interval, "压层X1间隔", "DB3.W154"));
+ list.add(new ItemDto(ItemProtocol.item_pressLayerY1_interval, "压层Y1间隔", "DB3.W156"));
+ list.add(new ItemDto(ItemProtocol.item_pressLayerX2_interval, "压层X2间隔", "DB3.W158"));
+ list.add(new ItemDto(ItemProtocol.item_pressLayerY2_interval, "压层Y2间隔", "DB3.W160"));
+ list.add(new ItemDto(ItemProtocol.item_pressLayerX3_interval, "压层X3间隔", "DB3.W162"));
+ list.add(new ItemDto(ItemProtocol.item_pressLayerY3_interval, "压层Y3间隔", "DB3.W164"));
+ list.add(new ItemDto(ItemProtocol.item_pressLayerX1_offset, "压层X1偏移", "DB3.W166"));
+ list.add(new ItemDto(ItemProtocol.item_pressLayerY1_offset, "压层Y1偏移", "DB3.W168"));
+ list.add(new ItemDto(ItemProtocol.item_pressLayerX2_offset, "压层X2偏移", "DB3.W170"));
+ list.add(new ItemDto(ItemProtocol.item_pressLayerY2_offset, "压层Y2偏移", "DB3.W172"));
+ list.add(new ItemDto(ItemProtocol.item_pressLayerX3_offset, "压层X3偏移", "DB3.W174"));
+ list.add(new ItemDto(ItemProtocol.item_pressLayerY3_offset, "压层Y3偏移", "DB3.W176"));
+ list.add(new ItemDto(ItemProtocol.item_tool_coordinate, "工具坐标", "DB3.W178"));
return list;
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/LnshPalletizingManipulatorSiteDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/LnshPalletizingManipulatorSiteDeviceDriver.java
index a1b25d5..99df0e4 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/LnshPalletizingManipulatorSiteDeviceDriver.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/LnshPalletizingManipulatorSiteDeviceDriver.java
@@ -4,7 +4,8 @@ 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.Getter;
+import lombok.Setter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
@@ -19,12 +20,16 @@ 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.ItemValue;
import org.nl.acs.order.service.ProduceshiftorderService;
import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService;
+import org.nl.modules.lucene.service.dto.LuceneLogDto;
+import org.nl.modules.lucene.service.impl.LuceneExecuteLogServiceImpl;
import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
import java.util.Date;
import java.util.HashMap;
@@ -35,25 +40,30 @@ import java.util.Map;
* 晟华-码垛机械手工位
*/
@Slf4j
-@Data
+@Getter
+@Setter
@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");
+ LuceneExecuteLogServiceImpl lucene = SpringContextHolder.getBean("luceneExecuteLogServiceImpl");
+
String device_code;
int mode = 0;
int error = 0;
@@ -307,267 +317,268 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
pressLayerX3_offset = this.itemProtocol.getPressLayerX3_offset();
pressLayerY3_offset = this.itemProtocol.getPressLayerY3_offset();
tool_coordinate = this.itemProtocol.getTool_coordinate();
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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(material, last_material)) {
+ logServer.deviceItemValue(this.device_code, "material", material);
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号material:" + last_material + " -> " + material);
}
if (barcode != last_barcode) {
- logServer.deviceItemValue(this.device_code,"barcode", String.valueOf(barcode));
- logServer.deviceExecuteLog(this.device_code,"","","信号barcode:" + last_barcode + "->" + barcode);
+ logServer.deviceItemValue(this.device_code, "barcode", String.valueOf(barcode));
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号barcode:" + last_barcode + " -> " + barcode);
}
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);
+ 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);
+ 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);
+ 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);
+ 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);
+ logServer.deviceItemValue(this.device_code, "Wthickness", String.valueOf(Wthickness));
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号Wthickness: " + last_Wthickness + " -> " + Wthickness);
}
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);
+ logServer.deviceItemValue(this.device_code, "encoder_qty", String.valueOf(encoder_qty));
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号encoder_qty:" + last_encoder_qty + " -> " + encoder_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);
+ logServer.deviceItemValue(this.device_code, "unqualified_qty", String.valueOf(unqualified_qty));
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号unqualified_qty:" + last_unqualified_qty + " -> " + unqualified_qty);
}
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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ logServer.deviceItemValue(this.device_code, "pressLayerY3_offset", String.valueOf(pressLayerY3_offset));
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号pressLayerY3_offset:" + last_pressLayerY3_offset + " -> " + pressLayerY3_offset);
}
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);
+ 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) {
@@ -606,18 +617,21 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
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();
+ sendEmpty();
}
break;
case 7:
@@ -638,18 +652,29 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
getVehicle();
}
break;
+ case 11:
+ // 强制去包装(打包)
+ if (!requireSucess && this.move != 0) {
+ this.toPackage(true);
+ }
+ break;
+ case 14:
+ // 强制去包装(不打包)
+ if (!requireSucess && this.move != 0) {
+ this.toPackage(false);
+ }
}
- switch (flag) {
- //取货完成
- case 2:
- writing(2);
- return;
- //放货完成
- case 4:
- writing(3);
- return;
- }
+// switch (flag) {
+// //取货完成
+// case 2:
+// writing(2);
+// return;
+// //放货完成
+// case 4:
+// writing(3);
+// return;
+// }
}
last_mode = mode;
@@ -734,15 +759,17 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
} 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);
+ 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);
+ if (result.getStatus() == HttpStatus.OK.value()) {
+ JSONObject jsonObject = JSONObject.parseObject(result.body());
+ if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
+ this.writing(this.mode);
+ this.setRequireSucess(true);
+ }
}
}
return true;
@@ -762,70 +789,75 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
} else {
this.instruction_require_time = date;
JSONObject json = new JSONObject();
- json.put("device_code",device_code);
- 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("tool_coordinate",tool_coordinate);
+ json.put("type", "1");
+ json.put("device_code", device_code);
+ json.put("qty", encoder_qty);
+ json.put("weight", weight);
+ json.put("vehicle_code", barcode);
+ json.put("is_full", "1");
+ json.put("is_package", "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("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);
+ if (result.getStatus() == HttpStatus.OK.value()) {
+ JSONObject jsonObject = JSONObject.parseObject(result.body());
+ if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
+ this.writing(this.mode);
+ this.setRequireSucess(true);
+ }
}
}
return true;
@@ -845,70 +877,75 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
} else {
this.instruction_require_time = date;
JSONObject json = new JSONObject();
- 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("tool_coordinate",tool_coordinate);
-
+ json.put("type", "1");
+ json.put("device_code", device_code);
+ json.put("qty", encoder_qty);
+ json.put("weight", weight);
+ json.put("vehicle_code", barcode);
+ json.put("is_full", "0");
+ json.put("is_package", "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("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);
+ if (result.getStatus() == HttpStatus.OK.value()) {
+ JSONObject jsonObject = JSONObject.parseObject(result.body());
+ if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
+ this.writing(this.mode);
+ this.setRequireSucess(true);
+ }
}
}
return true;
@@ -928,18 +965,20 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
} 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");
+ 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);
+ if (result.getStatus() == HttpStatus.OK.value()) {
+ JSONObject jsonObject = JSONObject.parseObject(result.body());
+ if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
+ this.writing(this.mode);
+ this.setRequireSucess(true);
+ }
}
}
return true;
@@ -947,8 +986,6 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
}
-
-
public boolean exe_error() {
if (this.error == 0) {
return true;
@@ -985,11 +1022,13 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
itemMap.put(to_command, 1);
itemMap.put(to_task, instruction_num);
ReadUtil.write(itemMap, server);
+ server.disconnect();
}
public void executing(Server server, Map itemMap) {
ReadUtil.write(itemMap, server);
+ server.disconnect();
}
public void writing(int type, int command) {
@@ -1011,6 +1050,7 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
itemMap.put(to_task, command);
}
ReadUtil.write(itemMap, server);
+ server.disconnect();
}
@@ -1022,6 +1062,9 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
Map itemMap = new HashMap();
itemMap.put(to_command, command);
ReadUtil.write(itemMap, server);
+ ReadUtil.write(itemMap, server);
+ server.disconnect();
+ logServer.deviceExecuteLog(this.device_code, "", "", "to_command 写入 " + command);
}
public synchronized void OpenOrClose(String type) {
@@ -1041,77 +1084,118 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
@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 = "工单完成";
+ String mode;
+ String move;
+ String action;
+ String io_action;
+ boolean hasGoods;
+
+ switch (this.mode) {
+ case 0:
+ mode = "脱机";
+ break;
+ case 2:
+ mode = "待机";
+ break;
+ case 4:
+ mode = "叫料";
+ break;
+ case 5:
+ mode = "叫空托盘";
+ break;
+ case 6:
+ mode = "送空托盘";
+ break;
+ case 7:
+ mode = "码垛完成";
+ break;
+ case 8:
+ mode = "强制码垛完成";
+ break;
+ case 9:
+ mode = "获取托盘信息";
+ break;
+ case 11:
+ mode = "强制去包装(打包)";
+ break;
+ case 14:
+ mode = "强制去包装(不打包)";
+ default:
+ mode = String.valueOf(this.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.getMove() == 0) {
+ if (this.move == 0) {
move = "无货";
- } else if (this.getMove() == 1) {
+ hasGoods = false;
+ } else {
move = "有货";
- } else if (this.getMove() == 2) {
- move = "有托盘有货";
+ hasGoods = true;
}
+
+ switch (this.action) {
+ case 1:
+ action = "允许取货";
+ break;
+ case 2:
+ action = "允许放货";
+ break;
+ case 3:
+ action = "允许取放";
+ break;
+ default:
+ action = "禁止取放";
+ }
+
+ switch (this.io_action) {
+ case 1:
+ io_action = "允许进入";
+ break;
+ case 2:
+ io_action = "允许离开";
+ break;
+ case 3:
+ io_action = "允许进入离开";
+ break;
+ default:
+ io_action = "禁止进入离开";
+ }
+
+ String error;
+ switch (this.error) {
+ case 1:
+ error = "急停中";
+ break;
+ case 2:
+ error = "光幕报警";
+ break;
+ case 3:
+ error = "本体报警";
+ break;
+ case 4:
+ error = "未排产报警";
+ break;
+ case 5:
+ error = "扫码故障";
+ break;
+ default:
+ error = String.valueOf(this.error);
+ }
+
+ JSONObject jo = new JSONObject();
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("AlongSide", this.getAlongSide());
- jo.put("BshortSide", this.getBshortSide());
- jo.put("Htrapezoidal", this.getHtrapezoidal());
- jo.put("Wthickness", this.getWthickness());
+ jo.put("error", error);
+ jo.put("task", task);
+ jo.put("weight", weight);
+ jo.put("barcode", barcode);
+ jo.put("encoder_qty", encoder_qty);
+ jo.put("isError", iserror);
+ jo.put("isOnline", isonline);
+ jo.put("hasGoods", hasGoods);
+ jo.put("message", message);
return jo;
}
@@ -1125,141 +1209,142 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
*
* @param
*/
- public synchronized boolean getVehicle() throws InterruptedException {
+ public synchronized void getVehicle() throws InterruptedException {
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);
- JSONObject jo = acsToWmsService.getVehicle(json);
+ json.put("vehicle_code", barcode);
+ HttpResponse response = acsToWmsService.getVehicle(json);
- if (ObjectUtil.isNotEmpty(jo)) {
- 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 tool_coordinate = content.getString("tool_coordinate");
+ if (ObjectUtil.isNotEmpty(response)) {
+ if (response.getStatus() == HttpStatus.OK.value()) {
+ JSONObject jsonObject = JSONObject.parseObject(response.body());
+ if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
+ JSONObject content = jsonObject.getJSONObject("data");
+ if (ObjectUtil.isEmpty(content)) {
+ this.writing(20);
+ this.setRequireSucess(true);
+ } else {
+ String qty = content.getString("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 tool_coordinate = content.getString("tool_coordinate");
+ 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");
-
- this.writing("to_product_code", StrUtil.isEmpty(product_code) ? "0" : product_code);
-// this.writing("to_material_code",material_code);
- this.writing("to_AlongSide", StrUtil.isEmpty(AlongSide) ? "0" : AlongSide);
- this.writing("to_BshortSide", StrUtil.isEmpty(BshortSide) ? "0" : BshortSide);
- this.writing("to_Htrapezoidal", StrUtil.isEmpty(Htrapezoidal) ? "0" : Htrapezoidal);
- this.writing("to_Wthickness", StrUtil.isEmpty(Wthickness) ? "0" : Wthickness);
- //当前托盘砖数量
- this.writing("to_tray_qty", StrUtil.isEmpty(qty) ? "0" : qty);
- this.writing("to_tray_high", StrUtil.isEmpty(tray_high) ? "0" : tray_high);
- this.writing("to_crib_category", StrUtil.isEmpty(crib_category) ? "0" : crib_category);
- this.writing("to_palletX1_line", StrUtil.isEmpty(palletX1_line) ? "0" : palletX1_line);
- this.writing("to_palletY1_row", StrUtil.isEmpty(palletY1_row) ? "0" : palletY1_row);
- this.writing("to_palletA1_angle", StrUtil.isEmpty(palletA1_angle) ? "0" : palletA1_angle);
- this.writing("to_palletX2_line", StrUtil.isEmpty(palletX2_line) ? "0" : palletX2_line);
- this.writing("to_palletY2_row", StrUtil.isEmpty(palletY2_row) ? "0" : palletY2_row);
- this.writing("to_palletA2_angle", StrUtil.isEmpty(palletA2_angle) ? "0" : palletA2_angle);
- this.writing("to_palletX3_line", StrUtil.isEmpty(palletX3_line) ? "0" : palletX3_line);
- this.writing("to_palletY3_row", StrUtil.isEmpty(palletY3_row) ? "0" : palletY3_row);
- this.writing("to_palletA3_angle", StrUtil.isEmpty(palletA3_angle) ? "0" : palletA3_angle);
- this.writing("to_pressCribX1_line", StrUtil.isEmpty(pressCribX1_line) ? "0" : pressCribX1_line);
- this.writing("to_pressCribY1_row", StrUtil.isEmpty(pressCribY1_row) ? "0" : pressCribY1_row);
- this.writing("to_pressCribA1_angle", StrUtil.isEmpty(pressCribA1_angle) ? "0" : pressCribA1_angle);
- this.writing("to_pressCribX2_line", StrUtil.isEmpty(pressCribX2_line) ? "0" : pressCribX2_line);
- this.writing("to_pressCribY2_row", StrUtil.isEmpty(pressCribY2_row) ? "0" : pressCribY2_row);
- this.writing("to_pressCribA2_angle", StrUtil.isEmpty(pressCribA2_angle) ? "0" : pressCribA2_angle);
- this.writing("to_pressCribX3_line", StrUtil.isEmpty(pressCribX3_line) ? "0" : pressCribX3_line);
- this.writing("to_pressCribY3_row", StrUtil.isEmpty(pressCribY3_row) ? "0" : pressCribY3_row);
- this.writing("to_pressCribA3_angle", StrUtil.isEmpty(pressCribA3_angle) ? "0" : pressCribA3_angle);
- this.writing("to_Zoffset", StrUtil.isEmpty(Zoffset) ? "0" : Zoffset);
- this.writing("to_pallet_layerQty", StrUtil.isEmpty(pallet_layerQty) ? "0" : pallet_layerQty);
- this.writing("to_pressCrib_layerQty", StrUtil.isEmpty(pressCrib_layerQty) ? "0" : pressCrib_layerQty);
- this.writing("to_codeLayerX1_interval", StrUtil.isEmpty(codeLayerX1_interval) ? "0" : codeLayerX1_interval);
- this.writing("to_codeLayerY1_interval", StrUtil.isEmpty(codeLayerY1_interval) ? "0" : codeLayerY1_interval);
- this.writing("to_codeLayerX2_interval", StrUtil.isEmpty(codeLayerX2_interval) ? "0" : codeLayerX2_interval);
- this.writing("to_codeLayerY2_interval", StrUtil.isEmpty(codeLayerY2_interval) ? "0" : codeLayerY2_interval);
- this.writing("to_codeLayerX3_interval", StrUtil.isEmpty(codeLayerX3_interval) ? "0" : codeLayerX3_interval);
- this.writing("to_codeLayerY3_interval", StrUtil.isEmpty(codeLayerY3_interval) ? "0" : codeLayerY3_interval);
- this.writing("to_codeLayerX1_offset", StrUtil.isEmpty(codeLayerX1_offset) ? "0" : codeLayerX1_offset);
- this.writing("to_codeLayerY1_offset", StrUtil.isEmpty(codeLayerY1_offset) ? "0" : codeLayerY1_offset);
- this.writing("to_codeLayerX2_offset", StrUtil.isEmpty(codeLayerX2_offset) ? "0" : codeLayerX2_offset);
- this.writing("to_codeLayerY2_offset", StrUtil.isEmpty(codeLayerY2_offset) ? "0" : codeLayerY2_offset);
- this.writing("to_codeLayerX3_offset", StrUtil.isEmpty(codeLayerX3_offset) ? "0" : codeLayerX3_offset);
- this.writing("to_codeLayerY3_offset", StrUtil.isEmpty(codeLayerY3_offset) ? "0" : codeLayerY3_offset);
- this.writing("to_pressLayerX1_interval", StrUtil.isEmpty(pressLayerX1_interval) ? "0" : pressLayerX1_interval);
- this.writing("to_pressLayerY1_interval", StrUtil.isEmpty(pressLayerY1_interval) ? "0" : pressLayerY1_interval);
- this.writing("to_pressLayerX2_interval", StrUtil.isEmpty(pressLayerX2_interval) ? "0" : pressLayerX2_interval);
- this.writing("to_pressLayerY2_interval", StrUtil.isEmpty(pressLayerY2_interval) ? "0" : pressLayerY2_interval);
- this.writing("to_pressLayerX3_interval", StrUtil.isEmpty(pressLayerX3_interval) ? "0" : pressLayerX3_interval);
- this.writing("to_pressLayerY3_interval", StrUtil.isEmpty(pressLayerY3_interval) ? "0" : pressLayerY3_interval);
- this.writing("to_pressLayerX1_offset", StrUtil.isEmpty(pressLayerX1_offset) ? "0" : pressLayerX1_offset);
- this.writing("to_pressLayerY1_offset", StrUtil.isEmpty(pressLayerY1_offset) ? "0" : pressLayerY1_offset);
- this.writing("to_pressLayerX2_offset", StrUtil.isEmpty(pressLayerX2_offset) ? "0" : pressLayerX2_offset);
- this.writing("to_pressLayerY2_offset", StrUtil.isEmpty(pressLayerY2_offset) ? "0" : pressLayerY2_offset);
- this.writing("to_pressLayerX3_offset", StrUtil.isEmpty(pressLayerX3_offset) ? "0" : pressLayerX3_offset);
- this.writing("to_pressLayerY3_offset", StrUtil.isEmpty(pressLayerY3_offset) ? "0" : pressLayerY3_offset);
- this.writing("to_tool_coordinate", StrUtil.isEmpty(tool_coordinate) ? "0" : tool_coordinate);
-
- Thread.sleep(1000);
-
- this.writing(this.mode);
- this.setRequireSucess(true);
+ this.writing("to_product_code", StrUtil.isBlank(product_code) ? "0" : product_code);
+ this.writing("to_AlongSide", StrUtil.isBlank(AlongSide) ? "0" : AlongSide);
+ this.writing("to_BshortSide", StrUtil.isBlank(BshortSide) ? "0" : BshortSide);
+ this.writing("to_Htrapezoidal", StrUtil.isBlank(Htrapezoidal) ? "0" : Htrapezoidal);
+ this.writing("to_Wthickness", StrUtil.isBlank(Wthickness) ? "0" : Wthickness);
+ //当前托盘砖数量
+ this.writing("to_tray_qty", StrUtil.isBlank(qty) ? "0" : qty);
+ this.writing("to_tray_high", StrUtil.isBlank(tray_high) ? "0" : tray_high);
+ this.writing("to_crib_category", StrUtil.isBlank(crib_category) ? "0" : crib_category);
+ this.writing("to_palletX1_line", StrUtil.isBlank(palletX1_line) ? "0" : palletX1_line);
+ this.writing("to_palletY1_row", StrUtil.isBlank(palletY1_row) ? "0" : palletY1_row);
+ this.writing("to_palletA1_angle", StrUtil.isBlank(palletA1_angle) ? "0" : palletA1_angle);
+ this.writing("to_palletX2_line", StrUtil.isBlank(palletX2_line) ? "0" : palletX2_line);
+ this.writing("to_palletY2_row", StrUtil.isBlank(palletY2_row) ? "0" : palletY2_row);
+ this.writing("to_palletA2_angle", StrUtil.isBlank(palletA2_angle) ? "0" : palletA2_angle);
+ this.writing("to_palletX3_line", StrUtil.isBlank(palletX3_line) ? "0" : palletX3_line);
+ this.writing("to_palletY3_row", StrUtil.isBlank(palletY3_row) ? "0" : palletY3_row);
+ this.writing("to_palletA3_angle", StrUtil.isBlank(palletA3_angle) ? "0" : palletA3_angle);
+ this.writing("to_pressCribX1_line", StrUtil.isBlank(pressCribX1_line) ? "0" : pressCribX1_line);
+ this.writing("to_pressCribY1_row", StrUtil.isBlank(pressCribY1_row) ? "0" : pressCribY1_row);
+ this.writing("to_pressCribA1_angle", StrUtil.isBlank(pressCribA1_angle) ? "0" : pressCribA1_angle);
+ this.writing("to_pressCribX2_line", StrUtil.isBlank(pressCribX2_line) ? "0" : pressCribX2_line);
+ this.writing("to_pressCribY2_row", StrUtil.isBlank(pressCribY2_row) ? "0" : pressCribY2_row);
+ this.writing("to_pressCribA2_angle", StrUtil.isBlank(pressCribA2_angle) ? "0" : pressCribA2_angle);
+ this.writing("to_pressCribX3_line", StrUtil.isBlank(pressCribX3_line) ? "0" : pressCribX3_line);
+ this.writing("to_pressCribY3_row", StrUtil.isBlank(pressCribY3_row) ? "0" : pressCribY3_row);
+ this.writing("to_pressCribA3_angle", StrUtil.isBlank(pressCribA3_angle) ? "0" : pressCribA3_angle);
+ this.writing("to_Zoffset", StrUtil.isBlank(Zoffset) ? "0" : Zoffset);
+ this.writing("to_pallet_layerQty", StrUtil.isBlank(pallet_layerQty) ? "0" : pallet_layerQty);
+ this.writing("to_pressCrib_layerQty", StrUtil.isBlank(pressCrib_layerQty) ? "0" : pressCrib_layerQty);
+ this.writing("to_codeLayerX1_interval", StrUtil.isBlank(codeLayerX1_interval) ? "0" : codeLayerX1_interval);
+ this.writing("to_codeLayerY1_interval", StrUtil.isBlank(codeLayerY1_interval) ? "0" : codeLayerY1_interval);
+ this.writing("to_codeLayerX2_interval", StrUtil.isBlank(codeLayerX2_interval) ? "0" : codeLayerX2_interval);
+ this.writing("to_codeLayerY2_interval", StrUtil.isBlank(codeLayerY2_interval) ? "0" : codeLayerY2_interval);
+ this.writing("to_codeLayerX3_interval", StrUtil.isBlank(codeLayerX3_interval) ? "0" : codeLayerX3_interval);
+ this.writing("to_codeLayerY3_interval", StrUtil.isBlank(codeLayerY3_interval) ? "0" : codeLayerY3_interval);
+ this.writing("to_codeLayerX1_offset", StrUtil.isBlank(codeLayerX1_offset) ? "0" : codeLayerX1_offset);
+ this.writing("to_codeLayerY1_offset", StrUtil.isBlank(codeLayerY1_offset) ? "0" : codeLayerY1_offset);
+ this.writing("to_codeLayerX2_offset", StrUtil.isBlank(codeLayerX2_offset) ? "0" : codeLayerX2_offset);
+ this.writing("to_codeLayerY2_offset", StrUtil.isBlank(codeLayerY2_offset) ? "0" : codeLayerY2_offset);
+ this.writing("to_codeLayerX3_offset", StrUtil.isBlank(codeLayerX3_offset) ? "0" : codeLayerX3_offset);
+ this.writing("to_codeLayerY3_offset", StrUtil.isBlank(codeLayerY3_offset) ? "0" : codeLayerY3_offset);
+ this.writing("to_pressLayerX1_interval", StrUtil.isBlank(pressLayerX1_interval) ? "0" : pressLayerX1_interval);
+ this.writing("to_pressLayerY1_interval", StrUtil.isBlank(pressLayerY1_interval) ? "0" : pressLayerY1_interval);
+ this.writing("to_pressLayerX2_interval", StrUtil.isBlank(pressLayerX2_interval) ? "0" : pressLayerX2_interval);
+ this.writing("to_pressLayerY2_interval", StrUtil.isBlank(pressLayerY2_interval) ? "0" : pressLayerY2_interval);
+ this.writing("to_pressLayerX3_interval", StrUtil.isBlank(pressLayerX3_interval) ? "0" : pressLayerX3_interval);
+ this.writing("to_pressLayerY3_interval", StrUtil.isBlank(pressLayerY3_interval) ? "0" : pressLayerY3_interval);
+ this.writing("to_pressLayerX1_offset", StrUtil.isBlank(pressLayerX1_offset) ? "0" : pressLayerX1_offset);
+ this.writing("to_pressLayerY1_offset", StrUtil.isBlank(pressLayerY1_offset) ? "0" : pressLayerY1_offset);
+ this.writing("to_pressLayerX2_offset", StrUtil.isBlank(pressLayerX2_offset) ? "0" : pressLayerX2_offset);
+ this.writing("to_pressLayerY2_offset", StrUtil.isBlank(pressLayerY2_offset) ? "0" : pressLayerY2_offset);
+ this.writing("to_pressLayerX3_offset", StrUtil.isBlank(pressLayerX3_offset) ? "0" : pressLayerX3_offset);
+ this.writing("to_pressLayerY3_offset", StrUtil.isBlank(pressLayerY3_offset) ? "0" : pressLayerY3_offset);
+ this.writing("to_tool_coordinate", StrUtil.isBlank(tool_coordinate) ? "0" : tool_coordinate);
+ this.writing(this.mode);
+ }
+ this.setRequireSucess(true);
+ }
+ }
}
- return true;
}
}
@@ -1273,6 +1358,151 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
itemMap.put(to_param, value);
ReadUtil.write(itemMap, server);
+ server.disconnect();
+ logServer.deviceExecuteLog(this.device_code, "", "", param + " 写入 " + value);
+ }
+
+ /**
+ * 强制去包装
+ */
+ public synchronized void toPackage(boolean is_package) {
+ 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);
+ } else {
+ this.instruction_require_time = date;
+ JSONObject json = new JSONObject();
+ json.put("type", "5");
+ json.put("device_code", device_code);
+ json.put("qty", encoder_qty);
+ json.put("weight", weight);
+ json.put("vehicle_code", barcode);
+ json.put("is_full", "0");
+ json.put("is_package", is_package ? "1" : "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("tool_coordinate", tool_coordinate);
+ HttpResponse result = acsToWmsService.applyTaskManipulatorToWms(json);
+ if (ObjectUtil.isNotEmpty(result)) {
+ if (result.getStatus() == HttpStatus.OK.value()) {
+ JSONObject jsonObject = JSONObject.parseObject(result.body());
+ if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
+ this.writing(this.mode);
+ this.setRequireSucess(true);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * 申请空盘
+ *
+ * @param
+ */
+ public synchronized boolean sendEmpty() {
+ 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", "3");
+ json.put("vehicle_code", barcode);
+ HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
+ if (ObjectUtil.isNotEmpty(result)) {
+ if (result.getStatus() == HttpStatus.OK.value()) {
+ JSONObject jsonObject = JSONObject.parseObject(result.body());
+ if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
+ this.writing(this.mode);
+ this.setRequireSucess(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");
+ HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
+ if (ObjectUtil.isNotEmpty(result)) {
+ if (result.getStatus() == HttpStatus.OK.value()) {
+ JSONObject jsonObject = JSONObject.parseObject(result.body());
+ if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
+ this.writing(this.mode);
+ this.setRequireSucess(true);
+ }
+ }
+ }
+ return true;
+ }
}
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_press/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_press/ItemProtocol.java
index 517e185..bb88a7d 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_press/ItemProtocol.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_press/ItemProtocol.java
@@ -1,6 +1,7 @@
package org.nl.acs.device_driver.lnsh.lnsh_press;
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
@@ -8,7 +9,8 @@ import java.util.ArrayList;
import java.util.List;
@Slf4j
-@Data
+@Getter
+@Setter
public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
@@ -59,8 +61,8 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_error);
}
- public int getOpen_time() {
- return this.getOpcIntegerValue(item_open_time);
+ public String getOpen_time() {
+ return this.getOpcStringValue(item_open_time);
}
public int getStandby_time() {
@@ -165,25 +167,25 @@ public class ItemProtocol {
} else {
return value;
}
- return "0";
+ return "";
}
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_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.STRING20.50"));
- list.add(new ItemDto(item_qty, "当前已生产数量", "DB8.D70"));
- list.add(new ItemDto(item_weight, "当前已生产重量", "DB8.D74"));
- list.add(new ItemDto(item_qualified, "当前已生产合格数", "DB8.D78"));
- list.add(new ItemDto(item_unqualified, "当前已生产不合格数", "DB8.D82"));
- list.add(new ItemDto(item_order_No, "工单号", "DB8.STRING86.50"));
+ list.add(new ItemDto(item_open_time, "开机时间", "DB8.STRING4.50"));
+ list.add(new ItemDto(item_standby_time, "待机时间", "DB8.D56"));
+ list.add(new ItemDto(item_production_time, "生产时间", "DB8.D60"));
+ list.add(new ItemDto(item_error_time, "故障时间", "DB8.D64"));
+ list.add(new ItemDto(item_material, "当前生产物料", "DB8.STRING68.50"));
+ list.add(new ItemDto(item_qty, "当前已生产数量", "DB8.D120"));
+ list.add(new ItemDto(item_weight, "当前已生产重量", "DB8.D124"));
+ list.add(new ItemDto(item_qualified, "当前已生产合格数", "DB8.D128"));
+ list.add(new ItemDto(item_unqualified, "当前已生产不合格数", "DB8.D132"));
+ list.add(new ItemDto(item_order_No, "工单号", "DB8.STRING136.50"));
return list;
}
@@ -192,13 +194,13 @@ public class ItemProtocol {
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.STRING4.50"));
- list.add(new ItemDto(item_to_qty, "生产重量", "DB9.D54"));
- list.add(new ItemDto(item_to_material_code, "下发物料编号", "DB9.STRING58.50"));
- list.add(new ItemDto(item_to_product_code, "产品编号", "DB4.W108"));
- list.add(new ItemDto(item_to_AlongSide, "A长边", "DB4.W110"));
- list.add(new ItemDto(item_to_BshortSide, "B短边", "DB4.W112"));
- list.add(new ItemDto(item_to_Htrapezoidal, "H梯形高", "DB4.W114"));
- list.add(new ItemDto(item_to_Wthickness, "W厚度", "DB4.W116"));
+ list.add(new ItemDto(item_to_qty, "生产重量", "DB9.D56"));
+ list.add(new ItemDto(item_to_material_code, "下发物料编号", "DB9.STRING60.50"));
+ list.add(new ItemDto(item_to_product_code, "产品编号", "DB4.W112"));
+ list.add(new ItemDto(item_to_AlongSide, "A长边", "DB4.W114"));
+ list.add(new ItemDto(item_to_BshortSide, "B短边", "DB4.W116"));
+ list.add(new ItemDto(item_to_Htrapezoidal, "H梯形高", "DB4.W118"));
+ list.add(new ItemDto(item_to_Wthickness, "W厚度", "DB4.W120"));
return list;
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_press/LnshPressDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_press/LnshPressDefination.java
index 683066d..58f77f5 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_press/LnshPressDefination.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_press/LnshPressDefination.java
@@ -58,19 +58,19 @@ public class LnshPressDefination implements OpcDeviceDriverDefination {
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_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.STRING20.50"));
- list.add(new ItemDto(ItemProtocol.item_qty, "当前已生产数量", "DB8.D70"));
- list.add(new ItemDto(ItemProtocol.item_weight, "当前已生产重量", "DB8.D74"));
- list.add(new ItemDto(ItemProtocol.item_qualified, "当前已生产合格数", "DB8.D78"));
- list.add(new ItemDto(ItemProtocol.item_unqualified, "当前已生产不合格数", "DB8.D82"));
- list.add(new ItemDto(ItemProtocol.item_order_No, "工单号", "DB8.STRING86.50"));
+ list.add(new ItemDto(ItemProtocol.item_open_time, "开机时间", "DB8.STRING4.50"));
+ list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "DB8.D56"));
+ list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "DB8.D60"));
+ list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "DB8.D64"));
+ list.add(new ItemDto(ItemProtocol.item_material, "当前生产物料", "DB8.STRING68.50"));
+ list.add(new ItemDto(ItemProtocol.item_qty, "当前已生产数量", "DB8.D120"));
+ list.add(new ItemDto(ItemProtocol.item_weight, "当前已生产重量", "DB8.D124"));
+ list.add(new ItemDto(ItemProtocol.item_qualified, "当前已生产合格数", "DB8.D128"));
+ list.add(new ItemDto(ItemProtocol.item_unqualified, "当前已生产不合格数", "DB8.D132"));
+ list.add(new ItemDto(ItemProtocol.item_order_No, "工单号", "DB8.STRING136.50"));
return list;
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_press/LnshPressDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_press/LnshPressDeviceDriver.java
index 4793040..b55e6e3 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_press/LnshPressDeviceDriver.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_press/LnshPressDeviceDriver.java
@@ -4,7 +4,8 @@ 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.Getter;
+import lombok.Setter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
@@ -17,6 +18,7 @@ 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;
@@ -25,6 +27,7 @@ import org.nl.acs.task.service.TaskService;
import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
import java.lang.reflect.Field;
import java.util.Date;
@@ -36,23 +39,24 @@ import java.util.Map;
* 晟华压力机
*/
@Slf4j
-@Data
+@Getter
+@Setter
@RequiredArgsConstructor
-public class LnshPressDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
+public class LnshPressDeviceDriver 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");
//放货准备锁
@@ -86,8 +90,8 @@ public class LnshPressDeviceDriver extends AbstractOpcDeviceDriver implements De
int status = 0;
int last_status = 0;
- int open_time = 0;
- int last_open_time = 0;
+ String open_time = "0";
+ String last_open_time = "0";
int standby_time = 0;
int last_standby_time = 0;
int production_time = 0;
@@ -134,63 +138,63 @@ public class LnshPressDeviceDriver extends AbstractOpcDeviceDriver implements De
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);
+ 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);
+ 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);
+ 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 (!open_time.equals(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);
+ 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);
+ 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);
+ 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);
+ 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(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);
+ 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);
+ 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);
+ 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);
+ 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);
@@ -215,43 +219,27 @@ public class LnshPressDeviceDriver extends AbstractOpcDeviceDriver implements De
break;
case 3:
//排产单确认
- if (!requireSucess && !order_No.equals("0")) {
+ if (!requireSucess && !"0".equals(order_No) && StrUtil.isNotBlank(order_No)) {
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");
+ json.put("workorder_code", order_No);
+ json.put("type", "1");
enterProduction(json);
}
break;
case 4:
//工单完成反馈
- if (!requireSucess && !order_No.equals("0")) {
+ if (!requireSucess && !"0".equals(order_No) && StrUtil.isNotBlank(order_No)) {
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");
+ json.put("workorder_code", order_No);
+ json.put("qty", qty);
+ json.put("unqualified_qty", unqualified);
+ json.put("type", "2");
enterProduction(json);
}
break;
}
- switch (flag) {
- //取货完成
- case 1:
- writing(2);
- return;
- //放货完成
- case 2:
- writing(3);
- return;
-
- }
+
}
last_mode = mode;
@@ -293,17 +281,19 @@ public class LnshPressDeviceDriver extends AbstractOpcDeviceDriver implements De
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");
+ if (result.getStatus() == HttpStatus.OK.value()) {
+ JSONObject jsonObject = JSONObject.parseObject(result.body());
+ if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
+// 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);
}
- produceshiftorderService.update(dto);
- this.writing(this.mode);
- this.setRequireSucess(true);
}
}
return true;
@@ -328,6 +318,7 @@ public class LnshPressDeviceDriver extends AbstractOpcDeviceDriver implements De
Server server = ReadUtil.getServer(opcservcerid);
Map itemMap = new HashMap();
ReadUtil.write(itemMap, server);
+ server.disconnect();
}
@@ -341,10 +332,13 @@ public class LnshPressDeviceDriver extends AbstractOpcDeviceDriver implements De
itemMap.put(to_param, value);
ReadUtil.write(itemMap, server);
+ server.disconnect();
+ logServer.deviceExecuteLog(this.device_code, "", "", param + " 写入 " + value);
}
public void executing(Server server, Map itemMap) {
ReadUtil.write(itemMap, server);
+ server.disconnect();
}
public void writing(int command) {
@@ -356,11 +350,13 @@ public class LnshPressDeviceDriver extends AbstractOpcDeviceDriver implements De
Map itemMap = new HashMap();
itemMap.put(to_command, command);
ReadUtil.write(itemMap, server);
-
+ ReadUtil.write(itemMap, server);
+ server.disconnect();
+ logServer.deviceExecuteLog(this.device_code, "", "", "to_command 写入 " + command);
}
public static Boolean isExistFieldName(String fieldName, Object obj) throws NoSuchFieldException {
- if (obj == null || StrUtil.isEmpty(fieldName)) {
+ if (obj == null || StrUtil.isBlank(fieldName)) {
return null;
}
//获取这个类的所有属性
@@ -376,4 +372,86 @@ public class LnshPressDeviceDriver extends AbstractOpcDeviceDriver implements De
return flag;
}
+ @Override
+ public JSONObject getDeviceStatusName() throws Exception {
+ String mode;
+ String status;
+
+ switch (this.mode) {
+ case 0:
+ mode = "脱机";
+ break;
+ case 2:
+ mode = "待机";
+ break;
+ case 3:
+ mode = "排产确认";
+ break;
+ case 4:
+ mode = "工单完成";
+ break;
+ default:
+ mode = String.valueOf(this.mode);
+ }
+
+ switch (this.status) {
+ case 1:
+ status = "待机";
+ break;
+ case 2:
+ status = "生产中";
+ break;
+ case 3:
+ status = "故障";
+ break;
+ default:
+ status = String.valueOf(this.status);
+ }
+
+ String error;
+ switch (this.error) {
+ case 1:
+ error = "急停中";
+ break;
+ case 2:
+ error = "光幕报警";
+ break;
+ case 3:
+ error = "本体报警";
+ break;
+ case 4:
+ error = "未排产报警";
+ break;
+ case 5:
+ error = "扫码故障";
+ break;
+ default:
+ error = String.valueOf(this.error);
+ }
+
+ JSONObject jo = new JSONObject();
+ jo.put("device_name", this.getDevice().getDevice_name());
+ jo.put("mode", mode);
+ jo.put("status", status);
+ jo.put("error", error);
+ jo.put("open_time", open_time);
+ jo.put("standby_time", standby_time);
+ jo.put("production_time", production_time);
+ jo.put("error_time", error_time);
+ jo.put("material", material);
+ jo.put("qty", qty);
+ jo.put("weight", weight);
+ jo.put("qualified", qualified);
+ jo.put("unqualified", unqualified);
+ jo.put("order_No", order_No);
+ jo.put("isError", iserror);
+ jo.put("isOnline", isonline);
+ jo.put("message", message);
+ return jo;
+ }
+
+ @Override
+ public void setDeviceStatus(JSONObject data) {
+
+ }
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_rgv/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_rgv/ItemProtocol.java
index e1c0203..689289b 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_rgv/ItemProtocol.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_rgv/ItemProtocol.java
@@ -1,6 +1,8 @@
package org.nl.acs.device_driver.lnsh.lnsh_rgv;
-import lombok.Data;
+import cn.hutool.core.util.StrUtil;
+import lombok.Getter;
+import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
@@ -8,16 +10,17 @@ import java.util.ArrayList;
import java.util.List;
@Slf4j
-@Data
+@Getter
+@Setter
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_move1 = "move1";
+ public static String item_move2 = "move2";
+ public static String item_action1 = "action1";
+ public static String item_action2 = "action2";
public static String item_walk_y = "walk_y";
public static String item_error = "error";
public static String item_task1 = "task1";
@@ -36,7 +39,6 @@ public class ItemProtocol {
public static String item_to_onset2 = "to_onset2";
public static String item_to_target2 = "to_target2";
-
private LnshRGVDeviceDriver driver;
public ItemProtocol(LnshRGVDeviceDriver driver) {
@@ -59,10 +61,9 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_error);
}
- public int getOpen_time() {
- return this.getOpcIntegerValue(item_open_time);
+ public String getOpen_time() {
+ return this.getOpcStringValue(item_open_time);
}
-
public int getStandby_time() {
return this.getOpcIntegerValue(item_standby_time);
}
@@ -75,20 +76,20 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_error_time);
}
- public int getMove_1() {
- return this.getOpcIntegerValue(item_move_1);
+ public int getMove1() {
+ return this.getOpcIntegerValue(item_move1);
}
- public int getMove_2() {
- return this.getOpcIntegerValue(item_move_2);
+ public int getMove2() {
+ return this.getOpcIntegerValue(item_move2);
}
- public int getAction_1() {
- return this.getOpcIntegerValue(item_action_1);
+ public int getAction1() {
+ return this.getOpcIntegerValue(item_action1);
}
- public int getAction_2() {
- return this.getOpcIntegerValue(item_action_2);
+ public int getAction2() {
+ return this.getOpcIntegerValue(item_action2);
}
public int getWalk_y() {
@@ -135,7 +136,6 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_to_task2);
}
-
//是否有货
public int hasGoods(int move) {
return move;
@@ -146,7 +146,7 @@ public class ItemProtocol {
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if (value == null) {
-// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
+ //log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
setIsonline(false);
} else {
setIsonline(true);
@@ -156,35 +156,45 @@ public class ItemProtocol {
}
+ public String getOpcStringValue(String protocol) {
+ String value = this.driver.getStringValue(protocol);
+ if (StrUtil.isBlank(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_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"));
+ list.add(new ItemDto(item_heartbeat, "心跳", "DB50.B0"));
+ list.add(new ItemDto(item_mode, "工作模式", "DB50.B1", Boolean.valueOf(true)));
+ list.add(new ItemDto(item_status, "设备状态", "DB50.B2"));
+ list.add(new ItemDto(item_move1, "前工位光电信号", "DB50.B3"));
+ list.add(new ItemDto(item_move2, "后工位光电信号", "DB50.B4"));
+ list.add(new ItemDto(item_action1, "前工位动作信号", "DB50.B5"));
+ list.add(new ItemDto(item_action2, "后工位动作信号", "DB50.B6"));
+ list.add(new ItemDto(item_walk_y, "行走列", "DB50.B7"));
+ list.add(new ItemDto(item_error, "车体报警", "DB50.B8"));
+ list.add(new ItemDto(item_task1, "前工位任务号", "DB50.D10"));
+ list.add(new ItemDto(item_task2, "后工位任务号", "DB50.D14"));
+ list.add(new ItemDto(item_open_time, "开机时间", "DB50.STRING18.50"));
+ list.add(new ItemDto(item_standby_time, "待机时间", "DB50.D70"));
+ list.add(new ItemDto(item_production_time, "生产时间", "DB50.D74"));
+ list.add(new ItemDto(item_error_time, "故障时间", "DB50.D78"));
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_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_command2, "后工位下发指令", "DB51.W10"));
+ list.add(new ItemDto(item_to_onset2, "下发起始站", "DB51.W12"));
+ list.add(new ItemDto(item_to_target2, "下发目标站", "DB51.W14"));
list.add(new ItemDto(item_to_task2, "下发任务号2", "DB51.D16"));
return list;
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_rgv/LnshRGVDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_rgv/LnshRGVDefination.java
index f019ec2..4174040 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_rgv/LnshRGVDefination.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_rgv/LnshRGVDefination.java
@@ -12,7 +12,7 @@ import java.util.LinkedList;
import java.util.List;
/**
- * 晟华RGV
+ * 嘉耐双工位RGV
*
*/
@Service
@@ -24,12 +24,12 @@ public class LnshRGVDefination implements OpcDeviceDriverDefination {
@Override
public String getDriverName() {
- return "晟华-RGV";
+ return "嘉耐双工位RGV";
}
@Override
public String getDriverDescription() {
- return "晟华-RGV";
+ return "嘉耐双工位RGV";
}
@Override
@@ -57,21 +57,21 @@ public class LnshRGVDefination implements OpcDeviceDriverDefination {
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"));
+ list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB50.B0"));
+ list.add(new ItemDto(ItemProtocol.item_mode, "工作模式", "DB50.B1", Boolean.valueOf(true)));
+ list.add(new ItemDto(ItemProtocol.item_status, "设备状态", "DB50.B2"));
+ list.add(new ItemDto(ItemProtocol.item_move1, "前工位光电信号", "DB50.B3"));
+ list.add(new ItemDto(ItemProtocol.item_move2, "后工位光电信号", "DB50.B4"));
+ list.add(new ItemDto(ItemProtocol.item_action1, "前工位动作信号", "DB50.B5"));
+ list.add(new ItemDto(ItemProtocol.item_action2, "后工位动作信号", "DB50.B6"));
+ list.add(new ItemDto(ItemProtocol.item_walk_y, "行走列", "DB50.B7"));
+ list.add(new ItemDto(ItemProtocol.item_error, "车体报警", "DB50.B8"));
+ list.add(new ItemDto(ItemProtocol.item_task1, "前工位任务号", "DB50.D10"));
+ list.add(new ItemDto(ItemProtocol.item_task2, "后工位任务号", "DB50.D14"));
+ list.add(new ItemDto(ItemProtocol.item_open_time, "开机时间", "DB50.STRING18.50"));
+ list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "DB50.D70"));
+ list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "DB50.D74"));
+ list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "DB50.D78"));
return list;
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_rgv/LnshRGVDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_rgv/LnshRGVDeviceDriver.java
index ce3d3d8..417ef08 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_rgv/LnshRGVDeviceDriver.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_rgv/LnshRGVDeviceDriver.java
@@ -4,52 +4,59 @@ 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 com.alibaba.fastjson.JSONObject;
+import lombok.Getter;
+import lombok.Setter;
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.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
+import org.nl.acs.device_driver.lnsh.lnsh_Laminating_machine.LnshLaminatingMachineDeviceDriver;
+import org.nl.acs.device_driver.lnsh.lnsh_package_site.LnshPackageSiteDeviceDriver;
+import org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator_site.LnshPalletizingManipulatorSiteDeviceDriver;
+import org.nl.acs.device_driver.lnsh.lnsh_station.LnshStationDeviceDriver;
+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.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.modules.wql.core.bean.WQLObject;
+import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
-import org.springframework.beans.factory.annotation.Autowired;
import java.util.*;
/**
- * 晟华RGV
+ * 嘉耐双工位RGV
*/
@Slf4j
-@Data
+@Getter
+@Setter
@RequiredArgsConstructor
-public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
+public class LnshRGVDeviceDriver 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 appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
- @Autowired
+
+ AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl");
+
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
//当前指令1
@@ -57,58 +64,69 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
//当前指令2
Instruction inst2 = null;
+ DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
+
+ //工作模式
int mode = 0;
- int error = 0;
int last_mode = 0;
+ //设备状态
+ int status = 0;
+ int last_status = 0;
+ //前后工位光电信号
+ int move1 = 0;
+ int last_move1 = 0;
+ int move2 = 0;
+ int last_move2 = 0;
+ //前后工位动作信号
+ int action1 = 0;
+ int last_action1 = 0;
+ int action2 = 0;
+ int last_action2 = 0;
+ //报警信号
+ int error = 0;
int last_error = 0;
+ //行走列
+ int walk_y = 0;
+ int last_walk_y = 0;
+ //前后工位任务号
+ int task1 = 0;
+ int last_task1 = 0;
+ int task2 = 0;
+ int last_task2 = 0;
+
+ String open_time = null;
+ String last_open_time = null;
+ 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;
+
Boolean isonline = true;
- Boolean requireSucess = false;
+ //后工位申请任务请求标记
+ Boolean requireBackSucess = false;
+ //前工位申请任务请求标记
+ Boolean requireHeadSucess = 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;
+
+
+ //后工位申请任务请求时间
+ private Date instruction_require_time = new Date();
+ //前工位申请任务请求时间
+ private Date instruction_head_time = new Date();
+ //请求超时时间
+ private int instruction_require_time_out = 3000;
@Override
public Device getDevice() {
@@ -123,10 +141,10 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
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();
+ move1 = this.itemProtocol.getMove1();
+ move2 = this.itemProtocol.getMove2();
+ action1 = this.itemProtocol.getAction1();
+ action2 = this.itemProtocol.getAction2();
walk_y = this.itemProtocol.getWalk_y();
error = this.itemProtocol.getError();
task1 = this.itemProtocol.getTask1();
@@ -137,138 +155,344 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
error_time = this.itemProtocol.getError_time();
if (mode != last_mode) {
- this.setRequireSucess(false);
+ if (mode == 0) {
+ this.setRequireHeadSucess(false);
+ this.setRequireBackSucess(false);
+ }
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
- logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + 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);
+ 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);
+ 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 (move1 != last_move1) {
+ if (move1 == 0) {
+ this.setRequireHeadSucess(false);
+ }
+ logServer.deviceItemValue(this.device_code, "move1", String.valueOf(move1));
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号move1:" + last_move1 + " -> " + move1);
}
- 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 (move2 != last_move2) {
+ if (move2 == 0) {
+ this.setRequireBackSucess(false);
+ }
+ logServer.deviceItemValue(this.device_code, "move2", String.valueOf(move2));
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号move2:" + last_move2 + " -> " + move2);
}
- 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 (action1 != last_action1) {
+ logServer.deviceItemValue(this.device_code, "action1", String.valueOf(action1));
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号action1:" + last_action1 + " -> " + action1);
}
- 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 (action2 != last_action2) {
+ logServer.deviceItemValue(this.device_code, "action2", String.valueOf(action2));
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号action2:" + last_action2 + " -> " + action2);
}
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);
+ 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);
+ 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);
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号task2:" + last_task2 + " -> " + task2);
}
- if (open_time != last_open_time) {
+ if (!open_time.equals(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);
+ 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);
+ 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);
+ 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);
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号error_time:" + last_error_time + " -> " + error_time);
+ }
+
+ //前工位任务就绪->执行
+ if (mode != 0 && error == 0 && status != 3 && task1 > 0) {
+ Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task1));
+ if (inst1 != null) {
+ if (StrUtil.equals(inst1.getInstruction_status(), "0")) {
+ inst1.setInstruction_status("1");
+ instructionService.update(inst1);
+ }
+ }
+ }
+
+ //前工位放货完成 任务完成
+ if (mode == 3 && error == 0 && status != 3 && action1 == 4 && move1 == 0 && task1 > 0) {
+ //inst_message
+ Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task1));
+ if (inst1 != null) {
+ if (StrUtil.equals(inst1.getInstruction_status(), "1")) {
+ finish_instruction(inst1);
+ logServer.deviceExecuteLog(this.device_code, "", "", "RGV前工位任务完成。");
+ this.writing("to_command1", "0");
+ this.writing("to_onset1", "0");
+ this.writing("to_target1", "0");
+ this.writing("to_task1", "0");
+ this.writing("to_command1", "0");
+ this.writing("to_onset1", "0");
+ this.writing("to_target1", "0");
+ this.writing("to_task1", "0");
+ this.setRequireHeadSucess(false);
+ }
+ }
+ }
+
+ //后工位任务就绪->执行
+ if (mode != 0 && error == 0 && status != 3 && task2 > 0) {
+ //inst_message
+ Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task2));
+ if (inst2 != null) {
+ if (StrUtil.equals(inst2.getInstruction_status(), "0")) {
+ inst2.setInstruction_status("1");
+ instructionService.update(inst2);
+ }
+ }
+ }
+ //后工位放货完成 任务完成
+ if (mode == 3 && error == 0 && status != 3 && action2 == 4 && move2 == 0 && task2 > 0) {
+ //inst_message
+ Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task2));
+ if (inst2 != null) {
+ if (StrUtil.equals(inst2.getInstruction_status(), "1")) {
+ finish_instruction(inst2);
+ logServer.deviceExecuteLog(this.device_code, "", "", "后工位任务完成。");
+ this.writing("to_command2", "0");
+ this.writing("to_onset2", "0");
+ this.writing("to_target2", "0");
+ this.writing("to_task2", "0");
+ this.writing("to_command2", "0");
+ this.writing("to_onset2", "0");
+ this.writing("to_target2", "0");
+ this.writing("to_task2", "0");
+ this.setRequireBackSucess(false);
+ }
+ }
+ }
+
+ //前工位取货时判断取货位光电信号
+ if (mode == 3 && error == 0 && status != 3 && action1 == 1 && move1 == 0 && task1 > 0 && action2 != 1) {
+ Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task1));
+ String start_device_code = inst1.getStart_device_code();
+ Device startDevice = deviceAppservice.findDeviceByCode(start_device_code);
+ if (startDevice.getDeviceDriver() instanceof LnshPalletizingManipulatorSiteDeviceDriver) {
+ LnshPalletizingManipulatorSiteDeviceDriver driver = (LnshPalletizingManipulatorSiteDeviceDriver) startDevice.getDeviceDriver();
+ if (driver.getMode() != 0
+ && driver.getMove() != 0
+ && (driver.getIo_action() == 3 || driver.getIo_action() == 1)
+ && (driver.getAction() == 3 || driver.getAction() == 1)) {
+ this.writing("to_command1", "2");
+ driver.setMessage("");
+ logServer.deviceExecuteLog(startDevice.getDevice_code(), "", "", "允许RGV前工位取货。");
+ } else {
+ String msg = "";
+ if (driver.getMode() == 0) {
+ msg += "站点未联机,";
+ } else {
+ if (driver.getMove() == 0) {
+ msg += "站点无货,";
+ }
+ if (driver.getIo_action() != 3 && driver.getIo_action() != 1) {
+ msg += "站点不允许进入,";
+ }
+ if (driver.getAction() != 3 && driver.getAction() != 1) {
+ msg += "站点不允许取货,";
+ }
+ }
+ msg += "不允许RGV前工位取货。";
+ driver.setMessage(msg);
+ logServer.deviceExecuteLog(startDevice.getDevice_code(), "", "", msg);
+ }
+ } else if (startDevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
+ this.writing("to_command1", "2");
+ logServer.deviceExecuteLog(startDevice.getDevice_code(), "", "", "允许RGV前工位取货。");
+ }
+ }
+
+ //前工位放货时判断放货位光电信号
+ if (mode == 3 && error == 0 && status != 3 && action1 == 3 && move1 != 0 && task1 > 0 && action2 != 3) {
+ Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task1));
+ String next_device_code = inst1.getNext_device_code();
+ Device nextDevice = deviceAppservice.findDeviceByCode(next_device_code);
+ if (nextDevice.getDeviceDriver() instanceof LnshStationDeviceDriver) {
+ LnshStationDeviceDriver driver = (LnshStationDeviceDriver) nextDevice.getDeviceDriver();
+ if (driver.getMode() != 0
+ && driver.getMove() == 0
+ && (driver.getAction() == 2 || driver.getAction() == 3)
+ && (driver.getIo_action() == 1 || driver.getIo_action() == 3)) {
+ this.writing("to_command1", "3");
+ driver.setMessage("");
+ logServer.deviceExecuteLog(nextDevice.getDevice_code(), "", "", "允许RGV前工位放货。");
+ } else {
+ String msg = "";
+ if (driver.getMode() == 0) {
+ msg += "站点未联机,";
+ } else {
+ if (driver.getMove() != 0) {
+ msg += "站点有货,";
+ }
+ if (driver.getIo_action() != 1 && driver.getIo_action() != 3) {
+ msg += "站点不允许进入,";
+ }
+ if (driver.getAction() != 2 && driver.getAction() != 3) {
+ msg += "站点不允许放货,";
+ }
+ }
+ msg += "不允许RGV前工位放货。";
+ driver.setMessage(msg);
+ logServer.deviceExecuteLog(nextDevice.getDevice_code(), "", "", msg);
+ }
+ } else if (nextDevice.getDeviceDriver() instanceof LnshPackageSiteDeviceDriver) {
+ LnshPackageSiteDeviceDriver driver = (LnshPackageSiteDeviceDriver) nextDevice.getDeviceDriver();
+ if (driver.getMode() != 0
+ && driver.getMove() == 0
+ && (driver.getAction() == 2 || driver.getAction() == 3)
+ && (driver.getIoaction() == 1 || driver.getIoaction() == 3)) {
+ this.writing("to_command1", "3");
+ driver.setMessage("");
+ logServer.deviceExecuteLog(nextDevice.getDevice_code(), "", "", "允许RGV前工位放货。");
+ } else {
+ String msg = "";
+ if (driver.getMode() == 0) {
+ msg += "站点未联机,";
+ } else {
+ if (driver.getMove() != 0) {
+ msg += "站点有货,";
+ }
+ if (driver.getIoaction() != 1 && driver.getIoaction() != 3) {
+ msg += "站点不允许进入,";
+ }
+ if (driver.getAction() != 2 && driver.getAction() != 3) {
+ msg += "站点不允许放货,";
+ }
+ }
+ msg += "不允许RGV前工位放货。";
+ driver.setMessage(msg);
+ logServer.deviceExecuteLog(nextDevice.getDevice_code(), "", "", msg);
+ }
+ }
+ }
+
+ //后工位取货时判断取货位光电信号
+ if (mode == 3 && error == 0 && status != 3 && action2 == 1 && move2 == 0 && task2 > 0) {
+ Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task2));
+ String start_device_code = inst1.getStart_device_code();
+ Device startDevice = deviceAppservice.findDeviceByCode(start_device_code);
+ if (startDevice.getDeviceDriver() instanceof LnshLaminatingMachineDeviceDriver) {
+ LnshLaminatingMachineDeviceDriver driver = (LnshLaminatingMachineDeviceDriver) startDevice.getDeviceDriver();
+ if (driver.getMode() != 0
+ && driver.getMove() != 0) {
+ this.writing("to_command2", "2");
+ driver.setMessage("");
+ logServer.deviceExecuteLog(startDevice.getDevice_code(), "", "", "允许RGV后工位取货。");
+ } else {
+ String msg = "";
+ if (driver.getMode() == 0) {
+ msg += "站点未联机,";
+ } else {
+ if (driver.getMove() == 0) {
+ msg += "站点无货,";
+ }
+ }
+ msg += "不允许RGV后工位取货。";
+ driver.setMessage(msg);
+ logServer.deviceExecuteLog(startDevice.getDevice_code(), "", "", msg);
+ }
+ } else if (startDevice.getDeviceDriver() instanceof LnshStationDeviceDriver) {
+ LnshStationDeviceDriver driver = (LnshStationDeviceDriver) startDevice.getDeviceDriver();
+ if (driver.getMode() != 0
+ && driver.getMove() != 0
+ && (driver.getIo_action() == 3 || driver.getIo_action() == 1)
+ && (driver.getAction() == 3 || driver.getAction() == 1)) {
+ this.writing("to_command2", "2");
+ driver.setMessage("");
+ logServer.deviceExecuteLog(startDevice.getDevice_code(), "", "", "允许RGV后工位取货。");
+ } else {
+ String msg = "";
+ if (driver.getMode() == 0) {
+ msg += "站点未联机,";
+ } else {
+ if (driver.getMove() == 0) {
+ msg += "站点无货,";
+ }
+ if (driver.getIo_action() != 3 && driver.getIo_action() != 1) {
+ msg += "站点不允许进入,";
+ }
+ if (driver.getAction() != 3 && driver.getAction() != 1) {
+ msg += "站点不允许取货,";
+ }
+ }
+ msg += "不允许RGV后工位取货。";
+ driver.setMessage(msg);
+ logServer.deviceExecuteLog(startDevice.getDevice_code(), "", "", msg);
+ }
+ }
+ }
+
+ //后工位放货时判断放货位光电信号
+ if (mode == 3 && error == 0 && status != 3 && action2 == 3 && move2 != 0 && task2 > 0 && action1 != 1) {
+ Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task2));
+ String next_device_code = inst1.getNext_device_code();
+ Device nextDevice = deviceAppservice.findDeviceByCode(next_device_code);
+ if (nextDevice.getDeviceDriver() instanceof LnshPalletizingManipulatorSiteDeviceDriver) {
+ LnshPalletizingManipulatorSiteDeviceDriver driver = (LnshPalletizingManipulatorSiteDeviceDriver) nextDevice.getDeviceDriver();
+ if (driver.getMode() != 0
+ && driver.getMove() == 0
+ && (driver.getIo_action() == 1 || driver.getIo_action() == 3)
+ && (driver.getAction() == 2 || driver.getAction() == 3)) {
+ this.writing("to_command2", "3");
+ driver.setMessage("");
+ logServer.deviceExecuteLog(nextDevice.getDevice_code(), "", "", "允许RGV后工位放货。");
+ } else {
+ String msg = "";
+ if (driver.getMode() == 0) {
+ msg += "站点未联机,";
+ } else {
+ if (driver.getMove() != 0) {
+ msg += "站点有货,";
+ }
+ if (driver.getIo_action() != 1 && driver.getIo_action() != 3) {
+ msg += "站点不允许进入,";
+ }
+ if (driver.getAction() != 2 && driver.getAction() != 3) {
+ msg += "站点不允许放货,";
+ }
+ }
+ msg += "不允许RGV后工位放货。";
+ driver.setMessage(msg);
+ logServer.deviceExecuteLog(device_code, "", "", msg);
+ }
+ } else if (nextDevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
+ this.writing("to_command2", "3");
+ logServer.deviceExecuteLog(nextDevice.getDevice_code(), "", "", "允许RGV后工位放货。");
+ }
}
} 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);
- writing("to_command1", "0");
- writing("to_onset1", "0");
- writing("to_target1", "0");
- writing("to_task1", "0");
-
- }
- }
- }
-
- 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);
- writing("to_command2", "0");
- writing("to_onset2", "0");
- writing("to_target2", "0");
- writing("to_task2", "0");
- }
- }
- }
-
- //执行双任务下的业务逻辑
- //给后工位下发空盘放货信号
- if (mode == 3 && action_1 == 2 && action_2 == 2 && move_1 != 0 && move_2 != 0 && task1 > 0 && task2 > 0) {
- writing("to_command2", "2");
- }
- //给前工位下发放货信号
- if (mode == 3 && action_2 == 4 && move_1 != 0 && move_2 == 0 && task1 > 0) {
- writing("to_command1", "2");
- }
-
- //执行单任务下的业务逻辑
- //给后工位下发空盘放货信号
- //判断条件 前工位无任务、无货 后工位有任务取货完成
- if (mode == 3 && action_2 == 2 && move_2 != 0 && move_1 == 0 && task2 > 0 && task1 == 0) {
- writing("to_command2", "2");
- }
- //给前工位取满托下发放货信号
- if (mode == 3 && action_1 == 2 && move_1 != 0 && move_2 == 0 && task1 > 0 && task2 == 0) {
- writing("to_command1", "2");
- }
-
- if (mode == 0) {
+ if (!this.itemProtocol.getIsonline()) {
+ this.setIsonline(false);
+ this.setIserror(true);
+ message = "信号量同步异常";
+ //未联机
+ } else if (mode == 0) {
this.setIsonline(false);
this.setIserror(true);
message = "未联机";
@@ -290,41 +514,32 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
return;
case 2:
//后工位申请任务
- if (mode == 2 && move_2 == 0 && action_2 == 0 && !requireSucess2) {
+ if (mode == 2 && move2 == 0 && action2 == 0 && !requireBackSucess && task2 == 0) {
+ logServer.deviceExecuteLog(this.device_code, "", "", "RGV开始申请后工位任务。");
instruction_require2();
}
//前工位申请任务
- if (mode == 2 && move_2 == 0 && action_2 == 0 && move_1 == 0 && task2 == 0 && !requireSucess1) {
-// System.out.println("move_2:" + move_2 + ",action_2:" + action_2 + ",move_1:" + move_1 + ",task2:" + task2 + ",requireSucess1:" + requireSucess1);
+ if (mode == 2 && move2 == 0 && action2 == 0 && task2 == 0 && move1 == 0 && !requireHeadSucess && !requireBackSucess && task1 == 0) {
+ logServer.deviceExecuteLog(this.device_code, "", "", "RGV开始申请前工位任务。");
instruction_require();
}
break;
case 3:
//前工位申请任务
- if (mode == 3 && move_2 == 1 && action_2 == 1 && move_1 == 0 && !requireSucess1) {
+ if (mode == 3 && action2 == 1 && move1 == 0 && !requireHeadSucess && task1 == 0) {
+ logServer.deviceExecuteLog(this.device_code, "", "", "RGV开始申请前工位任务。");
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_move1 = move1;
+ last_move2 = move2;
+ last_action1 = action1;
+ last_action2 = action2;
last_walk_y = walk_y;
last_task1 = task1;
last_task2 = task2;
@@ -335,6 +550,242 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
}
+ //申请前工位任务
+ public synchronized boolean instruction_require() {
+ Date date = new Date();
+ if (date.getTime() - this.instruction_head_time.getTime() < (long) this.instruction_require_time_out) {
+ log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_head_time);
+ return false;
+ } else {
+ this.instruction_head_time = date;
+ //前工位取货关联设备
+ List getDeviceCodeList = this.getExtraDeviceCodes("get_device_code1");
+ //前工位放货关联设备
+ List putDeviceCodeList = this.getExtraDeviceCodes("put_device_code1");
+ TaskDto task = null;
+ if (mode == 3) {
+ Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task2));
+ getDeviceCodeList = new ArrayList() {{
+ add(inst2.getNext_device_code());
+ }};
+ }
+ for (int i = 0; i < getDeviceCodeList.size(); i++) {
+ String startDeviceCode = getDeviceCodeList.get(i);
+ List taskDtos = taskserver.queryTaskByDeviceCodeAndStatus(startDeviceCode);
+ if (ObjectUtil.isNotEmpty(taskDtos)) {
+ TaskDto taskDto = taskDtos.get(0);
+ if (!putDeviceCodeList.contains(taskDto.getNext_device_code())) {
+ continue;
+ }
+ Instruction instruction = instructionService.findByTaskcode(taskDto.getTask_code());
+ instruction.setInstruction_status("1");
+ instruction.setUpdate_time(DateUtil.now());
+ instructionService.update(instruction);
+ this.sendHeadSignalType(instruction);
+ requireHeadSucess = true;
+ logServer.deviceExecuteLog(device_code, "", "", "RGV申请前工位任务成功,任务为重新创建指令的任务,指令号:" + instruction.getInstruction_code());
+ return true;
+ } else {
+ List taskDtoList = taskserver.queryTaskByDeviceCode(startDeviceCode);
+ if (ObjectUtil.isNotEmpty(taskDtoList)) {
+ task = taskDtoList.get(0);
+ if (!putDeviceCodeList.contains(task.getNext_device_code())) {
+ continue;
+ }
+ }
+ if (ObjectUtil.isNotEmpty(task)) break;
+ }
+ }
+
+ if (!ObjectUtil.isEmpty(task)) {
+ String taskid = task.getTask_id();
+ String taskcode = task.getTask_code();
+ String vehiclecode = task.getVehicle_code();
+ String priority = task.getPriority();
+ String start_point_code = task.getStart_point_code();
+ String start_device_code = task.getStart_device_code();
+ String route_plan_code = task.getRoute_plan_code();
+ String next_point_code = task.getNext_point_code();
+ String next_device_code = task.getNext_device_code();
+
+ Instruction instdto = new Instruction();
+ instdto.setInstruction_id(IdUtil.simpleUUID());
+ instdto.setRoute_plan_code(route_plan_code);
+ instdto.setRemark(task.getRemark());
+ instdto.setMaterial(task.getMaterial());
+ instdto.setQuantity(task.getQuantity());
+ instdto.setTask_id(taskid);
+ instdto.setTask_code(taskcode);
+ instdto.setVehicle_code(vehiclecode);
+ String now = DateUtil.now();
+ instdto.setCreate_time(now);
+ instdto.setCreate_by("auto");
+ instdto.setStart_device_code(start_device_code);
+ instdto.setNext_device_code(next_device_code);
+ instdto.setStart_point_code(start_point_code);
+ instdto.setNext_point_code(next_point_code);
+ instdto.setPriority(priority);
+ instdto.setInstruction_status("0");
+ instdto.setExecute_device_code(start_point_code);
+
+ try {
+ instructionService.create(instdto);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ //创建指令后修改任务状态
+ task.setTask_status("1");
+ task.setUpdate_time(DateUtil.now());
+ taskserver.update(task);
+ this.sendHeadSignalType(instdto);
+ requireHeadSucess = true;
+ logServer.deviceExecuteLog(this.device_code, "", "", "RGV申请前工位任务成功,任务为就绪状态下的任务,指令号:" + instdto.getInstruction_code());
+ } else {
+ logServer.deviceExecuteLog(this.device_code, "", "", "RGV申请前工位任务失败,未找到前工位取货位关联设备的起点任务!");
+ }
+ }
+ return true;
+ }
+
+ //申请后工位任务
+ public synchronized boolean instruction_require2() {
+ Date date = new Date();
+ if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
+ log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time);
+ return false;
+ } else {
+ this.instruction_require_time = date;
+
+ //后工位取货关联设备
+ List getDeviceCodeList = this.getExtraDeviceCodes("get_device_code2");
+ //后工位放货关联设备
+ List putDeviceCodeList = this.getExtraDeviceCodes("put_device_code2");
+
+ TaskDto task = null;
+ for (int i = 0; i < getDeviceCodeList.size(); i++) {
+ String startDeviceCode = getDeviceCodeList.get(i);
+ List taskDtos = taskserver.queryTaskByDeviceCodeAndStatus(startDeviceCode);
+ if (ObjectUtil.isNotEmpty(taskDtos)) {
+ TaskDto taskDto = taskDtos.get(0);
+ if (!putDeviceCodeList.contains(taskDto.getNext_device_code())) {
+ continue;
+ }
+ Instruction instruction = instructionService.findByTaskcode(taskDto.getTask_code());
+ instruction.setInstruction_status("1");
+ instruction.setUpdate_time(DateUtil.now());
+ instructionService.update(instruction);
+ this.sendBackSignalType(instruction);
+ requireBackSucess = true;
+ logServer.deviceExecuteLog(this.device_code, "", "", "RGV申请后工位任务成功,任务为重新创建指令的任务,指令号:" + instruction.getInstruction_code());
+ return true;
+ } else {
+ List taskDtoList = taskserver.queryTaskByDeviceCode(startDeviceCode);
+ if (ObjectUtil.isNotEmpty(taskDtoList)) {
+ task = taskDtoList.get(0);
+ if (!putDeviceCodeList.contains(task.getNext_device_code())) {
+ continue;
+ }
+ }
+ if (ObjectUtil.isNotEmpty(task)) break;
+ }
+ }
+
+ if (!ObjectUtil.isEmpty(task)) {
+ String taskid = task.getTask_id();
+ String taskcode = task.getTask_code();
+ String vehiclecode = task.getVehicle_code();
+ String priority = task.getPriority();
+ String start_point_code = task.getStart_point_code();
+ String start_device_code = task.getStart_device_code();
+ String route_plan_code = task.getRoute_plan_code();
+ String next_point_code = task.getNext_point_code();
+ String next_device_code = task.getNext_device_code();
+
+ Instruction instdto = new Instruction();
+ instdto.setInstruction_id(IdUtil.simpleUUID());
+ instdto.setRoute_plan_code(route_plan_code);
+ instdto.setRemark(task.getRemark());
+ instdto.setMaterial(task.getMaterial());
+ instdto.setQuantity(task.getQuantity());
+ instdto.setTask_id(taskid);
+ instdto.setTask_code(taskcode);
+ instdto.setVehicle_code(vehiclecode);
+ String now = DateUtil.now();
+ instdto.setCreate_time(now);
+ instdto.setCreate_by("auto");
+ instdto.setStart_device_code(start_device_code);
+ instdto.setNext_device_code(next_device_code);
+ instdto.setStart_point_code(start_point_code);
+ instdto.setNext_point_code(next_point_code);
+ instdto.setPriority(priority);
+ instdto.setInstruction_status("0");
+ instdto.setExecute_device_code(start_point_code);
+
+ try {
+ instructionService.create(instdto);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ //创建指令后修改任务状态
+ task.setTask_status("1");
+ taskserver.update(task);
+ this.sendBackSignalType(instdto);
+ requireBackSucess = true;
+ logServer.deviceExecuteLog(this.device_code, "", "", "RGV申请后工位任务成功,任务为就绪状态下的任务,指令号:" + instdto.getInstruction_code());
+ } else {
+ logServer.deviceExecuteLog(this.device_code, "", "", "RGV申请后工位任务失败,未找到后工位取货位关联设备的起点任务!");
+ }
+ }
+ return true;
+ }
+
+ public synchronized void sendHeadSignalType(Instruction dto) {
+ String start_device_code = dto.getStart_device_code();
+ String next_device_code = dto.getNext_device_code();
+ Device startDevice = deviceAppservice.findDeviceByCode(start_device_code);
+ Device nextDevice = deviceAppservice.findDeviceByCode(next_device_code);
+ this.isSetAddress(startDevice);
+ this.isSetAddress(nextDevice);
+ String start_addr = startDevice.getExtraValue().get("OPCServer").toString();
+ String next_addr = nextDevice.getExtraValue().get("OPCServer").toString();
+ this.writing("to_onset1", start_addr);
+ this.writing("to_target1", next_addr);
+ this.writing("to_task1", dto.getInstruction_code());
+ this.writing("to_command1", "1");
+ this.writing("to_onset1", start_addr);
+ this.writing("to_target1", next_addr);
+ this.writing("to_task1", dto.getInstruction_code());
+ this.writing("to_command1", "1");
+ }
+
+ public synchronized void sendBackSignalType(Instruction dto) {
+ String start_device_code = dto.getStart_device_code();
+ String next_device_code = dto.getNext_device_code();
+ Device startDevice = deviceAppservice.findDeviceByCode(start_device_code);
+ Device nextDevice = deviceAppservice.findDeviceByCode(next_device_code);
+ this.isSetAddress(startDevice);
+ this.isSetAddress(nextDevice);
+ String start_addr = startDevice.getExtraValue().get("OPCServer").toString();
+ String next_addr = nextDevice.getExtraValue().get("OPCServer").toString();
+ this.writing("to_onset2", start_addr);
+ this.writing("to_target2", next_addr);
+ this.writing("to_task2", dto.getInstruction_code());
+ this.writing("to_command2", "1");
+ this.writing("to_onset2", start_addr);
+ this.writing("to_target2", next_addr);
+ this.writing("to_task2", dto.getInstruction_code());
+ this.writing("to_command2", "1");
+ }
+
+ //判断点位是否设置电气值
+ public void isSetAddress(Device device) {
+ if (ObjectUtil.isEmpty(device.getExtraValue().get("OPCServer"))) {
+ throw new BadRequestException("设备:" + device.getDevice_code() + "未设置电气调度号!");
+ }
+ }
+
public boolean exe_error() {
if (this.error == 0) {
return true;
@@ -344,187 +795,19 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
}
}
+ public void writing(String param, String value) {
- 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 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_command1, command);
+ itemMap.put(to_param, value);
+
ReadUtil.write(itemMap, server);
-
+ logServer.deviceExecuteLog(this.device_code, "", "", param + " 写入 " + value);
}
- 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) {
ReadUtil.write(itemMap, server);
}
- public void writing(int command) {
+ 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 writing2(int command) {
+ String to_command2 = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ + "." + ItemProtocol.item_to_command2;
- 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_command2, command);
ReadUtil.write(itemMap, server);
+
}
- public void writeMap(Map map) {
- HashMap writeMap = new HashMap<>();
- for (Map.Entry e : map.entrySet()) {
- String key = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
- + "." + e.getKey();
- writeMap.put(key, e.getValue());
+ //将扩展表中的字符串数组数据转换成集合
+ public List getExtraDeviceCodes(String extraName) {
+ String extraValue = (String) this.getDevice().getExtraValue().get(extraName);
+ if (StrUtil.isEmpty(extraValue)) {
+ return new ArrayList<>();
+ }
+ String devicesString = extraValue.substring(1, extraValue.length() - 1);
+ List devicesList = new ArrayList<>();
+ String[] devices = devicesString.split(",");
+ for (int i = 0; i < devices.length; i++) {
+ String s = devices[i].replace("\"", "").replace("\"", "");
+ devicesList.add(s);
+ }
+ return devicesList;
+ }
+
+ @Override
+ public JSONObject getDeviceStatusName() {
+ String mode;
+ String status;
+ String move_1;
+ String move_2;
+ String action_1;
+ String action_2;
+
+ switch (this.mode) {
+ case 0:
+ mode = "脱机";
+ break;
+ case 2:
+ mode = "待机";
+ break;
+ case 3:
+ mode = "运行中";
+ break;
+ default:
+ mode = String.valueOf(this.mode);
}
- String opcservcerid = this.getDevice().getOpc_server_id();
- Server server = ReadUtil.getServer(opcservcerid);
- ReadUtil.write(writeMap, server);
+ switch (this.status) {
+ case 1:
+ status = "待机";
+ break;
+ case 2:
+ status = "生产中";
+ break;
+ case 3:
+ status = "故障";
+ break;
+ default:
+ status = String.valueOf(this.status);
+ }
+
+ if (this.move1 == 0) {
+ move_1 = "无货";
+ } else {
+ move_1 = "有货";
+ }
+
+ if (this.move2 == 0) {
+ move_2 = "无货";
+ } else {
+ move_2 = "有货";
+ }
+
+ switch (this.action1) {
+ case 0:
+ action_1 = "无动作";
+ break;
+ case 1:
+ action_1 = "请求取货";
+ break;
+ case 2:
+ action_1 = "取货完成";
+ break;
+ case 3:
+ action_1 = "请求放货";
+ break;
+ case 4:
+ action_1 = "放货完成";
+ break;
+ default:
+ action_1 = String.valueOf(this.action1);
+ }
+
+ switch (this.action2) {
+ case 0:
+ action_2 = "无动作";
+ break;
+ case 1:
+ action_2 = "请求取货";
+ break;
+ case 2:
+ action_2 = "取货完成";
+ break;
+ case 3:
+ action_2 = "请求放货";
+ break;
+ case 4:
+ action_2 = "放货完成";
+ break;
+ default:
+ action_2 = String.valueOf(this.action2);
+ }
+
+ JSONObject jo = new JSONObject();
+ jo.put("mode", mode);
+ jo.put("status", status);
+ jo.put("move_1", move_1);
+ jo.put("move_2", move_2);
+ jo.put("action_1", action_1);
+ jo.put("action_2", action_2);
+ jo.put("walk_y", walk_y);
+ jo.put("task1", task1);
+ jo.put("task2", task2);
+ jo.put("open_time", open_time);
+ jo.put("standby_time", standby_time);
+ jo.put("production_time", production_time);
+ jo.put("error_time", error_time);
+ jo.put("isError", iserror);
+ jo.put("isOnline", isonline);
+ jo.put("message", message);
+ return jo;
+ }
+
+ @Override
+ public void setDeviceStatus(JSONObject data) {
+
}
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_split_manipulator/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_split_manipulator/ItemProtocol.java
index 89d0e87..17eb148 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_split_manipulator/ItemProtocol.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_split_manipulator/ItemProtocol.java
@@ -2,7 +2,8 @@ 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.Getter;
+import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
@@ -10,7 +11,8 @@ import java.util.ArrayList;
import java.util.List;
@Slf4j
-@Data
+@Getter
+@Setter
public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
@@ -168,10 +170,9 @@ public class ItemProtocol {
return this.getOpcStringValue(item_barcode);
}
- public int getOpen_time() {
- return this.getOpcIntegerValue(item_open_time);
+ public String getOpen_time() {
+ return this.getOpcStringValue(item_open_time);
}
-
public int getStandby_time() {
return this.getOpcIntegerValue(item_standby_time);
}
@@ -694,7 +695,7 @@ public class ItemProtocol {
public String getOpcStringValue(String protocol) {
String value = this.driver.getStringValue(protocol);
- if (StrUtil.isEmpty(value)) {
+ if (StrUtil.isBlank(value)) {
// log.error("读取错误!");
} else {
return value;
@@ -705,7 +706,7 @@ public class ItemProtocol {
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_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"));
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_split_manipulator/LnshSplitManipulatorDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_split_manipulator/LnshSplitManipulatorDefination.java
index 84498b6..4a173b1 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_split_manipulator/LnshSplitManipulatorDefination.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_split_manipulator/LnshSplitManipulatorDefination.java
@@ -58,7 +58,7 @@ public class LnshSplitManipulatorDefination implements OpcDeviceDriverDefination
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_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"));
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_split_manipulator/LnshSplitManipulatorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_split_manipulator/LnshSplitManipulatorDeviceDriver.java
index 45aea36..58c24c7 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_split_manipulator/LnshSplitManipulatorDeviceDriver.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_split_manipulator/LnshSplitManipulatorDeviceDriver.java
@@ -1,9 +1,11 @@
package org.nl.acs.device_driver.lnsh.lnsh_split_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.Getter;
+import lombok.Setter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
@@ -29,21 +31,22 @@ import java.util.*;
* 晟华拆垛机械手
*/
@Slf4j
-@Data
+@Getter
+@Setter
@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;
@@ -79,8 +82,8 @@ public class LnshSplitManipulatorDeviceDriver extends AbstractOpcDeviceDriver im
String device_code;
//开机时间
- int open_time = 0;
- int last_open_time = 0;
+ String open_time = "0";
+ String last_open_time = "0";
//待机时间
int standby_time = 0;
int last_standby_time = 0;
@@ -301,276 +304,276 @@ public class LnshSplitManipulatorDeviceDriver extends AbstractOpcDeviceDriver im
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);
+ 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);
+ 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);
+ 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 (!open_time.equals(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);
+ 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);
+ 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);
+ 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(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 (!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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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) {
@@ -603,44 +606,33 @@ public class LnshSplitManipulatorDeviceDriver extends AbstractOpcDeviceDriver im
log.debug("设备运转模式:等待工作");
return;
case 2:
- break;
- case 4:
- //获取托盘信息
- if (!requireSucess) {
- getVehicle();
- }
- break;
- case 5:
- //拆垛完成
- if (!requireSucess) {
- palletizing();
- }
- break;
- case 6:
- //申请出库
- if (!requireSucess) {
- callMaterial();
- }
- break;
- case 7:
- //申请空盘
- if (!requireSucess) {
- applyEmpty();
- }
break;
+// case 4:
+// //获取托盘信息
+// if (!requireSucess) {
+// getVehicle();
+// }
+// break;
+// case 5:
+// //拆垛完成
+// if (!requireSucess) {
+// palletizing();
+// }
+// break;
+// case 6:
+// //申请出库
+// if (!requireSucess) {
+// callMaterial();
+// }
+// break;
+// case 7:
+// //申请空盘
+// if (!requireSucess) {
+// applyEmpty();
+// }
+// break;
}
- switch (flag) {
- //取货完成
- case 1:
- writing(2);
- return;
- //放货完成
- case 2:
- writing(3);
- return;
-
- }
}
last_mode = mode;
@@ -737,13 +729,13 @@ public class LnshSplitManipulatorDeviceDriver extends AbstractOpcDeviceDriver im
} 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 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);
+ json.put("device_code", demoList.get(getStation - 1).replace("\"", ""));
+ json.put("vehicle_code", barcode);
+ JSONObject jo = new JSONObject();
if (jo.getInteger("status") == 200) {
JSONObject content = jo.getJSONObject("data");
@@ -809,64 +801,64 @@ public class LnshSplitManipulatorDeviceDriver extends AbstractOpcDeviceDriver im
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("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;
}
@@ -887,18 +879,20 @@ public class LnshSplitManipulatorDeviceDriver extends AbstractOpcDeviceDriver im
} 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 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);
+ 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;
+ if (ObjectUtil.isNotEmpty(result)) {
+ if (result.getStatus() == 200) {
+ this.writing(this.mode);
+ requireSucess = true;
+ }
}
return true;
}
@@ -917,16 +911,19 @@ public class LnshSplitManipulatorDeviceDriver extends AbstractOpcDeviceDriver im
} 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 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");
+ 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;
+ if (ObjectUtil.isNotEmpty(result)) {
+ if (result.getStatus() == 200) {
+ this.writing(this.mode);
+ requireSucess = true;
+ }
}
return true;
}
@@ -945,17 +942,19 @@ public class LnshSplitManipulatorDeviceDriver extends AbstractOpcDeviceDriver im
} 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 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);
+ 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);
+ if (ObjectUtil.isNotEmpty(result)) {
+ if (result.getStatus() == 200) {
+ this.writing(this.mode);
+ }
}
requireSucess = true;
@@ -976,11 +975,13 @@ public class LnshSplitManipulatorDeviceDriver extends AbstractOpcDeviceDriver im
Server server = ReadUtil.getServer(opcservcerid);
Map itemMap = new HashMap();
ReadUtil.write(itemMap, server);
+ server.disconnect();
}
public void executing(Server server, Map itemMap) {
ReadUtil.write(itemMap, server);
+ server.disconnect();
}
public void writing(int feedback) {
@@ -991,6 +992,8 @@ public class LnshSplitManipulatorDeviceDriver extends AbstractOpcDeviceDriver im
Map itemMap = new HashMap();
itemMap.put(to_feedback, feedback);
ReadUtil.write(itemMap, server);
+ server.disconnect();
+ logServer.deviceExecuteLog(this.device_code, "", "", "to_feedback 写入 " + feedback);
}
public void writing(int type, int command) {
@@ -998,6 +1001,7 @@ public class LnshSplitManipulatorDeviceDriver extends AbstractOpcDeviceDriver im
Server server = ReadUtil.getServer(opcservcerid);
Map itemMap = new HashMap();
ReadUtil.write(itemMap, server);
+ server.disconnect();
}
@@ -1011,5 +1015,7 @@ public class LnshSplitManipulatorDeviceDriver extends AbstractOpcDeviceDriver im
itemMap.put(to_param, value);
ReadUtil.write(itemMap, server);
+ server.disconnect();
+ logServer.deviceExecuteLog(this.device_code, "", "", param + " 写入 " + value);
}
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/ItemProtocol.java
index fbc2abb..26d0077 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/ItemProtocol.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/ItemProtocol.java
@@ -1,7 +1,8 @@
package org.nl.acs.device_driver.lnsh.lnsh_station;
import cn.hutool.core.util.StrUtil;
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
@@ -9,7 +10,8 @@ import java.util.ArrayList;
import java.util.List;
@Slf4j
-@Data
+@Getter
+@Setter
public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
@@ -106,7 +108,7 @@ public class ItemProtocol {
}
public String getOpcStringValue(String protocol) {
String value = this.driver.getStringValue(protocol);
- if (StrUtil.isEmpty(value)) {
+ if (StrUtil.isBlank(value)) {
// log.error("读取错误!");
} else {
return value;
@@ -117,7 +119,7 @@ public class ItemProtocol {
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_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"));
@@ -125,7 +127,7 @@ public class ItemProtocol {
list.add(new ItemDto(item_task, "任务号", "DB4.D6"));
list.add(new ItemDto(item_weight, "重量", "DB4.D10"));
list.add(new ItemDto(item_material, "物料", "DB4.STRING14.50"));
- list.add(new ItemDto(item_barcode, "条码", "DB4.W64"));
+ list.add(new ItemDto(item_barcode, "条码", "DB4.W66"));
return list;
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDefination.java
index 357fc1f..100e782 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDefination.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDefination.java
@@ -58,7 +58,7 @@ public class LnshStationDefination implements OpcDeviceDriverDefination {
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_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"));
@@ -66,7 +66,7 @@ public class LnshStationDefination implements OpcDeviceDriverDefination {
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.STRING14.50"));
- list.add(new ItemDto(ItemProtocol.item_barcode, "条码", "DB4.W64"));
+ list.add(new ItemDto(ItemProtocol.item_barcode, "条码", "DB4.W66"));
return list;
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDeviceDriver.java
index 15c0ebb..63b5e3f 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDeviceDriver.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDeviceDriver.java
@@ -4,7 +4,8 @@ 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.Getter;
+import lombok.Setter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
@@ -17,12 +18,14 @@ 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.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService;
import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
import java.util.Date;
import java.util.HashMap;
@@ -33,21 +36,22 @@ import java.util.Map;
* 晟华-工位(交互模板)
*/
@Slf4j
-@Data
+@Getter
+@Setter
@RequiredArgsConstructor
-public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
+public class LnshStationDeviceDriver 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");
String device_code;
@@ -129,40 +133,40 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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(material, last_material)) {
+ logServer.deviceItemValue(this.device_code, "material", material);
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号material:" + last_material + " -> " + material);
}
if (barcode != last_barcode) {
- logServer.deviceItemValue(this.device_code,"barcode", String.valueOf(barcode));
- logServer.deviceExecuteLog(this.device_code,"","","信号barcode:" + last_barcode + "->" + barcode);
+ logServer.deviceItemValue(this.device_code, "barcode", String.valueOf(barcode));
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号barcode:" + last_barcode + " -> " + barcode);
}
} catch (Exception var17) {
@@ -189,6 +193,7 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
message = "";
Instruction instruction = null;
List toInstructions;
+ Object ignore_pickup_check = this.getExtraValue().get("ignore_pickup_check");
switch (mode) {
case 1:
log.debug("设备运转模式:等待工作");
@@ -197,26 +202,50 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
break;
case 4:
//叫料
- if (!requireSucess && this.move == 0) {
- callMaterial();
+ if (ObjectUtil.isNotEmpty(ignore_pickup_check) && "true".equals(ignore_pickup_check.toString())) {
+ if (!requireSucess) {
+ callMaterial();
+ }
+ } else {
+ if (!requireSucess && this.move == 0) {
+ callMaterial();
+ }
}
break;
case 5:
//申请空盘
- if (!requireSucess && this.move == 0) {
- applyEmpty();
+ if (ObjectUtil.isNotEmpty(ignore_pickup_check) && "true".equals(ignore_pickup_check.toString())) {
+ if (!requireSucess) {
+ applyEmpty();
+ }
+ } else {
+ if (!requireSucess && this.move == 0) {
+ applyEmpty();
+ }
}
break;
case 6:
//申请入库
- if (!requireSucess && this.move != 0) {
- putStorage();
+ if (ObjectUtil.isNotEmpty(ignore_pickup_check) && "true".equals(ignore_pickup_check.toString())) {
+ if (!requireSucess) {
+ putStorage();
+ }
+ } else {
+ if (!requireSucess && this.move != 0) {
+ putStorage();
+ }
}
break;
case 7:
//申请出窑分配
- if (!requireSucess && this.move != 0) {
- applyOuttoKiln();
+ if (ObjectUtil.isNotEmpty(ignore_pickup_check) && "true".equals(ignore_pickup_check.toString())) {
+ if (!requireSucess) {
+ applyOuttoKiln();
+ }
+ } else {
+ if (!requireSucess && this.move != 0) {
+ applyOuttoKiln();
+ }
}
break;
case 8:
@@ -225,18 +254,40 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
// reverseGroup();
// }
break;
+ case 11:
+ // 半托缓存强制去包装
+ if (ObjectUtil.isNotEmpty(ignore_pickup_check) && "true".equals(ignore_pickup_check.toString())) {
+ if (!requireSucess) {
+ toPackage();
+ }
+ } else {
+ if (!requireSucess && this.move != 0) {
+ toPackage();
+ }
+ }
+ case 15:
+ // 送空托盘
+ if (ObjectUtil.isNotEmpty(ignore_pickup_check) && "true".equals(ignore_pickup_check.toString())) {
+ if (!requireSucess) {
+ sendEmpty();
+ }
+ } else {
+ if (!requireSucess && this.move != 0) {
+ sendEmpty();
+ }
+ }
}
- switch (flag) {
- //取货完成
- case 2:
- writing(2);
- return;
- //放货完成
- case 4:
- writing(3);
- return;
- }
+// switch (flag) {
+// //取货完成
+// case 2:
+// writing(2);
+// return;
+// //放货完成
+// case 4:
+// writing(3);
+// return;
+// }
}
last_mode = mode;
@@ -264,14 +315,16 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
} else {
this.instruction_require_time = date;
JSONObject json = new JSONObject();
- json.put("device_code",this.device_code);
- json.put("type","4");
+ json.put("device_code", this.device_code);
+ 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(1);
- this.setRequireSucess(true);
+ if (result.getStatus() == HttpStatus.OK.value()) {
+ JSONObject jsonObject = JSONObject.parseObject(result.body());
+ if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
+ this.writing(this.mode);
+ this.setRequireSucess(true);
+ }
}
}
return true;
@@ -291,17 +344,19 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
} else {
this.instruction_require_time = date;
JSONObject json = new JSONObject();
- json.put("device_code",this.device_code);
- json.put("type","2");
- json.put("qty",weight);
- json.put("vehicle_code",barcode);
- json.put("is_full","1");
+ json.put("device_code", this.device_code);
+ json.put("type", "2");
+ json.put("qty", weight);
+ 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(this.mode);
- this.setRequireSucess(true);
+ if (result.getStatus() == HttpStatus.OK.value()) {
+ JSONObject jsonObject = JSONObject.parseObject(result.body());
+ if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
+ this.writing(this.mode);
+ this.setRequireSucess(true);
+ }
}
}
return true;
@@ -321,17 +376,19 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
} 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");
+ json.put("device_code", this.device_code);
+ json.put("type", "1");
+ json.put("weight", weight);
+ 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);
+ if (result.getStatus() == HttpStatus.OK.value()) {
+ JSONObject jsonObject = JSONObject.parseObject(result.body());
+ if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
+ this.writing(this.mode);
+ this.setRequireSucess(true);
+ }
}
}
@@ -353,17 +410,19 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
} else {
this.instruction_require_time = date;
JSONObject json = new JSONObject();
- json.put("device_code",this.device_code);
- json.put("vehicle_code",barcode);
+ json.put("device_code", this.device_code);
+ json.put("vehicle_code", barcode);
HttpResponse result = acsToWmsService.applyOuttoKiln(json);
if (ObjectUtil.isNotEmpty(result)) {
- JSONObject jsonObject = JSONObject.parseObject(result.body());
- if (result.getStatus() == 200 || StrUtil.equals(jsonObject.getString("status"), "200")) {
- JSONObject jo = JSONObject.parseObject(result.body());
- String is_package = jo.getString("is_package");
- this.writing(2, Integer.parseInt(is_package));
- this.writing(1);
- requireSucess = true;
+ if (result.getStatus() == HttpStatus.OK.value()) {
+ JSONObject jsonObject = JSONObject.parseObject(result.body());
+ if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
+ JSONObject jo = JSONObject.parseObject(result.body());
+ String is_package = jo.getString("is_package");
+ this.writing(2, Integer.parseInt(is_package));
+ this.writing(1);
+ requireSucess = true;
+ }
}
}
return true;
@@ -406,11 +465,13 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
itemMap.put(to_command, 1);
itemMap.put(to_task, instruction_num);
ReadUtil.write(itemMap, server);
+ server.disconnect();
}
public void executing(Server server, Map itemMap) {
ReadUtil.write(itemMap, server);
+ server.disconnect();
}
public void writing(int type, int command) {
@@ -425,13 +486,16 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
Map itemMap = new HashMap();
if (type == 1) {
itemMap.put(to_command, command);
+ logServer.deviceExecuteLog(this.device_code, "", "", "to_command 写入 " + command);
} else if (type == 2) {
itemMap.put(to_target, command);
-
+ logServer.deviceExecuteLog(this.device_code, "", "", "to_target 写入 " + command);
} else if (type == 3) {
itemMap.put(to_task, command);
+ logServer.deviceExecuteLog(this.device_code, "", "", "to_task 写入 " + command);
}
ReadUtil.write(itemMap, server);
+ server.disconnect();
}
@@ -443,6 +507,9 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
Map itemMap = new HashMap();
itemMap.put(to_command, command);
ReadUtil.write(itemMap, server);
+ ReadUtil.write(itemMap, server);
+ server.disconnect();
+ logServer.deviceExecuteLog(this.device_code, "", "", "to_command 写入 " + command);
}
public synchronized void OpenOrClose(String type) {
@@ -475,7 +542,7 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
HttpResponse result = acsToWmsService.reverseGroup(json);
if (ObjectUtil.isNotEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result.body());
- if (result.getStatus() == 200 || StrUtil.equals(jsonObject.getString("status"),"200")) {
+ if (result.getStatus() == 200 || StrUtil.equals(jsonObject.getString("status"), "200")) {
this.writing(1);
this.setRequireSucess(true);
}
@@ -483,4 +550,165 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
}
}
+ /**
+ * 强制去包装
+ */
+ public synchronized void toPackage() {
+ 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);
+ } else {
+ this.instruction_require_time = date;
+ JSONObject json = new JSONObject();
+ json.put("type", "5");
+ json.put("device_code", device_code);
+
+ HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
+ if (ObjectUtil.isNotEmpty(result)) {
+ if (result.getStatus() == HttpStatus.OK.value()) {
+ JSONObject jsonObject = JSONObject.parseObject(result.body());
+ if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
+ this.writing(this.mode);
+ this.setRequireSucess(true);
+ }
+ }
+ }
+ }
+ }
+
+ public synchronized void sendEmpty() {
+ 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);
+ } else {
+ this.instruction_require_time = date;
+ JSONObject json = new JSONObject();
+ json.put("type", "3");
+ json.put("device_code", device_code);
+
+ HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
+ if (ObjectUtil.isNotEmpty(result)) {
+ if (result.getStatus() == HttpStatus.OK.value()) {
+ JSONObject jsonObject = JSONObject.parseObject(result.body());
+ if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
+ this.writing(this.mode);
+ this.setRequireSucess(true);
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public JSONObject getDeviceStatusName() throws Exception {
+ String mode;
+ String move;
+ String action;
+ String io_action;
+ boolean hasGoods;
+
+ switch (this.mode) {
+ case 0:
+ mode = "脱机";
+ break;
+ case 2:
+ mode = "待机";
+ break;
+ case 4:
+ mode = "叫料";
+ break;
+ case 5:
+ mode = "申请空盘";
+ break;
+ case 6:
+ mode = "申请入库";
+ break;
+ case 11:
+ mode = "半托缓存强制去包装";
+ break;
+ case 15:
+ mode = "送空托盘";
+ break;
+ default:
+ mode = String.valueOf(this.mode);
+ }
+
+ if (this.move == 0) {
+ move = "无货";
+ hasGoods = false;
+ } else {
+ move = "有货";
+ hasGoods = true;
+ }
+
+ switch (this.action) {
+ case 1:
+ action = "允许取货";
+ break;
+ case 2:
+ action = "允许放货";
+ break;
+ case 3:
+ action = "允许取放";
+ break;
+ default:
+ action = "禁止取放";
+ }
+
+ switch (this.io_action) {
+ case 1:
+ io_action = "允许进入";
+ break;
+ case 2:
+ io_action = "允许离开";
+ break;
+ case 3:
+ io_action = "允许进入离开";
+ break;
+ default:
+ io_action = "禁止进入离开";
+ }
+
+ String error;
+ switch (this.error) {
+ case 1:
+ error = "急停中";
+ break;
+ case 2:
+ error = "光幕报警";
+ break;
+ case 3:
+ error = "本体报警";
+ break;
+ case 4:
+ error = "未排产报警";
+ break;
+ case 5:
+ error = "扫码故障";
+ break;
+ default:
+ error = String.valueOf(this.error);
+ }
+
+ JSONObject jo = new JSONObject();
+ jo.put("device_name", this.getDevice().getDevice_name());
+ jo.put("mode", mode);
+ jo.put("move", move);
+ jo.put("action", action);
+ jo.put("io_action", io_action);
+ jo.put("error", error);
+ jo.put("task", task);
+ jo.put("weight", weight);
+ jo.put("barcode", barcode);
+ jo.put("isError", iserror);
+ jo.put("isOnline", isonline);
+ jo.put("hasGoods", hasGoods);
+ jo.put("message", message);
+ return jo;
+ }
+
+ @Override
+ public void setDeviceStatus(JSONObject data) {
+
+ }
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_autodoor/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_autodoor/ItemProtocol.java
index bd81d1b..d2bf6f2 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_autodoor/ItemProtocol.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_autodoor/ItemProtocol.java
@@ -56,7 +56,7 @@ public class ItemProtocol {
public static List getReadableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_heartbeat, "心跳", "DB51.B0"));
- list.add(new ItemDto(item_mode, "工作状态", "DB51.B1", Boolean.valueOf(true)));
+ list.add(new ItemDto(item_mode, "工作模式", "DB51.B1", Boolean.valueOf(true)));
list.add(new ItemDto(item_action, "动作信号", "DB51.B2"));
list.add(new ItemDto(item_error, "报警信号", "DB51.B4"));
return list;
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_autodoor/StandardAutodoorDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_autodoor/StandardAutodoorDefination.java
index 5b6b3fd..b320a9d 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_autodoor/StandardAutodoorDefination.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_autodoor/StandardAutodoorDefination.java
@@ -57,7 +57,7 @@ public class StandardAutodoorDefination implements OpcDeviceDriverDefination {
public static List getReadableItemDtos2() {
List list = new ArrayList();
list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB600.B0"));
- list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB600.B1", true));
+ list.add(new ItemDto(ItemProtocol.item_mode, "工作模式", "DB600.B1", true));
list.add(new ItemDto(ItemProtocol.item_action, "动作信号", "DB600.B2"));
list.add(new ItemDto(ItemProtocol.item_error, "报警信号", "DB600.B4"));
return list;
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_autodoor/StandardAutodoorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_autodoor/StandardAutodoorDeviceDriver.java
index d79a6bc..b770a87 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_autodoor/StandardAutodoorDeviceDriver.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_autodoor/StandardAutodoorDeviceDriver.java
@@ -1,7 +1,8 @@
package org.nl.acs.device_driver.standard_autodoor;
import com.alibaba.fastjson.JSONObject;
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
@@ -25,17 +26,18 @@ import java.util.Map;
* 自动门驱动
*/
@Slf4j
-@Data
+@Getter
+@Setter
@RequiredArgsConstructor
public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver {
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");
String container;
String container_type_desc;
@@ -144,8 +146,10 @@ public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implem
Map itemMap = new HashMap();
itemMap.put(to_command, command);
ReadUtil.write(itemMap, server);
+ ReadUtil.write(itemMap, server);
+ server.disconnect();
log.info("下发PLC信号:{},{}", to_command, command);
- System.out.println("设备:" + devicecode + ",下发PLC信号:" + to_command + ",value:" + command);
+ System.out.println("设备:" + devicecode + ",下发PLC信号:" + to_command + ",value:" + command);
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_emptypallet_site/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_emptypallet_site/ItemProtocol.java
index 4ebb511..c5e6978 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_emptypallet_site/ItemProtocol.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_emptypallet_site/ItemProtocol.java
@@ -1,6 +1,7 @@
package org.nl.acs.device_driver.standard_emptypallet_site;
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
@@ -8,7 +9,8 @@ import java.util.ArrayList;
import java.util.List;
@Slf4j
-@Data
+@Getter
+@Setter
public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
public static String item_mode = "mode";
@@ -85,7 +87,7 @@ public class ItemProtocol {
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_mode, "工作模式", "DB600.B1", Boolean.valueOf(true)));
list.add(new ItemDto(item_move, "光电开关信号", "DB600.B2"));
list.add(new ItemDto(item_number, "数量", "DB600.B3"));
list.add(new ItemDto(item_error, "报警信号", "DB600.B5"));
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_emptypallet_site/StandardEmptyPalletSiteDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_emptypallet_site/StandardEmptyPalletSiteDefination.java
index dfcd287..e710285 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_emptypallet_site/StandardEmptyPalletSiteDefination.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_emptypallet_site/StandardEmptyPalletSiteDefination.java
@@ -58,7 +58,7 @@ public class StandardEmptyPalletSiteDefination implements OpcDeviceDriverDefinat
public static List getReadableItemDtos2() {
List list = new ArrayList();
list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB600.B0"));
- list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB600.B1", true));
+ list.add(new ItemDto(ItemProtocol.item_mode, "工作模式", "DB600.B1", true));
list.add(new ItemDto(ItemProtocol.item_move, "光电开关信号", "DB600.B2"));
list.add(new ItemDto(ItemProtocol.item_number, "数量", "DB600.B3"));
list.add(new ItemDto(ItemProtocol.item_error, "报警信号", "DB600.B5"));
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_emptypallet_site/StandardEmptyPalletSiteDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_emptypallet_site/StandardEmptyPalletSiteDeviceDriver.java
index 099f7f1..8b49362 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_emptypallet_site/StandardEmptyPalletSiteDeviceDriver.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_emptypallet_site/StandardEmptyPalletSiteDeviceDriver.java
@@ -5,7 +5,8 @@ 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.Getter;
+import lombok.Setter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.config.AcsConfig;
@@ -39,23 +40,24 @@ import java.util.*;
* 空盘堆叠站点驱动
*/
@Slf4j
-@Data
+@Getter
+@Setter
@RequiredArgsConstructor
public class StandardEmptyPalletSiteDeviceDriver 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
+
ParamService acsConfigService = SpringContextHolder.getBean(ParamServiceImpl.class);
- @Autowired
+
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
- @Autowired
+
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
String container;
@@ -229,7 +231,7 @@ public class StandardEmptyPalletSiteDeviceDriver extends AbstractOpcDeviceDriver
} else if (mode == 2) {
try {
-// if (StrUtil.isEmpty(container)) {
+// if (StrUtil.isBlank(container)) {
// //判断条码是否为空,否则申请任务
// return;
// }
@@ -312,7 +314,7 @@ public class StandardEmptyPalletSiteDeviceDriver extends AbstractOpcDeviceDriver
}
public void apply_InEmpty() {
- //{"status":200,"message":"任务状态反馈成功!","data":{},"errArr":[]}
+ //{"status":200,"message":"任务状态反馈成功!","data":{},"errArr":[]}
String result = acsToWmsService.apply_InEmpty(this.getDeviceCode(), "1", String.valueOf(this.getNumber()), this.container);
JSONObject jo = (JSONObject) JSONObject.toJSON(result);
if (ObjectUtil.isEmpty(jo)) {
@@ -381,7 +383,7 @@ public class StandardEmptyPalletSiteDeviceDriver extends AbstractOpcDeviceDriver
List container_instructions = new ArrayList();
String barcode = this.getLast_container();
- if (!StrUtil.isEmpty(barcode)) {
+ if (!StrUtil.isBlank(barcode)) {
Map map = new HashMap();
map.put("vehicle_code", barcode);
container_instructions = instructionService.queryAll(map);
@@ -451,11 +453,13 @@ public class StandardEmptyPalletSiteDeviceDriver extends AbstractOpcDeviceDriver
itemMap.put(to_command, 1);
itemMap.put(to_task, instruction_num);
ReadUtil.write(itemMap, server);
+ server.disconnect();
}
public void executing(Server server, Map itemMap) {
ReadUtil.write(itemMap, server);
+ server.disconnect();
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java
index 16fb105..b24848c 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java
@@ -2,6 +2,8 @@
package org.nl.acs.ext.wms.rest;
+import cn.dev33.satoken.annotation.SaIgnore;
+import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -25,6 +27,7 @@ import org.springframework.web.bind.annotation.RestController;
@Api(tags = "wms调用接口")
@RequestMapping("/api/wms")
@Slf4j
+@SaIgnore
public class WmsToAcsController {
private final WmsToAcsService wmstoacsService;
@@ -84,4 +87,24 @@ public class WmsToAcsController {
return new ResponseEntity<>(wmstoacsService.queryTray(whereJson), HttpStatus.OK);
}
+ @PostMapping("/getDeviceStatus")
+ @Log("查询大屏设备")
+ @ApiOperation("查询大屏设备")
+ public ResponseEntity