Browse Source

[fix] 销售管理

按照万材要求,调整客户报价4个导出模板的按钮样式
根据万材提供的新的客户报价模板3:新增客户报价模板3excel文件、
修改具体实现类,完成对客户报价模板3导出模板的数据填充
修改客户报价前端列表页面,设置导出模板3之前判断选择的数据是不是RMB
dev
liuxiaoxu 2 months ago
parent
commit
a2847b9620
  1. 54
      ruoyi-admin/src/main/java/com/ruoyi/sales/service/impl/SalesEstimateServiceImpl.java
  2. BIN
      ruoyi-admin/src/main/resources/static/attachments/客户报价3.xlsx
  3. 13
      ruoyi-admin/src/main/resources/templates/system/customerQuote/customerQuote.html

54
ruoyi-admin/src/main/java/com/ruoyi/sales/service/impl/SalesEstimateServiceImpl.java

@ -4,6 +4,7 @@ import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import com.ruoyi.common.core.redis.RedisCache;
@ -93,8 +94,28 @@ public class SalesEstimateServiceImpl implements ISalesEstimateService
salesEstimate.setEstimateStatus("0");
//设置默认值为RMB
salesEstimate.setCommonCurrency("1");
List<SalesEstimateDetail> salesEstimateDetailList = salesEstimate.getSalesEstimateDetailList();
if (salesEstimateDetailList != null && salesEstimateDetailList.size() > 0) {
// 确保 getMaterialNum 返回类型为 Long 或 long
long enterpriseSum = salesEstimateDetailList.stream()
.filter(detail->detail.getMaterialNum() != null) // 过滤掉 null 元素
.mapToLong(SalesEstimateDetail::getMaterialNum)
.sum();
salesEstimate.setEnterpriseSum(enterpriseSum);
salesEstimate.setMaterialSum((long) salesEstimateDetailList.size());
//计算不含税单价人民币
//计算不含税单价美元
//计算含税单价人民币
//计算含税单价美元
//计算不含税总价人民币
//计算不含税总价美元
//计算含税总价人民币
//计算含税总价美元
for (SalesEstimateDetail salesEstimateDetail : salesEstimateDetailList) {
salesEstimateDetail.setSalesEstimateCode(salesEstimateCode);
@ -286,7 +307,13 @@ public class SalesEstimateServiceImpl implements ISalesEstimateService
3不含税经营成本(RMB)=(该料号的BOM物料总不含税采购成本/总不含税物料成本)*总不含税经营成本
4含税经营成本(RMB)=(该料号的BOM物料总含税采购成本/总含税物料成本)*总含税经营成本
5不含税料号估价成本:该料号的BOM物料总不含税采购成本+不含税总经营成本+(该料号的BOM物料总不含税采购成本/总不含税物料成本)*总不含税经营成本
新版不含税料号估价成本:该料号的BOM物料总不含税采购成本+不含税运输成本+不含税服务成本+不含税开发成本+(该料号的BOM物料总不含税采购成本/总物料不含税成本)*总经营不含税成
6含税料号估价成本:该料号的BOM物料总含税采购成本+含税总经营成本+(该料号的BOM物料总含税采购成本/总含税物料成本)*总含税经营成本
新版含税料号估价成本:该料号的BOM物料总含税采购成本+含税运输成本+含税服务成本+含税开发成本+(该料号的BOM物料总含税采购成本/总物料含税成本)*总经营含税成本
7不含税单价(RMB):该料号不含税估价成本/(1-利润率)
8含税单价(RMB)=该料号含税估价成本/(1-利润率)
9不含税总价(RMB)=不含税单价(RMB)*数量
@ -340,6 +367,11 @@ public class SalesEstimateServiceImpl implements ISalesEstimateService
BigDecimal noTaxBusinessCosts = salesEstimateDetail.getNoTaxBusinessCosts(); // 获取不含税的业务成本
BigDecimal noTaxManagesCosts = salesEstimateDetail.getNoTaxManagesCosts(); // 获取不含税的管理成本
BigDecimal noTaxMaterialCosts = salesEstimateDetail.getNoTaxMaterialCosts(); // 获取不含税的物料成本
BigDecimal noTaxShippingCosts = salesEstimateDetail.getNoTaxShippingCosts(); //不含税运输成本
BigDecimal noTaxServiceCosts = salesEstimateDetail.getNoTaxServiceCosts(); //不含税服务成本
BigDecimal noTaxDevelopmentCosts = salesEstimateDetail.getNoTaxDevelopCosts();//不含税开发成本
BigDecimal profitRate = salesEstimateDetail.getProfitRate().divide(BigDecimal.valueOf(100)); // 获取利润率并转换为小数形式
Long materialNum = salesEstimateDetail.getMaterialNum(); // 获取物料数量
@ -367,10 +399,10 @@ public class SalesEstimateServiceImpl implements ISalesEstimateService
.setScale(2, RoundingMode.HALF_UP);
// 计算不含税料号估价成本,并保留两位小数
BigDecimal noTaxEstimateCost = calculateNoTaxEstimateCost(totalNoTaxPurchaseRmb, noAllTaxOperatingCosts, noTaxMaterialCosts)
BigDecimal noTaxEstimateCost = calculateNoTaxEstimateCost(totalNoTaxPurchaseRmb, noTaxShippingCosts,noTaxServiceCosts,noTaxDevelopmentCosts,noAllTaxOperatingCosts, noTaxMaterialCosts)
.setScale(2, RoundingMode.HALF_UP);
// 计算含税料号估价成本,并保留两位小数
BigDecimal taxEstimateCost = calculateTaxEstimateCost(totalTaxPurchaseRmb, allTaxOperatingCosts, taxMaterialCosts)
BigDecimal taxEstimateCost = calculateTaxEstimateCost(totalTaxPurchaseRmb,noTaxShippingCosts,noTaxServiceCosts,noTaxDevelopmentCosts, allTaxOperatingCosts, taxMaterialCosts)
.setScale(2, RoundingMode.HALF_UP);
// 计算不含税单价(RMB),并保留两位小数
@ -498,16 +530,24 @@ public class SalesEstimateServiceImpl implements ISalesEstimateService
.multiply(allTaxOperatingCosts);
}
// 计算不含税料号估价成本
private BigDecimal calculateNoTaxEstimateCost(BigDecimal totalNoTaxPurchaseRmb, BigDecimal noAllTaxOperatingCosts, BigDecimal noTaxMaterialCosts) {
return totalNoTaxPurchaseRmb.add(noAllTaxOperatingCosts)
// 计算不含税料号估价成本 BigDecimal noTaxShippingCosts = salesEstimateDetail.getNoTaxShippingCosts(); //不含税运输成本
// BigDecimal noTaxServiceCosts = salesEstimateDetail.getNoTaxServiceCosts(); //不含税服务成本
// BigDecimal noTaxDevelopmentCosts = salesEstimateDetail.getNoTaxDevelopCosts();//不含税开发成本
private BigDecimal calculateNoTaxEstimateCost(BigDecimal totalNoTaxPurchaseRmb, BigDecimal noTaxShippingCosts ,BigDecimal noTaxServiceCosts,BigDecimal noTaxDevelopmentCosts ,BigDecimal noAllTaxOperatingCosts,BigDecimal noTaxMaterialCosts) {
return totalNoTaxPurchaseRmb
.add(noTaxShippingCosts)
.add(noTaxServiceCosts)
.add(noTaxDevelopmentCosts)
.add(totalNoTaxPurchaseRmb.divide(noTaxMaterialCosts, 2, RoundingMode.HALF_UP)
.multiply(noAllTaxOperatingCosts));
}
// 计算含税料号估价成本
private BigDecimal calculateTaxEstimateCost(BigDecimal totalTaxPurchaseRmb, BigDecimal allTaxOperatingCosts, BigDecimal taxMaterialCosts) {
return totalTaxPurchaseRmb.add(allTaxOperatingCosts)
private BigDecimal calculateTaxEstimateCost(BigDecimal totalTaxPurchaseRmb, BigDecimal noTaxShippingCosts ,BigDecimal noTaxServiceCosts,BigDecimal noTaxDevelopmentCosts ,BigDecimal allTaxOperatingCosts, BigDecimal taxMaterialCosts) {
return totalTaxPurchaseRmb
.add(noTaxShippingCosts)
.add(noTaxServiceCosts)
.add(noTaxDevelopmentCosts)
.add(totalTaxPurchaseRmb.divide(taxMaterialCosts, 2, RoundingMode.HALF_UP)
.multiply(allTaxOperatingCosts));
}

BIN
ruoyi-admin/src/main/resources/static/attachments/客户报价3.xlsx

Binary file not shown.

13
ruoyi-admin/src/main/resources/templates/system/customerQuote/customerQuote.html

@ -71,17 +71,16 @@
<i class="fa fa-download"></i> 导出
</a>
<a class="btn btn-warning" onclick="exportCustomerQuoteOne()" shiro:hasPermission="system:customerQuote:exportCustomerQuoteOne">
<i class="fa fa-download"></i> 导出客户报价1
<i class="fa fa-download"></i> 导出Vantritek-RMB
</a>
<a class="btn btn-warning" onclick="exportCustomerQuoteTwo()" shiro:hasPermission="system:customerQuote:exportCustomerQuoteTwo">
<i class="fa fa-download"></i> 导出客户报价2
<i class="fa fa-download"></i> 导出Vantritek-美元
</a>
<a class="btn btn-warning" onclick="exportCustomerQuoteThree()" shiro:hasPermission="system:customerQuote:exportCustomerQuoteThree">
<i class="fa fa-download"></i> 导出客户报价3
<i class="fa fa-download"></i> 导出Infinity-RMB
</a>
<a class="btn btn-warning" onclick="exportCustomerQuoteFour()" shiro:hasPermission="system:customerQuote:exportCustomerQuoteFour">
<i class="fa fa-download"></i> 导出客户报价4
<i class="fa fa-download"></i> 导出Infinity-美元
</a>
</div>
<div class="col-sm-12 select-table table-striped">
@ -410,7 +409,7 @@
// 检查是否已审核
if (row.auditStatus === AUDIT_STATUS_APPROVED) {
if (row.commonCurrency === '2'){
if (row.commonCurrency === '1'){
// 使用 $.modal.confirm 显示确认对话框
$.modal.confirm("确定导出这条数据的客户报价吗?", function() {
// 如果用户点击确定,继续导出
@ -419,7 +418,7 @@
$('#bootstrap-table').bootstrapTable('refresh'); // 刷新表格
});
}else {
showWarning("请选择报价币种为美元的数据进行导出");
showWarning("请选择报价币种为RMB的数据进行导出");
}
} else {
showWarning("请先审核");

Loading…
Cancel
Save