📄 admin_couarr.asp
字号:
<!--#include file="../conn.asp"-->
<!--#include file="../inc/inc.asp"-->
<!--#include file="inc/inc.asp"-->
<!--#include file="common/admin_couarr_inc.asp"-->
<%
HTMLother= script("admin_couarr","")
res w3chead(HTMLother),1
nowtit="课表"
Login_Judge
dimarr "tit"
powerid=1241
Ispower powerid
Dim lj_id,sem_id,Col_id
Dim rs_cla
action=che(request("action"))
Dim nows(8)
nows(0)="年届"
nows(1)="学期"
nows(2)="系所"
nows(3)="专业"
nows(4)="班级"
nows(5)="课程"
nows(6)="任课教师"
nows(7)="教学场地"
nows(8)="课时"
Dim nowlm(8)
nowlm(0)="lj_id"
nowlm(1)="sem_id"
nowlm(2)="Col_id"
nowlm(3)="pro_id"
nowlm(4)="cla_id"
nowlm(5)="cou_id"
nowlm(6)="tea_id"
nowlm(7)="addr"
nowlm(8)="couinfo"
If action="list" Then
restit nowtit,"生成管理"
'const MaxPerPage=10
nowmenu
all_listinfos
ElseIf action="Gener" Then
lj_id=che(request("lj_id"))
sem_id=che(request("sem_id"))
Dim temp0_i '定义初始化,存在教学方案的班级的个数
temp0_i=0
Dim temp1_i,temp2_i,temp3_i,temp4_i '临时编号变量
Dim temp_nowcla() '存在教学方案的班级ID记录集
Dim temp_nowcouinfo() '(班,时段)==》可分配课程信息
Dim temp_nowcoudis() '(班,时段)==》可课程分布
Dim temp_line1,temp_line2
Dim temp_str1
Dim rsedit
Dim temp_couinfo
Dim H
Dim coutable
sql=Sqlinfo("id","res_cla"," lj_id="&lj_id,"","","")
rs_cla = connopen(sql)
If IsArray(rs_cla) Then
temp_str1=UBound(rs_cla,2)
temp0_i=0
For temp1_i = 0 To temp_str1 '遍历选择年届下的所有班级
Sql_Lists="id,cou_id,tea_id,addr_id,couinfo,cla_id"
Sql_tables="couarr_plans"
Sql_Conditions=" cla_id in ("&rs_cla(0,temp1_i)&") and sem_id="&sem_id
sql=Sqlinfo(Sql_Lists,Sql_tables,Sql_Conditions,Sql_Sortings,Sql_Orders,Sql_Additional)
rs_plan = connopen(sql)
If IsArray(rs_plan)=True Then
temp0_i=temp0_i+1
ReDim Preserve temp_nowcla(temp0_i)
ReDim Preserve temp_nowcouinfo(3,temp0_i)
ReDim Preserve temp_nowcoudis(temp0_i)
Sql_Lists="coudis"
Sql_tables="couarr_dis"
Sql_Conditions=" cla_id in ("&rs_cla(0,temp1_i)&") and sem_id="&sem_id
sql=Sqlinfo(Sql_Lists,Sql_tables,Sql_Conditions,Sql_Sortings,Sql_Orders,Sql_Additional)
rs_dis = connopen(sql)
If IsArray(rs_dis) Then
temp_nowcoudis(temp0_i)=rs_dis(0,0)
Else
temp_nowcoudis(temp0_i)="0%0%0, 0%0%0, 0%0%0, 0%0%0, 0%0%0, 0%0%0||0%0%0, 0%0%0, 0%0%0, 0%0%0, 0%0%0, 0%0%0||0%0%0, 0%0%0, 0%0%0, 0%0%0, 0%0%0, 0%0%0||0%0%0, 0%0%0, 0%0%0, 0%0%0, 0%0%0, 0%0%0||0%0%0, 0%0%0, 0%0%0, 0%0%0, -1%-1%-1, -1%-1%-1||-1%-1%-1, -1%-1%-1, -1%-1%-1, -1%-1%-1, -1%-1%-1, -1%-1%-1||-1%-1%-1, -1%-1%-1, -1%-1%-1, -1%-1%-1, -1%-1%-1, -1%-1%-1"
End If
temp_nowcla(temp0_i)=rs_cla(0,temp1_i)
For temp2_i = 0 To UBound(rs_plan,2) '遍历所有方案
temp_couinfo=Split(rs_plan(4,temp2_i),", ")
For temp3_i = 0 To 3 '遍历时段
If Int(temp_couinfo(temp3_i))>0 Then
For temp4_i=0 To Int(temp_couinfo(temp3_i)) '遍历当前课程当前时段的课时数
temp_line1="" '课程分隔
If temp_nowcouinfo(temp3_i,temp0_i)<>"" Then temp_line1=", "
temp_nowcouinfo(temp3_i,temp0_i)=temp_nowcouinfo(temp3_i,temp0_i)&temp_line1&rs_plan(1,temp2_i)&"%"&rs_plan(3,temp2_i)&"%"&rs_plan(2,temp2_i)
Next
End If
Next
Next
End If
Next
End If
If temp0_i>0 Then
Dim temp_now_tea()
ReDim temp_now_tea(6,5)
Dim temp_now_addr()
reDim temp_now_addr(6,5)
Dim temp_nowcla_couinfo()
ReDim temp_nowcla_couinfo(temp0_i)
Dim temp_nowcla_w_cou,temp_nowcla_d_cou
Dim temp_d,temp_h,temp_c,temp_e
Dim temp_arr_nowcouinfo
Dim nowtemp_str1,nowtemp_str2,nowtemp_str3,nowtemp_str4
Dim temp_arr_nowinfo
Dim intcou
Dim temp_nowaddr_str,temp_nowtea_str,temp_now_str
For temp_d = 0 To 6 '一周七天
For temp_h = 0 To 5 '一天六个课时
For temp_c = 1 To temp0_i '不同班级
'If temp_c=1 Then res "<td>",1
temp_nowcla_w_cou=Split(temp_nowcoudis(temp_c),"||") '当前一周每天课时的情况
temp_nowcla_d_cou=Split(temp_nowcla_w_cou(temp_d),", ") '当前一天每课时的情况
If temp_nowcla_d_cou(temp_h)<>"-1%-1%-1" Then '当前课时是否设置为有课
'初始化课程范围数组中分布时段的值
If temp_h=0 Then temp1_i=0
If temp_h>0 And temp_h<3 Then temp1_i=1
If temp_h>2 And temp_h<6 Then temp1_i=2
If temp_h=6 Then temp1_i=3
If temp_nowcouinfo(temp1_i,temp_c)<>"" Then '取出当前计划的课程,如不为空刚随机选课
temp_arr_nowcouinfo=Split(temp_nowcouinfo(temp1_i,temp_c),", ")
temp3_i=0
intcou=False
Do While intcou=False
Set temp_arr_nowinfo=Nothing
randomize
H = Int((UBound(temp_arr_nowcouinfo)+1) * Rnd)
'随机数H
'出随机数Htemp_arr_nowcouinfo(H)
temp_now_str=temp_arr_nowcouinfo(H)
If temp_now_str<>"" Then
temp_arr_nowinfo=Split(temp_now_str,"%")
temp_nowaddr_str=temp_arr_nowinfo(1)' 场地
temp_nowtea_str=temp_arr_nowinfo(2)' 老师
If temp_now_tea(temp_d,temp_h)="" And temp_now_addr(temp_d,temp_h)="" Then
intcou=True
else
nowtemp_str1=Replace(" "&temp_now_tea(temp_d,temp_h)&","," "&temp_nowtea_str&",","")
nowtemp_str2=" "&temp_now_tea(temp_d,temp_h)&","
nowtemp_str3=Replace(" "&temp_now_addr(temp_d,temp_h)&","," "&temp_nowaddr_str&",","")
nowtemp_str4=" "&temp_now_addr(temp_d,temp_h)&","
If nowtemp_str1<>nowtemp_str2 And nowtemp_str3<>nowtemp_str4 Then intcou=True
End If
temp3_i=temp3_i+1
End If
If temp3_i=UBound(temp_arr_nowcouinfo)+1 Then Exit Do
Loop
If intcou=True And ubound(temp_arr_nowinfo)=2 Then '保存课程到数组
temp_nowcla_couinfo(temp_c)=temp_nowcla_couinfo(temp_c) & temp_now_str&", "
If temp_now_tea(temp_d,temp_h)<>"" Then temp_line1=", "
If temp_now_addr(temp_d,temp_h)<>"" Then temp_line2=", "
temp_now_addr(temp_d,temp_h)=temp_now_addr(temp_d,temp_h)&temp_line2&temp_nowaddr_str
temp_now_tea(temp_d,temp_h)=temp_now_tea(temp_d,temp_h)&temp_line1&temp_nowtea_str
temp_nowcouinfo(temp1_i,temp_c)=Replace(Replace(temp_nowcouinfo(temp1_i,temp_c),temp_arr_nowcouinfo(H),"",1,1),", , ",", ")
If Left(temp_nowcouinfo(temp1_i,temp_c),2)=", " Then temp_nowcouinfo(temp1_i,temp_c)=Replace(temp_nowcouinfo(temp1_i,temp_c),", ","",1,1)
temp_nowtea_str=""
temp_nowtea_str=""
Else
temp_nowcla_couinfo(temp_c)=temp_nowcla_couinfo(temp_c)&"0%0%0, "
End If
Else
temp_nowcla_couinfo(temp_c)=temp_nowcla_couinfo(temp_c)&"0%0%0, "
End If
Else
temp_nowcla_couinfo(temp_c)=temp_nowcla_couinfo(temp_c)&"0%0%0, "
End If
Next
Next
Next
Dim temp_coutable,temp_is
For temp_e= 1 To temp0_i
coutable=Split(CutStr3(temp_nowcla_couinfo(temp_e)),", ")
'response.write temp_nowcla_couinfo(temp_e) &"<br>"
temp_coutable=""
For temp_is=0 To 41
temp_coutable=temp_coutable & coutable(temp_is)
If (temp_is+1) Mod 6 =0 And temp_is<41 Then
temp_coutable=temp_coutable & "||"
ElseIf temp_is<41 Then
temp_coutable=temp_coutable & ", "
End If
Next
set rsedit=server.createobject("adodb.recordset")
Sql_Lists=" * "
Sql_tables="couarr_info"
Sql_Conditions=" cla_id in ("&temp_nowcla(temp_e)&") and sem_id="&sem_id
sql=Sqlinfo(Sql_Lists,Sql_tables,Sql_Conditions,Sql_Sortings,Sql_Orders,Sql_Additional)
rsedit.open sql,conn,1,3
If rsedit.eof Then
conn.execute("insert into couarr_info(coutab,cla_id,sem_id) values('"&temp_coutable&"',"&temp_nowcla(temp_e)&","&sem_id&")" )
Else
'继续修改
rsedit("sem_id") = sem_id
rsedit("cla_id") = temp_nowcla(temp_e)
rsedit("coutab") = temp_coutable
rsedit.Update
End If
rsedit.close
Next
rightmsg "admin_couarr.asp?action=list","课表生成成功"
Else
errormsg "当前范围内的班级还没有添加教学方案!"
End If
Set temp_coutable=Nothing
Set temp_is=Nothing
Set temp0_i=Nothing '定义初始化,存在教学方案的班级的个数
Set temp1_i=Nothing
Set temp2_i=Nothing
Set temp3_i=Nothing '临时编号变量
Set temp_d=Nothing
Set temp_h=Nothing
Set temp_c=Nothing
Set temp_arr_nowcouinfo=Nothing
Set nowtemp_str1=Nothing
Set nowtemp_str2=Nothing
Set nowtemp_str3=Nothing
Set nowtemp_str4=Nothing
Set intcou=Nothing
Set temp_line1=Nothing
Erase temp_now_tea
Erase temp_now_addr
Erase temp_arr_nowinfo
Erase coutable
Erase temp_nowcla '存在教学方案的班级ID记录集
Erase temp_nowcouinfo '(班,时段)==》可分配课程信息
Erase temp_nowcoudis '(班,时段)==》可课程分布
Erase temp_now_addr
Erase temp_nowcla_couinfo
Erase temp_nowcla_couinfo
Erase temp_nowcla_w_cou
Erase temp_nowcla_d_cou
Erase coutable
Erase temp_nowcla_couinfo
ElseIf action="manager" Then
restit nowtit,"信息查看"
'const MaxPerPage=10
nowmenu
man_listinfos
End If
res footer(1),0
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -