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

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

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