From c286a55d190be337d8eb95b6c3b635993c4f60aa Mon Sep 17 00:00:00 2001 From: xuhaihui <2098865055@qq.com> Date: Mon, 20 Oct 2025 15:19:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A5=E5=BA=93=E5=8D=95=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/MaterialInBillEditPluginExt.java | 12 ++++----- .../form/MaterialInbPurchaseApplyPlugin.java | 26 ++++++++++++++++--- .../MaterialInBillSubmitValidatorOp.java | 10 ++++--- 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/MaterialInBillEditPluginExt.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/MaterialInBillEditPluginExt.java index ca0203f..1164ff1 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/MaterialInBillEditPluginExt.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/MaterialInBillEditPluginExt.java @@ -414,10 +414,10 @@ public class MaterialInBillEditPluginExt extends AbstractEcmaBillPlugin implemen } public void fieldLockLogic() { - boolean isAdjustamount = this.getModel().getDataEntity().getBoolean("adjustamount"); - boolean isAdjustoftax = this.getModel().getDataEntity().getBoolean("adjustoftax"); - boolean isInputtaxprice = this.getModel().getDataEntity().getBoolean("inputtaxprice"); - boolean isInputtotalprice = this.getModel().getDataEntity().getBoolean("inputtotalprice"); + boolean isAdjustamount = this.getModel().getDataEntity().getBoolean("adjustamount");//微调金额 + boolean isAdjustoftax = this.getModel().getDataEntity().getBoolean("adjustoftax");//微调税额 + boolean isInputtaxprice = this.getModel().getDataEntity().getBoolean("inputtaxprice");//录入含税价 + boolean isInputtotalprice = this.getModel().getDataEntity().getBoolean("inputtotalprice");//录入总价 DynamicObjectCollection entryentity = this.getView().getModel().getEntryEntity("entryentity"); if (entryentity.size() >= 1) { int i; @@ -467,8 +467,8 @@ public class MaterialInBillEditPluginExt extends AbstractEcmaBillPlugin implemen protected void initFormPage(int rowIndex) { /* this.getView().setEnable(true, rowIndex, new String[]{"lot", "lotid", "measureunit", "entrytaxrate", "price", "ismainmaterial"}); this.getView().setEnable(false, rowIndex, new String[]{"taxprice", "taxamount", "contprice", "oftaxamount", "notaxamount"});//系统源码*/ - this.getView().setEnable(true, rowIndex, new String[]{"lot", "lotid", "measureunit", "entrytaxrate", "ismainmaterial", "notaxamount"});//二开修改添加金额字段,去除入库单价 - this.getView().setEnable(false, rowIndex, new String[]{"taxprice", "taxamount", "contprice", "price", "oftaxamount"});//二开修改去除金额字段,添加入库单价 + this.getView().setEnable(true, rowIndex, new String[]{"lot", "lotid", "measureunit", "entrytaxrate", "price","ismainmaterial", "notaxamount"});//二开修改添加金额字段 + this.getView().setEnable(false, rowIndex, new String[]{"taxprice", "taxamount", "contprice", "oftaxamount"});//二开修改去除金额字段 Boolean poundIn = (Boolean) this.getModel().getValue("poundin"); this.getView().setEnable(!poundIn, rowIndex, new String[]{"material", "modelnum", "qty"}); } diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/MaterialInbPurchaseApplyPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/MaterialInbPurchaseApplyPlugin.java index 25cd32d..a0b32e6 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/MaterialInbPurchaseApplyPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/MaterialInbPurchaseApplyPlugin.java @@ -5,6 +5,8 @@ import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObjectCollection; import kd.bos.dataentity.metadata.dynamicobject.DynamicObjectType; import kd.bos.dataentity.resource.ResManager; +import kd.bos.entity.datamodel.RowDataEntity; +import kd.bos.entity.datamodel.events.AfterAddRowEventArgs; import kd.bos.entity.datamodel.events.ChangeData; import kd.bos.entity.datamodel.events.PropertyChangedArgs; import kd.bos.form.*; @@ -70,6 +72,24 @@ public class MaterialInbPurchaseApplyPlugin extends AbstractBillPlugIn implement } } + public void afterAddRow(AfterAddRowEventArgs e) { + super.afterAddRow(e); + String entryName = e.getEntryProp().getName();//新增行单据体名 + if ("entryentity".equals(entryName)) { + //入库单明细-新增行 + Object invoice_type = this.getModel().getValue("zcgj_invoice_type");//发票类型 + if (invoice_type != null && invoice_type.equals("0")) { + DynamicObject bd_taxrate = BusinessDataServiceHelper.loadSingle("bd_taxrate", + new QFilter[]{new QFilter("number", QCP.equals, "V0")});//税率-默认增值税0 + RowDataEntity[] rowDataEntities = e.getRowDataEntities(); + for (RowDataEntity rowDataEntity : rowDataEntities) { + int rowIndex = rowDataEntity.getRowIndex(); + this.getModel().setValue("entrytaxrate", bd_taxrate, rowIndex);//入库单明细-税率 + } + } + } + } + @Override public void propertyChanged(PropertyChangedArgs e) { super.propertyChanged(e); @@ -192,11 +212,11 @@ public class MaterialInbPurchaseApplyPlugin extends AbstractBillPlugIn implement this.getView().updateView("transoftaxamount"); this.getView().updateView("totaloftaxamount"); this.getModel().endInit(); - } else if ("oftaxamount".equals(key)) { - //入库单明细-含税金额 + } else if ("oftaxamount".equals(key) || "taxprice".equals(key)) { + //入库单明细-含税金额、入库单明细-入库含税单价 boolean inputtaxprice = (boolean) this.getModel().getValue("inputtaxprice");//录入含税价 boolean inputtotalprice = (boolean) this.getModel().getValue("inputtotalprice");//录入总价 - if (inputtaxprice && inputtotalprice) { + if ((inputtaxprice && inputtotalprice) || ("taxprice".equals(key) && inputtaxprice)) { BigDecimal matAmount = (BigDecimal) this.getModel().getValue("matamount");//材料总金额 BigDecimal transAmount = (BigDecimal) this.getModel().getValue("transamount");//总运费 BigDecimal totalAmount = matAmount.add(transAmount); 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 4784ee5..04dd621 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 @@ -44,6 +44,7 @@ public class MaterialInBillSubmitValidatorOp extends AbstractOperationServicePlu DynamicObject ecma_MaterialInBill = extendedDataEntity.getDataEntity(); DynamicObjectCollection entryEntityCollection = ecma_MaterialInBill.getDynamicObjectCollection("zcgj_entryentity");//合同进项发票信息 DynamicObjectCollection entryEntity2Collection = ecma_MaterialInBill.getDynamicObjectCollection("entryentity");//入库单分录 + String invoice_type = ecma_MaterialInBill.getString("zcgj_invoice_type");//发票类型 if (entryEntityCollection != null && entryEntityCollection.size() > 0 && entryEntity2Collection != null && entryEntity2Collection.size() > 0) { BigDecimal totalInvoiceAmount = BigDecimal.ZERO; // 发票总金额(不含税 @@ -83,15 +84,18 @@ public class MaterialInBillSubmitValidatorOp extends AbstractOperationServicePlu totalEntryTotal = totalEntryTotal.add(oftaxAmount); } }*/ + if (totalInvoiceTotal.compareTo(totalEntryTotal) != 0) { + this.addFatalErrorMessage(extendedDataEntity, "入库含税总金额与合同进项发票信息价税合计汇总不匹配!"); + } + if (invoice_type != null && invoice_type.equals("1")) { + return; + } if (totalInvoiceAmount.compareTo(totalEntryAmount) != 0) { this.addFatalErrorMessage(extendedDataEntity, "入库总金额与合同进项发票信息金额汇总不匹配!"); } if (totalInvoiceTax.compareTo(totalEntryTax) != 0) { this.addFatalErrorMessage(extendedDataEntity, "税额与合同进项发票信息税额汇总不匹配!"); } - if (totalInvoiceTotal.compareTo(totalEntryTotal) != 0) { - this.addFatalErrorMessage(extendedDataEntity, "入库含税总金额与合同进项发票信息价税合计汇总不匹配!"); - } } } }