diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java b/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java index c096a172f..b8757c595 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java @@ -35,6 +35,8 @@ public enum DriverTypeEnum { SIEMENS_CONVEYOR(13, "siemens_conveyor", "西门子-输送机驱动", "conveyor"), + SIEMENS_WEIGHT_CONVEYOR(29, "siemens_weight_conveyor", "西门子-输送机驱动-称重", "conveyor"), + HONGXIANG_CONVEYOR(13, "hongxiang_conveyor", "烘箱对接位", "conveyor"), INSPECT_CONVEYOR_CONTROL_WITH_SCANNER(14, "standard_conveyor_control_with_scanner", "标准版-输送机-控制点-关联扫码", "conveyor"), 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 ac79f4826..6a9b2bf27 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 @@ -110,7 +110,7 @@ public class BoxPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDriv action = this.itemProtocol.getAction(); walk_y = this.itemProtocol.getWalk_y(); error = this.itemProtocol.getError(); - task = this.itemProtocol.getTask(); + /*task = this.itemProtocol.getTask();*/ iserror = this.itemProtocol.deviceStatus; if (mode != last_mode) { logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode)); @@ -132,10 +132,10 @@ public class BoxPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDriv logServer.deviceItemValue(this.device_code, "walk_y", String.valueOf(walk_y)); logServer.deviceExecuteLog(this.device_code, "", "", "信号walk_y:" + last_walk_y + "->" + walk_y); } - if (task != last_task) { + /*if (task != last_task) { logServer.deviceItemValue(this.device_code, "task", String.valueOf(task)); logServer.deviceExecuteLog(this.device_code, "", "", "信号task:" + last_task + "->" + task); - } + }*/ } catch (Exception var17) { return; 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 ec5a996e0..0bd24e040 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 @@ -25,8 +25,8 @@ public class ItemProtocol { public static String item_walk_y = "walk_y"; //报警 public static String item_error = "error"; - //任务号 - public static String item_task = "task"; + /*//任务号 + public static String item_task = "task";*/ private BoxPalletizingManipulatorDeviceDriver driver; @@ -59,9 +59,9 @@ public class ItemProtocol { return this.getOpcIntegerValue(item_error); } - public int getTask() { + /*public int getTask() { return this.getOpcIntegerValue(item_task); - } + }*/ Boolean isonline; @@ -103,7 +103,7 @@ public class ItemProtocol { list.add(new ItemDto(item_action, "动作信号", "DB1.B3")); list.add(new ItemDto(item_walk_y, "行走列", "DB1.B4")); list.add(new ItemDto(item_error, "报警信号", "DB1.B5")); - list.add(new ItemDto(item_task, "任务号", "DB1.D6")); + /*list.add(new ItemDto(item_task, "任务号", "DB1.D6"));*/ return list; } 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 ed2173932..724d46d46 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 @@ -747,9 +747,18 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme map3.put("code", "to_command"); map3.put("value", "1"); list.add(map3); - this.writing(list); - requireSucess = true; - while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString() + try { + this.writing(list); + } catch (Exception e) { + logServer.deviceExecuteLog(device_code, "", "", "下发指令:" + inst.getInstruction_code() + + ",指令起点:" + inst.getStart_device_code() + + ",指令终点:" + inst.getNext_device_code() + ",根据指令下发信号失败" + e.getMessage()); + if (ObjectUtil.isEmpty(instructionService.findByTaskcodeAndStatus(taskdto.getTask_code()))) { + requireSucess = false; + return false; + } + } + /*while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString() , inst.getInstruction_code())) { this.writing(list); logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发信号"); @@ -762,18 +771,11 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme requireSucess = false; return false; } - } - -// if (task != Integer.parseInt(inst.getInstruction_code())) { -// this.writing(list); -// message = "重新下发电气信号"; -// logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号"); -// } + }*/ message = "下发电气任务号成功"; requireSucess = true; return true; } - // type 5 输送任务 if (!StrUtil.equals(taskdto.getTask_type(), "5")) { return false; @@ -870,9 +872,18 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme map3.put("code", "to_command"); map3.put("value", "1"); list.add(map3); - this.writing(list); - requireSucess = true; - while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString() + try { + this.writing(list); + } catch (Exception e) { + logServer.deviceExecuteLog(device_code, "", "", "下发指令:" + instdto.getInstruction_code() + + ",指令起点:" + instdto.getStart_device_code() + + ",指令终点:" + instdto.getNext_device_code() + ",根据指令下发信号失败" + e.getMessage()); + if (ObjectUtil.isEmpty(instructionService.findByTaskcodeAndStatus(taskdto.getTask_code()))) { + requireSucess = false; + return false; + } + } + /*while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString() , instdto.getInstruction_code())) { this.writing(list); logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号"); @@ -885,14 +896,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme requireSucess = false; return false; } - } - - -// if (task != Integer.parseInt(inst.getInstruction_code())) { -// this.writing(list); -// message = "重新下发电气信号"; -// logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号"); -// } + }*/ } else { //如果不存在则直接找对应指令 Instruction inst = instructionService.findByDeviceCodeFromCache(this.device_code); @@ -929,9 +933,18 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme map3.put("code", "to_command"); map3.put("value", "1"); list.add(map3); - this.writing(list); - requireSucess = true; - while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString() + try { + this.writing(list); + } catch (Exception e) { + logServer.deviceExecuteLog(device_code, "", "", "下发指令:" + inst.getInstruction_code() + + ",指令起点:" + inst.getStart_device_code() + + ",指令终点:" + inst.getNext_device_code() + ",根据指令下发信号失败" + e.getMessage()); + if (ObjectUtil.isEmpty(instructionService.findByTaskcodeAndStatus(taskdto.getTask_code()))) { + requireSucess = false; + return false; + } + } + /*while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString() , inst.getInstruction_code())) { this.writing(list); logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号"); @@ -944,11 +957,13 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme requireSucess = false; return false; } - } + }*/ // if (task != Integer.parseInt(inst.getInstruction_code())) { // this.writing(list); // logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号"); // } + requireSucess = true; + return true; } return true; } @@ -1116,7 +1131,18 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme if (jo.getInteger("status") == 200) { message = "申请补码AGV搬运任务成功"; List list = new ArrayList(); - while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".to_command").toString() + Map map = new HashMap(); + map.put("code", "to_command"); + map.put("value", "8"); + list.add(map); + try { + this.writing(list); + } catch (Exception e) { + logServer.deviceExecuteLog(device_code, "", "", "申请补码AGV搬运任务下发信号失败" + e.getMessage()); + requireSucess = false; + return; + } + /*while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".to_command").toString() , "8")) { this.writing(list); logServer.deviceExecuteLog(device_code, "", "", "再次下发mode信号"); @@ -1125,7 +1151,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme } catch (InterruptedException e) { e.printStackTrace(); } - } + }*/ logServer.deviceExecuteLog(this.device_code, "", "", "申请补码AGV任务,返回参数:" + jo); requireSucess = true; } else { @@ -1166,8 +1192,14 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme map.put("code", "to_command"); map.put("value", "8"); list.add(map); - this.writing(list); - while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".to_command").toString() + try { + this.writing(list); + } catch (Exception e) { + logServer.deviceExecuteLog(device_code, "", "", "申请AGV搬运任务下发信号失败" + e.getMessage()); + requireSucess = false; + return; + } + /*while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".to_command").toString() , "8")) { this.writing(list); logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发mode信号"); @@ -1176,7 +1208,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme } catch (InterruptedException e) { e.printStackTrace(); } - } + }*/ logServer.deviceExecuteLog(this.device_code, "", "", "申请AGV任务,返回参数:" + jo); requireSucess = true; } else { diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_weigh_conveyor/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_weigh_conveyor/ItemProtocol.java new file mode 100644 index 000000000..5ddfa5f15 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_weigh_conveyor/ItemProtocol.java @@ -0,0 +1,174 @@ +package org.nl.acs.device_driver.basedriver.siemens_weigh_conveyor; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import lombok.Data; +import lombok.extern.slf4j.Slf4j; +import org.nl.acs.device.device_driver.standard_inspect.ItemDto; + +import java.util.ArrayList; +import java.util.List; + +@Slf4j +@Data +public class ItemProtocol { + + //心跳 + public static String item_heartbeat = "heartbeat"; + //工作模式 + public static String item_mode = "mode"; + //光电信号 + public static String item_move = "move"; + //托盘方向 + public static String item_carrier_direction = "carrier_direction"; + //报警 + public static String item_error = "error"; + //任务号 + public static String item_task = "task"; + //重量 + public static String item_weight = "weight"; + + //下发命令 + public static String item_to_command = "to_command"; + //下发目标站 + public static String item_to_target = "to_target"; + //下发托盘类型 + public static String item_to_container_type = "to_container_type"; + //下发任务号 + public static String item_to_task = "to_task"; + //困扎次数 + public static String item_to_strap_times = "to_strap_times"; + //木箱长度 + public static String item_to_length = "to_length"; + //木箱宽度 + public static String item_to_weight = "to_weight"; + //木箱高度 + public static String item_to_height = "to_height"; + + + private SiemensWeightConveyorDeviceDriver driver; + + public ItemProtocol(SiemensWeightConveyorDeviceDriver driver) { + this.driver = driver; + } + + public int getHeartbeat() { + return this.getOpcIntegerValue(item_heartbeat); + } + + public int getMode() { + return this.getOpcIntegerValue(item_mode); + } + + public int getMove() { + return this.getOpcIntegerValue(item_move); + } + + public int getCarrier_direction() { + return this.getOpcIntegerValue(item_carrier_direction); + } + + public int getError() { + return this.getOpcIntegerValue(item_error); + } + + public int getTask() { + return this.getOpcIntegerValue(item_task); + } + + public int getTo_command() { + return this.getOpcIntegerValue(item_to_command); + } + + public int getTo_target() { + return this.getOpcIntegerValue(item_to_target); + } + + public int getTo_task() { + return this.getOpcIntegerValue(item_to_task); + } + + public int getTo_strap_times() { + return this.getOpcIntegerValue(item_to_strap_times); + } + + public int getTo_length() { + return this.getOpcIntegerValue(item_to_length); + } + + public int getTo_weight() { + return this.getOpcIntegerValue(item_to_weight); + } + + public int getTo_height() { + return this.getOpcIntegerValue(item_to_height); + } + + public int getWeight() { + return this.getOpcIntegerValue(item_weight); + } + + + 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); + } else { + setIsonline(true); + return value; + } + return 0; + + } + + public String getOpcStringValue(String protocol) { + String value = this.driver.getStringValue(protocol); + if (StrUtil.isEmpty(value)) { + + } else { + return value; + } + return "0"; + } + + public static List getReadableItemDtos() { + ArrayList list = new ArrayList(); + list.add(new ItemDto(item_heartbeat, "心跳", "DB600.B0")); + list.add(new ItemDto(item_mode, "工作模式", "DB600.B2")); + list.add(new ItemDto(item_move, "光电信号", "DB600.B3")); + list.add(new ItemDto(item_carrier_direction, "托盘方向", "DB600.B4")); + list.add(new ItemDto(item_error, "报警信号", "DB600.B6")); + list.add(new ItemDto(item_task, "任务号", "DB600.D10")); + list.add(new ItemDto(item_weight, "重量", "DB600.D12")); + return list; + } + + public static List getWriteableItemDtos() { + ArrayList list = new ArrayList(); + list.add(new ItemDto(item_to_command, "下发命令", "DB601.W2")); + list.add(new ItemDto(item_to_target, "下发目标站", "DB601.W4")); + list.add(new ItemDto(item_to_container_type, "下发托盘类型", "DB601.W6")); + list.add(new ItemDto(item_to_task, "下发任务号", "DB601.D8")); + list.add(new ItemDto(item_to_strap_times, "困扎次数", "DB601.W12")); + list.add(new ItemDto(item_to_length, "木箱长度", "DB601.W14")); + list.add(new ItemDto(item_to_weight, "木箱宽度", "DB601.W16")); + list.add(new ItemDto(item_to_height, "木箱高度", "DB601.W18")); + return list; + } + + @Override + public String toString() { + return ""; + } + +} + diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_weigh_conveyor/SiemensWeightConveyorDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_weigh_conveyor/SiemensWeightConveyorDefination.java new file mode 100644 index 000000000..5b6fd33b9 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_weigh_conveyor/SiemensWeightConveyorDefination.java @@ -0,0 +1,64 @@ +package org.nl.acs.device_driver.basedriver.siemens_weigh_conveyor; + +import org.nl.acs.device.device_driver.standard_inspect.ItemDto; +import org.nl.acs.device_driver.DeviceDriver; +import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination; +import org.nl.acs.opc.Device; +import org.nl.acs.opc.DeviceType; +import org.springframework.stereotype.Service; + +import java.util.LinkedList; +import java.util.List; + +/** + * 西门子-输送机驱动 + * + */ +@Service +public class SiemensWeightConveyorDefination implements OpcDeviceDriverDefination { + @Override + public String getDriverCode() { + return "siemens_weight_conveyor"; + } + + @Override + public String getDriverName() { + return "西门子-输送机驱动-称重"; + } + + @Override + public String getDriverDescription() { + return "西门子-输送机驱动-称重"; + } + + @Override + public DeviceDriver getDriverInstance(Device device) { + return (new SiemensWeightConveyorDeviceDriver()).setDevice(device).setDriverDefination(this); + + } + + @Override + public Class getDeviceDriverType() { + return SiemensWeightConveyorDeviceDriver.class; + } + + @Override + public List getFitDeviceTypes() { + List types = new LinkedList(); + types.add(DeviceType.station); + return types; + } + + @Override + public List getReadableItemDtos() { + return ItemProtocol.getReadableItemDtos(); + } + + + + @Override + public List getWriteableItemDtos() { + return ItemProtocol.getWriteableItemDtos(); + } + +} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_weigh_conveyor/SiemensWeightConveyorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_weigh_conveyor/SiemensWeightConveyorDeviceDriver.java new file mode 100644 index 000000000..39d8b67dd --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_weigh_conveyor/SiemensWeightConveyorDeviceDriver.java @@ -0,0 +1,1249 @@ +package org.nl.acs.device_driver.basedriver.siemens_weigh_conveyor; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpResponse; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import lombok.Data; +import lombok.RequiredArgsConstructor; +import lombok.SneakyThrows; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.ObjectUtils; +import org.nl.acs.AcsConfig; +import org.nl.acs.agv.server.NDCAgvService; +import org.nl.acs.device.service.DeviceService; +import org.nl.acs.device_driver.DeviceDriver; +import org.nl.acs.device_driver.FeedLmsRealFailed; +import org.nl.acs.device_driver.RouteableDeviceDriver; +import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; +import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; +import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingRequest; +import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingResponse; +import org.nl.acs.ext.wms.data.ApplyManipulatorActionRequest; +import org.nl.acs.ext.wms.data.ApplyManipulatorActionResponse; +import org.nl.acs.ext.wms.service.AcsToWmsService; +import org.nl.acs.history.ErrorUtil; +import org.nl.acs.history.service.DeviceErrorLogService; +import org.nl.acs.history.service.dto.DeviceErrorLogDto; +import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl; +import org.nl.acs.instruction.service.InstructionService; +import org.nl.acs.instruction.service.dto.Instruction; +import org.nl.acs.log.service.DeviceExecuteLogService; +import org.nl.acs.monitor.DeviceStageMonitor; +import org.nl.acs.opc.Device; +import org.nl.acs.opc.DeviceAppService; +import org.nl.acs.route.service.RouteLineService; +import org.nl.acs.route.service.dto.RouteLineDto; +import org.nl.acs.task.service.TaskService; +import org.nl.acs.task.service.dto.TaskDto; +import org.nl.config.thread.ThreadPoolExecutorUtil; +import org.nl.modules.system.service.ParamService; +import org.nl.modules.wql.core.bean.WQLObject; +import org.nl.modules.wql.util.SpringContextHolder; +import org.openscada.opc.lib.da.Server; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ThreadPoolExecutor; + +/** + * 西门子-输送机称重驱动 + */ +@Slf4j +@Data +@RequiredArgsConstructor +public class SiemensWeightConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed { + private final static ThreadPoolExecutor EXECUTOR = ThreadPoolExecutorUtil.getPoll(); + protected ItemProtocol itemProtocol = new ItemProtocol(this); + @Autowired + InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); + @Autowired + DeviceService deviceservice = SpringContextHolder.getBean(DeviceService.class); + @Autowired + RouteLineService routelineserver = SpringContextHolder.getBean(RouteLineService.class); + @Autowired + TaskService taskserver = SpringContextHolder.getBean(TaskService.class); + @Autowired + DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class); + @Autowired + RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class); + @Autowired + ParamService paramService = SpringContextHolder.getBean(ParamService.class); + @Autowired + AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsService.class); + @Autowired + DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); + @Autowired + NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvService.class); + @Autowired + DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class); + //当前指令 + Instruction inst = null; + + private String error_type = "ssx_error_type"; + + //工作模式 + int mode = 0; + int last_mode = 0; + //光电信号 + int move = 0; + int last_move = 0; + //托盘方向 + int carrier_direction = 0; + int last_carrier_direction = 0; + //报警信号 + int error = 0; + int last_error = 0; + //任务号 + int task = 0; + int last_task = 0; + int agvphase = 0; + int weight = 0; + int last_weight = 0; + String task_code = null; + int to_command = 0; + int last_to_command = 0; + + int to_target = 0; + int last_to_target = 0; + + int to_task = 0; + int last_to_task = 0; + + int to_strap_times = 0; + int last_to_strap_times = 0; + int to_length = 0; + int last_to_length = 0; + int to_weight = 0; + int last_to_weight = 0; + int to_height = 0; + int last_to_height = 0; + + int phase = 0; + int index = 0; + Boolean isonline = true; + int hasGoods = 0; + String message = null; + Boolean iserror = false; + Boolean deviceStatus = false; + + String hand_barcode = null; + + Integer heartbeat_tag; + private Date instruction_update_time = new Date(); + private int instruction_update_time_out = 500; + + private Date instruction_require_time = new Date(); + private Date require_apply_labeling_time = new Date(); + private Date require_apply_strangulation_time = new Date(); + private Date require_empty_in_time = new Date(); + private Date require_empty_out_time = new Date(); + + private int instruction_require_time_out = 3000; + //行架机械手申请任务成功标识 + boolean requireSucess = false; + boolean requireEmptyInSuccess = false; + boolean requiresShipDeviceUpdate = true; + private int instruction_finished_time_out; + + int branchProtocol = 0; + String inst_message; + String last_inst_message; + int heartbeat = 0; + int last_heartbeat = 0; + //当前指令 + + //暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域 + int flag; + + String device_code; + + String vehicle_code; + String last_vehicle_code; + + @Override + public Device getDevice() { + return this.device; + } + + + @Override + public void execute() { + try { + device_code = this.getDeviceCode(); + mode = this.itemProtocol.getMode(); + move = this.itemProtocol.getMove(); + carrier_direction = this.itemProtocol.getCarrier_direction(); + error = this.itemProtocol.getError(); + task = this.itemProtocol.getTask(); + to_command = this.itemProtocol.getTo_command(); + to_target = this.itemProtocol.getTo_target(); + to_task = this.itemProtocol.getTo_task(); + heartbeat = this.itemProtocol.getHeartbeat(); + to_strap_times = this.itemProtocol.getTo_strap_times(); + to_length = this.itemProtocol.getTo_length(); + to_weight = this.itemProtocol.getTo_weight(); + to_height = this.itemProtocol.getTo_height(); + weight = this.itemProtocol.getWeight(); + deviceStatus = this.itemProtocol.deviceStatus; + + if (to_strap_times != last_to_strap_times) { + logServer.deviceExecuteLog(this.device_code, "", "", "信号to_strap_times:" + last_to_strap_times + "->" + to_strap_times); + } + if (weight != last_weight) { + logServer.deviceExecuteLog(this.device_code, "", "", "信号weight:" + last_weight + "->" + weight); + } + if (to_length != last_to_length) { + logServer.deviceExecuteLog(this.device_code, "", "", "信号to_length:" + last_to_length + "->" + to_length); + } + if (to_weight != last_to_weight) { + logServer.deviceExecuteLog(this.device_code, "", "", "信号to_weight:" + last_to_weight + "->" + to_weight); + } + if (to_height != last_to_height) { + logServer.deviceExecuteLog(this.device_code, "", "", "信号to_height:" + last_to_height + "->" + to_height); + } + if (to_command != last_to_command) { + logServer.deviceExecuteLog(this.device_code, "", "", "信号to_command:" + last_to_command + "->" + to_command); + } + if (to_target != last_to_target) { + logServer.deviceExecuteLog(this.device_code, "", "", "信号to_target:" + last_to_target + "->" + to_target); + } + if (to_task != last_to_task) { + logServer.deviceExecuteLog(this.device_code, "", "", "信号to_task:" + last_to_task + "->" + to_task); + } + if (mode != last_mode) { + + //Boolean flag = ObjectUtil.isEmpty(this.device.getExtraValue().get("special_flag")) ? false : Boolean.valueOf(this.device.getExtraValue().get("special_flag").toString()); + //暂时这样写 后续通过配置判断 + if (StrUtil.equals(this.device_code, "1018")) { + if (mode == 6 && last_mode == 2) { + requireSucess = false; + requireEmptyInSuccess = false; + } + } else if (StrUtil.equals(this.device_code, "1016")) { + if (mode == 8 && (last_mode == 2 || last_mode == 3)) { + requireSucess = false; + requireEmptyInSuccess = false; + } + + } else { + requireSucess = false; + requireEmptyInSuccess = false; + } + + if ("true".equals(this.device.getExtraValue().get("sendDeviceStatus"))) { + JSONObject param = new JSONObject(); + param.put("device_code", this.device_code); + param.put("mode", Math.min(mode, 3)); + param.put("device_name", this.getDevice().getDevice_name()); + param.put("device_type", "1"); + param.put("product_area", paramService.findByCode("productArea").getValue()); +// acsToWmsService.sendDeviceStatus(param); + sendDeviceStatus(param); + } + message = ""; + logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode + "复位请求标记:" + requireSucess); + logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode); + } + if (move != last_move) { + message = null; + if (move == 0) { + inst_message = null; + inst = null; + this.hand_barcode = null; + this.clearWrite(); + } + if (move == 0 && last_move == 1) { + last_vehicle_code = vehicle_code; + last_inst_message = inst_message; + if ("true".equals(this.device.getExtraValue().get("ship_device_update"))) { + this.requiresShipDeviceUpdate = false; + if (mode > 0) { + shipDeviceUpdate(); + } + } + } + logServer.deviceItemValue(this.device_code, "move", String.valueOf(move)); + logServer.deviceExecuteLog(this.device_code, "", "", "信号move:" + last_move + "->" + move); + } + if (carrier_direction != last_carrier_direction) { + logServer.deviceItemValue(this.device_code, "carrier_direction", String.valueOf(carrier_direction)); + logServer.deviceExecuteLog(this.device_code, "", "", "信号carrier_direction:" + last_carrier_direction + "->" + carrier_direction); + } + if (error != last_error) { + if (error != 0) { + DeviceErrorLogDto dto = new DeviceErrorLogDto(); + dto.setDevice_code(device_code); + dto.setError_code(String.valueOf(error)); + String errorInfo = ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(error)); + dto.setError_info(errorInfo); + deviceErrorLogService.create(dto); + } + + if ("true".equals(this.device.getExtraValue().get("sendDeviceStatus"))) { + if (error != 0) { + DeviceErrorLogDto dto = new DeviceErrorLogDto(); + dto.setDevice_code(device_code); + dto.setError_code(String.valueOf(error)); + String errorInfo = ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(error)); + dto.setError_info(errorInfo); + deviceErrorLogService.create(dto); + } + + if (error != 110 && error != 70) { + JSONObject param = new JSONObject(); + param.put("device_code", this.device_code); + param.put("error", error); + param.put("error_msg", error == 0 ? "" : ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(error))); + param.put("device_name", this.getDevice().getDevice_name()); + param.put("device_type", "1"); + param.put("product_area", paramService.findByCode("productArea").getValue()); + acsToWmsService.sendDeviceStatus(param); + } + } + + logServer.deviceItemValue(this.device_code, "error", String.valueOf(error)); + logServer.deviceExecuteLog(this.device_code, "", "", "信号error:" + last_error + "->" + error); + } + if (task != last_task) { + logServer.deviceItemValue(this.device_code, "task", String.valueOf(task)); + logServer.deviceExecuteLog(this.device_code, "", "", "信号task:" + last_task + "->" + task); + if ("true".equals(this.device.getExtraValue().get("task_update"))) { + taskDeviceUpdate(task); + } + } + if (move != 0 && task > 0) { +// logServer.deviceExecuteLog(device_code, "", "", "输送线任务开始反馈任务状态,指令号:" + task); + //inst_message + update_instruction_status(); + } + + } catch (Exception var17) { + var17.printStackTrace(); + logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol)); + } + + try { + if ("true".equals(this.device.getExtraValue().get("ship_device_update"))) { + if (ObjectUtil.equal(this.getDevice().getExtraValue().get("noIdleRequest"), "true")) { + if (!requiresShipDeviceUpdate && move == 0) { + this.shipDeviceUpdate(); + } + } else { + if (mode == 2 && !requiresShipDeviceUpdate && move == 0) { + this.shipDeviceUpdate(); + } + } + } + } catch (Exception e) { + e.printStackTrace(); + logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + Arrays.toString(e.getStackTrace())); + } + + + if (mode == 0) { + this.setIsonline(false); + message = "未联机"; + //有报警 + + } else { + this.setIsonline(true); + this.setIserror(false); + if (error != 0) { + this.setIserror(true); + message = "有报警"; + } + + Instruction instruction = null; + List toInstructions; + if(mode > 0) { + switch (mode) { + case 1: + log.debug("设备运转模式:等待工作"); + break; + case 2: + //申请任务 + if (move > 0 && !requireSucess) { + instruction_require(); + } + break; + case 4: + //申请捆扎 + if (move > 0 && !requireSucess) { + applyLaStrangulation(String.valueOf(mode)); + } + break; + case 5: + //申请贴标 + if (move > 0 && !requireSucess) { + //applyLabeling(); + } + break; + case 6: + //空托盘满垛入库申请 + if (move > 0 && !requireEmptyInSuccess) { + emptyIn(); + } + if (move > 0 && !requireSucess) { + instruction_require(); + } + break; + case 7: + //空盘出库申请 + if (move == 0 && !requireSucess) { + emptyOut(); + } + break; + case 8: + //申请AGV任务 + if (move == 1 && !requireSucess) { + applyAgvTask(); + } + break; + case 9: + //申请捆扎 + if (move > 0 && !requireSucess) { + applyLaStrangulation(String.valueOf(mode)); + } + break; + } + } + } + last_mode = mode; + last_move = move; + last_carrier_direction = carrier_direction; + last_error = error; + last_task = task; + last_heartbeat = heartbeat; + last_to_task = to_task; + last_to_command = to_command; + last_to_target = to_target; + last_to_strap_times = to_strap_times; + last_to_length = to_length; + last_to_weight = to_weight; + last_to_height = to_height; + last_weight = weight; + } + + public void shipDeviceUpdate() { + CompletableFuture future = new CompletableFuture<>(); + // 使用线程池执行异步操作 + EXECUTOR.submit(() -> { + try { + JSONObject param = new JSONObject(); + param.put("device_code", device_code); + logServer.deviceExecuteLog(this.device_code, "", "", "有货变无货请求LMS,参数:" + param); + HttpResponse response = acsToWmsService.shipDeviceUpdate(param); + if (response == null || response.getStatus() == 200) { + logServer.deviceExecuteLog(this.device_code, "", "", "有货变无货请求LMS,接口返回:" + response.body()); + } + future.complete("Async operation completed"); + } catch (Exception e) { + future.completeExceptionally(e); + } + }); + this.requiresShipDeviceUpdate = true; + } + + public void sendDeviceStatus(JSONObject param) { + CompletableFuture future = new CompletableFuture<>(); + // 使用线程池执行异步操作 + EXECUTOR.submit(() -> { + try { + acsToWmsService.sendDeviceStatus(param); + future.complete("Async operation completed"); + } catch (Exception e) { + future.completeExceptionally(e); + } + }); + this.requiresShipDeviceUpdate = true; + } + + private void taskDeviceUpdate(int task) { + Instruction inst = instructionService.findByInsructionCode(String.valueOf(task)); + ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest(); + applyManipulatorActionRequest.setDevice_code(device_code); + applyManipulatorActionRequest.setAction("3"); + if (ObjectUtil.isEmpty(inst)) { + logServer.deviceExecuteLog(this.device_code, "", "", "任务号不存在:" + inst); + return; + } + applyManipulatorActionRequest.setTask_code1(inst.getTask_code()); + logServer.deviceExecuteLog(this.device_code, "", "", "task变化请求LMS,参数:" + applyManipulatorActionRequest); + try { + final ThreadPoolExecutor EXECUTOR = ThreadPoolExecutorUtil.getPoll(); + EXECUTOR.submit(() -> { + for (int i = 0; i < 5; i++) { + ApplyManipulatorActionResponse response = acsToWmsService.actionFinishRequest(applyManipulatorActionRequest); + if (response == null || response.getstatus() == 200) { + logServer.deviceExecuteLog(this.device_code, "", "", "task变化请求LMS,接口返回:" + response.getMessage()); + break; + } else { + logServer.deviceExecuteLog(this.device_code, "", "", "任务变化请求LMS失败:" + response.getMessage()); + message = "task变化请求LMS失败: " + response.getMessage(); + try { + Thread.sleep(15000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + }); + } catch (Exception e) { + e.printStackTrace(); + logServer.deviceExecuteLog(this.device_code, "", "", "task变化请求LMS失败" + e.getMessage()); + } + + } + + + public boolean exe_error() { + if (this.error == 0) { + return true; + } else { + log.debug("设备报警"); + return false; + } + } + + public void clearWrite() { + + List list = new ArrayList(); + Map map = new HashMap(); + map.put("code", "to_target"); + map.put("value", "0"); + list.add(map); + Map map2 = new HashMap(); + map2.put("code", "to_task"); + map2.put("value", "0"); + list.add(map2); + Map map3 = new HashMap(); + map3.put("code", "to_command"); + map3.put("value", "0"); + list.add(map3); + Map map4 = new HashMap(); + map4.put("code", "to_strap_times"); + map4.put("value", "0"); + list.add(map4); + Map map5 = new HashMap(); + map5.put("code", "to_length"); + map5.put("value", "0"); + list.add(map5); + Map map6 = new HashMap(); + map6.put("code", "to_weight"); + map6.put("value", "0"); + list.add(map6); + Map map7 = new HashMap(); + map7.put("code", "to_height"); + map7.put("value", "0"); + list.add(map7); + this.writing(list); + message = null; + vehicle_code = null; + } + + public boolean exe_business() { + return true; + } + + public synchronized boolean finish_instruction() throws Exception { + instructionService.finish(inst); + return true; + } + + + protected void thingToNothing() throws Exception { + requireSucess = false; + } + + + public void writing(String param, String value) { + + String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + param; + Map itemMap = new HashMap(); + + itemMap.put(to_param, Integer.parseInt(value)); + this.control(itemMap); + logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value); + } + + public void executing(Server server, Map itemMap) { + this.control(itemMap); + } + + public void writing(int command) { + Map itemMap = new HashMap(); + this.control(itemMap); + } + + @Override + public JSONObject getDeviceStatusName() { + JSONObject jo = new JSONObject(); + String mode = ""; + String move = ""; + String carrier_direction = ""; + if (this.getMode() == 0) { + mode = "脱机"; + } else if (this.getMode() == 1) { + mode = "单机"; + } else if (this.getMode() == 2) { + mode = "待机"; + } else if (this.getMode() == 3) { + mode = "运行中"; + } else if (this.getMode() == 4) { + mode = "申请捆扎中"; + } else if (this.getMode() == 5) { + mode = "申请贴标中"; + } else if (this.getMode() == 6) { + mode = "申请空盘入库中"; + } else if (this.getMode() == 7) { + mode = "申请空盘出库中"; + } else if (this.getMode() == 8) { + mode = "申请AGV任务中"; + } + + if (this.getMove() == 0) { + move = "无货"; + jo.put("hasGoods", false); + } else if (this.getMove() == 1) { + move = "有货"; + jo.put("hasGoods", true); + } else if (this.getMove() == 2) { + move = "有托盘有货"; + jo.put("hasGoods", true); + } + if (deviceStatus) { + iserror = true; + } + if (error == 0 && !deviceStatus) { + iserror = false; + } + if (this.carrier_direction == 1) { + carrier_direction = "正转"; + } else if (this.carrier_direction == 2) { + carrier_direction = "反转"; + } + String requireSucess = "0"; + 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); + jo.put("carrier_direction", carrier_direction); + jo.put("task", task); + jo.put("last_task", last_task); + jo.put("task_code", task_code); + jo.put("inst_message", this.inst_message); + jo.put("last_inst_message", this.last_inst_message); + jo.put("isOnline", this.getIsonline()); + jo.put("error", ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(this.getError()))); + jo.put("isError", this.getIserror()); + jo.put("message", this.getMessage()); + jo.put("hand_barcode", hand_barcode); + jo.put("barcode", this.getMove() == 0 ? null : checkInst() == null ? vehicle_code : checkInst().getVehicle_code()); + jo.put("is_click", true); + jo.put("requireSucess", requireSucess); + jo.put("driver_type", "siemens_conveyor"); + return jo; + } + + @Override + public void setDeviceStatus(JSONObject data) { + String requestSucess = data.getString("requireSucess"); + if (StrUtil.equals(requestSucess, "0")) { + this.requireSucess = false; + } else if (StrUtil.equals(requestSucess, "1")) { + this.requireSucess = true; + } + + String hand_barcode = data.getString("hand_barcode"); + this.setHand_barcode(hand_barcode); + } + + @Override + public JSONObject feedLmsRealFailedInfo() { + JSONObject jo = new JSONObject(); + jo.put("device_code", this.getDevice().getDevice_code()); + jo.put("device_name", this.getDevice().getDevice_name()); + jo.put("fault_code", String.valueOf(error)); + jo.put("fault_info", ErrorUtil.getDictDetail(error_type, String.valueOf(this.getError()))); + jo.put("fault_type", error_type); + return jo; + } + + public void writing(List list) { + Map itemMap = new HashMap(); + for (int i = 0; i < list.size(); i++) { + Object ob = list.get(i); + JSONObject json = (JSONObject) JSONObject.toJSON(ob); + if (!StrUtil.isEmpty(json.getString("value"))) { + String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + json.getString("code"); + itemMap.put(to_param, json.getString("value")); + } + } + logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap); + try { + this.checkcontrol(itemMap); + } catch (Exception e) { + e.printStackTrace(); + try { + this.checkcontrol(itemMap); + } catch (Exception e1) { + e1.printStackTrace(); + } + } + + } + + + /** + * 请求指令 + */ + public synchronized boolean instruction_require() { + Date date = new Date(); + if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + return false; + } else { + this.instruction_require_time = date; + //判断是否存在起点相同 任务状态就绪的任务 + TaskDto taskdto = taskserver.findByStartCodeAndReady(device_code); + if (!ObjectUtil.isEmpty(taskdto) && "5".equals(taskdto.getTask_type())) { + //需要判断当前设备是否已经存在就绪的指令 如果存在就直接下发 不存在则创建 + Instruction inst = instructionService.findByTaskcodeAndStatus(taskdto.getTask_code()); + if (ObjectUtil.isNotEmpty(inst)) { + List list = new ArrayList(); + Map map = new HashMap(); + if (StrUtil.isNotEmpty(taskdto.getTo_z())) { + if (StrUtil.equals(taskdto.getTo_z(), "01")) { + map.put("code", "to_target"); + map.put("value", "102"); + } else if (StrUtil.equals(taskdto.getTo_z(), "02")) { + map.put("code", "to_target"); + map.put("value", "201"); + } else if (StrUtil.equals(taskdto.getTo_z(), "03")) { + map.put("code", "to_target"); + map.put("value", "301"); + } + } + list.add(map); + Map map2 = new HashMap(); + map2.put("code", "to_task"); + map2.put("value", inst.getInstruction_code()); + list.add(map2); + Map map3 = new HashMap(); + map3.put("code", "to_command"); + map3.put("value", "1"); + list.add(map3); + try { + this.writing(list); + } catch (Exception e) { + logServer.deviceExecuteLog(device_code, "", "", "下发指令:" + inst.getInstruction_code() + + ",指令起点:" + inst.getStart_device_code() + + ",指令终点:" + inst.getNext_device_code() + ",根据指令下发信号失败" + e.getMessage()); + if (ObjectUtil.isEmpty(instructionService.findByTaskcodeAndStatus(taskdto.getTask_code()))) { + requireSucess = false; + return false; + } + } + message = "下发电气任务号成功"; + requireSucess = true; + return true; + } + // type 5 输送任务 + if (!StrUtil.equals(taskdto.getTask_type(), "5")) { + return false; + } + String taskid = taskdto.getTask_id(); + String taskcode = taskdto.getTask_code(); + String vehiclecode = taskdto.getVehicle_code(); + String priority = taskdto.getPriority(); + String start_point_code = taskdto.getStart_point_code(); + String start_device_code = taskdto.getStart_device_code(); + String route_plan_code = taskdto.getRoute_plan_code(); + String next_device_code = ""; + + /** + * 开始平均分配 + */ + String this_coevice_code = taskserver.queryAssignedByDevice(device_code, taskdto.getNext_device_code()); + if (StrUtil.isEmpty(this_coevice_code)) { + List shortPathsList = routeLineService.getShortPathLines(start_device_code, taskdto.getNext_device_code(), route_plan_code); + RouteLineDto routeLineDto = shortPathsList.get(0); + + String path = routeLineDto.getPath(); + String type = routeLineDto.getType(); + String[] str = path.split("->"); + + List pathlist = Arrays.asList(str); + int index = 0; + for (int m = 0; m < pathlist.size(); m++) { + if (pathlist.get(m).equals(start_device_code)) { + index = m + 1; + break; + } + } + next_device_code = pathlist.get(index); + } else { + next_device_code = this_coevice_code; + } + //校验路由关系 + List shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code); + if (ObjectUtils.isEmpty(shortPathsList)) { + throw new RuntimeException("路由不通!"); + } + + Device startdevice = deviceAppservice.findDeviceByCode(start_device_code); + Device nextdevice = deviceAppservice.findDeviceByCode(next_device_code); + String next_point_code; + if (StrUtil.equals(deviceAppservice.findDeviceTypeByCode(next_device_code), "storage")) { + next_point_code = taskdto.getTo_x() + "-" + taskdto.getTo_y() + "-" + taskdto.getTo_z(); + } else { + next_point_code = next_device_code; + } + Instruction instdto = new Instruction(); + instdto.setInstruction_id(IdUtil.simpleUUID()); + instdto.setRoute_plan_code(route_plan_code); + instdto.setRemark(taskdto.getRemark()); + instdto.setMaterial(taskdto.getMaterial()); + instdto.setQuantity(taskdto.getQuantity()); + instdto.setTask_id(taskid); + instdto.setTask_code(taskcode); + instdto.setVehicle_code(vehiclecode); + String now = DateUtil.now(); + instdto.setCreate_time(now); + instdto.setCreate_by("auto"); + instdto.setStart_device_code(start_device_code); + instdto.setNext_device_code(next_device_code); + instdto.setStart_point_code(start_point_code); + instdto.setNext_point_code(next_point_code); + instdto.setPriority(priority); + instdto.setInstruction_status("0"); + instdto.setExecute_device_code(start_point_code); + try { + instructionService.create(instdto); + } catch (Exception e) { + e.printStackTrace(); + log.error("指令创建失败!", e.getMessage()); + return false; + } + //创建指令后修改任务状态 + taskdto.setTask_status("1"); + taskserver.update(taskdto); + requireSucess = true; + String next_addr = nextdevice.getExtraValue().get("address").toString(); + + List list = new ArrayList(); + Map map = new HashMap(); + map.put("code", "to_target"); + map.put("value", next_addr); + list.add(map); + Map map2 = new HashMap(); + map2.put("code", "to_task"); + map2.put("value", instdto.getInstruction_code()); + list.add(map2); + Map map3 = new HashMap(); + map3.put("code", "to_command"); + map3.put("value", "1"); + list.add(map3); + try { + this.writing(list); + } catch (Exception e) { + logServer.deviceExecuteLog(device_code, "", "", "下发指令:" + instdto.getInstruction_code() + + ",指令起点:" + instdto.getStart_device_code() + + ",指令终点:" + instdto.getNext_device_code() + ",根据指令下发信号失败" + e.getMessage()); + if (ObjectUtil.isEmpty(instructionService.findByTaskcodeAndStatus(taskdto.getTask_code()))) { + requireSucess = false; + return false; + } + } + } else { + //如果不存在则直接找对应指令 + Instruction inst = instructionService.findByDeviceCodeFromCache(this.device_code); + if (ObjectUtil.isEmpty(inst)) { + return false; + } + //当起点为行架任务的时候不需要请求下发 + if (StrUtil.equals(inst.getInstruction_type(), "6") || StrUtil.equals(inst.getInstruction_type(), "9")) { + return false; + } + Device nextdevice = deviceAppservice.findDeviceByCode(inst.getNext_device_code()); + String next_addr = nextdevice.getExtraValue().get("address").toString(); + if (StrUtil.equals(next_addr, "0")) { + if (StrUtil.isNotEmpty(inst.getTo_z())) { + if (StrUtil.equals(inst.getTo_z(), "01")) { + next_addr = "102"; + } else if (StrUtil.equals(inst.getTo_z(), "02")) { + next_addr = "201"; + } else if (StrUtil.equals(inst.getTo_z(), "03")) { + next_addr = "301"; + } + } + } + List list = new ArrayList(); + Map map = new HashMap(); + map.put("code", "to_target"); + map.put("value", next_addr); + list.add(map); + Map map2 = new HashMap(); + map2.put("code", "to_task"); + map2.put("value", inst.getInstruction_code()); + list.add(map2); + Map map3 = new HashMap(); + map3.put("code", "to_command"); + map3.put("value", "1"); + list.add(map3); + try { + this.writing(list); + } catch (Exception e) { + logServer.deviceExecuteLog(device_code, "", "", "下发指令:" + inst.getInstruction_code() + + ",指令起点:" + inst.getStart_device_code() + + ",指令终点:" + inst.getNext_device_code() + ",根据指令下发信号失败" + e.getMessage()); + if (ObjectUtil.isEmpty(instructionService.findByTaskcodeAndStatus(taskdto.getTask_code()))) { + requireSucess = false; + return false; + } + } + requireSucess = true; + return true; + } + return true; + } + } + + //申请捆扎 + @SneakyThrows + public synchronized void applyLaStrangulation(String mode) { + Date date = new Date(); + if (date.getTime() - this.require_apply_strangulation_time.getTime() < (long) this.instruction_require_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + return; + } else { + this.require_apply_strangulation_time = date; + String vehicle_code = ""; + if (StrUtil.isNotEmpty(hand_barcode)) { + vehicle_code = hand_barcode; + } else { + if (task > 0) { + Instruction instruction = checkInst(); + if (ObjectUtil.isEmpty(instruction)) { + message = "申请捆扎电气设备任务号:" + task + "未找到对应指令"; + logServer.deviceExecuteLog(device_code, "", "", "申请捆扎电气设备任务号:" + task + "未找到对应指令"); + return; + } + vehicle_code = instruction.getVehicle_code(); + } else { + logServer.deviceExecuteLog(device_code, "", "", "申请捆扎电气设备任务号:" + task + "异常"); + message = "申请捆扎电气设备任务号:" + task + "异常"; + return; + } + if (StrUtil.isEmpty(vehicle_code)) { + logServer.deviceExecuteLog(device_code, "", "", "申请捆扎电气设备任务号:" + task + "未找到载具号"); + message = "申请捆扎电气设备任务号:" + task + "未找到载具号"; + return; + } + } + ApplyLabelingAndBindingRequest applyLabelingAndBindingRequest = + new ApplyLabelingAndBindingRequest(); + JSONObject device_json = WQLObject.getWQLObject("acs_storage_cell").query("storage_code ='" + this.device_code + "'").uniqueResult(0); + String start_point_code = null; + if (!ObjectUtil.isEmpty(device_json)) { + start_point_code = (String) device_json.get("parent_storage_code") == null ? this.device_code : (String) device_json.get("parent_storage_code"); + } + applyLabelingAndBindingRequest.setDevice_code(start_point_code); + applyLabelingAndBindingRequest.setType("2"); + applyLabelingAndBindingRequest.setVehicle_code(vehicle_code); + if (StrUtil.equals(mode, "9")) { + applyLabelingAndBindingRequest.setIs_bind("0"); + } else { + applyLabelingAndBindingRequest.setIs_bind("1"); + } + logServer.deviceExecuteLog(this.device_code, "", "", "申请捆扎,请求参数:" + applyLabelingAndBindingRequest); + ApplyLabelingAndBindingResponse applyLabelingAndBindingResponse = acsToWmsService.applyLabelingAndBindingRequest(applyLabelingAndBindingRequest); + if (applyLabelingAndBindingResponse.getstatus() == 200) { + if (ObjectUtil.isNotEmpty(applyLabelingAndBindingResponse.getData())) { + Map datas = applyLabelingAndBindingResponse.getData(); + String length = datas.get("box_length").toString(); + String width = datas.get("box_width").toString(); + String box_high = datas.get("box_high").toString(); + String bundle_times = datas.get("bundle_times").toString(); + + List list = new ArrayList(); + Map map = new HashMap(); + map.put("code", "to_length"); + map.put("value", length); + list.add(map); + Map map2 = new HashMap(); + map2.put("code", "to_weight"); + map2.put("value", width); + list.add(map2); + Map map3 = new HashMap(); + map3.put("code", "to_height"); + map3.put("value", box_high); + list.add(map3); + Map map4 = new HashMap(); + map4.put("code", "to_strap_times"); + map4.put("value", bundle_times); + list.add(map4); + Map map5 = new HashMap(); + map5.put("code", "to_command"); + map5.put("value", mode); + list.add(map5); + this.writing(list); +// this.writing(list); + logServer.deviceExecuteLog(this.device_code, "", "", "申请捆扎,返回参数:" + applyLabelingAndBindingResponse); + message = "申请捆扎成功"; + //requireSucess = true; + } else { + message = "未返回尺寸信息"; + logServer.deviceExecuteLog(this.device_code, "", "", "申请捆扎,返回参数:" + applyLabelingAndBindingResponse); + } + + } else { + message = applyLabelingAndBindingResponse.getMessage(); + logServer.deviceExecuteLog(this.device_code, "", "", "申请捆扎,返回参数:" + applyLabelingAndBindingResponse); + } + + } + } + + + public synchronized void emptyIn() { + Date date = new Date(); + if (date.getTime() - this.require_empty_in_time.getTime() < (long) this.instruction_require_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + return; + } else { + this.require_empty_in_time = date; + + if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { + +// if(taskserver.querySameOriginTask(this.device_code) > 0 ){ +// message = "已存在空盘出库任务不再请求"; +// return; +// } + + JSONObject apply = new JSONObject(); + apply.put("device_code", device_code); + apply.put("type", "2"); + String str = acsToWmsService.applyTaskToWms(apply); + logServer.deviceExecuteLog(this.device_code, "", "", "申请空盘入库,请求参数:" + apply + ",响应参数:" + JSON.toJSONString(str)); + message = "申请空盘入库任务,请求参数:" + apply + "响应参数: " + str; + + JSONObject jo = JSON.parseObject(str); + if (ObjectUtil.isEmpty(jo)) { + message = "申请空盘入库接口不通"; + logServer.deviceExecuteLog(this.device_code, "", "", "申请空盘入库接口不通"); + } else { + if (jo.getInteger("status") == 200) { + message = "申请空盘入库成功"; + requireEmptyInSuccess = true; + } else { + message = "申请空盘入库失败," + jo.get("message").toString(); + logServer.deviceExecuteLog(this.device_code, "", "", message); + } + } + } + } + } + + public synchronized void applyAgvTask() { + Date date = new Date(); + if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + return; + } else { + this.instruction_require_time = date; + if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { + //判断是否有手动补码 如果有就申请补码agv任务 + if (StrUtil.isNotEmpty(hand_barcode)) { + message = "申请补码AGV搬运任务中..."; + JSONObject apply = new JSONObject(); + apply.put("device_code", device_code); + apply.put("type", "4"); + apply.put("vehicle_code", hand_barcode); + + String str = acsToWmsService.applyTaskToWms(apply); + logServer.deviceExecuteLog(this.device_code, "", "", "申请AGV任务,请求参数:" + apply + ",响应参数," + str); + + JSONObject jo = JSON.parseObject(str); + if (ObjectUtil.isEmpty(jo)) { + message = "申请补码AGV搬运任务接口不通"; + } else { + if (jo.getInteger("status") == 200) { + message = "申请补码AGV搬运任务成功"; + List list = new ArrayList(); + while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".to_command").toString() + , "8")) { + this.writing(list); + logServer.deviceExecuteLog(device_code, "", "", "再次下发mode信号"); + try { + Thread.sleep(500); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + logServer.deviceExecuteLog(this.device_code, "", "", "申请补码AGV任务,返回参数:" + jo); + requireSucess = true; + } else { + message = "申请补码AGV搬运任务失败," + jo.get("message").toString(); + } + } + return; + } + //没有就正常申请agv任务 + Instruction instruction = instructionService.findByCode(String.valueOf(task)); + if (ObjectUtil.isEmpty(instruction)) { + message = "指令号" + task + "未找到对应指令"; + return; + } + if (StrUtil.isEmpty(instruction.getVehicle_code())) { + message = "指令号" + task + "未找到对应木箱号"; + return; + } + + message = "申请AGV搬运任务中..."; + JSONObject apply = new JSONObject(); + apply.put("device_code", device_code); + apply.put("type", "4"); + apply.put("vehicle_code", instruction.getVehicle_code()); + + String str = acsToWmsService.applyTaskToWms(apply); + logServer.deviceExecuteLog(this.device_code, "", "", "申请AGV任务,请求参数:" + apply + ",响应参数"); + + JSONObject jo = JSON.parseObject(str); + if (ObjectUtil.isEmpty(jo)) { + message = "申请AGV搬运任务接口不通"; +// requireSucess = true; + } else { + if (jo.getInteger("status") == 200) { + message = "申请AGV搬运任务成功"; + List list = new ArrayList(); + Map map = new HashMap(); + map.put("code", "to_command"); + map.put("value", "8"); + list.add(map); + this.writing(list); + while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".to_command").toString() + , "8")) { + this.writing(list); + logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发mode信号"); + try { + Thread.sleep(500); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + logServer.deviceExecuteLog(this.device_code, "", "", "申请AGV任务,返回参数:" + jo); + requireSucess = true; + } else { + message = "申请AGV搬运任务失败," + jo.get("message").toString(); + } + } + + } + } + } + + public synchronized void emptyOut() { + Date date = new Date(); + if (date.getTime() - this.require_empty_out_time.getTime() < (long) this.instruction_require_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + return; + } else { + this.require_empty_out_time = date; + if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { +// if (taskserver.querySameDestinationTask(this.device_code) > 0) { +// message = "已存在空盘出库任务不再请求"; +// return; +// } + message = "申请空盘出库任务中..."; + JSONObject apply = new JSONObject(); + apply.put("device_code", device_code); + apply.put("type", "3"); + String str = acsToWmsService.applyTaskToWms(apply); + JSONObject jo = JSON.parseObject(str); + if (ObjectUtil.isEmpty(jo)) { + message = "申请空盘出库接口不通"; + requireSucess = true; + } else { + if (jo.getInteger("status") == 200) { + message = "申请空盘出库成功"; + requireSucess = true; + } else { + message = "申请空盘出库失败," + jo.get("message").toString(); + } + } + + } + } + } + + /** + * 更新指令状态 + */ + public synchronized void update_instruction_status() throws Exception { + Date date = new Date(); + if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out); + + } else { + this.instruction_update_time = date; + inst = checkInst(); + if (inst != null) { + inst_message = "当前指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code(); + vehicle_code = inst.getVehicle_code(); + task_code = inst.getTask_code(); + if (StrUtil.equals(inst.getInstruction_status(), "0") && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) { + inst.setInstruction_status("1"); + inst.setExecute_device_code(this.device_code); + instructionService.update(inst); + logServer.deviceExecuteLog(device_code, "", "", "入库输送线任务开始反馈执行中状态,反馈成功,指令号:" + task + ",载具号:" + inst.getVehicle_code()); + } + if (StrUtil.equals(inst.getInstruction_status(), "1") || StrUtil.equals(inst.getInstruction_status(), "0")) { + if (StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) { + vehicle_code = inst.getVehicle_code(); + inst.setExecute_device_code(this.device_code); + if (mode == 2) { + finish_instruction(); + } + logServer.deviceExecuteLog(device_code, "", "", "入库输送线任务开始反馈完成状态,反馈成功,指令号:" + task + ",载具号:" + inst.getVehicle_code()); + } else { + + } + } + } else { +// message = "输送线任务反馈状态,查询不到指令号:" + task +"指令已完成"; + inst_message = null; + } + + } + } + + public Instruction checkInst() { + if (ObjectUtil.isNotEmpty(this.inst)) { + if (this.task > 0) { + if (this.inst.getInstruction_code().equals(String.valueOf(this.task))) { + return this.inst; + } else { + inst = instructionService.findByCodeFromCache(String.valueOf(task)); + return inst; + } + } + } else { + inst = instructionService.findByCodeFromCache(String.valueOf(task)); + return inst; + } + return null; + } +} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java index e4228194d..1022cafa8 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java @@ -39,6 +39,7 @@ import org.nl.acs.device_driver.basedriver.siemens_conveyor.SiemensConveyorDevic import org.nl.acs.device_driver.basedriver.siemens_conveyor_ckk.SiemensConveyorCkkDeviceDriver; import org.nl.acs.device_driver.basedriver.siemens_conveyor_labeling.SiemensConveyorLabelingDeviceDriver; import org.nl.acs.device_driver.basedriver.siemens_onefloor_agv_conveyor.SiemensOneFloorAGVConveyorDeviceDriver; +import org.nl.acs.device_driver.basedriver.siemens_weigh_conveyor.SiemensWeightConveyorDeviceDriver; import org.nl.acs.device_driver.basedriver.slit_two_manipulator.SlitTwoManipulatorDeviceDriver; import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver; import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDefination; @@ -265,6 +266,9 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { CasingStationConveyorDeviceDriver casingStationConveyorDeviceDriver; //RGV RgvDeviceDriver rgvDeviceDriver; + //西门子-输送机称重驱动 + SiemensWeightConveyorDeviceDriver siemensWeightConveyorDeviceDriver; + if (datas.size() == 0) { throw new BadRequestException("缺少输入参数!"); @@ -498,6 +502,14 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { // jo.put("task2", driver.getTask2()); jo.put("error", driver.getError()); jo.put("error_msg", driver.getError() == 0 ? "" : ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(driver.getError()))); + }else if (device.getDeviceDriver() instanceof SiemensWeightConveyorDeviceDriver) { + siemensWeightConveyorDeviceDriver = (SiemensWeightConveyorDeviceDriver) device.getDeviceDriver(); + jo.put("device_code", siemensWeightConveyorDeviceDriver.getDevice().getDevice_code()); + jo.put("device_name", siemensWeightConveyorDeviceDriver.getDevice().getDevice_name()); + jo.put("mode", siemensWeightConveyorDeviceDriver.getMode()); + jo.put("move", siemensWeightConveyorDeviceDriver.getMove()); + jo.put("error", siemensWeightConveyorDeviceDriver.getError()); + jo.put("weight", siemensWeightConveyorDeviceDriver.getWeight()); } else { jo.put("device_code", parent_device_code); } diff --git a/acs/nladmin-ui/src/views/acs/device/config.vue b/acs/nladmin-ui/src/views/acs/device/config.vue index 9b4b5a250..e751fa848 100644 --- a/acs/nladmin-ui/src/views/acs/device/config.vue +++ b/acs/nladmin-ui/src/views/acs/device/config.vue @@ -89,6 +89,7 @@ import agv_ndc_two from '@/views/acs/device/driver/agv/agv_ndc_two' import box_palletizing_manipulator from '@/views/acs/device/driver/box_palletizing_manipulator' import oven_manipulator from '@/views/acs/device/driver/oven_manipulator' import siemens_conveyor from '@/views/acs/device/driver/siemens_conveyor' +import siemens_weight_conveyor from '@/views/acs/device/driver/siemens_weight_conveyor' import slit_two_manipulator from '@/views/acs/device/driver/slit_two_manipulator' import hongxiang_device from '@/views/acs/device/driver/hongxiang_device' import hongxiang_conveyor from '@/views/acs/device/driver/hongxiang_conveyor' @@ -126,6 +127,7 @@ export default { hongxiang_device, hongxiang_conveyor, box_palletizing_manipulator, + siemens_weight_conveyor, oven_manipulator, siemens_conveyor, slit_two_manipulator, diff --git a/acs/nladmin-ui/src/views/acs/device/driver/siemens_weight_conveyor.vue b/acs/nladmin-ui/src/views/acs/device/driver/siemens_weight_conveyor.vue new file mode 100644 index 000000000..1d3381c43 --- /dev/null +++ b/acs/nladmin-ui/src/views/acs/device/driver/siemens_weight_conveyor.vue @@ -0,0 +1,559 @@ + + + + + diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/AgvWaitUtil.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/AgvWaitUtil.java index fc61d1dde..8f13cbc42 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/AgvWaitUtil.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/AgvWaitUtil.java @@ -9,7 +9,9 @@ import lombok.extern.slf4j.Slf4j; import org.nl.acs.device.domain.Device; import org.nl.acs.device.service.DeviceService; import org.nl.acs.device_driver.conveyor.standard_inspect_site.StandardInspectSiteDeviceDriver; +import org.nl.acs.device_driver.one_conveyor.box_subvolumes_conveyor.BoxSubvolumesConveyorDeviceDriver; import org.nl.acs.device_driver.one_manipulator.box_storage_manipulator.BoxStorageManipulatorDeviceDriver; +import org.nl.acs.device_driver.two_conveyor.manipulator_agv_station.ManipulatorAgvStationDeviceDriver; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.instruction.domain.Instruction; import org.nl.acs.instruction.service.InstructionService; @@ -32,6 +34,7 @@ public class AgvWaitUtil { AcsToWmsService acsToWmsService; @Autowired + @Lazy InstructionService instructionService; @Autowired @@ -41,15 +44,21 @@ public class AgvWaitUtil { public JSONObject waitInGet(String startDeviceCode, Instruction inst) { log.info("仙工AGV请求取货,设备号 - {}", startDeviceCode); Device startDevice = deviceAppService.findDeviceByCode(startDeviceCode); - StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; - if(startDevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){ - standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startDevice.getDeviceDriver(); - if(standardInspectSiteDeviceDriver.getError() != 0){ - JSONObject map = new JSONObject(); - map.put("status", 500); - map.put("message", "不允许取货!"); - log.info("不允许仙工AGV取货,烘箱对接位有报警,设备号 - {}", startDeviceCode); - return map; + ManipulatorAgvStationDeviceDriver manipulatorAgvStationDeviceDriver; + BoxSubvolumesConveyorDeviceDriver boxSubvolumesConveyorDeviceDriver; + //agv诺宝对接位安全信号交互 + if(startDevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver){ + manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) startDevice.getDeviceDriver(); + manipulatorAgvStationDeviceDriver.writing(2); + if(manipulatorAgvStationDeviceDriver.getAction() != 1){ + throw new BadRequestException("上位系统不允许取货"); + } + } + //agv叉车对接位安全信号交互 + if(startDevice.getDeviceDriver() instanceof BoxSubvolumesConveyorDeviceDriver){ + boxSubvolumesConveyorDeviceDriver = (BoxSubvolumesConveyorDeviceDriver) startDevice.getDeviceDriver(); + if(boxSubvolumesConveyorDeviceDriver.getMode() != 2){ + throw new BadRequestException("上位系统不允许取货"); } } JSONObject map = new JSONObject(); @@ -75,15 +84,13 @@ public class AgvWaitUtil { public JSONObject waitInPut(String endDeviceCode, Instruction inst) { log.info("仙工AGV请求放货,设备号 - {}", endDeviceCode); Device endDevice = deviceAppService.findDeviceByCode(endDeviceCode); - StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; - if(endDevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){ - standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) endDevice.getDeviceDriver(); - if(standardInspectSiteDeviceDriver.getError() != 0){ - JSONObject map = new JSONObject(); - map.put("status", 500); - map.put("message", "不允许放货!"); - log.info("不允许仙工AGV放货,烘箱对接位有报警,设备号 - {}", endDeviceCode); - return map; + ManipulatorAgvStationDeviceDriver manipulatorAgvStationDeviceDriver; + if(endDevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver){ + manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) endDevice.getDeviceDriver(); + manipulatorAgvStationDeviceDriver.writing(2); + if(manipulatorAgvStationDeviceDriver.getAction() != 1){ + log.info("不允许仙工AGV取货,对接位有报警,设备号 - {}", endDevice); + throw new BadRequestException("上位系统不允许取货"); } } JSONObject map = new JSONObject(); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/QueryAGVStatus.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/QueryAGVStatus.java index 8588c6eaf..a754c6ce6 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/QueryAGVStatus.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/QueryAGVStatus.java @@ -13,11 +13,13 @@ import lombok.extern.slf4j.Slf4j; import org.nl.acs.AcsConfig; import org.nl.acs.instruction.domain.Instruction; import org.nl.acs.instruction.service.InstructionService; +import org.nl.acs.task.enums.AgvSystemTypeEnum; import org.nl.config.SpringContextHolder; import org.nl.system.service.param.ISysParamService; import org.springframework.stereotype.Component; import java.util.List; +import java.util.stream.Collectors; /** * 定时查询AGV状态 @@ -30,48 +32,47 @@ public class QueryAGVStatus { InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); ISysParamService paramService = SpringContextHolder.getBean(ISysParamService.class); List allInstFromCache = instructionService.findAllInstFromCache(); - if(CollUtil.isEmpty(allInstFromCache) || allInstFromCache.size() < 1){ + List agvInstruction = allInstFromCache.stream().filter(item -> AgvSystemTypeEnum.One_NDC_System_Type.getIndex().equals(item.getAgv_system_type()) || AgvSystemTypeEnum.XG_System_Type.getIndex().equals(item.getAgv_system_type())).collect(Collectors.toList()); + if (CollUtil.isEmpty(agvInstruction) || agvInstruction.size() < 1) { return; } - for (Instruction instruction : allInstFromCache) { - if ("4".equals(instruction.getInstruction_type())) { - String agvurl =paramService.findByCode(AcsConfig.AGVURL).getValue(); - String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue(); - JSONObject param = new JSONObject(); - agvurl = agvurl + ":" + agvport + "/" + instruction.getInstruction_code(); - log.info("根据运单号查询运单状态的请求:{}", agvurl); - HttpResponse result = HttpRequest.get(agvurl) - .timeout(20000)//超时,毫秒 - .execute(); - log.info("根据运单号查询运单状态的请求反馈:{}", result); - String body = result.body(); - JSONObject json = JSONObject.parseObject(body); - if(result.getStatus() == 200 && json.getString("id").equals(instruction.getInstruction_code())){ - // 已创建=CREATED, - // 待分配=TOBEDISPATCHED, - // 正在执行=RUNNING, - // 完成=FINISHED, - // 失败=FAILED(主动失败), - // 终止=STOPPED(被人为终止), - // 无法执行=Error(参数错误), - // 等待=WAITING - //执行中 - String state = json.getString("state"); - if ("RUNNING".equals(state) || "CREATED".equals(state) || "TOBEDISPATCHED".equals(state) || "WAITING".equals(state)) { - instruction.setInstruction_status("1"); - instructionService.update(instruction); - } else if ("FINISHED".equals(state)) { - instruction.setInstruction_status("2"); - try { - instructionService.finish(instruction); - } catch (Exception e) { - log.error("执行完成,但无法更新状态,可能由于参数错误导致的异常"); - e.printStackTrace(); - } - } else if ("STOPPED".equals(state) || "FAILED".equals(state) || "Error".equals(state)) { - instruction.setInstruction_status("1"); - instructionService.update(instruction); + for (Instruction instruction : agvInstruction) { + String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue(); + String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue(); + JSONObject param = new JSONObject(); + agvurl = agvurl + ":" + agvport + "/orderDetails/" + instruction.getInstruction_code(); + log.info("根据运单号查询运单状态的请求:{}", agvurl); + HttpResponse result = HttpRequest.get(agvurl) + .timeout(20000)//超时,毫秒 + .execute(); + log.info("根据运单号查询运单状态的请求反馈:{}", result); + String body = result.body(); + JSONObject json = JSONObject.parseObject(body); + if (result.getStatus() == 200 && json.getString("id").equals(instruction.getInstruction_code())) { + // 已创建=CREATED, + // 待分配=TOBEDISPATCHED, + // 正在执行=RUNNING, + // 完成=FINISHED, + // 失败=FAILED(主动失败), + // 终止=STOPPED(被人为终止), + // 无法执行=Error(参数错误), + // 等待=WAITING + //执行中 + String state = json.getString("state"); + if ("RUNNING".equals(state) || "CREATED".equals(state) || "TOBEDISPATCHED".equals(state) || "WAITING".equals(state)) { + instruction.setInstruction_status("1"); + instructionService.update(instruction); + } else if ("FINISHED".equals(state)) { + instruction.setInstruction_status("2"); + try { + instructionService.finish(instruction); + } catch (Exception e) { + log.error("执行完成,但无法更新状态,可能由于参数错误导致的异常"); + e.printStackTrace(); } + } else if ("STOPPED".equals(state) || "FAILED".equals(state) || "Error".equals(state)) { + instruction.setInstruction_status("1"); + instructionService.update(instruction); } } } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/rest/XianGongAgvController.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/rest/XianGongAgvController.java index 063da5b90..b1b998064 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/rest/XianGongAgvController.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/rest/XianGongAgvController.java @@ -1,5 +1,6 @@ package org.nl.acs.agv.rest; +import cn.dev33.satoken.annotation.SaIgnore; import com.alibaba.fastjson.JSONObject; import groovy.lang.Lazy; import org.nl.acs.agv.server.XianGongAgvService; @@ -22,8 +23,9 @@ public class XianGongAgvController { @Autowired private XianGongAgvService xianGongAgentService; - @PostMapping("/waitPointRequest") + @PostMapping("/api/agv/xg/waitPointRequest") @Log("仙工AGV请求取放货") + @SaIgnore public ResponseEntity xgAGVWaitPointRequest(@RequestBody JSONObject requestParam) { return new ResponseEntity<>(xianGongAgentService.xgAGVWaitPointRequest(requestParam), HttpStatus.OK); } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/XianGongAgvService.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/XianGongAgvService.java index 433cdc6d4..be1d60f43 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/XianGongAgvService.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/XianGongAgvService.java @@ -4,6 +4,7 @@ import cn.hutool.http.HttpResponse; import com.alibaba.fastjson.JSONObject; import org.nl.acs.agv.server.dto.AgvDto; import org.nl.acs.instruction.domain.Instruction; +import org.nl.acs.instruction.service.dto.InteractionJsonDTO; import java.util.Map; @@ -117,8 +118,10 @@ public interface XianGongAgvService { /** * 下发叉车运单 + * * @param dto + * @param interactionJsonDTO * @return */ - HttpResponse sendOrderSequencesToForklift(Instruction dto); + HttpResponse sendOrderSequencesToForklift(Instruction dto, InteractionJsonDTO interactionJsonDTO); } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java index 9e832859b..cf2c55423 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java @@ -14,13 +14,13 @@ import org.nl.acs.agv.AgvUtil; import org.nl.acs.agv.AgvWaitUtil; import org.nl.acs.agv.server.XianGongAgvService; import org.nl.acs.agv.server.dto.AgvDto; -import org.nl.acs.angle.domain.AcsPointAngle; import org.nl.acs.angle.service.IAcsPointAngleService; import org.nl.acs.common.base.CommonFinalParam; import org.nl.acs.device.domain.Device; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.instruction.domain.Instruction; import org.nl.acs.instruction.service.InstructionService; +import org.nl.acs.instruction.service.dto.InteractionJsonDTO; import org.nl.acs.opc.DeviceAppService; import org.nl.acs.device.enums.DeviceType; import org.nl.common.exception.BadRequestException; @@ -32,7 +32,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; -import java.math.BigDecimal; import java.util.Arrays; import java.util.HashMap; import java.util.List; @@ -259,7 +258,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { jo.put("priority", inst.getPriority()); LuceneLogDto logDto = LuceneLogDto.builder() .device_code("下发诺宝运单") - .content("任务号:"+inst.getTask_code()+",指令号:"+inst.getInstruction_code()+",下发agv订单序列参数:"+jo) + .content("任务号:" + inst.getTask_code() + ",指令号:" + inst.getInstruction_code() + ",下发agv订单序列参数:" + jo) .build(); logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); @@ -280,7 +279,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { .execute(); LuceneLogDto logDto1 = LuceneLogDto.builder() .device_code("诺宝运单响应") - .content("任务号:"+inst.getTask_code()+",指令号:"+inst.getInstruction_code()+",下发诺宝订单序列反馈参数:"+jo) + .content("任务号:" + inst.getTask_code() + ",指令号:" + inst.getInstruction_code() + ",下发诺宝订单序列反馈参数:" + jo) .build(); logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto1); @@ -326,70 +325,38 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { /** * 下发取货信号 + * * @param ja - * @param pointCode 起始点位 + * @param pointCode 起始点位 * @param device_code 起始设备 - * @param instCode 指令号 + * @param instCode 指令号 */ public void sendStartDeviceOrder(JSONArray ja, String pointCode, String device_code, String instCode) { Device startDevice = deviceAppService.findDeviceByCode(device_code); - //忽略取货校验 - if ("true".equals(startDevice.getExtraValue().get("ignore_pickup_check"))) { - //取货前等待 - JSONObject jo = new JSONObject(); - //动作块id - jo.put("blockId", IdUtil.simpleUUID()); - //目的地名称 - jo.put("location", pointCode + "INGET"); - //执行脚本 - jo.put("operation", "script"); - jo.put("id", pointCode + "INGET"); - //通信脚本,动作前后与现场设备交互的场景 - jo.put("script_name", "userpy/interact.py"); - JSONObject script_args = new JSONObject(); - //更改为现场设备IP及PORT - script_args.put("addr", addr); - JSONObject data = new JSONObject(); - JSONObject reach = new JSONObject(); - reach.put("task_code", instCode); - reach.put("address", pointCode + "INGET"); - data.put("reach", reach); - script_args.put("data", data); - script_args.put("protocol", "HTTP"); - jo.put("script_args", script_args); - ja.add(jo); - } - JSONObject jo3 = new JSONObject(); + //取货前等待 + JSONObject jo = new JSONObject(); //动作块id - jo3.put("blockId", IdUtil.simpleUUID()); + jo.put("blockId", IdUtil.simpleUUID()); //目的地名称 - jo3.put("location", pointCode + "INGET"); - jo3.put("id", pointCode + "INGET"); + jo.put("location", pointCode + "INGET"); //执行脚本 - jo3.put("operation", "expand"); + jo.put("operation", "script"); + jo.put("id", pointCode + "INGET"); //通信脚本,动作前后与现场设备交互的场景 - jo3.put("script_name", "Fork-expand.py"); + jo.put("script_name", "userpy/interact.py"); JSONObject script_args = new JSONObject(); - script_args.put("expandWidth", 0.2); - script_args.put("operation", "expand"); - jo3.put("script_args", script_args); - ja.add(jo3); + //更改为现场设备IP及PORT + script_args.put("addr", addr); + JSONObject data = new JSONObject(); + JSONObject reach = new JSONObject(); + reach.put("task_code", instCode); + reach.put("address", pointCode + "INGET"); + data.put("reach", reach); + script_args.put("data", data); + script_args.put("protocol", "HTTP"); + jo.put("script_args", script_args); + ja.add(jo); - JSONObject jo4 = new JSONObject(); - //动作块id - jo4.put("blockId", IdUtil.simpleUUID()); - //目的地名称 - jo4.put("location", pointCode + "INGET"); - jo4.put("id", pointCode + "INGET"); - //执行脚本 - jo4.put("operation", "stretch"); - //通信脚本,动作前后与现场设备交互的场景 - jo4.put("script_name", "Fork-expand.py"); - JSONObject script_args1 = new JSONObject(); - script_args1.put("expandWidth", 0.2); - script_args1.put("operation", "stretch"); - jo4.put("script_args", script_args1); - ja.add(jo4); //将货物顶起来,机器识别提升高度 JSONObject jo1 = new JSONObject(); @@ -401,59 +368,57 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { }}); ja.add(jo1); - //取货完成等待 - if ("true".equals(startDevice.getExtraValue().get("ignore_pickup_check"))) { - JSONObject jo2 = new JSONObject(); - jo2.put("blockId", IdUtil.simpleUUID()); - jo2.put("location", pointCode + "OUTGET"); - jo2.put("operation", "script"); - jo2.put("id", pointCode + "OUTGET"); - jo2.put("script_name", "userpy/interact.py"); - JSONObject script_args2 = new JSONObject(); - script_args2.put("addr", addr); - JSONObject data2 = new JSONObject(); - JSONObject reach2 = new JSONObject(); - reach2.put("task_code", instCode); - reach2.put("address", pointCode + "OUTGET"); - data2.put("reach", reach2); - script_args2.put("data", data2); - script_args2.put("protocol", "HTTP"); - jo2.put("script_args", script_args2); - ja.add(jo2); - } + + JSONObject jo2 = new JSONObject(); + jo2.put("blockId", IdUtil.simpleUUID()); + jo2.put("location", pointCode + "OUTGET"); + jo2.put("operation", "script"); + jo2.put("id", pointCode + "OUTGET"); + jo2.put("script_name", "userpy/interact.py"); + JSONObject script_args2 = new JSONObject(); + script_args2.put("addr", addr); + JSONObject data2 = new JSONObject(); + JSONObject reach2 = new JSONObject(); + reach2.put("task_code", instCode); + reach2.put("address", pointCode + "OUTGET"); + data2.put("reach", reach2); + script_args2.put("data", data2); + script_args2.put("protocol", "HTTP"); + jo2.put("script_args", script_args2); + ja.add(jo2); } /** * 下发放货信号 + * * @param ja - * @param device_code 起始设备 - * @param instCode 指令号 - * @param pointCode 终点点位 + * @param device_code 起始设备 + * @param instCode 指令号 + * @param pointCode 终点点位 * @param nextDeviceCode 终点设备 */ public void sendEndDeviceOrder(JSONArray ja, String device_code, String instCode, String pointCode, String nextDeviceCode) { Device nextDevice = deviceAppService.findDeviceByCode(nextDeviceCode); - //忽略放货校验 - if ("true".equals(nextDevice.getExtraValue().get("ignore_release_check"))) { - //放货前等待 - JSONObject jo3 = new JSONObject(); - jo3.put("blockId", IdUtil.simpleUUID()); - jo3.put("location", pointCode + "INPUT"); - jo3.put("operation", "script"); - jo3.put("id", pointCode + "INPUT"); - jo3.put("script_name", "userpy/interact.py"); - JSONObject script_args3 = new JSONObject(); - script_args3.put("addr", addr); - JSONObject data3 = new JSONObject(); - JSONObject reach3 = new JSONObject(); - reach3.put("task_code", instCode); - reach3.put("address", pointCode + "INPUT"); - data3.put("reach", reach3); - script_args3.put("data", data3); - script_args3.put("protocol", "HTTP"); - jo3.put("script_args", script_args3); - ja.add(jo3); - } + + //放货前等待 + JSONObject jo3 = new JSONObject(); + jo3.put("blockId", IdUtil.simpleUUID()); + jo3.put("location", pointCode + "INPUT"); + jo3.put("operation", "script"); + jo3.put("id", pointCode + "INPUT"); + jo3.put("script_name", "userpy/interact.py"); + JSONObject script_args3 = new JSONObject(); + script_args3.put("addr", addr); + JSONObject data3 = new JSONObject(); + JSONObject reach3 = new JSONObject(); + reach3.put("task_code", instCode); + reach3.put("address", pointCode + "INPUT"); + data3.put("reach", reach3); + script_args3.put("data", data3); + script_args3.put("protocol", "HTTP"); + jo3.put("script_args", script_args3); + ja.add(jo3); + //放货前下发旋转角度 /*JSONObject json1 = new JSONObject(); @@ -478,27 +443,25 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { ja.add(jo4); - //忽略放货校验 - if ("true".equals(nextDevice.getExtraValue().get("ignore_release_check"))) { - //放货完成等待 - com.alibaba.fastjson.JSONObject jo5 = new com.alibaba.fastjson.JSONObject(); - jo5.put("blockId", IdUtil.simpleUUID()); - jo5.put("location", pointCode + "OUTPUT"); - jo5.put("operation", "script"); - jo5.put("id", pointCode + "OUTPUT"); - jo5.put("script_name", "userpy/interact.py"); - com.alibaba.fastjson.JSONObject script_args5 = new com.alibaba.fastjson.JSONObject(); - script_args5.put("addr", addr); - com.alibaba.fastjson.JSONObject data5 = new com.alibaba.fastjson.JSONObject(); - com.alibaba.fastjson.JSONObject reach5 = new com.alibaba.fastjson.JSONObject(); - reach5.put("task_code", instCode); - reach5.put("address", pointCode + "OUTPUT"); - data5.put("reach", reach5); - script_args5.put("data", data5); - script_args5.put("protocol", "HTTP"); - jo5.put("script_args", script_args5); - ja.add(jo5); - } + //放货完成等待 + com.alibaba.fastjson.JSONObject jo5 = new com.alibaba.fastjson.JSONObject(); + jo5.put("blockId", IdUtil.simpleUUID()); + jo5.put("location", pointCode + "OUTPUT"); + jo5.put("operation", "script"); + jo5.put("id", pointCode + "OUTPUT"); + jo5.put("script_name", "userpy/interact.py"); + com.alibaba.fastjson.JSONObject script_args5 = new com.alibaba.fastjson.JSONObject(); + script_args5.put("addr", addr); + com.alibaba.fastjson.JSONObject data5 = new com.alibaba.fastjson.JSONObject(); + com.alibaba.fastjson.JSONObject reach5 = new com.alibaba.fastjson.JSONObject(); + reach5.put("task_code", instCode); + reach5.put("address", pointCode + "OUTPUT"); + data5.put("reach", reach5); + script_args5.put("data", data5); + script_args5.put("protocol", "HTTP"); + jo5.put("script_args", script_args5); + ja.add(jo5); + } @@ -792,18 +755,18 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { } @Override - public HttpResponse sendOrderSequencesToForklift(Instruction inst) { + public HttpResponse sendOrderSequencesToForklift(Instruction inst, InteractionJsonDTO interactionJsonDTO) { com.alibaba.fastjson.JSONObject jo = new com.alibaba.fastjson.JSONObject(); jo.put("id", inst.getInstruction_code()); //运单封口,true=创建运单之后不可添加动作块;false=创建运单可以添加动作块 jo.put("complete", true); //动作块 - jo.put("blocks", createBlocksForklift(inst)); + jo.put("blocks", createBlocksForklift(inst,interactionJsonDTO)); //运单优先级 jo.put("priority", inst.getPriority()); LuceneLogDto logDto = LuceneLogDto.builder() .device_code("下发叉车运单") - .content("任务号:"+inst.getTask_code()+",指令号:"+inst.getInstruction_code()+",下发叉车订单序列参数:"+jo) + .content("任务号:" + inst.getTask_code() + ",指令号:" + inst.getInstruction_code() + ",下发叉车订单序列参数:" + jo) .build(); logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); @@ -824,7 +787,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { .execute(); LuceneLogDto logDto1 = LuceneLogDto.builder() .device_code("叉车运单响应") - .content("任务号:"+inst.getTask_code()+",指令号:"+inst.getInstruction_code()+",下发叉车订单序列反馈参数:"+jo) + .content("任务号:" + inst.getTask_code() + ",指令号:" + inst.getInstruction_code() + ",下发叉车订单序列反馈参数:" + jo) .build(); logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto1); @@ -838,134 +801,137 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { /** * 叉车运单动作块 + * * @param inst + * @param interactionJsonDTO * @return */ - private JSONArray createBlocksForklift(Instruction inst) { + private JSONArray createBlocksForklift(Instruction inst, InteractionJsonDTO interactionJsonDTO) { JSONArray ja = new JSONArray(); //起点 Device startDevice = deviceAppService.findDeviceByCode(inst.getStart_device_code()); - //忽略取货校验 - if ("true".equals(startDevice.getExtraValue().get("ignore_pickup_check"))) { - //取货前等待 - JSONObject jo = new JSONObject(); - //动作块id - jo.put("blockId", IdUtil.simpleUUID()); - //目的地名称 - jo.put("location", inst.getStart_point_code() + "INGET"); - //执行脚本 - jo.put("operation", "script"); - jo.put("id", inst.getStart_point_code() + "INGET"); - //通信脚本,动作前后与现场设备交互的场景 - jo.put("script_name", "userpy/interact.py"); - JSONObject script_args = new JSONObject(); - //更改为现场设备IP及PORT - script_args.put("addr", addr); - JSONObject data = new JSONObject(); - JSONObject reach = new JSONObject(); - reach.put("task_code", inst.getInstruction_code()); - reach.put("address", inst.getStart_point_code() + "INGET"); - data.put("reach", reach); - script_args.put("data", data); - script_args.put("protocol", "HTTP"); - jo.put("script_args", script_args); - ja.add(jo); - } - //货叉加载货物,会将叉车状态变成载货中 + String pointCode = inst.getStart_point_code(); + + + + //取货前等待 + JSONObject jo = new JSONObject(); + //动作块id + jo.put("blockId", IdUtil.simpleUUID()); + //目的地名称 + jo.put("location", pointCode + "INGET"); + //执行脚本 + jo.put("operation", "script"); + jo.put("id", pointCode + "INGET"); + //通信脚本,动作前后与现场设备交互的场景 + jo.put("script_name", "userpy/interact.py"); + JSONObject script_args = new JSONObject(); + //更改为现场设备IP及PORT + script_args.put("addr", addr); + JSONObject data = new JSONObject(); + JSONObject reach = new JSONObject(); + reach.put("task_code", inst.getInstruction_code()); + reach.put("address", pointCode + "INGET"); + data.put("reach", reach); + script_args.put("data", data); + script_args.put("protocol", "HTTP"); + jo.put("script_args", script_args); + ja.add(jo); + + JSONObject jo1 = new JSONObject(); jo1.put("blockId", IdUtil.simpleUUID()); - jo1.put("location", inst.getStart_point_code()); - jo1.put("operation", "ForkLoad"); - //行走高度 - jo1.put("start_height", "0.1"); - //取货高度 - jo1.put("end_height", inst.getStart_height()); - //升起信号 - jo1.put("operationArgs", new JSONObject() {{ - put("recognize", true); - }}); + jo1.put("location", inst.getStart_point_code()+ "INGET"); + jo1.put("binTask", "InForkHeight"); ja.add(jo1); - //取货完成等待 - if ("true".equals(startDevice.getExtraValue().get("ignore_pickup_check"))) { - JSONObject jo2 = new JSONObject(); - jo2.put("blockId", IdUtil.simpleUUID()); - jo2.put("location", inst.getStart_point_code() + "OUTGET"); - jo2.put("operation", "script"); - jo2.put("id", inst.getStart_point_code() + "OUTGET"); - jo2.put("script_name", "userpy/interact.py"); - JSONObject script_args2 = new JSONObject(); - script_args2.put("addr", addr); - JSONObject data2 = new JSONObject(); - JSONObject reach2 = new JSONObject(); - reach2.put("task_code", inst.getInstruction_code()); - reach2.put("address", inst.getStart_point_code() + "OUTGET"); - data2.put("reach", reach2); - script_args2.put("data", data2); - script_args2.put("protocol", "HTTP"); - jo2.put("script_args", script_args2); - ja.add(jo2); + JSONObject jo3 = new JSONObject(); + //动作块id + jo3.put("blockId", IdUtil.simpleUUID()); + //目的地名称 + jo3.put("location", pointCode + "INGET"); + jo3.put("id", pointCode + "INGET"); + //执行脚本 + jo3.put("operation", "expand"); + //通信脚本,动作前后与现场设备交互的场景 + jo3.put("script_name", "Fork-expand.py"); + JSONObject script_args2 = new JSONObject(); + if (ObjectUtil.isNotEmpty(interactionJsonDTO.getExpandWidthLength())) { + script_args2.put("expandWidth",interactionJsonDTO.getExpandWidthLength()); } + script_args2.put("operation", "expand"); + jo3.put("script_args", script_args2); + ja.add(jo3); - //起点 - Device nextDevice = deviceAppService.findDeviceByCode(inst.getNext_device_code()); - //忽略放货校验 - if ("true".equals(nextDevice.getExtraValue().get("ignore_release_check"))) { - //放货前等待 - JSONObject jo3 = new JSONObject(); - jo3.put("blockId", IdUtil.simpleUUID()); - jo3.put("location", inst.getNext_point_code() + "INPUT"); - jo3.put("operation", "script"); - jo3.put("id", inst.getNext_point_code() + "INPUT"); - jo3.put("script_name", "userpy/interact.py"); - JSONObject script_args3 = new JSONObject(); - script_args3.put("addr", addr); - JSONObject data3 = new JSONObject(); - JSONObject reach3 = new JSONObject(); - reach3.put("task_code", inst.getInstruction_code()); - reach3.put("address", inst.getNext_point_code() + "INPUT"); - data3.put("reach", reach3); - script_args3.put("data", data3); - script_args3.put("protocol", "HTTP"); - jo3.put("script_args", script_args3); - ja.add(jo3); + JSONObject jo4 = new JSONObject(); + //动作块id + jo4.put("blockId", IdUtil.simpleUUID()); + //目的地名称 + jo4.put("location", pointCode + "INGET"); + jo4.put("id", pointCode + "INGET"); + //执行脚本 + jo4.put("operation", "stretch"); + //通信脚本,动作前后与现场设备交互的场景 + jo4.put("script_name", "Fork-expand.py"); + JSONObject script_args1 = new JSONObject(); + if (ObjectUtil.isNotEmpty(interactionJsonDTO.getExpandWidthLength())) { + script_args2.put("stretchLength",interactionJsonDTO.getExpandWidthLength()); } + script_args1.put("operation", "stretch"); + jo4.put("script_args", script_args1); + ja.add(jo4); + JSONObject jo6 = new JSONObject(); + jo6.put("blockId", IdUtil.simpleUUID()); + jo6.put("location", inst.getStart_point_code()); + jo6.put("binTask", "Script"); + ja.add(jo6); - //ForkUnload(货叉卸载货物,会将叉车的状态变成非载货中) + JSONObject jo7 = new JSONObject(); + jo7.put("blockId", IdUtil.simpleUUID()); + jo7.put("location", inst.getStart_point_code()); + jo7.put("binTask", "ForkLoad"); + ja.add(jo7); + + //取货完成 JSONObject jo2 = new JSONObject(); jo2.put("blockId", IdUtil.simpleUUID()); - jo2.put("location", inst.getStart_point_code()); - jo2.put("operation", "ForkUnload"); - //行走高度 - jo2.put("start_height", "0.2"); - //放货高度 - jo2.put("end_height", inst.getNext_height()); + jo2.put("location", pointCode + "OUTGET"); + jo2.put("operation", "script"); + jo2.put("id", pointCode + "OUTGET"); + jo2.put("script_name", "userpy/interact.py"); + JSONObject script_args4 = new JSONObject(); + script_args4.put("addr", addr); + JSONObject data2 = new JSONObject(); + JSONObject reach2 = new JSONObject(); + reach2.put("task_code", inst.getInstruction_code()); + reach2.put("address", pointCode + "OUTGET"); + data2.put("reach", reach2); + script_args4.put("data", data2); + script_args4.put("protocol", "HTTP"); + jo2.put("script_args", script_args4); ja.add(jo2); - //忽略放货校验 - if ("true".equals(nextDevice.getExtraValue().get("ignore_release_check"))) { - //放货完成等待 - com.alibaba.fastjson.JSONObject jo5 = new com.alibaba.fastjson.JSONObject(); - jo5.put("blockId", IdUtil.simpleUUID()); - jo5.put("location", inst.getNext_point_code() + "OUTPUT"); - jo5.put("operation", "script"); - jo5.put("id", inst.getNext_point_code() + "OUTPUT"); - jo5.put("script_name", "userpy/interact.py"); - com.alibaba.fastjson.JSONObject script_args5 = new com.alibaba.fastjson.JSONObject(); - script_args5.put("addr", addr); - com.alibaba.fastjson.JSONObject data5 = new com.alibaba.fastjson.JSONObject(); - com.alibaba.fastjson.JSONObject reach5 = new com.alibaba.fastjson.JSONObject(); - reach5.put("task_code", inst.getInstruction_code()); - reach5.put("address", inst.getNext_point_code() + "OUTPUT"); - data5.put("reach", reach5); - script_args5.put("data", data5); - script_args5.put("protocol", "HTTP"); - jo5.put("script_args", script_args5); - ja.add(jo5); - } + //ForkUnload(货叉卸载货物,会将叉车的状态变成非载货中) + JSONObject jo8 = new JSONObject(); + jo8.put("blockId", IdUtil.simpleUUID()); + jo8.put("location", inst.getStart_point_code()+"OUTGET"); + jo8.put("binTask", "OutForkHeight"); + ja.add(jo8); + + JSONObject jo9 = new JSONObject(); + jo9.put("blockId", IdUtil.simpleUUID()); + jo9.put("location", inst.getNext_point_code()); + jo9.put("binTask", "ForkUnload"); + ja.add(jo9); + + JSONObject jo10 = new JSONObject(); + jo10.put("blockId", IdUtil.simpleUUID()); + jo10.put("location", inst.getNext_point_code()+"OUTPUT"); + jo10.put("binTask", "OutForkHeight"); + ja.add(jo10); return ja; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java index 04ddb23b1..d122e90d4 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java @@ -307,11 +307,11 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } catch (Exception e) { e.printStackTrace(); } - if (paperTubePickSiteDeviceDriver.getMove() > 0 && paperTubePickSiteDeviceDriver.getAction() == 1 + if (paperTubePickSiteDeviceDriver.getAction() == 1 && paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } else { - message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; + message = "设备号:" + device_code + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},设备状态{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction() , paperTubePickSiteDeviceDriver.getError(), paperTubePickSiteDeviceDriver.getMode(), ikey); } @@ -478,11 +478,11 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } catch (Exception e) { e.printStackTrace(); } - if (paperTubePickSiteDeviceDriver.getMove() == 0 && paperTubePickSiteDeviceDriver.getAction() == 1 + if (paperTubePickSiteDeviceDriver.getAction() == 1 && paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } else { - message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; + message = "设备号:" + device_code + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},设备状态{},不满足取货完成反馈,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction() , paperTubePickSiteDeviceDriver.getError(), paperTubePickSiteDeviceDriver.getMode(), ikey); } @@ -617,11 +617,11 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } catch (Exception e) { e.printStackTrace(); } - if (paperTubePickSiteDeviceDriver.getMove() == 1 && paperTubePickSiteDeviceDriver.getAction() == 1 + if (paperTubePickSiteDeviceDriver.getAction() == 1 && paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } else { - message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; + message = "设备号:" + device_code + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},设备状态{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction() , paperTubePickSiteDeviceDriver.getError(), paperTubePickSiteDeviceDriver.getMode(), ikey); } @@ -792,10 +792,11 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } catch (Exception e) { e.printStackTrace(); } - if (paperTubePickSiteDeviceDriver.getMove() == 0) { + if (paperTubePickSiteDeviceDriver.getAction() == 1 + && paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); } else { - message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; + message = "设备号:" + device_code + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction() , paperTubePickSiteDeviceDriver.getError(), ikey); } @@ -909,11 +910,11 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } catch (Exception e) { e.printStackTrace(); } - if (paperTubePickSiteDeviceDriver.getMove() == 0 && paperTubePickSiteDeviceDriver.getAction() == 1 + if (paperTubePickSiteDeviceDriver.getAction() == 1 && paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } else { - message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; + message = "设备号:" + device_code + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},设备状态{},不满足放货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction() , paperTubePickSiteDeviceDriver.getError(), paperTubePickSiteDeviceDriver.getMode(), ikey); } @@ -1107,11 +1108,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } catch (Exception e) { e.printStackTrace(); } - if (paperTubePickSiteDeviceDriver.getMove() == 1 && paperTubePickSiteDeviceDriver.getAction() == 1 + if (paperTubePickSiteDeviceDriver.getAction() == 1 && paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + paperTubePickSiteDeviceDriver.setFlag(3); } else { - message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; + message = "设备号:" + device_code + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},设备状态{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction() , paperTubePickSiteDeviceDriver.getError(), paperTubePickSiteDeviceDriver.getMode(), ikey); } @@ -1237,7 +1239,8 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } catch (Exception e) { e.printStackTrace(); } - if (paperTubePickSiteDeviceDriver.getMove() == 0) { + if (paperTubePickSiteDeviceDriver.getAction() == 1 + && paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } else { message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; @@ -1369,7 +1372,8 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } catch (Exception e) { e.printStackTrace(); } - if (paperTubePickSiteDeviceDriver.getMove() > 0) { + if (paperTubePickSiteDeviceDriver.getAction() == 1 + && paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); } else { message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/BeltConveyorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/BeltConveyorDeviceDriver.java index 6268b21e7..758217593 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/BeltConveyorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/BeltConveyorDeviceDriver.java @@ -1,22 +1,19 @@ package org.nl.acs.device_driver.conveyor.belt_conveyor; -import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; -import cn.hutool.http.HttpResponse; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import lombok.Data; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import lombok.val; import org.apache.commons.lang3.ObjectUtils; -import org.nl.acs.AcsConfig; import org.nl.acs.agv.server.AgvService; import org.nl.acs.common.base.CommonFinalParam; import org.nl.acs.device.domain.Device; -import org.nl.acs.device.enums.ErrorType; import org.nl.acs.device.service.DeviceService; import org.nl.acs.device_driver.DeviceDriver; import org.nl.acs.device_driver.RouteableDeviceDriver; @@ -24,13 +21,11 @@ import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; import org.nl.acs.device_driver.one_conveyor.fold_disc_site.FoldDiscSiteDeviceDriver; import org.nl.acs.device_driver.one_manipulator.box_package_manipulator.InteractionJsonDTO; -import org.nl.acs.enums.AcsToLmsApplyTaskTypeEnum; import org.nl.acs.enums.StorageTypeEnum; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; import org.nl.acs.history.ErrorUtil; import org.nl.acs.history.service.DeviceErrorLogService; -import org.nl.acs.history.service.dto.DeviceErrorLogDto; import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl; import org.nl.acs.instruction.domain.Instruction; import org.nl.acs.instruction.enums.InstructionStatusEnum; @@ -41,7 +36,6 @@ import org.nl.acs.opc.DeviceAppService; import org.nl.acs.route.service.RouteLineService; import org.nl.acs.route.service.dto.RouteLineDto; import org.nl.acs.task.enums.TaskStatusEnum; -import org.nl.acs.task.enums.TaskTypeEnum; import org.nl.acs.task.service.TaskService; import org.nl.acs.task.service.dto.TaskDto; import org.nl.common.utils.SecurityUtils; @@ -52,12 +46,9 @@ import org.nl.config.lucene.service.dto.LuceneLogDto; import org.nl.system.service.param.ISysParamService; import org.springframework.beans.factory.annotation.Autowired; -import java.time.LocalDateTime; import java.util.*; import java.util.concurrent.CompletableFuture; -import static redis.clients.jedis.HostAndPort.localhost; - /** * 输送线 */ @@ -99,6 +90,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements String notCreateInstMessage = ""; + /** * 心跳 */ @@ -177,7 +169,6 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements int last_to_height_level = 0; - //子卷条码 String material_barcode = null; String last_material_barcode = null; @@ -210,6 +201,8 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements String hand_barcode = null; + Boolean ignore_pickup_check = false; + /** * led点阵屏信息 */ @@ -244,19 +237,13 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements to_container_no = this.itemProtocol.getContainer_direction(); - if (mode != last_mode) { - requireSucess = false; - if(mode == 2){ - clearWrite(); - } - } - if (move != last_move && move==0) { + if (move != last_move && move == 0 && last_move == 1) { requireSucess = false; clearWrite(); } if (move != 0 && task > 0) { - CompletableFuture.runAsync(() -> { + CompletableFuture.runAsync(() -> { // 异步更新指令状态 try { update_instruction_status(); @@ -274,8 +261,8 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements //申请空托盘出库 if (mode == 8 && !requireSucess) { - if (container_type==0){ - message = "universal_notCreateInstMessage7"; + if (container_type == 0) { + message = "托盘类型为空"; } applyEmptyTask(StorageTypeEnum.DISKS_OUT.getType(), mode); @@ -284,10 +271,10 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements if (mode == 0) { this.setIsonline(false); - message = "universal_off-line"; + message = "脱机"; } else if (error != 0) { this.setIserror(true); - message = "universal_message3"; + message = "有报警"; } else { this.setIsonline(true); @@ -302,7 +289,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements break; case 2: //申请任务 - if (move == 1 && !requireSucess) { + if (move == 1 && !requireSucess) { instruction_require(); } else { String remark = ""; @@ -337,8 +324,6 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements break; - - default: break; } @@ -359,30 +344,26 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements last_to_container_type = to_container_type; } - public void clearWrite() { - List list = new ArrayList<>(); - Map map = new HashMap<>(); - map.put("code","to_target"); - map.put("value","0"); - list.add(map); - Map map2 = new HashMap<>(); - map2.put("code","to_task"); - map2.put("value","0"); - list.add(map2); - Map map3 = new HashMap<>(); - map3.put("code","to_command"); - map3.put("value","0"); - list.add(map3); - Map map4 = new HashMap<>(); - map4.put("code","to_container_type"); - map4.put("value","0"); - list.add(map4); + public void clearWrite() { + List list = new ArrayList<>(); + Map map = new HashMap<>(); + map.put("code", "to_target"); + map.put("value", "0"); + list.add(map); + Map map2 = new HashMap<>(); + map2.put("code", "to_task"); + map2.put("value", "0"); + list.add(map2); + Map map4 = new HashMap<>(); + map4.put("code", "to_container_type"); + map4.put("value", "0"); + list.add(map4); - this.writing(list); - message=null; - vehicle_code=null; + this.writing(list); + message = null; + vehicle_code = null; - } + } public void writing(int command) { @@ -419,6 +400,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements luceneExecuteLogService.deviceExecuteLog(logDto); String response = acsToWmsService.applyTwo(param); JSONObject jo = JSON.parseObject(response); + message = "申请空托盘出入库,返回参数:" + jo.getString("body"); if (jo.getInteger("status") == 200) { LuceneLogDto logDto2 = LuceneLogDto.builder() .device_code(device_code) @@ -448,9 +430,6 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements } - - - /** * 申请任务 */ @@ -489,10 +468,10 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class); String containerType = ""; if (ObjectUtil.isNotEmpty(interactionJsonDTO)) { - containerType = interactionJsonDTO.getContainerType(); + containerType = interactionJsonDTO.getContainerType(); } List list = new ArrayList(); - writeData(next_addr, list, inst,containerType); + writeData(next_addr, list, inst, containerType); // led_message = getLedMessage(inst); requireSucess = true; return true; @@ -511,6 +490,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements String route_plan_code = taskDtoHandCode.getRoute_plan_code(); String next_device_code = taskDtoHandCode.getNext_device_code(); String interactionJson = taskDtoHandCode.getInteraction_json(); + String vehicleCode = taskDtoHandCode.getVehicle_code(); String containerType = ""; if (StrUtil.isNotEmpty(interactionJson)) { InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class); @@ -539,7 +519,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements if (StrUtil.equals(deviceAppservice.findDeviceTypeByCode(next_device_code), "storage")) { next_point_code = next_device_code + "-" + taskDtoHandCode.getTo_y() + "-" + taskDtoHandCode.getTo_z(); Instruction instdto = new Instruction(); - packageData(instdto, route_plan_code, taskDtoHandCode, taskid, taskcode, start_device_code, next_device_code, start_point_code, next_point_code, priority, containerType); + packageData(instdto, route_plan_code, taskDtoHandCode, taskid, taskcode, start_device_code, next_device_code, start_point_code, next_point_code, priority, containerType, vehicleCode); try { instructionService.create(instdto); } catch (Exception e) { @@ -569,6 +549,8 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements String start_point_code = taskdto.getStart_point_code(); String start_device_code = taskdto.getStart_device_code(); String route_plan_code = taskdto.getRoute_plan_code(); + String vehicleCode = taskdto.getVehicle_code(); + String next_device_code = ""; String containerType = ""; String interactionJson = taskdto.getInteraction_json(); @@ -621,14 +603,18 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements BeltConveyorDeviceDriver beltConveyorDeviceDriver; //异常位到叠盘位 FoldDiscSiteDeviceDriver foldDiscSiteDeviceDriver; + if (nextdevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) { beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) nextdevice.getDeviceDriver(); - if (beltConveyorDeviceDriver.getMode() != 2 || beltConveyorDeviceDriver.getMove() == 1) { - log.error("输送机,{}未联机或执行中", next_device_code); - this.setNotCreateInstMessage("universal_notCreateInstMessage4"); - return false; + Boolean ignorePickupCheck = (Boolean) beltConveyorDeviceDriver.getExtraValue().get("ignore_pickup_check"); + if (!ignorePickupCheck) { + if (beltConveyorDeviceDriver.getMode() != 2 || beltConveyorDeviceDriver.getMove() == 1) { + log.error("输送机,{}未联机或执行中", next_device_code); + this.setNotCreateInstMessage("universal_notCreateInstMessage4"); + return false; + } } - }else if (nextdevice.getDeviceDriver() instanceof FoldDiscSiteDeviceDriver){ + } else if (nextdevice.getDeviceDriver() instanceof FoldDiscSiteDeviceDriver) { foldDiscSiteDeviceDriver = (FoldDiscSiteDeviceDriver) nextdevice.getDeviceDriver(); if (foldDiscSiteDeviceDriver.getMode() != 2 || foldDiscSiteDeviceDriver.getMove() == 1) { log.error("输送机,{}未联机或执行中", next_device_code); @@ -641,7 +627,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements return false; } Instruction instdto = new Instruction(); - packageData(instdto, route_plan_code, taskdto, taskid, taskcode, start_device_code, next_device_code, start_point_code, next_point_code, priority, containerType); + packageData(instdto, route_plan_code, taskdto, taskid, taskcode, start_device_code, next_device_code, start_point_code, next_point_code, priority, containerType, vehicleCode); log.error("=================================,{}", instdto.getCreate_by()); try { instructionService.create(instdto); @@ -668,7 +654,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class); String containerType = ""; if (ObjectUtil.isNotEmpty(interactionJsonDTO)) { - containerType = interactionJsonDTO.getContainerType(); + containerType = interactionJsonDTO.getContainerType(); } List list = new ArrayList(); writeData(next_addr, list, instdto, containerType); @@ -677,7 +663,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements return true; } - private void writeData(String next_addr, List list, Instruction inst,String containerType) { + private void writeData(String next_addr, List list, Instruction inst, String containerType) { List list1 = new ArrayList(); Map map = new HashMap(); map.put("code", "to_target"); @@ -704,7 +690,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements this.writing(list3); } - private static void packageData(Instruction instdto, String route_plan_code, TaskDto taskdto, String taskid, String taskcode, String start_device_code, String next_device_code, String start_point_code, String next_point_code, String priority, String containerType) { + private static void packageData(Instruction instdto, String route_plan_code, TaskDto taskdto, String taskid, String taskcode, String start_device_code, String next_device_code, String start_point_code, String next_point_code, String priority, String containerType, String vehicleCode) { instdto.setInstruction_id(IdUtil.simpleUUID()); instdto.setRoute_plan_code(route_plan_code); instdto.setRemark(taskdto.getRemark()); @@ -723,6 +709,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements instdto.setInstruction_status("0"); instdto.setExecute_device_code(start_point_code); instdto.setVehicle_type(containerType); + instdto.setVehicle_code(vehicleCode); } public void writeData(String next_addr, Instruction instdto, Map map) { @@ -813,8 +800,8 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements jo.put("device_name", this.getDevice().getDevice_name()); jo.put("mode", mode); - jo.put("message", LangProcess.msg(message)); - jo.put("error", ErrorUtil.getDictDetail("error_type", String.valueOf(this.getError()))); + jo.put("message", message); + jo.put("error", ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(this.getError()))); if (this.getMove() == 0) { move = LangProcess.msg("universal_no"); jo.put("hasGoods", false); @@ -838,7 +825,8 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements jo.put("isOnline", this.getIsonline()); jo.put("requireSucess", requireSucess); jo.put("hand_barcode", hand_barcode); - jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage)); + jo.put("materiel", material_barcode); + jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage)); return jo; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/box_palletizing_manipulator/BoxPalletizingManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/box_palletizing_manipulator/BoxPalletizingManipulatorDeviceDriver.java index 59189b384..d7b6977e6 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/box_palletizing_manipulator/BoxPalletizingManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/box_palletizing_manipulator/BoxPalletizingManipulatorDeviceDriver.java @@ -381,7 +381,6 @@ public class BoxPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDriv jo.put("isOnline", this.getIsonline()); jo.put("error", this.getError()); jo.put("isError", this.getIserror()); - jo.put("message", LangProcess.msg(message)); return jo; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/BoxStorageOutConveyorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/BoxStorageOutConveyorDeviceDriver.java index b1d7d7c7e..d525b6f26 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/BoxStorageOutConveyorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/BoxStorageOutConveyorDeviceDriver.java @@ -206,20 +206,15 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol)); } - if (mode != last_mode) { - requireSucess = false; - if(mode == 2){ - clearWrite(); - } - } - if (move != last_move && move==0) { + + if (move != last_move && move==0 && last_move==1) { requireSucess = false; clearWrite(); } if (mode == 0) { this.setIsonline(false); - message = "universal_off-line"; + message = "脱机"; //有报警 @@ -228,7 +223,7 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i this.setIserror(false); if (error != 0) { this.setIserror(true); - message = "universal_message3"; + message = "有警报"; } Instruction instruction = null; @@ -265,6 +260,10 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i } break; case 25: + if ( StrUtil.isEmpty(material_barcode)) { + message = "子卷码为空"; + } + //二楼到一楼输送线申请行架任务 if (move == 1 && !requireSucess) { applyManipulatorTask(); @@ -296,10 +295,6 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i map2.put("code","to_task"); map2.put("value","0"); list.add(map2); - Map map3 = new HashMap<>(); - map3.put("code","to_command"); - map3.put("value","0"); - list.add(map3); Map map4 = new HashMap<>(); map4.put("code","to_container_type"); map4.put("value","0"); @@ -397,6 +392,7 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i logServer.deviceExecuteLog(this.device_code, "", "", "二楼到一楼输送线申请行架任务,参数:" + param); String response = acsToWmsService.applyTowToOne(param); JSONObject jo = JSON.parseObject(response); + message = "二楼到一楼输送线申请行架任务,返回参数:" + jo.getString("body"); if (response == null || jo.getInteger("status") == 200) { List list1 = new ArrayList(); Map map = new HashMap(); @@ -463,7 +459,7 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i return false; } } - message = "universal_message5"; + message = "下发电气任务号成功"; requireSucess = true; return true; } @@ -679,10 +675,10 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i map.put("hand_barcode", hand_barcode); map.put("barcode", this.getMove() == 0 ? null : checkInst() == null ? vehicle_code : checkInst().getVehicle_code()); map.put("is_click", true); - map.put("error", ErrorUtil.getDictDetail("error_type", String.valueOf(this.getError()))); + map.put("error", ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(this.getError()))); map.put("requireSucess", requireSucess); map.put("driver_type", "siemens_conveyor"); - map.put("message", LangProcess.msg(message)); + map.put("message",message); map.put("inst_message", this.inst_message); map.put("last_inst_message", this.last_inst_message); map.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage)); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/BoxSubvolumesConveyorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/BoxSubvolumesConveyorDeviceDriver.java index 8502e9a42..a2808d1ec 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/BoxSubvolumesConveyorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/BoxSubvolumesConveyorDeviceDriver.java @@ -204,13 +204,8 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol)); } - if (mode != last_mode) { - requireSucess = false; - if(mode == 2){ - clearWrite(); - } - } - if (move != last_move && move==0) { + + if (move != last_move && move == 0 && last_move == 1) { requireSucess = false; clearWrite(); } @@ -224,7 +219,7 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i this.setIserror(false); if (error != 0) { this.setIserror(true); - message = "universal_message3"; + message = "有报警"; } Instruction instruction = null; @@ -237,8 +232,8 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i case 19: //申请AGV任务 if (move == 1 && !requireSucess) { - if (StrUtil.isEmpty(material_barcode)){ - message = "universal_notCreateInstMessage8"; + if (StrUtil.isEmpty(material_barcode)) { + message = "条码为空"; } applyAgvTask(); @@ -248,7 +243,7 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i //申请任务 if (move > 0 && !requireSucess) { instruction_require(); - }else { + } else { String remark = ""; ; if (mode != 2) { @@ -290,25 +285,21 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i private void clearWrite() { List list = new ArrayList<>(); Map map = new HashMap<>(); - map.put("code","to_target"); - map.put("value","0"); + map.put("code", "to_target"); + map.put("value", "0"); list.add(map); Map map2 = new HashMap<>(); - map2.put("code","to_task"); - map2.put("value","0"); + map2.put("code", "to_task"); + map2.put("value", "0"); list.add(map2); - Map map3 = new HashMap<>(); - map3.put("code","to_command"); - map3.put("value","0"); - list.add(map3); Map map4 = new HashMap<>(); - map4.put("code","to_container_type"); - map4.put("value","0"); + map4.put("code", "to_container_type"); + map4.put("value", "0"); list.add(map4); this.writing(list); - message=null; - vehicle_code=null; + message = null; + vehicle_code = null; } @@ -343,27 +334,22 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i .content("申请AGV任务,参数,接口返回:" + jo) .build(); luceneExecuteLogService.deviceExecuteLog(logDto2); - if (ObjectUtil.isEmpty(jo)) { - message = "one_message15"; - } else { - if (jo.getInteger("status") == 200) { - message = "one_message16"; - List list1 = new ArrayList(); - Map map = new HashMap(); - map.put("code", "to_command"); - map.put("value", 19); - list1.add(map); - this.writing(list1); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("申请AGV任务,返回参数:" + jo.getString("body")) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - requireSucess = true; - } else { - message = "one_message17"; - } + message = "申请AGV任务,参数,接口返回:" + jo; + + if (jo.getInteger("status") == 200) { + List list1 = new ArrayList(); + Map map = new HashMap(); + map.put("code", "to_command"); + map.put("value", 19); + list1.add(map); + this.writing(list1); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("申请AGV任务,返回参数:" + jo.getString("body")) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + requireSucess = true; } return; } @@ -376,23 +362,17 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i logServer.deviceExecuteLog(this.device_code, "", "", "申请AGV任务,请求参数:" + apply + ",响应参数"); JSONObject jo = JSON.parseObject(str); - if (ObjectUtil.isEmpty(jo)) { - message = "one_message15"; -// requireSucess = true; - } else { - if (jo.getInteger("status") == 200) { - message = "one_message16"; - List list = new ArrayList(); - Map map = new HashMap(); - map.put("code", "to_command"); - map.put("value", 19); - list.add(map); - this.writing(list); - logServer.deviceExecuteLog(this.device_code, "", "", "申请AGV任务,返回参数:" + jo); - requireSucess = true; - } else { - message = "one_message17"; - } + + message = "申请AGV任务,参数,接口返回:" + jo; + if (jo.getInteger("status") == 200) { + List list = new ArrayList(); + Map map = new HashMap(); + map.put("code", "to_command"); + map.put("value", 19); + list.add(map); + this.writing(list); + logServer.deviceExecuteLog(this.device_code, "", "", "申请AGV任务,返回参数:" + jo); + requireSucess = true; } } @@ -462,15 +442,15 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i jo.put("inst_message", this.inst_message); jo.put("last_inst_message", this.last_inst_message); jo.put("isOnline", this.getIsonline()); - jo.put("error", ErrorUtil.getDictDetail("error_type", String.valueOf(this.getError()))); + jo.put("error", ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(this.getError()))); jo.put("isError", this.getIserror()); - jo.put("message", LangProcess.msg(message)); + jo.put("message", message); jo.put("hand_barcode", hand_barcode); jo.put("barcode", this.getMove() == 0 ? null : checkInst() == null ? vehicle_code : checkInst().getVehicle_code()); jo.put("is_click", true); jo.put("requireSucess", requireSucess); jo.put("driver_type", "siemens_conveyor"); - jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage)); + jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage)); return jo; } @@ -575,7 +555,6 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i return false; } } - message = "universal_message5"; requireSucess = true; return true; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/finished_product_out_with_bind_lable_conveyor/FinishedProductOutBindLableDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/finished_product_out_with_bind_lable_conveyor/FinishedProductOutBindLableDeviceDriver.java index 4546ebdb9..ad2dbc819 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/finished_product_out_with_bind_lable_conveyor/FinishedProductOutBindLableDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/finished_product_out_with_bind_lable_conveyor/FinishedProductOutBindLableDeviceDriver.java @@ -117,8 +117,7 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr int to_length = 0; int last_to_length = 0; - int to_weight = 0; - int last_to_weight = 0; + int to_height = 0; int last_to_height = 0; @@ -209,13 +208,8 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol)); } - if (mode != last_mode) { - requireSucess = false; - if(mode == 2){ - clearWrite(); - } - } - if (move != last_move && move==0) { + + if (move != last_move && move==0 && last_move==1) { requireSucess = false; clearWrite(); } @@ -223,7 +217,7 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr if (mode == 0) { this.setIsonline(false); - message = "universal_off-line"; + message = "脱机"; //有报警 @@ -232,7 +226,7 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr this.setIserror(false); if (error != 0) { this.setIserror(true); - message = "universal_message3"; + message = "有警报"; } Instruction instruction = null; @@ -318,7 +312,6 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr last_to_target = to_target; last_material_barcode = material_barcode; last_to_length = to_length; - last_to_weight = to_weight; last_to_height = to_height; } @@ -332,10 +325,6 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr map2.put("code","to_task"); map2.put("value","0"); list.add(map2); - Map map3 = new HashMap<>(); - map3.put("code","to_command"); - map3.put("value","0"); - list.add(map3); Map map4 = new HashMap<>(); map4.put("code","to_container_type"); map4.put("value","0"); @@ -354,7 +343,7 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr this.require_apply_strangulation_time = date; Instruction inst = instructionService.findByCodeFromCache(String.valueOf(task)); if (ObjectUtil.isEmpty(inst) && StrUtil.isEmpty(inst.getVehicle_code())) { - message = LangProcess.msg("one_message8") + ": " + task + LangProcess.msg("one_message11"); + message = "指令为空、或者托盘码未空"; return; } JSONObject param = new JSONObject(); @@ -369,6 +358,7 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr luceneExecuteLogService.deviceExecuteLog(logDto); String response = acsToWmsService.deviceApplyTwo(param); JSONObject jo = JSON.parseObject(response); + message = "申请捆扎,参数,接口返回:" + jo; if (StrUtil.isNotEmpty(jo.getString("body")) || jo.getInteger("status") == 200) { LuceneLogDto logDto2 = LuceneLogDto.builder() .device_code(device_code) @@ -404,7 +394,7 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr // Instruction inst = instructionService.findByCodeFromCache(String.valueOf(task)); if (StrUtil.isEmpty(inst.getVehicle_code())) { - message = LangProcess.msg("one_message8") + ": " + task + LangProcess.msg("one_message11"); + message = "托盘码为空"; return; } JSONObject param = new JSONObject(); @@ -428,7 +418,7 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr try { this.writing(list); } catch (Exception e) { - message = "universal_write_erro"; + message = "写入异常"; } // Map datas = applyLabelingAndBindingResponse.getData(); requireSucess = true; @@ -466,7 +456,7 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr map.put("value", length); list.add(map); Map map2 = new HashMap(); - map2.put("code", "to_weight"); + map2.put("code", "to_width"); map2.put("value", width); list.add(map2); Map map3 = new HashMap(); @@ -516,7 +506,7 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr map.put("value", length); list.add(map); Map map2 = new HashMap(); - map2.put("code", "to_weight"); + map2.put("code", "to_width"); map2.put("value", width); list.add(map2); Map map3 = new HashMap(); @@ -579,7 +569,7 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr map.put("value", length); list.add(map); Map map2 = new HashMap(); - map2.put("code", "to_weight"); + map2.put("code", "to_width"); map2.put("value", width); list.add(map2); Map map3 = new HashMap(); @@ -610,7 +600,7 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr try { this.writing(list); } catch (Exception e) { - message = "universal_write_erro"; + message = "写入异常"; } this.setRequireSucess(true); @@ -698,9 +688,9 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr jo.put("inst_message", this.inst_message); jo.put("last_inst_message", this.last_inst_message); jo.put("isOnline", this.getIsonline()); - jo.put("error", ErrorUtil.getDictDetail("error_type", String.valueOf(this.getError()))); + jo.put("error", ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(this.getError()))); jo.put("isError", this.getIserror()); - jo.put("message", LangProcess.msg(message)); + jo.put("message", message); jo.put("hand_barcode", hand_barcode); jo.put("is_click", true); jo.put("requireSucess", requireSucess); @@ -812,7 +802,6 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr return false; } } - message = "universal_message5"; requireSucess = true; return true; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/fold_disc_site/FoldDiscSiteDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/fold_disc_site/FoldDiscSiteDeviceDriver.java index 4d79e349d..7765179d2 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/fold_disc_site/FoldDiscSiteDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/fold_disc_site/FoldDiscSiteDeviceDriver.java @@ -209,13 +209,8 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements } - if (mode != last_mode) { - requireSucess = false; - if(mode == 2){ - clearWrite(); - } - } - if (move != last_move && move==0) { + + if (move != last_move && move==0 && last_move==1) { requireSucess = false; clearWrite(); } @@ -233,12 +228,12 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements if (mode == 0) { this.setIsonline(false); - message = "universal_off-line"; + message = "脱机"; //有报警 } else if (error != 0) { this.setIserror(true); - message = "universal_message3"; + message = "有报警"; //无报警 } else { this.setIsonline(true); @@ -250,7 +245,7 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements //申请空托盘入库 if (mode == 9 && move == 1 && !requireSucess) { if (container_type==0){ - message = "universal_notCreateInstMessage7"; + message = "托盘类型为空"; } applyEmptyTask(StorageTypeEnum.DISKS_IN.getType(), mode); @@ -260,7 +255,7 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements //申请空托盘出库 if (mode == 8 && !requireSucess) { if (container_type==0){ - message = "universal_notCreateInstMessage7"; + message = "托盘类型为空"; } applyEmptyTask(StorageTypeEnum.DISKS_OUT.getType(), mode); @@ -327,10 +322,6 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements map2.put("code","to_task"); map2.put("value","0"); list.add(map2); - Map map3 = new HashMap<>(); - map3.put("code","to_command"); - map3.put("value","0"); - list.add(map3); Map map4 = new HashMap<>(); map4.put("code","to_container_type"); map4.put("value","0"); @@ -382,7 +373,6 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements return false; } } - message = "universal_message5"; requireSucess = true; return true; } @@ -600,6 +590,7 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements luceneExecuteLogService.deviceExecuteLog(logDto); String response = acsToWmsService.applyTwo(param); JSONObject jo = JSON.parseObject(response); + message = "申请空托盘出入库,参数,接口返回:" + jo; if (jo.getInteger("status") == 200) { LuceneLogDto logDto2 = LuceneLogDto.builder() .device_code(device_code) @@ -674,9 +665,9 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements jo.put("action", action); jo.put("task", task); jo.put("isOnline", this.getIsonline()); - jo.put("error", ErrorUtil.getDictDetail("error_type", String.valueOf(this.getError()))); + jo.put("error", ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(this.getError()))); jo.put("isError", this.getIserror()); - jo.put("message", LangProcess.msg(message)); + jo.put("message", message); jo.put("notCreateTaskMessage", notCreateTaskMessage); jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage)); jo.put("feedMessage", LangProcess.msg(feedMessage)); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java index 86da0938b..c43ad8638 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java @@ -127,8 +127,6 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv int last_container_type = 0; - - //行架任务号 int hj_task = 0; int last_hj_task = 0; @@ -243,21 +241,15 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv } - if (mode != last_mode) { - requireSucess = false; - if(mode == 2){ - clearWrite(); - } - } - if (move != last_move && move==0) { + if (move != last_move && move == 0 && last_move == 1) { requireSucess = false; clearWrite(); } - if(move !=last_move){ - if (ObjectUtil.isNotEmpty(inst)){ - if (move==0){ + if (move != last_move) { + if (ObjectUtil.isNotEmpty(inst)) { + if (move == 0) { Thread.sleep(10000); led_message = clearMessage(); List deviceCodes = this.getExtraDeviceCodes("link_device_code"); @@ -268,7 +260,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv if (ObjectUtil.isEmpty(linkDevice)) { throw new BadRequestException("设备:" + device_code + "关联设备->" + deviceCode + "为空!"); } - if (linkDevice.getDeviceDriver() instanceof LedScreenDeviceDriver){ + if (linkDevice.getDeviceDriver() instanceof LedScreenDeviceDriver) { device = deviceCode; } } @@ -292,7 +284,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv //有报警 } else if (error != 0) { this.setIserror(true); - message = "one_mode5"; + message = "有报警"; //申请异常位任务 applyErrorTask(); } else { @@ -302,51 +294,56 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv Instruction instruction = null; List toInstructions; //木箱入库申请入库任务 - if (mode == 6 && !requireSucess){ - if (StrUtil.isEmpty(barcode)){ - message = "universal_notCreateInstMessage8"; + if (mode == 6 && !requireSucess) { + if (StrUtil.isEmpty(barcode)||StrUtil.isEmpty(material_barcode)) { + message = "托盘条码为空、或者子卷码为空"; + }else { + applyIn(StorageTypeEnum.BOX_IN.getType(), mode); } - applyIn(StorageTypeEnum.BOX_IN.getType(),mode); } //子卷入库申请入库任务 - if (mode == 7 && move == 1 && !requireSucess){ - if (StrUtil.isEmpty(barcode)||StrUtil.isEmpty(material_barcode)){ - message = "universal_notCreateInstMessage8"; + if (mode == 7 && move == 1 && !requireSucess) { + if (StrUtil.isEmpty(barcode) || StrUtil.isEmpty(material_barcode)) { + message = "托盘条码为空、或者子卷码为空"; + }else { + applyIn(StorageTypeEnum.STORAGE.getType(), mode); } - applyIn(StorageTypeEnum.STORAGE.getType(),mode); } //申请空托盘入库 - if (mode == 9 && move == 1 && !requireSucess){ - if (container_type==0){ - message = "universal_notCreateInstMessage7"; + if (mode == 9 && move == 1 && !requireSucess) { + if (container_type == 0) { + message = "托盘类型为空"; + }else { + applyEmptyTask(StorageTypeEnum.DISKS_IN.getType(), mode); } - applyEmptyTask(StorageTypeEnum.DISKS_IN.getType(), mode); - } //申请退货入库 - if (mode == 18 && move == 1 && !requireSucess){ - if (StrUtil.isEmpty(barcode)){ - message = "universal_notCreateInstMessage8"; + if (mode == 18 && move == 1 && !requireSucess) { + if (StrUtil.isEmpty(barcode)) { + message = "托盘条码为空"; + }else { + applyBoxReturnTask(StorageTypeEnum.BOX_RETURN.getType(), mode); } - applyBoxReturnTask(StorageTypeEnum.BOX_RETURN.getType(), mode); } - if (mode == 23 && !requireSucess){ - if (StrUtil.isEmpty(barcode)||StrUtil.isEmpty(material_barcode)){ - message = "universal_notCreateInstMessage8"; + //申请高度 + if (mode == 23 && !requireSucess) { + if (StrUtil.isEmpty(barcode) || StrUtil.isEmpty(material_barcode)) { + message = "条码为空"; + }else { + applyErrorHeight(); } - applyErrorHeight(); } //申请入库指令、异常位指令 - if (mode == 2 && move == 1 && !requireSucess) { + if (mode == 2 && move == 1 && !requireSucess) { boolean res = instruction_require(); if (res) { notCreateInstMessage = ""; @@ -403,8 +400,18 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv try { JSONObject param = new JSONObject(); param.put("device_code", device_code); - param.put("vehicle_code", barcode); - param.put("material_barcode", material_barcode); + if (StrUtil.isNotEmpty(hand_barcode)) { + param.put("vehicle_code", hand_barcode); + } + if (StrUtil.isNotEmpty(barcode)&&(barcode.startsWith("A")||barcode.startsWith("B"))) { + param.put("vehicle_code", barcode); + } + if (StrUtil.isNotEmpty(material_barcode)) { + param.put("material_barcode", material_barcode); + } + if (StrUtil.isNotEmpty(hand_material_barcode)) { + param.put("material_barcode", hand_material_barcode); + } LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) .content("申请高度等级,参数:" + param) @@ -413,6 +420,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv luceneExecuteLogService.deviceExecuteLog(logDto); String response = acsToWmsService.getBoxInfo(param); JSONObject jo = JSON.parseObject(response); + message = "申请高度等级,返回参数:" + jo; if (jo.getInteger("status") == 200) { LuceneLogDto logDto2 = LuceneLogDto.builder() .device_code(device_code) @@ -433,7 +441,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv map2.put("value", 23); list2.add(map2); this.writing(list2); - }else { + } else { LuceneLogDto logDto2 = LuceneLogDto.builder() .device_code(device_code) .content("申请高度等级,返回参数:" + jo.getString("body")) @@ -457,8 +465,18 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv try { JSONObject param = new JSONObject(); param.put("device_code", device_code); - param.put("vehicle_code", barcode); - param.put("material_barcode", material_barcode); + if (StrUtil.isNotEmpty(hand_barcode)) { + param.put("vehicle_code", hand_barcode); + } + if (StrUtil.isNotEmpty(barcode)&&(barcode.startsWith("A")||barcode.startsWith("B"))) { + param.put("vehicle_code", barcode); + } + if (StrUtil.isNotEmpty(material_barcode)) { + param.put("material_barcode", material_barcode); + } + if (StrUtil.isNotEmpty(hand_material_barcode)) { + param.put("material_barcode", hand_material_barcode); + } param.put("type", type); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) @@ -468,6 +486,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv luceneExecuteLogService.deviceExecuteLog(logDto); String response = acsToWmsService.applyTwo(param); JSONObject jo = JSON.parseObject(response); + message = "申请退货入库,返回参数:" + jo; if (jo.getInteger("status") == 200) { LuceneLogDto logDto2 = LuceneLogDto.builder() .device_code(device_code) @@ -482,7 +501,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv list1.add(map); this.writing(list1); this.requireSucess = true; - }else { + } else { LuceneLogDto logDto2 = LuceneLogDto.builder() .device_code(device_code) .content("申请退货入库,返回参数:" + jo.getString("body")) @@ -499,25 +518,22 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv public void clearWrite() { List list = new ArrayList<>(); Map map = new HashMap<>(); - map.put("code","to_target"); - map.put("value","0"); + map.put("code", "to_target"); + map.put("value", "0"); list.add(map); Map map2 = new HashMap<>(); - map2.put("code","to_task"); - map2.put("value","0"); + map2.put("code", "to_task"); + map2.put("value", "0"); list.add(map2); - Map map3 = new HashMap<>(); - map3.put("code","to_command"); - map3.put("value","0"); - list.add(map3); Map map4 = new HashMap<>(); - map4.put("code","to_container_type"); - map4.put("value","0"); + map4.put("code", "to_container_type"); + map4.put("value", "0"); list.add(map4); this.writing(list); - message=null; - vehicle_code=null; + message = null; + vehicle_code = null; + hand_barcode = null; } @@ -564,7 +580,6 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv JSONObject param = new JSONObject(); param.put("device_code", device_code); param.put("container_type", container_type); - param.put("vehicle_code", barcode); param.put("type", type); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) @@ -574,6 +589,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv luceneExecuteLogService.deviceExecuteLog(logDto); String response = acsToWmsService.applyTwo(param); JSONObject jo = JSON.parseObject(response); + message = "申请空托盘出入库,返回参数:" + jo; if (jo.getInteger("status") == 200) { LuceneLogDto logDto2 = LuceneLogDto.builder() .device_code(device_code) @@ -588,7 +604,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv list1.add(map); this.writing(list1); this.requireSucess = true; - }else { + } else { LuceneLogDto logDto2 = LuceneLogDto.builder() .device_code(device_code) .content("申请空托盘出入库,返回参数:" + jo.getString("body")) @@ -610,42 +626,52 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv return; } else { try { - JSONObject param = new JSONObject(); - param.put("device_code", device_code); - param.put("vehicle_code", barcode); - param.put("material_barcode", material_barcode); - param.put("type", type); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("木箱、子卷入库申请入库任务,参数:" + param) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - String response = acsToWmsService.applyTwo(param); - JSONObject jo = JSON.parseObject(response); - if (jo.getInteger("status") == 200) { - LuceneLogDto logDto2 = LuceneLogDto.builder() - .device_code(device_code) - .content("木箱、子卷入库申请入库任务,参数,接口返回:" + jo) - .build(); - logDto2.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto2); - List list1 = new ArrayList(); - Map map = new HashMap(); - map.put("code", "to_command"); - map.put("value", mode); - list1.add(map); - this.writing(list1); - }else { - LuceneLogDto logDto2 = LuceneLogDto.builder() - .device_code(device_code) - .content("木箱、子卷入库申请入库任务,返回参数:" + jo.getString("body")) - .build(); - logDto2.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto2); - } + JSONObject param = new JSONObject(); + param.put("device_code", device_code); + if (StrUtil.isNotEmpty(hand_barcode)) { + param.put("vehicle_code", hand_barcode); } - catch (Exception e) { + if (StrUtil.isNotEmpty(barcode)&&(barcode.startsWith("A")||barcode.startsWith("B"))) { + param.put("vehicle_code", barcode); + } + if (StrUtil.isNotEmpty(material_barcode)) { + param.put("material_barcode", material_barcode); + } + if (StrUtil.isNotEmpty(hand_material_barcode)) { + param.put("material_barcode", hand_material_barcode); + } + param.put("type", type); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("木箱、子卷入库申请入库任务,参数:" + param) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + String response = acsToWmsService.applyTwo(param); + JSONObject jo = JSON.parseObject(response); + message = "木箱、子卷入库申请入库任务,返回参数:" + jo; + if (jo.getInteger("status") == 200) { + LuceneLogDto logDto2 = LuceneLogDto.builder() + .device_code(device_code) + .content("木箱、子卷入库申请入库任务,参数,接口返回:" + jo) + .build(); + logDto2.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto2); + List list1 = new ArrayList(); + Map map = new HashMap(); + map.put("code", "to_command"); + map.put("value", mode); + list1.add(map); + this.writing(list1); + } else { + LuceneLogDto logDto2 = LuceneLogDto.builder() + .device_code(device_code) + .content("木箱、子卷入库申请入库任务,返回参数:" + jo.getString("body")) + .build(); + logDto2.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto2); + } + } catch (Exception e) { e.printStackTrace(); } } @@ -707,7 +733,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv if (!ObjectUtil.isEmpty(taskdto)) { if (creatInstruction(taskdto)) return false; } - }else { + } else { if (StrUtil.isNotBlank(barcode)) { //根据载具号查找任务 TaskDto taskdto = taskserver.findByVehicleCodeCodeAndReady(barcode); @@ -730,13 +756,13 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class); String containerType = ""; if (ObjectUtil.isNotEmpty(interactionJsonDTO)) { - containerType = interactionJsonDTO.getContainerType(); + containerType = interactionJsonDTO.getContainerType(); } - if (TaskTypeEnum.AGV_Task.getIndex().equals(taskdto.getTask_type())){ + if (TaskTypeEnum.AGV_Task.getIndex().equals(taskdto.getTask_type())) { String route_plan_code = taskdto.getRoute_plan_code(); List shortPathsList = routeLineService.getShortPathLines(taskdto.getStart_device_code(), taskdto.getNext_device_code(), route_plan_code); - if (CollectionUtil.isEmpty(shortPathsList)){ + if (CollectionUtil.isEmpty(shortPathsList)) { return true; } RouteLineDto routeLineDto = shortPathsList.get(0); @@ -745,20 +771,20 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv List pathlist = Arrays.asList(str); Integer start = 0; String start_device_code = pathlist.get(start); - String next_device_code = pathlist.get(start+1); + String next_device_code = pathlist.get(start + 1); //判断有无出入库任务是相同路线 TaskDto dto = taskserver.findByCodeAndExcute(taskdto.getNext_device_code(), taskdto.getStart_device_code()); - if (ObjectUtil.isNotEmpty(dto)){ + if (ObjectUtil.isNotEmpty(dto)) { requireSucess = false; return true; } - packageInstrcutData(instdto, taskdto, taskid, taskcode, vehiclecode, priority,start_device_code,next_device_code,containerType); - }else { + packageInstrcutData(instdto, taskdto, taskid, taskcode, vehiclecode, priority, start_device_code, next_device_code, containerType); + } else { - packageInstrcutData(instdto, taskdto, taskid, taskcode, vehiclecode, priority, taskdto.getStart_device_code(), taskdto.getNext_device_code(),containerType); + packageInstrcutData(instdto, taskdto, taskid, taskcode, vehiclecode, priority, taskdto.getStart_device_code(), taskdto.getNext_device_code(), containerType); } try { instructionService.create(instdto); @@ -787,12 +813,13 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv map3.put("code", "to_container_type"); map3.put("value", containerType); list.add(map3); + this.writing(list); + List list2 = new ArrayList(); Map map4 = new HashMap(); map4.put("code", "to_command"); map4.put("value", "1"); - list.add(map4); - - this.writing(list); + list2.add(map4); + this.writing(list2); led_message = getLedMessage(instdto); List deviceCodes = this.getExtraDeviceCodes("link_device_code"); String device = null; @@ -802,7 +829,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv if (ObjectUtil.isEmpty(linkDevice)) { throw new BadRequestException("设备:" + device_code + "关联设备->" + deviceCode + "为空!"); } - if (linkDevice.getDeviceDriver() instanceof LedScreenDeviceDriver){ + if (linkDevice.getDeviceDriver() instanceof LedScreenDeviceDriver) { device = deviceCode; } } @@ -812,7 +839,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString() , instdto.getInstruction_code())) { this.writing(list); - LuceneLogDto logDto = LuceneLogDto.builder() + LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) .content(device_code + inst.getInstruction_code() + "再次下发电气信号") .build(); @@ -867,7 +894,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv return json; } - private void packageInstrcutData(Instruction instdto, TaskDto taskdto, String taskid, String taskcode, String vehiclecode, String priority,String startCode, String endCode,String containerType) { + private void packageInstrcutData(Instruction instdto, TaskDto taskdto, String taskid, String taskcode, String vehiclecode, String priority, String startCode, String endCode, String containerType) { instdto.setInstruction_id(IdUtil.simpleUUID()); instdto.setRoute_plan_code(taskdto.getRoute_plan_code()); instdto.setRemark(taskdto.getRemark()); @@ -922,6 +949,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv } } + public synchronized boolean finish_instruction() throws Exception { instructionService.finish(inst); return true; @@ -942,7 +970,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv mode = LangProcess.msg("universal_standby"); } else if (this.getMode() == 3) { mode = LangProcess.msg("universal_operation"); - }else if (this.getMode() == 6) { + } else if (this.getMode() == 6) { mode = LangProcess.msg("one_mode1"); } @@ -969,15 +997,17 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv jo.put("device_name", this.getDevice().getDevice_name()); jo.put("mode", mode); jo.put("hand_barcode", hand_barcode); + jo.put("barcode", barcode); + jo.put("material_barcode", material_barcode); jo.put("move", move); jo.put("action", action); jo.put("task", task); jo.put("isOnline", this.getIsonline()); - jo.put("error", ErrorUtil.getDictDetail("error_type", String.valueOf(this.getError()))); + jo.put("error", ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(this.getError()))); jo.put("isError", this.getIserror()); - jo.put("message", LangProcess.msg(message)); + jo.put("message", message); jo.put("notCreateTaskMessage", notCreateTaskMessage); - jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage)); + jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage)); jo.put("feedMessage", LangProcess.msg(feedMessage)); jo.put("driver_type", "conveyor_with_scanner_weight"); jo.put("is_click", true); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/un_box_lable_conveyor/UnBoxLableConveyorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/un_box_lable_conveyor/UnBoxLableConveyorDeviceDriver.java index 9fbe144cf..a44f5d923 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/un_box_lable_conveyor/UnBoxLableConveyorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/un_box_lable_conveyor/UnBoxLableConveyorDeviceDriver.java @@ -191,7 +191,7 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl } if (mode == 0) { this.setIsonline(false); - message = "universal_off-line"; + message = "脱机"; //有报警 @@ -200,15 +200,15 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl this.setIserror(false); if (error != 0) { this.setIserror(true); - message = "universal_message3"; + message = "有报警"; } Instruction instruction = instructionService.findByCode(String.valueOf(task)); //空箱出库开盖位,申请开盖 - if (mode == 7 && move == 1 && task > 0 ) { + if (mode == 15 && move == 1 && task > 0 ) { //不允许开盖,完成出库任务,自动去扫码位 if (StrUtil.isEmpty(instruction.getVehicle_code())){ - message = "universal_notCreateInstMessage8"; + message = "任务托盘码为空"; } applyUnbox(instruction.getVehicle_code()); @@ -252,6 +252,7 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl luceneExecuteLogService.deviceExecuteLog(logDto); String response = acsToWmsService.getBoxInfo(param); JSONObject jo = JSON.parseObject(response); + message = "木箱开盖,返回参数:" + jo; if (jo.getInteger("status") == 200) { LuceneLogDto logDto2 = LuceneLogDto.builder() .device_code(device_code) @@ -266,7 +267,7 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl List list1 = new ArrayList(); Map map = new HashMap(); map.put("code", "to_command"); - map.put("value", 7); + map.put("value", 15); list1.add(map); this.writing(list1); }else { @@ -316,7 +317,7 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl try { this.writing(list); } catch (Exception e) { - message = "universal_write_erro"; + message = "写入异常"; } this.setRequireSucess(true); @@ -410,9 +411,9 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl jo.put("inst_message", this.inst_message); jo.put("last_inst_message", this.last_inst_message); jo.put("isOnline", this.getIsonline()); - jo.put("error", ErrorUtil.getDictDetail("error_type", String.valueOf(this.getError()))); + jo.put("error", ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(this.getError()))); jo.put("isError", this.getIserror()); - jo.put("message", LangProcess.msg(message)); + jo.put("message", message); jo.put("hand_barcode", hand_barcode); jo.put("barcode", this.getMove() == 0 ? null : checkInst() == null ? vehicle_code : checkInst().getVehicle_code()); jo.put("is_click", true); @@ -512,7 +513,7 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl return false; } } - message = "universal_message5"; + message = "申请任务成功"; requireSucess = true; return true; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/BoxPackageManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/BoxPackageManipulatorDeviceDriver.java index d59c58581..b437e7dd3 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/BoxPackageManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/BoxPackageManipulatorDeviceDriver.java @@ -427,7 +427,6 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i try { instructionService.create(instdto); } catch (Exception e) { - notCreateInstMessage = e.getMessage(); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) .content(device_code+"创建指令时出现异常:" + e.getMessage()) diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/BoxStorageManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/BoxStorageManipulatorDeviceDriver.java index 4a51e3b4a..805c7e618 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/BoxStorageManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/BoxStorageManipulatorDeviceDriver.java @@ -382,7 +382,6 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i try { instructionService.create(instdto); } catch (Exception e) { - notCreateInstMessage = e.getMessage(); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) .content(device_code+"创建指令时出现异常:" + e.getMessage()) diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ReturnGoodManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ReturnGoodManipulatorDeviceDriver.java index 991d531e0..c0f1da0ba 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ReturnGoodManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ReturnGoodManipulatorDeviceDriver.java @@ -400,7 +400,6 @@ public class ReturnGoodManipulatorDeviceDriver extends AbstractOpcDeviceDriver i try { instructionService.create(instdto); } catch (Exception e) { - notCreateInstMessage = e.getMessage(); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) .content(device_code+"创建指令时出现异常:" + e.getMessage()) diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/TrappedManipulatorManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/TrappedManipulatorManipulatorDeviceDriver.java index 74780b4e3..54ad24ca5 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/TrappedManipulatorManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/TrappedManipulatorManipulatorDeviceDriver.java @@ -620,7 +620,7 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice jo.put("isError", this.getIserror()); jo.put("message", LangProcess.msg(message)); jo.put("notCreateTaskMessage", notCreateTaskMessage); - jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage)); + jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage)); jo.put("feedMessage", LangProcess.msg(feedMessage)); jo.put("driver_type", "siemens_conveyor"); jo.put("is_click", true); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/volume_two_manipulator/VolumeTwoManipulatorManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/volume_two_manipulator/VolumeTwoManipulatorManipulatorDeviceDriver.java index 6626f9ee0..ab3919106 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/volume_two_manipulator/VolumeTwoManipulatorManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/volume_two_manipulator/VolumeTwoManipulatorManipulatorDeviceDriver.java @@ -190,7 +190,6 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi } catch (Exception var17) { var17.printStackTrace(); - feedMessage = var17.getMessage(); logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol)); } @@ -430,7 +429,6 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi try { instructionService.create(instdto); } catch (Exception e) { - notCreateInstMessage = e.getMessage(); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) .content(device_code + "创建指令时出现异常:" + e.getMessage()) diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/rgv/RgvDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/rgv/RgvDeviceDriver.java index 8c19c8f4c..299e594be 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/rgv/RgvDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/rgv/RgvDeviceDriver.java @@ -183,18 +183,17 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr } catch (Exception var17) { var17.printStackTrace(); - feedMessage = var17.getMessage(); logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol)); } if (mode == 0) { this.setIsonline(false); - message = "未联机"; + message = "universal_off-line"; //有报警 } else if (error != 0) { this.setIserror(true); - message = "有报警"; + message = "universal_message3"; //无报警 } else { this.setIsonline(true); @@ -218,13 +217,13 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr remark = "universal_no"; } if (task != 0) { - remark = LangProcess.msg("universal_remark4"); + remark = "universal_remark4"; if (ObjectUtil.isNotEmpty(this.inst)) { this.inst = null; } } if (requireSucess) { - remark = LangProcess.msg("universal_remark5"); + remark = "universal_remark5"; } this.setFeedMessage(remark); //} @@ -261,7 +260,7 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr applyManipulatorActionRequest.setQzz_no(String.valueOf(barcode));//气涨轴编码 applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest); Map map = new LinkedHashMap<>(); - if (applyManipulatorActionResponse.getCode() == 200) { + if (applyManipulatorActionResponse.getstatus() == 200) { Map data = applyManipulatorActionResponse.getData(); String point_code2 = data.get("point_code2");//目标站点 Device deviceByCode = deviceAppService.findDeviceByCode(point_code2); @@ -271,17 +270,20 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr map.put("to_target", address); map.put("to_sub_volume_no", material_code); map.put("to_command", "1"); - map.put("to_is_labeling",StrUtil.isNotEmpty(to_is_labeling)?"0":"1"); + if (StrUtil.equals("1",to_is_labeling)){ + map.put("to_is_labeling","1"); + }else { + map.put("to_is_labeling","0"); + } this.writing(map); logServer.deviceExecuteLog(this.device_code, "", "", "申请行架任务,返回参数:" + applyManipulatorActionResponse); - message = "申请行架任务成功"; + message = "universal_message12"; requireSucess = true; } else { - message = applyManipulatorActionResponse.getMessage(); map.put("to_command", 99); this.writing(map); requireSucess = true; - message = "申请行架任务失败"; + message = "universal_message13"; logServer.deviceExecuteLog(this.device_code, "", "", "申请行架任务反馈失败,返回参数:" + applyManipulatorActionResponse); } } @@ -363,10 +365,10 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr map.put("isOnline", this.getIsonline()); map.put("error", ErrorUtil.getDictDetail("error_type", String.valueOf(this.getError()))); map.put("isError", this.getIserror()); - map.put("message", message); + map.put("message", LangProcess.msg(message)); /*jo.put("notCreateTaskMessage", notCreateTaskMessage); jo.put("notCreateInstMessage",notCreateInstMessage);*/ - map.put("feedMessage", feedMessage); + map.put("feedMessage", LangProcess.msg(feedMessage)); map.put("driver_type", "siemens_conveyor"); map.put("is_click", true); JSONObject jo = new JSONObject(map); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/stacker/standard_stacker/StandardStackerDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/stacker/standard_stacker/StandardStackerDeviceDriver.java index bc9a3e2ca..eac1a4d77 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/stacker/standard_stacker/StandardStackerDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/stacker/standard_stacker/StandardStackerDeviceDriver.java @@ -368,8 +368,13 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme message = "one_message7"; } else { if (error != 0) { - //满入空出或者浅货位阻挡 - erroBlock(); + Date date = new Date(); + if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out); + } else { + //满入空出或者浅货位阻挡 + erroBlock(); + } } List list = new ArrayList(); switch (command) { @@ -432,7 +437,6 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme break; case 4: message = "one_message1"; - if (updateCommand("4")) break; Instruction instruction1 = checkInst(); String next_device_code1 = instruction1.getNext_device_code(); Device nextDevice1 = deviceAppService.findDeviceByCode(next_device_code1); @@ -456,7 +460,6 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme break; case 5: message = "universal_releasing_completed"; - if (updateCommand("11")) break; Map map = new HashMap<>(); List list5 = new ArrayList(); map.put("code", "to_command"); @@ -479,7 +482,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme } finish_instruction(inst); errorInst = null; - }else { + } else { finish_instruction(inst); } } catch (Exception e) { @@ -523,6 +526,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme } } + last_heartbeat = heartbeat; last_item_deviceCode = item_deviceCode; last_mode = mode; @@ -829,6 +833,8 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme requireSucess = true; return true; } + }else { + message = "不是取货中或者取货完成报警"; } } //放货中报警 @@ -839,6 +845,8 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme requireSucess = true; return true; } + }else { + message = "不是放货中报警"; } } //出库报警 @@ -851,6 +859,8 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme requireSucess = true; return true; } + }else { + message = "不是取货中或者取货完成报警"; } //放货中报警 if ("3".equals(instructionErro.getExecute_code()) && forkCargo == 2) { @@ -862,6 +872,8 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme requireSucess = true; return true; } + }else { + message = "不是放货中报警"; } } } @@ -978,7 +990,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme } - private void pakagePlc(Instruction inst, List list) { + private void pakagePlc(Instruction inst, List list) { HashMap map4 = new HashMap(); map4.put("code", "to_y"); map4.put("value", inst.getFrom_z()); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/blank_manipulator/BlankManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/blank_manipulator/BlankManipulatorDeviceDriver.java index c42503ee2..5d630f8b9 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/blank_manipulator/BlankManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/blank_manipulator/BlankManipulatorDeviceDriver.java @@ -278,13 +278,13 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem feedMessage = "universal_feedMessage1"; } if (action != 5) { - feedMessage = feedMessage + "two_message4"; + feedMessage = "two_message4"; } if (move != 1) { - feedMessage = feedMessage + "universal_feedMessage7"; + feedMessage = "universal_feedMessage7"; } if (task == 0) { - feedMessage = feedMessage + "universal_feedMessage8"; + feedMessage = "universal_feedMessage8"; } } @@ -312,7 +312,6 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem } catch (Exception var17) { var17.printStackTrace(); - feedMessage = var17.getMessage(); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) .content("读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol)) @@ -350,21 +349,21 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem } else { if (mode == 2) { //if (!requireSucess) { - String remark = "未查找任务原因为:"; + String remark = "universal_remark1"; if (mode != 2) { - remark = remark + "工作模式(mode)不是待机状态"; + remark = "universal_remark2"; } if (move != 0) { - remark = remark + "光电信号(move)为有货状态"; + remark = "universal_remark3"; } if (task != 0) { - remark = remark + "当前上报任务号(task)应该为0"; + remark = "universal_remark4"; if (ObjectUtil.isNotEmpty(this.inst)) { this.inst = null; } } if (requireSucess) { - remark = remark + "右击该图标,将请求任务复位标记(requireSucess)改为否。"; + remark ="universal_remark5"; } this.setNotCreateTaskMessage(remark); //} @@ -420,10 +419,12 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem Device startDevice = deviceAppService.findDeviceByCode(startCode); Device nextDevice = deviceAppService.findDeviceByCode(nextCode); if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) { - throw new BadRequestException(LangProcess.msg("device_checkAdd", startDevice.getDevice_code())); + notCreateInstMessage = "universal_notCreateInstMessage1"; + throw new BadRequestException("设备:" + startDevice.getDevice_code() + "未设置电气调度号!"); } if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))) { - throw new BadRequestException(LangProcess.msg("device_checkAdd", nextDevice.getDevice_code())); + notCreateInstMessage = "universal_notCreateInstMessage1"; + throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!"); } String startAddr = startDevice.getExtraValue().get("address").toString(); String nextAddr = nextDevice.getExtraValue().get("address").toString(); @@ -438,17 +439,23 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem Device startDevice2 = deviceAppService.findDeviceByCode(startCode2); Device nextDevice2 = deviceAppService.findDeviceByCode(nextCode2); if (ObjectUtil.isEmpty(startDevice2.getExtraValue().get("address"))) { - throw new BadRequestException(LangProcess.msg("device_checkAdd", startDevice.getDevice_code())); + throw new BadRequestException("设备:" + startDevice.getDevice_code() + "未设置电气调度号!"); } if (ObjectUtil.isEmpty(nextDevice2.getExtraValue().get("address"))) { - throw new BadRequestException(LangProcess.msg("device_checkAdd", nextDevice.getDevice_code())); + throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!"); } String start_addr2 = startDevice2.getExtraValue().get("address").toString(); String next_addr2 = nextDevice2.getExtraValue().get("address").toString(); map.put("to_onset2", start_addr2); map.put("to_target2", next_addr2); } - this.writing(map); + try { + this.writing(map); + } catch (Exception e) { + logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:" + + instruction.getInstruction_code() + ",指令起点:" + instruction.getStart_device_code() + + ",指令终点:" + instruction.getNext_device_code() + ",指令执行失败:" + e.getMessage()); + } this.setRequireSucess(true); return true; } else { @@ -500,33 +507,32 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem Device startDevice = deviceAppService.findDeviceByCode(instdto.getStart_device_code()); Device nextDevice = deviceAppService.findDeviceByCode(instdto.getNext_device_code()); if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) { - notCreateInstMessage = startDevice.getDevice_code() + LangProcess.msg("universal_notCreateInstMessage1"); + notCreateInstMessage ="universal_notCreateInstMessage1"; LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) - .content(startDevice.getDevice_code() + LangProcess.msg("universal_notCreateInstMessage1")) + .content(startDevice.getDevice_code() + "未设置电气调度号!") .build(); logDto.setLog_level(2); luceneExecuteLogService.deviceExecuteLog(logDto); - throw new BadRequestException(LangProcess.msg("device_checkAdd", startDevice.getDevice_code())); + throw new BadRequestException("设备:" + startDevice.getDevice_code() + "未设置电气调度号!"); } if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))) { - notCreateInstMessage = nextDevice.getDevice_code() + LangProcess.msg("universal_notCreateInstMessage1"); + notCreateInstMessage = "universal_notCreateInstMessage1"; LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) - .content(nextDevice.getDevice_code() + LangProcess.msg("universal_notCreateInstMessage1")) + .content(nextDevice.getDevice_code() + "未设置电气调度号!") .build(); logDto.setLog_level(2); luceneExecuteLogService.deviceExecuteLog(logDto); - throw new BadRequestException(LangProcess.msg("device_checkAdd", nextDevice.getDevice_code())); + throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!"); } try { instructionService.create(instdto); } catch (Exception e) { - notCreateInstMessage = e.getMessage(); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) - .content(LangProcess.msg("universal_message9") + e.getMessage()) + .content(device_code+"创建指令时出现异常:" + e.getMessage()) .build(); logDto.setLog_level(2); luceneExecuteLogService.deviceExecuteLog(logDto); @@ -549,10 +555,10 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem Device startDevice2 = deviceAppService.findDeviceByCode(startDeviceCode2); Device nextDevice2 = deviceAppService.findDeviceByCode(nextDeviceCode2); if (ObjectUtil.isEmpty(startDevice2.getExtraValue().get("address"))) { - throw new BadRequestException(LangProcess.msg("device_checkAdd", startDevice2.getDevice_code())); + throw new BadRequestException("设备:" + startDevice2.getDevice_code() + "未设置电气调度号!"); } if (ObjectUtil.isEmpty(nextDevice2.getExtraValue().get("address"))) { - throw new BadRequestException(LangProcess.msg("device_checkAdd", nextDevice2.getDevice_code())); + throw new BadRequestException("设备:" + nextDevice2.getDevice_code() + "未设置电气调度号!"); } String start_addr2 = startDevice2.getExtraValue().get("address").toString(); String next_addr2 = nextDevice2.getExtraValue().get("address").toString(); @@ -689,8 +695,8 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem jo.put("error", ErrorUtil.getDictDetail("error_type", String.valueOf(this.getError()))); jo.put("isError", this.getIserror()); jo.put("message", LangProcess.msg(message)); - jo.put("notCreateTaskMessage", notCreateTaskMessage); - jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage)); + jo.put("notCreateTaskMessage", LangProcess.msg(notCreateTaskMessage)); + jo.put("notCreateInstMessage",LangProcess.msg(notCreateInstMessage)); jo.put("feedMessage", LangProcess.msg(feedMessage)); jo.put("driver_type", "siemens_conveyor"); jo.put("is_click", true); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/blanking_button/BlankingButtonDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/blanking_button/BlankingButtonDriver.java index c8cf8d524..ed0063c96 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/blanking_button/BlankingButtonDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/blanking_button/BlankingButtonDriver.java @@ -2,6 +2,7 @@ package org.nl.acs.device_driver.two_conveyor.blanking_button; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpResponse; import com.alibaba.fastjson.JSONObject; import lombok.Data; import lombok.RequiredArgsConstructor; @@ -28,6 +29,7 @@ import org.nl.acs.monitor.DeviceStageMonitor; import org.nl.acs.opc.DeviceAppService; import org.nl.acs.route.service.RouteLineService; import org.nl.acs.task.service.TaskService; +import org.nl.acs.task.service.dto.TaskDto; import org.nl.config.SpringContextHolder; import org.nl.config.language.LangProcess; import org.nl.config.lucene.service.LuceneExecuteLogService; @@ -35,10 +37,7 @@ import org.nl.config.lucene.service.dto.LuceneLogDto; import org.nl.system.service.param.ISysParamService; import org.springframework.beans.factory.annotation.Autowired; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; /** * @author : TuQiang * @date : 2024/3/14 @@ -102,7 +101,7 @@ public class BlankingButtonDriver extends AbstractOpcDeviceDriver implements Dev Boolean iserror = false; - String deviceCode; + String device_code; String message = null; @@ -118,7 +117,7 @@ public class BlankingButtonDriver extends AbstractOpcDeviceDriver implements Dev @Override public void execute() { - deviceCode = this.getDeviceCode(); + device_code = this.getDeviceCode(); heartbeat = this.itemProtocol.getItem_heartbeat(); mode = this.itemProtocol.getItem_mode(); move = this.itemProtocol.getItem_move(); @@ -156,22 +155,31 @@ public class BlankingButtonDriver extends AbstractOpcDeviceDriver implements Dev case 3: log.debug("运行中"); break; - case 9: + case 10: // 表处下满料请求 if (!requireSucess) { - applyTakeFullVolume(); - } - break; - case 10: - //表处上空轴请求 - if (!requireSucess) { - applyTakeEmptyShaft(); + boolean b = applyTake(); + if (b) { + requireSucess = true; + } } break; case 11: + //表处上空轴请求 + if (!requireSucess) { + boolean b = applyTake(); + if (b) { + requireSucess = true; + } + } + break; + case 9: // 取消任务 if (!requireSucess) { - cancelTask(); + boolean b = cancelTake(); + if (b) { + requireSucess = true; + } } break; default: @@ -184,110 +192,134 @@ public class BlankingButtonDriver extends AbstractOpcDeviceDriver implements Dev lastMove = move; lastAction = action; lastError = error; - } - /** - * 表处下满料请求 - */ - public synchronized void applyTakeFullVolume() { + private boolean cancelTake() { + Date date = new Date(); + boolean flag = false; + if (date.getTime() - this.instructionRequireTime.getTime() + < (long) this.instructionRequireTimeOut) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instructionRequireTimeOut); + return false; + } else { + String deviceCode = device_code + "_X"; + //根据起点设备编号查询当前是否有就绪任务 + TaskDto taskDto = taskserver.findByStartCodeAndReady(deviceCode); + if (ObjectUtil.isNotEmpty(taskDto)){ + try { + taskserver.cancel(taskDto.getTask_id()); + Map map = new HashMap(); + map.put("to_command", 9); + try { + this.writing(map); + } catch (Exception e) { + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("下发信号报错" + map) + .build(); + logDto.setLog_level(3); + luceneExecuteLogService.deviceExecuteLog(logDto); + } + } catch (Exception e) { + e.printStackTrace(); + } + flag = true; + } + //根据终点设备编号查询当前是否有就绪任务 + TaskDto dto = taskserver.findByEndCodeAndReady(deviceCode); + if (ObjectUtil.isNotEmpty(dto)){ + try { + taskserver.cancel(dto.getTask_id()); + Map map = new HashMap(); + map.put("to_command", 9); + try { + this.writing(map); + } catch (Exception e) { + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("下发信号报错" + map) + .build(); + logDto.setLog_level(3); + luceneExecuteLogService.deviceExecuteLog(logDto); + } + } catch (Exception e) { + e.printStackTrace(); + } + flag = true; + } + } + if (!flag){ + Map map = new HashMap(); + map.put("to_command", 99); + try { + this.writing(map); + } catch (Exception e) { + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("下发信号报错" + map) + .build(); + logDto.setLog_level(3); + luceneExecuteLogService.deviceExecuteLog(logDto); + } + } + return flag; + } + + + private boolean applyTake() { Date date = new Date(); if (date.getTime() - this.instructionRequireTime.getTime() < (long) this.instructionRequireTimeOut) { log.trace("触发时间因为小于{}毫秒,而被无视", this.instructionRequireTimeOut); - return; + return false; } else { - this.instructionRequireTime = date; - if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), CommonFinalParam.ONE)) { - message = "two_message5"; - BlankingButtonRequest blankingButtonRequest = new BlankingButtonRequest(); - blankingButtonRequest.setDevice_code(deviceCode); - blankingButtonRequest.setType(CommonFinalParam.TYPE_ONE); - BlankingButtonResponse response = acsToWmsService.applyBlankButtonTask(blankingButtonRequest); - if (ObjectUtil.isEmpty(response)) { - message = "two_message6"; - } else { - if (response.getCode()== CommonFinalParam.STATUS_OPEN) { - this.writing("to_command","9"); - message = "two_message7"; - requireSucess = true; - } else { - requireSucess = false; - message = "two_message8" + response.getMessage(); - this.writing("to_command","99"); - } + JSONObject jo = new JSONObject(); + jo.put("device_code", this.getDevice_code()); + if (this.mode==10) { + jo.put("type",CommonFinalParam.TYPE_TWO); + } + if (this.mode==11) { + jo.put("type",CommonFinalParam.TYPE_THREE); + } + HttpResponse httpResponse = acsToWmsService.applyBlankButtonTask(jo); + JSONObject jsonObject = null; + if(ObjectUtil.isNotEmpty(httpResponse)){ + String body = httpResponse.body(); + jsonObject = JSONObject.parseObject(body); + } + if(ObjectUtil.isNotNull(jsonObject) && jsonObject.getInteger("status") == 200){ + Map map = new HashMap(); + //反馈表处下满料请求 + if (this.mode==10) { + map.put("to_command", 10); } + //反馈表处上空轴请求 + if (this.mode==11) { + map.put("to_command", 11); + } + try { + this.writing(map); + } catch (Exception e) { + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("下发信号报错" + map) + .build(); + logDto.setLog_level(3); + luceneExecuteLogService.deviceExecuteLog(logDto); + } + return true; + }else{ + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("反馈LMS表处按钮任务失败" + httpResponse.body()) + .build(); + logDto.setLog_level(3); + luceneExecuteLogService.deviceExecuteLog(logDto); + return false; } } } - /** - * 取消任务 - */ - public synchronized void cancelTask() { - Date date = new Date(); - if (date.getTime() - this.instructionRequireTime.getTime() - < (long) this.instructionRequireTimeOut) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instructionRequireTimeOut); - return; - } else { - this.instructionRequireTime = date; - if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), CommonFinalParam.ONE)) { - message = "two_message9"; - BlankingButtonRequest blankingButtonRequest = new BlankingButtonRequest(); - blankingButtonRequest.setDevice_code(deviceCode); - blankingButtonRequest.setType(CommonFinalParam.TYPE_SIX); - BlankingButtonResponse response = acsToWmsService.applyBlankButtonTask(blankingButtonRequest); - if (ObjectUtil.isEmpty(response)) { - message = "two_message10"; - } else { - if (response.getCode()== CommonFinalParam.STATUS_OPEN) { - this.writing("to_command","10"); - message = "two_message11"; - requireSucess = true; - } else { - requireSucess = false; - message = "two_message12" + response.getMessage(); - this.writing("to_command","99"); - } - } - } - } - } - - /** - * 表处上空轴请求 - */ - public synchronized void applyTakeEmptyShaft() { - Date date = new Date(); - if (date.getTime() - this.instructionRequireTime.getTime() - < (long) this.instructionRequireTimeOut) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instructionRequireTimeOut); - return; - } else { - this.instructionRequireTime = date; - if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), CommonFinalParam.ONE)) { - message = "two_message13"; - BlankingButtonRequest blankingButtonRequest = new BlankingButtonRequest(); - blankingButtonRequest.setDevice_code(deviceCode); - blankingButtonRequest.setType(CommonFinalParam.TYPE_TWO); - BlankingButtonResponse response = acsToWmsService.applyBlankButtonTask(blankingButtonRequest); - if (ObjectUtil.isEmpty(response)) { - message = "two_message14"; - } else { - if (response.getCode()== CommonFinalParam.STATUS_OPEN) { - this.writing("to_command","10"); - message = "two_message15"; - requireSucess = true; - } else { - requireSucess = false; - message = "two_message16" + response.getMessage(); - this.writing("to_command","99"); - } - } - } - } - } public void writing(String param, String value) { @@ -298,9 +330,9 @@ public class BlankingButtonDriver extends AbstractOpcDeviceDriver implements Dev itemMap.put(to_param, Integer.parseInt(value)); this.control(itemMap); - logServer.deviceExecuteLog(deviceCode, "", "", "下发电气信号设备号:" + deviceCode + ",下发电气:" + to_param + ",下发电气值:" + value); + logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value); LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(deviceCode) + .device_code(device_code) .content("下发多个电气信号" + itemMap) .build(); logDto.setLog_level(3); @@ -369,4 +401,28 @@ public class BlankingButtonDriver extends AbstractOpcDeviceDriver implements Dev public void setDeviceStatus(JSONObject data) { } + + public String getToParam() { + return this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "."; + } + + public void writing(Map map) throws Exception { + DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); + Map itemMap = new LinkedHashMap<>(); + map.forEach((key, value) -> { + if (ObjectUtil.isNotEmpty(value)) { + itemMap.put(getToParam() + key, value); + } + }); + if (ObjectUtil.isNotEmpty(itemMap)) { + this.checkcontrol(itemMap); + logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("下发多个电气信号" + itemMap) + .build(); + logDto.setLog_level(3); + luceneExecuteLogService.deviceExecuteLog(logDto); + } + } } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/green_foil_machine_button/GreenFoilMachineButtonDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/green_foil_machine_button/GreenFoilMachineButtonDriver.java index dfc03da4a..62f911b1f 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/green_foil_machine_button/GreenFoilMachineButtonDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/green_foil_machine_button/GreenFoilMachineButtonDriver.java @@ -100,7 +100,7 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem Boolean iserror = false; - String deviceCode; + String device_code; String message = null; @@ -116,7 +116,7 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem @Override public void execute() { - deviceCode = this.getDeviceCode(); + device_code = this.getDeviceCode(); heartbeat = this.itemProtocol.getItem_heartbeat(); mode = this.itemProtocol.getItem_mode(); move = this.itemProtocol.getItem_move(); @@ -206,7 +206,7 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), CommonFinalParam.ONE)) { message = "two_message17"; ApplyGreenFoilButtonRequest applyGreenFoilButtonRequest = new ApplyGreenFoilButtonRequest(); - applyGreenFoilButtonRequest.setDevice_code(deviceCode); + applyGreenFoilButtonRequest.setDevice_code(device_code); applyGreenFoilButtonRequest.setType(String.valueOf(mode)); ApplyGreenFoilButtonResponse response = acsToWmsService.applyGreenFoilButtonTask(applyGreenFoilButtonRequest); if (ObjectUtil.isEmpty(response)) { @@ -224,7 +224,7 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem requireSucess = true; } else { requireSucess = false; - message = "two_message20" + response.getMessage(); + message = "two_message20"; this.writing("to_command", "99"); } } @@ -242,9 +242,9 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem itemMap.put(to_param, Integer.parseInt(value)); this.control(itemMap); - logServer.deviceExecuteLog(deviceCode, "", "", "下发电气信号设备号:" + deviceCode + ",下发电气:" + to_param + ",下发电气值:" + value); + logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value); LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(deviceCode) + .device_code(device_code) .content("下发多个电气信号" + itemMap) .build(); luceneExecuteLogService.deviceExecuteLog(logDto); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/inflatable_shaft_library/InflatableShaftLibraryDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/inflatable_shaft_library/InflatableShaftLibraryDeviceDriver.java index 47c812623..df1e445fe 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/inflatable_shaft_library/InflatableShaftLibraryDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/inflatable_shaft_library/InflatableShaftLibraryDeviceDriver.java @@ -86,7 +86,7 @@ public class InflatableShaftLibraryDeviceDriver extends AbstractOpcDeviceDriver Boolean iserror = false; - String deviceCode; + String device_code; String message = null; @@ -101,7 +101,7 @@ public class InflatableShaftLibraryDeviceDriver extends AbstractOpcDeviceDriver @Override public void execute() { - deviceCode = this.getDeviceCode(); + device_code = this.getDeviceCode(); heartbeat = this.itemProtocol.getItem_heartbeat(); mode = this.itemProtocol.getItem_mode(); move = this.itemProtocol.getItem_move(); @@ -139,9 +139,9 @@ public class InflatableShaftLibraryDeviceDriver extends AbstractOpcDeviceDriver } catch (Exception e) { e.printStackTrace(); } - logServer.deviceExecuteLog(deviceCode, "", "", "下发电气信号设备号:" + deviceCode + ",下发电气:" + to_param + ",下发电气值:" + value); + logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value); LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(deviceCode) + .device_code(device_code) .content("下发多个电气信号" + itemMap) .build(); luceneExecuteLogService.deviceExecuteLog(logDto); @@ -163,7 +163,7 @@ public class InflatableShaftLibraryDeviceDriver extends AbstractOpcDeviceDriver this.checkcontrol(itemMap); logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap); LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.deviceCode) + .device_code(this.device_code) .content("下发多个电气信号" + itemMap) .build(); logDto.setLog_level(3); @@ -223,7 +223,6 @@ public class InflatableShaftLibraryDeviceDriver extends AbstractOpcDeviceDriver jo.put("isOnline", this.getIsonline()); jo.put("error", ErrorUtil.getDictDetail("error_type", String.valueOf(this.getError()))); jo.put("isError", this.getIserror()); - jo.put("message", LangProcess.msg(message)); jo.put("driver_type", "siemens_conveyor"); jo.put("is_click", true); return jo; diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java index 2e8810a36..19d635540 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java @@ -1117,7 +1117,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i action = LangProcess.msg("universal_releasing_completed"); } if (error == 0 && iserror) { - this.setMessage(LangProcess.msg("universal_message11")); + this.setMessage("universal_message11"); } String requireActionSucess = "指令" + LangProcess.msg("universal_actionMessage4"); if(this.requireActionSucess){ diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/plug_pull_device_site/PlugPullDeviceSiteDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/plug_pull_device_site/PlugPullDeviceSiteDeviceDriver.java index 30651b243..663811ffd 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/plug_pull_device_site/PlugPullDeviceSiteDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/plug_pull_device_site/PlugPullDeviceSiteDeviceDriver.java @@ -213,29 +213,26 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl if (mode == 0) { this.setIsonline(false); - message = LangProcess.msg("universal_off-line"); + message = "universal_off-line"; //有报警 } else if (error != 0) { this.setIserror(true); - message = LangProcess.msg("universal_message3"); + message ="universal_message3"; //无报警 } else { this.setIsonline(true); this.setIserror(false); message = ""; - if(requireSucess){ - message = LangProcess.msg("universal_actionMessage5"); - } //插拔轴机工位申请任务 switch (mode) { case 1: - log.debug(LangProcess.msg("universal_stand-alone")); + log.debug("设备运转模式:等待工作"); break; case 2: - log.info(LangProcess.msg("universal_standby")); + log.info("待机"); break; case 3: - log.info(LangProcess.msg("universal_operation")); + log.info("运行中"); break; case 4: if (!requireSucess) { @@ -307,6 +304,13 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); return; } else { + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(device_code+"当前mode值为:" + mode) + .build(); + logDto.setLog_level(2); + luceneExecuteLogService.deviceExecuteLog(logDto); + logServer.deviceExecuteLog(this.device_code, "", "", "当前mode值为:" + mode); ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest(); ApplyPlugPullSitResponse applyPlugPullSitResponse; applyPlugPullSiteRequest.setDevice_code(device_code); @@ -314,7 +318,13 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl //气涨轴尺寸 applyPlugPullSiteRequest.setSize(String.valueOf(size)); applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest); - if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) { + if (applyPlugPullSitResponse.getstatus() == CommonFinalParam.STATUS_OPEN) { + LuceneLogDto logDto2 = LuceneLogDto.builder() + .device_code(device_code) + .content("申请贴标成功:" + applyPlugPullSitResponse.getData()) + .build(); + logDto2.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto2); Map data = applyPlugPullSitResponse.getData(); String number = data.get("number"); String leftSize = data.get("leftSize"); @@ -370,6 +380,13 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); return; } else { + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(device_code+"当前mode值为:" + mode) + .build(); + logDto.setLog_level(2); + luceneExecuteLogService.deviceExecuteLog(logDto); + logServer.deviceExecuteLog(this.device_code, "", "", "当前mode值为:" + mode); ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest(); ApplyPlugPullSitResponse applyPlugPullSitResponse; applyPlugPullSiteRequest.setDevice_code(device_code); @@ -380,7 +397,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl applyPlugPullSiteRequest.setMaterial2(String.valueOf(material2)); applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_TWO); applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest); - if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) { + if (applyPlugPullSitResponse.getstatus() == CommonFinalParam.STATUS_OPEN) { this.writeSignal(mode); logServer.deviceExecuteLog(this.device_code, "", "", "反馈套管完成,返回参数:" + applyPlugPullSitResponse); message = "套管完成成功"; @@ -406,13 +423,20 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); return; } else { + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(device_code+"当前mode值为:" + mode) + .build(); + logDto.setLog_level(2); + luceneExecuteLogService.deviceExecuteLog(logDto); + logServer.deviceExecuteLog(this.device_code, "", "", "当前mode值为:" + mode); ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest(); ApplyPlugPullSitResponse applyPlugPullSitResponse; applyPlugPullSiteRequest.setDevice_code(device_code); applyPlugPullSiteRequest.setBarcode(String.valueOf(barcode)); applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_THREE); applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest); - if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) { + if (applyPlugPullSitResponse.getstatus() == CommonFinalParam.STATUS_OPEN) { Map map = new LinkedHashMap<>(); map.put("to_command", mode); this.writing(map); @@ -440,13 +464,20 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); return; } else { + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(device_code+"当前mode值为:" + mode) + .build(); + logDto.setLog_level(2); + luceneExecuteLogService.deviceExecuteLog(logDto); + logServer.deviceExecuteLog(this.device_code, "", "", "当前mode值为:" + mode); ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest(); ApplyPlugPullSitResponse applyPlugPullSitResponse; applyPlugPullSiteRequest.setDevice_code(device_code); applyPlugPullSiteRequest.setQzz_no(String.valueOf(barcode)); applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_FOUR); applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest); - if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) { + if (applyPlugPullSitResponse.getstatus() == CommonFinalParam.STATUS_OPEN) { Map data = applyPlugPullSitResponse.getData(); //拔管1物料 Object to_material3 = data.get("currentLeft"); @@ -502,13 +533,20 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); return; } else { + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(device_code+"当前mode值为:" + mode) + .build(); + logDto.setLog_level(2); + luceneExecuteLogService.deviceExecuteLog(logDto); + logServer.deviceExecuteLog(this.device_code, "", "", "当前mode值为:" + mode); ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest(); ApplyPlugPullSitResponse applyPlugPullSitResponse; applyPlugPullSiteRequest.setDevice_code(device_code); applyPlugPullSiteRequest.setSize(String.valueOf(size)); applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_FIVE); applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest); - if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) { + if (applyPlugPullSitResponse.getstatus() == CommonFinalParam.STATUS_OPEN) { Map map = new LinkedHashMap<>(); map.put("to_command", mode); this.writing(map); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_head_manipulator/PullHeadManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_head_manipulator/PullHeadManipulatorDeviceDriver.java index 91fe480fe..21019aaed 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_head_manipulator/PullHeadManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_head_manipulator/PullHeadManipulatorDeviceDriver.java @@ -20,6 +20,7 @@ import org.nl.acs.device_driver.RouteableDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; import org.nl.acs.device_driver.one_manipulator.box_storage_manipulator.InteractionJsonDTO; +import org.nl.acs.device_driver.two_conveyor.plug_pull_device_site.PlugPullDeviceSiteDeviceDriver; import org.nl.acs.device_driver.two_conveyor.pull_head_manipulator.ItemProtocol; import org.nl.acs.history.ErrorUtil; import org.nl.acs.history.service.DeviceErrorLogService; @@ -379,6 +380,14 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp } } if (!ObjectUtil.isEmpty(task)) { + String nextDeviceCode = task.getNext_device_code(); + Device device = deviceAppService.findDeviceByCode(nextDeviceCode); + PlugPullDeviceSiteDeviceDriver plugPullDeviceSiteDeviceDriver; + if (device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) { + plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) device.getDeviceDriver(); + if (plugPullDeviceSiteDeviceDriver.getMode() != 2 && plugPullDeviceSiteDeviceDriver.getMove() != 0 && plugPullDeviceSiteDeviceDriver.getAction() != 1) + return false; + } String taskId = task.getTask_id(); String taskCode = task.getTask_code(); String vehicleCode = task.getVehicle_code(); @@ -387,7 +396,7 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp String startDeviceCode = task.getStart_device_code(); String routePlanCode = task.getRoute_plan_code(); String nextPointCode = task.getNext_point_code(); - String nextDeviceCode = task.getNext_device_code(); + Instruction instdto = new Instruction(); instdto.setInstruction_id(IdUtil.simpleUUID()); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java index 067efb26a..7aff9d4c3 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java @@ -177,7 +177,6 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl } catch (Exception var17) { - feedMessage = var17.getMessage(); logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage()); // return; } @@ -225,10 +224,10 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl remark = "universal_remark2"; } if (move1 != 0) { - remark = remark + "universal_remark6"; + remark = "universal_remark6"; } if (move2 != 0) { - remark = remark + "universal_remark7"; + remark = "universal_remark7"; } if (task != 0) { remark = "universal_remark4"; @@ -293,19 +292,19 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl feedMessage = "universal_feedMessage6"; } else { if (mode != 3) { - feedMessage += "universal_feedMessage1"; + feedMessage = "universal_feedMessage1"; } if (action != 9) { - feedMessage += "universal_feedMessage9"; + feedMessage = "universal_feedMessage9"; } if (move1 != 0) { - feedMessage += "universal_feedMessage10"; + feedMessage = "universal_feedMessage10"; } if (move2 != 0) { - feedMessage += "universal_feedMessage11"; + feedMessage = "universal_feedMessage11"; } if (task == 0) { - feedMessage += "universal_feedMessage4"; + feedMessage = "universal_feedMessage4"; } } } @@ -322,12 +321,14 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl } else { this.instruction_head_time = date; String link_device_code = String.valueOf(this.getDevice().getExtraValue().get("link_device_code")); - Device device = deviceAppservice.findDeviceByCode(link_device_code); + List extraDeviceCodes = getExtraDeviceCodes1(link_device_code); + String linkCode = extraDeviceCodes.get(0); + Device device = deviceAppservice.findDeviceByCode(linkCode); SlitTwoManipulatorDeviceDriver slitTwoManipulatorDeviceDriver; - if (device.getDeviceDriver()instanceof SlitTwoManipulatorDeviceDriver) { + if (device.getDeviceDriver() instanceof SlitTwoManipulatorDeviceDriver) { slitTwoManipulatorDeviceDriver = (SlitTwoManipulatorDeviceDriver) device.getDeviceDriver(); //如果禁用 - if (slitTwoManipulatorDeviceDriver.getIs_disable()==1){ + if (slitTwoManipulatorDeviceDriver.getIs_disable() == 1) { //就去走关联设备异常取放货工位的任务 任务生成成功返回true 就不会走下面正常生成任务的逻辑 try { flag = instruction_require2(); @@ -339,6 +340,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl } } } + //没有生成异常取放货工位的任务 就生成正常关联取放货工位的任务 //抓取工位 if (ObjectUtil.isEmpty(getDeviceCodeList)) { getDeviceCodeList = this.getExtraDeviceCodes("get_device_code"); @@ -397,6 +399,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl } else { this.instruction_head_time = date; //抓取工位 + if (ObjectUtil.isEmpty(getDeviceCodeList)) { getDeviceCodeList = this.getExtraDeviceCodes("error_get_device_code"); } @@ -427,7 +430,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl for (int j = 0; j < taskDtoList.size(); j++) { task = taskDtoList.get(j); - // 9 行架任务 + // 6 行架任务 if (ObjectUtil.isNotEmpty(task) && !StrUtil.equals(task.getTask_type(), "6")) { task = null; continue; @@ -584,7 +587,6 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl try { instructionService.create(instdto); } catch (Exception e) { - notCreateInstMessage = e.getMessage(); logServer.deviceExecuteLog(device_code, "", instdto.getInstruction_code(), "指令创建失败,原因->" + e.getMessage()); } //创建指令后修改任务状态 @@ -608,7 +610,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl public void isSetAddress(Device device) { if (ObjectUtil.isEmpty(device.getExtraValue().get("address"))) { logServer.deviceExecuteLog(device_code, "", "task:" + task, "设备:" + device.getDevice_code() + "未设置电气调度号!"); - notCreateInstMessage = device.getDevice_code() + "universal_notCreateInstMessage1";; + notCreateInstMessage = "universal_notCreateInstMessage1";; throw new BadRequestException("设备:" + device.getDevice_code() + "未设置电气调度号!"); } } @@ -719,6 +721,26 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl //将扩展表中的字符串数组数据转换成集合 + public List getExtraDeviceCodes1(String extraValue) { + if (StrUtil.isEmpty(extraValue)) { + return new ArrayList<>(); + } + String devicesString = extraValue.substring(1, extraValue.length() - 1); + List devicesList = new ArrayList<>(); + String[] devices = devicesString.split(","); + for (int i = 0; i < devices.length; i++) { + String s = devices[i].replace("\"", "").replace("\"", ""); + devicesList.add(s); + } + return devicesList; + } + + /** + * 将扩展表中的字符串数据转换成集合 + * + * @param extraName + * @return + */ @Override public List getExtraDeviceCodes(String extraName) { String extraValue = (String) this.getDevice().getExtraValue().get(extraName); @@ -841,7 +863,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl jo.put("message", message); jo.put("is_click", true); jo.put("driver_type", "slit_two_manipulator"); - jo.put("notCreateTaskMessage", notCreateTaskMessage); + jo.put("notCreateTaskMessage", LangProcess.msg(notCreateTaskMessage)); jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage)); jo.put("feedMessage", LangProcess.msg(feedMessage)); return jo; diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/subvolume_weighing_station/SubvolumeWeighingStationDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/subvolume_weighing_station/SubvolumeWeighingStationDriver.java index 61448083c..0dded8a7f 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/subvolume_weighing_station/SubvolumeWeighingStationDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/subvolume_weighing_station/SubvolumeWeighingStationDriver.java @@ -163,7 +163,6 @@ public class SubvolumeWeighingStationDriver extends AbstractOpcDeviceDriver impl jo.put("isOnline", this.getIsonline()); jo.put("error", this.getError()); jo.put("isError", this.getIserror()); - jo.put("message", LangProcess.msg(message)); jo.put("driver_type", "siemens_conveyor"); jo.put("is_click", true); return jo; diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java index 9265ed8b0..97c58156d 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java @@ -110,4 +110,12 @@ public class WmsToAcsController { return new ResponseEntity<>(wmstoacsService.putWeightAction(whereJson), HttpStatus.OK); } + @PostMapping("/getTubeMsg") + @Log("wms下发废箔重量") + @SaIgnore + public ResponseEntity getTubeMes(@RequestBody String whereJson) throws Exception { + return new ResponseEntity<>(wmstoacsService.getTubeMes(whereJson), HttpStatus.OK); + } + + } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java index f59592cae..a0f6d6f97 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java @@ -148,7 +148,7 @@ public interface AcsToWmsService { * @param param * @return */ - BlankingButtonResponse applyBlankButtonTask(BlankingButtonRequest param); + HttpResponse applyBlankButtonTask(JSONObject param); /** * 向lms申请反馈 diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java index b684c5951..44f38d9ec 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java @@ -117,4 +117,5 @@ public interface WmsToAcsService { */ Map putWeightAction(String jsonObject) throws Exception; + Map getTubeMes(String whereJson) throws Exception; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java index e7c8231e6..5191dc687 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java @@ -381,8 +381,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { @Override public ApplyGreenFoilButtonResponse applyGreenFoilButtonTask(ApplyGreenFoilButtonRequest param) { - try { - MDC.put(log_file_type, log_type); ApplyGreenFoilButtonResponse applyGreenFoilButtonResponse = new ApplyGreenFoilButtonResponse(); if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); @@ -409,49 +407,46 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { luceneLogService.interfaceExecuteLog(luceneLogDto); } return applyGreenFoilButtonResponse; - } finally { - MDC.remove(log_file_type); - } } @Override - public BlankingButtonResponse applyBlankButtonTask(BlankingButtonRequest param) { + public HttpResponse applyBlankButtonTask(JSONObject param) { + HttpResponse result = null; try { - MDC.put(log_file_type, log_type); - BlankingButtonResponse blankingButtonResponse = new BlankingButtonResponse(); - if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { - String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("applyButtonTask"); - String methods_url = addressDto.getMethods_url(); - String url = wmsUrl + methods_url; - log.info("BlankingButtonRequest----请求参数{}", param); - try { -// String result = ""; - String result = HttpRequest.post(url) - .body(JSON.toJSONString(param)) - .execute().body(); - JSONObject jsonObject = JSONObject.parseObject(result); - log.info("BlankingButtonResponse----返回参数{}", result); - blankingButtonResponse = JSONObject.toJavaObject(jsonObject, BlankingButtonResponse.class); - } catch (Exception e) { - JSONObject map = new JSONObject(); - map.put("status", 400); - map.put("message", e.getMessage()); - return JSONObject.toJavaObject(map, BlankingButtonResponse.class); - } - LuceneLogDto luceneLogDto = new LuceneLogDto(4,"BlankingButtonRequest", String.valueOf(blankingButtonResponse.getCode()), - JSON.toJSONString(param), String.valueOf(blankingButtonResponse.getMessage()), "ACS向LMS申请表处下料位按钮任务"); + String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); + AddressDto addressDto = addressService.findByCode("applyButtonTask"); + String methods_url = addressDto.getMethods_url(); + String url = wmsUrl + methods_url; + log.info("applyBlankButtonTask----反馈表处按钮请求路径{}", url); + try { + result = HttpRequest.post(url) + .header("Authorization", token) + .body(String.valueOf(param)) + .execute(); + } catch (Exception e) { + String message = e.getMessage(); + log.info("applyBlankButtonTask----反馈表处按钮请求失败{}", message); + LuceneLogDto luceneLogDto = new LuceneLogDto(4, "applyBlankButtonTask", String.valueOf(result.getStatus()), + JSON.toJSONString(result), + String.valueOf(result.body()), "反馈下发表处任务报错"); luceneLogService.interfaceExecuteLog(luceneLogDto); } - return blankingButtonResponse; + log.info("applyBlankButtonTask - 反馈表处按钮{}", result.body()); + LuceneLogDto luceneLogDto = new LuceneLogDto(4, "applyBlankButtonTask", String.valueOf(result.getStatus()), + JSON.toJSONString(result.body()), + String.valueOf(result.body()), "反馈下发表处任务"); + luceneLogService.interfaceExecuteLog(luceneLogDto); + return result; } finally { MDC.remove(log_file_type); + } } @Override public ApplyPlugPullSitResponse applyPlugPullSiteRequest(ApplyPlugPullSiteRequest param) { log.info("向LMS申请反馈,请求参数{}",param); + String result = ""; try { MDC.put(log_file_type, log_type); ApplyPlugPullSitResponse applyPlugPullSitResponse = new ApplyPlugPullSitResponse(); @@ -462,19 +457,25 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { String url = wmsUrl + methods_url; log.info("ApplyPlugPullSiteRequest----请求参数:{}", JSONObject.toJSONString(param)); try { -// String result = ""; - String result = HttpRequest.post(url) +// + result = HttpRequest.post(url) .body(JSON.toJSONString(param)) .execute().body(); JSONObject jsonObject = JSONObject.parseObject(result); log.info("ApplyPlugPullSitResponse----返回参数{}", result); applyPlugPullSitResponse = JSONObject.toJavaObject(jsonObject, ApplyPlugPullSitResponse.class); - LuceneLogDto luceneLogDto = new LuceneLogDto(4,"ApplyPlugPullSiteRequest", String.valueOf(applyPlugPullSitResponse.getCode()), + LuceneLogDto luceneLogDto = new LuceneLogDto(4, "ApplyPlugPullSiteRequest", String.valueOf(applyPlugPullSitResponse.getstatus()), JSON.toJSONString(param), String.valueOf(result), "ACS向LMS申请" - + ("1".equals(param.getType()) ? "套轴": "2".equals(param.getType()) ? "套轴完成": "3".equals(param.getType()) ? "拔轴完成": - "4".equals(param.getType()) ? "拔轴": "缓存线已满,生成行架任务")); + + ("1".equals(param.getType()) ? "套轴" : "2".equals(param.getType()) ? "套轴完成" : "3".equals(param.getType()) ? "拔轴完成" : + "4".equals(param.getType()) ? "拔轴" : "缓存线已满,生成行架任务")); luceneLogService.interfaceExecuteLog(luceneLogDto); } catch (Exception e) { + JSONObject jsonObject = JSONObject.parseObject(result); + log.info("ApplyPlugPullSitResponse----返回参数{}", result); + applyPlugPullSitResponse = JSONObject.toJavaObject(jsonObject, ApplyPlugPullSitResponse.class); + LuceneLogDto luceneLogDto = new LuceneLogDto(4, "ApplyPlugPullSiteRequest", String.valueOf(applyPlugPullSitResponse.getstatus()), + JSON.toJSONString(param), String.valueOf(result), "ACS向LMS申请失败"); + luceneLogService.interfaceExecuteLog(luceneLogDto); JSONObject map = new JSONObject(); map.put("status", 400); map.put("message", e.getMessage()); @@ -490,46 +491,43 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { @Override public ApplyfeedbackSubVolumeWeightResponse applyfeedbackSubVolumeWeight(ApplyfeedbackSubVolumeWeightRequest param) { - log.info("向LMS申请反馈,请求参数{}",param); - try { - MDC.put(log_file_type, log_type); - ApplyfeedbackSubVolumeWeightResponse applyfeedbackSubVolumeWeightResponse = new ApplyfeedbackSubVolumeWeightResponse(); - if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { - String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("applyfeedbackSubVolumeWeightRequest"); - String methods_url = addressDto.getMethods_url(); - String url = wmsUrl + methods_url; - log.info("applyfeedbackSubVolumeWeightRequest----请求参数:{}", JSONObject.toJSONString(param)); - try { -// String result = ""; - String result = HttpRequest.post(url) - .body(JSON.toJSONString(param)) - .execute().body(); - JSONObject jsonObject = JSONObject.parseObject(result); - log.info("applyfeedbackSubVolumeWeightRequest----返回参数{}", result); - applyfeedbackSubVolumeWeightResponse = JSONObject.toJavaObject(jsonObject, ApplyfeedbackSubVolumeWeightResponse.class); - } catch (Exception e) { - JSONObject map = new JSONObject(); - map.put("status", 400); - map.put("message", e.getMessage()); - return JSONObject.toJavaObject(map, ApplyfeedbackSubVolumeWeightResponse.class); - } + log.info("向LMS申请反馈,请求参数{}", param); + String result = ""; + ApplyfeedbackSubVolumeWeightResponse applyfeedbackSubVolumeWeightResponse = new ApplyfeedbackSubVolumeWeightResponse(); + if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { + String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); + AddressDto addressDto = addressService.findByCode("applyfeedbackSubVolumeWeightRequest"); + String methods_url = addressDto.getMethods_url(); + String url = wmsUrl + methods_url; + log.info("applyfeedbackSubVolumeWeightRequest----请求参数:{}", JSONObject.toJSONString(param)); + try { +// + result = HttpRequest.post(url) + .body(JSON.toJSONString(param)) + .execute().body(); + JSONObject jsonObject = JSONObject.parseObject(result); + log.info("applyfeedbackSubVolumeWeightRequest----返回参数{}", result); + applyfeedbackSubVolumeWeightResponse = JSONObject.toJavaObject(jsonObject, ApplyfeedbackSubVolumeWeightResponse.class); + } catch (Exception e) { + JSONObject jsonObject = JSONObject.parseObject(result); + log.info("applyfeedbackSubVolumeWeightRequest----返回参数{}", result); + JSONObject map = new JSONObject(); + map.put("status", 400); + map.put("message", e.getMessage()); + return JSONObject.toJavaObject(map, ApplyfeedbackSubVolumeWeightResponse.class); + } LuceneLogDto luceneLogDto = new LuceneLogDto(4,"applyfeedbackSubVolumeWeightRequest", String.valueOf(applyfeedbackSubVolumeWeightResponse.getCode()), JSON.toJSONString(param), String.valueOf(applyfeedbackSubVolumeWeightResponse.getMessage()), "ACS反馈LMS子卷重量"); luceneLogService.interfaceExecuteLog(luceneLogDto); } return applyfeedbackSubVolumeWeightResponse; - } finally { - MDC.remove(log_file_type); - } } @Override public ApplyManipulatorActionResponse applyManipulatorActionRequest(ApplyManipulatorActionRequest param) { log.info("向LMS申请反馈,请求参数{}", param); - try { - MDC.put(log_file_type, log_type); - ApplyManipulatorActionResponse applyManipulatorActionResponse = new ApplyManipulatorActionResponse(); + String result = ""; + ApplyManipulatorActionResponse applyManipulatorActionResponse = new ApplyManipulatorActionResponse(); if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); AddressDto addressDto = addressService.findByCode("applyManipulatorAction"); @@ -537,28 +535,29 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { String url = wmsUrl + methods_url; log.info("ApplyManipulatorActionRequest----请求参数:{}", JSONObject.toJSONString(param)); try { -// String result = ""; - String result = HttpRequest.post(url) + result = HttpRequest.post(url) .body(JSON.toJSONString(param)) .execute().body(); JSONObject jsonObject = JSONObject.parseObject(result); log.info("ApplyManipulatorActionResponse----返回参数{}", result); applyManipulatorActionResponse = JSONObject.toJavaObject(jsonObject, ApplyManipulatorActionResponse.class); } catch (Exception e) { + JSONObject jsonObject = JSONObject.parseObject(result); + log.info("ApplyManipulatorActionResponse----返回参数{}", result); + applyManipulatorActionResponse = JSONObject.toJavaObject(jsonObject, ApplyManipulatorActionResponse.class); + LuceneLogDto luceneLogDto = new LuceneLogDto(4, "ApplyManipulatorActionRequest", String.valueOf(applyManipulatorActionResponse.getCode()), + JSON.toJSONString(param), String.valueOf(applyManipulatorActionResponse), "ACS向LMS申请反馈子卷重量失败"); + luceneLogService.interfaceExecuteLog(luceneLogDto); JSONObject map = new JSONObject(); map.put("status", 400); map.put("message", e.getMessage()); return JSONObject.toJavaObject(map, ApplyManipulatorActionResponse.class); } - LuceneLogDto luceneLogDto = new LuceneLogDto(4,"ApplyManipulatorActionRequest", String.valueOf(applyManipulatorActionResponse.getCode()), - JSON.toJSONString(param), String.valueOf(applyManipulatorActionResponse), "ACS向LMS申请反馈子卷重量"); + LuceneLogDto luceneLogDto = new LuceneLogDto(4, "ApplyManipulatorActionRequest", String.valueOf(applyManipulatorActionResponse.getCode()), + JSON.toJSONString(param), String.valueOf(applyManipulatorActionResponse), "ACS向LMS申请反馈子卷重量成功"); luceneLogService.interfaceExecuteLog(luceneLogDto); } return applyManipulatorActionResponse; - } finally { - MDC.remove(log_file_type); - - } } @Override diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java index fcee9fdbf..23413ae31 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java @@ -22,6 +22,7 @@ import org.nl.acs.device_driver.one_conveyor.fold_disc_site.FoldDiscSiteDeviceDr import org.nl.acs.device_driver.one_manipulator.box_package_manipulator.BoxPackageManipulatorDeviceDriver; import org.nl.acs.device_driver.conveyor.box_palletizing_manipulator.BoxPalletizingManipulatorDeviceDriver; import org.nl.acs.device_driver.paper_tube_device2.PaperTubeConveyor2DeviceDriver; +import org.nl.acs.device_driver.paper_tube_pick_site.PaperTubePickSiteDeviceDriver; import org.nl.acs.device_driver.two_conveyor.blank_manipulator.BlankManipulatorDeviceDriver; import org.nl.acs.device_driver.two_conveyor.hongxiang_conveyor.HongXiangStationDeviceDriver; import org.nl.acs.device_driver.two_conveyor.hongxiang_device.HongXiangConveyorDeviceDriver; @@ -56,10 +57,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Service; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; @Service @RequiredArgsConstructor @@ -78,6 +76,9 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { @Autowired private InstructionService instructionService; + @Autowired + private LuceneExecuteLogService luceneLogService; + @Autowired private AcsToLiKuService acsToLiKuService; @@ -489,19 +490,20 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { @Override public PutActionResponse putAction(String jsonObject) throws Exception { - try { - MDC.put(log_file_type, log_type); - log.info("putAction--------------:输入参数" + jsonObject); - JSONArray datas = JSONArray.parseArray(jsonObject); - PutActionResponse response = new PutActionResponse(); - JSONArray errArr = new JSONArray(); - for (int i = 0; i < datas.size(); i++) { - String data = datas.get(i).toString(); - PutActionRequest request = JsonUtl.format(data, PutActionRequest.class); - String device_code = request.getDevice_code(); - String code = request.getCode(); - String value = request.getValue(); - Device device = deviceAppService.findDeviceByCode(device_code); + log.info("putAction--------------:输入参数" + jsonObject); + String date = new Date().toString(); + LuceneLogDto luceneLogDto = new LuceneLogDto(4, jsonObject, date+"LMS反馈ACS动作信号"); + luceneLogService.interfaceExecuteLog(luceneLogDto); + JSONArray datas = JSONArray.parseArray(jsonObject); + PutActionResponse response = new PutActionResponse(); + JSONArray errArr = new JSONArray(); + for (int i = 0; i < datas.size(); i++) { + String data = datas.get(i).toString(); + PutActionRequest request = JsonUtl.format(data, PutActionRequest.class); + String device_code = request.getDevice_code(); + String code = request.getCode(); + String value = request.getValue(); + Device device = deviceAppService.findDeviceByCode(device_code); if (ObjectUtil.isEmpty(device)) { throw new Exception("未找到对应设备:" + device_code); } @@ -547,78 +549,119 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { } } response.setStatus(200); - response.setMessage("success"); - LuceneLogDto luceneLogDto = new LuceneLogDto(4,"putAction", String.valueOf(response.getCode()), - jsonObject, String.valueOf(response), "LMS下发动作"); - luceneExecuteLogService.interfaceExecuteLog(luceneLogDto); - log.info("putAction--------------:输出参数:" + response); - return response; - } finally { - MDC.remove(log_file_type); - } + response.setMessage("success"); + LuceneLogDto luceneLogDto1 = new LuceneLogDto(4, "putAction", String.valueOf(response.getCode()), + jsonObject, String.valueOf(response), "LMS下发动作"); + luceneExecuteLogService.interfaceExecuteLog(luceneLogDto); + log.info("putAction--------------:输出参数:" + response); + return response; } @Override public Map putWeightAction(String jsonObject) throws Exception { - try { - MDC.put(log_file_type, log_type); - log.info("putWeightAction--------------:输入参数" + jsonObject); - JSONArray datas = JSONArray.parseArray(jsonObject); - JSONObject jo = new JSONObject(); - for (int i = 0; i < datas.size(); i++) { - JSONObject data = (JSONObject) datas.get(i); - String device_code = data.getString("device_code"); - String type = data.getString("type"); - Device device = deviceAppService.findDeviceByCode(device_code); - if (ObjectUtil.isEmpty(device)) { - throw new Exception("未找到对应设备:" + device_code); - } - WasteFoilWeighingStationDriver wasteFoilWeighingStationDriver; - if (device.getDeviceDriver() instanceof WasteFoilWeighingStationDriver) { - wasteFoilWeighingStationDriver = (WasteFoilWeighingStationDriver) device.getDeviceDriver(); - try { - //称重完成 - if (StrUtil.equals("1", type)) { - wasteFoilWeighingStationDriver.writing("to_command", "6"); - Thread.sleep(1000); //休眠1秒 - while (true) { - if (wasteFoilWeighingStationDriver.getMode()==6){ - jo.put("currentWeight", wasteFoilWeighingStationDriver.getWeight());//当前重量 - jo.put("lastWeight", wasteFoilWeighingStationDriver.getOld_weight());//上一次重量 - jo.put("weightGap", wasteFoilWeighingStationDriver.getGap_weight());//重量差 - break; - } + log.info("putWeightAction--------------:输入参数" + jsonObject); + String date = new Date().toString(); + LuceneLogDto luceneLogDto = new LuceneLogDto(4, jsonObject, date+"LMS反馈ACS废箔重量"); + luceneLogService.interfaceExecuteLog(luceneLogDto); + JSONArray datas = JSONArray.parseArray(jsonObject); + JSONObject jo = new JSONObject(); + for (int i = 0; i < datas.size(); i++) { + JSONObject data = (JSONObject) datas.get(i); + String device_code = data.getString("device_code"); + String type = data.getString("type"); + Device device = deviceAppService.findDeviceByCode(device_code); + if (ObjectUtil.isEmpty(device)) { + throw new Exception("未找到对应设备:" + device_code); + } + WasteFoilWeighingStationDriver wasteFoilWeighingStationDriver; + if (device.getDeviceDriver() instanceof WasteFoilWeighingStationDriver) { + wasteFoilWeighingStationDriver = (WasteFoilWeighingStationDriver) device.getDeviceDriver(); + try { + //称重完成 + if (StrUtil.equals("1", type)) { + wasteFoilWeighingStationDriver.writing("to_command", "6"); + Thread.sleep(1000); //休眠1秒 + while (true) { + if (wasteFoilWeighingStationDriver.getMode() == 6) { + jo.put("currentWeight", wasteFoilWeighingStationDriver.getWeight());//当前重量 + jo.put("lastWeight", wasteFoilWeighingStationDriver.getOld_weight());//上一次重量 + jo.put("weightGap", wasteFoilWeighingStationDriver.getGap_weight());//重量差 + break; } - wasteFoilWeighingStationDriver.writing("to_command", "0"); } - //称重确认信号 - else if (StrUtil.equals("2", type)) { - wasteFoilWeighingStationDriver.writing("to_command", "7"); - Thread.sleep(1000); //休眠1秒 - while (true) { - if (wasteFoilWeighingStationDriver.getMode()==7){ - jo.put("currentWeight", wasteFoilWeighingStationDriver.getWeight());//当前重量 - jo.put("lastWeight", wasteFoilWeighingStationDriver.getOld_weight());//上一次重量 - jo.put("weightGap", wasteFoilWeighingStationDriver.getGap_weight());//重量差 - break; - } - } - wasteFoilWeighingStationDriver.writing("to_command", "0"); - } - } catch (InterruptedException e) { - e.printStackTrace(); + wasteFoilWeighingStationDriver.writing("to_command", "0"); } + //称重确认信号 + else if (StrUtil.equals("2", type)) { + wasteFoilWeighingStationDriver.writing("to_command", "7"); + Thread.sleep(1000); //休眠1秒 + while (true) { + if (wasteFoilWeighingStationDriver.getMode() == 7) { + jo.put("currentWeight", wasteFoilWeighingStationDriver.getWeight());//当前重量 + jo.put("lastWeight", wasteFoilWeighingStationDriver.getOld_weight());//上一次重量 + jo.put("weightGap", wasteFoilWeighingStationDriver.getGap_weight());//重量差 + break; + } + } + wasteFoilWeighingStationDriver.writing("to_command", "0"); + } + } catch (InterruptedException e) { + e.printStackTrace(); } } - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.OK.value()); - resultJson.put("message", "操作成功"); - resultJson.put("data", jo); - log.info("putWeightAction--------------:输出参数" + resultJson.toString()); - return resultJson; - } finally { - MDC.remove(log_file_type); } + JSONObject resultJson = new JSONObject(); + resultJson.put("status", HttpStatus.OK.value()); + resultJson.put("message", "操作成功"); + resultJson.put("data", jo); + log.info("putWeightAction--------------:输出参数" + resultJson.toString()); + return resultJson; + } + + @Override + public Map getTubeMes(String jsonObject) throws Exception { + log.info("getTubeMes--------------:输入参数" + jsonObject); + String date = new Date().toString(); + LuceneLogDto luceneLogDto = new LuceneLogDto(4, jsonObject, date+"获取管芯信息"); + luceneLogService.interfaceExecuteLog(luceneLogDto); + JSONArray datas = JSONArray.parseArray(jsonObject); + JSONObject jo = new JSONObject(); + for (int i = 0; i < datas.size(); i++) { + JSONObject data = (JSONObject) datas.get(i); + String device_code = data.getString("device_code"); + String to_material = data.getString("to_material"); + String to_spec = data.getString("to_spec"); + String to_qty = data.getString("to_qty"); + + Device device = deviceAppService.findDeviceByCode(device_code); + if (ObjectUtil.isEmpty(device)) { + throw new Exception("未找到对应设备:" + device_code); + } + PaperTubePickSiteDeviceDriver paperTubePickSiteDeviceDriver; + if (device.getDeviceDriver() instanceof WasteFoilWeighingStationDriver) { + paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver(); + try { + //反馈管芯信息 + Thread.sleep(1000); //休眠1秒 + while (true) { + if (paperTubePickSiteDeviceDriver.getMode() == 2 && paperTubePickSiteDeviceDriver.getFlag() == 3) { + jo.put("to_material", to_material);//当前重量 + jo.put("to_spec", to_spec);//上一次重量 + jo.put("to_qty", to_qty);//重量差 + break; + } + } + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + JSONObject resultJson = new JSONObject(); + resultJson.put("status", HttpStatus.OK.value()); + resultJson.put("message", "操作成功"); + resultJson.put("data", jo); + log.info("putWeightAction--------------:输出参数" + resultJson.toString()); + return resultJson; } @Override diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/InstructionService.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/InstructionService.java index bf534eaa1..4a8087ef1 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/InstructionService.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/InstructionService.java @@ -7,6 +7,7 @@ import org.nl.acs.instruction.service.dto.InstructionQueryParam; import org.nl.acs.common.base.PageInfo; import org.nl.acs.common.base.CommonService; import org.nl.acs.instruction.domain.Instruction; +import org.nl.acs.task.service.dto.TaskDto; import org.springframework.data.domain.Pageable; import javax.servlet.http.HttpServletResponse; @@ -333,6 +334,22 @@ public interface InstructionService extends CommonService { */ Instruction findByDeviceCodeFromCache(String devicecode); + /** + * 根据起点设备编号查询当前是否有就绪指令 + * + * @param device_code + * @return + */ + Instruction findByStartCodeAndReady(String device_code); + + /** + * 根据终点设备编号查询当前是否有就绪指令 + * + * @param device_code + * @return + */ + Instruction findByEndCodeAndReady(String device_code); + /** * 根据终点查询指令 diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/dto/InteractionJsonDTO.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/dto/InteractionJsonDTO.java new file mode 100644 index 000000000..4ab6cfa81 --- /dev/null +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/dto/InteractionJsonDTO.java @@ -0,0 +1,13 @@ +package org.nl.acs.instruction.service.dto; + +import lombok.Data; + +@Data +public class InteractionJsonDTO { + + /** + * agv叉车调整长宽 + */ + private Double expandWidthLength; + +} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java index 0e2fab15f..e9a970c0e 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java @@ -42,6 +42,7 @@ import org.nl.acs.instruction.domain.InstructionMybatis; import org.nl.acs.instruction.enums.InstructionStatusEnum; import org.nl.acs.instruction.service.dto.InstructionDto; import org.nl.acs.instruction.service.dto.InstructionQueryParam; +import org.nl.acs.instruction.service.dto.InteractionJsonDTO; import org.nl.acs.limit_regional.server.LimitRegionalService; import org.nl.acs.limit_regional.server.dto.LimitRegionalDto; import org.nl.acs.opc.DeviceAppService; @@ -51,6 +52,7 @@ import org.nl.acs.route.service.dto.RouteLineDto; import org.nl.acs.route.service.impl.RouteLineServiceImpl; import org.nl.acs.task.TaskInstructionLock; import org.nl.acs.task.domain.Task; +import org.nl.acs.task.enums.AgvSystemTypeEnum; import org.nl.acs.task.enums.TaskStatusEnum; import org.nl.acs.task.service.TaskService; import org.nl.acs.task.service.dto.TaskDto; @@ -381,11 +383,11 @@ public class InstructionServiceImpl extends CommonServiceImpl instructionMybatis = instructionMapper.selectList(Wrappers.lambdaQuery(InstructionMybatis.class) .eq(InstructionMybatis::getTask_code, dto.getTask_code())); - if(CollUtil.isNotEmpty(instructionMybatis) && instructionMybatis.stream().anyMatch(inst -> inst.getStart_device_code() - .equals(start_device_code))){ + if (CollUtil.isNotEmpty(instructionMybatis) && instructionMybatis.stream().anyMatch(inst -> inst.getStart_device_code() + .equals(start_device_code))) { return; } } @@ -470,7 +472,7 @@ public class InstructionServiceImpl extends CommonServiceImpl 0 && StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE) && dto.getAgv_system_type().equals(CommonFinalParam.TWO)) { + if (shortPathsList.size() > 0 && StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE) && dto.getAgv_system_type().equals(AgvSystemTypeEnum.Two_NDC_System_Type.getIndex())) { // 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())) { @@ -500,26 +502,33 @@ public class InstructionServiceImpl extends CommonServiceImpl 0 && StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE) && dto.getAgv_system_type().equals(CommonFinalParam.ONE)) { + if (shortPathsList.size() > 0 && StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE)) { Device deviceByCode = deviceAppService.findDeviceByCode(dto.getStart_device_code()); - if (StrUtil.equals(task.getRequest_again_success(), "1")) { - //追加订单 - HttpResponse result = xiangGongAgvService.addOrderSequences(dto); - if (ObjectUtils.isEmpty(result) || result.getStatus() != 200) { - dto.setSend_status("2"); - } else { - dto.setSend_status("1"); +// if (StrUtil.equals(task.getRequest_again_success(), "1")) { +// //追加订单 +// HttpResponse result = xiangGongAgvService.addOrderSequences(dto); +// if (ObjectUtils.isEmpty(result) || result.getStatus() != 200) { +// dto.setSend_status("2"); +// } else { +// dto.setSend_status("1"); +// } +// +// } else + if (dto.getAgv_system_type().equals(AgvSystemTypeEnum.XG_System_Type.getIndex())) { + String interactionJson = task.getInteraction_json(); + if (StrUtil.isNotEmpty(interactionJson)){ + throw new BadRequestException("agv叉车调整长宽参数为空"); } + InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class); //仙工叉车 - } else if (deviceByCode.getDeviceDriver() instanceof BeltConveyorDeviceDriver) { - HttpResponse response = xiangGongAgvService.sendOrderSequencesToForklift(dto); + HttpResponse response = xiangGongAgvService.sendOrderSequencesToForklift(dto,interactionJsonDTO); if (ObjectUtils.isEmpty(response) || response.getStatus() != 200) { dto.setSend_status("2"); } else { dto.setSend_status("1"); } - } else { - //创建运单序列 + } else if (dto.getAgv_system_type().equals(AgvSystemTypeEnum.One_NDC_System_Type.getIndex())) { + //一楼agv任务创建运单序列 HttpResponse response = xiangGongAgvService.sendOrderSequencesToXZ(dto); if (ObjectUtils.isEmpty(response) || response.getStatus() != 200) { dto.setSend_status("2"); @@ -533,7 +542,7 @@ public class InstructionServiceImpl extends CommonServiceImpl it = instructions.iterator(); while (it.hasNext()) { Instruction inst = it.next(); - if (StrUtil.equals(devicecode, inst.getNext_device_code()) && Integer.parseInt(inst.getInstruction_status())<=Integer.parseInt(InstructionStatusEnum.BUSY.getIndex())) { + if (StrUtil.equals(devicecode, inst.getNext_device_code()) && Integer.parseInt(inst.getInstruction_status()) <= Integer.parseInt(InstructionStatusEnum.BUSY.getIndex())) { return inst; } } @@ -1722,6 +1739,24 @@ public class InstructionServiceImpl extends CommonServiceImpl optionalInstruction = instructions.stream() + .filter(instruction -> StrUtil.equals(instruction.getStart_device_code(), device_code) + && StrUtil.equals(instruction.getInstruction_status(), InstructionStatusEnum.READY.getIndex())) + .findFirst(); + return optionalInstruction.orElse(null); + } + + @Override + public Instruction findByEndCodeAndReady(String device_code) { + Optional optionalInstruction = instructions.stream() + .filter(instruction -> StrUtil.equals(instruction.getNext_device_code(), device_code) + && StrUtil.equals(instruction.getInstruction_status(), InstructionStatusEnum.READY.getIndex())) + .findFirst(); + return optionalInstruction.orElse(null); + } + @Override public List findByDeviceCodes(Instruction instruction1, Boolean flay) { List instructionList = new ArrayList<>(); @@ -1866,7 +1901,6 @@ public class InstructionServiceImpl extends CommonServiceImpl impleme List shortPathsList = routeLineService.getShortPathLines( start_device_code, acsTask.getNext_device_code(), route_plan_code); + Device startDevice = deviceAppService.findDeviceByCode(start_device_code); RouteLineDto routeLineDto = shortPathsList.get(0); String path = routeLineDto.getPath(); String type = routeLineDto.getType(); @@ -914,7 +917,12 @@ public class TaskServiceImpl extends CommonServiceImpl impleme int index = 0; for (int m = 0; m < pathlist.size(); m++) { if (pathlist.get(m).equals(start_device_code)) { - index = m + 1; + //起点为货架跳过堆垛机 + if (startDevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { + index = m + 2; + }else { + index = m + 1; + } break; } } @@ -1077,9 +1085,10 @@ public class TaskServiceImpl extends CommonServiceImpl impleme @Override public TaskDto findByStartCodeAndReady(String device_code) { + //根据时间升序取第一个 Optional optionalTask = tasks.stream() .filter(task -> StrUtil.equals(task.getStart_device_code(), device_code) - && StrUtil.equals(task.getTask_status(), TaskStatusEnum.READY.getIndex())) + && StrUtil.equals(task.getTask_status(), TaskStatusEnum.READY.getIndex())).sorted(Comparator.comparing(TaskDto::getCreate_time)) .findFirst(); return optionalTask.orElse(null); } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/annotation/Query.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/annotation/Query.java index 2abca5a5a..e3a102959 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/annotation/Query.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/annotation/Query.java @@ -33,7 +33,7 @@ public @interface Query { // Dong ZhaoYang 2017/8/7 查询方式 Type type() default Type.EQUAL; - /** + /**r * 连接查询的属性名,如User类中的dept */ String joinName() default ""; diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/service/dto/LuceneLogDto.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/service/dto/LuceneLogDto.java index dc3a78979..720eaa1cf 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/service/dto/LuceneLogDto.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/service/dto/LuceneLogDto.java @@ -92,13 +92,18 @@ public class LuceneLogDto { final String requestparam, final String responseparam, final String content) { super(); this.log_level = log_level; - this.method = method; - this.status_code = status; this.requestparam = requestparam; this.responseparam = responseparam; this.content = content; } + public LuceneLogDto(final Integer log_level, final String requestparam, final String content) { + super(); + this.log_level = log_level; + this.requestparam = requestparam; + this.content = content; + } + public LuceneLogDto(final String device_code, final String remark) { super(); this.device_code = device_code; diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/AutoCreateInst.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/AutoCreateInst.java index 3debd9ce3..a8bd8141f 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/AutoCreateInst.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/AutoCreateInst.java @@ -162,7 +162,7 @@ public class AutoCreateInst { //1、1楼叉车系统 //2、2楼1区域AGV系统 //3、2楼2区域AGV系统 -已废弃 - if (!StrUtil.equals(agv_system_type, CommonFinalParam.ONE)) { + if (StrUtil.equals(agv_system_type, CommonFinalParam.TWO)) { // task_type //1、生箔; Itype=1:取空,取满,放空,放满; //2、分切 Itype=3取满、取空、放满、放空; diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/CreateDDJInst.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/CreateDDJInst.java index 58fdbace2..094b822ce 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/CreateDDJInst.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/CreateDDJInst.java @@ -59,7 +59,7 @@ public class CreateDDJInst { //判断有无出入库任务是相同路线 TaskDto dto = taskserver.findByCodeAndExcute(next_device_code, start_device_code); if (ObjectUtil.isNotEmpty(dto)) { - return; + continue; } if (startDevice.getDevice_type().equals(DeviceType.storage.name()) && (nextDevice.getDevice_type().equals(DeviceType.conveyor.name()) || nextDevice.getDevice_type().equals(DeviceType.storage.name()))) { @@ -115,7 +115,7 @@ public class CreateDDJInst { deviceByCode = appService.findDeviceByCode(pathlist.get(1)); if (ObjectUtils.isEmpty(deviceByCode)) { log.error("没有找到DDJ设备"); - return; + continue; } StandardStackerDeviceDriver standardStackerDeviceDriver; if (deviceByCode.getDeviceDriver() instanceof StandardStackerDeviceDriver) { @@ -123,7 +123,7 @@ public class CreateDDJInst { if (standardStackerDeviceDriver.getMode() != 3 || standardStackerDeviceDriver.getForkCargo() == 1 || standardStackerDeviceDriver.getCommand() != 0) { log.error("堆垛机,{}未联机或者在执行中", deviceByCode.getDevice_code()); ((StandardStackerDeviceDriver) deviceByCode.getDeviceDriver()).setNotCreateInstMessage("堆垛机,{}未联机或者在执行中"); - return; + continue; } } next_device_code = start_device_code; @@ -142,7 +142,7 @@ public class CreateDDJInst { if (ObjectUtils.isEmpty(deviceByCode)) { log.error("没有找到DDJ设备"); - return; + continue; } StandardStackerDeviceDriver standardStackerDeviceDriver; if (deviceByCode.getDeviceDriver() instanceof StandardStackerDeviceDriver) { @@ -150,7 +150,7 @@ public class CreateDDJInst { if (standardStackerDeviceDriver.getMode() != 3 || standardStackerDeviceDriver.getForkCargo() == 1 || standardStackerDeviceDriver.getCommand() != 0 || standardStackerDeviceDriver.getError() != 0) { log.error("堆垛机,{}未联机或者在执行中或者有异常", deviceByCode.getDevice_code()); ((StandardStackerDeviceDriver) deviceByCode.getDeviceDriver()).setNotCreateInstMessage("堆垛机,{}未联机或者在执行中"); - return; + continue; } } @@ -205,7 +205,7 @@ public class CreateDDJInst { if (beltConveyorDeviceDriver.getMode() != 2 || beltConveyorDeviceDriver.getMove() == 1) { log.error("输送机,{}未联机或执行中", next_device_code); ((BeltConveyorDeviceDriver) nextDevice.getDeviceDriver()).setNotCreateInstMessage("one_message7"); - return; + continue; } } @@ -219,7 +219,7 @@ public class CreateDDJInst { List byCodeAndExcute = instructionService.findByCodeAndExcute(next_device_code); if (CollUtil.isNotEmpty(byCodeAndExcute)){ ((StandardStackerDeviceDriver) deviceByCode.getDeviceDriver()).setNotCreateInstMessage("有DDJ对接位出入库的指令"); - return; + continue; } instdto.setInstruction_type(task_type); instdto.setInstruction_id(IdUtil.simpleUUID()); diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml b/acs2/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml index e6a974ebe..8415b20de 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml @@ -10,7 +10,7 @@ spring: driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy # url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:stand_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true # url: jdbc:log4jdbc:mysql://${DB_HOST:47.111.78.178}:${DB_PORT:3306}/${DB_NAME:lzhl_two_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true - url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:lzhl_two_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true + url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.10.67}:${DB_PORT:3306}/${DB_NAME:lzhl_acs2}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true username: ${DB_USER:root} # password: ${DB_PWD:Root.123456} diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/config/application-prod.yml b/acs2/nladmin-system/nlsso-server/src/main/resources/config/application-prod.yml index a3bb23c63..0e1081552 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/config/application-prod.yml +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/config/application-prod.yml @@ -157,3 +157,8 @@ sa-token: token-prefix: Bearer is-read-cookie: false is-read-body: false + + + + agvToAcs: + addr: http://http://10.1.3.96:8011 diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal.properties b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal.properties index 1b40b75a1..5249d3352 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal.properties +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal.properties @@ -1,4 +1,4 @@ -universal_null = \u7A7A +universal_null =\u7A7A universal_off-line=\u8131\u673A universal_stand-alone=\u5355\u673A universal_standby=\u5F85\u673A @@ -35,6 +35,8 @@ universal_message8=\u8BFB\u53D6\u4FE1\u53F7\u503C\u65F6\u51FA\u73B0\u5F02\u5E38: universal_message9=\u521B\u5EFA\u6307\u4EE4\u65F6\u51FA\u73B0\u5F02\u5E38: universal_message10=\u4E0B\u53D1\u591A\u4E2A\u7535\u6C14\u4FE1\u53F7: universal_message11=\u4FE1\u53F7\u8FDE\u63A5\u5F02\u5E38\uFF01 +universal_message12=\u7533\u8BF7\u884C\u67B6\u4EFB\u52A1\u6210\u529F\uFF01 +universal_message13=\u7533\u8BF7\u884C\u67B6\u4EFB\u52A1\u5931\u8D25\uFF01 universal_feedMessage1=\u5DE5\u4F5C\u6A21\u5F0F(mode)\u4E0D\u4E3A\u8FD0\u884C\u4E2D\u72B6\u6001 universal_feedMessage2=\u52A8\u4F5C\u4FE1\u53F7(action)\u4E0D\u4E3A\u653E\u8D27\u5B8C\u6210\u72B6\u6001 universal_feedMessage3=\u5149\u7535\u4FE1\u53F7(move)\u4E0D\u4E3A\u65E0\u8D27\u72B6\u6001 diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_en_US.properties b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_en_US.properties index 23e6b11a5..b06e2d793 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_en_US.properties +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_en_US.properties @@ -33,6 +33,8 @@ universal_message8=An exception occurred when reading the signal value: universal_message9=An exception occurred while creating the directive universal_message10=Multiple electrical signals are issued universal_message11=The signal connection is abnormal! +universal_message12=Successfully applied for shelving task! +universal_message13=Application for shelving task failed! universal_feedMessage1=mode is not in the running state universal_feedMessage2=action signal (action signal) is not a release completed status universal_feedMessage3=Photoelectric signal (move) is not out of stock diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_in_ID.properties b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_in_ID.properties index 757a7c99c..7f4707491 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_in_ID.properties +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_in_ID.properties @@ -32,6 +32,8 @@ universal_message7=Misi tercapai ... universal_message8=Pengecualian terjadi saat membaca nilai sinyal: universal_message9=Pengecualian terjadi saat membuat direktif universal_message10=Beberapa sinyal listrik dikeluarkan +universal_message12=Aplikasi untuk tugas perancah berhasil! +universal_message13=Gagal melamar tugas memeras! universal_message11=Koneksi sinyal tidak normal! universal_feedMessage1=Mode kerja tidak untuk mode dalam mode universal_feedMessage2=Sinyal aksi tidak lengkap untuk penempatan diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_zh_CN.properties b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_zh_CN.properties index ca6a05aa7..83e651b28 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_zh_CN.properties +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_zh_CN.properties @@ -33,6 +33,8 @@ universal_message8=\u8BFB\u53D6\u4FE1\u53F7\u503C\u65F6\u51FA\u73B0\u5F02\u5E38: universal_message9=\u521B\u5EFA\u6307\u4EE4\u65F6\u51FA\u73B0\u5F02\u5E38: universal_message10=\u4E0B\u53D1\u591A\u4E2A\u7535\u6C14\u4FE1\u53F7 universal_message11=\u4FE1\u53F7\u8FDE\u63A5\u5F02\u5E38\uFF01 +universal_message12=\u7533\u8BF7\u884C\u67B6\u4EFB\u52A1\u6210\u529F\uFF01 +universal_message13=\u7533\u8BF7\u884C\u67B6\u4EFB\u52A1\u5931\u8D25\uFF01 universal_feedMessage1=\u5DE5\u4F5C\u6A21\u5F0F(mode)\u4E0D\u4E3A\u8FD0\u884C\u4E2D\u72B6\u6001 universal_feedMessage2=\u52A8\u4F5C\u4FE1\u53F7(action)\u4E0D\u4E3A\u653E\u8D27\u5B8C\u6210\u72B6\u6001 universal_feedMessage3=\u5149\u7535\u4FE1\u53F7(move)\u4E0D\u4E3A\u65E0\u8D27\u72B6\u6001 diff --git a/acs2/nladmin-ui/src/i18n/langs/monitor/en.js b/acs2/nladmin-ui/src/i18n/langs/monitor/en.js index ea557524d..c597c9250 100644 --- a/acs2/nladmin-ui/src/i18n/langs/monitor/en.js +++ b/acs2/nladmin-ui/src/i18n/langs/monitor/en.js @@ -96,6 +96,7 @@ export default { 'previous_station_task': 'Former station task number', 'back_station_task': 'station task Back number', 'task_number': 'task number', + 'command': 'command', 'disable': 'Whether to disable', 'current_temperature': 'Current temperature', 'oven_finish': 'Oven complete', diff --git a/acs2/nladmin-ui/src/i18n/langs/monitor/in.js b/acs2/nladmin-ui/src/i18n/langs/monitor/in.js index 1ce62c624..be5f9fc1e 100644 --- a/acs2/nladmin-ui/src/i18n/langs/monitor/in.js +++ b/acs2/nladmin-ui/src/i18n/langs/monitor/in.js @@ -96,6 +96,7 @@ export default { 'previous_station_task': 'Mantan pegawai stasiun', 'back_station_task': 'Back star number', 'task_number': 'Mission no', + 'command': 'perbuatan', 'disable': 'apakah dinonaktifkan', 'current_temperature': 'Suhu saat ini', 'oven_finish': 'Oven selesai', diff --git a/acs2/nladmin-ui/src/i18n/langs/monitor/zh.js b/acs2/nladmin-ui/src/i18n/langs/monitor/zh.js index 811fde9f6..d7f237bcb 100644 --- a/acs2/nladmin-ui/src/i18n/langs/monitor/zh.js +++ b/acs2/nladmin-ui/src/i18n/langs/monitor/zh.js @@ -96,6 +96,7 @@ export default { 'previous_station_task': '前工位任务号', 'back_station_task': '后工位任务号', 'task_number': '任务号', + 'command': '动作', 'disable': '是否禁用', 'current_temperature': '当前温度', 'oven_finish': '烘箱完成', diff --git a/acs2/nladmin-ui/src/i18n/langs/task/en.js b/acs2/nladmin-ui/src/i18n/langs/task/en.js index 5ff18b36a..5585ec735 100644 --- a/acs2/nladmin-ui/src/i18n/langs/task/en.js +++ b/acs2/nladmin-ui/src/i18n/langs/task/en.js @@ -27,6 +27,7 @@ export default { 'Starting_layer': 'Starting Layer', 'Destination': 'Destination', 'Destination2': 'Destination 2', + 'Interaction_json': 'Interaction Fields', 'Ending_column': 'Ending Column', 'Ending_layer': 'Ending Layer', 'Description': 'Description', diff --git a/acs2/nladmin-ui/src/i18n/langs/task/in.js b/acs2/nladmin-ui/src/i18n/langs/task/in.js index e6b066706..ff60c0e7e 100644 --- a/acs2/nladmin-ui/src/i18n/langs/task/in.js +++ b/acs2/nladmin-ui/src/i18n/langs/task/in.js @@ -27,6 +27,7 @@ export default { 'Starting_layer': 'Lapisan Awal', 'Destination': 'Tujuan', 'Destination2': 'Tujuan 2', + 'Interaction_json': 'Bidang Interaksi', 'Ending_column': 'Kolom Akhir', 'Ending_layer': 'Lapisan Akhir', 'Description': 'Deskripsi', diff --git a/acs2/nladmin-ui/src/i18n/langs/task/zh.js b/acs2/nladmin-ui/src/i18n/langs/task/zh.js index 243ed7fdb..045882c91 100644 --- a/acs2/nladmin-ui/src/i18n/langs/task/zh.js +++ b/acs2/nladmin-ui/src/i18n/langs/task/zh.js @@ -27,6 +27,7 @@ export default { 'Starting_layer': '起点-层', 'Destination': '终点', 'Destination2': '终点2', + 'Interaction_json': '交互字段', 'Ending_column': '终点-列', 'Ending_layer': '终点-层', 'Description': '描述信息', diff --git a/acs2/nladmin-ui/src/views/acs/device/driver/belt_conveyor.vue b/acs2/nladmin-ui/src/views/acs/device/driver/belt_conveyor.vue index 3149a4086..4768b3194 100644 --- a/acs2/nladmin-ui/src/views/acs/device/driver/belt_conveyor.vue +++ b/acs2/nladmin-ui/src/views/acs/device/driver/belt_conveyor.vue @@ -50,7 +50,7 @@ - + @@ -265,7 +265,7 @@ export default { data2: [], form: { inspect_in_stocck: true, - ignore_pickup_check: true, + ignore_pickup_check: false, ignore_release_check: true, apply_task: true, link_three_lamp: '', diff --git a/acs2/nladmin-ui/src/views/acs/history/taskRecord/index.vue b/acs2/nladmin-ui/src/views/acs/history/taskRecord/index.vue index e8a87b8a1..7fd33e69e 100644 --- a/acs2/nladmin-ui/src/views/acs/history/taskRecord/index.vue +++ b/acs2/nladmin-ui/src/views/acs/history/taskRecord/index.vue @@ -295,6 +295,7 @@ + @@ -329,6 +330,7 @@ const defaultForm = { start_point_code: null, start_device_code: null, next_point_code: null, + start_point_code: null, remark: null, material: null, route_plan_code: 'normal', diff --git a/acs2/nladmin-ui/src/views/acs/task/index.vue b/acs2/nladmin-ui/src/views/acs/task/index.vue index 5b01edc92..90b23f6b8 100644 --- a/acs2/nladmin-ui/src/views/acs/task/index.vue +++ b/acs2/nladmin-ui/src/views/acs/task/index.vue @@ -502,6 +502,7 @@ + @@ -671,6 +672,7 @@ export default { start_device_code2: null, next_point_code: null, next_point_code2: null, + interaction_json: null, remark: null, material: null, route_plan_code: 'normal', diff --git a/acs2/nladmin-ui/src/views/monitor/logQuery/index.vue b/acs2/nladmin-ui/src/views/monitor/logQuery/index.vue index fbd64af79..39cab5cb6 100644 --- a/acs2/nladmin-ui/src/views/monitor/logQuery/index.vue +++ b/acs2/nladmin-ui/src/views/monitor/logQuery/index.vue @@ -17,10 +17,10 @@ - - + + - + diff --git a/acs2/nladmin-ui/src/views/monitor/lucene/index.vue b/acs2/nladmin-ui/src/views/monitor/lucene/index.vue index a83b8cbdd..84f14c8c8 100644 --- a/acs2/nladmin-ui/src/views/monitor/lucene/index.vue +++ b/acs2/nladmin-ui/src/views/monitor/lucene/index.vue @@ -21,10 +21,10 @@ - - + + - + diff --git a/acs2/nladmin-ui/src/views/system/monitor/device/index.vue b/acs2/nladmin-ui/src/views/system/monitor/device/index.vue index 5f84af01f..4aa475fbb 100644 --- a/acs2/nladmin-ui/src/views/system/monitor/device/index.vue +++ b/acs2/nladmin-ui/src/views/system/monitor/device/index.vue @@ -283,6 +283,7 @@ export default { dialogFormVisible10: false, Stages: [], stage_code: 'stage_code', + stage_name: '二楼监控', form: { device_code: '', hasGoodStatus: null, @@ -363,7 +364,7 @@ export default { lf.extension.menu.setMenuConfig({ nodeMenu: false }) - lf.on('node:click', (data, e) => { // 鼠标点击节点 + lf.on('node:click', (data) => { // 鼠标点击节点 console.log('data: ', data) // 展开显示设备信息 if (data.data.type !== 'pro-rect' && data.data.type !== 'pro-circle' && data.data.type !== 'triangle' && data.data.type !== 'rect-radius') { @@ -376,7 +377,7 @@ export default { } } }) - lf.on('node:contextmenu', (data, e, position) => { // 右键编辑 + lf.on('node:contextmenu', (data) => { // 右键编辑 if (data.data.type !== 'pro-rect' && data.data.type !== 'pro-circle' && data.data.type !== 'triangle' && data.data.type !== 'rect-radius') { if (data.data.properties.device) { this.editDevice(data.data.id) // 编辑 @@ -391,14 +392,14 @@ export default { getStages() { selectStageList().then(data => { for (let i = 0; i < data.length; i++) { - if (this.language === 'en') { + if (i18n.locale === 'en') { const tempObject = { 'stage_name': data[i].en_stage_name, 'stage_code': data[i].stage_code } this.Stages.push(tempObject) } - if (this.language === 'zh') { + if (i18n.locale === 'zh') { const tempObject = { 'stage_name': data[i].zh_stage_name, 'stage_code': data[i].stage_code @@ -703,7 +704,7 @@ export default { const obj = { name: i18n.t('monitor.click.inventory_quantity'), value: data[val] } this.arr.push(obj) } else if (val === 'hand_barcode') { - const obj = { name: '子卷编号', value: data[val] } + const obj = { name: '补码信息', value: data[val] } this.arr.push(obj) } else if (val === 'x') { const obj = { name: 'X', value: data[val] } @@ -741,6 +742,12 @@ export default { } else if (val === 'task_id') { const obj = { name: i18n.t('monitor.click.task_number'), value: data[val] } this.arr.push(obj) + } else if (val === 'command') { + const obj = { name: i18n.t('monitor.click.command'), value: data[val] } + this.arr.push(obj) + } else if (val === 'material_barcode') { + const obj = { name: '子卷编号', value: data[val] } + this.arr.push(obj) } } } @@ -782,7 +789,7 @@ export default { }) }, dialogSave() { - deviceCrud.changeDeviceStatus(this.form).then(res => { + deviceCrud.changeDeviceStatus(this.form).then(() => { this.$notify({ title: '操作成功', message: '', type: 'success' }) this.dialogFormVisible = false this.dialogFormVisible3 = false @@ -807,7 +814,7 @@ export default { }) }, saveBarcode() { - deviceCrud.saveBarcode(this.form).then(res => { + deviceCrud.saveBarcode(this.form).then(() => { this.notify('操作成功', 'success') this.dialogFormVisible1 = false this.initStageData() 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 8f2d69d67..4957fe537 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 @@ -296,7 +296,7 @@ public class StructivtServiceImpl implements StructivtService { mp.put("客户名称", json.getString("customer_description")); mp.put("销售订单", json.getString("sale_order_name")); mp.put("业务员", json.getString("sales_owner")); - mp.put("入库日期", json.getString("instorage_time")); + mp.put("入库日期", json.getString("confirm_time")); mp.put("生产日期", json.getString("date_of_production")); if ("1".equals(json.getString("sub_type"))) { mp.put("子卷状态", "正常"); @@ -312,6 +312,7 @@ public class StructivtServiceImpl implements StructivtService { mp.put("净重", json.getString("net_weight")); mp.put("毛重", json.getString("box_weight")); mp.put("长度", json.getString("length")); + mp.put("接头数", json.getString("joint_type")); mp.put("计划外分切的子卷", json.getString("is_un_plan_production")); mp.put("子卷的物性值1", json.getString("un_plan_product_property1")); mp.put("子卷的物性值2", json.getString("un_plan_product_property2")); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/wql/QST_STRUCTIVT001.wql b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/wql/QST_STRUCTIVT001.wql index 12adc2f6a..170793a81 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/wql/QST_STRUCTIVT001.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/wql/QST_STRUCTIVT001.wql @@ -90,7 +90,9 @@ WHEN DATEDIFF( NOW(), sub.date_of_production ) > '90' THEN '3' END END AS sub_type, - DATEDIFF( NOW(), sub.date_of_production ) AS stock_age + DATEDIFF( NOW(), sub.date_of_production ) AS stock_age, + sub.joint_type, + dis.confirm_time FROM ST_IVT_StructIvt ivt @@ -114,6 +116,20 @@ WHERE plan1.is_delete = '0' GROUP BY container_name) plan ON plan.container_name = sub.container_name + LEFT JOIN ( + SELECT + MIN( mst.confirm_time ) AS confirm_time, + dis.pcsn + FROM + st_ivt_iostorinvdis dis + LEFT JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id + WHERE + mst.io_type = '0' + AND mst.bill_type = '0001' + AND mst.is_delete = '0' + GROUP BY + dis.pcsn + ) dis ON dis.pcsn = ivt.pcsn WHERE 1 = 1 @@ -243,7 +259,9 @@ WHEN DATEDIFF( NOW(), sub.date_of_production ) <= '90' THEN '1' WHEN DATEDIFF( NOW(), sub.date_of_production ) > '90' THEN '3' END AS sub_type, - DATEDIFF( NOW(), ivt.instorage_time ) AS stock_age + DATEDIFF( NOW(), ivt.instorage_time ) AS stock_age, + sub.joint_type, + dis.confirm_time FROM ST_IVT_StructIvt ivt LEFT JOIN st_ivt_structattr attr ON ivt.struct_id = attr.struct_id @@ -267,6 +285,20 @@ WHERE plan1.is_delete = '0' GROUP BY container_name) plan ON plan.container_name = sub.container_name + LEFT JOIN ( + SELECT + MIN( mst.confirm_time ) AS confirm_time, + dis.pcsn + FROM + st_ivt_iostorinvdis dis + LEFT JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id + WHERE + mst.io_type = '0' + AND mst.bill_type = '0001' + AND mst.is_delete = '0' + GROUP BY + dis.pcsn + ) dis ON dis.pcsn = ivt.pcsn WHERE 1 = 1 and attr.stor_id in 输入.in_stor_id diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/rest/WmsToAcsController.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/rest/WmsToAcsController.java index 5ef3fd500..c2246dfde 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/rest/WmsToAcsController.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/rest/WmsToAcsController.java @@ -140,5 +140,9 @@ public class WmsToAcsController { return new ResponseEntity<>(wmsToAcsService.getTubeMsg(jo), HttpStatus.OK); } - + @PostMapping("/queryBoxWeigh") + @Log(value = "查询木箱毛重", isInterfaceLog = true, interfaceLogType = InterfaceLogType.LMS_TO_ACS) + public ResponseEntity querydeviceOne(@RequestBody JSONObject jo) { + return new ResponseEntity<>(wmsToAcsService.queryBoxWeigh(jo), HttpStatus.OK); + } } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/WmsToAcsService.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/WmsToAcsService.java index 995e097a0..340e21ff8 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/WmsToAcsService.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/WmsToAcsService.java @@ -147,6 +147,10 @@ public interface WmsToAcsService { JSONObject getTubeMsg(JSONObject jo); - - + /** + * 查询木箱重量 + * @param jo 、 + * @return JSONObject + */ + JSONObject queryBoxWeigh(JSONObject jo); } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToAcsServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToAcsServiceImpl.java index 2491a7a6b..65613140b 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToAcsServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToAcsServiceImpl.java @@ -474,4 +474,47 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { arr.add(whereJson); return AcsUtil.notifyAcs(api, arr); } + + @Override + public JSONObject queryBoxWeigh(JSONObject jo) { + String api = "api/wms/querydevice"; + //判断是否连接ACS系统 + String isConnect = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("is_connect_acs").getValue(); + JSONObject result = new JSONObject(); + if (StrUtil.equals("0", isConnect)) { + result.put("status", HttpStatus.OK.value()); + result.put("message", "查询失败,未连接ACS!"); + result.put("data", new JSONArray()); + return result; + } + + String product_area = "LK"; + + String acs_url = URLEnum.find(product_area); + if (StrUtil.isEmpty(acs_url)) { + log.info(product_area); + throw new BadRequestException("未查询到区域对应的acs地址!"); + } + + String url = acs_url + api; + try { + String resultMsg = HttpRequest.post(url) + .body(String.valueOf(jo.getJSONArray("data"))) + .execute().body(); + result = JSONObject.parseObject(resultMsg); + + } catch (Exception e) { + String msg = e.getMessage(); + //网络不通 + System.out.println(msg); + result.put("status", HttpStatus.BAD_REQUEST); + result.put("message", "网络不通,操作失败!"); + result.put("data", new JSONArray()); + } + //acs抛异常这里 + if (!StrUtil.equals(result.getString("status"), "200")) { + throw new BadRequestException("操作失败:" + result.getString("message")); + } + return result; + } } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/rest/ProductInstorController.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/rest/ProductInstorController.java index 4e061477d..5d79e8646 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/rest/ProductInstorController.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/rest/ProductInstorController.java @@ -33,6 +33,12 @@ public class ProductInstorController { return new ResponseEntity<>(productInstorService.boxQuery(whereJson), HttpStatus.OK); } + @PostMapping("/weighCheck") + @Log("称重校验") + public ResponseEntity weighCheck(@RequestBody JSONObject whereJson) { + return new ResponseEntity<>(productInstorService.weighCheck(whereJson), HttpStatus.OK); + } + @PostMapping("/confirm") @Log("手持生产入库确认") diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/ProductInstorService.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/ProductInstorService.java index e36c10025..e82f8c4cc 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/ProductInstorService.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/ProductInstorService.java @@ -22,4 +22,6 @@ public interface ProductInstorService { JSONObject bale(JSONObject whereJson); JSONObject abnormalOut(JSONObject whereJson); + + JSONObject weighCheck(JSONObject whereJson); } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/PrintServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/PrintServiceImpl.java index a4b39fac9..37b0ea539 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/PrintServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/PrintServiceImpl.java @@ -153,7 +153,7 @@ public class PrintServiceImpl implements PrintService { + box_jo.getString("customer_description") + "," + box_jo.getString("thickness") + "," + box_jo.getString("mass_per_unit_area") + "," - + box_jo.getString("length") + "," + + NumberUtil.round(box_jo.getString("length"), 2) + "," + box_jo.getString("box_type") + "," + box_jo.getString("sap_pcsn") + "," + box_jo.getString("box_length") + "," @@ -295,7 +295,7 @@ public class PrintServiceImpl implements PrintService { + box_jo.getString("customer_description") + "," + box_jo.getString("thickness") + "," + box_jo.getString("mass_per_unit_area") + "," - + box_jo.getString("length") + "," + + NumberUtil.round(box_jo.getString("length"), 2) + "," + box_jo.getString("box_type") + "," + box_jo.getString("sap_pcsn") + "," + box_jo.getString("box_length") + "," diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/ProductInstorServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/ProductInstorServiceImpl.java index 5e62ec19b..7bc6ddc23 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/ProductInstorServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/ProductInstorServiceImpl.java @@ -3,6 +3,7 @@ package org.nl.wms.pda.st.service.impl; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSONArray; @@ -17,6 +18,7 @@ import org.nl.modules.wql.core.bean.WQLObject; import org.nl.modules.wql.util.SpringContextHolder; import org.nl.system.service.param.impl.SysParamServiceImpl; import org.nl.wms.basedata.st.service.impl.UserStorServiceImpl; +import org.nl.wms.ext.acs.service.WmsToAcsService; import org.nl.wms.ext.acs.service.impl.AcsToWmsServiceImpl; import org.nl.wms.ext.acs.service.impl.WmsToAcsServiceImpl; import org.nl.wms.pda.st.service.ProductInstorService; @@ -55,6 +57,8 @@ public class ProductInstorServiceImpl implements ProductInstorService { private final RedissonClient redissonClient; + private final WmsToAcsService wmsToAcsService; + @Override public JSONObject boxQuery(JSONObject whereJson) { String box_no = whereJson.getString("box_no"); @@ -540,4 +544,49 @@ public class ProductInstorServiceImpl implements ProductInstorService { return jo; } + + @Override + public JSONObject weighCheck(JSONObject whereJson) { + WQLObject subTab = WQLObject.getWQLObject("pdm_bi_subpackagerelation"); + JSONObject jo = new JSONObject(); + + String point_code = whereJson.getString("point_code"); + String box_no = whereJson.getString("box_no"); + + if (ObjectUtil.isEmpty(point_code)) { + throw new BadRequestException("点位不能为空!"); + } + + if (ObjectUtil.isEmpty(box_no)) { + throw new BadRequestException("木箱号不能为空!"); + } + + // 组织数据 + JSONArray paramArr = new JSONArray(); + JSONObject paramJson = new JSONObject(); + paramJson.put("device_code", point_code); + paramArr.add(paramJson); + + // 调用接口 + whereJson.put("data", paramArr); + JSONObject jsonObject = wmsToAcsService.queryBoxWeigh(whereJson); + + JSONObject data = jsonObject.getJSONArray("data").getJSONObject(0); + double weight_now = NumberUtil.div(data.getDoubleValue("weight"), 10); + + // 获取系统参数 + double weight_sys = Double.parseDouble(SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("weight_sys").getValue()); + + // 查询子卷包装关系 + JSONObject jsonSub = subTab.query("package_box_sn = '" + box_no + "'").uniqueResult(0); + double box_weight = jsonSub.getDoubleValue("box_weight"); + + if (NumberUtil.sub(box_weight, weight_sys) <= weight_now && NumberUtil.add(box_weight, weight_sys) >= weight_now) { + jo.put("message", "重量合格!当前称重重量:"+weight_now); + } else { + jo.put("message", "重量不合格!当前称重重量:"+weight_now); + } + + return jo; + } } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/CutConveyorTask.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/CutConveyorTask.java index 8f04dc9c3..a8ead88de 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/CutConveyorTask.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/CutConveyorTask.java @@ -77,6 +77,7 @@ public class CutConveyorTask extends AbstractAcsTask { public void updateTaskStatus(JSONObject taskObj, String status) { WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); WQLObject ivtTab = WQLObject.getWQLObject("ST_IVT_DeliveryPointIvt"); + WQLObject subTab = WQLObject.getWQLObject("pdm_bi_subpackagerelation"); String task_id = taskObj.getString("task_id"); JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0); @@ -111,6 +112,15 @@ public class CutConveyorTask extends AbstractAcsTask { jsonTask.put("update_time", DateUtil.now()); taskTab.update(jsonTask); + if ("010507".equals(jsonTask.getString("task_type"))) { + double weight = taskObj.getDoubleValue("weight"); + + // 更新子卷包装实际重量 + JSONObject param = new JSONObject(); + param.put("real_weight",weight); + subTab.update(param,"package_box_sn ='"+jsonTask.getString("vehicle_code")+"'"); + } + //只有输送入的时候才调用MES if ("010402".equals(jsonTask.getString("task_type"))) { //调用MES接口,通知MES运输中 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 329ee1879..2cb0dcbe7 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 @@ -239,7 +239,8 @@ - + +