TIPTOP ERP系统函数clshowarray.docx

上传人:b****4 文档编号:5650434 上传时间:2023-05-08 格式:DOCX 页数:17 大小:98.53KB
下载 相关 举报
TIPTOP ERP系统函数clshowarray.docx_第1页
第1页 / 共17页
TIPTOP ERP系统函数clshowarray.docx_第2页
第2页 / 共17页
TIPTOP ERP系统函数clshowarray.docx_第3页
第3页 / 共17页
TIPTOP ERP系统函数clshowarray.docx_第4页
第4页 / 共17页
TIPTOP ERP系统函数clshowarray.docx_第5页
第5页 / 共17页
TIPTOP ERP系统函数clshowarray.docx_第6页
第6页 / 共17页
TIPTOP ERP系统函数clshowarray.docx_第7页
第7页 / 共17页
TIPTOP ERP系统函数clshowarray.docx_第8页
第8页 / 共17页
TIPTOP ERP系统函数clshowarray.docx_第9页
第9页 / 共17页
TIPTOP ERP系统函数clshowarray.docx_第10页
第10页 / 共17页
TIPTOP ERP系统函数clshowarray.docx_第11页
第11页 / 共17页
TIPTOP ERP系统函数clshowarray.docx_第12页
第12页 / 共17页
TIPTOP ERP系统函数clshowarray.docx_第13页
第13页 / 共17页
TIPTOP ERP系统函数clshowarray.docx_第14页
第14页 / 共17页
TIPTOP ERP系统函数clshowarray.docx_第15页
第15页 / 共17页
TIPTOP ERP系统函数clshowarray.docx_第16页
第16页 / 共17页
TIPTOP ERP系统函数clshowarray.docx_第17页
第17页 / 共17页
亲,该文档总共17页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

TIPTOP ERP系统函数clshowarray.docx

《TIPTOP ERP系统函数clshowarray.docx》由会员分享,可在线阅读,更多相关《TIPTOP ERP系统函数clshowarray.docx(17页珍藏版)》请在冰点文库上搜索。

TIPTOP ERP系统函数clshowarray.docx

TIPTOPERP系统函数clshowarray

TIPTOP系统函数cl_show_array()

在TIPTOP系统中设有这样的一个方法cl_show_array(),这个方法的主要作用是开窗呈现一个动态数组中的内容,主要用于我们在对单身里面多条数据进行逐一判断,最终将单身里面有错误的信息,在不写任何开窗代码的情况下,使用这个cl_show_array()将错误信息组合罗列在弹窗里面,外加了一个导出excel的功能.废话不多说直接写段代码测试一下,编写一个名为f4.4gl文件,然后上传编译,在42m目录下面使用命令fglruncxm_f4.42m执行,弹出结果.

【注:

因为是测试,所以这里面有些系统自带函数注释掉一些,然后添加了两个比较重要的函数FUNCTIONcl_set_comp_att_text(ps_fields,ps_att_value)(动态设定栏位标题)和FUNCTIONcl_set_comp_visible(ps_fields,pi_visible)(动态隐藏栏位),这两个方法里面做了一些小小的改动】

代码如下:

MAIN

DEFINEtest1,test2STRING

DEFINErDYNAMICARRAYOFRECORD

keyINTEGER,

lastnameCHAR(20)

ENDRECORD

LETr[1].key=1

LETr[1].lastname='Condor1'

LETr[2].key=2

LETr[2].lastname='Condor2'

LETr[3].key=3

LETr[3].lastname='Condor3'

LETtest1="|",'Item'CLIPPED

LETtest1=test1.trim(),"|",'Content'CLIPPED

LETtest2='测试数据!

'CLIPPED

CALLcl_show_array(base.typeinfo.create(r),test2,test1)//base.typeinfo.create(r)数组内容,test2窗口标题,test1栏位标题(注意栏位标题的格式以”|”将其分开,因为后面的代码里面会以”|”来截取)

ENDMAIN

FUNCTIONcl_show_array(pnode_array,ps_win_title,ps_title_str)

DEFINEpnode_arrayom.DomNode

DEFINEps_win_titleSTRING

DEFINEps_title_strSTRING

DEFINElnode_recordom.DomNode

DEFINEllst_fieldsom.NodeList

DEFINElnode_fieldom.DomNode

DEFINEllst_rec_fieldsom.NodeList

DEFINEli_child_cntSMALLINT

DEFINEli_rec_cntINTEGER

DEFINElr_arrayDYNAMICARRAYOFRECORD

field1STRING,

field2STRING,

field3STRING,

field4STRING,

field5STRING,

field6STRING,

field7STRING,

field8STRING,

field9STRING,

field10STRING

ENDRECORD

DEFINEls_visible_strSTRING

DEFINEli_iSMALLINT

DEFINEli_jSMALLINT

DEFINEls_iSTRING

DEFINElst_title_namesbase.StringTokenizer

DEFINEls_titleSTRING

DEFINEg_max_recINTEGER

DEFINElwin_currui.Window

LETg_max_rec=10//这个g_max_rec在global是有定义的,这里因为只是做简单测试赋值一固定值10

IFpnode_arrayISNULLTHEN

RETURN

ELSE

LETli_rec_cnt=pnode_array.getChildCount()

LETlnode_record=pnode_array.getFirstChild()

ENDIF

IFlnode_recordISNULLTHEN

RETURN

ELSE

LETllst_rec_fields=lnode_record.selectByTagName("Field")

LETli_child_cnt=llst_rec_fields.getLength()

ENDIF

FORli_i=1TOli_rec_cnt

IFli_i>g_max_recTHEN

--CALLcl_err('',9035,0)//系统自带错误提示的方法注释

EXITFOR

ENDIF

IFli_i=1THEN

LETlnode_record=pnode_array.getFirstChild()

ELSE

LETlnode_record=lnode_record.getNext()

ENDIF

LETllst_fields=lnode_record.selectByTagName("Field")

FORli_j=1TOllst_fields.getLength()

LETlnode_field=llst_fields.item(li_j)

CASEli_j

WHEN1

LETlr_array[li_i].field1=lnode_field.getAttribute("value")

WHEN2

LETlr_array[li_i].field2=lnode_field.getAttribute("value")

WHEN3

LETlr_array[li_i].field3=lnode_field.getAttribute("value")

WHEN4

LETlr_array[li_i].field4=lnode_field.getAttribute("value")

WHEN5

LETlr_array[li_i].field5=lnode_field.getAttribute("value")

WHEN6

LETlr_array[li_i].field6=lnode_field.getAttribute("value")

WHEN7

LETlr_array[li_i].field7=lnode_field.getAttribute("value")

WHEN8

LETlr_array[li_i].field8=lnode_field.getAttribute("value")

WHEN9

LETlr_array[li_i].field9=lnode_field.getAttribute("value")

WHEN10

LETlr_array[li_i].field10=lnode_field.getAttribute("value")

ENDCASE

ENDFOR

ENDFOR

OPENWINDOWcl_show_array_wAT1,1WITHFORM"lib/42f/cl_show_array"

ATTRIBUTE(STYLE="frm_list")

--CALLcl_ui_init()//系统自带的方法注释

--CALLcl_chg_win_title(ps_win_title)//系统自带方法注释,换成下面的两句更改窗口标题

LETlwin_curr=ui.window.getCurrent()

CALLlwin_curr.setText(ps_win_title)

DISPLAYli_rec_cntTOFORMONLY.cnt

--CALLcl_set_act_visible("accept,cancel",FALSE)//系统自带隐藏按钮代码注释

DISPLAYARRAYlr_arrayTOs_array.*ATTRIBUTE(COUNT=g_max_rec,UNBUFFERED)

BEFOREDISPLAY

FORli_i=li_child_cnt+1TO10

LETls_i=li_i

LETls_visible_str=ls_visible_str,"field",ls_i

IFli_i!

=10THEN

LETls_visible_str=ls_visible_str,","

ENDIF

ENDFOR

CALLcl_set_comp_visible(ls_visible_str,FALSE)//隐藏掉不需要栏位

LETlst_title_names=base.StringTokenizer.create(ps_title_str,"|")

LETli_i=1

WHILElst_title_names.hasMoreTokens()

LETls_title=lst_title_names.nextToken()

LETls_title=ls_title.trim()

CASEli_i

WHEN1

CALLcl_set_comp_att_text("field1",ls_title)//动态设定栏位标题

WHEN2

CALLcl_set_comp_att_text("field2",ls_title)

WHEN3

CALLcl_set_comp_att_text("field3",ls_title)

WHEN4

CALLcl_set_comp_att_text("field4",ls_title)

WHEN5

CALLcl_set_comp_att_text("field5",ls_title)

WHEN6

CALLcl_set_comp_att_text("field6",ls_title)

WHEN7

CALLcl_set_comp_att_text("field7",ls_title)

WHEN8

CALLcl_set_comp_att_text("field8",ls_title)

WHEN9

CALLcl_set_comp_att_text("field9",ls_title)

WHEN10

CALLcl_set_comp_att_text("field10",ls_title)

ENDCASE

LETli_i=li_i+1

ENDWHILE

ONACTIONexporttoexcel//汇出excel的方法注释

#IFcl_chk_act_auth()THENmarkbyFUN-650020

--CALLcl_export_to_excel(ui.Interface.getRootNode(),base.TypeInfo.create(lr_array),'','')

#ENDIF

ONACTIONexit

EXITDISPLAY

#TQC-660079...............begin

ONACTIONcancel

LETINT_FLAG=0

EXITDISPLAY

#TQC-660079...............end

ENDDISPLAY

--CALLcl_set_act_visible("accept,cancel",TRUE)//隐藏按钮方法注释

CLOSEWINDOWcl_show_array_w

ENDFUNCTION

FUNCTIONcl_set_comp_att_text(ps_fields,ps_att_value)//动态设定栏位标题

DEFINEps_fieldsSTRING,

ps_att_valueSTRING

DEFINElst_fieldsbase.StringTokenizer,

lst_stringbase.StringTokenizer,

ls_field_nameSTRING,

ls_field_valueSTRING,

ls_win_nameSTRING

DEFINElnode_rootom.DomNode,

lnode_winom.DomNode,

lnode_preom.DomNode,

llst_itemsom.NodeList,

li_iSMALLINT,

lnode_itemom.DomNode,

ls_item_nameSTRING,

lnode_item_childom.DomNode,

ls_item_pre_tagSTRING,

ls_item_tag_nameSTRING

DEFINEg_chgDYNAMICARRAYOFRECORD

itemSTRING,

valueSTRING

ENDRECORD

DEFINElwin_currui.Window

IF(ps_fieldsISNULL)THEN

RETURN

ELSE

LETps_fields=ps_fields.toLowerCase()

ENDIF

LETlwin_curr=ui.Window.getCurrent()

LETlnode_win=lwin_curr.getNode()

LETls_win_name=lnode_win.getAttribute("name")

LETllst_items=lnode_win.selectByPath("//Form//*")

LETlst_fields=base.StringTokenizer.create(ps_fields,",")

LETlst_string=base.StringTokenizer.create(ps_att_value,",")

WHILElst_fields.hasMoreTokens()ANDlst_string.hasMoreTokens()

LETls_field_name=lst_fields.nextToken()

LETls_field_value=lst_string.nextToken()

LETls_field_name=ls_field_name.trim()

IFls_field_name.equals(ls_win_name)THEN

CALLlnode_win.setAttribute("text",ls_field_value)

ENDIF

FORli_i=1TOllst_items.getLength()

LETlnode_item=llst_items.item(li_i)

LETls_item_name=lnode_item.getAttribute("colName")

IF(ls_item_nameISNULL)THEN

LETls_item_name=lnode_item.getAttribute("name")

IF(ls_item_nameISNULL)THEN

CONTINUEFOR

ENDIF

ENDIF

IF(ls_item_name.equals(ls_field_name))THEN

LETls_item_tag_name=lnode_item.getTagName()

IFls_item_tag_name.equals("TableColumn")OR

ls_item_tag_name.equals("Window")OR

ls_item_tag_name.equals("Button")THEN#FUN.570234AddByLifeng

CALLlnode_item.setAttribute("text",ls_field_value.trim())#FUN-530037

ELSE

LETlnode_pre=lnode_item.getPrevious()

LETls_item_pre_tag=lnode_pre.getTagName()

IFls_item_pre_tag.equals("Label")THEN

CALLlnode_pre.setAttribute("text",ls_field_value.trim())#FUN-530037

ENDIF

ENDIF

EXITFOR

ENDIF

ENDFOR

ENDWHILE

ENDFUNCTION

FUNCTIONcl_set_comp_visible(ps_fields,pi_visible)//动态设定栏位标题隐藏

DEFINEps_fieldsSTRING,

pi_visibleSMALLINT

DEFINElst_fieldsbase.StringTokenizer,

ls_field_nameSTRING

DEFINElnode_rootom.DomNode,

llst_itemsom.NodeList,

li_iSMALLINT,

lnode_itemom.DomNode,

lnode_prevom.DomNode,

ls_item_nameSTRING,

ls_prev_nameSTRING,#No:

FUN-570225

ls_item_tagSTRING,

ls_prev_tagSTRING

DEFINElwin_currui.Window,

lfrm_currui.Form

DEFINElnode_frmom.DomNode

DEFINEls_formNameSTRING

DEFINEli_idxSMALLINT

DEFINEli_gav_cntSMALLINT

DEFINElc_cust_flagVARCHAR

(1)

DEFINEls_gav09VARCHAR

(1)--LIKEgav_file.gav09

DEFINEls_notNullSTRING,

ls_requiredSTRING

DEFINEls_gav01VARCHAR(20),--LIKEgav_file.gav01,

ls_gav02VARCHAR(20)--LIKEgav_file.gav02

--#FUN-640184

--IFg_bgjob='Y'

--ANDg_gui_typeNOTMATCHES"[13]"THEN#TQC-710024add

--RETURN

--ENDIF

--#ENDFUN-640184

IF(ps_fieldsISNULL)THEN

RETURN

ELSE

LETps_fields=ps_fields.toLowerCase()

ENDIF

LETlwin_curr=ui.Window.getCurrent()

LETlfrm_curr=lwin_curr.getForm()

LETlnode_frm=lfrm_curr.getNode()

LETlnode_root=ui.Interface.getRootNode()

#No:

MOD-750003--start--

#LETllst_items=lnode_root.selectByPath("//Form//*")

LETllst_items=lnode_frm.selectByPath("//Form//*")

#No:

MOD-750003---end---

LETlst_fields=base.StringTokenizer.create(ps_fields,",")

#FUN-4B0078

LETls_formName=lnode_frm.getAttribute("name")

LETli_idx=ls_formName.getIndexOf("T",1)

IFli_idx!

=0THEN

LETls_formName=ls_formName.subString(1,li_idx-1)

ENDIF

LETls_gav01=ls_formName

--SELECTCOUNT(*)INTOli_gav_cntFROMgav_file

--WHEREgav01=ls_gav01ANDgav08='Y'

IFli_gav_cnt>0THEN

LETlc_cust_flag="Y"

ELSE

LETlc_cust_flag="N"

ENDIF

#---

WHILElst_fields.hasMoreTokens()

LETls_field_name=lst_fields.nextToken()

LETls_field_name=ls_field_name.trim()

LETls_gav02=ls_field_name

FORli_i=1TOllst_items.getLength()

LETlnode_item=llst_items.item(li_i)

LETls_item_name=lnode_item.getAttribute("colName")

IF(ls_item_nameISNULL)THEN

LETls_item_name=lnode_item.getAttribute("name")

IF(ls_item_nameISNULL)THEN

CONTINUEFOR

ENDIF

ENDIF

IF(ls_item_name.equal

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 农林牧渔 > 林学

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2