From ce325a6e387713fbb80cbb4bf748214a9d49b714 Mon Sep 17 00:00:00 2001 From: gengby <858962040@qq.com> Date: Tue, 29 Nov 2022 16:25:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rest/InstructionController.java | 8 ++ .../service/impl/InstructionServiceImpl.java | 4 +- .../org/nl/hand/rest/HFHandController.java | 16 +++- .../org/nl/hand/service/HFHandService.java | 7 ++ .../hand/service/impl/HFHandServiceImpl.java | 38 ++++++++- .../modules/quartz/task/AutoCreateInst.java | 84 +++++++++++++++---- .../src/api/acs/instruction/instruction.js | 10 ++- .../src/views/acs/instruction/index.vue | 12 +++ .../src/views/acs/route/routeLine/index.vue | 7 ++ 9 files changed, 161 insertions(+), 25 deletions(-) diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/instruction/rest/InstructionController.java b/acs/nladmin-system/src/main/java/org/nl/acs/instruction/rest/InstructionController.java index 644f971..d5e32a9 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/instruction/rest/InstructionController.java +++ b/acs/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.cancelNOSendAgv(id); + return new ResponseEntity<>(HttpStatus.OK); + } + @Log("导出指令") @ApiOperation("导出指令") @GetMapping(value = "/download") 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 c21a943..9d02c84 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 @@ -363,8 +363,8 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu } try { - String start_device_code = task.getStart_device_code(); - String next_device_code = task.getNext_device_code(); + String start_device_code = dto.getStart_device_code(); + String next_device_code = dto.getNext_device_code(); String route_plan_code = task.getRoute_plan_code(); List shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code); RouteLineDto route = null; diff --git a/acs/nladmin-system/src/main/java/org/nl/hand/rest/HFHandController.java b/acs/nladmin-system/src/main/java/org/nl/hand/rest/HFHandController.java index 2483dd9..37b2a99 100644 --- a/acs/nladmin-system/src/main/java/org/nl/hand/rest/HFHandController.java +++ b/acs/nladmin-system/src/main/java/org/nl/hand/rest/HFHandController.java @@ -1,6 +1,7 @@ package org.nl.hand.rest; import cn.dev33.satoken.annotation.SaIgnore; +import com.alibaba.fastjson.JSONObject; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; @@ -9,10 +10,7 @@ import org.nl.hand.service.HFHandService; import org.nl.modules.logging.annotation.Log; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.Map; @@ -172,4 +170,14 @@ public class HFHandController { return new ResponseEntity<>(HandService.queryDevice(), HttpStatus.OK); } + @PostMapping("/queryStorageExtra") + @Log("查询货架扩展信息") + @ApiOperation("查询货架扩展信息") + @SaIgnore + //@PreAuthorize("@el.check('sect:list')") + //@RequestBody JSONObject json + public ResponseEntity queryStorageExtra(@RequestBody JSONObject storage_code) { + return new ResponseEntity<>(HandService.queryStorageExtra(storage_code.getString("storage_code")), HttpStatus.OK); + } + } diff --git a/acs/nladmin-system/src/main/java/org/nl/hand/service/HFHandService.java b/acs/nladmin-system/src/main/java/org/nl/hand/service/HFHandService.java index 9dd24c4..e37acd1 100644 --- a/acs/nladmin-system/src/main/java/org/nl/hand/service/HFHandService.java +++ b/acs/nladmin-system/src/main/java/org/nl/hand/service/HFHandService.java @@ -2,6 +2,8 @@ package org.nl.hand.service; +import com.alibaba.fastjson.JSONObject; + import java.util.Map; /** @@ -114,4 +116,9 @@ public interface HFHandService { Map createTask2(Map whereJson); Map queryDevice(); + + /** + * 根据货架号,查询扩展信息 + */ + JSONObject queryStorageExtra(String device_code); } diff --git a/acs/nladmin-system/src/main/java/org/nl/hand/service/impl/HFHandServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/hand/service/impl/HFHandServiceImpl.java index 84b0f8d..cef9af3 100644 --- a/acs/nladmin-system/src/main/java/org/nl/hand/service/impl/HFHandServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/hand/service/impl/HFHandServiceImpl.java @@ -292,6 +292,10 @@ public class HFHandServiceImpl implements HFHandService { String priority = jsonObject.get("priority"); String carrier = jsonObject.get("carrier"); String emptypallet_num = jsonObject.get("emptypallet_num"); + String form_y = jsonObject.get("form_y"); + String form_z = jsonObject.get("form_z"); + String to_y = jsonObject.get("to_y"); + String to_z = jsonObject.get("to_z"); JSONObject resultJson = new JSONObject(); DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); @@ -360,11 +364,19 @@ public class HFHandServiceImpl implements HFHandService { dto.setMaterial(material_type); dto.setStart_point_code(start_devicecode); dto.setNext_point_code(next_devicecode); + dto.setStart_device_code(start_devicecode); + dto.setNext_device_code(next_devicecode); dto.setMaterial(material_type); dto.setTask_type(task_type); dto.setPriority(priority); dto.setVehicle_code(carrier); dto.setEmptypallet_num(emptypallet_num); + dto.setFrom_x("1"); + dto.setFrom_y(form_y); + dto.setFrom_z(form_z); + dto.setTo_x("1"); + dto.setTo_y(to_y); + dto.setTo_z(to_z); try { taskService.create(dto); // startDevice.setIslock("true"); @@ -772,10 +784,34 @@ public class HFHandServiceImpl implements HFHandService { public Map queryDevice() { WQLObject wo = WQLObject.getWQLObject("acs_device"); JSONArray resultJSONArray = wo.query("1 = 1", "device_code").getResultJSONArray(0); + JSONArray js = new JSONArray(); + for (int i = 0; i < resultJSONArray.size(); i++) { + JSONObject jsonObject = resultJSONArray.getJSONObject(i); + JSONObject map = new JSONObject(); + map.put("device_id",jsonObject.getString("device_id")); + map.put("device_code",jsonObject.getString("device_code")); + map.put("device_name",jsonObject.getString("device_name")); + map.put("device_type",jsonObject.getString("device_type")); + js.add(map); + } JSONObject jo = new JSONObject(); jo.put("code", "1"); jo.put("desc", "查询成功"); - jo.put("result", resultJSONArray); + jo.put("result", js); + return jo; + } + + @Override + public JSONObject queryStorageExtra(String device_code) { + JSONObject device = WQLObject.getWQLObject("acs_device").query("device_code = '" + device_code + "'").uniqueResult(0); + String device_id = device.getString("device_id"); + WQLObject wo = WQLObject.getWQLObject("acs_device_extra"); + JSONObject jo = new JSONObject(); + jo.put("maxY", wo.query("device_id = '" + device_id + "' AND extra_code = 'maxY'").uniqueResult(0).getString("extra_value")); + jo.put("minY", wo.query("device_id = '" + device_id + "' AND extra_code = 'minY'").uniqueResult(0).getString("extra_value")); + jo.put("maxZ", wo.query("device_id = '" + device_id + "' AND extra_code = 'maxZ'").uniqueResult(0).getString("extra_value")); + jo.put("minZ", wo.query("device_id = '" + device_id + "' AND extra_code = 'minZ'").uniqueResult(0).getString("extra_value")); + //jo.put("tunnel", wo.query("device_id = '" + device_id + "' AND extra_code = 'tunnel'").uniqueResult(0).getString("extra_value")); return jo; } } 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 be68a17..ff0b8d5 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 @@ -7,6 +7,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ObjectUtils; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.dto.Instruction; +import org.nl.acs.opc.Device; import org.nl.acs.opc.DeviceAppService; import org.nl.acs.opc.DeviceAppServiceImpl; import org.nl.acs.route.service.RouteLineService; @@ -58,19 +59,46 @@ public class AutoCreateInst { if(StrUtil.equals(is_send,"0")){ continue; } - 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; - } - - if (!StrUtil.equals(shortPathsList.get(0).getType(), "1")) { - continue; - } +// 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; +// } +// +// 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; +// } +// } + /** + * 开始平均分解校验 + */ + String this_device_code = taskserver.queryAssignedByDevice(acsTask.getStart_device_code(), acsTask.getNext_device_code()); + if (StrUtil.isEmpty(this_device_code)) { + List shortPathsList = routeLineService.getShortPathLines(start_device_code, acsTask.getNext_device_code(), route_plan_code); RouteLineDto routeLineDto = shortPathsList.get(0); String path = routeLineDto.getPath(); String type = routeLineDto.getType(); @@ -84,12 +112,34 @@ public class AutoCreateInst { } } next_device_code = pathlist.get(index); + } else { + next_device_code = this_device_code; + } + //校验路由关系 + 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(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; + } + Device startdevice = appService.findDeviceByCode(start_device_code); + Device nextdevice = appService.findDeviceByCode(next_device_code); + 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 (ObjectUtils.isEmpty(appService)) { + log.info("地址对应设备未找到"); + continue; + } + if (ObjectUtils.isEmpty(startdevice)) { + log.info("地址对应设备未找到"); + continue; } Instruction instdto = new Instruction(); diff --git a/acs/nladmin-ui/src/api/acs/instruction/instruction.js b/acs/nladmin-ui/src/api/acs/instruction/instruction.js index 12aea74..eda24eb 100644 --- a/acs/nladmin-ui/src/api/acs/instruction/instruction.js +++ b/acs/nladmin-ui/src/api/acs/instruction/instruction.js @@ -62,4 +62,12 @@ export function reload() { }) } -export default { add, edit, del, finish, cancel, queryUnFinish, queryByTaskId, reload } +export function forceCancel(instruction_id) { + return request({ + url: 'api/instruction/forceCancel/' + instruction_id, + method: 'post', + data: instruction_id + }) +} + +export default { add, edit, del, finish, cancel, queryUnFinish, queryByTaskId, reload, forceCancel } diff --git a/acs/nladmin-ui/src/views/acs/instruction/index.vue b/acs/nladmin-ui/src/views/acs/instruction/index.vue index 7e82e25..d69b0ca 100644 --- a/acs/nladmin-ui/src/views/acs/instruction/index.vue +++ b/acs/nladmin-ui/src/views/acs/instruction/index.vue @@ -160,6 +160,7 @@ 完成 取消 + 强制取消 @@ -290,6 +291,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() @@ -313,6 +322,9 @@ export default { case 'b':// 取消 this.cancel(command.index, command.row) break + case 'c':// 强制取消 + this.forceCancel(command.index, command.row) + break } } diff --git a/acs/nladmin-ui/src/views/acs/route/routeLine/index.vue b/acs/nladmin-ui/src/views/acs/route/routeLine/index.vue index 39cfb22..21fc73f 100644 --- a/acs/nladmin-ui/src/views/acs/route/routeLine/index.vue +++ b/acs/nladmin-ui/src/views/acs/route/routeLine/index.vue @@ -313,6 +313,13 @@ export default { this.form.next_device_code = Array.of(data.form.next_device_code.split('').join('')) return true }, + [CRUD.HOOK.beforeSubmit](data) { + if (this.crud.status.edit === 1) { + this.form.device_code = data.form.device_code.join('') + this.form.next_device_code = data.form.next_device_code.join('') + } + return true + }, // 改变状态 changeEnabled(data) { var msg = '停用'