From 065f422e55355dd9bccd097aaaaa688f6f2a73cd Mon Sep 17 00:00:00 2001 From: yanps Date: Thu, 1 Feb 2024 10:37:01 +0800 Subject: [PATCH 1/2] =?UTF-8?q?add:=20=E7=83=98=E7=AE=B1=E5=AF=B9=E6=8E=A5?= =?UTF-8?q?=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HongXiangStationDeviceDriver.java | 62 +++------------- .../hongxiang_conveyor/ItemProtocol.java | 73 +++++++++++++++++-- .../OvenGantryManipulatorDeviceDriver.java | 52 ++----------- 3 files changed, 86 insertions(+), 101 deletions(-) diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/hongxiang_conveyor/HongXiangStationDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/hongxiang_conveyor/HongXiangStationDeviceDriver.java index c8c1536c0..01fa6cdc6 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/hongxiang_conveyor/HongXiangStationDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/hongxiang_conveyor/HongXiangStationDeviceDriver.java @@ -63,40 +63,14 @@ public class HongXiangStationDeviceDriver extends AbstractOpcDeviceDriver implem public int move = 0; public int action = 0; public int error = 0; - public int door = 0; - public int temperature = 0; - public int countdown = 0; - public int finish = 0; - public int task = 0; - public int error1 = 0; - public int material = 0; - public int consumption = 0; - public int voltageA = 0; - public int voltageB = 0; - public int voltageC = 0; - public int currentA = 0; - public int currentB = 0; - public int currentC = 0; + public String task = null; public int last_heartbeat = 0; public int last_mode = 0; public int last_move = 0; public int last_action = 0; public int last_error = 0; - public int last_door = 0; - public int last_temperature = 0; - public int last_countdown = 0; - public int last_finish = 0; - public int last_task = 0; - public int last_error1 = 0; - public int last_material = 0; - public int last_consumption = 0; - public int last_voltageA = 0; - public int last_voltageB = 0; - public int last_voltageC = 0; - public int last_currentA = 0; - public int last_currentB = 0; - public int last_currentC = 0; + public String last_task = null; Boolean isonline = true; @@ -122,23 +96,17 @@ public class HongXiangStationDeviceDriver extends AbstractOpcDeviceDriver implem @Override public void execute() { String message = null; - device_code = this.getDeviceCode(); + heartbeat = itemProtocol.getItem_heartbeat(); + mode = itemProtocol.getItem_mode(); + move = itemProtocol.getItem_move(); + task = itemProtocol.getItem_task(); + error = itemProtocol.getItem_error(); + action = itemProtocol.getItem_action(); } - public synchronized boolean instruction_apply(String container_code) throws Exception { - Date date = new Date(); - if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_apply_time = date; - requireSucess = true; - return true; - } - } protected void thingToNothing() { this.setRequireSucess(false); @@ -147,8 +115,8 @@ public class HongXiangStationDeviceDriver extends AbstractOpcDeviceDriver implem public void writing(int command) { String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + ItemProtocol.item_to_command; - //String opcservcerid = this.getDevice().getOpc_server_id(); -//Server server = ReadUtil.getServer(opcservcerid); + // String opcservcerid = this.getDevice().getOpc_server_id(); + // Server server = ReadUtil.getServer(opcservcerid); Map itemMap = new HashMap(); itemMap.put(to_command, command); this.control(itemMap); @@ -177,12 +145,9 @@ public class HongXiangStationDeviceDriver extends AbstractOpcDeviceDriver implem String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + param; - //String opcservcerid = this.getDevice().getOpc_server_id(); -//Server server = ReadUtil.getServer(opcservcerid); Map itemMap = new HashMap(); itemMap.put(to_param, value); -// itemMap.put(to_param, Integer.parseInt(value)); this.control(itemMap); } @@ -190,12 +155,9 @@ public class HongXiangStationDeviceDriver extends AbstractOpcDeviceDriver implem @Override public JSONObject getDeviceStatusName() { JSONObject jo = new JSONObject(); - String mode = ""; - String action = ""; - String move = ""; jo.put("device_name", this.getDevice().getDevice_name()); - jo.put("mode", "联机"); - jo.put("action", action); + jo.put("mode", mode ==2 ? "待机": "脱机"); + jo.put("action", action == 1 ? "允许取放": "不允许取放"); jo.put("isOnline", true); jo.put("error", this.getError()); jo.put("isError", this.getIserror()); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/hongxiang_conveyor/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/hongxiang_conveyor/ItemProtocol.java index 72992ccec..59ec84678 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/hongxiang_conveyor/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/hongxiang_conveyor/ItemProtocol.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.two_conveyor.hongxiang_conveyor; +import cn.hutool.core.util.StrUtil; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.nl.acs.device.device_driver.standard_inspect.ItemDto; @@ -11,10 +12,24 @@ import java.util.List; @Data public class ItemProtocol { + public static String item_heartbeat = "heartbeat"; + + public static String item_mode = "mode"; + + public static String item_move = "move"; + public static String item_action = "action"; + public static String item_error = "error"; + + public static String item_task = "task"; + public static String item_to_command = "to_command"; + public static String item_target = "target"; + + public static String item_to_task = "task"; + private HongXiangStationDeviceDriver driver; public ItemProtocol(HongXiangStationDeviceDriver driver) { @@ -22,11 +37,42 @@ public class ItemProtocol { } + public int getItem_heartbeat() { + return this.getOpcIntegerValue(item_heartbeat); + } + + public int getItem_mode() { + return this.getOpcIntegerValue(item_mode); + } + + public int getItem_move() { + return this.getOpcIntegerValue(item_move); + } + + public int getItem_error() { + return this.getOpcIntegerValue(item_error); + } + + public String getItem_task() { + return this.getOpcStringValue(item_task); + } + public int getItem_action() { return this.getOpcIntegerValue(item_action); } - ; + public int getItem_to_command() { + return this.getOpcIntegerValue(item_to_command); + } + + public int getItem_target() { + return this.getOpcIntegerValue(item_target); + } + + public String getItem_to_task() { + return this.getOpcStringValue(item_to_task); + } + Boolean isonline; @@ -42,17 +88,34 @@ public class ItemProtocol { } + public String getOpcStringValue(String protocol) { + String stringValue = this.driver.getStringValue(protocol); + if (StrUtil.isEmpty(stringValue)) { + setIsonline(false); + } else { + setIsonline(true); + return stringValue; + } + return "0"; + + } + public static List getReadableItemDtos() { ArrayList list = new ArrayList(); - - list.add(new ItemDto(item_action, "动作信号", "450")); - + list.add(new ItemDto(item_heartbeat, "心跳", "DB100.10")); + list.add(new ItemDto(item_mode, "模式", "DB100.12")); + list.add(new ItemDto(item_move, "光电信号", "DB100.13")); + list.add(new ItemDto(item_error, "error", "DB100.14")); + list.add(new ItemDto(item_task, "任务号", "DB100.15")); + list.add(new ItemDto(item_action, "取放信号", "DB100.11 ")); return list; } public static List getWriteableItemDtos() { ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_command, "下发命令", "226")); + list.add(new ItemDto(item_to_command, "下发命令", "DB101.11")); + list.add(new ItemDto(item_target, "下发目标站", "DB101.12")); + list.add(new ItemDto(item_to_task, "下发任务号", "DB101.13")); return list; } 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 d025e19d4..348e34738 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 @@ -348,17 +348,9 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i String next_device_code = instruction.getNext_device_code(); Device nextdevice = deviceAppService.findDeviceByCode(next_device_code); Device startdevice = deviceAppService.findDeviceByCode(start_device_code); - //PhotoelectricInspectionSiteDeviceDriver photoelectricInspectionSiteDeviceDriver; HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; OvenInspectSiteDeviceDriver ovenInspectSiteDeviceDriver; -// if (startdevice.getDeviceDriver() instanceof PhotoelectricInspectionSiteDeviceDriver) { -// photoelectricInspectionSiteDeviceDriver = (PhotoelectricInspectionSiteDeviceDriver) startdevice.getDeviceDriver(); -// if (photoelectricInspectionSiteDeviceDriver.getMove() != 1) { -// notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱对接位:" + photoelectricInspectionSiteDeviceDriver.getDevice_code() + "无货,无法下发指令!指令号:" + instruction.getInstruction_code(); -// return false; -// } -// } if(startdevice.getDeviceDriver() instanceof OvenInspectSiteDeviceDriver && nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){ ovenInspectSiteDeviceDriver = (OvenInspectSiteDeviceDriver) startdevice.getDeviceDriver(); standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver(); @@ -485,13 +477,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; OvenInspectSiteDeviceDriver ovenInspectSiteDeviceDriver; -// if (startdevice.getDeviceDriver() instanceof PhotoelectricInspectionSiteDeviceDriver) { -// photoelectricInspectionSiteDeviceDriver = (PhotoelectricInspectionSiteDeviceDriver) startdevice.getDeviceDriver(); -// if (photoelectricInspectionSiteDeviceDriver.getMove() != 1) { -// notCreateInstMessage = "就绪任务未创建指令原因->取货位-烘箱对接位:" + photoelectricInspectionSiteDeviceDriver.getDevice_code() + "光电无货,无法生成指令!"; -// return false; -// } -// } if(startdevice.getDeviceDriver() instanceof OvenInspectSiteDeviceDriver && nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){ ovenInspectSiteDeviceDriver = (OvenInspectSiteDeviceDriver) startdevice.getDeviceDriver(); standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver(); @@ -544,13 +529,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i return false; } } -// if (nextdevice.getDeviceDriver() instanceof PhotoelectricInspectionSiteDeviceDriver) { -// photoelectricInspectionSiteDeviceDriver = (PhotoelectricInspectionSiteDeviceDriver) nextdevice.getDeviceDriver(); -// if (photoelectricInspectionSiteDeviceDriver.getMove() != 0) { -// notCreateInstMessage = "就绪任务未创建指令原因->放货位-烘箱对接位:" + photoelectricInspectionSiteDeviceDriver.getDevice_code() + "光电有货,无法生成指令!"; -// return false; -// } -// } if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver(); if (standardInspectSiteDeviceDriver.getMove() != 0) { @@ -699,7 +677,12 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i return flag; } - //判断取货位或放货位为烘箱设备时关联的同一列烘箱设备是否有开门 + /** + * 判断取货位或放货位为烘箱设备时关联的同一列烘箱设备是否有开门 + * @param start_device_code + * @param next_device_code + * @return + */ public boolean judgeCloseDoor(String start_device_code, String next_device_code) { Boolean isClose = false; try { @@ -774,7 +757,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i this.instruction_update_time = date; //更改任务状态 if (task > 0) { - //inst_message Instruction inst1 = checkInst(); if (inst1 != null) { if (StrUtil.equals(inst1.getInstruction_status(), "0")) { @@ -794,7 +776,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; if (device.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) device.getDeviceDriver(); - //hongXiangConveyorDeviceDriver.writing("to_open_door", "1"); int mode = hongXiangConveyorDeviceDriver.getMode(); int door = hongXiangConveyorDeviceDriver.getDoor(); int action = hongXiangConveyorDeviceDriver.getAction(); @@ -804,8 +785,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i if (this.getNow_steps_type() == 2) { this.writing("to_command", "2"); this.setNow_steps_type(3); - } else { - //logServer.deviceExecuteLog(this.device_code, "", "", "未反馈电气信号原因:当前步骤不为下发电气信号(now_steps_type!=2)"); } } else { if (this.getNow_steps_type() == 2) { @@ -831,8 +810,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i if (this.getNow_steps_type() == 2) { this.writing("to_command", "2"); this.setNow_steps_type(3); - } else { - //logServer.deviceExecuteLog(this.device_code, "", "", "未反馈电气信号原因:当前步骤不为下发电气信号(now_steps_type!=2)\")"); } } } @@ -868,8 +845,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i if (this.getNow_steps_type() == 3) { this.writing("to_command", "3"); this.setNow_steps_type(4); - } else { - //logServer.deviceExecuteLog(this.device_code, "", "", "未反馈电气信号原因:当前步骤不为允许取货(now_steps_type!=3)"); } } } else { @@ -899,7 +874,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; if (nextDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextDevice.getDeviceDriver(); - //hongXiangConveyorDeviceDriver.writing("to_open_door", "1"); int mode = hongXiangConveyorDeviceDriver.getMode(); int door = hongXiangConveyorDeviceDriver.getDoor(); int action = hongXiangConveyorDeviceDriver.getAction(); @@ -911,7 +885,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i this.setNow_steps_type(5); } else { feedMessage = "未反馈电气信号原因:当前步骤不为允许放货(now_steps_type!=4)"; - //logServer.deviceExecuteLog(this.device_code, "", "", "未反馈电气信号原因:当前步骤不为允许放货(now_steps_type!=4)"); } } else { if (this.getNow_steps_type() == 4) { @@ -937,10 +910,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i if (this.getNow_steps_type() == 4) { this.writing("to_command", "4"); this.setNow_steps_type(5); - } else { - //logServer.deviceExecuteLog(this.device_code, "", "", "未反馈电气信号原因:当前步骤不为允许放货(now_steps_type!=4)"); } - } } else { if (this.getNow_steps_type() == 4) { @@ -965,20 +935,12 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i Instruction inst2 = checkInst(); if (inst2 != null) { if (StrUtil.equals(inst2.getInstruction_status(), "1")) { - TaskDto taskDto = taskserver.findByCode(inst2.getTask_code()); - String next_device_code = inst2.getNext_device_code(); - //String start_device_code = taskDto.getStart_device_code(); - //Device startDevice = deviceAppService.findDeviceByCode(start_device_code); Device nextDevice = deviceAppService.findDeviceByCode(next_device_code); HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; LampThreecolorDeviceDriver lampThreecolorDeviceDriver; -// if (startDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { -// hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startDevice.getDeviceDriver(); -// hongXiangConveyorDeviceDriver.writing("to_close_door", "1"); -// } if (nextDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextDevice.getDeviceDriver(); hongXiangConveyorDeviceDriver.writing("to_close_door", "1"); @@ -994,8 +956,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i if (nextDevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextDevice.getDeviceDriver(); -// hongXiangConveyorDeviceDriver.writing("to_close_door", "1"); - if (!StrUtil.startWith(taskDto.getTask_code(), "-")) { if (ObjectUtil.isNotEmpty(nextDevice.getExtraValue().get("link_three_lamp"))) { String lamp = nextDevice.getExtraValue().get("link_three_lamp").toString(); From 0bd35e99bde29e9fee95e62c0498efcd7fd73332 Mon Sep 17 00:00:00 2001 From: yanps Date: Thu, 1 Feb 2024 14:48:42 +0800 Subject: [PATCH 2/2] =?UTF-8?q?add:=20ACS=E4=B8=8ELMS=E7=9A=84=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=97=A5=E5=BF=97=E6=B7=BB=E5=8A=A0=E5=88=B0Lucene?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nl/acs/agv/server/XianGongAgvService.java | 7 +- .../server/impl/XianGongAgvServiceImpl.java | 125 ++++++++---------- .../service/impl/DeviceServiceImpl.java | 4 + .../agv/xg_agv_car/XgAgvCarDeviceDriver.java | 2 +- .../StandardStackerDeviceDriver.java | 5 +- .../wms/service/impl/AcsToWmsServiceImpl.java | 26 +++- .../wms/service/impl/WmsToAcsServiceImpl.java | 16 ++- .../service/impl/InstructionServiceImpl.java | 21 ++- .../lucene/service/dto/LuceneLogDto.java | 11 ++ .../src/views/monitor/log/search.vue | 2 +- .../src/views/monitor/lucene/index.vue | 20 +-- 11 files changed, 142 insertions(+), 97 deletions(-) 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 a0a3d1c72..b252885c3 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 @@ -78,7 +78,7 @@ public interface XianGongAgvService { public HttpResponse sendOrderSequencesToXZ(Instruction inst) throws Exception; /** - * 添加 + * 追加运单 * @param inst * @return * @throws Exception @@ -109,11 +109,6 @@ public interface XianGongAgvService { */ JSONObject xgAGVWaitPointRequest(JSONObject requestParam); - /** - * 运单号查询运单状态 - */ - public HttpResponse selectOrderByInstCode(String instCode); - /** * 查询场景中指定机器人信息 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 2472995e7..630d92e0f 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 @@ -245,46 +245,29 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { @LokiLog(type = LokiLogType.AGV) @Override public HttpResponse sendOrderSequencesToXZ(Instruction inst) throws Exception { - /*JSONObject jo = new JSONObject(); - jo.put("intendedVehicle", ""); - jo.put("category", ""); - jo.put("failureFatal", false); - jo.put("complete", false); - JSONArray transports = new JSONArray(); - JSONObject orderjo = new JSONObject(); - orderjo.put("name", inst.getInstruction_code()); - orderjo.put("order", createOrederData(inst, CommonFinalParam.ONE)); - transports.add(orderjo); - jo.put("transports", transports); - - JSONArray ja1 = new JSONArray(); - JSONObject jo1 = new JSONObject(); - jo1.put("key", ""); - jo1.put("value", ""); - ja1.add(jo1); - jo.put("properties", ja1); - log.info("任务号:{},指令号{},下发agv订单序列参数:{}", inst.getTask_code(), inst.getInstruction_code(), jo.toString());*/ - 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", createBlocksData(inst)); + //运单优先级 jo.put("priority", inst.getPriority()); - log.info("任务号:{},指令号{},下发agv订单序列参数:{}", inst.getTask_code(), inst.getInstruction_code(), jo.toString()); + log.info("任务号:{},指令号{},下发agv订单序列参数:{}", inst.getTask_code(), inst.getInstruction_code(), 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 + "/api/route/orderSequences/" + inst.getTask_code(); + agvurl = agvurl + ":" + agvport + "/setOrder"; + log.info(agvurl); HttpResponse result = HttpRequest.post(agvurl) //表单内容 .body(String.valueOf(jo)) //超时,毫秒 .timeout(20000) .execute(); - log.info(agvurl); log.info("任务号:{},指令号{},状态{},下发agv订单序列反馈:{}", inst.getTask_code(), inst.getInstruction_code(), result.getStatus(), result.body()); return result; @@ -294,41 +277,57 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { } /** - * 下发运单 + * 下发动作块信号 + * * @param inst * @return */ public JSONArray createBlocksData(Instruction inst) { JSONArray ja = new JSONArray(); - sendStartDeviceOrder(ja,inst.getStart_device_code(), inst.getStart_point_code(),inst.getInstruction_code()); - sendEndDeviceOrder(ja,inst.getStart_device_code(),inst.getInstruction_code(),inst.getNext_point_code(),inst.getNext_device_code()); - if(StrUtil.isNotEmpty(inst.getStart_device_code2())){ - sendStartDeviceOrder(ja,inst.getStart_device_code2(), inst.getStart_point_code2(),inst.getInstruction_code()); + String instruction_code = inst.getInstruction_code(); + String start_device_code = inst.getStart_device_code(); + String start_point_code = inst.getStart_point_code(); + String next_device_code = inst.getNext_device_code(); + String next_point_code = inst.getNext_point_code(); + sendStartDeviceOrder(ja, start_device_code, start_point_code, instruction_code); + sendEndDeviceOrder(ja, start_device_code, instruction_code, next_point_code, next_device_code); + String start_device_code2 = inst.getStart_device_code2(); + String start_point_code2 = inst.getStart_point_code2(); + if (StrUtil.isNotEmpty(start_device_code2)) { + sendStartDeviceOrder(ja, start_device_code2, start_point_code2, instruction_code); } - if(StrUtil.isNotEmpty(inst.getNext_device_code2())){ - sendEndDeviceOrder(ja,inst.getNext_device_code2(),inst.getInstruction_code(),inst.getNext_point_code2(),inst.getNext_device_code2()); + String next_device_code2 = inst.getNext_device_code2(); + String next_point_code2 = inst.getNext_point_code2(); + if (StrUtil.isNotEmpty(next_device_code2)) { + sendEndDeviceOrder(ja, start_device_code2, instruction_code, next_device_code2, next_point_code2); } return ja; } /** - * 下发取货 - * @param device_code - * @param instCode + * 下发取货信号 + * @param ja + * @param pointCode 起始点位 + * @param device_code 起始设备 + * @param instCode 指令号 */ - public void sendStartDeviceOrder(JSONArray ja,String pointCode, String device_code,String instCode){ - + public void sendStartDeviceOrder(JSONArray ja, String pointCode, String device_code, String instCode) { Device startDevice = deviceAppService.findDeviceByCode(device_code); //忽略取货校验 if ("true".equals(startDevice.getExtraValue().get("ignore_pickup_check"))) { //取货前等待 JSONObject jo = new JSONObject(); + //动作块id jo.put("blockId", IdUtil.simpleUUID()); + //目的地名称 jo.put("location", pointCode + "INGET"); + //执行脚本 jo.put("operation", "script"); jo.put("id", pointCode + "INGET"); + //通信脚本,动作前后与现场设备交互的场景 jo.put("script_name", "userpy/interact.py"); JSONObject script_args = new JSONObject(); + //更改为现场设备IP及PORT script_args.put("addr", addr); JSONObject data = new JSONObject(); JSONObject reach = new JSONObject(); @@ -340,7 +339,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { jo.put("script_args", script_args); ja.add(jo); } - + //将货物顶起来 JSONObject jo1 = new JSONObject(); jo1.put("blockId", IdUtil.simpleUUID()); jo1.put("location", pointCode); @@ -368,11 +367,14 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { } /** - * 下发放货 - * @param device_code - * @param instCode + * 下发放货信号 + * @param ja + * @param device_code 起始设备 + * @param instCode 指令号 + * @param pointCode 终点点位 + * @param nextDeviceCode 终点设备 */ - 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) { Device nextDevice = deviceAppService.findDeviceByCode(nextDeviceCode); //忽略放货校验 if ("true".equals(nextDevice.getExtraValue().get("ignore_release_check"))) { @@ -398,24 +400,27 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { //放货前下发旋转角度 JSONObject json1 = new JSONObject(); - AcsPointAngle acsPointAngleDto = acsPointAngleService.findByCode(device_code,nextDeviceCode); - if (ObjectUtil.isNotEmpty(acsPointAngleDto)){ + 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"); + 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); + 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"))) { //放货完成等待 @@ -523,8 +528,8 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { Device startdevice = deviceAppService.findDeviceByCode(startAddress); Device nextdevice = deviceAppService.findDeviceByCode(nextAddress); break; - default: - break; + default: + break; } orderjo.put("destinations", ja); @@ -711,35 +716,13 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { throw new BadRequestException("请求失败,IN OUT 站点错误!"); } - @Override - public HttpResponse selectOrderByInstCode(String instCode) { - if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) { - String agvurl =paramService.findByCode(AcsConfig.AGVURL).getValue(); - String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue(); - - com.alibaba.fastjson.JSONObject param = new com.alibaba.fastjson.JSONObject(); - param.put("id", instCode); - param.put("disableVehicle", false); - agvurl = agvurl + ":" + agvport + "/" + instCode; - log.info("根据运单号查询运单状态的请求:{}", agvurl); - HttpResponse result = HttpRequest.post(agvurl) - .body(param.toJSONString()) - .timeout(20000)//超时,毫秒 - .execute(); - log.info("根据运单号查询运单状态的请求反馈:{}", result); - return result; - } else { - return null; - } - } - @Override public HttpResponse getRobotInfo(String robotCode) { if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) { - String agvurl =paramService.findByCode(AcsConfig.AGVURL).getValue(); + String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue(); String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue(); - agvurl = agvurl + ":" + agvport + "/"+ " robotsStatus?vehicles=" + robotCode; + agvurl = agvurl + ":" + agvport + "/" + " robotsStatus?vehicles=" + robotCode; log.info("根据指定机器人查询状态的请求:{}", agvurl); HttpResponse result = HttpRequest.get(agvurl) .timeout(20000)//超时,毫秒 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 6ad4e3b4c..732c2b7ed 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 @@ -26,6 +26,7 @@ import org.nl.acs.device.enums.DeviceType; import org.nl.acs.device.service.mapper.DeviceExtraMapper; import org.nl.acs.device.domain.DeviceRunpoint; import org.nl.acs.device.service.mapper.DeviceRunpointMapper; +import org.nl.acs.device_driver.stacker.standard_stacker.StandardStackerDeviceDriver; import org.nl.acs.device_driver.two_conveyor.oven_manipulator.OvenGantryManipulatorDeviceDriver; import org.nl.acs.device_driver.two_conveyor.slit_two_manipulator.SlitTwoManipulatorDeviceDriver; import org.nl.acs.monitor.DeviceStageMonitor; @@ -1021,6 +1022,9 @@ public class DeviceServiceImpl extends CommonServiceImpl i } else if (device.getDeviceDriver() instanceof DeviceStageMonitor) { DeviceStageMonitor deviceStageMonitor = (DeviceStageMonitor) device.getDeviceDriver(); deviceStageMonitor.setDeviceStatus(form); + }else if (device.getDeviceDriver() instanceof StandardStackerDeviceDriver) { + StandardStackerDeviceDriver standardStackerDeviceDriver = (StandardStackerDeviceDriver) device.getDeviceDriver(); + standardStackerDeviceDriver.setDeviceStatus(form); } } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/xg_agv_car/XgAgvCarDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/xg_agv_car/XgAgvCarDeviceDriver.java index 436891663..e83dd157e 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/xg_agv_car/XgAgvCarDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/xg_agv_car/XgAgvCarDeviceDriver.java @@ -31,7 +31,7 @@ import java.util.Date; /** - * 普通站点仙工AGV + * 仙工AGV */ @Slf4j @Data 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 2df4b6367..781718470 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 @@ -725,7 +725,10 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme @Override public JSONObject getDeviceStatusName() throws Exception { - return null; + JSONObject jsonObject = new JSONObject(); + jsonObject.put("device_code", this.getDevice().getDevice_code()); + jsonObject.put("is_click", true); + return jsonObject; } @Override 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 0e3cb2320..c8ffead76 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 @@ -28,6 +28,8 @@ import org.nl.acs.instruction.domain.Instruction; import org.nl.acs.log.service.DeviceExecuteLogService; import org.nl.acs.task.service.TaskService; import org.nl.acs.task.service.dto.TaskDto; +import org.nl.config.lucene.service.LuceneExecuteLogService; +import org.nl.config.lucene.service.dto.LuceneLogDto; import org.nl.system.service.param.ISysParamService; import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; @@ -55,6 +57,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { @Autowired DeviceExecuteLogService logServer; + @Autowired + private LuceneExecuteLogService luceneLogService; + public String token; @@ -92,6 +97,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { type = "error"; } log.info("applyTaskToWms-----输出参数{}", result2.body()); + LuceneLogDto luceneLogDto = new LuceneLogDto("applyTaskToWms", String.valueOf(result2.getStatus()), + JSON.toJSONString(jo), String.valueOf(result2.body()), "ACS向LMS申请生箔按钮任务"); + luceneLogService.interfaceExecuteLog(luceneLogDto); return result2.body(); } finally { @@ -183,6 +191,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { map.put("message", e.getMessage()); return JSONObject.toJavaObject(map, ApplyGreenFoilButtonResponse.class); } + LuceneLogDto luceneLogDto = new LuceneLogDto("ApplyGreenFoilButtonRequest", String.valueOf(applyGreenFoilButtonResponse.getCode()), + JSON.toJSONString(param), String.valueOf(applyGreenFoilButtonResponse.getMessage()), "ACS向LMS申请生箔按钮任务"); + luceneLogService.interfaceExecuteLog(luceneLogDto); } return applyGreenFoilButtonResponse; } finally { @@ -215,6 +226,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { map.put("message", e.getMessage()); return JSONObject.toJavaObject(map, BlankingButtonResponse.class); } + LuceneLogDto luceneLogDto = new LuceneLogDto("BlankingButtonRequest", String.valueOf(blankingButtonResponse.getCode()), + JSON.toJSONString(param), String.valueOf(blankingButtonResponse.getMessage()), "ACS向LMS申请表处下料位按钮任务"); + luceneLogService.interfaceExecuteLog(luceneLogDto); } return blankingButtonResponse; } finally { @@ -248,6 +262,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { map.put("message", e.getMessage()); return JSONObject.toJavaObject(map, ApplyPlugPullSitResponse.class); } + LuceneLogDto luceneLogDto = new LuceneLogDto("ApplyPlugPullSiteRequest", String.valueOf(applyPlugPullSitResponse.getCode()), + JSON.toJSONString(param), String.valueOf(applyPlugPullSitResponse.getMessage()), "ACS向LMS申请套管"); + luceneLogService.interfaceExecuteLog(luceneLogDto); } return applyPlugPullSitResponse; } finally { @@ -281,6 +298,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { map.put("message", e.getMessage()); return JSONObject.toJavaObject(map, ApplyManipulatorActionResponse.class); } + LuceneLogDto luceneLogDto = new LuceneLogDto("ApplyManipulatorActionRequest", String.valueOf(applyManipulatorActionResponse.getCode()), + JSON.toJSONString(param), String.valueOf(applyManipulatorActionResponse), "ACS向LMS申请反馈"); + luceneLogService.interfaceExecuteLog(luceneLogDto); } return applyManipulatorActionResponse; } finally { @@ -303,7 +323,11 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { .execute() .body(); log.info("gccQueryStationState - 响应参数{}", responseBody); - + JSONObject jsonObject = JSONObject.parseObject(responseBody); + LuceneLogDto luceneLogDto = new LuceneLogDto("gccQueryStationState", String.valueOf(jsonObject.get("code")), + JSON.toJSONString("StartStationCode=" + inst.getStart_point_code() + "&EndStationCode=" + inst.getNext_point_code()), + String.valueOf(jsonObject), "ACS查询站点有无货状态"); + luceneLogService.interfaceExecuteLog(luceneLogDto); return JSONObject.parseObject(responseBody); } catch (Exception e) { JSONObject result = new JSONObject(); 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 242dc8197..8eb0f533f 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 @@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import lombok.Builder; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.nl.acs.device.domain.Device; @@ -28,7 +29,11 @@ import org.nl.acs.ext.wms.service.WmsToAcsService; import org.nl.acs.opc.DeviceAppService; import org.nl.acs.storage_cell.domain.StorageCell; import org.nl.acs.storage_cell.service.mapper.StorageCellMapper; +import org.nl.common.enums.LogTypeEnum; import org.nl.common.exception.BadRequestException; +import org.nl.config.lucene.service.LuceneExecuteLogService; +import org.nl.config.lucene.service.dto.LuceneLogDto; +import org.nl.config.lucene.service.impl.LuceneExecuteLogServiceImpl; import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; @@ -48,6 +53,9 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { @Autowired private DeviceAppService deviceAppService; + @Autowired + private LuceneExecuteLogService luceneExecuteLogService; + private String log_file_type = "log_file_type"; private String log_type = "LMS请求ACS"; @@ -118,6 +126,9 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { } response.setCode(200); response.setMessage("success"); + LuceneLogDto luceneLogDto = new LuceneLogDto("putAction", String.valueOf(response.getCode()), + jsonObject, String.valueOf(response), "LMS下发动作"); + luceneExecuteLogService.interfaceExecuteLog(luceneLogDto); log.info("putAction--------------:输出参数:" + response); return response; } finally { @@ -156,7 +167,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { String parent_device_code = data.getString("device_code"); String device_code = ""; LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.like(StringUtils.isNotBlank(parent_device_code), StorageCell::getParent_storage_code, parent_device_code); + wrapper.in(StringUtils.isNotBlank(parent_device_code), StorageCell::getParent_storage_code, parent_device_code); StorageCell storageCell = storageCellMapper.selectOne(wrapper); final JSONObject device_json = (JSONObject) JSON.toJSON(storageCell); if (!ObjectUtil.isEmpty(device_json)) { @@ -280,6 +291,9 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { resultJson.put("status", HttpStatus.OK.value()); resultJson.put("message", "操作成功"); resultJson.put("data", backja); + LuceneLogDto luceneLogDto = new LuceneLogDto("queryDevice", String.valueOf(resultJson.get("status")), + jsonObject, String.valueOf(resultJson), "LMS查询设备状态"); + luceneExecuteLogService.interfaceExecuteLog(luceneLogDto); return resultJson; } finally { MDC.remove(log_file_type); 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 2de58000d..19f56d5ae 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 @@ -445,12 +445,23 @@ public class InstructionServiceImpl extends CommonServiceImpl - + - - + + - - - - - - - - + + + + + + + +