private static void Initialize(LabReportChileLotReturn chileLot) { if (chileLot.WeightedAttributes == null) { chileLot.WeightedAttributes = new List <WeightedLotAttributeReturn>(); } if (chileLot.PickedLots == null) { chileLot.PickedLots = new List <PickedLotReturn>(); } }
private void SetValidToPick(LabReportChileLotReturn chileLot) { var customerKey = chileLot.PackScheduleBaseReturn != null && chileLot.PackScheduleBaseReturn.Customer != null ? chileLot.PackScheduleBaseReturn.Customer.CustomerKeyReturn : null; IDictionary <AttributeNameKey, ChileProductAttributeRange> productSpec; IDictionary <AttributeNameKey, CustomerProductAttributeRange> customerSpec; if (!new GetProductSpecCommand(_lotUnitOfWork).Execute(ChileProductKey.FromProductKey(chileLot.ChileProductKeyReturn), customerKey, out productSpec, out customerSpec).Success) { chileLot.ValidToPick = true; } var lot = _lotUnitOfWork.LotRepository.FindByKey(chileLot.LotKeyReturn.ToLotKey(), l => l.ContractAllowances, l => l.SalesOrderAllowances, l => l.CustomerAllowances, l => l.Attributes, l => l.AttributeDefects.Select(a => a.LotDefect.Resolution)); var context = new PickingValidatorContext(productSpec, customerSpec, null, null, customerKey); var validator = new PickingValidator(lot).ValidForPicking(context); chileLot.ValidToPick = validator.Success; }