Maximo Open Forum

 View Only
  • 1.  OPEN PO Alert before Closing a WO

    Posted 6 days ago
    Edited by Danny Richardson 6 days ago

    I was curious if Maximo out of the box has a setting so that it warns you of an open PO before closing a work order?

    It seems that if you close a work order and have a PO that has not been received it will not allow you to receive the PO.

    So if there is not an out of the box option, I'm considering creating an automation script to warn the user, or even block the closing of a work order if there is an open PO not yet received.

    Or if there is anything best practice to consider with closing Work Orders and open PO's I'd love to hear any advice.

    Thank you in advance,


    #Administration
    #Customizations
    #EndUser
    #EverythingMaximo
    #MaximoApplicationSuite
    #Procurement
    #WorkManagement

    ------------------------------
    Danny Richardson
    Maximo Administrator Manager
    Technimark LLC
    ------------------------------



  • 2.  RE: OPEN PO Alert before Closing a WO

    Posted 3 days ago

    Maximo provides a warning out of the box when a work order is closed that is referenced on a PO that is not fully received. You could add additional logic (such as an automation script) to fully prevent this status change if desired. 

    Generally, I recommend customers don't close work orders via a manual process. I've seen too many situations where users bulk close work orders and there's no good way to recover them. Edit history can be used but it's quite painful. Normally I recommend an escalation that looks for things like the work order is in a COMP status, has not been modified in X days (30, 90, etc.), is not referenced on an open PO, etc. 



    ------------------------------
    Steven Shull
    Naviam
    ------------------------------



  • 3.  RE: OPEN PO Alert before Closing a WO

    Posted 2 days ago

    I agree wholeheartedly with Steven.  Remove the Close Work Order action from (almost) all users, except for Sys Admins and MAYBE a Power User you really trust to understand the whole Work Order lifecycle.  Create an Escalation to do the Close action.  Set the Escalation's WHERE clause to affect only WOs that don't have anything left "open" -- unapproved Labor Transactions; references in MRs, PRs, POs, or Invoices where those records aren't closed out; possibly even if it has Children WOs with any of those same symptoms; etc.



    ------------------------------
    Travis Herron
    Pensacola Christian College
    ------------------------------



  • 4.  RE: OPEN PO Alert before Closing a WO

    Posted 2 days ago

    Thank you @Travis Herron.  We have an escalation, but I haven't thought about updating the where clause like you are suggesting.



    ------------------------------
    Danny Richardson
    Maximo Administrator Manager
    Technimark LLC
    ------------------------------



  • 5.  RE: OPEN PO Alert before Closing a WO

    Posted 2 days ago
    Edited by Danny Richardson 2 days ago

    Thank you @Steven Shull. Does that mean then that you would filter out COMP work orders from the List View screen in Work Order Tracking or Quick Reporting?  



    ------------------------------
    Danny Richardson
    Maximo Administrator Manager
    Technimark LLC
    ------------------------------



  • 6.  RE: OPEN PO Alert before Closing a WO

    Posted 2 days ago

    I recently had a similar requirement while migrating our triggers off our DB into automation scripts. It's an launch point on the status attribute. Here is a starter template for what I came up with. I'm still testing it before moving into production. But I think it's pretty close to the workflow that you're looking for. 

    With that said, we don't allow our users to manually close work orders.  All they can do is put them into a "Completed" status. We then have a batch job that will run 90 days after they are in that status to finally close them.

    from psdi.server import MXServer
    from psdi.util import MXApplicationException
    
    # ---------------------------------------------------------------------------
    # Script Name: VAL_WO_STATUS
    # Launch Point: Attribute - WORKORDER.STATUS - Validate
    # Logic: Prevents Close/Bill/Cancel if open Children or POs exist.
    # ---------------------------------------------------------------------------
    
    # 1. Define the "Gatekeeper" statuses
    stop_statuses = ['CLOSE', 'BILLPREP', 'CAN', 'COMP']
    
    # Get the status the user is trying to change to.
    # Return the NEW value currently in memory.
    pendingStatus = mbo.getString("STATUS")
    
    if pendingStatus in stop_statuses:
    
        # 2. PM Bypass Rule
        #    If this WO came from a PM (Preventive Maintenance), we skip all checks.
        pmnum = mbo.getString("PMNUM")
        
        if not pmnum:
            
            # Get current WO details
            wonum = mbo.getString("WONUM")
            siteid = mbo.getString("SITEID")
            
            # ---------------------------------------------------------
            # CHECK 1: Open Child Work Orders
            # ---------------------------------------------------------
            where_children = "parent = '{}' and siteid = '{}' and status not in ('CAN','CLOSE','BILLPREP')".format(wonum, siteid)
            
            childSet = MXServer.getMXServer().getMboSet("WORKORDER", mbo.getUserInfo())
            childSet.setWhere(where_children)
            
            if not childSet.isEmpty():
                # We found open children! Stop the user.
                params = [wonum] 
                # Ensure "openchildren" exists in Database Config > Messages
                raise MXApplicationException("workorder", "openchildren", params)
                
            childSet.close()
    
            # ---------------------------------------------------------
            # CHECK 2: Open Purchase Orders (Directly on this WO)
            # ---------------------------------------------------------
            where_po = "refwo = '{}' and siteid = '{}' and exists (select 1 from po where po.ponum=poline.ponum and po.revisionnum=poline.revisionnum and po.siteid=poline.siteid and po.status not like 'C%' and po.status <> 'REVISD')".format(wonum, siteid)
            
            poLineSet = MXServer.getMXServer().getMboSet("POLINE", mbo.getUserInfo())
            poLineSet.setWhere(where_po)
            
            if not poLineSet.isEmpty():
                service.error("po", "openpo_on_wo")
                # raise MXApplicationException("po", "openpo_on_wo")
                
            poLineSet.close()
    
            # ---------------------------------------------------------
            # CHECK 3: Open POs on Child Work Orders
            # ---------------------------------------------------------
            where_child_po = "refwo in (select wonum from workorder where parent='{}' and siteid='{}') and siteid = '{}' and exists (select 1 from po where po.ponum=poline.ponum and po.revisionnum=poline.revisionnum and po.siteid=poline.siteid and po.status not like 'C%' and po.status <> 'REVISD')".format(wonum, siteid, siteid)
            
            childPoSet = MXServer.getMXServer().getMboSet("POLINE", mbo.getUserInfo())
            childPoSet.setWhere(where_child_po)
            
            if not childPoSet.isEmpty():
                service.error("po", "openpo_on_childwo")
                # raise MXApplicationException("po", "openpo_on_childwo")
                
            childPoSet.close()
            
            # ---------------------------------------------------------
            # CHECK 4: Open Purchase Requisitions (Directly on this WO)
            # ---------------------------------------------------------
            # Checks PRLINEs linked to this WO where the PR header is not Closed (CLOSE) or Cancelled (CAN)
            where_pr = "refwo = '{}' and siteid = '{}' and exists (select 1 from pr where pr.prnum=prline.prnum and pr.siteid=prline.siteid and pr.status not like 'C%')".format(wonum, siteid)
            
            prLineSet = MXServer.getMXServer().getMboSet("PRLINE", mbo.getUserInfo())
            prLineSet.setWhere(where_pr)
            
            if not prLineSet.isEmpty():
                service.error("pr", "openpr_on_wo")
                # raise MXApplicationException("pr", "openpr_on_wo")
                
            prLineSet.close()
    
            # ---------------------------------------------------------
            # CHECK 5: Open PRs on Child Work Orders
            # ---------------------------------------------------------
            where_child_pr = "refwo in (select wonum from workorder where parent='{}' and siteid='{}') and siteid = '{}' and exists (select 1 from pr where pr.prnum=prline.prnum and pr.siteid=prline.siteid and pr.status not like 'C%')".format(wonum, siteid, siteid)
            
            childPrSet = MXServer.getMXServer().getMboSet("PRLINE", mbo.getUserInfo())
            childPrSet.setWhere(where_child_pr)
            
            if not childPrSet.isEmpty():
                service.error("pr", "openpr_on_childwo")
                # raise MXApplicationException("pr", "openpr_on_childwo")
                
            childPrSet.close()


    ------------------------------
    Brett Coleman
    Georgia Building Authority
    ------------------------------



  • 7.  RE: OPEN PO Alert before Closing a WO

    Posted 2 days ago

    Thank you @Brett Coleman.  I appreciate you sharing the script as a possible starting point.  How do you handle users seeing most recent, relative work orders if work orders stay on the list view for 90 days?  Do you teach them how to filter or do you have an automatic filter set up?



    ------------------------------
    Danny Richardson
    Maximo Administrator Manager
    Technimark LLC
    ------------------------------



  • 8.  RE: OPEN PO Alert before Closing a WO

    Posted 17 hours ago

    HI @Danny Richardson - we have set up a start center portlet using a query that filters the reverse of the escalation, so that they will only see work orders that don't meet the criteria for closure, meaning something must be done about them.

    For example, If a work has no open POs or PRs, is not safety critical, has no compliance markers on it (that's a custom field for us), is in COMP, has failure reporting (based on worktype) and has actual hours entered against us, it won't appear in their start centre, and the escalation will take care of it overnight.

    (We dropped the 90 day delay because we found nobody touched the work orders for 90 days anyway, based on all the criteria above they were finished.)



    ------------------------------
    Craig Webber
    Mercury NZ
    ------------------------------