组态王6.55——日报表


 

 

 

 //..............................................................

float Ayear;
float Amonth;
float Aday;
long x;
long y;
long Row;
long StartTime;
string temp;
Ayear=ADate1.Year;
Amonth=ADate1.Month;
Aday=ADate1.Day;
temp=StrFromInt( Ayear, 10 );
if(Amonth<10)
temp=temp+"-0"+StrFromInt( Amonth, 10 );
else
temp=temp+"-"+StrFromInt( Amonth, 10 );
if(Aday<10)
temp=temp+"-0"+StrFromInt( Aday, 10 );
else
temp=temp+"-"+StrFromInt( Aday, 10 );
\\本站点\选择日期=temp;
ReportSetCellString2("日报表", 5, 1, 28, 10, " "); //清空单元格
ReportSetCellString("日报表", 3, 2, temp);//填写日期
//查询数据
StartTime=NewHTConvertTime(Ayear,Amonth,Aday,0,0,0);
ReportSetHistData("日报表", "\\本站点\闸门开度", StartTime, 3600, "B4:B20");
ReportSetHistData("日报表", "\\本站点\产生水位随机数", StartTime, 3600, "C4:C20");

//填写时间
x=0;
while(x<24)
{
row=5+x;
y=StartTime+x*3600;
temp=StrFromTime( y, 2 );
ReportSetCellString("日报表", row, 1, temp);
x=x+1;
}

//..........................................................................................

 

 

long x;//天
long t;//时间戳
long m1;//月处理值
long n1;//年处理值

//年月处理初值
n1=year1;
m1=month1-2;

//年月处理
if(m1<=0)
{m1=m1+12;n1=n1-1;}

//天数
x=int(n1/4) -int( n1/100) + int(n1/400) + int(367*m1/12) + day1 + n1*365 - 719499;
//时间戳结果
t=x*24*3600+(hour1-8)*3600+minite1*60+second1;

//错误处理
if(t<0)
{t=0;}

//返回计算值
return t;

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM