123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- $PBExportHeader$uo_reportdef.sru
- forward
- global type uo_reportdef from nonvisualobject
- end type
- end forward
- global type uo_reportdef from nonvisualobject
- end type
- global uo_reportdef uo_reportdef
- type variables
- s_report s_rpt
- long rpid
- boolean if_getid_ture=false
- transaction commit_transaction //数据commit事务
- boolean it_newbegin=false //新建标志
- boolean it_updatebegin=false //修改标志
- end variables
- forward prototypes
- public subroutine p_reset ()
- public function integer newbegin (integer arg_rpid)
- public function integer del (long arg_rpid, boolean arg_ifcommit, ref string arg_msg)
- public function integer save (boolean arg_ifcommit, ref string arg_msg)
- end prototypes
- public subroutine p_reset ();s_rpt.rpid = 0
- s_rpt.rpname = ''
- s_rpt.ifuse = 1
- s_rpt.flag= 0
- s_rpt.billid = 0
- end subroutine
- public function integer newbegin (integer arg_rpid);long rslt = 1
- it_newbegin =true
- it_updatebegin =false
- rpid = arg_rpid
- return rslt
- end function
- public function integer del (long arg_rpid, boolean arg_ifcommit, ref string arg_msg);
- int rslt = 1
- long ls_long
- if arg_rpid = 0 then
- rslt = 0
- arg_msg = "没有删除对象,操作取消"
- goto ext
- end if
- delete from u_report_list
- where rpid = :arg_rpid using commit_transaction;
- if commit_transaction.sqlcode <> 0 then
- rslt = 0
- arg_msg = "删除物料操作失败"+"~n"+commit_transaction.sqlerrtext
- goto ext
- end if
- it_newbegin = false
- it_updatebegin = false
- ext:
- if rslt=0 then
- rollback using commit_transaction;
- elseif rslt=1 and arg_ifcommit then
- commit using commit_transaction;
- end if
- p_reset()
- return rslt
- end function
- public function integer save (boolean arg_ifcommit, ref string arg_msg);long rslt =1
- long ls_newid
- if isnull(s_rpt.ifuse) then s_rpt.ifuse = 1
- if isnull(s_rpt.rpid) then s_rpt.rpid = 0
- if isnull(s_rpt.rpname) then s_rpt.rpname = ''
- if isnull(s_rpt.billid) then s_rpt.billid = 0
- if isnull(s_rpt.auditprint) then s_rpt.auditprint = 0
- ////////////////////////////////////////////////开始区分:新建/更新 处理
- if s_rpt.rpid = 0 then //新建
- ls_newid = f_sys_scidentity_rpt(0,"u_report_list","rpid",arg_msg,if_getid_ture,commit_transaction)
- if ls_newid <= 0 then
- rslt = 0
- goto ext
- end if
-
-
- insert into u_report_list
- (rpid,
- RpName,
- Ifuse,
- Flag,
- billid,
- auditprint,
- descrp)
- values
- (:ls_newid,
- :s_rpt.RpName,
- :s_rpt.Ifuse,
- 0,
- :s_rpt.billid,
- :s_rpt.auditprint,
- :s_rpt.descrp) using commit_transaction ;
- if commit_transaction.sqlcode <> 0 then
- rslt = 0
- arg_msg = "因网络或其它原因导致报表插入操作失败"+"~n"+commit_transaction.sqlerrtext
- goto ext
- end if
- rpid = ls_newid
- else //////////////////////////////////////////////////更新
- update u_report_list
- set RpName = :s_rpt.RpName,
- Ifuse = :s_rpt.Ifuse,
- auditprint = :s_rpt.auditprint,
- descrp = :s_rpt.descrp
- where rpid = :s_rpt.rpid using commit_transaction;
- if commit_transaction.sqlcode <> 0 or commit_transaction.sqlnrows <= 0 then
- rslt = 0
- arg_msg = "因网络或其它原因导致更新操作失败"+"~n"+commit_transaction.sqlerrtext
- goto ext
- end if
- rpid = s_rpt.rpid
- end if
- it_newbegin = false
- it_updatebegin = false
- ext:
- if rslt = 0 then
- rollback using commit_transaction;
- elseif rslt = 1 and arg_ifcommit then
- commit using commit_transaction;
- end if
- return rslt
- end function
- on uo_reportdef.create
- call super::create
- TriggerEvent( this, "constructor" )
- end on
- on uo_reportdef.destroy
- TriggerEvent( this, "destructor" )
- call super::destroy
- end on
|