$PBExportHeader$w_mtrldef_ch_hq.srw forward global type w_mtrldef_ch_hq from w_pageretr_ch end type type cbx_mlselect from checkbox within w_mtrldef_ch_hq end type type tv_1 from uo_tv_mtrltype within w_mtrldef_ch_hq end type type ddlb_mtrlprp from uo_ddlb_mtrlorigin within w_mtrldef_ch_hq end type type cbx_all from checkbox within w_mtrldef_ch_hq end type end forward global type w_mtrldef_ch_hq from w_pageretr_ch integer width = 3616 integer height = 2304 string title = "主行情材料选择" event retrieve_mx ( ) cbx_mlselect cbx_mlselect tv_1 tv_1 ddlb_mtrlprp ddlb_mtrlprp cbx_all cbx_all end type global w_mtrldef_ch_hq w_mtrldef_ch_hq type variables s_mtrldef_array INS_RT_STRU Boolean if_changeselect = TRUE Int if_mlselect = 0 String ls_handtype = '' Int cur_mtrlorigin = 0 //当前显示物料来源 Long cur_scid boolean if_select_all=false //datawindow dw_1,dw_2,dw_3 end variables forward prototypes public subroutine wf_resize () public subroutine wf_resize_2 () end prototypes public subroutine wf_resize ();Long w_width,w_height w_width = 3600 w_height = 2300 dw_pageretr.Width = THIS.Width - tv_1.Width - 50 end subroutine public subroutine wf_resize_2 ();Long w_width,w_height w_width = 3600 w_height = 2300 dw_pageretr.height = tv_1.height end subroutine on w_mtrldef_ch_hq.create int iCurrent call super::create this.cbx_mlselect=create cbx_mlselect this.tv_1=create tv_1 this.ddlb_mtrlprp=create ddlb_mtrlprp this.cbx_all=create cbx_all iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.cbx_mlselect this.Control[iCurrent+2]=this.tv_1 this.Control[iCurrent+3]=this.ddlb_mtrlprp this.Control[iCurrent+4]=this.cbx_all end on on w_mtrldef_ch_hq.destroy call super::destroy destroy(this.cbx_mlselect) destroy(this.tv_1) destroy(this.ddlb_mtrlprp) destroy(this.cbx_all) end on event ue_before_open;call super::ue_before_open; if_ue_retr=true if_ue_sort=true end event event close;call super::close;cLOSEWITHRETURN(THIS,INS_RT_STRU) // 窗体级子定义结构变量,用于返回 end event event open;THIS.TriggerEvent('ue_before_open') wf_movetocenter() OLD_TITLE = THIS.Title s_tran = Message.PowerObjectParm IF NOT IsNull(s_tran) THEN retrieve_all = s_tran.if_retrieve_all mode = s_tran.work_mode arg_pkid = s_tran.arg_pkid arg_string_code = s_tran.arg_string_code cur_scid = s_tran.c_long if_select_all = s_tran.if_select_all END IF dw_pageretr.RBUTTON_FILTER_USE = TRUE //右键查询功能开关 dw_pageretr.titleclick_sort_use = TRUE //单击标题排序功能开关 dw_pageretr.SetTransObject (sqlca) pkcolumndbtname = wf_get_pkcolumndbtname(dw_pageretr) //取第一列为关键字 ori_oldselect = dw_pageretr.Describe("DataWindow.Table.Select") ls_newselect = ori_oldselect ds_curquery = CREATE DATASTORE ds_curquery.DataObject = 'd_extr_find' ds_curquery.SetTransObject (sqlca) wf_editindex_lockf() IF s_tran.b_long = 0 THEN ddlb_mtrlprp.Text = "自制产品[0]" cur_mtrlorigin = 0 ELSEIF s_tran.b_long = 2 THEN ddlb_mtrlprp.Text = "采购[2]" cur_mtrlorigin = 2 ELSEIF s_tran.b_long = 3 THEN ddlb_mtrlprp.Text = "外协部件[3]" cur_mtrlorigin = 3 ELSEIF s_tran.b_long = -1 THEN ddlb_mtrlprp.Text = "全部[-1]" cur_mtrlorigin = -1 END IF IF NOT retrieve_all AND Trim(arg_string_code) <> '' THEN sle_usual_query.Text = Trim(arg_string_code) THIS.TriggerEvent("ue_usual_query_RETR") //修改ls_newselect,retrieve ELSE wf_retrieveuc(dw_pageretr,ls_newselect,1) THIS.TriggerEvent('RETRIEVE_pageretr') END IF IF retrieve_all AND Trim(arg_string_code) <> '' THEN THIS.TriggerEvent("ue_usual_query_filt") END IF IF if_select_all THEN cbx_mlselect.Enabled = TRUE ELSE cbx_mlselect.Enabled = FALSE cbx_all.Enabled = FALSE cbx_mlselect.Checked = FALSE if_mlselect = 0 END IF INS_RT_STRU.mtrlid[1] = 0 end event event retrieve_pageretr;Boolean cb_nextpage_enabled,cb_retrieveall_enabled Boolean cb_func_enabled,cb_retrieve_enabled cb_nextpage_enabled = cb_nextpage.Enabled cb_retrieveall_enabled = cb_retrieveall.Enabled cb_func_enabled = cb_func.Enabled cb_nextpage.Enabled = FALSE cb_retrieveall.Enabled = FALSE cb_func.Enabled = FALSE SetPointer(HourGlass!) dw_pageretr.Retrieve(ls_handtype,cur_mtrlorigin) IF dw_pageretr.RowCount() > 0 AND dw_pageretr.GetRow() = 0 THEN dw_pageretr.SetRow(1) SetPointer(Arrow!) cb_nextpage.Enabled = cb_nextpage_enabled cb_retrieveall.Enabled = cb_retrieveall_enabled cb_func.Enabled = cb_func_enabled end event event ue_usual_query_filt;call super::ue_usual_query_filt;string obj_expr='' if trim(sle_usual_query.text)<>'' then IF POS(trim(sle_usual_query.text),'%')=0 THEN obj_expr=obj_expr+'( u_mtrldef_mtrlcode LIKE "%'+trim(sle_usual_query.text)+'%" )' obj_expr=obj_expr+' or (u_mtrldef_mtrlname LIKE "%'+trim(sle_usual_query.text)+'%" )' ELSE obj_expr=obj_expr+'( u_mtrldef_mtrlcode LIKE "'+trim(sle_usual_query.text)+'" )' obj_expr=obj_expr+' or (u_mtrldef_mtrlname LIKE "'+trim(sle_usual_query.text)+'" )' END IF end if dw_pageretr.setfilter(obj_expr) dw_pageretr.SetRedraw(False) dw_pageretr.filter() if dw_pageretr.rowcount()>=1 then dw_pageretr.selectrow(0,false) dw_pageretr.selectrow(1,true ) end if dw_pageretr.SetRedraw(TRUE ) end event event ue_usual_query_retr;call super::ue_usual_query_retr;string ls_querystrpart='' ls_newselect=lower(ori_oldselect) if trim(sle_usual_query.text)<>'' then if pos(trim(sle_usual_query.text),'%')=0 then ls_querystrpart=ls_querystrpart + "( u_mtrldef.mtrlcode like '%"+trim(sle_usual_query.text)+"%'" ls_querystrpart=ls_querystrpart + " or u_mtrldef.mtrlname like '%"+trim(sle_usual_query.text)+"%')" else ls_querystrpart=ls_querystrpart + "( u_mtrldef.mtrlcode like '"+trim(sle_usual_query.text)+"'" ls_querystrpart=ls_querystrpart + " or u_mtrldef.mtrlname like '"+trim(sle_usual_query.text)+"')" end if if Pos(ls_newselect," where ") <> 0 then ls_newselect=ls_newselect+" AND ("+ls_querystrpart+')' else ls_newselect=ls_newselect+" where ("+ls_querystrpart+')' end if end if wf_retrieveuc(dw_pageretr,ls_newselect,1) this.triggerevent('retrieve_pageretr') end event type cb_func from w_pageretr_ch`cb_func within w_mtrldef_ch_hq end type type cb_exit from w_pageretr_ch`cb_exit within w_mtrldef_ch_hq end type type sle_usual_query from w_pageretr_ch`sle_usual_query within w_mtrldef_ch_hq integer x = 887 end type type cb_retrieveall from w_pageretr_ch`cb_retrieveall within w_mtrldef_ch_hq end type type em_pagerowno from w_pageretr_ch`em_pagerowno within w_mtrldef_ch_hq end type type dw_pageretr from w_pageretr_ch`dw_pageretr within w_mtrldef_ch_hq integer x = 997 integer width = 2597 integer height = 1924 string dataobject = "dw_mtrldef_ch_hq" end type event dw_pageretr::clicked;if row>0 then this.setrow(row) if if_mlselect=1 then if if_changeselect then this.selectrow(row,not this.IsSelected(row)) else if_changeselect=true end if else this.selectrow(0,false) this.selectrow(row,true) end if end if end event event dw_pageretr::doubleclicked;cb_choice.TRIGGEREVENT(CLICKED!) end event event dw_pageretr::rowfocuschanged;if if_mlselect=1 then if currentrow <=0 then return if keydown(keycontrol!) then if this.isselected(currentrow) then this.selectrow(currentrow,false) if_changeselect=false else if_changeselect=true end if else if not this.isselected(currentrow) then this.selectrow(currentrow,true) if_changeselect=false else if_changeselect=true end if end if else if currentrow <=0 then return this.selectrow(0,false) this.selectrow(currentrow,true) end if end event event dw_pageretr::dwnkey;call super::dwnkey;if keydown(keyenter!) then return 1 end event type st_1 from w_pageretr_ch`st_1 within w_mtrldef_ch_hq integer x = 539 integer width = 343 string text = "编码/名称含:" end type type cb_nextpage from w_pageretr_ch`cb_nextpage within w_mtrldef_ch_hq string normalpicname = "" end type type cb_choice from w_pageretr_ch`cb_choice within w_mtrldef_ch_hq integer x = 302 integer taborder = 120 end type event cb_choice::clicked;call super::clicked;Long ROW,ls_i = 0,chC = 0 ROW = dw_pageretr.GetRow() IF ROW <= 0 THEN MessageBox('系统提示','请先选择目标行!',StopSign!) RETURN END IF FOR ls_i = 1 TO dw_pageretr.RowCount() IF dw_pageretr.IsSelected(ls_i) THEN chC++ INS_RT_STRU.mtrlid[chC] = dw_pageretr.Object.u_mtrldef_mtrlid[ls_i] INS_RT_STRU.mtrlcode[chC] = dw_pageretr.Object.u_mtrldef_mtrlcode[ls_i] INS_RT_STRU.mtrlname[chC] = dw_pageretr.Object.u_mtrldef_mtrlname[ls_i] INS_RT_STRU.mtrlmode[chC] = dw_pageretr.Object.u_mtrldef_mtrlmode[ls_i] INS_RT_STRU.unit[chC] = dw_pageretr.Object.u_mtrldef_unit[ls_i] INS_RT_STRU.mtrltype[chC] = dw_pageretr.Object.u_mtrldef_mtrltype[ls_i] INS_RT_STRU.planprice[chC] = dw_pageretr.Object.u_mtrldef_planprice[ls_i] INS_RT_STRU.mtrlsectype[chC] = dw_pageretr.Object.u_mtrldef_mtrlsectype[ls_i] INS_RT_STRU.zxmtrlmode[chC] = dw_pageretr.Object.u_mtrldef_zxmtrlmode[ls_i] END IF NEXT IF chC = 0 THEN MessageBox('系统提示','请至少选择一个目标行!',StopSign!) RETURN END IF Close(PARENT) end event type cb_refresh from w_pageretr_ch`cb_refresh within w_mtrldef_ch_hq end type type cb_help from w_pageretr_ch`cb_help within w_mtrldef_ch_hq integer x = 453 end type type ln_bar from w_pageretr_ch`ln_bar within w_mtrldef_ch_hq end type type ln_bar2 from w_pageretr_ch`ln_bar2 within w_mtrldef_ch_hq end type type r_bar from w_pageretr_ch`r_bar within w_mtrldef_ch_hq integer x = 2670 end type type ln_1 from w_pageretr_ch`ln_1 within w_mtrldef_ch_hq end type type ln_2 from w_pageretr_ch`ln_2 within w_mtrldef_ch_hq end type type cbx_mlselect from checkbox within w_mtrldef_ch_hq integer x = 1454 integer y = 196 integer width = 256 integer height = 60 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long backcolor = 134217739 string text = "多选" end type event clicked;IF THIS.Checked THEN if_mlselect = 1 cbx_all.Enabled = TRUE ELSE if_mlselect = 0 cbx_all.Enabled = FALSE cbx_all.Checked = FALSE Long li FOR li = 1 TO dw_pageretr.RowCount() dw_pageretr.SelectRow(li,FALSE) NEXT END IF SetProfileString (sys_inifilename,dw_pageretr.DataObject, "if_mlselect", String(if_mlselect)) end event event constructor;if_mlselect = Integer(ProfileString (sys_inifilename,dw_pageretr.DataObject, "if_mlselect", '0')) IF if_mlselect = 0 THEN THIS.Checked = FALSE cbx_all.Enabled = FALSE ELSE THIS.Checked = TRUE cbx_all.Enabled = TRUE END IF end event type tv_1 from uo_tv_mtrltype within w_mtrldef_ch_hq integer y = 288 integer width = 983 integer height = 1924 integer taborder = 60 boolean bringtotop = true integer textsize = -9 fontcharset fontcharset = gb2312charset! fontfamily fontfamily = anyfont! string facename = "宋体" end type event selectionchanged;call super::selectionchanged;ls_handtype = THIS.uo_cur_info.handtype ls_handtype = ls_handtype + '%' PARENT.TriggerEvent('retrieve_pageretr') end event type ddlb_mtrlprp from uo_ddlb_mtrlorigin within w_mtrldef_ch_hq integer y = 180 integer width = 517 integer height = 480 integer taborder = 20 boolean bringtotop = true end type event selectionchanged;call super::selectionchanged;cur_mtrlorigin = this.uo_mtrlorigin parent.triggerevent('ue_usual_query_retr') end event type cbx_all from checkbox within w_mtrldef_ch_hq integer x = 1673 integer y = 196 integer width = 256 integer height = 60 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long backcolor = 134217739 boolean enabled = false string text = "全选" end type event clicked;IF dw_pageretr.RowCount() <= 0 THEN RETURN Long li IF THIS.Checked THEN FOR li = 1 TO dw_pageretr.RowCount() dw_pageretr.SelectRow(li,TRUE) NEXT ELSE FOR li = 1 TO dw_pageretr.RowCount() dw_pageretr.SelectRow(li,FALSE) NEXT END IF end event