// получаем номенклатуру по партии private Nomenclatures GetNomenclature(Parties parties, ObservableCollection <Nomenclatures> nomenclatures) { foreach (var item in nomenclatures) { if (item.Id == parties.Nomenclature_id) { return(item); } } return(null); }
// распределение private void Distribution() { // партия -> номенклатура -> машина -> вычисление -> расписание while (party.Count > 0) { // берём следующую партию и возвращаем оставшиеся Parties current_party = GetParties(party, out var newParties); // определяем номенклатуру Nomenclatures current_nomenclature = GetNomenclature(current_party, nomenclatures); // выбираем для номенклатуры машину Machine_tools current_machine = GetMachine(current_nomenclature, machine_Tools, times); string partyName = current_nomenclature.Nomenclature; string equipmentName = current_machine.name; string tStart = current_machine.time.ToString(); string tStop = СalculationTime(current_machine, current_nomenclature, times); Raspisanies.Add(new Raspisanie { Party = partyName, Equipment = equipmentName, TStart = tStart, TStop = tStop }); } }