public RePayPointsController( IRePayPointsService _RePayPoints , IRePayPointsDetailService _rePayPointsDetail , IUserRepository _user , ICustomerRepository _customerRepository , IWarehouseRepository _warehouseRepository , IInventoryRepository _inventoryRepository , IProductRepository _productRepository , IProductOutboundRepository _ProductOutbound , IvwRePayPointsService _vwRePayPoints , IvwRePayPointsDetailService _vwrePayPointsDetail , ITransactionRepository _Transaction , ITemplatePrintRepository _TemplatePrint ) { RePayPointsService = _RePayPoints; RePayPointsDetailService = _rePayPointsDetail; userRepository = _user; customerRepository = _customerRepository; WarehouseRepository = _warehouseRepository; InventoryRepository = _inventoryRepository; ProductRepository = _productRepository; ProductOutboundRepository = _ProductOutbound; vwRePayPointsService = _vwRePayPoints; vwRePayPointsDetailService = _vwrePayPointsDetail; transactionRepository = _Transaction; templatePrintRepository = _TemplatePrint; }
public static string Update(string productName, int productId, int warehouseId, int quantityIn, int quantityOut, bool isArchive = true) { string error = ""; IProductInboundRepository productInboundRepository = DependencyResolver.Current.GetService <IProductInboundRepository>(); IProductOutboundRepository productOutboundRepository = DependencyResolver.Current.GetService <IProductOutboundRepository>(); IInventoryRepository inventoryRepository = DependencyResolver.Current.GetService <IInventoryRepository>(); var inbound = productInboundRepository.GetAllvwProductInboundDetail() .Where(x => x.IsArchive && x.ProductId == productId && x.WarehouseDestinationId == warehouseId); var outbound = productOutboundRepository.GetAllvwProductOutboundDetail() .Where(x => x.IsArchive && x.ProductId == productId && x.WarehouseSourceId == warehouseId); var inventory = (inbound.Count() == 0 ? 0 : inbound.Sum(x => x.Quantity)) - (outbound.Count() == 0 ? 0 : outbound.Sum(x => x.Quantity)) + quantityIn - quantityOut; var inventoryCurrent = inventoryRepository.GetInventoryByWarehouseIdAndProductId(warehouseId, productId); //Sau khi thay đổi dữ liệu phải đảm bảo tồn kho >= 0 if (inventory >= 0) { if (isArchive) { if (inventoryCurrent != null) { if (inventoryCurrent.Quantity != inventory) { inventoryCurrent.Quantity = inventory; inventoryRepository.UpdateInventory(inventoryCurrent); } } else { inventoryCurrent = new Inventory(); inventoryCurrent.IsDeleted = false; inventoryCurrent.CreatedUserId = WebSecurity.CurrentUserId; inventoryCurrent.ModifiedUserId = WebSecurity.CurrentUserId; inventoryCurrent.CreatedDate = DateTime.Now; inventoryCurrent.ModifiedDate = DateTime.Now; inventoryCurrent.WarehouseId = warehouseId; inventoryCurrent.ProductId = productId; inventoryCurrent.Quantity = inventory; inventoryRepository.InsertInventory(inventoryCurrent); } } } else { error += string.Format("<br/>Dữ liệu tồn kho của sản phẩm \"{0}\" là {1}: không hợp lệ!", productName, inventory); } return(error); }
public InventoryController( IInventoryRepository _Inventory , IProductOrServiceRepository _Product , IWarehouseRepository _Warehouse , IProductInboundRepository _ProductInbound , IProductOutboundRepository _ProductOutbound , IPhysicalInventoryRepository _PhysicalInventory , IUserRepository _user ) { WarehouseRepository = _Warehouse; ProductRepository = _Product; InventoryRepository = _Inventory; ProductInboundRepository = _ProductInbound; ProductOutboundRepository = _ProductOutbound; userRepository = _user; PhysicalInventoryRepository = _PhysicalInventory; }
public InventoryController( IInventoryRepository _Inventory , IProductRepository _Product , IWarehouseRepository _Warehouse , IProductInboundRepository _ProductInbound , IProductOutboundRepository _ProductOutbound , IPhysicalInventoryRepository _PhysicalInventory , IUserRepository _user , ICategoryRepository categorys ) { WarehouseRepository = _Warehouse; ProductRepository = _Product; InventoryRepository = _Inventory; ProductInboundRepository = _ProductInbound; ProductOutboundRepository = _ProductOutbound; userRepository = _user; PhysicalInventoryRepository = _PhysicalInventory; _categoryRepository = categorys; }
public RequestInboundController( IRequestInboundRepository _RequestInbound , IUserRepository _user , IWarehouseRepository warehouse , IProductOrServiceRepository product , ICategoryRepository category , IProductOutboundRepository productOutbound , IProductInboundRepository productInbound , ITemplatePrintRepository templatePrint , IBranchRepository branch ) { RequestInboundRepository = _RequestInbound; userRepository = _user; WarehouseRepository = warehouse; ProductRepository = product; categoryRepository = category; productInboundRepository = productInbound; productOutboundRepository = productOutbound; templatePrintRepository = templatePrint; branchRepository = branch; }
public PhysicalInventoryController( IInventoryRepository _Inventory , IProductRepository _Product , IWarehouseRepository _Warehouse , IProductInboundRepository _ProductInbound , IProductOutboundRepository _ProductOutbound , IPhysicalInventoryRepository _PhysicalInventory , IUserRepository _user , IWarehouseLocationItemRepository _WarehouseLocationItem , ICategoryRepository _CategoryRepository , ITemplatePrintRepository _templatePrint ) { WarehouseRepository = _Warehouse; ProductRepository = _Product; InventoryRepository = _Inventory; productInboundRepository = _ProductInbound; productOutboundRepository = _ProductOutbound; userRepository = _user; PhysicalInventoryRepository = _PhysicalInventory; warehouseLocationItemRepository = _WarehouseLocationItem; categoryRepository = _CategoryRepository; templatePrintRepository = _templatePrint; }