using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace IStation.Calculation.DispatchAna.Model { /// /// 组合运行判断 /// public class CombineRunJudge { private CombineRunJudge() { } /// /// /// /// 所有ID /// 禁止只开机index组合列表 public static CombineRunJudge BuildByOpenMachineIndex(List ids_list, params int[] index_list) { CombineRunJudge c1 = new CombineRunJudge(); var must_open_machine_array = new List(); 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; /// /// 符合就true, 不满足就false /// /// /// public bool Judgement(List 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; } } }