public void CountThreadProc() { string strLog = string.Empty; bu_Joch bu = new bu_Joch(); DataTable dt = new DataTable(); try { int intRowNo = 0; if (this.running == true) { dt = bu.GetDataTableFromEXFO(this.strConnectString, this.strDatatableName); strLog = string.Format("GetSPCData开始,{0}", dtStartTime.ToString("yyyy-MM-dd HH:mm:ss") + "~" + dtEndTime.ToString("yyyy-MM-dd HH:mm:ss")); //log.WriteLog(strLog, ThreadName); AppLogHelp.WriteLog(LogFileFormate.MES, ThreadName + strLog); dt = bu.GetSPCDataForEXFO(this.strConnectString, this.strDatatableName, dtStartTime, dtEndTime); if (dt != null) { intRowNo = dt.Rows.Count; strLog = string.Format("GetSPCData结束,共获取{1}日期之前下的{0}条记录", intRowNo, dtStartTime.ToString("yyyy-MM-dd HH:mm:ss") + "~" + dtEndTime.ToString("yyyy-MM-dd HH:mm:ss")); //log.WriteLog(strLog, ThreadName); AppLogHelp.WriteLog(LogFileFormate.MES, ThreadName + strLog); if (intRowNo > 0) { bu.BulkToDB(this.strConnectString, dt, null); strLog = string.Format("Insert SPCData结束,共同步{1}日期之前下的{0}条记录", intRowNo, dtStartTime.ToString("yyyy-MM-dd HH:mm:ss") + "~" + dtEndTime.ToString("yyyy-MM-dd HH:mm:ss")); //log.WriteLog(strLog, ThreadName); AppLogHelp.WriteLog(LogFileFormate.MES, ThreadName + strLog); } } else { strLog = "GetSPCData结束, NULL "; //log.WriteLog(strLog, ThreadName); AppLogHelp.WriteLog(LogFileFormate.MES, ThreadName + strLog); } } } catch (Exception ex) { //log.WriteErr("错误 ! " + ex.ToString(), ThreadName); AppLogHelp.WriteLog(LogFileFormate.MES, ThreadName + "错误 ! " + ex.ToString()); } finally { //log.WriteLog("线程EXFO结束!", ThreadName); AppLogHelp.WriteLog(LogFileFormate.MES, ThreadName + strLog); } }
public void CountThreadProc() { string strLog = string.Empty; try { bu_Joch bu = new bu_Joch(); int intRowNo = 0; AutoAPP.MainForm._runnerDeleteProcess = this; if (this.running == true) { intRowNo = bu.DeleteAndBackupDataByDays(dtStartTime, dtEndTime, 2, strConnectString, blnBackupData, strBackFilePath, blnDeleteEveryHour, _iPCBLimit); strLog = string.Format("删除结束,共删除{1}日期之前下的{0}条记录", intRowNo, dtStartTime.ToString("yyyy-MM-dd HH:mm:ss") + "~" + dtEndTime.ToString("yyyy-MM-dd HH:mm:ss")); if (blnBackupData) { strLog += "\r\n 数据备份目录:" + strBackFilePath; } else { strLog += "\r\n 无数据备份!"; } //log.WriteLog(strLog, ThreadName); AppLogHelp.WriteLog(LogFileFormate.Delete, ThreadName + " :" + strLog); } } catch (Exception ex) { //log.WriteErr("错误 ! " + ex.ToString(), ThreadName); AppLogHelp.WriteError(LogFileFormate.Delete, ThreadName + "错误 ! " + ex.ToString()); return; } finally { AppLogHelp.WriteLog(LogFileFormate.Delete, ThreadName + " :结束"); this.running = false; } }