fix:配件价格库获取标准价条件增加
This commit is contained in:
parent
349940649a
commit
ccde1671b9
@ -84,17 +84,17 @@ public class ClientUtils {
|
|||||||
if (spmodel != null) {
|
if (spmodel != null) {
|
||||||
products = spmodel.getLong("yem_products.id");
|
products = spmodel.getLong("yem_products.id");
|
||||||
}
|
}
|
||||||
String yemBdProductsid = "";
|
String yemBdProductsid = "";
|
||||||
if (yemBdProducts!=null){
|
if (yemBdProducts != null) {
|
||||||
yemBdProductsid = yemBdProducts.getString("number");
|
yemBdProductsid = yemBdProducts.getString("number");
|
||||||
}
|
}
|
||||||
if ("P".equals(businesssort)){
|
if ("P".equals(businesssort)) {
|
||||||
if ("CC".equals(yemBdProducts.getString("number"))){//叉车
|
if ("CC".equals(yemBdProducts.getString("number"))) {//叉车
|
||||||
yemBdProductsid= "CCPJ";
|
yemBdProductsid = "CCPJ";
|
||||||
}else if ("ZZJ".equals(yemBdProducts.getString("number"))){//装载机
|
} else if ("ZZJ".equals(yemBdProducts.getString("number"))) {//装载机
|
||||||
yemBdProductsid= "ZZJPJ";
|
yemBdProductsid = "ZZJPJ";
|
||||||
} else if ("TLJ".equals(yemBdProducts.getString("number"))) {//拖拉机
|
} else if ("TLJ".equals(yemBdProducts.getString("number"))) {//拖拉机
|
||||||
yemBdProductsid= "TLJPJ";
|
yemBdProductsid = "TLJPJ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//客户需求单整机 -整机分录行
|
//客户需求单整机 -整机分录行
|
||||||
@ -103,7 +103,7 @@ public class ClientUtils {
|
|||||||
list.add(new QFilter("yem_bd_products.id", QCP.equals, products));
|
list.add(new QFilter("yem_bd_products.id", QCP.equals, products));
|
||||||
list.add(new QFilter("billstatus", QCP.equals, "C"));
|
list.add(new QFilter("billstatus", QCP.equals, "C"));
|
||||||
list.add(new QFilter("yem_billtype.number", QCP.equals, "yem_pricelibrary_ZJ"));
|
list.add(new QFilter("yem_billtype.number", QCP.equals, "yem_pricelibrary_ZJ"));
|
||||||
list.add(new QFilter("yem_cancelstatus",QCP.equals,"0"));
|
list.add(new QFilter("yem_cancelstatus", QCP.equals, "0"));
|
||||||
// list.add(new QFilter("yem_productclass.number",QCP.equals,yemBdProductsid));
|
// list.add(new QFilter("yem_productclass.number",QCP.equals,yemBdProductsid));
|
||||||
//读取价格库数据
|
//读取价格库数据
|
||||||
DynamicObject yem_pricelibrary = null;
|
DynamicObject yem_pricelibrary = null;
|
||||||
@ -192,19 +192,25 @@ public class ClientUtils {
|
|||||||
* 获取标准价中 计算fob价(整机分录行)
|
* 获取标准价中 计算fob价(整机分录行)
|
||||||
*/
|
*/
|
||||||
public static void fobPriceAdd(DynamicObjectCollection dy, BigDecimal yem_exrate, int rowInfo, DynamicObject dynamicObject, IDataModel models) {
|
public static void fobPriceAdd(DynamicObjectCollection dy, BigDecimal yem_exrate, int rowInfo, DynamicObject dynamicObject, IDataModel models) {
|
||||||
|
//计算多功能配置页签 标准销售价价计算总额
|
||||||
|
DynamicObject currEntry = dy.get(rowInfo);
|
||||||
//fob单价计算
|
//fob单价计算
|
||||||
DynamicObject dataEntity = models.getDataEntity(true);
|
DynamicObject dataEntity = models.getDataEntity(true);
|
||||||
String yembilltype = dataEntity.getString("yem_billtype.number");
|
String yembilltype = dataEntity.getString("yem_billtype.number");
|
||||||
BigDecimal pricefob = BigDecimal.ZERO;
|
BigDecimal pricefob = BigDecimal.ZERO;
|
||||||
if ("yem_im_inclientdeman_zj".equals(yembilltype) || "yem_es_salesorder_nmzj".equals(yembilltype) || "yem_es_xsalesorder_nmzj".equals(yembilltype)) {
|
if (!isFCAPriceItem(currEntry)) {
|
||||||
pricefob = dynamicObject.getBigDecimal("yem_foreigntradeprice");
|
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 ("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) {
|
if (currEntry != null) {
|
||||||
BigDecimal fobPrice = BigDecimal.ZERO;
|
BigDecimal fobPrice = BigDecimal.ZERO;
|
||||||
DynamicObjectCollection dc = currEntry.getDynamicObjectCollection("yem_multiconfig");
|
DynamicObjectCollection dc = currEntry.getDynamicObjectCollection("yem_multiconfig");
|
||||||
@ -331,7 +337,8 @@ public class ClientUtils {
|
|||||||
list.add(new QFilter("billstatus", QCP.equals, "C"));
|
list.add(new QFilter("billstatus", QCP.equals, "C"));
|
||||||
list.add(new QFilter("yem_billtype.number", QCP.equals, "yem_pricelibrary_PJ"));
|
list.add(new QFilter("yem_billtype.number", QCP.equals, "yem_pricelibrary_PJ"));
|
||||||
list.add(new QFilter("yem_accessory.yem_material.id", QCP.equals, materialId));
|
list.add(new QFilter("yem_accessory.yem_material.id", QCP.equals, materialId));
|
||||||
list.add(new QFilter("yem_productclass.number",QCP.equals,yemBdProducts));
|
list.add(new QFilter("yem_productclass.number", QCP.equals, yemBdProducts));
|
||||||
|
list.add(new QFilter("yem_cancelstatus", QCP.equals, "0"));
|
||||||
//DynamicObject yem_material = BusinessDataServiceHelper.loadSingle("yem_pricelibrary","yem_accessory.yem_material,yem_accessory.yem_standsalesprice", list.toArray(new QFilter[0]));
|
//DynamicObject yem_material = BusinessDataServiceHelper.loadSingle("yem_pricelibrary","yem_accessory.yem_material,yem_accessory.yem_standsalesprice", list.toArray(new QFilter[0]));
|
||||||
DynamicObject[] yem_material = BusinessDataServiceHelper.load("yem_pricelibrary", "billno,yem_accessory.yem_material,yem_accessory.yem_standsalesprice,auditdate", list.toArray(new QFilter[0]));
|
DynamicObject[] yem_material = BusinessDataServiceHelper.load("yem_pricelibrary", "billno,yem_accessory.yem_material,yem_accessory.yem_standsalesprice,auditdate", list.toArray(new QFilter[0]));
|
||||||
DynamicObject nowMaterial = null;
|
DynamicObject nowMaterial = null;
|
||||||
@ -368,16 +375,25 @@ public class ClientUtils {
|
|||||||
if (yem_accessory != null && yem_accessory.size() > 0) {
|
if (yem_accessory != null && yem_accessory.size() > 0) {
|
||||||
for (DynamicObject dm : yem_accessory) {
|
for (DynamicObject dm : yem_accessory) {
|
||||||
long yem_materials = dm.getLong("yem_material.id");//价格库物料内码
|
long yem_materials = dm.getLong("yem_material.id");//价格库物料内码
|
||||||
|
String yemBillstatusfield = dm.getString("yem_billstatusfield");
|
||||||
|
|
||||||
if (materialId == yem_materials) {
|
if (materialId == yem_materials) {
|
||||||
pjDatas.add(dm);
|
pjDatas.add(dm);
|
||||||
if (dm != null) {
|
if (dm != null) {
|
||||||
models.setValue("yem_fobprice", dm.getBigDecimal("yem_standsalesprice"), rowInfo);
|
models.setValue("yem_fobprice", dm.getBigDecimal("yem_standsalesprice"), rowInfo);
|
||||||
String yembilltype = models.getDataEntityType().getName();
|
String yembilltype = models.getDataEntityType().getName();
|
||||||
if ("yem_es_salesorder".equals(yembilltype) || "yem_es_xsalesorder".equals(yembilltype)) {
|
if ("B".equals(yemBillstatusfield)) {
|
||||||
models.setValue("yem_exwrmbprice", dm.getBigDecimal("yem_standsalesprice"), rowInfo);
|
if ("yem_es_salesorder".equals(yembilltype) || "yem_es_xsalesorder".equals(yembilltype)) {
|
||||||
}
|
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);
|
if (yem_exrate.compareTo(BigDecimal.ZERO) != 0) {
|
||||||
|
DynamicObjectCollection coll = getTypeColl(models);
|
||||||
|
if (!isFCAPriceItem(coll, rowInfo)) {
|
||||||
|
models.setValue("yem_safobprice", roundUpNew(dm.getBigDecimal("yem_standsalesprice").divide(yem_exrate, RoundingMode.HALF_UP)), rowInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
info.append("明细信息 第" + (rowInfo + 1) + "行未获取到标准价,请及时询价!\r\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -437,7 +453,7 @@ public class ClientUtils {
|
|||||||
BigDecimal exrate = (BigDecimal) model.getValue("yem_exrate");
|
BigDecimal exrate = (BigDecimal) model.getValue("yem_exrate");
|
||||||
BigDecimal standardprice = (BigDecimal) model.getValue("yem_standardprice", rowNow);
|
BigDecimal standardprice = (BigDecimal) model.getValue("yem_standardprice", rowNow);
|
||||||
if (exrate.compareTo(BigDecimal.ZERO) != 0) {
|
if (exrate.compareTo(BigDecimal.ZERO) != 0) {
|
||||||
model.setValue("yem_sastandardprice", roundUp(standardprice.divide(exrate, BigDecimal.ROUND_HALF_UP)), rowNow);
|
model.setValue("yem_sastandardprice", roundUp(standardprice.divide(exrate, RoundingMode.HALF_UP)), rowNow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -469,7 +485,10 @@ public class ClientUtils {
|
|||||||
// }else {
|
// }else {
|
||||||
// }
|
// }
|
||||||
if ("Z".equals(businesssort)) {
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -508,7 +527,7 @@ public class ClientUtils {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 实际整车单价
|
* 实际整车单价
|
||||||
*
|
* <p>
|
||||||
* 实际整车单价 = 实际整车金额 / 数量
|
* 实际整车单价 = 实际整车金额 / 数量
|
||||||
*/
|
*/
|
||||||
public static void countRealCatPrice(IDataModel model, int rowNow) {
|
public static void countRealCatPrice(IDataModel model, int rowNow) {
|
||||||
@ -531,7 +550,7 @@ public class ClientUtils {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 实际整车金额
|
* 实际整车金额
|
||||||
*
|
* <p>
|
||||||
* 实际整车金额 = 销售金额价格条款 - 资源配件金额
|
* 实际整车金额 = 销售金额价格条款 - 资源配件金额
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -583,7 +602,7 @@ public class ClientUtils {
|
|||||||
BigDecimal qty = (BigDecimal) model.getValue("yem_qty", rowNow);
|
BigDecimal qty = (BigDecimal) model.getValue("yem_qty", rowNow);
|
||||||
BigDecimal pricefieldaccamt = (BigDecimal) model.getValue("yem_pricefieldaccamt", rowNow);
|
BigDecimal pricefieldaccamt = (BigDecimal) model.getValue("yem_pricefieldaccamt", rowNow);
|
||||||
if (qty.compareTo(BigDecimal.ZERO) != 0) {
|
if (qty.compareTo(BigDecimal.ZERO) != 0) {
|
||||||
model.setValue("yem_pricefieldaccba", pricefieldaccamt.divide(qty, BigDecimal.ROUND_HALF_UP), rowNow);
|
model.setValue("yem_pricefieldaccba", pricefieldaccamt.divide(qty, RoundingMode.HALF_UP), rowNow);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
model.setValue("yem_pricefieldaccba", null, rowNow);
|
model.setValue("yem_pricefieldaccba", null, rowNow);
|
||||||
@ -672,7 +691,7 @@ public class ClientUtils {
|
|||||||
if ("Z".equals(businesssort)) {
|
if ("Z".equals(businesssort)) {
|
||||||
BigDecimal standardprice = (BigDecimal) model.getValue("yem_standardprice", i);
|
BigDecimal standardprice = (BigDecimal) model.getValue("yem_standardprice", i);
|
||||||
if (exrate.compareTo(BigDecimal.ZERO) != 0) {
|
if (exrate.compareTo(BigDecimal.ZERO) != 0) {
|
||||||
model.setValue("yem_sastandardprice", roundUp(standardprice.divide(exrate, BigDecimal.ROUND_HALF_UP)), i);
|
model.setValue("yem_sastandardprice", roundUp(standardprice.divide(exrate, RoundingMode.HALF_UP)), i);
|
||||||
}
|
}
|
||||||
BigDecimal sastandardprice = (BigDecimal) model.getValue("yem_sastandardprice", i);
|
BigDecimal sastandardprice = (BigDecimal) model.getValue("yem_sastandardprice", i);
|
||||||
model.setValue("yem_sastandardpricesa", sastandardprice.multiply(exrate), i);
|
model.setValue("yem_sastandardpricesa", sastandardprice.multiply(exrate), i);
|
||||||
@ -685,7 +704,7 @@ public class ClientUtils {
|
|||||||
for (DynamicObject temp : multiconfig) {
|
for (DynamicObject temp : multiconfig) {
|
||||||
BigDecimal marketraisepribase = temp.getBigDecimal("yem_marketraisepribase");
|
BigDecimal marketraisepribase = temp.getBigDecimal("yem_marketraisepribase");
|
||||||
if (exrate.compareTo(BigDecimal.ZERO) != 0) {
|
if (exrate.compareTo(BigDecimal.ZERO) != 0) {
|
||||||
model.setValue("yem_marketraiseprice", roundUp(marketraisepribase.divide(exrate, BigDecimal.ROUND_HALF_UP)), row, i);
|
model.setValue("yem_marketraiseprice", roundUp(marketraisepribase.divide(exrate, RoundingMode.HALF_UP)), row, i);
|
||||||
}
|
}
|
||||||
row++;
|
row++;
|
||||||
}
|
}
|
||||||
@ -694,7 +713,7 @@ public class ClientUtils {
|
|||||||
if ("P".equals(businesssort)) {
|
if ("P".equals(businesssort)) {
|
||||||
BigDecimal fobprice = (BigDecimal) model.getValue("yem_fobprice", i);
|
BigDecimal fobprice = (BigDecimal) model.getValue("yem_fobprice", i);
|
||||||
if (exrate.compareTo(BigDecimal.ZERO) != 0) {
|
if (exrate.compareTo(BigDecimal.ZERO) != 0) {
|
||||||
model.setValue("yem_safobprice", roundUpNew(fobprice.divide(exrate, BigDecimal.ROUND_HALF_UP)), i);
|
model.setValue("yem_safobprice", roundUpNew(fobprice.divide(exrate, RoundingMode.HALF_UP)), i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -916,7 +935,7 @@ public class ClientUtils {
|
|||||||
if (dy != null) {
|
if (dy != null) {
|
||||||
BigDecimal marketraisepribase = dy.getBigDecimal("yem_marketraisepribase");
|
BigDecimal marketraisepribase = dy.getBigDecimal("yem_marketraisepribase");
|
||||||
if (BigDecimal.ZERO.compareTo(exrate) != 0) {
|
if (BigDecimal.ZERO.compareTo(exrate) != 0) {
|
||||||
model.setValue("yem_marketraiseprice", roundUp(marketraisepribase.divide(exrate, BigDecimal.ROUND_HALF_UP)), sonIndex, partIndex);
|
model.setValue("yem_marketraiseprice", roundUp(marketraisepribase.divide(exrate, RoundingMode.HALF_UP)), sonIndex, partIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sonIndex++;
|
sonIndex++;
|
||||||
@ -992,11 +1011,7 @@ public class ClientUtils {
|
|||||||
String businessSort = (String) model.getValue("yem_businesssort", rowIndex);
|
String businessSort = (String) model.getValue("yem_businesssort", rowIndex);
|
||||||
boolean ifgift = (boolean) model.getValue("yem_ifgift", rowIndex);
|
boolean ifgift = (boolean) model.getValue("yem_ifgift", rowIndex);
|
||||||
if ("P".equals(businessSort)) {
|
if ("P".equals(businessSort)) {
|
||||||
if (ifgift) {
|
view.setEnable(ifgift, rowIndex, "yem_resourcenog");
|
||||||
view.setEnable(true, rowIndex, "yem_resourcenog");
|
|
||||||
} else {
|
|
||||||
view.setEnable(false, rowIndex, "yem_resourcenog");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1100,9 +1115,7 @@ public class ClientUtils {
|
|||||||
DynamicObject temp = (DynamicObject) model.getValue("yem_billtype");
|
DynamicObject temp = (DynamicObject) model.getValue("yem_billtype");
|
||||||
if (temp != null) {
|
if (temp != null) {
|
||||||
String billNumber = temp.getString("number");
|
String billNumber = temp.getString("number");
|
||||||
if ("yem_im_clientdeman_zj".equals(billNumber) || "yem_im_inclientdeman_zj".equals(billNumber)) {
|
return "yem_im_clientdeman_zj".equals(billNumber) || "yem_im_inclientdeman_zj".equals(billNumber);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1114,9 +1127,7 @@ public class ClientUtils {
|
|||||||
DynamicObject temp = (DynamicObject) model.getValue("yem_billtype");
|
DynamicObject temp = (DynamicObject) model.getValue("yem_billtype");
|
||||||
if (temp != null) {
|
if (temp != null) {
|
||||||
String billNumber = temp.getString("number");
|
String billNumber = temp.getString("number");
|
||||||
if ("yem_im_clientdema_pj".equals(billNumber) || "yem_im_inclientdema_pj".equals(billNumber)) {
|
return "yem_im_clientdema_pj".equals(billNumber) || "yem_im_inclientdema_pj".equals(billNumber);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1189,7 +1200,7 @@ public class ClientUtils {
|
|||||||
* @param[2] row
|
* @param[2] row
|
||||||
* return
|
* return
|
||||||
* @time 2023/8/10 19:55
|
* @time 2023/8/10 19:55
|
||||||
*
|
* <p>
|
||||||
* 销售单价(价格条款)= 销售FOB金额 /数量
|
* 销售单价(价格条款)= 销售FOB金额 /数量
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -1222,17 +1233,15 @@ public class ClientUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 销售金额(价格条款)结算币别
|
* 销售金额(价格条款)结算币别
|
||||||
*
|
* <p>
|
||||||
* 1、如果分录没有总费用、没有折扣金额,就是按照 数量*销售EXW单价
|
* 1、如果分录没有总费用、没有折扣金额,就是按照 数量*销售EXW单价
|
||||||
* 2、如果分录有总费用或者折扣金额,则销售金额(价格条款) = (折扣后销售金额 +总费用 )+ 资源配件单价 *数量
|
* 2、如果分录有总费用或者折扣金额,则销售金额(价格条款) = (折扣后销售金额 +总费用 )+ 资源配件单价 *数量
|
||||||
* 销售单价(价格条款)= 销售金额(价格条款) /数量
|
* 销售单价(价格条款)= 销售金额(价格条款) /数量
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public static void addSaAmountTk(IDataModel model, int rowNow) {
|
public static void addSaAmountTk(IDataModel model, int rowNow) {
|
||||||
boolean ifgift = (boolean) model.getValue("yem_ifgift", rowNow);
|
boolean ifgift = (boolean) model.getValue("yem_ifgift", rowNow);
|
||||||
@ -1282,6 +1291,7 @@ public class ClientUtils {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 整机计算 销售单价(价格条款)=折扣后销售单价+单车总费用+资源配件单价
|
* 整机计算 销售单价(价格条款)=折扣后销售单价+单车总费用+资源配件单价
|
||||||
|
*
|
||||||
* @param model
|
* @param model
|
||||||
* @param row
|
* @param row
|
||||||
*/
|
*/
|
||||||
@ -1296,6 +1306,7 @@ public class ClientUtils {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 整机 销售金额(价格条款)=销售单价(价格条款)*数量
|
* 整机 销售金额(价格条款)=销售单价(价格条款)*数量
|
||||||
|
*
|
||||||
* @param model
|
* @param model
|
||||||
* @param row
|
* @param row
|
||||||
*/
|
*/
|
||||||
@ -1308,6 +1319,7 @@ public class ClientUtils {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 整机 实际整车单价=折扣后销售单价+单车总费用
|
* 整机 实际整车单价=折扣后销售单价+单车总费用
|
||||||
|
*
|
||||||
* @param model
|
* @param model
|
||||||
* @param row
|
* @param row
|
||||||
*/
|
*/
|
||||||
@ -1321,6 +1333,7 @@ public class ClientUtils {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 整机 实际整车金额=实际整车单价*数量
|
* 整机 实际整车金额=实际整车单价*数量
|
||||||
|
*
|
||||||
* @param model
|
* @param model
|
||||||
* @param row
|
* @param row
|
||||||
*/
|
*/
|
||||||
@ -1334,6 +1347,7 @@ public class ClientUtils {
|
|||||||
/**
|
/**
|
||||||
* 计算保险费
|
* 计算保险费
|
||||||
* 保险费=(FOB单价+海运费)*保险加成率*运保费率/100
|
* 保险费=(FOB单价+海运费)*保险加成率*运保费率/100
|
||||||
|
*
|
||||||
* @param rowIdx
|
* @param rowIdx
|
||||||
* @param model
|
* @param model
|
||||||
*/
|
*/
|
||||||
@ -1396,8 +1410,9 @@ public class ClientUtils {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* // 银行利息费=(当前行销售FOB单价+海运费+保险费)*收款计划中的是否信保为是的收汇百分比%/100*利息率/100,利息率手填
|
* // 银行利息费=(当前行销售FOB单价+海运费+保险费)*收款计划中的是否信保为是的收汇百分比%/100*利息率/100,利息率手填
|
||||||
*
|
* <p>
|
||||||
* 银行利息费=(当前行销售FOB单价+海运费+保险费)*收款计划中的是否信保为是的收汇百分比%/100*利息率/100/360*利息天数
|
* 银行利息费=(当前行销售FOB单价+海运费+保险费)*收款计划中的是否信保为是的收汇百分比%/100*利息率/100/360*利息天数
|
||||||
|
*
|
||||||
* @param rowIdx
|
* @param rowIdx
|
||||||
* @param model
|
* @param model
|
||||||
*/
|
*/
|
||||||
@ -1628,11 +1643,27 @@ public class ClientUtils {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public static void countAfterFrontAmt(IDataModel model, int row) {
|
public static void countAfterFrontAmt(IDataModel model, int row) {
|
||||||
|
DynamicObject dataEntity = model.getDataEntity(true);
|
||||||
Boolean ifGift = (Boolean) model.getValue("yem_ifgift", row);
|
Boolean ifGift = (Boolean) model.getValue("yem_ifgift", row);
|
||||||
if (!ifGift) {
|
if (!ifGift) {
|
||||||
BigDecimal saFobAmount = (BigDecimal) model.getValue("yem_safobamount", row);
|
BigDecimal saFobAmount = (BigDecimal) model.getValue("yem_safobamount", row);
|
||||||
BigDecimal disAmt = (BigDecimal) model.getValue("yem_disamt", row);
|
BigDecimal disAmt = (BigDecimal) model.getValue("yem_disamt", row);
|
||||||
model.setValue("yem_afterfrontdisamt", saFobAmount.subtract(disAmt), row);
|
if (isFCAPriceItem(model, row)) {
|
||||||
|
// 折扣后销售金额 = 商品明细对应多功能配置中 单台加价金额(结算币别)合计值 + 销售FCA标配青岛单价- 折扣金额
|
||||||
|
DynamicObjectCollection c = dataEntity.getDynamicObjectCollection("yem_es_materialinfo");
|
||||||
|
|
||||||
|
DynamicObject d = c.get(row);
|
||||||
|
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", row);
|
||||||
|
model.setValue("yem_afterfrontdisamt", sumAmt.add(sastandardfcaprice).subtract(disAmt));
|
||||||
|
} else {
|
||||||
|
model.setValue("yem_afterfrontdisamt", saFobAmount.subtract(disAmt), row);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
model.setValue("yem_afterfrontdisamt", null, row);
|
model.setValue("yem_afterfrontdisamt", null, row);
|
||||||
}
|
}
|
||||||
@ -1793,6 +1824,300 @@ public class ClientUtils {
|
|||||||
model.endInit();
|
model.endInit();
|
||||||
view.updateView("yem_frontrateentry", idx);
|
view.updateView("yem_frontrateentry", idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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标配青岛单价
|
||||||
|
* <p>
|
||||||
|
* 销售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标配青岛金额
|
||||||
|
* <p>
|
||||||
|
* 销售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单价
|
||||||
|
* <p>
|
||||||
|
* 销售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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询物流价格核算表
|
||||||
|
*
|
||||||
|
* @param transportStyle 运输方式
|
||||||
|
* @param port 港口
|
||||||
|
* @param billingMethod 计费方式
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static BigDecimal queryLogisticsCosts(long transportStyle, long port, long billingMethod) {
|
||||||
|
QFilter qFilter = new QFilter("status", "=", "C");
|
||||||
|
qFilter.and("yem_entryentity.yem_shippingmethod.id", "=", transportStyle);
|
||||||
|
qFilter.and("yem_entryentity.yem_port.id", "=", port);
|
||||||
|
qFilter.and("yem_entryentity.yem_billingmethod.id", "=", billingMethod);
|
||||||
|
DynamicObject single = BusinessDataServiceHelper.loadSingle("yem_materialpriceing", qFilter.toArray());
|
||||||
|
DynamicObjectCollection entry = single.getDynamicObjectCollection("yem_entryentity");
|
||||||
|
for (DynamicObject d : entry) {
|
||||||
|
long e_transportStyle = d.getLong("yem_shippingmethod");
|
||||||
|
long e_port = d.getLong("yem_port");
|
||||||
|
long e_billingMethod = d.getLong("yem_billingmethod");
|
||||||
|
|
||||||
|
if (e_transportStyle == transportStyle && e_port == port && e_billingMethod == billingMethod) {
|
||||||
|
return d.getBigDecimal("yem_price");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return BigDecimal.ZERO;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 到【物流价格核算表】中查询到费用项目为【港杂费】的基础资料,根据合同的运输方式+明细.港口+费用信息.港杂费分录.计费方式 匹配 上述基础资料中的 运输方式+港口+计费方式
|
||||||
|
*
|
||||||
|
* @param model
|
||||||
|
* @param idx
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Map<String, Object> queryLogistics(IDataModel model, int idx, String expenseItemNo) {
|
||||||
|
DynamicObject dataEntity = model.getDataEntity(true);
|
||||||
|
DynamicObject transportstyle = dataEntity.getDynamicObject("yem_transportstyle");
|
||||||
|
DynamicObjectCollection materialinfo = dataEntity.getDynamicObjectCollection("yem_es_materialinfo");
|
||||||
|
DynamicObject d = materialinfo.get(idx);
|
||||||
|
DynamicObjectCollection ports = d.getDynamicObjectCollection("yem_port");
|
||||||
|
if (ports.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
DynamicObject port = ports.get(0).getDynamicObject("fbasedataid");
|
||||||
|
|
||||||
|
long billingMethod = queryBillingMethod(dataEntity, expenseItemNo);
|
||||||
|
|
||||||
|
if (YEM.isNotEmpty(transportstyle) && YEM.isNotEmpty(port) && YEM.isNotEmpty(billingMethod)) {
|
||||||
|
long transportsty = transportstyle.getLong("id");
|
||||||
|
long portId = port.getLong("id");
|
||||||
|
QFilter qFilter = new QFilter("yem_expenseitems.number", "=", expenseItemNo);
|
||||||
|
qFilter.and("yem_entryentity.yem_shippingmethod.id", "=", transportsty);
|
||||||
|
qFilter.and("yem_entryentity.yem_port.id", "=", portId);
|
||||||
|
qFilter.and("yem_entryentity.yem_billingmethod.id", "=", billingMethod);
|
||||||
|
DynamicObject logistics = BusinessDataServiceHelper.loadSingle("yem_materialpriceing", qFilter.toArray());
|
||||||
|
if (YEM.isNotEmpty(logistics)) {
|
||||||
|
DynamicObjectCollection c = logistics.getDynamicObjectCollection("yem_entryentity");
|
||||||
|
for (DynamicObject cd : c) {
|
||||||
|
int i = c.indexOf(cd);
|
||||||
|
long cd_shippingmethod = cd.getLong("yem_shippingmethod.id");//运输方式
|
||||||
|
long cd_port = cd.getLong("yem_port.id");//港口
|
||||||
|
long cd_billingmethod = cd.getLong("yem_billingmethod.id");//计费方式
|
||||||
|
if (cd_shippingmethod == transportsty && portId == cd_port && billingMethod == cd_billingmethod) {
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("idx", i);
|
||||||
|
map.put("obj", logistics);
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据重量物流价格核算表.明细信息.重量核算价格 查询价格
|
||||||
|
*
|
||||||
|
* @param entry 重量核算价格
|
||||||
|
* @param weight 重量
|
||||||
|
* @return 单价
|
||||||
|
*/
|
||||||
|
public static BigDecimal queryIntervalPrice(DynamicObjectCollection entry, BigDecimal weight) {
|
||||||
|
for (DynamicObject d : entry) {
|
||||||
|
BigDecimal from = d.getBigDecimal("yem_from");
|
||||||
|
BigDecimal reach = d.getBigDecimal("yem_reach");
|
||||||
|
if (weight.compareTo(from) >= 0 && weight.compareTo(reach) < 0) {
|
||||||
|
return d.getBigDecimal("yem_unitprice");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return BigDecimal.ZERO;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算港杂费
|
||||||
|
* <p>
|
||||||
|
* ①按方
|
||||||
|
* ②按台
|
||||||
|
* <p>
|
||||||
|
* ①港杂费=单价*方数*数量
|
||||||
|
* ②港杂费=单价*数量
|
||||||
|
*
|
||||||
|
* @param model 外销合同
|
||||||
|
* @param idx 明细行
|
||||||
|
*/
|
||||||
|
public static void calculatePortAmt(IDataModel model, int idx) {
|
||||||
|
BigDecimal qty = (BigDecimal) model.getValue("yem_qty", idx);
|
||||||
|
BigDecimal calc = BigDecimal.ZERO;
|
||||||
|
Map<String, Object> logistics = queryLogistics(model, idx, "FYXM0023.6");
|
||||||
|
if (YEM.isNotEmpty(logistics)) {
|
||||||
|
DynamicObject logisticsObj = (DynamicObject) logistics.get("obj");
|
||||||
|
int entryIdx = (int) logistics.get("idx");
|
||||||
|
DynamicObject entry = logisticsObj.getDynamicObjectCollection("yem_entryentity").get(entryIdx);
|
||||||
|
BigDecimal price = entry.getBigDecimal("yem_price");
|
||||||
|
BigDecimal squareqty = (BigDecimal) model.getValue("yem_squareqty", idx);
|
||||||
|
if (squareqty.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
calc = qty.multiply(price).multiply(squareqty);
|
||||||
|
} else {
|
||||||
|
calc = qty.multiply(price);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
model.setValue("yem_portamt", calc, idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算内陆运费
|
||||||
|
* <p>
|
||||||
|
* ①内陆运输=费用信息.区间单价*吨数
|
||||||
|
*
|
||||||
|
* @param model 外销合同
|
||||||
|
* @param idx 明细行
|
||||||
|
*/
|
||||||
|
public static void calcInlandTransportationAmt(IDataModel model, int idx) {
|
||||||
|
BigDecimal tonsqty = (BigDecimal) model.getValue("yem_tonsqty", idx);
|
||||||
|
BigDecimal price = BigDecimal.ZERO;
|
||||||
|
Map<String, Object> logistics = queryLogistics(model, idx, "FYXM0023.11");//内陆运费
|
||||||
|
if (YEM.isNotEmpty(logistics)) {
|
||||||
|
DynamicObject logisticsObj = (DynamicObject) logistics.get("obj");
|
||||||
|
int entryIdx = (int) logistics.get("idx");
|
||||||
|
DynamicObject entryObj = logisticsObj.getDynamicObjectCollection("yem_entryentity").get(entryIdx);
|
||||||
|
DynamicObjectCollection subC = entryObj.getDynamicObjectCollection("yem_subentryentity");
|
||||||
|
price = queryIntervalPrice(subC, tonsqty);
|
||||||
|
}
|
||||||
|
BigDecimal calc = price.multiply(tonsqty);
|
||||||
|
model.setValue("yem_inlandfreight", calc, idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选择基础机型、携带基础机型中产品机型的吨数
|
||||||
|
*
|
||||||
|
* @param model 外销合同
|
||||||
|
* @param idx 明细行
|
||||||
|
*/
|
||||||
|
public static void bringProductModelTons(IDataModel model, int idx) {
|
||||||
|
DynamicObject productmodel = (DynamicObject) model.getValue("yem_productmodel", idx);
|
||||||
|
if (YEM.isNotEmpty(productmodel)) {
|
||||||
|
DynamicObject products = productmodel.getDynamicObject("yem_products");
|
||||||
|
if (YEM.isNotEmpty(products)) {
|
||||||
|
products = BusinessDataServiceHelper.loadSingle(products.getPkValue(), products.getDynamicObjectType().getName());
|
||||||
|
BigDecimal tons = products.getBigDecimal("yem_tons");
|
||||||
|
model.setValue("yem_tonsqty", tons, idx);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
model.setValue("yem_tonsqty", BigDecimal.ZERO, idx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询费用项目对应的计费方式
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Long queryBillingMethod(DynamicObject dataEntity, String expenseItemNo) {
|
||||||
|
DynamicObjectCollection costinfor = dataEntity.getDynamicObjectCollection("yem_costinfor");
|
||||||
|
for (DynamicObject d : costinfor) {
|
||||||
|
DynamicObject padexpense = d.getDynamicObject("yem_padexpense");
|
||||||
|
if (YEM.isNotEmpty(padexpense)) {
|
||||||
|
String number = padexpense.getString("number");
|
||||||
|
if (expenseItemNo.equals(number)) {
|
||||||
|
DynamicObject chargemode = d.getDynamicObject("yem_bd_chargemode");
|
||||||
|
if (YEM.isNotEmpty(chargemode)) {
|
||||||
|
return chargemode.getLong("id");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0L;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user