Пример #1
0
 public BinItemController(IMapper mapper, IBinItemRepository binItemRepository, CSVService csvHandler,
                          IBinRepository binRepository, IItemRepository itemRepository, IShippingRepository shippingRepository,
                          IReceivingRepository receivingRepository, IReceivingItemRepository receivingItemRepository)
 {
     _csvHandler              = csvHandler;
     _itemRepository          = itemRepository;
     _binRepository           = binRepository;
     _mapper                  = mapper;
     _binItemRepository       = binItemRepository;
     _shippingRepository      = shippingRepository;
     _receivingRepository     = receivingRepository;
     _receivingItemRepository = receivingItemRepository;
 }
 //Custom Code End
 //Custom Code Start | Replaced Code Block
 //Replaced Code Block Start
 //public ReceivingService(IReceivingRepository receivingRepository)
 //Replaced Code Block End
 public ReceivingService(IReceivingRepository receivingRepository, IHandlingUnitsService handlingunitsService, IInventoryUnitsService inventoryunitsService, IInventoryUnitTransactionContextsService inventoryunittransactioncontextsService, IInboundOrdersService inboundordersService, IInboundOrderLinesService inboundorderlinesService, CommonLookUps commonLookUps)
 //Custom Code End
 {
     _receivingRepository = receivingRepository;
     //Custom Code Start | Added Code Block
     _handlingunitsService  = handlingunitsService;
     _inventoryunitsService = inventoryunitsService;
     _inventoryunittransactioncontextsService = inventoryunittransactioncontextsService;
     _ixInventoryUnitTransactionContext       = _inventoryunittransactioncontextsService.IndexDb().Where(x => x.sInventoryUnitTransactionContext == "Receiving").Select(x => x.ixInventoryUnitTransactionContext).FirstOrDefault();
     _inboundordersService     = inboundordersService;
     _inboundorderlinesService = inboundorderlinesService;
     _commonLookUps            = commonLookUps;
     //Custom Code End
 }
Пример #3
0
 public ReceivingController(UserManager <AppUser> userManager, IShippingRepository shippingRepository,
                            IVenderRepository venderRepository, IERPRepository eRPRepository, IMapper mapper,
                            IReceivingItemRepository receivingItemRepository, IReceivingRepository receivingRepository,
                            IItemRepository itemRepository)
 {
     _mapper                  = mapper;
     _shippingRepository      = shippingRepository;
     _userManager             = userManager;
     _venderRepository        = venderRepository;
     _erpRepository           = eRPRepository;
     _receivingItemRepository = receivingItemRepository;
     _receivingRepository     = receivingRepository;
     _itemRepository          = itemRepository;
 }
Пример #4
0
        public ReceivingPostValidator(IReceivingRepository receivingRepository, VolumeAndWeight volumeAndWeight, IHandlingUnitsRepository handlingunitsRepository, IInventoryUnitsRepository inventoryunitsRepository, IMaterialsRepository materialsRepository, IInventoryLocationsRepository inventorylocationsRepository, IInboundOrderLinesRepository inboundorderlinesRepository)
        {
            _receivingRepository          = receivingRepository;
            _handlingunitsRepository      = handlingunitsRepository;
            _inventoryunitsRepository     = inventoryunitsRepository;
            _materialsRepository          = materialsRepository;
            _inventorylocationsRepository = inventorylocationsRepository;
            _volumeAndWeight             = volumeAndWeight;
            _inboundorderlinesRepository = inboundorderlinesRepository;

            //InventoryUnitsPost _inventoryUnit = new InventoryUnitsPost();

            RuleFor(rec => rec.sReceipt)
            .NotEmpty()
            .WithMessage("Please enter a handling unit identifier.");

            When(rec => rec.sReceipt.Trim() != "" && !_handlingunitsRepository.IndexDb().Where(x => x.sHandlingUnit == rec.sReceipt.Trim()).Any(), () =>
            {
                RuleFor(u => u.ixHandlingUnitType)
                .NotEqual(0)
                .NotEmpty()
                .WithMessage("This is a new handling unit, please select a handling unit type.");
            }
                 );

            When(rec => (rec.ixMaterialHandlingUnitConfiguration ?? 0) > 0, () =>
            {
                RuleFor(u => u.nHandlingUnitQuantity)
                .NotEmpty()
                .WithMessage("When using a material handling unit configuration, you must enter a Handling Unit Quantity greater than 0.");
            }
                 );

            //When(rec => rec.sSerialNumber.Trim() != "", () =>
            //{
            //    RuleFor(u => u.nBaseUnitQuantityReceived)
            //    .Equal(1)
            //    .WithMessage("When entering a serial number, the Base Unit Quantity Received must be 1.");
            //}
            //);

            RuleFor(u => u.nBaseUnitQuantityReceived)
            .GreaterThanOrEqualTo(0)
            .WithMessage("The Base Unit Quantity Received must be a positive number.");

            When(rec => _materialsRepository.GetPost(rec.ixMaterial).bTrackSerialNumber, () =>
            {
                RuleFor(iu => iu.sSerialNumber)
                .NotEmpty()
                .WithMessage("The material is serial tracked. Please enter a serial number.");
            }
                 );

            When(rec => _materialsRepository.GetPost(rec.ixMaterial).bTrackSerialNumber, () =>
            {
                RuleFor(iu => iu.nBaseUnitQuantityReceived)
                .LessThanOrEqualTo(1)
                .WithMessage("The material is serial tracked. The base unit quantity must be 0 or 1");
            }
                 );

            When(rec => _materialsRepository.GetPost(rec.ixMaterial).bTrackBatchNumber, () =>
            {
                RuleFor(iu => iu.sBatchNumber)
                .NotEmpty()
                .WithMessage("The material is batch tracked. Please enter a batch.");
            }
                 );

            When(rec => _materialsRepository.GetPost(rec.ixMaterial).bTrackExpiry, () =>
            {
                RuleFor(iu => iu.dtExpireAt)
                .NotEmpty()
                .WithMessage("The material is expiry tracked. Please enter an expiry date.");
            }
                 );

            // When(rec => !_volumeAndWeight.inventoryUnitWillFitLocation(new InventoryUnitsPost
            //     { ixFacility = _receivingRepository.InboundOrdersDb().Where(x => x.ixInboundOrder == rec.ixInboundOrder).Select(x => x.ixFacility).FirstOrDefault(),
            //       ixCompany = _receivingRepository.InboundOrdersDb().Where(x => x.ixInboundOrder == rec.ixInboundOrder).Select(x => x.ixCompany).FirstOrDefault(),
            //       ixMaterial = rec.ixMaterial,
            //       ixInventoryState = _inventoryunitsRepository.InventoryStatesDb().Where(x => x.sInventoryState == "")
            // }, _inventorylocationsRepository.GetPost(rec.ixInventoryLocation)), () =>
            //{
            //    RuleFor(u => u.ixInventoryLocation)
            //    .Empty()
            //    .WithMessage("The inventory will not fit into the selected location.");
            //}
            // );

            When(rec => _inboundorderlinesRepository.IndexDb().Where(x => x.ixInboundOrder == rec.ixInboundOrder && x.ixMaterial == rec.ixMaterial).Select(x => x.nBaseUnitQuantityExpected - x.nBaseUnitQuantityReceived).Sum() < rec.nBaseUnitQuantityReceived, () =>
            {
                RuleFor(r => r.nBaseUnitQuantityReceived)
                .LessThan(0)
                .WithMessage("The Base Unit Quantity Received exceeds the open quantity on the inbound order.");
            }
                 );
        }
 public ReceivingService(IReceivingRepository repo)
 {
     this.repository = repo;
 }
 public ReceivingService(IReceivingRepository receivingRepository, IUnitOfWork unitOfWork, IPlayerRepository playerRepository)
 {
     _receivingRepository = receivingRepository;
     _unitOfWork          = unitOfWork;
     _playerRepository    = playerRepository;
 }
Пример #7
0
 public ReceivingService(IReceivingRepository receivingRepository)
 {
     ReceivingRepository = receivingRepository;
 }
        public InboundOrderLinesPostValidator(IReceivingRepository receivingRepository, VolumeAndWeight volumeAndWeight, IHandlingUnitsRepository handlingunitsRepository, IInventoryUnitsRepository inventoryunitsRepository, IMaterialsRepository materialsRepository, IInventoryLocationsRepository inventorylocationsRepository)
        {
            _receivingRepository          = receivingRepository;
            _handlingunitsRepository      = handlingunitsRepository;
            _inventoryunitsRepository     = inventoryunitsRepository;
            _materialsRepository          = materialsRepository;
            _inventorylocationsRepository = inventorylocationsRepository;
            _volumeAndWeight = volumeAndWeight;

            //InventoryUnitsPost _inventoryUnit = new InventoryUnitsPost();

            When(rec => (rec.ixMaterialHandlingUnitConfiguration ?? 0) > 0, () =>
            {
                RuleFor(u => u.nHandlingUnitQuantity)
                .NotEmpty()
                .WithMessage("When using a material handling unit configuration, you must enter a Handling Unit Quantity greater than 0.");
            }
                 );

            //When(rec => rec.sSerialNumber.Trim() != "", () =>
            //{
            //    RuleFor(u => u.nBaseUnitQuantityExpected)
            //    .Equal(1)
            //    .WithMessage("When entering a serial number, the Base Unit Quantity Expected must be 1.");
            //}
            //);

            RuleFor(u => u.nBaseUnitQuantityExpected)
            .GreaterThanOrEqualTo(0)
            .WithMessage("The Base Unit Quantity Expected must be a positive number.");

            When(rec => _materialsRepository.GetPost(rec.ixMaterial).bTrackSerialNumber, () =>
            {
                RuleFor(iu => iu.sSerialNumber)
                .NotEmpty()
                .WithMessage("The material is serial tracked. Please enter a serial number.");
            }
                 );

            When(rec => _materialsRepository.GetPost(rec.ixMaterial).bTrackSerialNumber, () =>
            {
                RuleFor(iu => iu.nBaseUnitQuantityExpected)
                .LessThanOrEqualTo(1)
                .WithMessage("The material is serial tracked. The base unit quantity must be 0 or 1");
            }
                 );

            When(rec => _materialsRepository.GetPost(rec.ixMaterial).bTrackBatchNumber, () =>
            {
                RuleFor(iu => iu.sBatchNumber)
                .NotEmpty()
                .WithMessage("The material is batch tracked. Please enter a batch.");
            }
                 );

            When(rec => _materialsRepository.GetPost(rec.ixMaterial).bTrackExpiry, () =>
            {
                RuleFor(iu => iu.dtExpireAt)
                .NotEmpty()
                .WithMessage("The material is expiry tracked. Please enter an expiry date.");
            }
                 );
        }
 public ReceivingService(IReceivingRepository repo)
 {
     this.repository = repo;
 }