From ffce40df0e793985cc4294434ace9b3f77e2a868 Mon Sep 17 00:00:00 2001 From: gengby <858962040@qq.com> Date: Wed, 3 Jul 2024 12:04:15 +0800 Subject: [PATCH] =?UTF-8?q?rev=EF=BC=9A=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/dto/DeviceAssignedQueryParam.java | 4 + .../impl/DeviceAssignedServiceImpl.java | 7 +- ...InspectionScannerConveyorDeviceDriver.java | 19 ++++- .../StandardStackerDeviceDriver.java | 5 ++ .../with_station/WithStationDeviceDriver.java | 12 +-- .../acs/device/utils/ArrayComparisonUtil.java | 7 +- .../acs/ext/wms/data/req/CommonRequest.java | 18 +++- .../acs/ext/wms/rest/WmsToAcsController.java | 8 +- .../acs/ext/wms/service/GateWayService.java | 24 ++++-- .../acs/ext/wms/service/WmsToAcsService.java | 10 ++- .../acs/ext/wms/service/dto/InteracteDto.java | 19 ----- .../wms/service/impl/WmsToAcsServiceImpl.java | 83 +++++++++++++------ .../enums/InstructionStatusEnum.java | 4 +- .../service/impl/InstructionServiceImpl.java | 21 +++-- .../task/service/enums/WmsTaskStatusEnum.java | 32 +++++++ .../task/service/impl/TaskServiceImpl.java | 17 ++-- .../src/views/acs/config/assigned/index.vue | 47 ++++++++++- nladmin-ui/src/views/acs/task/index.vue | 4 +- nladmin-ui/src/views/monitor/lucene/index.vue | 14 ++-- .../src/views/system/monitor/device/index.vue | 10 +-- nladmin-ui/src/views/system/param/index.vue | 8 +- nladmin-ui/src/views/system/timing/index.vue | 2 +- 22 files changed, 266 insertions(+), 109 deletions(-) delete mode 100644 nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/dto/InteracteDto.java create mode 100644 nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/enums/WmsTaskStatusEnum.java diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/device/service/dto/DeviceAssignedQueryParam.java b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/device/service/dto/DeviceAssignedQueryParam.java index 64529a5..e09ced7 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/device/service/dto/DeviceAssignedQueryParam.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/device/service/dto/DeviceAssignedQueryParam.java @@ -11,4 +11,8 @@ import lombok.Setter; @Setter public class DeviceAssignedQueryParam { + private String device_code; + private String inst_nextDevice_code; + private String task_nextDevice_code; + } diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/device/service/impl/DeviceAssignedServiceImpl.java b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/device/service/impl/DeviceAssignedServiceImpl.java index 27306af..f4025cf 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/device/service/impl/DeviceAssignedServiceImpl.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/device/service/impl/DeviceAssignedServiceImpl.java @@ -2,6 +2,7 @@ package org.nl.acs.device.device.service.impl; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -44,7 +45,11 @@ public class DeviceAssignedServiceImpl extends CommonServiceImpl queryAll(DeviceAssignedQueryParam query, Pageable pageable) { IPage queryPage = PageUtil.toMybatisPage(pageable); - IPage page = deviceAssignedMapper.selectPage(queryPage, QueryHelpMybatisPlus.getPredicate(query)); + LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(); + lqw.like(StrUtil.isNotBlank(query.getDevice_code()), DeviceAssigned::getDevice_code, query.getDevice_code()) + .and(StrUtil.isNotBlank(query.getTask_nextDevice_code()), s -> s.like(DeviceAssigned::getTask_nextDevice_code, query.getTask_nextDevice_code())) + .and(StrUtil.isNotBlank(query.getInst_nextDevice_code()), s -> s.like(DeviceAssigned::getInst_nextDevice_code, query.getInst_nextDevice_code())); + IPage page = deviceAssignedMapper.selectPage(queryPage, lqw); return ConvertUtil.convertPage(page, DeviceAssignedDto.class); } diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/conveyor/appearance_inspection_scannner_conveyor/AppearanceInspectionScannerConveyorDeviceDriver.java b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/conveyor/appearance_inspection_scannner_conveyor/AppearanceInspectionScannerConveyorDeviceDriver.java index 89c68b0..fabc6f3 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/conveyor/appearance_inspection_scannner_conveyor/AppearanceInspectionScannerConveyorDeviceDriver.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/conveyor/appearance_inspection_scannner_conveyor/AppearanceInspectionScannerConveyorDeviceDriver.java @@ -144,6 +144,11 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc private boolean requireSuccess = false; + /** + * 关联站点申请任务请求标记 + */ + private boolean withStationRequireSuccess = false; + /** * 请求时间 */ @@ -200,6 +205,10 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc private void executeLogicBefore() { if (this.move != this.lastMove) { this.requireSuccess = false; + this.withStationRequireSuccess = false; + } + if (this.mode != this.lastMode) { + this.requireSuccess = false; } if (!StrUtil.equals(this.barcode, this.lastBarcode) && this.move == 1) { this.requireInTaskTime = System.currentTimeMillis(); @@ -327,6 +336,7 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc .build(); UnifiedResponse response = acsToWmsService.apply(request); if (response.isSuccess()) { + this.writing(ItemProtocol.TO_COMMAND.getKey(), CommandEnum.COMMAND_6.getValue()); this.requireSuccess = true; } } @@ -579,7 +589,7 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc Device device = deviceAppService.findDeviceByCode(next_device_code); if (device != null) { String pinkDeviceCode = Optional.ofNullable(device.getExtraValue().get("pinkDeviceCode")).map(Objects::toString).orElse(""); - if (StrUtil.equals(taskDto.getNext_device_code(), pinkDeviceCode)) { + if (StrUtil.isNotEmpty(pinkDeviceCode)) { Device pinkDevice = deviceAppService.findDeviceByCode(pinkDeviceCode); if (pinkDevice != null && pinkDevice.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) { AppearanceInspectionScannerConveyorDeviceDriver appearanceInspectionScannerConveyorDeviceDriver = (AppearanceInspectionScannerConveyorDeviceDriver) pinkDevice.getDeviceDriver(); @@ -718,7 +728,7 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc @SneakyThrows private void update_inst_status(Instruction instruction) { if (InstructionStatusEnum.READY.getIndex().equals(instruction.getInstruction_status()) && this.currentDeviceCode.equals(instruction.getStart_device_code())) { - logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "指令号:" + instruction.getInstruction_code() + ", 修改指令状态为 '" + InstructionStatusEnum.getName(instruction.getInstruction_status()) + "' -> " + InstructionStatusEnum.BUSY.getName())); + logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "指令号:" + instruction.getInstruction_code() + ", 修改指令状态为 " + InstructionStatusEnum.getName(instruction.getInstruction_status()) + " -> " + InstructionStatusEnum.BUSY.getName())); instruction.setInstruction_status(InstructionStatusEnum.BUSY.getIndex()); instruction.setExecute_device_code(this.currentDeviceCode); instructionService.update(instruction); @@ -732,7 +742,7 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc } this.unExecutedMessage = ""; } - logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "指令号:" + instruction.getInstruction_code() + ", 修改指令状态为 '" + InstructionStatusEnum.getName(instruction.getInstruction_status()) + "' -> " + InstructionStatusEnum.FINISHED.getName())); + logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "指令号:" + instruction.getInstruction_code() + ", 修改指令状态为 " + InstructionStatusEnum.getName(instruction.getInstruction_status()) + " -> " + InstructionStatusEnum.FINISHED.getName())); instruction.setInstruction_status(InstructionStatusEnum.FINISHED.getIndex()); instruction.setExecute_device_code(this.currentDeviceCode); instructionService.finish(instruction); @@ -751,6 +761,7 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc map.put("isError", this.isError); map.put("unExecutedMessage", this.unExecutedMessage); map.put("requireSuccess", this.requireSuccess); + map.put("requireSuccessLabel", this.requireSuccess ? "是" : "否"); map.put("mode", AppModeEnum.getLabelByCode(this.mode)); String belongToConveyor = Optional.ofNullable(this.getExtraValue().get("belongToConveyor")).map(Object::toString).orElse(null); if (belongToConveyor != null) { @@ -763,7 +774,7 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc } map.put("move", this.move == 0 ? "无货" : "有货"); map.put("hasGoods", this.move); - map.put("task", this.task); + map.put("task", this.task + " (" + (instructionService.findByCodeFromCache(String.valueOf(this.task)) == null ? "已结束" : "执行中") + ")"); map.put("action", this.action == 0 ? "不允许取放" : "允许取放"); map.put("error", ErrorEnum.getLabel(this.error)); map.put("barcode", this.barcode); diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/stacker/double_stacker/StandardStackerDeviceDriver.java b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/stacker/double_stacker/StandardStackerDeviceDriver.java index 12b194b..4882acc 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/stacker/double_stacker/StandardStackerDeviceDriver.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/stacker/double_stacker/StandardStackerDeviceDriver.java @@ -1256,10 +1256,15 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme map.put("message", this.message); map.put("unExecutedMessage", this.unExecutedMessage); map.put("prohibitInWarehouse", this.prohibitInWarehouse); + map.put("prohibitInWarehouseLabel", this.prohibitInWarehouse ? "是" : "否"); map.put("prohibitOutWarehouse", this.prohibitOutWarehouse); + map.put("prohibitOutWarehouseLabel", this.prohibitOutWarehouse ? "是" : "否"); map.put("stopReceiveTask", this.stopReceiveTask); + map.put("stopReceiveTaskLabel", this.stopReceiveTask ? "是" : "否"); map.put("requireSuccess", this.requireSuccess); + map.put("requireSuccessLabel", this.requireSuccess ? "是" : "否"); map.put("againRequireSuccess", this.againRequireSuccess); + map.put("againRequireSuccessLabel", this.againRequireSuccess ? "是" : "否"); map.put("mode", ModeEnum.getDescByNum(this.mode)); map.put("front_command", CommandEnum.getDesc(this.front_command)); map.put("front_task", this.front_task + " (" + (instructionService.findByCodeFromCache(String.valueOf(this.front_task)) == null ? "已结束" : "执行中") + ")"); diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/station/with_station/WithStationDeviceDriver.java b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/station/with_station/WithStationDeviceDriver.java index 9275f14..0bb0cf8 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/station/with_station/WithStationDeviceDriver.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/station/with_station/WithStationDeviceDriver.java @@ -89,7 +89,7 @@ public class WithStationDeviceDriver extends AbstractOpcDeviceDriver implements continue; } if (!requireSuccess && StrUtil.isNotEmpty(appearanceInspectionScannerConveyorDeviceDriver.getBarcode()) - && !appearanceInspectionScannerConveyorDeviceDriver.isRequireSuccess()) { + && !appearanceInspectionScannerConveyorDeviceDriver.isWithStationRequireSuccess()) { TaskDto taskDto = taskServer.findByContainer(appearanceInspectionScannerConveyorDeviceDriver.getBarcode()); if (ObjectUtil.isEmpty(taskDto)) { String getLinkDeviceCode = Optional.ofNullable(device.getExtraValue().get("getLinkDeviceCode")).map(Object::toString).orElse(null); @@ -105,14 +105,14 @@ public class WithStationDeviceDriver extends AbstractOpcDeviceDriver implements logServer.deviceExecuteLog(new LuceneLogDto(this.device_code, "申请任务...." + request.toString())); UnifiedResponse response = acsToWmsService.apply(request); if (response.isSuccess()) { - appearanceInspectionScannerConveyorDeviceDriver.setRequireSuccess(true); + appearanceInspectionScannerConveyorDeviceDriver.setWithStationRequireSuccess(true); this.requireSuccess = true; } } else { Device linkDevice = deviceAppservice.findDeviceByCode(getLinkDeviceCode); if (ObjectUtil.isNotEmpty(linkDevice) && linkDevice.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) { AppearanceInspectionScannerConveyorDeviceDriver appearanceInspectionScannerConveyorDeviceDriver2 = (AppearanceInspectionScannerConveyorDeviceDriver) linkDevice.getDeviceDriver(); - if (appearanceInspectionScannerConveyorDeviceDriver2.getMove() == 1 && !appearanceInspectionScannerConveyorDeviceDriver2.isRequireSuccess()) { + if (appearanceInspectionScannerConveyorDeviceDriver2.getMove() == 1 && !appearanceInspectionScannerConveyorDeviceDriver2.isWithStationRequireSuccess()) { TaskDto taskDto2 = taskServer.findByContainer(appearanceInspectionScannerConveyorDeviceDriver2.getBarcode()); if (ObjectUtil.isEmpty(taskDto2)) { JSONObject param = new JSONObject(); @@ -128,8 +128,8 @@ public class WithStationDeviceDriver extends AbstractOpcDeviceDriver implements UnifiedResponse response = acsToWmsService.apply(request); if (response.isSuccess()) { this.requireSuccess = true; - appearanceInspectionScannerConveyorDeviceDriver.setRequireSuccess(true); - appearanceInspectionScannerConveyorDeviceDriver2.setRequireSuccess(true); + appearanceInspectionScannerConveyorDeviceDriver.setWithStationRequireSuccess(true); + appearanceInspectionScannerConveyorDeviceDriver2.setWithStationRequireSuccess(true); } } } else { @@ -145,7 +145,7 @@ public class WithStationDeviceDriver extends AbstractOpcDeviceDriver implements logServer.deviceExecuteLog(new LuceneLogDto(this.device_code, "申请任务...." + request.toString())); UnifiedResponse response = acsToWmsService.apply(request); if (response.isSuccess()) { - appearanceInspectionScannerConveyorDeviceDriver.setRequireSuccess(true); + appearanceInspectionScannerConveyorDeviceDriver.setWithStationRequireSuccess(true); this.requireSuccess = true; } } diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/utils/ArrayComparisonUtil.java b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/utils/ArrayComparisonUtil.java index 70eb251..1344458 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/utils/ArrayComparisonUtil.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/utils/ArrayComparisonUtil.java @@ -12,8 +12,13 @@ import java.util.Objects; */ public class ArrayComparisonUtil { public static boolean equals(Object oldValue, Object newValue) { + + if ((oldValue instanceof String && newValue == null && "".equals(oldValue)) || + (newValue instanceof String && oldValue == null && "".equals(newValue))) { + return true; + } if (oldValue == null || newValue == null) { - return Objects.equals(oldValue, newValue); + return ObjectUtil.equals(oldValue, newValue); } Class oldType = oldValue.getClass(); Class newType = newValue.getClass(); diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/req/CommonRequest.java b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/req/CommonRequest.java index e6841e0..d3fb1d7 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/req/CommonRequest.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/req/CommonRequest.java @@ -1,9 +1,13 @@ package org.nl.acs.ext.wms.data.req; import cn.hutool.core.date.DateUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; +import lombok.NoArgsConstructor; import org.nl.acs.ext.wms.IpUtil; import org.nl.config.IdUtil; @@ -14,12 +18,15 @@ import org.nl.config.IdUtil; */ @Data @Builder +@AllArgsConstructor +@NoArgsConstructor public class CommonRequest { private String service; private String type; + @Builder.Default private String ip = IpUtil.LOCAL_IP; @Builder.Default @@ -28,5 +35,14 @@ public class CommonRequest { @Builder.Default private String trace_id = "trace_id_" + IdUtil.getStringId(); - private JSONObject data; + private Object data; + + + public JSONArray handleArray() { + return JSONArray.parseArray(JSON.toJSONString(data)); + } + + public JSONObject handleObject() { + return (JSONObject) data; + } } \ No newline at end of file diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java index 42c7b9f..fb6fcfc 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java @@ -5,10 +5,8 @@ package org.nl.acs.ext.wms.rest; import cn.dev33.satoken.annotation.SaIgnore; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.nl.acs.ext.wms.data.req.CommonRequest; import org.nl.acs.ext.wms.service.GateWayService; -import org.nl.acs.ext.wms.service.WmsToAcsService; -import org.nl.acs.ext.wms.service.dto.InteracteDto; -import org.nl.common.base.TableDataInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -33,8 +31,8 @@ public class WmsToAcsController { @PostMapping("/apply") @SaIgnore - public ResponseEntity apply(@RequestBody InteracteDto form) { - return new ResponseEntity<>(gateWayService.apply(form), HttpStatus.OK); + public ResponseEntity apply(@RequestBody CommonRequest request) { + return new ResponseEntity<>(gateWayService.apply(request), HttpStatus.OK); } } diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/GateWayService.java b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/GateWayService.java index ffc5c41..cdeab08 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/GateWayService.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/GateWayService.java @@ -1,7 +1,9 @@ package org.nl.acs.ext.wms.service; import com.alibaba.fastjson.JSONObject; -import org.nl.acs.ext.wms.service.dto.InteracteDto; +import org.nl.acs.ext.wms.data.req.CommonRequest; +import org.nl.config.lucene.service.LuceneExecuteLogService; +import org.nl.config.lucene.service.dto.LuceneLogDto; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -15,16 +17,20 @@ public class GateWayService { @Autowired private WmsToAcsService wmsToAcsService; + @Autowired + private LuceneExecuteLogService logService; - public JSONObject apply(InteracteDto param) { - if ("crateTask".equals(param.getType())) { - return wmsToAcsService.crateTask(param.getData()); - } else if ("switchInOut".equals(param.getType())) { - return wmsToAcsService.switchInOut(param.getData()); - } else if ("pinkStartStop".equals(param.getType())) { - return wmsToAcsService.pinkStartStop(param.getData()); - } + public JSONObject apply(CommonRequest request) { JSONObject resp = new JSONObject(); + if ("createTask".equals(request.getType())) { + return wmsToAcsService.crateTask(request.handleArray()); + } else if ("switchInOut".equals(request.getType())) { + return wmsToAcsService.switchInOut(request.handleObject()); + } else if ("pinkStartStop".equals(request.getType())) { + return wmsToAcsService.pinkStartStop(request.handleObject()); + } else if ("toCommand".equals(request.getType())) { + return wmsToAcsService.toCommand(request.handleObject()); + } resp.put("code", "400"); resp.put("msg", "type有误"); return resp; diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java index 12ef3ab..892f35d 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java @@ -1,6 +1,7 @@ package org.nl.acs.ext.wms.service; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; @@ -12,7 +13,7 @@ public interface WmsToAcsService { * @param req * @return */ - JSONObject crateTask(JSONObject req); + JSONObject crateTask(JSONArray req); /** * 出入库模式切换 @@ -31,4 +32,11 @@ public interface WmsToAcsService { */ JSONObject pinkStartStop(JSONObject req); + /** + * 下发输送线转动命令 + * + * @param req + * @return + */ + JSONObject toCommand(JSONObject req); } diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/dto/InteracteDto.java b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/dto/InteracteDto.java deleted file mode 100644 index 5849aca..0000000 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/dto/InteracteDto.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.nl.acs.ext.wms.service.dto; - -import com.alibaba.fastjson.JSONObject; -import lombok.Data; - -/* - * @author ZZQ - * @Date 2024/5/29 16:26 - */ -@Data -public class InteracteDto { - - String service; - String type; - String ip; - String request_time; - String trace_id; - JSONObject data; -} diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java index a138167..3727770 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java @@ -38,20 +38,20 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { @Autowired private DeviceAppService deviceAppService; @Autowired - private TaskService taskserver; + private TaskService taskService; + @Override - public JSONObject crateTask(JSONObject req) { - log.info("createFromWms--------------:输入参数:" + JSON.toJSONString(req)); + public JSONObject crateTask(JSONArray req) { + log.info("crateTask--------------:输入参数:" + JSON.toJSONString(req)); try { - JSONArray datas = req.getJSONArray("tasks"); JSONArray errArr = new JSONArray(); - for (int i = 0; i < datas.size(); i++) { - JSONObject task = datas.getJSONObject(i); - String ext_task_id = task.getString("ext_task_id"); + for (int i = 0; i < req.size(); i++) { + JSONObject task = req.getJSONObject(i); + String ext_task_id = task.getString("id"); String task_code = task.getString("task_code"); - String start_device_code = task.getString("start_device_code"); - String next_device_code = task.getString("next_device_code"); + String start_device_code = task.getString("point_code1"); + String next_device_code = task.getString("point_code2"); String put_device_code = task.getString("put_device_code"); String priority = task.getString("priority"); String vehicle_code = task.getString("vehicle_code"); @@ -61,7 +61,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { String remark = task.getString("remark"); String storage_task_type = task.getString("storage_task_type"); String agv_system_type = task.getString("agv_system_type"); - JSONObject param = task.getJSONObject("param"); + JSONObject params = task.getJSONObject("params"); String start_point_code = ""; String next_point_code = ""; String put_point_code = ""; @@ -136,7 +136,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { route_plan_code = "normal"; } - TaskDto taskDto = taskserver.findByCodeFromCache(task_code); + TaskDto taskDto = taskService.findByCodeFromCache(task_code); if (taskDto != null) { JSONObject json = new JSONObject(); json.put("task_code", task_code); @@ -146,7 +146,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { continue; } if (!StrUtil.isEmpty(vehicle_code)) { - TaskDto vehicle_dto = taskserver.findByContainer(vehicle_code); + TaskDto vehicle_dto = taskService.findByContainer(vehicle_code); if (vehicle_dto != null) { JSONObject json = new JSONObject(); json.put("task_code", task_code); @@ -191,7 +191,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { jo.put("agv_system_type", agv_system_type); jo.put("storage_task_type", storage_task_type); jo.put("remark", remark); - jo.put("params", param); + jo.put("params", params); jo.put("task_type", StrUtil.isEmpty(task_type) ? 1 : Integer.parseInt(task_type)); @@ -201,7 +201,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { TaskDto task_dto = jo.toJavaObject(TaskDto.class); try { - taskserver.create(task_dto); + taskService.create(task_dto); } catch (Exception e) { JSONObject json = new JSONObject(); json.put("task_code", task_code); @@ -224,7 +224,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { } resp.put("errArr", errArr); } - log.info("createFromWms--------------:输出参数:" + JSON.toJSONString(resp)); + log.info("crateTask--------------:输出参数:" + JSON.toJSONString(resp)); return resp; } finally { } @@ -232,6 +232,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { @Override public JSONObject switchInOut(JSONObject reqs) { + log.info("switchInOut--------------:输入参数:" + JSON.toJSONString(reqs)); Assert.notNull(reqs); String device_code = reqs.getString("device_code"); if (StrUtil.isBlank(device_code)) { @@ -247,13 +248,13 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { if (belongToConveyorDevice != null && belongToConveyorDevice.getDeviceDriver() instanceof StripConveyorDeviceDriver) { StripConveyorDeviceDriver stripConveyorDeviceDriver = (StripConveyorDeviceDriver) belongToConveyorDevice.getDeviceDriver(); //切换为入库 - if ("1".equals(type)) { + if ("0".equals(type)) { String samePoint = Optional.ofNullable(device.getExtraValue().get("samePoint")).map(Object::toString).orElse(null); TaskDto taskDto; if (StrUtil.isNotEmpty(samePoint)) { - taskDto = taskserver.findByNextCode(samePoint); + taskDto = taskService.findByNextCode(samePoint); } else { - taskDto = taskserver.findByNextCode(device_code); + taskDto = taskService.findByNextCode(device_code); } if (ObjectUtil.isNotEmpty(taskDto)) { throw new BadRequestException("ACS存在出库任务,无法切换为入库模式"); @@ -268,13 +269,13 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { stripConveyorDeviceDriver.writing("toCommand", 0); } //切换为出库 - else if ("2".equals(type)) { + else if ("1".equals(type)) { String samePoint = Optional.ofNullable(device.getExtraValue().get("samePoint")).map(Object::toString).orElse(null); TaskDto taskDto; if (StrUtil.isNotEmpty(samePoint)) { - taskDto = taskserver.findByStartCode(samePoint); + taskDto = taskService.findByStartCode(samePoint); } else { - taskDto = taskserver.findByStartCode(device_code); + taskDto = taskService.findByStartCode(device_code); } if (ObjectUtil.isNotEmpty(taskDto)) { throw new BadRequestException("ACS存在入库任务,无法切换为出库模式"); @@ -290,22 +291,24 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { } } JSONObject resp = new JSONObject(); - resp.put("status", 200); - resp.put("message", "切换出入库模式成功"); + resp.put("code", "200"); + resp.put("msg", "切换出入库模式成功"); + log.info("switchInOut--------------:输出参数:" + JSON.toJSONString(resp)); return resp; } @Override public JSONObject pinkStartStop(JSONObject reqs) { + log.info("pinkStartStop--------------:输入参数:" + JSON.toJSONString(reqs)); Assert.notNull(reqs); JSONObject resp = new JSONObject(); String device_code = reqs.getString("device_code"); if (StrUtil.isBlank(device_code)) { throw new BadRequestException("设备号不能为空!"); } - String type = reqs.getString("type"); + String type = reqs.getString("status"); if (StrUtil.isEmpty(type)) { - throw new BadRequestException("启停类型不能为空!"); + throw new BadRequestException("启停状态不能为空!"); } Device device = deviceAppService.findDeviceByCode(device_code); if (device != null && device.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) { @@ -318,8 +321,34 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { } else { throw new BadRequestException("设备不存在"); } - resp.put("status", 200); - resp.put("message", "切换成功"); + resp.put("code", "200"); + resp.put("msg", "切换成功"); + log.info("pinkStartStop--------------:输出参数:" + JSON.toJSONString(resp)); + return resp; + } + + @Override + public JSONObject toCommand(JSONObject req) { + log.info("toCommand--------------:输入参数:" + JSON.toJSONString(req)); + Assert.notNull(req); + String device_code = req.getString("device_code"); + if (StrUtil.isEmpty(device_code)) { + throw new BadRequestException("设备号不能为空"); + } + Integer toCommand = req.getInteger("toCommand"); + if (toCommand == null) { + throw new BadRequestException("下发参数不能为空"); + } + Device device = deviceAppService.findDeviceByCode(device_code); + + if (device != null && device.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) { + AppearanceInspectionScannerConveyorDeviceDriver appearanceInspectionScannerConveyorDeviceDriver = (AppearanceInspectionScannerConveyorDeviceDriver) device.getDeviceDriver(); + appearanceInspectionScannerConveyorDeviceDriver.writing("toCommand", toCommand); + } + JSONObject resp = new JSONObject(); + resp.put("code", "200"); + resp.put("msg", "下发成功"); + log.info("toCommand--------------:输出参数:" + JSON.toJSONString(resp)); return resp; } diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/enums/InstructionStatusEnum.java b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/enums/InstructionStatusEnum.java index 259b293..01c70b6 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/enums/InstructionStatusEnum.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/enums/InstructionStatusEnum.java @@ -58,9 +58,9 @@ public enum InstructionStatusEnum { return arr; } - public static String getName(String code) { + public static String getName(String index) { for (InstructionStatusEnum c : InstructionStatusEnum.values()) { - if (c.code == code) { + if (c.index.equals(index)) { return c.name; } } diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java index 9b4e441..cb73562 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java @@ -1749,7 +1749,8 @@ public class InstructionServiceImpl extends CommonServiceImpl findReadyInstByStartDeviceCode(List start_device_code_list, String noY) { - String currentNoY = noY == null ? "" : noY; +// String currentNoY = noY == null ? "" : noY; + Set currentNoY = noY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(noY.split(","))); return Optional.ofNullable(this.instructions) .orElse(new CopyOnWriteArrayList<>()) .stream() @@ -1763,7 +1764,8 @@ public class InstructionServiceImpl extends CommonServiceImpl findReadyInstByNextDeviceCode(List next_device_code_list, String noY) { - String currentNoY = noY == null ? "" : noY; + //String currentNoY = noY == null ? "" : noY; + Set currentNoY = noY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(noY.split(","))); return Optional.ofNullable(this.instructions) .orElse(new CopyOnWriteArrayList<>()) .stream() @@ -1777,7 +1779,8 @@ public class InstructionServiceImpl extends CommonServiceImpl findReadyInstByDeviceCode(List device_code_list, String noY) { - String currentNoY = noY == null ? "" : noY; + //String currentNoY = noY == null ? "" : noY; + Set currentNoY = noY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(noY.split(","))); return Optional.ofNullable(this.instructions) .orElse(new CopyOnWriteArrayList<>()) .stream() @@ -1790,7 +1793,8 @@ public class InstructionServiceImpl extends CommonServiceImpl currentNoY = noY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(noY.split(","))); return Optional.ofNullable(this.instructions) .orElse(new CopyOnWriteArrayList<>()) .stream() @@ -1807,7 +1811,8 @@ public class InstructionServiceImpl extends CommonServiceImpl currentNoY = noY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(noY.split(","))); return Optional.ofNullable(this.instructions) .orElse(new CopyOnWriteArrayList<>()) .stream() @@ -1822,7 +1827,8 @@ public class InstructionServiceImpl extends CommonServiceImpl currentNoY = noY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(noY.split(","))); return Optional.ofNullable(this.instructions) .orElse(new CopyOnWriteArrayList<>()) .stream() @@ -1837,7 +1843,8 @@ public class InstructionServiceImpl extends CommonServiceImpl currentNoY = noY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(noY.split(","))); return Optional.ofNullable(this.instructions) .orElse(new CopyOnWriteArrayList<>()) .stream() diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/enums/WmsTaskStatusEnum.java b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/enums/WmsTaskStatusEnum.java new file mode 100644 index 0000000..dbaea0a --- /dev/null +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/enums/WmsTaskStatusEnum.java @@ -0,0 +1,32 @@ +package org.nl.acs.task.service.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @Description TODO + * @Author Gengby + * @Date 2024/7/1 + */ +@Getter +@AllArgsConstructor +public enum WmsTaskStatusEnum { + RUN("1", "20", "执行中"), + + FINISH("2", "90", "完成"), + + CANCEL("3", "100", "取消"); + + private String acsStatus; + private String wmsStatus; + private String desc; + + public static String getWmsStatusByAcsStatus(String acsStatus) { + for (WmsTaskStatusEnum status : WmsTaskStatusEnum.values()) { + if (status.getAcsStatus().equals(acsStatus)) { + return status.getWmsStatus(); + } + } + return null; + } +} \ No newline at end of file diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java index e7fb321..26e507f 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java @@ -46,6 +46,7 @@ import org.nl.acs.task.service.TaskFeedbackService; import org.nl.acs.common.base.PageInfo; import org.nl.acs.common.base.QueryHelpMybatisPlus; import org.nl.acs.common.base.service.impl.CommonServiceImpl; +import org.nl.acs.task.service.enums.WmsTaskStatusEnum; import org.nl.common.exception.BadRequestException; import org.nl.acs.utils.ConvertUtil; import org.nl.common.utils.FileUtil; @@ -563,7 +564,7 @@ public class TaskServiceImpl extends CommonServiceImpl impleme //向缓存添加任务信息 this.addTaskToCache(dto); //反馈上位系统任务状态 - this.feedWmsTaskStatus(entity); + this.feedWmsTaskStatus(dto); } @Override @@ -1252,7 +1253,7 @@ public class TaskServiceImpl extends CommonServiceImpl impleme if (!StrUtil.startWith(taskDto.getTask_code(), CommonFinalParam.HYPHEN_) && StrUtil.equals(hasWms, CommonFinalParam.ONE)) { JSONObject param = new JSONObject(); param.put("taskCode", entity.getTask_code()); - param.put("status", ""); + param.put("status", WmsTaskStatusEnum.getWmsStatusByAcsStatus(taskDto.getTask_status())); CommonRequest request = CommonRequest .builder() @@ -1307,7 +1308,9 @@ public class TaskServiceImpl extends CommonServiceImpl impleme @Override public List findReadyTaskByXDeviceCode(List xDeviceCodeList, String noY) { - String currentNoY = noY == null ? "" : noY; + // String currentNoY = noY == null ? "" : noY; + Set currentNoY = noY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(noY.split(","))); + return Optional.ofNullable(this.tasks) .orElse(new CopyOnWriteArrayList<>()) .stream() @@ -1330,7 +1333,9 @@ public class TaskServiceImpl extends CommonServiceImpl impleme String front_to_x = frontTask.getTo_x(); String front_to_y = frontTask.getTo_y(); String front_to_z = frontTask.getTo_z(); - String currentBackNoY = backNoY == null ? "" : backNoY; + //String currentBackNoY = backNoY == null ? "" : backNoY; + Set currentBackNoY = backNoY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(backNoY.split(","))); + return Optional.ofNullable(this.tasks) .orElse(new CopyOnWriteArrayList<>()) .stream() @@ -1353,7 +1358,9 @@ public class TaskServiceImpl extends CommonServiceImpl impleme String front_from_x = frontTask.getFrom_x(); String front_from_y = frontTask.getFrom_y(); String front_from_z = frontTask.getFrom_z(); - String currentBackNoY = backNoY == null ? "" : backNoY; + //String currentBackNoY = backNoY == null ? "" : backNoY; + Set currentBackNoY = backNoY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(backNoY.split(","))); + return Optional.ofNullable(this.tasks) .orElse(new CopyOnWriteArrayList<>()) .stream() diff --git a/nladmin-ui/src/views/acs/config/assigned/index.vue b/nladmin-ui/src/views/acs/config/assigned/index.vue index 6b8baf8..d6e72e5 100644 --- a/nladmin-ui/src/views/acs/config/assigned/index.vue +++ b/nladmin-ui/src/views/acs/config/assigned/index.vue @@ -2,6 +2,47 @@
+
+ + + + + + + + + + + + + +
@@ -144,6 +185,7 @@ import crudAcsDeviceAssigned from '@/api/acs/config/deviceAssigned' import CRUD, { crud, form, header, presenter } from '@crud/crud' import crudOperation from '@crud/CRUD.operation' +import rrOperation from '@crud/RR.operation' import udOperation from '@crud/UD.operation' import pagination from '@crud/Pagination' import deviceCrud from '@/api/acs/device/device' @@ -159,7 +201,7 @@ const defaultForm = { } export default { name: 'AcsDeviceAssigned', - components: { pagination, crudOperation, udOperation }, + components: { pagination, crudOperation, udOperation, rrOperation }, mixins: [presenter(), header(), form(defaultForm), crud()], cruds() { return CRUD({ @@ -170,7 +212,8 @@ export default { optShow: { add: true, edit: true, - del: true + del: true, + reset: true }, crudMethod: { ...crudAcsDeviceAssigned } }) diff --git a/nladmin-ui/src/views/acs/task/index.vue b/nladmin-ui/src/views/acs/task/index.vue index be7f906..7e58cf7 100644 --- a/nladmin-ui/src/views/acs/task/index.vue +++ b/nladmin-ui/src/views/acs/task/index.vue @@ -475,7 +475,7 @@ - + @@ -591,7 +591,7 @@ export default { return CRUD({ title: i18n.t('task.txt_box.Task'), url: 'api/task', idField: 'task_id', sort: 'task_id,desc', optShow: { add: false, - edit: true, + edit: false, del: true, reset: false, download: false diff --git a/nladmin-ui/src/views/monitor/lucene/index.vue b/nladmin-ui/src/views/monitor/lucene/index.vue index c7bc072..16943e8 100644 --- a/nladmin-ui/src/views/monitor/lucene/index.vue +++ b/nladmin-ui/src/views/monitor/lucene/index.vue @@ -25,33 +25,33 @@ v-if="logType === '接口日志'" prop="request_url" label="请求路径" - :min-width="flexWidth('method',crud.data,'请求路径')" + show-overflow-tooltip /> - - - + + + diff --git a/nladmin-ui/src/views/system/monitor/device/index.vue b/nladmin-ui/src/views/system/monitor/device/index.vue index 72fa081..994123e 100644 --- a/nladmin-ui/src/views/system/monitor/device/index.vue +++ b/nladmin-ui/src/views/system/monitor/device/index.vue @@ -361,19 +361,19 @@ export default { } else if (val === 'height') { const obj = { name: '高度', value: data[val] } this.arr.push(obj) - } else if (val === 'prohibitInWarehouse') { + } else if (val === 'prohibitInWarehouseLabel') { const obj = { name: '禁止入库', value: data[val] } this.arr.push(obj) - } else if (val === 'prohibitOutWarehouse') { + } else if (val === 'prohibitOutWarehouseLabel') { const obj = { name: '禁止出库', value: data[val] } this.arr.push(obj) - } else if (val === 'stopReceiveTask') { + } else if (val === 'stopReceiveTaskLabel') { const obj = { name: '停止接收任务', value: data[val] } this.arr.push(obj) - } else if (val === 'requireSuccess') { + } else if (val === 'requireSuccessLabel') { const obj = { name: '请求标记', value: data[val] } this.arr.push(obj) - } else if (val === 'againRequireSuccess') { + } else if (val === 'againRequireSuccessLabel') { const obj = { name: '异常请求标记', value: data[val] } this.arr.push(obj) } else if (val === 'front_command') { diff --git a/nladmin-ui/src/views/system/param/index.vue b/nladmin-ui/src/views/system/param/index.vue index fb183fe..15153da 100644 --- a/nladmin-ui/src/views/system/param/index.vue +++ b/nladmin-ui/src/views/system/param/index.vue @@ -42,10 +42,10 @@ > - - - - + + + +