以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  自定义信息提示窗口  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=173363)

--  作者:qinlao666
--  发布时间:2021/11/26 10:43:00
--  自定义信息提示窗口
审核申请提示窗口如何能同时更新“报价主表”及其关联表“报价主表.报价明细”
--  作者:有点蓝
--  发布时间:2021/11/26 10:47:00
--  
代码都是自己写的,加上更新其它表的代码咯
--  作者:qinlao666
--  发布时间:2021/11/26 10:55:00
--  

审核按钮
DataTables("报价主表").Save() \'接下来要根据主键查找,必须先保存,因为只有保存后新增行的主键才是有效值.
Tables("报价主表.报价明细").Save()
Dim id As String = e.Form.Controls("Label2").Text
Dim id1 As String = e.Form.Controls("Label3").Text
Dim dr As DataRow = DataTables("报价主表").Find("[_Identify] = " & id)
Dim dr1 As DataRow = DataTables("报价明细").Find("[_Identify] = " & id1)
If dr Is Nothing Then
    DataTables("报价主表").AppendLoad("[_Identify] = " & id)
    dr =  DataTables("报价主表").Find("[_Identify] = " & id)
    DataTables("报价明细").AppendLoad("[_Identify] = " & id1)
    dr1 =  DataTables("报价明细").Find("[_Identify] = " & id1)
Else
    dr.Load()
    dr1.Load()
End If
If dr IsNot Nothing Then
    Dim wz As Integer = Tables("报价主表").FindRow(dr)
    If wz < 0 Then \'如果因为筛选导致此报价主表不可见
        Tables("报价主表").Filter = ""
        wz =Tables("报价主表").FindRow(dr)
    End If
    If wz >= 0 Then
        Tables("报价主表").Position = wz
        Forms("报价").show()
    End If
End If
e.Form.Close()

项目事件SystemIdle
If fhs.Count > 0 AndAlso Forms("审核提示").Opened = False Then
    Dim pts() As String = fhs(0).Split("|")
    With Forms("审核提示")
        .Open()
        .Controls("Label1").Text = pts(2) & "新增报价单" & pts(1) & ",请审核!"
        .Controls("Label2").Text = pts(0) \'将发货单主健设置为Label2的标题
        .Controls("Label3").Text = pts(0) \'将发货单主健设置为Label2的标题
        
    End With
    fhs.RemoveAt(0)
End If

--  作者:有点蓝
--  发布时间:2021/11/26 11:05:00
--  
有啥问题?
--  作者:qinlao666
--  发布时间:2021/11/26 11:09:00
--  
没反应,关联表更新不了
--  作者:有点蓝
--  发布时间:2021/11/26 11:15:00
--  
是关联表数据不能更新?还是提示窗口的控件值不能更新?

关联表就是子表的数据,“报价主表.报价明细”其实就是报价明细表的数据。只要报价明细表的数据更新了,关联表肯定也更新了。如果不能检查一下报价明细表的数据更新代码

--  作者:qinlao666
--  发布时间:2021/11/26 13:33:00
--  
麻烦老师帮我看看,实在是不会写图片点击可在新窗口打开查看
报价明细表数据没有更新

保存按钮
Dim r As Row  = Tables("报价主表").Current
If r("审核") = False Then
    r.Save()
    Dim ids As String = ""
    For Each r1 As Row In Tables("报价明细").rows
        r1.Save()
        ids &= r1("_Identify") & ","
    Next
    If ids > "" Then
        QQClient.Send("计划.吴连英","+b|" & ids.trim(",") & "",True)
    End If
    QQClient.Send("计划.吴连英","+@|" & r("_Identify") & "|" & r("报价单号") & "|" & User.Name,True)
End If

MessageReceived代码
Dim pts() As String  = e.Message.Split("|")
If pts.Length = 4 AndAlso pts(0) = "+@" \'如果是申请审核消息
    fhs.Add(pts(1) & "|" & pts(2) & "|" & pts(3)) \'将主健?单号和制单人合成为一个字符串存储在集合中
ElseIf pts.Length = 2 AndAlso pts(0) = "+b" \'如果是申请审核消息
    fhs1.Add(" & pts(1) & " )  \'将主健?单号和制单人合成为一个字符串存储在集合中

ElseIf pts.Length = 3 AndAlso pts(0) = "-@" \'如果是审核通过消息
    PopMessage("报价单" & pts(1) & "已由" & pts(2) & "审核通过!")
    Dim dr As DataRow = DataTables("报价主表").Find("报价单号 = \'" & pts(1) & "\'")
    If dr IsNot Nothing Then
        dr.Load
    End If
End If

查看按钮
DataTables("报价主表").Save() \'接下来要根据主键查找,必须先保存,因为只有保存后新增行的主键才是有效值
DataTables("报价明细").Save()
Dim id As String = e.Form.Controls("Label2").Text
Dim id1 As String = e.Form.Controls("Label3").Text
DataTables("报价主表").removefor("[_Identify] in (" & id & ")")
DataTables("报价主表").AppendLoad("[_Identify] in (" & id & ")")
DataTables("报价明细").removefor("[_Identify] in (" & id & ")")
DataTables("报价明细").AppendLoad("[_Identify] in (" & id & ")")

Dim dr As DataRow = DataTables("报价主表").Find("[_Identify] = " & id)
If dr IsNot Nothing Then
    Dim wz As Integer = Tables("报价主表").FindRow(dr)
    If wz < 0 Then \'如果因为筛选导致此报价主表不可见
        Tables("报价主表").Filter = ""
        wz =Tables("报价主表").FindRow(dr)
    End If
    If wz >= 0 Then
        Tables("报价主表").Position = wz
        Forms("报价").show()
    End If
End If
e.Form.Close()
项目事件SystemIdle
If fhs.Count > 0 AndAlso Forms("审核提示").Opened = False Then
    Dim pts() As String = fhs(0).Split("|")
    Dim pts1() As String = fhs1(0).Split("|")
    With Forms("审核提示")
        .Open()
        .Controls("Label1").Text = pts(2) & "新增报价单" & pts(1) & ",请审核!"
        .Controls("Label2").Text = pts(0) \'将发货单主健设置为Label2的标题
        .Controls("Label3").Text = pts1(0) \'将发货单主健设置为Label2的标题
        
    End With
    fhs.RemoveAt(0)
    fhs1.RemoveAt(0)
End If



--  作者:有点蓝
--  发布时间:2021/11/26 13:46:00
--  
MessageReceived代码没有处理明细的代码啊

Dim pts() As String  = e.Message.Split("|")
If pts.Length = 4 AndAlso pts(0) = "+@" \'如果是申请审核消息
    fhs.Add(pts(1) & "|" & pts(2) & "|" & pts(3)) \'将主健?单号和制单人合成为一个字符串存储在集合中
ElseIf pts.Length = 2 AndAlso pts(0) = "+b" \'如果是申请审核消息
    fhs1.Add(" & pts(1) & " )  \'将主健?单号和制单人合成为一个字符串存储在集合中

ElseIf pts.Length = 3 AndAlso pts(0) = "-@" \'如果是审核通过消息
    PopMessage("报价单" & pts(1) & "已由" & pts(2) & "审核通过!")
    Dim dr As DataRow = DataTables("报价主表").Find("报价单号 = \'" & pts(1) & "\'")
    If dr IsNot Nothing Then
        dr.Load
    End If
ElseIf pts.Length = 3 AndAlso pts(0) = "+b|"
处理明细表的数据加载
End If

或者

查看按钮
DataTables("报价主表").Save() \'接下来要根据主键查找,必须先保存,因为只有保存后新增行的主键才是有效值
DataTables("报价明细").Save()
Dim id As String = e.Form.Controls("Label2").Text
Dim id1 As String = e.Form.Controls("Label3").Text \'增加一个控件把消息里的报价单号记录下来
Dim id3 As String = e.Form.Controls("Label4").Text \'提示窗口增加一个控件把消息里的报价单号记录下来 (.Controls("Label4").Text = pts(1))
msgbox(id1 )
DataTables("报价主表").removefor("[_Identify] in (" & id & ")")
DataTables("报价主表").AppendLoad("[_Identify] in (" & id & ")")
DataTables("报价明细").removefor("[报价单号] in (" & id3 & ")")
DataTables("报价明细").AppendLoad("[报价单号] in (" & id3 & ")")

--  作者:qinlao666
--  发布时间:2021/11/26 15:21:00
--  
我更改了查看命令,
msgbox(id1 )显示的内容是AKP181205K5
但错误提示未找到列[AKP181205K5]

--  作者:有点蓝
--  发布时间:2021/11/26 15:32:00
--  
加上单引号,学会自己判断问题,不是别人给的代码就只能等别人改

DataTables("报价明细").removefor("[报价单号] in (\'" & id3.replace(",","\',\'") & "\')")