Maximo Open Forum

 View Only

 How to create inventory usage lines from remaining reservations

  • Customizations
  • Inventory
Svein Askvoll's profile image
Svein Askvoll posted 05-23-2024 02:32

I am trying to create some logic which is very similar to the existing “Create Remaining Usage Lines” functionality in the inventory usage application. The reason for this is that we want the ability to create a new inventory usage record with the remaining reservations which are to be picked at a later date. Today this is only possible when the inventory usage record is in status staged or completed. I know we could associate the material reservations to tasks on the WO with different schedule start date to get different inventory usage records with different picking dates, however our organization is not ready to adopt this process yet. Therefor I would love a “Create Remaining Usage Lines” functionality that also works in status entered. To do this I believe the method copyInvReserveSetForInvUse() should help me out, however the invuse lines are not added to the new inventory usage when I implement the jython script below. Am I missing something? My mboset collects the remaining reservations for that specific WO though the following where-query from invuse to invreserve:
requestnum in (select invr.requestnum from invreserve invr left join invuseline invl on invl.requestnum = invr.requestnum and invl.siteid = invr.storelocsiteid where invl.invusenum is null) and wonum = (select wonum from workorder where workorderid = :workorderid and siteid = :siteid)

*The script is launched from a button in the UI.

*****

invUseSet = mbo.getThisMboSet()

deletedInvuseLinesSet = mbo.getMboSet("MNTATESTINVRESERVE")

if not deletedInvuseLinesSet.notExist():

    newInvUse = invUseSet.add()

    newInvUse.setValue("FROMSTORELOC", mbo.getString("FROMSTORELOC"))

    newInvUse.setValue("USETYPE", mbo.getString("USETYPE"))

    newInvUse.setValue("DESCRIPTION", mbo.getString("DESCRIPTION"))

    newInvUse.copyInvReserveSetForInvUse(deletedInvuseLinesSet)

*****