1
zhang
4 天以前 4696a0be1e0235e4a9e5077c3f42e038da8c6809
zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java
@@ -132,7 +132,7 @@
        if (!busService.save(bus)) {
            throw new BusinessException("Internal Server Error!");
        }
        Boolean locStaStatusCheck = configService.getVal("LOC_STA_STATUS_CHECK", Boolean.class, false);
        Boolean locStaStatusCheck = configService.getVal("LOC_STA_STATUS_CHECK", Boolean.class, true);
        // 保存任务
@@ -279,7 +279,7 @@
                if (!taskService.updateById(task)) {
                    throw new BusinessException("seqNum: " + task.getSeqNum() + " failed to update");
                }
                report(task, TaskReportStsType.START);
                report(task,null, TaskReportStsType.START);
            }
        } catch (Exception e) {
            log.error("mainService.infuseAgvForTask", e);
@@ -1468,7 +1468,7 @@
                List<Long> taskIds = actionService.selectTaskIdsByGroupId(serialNo);
                for (Long taskId : taskIds) {
                    Task task = taskService.getById(taskId);
                    report(task, TaskReportStsType.END);
                    report(task, agv_11_up.getQrCode(), TaskReportStsType.END);
                }
            }
@@ -1506,7 +1506,7 @@
                List<Long> taskIds = actionService.selectTaskIdsByGroupId(serialNo);
                for (Long taskId : taskIds) {
                    Task task = taskService.getById(taskId);
                    report(task, TaskReportStsType.OTBIN);
                    report(task, agv_11_up.getQrCode(), TaskReportStsType.OTBIN);
                }
            }
@@ -1516,7 +1516,7 @@
                List<Long> taskIds = actionService.selectTaskIdsByGroupId(serialNo);
                for (Long taskId : taskIds) {
                    Task task = taskService.getById(taskId);
                    report(task, TaskReportStsType.OTBIN);
                    report(task, agv_11_up.getQrCode(), TaskReportStsType.OTBIN);
                }
            }
            //往输送线放货完成
@@ -1525,7 +1525,7 @@
                List<Long> taskIds = actionService.selectTaskIdsByGroupId(serialNo);
                for (Long taskId : taskIds) {
                    Task task = taskService.getById(taskId);
                    report(task, TaskReportStsType.END);
                    report(task, agv_11_up.getQrCode(), TaskReportStsType.END);
                }
            }
@@ -1641,12 +1641,21 @@
    /**
     * 上报给上游系统,就是插入一条数据到上报表
     */
    private void report(Task task, TaskReportStsType taskReportStsType) {
    private void report(Task task, String qrCode, TaskReportStsType taskReportStsType) {
        // TODO 插入一条上报记录
        if (task.getBusId() == null) {
            return;
        }
        List<TaskReport> list = taskReportService.list(new LambdaQueryWrapper<TaskReport>().eq(TaskReport::getSeqNum, task.getSeqNum()).eq(TaskReport::getBusNo, task.getBusId$()).eq(TaskReport::getTaskSts, taskReportStsType.status));
        if (!Cools.isEmpty(list)) {
            log.info("TaskReport [{}] 已重复,不再插入 ==========>> ", JSON.toJSONString(task));
            return;
        }
        TaskReport taskReport = new TaskReport();
        taskReport.setAgvId(task.getAgvId());
        taskReport.setBusNo(task.getBusId$());
        taskReport.setCreateTime(new Date());
        taskReport.setQrCode(qrCode);
        taskReport.setReportTimes(0);
        taskReport.setTaskSts(taskReportStsType.status);
        taskReport.setSeqNum(task.getSeqNum());