《陈寒清WINCC视频教程报表脚本-打开画面显示当天数据.docx》由会员分享,可在线阅读,更多相关《陈寒清WINCC视频教程报表脚本-打开画面显示当天数据.docx(7页珍藏版)》请在第壹文秘上搜索。
1、I.在直面的点件其它二.瞄开片面trw中圣立捏序t见下面程序卜2.MBm包南屋时照源芯市密寄NAPdM.pdl瓯色A收的或WEP-年目V啦喇.缥,.VbYteiIow莅叱她.山yiMagema徉虹”BTL004HtHJQRj-rt21“:LS算SSLE力虹CeXLQl:Qi.DAdrCnlriz总工白I二.JKtfaCcELInckn8m,卫72JT2E登曲当天全部左提,为扁城5CTSFI2KGIIdI51tmmms:I,M广系Ikt老小IlXLl-百口片IxrnnIEceinTTr-YcviiinSFAii7hqijG4;uu-.1.wxiIK-DirrimrYcmrTiE卜E&RiyMp1
2、EtS6LocaIygumneI,SLocaiEndnw6.店面油内容睾就应款堆互3列鬲内容郛云向,一与用面而-娶却SJ烫-,”二X二史Jl%t在E称.七M泊M行acn*-.迂JUr导效招痂我乞*ftjs-o&SetcoraCtm:+Dt;RerIr-rrconn.ConnectonStreg-stcncon.QirsoxLccaion-xoce.GsenJ三cR三CxtOorJlQCoa-CLjL11.二4”,oCc3.CcandTvpe三1Su:QUeAMtae二og-8=qscCca.CcsBaAciTcxc上:*53案,ScoRji三GCCS.Cx6Kfto.ft三eordCount1
3、1AH5.A=二OiTSUXiLLM.Tago(:-IWxLCn运人在.iftW由住MSFiexSrdl.ClearMS11ox:.BowecDa.RonrKcur-,fr-r-.叶E3口r、:/一JTrSrwK8rIdt(i4L(k-1?1-WSFtXLd/.rl:,一才一 二冤堂NiLJrH,二5 xtp-所X$ridl.CcLVl*1::!CF【j-一.力EHin召一,:wjzm.,IUvlhiftrI二aI-SetoCom=Creat&Obiect(ADODBrCommandF)-DConrkCoEmaridTite-1,lSetOCom.ActiveConnetiononn.oCom
4、i,CommandText=si,执行检索功能*SetoRs=oCom.EKecuten=oRs.RecordCount获得检索到的总数,1HMIRuntirn己Tag名(J3).WitEn.,定义在线表格属性.MSFIcxGridLCIearMSFIeGrldl.Row莒二aRs.RecorefCount+2-MSFIexGridl.CalWidth)=700,第一列宽度设置.MSFIej(Gridl3Width俨IODO.MSFkxGHdlolWidth(2)=3300.MSFxGridl.ColWidth31=2500-MSF1exGridlolWidth(4)=2200-MSHexGr
5、idirolWidth51=2950等6列施度设比方果列数多叫维续添力WMSFIexGridLRowHeight(O)=GOO端一行高度设置.MSFxGridl.RowHeight(I)=400-MSFIexGridIrRow=0.orz=0To5限据上面的列数改变.MSFIexGridl.CeIFontSize=12r字体大小.M纤IGridLC仁卜MSFiexGridIT&xtL工件信息统计声:Mext-MSFIexGHdLMergeCells=4,相同内容合并用,元眸MsFIexGridLWLerEeRcwfO)=True1合并单元格.M5FIexGridI.Row=kForz=OTo5
6、根据上面的列数改变时MSFIexGndLCoI=LMSFIexGNdLCellB3dcCcJQUYbQaH,定七第二行猷色.Mext-MSF1exGndl.Te!O)Then:oRs.MoveFirst移动到数据库检索结果的第一行DoWhileNotoRsXOF是否到记录木尾.循环填与表格n=n+1MSFIexGridI.TEMtIVIatrix(F+2.0)-i,根1后,而实际情况对应输MSFIexGrid1,TextMatrixi+2,1)-oRs.Fieid5(0.VaJue丁rMiMMWWWMwWwdWVnWWWWWVUWWWVWVWWWUwWruVadwWWWwWWnW八MSFIex
7、Grid1,TextMatri(M2,2)=oRs.Feldsfl.ValuerMSFlexGFldl.TextMjBtri网i+23)=RtFeldE21.Vaiue.凶羽目GridITxtMtri3+&41=OH.HeEQ3).Vaiue,1MsFIexGridLTextMatrIxrFI23)=oR5JFjeld5(+),Value.i=l+l.ORSAIOCeNeXi1.oop,conn.CQ&e-二M纤但灼血工丁叩只口w三MWFIexGridJFow-移动到最占一仃.Else.妙鲍.您所查询的忖间段内没有数据口Rs-Requery匚口PmCl。施EndIf.Dimkjl,kj2,kj
8、3,kj4,kj5,kj6DimQRDimMSFIeXGrid对应表格控件名称DimLoCalBeginTime,LocaIEndTimegqiDimoRs,oRsl,nznl,ifz,ssll,oComzoComstrcn,conn,pjDimzxyl查询当天全部数据,除了控件名要注意修改外,以上其他为标准SetMSFIexGridl=SCreenItemS(Al)对应表格控件名称riqi=Now1.ocaIBeginTime=Year(Hqi)&Monthfriqi)&Dayfriqi)&00:00:001.ocaIEndTime=Year(riqi)&Month(riqi)&Dayfri
9、qi)&23:59:59MsgBox1.si=SELECTDLName,Bl,B2zB3zB4zB5FROMbiaolWHEREDTBETWEEN,&LocaIBeginTime&,and&LocaIEndTime&ORDERBYDT,SI后面的内容要对应数据库中列的内容,后面的DT与前面的DT要名称一致,biao要对应数据库列表名称dbo.后面的名称strcn=nProvider=SQLOLEDB-IJntegratedSecurity=SSPI;PersistSecurityInfo=FaIse;InitialCatalog=Project_l;DataSource=AwinccSetco
10、nn=CreateObject(ADODB.connection)Conn.ConnectionString=StrcnConn.CursorLocation=3conn.OpenSetoRs=CreateObject(ADODB.Recordset)Set0C0m=CreateObject(ADODB.Command)MsgBox2.oCom.CommandType=1MsgBox3.SetoCom.ActiveConnection=connMsgBox4.oCom.CommandText=siMsgBox5.SetoRs=oCom.Executen=oRs.RecordCount获得检索到
11、的总行数MsgBox6.定义在线表格属性MSFIexGridl.CIearMSFIexGridl.Rows=oRs.RecordCount+2MSFleXGridl.ColWidth(0)=700第一列宽度设置MSFIeXGridLCOlWidth=3300MSFIeGridl.ColWidth(2)=1000MSFIexGridl.ColWidth(3)=1500MSFIexGridl.ColWidth(4)=1500MSFIeGridl.ColWidth(5)=1500MSFIexGridl.ColWidth(6)=1500MSFIexGridl.ColWidth(7)=1500MSFIe
12、xGridl.RowHeight(0)=600MSFIeGridl.RowHeight(l)=400MSFIexGndl.Row=OForz=0To7根据上面的列数改变MsFlexGridl-CeIIFontSize=12MSFIexGridl-CoI=ZMSFIexGridl,Text=统计表”NextMsFlexGridl.MergeCeIIs=4,相同内容合并单元格MSFIexGridl-MergeRow(O)=True,合并单元格MSFIexGndl-Row=IForz=0To7根据上面的列数改变MSFIexGridl.CoI=ZMsFlexGndl.CelIBackCoIor=VbC
13、yan,定义第二行颜色NextMSFIexGridl.TextMatnx(IzO)=序号根据实际情况输入MsFIexGndl.TextMatrix(IJ)=日期”MSFleXGridLTeXtMatriX(1,2)=名称”12345(mm) (mm) (mm) (mm) (mm)MSFIeXGridLTeXtMatriX(1,3)=位置MSFleXGridLTeXtMatriX(L4)=位置MSFIeXGridLTeXtMatriX(L5)=位置MSFieXGridLTeXtMatriX(1,6)=位置MSFleXGridl.TextMatrixQ,7)=位置MSFIexGridl.ColAlignment(0)=4对其方式,根据实际情