liding
昨天 4fedbed9949c6160dcfa216d6660bd3c625f7bce
main-business/src/main/java/com/ruoyi/business/service/impl/PurchaseRegistrationServiceImpl.java
@@ -16,6 +16,7 @@
import com.ruoyi.business.mapper.PurchaseRegistrationMapper;
import com.ruoyi.business.service.PurchaseRegistrationService;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@@ -49,6 +50,13 @@
    @Override
    public IPage<PurchaseRegistration> selectPurchaseRegistrationList(Page page, PurchaseRegistrationDto purchaseRegistrationDto) {
        LambdaQueryWrapper<PurchaseRegistration> queryWrapper = new LambdaQueryWrapper<>();
        if (StringUtils.isNotBlank(purchaseRegistrationDto.getSearchAll())){
            queryWrapper.and(wrapper -> wrapper
                    .like(PurchaseRegistration::getCoalId, purchaseRegistrationDto.getSearchAll())
                    .or()
                    .like(PurchaseRegistration::getSupplierName, purchaseRegistrationDto.getSearchAll())
            );
        }
        queryWrapper.orderByDesc(PurchaseRegistration::getCreateTime);
        return purchaseRegistrationMapper.selectPage(page, queryWrapper);
    }
@@ -66,7 +74,7 @@
        if (coalInfo == null) {
            throw new BaseException("煤种信息不存在");
        }
        purchaseRegistration.setCoal(coalInfo.getCoal());
//        purchaseRegistration.setCoal(coalInfo.getCoal());
        Supply supply = supplyMapper.selectById(purchaseRegistrationDto.getSupplierId());
        if (supply == null) {
            throw new BaseException("供应商信息不存在");
@@ -80,7 +88,6 @@
                // 采购登记成功,同步创建待入库记录
                PendingInventory pendingInventory = createPendingInventory(purchaseRegistration);
                pendingInventory.setSupplierName(supply.getSupplierName());
                pendingInventory.setCoal(coalInfo.getCoal());
                return pendingInventoryMapper.insert(pendingInventory);
            }
            return insertCount;
@@ -102,6 +109,7 @@
        BeanUtils.copyProperties(purchaseRegistration, pendingInventory);
        // 设置待入库记录特有的属性(如果有)
        pendingInventory.setCoalId(purchaseRegistration.getCoalId());
        pendingInventory.setInventoryQuantity(purchaseRegistration.getPurchaseQuantity());
        return pendingInventory;
    }