From 00b4dd02ee99b879d2402729a0c839ee4b1dc111 Mon Sep 17 00:00:00 2001 From: xuhaihui <2098865055@qq.com> Date: Thu, 5 Jun 2025 11:21:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E5=BA=8F=E6=88=90=E6=9C=AC=E9=A2=84?= =?UTF-8?q?=E7=AE=97=E5=8D=95=E6=8D=AE=E8=B0=83=E6=95=B4=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=9C=80=E9=80=89=E8=8C=83=E5=9B=B4=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E6=95=B0=E6=8D=AE=EF=BC=88=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/AimcostcbsbillListPluginExt.java | 114 ++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/AimcostcbsbillListPluginExt.java diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/AimcostcbsbillListPluginExt.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/AimcostcbsbillListPluginExt.java new file mode 100644 index 0000000..09fdaf8 --- /dev/null +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/AimcostcbsbillListPluginExt.java @@ -0,0 +1,114 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package zcgj.zcdev.zcdev.pr.plugin.form; + +import kd.bos.bill.OperationStatus; +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.dataentity.resource.ResManager; +import kd.bos.dataentity.utils.StringUtils; +import kd.bos.entity.EntityMetadataCache; +import kd.bos.entity.datamodel.ListSelectedRowCollection; +import kd.bos.form.CloseCallBack; +import kd.bos.form.FormShowParameter; +import kd.bos.form.ShowType; +import kd.bos.form.events.BeforeDoOperationEventArgs; +import kd.bos.form.events.ClosedCallBackEvent; +import kd.bos.form.operate.FormOperate; +import kd.bos.list.BillList; +import kd.bos.orm.query.QFilter; +import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.ec.basedata.common.enums.StatusEnum; +import kd.ec.contract.common.utils.TypeUtils; +import kd.ec.cost.formplugin.AbstractEccoListPlugin; +import org.apache.commons.collections4.map.HashedMap; + +public class AimcostcbsbillListPluginExt extends AbstractEccoListPlugin { + private static final String KEY_DOREFRESH = "refresh"; + private static final String CALLBACKID_REFRESHBACK = "refreshcallback"; + + public AimcostcbsbillListPluginExt() { + } + + public void beforeDoOperation(BeforeDoOperationEventArgs args) { + FormOperate operate = (FormOperate)args.getSource(); + String operateKey = operate.getOperateKey(); + BillList billList = (BillList)this.getControl("billlistap"); + ListSelectedRowCollection selectedRows = billList.getSelectedRows(); + Object[] aimcostcbsPks = null; + if (selectedRows != null && !selectedRows.isEmpty()) { + aimcostcbsPks = new Object[selectedRows.size()]; + + for(int i = 0; i < selectedRows.size(); ++i) { + aimcostcbsPks[i] = selectedRows.get(i).getPrimaryKeyValue(); + } + } + + if ("adjust".equals(operateKey)) { + this.doAdjust(aimcostcbsPks); + } else if ("summaryall".equals(operateKey)) { + this.summaryAllBill(aimcostcbsPks); + } + + } + + protected void summaryAllBill(Object[] aimcostcbsPks) { + if (aimcostcbsPks != null && aimcostcbsPks.length == 1) { + DynamicObject obj = BusinessDataServiceHelper.loadSingle(aimcostcbsPks[0], "ecco_aimcostbillcbs"); + DynamicObject project = obj.getDynamicObject("project"); + FormShowParameter parameter = new FormShowParameter(); + parameter.setFormId("ecco_projecttotalbudget"); + parameter.setCustomParam("projectId", project != null ? project.getPkValue() : null); + parameter.getOpenStyle().setShowType(ShowType.Modal); + this.getView().showForm(parameter); + } else { + this.getView().showTipNotification(ResManager.loadKDString("请选择单条预算后查看。", "AimcostcbsbillListPlugin_0", "ec-ecco-formplugin", new Object[0])); + } + } + + protected void doAdjust(Object[] aimcostcbsPks) { + if (aimcostcbsPks != null && aimcostcbsPks.length != 1) { + this.getView().showTipNotification(ResManager.loadKDString("请选中1条已审核的记录。", "AimcostcbsbillListPlugin_1", "ec-ecco-formplugin", new Object[0])); + } else { + DynamicObject[] aimcostcbsInfos = BusinessDataServiceHelper.load(aimcostcbsPks, EntityMetadataCache.getDataEntityType("ecco_aimcostbillcbs")); + if (!StatusEnum.Checked.value.equalsIgnoreCase(TypeUtils.nullToString(aimcostcbsInfos[0].get("billstatus")))) { + this.getView().showTipNotification(String.format(ResManager.loadKDString("只有已审核状态的数据才能调整,请重新选择:%s", "AimcostcbsbillListPlugin_2", "ec-ecco-formplugin", new Object[0]), aimcostcbsInfos[0].get("name"))); + } else { + QFilter filter = new QFilter("versionno", ">", aimcostcbsInfos[0].get("versionno")); + filter.and(new QFilter("zcgj_periodyear", "=", aimcostcbsInfos[0].get("zcgj_periodyear"))); + filter.and(new QFilter("project", "=", aimcostcbsInfos[0].getDynamicObject("project").getPkValue())); + if (aimcostcbsInfos[0].get("unitproject") != null) { + filter.and(new QFilter("unitproject", "=", aimcostcbsInfos[0].getDynamicObject("unitproject").getPkValue())); + } else { + filter.and(new QFilter("unitproject", "=", 0)); + } + + DynamicObject[] gaobanbens = BusinessDataServiceHelper.load("ecco_aimcostbillcbs", "id", new QFilter[]{filter}); + if (gaobanbens.length > 0) { + this.getView().showTipNotification(ResManager.loadKDString("请在最新的版本上进行调整或编辑。", "AimcostcbsbillListPlugin_3", "ec-ecco-formplugin", new Object[0])); + } else { + HashedMap map = new HashedMap(); + map.put("formId", "ecco_aimcostbillcbs"); + map.put("projectId", aimcostcbsInfos[0].getDynamicObject("project").getPkValue()); + map.put("isadjust", true); + map.put("oldInfoid", aimcostcbsInfos[0].getPkValue()); + FormShowParameter showParameter = FormShowParameter.createFormShowParameter(map); + showParameter.setStatus(OperationStatus.ADDNEW); + showParameter.setCloseCallBack(new CloseCallBack(this, "refreshcallback")); + showParameter.getOpenStyle().setShowType(ShowType.MainNewTabPage); + this.getView().showForm(showParameter); + } + } + } + } + + public void closedCallBack(ClosedCallBackEvent closedCallBackEvent) { + super.closedCallBack(closedCallBackEvent); + if (StringUtils.equals(closedCallBackEvent.getActionId(), "refreshcallback")) { + this.getView().invokeOperation("refresh"); + } + + } +}