コード例 #1
0
        //public long Add(WarehouseBindingModel obj)
        //{
        //    var customer = _customerService.GetByDomain(obj.Domain);
        //    Warehouse warehouse = new Warehouse
        //    {
        //        WarehouseCode = obj.WarehouseCode,
        //        CustomerId = customer.Id,
        //        Description = obj.Description,
        //        Address1 = obj.
        //        //AddressCode = obj.AddressCode,
        //    };
        //    if (IsDuplicate(warehouse.WarehouseCode, warehouse.Id, warehouse.CustomerId) == false) return _warehouseRepository.Add(warehouse);
        //    else return 0;
        //}

        public bool Delete(long id, string updatedBy)
        {
            var warehouse = _warehouseRepository.GetById(id);

            warehouse.IsActive  = false;
            warehouse.UpdatedBy = updatedBy;

            var retVal = _warehouseRepository.Update(warehouse);

            if (retVal)
            {
                var locs = _locationRepository.GetListByWarehouseId(id).ToList();

                if (locs != null || locs.Count() > 0)
                {
                    foreach (var loc in locs)
                    {
                        loc.IsActive  = false;
                        loc.UpdatedBy = updatedBy;
                        _locationRepository.Update(loc);
                    }
                }
            }

            return(retVal);
        }
コード例 #2
0
        public IActionResult Update(int id)
        {
            warehouse Warehouse = _repository.GetById(id);

            if (Warehouse == null)
            {
                return(NotFound());
            }

            return(View(Warehouse));
        }
コード例 #3
0
        public IEnumerable <WarehouseHistoryRecordDto> GetInOutHistory(int warehouseId)
        {
            var warehouse = _warehouseRepository.GetById(warehouseId);

            if (warehouse == null)
            {
                return(null);
            }

            warehouse.OrderByOperationDateTimeInOutHistory(true);
            var warehouseDto             = _mapper.Map <WarehouseDto>(warehouse);
            var warehouseInOutHistoryDto = warehouseDto.InOutHistory;

            return(warehouseInOutHistoryDto);
        }
コード例 #4
0
        public async Task <IActionResult> Delete(Guid id)
        {
            var item = await _warehouseRepository.GetById(id);

            await _warehouseRepository.Delete(item);

            return(Ok());
        }
コード例 #5
0
        public IHttpActionResult GetWarehouse(int Id)
        {
            var result = _warehouseRepository.GetById(Id);

            if (result != null)
            {
                return(Ok(result));
            }
            else
            {
                return(NotFound());
            }
        }
コード例 #6
0
        public async Task <int> GetRemainingCapacityByWarehouseId(int warehouseId)
        {
            Warehouse warehouse = await warehouseRepository.GetById(warehouseId);

            WarehouseProductViewModel     warehouseProductViewModel = new WarehouseProductViewModel();
            IQueryable <WarehouseProduct> query = Database.Set <WarehouseProduct>().Where(wp => wp.IsActive && wp.WarehouseId == warehouseId).AsQueryable();

            warehouseProductViewModel.WarehouseProducts = await query.ToListAsync();

            if (warehouseProductViewModel.WarehouseProducts.Count > 0)
            {
                warehouseProductViewModel.UsedCapacity = query.GroupBy(o => o.WarehouseId).Select(g => new { key = g.Key, total = g.Sum(i => i.Count) }).FirstOrDefault().total;
            }

            int remainingCapacity = warehouse.Capacity - warehouseProductViewModel.UsedCapacity;

            return(remainingCapacity);
        }
コード例 #7
0
ファイル: WareHouseService.cs プロジェクト: yexinw/SmoWMS
 /// <summary>
 /// 根据仓库编号获取仓库信息
 /// </summary>
 /// <param name="WAREID">仓库编号</param>
 /// <returns></returns>
 public WareHouse GetByWareID(string WAREID)
 {
     return(_warehouseRepository.GetById(WAREID).AsNoTracking().FirstOrDefault());
 }
コード例 #8
0
 public async Task <RWarehouse> GetById(string id)
 {
     return(await _warehouseRepository.GetById(id));
 }
コード例 #9
0
        public Warehouse GetWarehouse(Int64 id)
        {
            var warehouse = warehouseRepository.GetById(id);

            return(warehouse);
        }