123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632 |
- $PBExportHeader$w_aifmb_erpfj_ch.srw
- forward
- global type w_aifmb_erpfj_ch from window
- end type
- type cb_2 from uo_imflatbutton within w_aifmb_erpfj_ch
- end type
- type cbx_showpic from checkbox within w_aifmb_erpfj_ch
- end type
- type cb_5 from uo_imflatbutton within w_aifmb_erpfj_ch
- end type
- type dw_fileclass from u_dw_rbtnfilter within w_aifmb_erpfj_ch
- end type
- type cb_6 from uo_imflatbutton within w_aifmb_erpfj_ch
- end type
- type dw_fj from datawindow within w_aifmb_erpfj_ch
- end type
- type cb_1 from uo_imflatbutton within w_aifmb_erpfj_ch
- end type
- type cb_4 from uo_imflatbutton within w_aifmb_erpfj_ch
- end type
- type cb_open from uo_imflatbutton within w_aifmb_erpfj_ch
- end type
- type ln_bar2 from line within w_aifmb_erpfj_ch
- end type
- type ln_bar from line within w_aifmb_erpfj_ch
- end type
- type r_bar from rectangle within w_aifmb_erpfj_ch
- end type
- end forward
- global type w_aifmb_erpfj_ch from window
- integer width = 2999
- integer height = 1372
- boolean titlebar = true
- string title = "附件管理"
- boolean controlmenu = true
- windowtype windowtype = response!
- long backcolor = 67108864
- string icon = "AppIcon!"
- boolean center = true
- event retrieve_file ( )
- event retrieve_fileclass ( )
- cb_2 cb_2
- cbx_showpic cbx_showpic
- cb_5 cb_5
- dw_fileclass dw_fileclass
- cb_6 cb_6
- dw_fj dw_fj
- cb_1 cb_1
- cb_4 cb_4
- cb_open cb_open
- ln_bar2 ln_bar2
- ln_bar ln_bar
- r_bar r_bar
- end type
- global w_aifmb_erpfj_ch w_aifmb_erpfj_ch
- type variables
- long ins_billtype //当前单据类型
- //
- //
- //
- //long ins_relid //当前单据ID
- //string ins_relcode //当前单据号码
- //long ins_relid_mx //当前明细ID
- //string ins_relcode_mx //当前明细号码
- //long ins_scid //分部ID
- //
- Blob ins_lbimage
- string ori_title
- datastore ins_ds_fileclass
- Transaction Transaction_pic
- string ins_openfile_log[] //用于退出后删除
- long ins_openfile_log_p=0 //用于退出后删除
- s_aifmb_erpfj_ch ins_rslt
- end variables
- forward prototypes
- public subroutine wf_addlog_tempfilepathname (string arg_filepathname)
- public subroutine wf_del_tempfilepathname ()
- public subroutine wf_fileopen_pic (long arg_fileid)
- public subroutine wf_retrfile (long arg_mtrlid)
- end prototypes
- event retrieve_file();long lrow
- lrow=dw_fileclass.getrow( )
- if lrow>0 then
- dw_fj.Retrieve(dw_fileclass.object.classid[lrow])
- else
- dw_fj.reset()
- end if
- //201 //物料定义-附件
- //102 //销售订单-附件
- //202 //物料清单-附件
- // >.. 按main函数上的ID
- end event
- event retrieve_fileclass();Long i,ls_row,ls_rowcount,nrow
- Long ls_classid,ls_filecount,ls_allowedit
- ls_rowcount = ins_ds_fileclass.Retrieve( ins_billtype)
- //messagebox(string(ins_billtype),ls_rowcount)
- dw_fileclass.Reset()
- dw_fileclass.Enabled = FALSE
- FOR i = 1 TO ls_rowcount
- ls_allowedit = 0
- ls_filecount = 0
- ls_classid = ins_ds_fileclass.Object.classid[i]
- IF f_power_ind_fileclassview(ls_classid) THEN
-
- SELECT count(*) INTO :ls_filecount
- FROM u_file
- WHERE classid = :ls_classid
- USING Transaction_pic;
- IF Transaction_pic.SQLCode <> 0 THEN
- MessageBox('错误','统计附件数量失败>'+Transaction_pic.SQLErrText,stopsign!,OK!)
- RETURN
- END IF
- IF f_power_ind_fileclassedit(ls_classid) THEN
- ls_allowedit = 1
- ELSE
- ls_allowedit = 0
- END IF
- nrow = dw_fileclass.InsertRow(0)
- dw_fileclass.Object.classid[nrow] = ls_classid
- dw_fileclass.Object.ClassName[nrow] = ins_ds_fileclass.Object.ClassName[i]
- dw_fileclass.Object.dscrp[nrow] = ins_ds_fileclass.Object.dscrp[i]
- dw_fileclass.Object.filecount[nrow] = ls_filecount
- dw_fileclass.Object.allow_edit[nrow] = ls_allowedit
- END IF
- NEXT
- IF dw_fileclass.RowCount() > 0 THEN
- dw_fileclass.SetSort('classname')
- dw_fileclass.Sort()
- dw_fileclass.SelectRow( 0, FALSE)
- dw_fileclass.SelectRow( 1, TRUE)
- dw_fileclass.ScrollToRow( 1)
- THIS.TriggerEvent( 'retrieve_file')
- END IF
- dw_fileclass.Enabled = TRUE
- //dw_fileclass.Retrieve( ins_billtype)
- end event
- public subroutine wf_addlog_tempfilepathname (string arg_filepathname);//wf_addlog_tempfilepathname
- if isnull(arg_filepathname) or len(trim(arg_filepathname))<3 then return
- ins_openfile_log_p++
- ins_openfile_log[ins_openfile_log_p]=arg_filepathname
- // string ins_openfile_log[] //用于退出后删除
- // long ins_openfile_log_p=0 //用于退出后删除
- //
- end subroutine
- public subroutine wf_del_tempfilepathname ();//wf_del_tempfilepathname
- // 删除临时文件
- long li
- for li=1 to ins_openfile_log_p
- if len(trim(ins_openfile_log[li]))<=0 then
- else
- FileDelete(ins_openfile_log[li])
- end if
- next
- end subroutine
- public subroutine wf_fileopen_pic (long arg_fileid);
- s_edit_index_tran s_pic
- s_pic.f_long= arg_fileid
- s_pic.sqltransaction = sys_filedb_sqlca
- OpenWithParm(w_fj_fileopen,s_pic)
- end subroutine
- public subroutine wf_retrfile (long arg_mtrlid);Long lrow
- lrow = dw_fileclass.GetRow( )
- IF lrow > 0 THEN
- dw_fj.Retrieve(dw_fileclass.Object.classid[lrow])
- ELSE
- dw_fj.Reset()
- END IF
- String ls_mtrlcode
- SELECT mtrlcode
- INTO :ls_mtrlcode
- FROM u_mtrldef
- Where mtrlid = :arg_mtrlid;
- IF sqlca.SQLCode = 0 THEN
- THIS.Title = ls_mtrlcode
- ELSE
- THIS.Title = ''
- END IF
-
- end subroutine
- on w_aifmb_erpfj_ch.create
- this.cb_2=create cb_2
- this.cbx_showpic=create cbx_showpic
- this.cb_5=create cb_5
- this.dw_fileclass=create dw_fileclass
- this.cb_6=create cb_6
- this.dw_fj=create dw_fj
- this.cb_1=create cb_1
- this.cb_4=create cb_4
- this.cb_open=create cb_open
- this.ln_bar2=create ln_bar2
- this.ln_bar=create ln_bar
- this.r_bar=create r_bar
- this.Control[]={this.cb_2,&
- this.cbx_showpic,&
- this.cb_5,&
- this.dw_fileclass,&
- this.cb_6,&
- this.dw_fj,&
- this.cb_1,&
- this.cb_4,&
- this.cb_open,&
- this.ln_bar2,&
- this.ln_bar,&
- this.r_bar}
- end on
- on w_aifmb_erpfj_ch.destroy
- destroy(this.cb_2)
- destroy(this.cbx_showpic)
- destroy(this.cb_5)
- destroy(this.dw_fileclass)
- destroy(this.cb_6)
- destroy(this.dw_fj)
- destroy(this.cb_1)
- destroy(this.cb_4)
- destroy(this.cb_open)
- destroy(this.ln_bar2)
- destroy(this.ln_bar)
- destroy(this.r_bar)
- end on
- event resize;ln_bar.EndX = THIS.Width
- ln_bar2.EndX = THIS.Width
- r_bar.Width = THIS.Width
- end event
- event open;//
- //IF NOT IsNull(s_tran.sqltransaction ) THEN
- // Transaction_pic = s_tran.sqltransaction
- //ELSE
- // MessageBox('提示','没有数据库事务',information!,OK!)
- // Close(THIS)
- // RETURN
- //END IF
- IF sys_fileDB_sqlca.DBHandle() > 0 THEN
- Transaction_pic = sys_fileDB_sqlca
- ELSE
- MessageBox('提示','没有数据库事务',information!,OK!)
- Close(This)
- RETURN
- END IF
- ins_ds_fileclass = Create datastore
- ins_ds_fileclass.DataObject = dw_fileclass.DataObject
- ins_ds_fileclass.SetTransObject(sqlca)
- //dw_fileclass.SetTransObject(sqlca)
- dw_fj.SetTransObject(Transaction_pic)
- This.TriggerEvent('retrieve_fileclass')
- end event
- event close;// 删除临时文件
- wf_del_tempfilepathname()
- closewithreturn(this, ins_rslt)
- end event
- type cb_2 from uo_imflatbutton within w_aifmb_erpfj_ch
- integer x = 1856
- integer width = 151
- integer height = 164
- integer taborder = 40
- string text = "选定"
- string normalpicname = "ok.bmp"
- integer picsize = 16
- toolbaralignment pic_align = alignattop!
- boolean border = false
- end type
- event clicked;call super::clicked;s_piclistview_parm s_pics[]
- Long cnt = 0
- Long i
- uo_fj_mng_billtype ls_uo_fjbt
- ls_uo_fjbt = Create uo_fj_mng_billtype
- Int rslt = 1
- String arg_msg
- FOR i = 1 To dw_fj.RowCount()
- IF dw_fj.IsSelected(i) THEN
- cnt++
- s_pics[cnt].a_any = dw_fj.Object.fileid[i]
- s_pics[cnt].Label = dw_fj.Object.DisplayName[i]
- s_pics[cnt].tmppath = sys_cur_path + 'aifmb_tmp\u_file_' + String(dw_fj.Object.fileid[i]) + '.' + dw_fj.Object.FileType[i]
- IF ls_uo_fjbt.uf_getfjbolb_fromdb( dw_fj.Object.fileid[i], s_pics[cnt].Data, Transaction_pic, arg_msg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
-
- END IF
- NEXT
- ext:
- Destroy ls_uo_fjbt
- IF rslt = 1 THEN
- ins_rslt.pics = s_pics
- Close(Parent)
- ELSE
- MessageBox('ERROR', arg_msg)
- END IF
- end event
- type cbx_showpic from checkbox within w_aifmb_erpfj_ch
- integer x = 192
- integer y = 92
- integer width = 425
- integer height = 56
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- long textcolor = 33554432
- long backcolor = 67108864
- string text = "直接查看图片"
- boolean checked = true
- end type
- event clicked;if this.checked then
- f_SetProfileString (sys_empid, "w_fj_bill_mng", "cbx_showpic", '1')
- else
- f_SetProfileString (sys_empid, "w_fj_bill_mng", "cbx_showpic", '0')
- end if
- end event
- event constructor;THIS.BackColor = 14215660
- String showpic
- showpic = f_ProfileString (sys_empid, "w_fj_bill_mng", "cbx_showpic", "1")
- IF showpic = '1' THEN
- THIS.Checked = TRUE
- ELSE
- THIS.Checked = FALSE
- END IF
- end event
- type cb_5 from uo_imflatbutton within w_aifmb_erpfj_ch
- integer width = 151
- integer height = 164
- integer taborder = 10
- string text = "刷新"
- string normalpicname = "refresh.bmp"
- integer picsize = 16
- toolbaralignment pic_align = alignattop!
- boolean border = false
- end type
- event clicked;call super::clicked;PARENT.TriggerEvent('retrieve_fileclass')
- end event
- type dw_fileclass from u_dw_rbtnfilter within w_aifmb_erpfj_ch
- integer y = 184
- integer height = 1056
- integer taborder = 80
- string dataobject = "dw_fj_fileclass_list"
- 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_6 from uo_imflatbutton within w_aifmb_erpfj_ch
- integer x = 1435
- integer width = 274
- integer height = 164
- integer taborder = 30
- string text = "另存文件"
- string normalpicname = "save.BMP"
- integer picsize = 16
- toolbaralignment pic_align = alignattop!
- boolean border = false
- end type
- event clicked;call super::clicked;//附件下载并打开
- Integer i
- Long ls_i,ls_j,ls_newrow,ls_filesize
- Blob ls_filedata
- String Pathname,ls_filename
- String errmsg,arg_msg
- Long pos1,lrow,rslt,ls_fileid
- String ls_para,ls_downarg[],ls_filetype
- SetNull(ls_filedata)
- uo_fj_mng_billtype ls_uo_fjbt
- ls_uo_fjbt=create uo_fj_mng_billtype
- long ls_row
- ls_row=dw_fj.getrow()
- if ls_row<=0 then
- messagebox('提示','当前没有文件',information!,OK!)
- return
- end if
- //取附件信息
- ls_fileid = dw_fj.object.fileid[ls_row]
- ls_filename = dw_fj.object.filename[ls_row]
- ls_filetype = dw_fj.object.filetype[ls_row]
-
- IF len(ls_filetype) > 0 THEN
- i = GetFileSaveName("另存为",Pathname,ls_filename,"*","*."+ls_filetype+",*."+ls_filetype)
- ELSE
- i = GetFileSaveName("另存为",Pathname,ls_filename,"*","*.*,*.*")
- END IF
- IF i = 1 AND Trim(Pathname) <> '' THEN
- if ls_uo_fjbt.uf_getfjbolb_fromdb( ls_fileid, ls_filedata, Transaction_pic, arg_msg)=0 THEN
- MessageBox('错误',arg_msg,stopsign!,OK!)
- RETURN
- END IF
-
- IF f_saveblobtofile(ls_filedata,Pathname,errmsg) = 0 THEN
- MessageBox('错误',errmsg,stopsign!,OK!)
- RETURN
- ELSE
-
- MessageBox('提示','附件保存成功!'+'~r~n'+'保存路径:'+Pathname,information!,OK!)
- END IF
- END IF
- //
- end event
- type dw_fj from datawindow within w_aifmb_erpfj_ch
- integer x = 1015
- integer y = 184
- integer width = 1925
- integer height = 1056
- integer taborder = 70
- string title = "none"
- string dataobject = "dw_fj_file_list"
- boolean hscrollbar = true
- boolean vscrollbar = true
- boolean livescroll = true
- borderstyle borderstyle = stylelowered!
- end type
- event doubleclicked;IF row <= 0 THEN RETURN
- cb_open.triggerevent(clicked!)
- end event
- event clicked;IF row > 0 THEN
- This.SelectRow(row, Not This.IsSelected(row))
- END IF
- end event
- type cb_1 from uo_imflatbutton within w_aifmb_erpfj_ch
- integer x = 1010
- integer width = 151
- integer height = 164
- integer taborder = 10
- string text = "刷新"
- string normalpicname = "refresh.bmp"
- integer picsize = 16
- toolbaralignment pic_align = alignattop!
- boolean border = false
- end type
- event clicked;call super::clicked;PARENT.TriggerEvent('retrieve_file')
- end event
- type cb_4 from uo_imflatbutton within w_aifmb_erpfj_ch
- integer x = 2011
- integer width = 151
- integer height = 164
- integer taborder = 60
- 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_open from uo_imflatbutton within w_aifmb_erpfj_ch
- integer x = 1161
- integer width = 274
- integer height = 164
- integer taborder = 20
- string text = "查看文件"
- string normalpicname = "audit.BMP"
- integer picsize = 16
- toolbaralignment pic_align = alignattop!
- boolean border = false
- end type
- event clicked;call super::clicked;//附件下载并打开
- Integer i
- Long ls_i,ls_j,ls_newrow,ls_filesize
- Blob ls_filedata
- String Pathname,ls_filename,ls_filetype
- String errmsg,arg_msg
- Long pos1,lrow,rslt,ls_fileid
- String ls_para,ls_downarg[]
- SetNull(ls_filedata)
- uo_fj_mng_billtype ls_uo_fjbt
- ls_uo_fjbt = CREATE uo_fj_mng_billtype
- Long ls_row
- ls_row = dw_fj.GetRow()
- IF ls_row <= 0 THEN
- MessageBox('提示','当前没有文件',information!,OK!)
- RETURN
- END IF
- //取附件信息
- ls_fileid = dw_fj.Object.fileid[ls_row]
- ls_filename = dw_fj.Object.Filename[ls_row]
- ls_filetype = Lower(Trim(dw_fj.Object.FileType[ls_row]))
- IF cbx_showpic.Checked THEN
- IF ls_filetype = 'bmp' OR ls_filetype = 'rle' OR ls_filetype = 'wmf' OR ls_filetype = 'tif' OR ls_filetype = 'jpg' OR ls_filetype = 'gif' OR ls_filetype = 'jpeg' THEN
- wf_fileopen_pic(ls_fileid)
- RETURN
- END IF
- END IF
- //下载附件并打开
- Pathname = sys_cur_path+ins_fjtemppath+'\'+String(Today(),'yymmdd')+String(Now(),'hhmmss')+'_'+ls_filename+'.'+ls_filetype
- IF Trim(Pathname) <> '' THEN
-
-
- IF ls_uo_fjbt.uf_getfjbolb_fromdb( ls_fileid, ls_filedata, Transaction_pic, arg_msg) = 0 THEN
- MessageBox('错误',arg_msg,stopsign!,OK!)
- RETURN 0
- END IF
-
- IF f_saveblobtofile(ls_filedata,Pathname,errmsg) = 0 THEN
- MessageBox('错误',errmsg,stopsign!,OK!)
- RETURN
- ELSE
-
- //记录临时文件位置,本窗口退出后删除
- wf_addlog_tempfilepathname(Pathname)
-
- //打开附件
- String lsNull
- ShellExecute32( Handle(THIS), lsNull, Pathname, lsNull, lsNull, 1 )
- END IF
- END IF
- DESTROY ls_uo_fjbt
- end event
- type ln_bar2 from line within w_aifmb_erpfj_ch
- long linecolor = 16777215
- integer linethickness = 4
- integer beginx = -23
- integer beginy = 172
- integer endx = 2016
- integer endy = 172
- end type
- type ln_bar from line within w_aifmb_erpfj_ch
- long linecolor = 268435456
- integer linethickness = 4
- integer beginx = -23
- integer beginy = 168
- integer endx = 1984
- integer endy = 168
- end type
- type r_bar from rectangle within w_aifmb_erpfj_ch
- long linecolor = 16777215
- integer linethickness = 4
- long fillcolor = 1073741824
- integer x = 2642
- integer y = 48
- integer width = 146
- 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
|