w_sysplan_import.srw 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. $PBExportHeader$w_sysplan_import.srw
  2. forward
  3. global type w_sysplan_import from w_publ_base
  4. end type
  5. type cb_export from uo_rpt_imflatbutton within w_sysplan_import
  6. end type
  7. type sle_filename from singlelineedit within w_sysplan_import
  8. end type
  9. type cb_2 from uo_rpt_imflatbutton within w_sysplan_import
  10. end type
  11. type gb_2 from groupbox within w_sysplan_import
  12. end type
  13. end forward
  14. global type w_sysplan_import 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_import w_sysplan_import
  26. type variables
  27. int len_headinfo = 100
  28. end variables
  29. forward prototypes
  30. public function integer wf_import (ref string arg_msg)
  31. end prototypes
  32. public function integer wf_import (ref string arg_msg);Integer rslt = 1
  33. Blob lb_rsyntax
  34. String ls_importstr
  35. Blob lb_r_headinfo
  36. Blob lb_importfilename
  37. String bczh_headinfo
  38. String headinfo
  39. String ls_system_id
  40. Integer ls_k
  41. Integer ls_psc
  42. String ls_importfilename
  43. String ls_pwrstr,ls_optionstr
  44. String ls_DwObjStr
  45. datastore ds
  46. ds = Create datastore
  47. ls_importfilename = sle_filename.Text
  48. IF f_getblobfromfile(lb_importfilename,ls_importfilename,arg_msg) = 0 THEN
  49. rslt = 0
  50. GOTO ext
  51. END IF
  52. ls_importstr = String(lb_importfilename)
  53. //bczh_headinfo = Left(String(lb_importfilename),len_headinfo * 3)
  54. //headinfo = f_psw_bczh(bczh_headinfo,1,sys_power_key)
  55. headinfo = Left(ls_importstr,len_headinfo)
  56. ls_importstr = mid(ls_importstr, len_headinfo + 1)
  57. ls_k = 0
  58. ls_psc = 0
  59. ls_psc = Pos(headinfo,";")
  60. ls_system_id = Left(headinfo,ls_psc - 1)
  61. IF ls_system_id <> sys_system_id THEN
  62. arg_msg = "导入的不是本系统的数据包,请检查"
  63. rslt = 0
  64. GOTO ext
  65. END IF
  66. //lb_rsyntax = BlobMid(lb_importfilename,Len(bczh_headinfo) + 1)
  67. //ls_importstr = String(lb_rsyntax)
  68. //ls_importstr = f_psw_bczh(ls_importstr,1,sys_power_key)
  69. //ls_pwrstr = Mid(ls_importstr,1,Pos(ls_importstr,'/*1/'))
  70. //ls_optionstr = Mid(ls_importstr,Pos(ls_importstr,'/*1/') + 4,Pos(ls_importstr,'/*2/'))
  71. //ls_DwObjStr = Mid(ls_importstr,Pos(ls_importstr,'/*2/') + 4,Pos(ls_importstr,'/*3/'))
  72. ls_psc = Pos(ls_importstr,"/*1/")
  73. if ls_psc = 1 then
  74. ls_pwrstr = ""
  75. else
  76. ls_pwrstr = left(ls_importstr,ls_psc)
  77. end if
  78. ls_importstr = Mid(ls_importstr,ls_psc + 4)
  79. ls_psc = Pos(ls_importstr,"/*2/")
  80. if ls_psc = 1 then
  81. ls_optionstr = ""
  82. else
  83. ls_optionstr = left(ls_importstr,ls_psc)
  84. end if
  85. ls_importstr = Mid(ls_importstr,ls_psc + 4)
  86. ls_psc = Pos(ls_importstr,"/*3/")
  87. ls_DwObjStr = left(ls_importstr,ls_psc - 1)
  88. ls_importstr = Mid(ls_importstr,ls_psc + 4)
  89. Blob lb_DwObjStr
  90. lb_DwObjStr = Blob(ls_DwObjStr)
  91. String ls_tmpfile
  92. IF Right(sys_cur_path, 1) = "\" THEN
  93. ls_tmpfile = sys_cur_path + "tmppbsavefile.txt"
  94. ELSE
  95. ls_tmpfile = sys_cur_path + "\tmppbsavefile.txt"
  96. END IF
  97. IF FileExists(ls_tmpfile) THEN
  98. IF Not FileDelete(ls_tmpfile) THEN
  99. rslt = 0
  100. arg_msg = "删除临时文件失败(" + ls_tmpfile + "),请先手动清除!"
  101. GOTO ext
  102. END IF
  103. END IF
  104. IF f_saveblobtofile(lb_DwObjStr,ls_tmpfile,arg_msg) = 0 THEN
  105. rslt = 0
  106. END IF
  107. UPDATE sys_DB_version
  108. SET sys_pwrstr = :ls_pwrstr,
  109. sys_optionstr = :ls_optionstr,
  110. sys_pwrstr_sys = :ls_pwrstr;
  111. IF sqlca.SQLCode <> 0 THEN
  112. rslt = 0
  113. arg_msg = '更新系统解决方案失败,'+sqlca.SQLErrText
  114. GOTO ext
  115. END IF
  116. DELETE FROM sys_user_dwnSyntax
  117. Where empid = -1;
  118. IF sqlca.SQLCode <> 0 THEN
  119. rslt = 0
  120. arg_msg = '删除管理员解决方案原数据2失败,'+sqlca.SQLErrText
  121. GOTO ext
  122. END IF
  123. //取解决方案所有字段
  124. ds.DataObject = 'ds_system_plan_dw_obj_export_super'
  125. ds.SetTransObject(sqlca)
  126. ds.ImportFile(Text!, ls_tmpfile, 2)
  127. IF ds.Update() = -1 THEN
  128. rslt = 0
  129. arg_msg = '更新系统解决方案窗口对应字段数据失败,'+sqlca.SQLErrText
  130. GOTO ext
  131. END IF
  132. ext:
  133. IF rslt = 1 THEN
  134. COMMIT;
  135. ELSE
  136. ROLLBACK;
  137. END IF
  138. RETURN rslt
  139. end function
  140. on w_sysplan_import.create
  141. int iCurrent
  142. call super::create
  143. this.cb_export=create cb_export
  144. this.sle_filename=create sle_filename
  145. this.cb_2=create cb_2
  146. this.gb_2=create gb_2
  147. iCurrent=UpperBound(this.Control)
  148. this.Control[iCurrent+1]=this.cb_export
  149. this.Control[iCurrent+2]=this.sle_filename
  150. this.Control[iCurrent+3]=this.cb_2
  151. this.Control[iCurrent+4]=this.gb_2
  152. end on
  153. on w_sysplan_import.destroy
  154. call super::destroy
  155. destroy(this.cb_export)
  156. destroy(this.sle_filename)
  157. destroy(this.cb_2)
  158. destroy(this.gb_2)
  159. end on
  160. type cb_func from w_publ_base`cb_func within w_sysplan_import
  161. boolean visible = false
  162. end type
  163. type cb_exit from w_publ_base`cb_exit within w_sysplan_import
  164. integer x = 1801
  165. integer y = 252
  166. end type
  167. type cb_export from uo_rpt_imflatbutton within w_sysplan_import
  168. integer x = 1760
  169. integer y = 96
  170. integer width = 325
  171. integer height = 96
  172. integer taborder = 50
  173. boolean bringtotop = true
  174. string text = "导入"
  175. end type
  176. event clicked;call super::clicked;String arg_msg
  177. String ls_pwrstr,ls_optionstr
  178. IF NOT sys_power_issuper THEN
  179. MessageBox("系统提示","非管理员不可以操作")
  180. RETURN
  181. END IF
  182. IF Trim(sle_filename.Text) = "" THEN
  183. MessageBox("系统提示","请选择导入文件")
  184. RETURN
  185. END IF
  186. IF MessageBox('询问','导入功能会覆盖原来的系统解决方案,是否继续?',question!,yesno!) = 2 THEN RETURN
  187. IF wf_import(arg_msg) = 0 THEN
  188. MessageBox("系统提示",arg_msg)
  189. RETURN
  190. ELSE
  191. MessageBox("系统提示","导入成功,请重启系统使方案生效")
  192. Close(PARENT)
  193. END IF
  194. end event
  195. type sle_filename from singlelineedit within w_sysplan_import
  196. integer x = 41
  197. integer y = 96
  198. integer width = 1591
  199. integer height = 92
  200. integer taborder = 60
  201. boolean bringtotop = true
  202. integer textsize = -9
  203. integer weight = 400
  204. fontcharset fontcharset = gb2312charset!
  205. fontpitch fontpitch = variable!
  206. string facename = "宋体"
  207. long textcolor = 33554432
  208. borderstyle borderstyle = stylelowered!
  209. end type
  210. type cb_2 from uo_rpt_imflatbutton within w_sysplan_import
  211. integer x = 1646
  212. integer y = 96
  213. integer width = 114
  214. integer height = 96
  215. integer taborder = 60
  216. boolean bringtotop = true
  217. string text = "..."
  218. end type
  219. event clicked;call super::clicked;
  220. Integer i
  221. String Pathname
  222. String Filename
  223. i = GetFileSaveName("系统方案文件",Pathname,Filename,"ljsp","系统方案文件ljsp,*.ljsp")
  224. IF i = 1 AND Trim(Pathname) <> "" AND Trim(Filename) <> "" THEN
  225. sle_filename.Text = Pathname
  226. END IF
  227. RETURN
  228. end event
  229. type gb_2 from groupbox within w_sysplan_import
  230. integer x = 23
  231. integer y = 16
  232. integer width = 2094
  233. integer height = 228
  234. integer taborder = 30
  235. integer textsize = -9
  236. integer weight = 400
  237. fontcharset fontcharset = gb2312charset!
  238. fontpitch fontpitch = variable!
  239. string facename = "宋体"
  240. long textcolor = 33554432
  241. long backcolor = 134217739
  242. string text = "导出文件路径"
  243. end type