From b5e822a8ab2fb806cebdf6bc63bc9fc4689544a9 Mon Sep 17 00:00:00 2001 From: gengby <858962040@qq.com> Date: Sat, 28 Jan 2023 09:40:06 +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 --- .../acs/hand/amb/rest/AMHandController.java | 7 ++-- .../amb/service/impl/AMHandServiceImpl.java | 13 +++--- .../modules/quartz/task/AutoCreateInst.java | 41 ++++++++++--------- 3 files changed, 32 insertions(+), 29 deletions(-) diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/hand/amb/rest/AMHandController.java b/acs/nladmin-system/src/main/java/org/nl/acs/hand/amb/rest/AMHandController.java index b286cba..706e5bc 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/hand/amb/rest/AMHandController.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/hand/amb/rest/AMHandController.java @@ -37,12 +37,13 @@ public class AMHandController { return new ResponseEntity<>(HandService.queryArea(null), HttpStatus.OK); } - @PostMapping("/queryPointByArea/{areaCode}") + @PostMapping("/queryPointByArea") @Log("根据区域查询点位") @ApiOperation("根据区域查询点位") @SaIgnore //@PreAuthorize("@el.check('sect:list')") - public ResponseEntity queryPointByArea(@PathVariable String areaCode) { + public ResponseEntity queryPointByArea(@RequestBody JSONObject jsonObject) { + String areaCode = jsonObject.getString("areaCode"); return new ResponseEntity<>(HandService.queryPointByArea(areaCode), HttpStatus.OK); } @@ -55,7 +56,7 @@ public class AMHandController { return new ResponseEntity<>(HandService.queryMaterial(), HttpStatus.OK); } - @PostMapping("/bindPoint") + @PostMapping("/bindpoint") @Log("点位绑定") @ApiOperation("点位绑定") @SaIgnore diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/hand/amb/service/impl/AMHandServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/hand/amb/service/impl/AMHandServiceImpl.java index 73fa760..e6bb87d 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/hand/amb/service/impl/AMHandServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/hand/amb/service/impl/AMHandServiceImpl.java @@ -650,7 +650,7 @@ public class AMHandServiceImpl implements AMHandService { String device_code = MapUtil.getStr(reqParam, "device_code"); String material_type = MapUtil.getStr(reqParam, "material_type"); String type = MapUtil.getStr(reqParam, "type"); - String status = MapUtil.getStr(reqParam, "status"); + String status = "0"; JSONObject jo = new JSONObject(); if (StrUtil.isEmpty(type)) { jo.put("code", "0"); @@ -662,15 +662,14 @@ public class AMHandServiceImpl implements AMHandService { jo.put("desc", "失败,设备号不能为空!"); return jo; } - if (StrUtil.isNotEmpty(material_type) && StrUtil.equals(status, "0")) { + if (StrUtil.isEmpty(material_type)) { jo.put("code", "0"); - jo.put("desc", "失败,点位带有物料信息与无货状态不符合!"); - return jo; - } else if (StrUtil.isEmpty(material_type) && !StrUtil.equals(status, "0")) { - jo.put("code", "0"); - jo.put("desc", "失败,点位无物料信息与有货状态不符合!"); + jo.put("desc", "失败,当前物料不能为空!"); return jo; } + if (StrUtil.equals(material_type, "1")) { + status = "1"; + } JSONObject map = new JSONObject(); if (StrUtil.equals(type, "0")) { map.put("material_type", ""); 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 37df1f2..4a59578 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 @@ -2,6 +2,7 @@ package org.nl.modules.quartz.task; 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 lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ObjectUtils; @@ -40,26 +41,28 @@ public class AutoCreateInst { DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); List list = taskserver.queryAll("task_status = '0'"); - Collections.sort(list, new Comparator() { - @Override - public int compare(TaskDto t1, TaskDto t2) { - String start_device_code1 = t1.getStart_device_code(); - String start_device_code2 = t2.getStart_device_code(); - Integer start_1 = Integer.parseInt(start_device_code1.split("_")[0]); - Integer start_2 = Integer.parseInt(start_device_code2.split("_")[0]); - if (start_1 > start_2){ - + if (ObjectUtil.isNotEmpty(list)) + Collections.sort(list, new Comparator() { + @Override + public int compare(TaskDto t1, TaskDto t2) { + String start_device_code1 = t1.getStart_device_code(); + String start_device_code2 = t2.getStart_device_code(); + Integer start_1 = Integer.parseInt(start_device_code1.split("_")[0]); + Integer start_2 = Integer.parseInt(start_device_code2.split("_")[0]); + if (start_1 == start_2) { + int end_i = Integer.parseInt(start_device_code1.split("_")[start_device_code1.split("_").length - 1]); + int end_j = Integer.parseInt(start_device_code2.split("_")[start_device_code2.split("_").length - 1]); + if (end_i > end_j) { + return 1; + } else if (end_i < end_j) { + return -1; + } + return 0; + } else { + return 1; + } } - int end_i = Integer.parseInt(start_device_code1.split("_")[start_device_code1.split("_").length - 1]); - int end_j = Integer.parseInt(start_device_code2.split("_")[start_device_code2.split("_").length - 1]); - if (end_i > end_j) { - return 1; - } else if (end_i < end_j) { - return -1; - } - return 0; - } - }); + }); for (int i = 0; i < list.size(); i++) { TaskDto acsTask = list.get(i); String taskid = acsTask.getTask_id();