当前单价变动提醒

This commit is contained in:
程小伟 2025-04-25 11:30:13 +08:00
parent cb2390bcad
commit 7b1b7e57d7
2 changed files with 32 additions and 22 deletions

View File

@ -131,6 +131,7 @@ public class ContractEeasurementBillPlugin extends ContractMeasureBillEditPlugin
@Override @Override
public void propertyChanged(PropertyChangedArgs e) { public void propertyChanged(PropertyChangedArgs e) {
super.propertyChanged(e); super.propertyChanged(e);
boolean checkbox= this.getModel().getDataEntity().getBoolean("zcgj_hsjell");
String propName = e.getProperty().getName(); String propName = e.getProperty().getName();
ChangeData changeData = e.getChangeSet()[0]; ChangeData changeData = e.getChangeSet()[0];
int rowIndex = changeData.getRowIndex(); int rowIndex = changeData.getRowIndex();
@ -141,22 +142,28 @@ public class ContractEeasurementBillPlugin extends ContractMeasureBillEditPlugin
BigDecimal oldValue = (BigDecimal)changeData.getOldValue(); BigDecimal oldValue = (BigDecimal)changeData.getOldValue();
if(oldValue.compareTo(new BigDecimal(0)) == 0){ if(oldValue.compareTo(new BigDecimal(0)) == 0){
BigDecimal initialValue = (BigDecimal) changeData.getNewValue(); BigDecimal initialValue = (BigDecimal) changeData.getNewValue();
this.getView().getPageCache().put("currentprice", initialValue.toString()); this.getModel().setValue("zcgj_cachepricefield", initialValue,rowIndex,parentRowIndex);
// BigDecimal initialValue = (BigDecimal) changeData.getNewValue();
// this.getView().getPageCache().put("currentprice", initialValue.toString());
return; return;
} }
String initialValue = this.getView().getPageCache().get("currentprice"); BigDecimal initialValue = (BigDecimal)this.getModel().getValue("zcgj_cachepricefield", rowIndex, parentRowIndex);
BigDecimal initialvalue = new BigDecimal(initialValue);
// String initialValue = this.getView().getPageCache().get("currentprice");
// BigDecimal initialvalue = new BigDecimal(initialValue);
BigDecimal newValue = (BigDecimal)changeData.getNewValue(); BigDecimal newValue = (BigDecimal)changeData.getNewValue();
PriceChangedWarn(initialvalue,newValue,rowIndex,parentRowIndex); PriceChangedWarn(initialValue,newValue,rowIndex,parentRowIndex);
} else if (StringUtils.equals(propName, "thisqty") || StringUtils.equals(propName, "thisoftaxmount")) { } else if (checkbox && (StringUtils.equals(propName, "thisqty") || StringUtils.equals(propName, "thisoftaxmount"))) {
BigDecimal oldValue = (BigDecimal)changeData.getOldValue(); BigDecimal oldValue = (BigDecimal)changeData.getOldValue();
if(oldValue.compareTo(new BigDecimal(0)) == 0){ if(oldValue.compareTo(new BigDecimal(0)) == 0){
BigDecimal initialValue = (BigDecimal) changeData.getNewValue(); BigDecimal initialValue = (BigDecimal) changeData.getNewValue();
this.getView().getPageCache().put("currentprice", initialValue.toString()); this.getView().getPageCache().put("currentprice", initialValue.toString());
return; return;
} }
String initialValue = this.getView().getPageCache().get("currentprice"); BigDecimal initialValue = (BigDecimal)this.getModel().getValue("zcgj_cachepricefield", rowIndex, parentRowIndex);
BigDecimal initialvalue = new BigDecimal(initialValue); //
// String initialValue = this.getView().getPageCache().get("currentprice");
// BigDecimal initialvalue = new BigDecimal(initialValue);
BigDecimal thisqty = (BigDecimal)this.getModel().getValue("thisqty", rowIndex, parentRowIndex); BigDecimal thisqty = (BigDecimal)this.getModel().getValue("thisqty", rowIndex, parentRowIndex);
BigDecimal thisoftaxmount =(BigDecimal) this.getModel().getValue("thisoftaxmount", rowIndex, parentRowIndex); BigDecimal thisoftaxmount =(BigDecimal) this.getModel().getValue("thisoftaxmount", rowIndex, parentRowIndex);
BigDecimal totalqty =(BigDecimal) this.getModel().getValue("totalqty", rowIndex, parentRowIndex); BigDecimal totalqty =(BigDecimal) this.getModel().getValue("totalqty", rowIndex, parentRowIndex);
@ -177,7 +184,7 @@ public class ContractEeasurementBillPlugin extends ContractMeasureBillEditPlugin
listentry.set("currenttaxamt",curtaxprice.multiply(totalqty).subtract(currentprice.multiply(totalqty))); listentry.set("currenttaxamt",curtaxprice.multiply(totalqty).subtract(currentprice.multiply(totalqty)));
listentry.set("currentoftax",curtaxprice.multiply(totalqty)); listentry.set("currentoftax",curtaxprice.multiply(totalqty));
this.getView().updateView("listentry"); this.getView().updateView("listentry");
PriceChangedWarn(initialvalue,currentprice,rowIndex, parentRowIndex); PriceChangedWarn(initialValue,currentprice,rowIndex, parentRowIndex);
} }

View File

@ -182,35 +182,38 @@ public class InContractMeasurementBillEditPlugin extends InContractMeasureBillEd
super.propertyChanged(e); super.propertyChanged(e);
String propName = e.getProperty().getName(); String propName = e.getProperty().getName();
ChangeData changeData = e.getChangeSet()[0]; ChangeData changeData = e.getChangeSet()[0];
boolean checkbox= this.getModel().getDataEntity().getBoolean("zcgj_hsjell");
int rowIndex = changeData.getRowIndex(); int rowIndex = changeData.getRowIndex();
int parentRowIndex = changeData.getParentRowIndex(); int parentRowIndex = changeData.getParentRowIndex();
if (StringUtils.equals(propName, "zcgj_hsjell")) { if (StringUtils.equals(propName, "zcgj_hsjell")) {
doLockFieldWithPriceAdjustMode((PriceAdjustModeEnum)null); doLockFieldWithPriceAdjustMode((PriceAdjustModeEnum)null);
} else if (StringUtils.equals(propName,"currentprice")) { } else if (StringUtils.equals(propName,"currentprice")) {
// 获取初始单价 // 获取初始单价
BigDecimal initialPrice = (BigDecimal) this.getModel().getValue("currentprice", rowIndex, parentRowIndex); // BigDecimal initialPrice = (BigDecimal) this.getModel().getValue("currentprice", rowIndex, parentRowIndex);
BigDecimal oldValue = (BigDecimal)changeData.getOldValue(); BigDecimal oldValue = (BigDecimal)changeData.getOldValue();
if(oldValue.compareTo(new BigDecimal(0)) == 0){ if(oldValue.compareTo(new BigDecimal(0)) == 0){
BigDecimal initialValue = (BigDecimal) changeData.getNewValue(); BigDecimal initialValue = (BigDecimal) changeData.getNewValue();
this.getView().getPageCache().put("currentprice", initialValue.toString()); this.getModel().setValue("zcgj_cachepricefield", initialValue,rowIndex,parentRowIndex);
// BigDecimal initialValue = (BigDecimal) changeData.getNewValue();
// this.getView().getPageCache().put("currentprice", initialValue.toString());
return; return;
} }
String initialValue = this.getView().getPageCache().get("currentprice"); // String initialValue = this.getView().getPageCache().get("currentprice");
BigDecimal initialvalue = new BigDecimal(initialValue); BigDecimal initialValue = (BigDecimal)this.getModel().getValue("zcgj_cachepricefield", rowIndex, parentRowIndex);
// BigDecimal initialvalue = new BigDecimal(initialValue);
BigDecimal newValue = (BigDecimal)changeData.getNewValue(); BigDecimal newValue = (BigDecimal)changeData.getNewValue();
PriceChangedWarn(initialvalue,newValue,rowIndex,parentRowIndex); PriceChangedWarn(initialValue,newValue,rowIndex,parentRowIndex);
} else if ( StringUtils.equals(propName, "thisoftaxmount")) {//StringUtils.equals(propName, "thisqty") || } else if ( checkbox && StringUtils.equals(propName, "thisoftaxmount")) {//StringUtils.equals(propName, "thisqty") ||
BigDecimal initialPrice = (BigDecimal) this.getModel().getValue("currentprice", rowIndex, parentRowIndex); // BigDecimal initialPrice = (BigDecimal) this.getModel().getValue("currentprice", rowIndex, parentRowIndex);
BigDecimal oldValue = (BigDecimal)changeData.getOldValue(); BigDecimal oldValue = (BigDecimal)changeData.getOldValue();
if(oldValue.compareTo(new BigDecimal(0)) == 0){ if(oldValue.compareTo(new BigDecimal(0)) == 0){
BigDecimal initialValue = (BigDecimal) changeData.getNewValue(); // BigDecimal initialValue = (BigDecimal) changeData.getNewValue();
this.getView().getPageCache().put("currentprice", initialValue.toString()); // this.getView().getPageCache().put("currentprice", initialValue.toString());
return; return;
} }
String initialValue = this.getView().getPageCache().get("currentprice"); // String initialValue = this.getView().getPageCache().get("currentprice");
BigDecimal initialvalue = new BigDecimal(initialValue); // BigDecimal initialvalue = new BigDecimal(initialValue);
BigDecimal initialValue = (BigDecimal)this.getModel().getValue("zcgj_cachepricefield", rowIndex, parentRowIndex);
BigDecimal thisqty = (BigDecimal)this.getModel().getValue("thisqty", rowIndex, parentRowIndex);//本期计量数量 BigDecimal thisqty = (BigDecimal)this.getModel().getValue("thisqty", rowIndex, parentRowIndex);//本期计量数量
BigDecimal thisoftaxmount =(BigDecimal) this.getModel().getValue("thisoftaxmount", rowIndex, parentRowIndex);//本期计量含税金额 BigDecimal thisoftaxmount =(BigDecimal) this.getModel().getValue("thisoftaxmount", rowIndex, parentRowIndex);//本期计量含税金额
BigDecimal totalqty =(BigDecimal) this.getModel().getValue("totalqty", rowIndex, parentRowIndex);//数量 BigDecimal totalqty =(BigDecimal) this.getModel().getValue("totalqty", rowIndex, parentRowIndex);//数量
@ -238,7 +241,7 @@ public class InContractMeasurementBillEditPlugin extends InContractMeasureBillEd
// this.getModel().setValue("currenttaxamt",curtaxprice.multiply(totalqty).subtract(currentprice.multiply(totalqty)),rowIndex, parentRowIndex); // this.getModel().setValue("currenttaxamt",curtaxprice.multiply(totalqty).subtract(currentprice.multiply(totalqty)),rowIndex, parentRowIndex);
// this.getModel().setValue("currentoftax",curtaxprice.multiply(totalqty),rowIndex, parentRowIndex); // this.getModel().setValue("currentoftax",curtaxprice.multiply(totalqty),rowIndex, parentRowIndex);
this.getView().updateView(); this.getView().updateView();
PriceChangedWarn(initialvalue,currentprice,rowIndex, parentRowIndex); PriceChangedWarn(initialValue,currentprice,rowIndex, parentRowIndex);
} }
// String resname = (String)this.getModel().getValue("resname", rowIndex, parentRowIndex); // String resname = (String)this.getModel().getValue("resname", rowIndex, parentRowIndex);
// PriceChangedWarn(oldPrice,currentprice,rowIndex, parentRowIndex); // PriceChangedWarn(oldPrice,currentprice,rowIndex, parentRowIndex);