,Case When a.ConfirmUserClass='PG' Then '程序' When a.ConfirmUserClass='PE' Then '承辦人' When a.ConfirmUserClass='Leader' Then '主管' else '其他' End as ConfirmUserClass
,Case When a.ConfirmMethod='CF' Then '確認' When a.ConfirmMethod='RJ' Then '退回' When a.ConfirmMethod='RV' Then '撤回' else '其他' End as ConfirmMethod
,Case When a.ConfirmMethod='CF' Then '確認' When a.ConfirmMethod='RJ' Then '退回' When a.ConfirmMethod='RV' Then '撤回'
When a.ConfirmMethod='RJTOp' Then '轉運營辦' When a.ConfirmMethod='CFTLd' Then '轉運營辦確認' else '其他' End as ConfirmMethod
,a.Create_time,d.cn_name as Create_User_Name,b.Step_Text as ""From"",c.Step_Text as ""To"",a.Description
from esn_Todos_flow_his a
left join esn_todos_Flow_StepType b on a.FromType_id = b.id
+" output Inserted.id into @TempTable where id ="+dr["Flowid"]+";"
+" output Inserted.id into @TempTable where id ="+dsr["Flowid"]+";"
;
}
Tsql+=@"select @FlowId=id from @TempTable;
insert into esn_todos_Flow_his (Flow_id,ConfirmTime,FromType_id,ToType_id,ConfirmUserId,ConfirmUserClass,ConfirmMethod,Description,Create_User_id,Create_time) "