From 1bac3290cd69717af8c3dede23db47eabe9ab8c8 Mon Sep 17 00:00:00 2001 From: xiaoshi <2272816786@qq.com> Date: Thu, 19 Dec 2024 15:59:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81=20=20?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E5=90=88=E5=90=8C=E9=87=91=E9=A2=9D=20=20=20?= =?UTF-8?q?=E5=A4=9A=E5=88=86=E5=BD=95=E8=AE=A1=E9=87=8F=E5=8F=AA=E8=83=BD?= =?UTF-8?q?=E8=AE=A1=E9=87=8F=E5=85=B6=E4=B8=80=20=20=20=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E6=B8=85=E5=8D=95=E8=BF=87=E6=BB=A4=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin/form/ResourceFilterExtPlugin.java | 22 ++++---- .../operate/ContractMeasurementValidator.java | 52 +++++++++++++------ .../InContractSettlementValidator.java | 4 ++ .../OutContractSettlementValidator.java | 48 +++++++++-------- 4 files changed, 76 insertions(+), 50 deletions(-) diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ResourceFilterExtPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ResourceFilterExtPlugin.java index b2da35d..d50a14b 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ResourceFilterExtPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ResourceFilterExtPlugin.java @@ -60,17 +60,17 @@ public class ResourceFilterExtPlugin extends ResourceItemListPlugin { // contractType = "ck"; // this.getPageCache().remove("firstOpen"); if (contractType != null) { - if (contractType.toString().equals("wzcg01")) {//物资采购 - this.getView().setVisible(true, new String[]{"flexpanelmaterial"}); - this.getView().setVisible(false, new String[]{"flexpanelsub", "flexpanellabour", "flexpanelcomposite", "flexpanelequipment", "flexpanelturnover","flexpanelother"}); - } else if (contractType.toString().equals("sbcg")) {//设备采购 - this.getView().setVisible(true, new String[]{"flexpanelequipment"}); - this.getView().setVisible(false, new String[]{"flexpanelsub", "flexpanellabour", "flexpanelcomposite", "flexpanelmaterial", "flexpanelturnover","flexpanelother"}); - }else if (contractType.toString().equals("qtcc") || contractType.toString().equals("lwlcc")|| contractType.toString().equals("ck")|| - contractType.toString().equals("zyfbcc")|| contractType.toString().equals("jjbc")) {//产出物 - this.getView().setVisible(true, new String[]{"flexpanelturnover"}); - this.getView().setVisible(false, new String[]{"flexpanelsub", "flexpanellabour", "flexpanelcomposite", "flexpanelequipment", "flexpanelmaterial","flexpanelother"}); - } +// if (contractType.toString().equals("wzcg01")) {//物资采购 +// this.getView().setVisible(true, new String[]{"flexpanelmaterial"}); +// this.getView().setVisible(false, new String[]{"flexpanelsub", "flexpanellabour", "flexpanelcomposite", "flexpanelequipment", "flexpanelturnover","flexpanelother"}); +// } else if (contractType.toString().equals("sbcg")) {//设备采购 +// this.getView().setVisible(true, new String[]{"flexpanelequipment"}); +// this.getView().setVisible(false, new String[]{"flexpanelsub", "flexpanellabour", "flexpanelcomposite", "flexpanelmaterial", "flexpanelturnover","flexpanelother"}); +// }else if (contractType.toString().equals("qtcc") || contractType.toString().equals("lwlcc")|| contractType.toString().equals("ck")|| +// contractType.toString().equals("zyfbcc")|| contractType.toString().equals("jjbc")) {//产出物 +// this.getView().setVisible(true, new String[]{"flexpanelturnover"}); +// this.getView().setVisible(false, new String[]{"flexpanelsub", "flexpanellabour", "flexpanelcomposite", "flexpanelequipment", "flexpanelmaterial","flexpanelother"}); +// } } } } diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/ContractMeasurementValidator.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/ContractMeasurementValidator.java index 97d02c3..5c70383 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/ContractMeasurementValidator.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/ContractMeasurementValidator.java @@ -26,7 +26,7 @@ public class ContractMeasurementValidator extends ContractMeasureValidator { int var7 = dataEntities.length; DynamicObject changeListing; - for(int var8 = 0; var8 < var7; ++var8) { + for (int var8 = 0; var8 < var7; ++var8) { ExtendedDataEntity dataEntity = var6[var8]; changeListing = dataEntity.getDataEntity(); if (!excludeIds.contains(changeListing.getLong("id"))) { @@ -34,13 +34,13 @@ public class ContractMeasurementValidator extends ContractMeasureValidator { DynamicObjectCollection modelEntries = changeListing.getDynamicObjectCollection("listmodelentry"); Iterator var12 = modelEntries.iterator(); - while(var12.hasNext()) { - DynamicObject modelEntry = (DynamicObject)var12.next(); + while (var12.hasNext()) { + DynamicObject modelEntry = (DynamicObject) var12.next(); DynamicObjectCollection listingEntries = modelEntry.getDynamicObjectCollection("listentry"); Iterator var15 = listingEntries.iterator(); - while(var15.hasNext()) { - DynamicObject listingEntry = (DynamicObject)var15.next(); + while (var15.hasNext()) { + DynamicObject listingEntry = (DynamicObject) var15.next(); DynamicObject listing = listingEntry.getDynamicObject("listing"); if (listing != null && !listingIds.add(listing.getLong("id"))) { repeatListingIds.add(listing.getLong("id")); @@ -57,8 +57,8 @@ public class ContractMeasurementValidator extends ContractMeasureValidator { Set changedListingIds = new HashSet(16); Iterator var30 = changeListings.iterator(); - while(var30.hasNext()) { - changeListing = (DynamicObject)var30.next(); + while (var30.hasNext()) { + changeListing = (DynamicObject) var30.next(); changedListingIds.add(changeListing.getLong("kapianentry.entryentity.listid")); } @@ -69,7 +69,7 @@ public class ContractMeasurementValidator extends ContractMeasureValidator { int var36 = listings.length; DynamicObject measureListing; - for(int var38 = 0; var38 < var36; ++var38) { + for (int var38 = 0; var38 < var36; ++var38) { measureListing = var34[var38]; listingQtyBalance.put(measureListing.getLong("id"), measureListing.getBigDecimal("totalqty")); } @@ -80,11 +80,11 @@ public class ContractMeasurementValidator extends ContractMeasureValidator { DynamicObjectCollection measureListings = QueryServiceHelper.query("ec_incontractmeasure", "listmodelentry.listentry.listing,listmodelentry.listentry.thisqty", new QFilter[]{filter}); Iterator var39 = measureListings.iterator(); - while(var39.hasNext()) { - measureListing = (DynamicObject)var39.next(); + while (var39.hasNext()) { + measureListing = (DynamicObject) var39.next(); long listingId = measureListing.getLong("listmodelentry.listentry.listing"); if (listingId != 0L) { - BigDecimal qtyBalance = (BigDecimal)listingQtyBalance.getOrDefault(listingId, BigDecimal.ZERO); + BigDecimal qtyBalance = (BigDecimal) listingQtyBalance.getOrDefault(listingId, BigDecimal.ZERO); listingQtyBalance.put(listingId, qtyBalance.subtract(measureListing.getBigDecimal("listmodelentry.listentry.thisqty"))); } } @@ -92,20 +92,35 @@ public class ContractMeasurementValidator extends ContractMeasureValidator { ExtendedDataEntity[] var41 = dataEntities; int var42 = dataEntities.length; - for(int var44 = 0; var44 < var42; ++var44) { + for (int var44 = 0; var44 < var42; ++var44) { ExtendedDataEntity dataEntity = var41[var44]; DynamicObject bill = dataEntity.getDataEntity(); if (!excludeIds.contains(bill.getLong("id"))) { DynamicObjectCollection modelEntries = bill.getDynamicObjectCollection("listmodelentry"); Iterator var20 = modelEntries.iterator(); - - while(var20.hasNext()) { - DynamicObject modelEntry = (DynamicObject)var20.next(); + int isTwo = 0; + if (modelEntries.size() > 1) { + DynamicObject object = modelEntries.get(0); + DynamicObjectCollection listingEntries = object.getDynamicObjectCollection("listentry"); + if (!listingEntries.isEmpty()) { + isTwo++; + } + DynamicObject object1 = modelEntries.get(1); + DynamicObjectCollection listingEntries1 = object1.getDynamicObjectCollection("listentry"); + if (!listingEntries1.isEmpty()) { + isTwo++; + } + if (isTwo > 1) { + this.addErrorMessage(dataEntity, "多清单时计量只可计量其中!请清空其中一个分录。"); + } + } + while (var20.hasNext()) { + DynamicObject modelEntry = (DynamicObject) var20.next(); DynamicObjectCollection listingEntries = modelEntry.getDynamicObjectCollection("listentry"); Iterator var23 = listingEntries.iterator(); - while(var23.hasNext()) { - DynamicObject listingEntry = (DynamicObject)var23.next(); + while (var23.hasNext()) { + DynamicObject listingEntry = (DynamicObject) var23.next(); DynamicObject listing = listingEntry.getDynamicObject("listing"); if (listing != null) { if (repeatListingIds.contains(listing.getLong("id"))) { @@ -120,8 +135,11 @@ public class ContractMeasurementValidator extends ContractMeasureValidator { } } } + } + } + } } diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/InContractSettlementValidator.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/InContractSettlementValidator.java index 3420bdb..f52a3d9 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/InContractSettlementValidator.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/InContractSettlementValidator.java @@ -31,6 +31,10 @@ public class InContractSettlementValidator extends InContractSettleValidator { if (itementry.size() == 0) { this.addErrorMessage(dataEntity, ResManager.loadKDString("支付合同项不能为空", "InContractSettleValidator_0", "ec-contract-opplugin", new Object[0])); } + BigDecimal oftaxamount = itementry.get(0).getBigDecimal("oftaxamount"); + if (oftaxamount.compareTo(new BigDecimal(0)) > 0) { + this.addErrorMessage(dataEntity, ResManager.loadKDString("支付合同项分录中的金额不能为空!", "InContractSettleValidator_0", "ec-contract-opplugin", new Object[0])); + } DynamicObject contract = BusinessDataServiceHelper.loadSingle(dataEntity.getDataEntity().getDynamicObject("contract").getPkValue(), "ec_in_contract"); BigDecimal totalSettleOfTaxAmount = contract.getBigDecimal("totalsettleoftaxamount"); BigDecimal totalOfTaxAmount = contract.getBigDecimal("totaloftaxamount"); diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/OutContractSettlementValidator.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/OutContractSettlementValidator.java index b83a873..e0145a8 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/OutContractSettlementValidator.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/OutContractSettlementValidator.java @@ -18,32 +18,36 @@ public class OutContractSettlementValidator extends OutContractSettleValidator { BigDecimal settleOfTaxAmount = dataEntity.getDataEntity().getBigDecimal("settleoftaxamount"); DynamicObject contractTemp = dataEntity.getDataEntity().getDynamicObject("contract"); - DynamicObjectCollection itementry = dataEntity.getDataEntity().getDynamicObjectCollection("itementry"); - if(itementry.isEmpty()) { - this.addErrorMessage(dataEntity, ResManager.loadKDString("支付合同项不能为空", "InContractSettleValidator_0", "ec-contract-opplugin", new Object[0])); + DynamicObjectCollection itementry = dataEntity.getDataEntity().getDynamicObjectCollection("itementry"); + if (itementry.isEmpty()) { + this.addErrorMessage(dataEntity, ResManager.loadKDString("支付合同项不能为空", "InContractSettleValidator_0", "ec-contract-opplugin", new Object[0])); + } + BigDecimal oftaxamount = itementry.get(0).getBigDecimal("oftaxamount"); + if (oftaxamount.compareTo(new BigDecimal(0)) > 0) { + this.addErrorMessage(dataEntity, ResManager.loadKDString("支付合同项分录中的金额不能为空!", "InContractSettleValidator_0", "ec-contract-opplugin", new Object[0])); + } + if (contractTemp == null) { + this.addErrorMessage(dataEntity, ResManager.loadKDString("合同不可为空。", "OutContractSettleValidator_5", "ec-contract-opplugin", new Object[0])); + return false; + } else { + DynamicObject contract = BusinessDataServiceHelper.loadSingle(dataEntity.getDataEntity().getDynamicObject("contract").getPkValue(), "ec_out_contract"); + BigDecimal totalSettleOfTaxAmount = contract.getBigDecimal("totalsettleoftaxamount"); + BigDecimal totalOfTaxAmount = contract.getBigDecimal("totaloftaxamount"); + DynamicObject contractType = contract.getDynamicObject("contracttype"); + DynamicObject contractAttr = contractType == null ? null : contractType.getDynamicObject("contattr"); + boolean validateAmount = true; + if (contractAttr != null) { + contractAttr = BusinessDataServiceHelper.loadSingle(contractAttr.getPkValue(), "ec_contattr"); + validateAmount = !StringUtils.equals("09", contractAttr.getString("basictype")); } - if (contractTemp == null) { - this.addErrorMessage(dataEntity, ResManager.loadKDString("合同不可为空。", "OutContractSettleValidator_5", "ec-contract-opplugin", new Object[0])); - return false; - } else { - DynamicObject contract = BusinessDataServiceHelper.loadSingle(dataEntity.getDataEntity().getDynamicObject("contract").getPkValue(), "ec_out_contract"); - BigDecimal totalSettleOfTaxAmount = contract.getBigDecimal("totalsettleoftaxamount"); - BigDecimal totalOfTaxAmount = contract.getBigDecimal("totaloftaxamount"); - DynamicObject contractType = contract.getDynamicObject("contracttype"); - DynamicObject contractAttr = contractType == null ? null : contractType.getDynamicObject("contattr"); - boolean validateAmount = true; - if (contractAttr != null) { - contractAttr = BusinessDataServiceHelper.loadSingle(contractAttr.getPkValue(), "ec_contattr"); - validateAmount = !StringUtils.equals("09", contractAttr.getString("basictype")); - } - if (validateAmount && settleOfTaxAmount.compareTo(totalOfTaxAmount.subtract(totalSettleOfTaxAmount)) > 0) { + if (validateAmount && settleOfTaxAmount.compareTo(totalOfTaxAmount.subtract(totalSettleOfTaxAmount)) > 0) { // this.addErrorMessage(dataEntity, ResManager.loadKDString("本期结算价税合计不能大于合同剩余金额价税合计", "OutContractSettleValidator_0", "ec-contract-opplugin", new Object[0])); - return true; - } else { - return true; - } + return true; + } else { + return true; } + } } } }