from ppms import ppms from ppms.module_subclasses.base_class import Base from ppms.constants import MENU_FILTER, MENU_RESET, MENU_SAVE class ModuleThatOverwritesSave(Base): def menu_override(self, menu_id): if menu_id == MENU_SAVE: ppms.ui_message_box('No saving allowed!') return self.MENU_OVERRIDE_SUCCESS # Don't allow resetting as that brings up a save prompt elif menu_id == MENU_RESET: return self.MENU_OVERRIDE_SUCCESS return super(ModuleThatOverwritesSave, self).menu_override(menu_id)
GROUPINGS = {1:'customer', 2:'pr_manager_name', 3:'ht_pr_code_name', 4:'pr_group_1', 5:'pr_group_2', 6:'pr_group_3', 7:'ou_cctr_name', 8:'calculated_end_date', 9:'phase_name', 10:'ht_pr_plan_idea', 12:'product'}
Beispiel:
<Python-ID>
und <Dataitem-ID>
fungieren als Platzhalter für die Python-ID sowie die ID des Hyperlink-Dataitems.
Hinweisedef computeOutput(di): hl_di = di.get_dtp_record().get_di('<Python-ID>') hl = hl_di.get_hyperlink() if (hl != None): ppms.ui_message_box(hl.get_uid()) return hl.get_uid() else: return "" computeOutput.deps = ('DI<Dataitem-ID>',)
Siehe auch: OLE-Dataitem, Hyperlink-Customizing |
mod_obj = ppms.get_target_module() uid = mod_obj.get_uid() ppms.client_exec(""" env = get_Env() mod = env.ActivePanel.ModuleManager.__getitem__('%s') doc = mod.CreateExcelExportDocument() env.GenerateExcelFile(doc) """ % uid)
Siehe auch: IronPython Api |
get_listboxvalue()
aus dem Customizing Helper Modul implementiert lediglich ein Mapping zwischen tatsächlichen Werten in Datentabellen und den IDs festgelegter Listboxwerte in der entsprechenden Tabelle, kann aber kein X-beliebigen Werte aus einem Listbox-Datensatz auslesen. def computeOutput(di): record = di.get_dtp_record() key0 = record.get_di_by_id(<key0_numeric_di_no>).get_value() # etc. für weitere DIs multicol_key_template = '{0}|{1}|{2}' multicol_key_value = multicol_key_template.format(key0, key1, key2) return multicol_key_value computeOutput.deps = ('DI<key0_textual_di_no>', 'DI<key1_textual_di_no>', ) # etc. für weitere DIs
def processInput(di, oldvalue): record = di.get_dtp_record() key0_di = record.get_di_by_id(<key0_numeric_di_no>) # etc. für weitere DIs new_value = di.get_value() key_values = new_value.split('|', 3) key0_di.set_value(key_values[0]) return new_value processInput.deps = ('DI<key0_textual_di_no>', 'DI<key1_textual_di_no>', ) # etc. für weitere DIs
textual_di_no
ist z.B. der String 000123, numeric_di_no
dagegen die Zahl 123
subject_text = "" body_text = ""
subject_text
= Betreff der E-Mail
body_text
= Inhalt der E-Mail
subject_text
und body_text
über Python setzen.
subject_text = record.name.get_raw_value()
DI_PREFIX = 'DI: ' def di041088_df_python_id_checkInput(di, old_value): if not python_id.is_valid_python_id(di.get_value()): return False dtp_record = di.get_dtp_record() own_lic = python_id.get_owner_license_of_record(dtp_record) da = dtp_record.da.get_value() da_record = ppms.search_record(410, [da], ['own_lic']) parent_own_lic = python_id.get_owner_license_of_record(da_record) return python_id.is_allowed_to_change_python_id(current_python_id=old_value, owner_license=own_lic, user_license=ppms.uvar_get(SYS_VAR_LICENSE), parent_license=parent_own_lic) def di041088_df_python_id_processInput(di, oldvalue): dtp_record = di.get_dtp_record() own_lic = python_id.get_owner_license_of_record(dtp_record) da = dtp_record.da.get_value() da_record = ppms.search_record(410, [da], ['own_lic']) parent_own_lic = python_id.get_owner_license_of_record(da_record) py_id = di.get_value() py_id = python_id.modify_python_id_for_parent_license(python_id=py_id, owner_license=own_lic, user_license=ppms.uvar_get(SYS_VAR_LICENSE), parent_license=parent_own_lic) di.get_dtp_record().df_customizing_name.set_value(py_id) return py_id def get_df_cust_name(di): df_name = di.get_dtp_record().df_customizing_name.get_value() if df_name: return df_name return None def get_di_cust_name(di): di_nr = di.get_dtp_record().di.get_value() if not di_nr: return None di_record = ppms.search_record(412, [di_nr], ['di_customizing_name']) if di_record: return di_record.di_customizing_name.get_value() return None def di041088_df_python_id_computeOutput(di): name = get_df_cust_name(di) if name is None: di_name = get_di_cust_name(di) if di_name is None: return '' name = DI_PREFIX + di_name return name di041088_df_python_id_checkInput.deps = ('DI000306', 'DI001862') di041088_df_python_id_processInput.deps = ('DI001869', 'DI000239') di041088_df_python_id_computeOutput.deps = ('DI041036', 'DI000213', 'DI000984')
# get module object mod_obj=ppms.get_target_module() #mark all records of all datareas in the module with ppms.echo_disabled(): [[mts_rec.mark() for mts_rec in mts_rec_list]for mts_rec_list in [da_obj.get_records() for da_obj in mod_obj.get_das()]]
# get module object mod_obj=ppms.get_target_module() #unmark all marked records of all dataareas in the module with ppms.echo_disabled(): [[mts_rec.unmark() for mts_rec in mts_rec_list]for mts_rec_list in [da_obj.get_marked_records() for da_obj in mod_obj.get_das()]]
# get module object mod_obj=ppms.get_target_module() #mark all records of all datareas in the module ppms.echo_off() [[mts_rec.mark() for mts_rec in mts_rec_list]for mts_rec_list in [da_obj.get_records() for da_obj in mod_obj.get_das()]] ppms.echo_on()
# get module object mod_obj=ppms.get_target_module() #unmark all marked records of all dataareas in the module ppms.echo_off() [[mts_rec.unmark() for mts_rec in mts_rec_list]for mts_rec_list in [da_obj.get_marked_records() for da_obj in mod_obj.get_das()]] ppms.echo_on()
Siehe auch: Splash Screen, Produkt- bzw. Firmenlogos verwenden |
call_resource()
wie folgt anpassen:
from ppms.text_constant import get_text_constant def call_resource(resource_id=ppms.get_target_module().get_current_L_var()[5]): resource_record = ppms.search_record(467, [resource_id[0]], ['resource_type'], True) if not resource_record : message = get_text_constant("001247") ppms.ui_message_box(message.replace("@user_id", resource_id[0]), blocking=1) mod_obj.menu(49) elif resource_record.resource_type.get_value() == "2": ppms.ui_message_id("0860") mod_obj.menu(49) else: mod_obj.set_current_L_var(5, [resource_id[0]])
from ppms.global_setting import get_global_setting_value mod_obj = ppms.get_target_module() rm_modul = get_global_setting_value("L100_employee_board_for_reporting", 'alpha120') inv_rec = ppms.get_context_df().get_record() res_id = inv_rec.res_id.get_raw_value() mod_obj.set_new_L_var(5, [res_id]) mod_obj.open_module(rm_modul)
def processInput(di, oldvalue): rec = di.get_dtp_record() rec.L100_prognose_vom.set_value(ppms.uvar_get("@15")) rec.L100_prognose_von.set_value(ppms.uvar_get("@1")) return di.get_value() processInput.deps = ("L100_prognose_vom", "L100_prognose_von")
mod_obj = ppms.get_target_module() mod_obj.menu(12) for rec in mod_obj.get_da("Python_ID_DA_name").get_records(): rec.DF_Python_ID_planned_load_fixed.set_raw_value(rec.DF_Python_ID_planned_load.get_raw_value()) mod_obj.menu(34) mod_obj.menu(49)
PATH = r'C:\Program Files (x86)\Applikation\anwendung.exe' # Der String, der den Pfad zur Applikation darstellt, wird mit "r" vorangestellt, # weil sonst der Backslash \ als Escape-Zeichen interpretiert werden würde. # Siehe http://docs.python.org/reference/lexical_analysis.html#string-literals ARGS = 'argument1=PLANTA argument2=Nocheins' # Die Argumente, die an die Applikation übertragen werden sollen, einfach als # einen fortlaufenden String deklarieren. def execute_client_script(path, args): ppms.client_exec("""import clr clr.AddReference('System') from System.Diagnostics import Process Process.Start(r'{path}', r'{args}')""".format(path=path, args=args)) execute_client_script(PATH, ARGS)
exp_path
= Speicherpfad der erzeugten PDF-Datei
file_name
= Name der erzeugten PDF-Datei
REPORT_MOD_ID
= Modul, das für die Ausgabe verwendet wird (=Reportmodul), für die Statusberichte z.B. das Standardmodul MOD009A52 Statusbericht
REPORT_VARIANT_ID
= gewünschte Variante des Reportmoduls
DA_PYTHON_ID
= Name des Quell-Datenbereiches im Auswahlmodul
# Moduleinstellungen: Exportpfad. Exportdateiname, Ausgabemodul und zu verwendende Variante, Python-ID des Quell-Datenbereichs exp_path = 'Exportpfad'.replace(chr(92),chr(92)+chr(92)) file_name = "Name der erzeugten PDF Datei" REPORT_MOD_ID = "Modul-ID" REPORT_VARIANT_ID = "Varianten-ID" DA_PYTHON_ID = 'Python-ID' #Auslesen der Druckeinstellungen aus dem Reportmodul module_customizing_record = ppms.search_record(405, [REPORT_MOD_ID], [25609,25610,1789,2947], True) page_size = module_customizing_record.paper_format.get_value() landscape = not bool(module_customizing_record.portrait_format.get_value()) zoom = float(module_customizing_record.zoom_print_preview.get_value()) fit_to_page = bool(module_customizing_record.default_zoom_col.get_value()) #Modulobjekte macro_module = ppms.get_macro_module() select_module = macro_module.get_invoker_module() #Zusammensetzung des Befehls fuer den Client CLIENT_CODE = """ e = get_Env() pdf_list = e.PdfExportDocumentsList list = e.PdfExportDocumentsList page_size = '{page_size}' landscape = {landscape} zoom = {zoom} fit_to_page = {fit_to_page} for uid in {export_list}: module = e.ActivePanel.ModuleManager[uid] doc = module.CreatePdfExportDocument(pageSize=page_size, landscape=landscape, zoom=zoom, fitToPage=fit_to_page) pdf_list.Add(doc) e.ActivePanel.ModuleManager e.GeneratePdfFile(pdf_list, '{exp_path}', '{file_name}') """ def get_selected_reports(): export_list =[] modules_to_close = [] for pr_rec in select_module.get_da(DA_PYTHON_ID).get_records(): pr_id = pr_rec.pr_id.get_raw_value() main_pr_id = pr_rec.main_pr_id.get_raw_value() report_id = pr_rec.report_id.get_raw_value() #Alle im Reportmodul verwendete Filterkriterien setzen select_module.set_new_L_var(30, [pr_id]) select_module.set_new_L_var(78, [report_id]) select_module.set_new_L_var(74, [main_pr_id]) #select_module.set_new_L_var(26, [report_id]) - wird im Makro des Statusberichts gesetzt #select_module.set_new_L_var(25, [report_id]) - ist im Standard leer #Aufruf der Modul-Variante (angedockt ausserhalb der Bildschirmanzeige) reporting_module=select_module.open_module(REPORT_MOD_ID, dock_to_module=select_module.get_uid(), forced_status=2, dock_style=3, dock_proportion=0.001, foreground=0, focus=0) reporting_module.apply_mv_by_id(REPORT_VARIANT_ID) reporting_module.menu(12) modules_to_close.append(reporting_module) #Interne Nummer des geoeffneten Moduls uid = str(reporting_module.get_uid()) #Offene Module zur Liste fuer PDF-Schnittstelle anfuegen export_list.append((uid)) client_call = CLIENT_CODE.format(export_list=export_list, exp_path=exp_path, file_name=file_name, page_size=page_size, landscape=landscape, zoom=zoom, fit_to_page=fit_to_page) ppms.client_exec(client_call) for module in modules_to_close: module.menu(49) select_module.menu(49) #Schleife fuer Anzeige Modulvariante get_selected_reports()
CreatePdfExportDocument()
müssen die Parameternamen mit angegeben werden. doc = module.CreatePdfExportDocument(pageSize='A4',landscape=TRUE, zoom=100.0, fitToPage=TRUE)
statt doc = module.CreatePdfExportDocument('A4', TRUE, 100.0,TRUE)
def executeProcessAction(mts_rec=None,object_id=None): from ppms.processrules import copy_phase_into_model phase = mts_rec.phase.get_raw_value() copy_phase_into_model(object_id, mts_rec, <Prozessmodell-ID>, <Phasen-ID>, phase) return True ppms.get_session_dict()["planta_functions"]=[executeProcessAction]
def executeProcessAction(mts_rec=None,object_id=None): from ppms.processrules import replace_phase_in_model replace_phase_in_model(project_id=object_id, prozess_templ_id=<Prozessmodell-ID>, phase=<Phasen-ID>, forced_phase=<Zielphasen-ID>) return True ppms.get_session_dict()["planta_functions"]=[executeProcessAction]
ppms.module_subclasses.resource.ResourceDatasheet
hinterlegen.
ppms.get_target_module().on_save_check_person_resource()
I | Attachment | History | Size | Date | Comment |
---|---|---|---|---|---|
png | AngemeldeteBenutzer.PNG | r2 r1 | 4.9 K | 2015-03-26 - 16:54 | |
png | ColorPreviewItem.PNG | r2 r1 | 15.5 K | 2019-09-24 - 09:13 | |
png | ModulBudgetinEarth.png | r1 | 15.8 K | 2014-10-15 - 12:08 | |
png | ModulBudgetinVenus.png | r1 | 23.9 K | 2014-10-15 - 12:21 | |
png | ModulCustomizingBudgetKostenartengruppen.png | r1 | 16.2 K | 2014-10-15 - 12:12 | |
png | ModulCustomizingBudgetinVenus.png | r1 | 25.3 K | 2014-10-15 - 12:21 | |
png | ProzentFormat.PNG | r1 | 6.6 K | 2013-06-25 - 12:47 | |
png | UnterDataItemFarbe.png | r2 r1 | 9.5 K | 2019-09-24 - 09:14 | |
png | VorschauFehlt.png | r1 | 15.4 K | 2019-09-24 - 09:06 | |
png | addColorPreviewItemToDA.PNG | r2 r1 | 7.5 K | 2019-09-24 - 09:13 |