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


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

主题:[求助] 没有反应

美女呀,离线,留言给我吧!
susanhe
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:小狐 帖子:312 积分:2477 威望:0 精华:0 注册:2018/11/22 20:30:00
[求助] 没有反应  发帖心情 Post By:2020/1/19 13:12:00 [只看该作者]

老师,可以帮忙修改一下以下代码吗 ? 感谢了。

 

 

If e.Col.Name ="GSSPartNo"
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("该物料不是单独包装的!!!")
   Else


    e.Cancel =True
    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
   e.cancel = True
End If


 回到顶部
帅哥,在线噢!
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106080 积分:539499 威望: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

 回到顶部
美女呀,离线,留言给我吧!
susanhe
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:小狐 帖子:312 积分:2477 威望:0 精华:0 注册:2018/11/22 20:30:00
  发帖心情 Post By:2020/1/19 15:10:00 [只看该作者]

老师,在双击事件中,双击没有反应。

 

我要双击GSSPartNo后,作如下判断

 

 If e.Table.compute("count(Customer_PartNo)","Customer_PartNo='" & e.Row("Customer_PartNo") & "' and BoxNo='" & e.Row("BoxNo") & "'")> 1 Then
        msgbox("该物料不是单独包装的!!!")
        e.Cancel =True

如果没有问题,就执行下面的

 

 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

[此贴子已经被作者于2020/1/19 15:16:13编辑过]

 回到顶部
帅哥,在线噢!
有点蓝
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106080 积分:539499 威望: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

 回到顶部
美女呀,离线,留言给我吧!
susanhe
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:小狐 帖子:312 积分:2477 威望:0 精华:0 注册:2018/11/22 20:30:00
  发帖心情 Post By:2020/1/19 16:13:00 [只看该作者]

老师,谢谢

 

双击后,可是boxno 数量超过1个了,没有出现提示,怎么回事 ?

 

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

 回到顶部
帅哥,在线噢!
有点蓝
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106080 积分:539499 威望: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同时重复。截图数据说明

 回到顶部
美女呀,离线,留言给我吧!
susanhe
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:小狐 帖子:312 积分:2477 威望:0 精华:0 注册:2018/11/22 20:30:00
  发帖心情 Post By:2020/1/19 16:47:00 [只看该作者]

老师,我的表达错了,我要实现的是在这个Customer_PartNo 列中 这个值是唯一的情况下,这个BoxNo是不是用在其它Customer_PartNo 记录上,如是,就出现提示..

 

If e.Table.compute("count(Customer_PartNo)","Customer_PartNo='" & e.Row("Customer_PartNo") & "' and BoxNo='" & e.Row("BoxNo") & "'")> 1 Then


 回到顶部
帅哥,在线噢!
有点蓝
  8楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106080 积分:539499 威望: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

 回到顶部
美女呀,离线,留言给我吧!
susanhe
  9楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:小狐 帖子:312 积分:2477 威望:0 精华:0 注册:2018/11/22 20:30:00
  发帖心情 Post By:2020/1/19 17:25:00 [只看该作者]

感谢老师,太专业了!!!

 回到顶部