$PBExportHeader$w_fx_check_bill_result.srw
forward
global type w_fx_check_bill_result from w_publ_base
end type
type cb_addware from uo_imflatbutton within w_fx_check_bill_result
end type
type dw_1 from datawindow within w_fx_check_bill_result
end type
type dw_2 from datawindow within w_fx_check_bill_result
end type
end forward

global type w_fx_check_bill_result from w_publ_base
integer width = 2839
integer height = 2344
string title = "录入质检结果"
boolean minbox = false
windowtype windowtype = response!
boolean center = true
event ue_f8 ( )
event ue_f9 ( )
event ue_allowedit ( )
cb_addware cb_addware
dw_1 dw_1
dw_2 dw_2
end type
global w_fx_check_bill_result w_fx_check_bill_result

type variables
Long ins_billid
Long ins_printid

s_check_bill_mx s_mx //传递参数使用  
end variables

forward prototypes
public subroutine wf_init_dw1 ()
end prototypes

event ue_f9();
//long uc_row
//uc_row=dw_1.getrow()
//dw_1.accepttext()
//if not isvalid(W_cust_edit) then 
//	s_edit_index_tran s_ch_tran  //传递参数使用
//	s_ch_tran.if_retrieve_all=false  //是否一次RETRIEVE所有行
//	s_ch_tran.work_mode=1            //0-单纯编辑模式 1-选择\编辑模式
//	s_ch_tran.arg_pkid=0             //目标定位PKID (备用)
//	//查询列(物料编码)部分内容,用于初步筛选
//	s_ch_tran.arg_string_code=upper(trim(dw_1.object.u_cust_cuscode[dw_1.getrow()]))
//
//	OPENwithparm(W_cust_edit,s_ch_tran)  //调用
//
//	s_custom S_INSCUST
//	S_INSCUST=Message.PowerObjectParm  //接受返回结构
//
//	IF S_INSCUST.cusid>0 THEN //正常返回值则可以取以下值
//		dw_1.setredraw(false)
//		dw_1.object.u_warepdb_sptid[uc_row]=S_INSCUST.cusid
//		dw_1.object.u_cust_name[uc_row]=S_INSCUST.name
//		dw_1.object.u_cust_cuscode[uc_row]=S_INSCUST.cuscode
//		dw_1.setredraw(true)
//	
//	END IF
//end if
//end event
//
//event ue_allowedit();Long Columns
//Int i
//String ls_modify_str
//Long ll_row
//Long ll_value
//Long ll_statusflag,ll_woodcodeflag,ll_pcodeflag
//String ls_status,ls_woodcode,ls_pcode
//
//String ls_data_type
//
//ll_row = dw_1.GetRow()
//IF ll_row <= 0 THEN RETURN
//
//Columns = Long(dw_1.Describe("DataWindow.Column.Count"))
//
//FOR i = 1 TO Columns
//	ls_modify_str = dw_1.Describe("#" + String(i) + ".name")
//	ls_modify_str = Lower(ls_modify_str)
//	
//	IF i = 1 THEN //第1个字段,约定物料ID
//		ls_data_type = dw_1.Describe(ls_modify_str+".ColType")
//		IF ls_data_type = "long" THEN
//			ll_value = dw_1.GetItemNumber(ll_row,ls_modify_str)
//		END IF
//	END IF
//	
//	IF Pos(ls_modify_str,'statusflag') > 0  THEN
//		ls_data_type = dw_1.Describe(ls_modify_str+".ColType")
//		IF ls_data_type = "long" THEN
//			ll_statusflag = dw_1.GetItemNumber(ll_row,ls_modify_str)
//		END IF
//	END IF
//	
//	IF Pos(ls_modify_str,'woodcodeflag') > 0  THEN
//		ls_data_type = dw_1.Describe(ls_modify_str+".ColType")
//		IF ls_data_type = "long" THEN
//			ll_woodcodeflag = dw_1.GetItemNumber(ll_row,ls_modify_str)
//		END IF
//	END IF
//	
//	IF Pos(ls_modify_str,'pcodeflag') > 0  THEN
//		ls_data_type = dw_1.Describe(ls_modify_str+".ColType")
//		IF ls_data_type = "long" THEN
//			ll_pcodeflag = dw_1.GetItemNumber(ll_row,ls_modify_str)
//		END IF
//	END IF
//	
//	IF Pos(ls_modify_str,'status') > 0 AND Pos(ls_modify_str,'statusflag') = 0 AND Pos(ls_modify_str,'statustype') = 0  THEN
//		IF Len(ls_modify_str) = Len('status') OR Pos(ls_modify_str,'_status') > 0 THEN
//			IF Not (Pos(ls_modify_str,'u_saletask_status') > 0 OR &
//				Pos(ls_modify_str,'u_buytask_status') > 0 OR &
//				Pos(ls_modify_str,'u_order_ml_status') > 0 OR &
//				Pos(ls_modify_str,'u_order_wfjg_status') > 0 OR &
//				Pos(ls_modify_str,'u_rs_empinfo_status') > 0 ) THEN
//				ls_status = ls_modify_str
//			END IF
//		END IF
//	END IF
//	
//	IF Pos(ls_modify_str,'woodcode') > 0 AND Pos(ls_modify_str,'woodcodeflag') = 0 AND Pos(ls_modify_str,'woodcodetype') = 0  THEN
//		IF Len(ls_modify_str) = Len('woodcode') OR Pos(ls_modify_str,'_woodcode') > 0 THEN
//			ls_woodcode = ls_modify_str
//		END IF
//	END IF
//	
//	IF Pos(ls_modify_str,'pcode') > 0 AND Pos(ls_modify_str,'pcodeflag') = 0 AND Pos(ls_modify_str,'pcodetype') = 0  THEN
//		IF Len(ls_modify_str) = Len('pcode') OR Pos(ls_modify_str,'_pcode') > 0 THEN
//			ls_pcode = ls_modify_str
//		END IF
//	END IF
//	
//NEXT
//
//IF ls_status <> '' THEN
//	IF ll_statusflag <> 0  OR ll_value = 0 THEN
//		dw_1.Modify(ls_status+".dddw.allowedit = no")
//	ELSE
//		dw_1.Modify(ls_status+".dddw.allowedit = yes")
//	END IF
//END IF
//
//IF ls_woodcode <> '' THEN
//	IF ll_woodcodeflag <> 0 OR ll_value = 0  THEN
//		dw_1.Modify(ls_woodcode+".dddw.allowedit = no")
//	ELSE
//		dw_1.Modify(ls_woodcode+".dddw.allowedit = yes")
//	END IF
//END IF
//
//IF ls_pcode <> '' THEN
//	IF ll_pcodeflag <> 0 OR ll_value = 0  THEN
//		dw_1.Modify(ls_pcode+".dddw.allowedit = no")
//	ELSE
//		dw_1.Modify(ls_pcode+".dddw.allowedit = yes")
//	END IF
//END IF




end event

public subroutine wf_init_dw1 ();//
Long ll_row,i
dw_1.Reset()
ll_row = dw_1.InsertRow(0)

dw_1.Object.billid[ll_row] = s_mx.billid
dw_1.Object.printid[ll_row] = s_mx.printid
dw_1.Object.taskcode[ll_row] = s_mx.taskcode
dw_1.Object.reltaskid[ll_row] = s_mx.reltaskid
dw_1.Object.relprintid[ll_row] = s_mx.relprintid
dw_1.Object.forqty[ll_row] = s_mx.forqty
dw_1.Object.passqty[ll_row] = s_mx.passqty
dw_1.Object.checktype[ll_row] = s_mx.checktype
dw_1.Object.checkqty[ll_row] = s_mx.checkqty
dw_1.Object.goodqty[ll_row] = s_mx.goodqty
dw_1.Object.badqty[ll_row] = s_mx.badqty
dw_1.Object.finishflag[ll_row] = s_mx.finishflag
dw_1.Object.checkemp[ll_row] = s_mx.checkemp
dw_1.Object.checkdate[ll_row] = s_mx.checkdate
dw_1.Object.mxdscrp[ll_row] = s_mx.mxdscrp
dw_1.Object.mtrlcode[ll_row] = s_mx.mtrlcode
dw_1.Object.mtrlname[ll_row] = s_mx.mtrlname
dw_1.Object.mtrlmode[ll_row] = s_mx.mtrlmode
dw_1.Object.status[ll_row] = s_mx.status
dw_1.Object.woodcode[ll_row] = s_mx.woodcode
dw_1.Object.pcode[ll_row] = s_mx.pcode


dw_2.Reset()
FOR i = 1 To UpperBound(s_mx.itemmx)
	
	ll_row = dw_2.InsertRow(0)
	
	
	dw_2.Object.fx_check_bill_itemmx_billid[ll_row] =  s_mx.itemmx[i].billid
	dw_2.Object.fx_check_bill_itemmx_printid[ll_row] = 		s_mx.itemmx[i].printid
	dw_2.Object.fx_check_bill_itemmx_mxid[ll_row] = 		s_mx.itemmx[i].mxid
	dw_2.Object.fx_check_bill_itemmx_itemid_erp[ll_row] = 		s_mx.itemmx[i].itemid_erp
	dw_2.Object.fx_check_bill_itemmx_qcresult[ll_row] = 		s_mx.itemmx[i].qcresult
	dw_2.Object.fx_check_bill_itemmx_goodqty[ll_row] = 		s_mx.itemmx[i].goodqty
	dw_2.Object.fx_check_bill_itemmx_badqty[ll_row] = 		s_mx.itemmx[i].badqty
	dw_2.Object.fx_checkitem_itemname[ll_row] = 		s_mx.itemmx[i].itemname
	
	
NEXT






//s_mx


end subroutine

on w_fx_check_bill_result.create
int iCurrent
call super::create
this.cb_addware=create cb_addware
this.dw_1=create dw_1
this.dw_2=create dw_2
iCurrent=UpperBound(this.Control)
this.Control[iCurrent+1]=this.cb_addware
this.Control[iCurrent+2]=this.dw_1
this.Control[iCurrent+3]=this.dw_2
end on

on w_fx_check_bill_result.destroy
call super::destroy
destroy(this.cb_addware)
destroy(this.dw_1)
destroy(this.dw_2)
end on

event open;call super::open;
s_mx = Message.PowerObjectParm

wf_init_dw1()


  

//dw_1.SetTransObject(sqlca)
//dw_2.SetTransObject(sqlca)
//dw_1.retrieve(ins_billid,ins_printid)
//dw_2.retrieve(ins_billid,ins_printid)
end event

type cb_func from w_publ_base`cb_func within w_fx_check_bill_result
boolean visible = false
integer x = 320
integer y = 860
end type

type cb_exit from w_publ_base`cb_exit within w_fx_check_bill_result
integer x = 1495
integer y = 2116
string text = "取消"
end type

type cb_addware from uo_imflatbutton within w_fx_check_bill_result
integer x = 933
integer y = 2116
integer width = 311
integer height = 96
integer taborder = 130
boolean bringtotop = true
end type

event clicked;call super::clicked;Int rslt = 1
Long j
String arg_msg
If (dw_2.RowCount() <= 0) THEN
	rslt = 0
	arg_msg = '没有明细'
	GOTO ext
END IF

Long ll_getrow
ll_getrow = dw_1.GetRow()

//dw_1.Object.goodqty[dw_1.GetRow()]   = Dec(dw_2.Describe("Evaluate('sum_goodqty',0)"))
//dw_1.Object.badqty[dw_1.GetRow()]   = Dec (dw_2.Describe("Evaluate('sum_badqty',0)"))




String ls_dscrp
DateTime ldt_billdate
Date ld_tempdate

dw_1.AcceptText()
dw_2.AcceptText()

oleobject mx , itemList , Item_1 ,filedatas
mx = FXAppCom.CreatePbDictionary()

IF IsNull(dw_1.Object.billid[ll_getrow]) THEN dw_1.Object.billid[ll_getrow] = 0
IF IsNull(dw_1.Object.printid[ll_getrow]) THEN dw_1.Object.printid[ll_getrow] = 0
IF IsNull(dw_1.Object.taskcode[ll_getrow]) THEN dw_1.Object.taskcode[ll_getrow] = ''
IF IsNull(dw_1.Object.reltaskid[ll_getrow]) THEN dw_1.Object.reltaskid[ll_getrow] = 0
IF IsNull(dw_1.Object.relprintid[ll_getrow]) THEN dw_1.Object.relprintid[ll_getrow] = 0
IF IsNull(dw_1.Object.forqty[ll_getrow]) THEN dw_1.Object.forqty[ll_getrow] = 0
IF IsNull(dw_1.Object.passqty[ll_getrow]) THEN dw_1.Object.passqty[ll_getrow] = 0
IF IsNull(dw_1.Object.checktype[ll_getrow]) THEN dw_1.Object.checktype[ll_getrow] = 0
IF IsNull(dw_1.Object.checkqty[ll_getrow]) THEN dw_1.Object.checkqty[ll_getrow] = 0
IF IsNull(dw_1.Object.goodqty[ll_getrow]) THEN dw_1.Object.goodqty[ll_getrow] = 0
IF IsNull(dw_1.Object.badqty[ll_getrow]) THEN dw_1.Object.badqty[ll_getrow] = 0
IF IsNull(dw_1.Object.finishflag[ll_getrow]) THEN dw_1.Object.finishflag[ll_getrow] = 0
IF IsNull(dw_1.Object.checkemp[ll_getrow]) THEN dw_1.Object.checkemp[ll_getrow] = ''
IF IsNull(dw_1.Object.mxdscrp[ll_getrow]) THEN dw_1.Object.mxdscrp[ll_getrow] = ''

//mx.SetString('printid', dw_1.Object.printid[ll_getrow])
//mx.SetString('taskcode', dw_1.Object.taskcode[ll_getrow])
//mx.SetInt('reltaskid', dw_1.Object.reltaskid[ll_getrow])
//mx.SetInt('relprintid', dw_1.Object.relprintid[ll_getrow])
//mx.SetDouble('forqty', dw_1.Object.forqty[ll_getrow])
//mx.SetInt('checktype', dw_1.Object.checktype[ll_getrow])
//mx.SetDouble('checkqty', dw_1.Object.checkqty[ll_getrow])
//mx.SetDouble('passqty', dw_1.Object.passqty[ll_getrow])
//mx.SetDouble('goodqty', dw_1.Object.goodqty[ll_getrow])
//mx.SetDouble('badqty', dw_1.Object.badqty[ll_getrow])
//mx.SetDouble('finishflag', dw_1.Object.finishflag[ll_getrow])
//mx.SetString('checkemp', dw_1.Object.checkemp[ll_getrow])
//mx.SetString('mxdscrp', dw_1.Object.mxdscrp[ll_getrow])


Long billid
Long  printid
Long checktype
Decimal passqty
Decimal checkqty
Decimal goodqty
Decimal badqty
Long finishflag


billid = dw_1.Object.billid[ll_getrow]
printid = dw_1.Object.printid[ll_getrow]
checktype = dw_1.Object.checktype[ll_getrow]
passqty = dw_1.Object.passqty[ll_getrow]
checkqty = dw_1.Object.checkqty[ll_getrow]
goodqty = dw_1.Object.goodqty[ll_getrow]
badqty = dw_1.Object.badqty[ll_getrow]
finishflag = dw_1.Object.finishflag[ll_getrow]



// 传入检查项目
itemList  = FXAppCom.CreArrOfPbDictionary()
filedatas = FXAppCom.CreArrOfPbDictionary()
FOR j = 1 To dw_2.RowCount()
	
	
	IF IsNull(dw_2.Object.fx_check_bill_itemmx_billid[j]) THEN dw_2.Object.fx_check_bill_itemmx_billid[j] = 0
	IF IsNull(dw_2.Object.fx_check_bill_itemmx_printid[j]) THEN dw_2.Object.fx_check_bill_itemmx_printid[j] = 0
	IF IsNull(dw_2.Object.fx_check_bill_itemmx_mxid[j]) THEN dw_2.Object.fx_check_bill_itemmx_mxid[j] = 0
	IF IsNull(dw_2.Object.fx_check_bill_itemmx_itemid_erp[j]) THEN dw_2.Object.fx_check_bill_itemmx_itemid_erp[j] = 0
	IF IsNull(dw_2.Object.fx_check_bill_itemmx_qcresult[j]) THEN dw_2.Object.fx_check_bill_itemmx_qcresult[j] = 0
	IF IsNull(dw_2.Object.fx_check_bill_itemmx_goodqty[j]) THEN dw_2.Object.fx_check_bill_itemmx_goodqty[j] = 0
	IF IsNull(dw_2.Object.fx_check_bill_itemmx_badqty[j]) THEN dw_2.Object.fx_check_bill_itemmx_badqty[j] = 0
	
	Item_1 = FXAppCom.CreatePbDictionary()
	Item_1.SetInt('billid', dw_2.Object.fx_check_bill_itemmx_billid[j])
	Item_1.SetInt('printid', dw_2.Object.fx_check_bill_itemmx_printid[j])
	Item_1.SetInt('mxid', dw_2.Object.fx_check_bill_itemmx_mxid[j])
	Item_1.SetInt('itemid_erp', dw_2.Object.fx_check_bill_itemmx_itemid_erp[j])
	Item_1.SetString('qcresult', dw_2.Object.fx_check_bill_itemmx_qcresult[j])
	Item_1.SetDouble('goodqty', dw_2.Object.fx_check_bill_itemmx_goodqty[j])
	Item_1.SetDouble('badqty', dw_2.Object.fx_check_bill_itemmx_badqty[j])
	
	itemList.Add(Item_1)
	
	
NEXT



oleobject request,response

request = FXAppCom.CreatePbDictionary()
request.SetString('token', app_token_fx)
//request.SetObject('bill', outware)
request.SetObject('billid', billid)
request.SetObject('printid', printid)
request.SetObject('checktype', checktype)
request.SetObject('passqty', passqty)
request.SetObject('checkqty', checkqty)
request.SetObject('goodqty', goodqty)
request.SetObject('badqty', badqty)
request.SetObject('finishflag', finishflag)

request.SetObject('itemList', itemList)
request.SetObject('filedatas', filedatas)


response = FXAppCom.DoExecute('SaveCheckbillItem', request)
arg_msg = response.GetString('ErrMsg')

If (arg_msg <> '') THEN
	rslt = 0
	GOTO ext
END IF

ext:
IF rslt = 0 THEN
	MessageBox('提示',arg_msg)
ELSE
	MessageBox('成功','录入成功')
	Close(Parent)
END IF

RETURN rslt

//
//ld_tempdate = Date(dw_fx_outware_free.Object.billdate[ll_getrow])
//ldt_billdate = DateTime(ld_tempdate, Now())
//
//IF if_modify_mode THEN
//	ll_billid = dw_fx_outware_free.Object.billid[ll_getrow]
//ELSE
//	ll_billid = 0
//END IF
//
//IF IsNull(dw_fx_outware_free.Object.cuscomid[ll_getrow]) Or (dw_fx_outware_free.Object.cuscomid[ll_getrow]) = 0 THEN
//	rslt = 0
//	arg_msg = '请选择客户！'
//	GOTO ext
//END IF
//
//
//
//dw_fx_outware_free.AcceptText()
//dw_fx_outware_mx.AcceptText()
//
//dw_itemmx.SetFilter('')
//dw_itemmx.Filter()
//dw_itemmx.AcceptText()
//
//IF  IsNull(ll_billid) THEN ll_billid = 0
//IF  IsNull( dw_fx_outware_free.Object.billcode[ll_getrow]) THEN  dw_fx_outware_free.Object.billcode[ll_getrow] = ''
//IF IsNull(ls_dscrp) THEN ls_dscrp = ''
//IF IsNull(dw_fx_outware_free.Object.cuscomid[ll_getrow]) THEN dw_fx_outware_free.Object.cuscomid[ll_getrow] = 0
//
//
//dw_fx_outware_free.AcceptText()
//oleobject Item,Item_1, outware, mxs,fx_fileList,fileList,itemList
//fx_fileList = FXAppCom.NewPBArray()
//fileList =  FXAppCom.NewPBArray()
//    //      FXAppCom.NewPBArray()
//
//outware = FXAppCom.CreatePbDictionary()
//outware.SetInt('billid', ll_billid)
//outware.SetInt('billtype', 0) //质量自检单
//outware.SetInt('flag', 0) //
//outware.SetInt('sync_flag', 0) //
//outware.SetString('opemp', '')
//outware.SetString('modemp', '')
//outware.SetString('auditemp', '')
//outware.SetString('erp_affirmemp', '')
//outware.SetString('cancel_emp', '')
//
//
//outware.SetInt('billid', ll_billid)
//outware.SetString('billcode', dw_fx_outware_free.Object.billcode[ll_getrow])
//outware.SetString('dscrp', ls_dscrp)
//outware.SetDateTime('billdate', ldt_billdate)
//outware.SetInt('cuscomid',dw_fx_outware_free.Object.cuscomid[ll_getrow])
//
//mxs = FXAppCom.CreArrOfPbDictionary()
////mxitem = FXAppCom.CreArrOfPbDictionary()
//Long i, cnt = 0
//DateTime ld_now
//ld_now = DateTime(Today(),Now())
//FOR i = 1 To dw_fx_outware_mx.RowCount()
//	
//	IF IsNull(dw_fx_outware_mx.Object.billid[i]) THEN dw_fx_outware_mx.Object.billid[i] = 0
//	IF IsNull(dw_fx_outware_mx.Object.printid[i]) THEN dw_fx_outware_mx.Object.printid[i] = 0
//	IF IsNull(dw_fx_outware_mx.Object.taskcode[i]) THEN dw_fx_outware_mx.Object.taskcode[i] = ''
//	IF IsNull(dw_fx_outware_mx.Object.reltaskid[i]) THEN dw_fx_outware_mx.Object.reltaskid[i] = 0
//	IF IsNull(dw_fx_outware_mx.Object.relprintid[i]) THEN dw_fx_outware_mx.Object.relprintid[i] = 0
//	IF IsNull(dw_fx_outware_mx.Object.forqty[i]) THEN dw_fx_outware_mx.Object.forqty[i] = 0
//	IF IsNull(dw_fx_outware_mx.Object.passqty[i]) THEN dw_fx_outware_mx.Object.passqty[i] = 0
//	IF IsNull(dw_fx_outware_mx.Object.checktype[i]) THEN dw_fx_outware_mx.Object.checktype[i] = 0
//	IF IsNull(dw_fx_outware_mx.Object.checkqty[i]) THEN dw_fx_outware_mx.Object.checkqty[i] = 0
//	IF IsNull(dw_fx_outware_mx.Object.goodqty[i]) THEN dw_fx_outware_mx.Object.goodqty[i] = 0
//	IF IsNull(dw_fx_outware_mx.Object.badqty[i]) THEN dw_fx_outware_mx.Object.badqty[i] = 0
//	IF IsNull(dw_fx_outware_mx.Object.finishflag[i]) THEN dw_fx_outware_mx.Object.finishflag[i] = 0
//	IF IsNull(dw_fx_outware_mx.Object.checkemp[i]) THEN dw_fx_outware_mx.Object.checkemp[i] = ''
//	IF IsNull(dw_fx_outware_mx.Object.mxdscrp[i]) THEN dw_fx_outware_mx.Object.mxdscrp[i] = ''
//	
//	
//	
//	
//	
//	
//	If (dw_fx_outware_mx.Object.checkqty[i] <= 0) THEN CONTINUE
//	
//	If (dw_fx_outware_mx.Object.checkqty[i] > dw_fx_outware_mx.Object.forqty[i]) THEN
//		rslt = 0
//		arg_msg = "行:" + String(dw_fx_outware_mx.Object.compute_2[i]) + "检验数不能大于【代表批量】"
//		GOTO ext
//	END IF
//	
//	cnt ++
//	Item = FXAppCom.CreatePbDictionary()
//	
//	Item.SetInt('printid', cnt)
//	Item.SetString('taskcode', dw_fx_outware_mx.Object.taskcode[i])
//	Item.SetInt('reltaskid', dw_fx_outware_mx.Object.reltaskid[i])
//	Item.SetInt('relprintid', dw_fx_outware_mx.Object.relprintid[i])
//	Item.SetDouble('forqty', dw_fx_outware_mx.Object.forqty[i])
//	Item.SetInt('checktype', dw_fx_outware_mx.Object.checktype[i])
//	Item.SetDouble('checkqty', dw_fx_outware_mx.Object.checkqty[i])
//	
//	Item.SetDouble('passqty', dw_fx_outware_mx.Object.passqty[i])
//	Item.SetDouble('goodqty', dw_fx_outware_mx.Object.goodqty[i])
//	Item.SetDouble('badqty', dw_fx_outware_mx.Object.badqty[i])
//	Item.SetDouble('finishflag', dw_fx_outware_mx.Object.finishflag[i])
//	Item.SetString('checkemp', dw_fx_outware_mx.Object.checkemp[i])
//	Item.SetString('mxdscrp', dw_fx_outware_mx.Object.mxdscrp[i])
//	Item.SetObject('fx_fileList', fx_fileList)
//	Item.SetObject('fileList', fileList)
//	
//	
//	
//	// 传入检查项目
//	itemList  = FXAppCom.CreArrOfPbDictionary()    
//	FOR j = 1 To dw_itemmx.RowCount()
//		
//		IF dw_itemmx.Object.fx_check_bill_itemmx_printid[j] = dw_fx_outware_mx.Object.printid[i] THEN
//			IF IsNull(dw_itemmx.Object.fx_check_bill_itemmx_billid[j]) THEN dw_itemmx.Object.fx_check_bill_itemmx_billid[j] = 0
//			IF IsNull(dw_itemmx.Object.fx_check_bill_itemmx_printid[j]) THEN dw_itemmx.Object.fx_check_bill_itemmx_printid[j] = 0
//			IF IsNull(dw_itemmx.Object.fx_check_bill_itemmx_mxid[j]) THEN dw_itemmx.Object.fx_check_bill_itemmx_mxid[j] = 0
//			IF IsNull(dw_itemmx.Object.fx_check_bill_itemmx_itemid_erp[j]) THEN dw_itemmx.Object.fx_check_bill_itemmx_itemid_erp[j] = 0
//			IF IsNull(dw_itemmx.Object.fx_check_bill_itemmx_qcresult[j]) THEN dw_itemmx.Object.fx_check_bill_itemmx_qcresult[j] = 0
//			IF IsNull(dw_itemmx.Object.fx_check_bill_itemmx_goodqty[j]) THEN dw_itemmx.Object.fx_check_bill_itemmx_goodqty[j] = 0
//			IF IsNull(dw_itemmx.Object.fx_check_bill_itemmx_badqty[j]) THEN dw_itemmx.Object.fx_check_bill_itemmx_badqty[j] = 0
//			
//			Item_1 = FXAppCom.CreatePbDictionary()
//			Item_1.SetInt('billid', dw_itemmx.Object.fx_check_bill_itemmx_billid[j])
//			Item_1.SetInt('printid', dw_itemmx.Object.fx_check_bill_itemmx_printid[j])
//			Item_1.SetInt('mxid', dw_itemmx.Object.fx_check_bill_itemmx_mxid[j])
//			Item_1.SetInt('itemid_erp', dw_itemmx.Object.fx_check_bill_itemmx_itemid_erp[j])
//			Item_1.SetString('qcresult', dw_itemmx.Object.fx_check_bill_itemmx_qcresult[j])
//			Item_1.SetDouble('goodqty', dw_itemmx.Object.fx_check_bill_itemmx_goodqty[j])
//			Item_1.SetDouble('badqty', dw_itemmx.Object.fx_check_bill_itemmx_badqty[j])
//			
//			itemList.Add(Item_1)
//		END IF
//		
//	NEXT
//	
//	
//	
//	Item.SetObject('itemList', itemList)
//	
//	
//	
//	
//	
//	mxs.Add(Item)
//	
//NEXT
//
//If (cnt <= 0) THEN
//	rslt = 0
//	arg_msg = '没有明细'
//	GOTO ext
//END IF
//
//
//
//
//
//
//
//
//
//
//
//
////mxs.Add(fx_fileList)
////mxs.Add('fx_fileList', fx_fileList)
////mxs.SetObject('fx_fileList', fx_fileList)
//
//
//oleobject request,response
//
//request = FXAppCom.CreatePbDictionary()
//request.SetString('token', app_token_fx)
//request.SetObject('bill', outware)
//request.SetObject('mxList', mxs)
//
//
//
//response = FXAppCom.DoExecute('SaveCheckBill', request)
//arg_msg = response.GetString('ErrMsg')
//
//If (arg_msg <> '') THEN
//	rslt = 0
//	GOTO ext
//END IF
//
//ext:
//RETURN rslt
//
//
//
//
//




end event

type dw_1 from datawindow within w_fx_check_bill_result
event key pbm_dwnkey
event ue_dwndropdown pbm_dwndropdown
integer width = 2816
integer height = 928
integer taborder = 10
boolean bringtotop = true
string title = "none"
string dataobject = "dw_fx_check_bill_result"
boolean livescroll = true
borderstyle borderstyle = stylelowered!
end type

event key;//String ls_mtrlcode,ls_mtrlname,ls_unit,ls_mtrlmode,ls_prdpackcode
//String ls_mtrlsectype,ls_zxmtrlmode
//Int li_ifunit,li_ifmtrlcuscode
//Long ls_mtrlid
//Decimal ls_planprice,ls_packqty
//Int li_statusflag,li_woodcodeflag,li_pcodeflag
//Long ll_statustype,ll_woodcodetype,ll_pcodetype
//
//Long child_row
//Long ls_null
//SetNull(ls_null)
//
//If (KeyDown(KeyEnter!) OR KeyDown(KeyTab!)) AND NOT KeyDown(KeyControl!) AND NOT KeyDown(KeyShift!)  THEN
//	IF THIS.GetColumnName() = 'u_mtrldef_mtrlcode' THEN
//		THIS.AcceptText()
//		child_row = THIS.GetRow()
//		
//		ls_mtrlcode = THIS.Object.u_mtrldef_mtrlcode[child_row]
//		
//		SELECT u_mtrldef.mtrlid,
//			u_mtrldef.mtrlname,
//			u_mtrldef.unit,
//			u_mtrldef.planprice,
//			u_mtrldef.mtrlmode,
//			u_mtrldef.prdpackcode,
//			u_mtrldef.packqty,
//			u_mtrldef.statusflag,
//			u_mtrldef.statustype,
//			u_mtrldef.woodcodeflag,
//			u_mtrldef.woodcodetype,
//			u_mtrldef.pcodeflag,
//			u_mtrldef.pcodetype,
//			u_mtrldef.mtrlsectype,
//			u_mtrldef.zxmtrlmode,
//			u_mtrldef.ifunit,
//			u_mtrldef.ifmtrlcuscode
//			INTO	:ls_mtrlid,
//			:ls_mtrlname,
//			:ls_unit,
//			:ls_planprice,
//			:ls_mtrlmode,
//			:ls_prdpackcode,
//			:ls_packqty,
//			:li_statusflag,
//			:ll_statustype,
//			:li_woodcodeflag,
//			:ll_woodcodetype,
//			:li_pcodeflag,
//			:ll_pcodetype,
//			:ls_mtrlsectype,
//			:ls_zxmtrlmode,
//			:li_ifunit,
//			:li_ifmtrlcuscode
//			FROM 	u_mtrldef
//			Where	( u_mtrldef.mtrlcode = :ls_mtrlcode);
//		IF sqlca.SQLCode = 100 THEN
//			PARENT.TriggerEvent('ue_f8')
//			RETURN
//		END IF
//		
//		THIS.Object.u_warepdb_mtrlid[child_row]    = ls_mtrlid
//		THIS.Object.u_mtrldef_mtrlname[child_row]   = ls_mtrlname
//		THIS.Object.u_mtrldef_mtrlmode[child_row]   = ls_mtrlmode
//		THIS.Object.u_mtrldef_unit[child_row]       = ls_unit
//		THIS.Object.u_mtrldef_zxmtrlmode[child_row]   = ls_zxmtrlmode
//		THIS.Object.u_mtrldef_mtrlsectype[child_row]   = ls_mtrlsectype
//		THIS.Object.u_mtrldef_ifunit[child_row]   = li_ifunit
//		THIS.Object.u_mtrldef_statusflag[child_row]  = li_statusflag
//		THIS.Object.u_mtrldef_statustype[child_row]  = ll_statustype
//		THIS.Object.u_mtrldef_woodcodeflag[child_row]  = li_woodcodeflag
//		THIS.Object.u_mtrldef_woodcodetype[child_row]  = ll_woodcodetype
//		THIS.Object.u_mtrldef_pcodeflag[child_row]  = li_pcodeflag
//		THIS.Object.u_mtrldef_pcodetype[child_row]  = ll_pcodetype
//		THIS.Object.u_mtrldef_ifmtrlcuscode[child_row]  = li_ifmtrlcuscode
//		 
//		PARENT.TriggerEvent('ue_allowedit')
//		IF Key = KeyEnter!  THEN
//			keybd_event ( 9, 0, 0 , 0 ) // 按下tab 
//			keybd_event ( 9, 0, 2, 0 ) // 释放tab 	
//			RETURN 1
//		END IF
//	ELSEIF dw_1.GetColumnName ( ) = 'u_cust_cuscode' AND Key = KeyEnter! THEN
//		String ls_code,ls_name,ls_find_code
//		Long ls_cusid
//		Long cnt = 0
//		Boolean if_find = FALSE
//		
//		dw_1.AcceptText()
//		ls_code = Upper(Trim(dw_1.Object.u_cust_cuscode[dw_1.GetRow()]))
//		SELECT   u_cust.cusid,
//			u_cust.name,
//			u_cust.cuscode
//			INTO	:ls_cusid,:ls_name,:ls_code
//			FROM u_cust
//			Where ( cuscode = :ls_code OR Name = :ls_code );
//		IF sqlca.SQLCode <> 0 THEN
//			IF Pos(Trim(ls_code),'%') = 0 THEN
//				ls_find_code = '%'+ Trim(ls_code) + '%'
//			ELSE
//				ls_find_code = Trim(ls_code)
//			END IF
//			
//			SELECT count(*) INTO :cnt
//				FROM u_cust
//				Where ( cuscode Like :ls_find_code OR Name Like :ls_find_code );
//			IF sqlca.SQLCode <> 0 THEN
//				PARENT.TriggerEvent('ue_f9')
//				RETURN 1
//			END IF
//			IF cnt <> 1 THEN
//				PARENT.TriggerEvent('ue_f9')
//				RETURN 1
//			ELSE
//				SELECT u_cust.cusid,
//					u_cust.cuscode,
//					u_cust.name
//					INTO	:ls_cusid,:ls_code,:ls_name
//					FROM u_cust
//					Where ( cuscode Like :ls_find_code OR Name Like :ls_find_code );
//				IF sqlca.SQLCode <> 0 THEN
//					
//					PARENT.TriggerEvent('ue_f9')
//					RETURN 1
//				ELSE
//					if_find = TRUE
//				END IF
//			END IF
//		ELSE
//			if_find = TRUE
//		END IF
//		
//		IF if_find THEN
//			dw_1.SetRedraw(FALSE)
//			dw_1.Object.u_warepdb_sptid[dw_1.GetRow()] = ls_cusid
//			dw_1.Object.u_cust_cuscode[dw_1.GetRow()] = ls_code
//			dw_1.Object.u_cust_name[dw_1.GetRow()] = ls_name
//			dw_1.SetRedraw(TRUE)
//			RETURN 1
//		END IF
//	ELSE
//		IF Key = KeyEnter!  THEN
//			keybd_event ( 9, 0, 0 , 0 ) // 按下tab 
//			keybd_event ( 9, 0, 2, 0 ) // 释放tab 	
//			RETURN 1
//		END IF
//		
//	END IF
//END IF
//
end event

event ue_dwndropdown;//
//String ls_col_pz,ls_col_mtrlid
//String ls_pz_ch
//Long ll_row,ll_mtrlid
//s_pzwin_open arg_s_win
//
//ll_row = THIS.GetRow()
//IF ll_row > 0 THEN
//	ls_col_mtrlid = THIS.Describe("#1.Name")
//	
//	IF NOT Pos(Lower(ls_col_mtrlid),'mtrlid') > 0 THEN RETURN
//	
//	ll_mtrlid = THIS.GetItemNumber(ll_row,ls_col_mtrlid)
//	
//	ls_col_pz = THIS.GetColumnName( )
//	
//	arg_s_win.arg_x = THIS.X + THIS.PointerX() + parent.x
//	arg_s_win.arg_y = THIS.Y + THIS.PointerY() + parent.y
//	
//	arg_s_win.arg_col = ls_col_pz
//	arg_s_win.arg_mtrlid = ll_mtrlid
//	
//	ls_pz_ch = f_mtrl_pz(arg_s_win)
//	
//	IF ls_pz_ch = '' THEN RETURN
//	
//	THIS.SetItem(ll_row,ls_col_pz,ls_pz_ch)
//END IF
//
//
end event

event doubleclicked;//
//CHOOSE CASE  dwo.Name
//	CASE 'u_mtrldef_mtrlcode'
//		PARENT.TriggerEvent('ue_f8')
//	CASE 'u_cust_cuscode'
//		PARENT.TriggerEvent('ue_f9')
//END CHOOSE
//
end event

event constructor;//f_title_change(this)
end event

event buttonclicked;//
//CHOOSE CASE  dwo.Name
//	CASE 'b_mtrl'
//		PARENT.TriggerEvent('ue_f8')
//	CASE 'b_cust'
//		PARENT.TriggerEvent('ue_f9')
//END CHOOSE
//
end event

type dw_2 from datawindow within w_fx_check_bill_result
integer y = 928
integer width = 2816
integer height = 1104
integer taborder = 20
boolean bringtotop = true
string title = "none"
string dataobject = "dw_fx_check_bill_result_mx"
boolean hscrollbar = true
boolean vscrollbar = true
boolean hsplitscroll = true
boolean livescroll = true
borderstyle borderstyle = stylelowered!
end type

event itemchanged;IF  dw_1.GetRow() > 0 THEN
	dw_1.Object.goodqty[dw_1.GetRow()]   = dec(dw_2.Describe("Evaluate('sum_goodqty',0)"))
	dw_1.Object.badqty[dw_1.GetRow()]   =dec (dw_2.Describe("Evaluate('sum_badqty',0)"))
END IF

end event

