$PBExportHeader$uo_mtrl_configure_ch.sru forward global type uo_mtrl_configure_ch from userobject end type type cb_6 from uo_imflatbutton within uo_mtrl_configure_ch end type type cb_5 from uo_imflatbutton within uo_mtrl_configure_ch end type type cb_4 from uo_imflatbutton within uo_mtrl_configure_ch end type type sle_1 from singlelineedit within uo_mtrl_configure_ch end type type cb_3 from uo_imflatbutton within uo_mtrl_configure_ch end type type cb_2 from uo_imflatbutton within uo_mtrl_configure_ch end type type cb_1 from uo_imflatbutton within uo_mtrl_configure_ch end type type dw_1 from datawindow within uo_mtrl_configure_ch end type type tv_1 from treeview within uo_mtrl_configure_ch end type end forward global type uo_mtrl_configure_ch from userobject integer width = 1806 integer height = 1164 long backcolor = 134217739 string text = "none" long tabtextcolor = 33554432 long picturemaskcolor = 536870912 cb_6 cb_6 cb_5 cb_5 cb_4 cb_4 sle_1 sle_1 cb_3 cb_3 cb_2 cb_2 cb_1 cb_1 dw_1 dw_1 tv_1 tv_1 end type global uo_mtrl_configure_ch uo_mtrl_configure_ch type variables long ll_mtrlid , ll_cfgid int li_cfgtype , li_sauditflag string ls_cfgname , ls_ename , ls_dscrp string ls_mtrlcode , ls_mtrlname string cfgname[] string ls_cfg_str = '' TreeViewItem tvi_tmp long deep=0 long oki=0 ,li=0 long select_tree=0,ls_ha=0,ls_ha1=0 end variables forward prototypes public function integer wf_maketree () public function integer wf_automtrlcfg_str () end prototypes public function integer wf_maketree ();//==================================================================== // Function: wf_maketree() //-------------------------------------------------------------------- // Description:生成配置树 //-------------------------------------------------------------------- // Arguments:(None) //-------------------------------------------------------------------- // Returns: integer //-------------------------------------------------------------------- // Author: wjc Date: 2006.08.31 //-------------------------------------------------------------------- // Modify History: // //==================================================================== Long hand deep = 1 Long tvi_hdl = 0 Int i String ls_mtrlpz DO UNTIL tv_1.FindItem(RootTreeItem!, 0) = -1 tv_1.DeleteItem(tvi_hdl) LOOP SELECT mtrlcode,mtrlname INTO :ls_mtrlcode,:ls_mtrlname FROM u_mtrldef Where u_mtrldef.mtrlid = :ll_mtrlid; hand = tv_1.InsertItemLast(0,'['+ls_mtrlcode+']'+ls_mtrlname,1) DECLARE cur_tree CURSOR FOR SELECT name FROM u_mtrl_configure WHERE mtrlid = :ll_mtrlid AND type = 1 ANd ifzj = 1; OPEN cur_tree; FETCH cur_tree INTO :ls_mtrlpz; DO WHILE sqlca.SQLCode = 0 tv_1.InsertItemLast(hand, ls_mtrlpz, 1) FETCH cur_tree INTO :ls_mtrlpz; LOOP CLOSE cur_tree; tv_1.ExpandItem(hand) RETURN 0 end function public function integer wf_automtrlcfg_str ();//==================================================================== // Function: wf_automtrlcfg_str() //-------------------------------------------------------------------- // Description:合并配置串 //-------------------------------------------------------------------- // Arguments:(None) //-------------------------------------------------------------------- // Returns: integer //-------------------------------------------------------------------- // Author: wjc Date: 2006.08.31 //-------------------------------------------------------------------- // Modify History: // //==================================================================== Int rslt = 1 Long ll_row , i ll_row = dw_1.RowCount( ) IF ll_row <= 0 THEN rslt = 0 GOTO ext END IF dw_1.AcceptText( ) ls_cfg_str = '' FOR i = 1 TO ll_row - 1 IF dw_1.Object.qty[i] <> 0 THEN // IF dw_1.Object.qty[i] = 1 THEN ls_cfg_str = ls_cfg_str + dw_1.Object.Name[i]+"+" // ELSE // ls_cfg_str = ls_cfg_str + dw_1.Object.Name[i]+'*'+String(dw_1.Object.qty[i],"##")+"+" // END IF END IF NEXT IF dw_1.Object.qty[ll_row] <> 0 THEN // IF dw_1.Object.qty[ll_row] = 1 THEN ls_cfg_str = ls_cfg_str + dw_1.Object.Name[ll_row] // ELSE // ls_cfg_str = ls_cfg_str + dw_1.Object.Name[ll_row]+'*'+String(dw_1.Object.qty[ll_row],"##") // END IF END IF sle_1.Text = ls_cfg_str ext: RETURN rslt end function on uo_mtrl_configure_ch.create this.cb_6=create cb_6 this.cb_5=create cb_5 this.cb_4=create cb_4 this.sle_1=create sle_1 this.cb_3=create cb_3 this.cb_2=create cb_2 this.cb_1=create cb_1 this.dw_1=create dw_1 this.tv_1=create tv_1 this.Control[]={this.cb_6,& this.cb_5,& this.cb_4,& this.sle_1,& this.cb_3,& this.cb_2,& this.cb_1,& this.dw_1,& this.tv_1} end on on uo_mtrl_configure_ch.destroy destroy(this.cb_6) destroy(this.cb_5) destroy(this.cb_4) destroy(this.sle_1) destroy(this.cb_3) destroy(this.cb_2) destroy(this.cb_1) destroy(this.dw_1) destroy(this.tv_1) end on event constructor;ll_mtrlid = Message.DoubleParm dw_1.SetTransObject( sqlca ) wf_maketree() end event type cb_6 from uo_imflatbutton within uo_mtrl_configure_ch integer x = 928 integer y = 1036 integer taborder = 60 string text = "取消" end type event clicked;call super::clicked;CloseWithReturn(w_mtrl_configure_ch,'') end event type cb_5 from uo_imflatbutton within uo_mtrl_configure_ch integer x = 425 integer y = 1032 integer taborder = 60 end type event clicked;call super::clicked;String arg_msg = '' Int i uo_func_mtrlcfg uo_func_mtrl_config uo_func_mtrl_config = CREATE uo_func_mtrlcfg FOR i = 1 TO dw_1.RowCount() IF dw_1.Object.qty[i] <= 0 THEN MessageBox('系统提示','构成数量必须大于0') RETURN END IF NEXT wf_automtrlcfg_str() IF uo_func_mtrl_config.check_mtrlcfg_str(ll_mtrlid,ls_cfg_str,0,arg_msg) = 0 THEN MessageBox("系统提示","检查配置名称失败!>>"+arg_msg) RETURN END IF DESTROY uo_func_mtrl_config CloseWithReturn(w_mtrl_configure_ch,ls_cfg_str) end event type cb_4 from uo_imflatbutton within uo_mtrl_configure_ch integer x = 754 integer y = 268 integer width = 137 integer taborder = 50 string text = ">>" end type event clicked;call super::clicked;String ls_mtrlpz Long ll_row dw_1.Reset( ) DECLARE cur_mtrlcfg CURSOR FOR SELECT name FROM u_mtrl_configure WHERE mtrlid = :ll_mtrlid AND type = 1 AND ifzj = 1; OPEN cur_mtrlcfg; FETCH cur_mtrlcfg INTO :ls_mtrlpz; DO WHILE sqlca.SQLCode = 0 ll_row = dw_1.InsertRow(0) dw_1.Object.Name[ll_row] = ls_mtrlpz dw_1.Object.qty[ll_row] = 1 FETCH cur_mtrlcfg INTO :ls_mtrlpz; LOOP CLOSE cur_mtrlcfg; wf_automtrlcfg_str() end event type sle_1 from singlelineedit within uo_mtrl_configure_ch integer y = 916 integer width = 1783 integer height = 96 integer taborder = 50 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 borderstyle borderstyle = stylelowered! end type type cb_3 from uo_imflatbutton within uo_mtrl_configure_ch integer x = 754 integer y = 684 integer width = 137 integer taborder = 40 string text = "<<" end type event clicked;call super::clicked;dw_1.reset( ) sle_1.text = '' end event type cb_2 from uo_imflatbutton within uo_mtrl_configure_ch integer x = 754 integer y = 476 integer width = 137 integer taborder = 30 string text = "<" end type event clicked;call super::clicked;String ls_name Long ll_row ll_row = dw_1.GetRow( ) IF ll_row <= 0 THEN RETURN ls_name = dw_1.Object.Name[dw_1.GetRow()] dw_1.DeleteRow(dw_1.GetRow()) dw_1.AcceptText( ) wf_automtrlcfg_str() end event type cb_1 from uo_imflatbutton within uo_mtrl_configure_ch integer x = 754 integer y = 60 integer width = 137 integer taborder = 30 string text = ">" end type event clicked;call super::clicked;Long ll_handle , ll_row Treeviewitem ltvi_tmp Int rslt ll_handle = tv_1.FindItem(CurrentTreeItem! , 0) IF ll_handle = 1 THEN RETURN rslt = tv_1.GetItem(ll_handle, ltvi_tmp) IF rslt = 1 THEN ll_row = dw_1.InsertRow(0) dw_1.Object.Name[ll_row] = ltvi_tmp.Label dw_1.Object.qty[ll_row] = 1 END IF dw_1.AcceptText( ) wf_automtrlcfg_str() end event type dw_1 from datawindow within uo_mtrl_configure_ch integer x = 914 integer width = 869 integer height = 896 integer taborder = 20 string dataobject = "dw_mtrl_configure_ch" boolean vscrollbar = true boolean livescroll = true borderstyle borderstyle = stylelowered! end type event clicked;IF row >= 0 THEN THIS.SelectRow(0,FALSE) THIS.SelectRow(row,TRUE) THIS.SetRow(row) THIS.ScrollToRow(row) END IF end event event doubleclicked;cb_2.triggerevent(clicked!) end event event dragdrop;String ls_name Long ll_row IF Source.TypeOf() = TreeView! THEN ls_name = tvi_tmp.Label ll_row = dw_1.InsertRow(0) dw_1.Object.Name[ll_row] = ls_name dw_1.Object.qty[ll_row] = 1 wf_automtrlcfg_str() END IF end event event rowfocuschanged;IF currentrow > 0 THEN THIS.SetRow(currentrow) THIS.ScrollToRow(currentrow) THIS.SelectRow(0,FALSE) THIS.SelectRow(currentrow,TRUE) wf_automtrlcfg_str() END IF end event event itemchanged;if row > 0 then if Dec(data) <= 0 THEN Messagebox('系统提示','构成数量必须大于0') return end if end if end event type tv_1 from treeview within uo_mtrl_configure_ch integer width = 727 integer height = 904 integer taborder = 10 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 borderstyle borderstyle = stylelowered! boolean disabledragdrop = false boolean trackselect = true string picturename[] = {"Custom030!"} long picturemaskcolor = 536870912 long statepicturemaskcolor = 536870912 end type event begindrag;IF Handle = 1 THEN RETURN THIS.Drag(Begin!) THIS.GetItem(Handle,tvi_tmp) end event event doubleclicked;cb_1.TriggerEvent(Clicked!) end event