Wednesday, July 20, 2016

Maximo : Populating ownergroup with a person group a user belongs to

 Below script is used to populate a field (Owner Group) in work order application with logged in users person group.

Launch point 
------------------
Name : KS_OBJ_OWNERGROUP
Desc : Launch Point for User
Intialize = Y
Condition : 
Object : WORKORDER

Autoscript :
Name : KS_OWNERGROUP
Desc : Load person group

from psdi.util.logging import MXLogger
from psdi.util.logging import MXLoggerFactory
from psdi.mbo import MboConstants
from psdi.server import MXServer


logger =  MXLoggerFactory.getLogger("maximo.script");
logger.debug("====================KS_OWNERGROUP." + launchPoint + ": START  =====================")
mboServer = mbo.getMboServer()
user1 = mbo.getUserInfo()
personGroupQuery = "persongroup in (select distinct a.persongroup from persongroup a, persongroupteam b  where b.RESPPARTYGROUP = '"+user+"' and rownum<2 div="">
personGroupMboSet = mboServer.getMboSet("persongroup",user1)
personGroupMboSet.setWhere(personGroupQuery)
personGroupMboSet.reset()
if not personGroupMboSet.isEmpty():
 personGroupMbo=personGroupMboSet.getMbo(0)
 mbo.setValue("OWNERGROUP",personGroupMbo.getString("persongroup"),MboConstants.NOACCESSCHECK|MboConstants.NOVALIDATION_AND_NOACTION)
logger.debug("====================YYZ_OBJ_USERGROUP." + launchPoint + ": END  =====================")




----------------------------------------------------------------------------
 All the messages below are just forwarded messages if some one feels hurt about it please add your comments we will remove the post.Host/author is not responsible for these posts.

Monday, July 11, 2016

Fetch PO's which have been receipts completed more than 90 days

Below query would fetch list of PO's record which have all the receipts closed before 90 days.

select ponum,REVISIONNUM,status from maximo.PO where
 status='APPR' and receipts='COMPLETE' and
 exists (select 1 from (select transdate from (
 select max(TRANSDATE) transdate from maximo.SERVRECTRANS
 where ponum=po.ponum group by ponum union select
 max(TRANSDATE) transdate from maximo.MATRECTRANS where
 ponum=po.ponum group by ponum ) order by transdate desc )
 where rownum <2 and="" p="" sysdate-transdate=""> >90)

using this query we can write an escalation which can change status of PO to COMPLETE or close etc

----------------------------------------------------------------------------
 All the messagesbelow are just forwarded messages if some one feels hurt about it please add your comments we will remove the post.Host/author is not responsible for these posts.