金蝶基础类KFO及其应用.ppt

上传人:本田雅阁 文档编号:2264751 上传时间:2019-03-13 格式:PPT 页数:35 大小:325.01KB
返回 下载 相关 举报
金蝶基础类KFO及其应用.ppt_第1页
第1页 / 共35页
金蝶基础类KFO及其应用.ppt_第2页
第2页 / 共35页
金蝶基础类KFO及其应用.ppt_第3页
第3页 / 共35页
亲,该文档总共35页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

《金蝶基础类KFO及其应用.ppt》由会员分享,可在线阅读,更多相关《金蝶基础类KFO及其应用.ppt(35页珍藏版)》请在三一文库上搜索。

1、KFO及其应用,应用集成部,KFO的对象模型 数据打包对象 注册表对象 全局对象 其他对象,提纲,KFO的对象模型 数据打包对象 注册表对象 全局对象 其他对象,提纲,KFO的对象模型,KFO的对象模型 数据打包对象 注册表对象 全局对象 其他对象,提纲,数据打包对象,Dictionary对象 DictWord对象 Vector对象 LinkedList对象 Node对象 IDMap对象 MapWord对象 ISortHelper接口,Dictionary对象特点,Dictionary对象是一个数据字典 字典里可以存放不同的变量,它可以是任一个单值变量,也可以是一个对象。 在Dictionar

2、y对象中主要通过变量名称来进行索引的。 Dictionary对象可以进行跨进程调度,跨进程调度可以采用值拷贝调度和引用调度 Dictionary对象支持系列化和持久化,Dictionary对象的属性,属性 Property Value(Name As String) Property Name(Index As Long) As String Property Count As Long Property Modified As Boolean Property MarshalOptions As MarshalOptionsEnum Property Repeated As Boolean

3、ByRefMarshal,Dictionary对象的方法,方法 Function Clone() As Dictionary Function GetValue(Name As String, Default) As Variant Function Lookup(Name As String, Value) As Boolean Sub Remove(Name As String) Sub RemoveAll() Sub ResetModified() Sub Append(pDict As Dictionary,ByVal bCloneObject As Boolean) Sub Init

4、MaxCount(nMaxCount As Long) Function CloneAll() As Dictionary Function Load(Source) As Boolean Function Save(Dest) As Boolean,Vector对象的特点,Vector对象相当于一个不定长的向量数组 每一个元素可以是任一个单值变量,也可以是一个对象 在Vector对象中主要通过索引来进行数据访问的 Vector对象可以进行跨进程调度,跨进程调度可以采用值拷贝调度和引用调度 Vector对象支持系列化和持久化,Vector对象的属性,属性 Property Item(Index

5、 As Long) As Variant Property Size As Long Property Array As Variant Property LBound As Long Property UBound As Long Property GrowBy As Long Property ByRefMarshal As Boolean,Vector对象的方法,方法 Function Add(Item) As Long Sub Insert(Index As Long, Item) Sub Append(NewVector As Vector) Sub Remove(Index As

6、Long, nCount As Long = 1) Sub RemoveAll() Function Clone() As Vector Sub FreeExtra() Function BSearch(ItemToSearch, Index As Long, SortHelper As ISortHelper) As Boolean Function Search(ItemToSearch, Index As Long, SortHelper As ISortHelper) As Boolean Sub Sort(First, Last, SortHelper As ISortHelper)

7、 Function CloneAll() As Vector Function Load(Source) As Boolean Function Save(Dest) As Boolean,LinkedList对象的特点,LinkedList对象相当于一个单线链表 每一个节点可以是任一个单值变量,也可以是一个对象 在LinkedList对象中主要通过索引或节点前后关系来进行数据访问的 LinkedList对象可以进行跨进程调度,跨进程调度可以采用值拷贝调度和引用调度 LinkedList对象支持系列化和持久化,LinkedList对象的属性,属性 Property Item(Index As

8、Long) As Node Property Count As Long Property Head As Node Property Tail As Node Property ByRefMarshal As Boolean,LinkedList对象的方法,方法 Function AddHead(Value) As Node Function AddTail(Value) As Node Sub AppendHead(List As LinkedList) Sub AppendTail(List As LinkedList) Function RemoveHead() As Variant

9、Function RemoveTail () As Variant Sub RemoveAll() Function Clone() As LinkedList Function Search(ItemToSearch, SortHelper As ISortHelper) As Node Function CloneAll() As LinkedList Function Load(Source) As Boolean Function Save(Dest) As Boolean,Node对象的属性和方法,属性 Property Container As LinkedList Propert

10、y Previous As Node Property Next As Node Property Value As Variant 方法 Function InsertBefore(Value) As Node Function InsertAfter(Value) As Node Sub Remove(),IDMap对象的特点,IDMap对象是一个数据字典 字典里可以存放不同的变量,它可以是任一个单值变量,也可以是一个对象 在IDMap对象中主要通过一个整数值来进行数据访问的 IDMap对象可以进行跨进程调度,跨进程调度可以采用值拷贝调度和引用调度 IDMap对象支持系列化和持久化 与Di

11、ctionary对象的区别就在于Dictionary用名称访问变量,而IDMap实用一个整数值访问元素变量的,IDMap对象的属性和方法,属性 Property Value(ID As Long) As Variant Property IDs(Index As Long) As Long Property Count As Long ByRefMarshal 方法 Function Clone() As IDMap Function GetValue(ID As Long, Default) As Variant Function Lookup(ID As Long, Value) As B

12、oolean Sub Remove(ID As Long) Sub RemoveAll() Function CloneAll() As IDMap Function Load(Source) As Boolean Function Save(Dest) As Boolean,ISortHelper接口,ISortHelper接口是一个辅助的接口,需要开发人员自己实现 ISortHelper接口对象应用于Vector对象的Sort、BSearch、Search以及LinkedList对象的Search方法 对于Vector对象的Sort、BSearch、Search以及LinkedList对象

13、的Search方法,如果调用过程中没有制定具体的ISortHelper实现,则采用系统默认的单值比较大小关系,但是我们建议采用自己实现的ISortHelper,实现自己真正意义上的大小比较 仅有一个方法需要实现: Function Compare(Item1, Item2) As Long 当Item1 “大于” Item2时返回大于0的数,如1 当Item1 “等于” Item2时返回等于0的数,如0 当Item1 “小于” Item2时返回小于0的数,如-1 示例一,Dictionary对象打包数据的性能问题,以前的性能问题:Dictionary对象在打包数据在20000个以内时,人的感觉

14、是能够接受的,但超过20000个时,明显的感觉很慢,数据越大,所需要的时间,特别是在记录集转化成指数函数的方式迅速递增为KFO的Dictionary对象时 解决的办法:应用InitMaxCount方法和Repeated属性 InitMaxCount方法:如果需要打包的数据个数超过20000个,最好先调用InitMaxCount方法,预先一次性分配内存,以提高内存分配的速度。在结合应用Repeated属性,大包的数据速度成几十上百乃上千的倍数提高具体倍数与打包的数据量有关,数据量越大,倍数越大。 Repeated属性:指明关键字是否允许重复,True表示允许重复,False表示不允许,默认值为F

15、alse。如果将Repeated设置为True,调用者需自己处理关键字不重复的问题 示例二,进程间调度问题,属性ByRefMarshal :在当前进程内是否允许该对象采用引用调度方式到其他进程,True表示允许,调度到另外进程后不会生成原对象的副本,False表示不允许,调度到另外进程后会生成原对象的副本。默认值为False。 采用引用调度的场景: 对于进程内的调用,无论ByRefMarshal 为True或是False,此属性值被忽略,不做任何处理。 在进行跨进程调度的过程中如果对调度后的对象进行修改并希望反映到原对象时,才有将原对象的属性ByRefMarshal设置为True,否则应该尽量

16、设置为False,以减少调度的频次和数据流量。 常用于插件调试过程中 示例三,系列化处理,以前在用金蝶核心对象KFO进行编程过程中,碰到以下两个现象: 当用KFO.Vector、KFO.Dictionary及KFO.LinkedList对象进行数据打包时,在VB及.NET中的变量查看中均无法看到内部的数据及其结构,只能看到最上一级的对象所包含的元素个数,给调试带来不方便性 在用MSMQ消息对象MSMQMessage、VB的PropertyBag对象时,直接使用KFO.Vector、KFO.Dictionary及KFO.LinkedList对象进行处理时提示错误 主要是因为原有KFO的Vecto

17、r、Dictionary、LinkedList以及IDMap对象没有支持系列化。从K/3 V10.2已经支持 示例四,克隆复制,Clone与CloneAll Clone方法,只对本身一级内数据进行复制,对Vector、Dictionary、LinkedList以及IDMap对象以及其他的可系列化对象的多层次嵌套时,只对Vector、Dictionary、LinkedList以及IDMap对象以及其他的可系列化对象进行简单引用,不是完全意义上的数据复制克隆。 完全意义上的克隆复制,包含内嵌的其他可系列化队象,形成一个全新真正副本。但如果包含的对象不是一个持久化的对象,还是保留其原有的引用关系。

18、示例五,持久化处理,支持持久化有两个方法: Function Save(Dest) As Boolean 将对象数据存储到目标中 Dest为一字串时,Save方法会自动检查该字串是否为路径文件,若是路径文件,则保存为文件,否则将对象保存为一字串形式;若为VARIANT变体应该代表的是字节数组,文件、字符串、对象流(Stream),否则默认保存为字节数组 Save 从源对象装载数据 Dest为一字串时,Load方法会自动检查该字串为文件路径,若是文件路径,则从文件中装载数据,否则从字串中装载数据;若为VARIANT变体应该代表的是字节数组、文件、字符串、对象流(Stream),且为通过对用的Sa

19、ve方法生成的数据,否则会报错“无效的过程对象或参数” 示例六,KFO的对象模型 数据打包对象 注册表对象 全局对象 其他对象,提纲,Reg对象特点,封装在KFO中的Reg对象是的操作对象是Windows系统的注册表 通过它来操纵我们K/3系统的一些系统内部的注册表内容 可以对通用Windows注册表的项、值进行增加、删除、修改、查找等操作,Reg对象的属性和方法(一),属性 Property CompanyName As String 方法 Sub AddKey(KeyName As String) Function GetKeyValue(Key As String, Entry As S

20、tring, Default) As Variant Sub SetKeyValue(Key As String, Entry As String, Value) Sub DeleteKey(KeyName As String) Sub DeleteKeyValue(Key As String, Entry As String) Function KeyExists(KeyName As String) As Boolean,Reg对象的属性和方法(二),方法 Function GetSystemSetting(AppName As String, Section As String, Ent

21、ry As String, Default) As Variant Sub SetSystemSetting(AppName As String, Section As String, Entry As String, Value) Sub DeleteSystemSetting(AppName As String, Section, Entry) Function GetUserSetting(AppName As String, Section As String, Entry As String, Default) As Variant Sub SetUserSetting(AppNam

22、e As String, Section As String, Entry As String, Value) Sub DeleteUserSetting(AppName As String, Section, Entry),KFO的对象模型 数据打包对象 注册表对象 全局对象 其他对象,提纲,Globals全局对象(一),该对象主要提供VB未能提供的一些公用函数 该对象属于全局对象,只要VB引用KFO,直接可用该对象的函数,不许创建此对象 属性 Property Reg As Reg,Globals全局对象(二),方法 Function AscAt(String As String, Ind

23、ex As Long) As Integer Function CNulls(Value, Default) As Variant Function AscAtA(String As String, Index As Long) As Integer Function LeftA(String As String, Length As Long) As String Function LenA(String As String) As Long Function MidA(String As String, Start As Long, Length) As String Function R

24、ightA(String As String, Length As Long) As String Function CreateEnumerator(WalkVariant As IWalkVariant) As Unknown Function GetViperSecurity() As ViperSecurity Function OpenClientToken() As AccessToken Function OpenProcessToken() As AccessToken Function OpenThreadToken() As AccessToken,KFO的对象模型 数据打

25、包对象 注册表对象 全局对象 其他对象,提纲,BitSet对象,BitSet对象描述的对数据进行位操作的数据对象 Array属性,可以把二进制数组转换为BitSet对象或者把BitSet对象转换成二进制数组。 Bit属性,可以取出BitSet对象中的具体的某一位的Byte值,用Boolean变量来表示。 Intersect方法,作两个BitSet对象的求交集的操作。 Invert方法,可以对BitSet对象中的某一段数据进行求反操作。 Union方法,作两个BitSet对象的求并集的操作。 Xor方法,作两个BitSet对象的求异或的操作。,Windows域用户权限管理,AccessControlEntry、AccessControlList、AccessToken三个对象是将Windows的域用户权限管理作了一个映像。示例: Dim oAccessEntry As New AccessControlEntry oAccessEntry. SecurityIdentifier. Name=”域名用户名(用户组名)” 通过以上的方法可以取得指定Windows域中的相应的域用户信息。通过AccessControlList、AccessToken两个对象可以直接的对域用户信息进行相应的操作。如:Allow方法,用户授权;Deny方法,用户操作禁止等。,谢 谢!,

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 其他


经营许可证编号:宁ICP备18001539号-1