欢迎光临散文网 会员登陆 & 注册

亚控kingscada简单报表

2023-12-08 19:41 作者:工控小周  | 我要投稿

祝贺已超 1 万工控人加入 PLC 工业自动化精 英群

祝贺已超 1 万工控人加入 PLC 工业自动化精 英群

一、一览图

二、主要控件

2.1 日期控件:对象-->UI控件-->日期时间,本次设计两个日期时间,分别是UIDateTime1(查询开始日期)和UIDateTime2(查询结束日期);如下图所示:

2.2 报表控件:工具箱-->报表,定义为Report1

选择编辑后,出现可以编辑的表格:

2.3 按钮

2.3.1 查询按钮

按下脚本如下:

float y1;

float m1;

float d1;

long StartTime;

long EndTime;

y1=UIDateTime1.Year;

m1=UIDateTime1.Month;

d1=UIDateTime1.Day;

string dtime1=StrFromReal(y1,0,"f")+"-"+StrFromReal(m1,0,"f")+"-"+StrFromReal(d1,0,"f");

float y2;

float m2;

float d2;

long StartTime2;

long EndTime2;

y2=UIDateTime2.Year;

m2=UIDateTime2.Month;

d2=UIDateTime2.Day;

string dtime2=StrFromReal(y1,0,"f")+"-"+StrFromReal(m1,0,"f")+"-"+StrFromReal(d1,0,"f");

// \\local\selectdate=dtime1;

Report1.SetCellStrings(4,1,27,3,"");  //清空单元格

Report1.SetCellString(2,2,dtime1);  //填写日期

StartTime=ConvertTimeToSecond(y1,m1,d1,0,0,0,0);

EndTime=ConvertTimeToSecond(y2,m2,d2,23,59,59,0);

Report1.SetTime(StartTime,EndTime,3600000);

Report1.SetHistData("\\local\PV1",2);  

Report1.SetHistData("\\local\PVQ1",3);

Report1.SetHistData("\\local\FT101",4);  

Report1.SetHistData("\\local\Total_FT101",5);

Report1.SetHistData("\\local\JS_COD",6);

Report1.SetHistData("\\local\JS_进水NH3N",7);

Report1.Query();

2.3.2 打印预览按钮

Report1.Preview();

2.3.3 打印按钮

Report1.Print();

2.3.4 导出保存按钮

string filename;

filename="C:\进水报表.xls";

Report1.ReportSaveAs(filename);


亚控kingscada简单报表的评论 (共 条)

分享到微博请遵守国家法律