diff --git a/hd/nladmin-system/src/main/java/org/nl/acs/instruction/rest/InstructionController.java b/hd/nladmin-system/src/main/java/org/nl/acs/instruction/rest/InstructionController.java index b6dec60..fb799fd 100644 --- a/hd/nladmin-system/src/main/java/org/nl/acs/instruction/rest/InstructionController.java +++ b/hd/nladmin-system/src/main/java/org/nl/acs/instruction/rest/InstructionController.java @@ -108,6 +108,14 @@ public class InstructionController { return new ResponseEntity<>(HttpStatus.OK); } + @Log("强制取消指令") + @ApiOperation("强制取消指令") + @PostMapping(value = "/forceCancel/{id}") + public ResponseEntity forceCancel(@RequestBody String id) throws Exception { + instructionService.forceCancel(id); + return new ResponseEntity<>(HttpStatus.OK); + } + @Log("导出指令") @ApiOperation("导出指令") @GetMapping(value = "/download") diff --git a/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/InstructionService.java b/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/InstructionService.java index 1da7904..119eeaa 100644 --- a/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/InstructionService.java +++ b/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/InstructionService.java @@ -162,6 +162,13 @@ public interface InstructionService { */ void cancel(String id) throws Exception; + /** + * 强制取消指令 + * + * @param id + */ + void forceCancel(String id) throws Exception; + /** * 取消指令不下发agv * diff --git a/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java index 7f9fae2..bc70bed 100644 --- a/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java +++ b/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java @@ -950,6 +950,48 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu } + @Override + public void forceCancel(String id) throws Exception { + //flag= true时取消指令 + boolean flag = false; + Instruction entity = this.findById(id); + if (entity == null) { + throw new BadRequestException("被删除或无权限,操作失败!"); + } + TaskDto task = taskService.findByCodeFromCache(entity.getTask_code()); + if (StrUtil.isEmpty(entity.getRoute_plan_code())) { + entity.setRoute_plan_code(task.getRoute_plan_code()); + } + String currentUsername = SecurityUtils.getCurrentUsername(); + String now = DateUtil.now(); + entity.setUpdate_time(now); + entity.setUpdate_by(currentUsername); + entity.setInstruction_status("3"); + WQLObject wo = WQLObject.getWQLObject("acs_instruction"); + JSONObject json = JSONObject.fromObject(entity); + wo.update(json); + DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); + DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class); + + String instnextdevice = entity.getNext_device_code(); + Device device = appService.findDeviceByCode(instnextdevice); + if (device == null) { + log.debug("地址对应设备未找到"); + return; + } + LampThreecolorDeviceDriver lampThreecolorDeviceDriver; + //变更三色灯状态 + if (!ObjectUtils.isEmpty(device.getExtraValue().get("link_three_lamp"))) { + String lamd_device = device.getExtraValue().get("link_three_lamp").toString(); + Device lamddevice = appService.findDeviceByCode(lamd_device); + if (lamddevice.getDeviceDriver() instanceof LampThreecolorDeviceDriver) { + lampThreecolorDeviceDriver = (LampThreecolorDeviceDriver) lamddevice.getDeviceDriver(); + lampThreecolorDeviceDriver.writing(0); + } + } + removeByCodeFromCache(entity.getInstruction_code()); + } + @Override public void cancelNOSendAgv(String id) throws Exception { //flag= true时取消指令 diff --git a/qd/src/App.vue b/qd/src/App.vue index ec9032c..2f82bcc 100644 --- a/qd/src/App.vue +++ b/qd/src/App.vue @@ -1,11 +1,36 @@ diff --git a/qd/src/api/acs/instruction/instruction.js b/qd/src/api/acs/instruction/instruction.js index 38169fd..02c7ac1 100644 --- a/qd/src/api/acs/instruction/instruction.js +++ b/qd/src/api/acs/instruction/instruction.js @@ -41,6 +41,14 @@ export function cancel(instruction_id) { }) } +export function forceCancel(instruction_id) { + return request({ + url: 'api/instruction/forceCancel/' + instruction_id, + method: 'post', + data: instruction_id + }) +} + export function queryUnFinish() { return request({ url: 'api/instruction/unfinish/', @@ -63,4 +71,4 @@ export function reload() { }) } -export default { add, edit, del, finish, cancel, queryUnFinish, queryByTaskId,reload } +export default { add, edit, del, finish, cancel, forceCancel, queryUnFinish, queryByTaskId,reload } diff --git a/qd/src/views/acs/instruction/index.vue b/qd/src/views/acs/instruction/index.vue index 2195918..e52dde8 100644 --- a/qd/src/views/acs/instruction/index.vue +++ b/qd/src/views/acs/instruction/index.vue @@ -159,6 +159,7 @@ 完成 取消 + 强制取消 @@ -291,6 +292,14 @@ export default { console.log(err.response.data.message) }) }, + forceCancel(index, row) { + crudInstruction.forceCancel(row.instruction_id).then(res => { + this.crud.toQuery() + this.crud.notify('取消成功', CRUD.NOTIFICATION_TYPE.SUCCESS) + }).catch(err => { + console.log(err.response.data.message) + }) + }, reload() { crudInstruction.reload().then(res => { this.crud.toQuery() @@ -314,6 +323,9 @@ export default { case 'b':// 取消 this.cancel(command.index, command.row) break + case 'c':// 取消 + this.forceCancel(command.index, command.row) + break } }