The documentation from version 39.5.17 of PLANTA project can be found in the new PLANTA Online Help.

Customizing Examples for Interfaces

Customize Individual System Check Class (from DB 39.5.7)

Task

  • Customize an individual check class
    • The class is supposed to check whether there is a file under the path stored in Parameter.

Procedure

  • Create a new check.py file under /py/customer/ppms/interface/parameter/conditional
  • The following code is inserted in the file:

import os

from ppms.interface import BaseConditional


class FileExistsConditional(BaseConditional):
    """Check if the file configured in the parameter exists"""
    
    @property
    def is_satisfied(self):
        return os.path.isfile(self.parameter)
    
    @property
    def value(self):
        if self.is_satisfied:
            return 'File exists!'
        
        return 'File does not exist!'

  • Restart the PLANTA service.
  • The class can now be used.

See also: Systems in PLANTA link

Stamping in Export Procedure

Task

  • Actual hours are to be exported summarized to a file (without pool). The source record is to be stamped in DT427.

Procedure

Example

  • New DIs in DT472: Create L100_exported_on and L100_exported_by.
  • Create the following source module.
    • DT463 Task grouped
      • DT463 Task (summarized) with DA-Python-ID: task_source_records
        • DT466 Resource assignment (summarized) with DA-Python-ID: res_source_records
          • DT472 Load with DA-Python-ID: load_act_source_records
  • Enter the associated stamp_mts.py module subclass

Notes

  • When using the Load export interface, the following data fields are stamped by default: SAP status, Exported on, Exported by.
  • The above mentioned customizing example shows how arbitrary data fields can be stamped. This is necessary, e.g., if the actual data must be exported multiple times (to different targets).

Optimize Performance of Interface Calls (From DB 39.5.8)

Task

  • The performance of the PLANTA link has been improved in DB 39.5.8 by drastically lowering the neceessary database access.
  • Individual code that calls interfaces can also be optimized.

Procedure

  • Make the following changes:

  • Previous code:
from ppms.interface import Config

config = Config('config-uuid')
# copy/execute the interface ...
  • New code:
from ppms.interface import StaticConfig

config = StaticConfig('config-uuid')
# copy/execute the interface ...

Topic attachments
I Attachment History Size Date Comment
Txttxt stamp_mts.py.txt r1 2.5 K 2016-04-27 - 21:39  

         PLANTA project









 
  • Suche in Topic-Namen

  • Suche in Topic-Inhalten
This site is powered by the TWiki collaboration platform Powered by Perl