| | |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.other.mapper.TempFileMapper; |
| | | import com.ruoyi.other.pojo.TempFile; |
| | | import com.ruoyi.procurementrecord.mapper.ProcurementRecordMapper; |
| | | import com.ruoyi.procurementrecord.pojo.ProcurementRecordStorage; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import com.ruoyi.purchase.dto.PurchaseLedgerDto; |
| | |
| | | private final QualityTestStandardMapper qualityTestStandardMapper; |
| | | private final QualityInspectParamMapper qualityInspectParamMapper; |
| | | |
| | | private final ProcurementRecordMapper procurementRecordStorageMapper; |
| | | @Value("${file.upload-dir}") |
| | | private String uploadDir; |
| | | |
| | |
| | | handleSalesLedgerProducts(purchaseLedger.getId(), productList, purchaseLedgerDto.getType()); |
| | | } |
| | | //新增原材料检验 |
| | | for (SalesLedgerProduct saleProduct : productList) { |
| | | //是否推送质检,如果true就添加 |
| | | if (saleProduct.getIsChecked()) { |
| | | addQualityInspect(purchaseLedger, saleProduct); |
| | | if (productList != null) { |
| | | for (SalesLedgerProduct saleProduct : productList) { |
| | | //是否推送质检,如果true就添加 |
| | | if (saleProduct.getIsChecked()) { |
| | | addQualityInspect(purchaseLedger, saleProduct); |
| | | } |
| | | } |
| | | } |
| | | // 5. 迁移临时文件到正式目录 |
| | |
| | | QualityInspect qualityInspect = new QualityInspect(); |
| | | qualityInspect.setInspectType(0); |
| | | qualityInspect.setSupplier(purchaseLedger.getSupplierName()); |
| | | qualityInspect.setPurchaseLedgerId(purchaseLedger.getId()); |
| | | qualityInspect.setProductId(saleProduct.getId()); |
| | | qualityInspect.setPurchaseLedgerId(saleProduct.getId()); |
| | | qualityInspect.setProductId(saleProduct.getProductId()); |
| | | qualityInspect.setProductName(saleProduct.getProductCategory()); |
| | | qualityInspect.setModel(saleProduct.getSpecificationModel()); |
| | | qualityInspect.setProductModelId(saleProduct.getProductModelId()); |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int deletePurchaseLedgerByIds(Long[] ids) { |
| | | if (ids == null || ids.length == 0) { |
| | | throw new BaseException("请选中至少一条数据"); |
| | | } |
| | | // 批量删除关联的采购入库记录 |
| | | LambdaQueryWrapper<SalesLedgerProduct> salesLedgerProductQueryWrapper = new LambdaQueryWrapper<>(); |
| | | salesLedgerProductQueryWrapper.in(SalesLedgerProduct::getSalesLedgerId, ids) |
| | | .eq(SalesLedgerProduct::getType, 2); |
| | | List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductMapper.selectList(salesLedgerProductQueryWrapper); |
| | | if (CollectionUtils.isNotEmpty(salesLedgerProducts)) { |
| | | salesLedgerProducts.stream().forEach(salesLedgerProduct -> { |
| | | // 批量删除关联的采购台账产品 |
| | | LambdaQueryWrapper<ProcurementRecordStorage> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(ProcurementRecordStorage::getSalesLedgerProductId, salesLedgerProduct.getId()); |
| | | procurementRecordStorageMapper.delete(queryWrapper); |
| | | }); |
| | | } |
| | | // 批量删除关联的采购台账产品 |
| | | LambdaQueryWrapper<SalesLedgerProduct> queryWrapper = new LambdaQueryWrapper<>(); |
| | |
| | | salesLedgerProductMapper.delete(queryWrapper); |
| | | // 批量删除关联的采购台账的来票登记 |
| | | LambdaQueryWrapper<TicketRegistration> ticketRegistrationLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | ticketRegistrationLambdaQueryWrapper.in(TicketRegistration::getSalesLedgerId,ids); |
| | | ticketRegistrationLambdaQueryWrapper.in(TicketRegistration::getPurchaseLedgerId,ids); |
| | | ticketRegistrationMapper.delete(ticketRegistrationLambdaQueryWrapper); |
| | | // 批量删除关联的采购台账的来票登记记录 |
| | | LambdaQueryWrapper<ProductRecord> productRecordLambdaQueryWrapper = new LambdaQueryWrapper<>(); |