反结算接口
This commit is contained in:
parent
aa62ce6a6c
commit
2f579cdb56
|
|
@ -0,0 +1,76 @@
|
||||||
|
package tqq9.lc123.cloud.app.plugin.operate.ap;
|
||||||
|
|
||||||
|
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.util.StringUtils;
|
||||||
|
import kd.fi.arapcommon.api.param.ServiceNameEnum;
|
||||||
|
import kd.fi.arapcommon.api.param.SettleResult;
|
||||||
|
import kd.fi.arapcommon.api.settle.IUnSettleService;
|
||||||
|
import kd.fi.arapcommon.factory.ArApServiceAPIFactory;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 财务应付单审核调用接口反结算 采购订单关闭时调用-将已预付的付款单进行反结算
|
||||||
|
*/
|
||||||
|
public class ApFinApBillUnSettleOp extends AbstractOperationServicePlugIn {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPreparePropertys(PreparePropertysEventArgs e) {
|
||||||
|
super.onPreparePropertys(e);
|
||||||
|
e.getFieldKeys().add("org");
|
||||||
|
e.getFieldKeys().add("planentity.plancorebilltype");
|
||||||
|
e.getFieldKeys().add("planentity.plancorebillno");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterExecuteOperationTransaction(AfterOperationArgs e) {
|
||||||
|
super.afterExecuteOperationTransaction(e);
|
||||||
|
DynamicObject[] dataEntities1 = e.getDataEntities();
|
||||||
|
for (DynamicObject dynamicObject : dataEntities1) {
|
||||||
|
DynamicObject org = dynamicObject.getDynamicObject("org");
|
||||||
|
//财务应付-付款计划
|
||||||
|
DynamicObjectCollection planentity = dynamicObject.getDynamicObjectCollection("planentity");
|
||||||
|
String orderBillbo = null;
|
||||||
|
for (DynamicObject object : planentity) {
|
||||||
|
String plancorebilltype = object.getString("plancorebilltype");//核心单据类型
|
||||||
|
if ("pm_purorderbill".equals(plancorebilltype)) {
|
||||||
|
String plancorebillno = object.getString("plancorebillno");//核心单据号
|
||||||
|
orderBillbo = plancorebillno;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//付款处理
|
||||||
|
//采购订单
|
||||||
|
DynamicObject pm_purorderbill = BusinessDataServiceHelper.loadSingle("pm_purorderbill", "id,billno,purbillentry_pay.tqq9_settleamount,purbillentry_pay.tqq9_paybillno"
|
||||||
|
, new QFilter[]{new QFilter("billno", QCP.equals, orderBillbo)});
|
||||||
|
if (null != pm_purorderbill) {
|
||||||
|
//付款计划
|
||||||
|
DynamicObjectCollection purbillentry_pay = pm_purorderbill.getDynamicObjectCollection("purbillentry_pay");
|
||||||
|
Set<String> billNoSet = new HashSet<>();
|
||||||
|
for (DynamicObject object : purbillentry_pay) {
|
||||||
|
//付款单
|
||||||
|
String tqq9_paybillno = object.getString("tqq9_paybillno");
|
||||||
|
if (StringUtils.isNotEmpty(tqq9_paybillno)) {
|
||||||
|
billNoSet.add(tqq9_paybillno);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 根据单据编号反结算对应的结算记录
|
||||||
|
*/
|
||||||
|
IUnSettleService unSettleService = ArApServiceAPIFactory.getUnSettleService(ServiceNameEnum.APUNSETTLE.getValue());
|
||||||
|
SettleResult settleResult = unSettleService.unSettleByBillNo("cas_paybill", billNoSet);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue