How the ISO process of Preventive and Corrective Actions is implemented
Preventive and Corrective Actions Process Automation
This application is about the “Preventive and Corrective Actions Management“ as we would describe it in any company‘s “ISO procedure.“ The requirement for the application is to automate the “procedure“ of “Preventive and Corrective Actions.“ That means that the successive “steps“ of the procedure are automatically forwarded from one employee to another without any “manager“ intervention (the “procedure“ is the manager). The manager can see what tasks (steps) the employees are assigned by the system at any time. He can also see what tasks are “scheduled“ for the next few days. After a period, the manager has a complete report on what tasks the system has assigned each employee. And when he has started and finished the tasks.
The requirements put on the application for the “Preventive and Corrective Actions Procedure“ are the following:
1. Every employee can start the “New Preventive and Corrective Actions“ to fill in the appropriate forum. In this form, the employee puts the subject, describes the problem and its causes. They can also fill in the corrective actions and the employees that have to take those actions.
2. After posting the form, the system assigns a task to the “Quality Assurance Manager“ to fill in the form with the names of the associates that must approve those actions.
3. The forwarding of the form from the “Quality Assurance Manager“ goes to each associate (in parallel) that they have to approve or reject the described actions.
4. If all of the assigned associates approve the required actions for approval or rejection, the procedure forwards tasks to every associate (employee) assigned for the execution of the corrective activities. (the system assigns those tasks in parallel).
5. After all employees execute the required actions (filling in some comments), the procedure terminates.
We place all of the above requirements on a coordinator agent. The action_code of the agent is the following:
start_action
id = Mykosmos Technology
call bpm_setprocedureowner(__activation_user) {.....set the procedure owner}
num = SelectFrom(“SELECT MAX(PNUM) FROM P10003_PREV_CORR“)
num = num + 1
call UpdateField(“P10003_PREV_CORR“,id,“PNUM“,num,“PDATE“,crDate)
comm = LookUpId(“P10003_PREV_CORR“,id,“PSUBJECT“)
call bpm_setprocedurecomment(comm) {.....set the procedures comment}
{.....fill in the form from the activating assosiate..............................}
call bpm_openatonce()
callwait bpm_assign_job(“Peventive and Corrective Action“,__activation_user,““,0,id)
{catalog of approving associates....................}
callwait bpm_assign_job(“Approvals for the Corrective Actions“,““,“QUALITY ASSURANCE MANAGER“,0,id)
{...........get the group of approving associates.....................}
start_sql “*“ “KOSMOS“
SELECT * FROM P10003_PREV_CORR_APPR
WHERE (PREV_CORR = :A)
end_sql
q = QueryByName()
call TSetParam(q,“A“,id)
call TExecute(q)
appr_count = TRecordCount(q)
call TFirst(q)
for i = 1 to appr_count
appr_name[i] = TGetFld(q,“AU_USER“)
appr_name[i] = LookUpId(“AU_USER“,appr_name[i],“UNAME“)
appr_id[i] = TGetFld(q,“PREV_CORR_APPR“)
call TNext(q)
next
call FreeEmbSQL(q)
{...........sent tasks for approving (parallel execution)......................}
split_for i = 1 to appr_count
callwait bpm_assign_job(“Approval/Rejection of Corrective Actions“, appr_name[i], ““, 0, id, appr_id[i] )
appr_flag[i] = LookUpId(“P10003_PREV_CORR_APPR“,appr_id[i],“YES_FLAG“)
next_branch
{.....does everybody has approved?.....}
flag = 1
for i = 1 to appr_count
if (appr_flag[i] <> “) then
flag = 0
endif
next
{.......get the group of correction associates..................................}
start_sql “*“ “KOSMOS“
SELECT * FROM P10003_PREV_CORR_EXE
WHERE (PREV_CORR = :A)
end_sql
q = QueryByName()
call TSetParam(q,“A“,id)
call TExecute(q)
corr_count = TRecordCount(q)
call TFirst(q)
for i = 1 to corr_count
corr_name[i] = TGetFld(q,“AU_USER“)
corr_name[i] = LookUpId(“AU_USER“,corr_name[i],“UNAME“)
corr_id[i] = TGetFld(q,“PREV_CORR_EXE“)
call TNext(q)
next
call FreeEmbSQL(q)
{.....if everybody has approved, send the tasks to correction associates}
if (flag = 1) then
{...............correction in parallel split......................}
split_for i = 1 to corr_count
callwait bpm_assign_job(“Corrective Action“, corr_name[i], ““, 0, id, corr_id[i] )
corr_flag[i] = LookUpId(“P10003_PREV_CORR_EXE“,corr_id[i],“YES_FLAG“)
next_branch
endif
end_action
We can see the callwait and split_for keywords. Those keywords allow the agent to wait (until the users have finished a job) or parallel code execution (for an undefined initial number of parallel tasks). Notice that the callwait “calls“ the user‘s activity as it would be a “program‘s subroutine.“ Notice also that we have a flow of procedures that the developer defines using conditions in the code. That is a case of ad hoc control flow (not known in advance to the programmer!)
We have to admit that the effect (coordination and historical data collection of the procedure) is far too significant for the lines of code that the application programmer writes. To be precise, the code is a little bigger (the agent contains the code that “describes“ the task (activities) assigned to employees).
We can view the agent prototype from right-mouse Click on Application‘s Background->Developer->Resources->Agent Prototypes. For every “service“ requested, the system creates a new “alive“ agent that starts to execute his action_code.
Where do we define users and roles?
Another issue is the jobs are assigned to users (employees) by name. But they are mainly using their roles in the company. The users and roles as we have defined them in the application are at Menu->System->Users/Positions.
How do we activate the agent?
A “new preventive and corrective action“ can be activated from the “New Action“ button in the left of the application window. For the users to see the activities (jobs) assigned to them, exit the demo application, and log in as the user in question.
How can the user see the incoming jobs?
Every user has the incoming activities window defined as “Tasks“ in the menu. Notice that the system sends the same activity to all users who have the same role in the company or organization. When the user “completes“ the activity required data, he “forwards“ the completed activity to the next step. Then the activity disappears from the window.
In order, a user to see activities that were assigned to him for today or are uncompleted from yesterday, he has to activate “Finished Tasks.“
How does the manager can see the current jobs?
By activating Menu->CPO Control Panel->Active Tasks, we see every activity (job) that is assigned at the time and is in the phase of completion, i.e., presented to users “incoming activities.“
How do we can evaluate our employees?
When we activate Menu->System->Associates, we can see a button captioned “Has Done.“ We get all the activities that the user (employee) has finished and by which role by activating it. The time of starting and completing each activity is also available—this way, the actual effort that the user has given to the company can be estimated.
How do we can improve the demo application?
The demo application comes with “Developer“ capabilities. That means we have the opportunity to change the database schema (Right Click->Developer->Resources->Database Manager->Edit Schema). We can also change the forms (Right Click over a form->Designing).