set talk off set stat on set dele onclear wind close all clearif .not.file('rout\welroutnew.txt') ? ? 'Not found Data file : rout\welroutnew.txt' =inkey(3) clear return endifif file('welroutxt.dbf') erase welroutxt.dbf endif creat table welroutxt ( fz C(3), fzhz C(10), dz C(3), dzhz C(10); , bdi C(2), bdo C(2), b2 C(2), bdic C(2), bdoc C(2), fjk C(120),verc C(8) )close all sele 2 use welroutxt zap appe blanksele 1 creat table txt100 ( txt C(100) ) zap appe sdf from rout\welroutnew.txt go top recnum=0do while .not.eof(1)do while subs(txt,1,5)<>'发站:' and .not.eof(1) skip enddo if eof(1) ? ? '分析路径文本完成.' exit endif@ 3,6 say str(recn(),8)+' /'+str(recc(),8)+' 'recnum=recn() fzhz1=trim(subs(txt,7,10)) skip dzhz1=trim(subs(txt,7,10)) skip 8 && Seek for 分界站 fjk0='' fjk1='' fjk2='' fjk3='' fjk4=''do while subs(txt,5,10)>' ' fjk1=ltrim(subs(txt,5,10)) fjk0=fjk0+','+fjk1if at(fjk1,'株洲,蒲圻,滩头湾,楠木塘;大龙,秀山;西斋;牙屯堡;;')>0 fjk2=fjk2+':'+padr(fjk1,6) endifif at(fjk1,';天水;平顶山西;郜营;胡家营;虞城县;')>0 fjk3=':'+padr(fjk1,6) endif if at(fjk1,';叶集;淮滨;攀枝花;凤凰山;六盘水南;')>0 fjk3=':'+padr(fjk1,6) endif if at(fjk1,';茂名,定南,琥市;;西河村,麻尾,威舍,达州,广元;')>0 fjk3=':'+padr(fjk1,6) fjk3=strtran(fjk3,'西河村','河西村') endifif len(trim(fjk2))>15 and at('西河村',fjk2)>0 fjk2=strtran(fjk2,'西河村','') endif if len(trim(fjk2))>15 and at('河西村',fjk2)>0 fjk2=strtran(fjk2,'河西村','') endif if len(trim(fjk2))>15 and at(':麻尾 ',fjk2)>0 fjk2=strtran(fjk2,':麻尾 ','') endif if len(trim(fjk2))>15 and at(':威舍 ',fjk2)>0 fjk2=strtran(fjk2,':威舍 ','') endif if len(trim(fjk2))>15 and at(':达州 ',fjk2)>0 fjk2=strtran(fjk2,':达州 ','') endif if len(trim(fjk2))>15 and at(':广元 ',fjk2)>0 fjk2=strtran(fjk2,':广元 ','') endifskip enddoif len(trim(fjk2))<1 fjk2=fjk3 endif fjk2=padr(fjk2,21,' ')fjk4=fjk2+':'+fjk0sele 2 *use rout\welroutxt appe blank repl fzhz with fzhz1, dzhz with dzhz1, fjk with fjk4sele 1enddo && Seek fz In welroutnew.txtuse sele 3 use welzmb alias zmbsele 2 go topscan all@ 8,6 say str(recn(),8)+' /'+str(recc(),8)+' 'fzhz1=trim(fzhz) dzhz1=trim(dzhz) sele zmb loca for zmhz=fzhz1 and zmm<>b.fz if found() sele 2 repl fz with zmb.zmm if at(zmb.fj,'HH,CS,SC')>0 repl bdic with '99' endif endifsele zmb loca for zmhz=dzhz1 and zmm<>b.dz if found() sele 2 repl dz with zmb.zmm if at(zmb.fj,'HH,CS,SC')>0 repl bdoc with '99' endif endifsele 2 bdic1=subs(fjk,2,2) bdoc1=subs(fjk,9,2) if empty(bdoc1) and empty(bdoc) bdoc1=bdic1 endifif subs(fz,3,1)='Q' and empty(bdic1) bdic1='99' endif if subs(dz,3,1)='Q' and empty(bdoc1) bdoc1='99' endifif empty(bdic) repl bdic with bdic1 endif if empty(bdoc) repl bdoc with bdoc1 endifif subs(fz,3,1)<>'Q' and empty(bdic) *repl bdic with 'oo' endif if subs(dz,3,1)<>'Q' and empty(bdoc) *repl bdoc with 'oo' endifif subs(fz,3,1)='Q' and bdic=bdoc *repl bdic with '99' endif if subs(dz,3,1)='Q' and bdic=bdoc *repl bdoc with '99' endifsele 2 fz1=fz dz1=dzsele 2 scat to memovar sele zmb loca for zmb.zmhz=fzhz1 and zmb.zmm<>b.fz if found() sele 2 inse blank gath from memovar repl fz with zmb.zmm endif sele 2 scat to memovar sele zmb loca for zmb.zmhz=dzhz1 and zmb.zmm<>b.dz if found() sele 2 inse blank gath from memovar repl dz with zmb.zmm endifif 1=1 sele 2 scat to memovar sele zmb loca for zmb.zmm=b.fz and zmb.zmhz<>b.fzhz if found() sele 2 inse blank gath from memovar repl fzhz with zmb.zmhz endif sele 2 scat to memovar sele zmb loca for zmb.zmm=b.dz and zmb.zmhz<>b.dzhz if found() sele 2 inse blank gath from memovar repl dzhz with zmb.zmhz endifsele 2 scat to memovar sele zmb loca for zmb.zmm=fz1 and zmb.zmhz<>fzhz1 if found() sele 2 inse blank gath from memovar repl fz with fz1, fzhz with zmb.zmhz endif sele 2 scat to memovar sele zmb loca for zmb.zmm=dz1 and zmb.zmhz<>dzhz1 if found() sele 2 inse blank gath from memovar repl dz with dz1, dzhz with zmb.zmhz endifendif && appe same zmhz or zmlmsele 2 endscanrepl fz with 'FGZ' for empty(fz) and fzhz='防城港口' repl dz with 'FGZ' for empty(dz) and dzhz='防城港口' repl fz with 'DIQ', bdic with '99' for empty(fz) and fzhz='张家界南' repl dz with 'DIQ', bdoc with '99' for empty(dz) and dzhz='张家界南'brow title '分界口太多或太少' for .not.empty(fzhz) and ( len(trim(subs(fjk,1,21)))>15; or empty(subs(fjk,1,21)) and (subs(fz,3,1)<>'Q' or subs(dz,3,1)<>'Q') )*repl all cars with 1 copy sdf to rout\welrout0.txt for .not.empty(fzhz) and .not.empty(dzhz) close all use txt100 zapdo welroutaddreturn VF下可以用这样的实现!全部导入一个表中!
set stat on
set dele onclear wind
close all
clearif .not.file('rout\welroutnew.txt')
?
? 'Not found Data file : rout\welroutnew.txt'
=inkey(3)
clear
return
endifif file('welroutxt.dbf')
erase welroutxt.dbf
endif
creat table welroutxt ( fz C(3), fzhz C(10), dz C(3), dzhz C(10);
, bdi C(2), bdo C(2), b2 C(2), bdic C(2), bdoc C(2), fjk C(120),verc C(8) )close all
sele 2
use welroutxt
zap
appe blanksele 1
creat table txt100 ( txt C(100) )
zap
appe sdf from rout\welroutnew.txt
go top
recnum=0do while .not.eof(1)do while subs(txt,1,5)<>'发站:' and .not.eof(1)
skip
enddo
if eof(1)
?
? '分析路径文本完成.'
exit
endif@ 3,6 say str(recn(),8)+' /'+str(recc(),8)+' 'recnum=recn()
fzhz1=trim(subs(txt,7,10))
skip
dzhz1=trim(subs(txt,7,10))
skip 8 && Seek for 分界站
fjk0=''
fjk1=''
fjk2=''
fjk3=''
fjk4=''do while subs(txt,5,10)>' '
fjk1=ltrim(subs(txt,5,10))
fjk0=fjk0+','+fjk1if at(fjk1,'株洲,蒲圻,滩头湾,楠木塘;大龙,秀山;西斋;牙屯堡;;')>0
fjk2=fjk2+':'+padr(fjk1,6)
endifif at(fjk1,';天水;平顶山西;郜营;胡家营;虞城县;')>0
fjk3=':'+padr(fjk1,6)
endif
if at(fjk1,';叶集;淮滨;攀枝花;凤凰山;六盘水南;')>0
fjk3=':'+padr(fjk1,6)
endif
if at(fjk1,';茂名,定南,琥市;;西河村,麻尾,威舍,达州,广元;')>0
fjk3=':'+padr(fjk1,6)
fjk3=strtran(fjk3,'西河村','河西村')
endifif len(trim(fjk2))>15 and at('西河村',fjk2)>0
fjk2=strtran(fjk2,'西河村','')
endif
if len(trim(fjk2))>15 and at('河西村',fjk2)>0
fjk2=strtran(fjk2,'河西村','')
endif
if len(trim(fjk2))>15 and at(':麻尾 ',fjk2)>0
fjk2=strtran(fjk2,':麻尾 ','')
endif
if len(trim(fjk2))>15 and at(':威舍 ',fjk2)>0
fjk2=strtran(fjk2,':威舍 ','')
endif
if len(trim(fjk2))>15 and at(':达州 ',fjk2)>0
fjk2=strtran(fjk2,':达州 ','')
endif
if len(trim(fjk2))>15 and at(':广元 ',fjk2)>0
fjk2=strtran(fjk2,':广元 ','')
endifskip
enddoif len(trim(fjk2))<1
fjk2=fjk3
endif
fjk2=padr(fjk2,21,' ')fjk4=fjk2+':'+fjk0sele 2
*use rout\welroutxt
appe blank
repl fzhz with fzhz1, dzhz with dzhz1, fjk with fjk4sele 1enddo && Seek fz In welroutnew.txtuse
sele 3
use welzmb alias zmbsele 2
go topscan all@ 8,6 say str(recn(),8)+' /'+str(recc(),8)+' 'fzhz1=trim(fzhz)
dzhz1=trim(dzhz)
sele zmb
loca for zmhz=fzhz1 and zmm<>b.fz
if found()
sele 2
repl fz with zmb.zmm
if at(zmb.fj,'HH,CS,SC')>0
repl bdic with '99'
endif
endifsele zmb
loca for zmhz=dzhz1 and zmm<>b.dz
if found()
sele 2
repl dz with zmb.zmm
if at(zmb.fj,'HH,CS,SC')>0
repl bdoc with '99'
endif
endifsele 2
bdic1=subs(fjk,2,2)
bdoc1=subs(fjk,9,2)
if empty(bdoc1) and empty(bdoc)
bdoc1=bdic1
endifif subs(fz,3,1)='Q' and empty(bdic1)
bdic1='99'
endif
if subs(dz,3,1)='Q' and empty(bdoc1)
bdoc1='99'
endifif empty(bdic)
repl bdic with bdic1
endif
if empty(bdoc)
repl bdoc with bdoc1
endifif subs(fz,3,1)<>'Q' and empty(bdic)
*repl bdic with 'oo'
endif
if subs(dz,3,1)<>'Q' and empty(bdoc)
*repl bdoc with 'oo'
endifif subs(fz,3,1)='Q' and bdic=bdoc
*repl bdic with '99'
endif
if subs(dz,3,1)='Q' and bdic=bdoc
*repl bdoc with '99'
endifsele 2
fz1=fz
dz1=dzsele 2
scat to memovar
sele zmb
loca for zmb.zmhz=fzhz1 and zmb.zmm<>b.fz
if found()
sele 2
inse blank
gath from memovar
repl fz with zmb.zmm
endif
sele 2
scat to memovar
sele zmb
loca for zmb.zmhz=dzhz1 and zmb.zmm<>b.dz
if found()
sele 2
inse blank
gath from memovar
repl dz with zmb.zmm
endifif 1=1
sele 2
scat to memovar
sele zmb
loca for zmb.zmm=b.fz and zmb.zmhz<>b.fzhz
if found()
sele 2
inse blank
gath from memovar
repl fzhz with zmb.zmhz
endif
sele 2
scat to memovar
sele zmb
loca for zmb.zmm=b.dz and zmb.zmhz<>b.dzhz
if found()
sele 2
inse blank
gath from memovar
repl dzhz with zmb.zmhz
endifsele 2
scat to memovar
sele zmb
loca for zmb.zmm=fz1 and zmb.zmhz<>fzhz1
if found()
sele 2
inse blank
gath from memovar
repl fz with fz1, fzhz with zmb.zmhz
endif
sele 2
scat to memovar
sele zmb
loca for zmb.zmm=dz1 and zmb.zmhz<>dzhz1
if found()
sele 2
inse blank
gath from memovar
repl dz with dz1, dzhz with zmb.zmhz
endifendif && appe same zmhz or zmlmsele 2
endscanrepl fz with 'FGZ' for empty(fz) and fzhz='防城港口'
repl dz with 'FGZ' for empty(dz) and dzhz='防城港口'
repl fz with 'DIQ', bdic with '99' for empty(fz) and fzhz='张家界南'
repl dz with 'DIQ', bdoc with '99' for empty(dz) and dzhz='张家界南'brow title '分界口太多或太少' for .not.empty(fzhz) and ( len(trim(subs(fjk,1,21)))>15;
or empty(subs(fjk,1,21)) and (subs(fz,3,1)<>'Q' or subs(dz,3,1)<>'Q') )*repl all cars with 1
copy sdf to rout\welrout0.txt for .not.empty(fzhz) and .not.empty(dzhz)
close all
use txt100
zapdo welroutaddreturn
VF下可以用这样的实现!全部导入一个表中!