From 8d13c5bf87f44a801b7d559bfb71a12a53bd4bad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=B0=8F=E4=BC=9F?= Date: Wed, 23 Apr 2025 18:23:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E5=87=BA=E5=90=88=E5=90=8C=E8=AE=A1?= =?UTF-8?q?=E9=87=8F=20=E5=BD=93=E5=89=8D=E5=8D=95=E4=BB=B7=E5=8F=98?= =?UTF-8?q?=E6=9B=B4=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/ContractEeasurementBillPlugin.java | 21 ++++++++++++--- .../InContractMeasurementBillEditPlugin.java | 26 ++++++++++++++----- 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ContractEeasurementBillPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ContractEeasurementBillPlugin.java index 3760beb..c9653fd 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ContractEeasurementBillPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ContractEeasurementBillPlugin.java @@ -139,12 +139,24 @@ public class ContractEeasurementBillPlugin extends ContractMeasureBillEditPlugin doLockFieldWithPriceAdjustMode((PriceAdjustModeEnum)null); } else if (StringUtils.equals(propName,"currentprice")) { BigDecimal oldValue = (BigDecimal)changeData.getOldValue(); - if(oldValue.compareTo(new BigDecimal(0)) == 0){return;} + if(oldValue.compareTo(new BigDecimal(0)) == 0){ + BigDecimal initialValue = (BigDecimal) changeData.getNewValue(); + this.getView().getPageCache().put("currentprice", initialValue.toString()); + return; + } + String initialValue = this.getView().getPageCache().get("currentprice"); + BigDecimal initialvalue = new BigDecimal(initialValue); BigDecimal newValue = (BigDecimal)changeData.getNewValue(); - PriceChangedWarn(oldValue,newValue,rowIndex,parentRowIndex); + PriceChangedWarn(initialvalue,newValue,rowIndex,parentRowIndex); } else if (StringUtils.equals(propName, "thisqty") || StringUtils.equals(propName, "thisoftaxmount")) { BigDecimal oldValue = (BigDecimal)changeData.getOldValue(); - if(oldValue.compareTo(new BigDecimal(0)) == 0){return;} + if(oldValue.compareTo(new BigDecimal(0)) == 0){ + BigDecimal initialValue = (BigDecimal) changeData.getNewValue(); + this.getView().getPageCache().put("currentprice", initialValue.toString()); + return; + } + String initialValue = this.getView().getPageCache().get("currentprice"); + BigDecimal initialvalue = new BigDecimal(initialValue); BigDecimal thisqty = (BigDecimal)this.getModel().getValue("thisqty", rowIndex, parentRowIndex); BigDecimal thisoftaxmount =(BigDecimal) this.getModel().getValue("thisoftaxmount", rowIndex, parentRowIndex); BigDecimal totalqty =(BigDecimal) this.getModel().getValue("totalqty", rowIndex, parentRowIndex); @@ -165,8 +177,9 @@ public class ContractEeasurementBillPlugin extends ContractMeasureBillEditPlugin listentry.set("currenttaxamt",curtaxprice.multiply(totalqty).subtract(currentprice.multiply(totalqty))); listentry.set("currentoftax",curtaxprice.multiply(totalqty)); this.getView().updateView("listentry"); + PriceChangedWarn(initialvalue,currentprice,rowIndex, parentRowIndex); } - PriceChangedWarn(oldPrice,currentprice,rowIndex, parentRowIndex); + } } diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/InContractMeasurementBillEditPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/InContractMeasurementBillEditPlugin.java index 7d05fbe..3cae691 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/InContractMeasurementBillEditPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/InContractMeasurementBillEditPlugin.java @@ -188,16 +188,28 @@ public class InContractMeasurementBillEditPlugin extends InContractMeasureBillEd if (StringUtils.equals(propName, "zcgj_hsjell")) { doLockFieldWithPriceAdjustMode((PriceAdjustModeEnum)null); } else if (StringUtils.equals(propName,"currentprice")) { + // 获取初始单价 + BigDecimal initialPrice = (BigDecimal) this.getModel().getValue("currentprice", rowIndex, parentRowIndex); BigDecimal oldValue = (BigDecimal)changeData.getOldValue(); - if(oldValue.compareTo(new BigDecimal(0)) == 0){return;} + if(oldValue.compareTo(new BigDecimal(0)) == 0){ + BigDecimal initialValue = (BigDecimal) changeData.getNewValue(); + this.getView().getPageCache().put("currentprice", initialValue.toString()); + return; + } + String initialValue = this.getView().getPageCache().get("currentprice"); + BigDecimal initialvalue = new BigDecimal(initialValue); BigDecimal newValue = (BigDecimal)changeData.getNewValue(); - PriceChangedWarn(oldValue,newValue,rowIndex,parentRowIndex); + PriceChangedWarn(initialvalue,newValue,rowIndex,parentRowIndex); } else if ( StringUtils.equals(propName, "thisoftaxmount")) {//StringUtils.equals(propName, "thisqty") || - + BigDecimal initialPrice = (BigDecimal) this.getModel().getValue("currentprice", rowIndex, parentRowIndex); BigDecimal oldValue = (BigDecimal)changeData.getOldValue(); - if(oldValue.compareTo(new BigDecimal(0)) == 0){return;} - - + if(oldValue.compareTo(new BigDecimal(0)) == 0){ + BigDecimal initialValue = (BigDecimal) changeData.getNewValue(); + this.getView().getPageCache().put("currentprice", initialValue.toString()); + return; + } + String initialValue = this.getView().getPageCache().get("currentprice"); + BigDecimal initialvalue = new BigDecimal(initialValue); BigDecimal thisqty = (BigDecimal)this.getModel().getValue("thisqty", rowIndex, parentRowIndex);//本期计量数量 BigDecimal thisoftaxmount =(BigDecimal) this.getModel().getValue("thisoftaxmount", rowIndex, parentRowIndex);//本期计量含税金额 @@ -226,7 +238,7 @@ public class InContractMeasurementBillEditPlugin extends InContractMeasureBillEd // this.getModel().setValue("currenttaxamt",curtaxprice.multiply(totalqty).subtract(currentprice.multiply(totalqty)),rowIndex, parentRowIndex); // this.getModel().setValue("currentoftax",curtaxprice.multiply(totalqty),rowIndex, parentRowIndex); this.getView().updateView(); - PriceChangedWarn(oldPrice,currentprice,rowIndex, parentRowIndex); + PriceChangedWarn(initialvalue,currentprice,rowIndex, parentRowIndex); } // String resname = (String)this.getModel().getValue("resname", rowIndex, parentRowIndex); // PriceChangedWarn(oldPrice,currentprice,rowIndex, parentRowIndex);