Compare commits
No commits in common. "ca2827f957ed1910222cd74b29dfbc5517178f56" and "d734ed05dd11f94d3739a0d9c0d02fb534fbc5f5" have entirely different histories.
ca2827f957
...
d734ed05dd
|
|
@ -1,64 +0,0 @@
|
||||||
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,9 +25,6 @@ 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
|
||||||
|
|
@ -46,13 +43,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 = ecma_MaterialInBill.getBigDecimal("totalamount"); // 入库总金额(不含税
|
BigDecimal totalEntryAmount = BigDecimal.ZERO; // 入库单总金额
|
||||||
BigDecimal totalEntryTax = ecma_MaterialInBill.getBigDecimal("totaltaxamount"); // 入库单总税额
|
BigDecimal totalEntryTax = BigDecimal.ZERO; // 入库单总税额
|
||||||
BigDecimal totalEntryTotal = ecma_MaterialInBill.getBigDecimal("totaloftaxamount"); // 入库含税总金额
|
BigDecimal totalEntryTotal = BigDecimal.ZERO; // 入库单总价税合计
|
||||||
|
|
||||||
for (DynamicObject entryEntity : entryEntityCollection) {
|
for (DynamicObject entryEntity : entryEntityCollection) {
|
||||||
BigDecimal invoiceAmount = entryEntity.getBigDecimal("zcgj_invoiceamount"); // 合同进项发票信息-金额
|
BigDecimal invoiceAmount = entryEntity.getBigDecimal("zcgj_invoiceamount"); // 合同进项发票信息-金额
|
||||||
|
|
@ -68,7 +65,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")); // 入库单-含税金额+含税运费
|
||||||
|
|
@ -82,7 +79,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