DoDailyTasks Method
- Last UpdatedNov 06, 2025
- 3 minute read
This method first schedules shifts for the next 2 days for all the entities.
The shift templates are defined in the Shift_Schedule table for an entity. These shift schedules are defined in standard times for each day of the week, and they do not represent the actual day the shift belongs to an entity. When this method is called, these shift templates are used as a baseline to create consolidated shift schedules for the next 2 days from the current date and time. If shift exceptions are configured for an entity, then those exceptions are accounted for in the shift schedule.
This method purges all historical data older than the configured system attribute value of how long to keep old data. It reads the system attribute “Days to keep data (0=never delete)” (attrid=180) from the System_Attribute table to obtain a cut-off date. The data is purged only if the value for this system attribute is greater than 0, and the cut-off date is the date that is more than that number of days older than the current date and time.
This method also reads the system attributes “Archive database server name” (attr_id=224) and “Archive database name” (attr_id=225) from the System_Attribute table to determine if purged work order data should be archived.
This will purge old data from following tables:
- Error_Log: A value in the logged_at column is older than this cut off date.
- Shift_To_Go: A value in the end_time column is older than this cut off date.
- Item_Transfer: A value in the transfer_time_utc column is older than this cut off date.
- Shipment_Lot: A value in the ship_date_utc column is older than this cut off date.
- Shipment: A value in the ship_date_utc column is older than this cut off date.
- Dx_Log: A value in the logged_at is older than this cut off date.
Note that the following data will be archived to a different database before purging if the system attributes Archive database server name (attr_id=224) and Archive database name (attr_id=225) are provided. Otherwise, these tables are simply purged.
- Job_Hour_History: A value in the hour_start_utc is older than this cut off date or the Job_Hour_History record linked to a job whose job.act_finish_time_utc is older than the cut off date.
- Item_Prod: The item production records linked to a job whose job.act_finish_time_utc is older than the cut off date.
- Item_Cons: The item consumption records linked to a job whose act_finish_time_utc is older than the cut off date.
- Job_History: The job linked to this event whose job.act_finish_time_utc is older than the cut off date.
- Util_History: The utilization events that are older than the cut off date.
- Labor_Usage: The labor usage records (.labor_start_utc) that are older than the cut off date or the labor usage records linked to the job whose job.act_finish_time_utc is older than the cut off date.
- Cert_Audit_Log: The certification logs (.sign_off_utc) that are older than the cut off date or the certification logs linked to this job whose job.act_finish_time_utc is older than the cut off date.
- Data_Log: The data log samples (.sample_time_utc) that are older than the cut off date or the data log samples linked to the job whose job.act_finish_time_utc is older than the cut off date.
- Job_Route: The job route linked to the job whose job.act_finish_time_utc is older than the cut off date.
- Job: All jobs whose act_finish_time_utc is older than the cut off date.
- Wo: If all the jobs in this work order whose job.act_finish_time_utc is older than the cut off date.