示例#1
0
        public async Task <IDataResult <ScrapDetailsDto> > GetScrapDetailsDtoByIdAsync(int scrapId)
        {
            var scrap = await _scrapDao.GetAsync(s => s.Id == scrapId);

            var locSource = await _locationDao.GetAsync(l => l.Id == scrap.SourceLocationId);

            var locScrap = await _locationDao.GetAsync(l => l.Id == scrap.ScrapLocationId);

            var productToScrap = await _productDao.GetAsync(p => p.Id == scrap.ProductId);

            var scrapDetailsDto = new ScrapDetailsDto
            {
                ScrapId            = scrap.Id,
                ProductId          = productToScrap.Id,
                ProductName        = productToScrap.Name,
                OrderReference     = scrap.Reference,
                OrderDescription   = scrap.Description,
                ScheduledDate      = scrap.ScheduledDate,
                CompletedDate      = scrap.CompletedDate,
                Quantity           = scrap.Quantity,
                ScrapLocationId    = locScrap.Id,
                ScrapLocationName  = locScrap.Name,
                SourceLocationId   = locSource.Id,
                SourceLocationName = locSource.Name,
                ScrapStatus        = scrap.Status,
            };

            return(new SuccessDataResult <ScrapDetailsDto>(scrapDetailsDto));
        }
示例#2
0
        public async Task <IDataResult <WarehouseDetailsDto> > GetWarehouseDetailsDtoByIdAsync(int warehouseId)
        {
            var warehouse = await _warehouseDao.GetAsync(p => p.Id == warehouseId);

            var whLocation = await _locationDao.GetAsync(l => l.Id == warehouse.LocationId);

            var warehouseDetailsDto = new WarehouseDetailsDto
            {
                WarehouseId          = warehouse.Id,
                WarehouseName        = warehouse.Name,
                WarehouseCode        = warehouse.WarehouseCode,
                HasLimitedStockCount = warehouse.HasLimitedStockCount,
                RouteListId          = warehouse.RouteListId,
                StockLimit           = warehouse.StockLimit,
                UsedForManufacture   = warehouse.UsedForManufacture
            };

            if (whLocation != null)
            {
                warehouseDetailsDto.LocationId   = whLocation.Id;
                warehouseDetailsDto.LocationName = whLocation.Name;
            }

            return(new SuccessDataResult <WarehouseDetailsDto>(warehouseDetailsDto));
        }
示例#3
0
        public async Task <IDataResult <ReplenishmentDetailsDto> > GetReplenishmentDetailsDtoByIdAsync(int replenishmentId)
        {
            var replenishment = await _replenishmentDao.GetAsync(r => r.Id == replenishmentId);

            var prodToReplenish = await _productDao.GetAsync(p => p.Id == replenishment.ProductToReplenishId);

            var replenishmentLocation = await _locationDao.GetAsync(l => l.Id == replenishment.LocationId);

            var replenishmentDetailsDto = new ReplenishmentDetailsDto
            {
                Id                     = replenishment.Id,
                Reference              = replenishment.Reference,
                ProductToReplenishId   = prodToReplenish.Id,
                ProductToReplenishName = prodToReplenish.Name,
                LocationId             = replenishmentLocation.Id,
                LocationName           = replenishmentLocation.Name,
                OnHandQuantity         = replenishment.OnHandQuantity,
                OrderQuantity          = replenishment.OrderQuantity,
                Status                 = replenishment.Status
            };

            return(new SuccessDataResult <ReplenishmentDetailsDto>(replenishmentDetailsDto));
        }
        public async Task <IDataResult <Location> > GetByIdAsync(int id)
        {
            var location = await _locationDao.GetAsync(l => l.Id == id);

            return(new SuccessDataResult <Location>(location));
        }