using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Net; using FObjBase; using Misc; using FLY.FeedbackRenZiJia.Server.Model; namespace FLY.FeedbackRenZiJia.Server { public class TDGage { #region 参数-------------------------------------------------------------------- #region 初始化------------------------------------------------------------------ public string mParamDirectory;//参数目录 m_path;//数据文件的 根目录默认是 Gage1 public string mName;//名字 如:gage0 #endregion #region 本地数据---------------------------------------------------------------- public SysParam mSysParam; public FeedbackHeat mfeedback; #endregion #region 服务器数据-------------------------------------------------------------- FLY.Thick.Blowing.Client.BlowingServiceClient mRenZiJia; FLY.Thick.Blowing.Client.BlowingDetectServiceClient mBDetect; FLY.Thick.Blowing.Client.BulkDbServiceClient bulkDbServiceClient; /// <summary> /// 报警系统 /// </summary> public FLY.OBJComponents.Server.WarningSystem mWarning; public HistoryDb mHistoryDb; DbModel mDbModel; #endregion #endregion public TDGage(string nam) { mName = nam; mParamDirectory = mName;// @"D:\" + m_name; if (!System.IO.Directory.Exists(mParamDirectory)) { System.IO.Directory.CreateDirectory(mParamDirectory); } System.Environment.CurrentDirectory = mParamDirectory; Init1(); } #region Init登陆服务器初始化---------------------------------------------------- /// <summary> /// 第1步, 加载本地数据 /// </summary> public void Init1() { mSysParam = new SysParam(); #region 与服务器同步的数据 FObjServiceClientManager.Instance.ConnAddrs.Add(new ConnAddr() { ConnName = "blowing", Addr = mSysParam.BlowingAddr }); mRenZiJia = new FLY.Thick.Blowing.Client.BlowingServiceClient(FLY.Thick.Blowing.OBJ_INTERFACE.OBJ_INTERFACE_ID.RENZIJIA_ID, "blowing"); mBDetect = new FLY.Thick.Blowing.Client.BlowingDetectServiceClient(FLY.Thick.Blowing.OBJ_INTERFACE.OBJ_INTERFACE_ID.BDETECT_ID, "blowing"); bulkDbServiceClient = new FLY.Thick.Blowing.Client.BulkDbServiceClient(FLY.Thick.Blowing.OBJ_INTERFACE.OBJ_INTERFACE_ID.BULKDB_ID, "blowing"); #endregion #region 提取保存的数据 //--------------------------------------------------------------------------------------------------------------- //数据库 mDbModel = new DbModel(); mDbModel.Init(); mHistoryDb = new HistoryDb(); mHistoryDb.Init(mDbModel); mHistoryDb.KeepDBSize(mSysParam.DBKeepMonth); //PollModule.Current.Poll_Config(PollModule.POLL_CONFIG.ADD, () => //{ // //避免1个月都不关程序,每天检查一次 // mHistoryDb.KeepDBSize(mSysParam.DBKeepMonth); //}, TimeSpan.FromDays(1)); //--------------------------------------------------------------------------------------------------------------- //Warning_Create mWarning = new FLY.OBJComponents.Server.WarningSystem(); mWarning.Init(mHistoryDb.ErrorBuffer); Misc.BindingOperations.SetBinding(mWarning, "IsRinging", () => { //报警不动作 if (mWarning.IsRinging) { } else { } }); mfeedback = new FeedbackHeat(); mfeedback.Init( mRenZiJia, mBDetect, bulkDbServiceClient, mWarning, mHistoryDb ); #endregion } #endregion } }