xuhy
2025-09-03 0838f85fa74b36638adf2621bc2f49a345982dec
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpSupplierWarehousingServiceImpl.java
@@ -3,6 +3,8 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.basic.PageInfo;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.system.dto.WarehousingGoodsDto;
import com.ruoyi.system.dto.WarehousingGoodsNextDto;
import com.ruoyi.system.mapper.*;
import com.ruoyi.system.model.*;
import com.ruoyi.system.query.TErpGoodsQuery;
@@ -182,4 +184,31 @@
        pageInfo.setRecords( list);
        return pageInfo;
    }
    @Override
    public void warehousingGoods(List<WarehousingGoodsDto> dtos, SysUser user) {
        for (WarehousingGoodsDto dto : dtos) {
            TErpSupplierWarehousing tErpSupplierWarehousing = new TErpSupplierWarehousing();
            tErpSupplierWarehousing.setSupplierId(user.getUserId().toString());
            tErpSupplierWarehousing.setWarehouseId(dto.getWarehouseId());
            tErpSupplierWarehousing.setGoodsId(dto.getGoodsId());
            TErpGoods goods = erpGoodsMapper.selectById(dto.getGoodsId());
            tErpSupplierWarehousing.setGoodsName(goods.getGoodsName());
            tErpSupplierWarehousing.setGoodsCount(tErpSupplierWarehousing.getGoodsCount());
            tErpSupplierWarehousing.setUnitAmount(tErpSupplierWarehousing.getUnitAmount());
            tErpSupplierWarehousing.setTotalPrice(tErpSupplierWarehousing.getTotalPrice());
            erpSupplierWarehousingMapper.insert(tErpSupplierWarehousing);
            List<WarehousingGoodsNextDto> warehousingGoodsNextDtos = dto.getWarehousingGoodsNextDtos();
            for (WarehousingGoodsNextDto warehousingGoodsNextDto : warehousingGoodsNextDtos) {
                TErpSupplierWarehousingBatch tErpSupplierWarehousingBatch = new TErpSupplierWarehousingBatch();
                tErpSupplierWarehousingBatch.setWarehousingId(tErpSupplierWarehousing.getId());
                tErpSupplierWarehousingBatch.setWarehousingNumber(warehousingGoodsNextDto.getWarehousingNum());
                tErpSupplierWarehousingBatch.setBatchNumber(warehousingGoodsNextDto.getBatchNumber());
                tErpSupplierWarehousingBatch.setProductionDate(warehousingGoodsNextDto.getProductionDate().atStartOfDay());
                tErpSupplierWarehousingBatch.setExpiryDate(warehousingGoodsNextDto.getExpiryDate().atStartOfDay());
                erpSupplierWarehousingBatchMapper.insert(tErpSupplierWarehousingBatch);
            }
        }
    }
}