$PBExportHeader$f_update_ins_flowdef.srf global type f_update_ins_flowdef from function_object end type forward prototypes global function integer f_update_ins_flowdef (boolean arg_ifcommit, ref string arg_msg) end prototypes global function integer f_update_ins_flowdef (boolean arg_ifcommit, ref string arg_msg);int rslt=1 long ls_i long cnt long ll_flowid,ll_funcid string ls_flowname,ls_sortnum,ls_flowtype for ls_i = 1 to UpperBound(s_oaflow_def) ll_flowid = s_oaflow_def[ls_i].flowid ls_flowname = s_oaflow_def[ls_i].flowname ls_sortnum = string(s_oaflow_def[ls_i].flowid) ls_flowtype = s_oaflow_def[ls_i].flowtype // ll_funcid = s_oaflow_def[ls_i].funcid if ll_flowid = 0 or isnull(ll_flowid) then continue end if cnt = 0 select count(*) into :cnt from OA_FLOWDEF where flowid = :ll_flowid using sqlca; if sqlca.sqlcode<>0 then rslt = 0 arg_msg = '查询操作失败:'+sqlca.sqlerrtext goto ext end if if cnt=0 then insert into OA_FLOWDEF (flowid,flowname,sortnum,flowtype,funcid) values(:ll_flowid,:ls_flowname,:ls_sortnum,:ls_flowtype,:ll_funcid) using sqlca; if sqlca.sqlcode<>0 then rslt = 0 arg_msg = '插入操作失败:'+sqlca.sqlerrtext goto ext end if else update OA_FLOWDEF set flowname = :ls_flowname, sortnum = :ls_sortnum, flowtype = :ls_flowtype, funcid = :ll_funcid where flowid = :ll_flowid using sqlca; if sqlca.sqlcode<>0 then rslt = 0 arg_msg = '更新操作失败:'+sqlca.sqlerrtext goto ext end if end if next ext: if arg_ifcommit and rslt=1 then commit using sqlca; elseif rslt=0 then rollback using sqlca; end if return rslt end function