优化代码 计算问题解决

This commit is contained in:
xiaoshi 2024-12-17 18:03:25 +08:00
parent 0612c52985
commit 5fe89369d6
2 changed files with 53 additions and 25 deletions

View File

@ -8,6 +8,7 @@ import kd.bos.form.CloseCallBack;
import kd.bos.form.ShowFormHelper;
import kd.bos.list.ListShowParameter;
import kd.bos.orm.query.QFilter;
import kd.ec.contract.common.enums.PriceAdjustModeEnum;
import kd.ec.contract.formplugin.ContractMeasureBillEditPlugin;
import java.math.BigDecimal;
@ -28,10 +29,10 @@ public class ContractEeasurementBillPlugin extends ContractMeasureBillEditPlugin
BigDecimal totalqty = (BigDecimal) this.getModel().getValue("totalqty", rowIndex, parentRowIndex);
BigDecimal preQty = (BigDecimal) this.getModel().getValue("preqty", rowIndex, parentRowIndex);
BigDecimal balanceQty = totalqty.subtract(preQty);
if (qty.compareTo(balanceQty) > 0) {
// this.getView().showMessage(String.format(ResManager.loadKDString("本期计量数量不能超过%s总数量-期初累计计量数量)。", "ContractMeasureBillEditPlugin_4", "ec-contract-formplugin", new Object[0]), balanceQty.intValue()));
// this.getModel().setValue("thisqty", BigDecimal.ZERO, rowIndex, parentRowIndex);
} else {
// if (qty.compareTo(balanceQty) > 0) {
//// this.getView().showMessage(String.format(ResManager.loadKDString("本期计量数量不能超过%s总数量-期初累计计量数量)。", "ContractMeasureBillEditPlugin_4", "ec-contract-formplugin", new Object[0]), balanceQty.intValue()));
//// this.getModel().setValue("thisqty", BigDecimal.ZERO, rowIndex, parentRowIndex);
// } else {
this.getModel().setValue("lstqty", preQty.add(qty), rowIndex, parentRowIndex);
BigDecimal taxPrice = (BigDecimal) this.getModel().getValue("curtaxprice", rowIndex, parentRowIndex);
BigDecimal amount = taxPrice.multiply(qty);
@ -40,7 +41,7 @@ public class ContractEeasurementBillPlugin extends ContractMeasureBillEditPlugin
this.countPercent(rowIndex, parentRowIndex);
}
}
// }
}
@Override
@ -77,9 +78,35 @@ public class ContractEeasurementBillPlugin extends ContractMeasureBillEditPlugin
}
}
// @Override
// public void propertyChanged(PropertyChangedArgs e) {
// super.propertyChanged(e);
@Override
public void propertyChanged(PropertyChangedArgs e) {
super.propertyChanged(e);
String propName = e.getProperty().getName();
ChangeData changeData = e.getChangeSet()[0];
if (StringUtils.equals(propName, "contract")) {
this.onContractChanged(changeData);
} else if (StringUtils.equals(propName, "period")) {
this.onPeriodChanged(changeData);
} else if (!StringUtils.equals(propName, "begindate") && !StringUtils.equals(propName, "enddate")) {
if (StringUtils.equals(propName, "thisqty")) {
this.onThisQtyChanged(changeData);
} else if (StringUtils.equals(propName, "thisamount")) {
this.onThisAmountChanged(changeData);
} else if (StringUtils.equals(propName, "thisoftaxmount")) {
this.onThisOfTaxAmountChanged(changeData);
} else if (StringUtils.equals(propName, "thistax")) {
this.onThisTaxChanged(changeData);
} else if (StringUtils.equals(propName, "ismeasurebymatin")) {
this.isMeasureByMaterialInChanged(changeData);
} else if (StringUtils.equals(propName, PriceAdjustModeEnum.ADJUST_AMOUNT.getValue())) {
this.onAdjustAmountChange(changeData);
} else if (StringUtils.equals(propName, PriceAdjustModeEnum.ADJUST_TAX.getValue())) {
this.onAdjustTaxChange(changeData);
}
} else {
this.onDateChanged(changeData, propName);
}
// String name = e.getProperty().getName();
// ChangeData changeData = e.getChangeSet()[0];
// int rowIndex = changeData.getRowIndex();
@ -131,6 +158,6 @@ public class ContractEeasurementBillPlugin extends ContractMeasureBillEditPlugin
//// this.getView().updateView();
//// }
////
//// }
// }
}
}

View File

@ -34,7 +34,8 @@ public class ResourceFilterExtPlugin extends ResourceItemListPlugin {
} else if (contractType.toString().equals("sbcg")) {//设备采购
this.setResourceTypeStyle("equipment");
this.afterSelectedTag("equipment");
}else if (contractType.toString().equals("qtcc") || contractType.toString().equals("lwlcc")) {//产出物
}else if (contractType.toString().equals("qtcc") || contractType.toString().equals("lwlcc")|| contractType.toString().equals("ck")||
contractType.toString().equals("zyfbcc")|| contractType.toString().equals("jjbc")) {//产出物
this.setResourceTypeStyle("turnover");
this.afterSelectedTag("turnover");
}else {