diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/AcsConfig.java b/acs/nladmin-system/src/main/java/org/nl/acs/AcsConfig.java index aba4594..6b05bc5 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/AcsConfig.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/AcsConfig.java @@ -15,15 +15,13 @@ public interface AcsConfig { //撤销任务检查 String CANCELTASKCHECK = "cancelTaskCheck"; //二楼agv系统接口地址 - String AGVURL = "agvurl"; + String AGVURL2 = "agvurl2"; //一楼agv系统接口地址 - String AGVURL2 = "agvurl"; - //双工AGV系统端口 + String AGVURL = "agvurl"; + //AGV系统端口 String AGVPORT = "agvport"; - //单工agv系统接口地址 - String ONEAGVURL = "oneagvurl"; - //单工AGV系统端口 - String ONEAGVPORT = "oneagvport"; + //二楼AGV系统端口 + String AGVPORT2 = "agvport2"; //指定AGV系统 String AGVTYPE = "agvType"; //WMS系统接口地址 diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/ZheDaAgvServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/ZheDaAgvServiceImpl.java index 24bfc0f..0885e94 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/ZheDaAgvServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/ZheDaAgvServiceImpl.java @@ -3,6 +3,7 @@ package org.nl.acs.agv.server.impl; 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; @@ -15,6 +16,7 @@ import org.nl.acs.device_driver.basedriver.empty_vehicle_stacking_position.Empty import org.nl.acs.device_driver.basedriver.hailiang_smart_plc_test.HailiangSmartplcTestDeviceDriver; import org.nl.acs.device_driver.basedriver.haokai_auto_conveyor.HaoKaiAutoConveyorDeviceDriver; import org.nl.acs.device_driver.basedriver.paint_conveyor.PaintConveyorDeviceDriver; +import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.dto.Instruction; import org.nl.acs.log.LokiLog; @@ -22,6 +24,8 @@ import org.nl.acs.log.LokiLogType; import org.nl.acs.opc.Device; import org.nl.acs.opc.DeviceAppService; import org.nl.acs.opc.DeviceAppServiceImpl; +import org.nl.acs.task.service.TaskService; +import org.nl.acs.task.service.dto.TaskDto; import org.nl.modules.system.service.ParamService; import org.nl.modules.wql.util.SpringContextHolder; import org.springframework.stereotype.Service; @@ -37,11 +41,14 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService { JSONObject jo = new JSONObject(); String start_point_code = inst.getStart_point_code(); String next_point_code = inst.getNext_point_code(); - //1、叠盘架追加任务;2、养生区需要追加任务,在缓存点等待3、二楼普通任务4、一楼普通任务 + //1楼AGV普通任务 + //2楼AGV普通任务 + //2楼AGV起点追加任务 + //2楼AGV终点追加任务 String task_type = inst.getInstruction_type(); jo.put("deadline", AgvUtil.getNextDay(1)); //判断是否追加任务 - if (task_type.equals("2") || task_type.equals("1")) { + if (task_type.equals("3") || task_type.equals("4")) { jo.put("complete", "false"); } else { jo.put("complete", "true"); @@ -49,31 +56,32 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService { jo.put("task_code", inst.getInstruction_code()); //根据任务,下发指令类型 JSONArray destinations = new JSONArray(); - if (task_type.equals("1")) { + if (task_type.equals("3")) { destinations.add(destination(start_point_code, "Wait", "5", "1")); + } else if (task_type.equals("4")) { + destinations.add(destination(start_point_code, "Load", "1", "1")); + destinations.add(destination(next_point_code, "Wait", "5", "1")); } else { destinations.add(destination(start_point_code, "Load", "1", "1")); - if (task_type.equals("2")) { - destinations.add(destination(next_point_code, "Wait", "5", "1")); - } else { - destinations.add(destination(next_point_code, "Unload", "5", "1")); - } + destinations.add(destination(next_point_code, "Unload", "1", "1")); } + jo.put("destinations", destinations); if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) { - String url = ""; String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue(); String agvurl2 = paramService.findByCode(AcsConfig.AGVURL2).getValue(); String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue(); + String agvport2 = paramService.findByCode(AcsConfig.AGVPORT2).getValue(); + + //不同楼层下发不同的agv系统 - if (task_type.equals("8")) { - url = agvurl2; + if (task_type.equals("1")) { + agvurl = agvurl + ":" + agvport + "/v1/transportOrders/" + inst.getInstruction_code(); } else { - url = agvurl; + agvurl = agvurl2 + ":" + agvport2 + "/v1/transportOrders/" + inst.getInstruction_code(); } - url = url + ":" + agvport + "v1/transportOrders/" + inst.getInstruction_code(); - log.info("下发agv任务请求:{}", url); + log.info("下发agv任务请求:{}", agvurl); HttpResponse result = HttpRequest.post(agvurl) .body(String.valueOf(jo))//表单内容 @@ -92,16 +100,17 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService { public HttpResponse queryAgvInstStatus(String type) { if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) { String agvurl = ""; + String agvport = ""; if (type.equals("1")) { agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue(); + agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue(); } if (type.equals("2")) { agvurl = paramService.findByCode(AcsConfig.AGVURL2).getValue(); + agvport = paramService.findByCode(AcsConfig.AGVPORT2).getValue(); } - String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue(); - - agvurl = agvurl + ":" + agvport + "/transportOrders"; + agvurl = agvurl + ":" + agvport + "/v1/transportOrders"; HttpResponse result = HttpRequest.get(agvurl) .timeout(20000)//超时,毫秒 .execute(); @@ -128,8 +137,11 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService { address = address.substring(0, address.indexOf("-")); } InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl"); - Instruction inst = instructionService.findByCodeFromCache(jobno); + TaskService taskService = SpringContextHolder.getBean("taskServiceImpl"); + AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl"); + Instruction inst = instructionService.findByCodeFromCache(jobno); + TaskDto task = taskService.findByCode(inst.getTask_code()); DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); Device addressdevice = appService.findDeviceByCode(address); @@ -233,35 +245,43 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService { JSONArray destinations = new JSONArray(); String inst_type = inst.getInstruction_type(); //如果任务类型为1,在点位进行等待,则查询当前叠盘位的数量,取当前数量的层数进行追加任务 - if ("1".equals(inst_type)) { - emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) addressdevice.getDeviceDriver(); - int current_num = emptyVehicleStackingPositionDeviceDriver.getNumber(); - if (current_num > 12) { - log.info("当前叠盘架:" + jobno + "已放满!"); - return null; - } - String start_point_code = inst.getStart_point_code(); - String next_point_code = inst.getNext_point_code(); - start_point_code = start_point_code + "." + (current_num + 1); - destinations.add(destination(start_point_code, "Load", "1", "1")); - destinations.add(destination(next_point_code, "Unload", "1", "1")); +// if ("1".equals(inst_type)) { +// emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) addressdevice.getDeviceDriver(); +// int current_num = emptyVehicleStackingPositionDeviceDriver.getNumber(); +// if (current_num > 12) { +// log.info("当前叠盘架:" + jobno + "已放满!"); +// return null; +// } +// String start_point_code = inst.getStart_point_code(); +// String next_point_code = inst.getNext_point_code(); +// start_point_code = start_point_code + "." + (current_num + 1); +// destinations.add(destination(start_point_code, "Load", "1", "1")); +// destinations.add(destination(next_point_code, "Unload", "1", "1")); +// +// } + String resp = acsToWmsService.requestTaskAgain(address,task.getExt_task_id(),inst.getVehicle_code()); + JSONObject respjson = JSONObject.parseObject(resp); + + if(StrUtil.equals(inst.getInstruction_type(),"3")){ + //2楼AGV起点追加任务 + String start_device_code = respjson.getString("device_code"); + String next_device_code = inst.getNext_device_code(); + destinations.add(destination(start_device_code, "load", "1", "1")); + destinations.add(destination(next_device_code, "Unload", "1", "1")); + + } else if(StrUtil.equals(inst.getInstruction_type(),"4")){ + //2楼AGV终点追加任务 + String next_device_code = respjson.getString("device_code"); + destinations.add(destination(next_device_code, "Unload", "1", "1")); } - //如果任务类型为2,在点位进行等待,则调用LMS的货位申请接口 - if ("2".equals(inst_type)) { - String next_point_code = ""; - //调用LMS接口 - - - destinations.add(destination(next_point_code, "Unload", "5", "1")); - } jo.put("destinations", destinations); String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue(); String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue(); - String url = agvurl + ":" + agvport + "addDestinations"; + String url = agvurl + ":" + agvport + "/addDestinations"; log.info("下发agv任务请求:{}", url); HttpResponse result = HttpRequest.post(url) diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/cargo_lift_conveyor/CargoLiftConveyorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/cargo_lift_conveyor/CargoLiftConveyorDeviceDriver.java index 2a8cb33..2b566d8 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/cargo_lift_conveyor/CargoLiftConveyorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/cargo_lift_conveyor/CargoLiftConveyorDeviceDriver.java @@ -4,6 +4,7 @@ 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 com.alibaba.fastjson.JSONObject; import lombok.Data; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -20,6 +21,7 @@ import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; 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; @@ -39,7 +41,7 @@ import java.util.*; @Slf4j @Data @RequiredArgsConstructor -public class CargoLiftConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver { +public class CargoLiftConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor { protected ItemProtocol itemProtocol = new ItemProtocol(this); @Autowired @@ -310,4 +312,54 @@ public class CargoLiftConveyorDeviceDriver extends AbstractOpcDeviceDriver imple ReadUtil.write(itemMap, server); } + + @Override + public JSONObject getDeviceStatusName() { + JSONObject jo = new JSONObject(); + String mode = ""; + String action = ""; + String move = ""; + if (this.getMode() == 0) { + mode = "未联机"; + } else if (this.getMode() == 1) { + mode = "单机"; + } else if (this.getMode() == 2) { + mode = "联机"; + } else if (this.getMode() == 3) { + mode = "运行中"; + } + + if (this.getAction() == 0) { + action = "禁止取放"; + } else if (this.getAction() == 1) { + action = "允许取货"; + } else if (this.getAction() == 2) { + action = "允许放货"; + } else if (this.getAction() == 3) { + action = "允许取放"; + } + + + if (this.getMove() == 0) { + move = "无货"; + } else if (this.getMove() == 1) { + move = "有货"; + } else if (this.getMove() == 2) { + move = "有托盘有货"; + } + jo.put("device_name", this.getDevice().getDevice_name()); + jo.put("mode", mode); + jo.put("move", move); + jo.put("action", action); + jo.put("isOnline", this.getIsonline()); + jo.put("error", this.getError()); + jo.put("isError", this.getIserror()); + jo.put("task", this.getTask()); + return jo; + } + + @Override + public void setDeviceStatus(JSONObject data) { + + } } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/empty_vehicle_stacking_position/EmptyVehicleStackingPositionDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/empty_vehicle_stacking_position/EmptyVehicleStackingPositionDeviceDriver.java index 8fdbcd6..a02e553 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/empty_vehicle_stacking_position/EmptyVehicleStackingPositionDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/empty_vehicle_stacking_position/EmptyVehicleStackingPositionDeviceDriver.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.basedriver.empty_vehicle_stacking_position; +import com.alibaba.fastjson.JSONObject; import lombok.Data; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -15,6 +16,7 @@ import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; 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; @@ -35,7 +37,7 @@ import java.util.Map; @Slf4j @Data @RequiredArgsConstructor -public class EmptyVehicleStackingPositionDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver { +public class EmptyVehicleStackingPositionDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor { protected ItemProtocol itemProtocol = new ItemProtocol(this); @Autowired DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class); @@ -191,4 +193,46 @@ public class EmptyVehicleStackingPositionDeviceDriver extends AbstractOpcDeviceD itemMap.put(to_command, value); ReadUtil.write(itemMap, server); } + + @Override + public JSONObject getDeviceStatusName() { + JSONObject jo = new JSONObject(); + String mode = ""; + String action = ""; + String move = ""; + if (this.getMode() == 0) { + mode = "未联机"; + } else if (this.getMode() == 1) { + mode = "单机"; + } else if (this.getMode() == 2) { + mode = "联机"; + } else if (this.getMode() == 3) { + mode = "运行中"; + } + + 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); + } + jo.put("device_name", this.getDevice().getDevice_name()); + jo.put("mode", mode); + jo.put("move", move); + jo.put("action", action); + jo.put("isOnline", this.getIsonline()); + jo.put("error", this.getError()); + jo.put("isError", this.getIserror()); + jo.put("task", this.getTask()); + return jo; + } + + @Override + public void setDeviceStatus(JSONObject data) { + + } } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_smart_plc_test/HailiangSmartplcTestDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_smart_plc_test/HailiangSmartplcTestDeviceDriver.java index 481d7b6..c18c2d9 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_smart_plc_test/HailiangSmartplcTestDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_smart_plc_test/HailiangSmartplcTestDeviceDriver.java @@ -15,6 +15,7 @@ import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; import org.nl.acs.instruction.service.InstructionService; 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; @@ -34,7 +35,7 @@ import java.util.Map; @Slf4j @Data @RequiredArgsConstructor -public class HailiangSmartplcTestDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver { +public class HailiangSmartplcTestDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor { protected ItemProtocol itemProtocol = new ItemProtocol(this); @Autowired DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class); @@ -224,4 +225,47 @@ public class HailiangSmartplcTestDeviceDriver extends AbstractOpcDeviceDriver im itemMap.put(to_command, value); ReadUtil.write(itemMap, server); } + + @Override + public JSONObject getDeviceStatusName() { + JSONObject jo = new JSONObject(); + String mode = ""; + String action = ""; + String move = ""; + if (this.getMode() == 0) { + mode = "未联机"; + } else if (this.getMode() == 1) { + mode = "单机"; + } else if (this.getMode() == 2) { + mode = "联机"; + } else if (this.getMode() == 3) { + mode = "运行中"; + } + + 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); + } + jo.put("device_name", this.getDevice().getDevice_name()); + jo.put("mode", mode); + jo.put("move", move); + jo.put("action", action); + jo.put("isOnline", this.getIsonline()); + jo.put("error", this.getError()); + jo.put("isError", this.getIserror()); + jo.put("task", this.getTask()); + return jo; + } + + @Override + public void setDeviceStatus(JSONObject data) { + + } + } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/haokai_auto_conveyor/HaoKaiAutoConveyorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/haokai_auto_conveyor/HaoKaiAutoConveyorDeviceDriver.java index e1a086c..08d53f3 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/haokai_auto_conveyor/HaoKaiAutoConveyorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/haokai_auto_conveyor/HaoKaiAutoConveyorDeviceDriver.java @@ -18,6 +18,7 @@ import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; 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; @@ -38,7 +39,7 @@ import java.util.Map; @Slf4j @Data @RequiredArgsConstructor -public class HaoKaiAutoConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver { +public class HaoKaiAutoConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver , DeviceStageMonitor { protected ItemProtocol itemProtocol = new ItemProtocol(this); @Autowired DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class); @@ -233,4 +234,47 @@ public class HaoKaiAutoConveyorDeviceDriver extends AbstractOpcDeviceDriver impl ReadUtil.write(itemMap, server); } + + @Override + public JSONObject getDeviceStatusName() { + JSONObject jo = new JSONObject(); + String mode = ""; + String action = ""; + String move = ""; + if (this.getMode() == 0) { + mode = "未联机"; + } else if (this.getMode() == 1) { + mode = "单机"; + } else if (this.getMode() == 2) { + mode = "联机"; + } else if (this.getMode() == 3) { + mode = "运行中"; + } + + 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); + } + jo.put("device_name", this.getDevice().getDevice_name()); + jo.put("mode", mode); + jo.put("move", move); + jo.put("action", action); + jo.put("isOnline", this.getIsonline()); + jo.put("error", this.getError()); + jo.put("isError", this.getIserror()); + jo.put("task", this.getTask()); + return jo; + } + + @Override + public void setDeviceStatus(JSONObject data) { + + } + } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paint_conveyor/PaintConveyorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paint_conveyor/PaintConveyorDeviceDriver.java index 9ad35d0..a90ec80 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paint_conveyor/PaintConveyorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paint_conveyor/PaintConveyorDeviceDriver.java @@ -15,6 +15,7 @@ import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; import org.nl.acs.instruction.service.InstructionService; 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; @@ -34,7 +35,7 @@ import java.util.Map; @Slf4j @Data @RequiredArgsConstructor -public class PaintConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver { +public class PaintConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor { protected ItemProtocol itemProtocol = new ItemProtocol(this); @Autowired DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class); @@ -257,4 +258,46 @@ public class PaintConveyorDeviceDriver extends AbstractOpcDeviceDriver implement itemMap.put(to_command, value); ReadUtil.write(itemMap, server); } + + @Override + public JSONObject getDeviceStatusName() { + JSONObject jo = new JSONObject(); + String mode = ""; + String action = ""; + String move = ""; + if (this.getMode() == 0) { + mode = "未联机"; + } else if (this.getMode() == 1) { + mode = "单机"; + } else if (this.getMode() == 2) { + mode = "联机"; + } else if (this.getMode() == 3) { + mode = "运行中"; + } + + 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); + } + jo.put("device_name", this.getDevice().getDevice_name()); + jo.put("mode", mode); + jo.put("move", move); + jo.put("action", action); + jo.put("isOnline", this.getIsonline()); + jo.put("error", this.getError()); + jo.put("isError", this.getIserror()); + jo.put("task", this.getTask()); + return jo; + } + + @Override + public void setDeviceStatus(JSONObject data) { + + } } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control/StandardCoveyorControlDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control/StandardCoveyorControlDeviceDriver.java index 0d69401..351e8e3 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control/StandardCoveyorControlDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control/StandardCoveyorControlDeviceDriver.java @@ -17,6 +17,7 @@ import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.dto.Instruction; +import org.nl.acs.monitor.DeviceStageMonitor; import org.nl.acs.opc.Device; import org.nl.acs.opc.DeviceAppService; import org.nl.acs.opc.WcsConfig; @@ -42,7 +43,7 @@ import java.util.Map; @Slf4j @Data @RequiredArgsConstructor -public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver { +public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor { protected ItemProtocol itemProtocol = new ItemProtocol(this); @Autowired DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class); @@ -435,4 +436,46 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver public synchronized boolean apply_InEmpty() throws Exception { return false; } + + @Override + public JSONObject getDeviceStatusName() { + JSONObject jo = new JSONObject(); + String mode = ""; + String action = ""; + String move = ""; + if (this.getMode() == 0) { + mode = "未联机"; + } else if (this.getMode() == 1) { + mode = "单机"; + } else if (this.getMode() == 2) { + mode = "联机"; + } else if (this.getMode() == 3) { + mode = "运行中"; + } + + 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); + } + jo.put("device_name", this.getDevice().getDevice_name()); + jo.put("mode", mode); + jo.put("move", move); + jo.put("action", action); + jo.put("isOnline", this.getIsonline()); + jo.put("error", this.getError()); + jo.put("isError", this.getIserror()); + jo.put("task", this.getTask()); + return jo; + } + + @Override + public void setDeviceStatus(JSONObject data) { + + } } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_plcscanner/StandardCoveyorControlWithPlcScannerDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_plcscanner/StandardCoveyorControlWithPlcScannerDeviceDriver.java index 8716517..370748e 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_plcscanner/StandardCoveyorControlWithPlcScannerDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_plcscanner/StandardCoveyorControlWithPlcScannerDeviceDriver.java @@ -20,6 +20,7 @@ import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.dto.Instruction; +import org.nl.acs.monitor.DeviceStageMonitor; import org.nl.acs.opc.Device; import org.nl.acs.opc.DeviceAppService; import org.nl.acs.opc.WcsConfig; @@ -42,7 +43,7 @@ import java.util.*; @Slf4j @Data @RequiredArgsConstructor -public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver { +public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor { protected ItemProtocol itemProtocol = new ItemProtocol(this); @Autowired InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); @@ -835,5 +836,47 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp } } + @Override + public JSONObject getDeviceStatusName() { + JSONObject jo = new JSONObject(); + String mode = ""; + String action = ""; + String move = ""; + if (this.getMode() == 0) { + mode = "未联机"; + } else if (this.getMode() == 1) { + mode = "单机"; + } else if (this.getMode() == 2) { + mode = "联机"; + } else if (this.getMode() == 3) { + mode = "运行中"; + } + + 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); + } + jo.put("device_name", this.getDevice().getDevice_name()); + jo.put("mode", mode); + jo.put("move", move); + jo.put("action", action); + jo.put("isOnline", this.getIsonline()); + jo.put("error", this.getError()); + jo.put("isError", this.getIserror()); + jo.put("task", this.getTask()); + return jo; + } + + @Override + public void setDeviceStatus(JSONObject data) { + + } + } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java index c2af26a..713669c 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java @@ -72,7 +72,8 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe private Date instruction_finished_time = new Date(); private Date instruction_apply_time = new Date(); private int instruction_require_time_out = 3000; - + //当前指令 + Instruction inst = null; int heartbeat = 0; int mode = 0; int move = 0; @@ -92,7 +93,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe int last_error = 0; int last_task = 0; String last_container; - + String inst_message; String device_code; String message; @@ -132,7 +133,10 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe ScannerDeviceDriver scanner = this.getScanner(); scanner.cleanBarcode(); } - + public synchronized boolean finish_instruction() throws Exception { + instructionService.finish(inst); + return true; + } private ScannerDeviceDriver getScanner() throws Exception { String scanner_code = (String) this.getDevice().getExtraValue().get(StandardConveyorWithScannerConfig.relation_scanner); @@ -183,6 +187,21 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe if (error != last_error) { } + if (mode == 2 && move != 0 && task > 0) { + //inst_message + inst = instructionService.findByCodeFromCache(String.valueOf(task)); + if (inst != null) { + inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code(); + if (StrUtil.equals(inst.getInstruction_status(), "1") && StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) { + finish_instruction(); + } + if (StrUtil.equals(inst.getInstruction_status(), "0") && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) { + inst.setInstruction_status("1"); + instructionService.update(inst); + } + } + } + } catch (Exception var17) { return; } @@ -552,27 +571,15 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe JSONObject jo = new JSONObject(); String mode = ""; String action = ""; - String io_action = ""; String move = ""; - String status = ""; if (this.getMode() == 0) { mode = "未联机"; } else if (this.getMode() == 1) { mode = "单机"; } else if (this.getMode() == 2) { 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 = "码垛强制完成"; - } else if (this.getMode() == 9) { - mode = "工单完成"; + } else if (this.getMode() == 3) { + mode = "运行中"; } if (this.getAction() == 0) { @@ -588,17 +595,18 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe 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); } jo.put("device_name", this.getDevice().getDevice_name()); jo.put("mode", mode); jo.put("move", move); jo.put("action", action); - jo.put("status", status); - jo.put("io_action", io_action); jo.put("isOnline", this.getIsonline()); jo.put("error", this.getError()); jo.put("isError", this.getIserror()); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java index 25110f9..032f77a 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java @@ -15,6 +15,7 @@ import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.dto.Instruction; +import org.nl.acs.monitor.DeviceStageMonitor; import org.nl.acs.opc.Device; import org.nl.acs.opc.DeviceAppService; import org.nl.acs.opc.DeviceAppServiceImpl; @@ -40,7 +41,7 @@ import java.util.Map; @Slf4j @Data @RequiredArgsConstructor -public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver { +public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver , DeviceStageMonitor { protected ItemProtocol itemProtocol = new ItemProtocol(this); @Autowired InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl"); @@ -437,5 +438,45 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp } } + @Override + public JSONObject getDeviceStatusName() { + JSONObject jo = new JSONObject(); + String mode = ""; + String action = ""; + String move = ""; + if (this.getMode() == 0) { + mode = "未联机"; + } else if (this.getMode() == 1) { + mode = "单机"; + } else if (this.getMode() == 2) { + mode = "联机"; + } else if (this.getMode() == 3) { + mode = "运行中"; + } + 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); + } + jo.put("device_name", this.getDevice().getDevice_name()); + jo.put("mode", mode); + jo.put("move", move); + jo.put("action", action); + jo.put("isOnline", this.getIsonline()); + jo.put("error", this.getError()); + jo.put("isError", this.getIserror()); + jo.put("task", this.getTask()); + return jo; + } + + @Override + public void setDeviceStatus(JSONObject data) { + + } } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java index 085be85..22ffd78 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java @@ -1,6 +1,7 @@ package org.nl.acs.device_driver.basedriver.standard_ordinary_site; import cn.hutool.core.util.ObjectUtil; +import com.alibaba.fastjson.JSONObject; import lombok.Data; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -16,6 +17,7 @@ import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; 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.DeviceAppService; import org.nl.acs.route.service.RouteLineService; import org.nl.acs.task.service.TaskService; @@ -31,7 +33,7 @@ import java.util.Date; @Slf4j @Data @RequiredArgsConstructor -public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver { +public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver , DeviceStageMonitor { @Autowired DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class); @Autowired @@ -181,5 +183,47 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple } } + + @Override + public JSONObject getDeviceStatusName() { + JSONObject jo = new JSONObject(); + String mode = ""; + String action = ""; + String move = ""; + if (this.getMode() == 0) { + mode = "未联机"; + } else if (this.getMode() == 1) { + mode = "单机"; + } else if (this.getMode() == 2) { + mode = "联机"; + } else if (this.getMode() == 3) { + mode = "运行中"; + } + + 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); + } + jo.put("device_name", this.getDevice().getDevice_name()); + jo.put("mode", mode); + jo.put("move", move); + jo.put("action", action); + jo.put("isOnline", true); + jo.put("error", this.getError()); + jo.put("isError", this.getIserror()); + return jo; + } + + + @Override + public void setDeviceStatus(JSONObject data) { + + } } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_scanner/StandardScannerDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_scanner/StandardScannerDeviceDriver.java index 28f4035..d36492a 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_scanner/StandardScannerDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_scanner/StandardScannerDeviceDriver.java @@ -1,11 +1,13 @@ package org.nl.acs.device_driver.basedriver.standard_scanner; import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSONObject; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.nl.acs.device_driver.DeviceDriver; import org.nl.acs.device_driver.ScannerDeviceDriver; import org.nl.acs.device_driver.driver.AbstractDeviceDriver; +import org.nl.acs.monitor.DeviceStageMonitor; import org.nl.acs.socket.SocketConfig; import org.nl.acs.udw.UnifiedDataAccessor; import org.nl.acs.udw.UnifiedDataAccessorFactory; @@ -15,7 +17,7 @@ import org.nl.acs.udw.UnifiedDataAccessorFactory; */ @Slf4j @Data -public class StandardScannerDeviceDriver extends AbstractDeviceDriver implements ScannerDeviceDriver, DeviceDriver { +public class StandardScannerDeviceDriver extends AbstractDeviceDriver implements ScannerDeviceDriver, DeviceDriver, DeviceStageMonitor { UnifiedDataAccessor accessor_value; @@ -59,5 +61,22 @@ public class StandardScannerDeviceDriver extends AbstractDeviceDriver implements } } + @Override + public JSONObject getDeviceStatusName() throws Exception { + JSONObject jo = new JSONObject(); + jo.put("device_name", this.getDevice().getDevice_name()); + jo.put("isOnline", true); + jo.put("device_type", device.getDevice_type()); + //点击弹出 + jo.put("is_click", true); + jo.put("ip", this.getIp()); + jo.put("container", StrUtil.isEmpty(this.readBarcode()) ? "" : this.readBarcode()); + return jo; + } + + @Override + public void setDeviceStatus(JSONObject data) { + + } } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java index 017aba3..769893e 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java @@ -2,6 +2,7 @@ package org.nl.acs.ext.wms.rest; +import cn.dev33.satoken.annotation.SaIgnore; import com.alibaba.fastjson.JSONObject; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -31,6 +32,7 @@ public class WmsToAcsController { @PostMapping("/task") @Log("接收WMS任务") @ApiOperation("接收WMS任务") + @SaIgnore public ResponseEntity createFromWms(@RequestBody String whereJson) { return new ResponseEntity<>(wmstoacsService.createFromWms(whereJson), HttpStatus.OK); } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java index 464dc39..a69b673 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java @@ -202,9 +202,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); String device_code = deviceService.queryDeviceCodeByAddress(Integer.parseInt(address)); JSONObject jo = new JSONObject(); - jo.put("device_code", device_code); jo.put("task_id", task_id); - jo.put("vehicle_code", vehicle_code); String result2 = null; AddressDto addressDto = addressService.findByCode("requestTaskAgain"); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java index 794f4a6..3ec7fee 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java @@ -290,15 +290,8 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu dto.setStart_parent_code(task.getStart_parent_code()); dto.setNext_parent_code(task.getNext_parent_code()); - - if (StrUtil.equals(task.getTask_type(), "1")) { - dto.setAgv_inst_type("1"); - } else if (StrUtil.equals(task.getTask_type(), "2")) { - dto.setAgv_inst_type("2"); - } else if (StrUtil.equals(task.getTask_type(), "3")) { - dto.setAgv_inst_type("3"); - } else if (StrUtil.equals(task.getTask_type(), "4")) { - dto.setAgv_inst_type("4"); + if(ObjectUtil.isNotEmpty(task.getTask_type())){ + dto.setInstruction_type(task.getTask_type()); } DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); @@ -501,16 +494,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu // != 0 为agv任务 if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "2")) { - /** - * 1 双工agv双任务 - * 2 双工agv但认为 - * 3 单入-单任务 - * 4 双入-双任务 - * 5 点对点任务 - * 6 称重平台称重PS20 agvtype:1 - * 7 不去称重平台称重PS20 agvtype:2 - * 8 RT20 agvtype:3 - */ if (StrUtil.equals("1", dto.getInstruction_type())) { ndcAgvService.sendAgvTwoInstToNDC(dto, dto2); dto.setSend_status("1"); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/monitor/DeviceStageMonitor.java b/acs/nladmin-system/src/main/java/org/nl/acs/monitor/DeviceStageMonitor.java index 2cc1e37..5310d2b 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/monitor/DeviceStageMonitor.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/monitor/DeviceStageMonitor.java @@ -12,7 +12,7 @@ public interface DeviceStageMonitor { * 根据设备获取设备状态(中文名:如故障、联机等) * @return */ - public JSONObject getDeviceStatusName(); + public JSONObject getDeviceStatusName() throws Exception; /** * 根据舞台数据修改设备驱动状态 diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/monitor/rest/DeviceStageMonitorController.java b/acs/nladmin-system/src/main/java/org/nl/acs/monitor/rest/DeviceStageMonitorController.java index 2aef441..66692b2 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/monitor/rest/DeviceStageMonitorController.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/monitor/rest/DeviceStageMonitorController.java @@ -31,7 +31,7 @@ public class DeviceStageMonitorController { @Log("获取舞台设备信息") @ApiOperation("获取舞台设备信息") @PostMapping("/getDeviceByCodes") - public ResponseEntity getDeviceByCodes(@RequestBody String json) { + public ResponseEntity getDeviceByCodes(@RequestBody String json) throws Exception { JSONArray jsonArray = JSONArray.parseArray(json); return new ResponseEntity<>(deviceStageMonitorService.getData(jsonArray), HttpStatus.OK); } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/monitor/service/DeviceStageMonitorService.java b/acs/nladmin-system/src/main/java/org/nl/acs/monitor/service/DeviceStageMonitorService.java index 485f6a0..27d0bca 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/monitor/service/DeviceStageMonitorService.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/monitor/service/DeviceStageMonitorService.java @@ -14,5 +14,5 @@ public interface DeviceStageMonitorService { * @param jsonArray 前端传来设备编号和节点的id * @return */ - public JSONArray getData(JSONArray jsonArray); + public JSONArray getData(JSONArray jsonArray) throws Exception; } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/monitor/service/impl/DeviceStageMonitorServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/monitor/service/impl/DeviceStageMonitorServiceImpl.java index 333aa2b..53bca4d 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/monitor/service/impl/DeviceStageMonitorServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/monitor/service/impl/DeviceStageMonitorServiceImpl.java @@ -24,7 +24,7 @@ public class DeviceStageMonitorServiceImpl implements DeviceStageMonitorService @Override - public JSONArray getData(JSONArray jsonArray) { + public JSONArray getData(JSONArray jsonArray) throws Exception { JSONArray arr = new JSONArray(); for (int i = 0; i < jsonArray.size(); i++) { JSONObject obj = new JSONObject(); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java index 613ec94..4400827 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java @@ -829,7 +829,6 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { String compound_task = acsTask.getCompound_task(); String next_point_code = acsTask.getNext_point_code(); String next_device_code = acsTask.getNext_device_code(); - String maxInstnumber = paramService.findByCode(AcsConfig.MAXINSTNUMBER).getValue(); /** * 开始平均分解校验 diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java b/acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java index c1b4fda..be68a17 100644 --- a/acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java +++ b/acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java @@ -58,37 +58,38 @@ public class AutoCreateInst { if(StrUtil.equals(is_send,"0")){ continue; } - - //校验路由关系 - List shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code); - if (ObjectUtils.isEmpty(shortPathsList)) { - acsTask.setRemark("路由不通无法生成指令"); - taskserver.updateByCodeFromCache(acsTask); - continue; - } - - if (!StrUtil.equals(shortPathsList.get(0).getType(), "1")) { - continue; - } - - 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; + if(StrUtil.equals(acsTask.getTask_type(),"1") || StrUtil.equals(acsTask.getTask_type(),"2")){ + //校验路由关系 + List shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code); + if (ObjectUtils.isEmpty(shortPathsList)) { + acsTask.setRemark("路由不通无法生成指令"); + taskserver.updateByCodeFromCache(acsTask); + continue; } - } - next_device_code = pathlist.get(index); - if (StrUtil.equals(appService.findDeviceTypeByCode(next_device_code), "storage")) { - next_point_code = next_device_code + "-" + acsTask.getTo_y() + "-" + acsTask.getTo_z(); - } else { - next_point_code = next_device_code; + if (!StrUtil.equals(shortPathsList.get(0).getType(), "1")) { + continue; + } + + 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); + + if (StrUtil.equals(appService.findDeviceTypeByCode(next_device_code), "storage")) { + next_point_code = next_device_code + "-" + acsTask.getTo_y() + "-" + acsTask.getTo_z(); + } else { + next_point_code = next_device_code; + } } Instruction instdto = new Instruction(); diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/QueryZDAgvTaskStatus.java b/acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/QueryZDAgvTaskStatus.java index b226b1a..668a57c 100644 --- a/acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/QueryZDAgvTaskStatus.java +++ b/acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/QueryZDAgvTaskStatus.java @@ -98,7 +98,7 @@ public class QueryZDAgvTaskStatus { HttpResponse response2 = agvService.queryAgvInstStatus("2"); //查询AGV指令列表 - JSONArray inst_rows2 = JSONArray.parseArray(response.body()); + JSONArray inst_rows2 = JSONArray.parseArray(response2.body()); for (int i = 0; i < inst_rows2.size(); i++) { JSONObject inst_jo = inst_rows2.getJSONObject(i); String inst_code = inst_jo.getString("task_code"); diff --git a/acs/nladmin-system/src/main/resources/initsql.txt b/acs/nladmin-system/src/main/resources/initsql.txt new file mode 100644 index 0000000..dc704cb --- /dev/null +++ b/acs/nladmin-system/src/main/resources/initsql.txt @@ -0,0 +1,16 @@ +delete from acs_device_runpoint; +delete from acs_device_extra; +delete from acs_device; +delete from acs_device_assigned; +delete from acs_opc_plc; +delete from acs_opc; +delete from acs_route_line; +delete from acs_instruction; +delete from acs_task; +delete from sys_log; +delete from acs_log; +delete from acs_task_feedback; +delete from sys_quartz_log; +delete from acs_storage_cell; +update acs_stage_actor set device_code='',image_name ='1'; +update sys_code_rule_detail set current_value=0; \ No newline at end of file diff --git a/acs/nladmin-ui/src/views/acs/device/driver/empty_vehicle_stacking_position.vue b/acs/nladmin-ui/src/views/acs/device/driver/empty_vehicle_stacking_position.vue index 57f2284..097cd0b 100644 --- a/acs/nladmin-ui/src/views/acs/device/driver/empty_vehicle_stacking_position.vue +++ b/acs/nladmin-ui/src/views/acs/device/driver/empty_vehicle_stacking_position.vue @@ -30,8 +30,8 @@ v-model="plc_id" placeholder="无" clearable - @change="changePlc" filterable + @change="changePlc" > + + + + + + + + + + + + + + + + + + + + + @@ -298,6 +334,20 @@ export default { plc_code: '', opc_id: '', opc_code: '', + doors: [{ + key: '1', + label: '前门' + }, { + key: '2', + label: '后门' + }], + floors: [{ + key: '1', + label: '1楼' + }, { + key: '2', + label: '2楼' + }], address: '', configLoading: false, dataOpcservers: [], diff --git a/acs/nladmin-ui/src/views/acs/instruction/index.vue b/acs/nladmin-ui/src/views/acs/instruction/index.vue index 3947310..7e82e25 100644 --- a/acs/nladmin-ui/src/views/acs/instruction/index.vue +++ b/acs/nladmin-ui/src/views/acs/instruction/index.vue @@ -109,6 +109,7 @@ + diff --git a/acs/nladmin-ui/src/views/acs/task/index.vue b/acs/nladmin-ui/src/views/acs/task/index.vue index a9a05bf..d95937c 100644 --- a/acs/nladmin-ui/src/views/acs/task/index.vue +++ b/acs/nladmin-ui/src/views/acs/task/index.vue @@ -251,6 +251,7 @@ + @@ -266,9 +267,9 @@ --> - + - +