优化代码 计算问题解决
This commit is contained in:
parent
0612c52985
commit
5fe89369d6
|
@ -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;
|
||||
|
@ -22,25 +23,25 @@ public class ContractEeasurementBillPlugin extends ContractMeasureBillEditPlugin
|
|||
|
||||
@Override
|
||||
protected void onThisQtyChanged(ChangeData changeData) {
|
||||
BigDecimal qty = this.defaultZeroBigDecimal((BigDecimal)changeData.getNewValue());
|
||||
BigDecimal qty = this.defaultZeroBigDecimal((BigDecimal) changeData.getNewValue());
|
||||
int rowIndex = changeData.getRowIndex();
|
||||
int parentRowIndex = changeData.getParentRowIndex();
|
||||
BigDecimal totalqty = (BigDecimal)this.getModel().getValue("totalqty", rowIndex, parentRowIndex);
|
||||
BigDecimal preQty = (BigDecimal)this.getModel().getValue("preqty", rowIndex, parentRowIndex);
|
||||
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 taxPrice = (BigDecimal) this.getModel().getValue("curtaxprice", rowIndex, parentRowIndex);
|
||||
BigDecimal amount = taxPrice.multiply(qty);
|
||||
this.getModel().setValue("thisoftaxmount", amount, rowIndex, parentRowIndex);
|
||||
if (this.isInContract()) {
|
||||
this.countPercent(rowIndex, parentRowIndex);
|
||||
}
|
||||
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -54,8 +55,8 @@ public class ContractEeasurementBillPlugin extends ContractMeasureBillEditPlugin
|
|||
List<Object> listingIds = new ArrayList();
|
||||
|
||||
int rowIndex;
|
||||
for(rowIndex = 0; rowIndex < rowCount; ++rowIndex) {
|
||||
DynamicObject listing = (DynamicObject)this.getModel().getValue("listing", rowIndex);
|
||||
for (rowIndex = 0; rowIndex < rowCount; ++rowIndex) {
|
||||
DynamicObject listing = (DynamicObject) this.getModel().getValue("listing", rowIndex);
|
||||
if (listing != null) {
|
||||
// listingIds.add(listing.getPkValue());
|
||||
}
|
||||
|
@ -63,9 +64,9 @@ public class ContractEeasurementBillPlugin extends ContractMeasureBillEditPlugin
|
|||
|
||||
qFilters.add(new QFilter("id", "not in", listingIds));
|
||||
rowIndex = this.getModel().getEntryCurrentRowIndex("listmodelentry");
|
||||
String listModelId = (String)this.getModel().getValue("listmodelid", rowIndex);
|
||||
String listModelId = (String) this.getModel().getValue("listmodelid", rowIndex);
|
||||
qFilters.add(new QFilter("listingmodel", "=", StringUtils.isNotBlank(listModelId) ? Long.parseLong(listModelId) : 0L));
|
||||
DynamicObject contract = (DynamicObject)this.getModel().getValue("contract");
|
||||
DynamicObject contract = (DynamicObject) this.getModel().getValue("contract");
|
||||
if (contract != null) {
|
||||
qFilters.add(new QFilter("contractid", "=", contract.getLong("id")));
|
||||
}
|
||||
|
@ -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();
|
||||
//// }
|
||||
////
|
||||
//// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue