操作插件改为有事务保护的方法、对公报销单选择付款单时过滤仅展示:已审核、已付款

This commit is contained in:
XiangLingFeng 2025-12-22 16:04:50 +08:00
parent c2faf370c8
commit b77cea717a
7 changed files with 49 additions and 23 deletions

View File

@ -6,6 +6,10 @@ import kd.bos.entity.datamodel.RowDataEntity;
import kd.bos.entity.datamodel.events.AfterAddRowEventArgs; import kd.bos.entity.datamodel.events.AfterAddRowEventArgs;
import kd.bos.entity.property.EntryProp; import kd.bos.entity.property.EntryProp;
import kd.bos.form.FormShowParameter; import kd.bos.form.FormShowParameter;
import kd.bos.form.field.BasedataEdit;
import kd.bos.form.field.events.BeforeF7SelectEvent;
import kd.bos.form.field.events.BeforeF7SelectListener;
import kd.bos.list.ListShowParameter;
import kd.bos.orm.query.QCP; import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter; import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.BusinessDataServiceHelper;
@ -13,13 +17,12 @@ import kd.sdk.plugin.Plugin;
import kdsz.zyf25.tmc.cfm.common.AppConfig; import kdsz.zyf25.tmc.cfm.common.AppConfig;
import java.util.EventObject; import java.util.EventObject;
import java.util.HashSet;
import static kd.bos.form.ClientActions.insertRow;
/** /**
* 对公报销在在供应链金融新增时默认 * 对公报销在在供应链金融新增时默认
*/ */
public class PublicReimburseDefaultBillPlugin extends AbstractBillPlugIn implements Plugin { public class PublicReimburseDefaultBillPlugin extends AbstractBillPlugIn implements Plugin, BeforeF7SelectListener {
private static final String DEFAULT_EXPENSE_NUM = "FYXM26.05";//费用项目默认财务费用.金融利息支出 private static final String DEFAULT_EXPENSE_NUM = "FYXM26.05";//费用项目默认财务费用.金融利息支出
@Override @Override
@ -58,4 +61,25 @@ public class PublicReimburseDefaultBillPlugin extends AbstractBillPlugIn impleme
} }
} }
} }
@Override
public void registerListener(EventObject e) {
super.registerListener(e);
BasedataEdit fieldEdit = this.getView().getControl("kdsz_paybill_f7");//基础资料字段标识
fieldEdit.addBeforeF7SelectListener(this);
}
@Override
public void beforeF7Select(BeforeF7SelectEvent beforeF7SelectEvent) {
String fieldName = beforeF7SelectEvent.getProperty().getName();
if ("kdsz_paybill_f7".equals(fieldName)){
ListShowParameter showParameter = (ListShowParameter)this.getView().getFormShowParameter();
showParameter.setShowApproved(false);
HashSet<Object> statusSet = new HashSet<>();
statusSet.add("C");
statusSet.add("D");
QFilter filter = new QFilter("billstatus", QCP.in, statusSet);
showParameter.getListFilterParameter().getQFilters().add(filter);
}
}
} }

View File

@ -10,6 +10,7 @@ import kd.bos.entity.operate.result.OperationResult;
import kd.bos.entity.plugin.AbstractOperationServicePlugIn; import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
import kd.bos.entity.plugin.PreparePropertysEventArgs; import kd.bos.entity.plugin.PreparePropertysEventArgs;
import kd.bos.entity.plugin.args.BeforeOperationArgs; import kd.bos.entity.plugin.args.BeforeOperationArgs;
import kd.bos.entity.plugin.args.BeginOperationTransactionArgs;
import kd.bos.orm.query.QCP; import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter; import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.BusinessDataServiceHelper;
@ -63,10 +64,9 @@ public class CdmInterestAccrualPlugin extends AbstractOperationServicePlugIn imp
e.getFieldKeys().add("kdsz_payentry.kdsz_valuedate"); e.getFieldKeys().add("kdsz_payentry.kdsz_valuedate");
e.getFieldKeys().add("kdsz_payentry.kdsz_settledate"); e.getFieldKeys().add("kdsz_payentry.kdsz_settledate");
} }
@Override @Override
public void beforeExecuteOperationTransaction(BeforeOperationArgs e) { public void beginOperationTransaction(BeginOperationTransactionArgs e) {
super.beforeExecuteOperationTransaction(e); super.beginOperationTransaction(e);
DynamicObject[] bills = e.getDataEntities(); DynamicObject[] bills = e.getDataEntities();
//不同单据开始结束时间标识不一致 //不同单据开始结束时间标识不一致
String appNumber = this.getOption().getVariableValue("appnumber"); String appNumber = this.getOption().getVariableValue("appnumber");

View File

@ -7,6 +7,7 @@ import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
import kd.bos.entity.plugin.AddValidatorsEventArgs; import kd.bos.entity.plugin.AddValidatorsEventArgs;
import kd.bos.entity.plugin.PreparePropertysEventArgs; import kd.bos.entity.plugin.PreparePropertysEventArgs;
import kd.bos.entity.plugin.args.AfterOperationArgs; import kd.bos.entity.plugin.args.AfterOperationArgs;
import kd.bos.entity.plugin.args.EndOperationTransactionArgs;
import kd.bos.entity.validate.AbstractValidator; import kd.bos.entity.validate.AbstractValidator;
import kd.bos.orm.query.QFilter; import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.BusinessDataServiceHelper;
@ -28,6 +29,7 @@ public class InterestAccrualDeletePlugin extends AbstractOperationServicePlugIn
e.getFieldKeys().add("kdsz_srcentity"); e.getFieldKeys().add("kdsz_srcentity");
e.getFieldKeys().add("kdsz_srcbillid"); e.getFieldKeys().add("kdsz_srcbillid");
e.getFieldKeys().add("billno"); e.getFieldKeys().add("billno");
e.getFieldKeys().add("kdsz_srcapp");
e.getFieldKeys().add("entryentity.kdsz_e_paybill"); e.getFieldKeys().add("entryentity.kdsz_e_paybill");
} }
@ -52,8 +54,8 @@ public class InterestAccrualDeletePlugin extends AbstractOperationServicePlugIn
} }
@Override @Override
public void afterExecuteOperationTransaction(AfterOperationArgs e) { public void endOperationTransaction(EndOperationTransactionArgs e) {
super.afterExecuteOperationTransaction(e); super.endOperationTransaction(e);
DynamicObject[] bills = e.getDataEntities(); DynamicObject[] bills = e.getDataEntities();
for (DynamicObject bill : bills) { for (DynamicObject bill : bills) {
String srcEntity = bill.getString("kdsz_srcentity"); String srcEntity = bill.getString("kdsz_srcentity");

View File

@ -12,6 +12,7 @@ import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
import kd.bos.entity.plugin.AddValidatorsEventArgs; import kd.bos.entity.plugin.AddValidatorsEventArgs;
import kd.bos.entity.plugin.PreparePropertysEventArgs; import kd.bos.entity.plugin.PreparePropertysEventArgs;
import kd.bos.entity.plugin.args.BeforeOperationArgs; import kd.bos.entity.plugin.args.BeforeOperationArgs;
import kd.bos.entity.plugin.args.BeginOperationTransactionArgs;
import kd.bos.entity.validate.AbstractValidator; import kd.bos.entity.validate.AbstractValidator;
import kd.bos.i18n.mservice.I18nServiceHelper; import kd.bos.i18n.mservice.I18nServiceHelper;
import kd.bos.i18n.mservice.utils.AmountConvertResult; import kd.bos.i18n.mservice.utils.AmountConvertResult;
@ -123,9 +124,10 @@ public class InterestAccrualGenPaymentOperationPlugin extends AbstractOperationS
} }
}); });
} }
@Override @Override
public void beforeExecuteOperationTransaction(BeforeOperationArgs e) { public void beginOperationTransaction(BeginOperationTransactionArgs e) {
super.beforeExecuteOperationTransaction(e); super.beginOperationTransaction(e);
DynamicObject[] bills = e.getDataEntities(); DynamicObject[] bills = e.getDataEntities();
for (DynamicObject bill : bills) { for (DynamicObject bill : bills) {
String billNo = bill.getString("billno"); String billNo = bill.getString("billno");
@ -144,7 +146,7 @@ public class InterestAccrualGenPaymentOperationPlugin extends AbstractOperationS
writeLkInfo(bill,selectRows,result.getSuccessPkIds().get(0)); writeLkInfo(bill,selectRows,result.getSuccessPkIds().get(0));
}else { }else {
StringBuilder str = new StringBuilder(); StringBuilder str = new StringBuilder();
str.append("生成付款单失败。"); str.append("------计息单:"+billNo).append("生成付款单失败。");
List<IOperateInfo> allErrorOrValidateInfo = result.getAllErrorOrValidateInfo(); List<IOperateInfo> allErrorOrValidateInfo = result.getAllErrorOrValidateInfo();
if (allErrorOrValidateInfo != null){ if (allErrorOrValidateInfo != null){
str.append("message\n"); str.append("message\n");
@ -153,8 +155,7 @@ public class InterestAccrualGenPaymentOperationPlugin extends AbstractOperationS
} }
} }
logger.error(str.toString()); logger.error(str.toString());
e.setCancel( true); throw new RuntimeException(str.toString());
e.setCancelMessage(str.toString());
} }
} }
} }

View File

@ -4,7 +4,7 @@ import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection; import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.entity.plugin.AbstractOperationServicePlugIn; import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
import kd.bos.entity.plugin.PreparePropertysEventArgs; import kd.bos.entity.plugin.PreparePropertysEventArgs;
import kd.bos.entity.plugin.args.AfterOperationArgs; import kd.bos.entity.plugin.args.EndOperationTransactionArgs;
import kd.bos.orm.query.QFilter; import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.operation.SaveServiceHelper; import kd.bos.servicehelper.operation.SaveServiceHelper;
@ -27,8 +27,8 @@ public class PaymentBillDeleteLkOperationPlugin extends AbstractOperationService
} }
@Override @Override
public void afterExecuteOperationTransaction(AfterOperationArgs e) { public void endOperationTransaction(EndOperationTransactionArgs e) {
super.afterExecuteOperationTransaction(e); super.endOperationTransaction(e);
DynamicObject[] bills = e.getDataEntities(); DynamicObject[] bills = e.getDataEntities();
for (DynamicObject bill : bills) { for (DynamicObject bill : bills) {
String srcBillType = bill.getString("sourcebilltype"); String srcBillType = bill.getString("sourcebilltype");

View File

@ -6,8 +6,7 @@ import kd.bos.entity.EntityMetadataCache;
import kd.bos.entity.botp.runtime.TableDefine; import kd.bos.entity.botp.runtime.TableDefine;
import kd.bos.entity.plugin.AbstractOperationServicePlugIn; import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
import kd.bos.entity.plugin.PreparePropertysEventArgs; import kd.bos.entity.plugin.PreparePropertysEventArgs;
import kd.bos.entity.plugin.args.AfterOperationArgs; import kd.bos.entity.plugin.args.EndOperationTransactionArgs;
import kd.bos.entity.plugin.args.RollbackOperationArgs;
import kd.bos.orm.query.QCP; import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter; import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.BusinessDataServiceHelper;
@ -48,8 +47,8 @@ public class PublicReimburseAuditOperationPlugin extends AbstractOperationServic
} }
@Override @Override
public void afterExecuteOperationTransaction(AfterOperationArgs e) { public void endOperationTransaction(EndOperationTransactionArgs e) {
super.afterExecuteOperationTransaction(e); super.endOperationTransaction(e);
DynamicObject[] bills = e.getDataEntities(); DynamicObject[] bills = e.getDataEntities();
for (DynamicObject bill : bills) { for (DynamicObject bill : bills) {
String jxInvoiceType = bill.getString("kdsz_jxinvoicetype"); String jxInvoiceType = bill.getString("kdsz_jxinvoicetype");

View File

@ -6,7 +6,7 @@ import kd.bos.entity.EntityMetadataCache;
import kd.bos.entity.botp.runtime.TableDefine; import kd.bos.entity.botp.runtime.TableDefine;
import kd.bos.entity.plugin.AbstractOperationServicePlugIn; import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
import kd.bos.entity.plugin.PreparePropertysEventArgs; import kd.bos.entity.plugin.PreparePropertysEventArgs;
import kd.bos.entity.plugin.args.AfterOperationArgs; import kd.bos.entity.plugin.args.EndOperationTransactionArgs;
import kd.bos.orm.query.QCP; import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter; import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.BusinessDataServiceHelper;
@ -46,8 +46,8 @@ public class PublicReimburseUnAuditOperationPlugin extends AbstractOperationServ
} }
@Override @Override
public void afterExecuteOperationTransaction(AfterOperationArgs e) { public void endOperationTransaction(EndOperationTransactionArgs e) {
super.afterExecuteOperationTransaction(e); super.endOperationTransaction(e);
DynamicObject[] bills = e.getDataEntities(); DynamicObject[] bills = e.getDataEntities();
for (DynamicObject bill : bills) { for (DynamicObject bill : bills) {
String jxInvoiceType = bill.getString("kdsz_jxinvoicetype"); String jxInvoiceType = bill.getString("kdsz_jxinvoicetype");