#
vincentlu
2025-12-26 a4a7479ffbee57c642387baeca5783b943bb1af3
zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/StaReserveServiceImpl.java
@@ -98,6 +98,32 @@
        return reserve;
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void confirmStaReserve(Sta sta, Task task, Integer qty, StaReserveType type) {
        qty = Optional.ofNullable(qty).orElse(1);
        // update reserve state to be confirmed
        if (0 == this.baseMapper.updateState(task.getId(), sta.getId(), type.toString(), StaReserveStateType.CONFIRMED.toString())) {
            throw new BusinessException("failed to confirm sta reserve");
        }
        int cntOfDealWithReserve = 0;
        switch (type) {
            case IN:
                cntOfDealWithReserve = staMapper.confirmReserveIn(sta.getId(), qty);
                break;
            case OUT:
                cntOfDealWithReserve = staMapper.confirmReserveOut(sta.getId(), qty);
                break;
            default:
                break;
        }
        if (cntOfDealWithReserve == 0) {
            throw new BusinessException("Sta[" + sta.getStaNo() + "] apply confirmed failed, type=" + type.toString());
        }
    }
    private String generateReserveUniqKey(Long staId, Long taskId, StaReserveType type) {
        return "STA:" + staId + "-TASK:" + taskId + "-T:" + type.toString();