| | |
| | | import com.ruoyi.sales.pojo.InvoiceRegistrationProduct; |
| | | import com.ruoyi.sales.pojo.SalesLedger; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.sales.service.impl.CommonFileServiceImpl; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.io.FilenameUtils; |
| | |
| | | |
| | | private final StringRedisTemplate redisTemplate; |
| | | private final QualityInspectMapper qualityInspectMapper; |
| | | private final CommonFileServiceImpl commonFileService; |
| | | private final QualityTestStandardBindingMapper qualityTestStandardBindingMapper; |
| | | private final QualityTestStandardParamMapper qualityTestStandardParamMapper; |
| | | private final QualityTestStandardMapper qualityTestStandardMapper; |
| | |
| | | purchaseLedger.setRecorderId(purchaseLedgerDto.getRecorderId()); |
| | | purchaseLedger.setRecorderName(sysUser.getNickName()); |
| | | purchaseLedger.setPhoneNumber(sysUser.getPhonenumber()); |
| | | purchaseLedger.setApprovalStatus(1); |
| | | // 3. 新增或更新主表 |
| | | if (purchaseLedger.getId() == null) { |
| | | purchaseLedgerMapper.insert(purchaseLedger); |
| | |
| | | } |
| | | //批量删除原材料检验数据 |
| | | qualityInspectMapper.delete(materialInspectLambdaQueryWrapper); |
| | | //删除附件 |
| | | commonFileService.deleteByBusinessIds(Arrays.asList(ids), 2); |
| | | // 批量删除采购台账 |
| | | return purchaseLedgerMapper.deleteBatchIds(Arrays.asList(ids)); |
| | | } |
| | |
| | | List<SysUser> sysUsers = sysUserMapper.selectList(new LambdaQueryWrapper<SysUser>().in(SysUser::getNickName, |
| | | salesLedgerImportDtoList.stream().map(PurchaseLedgerImportDto::getRecorderName).collect(Collectors.toList()))); |
| | | for (PurchaseLedgerImportDto salesLedgerImportDto : salesLedgerImportDtoList) { |
| | | PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectOne(new LambdaQueryWrapper<PurchaseLedger>() |
| | | .eq(PurchaseLedger::getPurchaseContractNumber, salesLedgerImportDto.getPurchaseContractNumber()) |
| | | .last("limit 1")); |
| | | if(purchaseLedger != null){ |
| | | continue; |
| | | } |
| | | PurchaseLedger salesLedger = new PurchaseLedger(); |
| | | BeanUtils.copyProperties(salesLedgerImportDto, salesLedger); |
| | | // 通过供应商名称查询ID |
| | |
| | | return AjaxResult.success("导入失败"); |
| | | } |
| | | |
| | | @Override |
| | | public PurchaseLedgerDto getPurchaseByCode(PurchaseLedgerDto purchaseLedgerDto) { |
| | | // 1. 查询主表 |
| | | PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectOne(new LambdaQueryWrapper<PurchaseLedger>() |
| | | .eq(PurchaseLedger::getPurchaseContractNumber, purchaseLedgerDto.getPurchaseContractNumber()) |
| | | .last("LIMIT 1")); |
| | | if (purchaseLedger == null) { |
| | | throw new BaseException("采购台账不存在"); |
| | | } |
| | | |
| | | // 2. 查询子表 |
| | | LambdaQueryWrapper<SalesLedgerProduct> productWrapper = new LambdaQueryWrapper<>(); |
| | | productWrapper.eq(SalesLedgerProduct::getSalesLedgerId, purchaseLedger.getId()) |
| | | .eq(SalesLedgerProduct::getType, 2); |
| | | List<SalesLedgerProduct> products = salesLedgerProductMapper.selectList(productWrapper); |
| | | |
| | | // 4. 转换 DTO |
| | | PurchaseLedgerDto resultDto = new PurchaseLedgerDto(); |
| | | BeanUtils.copyProperties(purchaseLedger, resultDto); |
| | | if (!products.isEmpty()) { |
| | | resultDto.setHasChildren(true); |
| | | resultDto.setProductData(products); |
| | | } |
| | | return resultDto; |
| | | } |
| | | |
| | | public void addApproveByPurchase(LoginUser loginUser,PurchaseLedger purchaseLedger) throws Exception { |
| | | ApproveProcessVO approveProcessVO = new ApproveProcessVO(); |
| | | approveProcessVO.setApproveType(5); |