1.返利规则增行弹窗调整

This commit is contained in:
龚豆豆 2025-08-20 15:53:57 +08:00
parent 9ee3230dbd
commit e09421edd3
2 changed files with 75 additions and 20 deletions

View File

@ -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);
}
}
}

View File

@ -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);
}