Compare commits
3 Commits
d734ed05dd
...
ca2827f957
Author | SHA1 | Date |
---|---|---|
|
ca2827f957 | |
|
78e865e2aa | |
|
4c65bddb70 |
|
@ -0,0 +1,64 @@
|
||||||
|
package zcgj.zcdev.zcdev.pr.plugin.operate;
|
||||||
|
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.entity.ExtendedDataEntity;
|
||||||
|
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||||
|
import kd.bos.entity.plugin.AddValidatorsEventArgs;
|
||||||
|
import kd.bos.entity.plugin.PreparePropertysEventArgs;
|
||||||
|
import kd.bos.entity.validate.AbstractValidator;
|
||||||
|
import kd.bos.orm.query.QCP;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入库单提交操作校验插件
|
||||||
|
* 说明:
|
||||||
|
*/
|
||||||
|
public class MaterialInBillOrgSubmitValidatorOp extends AbstractOperationServicePlugIn {
|
||||||
|
public void onPreparePropertys(PreparePropertysEventArgs e) {
|
||||||
|
super.onPreparePropertys(e);
|
||||||
|
e.getFieldKeys().add("fiaccountOrg");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAddValidators(AddValidatorsEventArgs e) {
|
||||||
|
super.onAddValidators(e);
|
||||||
|
e.getValidators().add(new ValidatorExt());
|
||||||
|
}
|
||||||
|
|
||||||
|
class ValidatorExt extends AbstractValidator {
|
||||||
|
@Override
|
||||||
|
public void validate() {
|
||||||
|
ExtendedDataEntity[] extendedDataEntities = this.getDataEntities();
|
||||||
|
for (ExtendedDataEntity extendedDataEntity : extendedDataEntities) {
|
||||||
|
DynamicObject ecma_MaterialInBill = extendedDataEntity.getDataEntity();
|
||||||
|
DynamicObject fiaccountOrg = ecma_MaterialInBill.getDynamicObject("fiaccountOrg");//财务记账组织
|
||||||
|
if (fiaccountOrg == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QFilter f1 = new QFilter("number", QCP.equals, "ecma_materialinbill");
|
||||||
|
QFilter f2 = new QFilter("zcgj_org.fbasedataid", QCP.in, fiaccountOrg.getPkValue());
|
||||||
|
DynamicObject zcgj_authorizedcompany = BusinessDataServiceHelper.loadSingle("zcgj_authorizedcompany",
|
||||||
|
new QFilter[]{f1.and(f2)});//入库单公司过滤
|
||||||
|
if (zcgj_authorizedcompany != null) {
|
||||||
|
DynamicObjectCollection entryEntityCollection = ecma_MaterialInBill.getDynamicObjectCollection("entryentity");//入库单分录
|
||||||
|
for (int i = 0; i < entryEntityCollection.size(); i++) {
|
||||||
|
DynamicObject entryEntity = entryEntityCollection.get(i);
|
||||||
|
DynamicObject material = entryEntity.getDynamicObject("material");//资源编码
|
||||||
|
if (material != null) {
|
||||||
|
DynamicObject resource = material.getDynamicObject("resource");//资源编码-清单分类
|
||||||
|
if (resource != null) {
|
||||||
|
String number = resource.getString("number");//清单分类-编码
|
||||||
|
if (number.contains("ZCKS03") || number.contains("ZCKS05")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ecma_MaterialInBill.getString("zcgj_attachmentcountfield");//附件数
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -12,7 +12,7 @@ import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 入库单提交操作校验插件
|
* 入库单提交操作校验插件
|
||||||
* 说明:校验存在发票时,发票分录中的金额税额和价税合计与入库单明细中的金额税额和价税合计是否一致
|
* 说明:校验存在发票时,发票分录中的金额税额和价税合计与入库单明细中的金额税额和含税金额是否一致
|
||||||
*/
|
*/
|
||||||
public class MaterialInBillSubmitValidatorOp extends AbstractOperationServicePlugIn {
|
public class MaterialInBillSubmitValidatorOp extends AbstractOperationServicePlugIn {
|
||||||
public void onPreparePropertys(PreparePropertysEventArgs e) {
|
public void onPreparePropertys(PreparePropertysEventArgs e) {
|
||||||
|
@ -25,6 +25,9 @@ public class MaterialInBillSubmitValidatorOp extends AbstractOperationServicePlu
|
||||||
e.getFieldKeys().add("notaxamount");
|
e.getFieldKeys().add("notaxamount");
|
||||||
e.getFieldKeys().add("taxamount");
|
e.getFieldKeys().add("taxamount");
|
||||||
e.getFieldKeys().add("oftaxamount");
|
e.getFieldKeys().add("oftaxamount");
|
||||||
|
e.getFieldKeys().add("totalamount");
|
||||||
|
e.getFieldKeys().add("totaltaxamount");
|
||||||
|
e.getFieldKeys().add("totaloftaxamount");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -43,13 +46,13 @@ public class MaterialInBillSubmitValidatorOp extends AbstractOperationServicePlu
|
||||||
DynamicObjectCollection entryEntity2Collection = ecma_MaterialInBill.getDynamicObjectCollection("entryentity");//入库单分录
|
DynamicObjectCollection entryEntity2Collection = ecma_MaterialInBill.getDynamicObjectCollection("entryentity");//入库单分录
|
||||||
if (entryEntityCollection != null && entryEntityCollection.size() > 0 && entryEntity2Collection != null && entryEntity2Collection.size() > 0) {
|
if (entryEntityCollection != null && entryEntityCollection.size() > 0 && entryEntity2Collection != null && entryEntity2Collection.size() > 0) {
|
||||||
|
|
||||||
BigDecimal totalInvoiceAmount = BigDecimal.ZERO; // 发票总金额
|
BigDecimal totalInvoiceAmount = BigDecimal.ZERO; // 发票总金额(不含税
|
||||||
BigDecimal totalInvoiceTax = BigDecimal.ZERO; // 发票总税额
|
BigDecimal totalInvoiceTax = BigDecimal.ZERO; // 发票总税额
|
||||||
BigDecimal totalInvoiceTotal = BigDecimal.ZERO; // 发票总价税合计
|
BigDecimal totalInvoiceTotal = BigDecimal.ZERO; // 发票总价税合计
|
||||||
|
|
||||||
BigDecimal totalEntryAmount = BigDecimal.ZERO; // 入库单总金额
|
BigDecimal totalEntryAmount = ecma_MaterialInBill.getBigDecimal("totalamount"); // 入库总金额(不含税
|
||||||
BigDecimal totalEntryTax = BigDecimal.ZERO; // 入库单总税额
|
BigDecimal totalEntryTax = ecma_MaterialInBill.getBigDecimal("totaltaxamount"); // 入库单总税额
|
||||||
BigDecimal totalEntryTotal = BigDecimal.ZERO; // 入库单总价税合计
|
BigDecimal totalEntryTotal = ecma_MaterialInBill.getBigDecimal("totaloftaxamount"); // 入库含税总金额
|
||||||
|
|
||||||
for (DynamicObject entryEntity : entryEntityCollection) {
|
for (DynamicObject entryEntity : entryEntityCollection) {
|
||||||
BigDecimal invoiceAmount = entryEntity.getBigDecimal("zcgj_invoiceamount"); // 合同进项发票信息-金额
|
BigDecimal invoiceAmount = entryEntity.getBigDecimal("zcgj_invoiceamount"); // 合同进项发票信息-金额
|
||||||
|
@ -65,7 +68,7 @@ public class MaterialInBillSubmitValidatorOp extends AbstractOperationServicePlu
|
||||||
totalInvoiceTotal = totalInvoiceTotal.add(invoiceTotal);
|
totalInvoiceTotal = totalInvoiceTotal.add(invoiceTotal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (DynamicObject entryEntity2 : entryEntity2Collection) {
|
/* for (DynamicObject entryEntity2 : entryEntity2Collection) {
|
||||||
BigDecimal notaxAmount = entryEntity2.getBigDecimal("amount"); // 入库单-含运费金额(不含税)
|
BigDecimal notaxAmount = entryEntity2.getBigDecimal("amount"); // 入库单-含运费金额(不含税)
|
||||||
BigDecimal taxAmount = entryEntity2.getBigDecimal("taxamount").add(entryEntity2.getBigDecimal("zcgj_transtaxamount")); // 入库单-税额+运费税额
|
BigDecimal taxAmount = entryEntity2.getBigDecimal("taxamount").add(entryEntity2.getBigDecimal("zcgj_transtaxamount")); // 入库单-税额+运费税额
|
||||||
BigDecimal oftaxAmount = entryEntity2.getBigDecimal("amount").add(entryEntity2.getBigDecimal("taxtransamount")); // 入库单-含税金额+含税运费
|
BigDecimal oftaxAmount = entryEntity2.getBigDecimal("amount").add(entryEntity2.getBigDecimal("taxtransamount")); // 入库单-含税金额+含税运费
|
||||||
|
@ -79,7 +82,7 @@ public class MaterialInBillSubmitValidatorOp extends AbstractOperationServicePlu
|
||||||
if (oftaxAmount != null) {
|
if (oftaxAmount != null) {
|
||||||
totalEntryTotal = totalEntryTotal.add(oftaxAmount);
|
totalEntryTotal = totalEntryTotal.add(oftaxAmount);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
if (totalInvoiceAmount.compareTo(totalEntryAmount) != 0) {
|
if (totalInvoiceAmount.compareTo(totalEntryAmount) != 0) {
|
||||||
this.addFatalErrorMessage(extendedDataEntity, "入库总金额与合同进项发票信息金额汇总不匹配!");
|
this.addFatalErrorMessage(extendedDataEntity, "入库总金额与合同进项发票信息金额汇总不匹配!");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue