Exemplo n.º 1
0
 public MaterialBatchFacade(
     ILog log,
     IVirtualProductFacade virtualProductFacade,
     IMaterialBatchRepository batchRepository,
     IPurchaseOrderRepository orderRepository,
     AmountProcessor amountProcessor,
     ICache cache,
     IDatabase database,
     IPackingPreferredBatchRepository batchPreferrenceRepository,
     IKitProductRepository kitProductRepository,
     IUnitConversionHelper conversionHelper,
     IMaterialThresholdRepository materialThresholdRepository,
     IMaterialRepository materialRepository,
     IUnitRepository unitRepository,
     IStockEventRepository stockEventRepository,
     ISession session,
     IFixedCostRepository fixedCostRepository)
 {
     m_log = log;
     m_virtualProductFacade = virtualProductFacade;
     m_batchRepository      = batchRepository;
     m_orderRepository      = orderRepository;
     m_amountProcessor      = amountProcessor;
     m_cache    = cache;
     m_database = database;
     m_batchPreferrenceRepository  = batchPreferrenceRepository;
     m_kitProductRepository        = kitProductRepository;
     m_conversionHelper            = conversionHelper;
     m_materialThresholdRepository = materialThresholdRepository;
     m_materialRepository          = materialRepository;
     m_unitRepository       = unitRepository;
     m_stockEventRepository = stockEventRepository;
     m_session             = session;
     m_fixedCostRepository = fixedCostRepository;
 }
Exemplo n.º 2
0
        public bool Populate(ISaleEventAllocation entity, AmountProcessor amountProcessor)
        {
            if (SaleEventId != 0 && SaleEventId != entity.SaleEventId)
            {
                return(false);
            }

            SaleEventId = entity.SaleEventId;

            if (string.IsNullOrWhiteSpace(EventName))
            {
                EventName = entity.SaleEvent.Name;
                SortDt    = entity.ReturnDt ?? entity.AllocationDt;
                Author    = entity.AllocationUser?.EMail;
            }

            m_blockedAmount  = amountProcessor.Add(m_blockedAmount, new Amount(entity.AllocatedQuantity, entity.Unit));
            m_returnedAmount = amountProcessor.Add(m_returnedAmount, new Amount(entity.ReturnedQuantity ?? 0m, entity.Unit));

            if (m_returnedAmount == null)
            {
                m_usedAmount = m_blockedAmount;
            }

            m_usedAmount = amountProcessor.Subtract(m_blockedAmount, m_returnedAmount);

            return(true);
        }
Exemplo n.º 3
0
 public BatchReportingFacade(ISession session,
                             IDatabase database,
                             IMaterialBatchFacade batchFacade,
                             IMaterialBatchRepository batchRepository,
                             IMaterialRepository materialRepository,
                             IProductionFacade productionFacade,
                             AmountProcessor amountProcessor,
                             IUnitRepository unitRepository,
                             IOrdersFacade ordersFacade,
                             IOrderStatusRepository orderStatusRepository,
                             IPurchaseOrderRepository orderRepository,
                             IUserRepository userRepository,
                             IStockEventRepository stockEventRepository,
                             ISaleEventRepository saleEventRepository)
 {
     m_session               = session;
     m_database              = database;
     m_batchFacade           = batchFacade;
     m_batchRepository       = batchRepository;
     m_materialRepository    = materialRepository;
     m_productionFacade      = productionFacade;
     m_amountProcessor       = amountProcessor;
     m_unitRepository        = unitRepository;
     m_ordersFacade          = ordersFacade;
     m_orderStatusRepository = orderStatusRepository;
     m_orderRepository       = orderRepository;
     m_userRepository        = userRepository;
     m_stockEventRepository  = stockEventRepository;
     m_saleEventRepository   = saleEventRepository;
 }
 public ReturnedOrdersFormGenerator(IMaterialBatchFacade batchFacade, IInvoiceFormsRepository invoiceFormsRepository, IMaterialRepository materialRepository, IPurchaseOrderRepository orderRepository, IUnitRepository unitRepository, AmountProcessor amountProcessor, IStockEventRepository stockEventRepository) : base(batchFacade, invoiceFormsRepository, materialRepository)
 {
     m_materialRepository   = materialRepository;
     m_orderRepository      = orderRepository;
     m_unitRepository       = unitRepository;
     m_amountProcessor      = amountProcessor;
     m_stockEventRepository = stockEventRepository;
 }
Exemplo n.º 5
0
 public SetComponents(IMaterialRepository materialRepository, IUnitRepository unitRepository, AmountProcessor amountProcessor, IMaterialBatchFacade batchFacade, IMaterialBatchRepository batchRepository)
 {
     m_materialRepository = materialRepository;
     m_unitRepository     = unitRepository;
     m_amountProcessor    = amountProcessor;
     m_batchFacade        = batchFacade;
     m_batchRepository    = batchRepository;
 }
Exemplo n.º 6
0
 public ApplyResultingMaterial(IMaterialRepository materialRepository, IMaterialFacade materialFacade,
                               IUnitRepository unitRepository, IUnitConversionHelper conversionHelper, AmountProcessor amountProcessor)
 {
     m_materialRepository = materialRepository;
     m_materialFacade     = materialFacade;
     m_unitRepository     = unitRepository;
     m_conversionHelper   = conversionHelper;
     m_amountProcessor    = amountProcessor;
 }
Exemplo n.º 7
0
 public StockEventsController(IWebSession webSession, ILog log, IStockEventRepository eventRepository,
                              IMaterialBatchFacade batchFacade,
                              IMaterialBatchRepository batchRepository, AmountProcessor amountProcessor)
     : base(webSession, log)
 {
     m_eventRepository = eventRepository;
     m_batchFacade     = batchFacade;
     m_batchRepository = batchRepository;
     m_amountProcessor = amountProcessor;
 }
Exemplo n.º 8
0
 public SaleEventRepository(IDatabase database, ICache cache, ISession session, IServiceLocator serviceLocator, IMaterialBatchFacade batchFacade, IMaterialRepository materialRepository, AmountProcessor amountProcessor)
 {
     m_database           = database;
     m_cache              = cache;
     m_session            = session;
     m_serviceLocator     = serviceLocator;
     m_batchFacade        = batchFacade;
     m_materialRepository = materialRepository;
     m_amountProcessor    = amountProcessor;
 }
Exemplo n.º 9
0
 public ApplySourceSegmentId(IMaterialBatchRepository batchRepository,
                             IMaterialBatchFacade batchFacade,
                             AmountProcessor amountProcessor,
                             IRecipeRepository recipeRepository, IMaterialRepository materialRepository, IUnitRepository unitRepository)
 {
     m_batchRepository    = batchRepository;
     m_batchFacade        = batchFacade;
     m_amountProcessor    = amountProcessor;
     m_recipeRepository   = recipeRepository;
     m_materialRepository = materialRepository;
     m_unitRepository     = unitRepository;
 }
Exemplo n.º 10
0
 public MaterialLevelsLoader(ISession session, IDatabase database, AmountProcessor amountProcessor,
                             IUnitRepository unitRepository, IMaterialThresholdRepository thresholdRepository, ICache cache, IMaterialRepository materialRepository, IInventoryWatchRepository inventoryWatchRepository)
 {
     m_session             = session;
     m_database            = database;
     m_amountProcessor     = amountProcessor;
     m_unitRepository      = unitRepository;
     m_thresholdRepository = thresholdRepository;
     m_cache = cache;
     m_materialRepository       = materialRepository;
     m_inventoryWatchRepository = inventoryWatchRepository;
 }
Exemplo n.º 11
0
 public ProductionFacade(
     IDatabase database,
     IMaterialBatchRepository batchRepository,
     IMaterialRepository materialRepository,
     IUnitConversionHelper unitConversion,
     AmountProcessor amountProcessor,
     ILog log,
     IMaterialBatchFacade batchFacade, IUnitRepository unitRepository, ISession session)
 {
     m_database           = database;
     m_batchRepository    = batchRepository;
     m_materialRepository = materialRepository;
     m_unitConversion     = unitConversion;
     m_amountProcessor    = amountProcessor;
     m_log            = log;
     m_batchFacade    = batchFacade;
     m_unitRepository = unitRepository;
     m_session        = session;
 }
Exemplo n.º 12
0
 public StockEventRepository(IPerProjectDbCache cache,
                             Lazy <IMaterialBatchFacade> batchFacade,
                             IMaterialBatchRepository batchRepository,
                             AmountProcessor amountProcessor,
                             IMaterialRepository materialRepository,
                             ISession session,
                             IDatabase database, IUnitRepository unitRepository, IUnitConversionHelper conversionHelper,
                             IPurchaseOrderRepository orderRepository, IServiceLocator serviceLocator)
 {
     m_cache              = cache;
     m_batchFacade        = batchFacade;
     m_batchRepository    = batchRepository;
     m_amountProcessor    = amountProcessor;
     m_materialRepository = materialRepository;
     m_session            = session;
     m_database           = database;
     m_unitRepository     = unitRepository;
     m_conversionHelper   = conversionHelper;
     m_orderRepository    = orderRepository;
     m_serviceLocator     = serviceLocator;
 }
Exemplo n.º 13
0
 public void Join(StockEventViewModel rawEvent, AmountProcessor amountProcessor)
 {
     m_amount = amountProcessor.Add(m_amount, rawEvent.m_amount);
 }
Exemplo n.º 14
0
        public static IEnumerable <MaterialBatchViewModel> JoinAutomaticBatches(IEnumerable <MaterialBatchViewModel> source, AmountProcessor processor)
        {
            var targetList = new List <MaterialBatchViewModel>();

            foreach (var batch in source.OrderBy(i => i.MaterialId))
            {
                if (batch.AutomaticBatches && (targetList.LastOrDefault()?.MaterialId == batch.MaterialId))
                {
                    var joined = targetList.Last();
                    joined.BatchNumber = null;
                    joined.Id          = null;

                    var sum = processor.Add(processor.ToAmount(batch.Volume, batch.UnitName),
                                            processor.ToAmount(joined.Volume, joined.UnitName));

                    joined.UnitName = sum.Unit.Symbol;
                    joined.Volume   = sum.Value;

                    continue;
                }

                targetList.Add(batch);
            }

            return(targetList);
        }