- Generate inspections when starting an inspection plan
When starting an inspection plan using the Actions button and "Start inspection program," the Start date field is mandatory, while the End date field is optional.
When the start date is in the past, the "Inspections" corresponding to the "Conditions" of the program are generated according to the information of "lead time", "Frequency" and "Number of Occurrences" defined in the "Condition for a period of time" .
Nmax then corresponds to the time between the "Start Date" of the program and the "End Date" of the program, if it is less than one year from the current date, or the time between the "Start Date" "of the program and the current date + 1 year if the" End Date "is not defined or is in more than 1 year.
- Daily generation of missing inspections
Each day, a function is automatically executed to generate the inspections that were not generated when the program was started because it is more than one year from the current date. Since this function is executed daily, it generates only one inspection corresponding to the next inspection for the plan if there is one to be added if the inspection date is less than the current date + 1 year and that the inspection date is less than the end date of the program. Note that this function does not generate any inspection in the past.
- Updating inspections when modifying conditions of a program
If the frequency, occurrence, or lead time of the conditions of a program is modified after the program has been started, there must be a recalculation of the planned inspections for the changes to be coherent across the program (i.e: the program needs to be started again). Note that changes will only be made to inspections whose status is anything other than closed and only for future inspections with no results yet.
a. Changing the lead time
No inspection of the plan for this condition should have any result.
If the new date of the first inspection is greater than the current date then a new date is calculated and the whole inspection date is updated taking into account the frequency and the number of occurrences. We do not create inspections in the past. If the date of the first inspection was in the past it is still modified to reflect the new lead time since no result has been added yet but only if the new date is greater than the current date. If inspections can be generated in the one-year period they are. If following the update of inspection inspection dates are planned beyond one year they are deleted.
b. Changing the frequency
None of the generated inspections should have results.
All inspections are deleted and regenerated taking into account the new frequency information, lead time and number of occurrences.
c. Change the number of occurrences.
If the new occurrence number is larger than the previous one we set the are_ins_plan_all_generated flag of the inspection plan to false and we call N times the daily inspection generation function where N is equal to the number of defined occurrences. So inspections will be created if it meets the date criteria.
If the new number of occurrences is smaller than the previous one, we remove the excess inspections, if any, and they are not related to other conditions (otherwise we remove the link between inspection and condition), starting from the last scheduled inspection and going back in time until the number of inspections to be deleted has been removed or until an inspection with a result is found.
In all cases, if a new inspection is to be created after the initial creation of the program, we validate that there is not already an inspection on the same date. If this is the case we simply tie the condition to the existing inspection.