namespace IStation.Application
|
{
|
/// <summary>
|
/// 泵站调度
|
/// </summary>
|
public class StationDispatchInput : IValidatableObject
|
{
|
/// <summary>
|
/// 对象列表
|
/// </summary>
|
public Dictionary<string, double> objects { get; set; }
|
|
/// <summary>
|
/// 计算状态 0:失败 1:成功
|
/// </summary>
|
public int flag { get; set; }
|
|
/// <summary>
|
/// 接收时间
|
/// </summary>
|
public DateTime ReceiptTime { get; set; }
|
|
/// <summary>
|
/// 返回时间
|
/// </summary>
|
public DateTime ReturnTime { get; set; }
|
|
/// <summary>
|
/// 备注信息
|
/// </summary>
|
public string message { get; set; }
|
|
|
/// <summary>
|
/// 验证
|
/// </summary>
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
{
|
if (objects == null || objects.Count < 1)
|
{
|
yield return
|
new ValidationResult("objects 不能为空", new[] { nameof(objects) });
|
}
|
else if (objects.Count < 4)
|
{
|
yield return
|
new ValidationResult("objects 数据缺失", new[] { nameof(objects) });
|
}
|
else
|
{
|
if (!objects.ContainsKey("TotalFlow1"))
|
{
|
yield return
|
new ValidationResult(" objects [TotalFlow1]数据缺失", new[] { nameof(objects) });
|
}
|
else
|
{
|
if (objects["TotalFlow1"] < 1)
|
{
|
yield return
|
new ValidationResult($"一输水增水量过低! tag:TotalFlow1 Value:{objects["TotalFlow1"]}", new[] { nameof(objects) });
|
}
|
}
|
|
if (!objects.ContainsKey("TotalPressure1"))
|
{
|
yield return
|
new ValidationResult(" objects [TotalPressure1]数据缺失", new[] { nameof(objects) });
|
}
|
else
|
{
|
if (objects["TotalPressure1"] < 0.01)
|
{
|
yield return
|
new ValidationResult($"一输水增压过低! tag:TotalPressure1 Value:{objects["TotalPressure1"]}", new[] { nameof(objects) });
|
}
|
}
|
|
if (!objects.ContainsKey("TotalFlow2"))
|
{
|
yield return
|
new ValidationResult(" objects [TotalFlow2]数据缺失", new[] { nameof(objects) });
|
}
|
else
|
{
|
if (objects["TotalFlow2"] < 1)
|
{
|
yield return
|
new ValidationResult($"二输水增水量过低! tag:TotalFlow2 Value:{objects["TotalFlow2"]}", new[] { nameof(objects) });
|
}
|
}
|
|
|
if (!objects.ContainsKey("TotalPressure2"))
|
{
|
yield return
|
new ValidationResult(" objects [TotalPressure2]数据缺失", new[] { nameof(objects) });
|
}
|
else
|
{
|
if (objects["TotalPressure2"] < 0.01)
|
{
|
yield return
|
new ValidationResult($"二输水增压过低! tag:TotalPressure2 Value:{objects["TotalPressure2"]}", new[] { nameof(objects) });
|
}
|
}
|
}
|
}
|
|
|
}
|
}
|