$PBExportHeader$w_pz_ch_configcode_fx.srw
$PBExportComments$协同系统 fx_configure_codemx 部件选配 配置选择
forward
global type w_pz_ch_configcode_fx from w_publ_choice
end type
end forward

global type w_pz_ch_configcode_fx from w_publ_choice
integer width = 2409
string title = "部件选配-配置选择"
long backcolor = 16777215
string icon = "graphics\chain_link_128px.ico"
end type
global w_pz_ch_configcode_fx w_pz_ch_configcode_fx

type variables
s_fx_pzwin_open ins_s

string ins_ret
end variables

on w_pz_ch_configcode_fx.create
call super::create
end on

on w_pz_ch_configcode_fx.destroy
call super::destroy
end on

event open;ins_s = Message.PowerObjectParm

if IsNull(ins_s) then
	MessageBox('提示', '打开方式有误(structure)')
	Close(this)
	return
end if

if IsNull(ins_s.arg_ds) or IsNull(ins_s.arg_dsmx) then
	MessageBox('提示', '打开方式有误(datastore)')
	Close(this)
	return
end if

if (ins_s.arg_ds.DataObject <> 'ds_fx_configure_code') &
		or (ins_s.arg_dsmx.DataObject <> 'ds_fx_configure_codemx') then
	MessageBox('提示', '打开方式有误(dataobject)')
	Close(this)
	return
end if

long typeid
if (Pos(ins_s.arg_colname, 'status') > 0) then
//	this.Title = '配置选择'
	typeid = ins_s.arg_statustype
elseif (Pos(ins_s.arg_colname, 'woodcode') > 0) then
//	this.Title = '配置1选择'
	typeid = ins_s.arg_woodcodetype
elseif (Pos(ins_s.arg_colname, 'pcode') > 0) then
//	this.Title = '配置2选择'
	typeid = ins_s.arg_pcodetype
end if

environment exerun_env 
GetEnvironment(exerun_env)
this.X = ins_s.arg_x + 100
this.Y = ins_s.arg_y
if THIS.X + this.width > PixelsToUnits(exerun_env.screenwidth, XPixelsToUnits!) - 100 then 
	THIS.X = PixelsToUnits(exerun_env.screenwidth, XPixelsToUnits!) - this.width - 100
end if
if THIS.Y + this.height > PixelsToUnits(exerun_env.screenheight, XPixelsToUnits!) - 350 then 
	THIS.Y = PixelsToUnits(exerun_env.screenheight, XPixelsToUnits!) - this.height - 350
end if

dw_ch.SetRedraw(false)
dw_ch.DataObject = ins_s.arg_ds.DataObject
dw_ch.Object.Data = ins_s.arg_ds.Object.Data

dw_ch.SetFilter('typeid_erp = ' + string(typeid))
dw_ch.Filter()
	
dw_ch.SetRedraw(true)

ins_ret = ''


end event

event close;call super::close;CloseWithReturn(this, ins_ret)
end event

type cb_func from w_publ_choice`cb_func within w_pz_ch_configcode_fx
boolean visible = false
end type

type cb_exit from w_publ_choice`cb_exit within w_pz_ch_configcode_fx
integer x = 151
end type

type sle_ch from w_publ_choice`sle_ch within w_pz_ch_configcode_fx
boolean visible = false
end type

type dw_ch from w_publ_choice`dw_ch within w_pz_ch_configcode_fx
event ue_dwndropdown pbm_dwndropdown
integer y = 172
integer width = 2418
integer height = 1564
string dataobject = "ds_fx_configure_code"
boolean rbutton_setposition_use = true
boolean titleclick_sort_use = true
end type

event dw_ch::ue_dwndropdown;//
long row
row = this.GetRow()
if IsNull(row) then return
if (row <= 0) then return

long pzid
pzid = this.Object.pzid_erp[row]
if IsNull(pzid) then return
if (pzid <= 0) then return

ins_s.arg_dsmx.SetFilter('pzid_erp = ' + string(pzid))
ins_s.arg_dsmx.Filter()

s_fx_pzwin_open temp_s
temp_s = ins_s
temp_s.arg_ds = ins_s.arg_dsmx
temp_s.arg_x = parent.X + this.X + this.Pointerx()
temp_s.arg_y = parent.Y + this.Y + this.Pointery()
OpenWithParm(w_pz_ch_fx, temp_s)
string ret
ret = Message.StringParm
this.SetItem(row, 'namemx', ret)

ins_s.arg_dsmx.SetFilter('')
ins_s.arg_dsmx.Filter()
end event

event dw_ch::clicked;if (row > 0) then
	this.SelectRow(0, false)
	this.SelectRow(row, true)
end if
end event

type st_1 from w_publ_choice`st_1 within w_pz_ch_configcode_fx
boolean visible = false
end type

type cb_retrieve from w_publ_choice`cb_retrieve within w_pz_ch_configcode_fx
boolean visible = false
end type

type cb_choice from w_publ_choice`cb_choice within w_pz_ch_configcode_fx
integer x = 0
end type

event cb_choice::clicked;call super::clicked;dw_ch.AcceptText()

long i
string temp
for i = 1 to dw_ch.RowCount()
	temp = Trim(dw_ch.Object.namemx[i])
	
	if (temp <> '') then
		ins_ret += Trim(dw_ch.Object.name[i]) + ':' + temp + '|'
	end if
next

Close(parent)
end event

type ln_bar from w_publ_choice`ln_bar within w_pz_ch_configcode_fx
end type

type ln_bar2 from w_publ_choice`ln_bar2 within w_pz_ch_configcode_fx
end type

type r_bar from w_publ_choice`r_bar within w_pz_ch_configcode_fx
end type

type ln_1 from w_publ_choice`ln_1 within w_pz_ch_configcode_fx
boolean visible = false
end type

type ln_2 from w_publ_choice`ln_2 within w_pz_ch_configcode_fx
boolean visible = false
end type

