whyclj
2020-08-20 4dbd3ce69274c1b48ed569c4e23de63b9f9586b8
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
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
package com.electrical.FourKW;
 
import java.security.interfaces.RSAKey;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
 
import com.base.Com;
import com.mysql.jdbc.EscapeTokenizer;
import com.sql.MysqlConnPool;
import com.sql.Sql_Mysql;
 
public class Electrical_Task_SQL {
    
    
    
    /**
     * ²éѯËùÓеÄÉ豸¼Ç¼
     * @param pool
     * @param electric
     */
    public static String queryAllElectric(MysqlConnPool pool,List<Electric_inf> electrics) {
        String PLC_ip="";
        String sql_str = " select * from " + Sql_Mysql.Tb_Electric_Inf + " order by electric_id;";
        Sql_Mysql sql = new Sql_Mysql(pool.getConn());
        ResultSet res = null;
        try {
            res = sql.sqlMysqlQuery(sql_str);
            Electric_inf elect = null;
            while(res.next()) {
                elect = new Electric_inf(res.getInt("electric_id"));
                elect.setElectric_name(res.getString("electric_name"));
                elect.setElectric_type(res.getInt("electric_type"));
                elect.setElectric_ip(res.getString("electric_ip"));
                electrics.add(elect);
                 PLC_ip=elect.getElectric_ip();
            }
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            if(res != null) {
                try {
                    res.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
            sql.close_con();
        }
        return  PLC_ip;
    }
    
    /**
     * ³õʼ»¯Êý¾Ý¿â±í
     * @param pool
     */
    public static void init(MysqlConnPool pool) {
        
        createDB_ElectricSystem(pool);
        
        createTb_Electric_inf(pool);
        
        //createTb_Electric_Switch(pool);
        
        createTb_Electric_State(pool);
                
        createTb_Electric_Rt(pool);
        
       //createTb_Electric_Power(pool);
        
        createTb_Electric_Control_Single(pool);
        
        createTb_Electric_Alarm(pool);
        
        createTb_Electric_Alarm_History(pool);
        
        createTb_Electric_Control_Conn(pool);
    }
    
    
    
    
    /**
     * ´´½¨4KWµçÔ´Êý¾Ý¿â
     * @param pool
     */
    public static void createDB_ElectricSystem(MysqlConnPool pool) {
        Sql_Mysql sql = new Sql_Mysql(pool.getConn());
        try {
            sql.sqlMysqlExecute("CREATE DATABASE IF NOT EXISTS " + Sql_Mysql.DB_ElectricSystem);
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
    
    
    
    
    
    /**
     * ´´½¨µçÔ´ÐÅÏ¢±í
     * @param pool
     */
    public static void createTb_Electric_inf(MysqlConnPool pool) {
        String sql_str = "CREATE TABLE IF NOT EXISTS "+Sql_Mysql.Tb_Electric_Inf+" (" + 
                "  num bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'Ö÷¼ü'," + 
                "  electric_id int(11) NOT NULL DEFAULT '3001' COMMENT 'É豸id'," + 
                "  electric_name varchar(255) NOT NULL DEFAULT '' COMMENT 'µçÔ´Ãû³Æ'," + 
                "  electric_type int(11) NOT NULL DEFAULT '0' COMMENT 'µçÔ´ÀàÐÍ(±¸ÓÃ)'," + 
                "  electric_ip varchar(255) NOT NULL DEFAULT '127.0.0.1' COMMENT 'µçÔ´É豸ip(ÖØÒª)'," + 
                "  note varchar(255) NOT NULL DEFAULT ''," + 
                "  PRIMARY KEY (num)," + 
                "  KEY electric_id_key (electric_id)" + 
                ") ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;";
        Sql_Mysql sql = new Sql_Mysql(pool.getConn());
        try {
            sql.sqlMysqlExecute(sql_str);
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
    
    /**
     * ´´½¨µçÔ´×Ü¿ª¹Ø×´Ì¬±í
     * @param pool
     */
    public static void createTb_Electric_Switch(MysqlConnPool pool) {
        String sql_str = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Tb_Electric_Switch + " (" + 
                "  num bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'Ö÷¼ü'," + 
                "  PLC_ip varchar(255) NOT NULL DEFAULT '127.0.0.1' COMMENT 'PLC_ip', "+
                "  km1_switchon_one int(11) NOT NULL DEFAULT '0' COMMENT 'Ò»ºÅת»»¿ª¹Ø¹ñKM1ºÏÕ¢Ö¸Áî'," + 
                "  km1_switchoff_one int(11) NOT NULL DEFAULT '0' COMMENT 'Ò»ºÅת»»¿ª¹Ø¹ñKM1·ÖÕ¢Ö¸Áî'," + 
                "  km2_switchon_one int(11) NOT NULL DEFAULT '0' COMMENT 'Ò»ºÅת»»¿ª¹Ø¹ñKM2ºÏÕ¢Ö¸Áî'," + 
                "  km2_switchoff_one int(11) NOT NULL DEFAULT '0' COMMENT 'Ò»ºÅת»»¿ª¹Ø¹ñKM2·ÖÕ¢Ö¸Áî'," + 
                "  km3_switchon_one int(11) NOT NULL DEFAULT '0' COMMENT 'Ò»ºÅת»»¿ª¹Ø¹ñKM3ºÏÕ¢Ö¸Áî'," + 
                "  km3_switchoff_one int(11) NOT NULL DEFAULT '0' COMMENT 'Ò»ºÅת»»¿ª¹Ø¹ñKM3·ÖÕ¢Ö¸Áî'," + 
                "  km4_switchon_one int(11) NOT NULL DEFAULT '0' COMMENT 'Ò»ºÅת»»¿ª¹Ø¹ñKM4ºÏÕ¢Ö¸Áî'," + 
                "  km4_switchoff_one int(11) NOT NULL DEFAULT '0' COMMENT 'Ò»ºÅת»»¿ª¹Ø¹ñKM4·ÖÕ¢Ö¸Áî'," + 
                "  km1_switchon_two int(11) NOT NULL DEFAULT '0' COMMENT '¶þºÅת»»¿ª¹Ø¹ñKM1ºÏÕ¢Ö¸Áî'," + 
                "  km1_switchoff_two int(11) NOT NULL DEFAULT '0' COMMENT '¶þºÅת»»¿ª¹Ø¹ñKM1·ÖÕ¢Ö¸Áî'," + 
                "  km2_switchon_two int(11) NOT NULL DEFAULT '0' COMMENT '¶þºÅת»»¿ª¹Ø¹ñKM2ºÏÕ¢Ö¸Áî'," + 
                "  km2_switchoff_two int(11) NOT NULL DEFAULT '0' COMMENT '¶þºÅת»»¿ª¹Ø¹ñKM2·ÖÕ¢Ö¸Áî'," + 
                "  km3_switchon_two int(11) NOT NULL DEFAULT '0' COMMENT '¶þºÅת»»¿ª¹Ø¹ñKM3ºÏÕ¢Ö¸Áî'," + 
                "  km3_switchoff_two int(11) NOT NULL DEFAULT '0' COMMENT '¶þºÅת»»¿ª¹Ø¹ñKM3·ÖÕ¢Ö¸Áî'," + 
                "  km4_switchon_two int(11) NOT NULL DEFAULT '0' COMMENT '¶þºÅת»»¿ª¹Ø¹ñKM4ºÏÕ¢Ö¸Áî'," + 
                "  km4_switchoff_two int(11) NOT NULL DEFAULT '0' COMMENT '¶þºÅת»»¿ª¹Ø¹ñKM4·ÖÕ¢Ö¸Áî'," + 
                "  note varchar(255) NOT NULL DEFAULT ''," + 
                "  PRIMARY KEY (num),"+ 
                "  UNIQUE KEY PLC_ip_key (PLC_ip) USING BTREE " + 
                ") ENGINE=InnoDB DEFAULT CHARSET=utf8;";
        Sql_Mysql sql = new Sql_Mysql(pool.getConn());
        try {
            sql.sqlMysqlExecute(sql_str);
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
    
    /**
     * ´´½¨µçԴ״̬±í
     * @param pool
     */
    public static void createTb_Electric_State(MysqlConnPool pool) {
        String sql_str = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Tb_Electric_State + " (" + 
                "  num bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'Ö÷¼ü'," + 
                "  electric_id int(11) NOT NULL DEFAULT '3001' COMMENT 'É豸id'," + 
                "  case_trip_output int(11) NOT NULL DEFAULT '0' COMMENT '»úÏäÌøÕ¢Êä³ö'," + 
                "  fault_reset_signal int(11) NOT NULL DEFAULT '0' COMMENT '¹ÊÕϸ´Î»ÐźÅ'," + 
                "  high_vol_switch_status int(11) NOT NULL DEFAULT '0' COMMENT '¸ßѹ¿ª¹Ø×´Ì¬'," + 
                "  stop_button int(11) NOT NULL DEFAULT '0' COMMENT '¼±Í£°´Å¥'," + 
                "  main_cabinet_fan_status int(11) NOT NULL DEFAULT '0' COMMENT 'Ö÷¹ñ·ç»ú״̬'," + 
                "  trans_cabinet_door_lock int(11) NOT NULL DEFAULT '0' COMMENT '±äѹÆ÷¹ñÃÅÁ¬Ëø'," + 
                "  trans_cabinet_overtem_alarm int(11) NOT NULL DEFAULT '0' COMMENT '±äѹÆ÷³¬Î±¨¾¯'," + 
                "  trans_cabinet_overtem_trip int(11) NOT NULL DEFAULT '0' COMMENT '±äѹÆ÷³¬ÎÂÌøÕ¢'," + 
                "  qs1_state int(11) NOT NULL DEFAULT '0' COMMENT 'QS1״̬'," + 
                "  qs2_state int(11) NOT NULL DEFAULT '0' COMMENT 'QS2״̬'," + 
                "  switch_cabinet_door_status int(11) NOT NULL DEFAULT '0' COMMENT 'ת»»¿ª¹Ø¹ñÃÅ״̬'," + 
                "  alldcvol float NOT NULL DEFAULT '0' COMMENT '×ÜÖ±Á÷µçѹ'," + 
                "  alldccurr float NOT NULL DEFAULT '0' COMMENT '×ÜÖ±Á÷µçÁ÷'," + 
                "  conn_flag int(11) NOT NULL DEFAULT '0' COMMENT '´®/²¢Áª×´Ì¬'," +
                "  note varchar(255) NOT NULL DEFAULT ''," + 
                "  PRIMARY KEY (num)," + 
                "  UNIQUE KEY electric_id_key (electric_id) USING BTREE" + 
                ") ENGINE=InnoDB DEFAULT CHARSET=utf8;";
        Sql_Mysql sql = new Sql_Mysql(pool.getConn());
        try {
            sql.sqlMysqlExecute(sql_str);
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
    
    /**
     * ´´½¨µçԴ״̬±í
     * @param pool
     */
    public static void createTb_Electric_Rt(MysqlConnPool pool) {
        String sql_str = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Tb_Electric_Rt + " (" + 
                "  num bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'Ö÷¼ü'," + 
                "  electric_id int(11) NOT NULL DEFAULT '3001' COMMENT 'É豸id'," + 
                "  upsetcurr float NOT NULL DEFAULT '0' COMMENT 'ÉÏλ»úÉ趨µçÁ÷'," + 
                "  upsetvol float NOT NULL DEFAULT '0' COMMENT 'ÉÏλ»úÉ趨µçѹ'," + 
                "  convolcontrol int(11) NOT NULL DEFAULT '0' COMMENT 'ºãѹ¿ØÖÆ'," + 
                "  concurrcontrol int(11) NOT NULL DEFAULT '0' COMMENT 'ºãÁ÷¿ØÖÆ'," + 
                "  othermodes int(11) NOT NULL DEFAULT '0' COMMENT 'ÆäËûģʽÔËÐÐ'," + 
                "  parallelmodes int(11) NOT NULL DEFAULT '0' COMMENT '²¢ÁªÎÈѹÔËÐÐ'," + 
                "  startposition int(11) NOT NULL DEFAULT '0' COMMENT 'Æô¶¯Î»'," + 
                "  stopposition int(11) NOT NULL DEFAULT '0' COMMENT 'ֹͣλ'," + 
                "  resetposition int(11) NOT NULL DEFAULT '0' COMMENT '¸´Î»'," + 
                "  fanstart int(11) NOT NULL DEFAULT '0' COMMENT '·ç»úÆô¶¯'," + 
                "  fanstop int(11) NOT NULL DEFAULT '0' COMMENT '·ç»úÍ£Ö¹'," + 
                "  dcvol float NOT NULL DEFAULT '0' COMMENT 'Ö±Á÷µçѹ '," + 
                "  dccurr float NOT NULL DEFAULT '0' COMMENT 'Ö±Á÷µçÁ÷'," + 
                "  controlangle int(11) NOT NULL DEFAULT '0' COMMENT '¿ØÖƽÇ'," + 
                "  loopflag int(11) NOT NULL DEFAULT '0' COMMENT '¿ª±Õ»·±ê־루0¿ª»·£¬1±Õ»·£©'," + 
                "  remoteflag int(11) NOT NULL DEFAULT '0' COMMENT '¾ÍµØÔ¶³Ì±ê־루0Ô¶³Ì£¬1¾ÍµØ£©'," + 
                "  orderflag int(11) NOT NULL DEFAULT '0' COMMENT 'ÕýÐòÄæÐò±ê־루0ÕýÐò£¬1ÄæÐò£©'," + 
                "  consvolcurrflag int(11) NOT NULL DEFAULT '0' COMMENT 'ºãѹºãÁ÷±ê־루0ºãѹ£¬1ºãÁ÷£©'," + 
                "  powerstartflag int(11) NOT NULL DEFAULT '0' COMMENT 'µçÔ´Æô¶¯±ê־루0Í£Ö¹£¬1Æô¶¯£© '," + 
                "  workmodelflag int(11) NOT NULL DEFAULT '0' COMMENT '¹¤×÷ģʽ±ê־루0ÆäËûģʽ£¬1²¢ÁªÎÈѹ£©'," + 
                
                "  switchon_1 int(11) NOT NULL DEFAULT '0' COMMENT '1ºÅ¿ª¹Ø¿ª'," + 
                "  switchoff_1 int(11) NOT NULL DEFAULT '0' COMMENT '1ºÅ¿ª¹Ø¹Ø'," + 
                "  switchon_2 int(11) NOT NULL DEFAULT '0' COMMENT '2ºÅ¿ª¹Ø¿ª '," + 
                "  switchoff_2 int(11) NOT NULL DEFAULT '0' COMMENT '2ºÅ¿ª¹Ø¹Ø'," + 
                
                "  note varchar(255) NOT NULL DEFAULT ''," + 
                "  PRIMARY KEY (num)," + 
                "  UNIQUE KEY electric_id_key (electric_id) USING BTREE " + 
                ") ENGINE=InnoDB DEFAULT CHARSET=utf8;";
        Sql_Mysql sql = new Sql_Mysql(pool.getConn());
        try {
            sql.sqlMysqlExecute(sql_str);
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
    
    
    /**
     * ´´½¨4Ì×µçԴ״̬±í
     * @param pool
     */
    public static void createTb_Electric_Power(MysqlConnPool pool) {
        String sql_str = " CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Tb_Electric_Power + " (" + 
                "  num bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'Ö÷¼ü'," + 
                "  PLC_ip varchar(255) NOT NULL DEFAULT '127.0.0.1' COMMENT 'PLC_ip', "+
                "  start_a int(11) NOT NULL DEFAULT '0' COMMENT 'AÌׯô¶¯'," + 
                "  stop_a int(11) NOT NULL DEFAULT '0' COMMENT 'AÌ×Í£Ö¹'," + 
                "  start_b int(11) NOT NULL DEFAULT '0' COMMENT 'BÌׯô¶¯'," + 
                "  stop_b int(11) NOT NULL DEFAULT '0' COMMENT 'BÌ×Í£Ö¹'," + 
                "  start_c int(11) NOT NULL DEFAULT '0' COMMENT 'CÌׯô¶¯'," + 
                "  stop_c int(11) NOT NULL DEFAULT '0' COMMENT 'CÌ×Í£Ö¹'," + 
                "  start_d int(11) NOT NULL DEFAULT '0' COMMENT 'DÌׯô¶¯'," + 
                "  stop_d int(11) NOT NULL DEFAULT '0' COMMENT 'DÌ×Í£Ö¹'," + 
                "  abconn_start int(11) NOT NULL DEFAULT '0' COMMENT 'AÌ×BÌײ¢ÁªÔËÐÐÆô¶¯'," + 
                "  abconn_stop int(11) NOT NULL DEFAULT '0' COMMENT 'AÌ×BÌײ¢ÁªÔËÐÐÍ£Ö¹'," + 
                "  cdconn_start int(11) NOT NULL DEFAULT '0' COMMENT 'CÌ×DÌײ¢ÁªÔËÐÐÆô¶¯'," + 
                "  cdconn_stop int(11) NOT NULL DEFAULT '0' COMMENT 'CÌ×DÌײ¢ÁªÔËÐÐÍ£Ö¹'," + 
                "  allconn_start int(11) NOT NULL DEFAULT '0' COMMENT 'ËÄÌײ¢ÁªÔËÐÐÆô¶¯'," + 
                "  allconn_stop int(11) NOT NULL DEFAULT '0' COMMENT 'ËÄÌײ¢ÁªÔËÐÐÍ£Ö¹'," + 
                "  abconn_flag int(11) NOT NULL DEFAULT '0' COMMENT 'AB²¢´®Áª±ê־λ'," + 
                "  cdconn_flag int(11) NOT NULL DEFAULT '0' COMMENT 'CD²¢´®Áª±ê־λ'," + 
                "  abconn_volset int(11) NOT NULL DEFAULT '0' COMMENT 'AB²¢Áªµçѹ¸ø¶¨'," + 
                "  abconn_currset int(11) NOT NULL DEFAULT '0' COMMENT 'AB²¢ÁªµçÁ÷¸ø¶¨'," + 
                "  cdconn_volset int(11) NOT NULL DEFAULT '0' COMMENT 'CD²¢Áªµçѹ¸ø¶¨'," + 
                "  cdconn_currset int(11) NOT NULL DEFAULT '0' COMMENT 'CD²¢ÁªµçÁ÷¸ø¶¨'," + 
                "  note varchar(255) NOT NULL DEFAULT ''," + 
                "  PRIMARY KEY (num)," + 
                "  UNIQUE KEY PLC_ip_key (PLC_ip) USING BTREE " + 
                ") ENGINE=InnoDB DEFAULT CHARSET=utf8;";
        Sql_Mysql sql = new Sql_Mysql(pool.getConn());
        try {
            sql.sqlMysqlExecute(sql_str);
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
    
    /**
     * ´´½¨µçÔ´µ¥µã¿ØÖÆ×´Ì¬±í
     * @param pool
     */
    public static void createTb_Electric_Control_Single(MysqlConnPool pool) {
        String sql_str = " CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Tb_Electric_Control_Single + " (" + 
                "  num bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'Ö÷¼ü'," + 
                "  electric_id int(11) NOT NULL DEFAULT '3001' COMMENT 'µçÔ´id'," + 
                "  upsetcurr float NOT NULL DEFAULT '0' COMMENT 'ÉÏλ»úÉ趨µçÁ÷'," + 
                "  upsetvol float NOT NULL DEFAULT '0' COMMENT 'ÉÏλ»úÉ趨µçѹ'," + 
                "  convolcontrol int(11) NOT NULL DEFAULT '0' COMMENT 'ºãѹ¿ØÖÆ'," + 
                "  concurrcontrol int(11) NOT NULL DEFAULT '0' COMMENT 'ºãÁ÷¿ØÖÆ'," + 
                "  othermodes int(11) NOT NULL DEFAULT '0' COMMENT 'ÆäËûģʽÔËÐÐ'," + 
                "  parallelmodes int(11) NOT NULL DEFAULT '0' COMMENT '²¢ÁªÎÈѹÔËÐÐ'," + 
                "  startposition int(11) NOT NULL DEFAULT '0' COMMENT 'Æô¶¯Î»'," + 
                "  stopposition int(11) NOT NULL DEFAULT '0' COMMENT 'ֹͣλ'," + 
                "  resetposition int(11) NOT NULL DEFAULT '0' COMMENT '¸´Î»'," + 
                "  fanstart int(11) NOT NULL DEFAULT '0' COMMENT '·ç»úÆô¶¯'," + 
                "  fanstop int(11) NOT NULL DEFAULT '0' COMMENT '·ç»úÍ£Ö¹'," + 
                "  dcvol float NOT NULL DEFAULT '0' COMMENT 'Ö±Á÷µçѹ'," + 
                "  dccurr float NOT NULL DEFAULT '0' COMMENT 'Ö±Á÷µçÁ÷'," + 
                "  controlangle float NOT NULL DEFAULT '0' COMMENT '¿ØÖƽÇ'," + 
                "  switchon int(11) NOT NULL DEFAULT '0' COMMENT '¿ª¹ØºÏÕ¢'," + 
                "  switchoff int(11) NOT NULL DEFAULT '0' COMMENT '¿ª¹Ø·ÖÕ¢'," + 
                "  PRIMARY KEY (num),"+
                "  UNIQUE KEY electric_id_key (electric_id) USING BTREE " + 
                ") ENGINE=InnoDB DEFAULT CHARSET=utf8;";
        Sql_Mysql sql = new Sql_Mysql(pool.getConn());
        try {
            sql.sqlMysqlExecute(sql_str);
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
    /**
     * ´´½¨×éºÏ¿ØÖÆ×´Ì¬±í
     * @param pool
     */
    public static void createTb_Electric_Control_Conn(MysqlConnPool pool) {
        String sql_str = " CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Tb_Electric_Control_Conn + " (" + 
                "  num bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'Ö÷¼ü'," + 
                "  electric_id int NOT NULL DEFAULT '4001' COMMENT '×éºÏ½çÃæÖ÷Òªid'," + 
                "  conn_name  VARCHAR(225) NOT NULL DEFAULT 'AB' COMMENT '×éºÏÃû³Æ'," + 
                "  convolcontrol int(11) NOT NULL DEFAULT '0' COMMENT 'ºãѹ¿ØÖÆ'," + 
                "  concurrcontrol int(11) NOT NULL DEFAULT '0' COMMENT 'ºãÁ÷¿ØÖÆ'," + 
                "  conn_flag int(11) NOT NULL DEFAULT '0' COMMENT '²¢ÁªÄ£Ê½'," + 
                "  divide_flag int(11) NOT NULL DEFAULT '0' COMMENT '´®ÁªÄ£Ê½'," + 
                "  volset int(11) NOT NULL DEFAULT '0' COMMENT 'µçѹ¸ø¶¨'," + 
                "  currset int(11) NOT NULL DEFAULT '0' COMMENT 'µçÁ÷¸ø¶¨'," + 
                "  givevol float NOT NULL DEFAULT '0' COMMENT '¸ø¶¨µçѹ'," + 
                "  givecurr float NOT NULL DEFAULT '0' COMMENT '¸ø¶¨µçÁ÷'," + 
                "  switchon1 int(11) NOT NULL DEFAULT '0' COMMENT 'Êä³öºÏÕ¢1'," + 
                "  switchon2 int(11) NOT NULL DEFAULT '0' COMMENT 'Êä³öºÏÕ¢2'," + 
                "  switchoff1 int(11) NOT NULL DEFAULT '0' COMMENT 'Êä³ö·ÖÕ¢1 '," + 
                "  switchoff2 int(11) NOT NULL DEFAULT '0' COMMENT 'Êä³ö·ÖÕ¢2'," + 
                "  conn_start int(11) NOT NULL DEFAULT '0' COMMENT '²¢ÁªÔËÐÐÆô¶¯'," + 
                "  conn_stop int(11) NOT NULL DEFAULT '0' COMMENT '²¢ÁªÔËÐÐÍ£Ö¹'," + 
                "  PRIMARY KEY (num),"+
                "  UNIQUE KEY electric_id_key (electric_id) USING BTREE " + 
                ") ENGINE=InnoDB DEFAULT CHARSET=utf8;";
        Sql_Mysql sql = new Sql_Mysql(pool.getConn());
        try {
            sql.sqlMysqlExecute(sql_str);
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
 
    /* ´´½¨µçÔ´¹ÊÕϱí
     * @param pool
     */
    public static void createTb_Electric_Alarm(MysqlConnPool pool) {
        String sql_str = " CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Tb_Electric_alarm+ " (" + 
                "  num bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'Ö÷¼ü'," + 
                "  electric_id int(11) NOT NULL DEFAULT '4001' COMMENT 'É豸id'," + 
                "  alarm_id int(11) NOT NULL DEFAULT '10001' COMMENT '¸æ¾¯id'," + 
                "  alarm_starttime datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '¸æ¾¯¿ªÊ¼Ê±¼ä'," + 
                "  alarm_endtime datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '¸æ¾¯½áÊøÊ±¼ä'," + 
                "  alarm_confirm int(11) NOT NULL DEFAULT '0' COMMENT '¸æ¾¯È·ÈÏ'," + 
                "  alarm_confirmtime datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '¸æ¾¯È·ÈÏʱ¼ä'," + 
                "  note varchar(255) NOT NULL DEFAULT ''," + 
                "  PRIMARY KEY (num),"+
                "  index  electric_id_key(electric_id) " + 
                ") ENGINE=InnoDB DEFAULT CHARSET=utf8;";
        Sql_Mysql sql = new Sql_Mysql(pool.getConn());
        try {
            sql.sqlMysqlExecute(sql_str);
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
    /* ´´½¨µçÔ´¹ÊÕÏÀúÊ·±í
     * @param pool
     */
    public static void createTb_Electric_Alarm_History(MysqlConnPool pool) {
        String sql_str = " CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Tb_Electric_alarm_history+ " (" + 
                "  num bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'Ö÷¼ü'," + 
                "  electric_id int(11) NOT NULL DEFAULT '4001' COMMENT 'É豸id'," + 
                "  alarm_id int(11) NOT NULL DEFAULT '10001' COMMENT '¸æ¾¯id'," + 
                "  alarm_starttime datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '¸æ¾¯¿ªÊ¼Ê±¼ä'," + 
                "  alarm_endtime datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '¸æ¾¯½áÊøÊ±¼ä'," + 
                "  alarm_confirm int(11) NOT NULL DEFAULT '0' COMMENT '¸æ¾¯È·ÈÏ'," + 
                "  alarm_confirmtime datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '¸æ¾¯È·ÈÏʱ¼ä'," + 
                "  note varchar(255) NOT NULL DEFAULT ''," + 
                "  PRIMARY KEY (num),"+
                "  index  electric_id_key(electric_id) " + 
                ") ENGINE=InnoDB DEFAULT CHARSET=utf8;";
        Sql_Mysql sql = new Sql_Mysql(pool.getConn());
        try {
            sql.sqlMysqlExecute(sql_str);
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
   //²åÈë»ò¸üеçÔ´µ¥µã¿ØÖƱí
    public static void replace_Electric_Control_Conn(MysqlConnPool pool,Electric_control_conn econn) {
        if(econn.electric_id==4001) {
            econn.conn_name="AB×éºÏ";
        }else {
            econn.conn_name="CD×éºÏ";
        }
        String sql_str = " replace into "+ Sql_Mysql.Tb_Electric_Control_Conn+"(electric_id,conn_name,convolcontrol,concurrcontrol,conn_flag,volset,currset,givevol,givecurr,switchon1,switchon2,switchoff1,switchoff2,conn_start,conn_stop)  "
                + "  values("+econn.electric_id+",'"+econn.conn_name+"',"+econn.convolcontrol+","+econn.concurrcontrol+","+econn.conn_flag+","+econn.volset+","+econn.currset+","+econn.givevol+","+econn.givecurr+","+econn.switchon1+","+econn.switchon2+","+econn.switchoff1+","+econn.switchoff2+","+econn.conn_start+","+econn.conn_stop+")";
        Sql_Mysql sql = new Sql_Mysql(pool.getConn());
        try {
            sql.sqlMysqlExecute(sql_str);
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
    //²åÈë»ò¸üеçԴʵʱÐÅÏ¢±í
    public static void replace_Electric_Rt(MysqlConnPool pool,Electric_Rt ert) {
        String sql_str = " replace into "+ Sql_Mysql.Tb_Electric_Rt  +"(electric_id,upsetcurr,upsetvol,convolcontrol,concurrcontrol,othermodes,parallelmodes,startposition,stopposition,resetposition,fanstart,fanstop,dcvol,dccurr,controlangle,loopflag,remoteflag,orderflag,consvolcurrflag,powerstartflag,workmodelflag,switchon_1,switchoff_1,switchon_2,switchoff_2)  "
                + "  values("+ert.electric_id+","+ert.upsetcurr+","+ert.upsetvol+","+ert.convolcontrol+","+ert.concurrcontrol+","+ert.othermodes+","+ert.parallelmodes+","+ert.startposition+","+ert.stopposition+","+ert.resetposition+","+ert.fanstart+","+ert.fanstop+","+ert.dcvol+","+ert.dccurr+","+ert.controlangle+","+ert.loopflag+","+ert.remoteflag+","+ert.orderflag+","+ert.consvolcurrflag+","+ert.powerstartflag+","+ert.workmodelflag+","+ert.switchon_1+","+ert.switchoff_1+","+ert.switchon_2+","+ert.switchoff_2+")";
        Sql_Mysql sql = new Sql_Mysql(pool.getConn());
        try {
            sql.sqlMysqlExecute(sql_str);
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    } 
    //²åÈë»ò¸üеçԴʵʱ״̬±í
    public static void replace_Electric_State(MysqlConnPool pool,Electric_State estate) {
        String sql_str = " replace into "+ Sql_Mysql.Tb_Electric_State  +"(electric_id,case_trip_output,fault_reset_signal,high_vol_switch_status,stop_button,main_cabinet_fan_status,trans_cabinet_door_lock,trans_cabinet_overtem_alarm,trans_cabinet_overtem_trip,qs1_state,qs2_state,switch_cabinet_door_status,alldcvol,alldccurr,conn_flag)  "
                + "  values("+estate.electric_id+","+estate.case_trip_output+","+estate.fault_reset_signal+","+estate.high_vol_switch_status+","+estate.stop_button+","+estate.main_cabinet_fan_status+","+estate.trans_cabinet_door_lock+","+estate.trans_cabinet_overtem_alarm+","+estate.trans_cabinet_overtem_trip+","+estate.qs1_state+","+estate.qs2_state+","+estate.switch_cabinet_door_status+","+estate.alldcvol+","+estate.alldccurr+","+estate.conn_flag+")";
        Sql_Mysql sql = new Sql_Mysql(pool.getConn());
        try {
            sql.sqlMysqlExecute(sql_str);
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    } 
    //²åÈë»ò¸üеçÔ´×Ü¿ª¹Ø×´Ì¬±í
    public static void replace_Electric_Switch(MysqlConnPool pool,Electric_Switch eswitch) {
        String sql_str = " replace into "+ Sql_Mysql.Tb_Electric_Switch  +"(PLC_ip,km1_switchon_one,km1_switchoff_one,km2_switchon_one,km2_switchoff_one,km3_switchon_one,km3_switchoff_one,km4_switchon_one,km4_switchoff_one,km1_switchon_two,km1_switchoff_two,km2_switchon_two,km2_switchoff_two,km3_switchon_two,km3_switchoff_two,km4_switchon_two,km4_switchoff_two)  "
                + "  values('"+eswitch.PLC_ip+"',"+eswitch.km1_switchon_one+","+eswitch.km1_switchoff_one+","+eswitch.km2_switchon_one+","+eswitch.km2_switchoff_one+","+eswitch.km3_switchon_one+","+eswitch.km3_switchoff_one+","+eswitch.km4_switchon_one+","+eswitch.km4_switchoff_one+","+eswitch.km1_switchon_two+","+eswitch.km1_switchoff_two+","+eswitch.km2_switchon_two+","+eswitch.km2_switchoff_two+","+eswitch.km3_switchon_two+","+eswitch.km3_switchoff_two+","+eswitch.km4_switchon_two+","+eswitch.km4_switchoff_two+")";
        Sql_Mysql sql = new Sql_Mysql(pool.getConn());
        try {
            sql.sqlMysqlExecute(sql_str);
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
    //²åÈë»ò¸üÐÂ4Ì×µçԴ״̬±í
    public static void replace_Electric_Power(MysqlConnPool pool,Electric_Power epower) {
        String sql_str = " replace into "+ Sql_Mysql.Tb_Electric_Power  +"(PLC_ip,start_a,stop_a,start_b,stop_b,start_c,stop_c,start_d,stop_d,abconn_start,abconn_stop,cdconn_start,cdconn_stop,allconn_start,allconn_stop,abconn_flag,cdconn_flag,abconn_volset,abconn_currset,cdconn_volset,cdconn_currset)  "
                + "  values('"+epower.PLC_ip+"',"+epower.start_a+","+epower.stop_a+","+epower.start_b+","+epower.stop_b+","+epower.start_c+","+epower.stop_c+","+epower.start_d+","+epower.stop_d+","+epower.abconn_start+","+epower.abconn_stop+","+epower.cdconn_start+","+epower.cdconn_stop
                +","+epower.allconn_start+","+epower.allconn_stop+","+epower.abconn_flag+","+epower.cdconn_flag+","+epower.abconn_volset+","+epower.abconn_currset+","+epower.cdconn_volset+","+epower.abconn_currset+")";
        Sql_Mysql sql = new Sql_Mysql(pool.getConn());
        try {
            sql.sqlMysqlExecute(sql_str);
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
    //²éѯµçÔ´µ¥µã¿ØÖƱíÖÐÊý¾Ý
    public static void queryElectric_Control_Single(MysqlConnPool conn_pool,Electric_Control_Single ecs) {
        String sql_str = " select * from " + Sql_Mysql.Tb_Electric_Control_Single+" Where electric_id = " +ecs.getElectric_id();
        ResultSet res = null;
        Sql_Mysql sql = new Sql_Mysql(conn_pool.getConn());
        try {            
            res = sql.sqlMysqlQuery(sql_str);
            if(res.next()) {    
                ecs.setElectric_id(res.getInt("electric_id"));
                ecs.setUpsetcurr(res.getFloat("upsetcurr"));
                ecs.setUpsetvol(res.getFloat("upsetvol"));
                ecs.setConvolcontrol(res.getInt("convolcontrol"));
                ecs.setConcurrcontrol(res.getInt("concurrcontrol"));
                //ecs.setOthermodes(res.getInt("othermodes"));
                //ecs.setParallelmodes(res.getInt("parallelmodes"));
                ecs.setStartposition(res.getInt("startposition"));
                ecs.setStopposition(res.getInt("stopposition"));
                ecs.setResetposition(res.getInt("resetposition"));
                //ecs.setFanstart(res.getInt("fanstart"));
                //ecs.setFanstop(res.getInt("fanstop"));
                ecs.setDcvol(res.getFloat("dcvol"));
                ecs.setDccurr(res.getFloat("dccurr"));
                ecs.setControlangle(res.getFloat("controlangle"));
                //System.out.println(ecs.toString());
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if(res != null) {
                try {
                    res.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
            sql.close_con();
        }
    }
    //²éѯµçÔ´×éºÏ¿ØÖƱíÖÐÊý¾Ý
    public static void queryElectric_Control_Conn(MysqlConnPool conn_pool,Electric_control_conn econn) {
        String sql_str = " select * from " + Sql_Mysql.Tb_Electric_Control_Conn+" Where electric_id = " +econn.getElectric_id();
        ResultSet res = null;
        Sql_Mysql sql = new Sql_Mysql(conn_pool.getConn());
        try {            
            res = sql.sqlMysqlQuery(sql_str);
            if(res.next()) {    
                econn.setElectric_id(res.getInt("electric_id"));
                econn.setConn_name(res.getString("conn_name"));
                econn.setConvolcontrol(res.getInt("convolcontrol"));
                econn.setConcurrcontrol(res.getInt("concurrcontrol"));
                econn.setConn_flag(res.getInt("conn_flag"));
                econn.setVolset(res.getInt("volset"));
                econn.setCurrset(res.getInt("currset"));
                econn.setGivecurr(res.getFloat("givecurr"));
                econn.setGivevol(res.getFloat("givevol"));
                econn.setSwitchon1(res.getInt("switchon1"));
                econn.setSwitchon2(res.getInt("switchon2"));
                econn.setSwitchoff1(res.getInt("switchoff1"));
                econn.setSwitchoff2(res.getInt("switchoff2"));
                econn.setConn_start(res.getInt("conn_start"));
                econn.setConn_stop(res.getInt("conn_stop"));
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if(res != null) {
                try {
                    res.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
            sql.close_con();
        }
    }
    /**
     * ²åÈë»ò¸üеçÔ´¹ÊÕÏ
     * @param conn_pool
     * @param control
     */
    public static void insertOrUpdateElectrical_alarmTable(MysqlConnPool conn_pool,List<Electric_alarm> list) {
        if(list!=null&&list.size()>0) {
            for (Electric_alarm ealarm : list) {
                String sql_str_sel = " select * from " + Sql_Mysql.Tb_Electric_alarm + " where electric_id = " + ealarm.getElectric_id()+" and alarm_id="+ealarm.getAlarm_id();
                String sql_str_ins = " INSERT INTO " + Sql_Mysql.Tb_Electric_alarm + "(electric_id,alarm_id,alarm_starttime,alarm_endtime,alarm_confirm,alarm_confirmtime) "
                                    +" VALUES("+ealarm.electric_id+","+ealarm.alarm_id+",'"+ealarm.alarm_starttime+"','"+ealarm.getAlarm_endtime()+"',"+ealarm.alarm_confirm+",'"+ealarm.alarm_confirmtime+"');";
                String sql_str_update= " update " + Sql_Mysql.Tb_Electric_alarm + 
                                       " set alarm_starttime="+ealarm.alarm_starttime+
                                       ",alarm_endtime="+ealarm.getAlarm_endtime()+
                                       ",alarm_confirm="+ealarm.alarm_confirm+
                                       ",alarm_confirmtime"+ealarm.getAlarm_confirmtime()+
                                       "  where electric_id="+ealarm.electric_id+
                                       "  and alarm_id="+ealarm.alarm_id;
    
                ResultSet res = null;
                Sql_Mysql sql = new Sql_Mysql(conn_pool.getConn());
                try {
                    res = sql.sqlMysqlQuery(sql_str_sel);
                    if(res.next()) {
                        //¸üе±Ç°¿ØÖÆ×´Ì¬
                        sql.sqlMysqlExecute(sql_str_update);
                    }else {
                        sql.sqlMysqlExecute(sql_str_ins);
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                } finally {
                    if(res != null) {
                        try {
                            res.close();
                        } catch (SQLException e) {
                            e.printStackTrace();
                        }
                    }
                    sql.close_con();
                }
            }
            
        }
        
    }
    //²åÈë»ò¸üеçÔ´µ¥µã¿ØÖƱí
    public static void replace_Electric_Control_Single(MysqlConnPool pool,Electric_Control_Single ecs) {
        String sql_str = " replace into "+ Sql_Mysql.Tb_Electric_Control_Single +"(electric_id,upsetcurr,upsetvol,convolcontrol,concurrcontrol,othermodes,parallelmodes,startposition,stopposition,resetposition,fanstart,fanstop,dcvol,dccurr,controlangle)  "
                + "  values("+ecs.electric_id+","+ecs.upsetcurr+","+ecs.upsetvol+","+ecs.convolcontrol+","+ecs.concurrcontrol+","+ecs.othermodes+","+ecs.parallelmodes+","+ecs.startposition+","+ecs.stopposition+","+ecs.resetposition+","+ecs.fanstart+","+ecs.fanstop+","+ecs.dcvol+","+ecs.dccurr+","+ecs.controlangle+")";
        Sql_Mysql sql = new Sql_Mysql(pool.getConn());
        try {
            sql.sqlMysqlExecute(sql_str);
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
    
    /**
     *     ´´½¨ÀúʷʵʱÊý¾Ý±í
     * @param pool
     * @param electric_id
     */
    public static void createTb_Electric_Readhist_DataTable(MysqlConnPool pool,int electric_id) {
        String sql_str = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Tb_Electric_Readhist_Data + electric_id + " (" + 
                "  num bigint(20) NOT NULL AUTO_INCREMENT," + 
                "  electric_id int(11) NOT NULL DEFAULT '0' COMMENT 'µçÔ´id'," + 
                "  record_time datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '¼Ç¼ʱ¼ä'," + 
                "  dcvol float NOT NULL DEFAULT '0' COMMENT 'Ö±Á÷µçѹ'," + 
                "  dccurr float NOT NULL DEFAULT '0' COMMENT 'Ö±Á÷µçÁ÷'," + 
                "  controlangle int(11) NOT NULL DEFAULT '0' COMMENT '¿ØÖƽÇ'," + 
                "  note varchar(255) NOT NULL DEFAULT '' COMMENT '±¸ÓÃ'," + 
                "  PRIMARY KEY (num)" + 
                ") ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;";
        Sql_Mysql sql = new Sql_Mysql(pool.getConn());
        try {
            sql.sqlMysqlExecute(sql_str);
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
    
    /**
     *     ¶ÁÈ¡µ±Ç°É豸µÄ״̬ÐÅÏ¢
     */
    public static void queryElectric_RtById(Electric_Rt rt,MysqlConnPool pool) {
        String sql_str = " SELECT * FROM db_electricsystem.tb_electric_rt WHERE electric_id = " + rt.electric_id;
        Sql_Mysql sql = new Sql_Mysql(pool.getConn());
        ResultSet res = null;
        try {
            res = sql.sqlMysqlQuery(sql_str);
            while(res.next()) {
                rt.upsetcurr = res.getFloat("upsetcurr");                //ÉÏλ»úÉ趨µçÁ÷
                rt.upsetvol = res.getFloat("upsetvol");                    //ÉÏλ»úÉ趨µçѹ
                rt.convolcontrol = res.getInt("convolcontrol");            //ºãѹ¿ØÖÆ    
                rt.concurrcontrol = res.getInt("concurrcontrol");        //ºãÁ÷¿ØÖÆ
                rt.othermodes = res.getInt("othermodes");                //ÆäËûģʽÔËÐÐ
                rt.parallelmodes = res.getInt("parallelmodes");            //²¢ÁªÎÈѹÔËÐÐ
                rt.startposition = res.getInt("startposition");            //Æô¶¯Î»
                rt.stopposition = res.getInt("stopposition");            //ֹͣλ
                rt.resetposition = res.getInt("resetposition");            //¸´Î»
                rt.fanstart = res.getInt("fanstart");                    //·ç»úÆô¶¯
                rt.fanstop = res.getInt("fanstop");                        //·ç»úÍ£Ö¹
                rt.dcvol = res.getFloat("dcvol");                        //Ö±Á÷µçѹ
                rt.dccurr = res.getFloat("dccurr");                        //Ö±Á÷µçÁ÷
                rt.controlangle = res.getInt("controlangle");            //¿ØÖƽÇ
                rt.loopflag = res.getInt("loopflag");                    //¿ª±Õ»·±ê־λ¡¾0¿ª»·£»1±Õ»·¡¿
                rt.remoteflag = res.getInt("remoteflag");                //¾ÍµØÔ¶³Ì±ê־λ¡¾0Ô¶³Ì£»1¾ÍµØ¡¿
                rt.orderflag = res.getInt("orderflag");                    //ÕýÐòÄæÐò±ê־λ¡¾0ÕýÐò£»1ÄæÐò¡¿
                rt.consvolcurrflag = res.getInt("consvolcurrflag");        //ºãѹºáÁ÷±ê־λ¡¾0ºãѹ£»1ºãÁ÷¡¿
                rt.powerstartflag = res.getInt("powerstartflag");            //µçÔ´Æô¶¯±ê־λ¡¾0Í£Ö¹£»1Æô¶¯¡¿
                rt.workmodelflag = res.getInt("workmodelflag");            //¹¤×÷ģʽ±ê־λ¡¾0ÆäËûģʽ£»1²¢ÁªÎÈѹ¡¿
                rt.switchon_1 = res.getInt("switchon_1");                //¿ª¹Ø1
                rt.switchoff_1 = res.getInt("switchoff_1");                //¿ª¹Ø1
                rt.switchon_2 = res.getInt("switchon_2");                //¿ª¹Ø2
                rt.switchoff_2 = res.getInt("switchoff_2");                //¿ª¹Ø2
            }
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            if(res != null) {
                try {
                    res.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
                sql.close_con();
            }
        }
    }
    
    /**
     *     ¼Ç¼ÀúʷʵʱÊý¾Ý
     * @param pool
     * @param rt
     */
    public static void recordHistoryData(MysqlConnPool pool, Electric_Rt rt) {
        String sql_str = " INSERT INTO " + Sql_Mysql.Tb_Electric_Readhist_Data + rt.electric_id + "(electric_id,record_time,dcvol,dccurr,controlangle) VALUES("+rt.electric_id+",'"+Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms)+"',"+rt.dcvol+","+rt.dccurr+","+rt.controlangle+");";
        Sql_Mysql sql = new Sql_Mysql(pool.getConn());
        try {
            sql.sqlMysqlExecute(sql_str);
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
}