///todo если не пустая, то добывляем событие в кассу, касса запломбирована завкой, по окончанию работы заявка отправляется в очередь ///todo законченных, а касса идет искать заявку в очередь, если в очереди нет заявки такого типа, то ждет тик. ///todo Если очередб переполнена, то заявка попадает в массив пропущенных заявок void ServicesGenerate() { timertime = double.Parse(TimerTime.Text); double instance = 1000 * timertime / int.Parse(TimeInterval.Text); time1 = Convert.ToInt32(int.Parse(timeXCHG.Text) * instance); time2 = Convert.ToInt32(int.Parse(timeCARD.Text) * instance); time3 = Convert.ToInt32(int.Parse(timeCRED.Text) * instance); time4 = Convert.ToInt32(int.Parse(timeACNT.Text) * instance); m1[0] = new ServiceMachineTypeFirst(1, time1, time2); m1[1] = new ServiceMachineTypeFirst(2, time1, time2); m1[2] = new ServiceMachineTypeFirst(3, time1, time2); m2[0] = new ServiceMachineTypeSecond(4, time3, time4); m2[1] = new ServiceMachineTypeSecond(5, time3, time4); interval = new TimeSpan(0, int.Parse(TimeInterval.Text), 0); }
//Проверка пустая ли машина void CheckServiceMachineTypeFirst(ServiceMachineTypeFirst m, TextBlock block) { block.Background = Brushes.Green; block.Text = "Open!"; Request temp = new Request(-1); int i = 0; if (i == 0) { temp = this.reqlist.Find(RequestType.XCHG); if (temp.ID != -1) { i++; } } if (i == 0) { temp = this.reqlist.Find(RequestType.CARD); if (temp.ID != -1) { i++; } } if (i == 1) { block.Text = temp.Type.ToString(); block.Background = Brushes.Red; temp.TimeStarted = this.BeginTime; m.MethodOfTypeRequest(temp); if (temp.Type == RequestType.XCHG) { temp.TimeFinalized = this.BeginTime + TimeSpan.FromMinutes(Convert.ToInt32(int.Parse(timeXCHG.Text))); this.xchgcomplete++; } if (temp.Type == RequestType.CARD) { temp.TimeFinalized = this.BeginTime + TimeSpan.FromMinutes(Convert.ToInt32(int.Parse(timeCARD.Text))); this.cardcomplete++; } temp.RequestState = RequestStateType.Finalized; temp.MachineID = m.ID; this.reqcomplete.Add(temp); this.fcomplete++; } }