You are on page 1of 9

---------------------------------------------------------------------

--File : batchmodify.pmlfrm
--Author : Zhen Linlin
--Created : 2009-06-26
--Company : SIXTEE Engineering Groups PTE LTD--Mechanical&
Piping Section(Piping)
--Revision : R2.3
--Purpose : batch pipe component modify
--Modify : 2010-05-26
--Descirption :
--
---------------------------------------------------------------------
kill !!batchmodify
setup form !!batchmodify
revision 'R2.3'
title 'Ôª¼þ²éÕÒÐÞ¸Ä $!this.formrevision '
init '!this.init()'
button .bnREGION 'ÇøÓò' call '!this.Region()'
para .paREGION text '' width 30
button .bnHELP '°ïÖúÎĵµ' call '!this.Help()'
path down
para .paTYPE at xmin.bnREGION text 'ÀàÐÍ' width 5
path right
para .paATTR at xmax.paTYPE+4 text 'ÊôÐÔ' width 8
para .paCOND at xmax.paATTR+4 text 'Ìõ¼þ' width 8
para .paVALU at xmax.paCOND+2 text 'Öµ' width 12
path down
option .opTYPE at xmin.paTYPE call '!this.initATTR()' width 5
path right
option .opATTR at xmin.paATTR call '!this.initCOND()' width 8
option .opCOND at xmin.paCOND call '!this.CondAct()' width 6
text .txVALU at xmin.paVALU width 14 is STRING
path down
list .liRULES 'ËÑË÷Ìõ¼þ:' at xmin.bnREGION MULT width 32 height 3
--button .bnClearRule 'Çå¿Õ' at xmax.liRULES - size ymin.liRULES - 0.3 call '!this.Cle
arRule()'
button .bnADD 'Ìí¼ÓÌõ¼þ' at xmax.liRULES+2 ymin.liRULES+0.5 call '!this.AddRule()'
button .bnDEL 'ɾ³ýÌõ¼þ' call '!this.DelRule()'
button .bnClearRule 'Çå¿ÕÌõ¼þ' call '!this.ClearRule()'
button .bnNOT '—Ç ת»»' at xmin.liRULES call '!this.NotRule()'
path right
button .bnAND '²¢ Áª½Ó' call '!this.AndRule()'
button .bnOR '»ò Áª½Ó' call '!this.OrRule()'
button .bnAPPLY '¿ªÊ¼ËÑË÷' at xmin.bnADD ymin.bnNOT call '!this.Coll()'
list .liCOMP '—ûºÏÌõ¼þÔª¼þ:' at xmin.liRULES ymax.bnNOT+0.5 call '!this.GotoComp()' width
para .paCOMPNUM at xmin.liCOMP+15 ymin.liCOMP-0.2 width 6
button .bnClearComp 'Çå¿ÕÔª¼þ' at xmin.bnClearRule ymin.liCOMP-0.3 call '!this.ClearComp(
text .txRCOMP at xmin.liCOMP ymax.liCOMP-0.5 width 35 is STRING
--!this.txRCOMP.callback = '!this.Execute()'
path right
button .bnREPLACE 'Ö´ÐÐÃüÁî' at xmax form - size ymin.txRCOMP call '!this.Execute()'
mem .rules is array
mem .showrules is array
mem .Typeval is real
mem .Attrval is real
mem .Condval is real
mem .CompNum is string
exit
---------------batchmodify()--------------
define method .batchmodify()
!this.bnHELP.background = 5
!this.bnADD.background = 5
!this.bnDEL.background = 5
!this.bnNOT.background = 5
!this.bnAND.background = 5
!this.bnOR.background = 5
!this.bnREGION.background = 5
!this.bnAPPLY.background = 6
!this.bnREPLACE.background = 2
!this.bnClearComp.background = 5
!this.bnClearRule.background = 5
!this.CompNum = '0'
!this.Typeval = 1
!this.Attrval = 1
!this.Condval = 1
endmethod
--------------.init()------------------
define method .init()
!this.paCOMPNUM.val = !this.CompNum
!this.ClearRule()
if (!!CE.TYPE EQ 'WORL') then
1
endif
ALPHA REQUEST CLEAR
$p -------------------------------------------
$p ¹«Ë¾: л¿Ë˹ÌØ(Ìì½ò)º£Ñ󴬲°¹¤³ÌÓÐÏÞ¹«Ë¾
$p ×÷Õß: ÕçÁÖÁÖ
$p ÓÊÏä: zhenlinlin$@sixtee.com zhenlin220$@126.com
$p ÈÕÆÚ: 2009Äê2ÔÂ26ÈÕ
$p Ãû³Æ: Ôª¼þ²éÕÒÐÞ¸Ä
$p °æ±¾: R2.3
$p -------------------------------------------

!this.txVALU.setfocus()
!this.Region()
!this.initTYPE()
endmethod
---------------ClearRule()----------------------
define method .ClearRule()
!this.liRULES.clear()
!this.rules.clear()
!this.showrules.clear()
endmethod
---------------ClearComp()----------------------
define method .ClearComp()
!this.liCOMP.clear()
!this.paCompNum.val = '0'
endmethod
--------------.initTYPE()--------------------
--¿ÉÒÔËÑË÷µÄÔª¼þÀàÐÍÁбí
define method .initTYPE()
!arTYPE = array()
!arTYPE.clear()
!arTYPE.append('ALL')
!arTYPE.append('ATTA')
!arTYPE.append('BEND')
!arTYPE.append('CAP')
!arTYPE.append('COUP')
!arTYPE.append('CROS')
!arTYPE.append('ELBO')
!arTYPE.append('FLAN')
!arTYPE.append('FTUB')
!arTYPE.append('GASK')
!arTYPE.append('INST')
!arTYPE.append('OLET')
!arTYPE.append('REDU')
!arTYPE.append('TEE')
!arTYPE.append('TRAP')
!arTYPE.append('TUBI')
!arTYPE.append('UNIO')
!arTYPE.append('VALV')
!arTYPE.append('WELD')
!arTYPE.append('BRAN')
!arTYPE.append('PIPE')
!arTYPE.append('SCTN')
!this.opTYPE.dtext=!arTYPE
!this.opTYPE.val = !this.Typeval
!this.initATTR()
endmethod
--------------.initATTR()---------------------
--´ËÖÖÀàÐ͵ÄÔª¼þ¿ÉÒÔËÑË÷µÄÊôÐÔ
define method .initATTR()
!arATTR = array()
!arATTR.clear()
!type = !this.opTYPE.rtext[!this.opTYPE.val]
if (!type ne 'SCTN' and !type ne 'PIPE' and !type ne 'BRAN') then
!arATTR.append('P1BORE')
endif
if (!type eq 'REDU' or !type eq 'COUP' or !type eq 'UNIO') then
!arATTR.append('P2BORE')
endif
if (!type eq 'TEE' or !type eq 'OLET' or !type eq 'CROS') then
!arATTR.append('P3BORE')
endif
if (!type eq 'ELBO' or !type eq 'BEND') then
!arATTR.append('ANGLE')
endif
if (!type ne 'PIPE' and !type ne 'BRAN') then
!arATTR.append('SPREF')
!arATTR.append('MTXR')
!arATTR.append('DTXR')
!arATTR.append('POS')
if (!type ne 'SCTN' and !type ne 'TUBI') then
!arATTR.append('SHOP')
endif
endif
!arATTR.append('NONE')
!this.opATTR.dtext=!arATTR
if !this.Attrval le !this.opATTR.dtext.size() then
!this.opATTR.val = !this.Attrval
endif
!this.Typeval = !this.opTYPE.val
!this.initCOND()

endmethod
--------------.initCOND()----------------------
--Ìõ¼þµÄ¶Ô±È¹Øϵ
define method .initCOND()
!arCOND = array()
!arCOND.clear()
!attr = !this.opATTR.rtext[!this.opATTR.val]
if (!attr eq 'NONE') then
!arCOND.append('NONE')
!this.paATTR.val = '¿Õ'
!this.paCOND.val = '¿Õ'
!this.paVALU.val = '×Ô¶¨ÒåÌõ¼þ'
else
!this.paATTR.val = 'ÊôÐÔ'
!this.paCOND.val = 'Ìõ¼þ'
!this.paVALU.val = 'Öµ'
endif
if (!attr ne 'NONE' and !attr ne 'DTXR') then
!arCOND.append('= (EQ)')
!arCOND.append('<>(NE)')
endif
if (!attr eq 'P1BORE' or !attr eq 'P2BORE' or !attr eq 'P3BORE' or !attr eq 'A
NGLE' or !attr eq 'POS') then
!arCOND.append('< (LT)')
!arCOND.append('> (GT)')
!arCOND.append('<=(LE)')
!arCOND.append('>=(GE)')
endif
if (!attr eq 'DTXR') then
!arCOND.append('LIKE')
endif
!this.opCOND.dtext=!arCOND
if !this.Condval le !this.opCOND.dtext.size() then
!this.opCOND.val = !this.Condval
endif
!this.Attrval = !this.opATTR.val
endmethod
---------------CondAct()--------------------
define method .CondAct()
!this.Condval = !this.opCOND.val
endmethod
--------------.AddRule()-------------------
--Ìí¼ÓËÑË÷Ìõ¼þ
define method .AddRule()
if (!this.txVALU.val eq '') then
!!ALERT.MESSAGE('ÇëÊäÈëÖµ')
return
endif
!attr = !this.opATTR.rtext[!this.opATTR.val]
!rule = !attr
if !attr eq 'POS' then
!rule = 'POS IN WORLD'
endif
!cond = !this.opCOND.rtext[!this.opCOND.val]
if (!cond eq '= (EQ)') then
!rule = !rule + ' EQ '
!show = '='
endif
if (!cond eq '> (GT)') then
!rule = !rule + ' GT '
!show = '>'
endif
if (!cond eq '< (LT)') then
!rule = !rule + ' LT '
!show = '<'
endif
if (!cond eq '>=(GE)') then
!rule = !rule + ' GE '
!show = '>='
endif
if (!cond eq '<=(LE)') then
!rule = !rule + ' LE '
!show = '<='
endif
if (!cond eq '<>(NE)') then
!rule = !rule + ' NE '
!show = '<>'
endif
if (!attr eq 'NONE') then
!rule = !this.txVALU.val
!showrule = !this.txVALU.val
elseif (!attr eq 'DTXR') then
!rule = 'MATCH(DTXR,''$!this.txVALU.val'') GT 0'
!showrule = 'DTXR LIKE * $!this.txVALU.val *'
else
!rule = !rule + !this.txVALU.val
!showrule = !attr + ' ' + !show + ' ' + !this.txVALU.val
endif
!this.txVALU.val=''
!this.showrules.append(!showrule)
!this.rules.append(!rule)
!this.showrules.unique()
!this.rules.unique()
!this.liRULES.dtext=!this.showrules
endmethod
--------------.DelRule()------------------
--ɾ³ý²»ÐèÒªÌõ¼þ
define method .DelRule()
if (!this.liRULES.val.size() eq 0) then
!!ALERT.MESSAGE('ÇëÑ¡ÔñÖÁÉÙÒ»¸öÌõ¼þ!')
return
endif

!ar = !this.liRULES.val
do !i from 1 to !this.liRULES.val.size()
!this.rules.DeleteTo(!ar[$!i],1)
!this.showrules.DeleteTo(!ar[$!i],1)
enddo
!this.rules.unique()
!this.showrules.unique()
!this.liRULES.dtext=!this.showrules
endmethod
---------------NotRule()--------------------
--Ìõ¼þµÄ—DzÙ×÷
define method .NotRule()
if (!this.liRULES.val.size() lt 1) then
!!ALERT.MESSAGE('ÇëÑ¡ÔñÖÁÉÙÒ»¸öÌõ¼þ')
return
endif
!ar = !this.liRULES.val
!rule = 'NOT(' + !this.rules[$!ar[1]]
!showrule = 'NOT(' + !this.showrules[$!ar[1]]
do !i from 1 to !this.liRULES.val.size()
!this.rules[$!ar[$!i]] = 'NOT(' + !this.rules[$!ar[$!i]] + ')'
!this.showrules[$!ar[$!i]] = 'NOT(' + !this.showrules[$!ar[$!i]] + ')'
enddo
!this.rules.unique()
!this.showrules.unique()
!this.liRULES.dtext = !this.showrules
endmethod
--------------.AndRule()-------------------
--Ìõ¼þµÄ²¢²Ù×÷
define method .AndRule()
if (!this.liRULES.val.size() lt 2) then
!!ALERT.MESSAGE('ÇëÑ¡ÔñÖÁÉÙÁ½¸öÌõ¼þ')
return
endif
!ar = !this.liRULES.val
!rule = '(' + !this.rules[$!ar[1]]
!showrule = '(' +!this.showrules[$!ar[1]]
do !i from 2 to !this.liRULES.val.size()
!rule = !rule + ' AND ' + !this.rules[$!ar[$!i]]
!showrule = !showrule + ' AND ' + !this.showrules[$!ar[$!i]]
!this.rules.DeleteTo(!ar[$!i],1)
!this.showrules.DeleteTo(!ar[$!i],1)
enddo
!this.rules[$!ar[1]] = !rule + ')'
!this.showrules[$!ar[1]] = !showrule + ')'
!this.rules.unique()
!this.showrules.unique()
!this.liRULES.dtext=!this.showrules

endmethod
--------------.OrRule()-------------------
--Ìõ¼þµÄ»ò²Ù×÷
define method .OrRule()
if (!this.liRULES.val.size() lt 2) then
!!ALERT.MESSAGE('ÇëÑ¡ÔñÖÁÉÙÁ½¸öÌõ¼þ')
return
endif
!ar = !this.liRULES.val
!rule = '(' + !this.rules[$!ar[1]]
!showrule = '(' +!this.showrules[$!ar[1]]
do !i from 2 to !this.liRULES.val.size()
!rule = !rule + ' OR ' + !this.rules[$!ar[$!i]]
!showrule = !showrule + ' OR ' + !this.showrules[$!ar[$!i]]
!this.rules.DeleteTo(!ar[$!i],1)
!this.showrules.DeleteTo(!ar[$!i],1)
enddo

!this.rules[$!ar[1]] = !rule + ')'


!this.showrules[$!ar[1]] = !showrule + ')'
!this.rules.unique()
!this.showrules.unique()
!this.liRULES.dtext=!this.showrules
endmethod
--------------.Coll()-------------
--ËÑË÷Ôª¼þ
define method .Coll()
if (!this.paREGION.val eq '') then
!!ALERT.MESSAGE('ÇëÑ¡ÔñËÑË÷—¶Î§!')
return
endif
$!this.paREGION.val
if (!this.rules.size() gt 1) then
!rule = '(' + !this.rules[1]
!showrule = '(' +!this.showrules[1]
do !i from 2 to !this.rules.size()
!rule = !rule + ' AND ' + !this.rules[$!i]
!showrule = !showrule + ' AND ' + !this.showrules[$!i]
!this.rules.DeleteTo($!i,1)
!this.showrules.DeleteTo($!i,1)
enddo
!this.rules[1] = !rule + ')'
!this.showrules[1] = !showrule + ')'
!this.rules.unique()
!this.showrules.unique()
!this.liRULES.dtext = !this.showrules
endif

!type = !this.opTYPE.rtext[!this.opTYPE.val]
if !type eq 'ALL' then
!type = 'BRANCH MEMBER'
endif
if (!this.rules.size() eq 0) then
VAR !compname EVALUATE (FULLNAME) FOR ALL $!type FOR $!this.paREGION.val
else
VAR !compname EVALUATE (FULLNAME) FOR ALL $!type WITH ( $!this.rules[1] ) FO
R $!this.paREGION.val
HANDLE ANY
!!ALERT.MESSAGE('ËÑË÷Ìõ¼þ¿ÉÄÜ´æÔÚ´íÎó£¬Çë¼ì²é!!!')
RETURN
ENDHANDLE
endif
!this.liCOMP.dtext=!compname
!this.paCOMPNUM.val = string(!compname.size())
!this.CompNum = !this.paCOMPNUM.val
endmethod
--------------.GotoComp()---------------------
--ÊÓͼÌøתµ½Ôª¼þ
define method .GotoComp()
!comp = !this.liCOMP.rtext[$!this.liCOMP.val]
$!comp
Auto CE
endmethod
--------------.Execute()---------------
--¶ÔËùÓÐÔª¼þÖ´ÐÐÃüÁî
define method .Execute()
if (!this.liCOMP.rtext.size() eq 0) then
!!ALERT.MESSAGE('Ôª¼þÁбíΪ¿Õ!')
return
endif
if ( !this.txRCOMP.val eq '') then
!!ALERT.MESSAGE('ûÓпÉÖ´ÐÐÃüÁî!')
return
endif
if (!!ALERT.CONFIRM('¶ÔËùÓÐÔª¼þÖ´ÐдËÃüÁî?') NE 'YES') then
return
endif
do !n from 1 to !this.liCOMP.rtext.size()
$!this.liCOMP.dtext[$!n]
$!this.txRCOMP.val
HANDLE ANY
!!ALERT.MESSAGE('´íÎóµÄÃüÁî!')
RETURN
ENDHANDLE
enddo
!!ALERT.MESSAGE('ÃüÁîÖ´ÐÐÍê³É!')

endmethod
--------------.Region()---------------------
--ËÑË÷—¶Î§
define method .Region()
if (!!CE.TYPE EQ 'WORL') then
!!ALERT.MESSAGE('Ñ¡ÔñWORLDËÑË÷¿ÉÄܻỨ—Ѻܳ¤Ê±¼ä!')
endif
if (!!CE.TYPE NE 'SITE' AND !!CE.TYPE NE 'ZONE') then
ZONE
endif
!this.paREGION.val=!!CE.FULLNAME
endmethod
--------------.Help()---------------------
define method .Help()
syscom 'start wordpad %pdmsexe%\pmllib\newpml\HelpDocs\batchmodify.rtf'
HANDLE ANY
!!ALERT.MESSAGE('δÕÒµ½°ïÖúÎļþ!')
ENDHANDLE
endmethod
$.

You might also like