• M代码管理篇


    之前好几年大家M开发都是在一个中心库上改代码。都以一个中心库的M代码为开发标准。由于大家不在一起或者有时候连不上中心库,所以也有本地库开发的。这就带来一个问题,有些人本地库代码很老,或者不是最新的M。那么在本地改代码后如果不比对中心库添加而直接导入M的话,就会把别人的改动盖了。还查不到谁盖的,盖之前代码是什么样的。就算大家在一起开发的话也存在代码历史追溯问题。

    所以那段时间很头大。一个打印M增加的功能,隔段时间又变成一个老的了。有些本地不时常更新代码的人,领导安排个活之后让他提交能给你盖成几年之前的M。很久之后用到了才发现,然后又是找近一点的代码盖回去。来来回回,反反复复的后台进步很慢。所以需要管理起来M。最好是借助代码管理工具SVN,Git之类的。

    要管理M那么问题就是有没有什么代码能自动导出导入M呢?如果能代码自动导入导出就可以开发业务功能把M代码管理起来了。

    然后就搞了个这么个东东,更新SVN的M文件目录然后全部导入本地或者导入最近改的200,程序会存一个globle记录最后导入时间,导出修改就是查修改时间大于最后导入时间的M,这样把修改M按目录导入到SVN目录了,再提交就OK了,这样整个M就有版本管理了,每个人自己在本地库开发,以SVN的代码为准:
    在这里插入图片描述

    在这里插入图片描述
    在这里插入图片描述

    开发管理M代码功能M需要用到的技术部分如下:

    首先知道用SQL查库里全部表和类

    查全部表:
    select CLASSNAME FROM information_schema.Tables where TABLE_SCHEMA=‘dbo’

    查全部类:
    select distinct ID from %dictionary.compiledclass where CompileNamespace like ‘%DHC-LISDATA’

    查询最近修改的M:
    select distinct ID,TimeChanged from %dictionary.compiledclass where CompileNamespace like ‘%DHC-LISDATA’ order by TimeChanged desc

    然后可以借助s ret=$system.OBJ.Export(“类名.cls”,“导出全路径名称”)来导出M到数据库指定文件里。

    导出逻辑可以借助i ##Class(%ClassDefinition).%ExistsId(“类名.cls”) 判断类是否存在

    可以借助s ret=$system.OBJ.Load(“M导出xml的全路径”,“ck”)来导入和自动编译M,ck就是编译

    这样结合别的语言开发个代码管理功能就可以实现了。还能借助这个批量导出M,然后用脚本批量处理M的xml文件来批量处理代码(我就借助这个机制处理过好几波代码,代码实在太多了,几千个,人工一个个改是单纯的体力活)。也可以做自动升级工具,把打包的M文件自动备份数据库里的M,然后导入新的更新包的M(因为别的dll,js那些本身更新就没问题,早期自动更新就卡在自动备份M和导入M上)。

    示例M

    Class websys.LISUpGrade Extends %RegisteredObject
    {
    
    ///  导出M
    ///  w ##Class(websys.LISUpGrade).ExportMMTHD("websys.LISUpGrade.cls","C:\Users\zlzxu\Desktop\新建文件夹\DHC-LISDATA\websys.LISUpGrade.xml","")
    ///  w ##Class(websys.LISUpGrade).ExportMMTHD("DHCLIS.BLD.DHCBDApprovalReqForm.cls","C:\Users\zlzxu\Desktop\新建文件夹\DHC-APP\DHCLIS.BLD.DHCBDApprovalReqForm.xml","DHC-APP")
    ///  按类名和路径导出M
    ClassMethod ExportMMTHD(ClassName, ExportPath, NameSpace, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, Sessions, Output RowCount As %String) As %String
    {
    	//s ^TMP("zlz")=$lb(ClassName, ExportPath, NameSpace)
    	s ClassName=$g(ClassName)
    	s ExportPath=$g(ExportPath)
    	s NameSpace=$g(NameSpace)
    	s ret=1
    	S $ZT="Error"
    	s CurNameSpace=$NAMESPACE
    	i $l(NameSpace) s $NAMESPACE=NameSpace
    	i ##Class(%ClassDefinition).%ExistsId($REPLACE(ClassName,".cls","")) d
    	.s ret=$system.OBJ.Export(ClassName,ExportPath)
    	i ClassName[".mac" d
    	.s ret=$system.OBJ.Export(ClassName,ExportPath)
    	i $l(NameSpace) s $NAMESPACE=CurNameSpace
    	q ret
    	
    Error
    	q "导出:"_ClassName_"失败!"_$ECODE_","_$ZERROR
    }
    
    ///  导入M
    ///  w ##Class(websys.LISUpGrade).LoadMMTHD("C:\Users\zhanglianzhu\Desktop\dealtableutil\bin\Debug\net5.0\tmp\dbo.BBAdverseReactionType.xml","DHC-LISDATA")
    ///  按类名和路径导出M
    ClassMethod LoadMMTHD(Path, NameSpace, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, Sessions, Output RowCount As %String) As %String
    {
    	s Path=$g(Path)
    	s NameSpace=$g(NameSpace)
    	s CurNameSpace=$NAMESPACE
    	i $l(NameSpace) s $NAMESPACE=NameSpace
    	s ret=$system.OBJ.Load(Path,"ck")
    	i $l(NameSpace) s $NAMESPACE=CurNameSpace
    	q ret
    }
    
    
    ///  设置索引模式和重建索引(平常不允许执行,使用环境会破坏数据库)
    ///  w ##Class(websys.LISUpGrade).SetIndexModeMTHD("1","")
    ///  
    ClassMethod SetIndexModeMTHD(Mode, Para, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, Sessions, Output RowCount As %String) As %String
    {
    	i Para'="DHCC" q "0"
    	s ^["DHC-LISDATA"]LISTableIndexVetion=Mode
    	//重建索引
    	s rset1 = ##class(%ResultSet).%New()
    	d rset1.Prepare("select CLASSNAME FROM information_schema.Tables where TABLE_SCHEMA='dbo'")
    	s exeret1=rset1.Execute()
    	s colCount1=rset1.GetColumnCount()
    	s dealNum1=0
        While(rset1.Next())
        {
            s colField=rset1.GetColumnName(1)
            s ColValue=rset1.GetDataByName(colField)
            i ColValue["dbo.V" continue
            s BuildStr="rtn=##class("_ColValue_").%BuildIndices()"
            s @BuildStr
            set ret=@"rtn"	
            zw ret
        }
    	q "0"
    }
    
    Query QryAllDbo(Path, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, Sessions, Output RowCount As %String) As %Query(ROWSPEC = "OutName,Type,NameSpace")
    {
    }
    
    /// 查询导出所有M
    /// Path:文件夹路径
    /// 
    ///                   
    /// d ##Class(%ResultSet).RunQuery("websys.LISUpGrade","QryAllDbo","D:\OUT")
    ClassMethod QryAllDboExecute(ByRef qHandle As %Binary, Path, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, Sessions, Output RowCount As %String) As %Status
    {
     	Set repid=$I(^CacheTemp)
    	If $g(ind)="" Set ind=1
    	s Path=$g(Path)
    	k ^TMPLIS($zn,repid)
    	s index=0
    	s rset1 = ##class(%ResultSet).%New()
    	d rset1.Prepare("select CLASSNAME FROM information_schema.Tables where TABLE_SCHEMA='dbo'")
    	s exeret1=rset1.Execute()
    	s colCount1=rset1.GetColumnCount()
    	s dealNum1=0
        While(rset1.Next())
        {
            s colField=rset1.GetColumnName(1)
            s ColValue=rset1.GetDataByName(colField)
            s OutName=ColValue_".xml"
            s Type=$p(ColValue,".",1)
            s NameSpace="DHC-LISDATA"
            i $l(Path) d
            .i Path["\" d
            ..s OutPath=Path_"\"_OutName
            .e  d
            ..s OutPath=Path_"/"_OutName
            .s ret=$system.OBJ.Export(ColValue_".cls",OutPath)
            .i ret=1 d
            ..i (OutName'["dbo.") d
            ...s ^TMPLIS($zn,repid,"OUT",index)=$lb(OutName,Type,NameSpace)
            ...s index=index+1
            ..e  d
            ...d OutputData
            e  d 
            .i OutName'["dbo." d
            ..s ^TMPLIS($zn,repid,"OUT",index)=$lb(OutName,Type,NameSpace)
            ..s index=index+1
            .e  d
            ..d OutputData
        }
    
    	
    	k ^TMPLIS($zn,repid)
        Set qHandle=$lb(0,repid,0)
        Quit $$$OK
        
    OutputData
    	i $d(^TMPLIS($zn,repid,OutName,NameSpace)) q
    	s ^TMPLIS($zn,repid,OutName,NameSpace)=""
     	s TypeI=" "
     	i $l(Type) s TypeI=Type
     	s NameSpaceI=" "
     	i $l(NameSpace) s NameSpaceI=NameSpace
     	set Data=$lb(OutName,Type,NameSpace)
     	Set ColFields = "OutName,Type,NameSpace"
     	Set ^CacheTemp(repid,ind)=##Class(LIS.Util.Common).TransListNull(Data,ColFields)
     	Set ind=ind+1
    	Quit
    }
    
    ClassMethod QryAllDboClose(ByRef qHandle As %Binary) As %Status [ PlaceAfter = QryAllDboExecute ]
    {
    	Set repid=$LIST(qHandle,2)
     	Kill ^CacheTemp(repid)
    	Quit $$$OK
    }
    
    ClassMethod QryAllDboFetch(ByRef qHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer = 0) As %Status [ PlaceAfter = QryAllDboExecute ]
    {
     	Set AtEnd=$LIST(qHandle,1)
     	Set repid=$LIST(qHandle,2)
     	Set ind=$LIST(qHandle,3)
    	//
     	Set ind=$o(^CacheTemp(repid,ind))
     	If ind="" {				// if there are no more rows, finish fetching
     		Set AtEnd=1
     		Set Row=""
     	}
     	Else      {				// fetch row
     		Set Row=^CacheTemp(repid,ind)
     	}
     	// Save QHandle
     	s qHandle=$lb(AtEnd,repid,ind)
    	Quit $$$OK
    }
    
    }
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164

    示例M

    Class websys.ExportAllM Extends %RegisteredObject
    {
    
    Query ExportAllM(Path, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, Sessions, Output RowCount As %String) As %Query(ROWSPEC = "OutName,Type,NameSpace,BllType")
    {
    }
    
    /// 导出所有M
    /// Path:文件夹路径
    /// 
    ///                   
    /// d ##Class(%ResultSet).RunQuery("websys.ExportAllM","ExportAllM","D:\SVN临时\trunk\13开发库\Common\checkindexutil\bin\Debug\net5.0\tmp")
    ClassMethod ExportAllMExecute(ByRef qHandle As %Binary, Path, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, Sessions, Output RowCount As %String) As %Status
    {
     	Set repid=$I(^CacheTemp)
    	If $g(ind)="" Set ind=1
    	s Path=$g(Path)
    	k ^TMPLIS($zn,repid)
    	s index=0
    	s rset1 = ##class(%ResultSet).%New()
    	d rset1.Prepare("select CLASSNAME FROM information_schema.Tables where TABLE_SCHEMA='dbo'")
    	s exeret1=rset1.Execute()
    	s colCount1=rset1.GetColumnCount()
    	s dealNum1=0
        While(rset1.Next())
        {
            s colField=rset1.GetColumnName(1)
            s ColValue=rset1.GetDataByName(colField)
            s OutName=ColValue_".xml"
            s Type=$p(ColValue,".",1)
            s NameSpace="DHC-LISDATA"
            i $l(Path) d
            .i Path["\" d
        	..s OutPath=Path_"\"_NameSpace_"\"_OutName
        	.e  d
            ..s OutPath=Path_"/"_NameSpace_"/"_OutName
            .s ret=$system.OBJ.Export(ColValue_".cls",OutPath)
            .i ret=1 d
            ..i (OutName'["dbo.") d
            ...s ^TMPLIS($zn,repid,"OUT",index)=$lb(OutName,Type,NameSpace)
            ...s index=index+1
            ..e  d
            ...d OutputData
            e  d 
            .i OutName'["dbo." d
            ..s ^TMPLIS($zn,repid,"OUT",index)=$lb(OutName,Type,NameSpace)
            ..s index=index+1
            .e  d
            ..d OutputData
        }
    
    	s rset = ##class(%ResultSet).%New()
    	d rset.Prepare("select distinct  ID from %dictionary.compiledclass where CompileNamespace like '%DHC-LISDATA'")
    	s exeret=rset.Execute()
    	s colCount=rset.GetColumnCount()
    	s dealNum=0
        While(rset.Next())
        {
            s colField=rset.GetColumnName(1)
            s ColValue=rset.GetDataByName(colField)
            s OutName=ColValue_".xml"
            s Type=$p(ColValue,".",1)
            s NameSpace="DHC-LISDATA"
            i $l(Path) d
            .i Path["\" d
        	..s OutPath=Path_"\"_NameSpace_"\"_OutName
        	.e  d
            ..s OutPath=Path_"/"_NameSpace_"/"_OutName
            .s ret=$system.OBJ.Export(ColValue_".cls",OutPath)
            .i ret=1 d
            ..i (OutName'["dbo.") d
            ...s ^TMPLIS($zn,repid,"OUT",index)=$lb(OutName,Type,NameSpace)
            ...s index=index+1
            ..e  d
            ...d OutputData
            e  d 
            .i OutName'["dbo." d
            ..s ^TMPLIS($zn,repid,"OUT",index)=$lb(OutName,Type,NameSpace)
            ..s index=index+1
            .e  d
            ..d OutputData
        }
        
    	//先输出dbo的类
    	s index="" f  s index=$o(^TMPLIS($zn,repid,"OUT",index)) q:index=""  d
    	.s OutData=$g(^TMPLIS($zn,repid,"OUT",index))
    	.s OutName=$lg(OutData,1)
    	.s Type=$lg(OutData,2)
    	.s NameSpace=$lg(OutData,3)
    	.d OutputData
    
        
        //设置所有Mac信息
    	d ..SetAllMacData()
    	s ColValue="" f  s ColValue=$o(^LISAllMacName(ColValue)) q:ColValue=""  d
    	.s OutName=ColValue_".mac"
        .s Type=$p(OutName,".",1)
        .s NameSpace="DHC-LISDATA"
        .i $l(Path) d
        ..i Path["\" d
        ...s OutPath=Path_"\"_NameSpace_"\"_OutName
        ..e  d
        ...s OutPath=Path_"/"_NameSpace_"/"_OutName
        ..s ret=$system.OBJ.Export(ColValue_".mac",OutPath)
        ..i ret=1 d
        ...d OutputData
        .e  d 
        ..d OutputData
        
        s $NAMESPACE="DHC-APP"
        s rset = ##class(%ResultSet).%New()
    	d rset.Prepare("select distinct  ID from %dictionary.compiledclass where CompileNamespace like '%DHC-APP'")
    	s exeret=rset.Execute()
    	s colCount=rset.GetColumnCount()
    	s dealNum=0
        While(rset.Next())
        {
            s colField=rset.GetColumnName(1)
            s ColValue=rset.GetDataByName(colField)
            s OutName=ColValue_".xml"
            s Type=$p(ColValue,".",1)
            s NameSpace="DHC-APP"
            i $l(Path) d
            .i Path["\" d
        	..s OutPath=Path_"\"_NameSpace_"\"_OutName
        	.e  d
            ..s OutPath=Path_"/"_NameSpace_"/"_OutName
            .s ret=$system.OBJ.Export(ColValue_".cls",OutPath)
            .i ret=1 d
            ..i (OutName'["dbo.") d
            ...d OutputData
            e  d 
            .i OutName'["dbo." d
            ..d OutputData
        }
        s $NAMESPACE="DHC-LISDATA"
    	k ^TMPLIS($zn,repid)
        Set qHandle=$lb(0,repid,0)
        Quit $$$OK
        
    OutputData
    	i $d(^TMPLIS($zn,repid,OutName,NameSpace)) q
    	s ^TMPLIS($zn,repid,OutName,NameSpace)=""
     	s TypeI=" "
     	i $l(Type) s TypeI=Type
     	s NameSpaceI=" "
     	i $l(NameSpace) s NameSpaceI=NameSpace
     	i '$d(^LISAllM(OutName,TypeI,NameSpaceI)) d
     	.s ^LISAllM(OutName,TypeI,NameSpaceI)=""
     	s HasType=0
     	i (OutName["MIC") s ^LISAllM(OutName,TypeI,NameSpaceI)="微生物",HasType=1
     	i (OutName["MC") s ^LISAllM(OutName,TypeI,NameSpaceI)="微生物",HasType=1
     	i (OutName["Mic") s ^LISAllM(OutName,TypeI,NameSpaceI)="微生物",HasType=1
     	i (OutName["QC") s ^LISAllM(OutName,TypeI,NameSpaceI)="质控",HasType=1
     	i (OutName["BLD.") s ^LISAllM(OutName,TypeI,NameSpaceI)="血库",HasType=1
     	i (OutName[".BLD") s ^LISAllM(OutName,TypeI,NameSpaceI)="血库",HasType=1
     	i (OutName["BLDProxy") s ^LISAllM(OutName,TypeI,NameSpaceI)="血库",HasType=1
     	i (OutName["BLDSP.") s ^LISAllM(OutName,TypeI,NameSpaceI)="血库",HasType=1
     	i (OutName["EQA.") s ^LISAllM(OutName,TypeI,NameSpaceI)="EQA",HasType=1
     	i (OutName["RG") s ^LISAllM(OutName,TypeI,NameSpaceI)="试剂",HasType=1
     	i (OutName["DHCRG") s ^LISAllM(OutName,TypeI,NameSpaceI)="试剂",HasType=1
     	i (OutName["LISSTAT.") s ^LISAllM(OutName,TypeI,NameSpaceI)="统计",HasType=1
     	i (OutName[".DHCStat") s ^LISAllM(OutName,TypeI,NameSpaceI)="统计",HasType=1
     	i (OutName["MI.") s ^LISAllM(OutName,TypeI,NameSpaceI)="接口",HasType=1
     	i (OutName["dbo.") s ^LISAllM(OutName,TypeI,NameSpaceI)="表结构",HasType=1
     	i HasType=0 s ^LISAllM(OutName,TypeI,NameSpaceI)="检验"
     	s BllType=^LISAllM(OutName,TypeI,NameSpaceI)
     	set Data=$lb(OutName,Type,NameSpace,BllType)
     	Set ColFields = "OutName,Type,NameSpace,BllType"
     	Set ^CacheTemp(repid,ind)=##Class(LIS.Util.Common).TransListNull(Data,ColFields)
     	Set ind=ind+1
    	Quit
    }
    
    ClassMethod ExportAllMClose(ByRef qHandle As %Binary) As %Status [ PlaceAfter = ExportAllMExecute ]
    {
    	Set repid=$LIST(qHandle,2)
     	Kill ^CacheTemp(repid)
    	Quit $$$OK
    }
    
    ClassMethod ExportAllMFetch(ByRef qHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer = 0) As %Status [ PlaceAfter = ExportAllMExecute ]
    {
     	Set AtEnd=$LIST(qHandle,1)
     	Set repid=$LIST(qHandle,2)
     	Set ind=$LIST(qHandle,3)
    	//
     	Set ind=$o(^CacheTemp(repid,ind))
     	If ind="" {				// if there are no more rows, finish fetching
     		Set AtEnd=1
     		Set Row=""
     	}
     	Else      {				// fetch row
     		Set Row=^CacheTemp(repid,ind)
     	}
     	// Save QHandle
     	s qHandle=$lb(AtEnd,repid,ind)
    	Quit $$$OK
    }
    
    /// 设置所有Mac名信息
    ClassMethod SetAllMacData()
    {
    	s ^LISAllMacName("MI.Common.MIH7600")=""
        s ^LISAllMacName("MI.DHCDATAMIC")=""
        s ^LISAllMacName("MI.DHCMIFAuthResult")=""
        s ^LISAllMacName("MI.DHCMIFXMRES")=""
        s ^LISAllMacName("MI.MIF000")=""
        s ^LISAllMacName("MI.MIF008ANew")=""
        s ^LISAllMacName("MI.MIF16200BI")=""
        s ^LISAllMacName("MI.MIF5DIFF")=""
        s ^LISAllMacName("MI.MIFABH7600BI")=""
        s ^LISAllMacName("MI.MIFABHLs76BI")=""
        s ^LISAllMacName("MI.MIFABL800")=""
        s ^LISAllMacName("MI.MIFABXPentraLX80")=""
        s ^LISAllMacName("MI.MIFACCESS2")=""
        s ^LISAllMacName("MI.MIFACLTOPBI")=""
        s ^LISAllMacName("MI.MIFACP3000")=""
        s ^LISAllMacName("MI.MIFACP3000BI")=""
        s ^LISAllMacName("MI.MIFACUATAR")=""
        s ^LISAllMacName("MI.MIFADVIA")=""
        s ^LISAllMacName("MI.MIFADVIABI")=""
        s ^LISAllMacName("MI.MIFAIQ200")=""
        s ^LISAllMacName("MI.MIFASTM")=""
        s ^LISAllMacName("MI.MIFAU480BI")=""
        s ^LISAllMacName("MI.MIFAU5800BI")=""
        s ^LISAllMacName("MI.MIFAU6800BI")=""
        s ^LISAllMacName("MI.MIFAU680BI")=""
        s ^LISAllMacName("MI.MIFAUTOLUMOA2000")=""
        s ^LISAllMacName("MI.MIFAX4280")=""
        s ^LISAllMacName("MI.MIFAxceed260BI")=""
        s ^LISAllMacName("MI.MIFBACTECFX")=""
        s ^LISAllMacName("MI.MIFBC3000")=""
        s ^LISAllMacName("MI.MIFBC5390")=""
        s ^LISAllMacName("MI.MIFBC6390")=""
        s ^LISAllMacName("MI.MIFBC6800")=""
        s ^LISAllMacName("MI.MIFBCHL7G")=""
        s ^LISAllMacName("MI.MIFBCHL7GBi")=""
        s ^LISAllMacName("MI.MIFBD100")=""
        s ^LISAllMacName("MI.MIFBD100ACT")=""
        s ^LISAllMacName("MI.MIFBECompactX")=""
        s ^LISAllMacName("MI.MIFBNII")=""
        s ^LISAllMacName("MI.MIFBOXUN")=""
        s ^LISAllMacName("MI.MIFBS2000M")=""
        s ^LISAllMacName("MI.MIFCA1500")=""
        s ^LISAllMacName("MI.MIFCAL8000N")=""
        s ^LISAllMacName("MI.MIFCentaurXP")=""
        s ^LISAllMacName("MI.MIFCH7600II")=""
        s ^LISAllMacName("MI.MIFCI1600BI")=""
        s ^LISAllMacName("MI.MIFCI8200BI")=""
        s ^LISAllMacName("MI.MIFCL2000")=""
        s ^LISAllMacName("MI.MIFCLISalphaBI")=""
        s ^LISAllMacName("MI.MIFCOBAS6500")=""
        s ^LISAllMacName("MI.MIFCOBASB123")=""
        s ^LISAllMacName("MI.MIFCOBASE411")=""
        s ^LISAllMacName("MI.MIFCOBASE412")=""
        s ^LISAllMacName("MI.MIFCOBASE601")=""
        s ^LISAllMacName("MI.MIFCOBASE715")=""
        s ^LISAllMacName("MI.MIFCobaseE411BI")=""
        s ^LISAllMacName("MI.MIFCOBASP600")=""
        s ^LISAllMacName("MI.MIFCS5100")=""
        s ^LISAllMacName("MI.MIFDiana1")=""
        s ^LISAllMacName("MI.MIFDM2INAuth")=""
        s ^LISAllMacName("MI.MIFDM2RECEIVE")=""
        s ^LISAllMacName("MI.MIFDM2SEND")=""
        s ^LISAllMacName("MI.MIFDXC800BI")=""
        s ^LISAllMacName("MI.MIFDXH600")=""
        s ^LISAllMacName("MI.MIFDXH800")=""
        s ^LISAllMacName("MI.MIFDXI800BI")=""
        s ^LISAllMacName("MI.MIFE411BI")=""
        s ^LISAllMacName("MI.MIFE411BI2")=""
        s ^LISAllMacName("MI.MIFEPALY")=""
        s ^LISAllMacName("MI.MIFEPCenter")=""
        s ^LISAllMacName("MI.MIFFA160")=""
        s ^LISAllMacName("MI.MIFFUS3000")=""
        s ^LISAllMacName("MI.MIFG7")=""
        s ^LISAllMacName("MI.MIFG8")=""
        s ^LISAllMacName("MI.MIFGEB600")=""
        s ^LISAllMacName("MI.MIFGEB600B")=""
        s ^LISAllMacName("MI.MIFGEM3000")=""
        s ^LISAllMacName("MI.MIFGEM4000")=""
        s ^LISAllMacName("MI.MIFGM3000")=""
        s ^LISAllMacName("MI.MIFGRIFOLS")=""
        s ^LISAllMacName("MI.MIFGSTARE4")=""
        s ^LISAllMacName("MI.MIFGZWAD2")=""
        s ^LISAllMacName("MI.MIFH7600")=""
        s ^LISAllMacName("MI.MIFHAlegria")=""
        s ^LISAllMacName("MI.MIFHDXI800")=""
        s ^LISAllMacName("MI.MIFHEMOHUB")=""
        s ^LISAllMacName("MI.MIFHEMOHUBSEND")=""
        s ^LISAllMacName("MI.MIFHL7")=""
        s ^LISAllMacName("MI.MIFHLBC5800")=""
        s ^LISAllMacName("MI.MIFHLIAISONXL")=""
        s ^LISAllMacName("MI.MIFHPHADIA")=""
        s ^LISAllMacName("MI.MIFHTSM")=""
        s ^LISAllMacName("MI.MIFI2000SR")=""
        s ^LISAllMacName("MI.MIFI2000SR2")=""
        s ^LISAllMacName("MI.MIFI3000")=""
        s ^LISAllMacName("MI.MIFILH750Img")=""
        s ^LISAllMacName("MI.MIFIQ200")=""
        s ^LISAllMacName("MI.MIFKUF10")=""
        s ^LISAllMacName("MI.MIFLIAISON")=""
        s ^LISAllMacName("MI.MIFLISVMachine")=""
        s ^LISAllMacName("MI.MIFLWC420")=""
        s ^LISAllMacName("MI.MIFMINIVIDAS")=""
        s ^LISAllMacName("MI.MIFMQ2000")=""
        s ^LISAllMacName("MI.MIFN600")=""
        s ^LISAllMacName("MI.MIFNOVA")=""
        s ^LISAllMacName("MI.MIFOC")=""
        s ^LISAllMacName("MI.MIFPYLON3D")=""
        s ^LISAllMacName("MI.MIFROCHEE411")=""
        s ^LISAllMacName("MI.MIFRP500")=""
        s ^LISAllMacName("MI.MIFRT6000")=""
        s ^LISAllMacName("MI.MIFRT6000B")=""
        s ^LISAllMacName("MI.MIFSERVER")=""
        s ^LISAllMacName("MI.MIFSIMRec")=""
        s ^LISAllMacName("MI.MIFSIMSend")=""
        s ^LISAllMacName("MI.MIFSTAGO")=""
        s ^LISAllMacName("MI.MIFSYSMEXXT2000i")=""
        s ^LISAllMacName("MI.MIFTB120")=""
        s ^LISAllMacName("MI.MIFTBABi")=""
        s ^LISAllMacName("MI.MIFTDR300C")=""
        s ^LISAllMacName("MI.MIFTEST")=""
        s ^LISAllMacName("MI.MIFTest")=""
        s ^LISAllMacName("MI.MIFTEXT")=""
        s ^LISAllMacName("MI.MIFTMP")=""
        s ^LISAllMacName("MI.MIFTOP700")=""
        s ^LISAllMacName("MI.MIFUROCHEHE601")=""
        s ^LISAllMacName("MI.MIFUT500B")=""
        s ^LISAllMacName("MI.MIFV8")=""
        s ^LISAllMacName("MI.MIFVIT5600")=""
        s ^LISAllMacName("MI.MIFVITEK")=""
        s ^LISAllMacName("MI.MIFVITEK2")=""
        s ^LISAllMacName("MI.MIFVITROS350BI")=""
        s ^LISAllMacName("MI.MIFVITROS5600")=""
        s ^LISAllMacName("MI.MIFWVITEKMS")=""
        s ^LISAllMacName("MI.MIFXE2100BI")=""
        s ^LISAllMacName("MI.MIFXIMENZI")=""
        s ^LISAllMacName("MI.MIFXL3000")=""
        s ^LISAllMacName("MI.MIFXRMBEBI")=""
        s ^LISAllMacName("MI.MIFXT4000i")=""
        s ^LISAllMacName("MI.MIFXT800i")=""
        s ^LISAllMacName("MI.MIFXXB")=""
        s ^LISAllMacName("MI.MIFYDBNII")=""
        s ^LISAllMacName("MI.MIFYPIN")=""
        s ^LISAllMacName("MI.MIFYPOUT")=""
        s ^LISAllMacName("MI.MIFZHCAL8000")=""
        s ^LISAllMacName("MI.MIFZYI4000BI")=""
        s ^LISAllMacName("MI.SMART3000")=""
        s ^LISAllMacName("MI.TESTYY")=""
        s ^LISAllMacName("MIF000")=""
    }
    
    /// 设置最后更新M时间
    ClassMethod SetLastTimeUpdateMMTHD(Date, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, Sessions, Output RowCount As %String) As %String
    {
    	s ^LISLastUpdateM=Date
    	q ""
    }
    
    Query ExportUpdateM(Path, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, Sessions, Output RowCount As %String) As %Query(ROWSPEC = "OutName")
    {
    }
    
    /// 导出所有M
    /// Path:文件夹路径
    /// 
    ///                   
    /// d ##Class(%ResultSet).RunQuery("websys.LISCodeManage","ExportUpdateM")
    ClassMethod ExportUpdateMExecute(ByRef qHandle As %Binary, Path, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, Sessions, Output RowCount As %String) As %Status
    {
     	Set repid=$I(^CacheTemp)
    	If $g(ind)="" Set ind=1
    	s Path=$g(Path)
    	k ^TMPLIS($zn,repid)
    	s index=0
    	s rset1 = ##class(%ResultSet).%New()
    	d rset1.Prepare("select distinct ID,TimeChanged from %dictionary.compiledclass where CompileNamespace like '%DHC-LISDATA' order by TimeChanged desc")
    	s exeret1=rset1.Execute()
    	s colCount1=rset1.GetColumnCount()
    	s dealNum1=0
    	s LISLastUpdateM=$g(^LISLastUpdateM)
    	i $l(LISLastUpdateM) d
    	.s LastDate=$p(LISLastUpdateM,"^",1)
    	.s LastTime=$p(LISLastUpdateM,"^",2)
    	e  d
    	.s LastDate=$zd($p($h,",",1),8)
    	.s LastTime=$p($h,",",2)
        While(rset1.Next())
        {
            s colFieldID=rset1.GetColumnName(1)
            s OutName=rset1.GetDataByName(colFieldID)
            s colFieldTimeChanged=rset1.GetColumnName(2)
            s TimeChanged=rset1.GetDataByName(colFieldTimeChanged)
            s CurDate=$zd($p(TimeChanged,",",1),8)
            s CurTime=$p(TimeChanged,",",2)
            s Cha=##Class(LIS.Util.Common).GetDateTimeDiff(CurDate,CurTime,LastDate,LastTime)
            i $p(Cha,",",4)<0 q
            d OutputData
        }
    
    	k ^TMPLIS($zn,repid)
        Set qHandle=$lb(0,repid,0)
        Quit $$$OK
        
    OutputData
    	
     	set Data=$lb(OutName)
     	Set ColFields = "OutName"
     	Set ^CacheTemp(repid,ind)=##Class(LIS.Util.Common).TransListNull(Data,ColFields)
     	Set ind=ind+1
    	Quit
    }
    
    ClassMethod ExportUpdateMClose(ByRef qHandle As %Binary) As %Status [ PlaceAfter = ExportUpdateMExecute ]
    {
    	Set repid=$LIST(qHandle,2)
     	Kill ^CacheTemp(repid)
    	Quit $$$OK
    }
    
    ClassMethod ExportUpdateMFetch(ByRef qHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer = 0) As %Status [ PlaceAfter = ExportUpdateMExecute ]
    {
     	Set AtEnd=$LIST(qHandle,1)
     	Set repid=$LIST(qHandle,2)
     	Set ind=$LIST(qHandle,3)
    	//
     	Set ind=$o(^CacheTemp(repid,ind))
     	If ind="" {				// if there are no more rows, finish fetching
     		Set AtEnd=1
     		Set Row=""
     	}
     	Else      {				// fetch row
     		Set Row=^CacheTemp(repid,ind)
     	}
     	// Save QHandle
     	s qHandle=$lb(AtEnd,repid,ind)
    	Quit $$$OK
    }
    
    }
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168
    • 169
    • 170
    • 171
    • 172
    • 173
    • 174
    • 175
    • 176
    • 177
    • 178
    • 179
    • 180
    • 181
    • 182
    • 183
    • 184
    • 185
    • 186
    • 187
    • 188
    • 189
    • 190
    • 191
    • 192
    • 193
    • 194
    • 195
    • 196
    • 197
    • 198
    • 199
    • 200
    • 201
    • 202
    • 203
    • 204
    • 205
    • 206
    • 207
    • 208
    • 209
    • 210
    • 211
    • 212
    • 213
    • 214
    • 215
    • 216
    • 217
    • 218
    • 219
    • 220
    • 221
    • 222
    • 223
    • 224
    • 225
    • 226
    • 227
    • 228
    • 229
    • 230
    • 231
    • 232
    • 233
    • 234
    • 235
    • 236
    • 237
    • 238
    • 239
    • 240
    • 241
    • 242
    • 243
    • 244
    • 245
    • 246
    • 247
    • 248
    • 249
    • 250
    • 251
    • 252
    • 253
    • 254
    • 255
    • 256
    • 257
    • 258
    • 259
    • 260
    • 261
    • 262
    • 263
    • 264
    • 265
    • 266
    • 267
    • 268
    • 269
    • 270
    • 271
    • 272
    • 273
    • 274
    • 275
    • 276
    • 277
    • 278
    • 279
    • 280
    • 281
    • 282
    • 283
    • 284
    • 285
    • 286
    • 287
    • 288
    • 289
    • 290
    • 291
    • 292
    • 293
    • 294
    • 295
    • 296
    • 297
    • 298
    • 299
    • 300
    • 301
    • 302
    • 303
    • 304
    • 305
    • 306
    • 307
    • 308
    • 309
    • 310
    • 311
    • 312
    • 313
    • 314
    • 315
    • 316
    • 317
    • 318
    • 319
    • 320
    • 321
    • 322
    • 323
    • 324
    • 325
    • 326
    • 327
    • 328
    • 329
    • 330
    • 331
    • 332
    • 333
    • 334
    • 335
    • 336
    • 337
    • 338
    • 339
    • 340
    • 341
    • 342
    • 343
    • 344
    • 345
    • 346
    • 347
    • 348
    • 349
    • 350
    • 351
    • 352
    • 353
    • 354
    • 355
    • 356
    • 357
    • 358
    • 359
    • 360
    • 361
    • 362
    • 363
    • 364
    • 365
    • 366
    • 367
    • 368
    • 369
    • 370
    • 371
    • 372
    • 373
    • 374
    • 375
    • 376
    • 377
    • 378
    • 379
    • 380
    • 381
    • 382
    • 383
    • 384
    • 385
    • 386
    • 387
    • 388
    • 389
    • 390
    • 391
    • 392
    • 393
    • 394
    • 395
    • 396
    • 397
    • 398
    • 399
    • 400
    • 401
    • 402
    • 403
    • 404
    • 405
    • 406
    • 407
    • 408
    • 409
    • 410
    • 411
    • 412
    • 413
    • 414
    • 415
    • 416
    • 417
    • 418
    • 419
    • 420
    • 421
    • 422
    • 423
    • 424
    • 425
    • 426
    • 427
    • 428
    • 429
    • 430
    • 431
    • 432
    • 433
    • 434
    • 435
    • 436
    • 437
    • 438
    • 439
    • 440
    • 441
    • 442

    美美的,再也不用担心M被盖了,后台也就避免内耗稳步提高了。供有管理M代码想法的同学参考。

  • 相关阅读:
    WINDOWS与LINUX的文件文件共享
    噢不,一条update.where无索引导致的MySQL死锁
    中国计算机学会芯片大会 (CCF Chip 2024)
    Spire Office 7.5.4 for NET
    荣耀携手Blue Yonder,加快企业战略增长
    SQL开发笔记之专栏介绍
    AttributeError: ‘bytes‘ object has no attribute ‘encode‘异常解决方案
    Rn开发社区推荐组件
    [论文总结] 深度学习在农业领域应用论文笔记10
    君方智能设计平台-对象持久化技术方案
  • 原文地址:https://blog.csdn.net/zhanglianzhu_91/article/details/126393129