f_billevent_trigger.srf 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. $PBExportHeader$f_billevent_trigger.srf
  2. global type f_billevent_trigger from function_object
  3. end type
  4. forward prototypes
  5. global function integer f_billevent_trigger (long arg_billtype, long arg_eventtype, string arg_taskcode, ref string arg_msg)
  6. end prototypes
  7. global function integer f_billevent_trigger (long arg_billtype, long arg_eventtype, string arg_taskcode, ref string arg_msg);Int rslt = 1
  8. String ls_cmds[], ls_cmd, ls_rslt, ls_msg
  9. Long ll_cnt = 0, ll_i
  10. DECLARE cur1 CURSOR FOR
  11. SELECT escript
  12. FROM sys_event
  13. WHERE billtype = :arg_billtype AND
  14. eventtype = :arg_eventtype AND
  15. isuse = 1 AND
  16. rtrim(escript) <> ''
  17. Order By printid;
  18. OPEN cur1;
  19. FETCH cur1 Into :ls_cmd;
  20. DO WHILE sqlca.SQLCode = 0
  21. ll_cnt++
  22. ls_cmds[ll_cnt] = trim(ls_cmd)
  23. FETCH cur1 Into :ls_cmd;
  24. LOOP
  25. CLOSE cur1;
  26. for ll_i = 1 to ll_cnt
  27. ls_cmd = ls_cmds[ll_i]
  28. if ls_cmd <> '' then
  29. ls_rslt = f_billevent_excute(ls_cmds[ll_i], arg_billtype, arg_eventtype, arg_taskcode)
  30. if ls_rslt<> '' then
  31. ls_msg += ls_cmds[ll_i] + '执行失败~r~n'
  32. ls_msg += '~t' + ls_rslt + '~r~n'
  33. end if
  34. end if
  35. next
  36. if ls_msg <> '' then
  37. rslt = 0
  38. arg_msg = ls_msg
  39. end if
  40. RETURN rslt
  41. end function