How the process of selecting Labels for Packaging is implemented

Product Label Selection Process Automation

This application is about the "Label for Packaging Request Management" as it would be described in the "ISO procedure" of any kind of manufacturing company. The requirement on the application is to automate the "procedure" of "Label Request". This means that the successive "steps" of the procedure are automatically forwarded from one employee to another without any kind of "manager" intervention (the "procedure" is the manager). At any time the manager has the ability to see on what tasks (steps) the employees are engaged. He can also see what tasks are "scheduled" for the next days. After a certain period of time the manager has a complete report on what tasks each employee has been assigned, when has started and when has finished the tasks.


The requirements, put on the application for the "Label Request Procedure", are the following:


"1. The "Product Manager" has usually the permission to start the "New Label for Packaging" request. The appropriate form appears and the product name and some description for what is required.

2. After posting the form a task is assigned to "Creative Department" in order to do the actual designing work. This work can (and must) be attached to the form.

3. The forwarding of the form from "Creative Department" goes to "Product Manager" again in order to accept the quality of the work.

4. If the "Product Manager" accepts the quality of the "label" the procedure sends the form to the "CEO" and "Legal Service" in order to accept or reject the "label" (those tasks are assigned in parallel).

5. If the "CEO" or the "Legal Service" reject the "label" then the form goes again to step (2) in order to adjust the final "label". If both the "CEO" and "Legal Service" roles accept the "label" then...

6. A task is created for the "Procurement Department" in order to find a good price and quality for the massive production of the "label". Finally a price per 1000 labels is put on the form and the task is forwarded.

7. At the same time tasks are assigned to "CEO" and "Marketing Department" in order to evaluate the final price of the "label". If one of them rejects the price then the procedure goes back to step (6).

8. If both the "CEO" and the "Marketing Department" agree on the price then the procedure creates a task for the "Product Manager" in order to file the "label" and the procedure ends succesfully." 

All of the above requirements are put on a coordinator agent. The action_code of the agent's is the following:



     id = __params[1]

     call bpm_setprocedureowner(__activation_user) {.....set the procedure owner}

     num = SelectFrom("SELECT MAX(LNUM) FROM P10002_LABEL_PACKAGE")
     num = num + 1
     call UpdateField("P10002_LABEL_PACKAGE",id,"LNUM",num,"LDATE",crDate)

     comm = LookUpId("P10002_LABEL_PACKAGE",id,"DESCR")
     call bpm_setprocedurecomment(comm) {.....set the procedures comment}

     for j = 1 to 1000 {_b}
          {...repeat the the following tasks...}
          for i = 1 to 1000 {_b}
               callwait bpm_assign_job ( "Creation of Makette-Photo-Label" , "" , "CREATIVE DEPARTMENT" , 0 , id )
               callwait bpm_assign_job ( "Product Manager Label Check" , "" , "PRODUCT MANAGER" , 0 , id )
               flag = LookUpId("P10002_LABEL_PACKAGE",id,"FIRST_CHECK")

               if (flag = 1) then {...until the product manager agrees with the task outcome!}
                    i = 1000
          next {_b}

          {....parallel split: at the same time CEO and LEGAL SERVICE check the "label"}
               callwait bpm_assign_job ( "Creatives Check From CEO" , "" , "CEO" , 0 , id )
               callwait bpm_assign_job ( "Creatives Check From Legal Service" , "" , "LEGAL SERVICE" , 0 , id )

          check1 = LookUpId("P10002_LABEL_PACKAGE",id,"CHECK1")
          check2 = LookUpId("P10002_LABEL_PACKAGE",id,"CHECK2")

          check = check1 + check2
          if (check = 2) then {_b}
               j = 1000 {....the "label" is ok continue}
               {......the SEO or LEGAL SERVICE or both disagree...}
               if (flag = 1) then
                    call UpdateField("P10002_LABEL_PACKAGE",id,"FIRST_CHECK","0")

               {...back to PRODUCT MANAGER again!}
               callwait bpm_assign_job ( "Product Manager Label Check" , "" , "PRODUCT MANAGER" , 0 , id )
          endif {_b}

     next {_b}

     {.....check the market to find good quality and prices for the production of the "label"}
     for i = 1 to 1000 {_b}
          callwait bpm_assign_job ( "Market Search for Label" , "" , "PROCUREMENT DEPARTMENT" , 0 , id )

          {....parallel execution of tasks again!}
               callwait bpm_assign_job ( "Final Label Check from CEO" , "" , "CEO" , 0 , id )
               callwait bpm_assign_job ( "Final Label Check form Marketing" , "" , "MARKETING DEPARTMENT" , 0 , id )

          check1 = LookUpId("P10002_LABEL_PACKAGE",id,"CHECK21")
          check2 = LookUpId("P10002_LABEL_PACKAGE",id,"CHECK22","")

          check = check1 + check2
          if (check = 2) then {....if both of them agree then finish}
               i = 1000

     next {_b}

     {.....goto PRODUCT MANAGER to file the "label"}
     callwait bpm_assign_job ( "Label Filing" , "" , "PRODUCT MANAGER" , 0 , id )


We can see the callwait and split_in_branch keywords. Those keywords give the opportunity to the agent to wait (until a job has been finished) or to have parallel code execution. Those are capabilities that are not presented every day in a programming language (ok script!). Notice that the callwait "calls" the user's activity as it would be a "program's subroutine". Notice also that we have flow of procedure that is defined by conditions into the code. This is a case of ad hoc control flow (not known in advance to the programmer!)


We have to admit that the effect (coordination and historic data collection of the procedure) is far too big for the  lines of code that are written by the application programmer. To be precise the code is a little bigger (the agent contains the code that "describes" the task (activities) assigned to employees). 

The agent (agent prototype precisely) can be viewed form Right Mouse Click on Application's Background->Developer->Resources->Agent Prototypes. The system creates, for every "service" requested, a new "alive" agent that starts to execute his action_code.


Where we define users and roles?


Another issue is that the jobs are assigned to users (employees) not only by name but also (and mainly) by their roles into the company. The users and roles as they are defined into the application can be found at Menu->System->Users/Positions.


How we activate the agent?


A "new label for packages requirement" can be activated on the application from the "New Action" button in the left on the application window. In order the users see the activities (jobs) that are assigned to them exit the demo application and logon 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 same activity is send to all users that happen to have the same role into the company or organization. When the user "completes" the data that the activity required, he/she "forwards" the completed activity to the next step. Then the activity disappears from the window.


In order a user to see activities that assigned to him for today or are uncompleted from yesterday he/she has to activate "Finished Tasks".


How 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 phase of completion, i.e. presented to users "incoming activities" and are worked by them.


How we can evaluate our employees?


When we activate Menu->System->Associates we can see a button captioned "Has Done". By activating it we get all the activities that the user (employee) has finished and by witch role. The time of staring and completing for each activity is also available. This way the real effort that the user has given to the company can be estimated.


How 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).


You can download the client and connect to our Demo Mykosmos Application Server

Download Demo