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..293be5d91 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_weigh_conveyor/SiemensWeightConveyorDeviceDriver.java @@ -0,0 +1,1250 @@ +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"); + taskdto.setWeight(String.valueOf(this.weight)); + 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..7c74d4e71 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,22 @@ 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 +85,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..ce0f3a873 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 @@ -5,6 +5,7 @@ import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpResponse; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; @@ -14,15 +15,18 @@ 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.acs.task.enums.ActionTypeEnum; +import org.nl.acs.task.enums.AgvActionTypeEnum; +import org.nl.acs.task.enums.AgvSystemTypeEnum; import org.nl.common.exception.BadRequestException; import org.nl.config.language.LangProcess; import org.nl.config.lucene.service.LuceneExecuteLogService; @@ -32,11 +36,7 @@ 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; -import java.util.Map; +import java.util.*; /** * @author 20220102CG\noblelift @@ -252,18 +252,22 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { com.alibaba.fastjson.JSONObject jo = new com.alibaba.fastjson.JSONObject(); jo.put("id", inst.getInstruction_code()); //运单封口,true=创建运单之后不可添加动作块;false=创建运单可以添加动作块 - jo.put("complete", true); + if (AgvActionTypeEnum.ORDINARY.getCode().equals(inst.getAgv_action_type())) { + jo.put("complete", true); + } else { + jo.put("complete", false); + } //动作块 jo.put("blocks", createBlocksData(inst)); //运单优先级 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); - log.info("任务号:{},指令号{},下发agv订单序列参数:{}", inst.getTask_code(), inst.getInstruction_code(), jo); + log.info("任务号:{},指令号{},下发诺宝运单序列参数:{}", inst.getTask_code(), inst.getInstruction_code(), jo); if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) { String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue(); @@ -280,7 +284,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); @@ -305,104 +309,64 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { String start_point_code = inst.getStart_point_code(); String next_device_code = inst.getNext_device_code(); String next_point_code = inst.getNext_point_code(); - String start_device_code2 = inst.getStart_device_code2(); - String start_point_code2 = inst.getStart_point_code2(); - String next_device_code2 = inst.getNext_device_code2(); - String next_point_code2 = inst.getNext_point_code2(); + Integer agv_action_type = inst.getAgv_action_type(); + + //起点1 - sendStartDeviceOrder(ja, start_device_code, start_point_code, instruction_code); + sendStartDeviceOrder(ja, start_device_code, start_point_code, instruction_code, agv_action_type); //终点1 - sendEndDeviceOrder(ja, start_device_code, instruction_code, next_point_code, next_device_code); - //起点2 - if (StrUtil.isNotEmpty(start_device_code2)) { - sendStartDeviceOrder(ja, start_device_code2, start_point_code2, instruction_code); - } - //终点2 - if (StrUtil.isNotEmpty(next_device_code2)) { - sendEndDeviceOrder(ja, start_device_code2, instruction_code, next_device_code2, next_point_code2); - } + sendEndDeviceOrder(ja, start_device_code, instruction_code, next_point_code, next_device_code, agv_action_type); + return ja; } /** * 下发取货信号 + * * @param ja - * @param pointCode 起始点位 - * @param device_code 起始设备 - * @param instCode 指令号 + * @param pointCode 起始点位 + * @param device_code 起始设备 + * @param instCode 指令号 + * @param agv_action_type */ - public void sendStartDeviceOrder(JSONArray ja, String pointCode, String device_code, String instCode) { + public void sendStartDeviceOrder(JSONArray ja, String pointCode, String device_code, String instCode, Integer agv_action_type) { 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); + if (AgvActionTypeEnum.ORDINARY.getCode().equals(agv_action_type) || AgvActionTypeEnum.OUT_STOCK.getCode().equals(agv_action_type)) { + //将货物顶起来,机器识别提升高度 + JSONObject jo1 = new JSONObject(); + jo1.put("blockId", IdUtil.simpleUUID()); + jo1.put("location", pointCode); + jo1.put("operation", "JackLoad"); + jo1.put("operationArgs", new JSONObject() {{ + put("recognize", true); + }}); + ja.add(jo1); - //将货物顶起来,机器识别提升高度 - JSONObject jo1 = new JSONObject(); - jo1.put("blockId", IdUtil.simpleUUID()); - jo1.put("location", pointCode); - jo1.put("operation", "JackLoad"); - jo1.put("operationArgs", new JSONObject() {{ - put("recognize", true); - }}); - 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"); @@ -425,16 +389,17 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { /** * 下发放货信号 + * * @param ja - * @param device_code 起始设备 - * @param instCode 指令号 - * @param pointCode 终点点位 - * @param nextDeviceCode 终点设备 + * @param device_code 起始设备 + * @param instCode 指令号 + * @param pointCode 终点点位 + * @param nextDeviceCode 终点设备 + * @param agv_action_type */ - public void sendEndDeviceOrder(JSONArray ja, String device_code, String instCode, String pointCode, String nextDeviceCode) { + public void sendEndDeviceOrder(JSONArray ja, String device_code, String instCode, String pointCode, String nextDeviceCode, Integer agv_action_type) { Device nextDevice = deviceAppService.findDeviceByCode(nextDeviceCode); - //忽略放货校验 - if ("true".equals(nextDevice.getExtraValue().get("ignore_release_check"))) { + if (!AgvActionTypeEnum.IN_STOCK.getCode().equals(agv_action_type)) { //放货前等待 JSONObject jo3 = new JSONObject(); jo3.put("blockId", IdUtil.simpleUUID()); @@ -453,52 +418,37 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { script_args3.put("protocol", "HTTP"); jo3.put("script_args", script_args3); ja.add(jo3); + + if (AgvActionTypeEnum.ORDINARY.getCode().equals(agv_action_type)) { + //将货物放下 + com.alibaba.fastjson.JSONObject jo4 = new com.alibaba.fastjson.JSONObject(); + jo4.put("blockId", IdUtil.simpleUUID()); + jo4.put("location", pointCode); + jo4.put("operation", "JackUnload"); + ja.add(jo4); + + + //放货完成等待 + 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); + } } - //放货前下发旋转角度 - /*JSONObject json1 = new JSONObject(); - AcsPointAngle acsPointAngleDto = acsPointAngleService.findByCode(device_code, nextDeviceCode); - if (ObjectUtil.isNotEmpty(acsPointAngleDto)) { - log.info("acsPointAngleDto----參數,{}", acsPointAngleDto.toString()); - com.alibaba.fastjson.JSONObject operation_args = new com.alibaba.fastjson.JSONObject(); - BigDecimal next_point_angle = acsPointAngleDto.getNext_point_angle(); - operation_args.put("increase_spin_angle", next_point_angle);//弧度值,如3.14 - operation_args.put("skill_name", "GoByOdometer"); - json1.put("blockId", IdUtil.simpleUUID()); - json1.put("location", pointCode + "INPUT"); - json1.put("operation_args", operation_args); - ja.add(json1); - }*/ - - //将货物放下 - com.alibaba.fastjson.JSONObject jo4 = new com.alibaba.fastjson.JSONObject(); - jo4.put("blockId", IdUtil.simpleUUID()); - jo4.put("location", pointCode); - jo4.put("operation", "JackUnload"); - 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); - } } @@ -746,14 +696,33 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { throw new BadRequestException("请求失败,地址为空!"); } if (address.contains("IN")) { + String instructionCode = instructionDto.getInstruction_code(); String deviceCodeNow = address.substring(0, address.length() - 5); if (ObjectUtil.isEmpty(deviceAppService.findDeviceByCode(deviceCodeNow))) { throw new BadRequestException("设备号 " + deviceCodeNow + " 不存在!"); } - if (address.contains("GET")) { + if (instructionDto.getAgv_system_type().equals(AgvSystemTypeEnum.One_NDC_System_Type.getIndex())) { + //如果是取货二次分配,取放货二次分配需要重新追加动作块 + if (AgvActionTypeEnum.IN_STOCK.getCode().equals(instructionDto.getAgv_action_type()) || AgvActionTypeEnum.IN_OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type())) { + Integer actionType = ActionTypeEnum.IN_STOCK.getCode(); + deviceCodeNow = applyXGAgvTask(instructionCode, actionType, instructionDto); + } + } else if (instructionDto.getAgv_system_type().equals(AgvSystemTypeEnum.XG_System_Type.getIndex())) { + + } return agvWaitUtil.waitInGet(deviceCodeNow, instructionDto); } else if (address.contains("PUT")) { + if (instructionDto.getAgv_system_type().equals(AgvSystemTypeEnum.One_NDC_System_Type.getIndex())) { + //如果是放货二次分配,取放货二次分配需要重新追加动作块 + if (AgvActionTypeEnum.OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type()) || AgvActionTypeEnum.IN_OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type())) { + Integer actionType = ActionTypeEnum.OUT_STOCK.getCode(); + deviceCodeNow = applyXGAgvTask(instructionCode, actionType, instructionDto); + } + } else if (instructionDto.getAgv_system_type().equals(AgvSystemTypeEnum.XG_System_Type.getIndex())) { + Integer actionType = ActionTypeEnum.OUT_STOCK.getCode(); + deviceCodeNow = applyCCAgvTask(instructionCode, actionType, instructionDto); + } return agvWaitUtil.waitInPut(deviceCodeNow, instructionDto); } } @@ -773,6 +742,102 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { throw new BadRequestException("请求失败,IN OUT 站点错误!"); } + private String applyCCAgvTask(String instructionCode, Integer actionType, Instruction instructionDto) { + try { + JSONObject param = new JSONObject(); + param.put("taskCode", instructionCode); + param.put("actionType", actionType.toString()); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code("追加动叉车作块:") + .content("追加动叉车作块,参数:" + instructionCode + "--" + actionType) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + String response = acsToWmsService.secondaryAllocationPoint(param); + JSONObject jo = JSON.parseObject(response); + if (jo.getInteger("status") == 200) { + LuceneLogDto logDto2 = LuceneLogDto.builder() + .device_code("追加动叉车作块:") + .content("追加动叉车作块,参数,接口返回:" + jo) + .build(); + logDto2.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto2); + //请求成功调用叉车追加动作块 + sendAddSequencesToCCAgv(instructionCode, jo.getString("data"), instructionDto); + return jo.getString("data"); + + } else { + LuceneLogDto logDto2 = LuceneLogDto.builder() + .device_code("追加动叉车作块:") + .content("追加动叉车作块失败,返回参数:" + jo.getString("body")) + .build(); + logDto2.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto2); + throw new BadRequestException("追加动叉车作块返回失败"); + } + } catch (Exception e) { + e.printStackTrace(); + } + + return null; + + } + + private void sendAddSequencesToCCAgv(String instructionCode, String nextPoint, Instruction instructionDto) { + com.alibaba.fastjson.JSONObject jo = new com.alibaba.fastjson.JSONObject(); + jo.put("id", instructionCode); + //动作块 + jo.put("blocks", createBlocksDataTowCCStart(nextPoint)); + + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code("追加诺宝运单") + .content("指令号:" + instructionCode + ",追加诺宝运单参数:" + jo) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + log.info("任务号:{},指令号{},追加诺宝运单:{}", instructionCode, instructionCode, jo); + + if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) { + String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue(); + String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue(); + + agvurl = agvurl + ":" + agvport + "/addBlocks"; + + log.info(agvurl); + HttpResponse result = HttpRequest.post(agvurl) + //表单内容 + .body(String.valueOf(jo)) + //超时,毫秒 + .timeout(20000) + .execute(); + LuceneLogDto logDto1 = LuceneLogDto.builder() + .device_code("叉车运单响应") + .content("指令号:" + instructionCode + ",下发追加诺宝运单反馈参数:" + jo) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto1); + log.info("指令号{},状态{},下发追加诺宝运单序列反馈:{}", instructionCode, result.getStatus(), result.body()); + + } + + } + + private Object createBlocksDataTowCCStart(String nextPoint) { + JSONArray ja = new JSONArray(); + JSONObject jo9 = new JSONObject(); + jo9.put("blockId", IdUtil.simpleUUID()); + jo9.put("location", nextPoint); + jo9.put("binTask", "ForkUnload"); + ja.add(jo9); + + JSONObject jo10 = new JSONObject(); + jo10.put("blockId", IdUtil.simpleUUID()); + jo10.put("location", nextPoint + "OUTPUT"); + jo10.put("binTask", "OutForkHeight"); + ja.add(jo10); + return ja; + } + @Override public HttpResponse getRobotInfo(String robotCode) { if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) { @@ -791,19 +856,66 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { } } + private String applyXGAgvTask(String instructionCode, Integer actionType, Instruction instructionDto) { + try { + JSONObject param = new JSONObject(); + param.put("taskCode", instructionCode); + param.put("actionType", actionType.toString()); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code("追加动诺宝作块:") + .content("追加动诺宝作块,参数:" + instructionCode + "--" + actionType) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + String response = acsToWmsService.secondaryAllocationPoint(param); + JSONObject jo = JSON.parseObject(response); + if (jo.getInteger("status") == 200) { + LuceneLogDto logDto2 = LuceneLogDto.builder() + .device_code("追加动诺宝作块:") + .content("追加动诺宝作块,参数,接口返回:" + jo) + .build(); + logDto2.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto2); + if (!ActionTypeEnum.IN_FINISHING.getCode().equals(actionType)) { + //请求成功调用诺宝追加动作块 + sendAddSequencesToNBAgv(instructionCode, jo.getString("data"), instructionDto); + } + return jo.getString("data"); + + } else { + LuceneLogDto logDto2 = LuceneLogDto.builder() + .device_code("追加动诺宝作块:") + .content("追加动诺宝作块失败,返回参数:" + jo.getString("body")) + .build(); + logDto2.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto2); + throw new BadRequestException("追加动诺宝作块返回失败"); + } + } catch (Exception e) { + e.printStackTrace(); + } + + return null; + } + + @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)); + //运单封口,true=创建运单之后不可添加动作块;false=创建运单可以添加动作块 + if (AgvActionTypeEnum.ORDINARY.getCode().equals(inst.getAgv_action_type())) { + jo.put("complete", true); + } else { + jo.put("complete", false); + } //动作块 + 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 +936,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); @@ -836,135 +948,423 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { } } + /** - * 叉车运单动作块 - * @param inst + * 追加动作块 + * + * @param + * @param instructionCode + * @param instructionDto * @return */ - private JSONArray createBlocksForklift(Instruction inst) { + private void sendAddSequencesToNBAgv(String instructionCode, String point, Instruction instructionDto) { + com.alibaba.fastjson.JSONObject jo = new com.alibaba.fastjson.JSONObject(); + jo.put("id", instructionCode); + //动作块 + if (AgvActionTypeEnum.IN_STOCK.getCode().equals(instructionDto.getAgv_action_type()) || AgvActionTypeEnum.IN_OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type())) { + jo.put("blocks", createBlocksDataTowStart(instructionCode, point, instructionDto)); + } + if (AgvActionTypeEnum.OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type()) || AgvActionTypeEnum.IN_OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type())) { + jo.put("blocks", createBlocksDataTowEnd(instructionCode, point, instructionDto)); + } + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code("追加诺宝运单") + .content("指令号:" + instructionCode + ",追加诺宝运单参数:" + jo) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + log.info("任务号:{},指令号{},追加诺宝运单:{}", instructionCode, point, jo); + + if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) { + String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue(); + String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue(); + + agvurl = agvurl + ":" + agvport + "/addBlocks"; + + log.info(agvurl); + HttpResponse result = HttpRequest.post(agvurl) + //表单内容 + .body(String.valueOf(jo)) + //超时,毫秒 + .timeout(20000) + .execute(); + LuceneLogDto logDto1 = LuceneLogDto.builder() + .device_code("叉车运单响应") + .content("指令号:" + instructionCode + ",下发追加诺宝运单反馈参数:" + jo) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto1); + log.info("指令号{},状态{},下发追加诺宝运单序列反馈:{}", instructionCode, result.getStatus(), result.body()); + + } + } + + private Object createBlocksDataTowEnd(String instructionCode, String point, Instruction instructionDto) { 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); - } - //货叉加载货物,会将叉车状态变成载货中 - 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); - }}); - ja.add(jo1); + String nextDeviceCode = instructionDto.getNext_device_code(); + //终点2 + sendEndDeviceOrder3(ja, nextDeviceCode, instructionCode, instructionDto); + return ja; - //取货完成等待 - 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); - } + } - //起点 - 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); - } + private void sendEndDeviceOrder3(JSONArray ja, String nextDeviceCode, String instructionCode, Instruction instructionDto) { + //将货物放下 + com.alibaba.fastjson.JSONObject jo4 = new com.alibaba.fastjson.JSONObject(); + jo4.put("blockId", IdUtil.simpleUUID()); + jo4.put("location", nextDeviceCode); + jo4.put("operation", "JackUnload"); + ja.add(jo4); + //放货完成等待 + com.alibaba.fastjson.JSONObject jo5 = new com.alibaba.fastjson.JSONObject(); + jo5.put("blockId", IdUtil.simpleUUID()); + jo5.put("location", nextDeviceCode + "OUTPUT"); + jo5.put("operation", "script"); + jo5.put("id", nextDeviceCode + "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", instructionCode); + reach5.put("address", nextDeviceCode + "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 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()); - ja.add(jo2); + private Object createBlocksDataTowStart(String instructionCode, String startPoint, Instruction instructionDto) { + JSONArray ja = new JSONArray(); + String nextDeviceCode = instructionDto.getNext_device_code(); + //起点2 + sendStartDeviceOrder2(ja, startPoint, instructionCode); + //终点2 + sendEndDeviceOrder2(ja, nextDeviceCode, instructionCode, instructionDto); + return ja; + } - //忽略放货校验 - if ("true".equals(nextDevice.getExtraValue().get("ignore_release_check"))) { + private void sendEndDeviceOrder2(JSONArray ja, String nextDeviceCode, String instructionCode, Instruction instructionDto) { + //放货前等待 + JSONObject jo3 = new JSONObject(); + jo3.put("blockId", IdUtil.simpleUUID()); + jo3.put("location", nextDeviceCode + "INPUT"); + jo3.put("operation", "script"); + jo3.put("id", nextDeviceCode + "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", instructionCode); + reach3.put("address", nextDeviceCode + "INPUT"); + data3.put("reach", reach3); + script_args3.put("data", data3); + script_args3.put("protocol", "HTTP"); + jo3.put("script_args", script_args3); + ja.add(jo3); + if (AgvActionTypeEnum.IN_STOCK.getCode().equals(instructionDto.getAgv_action_type())) { + //将货物放下 + com.alibaba.fastjson.JSONObject jo4 = new com.alibaba.fastjson.JSONObject(); + jo4.put("blockId", IdUtil.simpleUUID()); + jo4.put("location", nextDeviceCode); + jo4.put("operation", "JackUnload"); + ja.add(jo4); //放货完成等待 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("location", nextDeviceCode + "OUTPUT"); jo5.put("operation", "script"); - jo5.put("id", inst.getNext_point_code() + "OUTPUT"); + jo5.put("id", nextDeviceCode + "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"); + reach5.put("task_code", instructionCode); + reach5.put("address", nextDeviceCode + "OUTPUT"); data5.put("reach", reach5); script_args5.put("data", data5); script_args5.put("protocol", "HTTP"); jo5.put("script_args", script_args5); ja.add(jo5); } + } + + private void sendStartDeviceOrder2(JSONArray ja, String startPoint, String instructionCode) { + //将货物顶起来,机器识别提升高度 + JSONObject jo1 = new JSONObject(); + jo1.put("blockId", IdUtil.simpleUUID()); + jo1.put("location", startPoint); + jo1.put("operation", "JackLoad"); + jo1.put("operationArgs", new JSONObject() {{ + put("recognize", true); + }}); + ja.add(jo1); + + + JSONObject jo2 = new JSONObject(); + jo2.put("blockId", IdUtil.simpleUUID()); + jo2.put("location", startPoint + "OUTGET"); + jo2.put("operation", "script"); + jo2.put("id", startPoint + "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", instructionCode); + reach2.put("address", startPoint + "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 inst + * @param interactionJsonDTO + * @return + */ + private JSONArray createBlocksForklift(Instruction inst, InteractionJsonDTO interactionJsonDTO) { + JSONArray ja = new JSONArray(); + //起点 + Device startDevice = deviceAppService.findDeviceByCode(inst.getStart_device_code()); + 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); + + if (AgvActionTypeEnum.ORDINARY.getCode().equals(inst.getAgv_action_type())) { + // to do + JSONObject jo1 = new JSONObject(); + jo1.put("blockId", IdUtil.simpleUUID()); + jo1.put("location", inst.getStart_point_code() + "INGET"); + jo1.put("binTask", "InForkHeight"); + ja.add(jo1); + + 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); + + 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_args1.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); + + 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", 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); + + + //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); + + } else if (AgvActionTypeEnum.IN_STOCK.getCode().equals(inst.getAgv_action_type())) { + + } else if (AgvActionTypeEnum.OUT_STOCK.getCode().equals(inst.getAgv_action_type())) { + // to do + JSONObject jo1 = new JSONObject(); + jo1.put("blockId", IdUtil.simpleUUID()); + jo1.put("location", inst.getStart_point_code() + "INGET"); + jo1.put("binTask", "InForkHeight"); + ja.add(jo1); + + 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); + + 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_args1.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); + + 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", 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); + + + //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", pointCode + "INPUT"); + jo9.put("operation", "script"); + jo9.put("id", pointCode + "INPUT"); + jo9.put("script_name", "userpy/interact.py"); + JSONObject script_args5 = new JSONObject(); + script_args5.put("addr", addr); + JSONObject data3 = new JSONObject(); + JSONObject reach3 = new JSONObject(); + reach3.put("task_code", inst.getInstruction_code()); + reach3.put("address", pointCode + "INPUT"); + data3.put("reach", reach3); + script_args5.put("data", data3); + script_args5.put("protocol", "HTTP"); + jo9.put("script_args", script_args5); + ja.add(jo9); + + } else if (AgvActionTypeEnum.IN_STOCK.getCode().equals(inst.getAgv_action_type())) { + + } return ja; diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java index dea3e883d..a9adea9fa 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java @@ -230,6 +230,7 @@ public class DeviceServiceImpl extends CommonServiceImpl i LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank((String) whereJson.get("device_type")), Device::getDevice_type, whereJson.get("device_type")); wrapper.eq(StringUtils.isNotBlank((String) whereJson.get("region")), Device::getRegion, whereJson.get("region")); + wrapper.eq(StringUtils.isNotBlank((String) whereJson.get("is_config")), Device::getIs_config, whereJson.get("is_config")); wrapper.nested(StringUtils.isNotBlank((String) whereJson.get("blurry")), i -> i.like(Device::getDevice_code, whereJson.get("blurry")).or().like(Device::getDevice_name, whereJson.get("blurry"))); wrapper.orderByAsc(Device::getIs_config).orderByDesc(Device::getSeq_num).orderByDesc(Device::getUpdate_time); wrapper.orderByDesc(Device::getCreate_time); @@ -926,6 +927,7 @@ public class DeviceServiceImpl extends CommonServiceImpl i String vehicle_code = form.getString("vehicle_code"); String islock = form.getString("islock"); String requireSucess = form.getString("requireSucess"); + String requireActionSucess = form.getString("requireActionSucess"); String fullrequireSucess = form.getString("fullrequireSucess"); if (device_code.indexOf(".") != -1) { device_code = device_code.substring(0, device_code.indexOf(".")); 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..04a1f0b95 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,20 +261,20 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements //申请空托盘出库 if (mode == 8 && !requireSucess) { - if (container_type==0){ - message = "universal_notCreateInstMessage7"; - } + if (container_type == 0) { + message = "托盘类型为空"; + }else { applyEmptyTask(StorageTypeEnum.DISKS_OUT.getType(), mode); - +} } 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; + String ignorePickupCheck = (String) beltConveyorDeviceDriver.getExtraValue().get("ignore_pickup_check"); + if ("false".equals(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) { @@ -768,7 +755,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements public void writing(String key, String param) { String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + param; + + "." + key; //String opcservcerid = this.getDevice().getOpc_server_id(); //Server server = ReadUtil.getServer(opcservcerid); Map itemMap = new HashMap(); @@ -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..593383cda 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,9 +260,13 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i } break; case 25: - //二楼到一楼输送线申请行架任务 - if (move == 1 && !requireSucess) { - applyManipulatorTask(); + if ( StrUtil.isEmpty(material_barcode)) { + message = "子卷码为空"; + }else { + //二楼到一楼输送线申请行架任务 + if (move == 1 && !requireSucess) { + applyManipulatorTask(); + } } break; } @@ -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..6dc8e9a3c 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,10 +232,11 @@ 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 = "条码为空"; + }else { + applyAgvTask(); } - applyAgvTask(); } break; @@ -248,7 +244,7 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i //申请任务 if (move > 0 && !requireSucess) { instruction_require(); - }else { + } else { String remark = ""; ; if (mode != 2) { @@ -290,25 +286,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 +335,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 +363,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 +443,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 +556,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..26a219819 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); @@ -249,21 +244,21 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements //申请空托盘入库 if (mode == 9 && move == 1 && !requireSucess) { - if (container_type==0){ - message = "universal_notCreateInstMessage7"; + if (container_type == 0) { + message = "托盘类型为空"; + } else { + applyEmptyTask(StorageTypeEnum.DISKS_IN.getType(), mode); } - applyEmptyTask(StorageTypeEnum.DISKS_IN.getType(), mode); - } //申请空托盘出库 if (mode == 8 && !requireSucess) { - if (container_type==0){ - message = "universal_notCreateInstMessage7"; + if (container_type == 0) { + message = "托盘类型为空"; + } else { + applyEmptyTask(StorageTypeEnum.DISKS_OUT.getType(), mode); } - applyEmptyTask(StorageTypeEnum.DISKS_OUT.getType(), mode); - } @@ -320,25 +315,21 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements 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; } @@ -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..8132f0ff5 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 || StrUtil.isEmpty(barcode)) { + 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,12 @@ 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); + 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); + } param.put("type", type); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) @@ -574,6 +595,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 +610,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 +632,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 +739,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 +762,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 +777,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 +819,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 +835,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 +845,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 +900,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 +955,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv } } + public synchronized boolean finish_instruction() throws Exception { instructionService.finish(inst); return true; @@ -942,7 +976,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 +1003,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..2a64e05da 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 @@ -360,9 +360,11 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i }*/ if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver(); - if (standardInspectSiteDeviceDriver.getMove() != 1) { - notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevicecode() + "无货,无法下发指令!指令号:" + instruction.getInstruction_code(); - return false; + if (ObjectUtil.equal("true", standardInspectSiteDeviceDriver.getExtraValue().get("input_move"))) { + if (standardInspectSiteDeviceDriver.getMove() != 1) { + notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevicecode() + "无货,无法下发指令!指令号:" + instruction.getInstruction_code(); + return false; + } } } if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { @@ -375,9 +377,11 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver(); - if (standardInspectSiteDeviceDriver.getMove() != 0) { - notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevicecode() + "有货,无法下发指令!指令号:" + instruction.getInstruction_code(); - return false; + if (ObjectUtil.equal("true", standardInspectSiteDeviceDriver.getExtraValue().get("input_move"))) { + if (standardInspectSiteDeviceDriver.getMove() != 0) { + notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevicecode() + "有货,无法下发指令!指令号:" + instruction.getInstruction_code(); + return false; + } } } if (nextdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { @@ -503,9 +507,11 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i }*/ if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver(); - if (standardInspectSiteDeviceDriver.getMove() != 1) { - notCreateInstMessage = "就绪任务未创建指令原因->取货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevicecode() + "光电无货,无法生成指令!"; - return false; + if (ObjectUtil.equal("true", standardInspectSiteDeviceDriver.getExtraValue().get("input_move"))) { + if (standardInspectSiteDeviceDriver.getMove() != 1) { + notCreateInstMessage = "就绪任务未创建指令原因->取货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevicecode() + "光电无货,无法生成指令!"; + return false; + } } } if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { @@ -525,9 +531,11 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i } if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver(); - if (standardInspectSiteDeviceDriver.getMove() != 0) { - notCreateInstMessage = "就绪任务未创建指令原因->放货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevicecode() + "光电有货,无法生成指令!"; - return false; + if (ObjectUtil.equal("true", standardInspectSiteDeviceDriver.getExtraValue().get("input_move"))) { + if (standardInspectSiteDeviceDriver.getMove() != 0) { + notCreateInstMessage = "就绪任务未创建指令原因->放货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevicecode() + "光电有货,无法生成指令!"; + return false; + } } } @@ -1117,11 +1125,11 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i action = LangProcess.msg("universal_releasing_completed"); } if (error == 0 && iserror) { - this.setMessage(LangProcess.msg("universal_message11")); + this.setMessage("信号连接异常!"); } - String requireActionSucess = "指令" + LangProcess.msg("universal_actionMessage4"); + String requireActionSucess = LangProcess.msg("universal_directives") + ":" + LangProcess.msg("universal_actionMessage4"); if(this.requireActionSucess){ - requireActionSucess = "指令" + LangProcess.msg("universal_actionMessage5"); + requireActionSucess = LangProcess.msg("universal_directives") + ":" + LangProcess.msg("universal_actionMessage5"); } map.put("device_name", this.getDevice().getDevice_name()); map.put("mode", mode); @@ -1148,11 +1156,17 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i @Override public void setDeviceStatus(JSONObject data) { String requestSucess = data.getString("requireSucess"); + String requireActionSucess = data.getString("requireActionSucess"); if (StrUtil.equals(requestSucess, "0")) { this.requireSucess = false; } else if (StrUtil.equals(requestSucess, "1")) { this.requireSucess = true; } + if (StrUtil.equals(requireActionSucess, "0")) { + this.requireActionSucess = false; + } else if (StrUtil.equals(requireActionSucess, "1")) { + this.requireActionSucess = true; + } } public void writing(String param, String value) { 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..4ef5de975 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; @@ -223,7 +224,6 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp if (inst != null) { if (StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.BUSY.getIndex())) { try { - TaskDto dto = taskserver.findByCode(inst.getTask_code()); Map map = new LinkedHashMap<>(); /*if (ObjectUtil.isNotEmpty(dto)){ String interaction_json = dto.getInteraction_json(); @@ -256,11 +256,11 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp 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); @@ -336,6 +336,7 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp //放货工位 List putDeviceCodeList = this.getExtraDeviceCodes("put_device_code"); TaskDto task = null; + PlugPullDeviceSiteDeviceDriver plugPullDeviceSiteDeviceDriver; for (int i = 0; i < getDeviceCodeList.size(); i++) { String startDeviceCode = getDeviceCodeList.get(i); List taskDtos = taskserver.queryTaskByDeviceCodeAndStatus(startDeviceCode); @@ -343,6 +344,22 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp //按照优先级排序 优先级相等按照创建时间排序 taskDtos = this.sortTask(taskDtos); TaskDto taskDto = taskDtos.get(0); + String startPoint = task.getStart_device_code(); + Device startPointDevice = deviceAppService.findDeviceByCode(startPoint); + if (startPointDevice.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) { + plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) startPointDevice.getDeviceDriver(); + if (plugPullDeviceSiteDeviceDriver.getAction() != 1&&plugPullDeviceSiteDeviceDriver.getAction() != 3) + notCreateInstMessage = "universal_notCreateInstMessage9"; + return false; + } + String nextDeviceCode = taskDto.getNext_device_code(); + Device device = deviceAppService.findDeviceByCode(nextDeviceCode); + if (device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) { + plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) device.getDeviceDriver(); + if (plugPullDeviceSiteDeviceDriver.getMode() != 2 || plugPullDeviceSiteDeviceDriver.getMove() != 0 || plugPullDeviceSiteDeviceDriver.getAction() != 2&&plugPullDeviceSiteDeviceDriver.getAction() != 3) + notCreateInstMessage = "universal_notCreateInstMessage9"; + return false; + } Instruction instruction = instructionService.findByTaskcode(taskDto.getTask_code()); String startCode = instruction.getStart_device_code(); String nextCode = instruction.getNext_device_code(); @@ -379,15 +396,29 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp } } if (!ObjectUtil.isEmpty(task)) { + String startDeviceCode = task.getStart_device_code(); + Device start_device = deviceAppService.findDeviceByCode(startDeviceCode); + if (start_device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) { + plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) start_device.getDeviceDriver(); + if (plugPullDeviceSiteDeviceDriver.getAction() != 1&&plugPullDeviceSiteDeviceDriver.getAction() != 3) + notCreateInstMessage = "universal_notCreateInstMessage9"; + return false; + } + String nextDeviceCode = task.getNext_device_code(); + Device next_device = deviceAppService.findDeviceByCode(nextDeviceCode); + if (next_device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) { + plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) next_device.getDeviceDriver(); + if (plugPullDeviceSiteDeviceDriver.getMode() != 2 || plugPullDeviceSiteDeviceDriver.getMove() != 0 || plugPullDeviceSiteDeviceDriver.getAction() != 2&&plugPullDeviceSiteDeviceDriver.getAction() != 3) + notCreateInstMessage = "universal_notCreateInstMessage9"; + return false; + } String taskId = task.getTask_id(); String taskCode = task.getTask_code(); String vehicleCode = task.getVehicle_code(); String priority = task.getPriority(); String startPointCode = task.getStart_point_code(); - 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()); @@ -670,9 +701,9 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp map.put("driver_type", "siemens_conveyor"); map.put("is_click", true); map.put("message", message); - map.put("error", ErrorUtil.getDictDetail("error_type", String.valueOf(this.getError()))); - map.put("notCreateTaskMessage", notCreateTaskMessage); - map.put("notCreateInstMessage", notCreateInstMessage); + map.put("notCreateTaskMessage", LangProcess.msg(notCreateTaskMessage)); + map.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage)); + map.put("error", ErrorUtil.getDictDetail("bqhj_error_type", String.valueOf(this.getError()))); /*jo.put("x", xPosition); jo.put("y", yPosition);*/ JSONObject jo = new JSONObject(map); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_tail_manipulator/PullTailManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_tail_manipulator/PullTailManipulatorDeviceDriver.java index d68e74c0b..9b61c7145 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_tail_manipulator/PullTailManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_tail_manipulator/PullTailManipulatorDeviceDriver.java @@ -627,7 +627,7 @@ public class PullTailManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp map.put("move", move); map.put("action", action); map.put("isOnline", this.getIsonline()); - map.put("error", ErrorUtil.getDictDetail("error_type", String.valueOf(this.getError()))); + map.put("error", ErrorUtil.getDictDetail("bhhj_error_type", String.valueOf(this.getError()))); map.put("isError", this.getIserror()); map.put("message", message); map.put("feedMessage", feedMessage); 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..db2a23625 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申请反馈 @@ -199,4 +199,6 @@ public interface AcsToWmsService { * @return */ HttpResponse feedbackDies(JSONObject param); + + String secondaryAllocationPoint(JSONObject param); } 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..62c0e68b2 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 @@ -638,6 +637,46 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { } } + @Override + public String secondaryAllocationPoint(JSONObject param) { + try { + MDC.put(log_file_type, log_type); + log.info("applyTaskToWms-----输入参数{}", param); + String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); + AddressDto addressDto = addressService.findByCode("secondaryAllocationPoint"); + String url = wmsurl + addressDto.getMethods_url(); + HttpResponse result2 = null; + try { + result2 = HttpRequest.post(url) + .header("Authorization", token) + .body(String.valueOf(param)) + .execute(); + } catch (Exception e) { + String msg = e.getMessage(); + log.info("applyTaskToWms-----输出参数{}", msg); + //网络不通 + } + if(ObjectUtil.isEmpty(result2)){ + log.info("applyTaskToWms-----输出参数{}", "返回结果为空"); + return null; + } + String type = ""; + if (result2.getStatus() == 200) { + type = "info"; + } else { + type = "error"; + } + log.info("applyTaskToWms-----输出参数{}", result2.body()); + LuceneLogDto luceneLogDto = new LuceneLogDto(4,"applyTaskToWms", String.valueOf(result2.getStatus()), + JSON.toJSONString(param), String.valueOf(result2.body()), "二期发货申请捆扎、贴标"); + luceneLogService.interfaceExecuteLog(luceneLogDto); + return result2.body(); + + } finally { + MDC.remove(log_file_type); + } + } + @Override public HttpResponse feedbackDies(JSONObject param) { HttpResponse result2 = null; 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..b2f5de694 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 @@ -16,12 +16,14 @@ import lombok.extern.slf4j.Slf4j; import org.nl.acs.AcsConfig; import org.nl.acs.device.domain.Device; import org.nl.acs.device_driver.agv.ndctwo.AgvNdcTwoDeviceDriver; +import org.nl.acs.device_driver.conveyor.belt_conveyor.BeltConveyorDeviceDriver; import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver; import org.nl.acs.device_driver.conveyor.standard_ordinary_site.StandardOrdinarySiteDeviceDriver; import org.nl.acs.device_driver.one_conveyor.fold_disc_site.FoldDiscSiteDeviceDriver; 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 +58,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 +77,9 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { @Autowired private InstructionService instructionService; + @Autowired + private LuceneExecuteLogService luceneLogService; + @Autowired private AcsToLiKuService acsToLiKuService; @@ -93,6 +95,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { try { MDC.put(log_file_type, log_type); log.info("crateTask-----输入参数{}", param); + LuceneLogDto luceneLogDto = new LuceneLogDto(4, param, "acs接收lms任务"); + luceneLogService.interfaceExecuteLog(luceneLogDto); JSONArray datas = JSONArray.parseArray(param); CreateTaskResponse response = new CreateTaskResponse(); // ParamService paramService = SpringContextHolder.getBean(ParamService.class); @@ -489,136 +493,178 @@ 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); - if (ObjectUtil.isEmpty(device)) { - throw new Exception("未找到对应设备:" + device_code); - } - InflatableShaftLibraryDeviceDriver inflatableShaftLibraryDeviceDriver; - HongXiangStationDeviceDriver hongXiangStationDeviceDriver; - LampThreecolorDeviceDriver lampThreecolorDeviceDriver; - SiemensConveyorDeviceDriver siemensConveyorDeviceDriver; - WasteFoilWeighingStationDriver wasteFoilWeighingStationDriver; - FoldDiscSiteDeviceDriver foldDiscSiteDeviceDriver; - if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) { - hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver(); - hongXiangStationDeviceDriver.writing(code, value); - } - if (device.getDeviceDriver() instanceof LampThreecolorDeviceDriver) { - lampThreecolorDeviceDriver = (LampThreecolorDeviceDriver) device.getDeviceDriver(); - lampThreecolorDeviceDriver.writing(code, value); - } - if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) { - siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver(); - siemensConveyorDeviceDriver.writing(code, value); - } - if (device.getDeviceDriver() instanceof InflatableShaftLibraryDeviceDriver) { - inflatableShaftLibraryDeviceDriver = (InflatableShaftLibraryDeviceDriver) device.getDeviceDriver(); - inflatableShaftLibraryDeviceDriver.writing(code, value); - } - if (device.getDeviceDriver() instanceof FoldDiscSiteDeviceDriver) { - foldDiscSiteDeviceDriver = (FoldDiscSiteDeviceDriver) device.getDeviceDriver(); - List list = new ArrayList(); - Map map = new HashMap(); - map.put("code",code); - map.put("value",value); - list.add(map); - foldDiscSiteDeviceDriver.writing(list); - } - if (device.getDeviceDriver() instanceof WasteFoilWeighingStationDriver) { - wasteFoilWeighingStationDriver = (WasteFoilWeighingStationDriver) device.getDeviceDriver(); - wasteFoilWeighingStationDriver.writing(code, value); - try { - Thread.sleep(1000); //休眠1秒 - } catch (InterruptedException e) { - e.printStackTrace(); - } + 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); + } + InflatableShaftLibraryDeviceDriver inflatableShaftLibraryDeviceDriver; + HongXiangStationDeviceDriver hongXiangStationDeviceDriver; + LampThreecolorDeviceDriver lampThreecolorDeviceDriver; + BeltConveyorDeviceDriver beltConveyorDeviceDriver ; + WasteFoilWeighingStationDriver wasteFoilWeighingStationDriver; + FoldDiscSiteDeviceDriver foldDiscSiteDeviceDriver; + if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) { + hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver(); + hongXiangStationDeviceDriver.writing(code, value); + } + if (device.getDeviceDriver() instanceof LampThreecolorDeviceDriver) { + lampThreecolorDeviceDriver = (LampThreecolorDeviceDriver) device.getDeviceDriver(); + lampThreecolorDeviceDriver.writing(code, value); + } + if (device.getDeviceDriver() instanceof BeltConveyorDeviceDriver) { + beltConveyorDeviceDriver=(BeltConveyorDeviceDriver) device.getDeviceDriver(); + beltConveyorDeviceDriver.writing(code, value); + } + if (device.getDeviceDriver() instanceof InflatableShaftLibraryDeviceDriver) { + inflatableShaftLibraryDeviceDriver = (InflatableShaftLibraryDeviceDriver) device.getDeviceDriver(); + inflatableShaftLibraryDeviceDriver.writing(code, value); + } + if (device.getDeviceDriver() instanceof FoldDiscSiteDeviceDriver) { + foldDiscSiteDeviceDriver = (FoldDiscSiteDeviceDriver) device.getDeviceDriver(); + List list = new ArrayList(); + Map map = new HashMap(); + map.put("code", code); + map.put("value", value); + list.add(map); + foldDiscSiteDeviceDriver.writing(list); + } + if (device.getDeviceDriver() instanceof WasteFoilWeighingStationDriver) { + wasteFoilWeighingStationDriver = (WasteFoilWeighingStationDriver) device.getDeviceDriver(); + wasteFoilWeighingStationDriver.writing(code, value); + try { + Thread.sleep(1000); //休眠1秒 + } catch (InterruptedException e) { + e.printStackTrace(); } } - 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.setStatus(200); + 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 @@ -678,7 +724,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { jo.put("action", Math.min(3, blankManipulatorDeviceDriver.getAction())); jo.put("task", Math.min(3, blankManipulatorDeviceDriver.getTask())); jo.put("error", blankManipulatorDeviceDriver.getError()); - }else if (device.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { + } else if (device.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) device.getDeviceDriver(); jo.put("device_code", parent_device_code); jo.put("mode", hongXiangConveyorDeviceDriver.getMode()); @@ -788,7 +834,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { jo.put("action", subvolumeWeighingStationDriver.getAction()); jo.put("weight", subvolumeWeighingStationDriver.getWeight()); jo.put("error", subvolumeWeighingStationDriver.getError()); - }else if (device.getDeviceDriver() instanceof FoldDiscSiteDeviceDriver) { + } else if (device.getDeviceDriver() instanceof FoldDiscSiteDeviceDriver) { foldDiscSiteDeviceDriver = (FoldDiscSiteDeviceDriver) device.getDeviceDriver(); jo.put("device_code", parent_device_code); jo.put("move", foldDiscSiteDeviceDriver.getMove()); @@ -805,7 +851,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { resultJson.put("status", HttpStatus.OK.value()); resultJson.put("message", "操作成功"); resultJson.put("data", backja); - LuceneLogDto luceneLogDto = new LuceneLogDto(4,"queryDevice", String.valueOf(resultJson.get("status")), + LuceneLogDto luceneLogDto = new LuceneLogDto(4, "queryDevice", String.valueOf(resultJson.get("status")), jsonObject, String.valueOf(resultJson), "LMS查询设备状态"); luceneExecuteLogService.interfaceExecuteLog(luceneLogDto); return resultJson; @@ -835,5 +881,4 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { } - } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/history/ErrorUtil.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/history/ErrorUtil.java index 07a323bd0..cb87e0412 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/history/ErrorUtil.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/history/ErrorUtil.java @@ -41,7 +41,7 @@ public class ErrorUtil { String en_label = dictDetailDto.getEn_label(); String in_label = dictDetailDto.getIn_label(); String zh_label = dictDetailDto.getZh_label(); - if (StrUtil.equals(value, error_code)) { + if (StrUtil.equals(value, error_code) && ObjectUtil.isNotEmpty(language)) { if (language.contains("zh")){ detail = zh_label; break; @@ -54,7 +54,10 @@ public class ErrorUtil { detail = en_label; break; } - + if(StrUtil.isEmpty(language)){ + detail = en_label; + break; + } } } } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/domain/InstructionMybatis.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/domain/InstructionMybatis.java index 8b9bdbfee..226cd2917 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/domain/InstructionMybatis.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/domain/InstructionMybatis.java @@ -34,211 +34,215 @@ import java.io.Serializable; public class InstructionMybatis extends CommonModel implements Serializable { private static final long serialVersionUID = 1L; - + @TableId(type = IdType.ASSIGN_ID) private String instruction_id; - + private String task_id; - + @NotBlank private String instruction_code; - + private String link_num; - + private String execute_device_code; - + private String execute_status; - + private String execute_status_description; - + private String follow_device_code; - + @NotBlank private String compound_inst; - + private String compound_inst_data; - + private String material; - + @NotNull private BigDecimal quantity; - + private String instruction_type; - + private String instruction_status; - + private String create_type; - + private String finish_type; - + private String priority; - + private String execute_code; - + private String execute_message; - + private String start_point_code; - + private String start_device_code; - + private String start_point_code2; - + private String start_device_code2; - + private String next_point_code; - + private String next_device_code; - + private String next_point_code2; - + private String next_device_code2; - + private String put_point_code; - + private String put_device_code; - + private String task_code; - + private String vehicle_code; - + private String vehicle_type; - + private String from_x; - + private String from_y; - + private String from_z; - + private String from_x2; - + private String from_y2; - + private String from_z2; - + private String put_x; - + private String put_y; - + private String put_z; - + private String to_x; - + private String to_y; - + private String to_z; - + private String to_x2; - + private String to_y2; - + private String to_z2; - + private String last_instruction_id; - + @NotBlank private String can_modify; - + private String remark; - + @NotBlank private String is_active; - + @NotBlank private String is_delete; - + @NotBlank @TableField(fill = FieldFill.INSERT) private String create_by; - + @NotBlank @TableField(fill = FieldFill.INSERT) private String create_time; - + @TableField(fill = FieldFill.INSERT_UPDATE) private String update_by; - + @TableField(fill = FieldFill.INSERT_UPDATE) private String update_time; - + private String carno; - + private String agv_jobno; - + private String send_status; - + private String weight; - + private String route_plan_code; - + private String emptypallet_num; - + private String agv_inst_type; - + private String agv_system_type; + + + private Integer agv_action_type; + public void copyFrom(Instruction source) { BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true)); } 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/InstructionDto.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/dto/InstructionDto.java index bd79c3678..a9e802d6b 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/dto/InstructionDto.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/dto/InstructionDto.java @@ -365,6 +365,12 @@ public class InstructionDto implements Serializable { private String to_device_code; + /** + * agv二次分配类型(1、普通任务 2、取货二次分配 3、防货二次分配 4、取放货二次分配) + */ + private Integer agv_action_type; + + /** * */ 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..889c69d29 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.isEmpty(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 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))) { + return; + } + } String currentUsername = SecurityUtils.getCurrentNickName(); String now = DateUtil.now(); if (StrUtil.isEmpty(dto.getRoute_plan_code())) { @@ -573,14 +592,22 @@ public class InstructionServiceImpl extends CommonServiceImpl shortPathsList = @@ -636,26 +658,44 @@ public class InstructionServiceImpl extends CommonServiceImpl 0 && StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE)) { + Device deviceByCode = deviceAppService.findDeviceByCode(dto.getStart_device_code()); + if (dto.getAgv_system_type().equals(AgvSystemTypeEnum.XG_System_Type.getIndex())) { + String interactionJson = task.getInteraction_json(); + if (StrUtil.isEmpty(interactionJson)){ + throw new BadRequestException("agv叉车调整长宽参数为空"); + } + InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class); + //仙工叉车 + HttpResponse response = xiangGongAgvService.sendOrderSequencesToForklift(dto,interactionJsonDTO); + if (ObjectUtils.isEmpty(response) || response.getStatus() != 200) { dto.setSend_status("2"); + } else { + dto.setSend_status("1"); + } + } 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"); + } else { + dto.setSend_status("1"); } } } } catch (Exception e) { dto.setSend_status("2"); - e.printStackTrace(); + log.error(e.getMessage()); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code("创建指令报错") + .content("任务号" + dto.getTask_code() + "报错原因:" + e.getMessage()) + .build(); + logDto.setLog_level(2); + luceneExecuteLogService.deviceExecuteLog(logDto); + throw e; } - InstructionMybatis entity = ConvertUtil.convert(dto, InstructionMybatis.class); instructionMapper.insert(entity); instructions.add(dto); @@ -1168,6 +1208,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 +1770,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 +1932,6 @@ public class InstructionServiceImpl extends CommonServiceImpl implements Serializable { private String interaction_json; + + + private Integer agv_action_type; + public void copyFrom(Task source) { BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true)); } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/enums/ActionTypeEnum.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/enums/ActionTypeEnum.java new file mode 100644 index 000000000..ba2f202f0 --- /dev/null +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/enums/ActionTypeEnum.java @@ -0,0 +1,35 @@ +package org.nl.acs.task.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum ActionTypeEnum { + + /** + * 取货二次分配 + */ + IN_STOCK(1, "取货二次分配"), + + /** + * 防货二次分配 + */ + OUT_STOCK(2, "防货二次分配"), + /** + * 取货完成 + */ + IN_FINISHING(3, "取货完成"); + + Integer code; + String status; + + public static String getStatus(Integer code) { + for (ActionTypeEnum value : values()) { + if (value.code.equals(code)) { + return value.status; + } + } + return null; + } +} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/enums/AgvActionTypeEnum.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/enums/AgvActionTypeEnum.java new file mode 100644 index 000000000..67b408a90 --- /dev/null +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/enums/AgvActionTypeEnum.java @@ -0,0 +1,39 @@ +package org.nl.acs.task.enums; + + +import lombok.AllArgsConstructor; +import lombok.Getter; + + +@Getter +@AllArgsConstructor +public enum AgvActionTypeEnum { + /** + * 普通任务 + */ + ORDINARY(1, "普通任务"), + /** + * 取货二次分配 + */ + IN_STOCK(2, "取货二次分配"), + /** + * 防货二次分配 + */ + OUT_STOCK(3, "防货二次分配"), + /** + * 取放货二次分配 + */ + IN_OUT_STOCK(4, "取放货二次分配"); + + Integer code; + String status; + + public static String getStatus(Integer code) { + for (AgvActionTypeEnum value : values()) { + if (value.code.equals(code)) { + return value.status; + } + } + return null; + } +} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/dto/TaskDto.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/dto/TaskDto.java index b5a63553a..b54c66f85 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/dto/TaskDto.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/dto/TaskDto.java @@ -349,4 +349,10 @@ public class TaskDto implements Serializable { * 是否拔轴 0/1 */ private String is_pulling; + + + /** + * agv二次分配类型(1、普通任务 2、取货二次分配 3、防货二次分配 4、取放货二次分配) + */ + private Integer agv_action_type; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java index 482d13edc..136ee6a86 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java @@ -28,6 +28,8 @@ import org.nl.acs.device.service.DeviceService; import org.nl.acs.device.service.dto.DeviceAssignedDto; import org.nl.acs.device.service.impl.DeviceServiceImpl; import org.nl.acs.device_driver.DeviceDriverDefination; +import org.nl.acs.device_driver.conveyor.standard_ordinary_site.StandardOrdinarySiteDeviceDriver; +import org.nl.acs.device_driver.storage.standard_storage.StandardStorageDeviceDriver; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.instruction.domain.Instruction; import org.nl.acs.instruction.domain.InstructionMybatis; @@ -40,6 +42,7 @@ import org.nl.acs.route.domain.RoutePlan; import org.nl.acs.route.service.RouteLineService; import org.nl.acs.route.service.dto.RouteLineDto; import org.nl.acs.route.service.mapper.RoutePlanMapper; +import org.nl.acs.task.enums.AgvSystemTypeEnum; import org.nl.acs.task.enums.TaskStatusEnum; import org.nl.acs.task.enums.TaskTypeEnum; import org.nl.acs.task.service.TaskFeedbackService; @@ -837,7 +840,9 @@ public class TaskServiceImpl extends CommonServiceImpl impleme //反馈上位系统任务状态 this.feedWmsTaskStatus(entity); //关闭仙工运单序列 - this.markComplete(entity); + if(StrUtil.equals(task.getTask_type(),TaskTypeEnum.Standard_AGV_Task.getCode()) && (StrUtil.equals(task.getAgv_system_type(), AgvSystemTypeEnum.One_NDC_System_Type.getCode())||StrUtil.equals(task.getAgv_system_type(), AgvSystemTypeEnum.XG_System_Type.getCode()))) { + this.markComplete(entity); + } } @Override @@ -866,7 +871,9 @@ public class TaskServiceImpl extends CommonServiceImpl impleme //反馈上位系统任务状态 this.feedWmsTaskStatus(entity); //关闭仙工运单序列 - this.markComplete(entity); + if(StrUtil.equals(task.getTask_type(),TaskTypeEnum.Standard_AGV_Task.getCode()) && (StrUtil.equals(task.getAgv_system_type(), AgvSystemTypeEnum.One_NDC_System_Type.getCode())||StrUtil.equals(task.getAgv_system_type(), AgvSystemTypeEnum.XG_System_Type.getCode()))) { + this.markComplete(entity); + } } @@ -899,6 +906,8 @@ public class TaskServiceImpl extends CommonServiceImpl impleme String next_point_code2 = acsTask.getNext_point_code2(); String agv_system_type = acsTask.getAgv_system_type(); String task_type = acsTask.getTask_type(); + String start_height = acsTask.getStart_height(); + String next_height = acsTask.getNext_height(); /** 开始平均分解校验 */ String this_device_code = this.queryAssignedByDevice(acsTask.getStart_device_code(), acsTask.getNext_device_code()); @@ -906,6 +915,7 @@ public class TaskServiceImpl 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 +924,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; } } @@ -954,31 +969,37 @@ public class TaskServiceImpl extends CommonServiceImpl impleme instdto.setNext_device_code2(next_point_code2); instdto.setNext_point_code2(next_point_code2); instdto.setAgv_system_type(agv_system_type); - instdto.setAgv_inst_type(CommonFinalParam.ONE); + instdto.setStart_height(start_height); + instdto.setNext_height(next_height); - if (!StrUtil.equals(agv_system_type, "1")) { + //判断agv系统 + //1、1楼叉车系统 + //2、2楼1区域AGV系统 + //3、2楼2区域AGV系统 -已废弃 + if (StrUtil.equals(agv_system_type, CommonFinalParam.TWO)) { // task_type - // 1、生箔; Itype=1:取空,取满,放空,放满; - // 2、分切 Itype=3取满、取空、放满、放空; - // 3、普通任务 Itype=2:取货、放货; - // 4、叉车任务 - // 5、输送任务 - // 6、行架 - // 7、立库 - if (StrUtil.equals(task_type, "1")) { - instdto.setAgv_inst_type("1"); + //1、生箔; Itype=1:取空,取满,放空,放满; + //2、分切 Itype=3取满、取空、放满、放空; + //3、普通任务 Itype=2:取货、放货; + //4、叉车任务 + //5、输送任务 + //6、行架 + //7、立库 + if (StrUtil.equals(task_type, CommonFinalParam.ONE)) { + instdto.setAgv_inst_type(CommonFinalParam.ONE); } else if (StrUtil.equals(task_type, "3")) { instdto.setAgv_inst_type("2"); } else if (StrUtil.equals(task_type, "2")) { instdto.setAgv_inst_type("3"); } else if (StrUtil.equals(task_type, "8")) { instdto.setAgv_inst_type("2"); + } else { + log.info("未找到对应的AGV指令类型,任务号:" + acsTask.getTask_code() + ",task_type:" + acsTask.getTask_type()); } } else { instdto.setAgv_inst_type("4"); } instructionservice.create2(instdto); - acsTask.setTask_status(CommonFinalParam.ONE); this.update(acsTask); return instdto; @@ -1077,9 +1098,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); } @@ -1625,23 +1647,10 @@ public class TaskServiceImpl extends CommonServiceImpl impleme */ private void markComplete(TaskDto taskDto) { // 如果属于先知AGV,关闭运单序列 - List shortPathsList = - routeLineService.getShortPathLines( - taskDto.getStart_device_code(), - taskDto.getNext_device_code(), - taskDto.getRoute_plan_code()); - if (ObjectUtil.isNotEmpty(shortPathsList)) { - String type = shortPathsList.get(0).getType(); - // != 0 为agv任务 - if (!StrUtil.equals(type, "0")) { - if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) { - try { - agvService.markComplete(taskDto.getTask_code()); - } catch (Exception e) { - log.error("关闭运单异常,原因:{}", e.getMessage()); - } - } - } + try { + agvService.markComplete(taskDto.getTask_code()); + } catch (Exception e) { + log.error("关闭运单异常,原因:{}", e.getMessage()); } } 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/language/InitLocaleResolver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/language/InitLocaleResolver.java index 5d16d842e..2ed33f922 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/language/InitLocaleResolver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/language/InitLocaleResolver.java @@ -19,7 +19,6 @@ public class InitLocaleResolver implements LocaleResolver { if (StringUtils.isNotEmpty(header)){ String lang = Language_Country.get(header); language = lang; - System.out.println("lang的值为:"+lang); if (StringUtils.isNotEmpty(lang)){ String[] l = lang.split("-"); //印尼的ISO标准国家代码为id-ID 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/dict/impl/SysDictServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/dict/impl/SysDictServiceImpl.java index c8e41b2d3..e389ed070 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/dict/impl/SysDictServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/dict/impl/SysDictServiceImpl.java @@ -153,6 +153,9 @@ public class SysDictServiceImpl extends ServiceImpl impleme dic.setPara1(dict.getPara1()); dic.setPara2(dict.getPara2()); dic.setPara3(dict.getPara3()); + dic.setZh_label(dict.getZh_label()); + dic.setEn_label(dict.getEn_label()); + dic.setIn_label(dict.getIn_label()); sysDictMapper.updateById(dic); return; } 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..5aee86e81 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 @@ -86,6 +86,7 @@ public class AutoCreateInst { String start_height = acsTask.getStart_height(); String next_height = acsTask.getNext_height(); + Integer agvActionType = acsTask.getAgv_action_type(); if (StrUtil.equals(is_send, "0")) { @@ -158,11 +159,12 @@ public class AutoCreateInst { instdto.setAgv_system_type(agv_system_type); instdto.setStart_height(start_height); instdto.setNext_height(next_height); + instdto.setAgv_action_type(agvActionType); //判断agv系统 //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..6b680c23b 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 @@ -55,11 +57,13 @@ universal_notCreateInstMessage5=\u5B58\u5728\u76F8\u540C\u8DEF\u7EBF\u7684\u6307 universal_notCreateInstMessage6=\u4E0B\u4E00\u4E2A\u8BBE\u5907\u4E0D\u662F\u8F93\u9001\u7EBF\u6307\u4EE4! universal_notCreateInstMessage7=\u6258\u76D8\u7C7B\u578B\u4E3A\u7A7A! universal_notCreateInstMessage8=\u6761\u7801\u4E3A\u7A7A! +universal_notCreateInstMessage9=\u63D2\u62D4\u8F74\u5DE5\u4F4D\u6761\u4EF6\u4E0D\u6EE1\u8DB3\uFF0C\u65E0\u6CD5\u751F\u6210\u6307\u4EE4! universal_actionMessage1=\u4E0D\u5141\u8BB8\u53D6\u653E universal_actionMessage2=\u5141\u8BB8\u53D6\u653E universal_actionMessage3=\u5141\u8BB8\u79BB\u5F00 universal_actionMessage4=\u8BF7\u6C42\u52A8\u4F5C\u5DF2\u590D\u4F4D universal_actionMessage5=\u8BF7\u6C42\u52A8\u4F5C\u672A\u590D\u4F4D +universal_directives=\u6307\u4EE4 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..61adfec8e 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 @@ -52,6 +54,7 @@ universal_notCreateInstMessage3=The device is in standby mode or is not allowed universal_notCreateInstMessage4=ddj interface bit is in stock, cannot generate command! universal_notCreateInstMessage5=Instructions with the same route exist! universal_notCreateInstMessage6=The next device is not a conveyor line directive! +universal_notCreateInstMessage9=The plugging and unplugging shaft station conditions are not met, and the instruction cannot be generated! universal_actionMessage1=Pick-and-place is not permitted universal_actionMessage2=Pick-and-place is allowed universal_actionMessage3=Permission to leave @@ -59,5 +62,6 @@ universal_actionMessage4=The request action has been reset universal_actionMessage5=The request action is not reset universal_notCreateInstMessage7=ray type is empty! universal_notCreateInstMessage8=The barcode is blank\uFF01 +universal_directives=Directives 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..506419cd1 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 @@ -52,6 +54,7 @@ universal_notCreateInstMessage3=Siaga perangkat atau tidak diizinkan masuk universal_notCreateInstMessage4=DDJ mendarat di dok, tidak ada perintah yang diberikan! universal_notCreateInstMessage5=Ada instruksi tentang rute yang sama! universal_notCreateInstMessage6=Perangkat berikutnya bukan arahan jalur konveyor! +universal_notCreateInstMessage9=Kondisi stasiun poros penyumbatan dan pencabutan tidak terpenuhi, dan instruksi tidak dapat dibuat! universal_actionMessage1=Pick-and-place tidak diizinkan universal_actionMessage2=Pick-and-place diperbolehkan universal_actionMessage3=Izin untuk pergi @@ -59,3 +62,4 @@ universal_actionMessage4=Tindakan permintaan telah disetel ulang universal_actionMessage5=Tindakan permintaan tidak disetel ulang universal_notCreateInstMessage7=ponypianmereka yang kosong! universal_notCreateInstMessage8=Kode batang kosong! +universal_directives=Arahan 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..c6ad11329 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 @@ -57,8 +59,9 @@ universal_notCreateInstMessage3=\u8BBE\u5907\u5F85\u673A\u6216\u4E0D\u5141\u8BB8 universal_notCreateInstMessage4=ddj\u5BF9\u63A5\u4F4D\u6709\u8D27,\u65E0\u6CD5\u751F\u6210\u6307\u4EE4! universal_notCreateInstMessage5=\u5B58\u5728\u76F8\u540C\u8DEF\u7EBF\u7684\u6307\u4EE4! universal_notCreateInstMessage6=\u4E0B\u4E00\u4E2A\u8BBE\u5907\u4E0D\u662F\u8F93\u9001\u7EBF\u6307\u4EE4! +universal_notCreateInstMessage9=\u63D2\u62D4\u8F74\u5DE5\u4F4D\u6761\u4EF6\u4E0D\u6EE1\u8DB3\uFF0C\u65E0\u6CD5\u751F\u6210\u6307\u4EE4! universal_notCreateInstMessage7=\u6258\u76D8\u7C7B\u578B\u4E3A\u7A7A! universal_notCreateInstMessage8=\u6761\u7801\u4E3A\u7A7A! - +universal_directives=\u6307\u4EE4 diff --git a/acs2/nladmin-ui/src/i18n/langs/monitor/en.js b/acs2/nladmin-ui/src/i18n/langs/monitor/en.js index ea557524d..394d5e9c8 100644 --- a/acs2/nladmin-ui/src/i18n/langs/monitor/en.js +++ b/acs2/nladmin-ui/src/i18n/langs/monitor/en.js @@ -66,6 +66,9 @@ export default { 'photoelectric_signal': 'photoelectric signal', 'mode': 'mode', 'alarm': 'alarm', + 'last_mission_number': 'Last Mission Number', + 'the_subvolume_number': 'The Subvolume Number', + 'pallet_type': 'Pallet Type', 'ip_address': 'IP', 'pallet_quantity': 'Pallet quantity', 'instruction_information': 'instruction information', @@ -96,6 +99,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..42388c80d 100644 --- a/acs2/nladmin-ui/src/i18n/langs/monitor/in.js +++ b/acs2/nladmin-ui/src/i18n/langs/monitor/in.js @@ -64,6 +64,9 @@ export default { 'device_name': 'nama divais', 'exception_message': 'pesan yang tidak biasa', 'photoelectric_signal': 'Sinyal fotolistrik', + 'last_mission_number': 'Nomor misi terakhir', + 'the_subvolume_number': 'Nomor Subvolume', + 'pallet_type': 'Jenis Palet', 'mode': 'pola', 'alarm': 'polisi', 'ip_address': 'IP', @@ -96,6 +99,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..3885b4a3b 100644 --- a/acs2/nladmin-ui/src/i18n/langs/monitor/zh.js +++ b/acs2/nladmin-ui/src/i18n/langs/monitor/zh.js @@ -96,7 +96,11 @@ export default { 'previous_station_task': '前工位任务号', 'back_station_task': '后工位任务号', 'task_number': '任务号', + 'command': '动作', 'disable': '是否禁用', + 'last_mission_number': '上次任务号', + 'the_subvolume_number': '子卷编号', + 'pallet_type': '托盘类型', 'current_temperature': '当前温度', 'oven_finish': '烘箱完成', 'house': '恒温倒计时-时', 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/device/driver/standard_inspect_site.vue b/acs2/nladmin-ui/src/views/acs/device/driver/standard_inspect_site.vue index c421eda4d..240399dd5 100644 --- a/acs2/nladmin-ui/src/views/acs/device/driver/standard_inspect_site.vue +++ b/acs2/nladmin-ui/src/views/acs/device/driver/standard_inspect_site.vue @@ -1,5 +1,5 @@ + + + +