gongchunyi
5 天以前 9d5a97dc49873eb0ea812f4213f1e7819c2a1474
src/main/java/com/ruoyi/productionPlan/service/impl/ProductionPlanServiceImpl.java
@@ -230,9 +230,17 @@
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean update(ProductionPlanDto productionPlanDto) {
        if (productionPlanDto == null) {
            throw new ServiceException("编辑失败,数据不能为空");
        }
        ProductionPlan productionPlan = getById(productionPlanDto.getId());
        if (productionPlan == null) {
            throw new ServiceException("编辑失败,主生产计划不存在");
        }
        // 已下发状态,不能编辑
        if (productionPlanDto.getStatus() != 0) {
            throw new BaseException("已下发或部分下发状态,不能编辑");
        if (productionPlan.getStatus() != 0) {
            throw new BaseException("编辑失败,该生产计划已下发或部分下发状态,禁止编辑");
        }
        // 查询是否有关联订单
        boolean hasProductOrderPlan = productOrderPlanMapper.selectList(Wrappers.<ProductOrderPlan>lambdaQuery().eq(ProductOrderPlan::getProductionPlanId, productionPlanDto.getId())).stream().anyMatch(p -> p.getProductOrderId() != null);