diff --git a/acs/nladmin-system/pom.xml b/acs/nladmin-system/pom.xml index e02d8fb42..92dd526a9 100644 --- a/acs/nladmin-system/pom.xml +++ b/acs/nladmin-system/pom.xml @@ -20,7 +20,6 @@ 1.8 1.16 2.9.2 - 1.2.70 1.1.22 2.5.0 1.3.1.Final @@ -34,11 +33,11 @@ - + org.apache.commons @@ -65,21 +64,21 @@ poi-ooxml-schemas 4.1.2 - + + + org.openscada.utgard org.openscada.opc.lib @@ -103,11 +102,11 @@ 1.8.0 - + @@ -116,11 +115,11 @@ - + org.springframework.boot @@ -231,6 +230,12 @@ org.springframework.boot spring-boot-starter-test test + + + objenesis + org.objenesis + + @@ -296,6 +301,10 @@ io.swagger swagger-models + + mapstruct + org.mapstruct + @@ -362,13 +371,6 @@ 2.12.0 - - - com.alibaba - fastjson - ${fastjson.version} - - org.mapstruct @@ -453,6 +455,9 @@ **/*.* + + **/*.java + diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java b/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java index d4f54e4a7..edf03089c 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java @@ -43,7 +43,9 @@ public enum DriverTypeEnum { SIEMENS_CONVEYOR_LABELING(16, "siemens_conveyor_labeling", "西门子-输送机驱动-贴标", "conveyor"), - SIEMENS_CONVEYOR_CKK(17, "siemens_conveyor_ckk", "西门子-输送机驱动-出库口", "conveyor"); + SIEMENS_CONVEYOR_CKK(17, "siemens_conveyor_ckk", "西门子-输送机驱动-出库口", "conveyor"), + + SIEMENS_ONEFLOOR_AGV_CONVEYOR(17, "siemens_onefloor_agv_conveyor", "西门子-1LAGV-输送机驱动", "conveyor"); //驱动索引 diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java index a50e0ed89..ef7547015 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java @@ -20,6 +20,7 @@ import org.nl.acs.device.device_driver.standard_inspect.ItemDto; import org.nl.acs.device.device_driver.standard_inspect.ReadUtil; import org.nl.acs.device.service.*; import org.nl.acs.device.service.dto.*; +import org.nl.acs.device_driver.DeviceDriver; import org.nl.acs.device_driver.DeviceDriverDefination; import org.nl.acs.device_driver.ScannerDeviceDriver; import org.nl.acs.device_driver.basedriver.oven_manipulator.OvenGantryManipulatorDeviceDriver; @@ -32,9 +33,7 @@ import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspect import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver; import org.nl.acs.device_driver.basedriver.standard_scanner.StandardScannerDeviceDriver; import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination; -import org.nl.acs.opc.Device; -import org.nl.acs.opc.DeviceAppService; -import org.nl.acs.opc.DeviceAppServiceImpl; +import org.nl.acs.opc.*; import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.common.utils.FileUtil; import org.nl.modules.common.utils.RedisUtils; @@ -76,6 +75,7 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial private final DeviceDriverDefinationAppService deviceDriverDefinationAppService; private final DeviceAppService deviceAppService; private final ParamService paramService; + private final DeviceManageService deviceManageService; List storageCells = new ArrayList<>(); private Map storage_address = new HashMap(); @@ -629,27 +629,6 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial } } - -// for(int i=0; i" + door); + } if (mode != last_mode) { //this.setRequireSucess(false); } 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 c830c46e2..65933128b 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 @@ -158,6 +158,9 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme requireEmptyOutSuccess = false; logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode + "复位请求标记"); } + if(mode == 6){ + requireEmptyInSuccess = false; + } logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode)); logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode); } @@ -211,15 +214,12 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme finish_instruction(); logServer.deviceExecuteLog(device_code, "", "", "入库输送线任务开始反馈完成状态,反馈成功,指令号:" + task); } else { -// if (!StrUtil.equals(inst.getExecute_code(), this.device_code)) { -// inst.setExecute_device_code(this.device_code); -// instructionService.update(inst); -// } + + } } } else { -// logServer.deviceExecuteLog(device_code, "", "", "输送线任务开始反馈任务状态,反馈失败,查询不到指令号:" + task); message = "输送线任务反馈状态,查询不到指令号:" + task +"指令已完成"; inst_message = null; } @@ -230,21 +230,11 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme 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.setIsonline(false); -// this.setIserror(true); -// message = "有报警"; -// //无报警 + } else { this.setIsonline(true); this.setIserror(false); @@ -257,21 +247,6 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme List toInstructions; -// if (mode == 2 && move != 0 && task > 0) { -// //inst_message -// inst = instructionService.findByCodeFromCache(String.valueOf(task)); -// if (inst != null) { -// inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code(); -// if (StrUtil.equals(inst.getInstruction_status(), "1") && StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) { -// finish_instruction(); -// } -// if (StrUtil.equals(inst.getInstruction_status(), "0") && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) { -// inst.setInstruction_status("1"); -// instructionService.update(inst); -// } -// } -// } - switch (mode) { case 1: log.debug("设备运转模式:等待工作"); @@ -881,13 +856,11 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme JSONObject jo = JSON.parseObject(str); if (ObjectUtil.isEmpty(jo)) { message = "申请空盘入库接口不通"; - requireEmptyInSuccess = true; } else { if (jo.getInteger("status") == 200) { message = "申请空盘入库成功"; requireEmptyInSuccess = true; } else { - requireEmptyInSuccess = true; message = "申请空盘入库失败," + jo.get("message").toString(); } } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_onefloor_agv_conveyor/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_onefloor_agv_conveyor/ItemProtocol.java new file mode 100644 index 000000000..acef45db6 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_onefloor_agv_conveyor/ItemProtocol.java @@ -0,0 +1,128 @@ +package org.nl.acs.device_driver.basedriver.siemens_onefloor_agv_conveyor; + +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_carrier_direction = "carrier_direction"; + //报警 + public static String item_error = "error"; + //任务号 + public static String item_task = "task"; + + //下发命令 + public static String item_to_command = "to_command"; + //下发目标站 + public static String item_to_target = "to_target"; + //下发托盘类型 + public static String item_to_container_type = "to_container_type"; + //下发任务号 + public static String item_to_task = "to_task"; + //困扎次数 + public static String item_to_strap_times = "to_strap_times"; + //木箱长度 + public static String item_to_length = "to_length"; + //木箱宽度 + public static String item_to_weight = "to_weight"; + //木箱高度 + public static String item_to_height = "to_height"; + + + private SiemensOneFloorAGVConveyorDeviceDriver driver; + + public ItemProtocol(SiemensOneFloorAGVConveyorDeviceDriver 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 getCarrier_direction() { + return this.getOpcIntegerValue(item_carrier_direction); + } + + public int getError() { + return this.getOpcIntegerValue(item_error); + } + + public int getTask() { + return this.getOpcIntegerValue(item_task); + } + + public int getTo_command() { + return this.getOpcIntegerValue(item_to_command); + } + + + 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_mode, "工作模式", "DB101.B152")); + list.add(new ItemDto(item_move, "光电信号", "DB101.B153")); + list.add(new ItemDto(item_carrier_direction, "托盘方向", "DB101.B154")); + list.add(new ItemDto(item_error, "报警信号", "DB101.B156")); + list.add(new ItemDto(item_task, "任务号", "DB101.D160")); + return list; + } + + public static List getWriteableItemDtos() { + ArrayList list = new ArrayList(); + list.add(new ItemDto(item_to_command, "下发命令", "DB102.W152")); + return list; + } + + @Override + public String toString() { + return ""; + } + +} + diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_onefloor_agv_conveyor/SiemensOneFloorAGVConveyorDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_onefloor_agv_conveyor/SiemensOneFloorAGVConveyorDefination.java new file mode 100644 index 000000000..4969f9166 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_onefloor_agv_conveyor/SiemensOneFloorAGVConveyorDefination.java @@ -0,0 +1,64 @@ +package org.nl.acs.device_driver.basedriver.siemens_onefloor_agv_conveyor; + +import org.nl.acs.device.device_driver.standard_inspect.ItemDto; +import org.nl.acs.device_driver.DeviceDriver; +import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination; +import org.nl.acs.opc.Device; +import org.nl.acs.opc.DeviceType; +import org.springframework.stereotype.Service; + +import java.util.LinkedList; +import java.util.List; + +/** + * 西门子-输送机驱动 + * + */ +@Service +public class SiemensOneFloorAGVConveyorDefination implements OpcDeviceDriverDefination { + @Override + public String getDriverCode() { + return "siemens_onefloor_agv_conveyor"; + } + + @Override + public String getDriverName() { + return "西门子-1LAGV-输送机驱动"; + } + + @Override + public String getDriverDescription() { + return "西门子-1LAGV-输送机驱动"; + } + + @Override + public DeviceDriver getDriverInstance(Device device) { + return (new SiemensOneFloorAGVConveyorDeviceDriver()).setDevice(device).setDriverDefination(this); + + } + + @Override + public Class getDeviceDriverType() { + return SiemensOneFloorAGVConveyorDeviceDriver.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/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_onefloor_agv_conveyor/SiemensOneFloorAGVConveyorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_onefloor_agv_conveyor/SiemensOneFloorAGVConveyorDeviceDriver.java new file mode 100644 index 000000000..72db963e9 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_onefloor_agv_conveyor/SiemensOneFloorAGVConveyorDeviceDriver.java @@ -0,0 +1,341 @@ +package org.nl.acs.device_driver.basedriver.siemens_onefloor_agv_conveyor; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpResponse; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import lombok.Data; +import lombok.RequiredArgsConstructor; +import lombok.SneakyThrows; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.ObjectUtils; +import org.nl.acs.AcsConfig; +import org.nl.acs.agv.server.NDCAgvService; +import org.nl.acs.device.service.DeviceService; +import org.nl.acs.device_driver.DeviceDriver; +import org.nl.acs.device_driver.RouteableDeviceDriver; +import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; +import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; +import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingRequest; +import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingResponse; +import org.nl.acs.ext.wms.service.AcsToWmsService; +import org.nl.acs.instruction.service.InstructionService; +import org.nl.acs.instruction.service.dto.Instruction; +import org.nl.acs.log.service.DeviceExecuteLogService; +import org.nl.acs.monitor.DeviceStageMonitor; +import org.nl.acs.opc.Device; +import org.nl.acs.opc.DeviceAppService; +import org.nl.acs.route.service.RouteLineService; +import org.nl.acs.route.service.dto.RouteLineDto; +import org.nl.acs.task.service.TaskService; +import org.nl.acs.task.service.dto.TaskDto; +import org.nl.modules.system.service.ParamService; +import org.nl.modules.wql.core.bean.WQLObject; +import org.nl.modules.wql.util.SpringContextHolder; +import org.openscada.opc.lib.da.Server; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.*; + +/** + * 西门子-1LAGV-输送机驱动 + */ +@Slf4j +@Data +@RequiredArgsConstructor +public class SiemensOneFloorAGVConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor { + protected ItemProtocol itemProtocol = new ItemProtocol(this); + @Autowired + InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); + @Autowired + DeviceService deviceservice = SpringContextHolder.getBean(DeviceService.class); + @Autowired + RouteLineService routelineserver = SpringContextHolder.getBean(RouteLineService.class); + @Autowired + TaskService taskserver = SpringContextHolder.getBean(TaskService.class); + @Autowired + DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class); + @Autowired + RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class); + @Autowired + ParamService paramService = SpringContextHolder.getBean(ParamService.class); + @Autowired + AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsService.class); + @Autowired + DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); + @Autowired + NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvService.class); + //当前指令 + Instruction inst = null; + + //工作模式 + int mode = 0; + int last_mode = 0; + //光电信号 + int move = 0; + int last_move = 0; + //托盘方向 + int carrier_direction = 0; + int last_carrier_direction = 0; + //报警信号 + int error = 0; + int last_error = 0; + //任务号 + int task = 0; + int last_task = 0; + int agvphase = 0; + String task_code = null; + int to_command = 0; + + int phase = 0; + int index = 0; + Boolean isonline = true; + int hasGoods = 0; + String message = null; + Boolean iserror = false; + + Integer heartbeat_tag; + private Date instruction_require_time = new Date(); + private Date require_apply_labeling_time = new Date(); + private Date require_apply_strangulation_time = new Date(); + private Date require_empty_in_time = new Date(); + private Date require_empty_out_time = new Date(); + + private int instruction_require_time_out = 3000; + //行架机械手申请任务成功标识 + boolean requireSucess = false; + boolean requireApplyLabelingSuccess = false; + boolean requireApplyLaStrangulationSuccess = false; + boolean requireEmptyInSuccess = false; + boolean requireEmptyOutSuccess = false; + boolean requiresShipDeviceUpdate = true; + private int instruction_finished_time_out; + + int branchProtocol = 0; + String inst_message; + String last_inst_message; + + //当前指令 + + //暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域 + int flag; + + String device_code; + + String vehicle_code; + String last_vehicle_code; + + @Override + public Device getDevice() { + return this.device; + } + + + @Override + public void execute() { + try { + device_code = this.getDeviceCode(); + mode = this.itemProtocol.getMode(); + move = this.itemProtocol.getMove(); + carrier_direction = this.itemProtocol.getCarrier_direction(); + error = this.itemProtocol.getError(); + task = this.itemProtocol.getTask(); + to_command = this.itemProtocol.getTo_command(); + + } catch (Exception var17) { + inst_message = var17.getMessage(); + logServer.deviceExecuteLog(this.getDevice_code(), "", "", "读取信号值时出现异常:" + var17.getMessage()); + } + + if (mode == 0) { + this.setIsonline(false); + message = "未联机"; + + } else { + this.setIsonline(true); + this.setIserror(false); + if (error != 0) { + this.setIserror(true); + message = "有报警"; + } + + } + last_mode = mode; + last_move = move; + last_carrier_direction = carrier_direction; + last_error = error; + last_task = task; + } + + + + public void clearWrite() { + + List list = new ArrayList(); + Map map = new HashMap(); + map.put("code", "to_target"); + map.put("value", "0"); + list.add(map); + Map map2 = new HashMap(); + map2.put("code", "to_task"); + map2.put("value", "0"); + list.add(map2); + Map map3 = new HashMap(); + map3.put("code", "to_command"); + map3.put("value", "0"); + list.add(map3); + Map map4 = new HashMap(); + map4.put("code", "to_strap_times"); + map4.put("value", "0"); + list.add(map4); + Map map5 = new HashMap(); + map5.put("code", "to_length"); + map5.put("value", "0"); + list.add(map5); + Map map6 = new HashMap(); + map6.put("code", "to_weight"); + map6.put("value", "0"); + list.add(map6); + Map map7 = new HashMap(); + map7.put("code", "to_height"); + map7.put("value", "0"); + list.add(map7); + this.writing(list); + message = null; + vehicle_code = null; + } + + public boolean exe_business() { + return true; + } + + public synchronized boolean finish_instruction() throws Exception { + instructionService.finish(inst); +// requireSucess = false; + return true; + } + + + protected void thingToNothing() throws Exception { + requireSucess = false; + } + + + public void writing(String param, String value) { + + String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + param; + Map itemMap = new HashMap(); + + 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); + } + + public void writing(int command) { + + Map itemMap = new HashMap(); + this.control(itemMap); + + } + + @Override + public JSONObject getDeviceStatusName() { + JSONObject jo = new JSONObject(); + String mode = ""; + String move = ""; + String carrier_direction = ""; + if (this.getMode() == 0) { + mode = "脱机"; + } else if (this.getMode() == 1) { + mode = "单机"; + } else if (this.getMode() == 2) { + mode = "待机"; + } else if (this.getMode() == 3) { + mode = "运行中"; + } else if (this.getMode() == 4) { + mode = "申请捆扎中"; + } else if (this.getMode() == 5) { + mode = "申请贴标中"; + } else if (this.getMode() == 6) { + mode = "申请空盘入库中"; + } else if (this.getMode() == 7) { + mode = "申请空盘出库中"; + } else if (this.getMode() == 8) { + mode = "申请AGV任务中"; + } + + if (this.getMove() == 0) { + move = "无货"; + jo.put("hasGoods", false); + } else if (this.getMove() == 1) { + move = "有货"; + jo.put("hasGoods", true); + } else if (this.getMove() == 2) { + move = "有托盘有货"; + jo.put("hasGoods", true); + } + + if (this.carrier_direction == 1) { + carrier_direction = "正转"; + } else if (this.carrier_direction == 2) { + carrier_direction = "反转"; + } + String requireSucess = "0"; + if (this.requireSucess) { + requireSucess = "1"; + } + jo.put("device_name", this.getDevice().getDevice_name()); + jo.put("mode", mode); + jo.put("move", move); + jo.put("carrier_direction", carrier_direction); + jo.put("task", task); + jo.put("last_task", last_task); + jo.put("task_code", task_code); + jo.put("inst_message", this.inst_message); + jo.put("last_inst_message", this.last_inst_message); + jo.put("isOnline", this.getIsonline()); + jo.put("error", this.getError()); + jo.put("isError", this.getIserror()); + jo.put("message", this.getMessage()); + jo.put("is_click", true); + jo.put("requireSucess", requireSucess); + jo.put("driver_type", "siemens_conveyor"); + 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, "1")) { + this.requireSucess = true; + } + } + + 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); + this.control(itemMap); + + } + +} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/ItemProtocol.java index 2ca2c067a..f566a162d 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/ItemProtocol.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/ItemProtocol.java @@ -112,6 +112,13 @@ public class ItemProtocol { return this.getOpcIntegerValue(item_task2); } + public int getTo_command1() { + return this.getOpcIntegerValue(item_to_command1); + } + + public int getTo_command2() { + return this.getOpcIntegerValue(item_to_command2); + } //是否有货 public int hasGoods(int move) { diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java index 2d5c6014c..810ed1f88 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java @@ -91,7 +91,8 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl int last_task1 = 0; int task2 = 0; int last_task2 = 0; - + int to_command1 = 0; + int to_command2 = 0; Boolean isonline = true; //前工位申请任务请求标记 @@ -155,6 +156,8 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl type = this.itemProtocol.getType(); task1 = this.itemProtocol.getTask1(); task2 = this.itemProtocol.getTask2(); + to_command1 = this.itemProtocol.getTo_command1(); + to_command2 = this.itemProtocol.getTo_command2(); if (mode != last_mode) { if (mode == 2) { @@ -243,19 +246,6 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl inst2.setInstruction_status("1"); inst2.setExecute_device_code(this.device_code); instructionService.update(inst2); -// TaskDto taskDto = taskserver.findByCodeFromCache(inst2.getTask_code()); -// if (!ObjectUtil.isEmpty(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", "1"); -// array.add(map); -// acsToWmsService.feedbackTaskStatusToWms(array); -// } -// } - ; - // this.setNow_steps_type2(1); } } } @@ -270,18 +260,6 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl inst2.setInstruction_status("1"); inst2.setExecute_device_code(this.device_code); instructionService.update(inst2); -// TaskDto taskDto = taskserver.findByCodeFromCache(inst2.getTask_code()); -// if (!ObjectUtil.isEmpty(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", "1"); -// array.add(map); -// acsToWmsService.feedbackTaskStatusToWms(array); -// } -// } - ; } } } @@ -302,7 +280,9 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl int move = siemensConveyorDeviceDriver.getMove(); int mode = siemensConveyorDeviceDriver.getMode(); if (mode == 2 && move == 1) { - this.writing("to_command2", "2"); + if(to_command2 != 2){ + this.writing("to_command2", "2"); + } if (type == 2) { this.setNow_steps_type2(3); } else if (type == 3) { @@ -340,7 +320,9 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl //单任务/或双任务 后工位收到取货完成信号并反馈 if (mode == 3 && action2 == 2 && move2 == 1 && task2 > 0) { - this.writing("to_command2", "3"); + if(to_command2 != 3){ + this.writing("to_command2", "3"); + } if (type == 2) { this.setNow_steps_type2(4); } @@ -367,7 +349,9 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl //单任务/双任务 前工位取货时判断动作信号并反馈 if (mode == 3 && action1 == 1 && move1 == 0 && task1 > 0) { - this.writing("to_command1", "2"); + if(to_command1 != 2){ + this.writing("to_command1", "2"); + } if (type == 1) { this.setNow_steps_type1(3); } else if (type == 3) { @@ -393,7 +377,9 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl //单任务/双任务 前工位取货完成并反馈 if (mode == 3 && action1 == 2 && move1 == 1 && task1 > 0) { - this.writing("to_command1", "3"); + if(to_command1 != 3){ + this.writing("to_command1", "3"); + } if (type == 1) { this.setNow_steps_type1(4); } @@ -421,7 +407,9 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl //单任务/双任务 后工位放货时判断信号并反馈 if (mode == 3 && action2 == 3 && move2 == 1 && task2 > 0) { - this.writing("to_command2", "4"); + if(to_command2 != 4){ + this.writing("to_command2", "4"); + } if (type == 2) { this.setNow_steps_type2(5); } else if (type == 3) { @@ -452,19 +440,9 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl if (inst2 != null) { if (StrUtil.equals(inst2.getInstruction_status(), "1")) { finish_instruction(inst2); - TaskDto taskDto = taskserver.findByCodeFromCache(inst2.getTask_code()); - if (!ObjectUtil.isEmpty(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", "2"); - array.add(map); - acsToWmsService.feedbackTaskStatusToWms(array); - } + if(to_command2 != 5){ + this.writing("to_command2", "5"); } - ; - this.writing("to_command2", "5"); this.setNow_steps_type2(6); this.setNow_steps_type2(0); } @@ -492,7 +470,9 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl //双任务 后工位反馈任务完成 并反馈 if (mode == 3 && action2 == 4 && move2 == 0 && task1 > 0 && task2 > 0 && type == 3) { - this.writing("to_command2", "5"); + if(to_command2 != 5){ + this.writing("to_command2", "5"); + } this.setNow_steps_type3(8); } else { if (this.getNow_steps_type3() == 7) { @@ -538,7 +518,9 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl int move = siemensConveyorDeviceDriver.getMove(); int mode = siemensConveyorDeviceDriver.getMode(); if (move == 1 && mode == 2) { - this.writing("to_command1", "4"); + if(to_command1 != 4){ + this.writing("to_command1", "4"); + } if (type == 1) { this.setNow_steps_type1(5); } else if (type == 3) { @@ -582,19 +564,9 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl if (inst1 != null) { if (StrUtil.equals(inst1.getInstruction_status(), "1")) { this.finish_instruction(inst1); - TaskDto taskDto = taskserver.findByCodeFromCache(inst1.getTask_code()); - if (!ObjectUtil.isEmpty(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", "2"); - array.add(map); - acsToWmsService.feedbackTaskStatusToWms(array); - } + if(to_command1 != 5){ + this.writing("to_command1", "5"); } - ; - this.writing("to_command1", "5"); this.setNow_steps_type1(6); this.setNow_steps_type1(0); } @@ -628,19 +600,9 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl if (inst1 != null) { if (StrUtil.equals(inst1.getInstruction_status(), "1")) { this.finish_instruction(inst1); - TaskDto taskDto = taskserver.findByCodeFromCache(inst1.getTask_code()); - if (!ObjectUtil.isEmpty(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", "2"); - array.add(map); - acsToWmsService.feedbackTaskStatusToWms(array); - } + if(to_command1 != 5){ + this.writing("to_command1", "5"); } - ; - this.writing("to_command1", "5"); this.setNow_steps_type3(10); this.setNow_steps_type3(0); } @@ -673,16 +635,9 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl } catch (Exception var17) { feedMessage = var17.getMessage(); logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage()); -// return; } -// if (!this.itemProtocol.getIsonline()) { -// this.setIsonline(false); -// this.setIserror(true); -// message = "信号量同步异常"; -// //未联机 -// } else - if (mode == 0) { + if (mode == 0) { this.setIsonline(false); message = "未联机"; //有报警 @@ -725,11 +680,8 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl feedMessage = ""; notCreateInstMessage = ""; notCreateTaskMessage = ""; - logServer.deviceExecuteLog(device_code, "", String.valueOf(task1), "move2:" + move2 + ",action2:" + action2 + ",move1:" + move1 + ",action1:" + action1 + ",requireSucess:" + requireSucess); } else { -// if (!requireSucess) { -// remark = remark + "请求标记为true,请检查mode是否由其他值变为2!"; -// } + if (!requireSucess) { String remark = ""; if (mode != 2) { @@ -1140,12 +1092,6 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl list.add(map6); this.writing(list); logServer.deviceExecuteLog(device_code, "", "", dto.getInstruction_code() + "下发前工位任务"); - -// this.writing("to_onset1", start_addr); -// this.writing("to_target1", next_addr); -// this.writing("to_task1", dto.getInstruction_code()); -// this.writing("to_command1", "1"); -// this.writing("to_type", "1"); this.setNow_steps_type1(2); } else if (StrUtil.equals(type, "2")) { Map map1 = new HashMap(); @@ -1175,12 +1121,6 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl list.add(map6); this.writing(list); logServer.deviceExecuteLog(device_code, "", "", dto.getInstruction_code() + "下发后工位任务"); - -// this.writing("to_onset2", start_addr); -// this.writing("to_target2", next_addr); -// this.writing("to_task2", dto.getInstruction_code()); -// this.writing("to_command2", "1"); -// this.writing("to_type", "2"); this.setNow_steps_type2(2); } else if (StrUtil.equals(type, "3")) { String start_device_code2 = dto.getStart_device_code2(); @@ -1230,16 +1170,6 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl this.writing(list); logServer.deviceExecuteLog(device_code, "", "", dto.getInstruction_code() + "下发双工位任务"); - -// this.writing("to_onset1", start_addr2); -// this.writing("to_target1", next_addr2); -// this.writing("to_task1", dto.getInstruction_code()); -// this.writing("to_command1", "1"); -// this.writing("to_onset2", start_addr); -// this.writing("to_target2", next_addr); -// this.writing("to_task2", dto.getInstruction_code()); -// this.writing("to_command2", "1"); -// this.writing("to_type", "3"); this.setNow_steps_type3(2); } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java index 70654b0a2..30c6f1761 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java @@ -107,7 +107,7 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple String message; // 1 上位系统允许进入 2 上位系统允许离开 - int status = 0; + int option = 0; int agvphase = 0; int index = 0; diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java index 47c5a8807..b004859c4 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java @@ -70,7 +70,7 @@ public class WmsToAcsController { } @PostMapping("/querydevice") - @Log(value = "WMS查询设备状态",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS) +// @Log(value = "WMS查询设备状态",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS) @ApiOperation("WMS查询设备状态") @SaIgnore public ResponseEntity queryDevice(@RequestBody String whereJson) throws Exception { @@ -94,4 +94,11 @@ public class WmsToAcsController { return new ResponseEntity<>(wmstoacsService.putPlusPullAction(whereJson), HttpStatus.OK); } + @PostMapping("/updateTask") + @Log(value = "WMS更新任务点位状态",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS) + @ApiOperation("WMS更新任务点位状态") + @SaIgnore + public ResponseEntity updateTask(@RequestBody String whereJson){ + return new ResponseEntity<>(wmstoacsService.updateTask(whereJson), HttpStatus.OK); + } } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java index a9125cccf..7890352df 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java @@ -84,4 +84,12 @@ public interface WmsToAcsService { Map putPlusPullAction(String whereJson); + /** + * 更新任务点位状态 + * + * @param whereJson 条件 + * @return Map + */ + Map updateTask(String whereJson); + } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java index 4f99defa4..c6618e197 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java @@ -9,6 +9,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.nl.acs.AcsConfig; import org.nl.acs.common.IDriverService; +import org.nl.acs.common.StandardOrdinarySiteDevice; import org.nl.acs.device.service.DeviceService; import org.nl.acs.device_driver.basedriver.cargo_lift_conveyor.CargoLiftConveyorDeviceDriver; import org.nl.acs.device_driver.basedriver.empty_vehicle_stacking_position.EmptyVehicleStackingPositionDeviceDriver; @@ -16,6 +17,8 @@ import org.nl.acs.device_driver.basedriver.hongxiang_conveyor.HongXiangStationDe import org.nl.acs.device_driver.basedriver.hongxiang_device.HongXiangConveyorDeviceDriver; import org.nl.acs.device_driver.basedriver.plug_pull_device_site.PlugPullDeviceSiteDeviceDriver; import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver; +import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDefination; +import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver; import org.nl.acs.ext.wms.data.*; import org.nl.acs.ext.wms.liKuData.Resp; import org.nl.acs.ext.wms.service.AcsToLiKuService; @@ -728,9 +731,41 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { MDC.remove(log_file_type); } - - } + @Override + public Map updateTask(String whereJson) { + JSONArray datas = JSONArray.parseArray(whereJson); + log.info("updateTask--------------:输入参数" + datas.toString()); + JSONObject map = new JSONObject(); + if (datas.size() > 0) { + for (int i = 0; i < datas.size(); i++) { + JSONObject jsonObject = datas.getJSONObject(i); + String device_code = jsonObject.getString("device_code"); + String task_code = jsonObject.getString("task_code"); + //1-允许取放; 2-允许离开 + String option = jsonObject.getString("option"); + StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver; + Device device_k = deviceAppService.findDeviceByCode(device_code+"_K"); + Device device_m = deviceAppService.findDeviceByCode(device_code+"_M"); + + if(device_k.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver){ + standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device_k.getDeviceDriver(); + standardOrdinarySiteDeviceDriver.setOption(Integer.parseInt(option)); + } + if(device_m.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver){ + standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device_m.getDeviceDriver(); + standardOrdinarySiteDeviceDriver.setOption(Integer.parseInt(option)); + } + + } + } + JSONObject resultJson = new JSONObject(); + resultJson.put("status", HttpStatus.OK); + resultJson.put("message", "操作成功"); + resultJson.put("data", map); + return resultJson; + } + } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceAppService.java b/acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceAppService.java index 75887637a..8718992ef 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceAppService.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceAppService.java @@ -81,4 +81,9 @@ public interface DeviceAppService { */ String findDeviceTypeByCode(String deviceCode); + + void removeDevice(String deviceCode); + + void addDevice(String deviceCode); + } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceAppServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceAppServiceImpl.java index 7f1d71030..a415b9148 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceAppServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceAppServiceImpl.java @@ -302,6 +302,51 @@ public class DeviceAppServiceImpl implements DeviceAppService, ApplicationAutoIn return null; } + @Override + public void removeDevice(String deviceCode) { + + Iterator iterator = devices.iterator(); + while (iterator.hasNext()) { + Device device = iterator.next(); + if (StrUtil.equals(device.getDevice_code(), deviceCode)) { + iterator.remove(); + } + } + Iterator iterator2 = code_indexs.iterator(); + while (iterator2.hasNext()) { + String str = iterator2.next(); + if (StrUtil.equals(str, deviceCode)) { + iterator2.remove(); + } + } + + } + + @Override + public void addDevice(String deviceCode) { + List deviceManageDtos = this.deviceManageService.queryAllWithExtra(deviceCode); + int i = 0; + + for (int size = deviceManageDtos.size(); i < size; ++i) { + DeviceManageDto deviceManage = (DeviceManageDto) deviceManageDtos.get(i); + Device device = new Device(); + BeanUtil.copyProperties(deviceManage, device); + this.devices.add(device); + this.code_indexs.add(device.getDevice_code()); + + if (!StrUtil.isEmpty(device.getDriver_code())) { + DeviceDriverDefination defination = this.deviceDriverDefinationAppService.getDeviceDriverDefination(deviceManage.getDriver_code()); + if (defination != null) { + device.setDeviceDriverDefination(defination); + DeviceDriver driver = defination.getDriverInstance(device); + device.setDeviceDriver(driver); + + } + } + + } + } + public List findLaneway() { return this.findDeviceDriver(LinewayDeviceDriver.class); } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceManageService.java b/acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceManageService.java index f95b50ba3..adff13b8d 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceManageService.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceManageService.java @@ -4,4 +4,7 @@ import java.util.List; public interface DeviceManageService { List queryAllWithExtra(); + + List queryAllWithExtra(String device_code); + } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceManageServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceManageServiceImpl.java index c0f64d9f0..4313f1740 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceManageServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceManageServiceImpl.java @@ -78,4 +78,69 @@ public class DeviceManageServiceImpl implements DeviceManageService { return devices; } + + @Override + public List queryAllWithExtra(String device_code) { + JSONArray arr = WQLObject.getWQLObject("acs_device").query("device_code = '" + device_code + " '").getResultJSONArray(0); + + JSONArray extArr = WQLObject.getWQLObject("acs_device_extra").query("device_code = '" + device_code + " '").getResultJSONArray(0); + + List extras = extArr.toJavaList(DeviceExtraManageDto.class); + + WQLObject runpointTab = WQLObject.getWQLObject("acs_device_runpoint"); + + WQLObject opcTab = WQLObject.getWQLObject("acs_opc"); + //OPC_PLC表【acs_opc_plc】 + WQLObject plcTab = WQLObject.getWQLObject("acs_opc_plc"); + List devices = new ArrayList<>(); + for (int i = 0; i < arr.size(); i++) { + JSONObject json = arr.getJSONObject(i); + DeviceManageDto device = json.toJavaObject(DeviceManageDto.class); + String opc_server_id = json.getString("opc_server_id"); + String opc_plc_id = json.getString("opc_plc_id"); + if (StrUtil.isNotEmpty(opc_plc_id) && StrUtil.isNotEmpty(opc_server_id)) { + //OPC表【acs_opc】 + JSONObject rb = opcTab.query("is_delete= '0' AND is_active= '1' AND opc_id = '" + opc_server_id + "'").uniqueResult(0); + if(ObjectUtil.isEmpty(rb)){ + System.out.println(device.getDevice_code()); + continue; + } + String opc_code= rb.getString("opc_code"); + device.setOpc_server_code(opc_code); + if(ObjectUtil.isEmpty(plcTab.query("is_delete= '0' AND is_active= '1' AND plc_id = '" + opc_plc_id + "'").uniqueResult(0))) + { + System.out.println(device.getDevice_code()); + continue; + } + String plc_code = plcTab.query("is_delete= '0' AND is_active= '1' AND plc_id = '" + opc_plc_id + "'").uniqueResult(0).getString("plc_code"); + device.setOpc_plc_code(plc_code); + } + devices.add(device); + } + + Iterator it = devices.iterator(); + + while (it.hasNext()) { + DeviceManageDto device = (DeviceManageDto) it.next(); + Iterator var5 = extras.iterator(); + while (var5.hasNext()) { + DeviceExtraManageDto extra = (DeviceExtraManageDto) var5.next(); + if (extra.getDevice_id().equals(device.getDevice_id())) { + device.getExtra().add(extra); + if (StrUtil.equals(extra.getExtra_code(), "station_manager") && StrUtil.equals(extra.getExtra_value().toString(), "true")) { + String has_goods = runpointTab.query("is_delete= '0' AND is_active= '1' AND device_id = '" + extra.getDevice_id() + "'").uniqueResult(0).getString("hasgoods"); + String material_type = runpointTab.query("is_delete= '0' AND is_active= '1' AND device_id = '" + extra.getDevice_id() + "'").uniqueResult(0).getString("material_type"); + String batch = runpointTab.query("is_delete= '0' AND is_active= '1' AND device_id = '" + extra.getDevice_id() + "'").uniqueResult(0).getString("batch"); + String islock = runpointTab.query("is_delete= '0' AND is_active= '1' AND device_id = '" + extra.getDevice_id() + "'").uniqueResult(0).getString("islock"); + device.setMaterial_type(material_type); + device.setHas_goods(Integer.parseInt(has_goods)); + device.setBatch(batch); + device.setIslock(islock); + } + } + } + } + + return devices; + } } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java b/acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java index a609a2d78..db19141d2 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java @@ -120,8 +120,8 @@ public class DeviceOpcProtocolRunable implements Runnable { try { itemStatus = group.read(true, (Item[]) itemsMap.values().toArray(new Item[0])); } catch (Exception e){ -// System.out.println("数据同步异常:"+itemsMap); - e.printStackTrace(); + System.out.println("数据同步异常:"+ this.getOpcServer().getOpc_code()); + //e.printStackTrace(); } long end = System.currentTimeMillis(); log.trace("{} 开始记时{}", tag, DateUtil.now()); @@ -138,7 +138,7 @@ public class DeviceOpcProtocolRunable implements Runnable { time_out = false; } - if(ObjectUtil.isEmpty(itemStatus)) continue label97; +// if(ObjectUtil.isEmpty(itemStatus)) continue label97; Set items = itemStatus.keySet(); Iterator var18 = items.iterator(); diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/common/utils/StringUtils.java b/acs/nladmin-system/src/main/java/org/nl/modules/common/utils/StringUtils.java index 269c7f5db..b90121d71 100644 --- a/acs/nladmin-system/src/main/java/org/nl/modules/common/utils/StringUtils.java +++ b/acs/nladmin-system/src/main/java/org/nl/modules/common/utils/StringUtils.java @@ -53,7 +53,8 @@ public class StringUtils { private static final UserAgentAnalyzer USER_AGENT_ANALYZER = UserAgentAnalyzer .newBuilder() .hideMatcherLoadStats() - .withCache(10000) + .withCache(1) +// .withCache(10000) .withField(UserAgent.AGENT_NAME_VERSION) .build(); diff --git a/acs/nladmin-ui/src/views/acs/device/config.vue b/acs/nladmin-ui/src/views/acs/device/config.vue index 477cdc6d1..e8da1280c 100644 --- a/acs/nladmin-ui/src/views/acs/device/config.vue +++ b/acs/nladmin-ui/src/views/acs/device/config.vue @@ -95,6 +95,7 @@ import hongxiang_conveyor from '@/views/acs/device/driver/hongxiang_conveyor' import plug_pull_device_site from '@/views/acs/device/driver/plug_pull_device_site' import siemens_conveyor_labeling from '@/views/acs/device/driver/siemens_conveyor_labeling' import siemens_conveyor_ckk from '@/views/acs/device/driver/siemens_conveyor_ckk' +import siemens_onefloor_agv_conveyor from '@/views/acs/device/driver/siemens_onefloor_agv_conveyor' export default { name: 'DeviceConfig', @@ -120,7 +121,8 @@ export default { slit_two_manipulator, plug_pull_device_site, siemens_conveyor_labeling, - siemens_conveyor_ckk + siemens_conveyor_ckk, + siemens_onefloor_agv_conveyor }, dicts: ['device_type'], mixins: [crud], diff --git a/acs/nladmin-ui/src/views/acs/device/driver/siemens_onefloor_agv_conveyor.vue b/acs/nladmin-ui/src/views/acs/device/driver/siemens_onefloor_agv_conveyor.vue new file mode 100644 index 000000000..81c699a1e --- /dev/null +++ b/acs/nladmin-ui/src/views/acs/device/driver/siemens_onefloor_agv_conveyor.vue @@ -0,0 +1,530 @@ + + + + + diff --git a/lms/nladmin-system/pom.xml b/lms/nladmin-system/pom.xml index 506e552b6..7c5bfd82d 100644 --- a/lms/nladmin-system/pom.xml +++ b/lms/nladmin-system/pom.xml @@ -45,22 +45,6 @@ 6.1.4 - - - - - - - - - - - - - - - - com.internetitem 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 new file mode 100644 index 000000000..1222496c6 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/config/ESConfig.java @@ -0,0 +1,18 @@ +package org.nl.config; + +/* + * @author ZZQ + * @Date 2023/2/13 9:58 上午 + */ + +import lombok.Data; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; + +@Configuration +@Data +public class ESConfig { + + @Value(("${es.index}")) + private String index; +} diff --git a/lms/nladmin-system/src/main/java/org/nl/modules/logging/aspect/LogAspect.java b/lms/nladmin-system/src/main/java/org/nl/modules/logging/aspect/LogAspect.java index bbc2e077b..820221159 100644 --- a/lms/nladmin-system/src/main/java/org/nl/modules/logging/aspect/LogAspect.java +++ b/lms/nladmin-system/src/main/java/org/nl/modules/logging/aspect/LogAspect.java @@ -123,11 +123,8 @@ public class LogAspect { StackTraceElement[] stackTrace = ex.getStackTrace(); if (stackTrace!=null && stackTrace.length>0){ for (StackTraceElement stack : stackTrace) { - x++; - errorStack.append(stack.toString().replaceAll("<",">")).append("
"); - if (x>10){ - break; - } + x++;errorStack.append(stack.toString().replaceAll("<",">")).append("
"); + if (x>10){ break; } } } log.error("[-requestError-][请求接口:{}]【异常信息:{}】[请求参数:{}] {}", url,errorMsg,params, errorStack.append("】").toString()); @@ -179,7 +176,4 @@ public class LogAspect { return ""; } } - - - } diff --git a/lms/nladmin-system/src/main/java/org/nl/modules/logging/service/dto/LogRepositoryDTO.java b/lms/nladmin-system/src/main/java/org/nl/modules/logging/service/dto/LogRepositoryDTO.java index 63317ba91..5f0ba2659 100644 --- a/lms/nladmin-system/src/main/java/org/nl/modules/logging/service/dto/LogRepositoryDTO.java +++ b/lms/nladmin-system/src/main/java/org/nl/modules/logging/service/dto/LogRepositoryDTO.java @@ -8,7 +8,7 @@ import org.springframework.data.elasticsearch.annotations.Document; * @author ZZQ * @Date 2023/2/8 4:06 下午 */ -@Document(indexName = "lms_log", type = "lms_log") +@Document(indexName = "#{@ESConfig.index}", type = "lms_log") @Data public class LogRepositoryDTO { 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 83a7012a4..c8b101d95 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 @@ -69,7 +69,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { */ @Override public Map receiveTaskStatusAcs(String string) { - log.info("receiveTaskStatusAcs请求参数:--------------------------------------"+string); + log.info("receiveTaskStatusAcs请求参数:--------------------------------------" + string); JSONArray array = JSONArray.parseArray(string); //返回处理失败的任务 JSONArray errArr = new JSONArray(); @@ -508,7 +508,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { @Override public JSONObject deviceApply(JSONObject whereJson) { - log.info("deviceApply请求参数:---------------------------------------------"+whereJson.toString()); + log.info("deviceApply请求参数:---------------------------------------------" + whereJson.toString()); String vehicle_code = whereJson.getString("vehicle_code"); String weight = whereJson.getString("weight"); String type = whereJson.getString("type"); @@ -571,13 +571,13 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { data.put("box_width", box_width); data.put("box_high", box_high); data.put("bundle_times", 2); - result.put("data",data); + result.put("data", data); } else if (type.equals("3")) { //烘箱出箱任务 String device_code = whereJson.getString("device_code"); JSONObject bake_jo = new JSONObject(); - bake_jo.put("point_code",device_code); - bake_jo.put("option","2"); + bake_jo.put("point_code", device_code); + bake_jo.put("option", "2"); new BakingServiceImpl().ovenInAndOut(bake_jo); } else { throw new BadRequestException("请输入正确的任务类型!"); @@ -587,7 +587,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { @Override public JSONObject process(JSONObject whereJson) { - log.info("process请求参数:---------------------------------------------"+whereJson.toString()); + log.info("process请求参数:---------------------------------------------" + whereJson.toString()); String vehicle_code = whereJson.getString("vehicle_code"); String ext_task_id = whereJson.getString("ext_task_id"); String srcLocation = whereJson.getString("srcLocation"); @@ -654,20 +654,20 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { @Override public JSONObject shipDeviceUpdate(JSONObject whereJson) { - log.info("shipDeviceUpdate请求参数:---------------------------------------------"+whereJson.toString()); + log.info("shipDeviceUpdate请求参数:---------------------------------------------" + whereJson.toString()); String device_code = whereJson.getString("device_code"); - if (StrUtil.isEmpty(device_code)){ + if (StrUtil.isEmpty(device_code)) { throw new BadRequestException("输入的设备号不能为空!"); } //查询该设备对应的输送线点位 - JSONObject deliver_jo = WQLObject.getWQLObject("st_ivt_deliverypointivt").query("point_code = '"+device_code+"'").uniqueResult(0); - if (deliver_jo != null){ + JSONObject deliver_jo = WQLObject.getWQLObject("st_ivt_deliverypointivt").query("point_code = '" + device_code + "'").uniqueResult(0); + if (deliver_jo != null) { String qzzno = deliver_jo.getString("qzzno"); - if (ObjectUtil.isNotEmpty(deliver_jo)){ - deliver_jo.put("point_status","01"); - deliver_jo.put("qzzno",""); - deliver_jo.put("vehicle_code",""); + if (ObjectUtil.isNotEmpty(deliver_jo)) { + deliver_jo.put("point_status", "01"); + deliver_jo.put("qzzno", ""); + deliver_jo.put("vehicle_code", ""); WQLObject.getWQLObject("st_ivt_deliverypointivt").update(deliver_jo); //如果为靠近分切机一端的输送点,判断远离端是否需要进行横移 @@ -681,18 +681,18 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { .addParam("point_code", device_code) .addParam("product_area", product_area) .addParam("sort_seq", sort_seq) - .addParam("find_type","1") + .addParam("find_type", "1") .addParam("flag", "17").process().uniqueResult(0); if (ObjectUtil.isNotEmpty(right_point) && !right_point.getString("point_status").equals("01")) { //创建载具横移任务 String translate_code1 = right_point.getString("point_code"); String translate_code2 = device_code; JSONObject tran_jo = new JSONObject(); - tran_jo.put("point_code1",translate_code1); - tran_jo.put("point_code2",translate_code2); - tran_jo.put("vehicle_code",right_point.getString("qzzno")); - tran_jo.put("vehicle_code2",right_point.getString("vehicle_code")); - tran_jo.put("task_type","010406"); + tran_jo.put("point_code1", translate_code1); + tran_jo.put("point_code2", translate_code2); + tran_jo.put("vehicle_code", right_point.getString("qzzno")); + tran_jo.put("vehicle_code2", right_point.getString("vehicle_code")); + tran_jo.put("task_type", "010406"); cutConveyorTask.createTask(tran_jo); } } @@ -707,100 +707,98 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { @Override public void initialize(JSONObject param) { { - { - int j_size = param.getInteger("j"); // 排 - int k_size = param.getInteger("k"); // 列 - String block = param.getString("layer"); // 块 - JSONObject max_jo = WQLObject.getWQLObject("ST_IVT_StructAttr").query("sect_code = 'ZC01' order by out_order_seq desc ").uniqueResult(0); - int max_no = 0; - if (ObjectUtil.isNotEmpty(max_jo)) { - max_no = max_jo.getIntValue("out_order_seq"); - } - max_no++; - for (int i = 1; i < 4; i++) { - for (int j = 1; j < j_size; j++) { - for (int k = 1; k < k_size; k++) { - //排 - String row = ""; - if (j < 10) { - row = "0" + j; - } else { - row = j + ""; - } - - //列 - String line = ""; - if (k < 10) { - line = "0" + k; - } else { - line = k + ""; - } - - //块 - String piece = i + block; - - //层 - String layer = "0" + i; - - - JSONObject jo = new JSONObject(); - jo.put("struct_id", IdUtil.getSnowflake(1, 1).nextId()); - jo.put("struct_code", piece + row + "-" + line + "-" + layer); - jo.put("struct_name", piece + "区" + row + "排" + line + "列" + layer + "层"); - jo.put("simple_name", piece + "区" + row + "排" + line + "列" + layer + "层"); - jo.put("sect_id", "1582991348217286656"); - jo.put("sect_code", "ZC01"); - jo.put("sect_name", "主存区"); - jo.put("stor_id", "1582991156504039424"); - jo.put("stor_code", "CP01"); - jo.put("stor_name", "兰州仓库"); - jo.put("stor_type", "03"); - jo.put("is_tempstruct", "0"); - jo.put("row_num", row); - jo.put("col_num", line); - jo.put("layer_num", layer); - jo.put("block_num", piece); - jo.put("in_order_seq", 0); - jo.put("out_order_seq", max_no); - jo.put("in_empty_seq", 0); - jo.put("out_empty_seq", 0); - jo.put("placement_type", "01"); - jo.put("create_id", "1"); - jo.put("create_name", "管理员"); - jo.put("create_time", DateUtil.now()); - jo.put("update_optid", "1"); - jo.put("update_optname", "管理员"); - jo.put("update_time", DateUtil.now()); - jo.put("is_delete", "0"); - jo.put("is_used", "1"); - jo.put("lock_type", "1"); - jo.put("material_height_type", "1"); - WQLObject.getWQLObject("ST_IVT_StructAttr").insert(jo); - max_no++; - //插入点位 - JSONObject structMap = new JSONObject(); - structMap.put("point_id", IdUtil.getSnowflake(1,1).nextId()); - structMap.put("point_code", jo.getString("struct_code")); - structMap.put("point_name", jo.getString("struct_name")); - structMap.put("region_id", "1582991348217286656"); - structMap.put("region_code", jo.getString("sect_code")); - structMap.put("region_name", jo.getString("sect_name")); - structMap.put("point_type", "2"); - structMap.put("point_status", "1"); - structMap.put("lock_type", jo.getString("lock_type")); - structMap.put("block_num", jo.getIntValue("block_num")); - structMap.put("row_num", jo.getIntValue("row_num")); - structMap.put("col_num", jo.getIntValue("col_num")); - structMap.put("layer_num", jo.getIntValue("layer_num")); - structMap.put("source_id", jo.getString("struct_id")); - structMap.put("create_id", "1"); - structMap.put("create_name", "管理员"); - structMap.put("create_time", DateUtil.now()); - structMap.put("update_optid", "1"); - structMap.put("update_optname", "管理员"); - structMap.put("update_time", DateUtil.now()); - WQLObject.getWQLObject("sch_base_point").insert(structMap); + int j_size = param.getInteger("j"); // 排 + int k_size = param.getInteger("k"); // 列 + String block = param.getString("layer"); // 块 + JSONObject max_jo = WQLObject.getWQLObject("ST_IVT_StructAttr").query("sect_code = 'ZC01' order by out_order_seq desc ").uniqueResult(0); + int max_no = 0; + if (ObjectUtil.isNotEmpty(max_jo)) { + max_no = max_jo.getIntValue("out_order_seq"); + } + max_no++; + for (int i = 1; i < 4; i++) { + for (int j = 1; j < j_size; j++) { + for (int k = 1; k < k_size; k++) { + //排 + String row = ""; + if (j < 10) { + row = "0" + j; + } else { + row = j + ""; } + + //列 + String line = ""; + if (k < 10) { + line = "0" + k; + } else { + line = k + ""; + } + + //块 + String piece = i + block; + + //层 + String layer = "0" + i; + + + JSONObject jo = new JSONObject(); + jo.put("struct_id", IdUtil.getSnowflake(1, 1).nextId()); + jo.put("struct_code", piece + row + "-" + line + "-" + layer); + jo.put("struct_name", piece + "区" + row + "排" + line + "列" + layer + "层"); + jo.put("simple_name", piece + "区" + row + "排" + line + "列" + layer + "层"); + jo.put("sect_id", "1582991348217286656"); + jo.put("sect_code", "ZC01"); + jo.put("sect_name", "主存区"); + jo.put("stor_id", "1582991156504039424"); + jo.put("stor_code", "CP01"); + jo.put("stor_name", "兰州仓库"); + jo.put("stor_type", "03"); + jo.put("is_tempstruct", "0"); + jo.put("row_num", row); + jo.put("col_num", line); + jo.put("layer_num", layer); + jo.put("block_num", piece); + jo.put("in_order_seq", 0); + jo.put("out_order_seq", max_no); + jo.put("in_empty_seq", 0); + jo.put("out_empty_seq", 0); + jo.put("placement_type", "01"); + jo.put("create_id", "1"); + jo.put("create_name", "管理员"); + jo.put("create_time", DateUtil.now()); + jo.put("update_optid", "1"); + jo.put("update_optname", "管理员"); + jo.put("update_time", DateUtil.now()); + jo.put("is_delete", "0"); + jo.put("is_used", "1"); + jo.put("lock_type", "1"); + jo.put("material_height_type", "1"); + WQLObject.getWQLObject("ST_IVT_StructAttr").insert(jo); + max_no++; + //插入点位 + JSONObject structMap = new JSONObject(); + structMap.put("point_id", IdUtil.getSnowflake(1, 1).nextId()); + structMap.put("point_code", jo.getString("struct_code")); + structMap.put("point_name", jo.getString("struct_name")); + structMap.put("region_id", "1582991348217286656"); + structMap.put("region_code", jo.getString("sect_code")); + structMap.put("region_name", jo.getString("sect_name")); + structMap.put("point_type", "2"); + structMap.put("point_status", "1"); + structMap.put("lock_type", jo.getString("lock_type")); + structMap.put("block_num", jo.getIntValue("block_num")); + structMap.put("row_num", jo.getIntValue("row_num")); + structMap.put("col_num", jo.getIntValue("col_num")); + structMap.put("layer_num", jo.getIntValue("layer_num")); + structMap.put("source_id", jo.getString("struct_id")); + structMap.put("create_id", "1"); + structMap.put("create_name", "管理员"); + structMap.put("create_time", DateUtil.now()); + structMap.put("update_optid", "1"); + structMap.put("update_optname", "管理员"); + structMap.put("update_time", DateUtil.now()); + WQLObject.getWQLObject("sch_base_point").insert(structMap); } } } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/pdm.xls b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/pdm.xls index 88b2e50de..f40b984fc 100644 Binary files a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/pdm.xls and b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/pdm.xls differ 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 d441c92a7..09972e7e5 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 @@ -1,6 +1,7 @@ package org.nl.wms.sch.manage; +import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; @@ -13,19 +14,36 @@ import org.springframework.stereotype.Component; @Slf4j @Component @RequiredArgsConstructor -public class AutoQueryDeviceStatus{ +public class AutoQueryDeviceStatus { private final WmsToAcsService wmsToAcsService; + public void run() { //通过ACS接口获取温度 - JSONArray device_rows = WQL.getWO("PDA_02").addParam("flag","15").process().getResultJSONArray(0); + JSONArray device_rows = WQL.getWO("PDA_02").addParam("flag", "15").process().getResultJSONArray(0); JSONObject jo = wmsToAcsService.getPointStatus(device_rows); - WQLObject ivtTab=WQLObject.getWQLObject("st_ivt_hotpointivt"); + WQLObject ivtTab = WQLObject.getWQLObject("st_ivt_hotpointivt"); 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"); - JSONObject point_jo = ivtTab.query("point_code = '"+device_code+"'").uniqueResult(0); - point_jo.put("temperature",row.getString("temperature")); + JSONObject point_jo = ivtTab.query("point_code = '" + device_code + "'").uniqueResult(0); + point_jo.put("temperature", row.getString("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 + "分钟"; + point_jo.put("last_time", last_time); ivtTab.update(point_jo); } } diff --git a/lms/nladmin-system/src/main/resources/config/application-dev.yml b/lms/nladmin-system/src/main/resources/config/application-dev.yml index d267e00d8..263ccda44 100644 --- a/lms/nladmin-system/src/main/resources/config/application-dev.yml +++ b/lms/nladmin-system/src/main/resources/config/application-dev.yml @@ -184,3 +184,5 @@ sa-token: loki: url: http://localhost:3100/loki/api/v1 systemName: lms +es: + index: lms_log 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 6bb7eed6e..fc1a5bd14 100644 --- a/lms/nladmin-system/src/main/resources/config/application-prod.yml +++ b/lms/nladmin-system/src/main/resources/config/application-prod.yml @@ -178,11 +178,7 @@ sa-token: is-log: false jwt-secret-key: opsjajisdnnca0sdkksdfaaasdfwwq # token 前缀 - token-prefix: + token-prefix: Bearer cookie: # 配置 Cookie 作用域:根据二级域名实现sso登入如lms.sso.com;acs.sso.com domain: - -loki: - url: http://localhost:3100/loki/api/v1 - systemName: lms diff --git a/lms/nladmin-system/src/main/resources/logback-spring.xml b/lms/nladmin-system/src/main/resources/logback-spring.xml index c9c78c213..9bdd5c291 100644 --- a/lms/nladmin-system/src/main/resources/logback-spring.xml +++ b/lms/nladmin-system/src/main/resources/logback-spring.xml @@ -15,6 +15,7 @@ https://juejin.cn/post/6844903775631572999 value="%black(%contextName-) %X{traceId} %red(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %gray(%msg%n)"/> + @@ -50,7 +51,7 @@ https://juejin.cn/post/6844903775631572999 http://10.1.3.90:9200/_bulk - lms_log + ${esIndex} lms_log es-logger es-error-logger