diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/AgvServiceImpl.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/AgvServiceImpl.java index af007ec..838755c 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/AgvServiceImpl.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/AgvServiceImpl.java @@ -742,12 +742,14 @@ public class AgvServiceImpl implements AgvService { if ("Load".equals(action)) { if (lnshStationDeviceDriver.getMode() == 2 && lnshStationDeviceDriver.getMove() > 0) { inst.setExecute_status("1"); + lnshStationDeviceDriver.setFlag(1); is_feedback = true; } //请求放货 } else if ("Unload".equals(action)) { if (lnshStationDeviceDriver.getMode() == 2 && lnshStationDeviceDriver.getMove() == 0) { inst.setExecute_status("3"); + lnshStationDeviceDriver.setFlag(3); is_feedback = true; } } @@ -769,23 +771,6 @@ public class AgvServiceImpl implements AgvService { } } } - //晟华码垛机械手 - if (addressdevice.getDeviceDriver() instanceof LnshPalletizingManipulatorDeviceDriver) { - lnshPalletizingManipulatorDeviceDriver = (LnshPalletizingManipulatorDeviceDriver) addressdevice.getDeviceDriver(); - //请求取货 - if ("Load".equals(action)) { - if (lnshPalletizingManipulatorDeviceDriver.getMode() == 2) { - inst.setExecute_status("1"); - is_feedback = true; - } - //请求放货 - } else if ("Unload".equals(action)) { - if (lnshPalletizingManipulatorDeviceDriver.getMode() == 2) { - inst.setExecute_status("3"); - is_feedback = true; - } - } - } if (addressdevice.getDeviceDriver() instanceof SpecialOrdinarySiteDeviceDriver) { specialOrdinarySiteDeviceDriver = (SpecialOrdinarySiteDeviceDriver) addressdevice.getDeviceDriver(); //请求取货 @@ -862,6 +847,7 @@ public class AgvServiceImpl implements AgvService { if (lnshStationDeviceDriver.getMode() == 2 && lnshStationDeviceDriver.getMove() == 0) { inst.setExecute_device_code(processingVehicle); inst.setExecute_status("2"); + lnshStationDeviceDriver.setFlag(2); is_feedback = true; } //放货完成 @@ -869,6 +855,7 @@ public class AgvServiceImpl implements AgvService { if (lnshStationDeviceDriver.getMode() == 2 && lnshStationDeviceDriver.getMove() > 0) { inst.setExecute_device_code(address); inst.setExecute_status("4"); + lnshStationDeviceDriver.setFlag(4); is_feedback = true; } } @@ -892,25 +879,6 @@ public class AgvServiceImpl implements AgvService { } } } - //晟华码垛机械手 - if (addressdevice.getDeviceDriver() instanceof LnshPalletizingManipulatorDeviceDriver) { - lnshPalletizingManipulatorDeviceDriver = (LnshPalletizingManipulatorDeviceDriver) addressdevice.getDeviceDriver(); - //取货完成 - if ("Load".equals(action)) { - if (lnshPalletizingManipulatorDeviceDriver.getMode() == 2) { - inst.setExecute_device_code(processingVehicle); - inst.setExecute_status("2"); - is_feedback = true; - } - //放货完成 - } else if ("Unload".equals(action)) { - if (lnshPalletizingManipulatorDeviceDriver.getMode() == 2) { - inst.setExecute_device_code(address); - inst.setExecute_status("4"); - is_feedback = true; - } - } - } if (addressdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) addressdevice.getDeviceDriver(); //取货完成 @@ -1294,21 +1262,22 @@ public class AgvServiceImpl implements AgvService { } @Override - public String requestOpenOrCloseDoor(String device, String param) { - log.info("AGV请求开关门参数,设备:{},参数:{}", device, param); + public String requestOpenOrCloseDoor(String device_code, String param) { + log.info("AGV请求开关门参数,设备:{},参数:{}", device_code, param); int type = Integer.parseInt(acsConfigService.findConfigFromCache().get(AcsConfig.BUSINESSTYPE)); switch (type) { case 4: - acsToWmsService.applyOpenOrCloseDoor(device, param); + acsToWmsService.applyOpenOrCloseDoor(device_code, param); break; default: StandardAutodoorDeviceDriver autodoor; - Device doordevice = deviceAppService.findDeviceByCode(device); - if (ObjectUtil.isEmpty(doordevice)) { + LnshStationDeviceDriver lnshStationDeviceDriver; + Device device = deviceAppService.findDeviceByCode(device_code); + if (ObjectUtil.isEmpty(device)) { throw new BadRequestException("未找到对应设备"); } - if (doordevice.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) { - autodoor = (StandardAutodoorDeviceDriver) doordevice.getDeviceDriver(); + if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) { + autodoor = (StandardAutodoorDeviceDriver) device.getDeviceDriver(); if (StrUtil.equals("open", param)) { autodoor.OpenOrClose("1"); log.info("下发开门请求"); @@ -1318,6 +1287,17 @@ public class AgvServiceImpl implements AgvService { log.info("下发关门请求"); } } + if (device.getDeviceDriver() instanceof LnshStationDeviceDriver) { + lnshStationDeviceDriver = (LnshStationDeviceDriver) device.getDeviceDriver(); + if (StrUtil.equals("open", param)) { + lnshStationDeviceDriver.OpenOrClose("1"); + log.info("下发进入区域"); + + } else if (StrUtil.equals("close", param)) { + lnshStationDeviceDriver.OpenOrClose("2"); + log.info("下发离开区域"); + } + } break; } diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDeviceDriver.java index 01cd82f..3462b82 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDeviceDriver.java @@ -664,6 +664,17 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD if (!requireSucess) { applyEmpty(); } + case 9: + //工单完成 + if (!requireSucess && order_No != 0) { + JSONObject json = new JSONObject(); + json.put("producetask_code",order_No); + json.put("device_code",this.device_code); + json.put("material_code",material); + json.put("qty",qty); + json.put("type","3"); + enterProduction(json); + } break; } @@ -778,7 +789,11 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD if (result.getStatus() == 200) { this.writing(this.mode); ProduceshiftorderDto dto = produceshiftorderService.findByCode(String.valueOf(order_No)); - dto.setOrder_status("0"); + if (this.mode == 4) { + dto.setOrder_status("0"); + } else if (this.mode == 9){ + dto.setOrder_status("2"); + } produceshiftorderService.update(dto); } requireSucess = true; @@ -870,6 +885,7 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD this.writing(this.mode); this.writing("to_material_qty",qty); this.writing("to_material_code",material_code); + this.writing("to_product_code",product_code); this.writing("to_AlongSide",AlongSide); this.writing("to_BshortSide",BshortSide); this.writing("to_Htrapezoidal",Htrapezoidal); diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDeviceDriver.java index 4570256..a9815a5 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDeviceDriver.java @@ -227,6 +227,17 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements } break; } + + switch (flag) { + //取货完成 + case 2: + writing(2); + return; + //放货完成 + case 4: + writing(3); + return; + } } last_mode = mode; @@ -392,12 +403,24 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements } public void writing(int command) { - + String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + ItemProtocol.item_to_command; String opcservcerid = this.getDevice().getOpc_server_id(); Server server = ReadUtil.getServer(opcservcerid); Map itemMap = new HashMap(); + itemMap.put(to_command, command); ReadUtil.write(itemMap, server); + } + + public synchronized void OpenOrClose(String type) { + //进入区域 + if ("1".equals(type)) { + writing(5); + } else { + //离开区域 + writing(6); + } } public String toString() { diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/order/rest/ProduceshiftorderController.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/order/rest/ProduceshiftorderController.java index f3e1ccc..0d596fd 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/order/rest/ProduceshiftorderController.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/order/rest/ProduceshiftorderController.java @@ -72,4 +72,13 @@ public class ProduceshiftorderController { public void download(HttpServletResponse response, @RequestParam Map whereJson) throws IOException { produceshiftorderService.download(produceshiftorderService.queryAll(whereJson), response); } + + @Log("完成工单") + @ApiOperation("完成工单") + @PostMapping(value = "/finish/{id}") + //@PreAuthorize("@el.check('produceshiftorder:list')") + public ResponseEntity finish(@RequestBody String id) throws IOException { + produceshiftorderService.finish(id); + return new ResponseEntity<>(HttpStatus.OK); + } } diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/order/service/ProduceshiftorderService.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/order/service/ProduceshiftorderService.java index c82db20..8d73873 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/order/service/ProduceshiftorderService.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/order/service/ProduceshiftorderService.java @@ -70,4 +70,11 @@ public interface ProduceshiftorderService { * @throws IOException / */ void download(List dtos, HttpServletResponse response) throws IOException; + + /** + * 完成工单 + * + * @param ids + */ + void finish(String ids); } diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderServiceImpl.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderServiceImpl.java index 0ba4188..127ece0 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderServiceImpl.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderServiceImpl.java @@ -147,4 +147,11 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService { } FileUtil.downloadExcel(list, response); } + + @Override + public void finish(String ids) { + ProduceshiftorderDto dto = this.findById(ids); + dto.setOrder_status("3"); + this.update(dto); + } } diff --git a/acs/qd/src/api/acs/produceshiftorder/produceshiftorder.js b/acs/qd/src/api/acs/produceshiftorder/produceshiftorder.js index ab22211..d35c785 100644 --- a/acs/qd/src/api/acs/produceshiftorder/produceshiftorder.js +++ b/acs/qd/src/api/acs/produceshiftorder/produceshiftorder.js @@ -24,4 +24,12 @@ export function edit(data) { }) } -export default { add, edit, del } +export function finish(order_id) { + return request({ + url: 'api/produceshiftorder/finish/' + order_id, + method: 'post', + data: order_id + }) +} + +export default { add, edit, del, finish } diff --git a/acs/qd/src/views/acs/device/driver/lnsh/lnsh_rgv.vue b/acs/qd/src/views/acs/device/driver/lnsh/lnsh_rgv.vue index 824ee97..ee43a40 100644 --- a/acs/qd/src/views/acs/device/driver/lnsh/lnsh_rgv.vue +++ b/acs/qd/src/views/acs/device/driver/lnsh/lnsh_rgv.vue @@ -55,6 +55,53 @@ + + + + + + + + + + + + + + + + + + + @@ -282,6 +329,9 @@ export default { opc_id: '', opc_code: '', configLoading: false, + get_device_code: '', + load_device_code: '', + put_device_code: '', dataOpcservers: [], dataOpcPlcs: [], deviceList: [], diff --git a/acs/qd/src/views/acs/produceshiftorder/index.vue b/acs/qd/src/views/acs/produceshiftorder/index.vue index 303229f..03f171c 100644 --- a/acs/qd/src/views/acs/produceshiftorder/index.vue +++ b/acs/qd/src/views/acs/produceshiftorder/index.vue @@ -59,6 +59,18 @@ + + + @@ -134,6 +146,29 @@ export default { [CRUD.HOOK.beforeRefresh]() { return true } + }, + beforeHandleCommand(index, row, command) { + return { + 'index': index, + 'row': row, + 'command': command + } + }, + finish(index, row) { + debugger + crudProduceshiftorder.finish(row.order_id).then(res => { + this.crud.toQuery() + this.crud.notify('完成成功', CRUD.NOTIFICATION_TYPE.SUCCESS) + }).catch(err => { + console.log(err.response.data.message) + }) + }, + handleCommand(command) { + switch (command.command) { + case 'a':// 完成 + this.finish(command.index, command.row) + break + } } }