进项发票反审核占用校验逻辑优化

This commit is contained in:
xuhaihui 2025-12-18 14:24:12 +08:00
parent c4ce89069b
commit b60796a698
1 changed files with 17 additions and 0 deletions

View File

@ -11,6 +11,7 @@ import kd.bos.entity.validate.AbstractValidator;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.QueryServiceHelper;
/**
* 进项发票占用校验
@ -20,6 +21,7 @@ public class InInvoiceUseCkOp extends AbstractOperationServicePlugIn {
public void onPreparePropertys(PreparePropertysEventArgs e) {
super.onPreparePropertys(e);
e.getFieldKeys().add("serialno");
e.getFieldKeys().add("invoiceno");
}
@Override
@ -40,6 +42,7 @@ public class InInvoiceUseCkOp extends AbstractOperationServicePlugIn {
DynamicObject[] xpenseRelation = BusinessDataServiceHelper.load("rim_expense_relation", "number,expense_num", new QFilter[]{filterOrgDepId});
if(xpenseRelation != null && xpenseRelation.length > 0) {
this.addFatalErrorMessage(extendedDataEntity, String.format("当前发票已被单据%s绑定不允许反审核",xpenseRelation[0].getString("expense_num")));
return;
}
/*DynamicObject zcgjAccounttype = dynamicObject.getDynamicObject("zcgj_accounttype");
if(zcgjAccounttype == null){
@ -53,6 +56,20 @@ public class InInvoiceUseCkOp extends AbstractOperationServicePlugIn {
}*/
}
String invoicecode = dataEntity.getString("invoiceno");//发票号码
if (!StringUtils.isEmpty(invoicecode)) {
QFilter filter = new QFilter("zcgj_entryentity.zcgj_invoice.invoiceno", QCP.equals, invoicecode);
DynamicObject ecma_materialinbill = QueryServiceHelper.queryOne("ecma_materialinbill", "billno", new QFilter[]{filter});//入库单
if (ecma_materialinbill != null) {
this.addFatalErrorMessage(extendedDataEntity, String.format("当前发票已被入库单%s绑定不允许反审核", ecma_materialinbill.getString("billno")));
return;
}
DynamicObject zcgj_maintenanceackbill = QueryServiceHelper.queryOne("zcgj_maintenanceackbill", "billno", new QFilter[]{filter});//入库单
if (zcgj_maintenanceackbill != null) {
this.addFatalErrorMessage(extendedDataEntity, String.format("当前发票已被设备维修确认单%s绑定不允许反审核", zcgj_maintenanceackbill.getString("billno")));
return;
}
}
}
}
}