| | |
| | | import com.ruoyi.business.mapper.PendingInventoryMapper; |
| | | import com.ruoyi.business.mapper.PurchaseRegistrationMapper; |
| | | import com.ruoyi.business.service.PurchaseRegistrationService; |
| | | import com.ruoyi.business.utils.OrderUtils; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | |
| | | .map(CoalInfo::getId) |
| | | .collect(Collectors.toList()); |
| | | |
| | | // 组装查询条件:煤种ID在匹配的列表中 或 供应商名称匹配 |
| | | // 组装查询条件:煤种ID在匹配的列表中 |
| | | queryWrapper.and(w -> { |
| | | if (!matchedCoalIds.isEmpty()) { |
| | | w.in(PurchaseRegistration::getCoalId, matchedCoalIds).or(); |
| | |
| | | } |
| | | purchaseRegistration.setSupplierName(supply.getSupplierName()); |
| | | if (Objects.isNull(purchaseRegistrationDto.getId())) { |
| | | // 生成采购单号 |
| | | String pr = OrderUtils.countTodayByCreateTime(purchaseRegistrationMapper, "PR"); |
| | | purchaseRegistration.setPurchaseNumber(pr); |
| | | // 新增采购登记 |
| | | purchaseRegistration.setRegistrationDate(LocalDate.now()); |
| | | int insertCount = purchaseRegistrationMapper.insert(purchaseRegistration); |
| | |
| | | // 采购登记成功,同步创建待入库记录 |
| | | PendingInventory pendingInventory = createPendingInventory(purchaseRegistration); |
| | | pendingInventory.setSupplierName(supply.getSupplierName()); |
| | | pendingInventory.setPurchaseNumber(pr); |
| | | return pendingInventoryMapper.insert(pendingInventory); |
| | | } |
| | | return insertCount; |
| | |
| | | pendingInventory.setPurchaseId(purchaseRegistration.getId()); |
| | | pendingInventory.setCoalId(purchaseRegistration.getCoalId()); |
| | | pendingInventory.setInventoryQuantity(purchaseRegistration.getPurchaseQuantity()); |
| | | pendingInventory.setType(purchaseRegistration.getType()); |
| | | return pendingInventory; |
| | | } |
| | | |