zhang
2 天以前 33664d7d7f8478fb961f8fbda44c885fd854bf3d
zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java
@@ -132,6 +132,8 @@
        if (!busService.save(bus)) {
            throw new BusinessException("Internal Server Error!");
        }
        Boolean locStaStatusCheck = configService.getVal("LOC_STA_STATUS_CHECK", Boolean.class, false);
        // 保存任务
        for (Task task : taskList) {
@@ -149,7 +151,7 @@
            switch (TaskTypeType.get(task.getTaskTypeEl())) {
                case LOC_TO_LOC:
                    oriLoc = locService.getById(task.getOriLoc());
                    if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) {
                    if (locStaStatusCheck && !oriLoc.getLocSts().equals(LocStsType.STOCK.val())) {
                        throw new BusinessException("oriLoc:" + task.getOriLoc$() + " is not in STOCK status");
                    }
                    oriLoc.setLocSts(LocStsType.PAKOUT.val());
@@ -159,7 +161,7 @@
                    }
                    destLoc = locService.getById(task.getDestLoc());
                    if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) {
                    if (locStaStatusCheck && !destLoc.getLocSts().equals(LocStsType.IDLE.val())) {
                        throw new BusinessException("destLoc:" + task.getDestLoc$() + " is not in IDLE status");
                    }
                    destLoc.setLocSts(LocStsType.PAKIN.val());
@@ -170,7 +172,7 @@
                    break;
                case LOC_TO_STA:
                    oriLoc = locService.getById(task.getOriLoc());
                    if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) {
                    if (locStaStatusCheck && !oriLoc.getLocSts().equals(LocStsType.STOCK.val())) {
                        throw new BusinessException("oriLoc:" + task.getOriLoc$() + " is not in STOCK status");
                    }
                    oriLoc.setLocSts(LocStsType.PAKOUT.val());
@@ -180,7 +182,7 @@
                    }
                    destSta = staService.getById(task.getDestSta());
                    if (!destSta.getStaSts().equals(StaStsType.IDLE.val())) {
                    if (locStaStatusCheck && !destSta.getStaSts().equals(StaStsType.IDLE.val())) {
                        throw new BusinessException("destSta:" + task.getDestSta$() + " is not in IDLE status");
                    }
                    destSta.setStaSts(StaStsType.READY_RELEASE.val());
@@ -191,7 +193,7 @@
                    break;
                case STA_TO_LOC:
                    oriSta = staService.getById(task.getOriSta());
                    if (!oriSta.getStaSts().equals(StaStsType.STOCK.val())) {
                    if (locStaStatusCheck && !oriSta.getStaSts().equals(StaStsType.STOCK.val())) {
                        throw new BusinessException("oriSta:" + task.getOriSta$() + " is not in STOCK status");
                    }
                    oriSta.setStaSts(StaStsType.READY_TAKE.val());
@@ -201,7 +203,7 @@
                    }
                    destLoc = locService.getById(task.getDestLoc());
                    if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) {
                    if (locStaStatusCheck && !destLoc.getLocSts().equals(LocStsType.IDLE.val())) {
                        throw new BusinessException("destLoc:" + task.getDestLoc$() + " is not in IDLE status");
                    }
                    destLoc.setLocSts(LocStsType.PAKIN.val());
@@ -212,7 +214,7 @@
                    break;
                case STA_TO_STA:
                    oriSta = staService.getById(task.getOriSta());
                    if (!oriSta.getStaSts().equals(StaStsType.STOCK.val())) {
                    if (locStaStatusCheck && !oriSta.getStaSts().equals(StaStsType.STOCK.val())) {
                        throw new BusinessException("oriSta:" + task.getOriSta$() + " is not in STOCK status");
                    }
                    oriSta.setStaSts(StaStsType.READY_TAKE.val());
@@ -222,7 +224,7 @@
                    }
                    destSta = staService.getById(task.getDestSta());
                    if (!destSta.getStaSts().equals(StaStsType.IDLE.val())) {
                    if (locStaStatusCheck && !destSta.getStaSts().equals(StaStsType.IDLE.val())) {
                        throw new BusinessException("destSta:" + task.getDestSta$() + " is not in IDLE status");
                    }
                    destSta.setStaSts(StaStsType.READY_RELEASE.val());
@@ -1641,6 +1643,14 @@
     */
    private void report(Task task, 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$());