Пример #1
0
        public IResult ValidForPicking(PickingValidatorContext context)
        {
            if (!string.IsNullOrWhiteSpace(context.ContractKey) && _contractAllowances.Contains(context.ContractKey))
            {
                return(new SuccessResult());
            }

            if (!string.IsNullOrWhiteSpace(context.CustomerOrderKey) && _customerOrderAllowances.Contains(context.CustomerOrderKey))
            {
                return(new SuccessResult());
            }

            if (!string.IsNullOrWhiteSpace(context.CustomerKey) && _customerAllowances.Contains(context.CustomerKey))
            {
                return(new SuccessResult());
            }

            var invalidResults = context.AttributeSpecs
                                 .Select(s => s.Value.IsValidForPicking(_attributeAndDefects, s.Key, _lotKey, _lotQualityStatus))
                                 .Where(r => !r.Success)
                                 .ToList();

            if (invalidResults.Any())
            {
                return(new InvalidResult(invalidResults.CombineMessages()));
            }

            return(new SuccessResult());
        }
Пример #2
0
 internal ValidPickingForOrder(PickingValidatorContext validatorContext)
 {
     _context = validatorContext;
 }