diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/box_palletizing_manipulator/BoxPalletizingManipulatorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/box_palletizing_manipulator/BoxPalletizingManipulatorDeviceDriver.java index 7bce24421..b98a72a6d 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/box_palletizing_manipulator/BoxPalletizingManipulatorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/box_palletizing_manipulator/BoxPalletizingManipulatorDeviceDriver.java @@ -111,6 +111,7 @@ public class BoxPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDriv walk_y = this.itemProtocol.getWalk_y(); error = this.itemProtocol.getError(); task = this.itemProtocol.getTask(); + iserror = this.itemProtocol.deviceStatus; if (mode != last_mode) { logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode)); logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode); @@ -265,7 +266,9 @@ public class BoxPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDriv } else if (this.getAction() == 4) { action = "放货完成"; } - + if(error == 0 && iserror){ + message = "信号连接超时!"; + } jo.put("device_name", this.getDevice().getDevice_name()); jo.put("mode", mode); jo.put("move", move); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/box_palletizing_manipulator/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/box_palletizing_manipulator/ItemProtocol.java index 74a42e822..ec5a996e0 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/box_palletizing_manipulator/ItemProtocol.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/box_palletizing_manipulator/ItemProtocol.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.basedriver.box_palletizing_manipulator; +import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import lombok.Data; import lombok.extern.slf4j.Slf4j; @@ -64,9 +65,15 @@ public class ItemProtocol { Boolean isonline; + Boolean deviceStatus = false; public int getOpcIntegerValue(String protocol) { Integer value = this.driver.getIntegeregerValue(protocol); + if(ObjectUtil.isEmpty(value)){ + deviceStatus = true; + }else if (item_heartbeat.equals(protocol)){ + deviceStatus = false; + } if (value == null) { // log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); setIsonline(false); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/cargo_lift_conveyor/CargoLiftConveyorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/cargo_lift_conveyor/CargoLiftConveyorDeviceDriver.java index 73f6ad54c..b8165bafe 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/cargo_lift_conveyor/CargoLiftConveyorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/cargo_lift_conveyor/CargoLiftConveyorDeviceDriver.java @@ -107,7 +107,7 @@ public class CargoLiftConveyorDeviceDriver extends AbstractOpcDeviceDriver imple error = this.itemProtocol.getItem_error(); task = this.itemProtocol.getItem_task(); action = this.itemProtocol.getItem_action(); - + iserror = this.itemProtocol.isError; if (mode != last_mode) { this.setRequireSucess(false); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/cargo_lift_conveyor/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/cargo_lift_conveyor/ItemProtocol.java index 9fde67bdd..27d4fc517 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/cargo_lift_conveyor/ItemProtocol.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/cargo_lift_conveyor/ItemProtocol.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.basedriver.cargo_lift_conveyor; +import cn.hutool.core.util.ObjectUtil; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.nl.acs.device.device_driver.standard_inspect.ItemDto; @@ -57,9 +58,15 @@ public class ItemProtocol { } Boolean isonline; + Boolean isError; public int getOpcIntegerValue(String protocol) { Integer value = this.driver.getIntegeregerValue(protocol); + if(ObjectUtil.isEmpty(value)){ + isError = true; + }else if (item_heartbeat.equals(protocol)){ + isError = false; + } if (value == null) { setIsonline(false); } else { diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/casing_station/CasingStationConveyorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/casing_station/CasingStationConveyorDeviceDriver.java index f2b24e088..7a038237c 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/casing_station/CasingStationConveyorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/casing_station/CasingStationConveyorDeviceDriver.java @@ -150,7 +150,7 @@ public class CasingStationConveyorDeviceDriver extends AbstractOpcDeviceDriver i material2 = this.itemProtocol.getMaterial2(); qty = this.itemProtocol.getQty(); to_command = this.itemProtocol.getTo_command(); - + iserror = this.itemProtocol.isError; if (to_command != last_to_command) { logServer.deviceExecuteLog(this.device_code, "", "", "信号to_command:" + last_to_command + "->" + to_command); @@ -479,12 +479,16 @@ public class CasingStationConveyorDeviceDriver extends AbstractOpcDeviceDriver i } else if (this.getMove() == 1) { move = "有托盘"; } + if(error == 0 && iserror){ + message = "信号连接超时!"; + } jo.put("device_name", this.getDevice().getDevice_name()); jo.put("task", task); jo.put("mode", mode); jo.put("error", ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(this.getError()))); jo.put("move", move); jo.put("inventory_qty", qty); + jo.put("isError", iserror); jo.put("out_finish", out_finish); jo.put("material1", material1); jo.put("material2", material2); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/casing_station/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/casing_station/ItemProtocol.java index 143c66e17..1fc78262b 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/casing_station/ItemProtocol.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/casing_station/ItemProtocol.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.basedriver.casing_station; +import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import lombok.Data; import lombok.extern.slf4j.Slf4j; @@ -85,11 +86,17 @@ public class ItemProtocol { } Boolean isonline; + Boolean isError; private CasingStationConveyorDeviceDriver driver; public int getOpcIntegerValue(String protocol) { Integer value = this.driver.getIntegeregerValue(protocol); + if(ObjectUtil.isEmpty(value)){ + isError = true; + }else if (item_heartbeat.equals(protocol)){ + isError = false; + } if (value == null) { setIsonline(false); } else { diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/empty_vehicle_stacking_position/EmptyVehicleStackingPositionDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/empty_vehicle_stacking_position/EmptyVehicleStackingPositionDeviceDriver.java index 02651d076..71c7a7ef9 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/empty_vehicle_stacking_position/EmptyVehicleStackingPositionDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/empty_vehicle_stacking_position/EmptyVehicleStackingPositionDeviceDriver.java @@ -104,7 +104,7 @@ public class EmptyVehicleStackingPositionDeviceDriver extends AbstractOpcDeviceD number = this.itemProtocol.getItem_number(); container_type = this.itemProtocol.getItem_container_type(); task = this.itemProtocol.getItem_task(); - + iserror = this.itemProtocol.getIsError(); if (mode != last_mode) { this.setRequireSucess(false); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/empty_vehicle_stacking_position/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/empty_vehicle_stacking_position/ItemProtocol.java index adc0f2a0f..1a00b0d44 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/empty_vehicle_stacking_position/ItemProtocol.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/empty_vehicle_stacking_position/ItemProtocol.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.basedriver.empty_vehicle_stacking_position; +import cn.hutool.core.util.ObjectUtil; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.nl.acs.device.device_driver.standard_inspect.ItemDto; @@ -61,9 +62,15 @@ public class ItemProtocol { } Boolean isonline; + Boolean isError; public int getOpcIntegerValue(String protocol) { Integer value = this.driver.getIntegeregerValue(protocol); + if(ObjectUtil.isEmpty(value)){ + isError = true; + }else if (item_heartbeat.equals(protocol)){ + isError = false; + } if (value == null) { setIsonline(false); } else { diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_smart_plc_test/HailiangSmartplcTestDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_smart_plc_test/HailiangSmartplcTestDeviceDriver.java index 7cf39de57..7225e1268 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_smart_plc_test/HailiangSmartplcTestDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_smart_plc_test/HailiangSmartplcTestDeviceDriver.java @@ -104,7 +104,7 @@ public class HailiangSmartplcTestDeviceDriver extends AbstractOpcDeviceDriver im number = this.itemProtocol.getItem_number(); container_type = this.itemProtocol.getItem_container_type(); task = this.itemProtocol.getItem_task(); - + iserror = this.itemProtocol.isError; if (mode != last_mode) { this.setRequireSucess(false); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_smart_plc_test/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_smart_plc_test/ItemProtocol.java index 4ecd889ad..92986b51d 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_smart_plc_test/ItemProtocol.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_smart_plc_test/ItemProtocol.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.basedriver.hailiang_smart_plc_test; +import cn.hutool.core.util.ObjectUtil; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.nl.acs.device.device_driver.standard_inspect.ItemDto; @@ -65,9 +66,15 @@ public class ItemProtocol { } Boolean isonline; + Boolean isError; public int getOpcIntegerValue(String protocol) { Integer value = this.driver.getIntegeregerValue(protocol); + if(ObjectUtil.isEmpty(value)){ + isError = true; + }else if (item_heartbeat.equals(protocol)){ + isError = false; + } if (value == null) { setIsonline(false); } else { 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 8e1740ffa..2fc5e8dc6 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 @@ -167,6 +167,7 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple currentB = this.itemProtocol.getItem_currentB(); currentC = this.itemProtocol.getItem_currentC(); to_temperature = this.itemProtocol.getItem_to_temperature(); + iserror = this.itemProtocol.isError; if (door != last_door) { logServer.deviceExecuteLog(this.device_code, "", "", "信号door:" + last_door + "->" + door); } @@ -335,6 +336,9 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple move = "有托盘有货"; jo.put("hasGoods", true); } + if(error == 0 && iserror){ + message = "信号连接超时!"; + } jo.put("device_name", this.getDevice().getDevice_name()); jo.put("temperature", temperature); jo.put("finish", finish); @@ -350,6 +354,7 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple jo.put("move", move); jo.put("action", action); jo.put("task", this.getTask()); + jo.put("message", this.getMessage()); return jo; } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_device/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_device/ItemProtocol.java index 95e821503..658d7e9e7 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_device/ItemProtocol.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_device/ItemProtocol.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.basedriver.hongxiang_device; +import cn.hutool.core.util.ObjectUtil; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.nl.acs.device.device_driver.standard_inspect.ItemDto; @@ -123,9 +124,15 @@ public class ItemProtocol { } ; Boolean isonline; + Boolean isError; public int getOpcIntegerValue(String protocol) { Integer value = this.driver.getIntegeregerValue(protocol); + if(ObjectUtil.isEmpty(value)){ + isError = true; + }else if (item_heartbeat.equals(protocol)){ + isError = false; + } if (value == null) { setIsonline(false); } else { diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/indoor_manipulator/IndoorManipulatorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/indoor_manipulator/IndoorManipulatorDeviceDriver.java index f6ae2ec2b..70bce40a7 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/indoor_manipulator/IndoorManipulatorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/indoor_manipulator/IndoorManipulatorDeviceDriver.java @@ -138,6 +138,7 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple int last_is_wrapped = 0; Boolean isonline = true; + Boolean deviceStatus = false; int hasGoods = 0; String message = null; Boolean iserror = false; @@ -212,6 +213,7 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple tube_num = this.itemProtocol.getTube_num(); inflatableShaftVersion = this.itemProtocol.getInflatableShaftVersion(); is_wrapped = this.itemProtocol.getIs_wrapped(); + deviceStatus = this.itemProtocol.deviceStatus; if (to_onset != last_to_onset) { logServer.deviceExecuteLog(this.device_code, "", "", "信号to_onset:" + last_to_onset + "->" + to_onset); @@ -753,6 +755,13 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple if (this.requireSucess) { requireSucess = "1"; } + if(deviceStatus && error == 0){ + iserror = true; + message = "信号连接超时!"; + } + if(error == 0 && !deviceStatus){ + iserror = false; + } jo.put("requireSucess", requireSucess); if (this.getAction() == 2) { action = "反馈气胀轴尺寸"; diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/indoor_manipulator/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/indoor_manipulator/ItemProtocol.java index b9c2f3e12..b8aff5a0e 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/indoor_manipulator/ItemProtocol.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/indoor_manipulator/ItemProtocol.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.basedriver.indoor_manipulator; +import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import lombok.Data; import lombok.extern.slf4j.Slf4j; @@ -152,8 +153,15 @@ public class ItemProtocol { Boolean isonline; + Boolean deviceStatus = false; + public int getOpcIntegerValue(String protocol) { Integer value = this.driver.getIntegeregerValue(protocol); + if(ObjectUtil.isEmpty(value)){ + deviceStatus = true; + }else if(item_heartbeat.equals(protocol)){ + deviceStatus = false; + } if (value == null) { // log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); setIsonline(false); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/ItemProtocol.java index 261abb188..7c73d3e26 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/ItemProtocol.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/ItemProtocol.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.basedriver.oven_manipulator; +import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import lombok.Data; import lombok.extern.slf4j.Slf4j; @@ -40,6 +41,7 @@ public class ItemProtocol { //下发任务号 public static String item_to_task = "to_task"; + public Boolean device_status = false; private OvenGantryManipulatorDeviceDriver driver; @@ -104,6 +106,11 @@ public class ItemProtocol { public int getOpcIntegerValue(String protocol) { Integer value = this.driver.getIntegeregerValue(protocol); + if(ObjectUtil.isEmpty(value)){ + device_status = true; + }else if(item_heartbeat.equals(protocol)){ + device_status = false; + } if (value == null) { // log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); setIsonline(false); 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 86e9b7d11..f0ea29e13 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 @@ -123,6 +123,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i //行架机械手申请任务成功标识 boolean requireSucess = false; + public boolean deviceStatus = false; + private int instruction_finished_time_out; int branchProtocol = 0; @@ -172,6 +174,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i to_onset = this.itemProtocol.getTo_onset(); x_position = this.itemProtocol.getX_position(); y_position = this.itemProtocol.getY_position(); + deviceStatus = this.itemProtocol.getDevice_status(); + // if(heartbeat != last_heartbeat){ // logServer.deviceExecuteLog(this.device_code, "", "", "heartbeat:" + last_heartbeat + "->" + heartbeat); // } @@ -386,105 +390,107 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i } Instruction instruction = instructionService.findByTaskcodeAndStatus(taskDto.getTask_code()); - String start_device_code = instruction.getStart_device_code(); - String next_device_code = instruction.getNext_device_code(); - Device nextdevice = deviceAppService.findDeviceByCode(next_device_code); - Device startdevice = deviceAppService.findDeviceByCode(start_device_code); - PhotoelectricInspectionSiteDeviceDriver photoelectricInspectionSiteDeviceDriver; - HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; - StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; - if (startdevice.getDeviceDriver() instanceof PhotoelectricInspectionSiteDeviceDriver) { - photoelectricInspectionSiteDeviceDriver = (PhotoelectricInspectionSiteDeviceDriver) startdevice.getDeviceDriver(); - if (photoelectricInspectionSiteDeviceDriver.getMove() != 1) { - notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱对接位:" + photoelectricInspectionSiteDeviceDriver.getDevice_code() + "无货,无法下发指令!指令号:" + instruction.getInstruction_code(); - return false; + if(ObjectUtil.isNotEmpty(instruction)){ + String start_device_code = instruction.getStart_device_code(); + String next_device_code = instruction.getNext_device_code(); + Device nextdevice = deviceAppService.findDeviceByCode(next_device_code); + Device startdevice = deviceAppService.findDeviceByCode(start_device_code); + PhotoelectricInspectionSiteDeviceDriver photoelectricInspectionSiteDeviceDriver; + HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; + StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; + if (startdevice.getDeviceDriver() instanceof PhotoelectricInspectionSiteDeviceDriver) { + photoelectricInspectionSiteDeviceDriver = (PhotoelectricInspectionSiteDeviceDriver) startdevice.getDeviceDriver(); + if (photoelectricInspectionSiteDeviceDriver.getMove() != 1) { + notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱对接位:" + photoelectricInspectionSiteDeviceDriver.getDevice_code() + "无货,无法下发指令!指令号:" + instruction.getInstruction_code(); + return false; + } } - } - if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { - standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver(); - if (standardInspectSiteDeviceDriver.getMove() != 1) { - notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevice_code() + "无货,无法下发指令!指令号:" + instruction.getInstruction_code(); - return false; + if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { + standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver(); + if (standardInspectSiteDeviceDriver.getMove() != 1) { + notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevice_code() + "无货,无法下发指令!指令号:" + instruction.getInstruction_code(); + return false; + } } - } - if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { - hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver(); - if (hongXiangConveyorDeviceDriver.getMode() == 0 || hongXiangConveyorDeviceDriver.getMove() == 0) { - notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code() + "未联机或无货,无法下发指令!指令号:" + instruction.getInstruction_code(); - return false; + if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { + hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver(); + if (hongXiangConveyorDeviceDriver.getMode() == 0 || hongXiangConveyorDeviceDriver.getMove() == 0) { + notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code() + "未联机或无货,无法下发指令!指令号:" + instruction.getInstruction_code(); + return false; + } } - } - if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { - standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver(); - if (standardInspectSiteDeviceDriver.getMove() != 0) { - notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevice_code() + "有货,无法下发指令!指令号:" + instruction.getInstruction_code(); + if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { + standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver(); + if (standardInspectSiteDeviceDriver.getMove() != 0) { + notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevice_code() + "有货,无法下发指令!指令号:" + instruction.getInstruction_code(); + return false; + } + } + if (nextdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { + hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextdevice.getDeviceDriver(); + if (hongXiangConveyorDeviceDriver.getMode() == 0 || hongXiangConveyorDeviceDriver.getMove() == 1) { + notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code() + "未联机或者有货,无法下发指令!指令号:" + instruction.getInstruction_code(); + return false; + } + } + //判断关联的同一列烘箱设备是否都关门 都关门返回false,有一个不关门就返回true + boolean isCloseDoor = this.judgeCloseDoor(start_device_code, next_device_code); + //未关门结束 + if (isCloseDoor) { + notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位:" + start_device_code + ",放货位:" + next_device_code + ",存在关联的同一列烘箱设备未关门!指令号:" + instruction.getInstruction_code(); return false; } - } - if (nextdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { - hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextdevice.getDeviceDriver(); - if (hongXiangConveyorDeviceDriver.getMode() == 0 || hongXiangConveyorDeviceDriver.getMove() == 1) { - notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code() + "未联机或者有货,无法下发指令!指令号:" + instruction.getInstruction_code(); - return false; + instruction.setInstruction_status("1"); + 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("设备:" + startDevice.getDevice_code() + "未设置电气调度号!"); } - } - //判断关联的同一列烘箱设备是否都关门 都关门返回false,有一个不关门就返回true - boolean isCloseDoor = this.judgeCloseDoor(start_device_code, next_device_code); - //未关门结束 - if (isCloseDoor) { - notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位:" + start_device_code + ",放货位:" + next_device_code + ",存在关联的同一列烘箱设备未关门!指令号:" + instruction.getInstruction_code(); - return false; - } - instruction.setInstruction_status("1"); - 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("设备:" + startDevice.getDevice_code() + "未设置电气调度号!"); - } - if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))) { - throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!"); - } - String start_addr = startDevice.getExtraValue().get("address").toString(); - String next_addr = nextDevice.getExtraValue().get("address").toString(); - logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:" - + instruction.getInstruction_code() + ",指令起点:" + instruction.getStart_device_code() - + ",指令终点:" + instruction.getNext_device_code()); - this.writing("to_onset", start_addr); - this.writing("to_target", next_addr); - this.writing("to_task", instruction.getInstruction_code()); - this.writing("to_command", "1"); - if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { - hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver(); - 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 (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))) { + throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!"); } - } - if (nextdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { - hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextdevice.getDeviceDriver(); - 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); + String start_addr = startDevice.getExtraValue().get("address").toString(); + String next_addr = nextDevice.getExtraValue().get("address").toString(); + logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:" + + instruction.getInstruction_code() + ",指令起点:" + instruction.getStart_device_code() + + ",指令终点:" + instruction.getNext_device_code()); + this.writing("to_onset", start_addr); + this.writing("to_target", next_addr); + this.writing("to_task", instruction.getInstruction_code()); + this.writing("to_command", "1"); + if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { + hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver(); + 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(); + 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); + return true; } - this.setNow_steps_type(2); - this.setRequireSucess(true); - return true; } else { List taskDtoList = taskserver.queryTaskByDeviceCode(startDeviceCode); if (ObjectUtil.isNotEmpty(taskDtoList)) { @@ -560,8 +566,12 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i String route_plan_code = task.getRoute_plan_code(); String next_point_code = task.getNext_point_code(); String next_device_code = task.getNext_device_code(); + String put_device_code = task.getPut_device_code(); + String put_point_code = task.getPut_point_code(); Instruction instdto = new Instruction(); + instdto.setPut_device_code(put_device_code); + instdto.setPut_point_code(put_point_code); instdto.setInstruction_id(IdUtil.simpleUUID()); instdto.setRoute_plan_code(route_plan_code); instdto.setRemark(task.getRemark()); @@ -843,7 +853,13 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i } else if (now_steps_type == 5) { steps_type += "放货完成"; } - + if(deviceStatus && error == 0){ + iserror = true; + message = "信号连接超时!"; + } + if(error == 0 && !deviceStatus){ + iserror = false; + } jo.put("device_name", this.getDevice().getDevice_name()); jo.put("mode", mode); jo.put("move", move); @@ -1128,7 +1144,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i } } - if (nextDevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { + /*if (nextDevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextDevice.getDeviceDriver(); // hongXiangConveyorDeviceDriver.writing("to_close_door", "1"); @@ -1147,7 +1163,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i } } - } + }*/ this.writing("to_command", "5"); this.setNow_steps_type(6); this.setNow_steps_type(0); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paint_conveyor/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paint_conveyor/ItemProtocol.java index 8707e77ce..0098f0340 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paint_conveyor/ItemProtocol.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paint_conveyor/ItemProtocol.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.basedriver.paint_conveyor; +import cn.hutool.core.util.ObjectUtil; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.nl.acs.device.device_driver.standard_inspect.ItemDto; @@ -60,9 +61,15 @@ public class ItemProtocol { } Boolean isonline; + Boolean isError; public int getOpcIntegerValue(String protocol) { Integer value = this.driver.getIntegeregerValue(protocol); + if(ObjectUtil.isEmpty(value)){ + isError = true; + }else if (item_heartbeat.equals(protocol)){ + isError = false; + } if (value == null) { setIsonline(false); } else { diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paint_conveyor/PaintConveyorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paint_conveyor/PaintConveyorDeviceDriver.java index 64bca6768..2bc8ed208 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paint_conveyor/PaintConveyorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paint_conveyor/PaintConveyorDeviceDriver.java @@ -102,7 +102,7 @@ public class PaintConveyorDeviceDriver extends AbstractOpcDeviceDriver implement error = this.itemProtocol.getItem_error(); number = this.itemProtocol.getItem_number(); task = this.itemProtocol.getItem_task(); - + iserror = this.itemProtocol.isError; if (mode != last_mode) { this.setRequireSucess(false); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device/ItemProtocol.java index dd690e4e8..dded36ab5 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device/ItemProtocol.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device/ItemProtocol.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.basedriver.paper_tube_device; +import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import lombok.Data; import lombok.extern.slf4j.Slf4j; @@ -75,9 +76,15 @@ public class ItemProtocol { } Boolean isonline; + Boolean isError; public int getOpcIntegerValue(String protocol) { Integer value = this.driver.getIntegeregerValue(protocol); + if(ObjectUtil.isEmpty(value)){ + isError = true; + }else if (item_heartbeat.equals(protocol)){ + isError = false; + } if (value == null) { setIsonline(false); } else { diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device/PaperTubeConveyorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device/PaperTubeConveyorDeviceDriver.java index e0b5f3136..cf8706b15 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device/PaperTubeConveyorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device/PaperTubeConveyorDeviceDriver.java @@ -70,6 +70,7 @@ public class PaperTubeConveyorDeviceDriver extends AbstractOpcDeviceDriver imple int to_command =0; int to_target =0; String material = null; + String message = null; Boolean isonline = true; @@ -96,7 +97,6 @@ public class PaperTubeConveyorDeviceDriver extends AbstractOpcDeviceDriver imple @Override public void execute() { - String message = null; device_code = this.getDeviceCode(); heartbeat = this.itemProtocol.getHeartbeat(); @@ -107,7 +107,7 @@ public class PaperTubeConveyorDeviceDriver extends AbstractOpcDeviceDriver imple error = this.itemProtocol.getError(); to_command = this.itemProtocol.getTo_command(); to_target = this.itemProtocol.getTotarget(); - + iserror = this.itemProtocol.isError; if (mode != last_mode) { this.setRequireSucess(false); if (mode == 0) { @@ -137,9 +137,7 @@ public class PaperTubeConveyorDeviceDriver extends AbstractOpcDeviceDriver imple if(error > 0){ this.setIserror(true); } else { - if(error > 0){ - this.setIserror(false); - } + this.setIserror(false); } logServer.deviceExecuteLog(this.device_code, "", "", "信号out_finish:" + last_out_finish + "->" + out_finish); } @@ -217,6 +215,9 @@ public class PaperTubeConveyorDeviceDriver extends AbstractOpcDeviceDriver imple } else if (this.getMode() == 4) { mode = "出库中"; } + if(error == 0 && iserror){ + message = "信号连接超时!"; + } jo.put("device_name", this.getDevice().getDevice_name()); jo.put("mode", mode); jo.put("error", ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(this.getError()))); @@ -224,6 +225,8 @@ public class PaperTubeConveyorDeviceDriver extends AbstractOpcDeviceDriver imple jo.put("out_finish", out_finish); jo.put("material", material); jo.put("isOnline", this.getIsonline()); + jo.put("isError", iserror); + jo.put("message", message); return jo; } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device2/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device2/ItemProtocol.java index ed0b63e7b..fcb7c7206 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device2/ItemProtocol.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device2/ItemProtocol.java @@ -294,9 +294,14 @@ public class ItemProtocol { } Boolean isonline; - + Boolean isError; public int getOpcIntegerValue(String protocol) { Integer value = this.driver.getIntegeregerValue(protocol); + if(ObjectUtil.isEmpty(value)){ + isError = true; + }else if (item_heartbeat.equals(protocol)){ + isError = false; + } if (value == null) { setIsonline(false); } else { diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device2/PaperTubeConveyor2DeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device2/PaperTubeConveyor2DeviceDriver.java index 1360580fd..3e74f6042 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device2/PaperTubeConveyor2DeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device2/PaperTubeConveyor2DeviceDriver.java @@ -284,7 +284,7 @@ public class PaperTubeConveyor2DeviceDriver extends AbstractOpcDeviceDriver impl item_to_position1 = this.itemProtocol.getTo_position1(); item_to_position2 = this.itemProtocol.getTo_position2(); item_to_position3 = this.itemProtocol.getTo_position3(); - + iserror = this.itemProtocol.isError; //信号位置校验,记录日志 signal_verification(); @@ -754,10 +754,15 @@ public class PaperTubeConveyor2DeviceDriver extends AbstractOpcDeviceDriver impl map.put("z_qty11", this.getItem_qty11()); map.put("material12", this.getItem_material12()); map.put("z_qty12", this.getItem_qty12()); + map.put("isError", iserror); String requireSucess = "0"; if (this.requireSucess) { requireSucess = "1"; } + if(error == 0 && iserror){ + this.message = "信号连接超时!"; + } + map.put("message", message); map.put("requireSucess", requireSucess); map.put("driver_type", "conveyor"); JSONObject jo = new JSONObject(map); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/plugging_unplugging_machine/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/plugging_unplugging_machine/ItemProtocol.java index 3e10ab4de..7eda50492 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/plugging_unplugging_machine/ItemProtocol.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/plugging_unplugging_machine/ItemProtocol.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.basedriver.plugging_unplugging_machine; +import cn.hutool.core.util.ObjectUtil; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.nl.acs.device.device_driver.standard_inspect.ItemDto; @@ -59,9 +60,15 @@ public class ItemProtocol { } Boolean isonline; + Boolean isError; public int getOpcIntegerValue(String protocol) { Integer value = this.driver.getIntegeregerValue(protocol); + if(ObjectUtil.isEmpty(value)){ + isError = true; + }else if (item_heartbeat.equals(protocol)){ + isError = false; + } if (value == null) { // log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); setIsonline(false); 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 a72785729..17909e97d 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 @@ -104,6 +104,7 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv move = this.itemProtocol.getMove(); task1 = this.itemProtocol.getTask1(); to_command = this.itemProtocol.getToCommand(); + iserror = this.itemProtocol.isError; if (mode != last_mode) { this.requireSucess = false; diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/rgv/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/rgv/ItemProtocol.java index cc07cd5a9..74143393a 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/rgv/ItemProtocol.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/rgv/ItemProtocol.java @@ -1,6 +1,7 @@ package org.nl.acs.device_driver.basedriver.rgv; +import cn.hutool.core.util.ObjectUtil; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.nl.acs.device.device_driver.standard_inspect.ItemDto; @@ -65,11 +66,11 @@ public class ItemProtocol { } Boolean isonline; + Boolean isError; public float getOpcFloatValue(String protocol) { Float value = this.driver.getDoubleValue(protocol); if (value == null) { - // log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); setIsonline(false); } else { setIsonline(true); @@ -80,6 +81,11 @@ public class ItemProtocol { } public int getOpcIntegerValue(String protocol) { Integer value = this.driver.getIntegeregerValue(protocol); + if(ObjectUtil.isEmpty(value)){ + isError = true; + }else if (item_heartbeat.equals(protocol)){ + isError = false; + } if (value == null) { // log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); setIsonline(false); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/rgv/RgvDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/rgv/RgvDeviceDriver.java index 30ee81d0a..3e22f1ac2 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/rgv/RgvDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/rgv/RgvDeviceDriver.java @@ -57,6 +57,7 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr @Autowired ParamService paramService = SpringContextHolder.getBean(ParamServiceImpl.class); + int heartbeat = 0; int mode = 0; int last_mode = 0; int error = 0; @@ -108,6 +109,8 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr qty2 = this.itemProtocol.getQty2(); task = this.itemProtocol.getTask(); to_command = this.itemProtocol.getToCommand(); + heartbeat = this.itemProtocol.getHeartbeat(); + iserror = this.itemProtocol.isError; if (mode != last_mode) { this.requireSucess = false; @@ -320,8 +323,21 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr move2 = "无货"; jo.put("hasGoods", false); } else if (this.getMove1() == 1 || this.getMove2() == 1) { + if(this.getMove1() == 1){ + move1 = "有货"; + }else if(this.getMove1() == 0){ + move1 = "无货"; + } + if(this.getMove2() == 1){ + move2 = "有货"; + }else if(this.getMove2() == 0){ + move2 = "无货"; + } jo.put("hasGoods", true); } + if(error == 0 && iserror){ + message = "信号连接超时!"; + } jo.put("device_name", this.getDevice().getDevice_name()); jo.put("mode", mode); jo.put("move1", move1); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/ItemProtocol.java index fe28d286b..55d6d0c6a 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/ItemProtocol.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/ItemProtocol.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.basedriver.siemens_conveyor; +import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import lombok.Data; import lombok.extern.slf4j.Slf4j; @@ -103,9 +104,15 @@ public class ItemProtocol { Boolean isonline; + Boolean deviceStatus = false; public int getOpcIntegerValue(String protocol) { Integer value = this.driver.getIntegeregerValue(protocol); + if(ObjectUtil.isEmpty(value)){ + deviceStatus = true; + }else if (item_heartbeat.equals(protocol)){ + deviceStatus = false; + } if (value == null) { // log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); setIsonline(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 9ac8f9e9c..eceef6cb8 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 @@ -128,6 +128,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme int hasGoods = 0; String message = null; Boolean iserror = false; + Boolean deviceStatus = false; String hand_barcode = null; @@ -186,6 +187,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme to_length = this.itemProtocol.getTo_length(); to_weight = this.itemProtocol.getTo_weight(); to_height = this.itemProtocol.getTo_height(); + deviceStatus = this.itemProtocol.deviceStatus; // if(heartbeat != last_heartbeat){ // logServer.deviceExecuteLog(this.device_code, "", "", "heartbeat:" + last_heartbeat + "->" + heartbeat); // } @@ -611,7 +613,12 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme move = "有托盘有货"; jo.put("hasGoods", true); } - + if(deviceStatus){ + iserror = true; + } + if(error == 0 && !deviceStatus){ + iserror = false; + } if (this.carrier_direction == 1) { carrier_direction = "正转"; } else if (this.carrier_direction == 2) { @@ -621,6 +628,9 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme if (this.requireSucess) { requireSucess = "1"; } + if(error == 0 && iserror){ + message = "信号连接超时!"; + } jo.put("device_name", this.getDevice().getDevice_name()); jo.put("mode", mode); jo.put("move", move); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_ckk/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_ckk/ItemProtocol.java index 755d4bc2e..516f7edaf 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_ckk/ItemProtocol.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_ckk/ItemProtocol.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.basedriver.siemens_conveyor_ckk; +import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import lombok.Data; import lombok.extern.slf4j.Slf4j; @@ -86,9 +87,15 @@ public class ItemProtocol { } Boolean isonline; + Boolean isError; public int getOpcIntegerValue(String protocol) { Integer value = this.driver.getIntegeregerValue(protocol); + if(ObjectUtil.isEmpty(value)){ + isError = true; + }else if (item_heartbeat.equals(protocol)){ + isError = false; + } if (value == null) { // log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); setIsonline(false); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_ckk/SiemensConveyorCkkDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_ckk/SiemensConveyorCkkDeviceDriver.java index fc05249d2..c7ed79a40 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_ckk/SiemensConveyorCkkDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_ckk/SiemensConveyorCkkDeviceDriver.java @@ -166,6 +166,7 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl to_command = this.itemProtocol.getTo_command(); to_target = this.itemProtocol.getTo_target(); to_task = this.itemProtocol.getTo_task(); + iserror = this.itemProtocol.isError; // if(heartbeat != last_heartbeat){ // logServer.deviceExecuteLog(this.device_code, "", "", "heartbeat:" + last_heartbeat + "->" + heartbeat); // } @@ -462,6 +463,9 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl if (this.requireSucess) { requireSucess = "1"; } + if(error == 0 && iserror){ + message = "信号连接超时!"; + } jo.put("device_name", this.getDevice().getDevice_name()); jo.put("mode", mode); jo.put("move", move); @@ -470,8 +474,8 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl jo.put("last_task", last_task); jo.put("task_code", task_code); jo.put("hand_barcode", hand_barcode); - jo.put("barcode", this.getMove() == 0 ? null : instructionService.findByCodeFromCache(String.valueOf(task)) == null ? null : instructionService.findByCodeFromCache(String.valueOf(task)).getVehicle_code()); -// jo.put("last_task", last_task); + jo.put("barcode", this.getMove() == 0 ? null : instructionService.findByCodeFromCache(String.valueOf(task)) == null + ? null : instructionService.findByCodeFromCache(String.valueOf(task)).getVehicle_code()); jo.put("inst_message", this.inst_message); jo.put("last_inst_message", this.last_inst_message); jo.put("isOnline", this.getIsonline()); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_labeling/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_labeling/ItemProtocol.java index baa5e9a75..2e9ffe1b9 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_labeling/ItemProtocol.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_labeling/ItemProtocol.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.basedriver.siemens_conveyor_labeling; +import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import lombok.Data; import lombok.extern.slf4j.Slf4j; @@ -81,9 +82,15 @@ public class ItemProtocol { Boolean isonline; + Boolean isError; public int getOpcIntegerValue(String protocol) { Integer value = this.driver.getIntegeregerValue(protocol); + if(ObjectUtil.isEmpty(value)){ + isError = true; + }else if (item_heartbeat.equals(protocol)){ + isError = false; + } if (value == null) { // log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); setIsonline(false); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_labeling/SiemensConveyorLabelingDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_labeling/SiemensConveyorLabelingDeviceDriver.java index 3400071d4..1135ab5ae 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_labeling/SiemensConveyorLabelingDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_labeling/SiemensConveyorLabelingDeviceDriver.java @@ -158,6 +158,7 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver task = this.itemProtocol.getTask(); weight = this.itemProtocol.getWeight(); heartbeat = this.itemProtocol.getHeartbeat(); + iserror = this.itemProtocol.isError; // if(heartbeat != last_heartbeat){ // logServer.deviceExecuteLog(this.device_code, "", "", "heartbeat:" + last_heartbeat + "->" + heartbeat); // } @@ -455,7 +456,9 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver if (this.requireSucess) { requireSucess = "1"; } - + if(error == 0 && iserror){ + message = "信号连接超时!"; + } jo.put("device_name", this.getDevice().getDevice_name()); jo.put("mode", mode); jo.put("move", move); @@ -464,7 +467,8 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver jo.put("isOnline", this.getIsonline()); jo.put("error", ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(this.getError()))); jo.put("isError", this.getIserror()); - jo.put("barcode", this.getMove() == 0 ? null : instructionService.findByCodeFromCache(String.valueOf(task)) == null ? vehicle_code : instructionService.findByCodeFromCache(String.valueOf(task)).getVehicle_code()); + jo.put("barcode", this.getMove() == 0 ? null : instructionService.findByCodeFromCache(String.valueOf(task)) == null + ? vehicle_code : instructionService.findByCodeFromCache(String.valueOf(task)).getVehicle_code()); jo.put("message", this.getMessage()); jo.put("is_click", true); jo.put("requireSucess", requireSucess); 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 index 9411bbba3..d889e9bd1 100644 --- 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 @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.basedriver.siemens_onefloor_agv_conveyor; +import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import lombok.Data; import lombok.extern.slf4j.Slf4j; @@ -87,9 +88,15 @@ public class ItemProtocol { Boolean isonline; + Boolean isError; public int getOpcIntegerValue(String protocol) { Integer value = this.driver.getIntegeregerValue(protocol); + if(ObjectUtil.isEmpty(value)){ + isError = true; + }else if (item_heartbeat.equals(protocol)){ + isError = false; + } if (value == null) { // log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); setIsonline(false); 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 index b2e02696e..c1103c6b3 100644 --- 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 @@ -161,6 +161,7 @@ public class SiemensOneFloorAGVConveyorDeviceDriver extends AbstractOpcDeviceDri to_command = this.itemProtocol.getTo_command(); to_target = this.itemProtocol.getTo_target(); to_task = this.itemProtocol.getTo_task(); + iserror = this.itemProtocol.isError; if (last_mode != mode) { JSONObject param = new JSONObject(); param.put("device_code", this.device_code); @@ -348,6 +349,9 @@ public class SiemensOneFloorAGVConveyorDeviceDriver extends AbstractOpcDeviceDri if (this.requireSucess) { requireSucess = "1"; } + if(error == 0 && iserror){ + message = "信号连接超时!"; + } jo.put("device_name", this.getDevice().getDevice_name()); jo.put("mode", mode); jo.put("move", move); 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 c0976344d..48fd270ce 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 @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.basedriver.slit_two_manipulator; +import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import lombok.Data; import lombok.extern.slf4j.Slf4j; @@ -163,9 +164,15 @@ public class ItemProtocol { } Boolean isonline; + Boolean isError; public int getOpcIntegerValue(String protocol) { Integer value = this.driver.getIntegeregerValue(protocol); + if(ObjectUtil.isEmpty(value)){ + isError = true; + }else if (item_heartbeat.equals(protocol)){ + isError = false; + } if (value == null) { // log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); setIsonline(false); 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 72d07ed55..4d5d6ccd0 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 @@ -213,6 +213,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl to_target2 = this.itemProtocol.getTo_target2(); to_onset1 = this.itemProtocol.getTo_onset1(); to_onset2 = this.itemProtocol.getTo_onset2(); + iserror = this.itemProtocol.isError; if (to_command1 != last_to_command1) { logServer.deviceExecuteLog(this.device_code, "", "", "信号to_command1:" + last_to_command1 + "->" + to_command1); @@ -1216,8 +1217,10 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl if (this.requireSucess) { requireSucess = "1"; } + if(error == 0 && iserror){ + type = 4; + } jo.put("requireSucess", requireSucess); - jo.put("device_name", this.getDevice().getDevice_name()); jo.put("mode", mode); jo.put("status", status); @@ -1278,6 +1281,8 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl map.put("8", "双任务后工位放货完成"); map.put("9", "双任务前工位允许放货"); map.put("10", "双任务前工位放货完成"); + }else if(type == 4){ + return "信号连接超时!"; } else { return "未执行任务"; } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control/ItemProtocol.java index 40c8e9183..85fdcc9e3 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control/ItemProtocol.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control/ItemProtocol.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.basedriver.standard_conveyor_control; +import cn.hutool.core.util.ObjectUtil; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.nl.acs.device.device_driver.standard_inspect.ItemDto; @@ -80,9 +81,15 @@ public class ItemProtocol { } Boolean isonline; + Boolean isError; public int getOpcIntegerValue(String protocol) { Integer value = this.driver.getIntegeregerValue(protocol); + if(ObjectUtil.isEmpty(value)){ + isError = true; + }else if (item_heartbeat.equals(protocol)){ + isError = false; + } if (value == null) { // log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); setIsonline(false); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control/StandardCoveyorControlDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control/StandardCoveyorControlDeviceDriver.java index 499346239..bed3a27ba 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control/StandardCoveyorControlDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control/StandardCoveyorControlDeviceDriver.java @@ -151,6 +151,7 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver task = this.itemProtocol.getTask(); hasGoods = this.itemProtocol.getMove(); operation_type = this.itemProtocol.getOperation_type(); + iserror = this.itemProtocol.isError; if (mode != last_mode) { } if (move != last_move) { @@ -463,6 +464,9 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver move = "有托盘有货"; jo.put("hasGoods", true); } + if(error == 0 && iserror){ + message = "信号连接超时!"; + } jo.put("device_name", this.getDevice().getDevice_name()); jo.put("mode", mode); jo.put("move", move); @@ -471,6 +475,7 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver jo.put("error", this.getError()); jo.put("isError", this.getIserror()); jo.put("task", this.getTask()); + jo.put("message", message); return jo; } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_plcscanner/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_plcscanner/ItemProtocol.java index 7b2de419a..86a95cb6b 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_plcscanner/ItemProtocol.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_plcscanner/ItemProtocol.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_plcscanner; +import cn.hutool.core.util.ObjectUtil; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.nl.acs.device.device_driver.standard_inspect.ItemDto; @@ -97,9 +98,15 @@ public class ItemProtocol { } Boolean isonline; + Boolean isError; public int getOpcIntegerValue(String protocol) { Integer value = this.driver.getIntegeregerValue(protocol); + if(ObjectUtil.isEmpty(value)){ + isError = true; + }else if (item_heartbeat.equals(protocol)){ + isError = false; + } if (value == null) { // log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); setIsonline(false); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_plcscanner/StandardCoveyorControlWithPlcScannerDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_plcscanner/StandardCoveyorControlWithPlcScannerDeviceDriver.java index e459f504b..68b4bc87d 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_plcscanner/StandardCoveyorControlWithPlcScannerDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_plcscanner/StandardCoveyorControlWithPlcScannerDeviceDriver.java @@ -162,6 +162,7 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp direction = this.itemProtocol.getDirection(); hasGoods = this.itemProtocol.getMove(); barcode = this.itemProtocol.getBarcode(); + iserror = this.itemProtocol.isError; if (mode != last_mode) { this.setRequireSucess(false); } @@ -872,6 +873,9 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp if (this.applySucess) { applySucess = "1"; } + if(error == 0 && iserror){ + message = "信号连接超时!"; + } jo.put("requireSucess", requireSucess); jo.put("applySucess", applySucess); jo.put("driver_type", "standard_conveyor_control_with_scanner"); @@ -884,6 +888,7 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp jo.put("error", this.getError()); jo.put("isError", this.getIserror()); jo.put("task", this.getTask()); + jo.put("message", message); return jo; } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/ItemProtocol.java index c887e46e5..7903b43cc 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/ItemProtocol.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/ItemProtocol.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner; +import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import lombok.Data; import lombok.extern.slf4j.Slf4j; @@ -112,9 +113,15 @@ public class ItemProtocol { } Boolean isonline; + Boolean isError; public int getOpcIntegerValue(String protocol) { Integer value = this.driver.getIntegeregerValue(protocol); + if(ObjectUtil.isEmpty(value)){ + isError = true; + }else if (item_heartbeat.equals(protocol)){ + isError = false; + } if (value == null) { // log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); setIsonline(false); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java index 23a9448d5..0e19aa287 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java @@ -225,6 +225,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe to_target = this.itemProtocol.getTo_target(); to_task = this.itemProtocol.getTo_task(); weight = this.itemProtocol.getWeight(); + iserror = this.itemProtocol.isError; if (to_command != last_to_command) { logServer.deviceExecuteLog(this.device_code, "", "", "信号to_command:" + last_to_command + "->" + to_command); @@ -1104,6 +1105,9 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe move = "有托盘有货"; jo.put("hasGoods", true); } + if(error == 0 && iserror){ + message = "信号连接超时!"; + } jo.put("device_name", this.getDevice().getDevice_name()); jo.put("driver_type", "standard_conveyor_control_with_scanner"); jo.put("mode", mode); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/ItemProtocol.java index 220afccdd..f54e7964c 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/ItemProtocol.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/ItemProtocol.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.basedriver.standard_inspect_site; +import cn.hutool.core.util.ObjectUtil; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.nl.acs.device.device_driver.standard_inspect.ItemDto; @@ -69,9 +70,15 @@ public class ItemProtocol { } Boolean isonline; + Boolean isError; public int getOpcIntegerValue(String protocol) { Integer value = this.driver.getIntegeregerValue(protocol); + if(ObjectUtil.isEmpty(value)){ + isError = true; + }else if (item_heartbeat.equals(protocol)){ + isError = false; + } if (value == null) { // log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); setIsonline(false); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java index a0603963b..f70ad76b3 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java @@ -57,6 +57,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp //有货标记 protected boolean has_goods_tag = false; + int heartbeat = 0; int mode = 0; int error = 0; int move = 0; @@ -133,11 +134,13 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp try { device_code = this.getDeviceCode(); mode = this.itemProtocol.getMode(); + heartbeat = this.itemProtocol.getHeartbeat(); error = this.itemProtocol.getError(); move = this.itemProtocol.getMove(); action = this.itemProtocol.getAction(); task = this.itemProtocol.getTask(); hasGoods = this.itemProtocol.getMove(); + iserror = this.itemProtocol.isError; if (mode != last_mode) { logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode + "复位请求标记"); @@ -232,6 +235,9 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp move = "有托盘有货"; jo.put("hasGoods", true); } + if(error == 0 && iserror){ + message = "信号连接超时!"; + } jo.put("device_name", this.getDevice().getDevice_name()); jo.put("mode", mode); jo.put("move", move); @@ -242,6 +248,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp jo.put("task", this.getTask()); jo.put("is_click", true); jo.put("is_force", this.getIs_force()); + jo.put("message", message); return jo; } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/OpcDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/OpcDeviceDriver.java index b51132023..4f4366955 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/OpcDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/OpcDeviceDriver.java @@ -54,12 +54,14 @@ public interface OpcDeviceDriver extends DeviceDriver { @Override Device getDevice(); - default String getOpcPlc() { return this.getDevice().getOpc_plc_code(); } default Integer getIntegeregerValue(String protocol) { + if("heartbeat".equals(protocol) && this.getValue(protocol)==null){ + return null; + } Object value = this.getValue(protocol)==null?"0":this.getValue(protocol); return Integer.parseInt(value.toString()); } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java index ecb833cfc..ca03a80d9 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java @@ -413,6 +413,34 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu // 0为输送、立库任务 1 1楼叉车系统 2 2楼1区域AGV系统 3 2楼2区域AGV系统 if (!StrUtil.equals(task.getAgv_system_type(), "0") && ObjectUtil.isNotEmpty(task.getAgv_system_type())) { + if(StrUtil.isBlank(dto.getAgv_inst_type())){ + String agv_system_type = task.getAgv_system_type(); + String task_type = task.getTask_type(); + if (!StrUtil.equals(agv_system_type, "1")) { + // task_type + //1、生箔; Itype=1:取空,取满,放空,放满; + //2、分切 Itype=3取满、取空、放满、放空; + //3、普通任务 Itype=2:取货、放货; + //4、叉车任务 + //5、输送任务 + //6、行架 + //7、立库 + if (StrUtil.equals(task_type, "1")) { + dto.setAgv_inst_type("1"); + } else if (StrUtil.equals(task_type, "3")) { + dto.setAgv_inst_type("2"); + } else if (StrUtil.equals(task_type, "2")) { + dto.setAgv_inst_type("3"); + } else if (StrUtil.equals(task_type, "8")) { + dto.setAgv_inst_type("2"); + } else { + log.info("未找到对应的AGV指令类型,任务号:" + task.getTask_code() + ",task_type:" + task.getTask_type()) ; + } + } else { + dto.setAgv_inst_type("4"); + } + dto.setAgv_system_type(task.getAgv_system_type()); + } NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class); log.warn("下发AGV指令数据,"+ "指令号:" + dto.getInstruction_code() + ",AGV系统类型:"+ dto.getAgv_system_type() + ",AGV指令类型:" + dto.getInstruction_type() ); 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 7d2895ea1..02807c8c6 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 @@ -198,6 +198,9 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC if (true) { this.logItemChanged(itemId, accessor_value, value, itemDto); } + if(ObjectUtil.isEmpty(value)){ + accessor_value.removeValue(itemId); + } if(!ObjectUtil.isEmpty(value)){ accessor_value.setValue(itemId, value); } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/udw/UnifiedDataAccessor.java b/acs/nladmin-system/src/main/java/org/nl/acs/udw/UnifiedDataAccessor.java index 559373f55..d5b82003a 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/udw/UnifiedDataAccessor.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/udw/UnifiedDataAccessor.java @@ -9,6 +9,8 @@ public interface UnifiedDataAccessor { void setValue(String key, Object value); + void removeValue(String key); + UnifiedData getUnifiedData(String key); List getHistoryUnifiedData(String key); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/udw/service/impl/UnifiedDataAccessorImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/udw/service/impl/UnifiedDataAccessorImpl.java index 995ab9aa3..d7756d732 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/udw/service/impl/UnifiedDataAccessorImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/udw/service/impl/UnifiedDataAccessorImpl.java @@ -33,6 +33,10 @@ public class UnifiedDataAccessorImpl implements UnifiedDataAccessor { this.unifiedDataAppService.setValue(this.unified_key, key, value); } + public void removeValue(String key) { + this.unifiedDataAppService.removeValue(this.unified_key, key); + } + public void setValueWithPersistence(String key, Object value) { this.unifiedDataAppService.setValueWithPersistence(this.unified_key, key, value); } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/rest/StructivtController.java b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/rest/StructivtController.java index 27aa68b76..bd0b2b469 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/rest/StructivtController.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/rest/StructivtController.java @@ -1,6 +1,7 @@ package org.nl.wms.basedata.st.rest; +import cn.dev33.satoken.annotation.SaIgnore; import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -12,7 +13,9 @@ import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.Map; @@ -98,10 +101,16 @@ public class StructivtController { @PostMapping("/save") @Log("保存") - public ResponseEntity save(@RequestBody JSONObject whereJson) { structivtService.save(whereJson); return new ResponseEntity<>(HttpStatus.OK); } + @PostMapping("/importExcel") + @SaIgnore + public ResponseEntity importExcel(@RequestParam("file") MultipartFile file, HttpServletRequest request) { + structivtService.importExcel(file, request); + return new ResponseEntity<>(HttpStatus.OK); + } + } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/service/StructivtService.java b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/service/StructivtService.java index 2f0f6131d..15db8d5f4 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/service/StructivtService.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/service/StructivtService.java @@ -4,7 +4,9 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import org.nl.wms.basedata.st.service.dto.StructivtDto; import org.springframework.data.domain.Pageable; +import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.List; @@ -81,4 +83,6 @@ public interface StructivtService { void download(Map map, HttpServletResponse response, String[] product_area, String[] ivt_flag) throws IOException; void save(JSONObject whereJson); + + void importExcel(MultipartFile file, HttpServletRequest request); } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/service/impl/StructivtServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/service/impl/StructivtServiceImpl.java index 1b46a3387..a37c84e7a 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/service/impl/StructivtServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/service/impl/StructivtServiceImpl.java @@ -6,6 +6,9 @@ import cn.hutool.core.map.MapUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; +import cn.hutool.poi.excel.ExcelReader; +import cn.hutool.poi.excel.ExcelUtil; +import com.alibaba.excel.EasyExcel; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; @@ -23,9 +26,12 @@ import org.nl.wms.basedata.st.service.dto.StructivtDto; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.io.InputStream; import java.util.*; /** @@ -329,4 +335,34 @@ public class StructivtServiceImpl implements StructivtService { WQLObject.getWQLObject("st_ivt_structivt").update(jsonObject, "stockrecord_id = '" + whereJson.getString("stockrecord_id") + "'"); } + @Override + public void importExcel(MultipartFile file, HttpServletRequest request) { + // 1.获取上传文件输入流 + InputStream inputStream = null; + try { + inputStream = file.getInputStream(); + } catch (Exception e) { + e.printStackTrace(); + } + + ExcelReader excelReader = ExcelUtil.getReader(inputStream); + List> read = excelReader.read(1, excelReader.getRowCount()); + // 循环获取的数据 + for (int i = 0; i < read.size(); i++) { + List list = read.get(i); + String container_name = list.get(0).toString(); + String remark = list.get(1).toString(); + + if (StrUtil.isEmpty(container_name) || StrUtil.isEmpty(remark)) { + continue; + } + + JSONObject ivt_jo = WQLObject.getWQLObject("st_ivt_structivt").query("pcsn = '" + container_name + "'").uniqueResult(0); + if (ObjectUtil.isEmpty(ivt_jo)) { + continue; + } + ivt_jo.put("remark", remark); + WQLObject.getWQLObject("st_ivt_structivt").update(ivt_jo); + } + } } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/BakingServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/BakingServiceImpl.java index 77bf45ed3..4ad3e5bce 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/BakingServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/BakingServiceImpl.java @@ -19,6 +19,7 @@ import org.nl.modules.wql.util.SpringContextHolder; import org.nl.system.service.param.impl.SysParamServiceImpl; import org.nl.wms.basedata.st.service.impl.UserAreaServiceImpl; import org.nl.wms.ext.acs.service.impl.WmsToAcsServiceImpl; +import org.nl.wms.ext.mes.service.impl.LmsToMesServiceImpl; import org.nl.wms.pda.mps.eum.RegionTypeEnum; import org.nl.wms.pda.mps.service.BakingService; import org.nl.wms.sch.tasks.CutConveyorTask; @@ -29,6 +30,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.HashMap; + @Service @RequiredArgsConstructor @Slf4j @@ -383,10 +386,33 @@ public class BakingServiceImpl implements BakingService { if (ObjectUtil.isEmpty(point_code2)) { throw new BadRequestException("没有无货且没有任务的点位类型为出箱的烘箱对接位!"); } + + // 2.找冷却区空货位 + JSONObject map2 = new JSONObject(); + map2.put("flag", "2"); + map2.put("product_area", jsonHotIvt.getString("product_area")); + map2.put("point_location", jsonHotIvt.getString("point_location")); + + JSONObject jsonCooIvt = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map2).process().uniqueResult(0); + // 如果为空 + if (ObjectUtil.isEmpty(jsonCooIvt)) { + if (StrUtil.equals(jsonHotIvt.getString("point_location"), "0")) { + map2.put("point_location", "1"); + } + if (StrUtil.equals(jsonHotIvt.getString("point_location"), "1")) { + map2.put("point_location", "0"); + } + jsonCooIvt = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map2).process().uniqueResult(0); + } + if (ObjectUtil.isEmpty(jsonCooIvt)) { + throw new BadRequestException("冷却区空位不足"); + } + // 3.创建任务 JSONObject param = new JSONObject(); param.put("point_code1", point_code1); param.put("point_code2", point_code2); + param.put("point_code3", jsonCooIvt.getString("full_point_code")); param.put("material_code", jsonHotIvt.getString("container_name")); param.put("product_area", jsonHotIvt.getString("product_area")); OutHotTask outHotTask = new OutHotTask(); @@ -430,13 +456,13 @@ public class BakingServiceImpl implements BakingService { @Override @Transactional(rollbackFor = Exception.class) public JSONObject inCoolIvt(JSONObject whereJson) { - WQLObject pointTab = WQLObject.getWQLObject("SCH_BASE_Point"); // 点位点 + WQLObject pointTab = WQLObject.getWQLObject("st_ivt_coolpointivt"); // 点位点 WQLObject coolTab = WQLObject.getWQLObject("ST_IVT_CoolRegionIO"); // 冷却区出入表 WQLObject rawTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); // 生箔工单表 WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase"); // 物料表 - String point_code1 = whereJson.getString("point_code"); // 暂存位:起点 + String point_code1 = whereJson.getString("point_code"); // 冷却区点位:起点 String container_name = whereJson.getString("container_name"); // 母卷号 //获取人员对应的区域 @@ -467,15 +493,16 @@ public class BakingServiceImpl implements BakingService { throw new BadRequestException("该母卷在MES上未进行决策入半成品库,不允许进行入冷却操作!"); } - // 1.获取此暂存位的生产区域和上下位置 - JSONObject jsonPoint = pointTab.query("point_code = '" + point_code1 + "'").uniqueResult(0); + JSONObject jsonPoint = pointTab.query("full_point_code = '" + point_code1 + "'").uniqueResult(0); if (ObjectUtil.isEmpty(jsonPoint)) { - throw new BadRequestException("请扫描点位类型为出箱的烘箱对接位!"); + throw new BadRequestException("请扫描冷却区满轴点位编码!"); } if (!in_area_id.contains(jsonPoint.getString("product_area"))) { throw new BadRequestException("当前登录人员暂无【" + jsonPoint.getString("product_area") + "】操作权限"); } + + /* // 1.获取此暂存位的生产区域和上下位置 // 2.找冷却区空货位 JSONObject map = new JSONObject(); map.put("flag", "2"); @@ -507,9 +534,9 @@ public class BakingServiceImpl implements BakingService { InCoolIvtTask inCoolIvtTask = new InCoolIvtTask(); String task_id = inCoolIvtTask.createTask(param); - +*/ // 生成冷却区出入表 - String currentUserId = SecurityUtils.getCurrentUserId(); + /*String currentUserId = SecurityUtils.getCurrentUserId(); String currentUsername = SecurityUtils.getCurrentUsername(); JSONObject jsonRaw = rawTab.query("container_name = '" + container_name + "' and is_delete = '0'").uniqueResult(0); @@ -540,7 +567,44 @@ public class BakingServiceImpl implements BakingService { jsonCool.put("confirm_optid", currentUserId); jsonCool.put("confirm_optname", currentUsername); jsonCool.put("confirm_time", DateUtil.now()); - coolTab.insert(jsonCool); + coolTab.insert(jsonCool);*/ + + WQLObject ivtTab = WQLObject.getWQLObject("ST_IVT_CoolPointIvt"); // 冷却区库存表 + JSONObject jsonIvt = ivtTab.query("full_point_code ='" + point_code1 + "'").uniqueResult(0); + // 更新冷却库存状态 + jsonIvt.put("full_point_status", "02"); + jsonIvt.put("cool_ivt_status", "04"); + jsonIvt.put("instorage_time", DateUtil.now()); + jsonIvt.put("container_name", raw_jo.getString("container_name")); + jsonIvt.put("workorder_id", raw_jo.getString("workorder_id")); + jsonIvt.put("ivt_qty", raw_jo.getString("qty")); + ivtTab.update(jsonIvt); + + + // 将入冷却信息发送给mes + JSONObject param = new JSONObject(); + String userName = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_USERNAME").getValue(); + String passWord = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_PASSWORD").getValue(); + param.put("iContainerName", container_name); + param.put("iArrivalTime", DateUtil.now()); + param.put("iWarehouse", 2); + param.put("UserName", userName); + param.put("PassWord", passWord); + + //判断该接口是否需要回传 + JSONObject back_jo = WQLObject.getWQLObject("MD_PB_InterfaceBack").query("interface_name = 'momRollSemiFGInboundComplete'").uniqueResult(0); + if (ObjectUtil.isNotEmpty(back_jo) && "1".equals(back_jo.getString("is_back"))) { + String product_area = back_jo.getString("product_area"); + if (StrUtil.isNotEmpty(product_area) && product_area.contains(jsonPoint.getString("product_area"))) { + new LmsToMesServiceImpl().momRollSemiFGInboundComplete(param); + } + } + + //将该母卷的入冷却标识改为0 + HashMap map = new HashMap<>(); + map.put("is_instor", "0"); + WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").update(map, "container_name = '" + container_name + "'"); + log.info("母卷:" + container_name + "对应的入冷却任务完成,请求入半成品库标识改为0"); JSONObject result = new JSONObject(); result.put("message", "操作成功!"); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/FeedingServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/FeedingServiceImpl.java index f24a94a17..93b7fe801 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/FeedingServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/FeedingServiceImpl.java @@ -361,40 +361,90 @@ public class FeedingServiceImpl implements FeedingService { if (StrUtil.isEmpty(point_code)) { throw new BadRequestException("输入的点位不能为空!"); } + String type = form.getString("type"); - //查询对应的分切点位是否存在 - JSONObject cut_jo = WQLObject.getWQLObject("st_ivt_cutpointivt").query("empty_point_code = '" + point_code + "'").uniqueResult(0); - if (ObjectUtil.isEmpty(cut_jo)) { - throw new BadRequestException("请输入或者扫码分切区域的空轴点位!"); - } - if (StrUtil.equals("01", cut_jo.getString("empty_point_status"))) { - throw new BadRequestException("该点位库存状态不存在空轴!"); + //空轴送回 + if (type.equals("1")) { + //查询对应的分切点位是否存在 + JSONObject cut_jo = WQLObject.getWQLObject("st_ivt_cutpointivt").query("empty_point_code = '" + point_code + "'").uniqueResult(0); + if (ObjectUtil.isEmpty(cut_jo)) { + throw new BadRequestException("请输入或者扫码分切区域的空轴点位!"); + } + if (StrUtil.equals("01", cut_jo.getString("empty_point_status"))) { + throw new BadRequestException("该点位库存状态不存在空轴!"); + } + + // 2.找冷却区空货位 + JSONObject map = new JSONObject(); + map.put("flag", "2"); + map.put("product_area", cut_jo.getString("product_area")); + map.put("point_location", "0"); + + JSONObject jsonCooIvt = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().uniqueResult(0); + // 如果为空 + if (ObjectUtil.isEmpty(jsonCooIvt)) { + map.put("point_location", "1"); + jsonCooIvt = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().uniqueResult(0); + } + if (ObjectUtil.isEmpty(jsonCooIvt)) { + throw new BadRequestException("冷却区空位不足"); + } + + // 3.创建任务 + JSONObject param = new JSONObject(); + param.put("point_code1", point_code); + param.put("point_code2", jsonCooIvt.getString("empty_point_code")); + param.put("product_area", cut_jo.getString("product_area")); + param.put("task_type", "010303"); + AbstractAcsTask task = new CoolCutTask(); + task.createTask(param); } - // 2.找冷却区空货位 - JSONObject map = new JSONObject(); - map.put("flag", "2"); - map.put("product_area", cut_jo.getString("product_area")); - map.put("point_location", "0"); + //满轴送回 + if (type.equals("2")) { + //查询对应的分切点位是否存在 + JSONObject cut_jo = WQLObject.getWQLObject("st_ivt_cutpointivt").query("full_point_code = '" + point_code + "'").uniqueResult(0); + if (ObjectUtil.isEmpty(cut_jo)) { + throw new BadRequestException("请输入或者扫码分切区域的满轴点位!"); + } + if (StrUtil.equals("01", cut_jo.getString("full_point_status"))) { + throw new BadRequestException("该点位库存状态不存在满轴!"); + } - JSONObject jsonCooIvt = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().uniqueResult(0); - // 如果为空 - if (ObjectUtil.isEmpty(jsonCooIvt)) { - map.put("point_location", "1"); - jsonCooIvt = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().uniqueResult(0); - } - if (ObjectUtil.isEmpty(jsonCooIvt)) { - throw new BadRequestException("冷却区空位不足"); + String container_name = cut_jo.getString("container_name"); + if (StrUtil.isEmpty(container_name)) { + throw new BadRequestException("该点位上不存在母卷,或LMS系统上未维护母卷号!"); + } + JSONObject raw_jo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder").query("container_name = '" + container_name + "'").uniqueResult(0); + if (ObjectUtil.isEmpty(raw_jo)) { + throw new BadRequestException("未查询到【" + container_name + "】对应的母卷号!"); + } + JSONObject device_jo = WQLObject.getWQLObject("st_ivt_sbpointivt").query("ext_code = '" + raw_jo.getString("resource_name") + "'").uniqueResult(0); + String point_location = device_jo.getString("point_location"); + + // 2.找冷却区空货位 + JSONObject map = new JSONObject(); + map.put("flag", "2"); + map.put("product_area", cut_jo.getString("product_area")); + map.put("point_location", point_location); + + JSONObject jsonCooIvt = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().uniqueResult(0); + // 如果为空 + if (ObjectUtil.isEmpty(jsonCooIvt)) { + throw new BadRequestException("冷却区空位不足"); + } + + // 3.创建任务 + JSONObject param = new JSONObject(); + param.put("point_code1", point_code); + param.put("point_code2", jsonCooIvt.getString("full_point_code")); + param.put("product_area", cut_jo.getString("product_area")); + param.put("vehicle_code", container_name); + param.put("task_type", "010304"); + AbstractAcsTask task = new CoolCutTask(); + task.createTask(param); } - // 3.创建任务 - JSONObject param = new JSONObject(); - param.put("point_code1", point_code); - param.put("point_code2", jsonCooIvt.getString("empty_point_code")); - param.put("product_area", cut_jo.getString("product_area")); - param.put("task_type", "010303"); - AbstractAcsTask task = new CoolCutTask(); - task.createTask(param); JSONObject result = new JSONObject(); result.put("message", "操作成功!"); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/ST_IVT_PACKAGEPOINTIVT.wql b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/ST_IVT_PACKAGEPOINTIVT.wql index 325a1744f..ee77ee807 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/ST_IVT_PACKAGEPOINTIVT.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/ST_IVT_PACKAGEPOINTIVT.wql @@ -45,9 +45,11 @@ IF 输入.flag = "1" PAGEQUERY SELECT - ivt.* + ivt.*, + dict.label FROM st_ivt_shaftivt ivt + LEFT JOIN sys_dict dict ON dict.value = ivt.point_type AND dict.`code` = 'PACKAGE_POINT_TYPE' WHERE ivt.product_area in 输入.in_area_id OPTION 输入.point_code <> "" diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/CoolCutTask.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/CoolCutTask.java index 85f8934a5..f7542452b 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/CoolCutTask.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/CoolCutTask.java @@ -244,6 +244,31 @@ public class CoolCutTask extends AbstractAcsTask { WQLObject.getWQLObject("st_ivt_coolpointivt").update(jsonCoolIvt2); } + if ("010304".equals(jsonTask.getString("task_type"))) { + //更新分切区空轴库存 + + JSONObject cut_jo2 = WQLObject.getWQLObject("ST_IVT_CutPointIvt").query("full_point_code = '" + point_code1 + "'").uniqueResult(0); + String container_name = cut_jo2.getString("container_name"); + cut_jo2.put("full_point_status", "01"); + cut_jo2.put("full_vehicle_code", ""); + cut_jo2.put("container_name", ""); + cut_jo2.put("update_optid", currentUserId); + cut_jo2.put("update_optname", currentUsername); + cut_jo2.put("update_time", DateUtil.now()); + WQLObject.getWQLObject("ST_IVT_CutPointIvt").update(cut_jo2); + + //更新冷却区空轴库存 + JSONObject jsonCoolIvt2 = WQLObject.getWQLObject("st_ivt_coolpointivt").query("full_point_code = '" + point_code2 + "'").uniqueResult(0); + jsonCoolIvt2.put("full_point_status", "02"); + jsonCoolIvt2.put("container_name", container_name); + jsonCoolIvt2.put("cool_ivt_status", "02"); + jsonCoolIvt2.put("instorage_time", ""); + jsonCoolIvt2.put("update_optid", currentUserId); + jsonCoolIvt2.put("update_optname", currentUsername); + jsonCoolIvt2.put("update_time", DateUtil.now()); + WQLObject.getWQLObject("st_ivt_coolpointivt").update(jsonCoolIvt2); + } + } } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/OutHotTask.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/OutHotTask.java index 67ada36bc..26695bf6c 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/OutHotTask.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/OutHotTask.java @@ -49,13 +49,18 @@ public class OutHotTask extends AbstractAcsTask { .task_code(json.getString("task_code")) .task_type(json.getString("acs_task_type")) .start_device_code(json.getString("point_code1")) - .next_device_code(json.getString("point_code2")) .vehicle_code(json.getString("vehicle_code")) .agv_system_type(agv_system_type) .priority(json.getString("priority")) .product_area(product_area) .remark(json.getString("remark")) .build(); + if (StrUtil.isNotEmpty(json.getString("point_code3"))) { + dto.setNext_device_code(json.getString("point_code3")); + dto.setPut_device_code(json.getString("point_code2")); + } else { + dto.setNext_device_code(json.getString("point_code2")); + } resultList.add(dto); } return resultList; @@ -105,11 +110,11 @@ public class OutHotTask extends AbstractAcsTask { // 更新主表: 什么时候更新主表 JSONObject jsonHotMst = hotMstTab.query("task_id = '" + task_id + "'").uniqueResult(0); - // 更新暂存区点位状态 + /*// 更新暂存区点位状态 JSONObject jsonPoint2 = pointTab.query("point_code = '" + jsonTask.getString("point_code2") + "'").uniqueResult(0); jsonPoint2.put("point_status", "2"); jsonPoint2.put("material_code", jsonHotIvt.getString("container_name")); - pointTab.update(jsonPoint2); + pointTab.update(jsonPoint2);*/ // 更新烘箱区库存状态 jsonHotIvt.put("point_status", "01"); @@ -121,6 +126,24 @@ public class OutHotTask extends AbstractAcsTask { jsonHotIvt.put("update_optname", currentUsername); jsonHotIvt.put("update_time", DateUtil.now()); + // 更新冷却库存状态 + // 校验终点是否存在 + WQLObject ivtTab = WQLObject.getWQLObject("ST_IVT_CoolPointIvt"); // 冷却区库存表 + JSONObject jsonIvt = ivtTab.query("full_point_code ='" + jsonTask.getString("point_code3") + "'").uniqueResult(0); + if (ObjectUtil.isEmpty(jsonIvt)) { + throw new BadRequestException("终点未找到可用点位:" + jsonTask.getString("point_code3")); + } + + JSONObject raw_jo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder").query("container_name = '" + jsonTask.getString("material_code") + "'").uniqueResult(0); + + jsonIvt.put("full_point_status", "02"); + jsonIvt.put("cool_ivt_status", "03"); + jsonIvt.put("instorage_time", DateUtil.now()); + jsonIvt.put("container_name", raw_jo.getString("container_name")); + jsonIvt.put("workorder_id", raw_jo.getString("workorder_id")); + jsonIvt.put("ivt_qty", raw_jo.getString("qty")); + ivtTab.update(jsonIvt); + log.info("出烘箱wql执行update语句!"); hotIvtTab.update(jsonHotIvt); JSONObject update_ivt = hotIvtTab.query("point_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0); @@ -191,6 +214,7 @@ public class OutHotTask extends AbstractAcsTask { json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode()); json.put("point_code1", form.getString("point_code1")); json.put("point_code2", form.getString("point_code2")); + json.put("point_code3", form.getString("point_code3")); json.put("product_area", form.getString("product_area")); json.put("material_code", form.getString("material_code")); json.put("sort_seq", "1"); @@ -205,7 +229,7 @@ public class OutHotTask extends AbstractAcsTask { } else { json.put("priority", priority_jo.getString("value")); } - json.put("acs_task_type", "6"); + json.put("acs_task_type", "8"); tab.insert(json); immediateNotifyAcs(json.getString("task_id")); return json.getString("task_id"); diff --git a/lms/nladmin-ui/src/views/wms/basedata/st/ivt/UploadDialog.vue b/lms/nladmin-ui/src/views/wms/basedata/st/ivt/UploadDialog.vue new file mode 100644 index 000000000..da04b4678 --- /dev/null +++ b/lms/nladmin-ui/src/views/wms/basedata/st/ivt/UploadDialog.vue @@ -0,0 +1,116 @@ + + + + diff --git a/lms/nladmin-ui/src/views/wms/basedata/st/ivt/index.vue b/lms/nladmin-ui/src/views/wms/basedata/st/ivt/index.vue index 52b590558..4f3fb44d9 100644 --- a/lms/nladmin-ui/src/views/wms/basedata/st/ivt/index.vue +++ b/lms/nladmin-ui/src/views/wms/basedata/st/ivt/index.vue @@ -155,7 +155,7 @@ /> - + @@ -170,39 +170,63 @@ > 导出Excel + + 超期信息导入 + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + @@ -240,17 +267,37 @@ import crudOperation from '@crud/CRUD.operation' import udOperation from '@crud/UD.operation' import pagination from '@crud/Pagination' import crudUserStor from '@/views/wms/basedata/st/userStor/userStor' +import UploadDialog from '@/views/wms/basedata/st/ivt/UploadDialog' import { download } from '@/api/data' import { downloadFile } from '@/utils' -const defaultForm = { stockrecord_id: null, cascader: null, struct_id: null, struct_code: null, struct_name: null, workprocedure_id: null, material_id: null, material_code: null, quality_scode: null, pcsn: null, canuse_qty: null, frozen_qty: null, ivt_qty: null, warehousing_qty: null, qty_unit_id: null, instorage_time: null, sale_id: null } +const defaultForm = { + stockrecord_id: null, + cascader: null, + struct_id: null, + struct_code: null, + struct_name: null, + workprocedure_id: null, + material_id: null, + material_code: null, + quality_scode: null, + pcsn: null, + canuse_qty: null, + frozen_qty: null, + ivt_qty: null, + warehousing_qty: null, + qty_unit_id: null, + instorage_time: null, + sale_id: null +} export default { name: 'Structivt', dicts: ['ST_QUALITY_SCODE', 'product_area', 'IS_OR_NOT'], - components: { pagination, crudOperation, rrOperation, udOperation }, + components: { pagination, crudOperation, rrOperation, udOperation, UploadDialog }, mixins: [presenter(), header(), form(defaultForm), crud()], cruds() { - return CRUD({ title: '库存管理', url: 'api/structivt', idField: 'stockrecord_id', sort: 'stockrecord_id,desc', + return CRUD({ + title: '库存管理', url: 'api/structivt', idField: 'stockrecord_id', sort: 'stockrecord_id,desc', optShow: { add: false, edit: false, @@ -258,11 +305,13 @@ export default { download: false, reset: true }, - crudMethod: { ...crudStructivt }}) + crudMethod: { ...crudStructivt } + }) }, data() { return { sects: [], + viewShow: false, ivtStatusList: [ { 'value': 'canuse_qty', 'label': '可用数' }, { 'value': 'warehousing_qty', 'label': '待入数' }, @@ -278,10 +327,8 @@ export default { { 'value': '2', 'label': '生产质量原因' }, { 'value': '3', 'label': '市场原因' } ], - permission: { - }, - rules: { - } + permission: {}, + rules: {} } }, created() { @@ -324,6 +371,9 @@ export default { } this.crud.toQuery() }, + querytable() { + this.crud.toQuery() + }, downdtl() { if (this.currentRow !== null) { crud.downloadLoading = true @@ -335,6 +385,9 @@ export default { }) } }, + Import() { + this.viewShow = true + }, save(row) { crudStructivt.save(row).then(res => { this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS) diff --git a/lms/nladmin-ui/src/views/wms/basedata/st/ivt/structivt.js b/lms/nladmin-ui/src/views/wms/basedata/st/ivt/structivt.js index 762aeb53d..52927a92d 100644 --- a/lms/nladmin-ui/src/views/wms/basedata/st/ivt/structivt.js +++ b/lms/nladmin-ui/src/views/wms/basedata/st/ivt/structivt.js @@ -54,4 +54,12 @@ export function save(data) { }) } -export default { add, edit, del, getStruct, getStructById, getUnits, save } +export function excelImport(data) { + return request({ + url: 'api/structivt/importExcel', + method: 'post', + data + }) +} + +export default { add, edit, del, getStruct, getStructById, getUnits, save, excelImport } diff --git a/lms/nladmin-ui/src/views/wms/pdm/ivt/package/index.vue b/lms/nladmin-ui/src/views/wms/pdm/ivt/package/index.vue index a5f42d541..e5e1f2dd8 100644 --- a/lms/nladmin-ui/src/views/wms/pdm/ivt/package/index.vue +++ b/lms/nladmin-ui/src/views/wms/pdm/ivt/package/index.vue @@ -158,6 +158,7 @@ > +