Monday, November 16, 2015

Map3D Industry Model : Modify Job States & Job State Transitions

By default Map 3D industry models have 4 job states and their corresponding job state transitions.
It is possible to add some extra states and modify or add corresponding state transitions if the defaults are insufficient for your implementation.

Default job states

select * from tb_job_state;


Default job state transitions

select * from tb_job_state_transition;



Transition Direction

  • (F,Forward)
  • (B,Backward)
Transition Type
  • (M,Merge the features)
  • (D,Delete the job)
  • (N, Do nothing)
SQL Example

--insert new job states into table tb_job_state
delete from tb_job_state where id in(5,6,7,8,9);
delete from TB_JOB_STATE_TRANSITION where id in(6,7,8,9,10);
delete from TB_JOB_STATE_TRANSITION where id in(12,13,14,15,16,22);
delete from TB_JOB_STATE_TRANSITION where id in(17,18,19,20,21);
insert into tb_job_state (ID, DESCRIPTION, FEATURES_EDITABLE,INITIAL_STATE,NAME,USE_JOBID) VALUES(5,null,1,1,'Planning',1);
insert into tb_job_state (ID, DESCRIPTION, FEATURES_EDITABLE,INITIAL_STATE,NAME,USE_JOBID) VALUES(6,null,1,0,'Design',0);
insert into tb_job_state (ID, DESCRIPTION, FEATURES_EDITABLE,INITIAL_STATE,NAME,USE_JOBID) VALUES(7,null,1,0,'Phase Planning',0);
insert into tb_job_state (ID, DESCRIPTION, FEATURES_EDITABLE,INITIAL_STATE,NAME,USE_JOBID) VALUES(8,null,1,0,'Construction',0);
insert into tb_job_state (ID, DESCRIPTION, FEATURES_EDITABLE,INITIAL_STATE,NAME,USE_JOBID) VALUES(9,null,1,0,'Asset Management',0);
--insert new job state transitions forward into table tb_job_state_transition
insert into TB_JOB_STATE_TRANSITION (ID,PASSWORD, PREDECESSOR_ID, SUCCESSOR_ID, TRANSITION_DIRECTION, TRANSITION_TYPE) VALUES(6,null,5,6,'F','M');
insert into TB_JOB_STATE_TRANSITION (ID,PASSWORD, PREDECESSOR_ID, SUCCESSOR_ID, TRANSITION_DIRECTION, TRANSITION_TYPE) VALUES(7,null,6,7,'F','M');
insert into TB_JOB_STATE_TRANSITION (ID,PASSWORD, PREDECESSOR_ID, SUCCESSOR_ID, TRANSITION_DIRECTION, TRANSITION_TYPE) VALUES(8,null,7,8,'F','M');
insert into TB_JOB_STATE_TRANSITION (ID,PASSWORD, PREDECESSOR_ID, SUCCESSOR_ID, TRANSITION_DIRECTION, TRANSITION_TYPE) VALUES(9,null,8,9,'F','M');
insert into TB_JOB_STATE_TRANSITION (ID,PASSWORD, PREDECESSOR_ID, SUCCESSOR_ID, TRANSITION_DIRECTION, TRANSITION_TYPE) VALUES(10,null,9,1,'F','M');
--insert new job state transitions delete into table tb_job_state_transition
insert into TB_JOB_STATE_TRANSITION (ID,PASSWORD, PREDECESSOR_ID, SUCCESSOR_ID, TRANSITION_DIRECTION, TRANSITION_TYPE) VALUES(12,null,5,4,'F','D');
insert into TB_JOB_STATE_TRANSITION (ID,PASSWORD, PREDECESSOR_ID, SUCCESSOR_ID, TRANSITION_DIRECTION, TRANSITION_TYPE) VALUES(13,null,6,4,'F','D');
insert into TB_JOB_STATE_TRANSITION (ID,PASSWORD, PREDECESSOR_ID, SUCCESSOR_ID, TRANSITION_DIRECTION, TRANSITION_TYPE) VALUES(14,null,7,4,'F','D');
insert into TB_JOB_STATE_TRANSITION (ID,PASSWORD, PREDECESSOR_ID, SUCCESSOR_ID, TRANSITION_DIRECTION, TRANSITION_TYPE) VALUES(15,null,8,4,'F','D');
insert into TB_JOB_STATE_TRANSITION (ID,PASSWORD, PREDECESSOR_ID, SUCCESSOR_ID, TRANSITION_DIRECTION, TRANSITION_TYPE) VALUES(16,null,9,4,'F','D');
insert into TB_JOB_STATE_TRANSITION (ID,PASSWORD, PREDECESSOR_ID, SUCCESSOR_ID, TRANSITION_DIRECTION, TRANSITION_TYPE) VALUES(22,null,1,4,'F','D');
--insert new job state transitions backwards into table tb_job_state_transition
insert into TB_JOB_STATE_TRANSITION (ID,PASSWORD, PREDECESSOR_ID, SUCCESSOR_ID, TRANSITION_DIRECTION, TRANSITION_TYPE) VALUES(17,null,6,5,'B','N');
insert into TB_JOB_STATE_TRANSITION (ID,PASSWORD, PREDECESSOR_ID, SUCCESSOR_ID, TRANSITION_DIRECTION, TRANSITION_TYPE) VALUES(18,null,7,6,'B','N');
insert into TB_JOB_STATE_TRANSITION (ID,PASSWORD, PREDECESSOR_ID, SUCCESSOR_ID, TRANSITION_DIRECTION, TRANSITION_TYPE) VALUES(19,null,8,7,'B','N');
insert into TB_JOB_STATE_TRANSITION (ID,PASSWORD, PREDECESSOR_ID, SUCCESSOR_ID, TRANSITION_DIRECTION, TRANSITION_TYPE) VALUES(20,null,9,8,'B','N');
insert into TB_JOB_STATE_TRANSITION (ID,PASSWORD, PREDECESSOR_ID, SUCCESSOR_ID, TRANSITION_DIRECTION, TRANSITION_TYPE) VALUES(21,null,1,9,'B','N');
commit;

Result Job States

Result Job State Transitions


No comments:

Post a Comment