Example #1
0
 public Shipping(ILocationFunctionsService locationfunctionsService
                 , IInventoryUnitsService inventoryunitsService
                 , IInventoryLocationsSlottingService inventorylocationsslottingService
                 , VolumeAndWeight volumeAndWeight
                 , IInventoryLocationsService inventorylocationsService
                 , CommonLookUps commonLookUps
                 , IOutboundCarrierManifestsService outboundcarriermanifestsService
                 , IOutboundOrdersRepository outboundordersRepository
                 //, IOutboundCarrierManifestPickupsService outboundcarriermanifestpickupsService
                 , IOutboundShipmentsService outboundshipmentsService
                 , IOutboundOrderLinesService outboundorderlinesService
                 , IOutboundOrderLinePackingService outboundorderlinepackingService
                 , IOutboundOrderLinesInventoryAllocationService outboundorderlinesinventoryallocationService
                 , IHandlingUnitsService handlingunitsService
                 )
 {
     _locationfunctionsService          = locationfunctionsService;
     _inventoryunitsService             = inventoryunitsService;
     _inventorylocationsslottingService = inventorylocationsslottingService;
     _volumeAndWeight                 = volumeAndWeight;
     _inventorylocationsService       = inventorylocationsService;
     _commonLookUps                   = commonLookUps;
     _outboundcarriermanifestsService = outboundcarriermanifestsService;
     _outboundordersRepository        = outboundordersRepository;
     //_outboundcarriermanifestpickupsService = outboundcarriermanifestpickupsService;
     _outboundshipmentsService        = outboundshipmentsService;
     _outboundorderlinesService       = outboundorderlinesService;
     _outboundorderlinepackingService = outboundorderlinepackingService;
     _outboundorderlinesinventoryallocationService = outboundorderlinesinventoryallocationService;
     _handlingunitsService = handlingunitsService;
 }
Example #2
0
 public PutAway(ILocationFunctionsService locationfunctionsService, IInventoryUnitsService inventoryunitsService, IInventoryLocationsSlottingService inventorylocationsslottingService, VolumeAndWeight volumeAndWeight, IInventoryLocationsService inventorylocationsService)
 {
     _locationfunctionsService          = locationfunctionsService;
     _inventoryunitsService             = inventoryunitsService;
     _inventorylocationsslottingService = inventorylocationsslottingService;
     _volumeAndWeight           = volumeAndWeight;
     _inventorylocationsService = inventorylocationsService;
 }
Example #3
0
 //Custom Code End
 //Custom Code Start | Replaced Code Block
 //Replaced Code Block Start
 //public MoveQueuesService(IMoveQueuesRepository movequeuesRepository)
 //Replaced Code Block End
 public MoveQueuesService(IMoveQueuesRepository movequeuesRepository, CommonLookUps commonLookUps, IInventoryLocationsService inventorylocationsService, IInventoryUnitsService inventoryunitsService, VolumeAndWeight volumeAndWeight)
 //Custom Code End
 {
     _movequeuesRepository = movequeuesRepository;
     //Custom Code Start | Added Code Block
     _commonLookUps             = commonLookUps;
     _inventorylocationsService = inventorylocationsService;
     _inventoryunitsService     = inventoryunitsService;
     _volumeAndWeight           = volumeAndWeight;
     //Custom Code End
 }
Example #4
0
        //Custom Code End

        //Custom Code Start | Replaced Code Block
        //Replaced Code Block Start
        //public InventoryUnitsService(IInventoryUnitsRepository inventoryunitsRepository, IInventoryUnitTransactionsService inventoryunittransactionsService)
        //Replaced Code Block End
        public InventoryUnitsService(IInventoryUnitsRepository inventoryunitsRepository, IInventoryUnitTransactionsService inventoryunittransactionsService, InventoryUnitTransactionsPost inventoryunittransactions, IInventoryLocationsService inventorylocationsService, InventoryLocationsPost inventorylocations, VolumeAndWeight volumeAndWeight)
        {
            //Custom Code End
            _inventoryunitsRepository = inventoryunitsRepository;
            //Custom Code Start | Added Code Block
            _inventoryunittransactionsService = inventoryunittransactionsService;
            _inventoryunittransactions        = inventoryunittransactions;
            _inventorylocationsService        = inventorylocationsService;
            _inventorylocations = inventorylocations;
            _volumeAndWeight    = volumeAndWeight;
            //Custom Code End
        }
        public InventoryUnitsPostValidator(VolumeAndWeight volumeAndWeight, IInventoryLocationsRepository inventorylocationsRepository, IMaterialsRepository materialsRepository)
        {
            _volumeAndWeight = volumeAndWeight;
            _inventorylocationsRepository = inventorylocationsRepository;
            _materialsRepository          = materialsRepository;

            RuleFor(u => u.nBaseUnitQuantity)
            .GreaterThanOrEqualTo(0)
            .WithMessage("The base unit quantity must be a positive number.");

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

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

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

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


            When(inventoryUnit => !_volumeAndWeight.inventoryUnitWillFitLocation(inventoryUnit, _inventorylocationsRepository.GetPost(inventoryUnit.ixInventoryLocation)), () =>
            {
                RuleFor(u => u.ixInventoryLocation)
                .Empty()
                .WithMessage("The inventory will not fit into the selected location.");
            }
                 );
        }
        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 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.");
            }
                 );
        }