1
zhang
1 天以前 02e3fbfc96e08c9285daaa5a6ec53716c747a671
1
4个文件已修改
135 ■■■■ 已修改文件
zy-acs-manager/src/main/java/com/zy/acs/manager/common/domain/PageParam.java 102 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/ValidService.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-manager/src/main/java/com/zy/acs/manager/core/third/ReportThirdScheduler.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/OpenController.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-manager/src/main/java/com/zy/acs/manager/common/domain/PageParam.java
@@ -24,6 +24,11 @@
    private static final long serialVersionUID = 1L;
    public static final String ORDER_DESC_VALUE = "desc";
    public static final Integer DEFAULT_PAGESIZE = 100;
    public static final Integer DEFAULT_CURRENT = 1;
    private final U where;
    /**
@@ -45,6 +50,7 @@
        this(where, true, cls);
    }
    public PageParam(U where, boolean isToUnderlineCase) {
        this(where, isToUnderlineCase, null);
    }
@@ -65,6 +71,11 @@
    }
    public QueryWrapper<T> buildWrapperExcludeNull(boolean like) {
        return this.buildWrapperExcludeNull(like, null, "create_time");
    }
    public QueryWrapper<T> buildWrapper(boolean like) {
        return this.buildWrapper(like, null, "create_time");
    }
@@ -162,6 +173,97 @@
        return queryWrapper;
    }
    @SuppressWarnings("all")
    public QueryWrapper<T> buildWrapperExcludeNull(boolean like, Consumer<QueryWrapper<T>> consumer, String timeField) {
        QueryWrapper<T> queryWrapper = new QueryWrapper<>();
        Map<String, Object> map = where.getMap();
        for (String key : map.keySet()) {
            Object val = map.get(key);
            if (val == null) {
                continue;
            }
            if (key.contains("Range")) {
                ArrayList<String> list = null;
                if (val instanceof ArrayList) {
                    list = (ArrayList<String>) val;
                }
                if (null != list) {
                    key = key.replaceAll("Range", "");
                    if (this.isToUnderlineCase) {
                        key = Utils.toSymbolCase(key, '_');
                    }
                    queryWrapper.ge(key, DateUtils.convert(list.get(0)));
                    queryWrapper.le(key, DateUtils.convert(list.get(1)));
                }
            } else {
                if (this.isToUnderlineCase) {
                    key = Utils.toSymbolCase(key, '_');
                }
                if (like) {
                    queryWrapper.like(key, val);
                } else {
                    queryWrapper.eq(key, val);
                }
            }
        }
        if (null != consumer) {
            consumer.accept(queryWrapper);
        }
        if (!Cools.isEmpty(where.getTimeStart())) {
            Date timeStart = DateUtils.convert(String.valueOf(where.getTimeStart()), DateUtils.yyyyMMdd_F);
            queryWrapper.ge(timeField, timeStart);
        }
        if (!Cools.isEmpty(where.getTimeEnd())) {
            Date timeStart = DateUtils.convert(String.valueOf(where.getTimeEnd()), DateUtils.yyyyMMdd_F);
            queryWrapper.le(timeField, timeStart);
        }
        if (!Cools.isEmpty(where.getOrderBy())) {
            if (sortIsSQL(where.getOrderBy())) {
                setOrders(parseOrderSQL(where.getOrderBy()));
            }
        } else {
//            queryWrapper.orderByDesc("create_time");
        }
        if (!Cools.isEmpty(where.getCondition()) && !Cools.isEmpty(cls)) {
            List<String> columns = new ArrayList<>();
            for (Field field : Cools.getAllFields(cls)) {
                if (Modifier.isFinal(field.getModifiers())
                        || Modifier.isStatic(field.getModifiers())
                        || Modifier.isTransient(field.getModifiers())) {
                    continue;
                }
                if (field.isAnnotationPresent(TableField.class)) {
                    TableField annotation = field.getAnnotation(TableField.class);
                    if (!annotation.exist()) {
                        continue;
                    }
                }
                String column = Utils.toSymbolCase(field.getName(), '_');
                columns.add(column);
            }
            if (!columns.isEmpty()) {
                for (int i = 0; i < columns.size(); i++) {
                    String column = columns.get(i);
                    String condition = where.getCondition();
                    if (i == 0) {
                        queryWrapper.and(wrapper -> wrapper.like(column, condition));
                    } else {
                        queryWrapper.or().like(column, condition);
                    }
                }
            }
        }
        return queryWrapper;
    }
    private boolean sortIsSQL(String sort) {
        return sort != null && (sort.contains(",") || sort.trim().contains(" "));
    }
zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/ValidService.java
@@ -49,6 +49,7 @@
            task.setSeqNum(taskDto.getSeqNum());
            task.setPriority(taskDto.getPriority());
            // ori --------------------------
            if (!Cools.isEmpty(taskDto.getOriLoc())) {
                Loc oriLoc = locService.selecatByLocNo(taskDto.getOriLoc());
@@ -98,6 +99,9 @@
            if (null != task.getDestLoc() && null != task.getDestSta()) {
                throw new BusinessException("seNum:" + task.getSeqNum() + " is wrong,either destLoc and destSta must be present");
            }
            if (!Cools.isEmpty(taskDto.getTaskType())) {
                task.setTaskType(TaskTypeType.valueOf(taskDto.getTaskType()).val());
            } else {
            if (null != task.getOriSta()) {
                if (null != task.getDestLoc()) {
                    task.setTaskType(TaskTypeType.STA_TO_LOC.val());
@@ -115,13 +119,16 @@
                }
            }
        }
        }
        // 校验路径合理性
        for (Task task : taskList) {
            Code startCode = null;
            Code endCode = null;
            Loc oriLoc = null; Loc destLoc = null;
            Sta oriSta = null; Sta destSta = null;
            Loc oriLoc = null;
            Loc destLoc = null;
            Sta oriSta = null;
            Sta destSta = null;
            List<String> pathList = null;
            switch (Objects.requireNonNull(TaskTypeType.get(task.getTaskTypeEl()))) {
                case LOC_TO_LOC:
zy-acs-manager/src/main/java/com/zy/acs/manager/core/third/ReportThirdScheduler.java
@@ -46,8 +46,9 @@
            String wmsPath = configService.getVal("WMS_PATH", String.class);
            List<TaskReport> list = taskReportService.list(new LambdaQueryWrapper<TaskReport>().eq(TaskReport::getCompleted, 0).le(TaskReport::getReportTimes, 3));
            for (TaskReport taskReport : list) {
                log.info("开始上报:{}", taskReport);
                if (report(new TaskEvent(taskReport.getSeqNum(), taskReport.getEventType(), taskReport.getAgvId() + ""), wmsUrl, wmsPath)) {
                TaskEvent taskEvent = new TaskEvent(taskReport.getSeqNum(), taskReport.getEventType(), taskReport.getAgvId() + "");
                log.info("开始上报:{}", taskEvent);
                if (report(taskEvent, wmsUrl, wmsPath)) {
                    taskReport.setReportTimes((Cools.isEmpty(taskReport.getReportTimes()) ? 0 : taskReport.getReportTimes()) + 1);
                    taskReport.setUpdateTime(new Date());
                    taskReport.setCompleted(1);
zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/OpenController.java
@@ -58,10 +58,13 @@
    @OperationLog("generate task from open api")
    public R save(@RequestBody OpenBusSubmitParam param) {
        if (!configService.getVal("TaskAssignMode", Boolean.class)) {
            if (configService.getVal("InAndOutMode", Boolean.class, false)) {
            for (TaskDto taskDto : param.getTaskList()) {
                if (Cools.isEmpty(taskDto.getSeqNum())) {
                    return R.error("缺失任务号");
                }
            }
                mainService.generateBusAndTask(param, null);
                return R.ok("generate tasks success");
            }
        }
        return R.error("generate tasks error");
    }
@@ -101,16 +104,10 @@
    @PostMapping("/loc/sync")
    @OperationLog("sync loc")
    public R loc(@RequestBody(required = false) Map<String, Object> map) {
        if (map.get("current") == null) {
            map.put("current", 1);
        }
        if (map.get("pageSize") == null) {
            map.put("pageSize", 100);
        }
    public R loc(@RequestBody Map<String, Object> map) {
        BaseParam baseParam = buildParam(map, BaseParam.class);
        PageParam<Loc, BaseParam> pageParam = new PageParam<>(baseParam, Loc.class);
        return R.ok().add(locService.page(pageParam, pageParam.buildWrapper(true)));
        return R.ok().add(locService.page(pageParam, pageParam.buildWrapperExcludeNull(true)));
    }