BattMonitor_FGCD-A059NT/src/com/dev/btse/comm/BattRealDataPro_Thread.java
@@ -47,6 +47,7 @@ logger.warn("BattRealDataPro_Thread Started ..."); Date lastTime = new Date(); Date lastdelTime = new Date(); //线程启动前休眠60秒 //用于甄别还未通讯上的设备 for(int i =0; i<60; i++) { try { @@ -68,12 +69,19 @@ /**********************************************************/ nowTime = new Date(); long timelong =(nowTime.getTime()-lastTime.getTime())/1000; long deltimelong = (nowTime.getTime()-lastdelTime.getTime())/1000; try { /**************** lijun add @ 20200906 ***************/ //获取指定天数之前的时间 Date critical = getDateBefore(nowTime, MaxRecordTimeLong); //删除修改时间超时的数据表 FBS9100_Task_Thread_SQL.deleteHistoryData(con_pool, critical); if(deltimelong > 60*60*24) { /** * 2021-08-25 @lijun 24小时定期删除指定天数之前的历史实时表,该查询占用SQL资源较大,减轻SQL查询负担 */ FBS9100_Task_Thread_SQL.deleteHistoryData(con_pool, critical); lastdelTime = nowTime; } /**********************************************************/ if(timelong < MinRecordTimeLong) { continue; BattMonitor_FGCD-A059NT/src/com/dev/fgcd/comm/FGCD_SocketClient_Thread.java
@@ -69,7 +69,10 @@ private boolean readMonData = false; //是否立即读取单体数据 记录历史数据时立即读取单体数据 private boolean readCharData = false; //是否立即读取放电数据 记录历史数据时立即读取放电数据 private int readMonData_lock = 1; //单体数据返回 private int readCharData_lock = 1; //充放电数据返回 private int sendlock_state = 1; //发送数据返回 public FGCD_SocketClient_Thread(MysqlConnPool m_ConnPool,BattData_RT_Array m_Data,Socket socket){ this.socket = socket; @@ -280,21 +283,26 @@ }else if(FGCD_ComBase.CMD_DownLoadFBDFile == fboFile.op_cmd) { //开始下载文件 FGCD_TestDataDownLoad download = new FGCD_TestDataDownLoad(fboFile, socket,m_ConnPool); fboFile.initDownLoadState(); FGCD_SocketClient_Thread_SQL.updateFgcd_Filedownload_TableCmdByDevId(m_ConnPool, fboFile); download.downLoadTestData(); } } if(DevReadCount %10 == 0) { if(DevReadCount %10 == 0 || readMonData) { //logger.info("获取单体数据"); FGCD_Cmd tmp_cmd = new FGCD_Cmd(FGCD_ComBase.CMD_GETBATTDATA); tmp_cmd.Db3 = sendlock_state; SocketComm(tmp_cmd, ByteBuffer.allocate(0)); tmp_cmd = null; readMonData = false; } if(DevReadCount %12 == 0) { if(DevReadCount %12 == 0 || readCharData) { //logger.info("获取放电数据"); SocketComm(FGCD_ComBase.CMD_GETDISCHARGEDATA, ByteBuffer.allocate(0)); FGCD_Cmd tmp_cmd = new FGCD_Cmd(FGCD_ComBase.CMD_GETDISCHARGEDATA); tmp_cmd.Db1 = sendlock_state; SocketComm(tmp_cmd, ByteBuffer.allocate(0)); tmp_cmd = null; readCharData = false; } DevReadCount++; @@ -722,6 +730,19 @@ else if(FGCD_ComBase.CMD_GETBATTDATA == m_FBS_Cmd.CMD) { //System.out.println("获取单体数据"); if(vc_data.putByteBuffer(bf, m_FBS_Cmd.ByteLen-m_FBS_Cmd.BYTE_LEN)) { readMonData_lock = m_FBS_Cmd.Db3; System.out.println("单体数据返回:"+readMonData_lock); if(m_FBS_Cmd.Db3 == 2) { if(m_FBS_Cmd.Db3 == readCharData_lock) { sendlock_state = 2; }else { readCharData = true; } }else if(m_FBS_Cmd.Db3 == 0){ sendlock_state = 1; }else{ sendlock_state = 1; } //System.out.println("获取单体数据成功"); getFBS9100MonVolData(vc_data, sysState); isSuccess = true; @@ -730,6 +751,7 @@ //--------------------- 获取放电参数 ---------------------------------------------- else if(FGCD_ComBase.CMD_GETDISCHARGEPARAM == m_FBS_Cmd.CMD) { if(testParam.putByteBuffer(bf)) { m_StatAndParam.op_cmd_ack = FGCD_ComBase.CMD_GetDischargeParmAck; FGCD_SocketClient_Thread_SQL.updateFbs9100SetParamBydev_id(m_ConnPool, m_StatAndParam, testParam); isSuccess = true; @@ -781,6 +803,16 @@ //--------------------- 获取放电数据 ---------------------------------- else if(FGCD_ComBase.CMD_GETDISCHARGEDATA == m_FBS_Cmd.CMD) { if(sysState.putByteBuffer(bf)) { readCharData_lock = m_FBS_Cmd.Db1; System.out.println("放电数据返回:"+readCharData_lock); if(m_FBS_Cmd.Db1 == 2) { if(m_FBS_Cmd.Db1 == readMonData_lock) { sendlock_state = 2; }else { readMonData = true; } } //读取当前设备的停止原因和当前工作状态 sysState.dev_captest_stop_type = m_FBS_Cmd.Alarm; sysState.dev_workstate = m_FBS_Cmd.WorkState; @@ -898,6 +930,7 @@ //读取文件列表成功 fboFile.op_cmd = FGCD_ComBase.CMD_ReadFBDFile_ACK; System.out.println("读取文件列表成功"); fboFile.cleatState(); FGCD_SocketClient_Thread_SQL.updateTb_Fgcd_Filedownload_Table(m_ConnPool, fboFile); isSuccess = true; } @@ -930,20 +963,22 @@ } int now_test_type = FGCD_ComBase.TestType_NULL; //记录停止原因时数据处理 if(sys_state.dev_captest_stop_type > 0x80) { if(sys_state.dev_captest_stop_type >= 0x80) { m_RTData[n].mTestData.test_stoptype = sys_state.dev_captest_stop_type - 0x80; //更新当前的停止原因 }else { m_RTData[n].mTestData.test_stoptype = sys_state.dev_captest_stop_type; } System.out.println("停止原因:"+m_RTData[n].mTestData.test_stoptype); int now_dev_workstate = 0; if(FGCD_ComBase.WORK_STATE_DISTEST == sys_state.dev_workstate || (FGCD_ComBase.WORK_STATE_STOPDIS == sys_state.dev_workstate)){ vc_data.battcurr[n] = (-1)*Math.abs(vc_data.battcurr[n]); //vc_data.battcurr[n] = (-1)*Math.abs(vc_data.battcurr[n]); //System.out.println("vc_data.battcurr[n]:"+vc_data.battcurr[n]); now_test_type = FGCD_ComBase.TestType_CAP; }else if(FGCD_ComBase.WORK_STATE_CHARTEST == sys_state.dev_workstate || FGCD_ComBase.WORK_STATE_STOPCHAR == sys_state.dev_workstate ){ vc_data.battcurr[n] = Math.abs(vc_data.battcurr[n]); //vc_data.battcurr[n] = Math.abs(vc_data.battcurr[n]); //System.out.println("vc_data.battcurr[n]:"+vc_data.battcurr[n]); now_test_type = FGCD_ComBase.TestType_Charge; } @@ -983,5 +1018,7 @@ } } } public static void main(String[] args) { System.out.println(0x80); } } BattMonitor_FGCD-A059NT/src/com/dev/fgcd/comm/FGCD_SocketClient_Thread_SQL.java
@@ -184,6 +184,10 @@ + ",cap_std"+(i+1)+"="+file.cap_std + ",mon_count"+(i+1)+"="+file.mon_count + ",mon_vol"+(i+1)+"="+file.monvol_type + ",download_flag"+(i+1)+"="+file.download_flag + ",download_state"+(i+1)+"="+file.download_state + ",now_data_block"+(i+1)+"="+file.now_data_block + ",total_data_block"+(i+1)+"="+file.total_data_block + ",stop_type"+(i+1)+"="+file.teststop_reason; } } BattMonitor_FGCD-A059NT/src/com/dev/fgcd/comm/FGCD_Task_Thread_SQL.java
@@ -191,9 +191,12 @@ public static void updateFBOFIleExportFlag(MysqlConnPool pool, FGCD_TestFBOFile fbofile) { String sql_str = " Update " + Sql_Mysql.Tb_Fgcd_Filedownload_Table + " Set download_state = " + fbofile.getDownload_state(); " Set "; for(int i=0;i<fbofile.files.length;i++) { sql_str += " ,download_flag"+(i+1)+" = "+fbofile.files[i].download_flag+"" if(i>0) { sql_str += ","; } sql_str += " download_flag"+(i+1)+" = "+fbofile.files[i].download_flag+"" + " ,download_state"+(i+1)+" =" +fbofile.files[i].download_state; } sql_str += " WHERE dev_id = " + fbofile.dev_id; @@ -206,4 +209,47 @@ sql.close_con(); } } /** * 更新当前下载状态,以及异常结束原因 * @param pool * @param file */ public static void updateFgcd_Filedownload_TableCmdByDevId(MysqlConnPool pool,FGCD_TestFBOFile file) { String sql_str = " UPDATE " + Sql_Mysql.Tb_Fgcd_Filedownload_Table + " SET op_cmd = " + file.op_cmd + " ,stop_reason = " + file.getStop_reason() + " WHERE dev_id = " + file.dev_id; Sql_Mysql sql = new Sql_Mysql(pool); try { sql.sqlMysqlExecute(sql_str); } catch (SQLException e) { e.printStackTrace(); } finally { sql.close_con(); } } /** * 更新当前设备的下载状态 * @param pool * @param fbofile */ public static void updateFgcd_FiledownloadState_TableByDevId(MysqlConnPool pool, FGCD_TestFBOFile fbofile) { String sql_str_base = " update " + Sql_Mysql.Tb_Fgcd_Filedownload_Table + " Set stop_reason = " + fbofile.getStop_reason(); for(int i=0;i<fbofile.files.length;i++) { FBOFile file = fbofile.files[i]; sql_str_base += " ,download_flag"+(i+1) + " = "+file.download_flag+"," + " download_state"+(i+1) + " = "+file.download_state; } sql_str_base += " WHERE dev_id = " + fbofile.dev_id; Sql_Mysql sql = new Sql_Mysql(pool.getConn()); try { sql.sqlMysqlExecute(sql_str_base); } catch (SQLException e) { e.printStackTrace(); } finally { sql.close_con(); } } } BattMonitor_FGCD-A059NT/src/com/dev/fgcd/comm/FGCD_TestDataDownLoad.java
@@ -38,12 +38,16 @@ public static final int FialReason_FIleNotFound = 1; //文件未找到 public static final int FialReason_ParamError = 2; //参数错误 public static final int FialReason_NetWorkError = 3; //网络异常错误 public static final int FialReason_UserCancel = 4; //用户取消 public static final int DownLoadState_ReadData = 1; //下载文件 public static final int DownLoadState_CreateData = 2; //生成文件 public static final int DownLoadState_ExportData = 3; //导出数据 public static final int DownLoadState_ExportSucc = 4; //导入成功 public static final int DownLoadState_ExportFail = 5; //导入失败 public static final int DownLoadState_UserCancel = 6; //用户取消 private ByteBuffer bytebuffer_for_socket_RX = ByteBuffer.allocate(1200); @@ -57,6 +61,8 @@ private Socket socket; private int ErrorCount = 0; //错误计数;连续3次通信失败即为网络异常结束 private String fileName; private FBOFile nowFbo; public FGCD_TestDataDownLoad(FGCD_TestFBOFile fbofile,Socket socket,MysqlConnPool pool) { this.fbofile = fbofile; @@ -67,63 +73,72 @@ downLoadParamCheck(); } /** * 下载当前电池组数据 * @param socket */ public void downLoadTestData() { int now_download_state = DownLoadState_ReadData; for(int i=0;i<fbofile.files.length;i++) { //当前下载文件 FBOFile file = fbofile.files[i]; if(now_download_state == DownLoadState_UserCancel) { file.setDownload_state(DownLoadState_UserCancel); file.setDownload_flag(DownloadFlag_Fail); continue; } if(file.download_flag != DownloadFlag_Start) { continue; } nowFbo = file; ReadTestData = true; fbofile.initDownLoadState(); fbofile.setDownload_state(DownLoadState_ReadData); file.setDownload_state(DownLoadState_ReadData); while(ReadTestData) { try { queryDownLoadState(pool, fbofile); if(fbofile.op_cmd != FGCD_ComBase.CMD_DownLoadFBDFile_Over) { if(fbofile.op_cmd == FGCD_ComBase.CMD_DownLoadFBDFile_Over) { now_download_state = FGCD_ComBase.CMD_DownLoadFBDFile_Over; fbofile.setStop_reason(FialReason_UserCancel); //手动终止下载命令 return; file.setDownload_flag(DownloadFlag_Fail); fbofile.op_cmd = FGCD_ComBase.CMD_DownLoadFBDFile_Over_ACK; FGCD_Task_Thread_SQL.updateFgcd_Filedownload_TableCmdByDevId(pool, fbofile); file.setDownload_state(DownLoadState_UserCancel); continue; } if(fbofile.getDownload_state() == DownLoadState_ReadData) { if(nowFbo.getDownload_state() == DownLoadState_ReadData) { //System.out.println("读取测试文件中"+file); SocketComm(FGCD_ComBase.CMD_GETFILE,file.file_index,fbofile.now_data_block); SocketComm(FGCD_ComBase.CMD_GETFILE,file.file_index,nowFbo.now_data_block); } if(fbofile.getDownload_state() == DownLoadState_CreateData) { if(nowFbo.getDownload_state() == DownLoadState_CreateData) { //生成当前下载的数据文件 if(createFBOFile(file)) { //生成FBO文件成功过 //System.err.println("生成文件成功"); fbofile.setDownload_state(DownLoadState_ExportData); nowFbo.setDownload_state(DownLoadState_ExportData); }else{ //生成FBO文件失败 //System.err.println("生成文件失败"); fbofile.setDownload_state(DownLoadState_ExportFail); nowFbo.setDownload_state(DownLoadState_ExportFail); } } if(fbofile.getDownload_state() == DownLoadState_ExportData) { if(nowFbo.getDownload_state() == DownLoadState_ExportData) { //解析本地数据文件并导入数据库 boolean flag = readFBOFileData(file,pool); if(flag) { fbofile.setDownload_state(DownLoadState_ExportSucc); nowFbo.setDownload_state(DownLoadState_ExportSucc); }else { fbofile.setDownload_state(DownLoadState_ExportFail); nowFbo.setDownload_state(DownLoadState_ExportFail); } } if(fbofile.getDownload_state() == DownLoadState_ExportFail || fbofile.getDownload_state() == DownLoadState_ExportSucc) { if(nowFbo.getDownload_state() == DownLoadState_ExportFail || nowFbo.getDownload_state() == DownLoadState_ExportSucc) { ReadTestData = false; } file.setDownload_state(fbofile.getDownload_state()); file.setDownload_state(nowFbo.getDownload_state()); updateDownLoadProgress(pool,fbofile); //更新当前下载进度 Thread.sleep(50); } catch(Exception e) { @@ -132,7 +147,7 @@ } filebyte = new byte[0]; { if(fbofile.getDownload_state() == DownLoadState_ExportSucc) { if(nowFbo.getDownload_state() == DownLoadState_ExportSucc) { //System.out.println("导出历史放电数据成功"); file.setDownload_flag(DownloadFlag_Over); fbofile.op_cmd = FGCD_ComBase.CMD_DownLoadFBDFile_ACK; @@ -143,7 +158,8 @@ } } FGCD_Task_Thread_SQL.updateFBOFIleExportFlag(pool,fbofile); } } FGCD_Task_Thread_SQL.updateFgcd_FiledownloadState_TableByDevId(pool, fbofile); /******************************** 最后设置当前导出状态 ********************************************/ } @@ -275,18 +291,18 @@ //--------------------- 心跳包测试 ---------------------------------- if(FGCD_ComBase.CMD_GETFILE == m_FBS_Cmd.CMD) { if(FGCD_ComBase.RETURN_SUCCESS == m_FBS_Cmd.RecState) { this.fbofile.total_data_block = m_FBS_Cmd.getTotalDownLoadBlock(); this.nowFbo.total_data_block = m_FBS_Cmd.getTotalDownLoadBlock(); //System.out.println("数据包总长度:"+ this.fbofile.total_data_block+ m_FBS_Cmd); if(m_FBS_Cmd.getNowDownLoadIndex() == fbofile.now_data_block) { if(m_FBS_Cmd.getNowDownLoadIndex() == nowFbo.now_data_block) { if(putFileData(bf,m_FBS_Cmd.ByteLen-18)) { fbofile.now_data_block ++; nowFbo.now_data_block ++; isSuccess = true; //System.out.println("读取第"+m_FBS_Cmd.getNowDownLoadIndex()+"个数据包成功"); System.out.println("读取第"+m_FBS_Cmd.getNowDownLoadIndex()+"个数据包成功"); if(fbofile.now_data_block == fbofile.total_data_block) { if(nowFbo.now_data_block == nowFbo.total_data_block) { //System.out.println("下载历史数据文件完成"); fbofile.setDownload_state(DownLoadState_CreateData); nowFbo.setDownload_state(DownLoadState_CreateData); } } } @@ -386,13 +402,16 @@ */ public void updateDownLoadProgress(MysqlConnPool pool,FGCD_TestFBOFile fbofile) { String sql_str = " UPDATE " + Sql_Mysql.Tb_Fgcd_Filedownload_Table + " SET download_state = " + fbofile.getDownload_state() + " ,now_data_block = " + fbofile.now_data_block + " ,total_data_block = " + fbofile.total_data_block; " SET "; Sql_Mysql sql = new Sql_Mysql(pool); String sql_str_end = " WHERE dev_id = " + fbofile.dev_id; for(int i=0;i<fbofile.files.length;i++) { sql_str += ",download_state"+(i+1)+" = "+fbofile.files[i].getDownload_state(); if(i>0) { sql_str += ","; } sql_str += "download_state"+(i+1)+" = "+fbofile.files[i].getDownload_state() + ",now_data_block"+(i+1)+" = "+fbofile.files[i].getNow_data_block() + ",total_data_block"+(i+1)+" = "+fbofile.files[i].getTotal_data_block(); } sql_str += sql_str_end; try { @@ -472,11 +491,27 @@ } return flag; } // public static void main(String[] args) { // File root = new File(System.getProperty("user.dir")+File.separator+"88888"+File.separator+123456); // if(!root.exists()) { // root.mkdirs(); // } // } /** * 解析FBO文件线程 * @author LiJun * */ public class ParseFboThread extends Thread{ public MysqlConnPool pool; public int port_index; public FGCD_TestFBOFile fbofile; public ParseFboThread(MysqlConnPool pool,int index,FGCD_TestFBOFile fbofile){ this.pool = pool; this.port_index = index; this.fbofile = fbofile; } @Override public void run() { } } } BattMonitor_FGCD-A059NT/src/com/dev/fgcd/data/FGCD_ComBase.java
@@ -48,8 +48,8 @@ public static final int CMD_DownLoadFBDFile = 0xA3; //开始下载 public static final int CMD_DownLoadFBDFile_ACK = 0xA4; //下载成功 public static final int CMD_DownLoadFBDFile_Over = 0xA4; //手动结束 public static final int CMD_DownLoadFBDFile_Over = 0xA5; //ֹͣ public static final int CMD_DownLoadFBDFile_Over_ACK = 0xA6; //停止成功 //---------------------------------------------------------------------------- BattMonitor_FGCD-A059NT/src/com/dev/fgcd/data/FGCD_TestFBOFile.java
@@ -16,9 +16,6 @@ public int file_count; //当前文件数 public int file_total; //数据文件总数 public int total_data_block; //总的数据块数 public int now_data_block; //当前数据块数目 private int download_state; //当前下载状态 private int stop_reason; //结束原因 public FBOFile[] files = new FBOFile[8]; //读取的历史文件 @@ -30,11 +27,6 @@ } } public void initDownLoadState() { total_data_block = 0; //总的数据块数 now_data_block = 0; //当前数据块数目 download_state = FGCD_TestDataDownLoad.DownLoadState_ReadData; //当前下载状态 } public FGCD_Cmd createCmd(int cmd) { FGCD_Cmd m_Cmd = new FGCD_Cmd(); @@ -46,17 +38,11 @@ public int getDownload_state() { return download_state; } public int getStop_reason() { return stop_reason; } public void setDownload_state(int download_state) { this.download_state = download_state; } public void setStop_reason(int stop_reason) { this.stop_reason = stop_reason; @@ -142,46 +128,51 @@ } public class FBOFile{ public int file_count; //数据文件总数 public int file_index; //当前文件索引 public int year; //年 public int month; //月 public int day; //天 public int hour; //ʱ public int minte; //分 public int second; //秒 public String filename; //文件名 public int test_timelong; //测试时长 public int data_type; //数据类型 public float test_curr; //测试电流(0.1A) public int test_cap; //测试容量(1AH) public int cap_std; //标称容量(1AH) public float monvol_low; //单体下限(0.01V) public float groupvol_low; //组端下限 public int mon_count; //单体个数 public int testgroup_count; //测试第几组得到的数据 public int teststop_reason; //停止原因 public float monvol_type; //单体电压类型 public int download_flag; //下载标识 public int download_state; //下载状态 public int file_count; //数据文件总数 public int file_index; //当前文件索引 public int year; //年 public int month; //月 public int day; //天 public int hour; //ʱ public int minte; //分 public int second; //秒 public String filename; //文件名 public int test_timelong; //测试时长 public int data_type; //数据类型 public float test_curr; //测试电流(0.1A) public int test_cap; //测试容量(1AH) public int cap_std; //标称容量(1AH) public float monvol_low; //单体下限(0.01V) public float groupvol_low; //组端下限 public int mon_count; //单体个数 public int testgroup_count; //测试第几组得到的数据 public int teststop_reason; //停止原因 public float monvol_type; //单体电压类型 public int download_flag; //下载标识 public int download_state; //下载状态 public int now_data_block; //当前数据块数目 public int total_data_block; //当前下载状态 public void clear() { file_count = 0; //数据文件总数 file_index = 0; //当前文件索引 filename = ""; //文件名 test_timelong = 0; //测试时长 data_type = 0; //数据类型 test_curr = 0; //测试电流(0.1A) test_cap = 0; //测试容量(1AH) file_count = 0; //数据文件总数 file_index = 0; //当前文件索引 filename = ""; //文件名 test_timelong = 0; //测试时长 data_type = 0; //数据类型 test_curr = 0; //测试电流(0.1A) test_cap = 0; //测试容量(1AH) cap_std = 0; //标称容量(1AH) monvol_low = 0; //单体下限(0.01V) groupvol_low = 0; //组端下限 mon_count = 0; //单体个数 monvol_low = 0; //单体下限(0.01V) groupvol_low = 0; //组端下限 mon_count = 0; //单体个数 testgroup_count = 0; //测试第几组得到的数据 teststop_reason = 0; //停止原因 monvol_type = 0; //单体电压类型 download_flag = 0; //下载标识 download_state = 0; //下载状态 monvol_type = 0; //单体电压类型 download_flag = 0; //下载标识 download_state = 0; //下载状态 now_data_block = 0; //当前数据块数目 total_data_block = 0; //当前下载状态 } public int getFile_count() { @@ -295,6 +286,23 @@ this.download_state = FGCD_TestDataDownLoad.DownLoadState_ReadData; } } public int getNow_data_block() { return now_data_block; } public int getTotal_data_block() { return total_data_block; } public void setNow_data_block(int now_data_block) { this.now_data_block = now_data_block; } public void setTotal_data_block(int total_data_block) { this.total_data_block = total_data_block; } public void setDownload_state(int download_state) { this.download_state = download_state; } @@ -352,12 +360,30 @@ } @Override public String toString() { return "FGCD_TestFBOFile [dev_id=" + dev_id + ", op_cmd=" + op_cmd + ", battgroupid=" + battgroupid + ", file_index=" + file_index + ", file_count=" + file_count + ", file_total=" + file_total + ", total_data_block=" + total_data_block + ", now_data_block=" + now_data_block + ", download_state=" + download_state + ", stop_reason=" + stop_reason + "]"; public void initDownLoadState() { for(int i=0;i<files.length;i++) { FBOFile fbo = files[i]; if(fbo.download_flag == 1) { fbo.setDownload_state(FGCD_TestDataDownLoad.DownLoadState_ReadData); fbo.total_data_block = 0; fbo.now_data_block = 0; } } } public void cleatState() { for(int i=0;i<files.length;i++) { FBOFile f = files[i]; f.download_flag = 0; f.download_state = 0; f.now_data_block = 0; f.total_data_block = 0; } } }