Commit 4cc848b7 authored by 潘栩锋's avatar 潘栩锋 🚴

TimeGridAdv2Event 可以通过查询获取

parent e01f567c
......@@ -441,6 +441,48 @@ namespace FlyADBase
AD = ad;
}
public TimeGridAdv2EventArgs GetTimeGridAdv2Event(DateTime beginTime) {
//获取ad列表
var adList = mTimeGridAdvHelper.GetAD(beginTime);
if (adList.Count() == 0)
return null;
DateTime endTime = mTimeGridAdvHelper.NewestTime;
int adCnt = adList.Count();
//获取pos
var posList = mTimeGridAdvHelper.GetPos(mTimeGridAdvHelper.NewestTime, adList.Count());
Misc.DIRECTION direction;
//判断运动方向
if (posList.Last() > posList.First())
{
//正向
direction = DIRECTION.FORWARD;
}
else
{
direction = DIRECTION.BACKWARD;
}
//机架修正
if (CorrectADs != null)
{
for (int i = 0; i < adList.Count(); i++)
{
adList[i] = CorrectAD(posList[i] / PosOfGrid, adList[i]);
}
}
TimeGridAdv2EventArgs eventArgs = new TimeGridAdv2EventArgs();
eventArgs.Direction = direction;
eventArgs.EndTime = endTime;
eventArgs.AdList = adList;
eventArgs.PosList = posList;
return eventArgs;
}
void advPushTimeGrid(DateTime end_dt, int[] datas)
{
......@@ -493,15 +535,7 @@ namespace FlyADBase
eventArgs.PosList = posList;
eventArgs.Marker = marker;
TimeGridAdv2Event(this,
new TimeGridAdv2EventArgs()
{
Direction = direction,
EndTime = reponse_endTime,
AdList = adList,
PosList = posList,
Marker = marker
});
TimeGridAdv2Event(this, eventArgs);
}
}
......@@ -521,8 +555,16 @@ namespace FlyADBase
mTimeGridAdvHelper.AddDriveStatus(Now, DriveOrder, DriveStatus, Marker);
if (DriveStatus != DRIVE_MAN_STATUS.RUNNING)
{
//检测 mTimeGridAdvHelper.AdPool 的 systick 是否 大于等于 Now
if (mTimeGridAdvHelper.NewestTime >= Now)
{
IsTimeToPushTimeGridAdv = false;
}
else {
//通知 mTimeGridAdvHelper 下次触发 timegridadv
IsTimeToPushTimeGridAdv = true;
}
}
}
......
......@@ -407,6 +407,10 @@ namespace FlyADBase
{
return TimeGridAdvHelperExt.GetAD(ADPool, begin, end, out reponse_endTime);
}
public List<int> GetAD(DateTime begin)
{
return TimeGridAdvHelperExt.GetAD(ADPool, begin );
}
public List<int> GetPos(DateTime end_dt, int cnt) {
......@@ -514,7 +518,7 @@ namespace FlyADBase
return GetAD(adPool, begin);
}
static List<int> GetAD(List<DateTimeUnit3> adPool, DateTime begin)
public static List<int> GetAD(List<DateTimeUnit3> adPool, DateTime begin)
{
var ts = TimeSpan.FromTicks((long)(ad_ts_ms * TimeSpan.TicksPerMillisecond));
......
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