$PBExportHeader$w_checkdata.srw
forward
global type w_checkdata from w_publ_easyq
end type
type em_pagesize from editmask within w_checkdata
end type
type cb_toppage from uo_imflatbutton within w_checkdata
end type
type cb_page_ch from uo_imflatbutton within w_checkdata
end type
type mle_1 from multilineedit within w_checkdata
end type
type ddlb_1 from dropdownlistbox within w_checkdata
end type
end forward

global type w_checkdata from w_publ_easyq
string title = "数据检查"
event ue_page_before ( )
event ue_page_next ( )
em_pagesize em_pagesize
cb_toppage cb_toppage
cb_page_ch cb_page_ch
mle_1 mle_1
ddlb_1 ddlb_1
end type
global w_checkdata w_checkdata

type variables
long ins_cur_pageNum = 1 // 用于记录当前页码
long ins_totalPages = 1 // 用于记录总页数
end variables

forward prototypes
public function integer wf_retrieve ()
end prototypes

event ue_page_before();if ins_cur_pageNum > 1 THEN 
	ins_cur_pageNum --
	wf_retrieve()
END IF
end event

event ue_page_next();ins_cur_pageNum ++
wf_retrieve()
end event

public function integer wf_retrieve ();string ls_taskcodes[],temp_taskcode
int rslt = 1
long i, row
string arg_msg
oleobject request,response
request = FXAppCom.CreatePbDictionary()
request.SetString("token",app_token_fx)
request.SetString("begindate",em_1.Text)
request.SetString("enddate",em_2.Text)

string t
t = ddlb_1.text

if t = '显示所有数据' then request.SetInt("config",1)

temp_taskcode = mle_1.text
if temp_taskcode <> '' then
	f_split(temp_taskcode,'~t~n',ls_taskcodes)
	oleobject list 
	list = FXAppCom.NewPBArray()
	for i = 1 to upperbound(ls_taskcodes)
		list.AddString(ls_taskcodes[i])
	next
	request.SetObject('taskcodes_fxsaletask',list)
end if

response = FXAppCom.DoExecute("CheckData", request)
arg_msg = response.GetString("ErrMsg")

if (arg_msg <> '') then
	rslt = 0
	goto ext
end if

dw_1.Reset()
dw_1.SetRedraw(false)
list = response.GetArrOfPBDictionary('checkdataresult')
any requiredate, promisedate, requiredate_erp,outDate
for i = 1 to list.Count
	oleobject item
	item = list.GetItem(i - 1)
	row = dw_1.InsertRow(0)
	
//	dw_1.Object.taskcode[row] = item.GetInt("taskcode")
	dw_1.Object.taskcode[row] = item.GetString("taskcode")
	dw_1.Object.tid[row] = item.GetString("tid")
	dw_1.Object.taskid[row] = item.GetInt("taskid")
	dw_1.Object.printid[row] = item.GetInt("printid")
	dw_1.Object.cuscomid[row] = item.GetInt("cuscomid")
	dw_1.Object.comname[row] = item.GetString("comname")
	
	requiredate = item.GetDateTime("requiredate")
	if (not IsNull(requiredate_erp)) then dw_1.Object.requiredate[row] = requiredate
	
	dw_1.Object.date_confirm_flag[row] = item.GetInt("date_confirm_flag")
	dw_1.Object.stopQty[row] = item.GetDouble("date_confirm_flag")
	
	promisedate = item.GetDateTime("promisedate")
	if (not IsNull(promisedate)) then dw_1.Object.promisedate[row] = promisedate
	
	dw_1.Object.cus_receiveqty[row] = item.GetDouble("cus_receiveqty")
	outDate = item.GetDateTime("outDate")
	if (not IsNull(outDate)) then dw_1.Object.outdate[row] = outDate
	
	dw_1.Object.finishqty[row] = item.GetDouble("finishqty")
	dw_1.Object.custFlagStr_spt[row] = item.GetString("custFlagStr_spt")
	dw_1.Object.sptFlagStr_spt[row] = item.GetString("sptFlagStr_spt")
	dw_1.Object.uqty_erp[row] = item.GetDouble("uqty_erp")
	
	requiredate_erp = item.GetDateTime("requiredate_erp")
	if (not IsNull(requiredate_erp)) then dw_1.Object.requiredate_erp[row] = requiredate_erp
	
	dw_1.Object.finishqty_fx_erp[row] = item.GetDouble("finishqty_fx_erp")
	dw_1.Object.date_confirm_flag_erp[row] = item.GetInt("date_confirm_flag_erp")
	dw_1.Object.stopqty_erp[row] = item.GetDouble("stopqty_erp")
	dw_1.Object.consignedqty_erp[row] = item.GetDouble("consignedqty_erp")
next
dw_1.SetRedraw(true)

if (arg_msg <> '') then
	rslt = 0
	goto ext
end if
ext:
if (rslt = 1) then
	if (dw_1.RowCount() > 0) then
		dw_1.SelectRow(0, false)
		dw_1.SelectRow(1, true)
		dw_1.SetRow(1)
	end if
else
	MessageBox('提示', arg_msg)
end if

return rslt
end function

on w_checkdata.create
int iCurrent
call super::create
this.em_pagesize=create em_pagesize
this.cb_toppage=create cb_toppage
this.cb_page_ch=create cb_page_ch
this.mle_1=create mle_1
this.ddlb_1=create ddlb_1
iCurrent=UpperBound(this.Control)
this.Control[iCurrent+1]=this.em_pagesize
this.Control[iCurrent+2]=this.cb_toppage
this.Control[iCurrent+3]=this.cb_page_ch
this.Control[iCurrent+4]=this.mle_1
this.Control[iCurrent+5]=this.ddlb_1
end on

on w_checkdata.destroy
call super::destroy
destroy(this.em_pagesize)
destroy(this.cb_toppage)
destroy(this.cb_page_ch)
destroy(this.mle_1)
destroy(this.ddlb_1)
end on

event open;call super::open;em_1.Text =  String(Today(),'YYYY-MM')+'-01'
em_2.Text = String(Today(),'YYYY-MM-DD')
end event

type cb_func from w_publ_easyq`cb_func within w_checkdata
boolean visible = false
end type

type cb_exit from w_publ_easyq`cb_exit within w_checkdata
integer x = 151
end type

type cb_2 from w_publ_easyq`cb_2 within w_checkdata
boolean visible = false
end type

type cb_psetup from w_publ_easyq`cb_psetup within w_checkdata
boolean visible = false
end type

type cb_1 from w_publ_easyq`cb_1 within w_checkdata
end type

event cb_1::clicked;call super::clicked;wf_retrieve()
end event

type st_3 from w_publ_easyq`st_3 within w_checkdata
end type

type st_4 from w_publ_easyq`st_4 within w_checkdata
end type

type em_1 from w_publ_easyq`em_1 within w_checkdata
end type

type em_2 from w_publ_easyq`em_2 within w_checkdata
end type

type ddlb_yl from w_publ_easyq`ddlb_yl within w_checkdata
boolean visible = false
borderstyle borderstyle = styleraised!
end type

type cbx_yl from w_publ_easyq`cbx_yl within w_checkdata
boolean visible = false
end type

type dw_1 from w_publ_easyq`dw_1 within w_checkdata
integer y = 536
integer height = 1696
string dataobject = "dw_checkdata"
boolean controlmenu = true
end type

type sle_mtrl from w_publ_easyq`sle_mtrl within w_checkdata
integer x = 2523
integer y = 184
integer width = 896
integer height = 88
end type

type sle_cust from w_publ_easyq`sle_cust within w_checkdata
integer x = 2537
integer y = 300
integer width = 891
end type

type st_mtrl from w_publ_easyq`st_mtrl within w_checkdata
integer x = 2341
integer y = 312
integer width = 187
integer height = 52
string text = "客户:"
end type

type st_cust from w_publ_easyq`st_cust within w_checkdata
boolean visible = true
integer x = 23
integer width = 315
integer height = 56
string text = "采购订单号:"
end type

type cbx_loginretr from w_publ_easyq`cbx_loginretr within w_checkdata
end type

type pb_em1 from w_publ_easyq`pb_em1 within w_checkdata
end type

type pb_em2 from w_publ_easyq`pb_em2 within w_checkdata
end type

type pb_2 from w_publ_easyq`pb_2 within w_checkdata
end type

type cb_help from w_publ_easyq`cb_help within w_checkdata
boolean visible = false
end type

type cb_copyself from w_publ_easyq`cb_copyself within w_checkdata
boolean visible = false
end type

type gb_1 from w_publ_easyq`gb_1 within w_checkdata
end type

type ln_bar from w_publ_easyq`ln_bar within w_checkdata
end type

type ln_bar2 from w_publ_easyq`ln_bar2 within w_checkdata
end type

type r_bar from w_publ_easyq`r_bar within w_checkdata
end type

type ln_1 from w_publ_easyq`ln_1 within w_checkdata
end type

type ln_2 from w_publ_easyq`ln_2 within w_checkdata
end type

type ln_3 from w_publ_easyq`ln_3 within w_checkdata
integer beginx = 5
integer beginy = 508
integer endx = 2021
integer endy = 508
end type

type ln_4 from w_publ_easyq`ln_4 within w_checkdata
integer beginx = 18
integer beginy = 512
integer endx = 2066
integer endy = 512
end type

type em_pagesize from editmask within w_checkdata
integer x = 311
integer y = 44
integer width = 306
integer height = 84
integer taborder = 50
boolean bringtotop = true
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
string text = "10000"
alignment alignment = right!
borderstyle borderstyle = stylelowered!
string mask = "#####0"
boolean spin = true
double increment = 1
string minmax = "1~~"
end type

type cb_toppage from uo_imflatbutton within w_checkdata
integer x = 622
integer width = 151
integer height = 164
integer taborder = 20
boolean bringtotop = true
string text = "首页"
boolean border = false
end type

event clicked;call super::clicked;ins_cur_pageNum = 1
wf_retrieve( )
end event

type cb_page_ch from uo_imflatbutton within w_checkdata
integer x = 773
integer width = 82
integer height = 164
integer taborder = 30
boolean bringtotop = true
string text = "▼"
toolbaralignment pic_align = alignattop!
boolean border = false
end type

event clicked;call super::clicked;m_Dfc_Control_PopupMenu dmPopupMenu
string menustr

menustr="Text=下页~tEvent=ue_page_next"
menustr = menustr + "|" + "Text=上页~tEvent=ue_page_before"
	
if len(trim(menustr))<>0 then
	dmPopupMenu = Create m_Dfc_Control_PopupMenu
	dmPopupMenu.mf_BuildMenu(This, menustr)
	dmPopupMenu.mf_PopMenu()
	Destroy dmPopupMenu
end if
end event

type mle_1 from multilineedit within w_checkdata
integer x = 320
integer y = 320
integer width = 1696
integer height = 164
integer taborder = 140
boolean bringtotop = true
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
borderstyle borderstyle = stylelowered!
end type

type ddlb_1 from dropdownlistbox within w_checkdata
integer x = 873
integer y = 44
integer width = 480
integer height = 300
integer taborder = 60
boolean bringtotop = true
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
string item[] = {"显示不同步数据","显示所有数据"}
borderstyle borderstyle = styleraised!
end type

event selectionchanged;wf_retrieve()
end event

