在测试中添加 记录是否正确检查

main^2
xiaoguo 12 months ago
parent 53eea68392
commit fd0d88b1b4

Binary file not shown.

@ -97,11 +97,13 @@ app.Lifetime.ApplicationStarted.Register(() =>
// Thread.Sleep(100);
//}
// Test.EqualsRecordAndDayTotal();
// Test.EqualsRecordAndDayTotal();
// Test.QueryRecordFaultInfo();
});
app.Run();

@ -130,5 +130,42 @@ namespace PVDEMCS
}
public static void QueryRecordFaultInfo()
{
var beg = DateTime.Parse("2024-6-1");
var end = beg.AddMonths(1);
using (var context = new EFContext())
{
var equiments = context.EquipmentInfos.Where(f => !f.IsDelete).ToList();
var records = context.EquipmentRecords.Where(f => f.StartTime >= beg && f.StartTime <= end).ToList();
foreach (var equipment in equiments)
{
EquipmentRecordEntity er = null;
var list = records.Where(f => f.EquipmentId == equipment.Id).OrderBy(f => f.CreateAt).ToList();
for (int i = 0; i < list.Count; i++)
{
if (i == 0)
{
er= list[i];
continue;
}
if (er.EndTime != list[i].StartTime)
{
Console.WriteLine(er.ToJsonString());
Console.WriteLine(list[i].StartTime.ToJsonString());
}
else
{
// Console.WriteLine(er.EquipmentId + "OK!!!");
}
er = list[i];
}
}
}
}
}
}

Loading…
Cancel
Save