/// <summary> /// 添加出库 /// </summary> /// <param name="request"></param> public void AddOutBound(AddOutBoundRequest request) { InBound inBound = this.GetFirstInBound(request.ProductId, request.WarehouseId); if (inBound == null) { throw new EntityIsInvalidException <string>(request.ProductId.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.AddOutBound(reason, request.Qty, request.Note, users); this._uow.Commit(); this._spotInventoryService.OutSpotInventory(request.ProductId, request.WarehouseId, request.Qty); }
/// <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 AddOutBound(int inboundId, int inboundShelfId, int qty, float price, string note, int createUserId) { InBound inBound = this._inBoundRepository.FindBy(inboundId); inBound.AddOutBound(qty, price, note, createUserId, inboundShelfId); 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); }