Feature #2758 » ZJ_ACSputRdb.cpp
1 |
#include "ZJ_ACSputRdb.h"
|
---|---|
2 |
#include "ZJ_ACS.h"
|
3 |
|
4 |
putRdb::putRdb() |
5 |
{
|
6 |
|
7 |
|
8 |
}
|
9 |
putRdb::~putRdb() |
10 |
{
|
11 |
|
12 |
|
13 |
}
|
14 |
|
15 |
int putRdb::putAYc(int rtu, int no, float value) |
16 |
{
|
17 |
CZJACS *s = (CZJACS *)iotprotocols; |
18 |
s->iotPRawCtrl->PutAYc(rtu, no, value); |
19 |
|
20 |
return 1; |
21 |
}
|
22 |
|
23 |
int putRdb::putAYx(int rtu, int no, int value) |
24 |
{
|
25 |
CZJACS *s = (CZJACS *)iotprotocols; |
26 |
s->iotPRawCtrl->PutAYx(rtu, no, value); |
27 |
return 1; |
28 |
}
|
29 |
|
30 |
int putRdb::printLog(unsigned int type, char *fmt) |
31 |
{
|
32 |
CZJACS *s = (CZJACS *)iotprotocols; |
33 |
s->PrintLog(type, fmt); |
34 |
|
35 |
return 1; |
36 |
|
37 |
|
38 |
}
|
39 |
|
40 |
void putRdb::putasoe(int rtu, int yxno, long long empno, long long timestamp) |
41 |
{
|
42 |
CZJACS *s = (CZJACS *)iotprotocols; |
43 |
S_RAWSOEEX soe; |
44 |
uint32 employeeno = 0; |
45 |
int num = 0; |
46 |
employeeno = empno; |
47 |
|
48 |
time_t tick = (time_t)(timestamp);//ת??ʱ?? |
49 |
struct tm tm; |
50 |
tm = *localtime(&tick); |
51 |
|
52 |
soe.Rtuno = rtu; |
53 |
soe.Yxno = yxno; |
54 |
soe.Type = 102; |
55 |
soe.Source = DC_K_RTUSOE; |
56 |
soe.Year = tm.tm_year+1900; |
57 |
soe.Month = tm.tm_mon+1; |
58 |
soe.Day = tm.tm_mday; |
59 |
soe.Hour = tm.tm_hour; |
60 |
soe.Minute = tm.tm_min; |
61 |
soe.Second = tm.tm_sec; |
62 |
soe.Ms = 0; |
63 |
soe.Val = 1; |
64 |
|
65 |
while (employeeno != 0) |
66 |
{
|
67 |
num++; |
68 |
employeeno = employeeno / 10; |
69 |
}
|
70 |
|
71 |
employeeno = empno; |
72 |
uint32 tmp = employeeno; |
73 |
|
74 |
for (int i = 0; i < num; i++) |
75 |
{
|
76 |
tmp = employeeno; |
77 |
for (int j = num - i - 1; j > 0; j--) |
78 |
{
|
79 |
tmp = tmp / 10; |
80 |
}
|
81 |
soe.Data[i + 1] = 48 + tmp % 10; |
82 |
}
|
83 |
soe.Data[num + 1] = 0; |
84 |
|
85 |
s->iotPRawCtrl->PutASoeEx(soe); |
86 |
}
|