$PBExportHeader$w_outware_to_inwarebuy_edit.srw forward global type w_outware_to_inwarebuy_edit from w_publ_base end type type cb_save from uo_imflatbutton within w_outware_to_inwarebuy_edit end type type dw_uc from datawindow within w_outware_to_inwarebuy_edit end type type cb_fhmx from commandbutton within w_outware_to_inwarebuy_edit end type type cb_fymx from commandbutton within w_outware_to_inwarebuy_edit end type type dw_fymx from datawindow within w_outware_to_inwarebuy_edit end type type ln_bar from line within w_outware_to_inwarebuy_edit end type type ln_bar2 from line within w_outware_to_inwarebuy_edit end type type r_bar from rectangle within w_outware_to_inwarebuy_edit end type type dw_child from datawindow within w_outware_to_inwarebuy_edit end type type st_item_msg from statictext within w_outware_to_inwarebuy_edit end type end forward global type w_outware_to_inwarebuy_edit from w_publ_base integer width = 3611 integer height = 2380 string title = "收货单信息匹配" boolean minbox = false windowtype windowtype = response! cb_save cb_save dw_uc dw_uc cb_fhmx cb_fhmx cb_fymx cb_fymx dw_fymx dw_fymx ln_bar ln_bar ln_bar2 ln_bar2 r_bar r_bar dw_child dw_child st_item_msg st_item_msg end type global w_outware_to_inwarebuy_edit w_outware_to_inwarebuy_edit type variables Transaction tr_eb_sqlca s_packet_ljfieb s_inscust string ins_sn long ins_cusid,ins_scid,ins_billtype string ins_inwarecode long ins_sendcuscommid string ins_sendsccode uo_inware_buy uo_ware long ins_storageid end variables forward prototypes public subroutine wf_face_child (long arg_storageid) end prototypes public subroutine wf_face_child (long arg_storageid);Int iflocation //iflocation = f_find_iflocation(arg_storageid) // //IF iflocation = 0 THEN dw_child.SetTabOrder('location',0) //ELSE // dw_child.SetTabOrder('location',30) // // IF iflocation = 1 THEN // dw_child.Modify("location.dddw.allowedit = yes") // ELSE // dw_child.Modify("location.dddw.allowedit = no") // END IF //END IF ins_storageid = arg_storageid end subroutine on w_outware_to_inwarebuy_edit.create int iCurrent call super::create this.cb_save=create cb_save this.dw_uc=create dw_uc this.cb_fhmx=create cb_fhmx this.cb_fymx=create cb_fymx this.dw_fymx=create dw_fymx this.ln_bar=create ln_bar this.ln_bar2=create ln_bar2 this.r_bar=create r_bar this.dw_child=create dw_child this.st_item_msg=create st_item_msg iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.cb_save this.Control[iCurrent+2]=this.dw_uc this.Control[iCurrent+3]=this.cb_fhmx this.Control[iCurrent+4]=this.cb_fymx this.Control[iCurrent+5]=this.dw_fymx this.Control[iCurrent+6]=this.ln_bar this.Control[iCurrent+7]=this.ln_bar2 this.Control[iCurrent+8]=this.r_bar this.Control[iCurrent+9]=this.dw_child this.Control[iCurrent+10]=this.st_item_msg end on on w_outware_to_inwarebuy_edit.destroy call super::destroy destroy(this.cb_save) destroy(this.dw_uc) destroy(this.cb_fhmx) destroy(this.cb_fymx) destroy(this.dw_fymx) destroy(this.ln_bar) destroy(this.ln_bar2) destroy(this.r_bar) destroy(this.dw_child) destroy(this.st_item_msg) end on event open;call super::open;tr_eb_sqlca = sys_email_sqlca // 电子商务连接 If sys_email_sqlca.DBHandle() = 0 Then MessageBox('Error','电子商务数据库连接失败,请检查') Return End If uo_ware = Create uo_inware_buy uo_ware.commit_transaction = sqlca s_inscust = Message.PowerObjectParm ins_sn = s_inscust.serialnum ins_scid = s_inscust.scid ins_sendcuscommid = s_inscust.sendcuscommid ins_sendsccode = s_inscust.sendsccode dw_uc.SetTransObject(tr_eb_sqlca) dw_child.SetTransObject(tr_eb_sqlca) dw_fymx.SetTransObject(tr_eb_sqlca) datawindowchild child_storage dw_uc.GetChild("storageid",child_storage) child_storage.SetTransObject (sqlca) If child_storage.Retrieve(ins_scid,sys_user_storageid) = 0 Then child_storage.InsertRow(0) End If datawindowchild childdwmx dw_uc.GetChild("banktypeid",childdwmx) childdwmx.SetTransObject (sqlca) If childdwmx.Retrieve() = 0 Then childdwmx.InsertRow(0) End If datawindowchild childdwmx_2 dw_uc.GetChild("moneyid",childdwmx_2) childdwmx_2.SetTransObject (sqlca) If childdwmx_2.Retrieve() = 0 Then childdwmx_2.InsertRow(0) End If datawindowchild childdwmx_rep dw_uc.GetChild("inrep",childdwmx_rep) childdwmx_rep.SetTransObject (sqlca) If childdwmx_rep.Retrieve() = 0 Then childdwmx_rep.InsertRow(0) End If dw_uc.Retrieve(ins_sn) dw_child.Retrieve(ins_sn) dw_fymx.Retrieve(ins_sn) //自动匹配信息 Long ll_ucrow,ll_i String ls_moneyname,ls_banktypename Long ll_moneyid,ll_banktypeid String ls_sptmtrlcode String ls_mtrlcode_my,ls_mtrlname_my,ls_mtrlmode_my Long ll_mtrlid,ll_sptid String ls_cuscode,ls_sptcode,ls_sptname,ls_unit_my String ls_fiebrelcode,ls_status,ls_woodcode,ls_pcode Long ll_relid,ll_relprintid ll_ucrow = dw_uc.GetRow() dw_uc.AcceptText() dw_child.AcceptText() dw_uc.SetRedraw(False) dw_child.SetRedraw(False) dw_fymx.SetRedraw(False) If ll_ucrow > 0 Then dw_uc.Object.inrep[ll_ucrow] = publ_operator dw_uc.Object.indate[ll_ucrow] = DateTime(Today(),Now()) Select CusCode Into :ls_cuscode From LJFIEB_CusComm Where CusCommID = :ins_sendcuscommid Using tr_eb_sqlca; If tr_eb_sqlca.SQLCode <> 0 Then ls_cuscode = '' End If If Trim(ls_cuscode) <> '' Then Select sptid, sptcode, name Into :ll_sptid,:ls_sptcode,:ls_sptname From u_spt Where commcode = :ls_cuscode And commsccode = :ins_sendsccode Using sqlca; If sqlca.SQLCode <> 0 Then ll_sptid = 0 ls_sptcode = '' ls_sptname = '' End If dw_uc.Object.sptid[ll_ucrow] = ll_sptid dw_uc.Object.CusCode[ll_ucrow] = ls_sptcode dw_uc.Object.cusname[ll_ucrow] = ls_sptname End If ls_moneyname = dw_uc.Object.moneyname[ll_ucrow] Select moneyid Into :ll_moneyid From cw_currency Where Name = :ls_moneyname Using sqlca; If sqlca.SQLCode = 0 Then dw_uc.Object.moneyid[ll_ucrow] = ll_moneyid End If ls_banktypename = dw_uc.Object.banktypename[ll_ucrow] Select banktypeid Into :ll_banktypeid From cw_banktype Where inuse = 1 And banktype = 1 And banktypename = :ls_banktypename Using sqlca; If sqlca.SQLCode = 0 Then dw_uc.Object.banktypeid[ll_ucrow] = ll_banktypeid End If End If For ll_i = 1 To dw_child.RowCount() ls_sptmtrlcode = dw_child.Object.sptmtrlcode[ll_i] ls_fiebrelcode = dw_child.Object.fiebrelcode[ll_i] ls_status = dw_child.Object.status[ll_i] ls_woodcode = dw_child.Object.woodcode[ll_i] ls_pcode = dw_child.Object.pcode[ll_i] Select u_sptmtrlname.mtrlid, u_mtrldef.mtrlcode, u_mtrldef.mtrlname, u_mtrldef.mtrlmode, u_mtrldef.unit Into :ll_mtrlid, :ls_mtrlcode_my, :ls_mtrlname_my, :ls_mtrlmode_my, :ls_unit_my From u_sptmtrlname Inner JOIN u_mtrldef ON u_sptmtrlname.mtrlid = u_mtrldef.mtrlid Where u_sptmtrlname.sptid = :ll_sptid And u_sptmtrlname.sptmtrlcode = :ls_sptmtrlcode Using sqlca; If sqlca.SQLCode <> 0 Then ll_mtrlid = 0 ls_mtrlcode_my = '' ls_mtrlname_my = '' ls_mtrlmode_my = '' ls_unit_my = '' End If dw_child.Object.mtrlcode_my[ll_i] = ls_mtrlcode_my dw_child.Object.mtrlname_my[ll_i] = ls_mtrlname_my dw_child.Object.mtrlmode_my[ll_i] = ls_mtrlmode_my dw_child.Object.mtrlid_my[ll_i] = ll_mtrlid If ls_unit_my <> '' Then dw_child.Object.unit[ll_i] = ls_unit_my End If ll_relid = 0 ll_relprintid = 0 If ls_fiebrelcode <> '' And ll_mtrlid > 0 Then Select top 1 u_buyTaskMx.TaskID, u_buyTaskMx.printid Into :ll_relid,:ll_relprintid From u_buyTask Inner JOIN u_buyTaskMx ON u_buyTask.scid = u_buyTaskMx.scid And u_buyTask.TaskID = u_buyTaskMx.TaskID Where u_buyTask.taskcode = :ls_fiebrelcode And u_buyTaskMx.mtrlid = :ll_mtrlid And u_buyTaskMx.status = :ls_status And u_buyTaskMx.woodcode = :ls_woodcode And u_buyTaskMx.pcode = :ls_pcode; If sqlca.SQLCode <> 0 Then ll_relid = 0 ll_relprintid = 0 End If End If If ll_relid > 0 Then dw_child.Object.ifrel[ll_i] = 1 dw_child.Object.relid[ll_i] = ll_relid dw_child.Object.relprintid[ll_i] = ll_relprintid End If Next String ls_itemname,ls_itemcode Long ll_itemid For ll_i = 1 To dw_fymx.RowCount() ls_itemname = dw_fymx.Object.itemname[ll_i] Select u_itemdef.itemid, u_itemdef.itemcode Into :ll_itemid, :ls_itemcode From u_itemdef Where u_itemdef.itemname = :ls_itemname Using sqlca; If sqlca.SQLCode = 0 Then dw_fymx.Object.itemid[ll_i] = ll_itemid dw_fymx.Object.itemcode_self[ll_i] = ls_itemcode dw_fymx.Object.itemname_self[ll_i] = ls_itemname End If Next dw_uc.SetRedraw(True) dw_child.SetRedraw(True) dw_fymx.SetRedraw(True) end event event close;call super::close;closewithreturn(this,ins_inwarecode) end event event resize;call super::resize;ln_bar.endx = this.width ln_bar2.endx = this.width r_bar.width = this.width dw_fymx.x = dw_child.x dw_fymx.y = dw_child.y dw_fymx.height = dw_child.height dw_fymx.width = dw_child.width end event type cb_func from w_publ_base`cb_func within w_outware_to_inwarebuy_edit boolean visible = false end type type cb_exit from w_publ_base`cb_exit within w_outware_to_inwarebuy_edit integer x = 302 integer width = 187 integer height = 164 integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type type cb_save from uo_imflatbutton within w_outware_to_inwarebuy_edit integer height = 164 integer taborder = 30 boolean bringtotop = true string text = "生成单据" string normalpicname = "save.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;Long uc_row,i String arg_msg String ls_reissuecode uc_row = dw_uc.GetRow() If uc_row <= 0 Then MessageBox('系统提示','没有可保存的内容') Return End If dw_uc.AcceptText() dw_child.AcceptText() If dw_uc.Object.storageid[uc_row] = 0 Then MessageBox('系统提示','请选择仓库') dw_uc.SetFocus() dw_uc.SetColumn("storageid") Return End If If dw_uc.Object.banktypeid[uc_row] = 0 Then MessageBox('系统提示','请选择结算方式') dw_uc.SetFocus() dw_uc.SetColumn("banktypeid") Return End If If dw_uc.Object.moneyid[uc_row] = 0 Then MessageBox('系统提示','请选择币种') dw_uc.SetFocus() dw_uc.SetColumn("moneyid") Return End If If Trim(dw_uc.Object.inrep[uc_row]) = ''Then MessageBox('系统提示','请填写经手人') dw_uc.SetFocus() dw_uc.SetColumn("inrep") Return End If If uo_ware.newbegin(ins_scid,1,arg_msg) = 0 Then MessageBox('Error!',arg_msg) Return End If uo_ware.indate = dw_uc.Object.indate[uc_row] // 发生时间 uo_ware.inrep = dw_uc.Object.inrep[uc_row] // 经手人 uo_ware.part = '' uo_ware.dscrp = '' uo_ware.storageid = dw_uc.Object.storageid[uc_row] uo_ware.sptid = dw_uc.Object.sptid[uc_row] uo_ware.otheramt = 0 uo_ware.relint_1 = dw_uc.Object.banktypeid[uc_row] uo_ware.relid = 0 uo_ware.thflag = 0 uo_ware.relint_3 = dw_uc.Object.moneyid[uc_row] uo_ware.mrate = f_get_mrate(dw_uc.Object.moneyid[uc_row]) For i = 1 To dw_child.RowCount() If dw_child.Object.mtrlid_my[i] > 0 Then If uo_ware.acceptmx(i,& dw_child.Object.mtrlid_my[i],& dw_child.Object.mtrlcode_my[i],& dw_child.Object.plancode[i],& dw_child.Object.status[i],& dw_child.Object.qty[i],& 0,& dw_child.Object.enprice[i],& dw_child.Object.rebate[i],& dw_child.Object.mxdscrp_inware[i],& arg_msg,0,& dw_child.Object.relid[i],& dw_child.Object.relprintid[i],& dw_child.Object.ifrel[i],& dw_child.Object.woodcode[i],& dw_child.Object.pcode[i],& '',& 0,& dw_child.Object.unit[i],& 1,& '','',& datetime(today()),0) = 0 Then MessageBox('error!',arg_msg) Return End If End If Next //For i = 1 To dw_fymx.RowCount() // If dw_fymx.Object.itemid[i] = 0 Then // MessageBox('系统提示','第'+String(i)+'行明细,请先选择本厂项目') // Return // End If // // If dw_fymx.Object.itemid[i] > 0 And dw_fymx.Object.amt[i] <> 0 Then // If uo_ware.acceptmx_item(i,& // dw_fymx.Object.itemid[i],& // dw_fymx.Object.amt[i],& // dw_fymx.Object.mxdscrp[i],& // arg_msg) = 0 Then // MessageBox('error!','费用明细,第'+String(i)+'行,'+arg_msg) // Return // End If // End If //Next If uo_ware.Save(True,arg_msg) = 0 Then MessageBox('Error!',arg_msg) Return End If ins_inwarecode = uo_ware.inwarecode Update LJFIEB_tempoutware Set relreissuecode = :ins_inwarecode, flag = 1, ConfirmTime = getdate(), ConfirmUser = :publ_operator Where SerialNum = :ins_sn Using tr_eb_sqlca; If tr_eb_sqlca.SQLCode <> 0 Then Rollback Using tr_eb_sqlca; MessageBox('Error','更新相关单号失败,'+tr_eb_sqlca.SQLErrText) Return End If //更新本地通信记录 Update LJFIEB_packet Set status = 6, Complete = 1, ConfirmTime = getdate(), ConfirmUser = :publ_operator Where SerialNum = :ins_sn Using tr_eb_sqlca; If tr_eb_sqlca.SQLCode <> 0 Then Rollback Using tr_eb_sqlca; MessageBox('Error','更新本地通信记录失败,'+tr_eb_sqlca.SQLErrText) Return End If Close(Parent) end event type dw_uc from datawindow within w_outware_to_inwarebuy_edit integer y = 188 integer width = 3579 integer height = 500 integer taborder = 20 boolean bringtotop = true string title = "none" string dataobject = "dw_outware_to_inwarebuy_edit" boolean livescroll = true borderstyle borderstyle = stylelowered! end type event itemchanged;long ll_storageid,ll_i IF dwo.Name = 'storageid' THEN dw_uc.AcceptText() ll_storageid = dw_uc.Object.storageid[row] wf_face_child(ll_storageid) dw_child.SetRedraw(False) FOR ll_i = 1 To dw_child.RowCount() dw_child.Object.location[ll_i] = '' NEXT dw_child.SetRedraw(True) end if end event type cb_fhmx from commandbutton within w_outware_to_inwarebuy_edit integer x = 32 integer y = 704 integer width = 311 integer height = 84 integer taborder = 30 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" boolean underline = true string text = "收货明细" end type event clicked;cb_fhmx.TextSize = 13 cb_fhmx.Underline = TRUE cb_fymx.TextSize = 12 cb_fymx.Underline = FALSE dw_child.BringToTop = TRUE st_item_msg.visible = false end event type cb_fymx from commandbutton within w_outware_to_inwarebuy_edit integer x = 352 integer y = 704 integer width = 311 integer height = 84 integer taborder = 40 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "费用明细" end type event clicked;cb_fhmx.TextSize = 12 cb_fhmx.Underline = false cb_fymx.TextSize = 13 cb_fymx.Underline = true dw_fymx.BringToTop = TRUE st_item_msg.visible = true end event type dw_fymx from datawindow within w_outware_to_inwarebuy_edit integer y = 800 integer width = 2231 integer height = 400 integer taborder = 50 boolean bringtotop = true string title = "none" string dataobject = "dw_outware_to_inware_itemmx_ljfieb" boolean livescroll = true borderstyle borderstyle = stylelowered! end type event clicked; IF row <= 0 THEN RETURN THIS.SelectRow(0,FALSE) THIS.SelectRow(row,TRUE) this.setrow(row) end event event rowfocuschanged; IF currentrow <= 0 THEN RETURN THIS.SelectRow(0,FALSE) THIS.SelectRow(currentrow,TRUE) this.setrow(currentrow) end event event doubleclicked;If dw_uc.GetRow() <= 0 Then MessageBox('系统提示','请先选择单据') Return End If Long child_row Long ls_cusid,ll_moneyid Decimal ld_mrate Long ls_j child_row = dw_fymx.GetRow() If child_row <= 0 Then Return End If If Not IsValid(w_itemdef) Then This.Enabled = False s_edit_index_tran s_tran_item s_tran_item.work_mode = 1 s_tran_item.if_select_all = False s_tran_item.if_retrieve_all = False OpenWithParm(w_itemdef,s_tran_item) //调用 This.Enabled = True s_itemdef INS_RT_STRU INS_RT_STRU = Message.PowerObjectParm //接受返回结构 If INS_RT_STRU.itemid > 0 Then dw_fymx.Object.itemid[child_row] = INS_RT_STRU.itemid dw_fymx.Object.itemcode_self[child_row] = INS_RT_STRU.itemcode dw_fymx.Object.itemname_self[child_row] = INS_RT_STRU.itemname End If dw_fymx.SetFocus() End If end event type ln_bar from line within w_outware_to_inwarebuy_edit long linecolor = 268435456 integer linethickness = 4 integer beginy = 172 integer endx = 3200 integer endy = 172 end type type ln_bar2 from line within w_outware_to_inwarebuy_edit long linecolor = 16777215 integer linethickness = 4 integer beginx = 9 integer beginy = 176 integer endx = 3273 integer endy = 176 end type type r_bar from rectangle within w_outware_to_inwarebuy_edit long linecolor = 16777215 integer linethickness = 4 long fillcolor = 1073741824 integer x = 3351 integer width = 87 integer height = 68 end type event constructor;this.fillcolor = 14215660 this.linecolor = 14215660 this.x = -1 this.y = -1 this.height = ln_bar.beginy - 5 end event type dw_child from datawindow within w_outware_to_inwarebuy_edit event ue_dwndropdown pbm_dwndropdown integer y = 800 integer width = 3589 integer height = 1460 integer taborder = 30 boolean bringtotop = true string title = "none" string dataobject = "dw_outware_to_inwarebuy_mx_edit" boolean hscrollbar = true boolean vscrollbar = true boolean livescroll = true borderstyle borderstyle = stylelowered! end type event ue_dwndropdown;String ls_col_pz,ls_col_mtrlid String ls_pz_ch String ls_col_value String ls_data_type Long ll_row,ll_mtrlid s_pzwin_open arg_s_win ll_row = THIS.GetRow() IF ll_row > 0 THEN ls_col_pz = THIS.GetColumnName( ) // IF Pos(ls_col_pz,'location') > 0 THEN // 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_mtrlid = ins_storageid // // ls_pz_ch = f_storage_location(arg_s_win) // // IF ls_pz_ch = '' THEN RETURN // // THIS.SetItem(ll_row,ls_col_pz,ls_pz_ch) // // END IF END IF end event event rowfocuschanged; IF currentrow <= 0 THEN RETURN THIS.SelectRow(0,FALSE) THIS.SelectRow(currentrow,TRUE) this.setrow(currentrow) end event event clicked; IF row <= 0 THEN RETURN THIS.SelectRow(0,FALSE) THIS.SelectRow(row,TRUE) this.setrow(row) end event type st_item_msg from statictext within w_outware_to_inwarebuy_edit boolean visible = false integer x = 699 integer y = 720 integer width = 453 integer height = 48 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 = "双击选择费用项目" boolean focusrectangle = false end type