Foxtable(狐表)用户栏目专家坐堂 → [求助]开一个帖请教问题~


  共有3663人关注过本帖树形打印复制链接

主题:[求助]开一个帖请教问题~

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


加好友 发短信
等级:幼狐 帖子:184 积分:1148 威望:0 精华:0 注册:2014/6/10 20:24:00
[求助]开一个帖请教问题~  发帖心情 Post By:2014/7/13 10:40:00 [只看该作者]

当天装配表控制代码生成~ 然后我想昨天品种和昨天配比 显示该用户昨天的配比情况 前天品种和前天配比列显示 前天该用户的配比情况~ (从装配表里面读出来对应的历史配比记录)
其中自动生成装箱配比 代码如下(有点甜大哥帮忙解决的 自己有点小调整):
Tables("装配表").DataTable.DeleteFor(" [日期] = '" & e.Form.Controls("DateTimePicker1").Value & "'")
Tables("装配表").Filter=" [日期] = '" & e.Form.Controls("DateTimePicker1").Value & "'"
SystemReady = False
Dim n As Integer=0

Dim drs As List(Of DataRow) = DataTables("蔬菜采收表").Select("日期 = #" & e.Sender.Text & "#")
For Each dr As DataRow In DataTables("当天配送会员").Select("日期 = #" & e.Sender.Text & "#")
    '统计是否满足装箱总斤数
    n=0
    For Each cdr As DataRow In drs
        Dim ndr As DataRow = DataTables("装配表").addnew
        
        ndr("日期") = dr("日期")
        ndr("会员编号") = dr("会员编号")
        ndr("品种") = cdr("品种")
        ndr("装箱总斤数")=dr("装箱斤数")
        Dim fdr As DataRow = DataTables("蔬菜喜好表").Find("会员编号 = '" & dr("会员编号") & "' and 产品 = '" & cdr("品种") & "'")
        If fdr IsNot Nothing Then
            ndr("喜好") = fdr("喜好")
            If fdr("喜好") = "吃" Then
                ndr("配比") = 1
            ElseIf fdr("喜好") = "爱吃" Then
                ndr("配比") = 2
            Else
                ndr("配比") = 0
            End If
            '没有找到记录     '
        Else
            n=n+1
            If n<=5 Then
                ndr("喜好")="吃"
                ndr("配比") = 1
            Else
                ndr("喜好")="不吃"
                ndr("配比") = 0
            End If
        End If
    Next
Next
For Each dr As DataRow In DataTables("装配表").Select("日期 = #" & e.Sender.Text & "#")
    dr("小计") = DataTables("装配表").compute("sum(配比)", "日期 = #" & dr("日期") & "# and 会员编号 = '" & dr("会员编号") & "'")
    dr("装箱参考")=dr("配比")
Next

SystemReady = True

Dim t As Table = Forms("装配窗体").Controls("Table1").Table
Dim b As New GroupTableBuilder("统计表1", DataTables("装配表"))
b.Groups.AddDef("品种") '根据产品分组
b.Totals.AddDef("配比", AggregateEnum.Sum, "总数量") '对数量进行统计
b.Filter = "日期 = #" & e.Sender.Text & "#"
t.DataSource = b.BuildDataSource '生成统计表
t.DataTable.DataCols.Add("实际产量", Gettype(Integer))
For Each r As Row In t.Rows
    Dim fdr As DataRow = DataTables("蔬菜采收表").Find("日期 = #" & e.Sender.Text & "# And 品种 = '" & r("品种") & "'")
    If fdr IsNot Nothing Then
        r("实际产量") = fdr("实际产量")
    End If
Next

如果我要昨天品种和昨天配比 显示该用户昨天的配比情况 前天品种和前天配比列显示 前天该用户的配比情况  怎么在这个里面加代码读取实现呢?求大神指点下 不知道如何下手
图片点击可在新窗口打开查看此主题相关图片如下:33.png
图片点击可在新窗口打开查看
图片点击可在新窗口打开查看此主题相关图片如下:34.png
图片点击可在新窗口打开查看


 回到顶部
帅哥哟,离线,有人找我吗?
good131577
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:184 积分:1148 威望:0 精华:0 注册:2014/6/10 20:24:00
  发帖心情 Post By:2014/7/13 10:42:00 [只看该作者]

代码工程上传下~ foxtable开发版的  大神麻烦看下~ 求指导
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:装配 新项目.rar


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/7/13 11:51:00 [只看该作者]

 代码

 

Tables("装配表").DataTable.DeleteFor(" [日期] = '" & e.Form.Controls("DateTimePicker1").Value & "'")
Tables("装配表").Filter=" [日期] = '" & e.Form.Controls("DateTimePicker1").Value & "'"
SystemReady = False
Dim n,n1,n2 As Integer

Dim d As Date = e.Sender.Text

Dim drs As List(Of DataRow) = DataTables("蔬菜采收表").Select("日期 = #" & d & "#")
Dim drs_y As List(Of DataRow) = DataTables("蔬菜采收表").Select("日期 = #" & d.AddDays(-1) & "#")
Dim drs_by As List(Of DataRow) = DataTables("蔬菜采收表").Select("日期 = #" & d.AddDays(-2) & "#")
For Each dr As DataRow In DataTables("当天配送会员").Select("日期 = #" & d & "#")
    '统计是否满足装箱总斤数
    n=0
    n1=0
    n2=0
    Dim idx As Integer = 0
    For Each cdr As DataRow In drs
        Dim ndr As DataRow = DataTables("装配表").addnew
        If idx < drs_y.Count - 1 Then
            ndr("昨天品种") = drs_y(idx)("品种")
            Dim fdr_y As DataRow = DataTables("蔬菜喜好表").Find("会员编号 = '" & dr("会员编号") & "' and 产品 = '" & drs_y(idx)("品种") & "'")
            If fdr_y IsNot Nothing Then
                If fdr_y("喜好") = "吃" Then
                    ndr("昨天配比") = 1
                ElseIf fdr_y("喜好") = "爱吃" Then
                    ndr("昨天配比") = 2
                Else
                    ndr("昨天配比") = 0
                End If
                '没有找到记录     '
            Else
                n1=n1+1
                If n1<=5 Then
                    ndr("昨天配比") = 1
                Else
                    ndr("昨天配比") = 0
                End If
            End If
           
        End If
        If idx < drs_by.Count - 1 Then
            ndr("前天品种") = drs_by(idx)("品种")
            Dim fdr_by As DataRow = DataTables("蔬菜喜好表").Find("会员编号 = '" & dr("会员编号") & "' and 产品 = '" & drs_by(idx)("品种") & "'")
            If fdr_by IsNot Nothing Then
                If fdr_by("喜好") = "吃" Then
                    ndr("前天配比") = 1
                ElseIf fdr_by("喜好") = "爱吃" Then
                    ndr("前天配比") = 2
                Else
                    ndr("前天配比") = 0
                End If
                '没有找到记录     '
            Else
                n2=n2+1
                If n2<=5 Then
                    ndr("前天配比") = 1
                Else
                    ndr("前天配比") = 0
                End If
            End If
        End If
        ndr("日期") = dr("日期")
        ndr("会员编号") = dr("会员编号")
        ndr("品种") = cdr("品种")
        ndr("装箱总斤数")=dr("装箱斤数")
        Dim fdr As DataRow = DataTables("蔬菜喜好表").Find("会员编号 = '" & dr("会员编号") & "' and 产品 = '" & cdr("品种") & "'")
       
        If fdr IsNot Nothing Then
            ndr("喜好") = fdr("喜好")
            If fdr("喜好") = "吃" Then
                ndr("配比") = 1
            ElseIf fdr("喜好") = "爱吃" Then
                ndr("配比") = 2
            Else
                ndr("配比") = 0
            End If
            '没有找到记录     '
        Else
            n=n+1
            If n<=5 Then
                ndr("喜好")="吃"
                ndr("配比") = 1
            Else
                ndr("喜好")="不吃"
                ndr("配比") = 0
            End If
        End If
       
       
        idx += 1
    Next
Next
For Each dr As DataRow In DataTables("装配表").Select("日期 = #" & d & "#")
    dr("小计") = DataTables("装配表").compute("sum(配比)", "日期 = #" & dr("日期") & "# and 会员编号 = '" & dr("会员编号") & "'")
    dr("装箱参考")=dr("配比")
Next

SystemReady = True

Dim t As Table = Forms("装配窗体").Controls("Table1").Table
Dim b As New GroupTableBuilder("统计表1", DataTables("装配表"))
b.Groups.AddDef("品种") '根据产品分组
b.Totals.AddDef("配比", AggregateEnum.Sum, "总数量") '对数量进行统计
b.Filter = "日期 = #" & d & "#"
t.DataSource = b.BuildDataSource '生成统计表
t.DataTable.DataCols.Add("实际产量", Gettype(Integer))
For Each r As Row In t.Rows
    Dim fdr As DataRow = DataTables("蔬菜采收表").Find("日期 = #" & d & "# And 品种 = '" & r("品种") & "'")
    If fdr IsNot Nothing Then
        r("实际产量") = fdr("实际产量")
    End If
Next


 回到顶部
帅哥哟,离线,有人找我吗?
good131577
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:184 积分:1148 威望:0 精华:0 注册:2014/6/10 20:24:00
[求助]试了下~  发帖心情 Post By:2014/7/13 12:19:00 [只看该作者]

我试验了下~ 结果是这样的 昨天和前天  茄子的品种和配比
图片点击可在新窗口打开查看此主题相关图片如下:41.png
图片点击可在新窗口打开查看
没有显示?好像漏掉了最后一个品种

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/7/13 12:26:00 [只看该作者]

 把 If idx < drs_by.Count - 1 Then

 

 改成 If idx < drs_by.Count Then


 回到顶部
帅哥哟,离线,有人找我吗?
good131577
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:184 积分:1148 威望:0 精华:0 注册:2014/6/10 20:24:00
了解~非常感谢  发帖心情 Post By:2014/7/13 13:17:00 [只看该作者]

大神级别图片点击可在新窗口打开查看

 回到顶部
帅哥哟,离线,有人找我吗?
good131577
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:184 积分:1148 威望:0 精华:0 注册:2014/6/10 20:24:00
请教个问题~  发帖心情 Post By:2014/7/14 20:49:00 [只看该作者]

我现在这段代码 是写在日期控件的 TextChanged事件当中的 每次一打开那个窗口就会自动产生当天装配的表格  (这个不太对~) 要没有当天的记录 才会产生才对 如果已经产生了 已经就不用在产生了:
代码如下:  我是想判断表格是不是空  但这样写 提示代码有错 
Tables("装配表").Filter=" [日期] = '" & e.Form.Controls("DateTimePicker1").Value & "'"
'判断是有已经有装配表 有则不再产生装配表
If Tables("装配表") !=null Then
SystemReady = False
Dim n,n1,n2 As Integer
Dim d As Date = e.Sender.Text
Dim drs As List(Of DataRow) = DataTables("蔬菜采收表").Select("日期 = #" & d & "#")
Dim drs_y As List(Of DataRow) = DataTables("蔬菜采收表").Select("日期 = #" & d.AddDays(-1) & "#")
Dim drs_by As List(Of DataRow) = DataTables("蔬菜采收表").Select("日期 = #" & d.AddDays(-2) & "#")
For Each dr As DataRow In DataTables("当天配送会员").Select("日期 = #" & d & "#")
    '统计是否满足装箱总斤数
    n=0
    n1=0
    n2=0
    Dim idx As Integer = 0
    For Each cdr As DataRow In drs
        Dim ndr As DataRow = DataTables("装配表").addnew
        If idx < drs_y.Count  Then
            ndr("昨天品种") = drs_y(idx)("品种")
            Dim fdr_y As DataRow = DataTables("蔬菜喜好表").Find("会员编号 = '" & dr("会员编号") & "' and 产品 = '" & drs_y(idx)("品种") & "'")
            If fdr_y IsNot Nothing Then
                If fdr_y("喜好") = "吃" Then
                    ndr("昨天配比") = 1
                ElseIf fdr_y("喜好") = "爱吃" Then
                    ndr("昨天配比") = 2
                Else
                    ndr("昨天配比") = 0
                End If
                '没有找到记录     '
            Else
                n1=n1+1
                If n1<=5 Then
                    ndr("昨天配比") = 1
                Else
                    ndr("昨天配比") = 0
                End If
            End If
            
        End If
        If idx < drs_by.Count  Then
            ndr("前天品种") = drs_by(idx)("品种")
            Dim fdr_by As DataRow = DataTables("蔬菜喜好表").Find("会员编号 = '" & dr("会员编号") & "' and 产品 = '" & drs_by(idx)("品种") & "'")
            If fdr_by IsNot Nothing Then
                If fdr_by("喜好") = "吃" Then
                    ndr("前天配比") = 1
                ElseIf fdr_by("喜好") = "爱吃" Then
                    ndr("前天配比") = 2
                Else
                    ndr("前天配比") = 0
                End If
                '没有找到记录     '
            Else
                n2=n2+1
                If n2<=5 Then
                    ndr("前天配比") = 1
                Else
                    ndr("前天配比") = 0
                End If
            End If
        End If
        ndr("日期") = dr("日期")
        ndr("会员编号") = dr("会员编号")
        ndr("品种") = cdr("品种")
        ndr("装箱总斤数")=dr("装箱斤数")
        Dim fdr As DataRow = DataTables("蔬菜喜好表").Find("会员编号 = '" & dr("会员编号") & "' and 产品 = '" & cdr("品种") & "'")
        
        If fdr IsNot Nothing Then
            ndr("喜好") = fdr("喜好")
            If fdr("喜好") = "吃" Then
                ndr("配比") = 1
            ElseIf fdr("喜好") = "爱吃" Then
                ndr("配比") = 2
            Else
                ndr("配比") = 0
            End If
            '没有找到记录     '
        Else
            n=n+1
            '配比超过5斤
            If n<=5 Then
                ndr("喜好")="吃"
                ndr("配比") = 1
            Else
                ndr("喜好")="吃"
                ndr("配比") = 0
            End If
        End If
        
        
        idx += 1
    Next
Next
For Each dr As DataRow In DataTables("装配表").Select("日期 = #" & d & "#")
    dr("小计") = DataTables("装配表").compute("sum(配比)", "日期 = #" & dr("日期") & "# and 会员编号 = '" & dr("会员编号") & "'")
    dr("装箱参考")=dr("配比")
Next
SystemReady = True
End If

Dim t As Table = Forms("装配窗体").Controls("Table1").Table
Dim b As New GroupTableBuilder("统计表1", DataTables("装配表"))
b.Groups.AddDef("品种") '根据产品分组
b.Totals.AddDef("配比", AggregateEnum.Sum, "总数量") '对数量进行统计
b.Filter = "日期 = #" & d & "#"
t.DataSource = b.BuildDataSource '生成统计表
t.DataTable.DataCols.Add("实际产量", Gettype(Integer))
For Each r As Row In t.Rows
    Dim fdr As DataRow = DataTables("蔬菜采收表").Find("日期 = #" & d & "# And 品种 = '" & r("品种") & "'")
    If fdr IsNot Nothing Then
        r("实际产量") = fdr("实际产量")
    End If
Next

这个怎么写呢?

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  8楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/7/14 20:58:00 [只看该作者]

Dim d As Date = e.Sender.Text
If DataTables("装配表").Find("日期 = #" & Date.Today & "#") Is Nothing Then
SystemReady = False
Dim n,n1,n2 As Integer
Dim drs As List(Of DataRow) = DataTables("蔬菜采收表").Select("日期 = #" & d & "#")
Dim drs_y As List(Of DataRow) = DataTables("蔬菜采收表").Select("日期 = #" & d.AddDays(-1) & "#")
Dim drs_by As List(Of DataRow) = DataTables("蔬菜采收表").Select("日期 = #" & d.AddDays(-2) & "#")
For Each dr As DataRow In DataTables("当天配送会员").Select("日期 = #" & d & "#")
    '统计是否满足装箱总斤数
    n=0
    n1=0
    n2=0
    Dim idx As Integer = 0
    For Each cdr As DataRow In drs
        Dim ndr As DataRow = DataTables("装配表").addnew
        If idx < drs_y.Count  Then
            ndr("昨天品种") = drs_y(idx)("品种")
            Dim fdr_y As DataRow = DataTables("蔬菜喜好表").Find("会员编号 = '" & dr("会员编号") & "' and 产品 = '" & drs_y(idx)("品种") & "'")
            If fdr_y IsNot Nothing Then
                If fdr_y("喜好") = "吃" Then
                    ndr("昨天配比") = 1
                ElseIf fdr_y("喜好") = "爱吃" Then
                    ndr("昨天配比") = 2
                Else
                    ndr("昨天配比") = 0
                End If
                '没有找到记录     '
            Else
                n1=n1+1
                If n1<=5 Then
                    ndr("昨天配比") = 1
                Else
                    ndr("昨天配比") = 0
                End If
            End If
           
        End If
        If idx < drs_by.Count  Then
            ndr("前天品种") = drs_by(idx)("品种")
            Dim fdr_by As DataRow = DataTables("蔬菜喜好表").Find("会员编号 = '" & dr("会员编号") & "' and 产品 = '" & drs_by(idx)("品种") & "'")
            If fdr_by IsNot Nothing Then
                If fdr_by("喜好") = "吃" Then
                    ndr("前天配比") = 1
                ElseIf fdr_by("喜好") = "爱吃" Then
                    ndr("前天配比") = 2
                Else
                    ndr("前天配比") = 0
                End If
                '没有找到记录     '
            Else
                n2=n2+1
                If n2<=5 Then
                    ndr("前天配比") = 1
                Else
                    ndr("前天配比") = 0
                End If
            End If
        End If
        ndr("日期") = dr("日期")
        ndr("会员编号") = dr("会员编号")
        ndr("品种") = cdr("品种")
        ndr("装箱总斤数")=dr("装箱斤数")
        Dim fdr As DataRow = DataTables("蔬菜喜好表").Find("会员编号 = '" & dr("会员编号") & "' and 产品 = '" & cdr("品种") & "'")
       
        If fdr IsNot Nothing Then
            ndr("喜好") = fdr("喜好")
            If fdr("喜好") = "吃" Then
                ndr("配比") = 1
            ElseIf fdr("喜好") = "爱吃" Then
                ndr("配比") = 2
            Else
                ndr("配比") = 0
            End If
            '没有找到记录     '
        Else
            n=n+1
            '配比超过5斤
            If n<=5 Then
                ndr("喜好")="吃"
                ndr("配比") = 1
            Else
                ndr("喜好")="吃"
                ndr("配比") = 0
            End If
        End If
       
       
        idx += 1
    Next
Next
For Each dr As DataRow In DataTables("装配表").Select("日期 = #" & d & "#")
    dr("小计") = DataTables("装配表").compute("sum(配比)", "日期 = #" & dr("日期") & "# and 会员编号 = '" & dr("会员编号") & "'")
    dr("装箱参考")=dr("配比")
Next
SystemReady = True
End If


Dim t As Table = Forms("装配窗体").Controls("Table1").Table
Dim b As New GroupTableBuilder("统计表1", DataTables("装配表"))
b.Groups.AddDef("品种") '根据产品分组
b.Totals.AddDef("配比", AggregateEnum.Sum, "总数量") '对数量进行统计
b.Filter = "日期 = #" & d & "#"
t.DataSource = b.BuildDataSource '生成统计表
t.DataTable.DataCols.Add("实际产量", Gettype(Integer))
For Each r As Row In t.Rows
    Dim fdr As DataRow = DataTables("蔬菜采收表").Find("日期 = #" & d & "# And 品种 = '" & r("品种") & "'")
    If fdr IsNot Nothing Then
        r("实际产量") = fdr("实际产量")
    End If
Next


 回到顶部
帅哥哟,离线,有人找我吗?
good131577
  9楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:184 积分:1148 威望:0 精华:0 注册:2014/6/10 20:24:00
麻烦 还有个问题~  发帖心情 Post By:2014/7/14 21:18:00 [只看该作者]

能不能用代码控制客户 配比列累加值小计等于该会员的装箱斤数 后面的配比就为0 不在为1了~
比如7195客户 7个品种是都吃的~喜好表中是吃 装箱值是1 配比的值是拷贝的装箱列的值 就是都为1  能不能实现前五种累加小计值已经为5了 等于该客户的装箱斤数  则后面的两个品种茄子苦瓜配比都设置为0 
要不然每个客户 都要手工调整 去匹配 ~  这个用代码实现会不会很麻烦?感觉应该是用个变量累加配比列 跟装箱 值进行比较  但逻辑不会写~
图片点击可在新窗口打开查看此主题相关图片如下:111.png
图片点击可在新窗口打开查看

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  10楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/7/14 21:26:00 [只看该作者]

Dim d As Date = e.Sender.Text
If DataTables("装配表").Find("日期 = #" & Date.Today & "#") Is Nothing Then
    SystemReady = False
    Dim n,n1,n2 As Integer
    Dim drs As List(Of DataRow) = DataTables("蔬菜采收表").Select("日期 = #" & d & "#")
    Dim drs_y As List(Of DataRow) = DataTables("蔬菜采收表").Select("日期 = #" & d.AddDays(-1) & "#")
    Dim drs_by As List(Of DataRow) = DataTables("蔬菜采收表").Select("日期 = #" & d.AddDays(-2) & "#")
    For Each dr As DataRow In DataTables("当天配送会员").Select("日期 = #" & d & "#")
        '统计是否满足装箱总斤数
        n=0
        n1=0
        n2=0
        Dim idx As Integer = 0
        For Each cdr As DataRow In drs
            Dim ndr As DataRow = DataTables("装配表").addnew
            If idx < drs_y.Count  Then
                ndr("昨天品种") = drs_y(idx)("品种")
                Dim fdr_y As DataRow = DataTables("蔬菜喜好表").Find("会员编号 = '" & dr("会员编号") & "' and 产品 = '" & drs_y(idx)("品种") & "'")
                If fdr_y IsNot Nothing Then
                    If fdr_y("喜好") = "吃" Then
                        n1=n1+1
                        If n1<=5 Then
                            ndr("昨天配比") = 1
                        Else
                            ndr("昨天配比") = 0
                        End If
                    ElseIf fdr_y("喜好") = "爱吃" Then
                        ndr("昨天配比") = 2
                        n1=n1+2
                        If n1<=5 Then
                            ndr("昨天配比") = 2
                        Else
                            ndr("昨天配比") = 0
                        End If
                    Else
                        ndr("昨天配比") = 0
                    End If
                    '没有找到记录     '
                Else
                    n1=n1+1
                    If n1<=5 Then
                        ndr("昨天配比") = 1
                    Else
                        ndr("昨天配比") = 0
                    End If
                End If
               
            End If
            If idx < drs_by.Count  Then
                ndr("前天品种") = drs_by(idx)("品种")
                Dim fdr_by As DataRow = DataTables("蔬菜喜好表").Find("会员编号 = '" & dr("会员编号") & "' and 产品 = '" & drs_by(idx)("品种") & "'")
                If fdr_by IsNot Nothing Then
                    If fdr_by("喜好") = "吃" Then
                        n2=n2+1
                        If n2<=5 Then
                            ndr("前天配比") = 1
                        Else
                            ndr("前天配比") = 0
                        End If
                    ElseIf fdr_by("喜好") = "爱吃" Then
                        n2=n2+2
                        If n2<=5 Then
                            ndr("前天配比") = 2
                        Else
                            ndr("前天配比") = 0
                        End If
                    Else
                        ndr("前天配比") = 0
                    End If
                    '没有找到记录     '
                Else
                    n2=n2+1
                    If n2<=5 Then
                        ndr("前天配比") = 1
                    Else
                        ndr("前天配比") = 0
                    End If
                End If
            End If
            ndr("日期") = dr("日期")
            ndr("会员编号") = dr("会员编号")
            ndr("品种") = cdr("品种")
            ndr("装箱总斤数")=dr("装箱斤数")
            Dim fdr As DataRow = DataTables("蔬菜喜好表").Find("会员编号 = '" & dr("会员编号") & "' and 产品 = '" & cdr("品种") & "'")
           
            If fdr IsNot Nothing Then
                ndr("喜好") = fdr("喜好")
                If fdr("喜好") = "吃" Then
                    n=n+1
                    '配比超过5斤
                    If n<=5 Then
                        ndr("配比") = 1
                    Else
                        ndr("配比") = 0
                    End If
                ElseIf fdr("喜好") = "爱吃" Then
                    n=n+2
                    '配比超过5斤
                    If n<=5 Then
                        ndr("配比") = 1
                    Else
                        ndr("配比") = 0
                    End If
                Else
                    ndr("配比") = 0
                End If
                '没有找到记录     '
            Else
                n=n+1
                '配比超过5斤
                If n<=5 Then
                    ndr("喜好")="吃"
                    ndr("配比") = 1
                Else
                    ndr("喜好")="吃"
                    ndr("配比") = 0
                End If
            End If
           
           
            idx += 1
        Next
    Next
    For Each dr As DataRow In DataTables("装配表").Select("日期 = #" & d & "#")
        dr("小计") = DataTables("装配表").compute("sum(配比)", "日期 = #" & dr("日期") & "# and 会员编号 = '" & dr("会员编号") & "'")
        dr("装箱参考")=dr("配比")
    Next
    SystemReady = True
End If


'后面不写了

 


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