$PBExportHeader$w_outware_barcode_ch.srw
forward
global type w_outware_barcode_ch from w_publ_choice
end type
type cbx_all from checkbox within w_outware_barcode_ch
end type
end forward

global type w_outware_barcode_ch from w_publ_choice
cbx_all cbx_all
end type
global w_outware_barcode_ch w_outware_barcode_ch

type variables
s_edit_index_tran s_tran
end variables

on w_outware_barcode_ch.create
int iCurrent
call super::create
this.cbx_all=create cbx_all
iCurrent=UpperBound(this.Control)
this.Control[iCurrent+1]=this.cbx_all
end on

on w_outware_barcode_ch.destroy
call super::destroy
destroy(this.cbx_all)
end on

event dw_filter;call super::dw_filter;Int rslt = 1
dw_ch.Reset()

String arg_msg,barcode
barcode = sle_ch.Text
oleobject req, rsp

req = FXAppCom.CreatePbDictionary()
req.SetString('token', app_token_fx)
req.SetString('barcode', barcode)

rsp = FXAppCom.DoExecute('GetFxSaletaskBuyBarcode', req)
arg_msg = rsp.GetString('ErrMsg')

If (arg_msg <> '') Then
	rslt = 0
	MessageBox('提示', '获取条码失败:' + arg_msg)
	Return
End If

oleobject list, Item
list = rsp.GetPBArray('barcodeList')

dw_ch.SetRedraw(False)
Long i, row
For i = 1 To list.Count
	Item = list.GetPBDictionary(i - 1)
	
	row = dw_ch.InsertRow(0)
	
	dw_ch.SetItem(row, 'taskid', Item.GetInt('taskid'))
	dw_ch.SetItem(row, 'printid', Item.GetInt('printid'))
	dw_ch.SetItem(row, 'barcode', Item.GetString('barcode'))
	dw_ch.SetItem(row, 'taskcode', Item.GetString('taskcode'))
	dw_ch.SetItem(row, 'mtrlcode', Item.GetString('mtrlcode'))
	dw_ch.SetItem(row, 'mtrlname', Item.GetString('mtrlname'))
	dw_ch.SetItem(row, 'mtrlmode', Item.GetString('mtrlmode'))
	dw_ch.SetItem(row, 'status', Item.GetString('status'))
	dw_ch.SetItem(row, 'woodcode', Item.GetString('woodcode'))
	dw_ch.SetItem(row, 'pcode', Item.GetString('pcode'))
	dw_ch.SetItem(row, 'qty', Item.GetInt('qty'))
	dw_ch.SetItem(row, 'printnum', Item.GetInt('printnum'))
	dw_ch.SetItem(row, 'packqty', Item.GetDouble('packqty'))
	
	
Next
dw_ch.SetRedraw(True)



end event

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

event open;cb_retrieve.TRIGGEREVENT(CLICKED!)
end event

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

type cb_exit from w_publ_choice`cb_exit within w_outware_barcode_ch
integer x = 306
end type

type sle_ch from w_publ_choice`sle_ch within w_outware_barcode_ch
end type

type dw_ch from w_publ_choice`dw_ch within w_outware_barcode_ch
integer width = 2153
integer height = 1416
string dataobject = "dw_fx_saletask_buy_barcode"
end type

event dw_ch::doubleclicked;return
end event

type st_1 from w_publ_choice`st_1 within w_outware_barcode_ch
string text = "条码号"
end type

type cb_retrieve from w_publ_choice`cb_retrieve within w_outware_barcode_ch
end type

event cb_retrieve::clicked;Int rslt = 1
dw_ch.Reset()

String arg_msg

oleobject req, rsp

req = FXAppCom.CreatePbDictionary()
req.SetString('token', app_token_fx)

rsp = FXAppCom.DoExecute('GetFxSaletaskBuyBarcode', req)
arg_msg = rsp.GetString('ErrMsg')

If (arg_msg <> '') Then
	rslt = 0
	MessageBox('提示', '获取条码失败:' + arg_msg)
	return
End If

oleobject list, Item
list = rsp.GetPBArray('barcodeList')

dw_ch.SetRedraw(False)
Long i, row
For i = 1 To list.Count
	Item = list.GetPBDictionary(i - 1)
	
	row = dw_ch.InsertRow(0)
	
	dw_ch.SetItem(row, 'taskid', Item.GetInt('taskid'))
	dw_ch.SetItem(row, 'printid', Item.GetInt('printid'))
	dw_ch.SetItem(row, 'barcode', Item.GetString('barcode'))
	dw_ch.SetItem(row, 'taskcode', Item.GetString('taskcode'))
	dw_ch.SetItem(row, 'mtrlcode', Item.GetString('mtrlcode'))
	dw_ch.SetItem(row, 'mtrlname', Item.GetString('mtrlname'))
	dw_ch.SetItem(row, 'mtrlmode', Item.GetString('mtrlmode'))
	dw_ch.SetItem(row, 'status', Item.GetString('status'))
	dw_ch.SetItem(row, 'woodcode', Item.GetString('woodcode'))
	dw_ch.SetItem(row, 'pcode', Item.GetString('pcode'))
	dw_ch.SetItem(row, 'qty', Item.GetInt('qty'))
	dw_ch.SetItem(row, 'printnum', Item.GetInt('printnum'))
	dw_ch.SetItem(row, 'packqty', Item.GetDouble('packqty'))
	
	
Next
dw_ch.SetRedraw(True)


end event

type cb_choice from w_publ_choice`cb_choice within w_outware_barcode_ch
integer x = 155
end type

event cb_choice::clicked;call super::clicked;Long ll_row,i,j
ll_row = dw_ch.RowCount()
j = 0
For i = 1 To ll_row
	If dw_ch.Object.ch[i] = 1 Then
		j++
		s_tran.arr_string[j] = dw_ch.Object.barcode[i]
	End If
Next


Close(parent)
end event

type ln_bar from w_publ_choice`ln_bar within w_outware_barcode_ch
end type

type ln_bar2 from w_publ_choice`ln_bar2 within w_outware_barcode_ch
end type

type r_bar from w_publ_choice`r_bar within w_outware_barcode_ch
end type

type ln_1 from w_publ_choice`ln_1 within w_outware_barcode_ch
end type

type ln_2 from w_publ_choice`ln_2 within w_outware_barcode_ch
end type

type cbx_all from checkbox within w_outware_barcode_ch
integer x = 759
integer y = 200
integer width = 261
integer height = 60
boolean bringtotop = true
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
long backcolor = 134217739
string text = "全选"
end type

event clicked;Long ll_i

dw_ch.SetRedraw(FALSE)
FOR ll_i = 1 TO dw_ch.RowCount()
   IF THIS.Checked THEN
      dw_ch.Object.ch[ll_i] = 1
   ELSE
      dw_ch.Object.ch[ll_i] = 0
   END IF
NEXT
dw_ch.SetRedraw(TRUE)

end event

