系统校验计量清单变动的单价
This commit is contained in:
parent
13844f37c3
commit
898165509b
|
@ -9,6 +9,7 @@ import kd.bos.entity.datamodel.events.ChangeData;
|
|||
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||
import kd.bos.form.CloseCallBack;
|
||||
import kd.bos.form.ShowFormHelper;
|
||||
import kd.bos.form.field.TextEdit;
|
||||
import kd.bos.list.ListShowParameter;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.ec.contract.common.enums.PriceAdjustModeEnum;
|
||||
|
@ -137,15 +138,20 @@ public class ContractEeasurementBillPlugin extends ContractMeasureBillEditPlugin
|
|||
if (StringUtils.equals(propName, "zcgj_hsjell")) {
|
||||
doLockFieldWithPriceAdjustMode((PriceAdjustModeEnum)null);
|
||||
} else if (StringUtils.equals(propName, "thisqty") || StringUtils.equals(propName, "thisoftaxmount")) {
|
||||
BigDecimal oldValue = (BigDecimal)changeData.getOldValue();
|
||||
if(oldValue.compareTo(new BigDecimal(0)) == 0){return;}
|
||||
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);
|
||||
BigDecimal entrytaxrate =(BigDecimal) this.getModel().getValue("entrytaxrate", rowIndex, parentRowIndex);
|
||||
BigDecimal tax = entrytaxrate.divide(new BigDecimal(100)).add(new BigDecimal(1));
|
||||
BigDecimal zero = new BigDecimal(0);
|
||||
|
||||
BigDecimal oldPrice = (BigDecimal) this.getModel().getValue("currentprice", rowIndex, parentRowIndex);
|
||||
BigDecimal currentprice = null;
|
||||
if (thisqty.compareTo(zero)>0 && thisoftaxmount.compareTo(zero)>0) {
|
||||
BigDecimal curtaxprice = thisoftaxmount.divide(thisqty,6,BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal currentprice = curtaxprice.divide(tax, 6, BigDecimal.ROUND_HALF_UP);
|
||||
currentprice = curtaxprice.divide(tax, 6, BigDecimal.ROUND_HALF_UP);
|
||||
DynamicObjectCollection listmodelentry = this.getModel().getDataEntity().getDynamicObjectCollection("listmodelentry");
|
||||
DynamicObject listentry = listmodelentry.get(parentRowIndex).getDynamicObjectCollection("listentry").get(rowIndex);
|
||||
listentry.set("curtaxprice",curtaxprice);
|
||||
|
@ -153,8 +159,26 @@ public class ContractEeasurementBillPlugin extends ContractMeasureBillEditPlugin
|
|||
listentry.set("currentamt",currentprice.multiply(totalqty));
|
||||
listentry.set("currenttaxamt",curtaxprice.multiply(totalqty).subtract(currentprice.multiply(totalqty)));
|
||||
listentry.set("currentoftax",curtaxprice.multiply(totalqty));
|
||||
// this.getView().updateView();
|
||||
this.getView().updateView("listentry");
|
||||
}
|
||||
PriceChangedWarn(oldPrice,currentprice,rowIndex, parentRowIndex);
|
||||
|
||||
}
|
||||
}
|
||||
private void PriceChangedWarn(BigDecimal oldPrice, BigDecimal newPrice , int rowIndex, int parentRowIndex) {
|
||||
String resname = (String)this.getModel().getValue("resname", rowIndex, parentRowIndex);
|
||||
// String desc = (String)this.getModel().getValue("desc", rowIndex, parentRowIndex);
|
||||
if((newPrice.compareTo(oldPrice.multiply(new BigDecimal(2)))>=0)||
|
||||
(newPrice.compareTo(oldPrice.multiply(new BigDecimal(0.5)))<=0)){
|
||||
this.getView().showTipNotification(
|
||||
"请注意,清单项:"+resname+"的单价变动较大,\n" +
|
||||
" 请检查是否存在错误",5000);
|
||||
//设置说明字段的必录属性
|
||||
TextEdit descEdit = this.getView().getControl("desc");
|
||||
if(descEdit != null){
|
||||
descEdit.setMustInput(true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue