记录常用的一些小方法原创
金蝶云社区-武器大师金克斯
武器大师金克斯
2人赞赏了该文章 56次浏览 未经作者许可,禁止转载编辑于2024年09月20日 15:26:53

1、获取单据标识

//单据列表
ListShowParameter param = (ListShowParameter) this.getView().getFormShowParameter();
 param.getBillFormId(); 

//单据的PC布局列表页面,如何获取到源页面的标识 :
BillList billList=this.getControl("billlistap"); 
String name=billList.getEntityType().getName();

//获取当前单据标识
getModel().getDataEntityType().getName();

2、获取APPID

String appId = getView().getFormShowParameter().getAppId();

获取指定应用的appid
 AppInfo appInfo = AppMetadataCache.getAppInfo("hsas");
 String appId = getView().getFormShowParameter().getAppId();

3、获取某个实体对应的数据库表的ID

Long id = DBServiceHelper.genLongIds("表名", 1)[0];

4、获取字段名称

BasedataEdit control = this.getControl(name);
LocaleString displayName = control.getProperty().getDisplayName();

5、创建平铺对象

DynamicObject dynamicObject = BusinessDataServiceHelper.newDynamicObject("单据标识");

6、获取单据所有字段的标识

DynamicTransformUtil.getDynamicPropString("单据标识")

7、获取单据列表选中的行

BillList billList =  this.getControl("billlistap");
// 获取单据列表选中行集合
ListSelectedRowCollection selectedRows = billList.getSelectedRows();

8、通过上下文获取当前用户、当前登录组织

long currUserId = RequestContext.get().getCurrUserId();
long orgId = RequestContext.get().getOrgId();
赞 2