Administrator
2022-02-28 64659e3795b4f7cbafb2eaca8fd3831485035d71
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
package com.battdata_rt;
 
import com.base.Com;
import com.sql.MysqlConnPool;
import com.sql.Sql_Mysql;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;
 
public class BattData_RT_SQL {
    public static void createBattData_RT_RamDB_Table(MysqlConnPool conn_pool, int bg_id, int batt_cnt) {
        String tb_name = "`db_ram_batt_rt`.`tb_batt_rtdata_" + bg_id + "`";
        String sql_str0 = "DELETE FROM " + tb_name + " WHERE " + tb_name + ".num>0";
        String sql_str1 = "CREATE TABLE IF NOT EXISTS " + tb_name + " " + "( `num` BIGINT NOT NULL AUTO_INCREMENT, "
                + "`BattGroupId` INT NOT NULL DEFAULT 0, "
                + "`rec_datetime` DATETIME NOT NULL DEFAULT '1982-01-01 00:00:00', "
                + "`mon_num` INT NOT NULL DEFAULT 0, " + "`mon_vol` FLOAT NOT NULL DEFAULT 0, "
                + "`mon_tmp` FLOAT NOT NULL DEFAULT 0, " + "`mon_res` FLOAT NOT NULL DEFAULT 0, "
                + "`mon_ser` FLOAT NOT NULL DEFAULT 0, " + "`mon_conn_res` FLOAT NOT NULL DEFAULT 0, "
                + "`mon_cap` FLOAT NOT NULL DEFAULT 0, " + "`batt_count` INT NOT NULL DEFAULT 0, "
                + "`online_vol` FLOAT NOT NULL DEFAULT 0, " + "`group_vol` FLOAT NOT NULL DEFAULT 0, "
                + "`group_tmp` FLOAT NOT NULL DEFAULT 0, " + "`group_curr` FLOAT NOT NULL DEFAULT 0, "
                + "`batt_state` INT NOT NULL DEFAULT 0, " + "`batt_test_type` INT NOT NULL DEFAULT 0, "
                + "`batt_test_starttime` DATETIME NOT NULL DEFAULT '1982-01-01 00:00:00', "
                + "`batt_test_recordtime` DATETIME NOT NULL DEFAULT '1982-01-01 00:00:00', "
                + "`batt_test_tlong` INT NOT NULL DEFAULT 0, " + "`batt_test_cap` FLOAT NOT NULL DEFAULT 0, "
                + "`batt_real_cap` FLOAT NOT NULL DEFAULT 0, " + "`batt_rest_cap` FLOAT NOT NULL DEFAULT 0, "
                + "`batt_rest_power1_time` INT NOT NULL DEFAULT 0, "
                + "`batt_rest_power2_time` INT NOT NULL DEFAULT 0, " + "INDEX index_BattGroupId (`BattGroupId`), "
                + "PRIMARY KEY (`num`)) " + "ENGINE=MEMORY DEFAULT CHARSET=utf8;";
 
        String sql_str2 = "INSERT INTO " + tb_name + " " + "(BattGroupId," + "mon_num)" + " VALUES ";
        int cnt = 0;
        for (int mc = 0; mc < batt_cnt; mc++) {
            if (cnt > 0) {
                sql_str2 = sql_str2 + ",";
            }
            sql_str2 = sql_str2 + "(" + bg_id + "," + (mc + 1) + ")";
            cnt++;
        }
 
        Sql_Mysql sql = new Sql_Mysql(conn_pool.getConn());
        try {
            sql.sqlMysqlExecute(sql_str1);
            ResultSet res_t = sql.sqlMysqlQuery("SELECT COUNT(*) FROM " + tb_name);
            if (res_t.next()) {
                int cnt_row = res_t.getInt(1);
                if (cnt_row != batt_cnt) {
                    sql.sqlMysqlExecute(sql_str0);
                    sql.sqlMysqlExecute(sql_str2);
                }
            } else {
                sql.sqlMysqlExecute(sql_str2);
            }
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
 
    public static void updateBattState_RT_RamDB_Table(MysqlConnPool conn_pool, BattData_RT bd_rt) {
        Sql_Mysql sql = new Sql_Mysql(conn_pool.getConn());
        try {
            Date dt_test_Start = new Date();
            Date dt_record = new Date();
            dt_test_Start.setTime(bd_rt.getTestStartTime());
            dt_record.setTime(bd_rt.getTestRecordTime());
            String sql_str = "UPDATE `db_ram_db`.`tb_batt_rtstate` SET  rec_datetime='"
                    + Com.getDateTimeFormat(new Date(), "yyyy-MM-dd HH:mm:ss") + "'," + " batt_count=" + bd_rt.MonCount
                    + "," + " online_vol=" + bd_rt.getOnlineVol() + "," + " group_vol=" + bd_rt.getGroupVol() + ","
                    + " group_tmp=" + bd_rt.getGroupTmp() + "," + " group_curr=" + bd_rt.getTestCurr() + ","
                    + " batt_state=" + bd_rt.getBattState() + "," + " batt_test_type=" + bd_rt.getBattTestType() + ","
                    + " batt_test_starttime='" + Com.getDateTimeFormat(dt_test_Start, "yyyy-MM-dd HH:mm:ss") + "',"
                    + " batt_test_recordtime='" + Com.getDateTimeFormat(dt_record, "yyyy-MM-dd HH:mm:ss") + "',"
                    + " batt_test_tlong=" + bd_rt.getTestTimeLong() + "," + " batt_test_cap=" + bd_rt.getTestCap() + ","
                    + " batt_real_cap=" + bd_rt.getBattRealCap() + "," + " batt_rest_cap=" + bd_rt.getBattRestCap()
                    + "," + " batt_rest_power1_time=" + bd_rt.getBattRestTime() + " WHERE BattGroupId="
                    + bd_rt.BattGroupId;
            sql.sqlMysqlExecute(sql_str);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
 
    public static void updateBattData_RT_RamDB_Table(MysqlConnPool conn_pool, BattData_RT bd_rt) {
        Sql_Mysql sql = new Sql_Mysql(conn_pool.getConn());
        try {
            String sql_str = "UPDATE `db_ram_db`.`tb_batt_rtdata` SET  rec_datetime='"
                    + Com.getDateTimeFormat(new Date(), "yyyy-MM-dd HH:mm:ss") + "'";
 
            float tmp_dt = 0.0F;
            String sql_str_vol = " ";
            for (int n = 0; n < bd_rt.MonCount; n++) {
                tmp_dt = ((MonVolData) bd_rt.al_MonVol.get(n)).monVol;
                if (((MonVolData) bd_rt.al_MonVol_RtOld.get(n)).monVol != tmp_dt) {
                    ((MonVolData) bd_rt.al_MonVol_RtOld.get(n)).monVol = tmp_dt;
                    sql_str_vol = sql_str_vol + " WHEN " + (n + 1) + " THEN "
                            + String.format("%1.3f", new Object[] { Float.valueOf(tmp_dt) });
                }
            }
            if (sql_str_vol.trim().length() > 1) {
                sql_str_vol = ", mon_vol = CASE mon_num " + sql_str_vol + " ELSE mon_vol END ";
            }
            String sql_str_tmp = " ";
            for (int n = 0; n < bd_rt.MonCount; n++) {
                tmp_dt = ((MonVolData) bd_rt.al_MonVol.get(n)).monTmp;
                if (((MonVolData) bd_rt.al_MonVol_RtOld.get(n)).monTmp != tmp_dt) {
                    ((MonVolData) bd_rt.al_MonVol_RtOld.get(n)).monTmp = tmp_dt;
                    sql_str_tmp = sql_str_tmp + " WHEN " + (n + 1) + " THEN "
                            + String.format("%1.3f", new Object[] { Float.valueOf(tmp_dt) });
                }
            }
            if (sql_str_tmp.trim().length() > 1) {
                sql_str_tmp = ", mon_tmp = CASE mon_num " + sql_str_tmp + " ELSE mon_tmp END ";
            }
 
            String sql_str_res = " ";
            for (int n = 0; n < bd_rt.MonCount; n++) {
                tmp_dt = ((MonVolData) bd_rt.al_MonVol.get(n)).monRes;
                if (((MonVolData) bd_rt.al_MonVol_RtOld.get(n)).monRes != tmp_dt) {
                    ((MonVolData) bd_rt.al_MonVol_RtOld.get(n)).monRes = tmp_dt;
                    sql_str_res = sql_str_res + " WHEN " + (n + 1) + " THEN "
                            + String.format("%1.3f", new Object[] { Float.valueOf(tmp_dt) });
                }
            }
            if (sql_str_res.trim().length() > 1) {
                sql_str_res = ", mon_res = CASE mon_num " + sql_str_res + " ELSE mon_res END ";
            }
 
            String sql_str_cap = " ";
            for (int n = 0; n < bd_rt.MonCount; n++) {
                tmp_dt = ((MonVolData) bd_rt.al_MonVol.get(n)).monCap;
                if (((MonVolData) bd_rt.al_MonVol_RtOld.get(n)).monCap != tmp_dt) {
                    ((MonVolData) bd_rt.al_MonVol_RtOld.get(n)).monCap = tmp_dt;
                    sql_str_cap = sql_str_cap + " WHEN " + (n + 1) + " THEN "
                            + String.format("%3.3f", new Object[] { Float.valueOf(tmp_dt) });
                }
            }
            if (sql_str_cap.trim().length() > 1) {
                sql_str_cap = ", mon_cap = CASE mon_num " + sql_str_cap + " ELSE mon_cap END ";
            }
 
            String sql_str_2 = sql_str_vol + sql_str_tmp + sql_str_res + sql_str_cap;
            if (sql_str_2.trim().length() > 1) {
                sql_str_2 = sql_str_2 + " WHERE BattGroupId=" + bd_rt.BattGroupId;
            } else {
                sql_str_2 = " WHERE BattGroupId=" + bd_rt.BattGroupId;
            }
 
            sql_str = sql_str + sql_str_2;
 
            sql.sqlMysqlExecute(sql_str);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
 
    public static void updateVersion_Infor_Table(MysqlConnPool conn_pool) {
        Sql_Mysql sql = new Sql_Mysql(conn_pool.getConn());
        try {
            String BMS = "BMS_FBS9600_DISPLAY";
            String VER = "v1.101";
            String sql_str = "UPDATE web_site.tb_process_survey SET  ProcessTime='"
                    + Com.getDateTimeFormat(new Date(), "yyyy-MM-dd HH:mm:ss") + "'," + " Process_starttime='"
                    + Com.getDateTimeFormat(new Date(), "yyyy-MM-dd HH:mm:ss") + "'," + "ProcessVersion='" + VER + "'"
                    + " WHERE ProcessName='" + BMS + "' AND ServerName='" + BMS + "'";
 
            sql.sqlMysqlExecute(sql_str);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
 
    public static void updateThread_Time_Table(MysqlConnPool conn_pool) {
        String BMS = "BMS_FBS9600_DISPLAY";
        Sql_Mysql sql = new Sql_Mysql(conn_pool.getConn());
        try {
            String sql_str = "UPDATE web_site.tb_process_survey SET  ProcessTime='"
                    + Com.getDateTimeFormat(new Date(), "yyyy-MM-dd HH:mm:ss") + "'" + "WHERE ProcessName='" + BMS
                    + "'AND ServerName='" + BMS + "'";
            sql.sqlMysqlExecute(sql_str);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
 
    public static String getCreateBattTestDataStr(String tb_name) {
        String sql_str = "CREATE TABLE IF NOT EXISTS " + tb_name + " " + "( `num` BIGINT NOT NULL AUTO_INCREMENT, "
                + "`BattGroupId` INT NOT NULL DEFAULT 0, " + "`test_record_count` INT NOT NULL DEFAULT 0, "
                + "`test_type` INT NOT NULL DEFAULT 0, " + "`data_new` BOOLEAN NOT NULL DEFAULT false, "
                + "`data_available` BOOLEAN NOT NULL DEFAULT false, " + "`record_num` INT NOT NULL DEFAULT 0, "
                + "`test_starttime` DATETIME NOT NULL DEFAULT '1982-01-01 00:00:00', "
                + "`record_time` DATETIME NOT NULL DEFAULT '1982-01-01 00:00:00', "
                + "`test_timelong` INT NOT NULL DEFAULT 0, " + "`online_vol` FLOAT NOT NULL DEFAULT 0, "
                + "`group_vol` FLOAT NOT NULL DEFAULT 0, " + "`test_curr` FLOAT NOT NULL DEFAULT 0, "
                + "`test_cap` FLOAT NOT NULL DEFAULT 0, " + "`mon_num` INT NOT NULL DEFAULT 0, "
                + "`mon_vol` FLOAT NOT NULL DEFAULT 0, " + "`mon_tmp` FLOAT NOT NULL DEFAULT 0, "
                + "INDEX index_test_record_count (`test_record_count`), " + "PRIMARY KEY (`num`));";
        return sql_str;
    }
 
    public static String getInsertBattTestDataStr(BattData_RT rt_data) {
        int mon_count = rt_data.MonCount;
        BattStatData tmp_test_data = rt_data.mTestData.clone();
        String sql_str = "INSERT INTO tb_BattTestData_" + rt_data.BattGroupId + " " + "(BattGroupId, "
                + "test_record_count, " + "test_type, " + "data_new, " + "data_available, " + "record_num, "
                + "test_starttime, " + "record_time, " + "test_timelong, " + "online_vol, " + "group_vol, "
                + "test_curr, " + "test_cap, " + "mon_num, " + "mon_vol, " + "mon_tmp)" + " VALUES ";
 
        String sql_str_data = "";
        for (int n = 0; n < mon_count; n++) {
            if ((n <= 0) || (rt_data.is_al_MonVol_History_New(n)) || (tmp_test_data.recordNum <= 2)) {
                if (n > 0) {
                    sql_str_data = sql_str_data + ", ";
                }
                sql_str_data = sql_str_data + "(" + rt_data.BattGroupId + ", " + tmp_test_data.testRecordCount + ", "
                        + tmp_test_data.battTestType_For_DataSave + ", " + true + ", " + true + ", "
                        + (tmp_test_data.recordNum + 1) + ", " + "'"
                        + Com.getDateTimeFormat(tmp_test_data.startTestTime, "yyyy-MM-dd HH:mm:ss") + "', " + "'"
                        + Com.getDateTimeFormat(tmp_test_data.recordTime, "yyyy-MM-dd HH:mm:ss") + "', "
                        + tmp_test_data.testTimeLong + ", " + tmp_test_data.onlineVol + ", " + tmp_test_data.groupVol
                        + ", " + tmp_test_data.testCurr + ", " + tmp_test_data.testCap + ", " + (n + 1) + ", "
                        + rt_data.get_al_MonVol_History(n) + ", " + ((MonVolData) rt_data.al_MonVol.get(n)).monTmp
                        + ")";
            }
 
        }
 
        return sql_str + sql_str_data;
    }
 
    public static ArrayList<String> getInsertOrUpdateBattTestDataStopStr(BattData_RT rt_data) {
        ArrayList al_sql_str = new ArrayList();
        int mon_count = rt_data.MonCount;
        BattStatData tmp_test_data = rt_data.mTestData.clone();
        ArrayList tmp_mon_vol = rt_data.al_MonVol_History;
 
        rt_data.makeMaxMinMonVol(tmp_mon_vol);
        if (!rt_data.MysqlDataResInfTable_Exist) {
            String sql_str = "INSERT INTO tb_BattTestDataStop_" + rt_data.BattGroupId + " (BattGroupId, "
                    + "test_record_count, " + "test_type, " + "data_new, " + "data_available, " + "record_num, "
                    + "test_starttime, " + "record_time, " + "test_timelong, " + "group_vol, " + "test_curr, "
                    + "test_cap, " + "mon_num, " + "mon_vol)" + " VALUES ";
            for (int n = 0; n < mon_count; n++) {
                if (n > 0) {
                    sql_str = sql_str + ", ";
                }
                sql_str = sql_str + "(" + rt_data.BattGroupId + ", " + tmp_test_data.testRecordCount + ", "
                        + tmp_test_data.battTestType_For_DataSave + ", " + true + ", " + true + ", "
                        + (tmp_test_data.recordNum + 1) + ", " + "'"
                        + Com.getDateTimeFormat(tmp_test_data.startTestTime, "yyyy-MM-dd HH:mm:ss") + "', " + "'"
                        + Com.getDateTimeFormat(tmp_test_data.recordTime, "yyyy-MM-dd HH:mm:ss") + "', "
                        + tmp_test_data.testTimeLong + ", " + tmp_test_data.groupVol + ", " + tmp_test_data.testCurr
                        + ", " + tmp_test_data.testCap + ", " + (n + 1) + ", "
                        + ((MonVolData) tmp_mon_vol.get(n)).monVol + ")";
            }
            al_sql_str.add(sql_str);
        } else {
            String sql_str = "UPDATE tb_BattTestDataStop_" + rt_data.BattGroupId + " SET " + " data_new=" + true + ", "
                    + "data_available=" + true + ", " + "record_num=" + (tmp_test_data.recordNum + 1) + ", "
                    + "record_time='" + Com.getDateTimeFormat(tmp_test_data.recordTime, "yyyy-MM-dd HH:mm:ss") + "', "
                    + "test_timelong=" + tmp_test_data.testTimeLong + ", " + "group_vol=" + tmp_test_data.groupVol
                    + ", " + "test_curr=" + tmp_test_data.testCurrAbsMax + ", " + "test_cap=" + tmp_test_data.testCap
                    + " " + " WHERE " + " BattGroupId=" + rt_data.BattGroupId + " AND " + " test_record_count="
                    + tmp_test_data.testRecordCount;
            al_sql_str.add(sql_str);
 
            String temp_str = "";
            sql_str = "UPDATE tb_BattTestDataStop_" + rt_data.BattGroupId + " SET " + " mon_vol = CASE mon_num";
            for (int n = 0; n < mon_count; n++) {
                if ((n <= 0) || (rt_data.is_al_MonVol_History_New(n)) || (tmp_test_data.recordNum <= 2)) {
                    if (n > 0) {
                        temp_str = temp_str + ",";
                    }
                    temp_str = temp_str + (n + 1);
 
                    sql_str = sql_str + " WHEN " + (n + 1) + " THEN " + rt_data.get_al_MonVol_History(n);
                }
            }
            sql_str = sql_str + " END WHERE mon_num IN (" + temp_str + ")" + " AND BattGroupId=" + rt_data.BattGroupId
                    + " AND " + " test_record_count=" + tmp_test_data.testRecordCount;
 
            al_sql_str.add(sql_str);
        }
 
        return al_sql_str;
    }
 
    public static String getInsertOrUpdateBattTestDataInfStr(BattData_RT rt_data, int test_stoptype_t) {
        String sql_str = " ";
        BattStatData tmp_test_data = rt_data.mTestData.clone();
        tmp_test_data.test_stoptype = test_stoptype_t;
 
        if (!rt_data.MysqlRecordInf_Exist) {
            sql_str = "INSERT INTO `db_batt_testdata`.`tb_batttestdata_inf` (BattGroupId, test_record_count, test_type, record_time_interval, data_new, data_available, record_num, test_starttime, test_starttype, record_time, test_timelong, test_stoptype, group_vol, test_curr, test_cap, max_monnum, max_monvol, min_monnum, min_monvol)  VALUES ("
                    + rt_data.BattGroupId + ", " + tmp_test_data.testRecordCount + ", "
                    + tmp_test_data.battTestType_For_DataSave + ", " + rt_data.mSaveDataTimeInterval + ", " + true
                    + ", " + true + ", " + (tmp_test_data.recordNum + 1) + ", " + "'"
                    + Com.getDateTimeFormat(tmp_test_data.startTestTime, "yyyy-MM-dd HH:mm:ss") + "', "
                    + tmp_test_data.testLoaderType + ", " + "'"
                    + Com.getDateTimeFormat(tmp_test_data.recordTime, "yyyy-MM-dd HH:mm:ss") + "', "
                    + tmp_test_data.testTimeLong + ", " + tmp_test_data.test_stoptype + ", " + tmp_test_data.groupVol
                    + ", " + tmp_test_data.testCurr + ", " + tmp_test_data.testCap + ", " + rt_data.mMaxMonNum + ", "
                    + rt_data.mMaxMonVol + ", " + rt_data.mMinMonNum + ", " + rt_data.mMinMonVol + ") ";
        } else {
            sql_str = "UPDATE `db_batt_testdata`.`tb_batttestdata_inf` SET test_type="
                    + tmp_test_data.battTestType_For_DataSave + ", " + "record_time_interval="
                    + rt_data.mSaveDataTimeInterval + ", " + "data_new=" + true + ", " + "data_available=" + true + ", "
                    + "record_num=" + (tmp_test_data.recordNum + 1) + ", " + "test_starttime='"
                    + Com.getDateTimeFormat(tmp_test_data.startTestTime, "yyyy-MM-dd HH:mm:ss") + "', "
                    + "test_starttype=" + tmp_test_data.testLoaderType + ", " + "record_time='"
                    + Com.getDateTimeFormat(tmp_test_data.recordTime, "yyyy-MM-dd HH:mm:ss") + "', " + "test_timelong="
                    + tmp_test_data.testTimeLong + ", " + "test_stoptype=" + tmp_test_data.test_stoptype + ", "
                    + "group_vol=" + tmp_test_data.groupVol + ", " + "test_curr=" + tmp_test_data.testCurrAbsMax + ", "
                    + "test_cap=" + tmp_test_data.testCap + ", " + "max_monnum=" + rt_data.mMaxMonNum + ", "
                    + "max_monvol=" + rt_data.mMaxMonVol + ", " + "min_monnum=" + rt_data.mMinMonNum + ", "
                    + "min_monvol=" + rt_data.mMinMonVol + " " + " WHERE " + " BattGroupId=" + rt_data.BattGroupId
                    + " AND " + " test_record_count=" + tmp_test_data.testRecordCount;
        }
 
        return sql_str;
    }
    
    /************************************************************************************************/
    public static int queryTestRecordCountMax_From_tb_batttestdata_inf(MysqlConnPool conn_pool, int bg_id)
    {
        int rec_count = 0;
        Sql_Mysql sql = new Sql_Mysql(conn_pool.getConn());
        try 
        {
            String sql_str = "SELECT MAX(test_record_count) FROM " + Sql_Mysql.BattTestDataInf_Table 
                            + " WHERE BattGroupId=" + bg_id;
            //System.out.println(sql_str);
            ResultSet rs_t = sql.sqlMysqlQuery(sql_str);
            if(rs_t.next()) {
                rec_count = rs_t.getInt(1);
            }
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            sql.logger.error("BattData_RT_SQL.queryTestRecordCountMax_From_tb_batttestdata_inf():" + e.toString(), e);
        } finally {
            sql.close_con();
        }
        
        return rec_count;
    }
 
    public static ArrayList<String> getDeleteBattTestDataStr(BattData_RT rt_data) {
        ArrayList al_str = new ArrayList();
 
        BattStatData tmp_test_data = rt_data.mTestData.clone();
 
        String sql_str = "DELETE FROM tb_BattTestData_" + rt_data.BattGroupId + " WHERE test_record_count="
                + tmp_test_data.testRecordCount;
        al_str.add(sql_str);
 
        sql_str = "DELETE FROM tb_BattTestDataStop_" + rt_data.BattGroupId + " WHERE test_record_count="
                + tmp_test_data.testRecordCount;
        al_str.add(sql_str);
 
        sql_str = "DELETE FROM `db_batt_testdata`.`tb_batttestdata_inf` WHERE  BattGroupId=" + rt_data.BattGroupId
                + " AND " + " test_record_count=" + tmp_test_data.testRecordCount;
        al_str.add(sql_str);
 
        return al_str;
    }
}
 
/*
 * Location:
 * C:\Users\LiJun\Desktop\公司各种设备资料\9600显示模块相关文件\后台程序\2018-09-07\BattFBS9600XSP.
 * jar Qualified Name: com.battdata_rt.BattData_RT_SQL JD-Core Version: 0.6.2
 */