$PBExportHeader$w_buytaskmx_fileadd_p.srw forward global type w_buytaskmx_fileadd_p from window end type type cb_save from uo_imflatbutton within w_buytaskmx_fileadd_p end type type dw_fj_saletaskmx from u_dw_rbtnfilter within w_buytaskmx_fileadd_p end type type cb_del from uo_imflatbutton within w_buytaskmx_fileadd_p end type type dw_fj_mtrl from u_dw_rbtnfilter within w_buytaskmx_fileadd_p end type type dw_fileclass_saletaskmx from u_dw_rbtnfilter within w_buytaskmx_fileadd_p end type type dw_fileclass_mtrl from u_dw_rbtnfilter within w_buytaskmx_fileadd_p end type type cb_exit from uo_imflatbutton within w_buytaskmx_fileadd_p end type type cb_edit from uo_imflatbutton within w_buytaskmx_fileadd_p end type type dw_saletaskmx from u_dw_rbtnfilter within w_buytaskmx_fileadd_p end type type r_bar from rectangle within w_buytaskmx_fileadd_p end type type ln_bar from line within w_buytaskmx_fileadd_p end type type ln_bar2 from line within w_buytaskmx_fileadd_p end type end forward global type w_buytaskmx_fileadd_p from window integer width = 4160 integer height = 2496 boolean titlebar = true string title = "订单明细附件批量上传" boolean controlmenu = true boolean minbox = true boolean maxbox = true windowtype windowtype = popup! windowstate windowstate = maximized! long backcolor = 67108864 string icon = "AppIcon!" boolean clientedge = true event ue_selectfile ( ) event ue_save ( ) event retrieve_file ( ) event retrieve_file_saletaskmx ( ) event ue_del ( ) cb_save cb_save dw_fj_saletaskmx dw_fj_saletaskmx cb_del cb_del dw_fj_mtrl dw_fj_mtrl dw_fileclass_saletaskmx dw_fileclass_saletaskmx dw_fileclass_mtrl dw_fileclass_mtrl cb_exit cb_exit cb_edit cb_edit dw_saletaskmx dw_saletaskmx r_bar r_bar ln_bar ln_bar ln_bar2 ln_bar2 end type global w_buytaskmx_fileadd_p w_buytaskmx_fileadd_p type variables long ins_scid long ins_taskid string ins_taskcode long ins_billtype = 9401 //订单明细 long ins_billtype_mtrl = 201 //物料 transaction Transaction_pic long ins_fileid Blob ins_filedata string ins_filename uo_fileview obj_fileview end variables forward prototypes public function long wf_fileopen (long arg_fileid) public function integer wf_setfile (blob arg_filedata, string arg_filename) end prototypes event ue_selectfile();////ue_selectfile long ll_row string ls_col ll_row = dw_saletaskmx.GetRow() if ll_row <= 0 then return ls_col = dw_saletaskmx.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_saletaskmx.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, ll_printid//, ll_fileid String ls_filepath Int rslt = 1 String ls_msg = '' String arg_msg String ls_DisPlayName, ls_FileName, ls_FileType uo_fj_mng_billtype ls_uo_btfj ls_uo_btfj = Create uo_fj_mng_billtype IF dw_fileclass_mtrl.GetRow() <= 0 THEN ls_msg = '请选择附件分类-物料' GOTO ext END IF IF dw_fileclass_saletaskmx.GetRow() <= 0 THEN ls_msg = '请选择附件分类-订单明细' GOTO ext END IF ll_row = dw_saletaskmx.GetRow() IF ll_row <= 0 THEN ls_msg = '请选择订单明细' GOTO ext END IF ll_printid = dw_saletaskmx.Object.u_BuyTaskmx_printid[ll_row] s_file.classid = dw_fileclass_saletaskmx.Object.classid[dw_fileclass_saletaskmx.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 = ll_printid s_file.scid = ins_scid s_file.SqlTransaction = Transaction_pic s_file.fileid = 0 //ll_fileid = dw_fj_mtrl.object.fileid[dw_fj_mtrl.getrow] SELECT DisPlayName, FileName, FileType INTO :ls_DisPlayName, :ls_FileName, :ls_FileType FROM u_File WHERE Fileid = :ins_fileid Using Transaction_pic; IF Transaction_pic.SQLCode <> 0 THEN rslt = 0 ls_msg += '查询产品附件信息失败!~r~n' + Transaction_pic.sqlerrtext GOTO ext END IF s_file.DisplayName = ls_DisPlayName s_file.Filename = ls_FileName s_file.FileType = ls_FileType s_file.opemp = publ_operator s_file.opdate = DateTime(Today()) s_file.dscrp = '' s_file.filedata = ins_filedata IF ls_uo_btfj.uf_save_fj( s_file, rt_fileid, Transaction_pic , arg_msg ) <> 1 THEN rslt = 0 ls_msg += '附件保存到附件数据库失败!' + arg_msg + '~r~n' GOTO ext END IF IF f_update_fj_cnt(s_file.billtype,s_file.scid,s_file.relid,s_file.relid_mx,arg_msg) <> 1 THEN rslt = 0 ls_msg += '附件更新附件数量失败!' + arg_msg + '~r~n' GOTO ext END IF ext: Destroy ls_uo_btfj IF ls_msg <> '' THEN MessageBox('', ls_msg) ELSE MessageBox('提示', '上传成功,可继续选择上传') this.triggerevent( 'retrieve_file_saletaskmx') END IF end event event retrieve_file();Long ll_mtrlid, ll_classid IF dw_saletaskmx.GetRow() > 0 THEN ll_mtrlid = dw_saletaskmx.Object.mtrlid[dw_saletaskmx.GetRow()] ELSE ll_mtrlid = 0 END IF IF dw_fileclass_mtrl.GetRow() > 0 THEN ll_classid = dw_fileclass_mtrl.Object.classid[dw_fileclass_mtrl.GetRow()] ELSE ll_classid = 0 END IF dw_fj_mtrl.Retrieve(ins_billtype_mtrl, ll_classid, ll_mtrlid, 0, ins_scid) end event event retrieve_file_saletaskmx();Long ll_printid, ll_classid IF dw_saletaskmx.GetRow() > 0 THEN ll_printid = dw_saletaskmx.Object.u_BuyTaskmx_printid[dw_saletaskmx.GetRow()] ELSE ll_printid = 0 END IF IF dw_fileclass_saletaskmx.GetRow() > 0 THEN ll_classid = dw_fileclass_saletaskmx.Object.classid[dw_fileclass_saletaskmx.GetRow()] ELSE ll_classid = 0 END IF dw_fj_saletaskmx.Retrieve(ins_billtype, ll_classid, ins_taskid, ll_printid, ins_scid) end event event ue_del();Long ll_row, ll_fileid, ll_printid //Long ll_i, ll_pos,rt_fileid, ll_cnt = 0, ll_printid //, ll_fileid Int rslt = 1 String ls_msg = '' String arg_msg uo_fj_mng_billtype ls_uo_btfj ls_uo_btfj = Create uo_fj_mng_billtype IF dw_fileclass_saletaskmx.GetRow() <= 0 THEN ls_msg = '请选择附件分类-订单明细' GOTO ext END IF ll_row = dw_saletaskmx.GetRow() IF ll_row <= 0 THEN ls_msg = '请选择订单明细' GOTO ext END IF IF dw_fj_saletaskmx.GetRow() <= 0 THEN ls_msg = '请选择附件-订单明细' GOTO ext END IF IF MessageBox ("if","是否确定要删除当前订单明细附件文件["+String(dw_fj_saletaskmx.Object.DisplayName[dw_fj_saletaskmx.GetRow()]) +"]?(选择确定后记录将不可恢复)",question!,yesno! ) = 2 THEN RETURN END IF ll_fileid = dw_fj_saletaskmx.Object.Fileid[dw_fj_saletaskmx.GetRow()] ll_printid = dw_saletaskmx.Object.u_BuyTaskmx_printid[ll_row] IF ls_uo_btfj.uf_del_file(ll_fileid,Transaction_pic,arg_msg) = 0 THEN MessageBox('系统提示:',arg_msg) RETURN END IF IF f_update_fj_cnt(ins_billtype,ins_scid,ins_taskid,ll_printid,arg_msg) = 0 THEN ls_msg = arg_msg GOTO ext END IF ext: Destroy ls_uo_btfj IF ls_msg <> '' THEN MessageBox('', ls_msg) ELSE MessageBox('提示', '文件删除成功') this.triggerevent( 'retrieve_file_saletaskmx') END IF end event public function long wf_fileopen (long arg_fileid);s_fileinfo s_file String arg_msg Blob nulldata SetNull(nulldata) String ls_filetype,ls_filename Long ll_x, ll_y ll_x = 0 ll_y = dw_fileclass_mtrl.Y + dw_fileclass_mtrl.Height + 4 SELECT filetype,filename INTO :ls_filetype,:ls_filename FROM u_file Where fileid = :arg_fileid Using Transaction_pic; IF Transaction_pic.SQLCode <> 0 THEN IF IsValid(obj_fileview) THEN CloseUserObject(obj_fileview) END IF MessageBox('系统提示','获取文件类型失败'+Transaction_pic.SQLErrText) RETURN 0 END IF //THIS.Title = ins_ori_title +' ['+Trim(ls_filetype)+'] '+Trim(ls_filename) SelectBlob filedata Into :s_file.filedata From u_file Where fileid = :arg_fileid Using Transaction_pic; IF Transaction_pic.SQLCode <> 0 THEN IF IsValid(obj_fileview) THEN CloseUserObject(obj_fileview) END IF MessageBox('系统提示','获取图片失败'+Transaction_pic.SQLErrText) RETURN 0 END IF IF Not IsValid(obj_fileview) THEN obj_fileview = Create uo_fileview_pic OpenUserObject(obj_fileview, ll_x, ll_y) obj_fileview.Height = This.Height - obj_fileview.Y - 40 obj_fileview.Width = This.Width - obj_fileview.X -40 END IF obj_fileview.OriginalSize = True IF obj_fileview.of_showfile( s_file.filedata,ls_filename, arg_msg) <> 1 THEN IF IsValid(obj_fileview) THEN CloseUserObject(obj_fileview) END IF MessageBox('系统提示',arg_msg) RETURN 0 END IF ins_filedata = s_file.filedata ins_filename = ls_filename //obj_fileview.of_set_originalsize( true) obj_fileview.of_setfilesize( ) ins_fileid = arg_fileid RETURN 1 end function public function integer wf_setfile (blob arg_filedata, string arg_filename);String arg_msg IF IsValid(obj_fileview) THEN obj_fileview.OriginalSize = True IF obj_fileview.of_showfile( arg_filedata,arg_filename, arg_msg) <> 1 THEN CloseUserObject(obj_fileview) MessageBox('系统提示',arg_msg) RETURN 0 END IF ins_filedata = arg_filedata //ins_ori_title = ls_ //obj_fileview.of_set_originalsize( true) obj_fileview.of_setfilesize( ) END IF RETURN 1 end function on w_buytaskmx_fileadd_p.create this.cb_save=create cb_save this.dw_fj_saletaskmx=create dw_fj_saletaskmx this.cb_del=create cb_del this.dw_fj_mtrl=create dw_fj_mtrl this.dw_fileclass_saletaskmx=create dw_fileclass_saletaskmx this.dw_fileclass_mtrl=create dw_fileclass_mtrl this.cb_exit=create cb_exit this.cb_edit=create cb_edit this.dw_saletaskmx=create dw_saletaskmx this.r_bar=create r_bar this.ln_bar=create ln_bar this.ln_bar2=create ln_bar2 this.Control[]={this.cb_save,& this.dw_fj_saletaskmx,& this.cb_del,& this.dw_fj_mtrl,& this.dw_fileclass_saletaskmx,& this.dw_fileclass_mtrl,& this.cb_exit,& this.cb_edit,& this.dw_saletaskmx,& this.r_bar,& this.ln_bar,& this.ln_bar2} end on on w_buytaskmx_fileadd_p.destroy destroy(this.cb_save) destroy(this.dw_fj_saletaskmx) destroy(this.cb_del) destroy(this.dw_fj_mtrl) destroy(this.dw_fileclass_saletaskmx) destroy(this.dw_fileclass_mtrl) destroy(this.cb_exit) destroy(this.cb_edit) destroy(this.dw_saletaskmx) 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_saletaskmx.SetTransObject (sqlca) dw_fj_mtrl.SetTransObject(Transaction_pic) dw_fileclass_mtrl.SetTransObject(sqlca) dw_fileclass_saletaskmx.SetTransObject(sqlca) dw_fj_saletaskmx.SetTransObject(Transaction_pic) dw_saletaskmx.Retrieve(ins_scid, ins_taskid) dw_fileclass_mtrl.Retrieve(ins_billtype_mtrl) dw_fileclass_saletaskmx.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_saletaskmx.width = THIS.Width - dw_saletaskmx.x - 40 - dw_fileclass_saletaskmx.width - dw_fj_saletaskmx.width //dw_saletaskmx.Height = THIS.Height - dw_saletaskmx.y dw_fileclass_saletaskmx.x = dw_saletaskmx.x + dw_saletaskmx.width dw_fj_saletaskmx.x = dw_fileclass_saletaskmx.x + dw_fileclass_saletaskmx.width dw_fileclass_mtrl.y = dw_saletaskmx.y + dw_saletaskmx.height + 4 dw_fj_mtrl.y = dw_saletaskmx.y + dw_saletaskmx.height + 4 dw_fj_mtrl.width = THIS.Width - dw_fj_mtrl.x - 40 //dw_fileclass_mtrl.height = (THIS.Height - dw_fileclass_mtrl.y - 140 ) / 2 // //dw_fileclass_saletaskmx.y = dw_fileclass_mtrl.y + dw_fileclass_mtrl.height + 4 //dw_fileclass_saletaskmx.height = dw_fileclass_mtrl.height end event type cb_save from uo_imflatbutton within w_buytaskmx_fileadd_p 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_fj_saletaskmx from u_dw_rbtnfilter within w_buytaskmx_fileadd_p integer x = 2528 integer y = 172 integer width = 1454 integer height = 648 integer taborder = 30 boolean titlebar = true string title = "附件-订单明细" string dataobject = "dw_saletaskmx_fileadd_p_fj" boolean hscrollbar = true boolean vscrollbar = true end type event rowfocuschanged;call super::rowfocuschanged;//IF currentrow > 0 THEN // this.setrow(currentrow) // this.SelectRow( 0, FALSE) // this.SelectRow( currentrow, TRUE) // this.ScrollToRow( currentrow) // // dw_fj_mtrl.SelectRow( 0, FALSE) // // long ll_fileid // ll_fileid = this.object.fileid[currentrow] // wf_fileopen(ll_fileid) //// parent.triggerevent( 'open_file') //END IF end event event clicked;call super::clicked;IF row > 0 THEN this.setrow(row) this.SelectRow( 0, FALSE) this.SelectRow( row, TRUE) this.ScrollToRow( row) dw_fj_mtrl.SelectRow( 0, FALSE) long ll_fileid ll_fileid = this.object.fileid[row] wf_fileopen(ll_fileid) // parent.triggerevent( 'open_file') END IF end event type cb_del from uo_imflatbutton within w_buytaskmx_fileadd_p integer x = 329 integer width = 165 integer height = 164 integer taborder = 10 boolean bringtotop = true string text = "删除" string normalpicname = "delete.BMP" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;parent.triggerevent('ue_del') end event type dw_fj_mtrl from u_dw_rbtnfilter within w_buytaskmx_fileadd_p integer x = 1033 integer y = 1060 integer height = 660 integer taborder = 20 boolean titlebar = true string title = "附件-物料" string dataobject = "dw_saletaskmx_fileadd_p_fj" boolean hscrollbar = true boolean vscrollbar = true end type event rowfocuschanged;call super::rowfocuschanged;//IF currentrow > 0 THEN // this.setrow(currentrow) // this.SelectRow( 0, FALSE) // this.SelectRow( currentrow, TRUE) // this.ScrollToRow( currentrow) // // dw_fj_saletaskmx.SelectRow( 0, FALSE) // // long ll_fileid // ll_fileid = this.object.fileid[currentrow] // wf_fileopen(ll_fileid) //// parent.triggerevent( 'open_file') //END IF end event event clicked;call super::clicked;IF row > 0 THEN this.setrow(row) this.SelectRow( 0, FALSE) this.SelectRow( row, TRUE) this.ScrollToRow( row) dw_fj_saletaskmx.SelectRow( 0, FALSE) long ll_fileid ll_fileid = this.object.fileid[row] wf_fileopen(ll_fileid) // parent.triggerevent( 'open_file') END IF end event type dw_fileclass_saletaskmx from u_dw_rbtnfilter within w_buytaskmx_fileadd_p integer x = 1669 integer y = 180 integer width = 841 integer height = 648 integer taborder = 20 boolean titlebar = true string title = "附件分类-订单明细" 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_saletaskmx') END IF end event type dw_fileclass_mtrl from u_dw_rbtnfilter within w_buytaskmx_fileadd_p integer y = 1052 integer height = 660 integer taborder = 20 boolean titlebar = true string title = "附件分类-物料" 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_exit from uo_imflatbutton within w_buytaskmx_fileadd_p integer x = 494 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_edit from uo_imflatbutton within w_buytaskmx_fileadd_p integer x = 165 integer width = 165 integer height = 164 integer taborder = 10 boolean bringtotop = true string text = "编辑" string normalpicname = "open.BMP" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;//parent.triggerevent('ue_save') s_parm_bmp_editor s_tran s_tran.if_bmp = false s_tran.bmp = ins_filedata openwithparm(w_bmp_editor, s_tran) s_tran = Message.PowerObjectParm if s_tran.if_bmp then messagebox("","保存了") wf_setfile(s_tran.bmp, ins_filename) else messagebox("","没有保存") end if end event type dw_saletaskmx from u_dw_rbtnfilter within w_buytaskmx_fileadd_p event ue_dwndropdown pbm_dwndropdown integer y = 180 integer width = 1650 integer height = 648 boolean bringtotop = true boolean titlebar = true string title = "订单明细" string dataobject = "dw_buytaskmx_fileadd_p_buytaskmx" boolean hscrollbar = true boolean vscrollbar = true boolean hsplitscroll = true end type event ue_dwndropdown;//// DONE: 选择文件 //parent.triggerEvent('ue_selectfile') //return 1 // end event event rowfocuschanged;call super::rowfocuschanged;IF currentrow > 0 THEN this.setrow(currentrow) this.SelectRow( 0, FALSE) this.SelectRow( currentrow, TRUE) this.ScrollToRow( currentrow) parent.triggerevent( 'retrieve_file') parent.triggerevent( 'retrieve_file_saletaskmx') END IF end event type r_bar from rectangle within w_buytaskmx_fileadd_p 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_buytaskmx_fileadd_p long linecolor = 268435456 integer linethickness = 4 integer beginy = 172 integer endx = 4425 integer endy = 172 end type type ln_bar2 from line within w_buytaskmx_fileadd_p long linecolor = 16777215 integer linethickness = 4 integer beginy = 176 integer endx = 4498 integer endy = 176 end type