public OrderDetailViewModel(RequestDetail requestDetail, ICollection<StockInformation> stockInformations, ICollection<ApprovedDetail> approvedDetails, Forcasting forcasting, ConsumptionSetting consumptionSetting)
 {
     _requestDetail = requestDetail;
     _stockInformations = stockInformations;
     _approvedDetails = approvedDetails;
     _forcasting = forcasting;
     _consumptionSetting = consumptionSetting;
     _hasManyActivity = getActivityViewModels().Count > 2;
     _hasManyManufacturer = getManufacturerViewModels().Count > 2;
     _hasExpiryDatePreference = getExpiryDateViewModels().Count > 2;
     _hasPhysicalStorePreference = getPhysicalStoreViewModels().Count > 2;
     _allowAdd = _hasManyActivity || _hasManyManufacturer || _hasExpiryDatePreference || _hasPhysicalStorePreference;
     _allowRemove = RequestedQuantity == 0;
     if (_requestDetail.ActivityGroup == null)
     {
         var stockInformation = _stockInformations.OrderBy(s => s.ExpiryDate).FirstOrDefault();
         if (stockInformation != null)
         {
             _requestDetail.ActivityGroup = stockInformation.Activity;
         }
     }
     if (_requestDetail.IsFirstLoad)
     {
         if (_requestDetail.RequestedQuantity >= AvailableQuantity)
         {
             _requestDetail.ApprovedQuantity = AvailableQuantity;
         }
     }
 }
        public OrderViewModel(Request request, ICollection<StockInformation> stockInformations,ICollection<ApprovedDetail> approvedDetails , ICollection<Forcasting> otherStockInformations,ConsumptionSetting consumptionSetting)
        {
            _request = request;
            _stockInformations = stockInformations;
            _approvedDetails = approvedDetails;
            _otherStockInformations = otherStockInformations;
            _consumptionSetting = consumptionSetting;
            _consumptionSettingViewModel = new ConsumptionSettingViewModel(consumptionSetting);
            LoadOrderDetails();

            if (BLL.Settings.AllowPreferedPhysicalStoreForAllItemsOnApproval)
                LoadDistinctPhysicalStores();
        }
        public Stockstatus getStockStatus(decimal Soh,ConsumptionSetting consumptionSetting )
        {
            var mos = getMos(Soh);
               if(mos > consumptionSetting.Max)
               {
               return Stockstatus.Excess;
               }
            if(mos > consumptionSetting.Min && mos < consumptionSetting.Max)
            {
                return Stockstatus.Normal;
            }
            if (mos > consumptionSetting.EOP && mos < consumptionSetting.Min)
            {
                return Stockstatus.NearEOP;
            }
            if (mos > 0 && mos < consumptionSetting.EOP)
            {
                return Stockstatus.BelowEOP;
            }

            return Stockstatus.StockOut;
        }
Ejemplo n.º 4
0
        public Stockstatus getStockStatus(decimal Soh, ConsumptionSetting consumptionSetting)
        {
            var mos = getMos(Soh);

            if (mos > consumptionSetting.Max)
            {
                return(Stockstatus.Excess);
            }
            if (mos > consumptionSetting.Min && mos < consumptionSetting.Max)
            {
                return(Stockstatus.Normal);
            }
            if (mos > consumptionSetting.EOP && mos < consumptionSetting.Min)
            {
                return(Stockstatus.NearEOP);
            }
            if (mos > 0 && mos < consumptionSetting.EOP)
            {
                return(Stockstatus.BelowEOP);
            }

            return(Stockstatus.StockOut);
        }
 public void Initialize()
 {
     LoadActivity();
     LoadManufacturer();
     LoadPhysicalStore();
     consumptionSetting = _consumptionRepository.FindCurrentSetting();
     requestBindingSource.DataSource = new OrderViewModel();
 }