Esempio n. 1
0
        private IList <MovementMonitorOverviewViewResult> UpdateChartData()
        {
            List <MovementMonitorOverviewViewResult> tmpData = new List <MovementMonitorOverviewViewResult>();

            ChartDataValues chartValues = new ChartDataValues();

            int index = 0;

            if (_originalData != null)
            {
                foreach (MovementMonitorOverviewViewResult data in _originalData)
                {
                    if (data.TimeStamp == null)
                    {
                        chartValues.SetLaggingValues(data);

                        continue;
                    }

                    index++;

                    if (index == 1)
                    {
                        chartValues.SetDateTimeForNewTimeSlot(data.TimeStamp.GetValueOrDefault());

                        chartValues.LoadSaldoToNewTimeSlot(data);
                    }


                    chartValues.IncValuesInTimeSlot(data);

                    chartValues.RecalcSaldoInTimeSlot(data);

                    if (index == _duration)
                    {
                        MovementMonitorOverviewViewResult newData = new MovementMonitorOverviewViewResult();

                        newData.NoTrpAssInc = chartValues.noTrpAss;

                        newData.NoTrpAssLateInc = chartValues.noTrpAssLate;

                        newData.NoLiftTruksCapacityInc = chartValues.noLiftTruksCapacity;


                        newData.TimeStamp    = chartValues.date;
                        newData.TimeSpanText = chartValues.date.ToString("HH:mm") + "-" + chartValues.date.AddMinutes((_duration - 1)).ToString("HH:mm") + "\r" + chartValues.date.ToString("dd MMM");

                        tmpData.Add(newData);

                        chartValues.ResetValues();

                        index = 0;
                    }
                }
            }

            try
            {
                if (tmpData.Count > 0)
                {
                    MovementMonitorOverviewViewResult laggingWork = new MovementMonitorOverviewViewResult();

                    laggingWork.TimeStamp    = tmpData[0].TimeStamp.GetValueOrDefault().AddMinutes(-_duration);
                    laggingWork.TimeSpanText = "<";

                    MovementMonitorOverviewViewResult laggingWorkDummy = new MovementMonitorOverviewViewResult();

                    laggingWorkDummy.TimeStamp    = laggingWork.TimeStamp;
                    laggingWorkDummy.TimeSpanText = "<";

                    tmpData.Insert(0, laggingWorkDummy);

                    laggingWork.NoTrpAssLateInc = chartValues.LaggingTrpAss;

                    laggingSerie.ItemsSource = new MovementMonitorOverviewViewResult[] { laggingWork };

                    _capacitySerie.ItemsSource    = tmpData;
                    workloadSerie.ItemsSource     = tmpData;
                    workloadLateSerie.ItemsSource = tmpData;

                    tmpData.RemoveAt(0);
                }
                else
                {
                    laggingSerie.ItemsSource      = null;
                    _capacitySerie.ItemsSource    = null;
                    workloadSerie.ItemsSource     = null;
                    workloadLateSerie.ItemsSource = null;
                }
            }
            catch (Exception ex)
            {
            }

            return(tmpData);
        }
Esempio n. 2
0
        private IList <LoadingMonitorOverviewViewResult> UpdateChartData()
        {
            List <LoadingMonitorOverviewViewResult> tmpData = new List <LoadingMonitorOverviewViewResult>();

            ChartDataValues chartValues = new ChartDataValues();

            int index = 0;

            if (_originalData != null)
            {
                foreach (LoadingMonitorOverviewViewResult data in _originalData)
                {
                    if (data.TimeStamp == null)
                    {
                        chartValues.SetLaggingValues(data);

                        continue;
                    }

                    index++;

                    if (index == 1)
                    {
                        chartValues.SetDateTimeForNewTimeSlot(data.TimeStamp.GetValueOrDefault());

                        chartValues.LoadSaldoToNewTimeSlot(data);
                    }


                    chartValues.IncValuesInTimeSlot(data);

                    chartValues.RecalcSaldoInTimeSlot(data);

                    if (index == _duration)
                    {
                        //chartValues.CalcBurnDown();

                        LoadingMonitorOverviewViewResult newData = new LoadingMonitorOverviewViewResult();

                        newData.NoCars = Math.Round(chartValues.noCars);
                        newData.Weight = chartValues.weight;
                        newData.Volume = chartValues.volume;

                        newData.NoCarsLate = Math.Round(chartValues.noCarsLate);
                        newData.WeightLate = chartValues.weightLate;
                        newData.VolumeLate = chartValues.volumeLate;

                        newData.NoUsersInc     = chartValues.noUsersCapacity;
                        newData.NoCarsCapacity = Math.Round(chartValues.noCarsCapacity);
                        newData.WeightCapacity = chartValues.weightCapacity;
                        newData.VolumeCapacity = chartValues.volumeCapacity;

                        //newData.NoCarsCapacityDec = chartValues.noCarsBurnDown == 0 ? null : (decimal?)chartValues.noCarsBurnDown;
                        //newData.WeightCapacityDec = chartValues.weightBurnDown == 0 ? null : (decimal?)chartValues.weightBurnDown;
                        //newData.VolumeCapacityDec = chartValues.volumeBurnDown == 0 ? null : (decimal?)chartValues.volumeBurnDown;

                        newData.TimeStamp    = chartValues.date;
                        newData.TimeSpanText = chartValues.date.ToString("HH:mm") + "-" + chartValues.date.AddMinutes((_duration - 1)).ToString("HH:mm") + "\r" + chartValues.date.ToString("dd MMM");

                        tmpData.Add(newData);

                        chartValues.ResetValues();

                        index = 0;
                    }
                }
            }

            try
            {
                if (tmpData.Count > 0)
                {
                    LoadingMonitorOverviewViewResult laggingWork = new LoadingMonitorOverviewViewResult();

                    laggingWork.TimeStamp    = tmpData[0].TimeStamp.GetValueOrDefault().AddMinutes(-_duration);
                    laggingWork.TimeSpanText = "<";

                    LoadingMonitorOverviewViewResult laggingWorkDummy = new LoadingMonitorOverviewViewResult();

                    laggingWorkDummy.TimeStamp    = laggingWork.TimeStamp;
                    laggingWorkDummy.TimeSpanText = "<";

                    tmpData.Insert(0, laggingWorkDummy);

                    laggingWork.NoCarsLate = chartValues.LaggingCars;
                    laggingWork.WeightLate = chartValues.Laggingweight;
                    laggingWork.VolumeLate = chartValues.Laggingvolume;

                    laggingSerie.ValueBinding = new Telerik.Windows.Controls.ChartView.PropertyNameDataPointBinding()
                    {
                        PropertyName = _valueBinding + "Late"
                    };

                    laggingSerie.ItemsSource = new LoadingMonitorOverviewViewResult[] { laggingWork };


                    workloadSerie.ValueBinding = new Telerik.Windows.Controls.ChartView.PropertyNameDataPointBinding()
                    {
                        PropertyName = _valueBinding
                    };
                    workloadLateSerie.ValueBinding = new Telerik.Windows.Controls.ChartView.PropertyNameDataPointBinding()
                    {
                        PropertyName = _valueBinding + "Late"
                    };
                    _capacitySerie.ValueBinding = new Telerik.Windows.Controls.ChartView.PropertyNameDataPointBinding()
                    {
                        PropertyName = _valueBinding + "Capacity"
                    };
                    //_burndownSerie.ValueBinding = new Telerik.Windows.Controls.ChartView.PropertyNameDataPointBinding() { PropertyName = _valueBinding.Substring(0, _valueBinding.Length - 3) + "CapacityDec" };

                    //_burndownSerie.ItemsSource = tmpData;
                    _capacitySerie.ItemsSource    = tmpData;
                    workloadSerie.ItemsSource     = tmpData;
                    workloadLateSerie.ItemsSource = tmpData;

                    tmpData.RemoveAt(0);
                }
                else
                {
                    //_burndownSerie.ItemsSource = null;
                    laggingSerie.ItemsSource      = null;
                    _capacitySerie.ItemsSource    = null;
                    workloadSerie.ItemsSource     = null;
                    workloadLateSerie.ItemsSource = null;
                }
            }
            catch (Exception ex)
            {
            }

            return(tmpData);
        }