parent
eba9c167e1
commit
f2a9e43f75
|
@ -13,12 +13,16 @@ import java.util.EventObject;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重新计算费用申请单的实付金额值
|
||||||
|
*/
|
||||||
public class PaymentApplyEditUIExtPlugin extends PaymentApplyEditUI {
|
public class PaymentApplyEditUIExtPlugin extends PaymentApplyEditUI {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void thisApplyOfTaxChanged(ChangeData changeData) {
|
protected void thisApplyOfTaxChanged(ChangeData changeData) {
|
||||||
|
|
||||||
this.sumApplyOfTax();
|
this.sumApplyOfTax();
|
||||||
//this.setRealPayAmt();
|
this.setRealPayAmt();
|
||||||
if (this.getPageCache().get("thisApplyAmountCache") != null) {
|
if (this.getPageCache().get("thisApplyAmountCache") != null) {
|
||||||
this.getPageCache().remove("thisApplyAmountCache");
|
this.getPageCache().remove("thisApplyAmountCache");
|
||||||
} else {
|
} else {
|
||||||
|
@ -48,12 +52,8 @@ public class PaymentApplyEditUIExtPlugin extends PaymentApplyEditUI {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.getModel().setValue("realpayamt", totalAmount);
|
this.getModel().setValue("zcgj_realpayamt", totalAmount);
|
||||||
//Object id = this.getModel().getValue("id");
|
this.getView().updateView("zcgj_realpayamt");
|
||||||
//DynamicObject paymentapply = BusinessDataServiceHelper.loadSingle(id, "ec_paymentapply", "realpayamt");
|
|
||||||
//paymentapply.set("realpayamt", 99999);
|
|
||||||
//SaveServiceHelper.update(new DynamicObject[]{paymentapply});
|
|
||||||
this.getView().updateView("realpayamt");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -0,0 +1,71 @@
|
||||||
|
package zcgj.zcdev.zcdev.pr.plugin.operate;
|
||||||
|
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||||
|
import kd.bos.entity.plugin.PreparePropertysEventArgs;
|
||||||
|
import kd.bos.entity.plugin.args.AfterOperationArgs;
|
||||||
|
import kd.bos.orm.query.QCP;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 反写工程-项目资金-付款申请单的实际付款
|
||||||
|
*/
|
||||||
|
public class PaymentapplySetRealpayamtOp extends AbstractOperationServicePlugIn {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPreparePropertys(PreparePropertysEventArgs e) {
|
||||||
|
super.onPreparePropertys(e);
|
||||||
|
e.getFieldKeys().add("entryentity");
|
||||||
|
e.getFieldKeys().add("zcgj_realpayamt");
|
||||||
|
e.getFieldKeys().add("sourcebilltype");
|
||||||
|
e.getFieldKeys().add("sourcebillnumber");
|
||||||
|
e.getFieldKeys().add("sourcebillid");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterExecuteOperationTransaction(AfterOperationArgs e) {
|
||||||
|
super.afterExecuteOperationTransaction(e);
|
||||||
|
DynamicObject[] dataEntities = e.getDataEntities();
|
||||||
|
if(dataEntities!=null && dataEntities.length>0){
|
||||||
|
DynamicObject object = dataEntities[0];
|
||||||
|
String sourcebilltype = object.getString("sourcebilltype");
|
||||||
|
if("ec_paymentapply".equals(sourcebilltype)){//如果上游单据是工程-项目资金-付款申请单
|
||||||
|
String sourcebillnumber = object.getString("sourcebillnumber");//源单编码
|
||||||
|
String sourcebillid = object.getString("sourcebillid");//源单id
|
||||||
|
QFilter numberFilter = new QFilter("billno", QCP.equals,sourcebillnumber);//筛选出属性number=zcgjAccounttableNumber的结果
|
||||||
|
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(sourcebilltype, "id,number,zcgj_realpayamt,entryentity.contract,entryentity.thisrealpayamt", new QFilter[]{numberFilter});
|
||||||
|
DynamicObjectCollection dynamicObjectCollection = dynamicObject.getDynamicObjectCollection("entryentity");
|
||||||
|
Set<String> contractNo = new HashSet<>();
|
||||||
|
BigDecimal totalAmount = BigDecimal.ZERO;
|
||||||
|
for (DynamicObject entryentity : dynamicObjectCollection) {
|
||||||
|
DynamicObject contract = entryentity.getDynamicObject("contract");
|
||||||
|
if(contract != null) {
|
||||||
|
String billno = contract.getString("id");
|
||||||
|
if(!contractNo.contains(billno)) {
|
||||||
|
totalAmount = entryentity.getBigDecimal("thisrealpayamt");
|
||||||
|
contractNo.add(billno);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
BigDecimal realpayamt = dynamicObject.getBigDecimal("zcgj_realpayamt");
|
||||||
|
if(realpayamt!=null){
|
||||||
|
totalAmount = totalAmount.add(realpayamt);
|
||||||
|
}
|
||||||
|
dynamicObject.set("zcgj_realpayamt", totalAmount);
|
||||||
|
|
||||||
|
Object[] save = SaveServiceHelper.save(new DynamicObject[]{dynamicObject});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue