diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/AimcostcbsbillEditUIExt.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/AimcostcbsbillEditUIExt.java index c210939..a2f016e 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/AimcostcbsbillEditUIExt.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/AimcostcbsbillEditUIExt.java @@ -8,6 +8,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; + import kd.bos.bill.OperationStatus; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObjectCollection; @@ -84,13 +85,13 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B public void registerListener(EventObject e) { super.registerListener(e); - BasedataEdit unitproject = (BasedataEdit)this.getControl("unitproject"); + BasedataEdit unitproject = (BasedataEdit) this.getControl("unitproject"); unitproject.addBeforeF7SelectListener(this); - BasedataEdit project = (BasedataEdit)this.getControl("project"); + BasedataEdit project = (BasedataEdit) this.getControl("project"); project.addBeforeF7SelectListener(this); - BasedataEdit boqEdit = (BasedataEdit)this.getControl("projectboq"); + BasedataEdit boqEdit = (BasedataEdit) this.getControl("projectboq"); boqEdit.addBeforeF7SelectListener(this); - TreeEntryGrid grid = (TreeEntryGrid)this.getControl("treeentryentity"); + TreeEntryGrid grid = (TreeEntryGrid) this.getControl("treeentryentity"); grid.addRowClickListener(this); } @@ -101,16 +102,16 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B protected void setsubEntryColor() { if (this.isAdjust()) { - SubEntryGrid subentryGrid = (SubEntryGrid)this.getView().getControl("subentryentity"); + SubEntryGrid subentryGrid = (SubEntryGrid) this.getView().getControl("subentryentity"); int rowcount = this.getModel().getEntryRowCount("subentryentity"); - for(int i = 0; i < rowcount; ++i) { + for (int i = 0; i < rowcount; ++i) { String oldentryid = TypeUtils.nullToString(this.getModel().getValue("oldentryid", i)); if (!"".equals(oldentryid) && !"0".equals(oldentryid)) { - BigDecimal oldAdjuAmount = (BigDecimal)this.getModel().getValue("oldamountre", i); - BigDecimal amountnew = (BigDecimal)this.getModel().getValue("amount", i); - BigDecimal price = (BigDecimal)this.getModel().getValue("price", i); - BigDecimal qty = (BigDecimal)this.getModel().getValue("qty", i); + BigDecimal oldAdjuAmount = (BigDecimal) this.getModel().getValue("oldamountre", i); + BigDecimal amountnew = (BigDecimal) this.getModel().getValue("amount", i); + BigDecimal price = (BigDecimal) this.getModel().getValue("price", i); + BigDecimal qty = (BigDecimal) this.getModel().getValue("qty", i); if (amountnew.compareTo(BigDecimal.ZERO) == 0 && price.compareTo(BigDecimal.ZERO) == 0 && qty.compareTo(BigDecimal.ZERO) == 0) { subentryGrid.setRowBackcolor("#9D9D9D", new int[]{i}); } else if (oldAdjuAmount.compareTo(amountnew) != 0) { @@ -141,18 +142,18 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B } protected void beforeProjectSelected(BeforeF7SelectEvent ent) { - ListShowParameter parameter = (ListShowParameter)ent.getFormShowParameter(); + ListShowParameter parameter = (ListShowParameter) ent.getFormShowParameter(); QFilter filter = new QFilter("id", "!=", this.getModel().getDataEntity().getPkValue()); List projectIds = new ArrayList(); DynamicObject[] aimcostbills = BusinessDataServiceHelper.load("ecco_aimcostbillcbs", "id,billno,billstatus,creator,modifier,auditor,auditdate,modifytime,createtime,org,treeentryentity.id,treeentryentity.pid,treeentryentity.isGroupNode,treeentryentity.cbs,treeentryentity.oldamount,treeentryentity.pdamount,treeentryentity.description,treeentryentity.isgua,treeentryentity.isleaf,treeentryentity.oldcbsentryid,treeentryentity.isdelete,name,project,unitproject,totalamount,remark,versionno,oldid,isenable,currency,editonunit,fiaccountorg,billhead_lk.id,billhead_lk.billhead_lk_stableid,billhead_lk.billhead_lk_sbillid,billhead_lk.billhead_lk_sid,beforeamt", new QFilter[]{filter}); DynamicObject[] var6 = aimcostbills; int var7 = aimcostbills.length; - for(int var8 = 0; var8 < var7; ++var8) { + for (int var8 = 0; var8 < var7; ++var8) { DynamicObject aimcostbill = var6[var8]; DynamicObject project = aimcostbill.getDynamicObject("project"); if (project != null && !project.getBoolean("editonunit")) { - projectIds.add((Long)project.getPkValue()); + projectIds.add((Long) project.getPkValue()); } } @@ -161,9 +162,9 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B } protected void beforeBoqSelected(BeforeF7SelectEvent beforef7selectevent) { - boolean editOnUnit = (Boolean)this.getModel().getValue("editonunit"); - DynamicObject unitproject = (DynamicObject)this.getModel().getValue("unitproject"); - ListShowParameter parameter = (ListShowParameter)beforef7selectevent.getFormShowParameter(); + boolean editOnUnit = (Boolean) this.getModel().getValue("editonunit"); + DynamicObject unitproject = (DynamicObject) this.getModel().getValue("unitproject"); + ListShowParameter parameter = (ListShowParameter) beforef7selectevent.getFormShowParameter(); if (editOnUnit && unitproject == null) { this.getView().showTipNotification(ResManager.loadKDString("请填写“单位工程”字段。", "AimcostcbsbillEditUI_0", "ec-ecco-formplugin", new Object[0])); beforef7selectevent.setCancel(true); @@ -173,7 +174,7 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B parameter.getListFilterParameter().getQFilters().add(qFilter); } - DynamicObject project = (DynamicObject)this.getModel().getValue("project"); + DynamicObject project = (DynamicObject) this.getModel().getValue("project"); if (project != null) { QFilter qFilter = new QFilter("project", "=", project.getPkValue()); parameter.getListFilterParameter().getQFilters().add(qFilter); @@ -184,8 +185,8 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B } protected void beforeUnitProjectSelected(BeforeF7SelectEvent beforef7selectevent) { - ListShowParameter parameter = (ListShowParameter)beforef7selectevent.getFormShowParameter(); - DynamicObject project = (DynamicObject)this.getModel().getValue("project"); + ListShowParameter parameter = (ListShowParameter) beforef7selectevent.getFormShowParameter(); + DynamicObject project = (DynamicObject) this.getModel().getValue("project"); if (project != null) { QFilter qFilter = new QFilter("parent", "=", project.getPkValue()); List unitprojectIds = new ArrayList(); @@ -195,10 +196,10 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B DynamicObject[] var8 = aimcostbills; int var9 = aimcostbills.length; - for(int var10 = 0; var10 < var9; ++var10) { + for (int var10 = 0; var10 < var9; ++var10) { DynamicObject aimcostbill = var8[var10]; DynamicObject unitproject = aimcostbill.getDynamicObject("unitproject"); - unitprojectIds.add((Long)unitproject.getPkValue()); + unitprojectIds.add((Long) unitproject.getPkValue()); } qFilter.and(new QFilter("id", "not in", unitprojectIds)); @@ -210,7 +211,7 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B protected DynamicObjectTreeNode dynamicObjectToTreeNode(DynamicObject cbsEntryinfo, DynamicObject cbsInfo) { DynamicObjectTreeNode child = new DynamicObjectTreeNode(); - child.setId((Long)cbsEntryinfo.getPkValue()); + child.setId((Long) cbsEntryinfo.getPkValue()); if (cbsEntryinfo.get("pid") != null && cbsEntryinfo.getLong("pid") != 0L) { child.setParentId(cbsEntryinfo.getLong("pid")); } else { @@ -262,21 +263,18 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B newInfo.set("name", project.get("name")); newInfo.set("project", project.get("project")); newInfo.set("org", project.get("org")); - project = project.getDynamicObject("project"); - if (project != null) { - BigDecimal allInContractAmt = this.getAllInContractAmt(project.getLong("id")); + DynamicObject project1 = project.getDynamicObject("project"); + if (project1 != null) { + BigDecimal allInContractAmt = this.getAllInContractAmt(project1.getLong("id")); this.getModel().setValue("totalincontamt", allInContractAmt); } - if (project != null) { - newInfo.set("unitproject", project.get("unitproject")); - } - if (project != null) { - newInfo.set("totalamount", project.get("totalamount")); - } + newInfo.set("unitproject", project.get("unitproject")); + newInfo.set("totalamount", project.get("totalamount")); newInfo.set("remark", project.get("remark")); newInfo.set("editonunit", project.get("editonunit")); newInfo.set("fiaccountorg", project.get("fiaccountorg")); + newInfo.set("zcgj_periodyear", project.get("zcgj_periodyear")); this.versionNum = TypeUtils.string2Double(project.getString("versionno")) + 1.0; newInfo.set("versionno", this.versionNum); newInfo.set("currency", project.get("currency")); @@ -290,21 +288,22 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B this.getView().updateView("org"); this.getView().updateView("versionno"); this.getView().updateView("currency"); + this.getView().updateView("zcgj_periodyear"); Map cbsEntryIdMap = new HashMap(); Map idMap = new HashMap(16); - DynamicObjectCollection cbsEntryColl = (DynamicObjectCollection)project.get("treeentryentity"); + DynamicObjectCollection cbsEntryColl = (DynamicObjectCollection) project.get("treeentryentity"); DynamicObjectCollection entryColl = new DynamicObjectCollection(EcCommonUtils.getEntryDynamicObjectType("ecco_aimcostbillcbs", "treeentryentity"), newInfo); int seq = 0; - for(int i = 0; i < cbsEntryColl.size(); ++i) { - DynamicObject oldValue = (DynamicObject)cbsEntryColl.get(i); + for (int i = 0; i < cbsEntryColl.size(); ++i) { + DynamicObject oldValue = (DynamicObject) cbsEntryColl.get(i); if (!oldValue.getBoolean("isdelete")) { DynamicObject newValue = new DynamicObject(oldValue.getDynamicObjectType()); long entryId = orm.genLongId(EcCommonUtils.getEntryDynamicObjectType("ecco_aimcostbillcbs", "treeentryentity")); newValue.set("id", entryId); idMap.put(oldValue.getDynamicObject("cbs").getString("id"), String.valueOf(entryId)); if (oldValue.get("pid") != null) { - newValue.set("pid", cbsEntryIdMap.get((Long)oldValue.get("pid"))); + newValue.set("pid", cbsEntryIdMap.get((Long) oldValue.get("pid"))); } newValue.set("seq", seq++); @@ -316,14 +315,14 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B newValue.set("isgua", oldValue.get("isgua")); newValue.set("isleaf", cbs == null ? oldValue.get("isleaf") : cbs.get("isleaf")); newValue.set("oldcbsentryid", oldValue.getPkValue()); - cbsEntryIdMap.put((Long)oldValue.getPkValue(), (Long)newValue.getPkValue()); - DynamicObjectCollection oldResourceEntries = (DynamicObjectCollection)oldValue.get("subentryentity"); + cbsEntryIdMap.put((Long) oldValue.getPkValue(), (Long) newValue.getPkValue()); + DynamicObjectCollection oldResourceEntries = (DynamicObjectCollection) oldValue.get("subentryentity"); if (!oldResourceEntries.isEmpty()) { DynamicObjectCollection newResourceEntries = new DynamicObjectCollection(oldResourceEntries.getDynamicObjectType(), newValue); int subseq = 0; - for(int j = 0; j < oldResourceEntries.size(); ++j) { - DynamicObject oldreValue = (DynamicObject)oldResourceEntries.get(j); + for (int j = 0; j < oldResourceEntries.size(); ++j) { + DynamicObject oldreValue = (DynamicObject) oldResourceEntries.get(j); if (oldreValue.getBigDecimal("amount").compareTo(BigDecimal.ZERO) != 0 || oldreValue.getBigDecimal("price").compareTo(BigDecimal.ZERO) != 0 || oldreValue.getBigDecimal("qty").compareTo(BigDecimal.ZERO) != 0) { DynamicObject newreValue = new DynamicObject(oldreValue.getDynamicObjectType()); newreValue.set("seq", subseq++); @@ -357,6 +356,7 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B this.adjustAddNewCbs(project, entryColl, idMap); this.getView().setEnable(false, new String[]{"project"}); this.getView().setEnable(false, new String[]{"editonunit"}); + this.getView().setEnable(false, new String[]{"zcgj_periodyear"}); this.getModel().updateEntryCache(entryColl); this.getView().updateView("treeentryentity"); } @@ -371,14 +371,14 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B DynamicObject[] var7 = procbss; int i = procbss.length; - for(int var9 = 0; var9 < i; ++var9) { + for (int var9 = 0; var9 < i; ++var9) { DynamicObject procbs = var7[var9]; String procbsId = procbs.getString("id"); i = 0; int entryCollSize; - for(entryCollSize = entryColl.size(); i < entryCollSize; ++i) { - DynamicObject entryCbsObj = ((DynamicObject)entryColl.get(i)).getDynamicObject("cbs"); + for (entryCollSize = entryColl.size(); i < entryCollSize; ++i) { + DynamicObject entryCbsObj = ((DynamicObject) entryColl.get(i)).getDynamicObject("cbs"); if (procbsId.equals(entryCbsObj.getString("id"))) { break; } @@ -392,10 +392,10 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B if (!newProCbsList.isEmpty()) { ORM orm = ORM.create(); - for(i = 0; i < newProCbsList.size(); ++i) { + for (i = 0; i < newProCbsList.size(); ++i) { DynamicObject newValue = new DynamicObject(entryColl.getDynamicObjectType()); long treeEntryId = orm.genLongId(entryColl.getDynamicObjectType()); - DynamicObject newCbs = (DynamicObject)newProCbsList.get(i); + DynamicObject newCbs = (DynamicObject) newProCbsList.get(i); idMap.put(newCbs.getString("id"), String.valueOf(treeEntryId)); newValue.set("cbs", newCbs); boolean isleaf = newCbs.getBoolean("isleaf"); @@ -428,7 +428,7 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B this.getView().updateView("treeentryentity"); this.getView().updateView("subentryentity"); if (OperationStatus.ADDNEW.equals(this.getView().getFormShowParameter().getStatus())) { - BigDecimal beforeAmt = (BigDecimal)this.getModel().getValue("totalamount"); + BigDecimal beforeAmt = (BigDecimal) this.getModel().getValue("totalamount"); this.getModel().setValue("beforeamt", beforeAmt); } } else { @@ -450,13 +450,13 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B this.refershTreeEnable(); this.setSumToRow("treeentryentity", new String[]{"oldamount", "pdamount"}); this.setsubEntryColor(); - TreeEntryGrid treeEntry = (TreeEntryGrid)this.getView().getControl("treeentryentity"); + TreeEntryGrid treeEntry = (TreeEntryGrid) this.getView().getControl("treeentryentity"); treeEntry.setCollapse(false); } protected void setUnitProjectMustinput() { - boolean editOnUnit = (Boolean)this.getModel().getValue("editonunit"); - BasedataEdit unitProjectEdit = (BasedataEdit)this.getView().getControl("unitproject"); + boolean editOnUnit = (Boolean) this.getModel().getValue("editonunit"); + BasedataEdit unitProjectEdit = (BasedataEdit) this.getView().getControl("unitproject"); unitProjectEdit.setMustInput(editOnUnit); } @@ -468,14 +468,14 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B } } - return this.getView().getFormShowParameter().getCustomParam("isadjust") == null ? false : (Boolean)this.getView().getFormShowParameter().getCustomParam("isadjust"); + return this.getView().getFormShowParameter().getCustomParam("isadjust") == null ? false : (Boolean) this.getView().getFormShowParameter().getCustomParam("isadjust"); } protected void refershTreeEnable() { int rowcount = this.getModel().getEntryRowCount("treeentryentity"); - TreeEntryGrid grid = (TreeEntryGrid)this.getView().getControl("treeentryentity"); + TreeEntryGrid grid = (TreeEntryGrid) this.getView().getControl("treeentryentity"); - for(int i = 0; i < rowcount; ++i) { + for (int i = 0; i < rowcount; ++i) { if (this.isAdjust() && this.getModel().getValue("oldcbsentryid", i) != null && !"0".equals(TypeUtils.nullToString(this.getModel().getValue("oldcbsentryid", i)))) { BigDecimal oldAmount = EcNumberHelper.toBigDecimal(this.getModel().getValue("oldamount", i)); BigDecimal newAmount = EcNumberHelper.toBigDecimal(this.getModel().getValue("pdamount", i)); @@ -494,7 +494,7 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B protected void fillTreeList(IDataModel model, DynamicObject[] objs, boolean isRoot, int rowIndex) { if (objs != null && objs.length != 0) { - for(int i = 0; i < objs.length; ++i) { + for (int i = 0; i < objs.length; ++i) { // int rIndex = false; int rIndex; if (isRoot) { @@ -503,7 +503,7 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B rIndex = model.insertEntryRow("treeentryentity", rowIndex); } - TreeEntryGrid grid = (TreeEntryGrid)this.getView().getControl("treeentryentity"); + TreeEntryGrid grid = (TreeEntryGrid) this.getView().getControl("treeentryentity"); grid.getModel().updateCache(); model.setValue("cbs", objs[i], rIndex); model.setValue("isleaf", objs[i].get("isleaf"), rIndex); @@ -548,15 +548,15 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B DynamicObject org; DynamicObject currency; if (newValue != null) { - org = (DynamicObject)newValue; - currency = CurrencyHelper.getCurrency((Long)org.getPkValue()); + org = (DynamicObject) newValue; + currency = CurrencyHelper.getCurrency((Long) org.getPkValue()); if (currency != null) { this.getModel().setValue("currency", currency); } } else { org = this.getModel().getDataEntity().getDynamicObject("org"); if (org != null) { - currency = CurrencyHelper.getCurrency((Long)org.getPkValue()); + currency = CurrencyHelper.getCurrency((Long) org.getPkValue()); if (currency != null) { this.getModel().setValue("currency", currency); } @@ -568,16 +568,16 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B protected BigDecimal getAllInContractAmt(Long projectPk) { DynamicObject[] contractBillCols = BusinessDataServiceHelper.load("ec_in_contract", "id,project,contstatus,totaloftaxamount,signamount,currency,stdcurrency,exchangedate", new QFilter[]{new QFilter("project", "=", projectPk), new QFilter("billstatus", "=", BillStatusEnum.AUDIT.getValue()), new QFilter("paydirection", "=", PayDirectionEnum.IN.getValue())}); BigDecimal allInContAmount = BigDecimal.ZERO; - DynamicObject projectCurrencyObject = (DynamicObject)this.getModel().getValue("currency"); + DynamicObject projectCurrencyObject = (DynamicObject) this.getModel().getValue("currency"); Long projCurrency = 0L; if (projectCurrencyObject != null) { - projCurrency = (Long)projectCurrencyObject.getPkValue(); + projCurrency = (Long) projectCurrencyObject.getPkValue(); } - for(int i = 0; i < contractBillCols.length; ++i) { + for (int i = 0; i < contractBillCols.length; ++i) { DynamicObject contractBill = contractBillCols[i]; - DynamicObject currency = (DynamicObject)contractBill.get("currency"); - DynamicObject stdCurrency = (DynamicObject)contractBill.get("stdcurrency"); + DynamicObject currency = (DynamicObject) contractBill.get("currency"); + DynamicObject stdCurrency = (DynamicObject) contractBill.get("stdcurrency"); BigDecimal originaloftaxamount = contractBill.getBigDecimal("totaloftaxamount"); BigDecimal signamount = contractBill.getBigDecimal("signamount"); BigDecimal contAmount = null; @@ -588,13 +588,13 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B contAmount = originaloftaxamount; } } else if (currency != null && projectCurrencyObject != null) { - DynamicObject org = (DynamicObject)this.getModel().getValue("org"); + DynamicObject org = (DynamicObject) this.getModel().getValue("org"); BigDecimal rate = BigDecimal.ONE; if (org != null) { Long orgPk = org.getLong("id"); DynamicObject rateTable = CurrencyHelper.getExRateTable(orgPk); if (rateTable != null) { - rate = CurrencyHelper.getExChangeRate((Long)currency.getPkValue(), projCurrency, rateTable.getLong("id"), contractBill.getDate("exchangedate")); + rate = CurrencyHelper.getExChangeRate((Long) currency.getPkValue(), projCurrency, rateTable.getLong("id"), contractBill.getDate("exchangedate")); } } @@ -614,15 +614,15 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B } protected void amountChanged(ChangeData changeData) { - boolean isimport = "true".equals(TypeUtils.nullToString((String)this.getView().getFormShowParameter().getCustomParam("isdeletesubentry"))); + boolean isimport = "true".equals(TypeUtils.nullToString((String) this.getView().getFormShowParameter().getCustomParam("isdeletesubentry"))); if (!isimport) { int parentRowIndex = changeData.getParentRowIndex(); - EntryGrid treeEntry = (EntryGrid)this.getView().getControl("treeentryentity"); + EntryGrid treeEntry = (EntryGrid) this.getView().getControl("treeentryentity"); int[] selectrows = treeEntry.getSelectRows(); if (parentRowIndex >= 0) { DynamicObject treeEntryRowObj = this.getModel().getEntryRowEntity("treeentryentity", parentRowIndex); DynamicObjectCollection subentryentity = treeEntryRowObj.getDynamicObjectCollection("subentryentity"); - BigDecimal pdAmount = (BigDecimal)subentryentity.stream().map((o) -> { + BigDecimal pdAmount = (BigDecimal) subentryentity.stream().map((o) -> { return o.getBigDecimal("amount"); }).reduce(BigDecimal.ZERO, BigDecimal::add); this.getModel().setValue("pdamount", pdAmount, parentRowIndex); @@ -639,22 +639,22 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B } protected void qtyChanged(Object newValue, int rowIndex) { - BigDecimal qtynew = (BigDecimal)newValue; + BigDecimal qtynew = (BigDecimal) newValue; qtynew = qtynew == null ? BigDecimal.ZERO : qtynew; - BigDecimal price = (BigDecimal)this.getModel().getValue("price", rowIndex); + BigDecimal price = (BigDecimal) this.getModel().getValue("price", rowIndex); this.getModel().setValue("amount", qtynew.multiply(price), rowIndex); } protected void priceChanged(Object newValue, int rowIndex) { - BigDecimal pricenew = (BigDecimal)newValue; + BigDecimal pricenew = (BigDecimal) newValue; pricenew = pricenew == null ? BigDecimal.ZERO : pricenew; - BigDecimal qty = (BigDecimal)this.getModel().getValue("qty", rowIndex); + BigDecimal qty = (BigDecimal) this.getModel().getValue("qty", rowIndex); this.getModel().setValue("amount", pricenew.multiply(qty), rowIndex); } protected void resourceItemChanged(Object newValue, int rowIndex) { if (newValue != null) { - DynamicObject resourceItem = (DynamicObject)newValue; + DynamicObject resourceItem = (DynamicObject) newValue; String costType = CostTypeUtils.getCostType(resourceItem); this.getModel().setValue("costitem", costType, rowIndex); } @@ -662,9 +662,9 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B } protected void pdamountChanged(Object oldValue, Object newValue, int rowIndex) { - boolean isimport = "true".equals(TypeUtils.nullToString((String)this.getView().getFormShowParameter().getCustomParam("isimport"))); - boolean isdeletesubentry = "true".equals(TypeUtils.nullToString((String)this.getView().getFormShowParameter().getCustomParam("isdeletesubentry"))); - boolean isPdamountChange = "true".equals(TypeUtils.nullToString((String)this.getView().getFormShowParameter().getCustomParam("isPdamountChange"))); + boolean isimport = "true".equals(TypeUtils.nullToString((String) this.getView().getFormShowParameter().getCustomParam("isimport"))); + boolean isdeletesubentry = "true".equals(TypeUtils.nullToString((String) this.getView().getFormShowParameter().getCustomParam("isdeletesubentry"))); + boolean isPdamountChange = "true".equals(TypeUtils.nullToString((String) this.getView().getFormShowParameter().getCustomParam("isPdamountChange"))); if (!isimport && !isdeletesubentry && !isPdamountChange) { this.getView().getFormShowParameter().setCustomParam("isPdamountChange", "true"); DynamicObject row = this.getModel().getEntryRowEntity("treeentryentity", rowIndex); @@ -685,12 +685,12 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B } protected void setSubEntrySumAmount() { - SubEntryGrid subentryGrid = (SubEntryGrid)this.getView().getControl("subentryentity"); + SubEntryGrid subentryGrid = (SubEntryGrid) this.getView().getControl("subentryentity"); int rowcount = this.getModel().getEntryRowCount("subentryentity"); BigDecimal totalSubAmount = BigDecimal.ZERO; - for(int i = 0; i < rowcount; ++i) { - BigDecimal subEntryAmount = (BigDecimal)this.getModel().getValue("amount", i); + for (int i = 0; i < rowcount; ++i) { + BigDecimal subEntryAmount = (BigDecimal) this.getModel().getValue("amount", i); totalSubAmount = EcNumberHelper.add(totalSubAmount, subEntryAmount); } @@ -703,10 +703,10 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B protected void setSumToRow(String tbl, String[] cols) { if (null != tbl && !"".equals(tbl)) { - EntryGrid treeEntry = (EntryGrid)this.getView().getControl(tbl); + EntryGrid treeEntry = (EntryGrid) this.getView().getControl(tbl); Map floatButtomData = new HashMap(16); - for(int i = 0; i < cols.length; ++i) { + for (int i = 0; i < cols.length; ++i) { floatButtomData.put(cols[i], (String) null); } @@ -714,8 +714,8 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B Set setKey = mapSum.keySet(); Iterator iter = setKey.iterator(); - while(iter.hasNext()) { - String str = (String)iter.next(); + while (iter.hasNext()) { + String str = (String) iter.next(); DynamicObject currency = this.getModel().getDataEntity().getDynamicObject("currency"); floatButtomData.put(str, CurrencyFormatUtil.getAfterFormatString(currency, mapSum.get(str))); } @@ -730,10 +730,10 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B int tblLength = this.getModel().getEntryRowCount(tbl); int colLength = cols.length; - for(int i = 0; i < tblLength; ++i) { + for (int i = 0; i < tblLength; ++i) { DynamicObject row = this.getModel().getEntryRowEntity(tbl, i); if (row.get("isleaf") != null && Boolean.TRUE.equals(Boolean.valueOf(row.get("isleaf").toString()))) { - for(int j = 0; j < colLength; ++j) { + for (int j = 0; j < colLength; ++j) { if (row.get(cols[j]) != null) { Object obj = EcNumberHelper.toBigDecimal(mapSum.get(cols[j])); Object dec = EcNumberHelper.toBigDecimal(row.get(cols[j])); @@ -752,7 +752,7 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B public void beforeDoOperation(BeforeDoOperationEventArgs beforedooperationeventargs) { super.beforeDoOperation(beforedooperationeventargs); - FormOperate formOperate = (FormOperate)beforedooperationeventargs.getSource(); + FormOperate formOperate = (FormOperate) beforedooperationeventargs.getSource(); String key = formOperate.getOperateKey(); if ("newsubentry".equals(key)) { this.beforeNewSubEntry(beforedooperationeventargs); @@ -784,7 +784,7 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B } protected void doShowBudget() { - DynamicObject project = (DynamicObject)this.getModel().getValue("project"); + DynamicObject project = (DynamicObject) this.getModel().getValue("project"); boolean isUnitProject = CBSBudgetUtil.projectIsUnit(project); if (isUnitProject && this.getModel().getValue("unitproject") == null) { this.getView().showMessage(ResManager.loadKDString("单位工程未录入", "AimcostcbsbillEditUI_14", "ec-ecco-formplugin", new Object[0])); @@ -814,9 +814,9 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B this.getView().showTipNotification(ResManager.loadKDString("编码不能为空。", "AimcostcbsbillEditUI_3", "ec-ecco-formplugin", new Object[0])); beforedooperationeventargs.setCancel(true); } else { - boolean editOnUnit = (Boolean)this.getModel().getValue("editonunit"); - DynamicObject project = (DynamicObject)this.getModel().getValue("project"); - DynamicObject unitProject = (DynamicObject)this.getModel().getValue("unitproject"); + boolean editOnUnit = (Boolean) this.getModel().getValue("editonunit"); + DynamicObject project = (DynamicObject) this.getModel().getValue("project"); + DynamicObject unitProject = (DynamicObject) this.getModel().getValue("unitproject"); if (editOnUnit && unitProject == null) { this.getView().showTipNotification(ResManager.loadKDString("请填写“单位工程”字段。", "AimcostcbsbillEditUI_0", "ec-ecco-formplugin", new Object[0])); beforedooperationeventargs.setCancel(true); @@ -841,17 +841,17 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B // beforedooperationeventargs.setCancel(true); // } - List graySubEntryIds = (List)EcSerializeHelper.unserialize(this.getPageCache().get("subentry_grayids")); + List graySubEntryIds = (List) EcSerializeHelper.unserialize(this.getPageCache().get("subentry_grayids")); if (graySubEntryIds != null && !graySubEntryIds.isEmpty()) { DynamicObjectCollection entryEntity = this.getModel().getEntryEntity("treeentryentity"); int entryRow = 0; - for(Iterator var12 = entryEntity.iterator(); var12.hasNext(); ++entryRow) { - DynamicObject entry = (DynamicObject)var12.next(); + for (Iterator var12 = entryEntity.iterator(); var12.hasNext(); ++entryRow) { + DynamicObject entry = (DynamicObject) var12.next(); Iterator var14 = entry.getDynamicObjectCollection("subentryentity").iterator(); - while(var14.hasNext()) { - DynamicObject subEntry = (DynamicObject)var14.next(); + while (var14.hasNext()) { + DynamicObject subEntry = (DynamicObject) var14.next(); if (!graySubEntryIds.contains(subEntry.getPkValue())) { boolean isCancel = false; StringBuilder errorMessage = new StringBuilder(String.format(ResManager.loadKDString("请填写第%s行项目CBS对应预算成本清单分录的非灰色行", "AimcostcbsbillEditUI_6", "ec-ecco-formplugin", new Object[0]), entryRow + 1)); @@ -889,7 +889,7 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B } protected void beforeDoNew() { - DynamicObject project = (DynamicObject)this.getModel().getValue("project"); + DynamicObject project = (DynamicObject) this.getModel().getValue("project"); if (project != null) { this.getView().getFormShowParameter().setCustomParam("projectId", project.getPkValue()); } @@ -897,12 +897,12 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B } protected void deleteSubRows() { - List graySubEntryIds = (List)EcSerializeHelper.unserialize(this.getPageCache().get("subentry_grayids")); + List graySubEntryIds = (List) EcSerializeHelper.unserialize(this.getPageCache().get("subentry_grayids")); if (graySubEntryIds == null) { graySubEntryIds = new ArrayList(10); } - SubEntryGrid subentryGrid = (SubEntryGrid)this.getView().getControl("subentryentity"); + SubEntryGrid subentryGrid = (SubEntryGrid) this.getView().getControl("subentryentity"); int[] selectrows = subentryGrid.getSelectRows(); if (selectrows.length > 0) { if (this.isAdjust()) { @@ -910,7 +910,7 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B List shijideleterows = new ArrayList(10); BigDecimal subAmount = BigDecimal.ZERO; - for(int i = 0; i < selectrows.length; ++i) { + for (int i = 0; i < selectrows.length; ++i) { if (this.getModel().getValue("amount", selectrows[i]) != null) { subAmount = EcNumberHelper.add(subAmount, this.getModel().getValue("amount", selectrows[i])); } @@ -920,7 +920,7 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B this.getModel().setValue("qty", BigDecimal.ZERO, selectrows[i]); this.getModel().setValue("amount", BigDecimal.ZERO, selectrows[i]); Object pkValue = this.getModel().getEntryRowEntity("subentryentity", selectrows[i]).getPkValue(); - ((List)graySubEntryIds).add(pkValue); + ((List) graySubEntryIds).add(pkValue); } else { shijideleterows.add(selectrows[i]); } @@ -929,14 +929,14 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B this.getView().updateView("subentryentity"); int[] deleteRows = new int[shijideleterows.size()]; - for(int j = shijideleterows.size() - 1; j >= 0; --j) { - deleteRows[j] = (Integer)shijideleterows.get(j); + for (int j = shijideleterows.size() - 1; j >= 0; --j) { + deleteRows[j] = (Integer) shijideleterows.get(j); } this.getModel().deleteEntryRows("subentryentity", deleteRows); this.getView().updateView("subentryentity"); this.setsubEntryColor(); - EntryGrid treeEntry = (EntryGrid)this.getView().getControl("treeentryentity"); + EntryGrid treeEntry = (EntryGrid) this.getView().getControl("treeentryentity"); int[] treeEntrySelectedRows = treeEntry.getSelectRows(); if (treeEntrySelectedRows.length > 0) { this.getView().updateView("treeentryentity"); @@ -961,14 +961,14 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B BigDecimal subAmount = BigDecimal.ZERO; int parentRowIndex; - for(parentRowIndex = 0; parentRowIndex < selectrows.length; ++parentRowIndex) { + for (parentRowIndex = 0; parentRowIndex < selectrows.length; ++parentRowIndex) { if (this.getModel().getValue("amount", selectrows[parentRowIndex]) != null) { subAmount = EcNumberHelper.add(subAmount, this.getModel().getValue("amount", selectrows[parentRowIndex])); } } parentRowIndex = this.getModel().getEntryCurrentRowIndex("treeentryentity"); - EntryGrid treeEntry = (EntryGrid)this.getView().getControl("treeentryentity"); + EntryGrid treeEntry = (EntryGrid) this.getView().getControl("treeentryentity"); if (parentRowIndex >= 0) { BigDecimal cbsOldAmount = EcNumberHelper.toBigDecimal(this.getModel().getValue("pdamount", parentRowIndex)); this.getModel().setValue("pdamount", EcNumberHelper.subtract(cbsOldAmount, subAmount), parentRowIndex); @@ -984,7 +984,7 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B } protected void beforeNewSubEntry(BeforeDoOperationEventArgs beforedooperationeventargs) { - TreeEntryGrid grid = (TreeEntryGrid)this.getControl("treeentryentity"); + TreeEntryGrid grid = (TreeEntryGrid) this.getControl("treeentryentity"); int[] selectrow = grid.getSelectRows(); if (selectrow.length > 0) { boolean isdelete = "true".equals(TypeUtils.nullToString(this.getModel().getValue("isdelete", selectrow[0]))); @@ -1007,7 +1007,7 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) { super.afterDoOperation(afterDoOperationEventArgs); - FormOperate formOperate = (FormOperate)afterDoOperationEventArgs.getSource(); + FormOperate formOperate = (FormOperate) afterDoOperationEventArgs.getSource(); String key = formOperate.getOperateKey(); if ("newsubentry".equals(key)) { this.afterNewSubEntry(); @@ -1022,14 +1022,14 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B } protected void doFoldAll(boolean isFold) { - TreeEntryGrid treeGrid = (TreeEntryGrid)this.getControl("treeentryentity"); + TreeEntryGrid treeGrid = (TreeEntryGrid) this.getControl("treeentryentity"); treeGrid.setCollapse(isFold); } protected void afterDeleteSubEntry() { int subRowcount = this.getModel().getEntryRowCount("subentryentity"); if (subRowcount == 0) { - TreeEntryGrid grid = (TreeEntryGrid)this.getControl("treeentryentity"); + TreeEntryGrid grid = (TreeEntryGrid) this.getControl("treeentryentity"); int[] selectrow = grid.getSelectRows(); if (selectrow.length > 0) { DynamicObject entryRowEntity = this.getModel().getEntryRowEntity("treeentryentity", selectrow[0]); @@ -1057,11 +1057,11 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B RowDataEntity[] var4 = rowDataEntities; int var5 = rowDataEntities.length; - for(int var6 = 0; var6 < var5; ++var6) { + for (int var6 = 0; var6 < var5; ++var6) { RowDataEntity rowDataEntity = var4[var6]; int rowIndex = rowDataEntity.getRowIndex(); int parentRowIndex = rowDataEntity.getParentRowIndex(); - DynamicObject parentCbs = (DynamicObject)this.getModel().getValue("cbs", parentRowIndex); + DynamicObject parentCbs = (DynamicObject) this.getModel().getValue("cbs", parentRowIndex); this.getModel().setValue("cbsre", parentCbs, rowIndex, parentRowIndex); } } @@ -1070,7 +1070,7 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B protected void afterNewSubEntry() { ORM orm = ORM.create(); - TreeEntryGrid grid = (TreeEntryGrid)this.getControl("treeentryentity"); + TreeEntryGrid grid = (TreeEntryGrid) this.getControl("treeentryentity"); int[] selectrow = grid.getSelectRows(); if (selectrow.length > 0) { boolean isGua = "true".equals(TypeUtils.nullToString(this.getModel().getValue("isgua", selectrow[0]))); @@ -1085,7 +1085,7 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B int rowcount = this.getModel().getEntryRowCount("subentryentity"); - for(int i = 0; i < rowcount; ++i) { + for (int i = 0; i < rowcount; ++i) { DynamicObject subEntity = this.getModel().getEntryRowEntity("subentryentity", i); if (subEntity.get("id") == null || subEntity.getLong("id") == 0L) { subEntity.set("id", orm.genLongId(subEntity.getDataEntityType())); @@ -1107,10 +1107,10 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B if (messageBoxClosedEvent.getResult().equals(MessageBoxResult.Yes)) { DynamicObjectCollection subentryColl = this.getModel().getEntryEntity("subentryentity"); - for(int i = 0; i < subentryColl.size(); ++i) { - DynamicObject subEntry = (DynamicObject)subentryColl.get(i); + for (int i = 0; i < subentryColl.size(); ++i) { + DynamicObject subEntry = (DynamicObject) subentryColl.get(i); if (subEntry.get("projectboq") != null) { - subEntry.set("projectboq", (Object)null); + subEntry.set("projectboq", (Object) null); } } @@ -1126,7 +1126,7 @@ public class AimcostcbsbillEditUIExt extends AbstractEccoBillPlugin implements B } protected void setParentAmount(String table, String colname, int rowIndex, String parentId, BigDecimal oldAmount, BigDecimal newAmount) { - for(int i = rowIndex - 1; i >= 0; --i) { + for (int i = rowIndex - 1; i >= 0; --i) { String parent = this.getModel().getEntryRowEntity(table, i).get("id").toString(); if (parent.equals(parentId)) { if (oldAmount == null) {