1.注册证号带出许可证号引号隔开

2.采购订单用折扣前价税合计分摊
This commit is contained in:
龚豆豆 2025-08-15 11:34:49 +08:00
parent 1dbad706e5
commit 58fed10275
2 changed files with 104 additions and 75 deletions

View File

@ -64,8 +64,10 @@ public class BaseDataPlugin extends AbstractFormPlugin implements Plugin {
String supno = entry.getString("tqq9_e_supno");
stringBuilder.append("#").append(supno);
}
String substring = stringBuilder.substring(1);
this.getModel().setValue("tqq9_licenseno",substring,rowIndex);
if(StringUtils.isNotBlank(stringBuilder.toString())){
String substring = stringBuilder.substring(1);
this.getModel().setValue("tqq9_licenseno",substring,rowIndex);
}
}
}
this.getView().updateView();

View File

@ -15,6 +15,8 @@ import kd.bos.servicehelper.BusinessDataServiceHelper;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.List;
/**
* 采购订单
@ -51,29 +53,34 @@ public class PuroderBillShareRefundPlugin extends AbstractBillPlugIn {
//含税现返使用金额
BigDecimal tqq9_hsxfsyje = dataEntity.getBigDecimal(name);//单头含税现返使用金额
if (tqq9_hsxfsyje.compareTo(BigDecimal.ZERO) > 0) {
BigDecimal totalallamount = dataEntity.getBigDecimal("totalallamount");//单头价税合计
DynamicObjectCollection billentries = dataEntity.getDynamicObjectCollection("billentry");
if (billentries != null && billentries.size() > 0) {
BigDecimal remainRefundAmt = tqq9_hsxfsyje;//拆分后剩余的金额
List<Integer> seqs = new ArrayList<>();
BigDecimal tqq9_totalamount = BigDecimal.ZERO;
for (int i = 0; i <= billentries.size() - 1; i++) {
DynamicObject billentry = billentries.get(i);
if (i == billentries.size() - 1) {
BigDecimal tqq9_amount = billentry.getBigDecimal("tqq9_amount");//明细折扣前价税合计
tqq9_totalamount = tqq9_totalamount.add(tqq9_amount);
if (tqq9_amount.compareTo(BigDecimal.ZERO) > 0) {
seqs.add(i);
}
}
for (int i = 0; i < seqs.size(); i++) {
int seq = seqs.get(i);
if (i == seqs.size() - 1) {
//如果是最后一行
this.getModel().setValue("tqq9_xfamount", remainRefundAmt, i);//明细现返使用金额
this.getModel().setValue("tqq9_xfamount", remainRefundAmt, seq);//明细现返使用金额
} else {
//如果不是最后一行
BigDecimal amountandtax = billentry.getBigDecimal("amountandtax");//明细价税合计
if (amountandtax.compareTo(BigDecimal.ZERO) == 0) {
BigDecimal tqq9_xfamount = BigDecimal.ZERO;//分录行含税金额比例
this.getModel().setValue("tqq9_xfamount", tqq9_xfamount, i);//明细现返使用金额
remainRefundAmt = remainRefundAmt.subtract(tqq9_xfamount);
}else{
BigDecimal tqq9_xfamount = tqq9_hsxfsyje.multiply(amountandtax).divide(totalallamount, 2, RoundingMode.HALF_UP);//分录行含税金额比例
this.getModel().setValue("tqq9_xfamount", tqq9_xfamount, i);//明细现返使用金额
BigDecimal tqq9_amount = (BigDecimal) this.getModel().getValue("tqq9_amount", seq);//明细折扣前价税合计
if (tqq9_amount.compareTo(BigDecimal.ZERO) == 0) {
this.getModel().setValue("tqq9_xfamount", BigDecimal.ZERO, seq);//明细现返使用金额
} else {
BigDecimal tqq9_xfamount = tqq9_hsxfsyje.multiply(tqq9_amount).divide(tqq9_totalamount, 10, RoundingMode.HALF_UP);//分录行含税金额比例
this.getModel().setValue("tqq9_xfamount", tqq9_xfamount, seq);//明细现返使用金额
remainRefundAmt = remainRefundAmt.subtract(tqq9_xfamount);
}
}
}
}
@ -82,27 +89,35 @@ public class PuroderBillShareRefundPlugin extends AbstractBillPlugIn {
}
if ("tqq9_hshfsyje".equals(name)) {
//含税货返使用金额
BigDecimal tqq9_hshfsyje = dataEntity.getBigDecimal(name);//单头含税返使用金额
BigDecimal tqq9_hshfsyje = dataEntity.getBigDecimal(name);//单头含税返使用金额
if (tqq9_hshfsyje.compareTo(BigDecimal.ZERO) > 0) {
BigDecimal totalallamount = dataEntity.getBigDecimal("totalallamount");//单头价税合计
DynamicObjectCollection billentries = dataEntity.getDynamicObjectCollection("billentry");
if (billentries != null && billentries.size() > 0) {
BigDecimal remainRefundAmt = tqq9_hshfsyje;//拆分后剩余的金额
List<Integer> seqs = new ArrayList<>();
BigDecimal tqq9_totalamount = BigDecimal.ZERO;
for (int i = 0; i <= billentries.size() - 1; i++) {
DynamicObject billentry = billentries.get(i);
if (i == billentries.size() - 1) {
BigDecimal tqq9_amount = billentry.getBigDecimal("tqq9_amount");//明细折扣前价税合计
tqq9_totalamount = tqq9_totalamount.add(tqq9_amount);
if (tqq9_amount.compareTo(BigDecimal.ZERO) > 0) {
seqs.add(i);
}
}
for (int i = 0; i <= seqs.size() - 1; i++) {
int seq = seqs.get(i);
if (i == seqs.size() - 1) {
//如果是最后一行
this.getModel().setValue("tqq9_hfamount", remainRefundAmt, i);//明细货返使用金额
this.getModel().setValue("tqq9_hfamount", remainRefundAmt, seq);//明细货返使用金额
} else {
//如果不是最后一行
BigDecimal amountandtax = billentry.getBigDecimal("amountandtax");//明细价税合计
if (amountandtax.compareTo(BigDecimal.ZERO) == 0) {
BigDecimal tqq9_hfamount =BigDecimal.ZERO;//分录行含税金额比例
this.getModel().setValue("tqq9_hfamount", tqq9_hfamount, i);//明细货返使用金额
remainRefundAmt = remainRefundAmt.subtract(tqq9_hfamount);
}else{
BigDecimal tqq9_hfamount = tqq9_hshfsyje.multiply(amountandtax).divide(totalallamount, 2, RoundingMode.HALF_UP);//分录行含税金额比例
this.getModel().setValue("tqq9_hfamount", tqq9_hfamount, i);//明细货返使用金额
BigDecimal tqq9_amount = (BigDecimal) this.getModel().getValue("tqq9_amount", seq);//明细折扣前价税合计
if (tqq9_amount.compareTo(BigDecimal.ZERO) == 0) {
this.getModel().setValue("tqq9_hfamount", BigDecimal.ZERO, seq);//明细货返使用金额
} else {
BigDecimal tqq9_hfamount = tqq9_hshfsyje.multiply(tqq9_amount).divide(tqq9_totalamount, 10, RoundingMode.HALF_UP);//分录行含税金额比例
this.getModel().setValue("tqq9_hfamount", tqq9_hfamount, seq);//明细货返使用金额
remainRefundAmt = remainRefundAmt.subtract(tqq9_hfamount);
}
@ -116,25 +131,32 @@ public class PuroderBillShareRefundPlugin extends AbstractBillPlugIn {
//优惠金额
BigDecimal tqq9_discountamount = dataEntity.getBigDecimal(name);//单头优惠金额
if (tqq9_discountamount.compareTo(BigDecimal.ZERO) > 0) {
BigDecimal totalallamount = dataEntity.getBigDecimal("totalallamount");//单头价税合计
DynamicObjectCollection billentries = dataEntity.getDynamicObjectCollection("billentry");
if (billentries != null && billentries.size() > 0) {
BigDecimal remainRefundAmt = tqq9_discountamount;//拆分后剩余的金额
List<Integer> seqs = new ArrayList<>();
BigDecimal tqq9_totalamount = BigDecimal.ZERO;
for (int i = 0; i <= billentries.size() - 1; i++) {
DynamicObject billentry = billentries.get(i);
if (i == billentries.size() - 1) {
BigDecimal tqq9_amount = billentry.getBigDecimal("tqq9_amount");//明细折扣前价税合计
tqq9_totalamount = tqq9_totalamount.add(tqq9_amount);
if (tqq9_amount.compareTo(BigDecimal.ZERO) > 0) {
seqs.add(i);
}
}
for (int i = 0; i <= seqs.size() - 1; i++) {
int seq = seqs.get(i);
if (i == seqs.size() - 1) {
//如果是最后一行
this.getModel().setValue("tqq9_disamount", remainRefundAmt, i);//明细优惠金额
this.getModel().setValue("tqq9_disamount", remainRefundAmt, seq);//明细优惠金额
} else {
//如果不是最后一行
BigDecimal amountandtax = billentry.getBigDecimal("amountandtax");//明细价税合计
if (amountandtax.compareTo(BigDecimal.ZERO) == 0) {
BigDecimal tqq9_disamount = BigDecimal.ZERO;//分录行含税金额比例
this.getModel().setValue("tqq9_disamount", tqq9_disamount, i);//明细优惠金额
remainRefundAmt = remainRefundAmt.subtract(tqq9_disamount);
BigDecimal tqq9_amount = (BigDecimal) this.getModel().getValue("tqq9_amount", seq);//明细折扣前价税合计
if (tqq9_amount.compareTo(BigDecimal.ZERO) == 0) {
this.getModel().setValue("tqq9_disamount", BigDecimal.ZERO, seq);//明细优惠金额
} else {
BigDecimal tqq9_disamount = tqq9_discountamount.multiply(amountandtax).divide(totalallamount, 2, RoundingMode.HALF_UP);//分录行含税金额比例
this.getModel().setValue("tqq9_disamount", tqq9_disamount, i);//明细优惠金额
BigDecimal tqq9_disamount = tqq9_discountamount.multiply(tqq9_amount).divide(tqq9_totalamount, 10, RoundingMode.HALF_UP);//分录行含税金额比例
this.getModel().setValue("tqq9_disamount", tqq9_disamount, seq);//明细优惠金额
remainRefundAmt = remainRefundAmt.subtract(tqq9_disamount);
}
@ -160,74 +182,79 @@ public class PuroderBillShareRefundPlugin extends AbstractBillPlugIn {
}
if (StringUtils.equals("tqq9_amount", name)) {
//单头金额下推
BigDecimal tqq9_hsxfsyje = dataEntity.getBigDecimal("tqq9_hsxfsyje");//单头含税现返使用金额
BigDecimal tqq9_hshfsyje = dataEntity.getBigDecimal("tqq9_hshfsyje");//单头含税货返使用金额
BigDecimal tqq9_discountamount = dataEntity.getBigDecimal("tqq9_discountamount");//单头优惠金额
BigDecimal totalallamount = dataEntity.getBigDecimal("totalallamount");//单头价税合计
DynamicObjectCollection billentries = dataEntity.getDynamicObjectCollection("billentry");
BigDecimal remainRefundAmt_xf = tqq9_hsxfsyje;//拆分后剩余的金额-现返
BigDecimal remainRefundAmt_hf = tqq9_hshfsyje;//拆分后剩余的金额-货返
BigDecimal remainRefundAmt_yh = tqq9_discountamount;//拆分后剩余的金额-优惠
if (billentries != null && billentries.size() > 0) {
BigDecimal tqq9_hsxfsyje = dataEntity.getBigDecimal("tqq9_hsxfsyje");//单头含税现返使用金额
BigDecimal tqq9_hshfsyje = dataEntity.getBigDecimal("tqq9_hshfsyje");//单头含税货返使用金额
BigDecimal tqq9_discountamount = dataEntity.getBigDecimal("tqq9_discountamount");//单头优惠金额
BigDecimal remainRefundAmt_xf = tqq9_hsxfsyje;//拆分后剩余的金额-现返
BigDecimal remainRefundAmt_hf = tqq9_hshfsyje;//拆分后剩余的金额-货返
BigDecimal remainRefundAmt_yh = tqq9_discountamount;//拆分后剩余的金额-优惠
List<Integer> seqs = new ArrayList<>();
BigDecimal tqq9_totalamount = BigDecimal.ZERO;
for (int i = 0; i <= billentries.size() - 1; i++) {
DynamicObject billentry = billentries.get(i);
BigDecimal tqq9_amount = billentry.getBigDecimal("tqq9_amount");//明细折扣前价税合计
tqq9_totalamount = tqq9_totalamount.add(tqq9_amount);
if (tqq9_amount.compareTo(BigDecimal.ZERO) > 0) {
seqs.add(i);
}
}
for (int i = 0; i <= seqs.size() - 1; i++) {
Integer seq = seqs.get(i);
//现返
if (tqq9_hsxfsyje.compareTo(BigDecimal.ZERO) > 0) {
if (i == billentries.size() - 1) {
if (i == seqs.size() - 1) {
//如果是最后一行
this.getModel().setValue("tqq9_xfamount", remainRefundAmt_xf, i);//明细现返使用金额
this.getModel().setValue("tqq9_xfamount", remainRefundAmt_xf, seq);//明细现返使用金额
} else {
//如果不是最后一行
BigDecimal amountandtax = billentry.getBigDecimal("amountandtax");//明细价税合计
if (amountandtax.compareTo(BigDecimal.ZERO) == 0) {
BigDecimal tqq9_xfamount = BigDecimal.ZERO;//分录行含税金额比例
this.getModel().setValue("tqq9_xfamount", tqq9_xfamount, i);//明细现返使用金额
remainRefundAmt_xf = remainRefundAmt_xf.subtract(tqq9_xfamount);
BigDecimal tqq9_amount = (BigDecimal) this.getModel().getValue("tqq9_amount", seq);//明细折扣前价税合计
if (tqq9_amount.compareTo(BigDecimal.ZERO) == 0) {
this.getModel().setValue("tqq9_xfamount", BigDecimal.ZERO, seq);//明细现返使用金额
} else {
BigDecimal tqq9_xfamount = tqq9_hsxfsyje.multiply(amountandtax).divide(totalallamount.add(amountandtax), 2, RoundingMode.HALF_UP);//分录行含税金额比例
this.getModel().setValue("tqq9_xfamount", tqq9_xfamount, i);//明细现返使用金额
BigDecimal tqq9_xfamount = tqq9_hsxfsyje.multiply(tqq9_amount).divide(tqq9_totalamount, 10, RoundingMode.HALF_UP);//分录行含税金额比例
this.getModel().setValue("tqq9_xfamount", tqq9_xfamount, seq);//明细现返使用金额
remainRefundAmt_xf = remainRefundAmt_xf.subtract(tqq9_xfamount);
}
}
}
//货返
if (tqq9_hshfsyje.compareTo(BigDecimal.ZERO) > 0) {
if (i == billentries.size() - 1) {
if (i == seqs.size() - 1) {
//如果是最后一行
this.getModel().setValue("tqq9_hfamount", remainRefundAmt_hf, i);//明细货返使用金额
this.getModel().setValue("tqq9_hfamount", remainRefundAmt_hf, seq);//明细货返使用金额
} else {
//如果不是最后一行
BigDecimal amountandtax = billentry.getBigDecimal("amountandtax");//明细价税合计
if (amountandtax.compareTo(BigDecimal.ZERO) == 0) {
BigDecimal tqq9_hfamount = BigDecimal.ZERO;//分录行含税金额比例
this.getModel().setValue("tqq9_hfamount", tqq9_hfamount, i);//明细货返使用金额
remainRefundAmt_hf = remainRefundAmt_hf.subtract(tqq9_hfamount);
BigDecimal tqq9_amount = (BigDecimal) this.getModel().getValue("tqq9_amount", seq);//明细折扣前价税合计
if (tqq9_amount.compareTo(BigDecimal.ZERO) == 0) {
this.getModel().setValue("tqq9_hfamount", BigDecimal.ZERO, seq);//明细货返使用金额
} else {
BigDecimal tqq9_hfamount = tqq9_hshfsyje.multiply(amountandtax).divide(totalallamount.add(amountandtax), 2, RoundingMode.HALF_UP);//分录行含税金额比例
this.getModel().setValue("tqq9_hfamount", tqq9_hfamount, i);//明细货返使用金额
BigDecimal tqq9_hfamount = tqq9_hshfsyje.multiply(tqq9_amount).divide(tqq9_totalamount, 10, RoundingMode.HALF_UP);//分录行含税金额比例
this.getModel().setValue("tqq9_hfamount", tqq9_hfamount, seq);//明细货返使用金额
remainRefundAmt_hf = remainRefundAmt_hf.subtract(tqq9_hfamount);
}
}
}
//优惠
if (tqq9_discountamount.compareTo(BigDecimal.ZERO) > 0) {
if (i == billentries.size() - 1) {
if (i == seqs.size() - 1) {
//如果是最后一行
this.getModel().setValue("tqq9_disamount", remainRefundAmt_yh, i);//明细优惠金额
this.getModel().setValue("discountamount", remainRefundAmt_yh, i);//明细折扣额
this.getModel().setValue("tqq9_disamount", remainRefundAmt_yh, seq);//明细优惠金额
this.getModel().setValue("discountamount", remainRefundAmt_yh, seq);//明细折扣额
} else {
//如果不是最后一行
BigDecimal amountandtax = billentry.getBigDecimal("amountandtax");//明细价税合计
if (amountandtax.compareTo(BigDecimal.ZERO) == 0) {
BigDecimal tqq9_disamount = BigDecimal.ZERO;//分录行含税金额比例
this.getModel().setValue("tqq9_disamount", tqq9_disamount, i);//明细优惠金额
this.getModel().setValue("discountamount", tqq9_disamount, i);//
remainRefundAmt_yh = remainRefundAmt_yh.subtract(tqq9_disamount);
BigDecimal tqq9_amount = (BigDecimal) this.getModel().getValue("tqq9_amount", seq);//明细折扣前价税合计
if (tqq9_amount.compareTo(BigDecimal.ZERO) == 0) {
this.getModel().setValue("tqq9_disamount", BigDecimal.ZERO, seq);//明细优惠金额
this.getModel().setValue("discountamount", BigDecimal.ZERO, seq);//
} else {
BigDecimal tqq9_disamount = tqq9_discountamount.multiply(amountandtax).divide(totalallamount.add(amountandtax), 2, RoundingMode.HALF_UP);//分录行含税金额比例
this.getModel().setValue("tqq9_disamount", tqq9_disamount, i);//明细优惠金额
this.getModel().setValue("discountamount", tqq9_disamount, i);//
BigDecimal tqq9_disamount = tqq9_discountamount.multiply(tqq9_amount).divide(tqq9_totalamount, 10, RoundingMode.HALF_UP);//分录行含税金额比例
this.getModel().setValue("tqq9_disamount", tqq9_disamount, seq);//明细优惠金额
this.getModel().setValue("discountamount", tqq9_disamount, seq);//
remainRefundAmt_yh = remainRefundAmt_yh.subtract(tqq9_disamount);
}