Commit b6273c96 authored by 潘栩锋's avatar 潘栩锋 🚴

修复 FeedbackHeat 从测厚仪收的数据endtime可能比当前时间大于30秒,(AD盒时间异常导致)。

改为读取数据库最后一行,判断是否已经接收过
parent 0483e775
...@@ -487,7 +487,7 @@ namespace FLY.FeedbackRenZiJia.Server ...@@ -487,7 +487,7 @@ namespace FLY.FeedbackRenZiJia.Server
} }
} }
} }
DateTime lastScanDataEndTime;
public void Init( public void Init(
FLY.Thick.Blowing.IService.IBlowingService blowingService, FLY.Thick.Blowing.IService.IBlowingService blowingService,
FLY.Thick.Blowing.IService.IBlowingDetectService bDetect, FLY.Thick.Blowing.IService.IBlowingDetectService bDetect,
...@@ -511,6 +511,15 @@ namespace FLY.FeedbackRenZiJia.Server ...@@ -511,6 +511,15 @@ namespace FLY.FeedbackRenZiJia.Server
bulkDbService.PropertyChanged += BulkDbService_PropertyChanged; bulkDbService.PropertyChanged += BulkDbService_PropertyChanged;
this.bDetect.PropertyChanged += MBDetect_PropertyChanged; this.bDetect.PropertyChanged += MBDetect_PropertyChanged;
mHistoryDb.GetFrame(0, (asyncContext, retData) =>
{
var reponse = retData as GetFrameReponse;
if (reponse.thickHeat != null) {
lastScanDataEndTime = reponse.thickHeat.EndTime;
}
}, null);
InitError(); InitError();
} }
...@@ -527,10 +536,14 @@ namespace FLY.FeedbackRenZiJia.Server ...@@ -527,10 +536,14 @@ namespace FLY.FeedbackRenZiJia.Server
if (reponse.scanData == null) if (reponse.scanData == null)
return; return;
var scanData = reponse.scanData; var scanData = reponse.scanData;
if (Math.Abs((DateTime.Now - scanData.EndTime).TotalSeconds) > 30) {
//读取数据库,
if (lastScanDataEndTime == scanData.EndTime) {
//这是以前的数据,不要 //这是以前的数据,不要
return; return;
} }
lastScanDataEndTime = scanData.EndTime;
Add( Add(
scanData.Time, scanData.Time,
scanData.EndTime, scanData.EndTime,
......
...@@ -83,12 +83,12 @@ namespace FLY.FeedbackRenZiJia.Server.Model ...@@ -83,12 +83,12 @@ namespace FLY.FeedbackRenZiJia.Server.Model
LastId = thickHeat.ID; LastId = thickHeat.ID;
} }
public async void GetFrame(long Id, AsyncCBHandler asyncDelegate, object asyncContext) public void GetFrame(long Id, AsyncCBHandler asyncDelegate, object asyncContext)
{ {
GetFrameReponse reponse = new GetFrameReponse(); GetFrameReponse reponse = new GetFrameReponse();
reponse.Id = Id; reponse.Id = Id;
await Task.Factory.StartNew(() => Task.Factory.StartNew(() =>
{ {
List<Db_ThickHeat> db_thickHeats; List<Db_ThickHeat> db_thickHeats;
if (Id <= 0) if (Id <= 0)
...@@ -107,7 +107,8 @@ namespace FLY.FeedbackRenZiJia.Server.Model ...@@ -107,7 +107,8 @@ namespace FLY.FeedbackRenZiJia.Server.Model
var lc_thickHeat = Lc_AutoMapperProfile.Mapper.Map<Lc_ThickHeat>(db_thickHeats.First()); var lc_thickHeat = Lc_AutoMapperProfile.Mapper.Map<Lc_ThickHeat>(db_thickHeats.First());
reponse.thickHeat = lc_thickHeat; reponse.thickHeat = lc_thickHeat;
}); }).Wait();
asyncDelegate(asyncContext, reponse); asyncDelegate(asyncContext, reponse);
} }
......
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