using FLY.Thick.Blowing.Server.Model;
using FObjBase;
using FObjBase.Reflect;
using Misc;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FLY.Thick.Blowing.IService
{
///
/// 基于DB 的 bulkdata
///
public interface IBulkDbService : INotifyPropertyChanged
{
///
/// 最后一条扫描数据Id
///
long LastScanDataId { get; }
///
/// 最后一条产品Id
///
long LastProfileId { get; }
///
/// 最后一条产品被修改的时间
///
DateTime LastTimestamp { get; }
///
/// 开始产生数据时间
///
DateTime StartTime { get; }
///
/// 最后产生数据时间
///
DateTime EndTime { get; }
///
/// 当前生产,已经结束,已经下辊了
///
bool IsFinished { get; }
///
/// 临时数据改变
///
[Push(typeof(BulkDbTempFrameChangedEventArgs))]
event EventHandler TempFrameChanged;
///
/// 获取临时数据
///
///
///
///
[Call(typeof(BulkDbTempFrameChangedEventArgs))]
void GetTempFrame(
AsyncCBHandler asyncDelegate, object asyncContext);
#region 统计
///
/// 获取历史profile
///
///
///
///
[Call(typeof(Pack_GetProfileReponse))]
void GetProfile(
Pack_GetProfileRequest request,
AsyncCBHandler asyncDelegate, object asyncContext);
///
/// 获取一幅数据
///
///
///
///
[Call(typeof(Pack_GetFrameReponse))]
void GetFrame(
Pack_GetFrameRequest request,
AsyncCBHandler asyncDelegate, object asyncContext);
///
/// 获取纵向趋势图
///
///
///
///
[Call(typeof(Pack_GetTrendReponse))]
void GetTrend(
Pack_GetTrendRequest request,
AsyncCBHandler asyncDelegate, object asyncContext);
#endregion
///
/// 完成
///
void Finish();
}
public class Pack_GetFrameRequest
{
///
/// 最后1幅数据ID, 当-1, 从数据库最后获取
///
public long Id;
///
/// 混合数
///
public int Mix;
}
public class Pack_GetProfileRequest
{
public long Id;
}
public class Pack_GetProfileReponse
{
public Pack_GetProfileRequest Request;
public Db_Profile profile;
}
public class Pack_GetFrameReponse
{
public Pack_GetFrameRequest Request;
public Lc_ScanData scanData;
public Db_Profile profile;
}
public class Pack_GetTrendRequest
{
///
/// 最后1幅数据ID, 当-1, 从数据库最后获取
///
public long Id;
///
/// 长度
///
public int Count;
///
/// 间隔, 只获取 Id % Interval == 0 的数据
///
public int Interval;
///
/// 混合数,经过间隔后的数据再混合
///
public int Mix;
///
/// 按时间查找数据
///
public bool IsSearchByTime;
///
/// 按时间查找数据, 获取的数据对应的时间都比Time小
///
public DateTime Time;
}
public class Pack_GetTrendReponse
{
public Pack_GetTrendRequest Request;
public List Values;
public long ScanDataId;
}
public class TrendValue
{
public long ScanDataID { get; set; }
public double Sigma { get; set; }
public double Value { get; set; }
public DateTime Time { get; set; }
}
public class BulkDbTempFrameChangedEventArgs : EventArgs
{
///
/// 开始时间
///
public DateTime Time;
///
/// 结束时间
///
public DateTime EndTime;
///
/// 开始位置
///
public int StartIndex;
///
/// 数据
///
public double[] D;
}
}