From f31752613e0163117277cd43f8b36fb6f92bad13 Mon Sep 17 00:00:00 2001 From: ptt <2403326863@qq.com> Date: Mon, 23 Jun 2025 17:49:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=98=E6=AC=BE=E7=94=B3=E8=AF=B7=EF=BC=8C?= =?UTF-8?q?=E9=80=89=E4=B8=AD=E5=90=88=E5=90=8C=E6=97=B6=EF=BC=8C=E5=B8=A6?= =?UTF-8?q?=E5=87=BA=E9=99=84=E4=BB=B6=E6=94=B9=E4=B8=BA=E7=9B=96=E7=AB=A0?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../formplugin/RePayReqBillFormNewPlugin.java | 460 ++++++++++++++++++ 1 file changed, 460 insertions(+) create mode 100644 main/java/shkd/repc/recon/formplugin/RePayReqBillFormNewPlugin.java diff --git a/main/java/shkd/repc/recon/formplugin/RePayReqBillFormNewPlugin.java b/main/java/shkd/repc/recon/formplugin/RePayReqBillFormNewPlugin.java new file mode 100644 index 0000000..8a801ad --- /dev/null +++ b/main/java/shkd/repc/recon/formplugin/RePayReqBillFormNewPlugin.java @@ -0,0 +1,460 @@ +package shkd.repc.recon.formplugin; + +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.dataentity.utils.StringUtils; +import kd.bos.entity.EntityMetadataCache; +import kd.bos.entity.datamodel.IDataModel; +import kd.bos.entity.datamodel.ListSelectedRowCollection; +import kd.bos.entity.operate.result.OperationResult; +import kd.bos.form.CloseCallBack; +import kd.bos.form.ShowFormHelper; +import kd.bos.form.ShowType; +import kd.bos.form.StyleCss; +import kd.bos.form.events.AfterDoOperationEventArgs; +import kd.bos.form.events.ClosedCallBackEvent; +import kd.bos.form.operate.FormOperate; +import kd.bos.list.ListFilterParameter; +import kd.bos.list.ListShowParameter; +import kd.bos.orm.query.QFilter; +import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.pccs.concs.common.enums.BillStatusEnum; +import kd.pccs.concs.common.util.OperationUtil; +import kd.repc.rebas.common.bizutil.ReBotpUtil; +import kd.repc.rebas.common.bizutil.ReWfUtil; +import kd.repc.rebas.common.enums.ReBillStatusEnum; +import kd.repc.rebas.common.helper.ReFileHelper; +import kd.repc.rebas.common.util.ReDigitalUtil; +import kd.repc.recon.business.helper.RePayReqBillHelper; +import kd.repc.recon.business.helper.suppliercollaboration.RePayReqSupplierCollaborateHelper; +import kd.repc.recon.common.enums.ReInvoiceTypeEnum; +import kd.repc.recon.common.util.ReAttachmentUtil; +import kd.repc.recon.common.util.ReParameterUtil; +import kd.repc.recon.formplugin.base.ReContractPartyListHelper; +import kd.repc.recon.formplugin.f7.ReProgressTaskF7SelectListener; +import kd.repc.recon.formplugin.payreqbill.RePayReqBillFormPlugin; +import kd.repc.recon.formplugin.payreqbill.RePayReqBillTabSelectListener; +import kd.repc.recon.formplugin.payreqbill.RePayReqCostAccumulateHelper; +import kd.repc.recon.formplugin.resupplier.ReSupplierCollaborateUtil; + +import java.math.BigDecimal; +import java.util.*; +import java.util.stream.Collectors; + +public class RePayReqBillFormNewPlugin extends RePayReqBillFormPlugin { + ReSupplierCollaborateUtil supplierUtil; + ReContractPartyListHelper reContractPartyListHelper; + public void initialize() { + super.initialize(); + this.supplierUtil = new ReSupplierCollaborateUtil(this.getView(), new RePayReqSupplierCollaborateHelper()); + this.reContractPartyListHelper = new ReContractPartyListHelper(this, this.getModel()); + this.reContractPartyListHelper.setFieldName("receiveunittype", "multypereceiveunit", "receiveunit_view", "contractbill"); + this.reContractPartyListHelper.setFieldViewIsMustInput(false); + this.reContractPartyListHelper.setExtraField("receiveunit"); + this.tabSelectListener = new RePayReqBillTabSelectListener(this, this.getModel()); + } + + @Override + public void afterBindData(EventObject e) { + IDataModel dataModel = this.getModel(); + DynamicObject dataEntity = dataModel.getDataEntity(true); + DynamicObject contractBill = dataEntity.getDynamicObject("contractbill"); + if (null != contractBill) { + this.setTotalApplyAmtInfo((Long)contractBill.getPkValue(), dataEntity); + this.getModel().setDataChanged(false); + } + + this.tabSelectListener.getCostAccumulateHelper().initCostSplitTab(); + String billStatus = this.getModel().getDataEntity().getString("billstatus"); + if (ReBillStatusEnum.SAVED.getValue().equals(billStatus)) { + Boolean hasCostSplitTab = (new RePayReqCostAccumulateHelper(this, this.getModel())).hasCostSplitTab(); + if (hasCostSplitTab) { + this.tabSelectListener.getCostAccumulateHelper().openCostSplitPage(); + this.getView().setVisible(true, new String[]{"tabcostsplit"}); + } + } + + (new ReProgressTaskF7SelectListener(this, this.getModel())).setProgressTaskTip("progresstask"); + this.supplierUtil.setHandler(); + this.setPayPlanAuditAmt(); + this.reContractPartyListHelper.updateContractParty(); + boolean contractFlag = this.getModel().getDataEntity(true).getDynamicObject("connotextbill") == null; + this.getView().setVisible(contractFlag, new String[]{"receiveunit_view"}); + this.getView().setVisible(!contractFlag, new String[]{"multypereceiveunit"}); + DynamicObject project = dataEntity.getDynamicObject("project"); + if (null != contractBill && null != project) { + boolean workloadconfirmflag = contractBill.getBoolean("workloadconfirmflag"); + String projectParamVal = ReParameterUtil.getProjectParamVal(this.getAppId(), Long.toString((Long)project.getPkValue()), "p_separateworkfirmpay"); + if ("separate".equals(projectParamVal)) { + this.getView().setEnable(false, new String[]{"totalworkloadamt"}); + this.getView().setEnable(false, new String[]{"totalworkloadoriamt"}); + } + + this.getView().setVisible("unSeparate".equals(projectParamVal) && workloadconfirmflag, new String[]{"curworkloadamt"}); + } + + this.handleSubContractentry(dataEntity); + this.loadHisPayEntry(); + this.getModel().setDataChanged(false); + this.setPayReqDateMustInput(); + this.setReDeEntryAmt(); + this.setAttachmentData(); + Map sourceBill = ReBotpUtil.getSourceBill(dataEntity.getLong("id"), "recon_payreqbill"); + if (null != sourceBill.get("recon_connotextbill")) { + this.getView().setEnable(Boolean.FALSE, new String[]{"invoiceentry", "importinvoice", "refinvoice", "deleteinvoiceentry"}); + } + + this.setSecondSplitButton(this.getView(), this.getModel().getDataEntity()); + } + private void setAttachmentData() { + DynamicObject payBill = this.getModel().getDataEntity(true); + DynamicObject contractBill = payBill.getDynamicObject("contractbill"); + if (contractBill != null) { + ReFileHelper.copyFileFromAToB("recon_contractbill", contractBill.getPkValue(), "attachmentpanel", "recon_payreqbill", payBill.getPkValue(), "attachmentpanel"); + DynamicObject supplyContract = BusinessDataServiceHelper.loadSingle("recon_supplyconbill", new QFilter[]{new QFilter("contractbill", "=", contractBill.getPkValue())}); + if (null != supplyContract) { + ReFileHelper.copyFileFromAToB("recon_supplyconbill", supplyContract.getPkValue(), "attachmentcontactdoc", "recon_payreqbill", payBill.getPkValue(), "attachmentpanel"); + } + + this.getView().updateView("attachmentpanel"); + } + + } + private void setTotalApplyAmtInfo(Long contractId, DynamicObject dataEntity) { + Map sumApplyAmtMap = RePayReqBillHelper.getPayReqConAmtByContract(this.getAppId(), contractId, (Long)dataEntity.getPkValue(), dataEntity.getDate("createtime"), false); + BigDecimal totalOriAmt = (BigDecimal)sumApplyAmtMap.get("totaloriamt"); + BigDecimal totalAmount = (BigDecimal)sumApplyAmtMap.get("totalamount"); + BigDecimal totalPayedConOriAmt = (BigDecimal)sumApplyAmtMap.get("totalpayedconoriamt"); + BigDecimal totalPayedConAmount = (BigDecimal)sumApplyAmtMap.get("totalpayedconamt"); + dataEntity.set("totaloriamt", totalOriAmt); + dataEntity.set("totalamount", totalAmount); + dataEntity.set("totalpayedconoriamt", totalPayedConOriAmt); + dataEntity.set("totalpayedconamt", totalPayedConAmount); + this.getView().updateView("totaloriamt"); + this.getView().updateView("totalamount"); + this.getView().updateView("totalpayedconoriamt"); + this.getView().updateView("totalpayedconamt"); + } + + @Override + public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) { + DynamicObject dataEntity = this.getModel().getDataEntity(true); + boolean noContractFlag = dataEntity.getBoolean("nocontractflag"); + FormOperate operate = (FormOperate)afterDoOperationEventArgs.getSource(); + String operateKey = operate.getOperateKey(); + OperationResult operationResult = afterDoOperationEventArgs.getOperationResult(); + if (OperationUtil.isSubmitOp(operateKey)) { + this.getView().updateView(); + } + + if (OperationUtil.isAuditOp(operateKey)) { + this.setAttachmentEnable(); + } else if (OperationUtil.isUnAuditOp(operateKey) || OperationUtil.isUnSubmitOp(operateKey)) { + this.getView().setEnable(Boolean.TRUE, new String[]{"attachmentpanel"}); + } + + if (OperationUtil.isAuditOp(operateKey)) { + this.getModel().updateCache(); + } + + if (OperationUtil.isUnAuditOp(operateKey)) { + this.getView().updateView(); + this.getView().invokeOperation("refresh"); + } + + if (OperationUtil.isSubmitOp(operateKey) && operationResult.isSuccess()) { + if (dataEntity.getBoolean("supplementflag") && StringUtils.equals(dataEntity.getString("billstatus"), BillStatusEnum.SUBMITTED.getValue()) && !ReWfUtil.inProcess(dataEntity, 3)) { + this.getView().invokeOperation("audit"); + } + + this.getView().setVisible(true, new String[]{"payreqsplit"}); + this.getView().updateView("payreqsplit"); + } + + if (StringUtils.equals(operateKey, "reject") && operationResult.isSuccess()) { + this.supplierUtil.openRejectPage(this); + } + + if (StringUtils.equals(operateKey, "addnewinvoice")) { + this.openInvoiceBill(); + } + + ListShowParameter listShowParameter; +// List qFilters; + ListFilterParameter filterParameter; + ArrayList qFilters; + if (StringUtils.equals(operateKey, "newdetailentry")) { + listShowParameter = ShowFormHelper.createShowListForm("recon_rewarddeduct_f7", true); + listShowParameter.setFormId("bos_listf7"); + listShowParameter.setCaption(ResManager.loadKDString("请选择奖励扣款", "RePayReqBillFormPlugin_3", "repc-recon-formplugin", new Object[0])); + StyleCss inlineStyleCss = new StyleCss(); + inlineStyleCss.setHeight("600"); + inlineStyleCss.setWidth("800"); + listShowParameter.getOpenStyle().setInlineStyleCss(inlineStyleCss); + listShowParameter.getOpenStyle().setShowType(ShowType.Modal); + listShowParameter.setCloseCallBack(new CloseCallBack(this, "recon_rewarddeduct_f7")); + DynamicObject contractF7 = dataEntity.getDynamicObject("contractbill"); + DynamicObjectCollection payDetails = dataEntity.getDynamicObjectCollection("payreqdetailentry"); + qFilters = (ArrayList)payDetails.stream().filter((entry) -> { + return entry.get("payentry_rewarddeduct") != null; + }).map((entry) -> { + return entry.getDynamicObject("payentry_rewarddeduct").getLong("id"); + }).collect(Collectors.toList()); + filterParameter = new ListFilterParameter(); + qFilters = new ArrayList(); + qFilters.add(new QFilter("contractbill", "=", contractF7.getPkValue())); + qFilters.add(new QFilter("refbillids", "!=", (Object)null)); + qFilters.add(new QFilter("id", "not in", qFilters)); + filterParameter.setQFilters(qFilters); + listShowParameter.setListFilterParameter(filterParameter); + this.getView().showForm(listShowParameter); + } + + DynamicObjectCollection payNodeEntryColl; + if (StringUtils.equals(operateKey, "refinvoice")) { + listShowParameter = ShowFormHelper.createShowListForm("recon_invoicebill_f7", true); + listShowParameter.setFormId("bos_listf7"); + listShowParameter.setCaption(ResManager.loadKDString("请选择关联发票", "RePayReqBillFormPlugin_4", "repc-recon-formplugin", new Object[0])); + payNodeEntryColl = dataEntity.getDynamicObjectCollection("invoiceentry"); + List selectInvoiceIds = (List)payNodeEntryColl.stream().filter((invoiceEntry) -> { + return null != invoiceEntry.get("inventry_invoicebill"); + }).map((invoiceEntry) -> { + DynamicObject invoiceF7 = invoiceEntry.getDynamicObject("inventry_invoicebill"); + return invoiceF7.getPkValue(); + }).collect(Collectors.toList()); + listShowParameter.setSelectedRows(selectInvoiceIds.toArray()); + StyleCss inlineStyleCss = new StyleCss(); + inlineStyleCss.setHeight("600"); + inlineStyleCss.setWidth("800"); + qFilters = (ArrayList)listShowParameter.getListFilterParameter().getQFilters(); + qFilters.add(new QFilter("org", "=", this.getModel().getDataEntity().getDynamicObject("org").getPkValue())); + qFilters.add(new QFilter("hasredoff", "=", false)); + qFilters.add(new QFilter("invoicetype", "!=", ReInvoiceTypeEnum.ROFFINVOICE.getValue())); + qFilters.add(new QFilter("billstatus", "=", ReBillStatusEnum.AUDITTED.getValue())); + listShowParameter.getOpenStyle().setInlineStyleCss(inlineStyleCss); + listShowParameter.getOpenStyle().setShowType(ShowType.Modal); + listShowParameter.setCloseCallBack(new CloseCallBack(this, "recon_invoicebill_f7")); + this.getView().showForm(listShowParameter); + } + + if (!noContractFlag && StringUtils.equals(operateKey, "selectpaynode")) { + DynamicObject contractF7 = dataEntity.getDynamicObject("contractbill"); + if (contractF7 == null) { + this.getView().showTipNotification(ResManager.loadKDString("请先选择合同", "RePayReqBillFormPlugin_5", "repc-recon-formplugin", new Object[0])); + return; + } + + payNodeEntryColl = dataEntity.getDynamicObjectCollection("paynodeentry"); + Set paySchIds = (Set)payNodeEntryColl.stream().map((e) -> { + return e.getLong("pdentry_payplanschid"); + }).collect(Collectors.toSet()); + ListShowParameter listShowParameter1 = ShowFormHelper.createShowListForm("recon_conpayplan_sch_f7", true); + listShowParameter1.setFormId("bos_listf7"); + listShowParameter1.setSelectedRows(paySchIds.toArray(new Object[0])); + StyleCss inlineStyleCss = new StyleCss(); + inlineStyleCss.setHeight("600"); + inlineStyleCss.setWidth("800"); + listShowParameter1.getOpenStyle().setInlineStyleCss(inlineStyleCss); + listShowParameter1.getOpenStyle().setShowType(ShowType.Modal); + listShowParameter1.setCaption(ResManager.loadKDString("请选择付款节点", "RePayReqBillFormPlugin_6", "repc-recon-formplugin", new Object[0])); + listShowParameter1.setCloseCallBack(new CloseCallBack(this, "recon_conpayplan_sch_f7")); + filterParameter = new ListFilterParameter(); + qFilters = new ArrayList(); + qFilters.add(new QFilter("conpayplan.contractbill", "=", contractF7.getPkValue())); + qFilters.add(new QFilter("conpayplan.conrevisebill", "=", 0L)); + filterParameter.setQFilters(qFilters); + listShowParameter1.setListFilterParameter(filterParameter); + this.getView().showForm(listShowParameter1); + } + + if (StringUtils.equals(operateKey, "payreqsplitsave")) { + this.tabSelectListener.getCostAccumulateHelper().invokeCostSplitOperation("save"); + this.getView().showSuccessNotification(ResManager.loadKDString("保存成功。", "RePayReqBillFormPlugin_21", "repc-recon-formplugin", new Object[0])); + } + + if (StringUtils.equals(operateKey, "payreqsplit")) { + this.tabSelectListener.getCostAccumulateHelper().invokeCostSplitOperation("payreqsplit"); + this.getView().setVisible(false, new String[]{"payreqsplit"}); + this.getView().setVisible(true, new String[]{"payreqsplitsave"}); + this.getView().setVisible(false, new String[]{"bar_submit"}); + this.getView().setVisible(false, new String[]{"bar_audit"}); + this.getView().setVisible(false, new String[]{"bar_print"}); + this.getView().setVisible(false, new String[]{"viewflowchart"}); + this.getView().setVisible(false, new String[]{"tbl_invoiceaddnew"}); + this.getView().updateView("payreqsplit"); + this.getView().updateView("payreqsplitsave"); + this.getView().updateView("bar_submit"); + this.getView().updateView("bar_audit"); + this.getView().updateView("bar_print"); + this.getView().updateView("viewflowchart"); + this.getView().updateView("tbl_invoiceaddnew"); + } + + OperationResult result = afterDoOperationEventArgs.getOperationResult(); + if (null != result && result.isSuccess()) { + this.tabSelectListener.getCostAccumulateHelper().invokeCostSplitOperation(operate); + RePayReqCostAccumulateHelper payReqCostAccumulateHelper = new RePayReqCostAccumulateHelper(this, this.getModel()); + Boolean hasCostSplit = payReqCostAccumulateHelper.hasCostSplitTab(); + if (hasCostSplit) { + payReqCostAccumulateHelper.openCostSplitPage(); + } + + payReqCostAccumulateHelper.showOrHideCostSplitTab(); + } + + if (operateKey.equals("deleteinvoiceentry")) { + this.refreshInvoiceEntry(); + } + + } + + @Override + public void closedCallBack(ClosedCallBackEvent closedCallBackEvent) { + DynamicObject model = this.getModel().getDataEntity(true); + String actionId = closedCallBackEvent.getActionId(); + if ("recon_rejectreason".equals(closedCallBackEvent.getActionId())) { + this.supplierUtil.reject(this.getView().getReturnData()); + } + + DynamicObject[] invoiceF7s; + int i; + int index; + DynamicObject invoiceEntry1; + if (StringUtils.equals("invoiceImport", actionId)) { + Map returnData = (Map)closedCallBackEvent.getReturnData(); + if (!kd.bos.orm.util.CollectionUtils.isEmpty(returnData)) { + DynamicObjectCollection invoiceEnties = model.getDynamicObjectCollection("invoiceentry"); + DynamicObjectType dt = EntityMetadataCache.getDataEntityType("recon_invoicebill_f7"); + Map urlMap = (Map)returnData.get("url"); + invoiceF7s = BusinessDataServiceHelper.load(urlMap.keySet().toArray(), dt); + DynamicObject[] var9 = invoiceF7s; + i = invoiceF7s.length; + + for(index = 0; index < i; ++index) { + invoiceEntry1 = var9[index]; + DynamicObject invoiceEntry = invoiceEnties.addNew(); + invoiceEntry.set("inventry_invoicebill", invoiceEntry); + invoiceEntry.set("inventry_haswriteoffamt", invoiceEntry.get("writeoffamount")); + } + + this.getModel().updateCache(); + this.getView().updateView("invoiceentry"); + this.refreshInvoiceEntry(); + } + } + + if (StringUtils.equals(actionId, "recon_selreceiveno")) { + Object returnData = this.getView().getReturnData(); + if (null != returnData) { + DynamicObject bank = (DynamicObject)((HashMap)returnData).get("bank"); + String bankaccount = (String)((HashMap)returnData).get("bankaccount"); + this.getModel().setValue("receivebank", bank); + this.getModel().setValue("receiveno", bankaccount); + } + } + + ListSelectedRowCollection returnData; + Object[] primaryKeyValues; + DynamicObject[] conpayplanSchF7s; + DynamicObjectCollection payNodeEntries; + DynamicObject entry; + DynamicObject conpayplanSchF7; + if (StringUtils.equals(actionId, "recon_rewarddeduct_f7")) { + returnData = (ListSelectedRowCollection)closedCallBackEvent.getReturnData(); + if (returnData == null || returnData.isEmpty()) { + return; + } + + primaryKeyValues = returnData.getPrimaryKeyValues(); + conpayplanSchF7s = BusinessDataServiceHelper.load(primaryKeyValues, EntityMetadataCache.getDataEntityType("recon_rewarddeduct_f7")); + payNodeEntries = model.getDynamicObjectCollection("payreqredeentry"); + + for(i = 0; i < conpayplanSchF7s.length; ++i) { + entry = conpayplanSchF7s[i]; + conpayplanSchF7 = payNodeEntries.addNew(); + index = payNodeEntries.size(); + conpayplanSchF7.getDataEntityState().setFromDatabase(true); + this.getModel().setValue("inventry_rewarddeduct", entry, index - 1); + } + + this.getModel().updateCache(); + this.getView().updateView("payreqredeentry"); + this.calcActualApplyAmt(); + } + + if (StringUtils.equals(actionId, "recon_conpayplan_sch_f7")) { + returnData = (ListSelectedRowCollection)closedCallBackEvent.getReturnData(); + if (returnData == null || returnData.size() == 0) { + return; + } + + primaryKeyValues = returnData.getPrimaryKeyValues(); + conpayplanSchF7s = BusinessDataServiceHelper.load(primaryKeyValues, EntityMetadataCache.getDataEntityType("recon_conpayplan_sch_f7")); + payNodeEntries = model.getDynamicObjectCollection("paynodeentry"); + payNodeEntries.clear(); + + for(i = 0; i < conpayplanSchF7s.length; ++i) { + entry = payNodeEntries.addNew(); + entry.getDataEntityState().setFromDatabase(true); + conpayplanSchF7 = conpayplanSchF7s[i]; + entry.set("pdentry_payplanschid", conpayplanSchF7.getPkValue()); + entry.set("pdentry_paymenttype", conpayplanSchF7.get("paymenttype")); + entry.set("pdentry_paynode", conpayplanSchF7.get("paynode")); + entry.set("pdentry_begindate", conpayplanSchF7.get("begindate")); + entry.set("pdentry_enddate", conpayplanSchF7.get("enddate")); + entry.set("pdentry_payscale", conpayplanSchF7.get("payscale")); + entry.set("pdentry_paydate", conpayplanSchF7.get("paydate")); + entry.set("pdentry_payoriamt", conpayplanSchF7.get("payoriamt")); + entry.set("pdentry_payamt", conpayplanSchF7.get("payamt")); + entry.set("pdentry_totaloriamt", 0L); + entry.set("pdentry_totalamt", 0L); + entry.set("pdentry_canoriamt", 0L); + entry.set("pdentry_canamt", 0L); + entry.set("pdentry_curoriamt", 0L); + entry.set("pdentry_curamt", 0L); + } + + this.getModel().updateCache(); + this.getView().updateView("paynodeentry"); + } + + if (StringUtils.equals(actionId, "recon_invoicebill_f7")) { + returnData = (ListSelectedRowCollection)closedCallBackEvent.getReturnData(); + if (returnData == null || returnData.isEmpty()) { + return; + } + + primaryKeyValues = returnData.getPrimaryKeyValues(); + DynamicObjectCollection invoiceEntries = model.getDynamicObjectCollection("invoiceentry"); + List invoiceIdList = (List)invoiceEntries.stream().filter((e) -> { + return null != e.get("inventry_invoicebill"); + }).map((e) -> { + return e.getDynamicObject("inventry_invoicebill").getLong("id"); + }).collect(Collectors.toList()); + invoiceF7s = BusinessDataServiceHelper.load(primaryKeyValues, EntityMetadataCache.getDataEntityType("recon_invoicebill_f7")); + BigDecimal invoiceAmt = ReDigitalUtil.ZERO; + + for(i = 0; i < invoiceF7s.length; ++i) { + DynamicObject invoiceBill = invoiceF7s[i]; + if (!invoiceIdList.contains(invoiceBill.getLong("id"))) { + invoiceEntry1 = invoiceEntries.addNew(); + invoiceEntry1.getDataEntityState().setFromDatabase(true); + invoiceEntry1.set("inventry_invoicebill", invoiceBill); + invoiceEntry1.set("inventry_haswriteoffamt", invoiceBill.get("writeoffamount")); + invoiceAmt = ReDigitalUtil.add(invoiceAmt, invoiceBill.get("invoiceamount")); + } + } + + this.getModel().updateCache(); + this.getView().updateView("invoiceentry"); + this.refreshInvoiceEntry(); + } + + } + private void setAttachmentEnable() { + boolean isCanEnableAttachment = ReAttachmentUtil.checkCanUpLoadAttachment(this.getAppId(), this.getModel().getDataEntity()); + this.getView().setEnable(isCanEnableAttachment, new String[]{"attachmentpanel"}); + } +}