$PBExportHeader$w_associat_sptcust.srw forward global type w_associat_sptcust from w_publ_edit_index end type end forward global type w_associat_sptcust from w_publ_edit_index integer width = 4425 integer height = 2080 string title = "关联往来单位设置" boolean minbox = true windowtype windowtype = popup! event ue_spt_ch ( ) event ue_cus_ch ( ) end type global w_associat_sptcust w_associat_sptcust type variables s_associat_sptcust INS_RT_STRU long oldsptid=0,oldcusid=0,newsptid=0,newcusid=0 uo_associat_sptcust uo_sptcust end variables event ue_spt_ch();If Not dw_edit_mode Then Return S_spt S_INSCUST s_edit_index_tran s_ch_tran Long uc_row uc_row = dw_uc.GetRow() dw_uc.AcceptText() If Not IsValid(W_spt_edit) Then 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_uc.object.u_spt_sptcode[dw_uc.getrow()])) OpenWithParm(W_spt_edit,s_ch_tran) //调用 S_INSCUST = Message.PowerObjectParm //接受返回结构 If S_INSCUST.sptid > 0 Then //正常返回值则可以取以下值 dw_uc.SetRedraw(False) dw_uc.Object.sptid[uc_row] = S_INSCUST.sptid dw_uc.Object.u_spt_name[uc_row] = S_INSCUST.Name dw_uc.Object.u_spt_sptcode[uc_row] = S_INSCUST.sptcode //=S_INSCUST.sptcode dw_uc.SetRedraw(True) dw_uc.SetColumn("u_spt_sptcode") End If End If end event event ue_cus_ch(); If Not dw_edit_mode Then Return Long child_row s_custom S_INSCUST_c s_edit_index_tran s_ch_tran child_row = dw_uc.GetRow() If child_row = 0 Then Return End If 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 (备用) //查询列(物料编码)部分内容,用于初步筛选 // dw_uc.AcceptText() // s_ch_tran.arg_string_code = Upper(Trim(dw_uc.Object.u_cust_cuscode[dw_uc.GetRow()])) OpenWithParm(W_cust_edit,s_ch_tran) //调用 S_INSCUST_c = Message.PowerObjectParm //接受返回结构 If S_INSCUST_c.cusid > 0 Then //正常返回值则可以取以下值 dw_uc.SetRedraw(False) dw_uc.Object.cusid[child_row] = S_INSCUST_c.cusid dw_uc.Object.u_cust_name[child_row] = S_INSCUST_c.Name dw_uc.Object.u_cust_cuscode[child_row] = S_INSCUST_c.cuscode dw_uc.SetRedraw(True) dw_uc.SetFocus() dw_uc.SetColumn("u_cust_cuscode") End If End If end event on w_associat_sptcust.create call super::create end on on w_associat_sptcust.destroy call super::destroy end on event close;call super::close;CLOSEWITHRETURN(THIS,INS_RT_STRU) // 窗体级子定义结构变量,用于返回 end event event retrieve_uc;Boolean cb_firstpage_enabled,cb_nextpage_enabled,cb_retrieveall_enabled Boolean cb_priorpage_enabled,cb_func_enabled,cb_retrieve_enabled cb_firstpage_enabled = cb_firstpage.Enabled cb_nextpage_enabled = cb_nextpage.Enabled cb_retrieveall_enabled = cb_retrieveall.Enabled cb_priorpage_enabled = cb_priorpage.Enabled cb_func_enabled = cb_func.Enabled cb_retrieve_enabled = cb_retrieve.Enabled cb_firstpage.Enabled = FALSE cb_nextpage.Enabled = FALSE cb_retrieveall.Enabled = FALSE cb_priorpage.Enabled = FALSE cb_func.Enabled = FALSE cb_retrieve.Enabled = FALSE dw_UC.SetRedraw(FALSE) dw_index.ShareDataOff() SetPointer(HourGlass!) dw_UC.Retrieve(oldsptid) SetPointer(Arrow!) dw_UC.ShareData(dw_index) dw_UC.SetRedraw(TRUE) IF dw_index.RowCount() >= 1 THEN dw_index.SelectRow(0,FALSE) dw_index.SelectRow(1,TRUE) END IF cb_firstpage.Enabled = cb_firstpage_enabled cb_nextpage.Enabled = cb_nextpage_enabled cb_retrieveall.Enabled = cb_retrieveall_enabled cb_priorpage.Enabled = cb_priorpage_enabled cb_func.Enabled = cb_func_enabled cb_retrieve.Enabled = cb_retrieve_enabled end event event ue_usual_query_filt;call super::ue_usual_query_filt;if dw_edit_mode or keydown(keyf4!) or keydown(keyf5!) then return string obj_expr='' if trim(sle_usual_query.text)<>'' then IF POS(trim(sle_usual_query.text),'%')=0 THEN obj_expr=obj_expr+'( itemcode LIKE "%'+trim(sle_usual_query.text)+'%" )' ELSE obj_expr=obj_expr+'( itemcode LIKE "'+trim(sle_usual_query.text)+'" )' END IF end if dw_UC.setfilter(obj_expr) dw_UC.SetRedraw(False) dw_INDEX.SetRedraw(False) dw_UC.filter() if dw_index.rowcount()>=1 then dw_index.selectrow(0,false) dw_index.selectrow(1,true) end if dw_UC.SetRedraw(TRUE) dw_INDEX.SetRedraw(TRUE) end event event ue_usual_query_retr;call super::ue_usual_query_retr;if dw_edit_mode or keydown(keyf4!) or keydown(keyf5!) then return string ls_querystrpart='' ls_newselect=lower(ori_oldselect) if trim(sle_usual_query.text)<>'' then if pos(trim(sle_usual_query.text),'%')=0 then ls_querystrpart="(itemcode like '%"+trim(sle_usual_query.text)+"%')" else ls_querystrpart="(itemcode like '"+trim(sle_usual_query.text)+"')" end if if Pos(ls_newselect," where ") <> 0 then ls_newselect=ls_newselect+" AND ("+ls_querystrpart+')' else ls_newselect=ls_newselect+" where ("+ls_querystrpart+')' end if end if wf_retrieveuc(dw_uc,ls_newselect,1) this.triggerevent('retrieve_uc') //注意必须有此句 end event event open;call super::open; uo_sptcust = CREATE uo_associat_sptcust end event type cb_func from w_publ_edit_index`cb_func within w_associat_sptcust boolean visible = false end type type cb_exit from w_publ_edit_index`cb_exit within w_associat_sptcust integer x = 773 end type type sle_usual_query from w_publ_edit_index`sle_usual_query within w_associat_sptcust boolean visible = false integer x = 4338 end type type cb_nextpage from w_publ_edit_index`cb_nextpage within w_associat_sptcust integer x = 928 integer y = 1600 end type type cb_priorpage from w_publ_edit_index`cb_priorpage within w_associat_sptcust integer x = 782 integer y = 1600 end type type cb_firstpage from w_publ_edit_index`cb_firstpage within w_associat_sptcust integer x = 635 integer y = 1600 end type type cb_retrieveall from w_publ_edit_index`cb_retrieveall within w_associat_sptcust integer x = 489 integer y = 1600 end type type em_pagerowno from w_publ_edit_index`em_pagerowno within w_associat_sptcust integer x = 192 integer y = 1600 end type type st_pagerowno from w_publ_edit_index`st_pagerowno within w_associat_sptcust integer x = 18 integer y = 1620 end type type st_1 from w_publ_edit_index`st_1 within w_associat_sptcust boolean visible = false integer x = 4329 string text = "编号含" end type type cb_add from w_publ_edit_index`cb_add within w_associat_sptcust integer x = 233 end type event cb_add::clicked;Long ll_cnt,uc_row Long ll_sptid,ll_cusid,ll_id string arg_msg ='' IF dw_edit_mode THEN dw_uc.AcceptText() IF dw_uc.GetNextModified(0, Primary!) = 0 THEN MessageBox('提示','没有任何修改,不可以保存!',information!,ok!) RETURN END IF uc_row = dw_uc.GetRow() dw_uc.Object.sptid[uc_row] = long(dw_uc.Object.sptid[uc_row]) dw_uc.Object.cusid[uc_row] = long(dw_uc.Object.cusid[uc_row]) dw_uc.Object.dscrp[uc_row] = Trim(dw_uc.Object.dscrp[uc_row]) IF isnull(dw_uc.Object.sptid[uc_row] ) or dw_uc.Object.sptid[uc_row] =0 THEN MessageBox('提示','请输入供应商编号!',information!,ok!) dw_uc.SetFocus() dw_uc.SetColumn("sptid") RETURN END IF IF isnull(dw_uc.Object.cusid[uc_row] ) or dw_uc.Object.cusid[uc_row] =0 THEN MessageBox('提示','请输入客户编号!',information!,ok!) dw_uc.SetFocus() dw_uc.SetColumn("cusid") RETURN END IF //检查往来单位是否已存在 ll_sptid = dw_uc.Object.sptid[uc_row] ll_cusid = dw_uc.Object.cusid[uc_row] IF oldsptid <> 0 THEN ll_cnt = 0 if ll_sptid = oldsptid then SELECT count(*) INTO :ll_cnt FROM u_associat_sptcust WHERE cusid = :ll_cusid; IF sqlca.SQLCode <> 0 THEN MessageBox('错误','查询往来单位是否已存在失败',stopsign!,ok!) RETURN END IF if ll_cusid = oldcusid then ll_cnt = 0 else SELECT count(*) INTO :ll_cnt FROM u_associat_sptcust WHERE sptid = :ll_sptid ; IF sqlca.SQLCode <> 0 THEN MessageBox('错误','查询往来单位是否已存在失败',stopsign!,ok!) RETURN END IF end if IF ll_cnt > 0 THEN MessageBox('提示','已存在往来单位,不能重复建立!',information!,ok!) dw_uc.SetFocus() dw_uc.SetColumn("sptid") RETURN END IF ELSE ll_cnt = 0 SELECT count(*) INTO :ll_cnt FROM u_associat_sptcust WHERE sptid = :ll_sptid or cusid = :ll_cusid; IF sqlca.SQLCode <> 0 THEN MessageBox('错误','查询往来单位是否已存在失败',stopsign!,ok!) RETURN END IF IF ll_cnt > 0 THEN MessageBox('提示','已存在往来单位,不能重复建立!',information!,ok!) dw_uc.SetFocus() dw_uc.SetColumn("sptid") RETURN END IF END IF ////////////////////////////////////////////////// uo_sptcust.sptid = dw_uc.Object.sptid[uc_row] uo_sptcust.cusid = dw_uc.Object.cusid[uc_row] uo_sptcust.dscrp = dw_uc.Object.dscrp[uc_row] IF uo_sptcust.save_sptcust (arg_msg,TRUE,oldsptid,oldcusid) = 0 THEN MessageBox('错误',arg_msg,stopsign!,OK!) RETURN END IF // MessageBox('提示','保存操作成功!',information!,OK!) END IF IF dw_edit_mode THEN dw_uc.Enabled = False ELSE Long li_row, li_cur_row li_cur_row = dw_uc.GetRow() li_row = dw_uc.InsertRow (li_cur_row) dw_uc.ScrollToRow (li_row) dw_uc.Enabled = True dw_uc.SetFocus() modifyrow_no = li_row END IF dw_edit_mode = Not dw_edit_mode wf_face_change() IF dw_edit_mode THEN IF cb_mode_itfchg.Text = '<<' THEN cb_mode_itfchg.TriggerEvent(Clicked!) END IF ELSE wf_index_uc() END IF dw_index.rbutton_filter_use = Not dw_edit_mode wf_editindex_lockf() IF dw_edit_mode THEN dw_uc.SetFocus() dw_uc.SetColumn('sptid') END IF end event type cb_edit from w_publ_edit_index`cb_edit within w_associat_sptcust integer x = 425 end type event cb_edit::clicked;call super::clicked;if dw_edit_mode then oldsptid = dw_index.object.u_associat_sptcust_sptid[dw_index.getrow()] oldcusid = dw_index.object.u_associat_sptcust_cusid[dw_index.getrow()] else oldsptid =0 oldcusid =0 parent.triggerevent('retrieve_uc') end if end event type cb_delet from w_publ_edit_index`cb_delet within w_associat_sptcust integer x = 617 end type event cb_delet::clicked; long ll_sptid,ll_custid String ls_code,arg_msg IF DW_UC.GetRow() <= 0 THEN MessageBox('提示','没有操作目标记录!',information!,ok!) RETURN END IF ll_sptid = dw_uc.Object.sptid[dw_uc.getrow()] ll_custid= dw_uc.Object.cusid[dw_uc.getrow()] IF MessageBox ("询问","是否确定要删除当前记录?(选择确定后记录将不可恢复)",Question!,YesNo! ) = 2 THEN RETURN END IF DW_UC.SetRedraw (FALSE) DW_UC.DeleteRow (0) DW_UC.TriggerEvent (RowFocusChanged!) IF uo_sptcust.del (ll_sptid,ll_custid,arg_msg) = 0 THEN MessageBox('错误',arg_msg,stopsign!,OK!) RETURN END IF //MessageBox('提示','删除操作成功!',information!,OK!) DW_UC.SetRedraw (TRUE) WF_INDEX_UC() end event type cb_choice from w_publ_edit_index`cb_choice within w_associat_sptcust boolean visible = false integer x = 1029 end type type cb_cancel from w_publ_edit_index`cb_cancel within w_associat_sptcust end type type cbx_mlselect from w_publ_edit_index`cbx_mlselect within w_associat_sptcust boolean visible = false integer x = 4338 integer y = 96 integer width = 78 integer height = 172 end type type cbx_allselect from w_publ_edit_index`cbx_allselect within w_associat_sptcust boolean visible = false integer x = 4338 integer y = 92 integer width = 160 end type type cb_mode_itfchg_b from w_publ_edit_index`cb_mode_itfchg_b within w_associat_sptcust end type type cb_mode_itfchg from w_publ_edit_index`cb_mode_itfchg within w_associat_sptcust integer x = 923 integer width = 78 end type type gb_1 from w_publ_edit_index`gb_1 within w_associat_sptcust integer x = 37 integer y = 1596 end type type dw_uc from w_publ_edit_index`dw_uc within w_associat_sptcust integer x = 3086 integer y = 180 integer width = 1312 integer height = 1808 string dataobject = "dw_associat_sptcust_edit" end type event dw_uc::itemchanged;call super::itemchanged;//long uc_row //s_edit_index_tran s_ch_tran //传递参数使用 //S_spt S_INSCUST //s_custom S_INSCUST_c // //IF row > 0 THEN // IF dwo.Name = "sptid" THEN // if not dw_edit_mode then return // uc_row=dw_uc.getrow() // dw_uc.accepttext() // // if not isvalid(W_spt_edit) then // // 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_uc.object.u_spt_sptcode[dw_uc.getrow()])) // // OPENwithparm(W_spt_edit,s_ch_tran) //调用 // // S_INSCUST=Message.PowerObjectParm //接受返回结构 // // IF S_INSCUST.sptid>0 THEN //正常返回值则可以取以下值 // dw_uc.setredraw(false) // dw_uc.object.sptid[uc_row]=S_INSCUST.sptid // dw_uc.object.u_spt_name[uc_row]=S_INSCUST.name // //=S_INSCUST.sptcode // dw_uc.setredraw(true) // dw_uc.setcolumn("sptid") // END IF // end if // // ELSEIF dwo.Name = "cusid" THEN // // IF NOT dw_edit_mode THEN RETURN // Long child_row // // child_row = dw_uc.GetRow() // IF child_row = 0 THEN // RETURN // END IF // // 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 (备用) // //查询列(物料编码)部分内容,用于初步筛选 // //// dw_uc.AcceptText() //// s_ch_tran.arg_string_code = Upper(Trim(dw_uc.Object.u_cust_cuscode[dw_uc.GetRow()])) // // OpenWithParm(W_cust_edit,s_ch_tran) //调用 // // S_INSCUST_c = Message.PowerObjectParm //接受返回结构 // // IF S_INSCUST_c.cusid > 0 THEN //正常返回值则可以取以下值 // dw_uc.SetRedraw(FALSE) // dw_uc.Object.cusid[child_row] = S_INSCUST_c.cusid // dw_uc.Object.u_cust_name[child_row] = S_INSCUST_c.Name // //dw_uc.Object.u_cust_cuscode[child_row] = S_INSCUST.cuscode // dw_uc.SetRedraw(TRUE) // dw_uc.SetFocus() // dw_uc.SetColumn("cusid") // END IF // END IF // // END IF //END IF // end event event dw_uc::doubleclicked;call super::doubleclicked;Long uc_row If row > 0 Then If dwo.Name = "u_spt_sptcode" Or dwo.Name = 'u_spt_name' Then Parent.TriggerEvent('ue_spt_ch') ElseIf dwo.Name = "u_cust_cuscode" Or dwo.Name = 'u_cust_name' Then Parent.TriggerEvent('ue_cus_ch') End If End If end event event dw_uc::key;call super::key;If dw_uc.GetRow() <= 0 Then Return Long ll_row Long ll_id String ls_name ll_row = dw_uc.GetRow() String ls_code If dw_edit_mode Then dw_uc.AcceptText() If dw_uc.GetColumnName() = 'u_spt_sptcode' And Key = keyenter! Then ls_code = This.Object.u_spt_sptcode[ll_row] Select sptid, name Into :ll_id, :ls_name From u_spt Where sptcode = :ls_code; If sqlca.SQLCode <> 0 Then Parent.TriggerEvent('ue_spt_ch') Return Else dw_uc.Object.sptid[ll_row] = ll_id dw_uc.Object.u_spt_name[ll_row] = ls_name End If ElseIf dw_uc.GetColumnName() = 'u_cust_cuscode' And Key = keyenter! Then ls_code = This.Object.u_cust_cuscode[ll_row] Select cusid, name Into :ll_id, :ls_name From u_cust Where cuscode = :ls_code; If sqlca.SQLCode <> 0 Then Parent.TriggerEvent('ue_cus_ch') Return Else dw_uc.Object.cusid[ll_row] = ll_id dw_uc.Object.u_cust_name[ll_row] = ls_name End If End If End If end event type cb_retrieve from w_publ_edit_index`cb_retrieve within w_associat_sptcust end type type cb_print from w_publ_edit_index`cb_print within w_associat_sptcust boolean visible = false integer x = 1563 integer y = 4 end type event cb_print::clicked;call super::clicked;S_print_MSG LS_PRMSG LS_PRMSG.obj_dwNAME='dw_rp_item_index' LS_PRMSG.SHARE_DW=DW_UC LS_PRMSG.TAG_TEXT='项目资料表' LS_PRMSG.SETUP_FLAG=0 LS_PRMSG.PAGECH_FLAG=1 Openwithparm(w_publ_preview,LS_PRMSG) end event type ln_bar from w_publ_edit_index`ln_bar within w_associat_sptcust end type type ln_bar2 from w_publ_edit_index`ln_bar2 within w_associat_sptcust end type type r_bar from w_publ_edit_index`r_bar within w_associat_sptcust end type type ln_1 from w_publ_edit_index`ln_1 within w_associat_sptcust boolean visible = false end type type ln_2 from w_publ_edit_index`ln_2 within w_associat_sptcust boolean visible = false end type type dw_index from w_publ_edit_index`dw_index within w_associat_sptcust integer y = 180 integer width = 3090 integer height = 1808 string dataobject = "dw_associat_sptcust" end type type cb_help from w_publ_edit_index`cb_help within w_associat_sptcust boolean visible = false end type