コード例 #1
0
        public void RecalculateYear()
        {
            if (_bufferhoursList != null)
            {
                _bufferhoursList.Sort(new ComparerAvailableBufferHours());

                int[] planned_sums = (ServerEnvironment.StoreToWorldService as StoreToWorldService).GetWorldWorkingHoursForYearAsWeeksSum(StoreWorld.ID, Year, true);
                int[] actual_sums  = (ServerEnvironment.StoreToWorldService as StoreToWorldService).GetWorldWorkingHoursForYearAsWeeksSum(StoreWorld.ID, Year, false);
                YearlyEstimatedWorldHoursBuilder estimateLoader = new YearlyEstimatedWorldHoursBuilder();
                int[] estimate_sums = estimateLoader.BuildYear(StoreWorld, Year);

                if (planned_sums != null && actual_sums != null && estimate_sums != null &&
                    planned_sums.Length == actual_sums.Length &&
                    planned_sums.Length == estimate_sums.Length &&
                    planned_sums.Length == NumberOfWeekInYear &&
                    _bufferhoursList.Count == planned_sums.Length &&
                    _bufferhoursList.Count == NumberOfWeekInYear)
                {
                    BufferHourAvailable buffer = null;

                    for (int i = 0; i < NumberOfWeekInYear; i++)
                    {
                        buffer = _bufferhoursList[i];
                        if (buffer.IsExistsEstimate)
                        {
                            buffer.SumActualBVEstimated = estimate_sums[i];
                        }
                        if (buffer.IsExistsPlanning)
                        {
                            buffer.SumFromPlanning = planned_sums[i];
                        }
                        if (buffer.IsExistsRecording)
                        {
                            buffer.SumFromRecording = actual_sums[i];
                        }
                    }
                }

                Update();
            }
        }
コード例 #2
0
        public void UpdateEstimation()
        {
            if (_bufferhoursList != null)
            {
                //EstimatedWorldHoursBuilder estimateBuilder = new EstimatedWorldHoursBuilder();

                _bufferhoursList.Sort(new ComparerAvailableBufferHours());
                //double prev_buffer = 0;
                //foreach (BufferHourAvailable entity in _bufferhoursList)
                //{
                //    if (entity.IsExistsEstimate)
                //    {
                //        entity.SumActualBVEstimated = estimateBuilder.Build(StoreWorld, entity.WeekBegin, entity.WeekEnd);
                //    }
                //}

                YearlyEstimatedWorldHoursBuilder estimateLoader = new YearlyEstimatedWorldHoursBuilder();
                int[] sums = estimateLoader.BuildYear(StoreWorld, Year);

                int iCount = Math.Min(_bufferhoursList.Count, sums.Length);
                if (sums.Length != _bufferhoursList.Count)
                {
                    Debug.Assert(false);
                }

                BufferHourAvailable buffer = null;
                for (int i = 0; i < iCount; i++)
                {
                    buffer = _bufferhoursList[i];
                    if (buffer.IsExistsEstimate)
                    {
                        buffer.SumActualBVEstimated = sums[i];// estimateBuilder.Build(StoreWorld, entity.WeekBegin, entity.WeekEnd);
                    }
                }
            }
        }