From e09421edd324d44dfe8225128a36458a04b089dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BE=9A=E8=B1=86=E8=B1=86?= <13356128+sunandmoon60@user.noreply.gitee.com> Date: Wed, 20 Aug 2025 15:53:57 +0800 Subject: [PATCH] =?UTF-8?q?1.=E8=BF=94=E5=88=A9=E8=A7=84=E5=88=99=E5=A2=9E?= =?UTF-8?q?=E8=A1=8C=E5=BC=B9=E7=AA=97=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/ap/ApHandSettleFormPlugin.java | 58 +++++++++++++++++-- .../form/conm/RebateRulesBillPlugin.java | 37 +++++++----- 2 files changed, 75 insertions(+), 20 deletions(-) diff --git a/lc123/cloud/app/plugin/form/ap/ApHandSettleFormPlugin.java b/lc123/cloud/app/plugin/form/ap/ApHandSettleFormPlugin.java index 6cd9504..d0a783c 100644 --- a/lc123/cloud/app/plugin/form/ap/ApHandSettleFormPlugin.java +++ b/lc123/cloud/app/plugin/form/ap/ApHandSettleFormPlugin.java @@ -1,27 +1,48 @@ package tqq9.lc123.cloud.app.plugin.form.ap; import com.alibaba.fastjson.JSONObject; -import kd.bos.bill.AbstractBillPlugIn; -import kd.bos.card.adapter.Button; import kd.bos.dataentity.entity.DynamicObject; -import kd.bos.dataentity.entity.DynamicObjectCollection; import kd.bos.form.FormShowParameter; +import kd.bos.form.control.Button; +import kd.bos.form.control.Control; +import kd.bos.form.events.PreOpenFormEventArgs; +import kd.bos.form.events.TimerElapsedArgs; import kd.bos.form.plugin.AbstractFormPlugin; import kd.bos.logging.Log; import kd.bos.logging.LogFactory; import kd.bos.orm.query.QCP; import kd.bos.orm.query.QFilter; +import kd.bos.report.filter.ReportFilter; import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.sdk.plugin.Plugin; import java.util.EventObject; + /** * 动态表单插件 */ -public class ApHandSettleFormPlugin extends AbstractBillPlugIn implements Plugin { +public class ApHandSettleFormPlugin extends AbstractFormPlugin implements Plugin { private final static Log logger = LogFactory.getLog(ApHandSettleFormPlugin.class); + @Override + public void registerListener(EventObject e) { + super.registerListener(e); + Button button = this.getView().getControl("btnquery"); + button.addClickListener(this); + + } + + @Override + public void preOpenForm(PreOpenFormEventArgs e) { + super.preOpenForm(e); + // 要求触发TimerElapsed事件 + ((FormShowParameter)e.getSource()).setListentimerElapsed(true); + } + + + + @Override public void afterCreateNewData(EventObject e) { // 获取当前页面的FormShowParameter对象 @@ -31,7 +52,7 @@ public class ApHandSettleFormPlugin extends AbstractBillPlugIn implements Plugin JSONObject settleorg = formShowParameter.getCustomParam("settleorg"); DynamicObject supplier = null; DynamicObject bos_org = null; - if (e_asstact != null&&settleorg!=null) { + if (e_asstact != null && settleorg != null) { String number = e_asstact.get("number").toString(); String number1 = settleorg.get("number").toString(); supplier = BusinessDataServiceHelper.loadSingle("bd_supplier", new QFilter[]{new QFilter("number", QCP.equals, number)}); @@ -41,6 +62,33 @@ public class ApHandSettleFormPlugin extends AbstractBillPlugIn implements Plugin this.getModel().setValue("settlerelation", "apself"); this.getModel().setValue("pagedisplay", "entry"); + } } + + @Override + public void afterBindData(EventObject e) { + super.afterBindData(e); + Button button = (Button)this.getControl("btnquery"); + button.addClickListener(this); + button.click(); + } + + + + @Override + public void click(EventObject evt) { + super.click(evt); + Control control = (Control) evt.getSource(); + String key = control.getKey(); + if (key.equalsIgnoreCase("btnquery")) { + this.getView().showMessage("点击了查询按钮"); +// this.getView().setVisible(true,"settleitempanel"); +// this.getView().setVisible(true,"adv_mainbill"); +// this.getView().setVisible(true,"adv_asstbill"); +// ReportFilter querypanel = this.getView().getControl("querypanel"); +// querypanel.setCollapse(true); + } + } + } \ No newline at end of file diff --git a/lc123/cloud/app/plugin/form/conm/RebateRulesBillPlugin.java b/lc123/cloud/app/plugin/form/conm/RebateRulesBillPlugin.java index a84f16d..18a8b3d 100644 --- a/lc123/cloud/app/plugin/form/conm/RebateRulesBillPlugin.java +++ b/lc123/cloud/app/plugin/form/conm/RebateRulesBillPlugin.java @@ -1,5 +1,6 @@ package tqq9.lc123.cloud.app.plugin.form.conm; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import kd.bos.bill.AbstractBillPlugIn; import kd.bos.dataentity.entity.DynamicObject; @@ -37,37 +38,43 @@ public class RebateRulesBillPlugin extends AbstractBillPlugIn implements Plugin // 获取当前页面的FormShowParameter对象 FormShowParameter formShowParameter = this.getView().getFormShowParameter(); // 获取自定义参数 - String billno = (String) formShowParameter.getCustomParam("purcontract_billno"); + String billno =formShowParameter.getCustomParam("purcontract_billno"); JSONObject purcontract_supplier = formShowParameter.getCustomParam("purcontract_supplier"); - JSONObject purcontract_tqq9_dxpp = formShowParameter.getCustomParam("purcontract_tqq9_dxpp"); + JSONArray purcontract_tqq9_dxpp = formShowParameter.getCustomParam("purcontract_tqq9_dxpp"); DynamicObject supplier = null; - DynamicObject tqq9_dxpp = null; +// DynamicObject tqq9_dxpp = null; + DynamicObject purcontract = BusinessDataServiceHelper.loadSingle("conm_purcontract", new QFilter[]{new QFilter("billno", QCP.equals, billno)}); + DynamicObjectCollection tqq9_supplier = this.getModel().getDataEntity().getDynamicObjectCollection("tqq9_supplier"); + DynamicObjectCollection tqq9_rebatebrand = this.getModel().getDataEntity().getDynamicObjectCollection("tqq9_rebatebrand"); + DynamicObject newsupplier = new DynamicObject(tqq9_supplier.getDynamicObjectType()); if (purcontract_supplier != null) { String number = purcontract_supplier.get("number").toString(); supplier = BusinessDataServiceHelper.loadSingle("bd_supplier", new QFilter[]{new QFilter("number", QCP.equals, number)}); } if (purcontract_tqq9_dxpp != null) { - String number = purcontract_tqq9_dxpp.get("number").toString(); - tqq9_dxpp = BusinessDataServiceHelper.loadSingle("tqq9_brand", new QFilter[]{new QFilter("number", QCP.equals, number)}); + for (int i = 0; i < purcontract_tqq9_dxpp.size(); i++) { + JSONObject jsonObject = (JSONObject)purcontract_tqq9_dxpp.get(i); + JSONObject fbasedataid = jsonObject.getJSONObject("fbasedataid"); + String number = fbasedataid.getString("number"); + DynamicObject tqq9_dxpp = BusinessDataServiceHelper.loadSingle("tqq9_brand", new QFilter[]{new QFilter("number", QCP.equals, number)}); + if (tqq9_dxpp != null) { + DynamicObject newbrand = new DynamicObject(tqq9_rebatebrand.getDynamicObjectType()); + newbrand.set("fbasedataId", tqq9_dxpp); + tqq9_rebatebrand.add(newbrand); + } + + } + } // 把参数值赋值到页面文本字段上 - DynamicObject purcontract = BusinessDataServiceHelper.loadSingle("conm_purcontract", new QFilter[]{new QFilter("billno", QCP.equals, billno)}); - DynamicObjectCollection tqq9_supplier = this.getModel().getDataEntity().getDynamicObjectCollection("tqq9_supplier"); - DynamicObjectCollection tqq9_rebatebrand = this.getModel().getDataEntity().getDynamicObjectCollection("tqq9_rebatebrand"); - DynamicObject newsupplier = new DynamicObject(tqq9_supplier.getDynamicObjectType()); - DynamicObject newbrand = new DynamicObject(tqq9_rebatebrand.getDynamicObjectType()); if (supplier != null) { newsupplier.set("fbasedataId", supplier); tqq9_supplier.add(newsupplier); this.getModel().setValue("tqq9_supplier", tqq9_supplier); } - if (tqq9_dxpp != null) { - newbrand.set("fbasedataId", tqq9_dxpp); - tqq9_rebatebrand.add(newbrand); - this.getModel().setValue("tqq9_rebatebrand", tqq9_rebatebrand); - } this.getModel().setValue("tqq9_conm_purcontract", purcontract); + this.getModel().setValue("tqq9_rebatebrand", tqq9_rebatebrand); }