uo_oa_demo.sru 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. $PBExportHeader$uo_oa_demo.sru
  2. forward
  3. global type uo_oa_demo from nonvisualobject
  4. end type
  5. end forward
  6. global type uo_oa_demo from nonvisualobject
  7. end type
  8. global uo_oa_demo uo_oa_demo
  9. type variables
  10. Transaction ins_tran
  11. end variables
  12. forward prototypes
  13. public function integer del (long arg_demoid, ref string arg_msg, boolean arg_ifcommit)
  14. public function integer save (s_oa_demo arg_doc, ref string arg_msg, ref long arg_demoid, boolean arg_ifcommit)
  15. end prototypes
  16. public function integer del (long arg_demoid, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
  17. If arg_demoid <= 0 Then
  18. rslt = 0
  19. arg_msg = '无效的公文模板模板ID'
  20. Goto ext
  21. End If
  22. Delete From oa_demo_step
  23. Where (oa_demo_step.demoid = :arg_demoid) Using ins_tran;
  24. If ins_tran.SQLCode <> 0 Then
  25. arg_msg = '删除公文模板流转失败>>'+ins_tran.SQLErrText
  26. rslt = 0
  27. Goto ext
  28. End If
  29. Delete From oa_demo_stepemp
  30. Where oa_demo_stepemp.demoid = :arg_demoid
  31. Using ins_tran;
  32. If ins_tran.SQLCode <> 0 Then
  33. arg_msg = '删除公文模板流程相关人员失败'+ins_tran.SQLErrText
  34. rslt = 0
  35. Goto ext
  36. End If
  37. Delete From oa_demo_item
  38. Where oa_demo_item.demoid = :arg_demoid
  39. Using ins_tran;
  40. If ins_tran.SQLCode <> 0 Then
  41. arg_msg = '删除公文模板自定义字段失败'+ins_tran.SQLErrText
  42. rslt = 0
  43. Goto ext
  44. End If
  45. Delete From oa_demo_fj_cell
  46. Where oa_demo_fj_cell.demoid = :arg_demoid
  47. Using ins_tran;
  48. If ins_tran.SQLCode <> 0 Then
  49. arg_msg = '删除Excel主附件自动填写参数失败'+ins_tran.SQLErrText
  50. rslt = 0
  51. Goto ext
  52. End If
  53. Delete From oa_demo_annex
  54. Where oa_demo_annex.demoid = :arg_demoid
  55. Using ins_tran;
  56. If ins_tran.SQLCode <> 0 Then
  57. arg_msg = '删除公文模板失败(附件表)'+ins_tran.SQLErrText
  58. rslt = 0
  59. Goto ext
  60. End If
  61. Delete From oa_demo
  62. Where oa_demo.demoid = :arg_demoid
  63. Using ins_tran;
  64. If ins_tran.SQLCode <> 0 Then
  65. arg_msg = '删除公文模板失败'+ins_tran.SQLErrText
  66. rslt = 0
  67. Goto ext
  68. End If
  69. ext:
  70. If arg_ifcommit And rslt = 1 Then
  71. Commit Using ins_tran;
  72. ElseIf rslt = 0 Then
  73. Rollback Using ins_tran;
  74. End If
  75. Return rslt
  76. end function
  77. public function integer save (s_oa_demo arg_doc, ref string arg_msg, ref long arg_demoid, boolean arg_ifcommit);Long rslt = 1
  78. Long ls_newid,ll_i
  79. Long cnt
  80. If IsNull(arg_doc.doctitle) Then arg_doc.doctitle = ''
  81. If IsNull(arg_doc.doccontent) Then arg_doc.doccontent = ''
  82. If Trim(arg_doc.doctitle) = '' Then
  83. arG_MSG = '缺乏公文标题'
  84. rslt = 0
  85. Goto ext
  86. End If
  87. If Trim(arg_doc.doccontent) = '' Then
  88. arG_MSG = '缺乏公文内容'
  89. rslt = 0
  90. Goto ext
  91. End If
  92. Select count(*)
  93. Into :cnt
  94. From oa_demo
  95. Where democode = :arg_doc.democode
  96. And demoid <> :arg_doc.demoid Using ins_tran;
  97. If ins_tran.SQLCode <> 0 Then
  98. arG_MSG = '查询公文模板编码是否重复失败>>'+ins_tran.SQLErrText
  99. rslt = 0
  100. Goto ext
  101. End If
  102. If cnt > 0 Then
  103. rslt = 0
  104. arG_MSG = '公文模板编码重复,请修改'
  105. Goto ext
  106. End If
  107. If arg_doc.demoid = 0 Then //新建
  108. ls_newid = f_sys_scidentity(sys_scid,"oa_demo","demoid",arG_MSG,True,id_sqlca)
  109. Insert Into oa_demo
  110. (demoid,
  111. democode,
  112. doctitle,
  113. doccontent,
  114. flowid,
  115. typeid,
  116. timedscrp,
  117. specialdscrp,
  118. secrecy,
  119. dscrp,
  120. opemp,
  121. opdate,
  122. relqty)
  123. Values (:ls_newid,
  124. :arg_doc.democode,
  125. :arg_doc.doctitle,
  126. :arg_doc.doccontent,
  127. :arg_doc.flowid,
  128. :arg_doc.typeid,
  129. :arg_doc.timedscrp,
  130. :arg_doc.specialdscrp,
  131. :arg_doc.secrecy,
  132. :arg_doc.dscrp,
  133. :publ_operator,
  134. getdate(),
  135. :arg_doc.relqty) Using ins_tran;
  136. If ins_tran.SQLCode <> 0 Then
  137. arG_MSG = '建立公文模板失败>>'+ins_tran.SQLErrText
  138. rslt = 0
  139. Goto ext
  140. End If
  141. Else
  142. ls_newid = arg_doc.demoid
  143. Update oa_demo
  144. Set democode = :arg_doc.democode,
  145. doctitle = :arg_doc.doctitle,
  146. doccontent = :arg_doc.doccontent,
  147. flowid = :arg_doc.flowid,
  148. typeid = :arg_doc.typeid,
  149. timedscrp = :arg_doc.timedscrp,
  150. specialdscrp = :arg_doc.specialdscrp,
  151. secrecy = :arg_doc.secrecy,
  152. dscrp = :arg_doc.dscrp,
  153. modemp = :publ_operator,
  154. moddate = getdate(),
  155. relqty = :arg_doc.relqty
  156. Where demoid = :arg_doc.demoid Using ins_tran;
  157. If ins_tran.SQLCode <> 0 Then
  158. arG_MSG = '更新公文模板失败>>'+ins_tran.SQLErrText
  159. rslt = 0
  160. Goto ext
  161. End If
  162. Delete From oa_demo_step
  163. Where (demoid = :arg_doc.demoid) Using ins_tran;
  164. If ins_tran.SQLCode <> 0 Then
  165. arG_MSG = '删除公文模板原步骤失败>>'+ins_tran.SQLErrText
  166. rslt = 0
  167. Goto ext
  168. End If
  169. Delete From oa_demo_item
  170. Where (demoid = :arg_doc.demoid) Using ins_tran;
  171. If ins_tran.SQLCode <> 0 Then
  172. arG_MSG = '删除公文模板原自定义字段失败>>'+ins_tran.SQLErrText
  173. rslt = 0
  174. Goto ext
  175. End If
  176. Delete From oa_demo_fj_cell
  177. Where (demoid = :arg_doc.demoid) Using ins_tran;
  178. If ins_tran.SQLCode <> 0 Then
  179. arG_MSG = '删除Excel主附件自动填写参数失败>>'+ins_tran.SQLErrText
  180. rslt = 0
  181. Goto ext
  182. End If
  183. Delete From oa_demo_stepemp
  184. Where (demoid = :arg_doc.demoid) Using ins_tran;
  185. If ins_tran.SQLCode <> 0 Then
  186. arG_MSG = '删除公文模板原步骤人员失败>>'+ins_tran.SQLErrText
  187. rslt = 0
  188. Goto ext
  189. End If
  190. End If
  191. For ll_i = 1 To UpperBound(arg_doc.arg_s_step)
  192. Insert Into oa_demo_step
  193. (demoid,
  194. flowsort,
  195. flowstepname,
  196. flowempstr,
  197. flowinfo,
  198. limithour,
  199. ifopflag,
  200. ifnecessary,
  201. ifjoin,
  202. ifmod_relqty,
  203. ifmodfj)
  204. Values
  205. (:ls_newid,
  206. :arg_doc.arg_s_step[ll_i].flowsort,
  207. :arg_doc.arg_s_step[ll_i].flowstepname,
  208. :arg_doc.arg_s_step[ll_i].flowempstr,
  209. :arg_doc.arg_s_step[ll_i].flowinfo,
  210. :arg_doc.arg_s_step[ll_i].limithour,
  211. :arg_doc.arg_s_step[ll_i].ifopflag,
  212. :arg_doc.arg_s_step[ll_i].ifnecessary,
  213. :arg_doc.arg_s_step[ll_i].ifjoin,
  214. :arg_doc.arg_s_step[ll_i].ifmod_relqty,
  215. :arg_doc.arg_s_step[ll_i].ifmodfj) Using ins_tran;
  216. If ins_tran.SQLCode <> 0 Then
  217. arG_MSG = '发布公告失败2,插入审核步骤失败>>'+ins_tran.SQLErrText
  218. rslt = 0
  219. Goto ext
  220. End If
  221. Next
  222. For ll_i = 1 To UpperBound(arg_doc.arg_s_stepemp)
  223. Insert Into oa_demo_stepemp
  224. (demoid,
  225. flowsort,
  226. empid)
  227. Values
  228. (:ls_newid,
  229. :arg_doc.arg_s_stepemp[ll_i].flowsort,
  230. :arg_doc.arg_s_stepemp[ll_i].empid) Using ins_tran;
  231. If ins_tran.SQLCode <> 0 Then
  232. arG_MSG = '发布公告失败3,插入审核步骤人员信息失败>>'+ins_tran.SQLErrText
  233. rslt = 0
  234. Goto ext
  235. End If
  236. Next
  237. For ll_i = 1 To UpperBound(arg_doc.arg_s_item)
  238. Insert Into oa_demo_item
  239. (demoid,
  240. printid,
  241. itemname,
  242. itemtype,
  243. flowsort,
  244. ifrequired,
  245. cell,
  246. ifread,
  247. dscrp_ch)
  248. Values (:ls_newid,
  249. :arg_doc.arg_s_item[ll_i].printid,
  250. :arg_doc.arg_s_item[ll_i].itemname,
  251. :arg_doc.arg_s_item[ll_i].itemtype,
  252. :arg_doc.arg_s_item[ll_i].flowsort,
  253. :arg_doc.arg_s_item[ll_i].ifrequired,
  254. :arg_doc.arg_s_item[ll_i].cell,
  255. :arg_doc.arg_s_item[ll_i].ifread,
  256. :arg_doc.arg_s_item[ll_i].dscrp_ch) Using ins_tran;
  257. If ins_tran.SQLCode <> 0 Then
  258. arG_MSG = '发布公告失败4,插入自定义字段信息失败>>'+ins_tran.SQLErrText
  259. rslt = 0
  260. Goto ext
  261. End If
  262. Next
  263. For ll_i = 1 To UpperBound(arg_doc.arg_s_fj_cell)
  264. Insert Into oa_demo_fj_cell
  265. (demoid,
  266. printid,
  267. argname,
  268. cell)
  269. Values (:ls_newid,
  270. :arg_doc.arg_s_fj_cell[ll_i].printid,
  271. :arg_doc.arg_s_fj_cell[ll_i].argname,
  272. :arg_doc.arg_s_fj_cell[ll_i].cell) Using ins_tran;
  273. If ins_tran.SQLCode <> 0 Then
  274. arG_MSG = '发布公告失败5,插入Excel主附件自动填写参数失败>>'+ins_tran.SQLErrText
  275. rslt = 0
  276. Goto ext
  277. End If
  278. Next
  279. arg_demoid = ls_newid
  280. ext:
  281. If rslt = 0 Then
  282. Rollback Using ins_tran;
  283. ElseIf arg_ifcommit And rslt = 1 Then
  284. Commit Using ins_tran;
  285. End If
  286. Return rslt
  287. end function
  288. on uo_oa_demo.create
  289. call super::create
  290. TriggerEvent( this, "constructor" )
  291. end on
  292. on uo_oa_demo.destroy
  293. TriggerEvent( this, "destructor" )
  294. call super::destroy
  295. end on