123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347 |
- $PBExportHeader$uo_oa_demo.sru
- forward
- global type uo_oa_demo from nonvisualobject
- end type
- end forward
- global type uo_oa_demo from nonvisualobject
- end type
- global uo_oa_demo uo_oa_demo
- type variables
- Transaction ins_tran
- end variables
- forward prototypes
- public function integer del (long arg_demoid, ref string arg_msg, boolean arg_ifcommit)
- public function integer save (s_oa_demo arg_doc, ref string arg_msg, ref long arg_demoid, boolean arg_ifcommit)
- end prototypes
- public function integer del (long arg_demoid, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
- If arg_demoid <= 0 Then
- rslt = 0
- arg_msg = '无效的公文模板模板ID'
- Goto ext
- End If
- Delete From oa_demo_step
- Where (oa_demo_step.demoid = :arg_demoid) Using ins_tran;
- If ins_tran.SQLCode <> 0 Then
- arg_msg = '删除公文模板流转失败>>'+ins_tran.SQLErrText
- rslt = 0
- Goto ext
- End If
- Delete From oa_demo_stepemp
- Where oa_demo_stepemp.demoid = :arg_demoid
- Using ins_tran;
- If ins_tran.SQLCode <> 0 Then
- arg_msg = '删除公文模板流程相关人员失败'+ins_tran.SQLErrText
- rslt = 0
- Goto ext
- End If
- Delete From oa_demo_item
- Where oa_demo_item.demoid = :arg_demoid
- Using ins_tran;
- If ins_tran.SQLCode <> 0 Then
- arg_msg = '删除公文模板自定义字段失败'+ins_tran.SQLErrText
- rslt = 0
- Goto ext
- End If
- Delete From oa_demo_fj_cell
- Where oa_demo_fj_cell.demoid = :arg_demoid
- Using ins_tran;
- If ins_tran.SQLCode <> 0 Then
- arg_msg = '删除Excel主附件自动填写参数失败'+ins_tran.SQLErrText
- rslt = 0
- Goto ext
- End If
- Delete From oa_demo_annex
- Where oa_demo_annex.demoid = :arg_demoid
- Using ins_tran;
- If ins_tran.SQLCode <> 0 Then
- arg_msg = '删除公文模板失败(附件表)'+ins_tran.SQLErrText
- rslt = 0
- Goto ext
- End If
- Delete From oa_demo
- Where oa_demo.demoid = :arg_demoid
- Using ins_tran;
- If ins_tran.SQLCode <> 0 Then
- arg_msg = '删除公文模板失败'+ins_tran.SQLErrText
- rslt = 0
- Goto ext
- End If
- ext:
- If arg_ifcommit And rslt = 1 Then
- Commit Using ins_tran;
- ElseIf rslt = 0 Then
- Rollback Using ins_tran;
- End If
- Return rslt
- end function
- public function integer save (s_oa_demo arg_doc, ref string arg_msg, ref long arg_demoid, boolean arg_ifcommit);Long rslt = 1
- Long ls_newid,ll_i
- Long cnt
- If IsNull(arg_doc.doctitle) Then arg_doc.doctitle = ''
- If IsNull(arg_doc.doccontent) Then arg_doc.doccontent = ''
- If Trim(arg_doc.doctitle) = '' Then
- arG_MSG = '缺乏公文标题'
- rslt = 0
- Goto ext
- End If
- If Trim(arg_doc.doccontent) = '' Then
- arG_MSG = '缺乏公文内容'
- rslt = 0
- Goto ext
- End If
- Select count(*)
- Into :cnt
- From oa_demo
- Where democode = :arg_doc.democode
- And demoid <> :arg_doc.demoid Using ins_tran;
- If ins_tran.SQLCode <> 0 Then
- arG_MSG = '查询公文模板编码是否重复失败>>'+ins_tran.SQLErrText
- rslt = 0
- Goto ext
- End If
- If cnt > 0 Then
- rslt = 0
- arG_MSG = '公文模板编码重复,请修改'
- Goto ext
- End If
- If arg_doc.demoid = 0 Then //新建
- ls_newid = f_sys_scidentity(sys_scid,"oa_demo","demoid",arG_MSG,True,id_sqlca)
-
- Insert Into oa_demo
- (demoid,
- democode,
- doctitle,
- doccontent,
- flowid,
- typeid,
- timedscrp,
- specialdscrp,
- secrecy,
- dscrp,
- opemp,
- opdate,
- relqty)
- Values (:ls_newid,
- :arg_doc.democode,
- :arg_doc.doctitle,
- :arg_doc.doccontent,
- :arg_doc.flowid,
- :arg_doc.typeid,
- :arg_doc.timedscrp,
- :arg_doc.specialdscrp,
- :arg_doc.secrecy,
- :arg_doc.dscrp,
- :publ_operator,
- getdate(),
- :arg_doc.relqty) Using ins_tran;
- If ins_tran.SQLCode <> 0 Then
- arG_MSG = '建立公文模板失败>>'+ins_tran.SQLErrText
- rslt = 0
- Goto ext
- End If
-
- Else
- ls_newid = arg_doc.demoid
-
- Update oa_demo
- Set democode = :arg_doc.democode,
- doctitle = :arg_doc.doctitle,
- doccontent = :arg_doc.doccontent,
- flowid = :arg_doc.flowid,
- typeid = :arg_doc.typeid,
- timedscrp = :arg_doc.timedscrp,
- specialdscrp = :arg_doc.specialdscrp,
- secrecy = :arg_doc.secrecy,
- dscrp = :arg_doc.dscrp,
- modemp = :publ_operator,
- moddate = getdate(),
- relqty = :arg_doc.relqty
- Where demoid = :arg_doc.demoid Using ins_tran;
- If ins_tran.SQLCode <> 0 Then
- arG_MSG = '更新公文模板失败>>'+ins_tran.SQLErrText
- rslt = 0
- Goto ext
- End If
-
- Delete From oa_demo_step
- Where (demoid = :arg_doc.demoid) Using ins_tran;
- If ins_tran.SQLCode <> 0 Then
- arG_MSG = '删除公文模板原步骤失败>>'+ins_tran.SQLErrText
- rslt = 0
- Goto ext
- End If
-
- Delete From oa_demo_item
- Where (demoid = :arg_doc.demoid) Using ins_tran;
- If ins_tran.SQLCode <> 0 Then
- arG_MSG = '删除公文模板原自定义字段失败>>'+ins_tran.SQLErrText
- rslt = 0
- Goto ext
- End If
-
- Delete From oa_demo_fj_cell
- Where (demoid = :arg_doc.demoid) Using ins_tran;
- If ins_tran.SQLCode <> 0 Then
- arG_MSG = '删除Excel主附件自动填写参数失败>>'+ins_tran.SQLErrText
- rslt = 0
- Goto ext
- End If
- Delete From oa_demo_stepemp
- Where (demoid = :arg_doc.demoid) Using ins_tran;
- If ins_tran.SQLCode <> 0 Then
- arG_MSG = '删除公文模板原步骤人员失败>>'+ins_tran.SQLErrText
- rslt = 0
- Goto ext
- End If
-
- End If
- For ll_i = 1 To UpperBound(arg_doc.arg_s_step)
- Insert Into oa_demo_step
- (demoid,
- flowsort,
- flowstepname,
- flowempstr,
- flowinfo,
- limithour,
- ifopflag,
- ifnecessary,
- ifjoin,
- ifmod_relqty,
- ifmodfj)
- Values
- (:ls_newid,
- :arg_doc.arg_s_step[ll_i].flowsort,
- :arg_doc.arg_s_step[ll_i].flowstepname,
- :arg_doc.arg_s_step[ll_i].flowempstr,
- :arg_doc.arg_s_step[ll_i].flowinfo,
- :arg_doc.arg_s_step[ll_i].limithour,
- :arg_doc.arg_s_step[ll_i].ifopflag,
- :arg_doc.arg_s_step[ll_i].ifnecessary,
- :arg_doc.arg_s_step[ll_i].ifjoin,
- :arg_doc.arg_s_step[ll_i].ifmod_relqty,
- :arg_doc.arg_s_step[ll_i].ifmodfj) Using ins_tran;
- If ins_tran.SQLCode <> 0 Then
- arG_MSG = '发布公告失败2,插入审核步骤失败>>'+ins_tran.SQLErrText
- rslt = 0
- Goto ext
- End If
- Next
- For ll_i = 1 To UpperBound(arg_doc.arg_s_stepemp)
- Insert Into oa_demo_stepemp
- (demoid,
- flowsort,
- empid)
- Values
- (:ls_newid,
- :arg_doc.arg_s_stepemp[ll_i].flowsort,
- :arg_doc.arg_s_stepemp[ll_i].empid) Using ins_tran;
- If ins_tran.SQLCode <> 0 Then
- arG_MSG = '发布公告失败3,插入审核步骤人员信息失败>>'+ins_tran.SQLErrText
- rslt = 0
- Goto ext
- End If
- Next
- For ll_i = 1 To UpperBound(arg_doc.arg_s_item)
- Insert Into oa_demo_item
- (demoid,
- printid,
- itemname,
- itemtype,
- flowsort,
- ifrequired,
- cell,
- ifread,
- dscrp_ch)
- Values (:ls_newid,
- :arg_doc.arg_s_item[ll_i].printid,
- :arg_doc.arg_s_item[ll_i].itemname,
- :arg_doc.arg_s_item[ll_i].itemtype,
- :arg_doc.arg_s_item[ll_i].flowsort,
- :arg_doc.arg_s_item[ll_i].ifrequired,
- :arg_doc.arg_s_item[ll_i].cell,
- :arg_doc.arg_s_item[ll_i].ifread,
- :arg_doc.arg_s_item[ll_i].dscrp_ch) Using ins_tran;
- If ins_tran.SQLCode <> 0 Then
- arG_MSG = '发布公告失败4,插入自定义字段信息失败>>'+ins_tran.SQLErrText
- rslt = 0
- Goto ext
- End If
- Next
- For ll_i = 1 To UpperBound(arg_doc.arg_s_fj_cell)
- Insert Into oa_demo_fj_cell
- (demoid,
- printid,
- argname,
- cell)
- Values (:ls_newid,
- :arg_doc.arg_s_fj_cell[ll_i].printid,
- :arg_doc.arg_s_fj_cell[ll_i].argname,
- :arg_doc.arg_s_fj_cell[ll_i].cell) Using ins_tran;
- If ins_tran.SQLCode <> 0 Then
- arG_MSG = '发布公告失败5,插入Excel主附件自动填写参数失败>>'+ins_tran.SQLErrText
- rslt = 0
- Goto ext
- End If
- Next
- arg_demoid = ls_newid
- ext:
- If rslt = 0 Then
- Rollback Using ins_tran;
- ElseIf arg_ifcommit And rslt = 1 Then
- Commit Using ins_tran;
- End If
- Return rslt
- end function
- on uo_oa_demo.create
- call super::create
- TriggerEvent( this, "constructor" )
- end on
- on uo_oa_demo.destroy
- TriggerEvent( this, "destructor" )
- call super::destroy
- end on
|