From 1aa265b1857b13cefcb06d06839207a47515597c Mon Sep 17 00:00:00 2001 From: 25655 <2565550274@qq.com> Date: Thu, 6 Mar 2025 11:22:08 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=20=E8=8E=B7=E5=8F=96=E6=A0=87?= =?UTF-8?q?=E5=87=86=E4=BB=B7=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wm/im/clientdemand/utils/ClientUtils.java | 65 ++++++++++++++----- 1 file changed, 47 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/yem/wm/im/clientdemand/utils/ClientUtils.java b/src/main/java/com/yem/wm/im/clientdemand/utils/ClientUtils.java index 493759d7..371bd0bb 100644 --- a/src/main/java/com/yem/wm/im/clientdemand/utils/ClientUtils.java +++ b/src/main/java/com/yem/wm/im/clientdemand/utils/ClientUtils.java @@ -53,19 +53,21 @@ public class ClientUtils { if (!yem_linetype.equals("add")) { boolean tor = true; DynamicObjectCollection yemMulticonfig = temp.getDynamicObjectCollection("yem_multiconfig"); - if (!yemMulticonfig.isEmpty()){ + if (!yemMulticonfig.isEmpty()) { for (DynamicObject dynamicObject : yemMulticonfig) { String yemLinetypes = dynamicObject.getString("yem_linetypes"); - if ("add".equals(yemLinetypes)){ - tor= false; + if ("add".equals(yemLinetypes)) { + tor = false; } } } - if (tor){ + if (tor) { rowInfo++; continue; } } + } else { + yem_linetype = "add"; } //多功能配置分录行获取 DynamicObjectCollection multiconfig = null; @@ -158,19 +160,21 @@ public class ClientUtils { } } } - if ("yem_es_xsalesorder".equals(models.getDataEntityType().getName())){ + if ("yem_es_xsalesorder".equals(models.getDataEntityType().getName())) { int multiconfigIndex = 0; if (!multiconfig.isEmpty()) { for (DynamicObject dc : multiconfig) { - if ("add".equals(dc.getString("yem_linetypes"))){ + if ("add".equals(dc.getString("yem_linetypes"))) { long configentryid = dc.getLong("yem_configentryid"); BigDecimal configentry = dataMap.get(configentryid) == null ? BigDecimal.ZERO : dataMap.get(configentryid).setScale(2); models.setValue("yem_marketraisepribase", configentry, multiconfigIndex, rowInfo); multiconfigIndex++; + } else { + multiconfigIndex++; } } } - }else { + } else { setPriceNow(multiconfig, dataMap, rowInfo, models); } } @@ -202,7 +206,7 @@ public class ClientUtils { else if (("yem_im_clientdeman_zj".equals(yem_billtype) || "yem_im_inclientdeman_zj".equals(yem_billtype) || ("yem_es_salesorder_ZJ".equals(yem_billtype)) || "yem_es_salesorder_nmzj".equals(yem_billtype) || "yem_es_xsalesorder_zj".equals(yem_billtype) || "yem_es_xsalesorder_nmzj".equals(yem_billtype)) - && "P".equals(businesssort) && !yem_linetype.equals("add")) { + && "P".equals(businesssort) && yem_linetype.equals("add")) { // else if (("yem_im_clientdeman_zj".equals(yem_billtype) || "yem_im_inclientdeman_zj".equals(yem_billtype) || ("yem_es_salesorder_ZJ".equals(yem_billtype)) || "yem_es_salesorder_nmzj".equals(yem_billtype)) && "P".equals(businesssort)) { pjFindPrice(yem_exrate, info, pjDatas, rowInfo, list, materials, models, yemBdProductsid); } @@ -212,7 +216,7 @@ public class ClientUtils { else if (("yem_im_clientdema_pj".equals(yem_billtype) || "yem_im_inclientdema_pj".equals(yem_billtype) || "yem_es_salesorder_PJ".equals(yem_billtype) || "yem_es_salesorder_nmpj".equals(yem_billtype) || "yem_es_xsalesorder_pj".equals(yem_billtype) || "yem_es_xsalesorder_nmpj".equals(yem_billtype)) - && "P".equals(businesssort)&& !yem_linetype.equals("add")) { + && "P".equals(businesssort) && yem_linetype.equals("add")) { pjFindPrice(yem_exrate, info, pjDatas, rowInfo, list, materials, models, yemBdProductsid); } rowInfo++; @@ -366,7 +370,15 @@ public class ClientUtils { * 获取标准价中 给当前行标准销售加价赋值 */ public static void setPriceNow(DynamicObjectCollection multiconfig, Map dataMap, int rowInfo, IDataModel models) { - + int multiconfigIndex = 0; + if (!multiconfig.isEmpty()) { + for (DynamicObject dc : multiconfig) { + long configentryid = dc.getLong("yem_configentryid"); + BigDecimal configentry = dataMap.get(configentryid) == null ? BigDecimal.ZERO : dataMap.get(configentryid).setScale(2); + models.setValue("yem_marketraisepribase", configentry, multiconfigIndex, rowInfo); + multiconfigIndex++; + } + } } /** @@ -1489,22 +1501,39 @@ public class ClientUtils { private static void doCalculateBankInterestCharges(int rowIdx, IDataModel model) { BigDecimal safobprice = (BigDecimal) model.getValue("yem_safobprice", rowIdx);//销售FOB单价 BigDecimal seafreight = (BigDecimal) model.getValue("yem_e_seafreight", rowIdx);//海运费 + BigDecimal yemELandcarrycost = (BigDecimal) model.getValue("yem_e_landcarrycost", rowIdx);//国际陆运费 + BigDecimal yemEAirliftcost = (BigDecimal) model.getValue("yem_e_airliftcost", rowIdx);//空运费 + BigDecimal yemPortamt = (BigDecimal) model.getValue("yem_portamt", rowIdx);//港杂费 + BigDecimal yemInlandtransportation = (BigDecimal) model.getValue("yem_inlandtransportation", rowIdx);//内陆运输费 + BigDecimal yemEBankcost = (BigDecimal) model.getValue("yem_e_bankcost", rowIdx);//报关费 + BigDecimal yemEElsecost = (BigDecimal) model.getValue("yem_e_elsecost", rowIdx);//其他费用 + BigDecimal yemCostsinclude = (BigDecimal) model.getValue("yem_costsinclude", rowIdx);//费用包干 BigDecimal marinsupreamt = (BigDecimal) model.getValue("yem_e_marinsupreamt", rowIdx);//保险费 BigDecimal interestrate = (BigDecimal) model.getValue("yem_e_interestrate", rowIdx);//利息率% interestrate = BigDecimalUtils.div(interestrate, new BigDecimal("100"), 10); BigDecimal calculate = BigDecimal.ZERO; + BigDecimal interestdays = BigDecimal.ZERO; int rowCount = model.getEntryRowCount("yem_es_salescontrac_s"); for (int i = 0; i < rowCount; i++) { String issinosure = (String) model.getValue("yem_issinosure", i); if ("A".equals(issinosure)) { BigDecimal raprate = (BigDecimal) model.getValue("yem_raprate", i);//收汇百分比% - BigDecimal interestdays = (BigDecimal) model.getValue("yem_interestdays", i);//利息天数 - raprate = BigDecimalUtils.div(raprate, new BigDecimal("100"), 10); - BigDecimal multiply = BigDecimalUtils.div(safobprice.add(seafreight).add(marinsupreamt).multiply(raprate).multiply(interestrate), new BigDecimal("360"), 10).multiply(interestdays); - calculate = calculate.add(multiply); + interestdays = interestdays.add((BigDecimal) model.getValue("yem_interestdays", i));//利息天数 +// raprate = BigDecimalUtils.div(raprate, new BigDecimal("100"), 10); +// BigDecimal multiply = BigDecimalUtils.div(safobprice.add(seafreight).add(marinsupreamt).multiply(raprate).multiply(interestrate), new BigDecimal("360"), 10).multiply(interestdays); + calculate = calculate.add(raprate); } } - model.setValue("yem_e_interestamt", calculate.setScale(0, RoundingMode.UP), rowIdx); + BigDecimal yem_e_interestamt = seafreight.add(yemELandcarrycost).add(yemEAirliftcost).add(yemPortamt) + .add(yemInlandtransportation).add(yemEBankcost).add(yemEElsecost).add(yemCostsinclude).add(marinsupreamt); +// yem_e_interestamt = yem_e_interestamt.multiply(calculate).multiply(interestdays).multiply(interestrate.divide(new BigDecimal("100"),10).divide(new BigDecimal("360"),10)); + BigDecimal multiply = BigDecimalUtils.multiply(yem_e_interestamt, calculate, 10); + multiply = BigDecimalUtils.multiply(multiply, interestdays, 10); + multiply = BigDecimalUtils.multiply(multiply, interestrate, 10); + multiply = BigDecimalUtils.div(multiply, 100, 10); + multiply = BigDecimalUtils.div(multiply, 360, 10); +// BigDecimalUtils.div(yem_e_interestamt, new BigDecimal("100"), 10); + model.setValue("yem_e_interestamt", multiply.setScale(0, RoundingMode.UP), rowIdx); } /** @@ -1999,13 +2028,13 @@ public class ClientUtils { int rowCount = model.getEntryRowCount("yem_es_materialinfo"); for (int i = 0; i < rowCount; i++) { DynamicObject d = c.get(i); - if (string.equals("yem_es_xsalesorder")){ + if (string.equals("yem_es_xsalesorder")) { String yemLinetype = d.getString("yem_linetype"); - if (!"add".equals(yemLinetype)){ + if (!"add".equals(yemLinetype)) { continue; } } - if (!"Z".equals(d.getString("yem_businesssort"))){ + if (!"Z".equals(d.getString("yem_businesssort"))) { continue; } DynamicObjectCollection subC = d.getDynamicObjectCollection("yem_multiconfig");