From 718c51331ceed773053e515e78fa55a48b3fc5c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=97=AD=E6=98=8E=5C73939?= <739390650@QQ.COM> Date: Mon, 30 Mar 2026 14:35:19 +0800 Subject: [PATCH] =?UTF-8?q?opt:acs=E6=A0=87=E5=87=86=E7=89=88=E6=97=A0?= =?UTF-8?q?=E6=95=88=E4=BB=A3=E7=A0=81=E5=88=A0=E5=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + .../java/org/nl/acs/agv/QueryAGVStatus.java | 8 - .../acs/agv/rest/XianGongAgvController.java | 33 - .../nl/acs/agv/rest/ZheDaAgvController.java | 7 - .../nl/acs/agv/server/XianGongAgvService.java | 129 -- .../nl/acs/agv/server/ZheDaAgvService.java | 50 - .../server/impl/XianGongAgvServiceImpl.java | 1429 ----------------- .../agv/server/impl/ZheDaAgvServiceImpl.java | 442 ----- .../acs/device_driver/FeedLmsRealFailed.java | 11 - .../HeartbeatableDeviceDriver.java | 14 - .../device_driver/LinewayDeviceDriver.java | 16 - .../device_driver/ScannerDeviceDriver.java | 20 - .../device_driver/StandardRequestMethod.java | 149 -- .../device_driver/StorageDeviceDriver.java | 54 - .../agv/xg_agv_car/XgAgvCarDefination.java | 49 - .../agv/xg_agv_car/XgAgvCarDeviceDriver.java | 310 ---- .../standard_autodoor/ItemProtocol.java | 82 - .../StandardAutodoorDefination.java | 63 - .../StandardAutodoorDeviceDriver.java | 135 -- .../ToDoorCommandControl.java | 27 - .../main/java/org/nl/acs/ext/wms/AcsUtil.java | 3 - .../main/java/org/nl/acs/ext/wms/LmsUtil.java | 3 - .../org/nl/acs/ext/wms/RetryableUtil.java | 67 - .../service/impl/InstructionServiceImpl.java | 65 - .../java/org/nl/acs/opc/DeviceAppService.java | 8 - .../org/nl/acs/opc/DeviceAppServiceImpl.java | 6 - .../service/dto/StorageCellQueryParam.java | 6 - .../acs/task/service/dto/TaskQueryParam.java | 8 +- .../task/service/impl/TaskServiceImpl.java | 39 - .../acs/task/service/mapper/TaskMapper.java | 3 - .../java/org/nl/common/annotation/Limit.java | 50 - .../org/nl/common/annotation/RateLimiter.java | 39 - .../org/nl/common/aspect/LimitAspect.java | 105 -- .../java/org/nl/common/aspect/LimitType.java | 27 - .../org/nl/common/mnt/util/DataTypeEnum.java | 140 -- .../nl/common/mnt/util/ExecuteShellUtil.java | 103 -- .../org/nl/common/mnt/util/ScpClientUtil.java | 105 -- .../java/org/nl/common/mnt/util/SqlUtils.java | 206 --- .../java/org/nl/common/mnt/util/ZipUtils.java | 159 -- .../controller/dict/SysDictController.java | 2 - .../nladmin-ui/src/api/generator/genConfig.js | 16 - .../nladmin-ui/src/api/generator/generator.js | 33 - acs2/nladmin-ui/src/i18n/langs/task/zh.js | 2 +- .../src/views/acs/device/acsToERP/index.vue | 175 -- .../src/views/acs/test/hailiang/index.vue | 152 -- .../components/EditDownModal.vue | 140 -- .../components/EditDownTable.vue | 127 -- .../components/EditPopupModal.vue | 117 -- .../components/FilterComplex.vue | 69 - .../components/FilterContent.vue | 138 -- .../VxeTableRender/components/FilterExcel.vue | 262 --- .../VxeTableRender/components/FilterInput.vue | 50 - .../VxeTableRender/components/FormSimple.vue | 52 - .../components/VxeTableRender/content.js | 28 - .../components/VxeTableRender/default.js | 12 - .../views/components/VxeTableRender/edit.js | 57 - .../views/components/VxeTableRender/empty.js | 13 - .../views/components/VxeTableRender/filter.js | 123 -- .../views/components/VxeTableRender/form.js | 23 - .../views/components/VxeTableRender/index.js | 7 - .../components/VxeTableRender/toolbar.js | 29 - .../views/components/excel/upload-excel.vue | 41 - .../views/components/icons/element-icons.js | 74 - .../src/views/components/icons/index.vue | 97 -- .../src/views/components/icons/svg-icons.js | 10 - .../nladmin-ui/src/views/generator/config.vue | 328 ---- acs2/nladmin-ui/src/views/generator/index.vue | 118 -- .../src/views/generator/preview.vue | 30 - .../src/views/tools/codeGen/codeDetail.js | 39 - .../src/views/tools/codeGen/codeDetail.vue | 235 --- .../src/views/tools/codeGen/genCode.js | 36 - .../src/views/tools/codeGen/index.vue | 144 -- .../src/views/tools/storage/index.vue | 188 --- .../src/views/tools/storage/localStorage.js | 27 - .../src/views/tools/swagger/index.vue | 16 - 75 files changed, 3 insertions(+), 7178 deletions(-) create mode 100644 .gitignore delete mode 100644 acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/rest/XianGongAgvController.java delete mode 100644 acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/rest/ZheDaAgvController.java delete mode 100644 acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/XianGongAgvService.java delete mode 100644 acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/ZheDaAgvService.java delete mode 100644 acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java delete mode 100644 acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/ZheDaAgvServiceImpl.java delete mode 100644 acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/FeedLmsRealFailed.java delete mode 100644 acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/HeartbeatableDeviceDriver.java delete mode 100644 acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/LinewayDeviceDriver.java delete mode 100644 acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/ScannerDeviceDriver.java delete mode 100644 acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/StandardRequestMethod.java delete mode 100644 acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/StorageDeviceDriver.java delete mode 100644 acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/xg_agv_car/XgAgvCarDefination.java delete mode 100644 acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/xg_agv_car/XgAgvCarDeviceDriver.java delete mode 100644 acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/ItemProtocol.java delete mode 100644 acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/StandardAutodoorDefination.java delete mode 100644 acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/StandardAutodoorDeviceDriver.java delete mode 100644 acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/ToDoorCommandControl.java delete mode 100644 acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/RetryableUtil.java delete mode 100644 acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/annotation/Limit.java delete mode 100644 acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/annotation/RateLimiter.java delete mode 100644 acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/aspect/LimitAspect.java delete mode 100644 acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/aspect/LimitType.java delete mode 100644 acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/mnt/util/DataTypeEnum.java delete mode 100644 acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/mnt/util/ExecuteShellUtil.java delete mode 100644 acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/mnt/util/ScpClientUtil.java delete mode 100644 acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/mnt/util/SqlUtils.java delete mode 100644 acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/mnt/util/ZipUtils.java delete mode 100644 acs2/nladmin-ui/src/api/generator/genConfig.js delete mode 100644 acs2/nladmin-ui/src/api/generator/generator.js delete mode 100644 acs2/nladmin-ui/src/views/acs/device/acsToERP/index.vue delete mode 100644 acs2/nladmin-ui/src/views/acs/test/hailiang/index.vue delete mode 100644 acs2/nladmin-ui/src/views/components/VxeTableRender/components/EditDownModal.vue delete mode 100644 acs2/nladmin-ui/src/views/components/VxeTableRender/components/EditDownTable.vue delete mode 100644 acs2/nladmin-ui/src/views/components/VxeTableRender/components/EditPopupModal.vue delete mode 100644 acs2/nladmin-ui/src/views/components/VxeTableRender/components/FilterComplex.vue delete mode 100644 acs2/nladmin-ui/src/views/components/VxeTableRender/components/FilterContent.vue delete mode 100644 acs2/nladmin-ui/src/views/components/VxeTableRender/components/FilterExcel.vue delete mode 100644 acs2/nladmin-ui/src/views/components/VxeTableRender/components/FilterInput.vue delete mode 100644 acs2/nladmin-ui/src/views/components/VxeTableRender/components/FormSimple.vue delete mode 100644 acs2/nladmin-ui/src/views/components/VxeTableRender/content.js delete mode 100644 acs2/nladmin-ui/src/views/components/VxeTableRender/default.js delete mode 100644 acs2/nladmin-ui/src/views/components/VxeTableRender/edit.js delete mode 100644 acs2/nladmin-ui/src/views/components/VxeTableRender/empty.js delete mode 100644 acs2/nladmin-ui/src/views/components/VxeTableRender/filter.js delete mode 100644 acs2/nladmin-ui/src/views/components/VxeTableRender/form.js delete mode 100644 acs2/nladmin-ui/src/views/components/VxeTableRender/index.js delete mode 100644 acs2/nladmin-ui/src/views/components/VxeTableRender/toolbar.js delete mode 100644 acs2/nladmin-ui/src/views/components/excel/upload-excel.vue delete mode 100644 acs2/nladmin-ui/src/views/components/icons/element-icons.js delete mode 100644 acs2/nladmin-ui/src/views/components/icons/index.vue delete mode 100644 acs2/nladmin-ui/src/views/components/icons/svg-icons.js delete mode 100644 acs2/nladmin-ui/src/views/generator/config.vue delete mode 100644 acs2/nladmin-ui/src/views/generator/index.vue delete mode 100644 acs2/nladmin-ui/src/views/generator/preview.vue delete mode 100644 acs2/nladmin-ui/src/views/tools/codeGen/codeDetail.js delete mode 100644 acs2/nladmin-ui/src/views/tools/codeGen/codeDetail.vue delete mode 100644 acs2/nladmin-ui/src/views/tools/codeGen/genCode.js delete mode 100644 acs2/nladmin-ui/src/views/tools/codeGen/index.vue delete mode 100644 acs2/nladmin-ui/src/views/tools/storage/index.vue delete mode 100644 acs2/nladmin-ui/src/views/tools/storage/localStorage.js delete mode 100644 acs2/nladmin-ui/src/views/tools/swagger/index.vue diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fb9d512 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +acs2/.idea/ diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/QueryAGVStatus.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/QueryAGVStatus.java index 366b286..182cb83 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/QueryAGVStatus.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/QueryAGVStatus.java @@ -12,7 +12,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; import org.nl.acs.AcsConfig; import org.nl.acs.device.domain.Device; -import org.nl.acs.device_driver.agv.xg_agv_car.XgAgvCarDeviceDriver; import org.nl.acs.instruction.domain.Instruction; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.opc.DeviceAppService; @@ -85,13 +84,6 @@ public class QueryAGVStatus { taskService.update(task); if (StrUtil.isNotEmpty(instructionCode)) { Device carCode = deviceAppService.findDeviceByCode(instructionCode); - XgAgvCarDeviceDriver xgAgvCarDeviceDriver; - if (null != carCode) { - if (carCode.getDeviceDriver() instanceof XgAgvCarDeviceDriver) { - xgAgvCarDeviceDriver = (XgAgvCarDeviceDriver) carCode.getDeviceDriver(); - xgAgvCarDeviceDriver.setTaskType(AgvActionTypeEnum.getStatus(instruction.getAgv_action_type())); - } - } } } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/rest/XianGongAgvController.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/rest/XianGongAgvController.java deleted file mode 100644 index b1b9980..0000000 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/rest/XianGongAgvController.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.nl.acs.agv.rest; - -import cn.dev33.satoken.annotation.SaIgnore; -import com.alibaba.fastjson.JSONObject; -import groovy.lang.Lazy; -import org.nl.acs.agv.server.XianGongAgvService; -import org.nl.common.logging.annotation.Log; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Configurable; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; - -/** - * @author 20220102CG\noblelift - */ - -@Controller -public class XianGongAgvController { - @Lazy - @Autowired - private XianGongAgvService xianGongAgentService; - - @PostMapping("/api/agv/xg/waitPointRequest") - @Log("仙工AGV请求取放货") - @SaIgnore - public ResponseEntity xgAGVWaitPointRequest(@RequestBody JSONObject requestParam) { - return new ResponseEntity<>(xianGongAgentService.xgAGVWaitPointRequest(requestParam), HttpStatus.OK); - } - -} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/rest/ZheDaAgvController.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/rest/ZheDaAgvController.java deleted file mode 100644 index 2a53630..0000000 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/rest/ZheDaAgvController.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.nl.acs.agv.rest; - -/** - * @author 20220102CG\noblelift - */ -public class ZheDaAgvController { -} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/XianGongAgvService.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/XianGongAgvService.java deleted file mode 100644 index fcd194c..0000000 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/XianGongAgvService.java +++ /dev/null @@ -1,129 +0,0 @@ -package org.nl.acs.agv.server; - -import cn.hutool.http.HttpResponse; -import com.alibaba.fastjson.JSONObject; -import org.nl.acs.agv.server.dto.AgvDto; -import org.nl.acs.instruction.domain.Instruction; -import org.nl.acs.instruction.service.dto.InteractionJsonDTO; - -import java.util.Map; - -/** - * @Author: lyd - * @Description: - * @Date: 2022-08-15 - */ -public interface XianGongAgvService { - /** - * 查询所有AGV - * @return - */ - Map findAllAgvFromCache(); - - /** - * 查询自动门状态 - * - * @param device - * @return - */ - public String queryDoorStatus(String device); - - /** - * 先工agv 等待点请求 - * AGV->ACS - * @param param - * @return - */ - public String waitPointRequest(String param); - - /** - * acs->agv - * 关闭运单系列 - * - * @param code - * @return - * @throws Exception - */ - public HttpResponse markComplete(String code) throws Exception; - - /** - * 查询AGV状态 - * - * @return - */ - public HttpResponse queryXZAgvDeviceStatus(); - - /** - * 查询AGV任务状态 - * @param instCode - * @return - */ - public HttpResponse queryXZAgvInstStatus(String instCode); - - /** - * 删除先知任务 - * - * @param instCode - * @return - */ - public HttpResponse deleteXZAgvInst(String instCode); - - - /** - * 下发运单序列 - * - * @param inst - * @return - * @throws Exception - */ - public HttpResponse sendOrderSequencesToXZ(Instruction inst) throws Exception; - - /** - * 追加运单 - * @param inst - * @return - * @throws Exception - */ - public HttpResponse addOrderSequences(Instruction inst) throws Exception; - - /** - * 组织json数据 - * @param inst - * @return - * @throws Exception - */ - public String sendOrderSequencesParam(Instruction inst) throws Exception; - - - /** - * 创建 - * @param inst - * @param type - * @return - */ - public JSONObject createOrederData(Instruction inst, String type); - - /** - * 请求取货放货 - * @param requestParam - * @return - */ - JSONObject xgAGVWaitPointRequest(JSONObject requestParam); - - - /** - * 查询场景中指定机器人信息 - */ - HttpResponse getRobotInfo(String robotCode); - - /** - * 下发叉车运单 - * - * @param dto - * @param interactionJsonDTO - * @return - */ - HttpResponse sendOrderSequencesToForklift(Instruction dto, InteractionJsonDTO interactionJsonDTO); - - -} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/ZheDaAgvService.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/ZheDaAgvService.java deleted file mode 100644 index 7e43c63..0000000 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/ZheDaAgvService.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.nl.acs.agv.server; - - -import cn.hutool.http.HttpResponse; -import org.nl.acs.instruction.domain.Instruction; - -/** - * 浙大AGV服务 - * @author 20220102CG\noblelift - */ -public interface ZheDaAgvService { - - /** - * 下发指令 - * - * @param inst 指令对象 - * @return - * @throws Exception - */ - public HttpResponse sendAgvInstToAgv(Instruction inst) throws Exception; - - /** - * 查询AGV状态 - * 永裕家居项目:共两楼 - * - * @param floor 1、二楼AGV系统;2、一楼AGV系统 - * @return - */ - public HttpResponse queryAgvInstStatus(String floor); - - /** - * AGV任务处理 - * @param jobno - * @param type - * @param address - * @param action - * @param processingVehicle - * @return - */ - String process(String jobno, String type, String address, String action, String processingVehicle); - - /** - * 标记完成 - * - * @param code - * @return - */ - public HttpResponse markComplete(String code); - -} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java deleted file mode 100644 index 379fabd..0000000 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java +++ /dev/null @@ -1,1429 +0,0 @@ -package org.nl.acs.agv.server.impl; - -import cn.hutool.core.util.IdUtil; -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -import cn.hutool.http.HttpRequest; -import cn.hutool.http.HttpResponse; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import jodd.util.StringUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.nl.acs.AcsConfig; -import org.nl.acs.agv.AgvUtil; -import org.nl.acs.agv.AgvWaitUtil; -import org.nl.acs.agv.server.XianGongAgvService; -import org.nl.acs.agv.server.dto.AgvDto; -import org.nl.acs.common.base.CommonFinalParam; -import org.nl.acs.device.domain.Device; -import org.nl.acs.device_driver.conveyor.standard_ordinary_site.StandardOrdinarySiteDeviceDriver; -import org.nl.acs.ext.wms.service.AcsToWmsService; -import org.nl.acs.instruction.domain.Instruction; -import org.nl.acs.instruction.service.InstructionService; -import org.nl.acs.instruction.service.dto.InteractionJsonDTO; -import org.nl.acs.opc.DeviceAppService; -import org.nl.acs.device.enums.DeviceType; -import org.nl.acs.task.enums.ActionTypeEnum; -import org.nl.acs.task.enums.AgvActionTypeEnum; -import org.nl.acs.task.enums.AgvSystemTypeEnum; -import org.nl.acs.task.service.TaskService; -import org.nl.acs.task.service.dto.TaskDto; -import org.nl.common.exception.BadRequestException; -import org.nl.config.language.LangProcess; -import org.nl.config.lucene.service.LuceneExecuteLogService; -import org.nl.config.lucene.service.dto.LuceneLogDto; -import org.nl.system.service.param.ISysParamService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Lazy; -import org.springframework.stereotype.Service; - -import java.util.*; - -/** - * @author 20220102CG\noblelift - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class XianGongAgvServiceImpl implements XianGongAgvService { - private final DeviceAppService deviceAppService; - private final ISysParamService paramService; - @Autowired - @Lazy - private AcsToWmsService acsToWmsService; - - @Autowired - private InstructionService instructionService; - - @Autowired - private TaskService taskserver; - - @Autowired - private LuceneExecuteLogService luceneExecuteLogService; - @Autowired - private DeviceAppService deviceAppservice; - - - @Autowired - private AgvWaitUtil agvWaitUtil; - - Map AGVDeviceStatus = new HashMap(); - - private static final String JACKLOAD_THREE = "3"; - private static final String FOUR = "4"; - private static final String WAIT_FIVE = "5"; - - @Value("${agvToAcs.addr}") - private String addr; - - - @Override - public String waitPointRequest(String param) { - log.info("收到AGV请求参数:{}", param); - String[] strs = param.split("-"); - String address = strs[0]; - String inst_code = strs[1]; - String type = strs[2]; - String newaddress = null; - // 前置点会加上p - if (address.endsWith("IN")) { - newaddress = address.substring(0, address.length() - 2); - } else if (address.endsWith("OUT")) { - newaddress = address.substring(0, address.length() - 3); - } else if (address.endsWith("P") || address.endsWith("L") || address.endsWith("R")) { - newaddress = address.substring(0, address.length() - 1); - } else if (address.endsWith("CZ")) { - newaddress = address.substring(0, address.length() - 2); - } else if (address.endsWith("IQ") || address.endsWith("OQ")) { - newaddress = address.substring(0, address.length() - 2); - } else { - newaddress = address; - } - boolean is_feedback = false; - - Device device = deviceAppService.findDeviceByCode(newaddress); - JSONObject jo = new JSONObject(); - if (is_feedback) { - jo.put("name", param); - jo.put("lastAction", "wait"); - jo.put("lastActionStatus", "DONE"); - jo.put("status", "IDLE"); - } else { - jo.put("name", param); - jo.put("lastAction", "wait"); - jo.put("lastActionStatus", "FAILED"); - jo.put("status", "IDLE"); - } - is_feedback = false; - log.info("反馈AGV请求参数:{}", jo.toString()); - - return jo.toString(); - - } - - - @Override - public HttpResponse markComplete(String code) throws Exception { - - if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) { - String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue(); - String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue(); - - agvurl = agvurl + ":" + agvport + "/api/route/orderSequences/" + code + "/markComplete"; - log.info("关闭agv运单序列请求:{}", agvurl); - - HttpResponse result = HttpRequest.post(agvurl) - //.body(String.valueOf(orderjo))//表单内容 - //超时,毫秒 - .timeout(20000) - .execute(); - log.info("关闭agv运单序列请求反馈:{}", result); - - return result; - } else { - return null; - } - - - } - - - @Override - public HttpResponse queryXZAgvDeviceStatus() { - - if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) { - String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue(); - String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue(); - - String agvurl1 = agvurl + ":" + agvport + "/api/route/vehicles"; - String agvurl2 = agvurl + ":" + agvport + "/api/route/vehicleDetails"; - - HttpResponse result = HttpRequest.get(agvurl1) - //超时,毫秒 - .timeout(20000) - .execute(); - - - HttpResponse result2 = HttpRequest.get(agvurl2) - //超时,毫秒 - .timeout(20000) - .execute(); - - System.out.println("查询agv状态数据:" + result.body()); - if (result.getStatus() == CommonFinalParam.STATUS_OPEN) { - JSONArray ja = (JSONArray) JSONArray.parse(result.body()); - - for (int i = 0; i < ja.size(); i++) { - JSONObject jo = (JSONObject) ja.get(i); - String name = jo.getString("name"); - String state = jo.getString("state"); - String energyLevel = jo.getString("energyLevel"); - String transportOrder = jo.getString("transportOrder"); - JSONObject detailjo = (JSONObject) JSONObject.parse(result2.body()); - JSONObject item = (JSONObject) detailjo.get(name); - String x = item.getString("x"); - String y = item.getString("y"); - String angle = item.getString("angle"); - AgvDto dto = new AgvDto(); - dto.setName(name); - dto.setEnergyLevel(energyLevel); - dto.setState(state); - dto.setTransportOrder(transportOrder); - dto.setPositionAngle(angle); - dto.setPositionX(x); - dto.setPositionY(y); - if (AGVDeviceStatus.containsKey(name)) { - AGVDeviceStatus.remove(name); - AGVDeviceStatus.put(name, dto); - } else { - AGVDeviceStatus.put(name, dto); - } - } - } - return result; - } else { - return null; - } - - - } - - - @Override - public HttpResponse queryXZAgvInstStatus(String instCode) { - - if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) { - String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue(); - String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue(); - - agvurl = agvurl + ":" + agvport + "/api/route/transportOrders/" + instCode; - - HttpResponse result = HttpRequest.get(agvurl) - //超时,毫秒 - .timeout(20000) - .execute(); - System.out.println("查询agv指令数据:" + result.body()); - - return result; - } else { - - return null; - } - } - - - @Override - public HttpResponse deleteXZAgvInst(String instCode) { - if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) { - String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue(); - String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue(); - - agvurl = agvurl + ":" + agvport + "/terminate"; - JSONObject jsonObject = new JSONObject(); - jsonObject.put("id", instCode); - jsonObject.put("disableVehicle", false); - log.info("删除agv指令请求agvurl:{}", agvurl); - HttpResponse result = HttpRequest.post(agvurl) - .body(jsonObject.toJSONString()) - .timeout(20000) - .execute(); - log.info("删除agv指令请求反馈:{}", result); - return result; - } else { - return null; - } - } - - - @Override - public HttpResponse sendOrderSequencesToXZ(Instruction inst) throws Exception { - com.alibaba.fastjson.JSONObject jo = new com.alibaba.fastjson.JSONObject(); - jo.put("id", inst.getInstruction_code()); - //运单封口,true=创建运单之后不可添加动作块;false=创建运单可以添加动作块 - if (AgvActionTypeEnum.ORDINARY.getCode().equals(inst.getAgv_action_type())) { - jo.put("complete", true); - } else { - jo.put("complete", false); - } - //动作块 - jo.put("blocks", createBlocksData(inst)); - //运单优先级 - jo.put("priority", inst.getPriority()); - log.info("任务号:{},指令号{},下发诺宝运单序列参数:{}", inst.getTask_code(), inst.getInstruction_code(), jo); - - if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) { - String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue(); - String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue(); - - agvurl = agvurl + ":" + agvport + "/setOrder"; - - log.info(agvurl); - HttpResponse result = HttpRequest.post(agvurl) - //表单内容 - .body(String.valueOf(jo)) - //超时,毫秒 - .timeout(20000) - .execute(); - log.info("任务号:{},指令号{},状态{},下发agv订单序列反馈:{}", inst.getTask_code(), inst.getInstruction_code(), result.getStatus(), result.body()); - - return result; - } else { - return null; - } - } - - /** - * 下发动作块信号 - * - * @param inst - * @return - */ - public JSONArray createBlocksData(Instruction inst) { - JSONArray ja = new JSONArray(); - String instruction_code = inst.getInstruction_code(); - String start_device_code = inst.getStart_device_code(); - String start_point_code = inst.getStart_point_code(); - String next_device_code = inst.getNext_device_code(); - String next_point_code = inst.getNext_point_code(); - Integer agv_action_type = inst.getAgv_action_type(); - - - //起点1 - sendStartDeviceOrder(ja, start_device_code, start_point_code, instruction_code, agv_action_type); - //终点1 - sendEndDeviceOrder(ja, start_device_code, instruction_code, next_point_code, next_device_code, agv_action_type); - - return ja; - } - - /** - * 下发取货信号 - * - * @param ja - * @param pointCode 起始点位 - * @param device_code 起始设备 - * @param instCode 指令号 - * @param agv_action_type - */ - public void sendStartDeviceOrder(JSONArray ja, String pointCode, String device_code, String instCode, Integer agv_action_type) { - Device startDevice = deviceAppService.findDeviceByCode(device_code); - //取货前等待 - JSONObject jo = new JSONObject(); - //动作块id - jo.put("blockId", IdUtil.simpleUUID()); - //目的地名称 - if (AgvActionTypeEnum.IN_STOCK.getCode().equals(agv_action_type) || AgvActionTypeEnum.IN_OUT_STOCK.getCode().equals(agv_action_type)) { - jo.put("location", pointCode + "WAIT"); - } else { - jo.put("location", pointCode + "INGET"); - } - //执行脚本 - jo.put("operation", "script"); - if (AgvActionTypeEnum.IN_STOCK.getCode().equals(agv_action_type) || AgvActionTypeEnum.IN_OUT_STOCK.getCode().equals(agv_action_type)) { - jo.put("id", pointCode + "WAIT"); - } else { - jo.put("id", pointCode + "INGET"); - } - //通信脚本,动作前后与现场设备交互的场景 - jo.put("script_name", "userpy/interact.py"); - JSONObject script_args = new JSONObject(); - //更改为现场设备IP及PORT - script_args.put("addr", addr); - JSONObject data = new JSONObject(); - JSONObject reach = new JSONObject(); - reach.put("task_code", instCode); - if (AgvActionTypeEnum.IN_STOCK.getCode().equals(agv_action_type) || AgvActionTypeEnum.IN_OUT_STOCK.getCode().equals(agv_action_type)) { - reach.put("address", pointCode + "WAIT"); - } else { - reach.put("address", pointCode + "INGET"); - } - data.put("reach", reach); - script_args.put("data", data); - script_args.put("protocol", "HTTP"); - jo.put("script_args", script_args); - ja.add(jo); - - if (AgvActionTypeEnum.ORDINARY.getCode().equals(agv_action_type) || AgvActionTypeEnum.OUT_STOCK.getCode().equals(agv_action_type)) { - //将货物顶起来,机器识别提升高度 - JSONObject jo1 = new JSONObject(); - jo1.put("blockId", IdUtil.simpleUUID()); - jo1.put("location", pointCode); - jo1.put("operation", "JackLoad"); - inspectInStocckSet(pointCode, jo1); - ja.add(jo1); - JSONObject jo2 = new JSONObject(); - jo2.put("blockId", IdUtil.simpleUUID()); - jo2.put("location", pointCode + "OUTGET"); - jo2.put("operation", "script"); - jo2.put("id", pointCode + "OUTGET"); - jo2.put("script_name", "userpy/interact.py"); - JSONObject script_args2 = new JSONObject(); - script_args2.put("addr", addr); - JSONObject data2 = new JSONObject(); - JSONObject reach2 = new JSONObject(); - reach2.put("task_code", instCode); - reach2.put("address", pointCode + "OUTGET"); - data2.put("reach", reach2); - script_args2.put("data", data2); - script_args2.put("protocol", "HTTP"); - jo2.put("script_args", script_args2); - ja.add(jo2); - } - } - - private void inspectInStocckSet(String pointCode, JSONObject jo1) { - Device device = deviceAppservice.findDeviceByCode(pointCode); - StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver; - if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { - String inspectInStocck = (String) device.getExtraValue().get("inspect_in_stocck"); - if (StrUtil.isNotEmpty(inspectInStocck) && inspectInStocck.equals("true")) { - jo1.put("operationArgs", new JSONObject() {{ - put("recognize", false); - }}); - } else { - jo1.put("operationArgs", new JSONObject() {{ - put("recognize", true); - }}); - } - } else { - jo1.put("operationArgs", new JSONObject() {{ - put("recognize", true); - }}); - } - } - - /** - * 下发放货信号 - * - * @param ja - * @param device_code 起始设备 - * @param instCode 指令号 - * @param pointCode 终点点位 - * @param nextDeviceCode 终点设备 - * @param agv_action_type - */ - public void sendEndDeviceOrder(JSONArray ja, String device_code, String instCode, String pointCode, String nextDeviceCode, Integer agv_action_type) { - Device nextDevice = deviceAppService.findDeviceByCode(nextDeviceCode); - if (!AgvActionTypeEnum.IN_STOCK.getCode().equals(agv_action_type)) { - //放货前等待 - JSONObject jo3 = new JSONObject(); - jo3.put("blockId", IdUtil.simpleUUID()); - if (AgvActionTypeEnum.OUT_STOCK.getCode().equals(agv_action_type) || AgvActionTypeEnum.IN_OUT_STOCK.getCode().equals(agv_action_type)) { - jo3.put("location", pointCode + "WAIT"); - } else { - jo3.put("location", pointCode + "INPUT"); - } - jo3.put("operation", "script"); - if (AgvActionTypeEnum.OUT_STOCK.getCode().equals(agv_action_type) || AgvActionTypeEnum.IN_OUT_STOCK.getCode().equals(agv_action_type)) { - jo3.put("id", pointCode + "WAIT"); - } else { - jo3.put("id", pointCode + "INPUT"); - } - jo3.put("script_name", "userpy/interact.py"); - JSONObject script_args3 = new JSONObject(); - script_args3.put("addr", addr); - JSONObject data3 = new JSONObject(); - JSONObject reach3 = new JSONObject(); - reach3.put("task_code", instCode); - if (AgvActionTypeEnum.OUT_STOCK.getCode().equals(agv_action_type) || AgvActionTypeEnum.IN_OUT_STOCK.getCode().equals(agv_action_type)) { - reach3.put("address", pointCode + "WAIT"); - } else { - reach3.put("address", pointCode + "INPUT"); - } - data3.put("reach", reach3); - script_args3.put("data", data3); - script_args3.put("protocol", "HTTP"); - jo3.put("script_args", script_args3); - ja.add(jo3); - - if (AgvActionTypeEnum.ORDINARY.getCode().equals(agv_action_type)) { - //将货物放下 - com.alibaba.fastjson.JSONObject jo4 = new com.alibaba.fastjson.JSONObject(); - jo4.put("blockId", IdUtil.simpleUUID()); - jo4.put("location", pointCode); - jo4.put("operation", "JackUnload"); - ja.add(jo4); - - - //放货完成等待 - com.alibaba.fastjson.JSONObject jo5 = new com.alibaba.fastjson.JSONObject(); - jo5.put("blockId", IdUtil.simpleUUID()); - jo5.put("location", pointCode + "OUTPUT"); - jo5.put("operation", "script"); - jo5.put("id", pointCode + "OUTPUT"); - jo5.put("script_name", "userpy/interact.py"); - com.alibaba.fastjson.JSONObject script_args5 = new com.alibaba.fastjson.JSONObject(); - script_args5.put("addr", addr); - com.alibaba.fastjson.JSONObject data5 = new com.alibaba.fastjson.JSONObject(); - com.alibaba.fastjson.JSONObject reach5 = new com.alibaba.fastjson.JSONObject(); - reach5.put("task_code", instCode); - reach5.put("address", pointCode + "OUTPUT"); - data5.put("reach", reach5); - script_args5.put("data", data5); - script_args5.put("protocol", "HTTP"); - jo5.put("script_args", script_args5); - ja.add(jo5); - } - } - - } - - - @Override - public HttpResponse addOrderSequences(Instruction inst) throws Exception { - JSONObject orderjo = createOrederData(inst, CommonFinalParam.ONE); - log.info("指令号:{},追加agv订单序列参数:{}", inst.getInstruction_code(), orderjo.toString()); - - if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) { - String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue(); - String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue(); - - agvurl = agvurl + ":" + agvport + "/api/route/transportOrders/" + inst.getInstruction_code(); - - HttpResponse result = HttpRequest.post(agvurl) - //表单内容 - .body(String.valueOf(orderjo)) - //超时,毫秒 - .timeout(20000) - .execute(); - log.info(agvurl); - log.info("任务号:{},指令号{},状态{},追加agv订单序列参数:{}", inst.getTask_code(), inst.getInstruction_code(), result.getStatus(), result.body()); - - return result; - } else { - return null; - } - } - - - @Override - public String sendOrderSequencesParam(Instruction inst) throws Exception { - JSONObject jo = new JSONObject(); - jo.put("intendedVehicle", ""); - jo.put("category", "Park"); - jo.put("failureFatal", true); - jo.put("complete", false); - JSONArray transports = new JSONArray(); - JSONObject orderjo = createOrederData(inst, "0"); - JSONObject order = new JSONObject(); - orderjo.put("order", order); - orderjo.put("name", inst.getInstruction_code()); - transports.add(orderjo); - jo.put("transports", transports); - return jo.toString(); - } - - - @Override - public JSONObject createOrederData(Instruction inst, String inst_type) { - String inst_code = inst.getInstruction_code(); - String task_code = inst.getTask_code(); - String compound_inst_data = inst.getCompound_inst_data(); - String[] str = null; - List pathlist = null; - if (!StrUtil.isEmpty(compound_inst_data)) { - str = compound_inst_data.split("->"); - pathlist = Arrays.asList(str); - } - JSONArray ja = new JSONArray(); - JSONObject orderjo = new JSONObject(); - - //1表示追加任务,需将task_code赋值给wrappingSequence - if (StrUtil.equals(CommonFinalParam.ONE, inst_type)) { - orderjo.put("wrappingSequence", task_code); - } - String instno = inst.getInstruction_code(); - //指定agv车号 暂时不用 - //orderjo.put("intendedVehicle", ""); - //设置任务最终时间 - orderjo.put("deadline", AgvUtil.getNextDay(1)); - orderjo.put("category", ""); - //拼接起点子任务动作,待完善,动作码需要从数据库取值 - int type = Integer.parseInt(paramService.findByCode(AcsConfig.BUSINESSTYPE).getValue()); - - switch (type) { - case 3: - break; - case 4: - break; - case 6: - String startAddress = inst.getStart_device_code(); - String nextAddress = inst.getNext_device_code(); - Device startdevice = deviceAppService.findDeviceByCode(startAddress); - Device nextdevice = deviceAppService.findDeviceByCode(nextAddress); - break; - default: - break; - } - - orderjo.put("destinations", ja); - JSONObject prijo = new JSONObject(); - prijo.put("key", "duration"); - prijo.put("value", "101"); - - JSONArray prija = new JSONArray(); - prija.add(prijo); - orderjo.put("properties", prija); - - return orderjo; - } - - - /** - * 返回一个点位操作子任务 先知使用 - * - * @param locationName 点位 - * @param operation 点位操作 - * @param propertiesType 子任务类型 - * @param pro 子任务参数 - * 调用demo:destination("sh15p", "Spin", CommonFinalParam.TWO, "3.14") - * demo:destination("cz14", "JackUnload", "3", "") - * @return - */ - - public static JSONObject destination2(String locationName, String operation, String propertiesType, String pro) { - - //新增业务订单 - JSONObject destinationOrder = new JSONObject(); - //目标工作站 - destinationOrder.put("locationName", locationName); - //机器人在工作站要执行的操作 - destinationOrder.put("operation", operation); - //Wait请求是否继续 - if (CommonFinalParam.ONE.equals(propertiesType)) { - JSONArray properties = new JSONArray(); - JSONObject pro2 = new JSONObject(); - //固定值 - pro2.put("key", "device:queryAtExecuted"); - //pro为wait请求的标识,一般用点位拼接的字符串 - pro2.put("value", pro + ":wait"); - properties.add(pro2); - destinationOrder.put("properties", properties); - //Spin转动 - } else if (CommonFinalParam.TWO.equals(propertiesType)) { - JSONArray properties = new JSONArray(); - JSONObject pro1 = new JSONObject(); - //坐标系类型,global_spin_angle为全局坐标系 - pro1.put("key", "global_spin_angle"); - //弧度值,如3.14 - pro1.put("value", pro); - properties.add(pro1); - JSONObject pro2 = new JSONObject(); - //固定值 - pro2.put("key", "spin_direction"); - //弧度值,如0 - pro2.put("value", "0"); - properties.add(pro2); - destinationOrder.put("properties", properties); - //JackUnload,Jackload不操作 - } else if (JACKLOAD_THREE.equals(propertiesType)) { - JSONArray properties = new JSONArray(); - JSONObject pro1 = new JSONObject(); - //固定值 - pro1.put("key", "recognize"); - //固定值 - pro1.put("value", "false"); - properties.add(pro1); - destinationOrder.put("properties", properties); - } else if (FOUR.equals(propertiesType)) { - JSONArray properties = new JSONArray(); - JSONObject pro1 = new JSONObject(); - //坐标系类型,robot_spin_angle为机器人坐标系 - pro1.put("key", "robot_spin_angle"); - //弧度值,如3.14 - pro1.put("value", pro); - properties.add(pro1); - JSONObject pro2 = new JSONObject(); - //固定值 - pro2.put("key", "spin_direction"); - //弧度值,如0 - pro2.put("value", "0"); - properties.add(pro2); - destinationOrder.put("properties", properties); - //Wait请求是否继续 - } else if (WAIT_FIVE.equals(propertiesType)) { - JSONArray properties = new JSONArray(); - JSONObject pro2 = new JSONObject(); - - destinationOrder.put("properties", "[]"); - } - return destinationOrder; - } - - - @Override - public String queryDoorStatus(String device) { - log.info("AGV查询自动门状态,参数:{}", device); - int type = Integer.parseInt(paramService.findByCode(AcsConfig.BUSINESSTYPE).getValue()); - switch (type) { - case 4: - if (StrUtil.equals(paramService.findByCode(AcsConfig.HASOTHERSYSTEM).getValue(), CommonFinalParam.ONE)) { - //String result = acsToWmsService.queryDoorsStatus().body(); -// JSONArray ja = JSONArray.parseArray(result); -// log.info("AGV查询自动门状态,反馈:{}", ja.toString()); -// return ja.toString(); - } - return null; - default: - if (StrUtil.equals(CommonFinalParam.DOORS, device)) { - List list = deviceAppService.findDevice(DeviceType.autodoor); - JSONArray ja = new JSONArray(); - for (int i = 0; i < list.size(); i++) { - Device doordevice = deviceAppService.findDeviceByCode(list.get(i).getDevice_code()); - if (ObjectUtil.isEmpty(doordevice)) { - throw new BadRequestException(LangProcess.msg("device_checkNull", list.get(i).getDevice_code())); - } - String mes = null; - JSONObject jo = JSONObject.parseObject(mes); - ja.add(jo); - } - log.info("AGV查询自动门状态,反馈:{}", ja.toString()); - return ja.toString(); - - } else { - Device doordevice = deviceAppService.findDeviceByCode(device); - if (ObjectUtil.isEmpty(doordevice)) { - throw new BadRequestException(LangProcess.msg("device_checkNull", device)); - } - String mes = null; - JSONObject jo = JSONObject.parseObject(mes); - log.info("AGV查询自动门状态,反馈:{}", jo.toString()); - return jo.toString(); - } - } - - } - - @Override - public Map findAllAgvFromCache() { - return AGVDeviceStatus; - } - - - @Override - public JSONObject xgAGVWaitPointRequest(JSONObject requestParam) { - log.info("仙工AGV请求取放货,请求参数 - {}", requestParam); - String inst_code = requestParam.getString("task_code"); - Instruction instructionDto = instructionService.findByCodeFromCache(inst_code); - if (ObjectUtil.isEmpty(instructionDto)) { - throw new BadRequestException("请求失败,未找到指令!"); - } - String address = requestParam.getString("address"); - if (StrUtil.isBlank(address)) { - throw new BadRequestException("请求失败,地址为空!"); - } - if (address.contains("IN") || address.contains("WAIT")) { - String task_code = instructionDto.getTask_code(); - String deviceCodeNow; - if (address.contains("WAIT")) { - deviceCodeNow = address.substring(0, address.length() - 4); - } else { - deviceCodeNow = address.substring(0, address.length() - 5); - } - if (ObjectUtil.isEmpty(deviceAppService.findDeviceByCode(deviceCodeNow))) { - throw new BadRequestException("设备号 " + deviceCodeNow + " 不存在!"); - } - //一楼诺宝agv - if (instructionDto.getAgv_system_type().equals(AgvSystemTypeEnum.One_NDC_System_Type.getIndex())) { - - if (address.contains("GET")) { - return agvWaitUtil.waitInGet(deviceCodeNow, instructionDto); - } else if (address.contains("PUT")) { - return agvWaitUtil.waitInPut(deviceCodeNow, instructionDto); - } - //如果是取货二次分配,取放货二次分配需要重新追加动作块 - if (AgvActionTypeEnum.IN_STOCK.getCode().equals(instructionDto.getAgv_action_type()) || AgvActionTypeEnum.IN_OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type())) { - Integer actionType = ActionTypeEnum.IN_STOCK.getCode(); - String newPointCode = applyXGAgvTask(task_code, actionType, instructionDto); - log.info("取货二次分配追加诺宝成功,新点位 - {}", newPointCode); - JSONObject map = new JSONObject(); - map.put("status", 200); - map.put("message", "取货二次分配追加诺宝成功!"); - return map; - } - //如果是放货二次分配,取放货二次分配需要重新追加动作块 - if (AgvActionTypeEnum.OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type()) || AgvActionTypeEnum.IN_OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type())) { - Integer actionType = ActionTypeEnum.OUT_STOCK.getCode(); - String newPointCode = applyXGAgvTask(task_code, actionType, instructionDto); -// sendAddSequencesToNBAgv(instructionDto.getInstruction_code(), deviceCodeNow, instructionDto); - log.info("放货二次分配追加诺宝成功,新点位 - {}", newPointCode); - JSONObject map = new JSONObject(); - map.put("status", 200); - map.put("message", "放货二次分配追加诺宝成功!"); - return map; - } - } - //一楼叉车 - if (instructionDto.getAgv_system_type().equals(AgvSystemTypeEnum.XG_System_Type.getIndex())) { - if (address.contains("GET")) { - //取货前等待 - return agvWaitUtil.waitInGet(deviceCodeNow, instructionDto); - } else { - //放货前二次分配 - if (address.contains("WAIT")) { - String newPointCode = applyCCAgvTask(task_code, instructionDto); - - JSONObject map = new JSONObject(); - map.put("status", 200); - map.put("message", "允许叉车放货!" + "点位" + newPointCode); - log.info("允许仙工AGV放货,设备号 - {}", newPointCode); - return map; - } - //放货前等待 - if (address.contains("PUT")) { - return agvWaitUtil.waitInPut(deviceCodeNow, instructionDto); - } - } - } - } - if (address.contains("OUT")) { - String deviceCodeNow = address.substring(0, address.length() - 6); - if (ObjectUtil.isEmpty(deviceAppService.findDeviceByCode(deviceCodeNow))) { - throw new BadRequestException("设备号 " + deviceCodeNow + " 不存在!"); - } - - if (address.contains("GET")) { - //取货完成 - JSONObject jsonObject = agvWaitUtil.waitOutGet(deviceCodeNow, instructionDto); - if (StringUtil.equals("200", jsonObject.getString("status"))) { - log.info("仙工AGV取货完成后离开,设备号 - {}", deviceCodeNow); - return jsonObject; - } - } else if (address.contains("PUT")) { - //放货完成 - JSONObject jsonObject = agvWaitUtil.waitOutPut(deviceCodeNow, instructionDto); - if (StringUtil.equals("200", jsonObject.getString("status"))) { - log.info("仙工AGV放货完成后离开,设备号 - {}", deviceCodeNow); - return jsonObject; - } - - } - } - - throw new BadRequestException("请求失败,IN OUT 站点错误!"); - } - - private String applyCCAgvTask(String task_code, Instruction instructionDto) { - JSONObject param = new JSONObject(); - param.put("task_code", task_code); - return null; - -// String response = acsToWmsService.applySendOutTwo(param); -// JSONObject jo = JSON.parseObject(response); -// if (jo.getInteger("status") == 200) { -// LuceneLogDto logDto2 = LuceneLogDto.builder() -// .device_code(instructionDto.getCarno()) -// .content("叉车二次分配请求lms,参数,接口返回:" + jo) -// .build(); -// logDto2.setLog_level(4); -// luceneExecuteLogService.deviceExecuteLog(logDto2); - //二次分配更新点位 -// updataTask(instructionDto, jo.getString("data")); -// //请求成功调用叉车追加动作块 -// sendAddSequencesToCCAgv(instructionDto.getInstruction_code(), jo.getString("data"), instructionDto); -// return jo.getString("data"); -// -// } else { -// throw new BadRequestException("叉车二次分配请求lms返回失败"); -// } - } - - private void sendAddSequencesToCCAgv(String instructionCode, String nextPoint, Instruction instructionDto) { - com.alibaba.fastjson.JSONObject jo = new com.alibaba.fastjson.JSONObject(); - jo.put("id", instructionCode); - //动作块 - jo.put("blocks", createBlocksDataTowCCStart(nextPoint)); - //追加订单封口 - jo.put("complete", true); - log.info("任务号:{},指令号{},追加诺宝叉车运单:{}", instructionCode, instructionCode, jo); - - if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) { - String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue(); - String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue(); - - agvurl = agvurl + ":" + agvport + "/addBlocks"; - - log.info(agvurl); - HttpResponse result = HttpRequest.post(agvurl) - //表单内容 - .body(String.valueOf(jo)) - //超时,毫秒 - .timeout(20000) - .execute(); - log.info("指令号{},状态{},下发追加叉车运单序列反馈:{}", instructionCode, result.getStatus(), result.body()); - - } - - } - - private Object createBlocksDataTowCCStart(String nextPoint) { - JSONArray ja = new JSONArray(); - JSONObject jo9 = new JSONObject(); - jo9.put("blockId", IdUtil.simpleUUID()); - jo9.put("location", nextPoint); - jo9.put("binTask", "ForkUnload"); - ja.add(jo9); - - JSONObject jo10 = new JSONObject(); - jo10.put("blockId", IdUtil.simpleUUID()); - jo10.put("location", nextPoint + "OUTPUT"); - jo10.put("binTask", "OutForkHeight"); - ja.add(jo10); - return ja; - } - - @Override - public HttpResponse getRobotInfo(String robotCode) { - if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) { - String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue(); - String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue(); - - agvurl = agvurl + ":" + agvport + "/" + "robotsStatus?vehicles=" + robotCode; - log.info("根据指定机器人查询状态的请求:{}", agvurl); - HttpResponse result = HttpRequest.get(agvurl) - .timeout(20000)//超时,毫秒 - .execute(); - log.info("根据指定机器人查询状态的请求反馈:{}", result); - return result; - } else { - return null; - } - } - - private String applyXGAgvTask(String task_code, Integer actionType, Instruction instructionDto) { - return null; - } - - private void updataTask(Instruction instructionDto, String newPoint) { - - TaskDto taskUpdate = new TaskDto(); - if (AgvActionTypeEnum.IN_STOCK.getCode().equals(instructionDto.getAgv_action_type())) { - instructionDto.setStart_point_code(newPoint); - taskUpdate.setStart_point_code(newPoint); - instructionDto.setStart_device_code(newPoint); - taskUpdate.setStart_device_code(newPoint); - } - if (AgvActionTypeEnum.OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type())) { - instructionDto.setNext_point_code(newPoint); - taskUpdate.setNext_point_code(newPoint); - instructionDto.setNext_device_code(newPoint); - taskUpdate.setNext_device_code(newPoint); - } - taskUpdate.setTask_id(instructionDto.getTask_id()); - instructionService.update(instructionDto); - taskserver.update(taskUpdate); - } - - - @Override - public HttpResponse sendOrderSequencesToForklift(Instruction inst, InteractionJsonDTO interactionJsonDTO) { - com.alibaba.fastjson.JSONObject jo = new com.alibaba.fastjson.JSONObject(); - jo.put("id", inst.getInstruction_code()); - //运单封口,true=创建运单之后不可添加动作块;false=创建运单可以添加动作块 - if (AgvActionTypeEnum.ORDINARY.getCode().equals(inst.getAgv_action_type())) { - jo.put("complete", true); - } else { - jo.put("complete", false); - } //动作块 - jo.put("blocks", createBlocksForklift(inst, interactionJsonDTO)); - //运单优先级 - jo.put("priority", inst.getPriority()); - log.info("任务号:{},指令号{},下发agv订单序列参数:{}", inst.getTask_code(), inst.getInstruction_code(), jo); - - if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) { - String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue(); - String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue(); - - agvurl = agvurl + ":" + agvport + "/setOrder"; - - log.info(agvurl); - HttpResponse result = HttpRequest.post(agvurl) - //表单内容 - .body(String.valueOf(jo)) - //超时,毫秒 - .timeout(20000) - .execute(); - log.info("任务号:{},指令号{},状态{},下发agv叉车订单序列反馈:{}", inst.getTask_code(), inst.getInstruction_code(), result.getStatus(), result.body()); - - return result; - } else { - return null; - } - } - - - - /** - * 追加动作块 - * - * @param - * @param instructionCode - * @param instructionDto - * @return - */ - private void sendAddSequencesToNBAgv(String instructionCode, String point, Instruction instructionDto) { - com.alibaba.fastjson.JSONObject jo = new com.alibaba.fastjson.JSONObject(); - jo.put("id", instructionCode); - //动作块 - if (AgvActionTypeEnum.IN_STOCK.getCode().equals(instructionDto.getAgv_action_type()) || AgvActionTypeEnum.IN_OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type())) { - jo.put("blocks", createBlocksDataTowStart(instructionCode, point, instructionDto)); - } - if (AgvActionTypeEnum.OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type()) || AgvActionTypeEnum.IN_OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type())) { - jo.put("blocks", createBlocksDataTowEnd(instructionCode, point, instructionDto)); - } - //追加订单封口 - jo.put("complete", true); - log.info("任务号:{},指令号{},追加诺宝运单:{}", instructionCode, point, jo); - - if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) { - String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue(); - String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue(); - - agvurl = agvurl + ":" + agvport + "/addBlocks"; - - log.info(agvurl); - HttpResponse result = HttpRequest.post(agvurl) - //表单内容 - .body(String.valueOf(jo)) - //超时,毫秒 - .timeout(20000) - .execute(); - log.info("指令号{},状态{},下发追加诺宝运单序列反馈:{}", instructionCode, result.getStatus(), result.body()); - - } - } - - private Object createBlocksDataTowEnd(String instructionCode, String point, Instruction instructionDto) { - JSONArray ja = new JSONArray(); - //终点2 - sendEndDeviceOrder3(ja, point, instructionCode, instructionDto); - return ja; - - } - - private void sendEndDeviceOrder3(JSONArray ja, String nextDeviceCode, String instructionCode, Instruction instructionDto) { - JSONObject jo3 = new JSONObject(); - jo3.put("blockId", IdUtil.simpleUUID()); - jo3.put("location", nextDeviceCode + "INPUT"); - jo3.put("operation", "script"); - jo3.put("id", nextDeviceCode + "INPUT"); - jo3.put("script_name", "userpy/interact.py"); - JSONObject script_args3 = new JSONObject(); - script_args3.put("addr", addr); - JSONObject data3 = new JSONObject(); - JSONObject reach3 = new JSONObject(); - reach3.put("task_code", instructionCode); - reach3.put("address", nextDeviceCode + "INPUT"); - data3.put("reach", reach3); - script_args3.put("data", data3); - script_args3.put("protocol", "HTTP"); - jo3.put("script_args", script_args3); - ja.add(jo3); - - - //将货物放下 - com.alibaba.fastjson.JSONObject jo4 = new com.alibaba.fastjson.JSONObject(); - jo4.put("blockId", IdUtil.simpleUUID()); - jo4.put("location", nextDeviceCode); - jo4.put("operation", "JackUnload"); - ja.add(jo4); - //放货完成等待 - com.alibaba.fastjson.JSONObject jo5 = new com.alibaba.fastjson.JSONObject(); - jo5.put("blockId", IdUtil.simpleUUID()); - jo5.put("location", nextDeviceCode + "OUTPUT"); - jo5.put("operation", "script"); - jo5.put("id", nextDeviceCode + "OUTPUT"); - jo5.put("script_name", "userpy/interact.py"); - com.alibaba.fastjson.JSONObject script_args5 = new com.alibaba.fastjson.JSONObject(); - script_args5.put("addr", addr); - com.alibaba.fastjson.JSONObject data5 = new com.alibaba.fastjson.JSONObject(); - com.alibaba.fastjson.JSONObject reach5 = new com.alibaba.fastjson.JSONObject(); - reach5.put("task_code", instructionCode); - reach5.put("address", nextDeviceCode + "OUTPUT"); - data5.put("reach", reach5); - script_args5.put("data", data5); - script_args5.put("protocol", "HTTP"); - jo5.put("script_args", script_args5); - ja.add(jo5); - - } - - - private Object createBlocksDataTowStart(String instructionCode, String startPoint, Instruction instructionDto) { - JSONArray ja = new JSONArray(); - String nextDeviceCode = instructionDto.getNext_device_code(); - //起点2 - sendStartDeviceOrder2(ja, startPoint, instructionCode, instructionDto); - //终点2 - sendEndDeviceOrder2(ja, nextDeviceCode, instructionCode, instructionDto); - return ja; - - } - - private void sendEndDeviceOrder2(JSONArray ja, String nextDeviceCode, String instructionCode, Instruction instructionDto) { - if (AgvActionTypeEnum.IN_STOCK.getCode().equals(instructionDto.getAgv_action_type())) { - //放货前等待 - JSONObject jo3 = new JSONObject(); - jo3.put("blockId", IdUtil.simpleUUID()); - jo3.put("location", nextDeviceCode + "INPUT"); - jo3.put("operation", "script"); - jo3.put("id", nextDeviceCode + "INPUT"); - jo3.put("script_name", "userpy/interact.py"); - JSONObject script_args3 = new JSONObject(); - script_args3.put("addr", addr); - JSONObject data3 = new JSONObject(); - JSONObject reach3 = new JSONObject(); - reach3.put("task_code", instructionCode); - reach3.put("address", nextDeviceCode + "INPUT"); - data3.put("reach", reach3); - script_args3.put("data", data3); - script_args3.put("protocol", "HTTP"); - jo3.put("script_args", script_args3); - ja.add(jo3); - //将货物放下 - com.alibaba.fastjson.JSONObject jo4 = new com.alibaba.fastjson.JSONObject(); - jo4.put("blockId", IdUtil.simpleUUID()); - jo4.put("location", nextDeviceCode); - jo4.put("operation", "JackUnload"); - ja.add(jo4); - //放货完成等待 - com.alibaba.fastjson.JSONObject jo5 = new com.alibaba.fastjson.JSONObject(); - jo5.put("blockId", IdUtil.simpleUUID()); - jo5.put("location", nextDeviceCode + "OUTPUT"); - jo5.put("operation", "script"); - jo5.put("id", nextDeviceCode + "OUTPUT"); - jo5.put("script_name", "userpy/interact.py"); - com.alibaba.fastjson.JSONObject script_args5 = new com.alibaba.fastjson.JSONObject(); - script_args5.put("addr", addr); - com.alibaba.fastjson.JSONObject data5 = new com.alibaba.fastjson.JSONObject(); - com.alibaba.fastjson.JSONObject reach5 = new com.alibaba.fastjson.JSONObject(); - reach5.put("task_code", instructionCode); - reach5.put("address", nextDeviceCode + "OUTPUT"); - data5.put("reach", reach5); - script_args5.put("data", data5); - script_args5.put("protocol", "HTTP"); - jo5.put("script_args", script_args5); - ja.add(jo5); - } - } - - private void sendStartDeviceOrder2(JSONArray ja, String startPoint, String instructionCode, Instruction instructionDto) { - //取货前等待 - JSONObject jo = new JSONObject(); - //动作块id - jo.put("blockId", IdUtil.simpleUUID()); - //目的地名称 - jo.put("location", startPoint + "INGET"); - //执行脚本 - jo.put("operation", "script"); - jo.put("id", startPoint + "INGET"); - //通信脚本,动作前后与现场设备交互的场景 - jo.put("script_name", "userpy/interact.py"); - JSONObject script_args = new JSONObject(); - //更改为现场设备IP及PORT - script_args.put("addr", addr); - JSONObject data = new JSONObject(); - JSONObject reach = new JSONObject(); - reach.put("task_code", instructionCode); - reach.put("address", startPoint + "INGET"); - data.put("reach", reach); - script_args.put("data", data); - script_args.put("protocol", "HTTP"); - jo.put("script_args", script_args); - ja.add(jo); - - - //将货物顶起来,机器识别提升高度 - JSONObject jo1 = new JSONObject(); - jo1.put("blockId", IdUtil.simpleUUID()); - jo1.put("location", startPoint); - jo1.put("operation", "JackLoad"); - inspectInStocckSet(startPoint, jo1); - ja.add(jo1); - JSONObject jo2 = new JSONObject(); - jo2.put("blockId", IdUtil.simpleUUID()); - jo2.put("location", startPoint + "OUTGET"); - jo2.put("operation", "script"); - jo2.put("id", startPoint + "OUTGET"); - jo2.put("script_name", "userpy/interact.py"); - JSONObject script_args2 = new JSONObject(); - script_args2.put("addr", addr); - JSONObject data2 = new JSONObject(); - JSONObject reach2 = new JSONObject(); - reach2.put("task_code", instructionCode); - reach2.put("address", startPoint + "OUTGET"); - data2.put("reach", reach2); - script_args2.put("data", data2); - script_args2.put("protocol", "HTTP"); - jo2.put("script_args", script_args2); - ja.add(jo2); - } - - /** - * 叉车运单动作块 - * - * @param inst - * @param interactionJsonDTO - * @return - */ - private JSONArray createBlocksForklift(Instruction inst, InteractionJsonDTO interactionJsonDTO) { - JSONArray ja = new JSONArray(); - //起点 - Device startDevice = deviceAppService.findDeviceByCode(inst.getStart_device_code()); - String pointCode = inst.getStart_point_code(); - - - //取货前等待 - JSONObject jo = new JSONObject(); - //动作块id - jo.put("blockId", IdUtil.simpleUUID()); - //目的地名称 - jo.put("location", pointCode + "INGET"); - //执行脚本 - jo.put("operation", "script"); - jo.put("id", pointCode + "INGET"); - //通信脚本,动作前后与现场设备交互的场景 - jo.put("script_name", "userpy/interact.py"); - JSONObject script_args = new JSONObject(); - //更改为现场设备IP及PORT - script_args.put("addr", addr); - JSONObject data = new JSONObject(); - JSONObject reach = new JSONObject(); - reach.put("task_code", inst.getInstruction_code()); - reach.put("address", pointCode + "INGET"); - data.put("reach", reach); - script_args.put("data", data); - script_args.put("protocol", "HTTP"); - jo.put("script_args", script_args); - ja.add(jo); - - if (AgvActionTypeEnum.ORDINARY.getCode().equals(inst.getAgv_action_type())) { - // to do - JSONObject jo1 = new JSONObject(); - jo1.put("blockId", IdUtil.simpleUUID()); - jo1.put("location", inst.getStart_point_code() + "INGET"); - jo1.put("binTask", "InForkHeight"); - ja.add(jo1); - - JSONObject jo3 = new JSONObject(); - //动作块id - jo3.put("blockId", IdUtil.simpleUUID()); - //目的地名称 - jo3.put("location", pointCode + "INGET"); - jo3.put("id", pointCode + "INGET"); - //执行脚本 - jo3.put("operation", "expand"); - //通信脚本,动作前后与现场设备交互的场景 - jo3.put("script_name", "Fork-expand.py"); - JSONObject script_args2 = new JSONObject(); - if (ObjectUtil.isNotEmpty(interactionJsonDTO.getExpandWidthLength())) { - script_args2.put("expandWidth", interactionJsonDTO.getExpandWidthLength()); - } - script_args2.put("operation", "expand"); - jo3.put("script_args", script_args2); - ja.add(jo3); - - JSONObject jo4 = new JSONObject(); - //动作块id - jo4.put("blockId", IdUtil.simpleUUID()); - //目的地名称 - jo4.put("location", pointCode + "INGET"); - jo4.put("id", pointCode + "INGET"); - //执行脚本 - jo4.put("operation", "stretch"); - //通信脚本,动作前后与现场设备交互的场景 - jo4.put("script_name", "Fork-expand.py"); - JSONObject script_args1 = new JSONObject(); - if (ObjectUtil.isNotEmpty(interactionJsonDTO.getExpandWidthLength())) { - script_args1.put("stretchLength", interactionJsonDTO.getExpandWidthLength()); - } - script_args1.put("operation", "stretch"); - jo4.put("script_args", script_args1); - ja.add(jo4); - - JSONObject jo6 = new JSONObject(); - jo6.put("blockId", IdUtil.simpleUUID()); - jo6.put("location", inst.getStart_point_code()); - jo6.put("binTask", "Script"); - ja.add(jo6); - - JSONObject jo7 = new JSONObject(); - jo7.put("blockId", IdUtil.simpleUUID()); - jo7.put("location", inst.getStart_point_code()); - jo7.put("binTask", "ForkLoad"); - ja.add(jo7); - - //取货完成 - JSONObject jo2 = new JSONObject(); - jo2.put("blockId", IdUtil.simpleUUID()); - jo2.put("location", pointCode + "OUTGET"); - jo2.put("operation", "script"); - jo2.put("id", pointCode + "OUTGET"); - jo2.put("script_name", "userpy/interact.py"); - JSONObject script_args4 = new JSONObject(); - script_args4.put("addr", addr); - JSONObject data2 = new JSONObject(); - JSONObject reach2 = new JSONObject(); - reach2.put("task_code", inst.getInstruction_code()); - reach2.put("address", pointCode + "OUTGET"); - data2.put("reach", reach2); - script_args4.put("data", data2); - script_args4.put("protocol", "HTTP"); - jo2.put("script_args", script_args4); - ja.add(jo2); - - - //ForkUnload(货叉卸载货物,会将叉车的状态变成非载货中) - JSONObject jo8 = new JSONObject(); - jo8.put("blockId", IdUtil.simpleUUID()); - jo8.put("location", inst.getStart_point_code() + "OUTGET"); - jo8.put("binTask", "OutForkHeight"); - ja.add(jo8); - - JSONObject jo9 = new JSONObject(); - jo9.put("blockId", IdUtil.simpleUUID()); - jo9.put("location", inst.getNext_point_code()); - jo9.put("binTask", "ForkUnload"); - ja.add(jo9); - - JSONObject jo10 = new JSONObject(); - jo10.put("blockId", IdUtil.simpleUUID()); - jo10.put("location", inst.getNext_point_code() + "OUTPUT"); - jo10.put("binTask", "OutForkHeight"); - ja.add(jo10); - - } else if (AgvActionTypeEnum.IN_STOCK.getCode().equals(inst.getAgv_action_type())) { - - } else if (AgvActionTypeEnum.OUT_STOCK.getCode().equals(inst.getAgv_action_type())) { - // to do - JSONObject jo1 = new JSONObject(); - jo1.put("blockId", IdUtil.simpleUUID()); - jo1.put("location", inst.getStart_point_code() + "INGET"); - jo1.put("binTask", "InForkHeight"); - ja.add(jo1); - - JSONObject jo3 = new JSONObject(); - //动作块id - jo3.put("blockId", IdUtil.simpleUUID()); - //目的地名称 - jo3.put("location", pointCode + "INGET"); - jo3.put("id", pointCode + "INGET"); - //执行脚本 - jo3.put("operation", "expand"); - //通信脚本,动作前后与现场设备交互的场景 - jo3.put("script_name", "Fork-expand.py"); - JSONObject script_args2 = new JSONObject(); - if (ObjectUtil.isNotEmpty(interactionJsonDTO.getExpandWidthLength())) { - script_args2.put("expandWidth", interactionJsonDTO.getExpandWidthLength()); - } - script_args2.put("operation", "expand"); - jo3.put("script_args", script_args2); - ja.add(jo3); - - JSONObject jo4 = new JSONObject(); - //动作块id - jo4.put("blockId", IdUtil.simpleUUID()); - //目的地名称 - jo4.put("location", pointCode + "INGET"); - jo4.put("id", pointCode + "INGET"); - //执行脚本 - jo4.put("operation", "stretch"); - //通信脚本,动作前后与现场设备交互的场景 - jo4.put("script_name", "Fork-expand.py"); - JSONObject script_args1 = new JSONObject(); - if (ObjectUtil.isNotEmpty(interactionJsonDTO.getExpandWidthLength())) { - script_args1.put("stretchLength", interactionJsonDTO.getExpandWidthLength()); - } - script_args1.put("operation", "stretch"); - jo4.put("script_args", script_args1); - ja.add(jo4); - - JSONObject jo6 = new JSONObject(); - jo6.put("blockId", IdUtil.simpleUUID()); - jo6.put("location", inst.getStart_point_code()); - jo6.put("binTask", "Script"); - ja.add(jo6); - - JSONObject jo7 = new JSONObject(); - jo7.put("blockId", IdUtil.simpleUUID()); - jo7.put("location", inst.getStart_point_code()); - jo7.put("binTask", "ForkLoad"); - ja.add(jo7); - - //取货完成 - JSONObject jo2 = new JSONObject(); - jo2.put("blockId", IdUtil.simpleUUID()); - jo2.put("location", pointCode + "OUTGET"); - jo2.put("operation", "script"); - jo2.put("id", pointCode + "OUTGET"); - jo2.put("script_name", "userpy/interact.py"); - JSONObject script_args4 = new JSONObject(); - script_args4.put("addr", addr); - JSONObject data2 = new JSONObject(); - JSONObject reach2 = new JSONObject(); - reach2.put("task_code", inst.getInstruction_code()); - reach2.put("address", pointCode + "OUTGET"); - data2.put("reach", reach2); - script_args4.put("data", data2); - script_args4.put("protocol", "HTTP"); - jo2.put("script_args", script_args4); - ja.add(jo2); - - - //ForkUnload(货叉卸载货物,会将叉车的状态变成非载货中) - JSONObject jo8 = new JSONObject(); - jo8.put("blockId", IdUtil.simpleUUID()); - jo8.put("location", inst.getStart_point_code() + "OUTGET"); - jo8.put("binTask", "OutForkHeight"); - ja.add(jo8); - - JSONObject jo9 = new JSONObject(); - jo9.put("blockId", IdUtil.simpleUUID()); - jo9.put("location", inst.getNext_device_code() + "WAIT"); - jo9.put("operation", "script"); - jo9.put("id", inst.getNext_device_code() + "WAIT"); - jo9.put("script_name", "userpy/interact.py"); - JSONObject script_args5 = new JSONObject(); - script_args5.put("addr", addr); - JSONObject data3 = new JSONObject(); - JSONObject reach3 = new JSONObject(); - reach3.put("task_code", inst.getInstruction_code()); - reach3.put("address", inst.getNext_device_code() + "WAIT"); - data3.put("reach", reach3); - script_args5.put("data", data3); - script_args5.put("protocol", "HTTP"); - jo9.put("script_args", script_args5); - ja.add(jo9); - - } else if (AgvActionTypeEnum.IN_STOCK.getCode().equals(inst.getAgv_action_type())) { - - } - - - return ja; - } - -} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/ZheDaAgvServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/ZheDaAgvServiceImpl.java deleted file mode 100644 index 1f4b05c..0000000 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/ZheDaAgvServiceImpl.java +++ /dev/null @@ -1,442 +0,0 @@ -package org.nl.acs.agv.server.impl; - -import cn.hutool.core.util.StrUtil; -import cn.hutool.http.HttpRequest; -import cn.hutool.http.HttpResponse; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.nl.acs.AcsConfig; -import org.nl.acs.agv.AgvUtil; -import org.nl.acs.agv.server.ZheDaAgvService; -import org.nl.acs.common.base.CommonFinalParam; -import org.nl.acs.device.domain.Device; - -import org.nl.acs.ext.wms.service.AcsToWmsService; -import org.nl.acs.instruction.domain.Instruction; -import org.nl.acs.instruction.service.InstructionService; -import org.nl.acs.opc.DeviceAppService; -import org.nl.acs.opc.DeviceAppServiceImpl; -import org.nl.acs.task.service.TaskService; -import org.nl.acs.task.service.dto.TaskDto; -import org.nl.system.service.param.ISysParamService; -import org.nl.config.SpringContextHolder; -import org.springframework.stereotype.Service; - -/** - * @author 20220102CG\noblelift - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class ZheDaAgvServiceImpl implements ZheDaAgvService { - private final ISysParamService paramService; - - /** - * 判断是否追加任务 - */ - private static final String THREE = "3"; - private static final String FOUR = "4"; - private static final String FIVE = "5"; - /** - * 取货的进入前等待和离开等待 - */ - private static final String LOAD = "load"; - /** - * 取货的进入前等待和离开等待 - */ - private static final String ENTRY_REQUIRED = "EntryRequired"; - private static final String ENTRYREQUIRED = "entryRequired"; - private static final String PAUSE_ON_STATION = "PauseOnStation"; - /** - * 等待点等待 - */ - private static final String WAIT = "Wait"; - /** - * 放货的进入前等待和离开等待 - */ - private static final String UNLOAD = "Unload"; - - - @Override - public HttpResponse sendAgvInstToAgv(Instruction inst) throws Exception { - JSONObject jo = new JSONObject(); - String start_point_code = inst.getStart_point_code(); - String next_point_code = inst.getNext_point_code(); - //1楼AGV普通任务 - //2楼AGV普通任务 - //2楼AGV起点追加任务 - //2楼AGV终点追加任务 - String task_type = inst.getInstruction_type(); - jo.put("deadline", AgvUtil.getNextDay(1)); - //判断是否追加任务 - if (THREE.equals(task_type) || FOUR.equals(task_type)) { - jo.put("complete", "false"); - } else { - jo.put("complete", "true"); - } - jo.put("task_code", inst.getInstruction_code()); - //根据任务,下发指令类型 - JSONArray destinations = new JSONArray(); - if (THREE.equals(task_type)) { - destinations.add(destination(start_point_code, "Wait", "5", CommonFinalParam.ONE)); - } else if (FOUR.equals(task_type)) { - destinations.add(destination(start_point_code, "Load", CommonFinalParam.ONE, CommonFinalParam.ONE)); - destinations.add(destination(next_point_code, "Wait", "5", CommonFinalParam.ONE)); - } else { - destinations.add(destination(start_point_code, "Load", CommonFinalParam.ONE, CommonFinalParam.ONE)); - destinations.add(destination(next_point_code, "Unload", CommonFinalParam.ONE, CommonFinalParam.ONE)); - } - - jo.put("destinations", destinations); - - if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) { - String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue(); - String agvurl2 = paramService.findByCode(AcsConfig.AGVURL2).getValue(); - String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue(); - String agvport2 = paramService.findByCode(AcsConfig.AGVPORT2).getValue(); - - - //不同楼层下发不同的agv系统 - if (CommonFinalParam.ONE.equals(task_type)) { - agvurl = agvurl + ":" + agvport + "/v1/transportOrders/" + inst.getInstruction_code(); - } else { - agvurl = agvurl2 + ":" + agvport2 + "/v1/transportOrders/" + inst.getInstruction_code(); - } - log.info("下发agv任务请求:{}", agvurl); - - HttpResponse result = HttpRequest.post(agvurl) - //表单内容 - .body(String.valueOf(jo)) - //超时,毫秒 - .timeout(20000) - .execute(); - log.info("下发agv任务请求反馈:{}", result); - return result; - } else { - return null; - } - } - - /** - * ZDAGV - * @param type - * @return - */ - - @Override - public HttpResponse queryAgvInstStatus(String type) { - if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) { - String agvurl = ""; - String agvport = ""; - if (CommonFinalParam.ONE.equals(type)) { - agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue(); - agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue(); - } - if (CommonFinalParam.TWO.equals(type)) { - agvurl = paramService.findByCode(AcsConfig.AGVURL2).getValue(); - agvport = paramService.findByCode(AcsConfig.AGVPORT2).getValue(); - } - - agvurl = agvurl + ":" + agvport + "/v1/transportOrders"; - HttpResponse result = HttpRequest.get(agvurl) - //超时,毫秒 - .timeout(20000) - .execute(); - System.out.println("查询agv指令数据:" + result.body()); - - return result; - } else { - return null; - } - } - - /** - * 处理AGV指令 ZDAGV - * - * @param jobno - * @param type - * @param address - * @param action - * @param processingVehicle - * @return - */ - - @Override - public synchronized String process(String jobno, String type, String address, String action, String processingVehicle) { - log.info("查询到AGV请求参数,jobno:{},address:{}", jobno + ",address:" + address + ",type:" + type + ",action:" + action); - //释放AGV资源,继续后续动作 - boolean is_feedback = false; - String str = ""; - String backaddress = address; - if (address.indexOf(CommonFinalParam.DOT) > 0) { - str = address.substring(address.indexOf(".") + 1, address.length()); - address = address.substring(0, address.indexOf(".")); - } else if (address.indexOf(CommonFinalParam.HYPHEN_) > 0) { - address = address.substring(0, address.indexOf("-")); - } - InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl"); - TaskService taskService = SpringContextHolder.getBean("taskServiceImpl"); - AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl"); - - Instruction inst = instructionService.findByCodeFromCache(jobno); - TaskDto task = taskService.findByCode(inst.getTask_code()); - - DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); - Device addressdevice = appService.findDeviceByCode(address); - - //等待点等待 - if (WAIT.equals(action)) { - if (WAIT.equals(type)) { - JSONObject jo = new JSONObject(); - jo.put("task_code", inst.getInstruction_code()); - JSONArray destinations = new JSONArray(); - String inst_type = inst.getInstruction_type(); - //如果任务类型为1,在点位进行等待,则查询当前叠盘位的数量,取当前数量的层数进行追加任务 -// if (CommonFinalParam.ONE.equals(inst_type)) { -// emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) addressdevice.getDeviceDriver(); -// int current_num = emptyVehicleStackingPositionDeviceDriver.getNumber(); -// if (current_num > 12) { -// log.info("当前叠盘架:" + jobno + "已放满!"); -// return null; -// } -// String start_point_code = inst.getStart_point_code(); -// String next_point_code = inst.getNext_point_code(); -// start_point_code = start_point_code + "." + (current_num + 1); -// destinations.add(destination(start_point_code, "Load", CommonFinalParam.ONE, CommonFinalParam.ONE)); -// destinations.add(destination(next_point_code, "Unload", CommonFinalParam.ONE, CommonFinalParam.ONE)); -// -// } - - // String resp = acsToWmsService.requestTaskAgain(address, task.getExt_task_id(), inst.getVehicle_code()); - JSONObject respjson = JSONObject.parseObject(""); - - if (StrUtil.equals(inst.getInstruction_type(), THREE)) { - //2楼AGV起点追加任务 - String start_device_code = respjson.getString("device_code"); - String next_device_code = inst.getNext_device_code(); - destinations.add(destination(start_device_code, "load", CommonFinalParam.ONE, CommonFinalParam.ONE)); - destinations.add(destination(next_device_code, "Unload", CommonFinalParam.ONE, CommonFinalParam.ONE)); - - } else if (StrUtil.equals(inst.getInstruction_type(), FOUR)) { - //2楼AGV终点追加任务 - String next_device_code = respjson.getString("device_code"); - destinations.add(destination(next_device_code, "Unload", CommonFinalParam.ONE, CommonFinalParam.ONE)); - } - - jo.put("destinations", destinations); - - String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue(); - String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue(); - - String url = agvurl + ":" + agvport + "/addDestinations"; - log.info("下发agv任务请求:{}", url); - - HttpResponse result = HttpRequest.post(url) - //表单内容 - .body(String.valueOf(jo)) - //超时,毫秒 - .timeout(20000) - .execute(); - log.info("下发agv任务请求反馈:{}", result); - - //对任务进行封口 - JSONObject complete = new JSONObject(); - complete.put("task_code", inst.getInstruction_code()); - - String url2 = agvurl + ":" + agvport + "markComplete"; - log.info("下发agv任务请求:{}", url2); - - HttpResponse result2 = HttpRequest.post(url2) - //表单内容 - .body(String.valueOf(complete)) - //超时,毫秒 - .timeout(20000) - .execute(); - log.info("下发agv任务请求反馈:{}", result2); - } - } - - JSONObject requestjo = new JSONObject(); - if (is_feedback) { - requestjo.put("task_code", jobno); - requestjo.put("operation", action); - if (ENTRYREQUIRED.equals(type) || ENTRY_REQUIRED.equals(type)) { - requestjo.put("entryRequired", "true"); - } else { - requestjo.put("pauseOnStation", "true"); - } - log.info("反馈AGV请求数据:{}", requestjo); - System.out.println("back agv:" + requestjo); - - String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue(); - String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue(); - - if (FOUR.equals(inst.getInstruction_type())) { - agvurl = paramService.findByCode(AcsConfig.AGVURL2).getValue(); - } - agvurl = agvurl + ":" + agvport + "/v1/transportOrders/" + jobno + "/interact"; - - HttpResponse result = HttpRequest.post(agvurl) - .body(String.valueOf(requestjo)) - //超时,毫秒 - .timeout(20000) - .execute(); - } - return requestjo.toString(); - - } - - - @Override - public HttpResponse markComplete(String code) { - - if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) { - String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue(); - String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue(); - - agvurl = agvurl + ":" + agvport + "/v1/" + code + "/markComplete"; - log.info("关闭agv运单序列请求:{}", agvurl); - - HttpResponse result = HttpRequest.post(agvurl) - //.body(String.valueOf(orderjo))//表单内容 - //超时,毫秒 - .timeout(20000) - .execute(); - log.info("关闭agv运单序列请求反馈:{}", result); - - return result; - } else { - return null; - } - - } - - - /** - * 返回一个点位操作子任务 ZDAGV - * - * @param locationName 点位 - * @param operation 点位操作 - * @param propertiesType 子任务类型 - * @param pro 子任务参数 - * 调用demo:destination("sh15p", "Spin", CommonFinalParam.TWO, "3.14") - * demo:destination("cz14", "JackUnload", "3", "") - * @return - */ - - public static JSONObject destination(String locationName, String operation, String propertiesType, String pro) { - //新增业务订单 - JSONObject destinationOrder = new JSONObject(); - //目标工作站 - destinationOrder.put("locationName", locationName); - //机器人在工作站要执行的操作 - destinationOrder.put("operation", operation); - //取货前等待、取货后等待 - if (CommonFinalParam.ONE.equals(propertiesType)) { - - //pro 1 进入离开等待 - if (CommonFinalParam.ONE.equals(pro)) { - JSONArray properties = new JSONArray(); - JSONObject pro1 = new JSONObject(); - pro1.put("key", "EntryRequired"); - pro1.put("value", "True"); - properties.add(pro1); - JSONObject pro2 = new JSONObject(); - pro2.put("key", "PauseOnStation"); - pro2.put("value", "True"); - properties.add(pro2); - destinationOrder.put("properties", properties); - //进入等待 离开不等待 - } else if (CommonFinalParam.TWO.equals(pro)) { - JSONArray properties = new JSONArray(); - JSONObject pro1 = new JSONObject(); - pro1.put("key", "EntryRequired"); - pro1.put("value", "True"); - properties.add(pro1); - JSONObject pro2 = new JSONObject(); - pro2.put("key", "PauseOnStation"); - pro2.put("value", "False"); - properties.add(pro2); - destinationOrder.put("properties", properties); - //进入不等待 离开等待 - } else if (THREE.equals(pro)) { - JSONArray properties = new JSONArray(); - JSONObject pro1 = new JSONObject(); - pro1.put("key", "EntryRequired"); - pro1.put("value", "False"); - properties.add(pro1); - JSONObject pro2 = new JSONObject(); - pro2.put("key", "PauseOnStation"); - pro2.put("value", "True"); - properties.add(pro2); - destinationOrder.put("properties", properties); - //不等待 - } else { - JSONArray properties = new JSONArray(); - JSONObject pro1 = new JSONObject(); - pro1.put("key", "EntryRequired"); - pro1.put("value", "False"); - properties.add(pro1); - JSONObject pro2 = new JSONObject(); - pro2.put("key", "PauseOnStation"); - pro2.put("value", "False"); - properties.add(pro2); - destinationOrder.put("properties", properties); - } - //Spin转动 - } else if (CommonFinalParam.TWO.equals(propertiesType)) { - JSONArray properties = new JSONArray(); - JSONObject pro1 = new JSONObject(); - //坐标系类型,global_spin_angle为全局坐标系 - pro1.put("key", "global_spin_angle"); - //弧度值,如3.14 - pro1.put("value", pro); - properties.add(pro1); - JSONObject pro2 = new JSONObject(); - //固定值 - pro2.put("key", "spin_direction"); - //弧度值,如0 - pro2.put("value", "0"); - properties.add(pro2); - destinationOrder.put("properties", properties); - //JackUnload,Jackload不操作 - } else if (THREE.equals(propertiesType)) { - JSONArray properties = new JSONArray(); - JSONObject pro1 = new JSONObject(); - //固定值 - pro1.put("key", "recognize"); - //固定值 - pro1.put("value", "false"); - properties.add(pro1); - destinationOrder.put("properties", properties); - } else if (FOUR.equals(propertiesType)) { - JSONArray properties = new JSONArray(); - JSONObject pro1 = new JSONObject(); - //坐标系类型,robot_spin_angle为机器人坐标系 - pro1.put("key", "robot_spin_angle"); - //弧度值,如3.14 - pro1.put("value", pro); - properties.add(pro1); - JSONObject pro2 = new JSONObject(); - //固定值 - pro2.put("key", "spin_direction"); - //弧度值,如0 - pro2.put("value", "0"); - properties.add(pro2); - destinationOrder.put("properties", properties); - //在该点进行等待 - } else if (FIVE.equals(propertiesType)) { - JSONArray properties = new JSONArray(); - JSONObject pro1 = new JSONObject(); - pro1.put("key", "Wait"); - pro1.put("value", "True"); - properties.add(pro1); - destinationOrder.put("properties", properties); - } - return destinationOrder; - } - - -} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/FeedLmsRealFailed.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/FeedLmsRealFailed.java deleted file mode 100644 index 6739059..0000000 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/FeedLmsRealFailed.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.nl.acs.device_driver; - -import com.alibaba.fastjson.JSONObject; - -/** - * @author: geng by - * @createDate: 2023/4/21 - */ -public interface FeedLmsRealFailed { - public JSONObject feedLmsRealFailedInfo(); -} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/HeartbeatableDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/HeartbeatableDeviceDriver.java deleted file mode 100644 index 1d833cf..0000000 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/HeartbeatableDeviceDriver.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.nl.acs.device_driver; - -public interface HeartbeatableDeviceDriver extends DeviceDriver { - default void checkHeartbeat() { - } - - /** - * isOnline - * @return - */ - default boolean isOnline() { - return false; - } -} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/LinewayDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/LinewayDeviceDriver.java deleted file mode 100644 index b57bc92..0000000 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/LinewayDeviceDriver.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.nl.acs.device_driver; - - -import java.util.List; - -public interface LinewayDeviceDriver extends DeviceDriver { - List getRelatedDevices(); - - String getRelatedStacker(); - - int getMaxColumn(); - - int getMinColumn(); - - boolean getDirector(); -} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/ScannerDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/ScannerDeviceDriver.java deleted file mode 100644 index 864b938..0000000 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/ScannerDeviceDriver.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.nl.acs.device_driver; - -public interface ScannerDeviceDriver extends DeviceDriver { - /** - * writeBarcode - * @param var1 - */ - void writeBarcode(String var1); - - /** - * cleanBarcode - */ - void cleanBarcode(); - - /** - * readBarcode - * @return - */ - String readBarcode(); -} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/StandardRequestMethod.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/StandardRequestMethod.java deleted file mode 100644 index 27f036e..0000000 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/StandardRequestMethod.java +++ /dev/null @@ -1,149 +0,0 @@ -package org.nl.acs.device_driver; - -public interface StandardRequestMethod { - - /** - * 人工排产确认 - * - * @return - */ - public default boolean order_verify() { - throw new RuntimeException("未实现"); - } - - ; - - /** - * 工单完成 - * - * @return - */ - public default boolean order_finish() { - throw new RuntimeException("未实现"); - } - - ; - - /** - * 申请补满料盅托盘 - * - * @return - */ - public default boolean apply_put_full_vehicle() { - throw new RuntimeException("未实现"); - } - - ; - - /** - * 申请补空料盅托盘 - * - * @return - */ - public default boolean apply_put_empty_vehicle() { - throw new RuntimeException("未实现"); - } - - ; - - /** - * 申请取走空料盅托盘 - * - * @return - */ - public default boolean apply_take_empty_vehicle() { - throw new RuntimeException("未实现"); - } - - ; - - /** - * 申请取走满料盅托盘(入库) - * - * @return - */ - public default boolean apply_take_full_vehicle() { - throw new RuntimeException("未实现"); - } - - ; - - /** - * 申请强制取走满料盅托盘 - * - * @return - */ - public default boolean apply_force_take_full_vehicle() { - throw new RuntimeException("未实现"); - } - - ; - - /** - * 申请强制满托入缓存 - * - * @return - */ - public default boolean apply_force_take_full_vehicle_in_storage() { - throw new RuntimeException("未实现"); - } - - ; - - /** - * 扫码成功申请 - * - * @return - */ - public default boolean barcode_success_apply() { - throw new RuntimeException("未实现"); - } - - ; - - /** - * 获取组盘信息 - * - * @return - */ - public default boolean get_vehicle_info() { - throw new RuntimeException("未实现"); - } - - ; - - /** - * 强制去包装位-不包装 - * - * @return - */ - public default boolean force_no_package() { - throw new RuntimeException("未实现"); - } - - ; - - - /** - * 申请贴标 - * - * @return - */ - public default boolean apply_labelling() { - throw new RuntimeException("未实现"); - } - - ; - - /** - * 压机叫料 - * - * @return - */ - public default boolean press_request_material() { - throw new RuntimeException("未实现"); - } - - ; - -} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/StorageDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/StorageDeviceDriver.java deleted file mode 100644 index b9cc052..0000000 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/StorageDeviceDriver.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.nl.acs.device_driver; - -import java.util.ArrayList; -import java.util.List; - -public interface StorageDeviceDriver extends DeviceDriver { - /** - * getConfigForbidFront - * @return - */ - default List getConfigForbidFront() { - return new ArrayList(); - } - - /** - * getConfigCantFront - * @return - */ - default List getConfigCantFront() { - return new ArrayList(); - } - - /** - * getConfigCantBack - * @return - */ - default List getConfigCantBack() { - return new ArrayList(); - } - - /** - * getConfigForbidFrontLocation - * @return - */ - default List getConfigForbidFrontLocation() { - return new ArrayList(); - } - - /** - * getConfigCantFrontLocation - * @return - */ - default List getConfigCantFrontLocation() { - return new ArrayList(); - } - - /** - * getConfigCantBackLocation - * @return - */ - default List getConfigCantBackLocation() { - return new ArrayList(); - } -} \ No newline at end of file diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/xg_agv_car/XgAgvCarDefination.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/xg_agv_car/XgAgvCarDefination.java deleted file mode 100644 index e07d85d..0000000 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/xg_agv_car/XgAgvCarDefination.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.nl.acs.device_driver.agv.xg_agv_car; - -import org.nl.acs.device.domain.Device; -import org.nl.acs.device.enums.DeviceType; -import org.nl.acs.device_driver.DeviceDriver; -import org.nl.acs.device_driver.DeviceDriverDefination; -import org.springframework.stereotype.Service; - -import java.util.LinkedList; -import java.util.List; - -/** - * 仙工AGV - */ -@Service -public class XgAgvCarDefination implements DeviceDriverDefination { - @Override - public String getDriverCode() { - return "xg_agv_car"; - } - - @Override - public String getDriverName() { - return "仙工AGV车"; - } - - @Override - public String getDriverDescription() { - return "仙工AGV车"; - } - - @Override - public DeviceDriver getDriverInstance(Device device) { - return (new XgAgvCarDeviceDriver()).setDevice(device).setDriverDefination(this); - - } - - @Override - public Class getDeviceDriverType() { - return XgAgvCarDeviceDriver.class; - } - - @Override - public List getFitDeviceTypes() { - List types = new LinkedList(); - types.add(DeviceType.agv); - return types; - } -} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/xg_agv_car/XgAgvCarDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/xg_agv_car/XgAgvCarDeviceDriver.java deleted file mode 100644 index 5d3522d..0000000 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/xg_agv_car/XgAgvCarDeviceDriver.java +++ /dev/null @@ -1,310 +0,0 @@ -package org.nl.acs.device_driver.agv.xg_agv_car; - -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.http.HttpResponse; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import lombok.Data; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.nl.acs.agv.server.XianGongAgvService; -import org.nl.acs.common.base.CommonFinalParam; -import org.nl.acs.device.service.DeviceService; -import org.nl.acs.device_driver.DeviceDriver; -import org.nl.acs.device_driver.RouteableDeviceDriver; -import org.nl.acs.device_driver.driver.AbstractDeviceDriver; -import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; -import org.nl.acs.ext.wms.service.AcsToWmsService; -import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; -import org.nl.acs.instruction.domain.Instruction; -import org.nl.acs.instruction.service.InstructionService; -import org.nl.acs.log.service.DeviceExecuteLogService; -import org.nl.acs.monitor.DeviceStageMonitor; -import org.nl.acs.opc.DeviceAppService; -import org.nl.acs.route.service.RouteLineService; -import org.nl.acs.task.service.TaskService; -import org.nl.config.SpringContextHolder; -import org.springframework.beans.factory.annotation.Autowired; - -import java.util.Date; -import java.util.LinkedHashMap; -import java.util.Map; - - -/** - * 仙工AGV - */ -@Slf4j -@Data -@RequiredArgsConstructor -public class XgAgvCarDeviceDriver extends AbstractDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor { - @Autowired - DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class); - @Autowired - InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl"); - @Autowired - DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl"); - @Autowired - RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl"); - @Autowired - TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl"); - @Autowired - RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class); - @Autowired - AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class); - @Autowired - DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class); - @Autowired - XianGongAgvService xianGongAgvService = SpringContextHolder.getBean(XianGongAgvService.class); - - Integer hasGoods = 0; - int error = 0; - Boolean iserror = false; - Boolean islock = false; - - int branchProtocol = 0; - int last_branchProtocol = 0; - /** - * 是否需要输入物料 - */ - String input_material = "0"; - /** - * 备注 - */ - String remark = ""; - /** - * 数量 - */ - String qty = ""; - /** - * 批次 - */ - String batch = ""; - /** - * 物料 - */ - String material = ""; - /** - * 目标点位 - */ - String purpose = ""; - /** - * 当前指令 - */ - Instruction inst = null; - /** - * 上次指令 - */ - Instruction last_inst = null; - - boolean requireSucess = false; - - /** - * 触摸屏手动触发任务 - */ - private Boolean is_has_task = false; - - /** - * 申请搬运任务 - */ - private Boolean apply_handling = false; - /** - * 申请物料 - */ - private Boolean apply_material = false; - - /** - * 1取货完成 2放货完成 3进入区域 4离开区域 - */ - private int flag; - - /** - * 人工确认信号 默认0 agv到达后请求置1 等人工确认后变为2 反馈agv后继续为0 - */ - private int manua_confirm = 0; - - /** - * 是否推送场景的状态 0=可推送 1=正在更新场景 2=正在执行运单 - */ - private String upload_scene_status = ""; - /** - * 机器人当前运单 - */ - private String current_order = ""; - /** - * 机器人连接状态 0表示断连 1表示连接上 - */ - private String connection_status = ""; - /** - * 机器人可接单状态 true=可接单 false=不可接单 - */ - private boolean dispatchable = false; - /** - * core出错标识 - */ - private boolean is_error = false; - /** - * 是否正在执行用户下发的运单 - */ - private boolean procBusiness = false; - /** - * 机器人当前地图不在场景中 - */ - private boolean current_map_invalid = false; - /** - * 机器人是否断连 - */ - private boolean disconnect = false; - /** - * 1 = api 设置可接单,2 = api 设置不可接单(小车占用资源), 3 = api 设置不可接单(小车不占用资源) - */ - private int dispatchable_status = 0; - /** - * 低电量 - */ - private boolean low_battery = false; - /** - * 暂停运单 - */ - private boolean suspended = false; - /** - * 未确认定位 - */ - private boolean unconfirmed_reloc = false; - /** - * 0: 控制权在core手上 1; 控制权被其他人抢走; 2: 控制权没有被抢占 - */ - private int unlock = 0; - - /** - * agv二次分配类型(1、普通任务 2、取货二次分配 3、防货二次分配 4、取放货二次分配) - */ - private String taskType = ""; - - - String device_code = null; - String container; - String container_type_desc; - String last_container_type_desc; - String last_container; - private Date instruction_require_time = new Date(); - private Date instruction_finished_time = new Date(); - - private int instruction_require_time_out; - - String message; - - // 1 上位系统允许进入 2 上位系统允许离开 - int status = 0; - - int agvphase = 0; - int index = 0; - - int mode = 2; - - int move; - - @Override - public void execute() { - try { -// getAgvStatus(); - } catch (Exception e) { - message = "获取机器人状态报错"; - } - } - - @Override - public JSONObject getDeviceStatusName() { - Map map = new LinkedHashMap<>(); -// try { -// getAgvStatus(); -// } catch (Exception e) { -// message = "获取机器人状态报错"; -// } - String isError; - if (is_error) { - isError = "出错,不执行任何运单"; - } else { - isError = "正常"; - } - if (CommonFinalParam.ONE.equals(upload_scene_status)) { - upload_scene_status = "正在更新场景"; - } else if (CommonFinalParam.TWO.equals(upload_scene_status)) { - upload_scene_status = "正在执行运单"; - } else if (CommonFinalParam.DELETE.equals(upload_scene_status)) { - upload_scene_status = "可推送"; - } - map.put("errors", isError); - map.put("upload_scene_status", upload_scene_status); - map.put("procBusiness", procBusiness ? "是": "否"); - // map.put("current_order", current_order); - map.put("connection_status", "1".equals(connection_status) ? "连接上" : "断连"); - map.put("dispatchable", dispatchable ? "可接单" : "不可接单"); - map.put("dispatchable_status", dispatchable_status == 1?"设置可接单" : dispatchable_status == 2?"设置不可接单(小车占用资源)" : dispatchable_status == 3?"设置不可接单(小车不占用资源)" : "未知"); - map.put("current_map_invalid", current_map_invalid ? "机器人不在地图场景中": "机器人在地图场景中"); - map.put("disconnect", disconnect ? "机器人断连" : "机器人连接上"); - map.put("low_battery", low_battery ? "低电量": "正常"); - map.put("suspended", suspended ? "订单被暂停,需要人工手动恢复": "正常"); - map.put("message", message); - map.put("agv_task_type", taskType); - map.put("unconfirmed_reloc", unconfirmed_reloc ? "未确认定位" : "正常"); - map.put("unlock", unlock == 0 ? "控制权在core手上" : unlock == 1 ? "控制权被其他人抢走" : unlock == 2 ? "控制权没有被抢占" : "未知"); - map.put("move_2","有货"); - JSONObject jo = new JSONObject(map); - return jo; - } - - - @Override - public void setDeviceStatus(JSONObject data) { - - } - - - /** - * 获取机器人信息 - */ - private void getAgvStatus() { - HttpResponse robotInfo = xianGongAgvService.getRobotInfo(this.getDevice().getDevice_name()); - if (ObjectUtil.isNotEmpty(robotInfo) && robotInfo.getStatus() == 200) { - JSONObject jsonObject = JSONObject.parseObject(robotInfo.body()); - String report = jsonObject.getString("report"); - //core出错标识 - is_error = jsonObject.getBooleanValue("is_error"); - //是否推送场景的状态 0=可推送 1=正在更新场景 2=正在执行运单 - upload_scene_status = jsonObject.getString("upload_scene_status"); - JSONArray objects = JSONObject.parseArray(report); - for (Object object : objects) { - JSONObject json = (JSONObject) object; - //是否正在执行用户下发的运单 - procBusiness = json.getBooleanValue("procBusiness"); - //机器人当前运单 - current_order = json.getString("current_order"); - //机器人连接状态 0表示断连 1表示连接上 - connection_status = json.getString("connection_status"); - //机器人可接单状态 true=可接单 false=不可接单 - dispatchable = json.getBooleanValue("dispatchable"); - //机器人不可接单原因 - JSONObject undispatchableReason = json.getJSONObject("undispatchable_reason"); - //机器人当前地图不在场景中 - current_map_invalid = undispatchableReason.getBooleanValue("current_map_invalid"); - //网络断连 - disconnect = undispatchableReason.getBooleanValue("disconnect"); - //可接单状态: 0 = api 设置可接单, 1 = api 设置不可接单 - dispatchable_status = undispatchableReason.getIntValue("dispatchable_status"); - //低电量 - low_battery = undispatchableReason.getBooleanValue("low_battery"); - //当前车子的订单被暂停了,需要人为手动恢复 - suspended = undispatchableReason.getBooleanValue("suspended"); - //未确认定位 - unconfirmed_reloc = undispatchableReason.getBooleanValue("unconfirmed_reloc"); - //0: 控制权在core手上 , 1:控制权被其他人抢走 - unlock = undispatchableReason.getIntValue("unlock"); - } - } else { - message = "请求机器人状态失败"; - log.info("请求{}机器人状态失败", this.getDevice().getDevice_name()); - } - } -} - diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/ItemProtocol.java deleted file mode 100644 index 62dd6db..0000000 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/ItemProtocol.java +++ /dev/null @@ -1,82 +0,0 @@ -package org.nl.acs.device_driver.autodoor.standard_autodoor; - -import cn.hutool.core.util.StrUtil; -import lombok.extern.slf4j.Slf4j; -import org.nl.acs.device.domain.ItemDto; - -import java.util.ArrayList; -import java.util.List; - -@Slf4j -public class ItemProtocol { - public static String item_open = "open"; - public static String item_close = "close"; - public static String item_to_open = "to_open"; - public static String item_to_close = "to_close"; - - - private StandardAutodoorDeviceDriver driver; - - public ItemProtocol(StandardAutodoorDeviceDriver driver) { - this.driver = driver; - } - - public int getOpen() { - return this.getOpcIntegerValue(item_open); - } - - public int getClose() { - return this.getOpcIntegerValue(item_close); - } - - - public int getToOpen() { - return this.getOpcIntegerValue(item_to_open); - } - - public int getToClose() { - return this.getOpcIntegerValue(item_to_close); - } - - public int getOpcIntegerValue(String protocol) { - Integer value = this.driver.getIntegeregerValue(protocol); - if (value == null) { - // log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); - } else { - return value; - } - return 0; - - } - - public String getOpcStringValue(String protocol) { - String value = this.driver.getStringValue(protocol); - if (StrUtil.isEmpty(value)) { - - } else { - return value; - } - return "0"; - } - - public static List getReadableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_open, "开到位", "10001")); - list.add(new ItemDto(item_close, "关到位", "10002")); - return list; - } - - public static List getWriteableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_open, "下发开门", "00001" )); - list.add(new ItemDto(item_to_close, "下发关门", "00002")); - return list; - } - - - @Override - public String toString() { - return ""; - } -} - diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/StandardAutodoorDefination.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/StandardAutodoorDefination.java deleted file mode 100644 index ec14fa5..0000000 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/StandardAutodoorDefination.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.nl.acs.device_driver.autodoor.standard_autodoor; - -import org.nl.acs.device.domain.ItemDto; -import org.nl.acs.device.domain.Device; -import org.nl.acs.device.enums.DeviceType; -import org.nl.acs.device_driver.DeviceDriver; -import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination; -import org.springframework.stereotype.Service; - -import java.util.LinkedList; -import java.util.List; - -/** - * 自动门驱动定义 - */ -@Service -public class StandardAutodoorDefination implements OpcDeviceDriverDefination { - @Override - public String getDriverCode() { - return "standard_autodoor"; - } - - @Override - public String getDriverName() { - return "标准版-自动门"; - } - - @Override - public String getDriverDescription() { - return "标准版-自动门"; - } - - - @Override - public DeviceDriver getDriverInstance(Device device) { - return (new StandardAutodoorDeviceDriver()).setDevice(device).setDriverDefination(this); - - } - - @Override - public Class getDeviceDriverType() { - return StandardAutodoorDeviceDriver.class; - } - - @Override - public List getFitDeviceTypes() { - List types = new LinkedList(); - types.add(DeviceType.autodoor); - return types; - } - - - @Override - public List getReadableItemDtos() { - return ItemProtocol.getReadableItemDtos(); - } - - @Override - public List getWriteableItemDtos() { - return ItemProtocol.getWriteableItemDtos(); - } - -} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/StandardAutodoorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/StandardAutodoorDeviceDriver.java deleted file mode 100644 index 176cb68..0000000 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/StandardAutodoorDeviceDriver.java +++ /dev/null @@ -1,135 +0,0 @@ -package org.nl.acs.device_driver.autodoor.standard_autodoor; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import lombok.Data; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.nl.acs.device.domain.Device; -import org.nl.acs.device_driver.DeviceDriver; -import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; -import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; -import org.nl.acs.log.service.DeviceExecuteLogService; -import org.nl.acs.monitor.DeviceStageMonitor; -import org.nl.acs.utils.ReadUtil; -import org.nl.config.SpringContextHolder; -import org.nl.config.lucene.service.LuceneExecuteLogService; -import org.nl.config.lucene.service.dto.LuceneLogDto; -import org.openscada.opc.lib.da.Server; -import org.springframework.beans.factory.annotation.Autowired; - -import java.util.HashMap; -import java.util.Map; - - -/** - * 自动门驱动 - */ -@Slf4j -@Data -@RequiredArgsConstructor -public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, DeviceStageMonitor { - protected ItemProtocol itemProtocol = new ItemProtocol(this); - protected ToDoorCommandControl toDoorCommandControl = new ToDoorCommandControl(this); - DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); - @Autowired - LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class); - - int open = 0; - int close = 0; - - int last_open = 0; - int last_close = 0; - - int toOpen = 0; - int last_toOpen = 0; - int toClose = 0; - int last_toClose = 0; - String device_code = null; - - @Override - public Device getDevice() { - return this.device; - } - - - @Override - public void execute() { - String message = null; - - device_code = this.getDevice().getDevice_code(); - open = this.itemProtocol.getOpen(); - close = this.itemProtocol.getClose(); - toOpen = this.itemProtocol.getToOpen(); - toClose = this.itemProtocol.getToClose(); - if (open != last_open) { - logServer.deviceExecuteLog(this.device_code, "", "", "信号open:" + last_open + "->" + open); - } - if (close != last_close) { - if(close ==1 ){ - this.writing("to_close","0"); - } - } - - last_open = open; - last_close = close; - last_toClose = toClose; - last_toOpen = toOpen; - } - - - public void writing(String param, String value) { - String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + param; - Map itemMap = new HashMap(); - itemMap.put(to_param, Integer.parseInt(value)); - try { - this.toDoorCommandControl.control(param,value); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public void writing(String param, int command) { - String to_command = String.format("%s.%s.%s.%s", this.getDevice().getOpc_server_code(), this.getDevice().getOpc_plc_code(), this.getDevice().getDevice_code(), param); - - 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); - log.info("下发PLC信号:{},{}", to_command, command); - System.out.println("设备:" + this.device_code + ",下发PLC信号:" + to_command + ",value:" + command); - - } - - @Override - public JSONObject getDeviceStatusName() { - JSONObject jo = new JSONObject(); - String open = ""; - String close = ""; - if (this.getOpen() == 0) { - open = "未知"; - } else if (this.getOpen() == 1) { - open = "开到位"; - } - if (this.getClose() == 0) { - open = "未知"; - } else if (this.getClose() == 1) { - open = "关到位"; - } - jo.put("device_name", this.getDevice().getDevice_name()); - jo.put("open", open); - jo.put("close", close); - jo.put("isOnline", true); - - return jo; - } - - @Override - public void setDeviceStatus(JSONObject data) { - - } - - -} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/ToDoorCommandControl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/ToDoorCommandControl.java deleted file mode 100644 index 48839fc..0000000 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/ToDoorCommandControl.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.nl.acs.device_driver.autodoor.standard_autodoor; - - -import java.util.HashMap; -import java.util.Map; - -public class ToDoorCommandControl { - - private StandardAutodoorDeviceDriver driver; - - public ToDoorCommandControl(StandardAutodoorDeviceDriver driver){ - this.driver = driver; - } - - public void control(String param, String value) throws Exception { -// ItemValue[] itemValues = new ItemValue[]{new ItemValue(this.driver.getItem(ItemProtocol.item_to_command), command)}; - Map itemMap = new HashMap(); - String to_param = this.driver.getDevice().getOpc_server_code() + "." + this.driver.getDevice().getOpc_plc_code() + "." + this.driver.getDevice().getDevice_code() - + "."+ param; - itemMap.put(to_param, Integer.parseInt(value)); - try { - this.driver.checkcontrol(itemMap); - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/AcsUtil.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/AcsUtil.java index f8736f0..5901e40 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/AcsUtil.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/AcsUtil.java @@ -7,7 +7,6 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import lombok.extern.slf4j.Slf4j; import org.nl.acs.common.base.CommonFinalParam; -import org.nl.acs.log.service.DeviceExecuteLogService; import org.nl.common.exception.BadRequestException; import org.nl.config.language.LangProcess; import org.nl.system.service.param.ISysParamService; @@ -23,8 +22,6 @@ public class AcsUtil { public static String notifyAcs(String api, W requestParam) { - DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class); - ; ISysParamService paramService = SpringContextHolder.getBean(SysParamServiceImpl.class); //判断是否连接立库WCS系统 String isConnect = paramService.findByCode("is_connect_liKu_Wcs").getValue(); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/LmsUtil.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/LmsUtil.java index 1f3b511..2db3961 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/LmsUtil.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/LmsUtil.java @@ -6,7 +6,6 @@ import cn.hutool.http.HttpRequest; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import lombok.extern.slf4j.Slf4j; -import org.nl.acs.log.service.DeviceExecuteLogService; import org.nl.config.SpringContextHolder; import org.nl.system.service.param.ISysParamService; import org.nl.system.service.param.impl.SysParamServiceImpl; @@ -18,8 +17,6 @@ import org.nl.system.service.param.impl.SysParamServiceImpl; public class LmsUtil { public static String notifyAcs(String api, W requestParam) { - DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class); - ; ISysParamService paramService = SpringContextHolder.getBean(SysParamServiceImpl.class); //判断是否连接立库WCS系统 String isConnect = paramService.findByCode("hasWms").getValue(); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/RetryableUtil.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/RetryableUtil.java deleted file mode 100644 index 8e1c0fc..0000000 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/RetryableUtil.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.nl.acs.ext.wms; - - -import cn.hutool.http.HttpRequest; -import cn.hutool.http.HttpResponse; -import com.alibaba.fastjson.JSONObject; -import lombok.extern.slf4j.Slf4j; -import org.nl.acs.ext.wms.service.AcsToWmsService; -import org.nl.common.exception.BadRequestException; -import org.nl.common.utils.RedisUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.retry.annotation.Backoff; -import org.springframework.retry.annotation.Recover; -import org.springframework.retry.annotation.Retryable; -import org.springframework.stereotype.Component; - -@Component -@Slf4j -public class RetryableUtil { - private static ThreadLocal retryTimes = new ThreadLocal<>(); - @Autowired - private RedisUtils redisUtils; - @Autowired - private AcsToWmsService acsToWmsService; - - /** - * 只针对对接系统连接拒绝、连接超时进行重试机制 - * 如果系统连接成功 但是对方返回失败不进行重试 - * - * @param url - * @param param - */ - @Retryable(maxAttempts = 5, backoff = @Backoff(delay = 15000L, multiplier = 2)) - public void retryable(String url, String param, String token) { - HttpResponse httpResponse = null; - String respMessage = null; - try { - httpResponse = - HttpRequest - .post(url) - .header("Authorization", token).body(String.valueOf(param)) - .body(param) - .timeout(5000) - .execute(); - } catch (Exception e) { - respMessage = e.getMessage(); - } - if (retryTimes.get() == null) { - retryTimes.set(1); - } else { - retryTimes.set(retryTimes.get() + 1); - } - if (httpResponse == null) { - log.error("接口进行第{}次重试,请求路径:{},请求参数:{},响应参数:{}", retryTimes.get(), url, JSONObject.parse(param), respMessage); - throw new BadRequestException(url + "_" + param + "_" + retryTimes.get()); - } - retryTimes.remove(); - log.info("接口重试成功,请求路径:{},请求参数:{},重试次数:{}", url, JSONObject.parse(param), retryTimes.get()); - } - - @Recover - public void recover(RuntimeException e) { - retryTimes.remove(); - String[] excMessage = e.getMessage().split("_"); - log.error("请求路径:{},请求参数:{},已达到最大重试次数:{},停止重试!", excMessage[0], excMessage[1], excMessage[2]); - } -} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java index b090893..7260054 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java @@ -19,7 +19,6 @@ import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapp import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ObjectUtils; import org.nl.acs.AcsConfig; -import org.nl.acs.agv.server.XianGongAgvService; import org.nl.acs.auto.initial.ApplicationAutoInitial; import org.nl.acs.common.base.CommonFinalParam; import org.nl.acs.device.domain.Device; @@ -39,7 +38,6 @@ import org.nl.acs.opc.DeviceAppServiceImpl; import org.nl.acs.route.service.RouteLineService; import org.nl.acs.route.service.dto.RouteLineDto; import org.nl.acs.route.service.impl.RouteLineServiceImpl; -import org.nl.acs.task.TaskInstructionLock; import org.nl.acs.task.domain.Task; import org.nl.acs.task.enums.AgvSystemTypeEnum; import org.nl.acs.task.enums.TaskStatusEnum; @@ -61,12 +59,10 @@ import org.nl.acs.instruction.service.mapper.InstructionMapper; import org.nl.common.utils.SecurityUtils; import org.nl.config.language.LangProcess; import org.nl.config.lucene.service.LuceneExecuteLogService; -import org.nl.config.lucene.service.dto.LuceneLogDto; import org.nl.system.service.param.ISysParamService; import org.nl.common.utils.CodeUtil; import org.nl.config.SpringContextHolder; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; @@ -102,8 +98,6 @@ public class InstructionServiceImpl extends CommonServiceImpl" + dto.getNext_device_code() + "路由类型不是agv类型"); } - //判断是否是仙工AGV - if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) { - - if (dto.getAgv_system_type().equals(AgvSystemTypeEnum.XG_System_Type.getIndex())) { - String interactionJson = task.getInteraction_json(); - if (StrUtil.isEmpty(interactionJson)) { - throw new BadRequestException("agv叉车调整长宽参数为空"); - } - InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class); - //仙工叉车 - HttpResponse response = xiangGongAgvService.sendOrderSequencesToForklift(dto, interactionJsonDTO); - if (ObjectUtils.isEmpty(response) || response.getStatus() != 200) { - dto.setSend_status("2"); - } else { - dto.setSend_status("1"); - } - } else if (dto.getAgv_system_type().equals(AgvSystemTypeEnum.One_NDC_System_Type.getIndex())) { - //一楼agv任务创建运单序列 - HttpResponse response = xiangGongAgvService.sendOrderSequencesToXZ(dto); - if (ObjectUtils.isEmpty(response) || response.getStatus() != 200) { - dto.setSend_status("2"); - } else { - dto.setSend_status("1"); - } - } - } } catch (Exception e) { dto.setSend_status("2"); log.error(e.getMessage()); @@ -594,35 +562,6 @@ public class InstructionServiceImpl extends CommonServiceImpl 0 && StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE)) { - Device deviceByCode = deviceAppService.findDeviceByCode(dto.getStart_device_code()); - if (dto.getAgv_system_type().equals(AgvSystemTypeEnum.XG_System_Type.getIndex())) { - String interactionJson = task.getInteraction_json(); - if (StrUtil.isEmpty(interactionJson)) { - throw new BadRequestException("agv叉车调整长宽参数为空"); - } - InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class); - //仙工叉车 - HttpResponse response = xiangGongAgvService.sendOrderSequencesToForklift(dto, interactionJsonDTO); - if (ObjectUtils.isEmpty(response) || response.getStatus() != 200) { - dto.setSend_status("2"); - } else { - dto.setSend_status("1"); - } - } else if (dto.getAgv_system_type().equals(AgvSystemTypeEnum.One_NDC_System_Type.getIndex())) { - //一楼agv任务创建运单序列 - HttpResponse response = xiangGongAgvService.sendOrderSequencesToXZ(dto); - if (ObjectUtils.isEmpty(response) || response.getStatus() != 200) { - dto.setSend_status("2"); - } else { - dto.setSend_status("1"); - } - } else if (dto.getAgv_system_type().equals(AgvSystemTypeEnum.Two_NDC_System_Type.getIndex())) { - - } - } } catch (Exception e) { dto.setSend_status("2"); log.error(e.getMessage()); @@ -1144,13 +1083,9 @@ public class InstructionServiceImpl extends CommonServiceImpl findLaneway(); - /** * 根据设备编号查询类型 * diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceAppServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceAppServiceImpl.java index 55fd508..19fa68f 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceAppServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceAppServiceImpl.java @@ -10,7 +10,6 @@ import org.nl.acs.device.enums.DeviceType; import org.nl.acs.device.service.DeviceDriverDefinationAppService; import org.nl.acs.device_driver.DeviceDriver; import org.nl.acs.device_driver.DeviceDriverDefination; -import org.nl.acs.device_driver.LinewayDeviceDriver; import org.nl.acs.device_driver.driver.OpcDeviceDriver; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -314,11 +313,6 @@ public class DeviceAppServiceImpl implements DeviceAppService, ApplicationAutoIn return null; } - @Override - public List findLaneway() { - return this.findDeviceDriver(LinewayDeviceDriver.class); - } - @Override public void autoInitial() throws Exception { log.info("加载所有设备"); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/storage_cell/service/dto/StorageCellQueryParam.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/storage_cell/service/dto/StorageCellQueryParam.java index ffcbf22..83dc6b3 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/storage_cell/service/dto/StorageCellQueryParam.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/storage_cell/service/dto/StorageCellQueryParam.java @@ -3,12 +3,6 @@ package org.nl.acs.storage_cell.service.dto; import lombok.Getter; import lombok.Setter; -import java.util.List; -import java.util.Date; - -import org.nl.common.annotation.Query; -import org.springframework.format.annotation.DateTimeFormat; - /** * @author jiaolm * @date 2023-05-09 diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/dto/TaskQueryParam.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/dto/TaskQueryParam.java index a5df0d0..f6c80a0 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/dto/TaskQueryParam.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/dto/TaskQueryParam.java @@ -4,12 +4,6 @@ package org.nl.acs.task.service.dto; import lombok.Getter; import lombok.Setter; -import java.util.List; -import java.util.Date; - -import org.nl.common.annotation.Query; -import org.springframework.format.annotation.DateTimeFormat; - /** * @author jiaolm * @date 2023-05-09 @@ -17,6 +11,6 @@ import org.springframework.format.annotation.DateTimeFormat; @Getter @Setter public class TaskQueryParam { - + private String task_status; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java index 886e310..c884f7f 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java @@ -18,7 +18,6 @@ import groovy.lang.Lazy; import lombok.extern.slf4j.Slf4j; import org.jetbrains.annotations.NotNull; import org.nl.acs.AcsConfig; -import org.nl.acs.agv.server.XianGongAgvService; import org.nl.acs.auto.initial.ApplicationAutoInitial; import org.nl.acs.common.base.CommonFinalParam; import org.nl.acs.device.domain.Device; @@ -64,7 +63,6 @@ import org.nl.common.utils.CodeUtil; import org.nl.config.SpringContextHolder; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; @@ -72,9 +70,7 @@ import org.springframework.data.domain.Pageable; import javax.servlet.http.HttpServletResponse; import java.io.IOException; -import java.time.LocalDateTime; import java.util.*; -import java.util.concurrent.CompletableFuture; import java.util.concurrent.CopyOnWriteArrayList; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -101,9 +97,6 @@ public class TaskServiceImpl extends CommonServiceImpl impleme private TaskFeedbackService taskFeedbackService; @Autowired private ISysParamService paramService; - @Lazy - @Autowired - private XianGongAgvService agvService; @Autowired private RouteLineService routeLineService; @Autowired @@ -911,10 +904,6 @@ public class TaskServiceImpl extends CommonServiceImpl impleme if (!TaskStatusEnum.FINISHED.getIndex().equals(updateTask.getTask_status())) { //反馈上位系统任务状态 this.feedWmsTaskStatus(entity); - //关闭仙工运单序列 - if (StrUtil.equals(task.getTask_type(), TaskTypeEnum.Standard_AGV_Task.getCode()) && (StrUtil.equals(task.getAgv_system_type(), AgvSystemTypeEnum.One_NDC_System_Type.getCode()) || StrUtil.equals(task.getAgv_system_type(), AgvSystemTypeEnum.XG_System_Type.getCode()))) { - this.markComplete(entity); - } } } @@ -943,10 +932,6 @@ public class TaskServiceImpl extends CommonServiceImpl impleme this.removeByCodeFromCache(entity.getTask_code()); //反馈上位系统任务状态 this.feedWmsTaskStatus(entity); - //关闭仙工运单序列 - if (StrUtil.equals(task.getTask_type(), TaskTypeEnum.Standard_AGV_Task.getCode()) && (StrUtil.equals(task.getAgv_system_type(), AgvSystemTypeEnum.One_NDC_System_Type.getCode()) || StrUtil.equals(task.getAgv_system_type(), AgvSystemTypeEnum.XG_System_Type.getCode()))) { - this.markComplete(entity); - } } @Override @@ -975,10 +960,6 @@ public class TaskServiceImpl extends CommonServiceImpl impleme this.removeByCodeFromCache(entity.getTask_code()); //反馈上位系统任务状态 // this.feedWmsTaskStatus(entity); - //关闭仙工运单序列 - if (StrUtil.equals(task.getTask_type(), TaskTypeEnum.Standard_AGV_Task.getCode()) && (StrUtil.equals(task.getAgv_system_type(), AgvSystemTypeEnum.One_NDC_System_Type.getCode()) || StrUtil.equals(task.getAgv_system_type(), AgvSystemTypeEnum.XG_System_Type.getCode()))) { - this.markComplete(entity); - } } @Override @@ -1007,10 +988,6 @@ public class TaskServiceImpl extends CommonServiceImpl impleme this.removeByCodeFromCache(entity.getTask_code()); //反馈上位系统任务状态 this.feedWmsTaskStatus(entity); - //关闭仙工运单序列 - if (StrUtil.equals(task.getTask_type(), TaskTypeEnum.Standard_AGV_Task.getCode()) && (StrUtil.equals(task.getAgv_system_type(), AgvSystemTypeEnum.One_NDC_System_Type.getCode()) || StrUtil.equals(task.getAgv_system_type(), AgvSystemTypeEnum.XG_System_Type.getCode()))) { - this.markComplete(entity); - } } @@ -1816,20 +1793,4 @@ public class TaskServiceImpl extends CommonServiceImpl impleme ja.add(feed_jo); } } - - /** - * 关闭仙工运单序列 - * - * @param taskDto - */ - private void markComplete(TaskDto taskDto) { - // 如果属于先知AGV,关闭运单序列 - try { - agvService.markComplete(taskDto.getTask_code()); - } catch (Exception e) { - log.error("关闭运单异常,原因:{}", e.getMessage()); - } - } - - } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/mapper/TaskMapper.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/mapper/TaskMapper.java index f0b0548..e684c92 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/mapper/TaskMapper.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/mapper/TaskMapper.java @@ -4,11 +4,8 @@ import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import org.nl.acs.common.base.CommonMapper; import org.nl.acs.task.domain.Task; -import org.nl.common.annotation.Query; import org.springframework.stereotype.Repository; -import java.time.LocalDateTime; -import java.util.Date; import java.util.List; import java.util.Map; diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/annotation/Limit.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/annotation/Limit.java deleted file mode 100644 index 9f33b48..0000000 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/annotation/Limit.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.nl.common.annotation; - -import org.nl.common.aspect.LimitType; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * @author jacky - */ -@Target(ElementType.METHOD) -@Retention(RetentionPolicy.RUNTIME) -public @interface Limit { - - // 资源名称,用于描述接口功能 - String name() default ""; - - // 资源 key - String key() default ""; - - // key prefix - String prefix() default ""; - - // 时间的,单位秒 - int period(); - - // 限制访问次数 - int count(); - - // 限制类型 - LimitType limitType() default LimitType.CUSTOMER; - -} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/annotation/RateLimiter.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/annotation/RateLimiter.java deleted file mode 100644 index f076f3b..0000000 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/annotation/RateLimiter.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.nl.common.annotation; - -import org.springframework.core.annotation.AliasFor; -import org.springframework.core.annotation.AnnotationUtils; - -import java.lang.annotation.*; -import java.util.concurrent.TimeUnit; - -/** - * @Author: lyd - * @Description: 限流注解,添加了 {@link AliasFor} 必须通过 {@link AnnotationUtils} 获取,才会生效 - * @Date: 2022-08-15 - */ -@Target(ElementType.METHOD) -@Retention(RetentionPolicy.RUNTIME) -@Documented -public @interface RateLimiter { - int NOT_LIMITED = 0; - - /** - * qps - */ - @AliasFor("qps") double value() default NOT_LIMITED; - - /** - * qps - */ - @AliasFor("value") double qps() default NOT_LIMITED; - - /** - * 超时时长 - */ - int timeout() default 0; - - /** - * 超时时间单位 - */ - TimeUnit timeUnit() default TimeUnit.MILLISECONDS; -} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/aspect/LimitAspect.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/aspect/LimitAspect.java deleted file mode 100644 index 43ba0a6..0000000 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/aspect/LimitAspect.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.nl.common.aspect; - -import cn.hutool.core.util.StrUtil; -import com.google.common.collect.ImmutableList; -import lombok.extern.slf4j.Slf4j; -import org.aspectj.lang.ProceedingJoinPoint; -import org.aspectj.lang.annotation.Around; -import org.aspectj.lang.annotation.Aspect; -import org.aspectj.lang.annotation.Pointcut; -import org.aspectj.lang.reflect.MethodSignature; -import org.nl.common.annotation.Limit; -import org.nl.common.exception.BadRequestException; -import org.nl.common.utils.RequestHolder; -import org.nl.common.utils.StringUtils; -import org.nl.config.language.LangProcess; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.data.redis.core.script.DefaultRedisScript; -import org.springframework.data.redis.core.script.RedisScript; -import org.springframework.stereotype.Component; - -import javax.servlet.http.HttpServletRequest; -import java.lang.reflect.Method; - -/** - * @author / - */ -@Aspect -@Component -@Slf4j -public class LimitAspect { - - private final RedisTemplate redisTemplate; - private static final Logger logger = LoggerFactory.getLogger(LimitAspect.class); - - public LimitAspect(RedisTemplate redisTemplate) { - this.redisTemplate = redisTemplate; - } - - @Pointcut("@annotation(org.nl.common.annotation.Limit)") - public void pointcut() { - } - - @Around("pointcut()") - public Object around(ProceedingJoinPoint joinPoint) throws Throwable { - HttpServletRequest request = RequestHolder.getHttpServletRequest(); - MethodSignature signature = (MethodSignature) joinPoint.getSignature(); - Method signatureMethod = signature.getMethod(); - Limit limit = signatureMethod.getAnnotation(Limit.class); - LimitType limitType = limit.limitType(); - String key = limit.key(); - if (StrUtil.isEmpty(key)) { - if (limitType == LimitType.IP) { - key = StringUtils.getIp(request); - } else { - key = signatureMethod.getName(); - } - } - - ImmutableList keys = ImmutableList.of(StrUtil.join(limit.prefix(), "_", key, "_", request.getRequestURI().replaceAll("/","_"))); - - String luaScript = buildLuaScript(); - RedisScript redisScript = new DefaultRedisScript<>(luaScript, Number.class); - Number count = redisTemplate.execute(redisScript, keys, limit.count(), limit.period()); - if (null != count && count.intValue() <= limit.count()) { - log.info("第{}次访问key为 {},描述为 [{}] 的接口", count, keys, limit.name()); - return joinPoint.proceed(); - } else { - throw new BadRequestException(LangProcess.msg("error_sysLimit")); - } - } - - /** - * 限流脚本 - */ - private String buildLuaScript() { - return "local c" + - "\nc = redis.call('get',KEYS[1])" + - "\nif c and tonumber(c) > tonumber(ARGV[1]) then" + - "\nreturn c;" + - "\nend" + - "\nc = redis.call('incr',KEYS[1])" + - "\nif tonumber(c) == 1 then" + - "\nredis.call('expire',KEYS[1],ARGV[2])" + - "\nend" + - "\nreturn c;"; - } -} - diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/aspect/LimitType.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/aspect/LimitType.java deleted file mode 100644 index 7959f02..0000000 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/aspect/LimitType.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.nl.common.aspect; - -/** - * 限流枚举 - * @author / - */ -public enum LimitType { - // 默认 - CUSTOMER, - // by ip addr - IP -} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/mnt/util/DataTypeEnum.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/mnt/util/DataTypeEnum.java deleted file mode 100644 index 99ab108..0000000 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/mnt/util/DataTypeEnum.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * << - * Davinci - * == - * Copyright (C) 2016 - 2019 EDP - * == - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * >> - * - */ - -package org.nl.common.mnt.util; -import lombok.extern.slf4j.Slf4j; - -/** - * @author / - */ -@Slf4j -@SuppressWarnings({"unchecked","all"}) -public enum DataTypeEnum { - - /** mysql */ - MYSQL("mysql", "mysql", "com.mysql.cj.jdbc.Driver", "`", "`", "'", "'"), - - /** oracle */ - ORACLE("oracle", "oracle", "oracle.jdbc.driver.OracleDriver", "\"", "\"", "\"", "\""), - - /** sql server */ - SQLSERVER("sqlserver", "sqlserver", "com.microsoft.sqlserver.jdbc.SQLServerDriver", "\"", "\"", "\"", "\""), - - /** h2 */ - H2("h2", "h2", "org.h2.Driver", "`", "`", "\"", "\""), - - /** phoenix */ - PHOENIX("phoenix", "hbase phoenix", "org.apache.phoenix.jdbc.PhoenixDriver", "", "", "\"", "\""), - - /** mongo */ - MONGODB("mongo", "mongodb", "mongodb.jdbc.MongoDriver", "`", "`", "\"", "\""), - - /** sql4es */ - ELASTICSEARCH("sql4es", "elasticsearch", "nl.anchormen.sql4es.jdbc.ESDriver", "", "", "'", "'"), - - /** presto */ - PRESTO("presto", "presto", "com.facebook.presto.jdbc.PrestoDriver", "", "", "\"", "\""), - - /** moonbox */ - MOONBOX("moonbox", "moonbox", "moonbox.jdbc.MbDriver", "`", "`", "`", "`"), - - /** cassandra */ - CASSANDRA("cassandra", "cassandra", "com.github.adejanovski.cassandra.jdbc.CassandraDriver", "", "", "'", "'"), - - /** click house */ - CLICKHOUSE("clickhouse", "clickhouse", "ru.yandex.clickhouse.ClickHouseDriver", "", "", "\"", "\""), - - /** kylin */ - KYLIN("kylin", "kylin", "org.apache.kylin.jdbc.Driver", "\"", "\"", "\"", "\""), - - /** vertica */ - VERTICA("vertica", "vertica", "com.vertica.jdbc.Driver", "", "", "'", "'"), - - /** sap */ - HANA("sap", "sap hana", "com.sap.db.jdbc.Driver", "", "", "'", "'"), - - /** impala */ - IMPALA("impala", "impala", "com.cloudera.impala.jdbc41.Driver", "", "", "'", "'"); - - private String feature; - private String desc; - private String driver; - private String keywordPrefix; - private String keywordSuffix; - private String aliasPrefix; - private String aliasSuffix; - - private static final String JDBC_URL_PREFIX = "jdbc:"; - - DataTypeEnum(String feature, String desc, String driver, String keywordPrefix, String keywordSuffix, String aliasPrefix, String aliasSuffix) { - this.feature = feature; - this.desc = desc; - this.driver = driver; - this.keywordPrefix = keywordPrefix; - this.keywordSuffix = keywordSuffix; - this.aliasPrefix = aliasPrefix; - this.aliasSuffix = aliasSuffix; - } - - public static DataTypeEnum urlOf(String jdbcUrl) { - String url = jdbcUrl.toLowerCase().trim(); - for (DataTypeEnum dataTypeEnum : values()) { - if (url.startsWith(JDBC_URL_PREFIX + dataTypeEnum.feature)) { - try { - Class aClass = Class.forName(dataTypeEnum.getDriver()); - if (null == aClass) { - throw new RuntimeException("Unable to get driver instance for jdbcUrl: " + jdbcUrl); - } - } catch (ClassNotFoundException e) { - throw new RuntimeException("Unable to get driver instance: " + jdbcUrl); - } - return dataTypeEnum; - } - } - return null; - } - - public String getFeature() { - return feature; - } - - public String getDesc() { - return desc; - } - - public String getDriver() { - return driver; - } - - public String getKeywordPrefix() { - return keywordPrefix; - } - - public String getKeywordSuffix() { - return keywordSuffix; - } - - public String getAliasPrefix() { - return aliasPrefix; - } - - public String getAliasSuffix() { - return aliasSuffix; - } -} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/mnt/util/ExecuteShellUtil.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/mnt/util/ExecuteShellUtil.java deleted file mode 100644 index cf5d26f..0000000 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/mnt/util/ExecuteShellUtil.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.nl.common.mnt.util; - -import cn.hutool.core.io.IoUtil; -import com.jcraft.jsch.ChannelShell; -import com.jcraft.jsch.JSch; -import com.jcraft.jsch.Session; -import lombok.extern.slf4j.Slf4j; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.io.PrintWriter; -import java.util.Vector; - -/** - * 执行shell命令 - * - * @author: ZhangHouYing - * @date: 2019/8/10 - */ -@Slf4j -public class ExecuteShellUtil { - - private Vector stdout; - - Session session; - - public ExecuteShellUtil(final String ipAddress, final String username, final String password,int port) { - try { - JSch jsch = new JSch(); - session = jsch.getSession(username, ipAddress, port); - session.setPassword(password); - session.setConfig("StrictHostKeyChecking", "no"); - session.connect(3000); - } catch (Exception e) { - log.error(e.getMessage(),e); - } - - } - - public int execute(final String command) { - int returnCode = 0; - ChannelShell channel = null; - PrintWriter printWriter = null; - BufferedReader input = null; - stdout = new Vector(); - try { - channel = (ChannelShell) session.openChannel("shell"); - channel.connect(); - input = new BufferedReader(new InputStreamReader(channel.getInputStream())); - printWriter = new PrintWriter(channel.getOutputStream()); - printWriter.println(command); - printWriter.println("exit"); - printWriter.flush(); - log.info("The remote command is: "); - String line; - while ((line = input.readLine()) != null) { - stdout.add(line); - System.out.println(line); - } - } catch (Exception e) { - log.error(e.getMessage(),e); - return -1; - }finally { - IoUtil.close(printWriter); - IoUtil.close(input); - if (channel != null) { - channel.disconnect(); - } - } - return returnCode; - } - - public void close(){ - if (session != null) { - session.disconnect(); - } - } - - public String executeForResult(String command) { - execute(command); - StringBuilder sb = new StringBuilder(); - for (String str : stdout) { - sb.append(str); - } - return sb.toString(); - } - -} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/mnt/util/ScpClientUtil.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/mnt/util/ScpClientUtil.java deleted file mode 100644 index 0df287d..0000000 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/mnt/util/ScpClientUtil.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.nl.common.mnt.util; - -import ch.ethz.ssh2.Connection; -import ch.ethz.ssh2.SCPClient; -import com.google.common.collect.Maps; - -import java.io.IOException; -import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * 远程执行linux命令 - * @author: ZhangHouYing - * @date: 2019-08-10 10:06 - */ -public class ScpClientUtil { - - static private Map instance = Maps.newHashMap(); - - static synchronized public ScpClientUtil getInstance(String ip, int port, String username, String password) { - if (instance.get(ip) == null) { - instance.put(ip, new ScpClientUtil(ip, port, username, password)); - } - return instance.get(ip); - } - - public ScpClientUtil(String ip, int port, String username, String password) { - this.ip = ip; - this.port = port; - this.username = username; - this.password = password; - } - - public void getFile(String remoteFile, String localTargetDirectory) { - Connection conn = new Connection(ip, port); - try { - conn.connect(); - boolean isAuthenticated = conn.authenticateWithPassword(username, password); - if (!isAuthenticated) { - System.err.println("authentication failed"); - } - SCPClient client = new SCPClient(conn); - client.get(remoteFile, localTargetDirectory); - } catch (IOException ex) { - Logger.getLogger(SCPClient.class.getName()).log(Level.SEVERE, null, ex); - }finally{ - conn.close(); - } - } - - public void putFile(String localFile, String remoteTargetDirectory) { - putFile(localFile, null, remoteTargetDirectory); - } - - public void putFile(String localFile, String remoteFileName, String remoteTargetDirectory) { - putFile(localFile, remoteFileName, remoteTargetDirectory,null); - } - - public void putFile(String localFile, String remoteFileName, String remoteTargetDirectory, String mode) { - Connection conn = new Connection(ip, port); - try { - conn.connect(); - boolean isAuthenticated = conn.authenticateWithPassword(username, password); - if (!isAuthenticated) { - System.err.println("authentication failed"); - } - SCPClient client = new SCPClient(conn); - if ((mode == null) || (mode.length() == 0)) { - mode = "0600"; - } - if (remoteFileName == null) { - client.put(localFile, remoteTargetDirectory); - } else { - client.put(localFile, remoteFileName, remoteTargetDirectory, mode); - } - } catch (IOException ex) { - Logger.getLogger(ScpClientUtil.class.getName()).log(Level.SEVERE, null, ex); - }finally{ - conn.close(); - } - } - - private String ip; - private int port; - private String username; - private String password; - - -} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/mnt/util/SqlUtils.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/mnt/util/SqlUtils.java deleted file mode 100644 index 718f5b2..0000000 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/mnt/util/SqlUtils.java +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.nl.common.mnt.util; - -import com.alibaba.druid.pool.DruidDataSource; -import com.alibaba.druid.util.StringUtils; -import com.google.common.collect.Lists; -import lombok.extern.slf4j.Slf4j; - -import javax.sql.DataSource; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStreamReader; -import java.nio.charset.StandardCharsets; -import java.sql.*; -import java.util.List; - -/** - * @author / - */ -@Slf4j -public class SqlUtils { - - public static final String COLON = ":"; - - - /** - * 获取数据源 - * - * @param jdbcUrl / - * @param userName / - * @param password / - * @return DataSource - */ - private static DataSource getDataSource(String jdbcUrl, String userName, String password) { - DruidDataSource druidDataSource = new DruidDataSource(); - String className; - try { - className = DriverManager.getDriver(jdbcUrl.trim()).getClass().getName(); - } catch (SQLException e) { - throw new RuntimeException("Get class name error: =" + jdbcUrl); - } - if (StringUtils.isEmpty(className)) { - DataTypeEnum dataTypeEnum = DataTypeEnum.urlOf(jdbcUrl); - if (null == dataTypeEnum) { - throw new RuntimeException("Not supported data type: jdbcUrl=" + jdbcUrl); - } - druidDataSource.setDriverClassName(dataTypeEnum.getDriver()); - } else { - druidDataSource.setDriverClassName(className); - } - - - druidDataSource.setUrl(jdbcUrl); - druidDataSource.setUsername(userName); - druidDataSource.setPassword(password); - // 配置获取连接等待超时的时间 - druidDataSource.setMaxWait(3000); - // 配置初始化大小、最小、最大 - druidDataSource.setInitialSize(1); - druidDataSource.setMinIdle(1); - druidDataSource.setMaxActive(1); - - // 如果链接出现异常则直接判定为失败而不是一直重试 - druidDataSource.setBreakAfterAcquireFailure(true); - try { - druidDataSource.init(); - } catch (SQLException e) { - log.error("Exception during pool initialization", e); - throw new RuntimeException(e.getMessage()); - } - - return druidDataSource; - } - - private static Connection getConnection(String jdbcUrl, String userName, String password) { - DataSource dataSource = getDataSource(jdbcUrl, userName, password); - Connection connection = null; - try { - connection = dataSource.getConnection(); - } catch (Exception ignored) {} - try { - int timeOut = 5; - if (null == connection || connection.isClosed() || !connection.isValid(timeOut)) { - log.info("connection is closed or invalid, retry get connection!"); - connection = dataSource.getConnection(); - } - } catch (Exception e) { - log.error("create connection error, jdbcUrl: {}", jdbcUrl); - throw new RuntimeException("create connection error, jdbcUrl: " + jdbcUrl); - } - return connection; - } - - private static void releaseConnection(Connection connection) { - if (null != connection) { - try { - connection.close(); - } catch (Exception e) { - log.error(e.getMessage(),e); - log.error("connection close error:" + e.getMessage()); - } - } - } - - - public static void closeResult(ResultSet rs) { - if (rs != null) { - try { - rs.close(); - } catch (Exception e) { - log.error(e.getMessage(),e); - } - } - } - - public static boolean testConnection(String jdbcUrl, String userName, String password) { - Connection connection = null; - try { - connection = getConnection(jdbcUrl, userName, password); - if (null != connection) { - return true; - } - } catch (Exception e) { - log.info("Get connection failed:" + e.getMessage()); - } finally { - releaseConnection(connection); - } - return false; - } - - public static String executeFile(String jdbcUrl, String userName, String password, File sqlFile) { - Connection connection = getConnection(jdbcUrl, userName, password); - try { - batchExecute(connection, readSqlList(sqlFile)); - } catch (Exception e) { - log.error("sql脚本执行发生异常:{}",e.getMessage()); - return e.getMessage(); - }finally { - releaseConnection(connection); - } - return "success"; - } - - - /** - * 批量执行sql - * @param connection / - * @param sqlList / - */ - public static void batchExecute(Connection connection, List sqlList) throws SQLException { - Statement st = connection.createStatement(); - for (String sql : sqlList) { - if (sql.endsWith(";")) { - sql = sql.substring(0, sql.length() - 1); - } - st.addBatch(sql); - } - st.executeBatch(); - } - - /** - * 将文件中的sql语句以;为单位读取到列表中 - * @param sqlFile / - * @return / - * @throws Exception e - */ - private static List readSqlList(File sqlFile) throws Exception { - List sqlList = Lists.newArrayList(); - StringBuilder sb = new StringBuilder(); - try (BufferedReader reader = new BufferedReader(new InputStreamReader( - new FileInputStream(sqlFile), StandardCharsets.UTF_8))) { - String tmp; - while ((tmp = reader.readLine()) != null) { - log.info("line:{}", tmp); - if (tmp.endsWith(";")) { - sb.append(tmp); - sqlList.add(sb.toString()); - sb.delete(0, sb.length()); - } else { - sb.append(tmp); - } - } - if (!"".endsWith(sb.toString().trim())) { - sqlList.add(sb.toString()); - } - } - - return sqlList; - } - -} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/mnt/util/ZipUtils.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/mnt/util/ZipUtils.java deleted file mode 100644 index 9ef08c7..0000000 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/common/mnt/util/ZipUtils.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.nl.common.mnt.util; - -import java.io.*; -import java.util.Enumeration; -import java.util.zip.ZipEntry; -import java.util.zip.ZipException; -import java.util.zip.ZipFile; -import java.util.zip.ZipInputStream; - -/** - * @author: ZhangHouYing - * @date: 2019-08-10 13:34 - */ -public class ZipUtils { - /** - * 解压文件 - * - * @param zipFilePath 解压文件路径 - * @param outputFolder 输出解压文件路径 - */ - public static void unZipIt(String zipFilePath, String outputFolder) { - byte[] buffer = new byte[1024]; - - File folder = new File(outputFolder); - if (!folder.exists()) { - folder.mkdir(); - } - try { - //get the zip file content - ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFilePath)); - ZipEntry ze = zis.getNextEntry(); - while (ze != null) { - String fileName = ze.getName(); - File newFile = new File(outputFolder + File.separator + fileName); - System.out.println("file unzip : " + newFile.getAbsoluteFile()); - //大部分网络上的源码,这里没有判断子目录 - if (ze.isDirectory()) { - if (!newFile.mkdirs()) { - System.out.println("was not successful."); - } - } else { - if (!new File(newFile.getParent()).mkdirs()) { - System.out.println("was not successful."); - } - FileOutputStream fos = new FileOutputStream(newFile); - int len; - while ((len = zis.read(buffer)) != -1) { - fos.write(buffer, 0, len); - } - fos.close(); - } - ze = zis.getNextEntry(); - } - zis.closeEntry(); - zis.close(); - System.out.println("Done"); - } catch (IOException e) { - e.printStackTrace(); - } - } - - public static void unzip(File source, String out) throws IOException { - try (ZipInputStream zis = new ZipInputStream(new FileInputStream(source))) { - - ZipEntry entry = zis.getNextEntry(); - - while (entry != null) { - - File file = new File(out, entry.getName()); - - if (entry.isDirectory()) { - if (!file.mkdirs()) { - System.out.println("was not successful."); - } - } else { - File parent = file.getParentFile(); - - if (!parent.exists()) { - if (!parent.mkdirs()) { - System.out.println("was not successful."); - } - } - - try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file))) { - - byte[] buffer = new byte[Math.toIntExact(entry.getSize())]; - - int location; - - while ((location = zis.read(buffer)) != -1) { - bos.write(buffer, 0, location); - } - } - } - entry = zis.getNextEntry(); - } - } - } - - /** - * 把所有文件都直接解压到指定目录(忽略子文件夹) - * - * @param zipFile - * @param folderPath - * @throws ZipException - * @throws IOException - */ - public static void upZipFile(File zipFile, String folderPath) throws ZipException, IOException { - File desDir = new File(folderPath); - if (!desDir.exists()) { - if (!desDir.mkdirs()) { - System.out.println("was not successful."); - } - } - ZipFile zf = new ZipFile(zipFile); - for (Enumeration entries = zf.entries(); entries.hasMoreElements(); ) { - ZipEntry entry = ((ZipEntry) entries.nextElement()); - InputStream in = zf.getInputStream(entry); - String str = folderPath; - File desFile = new File(str, java.net.URLEncoder.encode(entry.getName(), "UTF-8")); - - if (!desFile.exists()) { - File fileParentDir = desFile.getParentFile(); - if (!fileParentDir.exists()) { - if (!fileParentDir.mkdirs()) { - System.out.println("was not successful."); - } - } - } - - OutputStream out = new FileOutputStream(desFile); - byte[] buffer = new byte[1024 * 1024]; - int realLength = in.read(buffer); - while (realLength != -1) { - out.write(buffer, 0, realLength); - realLength = in.read(buffer); - } - - out.close(); - in.close(); - - } - } -} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/controller/dict/SysDictController.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/controller/dict/SysDictController.java index 7158981..248d080 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/controller/dict/SysDictController.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/controller/dict/SysDictController.java @@ -77,7 +77,6 @@ public class SysDictController { } @Log("删除字典") - @DeleteMapping // @SaCheckPermission("dict:del") public ResponseEntity delete(@RequestBody Set ids){ @@ -86,7 +85,6 @@ public class SysDictController { } @GetMapping("/dictDetail") - public ResponseEntity queryDetails(@RequestParam Map criteria, PageQuery pageable){ DictQuery dictQuery = JSONObject.parseObject(JSONObject.toJSONString(criteria), DictQuery.class); return new ResponseEntity<>(TableDataInfo.build(dictService.queryAllDetail(dictQuery,pageable)),HttpStatus.OK); diff --git a/acs2/nladmin-ui/src/api/generator/genConfig.js b/acs2/nladmin-ui/src/api/generator/genConfig.js deleted file mode 100644 index e15b200..0000000 --- a/acs2/nladmin-ui/src/api/generator/genConfig.js +++ /dev/null @@ -1,16 +0,0 @@ -import request from '@/utils/request' - -export function get(tableName) { - return request({ - url: 'api/genConfig/' + tableName, - method: 'get' - }) -} - -export function update(data) { - return request({ - url: 'api/genConfig', - data, - method: 'put' - }) -} diff --git a/acs2/nladmin-ui/src/api/generator/generator.js b/acs2/nladmin-ui/src/api/generator/generator.js deleted file mode 100644 index 0c49718..0000000 --- a/acs2/nladmin-ui/src/api/generator/generator.js +++ /dev/null @@ -1,33 +0,0 @@ -import request from '@/utils/request' - -export function getAllTable() { - return request({ - url: 'api/generator/tables/all', - method: 'get' - }) -} - -export function generator(tableName, type) { - return request({ - url: 'api/generator/' + tableName + '/' + type, - method: 'post', - responseType: type === 2 ? 'blob' : '' - }) -} - -export function save(data) { - return request({ - url: 'api/generator', - data, - method: 'put' - }) -} - -export function sync(tables) { - return request({ - url: 'api/generator/sync', - method: 'post', - data: tables - }) -} - diff --git a/acs2/nladmin-ui/src/i18n/langs/task/zh.js b/acs2/nladmin-ui/src/i18n/langs/task/zh.js index b79c399..b53764c 100644 --- a/acs2/nladmin-ui/src/i18n/langs/task/zh.js +++ b/acs2/nladmin-ui/src/i18n/langs/task/zh.js @@ -71,7 +71,7 @@ export default { 'please_select_destination_level': '请选择终点-层!' }, screen: { - 'title': '兰州海亮设备管理任务看板', + 'title': '设备管理任务看板', 'task_screen': '任务看板', 'device': '当前设备', 'Wednesday': '星期三', diff --git a/acs2/nladmin-ui/src/views/acs/device/acsToERP/index.vue b/acs2/nladmin-ui/src/views/acs/device/acsToERP/index.vue deleted file mode 100644 index c8b90a0..0000000 --- a/acs2/nladmin-ui/src/views/acs/device/acsToERP/index.vue +++ /dev/null @@ -1,175 +0,0 @@ - - - - - diff --git a/acs2/nladmin-ui/src/views/acs/test/hailiang/index.vue b/acs2/nladmin-ui/src/views/acs/test/hailiang/index.vue deleted file mode 100644 index 47cd2a6..0000000 --- a/acs2/nladmin-ui/src/views/acs/test/hailiang/index.vue +++ /dev/null @@ -1,152 +0,0 @@ - - - - - diff --git a/acs2/nladmin-ui/src/views/components/VxeTableRender/components/EditDownModal.vue b/acs2/nladmin-ui/src/views/components/VxeTableRender/components/EditDownModal.vue deleted file mode 100644 index 47f758a..0000000 --- a/acs2/nladmin-ui/src/views/components/VxeTableRender/components/EditDownModal.vue +++ /dev/null @@ -1,140 +0,0 @@ - - - - - diff --git a/acs2/nladmin-ui/src/views/components/VxeTableRender/components/EditDownTable.vue b/acs2/nladmin-ui/src/views/components/VxeTableRender/components/EditDownTable.vue deleted file mode 100644 index 994681b..0000000 --- a/acs2/nladmin-ui/src/views/components/VxeTableRender/components/EditDownTable.vue +++ /dev/null @@ -1,127 +0,0 @@ - - - - - diff --git a/acs2/nladmin-ui/src/views/components/VxeTableRender/components/EditPopupModal.vue b/acs2/nladmin-ui/src/views/components/VxeTableRender/components/EditPopupModal.vue deleted file mode 100644 index 544a6ad..0000000 --- a/acs2/nladmin-ui/src/views/components/VxeTableRender/components/EditPopupModal.vue +++ /dev/null @@ -1,117 +0,0 @@ - - - - - diff --git a/acs2/nladmin-ui/src/views/components/VxeTableRender/components/FilterComplex.vue b/acs2/nladmin-ui/src/views/components/VxeTableRender/components/FilterComplex.vue deleted file mode 100644 index 599c27c..0000000 --- a/acs2/nladmin-ui/src/views/components/VxeTableRender/components/FilterComplex.vue +++ /dev/null @@ -1,69 +0,0 @@ - - - - - diff --git a/acs2/nladmin-ui/src/views/components/VxeTableRender/components/FilterContent.vue b/acs2/nladmin-ui/src/views/components/VxeTableRender/components/FilterContent.vue deleted file mode 100644 index ceb296b..0000000 --- a/acs2/nladmin-ui/src/views/components/VxeTableRender/components/FilterContent.vue +++ /dev/null @@ -1,138 +0,0 @@ - - - - - diff --git a/acs2/nladmin-ui/src/views/components/VxeTableRender/components/FilterExcel.vue b/acs2/nladmin-ui/src/views/components/VxeTableRender/components/FilterExcel.vue deleted file mode 100644 index 7714cff..0000000 --- a/acs2/nladmin-ui/src/views/components/VxeTableRender/components/FilterExcel.vue +++ /dev/null @@ -1,262 +0,0 @@ - - - - - diff --git a/acs2/nladmin-ui/src/views/components/VxeTableRender/components/FilterInput.vue b/acs2/nladmin-ui/src/views/components/VxeTableRender/components/FilterInput.vue deleted file mode 100644 index 216ff38..0000000 --- a/acs2/nladmin-ui/src/views/components/VxeTableRender/components/FilterInput.vue +++ /dev/null @@ -1,50 +0,0 @@ - - - - - diff --git a/acs2/nladmin-ui/src/views/components/VxeTableRender/components/FormSimple.vue b/acs2/nladmin-ui/src/views/components/VxeTableRender/components/FormSimple.vue deleted file mode 100644 index e243e59..0000000 --- a/acs2/nladmin-ui/src/views/components/VxeTableRender/components/FormSimple.vue +++ /dev/null @@ -1,52 +0,0 @@ - - - diff --git a/acs2/nladmin-ui/src/views/components/VxeTableRender/content.js b/acs2/nladmin-ui/src/views/components/VxeTableRender/content.js deleted file mode 100644 index 9853dec..0000000 --- a/acs2/nladmin-ui/src/views/components/VxeTableRender/content.js +++ /dev/null @@ -1,28 +0,0 @@ -import VXETable from 'vxe-table' - -// 创建一个简单的展开内容渲染 -VXETable.renderer.add('MyExpand', { - renderExpand(h, renderOpts, params) { - const { row } = params - return [ -
    -
  • - ID: - {row.id} -
  • -
  • - Name: - {row.name} -
  • -
  • - UpdateTime: - {row.updateTime} -
  • -
  • - CreateTime: - {row.createTime} -
  • -
- ] - } -}) diff --git a/acs2/nladmin-ui/src/views/components/VxeTableRender/default.js b/acs2/nladmin-ui/src/views/components/VxeTableRender/default.js deleted file mode 100644 index 98aa48e..0000000 --- a/acs2/nladmin-ui/src/views/components/VxeTableRender/default.js +++ /dev/null @@ -1,12 +0,0 @@ -import VXETable from 'vxe-table' -// 创建一个简单的超链接渲染 -VXETable.renderer.add('MyLink', { - // 默认显示模板 - renderDefault(h, renderOpts, params) { - const { row, column } = params - const { events } = renderOpts - return [ - events.click(params)}>{row[column.property]} - ] - } -}) diff --git a/acs2/nladmin-ui/src/views/components/VxeTableRender/edit.js b/acs2/nladmin-ui/src/views/components/VxeTableRender/edit.js deleted file mode 100644 index 571caaa..0000000 --- a/acs2/nladmin-ui/src/views/components/VxeTableRender/edit.js +++ /dev/null @@ -1,57 +0,0 @@ -import Vue from 'vue' -import VXETable from 'vxe-table' -import EditDownTable from './components/EditDownTable.vue' -import EditPopupModal from './components/EditPopupModal.vue' -import EditDownModal from './components/EditDownModal.vue' - -Vue.component(EditDownTable.name, EditDownTable) -Vue.component(EditPopupModal.name, EditPopupModal) -Vue.component(EditDownModal.name, EditDownModal) - -// 创建一个简单的输入框渲染 -VXETable.renderer.add('MyInput', { - // 激活时自动聚焦 - autofocus: '.my-cell', - // 可编辑激活模板 - renderEdit(h, renderOpts, { row, column }) { - return [ - - ] - }, - // 可编辑显示模板 - renderCell(h, renderOpts, { row, column }) { - return [ - { row[column.property] } - ] - } -}) - -// 创建一个下拉表格渲染 -VXETable.renderer.add('EditDownTable', { - autofocus: '.vxe-input--inner', - renderEdit(h, renderOpts, params) { - return [ - - ] - } -}) - -// 创建一个弹窗渲染 -VXETable.renderer.add('EditPopupModal', { - autofocus: '.vxe-input--inner', - renderEdit(h, renderOpts, params) { - return [ - - ] - } -}) - -// 创建一个复杂的组合渲染 -VXETable.renderer.add('EditDownModal', { - autofocus: '.vxe-input--inner', - renderEdit(h, renderOpts, params) { - return [ - - ] - } -}) diff --git a/acs2/nladmin-ui/src/views/components/VxeTableRender/empty.js b/acs2/nladmin-ui/src/views/components/VxeTableRender/empty.js deleted file mode 100644 index 74fabbe..0000000 --- a/acs2/nladmin-ui/src/views/components/VxeTableRender/empty.js +++ /dev/null @@ -1,13 +0,0 @@ -import VXETable from 'vxe-table' -// 创建一个简单的空内容渲染 -VXETable.renderer.add('NotData', { - // 空内容模板 - renderEmpty() { - return [ - - -

亲,没有更多数据了!

-
- ] - } -}) diff --git a/acs2/nladmin-ui/src/views/components/VxeTableRender/filter.js b/acs2/nladmin-ui/src/views/components/VxeTableRender/filter.js deleted file mode 100644 index 6ce21bf..0000000 --- a/acs2/nladmin-ui/src/views/components/VxeTableRender/filter.js +++ /dev/null @@ -1,123 +0,0 @@ -import Vue from 'vue' -import VXETable from 'vxe-table' -import FilterInput from './components/FilterInput.vue' -import FilterContent from './components/FilterContent.vue' -import FilterComplex from './components/FilterComplex.vue' -import FilterExcel from './components/FilterExcel.vue' - -Vue.component(FilterInput.name, FilterInput) -Vue.component(FilterContent.name, FilterContent) -Vue.component(FilterComplex.name, FilterComplex) -Vue.component(FilterExcel.name, FilterExcel) - -// 创建一个简单的输入框筛选 -VXETable.renderer.add('FilterInput', { - // 筛选模板 - renderFilter(h, renderOpts, params) { - return [ - - ] - }, - // 重置数据方法 - filterResetMethod({ options }) { - options.forEach(option => { - option.data = '' - }) - }, - // 重置筛选复原方法(当未点击确认时,该选项将被恢复为默认值) - filterRecoverMethod({ option }) { - option.data = '' - }, - // 筛选方法 - filterMethod({ option, row, column }) { - const { data } = option - const cellValue = row[column.property] - if (cellValue) { - return cellValue.indexOf(data) > -1 - } - return false - } -}) - -// 创建一个条件的渲染器 -VXETable.renderer.add('FilterComplex', { - // 不显示底部按钮,使用自定义的按钮 - isFooter: false, - // 筛选模板 - renderFilter(h, renderOpts, params) { - return [ - - ] - }, - // 重置数据方法 - filterResetMethod({ options }) { - options.forEach(option => { - option.data = { type: 'has', name: '' } - }) - }, - // 筛选数据方法 - filterMethod({ option, row, column }) { - const cellValue = row[column.property] - const { name } = option.data - if (cellValue) { - return cellValue.indexOf(name) > -1 - } - return false - } -}) - -// 创建一个支持列内容的筛选 -VXETable.renderer.add('FilterContent', { - // 不显示底部按钮,使用自定义的按钮 - isFooter: false, - // 筛选模板 - renderFilter(h, renderOpts, params) { - return [ - - ] - }, - // 重置数据方法 - filterResetMethod({ options }) { - options.forEach(option => { - option.data = { vals: [], sVal: '' } - }) - }, - // 筛选数据方法 - filterMethod({ option, row, column }) { - const { vals } = option.data - const cellValue = row[column.property] - return vals.includes(cellValue) - } -}) - -// 创建一个实现Excel的筛选器 -VXETable.renderer.add('FilterExcel', { - // 不显示底部按钮,使用自定义的按钮 - isFooter: false, - // 筛选模板 - renderFilter(h, renderOpts, params) { - return [ - - ] - }, - // 重置数据方法 - filterResetMethod({ options }) { - options.forEach(option => { - option.data = { vals: [], sVal: '', fMenu: '', f1Type: '', f1Val: '', fMode: 'and', f2Type: '', f2Val: '' } - }) - }, - // 筛选数据方法 - filterMethod({ option, row, column }) { - const cellValue = row[column.property] - const { vals, f1Type, f1Val } = option.data - if (cellValue) { - if (f1Type) { - return cellValue.indexOf(f1Val) > -1 - } else if (vals.length) { - // 通过指定值筛选 - return vals.includes(cellValue) - } - } - return false - } -}) diff --git a/acs2/nladmin-ui/src/views/components/VxeTableRender/form.js b/acs2/nladmin-ui/src/views/components/VxeTableRender/form.js deleted file mode 100644 index ac17fa2..0000000 --- a/acs2/nladmin-ui/src/views/components/VxeTableRender/form.js +++ /dev/null @@ -1,23 +0,0 @@ -import VXETable from 'vxe-table' -// 创建一个简单的表单-输入框渲染 -VXETable.renderer.add('FormItemInput', { - // 项内容模板 - renderItemContent(h, renderOpts, params) { - const { data, property } = params - const { props } = renderOpts - return [ - - ] - } -}) - -// 创建一个简单的表单-按钮组渲染 -VXETable.renderer.add('FormItemButtonGroup', { - // 项内容模板 - renderItemContent() { - return [ - 查询, - 重置 - ] - } -}) diff --git a/acs2/nladmin-ui/src/views/components/VxeTableRender/index.js b/acs2/nladmin-ui/src/views/components/VxeTableRender/index.js deleted file mode 100644 index 8d187ac..0000000 --- a/acs2/nladmin-ui/src/views/components/VxeTableRender/index.js +++ /dev/null @@ -1,7 +0,0 @@ -import './default' -import './filter' -import './edit' -import './content' -import './toolbar' -import './form' -import './empty' diff --git a/acs2/nladmin-ui/src/views/components/VxeTableRender/toolbar.js b/acs2/nladmin-ui/src/views/components/VxeTableRender/toolbar.js deleted file mode 100644 index 19fadb9..0000000 --- a/acs2/nladmin-ui/src/views/components/VxeTableRender/toolbar.js +++ /dev/null @@ -1,29 +0,0 @@ -import VXETable from 'vxe-table' -// 创建一个简单的工具栏-左侧按钮渲染 -VXETable.renderer.add('ToolbarButtonDownload', { - renderToolbarButton(h, renderOpts, params) { - const { events = {}} = renderOpts - const { button } = params - return [ - { - events.click(button) - } - }> - ] - } -}) - -// 创建一个简单的工具栏-右侧工具渲染 -VXETable.renderer.add('ToolbarToolPrint', { - renderToolbarTool(h, renderOpts, params) { - const { $table } = params - return [ - { - $table.print() - } - }> - ] - } -}) diff --git a/acs2/nladmin-ui/src/views/components/excel/upload-excel.vue b/acs2/nladmin-ui/src/views/components/excel/upload-excel.vue deleted file mode 100644 index 75f7634..0000000 --- a/acs2/nladmin-ui/src/views/components/excel/upload-excel.vue +++ /dev/null @@ -1,41 +0,0 @@ - - - diff --git a/acs2/nladmin-ui/src/views/components/icons/element-icons.js b/acs2/nladmin-ui/src/views/components/icons/element-icons.js deleted file mode 100644 index df72201..0000000 --- a/acs2/nladmin-ui/src/views/components/icons/element-icons.js +++ /dev/null @@ -1,74 +0,0 @@ -const elementIcons = [ - 'info', - 'error', - 'success', - 'warning', - 'question', - 'back', - 'arrow-left', - 'arrow-down', - 'arrow-right', - 'arrow-up', - 'caret-left', - 'caret-bottom', - 'caret-top', - 'caret-right', - 'd-arrow-left', - 'd-arrow-right', - 'minus', - 'plus', - 'remove', - 'circle-plus', - 'remove-outline', - 'circle-plus-outline', - 'close', - 'check', - 'circle-close', - 'circle-check', - 'circle-close-outline', - 'circle-check-outline', - 'zoom-out', - 'zoom-in', - 'd-caret', - 'sort', - 'sort-down', - 'sort-up', - 'tickets', - 'document', - 'goods', - 'sold-out', - 'news', - 'message', - 'date', - 'printer', - 'time', - 'bell', - 'mobile-phone', - 'service', - 'view', - 'menu', - 'more', - 'more-outline', - 'star-on', - 'star-off', - 'location', - 'location-outline', - 'phone', - 'phone-outline', - 'picture', - 'picture-outline', - 'delete', - 'search', - 'edit', - 'edit-outline', - 'rank', - 'refresh', - 'share', - 'setting', - 'upload', - 'upload2', - 'download', - 'loading' -] - -export default elementIcons diff --git a/acs2/nladmin-ui/src/views/components/icons/index.vue b/acs2/nladmin-ui/src/views/components/icons/index.vue deleted file mode 100644 index d060173..0000000 --- a/acs2/nladmin-ui/src/views/components/icons/index.vue +++ /dev/null @@ -1,97 +0,0 @@ - - - - - diff --git a/acs2/nladmin-ui/src/views/components/icons/svg-icons.js b/acs2/nladmin-ui/src/views/components/icons/svg-icons.js deleted file mode 100644 index 724cd8e..0000000 --- a/acs2/nladmin-ui/src/views/components/icons/svg-icons.js +++ /dev/null @@ -1,10 +0,0 @@ -const req = require.context('../../../assets/icons/svg', false, /\.svg$/) -const requireAll = requireContext => requireContext.keys() - -const re = /\.\/(.*)\.svg/ - -const svgIcons = requireAll(req).map(i => { - return i.match(re)[1] -}) - -export default svgIcons diff --git a/acs2/nladmin-ui/src/views/generator/config.vue b/acs2/nladmin-ui/src/views/generator/config.vue deleted file mode 100644 index 0ad0ed8..0000000 --- a/acs2/nladmin-ui/src/views/generator/config.vue +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - diff --git a/acs2/nladmin-ui/src/views/generator/index.vue b/acs2/nladmin-ui/src/views/generator/index.vue deleted file mode 100644 index 6c192d4..0000000 --- a/acs2/nladmin-ui/src/views/generator/index.vue +++ /dev/null @@ -1,118 +0,0 @@ - - - - - diff --git a/acs2/nladmin-ui/src/views/generator/preview.vue b/acs2/nladmin-ui/src/views/generator/preview.vue deleted file mode 100644 index d5b55f8..0000000 --- a/acs2/nladmin-ui/src/views/generator/preview.vue +++ /dev/null @@ -1,30 +0,0 @@ - - - diff --git a/acs2/nladmin-ui/src/views/tools/codeGen/codeDetail.js b/acs2/nladmin-ui/src/views/tools/codeGen/codeDetail.js deleted file mode 100644 index bc295ab..0000000 --- a/acs2/nladmin-ui/src/views/tools/codeGen/codeDetail.js +++ /dev/null @@ -1,39 +0,0 @@ -import request from '@/utils/request' - -export function get(dictName) { - const params = { - dictName, - page: 0, - size: 9999 - } - return request({ - url: 'api/codeDetail', - method: 'get', - params - }) -} - -export function add(data) { - return request({ - url: 'api/codeDetail', - method: 'post', - data - }) -} - -export function del(id) { - return request({ - url: 'api/codeDetail/' + id, - method: 'delete' - }) -} - -export function edit(data) { - return request({ - url: 'api/codeDetail', - method: 'put', - data - }) -} - -export default { add, edit, del } diff --git a/acs2/nladmin-ui/src/views/tools/codeGen/codeDetail.vue b/acs2/nladmin-ui/src/views/tools/codeGen/codeDetail.vue deleted file mode 100644 index 7d91755..0000000 --- a/acs2/nladmin-ui/src/views/tools/codeGen/codeDetail.vue +++ /dev/null @@ -1,235 +0,0 @@ - - - - - diff --git a/acs2/nladmin-ui/src/views/tools/codeGen/genCode.js b/acs2/nladmin-ui/src/views/tools/codeGen/genCode.js deleted file mode 100644 index 416f8e9..0000000 --- a/acs2/nladmin-ui/src/views/tools/codeGen/genCode.js +++ /dev/null @@ -1,36 +0,0 @@ -import request from '@/utils/request' - -export function getGenCode() { - return request({ - url: 'api/genCode/all', - method: 'get' - }) -} - -export function add(data) { - return request({ - url: 'api/genCode', - method: 'post', - data - }) -} - -export function del(ids) { - return request({ - url: 'api/genCode/', - method: 'delete', - data: ids - }) -} - -export function edit(data) { - return request({ - url: 'api/genCode/', - method: 'put', - data - }) -} - -export default { - add, del, edit -} diff --git a/acs2/nladmin-ui/src/views/tools/codeGen/index.vue b/acs2/nladmin-ui/src/views/tools/codeGen/index.vue deleted file mode 100644 index 715fac5..0000000 --- a/acs2/nladmin-ui/src/views/tools/codeGen/index.vue +++ /dev/null @@ -1,144 +0,0 @@ - - - - - diff --git a/acs2/nladmin-ui/src/views/tools/storage/index.vue b/acs2/nladmin-ui/src/views/tools/storage/index.vue deleted file mode 100644 index ae210ef..0000000 --- a/acs2/nladmin-ui/src/views/tools/storage/index.vue +++ /dev/null @@ -1,188 +0,0 @@ - - - - - diff --git a/acs2/nladmin-ui/src/views/tools/storage/localStorage.js b/acs2/nladmin-ui/src/views/tools/storage/localStorage.js deleted file mode 100644 index 63ebe2b..0000000 --- a/acs2/nladmin-ui/src/views/tools/storage/localStorage.js +++ /dev/null @@ -1,27 +0,0 @@ -import request from '@/utils/request' - -export function add(data) { - return request({ - url: 'api/localStorage', - method: 'post', - data - }) -} - -export function del(ids) { - return request({ - url: 'api/localStorage/', - method: 'delete', - data: ids - }) -} - -export function edit(data) { - return request({ - url: 'api/localStorage', - method: 'put', - data - }) -} - -export default { add, edit, del } diff --git a/acs2/nladmin-ui/src/views/tools/swagger/index.vue b/acs2/nladmin-ui/src/views/tools/swagger/index.vue deleted file mode 100644 index 5162cd9..0000000 --- a/acs2/nladmin-ui/src/views/tools/swagger/index.vue +++ /dev/null @@ -1,16 +0,0 @@ - -