From 32cb30599be96d0a96c5d60ebd44aed41b3d7b23 Mon Sep 17 00:00:00 2001 From: ljw Date: Fri, 3 Jan 2025 21:21:15 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=20=E8=B4=B7=E8=AE=B0=E5=8D=95?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E8=AE=A1=E7=AE=97=E6=89=A3=E5=87=8F=E5=90=8E?= =?UTF-8?q?=E9=87=91=E9=A2=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../debcrednotenew/op/DebCredNewSubmitOp.java | 52 +++++++++++++++++-- 1 file changed, 47 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/yem/wm/im/debcrednotenew/op/DebCredNewSubmitOp.java b/src/main/java/com/yem/wm/im/debcrednotenew/op/DebCredNewSubmitOp.java index 9e1d1753..909cdbb6 100644 --- a/src/main/java/com/yem/wm/im/debcrednotenew/op/DebCredNewSubmitOp.java +++ b/src/main/java/com/yem/wm/im/debcrednotenew/op/DebCredNewSubmitOp.java @@ -52,22 +52,42 @@ public class DebCredNewSubmitOp extends AbstractOperationServicePlugIn { public void beforeExecuteOperationTransaction(BeforeOperationArgs e) { super.beforeExecuteOperationTransaction(e); for (ExtendedDataEntity dataEntity : e.getSelectedRows()) { - DynamicObject billObj = dataEntity.getDataEntity(); - getlast(billObj); + DynamicObject dynamicObject = dataEntity.getDataEntity(); + DynamicObject billObj = BusinessDataServiceHelper.loadSingle(dynamicObject.getPkValue(), dynamicObject.getDynamicObjectType().getName()); + DynamicObject yemCurrency = billObj.getDynamicObject("yem_currency"); + getlast(dynamicObject); + if (yemCurrency != null) { + /* + (1)如果结算币别=美元: + ① 扣减后金额(美元)=上次美元金额(实际)+ 配件资金池增加金额-配件资金池扣减金额; + ② 扣减后金额(人民币)= 上次人民币金额(实际); + (2)如果结算币别=人民币: + ① 扣减后金额(美元)=上次美元金额(实际); + ② 扣减后金额(人民币)= 上次人民币金额(实际)+ 配件资金池增加金额-配件资金池扣减金额; + */ + + } + SaveServiceHelper.update(dynamicObject); } } + /** - * 计算上次美元金额(实际) 上次人民币金额(实际) + * 计算上次美元金额(实际) 上次人民币金额(实际) + * * @param temp */ - public void getlast(DynamicObject temp){ + public void getlast(DynamicObject temp) { temp = BusinessDataServiceHelper.loadSingle(temp.getPkValue(), temp.getDynamicObjectType().getName()); + DynamicObject yemCurrency = temp.getDynamicObject("yem_currency"); //借贷业务类型 DynamicObject yem_credittype = temp.getDynamicObject("yem_credittype"); //集团客户 DynamicObject yem_customer = temp.getDynamicObject("yem_groupcusfields"); //产品类型 DynamicObject yem_bd_products = temp.getDynamicObject("yem_bd_products"); + + BigDecimal yemAmount = temp.getBigDecimal("yem_amount");//配件资金池增加金额 + BigDecimal yemAmountSub = temp.getBigDecimal("yem_amount_sub");//配件资金池扣减金额 QFilter qFilter1 = new QFilter("billstatus", QCP.equals, "C"); qFilter1.and(new QFilter("yem_credittype.id", QCP.equals, yem_credittype.getLong("id"))); qFilter1.and(new QFilter("yem_groupcusfields.id", QCP.equals, yem_customer.getLong("id"))); @@ -132,10 +152,31 @@ public class DebCredNewSubmitOp extends AbstractOperationServicePlugIn { String number = yem_em_replace.getString("number"); if (number.equals("CNY")) { temp.set("yem_creditrmbamt", bigDecimal); + if (yemCurrency != null) { + String numbers = yemCurrency.getString("number"); + if ("CNY".equals(numbers)) { +// temp.set("yem_koujianusd", bigDecimal); + temp.set("yem_koujiancny", bigDecimal.add(yemAmount.subtract(yemAmountSub))); + } else if ("USD".equals(numbers)) { +// temp.set("yem_koujianusd", bigDecimal.add(yemAmount.subtract(yemAmountSub))); + temp.set("yem_koujiancny", bigDecimal); + } + } } if (number.equals("USD")) { temp.set("yem_creditusdamt", bigDecimal); + if (yemCurrency != null) { + String numbers = yemCurrency.getString("number"); + if ("CNY".equals(numbers)) { + temp.set("yem_koujianusd", bigDecimal); +// temp.set("yem_koujiancny", bigDecimal.add(yemAmount.subtract(yemAmountSub))); + } else if ("USD".equals(numbers)) { + temp.set("yem_koujianusd", bigDecimal.add(yemAmount.subtract(yemAmountSub))); +// temp.set("yem_koujiancny", bigDecimal); + } + } } + } } } @@ -154,8 +195,9 @@ public class DebCredNewSubmitOp extends AbstractOperationServicePlugIn { } } } - } + + } SaveServiceHelper.update(temp); } }