Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public Data PrepearingData()
        {
            //Импортируем данные из эксель.
            NomenclaturesList = _dataService.Import <Nomenclature>(_filesSettings.NomenclatureFile).ToList();
            MachinesList      = _dataService.Import <Machine>(_filesSettings.MachinesFile).ToList();
            TimesList         = _dataService.Import <Time>(_filesSettings.TimesFile).ToList();
            var batches = _dataService.Import <Batch>(_filesSettings.BatchesFile).ToList();

            //Заполняем очередь партий, проставляем ссылки на нужные объекты при необходимости.
            batches.ForEach(b => b.Nomenclature = NomenclaturesList.Find(n => n.Id == b.NomenclatureId));
            BatchesQueue = new Queue <Batch>(batches);

            TimesList.ForEach(t => t.Nomenclature = NomenclaturesList.Find(n => n.Id == t.Nomenclatureid));

            foreach (var machine in MachinesList)
            {
                var times = TimesList.Where(tl => tl.MachineId == machine.Id);
                machine.TimeDictionary = times.ToDictionary(t => t.Nomenclatureid, o => o.OperationTime);
            }
            var data = new Data(MachinesList, BatchesQueue);

            Log.Information("Данные подготовлены.");
            //Возвращаем подготовленные данные.
            return(data);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Отобразить рабочие промежутки
        /// </summary>
        private void ShowTimes()
        {
            int selectNumber = TimesList.CurrentRow != null ? TimesList.CurrentRow.Index : 0;

            m_TimesInfos = m_DatabaseTools.GetTimesRows(m_ProjectInfo.ID);
            TimesList.Rows.Clear();
            labelInfo.Text = "";
            foreach (Exchange.TimesInfo timeInfo in m_TimesInfos)
            {
                var param = new object[]
                {
                    timeInfo.DateStart.ToString(),
                                        timeInfo.DateStop != null?timeInfo.DateStop.ToString() : ""
                };
                TimesList.Rows.Add(param);
            }
            TimesList.Focus();

            if (TimesList.Rows.Count > 0)
            {
                if (selectNumber < TimesList.Rows.Count)
                {
                    TimesList.Rows[selectNumber].Cells[0].Selected = true;
                }
                else
                {
                    TimesList.Rows[TimesList.Rows.Count - 1].Cells[0].Selected = true;
                }
            }

            Color col = Color.FromArgb(255, 240, 240, 240);

            for (int i = 0; i < TimesList.Rows.Count; i += 2)
            {
                TimesList.Rows[i].DefaultCellStyle.BackColor = col;
            }

            if (m_TimesInfos.Length > 0 && m_TimesInfos[m_TimesInfos.Length - 1].DateStop == null)
            {
                buttonStart.Enabled = false;
                buttonStop.Enabled  = true;
                timerWork.Enabled   = true;
            }
            else
            {
                buttonStart.Enabled = true;
                buttonStop.Enabled  = false;
                timerWork.Enabled   = false;
            }

            var timesTools = new TimeTools();

            labelInfo.Text = "Общее время работы над проектом: " + timesTools.GetTimeFromSecond(GetAllSeconds(null));
        }
Ejemplo n.º 3
0
 private void Drop_Focus(object sender, EventArgs e)
 {
     TimesList.Focus();
 }