123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400 |
- $PBExportHeader$w_saletaskmx_fileadd.srw
- forward
- global type w_saletaskmx_fileadd from window
- end type
- type dw_fileclass from u_dw_rbtnfilter within w_saletaskmx_fileadd
- end type
- type cb_1 from uo_imflatbutton within w_saletaskmx_fileadd
- end type
- type cb_oaflow from uo_imflatbutton within w_saletaskmx_fileadd
- end type
- type dw_1 from u_dw_rbtnfilter within w_saletaskmx_fileadd
- end type
- type r_bar from rectangle within w_saletaskmx_fileadd
- end type
- type ln_bar from line within w_saletaskmx_fileadd
- end type
- type ln_bar2 from line within w_saletaskmx_fileadd
- end type
- end forward
- global type w_saletaskmx_fileadd from window
- integer width = 4160
- integer height = 1836
- boolean titlebar = true
- string title = "Untitled"
- boolean controlmenu = true
- windowtype windowtype = response!
- long backcolor = 67108864
- string icon = "AppIcon!"
- boolean clientedge = true
- boolean center = true
- event ue_selectfile ( )
- event ue_save ( )
- dw_fileclass dw_fileclass
- cb_1 cb_1
- cb_oaflow cb_oaflow
- dw_1 dw_1
- r_bar r_bar
- ln_bar ln_bar
- ln_bar2 ln_bar2
- end type
- global w_saletaskmx_fileadd w_saletaskmx_fileadd
- type variables
- long ins_scid
- long ins_taskid
- string ins_taskcode
- long ins_billtype = 9102
- transaction Transaction_pic
- end variables
- event ue_selectfile();////ue_selectfile
- long ll_row
- string ls_col
- ll_row = dw_1.GetRow()
- if ll_row <= 0 then return
- ls_col = dw_1.GetColumnName()
- boolean lb_selectfile
- lb_selectfile = ls_col = 'filename1' OR ls_col = 'filename2' OR ls_col = 'filename3'
- if not lb_selectfile then return
- String Pathname,Filename,FileType
- Integer i
- FileType = ''
- FileType = '所有文件(*.*),*.*,'
- // FileType += "配置文件(*.ini), *.ini,"
- FileType += "Zip压缩文件(*.Zip),*.Zip,"
- FileType += "RAR压缩文件(*.rar),*.rar,"
- // FileType += "XML文件(*.xml),*.xml,"
- FileType += "文本文件(*.txt),*.txt,"
- FileType += "Excel模版(*.xlt),*.xlt,"
- // FileType += "Excel文档(*.xls),*.xls,"
- // FileType += "Word模版(*.dot),*.dot,"
- FileType += "Word文档(*.doc),*.doc,"
- FileType += "JPG(*.JPG),*.JPG,"
- FileType += "位图文件(*.bmp),*.bmp,"
- FileType += "GIF文件(*.GIF),*.GIF"
- i = GetFileOpenName("请选择文件", Pathname,Filename, "All", FileType)
- IF i = 1 AND Trim(Pathname) <> '' AND Trim(Filename) <> "" THEN
- IF Pathname = '' OR NOT FileExists(Pathname) THEN
- MessageBox('系统提示','请选择文件!')
- RETURN
- END IF
- if FileLength(Pathname)/1024 > 10240 then
- messagebox('限制','附件文件大小不得大于10M')
- return
- end if
-
- dw_1.SetItem(ll_row, ls_col, Pathname)
- END IF
- end event
- event ue_save();s_fileinfo s_file
- Long ll_row
- Long ll_i, ll_pos,rt_fileid, ll_cnt = 0
- String ls_filepath
- String ls_filename
- String ls_msg = ''
- String arg_msg
- uo_fj_mng_billtype ls_uo_btfj
- ls_uo_btfj = Create uo_fj_mng_billtype
- IF dw_fileclass.GetRow() <= 0 THEN
- ls_msg = '请选择附件分类'
- GOTO ext
- END IF
- s_file.classid = dw_fileclass.Object.classid[dw_fileclass.GetRow()]
- s_file.fileid = 0
- s_file.Filename = ''
- s_file.dscrp = ''
- s_file.encrypted = 0
- s_file.compressed = 0
- s_file.FileType = ''
- s_file.relid = ins_taskid
- s_file.relcode = ins_taskcode
- s_file.billtype = ins_billtype
- //s_file.relid_mx = ins_relid_mx
- s_file.scid = ins_scid
- s_file.SqlTransaction = Transaction_pic
- Open(w_sys_wait_jdt) //打开进度窗口
- w_sys_wait_jdt.wf_accepttol(dw_1.RowCount() * 3) //初始化进度条
- w_sys_wait_jdt.wf_set_msg('正在保存附件,请稍候...')
- FOR ll_row = 1 To dw_1.RowCount()
- FOR ll_i = 1 To 3
- w_sys_wait_jdt.wf_set_msg('正在保存第' + String(ll_row) + '行,附件' + String(ll_i) +',请稍候...')
-
-
- ls_filepath = Trim(dw_1.GetItemString(ll_row, 'filename' + String(ll_i)))
- IF ls_filepath <> '' THEN
- IF Not FileExists(ls_filepath) THEN
- ls_msg += '第' + String(ll_row) + '行,附件' + String(ll_i) +':[' + ls_filepath + ']不存在!~r~n'
- GOTO label_next
- END IF
- s_file.fileid = 0
- s_file.relid_mx = dw_1.Object.u_saletaskmx_printid[ll_row]
- ll_pos = LastPos(ls_filepath, '\')
- ls_filename = Mid(ls_filepath, ll_pos + 1)
- ll_pos = LastPos(ls_filename, '.')
- IF ll_pos > 0 THEN
- s_file.DisplayName = Mid(ls_filename, 1, ll_pos - 1)
- s_file.Filename = Mid(ls_filename, 1, ll_pos - 1)
- s_file.FileType = Mid(ls_filename, ll_pos + 1)
- ELSE
- s_file.DisplayName = ls_filename
- s_file.Filename = ls_filename
- s_file.FileType = ''
- END IF
- s_file.opemp = publ_operator
- s_file.opdate = DateTime(Today())
- s_file.dscrp = ''
- IF f_filetoblob(ls_filepath, s_file.filedata, arg_msg) <> 1 THEN
- ls_msg += '第' + String(ll_row) + '行,附件' + String(ll_i) +':[' + ls_filepath + ']读取文件失败!' + arg_msg + '~r~n'
- GOTO label_next
- END IF
- IF ls_uo_btfj.uf_save_fj( s_file, rt_fileid, Transaction_pic , arg_msg ) <> 1 THEN
- ls_msg += '第' + String(ll_row) + '行,附件' + String(ll_i) +':[' + ls_filepath + ']保存到附件数据库失败!' + arg_msg + '~r~n'
- GOTO label_next
- END IF
- IF f_update_fj_cnt(s_file.billtype,s_file.scid,s_file.relid,s_file.relid_mx,arg_msg) <> 1 THEN
- ls_msg += '第' + String(ll_row) + '行,附件' + String(ll_i) +':[' + ls_filepath + ']更新附件数量失败!' + arg_msg + '~r~n'
- GOTO label_next
- END IF
- dw_1.SetItem(ll_row, 'filename' + String(ll_i), '')
- END IF
- label_next:
- ll_cnt ++
- w_sys_wait_jdt.wf_inc(ll_cnt)
- NEXT
- NEXT
- Close(w_sys_wait_jdt)
- ext:
- Destroy ls_uo_btfj
- IF ls_msg <> '' THEN
- MessageBox('', ls_msg)
- ELSE
- MessageBox('提示', '上传成功,可继续选择上传')
- END IF
- end event
- on w_saletaskmx_fileadd.create
- this.dw_fileclass=create dw_fileclass
- this.cb_1=create cb_1
- this.cb_oaflow=create cb_oaflow
- this.dw_1=create dw_1
- this.r_bar=create r_bar
- this.ln_bar=create ln_bar
- this.ln_bar2=create ln_bar2
- this.Control[]={this.dw_fileclass,&
- this.cb_1,&
- this.cb_oaflow,&
- this.dw_1,&
- this.r_bar,&
- this.ln_bar,&
- this.ln_bar2}
- end on
- on w_saletaskmx_fileadd.destroy
- destroy(this.dw_fileclass)
- destroy(this.cb_1)
- destroy(this.cb_oaflow)
- destroy(this.dw_1)
- destroy(this.r_bar)
- destroy(this.ln_bar)
- destroy(this.ln_bar2)
- end on
- event open;s_edit_index_tran s_pic
- s_pic = Message.PowerObjectParm
- ins_scid = s_pic.e_long
- ins_taskid = s_pic.g_long
- ins_taskcode = s_pic.f_string
- Transaction_pic = s_pic.sqltransaction
- dw_1.SetTransObject (sqlca)
- dw_1.Retrieve(ins_scid, ins_taskid)
- dw_fileclass.SetTransObject(sqlca)
- dw_fileclass.Retrieve(ins_billtype)
- this.Title = ins_taskcode
- end event
- event resize;ln_bar.EndX = THIS.Width
- ln_bar2.EndX = THIS.Width
- r_bar.Width = THIS.Width
- dw_1.width = WorkSpaceWidth() - dw_1.x
- dw_1.Height = WorkSpaceHeight() - dw_1.y
- dw_fileclass.height = WorkSpaceHeight() - dw_fileclass.y
- end event
- type dw_fileclass from u_dw_rbtnfilter within w_saletaskmx_fileadd
- integer y = 184
- integer height = 1056
- integer taborder = 20
- string dataobject = "dw_fj_fileclass_list_fileadd"
- boolean hscrollbar = true
- boolean vscrollbar = true
- end type
- event rowfocuschanged;call super::rowfocuschanged;IF currentrow > 0 THEN
- this.SelectRow( 0, FALSE)
- this.SelectRow( currentrow, TRUE)
- this.ScrollToRow( currentrow)
- parent.triggerevent( 'retrieve_file')
- END IF
- end event
- type cb_1 from uo_imflatbutton within w_saletaskmx_fileadd
- integer x = 169
- integer width = 165
- integer height = 164
- integer taborder = 20
- boolean bringtotop = true
- string text = "取消"
- string normalpicname = "exit.BMP"
- integer picsize = 16
- toolbaralignment pic_align = alignattop!
- boolean border = false
- end type
- event clicked;call super::clicked;Close(parent)
- end event
- type cb_oaflow from uo_imflatbutton within w_saletaskmx_fileadd
- integer width = 165
- integer height = 164
- integer taborder = 10
- boolean bringtotop = true
- string text = "上传"
- string normalpicname = "save.BMP"
- integer picsize = 16
- toolbaralignment pic_align = alignattop!
- boolean border = false
- end type
- event clicked;call super::clicked;parent.triggerevent('ue_save')
- end event
- type dw_1 from u_dw_rbtnfilter within w_saletaskmx_fileadd
- event ue_dwndropdown pbm_dwndropdown
- integer x = 1019
- integer y = 184
- integer width = 2821
- integer height = 1456
- boolean bringtotop = true
- string dataobject = "dw_saletaskmx_fileadd"
- boolean hscrollbar = true
- boolean vscrollbar = true
- boolean hsplitscroll = true
- end type
- event ue_dwndropdown;// DONE: 选择文件
- parent.triggerEvent('ue_selectfile')
- return 1
- end event
- event constructor;call super::constructor;// titleclick_sort_use=true //单击标题排序功能开关
- // RBUTTON_FILTER_USE=true //右键查询功能开关
- //
- end event
- event doubleclicked;call super::doubleclicked;//if if_mdf_title then
- //if LOWER(LEFT(dwo.type,4))='text' then
- // s_inputbox S_SREU
- // STRING LS_STR,column_name
- // S_SREU.TITLE='目前标题为: '+dwo.TEXT+' 。请输入新标题: '
- // S_SREU.OLD_TEXT=dwo.TEXT
- // column_name=DWO.NAME
- //
- // openwithparm(w_inputbox,S_SREU)
- // LS_STR=Message.StringParm
- // if trim(LS_STR)<>'' AND dwo.TEXT<>LS_STR then
- // THIS.Modify(column_name+'.text="'+LS_STR+'"')
- // END IF
- //
- //end if
- //end if
- end event
- event retrieveend;call super::retrieveend;//cb_1.Enabled = cb_reol
- //if_retrieveing = FALSE
- //
- //IF Dec(cur_vspos) > 0 THEN
- // THIS.Modify("DataWindow.VerticalScrollPosition="+cur_vspos)
- //END IF
- //
- end event
- event retrievestart;call super::retrievestart;//cb_reol = cb_1.Enabled
- //cb_1.Enabled = FALSE
- //if_retrieveing = TRUE
- //
- //cur_vspos = THIS.Describe("DataWindow.VerticalScrollPosition")
- //
- end event
- event rowfocuschanged;call super::rowfocuschanged;//IF currentrow > 0 THEN
- // THIS.SelectRow(0,FALSE)
- // THIS.SelectRow(currentrow,TRUE)
- //END IF
- end event
- event dwnkey;call super::dwnkey;PARENT.TRIGGEREVENT('USER_KEY')
- end event
- type r_bar from rectangle within w_saletaskmx_fileadd
- long linecolor = 16777215
- integer linethickness = 4
- long fillcolor = 1073741824
- integer x = 690
- integer y = 4
- integer width = 87
- integer height = 68
- end type
- event constructor;this.fillcolor = 14215660
- this.linecolor = 14215660
- this.x = -1
- this.y = -1
- this.height = ln_bar.beginy - 5
- end event
- type ln_bar from line within w_saletaskmx_fileadd
- long linecolor = 268435456
- integer linethickness = 4
- integer beginy = 172
- integer endx = 4425
- integer endy = 172
- end type
- type ln_bar2 from line within w_saletaskmx_fileadd
- long linecolor = 16777215
- integer linethickness = 4
- integer beginy = 176
- integer endx = 4498
- integer endy = 176
- end type
|