📄 分组.bak
字号:
***第四步
***从队员总表.dbf 到数组A,A到B,B到表-------现在做的是无报名成绩的情况的分组,采用斜线分组的方法!!!!
*!* set path to c:\zbydhxt
use 竞赛参数.dbf in 0 alias xxx1
sele xxx1
chengji=是否有成绩
if chengji=.T.
***第四步
***从队员总表.dbf 到数组A,A到表-------现在做的是有报名成绩的情况的分组,采用蛇形分组的方法!!!!
*!* set path to c:\zbydhxt
use 队员总表.dbf in 0 alias xxx2
use 各项目单位名单.dbf in 0 alias xxx3
use 分组后存放表.dbf in 0 alias xxx5
use 统计表.dbf in 0 alias xxx6
sele xxx5
zap
sele xxx2
sort to jjj on 报名成绩/A for left(ltrim(trim(项目代码)),1)='J'
sort to ttt on 报名成绩/D for left(ltrim(trim(项目代码)),1)='T'
use jjj in 0 alias xxjj
use ttt in 0 alias xxtt
sele xxx6
go 1
do while .not.eof()
xmdm=项目代码
xmmc=项目名称
xb=性别
zb=分组名称
fzs=分组数
zs1=组数1
zs2=组数2
rs1=人数1
rs2=人数2
dws=单位数
zrs=总人数
rrr=单位的最多人数
skip
if left(xmdm,1)='J'&&&径赛项目的分组
sele xxjj
endif
if left(xmdm,1)='T'
sele xxtt
endif
if left(xmdm,2)<>'JL'.and.zrs>1
dimension A [zrs]
store 'not' to A
******************************************************************************
set filter to 分组名称=zb.and.性别=xb.and.项目代码=xmdm
n=1
locate for 分组名称=zb.and.性别=xb.and.项目代码=xmdm
do while .not.eof()
hm=号码
skip
A(n)=hm
n=n+1
enddo
set filter to
*!* clear
*****************************************************************************
&&&&&&完成一个项目,一个组别,一个性别的所有单位的表到数组A的输入过程
***********************************程序要继续向下进行
yyy=1
xxx=1
hhh=0
xxhh=1
if zs1#0
for eee1=1 to zs1
for eee2=1 to rs1
hhh=A(yyy)
yyy=yyy+1
sele xxx5
append blank
repl 号码 with hhh,机器分组号 with xxx,项目代码 with xmdm,;
项目名称 with xmmc,性别 with xb,分组名称 with zb,序号 with xxhh
xxhh=xxhh+1
endfor
xxx=xxx+1
endfor
endif
if zs2#0
for pp=1 to zs2
for qq=1 to rs2
hhh=B (yyy)
yyy=yyy+1
sele xxx5
append blank
repl 号码 with hhh,机器分组号 with xxx,项目代码 with xmdm,;
项目名称 with xmmc,性别 with xb,分组名称 with zb,序号 with xxhh
xxhh=xxhh+1
endfor
xxx=xxx+1
endfor
endif
******************************************************************************
endif
sele xxx6
enddo
******************************************************************************
***给号码赋姓名
sele xxx5
go 1
do while .not.eof()
hm=号码
sele xxx2
locate for 号码=hm
if found()
xm=姓名
dwdm=单位代码
sele xxx5
repl 姓名 with xm,单位代码 with dwdm
endif
sele xxx5
skip
enddo
*****接力项目
sele xxx6
set filter to left(项目代码,2)<>'JL' &&&&&&&&项目代码="JL1".or.项目代码="JL2"
go top
do while .not.eof()
xmdm=项目代码
xmmc=项目名称
xb=性别
zb=分组名称
zs1=组数1
zs2=组数2
rs1=人数1
rs2=人数2
dws=单位数
skip
sele xxx3
set filter to 项目代码=xmdm.and.性别=xb.and.分组名称=zb
xxhh=1
go top
do while .not.eof()
dwdm=单位代码
skip
sele xxx5
append blank
repl 机器分组号 with 1,项目代码 with xmdm,项目名称 with xmmc,性别 with xb,;
分组名称 with zb,序号 with xxhh,单位代码 with dwdm &&&&,号码 with dwdmtoc
xxhh=xxhh+1
sele xxx3
enddo
set filter to
sele xxx6
enddo
set filter to
use 单位初始.dbf in 0 alias dwcs
sele xxx5
go 1
do while .not.eof()
dwdm=单位代码
sele dwcs
locate for 单位代码=dwdm
if found()
dwjc=单位简称
sele xxx5
repl 单位简称 with dwjc
endif
sele xxx5
skip
enddo
sele dwcs
use
sele xxx2
use
sele xxx3
use
sele xxx5
use
sele xxx6
use
sele xxjj
use
sele xxtt
use
dele file xxjj.dbf
dele file xxtt.dbf
endif
if chengji=.F.
use 队员总表.dbf in 0 alias xxx2
use 各项目单位名单.dbf in 0 alias xxx3
use 分组后存放表.dbf in 0 alias xxx5
use 统计表.dbf in 0 alias xxx6
sele xxx5
zap
sele xxx6
go 1
do while .not.eof()
xmdm=项目代码
xmmc=项目名称
xb=性别
zb=分组名称
zs1=组数1
zs2=组数2
rs1=人数1
rs2=人数2
dws=单位数
zrs=总人数
rrr=单位的最多人数
skip
if left(xmdm,2)<>'JL'.and.zrs>1
dimension A [rrr,dws]
store 'not' to A
******************************************************************************
m=1
sele xxx3
set filter to 分组名称=zb.and.性别=xb.and.项目代码=xmdm
locate for 分组名称=zb.and.性别=xb.and.项目代码=xmdm
**goto 1
do while .not.eof()
dwdm=单位代码
skip
sele xxx2
set filter to 分组名称=zb.and.性别=xb.and.项目代码=xmdm.and.单位代码=dwdm
n=1
locate for 分组名称=zb.and.性别=xb.and.项目代码=xmdm.and.单位代码=dwdm
*goto 1
do while .not.eof()
hm=号码
skip
A(n,m)=hm
n=n+1
enddo
m=m+1
set filter to
sele xxx3
enddo
clear
set filter to
*****************************************************************************
&&&&&&完成一个项目,一个组别,一个性别的所有单位的表到数组A的输入过程
***********************************程序要继续向下进行
***从数组A到数组B的过程
for ee=1 to rrr
for rr=1 to dws
?a(ee,rr)
endfor
endfor
Dimension B [zrs]
store 'not' to B
***第一次取值
r=1
t=1
do while .T.
for s=1 to rrr &&&&rrr最多参赛人数
if a(s,r)#'not'
B (t)=A (s,r)
t=t+1
r=r+1
else
r=r+1
endif
if r>dws
exit
endif
endfor
if r>dws
exit
endif
enddo
***第二次取值***
r=2
do while .T.
for s=1 to rrr
if A(s,r)#'not'
B (t)=A (s,r)
t=t+1
r=r+1
else
r=r+1
endif
if r>dws
exit
endif
endfor
if r>dws
exit
endif
enddo
****************************************
***第三次
if rrr=3 &&&&当最多参赛人数等于三人时
if A (2,1)#'not'
B (t)=A (2,1)
t=t+1
endif
if A (3,2)#'not'
B (t)=A (3,2)
t=t+1
endif
r=3
do while .T.
for s=1 to rrr
if A (s,r)#'not'
B (t)=A (s,r)
t=t+1
r=r+1
else
r=r+1
endif
if r>dws
exit
endif
endfor
if r>dws
exit
endif
enddo
endif
*************************************************
****当单位的参加人数为4人时的情况是这样的!!!注:这是我加的!!
if rrr=4
if A (2,1)#'not'
B (t)=A (2,1)
t=t+1
endif
if A (3,2)#'not'
B (t)=A (3,2)
t=t+1
endif
if A(4,3)#'not'
B(t)=A(4,3)
t=t+1
endif
r=4
do while .T.
for s=1 to rrr
if A (s,r)#'not'
B (t)=A (s,r)
t=t+1
r=r+1
else
r=r+1
endif
if r>dws
exit
endif
endfor
if r>dws
exit
endif
enddo
if A(3,1)#'not'
B(t)=A(3,1)
t=t+1
endif
if A(4,2)#'not'
B(t)=A(4,2)
t=t+1
endif
endif &&&&&这是4人的情况结束!!!!
*****************************************************
***最后取一个值
if A (rrr,1)#'not'
B (zrs)=A (rrr,1)
endif
*!* for i = 1 to zrs
*!* ?? b(i)
*!* endfor
*!* ******************************************************************
*!* ****从数组B到表的过程
yyy=1
xxx=1
hhh=0
xxhh=1
if zs1#0
for eee1=1 to zs1
for eee2=1 to rs1
hhh=B(yyy)
yyy=yyy+1
sele xxx5
append blank
repl 号码 with hhh,机器分组号 with xxx,项目代码 with xmdm,;
项目名称 with xmmc,性别 with xb,分组名称 with zb,序号 with xxhh
xxhh=xxhh+1
endfor
xxx=xxx+1
endfor
endif
if zs2#0
for pp=1 to zs2
for qq=1 to rs2
hhh=B (yyy)
yyy=yyy+1
sele xxx5
append blank
repl 号码 with hhh,机器分组号 with xxx,项目代码 with xmdm,;
项目名称 with xmmc,性别 with xb,分组名称 with zb,序号 with xxhh
xxhh=xxhh+1
endfor
xxx=xxx+1
endfor
endif
********************************************************************************
***不分道跑的项目(长跑和田赛项目的分组)由B数组到分组表0.dbf的情况是:现根据体育学院的具体情况制定
************************************************************
***else &&&&&如果是接力项目怎么办
endif
sele xxx6
enddo
******************************************************************************
***给号码赋姓名
sele xxx5
go 1
do while .not.eof()
hm=号码
sele xxx2
locate for 号码=hm
if found()
xm=姓名
dwdm=单位代码
sele xxx5
repl 姓名 with xm,单位代码 with dwdm
endif
sele xxx5
skip
enddo
*****接力项目
sele xxx6
set filter to left(项目代码,2)<>'JL' &&&&&&&&项目代码="JL1".or.项目代码="JL2"
go top
do while .not.eof()
xmdm=项目代码
xmmc=项目名称
xb=性别
zb=分组名称
zs1=组数1
zs2=组数2
rs1=人数1
rs2=人数2
dws=单位数
skip
sele xxx3
set filter to 项目代码=xmdm.and.性别=xb.and.分组名称=zb
xxhh=1
go top
do while .not.eof()
dwdm=单位代码
skip
sele xxx5
append blank
repl 机器分组号 with 1,项目代码 with xmdm,项目名称 with xmmc,性别 with xb,;
分组名称 with zb,序号 with xxhh,单位代码 with dwdm &&&&,号码 with dwdmtoc
xxhh=xxhh+1
sele xxx3
enddo
set filter to
sele xxx6
enddo
set filter to
use 单位初始.dbf in 0 alias dwcs
sele xxx5
go 1
do while .not.eof()
dwdm=单位代码
sele dwcs
locate for 单位代码=dwdm
if found()
dwjc=单位简称
sele xxx5
repl 单位简称 with dwjc
endif
sele xxx5
skip
enddo
sele dwcs
use
sele xxx2
use
sele xxx3
use
sele xxx5
use
sele xxx6
use
endif
sele xxx1
use
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -