Maximo Open Forum

 View Only
  • 1.  Update workorder status to its previous status

    Posted 03-25-2024 06:21

    Hi All,

    I have some workorders which have been completed recently by someone mistakenly and now I have to revert that change and update the status of those workorders back as those were before completion happened.

    As my understanding,i believe if i update workorder and woactivity tables with:

    Update workorder set status='Appr', status date= (hardcode the date value)where....

    And delete that row from wos status table.

    Is there anything thing else that i am missing?

    Or any other method apart from sql to make this change?

    Thanks.


    #EverythingMaximo

    ------------------------------
    Trisha S
    Tcs
    ------------------------------


  • 2.  RE: Update workorder status to its previous status

    Posted 03-25-2024 11:50

    Hi @Trisha S! If the change closed the WO, you must change historyflag from 1 to 0 to re-enable the WO.

    If it's just about updating the work order statuses, it's as you say. You delete the last record from the WOSTATUS table, update STATUS in WORKORDER and also STATUSDATE, CHANGEDATE and CHANGEBY, leaving it the same as the last WOSTATUS. Also check woownerhistory because it is possible that if he took ownership prior to the change in status, a record has been generated in that table. In that case you must delete and put back the previous OWNER.

    But if in addition, he made charges for hours, consumption, then those records cannot be deleted, you must do a reversal since when Maximo imputes costs, it updates accounting tables and now you must do a reversal of those costs, that is, impute them in reverse. so that the result remains zero. That is, if you registered 3 hours for a technician, you must register a new one but with a value of -3 to net it. In case of consumption, you must return it to the storeroom.

    Regards!



    ------------------------------
    Martin Fabra
    ARSAT S.A.
    ------------------------------



  • 3.  RE: Update workorder status to its previous status

    Posted 03-25-2024 16:23

    Hi Trisha,

    See below query and update statements that I use to reverts the status of a work order back. The comments in [ ] are what the queries return or what to expect

    use [your Maximo Environment];


    DECLARE @wonum as nvarchar(30);
    SET @wonum='[WONUM]'

    SELECT 'workorder', wonum, parent, status, statusdate, firstapprstatus, * 
    FROM workorder WHERE wonum=@wonum OR parent=@wonum order by 1;

    SELECT 'wostatus SELECT to DELETE',* FROM wostatus 
    WHERE wonum IN (SELECT wonum FROM workorder WHERE wonum=@wonum OR parent=@wonum AND status<>'CLOSE')
    AND status in ('[Statuses after the status you want to go back to]')
    ORDER BY wonum, changedate DESC;

    --[NOTE: Run the above first to ensure that you capture the statuses you want to remove from WOSTATUS]

    --DELETE FROM wostatus
    --WHERE wonum IN (SELECT wonum FROM workorder WHERE wonum=@wonum OR parent=@wonum)
    --AND status in ('[Statuses after the status you want to go back to from above]');


    SELECT 'wostatus SELECT after DELETE ',* FROM wostatus 
    WHERE wonum IN (SELECT wonum FROM workorder WHERE wonum=@wonum OR parent=@wonum AND status <> 'CLOSE')
    ORDER BY wonum, changedate DESC;

    SELECT 'workorder', wonum, parent, status, statusdate, firstapprstatus, * FROM workorder 
    WHERE wonum IN (SELECT wonum FROM workorder WHERE wonum=@wonum OR parent=@wonum AND status <> 'CLOSE')
    ORDER BY 2;

    --[NOTE: Run the above second to ensure that  the statuses you want to remove from WOSTATUS have been deleted]

    --update workorder
    --SET status ='APPR' --[only needed if status is an unapproved status] ,firstapprstatus=NULL --[status you want to revert back to]
    --, historyflag ='0' --[required if historyflag =1]
    WHERE wonum IN (SELECT wonum FROM workorder WHERE wonum=@wonum OR parent=@wonum AND status <> 'CLOSE');

    --[Checks to see that the correct changes have been made]
    SELECT 'workorder after UPDATE', wonum, parent, status, parentchgsstatus, statusdate, firstapprstatus, * FROM workorder 
    WHERE wonum IN (SELECT wonum FROM workorder WHERE wonum=@wonum OR parent=@wonum AND status <> 'CLOSE')
    ORDER BY 2;

    SELECT * FROM wostatus
    WHERE wonum IN (SELECT wonum FROM workorder WHERE wonum=@wonum OR parent=@wonum);

    SELECT historyflag, firstapprstatus, * FROM WORKORDER
    WHERE wonum IN (SELECT wonum FROM workorder WHERE wonum=@wonum OR parent=@wonum);

    Hope this is of some help.

    Cheers

    JB



    ------------------------------
    John Bauer
    Mercury
    ------------------------------



  • 4.  RE: Update workorder status to its previous status

    Posted 03-26-2024 12:24

    Hi Trisha:  a couple of things:

    • If there were assets on those work orders, then you may need to delete the assethierarchy entry as well, i.e. delete from assethierarchy where wonum = {wonum} and siteid = {siteid}.  Otherwise the users may get errors when they try to Close it again.
    • If the work order is a PM, then you need to check to see what's happening there.  On a floating schedule PM (which starts the countdown when the work order is COMPd or Closed), closing the work order may have re-set the PM schedule and started the countdown for the next work order prematurely (depending on whether the previous status was COMP already).  Unfortunately there's no universal fix for that - someone would have to review the PM work orders individually, and you may want to leave them closed.


    ------------------------------
    Shannon Rotz
    InComm Solutions Inc.
    ------------------------------