Monday, 30 December 2019

Add Estimated Duration into Start Date to Caluclate Finish Date | IBM Maximo

Write and Attribute Launch point on Schedule Start Date on Workorder, 

Script will take 2 inputs: Schedule Start date and Estimated Duration.
Add duration into start date and save the final output in schedule finish date.

Object: Workorder
Attribute: SCHEDSTART, Event: Validate


Script:
from java.util import Calendar
appName = mbo.getThisMboSet().getParentApp()
if appName == 'PLUSPWO' and mbo.getString("sp")  =='01' and mbo.getString("spcontract") == '005' and mbo.getInt("istask")  == 0 and mbo.getInt("historyflag") == 0 and mbo.getString("woclass") == 'WORKORDER' :
    if not mbo.isNull('SCHEDSTART'):
        vSSD = mbo.getDate("SCHEDSTART")
     
        #estduration in minutes
        vEstDuration = mbo.getFloat("ESTDUR")*60
   
        cal=Calendar.getInstance()
        cal.setTime(vSSD)
        cal.add(Calendar.MINUTE, long(vEstDuration))
        vNewSFD =  cal.getTime()
        mbo.setValue("SCHEDFINISH",vNewSFD,2L )

No comments:

Post a Comment