diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/OutContractSettleEditPluginExt.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/OutContractSettleEditPluginExt.java index 3b845d1..75b5019 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/OutContractSettleEditPluginExt.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/OutContractSettleEditPluginExt.java @@ -731,23 +731,16 @@ public class OutContractSettleEditPluginExt extends AbstractBillPlugIn implement this.getModel().deleteEntryData("materialinentry"); this.getModel().setValue("issettlebyreconc", false); this.getModel().deleteEntryData("reconcentry"); - DynamicObject contract = (DynamicObject) changeData.getNewValue();//合同名称新值 - if (contract != null) { - DynamicObject contractType = contract.getDynamicObject("contracttype");//合同名称-合同类型 - QFilter[] qFilters = new QFilter[]{new QFilter("number", QCP.equals, contractType.get("number"))}; - DynamicObject ec_conttype = BusinessDataServiceHelper.loadSingle("ec_conttype", "contattr", qFilters);//合同类型 - DynamicObject contattr = ec_conttype.getDynamicObject("contattr");//合同属性 - String number = contattr.getString("number");//合同属性编码 - if (!number.equals("sbwbl")) { + Object value = this.getModel().getValue("contattr");//合同属性 + if (value != null) { + DynamicObject contAttr = (DynamicObject) value; + String numebr = contAttr.getString("number"); + if (!numebr.equals("sbwbl")) { this.getModel().setValue("iseqsettle", false); - this.getView().setVisible(false, "iseqsettle"); - } else { - this.getView().setVisible(true, "iseqsettle"); } - } else { - this.getView().setVisible(false, "iseqsettle"); } this.getModel().deleteEntryData("eqsettleentry"); + DynamicObject contract = (DynamicObject) changeData.getNewValue(); if (contract == null) { this.getView().setVisible(false, new String[]{"issettlebymatin"}); this.getView().setVisible(false, new String[]{"issettlebyreconc"}); @@ -758,22 +751,22 @@ public class OutContractSettleEditPluginExt extends AbstractBillPlugIn implement this.getView().setEnable(false, new String[]{"project"}); } -// boolean isPurchaseContract = this.isPurchaseType(contract); -// if (isPurchaseContract) { - String contractSettle = contract.getString("settlemethod"); - if (StringUtils.equals(contractSettle, "B")) { - this.getModel().setValue("issettlebymatin", true); - this.getModel().setValue("issettlebyreconc", false); - } else if (StringUtils.equals(contractSettle, "A")) { - this.getModel().setValue("issettlebymatin", false); - this.getModel().setValue("issettlebyreconc", true); + boolean isPurchaseContract = this.isPurchaseType(); + if (isPurchaseContract) { + String contractSettle = contract.getString("settlemethod"); + if (StringUtils.equals(contractSettle, "B")) { + this.getModel().setValue("issettlebymatin", true); + this.getModel().setValue("issettlebyreconc", false); + } else if (StringUtils.equals(contractSettle, "A")) { + this.getModel().setValue("issettlebymatin", false); + this.getModel().setValue("issettlebyreconc", true); + } } -// } - this.getView().setVisible(true, new String[]{"issettlebymatin"}); - this.getView().setVisible(true, new String[]{"issettlebyreconc"}); -// boolean isLeaseContract = this.isLeaseType(); -// this.getView().setVisible(isLeaseContract, new String[]{"iseqsettle"}); + this.getView().setVisible(isPurchaseContract, new String[]{"issettlebymatin"}); + this.getView().setVisible(isPurchaseContract, new String[]{"issettlebyreconc"}); + boolean isLeaseContract = this.isLeaseType(); + this.getView().setVisible(isLeaseContract, new String[]{"iseqsettle"}); } }//二开替换 @@ -1026,16 +1019,12 @@ public class OutContractSettleEditPluginExt extends AbstractBillPlugIn implement } - protected boolean isPurchaseType(DynamicObject contract) { - DynamicObject contract1 = (DynamicObject) this.getModel().getValue("contract"); - if (contract1 == null) { + protected boolean isPurchaseType() { + DynamicObject contractAttr = (DynamicObject) this.getModel().getValue("contattr"); + if (contractAttr == null) { return false; } else { - DynamicObject contractType = contract.getDynamicObject("contracttype");//合同名称-合同类型 - QFilter[] qFilters = new QFilter[]{new QFilter("number", QCP.equals, contractType.get("number"))}; - DynamicObject ec_conttype = BusinessDataServiceHelper.loadSingle("ec_conttype", "contattr", qFilters);//合同类型 - DynamicObject contattr = ec_conttype.getDynamicObject("contattr");//合同属性 - String basicType = contattr.getString("basictype"); + String basicType = contractAttr.getString("basictype"); return "02".equals(basicType) || "09".equals(basicType); } }