Foxtable(狐表)用户栏目专家坐堂 → 控制生产累计数不允许大于计划生产数


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

主题:控制生产累计数不允许大于计划生产数

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


加好友 发短信
等级:超级版主 帖子:106430 积分:541297 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2016/12/1 22:57:00 [只看该作者]

Dim Filter As String
With e.Form.Controls("StartDate")
    If .Value   IsNot   Nothing   Then
        If Filter >""   Then
            Filter = Filter &   " And "
        End   If
        Filter = Filter &   "日期 >= #" & .Value &   "#"
    End   If
End   With
With e.Form.Controls("EndDate")
    If .Value   IsNot   Nothing   Then
        If Filter >""   Then
            Filter = Filter &   " And "
        End   If
        Filter = Filter &   "日期 <= #" & .Value &   "#"
    End   If
End   With
If Filter > "" Then Filter = " and " & Filter
DataTables("生产进度汇总表").StopRedraw
DataTables("生产进度汇总表").DataRows.Clear
Dim Arys As List(Of String())
Arys = DataTables("冲压车间工资表").GetValues("产品名称|生产工序|订单号", "产品名称 is not null" & Filter )
For Each Ary As String() In Arys
    Dim dr As DataRow = DataTables("生产进度汇总表").AddNew()
    dr("产品名称") = Ary(0)
    dr("生产工序") = Ary(1)
    dr("订单号") = Ary(2)
    dr("实际生产数") = DataTables("冲压车间工资表").Compute("sum(数量)","[产品名称] = '" & Ary(0) & "' and 生产工序='" & Ary(1) & "' and 订单号='" & Ary(2) & "'")
Next
Dim dt As DataTable
Dim g As New GroupTableBuilder("统计表1", DataTables("半成品完工进仓表"))
g.Groups.AddDef("产品名称")
g.Groups.AddDef("订单号")
g.Totals.AddDef("数量")
dt = g.Build(False)

For Each dr As DataRow In dt.DataRows
    DataTables("生产进度汇总表").ReplaceFor("半成品进仓数",dr("数量"),"[产品名称] = '" & dr("产品名称") &  "' and 订单号='" & dr("订单号") & "'")
Next
Dim g2 As New GroupTableBuilder("统计表2", DataTables("生产计划表"))
g2.Groups.AddDef("产品名称")
g2.Groups.AddDef("订单号")
g2.Totals.AddDef("数量")
dt = g2.Build(False)
For Each dr As DataRow In dt.DataRows
    DataTables("生产进度汇总表").ReplaceFor("生产计划数",dr("数量"),"[产品名称] = '" & dr("产品名称") &  "' and 订单号='" & dr("订单号") & "'")
Next
DataTables("生产进度汇总表").ResumeRedraw
[此贴子已经被作者于2016/12/1 22:58:46编辑过]

 回到顶部
总数 137 1 2 3 4 5 6 7 8 9 10 下一页 ..14