#
luxiaotao1123
2 天以前 bd4b7199d724280cd6536dc71d4afee263031464
zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java
@@ -104,6 +104,7 @@
    @Transactional
    public Bus generateBusAndTask(OpenBusSubmitParam busSubmitParam, String memo) {
        String errorMsg = busService.checkoutValid(busSubmitParam);
        Boolean maintainLocSts = configService.getVal("maintainLocSts", Boolean.class);
        if (!Cools.isEmpty(errorMsg)) {
            throw new BusinessException(errorMsg);
        }
@@ -147,35 +148,39 @@
            Sta destSta = null;
            switch (TaskTypeType.get(task.getTaskTypeEl())) {
                case LOC_TO_LOC:
                    oriLoc = locService.getById(task.getOriLoc());
                    if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) {
                        throw new BusinessException("oriLoc:" + task.getOriLoc$() + " is not in STOCK status");
                    }
                    oriLoc.setLocSts(LocStsType.PAKOUT.val());
                    oriLoc.setUpdateTime(now);
                    if (!locService.updateById(oriLoc)) {
                        throw new BusinessException("oriLoc:" + task.getOriLoc$() + " failed to update");
                    }
                    if (maintainLocSts) {
                        oriLoc = locService.getById(task.getOriLoc());
                        if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) {
                            throw new BusinessException("oriLoc:" + task.getOriLoc$() + " is not in STOCK status");
                        }
                        oriLoc.setLocSts(LocStsType.PAKOUT.val());
                        oriLoc.setUpdateTime(now);
                        if (!locService.updateById(oriLoc)) {
                            throw new BusinessException("oriLoc:" + task.getOriLoc$() + " failed to update");
                        }
                    destLoc = locService.getById(task.getDestLoc());
                    if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) {
                        throw new BusinessException("destLoc:" + task.getDestLoc$() + " is not in IDLE status");
                    }
                    destLoc.setLocSts(LocStsType.PAKIN.val());
                    destLoc.setUpdateTime(now);
                    if (!locService.updateById(destLoc)) {
                        throw new BusinessException("destLoc:" + task.getDestLoc$() + " failed to update");
                        destLoc = locService.getById(task.getDestLoc());
                        if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) {
                            throw new BusinessException("destLoc:" + task.getDestLoc$() + " is not in IDLE status");
                        }
                        destLoc.setLocSts(LocStsType.PAKIN.val());
                        destLoc.setUpdateTime(now);
                        if (!locService.updateById(destLoc)) {
                            throw new BusinessException("destLoc:" + task.getDestLoc$() + " failed to update");
                        }
                    }
                    break;
                case LOC_TO_STA:
                    oriLoc = locService.getById(task.getOriLoc());
                    if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) {
                        throw new BusinessException("oriLoc:" + task.getOriLoc$() + " is not in STOCK status");
                    }
                    oriLoc.setLocSts(LocStsType.PAKOUT.val());
                    oriLoc.setUpdateTime(now);
                    if (!locService.updateById(oriLoc)) {
                        throw new BusinessException("oriLoc:" + task.getOriLoc$() + " failed to update");
                    if (maintainLocSts) {
                        oriLoc = locService.getById(task.getOriLoc());
                        if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) {
                            throw new BusinessException("oriLoc:" + task.getOriLoc$() + " is not in STOCK status");
                        }
                        oriLoc.setLocSts(LocStsType.PAKOUT.val());
                        oriLoc.setUpdateTime(now);
                        if (!locService.updateById(oriLoc)) {
                            throw new BusinessException("oriLoc:" + task.getOriLoc$() + " failed to update");
                        }
                    }
                    destSta = staService.getById(task.getDestSta());
@@ -189,14 +194,16 @@
                        throw new BusinessException("oriSta:" + task.getOriSta$() + " failed to reserve");
                    }
                    destLoc = locService.getById(task.getDestLoc());
                    if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) {
                        throw new BusinessException("destLoc:" + task.getDestLoc$() + " is not in IDLE status");
                    }
                    destLoc.setLocSts(LocStsType.PAKIN.val());
                    destLoc.setUpdateTime(now);
                    if (!locService.updateById(destLoc)) {
                        throw new BusinessException("destLoc:" + task.getDestLoc$() + " failed to update");
                    if (maintainLocSts) {
                        destLoc = locService.getById(task.getDestLoc());
                        if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) {
                            throw new BusinessException("destLoc:" + task.getDestLoc$() + " is not in IDLE status");
                        }
                        destLoc.setLocSts(LocStsType.PAKIN.val());
                        destLoc.setUpdateTime(now);
                        if (!locService.updateById(destLoc)) {
                            throw new BusinessException("destLoc:" + task.getDestLoc$() + " failed to update");
                        }
                    }
                    break;
                case STA_TO_STA: