What happends "under the hood" in AdjustInventoryOrRemoveLineItems

Vote:
 

question to EPiServer mostly i guess.

AdjustInventoryOrRemoveLineItems 

what does it do? 

does it makes "RequestInventory", can someone explain when and what is does more exactly?

 

thanks!

#185307
Nov 15, 2017 9:31
Vote:
 

My tip to you if you want to find out what something does "under the hood" in epi is just to decompile it using Jetbrains dotPeek or ilSpy or something similar, and just read code :)

#185308
Nov 15, 2017 9:57
Vote:
 

I think I explained this in my book.

I also explain it partly here https://world.episerver.com/documentation/Items/Developers-Guide/Episerver-Commerce/9/Orders/order-processing/ (comments)

Basically RequestInventory will ask the inventory system: "Hi inventory system, this kind Goaral is buying 3 of this SKU. Can you allocate the stock for him so we can ship?". And the inventory system will be "OK, 3 requested and allocated", Or "We only have 2, but 1 can be backordered". This will happen when you actually place your order. The allocated inventory will be "committed" when the shipment is shipped, or will be reverted if you cancel the order before that. 

It can be much more complicated underneath if you think about edge cases, but that is basically the idea.

#185310
Nov 15, 2017 10:12
Vote:
 

Thank you for your tip Joel, but i already did that before i posted this post and it takes to much time digging, this post is my shortcut.. even tho i like digging i dont really have time for this in my project right now. 

#185312
Nov 15, 2017 10:21
Vote:
 

Quan, what makes me confused is that "PurchaseRequestedQuantity" is not reduced aven when we call the

       _inventoryProcessor.AdjustInventoryOrRemoveLineItem(shipment, purchaseOrder.OrderStatus, (item, issue) => validationIssues.Add(item, issue));

both shipment is shipped and order completed but nothing happends.. 

from my understanding is should make a "CompleteInventoryRequest" 

that should decrease the "PurchaseRequestedQuantity"? 

#185314
Nov 15, 2017 10:41
Vote:
 

I'm a bit confused here. Once the shipment is shipped (and the order is completed), you should not have to call AdjustInventoryOrRemoveLineItem. That is supposed to call only during check out process.

Once the order is completed the OperationKeys are cleared so the requests will not be changed at all. 

#185316
Nov 15, 2017 10:48
Vote:
 

Ok, so when and how should the PurchaseRequestedQuantity from InventoryRecord be decreased? 

#185318
Nov 15, 2017 10:51
Vote:
 

My bad. AdjustInventoryOrRemoveLineItem also do the job of "completing orders"  (It should have been a different API). So what you did was correct, when the Shipment status = Shipped, OR Order status = Completed, then it will complete the request (by committing the requested quantity).

However that can only be done if the Shipment.OperationKeys is not empty ... 

#185320
Nov 15, 2017 11:00
Vote:
 

and the way working with the OperationKeys

are they set when we make first AdjustInventoryOrRemoveLineItem on cart or is that a manual job by calling "RequestInventory" and then setting them to shipments

i tried to debug in different scenarions but hey never get set.. 

#185321
Nov 15, 2017 11:17
Vote:
 

When you call ReserveInventory - which is called inside AdjustInventoryOrRemoveLineItem when you place the order, it should do all the work for you (request inventory, add operation keys to the shipment...)

Check in your database if the OperationKeys is there

#185322
Nov 15, 2017 11:24
Vote:
 

hmm.. ok they are not set when i run AdjustInventoryOrRemoveLineItem on cart.. and they are not there i the table either..

#185325
Nov 15, 2017 11:48
Vote:
 

is this a bug, do you know what version it´s fixed in?  

#185326
Nov 15, 2017 11:57
Vote:
 

I don't think there was a bug regarding to that. We tested this area very intensively and such bug should be caught early.

To make sure, did you look into Shipment table, column OperationKeys?

Can you try with the vanila Quicksilver setup to see if it works? 

#185327
Nov 15, 2017 11:59
Vote:
 

ok, i tried this on Quicksilver but it was working fine there.. 

I copied the exact code from Quicksilver but still its not set.. 

is there any requirementson on the shipment that needs to be set in order to set Operationkeys? 

we run 10.2 commerce version 

#185328
Nov 15, 2017 13:28
Vote:
 

the difference i could see is we have created a shipment line in DB before calling the Adjust method and in QUicksilver that is first created when a order is placed. 

does it matter? maybe it cannot exist in the DB before we call adjust method in order to have it set.. ?

#185330
Nov 15, 2017 14:23
Vote:
 

It should not be a problem.

However it seems it's in your implementation - I would suggest to contact developer support service for a more throughout investigation. 

#185332
Nov 15, 2017 14:51
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.