123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300 |
- $PBExportHeader$w_sysplan_import.srw
- forward
- global type w_sysplan_import from w_publ_base
- end type
- type cb_export from uo_rpt_imflatbutton within w_sysplan_import
- end type
- type sle_filename from singlelineedit within w_sysplan_import
- end type
- type cb_2 from uo_rpt_imflatbutton within w_sysplan_import
- end type
- type gb_2 from groupbox within w_sysplan_import
- end type
- end forward
- global type w_sysplan_import from w_publ_base
- integer width = 2144
- integer height = 444
- string title = "系统解决方案导入"
- boolean minbox = false
- windowtype windowtype = response!
- cb_export cb_export
- sle_filename sle_filename
- cb_2 cb_2
- gb_2 gb_2
- end type
- global w_sysplan_import w_sysplan_import
- type variables
- int len_headinfo = 100
- end variables
- forward prototypes
- public function integer wf_import (ref string arg_msg)
- end prototypes
- public function integer wf_import (ref string arg_msg);Integer rslt = 1
- Blob lb_rsyntax
- String ls_importstr
- Blob lb_r_headinfo
- Blob lb_importfilename
- String bczh_headinfo
- String headinfo
- String ls_system_id
- Integer ls_k
- Integer ls_psc
- String ls_importfilename
- String ls_pwrstr,ls_optionstr
- String ls_DwObjStr
- datastore ds
- ds = Create datastore
- ls_importfilename = sle_filename.Text
- IF f_getblobfromfile(lb_importfilename,ls_importfilename,arg_msg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- ls_importstr = String(lb_importfilename)
- //bczh_headinfo = Left(String(lb_importfilename),len_headinfo * 3)
- //headinfo = f_psw_bczh(bczh_headinfo,1,sys_power_key)
- headinfo = Left(ls_importstr,len_headinfo)
- ls_importstr = mid(ls_importstr, len_headinfo + 1)
- ls_k = 0
- ls_psc = 0
- ls_psc = Pos(headinfo,";")
- ls_system_id = Left(headinfo,ls_psc - 1)
- IF ls_system_id <> sys_system_id THEN
- arg_msg = "导入的不是本系统的数据包,请检查"
- rslt = 0
- GOTO ext
- END IF
- //lb_rsyntax = BlobMid(lb_importfilename,Len(bczh_headinfo) + 1)
- //ls_importstr = String(lb_rsyntax)
- //ls_importstr = f_psw_bczh(ls_importstr,1,sys_power_key)
- //ls_pwrstr = Mid(ls_importstr,1,Pos(ls_importstr,'/*1/'))
- //ls_optionstr = Mid(ls_importstr,Pos(ls_importstr,'/*1/') + 4,Pos(ls_importstr,'/*2/'))
- //ls_DwObjStr = Mid(ls_importstr,Pos(ls_importstr,'/*2/') + 4,Pos(ls_importstr,'/*3/'))
- ls_psc = Pos(ls_importstr,"/*1/")
- if ls_psc = 1 then
- ls_pwrstr = ""
- else
- ls_pwrstr = left(ls_importstr,ls_psc)
- end if
- ls_importstr = Mid(ls_importstr,ls_psc + 4)
- ls_psc = Pos(ls_importstr,"/*2/")
- if ls_psc = 1 then
- ls_optionstr = ""
- else
- ls_optionstr = left(ls_importstr,ls_psc)
- end if
- ls_importstr = Mid(ls_importstr,ls_psc + 4)
- ls_psc = Pos(ls_importstr,"/*3/")
- ls_DwObjStr = left(ls_importstr,ls_psc - 1)
- ls_importstr = Mid(ls_importstr,ls_psc + 4)
- Blob lb_DwObjStr
- lb_DwObjStr = Blob(ls_DwObjStr)
- String ls_tmpfile
- IF Right(sys_cur_path, 1) = "\" THEN
- ls_tmpfile = sys_cur_path + "tmppbsavefile.txt"
- ELSE
- ls_tmpfile = sys_cur_path + "\tmppbsavefile.txt"
- END IF
- IF FileExists(ls_tmpfile) THEN
- IF Not FileDelete(ls_tmpfile) THEN
- rslt = 0
- arg_msg = "删除临时文件失败(" + ls_tmpfile + "),请先手动清除!"
- GOTO ext
- END IF
- END IF
- IF f_saveblobtofile(lb_DwObjStr,ls_tmpfile,arg_msg) = 0 THEN
- rslt = 0
- END IF
- UPDATE sys_DB_version
- SET sys_pwrstr = :ls_pwrstr,
- sys_optionstr = :ls_optionstr,
- sys_pwrstr_sys = :ls_pwrstr;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '更新系统解决方案失败,'+sqlca.SQLErrText
- GOTO ext
- END IF
- DELETE FROM sys_user_dwnSyntax
- Where empid = -1;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '删除管理员解决方案原数据2失败,'+sqlca.SQLErrText
- GOTO ext
- END IF
- //取解决方案所有字段
- ds.DataObject = 'ds_system_plan_dw_obj_export_super'
- ds.SetTransObject(sqlca)
- ds.ImportFile(Text!, ls_tmpfile, 2)
- IF ds.Update() = -1 THEN
- rslt = 0
- arg_msg = '更新系统解决方案窗口对应字段数据失败,'+sqlca.SQLErrText
- GOTO ext
- END IF
- ext:
- IF rslt = 1 THEN
- COMMIT;
- ELSE
- ROLLBACK;
- END IF
- RETURN rslt
- end function
- on w_sysplan_import.create
- int iCurrent
- call super::create
- this.cb_export=create cb_export
- this.sle_filename=create sle_filename
- this.cb_2=create cb_2
- this.gb_2=create gb_2
- iCurrent=UpperBound(this.Control)
- this.Control[iCurrent+1]=this.cb_export
- this.Control[iCurrent+2]=this.sle_filename
- this.Control[iCurrent+3]=this.cb_2
- this.Control[iCurrent+4]=this.gb_2
- end on
- on w_sysplan_import.destroy
- call super::destroy
- destroy(this.cb_export)
- destroy(this.sle_filename)
- destroy(this.cb_2)
- destroy(this.gb_2)
- end on
- type cb_func from w_publ_base`cb_func within w_sysplan_import
- boolean visible = false
- end type
- type cb_exit from w_publ_base`cb_exit within w_sysplan_import
- integer x = 1801
- integer y = 252
- end type
- type cb_export from uo_rpt_imflatbutton within w_sysplan_import
- integer x = 1760
- integer y = 96
- integer width = 325
- integer height = 96
- integer taborder = 50
- boolean bringtotop = true
- string text = "导入"
- end type
- event clicked;call super::clicked;String arg_msg
- String ls_pwrstr,ls_optionstr
- IF NOT sys_power_issuper THEN
- MessageBox("系统提示","非管理员不可以操作")
- RETURN
- END IF
- IF Trim(sle_filename.Text) = "" THEN
- MessageBox("系统提示","请选择导入文件")
- RETURN
- END IF
- IF MessageBox('询问','导入功能会覆盖原来的系统解决方案,是否继续?',question!,yesno!) = 2 THEN RETURN
- IF wf_import(arg_msg) = 0 THEN
- MessageBox("系统提示",arg_msg)
- RETURN
- ELSE
- MessageBox("系统提示","导入成功,请重启系统使方案生效")
- Close(PARENT)
- END IF
- end event
- type sle_filename from singlelineedit within w_sysplan_import
- integer x = 41
- integer y = 96
- integer width = 1591
- integer height = 92
- integer taborder = 60
- boolean bringtotop = true
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- long textcolor = 33554432
- borderstyle borderstyle = stylelowered!
- end type
- type cb_2 from uo_rpt_imflatbutton within w_sysplan_import
- integer x = 1646
- integer y = 96
- integer width = 114
- integer height = 96
- integer taborder = 60
- boolean bringtotop = true
- string text = "..."
- end type
- event clicked;call super::clicked;
- Integer i
- String Pathname
- String Filename
- i = GetFileSaveName("系统方案文件",Pathname,Filename,"ljsp","系统方案文件ljsp,*.ljsp")
- IF i = 1 AND Trim(Pathname) <> "" AND Trim(Filename) <> "" THEN
- sle_filename.Text = Pathname
- END IF
- RETURN
- end event
- type gb_2 from groupbox within w_sysplan_import
- integer x = 23
- integer y = 16
- integer width = 2094
- integer height = 228
- integer taborder = 30
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- long textcolor = 33554432
- long backcolor = 134217739
- string text = "导出文件路径"
- end type
|