Try our conversational search powered by Generative AI!

Multiple warehouse with differentiation per customer

Vote:
 

Hello everyone, 

we are currently using a single warehouse in the application, defined as default. We have a new business requirement where different customers belong to different departments, which we have stored in the database for each customer. Depending on the department, customers are expected to have a different number of items available to purchase,

e.g.

customer A, belonging to the DA department, will not know that customer B, belonging to the DB department, has a different number of available items.

I would like to ask how to approach this problem in a proper way, is keeping these data in different warehouses a suggested solution? On what to be aware of during implementation?

#298295
Mar 14, 2023 11:19
Vote:
 

How many departments do you have? Sounds like the easiest option is to setup each warehouse per department. 

#298300
Mar 14, 2023 14:29
Vote:
 

You can have several warehouses in the Commerce database, and keep separate inventory numbers for each warehouse. That is: one inventory record for each combination of WarehouseCode + CatalogEntryCode.

Every time you need to know the inventory of a catalog entry, you can call IInventoryService.QueryByPartialKey instead of IInventoryService.QueryByEntry.

You could maybe have a property on the CustomerContact or Organization MetaClass, that contains the related warehouse code for the customer. Then every time you load inventory for the customer, you get the WarehouseCode from the contact/organization.

#298318
Mar 14, 2023 20:41
Vote:
 

Thank you both for your replies, I have implemented my own version of the IFulfillmentWarehouseProcessor to retrieve the corresponding Warehouse per user. iI works well, I have not noticed any problems when buying products either and the correct amount is reduced for the correct warehouse.

However, I have another difficulty that I have now encountered in my path.

During tests and manual changes in the Catalog on the Inventory tab when I change the amount of In Stock e.g. from 100 to 0 and I go to a particular product and get data about it by the QueryByPartialKey method, I still get information as if there were 100 pieces of that product.

The data in the database (InventoryService table) is changing correctly, it seems to me as if some event that should update it is not firing because after rebuilding the code I get the correct value. How can I take care of this so that even with manual changes in Inventory I have fresh data immediately?

#300259
Apr 17, 2023 15:01
Vote:
 

From what I can see there were some issues with QueryByPartialKey method (maybe I was using it in the wrong way), once I change it to QueryByEntry everything started working as expected.

#300307
Apr 18, 2023 8:03
Vote:
 

You can have several warehouses in the Commerce database, and keep separate inventory numbers for each warehouse. That is: one inventory record for each combination of WarehouseCode + CatalogEntryCode.

#300327
Apr 18, 2023 19:57
Vote:
 

The thing with QueryByPartialKey is that you can request inventory records for a combination of WarehouseCode+CatalogCode. So you can skip loading inventory records for a catalog item from all other warehouses than those you need.

You can also request inventory records for several combinations. E.g. 10 catalog items from 2 warehouses, and ignoring all other combinations.

But if you need inventory records for a catalog item from all warehouse, or if you only have a single warehouse, you can easily use QueryByEntry.

#300328
Apr 18, 2023 20:01
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.