{-----------------------------------------------------------------------
'
'
procedure for the service manager
'
'----------------------------------------------------------------------------------}
{....................................AGENT INFO..............................................}
start_agent_info
AgentName = "SERVICE_MANAGER"
AgentDescr = ""
AgentLanguage = ""
__timer_interval = 0
__is_registered = 1
__delete_on_termination = 0
end_agent_info
{....................................PRODUCTION
CODE..................................................}
{..............................................................................new
appointment}
start_bpm_activity "new service request"
start_bpm_subactivity "Appointment
elements"
rec = bpm_getrecid()
if (rec = 0)
then
call
OpenForm("ptAppend","SERV_E01.FM","WORK.SERV",1,"?=SERV")
else
expr
= strcat(rec,"=SERV")
call
OpenForm("ptEdit","SERV_E01.FM","WORK.SERV",1,expr)
endif
end_bpm_subactivity
end_bpm_activity
{..................................................................................service
appointment}
start_bpm_activity "service appointment"
start_bpm_subactivity "Appointment"
rec =
__params[1]
expr = strcat(rec,"=SERV")
call OpenForm("ptEdit","SERV_E02.FM","WORK.SERV",1,expr)
end_bpm_subactivity
end_bpm_activity
{..................................................................................service
estimation}
start_bpm_activity "service estimation"
start_bpm_subactivity "Define
parts and labor"
rec =
__params[1]
expr = strcat(rec,"=SERV")
call OpenForm("ptEdit","SERV_E02.FM","WORK.SERV",1,expr)
end_bpm_subactivity
start_bpm_validation
result = 1
rec = bpm_getrecid(1)
{...get the record id of the first activity}
if (rec = 0)
then
call
message("You havent define parts and labor!")
result
= 0
endif
if (rec >
0) then
disas_mechanic
= LookUp("SERV","SERV",rec,"MECHANIC1","") {....disassemble
mechanic}
reass_mechanic
= LookUp("SERV","SERV",rec,"MECHANIC2","") {....reassemble
mechanic}
if
(disas_mechanic = "") then
call message("You must define a disassemble mechanic!")
result = 1
endif
if
(reass_mechanic = "") then
call message("You must define a reassemble mechanic!")
result = 1
endif
endif
end_bpm_validation
end_bpm_activity
{..................................................................................collect
parts}
start_bpm_activity "collect parts"
start_bpm_subactivity "Parts
to be collected"
rec =
__params[1]
expr = strcat(rec,"=SERV")
call OpenForm("ptEdit","SERV_E02.FM","WORK.SERV",1,expr)
end_bpm_subactivity
end_bpm_activity
{..................................................................................disassemble}
start_bpm_activity "disassemble"
start_bpm_subactivity "Car
to disassemble"
rec =
__params[1]
expr = strcat(rec,"=SERV")
call OpenForm("ptEdit","SERV_E02.FM","WORK.SERV",1,expr)
end_bpm_subactivity
end_bpm_activity
{..................................................................................reassemble}
start_bpm_activity "reassemble"
start_bpm_subactivity "Car
to reassemble"
rec =
__params[1]
expr = strcat(rec,"=SERV")
call OpenForm("ptEdit","SERV_E02.FM","WORK.SERV",1,expr)
end_bpm_subactivity
end_bpm_activity
{..................................................................................host
customer}
start_bpm_activity "host customer"
start_bpm_subactivity "Customer
to host"
rec =
__params[1]
expr = strcat(rec,"=SERV")
call OpenForm("ptEdit","SERV_E02.FM","WORK.SERV",1,expr)
end_bpm_subactivity
end_bpm_activity
{..................................................................................payment
and good bye}
start_bpm_activity "payment and goodbye"
start_bpm_subactivity "Payment"
rec =
__params[1]
expr = strcat(rec,"=SERV")
call OpenForm("ptEdit","SERV_E02.FM","WORK.SERV",1,expr)
end_bpm_subactivity
end_bpm_activity
{.....................................CONTROL
CODE......................................................}
{.................................ACTION
CODE................................................
This agent has as job to coordinate (that' why we call it
a coordinator agent) the activities of
a "luxury cars service facility".
The customer calls to the facility to make an appointment
The personnel in the gate wait the specified date the customer
on his car
The chief mechanic checks the car and decides for the parts,
the disassembly and reassembly mechanic
The customer is hosted to the cafeteria while waiting the
service to finish
The warehouse personnel prepares the parts
list while the disassemble mechanic works
When both of the above activities
are finished the reassembly mechanic does his job
When the customer finishes his/her coffee and the service
steps are finished
the customer goes to office in order to pay
The agent follows the events in real time (at the time that
they are happen!)
}
start_action
{ press F8 for next step }
call bpm_setprocedureowner(__activation_user)
{.....set the procedure owner}
{(1)....any user can put a new service request}
callwait bpm_assign_job ( "new service request" ,
__activation_user , "" , 0)
serv_id = bpm_getrecid(1,__au_step)
{......get the record id of the service request}
app_date = LookUp("SERV","SERV",serv_id,"ADATE","")
customer = LookUp("SERV","SERV",serv_id,"CUSTOMER","")
car_no = LookUp("SERV","SERV",serv_id,"CAR_NO","")
comm = strcat(customer," with car ",car_no)
call bpm_setprocedurecomment(comm)
{.....set the procedures comment}
{(2)....at date (app_date) the GATE SECURITY waits
the customer to come for the appoinment}
app_date_num = DateToNum(app_date)
callwait bpm_assign_job ( "service appointment" ,
"" , "GATE SECURITY" , app_date_num , serv_id )
{(3)....the CHIEF MECHANIC makes the first estimation
of labor and materials, assigns a mechanic}
callwait bpm_assign_job ( "service estimation" ,
"" , "CHIEF MECHANIC" , 0 , serv_id )
disas_mechanic = LookUp("SERV","SERV",serv_id,"MECHANIC1","")
{....disassemble mechanic}
reass_mechanic = LookUp("SERV","SERV",serv_id,"MECHANIC2","")
{....reassemble mechanic}
{split activities....at the same time, the warehouse
prepares the materials,}
{ the mechanic starts working,
the cafeteria hosts the cutomer}
split_in_branch
{parallel split....the technical department
does the job while in...}
split_in_branch
{parallel split...(4) the warehouse prepares the required
parts while ...}
callwait bpm_assign_job ( "collect
parts" , "" , "WAREHOUSE" , 0 , serv_id )
and_branch
{(5).... the assigned mechanic disassebles the engine}
callwait bpm_assign_job ( "disassemble"
, disas_mechanic , "" , 0 , serv_id )
join_branches
{(6).... the assigned mechanic puts the parts
and reassebles the engine}
callwait bpm_assign_job ( "reassemble" ,
reass_mechanic , "" , 0 , serv_id )
and_branch
{(7).... the cafeteria the customer
takes a cofee}
callwait bpm_assign_job ( "host customer"
, "" , "HOSTESS" , 0 , serv_id )
join_branches
{...the customer finished his/her coffee and
the job has been done}
{(8)....the customer goes to the office in order
to pay}
callwait bpm_assign_job ( "payment and goodbye" ,
"" , "OFFICE" , 0 , serv_id )
{------------------------------------ end of
procedure ---------------------------------------------}
end_action
|