關於表單提交簽核時流程摘要
所要用到的變量
FlowName = CStr(Request("FlowName"))
StepName = CStr(Request("StepName"))
TaskID = CStr(Request("TaskID"))
FlowID = CStr(Request("FlowID"))
UserID = CStr(Session("UserID"))
PassInfoNames = CStr(Request("PassInfo_Names"))
'PassInfoValues = CStr(Session("PassInfo_Values"))
PassInfoValues = CStr(Request("PassInfo_Values"))
TaskVarID = CStr(Request("TaskVarId"))
UserOCId = CStr(Request("UserOCId"))
posid=cstr(Request("POSID"))
關於發送簽核用到的表
提交:
1.INSERT INTO FLOW_LOG
2.INSERT INTO FLOW_STATUS
3.UPDATE FLOW_STATUS
4.insert into TaskVariables(id,taskid,varNames,varValues,summary)
簽核:
1.INSERT INTO FLOW_LOG
2.UPDATE FLOW_STATUS
3.insert into TaskVariables(id,taskid,varNames,varValues,summary)
其提交流程:
將STAND.ASP中的DATASET中的數據,以及FLOWINFO,PASSINFO對象中的數據傳至SUBMIT_DIALOG..ASP中進行處理,然後再傳送到FLOWSUBMIT.ASP中去提交數據.
USER表單 |
加工.提交 |
提交 |
數據庫 |
保存FLOWSUBMIT.asp中 |
保存SUBMIT_DIALOG.ASP INPUT中 |
1 |
2 |
關於1:有DATASET,FLOWINFO,PASSINFLO等變量 關於2:有將1種的各種對象加工為字符串存至INPUT中 |
一、查找出在STEP中關於此任務的IncidentNo-------------------------1-1
二、創建oUltBridge對象-------------------------------------------1-1
三、初始化FLOWINFO,PASSINFO對象---------------------------------1-1
四、執行FLOWLOGIN.ASP中的邏輯段(開發人員自定邏輯段)------------1-1
五、執行SUBMIT_FLOW(),利用OUltBridge.Save(string)保存數據-----1-7
六、執行UpdateTaskVariables(),更新FLOWINFO中數據到ARCHIVE. askVariables表中-----------------------------------------------------8-10
七、關於:提FLOWINFO對象中數據到ultimus變量中,利用客戶端SUBMIT_TASK.aspx頁傳遞數據---------------------------------11-14
詳細內容
一、查找出在STEP中關於此任務的IncidentNo
str = "SELECT NAME, LABEL,INCIDENT FROM STEP WHERE TASKIDENTIFIER='" + Request("TaskID") + "'"
set CN = Server.CreateObject("ADODB.Connection")
oCN.open(Ultimus_ConnectionString)
set RS = oCN.Execute(str)
IncidentNo = trimStr(oRS("INCIDENT").value)
oRS.Close()
oCN.Close()
set RS =nothing
set CN =nothing
二、創建oUltBridge對象
set UltBridge = createUltBridge()
三、初始化FLOWINFO,PASSINFO對象
set FlowInfo = initFlowInfo_standard()
set PassInfo = initPassInfo_standard()
以上為FLOSUBMIT.INC中
四、執行FLOWLOGIN.ASP中的邏輯段(開發人員自定代碼段)
關於案件編號也在此處得到
五、執行SUBMIT_FLOW()
在此發送數據給AFMS COM 數據如
TWORK~5fDATA~5fIDPBG@KWORK~5fNO~7ctext@Fwork~5fno~7ctext,emp~5fno~7ctext,apl~5fdate~7cdate,work~5fdate~7cdate,on~5ftime~7ctext,off~5ftime~7ctext,reason~7ctext,other~5freason~7ctext,apl~5fdpt~5fid~7ctext,apl~5fdpt~5fname~7ctext,apl~5femp~5fname~7ctext,apl~5fjob~5fname~7ctext,remark~7ctext,one~5fdirector~7ctext,two~5fdirector~7ctext,work~7ctext,exp~5freason~7ctext,reason1~7ctext,exp~5freason1~7ctext,flow~5ffin~7ctext,wks~7cnumber@IABID2007040006,f1205350,2007~2f04~2f12~2000~3a00,2007~2f04~2f12~2000~3a00,8~3a20,~3a,0,,IDPBG0725,Web~20Development,^9586^885b^5cf0,^4e00^822c^54e1^5de5,,f1204169,11518,,B,^4e0a^73ed^5237^5361^7570^5e38,^5361^5931^6548,,0&SINSERT~20INTO~20FLOW~5fLOG~20~28FLOW~5fFLOWID~2c~20FLOW~5fSIGN~5fMODE~2c~20FLOW~5fSIGNER~5fID~2c~20FLOW~5fSIGNER~5fJOB~5fID~2c~20FLOW~5fSIGNER~5fPOS~5fID~2c~20FLOW~5fFLOW~5fNAME~2c~20FLOW~5fSTEP~5fNAME~2c~20~20FLOW~5fSIGN~5fREMARK~2cFLOW~5fFLOW~5fINCIDENT~29~20VALUES~20~28~27ABID2007040006~27~2c~204~2c~20~27f1205350~27~2c~20~27Staffer~27~2c~20~27~27~2c~20~27ABWORK~5
fIDPBG~27~2c~20~27BEGIN~27~2c~20~20~27~27~2c0~29&SINSERT~20INTO~20FLOW~5fSTATUS~20~28FLOW~5fFLOWID~2c~20FLOW~5fSTATUS~2c~20FLOW~5fFLOW~5fNAME~2cFLOW~5fFLOW~5fINCIDENT~29~20VALUES~20~28~27ABID2007040006~27~2c~200~2c~20~27ABWORK~5fIDPBG~27~2c0~29"
發起時:TWORK_DATA_IDPBG@KWORK_NO|text@Fwork_no|text,emp_no|text,apl_date|date,work_date|date,on_time|text,off_time|text,reason|text,other_reason|text,apl_dpt_id|text,apl_dpt_name|text,apl_emp_name|text,apl_job_name|text,remark|text,one_director|text,two_director|text,work|text,exp_reason|text,reason1|text,exp_reason1|text,flow_fin|text,wks|number@IABID2007040006,f1205350,2007/04/12 00:00,2007/04/12 00:00,8:20,:,0,,IDPBG0725,Web Development,閆衛峰,一般員工,,f1204169,11518,,B,上班刷卡異常,卡失效,,0&SINSERT INTO FLOW_LOG (FLOW_FLOWID, FLOW_SIGN_MODE, FLOW_SIGNER_ID, FLOW_SIGNER_JOB_ID, FLOW_SIGNER_POS_ID, FLOW_FLOW_NAME, FLOW_STEP_NAME, FLOW_SIGN_REMARK,FLOW_FLOW_INCIDENT) VALUES ('ABID2007040006', 4, 'f1205350', 'Staffer', '', 'ABWORK_IDPBG', 'BEGIN', '',0)&SINSERT INTO FLOW_STATUS (FLOW_FLOWID, FLOW_STATUS, FLOW_FLOW_NAME,FLOW_FLOW_INCIDENT) VALUES ('ABID2007040006', 0, 'ABWORK_IDPBG',0)&SUPDATE FLOW_STATUS SET FLOW_STATUS = 0, FLOW_FLOW_INCIDENT=0 ,FLOW_END_TIME = to_date('2007/04/12 14:55','YYYY-MM-DD HH24:SS:MI') WHERE FLOW_F
LOWID = 'ABID2007040006'
主管簽核時:
TWORK_DATA_IDPBG@KWORK_NO|text@Fwork_no|text,emp_no|text,apl_date|date,work_date|date,on_time|text,off_time|text,reason|text,other_reason|text,apl_dpt_id|text,apl_dpt_name|text,apl_emp_name|text,apl_job_name|text,remark|text,one_director|text,two_director|text,work|text,exp_reason|text,reason1|text,exp_reason1|text,flow_fin|text,wks|number@UABID2007031264,f1210980,2007/03/26 00:00,2007/03/26 00:00,8:00,:,0,,IDPBG0571,MQC,劉鳳萍,一般員工,,f1203521,11688,,A,上班刷卡異常,忘記刷卡,,0<==>ABID2007031264&SINSERT INTO FLOW_LOG (FLOW_FLOWID, FLOW_SIGN_MODE, FLOW_SIGNER_ID, FLOW_SIGNER_JOB_ID, FLOW_SIGNER_POS_ID, FLOW_FLOW_NAME, FLOW_STEP_NAME, FLOW_SIGN_REMARK,FLOW_FLOW_INCIDENT) VALUES ('ABID2007031264', 1, 'f1203521', 'GLZX0006', '', 'ABWORK_IDPBG', 'SUPERVISOR', '',1047)&SUPDATE FLOW_STATUS SET FLOW_STATUS = 1, FLOW_FLOW_INCIDENT=1047 ,FLOW_END_TIME = to_date('2007/04/12 15:23','YYYY-MM-DD HH24:SS:MI') WHERE FLOW_FLOWID = 'ABID2007031264'
function submitFlow(){
try{
var iStatus, sLocalSS="", sDataText=getValidStr(Request("DataText"));
var iSignMode, iFlowStatus;
var sFirstStepName, sLastStepName;
var XMLDom = Server.CreateObject("MSXML.DOMDocument");
oXMLDom.load(Server.MapPath("FlowLogic.xml"));
oXMLDom.async = false;
var StepsNode = oXMLDom.documentElement.selectSingleNode("Steps");
sFirstStepName = oStepsNode.firstChild.selectSingleNode("StepName").nodeTypedValue;
sLastStepName = oStepsNode.lastChild.selectSingleNode("StepName").nodeTypedValue;
sFirstStepName = sFirstStepName.toUpperCase();
sLastStepName = sLastStepName.toUpperCase();
delete oXMLDom;
oUltBridge.Ultimus_ConnStr = getConnectionString("Ultimus_ConnectionString");
oUltBridge.UserData_ConnStr = getConnectionString("Shat_ConnectionString");
switch (Action){
case "SUBMIT":
if (TaskMode=="BEGIN"){
iSignMode = 4;
}
else{
if (StepName==sFirstStepName)
iSignMode = 5;
else
iSignMode = 1;
}
if (IsCompleted || StepName==sLastStepName)
iFlowStatus = 1;
else
iFlowStatus = 0;
iStatus = 3;
break;
case "FINISH":
iSignMode = 0;
iFlowStatus =2;
iStatus = 3;
break;
case "RETURN_PREV":
iSignMode = 2;
iFlowStatus = 0;
iStatus = 4;
break;
case "RETURN_BEGIN":
iSignMode = 3;
iFlowStatus = 0;
iStatus = 4;
break;
case "GROUP_RETURN":
iSignMode = 6;
iFlowStatus = 0;
iStatus = 3;
break;
}
FlowInfo.setValue("FLOW_SIGN_MODE", iSignMode);
if (Summary != ""){
FlowInfo.setValue("A10005", getSummaryText(FlowInfo.getValue("A10005"), DocumentNo, getValidStr(Summary)));
}
else {
FlowInfo.setValue("A10005", getSummaryText(FlowInfo.getValue("A10005")));
}
if (sDataText != ""){
sDataText = sDataText.replace(/\[DocumentNo\]/g, DocumentNo);
}
var sSql;
//********edit by zhan_jin 06/08/11
var conn = getConnectionObject("Shat_ConnectionString");
//********by zhan_jin
/*
*(hw) 20050519 modify
*solve the error(bug) when sign message include one or more charactor "'"
*/
//----------------------begin-----------------------------
var SignRemark=""+Request("SignRemark");
SignRemark=SignRemark.replace(/'/gi,"''");
//********edit by zhan_jin 20060802
//if (Action=="RETURN_PREV"||Action=="RETURN_BEGIN")
//{
// if (SignRemark=="")
// {
// Response.write("when back task,Comment fields can not is null");
// Response.end;
// return;
// }
//}
//********edit by zhan_jin 20060802
//Response.end;
//-----------------------end------------------------------
//modified by robinson on 2005-9-8 , add incidentno into flow_status & flow_log
var UserInfo = getEmpInfobyUserID(UserID, (ClientType == "EMAIL"));
sSql = "INSERT INTO FLOW_LOG "+
"(FLOW_FLOWID, FLOW_SIGN_MODE, FLOW_SIGNER_ID, FLOW_SIGNER_JOB_ID, "+
"FLOW_SIGNER_POS_ID, FLOW_FLOW_NAME, FLOW_STEP_NAME, FLOW_SIGN_REMARK,FLOW_FLOW_INCIDENT) "+
"VALUES ('" + FlowID + "', " + iSignMode + ", '" + getValidStr(session("UserID")) + "', "+
"'" + getValidStr(oUserInfo.job_id) + "', '" + getValidStr(oUserInfo.pos_id) + "', '" + FlowName + "', "+
"'" + StepName + "', '" + SignRemark +"',"+IncidentNo+ ")";
delete oUserInfo;
if (sDataText != "") sDataText += "&";
sDataText += "S" + getEncodeStr(sSql);
if (TaskMode=="BEGIN"){
sSql = "INSERT INTO FLOW_STATUS (FLOW_FLOWID, FLOW_STATUS, FLOW_FLOW_NAME,FLOW_FLOW_INCIDENT) " +
"VALUES ('" + FlowID + "', " + iFlowStatus + ", '" + FlowName + "',"+IncidentNo+")";
}
else{
//********edit by zhan_jin,06/08/11
sSql = "SELECT FLOW_STATUS,FLOW_FLOW_INCIDENT,FLOW_END_TIME FROM FLOW_STATUS WHERE FLOW_FLOWID = '" + FlowID + "'";
var ds = conn.execute(sSql);
bs_flow_status = ds("FLOW_STATUS").value;
bs_incidentno = ds("FLOW_FLOW_INCIDENT").value;
bs_flow_end_time = ds("FLOW_END_TIME").value;
//*******by zhan_jin
sSql = "UPDATE FLOW_STATUS "+
" SET FLOW_STATUS = " + iFlowStatus + ", FLOW_FLOW_INCIDENT=" +IncidentNo +
" ,FLOW_END_TIME = to_date('" + formatDateTime(new Date(), "datetime") + "','YYYY-MM-DD HH24:SS:MI')" +
" WHERE FLOW_FLOWID = '" + FlowID + "'";
}
sDataText += "&S" + getEncodeStr(sSql);
switch (ClientType){
case "STANDARD":
FlowInfo.setValue("FlowID", FlowID);
FlowInfo.setValue("DocumentNo", DocumentNo);
break;
default:
break;
}
sLocalSS = composeFlowInfo(FlowInfo);
if (showDebugWindow) return getDebugWindow("FlowInfo",sLocalSS);
//檢查如果流程已經審批,不執行保存動作,這是為了EMAIL簽核時重复簽核
if (TaskMode !="BEGIN" && ClientType=="EMAIL")
{
var conn = getConnectionObject("Ultimus_ConnectionString");
var sql= " select step.taskidentifier " +
" from step, incident " +
" where step.incident=incident.incident and step.name=incident.name " +
" and ( incident.status=3 or incident.status=7 or "+
" ((step.status=3 or step.status=4 or step.status=7) and incident.status=1)) "+
" and step.taskidentifier='" + TaskID + "'";
var rs =conn.execute(sql);
if ( (rs.bof || rs.eof)) {
sql = "select * from step where taskidentifier='" + TaskID + "' and step.client='" + UserID + "'" ;
rs = conn.execute(sql);
if ( (rs.bof|| rs.eof)) {
return ""; //指派
}
}
else
{return "";
}
}
var save_data = Server.CreateObject("AFMS.DBBridge");
save_data.Connect(getConnectionString("Shat_ConnectionString"));
save_data.SaveData(sDataText);
updateAttachFiles(FlowName + "\\" + DocumentNo);
return "";
}
catch(e){
if (typeof(e) == "string")
return e;
else
return e.description;
}
}
六、執行UpdateTaskVariables()
insert into TaskVariables(id,taskid,varNames,varValues,summary) values('AE362BB0-24D3-434D-84FD-96450C8CDBC9','032614e43fc1d29f908d27aedfe32d','apl_mailrzflagbg_renzisupervisorntdocumentnoapl_emp_noemp_namedirectmanagerstepnameflowidtest-emailflow_dispatch_flagemp_no_cnameflow_sign_modea10005','2007/03/08a1f1207484f1202315ABID2007031263f1207010熊雪霜11525SUPERVISORABID2007031263jacky.jl.lee@126.om0 ( 申請人: f1207010 -- 熊雪霜)1ABID2007031263|2007/03/26 14:06|熊雪霜|2007/04/12 15:32|上班時間::║下班時間:12:00║日期:2007/03/08','ABID2007031263|2007/03/26 14:06|熊雪霜|2007/04/12 15:32|上班時間::║下班時間:12:00║日期:2007/03/08')"
insert into TaskVariables(id,taskid,varNames,varValues,summary) values('"+TaskVarID+"','"+TaskID+"','"+strNames+"','"+strValues+"','"+FlowInfo.getValue("A10005")+"')"
//傳遞Task Valiables
function UpdateTaskVariables(){
try{
var strNames="";
var strValues="";
for(var i=0;i
if(trimStr(FlowInfo.getValue(FlowInfo.Names[i])) == "") continue;
strNames += FlowInfo.Names[i];
strValues += FlowInfo.getValue(FlowInfo.Names[i]);
if(i !== FlowInfo.Names.length -1){
strNames +="";
strValues +="";
}
}
var conn = getConnectionObject("Shat_ConnectionString");
var sql ="insert into TaskVariables(id,taskid,varNames,varValues,summary) values('"+TaskVarID+"','"+TaskID+"','"+strNames+"','"+strValues+"','"+FlowInfo.getValue("A10005")+"')";
conn.execute(sql);
return "";
}
catch(e){
if (typeof(e) == "string")
return e;
else
return e.description;
}
}
七、關於:提FLOWINFO對象中數據到ultimus變量中
string TaskVarID = (Request["TaskVarID"] == null)?"":Request["TaskVarID"].ToString();
string UserID = (Request["UserID"] == null)?"":Request["UserID"].ToLower().ToString();
string strTaskMode = (Request["TaskMode"] == null)?"":Request["TaskMode"].ToString();
string Action =(Request["Action"] == null)?"":Request["Action"].ToString();
string FlowID =(Request["FlowID"] == null)?"":Request["FlowID"].ToString();
string sql = "select * from TaskVariables where id='"+TaskVarID+"'";
DataSet ds = this.GetDS(sql);
string TaskID =ds.Tables[0].DefaultView[0]["TaskID"].ToString();
string TaskVariableNames = ds.Tables[0].DefaultView[0]["varNames"].ToString();
string TaskVariableValues=ds.Tables[0].DefaultView[0]["varValues"].ToString();
string Summary =ds.Tables[0].DefaultView[0]["summary"].ToString();
Ateam.TaskMode taskMode =TaskMode.BEGIN;
if(strTaskMode =="INBOX")
taskMode =TaskMode.INBOX;
Ateam.WFServer.task task = new Ateam.WFServer.task(TaskID,UserID,taskMode);
task.Recipient = UserID;
task.Summary = Summary;
int Incident=0;
string strError;
bool bResult;
if(Action =="SUBMIT" || Action=="FINISH" ||Action =="GROUP_RETURN")
{
bResult = task.Send(TaskVariableNames,TaskVariableValues,out Incident,out strError);
}
else
{
bResult = task.Return(TaskVariableNames,TaskVariableValues,out strError);
}
if(bResult)
{
this.txtError.Text ="[SUCCESS]";
//update flow_flow_incident filed in the table flow_status ,just begin step
if(strTaskMode =="BEGIN" && Action =="SUBMIT")
{
sql = "UPDATE FLOW_STATUS SET FLOW_FLOW_INCIDENT=" +Incident.ToString() +" WHERE FLOW_FLOWID = '" + FlowID + "'";
exeSql(sql);
}
}
function getXmlHttp(){
var xmlhttp;
try {
xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
return xmlhttp;
}
catch (e)
{
try {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
return xmlhttp;
}
catch (e) {
return null;
}
}
}
var _submit_result, _submit_error_num, _submit_error_text,FlowID;
function window_onload() {
var data = new Object();
data.result = _submit_result;
data.errorNum = _submit_error_num;
data.errorText = getDecodeStr(_submit_error_text);
var url ="../SubmitTask.aspx?TaskVarID=&UserID=&TaskMode=&Action=&ClientType=&FlowID="+FlowID;
if(data.errorNum == 0)
{
//var result= showModalDialog(url, null,"dialogHeight: 80px; dialogWidth: 260px; center: Yes; help: No; resizable: Yes; status: No");
result= "[SUCCESS]";
var xmlHttp = getXmlHttp();
//********edit by zhan_jin 06/08/11
var dsql_flow_status;
var dsql_flow_log;
var submitStatus;
var stepname = "";
//********edit by zhan_jin
if(xmlHttp){
xmlHttp.Open("Get",url,false);
xmlHttp.send();
//********edit by zhan_jin
submitStatus = xmlHttp.responseText;
if(submitStatus.substr(0,1) == "f")
{
result = "Ultimus submit not success,Rollback!";
if("" == "BEGIN")
{
dsql_flow_status = "DELETE FLOW_STATUS WHERE FLOW_FLOW_INCIDENT = " + + " AND FLOW_FLOWID = '" + FlowID + "'";
dsql_flow_log = "DELETE FLOW_LOG WHERE FLOW_FLOWID = '" + FlowID + "' AND FLOW_STEP_NAME = '" + stepname + "' AND FLOW_FLOW_INCIDENT =" + ;
execSQL(dsql_flow_status,"Shat_ConnectionString");
execSQL(dsql_flow_log,"Shat_ConnectionString");
}
else
{
dsql_flow_log = "DELETE FLOW_LOG WHERE FLOW_FLOWID = '" + FlowID + "' AND FLOW_STEP_NAME = '" + stepname + "' AND FLOW_FLOW_INCIDENT =" + ;
dsql_flow_status = "UPDATE FLOW_STATUS "+
" SET FLOW_STATUS = " + document.all["h_bs_flow_status"].value + ", FLOW_FLOW_INCIDENT=" +document.all["h_bs_incidentno"].value +
" ,FLOW_END_TIME = to_date('" + document.all["h_bs_flow_end_time"].value + "','YYYY/MM/DD')" +
" WHERE FLOW_FLOWID = '" + FlowID + "'";
execSQL(dsql_flow_status,"Shat_ConnectionString");
execSQL(dsql_flow_log,"Shat_ConnectionString");
}
}
//********edit by zhan_jin
}
else
result="PLEASE INSTALL XMLHTTP COM";
if(result != "[SUCCESS]"){
data.result ="[error]";
data.errorNum=1000;
data.errorText=result;
}
}
window.returnValue = data;
if(!document.all["IsCompleted"]==false)
{
if(document.all["IsCompleted"].value==1)
{
if(document.all["mailRecipients"]!="undefined"&&document.all["mailTitle"]!="undefined"&&document.all["mailContent"]!="undefined")
{
url="../sendmail.aspx?recipients="+document.all["mailRecipients"].value+"&title="+document.all["mailTitle"].value+"&content="+document.all["mailContent"].value;
showModalDialog(url, null,"dialogHeight: 80px; dialogWidth: 260px; center: Yes; help: No; resizable: Yes; status: No")
}
}
}
window.close();
}
其他
關於composeFlowInfo(oFlowInfo) 沒有用到
manager={++}apl_mail=2007/03/08a{++}rzflag=1{++}bg_renzi=f1207484{++}managernt={++}supervisornt=f1202315{++}jobidtype={++}documentno=ABID2007031263{++}apl_emp_no=f1207010{++}emp_name=熊雪霜{++}directmanager=11525{++}supervisor={++}stepname=SUPERVISOR{++}flowid=ABID2007031263{++}su_ma_type={++}test-email=jacky.jl.lee@foxconn.om{++}flow_dispatch_flag=0{++}bu_renzi={++}supervisor_mail={++}emp_no_cname= ( 申請人: f1207010 -- 熊雪霜){++}flow_sign_mode=1{++}a10005=ABID2007031263|2007/03/26 14:06|熊雪霜|2007/04/12 16:19|上班時間::║下班時間:12:00║日期:2007/03/08"
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24537046/viewspace-673250/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/24537046/viewspace-673250/