入库单日期提交操作校验插件优化
This commit is contained in:
parent
0fd3ee6f99
commit
645588997d
|
|
@ -10,6 +10,7 @@ import kd.bos.entity.validate.AbstractValidator;
|
||||||
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;
|
||||||
|
import kd.bos.servicehelper.QueryServiceHelper;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
@ -28,6 +29,7 @@ public class MaterialInBillDateSubValidatorOp extends AbstractOperationServicePl
|
||||||
e.getFieldKeys().add("zcgj_entryentity");//合同进项发票信息
|
e.getFieldKeys().add("zcgj_entryentity");//合同进项发票信息
|
||||||
e.getFieldKeys().add("zcgj_invoice");//发票号码
|
e.getFieldKeys().add("zcgj_invoice");//发票号码
|
||||||
e.getFieldKeys().add("zcgj_purchaseapply");//采购申请
|
e.getFieldKeys().add("zcgj_purchaseapply");//采购申请
|
||||||
|
e.getFieldKeys().add("fiaccountorg");//财务记账组织
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -45,22 +47,56 @@ public class MaterialInBillDateSubValidatorOp extends AbstractOperationServicePl
|
||||||
String matinsource = ecma_MaterialInBill.getString("matinsource");//入库来源
|
String matinsource = ecma_MaterialInBill.getString("matinsource");//入库来源
|
||||||
if ("6".equals(matinsource)) {
|
if ("6".equals(matinsource)) {
|
||||||
//入库来源为采购申请
|
//入库来源为采购申请
|
||||||
boolean zcgj_ispurchaseapplys = ecma_MaterialInBill.getBoolean("zcgj_ispurchaseapplys");//多采购申请
|
DynamicObject fiaccountorg = ecma_MaterialInBill.getDynamicObject("fiaccountorg");//财务记账组织
|
||||||
if (zcgj_ispurchaseapplys) {
|
if (fiaccountorg != null) {
|
||||||
DynamicObjectCollection zcgj_purchaseapplyentryCollection = ecma_MaterialInBill.getDynamicObjectCollection("zcgj_purchaseapplyentry");//采购申请分录
|
QFilter filter = new QFilter("zcgj_companyblentry.zcgj_org.id", QCP.equals, fiaccountorg.getPkValue());
|
||||||
if (zcgj_purchaseapplyentryCollection.size() > 0) {
|
filter.and(new QFilter("zcgj_checkreqdate", QCP.equals, true));
|
||||||
for (DynamicObject zcgj_purchaseapplyentry : zcgj_purchaseapplyentryCollection) {
|
DynamicObject zcgj_companybelong = QueryServiceHelper.queryOne("zcgj_companybelong", "id", new QFilter[]{filter});
|
||||||
DynamicObject zcgj_purchaseapply = zcgj_purchaseapplyentry.getDynamicObject("zcgj_purchaseapply_f7");//采购申请
|
if (zcgj_companybelong != null) {
|
||||||
|
boolean zcgj_ispurchaseapplys = ecma_MaterialInBill.getBoolean("zcgj_ispurchaseapplys");//多采购申请
|
||||||
|
if (zcgj_ispurchaseapplys) {
|
||||||
|
DynamicObjectCollection zcgj_purchaseapplyentryCollection = ecma_MaterialInBill.getDynamicObjectCollection("zcgj_purchaseapplyentry");//采购申请分录
|
||||||
|
if (zcgj_purchaseapplyentryCollection.size() > 0) {
|
||||||
|
for (DynamicObject zcgj_purchaseapplyentry : zcgj_purchaseapplyentryCollection) {
|
||||||
|
DynamicObject zcgj_purchaseapply = zcgj_purchaseapplyentry.getDynamicObject("zcgj_purchaseapply_f7");//采购申请
|
||||||
|
if (zcgj_purchaseapply == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String zcgj_number = zcgj_purchaseapply.getString("zcgj_number");
|
||||||
|
QFilter[] qFilters = new QFilter[]{new QFilter("billno", QCP.equals, zcgj_number)};
|
||||||
|
DynamicObject ecma_purchaseapply = BusinessDataServiceHelper.loadSingle("ecma_purchaseapply", "auditdate", qFilters);//采购申请
|
||||||
|
Date auditdate = ecma_purchaseapply.getDate("auditdate");//采购申请-审核时间
|
||||||
|
Date bizdate = ecma_MaterialInBill.getDate("bizdate");//业务日期
|
||||||
|
if (auditdate != null && bizdate != null && auditdate.after(bizdate)) {
|
||||||
|
this.addFatalErrorMessage(extendedDataEntity, "采购申请单:" + zcgj_number + "的审批日期不能晚于业务日期!");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
DynamicObjectCollection zcgj_entryentityCollection = ecma_MaterialInBill.getDynamicObjectCollection("zcgj_entryentity");//合同进项发票信息
|
||||||
|
if (zcgj_entryentityCollection.size() > 0) {
|
||||||
|
for (DynamicObject zcgj_entryentity : zcgj_entryentityCollection) {
|
||||||
|
DynamicObject zcgj_invoice = zcgj_entryentity.getDynamicObject("zcgj_invoice");//发票号码
|
||||||
|
if (zcgj_invoice != null) {
|
||||||
|
Date invoicedate = zcgj_invoice.getDate("invoicedate");//发票号码-开票日期
|
||||||
|
String billno = zcgj_invoice.getString("billno");
|
||||||
|
if (invoicedate != null && auditdate != null && auditdate.after(invoicedate)) {
|
||||||
|
this.addFatalErrorMessage(extendedDataEntity, "采购申请单:" + zcgj_number + "的审批日期不能晚于发票:" + billno + "的开票日期!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
DynamicObject zcgj_purchaseapply = ecma_MaterialInBill.getDynamicObject("zcgj_purchaseapply");//采购申请
|
||||||
if (zcgj_purchaseapply == null) {
|
if (zcgj_purchaseapply == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String zcgj_number = zcgj_purchaseapply.getString("zcgj_number");
|
QFilter[] qFilters = new QFilter[]{new QFilter("id", QCP.equals, zcgj_purchaseapply.getPkValue())};
|
||||||
QFilter[] qFilters = new QFilter[]{new QFilter("billno", QCP.equals, zcgj_number)};
|
|
||||||
DynamicObject ecma_purchaseapply = BusinessDataServiceHelper.loadSingle("ecma_purchaseapply", "auditdate", qFilters);//采购申请
|
DynamicObject ecma_purchaseapply = BusinessDataServiceHelper.loadSingle("ecma_purchaseapply", "auditdate", qFilters);//采购申请
|
||||||
Date auditdate = ecma_purchaseapply.getDate("auditdate");//采购申请-审核时间
|
Date auditdate = ecma_purchaseapply.getDate("auditdate");//采购申请-审核时间
|
||||||
Date bizdate = ecma_MaterialInBill.getDate("bizdate");//业务日期
|
Date bizdate = ecma_MaterialInBill.getDate("bizdate");//业务日期
|
||||||
if (auditdate != null && bizdate != null && auditdate.after(bizdate)) {
|
if (auditdate != null && bizdate != null && auditdate.after(bizdate)) {
|
||||||
this.addFatalErrorMessage(extendedDataEntity, "采购申请单:" + zcgj_number + "的审批日期不能晚于业务日期!");
|
this.addFatalErrorMessage(extendedDataEntity, "采购申请的审批日期不能晚于业务日期!");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
DynamicObjectCollection zcgj_entryentityCollection = ecma_MaterialInBill.getDynamicObjectCollection("zcgj_entryentity");//合同进项发票信息
|
DynamicObjectCollection zcgj_entryentityCollection = ecma_MaterialInBill.getDynamicObjectCollection("zcgj_entryentity");//合同进项发票信息
|
||||||
|
|
@ -71,39 +107,13 @@ public class MaterialInBillDateSubValidatorOp extends AbstractOperationServicePl
|
||||||
Date invoicedate = zcgj_invoice.getDate("invoicedate");//发票号码-开票日期
|
Date invoicedate = zcgj_invoice.getDate("invoicedate");//发票号码-开票日期
|
||||||
String billno = zcgj_invoice.getString("billno");
|
String billno = zcgj_invoice.getString("billno");
|
||||||
if (invoicedate != null && auditdate != null && auditdate.after(invoicedate)) {
|
if (invoicedate != null && auditdate != null && auditdate.after(invoicedate)) {
|
||||||
this.addFatalErrorMessage(extendedDataEntity, "采购申请单:" + zcgj_number + "的审批日期不能晚于发票:" + billno + "的开票日期!");
|
this.addFatalErrorMessage(extendedDataEntity, "采购申请的审批日期不能晚于发票:" + billno + "的开票日期!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
DynamicObject zcgj_purchaseapply = ecma_MaterialInBill.getDynamicObject("zcgj_purchaseapply");//采购申请
|
|
||||||
if (zcgj_purchaseapply == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
QFilter[] qFilters = new QFilter[]{new QFilter("id", QCP.equals, zcgj_purchaseapply.getPkValue())};
|
|
||||||
DynamicObject ecma_purchaseapply = BusinessDataServiceHelper.loadSingle("ecma_purchaseapply", "auditdate", qFilters);//采购申请
|
|
||||||
Date auditdate = ecma_purchaseapply.getDate("auditdate");//采购申请-审核时间
|
|
||||||
Date bizdate = ecma_MaterialInBill.getDate("bizdate");//业务日期
|
|
||||||
if (auditdate != null && bizdate != null && auditdate.after(bizdate)) {
|
|
||||||
this.addFatalErrorMessage(extendedDataEntity, "采购申请的审批日期不能晚于业务日期!");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
DynamicObjectCollection zcgj_entryentityCollection = ecma_MaterialInBill.getDynamicObjectCollection("zcgj_entryentity");//合同进项发票信息
|
|
||||||
if (zcgj_entryentityCollection.size() > 0) {
|
|
||||||
for (DynamicObject zcgj_entryentity : zcgj_entryentityCollection) {
|
|
||||||
DynamicObject zcgj_invoice = zcgj_entryentity.getDynamicObject("zcgj_invoice");//发票号码
|
|
||||||
if (zcgj_invoice != null) {
|
|
||||||
Date invoicedate = zcgj_invoice.getDate("invoicedate");//发票号码-开票日期
|
|
||||||
String billno = zcgj_invoice.getString("billno");
|
|
||||||
if (invoicedate != null && auditdate != null && auditdate.after(invoicedate)) {
|
|
||||||
this.addFatalErrorMessage(extendedDataEntity, "采购申请的审批日期不能晚于发票:" + billno + "的开票日期!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue