using System.Collections.Generic;
|
using System.Linq;
|
|
namespace PBS.WinFrmUI.Hydro.Dispatch.Model
|
{
|
/// <summary>
|
/// 组合运行判断
|
/// </summary>
|
public class CombineRunJudge
|
{
|
private CombineRunJudge() { }
|
/// <summary>
|
///
|
/// </summary>
|
/// <param name="ids_list">所有ID</param>
|
/// <param name="index_list">禁止只开机index组合列表</param>
|
public static CombineRunJudge BuildByOpenMachineIndex(List<long> ids_list, params int[] index_list)
|
{
|
CombineRunJudge c1 = new CombineRunJudge();
|
|
var must_open_machine_array = new List<long>();
|
for (int index = 0; index < ids_list.Count(); index++)
|
{
|
if (index_list.Contains(index))
|
{
|
must_open_machine_array.Add(ids_list[index]);
|
}
|
}
|
must_open_machine_array.Sort();
|
c1.open_machine_id_join_string = string.Join(",", must_open_machine_array);
|
return c1;
|
}
|
private string open_machine_id_join_string = null;
|
|
|
/// <summary>
|
/// 符合就true, 不满足就false
|
/// </summary>
|
/// <param name="open_machine_id_array"></param>
|
/// <returns></returns>
|
public bool Judgement(List<long> open_machine_id_array)
|
{
|
if (!string.IsNullOrEmpty(open_machine_id_join_string))
|
{
|
open_machine_id_array.Sort();
|
if (open_machine_id_join_string == string.Join(",", open_machine_id_array))
|
return true;
|
}
|
|
return false;
|
}
|
}
|
|
}
|