Maximo Open Forum

 View Only
  • 1.  Using processing class on automation script inbound

    Posted 02-17-2023 09:49
    Edited by KM Cornista 02-17-2023 09:59

    Good day everyone!

    I found this class psdi.app.inventory.FldInvUseLineToBin attached to the To Bin attribute of INVUSELINE. I have a requirement wherein I will set the default value of To Bin on inbound transaction. From my understanding, it seems that this class is responsible for defaulting the value on Inventory Usage when you try to create a new inventory usage line. There is action() method under this class that perhaps suits my needs. How can I use this class to an inbound automation (OSIN) script/jython to achieve my goal? Can someone give script example on how to call the method? Or if there is a better solution I am also open for suggestions, thank you in advance!


    #Customizations
    #Integrations
    #Inventory

    ------------------------------
    KM Cornista
    ------------------------------



  • 2.  RE: Using processing class on automation script inbound

    Posted 02-17-2023 11:32

    Hi KM,

    Did you check in Maximo Demo environment whether it is defaulting the TOBIN value while creating a new Inventory usage line? I have a doubt that this field is getting defaulted on creation of inventory uageline. Still you can have a check. 

    If you want to default this field value with a specific value, you can use the below logic in your OSIN script,

    1. Create a OSIN script in Automation script application.
    2. Add the below logic
    3. Ensure the INVUSELINE.TOBIN is included and not restricted at Object Structure Level.

        def beforeCreateMboSet(ctx):
            global count
            x=0
            struc = ctx.getData()
            child = struc.getChildrenData('INVOICELINE')
            x = len(child)
            count = 0
                while count < x:
                    child[count].setCurrentData("TOBIN","SETYOURDEFAULTVALUE") 
                    count +=1

    Each time a record is generated , the TOBIN field will be set with the default value provided in the script.

    As per my understanding this is your requirement. If not, you can specify here again.

     

          



    ------------------------------
    Subhransu Sekhar Sahoo
    Tata Consultancy Services
    ------------------------------



  • 3.  RE: Using processing class on automation script inbound

    Posted 02-20-2023 08:32

    Hello Sahoo,

    Thanks for the reply. I havent checked the demo environment yet, I will test as well afterwards. Anyway, I don't have issue on how to set value, it's more of how to get the value that I will set to the TOBIN field. I need to put the Default Bin of the item selected and I would like to check if the class psdi.app.inventory.FldInvUseLineToBin contains the information that I need. If it is, I need to know how I can fetch/use this so that I can use it in a query or setCurrentData in the OSIN script. Hope this makes sense.



    ------------------------------
    KM Cornista
    IBM
    ------------------------------



  • 4.  RE: Using processing class on automation script inbound

    Posted 02-20-2023 10:57

    HI KM,

    The logic you are looking for to default the tobin value perhaps present in the action method of psdi.app.inventory.FldInvUseLineToStoreLoc class file which has been associated with the TOSTORELOC attribute of Inventory usage Line object and its only applied to usage type transfer i believe. The TOINVENTORY relationship has been used to fetch the BIN details from corresponding child Inventory record.

    Assuming you are creating inventory usage  record by passing the itemnum,tostoreloc,siteid and Itemsetid attribute value from external system, you can use the below logic in OSIN script to achieve your requirement.

    def beforeCreateMboSet(ctx):
            global count
            x=0
            struc = ctx.getData()
            child = struc.getChildrenData('INVOICELINE')
            x = len(child)
            count = 0

           invSet=MXServer.getMXServer().getMboSet("INVENTORY",ctx.getUserInfo())
                while count < x:

                    invSet.setWhere("itemnum='"+ctx.getData().getCurrentData("ITEMNUM")+"' and location='"+ctx.getData().getCurrentData("TOSTORELOC")+"' and siteid="+ctx.getData().getCurrentData("SITEID")+"' and itemsetid="+ctx.getData().getCurrentData("ITEMSETID")+"'")

                   invSet.reset()

                   child[count].setCurrentData("TOBIN",invSet.getMbo(0).getString("TOBIN")) 
                   count +=1

    Let me know whether this is helpful.



    ------------------------------
    Subhransu Sekhar Sahoo
    Tata Consultancy Services
    ------------------------------



  • 5.  RE: Using processing class on automation script inbound

    Posted 02-21-2023 03:58

    Hello Sahoo,

    This is so helpful. Thank you for the guide! Appreciate this so much.



    ------------------------------
    KM Cornista
    IBM
    ------------------------------