Compare commits
4 Commits
7f3dcb4e65
...
51e0d68059
Author | SHA1 | Date | |
---|---|---|---|
![]() |
51e0d68059 | ||
![]() |
1c5a7e853f | ||
![]() |
a27d050b49 | ||
![]() |
5a2d7edaa0 |
@ -284,6 +284,7 @@ public class SalesOrderZJEdit extends AbstractBillPlugIn implements Plugin, Befo
|
||||
countCalculationAmt();
|
||||
ClientUtils.changeRate(model, "yem_es_materialinfo");
|
||||
ClientUtils.clearSalePrice(this.getModel());
|
||||
ClientUtils.calculateSalesFCAStandardQingdaoUnitPrice(model, rowIndex);//销售FCA标配青岛单价
|
||||
break;
|
||||
case "yem_qty":
|
||||
setRandomDataTools();
|
||||
@ -300,6 +301,7 @@ public class SalesOrderZJEdit extends AbstractBillPlugIn implements Plugin, Befo
|
||||
syncDeductionGifts(model, rowIndex);
|
||||
ClientUtils.addSaAmountTkZJ(model, rowIndex);//整机合同整机非赠品行销售单价(价格条款)
|
||||
ClientUtils.countRealCatAmountZJ(model, rowIndex);//整机合同整机非赠品行实际整车金额
|
||||
ClientUtils.calculateSalesFCAStandardQingdaoUnitAmount(model, rowIndex);//销售FCA标配青岛金额
|
||||
break;
|
||||
case "yem_saamtpriceclause"://销售金额(价格条款)
|
||||
ClientUtils.totalSaFobAmount(model, "yem_es_materialinfo", "yem_ifgift", "yem_saamtpriceclause", "yem_offeramount");//销售金额(价格条款)汇总表头 金额价格条款
|
||||
@ -310,6 +312,7 @@ public class SalesOrderZJEdit extends AbstractBillPlugIn implements Plugin, Befo
|
||||
case "yem_standardprice"://标配FOB(青岛价)
|
||||
ClientUtils.fobPriceAdd(model, materialInfo);//FOB单价
|
||||
ClientUtils.countFobAmtSale(model, rowIndex);//销售FOB标配青岛单价
|
||||
ClientUtils.calculateSalesFCAStandardQingdaoUnitPrice(model, rowIndex);//销售FCA标配青岛单价
|
||||
break;
|
||||
case "yem_truecarpriceba":
|
||||
ClientUtils.countRealCatAmountRMB(model, rowIndex);
|
||||
@ -357,6 +360,7 @@ public class SalesOrderZJEdit extends AbstractBillPlugIn implements Plugin, Befo
|
||||
break;
|
||||
case "yem_unitsetamount"://单台加价金额
|
||||
ClientUtils.addSaPrice(model, materialInfo);//销售FOB单价(结算币别)
|
||||
ClientUtils.calculateSalesFOBUnitPrice(model, -1);//计算销售FOB单价
|
||||
break;
|
||||
|
||||
case "yem_sapricepriceclause"://销售单价(价格条款)结算币别
|
||||
@ -505,6 +509,13 @@ public class SalesOrderZJEdit extends AbstractBillPlugIn implements Plugin, Befo
|
||||
case "yem_interestdays":
|
||||
ClientUtils.calculateBankInterestCharges(-1, model);//银行利息费
|
||||
break;
|
||||
case "yem_sastandardfcaprice":
|
||||
ClientUtils.calculateSalesFCAStandardQingdaoUnitAmount(model, rowIndex);//销售FCA标配青岛金额
|
||||
ClientUtils.calculateSalesFOBUnitPrice(model, rowIndex);//计算销售FOB单价
|
||||
break;
|
||||
case "yem_fobsubfcaamt":
|
||||
ClientUtils.calculateSalesFOBUnitPrice(model, rowIndex);//计算销售FOB单价
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.yem.wm.im.clientdemand.utils;
|
||||
|
||||
import com.sun.tools.doclets.formats.html.resources.standard;
|
||||
import com.yem.tws.common1.BigDecimalUtils;
|
||||
import com.yem.wm.utils.YEM;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
@ -192,19 +193,25 @@ public class ClientUtils {
|
||||
* 获取标准价中 计算fob价(整机分录行)
|
||||
*/
|
||||
public static void fobPriceAdd(DynamicObjectCollection dy, BigDecimal yem_exrate, int rowInfo, DynamicObject dynamicObject, IDataModel models) {
|
||||
//计算多功能配置页签 标准销售价价计算总额
|
||||
DynamicObject currEntry = dy.get(rowInfo);
|
||||
//fob单价计算
|
||||
DynamicObject dataEntity = models.getDataEntity(true);
|
||||
String yembilltype = dataEntity.getString("yem_billtype.number");
|
||||
BigDecimal pricefob = BigDecimal.ZERO;
|
||||
if ("yem_im_inclientdeman_zj".equals(yembilltype) || "yem_es_salesorder_nmzj".equals(yembilltype) || "yem_es_xsalesorder_nmzj".equals(yembilltype)) {
|
||||
pricefob = dynamicObject.getBigDecimal("yem_foreigntradeprice");
|
||||
}
|
||||
if ("yem_im_clientdeman_zj".equals(yembilltype) || "yem_es_salesorder_ZJ".equals(yembilltype) || "yem_es_xsalesorder_zj".equals(yembilltype)) {
|
||||
pricefob = dynamicObject.getBigDecimal("yem_pricefob");
|
||||
if (!isFCAPriceItem(currEntry)) {
|
||||
if ("yem_im_inclientdeman_zj".equals(yembilltype) || "yem_es_salesorder_nmzj".equals(yembilltype) || "yem_es_xsalesorder_nmzj".equals(yembilltype)) {
|
||||
pricefob = dynamicObject.getBigDecimal("yem_foreigntradeprice");
|
||||
}
|
||||
if ("yem_im_clientdeman_zj".equals(yembilltype) || "yem_es_salesorder_ZJ".equals(yembilltype) || "yem_es_xsalesorder_zj".equals(yembilltype)) {
|
||||
pricefob = dynamicObject.getBigDecimal("yem_pricefob");
|
||||
}
|
||||
} else {
|
||||
pricefob = dynamicObject.getBigDecimal("yem_fcafactoryprice");//FCA工厂价
|
||||
}
|
||||
BigDecimal fobsubfcaamt = dynamicObject.getBigDecimal("yem_fobsubfcaamt");//FOB与FCA费用差额
|
||||
models.setValue("yem_fobsubfcaamt", fobsubfcaamt, rowInfo);//FOB与FCA费用差额
|
||||
|
||||
//计算多功能配置页签 标准销售价价计算总额
|
||||
DynamicObject currEntry = dy.get(rowInfo);
|
||||
if (currEntry != null) {
|
||||
BigDecimal fobPrice = BigDecimal.ZERO;
|
||||
DynamicObjectCollection dc = currEntry.getDynamicObjectCollection("yem_multiconfig");
|
||||
@ -377,7 +384,10 @@ public class ClientUtils {
|
||||
models.setValue("yem_exwrmbprice", dm.getBigDecimal("yem_standsalesprice"), rowInfo);
|
||||
}
|
||||
if (yem_exrate.compareTo(BigDecimal.ZERO) != 0) {
|
||||
models.setValue("yem_safobprice", roundUpNew(dm.getBigDecimal("yem_standsalesprice").divide(yem_exrate, RoundingMode.HALF_UP)), rowInfo);
|
||||
DynamicObjectCollection coll = getTypeColl(models);
|
||||
if (!isFCAPriceItem(coll, rowInfo)) {
|
||||
models.setValue("yem_safobprice", roundUpNew(dm.getBigDecimal("yem_standsalesprice").divide(yem_exrate, RoundingMode.HALF_UP)), rowInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -469,7 +479,10 @@ public class ClientUtils {
|
||||
// }else {
|
||||
// }
|
||||
if ("Z".equals(businesssort)) {
|
||||
model.setValue("yem_safobprice", fobPrice.add(sastandardprice), rowNow);
|
||||
DynamicObjectCollection coll = getTypeColl(model);
|
||||
if (!isFCAPriceItem(coll, rowNow)) {
|
||||
model.setValue("yem_safobprice", fobPrice.add(sastandardprice), rowNow);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1756,6 +1769,112 @@ public class ClientUtils {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isFCAPriceItem(DynamicObjectCollection collection, int idx) {
|
||||
String propKey = "yem_priceitemsp";
|
||||
DynamicObject d = collection.get(idx);
|
||||
if (d.containsProperty(propKey)) {
|
||||
DynamicObject priceItem = d.getDynamicObject(propKey);
|
||||
if (YEM.isNotEmpty(priceItem)) {
|
||||
String name = priceItem.getString("name");
|
||||
return "FCA".equals(name);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isFCAPriceItem(DynamicObject d) {
|
||||
DynamicObjectCollection collection = new DynamicObjectCollection();
|
||||
collection.add(d);
|
||||
return isFCAPriceItem(collection, 0);
|
||||
}
|
||||
|
||||
public static boolean isFCAPriceItem(IDataModel model, int idx) {
|
||||
DynamicObject priceitemsp = (DynamicObject) model.getValue("yem_priceitemsp", idx);
|
||||
if (YEM.isNotEmpty(priceitemsp)) {
|
||||
String name = priceitemsp.getString("name");
|
||||
return "FCA".equals(name);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算销售FCA标配青岛单价
|
||||
*
|
||||
* 销售FCA标配青岛单价 = 标配FOB(青岛)价 / 汇率,向上取整,保留整数,业务存在手动调整
|
||||
*
|
||||
* @param model
|
||||
* @param idx
|
||||
*/
|
||||
public static void calculateSalesFCAStandardQingdaoUnitPrice(IDataModel model, int idx) {
|
||||
if (isFCAPriceItem(model, idx)) {
|
||||
BigDecimal standardprice = (BigDecimal) model.getValue("yem_standardprice", idx);//标配FOB(青岛)价
|
||||
BigDecimal exrate = (BigDecimal) model.getValue("yem_exrate");//汇率
|
||||
BigDecimal calc = BigDecimalUtils.div(standardprice, exrate, 10);
|
||||
calc = calc.setScale(0, RoundingMode.UP);
|
||||
model.setValue("yem_sastandardfcaprice", calc, idx);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 销售FCA标配青岛金额
|
||||
*
|
||||
* 销售FCA标配青岛金额=销售FCA标配青岛单价*数量
|
||||
*
|
||||
* @param model
|
||||
* @param idx
|
||||
*/
|
||||
public static void calculateSalesFCAStandardQingdaoUnitAmount(IDataModel model, int idx) {
|
||||
BigDecimal sastandardfcaprice = (BigDecimal) model.getValue("yem_sastandardfcaprice", idx);
|
||||
BigDecimal qty = (BigDecimal) model.getValue("yem_qty", idx);
|
||||
BigDecimal calc = sastandardfcaprice.multiply(qty);
|
||||
model.setValue("yem_sastandardfcaamt", calc, idx);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算销售FOB单价
|
||||
*
|
||||
* 销售FOB单价=商品明细对应多功能配置中 单台加价金额(结算币别)合计值 + 销售FCA标配青岛单价+FOB与FCA费用差额
|
||||
*/
|
||||
public static void calculateSalesFOBUnitPrice(IDataModel model, int idx) {
|
||||
if (!isFCAPriceItem(model, idx)) {
|
||||
return;
|
||||
}
|
||||
|
||||
DynamicObject dataEntity = model.getDataEntity(true);
|
||||
DynamicObjectCollection c = dataEntity.getDynamicObjectCollection("yem_es_materialinfo");
|
||||
|
||||
if (idx != -1) {
|
||||
DynamicObject d = c.get(idx);
|
||||
DynamicObjectCollection subC = d.getDynamicObjectCollection("yem_multiconfig");
|
||||
BigDecimal sumAmt = BigDecimal.ZERO;
|
||||
for (DynamicObject sub : subC) {
|
||||
BigDecimal decimal = sub.getBigDecimal("yem_unitsetamount");
|
||||
sumAmt = sumAmt.add(decimal);
|
||||
}
|
||||
|
||||
BigDecimal sastandardfcaprice = (BigDecimal) model.getValue("yem_sastandardfcaprice", idx);//销售FCA标配青岛单价
|
||||
BigDecimal fobsubfcaamt = (BigDecimal) model.getValue("yem_fobsubfcaamt", idx);//FOB与FCA费用差额
|
||||
BigDecimal calc = sumAmt.add(sastandardfcaprice).add(fobsubfcaamt);
|
||||
model.setValue("yem_safobprice", calc, idx);
|
||||
} else {
|
||||
int rowCount = model.getEntryRowCount("yem_es_materialinfo");
|
||||
for (int i = 0; i < rowCount; i++) {
|
||||
DynamicObject d = c.get(i);
|
||||
DynamicObjectCollection subC = d.getDynamicObjectCollection("yem_multiconfig");
|
||||
BigDecimal sumAmt = BigDecimal.ZERO;
|
||||
for (DynamicObject sub : subC) {
|
||||
BigDecimal decimal = sub.getBigDecimal("yem_unitsetamount");
|
||||
sumAmt = sumAmt.add(decimal);
|
||||
}
|
||||
|
||||
BigDecimal sastandardfcaprice = (BigDecimal) model.getValue("yem_sastandardfcaprice", i);//销售FCA标配青岛单价
|
||||
BigDecimal fobsubfcaamt = (BigDecimal) model.getValue("yem_fobsubfcaamt", i);//FOB与FCA费用差额
|
||||
BigDecimal calc = sumAmt.add(sastandardfcaprice).add(fobsubfcaamt);
|
||||
model.setValue("yem_safobprice", calc, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user