CMDBuild Forum

Failing to auto generate Preventive WO on opening date of activity

Hi,

I am using openmaint-2.0-3.1.1 version. The problem here is that Preventive WO not getting auto generated on the opening date of scheduled activity. I have to manually execute the activity to generate Prev WO. I checked the javascript of context menu in Prev.Maint.Calendar and verified with that of openamaint-2.0-3.1a but found no syntax errors.

Could you please guide me where I am wrong in settings ? Thanks

1 Like

Hi…Is there any setting or configuration that I missed in Admin Module ? Stuck with Prev WO automation problem. It’s reducing productivity value of openmaint. Or is it again a version specific problem like the one I faced for DMS feature in openmaint of version 2.0-3.1a. Kindly see to it and help. Thanks

hi @Venus, i managed to get the PrevWOGenerator job to run and the WO are generating automatically from prev. maint calendar entries.

1. Fix the groovy script for the PrevWOGenerator

1.1 Use PGAdmin and navigate to Databases > openmaint > Schemas > public > _Job table
1.2 Locate the record with Code: PrevWOGenerator & Status: A
1.3 Replace the Config with the following (Fix some groovy syntax errors like adding def and using in for the for loops):

{
    "script": "def scheduled_status = cmdb.selectLookupByCode(\"PrevMaintCalendar - ActivityStatus\", \"Scheduled\"); def ongoing_status = cmdb.selectLookupByCode(\"PrevMaintCalendar - ActivityStatus\", \"Ongoing\"); def entries=cmdb.queryClass(\"PrevMaintCalendar\").with(\"ActivityStatus\", scheduled_status).fetch();for(entry in entries){def openingDate = entry.get(\"OpeningDate\");if(openingDate.compareTo(Calendar.getInstance().getTime())<0){cmdb.newProcessInstance(\"PreventiveWO\").with(\"PrevMaintCal\",entry.getId()).startAndAdvance();cmdb.existingCard(\"PrevMaintCalendar\", entry.getId()).with(\"ActivityStatus\", ongoing_status).update();}}",
    "cronExpression": "* * * * ?"
}

1.4 Save the record

2. Navigate to OpenMaint > Administration > System config > Server management

2.1 Under Scheduler_Jobs, Stop and Start the Service

2 Likes

Hi,
I’m using openmaint 2.1 and it says in the new features: Automatic generation of preventive maintenance calendar

I configured all the preventives maintenance items (Maintenance manuals, CI subset, preventive maintenance definition and configuration) but nothing is generated automatically.

In the preventive maintenance configuration, I defined for ie forewarn 14 days and a first due execution date.
But nothing is happening in the preventive maintenance calendar or preventive workorders.

How to make automatic generation of preventive maintenance calendar to work? Any idea? I can’t find any help about it.

Thanks a lot!

Hi @benoithcc I don’t know if you have figured out your query with the solution given by @gameboy90, I do suggest follow those steps. Here I am sharing a screenshot of PgAdmin where you will need to edit the Config script.

image

Hi @gameboy90 script editing solution works. :+1: Thanks a lot.
I did edit the script in database and restarted the Scheduler_Jobs. All workorders get generated at opening dates. It’s a great help. Thanks again

1 Like

Hi @Venus, I will try it this week.
Thanks!

Hi @Venus,
image
I have the problem that preventive maintenance instances are marked as NOT PLANNED YET, do you have an idea about where that comes from ? I don’t find how to get passed this status