rentaiming
2024-07-29 24f7e4c21f6b6375f791b5132d25373255c1d464
ruoyi-modules/ruoyi-management/src/main/java/com/ruoyi/management/service/impl/InventoriesSuppliesInfoServiceImpl.java
@@ -71,18 +71,19 @@
    }
    @Override
    public void addInventoriesSuppliesInfo(InventoriesSuppliesInfoDTO inventoriesSuppliesInfoDTO) {
        if (inventoriesSuppliesInfoDTO.getId()==null){
    public void addInventoriesSuppliesInfo(List<InventoriesSuppliesInfoDTO> inventoriesSuppliesInfoDTO) {
        for (InventoriesSuppliesInfoDTO m:inventoriesSuppliesInfoDTO)
        if (m.getId()==null){
            InventoriesSuppliesInfo inventoriesSuppliesInf=new InventoriesSuppliesInfo();
            inventoriesSuppliesInf.setSuppliesId(inventoriesSuppliesInfoDTO.getSuppliesId());
            inventoriesSuppliesInf.setRkId(inventoriesSuppliesInfoDTO.getRkId());
            SlVolumeProductionRk slVolumeProductionRk = slVolumeProductionRkMapper.selectById(inventoriesSuppliesInfoDTO.getRkId());
            inventoriesSuppliesInf.setSuppliesId(m.getSuppliesId());
            inventoriesSuppliesInf.setRkId(m.getRkId());
            SlVolumeProductionRk slVolumeProductionRk = slVolumeProductionRkMapper.selectById(m.getRkId());
            inventoriesSuppliesInf.setZkNum(slVolumeProductionRk.getRepertoryZhai());
            inventoriesSuppliesInf.setSuppliesNum(inventoriesSuppliesInfoDTO.getSuppliesNum());
            inventoriesSuppliesInf.setSuppliesNum(m.getSuppliesNum());
            this.save(inventoriesSuppliesInf);
        }else{
            InventoriesSuppliesInfo byId = this.getById(inventoriesSuppliesInfoDTO.getId());
            byId.setSuppliesNum(inventoriesSuppliesInfoDTO.getSuppliesNum());
            InventoriesSuppliesInfo byId = this.getById(m.getId());
            byId.setSuppliesNum(m.getSuppliesNum());
            this.updateById(byId);
        }