From 41904ecbb57381a2537022387b246c9ae8405eab Mon Sep 17 00:00:00 2001 From: yanps Date: Tue, 23 Jan 2024 17:39:49 +0800 Subject: [PATCH 1/5] =?UTF-8?q?opt:=20=E6=8B=94=E8=BD=B4=E6=9C=BA=E7=94=B3?= =?UTF-8?q?=E8=AF=B7=E5=A5=97=E8=BD=B4=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...PluggingUnpluggingMachineDeviceDriver.java | 8 +- .../oven_manipulator/ItemProtocol.java | 150 -- .../OvenGantryManipulatorDefination.java | 62 - .../OvenGantryManipulatorDeviceDriver.java | 1204 ----------------- .../conveyor/oven_manipulator/Test.java | 56 - 5 files changed, 4 insertions(+), 1476 deletions(-) delete mode 100644 acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/oven_manipulator/ItemProtocol.java delete mode 100644 acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/oven_manipulator/OvenGantryManipulatorDefination.java delete mode 100644 acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java delete mode 100644 acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/oven_manipulator/Test.java diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/plugging_unplugging_machine/PluggingUnpluggingMachineDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/plugging_unplugging_machine/PluggingUnpluggingMachineDeviceDriver.java index 7db9dd378..a72785729 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/plugging_unplugging_machine/PluggingUnpluggingMachineDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/plugging_unplugging_machine/PluggingUnpluggingMachineDeviceDriver.java @@ -147,7 +147,7 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv case 3: break; case 4: - if ((task1 > 0) && !requireSucess) { + if (!requireSucess) { applyBushing(); } break; @@ -274,14 +274,14 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv private synchronized void applyBushing() { ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest(); ApplyManipulatorActionResponse applyManipulatorActionResponse; - Instruction inst1 = instructionService.findByCode(String.valueOf(task1)); + /*Instruction inst1 = instructionService.findByCode(String.valueOf(task1)); String task_code1 = inst1.getTask_code(); if (Long.parseLong(task_code1) < 1) { message = "任务ACS创建,不向LMS申请套轴"; return; - } + }*/ applyManipulatorActionRequest.setDevice_code(device_code); - applyManipulatorActionRequest.setTask_code1(task_code1); + //applyManipulatorActionRequest.setTask_code1(task_code1); applyManipulatorActionRequest.setType("6"); applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest); if (ObjectUtils.isNotEmpty(applyManipulatorActionResponse) && ("1".equals(applyManipulatorActionResponse.getIs_bushing()))) { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/oven_manipulator/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/oven_manipulator/ItemProtocol.java deleted file mode 100644 index b2396e6d6..000000000 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/oven_manipulator/ItemProtocol.java +++ /dev/null @@ -1,150 +0,0 @@ -//package org.nl.acs.device_driver.conveyor.oven_manipulator; -// -//import cn.hutool.core.util.StrUtil; -//import lombok.Data; -//import lombok.extern.slf4j.Slf4j; -//import org.nl.acs.device.device_driver.standard_inspect.ItemDto; -// -//import java.util.ArrayList; -//import java.util.List; -// -//@Slf4j -//@Data -//public class ItemProtocol { -// -// /** -// * 心跳 -// */ -// public static String item_heartbeat = "heartbeat"; -// /** -// * 工作模式 -// */ -// public static String item_mode = "mode"; -// /** -// * 光电信号 -// */ -// public static String item_move = "move"; -// /** -// * 动作信号 -// */ -// public static String item_action = "action"; -// /** -// * 行走列 -// */ -// public static String item_walk_y = "walk_y"; -// /** -// * 报警 -// */ -// public static String item_error = "error"; -// /** -// * 任务号 -// */ -// public static String item_task = "task"; -// -// /** -// * 行走列 -// */ -// public static String item_to_command = "to_command"; -// /** -// * 下发起始站 -// */ -// public static String item_to_onset = "to_onset"; -// /** -// * 下发目标站 -// */ -// public static String item_to_target = "to_target"; -// /** -// * 下发任务号 -// */ -// public static String item_to_task = "to_task"; -// -// -// private OvenGantryManipulatorDeviceDriver driver; -// -// public ItemProtocol(OvenGantryManipulatorDeviceDriver driver) { -// this.driver = driver; -// } -// -// public int getHeartbeat() { -// return this.getOpcIntegerValue(item_heartbeat); -// } -// -// public int getMode() { -// return this.getOpcIntegerValue(item_mode); -// } -// -// public int getMove() { -// return this.getOpcIntegerValue(item_move); -// } -// -// public int getAction() { -// return this.getOpcIntegerValue(item_action); -// } -// -// public int getWalk_y() { -// return this.getOpcIntegerValue(item_walk_y); -// } -// -// public int getError() { -// return this.getOpcIntegerValue(item_error); -// } -// -// public int getTask() { -// return this.getOpcIntegerValue(item_task); -// } -// -// -// -// -// Boolean isonline; -// -// public int getOpcIntegerValue(String protocol) { -// Integer value = this.driver.getIntegeregerValue(protocol); -// if (value == null) { -// // log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); -// setIsonline(false); -// } else { -// setIsonline(true); -// return value; -// } -// return 0; -// -// } -// -// public String getOpcStringValue(String protocol) { -// String value = this.driver.getStringValue(protocol); -// if (StrUtil.isEmpty(value)) { -// -// } else { -// return value; -// } -// return "0"; -// } -// -// public static List getReadableItemDtos() { -// ArrayList list = new ArrayList(); -// list.add(new ItemDto(item_heartbeat, "心跳", "DB1.B0")); -// list.add(new ItemDto(item_mode, "工作模式", "DB1.B1")); -// list.add(new ItemDto(item_move, "光电信号", "DB1.B2")); -// list.add(new ItemDto(item_action, "动作信号", "DB1.B3")); -// list.add(new ItemDto(item_walk_y, "行走列", "DB1.B4")); -// list.add(new ItemDto(item_error, "报警信号", "DB1.B5")); -// list.add(new ItemDto(item_task, "任务号", "DB1.D6")); -// return list; -// } -// -// public static List getWriteableItemDtos() { -// ArrayList list = new ArrayList(); -// list.add(new ItemDto(item_to_command, "下发命令", "DB2.W0")); -// list.add(new ItemDto(item_to_onset, "下发起始站", "DB2.W2")); -// list.add(new ItemDto(item_to_target, "下发目标站", "DB2.W4")); -// list.add(new ItemDto(item_to_task, "下发任务号", "DB2.D6")); -// return list; -// } -// -// @Override -// public String toString() { -// return ""; -// } -//} -// diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/oven_manipulator/OvenGantryManipulatorDefination.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/oven_manipulator/OvenGantryManipulatorDefination.java deleted file mode 100644 index c77d28ef4..000000000 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/oven_manipulator/OvenGantryManipulatorDefination.java +++ /dev/null @@ -1,62 +0,0 @@ -//package org.nl.acs.device_driver.conveyor.oven_manipulator; -// -//import org.nl.acs.device.device_driver.standard_inspect.ItemDto; -//import org.nl.acs.device.domain.Device; -//import org.nl.acs.device_driver.DeviceDriver; -//import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination; -//import org.nl.acs.device.enums.DeviceType; -//import org.springframework.stereotype.Service; -// -//import java.util.LinkedList; -//import java.util.List; -// -///** -// * 烘箱-行架机械手 -// */ -//@Service -//public class OvenGantryManipulatorDefination implements OpcDeviceDriverDefination { -// @Override -// public String getDriverCode() { -// return "oven_manipulator"; -// } -// -// @Override -// public String getDriverName() { -// return "烘箱-行架机械手"; -// } -// -// @Override -// public String getDriverDescription() { -// return "烘箱-行架机械手"; -// } -// -// @Override -// public DeviceDriver getDriverInstance(Device device) { -// return (new OvenGantryManipulatorDeviceDriver()).setDevice(device).setDriverDefination(this); -// -// } -// -// @Override -// public Class getDeviceDriverType() { -// return OvenGantryManipulatorDeviceDriver.class; -// } -// -// @Override -// public List getFitDeviceTypes() { -// List types = new LinkedList(); -// types.add(DeviceType.station); -// return types; -// } -// -// @Override -// public List getReadableItemDtos() { -// return ItemProtocol.getReadableItemDtos(); -// } -// -// -// @Override -// public List getWriteableItemDtos() { -// return ItemProtocol.getWriteableItemDtos(); -// } -// -//} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java deleted file mode 100644 index f8b548938..000000000 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java +++ /dev/null @@ -1,1204 +0,0 @@ -////package org.nl.acs.device_driver.conveyor.oven_manipulator; -//// -////import cn.hutool.core.date.DateUtil; -////import cn.hutool.core.util.IdUtil; -////import cn.hutool.core.util.ObjectUtil; -////import cn.hutool.core.util.StrUtil; -////import com.alibaba.fastjson.JSONObject; -////import lombok.Data; -////import lombok.RequiredArgsConstructor; -////import lombok.extern.slf4j.Slf4j; -////import org.nl.acs.common.base.CommonFinalParam; -////import org.nl.acs.device.domain.Device; -////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.conveyor.hongxiang_device.HongXiangConveyorDeviceDriver; -////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.domain.Instruction; -////import org.nl.acs.instruction.enums.InstructionStatusEnum; -////import org.nl.acs.instruction.service.InstructionService; -////import org.nl.acs.log.service.DeviceExecuteLogService; -////import org.nl.acs.monitor.DeviceStageMonitor; -////import org.nl.acs.opc.DeviceAppService; -////import org.nl.acs.opc.DeviceAppServiceImpl; -////import org.nl.acs.route.service.RouteLineService; -////import org.nl.acs.task.enums.TaskStatusEnum; -////import org.nl.acs.task.service.TaskService; -////import org.nl.acs.task.service.dto.TaskDto; -////import org.nl.common.exception.BadRequestException; -////import org.nl.config.SpringContextHolder; -////import org.nl.config.language.LangProcess; -////import org.openscada.opc.lib.da.Server; -////import org.springframework.beans.factory.annotation.Autowired; -//// -////import java.util.*; -//// -/////** -//// * 烘箱-行架机械手 -//// */ -////@Slf4j -////@Data -////@RequiredArgsConstructor -////public class OvenGantryManipulatorDeviceDriver 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 -//// DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); -//// -//// /** -//// * 工作模式 -//// */ -//// int mode = 0; -//// int last_mode = 0; -//// /** -//// * 光电信号 -//// */ -//// int move = 0; -//// int last_move = 0; -//// /** -//// * 动作信号 -//// */ -//// int action = 0; -//// int last_action = 0; -//// /** -//// * 行走列 -//// */ -//// int walk_y = 0; -//// int last_walk_y = 0; -//// /** -//// * 报警 -//// */ -//// int error = 0; -//// int last_error = 0; -//// /** -//// * 任务号 -//// */ -//// int task = 0; -//// int last_task = 0; -//// -//// -//// Boolean isonline = true; -//// int hasGoods = 0; -//// String message = null; -//// Boolean iserror = false; -//// -//// Integer heartbeat_tag; -//// private Date instruction_require_time = new Date(); -//// -//// private int instruction_require_time_out; -//// /** -//// * 行架机械手申请任务成功标识 -//// */ -//// boolean requireSucess = false; -//// -//// private int instruction_finished_time_out; -//// -//// int branchProtocol = 0; -//// -//// -//// /** -//// * 暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域 -//// */ -//// int flag; -//// -//// String device_code; -//// -//// /** -//// * 0 无任务执行 1更新指令状态 2下发电气信号 3允许取货 允许放货 5放货完成 -//// */ -//// int now_steps_type = 0; -//// String notCreateTaskMessage = ""; -//// String notCreateInstMessage = ""; -//// String feedMessage = ""; -//// -//// -//// @Override -//// public Device getDevice() { -//// return this.device; -//// } -//// -//// -//// @Override -//// public void execute() { -//// String message = null; -//// try { -//// device_code = this.getDeviceCode(); -//// mode = this.itemProtocol.getMode(); -//// move = this.itemProtocol.getMove(); -//// action = this.itemProtocol.getAction(); -//// walk_y = this.itemProtocol.getWalk_y(); -//// error = this.itemProtocol.getError(); -//// task = this.itemProtocol.getTask(); -//// if (mode != last_mode) { -//// if (mode == 2) { -//// logServer.deviceExecuteLog(this.device_code, "", "", "信号复位前requireSuccess:" + requireSucess); -//// this.setRequireSucess(false); -//// message = null; -//// logServer.deviceExecuteLog(this.device_code, "", "", "信号复位后requireSuccess:" + requireSucess); -//// } -//// 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 (action != last_action) { -//// logServer.deviceItemValue(this.device_code, "action", String.valueOf(action)); -//// logServer.deviceExecuteLog(this.device_code, "", "", "信号action:" + last_action + "->" + action); -//// } -//// if (error != last_error) { -//// logServer.deviceItemValue(this.device_code, "error", String.valueOf(error)); -//// logServer.deviceExecuteLog(this.device_code, "", "", "信号error:" + last_error + "->" + error); -//// } -//// if (walk_y != last_walk_y) { -//// logServer.deviceItemValue(this.device_code, "walk_y", String.valueOf(walk_y)); -//// logServer.deviceExecuteLog(this.device_code, "", "", "信号walk_y:" + last_walk_y + "->" + walk_y); -//// } -//// if (task != last_task) { -//// logServer.deviceItemValue(this.device_code, "task", String.valueOf(task)); -//// logServer.deviceExecuteLog(this.device_code, "", "", "信号task:" + last_task + "->" + task); -//// } -//// -//// //更改任务状态 -//// if (task > 0) { -//// //inst_message -//// Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task)); -//// if (inst1 != null) { -//// if (StrUtil.equals(inst1.getInstruction_status(), InstructionStatusEnum.READY.getIndex())) { -//// inst1.setInstruction_status(InstructionStatusEnum.BUSY.getIndex()); -//// inst1.setExecute_device_code(this.device_code); -//// instructionService.update(inst1); -////// TaskDto tas未反馈电气信号原因kDto = taskserver.findByCodeFromCache(inst1.getTask_code()); -////// if (ObjectUtil.isNotEmpty(taskDto)) { -////// if (StrUtil.isNotEmpty(taskDto.getExt_task_id())) { -////// JSONArray array = new JSONArray(); -////// JSONObject map = new JSONObject(); -////// map.put("task_id", taskDto.getExt_task_id()); -////// map.put("task_status", CommonFinalParam.ONE); -////// array.add(map); -////// acsToWmsService.feedbackTaskStatusToWms(array); -////// } -////// } -//// } -//// } -//// } -//// -//// //申请取货 -//// if (mode == 3 && action == 1 && move == 0 && task > 0) { -//// Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task)); -//// if (ObjectUtil.isNotEmpty(inst2)) { -//// String start_device_code = inst2.getStart_device_code(); -//// Device device = deviceAppService.findDeviceByCode(start_device_code); -//// HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; -//// if (device.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { -//// hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) device.getDeviceDriver(); -//// //hongXiangConveyorDeviceDriver.writing("to_open_door", CommonFinalParam.ONE); -//// int mode = hongXiangConveyorDeviceDriver.getMode(); -//// int door = hongXiangConveyorDeviceDriver.getDoor(); -//// int action = hongXiangConveyorDeviceDriver.getAction(); -//// int error1 = hongXiangConveyorDeviceDriver.getError1(); -//// if (mode == 1 && door == 1 && action == 1 && error1 == 0) { -//// if (this.getNow_steps_type() == 2) { -//// this.writing("to_command", "2"); -//// this.setNow_steps_type(3); -//// } else { -//// logServer.deviceExecuteLog(this.device_code, "", "", "未反馈电气信号原因:当前步骤不为下发电气信号(now_steps_type!=2)"); -//// } -//// } else { -//// if (this.getNow_steps_type() == 2) { -//// feedMessage = "烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code(); -//// if (mode != 1) { -//// feedMessage = feedMessage + "mode未联机,"; -//// } -//// if (door != 1) { -//// feedMessage = feedMessage + "door未开门,"; -//// } -//// if (action != 1) { -//// feedMessage = feedMessage + "action未允许取放,"; -//// } -//// if (error1 != 0) { -//// feedMessage = feedMessage + "error1出现故障。"; -//// } -//// } -//// } -//// } else { -//// if (this.getNow_steps_type() == 2) { -//// this.writing("to_command", "2"); -//// this.setNow_steps_type(3); -//// } else { -//// logServer.deviceExecuteLog(this.device_code, "", "", "未反馈电气信号原因:当前步骤不为下发电气信号(now_steps_type!=2)\")"); -//// } -//// } -//// } -//// } else { -//// if (this.getNow_steps_type() == 2) { -//// feedMessage = "行架机械手:"; -//// if (mode != 3) { -//// feedMessage = feedMessage + "mode不为运行中状态,"; -//// } -//// if (action != 1) { -//// feedMessage = feedMessage + "action不为取货中状态,"; -//// } -//// if (move != 0) { -//// feedMessage = feedMessage + "move不为无货状态,"; -//// } -//// if (task == 0) { -//// feedMessage = feedMessage + "task为0。"; -//// } -//// } -//// } -//// -//// //取货完成关闭烘箱门 -//// if (mode == 3 && action == 2 && move == 1 && task > 0) { -//// Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task)); -//// if (ObjectUtil.isNotEmpty(inst2)) { -//// String start_device_code = inst2.getStart_device_code(); -//// Device device = deviceAppService.findDeviceByCode(start_device_code); -//// HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; -//// if (device.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { -//// hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) device.getDeviceDriver(); -//// hongXiangConveyorDeviceDriver.writing("to_close_door", CommonFinalParam.ONE); -//// } -//// if (this.getNow_steps_type() == 3) { -//// this.writing("to_command", "3"); -//// this.setNow_steps_type(4); -//// } else { -//// logServer.deviceExecuteLog(this.device_code, "", "", "未反馈电气信号原因:当前步骤不为允许取货(now_steps_type!=3)"); -//// } -//// } -//// } else { -//// if (this.getNow_steps_type() == 3) { -//// feedMessage = "行架机械手:"; -//// if (mode != 3) { -//// feedMessage = feedMessage + "mode不为运行中状态,"; -//// } -//// if (action != 2) { -//// feedMessage = feedMessage + "action不为取货完成状态,"; -//// } -//// if (move != 1) { -//// feedMessage = feedMessage + "move不为有货状态,"; -//// } -//// if (task == 0) { -//// feedMessage = feedMessage + "task为0。"; -//// } -//// } -//// } -//// -//// //申请放货 -//// if (mode == 3 && action == 3 && move == 1 && task > 0) { -//// Instruction instructionDto = instructionService.findByCode(String.valueOf(task)); -//// String next_device_code = instructionDto.getNext_device_code(); -//// Device nextDevice = deviceAppService.findDeviceByCode(next_device_code); -//// HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; -//// if (nextDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { -//// hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextDevice.getDeviceDriver(); -//// //hongXiangConveyorDeviceDriver.writing("to_open_door", CommonFinalParam.ONE); -//// int mode = hongXiangConveyorDeviceDriver.getMode(); -//// int door = hongXiangConveyorDeviceDriver.getDoor(); -//// int action = hongXiangConveyorDeviceDriver.getAction(); -//// int error1 = hongXiangConveyorDeviceDriver.getError1(); -//// if (mode == 1 && door == 1 && action == 1 && error1 == 0) { -//// if (this.getNow_steps_type() == 4) { -//// this.writing("to_command", "4"); -//// this.setNow_steps_type(5); -//// } else { -//// logServer.deviceExecuteLog(this.device_code, "", "", "未反馈电气信号原因:当前步骤不为允许放货(now_steps_type!=4)"); -//// } -//// } else { -//// feedMessage = "烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code(); -//// if (mode != 1) { -//// feedMessage = feedMessage + "mode未联机,"; -//// } -//// if (door != 1) { -//// feedMessage = feedMessage + "door未开门,"; -//// } -//// if (action != 1) { -//// feedMessage = feedMessage + "action未允许取放,"; -//// } -//// if (error1 != 0) { -//// feedMessage = feedMessage + "error1出现故障。"; -//// } -//// } -//// } else { -//// if (this.getNow_steps_type() == 4) { -//// this.writing("to_command", "4"); -//// this.setNow_steps_type(5); -//// } else { -//// logServer.deviceExecuteLog(this.device_code, "", "", "未反馈电气信号原因:当前步骤不为允许放货(now_steps_type!=4)"); -//// } -//// } -//// } else { -//// if (this.getNow_steps_type() == 4) { -//// feedMessage = "行架机械手:"; -//// if (mode != 3) { -//// feedMessage = feedMessage + "mode不为运行中状态,"; -//// } -//// if (action != 3) { -//// feedMessage = feedMessage + "action不为放货中状态,"; -//// } -//// if (move != 1) { -//// feedMessage = feedMessage + "move不为有货状态,"; -//// } -//// if (task == 0) { -//// feedMessage = feedMessage + "task为0。"; -//// } -//// } -//// } -//// -//// //放货完成 -//// if (mode == 3 && action == 4 && move == 0 && task > 0) { -//// Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task)); -//// if (inst2 != null) { -//// if (StrUtil.equals(inst2.getInstruction_status(), InstructionStatusEnum.BUSY.getIndex())) { -//// try { -//// finish_instruction(inst2); -//// } catch (Exception e) { -//// e.printStackTrace(); -//// } -//// TaskDto taskDto = taskserver.findByCode(inst2.getTask_code()); -//// -//// String next_device_code = taskDto.getNext_device_code(); -//// //String start_device_code = taskDto.getStart_device_code(); -//// //Device startDevice = deviceAppService.findDeviceByCode(start_device_code); -//// Device nextDevice = deviceAppService.findDeviceByCode(next_device_code); -//// HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; -////// if (startDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { -////// hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startDevice.getDeviceDriver(); -////// hongXiangConveyorDeviceDriver.writing("to_close_door", CommonFinalParam.ONE); -////// } -//// if (nextDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { -//// hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextDevice.getDeviceDriver(); -//// hongXiangConveyorDeviceDriver.writing("to_close_door", CommonFinalParam.ONE); -//// if (StrUtil.isNotEmpty(taskDto.getOven_time())) { -//// //下发烘箱时间 -//// int time = Integer.parseInt(taskDto.getOven_time()); -//// int hours = (time % (60 * 60 * 24)) / (60 * 60); -//// int minutes = (time % (60 * 60)) / 60; -//// hongXiangConveyorDeviceDriver.writing("to_time_house", String.valueOf(hours)); -//// hongXiangConveyorDeviceDriver.writing("to_time_min", String.valueOf(minutes)); -//// } -//// } -//// if (this.getNow_steps_type() == 5) { -//// this.writing("to_command", "5"); -//// this.setNow_steps_type(6); -//// this.setNow_steps_type(0); -//// feedMessage = ""; -//// } else { -//// logServer.deviceExecuteLog(this.device_code, "", "", "未反馈电气信号原因:当前步骤不为放货完成(now_steps_type!=5)"); -//// } -////// this.writing("to_onset", "0"); -////// this.writing("to_target", "0"); -////// this.writing("to_task", "0"); -//// } -//// } -//// } else { -//// if (this.getNow_steps_type() == 5) { -//// feedMessage = "行架机械手:"; -//// if (mode != 3) { -//// feedMessage = feedMessage + "mode不为运行中状态,"; -//// } -//// if (action != 4) { -//// feedMessage = feedMessage + "action不为放货完成状态,"; -//// } -//// if (move != 0) { -//// feedMessage = feedMessage + "move不为无货状态,"; -//// } -//// if (task == 0) { -//// feedMessage = feedMessage + "task为0。"; -//// } -//// } -//// } -//// -//// } catch (Exception var17) { -//// feedMessage = var17.getMessage(); -//// logServer.deviceExecuteLog(this.getDevice_code(), "", "", "读取信号值时出现异常:" + var17.getMessage()); -//// } -//// -////// if (!this.itemProtocol.getIsonline()) { -////// this.setIsonline(false); -////// this.setIserror(true); -////// message = "信号量同步异常"; -////// //未联机 -////// } else -//// if (mode == 0) { -//// this.setIsonline(false); -//// message = "未联机"; -//// //有报警 -//// } else if (error != 0) { -//// this.setIserror(true); -//// message = "有报警"; -//// //无报警 -//// } else { -//// this.setIsonline(true); -//// this.setIserror(false); -//// message = ""; -//// Instruction instruction = null; -//// List toInstructions; -//// -//// //行架机械手申请任务 -//// if (mode == 2 && move == 0 && task == 0 && !requireSucess) { -//// applyTask(); -//// notCreateInstMessage = ""; -//// notCreateTaskMessage = ""; -//// feedMessage = ""; -//// } else { -//// if (mode == 2) { -//// //if (!requireSucess) { -//// String remark = "未查找任务原因为:"; -//// if (mode != 2) { -//// remark = remark + "mode不是待机状态,"; -//// } -//// if (move != 0) { -//// remark = remark + "move为有货状态,"; -//// } -//// if (task != 0) { -//// remark = remark + "task任务号不为0,"; -//// } -//// if (requireSucess) { -//// remark = remark + "请求标记requireSucess为true。"; -//// } -//// this.setNotCreateTaskMessage(remark); -//// //} -//// } -//// } -//// -//// } -//// last_mode = mode; -//// last_move = move; -//// last_action = action; -//// last_walk_y = walk_y; -//// last_error = error; -//// last_task = task; -//// } -//// -//// -//// public boolean exe_error() { -//// if (this.error == 0) { -//// return true; -//// } else { -//// log.debug("设备报警"); -//// return false; -//// } -//// } -//// -//// -//// /** -//// * 申请任务 -//// * -//// * @param -//// */ -//// public synchronized boolean applyTask() { -//// 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; -//// //抓取工位 -//// List getDeviceCodeList = this.getExtraDeviceCodes("get_device_code"); -//// //放货工位 -//// List putDeviceCodeList = this.getExtraDeviceCodes("put_device_code"); -//// 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)) { -//// //按照优先级排序 优先级相等按照创建时间排序 -//// taskDtos = this.sortTask(taskDtos); -//// TaskDto taskDto = taskDtos.get(0); -//// Instruction instruction = instructionService.findByTaskcode(taskDto.getTask_code()); -//// String start_device_code = instruction.getStart_device_code(); -//// String next_device_code = instruction.getNext_device_code(); -//// //判断关联的同一列烘箱设备是否都关门 都关门返回false,有一个不关门就返回true -//// boolean isCloseDoor = this.judgeCloseDoor(start_device_code, next_device_code); -//// //未关门结束 -//// if (isCloseDoor) { -//// return false; -//// } -//// instruction.setInstruction_status(InstructionStatusEnum.BUSY.getIndex()); -//// instruction.setUpdate_time(DateUtil.now()); -//// instructionService.update(instruction); -//// Device startDevice = deviceAppService.findDeviceByCode(start_device_code); -//// Device nextDevice = deviceAppService.findDeviceByCode(next_device_code); -//// if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) { -//// throw new BadRequestException(LangProcess.msg("device_checkAdd", startDevice.getDevice_code())); -//// } -//// if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))) { -//// throw new BadRequestException(LangProcess.msg("device_checkAdd", nextDevice.getDevice_code())); -//// } -//// String start_addr = startDevice.getExtraValue().get("address").toString(); -//// String next_addr = nextDevice.getExtraValue().get("address").toString(); -//// this.writing("to_onset", start_addr); -//// this.writing("to_target", next_addr); -//// this.writing("to_task", instruction.getInstruction_code()); -//// this.writing("to_command", CommonFinalParam.ONE); -//// -//// this.setNow_steps_type(2); -//// this.setRequireSucess(true); -//// return true; -//// } else { -//// List taskDtoList = taskserver.queryTaskByDeviceCode(startDeviceCode); -//// if (ObjectUtil.isNotEmpty(taskDtoList)) { -//// //按照优先级排序 优先级相等按照创建时间排序 -//// taskDtoList = this.sortTask(taskDtoList); -//// task = taskDtoList.get(0); -//// } -//// 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(InstructionStatusEnum.READY.getIndex()); -//// instdto.setExecute_device_code(start_point_code); -//// -//// //判断关联的同一列烘箱设备是否都关门 都关门返回false,有一个不关门就返回true -//// boolean isCloseDoor = this.judgeCloseDoor(instdto.getStart_device_code(), instdto.getNext_device_code()); -//// //如果未关门结束 -//// if (isCloseDoor) { -//// return false; -//// } -//// -//// try { -//// instructionService.create(instdto); -//// } catch (Exception e) { -//// notCreateInstMessage = e.getMessage(); -//// logServer.deviceExecuteLog(this.getDevice_code(), "", "", "创建指令时出现异常:" + e.getMessage()); -//// return false; -//// } -//// //创建指令后修改任务状态 -//// task.setTask_status(TaskStatusEnum.BUSY.getIndex()); -//// task.setUpdate_time(DateUtil.now()); -//// taskserver.update(task); -//// -//// Device startDevice = deviceAppService.findDeviceByCode(instdto.getStart_device_code()); -//// Device nextDevice = deviceAppService.findDeviceByCode(instdto.getNext_device_code()); -//// if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) { -//// notCreateInstMessage = "设备:" + startDevice.getDevice_code() + "未设置电气调度号!"; -//// logServer.deviceExecuteLog(this.getDevice_code(), "", "", "设备:" + startDevice.getDevice_code() + "未设置电气调度号!"); -//// throw new BadRequestException(LangProcess.msg("device_checkAdd", startDevice.getDevice_code())); -//// } -//// if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))) { -//// notCreateInstMessage = "设备:" + nextDevice.getDevice_code() + "未设置电气调度号!"; -//// logServer.deviceExecuteLog(this.getDevice_code(), "", "", "设备:" + nextDevice.getDevice_code() + "未设置电气调度号!"); -//// throw new BadRequestException(LangProcess.msg("device_checkAdd", nextDevice.getDevice_code())); -//// -//// } -//// String start_addr = startDevice.getExtraValue().get("address").toString(); -//// String next_addr = nextDevice.getExtraValue().get("address").toString(); -//// this.writing("to_onset", start_addr); -//// this.writing("to_target", next_addr); -//// this.writing("to_task", instdto.getInstruction_code()); -//// this.writing("to_command", CommonFinalParam.ONE); -//// HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; -//// if (nextDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { -//// hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextDevice.getDeviceDriver(); -//// hongXiangConveyorDeviceDriver.writing("to_open_door", CommonFinalParam.ONE); -//// hongXiangConveyorDeviceDriver.writing("to_open_door", CommonFinalParam.ONE); -//// } -//// if (startDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { -//// hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startDevice.getDeviceDriver(); -//// hongXiangConveyorDeviceDriver.writing("to_open_door", CommonFinalParam.ONE); -//// hongXiangConveyorDeviceDriver.writing("to_open_door", CommonFinalParam.ONE); -//// } -//// this.setNow_steps_type(2); -//// this.setRequireSucess(true); -//// notCreateInstMessage = ""; -//// notCreateTaskMessage = ""; -//// } else { -//// notCreateInstMessage = "未找到关联设备的任务,指令无法创建"; -//// } -//// return true; -//// } -//// } -//// -//// public boolean exe_business() { -//// return true; -//// } -//// -//// public synchronized boolean finish_instruction(Instruction inst) throws Exception { -//// instructionService.finish(inst); -//// return true; -//// } -//// -//// public void writing(String param, String value) { -//// -//// String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() -//// + "." + param; -//// //String opcservcerid = this.getDevice().getOpc_server_id(); -//////Server server = ReadUtil.getServer(opcservcerid); -//// Map itemMap = new HashMap(); -//// -//// itemMap.put(to_param, Integer.parseInt(value)); -////// itemMap.put(to_param, Integer.parseInt(value)); -//// this.control(itemMap); -//// logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value); -//// } -//// -//// public void executing(Server server, Map itemMap) { -//// this.control(itemMap); -//// } -//// -//// /** -//// * 判断取货位或放货位为烘箱设备时关联的同一列烘箱设备是否有开门 -//// * @param start_device_code -//// * @param next_device_code -//// * @return -//// */ -//// public boolean judgeCloseDoor(String start_device_code, String next_device_code) { -//// Boolean isClose = false; -//// -//// try { -//// Device startDevice = deviceAppService.findDeviceByCode(start_device_code); -//// Device nextDevice = deviceAppService.findDeviceByCode(next_device_code); -//// HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; -//// if (ObjectUtil.isEmpty(startDevice)) { -//// throw new BadRequestException(LangProcess.msg("error_isNull", start_device_code)); -//// } -//// if (startDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { -//// hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startDevice.getDeviceDriver(); -//// List deviceCodes = hongXiangConveyorDeviceDriver.getExtraDeviceCodes("link_device_code"); -//// if (ObjectUtil.isNotEmpty(deviceCodes)) { -//// for (String deviceCode : deviceCodes) { -//// Device linkDevice = deviceAppService.findDeviceByCode(deviceCode); -//// if (ObjectUtil.isEmpty(linkDevice)) { -//// throw new BadRequestException(LangProcess.msg("device_checkrelate", start_device_code, deviceCode, "is null")); -//// } -// if (nextDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { -// hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextDevice.getDeviceDriver(); -// hongXiangConveyorDeviceDriver.writing("to_close_door", CommonFinalParam.ONE); -// if (StrUtil.isNotEmpty(taskDto.getOven_time())) { -// //下发烘箱时间 -// int time = Integer.parseInt(taskDto.getOven_time()); -// int hours = (time % (60 * 60 * 24)) / (60 * 60); -// int minutes = (time % (60 * 60)) / 60; -// hongXiangConveyorDeviceDriver.writing("to_time_house", String.valueOf(hours)); -// hongXiangConveyorDeviceDriver.writing("to_time_min", String.valueOf(minutes)); -// } -// } -// if (this.getNow_steps_type() == 5) { -// this.writing("to_command", "5"); -// this.setNow_steps_type(6); -// this.setNow_steps_type(0); -// feedMessage = ""; -// } else { -// logServer.deviceExecuteLog(this.device_code, "", "", "未反馈电气信号原因:当前步骤不为放货完成(now_steps_type!=5)"); -// } -//// this.writing("to_onset", "0"); -//// this.writing("to_target", "0"); -//// this.writing("to_task", "0"); -// } -// } -// } else { -// if (this.getNow_steps_type() == 5) { -// feedMessage = "行架机械手:"; -// if (mode != 3) { -// feedMessage = feedMessage + "mode不为运行中状态,"; -// } -// if (action != 4) { -// feedMessage = feedMessage + "action不为放货完成状态,"; -// } -// if (move != 0) { -// feedMessage = feedMessage + "move不为无货状态,"; -// } -// if (task == 0) { -// feedMessage = feedMessage + "task为0。"; -// } -// } -// } -// -// } catch (Exception var17) { -// feedMessage = var17.getMessage(); -// logServer.deviceExecuteLog(this.getDevice_code(), "", "", "读取信号值时出现异常:" + var17.getMessage()); -// } -// -//// if (!this.itemProtocol.getIsonline()) { -//// this.setIsonline(false); -//// this.setIserror(true); -//// message = "信号量同步异常"; -//// //未联机 -//// } else -// if (mode == 0) { -// this.setIsonline(false); -// message = "未联机"; -// //有报警 -// } else if (error != 0) { -// this.setIserror(true); -// message = "有报警"; -// //无报警 -// } else { -// this.setIsonline(true); -// this.setIserror(false); -// message = ""; -// Instruction instruction = null; -// List toInstructions; -// -// //行架机械手申请任务 -// if (mode == 2 && move == 0 && task == 0 && !requireSucess) { -// applyTask(); -// notCreateInstMessage = ""; -// notCreateTaskMessage = ""; -// feedMessage = ""; -// } else { -// if (mode == 2) { -// //if (!requireSucess) { -// String remark = "未查找任务原因为:"; -// if (mode != 2) { -// remark = remark + "mode不是待机状态,"; -// } -// if (move != 0) { -// remark = remark + "move为有货状态,"; -// } -// if (task != 0) { -// remark = remark + "task任务号不为0,"; -// } -// if (requireSucess) { -// remark = remark + "请求标记requireSucess为true。"; -// } -// this.setNotCreateTaskMessage(remark); -// //} -// } -// } -// -// } -// last_mode = mode; -// last_move = move; -// last_action = action; -// last_walk_y = walk_y; -// last_error = error; -// last_task = task; -// } -// -// -// public boolean exe_error() { -// if (this.error == 0) { -// return true; -// } else { -// log.debug("设备报警"); -// return false; -// } -// } -// -// -// /** -// * 申请任务 -// * -// * @param -// */ -// public synchronized boolean applyTask() { -// 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; -// //抓取工位 -// List getDeviceCodeList = this.getExtraDeviceCodes("get_device_code"); -// //放货工位 -// List putDeviceCodeList = this.getExtraDeviceCodes("put_device_code"); -// 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)) { -// //按照优先级排序 优先级相等按照创建时间排序 -// taskDtos = this.sortTask(taskDtos); -// TaskDto taskDto = taskDtos.get(0); -// Instruction instruction = instructionService.findByTaskcode(taskDto.getTask_code()); -// String start_device_code = instruction.getStart_device_code(); -// String next_device_code = instruction.getNext_device_code(); -// //判断关联的同一列烘箱设备是否都关门 都关门返回false,有一个不关门就返回true -// boolean isCloseDoor = this.judgeCloseDoor(start_device_code, next_device_code); -// //未关门结束 -// if (isCloseDoor) { -// return false; -// } -// instruction.setInstruction_status(InstructionStatusEnum.BUSY.getIndex()); -// instruction.setUpdate_time(DateUtil.now()); -// instructionService.update(instruction); -// Device startDevice = deviceAppService.findDeviceByCode(start_device_code); -// Device nextDevice = deviceAppService.findDeviceByCode(next_device_code); -// if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) { -// throw new BadRequestException(LangProcess.msg("device_checkAdd", startDevice.getDevice_code())); -// } -// if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))) { -// throw new BadRequestException(LangProcess.msg("device_checkAdd", nextDevice.getDevice_code())); -// } -// String start_addr = startDevice.getExtraValue().get("address").toString(); -// String next_addr = nextDevice.getExtraValue().get("address").toString(); -// this.writing("to_onset", start_addr); -// this.writing("to_target", next_addr); -// this.writing("to_task", instruction.getInstruction_code()); -// this.writing("to_command", CommonFinalParam.ONE); -// -// this.setNow_steps_type(2); -// this.setRequireSucess(true); -// return true; -// } else { -// List taskDtoList = taskserver.queryTaskByDeviceCode(startDeviceCode); -// if (ObjectUtil.isNotEmpty(taskDtoList)) { -// //按照优先级排序 优先级相等按照创建时间排序 -// taskDtoList = this.sortTask(taskDtoList); -// task = taskDtoList.get(0); -// } -// 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(InstructionStatusEnum.READY.getIndex()); -// instdto.setExecute_device_code(start_point_code); -// -// //判断关联的同一列烘箱设备是否都关门 都关门返回false,有一个不关门就返回true -// boolean isCloseDoor = this.judgeCloseDoor(instdto.getStart_device_code(), instdto.getNext_device_code()); -// //如果未关门结束 -// if (isCloseDoor) { -// return false; -// } -// -// try { -// instructionService.create(instdto); -// } catch (Exception e) { -// notCreateInstMessage = e.getMessage(); -// logServer.deviceExecuteLog(this.getDevice_code(), "", "", "创建指令时出现异常:" + e.getMessage()); -// return false; -// } -// //创建指令后修改任务状态 -// task.setTask_status(TaskStatusEnum.BUSY.getIndex()); -// task.setUpdate_time(DateUtil.now()); -// taskserver.update(task); -// -// Device startDevice = deviceAppService.findDeviceByCode(instdto.getStart_device_code()); -// Device nextDevice = deviceAppService.findDeviceByCode(instdto.getNext_device_code()); -// if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) { -// notCreateInstMessage = "设备:" + startDevice.getDevice_code() + "未设置电气调度号!"; -// logServer.deviceExecuteLog(this.getDevice_code(), "", "", "设备:" + startDevice.getDevice_code() + "未设置电气调度号!"); -// throw new BadRequestException(LangProcess.msg("device_checkAdd", startDevice.getDevice_code())); -// } -// if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))) { -// notCreateInstMessage = "设备:" + nextDevice.getDevice_code() + "未设置电气调度号!"; -// logServer.deviceExecuteLog(this.getDevice_code(), "", "", "设备:" + nextDevice.getDevice_code() + "未设置电气调度号!"); -// throw new BadRequestException(LangProcess.msg("device_checkAdd", nextDevice.getDevice_code())); -// -// } -// String start_addr = startDevice.getExtraValue().get("address").toString(); -// String next_addr = nextDevice.getExtraValue().get("address").toString(); -// this.writing("to_onset", start_addr); -// this.writing("to_target", next_addr); -// this.writing("to_task", instdto.getInstruction_code()); -// this.writing("to_command", CommonFinalParam.ONE); -// HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; -// if (nextDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { -// hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextDevice.getDeviceDriver(); -// hongXiangConveyorDeviceDriver.writing("to_open_door", CommonFinalParam.ONE); -// hongXiangConveyorDeviceDriver.writing("to_open_door", CommonFinalParam.ONE); -// } -// if (startDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { -// hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startDevice.getDeviceDriver(); -// hongXiangConveyorDeviceDriver.writing("to_open_door", CommonFinalParam.ONE); -// hongXiangConveyorDeviceDriver.writing("to_open_door", CommonFinalParam.ONE); -// } -// this.setNow_steps_type(2); -// this.setRequireSucess(true); -// notCreateInstMessage = ""; -// notCreateTaskMessage = ""; -// } else { -// notCreateInstMessage = "未找到关联设备的任务,指令无法创建"; -// } -// return true; -// } -// } -// -// public boolean exe_business() { -// return true; -// } -// -// public synchronized boolean finish_instruction(Instruction inst) throws Exception { -// instructionService.finish(inst); -// return true; -// } -// -// public void writing(String param, String value) { -// -// String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() -// + "." + param; -// //String opcservcerid = this.getDevice().getOpc_server_id(); -////Server server = ReadUtil.getServer(opcservcerid); -// Map itemMap = new HashMap(); -// -// itemMap.put(to_param, Integer.parseInt(value)); -//// itemMap.put(to_param, Integer.parseInt(value)); -// this.control(itemMap); -// logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value); -// } -// -// public void executing(Server server, Map itemMap) { -// this.control(itemMap); -// } -// -// /** -// * 判断取货位或放货位为烘箱设备时关联的同一列烘箱设备是否有开门 -// * @param start_device_code -// * @param next_device_code -// * @return -// */ -// public boolean judgeCloseDoor(String start_device_code, String next_device_code) { -// Boolean isClose = false; -// -// try { -// Device startDevice = deviceAppService.findDeviceByCode(start_device_code); -// Device nextDevice = deviceAppService.findDeviceByCode(next_device_code); -// HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; -// if (ObjectUtil.isEmpty(startDevice)) { -// throw new BadRequestException(LangProcess.msg("error_isNull", start_device_code)); -// } -// if (startDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { -// hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startDevice.getDeviceDriver(); -// List deviceCodes = hongXiangConveyorDeviceDriver.getExtraDeviceCodes("link_device_code"); -// if (ObjectUtil.isNotEmpty(deviceCodes)) { -// for (String deviceCode : deviceCodes) { -// Device linkDevice = deviceAppService.findDeviceByCode(deviceCode); -// if (ObjectUtil.isEmpty(linkDevice)) { -// throw new BadRequestException(LangProcess.msg("device_checkrelate", start_device_code, deviceCode, "is null")); -// } -// if (linkDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { -// hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) linkDevice.getDeviceDriver(); -// //判断关联设备是否开门 -// if (hongXiangConveyorDeviceDriver.getDoor() == 1) { -// isClose = true; -// notCreateInstMessage = start_device_code + "关联设备->" + deviceCode + "烘箱门未关闭!"; -// break; -// } -// } -// } -// return isClose; -// } -// } -// if (ObjectUtil.isEmpty(nextDevice)) { -// throw new BadRequestException(LangProcess.msg("error_isNull", next_device_code)); -// } -// if (nextDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { -// hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextDevice.getDeviceDriver(); -// List deviceCodes = hongXiangConveyorDeviceDriver.getExtraDeviceCodes("link_device_code"); -// if (ObjectUtil.isNotEmpty(deviceCodes)) { -// for (String deviceCode : deviceCodes) { -// Device linkDevice = deviceAppService.findDeviceByCode(deviceCode); -// if (ObjectUtil.isEmpty(linkDevice)) { -// throw new BadRequestException(LangProcess.msg("device_checkrelate", next_device_code, deviceCode, "is null")); -// } -// if (linkDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { -// hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) linkDevice.getDeviceDriver(); -// //判断关联设备是否开门 -// if (hongXiangConveyorDeviceDriver.getDoor() == 1) { -// isClose = true; -// notCreateInstMessage = next_device_code + "关联设备->" + deviceCode + "烘箱门未关闭!"; -// break; -// } -// } -// } -// return isClose; -// } -// } -// } catch (Exception e) { -// isClose = true; -// logServer.deviceExecuteLog(this.getDevice_code(), "", "", "检查烘箱是否关门时出现异常:" + e.getMessage()); -// notCreateInstMessage = "检查烘箱是否关门时出现异常:" + e.getMessage(); -// } -// return isClose; -// } -// -// public void writing(int command) { -// //String opcservcerid = this.getDevice().getOpc_server_id(); -////Server server = ReadUtil.getServer(opcservcerid); -// Map itemMap = new HashMap(); -// this.control(itemMap); -// -// } -// -// /** -// * 将扩展表中的字符串数据转换成集合 -// */ -// @Override -// 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; -// } -// -// public List sortTask(List taskDtos) { -// Collections.sort(taskDtos, new Comparator() { -// @Override -// public int compare(TaskDto t1, TaskDto t2) { -// //优先级从大到小 -// int i = t2.getPriority().compareTo(t1.getPriority()); -// //如果优先级相等 -// if (i == 0) { -// //时间从早到晚 -// i = t1.getCreate_time().compareTo(t2.getCreate_time()); -// } -// return i; -// } -// }); -// return taskDtos; -// } -// -// -// @Override -// public JSONObject getDeviceStatusName() { -// JSONObject jo = new JSONObject(); -// String mode = ""; -// String move = ""; -// String action = ""; -// String walk_y = ""; -// if (this.getMode() == 0) { -// mode = "脱机"; -// } else if (this.getMode() == 1) { -// mode = "单机"; -// } else if (this.getMode() == 2) { -// mode = "待机"; -// } else if (this.getMode() == 3) { -// mode = "运行中"; -// } -// -// if (this.getMove() == 0) { -// move = "无货"; -// } else if (this.getMove() == 1) { -// move = "有货"; -// } -// -// String requireSucess = "0"; -// if (this.requireSucess) { -// requireSucess = CommonFinalParam.ONE; -// } -// jo.put("requireSucess", requireSucess); -// if (this.getAction() == 1) { -// action = "取货中"; -// } else if (this.getAction() == 2) { -// action = "取货完成"; -// } else if (this.getAction() == 3) { -// action = "放货中"; -// } else if (this.getAction() == 4) { -// action = "放货完成"; -// } -// -// jo.put("device_name", this.getDevice().getDevice_name()); -// jo.put("mode", mode); -// jo.put("move", move); -// jo.put("action", action); -// jo.put("task", task); -// jo.put("walk_y", walk_y); -// jo.put("isOnline", this.getIsonline()); -// jo.put("error", this.getError()); -// jo.put("isError", this.getIserror()); -// jo.put("message", this.getMessage()); -// jo.put("notCreateTaskMessage", notCreateTaskMessage); -// jo.put("notCreateInstMessage", notCreateInstMessage); -// jo.put("feedMessage", feedMessage); -// jo.put("driver_type", "siemens_conveyor"); -// jo.put("is_click", true); -// return jo; -// } -// -// @Override -// public void setDeviceStatus(JSONObject data) { -// String requestSucess = data.getString("requireSucess"); -// if (StrUtil.equals(requestSucess, "0")) { -// this.requireSucess = false; -// } else if (StrUtil.equals(requestSucess, CommonFinalParam.ONE)) { -// this.requireSucess = true; -// } -// } -// -//// public void writing(int type, int command) { -//// String to_material_code = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() -//// + "." + ItemProtocol.item_to_material_code; -//// String opcservcerid = this.getDevice().getOpc_server_id(); -//// Server server = ReadUtil.getServer(opcservcerid); -//// Map itemMap = new HashMap(); -//// if (type == 2) { -//// itemMap.put(to_material_code, command); -//// } -//// this.control(itemMap); -//// -//// } -// -//} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/oven_manipulator/Test.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/oven_manipulator/Test.java deleted file mode 100644 index 1a4b7bfd5..000000000 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/oven_manipulator/Test.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.nl.acs.device_driver.conveyor.oven_manipulator; - -import java.text.DecimalFormat; - -public class Test { - public static String beautifyTime(double second) { - if (second <= 0) { - return "0"; - } - final String[] units = new String[]{"秒", "分钟", "小时"}; - int digitGroups = (int) (Math.log10(second) / Math.log10(60)); - String value = "0"; - if (digitGroups < 3) { - value = new DecimalFormat("#,##0.#").format(second / Math.pow(60, digitGroups)) + "" + units[digitGroups]; - } else if (digitGroups >= 3) { - //如果超过了小时的表达范围则,则转换为天,小时,分,秒格式 - - value = secondToDate(second); - } - - return value; - } - - public static String secondToDate(double second) { - Long time = new Long(new Double(second).longValue()); - String strTime = null; - Long days = time / (60 * 60 * 24); - Long hours = (time % (60 * 60 * 24)) / (60 * 60); - Long minutes = (time % (60 * 60)) / 60; - Long seconds = time % 60; - if (days > 0) { - strTime = days + "天" + hours + "小时" + minutes + "分钟"; - } else if (hours > 0) { - strTime = hours + "小时" + minutes + "分钟"; - } else if (minutes > 0) { - strTime = minutes + "分钟" + seconds + "秒"; - } else { - strTime = second + "秒"; - } - return strTime; - } - - - public static void main(String[] args) { - - Long time = new Long(new Double(7500).longValue()); - Long hours = (time % (60 * 60 * 24)) / (60 * 60); - Long minutes = (time % (60 * 60)) / 60; - Long seconds = time % 60; - System.out.println(hours); - System.out.println(minutes); - System.out.println(seconds); - - } - -} From 14090a0d462c2b27c1b19500467110bfff82799c Mon Sep 17 00:00:00 2001 From: "ZHOUZ\\Noble'lift" <1014987728@qq.com> Date: Tue, 23 Jan 2024 17:44:07 +0800 Subject: [PATCH 2/5] =?UTF-8?q?rev=EF=BC=9A=E9=9B=86=E7=BE=A4=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/org/nl/config/ESConfig.java | 1 - .../acs/service/impl/AcsToWmsServiceImpl.java | 7 +- .../ivt/service/dto/PackagePointIvtDto.java | 10 +++ .../wms/sch/manage/AutoCallEmptyVehicle.java | 40 ++++++--- .../nl/wms/sch/manage/AutoQueryBillInfo.java | 41 +++++++-- .../nl/wms/sch/manage/AutoQueryConRem.java | 70 +++++++++------ .../wms/sch/manage/AutoQueryDeviceStatus.java | 88 +++++++++++-------- .../wms/sch/manage/AutoQueryProudDayData.java | 62 ++++++++----- .../nl/wms/sch/manage/AutoQueryUpload.java | 27 +++++- .../org/nl/wms/sch/manage/AutoSendFeiShu.java | 37 +++++--- .../impl/RawAssistIStorServiceImpl.java | 22 ++++- .../st/inbill/wql/QST_IVT_RAWASSISTISTOR.wql | 65 ++++++++++++++ .../resources/config/application-prod.yml | 47 ++++------ .../src/main/resources/config/application.yml | 37 ++------ .../src/main/resources/logback-spring.xml | 1 - 15 files changed, 370 insertions(+), 185 deletions(-) diff --git a/lms/nladmin-system/src/main/java/org/nl/config/ESConfig.java b/lms/nladmin-system/src/main/java/org/nl/config/ESConfig.java index 1222496c6..80fa00ed7 100644 --- a/lms/nladmin-system/src/main/java/org/nl/config/ESConfig.java +++ b/lms/nladmin-system/src/main/java/org/nl/config/ESConfig.java @@ -13,6 +13,5 @@ import org.springframework.context.annotation.Configuration; @Data public class ESConfig { - @Value(("${es.index}")) private String index; } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java index 61cf683d1..987fd8e45 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java @@ -1315,11 +1315,11 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { String point_type = task_jo.getString("task_type"); //取货完成 if ("1".equals(type)) { - if ("010602".equals(point_type) || "010606".equals(point_type)) { + if ("010602".equals(point_type)) { JSONObject point1_jo = ivt_shaftivt.query("point_code = '" + task_jo.getString("point_code1") + "'").uniqueResult(0); point1_jo.put("have_qzz", "0"); ivt_shaftivt.update(point1_jo); - } else if ("010607".equals(point_type) || "010603".equals(point_type)) { + } else if ("010607".equals(point_type) || "010603".equals(point_type) || "010606".equals(point_type)) { JSONObject point1_jo = ivt_shaftivt.query("point_code = '" + task_jo.getString("point_code1") + "'").uniqueResult(0); point1_jo.put("qzz_size", ""); point1_jo.put("qzz_generation", ""); @@ -1388,6 +1388,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { paperTrussTask.immediateNotifyAcs(null); } } else { + //判断当前套管工位上是否存在可用的纸管或任务 + JSONObject tggw_jo = WQLObject.getWQLObject("st_ivt_shaftivt").query("point_type = '4' AND product_area = '" + product_area + "'").uniqueResult(0); + JSONObject tggw_task = WQLObject.getWQLObject("sch_base_task").query("point_code1 = '"+tggw_jo.getString("point_code")+"' AND task_type = '010607' AND is_delete = '0' ADN task_status < '07'").uniqueResult(0); //判断在等待任务数量范围内是否存在符合的纸管,如果存在则等待,不存在则创建空载具入库任务 boolean need_wait = this.judgeWait(product_area, vehicle_jo); if (!need_wait) { diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/service/dto/PackagePointIvtDto.java b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/service/dto/PackagePointIvtDto.java index 3eb2ca8d7..08ed5bea1 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/service/dto/PackagePointIvtDto.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/service/dto/PackagePointIvtDto.java @@ -57,6 +57,16 @@ public class PackagePointIvtDto implements Serializable { */ private String tube_name1; + /** + * 子卷号1编码 + */ + private String container_name1; + + /** + * 子卷号2编码 + */ + private String container_name2; + /** * 顺序号 */ diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoCallEmptyVehicle.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoCallEmptyVehicle.java index 5021b9a95..545b27822 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoCallEmptyVehicle.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoCallEmptyVehicle.java @@ -1,11 +1,13 @@ package org.nl.wms.sch.manage; +import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; +import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.wql.WQL; @@ -17,9 +19,12 @@ import org.nl.wms.sch.tasks.CutConveyorTask; import org.nl.wms.sch.tasks.PaperTrussTask; import org.nl.wms.sch.tasks.PaperTubeTask; import org.nl.wms.sch.tasks.URLEnum; +import org.redisson.api.RLock; +import org.redisson.api.RedissonClient; import org.springframework.stereotype.Component; import java.util.HashMap; +import java.util.concurrent.TimeUnit; @Slf4j @Component @@ -34,20 +39,35 @@ public class AutoCallEmptyVehicle { private final WmsToAcsService wmsToAcsService; + private final RedissonClient redissonClient; + + @SneakyThrows public void run() { - for (URLEnum url : URLEnum.values()) { - String product_area = url.getProduct_area(); - JSONObject nbj_jo = WQLObject.getWQLObject("st_ivt_shaftivt").query("product_area = '" + product_area + "' AND point_type = '9'").uniqueResult(0); - if (ObjectUtil.isEmpty(nbj_jo)) { - continue; + RLock lock = redissonClient.getLock(this.getClass().getName()); + boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS); + try { + if (tryLock){ +// log.info("AutoCallEmptyVehicle"+ DateUtil.now()+"执行!!!!"); + for (URLEnum url : URLEnum.values()) { + String product_area = url.getProduct_area(); + JSONObject nbj_jo = WQLObject.getWQLObject("st_ivt_shaftivt").query("product_area = '" + product_area + "' AND point_type = '9'").uniqueResult(0); + if (ObjectUtil.isEmpty(nbj_jo)) { + continue; + } + if (nbj_jo.getString("is_used").equals("1")) { + //上半部分 + this.callEmptyVehicle(product_area, "0"); + //下半部分 + this.callEmptyVehicle(product_area, "1"); + } + } } - if (nbj_jo.getString("is_used").equals("1")) { - //上半部分 - this.callEmptyVehicle(product_area, "0"); - //下半部分 - this.callEmptyVehicle(product_area, "1"); + }finally { + if (tryLock) { + lock.unlock(); } } + } void callEmptyVehicle(String product_area, String point_location) { diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryBillInfo.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryBillInfo.java index d91258176..4fe51c90d 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryBillInfo.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryBillInfo.java @@ -1,32 +1,55 @@ package org.nl.wms.sch.manage; +import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.http.HttpRequest; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; +import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.nl.modules.wql.core.bean.WQLObject; import org.nl.modules.wql.util.SpringContextHolder; import org.nl.system.service.param.impl.SysParamServiceImpl; +import org.redisson.api.RLock; +import org.redisson.api.RedissonClient; import org.springframework.stereotype.Component; +import java.util.concurrent.TimeUnit; + @Slf4j @Component @RequiredArgsConstructor public class AutoQueryBillInfo { + + private final RedissonClient redissonClient; + + @SneakyThrows public void run() { - //查询已经处于分配中、分配完但还未回传给MES的销售出库单 - WQLObject wo = WQLObject.getWQLObject("st_ivt_iostorinv"); - String nofity_day = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("NOFITY_DAY").getValue(); - JSONArray send_rows = new JSONArray(); - if (Integer.parseInt(nofity_day) == 0) { - send_rows = wo.query("(bill_type = '1001' OR bill_type = '1004') AND bill_status = '99' AND confirm_time > '2023-09-01' AND is_delete = '0' AND ( IFNULL(trans_code,'') = '' OR IFNULL( deliveryaddress, '' ) = '' OR IFNULL( deliveryunit, '' ) = '' OR (IFNULL(trans_code,'') <> '00000000' AND IFNULL(estimated_freight,0) = 0) OR IFNULL(estimated_freight,'') = '' OR IFNULL(order_number,'') = '' OR IFNULL(car_type,'') = '')").getResultJSONArray(0); - } else { - send_rows = wo.query("(bill_type = '1001' OR bill_type = '1004') AND bill_status = '99' AND confirm_time > '2023-09-01' AND is_delete = '0' AND ( IFNULL(trans_code,'') = '' OR IFNULL( deliveryaddress, '' ) = '' OR IFNULL( deliveryunit, '' ) = '' OR (IFNULL(trans_code,'') <> '00000000' AND IFNULL(estimated_freight,0) = 0) OR IFNULL(estimated_freight,'') = '' OR IFNULL(order_number,'') = '' OR IFNULL(car_type,'') = '') AND TIMESTAMPDIFF(DAY,confirm_time,NOW()) >= " + nofity_day).getResultJSONArray(0); + RLock lock = redissonClient.getLock(this.getClass().getName()); + boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS); + try { + if (tryLock) { + System.out.println("AutoQueryBillInfo" + DateUtil.now() + "执行!!!!"); + //查询已经处于分配中、分配完但还未回传给MES的销售出库单 + WQLObject wo = WQLObject.getWQLObject("st_ivt_iostorinv"); + String nofity_day = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("NOFITY_DAY").getValue(); + JSONArray send_rows = new JSONArray(); + if (Integer.parseInt(nofity_day) == 0) { + send_rows = wo.query("(bill_type = '1001' OR bill_type = '1004') AND bill_status = '99' AND confirm_time > '2023-09-01' AND is_delete = '0' AND ( IFNULL(trans_code,'') = '' OR IFNULL( deliveryaddress, '' ) = '' OR IFNULL( deliveryunit, '' ) = '' OR (IFNULL(trans_code,'') <> '00000000' AND IFNULL(estimated_freight,0) = 0) OR IFNULL(estimated_freight,'') = '' OR IFNULL(order_number,'') = '' OR IFNULL(car_type,'') = '')").getResultJSONArray(0); + } else { + send_rows = wo.query("(bill_type = '1001' OR bill_type = '1004') AND bill_status = '99' AND confirm_time > '2023-09-01' AND is_delete = '0' AND ( IFNULL(trans_code,'') = '' OR IFNULL( deliveryaddress, '' ) = '' OR IFNULL( deliveryunit, '' ) = '' OR (IFNULL(trans_code,'') <> '00000000' AND IFNULL(estimated_freight,0) = 0) OR IFNULL(estimated_freight,'') = '' OR IFNULL(order_number,'') = '' OR IFNULL(car_type,'') = '') AND TIMESTAMPDIFF(DAY,confirm_time,NOW()) >= " + nofity_day).getResultJSONArray(0); + } + this.sendInfo(send_rows); + } else { + System.out.println("AutoQueryBillInfo" + DateUtil.now() + "被锁住!!!!"); + } + } finally { + if (tryLock) { + lock.unlock(); + } } - this.sendInfo(send_rows); } void sendInfo(JSONArray send_rows) { diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryConRem.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryConRem.java index 38cc33c8a..ecd9e5aa0 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryConRem.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryConRem.java @@ -6,42 +6,60 @@ import cn.hutool.http.HttpRequest; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; +import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.nl.modules.wql.core.bean.WQLObject; import org.nl.modules.wql.util.SpringContextHolder; import org.nl.system.service.param.impl.SysParamServiceImpl; +import org.redisson.api.RLock; +import org.redisson.api.RedissonClient; import org.springframework.stereotype.Component; +import java.util.concurrent.TimeUnit; + @Slf4j @Component @RequiredArgsConstructor public class AutoQueryConRem { + private final RedissonClient redissonClient; + + @SneakyThrows public void run() { - //查询立库贴标、捆扎机剩余材料是否低于下限 - JSONArray rows = new JSONArray(); - //捆扎米数 - String lash_num_up = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("lash_num_up").getValue(); - //捆扎下限 - String lash_num_down = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("lash_num_down").getValue(); - if (Double.parseDouble(lash_num_down) >= Double.parseDouble(lash_num_up)) { - JSONObject jo = new JSONObject(); - jo.put("device_code", "NKZ01"); - jo.put("device_name", "一楼入库北区捆扎位1"); - jo.put("param_name", "lash_num_up"); - rows.add(jo); - } - //标签纸数量 - String label_num_up = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("label_num_up").getValue(); - //标签纸下限 - String label_num_down = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("lash_num_down").getValue(); - if (Double.parseDouble(label_num_down) >= Double.parseDouble(label_num_up)) { - JSONObject jo = new JSONObject(); - jo.put("device_code", "NTB01"); - jo.put("device_name", "一楼入库北区贴标位1"); - jo.put("param_name", "label_num_up"); - rows.add(jo); - } - this.sendInfo(rows); + RLock lock = redissonClient.getLock(this.getClass().getName()); + boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS); + try { + if (tryLock){ + //查询立库贴标、捆扎机剩余材料是否低于下限 + JSONArray rows = new JSONArray(); + //捆扎米数 + String lash_num_up = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("lash_num_up").getValue(); + //捆扎下限 + String lash_num_down = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("lash_num_down").getValue(); + if (Double.parseDouble(lash_num_down) >= Double.parseDouble(lash_num_up)) { + JSONObject jo = new JSONObject(); + jo.put("device_code", "NKZ01"); + jo.put("device_name", "一楼入库北区捆扎位1"); + jo.put("param_name", "lash_num_up"); + rows.add(jo); + } + //标签纸数量 + String label_num_up = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("label_num_up").getValue(); + //标签纸下限 + String label_num_down = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("lash_num_down").getValue(); + if (Double.parseDouble(label_num_down) >= Double.parseDouble(label_num_up)) { + JSONObject jo = new JSONObject(); + jo.put("device_code", "NTB01"); + jo.put("device_name", "一楼入库北区贴标位1"); + jo.put("param_name", "label_num_up"); + rows.add(jo); + } + this.sendInfo(rows); + } + }finally { + if (tryLock) { + lock.unlock(); + } + } } void sendInfo(JSONArray send_rows) { @@ -65,7 +83,7 @@ public class AutoQueryConRem { } else { return; } - String Message = row.getString("device_name") + "消耗材料已低于下限,请及时更换。并将系统对应的:" + row.getString("param_name" + "进行维护!"); + String Message = row.getString("device_name") + "消耗材料已低于下限,请及时更换。并将系统对应的:" + row.getString("param_name") + "进行维护!"; JSONObject jo = new JSONObject(); jo.put("SendType", "L"); jo.put("Title", "捆扎、贴标预警信息"); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryDeviceStatus.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryDeviceStatus.java index fb5368bea..f88afd89e 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryDeviceStatus.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryDeviceStatus.java @@ -5,15 +5,19 @@ import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; +import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.nl.modules.common.utils.RedisUtils; import org.nl.modules.wql.WQL; import org.nl.wms.ext.acs.service.WmsToAcsService; import org.nl.wms.sch.tasks.URLEnum; +import org.redisson.api.RLock; +import org.redisson.api.RedissonClient; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.HashMap; +import java.util.concurrent.TimeUnit; @Slf4j @Component @@ -23,45 +27,59 @@ public class AutoQueryDeviceStatus { private RedisUtils redisUtils; private final WmsToAcsService wmsToAcsService; - public void run() { - for (URLEnum url : URLEnum.values()) { - try { - String product_area = url.getProduct_area(); - //通过ACS接口获取温度 - JSONArray device_rows = WQL.getWO("PDA_02").addParam("flag", "15").addParam("product_area", product_area).process().getResultJSONArray(0); - if (device_rows.size() == 0) { - continue; - } - JSONObject jo = wmsToAcsService.getHotPointStatus(device_rows); - JSONArray de_rows = jo.getJSONArray("data"); - for (int i = 0; i < de_rows.size(); i++) { - JSONObject row = de_rows.getJSONObject(i); - String device_code = row.getString("device_code"); - HashMap map = new HashMap<>(); - map.put("temperature", row.getString("now_temperature")); - //获取倒计时,分,秒 - String countdown_house = row.getString("countdown_house"); - String countdown_min = row.getString("countdown_min"); - String countdown_sec = row.getString("countdown_sec"); + private final RedissonClient redissonClient; - if (StrUtil.isEmpty(countdown_house)) { - countdown_house = "0"; + @SneakyThrows + public void run() { + RLock lock = redissonClient.getLock(this.getClass().getName()); + boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS); + try { + if (tryLock){ + for (URLEnum url : URLEnum.values()) { + try { + String product_area = url.getProduct_area(); + //通过ACS接口获取温度 + JSONArray device_rows = WQL.getWO("PDA_02").addParam("flag", "15").addParam("product_area", product_area).process().getResultJSONArray(0); + if (device_rows.size() == 0) { + continue; + } + JSONObject jo = wmsToAcsService.getHotPointStatus(device_rows); + JSONArray de_rows = jo.getJSONArray("data"); + for (int i = 0; i < de_rows.size(); i++) { + JSONObject row = de_rows.getJSONObject(i); + String device_code = row.getString("device_code"); + HashMap map = new HashMap<>(); + map.put("temperature", row.getString("now_temperature")); + //获取倒计时,分,秒 + String countdown_house = row.getString("countdown_house"); + String countdown_min = row.getString("countdown_min"); + String countdown_sec = row.getString("countdown_sec"); + + if (StrUtil.isEmpty(countdown_house)) { + countdown_house = "0"; + } + if (StrUtil.isEmpty(countdown_min)) { + countdown_min = "0"; + } + if (StrUtil.isEmpty(countdown_sec)) { + countdown_sec = "0"; + } + String last_time = countdown_house + "小时" + countdown_min + "分钟"; + map.put("last_time", last_time); + redisUtils.hset(device_code, "temperature", row.getString("temperature")); + redisUtils.hset(device_code, "last_time", last_time); + } + } catch (Exception e) { + log.info(e.getMessage()); } - if (StrUtil.isEmpty(countdown_min)) { - countdown_min = "0"; - } - if (StrUtil.isEmpty(countdown_sec)) { - countdown_sec = "0"; - } - String last_time = countdown_house + "小时" + countdown_min + "分钟"; - map.put("last_time", last_time); - redisUtils.hset(device_code, "temperature", row.getString("temperature")); - redisUtils.hset(device_code, "last_time", last_time); + + } + } + }finally { + if (tryLock) { + lock.unlock(); } - } catch (Exception e) { - log.info(e.getMessage()); } - } } } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryProudDayData.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryProudDayData.java index 31296edf8..d8a882094 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryProudDayData.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryProudDayData.java @@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; +import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.nl.modules.wql.WQL; import org.nl.modules.wql.core.bean.WQLObject; @@ -15,9 +16,12 @@ import org.nl.modules.wql.util.SpringContextHolder; import org.nl.system.service.param.impl.SysParamServiceImpl; import org.nl.wms.ext.mes.service.LmsToMesService; import org.nl.wms.sch.AutoQueryEnum; +import org.redisson.api.RLock; +import org.redisson.api.RedissonClient; import org.springframework.stereotype.Component; import java.util.*; +import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; @Slf4j @@ -27,33 +31,47 @@ public class AutoQueryProudDayData { private final LmsToMesService lmsToMesService; + private final RedissonClient redissonClient; + + @SneakyThrows public void run() { - JSONObject param = new JSONObject(); + RLock lock = redissonClient.getLock(this.getClass().getName()); + boolean tryLock = lock.tryLock(0,600, TimeUnit.SECONDS); + try { + if (tryLock){ + JSONObject param = new JSONObject(); - JSONArray UserList = new JSONArray(); + JSONArray UserList = new JSONArray(); - String userList = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("USER_LIST_FEISHU").getValue(); + String userList = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("USER_LIST_FEISHU").getValue(); - String[] split = userList.split(","); - if (split.length > 0) { - for (String s : split) { - JSONObject jo = new JSONObject(); - jo.put("User", s); - UserList.add(jo); + String[] split = userList.split(","); + if (split.length > 0) { + for (String s : split) { + JSONObject jo = new JSONObject(); + jo.put("User", s); + UserList.add(jo); + } + } else { + JSONObject jo = new JSONObject(); + jo.put("User", ""); + UserList.add(jo); + } + param.put("UserList", UserList); + + param.put("Code", "ctp_AAyBZtDQiYwG"); + param.put("card", data()); + + // 调用接口 + //lmsToMesService.proudDayData(param); + }else { + System.out.println("定时器当前被锁住!"); + } + }catch (Exception e){ + if (tryLock) { + lock.unlock(); + } } - } else { - JSONObject jo = new JSONObject(); - jo.put("User", ""); - UserList.add(jo); - } - param.put("UserList", UserList); - - param.put("Code", "ctp_AAyBZtDQiYwG"); - param.put("card", data()); - - // 调用接口 - lmsToMesService.proudDayData(param); - } public JSONObject data() { diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryUpload.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryUpload.java index 190f9c2c4..e9aa53b4f 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryUpload.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryUpload.java @@ -7,23 +7,42 @@ import cn.hutool.http.HttpRequest; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; +import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.nl.modules.wql.core.bean.WQLObject; import org.nl.modules.wql.util.SpringContextHolder; import org.nl.system.service.param.impl.SysParamServiceImpl; +import org.redisson.api.RLock; +import org.redisson.api.RedissonClient; import org.springframework.stereotype.Component; import java.util.HashMap; +import java.util.concurrent.TimeUnit; @Slf4j @Component @RequiredArgsConstructor public class AutoQueryUpload { + + private final RedissonClient redissonClient; + + @SneakyThrows public void run() { - //查询已经处于分配中、分配完但还未回传给MES的销售出库单 - WQLObject wo = WQLObject.getWQLObject("st_ivt_iostorinv"); - JSONArray send_rows = wo.query("bill_type = '1001' AND bill_status IN ( '30', '40' ) AND stor_code = 'AC01' AND upload_mes = '0' AND is_delete = '0'").getResultJSONArray(0); - this.sendInfo(send_rows); + RLock lock = redissonClient.getLock(this.getClass().getName()); + boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS); + try { + if (tryLock){ + //查询已经处于分配中、分配完但还未回传给MES的销售出库单 + WQLObject wo = WQLObject.getWQLObject("st_ivt_iostorinv"); + JSONArray send_rows = wo.query("bill_type = '1001' AND bill_status IN ( '30', '40' ) AND stor_code = 'AC01' AND upload_mes = '0' AND is_delete = '0'").getResultJSONArray(0); + this.sendInfo(send_rows); + } + }finally { + if (tryLock) { + lock.unlock(); + } + } + } void sendInfo(JSONArray send_rows) { diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoSendFeiShu.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoSendFeiShu.java index f083de4c9..13ffe7644 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoSendFeiShu.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoSendFeiShu.java @@ -6,31 +6,46 @@ import cn.hutool.http.HttpRequest; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; +import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.nl.modules.wql.core.bean.WQLObject; import org.nl.modules.wql.util.SpringContextHolder; import org.nl.system.service.param.impl.SysParamServiceImpl; +import org.redisson.api.RLock; +import org.redisson.api.RedissonClient; import org.springframework.stereotype.Component; import java.util.HashMap; +import java.util.concurrent.TimeUnit; @Slf4j @Component @RequiredArgsConstructor public class AutoSendFeiShu { + + private final RedissonClient redissonClient; + + @SneakyThrows public void run() { + RLock lock = redissonClient.getLock(this.getClass().getName()); + boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS); + try { + if (tryLock) { + WQLObject wo = WQLObject.getWQLObject("em_bi_devicestatus"); + //查询故障了还未发送的 + JSONArray send_rows = wo.query("error > '0' AND IFNULL(is_upload,'0') = '0' AND upload_flag = '1'").getResultJSONArray(0); + this.sendInfo(send_rows); - WQLObject wo = WQLObject.getWQLObject("em_bi_devicestatus"); - //查询故障了还未发送的 - JSONArray send_rows = wo.query("error > '0' AND IFNULL(is_upload,'0') = '0' AND upload_flag = '1'").getResultJSONArray(0); - this.sendInfo(send_rows); - - //查询已经发送了但是还是故障中的 - String resend_time = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("RESEND_TIME").getValue(); - JSONArray resend_rows = wo.query("error > '0' AND is_upload = '1' AND upload_flag = '1' AND TIMESTAMPDIFF(MINUTE,upload_time,NOW()) > " + resend_time).getResultJSONArray(0); - this.sendInfo(resend_rows); - - + //查询已经发送了但是还是故障中的 + String resend_time = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("RESEND_TIME").getValue(); + JSONArray resend_rows = wo.query("error > '0' AND is_upload = '1' AND upload_flag = '1' AND TIMESTAMPDIFF(MINUTE,upload_time,NOW()) > " + resend_time).getResultJSONArray(0); + this.sendInfo(resend_rows); + } + } finally { + if (tryLock) { + lock.unlock(); + } + } } void sendInfo(JSONArray device_rows) { diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/impl/RawAssistIStorServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/impl/RawAssistIStorServiceImpl.java index 495d46a28..29dba109f 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/impl/RawAssistIStorServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/impl/RawAssistIStorServiceImpl.java @@ -891,10 +891,10 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService { row_map.put("material_code", material_code); row_map.put("sale_order_name", sale_order_name); row_map.put("sect_id", sect_id); - row_map.put("flag", "11"); + row_map.put("flag", "111"); // 获取系统参数入库到第几层 0-3层都可 1-1层 2-2层 3-3层 - String in_layer_num = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("in_layer_num").getValue(); + String in_layer_num; /* * 判断木箱高度能入第几层: @@ -923,7 +923,23 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService { row_map.put("in_layer_num", in_layer_num); //查询到当前可用的巷道 - JSONArray rowArr = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0); + JSONArray rowArr2 = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0); + JSONArray rowArr = new JSONArray(); + for (int i = 0; i < rowArr2.size(); i++) { + JSONObject jo = rowArr2.getJSONObject(i); + String block_num = jo.getString("block_num"); + String row_num = jo.getString("row_num"); + String placement_type = jo.getString("placement_type"); + row_map.put("block_num", block_num); + row_map.put("row_num", row_num); + row_map.put("placement_type", placement_type); + row_map.put("flag", "112"); + JSONObject row_jo = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().uniqueResult(0); + int num = row_jo.getIntValue("num"); + if (num > 0) { + rowArr.add(jo); + } + } for (int i = 0; i < rowArr.size(); i++) { JSONObject row_jo = rowArr.getJSONObject(i); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/wql/QST_IVT_RAWASSISTISTOR.wql b/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/wql/QST_IVT_RAWASSISTISTOR.wql index 0bd82c1e1..9fec70b16 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/wql/QST_IVT_RAWASSISTISTOR.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/wql/QST_IVT_RAWASSISTISTOR.wql @@ -36,6 +36,7 @@ 输入.point_code TYPEAS s_string 输入.row_num TYPEAS s_string 输入.block_num TYPEAS s_string + 输入.placement_type TYPEAS s_string 输入.sql_str TYPEAS f_string 输入.in_stor_id TYPEAS f_string 输入.in_layer_num TYPEAS f_string @@ -471,6 +472,70 @@ ENDQUERY ENDIF + IF 输入.flag = "111" + QUERY + SELECT + count(sa.struct_code) AS num, + sa.block_num, + sa.row_num, + sa.placement_type + FROM + st_ivt_structivt ivt + INNER JOIN pdm_bi_subpackagerelation sub ON sub.container_name = ivt.pcsn + LEFT JOIN st_ivt_structattr sa ON sa.struct_code = ivt.struct_code + LEFT JOIN md_me_materialbase mb ON mb.material_id = ivt.material_id + WHERE + sa.sect_id = 输入.sect_id + OPTION 输入.material_code <> "" + mb.material_code = 输入.material_code + ENDOPTION + OPTION 输入.sale_order_name <> "" + sub.sale_order_name = 输入.sale_order_name + ENDOPTION + GROUP BY + sa.block_num,sa.row_num,sa.placement_type + ORDER BY + sa.placement_type desc,num + ENDSELECT + ENDQUERY + ENDIF + + IF 输入.flag = "112" + QUERY + SELECT + count(sa.struct_code) AS num, + sa.block_num, + sa.row_num, + sa.placement_type + FROM + st_ivt_structattr sa + WHERE + IFNULL(sa.storagevehicle_code,'') = '' + AND + sa.lock_type = '1' + AND + sa.is_delete = '0' + AND + sa.is_used = '1' + OPTION 输入.in_layer_num <> "" + sa.layer_num in 输入.in_layer_num + ENDOPTION + OPTION 输入.col_num <> "" + sa.layer_num = 输入.col_num + ENDOPTION + OPTION 输入.block_num <> "" + sa.block_num = 输入.block_num + ENDOPTION + OPTION 输入.row_num <> "" + sa.row_num = 输入.row_num + ENDOPTION + OPTION 输入.placement_type <> "" + sa.placement_type = 输入.placement_type + ENDOPTION + ENDSELECT + ENDQUERY + ENDIF + IF 输入.flag = "12" QUERY SELECT diff --git a/lms/nladmin-system/src/main/resources/config/application-prod.yml b/lms/nladmin-system/src/main/resources/config/application-prod.yml index d5ca9ad63..78565eb6d 100644 --- a/lms/nladmin-system/src/main/resources/config/application-prod.yml +++ b/lms/nladmin-system/src/main/resources/config/application-prod.yml @@ -1,12 +1,12 @@ server: - port: 8013 + port: 8010 #配置数据源 spring: datasource: druid: db-type: com.alibaba.druid.pool.DruidDataSource driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy - url: jdbc:log4jdbc:mysql://${DB_HOST:10.1.3.91}:${DB_PORT:3306}/${DB_NAME:lms_test2}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true + url: jdbc:log4jdbc:mysql://${DB_HOST:10.1.3.91}:${DB_PORT:3306}/${DB_NAME:lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true # url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:hl_tb_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true # username: ${DB_USER:root} username: ${DB_USER:root} @@ -17,11 +17,11 @@ spring: # 最小连接数 min-idle: 15 # 最大连接数 - max-active: 30 + max-active: 220 # 超时时间(以秒数为单位) remove-abandoned-timeout: 180 # 获取连接超时时间 - max-wait: 3000 + max-wait: 2000 # 连接有效性检测时间 time-between-eviction-runs-millis: 60000 # 连接在池中最小生存的时间 @@ -45,20 +45,19 @@ spring: reset-enable: false filters: DruidFilter,stat - validation-query-timeout: 5000 # stat: -# enabled: true -# # 记录慢SQL -# log-slow-sql: true -# slow-sql-millis: 1000 -# merge-sql: true -# wall: -# config: -# multi-statement-allow: true + # enabled: true + # # 记录慢SQL + # log-slow-sql: true + # slow-sql-millis: 1000 + # merge-sql: true + # wall: + # config: + # multi-statement-allow: true redis: #数据库索引 - database: ${REDIS_DB:14} - host: ${REDIS_HOST:127.0.0.1} + database: ${REDIS_DB:11} + host: ${REDIS_HOST:10.1.3.93} port: ${REDIS_PORT:6379} password: ${REDIS_PWD:} redisson: @@ -68,12 +67,10 @@ spring: singleServerConfig: connectionMinimumIdleSize: 8 connectionPoolSize: 8 - database: 14 - address: redis://127.0.0.1:6379 + database: 11 + address: redis://10.1.3.93:6379 idleConnectionTimeout: 10000 timeout: 3000 - - # 登录相关配置 login: # 登录缓存 @@ -114,15 +111,10 @@ jwt: detect: 1800000 # 续期时间范围,默认1小时,单位毫秒 renew: 3600000 - #是否允许生成代码,生产环境设置为false generator: enabled: true -#是否开启 swagger-ui -swagger: - enabled: true - # IP 本地解析 ip: local-parsing: true @@ -143,7 +135,7 @@ file: avatarMaxSize: 5 logging: file: - path: C:\log\wms + path: d:\log\wms config: classpath:logback-spring.xml # Sa-Token配置 @@ -164,10 +156,7 @@ sa-token: is-log: false jwt-secret-key: opsjajisdnnca0sdkksdfaaasdfwwq # token 前缀 - token-prefix: Bearer + token-prefix: cookie: # 配置 Cookie 作用域:根据二级域名实现sso登入如lms.sso.com;acs.sso.com domain: -lucene: - index: - path: D:\lms\lucene\index diff --git a/lms/nladmin-system/src/main/resources/config/application.yml b/lms/nladmin-system/src/main/resources/config/application.yml index 9908fdd44..13e2de704 100644 --- a/lms/nladmin-system/src/main/resources/config/application.yml +++ b/lms/nladmin-system/src/main/resources/config/application.yml @@ -19,39 +19,15 @@ spring: enabledBanner: false # 是否启用 控制台banner,默认true enabledCollect: true # 是否开启监控指标采集,默认true collectorTypes: logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer - logPath: C:\log\lms # 监控日志数据路径,默认 ${user.home}/logs,采集类型非logging不用配置 + logPath: d:\log\lms # 监控日志数据路径,默认 ${user.home}/logs,采集类型非logging不用配置 monitorInterval: 8 tomcatTp: # tomcat webserver 线程池配置 threadPoolAliasName: tomcat 线程池 # 线程池别名,可选 - corePoolSize: 100 - maximumPoolSize: 200 + corePoolSize: 50 + maximumPoolSize: 600 keepAliveTime: 60 runTimeout: 10000 queueTimeout: 100 - notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警、拒绝报警、任务超时报警) - - type: change - enabled: true - - - type: capacity # 队列容量使用率,报警项类型,查看源码 NotifyTypeEnum枚举类 - enabled: true - threshold: 80 # 报警阈值,默认70,意思是队列使用率达到70%告警 - interval: 120 # 报警间隔(单位:s),默认120 - - - type: liveness # 线程池活性 - enabled: true - threshold: 80 # 报警阈值,默认 70,意思是活性达到70%告警 - - - type: reject # 触发任务拒绝告警 - enabled: true - threshold: 100 # 默认阈值10 - - - type: run_timeout # 任务执行超时告警 - enabled: true - threshold: 100 # 默认阈值10 - - - type: queue_timeout # 任务排队超时告警 - enabled: true - threshold: 100 # 默认阈值10 #配置 Jpa jpa: hibernate: @@ -90,7 +66,7 @@ rsa: private_key: MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEA0vfvyTdGJkdbHkB8mp0f3FE0GYP3AYPaJF7jUd1M0XxFSE2ceK3k2kw20YvQ09NJKk+OMjWQl9WitG9pB6tSCQIDAQABAkA2SimBrWC2/wvauBuYqjCFwLvYiRYqZKThUS3MZlebXJiLB+Ue/gUifAAKIg1avttUZsHBHrop4qfJCwAI0+YRAiEA+W3NK/RaXtnRqmoUUkb59zsZUBLpvZgQPfj1MhyHDz0CIQDYhsAhPJ3mgS64NbUZmGWuuNKp5coY2GIj/zYDMJp6vQIgUueLFXv/eZ1ekgz2Oi67MNCk5jeTF2BurZqNLR3MSmUCIFT3Q6uHMtsB9Eha4u7hS31tj1UWE+D+ADzp59MGnoftAiBeHT7gDMuqeJHPL4b+kC+gzV4FGTfhR9q3tTbklZkD2A== logging: file: - path: C:\log\lms + path: d:\log\lms config: classpath:logback-spring.xml # sa-token白名单配置 security: @@ -100,9 +76,6 @@ security: - /auth/login - /auth/code - /auth/logout - # swagger - - /swagger-ui.html - - /swagger-resources/** - /webjars/** - /file/** - /webSocket/** @@ -183,4 +156,4 @@ jetcache: port: 6379 lucene: index: - path: D:\lms\lucene\index + path: D:\log\lms\lucene\index diff --git a/lms/nladmin-system/src/main/resources/logback-spring.xml b/lms/nladmin-system/src/main/resources/logback-spring.xml index bca4b8014..eed977b24 100644 --- a/lms/nladmin-system/src/main/resources/logback-spring.xml +++ b/lms/nladmin-system/src/main/resources/logback-spring.xml @@ -14,7 +14,6 @@ https://juejin.cn/post/6844903775631572999 - From db57ef0d0fe4ddec7aac054998676bba3ace467b Mon Sep 17 00:00:00 2001 From: "ZHOUZ\\Noble'lift" <1014987728@qq.com> Date: Wed, 24 Jan 2024 10:13:07 +0800 Subject: [PATCH 3/5] =?UTF-8?q?rev:=E5=AE=9A=E6=97=B6=E5=99=A8=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/nl/wms/sch/manage/AutoQueryProudDayData.java | 4 +--- .../src/main/resources/config/application-prod.yml | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryProudDayData.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryProudDayData.java index d8a882094..58dc8cdcc 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryProudDayData.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryProudDayData.java @@ -63,9 +63,7 @@ public class AutoQueryProudDayData { param.put("card", data()); // 调用接口 - //lmsToMesService.proudDayData(param); - }else { - System.out.println("定时器当前被锁住!"); + lmsToMesService.proudDayData(param); } }catch (Exception e){ if (tryLock) { diff --git a/lms/nladmin-system/src/main/resources/config/application-prod.yml b/lms/nladmin-system/src/main/resources/config/application-prod.yml index 78565eb6d..ef08fff13 100644 --- a/lms/nladmin-system/src/main/resources/config/application-prod.yml +++ b/lms/nladmin-system/src/main/resources/config/application-prod.yml @@ -1,5 +1,5 @@ server: - port: 8010 + port: 8011 #配置数据源 spring: datasource: From f2fb475e2e1d91e9c209154cc1bb8142995388df Mon Sep 17 00:00:00 2001 From: yanps Date: Wed, 24 Jan 2024 13:38:13 +0800 Subject: [PATCH 4/5] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=83=98=E7=AE=B1?= =?UTF-8?q?=E8=A1=8C=E6=9E=B6=E4=B8=8D=E7=BB=992=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HongXiangConveyorDeviceDriver.java | 29 +++++++++-- .../OvenGantryManipulatorDeviceDriver.java | 52 +++++++++++++++---- .../SiemensConveyorDeviceDriver.java | 2 +- .../src/views/system/monitor/device/index.vue | 3 ++ acs2/nladmin-ui/src/views/lucene/time.vue | 6 +-- 5 files changed, 76 insertions(+), 16 deletions(-) diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_device/HongXiangConveyorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_device/HongXiangConveyorDeviceDriver.java index d24676f2e..8e1740ffa 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_device/HongXiangConveyorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_device/HongXiangConveyorDeviceDriver.java @@ -340,6 +340,7 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple jo.put("finish", finish); jo.put("isOnline", this.getIsonline()); jo.put("error", ErrorUtil.getDictDetail("hx_error_type", String.valueOf(this.getError()))); + jo.put("error1", ErrorUtil.getDictDetail("hx_error_type", String.valueOf(this.getError1()))); jo.put("isError", this.getIserror()); jo.put("countdown_house", countdown_house); jo.put("countdown_min", countdown_min); @@ -348,9 +349,6 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple 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()); return jo; } @@ -402,4 +400,29 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple } } + public void writing(List list) { + Map itemMap = new HashMap(); + for (int i = 0; i < list.size(); i++) { + Object ob = list.get(i); + JSONObject json = (JSONObject) JSONObject.toJSON(ob); + if (!StrUtil.isEmpty(json.getString("value"))) { + String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + json.getString("code"); + itemMap.put(to_param, json.getString("value")); + } + } + logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap); + try { + this.checkcontrol(itemMap); + } catch (Exception e) { + e.printStackTrace(); + try { + this.checkcontrol(itemMap); + } catch (Exception e1) { + e1.printStackTrace(); + } + } + + } + } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/OvenGantryManipulatorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/OvenGantryManipulatorDeviceDriver.java index ed46b3468..6fbc82193 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/OvenGantryManipulatorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/OvenGantryManipulatorDeviceDriver.java @@ -457,11 +457,29 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i this.writing("to_command", "1"); if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver(); - hongXiangConveyorDeviceDriver.writing("to_open_door", "1"); + List list = new ArrayList(); + Map map = new HashMap(); + map.put("code", "to_open_door"); + map.put("value", "1"); + list.add(map); + try { + hongXiangConveyorDeviceDriver.writing(list); + } catch (Exception e) { + logServer.deviceExecuteLog(this.getDevice_code(), "", "", "起点设备:" + start_device_code + "未打开烘箱门,导致now_steps_type不等于: 2 ;now_steps_type:" + now_steps_type); + } } if (nextdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextdevice.getDeviceDriver(); - hongXiangConveyorDeviceDriver.writing("to_open_door", "1"); + List list = new ArrayList(); + Map map = new HashMap(); + map.put("code", "to_open_door"); + map.put("value", "1"); + list.add(map); + try { + hongXiangConveyorDeviceDriver.writing(list); + } catch (Exception e) { + logServer.deviceExecuteLog(this.getDevice_code(), "", "", "终点设备:" + next_device_code + "未打开烘箱门,导致now_steps_type不等于: 2;now_steps_type:" + now_steps_type); + } } this.setNow_steps_type(2); this.setRequireSucess(true); @@ -605,13 +623,29 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i //HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; if (nextDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextDevice.getDeviceDriver(); - hongXiangConveyorDeviceDriver.writing("to_open_door", "1"); - hongXiangConveyorDeviceDriver.writing("to_open_door", "1"); + List list = new ArrayList(); + Map map = new HashMap(); + map.put("code", "to_open_door"); + map.put("value", "1"); + list.add(map); + try { + hongXiangConveyorDeviceDriver.writing(list); + } catch (Exception e) { + logServer.deviceExecuteLog(this.getDevice_code(), "", "", "终点设备:" + next_device_code + "未打开烘箱门,导致now_steps_type不等于: 2;now_steps_type:" + now_steps_type); + } } if (startDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startDevice.getDeviceDriver(); - hongXiangConveyorDeviceDriver.writing("to_open_door", "1"); - hongXiangConveyorDeviceDriver.writing("to_open_door", "1"); + List list = new ArrayList(); + Map map = new HashMap(); + map.put("code", "to_open_door"); + map.put("value", "1"); + list.add(map); + try { + hongXiangConveyorDeviceDriver.writing(list); + } catch (Exception e) { + logServer.deviceExecuteLog(this.getDevice_code(), "", "", "起点设备:" + start_device_code + "未打开烘箱门,导致now_steps_type不等于: 2;now_steps_type:" + now_steps_type); + } } this.setNow_steps_type(2); this.setRequireSucess(true); @@ -800,11 +834,11 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i steps_type = "更新指令状态"; } else if (now_steps_type == 2) { steps_type = "下发电气信号"; - }else if(now_steps_type == 3){ + } else if (now_steps_type == 3) { steps_type = "允许取货"; - }else if (now_steps_type ==4 ){ + } else if (now_steps_type == 4) { steps_type += "允许放货"; - }else if (now_steps_type == 5){ + } else if (now_steps_type == 5) { steps_type += "放货完成"; } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/SiemensConveyorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/SiemensConveyorDeviceDriver.java index 8dd8baaf5..1d4486e82 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/SiemensConveyorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/SiemensConveyorDeviceDriver.java @@ -476,7 +476,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme break; } else { message = "task变化请求LMS失败: " + response.getMessage(); - Thread.sleep(5000); + Thread.sleep(15000); } } } catch (Exception e) { diff --git a/acs/nladmin-ui/src/views/system/monitor/device/index.vue b/acs/nladmin-ui/src/views/system/monitor/device/index.vue index 7533172be..0aa5a9538 100644 --- a/acs/nladmin-ui/src/views/system/monitor/device/index.vue +++ b/acs/nladmin-ui/src/views/system/monitor/device/index.vue @@ -470,6 +470,9 @@ export default { } else if (val === 'error') { const obj = { name: '报警', value: data[val] } this.arr.push(obj) + } else if (val === 'error1') { + const obj = { name: '报警2', value: data[val] } + this.arr.push(obj) } else if (val === 'ip') { const obj = { name: 'IP地址', value: data[val] } this.arr.push(obj) diff --git a/acs2/nladmin-ui/src/views/lucene/time.vue b/acs2/nladmin-ui/src/views/lucene/time.vue index 37b160175..7d3a98c68 100644 --- a/acs2/nladmin-ui/src/views/lucene/time.vue +++ b/acs2/nladmin-ui/src/views/lucene/time.vue @@ -7,9 +7,9 @@ v-model="query.createTime" type="datetimerange" :picker-options="pickerOptions" - range-separator="至" - start-placeholder="开始日期" - end-placeholder="结束日期" + :range-separator="$t('monitor.lucence.until')" + :start-placeholder="$t('auto.common.startDate')" + :end-placeholder="$t('auto.common.endDate')" align="right" /> From 686e3d33ae0a7484b64ec21a8ff7c003bbf08de4 Mon Sep 17 00:00:00 2001 From: "USER-20220102CG\\noblelift" <546428999@qq.com> Date: Wed, 24 Jan 2024 16:56:38 +0800 Subject: [PATCH 5/5] =?UTF-8?q?rev=20=E6=9B=B4=E6=96=B0=E9=A9=B1=E5=8A=A8?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E4=B8=B2=E8=AF=BB=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/nl/acs/device_driver/driver/OpcDeviceDriver.java | 2 +- .../one_conveyor/box_subvolumes_conveyor/ItemProtocol.java | 2 +- .../main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java | 5 +---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/driver/OpcDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/driver/OpcDeviceDriver.java index c1d27c02a..04fbae0a4 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/driver/OpcDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/driver/OpcDeviceDriver.java @@ -190,7 +190,7 @@ public interface OpcDeviceDriver extends DeviceDriver { * @return */ default String getStringValue(String protocol) { - return this.getOpcValueAccessor().getValue(this.getItem(protocol)).toString(); + return (String) this.getOpcValueAccessor().getValue(this.getItem(protocol)); } /** diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/ItemProtocol.java index 56a2e5c48..8b81241be 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/ItemProtocol.java @@ -153,7 +153,7 @@ public class ItemProtocol { } else { return value; } - return "0"; + return ""; } public static List getReadableItemDtos() { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java index 1f245e4c4..8e8f2f0ba 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java @@ -207,10 +207,8 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC if (!UnifiedDataAppService.isEquals(value, his)) { OpcItemDto itemDto = this.getItem(itemId); - if (true) { - this.logItemChanged(itemId, accessor_value, value, itemDto); - } if (!ObjectUtil.isEmpty(value)) { + this.logItemChanged(itemId, accessor_value, value, itemDto); accessor_value.setValue(itemId, value); } } @@ -436,7 +434,6 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC String.valueOf(itemDto.getHis_item_value()), String.valueOf(itemDto.getItem_value())); luceneLogDto.setLogType(LogTypeEnum.DEVICE_LOG.getDesc()); log.info("{}", JSON.toJSONString(luceneLogDto)); - } } else { if(his instanceof int[]){