w_saletaskmx_fileadd.srw 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. $PBExportHeader$w_saletaskmx_fileadd.srw
  2. forward
  3. global type w_saletaskmx_fileadd from window
  4. end type
  5. type dw_fileclass from u_dw_rbtnfilter within w_saletaskmx_fileadd
  6. end type
  7. type cb_1 from uo_imflatbutton within w_saletaskmx_fileadd
  8. end type
  9. type cb_oaflow from uo_imflatbutton within w_saletaskmx_fileadd
  10. end type
  11. type dw_1 from u_dw_rbtnfilter within w_saletaskmx_fileadd
  12. end type
  13. type r_bar from rectangle within w_saletaskmx_fileadd
  14. end type
  15. type ln_bar from line within w_saletaskmx_fileadd
  16. end type
  17. type ln_bar2 from line within w_saletaskmx_fileadd
  18. end type
  19. end forward
  20. global type w_saletaskmx_fileadd from window
  21. integer width = 4160
  22. integer height = 1836
  23. boolean titlebar = true
  24. string title = "Untitled"
  25. boolean controlmenu = true
  26. windowtype windowtype = response!
  27. long backcolor = 67108864
  28. string icon = "AppIcon!"
  29. boolean clientedge = true
  30. boolean center = true
  31. event ue_selectfile ( )
  32. event ue_save ( )
  33. dw_fileclass dw_fileclass
  34. cb_1 cb_1
  35. cb_oaflow cb_oaflow
  36. dw_1 dw_1
  37. r_bar r_bar
  38. ln_bar ln_bar
  39. ln_bar2 ln_bar2
  40. end type
  41. global w_saletaskmx_fileadd w_saletaskmx_fileadd
  42. type variables
  43. long ins_scid
  44. long ins_taskid
  45. string ins_taskcode
  46. long ins_billtype = 9102
  47. transaction Transaction_pic
  48. end variables
  49. event ue_selectfile();////ue_selectfile
  50. long ll_row
  51. string ls_col
  52. ll_row = dw_1.GetRow()
  53. if ll_row <= 0 then return
  54. ls_col = dw_1.GetColumnName()
  55. boolean lb_selectfile
  56. lb_selectfile = ls_col = 'filename1' OR ls_col = 'filename2' OR ls_col = 'filename3'
  57. if not lb_selectfile then return
  58. String Pathname,Filename,FileType
  59. Integer i
  60. FileType = ''
  61. FileType = '所有文件(*.*),*.*,'
  62. // FileType += "配置文件(*.ini), *.ini,"
  63. FileType += "Zip压缩文件(*.Zip),*.Zip,"
  64. FileType += "RAR压缩文件(*.rar),*.rar,"
  65. // FileType += "XML文件(*.xml),*.xml,"
  66. FileType += "文本文件(*.txt),*.txt,"
  67. FileType += "Excel模版(*.xlt),*.xlt,"
  68. // FileType += "Excel文档(*.xls),*.xls,"
  69. // FileType += "Word模版(*.dot),*.dot,"
  70. FileType += "Word文档(*.doc),*.doc,"
  71. FileType += "JPG(*.JPG),*.JPG,"
  72. FileType += "位图文件(*.bmp),*.bmp,"
  73. FileType += "GIF文件(*.GIF),*.GIF"
  74. i = GetFileOpenName("请选择文件", Pathname,Filename, "All", FileType)
  75. IF i = 1 AND Trim(Pathname) <> '' AND Trim(Filename) <> "" THEN
  76. IF Pathname = '' OR NOT FileExists(Pathname) THEN
  77. MessageBox('系统提示','请选择文件!')
  78. RETURN
  79. END IF
  80. if FileLength(Pathname)/1024 > 10240 then
  81. messagebox('限制','附件文件大小不得大于10M')
  82. return
  83. end if
  84. dw_1.SetItem(ll_row, ls_col, Pathname)
  85. END IF
  86. end event
  87. event ue_save();s_fileinfo s_file
  88. Long ll_row
  89. Long ll_i, ll_pos,rt_fileid, ll_cnt = 0
  90. String ls_filepath
  91. String ls_filename
  92. String ls_msg = ''
  93. String arg_msg
  94. uo_fj_mng_billtype ls_uo_btfj
  95. ls_uo_btfj = Create uo_fj_mng_billtype
  96. IF dw_fileclass.GetRow() <= 0 THEN
  97. ls_msg = '请选择附件分类'
  98. GOTO ext
  99. END IF
  100. s_file.classid = dw_fileclass.Object.classid[dw_fileclass.GetRow()]
  101. s_file.fileid = 0
  102. s_file.Filename = ''
  103. s_file.dscrp = ''
  104. s_file.encrypted = 0
  105. s_file.compressed = 0
  106. s_file.FileType = ''
  107. s_file.relid = ins_taskid
  108. s_file.relcode = ins_taskcode
  109. s_file.billtype = ins_billtype
  110. //s_file.relid_mx = ins_relid_mx
  111. s_file.scid = ins_scid
  112. s_file.SqlTransaction = Transaction_pic
  113. Open(w_sys_wait_jdt) //打开进度窗口
  114. w_sys_wait_jdt.wf_accepttol(dw_1.RowCount() * 3) //初始化进度条
  115. w_sys_wait_jdt.wf_set_msg('正在保存附件,请稍候...')
  116. FOR ll_row = 1 To dw_1.RowCount()
  117. FOR ll_i = 1 To 3
  118. w_sys_wait_jdt.wf_set_msg('正在保存第' + String(ll_row) + '行,附件' + String(ll_i) +',请稍候...')
  119. ls_filepath = Trim(dw_1.GetItemString(ll_row, 'filename' + String(ll_i)))
  120. IF ls_filepath <> '' THEN
  121. IF Not FileExists(ls_filepath) THEN
  122. ls_msg += '第' + String(ll_row) + '行,附件' + String(ll_i) +':[' + ls_filepath + ']不存在!~r~n'
  123. GOTO label_next
  124. END IF
  125. s_file.fileid = 0
  126. s_file.relid_mx = dw_1.Object.u_saletaskmx_printid[ll_row]
  127. ll_pos = LastPos(ls_filepath, '\')
  128. ls_filename = Mid(ls_filepath, ll_pos + 1)
  129. ll_pos = LastPos(ls_filename, '.')
  130. IF ll_pos > 0 THEN
  131. s_file.DisplayName = Mid(ls_filename, 1, ll_pos - 1)
  132. s_file.Filename = Mid(ls_filename, 1, ll_pos - 1)
  133. s_file.FileType = Mid(ls_filename, ll_pos + 1)
  134. ELSE
  135. s_file.DisplayName = ls_filename
  136. s_file.Filename = ls_filename
  137. s_file.FileType = ''
  138. END IF
  139. s_file.opemp = publ_operator
  140. s_file.opdate = DateTime(Today())
  141. s_file.dscrp = ''
  142. IF f_filetoblob(ls_filepath, s_file.filedata, arg_msg) <> 1 THEN
  143. ls_msg += '第' + String(ll_row) + '行,附件' + String(ll_i) +':[' + ls_filepath + ']读取文件失败!' + arg_msg + '~r~n'
  144. GOTO label_next
  145. END IF
  146. IF ls_uo_btfj.uf_save_fj( s_file, rt_fileid, Transaction_pic , arg_msg ) <> 1 THEN
  147. ls_msg += '第' + String(ll_row) + '行,附件' + String(ll_i) +':[' + ls_filepath + ']保存到附件数据库失败!' + arg_msg + '~r~n'
  148. GOTO label_next
  149. END IF
  150. IF f_update_fj_cnt(s_file.billtype,s_file.scid,s_file.relid,s_file.relid_mx,arg_msg) <> 1 THEN
  151. ls_msg += '第' + String(ll_row) + '行,附件' + String(ll_i) +':[' + ls_filepath + ']更新附件数量失败!' + arg_msg + '~r~n'
  152. GOTO label_next
  153. END IF
  154. dw_1.SetItem(ll_row, 'filename' + String(ll_i), '')
  155. END IF
  156. label_next:
  157. ll_cnt ++
  158. w_sys_wait_jdt.wf_inc(ll_cnt)
  159. NEXT
  160. NEXT
  161. Close(w_sys_wait_jdt)
  162. ext:
  163. Destroy ls_uo_btfj
  164. IF ls_msg <> '' THEN
  165. MessageBox('', ls_msg)
  166. ELSE
  167. MessageBox('提示', '上传成功,可继续选择上传')
  168. END IF
  169. end event
  170. on w_saletaskmx_fileadd.create
  171. this.dw_fileclass=create dw_fileclass
  172. this.cb_1=create cb_1
  173. this.cb_oaflow=create cb_oaflow
  174. this.dw_1=create dw_1
  175. this.r_bar=create r_bar
  176. this.ln_bar=create ln_bar
  177. this.ln_bar2=create ln_bar2
  178. this.Control[]={this.dw_fileclass,&
  179. this.cb_1,&
  180. this.cb_oaflow,&
  181. this.dw_1,&
  182. this.r_bar,&
  183. this.ln_bar,&
  184. this.ln_bar2}
  185. end on
  186. on w_saletaskmx_fileadd.destroy
  187. destroy(this.dw_fileclass)
  188. destroy(this.cb_1)
  189. destroy(this.cb_oaflow)
  190. destroy(this.dw_1)
  191. destroy(this.r_bar)
  192. destroy(this.ln_bar)
  193. destroy(this.ln_bar2)
  194. end on
  195. event open;s_edit_index_tran s_pic
  196. s_pic = Message.PowerObjectParm
  197. ins_scid = s_pic.e_long
  198. ins_taskid = s_pic.g_long
  199. ins_taskcode = s_pic.f_string
  200. Transaction_pic = s_pic.sqltransaction
  201. dw_1.SetTransObject (sqlca)
  202. dw_1.Retrieve(ins_scid, ins_taskid)
  203. dw_fileclass.SetTransObject(sqlca)
  204. dw_fileclass.Retrieve(ins_billtype)
  205. this.Title = ins_taskcode
  206. end event
  207. event resize;ln_bar.EndX = THIS.Width
  208. ln_bar2.EndX = THIS.Width
  209. r_bar.Width = THIS.Width
  210. dw_1.width = WorkSpaceWidth() - dw_1.x
  211. dw_1.Height = WorkSpaceHeight() - dw_1.y
  212. dw_fileclass.height = WorkSpaceHeight() - dw_fileclass.y
  213. end event
  214. type dw_fileclass from u_dw_rbtnfilter within w_saletaskmx_fileadd
  215. integer y = 184
  216. integer height = 1056
  217. integer taborder = 20
  218. string dataobject = "dw_fj_fileclass_list_fileadd"
  219. boolean hscrollbar = true
  220. boolean vscrollbar = true
  221. end type
  222. event rowfocuschanged;call super::rowfocuschanged;IF currentrow > 0 THEN
  223. this.SelectRow( 0, FALSE)
  224. this.SelectRow( currentrow, TRUE)
  225. this.ScrollToRow( currentrow)
  226. parent.triggerevent( 'retrieve_file')
  227. END IF
  228. end event
  229. type cb_1 from uo_imflatbutton within w_saletaskmx_fileadd
  230. integer x = 169
  231. integer width = 165
  232. integer height = 164
  233. integer taborder = 20
  234. boolean bringtotop = true
  235. string text = "取消"
  236. string normalpicname = "exit.BMP"
  237. integer picsize = 16
  238. toolbaralignment pic_align = alignattop!
  239. boolean border = false
  240. end type
  241. event clicked;call super::clicked;Close(parent)
  242. end event
  243. type cb_oaflow from uo_imflatbutton within w_saletaskmx_fileadd
  244. integer width = 165
  245. integer height = 164
  246. integer taborder = 10
  247. boolean bringtotop = true
  248. string text = "上传"
  249. string normalpicname = "save.BMP"
  250. integer picsize = 16
  251. toolbaralignment pic_align = alignattop!
  252. boolean border = false
  253. end type
  254. event clicked;call super::clicked;parent.triggerevent('ue_save')
  255. end event
  256. type dw_1 from u_dw_rbtnfilter within w_saletaskmx_fileadd
  257. event ue_dwndropdown pbm_dwndropdown
  258. integer x = 1019
  259. integer y = 184
  260. integer width = 2821
  261. integer height = 1456
  262. boolean bringtotop = true
  263. string dataobject = "dw_saletaskmx_fileadd"
  264. boolean hscrollbar = true
  265. boolean vscrollbar = true
  266. boolean hsplitscroll = true
  267. end type
  268. event ue_dwndropdown;// DONE: 选择文件
  269. parent.triggerEvent('ue_selectfile')
  270. return 1
  271. end event
  272. event constructor;call super::constructor;// titleclick_sort_use=true //单击标题排序功能开关
  273. // RBUTTON_FILTER_USE=true //右键查询功能开关
  274. //
  275. end event
  276. event doubleclicked;call super::doubleclicked;//if if_mdf_title then
  277. //if LOWER(LEFT(dwo.type,4))='text' then
  278. // s_inputbox S_SREU
  279. // STRING LS_STR,column_name
  280. // S_SREU.TITLE='目前标题为: '+dwo.TEXT+' 。请输入新标题: '
  281. // S_SREU.OLD_TEXT=dwo.TEXT
  282. // column_name=DWO.NAME
  283. //
  284. // openwithparm(w_inputbox,S_SREU)
  285. // LS_STR=Message.StringParm
  286. // if trim(LS_STR)<>'' AND dwo.TEXT<>LS_STR then
  287. // THIS.Modify(column_name+'.text="'+LS_STR+'"')
  288. // END IF
  289. //
  290. //end if
  291. //end if
  292. end event
  293. event retrieveend;call super::retrieveend;//cb_1.Enabled = cb_reol
  294. //if_retrieveing = FALSE
  295. //
  296. //IF Dec(cur_vspos) > 0 THEN
  297. // THIS.Modify("DataWindow.VerticalScrollPosition="+cur_vspos)
  298. //END IF
  299. //
  300. end event
  301. event retrievestart;call super::retrievestart;//cb_reol = cb_1.Enabled
  302. //cb_1.Enabled = FALSE
  303. //if_retrieveing = TRUE
  304. //
  305. //cur_vspos = THIS.Describe("DataWindow.VerticalScrollPosition")
  306. //
  307. end event
  308. event rowfocuschanged;call super::rowfocuschanged;//IF currentrow > 0 THEN
  309. // THIS.SelectRow(0,FALSE)
  310. // THIS.SelectRow(currentrow,TRUE)
  311. //END IF
  312. end event
  313. event dwnkey;call super::dwnkey;PARENT.TRIGGEREVENT('USER_KEY')
  314. end event
  315. type r_bar from rectangle within w_saletaskmx_fileadd
  316. long linecolor = 16777215
  317. integer linethickness = 4
  318. long fillcolor = 1073741824
  319. integer x = 690
  320. integer y = 4
  321. integer width = 87
  322. integer height = 68
  323. end type
  324. event constructor;this.fillcolor = 14215660
  325. this.linecolor = 14215660
  326. this.x = -1
  327. this.y = -1
  328. this.height = ln_bar.beginy - 5
  329. end event
  330. type ln_bar from line within w_saletaskmx_fileadd
  331. long linecolor = 268435456
  332. integer linethickness = 4
  333. integer beginy = 172
  334. integer endx = 4425
  335. integer endy = 172
  336. end type
  337. type ln_bar2 from line within w_saletaskmx_fileadd
  338. long linecolor = 16777215
  339. integer linethickness = 4
  340. integer beginy = 176
  341. integer endx = 4498
  342. integer endy = 176
  343. end type