单据类型初始化通用插件
This commit is contained in:
parent
b3f3ffd6f3
commit
a64fa20e49
|
@ -0,0 +1,56 @@
|
||||||
|
package shkd.fi.er.plugin.formplugin;
|
||||||
|
|
||||||
|
import kd.bos.bill.AbstractBillPlugIn;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.form.FormShowParameter;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.sdk.plugin.Plugin;
|
||||||
|
|
||||||
|
import java.util.EventObject;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表单插件公共方法<br>
|
||||||
|
* 1.获取菜单参数配置的单据类型编码,菜单参数:<br>
|
||||||
|
* key=billType,value=单据类型编码 <br>
|
||||||
|
* key=filedMark,value=单据类型字段标识 <br>
|
||||||
|
* 2.将单据类型编码转换为编辑界面单据类型字段的值
|
||||||
|
*/
|
||||||
|
public class CommonFormPlugin extends AbstractBillPlugIn implements Plugin {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化时,从获取参数类型,设置单据类型值
|
||||||
|
* @param e
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void afterCreateNewData(EventObject e) {
|
||||||
|
super.afterCreateNewData(e);
|
||||||
|
FormShowParameter formShowParameter = this.getView().getFormShowParameter();
|
||||||
|
if(null!=formShowParameter){
|
||||||
|
Map<String, Object> customParams = formShowParameter.getCustomParams();
|
||||||
|
if(null!=customParams){
|
||||||
|
//获取列表界面配置的参数:billType=单据类型编码
|
||||||
|
Object billType = customParams.get("billType");
|
||||||
|
//获取列表界面配置的参数:filedMark=单据类型字段标识
|
||||||
|
Object filedMark = customParams.get("filedMark");
|
||||||
|
if(null!=billType&&null!=filedMark){
|
||||||
|
DynamicObject billTypeObj = (DynamicObject)this.getModel().getValue(filedMark.toString());
|
||||||
|
if(null==billTypeObj){
|
||||||
|
//单据类型为空,赋值
|
||||||
|
QFilter q1 = new QFilter("number", "=", billType.toString());
|
||||||
|
DynamicObject billTypeObject = BusinessDataServiceHelper.loadSingle("bos_billtype", new QFilter[]{q1});
|
||||||
|
this.getModel().setValue(filedMark.toString(), billTypeObject);
|
||||||
|
}else if(!billTypeObj.getString("number").equals(billType.toString())){
|
||||||
|
//单据类型和列表菜单参数一致,不再赋值
|
||||||
|
QFilter q1 = new QFilter("number", "=", billType.toString());
|
||||||
|
DynamicObject billTypeObject = BusinessDataServiceHelper.loadSingle("bos_billtype", new QFilter[]{q1});
|
||||||
|
this.getModel().setValue(filedMark.toString(), billTypeObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue