gongchunyi
11 小时以前 efaa975ca9a7fe133744e353e4eb321f11470fd2
src/main/java/com/ruoyi/productionPlan/service/impl/ProductionPlanServiceImpl.java
@@ -14,8 +14,10 @@
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.config.AliDingConfig;
import com.ruoyi.framework.util.AliDingUtils;
import com.ruoyi.production.enums.ProductOrderStatusEnum;
import com.ruoyi.production.pojo.ProductMaterialSku;
import com.ruoyi.production.pojo.ProductOrder;
import com.ruoyi.production.service.IProductionOrderAppendixService;
import com.ruoyi.production.service.ProductMaterialService;
import com.ruoyi.production.service.ProductMaterialSkuService;
import com.ruoyi.production.service.ProductOrderService;
@@ -75,6 +77,9 @@
    @Autowired
    private ProductMaterialService productMaterialService;
    @Autowired
    private IProductionOrderAppendixService productionOrderAppendixService;
    /**
     * 同步锁,确保手动和定时任务不同时执行
@@ -141,7 +146,20 @@
        ProductOrder productOrder = new ProductOrder();
        productOrder.setQuantity(productionPlanDto.getTotalAssignedQuantity());
        productOrder.setPlanCompleteTime(productionPlanDto.getPlanCompleteTime());
        productOrderService.addProductOrder(productOrder);
        productOrder.setStatus(ProductOrderStatusEnum.WAIT.getCode());
        productOrder.setStrength(productionPlanDto.getStrength());
        Long orderId = productOrderService.insertProductOrder(productOrder);
        //  当下发的产品为砌块或板材,就拉取BOM子集与工艺路线子集数据存入到附表中
        if ("砌块".equals(productionPlanDto.getProductName())) {
            productOrder.setRouteId(productionOrderAppendixService.populateBlocks(orderId, productionPlanDto));
        }
        if ("板材".equals(productionPlanDto.getProductName())) {
            productOrder.setRouteId(productionOrderAppendixService.populatePlates(orderId, productionPlanDto));
        }
        //  更新绑定的工艺路线
        productOrderService.updateById(productOrder);
        // 根据下发数量,从第一个生产计划开始分配方数
        BigDecimal assignedVolume = BigDecimal.ZERO;