From a3211d97f6e2bc32d867f79d2c3ea33bf3d17936 Mon Sep 17 00:00:00 2001 From: xuhaihui <2098865055@qq.com> Date: Thu, 20 Nov 2025 13:41:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A5=E5=BA=93=E5=8D=95=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=8A=E4=BC=A0=E7=9A=84=E5=8F=91=E7=A5=A8?= =?UTF-8?q?=E4=B8=AD=E5=90=AB=E6=9C=89=E6=99=AE=E7=A5=A8=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=97=B6=E6=A0=A1=E9=AA=8C=E5=85=A5=E5=BA=93?= =?UTF-8?q?=E5=8D=95=E6=98=8E=E7=BB=86=E4=B8=AD=E5=BF=85=E9=A1=BB=E6=9C=89?= =?UTF-8?q?=E2=80=9C=E5=A2=9E=E5=80=BC=E7=A8=8E0%=E2=80=9D=E7=9A=84?= =?UTF-8?q?=E7=A8=8E=E7=8E=87=E6=A0=A1=E9=AA=8C=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MaterialInBillSubmitValidatorOp.java | 32 +++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/MaterialInBillSubmitValidatorOp.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/MaterialInBillSubmitValidatorOp.java index 8a8292c..50154e6 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/MaterialInBillSubmitValidatorOp.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/MaterialInBillSubmitValidatorOp.java @@ -12,7 +12,8 @@ import java.math.BigDecimal; /** * 入库单提交操作校验插件 - * 说明:校验存在发票时,看无运费发票按钮是否开启,不开启校验含运费金额,开启只校验金额 + * 说明:1:校验存在发票时,看无运费发票按钮是否开启,不开启校验含运费金额,开启只校验金额 + * 2:上传的发票中含有普票时,提交时校验入库单明细中必须有“增值税0%”的税率 */ public class MaterialInBillSubmitValidatorOp extends AbstractOperationServicePlugIn { public void onPreparePropertys(PreparePropertysEventArgs e) { @@ -35,6 +36,8 @@ public class MaterialInBillSubmitValidatorOp extends AbstractOperationServicePlu e.getFieldKeys().add("mataxamount"); e.getFieldKeys().add("zcgj_freight_invoice"); e.getFieldKeys().add("zcgj_no_invoice"); + e.getFieldKeys().add("zcgj_invoice"); + e.getFieldKeys().add("entrytaxrate"); } @Override @@ -52,6 +55,31 @@ public class MaterialInBillSubmitValidatorOp extends AbstractOperationServicePlu boolean zcgj_no_invoice = ecma_MaterialInBill.getBoolean("zcgj_no_invoice");//无物资发票 DynamicObjectCollection entryEntityCollection = ecma_MaterialInBill.getDynamicObjectCollection("zcgj_entryentity");//合同进项发票信息 DynamicObjectCollection entryEntity2Collection = ecma_MaterialInBill.getDynamicObjectCollection("entryentity");//入库单分录 + + int zeroTaxRateEntryCount = 0; + boolean hasNonSpecialInvoice = false; + for (DynamicObject entryEntity : entryEntityCollection) { + DynamicObject invoice = entryEntity.getDynamicObject("zcgj_invoice"); // 发票号码 + if (invoice == null) continue; + DynamicObject invoiceTypeId = invoice.getDynamicObject("invoicetypeid"); // 发票类型 + if (invoiceTypeId == null) continue; + String invoiceTypeIdName = invoiceTypeId.getString("name"); + if (!invoiceTypeIdName.contains("专")) { + hasNonSpecialInvoice = true; + for (DynamicObject entryEntity2 : entryEntity2Collection) { + DynamicObject entryTaxRate = entryEntity2.getDynamicObject("entrytaxrate"); // 税率名称 + if (entryTaxRate != null && "增值税0%".equals(entryTaxRate.getString("name"))) { + zeroTaxRateEntryCount++; + break; + } + } + } + } + if (hasNonSpecialInvoice && zeroTaxRateEntryCount == 0) { + this.addFatalErrorMessage(extendedDataEntity, "系统检测到上传的发票中存在普通发票,入库单明细中凡是涉及普票的物资,”税率名称“请选择”增值税0%”!!"); + } + + if (!zcgj_no_invoice && entryEntity2Collection != null && entryEntity2Collection.size() > 0) { String invoice_type = ecma_MaterialInBill.getString("zcgj_invoice_type");//发票类型 boolean zcgj_notraninvoice = ecma_MaterialInBill.getBoolean("zcgj_notraninvoice");//无运费发票 @@ -103,7 +131,7 @@ public class MaterialInBillSubmitValidatorOp extends AbstractOperationServicePlu BigDecimal invoiceTax = entryEntity.getBigDecimal("zcgj_invoicetax"); // 合同进项发票信息-税额 boolean zcgj_freight_invoice = entryEntity.getBoolean("zcgj_freight_invoice"); //运费发票 if (zcgj_freight_invoice) { - break; + continue; } if (invoiceTotal != null) { totalInvoiceTotal = totalInvoiceTotal.add(invoiceTotal);