Commit fd2f4630 authored by LiGuohua's avatar LiGuohua

分离分析和监视数据

parent 45f4a56a
...@@ -34,10 +34,11 @@ namespace FLY.HeatingHelper.UI.UiModule ...@@ -34,10 +34,11 @@ namespace FLY.HeatingHelper.UI.UiModule
private IUnityContainer container; private IUnityContainer container;
[InjectionMethod] [InjectionMethod]
public void Init(IUnityContainer container,IThickHeatData dat) public void Init(IUnityContainer container,[Dependency("forThread")]IThickHeatData dat)
{ {
this.container = container; this.container = container;
vm = new ViewModel_HeatThickDetector(container.Resolve<FLY.Thick.Blowing.IService.IBlowingService>(), dat); vm = new ViewModel_HeatThickDetector(container.Resolve<FLY.Thick.Blowing.IService.IBlowingService>(), dat);
dat.StartMonitorTask();
this.DataContext = vm; this.DataContext = vm;
} }
......
...@@ -43,6 +43,7 @@ namespace FLY.HeatingHelper.UI.UiModule ...@@ -43,6 +43,7 @@ namespace FLY.HeatingHelper.UI.UiModule
public void Init(IUnityContainer container, IThickHeatData dat) public void Init(IUnityContainer container, IThickHeatData dat)
{ {
Dat = dat as IThickHeatData; Dat = dat as IThickHeatData;
Dat.LoadMetaDataFromDB();
container.BuildUp(uc_SelectData); container.BuildUp(uc_SelectData);
container.BuildUp(uc_airRingShift); container.BuildUp(uc_airRingShift);
container.BuildUp(uc_heatBoltAnalyst); container.BuildUp(uc_heatBoltAnalyst);
...@@ -84,7 +85,7 @@ namespace FLY.HeatingHelper.UI.UiModule ...@@ -84,7 +85,7 @@ namespace FLY.HeatingHelper.UI.UiModule
private void Page_Unloaded(object sender, RoutedEventArgs e) private void Page_Unloaded(object sender, RoutedEventArgs e)
{ {
Dat.EndUse(); Dat.EndUse();
} }
} }
......
...@@ -210,6 +210,8 @@ namespace FLY.HeatingHelper.UI.UiModule ...@@ -210,6 +210,8 @@ namespace FLY.HeatingHelper.UI.UiModule
//while (rb < 0) rb += cnt; //while (rb < 0) rb += cnt;
//while (rb >= cnt) rb -= cnt; //while (rb >= cnt) rb -= cnt;
//ResetBolt = rb; //ResetBolt = rb;
if (correls is null)
return;
TandH_Corel = correls[_NewResetBolt - 1]; TandH_Corel = correls[_NewResetBolt - 1];
} }
} }
......
...@@ -39,18 +39,7 @@ namespace FLY.HeatingHelper.UI.UiModule.UC_SelectData ...@@ -39,18 +39,7 @@ namespace FLY.HeatingHelper.UI.UiModule.UC_SelectData
public DateTime? TotalDataFrom { get; set; } = null; public DateTime? TotalDataFrom { get; set; } = null;
public int RecordCount public int RecordCount { get; set; }
{
get
{
if (Dat is null) return -1;
return Dat.Dat_Times.Count();
}
set
{
}
}
public double[] DS_thick { get; set; } public double[] DS_thick { get; set; }
public double[] DS_2sigma { get; set; } public double[] DS_2sigma { get; set; }
...@@ -150,7 +139,7 @@ namespace FLY.HeatingHelper.UI.UiModule.UC_SelectData ...@@ -150,7 +139,7 @@ namespace FLY.HeatingHelper.UI.UiModule.UC_SelectData
Dat.LoadDataFromDB(1); Dat.LoadDataFromDB(1);
Dat.ResetCluster(); Dat.ResetCluster();
Dat.ClusterOnThickMean(); Dat.ClusterOnThickMean();
RecordCount = 1; RecordCount = Dat.Dat_Times.Count(); ;
OnLoaded(); OnLoaded();
//UpdateChart(); //UpdateChart();
} }
......
...@@ -180,6 +180,8 @@ namespace FLY.HeatingHelper ...@@ -180,6 +180,8 @@ namespace FLY.HeatingHelper
int DataChanged { get; set; } int DataChanged { get; set; }
//bool IsDataReady { get; } //bool IsDataReady { get; }
void StartMonitorTask();
bool BeginUse(bool isAsync = true); bool BeginUse(bool isAsync = true);
void EndUse(); void EndUse();
......
...@@ -31,7 +31,7 @@ namespace FLY.HeatingHelper ...@@ -31,7 +31,7 @@ namespace FLY.HeatingHelper
{ {
if (DBName == dbname) return; if (DBName == dbname) return;
DBName = dbname; DBName = dbname;
StartDBTask(); //StartDBTask();
//worker.WorkerSupportsCancellation = true; //worker.WorkerSupportsCancellation = true;
//worker.WorkerReportsProgress = true; //worker.WorkerReportsProgress = true;
//worker.DoWork += new DoWorkEventHandler((o, e) => //worker.DoWork += new DoWorkEventHandler((o, e) =>
...@@ -1541,8 +1541,9 @@ namespace FLY.HeatingHelper ...@@ -1541,8 +1541,9 @@ namespace FLY.HeatingHelper
#endregion #endregion
#region 自动更新数据的任务 #region 自动更新数据的任务
private Task taskForDB; private Task taskForDB;
private void StartDBTask() public void StartMonitorTask()
{ {
taskForDB = Task.Factory.StartNew(() => taskForDB = Task.Factory.StartNew(() =>
{ {
...@@ -1550,10 +1551,9 @@ namespace FLY.HeatingHelper ...@@ -1550,10 +1551,9 @@ namespace FLY.HeatingHelper
{ {
if (BeginUse()) if (BeginUse())
{ {
bool tmp = IsFilterUnstable;
IsFilterUnstable = true; IsFilterUnstable = true;
IsDataFilter = true;
RefreshData(); RefreshData();
IsFilterUnstable = tmp;
EndUse(); EndUse();
Thread.Sleep(1000 * 60); Thread.Sleep(1000 * 60);
} }
......
...@@ -225,14 +225,15 @@ namespace FLY.HeatingHelper ...@@ -225,14 +225,15 @@ namespace FLY.HeatingHelper
if ((reload == 0 && _ids.Count() == 0) || (reload == 1)) if ((reload == 0 && _ids.Count() == 0) || (reload == 1))
{ {
clear = true; clear = true;
DateTime to = LoadDataTo + new TimeSpan(0, 0, 1);
if(IsFilterUnstable) if(IsFilterUnstable)
cmdstr = string.Format("select * from [ThickHeat] where IsStable=1 and Time>=\"{0}\" and Time<=\"{1}\"", cmdstr = string.Format("select * from [ThickHeat] where IsStable=1 and Time>=\"{0}\" and Time<=\"{1}\"",
LoadDataFrom.ToString("yyyy-MM-dd HH:mm:ss"), LoadDataFrom.ToString("yyyy-MM-dd HH:mm:ss"),
LoadDataTo.ToString("yyyy-MM-dd HH:mm:ss")); to.ToString("yyyy-MM-dd HH:mm:ss"));
else else
cmdstr = string.Format("select * from [ThickHeat] where Time>=\"{0}\" and Time<=\"{1}\"", cmdstr = string.Format("select * from [ThickHeat] where Time>=\"{0}\" and Time<=\"{1}\"",
LoadDataFrom.ToString("yyyy-MM-dd HH:mm:ss"), LoadDataFrom.ToString("yyyy-MM-dd HH:mm:ss"),
LoadDataTo.ToString("yyyy-MM-dd HH:mm:ss")); to.ToString("yyyy-MM-dd HH:mm:ss"));
} }
else else
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment