feat:外销合同4个公式计算
This commit is contained in:
parent
43c219e4b9
commit
4405731da0
@ -55,6 +55,7 @@ import kd.bos.servicehelper.operation.OperationServiceHelper;
|
||||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||
import kd.bos.servicehelper.user.UserServiceHelper;
|
||||
import kd.sdk.plugin.Plugin;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
@ -1991,4 +1992,20 @@ public class SalesOrderEdit extends AbstractBillPlugIn implements Plugin, Before
|
||||
}
|
||||
|
||||
|
||||
public static boolean isZJ(String billtype) {
|
||||
return StringUtils.containsIgnoreCase(billtype, "zj");
|
||||
}
|
||||
|
||||
public static boolean isZJ(DynamicObject dynamicObject) {
|
||||
String type = dynamicObject.getString("yem_billtype.number");
|
||||
return isZJ(type);
|
||||
}
|
||||
|
||||
public static boolean isZJ(IDataModel model) {
|
||||
DynamicObject billtype = (DynamicObject) model.getValue("yem_billtype");
|
||||
if (YEM.isNotEmpty(billtype)) {
|
||||
return isZJ(billtype.getString("number"));
|
||||
}
|
||||
throw new KDBizException("单据类型为空!!");
|
||||
}
|
||||
}
|
@ -298,6 +298,8 @@ public class SalesOrderZJEdit extends AbstractBillPlugIn implements Plugin, Befo
|
||||
ClientUtils.addSaAmountTk(model, rowIndex);//销售金额(价格条款)结算币别
|
||||
ClientUtils.countAfterFrontPrice(model, rowIndex);//折扣后销售单价
|
||||
syncDeductionGifts(model, rowIndex);
|
||||
ClientUtils.addSaAmountTkZJ(model, rowIndex);//整机合同整机非赠品行销售单价(价格条款)
|
||||
ClientUtils.countRealCatAmountZJ(model, rowIndex);//整机合同整机非赠品行实际整车金额
|
||||
break;
|
||||
case "yem_saamtpriceclause"://销售金额(价格条款)
|
||||
ClientUtils.totalSaFobAmount(model, "yem_es_materialinfo", "yem_ifgift", "yem_saamtpriceclause", "yem_offeramount");//销售金额(价格条款)汇总表头 金额价格条款
|
||||
@ -350,6 +352,8 @@ public class SalesOrderZJEdit extends AbstractBillPlugIn implements Plugin, Befo
|
||||
// ClientUtils.totalSaFobAmount(model, "yem_es_materialinfo", "yem_ifgift", "yem_onecarsum", "yem_sumcost");//单车总费用 汇总表头 总费用
|
||||
// ClientUtils.countSaPricePriceClause(model, rowIndex);//计算销售单价(价格条款)
|
||||
ClientUtils.addSaAmountTk(model, rowIndex);//销售金额(价格条款)结算币别
|
||||
ClientUtils.countSaPricePriceClauseZJ(model, rowIndex);//整机合同整机非赠品行销售单价(价格条款)
|
||||
ClientUtils.countRealCatPriceZJ(model, rowIndex);//整机合同整机非赠品行实际整车单价
|
||||
break;
|
||||
case "yem_unitsetamount"://单台加价金额
|
||||
ClientUtils.addSaPrice(model, materialInfo);//销售FOB单价(结算币别)
|
||||
@ -357,6 +361,7 @@ public class SalesOrderZJEdit extends AbstractBillPlugIn implements Plugin, Befo
|
||||
|
||||
case "yem_sapricepriceclause"://销售单价(价格条款)结算币别
|
||||
ClientUtils.addSaAmountTk(model, rowIndex);//销售金额(价格条款)结算币别
|
||||
ClientUtils.addSaAmountTkZJ(model, rowIndex);//整机合同整机非赠品行销售单价(价格条款)
|
||||
break;
|
||||
case "yem_sapriceclausebase"://销售单价(价格条款人民币)
|
||||
// ClientUtils.countRealCatPrice(model, rowIndex);//实际整车单价
|
||||
@ -366,6 +371,7 @@ public class SalesOrderZJEdit extends AbstractBillPlugIn implements Plugin, Befo
|
||||
break;
|
||||
case "yem_truecarprice"://实际整车单价
|
||||
// ClientUtils.countRealCatAmount(model, rowIndex);//实际整车金额
|
||||
ClientUtils.countRealCatAmountZJ(model, rowIndex);//整机合同整机非赠品行实际整车金额
|
||||
ClientUtils.countRealCatPriceRMB(model, rowIndex);//实际整车单价人民币
|
||||
break;
|
||||
case "yem_reccondition":
|
||||
@ -378,6 +384,7 @@ public class SalesOrderZJEdit extends AbstractBillPlugIn implements Plugin, Befo
|
||||
// ClientUtils.countRealCatPrice(model, rowIndex);
|
||||
ClientUtils.countFrontDisPrice(model, rowIndex);//折扣前单价
|
||||
ClientUtils.addSaAmountTk(model, rowIndex);//销售金额(价格条款)结算币别
|
||||
ClientUtils.countSaPricePriceClauseZJ(model, rowIndex);//整机合同整机非赠品行销售单价(价格条款)
|
||||
break;
|
||||
case "yem_ticketprice":
|
||||
case "yem_bigcabinetprice":
|
||||
@ -434,6 +441,8 @@ public class SalesOrderZJEdit extends AbstractBillPlugIn implements Plugin, Befo
|
||||
break;
|
||||
case "yem_afterfrontdisprice"://折扣后销售单价
|
||||
// ClientUtils.countSaPricePriceClause(model, rowIndex);//计算销售单价(价格条款)
|
||||
ClientUtils.countSaPricePriceClauseZJ(model, rowIndex);//整机合同整机非赠品行销售单价(价格条款)
|
||||
ClientUtils.countRealCatPriceZJ(model, rowIndex);//整机合同整机非赠品行实际整车单价
|
||||
break;
|
||||
case "yem_accamtusetype"://配件资金使用方式
|
||||
ClientUtils.countDisAmt(model, "yem_es_materialinfo", rowIndex, view);//计算折扣金额
|
||||
|
@ -390,6 +390,8 @@ public class ClientDemandZJFormPlugin extends AbstractBillPlugIn implements Befo
|
||||
ClientUtils.countFrontDisAmt(model, row);//折扣前销售金额
|
||||
ClientUtils.addSaAmountTk(model, row);//销售金额(价格条款)结算币别
|
||||
ClientUtils.countAfterFrontPrice(model, row);//折扣后销售单价
|
||||
ClientUtils.addSaAmountTkZJ(model, row);//整机合同整机非赠品行销售单价(价格条款)
|
||||
ClientUtils.countRealCatAmountZJ(model, row);//整机合同整机非赠品行实际整车金额
|
||||
break;
|
||||
case "yem_frontdisprice"://折扣前单价
|
||||
ClientUtils.countFrontDisAmt(model, row);//折扣前销售金额
|
||||
@ -505,6 +507,7 @@ public class ClientDemandZJFormPlugin extends AbstractBillPlugIn implements Befo
|
||||
// break;
|
||||
case "yem_sapricepriceclause":
|
||||
// ClientUtils.addSaAmountTk(model, row);//销售金额(价格条款)结算币别
|
||||
ClientUtils.addSaAmountTkZJ(model, row);//整机合同整机非赠品行销售单价(价格条款)
|
||||
break;
|
||||
case "yem_sapriceclausebase":
|
||||
// ClientUtils.countRealCatPrice(model, row);
|
||||
@ -514,6 +517,7 @@ public class ClientDemandZJFormPlugin extends AbstractBillPlugIn implements Befo
|
||||
break;
|
||||
case "yem_truecarprice":
|
||||
// ClientUtils.countRealCatAmount(model, row);
|
||||
ClientUtils.countRealCatAmountZJ(model, row);//整机合同整机非赠品行实际整车金额
|
||||
ClientUtils.countRealCatPriceRMB(model, row);
|
||||
break;
|
||||
case "yem_truecarpriceba":
|
||||
@ -575,6 +579,8 @@ public class ClientDemandZJFormPlugin extends AbstractBillPlugIn implements Befo
|
||||
ClientUtils.totalSaFobAmount(model, "yem_im_detailedinfor", "yem_ifgift", "yem_totalamount", "yem_sumcost");//总费用 汇总表头 总费用
|
||||
// ClientUtils.countSaPricePriceClause(model, row);//计算销售单价(价格条款)
|
||||
ClientUtils.addSaAmountTk(model, row);//销售金额(价格条款)结算币别
|
||||
ClientUtils.countSaPricePriceClauseZJ(model, row);//整机合同整机非赠品行销售单价(价格条款)
|
||||
ClientUtils.countRealCatPriceZJ(model, row);//整机合同整机非赠品行实际整车单价
|
||||
break;
|
||||
case "yem_lenghtunit"://长度单位
|
||||
case "yem_vol"://体积
|
||||
@ -585,10 +591,13 @@ public class ClientDemandZJFormPlugin extends AbstractBillPlugIn implements Befo
|
||||
// ClientUtils.countRealCatPrice(model, row);
|
||||
ClientUtils.countFrontDisPrice(model, row);//折扣前单价
|
||||
ClientUtils.addSaAmountTk(model, row);//销售金额(价格条款)结算币别
|
||||
ClientUtils.countSaPricePriceClauseZJ(model, row);//整机合同整机非赠品行销售单价(价格条款)
|
||||
// ClientUtils.countSaPricePriceClause(model, row);//计算销售单价(价格条款)
|
||||
break;
|
||||
case "yem_afterfrontdisprice"://折扣后销售单价
|
||||
// ClientUtils.countSaPricePriceClause(model, row);//计算销售单价(价格条款)
|
||||
ClientUtils.countSaPricePriceClauseZJ(model, row);//整机合同整机非赠品行销售单价(价格条款)
|
||||
ClientUtils.countRealCatPriceZJ(model, row);//整机合同整机非赠品行实际整车单价
|
||||
break;
|
||||
case "yem_accamtusetype"://配件资金使用方式
|
||||
ClientUtils.countDisAmt(model, "yem_im_detailedinfor", row, view);//计算折扣金额
|
||||
|
@ -342,6 +342,8 @@ public class InClientDemandZJFormPlugin extends AbstractBillPlugIn implements Be
|
||||
ClientUtils.countFrontDisAmt(model, row);//折扣前销售金额
|
||||
ClientUtils.addSaAmountTk(model, row);//销售金额(价格条款)结算币别
|
||||
ClientUtils.countAfterFrontPrice(model, row);//折扣后销售单价
|
||||
ClientUtils.addSaAmountTkZJ(model, row);//整机合同整机非赠品行销售单价(价格条款)
|
||||
ClientUtils.countRealCatAmountZJ(model, row);//整机合同整机非赠品行实际整车金额
|
||||
break;
|
||||
case "yem_frontdisprice"://折扣前单价
|
||||
ClientUtils.countFrontDisAmt(model, row);//折扣前销售金额
|
||||
@ -457,6 +459,7 @@ public class InClientDemandZJFormPlugin extends AbstractBillPlugIn implements Be
|
||||
// break;
|
||||
case "yem_sapricepriceclause":
|
||||
// ClientUtils.addSaAmountTk(model, row);//销售金额(价格条款)结算币别
|
||||
ClientUtils.addSaAmountTkZJ(model, row);//整机合同整机非赠品行销售单价(价格条款)
|
||||
break;
|
||||
case "yem_sapriceclausebase":
|
||||
// ClientUtils.countRealCatPrice(model, row);
|
||||
@ -466,6 +469,7 @@ public class InClientDemandZJFormPlugin extends AbstractBillPlugIn implements Be
|
||||
break;
|
||||
case "yem_truecarprice":
|
||||
// ClientUtils.countRealCatAmount(model, row);
|
||||
ClientUtils.countRealCatAmountZJ(model, row);//整机合同整机非赠品行实际整车金额
|
||||
ClientUtils.countRealCatPriceRMB(model, row);
|
||||
break;
|
||||
case "yem_truecarpriceba":
|
||||
@ -527,6 +531,8 @@ public class InClientDemandZJFormPlugin extends AbstractBillPlugIn implements Be
|
||||
ClientUtils.totalSaFobAmount(model, "yem_im_detailedinfor", "yem_ifgift", "yem_totalamount", "yem_sumcost");//总费用 汇总表头 总费用
|
||||
// ClientUtils.countSaPricePriceClause(model, row);//计算销售单价(价格条款)
|
||||
ClientUtils.addSaAmountTk(model, row);//销售金额(价格条款)结算币别
|
||||
ClientUtils.countSaPricePriceClauseZJ(model, row);//整机合同整机非赠品行销售单价(价格条款)
|
||||
ClientUtils.countRealCatPriceZJ(model, row);//整机合同整机非赠品行实际整车单价
|
||||
break;
|
||||
case "yem_lenghtunit"://长度单位
|
||||
case "yem_vol"://体积
|
||||
@ -537,11 +543,13 @@ public class InClientDemandZJFormPlugin extends AbstractBillPlugIn implements Be
|
||||
// ClientUtils.countRealCatPrice(model, row);
|
||||
ClientUtils.countFrontDisPrice(model, row);//折扣前单价
|
||||
ClientUtils.addSaAmountTk(model, row);//销售金额(价格条款)结算币别
|
||||
|
||||
ClientUtils.countSaPricePriceClauseZJ(model, row);//整机合同整机非赠品行销售单价(价格条款)
|
||||
// ClientUtils.countSaPricePriceClause(model, row);//计算销售单价(价格条款)
|
||||
break;
|
||||
case "yem_afterfrontdisprice"://折扣后销售单价
|
||||
// ClientUtils.countSaPricePriceClause(model, row);//计算销售单价(价格条款)
|
||||
ClientUtils.countSaPricePriceClauseZJ(model, row);//整机合同整机非赠品行销售单价(价格条款)
|
||||
ClientUtils.countRealCatPriceZJ(model, row);//整机合同整机非赠品行实际整车单价
|
||||
break;
|
||||
case "yem_accamtusetype"://配件资金使用方式
|
||||
ClientUtils.countDisAmt(model, "yem_im_detailedinfor", row, view);//计算折扣金额
|
||||
|
@ -16,6 +16,8 @@ import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
|
||||
import static com.yem.wm.es.salesorder.from.SalesOrderEdit.isZJ;
|
||||
|
||||
/**
|
||||
* @author 张立攀
|
||||
* @version 1.0
|
||||
@ -511,6 +513,11 @@ public class ClientUtils {
|
||||
*/
|
||||
public static void countRealCatPrice(IDataModel model, int rowNow) {
|
||||
boolean ifgift = (boolean) model.getValue("yem_ifgift", rowNow);
|
||||
String businesssort = (String) model.getValue("yem_businesssort", rowNow);
|
||||
if (isZJ(model) && "Z".equals(businesssort) && !ifgift) {
|
||||
//整机合同整机行(非配件行不计算)
|
||||
return;
|
||||
}
|
||||
if (!ifgift) {
|
||||
// BigDecimal sapriceclausebase = (BigDecimal) model.getValue("yem_sapricepriceclause", rowNow);
|
||||
// BigDecimal pricefieldacc = (BigDecimal) model.getValue("yem_pricefieldaccba", rowNow);
|
||||
@ -530,6 +537,11 @@ public class ClientUtils {
|
||||
|
||||
public static void countRealCatAmount(IDataModel model, int rowNow) {
|
||||
boolean ifgift = (boolean) model.getValue("yem_ifgift", rowNow);
|
||||
String businesssort = (String) model.getValue("yem_businesssort", rowNow);
|
||||
if (isZJ(model) && "Z".equals(businesssort) && !ifgift) {
|
||||
//整机合同整机行(非配件行)不计算
|
||||
return;
|
||||
}
|
||||
if (!ifgift) {
|
||||
BigDecimal saamtpriceclause = (BigDecimal) model.getValue("yem_saamtpriceclause", rowNow); // 销售金额(价格条款)
|
||||
BigDecimal pricefieldaccamt = (BigDecimal) model.getValue("yem_pricefieldaccamt", rowNow); // 资源配件金额
|
||||
@ -1184,6 +1196,11 @@ public class ClientUtils {
|
||||
public static void countSaPricePriceClause(IDataModel model, int row) {
|
||||
BigDecimal afterFrontDisPrice = (BigDecimal) model.getValue("yem_afterfrontdisprice", row); // 折扣后销售单价
|
||||
boolean ifgift = (boolean) model.getValue("yem_ifgift", row);
|
||||
String businesssort = (String) model.getValue("yem_businesssort", row);
|
||||
if (isZJ(model) && "Z".equals(businesssort) && !ifgift) {
|
||||
//整机合同整机行(非配件行不计算)
|
||||
return;
|
||||
}
|
||||
BigDecimal qty = (BigDecimal) model.getValue("yem_qty", row);//数量
|
||||
if (!ifgift) {
|
||||
BigDecimal priceFieldAccBa = (BigDecimal) model.getValue("yem_pricefieldaccba", row);//资源配置单价
|
||||
@ -1219,6 +1236,11 @@ public class ClientUtils {
|
||||
*/
|
||||
public static void addSaAmountTk(IDataModel model, int rowNow) {
|
||||
boolean ifgift = (boolean) model.getValue("yem_ifgift", rowNow);
|
||||
String businesssort = (String) model.getValue("yem_businesssort", rowNow);
|
||||
if (isZJ(model) && "Z".equals(businesssort) && !ifgift) {
|
||||
//整机合同整机行(非配件行不计算)
|
||||
return;
|
||||
}
|
||||
String[] roundArr = {
|
||||
"yem_es_salesorder_ZJ",
|
||||
"yem_es_salesorder_nmzj",
|
||||
@ -1257,6 +1279,58 @@ public class ClientUtils {
|
||||
// calculateInsurancePremiums(rowNow, model);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 整机计算 销售单价(价格条款)=折扣后销售单价+单车总费用+资源配件单价
|
||||
* @param model
|
||||
* @param row
|
||||
*/
|
||||
public static void countSaPricePriceClauseZJ(IDataModel model, int row) {
|
||||
BigDecimal afterfrontdisprice = (BigDecimal) model.getValue("yem_afterfrontdisprice", row);//折扣后销售单价
|
||||
BigDecimal onecarsum = (BigDecimal) model.getValue("yem_onecarsum", row);//单车总费用
|
||||
BigDecimal pricefieldaccba = (BigDecimal) model.getValue("yem_pricefieldaccba", row);//资源配件单价
|
||||
BigDecimal add = afterfrontdisprice.add(onecarsum).add(pricefieldaccba);
|
||||
add = add.setScale(0, RoundingMode.UP);
|
||||
model.setValue("yem_sapricepriceclause", add, row);
|
||||
}
|
||||
|
||||
/**
|
||||
* 整机 销售金额(价格条款)=销售单价(价格条款)*数量
|
||||
* @param model
|
||||
* @param row
|
||||
*/
|
||||
public static void addSaAmountTkZJ(IDataModel model, int row) {
|
||||
BigDecimal sapricepriceclause = (BigDecimal) model.getValue("yem_sapricepriceclause", row);//销售单价(价格条款)
|
||||
BigDecimal qty = (BigDecimal) model.getValue("yem_qty", row);//数量
|
||||
BigDecimal multiply = sapricepriceclause.multiply(qty);
|
||||
model.setValue("yem_saamtpriceclause", multiply, row);
|
||||
}
|
||||
|
||||
/**
|
||||
* 整机 实际整车单价=折扣后销售单价+单车总费用
|
||||
* @param model
|
||||
* @param row
|
||||
*/
|
||||
public static void countRealCatPriceZJ(IDataModel model, int row) {
|
||||
BigDecimal afterfrontdisprice = (BigDecimal) model.getValue("yem_afterfrontdisprice", row);
|
||||
BigDecimal onecarsum = (BigDecimal) model.getValue("yem_onecarsum", row);
|
||||
BigDecimal add = afterfrontdisprice.add(onecarsum);
|
||||
add = add.setScale(0, RoundingMode.UP);
|
||||
model.setValue("yem_truecarprice", add, row);
|
||||
}
|
||||
|
||||
/**
|
||||
* 整机 实际整车金额=实际整车单价*数量
|
||||
* @param model
|
||||
* @param row
|
||||
*/
|
||||
public static void countRealCatAmountZJ(IDataModel model, int row) {
|
||||
BigDecimal truecarprice = (BigDecimal) model.getValue("yem_truecarprice", row);
|
||||
BigDecimal qty = (BigDecimal) model.getValue("yem_qty", row);
|
||||
BigDecimal multiply = truecarprice.multiply(qty);
|
||||
model.setValue("yem_truecaramt", multiply, row);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算保险费
|
||||
* 保险费=(FOB单价+海运费)*保险加成率*运保费率/100
|
||||
|
Loading…
Reference in New Issue
Block a user