w_sysplan_export.srw 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. $PBExportHeader$w_sysplan_export.srw
  2. forward
  3. global type w_sysplan_export from w_publ_base
  4. end type
  5. type cb_export from uo_rpt_imflatbutton within w_sysplan_export
  6. end type
  7. type sle_filename from singlelineedit within w_sysplan_export
  8. end type
  9. type cb_2 from uo_rpt_imflatbutton within w_sysplan_export
  10. end type
  11. type gb_2 from groupbox within w_sysplan_export
  12. end type
  13. end forward
  14. global type w_sysplan_export from w_publ_base
  15. integer width = 2144
  16. integer height = 444
  17. string title = "系统解决方案导出"
  18. boolean minbox = false
  19. windowtype windowtype = response!
  20. cb_export cb_export
  21. sle_filename sle_filename
  22. cb_2 cb_2
  23. gb_2 gb_2
  24. end type
  25. global w_sysplan_export w_sysplan_export
  26. type variables
  27. int len_headinfo = 100
  28. end variables
  29. forward prototypes
  30. public function integer wf_export (ref string arg_msg)
  31. end prototypes
  32. public function integer wf_export (ref string arg_msg);Int rslt = 1
  33. String ls_exportbfilename
  34. String headinfo
  35. String trailinfo
  36. String r_headinfo
  37. Blob lb_r_headinfo
  38. Blob lb_exportfilename
  39. String ls_pwrstr,ls_optionstr
  40. string ls_exportstr
  41. string ls_DwObjStr
  42. datastore ds
  43. ds = Create datastore
  44. ls_exportbfilename = sle_filename.Text
  45. IF FileExists(ls_exportbfilename) THEN
  46. IF MessageBox("系统提示","指定文件已经存在,是否覆盖该文件?",question!,yesno!,2) = 2 THEN
  47. rslt = 1
  48. GOTO ext
  49. END IF
  50. END IF
  51. IF FileExists(ls_exportbfilename) THEN
  52. IF NOT FileDelete(ls_exportbfilename) THEN
  53. rslt = 0
  54. arg_msg = "删除临时文件失败(" + ls_exportbfilename + "),请先手动清除!"
  55. GOTO ext
  56. END IF
  57. END IF
  58. //取解决方案所有窗口
  59. ds.DataObject = 'ds_system_plan_dw_obj_export_super'
  60. ds.SetTransObject(sqlca)
  61. ds.Retrieve()
  62. ls_DwObjStr = ds.Object.datawindow.Data
  63. string ls_tmpfile
  64. ls_tmpfile = sys_cur_path + "\tmppbsavefile.txt"
  65. IF FileExists(ls_tmpfile) THEN
  66. IF Not FileDelete(ls_tmpfile) THEN
  67. rslt = 0
  68. arg_msg = "删除临时文件失败(" + ls_tmpfile + "),请先手动清除!"
  69. GOTO ext
  70. END IF
  71. END IF
  72. ds.saveas(ls_tmpfile, Text! , true)
  73. blob lb_DwObjStr
  74. IF f_getblobfromfile(lb_DwObjStr,ls_tmpfile,arg_msg) = 0 THEN
  75. rslt = 0
  76. GOTO ext
  77. END IF
  78. //N
  79. SELECT sys_pwrstr,sys_optionstr
  80. INTO :ls_pwrstr,:ls_optionstr
  81. FROM sys_DB_version;
  82. IF sqlca.SQLCode <> 0 THEN
  83. rslt = 0
  84. arg_msg = '查询系统解决方案失败,'+sqlca.SQLErrText
  85. GOTO ext
  86. END IF
  87. ls_exportstr = ls_pwrstr + '/*1/'
  88. ls_exportstr += ls_optionstr + '/*2/'
  89. ls_exportstr += string(lb_DwObjStr) + '/*3/'
  90. headinfo = sys_system_id + ";"
  91. trailinfo = Fill("*",len_headinfo - Len(headinfo))
  92. r_headinfo = headinfo + trailinfo
  93. //r_headinfo = f_psw_bczh(r_headinfo,0,sys_power_key)
  94. //lb_r_headinfo = Blob(r_headinfo)
  95. //lb_exportfilename = lb_r_headinfo + blob(f_psw_bczh(ls_exportstr,0,sys_power_key))
  96. lb_exportfilename = blob(r_headinfo + ls_exportstr)
  97. IF f_saveblobtofile(lb_exportfilename,ls_exportbfilename,arg_msg) = 0 THEN
  98. rslt = 0
  99. END IF
  100. ext:
  101. RETURN rslt
  102. end function
  103. on w_sysplan_export.create
  104. int iCurrent
  105. call super::create
  106. this.cb_export=create cb_export
  107. this.sle_filename=create sle_filename
  108. this.cb_2=create cb_2
  109. this.gb_2=create gb_2
  110. iCurrent=UpperBound(this.Control)
  111. this.Control[iCurrent+1]=this.cb_export
  112. this.Control[iCurrent+2]=this.sle_filename
  113. this.Control[iCurrent+3]=this.cb_2
  114. this.Control[iCurrent+4]=this.gb_2
  115. end on
  116. on w_sysplan_export.destroy
  117. call super::destroy
  118. destroy(this.cb_export)
  119. destroy(this.sle_filename)
  120. destroy(this.cb_2)
  121. destroy(this.gb_2)
  122. end on
  123. type cb_func from w_publ_base`cb_func within w_sysplan_export
  124. boolean visible = false
  125. end type
  126. type cb_exit from w_publ_base`cb_exit within w_sysplan_export
  127. integer x = 1801
  128. integer y = 252
  129. end type
  130. type cb_export from uo_rpt_imflatbutton within w_sysplan_export
  131. integer x = 1760
  132. integer y = 96
  133. integer width = 325
  134. integer height = 96
  135. integer taborder = 50
  136. boolean bringtotop = true
  137. string text = "导出"
  138. end type
  139. event clicked;call super::clicked;String arg_msg
  140. IF NOT sys_power_issuper THEN
  141. MessageBox("系统提示","非管理员不可以操作")
  142. RETURN
  143. END IF
  144. IF Trim(sle_filename.Text) = "" THEN
  145. MessageBox("系统提示","请选择导出文件")
  146. RETURN
  147. END IF
  148. IF wf_export(arg_msg) = 0 THEN
  149. MessageBox("系统提示",arg_msg)
  150. ELSE
  151. MessageBox("系统提示","导出成功")
  152. END IF
  153. RETURN
  154. end event
  155. type sle_filename from singlelineedit within w_sysplan_export
  156. integer x = 41
  157. integer y = 96
  158. integer width = 1591
  159. integer height = 92
  160. integer taborder = 60
  161. boolean bringtotop = true
  162. integer textsize = -9
  163. integer weight = 400
  164. fontcharset fontcharset = gb2312charset!
  165. fontpitch fontpitch = variable!
  166. string facename = "宋体"
  167. long textcolor = 33554432
  168. borderstyle borderstyle = stylelowered!
  169. end type
  170. type cb_2 from uo_rpt_imflatbutton within w_sysplan_export
  171. integer x = 1646
  172. integer y = 96
  173. integer width = 114
  174. integer height = 96
  175. integer taborder = 60
  176. boolean bringtotop = true
  177. string text = "..."
  178. end type
  179. event clicked;call super::clicked;
  180. Integer i
  181. String Pathname
  182. String Filename
  183. i = GetFileSaveName("系统方案文件",Pathname,Filename,"ljsp","系统方案文件ljsp,*.ljsp")
  184. IF i = 1 AND Trim(Pathname) <> "" AND Trim(Filename) <> "" THEN
  185. sle_filename.Text = Pathname
  186. END IF
  187. RETURN
  188. end event
  189. type gb_2 from groupbox within w_sysplan_export
  190. integer x = 23
  191. integer y = 16
  192. integer width = 2094
  193. integer height = 228
  194. integer taborder = 30
  195. integer textsize = -9
  196. integer weight = 400
  197. fontcharset fontcharset = gb2312charset!
  198. fontpitch fontpitch = variable!
  199. string facename = "宋体"
  200. long textcolor = 33554432
  201. long backcolor = 134217739
  202. string text = "导出文件路径"
  203. end type