Foxtable(狐表)用户栏目专家坐堂 → [求助] 没有反应


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

主题:[求助] 没有反应

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


加好友 发短信
等级:超级版主 帖子:106298 积分:540619 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/1/19 14:05:00 [显示全部帖子]

代码在什么事件?要实现什么功能?

If e.Col.Name ="BoxNo" OrElse If e.Col.name = "Customer_PartNo"
    If e.Table.compute("count(Customer_PartNo)","Customer_PartNo='" & e.Row("Customer_PartNo") & "' and BoxNo='" & e.Row("BoxNo") & "'")> 1 Then
        msgbox("该物料不是单独包装的!!!")
        e.Cancel =True
    Else
        Dim r As Row = Tables("PackingInfo").AddNew
        r("CustomerPN") = e.Row("Customer_PartNo")
        r("GSSPartNo") = e.Row("GSSPartNo")
        
        r("Packing_Length") = e.Row("Box_Length")
        r("Packing_Width") = e.Row("Box_Width")
        r("Packing_Height") = e.Row("Box_Height")
        
        r("Packing_GrossWeight") = e.Row("Gross_Weight")
        r("Packing_Qty") = e.Row("Qty_perBox")
        
        Forms("窗口2").open
    End If
End If

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


加好友 发短信
等级:超级版主 帖子:106298 积分:540619 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/1/19 15:24:00 [显示全部帖子]

If e.Col.Name ="GSSPartNo"
        e.Cancel =True
    If e.Table.compute("count(Customer_PartNo)","Customer_PartNo='" & e.Row("Customer_PartNo") & "' and BoxNo='" & e.Row("BoxNo") & "'")> 1 Then
        msgbox("该物料不是单独包装的!!!")
    Else
        Dim r As Row = Tables("PackingInfo").AddNew
        r("CustomerPN") = e.Row("Customer_PartNo")
        r("GSSPartNo") = e.Row("GSSPartNo")
        
        r("Packing_Length") = e.Row("Box_Length")
        r("Packing_Width") = e.Row("Box_Width")
        r("Packing_Height") = e.Row("Box_Height")
        
        r("Packing_GrossWeight") = e.Row("Gross_Weight")
        r("Packing_Qty") = e.Row("Qty_perBox")
        
        Forms("窗口2").open
    End If
End If

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


加好友 发短信
等级:超级版主 帖子:106298 积分:540619 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/1/19 16:40:00 [显示全部帖子]

e.Table.compute只统计table看得到的数据,不加载,或者已经筛选掉的不会统计,如果要统计所有已加载改为e.Table.datatable.compute,如果要统计包含未加载的数据的,改为e.Table.datatable.sqlcompute。

另外上面的条件是:Customer_PartNo和BoxNo同时重复。截图数据说明

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


加好友 发短信
等级:超级版主 帖子:106298 积分:540619 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/1/19 16:54:00 [显示全部帖子]

If e.Table.datatable.find("Customer_PartNo <> '" & e.Row("Customer_PartNo") & "' and BoxNo='" & e.Row("BoxNo") & "'") isnot nothing Then

 回到顶部