update system_events set service_code='prv_default_ejb',comp_type='EJB',comp_name= 'WorkOrderRouteAlt' where obj_name = 'worder_route_alt' and event_code='pre_validate';
update system_events set service_code='poic_default_ejb',comp_type='EJB',comp_name= 'WorkOrderRouteAlt' where obj_name = 'worder_route_alt' and event_code='post_item_change';

update system_events set comp_name='WorkOrderRouteAltConf', comp_type='EJB',service_code ='worder_route_amd' 
where obj_name='worder_route_alt' and event_code='pre_confirm';

insert into system_event_services(SERVICE_CODE,SERVICE_DESCR,SERVICE_URI,SERVICE_PROVIDER,METHOD_NAME,RETURN_VALUE,RETURN_TYPE,CHG_DATE,CHG_USER,CHG_TERM)
values ('worder_route_amd','Work order route amd. confirmation','http://localhost:8080/axis/services/ActionHandlerService','Base Information','confirm','String',
'S',sysdate,'Base','Base');

	
insert into system_service_args(SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE)
values ('worder_route_amd',1,'COMPONENT_TYPE','I','Component Type','S',sysdate,'Base','Base','EJB');

insert into system_service_args(SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE)
values ('worder_route_amd',2,'COMPONENT_NAME','I','Component name','S',sysdate,'Base','Base','WorkOrderRouteAltConf');


insert into system_service_args(SERVICE_CODE,LINE_NO,ARG_NAME,ARG_TYPE,CHG_DATE,CHG_USER,CHG_TERM)
values ('worder_route_amd',3,'<tran_id>','B.String',sysdate,'Base','Base');


insert into system_service_args(SERVICE_CODE,LINE_NO,ARG_NAME ,DESCR,ARG_TYPE,CHG_DATE, CHG_USER,CHG_TERM)                                       
values ('worder_route_amd',4,'XTRA_PARAMS','params','S',sysdate,'Base','Base');

insert into system_service_args(SERVICE_CODE,LINE_NO,ARG_NAME ,DESCR,ARG_TYPE,CHG_DATE, CHG_USER,CHG_TERM)                                           
values ('worder_route_amd',5,'FORCED_FLAG','flag','S',sysdate,'Base','Base');


alter table worder_route_alt add remarks varchar2(100); 
alter table worder_route_alt add operation_parent number (5); 
alter table worder_route_alt add emp_code__aprv char (10);



Insert into obj_itemchange (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) values ('worder_route_alt','1','item_code',null);

Insert into obj_itemchange (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) values ('worder_route_alt','1','proc_code',null);

Insert into obj_itemchange (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) values ('worder_route_alt','1','operation_parent',null);



insert into messages
(msg_no,msg_str,msg_descr,msg_type,chg_date,chg_user,chg_term) 
values 
('VTOPRNN','Empty operation','Operation can not be blank.Please enter operation','E',sysdate,'BASE','BASE');
Insert into messages 
(MSG_NO,MSG_STR,MSG_DESCR,MSG_TYPE,MSG_OPT,MSG_TIME,ALARM,ERR_SOURCE,CHG_DATE,CHG_USER,CHG_TERM,OVERRIDE_INPUT,MAIL_OPTION) 
values ('VTALCONF','Transaction Already Confirmed','Selected transaction Already confirmed','E','Y',null,null,null,null,null,null,null,null);




insert into messages
(msg_no,msg_str,msg_descr,msg_type,chg_date,chg_user,chg_term) 
values 
('VTOPRFDB','Operation not confirmed','Parent operation not confirmed in workorder feedback','E',sysdate,'BASE','BASE');

insert into messages
(msg_no,msg_str,msg_descr,msg_type,chg_date,chg_user,chg_term) 
values 
('VTWOSRAM','Invalid user operation','Only work order with status Release are allowed to amend','E',sysdate,'BASE','BASE');


insert into messages
(msg_no,msg_str,msg_descr,msg_type,chg_date,chg_user,chg_term) 
values 
('VTWRANC','Not confirmed','Selected transaction not confirmed','E',sysdate,'BASE','BASE');

insert into messages
(msg_no,msg_str,msg_descr,msg_type,chg_date,chg_user,chg_term) 
values 
('VTWRACS','Confirmed successfully','Selected transaction confirmed successfully','P',sysdate,'BASE','BASE');


update obj_forms set title='WO Route Amendment' where win_name='w_worder_route_alt';
update transetup set confirm_col='confirmed',confirm_val ='Y' where tran_window='w_worder_route_alt';

--20/MAR/14

alter table worder_route_alt add( 
item_code  char(10),
proc_code  char(10),
wait_time number(14,3),
set_time  number(14,3),
run_time  number(14,3),
reset_time number(14,3)  
);

Insert into obj_itemchange (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) values ('worder_route_alt','1','work_ctr',null);
Insert into obj_itemchange (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) values ('worder_route_alt','1','work_order',null);

insert into messages
(msg_no,msg_str,msg_descr,msg_type,chg_date,chg_user,chg_term) 
values 
('VTITMCNN','Item code empty','Please enter item code','E',sysdate,'BASE','BASE');

insert into messages
(msg_no,msg_str,msg_descr,msg_type,chg_date,chg_user,chg_term) 
values 
('VTITMCNM','Invalid item','Entered item code does not exist in item master','E',sysdate,'BASE','BASE');

insert into messages
(msg_no,msg_str,msg_descr,msg_type,chg_date,chg_user,chg_term) 
values 
('VTPRCCNN','process code empty','Please enter process code','E',sysdate,'BASE','BASE');

insert into messages
(msg_no,msg_str,msg_descr,msg_type,chg_date,chg_user,chg_term) 
values 
('VTWRKCNN','Work center empty','Please enter work center','E',sysdate,'BASE','BASE');

insert into messages
(msg_no,msg_str,msg_descr,msg_type,chg_date,chg_user,chg_term) 
values 
('VTMCNN','Machine code empty','Please enter machine code','E',sysdate,'BASE','BASE');

insert into messages
(msg_no,msg_str,msg_descr,msg_type,chg_date,chg_user,chg_term) 
values 
('VTPRCCNM','Invalid process code','Entered process code does not exist in process master','E',sysdate,'BASE','BASE');

insert into messages
(msg_no,msg_str,msg_descr,msg_type,chg_date,chg_user,chg_term) 
values 
('VTWRKCNTN','Invalid work center code','Entered work center code does not exist in workcntr master','E',sysdate,'BASE','BASE');

insert into messages
(msg_no,msg_str,msg_descr,msg_type,chg_date,chg_user,chg_term) 
values 
('VTMCCNE','Invalid machine code','Entered machine code does not exist in machines master','E',sysdate,'BASE','BASE');

Insert into pophelp (FIELD_NAME,MOD_NAME,SQL_STR,DW_OBJECT,MSG_TITLE,WIDTH,HEIGHT,CHG_DATE,CHG_USER,CHG_TERM,DIST_OPT,FILTER_STRING,SQL_INPUT,DEFAULT_COL,POP_ALIGN,QUERY_MODE,PAGE_CONTEXT,POPHELP_COLS,POPHELP_SOURCE,MULTI_OPT,HELP_OPTION,POPUP_XSL_NAME) 
values ('ITEM_CODE','W_WORDER_ROUTE_ALT','SELECT ITEM_CODE,SH_DESCR DESCRIPTION,ITEM_SER,SITE_CODE FROM ITEM WHERE SITE_CODE = ''?''',null,'Select Item Code',0,0,sysdate,'BASE','BASE',null,null,':login_site',null,null,null,null,null,null,null,null,null);

update transetup set table_name='WORDER_ROUTE_ALT' where tran_window='w_worder_route_alt';

--25/MAR/2014

insert into messages
(msg_no,msg_str,msg_descr,msg_type,chg_date,chg_user,chg_term) 
values 
('VTMCHN','Invalid machine code','Entered machine is not in workcenter','E',sysdate,'BASE','BASE');


-- 15/JUL/2014

alter table worder_route_alt add site_code char(5);

Insert into pophelp
(FIELD_NAME,MOD_NAME,SQL_STR,DW_OBJECT,MSG_TITLE,WIDTH,HEIGHT,CHG_DATE,CHG_USER,CHG_TERM)
values ('SITE_CODE','W_WORDER_ROUTE_ALT','select site_code,descr from
site',null,
'Site',null,null,sysdate,'mchaudhari','192.168.0.128');


insert into obj_itemchange (obj_name,form_no,field_name,mandatory)
values('worder_route_alt','1','site_code',null);

--30/JUL/2014
alter table worder_route_alt add dept_code char(5);

insert into messages
(msg_no,msg_str,msg_descr,msg_type,chg_date,chg_user,chg_term) 
values 
('VMDEP1','Invalid department code','The department code entered does not exist in the dept. master. First you have to define it in the master','E',sysdate,'BASE','BASE');

insert into messages
(msg_no,msg_str,msg_descr,msg_type,chg_date,chg_user,chg_term) 
values 
('VTDEPTCNN','Dept. code empty','Please enter Dept. code','E',sysdate,'BASE','BASE');

Insert into pophelp
(FIELD_NAME,MOD_NAME,SQL_STR,DW_OBJECT,MSG_TITLE,WIDTH,HEIGHT,CHG_DATE,CHG_USER,CHG_TERM)
values ('DEPT_CODE','W_WORDER_ROUTE_ALT','SELECT DEPT_CODE,DESCR FROM DEPARTMENT',null,
'Dept. Code',null,null,sysdate,'BASE','BASE');