From bae18a1394c8234cdac0a9b7076bffd0a90cc4d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=B1=9F=E7=8E=AE?= Date: Tue, 22 Aug 2023 17:46:17 +0800 Subject: [PATCH] fix warn --- .../lnsh_Laminating_machine/ItemProtocol.java | 16 +-- .../LnshLaminatingMachineDefination.java | 4 +- .../LnshLaminatingMachineDeviceDriver.java | 113 ++---------------- .../lnsh_fold_disc_site/ItemProtocol.java | 12 +- .../LnshFoldDiscSiteDefination.java | 6 +- .../LnshFoldDiscSiteDeviceDriver.java | 104 +--------------- .../lnsh/lnsh_kiln_lane/ItemProtocol.java | 12 +- .../LnshKilnLaneDefination.java | 6 +- .../LnshKilnLaneDeviceDriver.java | 70 ++++------- .../lnsh/lnsh_kiln_truss/ItemProtocol.java | 5 +- .../LnshKilnTrussDefination.java | 3 +- .../LnshKilnTrussDeviceDriver.java | 52 ++++---- .../lnsh_labeling_machine/ItemProtocol.java | 10 +- .../LnshLabelingMachineDefination.java | 6 +- .../LnshLabelingMachineDeviceDriver.java | 79 ++++-------- .../wms/service/impl/AcsToWmsServiceImpl.java | 60 +++++----- .../wms/service/impl/WmsToAcsServiceImpl.java | 14 +-- .../org/nl/acs/opc/DeviceExecuteAutoRun.java | 10 +- .../org/nl/wms/sch/manage/AutoCreateTask.java | 5 +- 19 files changed, 153 insertions(+), 434 deletions(-) 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 ac22382..bf2b05f 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 @@ -66,10 +66,6 @@ public class ItemProtocol { return this.getOpcIntegerValue(item_to_task); } - public String getTo_barcode() { - return this.getOpcStringValue(item_to_barcode); - } - //是否有货 public int hasGoods(int move) { return move; @@ -92,18 +88,16 @@ public class ItemProtocol { public String getOpcStringValue(String protocol) { String value = this.driver.getStringValue(protocol); - if (value == null) { -// log.error("读取错误!"); - } else { + if (value != null) { return value; } return ""; } public static List getReadableItemDtos() { - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList<>(); list.add(new ItemDto(item_heartbeat, "心跳", "DB32.B0")); - list.add(new ItemDto(item_mode, "工作模式", "DB32.B1", Boolean.valueOf(true))); + list.add(new ItemDto(item_mode, "工作模式", "DB32.B1", Boolean.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")); @@ -112,8 +106,8 @@ public class ItemProtocol { } public static List getWriteableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_command, "作业命令", "DB.W0", Boolean.valueOf(true))); + ArrayList list = new ArrayList<>(); + list.add(new ItemDto(item_to_command, "作业命令", "DB.W0", Boolean.TRUE)); list.add(new ItemDto(item_to_target, "目标站", "DB.W2")); list.add(new ItemDto(item_to_task, "任务号", "DB.D4")); list.add(new ItemDto(item_to_barcode, "条码", "DB.W8")); 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 c4e9427..a6bc1c6 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 @@ -45,7 +45,7 @@ public class LnshLaminatingMachineDefination implements OpcDeviceDriverDefinatio @Override public List getFitDeviceTypes() { - List types = new LinkedList(); + List types = new LinkedList<>(); types.add(DeviceType.station); return types; } @@ -56,7 +56,7 @@ public class LnshLaminatingMachineDefination implements OpcDeviceDriverDefinatio } public static List getReadableItemDtos2() { - List list = new ArrayList(); + 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_move, "光电开关信号", "DB.B2")); 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 8e5be2e..b5439fb 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,12 +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.Getter; -import lombok.Setter; 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; @@ -19,18 +18,14 @@ 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; import java.util.HashMap; -import java.util.List; import java.util.Map; /** @@ -102,15 +97,9 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i String device_code; - @Override - public Device getDevice() { - return this.device; - } - @Override public void execute() { - String message = null; try { device_code = this.getDeviceCode(); mode = this.itemProtocol.getMode(); @@ -157,31 +146,14 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i if (mode == 0) { this.setIsonline(false); this.setIserror(true); - message = "未联机"; //有报警 } else if (error != 0) { this.setIsonline(false); this.setIserror(true); - message = "有报警"; //无报警 } else { this.setIsonline(true); this.setIserror(false); - message = ""; - Instruction instruction = null; - List toInstructions; - switch (mode) { - case 1: - log.debug("设备运转模式:等待工作"); - return; - case 2: - break; - case 4: - if (!requireSucess) { - getVehicle_code(); - } - break; - } } @@ -206,59 +178,6 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i return true; } - protected void executing(Instruction instruction) { - this.executing(1, instruction, ""); - } - - public void executing(int command, Instruction instruction, String appendMessage) { - String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_command; - String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_target; - String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_task; - String to_barcode = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_barcode; - if (appendMessage == null) { - appendMessage = ""; - } - if (instruction != null) { - instruction_num = Integer.parseInt(instruction.getInstruction_code()); - } - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(to_command, 1); - itemMap.put(to_task, instruction_num); - ReadUtil.write(itemMap, server); - server.disconnect(); - - } - - /** - * 获取托盘号 - * - * @param - */ - public synchronized boolean getVehicle_code() { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - JSONObject jo = acsToWmsService.getVehicleCode(this.device_code); - if (jo.getInteger("status") == 200) { - String vehicle_code = jo.getString("vehicle_code"); - this.writing("to_barcode", vehicle_code); - this.writing(this.mode); - requireSucess = true; - } - - return true; - } - } - public void executing(Server server, Map itemMap) { ReadUtil.write(itemMap, server); server.disconnect(); @@ -270,7 +189,7 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i String opcservcerid = this.getDevice().getOpc_server_id(); Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); + Map itemMap = new HashMap<>(); itemMap.put(to_command, command); ReadUtil.write(itemMap, server); ReadUtil.write(itemMap, server); @@ -287,7 +206,7 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i + "." + ItemProtocol.item_to_task; String opcservcerid = this.getDevice().getOpc_server_id(); Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); + Map itemMap = new HashMap<>(); if (type == 1) { itemMap.put(to_command, command); } else if (type == 2) { @@ -307,7 +226,7 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i + "." + param; String opcservcerid = this.getDevice().getOpc_server_id(); Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); + Map itemMap = new HashMap<>(); itemMap.put(to_param, value); ReadUtil.write(itemMap, server); @@ -315,23 +234,6 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i logServer.deviceExecuteLog(this.device_code, "", "", param + " 写入 " + value); } - public static Boolean isExistFieldName(String fieldName, Object obj) throws NoSuchFieldException { - if (obj == null || StrUtil.isBlank(fieldName)) { - return null; - } - //获取这个类的所有属性 - Field[] fields = obj.getClass().getDeclaredFields(); - boolean flag = false; - //循环遍历所有的fields - for (int i = 0; i < fields.length; i++) { - if (fields[i].getName().equals(fieldName)) { - flag = true; - break; - } - } - return flag; - } - 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) { @@ -343,10 +245,11 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i param.put("device_code", device_code); param.put("vehicle_type", vehicle_type); - HttpResponse response = acsToWmsService.feedbackVehicleType(param); + try (HttpResponse response = acsToWmsService.feedbackVehicleType(param)) { - if (response.getStatus() == HttpStatus.OK.value() && "200".equals(JSON.parseObject(response.body()).getString("status"))) { - return true; + if (response.getStatus() == HttpStatus.OK.value() && "200".equals(JSON.parseObject(response.body()).getString("status"))) { + return true; + } } } return false; 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 b08e5a4..d586a23 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 @@ -101,18 +101,16 @@ public class ItemProtocol { public String getOpcStringValue(String protocol) { String value = this.driver.getStringValue(protocol); - if (value == null) { -// log.error("读取错误!"); - } else { + if (value != null) { return value; } return ""; } public static List getReadableItemDtos() { - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList<>(); list.add(new ItemDto(item_heartbeat, "心跳", "DB120.B0")); - list.add(new ItemDto(item_mode, "工作模式", "DB120.B1", Boolean.valueOf(true))); + list.add(new ItemDto(item_mode, "工作模式", "DB120.B1", Boolean.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")); @@ -124,8 +122,8 @@ public class ItemProtocol { } public static List getWriteableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_command, "下发指令", "DB121.W0", Boolean.valueOf(true))); + ArrayList list = new ArrayList<>(); + list.add(new ItemDto(item_to_command, "下发指令", "DB121.W0", Boolean.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 96721ce..6065630 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 @@ -43,7 +43,7 @@ public class LnshFoldDiscSiteDefination implements OpcDeviceDriverDefination { @Override public List getFitDeviceTypes() { - List types = new LinkedList(); + List types = new LinkedList<>(); types.add(DeviceType.station); return types; } @@ -54,9 +54,9 @@ public class LnshFoldDiscSiteDefination implements OpcDeviceDriverDefination { } public static List getReadableItemDtos2() { - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList<>(); 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_mode, "工作模式", "DB120.B1", Boolean.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")); 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 3121fc0..5a8d00d 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,11 +1,9 @@ package org.nl.acs.device_driver.lnsh.lnsh_fold_disc_site; -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.Setter; import lombok.extern.slf4j.Slf4j; import org.nl.acs.device.device_driver.standard_inspect.ReadUtil; import org.nl.acs.device.service.DeviceService; @@ -15,20 +13,15 @@ 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; -import java.util.List; import java.util.Map; /** @@ -99,15 +92,9 @@ public class LnshFoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implem int container_qty = 0; int last_container_qty = 0; - @Override - public Device getDevice() { - return this.device; - } - @Override public void execute() { - String message = null; try { device_code = this.getDeviceCode(); @@ -135,7 +122,7 @@ public class LnshFoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implem logServer.deviceExecuteLog(this.device_code, "", "", "信号status:" + last_status + " -> " + status); } if (!open_time.equals(last_open_time)) { - logServer.deviceItemValue(this.device_code, "open_time", String.valueOf(open_time)); + logServer.deviceItemValue(this.device_code, "open_time", open_time); logServer.deviceExecuteLog(this.device_code, "", "", "信号open_time:" + last_open_time + " -> " + open_time); } if (close_time != last_close_time) { @@ -165,41 +152,26 @@ public class LnshFoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implem return; } - //急停 - if (this.isStop()) { - - //未在线无心跳 - } else if (!this.itemProtocol.getIsonline()) { + if (!this.itemProtocol.getIsonline()) { this.setIsonline(false); this.setIserror(true); - message = "信号量同步异常"; //未联机 } else if (mode == 0) { this.setIsonline(false); this.setIserror(true); - message = "未联机"; //有报警 } else if (error != 0) { this.setIsonline(false); this.setIserror(true); - message = "有报警"; //无报警 } else { this.setIsonline(true); this.setIserror(false); - message = ""; - Instruction instruction = null; - List toInstructions; switch (mode) { case 1: log.debug("设备运转模式:等待工作"); break; case 2: -// int max_emptypalletnum = Integer.parseInt(this.getDevice().getExtraValue().get("max_emptypalletnum").toString()); -// //当前数量等于最大数量,则生成搬运任务 -// if (!requireSucess && container_qty >= max_emptypalletnum) { -// putStorage(); -// } break; } } @@ -214,48 +186,14 @@ public class LnshFoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implem last_container_qty = container_qty; } - - /** - * 拆垛完成 - * - * @param - */ - public synchronized boolean palletizing() { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - JSONObject json = new JSONObject(); - json.put("device_code", device_code); - json.put("type", "3"); - HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); - if (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; - } - } - public void writing(String param, String value) { String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + param; String opcservcerid = this.getDevice().getOpc_server_id(); Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - if (value instanceof String) { - itemMap.put(to_param, value); - } else { - itemMap.put(to_param, value); - } + Map itemMap = new HashMap<>(); + itemMap.put(to_param, value); ReadUtil.write(itemMap, server); server.disconnect(); logServer.deviceExecuteLog(this.device_code, "", "", param + " 写入 " + value); @@ -272,7 +210,7 @@ public class LnshFoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implem String opcservcerid = this.getDevice().getOpc_server_id(); Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); + Map itemMap = new HashMap<>(); itemMap.put(to_command, command); ReadUtil.write(itemMap, server); ReadUtil.write(itemMap, server); @@ -280,36 +218,6 @@ public class LnshFoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implem logServer.deviceExecuteLog(this.device_code, "", "", "to_command 写入 " + command); } - /** - * 申请入库 - * - * @param - */ - public synchronized boolean putStorage() { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - JSONObject json = new JSONObject(); - json.put("device_code", this.device_code); - json.put("qty", container_qty); - json.put("type", "3"); - 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; - } - } - @Override public JSONObject getDeviceStatusName() throws Exception { String mode; 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 2e19f59..8cdb032 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 @@ -100,18 +100,16 @@ public class ItemProtocol { public String getOpcStringValue(String protocol) { String value = this.driver.getStringValue(protocol); - if (value == null) { -// log.error("读取错误!"); - } else { + if (value != null) { return value; } return ""; } public static List getReadableItemDtos() { - ArrayList list = new ArrayList(); + 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.TRUE)); list.add(new ItemDto(item_status, "设备状态", "DB3.B2")); list.add(new ItemDto(item_open_time, "开机时间", "DB3.STRING4.50")); list.add(new ItemDto(item_standby_time, "待机时间", "DB3.D56")); @@ -124,8 +122,8 @@ public class ItemProtocol { } public static List getWriteableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_command, "下发指令", "DB4.W0", Boolean.valueOf(true))); + ArrayList list = new ArrayList<>(); + list.add(new ItemDto(item_to_command, "下发指令", "DB4.W0", Boolean.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 08bc1df..68963bb 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 @@ -43,7 +43,7 @@ public class LnshKilnLaneDefination implements OpcDeviceDriverDefination { @Override public List getFitDeviceTypes() { - List types = new LinkedList(); + List types = new LinkedList<>(); types.add(DeviceType.station); return types; } @@ -54,9 +54,9 @@ public class LnshKilnLaneDefination implements OpcDeviceDriverDefination { } public static List getReadableItemDtos2() { - ArrayList 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.TRUE)); list.add(new ItemDto(ItemProtocol.item_status, "设备状态", "DB3.B2")); list.add(new ItemDto(ItemProtocol.item_open_time, "开机时间", "DB3.STRING4.50")); list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "DB3.D56")); 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 77b01d0..ecef438 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 @@ -2,8 +2,8 @@ package org.nl.acs.device_driver.lnsh.lnsh_kiln_lane; import com.alibaba.fastjson.JSONObject; import lombok.Getter; -import lombok.Setter; 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; @@ -12,18 +12,14 @@ import org.nl.acs.device_driver.RouteableDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; import org.nl.acs.instruction.service.InstructionService; -import org.nl.acs.instruction.service.dto.Instruction; import org.nl.acs.log.service.DeviceExecuteLogService; import org.nl.acs.monitor.DeviceStageMonitor; -import org.nl.acs.opc.Device; import org.nl.acs.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.HashMap; -import java.util.List; import java.util.Map; /** @@ -90,15 +86,9 @@ public class LnshKilnLaneDeviceDriver extends AbstractOpcDeviceDriver implements int burning_car_qty = 0; int last_burning_car_qty = 0; - @Override - public Device getDevice() { - return this.device; - } - @Override public void execute() { - String message = null; try { device_code = this.getDeviceCode(); mode = this.itemProtocol.getMode(); @@ -113,71 +103,61 @@ 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.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.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.deviceItemValue(this.device_code, "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.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 (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.deviceItemValue(this.device_code, "car_sum", String.valueOf(car_sum)); + logServer.deviceExecuteLog(this.device_code, "", "", "信号car_sum:" + last_car_sum + " -> " + car_sum); } if (nullCar_qty != last_nullCar_qty) { - logServer.deviceItemValue(this.device_code,"nullCar_qty" ,String.valueOf(nullCar_qty)); - logServer.deviceExecuteLog(this.device_code,"","","信号nullCar_qty:" + last_nullCar_qty + " -> " + nullCar_qty); + logServer.deviceItemValue(this.device_code, "nullCar_qty", String.valueOf(nullCar_qty)); + logServer.deviceExecuteLog(this.device_code, "", "", "信号nullCar_qty:" + last_nullCar_qty + " -> " + nullCar_qty); } if (burning_car_qty != last_burning_car_qty) { - logServer.deviceItemValue(this.device_code,"burning_car_qty" ,String.valueOf(burning_car_qty)); - logServer.deviceExecuteLog(this.device_code,"","","信号burning_car_qty:" + last_burning_car_qty + " -> " + burning_car_qty); + logServer.deviceItemValue(this.device_code, "burning_car_qty", String.valueOf(burning_car_qty)); + logServer.deviceExecuteLog(this.device_code, "", "", "信号burning_car_qty:" + last_burning_car_qty + " -> " + burning_car_qty); } } catch (Exception var17) { return; } - //急停 - if (this.isStop()) { - - //未在线无心跳 - } else if (!this.itemProtocol.getIsonline()) { + if (!this.itemProtocol.getIsonline()) { this.setIsonline(false); this.setIserror(true); - message = "信号量同步异常"; //未联机 } else if (mode == 0) { this.setIsonline(false); this.setIserror(true); - message = "未联机"; //有报警 } else if (error != 0) { this.setIsonline(false); this.setIserror(true); - message = "有报警"; //无报警 } else { this.setIsonline(true); this.setIserror(false); - message = ""; - Instruction instruction = null; - List toInstructions; switch (mode) { case 1: log.debug("设备运转模式:等待工作"); @@ -220,12 +200,8 @@ public class LnshKilnLaneDeviceDriver extends AbstractOpcDeviceDriver implements + "." + param; String opcservcerid = this.getDevice().getOpc_server_id(); Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - if (value instanceof String) { - itemMap.put(to_param, value); - } else { - itemMap.put(to_param, value); - } + Map itemMap = new HashMap<>(); + itemMap.put(to_param, value); ReadUtil.write(itemMap, server); server.disconnect(); logServer.deviceExecuteLog(this.device_code, "", "", param + " 写入 " + value); @@ -242,7 +218,7 @@ public class LnshKilnLaneDeviceDriver extends AbstractOpcDeviceDriver implements String opcservcerid = this.getDevice().getOpc_server_id(); Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); + Map itemMap = new HashMap<>(); itemMap.put(to_command, command); ReadUtil.write(itemMap, server); ReadUtil.write(itemMap, server); 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 1ef0aa2..a2917c1 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 @@ -56,6 +56,7 @@ public class ItemProtocol { public String getOpen_time() { return this.getOpcStringValue(item_open_time); } + public int getStandby_time() { return this.getOpcIntegerValue(item_standby_time); } @@ -101,9 +102,7 @@ public class ItemProtocol { public String getOpcStringValue(String protocol) { String value = this.driver.getStringValue(protocol); - if (value == null) { -// log.error("读取错误!"); - } else { + if (value != null) { return value; } return ""; 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 03e831f..7a2a8b5 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 @@ -7,7 +7,6 @@ import org.nl.acs.opc.Device; import org.nl.acs.opc.DeviceType; import org.springframework.stereotype.Service; -import java.util.ArrayList; import java.util.LinkedList; import java.util.List; @@ -43,7 +42,7 @@ public class LnshKilnTrussDefination implements OpcDeviceDriverDefination { @Override public List getFitDeviceTypes() { - List types = new LinkedList(); + List types = new LinkedList<>(); types.add(DeviceType.station); return types; } 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 d2c77d2..2dd594d 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 @@ -4,8 +4,8 @@ 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.Setter; import lombok.extern.slf4j.Slf4j; import org.nl.acs.device.device_driver.standard_inspect.ReadUtil; import org.nl.acs.device.service.DeviceService; @@ -15,20 +15,16 @@ 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; -import java.util.List; import java.util.Map; /** @@ -94,11 +90,6 @@ public class LnshKilnTrussDeviceDriver extends AbstractOpcDeviceDriver implement int error_time = 0; int last_error_time = 0; - @Override - public Device getDevice() { - return this.device; - } - @Override public void execute() { @@ -115,47 +106,44 @@ 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.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 (kiln_number != last_kiln_number) { - logServer.deviceItemValue(this.device_code,"kiln_number" ,String.valueOf(kiln_number)); - logServer.deviceExecuteLog(this.device_code,"","","信号kiln_number:" + last_kiln_number + " -> " + kiln_number); + logServer.deviceItemValue(this.device_code, "kiln_number", String.valueOf(kiln_number)); + logServer.deviceExecuteLog(this.device_code, "", "", "信号kiln_number:" + last_kiln_number + " -> " + kiln_number); } 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 (!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.deviceItemValue(this.device_code, "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.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); } } catch (Exception var17) { return; } - //急停 - if (this.isStop()) { - - //未在线无心跳 - } else if (!this.itemProtocol.getIsonline()) { + //未在线无心跳 + if (!this.itemProtocol.getIsonline()) { this.setIsonline(false); this.setIserror(true); message = "信号量同步异常"; @@ -211,7 +199,7 @@ public class LnshKilnTrussDeviceDriver extends AbstractOpcDeviceDriver implement String opcservcerid = this.getDevice().getOpc_server_id(); Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); + Map itemMap = new HashMap<>(); itemMap.put(to_command, command); ReadUtil.write(itemMap, server); ReadUtil.write(itemMap, server); 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 0c82a8d..e47ef75 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 @@ -95,18 +95,16 @@ public class ItemProtocol { public String getOpcStringValue(String protocol) { String value = this.driver.getStringValue(protocol); - if (value == null) { -// log.error("读取错误!"); - } else { + if (value != null) { return value; } return ""; } public static List getReadableItemDtos() { - ArrayList list = new ArrayList(); + 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.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")); @@ -118,7 +116,7 @@ public class ItemProtocol { } public static List getWriteableItemDtos() { - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList<>(); list.add(new ItemDto(item_to_command, "下发指令", "DB601.W0", Boolean.valueOf(true))); list.add(new ItemDto(item_to_material_code, "下发物料编号", "DB601.D2")); return list; diff --git a/acs/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 f72f359..cbbd59c 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 @@ -43,7 +43,7 @@ public class LnshLabelingMachineDefination implements OpcDeviceDriverDefination @Override public List getFitDeviceTypes() { - List types = new LinkedList(); + List types = new LinkedList<>(); types.add(DeviceType.station); return types; } @@ -54,9 +54,9 @@ public class LnshLabelingMachineDefination implements OpcDeviceDriverDefination } public static List getReadableItemDtos2() { - ArrayList list = new ArrayList(); + 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.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 54223d1..2d6ae72 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,8 +1,8 @@ package org.nl.acs.device_driver.lnsh.lnsh_labeling_machine; import lombok.Getter; -import lombok.Setter; 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; @@ -12,18 +12,14 @@ import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.instruction.service.InstructionService; -import org.nl.acs.instruction.service.dto.Instruction; import org.nl.acs.log.service.DeviceExecuteLogService; -import org.nl.acs.opc.Device; import org.nl.acs.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; -import java.util.List; import java.util.Map; /** @@ -83,15 +79,8 @@ public class LnshLabelingMachineDeviceDriver extends AbstractOpcDeviceDriver imp int last_labeling_qty = 0; - @Override - public Device getDevice() { - return this.device; - } - - @Override public void execute() { - String message = null; try { device_code = this.getDeviceCode(); mode = this.itemProtocol.getMode(); @@ -105,80 +94,58 @@ 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.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.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.deviceItemValue(this.device_code, "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.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 (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.deviceItemValue(this.device_code, "labeling_qty", String.valueOf(labeling_qty)); + logServer.deviceExecuteLog(this.device_code, "", "", "信号labeling_qty:" + last_labeling_qty + " -> " + labeling_qty); } } catch (Exception var17) { return; } - //急停 - if (this.isStop()) { - - //未在线无心跳 - } else if (!this.itemProtocol.getIsonline()) { + //未在线无心跳 + if (!this.itemProtocol.getIsonline()) { this.setIsonline(false); this.setIserror(true); - message = "信号量同步异常"; //未联机 } else if (mode == 0) { this.setIsonline(false); this.setIserror(true); - message = "未联机"; //有报警 } else if (error != 0) { this.setIsonline(false); this.setIserror(true); - message = "有报警"; //无报警 } else { this.setIsonline(true); this.setIserror(false); - message = ""; - Instruction instruction = null; - List toInstructions; - switch (mode) { - case 1: - log.debug("设备运转模式:等待工作"); - break; - case 2: - - break; - case 3: - - break; - case 4: - break; - } } last_mode = mode; last_status = status; @@ -191,10 +158,6 @@ public class LnshLabelingMachineDeviceDriver extends AbstractOpcDeviceDriver imp } - protected void thingToNothing() throws Exception { - this.setRequireSucess(false); - } - public boolean exe_error() { if (this.error == 0) { return true; @@ -217,7 +180,7 @@ public class LnshLabelingMachineDeviceDriver extends AbstractOpcDeviceDriver imp String opcservcerid = this.getDevice().getOpc_server_id(); Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); + Map itemMap = new HashMap<>(); ReadUtil.write(itemMap, server); server.disconnect(); logServer.deviceExecuteLog(this.device_code, "", "", "to_command 写入 " + command); @@ -229,7 +192,7 @@ public class LnshLabelingMachineDeviceDriver extends AbstractOpcDeviceDriver imp + "." + param; String opcservcerid = this.getDevice().getOpc_server_id(); Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); + Map itemMap = new HashMap<>(); itemMap.put(to_param, value); ReadUtil.write(itemMap, server); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java index 4ca1dd2..3d02ede 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java @@ -84,7 +84,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { .body(String.valueOf(jo)) .execute(); System.out.println(result2); - log.info("applyTaskToWms - 返回参数 {}", result2.body()); + log.info("applyTaskToWms - 响应参数 {}", result2.body()); } catch (Exception e) { String msg = e.getMessage(); //网络不通 @@ -131,7 +131,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { .body(String.valueOf(json)) .execute(); System.out.println(result2); - log.info("applyTaskManipulatorToWms - 返回参数 {}", result2.body()); + log.info("applyTaskManipulatorToWms - 响应参数 {}", result2.body()); } catch (Exception e) { String msg = e.getMessage(); //网络不通 @@ -172,7 +172,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { .body(String.valueOf(jo)) .execute(); System.out.println(result2); - log.info("applyOuttoKiln - 返回参数 {}", result2.body()); + log.info("applyOuttoKiln - 响应参数 {}", result2.body()); } catch (Exception e) { String msg = e.getMessage(); //网络不通 @@ -213,7 +213,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { .body(String.valueOf(jo)) .execute(); System.out.println(result2); - log.info("lnshApplyTaskToWms - 返回参数 {}", result2.body()); + log.info("lnshApplyTaskToWms - 响应参数 {}", result2.body()); } catch (Exception e) { String msg = e.getMessage(); //网络不通 @@ -255,7 +255,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { .body(String.valueOf(jo)) .execute(); System.out.println(result2); - log.info("lnshApplyTaskToWms - 返回参数 {}", result2.body()); + log.info("lnshApplyTaskToWms - 响应参数 {}", result2.body()); } catch (Exception e) { String msg = e.getMessage(); //网络不通 @@ -296,7 +296,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { .body(String.valueOf(jo)) .execute(); System.out.println(result2); - log.info("lnshApplyTaskToWms - 返回参数 {}", result2.body()); + log.info("lnshApplyTaskToWms - 响应参数 {}", result2.body()); } catch (Exception e) { String msg = e.getMessage(); //网络不通 @@ -326,7 +326,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { .body(String.valueOf(json)) .execute(); System.out.println(result); - log.info("getVehicle - 返回参数 {}", result.body()); + log.info("getVehicle - 响应参数 {}", result.body()); } catch (Exception e) { System.out.println(e.getMessage()); } @@ -355,7 +355,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { .body(String.valueOf(json)) .execute(); System.out.println(result); - log.info("getVehicleTokiln - 返回参数 {}", result.body()); + log.info("getVehicleTokiln - 响应参数 {}", result.body()); return JSONObject.parseObject(result.body()); } catch (Exception e) { System.out.println(e.getMessage()); @@ -382,7 +382,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { .post(wmsurl + methods_url) .body(param.toJSONString()) .execute(); - log.info("inKiln - 返回参数 {}", result.body()); + log.info("inKiln - 响应参数 {}", result.body()); } catch (Exception e) { String msg = e.getMessage(); //网络不通 @@ -412,7 +412,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { .body(String.valueOf(json)) .execute(); System.out.println(result); - log.info("outKiln - 返回参数 {}", result.body()); + log.info("outKiln - 响应参数 {}", result.body()); } catch (Exception e) { System.out.println(e.getMessage()); } @@ -440,7 +440,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { .body(String.valueOf(json)) .execute(); System.out.println(result); - log.info("enterOrder - 返回参数 {}", result.body()); + log.info("enterOrder - 响应参数 {}", result.body()); } catch (Exception e) { System.out.println(e.getMessage()); } @@ -476,7 +476,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { .body(String.valueOf(json)) .execute(); System.out.println(result); - log.info("getVehicleCode - 返回参数 {}", result.body()); + log.info("getVehicleCode - 响应参数 {}", result.body()); return JSONObject.parseObject(result.body()); } catch (Exception e) { System.out.println(e.getMessage()); @@ -508,7 +508,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { .body(String.valueOf(json)) .execute(); System.out.println(result); - log.info("getVehiclePoint - 返回参数 {}", result.body()); + log.info("getVehiclePoint - 响应参数 {}", result.body()); return JSONObject.parseObject(result.body()); } catch (Exception e) { System.out.println(e.getMessage()); @@ -542,7 +542,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { .header("Authorization", token).body(String.valueOf(data)) .execute(); System.out.println(result2); - log.info("feedbackTaskStatusToWms - 返回参数 {}", result2.body()); + log.info("feedbackTaskStatusToWms - 响应参数 {}", result2.body()); } catch (Exception e) { String msg = e.getMessage(); //网络不通 @@ -581,7 +581,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { .body(String.valueOf(json)) .execute().body(); System.out.println(result2); - log.info("feedbackPointStatusToWms - 返回参数 {}", result2); + log.info("feedbackPointStatusToWms - 响应参数 {}", result2); } catch (Exception e) { String msg = e.getMessage(); //网络不通 @@ -613,7 +613,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { result = HttpRequest.get(url) .execute().body(); System.out.println(result); - log.info("getTaskStatusToWms - 返回参数 {}", result); + log.info("getTaskStatusToWms - 响应参数 {}", result); } catch (Exception e) { System.out.println(e.getMessage()); } @@ -645,7 +645,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { .body(String.valueOf(json)) .execute(); System.out.println(result); - log.info("requestSignalInteraction - 返回参数 {}", result.body()); + log.info("requestSignalInteraction - 响应参数 {}", result.body()); } catch (Exception e) { String msg = e.getMessage(); //网络不通 @@ -682,7 +682,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { .body(String.valueOf(jo)) .execute().body(); System.out.println(result2); - log.info("requestTaskAgain - 返回参数 {}", result2); + log.info("requestTaskAgain - 响应参数 {}", result2); } catch (Exception e) { String msg = e.getMessage(); //网络不通 @@ -723,7 +723,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { .body(String.valueOf(jo)) .execute().body(); System.out.println(result2); - log.info("requestTaskAgain - 返回参数 {}", result2); + log.info("requestTaskAgain - 响应参数 {}", result2); } catch (Exception e) { String msg = e.getMessage(); //网络不通 @@ -755,7 +755,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { .body(String.valueOf(jo)) .execute().body(); System.out.println(result2); - log.info("apply_OutEmpty - 返回参数 {}", result2); + log.info("apply_OutEmpty - 响应参数 {}", result2); } catch (Exception e) { String msg = e.getMessage(); //网络不通 @@ -790,7 +790,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { .body(String.valueOf(json)) .execute(); System.out.println(result); - log.info("feedbackAgvStatus - 返回参数 {}", result.body()); + log.info("feedbackAgvStatus - 响应参数 {}", result.body()); } catch (Exception e) { String msg = e.getMessage(); //网络不通 @@ -829,7 +829,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { .body(String.valueOf(json)) .execute(); System.out.println(result); - log.info("feedbackDeviceStatus - 返回参数 {}", result.body()); + log.info("feedbackDeviceStatus - 响应参数 {}", result.body()); } catch (Exception e) { String msg = e.getMessage(); //网络不通 @@ -858,7 +858,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { .body(String.valueOf(from)) .execute(); System.out.println(result); - log.info("feedbackAgv - 返回参数 {}", result.body()); + log.info("feedbackAgv - 响应参数 {}", result.body()); } catch (Exception e) { String msg = e.getMessage(); //网络不通 @@ -889,7 +889,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { .body(String.valueOf(jo)) .execute(); System.out.println(result); - log.info("applyOpenOrCloseDoor - 返回参数 {}", result.body()); + log.info("applyOpenOrCloseDoor - 响应参数 {}", result.body()); } catch (Exception e) { String msg = e.getMessage(); //网络不通 @@ -916,7 +916,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { result = HttpRequest.get(wmsurl + methods_url) .body("") .execute(); - log.info("queryDoorStatus - 返回参数 {}", result.body()); + log.info("queryDoorStatus - 响应参数 {}", result.body()); } catch (Exception e) { String msg = e.getMessage(); //网络不通 @@ -951,12 +951,12 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { .body(String.valueOf(data)) .execute(); JSONObject jo = (JSONObject) JSON.toJSON(result2.body()); - log.info("feedbackActionStatusToWms - 返回参数 {}", jo.toString()); + log.info("feedbackActionStatusToWms - 响应参数 {}", jo.toString()); } catch (Exception e) { String msg = e.getMessage(); //网络不通 System.out.println(msg); - log.info("feedbackActionStatusToWms - 异常返回参数 {}", msg); + log.info("feedbackActionStatusToWms - 异常响应参数 {}", msg); } String type = ""; @@ -995,7 +995,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { result = HttpRequest.post(wmsurl + methods_url) .body(param.toJSONString()) .execute(); - log.info("reverseGroup - 返回参数 {}", result.body()); + log.info("reverseGroup - 响应参数 {}", result.body()); } catch (Exception e) { String msg = e.getMessage(); //网络不通 @@ -1021,7 +1021,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { result = HttpRequest.post(wmsurl + methods_url) .body(param.toJSONString()) .execute(); - log.info("feedbackVehicleType - 返回参数 {}", result.body()); + log.info("feedbackVehicleType - 响应参数 {}", result.body()); } catch (Exception e) { String msg = e.getMessage(); //网络不通 @@ -1048,7 +1048,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { .post(wmsurl + methods_url) .body(param.toJSONString()) .execute(); - log.info("mark - 返回参数 {}", result.body()); + log.info("mark - 响应参数 {}", result.body()); } catch (Exception e) { String msg = e.getMessage(); //网络不通 diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java index bcae594..ffcb134 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java @@ -188,14 +188,14 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { resultJson.put("errArr", errArr); resultJson.put("message", "操作成功"); resultJson.put("data", new JSONObject()); - log.info("createFromWms - 返回参数 {}", resultJson); + log.info("createFromWms - 响应参数 {}", resultJson); } catch (Exception e) { resultJson.put("status", 400); resultJson.put("errArr", e.getMessage()); resultJson.put("message", e.getMessage()); resultJson.put("data", new JSONObject()); - log.info("createFromWms - 返回参数 {}", resultJson); + log.info("createFromWms - 响应参数 {}", resultJson); } return resultJson; } finally { @@ -242,7 +242,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { resultJson.put("status", HttpStatus.OK); resultJson.put("message", "操作成功"); resultJson.put("data", new JSONObject()); - log.info("cancelFromWms - 返回参数 {}", resultJson); + log.info("cancelFromWms - 响应参数 {}", resultJson); return resultJson; } finally { MDC.remove(log_file_type); @@ -375,7 +375,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { resultJson.put("status", HttpStatus.OK.value()); resultJson.put("message", "操作成功"); resultJson.put("data", new JSONObject()); - log.info("createOrder - 返回参数 {}", resultJson); + log.info("createOrder - 响应参数 {}", resultJson); return resultJson; } @@ -528,7 +528,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { result.put("status", HttpStatus.OK.value()); result.put("message", "查询成功!"); result.put("data", param); - log.info("getDeviceStatus - 返回参数 {}", result); + log.info("getDeviceStatus - 响应参数 {}", result); return result; } @@ -554,7 +554,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { JSONObject result = new JSONObject(); result.put("status", HttpStatus.OK.value()); result.put("message", "亮灯成功!"); - log.info("light - 返回参数 {}", result); + log.info("light - 响应参数 {}", result); return result; } @@ -584,7 +584,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { JSONObject result = new JSONObject(); result.put("status", HttpStatus.OK.value()); result.put("message", "写入成功!"); - log.info("writeVehicle - 返回参数 {}", result); + log.info("writeVehicle - 响应参数 {}", result); return result; } } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceExecuteAutoRun.java b/acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceExecuteAutoRun.java index f81e654..0f92147 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceExecuteAutoRun.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceExecuteAutoRun.java @@ -71,14 +71,12 @@ public class DeviceExecuteAutoRun extends AbstractAutoRunnable { log.info("设备执行线程开始..."); while (true) { - Thread.sleep((long) this.loop_time_millions); + Thread.sleep(this.loop_time_millions); List deviceDrivers = this.deviceAppService.findDeviceDriver(ExecutableDeviceDriver.class); - Iterator it = deviceDrivers.iterator(); - while (it.hasNext()) { - final ExecutableDeviceDriver deviceDriver = (ExecutableDeviceDriver) it.next(); + for (ExecutableDeviceDriver deviceDriver : deviceDrivers) { //不包含正在执行的线程,则进行执行 - if (!this.runs.keySet().contains(deviceDriver.getDeviceCode())) { + if (!this.runs.containsKey(deviceDriver.getDeviceCode())) { BlockedRunable runnable = new BlockedRunable() { @Override public void subRun() { @@ -90,7 +88,7 @@ public class DeviceExecuteAutoRun extends AbstractAutoRunnable { return deviceDriver.getDeviceCode(); } }; - if (!this.runs.keySet().contains(deviceDriver.getDeviceCode())) { + if (!this.runs.containsKey(deviceDriver.getDeviceCode())) { this.runs.put(deviceDriver.getDeviceCode(), runnable); } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoCreateTask.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoCreateTask.java index 489df89..4276dfc 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoCreateTask.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoCreateTask.java @@ -7,14 +7,12 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; -import org.nl.modules.common.utils.SecurityUtils; import org.nl.modules.wql.core.bean.WQLObject; import org.nl.modules.wql.util.SpringContextHolder; import org.nl.wms.sch.AcsUtil; import org.nl.wms.sch.task.AcsTaskDTO; import org.reflections.Reflections; import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.List; @@ -51,7 +49,6 @@ public class AutoCreateTask { taskList.addAll(tasks); } } catch (Exception e) { - e.printStackTrace(); log.info("定时器执行失败:{}", e.getMessage()); } @@ -67,7 +64,7 @@ public class AutoCreateTask { }); String api = "api/wms/task"; - log.info("下发acs任务的参数为:{}", arr.toString()); + log.info("下发acs任务的参数为:{}", arr); JSONObject result = AcsUtil.notifyAcs(api, arr); log.info("下发acs任务的返回结果为:{}", result.toString());