/// <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); }
public void AddInOutReason(AddInOutReasonRequest request) { InOutReason model = this._inOutReasonRepository.FindBy(request.Id); if (model == null) { throw new EntityIsInvalidException <string>(request.Id.ToString()); } this._inOutReasonRepository.Add(model); this._uow.Commit(); }
public void RemoveInOutReason(int id) { InOutReason model = this._inOutReasonRepository.FindBy(id); if (model == null) { throw new EntityIsInvalidException <string>(id.ToString()); } this._inOutReasonRepository.Remove(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); }
public static InOutReasonView ConvertToInOutReasonView(this InOutReason model) { return(Mapper.Map <InOutReason, InOutReasonView>(model)); }