예제 #1
0
        public IResult <IQueryable <IPackScheduleSummaryReturn> > GetPackSchedules()
        {
            var packScheduleSummaryReturns = _productionUnitOfWork.PackScheduleRepository.All()
                                             .SplitSelect(PackScheduleProjectors.SplitSelectSummary());

            return(new SuccessResult <IQueryable <IPackScheduleSummaryReturn> >(packScheduleSummaryReturns));
        }
예제 #2
0
        public IResult <IPackScheduleDetailReturn> GetPackSchedule(string packScheduleKey)
        {
            if (packScheduleKey == null)
            {
                throw new ArgumentNullException("packScheduleKey");
            }

            var packScheduleKeyResult = KeyParserHelper.ParseResult <IPackScheduleKey>(packScheduleKey);

            if (!packScheduleKeyResult.Success)
            {
                return(packScheduleKeyResult.ConvertTo <IPackScheduleDetailReturn>());
            }

            var key          = new PackScheduleKey(packScheduleKeyResult.ResultingObject);
            var packSchedule = _productionUnitOfWork.PackScheduleRepository
                               .FilterByKey(key)
                               .SplitSelect(PackScheduleProjectors.SplitSelectDetail())
                               .FirstOrDefault();

            if (packSchedule == null)
            {
                return(new InvalidResult <IPackScheduleDetailReturn>(null, string.Format(UserMessages.PackScheduleNotFound, key)));
            }

            return(new SuccessResult <IPackScheduleDetailReturn>(packSchedule));
        }
예제 #3
0
        internal IResult <IProductionPacketReturn> Execute(IPackScheduleKey packScheduleKey, DateTime currentDate)
        {
            var parsedPackScheduleKey = new PackScheduleKey(packScheduleKey);
            var productionPacket      = _productionUnitOfWork.PackScheduleRepository
                                        .Filter(parsedPackScheduleKey.FindByPredicate)
                                        .SplitSelect(PackScheduleProjectors.SplitSelectProductionPacket(_productionUnitOfWork, currentDate.Date))
                                        .ToList();

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

            return(Process(productionPacket.Single()));
        }
예제 #4
0
        public IResult <IPackSchedulePickSheetReturn> GetPackSchedulePickSheet(string packScheduleKey)
        {
            var packScheduleKeyResult = KeyParserHelper.ParseResult <IPackScheduleKey>(packScheduleKey);

            if (!packScheduleKeyResult.Success)
            {
                return(packScheduleKeyResult.ConvertTo <IPackSchedulePickSheetReturn>());
            }

            var pickSheet = _productionUnitOfWork.PackScheduleRepository
                            .Filter(new PackScheduleKey(packScheduleKeyResult.ResultingObject).FindByPredicate)
                            .SplitSelect(PackScheduleProjectors.SplitSelectPickSheet(_productionUnitOfWork, _timeStamper.CurrentTimeStamp.Date))
                            .FirstOrDefault();

            if (pickSheet == null)
            {
                return(new InvalidResult <IPackSchedulePickSheetReturn>(null, string.Format(UserMessages.PackScheduleNotFound, packScheduleKey)));
            }

            return(new SuccessResult <IPackSchedulePickSheetReturn>(pickSheet));
        }