public IResult <IProductionBatchDetailReturn> Execute(LotKey lotKey, DateTime currentDate)
        {
            var predicate = lotKey.GetPredicate <ProductionBatch>();

            var batchDetails = _productionUnitOfWork.ProductionBatchRepository
                               .Filter(predicate)
                               .SplitSelect(ProductionBatchProjectors.SplitSelectDetail(_productionUnitOfWork, currentDate)).ToList()
                               .FirstOrDefault();

            if (batchDetails == null)
            {
                return(new InvalidResult <IProductionBatchDetailReturn>(null, string.Format(UserMessages.ProductionBatchNotFound, lotKey.KeyValue)));
            }

            return(CreateProductionBatchDetail(batchDetails));
        }
Exemple #2
0
        internal IResult <IProductionPacketReturn> Execute(ILotKey lotKey, DateTime currentDate)
        {
            var productionBatchKey = new LotKey(lotKey);
            var select             = ProductionBatchProjectors.SplitSelectProductionPacketFromBatch(_productionUnitOfWork, currentDate.Date, productionBatchKey);
            var productionPacket   = _productionUnitOfWork.ProductionBatchRepository
                                     .Filter(productionBatchKey.GetPredicate <ProductionBatch>())
                                     .SplitSelect(select)
                                     .ToList();

            if (productionPacket.Count != 1)
            {
                return(new InvalidResult <IProductionPacketReturn>(null, string.Format(UserMessages.ProductionBatchNotFound, productionBatchKey)));
            }

            return(Process(productionPacket.Single()));
        }