/// <summary> /// 添加入库 /// </summary> /// <param name="request"></param> public void AddInBound(AddInBoundRequest request) { Product product = this._productRepository.FindBy(request.ProductId); if (product == null) { throw new EntityIsInvalidException <string>(request.ProductId.ToString()); } Warehouse warehouse = this._warehouseRepository.FindBy(request.WarehouseId); if (warehouse == null) { throw new EntityIsInvalidException <string>(request.WarehouseId.ToString()); } WarehouseShelf warehouseShelf = this._warehouseShelfRepository.FindBy(request.WarehouseShelfId); if (warehouseShelf == null) { throw new EntityIsInvalidException <string>(request.WarehouseId.ToString()); } InBound model = new InBound(product, warehouse, warehouseShelf, request.Qty, request.Price, request.Currency, request.Note, request.CreateUserId); this._inBoundRepository.Add(model); this._uow.Commit(); }
/// <summary> /// 添加入库 /// </summary> /// <param name="request"></param> public void AddInBound(AddInBoundRequest request) { Product product = this._productRepository.FindBy(request.ProductId); if (product == null) { throw new EntityIsInvalidException <string>(request.ProductId.ToString()); } Warehouse warehouse = this._warehouseRepository.FindBy(request.WarehouseId); if (warehouse == null) { throw new EntityIsInvalidException <string>(request.WarehouseId.ToString()); } WarehouseShelf warehouseShelf = this._warehouseShelfRepository.FindBy(request.WarehouseShelfId); if (warehouseShelf == null) { throw new EntityIsInvalidException <string>(request.WarehouseId.ToString()); } InOutReason reason = this._inOutReasonService.GetInOutReason(request.InOutReasonId); if (reason == null) { throw new EntityIsInvalidException <string>(request.InOutReasonId.ToString()); } Users users = this._usersService.GetUsers(request.CreateUserId); if (users == null) { throw new EntityIsInvalidException <string>(users.ToString()); } InBound model = new InBound(product, warehouse, warehouseShelf, reason, request.Qty, request.Price, request.Currency, request.Note, users); this._inBoundRepository.Add(model); this._spotInventoryService.InSpotInventory(request.ProductId, request.WarehouseId, request.Qty, request.Price, request.Currency); }
/// <summary> /// 入库 /// </summary> /// <returns></returns> public JsonResult AddInBound(AddInBoundRequest request) { this._inOutBoundService.AddInBound(request); return(Json("入库成功", JsonRequestBehavior.AllowGet)); }
public HttpResponseMessage AddInBound([FromUri] AddInBoundRequest request) { this._inOutBoundService.AddInBound(request); return(ToJson("入库成功")); }