通过XML.query()查询元数据上注册的插件和插件所属元数据

栏目:云星空知识作者:金蝶来源:金蝶云社区发布:2024-09-16浏览:1

通过XML.query()查询元数据上注册的插件和插件所属元数据

# 需求 1.查询未知二开的插件属于哪个业务对象。 2.检测业务对象各个层级分别包含哪些插件?插件属于的类型是什么?插件是否启用? 3.除查询插件外还可以查询对象的开发方式(原厂 or 扩展[对应的开发商标识]); 如果是单据转换插件可以查询源单和目标单FORMID、启用状态、是否默认流程; 如果是执行计划插件可以查询下一次执行时间、启用状态、上一次执行日志。以上信息为本人认为的重要信息,如需其它信息可以在SQL中添加。 # 相关表 首先了解一点我们插件的配置信息都是存在数据库中的,大部分以XML的格式存储。 ## **`目前已梳理的插件`** - 业务插件: - T_META_OBJECTTYPE(主表) - T_META_OBJECTTYPE_L(多语言表) - 单据转换插件: - T_META_CONVERTRULE(主表) - T_META_CONVERTRULE_L(多语言表) - 执行计划插件: - T_BAS_SCHEDULETYPE(主表) - T_BAS_SCHEDULETYPE_L(多语言表) - T_BAS_SCHEDULEINFO(执行计划配置表) # 示例 ## **`业务插件`** `查询对象上有哪些插件` ```sql -- 查询对象上有哪些插件 SELECT AL.FNAME,A.FVERSION,A.FMAINVERSION,A.FID,A.FKERNELXML,A.FBASEOBJECTID,A.FDEVTYPE,A.FSUPPLIERNAME ,A.FKERNELXML.query('//ClassName') as 'ClassName' FROM T_META_OBJECTTYPE A LEFT JOIN T_META_OBJECTTYPE_L AL ON A.FID = AL.FID AND AL.FLOCALEID = '2052' WHERE AL.FNAME = '物料' ORDER BY AL.FNAME,A.FMODIFYDATE ``` 如果物料有多个扩展层会查询出多行结果,每个扩展层的插件可以在ClassName列中查看,如下XML为我本地扩展层中的插件信息: ```xml <ClassName>Study.yxf.BusinessPlugIn.ScheduleStudy, Study.yxf.BusinessPlugIn</ClassName> <ClassName>Kingdee.DY.BusinessPlugIn.MaUpdateBomCountList, Kingdee.DY.BusinessPlugIn</ClassName> <ClassName>Kingdee.DY.ServicePlugIn.UpdateModifyDateAfterOperation, Kingdee.DY.ServicePlugIn</ClassName> <ClassName>Kingdee.DY.ServicePlugIn.UpdateModifyDateAfterOperation, Kingdee.DY.ServicePlugIn</ClassName> <ClassName>Kingdee.DY.ServicePlugIn.UpdateModifyDateAfterOperation, Kingdee.DY.ServicePlugIn</ClassName> <ClassName>Kingdee.DY.ServicePlugIn.UpdateModifyDateAfterOperation, Kingdee.DY.ServicePlugIn</ClassName> <ClassName>Kingdee.DY.ServicePlugIn.MaToCrm, Kingdee.DY.ServicePlugIn</ClassName> <ClassName>Kingdee.DY.ServicePlugIn.FQ.MaToFQ, Kingdee.DY.ServicePlugIn</ClassName> ``` 我们可以看到这里面包含了此业务对象上所有的插件但没有区分插件类型,这时候会想如果能区分插件类型是不是更好些呢!我们可以通过观察标准XML中的结构来调整query()中的查询信息。通过观察大体上可以发现XML中的插件分为四类,比如FormPlugins为表单插件;同理还有列表插件、服务插件、报表插件、表单构建插件。我们可以调整SQL如下: ```sql -- 查询对象上有哪些插件(详细区分插件类型),无法查询单据转换插件、执行计划插件、自定义接口;动态表单插件属于表单插件 SELECT AL.FNAME,A.FVERSION,A.FMAINVERSION,A.FID,A.FKERNELXML,A.FBASEOBJECTID,A.FDEVTYPE,A.FSUPPLIERNAME ,A.FKERNELXML.query('//FormPlugins//ClassName') as 'FormPlugins' ,A.FKERNELXML.query('//ListPlugins//ClassName') as 'ListPlugins' ,A.FKERNELXML.query('//ServicePlugins//ClassName') as 'ServicePlugins' ,A.FKERNELXML.query('//SysReportServicePlugins//ClassName') as 'SysReportServicePlugins' ,A.FKERNELXML.query('//WebFormBuilderPlugins/PlugIn[ClassName]') as 'WebFormBuilderPlugins' FROM T_META_OBJECTTYPE A LEFT JOIN T_META_OBJECTTYPE_L AL ON A.FID = AL.FID AND AL.FLOCALEID = '2052' WHERE AL.FNAME = '物料' ORDER BY AL.FNAME,A.FMODIFYDATE ``` 如下图所示,这样就可以区分每个扩展层的插件类型了。 ![image.webp](/download/0100228b368460ee49e0a5529ce83615c94f.webp) `查询插件被哪些对象引用` ```sql SELECT AL.FNAME,A.FVERSION,A.FMAINVERSION,A.FID,A.FKERNELXML,A.FBASEOBJECTID,A.FDEVTYPE,A.FSUPPLIERNAME ,A.FKERNELXML.query('//ClassName') as 'ClassName' FROM T_META_OBJECTTYPE A LEFT JOIN T_META_OBJECTTYPE_L AL ON A.FID = AL.FID AND AL.FLOCALEID = '2052' WHERE CONVERT(varchar(max),A.FKERNELXML.query('//ClassName')) like '%RptOfBeShortofMa%' ``` 上述SQL可以根据类名进行模糊查询,查询插件绑定在哪些对象上;比如我查询了一个报表插件,查询结果如下: ![image.webp](/download/0100717d24513e4d472696a09389dbd45fa3.webp) ```xml <ClassName>Kingdee.DY.RptServicePlugIn.RptOfBeShortofMa, Kingdee.DY.RptServicePlugIn</ClassName> ``` `查询插件的启用状态` 以上query()仅能查询所有插件,但并不知道插件是否启用,我们可以再对query()进行一些调整,以`查询对象上有哪些插件`为示例,其余同理: ```sql --PlugIn[ClassName][IsEnabled="Fasle"] 表示取同时包含<ClassName>和<IsEnabled>且<IsEnabled>值为False的<PlugIn>标签 --PlugIn[ClassName]表示取到包含标签ClassName的标签PlugIn SELECT AL.FNAME,A.FVERSION,A.FMAINVERSION,A.FID,A.FKERNELXML,A.FBASEOBJECTID,A.FDEVTYPE,A.FSUPPLIERNAME ,A.FKERNELXML.query('//PlugIn[ClassName]') as 'ClassName' FROM T_META_OBJECTTYPE A LEFT JOIN T_META_OBJECTTYPE_L AL ON A.FID = AL.FID AND AL.FLOCALEID = '2052' WHERE AL.FNAME = '物料' ORDER BY AL.FNAME,A.FMODIFYDATE ``` 查询的插件XML信息如下: ```xml <PlugIn ElementType="0" ElementStyle="0"> <ClassName>Study.yxf.BusinessPlugIn.ScheduleStudy, Study.yxf.BusinessPlugIn</ClassName> <IsEnabled>False</IsEnabled> <OrderId>6</OrderId> </PlugIn> <PlugIn ElementType="0" ElementStyle="0"> <ClassName>Kingdee.DY.BusinessPlugIn.MaUpdateBomCountList, Kingdee.DY.BusinessPlugIn</ClassName> <IsEnabled>False</IsEnabled> <OrderId>5</OrderId> </PlugIn> <PlugIn ElementType="0" ElementStyle="0"> <ClassName>Kingdee.DY.ServicePlugIn.UpdateModifyDateAfterOperation, Kingdee.DY.ServicePlugIn</ClassName> <OrderId>4</OrderId> </PlugIn> <PlugIn ElementType="0" ElementStyle="0"> <ClassName>Kingdee.DY.ServicePlugIn.UpdateModifyDateAfterOperation, Kingdee.DY.ServicePlugIn</ClassName> <OrderId>1</OrderId> </PlugIn> <PlugIn ElementType="0" ElementStyle="0"> <ClassName>Kingdee.DY.ServicePlugIn.UpdateModifyDateAfterOperation, Kingdee.DY.ServicePlugIn</ClassName> <OrderId>4</OrderId> </PlugIn> <PlugIn ElementType="0" ElementStyle="0"> <ClassName>Kingdee.DY.ServicePlugIn.UpdateModifyDateAfterOperation, Kingdee.DY.ServicePlugIn</ClassName> <OrderId>3</OrderId> </PlugIn> <PlugIn ElementType="0" ElementStyle="0"> <ClassName>Kingdee.DY.ServicePlugIn.MaToCrm, Kingdee.DY.ServicePlugIn</ClassName> <OrderId>1</OrderId> </PlugIn> <PlugIn ElementType="0" ElementStyle="0"> <ClassName>Kingdee.DY.ServicePlugIn.FQ.MaToFQ, Kingdee.DY.ServicePlugIn</ClassName> <OrderId>1</OrderId> </PlugIn> ``` 通过和一开始`查询对象上有哪些插件`查询出来的插件信息对比发现这个取的数据更粗,里面包含了插件的绑定顺序,如果插件关闭的话会有标签IsEnabled:false。 ## **`单据转换插件`** `查询插件被哪些单据转换引用` ```sql -- T_META_CONVERTRULE 同理:单据转换插件在这个表可以找到 FSTATUS 1 为启用 0 为关闭 系统自带规则无法修改只能扩展后关闭 -- 查询插件被哪些单据转换引用 SELECT AL.FNAME,A.FVERSION,A.FMAINVERSION,A.FID,A.FKERNELXML,A.FBASEOBJECTID,A.FDEVTYPE,A.FSUPPLIERNAME,A.FSOURCEFORMID,A.FTARGETFORMID,A.FSTATUS,A.FISDEFAULT ,A.FKERNELXML.query('//ClassName') as 'ClassName' FROM T_META_CONVERTRULE A LEFT JOIN T_META_CONVERTRULE_L AL ON A.FID = AL.FID AND AL.FLOCALEID = '2052' WHERE CONVERT(varchar(max),A.FKERNELXML.query('//ClassName')) like '%SaleOrderToDeliverNotice%' ``` 查询结果如下: ![image.webp](/download/0100663ca9240d77407799ccdcfeddbab233.webp) 查询发现一共有两条单据转换引用了此插件。关于根据单据转换查询插件就不再废话了,可以参考业务插件中的查询方式基本一样。 此方法一般用于查询未知插件。 ## **`执行计划插件`** `查询插件被哪些执行计划引用` ```sql -- T_BAS_SCHEDULETYPE 执行计划表 FSTATUS 0 为启用 1 为停止 -- 查询插件被哪些执行计划引用 SELECT A.FSCHEDULETYPEID,A.FSCHEDULECLASS,AL.FNAME,AL.FDESCRIPTION,B.FEXECUTETIME,B.FSTATUS,B.FNOTES FROM T_BAS_SCHEDULETYPE A LEFT JOIN T_BAS_SCHEDULETYPE_L AL ON A.FSCHEDULETYPEID = AL.FSCHEDULETYPEID AND AL.FLOCALEID = '2052' LEFT JOIN T_BAS_SCHEDULEINFO B ON A.FSCHEDULETYPEID = B.FSCHEDULETYPEID WHERE A.FSCHEDULECLASS LIKE '%ScheduleStudy%' ``` 查询结果如下: ![image.webp](/download/0100363d0727c92a4626a8256cfe4b52750f.webp) 查询发现有一条执行计划引用了此插件。关于根据执行计划查询插件就没必要用sql查询了,可以用管理员权限账户搜索执行计划就可以看到相应插件,基本上都是一对一的关系。 此方法一般用于查询未知插件。 ## **`总结常用`** ```sql --根据插件名称查看它绑定的业务对象和该业务对象绑定的所有类型的插件信息 SELECT AL.FNAME,A.FVERSION,A.FMAINVERSION,A.FID,A.FKERNELXML,A.FBASEOBJECTID,A.FDEVTYPE,A.FSUPPLIERNAME ,A.FKERNELXML.query('//FormPlugins/PlugIn[ClassName]') as 'FormPlugins' ,A.FKERNELXML.query('//ListPlugins/PlugIn[ClassName]') as 'ListPlugins' ,A.FKERNELXML.query('//ServicePlugins/PlugIn[ClassName]') as 'ServicePlugins' ,A.FKERNELXML.query('//SysReportServicePlugins/PlugIn[ClassName]') as 'SysReportServicePlugins' ,A.FKERNELXML.query('//WebFormBuilderPlugins/PlugIn[ClassName]') as 'WebFormBuilderPlugins' FROM T_META_OBJECTTYPE A LEFT JOIN T_META_OBJECTTYPE_L AL ON A.FID = AL.FID AND AL.FLOCALEID = '2052' WHERE CONVERT(varchar(max),A.FKERNELXML.query('//ClassName')) like '%KONAMI.ygo.Business%' ORDER BY AL.FNAME,A.FMODIFYDATE --根据插件名称查询所属单据转换规则以及改规则绑定的所有插件信息 SELECT AL.FNAME,A.FVERSION,A.FMAINVERSION,A.FID,A.FKERNELXML,A.FBASEOBJECTID,A.FDEVTYPE,A.FSUPPLIERNAME,A.FSOURCEFORMID,A.FTARGETFORMID,A.FSTATUS,A.FISDEFAULT ,A.FKERNELXML.query('//PlugIn[ClassName]') as 'ClassName' FROM T_META_CONVERTRULE A LEFT JOIN T_META_CONVERTRULE_L AL ON A.FID = AL.FID AND AL.FLOCALEID = '2052' WHERE CONVERT(varchar(max),A.FKERNELXML.query('//ClassName')) like '%KONAMI.ygo.ConvertRule%' --根据插件名查询执行计划 SELECT A.FSCHEDULETYPEID,A.FSCHEDULECLASS,AL.FNAME,AL.FDESCRIPTION,B.FEXECUTETIME,B.FSTATUS,B.FNOTES FROM T_BAS_SCHEDULETYPE A LEFT JOIN T_BAS_SCHEDULETYPE_L AL ON A.FSCHEDULETYPEID = AL.FSCHEDULETYPEID AND AL.FLOCALEID = '2052' LEFT JOIN T_BAS_SCHEDULEINFO B ON A.FSCHEDULETYPEID = B.FSCHEDULETYPEID WHERE A.FSCHEDULECLASS LIKE '%KONAMI.ygo.Schedule%' ```
感谢,正有需要

我打开之前有个三幻神的图啊,怎么看不到了

通过XML.query()查询元数据上注册的插件和插件所属元数据

# 需求 1.查询未知二开的插件属于哪个业务对象。 2.检测业务对象各个层级分别包含哪些插件?插件属于的类型是什么?插件是否启用? 3.除查...
点击下载文档
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息