Esempio n. 1
0
        /// <summary>
        /// 运行服务
        /// </summary>
        public static void ExcelSnapRun(string strExcel, string strSheet,
                                        DateTime dtT, int nLength, int nSecond)
        {
            //获得需要补算的时间
            ArrayList archiveList = new ArrayList();

            WS_ExcelDatClient.ReadDatFile(out archiveList);
            try
            {
                //检查数据库连接是否满足要求
                if (WS_ExcelSubMethod.CanRun())
                {
                    //实时采集
                    WS_ExcelSubMethod.SnapshotCalc(strExcel, strSheet, dtT, nLength, nSecond);
                    //历史数据补采
                    foreach (string strTime in archiveList)
                    {
                        DateTime dtArchive = DateTime.Parse(strTime);
                        WS_ExcelSubMethod.SnapshotCalc(strExcel, strSheet, dtArchive, nLength, nSecond);
                    }
                    //历史时间清空
                    archiveList.Clear();
                }
            }
            catch (Exception ex)
            {
                //如果出现错误,记录。
                archiveList.Add(dtT.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss"));
                LogUtil.LogMessage(ex);
            }
            WS_ExcelDatClient.WriteDatFile(archiveList);
        }