diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ContractEeasurementBillPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ContractEeasurementBillPlugin.java index cd3ba53..95a0397 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ContractEeasurementBillPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ContractEeasurementBillPlugin.java @@ -8,6 +8,7 @@ import kd.bos.form.CloseCallBack; import kd.bos.form.ShowFormHelper; import kd.bos.list.ListShowParameter; import kd.bos.orm.query.QFilter; +import kd.ec.contract.common.enums.PriceAdjustModeEnum; import kd.ec.contract.formplugin.ContractMeasureBillEditPlugin; import java.math.BigDecimal; @@ -22,25 +23,25 @@ public class ContractEeasurementBillPlugin extends ContractMeasureBillEditPlugin @Override protected void onThisQtyChanged(ChangeData changeData) { - BigDecimal qty = this.defaultZeroBigDecimal((BigDecimal)changeData.getNewValue()); + BigDecimal qty = this.defaultZeroBigDecimal((BigDecimal) changeData.getNewValue()); int rowIndex = changeData.getRowIndex(); int parentRowIndex = changeData.getParentRowIndex(); - BigDecimal totalqty = (BigDecimal)this.getModel().getValue("totalqty", rowIndex, parentRowIndex); - BigDecimal preQty = (BigDecimal)this.getModel().getValue("preqty", rowIndex, parentRowIndex); + BigDecimal totalqty = (BigDecimal) this.getModel().getValue("totalqty", rowIndex, parentRowIndex); + BigDecimal preQty = (BigDecimal) this.getModel().getValue("preqty", rowIndex, parentRowIndex); BigDecimal balanceQty = totalqty.subtract(preQty); - if (qty.compareTo(balanceQty) > 0) { -// this.getView().showMessage(String.format(ResManager.loadKDString("本期计量数量不能超过%s(总数量-期初累计计量数量)。", "ContractMeasureBillEditPlugin_4", "ec-contract-formplugin", new Object[0]), balanceQty.intValue())); -// this.getModel().setValue("thisqty", BigDecimal.ZERO, rowIndex, parentRowIndex); - } else { - this.getModel().setValue("lstqty", preQty.add(qty), rowIndex, parentRowIndex); - BigDecimal taxPrice = (BigDecimal)this.getModel().getValue("curtaxprice", rowIndex, parentRowIndex); - BigDecimal amount = taxPrice.multiply(qty); - this.getModel().setValue("thisoftaxmount", amount, rowIndex, parentRowIndex); - if (this.isInContract()) { - this.countPercent(rowIndex, parentRowIndex); - } - +// if (qty.compareTo(balanceQty) > 0) { +//// this.getView().showMessage(String.format(ResManager.loadKDString("本期计量数量不能超过%s(总数量-期初累计计量数量)。", "ContractMeasureBillEditPlugin_4", "ec-contract-formplugin", new Object[0]), balanceQty.intValue())); +//// this.getModel().setValue("thisqty", BigDecimal.ZERO, rowIndex, parentRowIndex); +// } else { + this.getModel().setValue("lstqty", preQty.add(qty), rowIndex, parentRowIndex); + BigDecimal taxPrice = (BigDecimal) this.getModel().getValue("curtaxprice", rowIndex, parentRowIndex); + BigDecimal amount = taxPrice.multiply(qty); + this.getModel().setValue("thisoftaxmount", amount, rowIndex, parentRowIndex); + if (this.isInContract()) { + this.countPercent(rowIndex, parentRowIndex); } + +// } } @Override @@ -54,8 +55,8 @@ public class ContractEeasurementBillPlugin extends ContractMeasureBillEditPlugin List listingIds = new ArrayList(); int rowIndex; - for(rowIndex = 0; rowIndex < rowCount; ++rowIndex) { - DynamicObject listing = (DynamicObject)this.getModel().getValue("listing", rowIndex); + for (rowIndex = 0; rowIndex < rowCount; ++rowIndex) { + DynamicObject listing = (DynamicObject) this.getModel().getValue("listing", rowIndex); if (listing != null) { // listingIds.add(listing.getPkValue()); } @@ -63,9 +64,9 @@ public class ContractEeasurementBillPlugin extends ContractMeasureBillEditPlugin qFilters.add(new QFilter("id", "not in", listingIds)); rowIndex = this.getModel().getEntryCurrentRowIndex("listmodelentry"); - String listModelId = (String)this.getModel().getValue("listmodelid", rowIndex); + String listModelId = (String) this.getModel().getValue("listmodelid", rowIndex); qFilters.add(new QFilter("listingmodel", "=", StringUtils.isNotBlank(listModelId) ? Long.parseLong(listModelId) : 0L)); - DynamicObject contract = (DynamicObject)this.getModel().getValue("contract"); + DynamicObject contract = (DynamicObject) this.getModel().getValue("contract"); if (contract != null) { qFilters.add(new QFilter("contractid", "=", contract.getLong("id"))); } @@ -80,6 +81,32 @@ public class ContractEeasurementBillPlugin extends ContractMeasureBillEditPlugin @Override public void propertyChanged(PropertyChangedArgs e) { super.propertyChanged(e); + + String propName = e.getProperty().getName(); + ChangeData changeData = e.getChangeSet()[0]; + if (StringUtils.equals(propName, "contract")) { + this.onContractChanged(changeData); + } else if (StringUtils.equals(propName, "period")) { + this.onPeriodChanged(changeData); + } else if (!StringUtils.equals(propName, "begindate") && !StringUtils.equals(propName, "enddate")) { + if (StringUtils.equals(propName, "thisqty")) { + this.onThisQtyChanged(changeData); + } else if (StringUtils.equals(propName, "thisamount")) { + this.onThisAmountChanged(changeData); + } else if (StringUtils.equals(propName, "thisoftaxmount")) { + this.onThisOfTaxAmountChanged(changeData); + } else if (StringUtils.equals(propName, "thistax")) { + this.onThisTaxChanged(changeData); + } else if (StringUtils.equals(propName, "ismeasurebymatin")) { + this.isMeasureByMaterialInChanged(changeData); + } else if (StringUtils.equals(propName, PriceAdjustModeEnum.ADJUST_AMOUNT.getValue())) { + this.onAdjustAmountChange(changeData); + } else if (StringUtils.equals(propName, PriceAdjustModeEnum.ADJUST_TAX.getValue())) { + this.onAdjustTaxChange(changeData); + } + } else { + this.onDateChanged(changeData, propName); + } // String name = e.getProperty().getName(); // ChangeData changeData = e.getChangeSet()[0]; // int rowIndex = changeData.getRowIndex(); @@ -88,49 +115,49 @@ public class ContractEeasurementBillPlugin extends ContractMeasureBillEditPlugin // BigDecimal currentprice = BigDecimal.ZERO;//当前单价 // BigDecimal qty = BigDecimal.ZERO;//数量 // BigDecimal taxrate = BigDecimal.ZERO;//税率 -// if(name.equals("curtaxprice")||name.equals("currentprice")) { -// if (parentRowIndex>=0&&rowIndex>=0){ -// Object curtaxpriceobj = this.getModel().getValue("curtaxprice", rowIndex, parentRowIndex); -// if (curtaxpriceobj != null) { -// curtaxprice = (BigDecimal) curtaxpriceobj; -// } -// Object currentpriceobj = this.getModel().getValue("currentprice", rowIndex, parentRowIndex); -// if (currentpriceobj != null) { -// currentprice = (BigDecimal) currentpriceobj; -// ; -// } -// Object totalqtyibj = this.getModel().getValue("totalqty", rowIndex, parentRowIndex); -// if (totalqtyibj != null) { -// qty = (BigDecimal) totalqtyibj; -// } -// Object entrytaxrateobj = this.getModel().getValue("entrytaxrate", rowIndex, parentRowIndex); -// if (entrytaxrateobj != null) { -// BigDecimal entrytaxrate = (BigDecimal) entrytaxrateobj; -// taxrate = entrytaxrate.divide(new BigDecimal(100)).add(new BigDecimal(1)); -// } -// if (name.equals("curtaxprice") && curtaxprice.compareTo(new BigDecimal(0))>0) { -// BigDecimal divide = curtaxprice.divide(taxrate,6, RoundingMode.HALF_UP);//当前单价 -// BigDecimal multiply = divide.multiply(qty);//当前金额 -// BigDecimal multiply1 = curtaxprice.multiply(qty);//当前价税合计 -// BigDecimal subtract = multiply1.subtract(multiply);//当前税额 -//// this.getModel().getDataEntity().set("currentprice",divide, rowIndex, parentRowIndex); -// this.getModel().setValue("currentprice",divide, rowIndex, parentRowIndex);//当前单价 -// this.getModel().setValue("currentamt", multiply,rowIndex, parentRowIndex);//当前金额 -// this.getModel().setValue("currenttaxamt", subtract,rowIndex, parentRowIndex);//当前税额 -// this.getModel().setValue("currentoftax", multiply1,rowIndex, parentRowIndex);//当前价税合计 -// } else if (name.equals("currentprice")&¤tprice.compareTo(new BigDecimal(0))>0) { -// BigDecimal divide = currentprice.multiply(taxrate);//当前含税单价 -// BigDecimal multiply = currentprice.multiply(qty);//当前金额 -// BigDecimal multiply1 = divide.multiply(qty);//当前价税合计 -// BigDecimal subtract = multiply1.subtract(multiply);//当前税额 -// this.getModel().setValue("curtaxprice",divide, rowIndex, parentRowIndex);//当前含税单价 -// this.getModel().setValue("currentamt", multiply,rowIndex, parentRowIndex);//当前金额 -// this.getModel().setValue("currenttaxamt",multiply1, rowIndex, parentRowIndex);//当前税额 -// this.getModel().setValue("currentoftax",subtract, rowIndex, parentRowIndex);//当前价税合计 -// } -// this.getView().updateView(); -// } -// +//// if(name.equals("curtaxprice")||name.equals("currentprice")) { +//// if (parentRowIndex>=0&&rowIndex>=0){ +//// Object curtaxpriceobj = this.getModel().getValue("curtaxprice", rowIndex, parentRowIndex); +//// if (curtaxpriceobj != null) { +//// curtaxprice = (BigDecimal) curtaxpriceobj; +//// } +//// Object currentpriceobj = this.getModel().getValue("currentprice", rowIndex, parentRowIndex); +//// if (currentpriceobj != null) { +//// currentprice = (BigDecimal) currentpriceobj; +//// ; +//// } +//// Object totalqtyibj = this.getModel().getValue("totalqty", rowIndex, parentRowIndex); +//// if (totalqtyibj != null) { +//// qty = (BigDecimal) totalqtyibj; +//// } +//// Object entrytaxrateobj = this.getModel().getValue("entrytaxrate", rowIndex, parentRowIndex); +//// if (entrytaxrateobj != null) { +//// BigDecimal entrytaxrate = (BigDecimal) entrytaxrateobj; +//// taxrate = entrytaxrate.divide(new BigDecimal(100)).add(new BigDecimal(1)); +//// } +//// if (name.equals("curtaxprice") && curtaxprice.compareTo(new BigDecimal(0))>0) { +//// BigDecimal divide = curtaxprice.divide(taxrate,6, RoundingMode.HALF_UP);//当前单价 +//// BigDecimal multiply = divide.multiply(qty);//当前金额 +//// BigDecimal multiply1 = curtaxprice.multiply(qty);//当前价税合计 +//// BigDecimal subtract = multiply1.subtract(multiply);//当前税额 +////// this.getModel().getDataEntity().set("currentprice",divide, rowIndex, parentRowIndex); +//// this.getModel().setValue("currentprice",divide, rowIndex, parentRowIndex);//当前单价 +//// this.getModel().setValue("currentamt", multiply,rowIndex, parentRowIndex);//当前金额 +//// this.getModel().setValue("currenttaxamt", subtract,rowIndex, parentRowIndex);//当前税额 +//// this.getModel().setValue("currentoftax", multiply1,rowIndex, parentRowIndex);//当前价税合计 +//// } else if (name.equals("currentprice")&¤tprice.compareTo(new BigDecimal(0))>0) { +//// BigDecimal divide = currentprice.multiply(taxrate);//当前含税单价 +//// BigDecimal multiply = currentprice.multiply(qty);//当前金额 +//// BigDecimal multiply1 = divide.multiply(qty);//当前价税合计 +//// BigDecimal subtract = multiply1.subtract(multiply);//当前税额 +//// this.getModel().setValue("curtaxprice",divide, rowIndex, parentRowIndex);//当前含税单价 +//// this.getModel().setValue("currentamt", multiply,rowIndex, parentRowIndex);//当前金额 +//// this.getModel().setValue("currenttaxamt",multiply1, rowIndex, parentRowIndex);//当前税额 +//// this.getModel().setValue("currentoftax",subtract, rowIndex, parentRowIndex);//当前价税合计 +//// } +//// this.getView().updateView(); +//// } +//// // } } } diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ContractSettleBillPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ContractSettleBillPlugin.java index 80ba2a2..1c5c903 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ContractSettleBillPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ContractSettleBillPlugin.java @@ -26,16 +26,16 @@ public class ContractSettleBillPlugin extends AbstractBillPlugIn implements Plug @Override public void afterCreateNewData(EventObject e) { super.afterCreateNewData(e); - Object changetype = this.getModel().getValue("changetype"); - if(changetype!=null){ - if(changetype.toString().equals("03")){ - this.getView().setVisible(true,"zcgj_partb"); - this.getView().setVisible(true,"zcgj_otherpart"); - }else { - this.getView().setVisible(false,"zcgj_partb"); - this.getView().setVisible(false,"zcgj_otherpart"); - } - } +// Object changetype = this.getModel().getValue("changetype"); +// if(changetype!=null){ +// if(changetype.toString().equals("03")){ +// this.getView().setVisible(true,"zcgj_partb"); +// this.getView().setVisible(true,"zcgj_otherpart"); +// }else { +// this.getView().setVisible(false,"zcgj_partb"); +// this.getView().setVisible(false,"zcgj_otherpart"); +// } +// } } @Override @@ -44,7 +44,7 @@ public class ContractSettleBillPlugin extends AbstractBillPlugIn implements Plug // 注册按钮点击事件 // this.addClickListeners("bar_audit"); // this.addItemClickListeners("bar_audit"); -// Button button = this.getView().getControl("bar_audit"); +// Button button = this.getView().getControl("bar_save"); // button.addClickListener(this); } @@ -67,35 +67,35 @@ public class ContractSettleBillPlugin extends AbstractBillPlugIn implements Plug String key = source.getKey(); if (StringUtils.equals("bar_audit", key)) { // 在此添加业务逻辑 - Object changetype = this.getModel().getValue("changetype"); - if (changetype != null) { - if (changetype.toString().equals("03")) { - Object contract = this.getModel().getValue("contract"); - DynamicObject contractInfo = (DynamicObject) contract; - String billName = contractInfo.getDataEntityType().getName(); - DynamicObject zcgjpartb = (DynamicObject)this.getModel().getValue("zcgj_partb"); - Object zcgjOtherpart = this.getModel().getValue("zcgj_otherpart"); - if (billName.equals("ec_out_contract_f7")) { - QFilter f1 = new QFilter("number", "=", contractInfo.getString("number")); - DynamicObject outContractF7 = BusinessDataServiceHelper.loadSingle("ec_out_contract_f7", new QFilter[]{f1}); - outContractF7.set("partb",zcgjpartb); - OperationResult saveOperationResult = SaveServiceHelper.saveOperate("ec_out_contract_f7", new DynamicObject[]{outContractF7}, null);//支出合同F7实体 - - QFilter f2 = new QFilter("billno", "=", contractInfo.getString("number")); - DynamicObject outContract = BusinessDataServiceHelper.loadSingle("ec_out_contract", new QFilter[]{f2}); - outContract.set("partb",zcgjpartb); - if(zcgjOtherpart!=null){ - DynamicObjectCollection otherpart = (DynamicObjectCollection) this.getModel().getValue("zcgj_otherpart"); - outContract.set("otherpart",otherpart); - outContract.set("ismulticontract",true); - } - OperationResult saveOperationResult1 = SaveServiceHelper.saveOperate("ec_out_contract", new DynamicObject[]{outContractF7}, null);//支出合同实体 - System.out.println(saveOperationResult1); - }else{ - - } - } - } +// Object changetype = this.getModel().getValue("changetype"); +// if (changetype != null) { +// if (changetype.toString().equals("03")) { +// Object contract = this.getModel().getValue("contract"); +// DynamicObject contractInfo = (DynamicObject) contract; +// String billName = contractInfo.getDataEntityType().getName(); +// DynamicObject zcgjpartb = (DynamicObject)this.getModel().getValue("zcgj_partb"); +// Object zcgjOtherpart = this.getModel().getValue("zcgj_otherpart"); +// if (billName.equals("ec_out_contract_f7")) { +// QFilter f1 = new QFilter("number", "=", contractInfo.getString("number")); +// DynamicObject outContractF7 = BusinessDataServiceHelper.loadSingle("ec_out_contract_f7", new QFilter[]{f1}); +// outContractF7.set("partb",zcgjpartb); +// OperationResult saveOperationResult = SaveServiceHelper.saveOperate("ec_out_contract_f7", new DynamicObject[]{outContractF7}, null);//支出合同F7实体 +// +// QFilter f2 = new QFilter("billno", "=", contractInfo.getString("number")); +// DynamicObject outContract = BusinessDataServiceHelper.loadSingle("ec_out_contract", new QFilter[]{f2}); +// outContract.set("partb",zcgjpartb); +// if(zcgjOtherpart!=null){ +// DynamicObjectCollection otherpart = (DynamicObjectCollection) this.getModel().getValue("zcgj_otherpart"); +// outContract.set("otherpart",otherpart); +// outContract.set("ismulticontract",true); +// } +// OperationResult saveOperationResult1 = SaveServiceHelper.saveOperate("ec_out_contract", new DynamicObject[]{outContractF7}, null);//支出合同实体 +// System.out.println(saveOperationResult1); +// }else{ +// +// } +// } +// } evt.setCancel(true); // 取消后续处理,将不会再触发click事件 } } @@ -104,17 +104,17 @@ public class ContractSettleBillPlugin extends AbstractBillPlugIn implements Plug public void propertyChanged(PropertyChangedArgs e) { super.propertyChanged(e); String name = e.getProperty().getName(); - if(name.equals("changetype")){ - Object changetype = this.getModel().getValue("changetype"); - if(changetype!=null){ - if(changetype.toString().equals("03")){ - this.getView().setVisible(true,"zcgj_partb"); - this.getView().setVisible(true,"zcgj_otherpart"); - }else { - this.getView().setVisible(false,"zcgj_partb"); - this.getView().setVisible(false,"zcgj_otherpart"); - } - } - } +// if(name.equals("changetype")){ +// Object changetype = this.getModel().getValue("changetype"); +// if(changetype!=null){ +// if(changetype.toString().equals("03")){ +// this.getView().setVisible(true,"zcgj_partb"); +// this.getView().setVisible(true,"zcgj_otherpart"); +// }else { +// this.getView().setVisible(false,"zcgj_partb"); +// this.getView().setVisible(false,"zcgj_otherpart"); +// } +// } +// } } } \ No newline at end of file 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 c43cd54..b2da35d 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 @@ -28,13 +28,14 @@ public class ResourceFilterExtPlugin extends ResourceItemListPlugin { // contractType="ck"; if (contractType != null) { - if (contractType.toString().equals("wzcg")) {//物资采购 + if (contractType.toString().equals("wzcg01")) {//物资采购 this.setResourceTypeStyle("material"); this.afterSelectedTag("material"); } else if (contractType.toString().equals("sbcg")) {//设备采购 this.setResourceTypeStyle("equipment"); this.afterSelectedTag("equipment"); - }else if (contractType.toString().equals("qtcc") || contractType.toString().equals("lwlcc")) {//产出物 + }else if (contractType.toString().equals("qtcc") || contractType.toString().equals("lwlcc")|| contractType.toString().equals("ck")|| + contractType.toString().equals("zyfbcc")|| contractType.toString().equals("jjbc")) {//产出物 this.setResourceTypeStyle("turnover"); this.afterSelectedTag("turnover"); }else { @@ -54,17 +55,19 @@ public class ResourceFilterExtPlugin extends ResourceItemListPlugin { Map customParams = formShowParameter.getCustomParams(); Object contractType = customParams.get("contractType"); String firstOpen = this.getPageCache().get("firstOpen"); - if (firstOpen == null) { - this.getPageCache().put("firstOpen", "false"); + if (firstOpen != null) { +// this.getPageCache().put("firstOpen", "false"); // contractType = "ck"; +// this.getPageCache().remove("firstOpen"); if (contractType != null) { - if (contractType.toString().equals("wzcg")) {//物资采购 + 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")) {//产出物 + }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/InContractSettlementValidator.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/InContractSettlementValidator.java index 051c05f..3420bdb 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 @@ -19,32 +19,27 @@ public class InContractSettlementValidator extends InContractSettleValidator { ExtendedDataEntity[] var2 = dataEntities; int var3 = dataEntities.length; - for(int var4 = 0; var4 < var3; ++var4) { + for (int var4 = 0; var4 < var3; ++var4) { ExtendedDataEntity dataEntity = var2[var4]; BigDecimal settleOfTaxAmount = dataEntity.getDataEntity().getBigDecimal("settleoftaxamount"); DynamicObject contractTemp = dataEntity.getDataEntity().getDynamicObject("contract"); if (contractTemp == null) { return; } - long id = dataEntity.getDataEntity().getLong("id"); - QFilter f1 = new QFilter("id", "=", id); - DynamicObject incontractsettle = BusinessDataServiceHelper.loadSingle("ec_in_contract_settle", new QFilter[]{f1}); - if(incontractsettle!=null){ - DynamicObjectCollection itementry = incontractsettle.getDynamicObjectCollection("itementry"); - if(itementry == null) { - if(itementry.isEmpty()) { - 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"); - 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")); - } + DynamicObjectCollection itementry = dataEntity.getDataEntity().getDynamicObjectCollection("itementry"); + if (itementry != null) { + if (itementry.size() == 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"); + 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")); } } // DynamicObjectCollection payitemdetailap = incontractsettle.getDynamicObjectCollection("payitemdetailap"); 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 cfa3005..b83a873 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 @@ -17,12 +17,8 @@ public class OutContractSettlementValidator extends OutContractSettleValidator { { BigDecimal settleOfTaxAmount = dataEntity.getDataEntity().getBigDecimal("settleoftaxamount"); DynamicObject contractTemp = dataEntity.getDataEntity().getDynamicObject("contract"); - long id = dataEntity.getDataEntity().getLong("id"); - QFilter f1 = new QFilter("id", "=", id); - DynamicObject incontractsettle = BusinessDataServiceHelper.loadSingle("ec_in_contract_settle", new QFilter[]{f1}); - if(incontractsettle!=null){ - DynamicObjectCollection itementry = incontractsettle.getDynamicObjectCollection("itementry"); -// DynamicObjectCollection payitemdetailap = incontractsettle.getDynamicObjectCollection("payitemdetailap"); + + DynamicObjectCollection itementry = dataEntity.getDataEntity().getDynamicObjectCollection("itementry"); if(itementry.isEmpty()) { this.addErrorMessage(dataEntity, ResManager.loadKDString("支付合同项不能为空", "InContractSettleValidator_0", "ec-contract-opplugin", new Object[0])); } @@ -48,9 +44,6 @@ public class OutContractSettlementValidator extends OutContractSettleValidator { return true; } } - } - } - return true; } }