diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/AgvWaitUtil.java b/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/AgvWaitUtil.java index 0a67d0a..704d67e 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/AgvWaitUtil.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/AgvWaitUtil.java @@ -212,7 +212,7 @@ public class AgvWaitUtil { // 诺力4期对接位驱动 NL4StationDeviceDriver driver = (NL4StationDeviceDriver) device.getDeviceDriver(); if (RequestMethodEnum.GANTRY_MATERIAL_FINISHED.getCode().equals(task.getDirection())) { - // 门架上料完成任务 + // 其余物料上料完成任务 if (deviceCode.equals(task.getNext_device_code2())) { // 如果是放满点,需要把取满点的信息写入再请求离开。 Device device2 = this.deviceAppService.findDeviceByCode(task.getStart_device_code2()); @@ -244,11 +244,12 @@ public class AgvWaitUtil { this.deviceExecuteLogService.deviceExecuteLog(deviceCode, "", "", message); } } - } else if (RequestMethodEnum.CHANNEL_STEEL_CALL_MATERIAL.getCode().equals(task.getDirection())) { - // 槽钢呼叫满料任务 - if (deviceCode.equals(task.getNext_device_code())) { + } + else if (RequestMethodEnum.CHANNEL_STEEL_MATERIAL_FINISHED.getCode().equals(task.getDirection())) { + // 槽钢上料完成任务 + if (deviceCode.equals(task.getNext_device_code2())) { // 如果是放满点,需要把取满点的信息写入再请求离开。 - Device device2 = this.deviceAppService.findDeviceByCode(task.getStart_device_code()); + Device device2 = this.deviceAppService.findDeviceByCode(task.getStart_device_code2()); driver.writing("to_material", device2.getMaterial_type()); driver.writing("to_qty", device2.getBatch()); driver.writing("to_command", 4); @@ -277,7 +278,8 @@ public class AgvWaitUtil { this.deviceExecuteLogService.deviceExecuteLog(deviceCode, "", "", message); } } - } else { + } + else { driver.writing("to_command", 4); if (driver.getMode() != 0) { String message = "允许AGV放货后离开。"; diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java index 9b0c28a..d53c3cc 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java @@ -210,12 +210,17 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { param.put("disableVehicle", false); agvurl = agvurl + ":" + agvport + "/terminate"; log.info("删除agv指令请求agvurl:{}", agvurl); - HttpResponse result = HttpRequest.post(agvurl) - .body(param.toJSONString()) - .timeout(20000)//超时,毫秒 - .execute(); - log.info("删除agv指令请求反馈:{}", result); - return result; + try { + HttpResponse result = HttpRequest.post(agvurl) + .body(param.toJSONString()) + .timeout(20000)//超时,毫秒 + .execute(); + log.info("删除agv指令请求反馈:{}", result); + return result; + } catch (Exception e) { + log.error("取消AGV指令信息错误:{}", e.getMessage()); + throw new BadRequestException(e.getMessage()); + } } else { return null; } @@ -570,106 +575,110 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { } // 起点2 - Device device3 = deviceAppService.findDeviceByCode(inst.getStart_device_code2()); - if ("true".equals(device3.getExtraValue().get("ignore_pickup_check"))) { - //取货前等待 - block = new JSONObject(); - block.put("blockId", IdUtil.simpleUUID()); - block.put("location", inst.getStart_point_code2() + "INGET"); - block.put("operation", "script"); - block.put("id", inst.getStart_point_code2() + "INGET"); - block.put("script_name", "userpy/interact.py"); - JSONObject scriptArgs = new JSONObject(); - scriptArgs.put("addr", addr); - JSONObject data = new JSONObject(); - JSONObject reach = new JSONObject(); - reach.put("task_code", inst.getInstruction_code()); - reach.put("address", inst.getStart_point_code2() + "INGET"); - data.put("reach", reach); - scriptArgs.put("data", data); - scriptArgs.put("protocol", "HTTP"); - block.put("script_args", scriptArgs); - blocks.add(block); - } - - block = new JSONObject(); - block.put("blockId", IdUtil.simpleUUID()); - block.put("location", inst.getStart_point_code2()); - block.put("operation", "JackLoad"); - block.put("operationArgs", new JSONObject() {{ - put("recognize", true); - }}); - blocks.add(block); + if (StrUtil.isNotEmpty(inst.getStart_device_code2())) { + Device device3 = deviceAppService.findDeviceByCode(inst.getStart_device_code2()); + if ("true".equals(device3.getExtraValue().get("ignore_pickup_check"))) { + //取货前等待 + block = new JSONObject(); + block.put("blockId", IdUtil.simpleUUID()); + block.put("location", inst.getStart_point_code2() + "INGET"); + block.put("operation", "script"); + block.put("id", inst.getStart_point_code2() + "INGET"); + block.put("script_name", "userpy/interact.py"); + JSONObject scriptArgs = new JSONObject(); + scriptArgs.put("addr", addr); + JSONObject data = new JSONObject(); + JSONObject reach = new JSONObject(); + reach.put("task_code", inst.getInstruction_code()); + reach.put("address", inst.getStart_point_code2() + "INGET"); + data.put("reach", reach); + scriptArgs.put("data", data); + scriptArgs.put("protocol", "HTTP"); + block.put("script_args", scriptArgs); + blocks.add(block); + } - if ("true".equals(device3.getExtraValue().get("ignore_pickup_check"))) { - //取货完成等待 block = new JSONObject(); block.put("blockId", IdUtil.simpleUUID()); - block.put("location", inst.getStart_point_code2() + "OUTGET"); - block.put("operation", "script"); - block.put("id", inst.getStart_point_code2() + "OUTGET"); - block.put("script_name", "userpy/interact.py"); - JSONObject scriptArgs = new JSONObject(); - scriptArgs.put("addr", addr); - JSONObject data = new JSONObject(); - JSONObject reach = new JSONObject(); - reach.put("task_code", inst.getInstruction_code()); - reach.put("address", inst.getStart_point_code2() + "OUTGET"); - data.put("reach", reach); - scriptArgs.put("data", data); - scriptArgs.put("protocol", "HTTP"); - block.put("script_args", scriptArgs); + block.put("location", inst.getStart_point_code2()); + block.put("operation", "JackLoad"); + block.put("operationArgs", new JSONObject() {{ + put("recognize", true); + }}); blocks.add(block); - } - // 终点2 - Device device4 = deviceAppService.findDeviceByCode(inst.getNext_device_code2()); - if ("true".equals(device4.getExtraValue().get("ignore_release_check"))) { - //放货前等待 - block = new JSONObject(); - block.put("blockId", IdUtil.simpleUUID()); - block.put("location", inst.getNext_point_code2() + "INPUT"); - block.put("operation", "script"); - block.put("id", inst.getNext_point_code2() + "INPUT"); - block.put("script_name", "userpy/interact.py"); - JSONObject scriptArgs = new JSONObject(); - scriptArgs.put("addr", addr); - JSONObject data = new JSONObject(); - JSONObject reach = new JSONObject(); - reach.put("task_code", inst.getInstruction_code()); - reach.put("address", inst.getNext_point_code2() + "INPUT"); - data.put("reach", reach); - scriptArgs.put("data", data); - scriptArgs.put("protocol", "HTTP"); - block.put("script_args", scriptArgs); - blocks.add(block); + if ("true".equals(device3.getExtraValue().get("ignore_pickup_check"))) { + //取货完成等待 + block = new JSONObject(); + block.put("blockId", IdUtil.simpleUUID()); + block.put("location", inst.getStart_point_code2() + "OUTGET"); + block.put("operation", "script"); + block.put("id", inst.getStart_point_code2() + "OUTGET"); + block.put("script_name", "userpy/interact.py"); + JSONObject scriptArgs = new JSONObject(); + scriptArgs.put("addr", addr); + JSONObject data = new JSONObject(); + JSONObject reach = new JSONObject(); + reach.put("task_code", inst.getInstruction_code()); + reach.put("address", inst.getStart_point_code2() + "OUTGET"); + data.put("reach", reach); + scriptArgs.put("data", data); + scriptArgs.put("protocol", "HTTP"); + block.put("script_args", scriptArgs); + blocks.add(block); + } } - block = new JSONObject(); - block.put("blockId", IdUtil.simpleUUID()); - block.put("location", inst.getNext_point_code2()); - block.put("operation", "JackUnload"); - blocks.add(block); + if (StrUtil.isNotEmpty(inst.getNext_device_code2())) { + // 终点2 + Device device4 = deviceAppService.findDeviceByCode(inst.getNext_device_code2()); + if ("true".equals(device4.getExtraValue().get("ignore_release_check"))) { + //放货前等待 + block = new JSONObject(); + block.put("blockId", IdUtil.simpleUUID()); + block.put("location", inst.getNext_point_code2() + "INPUT"); + block.put("operation", "script"); + block.put("id", inst.getNext_point_code2() + "INPUT"); + block.put("script_name", "userpy/interact.py"); + JSONObject scriptArgs = new JSONObject(); + scriptArgs.put("addr", addr); + JSONObject data = new JSONObject(); + JSONObject reach = new JSONObject(); + reach.put("task_code", inst.getInstruction_code()); + reach.put("address", inst.getNext_point_code2() + "INPUT"); + data.put("reach", reach); + scriptArgs.put("data", data); + scriptArgs.put("protocol", "HTTP"); + block.put("script_args", scriptArgs); + blocks.add(block); + } - if ("true".equals(device4.getExtraValue().get("ignore_release_check"))) { - //放货完成等待 block = new JSONObject(); block.put("blockId", IdUtil.simpleUUID()); - block.put("location", inst.getNext_point_code2() + "OUTPUT"); - block.put("operation", "script"); - block.put("id", inst.getNext_point_code2() + "OUTPUT"); - block.put("script_name", "userpy/interact.py"); - JSONObject scriptArgs = new JSONObject(); - scriptArgs.put("addr", addr); - JSONObject data = new JSONObject(); - JSONObject reach = new JSONObject(); - reach.put("task_code", inst.getInstruction_code()); - reach.put("address", inst.getNext_point_code2() + "OUTPUT"); - data.put("reach", reach); - scriptArgs.put("data", data); - scriptArgs.put("protocol", "HTTP"); - block.put("script_args", scriptArgs); + block.put("location", inst.getNext_point_code2()); + block.put("operation", "JackUnload"); blocks.add(block); + + if ("true".equals(device4.getExtraValue().get("ignore_release_check"))) { + //放货完成等待 + block = new JSONObject(); + block.put("blockId", IdUtil.simpleUUID()); + block.put("location", inst.getNext_point_code2() + "OUTPUT"); + block.put("operation", "script"); + block.put("id", inst.getNext_point_code2() + "OUTPUT"); + block.put("script_name", "userpy/interact.py"); + JSONObject scriptArgs = new JSONObject(); + scriptArgs.put("addr", addr); + JSONObject data = new JSONObject(); + JSONObject reach = new JSONObject(); + reach.put("task_code", inst.getInstruction_code()); + reach.put("address", inst.getNext_point_code2() + "OUTPUT"); + data.put("reach", reach); + scriptArgs.put("data", data); + scriptArgs.put("protocol", "HTTP"); + block.put("script_args", scriptArgs); + blocks.add(block); + } } return blocks; diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/RequestMethodEnum.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/RequestMethodEnum.java index bc49fc2..477f45f 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/RequestMethodEnum.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/RequestMethodEnum.java @@ -15,12 +15,12 @@ public enum RequestMethodEnum { feedback_task_status(2, "feedback_task_status", "反馈任务状态","1"), - GANTRY_MATERIAL_FINISHED(3, "gantryMaterialFinished", "门架上料完成","0"), + GANTRY_MATERIAL_FINISHED(3, "gantryMaterialFinished", "其余物料上料完成","0"), - CHANNEL_STEEL_MATERIAL_FINISHED(4, "channelSteelMaterialFinished", "槽钢上料完成", "0"), + CHANNEL_STEEL_MATERIAL_FINISHED(4, "channelSteelMaterialFinished", "槽钢上料完成", "0"); - CHANNEL_STEEL_CALL_MATERIAL(5, "channelSteelCallMaterial", "槽钢呼叫满料", "0"), - PRODUCTION_COMPLETED(6, "productionCompleted", "下料完成", "0"); +// CHANNEL_STEEL_CALL_MATERIAL(5, "channelSteelCallMaterial", "槽钢呼叫满料", "0"), +// PRODUCTION_COMPLETED(6, "productionCompleted", "下料完成", "0"); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/nl4/station/NL4StationDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/nl4/station/NL4StationDeviceDriver.java index f2f6781..6e10d1c 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/nl4/station/NL4StationDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/nl4/station/NL4StationDeviceDriver.java @@ -19,6 +19,7 @@ import org.nl.acs.opc.Device; import org.nl.acs.opc.DeviceAppService; import org.nl.acs.task.service.TaskService; import org.nl.acs.task.service.dto.TaskDto; +import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.wql.core.bean.WQLObject; import org.nl.modules.wql.util.SpringContextHolder; @@ -102,6 +103,7 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D if (mode == 2) { this.writing("to_command", "0"); } + this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", "mode信号发生变化,进行复位标记,此时标记值:" + requireSuccess); this.deviceExecuteLogService.deviceItemValue(this.currentDeviceCode, ItemProtocol.ITEM_MODE, String.valueOf(mode)); this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", ItemProtocol.ITEM_MODE + " " + this.lastMode + " -> " + this.mode); } @@ -223,6 +225,19 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D } } + private void unLock(Device device1, Device device2, Device device3, Device device4) { + JSONObject rpUpdate = new JSONObject(); + rpUpdate.put("islock", "0"); + rpUpdate.put("update_by", "auto"); + rpUpdate.put("update_time", DateUtil.now()); + WQLObject.getWQLObject("acs_device_runpoint").update(rpUpdate, "device_code IN ('" + device1.getDevice_code() + "', '" + device2.getDevice_code() + "', '" + device3.getDevice_code() + "', '" + device4.getDevice_code() + "')"); + + device1.setIslock("0"); + device2.setIslock("0"); + device3.setIslock("0"); + device4.setIslock("0"); + } + @NotNull private TaskDto creatTask(Device device1, Device device2, Device device3, Device device4, RequestMethodEnum method) { JSONObject rpUpdate = new JSONObject(); @@ -273,37 +288,79 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D return null; } + private boolean findHasGoodsIsFull(JSONArray deviceCodes) { + for (int i = 0; i < deviceCodes.size(); i++) { + Device device = this.deviceAppService.findDeviceByCode(deviceCodes.getString(i)); + if (device != null && device.getHas_goods() == 0) { + return false; + } + } + return true; + } + /** - * 门架上料完成 + * 其余物料上料完成 */ @SuppressWarnings("unused") public void gantryMaterialFinished() throws Exception { synchronized (NL4StationDeviceDriver.class) { Device currentDevice = this.deviceAppService.findDeviceByCode(this.currentDeviceCode); if ("0".equals(currentDevice.getIslock())) { - // 门架上料完成放空设备 - Object gantryDeviceCode1 = this.getDevice().getExtraValue().get("gantry_device_code1"); - if (ObjectUtil.isEmpty(gantryDeviceCode1)) { - String message = "门架上料完成放空设备未配置。"; - this.message = message; - this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message); - return; - } - JSONArray emptyDeviceCodes = JSONArray.parseArray(gantryDeviceCode1.toString()); - // 门架上料完成取满设备 - Object gantryDeviceCode2 = this.getDevice().getExtraValue().get("gantry_device_code2"); + + // 其余物料上料完成放空设备 + Object gantryDeviceCode2 = this.getDevice().getExtraValue().get("gantry_device_code1"); if (ObjectUtil.isEmpty(gantryDeviceCode2)) { - String message = "门架上料完成取满设备未配置。"; + String message = "其余物料上料完成放空设备未配置。"; this.message = message; this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message); return; } - JSONArray materialDeviceCodes = JSONArray.parseArray(gantryDeviceCode2.toString()); + JSONArray emptyDeviceCodes = JSONArray.parseArray(gantryDeviceCode2.toString()); + + Object gantryDeviceCode3 = null; + JSONArray materialDeviceCodes = null; + //查询其余物料上料对接位关联的所有上料对接位 + Object link_device_code = this.getDevice().getExtraValue().get("link_device_code"); + if (ObjectUtil.isNotEmpty(link_device_code)) { + JSONArray linkDeviceCodes = JSONArray.parseArray(link_device_code.toString()); + boolean flag = this.findHasGoodsIsFull(linkDeviceCodes); + if (!flag) { + //否则查询特殊的取满设备 + gantryDeviceCode3 = this.getDevice().getExtraValue().get("gantry_device_code3"); + if (ObjectUtil.isEmpty(gantryDeviceCode3)) { + String message = "其余物料上料完成特殊取满设备未配置。"; + this.message = message; + this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message); + return; + } + materialDeviceCodes = JSONArray.parseArray(gantryDeviceCode3.toString()); + } else { + // 其余物料上料完成取满设备 + gantryDeviceCode3 = this.getDevice().getExtraValue().get("gantry_device_code2"); + if (ObjectUtil.isEmpty(gantryDeviceCode3)) { + String message = "其余物料上料完成取满设备未配置。"; + this.message = message; + this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message); + return; + } + materialDeviceCodes = JSONArray.parseArray(gantryDeviceCode3.toString()); + } + } else { + // 其余物料上料完成取满设备 + gantryDeviceCode3 = this.getDevice().getExtraValue().get("gantry_device_code2"); + if (ObjectUtil.isEmpty(gantryDeviceCode3)) { + String message = "其余物料上料完成取满设备未配置。"; + this.message = message; + this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message); + return; + } + materialDeviceCodes = JSONArray.parseArray(gantryDeviceCode3.toString()); + } // 查找合适的放空设备 Device emptyDevice = this.findNotHasGoodsDevice(emptyDeviceCodes); if (ObjectUtil.isEmpty(emptyDevice)) { - String message = "未找到合适的门架上料完成放空设备。"; + String message = "未找到合适的其余物料上料完成放空设备。"; this.message = message; this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message); return; @@ -313,14 +370,18 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D // 查找合适的取满设备 Device materialDevice = this.findHasGoodsDevice(materialDeviceCodes); if (ObjectUtil.isEmpty(materialDevice)) { - String message = "未找到合适的门架上料完成取满设备。"; + String message = "未找到合适的其余物料上料完成取满设备。"; this.message = message; this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message); return; } assert materialDevice != null; - - this.taskService.create(this.creatTask(currentDevice, emptyDevice, materialDevice, currentDevice, RequestMethodEnum.GANTRY_MATERIAL_FINISHED)); + try { + this.taskService.create(this.creatTask(currentDevice, emptyDevice, materialDevice, currentDevice, RequestMethodEnum.GANTRY_MATERIAL_FINISHED)); + } catch (Exception e) { + this.unLock(currentDevice, emptyDevice, materialDevice, currentDevice); + throw new BadRequestException(e.getMessage()); + } this.requireSuccess = true; this.writing("to_command", this.mode); } @@ -335,195 +396,58 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D synchronized (NL4StationDeviceDriver.class) { Device currentDevice = this.deviceAppService.findDeviceByCode(this.currentDeviceCode); if ("0".equals(currentDevice.getIslock())) { - // 槽钢上料完成取满设备 - Object channelSteelDeviceCode1 = this.getDevice().getExtraValue().get("channel_steel_device_code1"); - if (ObjectUtil.isEmpty(channelSteelDeviceCode1)) { - String message = "槽钢上料完成取满设备未配置。"; - this.message = message; - this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message); - return; - } - JSONArray deviceCodes1 = JSONArray.parseArray(channelSteelDeviceCode1.toString()); - // 槽钢上料完成放满设备 - Object channelSteelDeviceCode2 = this.getDevice().getExtraValue().get("channel_steel_device_code2"); - if (ObjectUtil.isEmpty(channelSteelDeviceCode2)) { - String message = "槽钢上料完成放满设备未配置。"; - this.message = message; - this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message); - return; - } - JSONArray deviceCodes2 = JSONArray.parseArray(channelSteelDeviceCode2.toString()); // 槽钢上料完成放空设备 - Object channelSteelDeviceCode4 = this.getDevice().getExtraValue().get("channel_steel_device_code4"); - if (ObjectUtil.isEmpty(channelSteelDeviceCode4)) { + Object channelSteelDeviceCode2 = this.getDevice().getExtraValue().get("channel_steel_device_code1"); + if (ObjectUtil.isEmpty(channelSteelDeviceCode2)) { String message = "槽钢上料完成放空设备未配置。"; this.message = message; this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message); return; } - JSONArray deviceCodes4 = JSONArray.parseArray(channelSteelDeviceCode4.toString()); + JSONArray deviceCodes2 = JSONArray.parseArray(channelSteelDeviceCode2.toString()); - // 查找合适的取满设备 - Device device1 = this.findHasGoodsDevice(deviceCodes1); - if (ObjectUtil.isEmpty(device1)) { - String message = "未找到合适的槽钢上料完成取满设备。"; + // 槽钢上料完成取满设备 + Object channelSteelDeviceCode3 = this.getDevice().getExtraValue().get("channel_steel_device_code2"); + if (ObjectUtil.isEmpty(channelSteelDeviceCode3)) { + String message = "槽钢上料完成取满设备未配置。"; this.message = message; this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message); return; } - assert device1 != null; + JSONArray deviceCodes3 = JSONArray.parseArray(channelSteelDeviceCode3.toString()); - // 查找合适的放满设备 - Device device2 = this.findNotHasGoodsDevice(deviceCodes2); - if (ObjectUtil.isEmpty(device2)) { - String message = "未找到合适的槽钢上料完成放满设备。"; - this.message = message; - this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message); - return; - } - assert device2 != null; // 查找合适的放空设备 - Device device4 = this.findNotHasGoodsDevice(deviceCodes4); - if (ObjectUtil.isEmpty(device4)) { + Device device2 = this.findNotHasGoodsDevice(deviceCodes2); + if (ObjectUtil.isEmpty(device2)) { String message = "未找到合适的槽钢上料完成放空设备。"; this.message = message; this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message); return; } - assert device4 != null; - - this.taskService.create(this.creatTask(device1, device2, currentDevice, device4, RequestMethodEnum.CHANNEL_STEEL_MATERIAL_FINISHED)); - this.requireSuccess = true; - this.writing("to_command", this.mode); - } - } - } - - /** - * 槽钢呼叫满料 - */ - @SuppressWarnings("unused") - public void channelSteelCallMaterial() throws Exception { - synchronized (NL4StationDeviceDriver.class) { - Device currentDevice = this.deviceAppService.findDeviceByCode(this.currentDeviceCode); - if ("0".equals(currentDevice.getIslock())) { - // 槽钢呼叫满料取满设备 - Object channelSteelCallMaterialDeviceCode1 = this.getDevice().getExtraValue().get("channel_steel_call_material_device_code1"); - if (ObjectUtil.isEmpty(channelSteelCallMaterialDeviceCode1)) { - String message = "槽钢呼叫满料取满设备未配置。"; - this.message = message; - this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message); - return; - } - JSONArray deviceCodes1 = JSONArray.parseArray(channelSteelCallMaterialDeviceCode1.toString()); - // 槽钢呼叫满料取空设备 - Object channelSteelCallMaterialDeviceCode3 = this.getDevice().getExtraValue().get("channel_steel_call_material_device_code3"); - if (ObjectUtil.isEmpty(channelSteelCallMaterialDeviceCode3)) { - String message = "槽钢呼叫满料取空设备未配置。"; - this.message = message; - this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message); - return; - } - JSONArray deviceCodes3 = JSONArray.parseArray(channelSteelCallMaterialDeviceCode3.toString()); - // 槽钢呼叫满料放空设备 - Object channelSteelCallMaterialDeviceCode4 = this.getDevice().getExtraValue().get("channel_steel_call_material_device_code4"); - if (ObjectUtil.isEmpty(channelSteelCallMaterialDeviceCode4)) { - String message = "槽钢呼叫满料放空设备未配置。"; - this.message = message; - this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message); - return; - } - JSONArray deviceCodes4 = JSONArray.parseArray(channelSteelCallMaterialDeviceCode4.toString()); + assert device2 != null; // 查找合适的取满设备 - Device device1 = this.findHasGoodsDevice(deviceCodes1); - if (ObjectUtil.isEmpty(device1)) { - String message = "未找到合适的槽钢呼叫满料取满设备。"; - this.message = message; - this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message); - return; - } - assert device1 != null; - - // 查找合适的取空设备 Device device3 = this.findHasGoodsDevice(deviceCodes3); if (ObjectUtil.isEmpty(device3)) { - String message = "未找到合适的槽钢呼叫满料取空设备。"; + String message = "未找到合适的槽钢上料完成取满设备。"; this.message = message; this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message); return; } assert device3 != null; - // 查找合适的放空设备 - Device device4 = this.findNotHasGoodsDevice(deviceCodes4); - if (ObjectUtil.isEmpty(device4)) { - String message = "未找到合适的槽钢呼叫满料放空设备。"; - this.message = message; - this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message); - return; + try { + this.taskService.create(this.creatTask(currentDevice, device2, device3, currentDevice, RequestMethodEnum.CHANNEL_STEEL_MATERIAL_FINISHED)); + } catch (Exception e) { + this.unLock(currentDevice, device2, device3, currentDevice); + throw new BadRequestException(e.getMessage()); } - assert device4 != null; - - this.taskService.create(this.creatTask(device1, currentDevice, device3, device4, RequestMethodEnum.CHANNEL_STEEL_CALL_MATERIAL)); this.requireSuccess = true; this.writing("to_command", this.mode); } } } - /** - * 下料完成 - */ - @SuppressWarnings("unused") - public void productionCompleted() throws Exception { - synchronized (NL4StationDeviceDriver.class) { - Device currentDevice = this.deviceAppService.findDeviceByCode(this.currentDeviceCode); - if ("0".equals(currentDevice.getIslock())) { - // 下料完成放满设备 - Object productionCompletedDeviceCode2 = this.getDevice().getExtraValue().get("production_completed_device_code2"); - if (ObjectUtil.isEmpty(productionCompletedDeviceCode2)) { - String message = "下料完成放满设备未配置。"; - this.message = message; - this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message); - return; - } - JSONArray deviceCodes2 = JSONArray.parseArray(productionCompletedDeviceCode2.toString()); - // 下料完成取空设备 - Object productionCompletedDeviceCode3 = this.getDevice().getExtraValue().get("production_completed_device_code3"); - if (ObjectUtil.isEmpty(productionCompletedDeviceCode3)) { - String message = "下料完成取空设备未配置。"; - this.message = message; - this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message); - return; - } - JSONArray deviceCodes3 = JSONArray.parseArray(productionCompletedDeviceCode3.toString()); - - // 查找合适的放满设备 - Device device2 = this.findNotHasGoodsDevice(deviceCodes2); - if (ObjectUtil.isEmpty(device2)) { - String message = "未找到合适的下料完成放满设备。"; - this.message = message; - this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message); - return; - } - assert device2 != null; - // 查找合适的取空设备 - Device device3 = this.findHasGoodsDevice(deviceCodes3); - if (ObjectUtil.isEmpty(device3)) { - String message = "未找到合适的下料完成取空设备。"; - this.message = message; - this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message); - return; - } - assert device3 != null; - - this.taskService.create(this.creatTask(currentDevice, device2, device3, currentDevice, RequestMethodEnum.PRODUCTION_COMPLETED)); - this.requireSuccess = true; - this.writing("to_command", this.mode); - } - } - } } 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 f0972ef..f235c50 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 @@ -575,11 +575,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu JSONObject jo1 = new JSONObject(); jo1.put("device_code", instnextdevice); - if (StrUtil.equals(entity.getMaterial(), "1")) { - jo1.put("hasGoodStatus", "1"); - } else { - jo1.put("hasGoodStatus", "2"); - } + jo1.put("hasGoodStatus", "1"); jo1.put("material_type", startdevice.getMaterial_type()); jo1.put("quantity", startdevice.getQuantity()); jo1.put("remark", startdevice.getRemark()); @@ -835,7 +831,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu log.debug("地址对应设备未找到"); return; } - LampThreecolorDeviceDriver lampThreecolorDeviceDriver; removeByCodeFromCache(entity.getInstruction_code()); } 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 ad7ad64..668ef3b 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 @@ -12,21 +12,13 @@ import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ObjectUtils; -import org.nl.acs.agv.server.impl.XianGongAgvServiceImpl; import org.nl.acs.auto.initial.ApplicationAutoInitial; import org.nl.acs.config.AcsConfig; import org.nl.acs.device.service.DeviceAssignedService; -import org.nl.acs.device.service.DeviceService; import org.nl.acs.device.service.StorageCellService; import org.nl.acs.device.service.dto.DeviceAssignedDto; -import org.nl.acs.device.service.impl.DeviceServiceImpl; import org.nl.acs.device_driver.RequestMethodEnum; import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver; -import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver; -import org.nl.acs.device_driver.lamp_three_color.LampThreecolorDeviceDriver; -import org.nl.acs.device_driver.lnsh.lnsh_fold_disc_site.LnshFoldDiscSiteDeviceDriver; -import org.nl.acs.device_driver.lnsh.lnsh_station.LnshStationDeviceDriver; -import org.nl.acs.device_driver.basedriver.standard_emptypallet_site.StandardEmptyPalletSiteDeviceDriver; import org.nl.acs.ext.wms.data.AcsToWmsData.feedBackTaskStatus.FeedBackTaskStatusRequest; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.instruction.service.InstructionService; @@ -323,7 +315,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { String plan_code = dto.getRoute_plan_code(); //判断起点终点设备类型 if (routelineserver.getShortPathLines(dto.getStart_device_code(), dto.getNext_device_code(), plan_code).isEmpty() - && routelineserver.getShortPathLines(dto.getStart_device_code2(), dto.getNext_device_code2(), plan_code).isEmpty()) { + && routelineserver.getShortPathLines(dto.getStart_device_code2(), dto.getNext_device_code2(), plan_code).isEmpty()) { throw new Exception(dto.getStart_point_code() + "->" + dto.getNext_point_code() + "路由不通!"); } @@ -485,7 +477,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { request.setRequest_medthod_code(RequestMethodEnum.feedback_task_status.getCode()); request.setRequest_medthod_name(RequestMethodEnum.feedback_task_status.getName()); boolean flag = false; - String resp = null; + String resp = null; try { resp = acstowmsService.applyTask(request); } catch (Exception e) { @@ -541,22 +533,38 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { // 诺力四期 完成任务后更新点位状态 if (RequestMethodEnum.GANTRY_MATERIAL_FINISHED.getCode().equals(entity.getDirection())) { - // 门架上料完成任务 + // 其余物料上料完成任务 WQLObject rpTable = WQLObject.getWQLObject("acs_device_runpoint"); + //起点1 + Device device1 = deviceAppService.findDeviceByCode(entity.getStart_device_code()); + //终点1 Device device2 = deviceAppService.findDeviceByCode(entity.getNext_device_code()); device2.setIslock("0"); - device2.setHas_goods(0); + device2.setHas_goods(1); device2.setMaterial_type("0"); device2.setBatch("0"); - JSONObject update23 = new JSONObject(); - update23.put("islock", "0"); - update23.put("hasgoods", "0"); - update23.put("material_type", "0"); - update23.put("batch", "0"); - update23.put("update_by", "auto"); - update23.put("update_time", DateUtil.now()); - rpTable.update(update23, "device_code = '" + device2.getDevice_code() + "'"); + JSONObject update24 = new JSONObject(); + update24.put("islock", "0"); + update24.put("hasgoods", "1"); + update24.put("material_type", "0"); + update24.put("batch", "0"); + update24.put("update_by", "auto"); + update24.put("update_time", DateUtil.now()); + rpTable.update(update24, "device_code = '" + device2.getDevice_code() + "'"); + + device1.setIslock("0"); + device1.setHas_goods(0); + device1.setMaterial_type("0"); + device1.setBatch("0"); + JSONObject update13 = new JSONObject(); + update13.put("islock", "0"); + update13.put("hasgoods", "0"); + update13.put("material_type", "0"); + update13.put("batch", "0"); + update13.put("update_by", "auto"); + update13.put("update_time", DateUtil.now()); + rpTable.update(update13, "device_code = '" + device1.getDevice_code() + "'"); Device device3 = deviceAppService.findDeviceByCode(entity.getStart_device_code2()); Device device4 = deviceAppService.findDeviceByCode(entity.getNext_device_code2()); @@ -577,7 +585,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { device3.setHas_goods(0); device3.setMaterial_type("0"); device3.setBatch("0"); - rpTable.update(update23, "device_code = '" + device3.getDevice_code() + "'"); + rpTable.update(update13, "device_code = '" + device3.getDevice_code() + "'"); } else if (RequestMethodEnum.CHANNEL_STEEL_MATERIAL_FINISHED.getCode().equals(entity.getDirection())) { // 槽钢上料完成任务 WQLObject rpTable = WQLObject.getWQLObject("acs_device_runpoint"); @@ -586,13 +594,13 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { Device device2 = deviceAppService.findDeviceByCode(entity.getNext_device_code()); device2.setIslock("0"); device2.setHas_goods(1); - device2.setMaterial_type(device1.getMaterial_type()); - device2.setBatch(device1.getBatch()); + device2.setMaterial_type("0"); + device2.setBatch("0"); JSONObject update2 = new JSONObject(); update2.put("islock", "0"); update2.put("hasgoods", "1"); - update2.put("material_type", device1.getMaterial_type()); - update2.put("batch", device1.getBatch()); + update2.put("material_type", "0"); + update2.put("batch", "0"); update2.put("update_by", "auto"); update2.put("update_time", DateUtil.now()); rpTable.update(update2, "device_code = '" + device2.getDevice_code() + "'"); @@ -611,27 +619,28 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { rpTable.update(update13, "device_code = '" + device1.getDevice_code() + "'"); Device device3 = deviceAppService.findDeviceByCode(entity.getStart_device_code2()); - device3.setIslock("0"); - device3.setHas_goods(0); - device3.setMaterial_type("0"); - device3.setBatch("0"); - rpTable.update(update13, "device_code = '" + device3.getDevice_code() + "'"); Device device4 = deviceAppService.findDeviceByCode(entity.getNext_device_code2()); device4.setIslock("0"); device4.setHas_goods(1); - device4.setMaterial_type("0"); - device4.setBatch("0"); + device4.setMaterial_type(device3.getMaterial_type()); + device4.setBatch(device3.getBatch()); JSONObject update4 = new JSONObject(); update4.put("islock", "0"); update4.put("hasgoods", "1"); - update4.put("material_type", "0"); - update4.put("batch", "0"); + update4.put("material_type", device3.getMaterial_type()); + update4.put("batch", device3.getBatch()); update4.put("update_by", "auto"); update4.put("update_time", DateUtil.now()); rpTable.update(update4, "device_code = '" + device4.getDevice_code() + "'"); - } else if (RequestMethodEnum.CHANNEL_STEEL_CALL_MATERIAL.getCode().equals(entity.getDirection())) { - // 槽钢呼叫满料任务 + + device3.setIslock("0"); + device3.setHas_goods(0); + device3.setMaterial_type("0"); + device3.setBatch("0"); + rpTable.update(update13, "device_code = '" + device3.getDevice_code() + "'"); + } else { + //手持任务完成更新点位状态 WQLObject rpTable = WQLObject.getWQLObject("acs_device_runpoint"); Device device1 = deviceAppService.findDeviceByCode(entity.getStart_device_code()); @@ -661,58 +670,6 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { update134.put("update_by", "auto"); update134.put("update_time", DateUtil.now()); rpTable.update(update134, "device_code = '" + device1.getDevice_code() + "'"); - - Device device3 = deviceAppService.findDeviceByCode(entity.getStart_device_code2()); - device3.setIslock("0"); - device3.setHas_goods(0); - device3.setMaterial_type("0"); - device3.setBatch("0"); - rpTable.update(update134, "device_code = '" + device3.getDevice_code() + "'"); - - Device device4 = deviceAppService.findDeviceByCode(entity.getNext_device_code2()); - device4.setIslock("0"); - device4.setHas_goods(0); - device4.setMaterial_type("0"); - device4.setBatch("0"); - rpTable.update(update134, "device_code = '" + device4.getDevice_code() + "'"); - } else if (RequestMethodEnum.PRODUCTION_COMPLETED.getCode().equals(entity.getDirection())) { - // 下料完成任务 - WQLObject rpTable = WQLObject.getWQLObject("acs_device_runpoint"); - - Device device1 = deviceAppService.findDeviceByCode(entity.getStart_device_code()); - device1.setIslock("0"); - device1.setHas_goods(1); - device1.setMaterial_type("0"); - device1.setBatch("0"); - JSONObject update12 = new JSONObject(); - update12.put("islock", "0"); - update12.put("hasgoods", "1"); - update12.put("material_type", "0"); - update12.put("batch", "0"); - update12.put("update_by", "auto"); - update12.put("update_time", DateUtil.now()); - rpTable.update(update12, "device_code = '" + device1.getDevice_code() + "'"); - - Device device2 = deviceAppService.findDeviceByCode(entity.getNext_device_code()); - device2.setIslock("0"); - device2.setHas_goods(1); - device2.setMaterial_type("0"); - device2.setBatch("0"); - rpTable.update(update12, "device_code = '" + device2.getDevice_code() + "'"); - - Device device3 = deviceAppService.findDeviceByCode(entity.getStart_device_code2()); - device3.setIslock("0"); - device3.setHas_goods(0); - device3.setMaterial_type("0"); - device3.setBatch("0"); - JSONObject update3 = new JSONObject(); - update3.put("islock", "0"); - update3.put("hasgoods", "0"); - update3.put("material_type", "0"); - update3.put("batch", "0"); - update3.put("update_by", "auto"); - update3.put("update_time", DateUtil.now()); - rpTable.update(update3, "device_code = '" + device3.getDevice_code() + "'"); } } @@ -769,12 +726,24 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { rpUpdate.put("islock", "0"); rpUpdate.put("update_by", "auto"); rpUpdate.put("update_time", DateUtil.now()); - WQLObject.getWQLObject("acs_device_runpoint").update(rpUpdate, "device_code IN ('" + device1.getDevice_code() + "', '" + device2.getDevice_code() + "', '" + device3.getDevice_code() + "', '" + device4.getDevice_code() + "')"); + String device_code3 = ""; + String device_code4 = ""; + if (device3 != null){ + device_code3 = device3.getDevice_code(); + } + if (device4 != null){ + device_code4 = device4.getDevice_code(); + } + WQLObject.getWQLObject("acs_device_runpoint").update(rpUpdate, "device_code IN ('" + device1.getDevice_code() + "', '" + device2.getDevice_code() + "', '" + device_code3 + "', '" + device_code4 + "')"); device1.setIslock("0"); device2.setIslock("0"); - device3.setIslock("0"); - device4.setIslock("0"); + if (device3 != null) { + device3.setIslock("0"); + } + if (device4 != null) { + device4.setIslock("0"); + } } @Override diff --git a/acs/nladmin-system/src/main/java/org/nl/hand/amb/rest/HFHandController.java b/acs/nladmin-system/src/main/java/org/nl/hand/amb/rest/HFHandController.java index d230a28..ce34051 100644 --- a/acs/nladmin-system/src/main/java/org/nl/hand/amb/rest/HFHandController.java +++ b/acs/nladmin-system/src/main/java/org/nl/hand/amb/rest/HFHandController.java @@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.HashMap; import java.util.Map; /** @@ -37,9 +38,23 @@ public class HFHandController { @SaIgnore //@PreAuthorize("@el.check('sect:list')") public ResponseEntity query() { - return new ResponseEntity<>(handService.queryArea(null), HttpStatus.OK); + return new ResponseEntity<>(handService.queryArea(new HashMap()), HttpStatus.OK); } + + @PostMapping("/designatedRegion") + @Log("查询特定区域区域") + @ApiOperation("查询特定区域") + @SaIgnore + //@PreAuthorize("@el.check('sect:list')") + public ResponseEntity queryDesignatedRegion() { + Map whereJson = new HashMap(); + String region_code = "region_code"; + whereJson.put("region_code", region_code); + return new ResponseEntity<>(handService.queryArea(whereJson), HttpStatus.OK); + } + + @PostMapping("/point") @Log("查询设备编号及状态") @ApiOperation("查询设备编号及状态") @@ -100,7 +115,7 @@ public class HFHandController { return new ResponseEntity<>(handService.queryRouteplanType(), HttpStatus.OK); } - @PostMapping("/task") + @PostMapping("/callTask") @Log("创建任务") @ApiOperation("创建任务") @SaIgnore diff --git a/acs/nladmin-system/src/main/java/org/nl/hand/amb/service/impl/HFHandServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/hand/amb/service/impl/HFHandServiceImpl.java index 1f5e333..7b8b1a8 100644 --- a/acs/nladmin-system/src/main/java/org/nl/hand/amb/service/impl/HFHandServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/hand/amb/service/impl/HFHandServiceImpl.java @@ -67,7 +67,7 @@ public class HFHandServiceImpl implements HFHandService { @Override public Map queryArea(Map whereJson) { JSONObject jo = new JSONObject(); - JSONArray resultJSONArray = WQL.getWO("QJN_QUERY001").addParam("flag", "1").process().getResultJSONArray(0); + JSONArray resultJSONArray = WQL.getWO("QJN_QUERY001").addParam("flag", "1").addParamMap(whereJson).process().getResultJSONArray(0); jo.put("code", "1"); jo.put("desc", "查询成功"); jo.put("result", resultJSONArray); @@ -208,8 +208,8 @@ public class HFHandServiceImpl implements HFHandService { @Override public Map createTask(Map jsonObject) { - String start_devicecode = jsonObject.get("start_devicecode"); - String next_devicecode = jsonObject.get("next_devicecode"); + String start_devicecode = jsonObject.get("start_device_code"); + String next_devicecode = jsonObject.get("next_device_code"); String material_type = jsonObject.get("material_type"); String task_type = jsonObject.get("task_type"); String priority = jsonObject.get("priority"); @@ -232,35 +232,29 @@ public class HFHandServiceImpl implements HFHandService { resultJson.put("result", ""); return resultJson; } -// if (ObjectUtil.isNotEmpty(taskService.findByStartCode(start_devicecode)) || -// ObjectUtil.isNotEmpty(taskService.findByStartCode(next_devicecode))) { -// resultJson.put("code", "2"); -// resultJson.put("desc", "已存在该起点或终点的任务!"); -// resultJson.put("result", ""); -// return resultJson; -// } + //判断起点有货,终点为空 - if (ObjectUtil.isEmpty(startDevice.getMaterial_type()) || Integer.parseInt(startDevice.getMaterial_type()) == 0) { + if (0 == startDevice.getHas_goods() || "1".equals(startDevice.getIslock())) { resultJson.put("code", "0"); - resultJson.put("desc", "起点必须有货"); + resultJson.put("desc", "起点无货或者起点已锁定"); resultJson.put("result", ""); return resultJson; } - if (!ObjectUtil.isEmpty(nextDevice.getMaterial_type()) && !StrUtil.equals(nextDevice.getMaterial_type(), "0")) { - resultJson.put("code", "0"); - resultJson.put("desc", "终点必须为空"); - resultJson.put("result", ""); - return resultJson; - } - if (Boolean.parseBoolean(startDevice.getIslock()) || Boolean.parseBoolean(nextDevice.getIslock())) { + + if (1 == nextDevice.getHas_goods() || "1".equals(nextDevice.getIslock())) { resultJson.put("code", "0"); - resultJson.put("desc", "起点或终点设备已被锁定"); + resultJson.put("desc", "终点有货或者终点已锁定"); resultJson.put("result", ""); return resultJson; } + if (StrUtil.isEmpty(priority)) { priority = "1"; } + if (StrUtil.isEmpty(task_type)) { + //3代表手持任务 + task_type = "3"; + } if (start_devicecode.equals(next_devicecode)) { resultJson.put("code", "0"); @@ -282,8 +276,13 @@ public class HFHandServiceImpl implements HFHandService { dto.setVehicle_code(carrier); try { taskService.create(dto); - startDevice.setIslock("true"); - nextDevice.setIslock("true"); + startDevice.setIslock("1"); + nextDevice.setIslock("1"); + JSONObject rpUpdate = new JSONObject(); + rpUpdate.put("islock", "1"); + rpUpdate.put("update_by", "sc"); + rpUpdate.put("update_time", DateUtil.now()); + WQLObject.getWQLObject("acs_device_runpoint").update(rpUpdate, "device_code IN ('" + start_devicecode + "', '" + next_devicecode + "')"); } catch (Exception e) { resultJson.put("code", "0"); resultJson.put("desc", e.getMessage()); diff --git a/acs/nladmin-system/src/main/java/org/nl/hand/amb/wql/QJN_QUERY001.wql b/acs/nladmin-system/src/main/java/org/nl/hand/amb/wql/QJN_QUERY001.wql index 475c96d..d4024c3 100644 --- a/acs/nladmin-system/src/main/java/org/nl/hand/amb/wql/QJN_QUERY001.wql +++ b/acs/nladmin-system/src/main/java/org/nl/hand/amb/wql/QJN_QUERY001.wql @@ -19,6 +19,7 @@ 输入.start_point TYPEAS s_string 输入.next_point TYPEAS s_string 输入.detail_id TYPEAS s_string + 输入.region_code TYPEAS s_string @@ -52,6 +53,9 @@ sys_dict_detail WHERE `name` = 'region' + OPTION 输入.region_code <> "" + value in ('2','3') + ENDOPTION ENDSELECT ENDQUERY ENDIF 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 bfdb6b3..a776662 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 @@ -6,12 +6,6 @@ import cn.hutool.core.util.StrUtil; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ObjectUtils; import org.nl.acs.config.AcsConfig; -import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver; -import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver; -import org.nl.acs.device_driver.lamp_three_color.LampThreecolorDeviceDriver; -import org.nl.acs.device_driver.lnsh.lnsh_fold_disc_site.LnshFoldDiscSiteDeviceDriver; -import org.nl.acs.device_driver.lnsh.lnsh_station.LnshStationDeviceDriver; -import org.nl.acs.device_driver.basedriver.standard_emptypallet_site.StandardEmptyPalletSiteDeviceDriver; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.dto.Instruction; import org.nl.acs.opc.Device; @@ -37,6 +31,7 @@ public class AutoCreateInst { /** * 根据任务状态创建指令、生成下一条指令 * 创建指令前需要判断是否条件具备:起始位置是否有货、目标位置是否有货 + * task_type == 3代表手持任务类型 */ public void run() throws Exception { TaskService taskserver = SpringContextHolder.getBean(TaskService.class); @@ -76,13 +71,13 @@ public class AutoCreateInst { taskserver.updateByCodeFromCache(acsTask); continue; } - if (StrUtil.isEmpty(start_device_code2)) { + if (StrUtil.isEmpty(start_device_code2) && !"3".equals(acsTask.getTask_type())) { log.info("任务 [" + taskcode + "] 起点设备2为空,无法生成指令。"); acsTask.setRemark("任务 [" + taskcode + "] 起点设备2为空,无法生成指令。"); taskserver.updateByCodeFromCache(acsTask); continue; } - if (StrUtil.isEmpty(next_device_code2)) { + if (StrUtil.isEmpty(next_device_code2) && !"3".equals(acsTask.getTask_type())) { log.info("任务 [" + taskcode + "] 终点设备为2空,无法生成指令。"); acsTask.setRemark("任务 [" + taskcode + "] 终点设备2为空,无法生成指令。"); taskserver.updateByCodeFromCache(acsTask); @@ -137,7 +132,7 @@ public class AutoCreateInst { //校验路由关系 List shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code); List shortPathsList2 = routeLineService.getShortPathLines(start_device_code2, next_device_code2, route_plan_code); - if (ObjectUtils.isEmpty(shortPathsList) || ObjectUtils.isEmpty(shortPathsList2)) { + if (ObjectUtils.isEmpty(shortPathsList) || (ObjectUtils.isEmpty(shortPathsList2) && !"3".equals(acsTask.getTask_type()))) { log.info("任务 [" + taskcode + "] 路由不通无法生成指令。"); acsTask.setRemark("任务 [" + taskcode + "] 路由不通无法生成指令。"); taskserver.updateByCodeFromCache(acsTask); @@ -159,11 +154,11 @@ public class AutoCreateInst { log.info("任务 [" + taskcode + "] 终点设备编码 [" + next_device_code + "] 对应设备未找到,无法生成指令。"); continue; } - if (ObjectUtils.isEmpty(startdevice2)) { + if (ObjectUtils.isEmpty(startdevice2) && !"3".equals(acsTask.getTask_type())) { log.info("任务 [" + taskcode + "] 起点设备2编码 [" + start_device_code + "] 对应设备未找到,无法生成指令。"); continue; } - if (ObjectUtils.isEmpty(nextdevice2)) { + if (ObjectUtils.isEmpty(nextdevice2) && !"3".equals(acsTask.getTask_type())) { log.info("任务 [" + taskcode + "] 终点设备2编码 [" + next_device_code + "] 对应设备未找到,无法生成指令。"); continue; } diff --git a/acs/nladmin-ui/src/views/acs/device/driver/nl4/nl4_station.vue b/acs/nladmin-ui/src/views/acs/device/driver/nl4/nl4_station.vue index b17fe8a..936b972 100644 --- a/acs/nladmin-ui/src/views/acs/device/driver/nl4/nl4_station.vue +++ b/acs/nladmin-ui/src/views/acs/device/driver/nl4/nl4_station.vue @@ -101,7 +101,7 @@ - + - + - - - - - - - - - - - - - - - - - + - + - - - - - - - - - - - - - - - - - + - +