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

This commit is contained in:
龚豆豆 2025-08-19 14:42:58 +08:00
parent ec5c03c0f0
commit f580b77f21
3 changed files with 76 additions and 44 deletions

View File

@ -1,8 +1,13 @@
package tqq9.lc123.cloud.app.plugin.form.conm;
import com.alibaba.fastjson.JSONObject;
import kd.bos.bill.AbstractBillPlugIn;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.dataentity.utils.StringUtils;
import kd.bos.entity.param.CustomParam;
import kd.bos.form.FormShowParameter;
import kd.bos.form.control.events.ItemClickEvent;
import kd.bos.logging.Log;
import kd.bos.logging.LogFactory;
import kd.bos.orm.query.QCP;
@ -11,6 +16,8 @@ import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.sdk.plugin.Plugin;
import java.util.EventObject;
import java.util.HashMap;
import java.util.Map;
/**
* 返利规则表单插件
@ -19,17 +26,46 @@ import java.util.EventObject;
public class RebateRulesBillPlugin extends AbstractBillPlugIn implements Plugin {
private final static Log logger = LogFactory.getLog(RebateRulesBillPlugin.class);
@Override
public void registerListener(EventObject e) {
super.registerListener(e);
this.addItemClickListeners("tbmain");
}
@Override
public void afterCreateNewData(EventObject e) {
// 获取当前页面的FormShowParameter对象
FormShowParameter formShowParameter = this.getView().getFormShowParameter();
// 获取自定义参数
String billno = (String)formShowParameter.getCustomParam("purcontract_billno");
JSONObject purcontract_supplier = formShowParameter.getCustomParam("purcontract_supplier");
String number = purcontract_supplier.get("number").toString();
DynamicObject supplier = BusinessDataServiceHelper.loadSingle("bd_supplier", new QFilter[]{new QFilter("number", QCP.equals, number)});
// 把参数值赋值到页面文本字段上
DynamicObject purcontract = BusinessDataServiceHelper.loadSingle("conm_purcontract", new QFilter[]{new QFilter("billno", QCP.equals, billno)});
DynamicObjectCollection tqq9_supplier = this.getModel().getDataEntity().getDynamicObjectCollection("tqq9_supplier");
DynamicObject newsupplier = new DynamicObject(tqq9_supplier.getDynamicObjectType());
if(supplier!=null){
newsupplier.set("fbasedataId", supplier);
tqq9_supplier.add(newsupplier);
this.getModel().setValue("tqq9_supplier", tqq9_supplier);
}
this.getModel().setValue("tqq9_conm_purcontract", purcontract);
// getView().updateView();
}
@Override
public void itemClick(ItemClickEvent evt) {
super.itemClick(evt);
String itemKey = evt.getItemKey();
if (StringUtils.equals("tqq9_confirm",itemKey)) {
DynamicObject dataEntity = this.getModel().getDataEntity(true);
HashMap<String,DynamicObject> map =new HashMap<>();
map.put("tqq9_pur_rebate",dataEntity);
this.getView().returnDataToParent(map);
this.getView().close();
}
}
}

View File

@ -25,6 +25,7 @@ import kd.sdk.plugin.Plugin;
import java.math.BigDecimal;
import java.util.Date;
import java.util.EventObject;
import java.util.HashMap;
import java.util.Map;
/**
@ -51,6 +52,7 @@ public class purconmAddRebateRulesPlugin extends AbstractFormPlugin implements P
BillShowParameter param = new BillShowParameter();
param.setFormId("tqq9_pur_rebate");
param.setCustomParam("purcontract_billno", this.getModel().getValue("billno"));
param.setCustomParam("purcontract_supplier", this.getModel().getValue("supplier"));
param.setCloseCallBack(new CloseCallBack(this, "rebateSync"));
param.getOpenStyle().setShowType(ShowType.Modal);
this.getView().showForm(param);
@ -58,6 +60,7 @@ public class purconmAddRebateRulesPlugin extends AbstractFormPlugin implements P
BillShowParameter param = new BillShowParameter();
param.setFormId("tqq9_pur_rebate");
param.setCustomParam("purcontract_billno", this.getModel().getValue("billno"));
param.setCustomParam("purcontract_supplier", (DynamicObject)this.getModel().getValue("supplier"));
param.setCloseCallBack(new CloseCallBack(this, "entry_rebateSync"));
param.getOpenStyle().setShowType(ShowType.Modal);
this.getView().showForm(param);
@ -81,8 +84,7 @@ public class purconmAddRebateRulesPlugin extends AbstractFormPlugin implements P
if ("entry_rebateSync".equals(actionId)) {
DynamicObjectCollection tqq9_entryentity = this.getModel().getDataEntity(true).getDynamicObjectCollection("tqq9_entryentity");
int size = tqq9_entryentity.size();
ListSelectedRow listSelectedRow = ((ListSelectedRowCollection) returnData).get(0);
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(listSelectedRow.toString(), "cas_paybill");
DynamicObject dynamicObject = (DynamicObject) ((HashMap) returnData).get("tqq9_pur_rebate");
String name = dynamicObject.getString("name");//规则名称
DynamicObjectCollection tqq9_rebatebrand = dynamicObject.getDynamicObjectCollection("tqq9_rebatebrand");//品牌
DynamicObjectCollection tqq9_supplier = dynamicObject.getDynamicObjectCollection("tqq9_supplier");//供应商
@ -102,6 +104,8 @@ public class purconmAddRebateRulesPlugin extends AbstractFormPlugin implements P
Boolean tqq9_beijinglichi = dynamicObject.getBoolean("tqq9_beijinglichi");
if (tqq9_beijinglichi) {
stringBuilder.append(",").append("北京励齿");
}
Boolean tqq9_guangzhoulici = dynamicObject.getBoolean("tqq9_guangzhoulici");
if (tqq9_guangzhoulici) {
stringBuilder.append(",").append("广州励齿");
@ -122,21 +126,20 @@ public class purconmAddRebateRulesPlugin extends AbstractFormPlugin implements P
}
model.setValue("tqq9_rulename", name,size-1);//规则名称
model.setValue("tqq9_company", stringBuilder,size-1);//主体
model.setValue("tqq9_brand", tqq9_rebatebrand,size-1);//品牌
model.setValue("tqq9_supplier", tqq9_supplier,size-1);//供应商
model.setValue("tqq9_startdate", tqq9_startdate,size-1);//返利开始时间
model.setValue("tqq9_enddate", tqq9_enddate,size-1);//返利结束时间
model.setValue("tqq9_status", tqq9_status,size-1);//返利状态
model.setValue("creator", creator,size-1);//创建人
model.setValue("createtime", createtime,size-1);//创建时间
model.setValue("tqq9_lastdate", tqq9_lastdate,size-1);//最后一次执行时间
model.setValue("tqq9_rulename", name, size - 1);//规则名称
model.setValue("tqq9_company", stringBuilder.substring(1), size - 1);//主体
model.setValue("tqq9_brand", tqq9_rebatebrand, size - 1);//品牌
model.setValue("tqq9_supplier", tqq9_supplier, size - 1);//供应商
model.setValue("tqq9_startdate", tqq9_startdate, size - 1);//返利开始时间
model.setValue("tqq9_enddate", tqq9_enddate, size - 1);//返利结束时间
model.setValue("tqq9_status", tqq9_status, size - 1);//返利状态
model.setValue("tqq9_creatuser", creator, size - 1);//创建人
model.setValue("tqq9_creatdate", createtime, size - 1);//创建时间
model.setValue("tqq9_lastdate", tqq9_lastdate, size - 1);//最后一次执行时间
}
}
this.getView().updateView();
}
}
}

View File

@ -71,6 +71,7 @@ public class PurInlotReceiptPlugin extends AbstractOperationServicePlugIn implem
}
}
} else if (StringUtils.equals("unaudit", operationKey)) {
logger.info("进入反审核方法");
for (DynamicObject dataEntity : e.getDataEntities()) {
ArrayList<String> billnos = new ArrayList<>();
String billno1 = dataEntity.getString("billno");
@ -98,18 +99,10 @@ public class PurInlotReceiptPlugin extends AbstractOperationServicePlugIn implem
bd_lot = BusinessDataServiceHelper.loadSingle("bd_lot", new QFilter[]{new QFilter("id", QCP.equals, bd_lot.getLong("id"))});
String lotstatus = bd_lot.getString("lotstatus");
if (lotstatus.equals("B")) {
logger.info("删除成功");
iterator.remove();
}
}
// for (DynamicObject lot : tqq9_bd_lot) {
// DynamicObject bd_lot = lot.getDynamicObject("fbasedataId");
// bd_lot = BusinessDataServiceHelper.loadSingle("bd_lot", new QFilter[]{new QFilter("id", QCP.equals, bd_lot.getLong("id"))});
// String lotstatus = bd_lot.getString("lotstatus");
// if (lotstatus.equals("B")) {
// tqq9_bd_lot.remove(bd_lot);
// }
// }
}
}
SaveServiceHelper.save(pm_purorderbills);