Multi-warehouse support v1.0b (contribution). Feedback please...

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
9 years ago
ChuckR wrote:
Hi Jorg,

I was thinking further about the overall approach here, and there is one thing that is bugging me a bit and I want to get your opinion.
Presently, ProductInventory has a foreign key relationship to Product (based on your productInventoryMap).  This scenario makes sense except for when we enter the world of combinable products where the sku combination is more important than the generic productId that it belongs to. ---

Looking forward to your thoughts.

I think this will be addressed in this workitem also included in v3.50 roadmap
9 years ago
Hi Eduardo,

That work item seems to be a almost a prerequisite to some other attribute related work items.  I was just looking at a fork from today https://nopcommerce.codeplex.com/SourceControl/network/forks/cybernexus/enhancements/contribution/7248 and then seeing the work item you just pointed out, much of that work depends on keeping/extending the "status quo" of how attributes currently work...from an architecture perspective, many of these decisions on inventory control will have to be made at the same time (including rental products) as it needs to take into account all forms of management of products/inventory/attributes.
9 years ago
Hi Jörg/Andrei/ChuckR,

Great start on a job that is IMO much needed if NOP is going to compete successfully as an enterprise level EComm system.

I am hoping you guys won't mind if I make a few suggestions in the first instance around the database structure/changes that I think could be added to the existing work to help deliver full "Stock/Inventory Control" capabilities to NOP.

Appreciative I've covered quite a bit in this post I'm also very aware that due to language & terminology differences some of the things I've highlighted here might not make immediate sense, rather than just dismissing something because of the differences & in the interest of us going forward as a team working to deliver this functionality to NOP could we use this as a starting point for a common understanding of both the Domain Model & terminology that we will need to get our heads around to be successful.

An example of the terminology differences would be ChuckR's comments on "shelf" while  from the nature of Chucks comment it appears to me that what Chuck calls a "shelf" I call a Store or Warehouse, in this example for me the Store or Warehouse is the upper level of where stock is stored and below that level stores & warehouses have shelves or bays where particular products are stored or displayed in a store or warehouse.

As I said we need to get these sorts of differences sorted.

Now as for suggestions;

I'll start with the "ProductInventory" Tbl you added Jörg, btw you hit the nail on the head with this table and getting this right is the key to having a great underlying inventory control system.

What you appear not be aware of is (highlighted in ChuckR's post) that in about V2.8 or V2.9 NOP made a fairly significant change to it's product table structure to allow for stock control to be implemented in the future, unfortunately the job was not completed so there is some hangover stuff that maybe we can also clean up with this.

This is the "ProductInventory" Tbl as it currently stands

       [Id]
      ,[ProductId]
      ,[WarehouseId]
      ,[StockQuantity]
      ,[ReservedQuantity]
      ,[PlannedQuantity]
      ,[MinStockQuantity]
      ,[MaxStockQuantity]
      ,[ReorderStockQuantity]


With the changes a couple of versions ago the primary key identifier for a product changed from the "Id" field on the "Product" Tbl to a combination of the "ProductId" and "AttributesXml" fields on the "ProductVariantAttributeCombination" Tbl it means that the Product Primary Key for the "ProductInventory" Tbl will need to be changed to;


       [Id]
      ,[ProductId]
      ,[AttributesXml]

      ,[WarehouseId]
      ,[StockQuantity]
      ,[ReservedQuantity]
      ,[PlannedQuantity]
      ,[MinStockQuantity]
      ,[MaxStockQuantity]
      ,[ReorderStockQuantity]


While some might argue that "Id" field from the "ProductVariantAttributeCombination" Tbl would be a better Identifier for the product (what happens if the "AttributesXml" field changes) I do see some merit in the use of the combination of the "ProductId" and "AttributesXml" fields being used but we would need to include change logging for it to be managed correctly.

Once this has been sorted we will need to flow the changes around what a product PK is into the OrdersLine tbl as it still only uses the ProductID field from the product tbl.

In any event I'm open for discussion on the preferred Product Pk.

The next suggestion I'd make would be to have ALL stock on hand quantities for all locations (Stores & Warehouses) stored in the 1 table I.E. the "ProductInventory" Tbl. For this to happen could I suggest 1 of 2 approaches;

1. First would include adding a "LocationTypeId" field to the "ProductInventory" Tbl, and changing the "WarehouseId" field on the "ProductInventory" Tbl to "LocationId". The "LocationTypeId" would identify the row as being Quantity's on hand for a Store or a Warehouse and the "LocationId" on the "ProductInventory" Tbl would then be the Id field from either the Store or the Warehouse Tbl's.

2. Second option, Merge Store & Warehouse Tbl's into a "Location" Tbl that includes all Store Tbl fields and the addition of a "LocationTypeId" field then in the "ProductInventory" Tbl change the "WarehouseId" field to "LocationId"

I would advocate for the second option as the way forward primarily as going into the enterprise world NOP is going to need strong location management capabilities and making this change as part of fixing stock control makes sense now.

This is how the "ProductInventory" Tbl will look if you guys were to adopt the second option.


       [Id]
      ,[ProductId]
      ,[AttributesXml]
      ,[LocationId]
      ,[StockQuantity]
      ,[ReservedQuantity]
      ,[PlannedQuantity]
      ,[MinStockQuantity]
      ,[MaxStockQuantity]
      ,[ReorderStockQuantity]



A future addition to NOP would include the ability to map the relationships between stores and warehouses (also see Chucks comments on this in his post). but I'll explain this further once the primary work has been done.

The next suggestion I have is pre-emptive to some changes I think would be highly beneficial to the sales transaction capabilities of NOP, fyi Layaway/Lay-by (Aust & NZ) is a much wanted feature that products like Magento have ignored.


       [Id]
      ,[ProductId]
      ,[AttributesXml]
      ,[LocationId]
      ,[StockQuantity]
      ,[OrderReservedQuantity]
      ,[LayawayReservedQuantity]
      ,[OtherReservedQuantity]

      ,[PlannedQuantity]
      ,[MinStockQuantity]
      ,[MaxStockQuantity]
      ,[ReorderStockQuantity]


To accommodate the possible changes to the sales transaction capabilities you'll note that I have added the [OrderReservedQuantity], [LayawayReservedQuantity] and [OtherReservedQuantity] fields. As we get more into this discussion I'll better explain why I thing we should provide for this functionality.

The final thing that I'd suggest we look at at this time would be the inclusion of some Cost/RRP info at the product inventory level, wether that be in the "ProductInventory" tbl or in its own "ProductInventoryCost" tbl is neither here nor there but that said my preference would be for it to be held in the "ProductInventory" tbl, on that basis this is how I envisage the "ProductInventory" tbl would look if all the changes I propose were accepted by the group.


       [Id]
      ,[ProductId]
      ,[AttributesXml]
      ,[LocationId]
      ,[StockQuantity]
      ,[OrderReservedQuantity]
      ,[LayawayReservedQuantity]
      ,[OtherReservedQuantity]
      ,[PlannedQuantity]
      ,[MinStockQuantity]
      ,[MaxStockQuantity]
      ,[ReorderStockQuantity]
      ,[CostFOB]
      ,[avgCostEx]
      ,[avgFreightCostEx]
      ,[RRPEx]
      ,[LastCostEx]
      ,[LastFreightCostEx]
      ,[PriceBookCostEx]
      ,[PriceBookFreightCostEx]
      ,[PricebookRRP]
      ,[VendorRebateId]



With respect the average & last costs these would initially be sucked up from an existing ERP or POS system in the longer term these numbers could be captured through NOP's own purchasing structure.

As for the inclusion of PriceBook costs, RRP and vendor rebate id this is info that is particularly needed for franchise/enterprise retail I've included it here as including it now allows us to nail the domain requirements.

Again with these suggested changes as the discussion develops I'll better explain everything.

In closing while I'm far from a gun coder (my strength is more as a domain specialist) I do alright so please accept this as an offer to get my hands dirty doing what coding work I can about these changes.

Cheers
Gaz
9 years ago
Hi Gaz,

Some good suggestions in your post.

Your table structure which can take into attribute combinations makes sense.

       [Id]
      ,[ProductId]
      ,[AttributesXml]

      ,[WarehouseId]
      ,[StockQuantity]
      ,[ReservedQuantity]
      ,[PlannedQuantity]
      ,[MinStockQuantity]
      ,[MaxStockQuantity]
      ,[ReorderStockQuantity]

My preference is to have the primary key as a composite key on ProductId, and AttributesXml for this table as I think it will be easier to manage combinations.

So... for part 2 of your post

Your proposed table structure makes sense to support locations... I am leaning towards option 1... of course this means warehouse has to be mapped to a location. Do you see a location table being created...and a location_warehouse mapping lookup table leveraged?

[Id]
      ,[ProductId]
      ,[AttributesXml]
     ,[LocationId]
      ,[StockQuantity]
      ,[ReservedQuantity]
      ,[PlannedQuantity]
      ,[MinStockQuantity]
      ,[MaxStockQuantity]
      ,[ReorderStockQuantity]

The reason I am leaning towards option 1 is that option 2 I think might create a challenge (possible breaking change) for people who want to use the current implementation (open to discuss of course).

Finally, when it comes to additional fields.  I have been looking at the completed work item (extending core entities) which is now in 3.5.  The work item was 12115

If we went with your option 1 now in the core, then developing plugins that extend the new core ProductInventory (location approach) would allow all of us to adapt/mold plugins to the more specific use cases. So...a layaway plugin for example could be developed and easily extend the new core table.
This would also open the door for developers to leverage this new table to do a serializedInventory Plugin, etc.  Although... I still feel this should be core to support rental products.

Andrei and Jorg / anyone... what do you think of Gaz's option 1, along with the mapping table (location_warehousemapping)?  I feel this would be a very good step forward and would be quite flexible.

Thanks
9 years ago
ChuckR wrote:
Hi Gaz,

Some good suggestions in your post.



G'day ChuckR & breakskater,

Thanks for the feedback & soz for being a bit slow to reply.

FYI based on your suggestion for serialise stock & rental product capability and breakskater's request for 'Shelf' management I've been looking at how it could be implemented with the changes around stock management.

Firstly I agree serialised stock should be core as it applys to so many different product types so it would be good to include. That said while I have factored it in to the design work I'm doing now I would not plan to build up this functionality as part of the stock management work. Main reason for now is that its inclusion hinges on having some sort of "goods Received" functionality to capture serial numbers when the goods are received from the supplier or alternatively if NOP is linked to a separate POS or ERP system digging it out of that.

With Laby/Layaway and rental product sales what I've got in mind is consistent with the principal that they could be developed as plugins, with this in mind one of the things I'm looking at is the changes in the "Orders" tbl that would be needed to accommodate both "Sale Type" plugins and locational sales, in effect this simply means adding a "SaleTypeID" and "LocationID" field to the "Orders" tbl.

Now as for breakskater's request for 'Shelf' management, when I put it up I think you'll like what you see particularly once you get your head around what you can do with it from a stock management & costing/price control & reporting capability. Without going into detail I've tried to make it as granular as possible so things like the ability to manage stock on hand for a product that is stored at multiple points within a warehouse is a given.

All that said I've still got some work on the DB design to do so all well I should have something for you to review mid next week.

Cheers
Gaz
9 years ago
Hi Gaz,

Sounds very interesting.  Are you forking the current fork from Jorg or are you doing a new fork of the final 3.4?

Thanks
Chuck
9 years ago
ChuckR wrote:
Hi Gaz,

Sounds very interesting.  Are you forking the current fork from Jorg or are you doing a new fork of the final 3.4?

Thanks
Chuck


G'day Chuck,

I was hoping that we could work with Jorg & have PM'd him, he's been pretty quiet on this discussion.

As to where we go with a fork I'd like to hear first from Jorg & if possible work with him on the existing fork, if that's not possible then I'd be inclined to start a new fork from the final 3.4, what are your thoughts?

Cheers
Garry
9 years ago
Hi Gaz,

Yes, I think it makes sense to work from Jorg's fork and extend it as there is a lot of good work there.
9 years ago
Hi guys,

sorry, I was a bit busy during the last days and I didn't have the time to dig deeply into your suggestions.
I just had a call with Andrei and we decided to integrate the changes I made without feature extensions into the next release of NopCommerce.

It might be that we'll add the AttributeXml attribute - but that's not yet fixed.

Important is to find the right borderline which features should be in the base and which features should be added by plugins.
All the statistics properties can be easily added with the GenericAttributeService in a plugin to keep NopCommerce simple.

Anyway, I agree just partially with the idea to link the ProductInventory table to a "Locations" table. But we should move this feature to the next version to get some feedback from the community first. Maybe you remember that in my first post I wrote that shelf support is not yet there. I can easily add it - but I don't wanna overburden the other store owners with such a complex infrastructure.

I was hoping to get some more feedback regarding the actual implementation. It can't be bugfree... ;-)

Cheers
Jörg
9 years ago
Hi Jorg,

Great to hear that you confirmed this will go into 3.5!

Makes sense around extending features in a plugin... with the new architecture being introduced in 3.5 to extend core entities, plugins should be able to extend the productInventory table to add additional data.
That being said... including the Attribute Xml imo is a must for the core. We have to be able to support the attribute combinations (overridden skus) right out of the box.  There is no benefit to doing all this heavy lifting in a plugin as almost everyone would need it.

I understand the reservation on Location table, however, I do think this is a good idea (even in a limited way). However, if we do get the granular sku's with combinations, it would be possible in 3.5 to extend the productinventory base entity to add location/shelf plugin for all possible products.

I am still unclear though on how to properly support Rental products (including handling warranties) without an optional serialized inventory.  I release this comment is related to a another work item, but I see this as a dependency.  

Re...the current build. I did test that out, and didn't have really any issues with it.  Are you planning another changeset that would be reflective of what will be pulled/merged with the attribute xml? If so, I can do additional testing on that changeset.

Thanks
Chuck
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.