Foxtable(狐表)用户栏目专家坐堂 → 请教一个排班问题


  共有4933人关注过本帖平板打印复制链接

主题:请教一个排班问题

帅哥哟,离线,有人找我吗?
liufucan
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:三尾狐 帖子:646 积分:5691 威望:0 精华:0 注册:2017/4/7 12:15:00
  发帖心情 Post By:2018/5/26 15:34:00 [只看该作者]

我把代码这么改了一下并增加了一个自定义函数testcount
Dim count As Integer = 0
Dim Names As List(Of Integer) = Args(0)
Dim Val As Integer = Args(1)

For t As Integer = 0 To (Names.Count-1)
           
If Names.Contains(Val)= True Then
    count = count+1
End If

Next

Return count

光星期一测试没问题,加上别的星期就卡住了
Dim lst100 As new List(of Integer) 
Dim lst200 As new List(of Integer) 
For Each dr As DataRow In DataTables("表b").DataRows
Select Case dr("星期")
 Case "星期一"
      dr("假期")="1,2"
Dim ids1 As String
Dim lst1 As new List(of Integer) 
Dim lst11 As new List(of Integer) 
Dim v1() As Integer = {1,2,3,4,5,6,7,8,9,10}
lst11.AddRange(v1)
 lst1.Add(1)
 lst1.Add(2)
lst11.Remove(1)
lst11.Remove(2)
Do  While lst1.count < 4     
Dim id As Integer = rand.Next(1,10)
          If lst1.Contains(id) = False And Functions.Execute("testcount",lst100,id) < 6 Then
        lst1.Add(id)
lst100.Add(id)
lst11.Remove(id)
ids1 = ids1 & id & ","
    End If
 
   Loop 
dr("晚班")= ids1.Trim(",")
ids1 = ""
Do  While lst1.count < 5     
Dim id As Integer = rand.Next(1,10)
          If lst1.Contains(id) = False And Functions.Execute("testcount",lst200,id) < 3 Then
        lst1.Add(id)
lst200.Add(id)
lst11.Remove(id)
ids1 = ids1 & id & ","
    End If
 
   Loop 
dr("早班")= ids1.Trim(",")
ids1 = ""

For t As Integer = 0 To (lst11.Count-1)
        ids1 = ids1 & lst11(t) & ","
    Next
dr("正常班")= ids1.Trim(",")
ids1 = ""

lst1.Clear
lst11.Clear
 lst1.Add(1)
 lst1.Add(2)
lst11.Remove(1)
lst11.Remove(2)


 回到顶部
总数 31 1 2 3 4 下一页