public IQueryable <UnitsOfMeasurement> UnitsOfMeasurementDb() => _unitofmeasurementconversionsRepository.UnitsOfMeasurementDb();
示例#2
0
        public bool handlingUnitWillFitLocation(Int64 ixHandlingUnit, List <InventoryUnits> inventoryUnitsOnHandlingUnit, InventoryLocationsPost inventoryLocationsPost)
        {
            if (inventoryLocationsPost.bTrackUtilisation && inventoryLocationsPost.ixInventoryLocationSize > 0)
            {
                Double nVolumeToFit = 0;
                inventoryUnitsOnHandlingUnit.ForEach(x =>
                {
                    nVolumeToFit += convertToCommonUnitValue(x.Materials.nLength ?? 0, x.Materials.ixLengthUnit ?? 0) *
                                    convertToCommonUnitValue(x.Materials.nWidth ?? 0, x.Materials.ixWidthUnit ?? 0) *
                                    convertToCommonUnitValue(x.Materials.nHeight ?? 0, x.Materials.ixHeightUnit ?? 0) * x.nBaseUnitQuantity;
                }
                                                     );

                var   inventoryUnitDimensions = getHandlingUnitDimensions(ixHandlingUnit, inventoryUnitsOnHandlingUnit);
                var   inventoryLocations      = _inventorylocationsRepository.Get(inventoryLocationsPost.ixInventoryLocation);
                Space spaceToFit     = new Space(inventoryUnitDimensions.nLength, inventoryUnitDimensions.nWidth, inventoryUnitDimensions.nHeight, nVolumeToFit, inventoryUnitDimensions.ixLengthUnit, inventoryUnitDimensions.ixWidthUnit, inventoryUnitDimensions.ixHeightUnit, _unitofmeasurementconversionsRepository.UnitsOfMeasurementDb().Where(x => x.sUnitOfMeasurement == "Cubic meter").Select(x => x.ixUnitOfMeasurement).FirstOrDefault(), _unitofmeasurementconversionsRepository, 1);
                Space spaceToFitInto = new Space(inventoryLocations.InventoryLocationSizes.nLength, inventoryLocations.InventoryLocationSizes.nWidth, inventoryLocations.InventoryLocationSizes.nHeight, inventoryLocations.InventoryLocationSizes.nUsableVolume - inventoryLocations.InventoryLocationSizes.nUsableVolume * ((inventoryLocations.nUtilisationPercent ?? 0) + (inventoryLocations.nQueuedUtilisationPercent ?? 0)) / 100.0, inventoryLocations.InventoryLocationSizes.ixLengthUnit, inventoryLocations.InventoryLocationSizes.ixWidthUnit, inventoryLocations.InventoryLocationSizes.ixHeightUnit, inventoryLocations.InventoryLocationSizes.ixUsableVolumeUnit, _unitofmeasurementconversionsRepository, 1);
                if (spaceToFitInto.CompareTo(spaceToFit) == 1)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(true);
            }
        }