Monday 17 January 2022

Concatenate the modified Location specification for a location

Concatenate the modified Location specification for a location and send mail.


Create a non Persistent Field LocStore with ALN type  LOCSPEC

  


from psdi.util.logging import MXLoggerFactory

from psdi.plust.app.location import PlusTLocation as Location

from psdi.util.logging import MXLogger

from java.util import Properties

from psdi.server import MXServer

logger = MXLoggerFactory.getLogger("maximo.script")

logger.debug("LOCSPEC=> Executing Script")

classsMboSet = mbo.getMboSet("CLASSSTRUCTURE")

if classsMboSet.isEmpty() == False:

    classMbo  = classsMboSet.getMbo(0)

    classificationid = classMbo.getString("CLASSIFICATIONID")

    if classificationid == 'AIRPORT':

        mbo.isModified("ALNVALUE")

        VALUE=mbo.getString("ALNVALUE")

        if VALUE is None:

         VALUE=mbo.getString("NUMVALUE")

        locspec_owner = mbo.getOwner()

        if isinstance(locspec_owner,Location):

          locspec_owner.setValue("LOCSPEC",locspec_owner.getString("LOCSPEC") +"<br> </br>" +str(mbo.getString("ASSETATTRID")) +" : "+ VALUE  )

  commTemplateSet = MXServer.getMXServer().getMboSet("COMMTEMPLATE",MXServer.getMXServer().getSystemUserInfo())

  commTemplateSet.setWhere("templateid='TEMPLATENAME'")

  commTemplateSet.reset()

  commTemplateSet.getMbo(0).sendMessage(mbo, mbo)

No comments:

Post a Comment