//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); }
public IActionResult Update(int id) { warehouse Warehouse = _repository.GetById(id); if (Warehouse == null) { return(NotFound()); } return(View(Warehouse)); }
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); }
public async Task <IActionResult> Delete(Guid id) { var item = await _warehouseRepository.GetById(id); await _warehouseRepository.Delete(item); return(Ok()); }
public IHttpActionResult GetWarehouse(int Id) { var result = _warehouseRepository.GetById(Id); if (result != null) { return(Ok(result)); } else { return(NotFound()); } }
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); }
/// <summary> /// 根据仓库编号获取仓库信息 /// </summary> /// <param name="WAREID">仓库编号</param> /// <returns></returns> public WareHouse GetByWareID(string WAREID) { return(_warehouseRepository.GetById(WAREID).AsNoTracking().FirstOrDefault()); }
public async Task <RWarehouse> GetById(string id) { return(await _warehouseRepository.GetById(id)); }
public Warehouse GetWarehouse(Int64 id) { var warehouse = warehouseRepository.GetById(id); return(warehouse); }