refactor(core): 删除销售台账及相关代码中与发票和待付款金额关联的逻辑
| | |
| | | @Excel(name = "单位") |
| | | private String unit; |
| | | |
| | | /** |
| | | * 生产炒机 |
| | | */ |
| | | @Excel(name = "生产炒机") |
| | | private String speculativeTradingName; |
| | | |
| | | @Schema(description = "租户ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | |
| | | salesLedgers.stream().map(SalesLedger::getId).collect(Collectors.toList())); |
| | | List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductMapper |
| | | .selectList(salesLedgerProductMapperLambdaQueryWrapper); |
| | | // 未开票金额 |
| | | BigDecimal noInvoiceAmountTotal = salesLedgerProducts.stream().map(SalesLedgerProduct::getNoInvoiceAmount) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | homeBusinessDto.setMonthSaleMoney(contractAmount.setScale(2, RoundingMode.HALF_UP).toString()); |
| | | homeBusinessDto.setMonthSaleHaveMoney(noInvoiceAmountTotal.setScale(2, RoundingMode.HALF_UP).toString()); |
| | | homeBusinessDto.setMonthSaleHaveMoney(BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP).toString()); |
| | | } |
| | | // 创建LambdaQueryWrapper |
| | | LambdaQueryWrapper<PurchaseLedger> queryWrapper = new LambdaQueryWrapper<>(); |
| | |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | // 待付款总金额 |
| | | BigDecimal unReceiptPaymentAmount = salesLedgerProductsCopy.stream() |
| | | .map(SalesLedgerProduct::getPendingTicketsTotal) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | homeBusinessDto.setMonthPurchaseMoney(receiveAmount.setScale(2, RoundingMode.HALF_UP).toString()); |
| | | homeBusinessDto.setMonthPurchaseHaveMoney(unReceiptPaymentAmount.setScale(2, RoundingMode.HALF_UP).toString()); |
| | | homeBusinessDto.setMonthPurchaseHaveMoney(BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP).toString()); |
| | | } |
| | | // 统计库存 |
| | | BigDecimal stockQuantityTotal = stockInventoryMapper.selectTotal(); |
| | |
| | | return dto; |
| | | } |
| | | |
| | | BigDecimal collected = products.stream() |
| | | .map(SalesLedgerProduct::getInvoiceTotal) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | dto.setMonthlyIncome(collected); |
| | | |
| | | BigDecimal overdue = products.stream() |
| | | .map(SalesLedgerProduct::getPendingInvoiceTotal) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | dto.setOverdueNum(overdue); |
| | | |
| | | BigDecimal total = collected.add(overdue); |
| | | |
| | | if (total.compareTo(BigDecimal.ZERO) > 0) { |
| | | String collectionRate = collected.divide(total, 4, RoundingMode.HALF_UP) |
| | | .multiply(new BigDecimal("100")) |
| | | .setScale(2, RoundingMode.HALF_UP) |
| | | .toString(); |
| | | dto.setCollectionRate(collectionRate); |
| | | |
| | | String overdueRate = overdue.divide(total, 4, RoundingMode.HALF_UP) |
| | | .multiply(new BigDecimal("100")) |
| | | .setScale(2, RoundingMode.HALF_UP) |
| | | .toString(); |
| | | dto.setOverdueRate(overdueRate); |
| | | } |
| | | |
| | | return dto; |
| | | } |
| | | |
| | |
| | | if (p.getTaxInclusiveTotalPrice() != null) { |
| | | rawMaterialCost = rawMaterialCost.add(p.getTaxInclusiveTotalPrice()); |
| | | } |
| | | |
| | | if (p.getTicketsTotal() != null) { |
| | | paidAmount = paidAmount.add(p.getTicketsTotal()); |
| | | } |
| | | |
| | | if (p.getPendingTicketsTotal() != null) { |
| | | pendingAmount = pendingAmount.add(p.getPendingTicketsTotal()); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | List<SalesLedgerProduct> salesProducts = salesLedgerProductMapper.selectList(salesWrapper); |
| | | |
| | | BigDecimal revenue = BigDecimal.ZERO; |
| | | if (!CollectionUtils.isEmpty(salesProducts)) { |
| | | for (SalesLedgerProduct s : salesProducts) { |
| | | if (s.getInvoiceAmount() != null) { |
| | | revenue = revenue.add(s.getInvoiceAmount()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 毛利润 & 利润率 |
| | | if (revenue.compareTo(BigDecimal.ZERO) > 0) { |
| | |
| | | private BigDecimal invoiceAmount; |
| | | |
| | | /** |
| | | * 来票登记id |
| | | */ |
| | | private Long ticketRegistrationId; |
| | | |
| | | /** |
| | | * 合同金额(产品含税总价) |
| | | */ |
| | | @Excel(name = "合同金额") |
| | | private BigDecimal contractAmount = BigDecimal.ZERO; |
| | | |
| | | |
| | | @TableField(exist = false) |
| | | @Schema(description = "来票金额") |
| | | @Excel(name = "已来票金额(元)") |
| | | private BigDecimal receiptPaymentAmount = BigDecimal.ZERO; |
| | | |
| | | @Schema(description = "未来票金额") |
| | | @TableField(exist = false) |
| | | @Excel(name = "未来票金额(元)") |
| | | private BigDecimal unReceiptPaymentAmount =BigDecimal.ZERO; |
| | | |
| | | @Schema(description = "文件类型 取 4") |
| | | @TableField(exist = false) |
| | |
| | | |
| | | LocalDateTime localDateTime = entryDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); |
| | | salesLedgerProduct.setRegisterDate(localDateTime); |
| | | salesLedgerProduct.setFutureTickets(salesLedgerProduct.getQuantity()); |
| | | salesLedgerProduct.setFutureTicketsAmount(salesLedgerProduct.getTaxInclusiveTotalPrice()); |
| | | salesLedgerProduct.setPendingTicketsTotal(salesLedgerProduct.getTaxInclusiveTotalPrice()); |
| | | salesLedgerProductMapper.insert(salesLedgerProduct); |
| | | } |
| | | } |
| | |
| | | queryWrapper.eq(SalesLedgerProduct::getSalesLedgerId, purchaseLedger.getId()) |
| | | .eq(SalesLedgerProduct::getType, 2); |
| | | List<SalesLedgerProduct> productList = salesLedgerProductMapper.selectList(queryWrapper); |
| | | productList.forEach(product -> { |
| | | product.setFutureTickets(product.getFutureTickets() != null ? product.getFutureTickets() : product.getQuantity()); |
| | | product.setFutureTicketsAmount(product.getFutureTicketsAmount() != null ? product.getFutureTicketsAmount() : product.getTaxInclusiveTotalPrice()); |
| | | product.setTicketsNum(null); |
| | | product.setTicketsAmount(null); |
| | | product.setTempFutureTickets(product.getFutureTickets()); |
| | | product.setTempFutureTicketsAmount(product.getFutureTicketsAmount()); |
| | | }); |
| | | resultDto.setProductData(productList); |
| | | return resultDto; |
| | | } |
| | |
| | | PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectById(id); |
| | | |
| | | BeanUtils.copyProperties(purchaseLedger, purchaseLedgerDto); |
| | | // TicketRegistration ticketRegistration = ticketRegistrationMapper.selectOne(new LambdaQueryWrapper<TicketRegistration>().eq(TicketRegistration::getPurchaseLedgerId, id)); |
| | | // if (ticketRegistration != null) { |
| | | // purchaseLedgerDto.setInvoiceNumber(ticketRegistration.getInvoiceNumber()); |
| | | // purchaseLedgerDto.setInvoiceAmount(ticketRegistration.getInvoiceAmount()); |
| | | // purchaseLedgerDto.setTicketRegistrationId(ticketRegistration.getId()); |
| | | // } |
| | | return purchaseLedgerDto; |
| | | } |
| | | |
| | |
| | | salesLedgerProduct.setType(2); |
| | | // 计算不含税总价 |
| | | salesLedgerProduct.setTaxExclusiveTotalPrice(salesLedgerProduct.getTaxInclusiveTotalPrice().divide(new BigDecimal(1).add(salesLedgerProduct.getTaxRate().divide(new BigDecimal(100))), 2, RoundingMode.HALF_UP)); |
| | | salesLedgerProduct.setFutureTickets(salesLedgerProduct.getQuantity()); |
| | | salesLedgerProduct.setFutureTicketsAmount(salesLedgerProduct.getTaxExclusiveTotalPrice()); |
| | | list.stream() |
| | | .filter(map -> map.get("productName").equals(salesLedgerProduct.getProductCategory()) && map.get("model").equals(salesLedgerProduct.getSpecificationModel())) |
| | | .findFirst() |
| | |
| | | salesLedgerProduct.setRegister(loginUser.getNickName()); |
| | | salesLedgerProduct.setRegisterDate(LocalDateTime.now()); |
| | | salesLedgerProduct.setApproveStatus(0); |
| | | salesLedgerProduct.setPendingTicketsTotal(salesLedgerProductImportDto.getTaxInclusiveTotalPrice()); |
| | | // 是否质检判断 |
| | | salesLedgerProduct.setIsChecked(salesLedgerProductImportDto.getIsChecked() == 1); |
| | | if(salesLedgerProductImportDto.getIsChecked() == 1){ |
| | |
| | | package com.ruoyi.sales.controller; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | | import com.ruoyi.purchase.dto.SimpleReturnOrderGroupDto; |
| | | import com.ruoyi.purchase.mapper.PurchaseReturnOrderProductsMapper; |
| | | import com.ruoyi.sales.dto.SalesLedgerProductDto; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.sales.service.ISalesLedgerProductService; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | |
| | | |
| | | |
| | | /** |
| | | * 回款登记分页查询 |
| | | */ |
| | | @GetMapping("/listPageSalesLedger") |
| | | public AjaxResult listPage(Page page, SalesLedgerProductDto salesLedgerProduct) { |
| | | IPage<SalesLedgerProductDto> list = salesLedgerProductService.listPage(page,salesLedgerProduct); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 付款登记分页查询 |
| | | */ |
| | | @GetMapping("/listPagePurchaseLedger") |
| | | public AjaxResult listPagePurchaseLedger(Page page, SalesLedgerProductDto salesLedgerProduct) { |
| | | IPage<SalesLedgerProductDto> list = salesLedgerProductService.listPagePurchaseLedger(page,salesLedgerProduct); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询产品信息列表 |
| | | */ |
| | | @GetMapping("/list") |
| | |
| | | Map<Long, BigDecimal> returnOrderGroupDtoMap = groupListByProductIds.stream().collect(Collectors.toMap(SimpleReturnOrderGroupDto::getProductModelId, item -> item.getSumReturnQuantity())); |
| | | |
| | | list.forEach(item -> { |
| | | if (item.getFutureTickets().compareTo(BigDecimal.ZERO) == 0) { |
| | | item.setFutureTickets(BigDecimal.ZERO); |
| | | } |
| | | if (item.getFutureTicketsAmount().compareTo(BigDecimal.ZERO) == 0) { |
| | | item.setFutureTicketsAmount(BigDecimal.ZERO); |
| | | } |
| | | if (item.getApproveStatus() != 2) { |
| | | if (item.getHasSufficientStock() == 0) { |
| | | item.setApproveStatus(0); |
| | |
| | | import com.ruoyi.common.config.MyBaseMapper; |
| | | import com.ruoyi.purchase.dto.ProcurementBusinessSummaryDto; |
| | | import com.ruoyi.sales.dto.LossProductModelDto; |
| | | import com.ruoyi.sales.dto.SalesLedgerProductDto; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | List<SalesLedgerProduct> selectSalesLedgerProductList(@Param("salesLedgerProduct") SalesLedgerProduct salesLedgerProduct); |
| | | |
| | | SalesLedgerProduct selectSalesLedgerProductByMainId(@Param("productMainId") Long productMainId); |
| | | |
| | | IPage<SalesLedgerProductDto> listPage(Page page, @Param("req") SalesLedgerProductDto salesLedgerProduct); |
| | | |
| | | IPage<SalesLedgerProductDto> listPagePurchaseLedger(Page page, @Param("req") SalesLedgerProductDto salesLedgerProduct); |
| | | |
| | | IPage<ProcurementBusinessSummaryDto> procurementBusinessSummaryListPage(Page page, @Param("req") ProcurementBusinessSummaryDto procurementBusinessSummaryDto); |
| | | |
| | |
| | | private String unit; |
| | | |
| | | /** |
| | | * 生产炒机 |
| | | */ |
| | | @Excel(name = "生产炒机") |
| | | private String speculativeTradingName; |
| | | |
| | | /** |
| | | * 数量 |
| | | */ |
| | | @Excel(name = "数量") |
| | |
| | | private Integer type; |
| | | |
| | | /** |
| | | * 本次来票数 |
| | | */ |
| | | private BigDecimal ticketsNum=BigDecimal.ZERO; |
| | | |
| | | /** |
| | | * 本次来票金额(元) |
| | | */ |
| | | private BigDecimal ticketsAmount=BigDecimal.ZERO; |
| | | |
| | | /** |
| | | * 未来票数 |
| | | */ |
| | | private BigDecimal futureTickets=BigDecimal.ZERO; |
| | | |
| | | /** |
| | | * 未来票金额(元) |
| | | */ |
| | | private BigDecimal futureTicketsAmount=BigDecimal.ZERO; |
| | | |
| | | @Schema(description = "开票数") |
| | | private BigDecimal invoiceNum = BigDecimal.ZERO; |
| | | |
| | | @Schema(description = "未开票数") |
| | | private BigDecimal noInvoiceNum = BigDecimal.ZERO; |
| | | |
| | | @Schema(description = "开票金额") |
| | | private BigDecimal invoiceAmount = BigDecimal.ZERO; |
| | | |
| | | @Schema(description = "未开票金额") |
| | | private BigDecimal noInvoiceAmount = BigDecimal.ZERO; |
| | | |
| | | @Schema(description = "本次开票数") |
| | | @TableField(exist = false) |
| | | private BigDecimal currentInvoiceNum; |
| | | |
| | | @TableField(exist = false) |
| | | @Schema(description = "本次开票金额") |
| | | private BigDecimal currentInvoiceAmount; |
| | | |
| | | /** |
| | | * 产品id |
| | | */ |
| | | private Long productId; |
| | |
| | | * 产品规格id |
| | | */ |
| | | private Long productModelId; |
| | | |
| | | @Schema(description = "初始未开票数") |
| | | @TableField(exist = false) |
| | | private BigDecimal originalNoInvoiceNum; |
| | | |
| | | @Schema(description = "临时未开票数") |
| | | @TableField(exist = false) |
| | | private BigDecimal tempNoInvoiceNum; |
| | | |
| | | @Schema(description = "临时未开票金额") |
| | | @TableField(exist = false) |
| | | private BigDecimal tempnoInvoiceAmount; |
| | | |
| | | @Schema(description = "临时未来票数") |
| | | @TableField(exist = false) |
| | | private BigDecimal tempFutureTickets; |
| | | |
| | | @Schema(description = "临时未来票金额") |
| | | @TableField(exist = false) |
| | | private BigDecimal tempFutureTicketsAmount; |
| | | |
| | | @Schema(description = "登记人") |
| | | private String register; |
| | |
| | | // @TableField(exist = false) |
| | | @Schema(description = "产品状态:1-充足") |
| | | private Integer approveStatus; |
| | | |
| | | @Schema(description = "待回款总金额") |
| | | private BigDecimal pendingInvoiceTotal; |
| | | |
| | | @Schema(description = "回款总金额") |
| | | private BigDecimal invoiceTotal = BigDecimal.ZERO; |
| | | |
| | | @Schema(description = "待付款总金额") |
| | | private BigDecimal pendingTicketsTotal; |
| | | |
| | | @Schema(description = "付款总金额") |
| | | private BigDecimal ticketsTotal = BigDecimal.ZERO; |
| | | |
| | | @Schema(description = "是否质检") |
| | | //针对采购台账,是否质检 |
| | |
| | | package com.ruoyi.sales.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.sales.dto.SalesLedgerProductDto; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | |
| | | import java.util.List; |
| | |
| | | int deleteSalesLedgerProductByIds(Long[] ids); |
| | | |
| | | int addOrUpdateSalesLedgerProduct(SalesLedgerProduct salesLedgerProduct); |
| | | |
| | | IPage<SalesLedgerProductDto> listPage(Page page, SalesLedgerProductDto salesLedgerProduct); |
| | | |
| | | IPage<SalesLedgerProductDto> listPagePurchaseLedger(Page page, SalesLedgerProductDto salesLedgerProduct); |
| | | |
| | | R judgmentInventory(SalesLedgerProduct salesLedgerProduct); |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | |
| | | import com.ruoyi.purchase.mapper.PurchaseLedgerMapper; |
| | | import com.ruoyi.purchase.pojo.PurchaseLedger; |
| | | import com.ruoyi.quality.mapper.QualityInspectMapper; |
| | | import com.ruoyi.sales.dto.SalesLedgerProductDto; |
| | | import com.ruoyi.sales.mapper.SalesLedgerMapper; |
| | | import com.ruoyi.sales.mapper.SalesLedgerProductMapper; |
| | | import com.ruoyi.sales.mapper.ShippingInfoMapper; |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int addOrUpdateSalesLedgerProduct(SalesLedgerProduct salesLedgerProduct) { |
| | | // 待回款,付款 |
| | | if(salesLedgerProduct.getType().equals(1)){ |
| | | salesLedgerProduct.setPendingInvoiceTotal(salesLedgerProduct.getTaxInclusiveTotalPrice().subtract(salesLedgerProduct.getInvoiceTotal())); |
| | | //未开票数量+金额 |
| | | salesLedgerProduct.setNoInvoiceNum(salesLedgerProduct.getQuantity()); |
| | | salesLedgerProduct.setNoInvoiceAmount(salesLedgerProduct.getTaxInclusiveTotalPrice()); |
| | | }else{ |
| | | salesLedgerProduct.setPendingTicketsTotal(salesLedgerProduct.getTaxInclusiveTotalPrice().subtract(salesLedgerProduct.getTicketsTotal())); |
| | | // 未来票数量+金额 |
| | | salesLedgerProduct.setFutureTickets(salesLedgerProduct.getQuantity()); |
| | | salesLedgerProduct.setFutureTicketsAmount(salesLedgerProduct.getTaxInclusiveTotalPrice()); |
| | | } |
| | | |
| | | int result; |
| | | Long salesLedgerId = salesLedgerProduct.getSalesLedgerId(); |
| | |
| | | addProductionData(salesLedgerProduct); |
| | | } else { |
| | | //查询原本的产品型号id |
| | | salesLedgerProduct.setFutureTickets(salesLedgerProduct.getQuantity()); |
| | | result = salesLedgerProductMapper.updateById(salesLedgerProduct); |
| | | /*删除对应的生产数据并重新新增*/ |
| | | deleteProductionData(Arrays.asList(salesLedgerProduct.getId())); |
| | |
| | | } |
| | | List<Long> ids = productionPlans.stream().map(ProductionPlan::getId).collect(Collectors.toList()); |
| | | productionPlanMapper.deleteByIds(ids); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<SalesLedgerProductDto> listPage(Page page, SalesLedgerProductDto salesLedgerProduct) { |
| | | IPage<SalesLedgerProductDto> salesLedgerProductDtoIPage = salesLedgerProductMapper.listPage(page, salesLedgerProduct); |
| | | salesLedgerProductDtoIPage.getRecords().forEach(item -> { |
| | | // 判断状态 |
| | | if(item.getTaxInclusiveTotalPrice().compareTo(item.getInvoiceTotal()) == 0){ |
| | | item.setStatusName("已完成付款"); |
| | | }else{ |
| | | item.setStatusName("未完成付款"); |
| | | } |
| | | }); |
| | | return salesLedgerProductDtoIPage; |
| | | } |
| | | |
| | | @Override |
| | | public IPage<SalesLedgerProductDto> listPagePurchaseLedger(Page page, SalesLedgerProductDto salesLedgerProduct) { |
| | | IPage<SalesLedgerProductDto> salesLedgerProductDtoIPage = salesLedgerProductMapper.listPagePurchaseLedger(page, salesLedgerProduct); |
| | | salesLedgerProductDtoIPage.getRecords().forEach(item -> { |
| | | // 判断状态 |
| | | if(item.getTaxInclusiveTotalPrice().compareTo(item.getTicketsTotal()) == 0){ |
| | | item.setStatusName("已完成付款"); |
| | | }else{ |
| | | item.setStatusName("未完成付款"); |
| | | } |
| | | }); |
| | | return salesLedgerProductDtoIPage; |
| | | } |
| | | |
| | | /** |
| | |
| | | productWrapper.eq(SalesLedgerProduct::getType, 1); |
| | | List<SalesLedgerProduct> products = salesLedgerProductMapper.selectList(productWrapper); |
| | | for (SalesLedgerProduct product : products) { |
| | | product.setOriginalNoInvoiceNum(product.getNoInvoiceNum()); |
| | | // 提供临时未开票数,未开票金额供前段计算 |
| | | product.setTempnoInvoiceAmount(product.getNoInvoiceAmount()); |
| | | product.setTempNoInvoiceNum(product.getNoInvoiceNum()); |
| | | product.setRegister(SecurityUtils.getLoginUser().getUser().getNickName()); |
| | | product.setRegisterDate(LocalDateTime.now()); |
| | | // 发货信息 |
| | |
| | | salesLedgerProduct.setType(1); |
| | | // 计算不含税总价 |
| | | salesLedgerProduct.setTaxExclusiveTotalPrice(salesLedgerProduct.getTaxInclusiveTotalPrice().divide(new BigDecimal(1).add(salesLedgerProduct.getTaxRate().divide(new BigDecimal(100))), 2, RoundingMode.HALF_UP)); |
| | | salesLedgerProduct.setNoInvoiceNum(salesLedgerProduct.getQuantity()); |
| | | salesLedgerProduct.setNoInvoiceAmount(salesLedgerProduct.getTaxExclusiveTotalPrice()); |
| | | list.stream() |
| | | .filter(map -> Objects.equals(map.get("productName"), salesLedgerProduct.getProductCategory()) && Objects.equals(map.get("model"), salesLedgerProduct.getSpecificationModel())) |
| | | .findFirst() |
| | |
| | | salesLedgerProduct.setRegister(loginUser.getNickName()); |
| | | salesLedgerProduct.setRegisterDate(LocalDateTime.now()); |
| | | salesLedgerProduct.setApproveStatus(0); |
| | | salesLedgerProduct.setPendingInvoiceTotal(salesLedgerProductImportDto.getTaxInclusiveTotalPrice()); |
| | | salesLedgerProduct.setIsProduction(salesLedgerProductImportDto.getIsProduction() == 1); |
| | | salesLedgerProductMapper.insert(salesLedgerProduct); |
| | | // 添加生产数据 |
| | |
| | | productWrapper.eq(SalesLedgerProduct::getType, 1); |
| | | List<SalesLedgerProduct> products = salesLedgerProductMapper.selectList(productWrapper); |
| | | for (SalesLedgerProduct product : products) { |
| | | product.setOriginalNoInvoiceNum(product.getNoInvoiceNum()); |
| | | // 提供临时未开票数,未开票金额供前段计算 |
| | | product.setTempnoInvoiceAmount(product.getNoInvoiceAmount()); |
| | | product.setTempNoInvoiceNum(product.getNoInvoiceNum()); |
| | | product.setRegister(SecurityUtils.getLoginUser().getUser().getNickName()); |
| | | product.setRegister(SecurityUtils.getLoginUser().getUser().getNickName()); |
| | | product.setRegisterDate(LocalDateTime.now()); |
| | | // 发货信息 |
| | | ShippingInfo shippingInfo = shippingInfoMapper.selectOne(new LambdaQueryWrapper<ShippingInfo>() |
| | |
| | | if (!insertList.isEmpty()) { |
| | | for (SalesLedgerProduct salesLedgerProduct : insertList) { |
| | | salesLedgerProduct.setType(type.getCode()); |
| | | salesLedgerProduct.setNoInvoiceNum(salesLedgerProduct.getQuantity()); |
| | | salesLedgerProduct.setNoInvoiceAmount(salesLedgerProduct.getTaxInclusiveTotalPrice()); |
| | | salesLedgerProduct.setPendingInvoiceTotal(salesLedgerProduct.getTaxInclusiveTotalPrice()); |
| | | salesLedgerProductMapper.insert(salesLedgerProduct); |
| | | // 添加生产数据 |
| | | salesLedgerProductServiceImpl.addProductionData(salesLedgerProduct); |
| | |
| | | <result column="product_id" property="productId" /> |
| | | <result column="model" property="model" /> |
| | | <result column="unit" property="unit" /> |
| | | <result column="speculative_trading_name" property="speculativeTradingName" /> |
| | | <result column="tenant_id" property="tenantId" /> |
| | | <result column="product_name" property="productName" /> |
| | | <result column="product_id" property="productId" /> |
| | |
| | | T1.id, |
| | | T1.sales_ledger_id, |
| | | T1.warn_num, |
| | | T1.speculative_trading_name, |
| | | T1.quantity, |
| | | T1.min_stock, |
| | | T1.tax_rate, |
| | |
| | | T1.tax_exclusive_total_price, |
| | | T1.invoice_type, |
| | | T1.type, |
| | | T1.tickets_num, |
| | | T1.tickets_amount, |
| | | T1.future_tickets, |
| | | T1.future_tickets_amount, |
| | | T1.invoice_num, |
| | | T1.no_invoice_num, |
| | | T1.invoice_amount, |
| | | T1.no_invoice_amount, |
| | | T1.product_id, |
| | | T1.product_model_id, |
| | | T1.register, |
| | | T1.register_date, |
| | | T1.approve_status, |
| | | T1.pending_invoice_total, |
| | | T1.invoice_total, |
| | | T1.pending_tickets_total, |
| | | T1.tickets_total, |
| | | T1.is_checked, |
| | | T1.is_production, |
| | | T1.create_user, |
| | |
| | | and slp.id is not null |
| | | order by slp.id desc |
| | | limit 1 |
| | | |
| | | |
| | | </select> |
| | | <select id="listPage" resultType="com.ruoyi.sales.dto.SalesLedgerProductDto"> |
| | | select slp.*, |
| | | sl.project_name, |
| | | sl.customer_name, |
| | | sl.sales_contract_no, |
| | | sl.customer_contract_no |
| | | from sales_ledger_product slp |
| | | left join sales_ledger sl on slp.sales_ledger_id = sl.id |
| | | <where> |
| | | slp.type = 1 |
| | | <if test="req.salesContractNo != null and req.salesContractNo != '' "> |
| | | AND sl.sales_contract_no like concat('%',#{req.salesContractNo},'%') |
| | | </if> |
| | | <if test="req.customerContractNo != null and req.customerContractNo != '' "> |
| | | AND sl.customer_contract_no like concat('%',#{req.customerContractNo},'%') |
| | | </if> |
| | | <if test="req.projectName != null and req.projectName != '' "> |
| | | AND sl.project_name like concat('%',#{req.projectName},'%') |
| | | </if> |
| | | <if test="req.customerName != null and req.customerName != '' "> |
| | | AND sl.customer_name like concat('%',#{req.customerName},'%') |
| | | </if> |
| | | <if test="req.productCategory != null and req.productCategory != '' "> |
| | | AND slp.product_category like concat('%',#{req.productCategory},'%') |
| | | </if> |
| | | <if test="req.status != null and req.status "> |
| | | AND slp.pending_invoice_total > 0 |
| | | </if> |
| | | </where> |
| | | order by slp.register_date desc |
| | | </select> |
| | | <select id="listPagePurchaseLedger" resultType="com.ruoyi.sales.dto.SalesLedgerProductDto"> |
| | | select slp.*, |
| | | sl.project_name, |
| | | sl.supplier_name, |
| | | sl.supplier_id, |
| | | sl.sales_contract_no, |
| | | sl.purchase_contract_number |
| | | from sales_ledger_product slp |
| | | left join purchase_ledger sl on slp.sales_ledger_id = sl.id |
| | | <where> |
| | | slp.type = 2 |
| | | <if test="req.purchaseContractNumber != null and req.purchaseContractNumber != '' "> |
| | | AND sl.purchase_contract_number like concat('%',#{req.purchaseContractNumber},'%') |
| | | </if> |
| | | <if test="req.approvalStatus != null and req.approvalStatus != ''"> |
| | | and sl.approval_status = #{req.approvalStatus} |
| | | </if> |
| | | <if test="req.customerContractNo != null and req.customerContractNo != '' "> |
| | | AND sl.customer_contract_no like concat('%',#{req.customerContractNo},'%') |
| | | </if> |
| | | <if test="req.projectName != null and req.projectName != '' "> |
| | | AND sl.project_name like concat('%',#{req.projectName},'%') |
| | | </if> |
| | | <if test="req.customerName != null and req.customerName != '' "> |
| | | AND sl.customer_name like concat('%',#{req.customerName},'%') |
| | | </if> |
| | | <if test="req.productCategory != null and req.productCategory != '' "> |
| | | AND slp.product_category like concat('%',#{req.productCategory},'%') |
| | | </if> |
| | | <if test="req.status != null and req.status "> |
| | | AND slp.pending_tickets_total > 0 |
| | | </if> |
| | | </where> |
| | | order by slp.register_date desc |
| | | </select> |
| | | <select id="procurementBusinessSummaryListPage" |
| | | resultType="com.ruoyi.purchase.dto.ProcurementBusinessSummaryDto"> |