Dim e As RequestEventArgs = args(0)
Dim wb As New weui
wb.AddPageTitle("","ph1","增加压舱水","")
Dim PageURL = "List2.htm?page=" & e.GetValues("page") & "&key=" & e.GetValues("list2key")
If e.PostValues.Count = 0 Then '生成增加订单网页
wb.AddForm("","form1","addnew3.htm?key=" & e.getvalues("key") & "&list2key=" & e.GetValues("list2key"))
With wb.AddInputGroup("form1","ipg1","压舱水")
'.AddHiddenValue("sureyid",id)
'.AddHiddenValue("次数",idx)
'
.AddInput("tankno","舱号tankno","text")
.AddInput("obvd","压舱水obvd","number").Step = "0.001"
With .AddInput("correct","修正correct","number")
.Step = "0.001"
.value="0"
End With
.AddInput("tovcubmeter","体积tovcubmeter","number").Step = "0.001"
With .AddInput("density","密度density","number")
.Step = "0.001"
.value="1.02"
End With
End With
With wb.AddButtonGroup("form1","btg1",True)
.Add("btn1", "确定", "button").Attribute= ""
End With
'With wb.AddDialog("", "dlg1", "提示", "增加成功,是否继续增加?") '增加订单成功提示框
' .AddButton("btnYes", "是").Attribute = ""
' .AddButton("btnNo", "否", PageURL).Kind = 1
' End With
With wb.AddDialog("", "dlg2", "错误", "") '增加订单失败提示框
.AddButton("btnOK", "确定")
End With
wb.AppendHTML("<script src='./lib/ycsbg.js'></script>") '引入脚本文件
Dim pr1 As DataRow
Dim id1 As String
pr1 = DataTables("操作表").SQLFind("[_Identify] =" & e.getvalues("key"))
If pr1 IsNot Nothing Then
id1 = pr1("sureyidtimes")
End If
With wb.AddTable("", "Table1")
'按日期顺序列出客户CS01的订单,仅显示产品/数量/单价/日期/审核等五列
.CreateFromDataTable(DataTables("压舱水"), False, "sureyidtimes='" & id1 & "'", "次数 desc", "次数", "tankno", "obvd", "tovcubmeter", "weightmetricton")
End With
e.WriteString(wb.Build)
Else '保存新增的订单
Dim dr As DataRow = DataTables("压舱水").AddNew()
'调取list1中的行id
Dim pr As DataRow
Dim id As String
pr = DataTables("操作表").SQLFind("[_Identify] =" & e.getvalues("key"))
If pr IsNot Nothing Then
id = pr("sureyidtimes")
End If
'MessageBox.Show(id)
''计算sureyidtimes
Dim max As Integer
Dim idx As Integer
max= DataTables("压舱水").SQLCompute("max(次数)","sureyidtimes='" & id & "'")
If max > 0 Then '如果存在最大次数
idx = max+1 '获得最大次数的后三位顺序号,并加1
Else
idx = 1 '否则顺序号等于1
End If
dr("sureyidtimes") = id
dr("时间") = Date.Today()
dr("次数")=idx
dr("压舱水编码次数")=id+CStr(idx)
Dim nms() As String = {"tankno","obvd","correct","tovcubmeter","density"}
For Each nm As String In nms
dr(nm) = e.PostValues(nm)
Next
' dr.Save()
''计算结果
If dr.IsNull("obvd") And dr.IsNull("correct") Then
dr("corrd") = Nothing
Else
dr("corrd") = Math.Round(dr("obvd")+dr("correct")/100,2)
End If
'' "tovcubmeter","density" ''weightmetricton,操作表bw获取公式
If dr.IsNull("tovcubmeter") Or dr.IsNull("density") Then
dr("weightmetricton") = Nothing
Else
dr("weightmetricton") = Math.Round(dr("tovcubmeter")*dr("density"),2)
End If
dr.Save()
e.WriteString("OK") '返回增加成功消息
' With wb.AddMsgPage("","msgpage","增加成功", "压舱水增加成功") '增加订单成功提示信息
' .AddButton("btn2","继续增加","addnew3.htm?key=" & e.getvalues("key") & "&list2key=" & e.GetValues("list2key"))
' .AddButton("btn1","返回",PageURL)
' End With
End If
e.WriteString(wb.Build) '生成网页
此主题相关图片如下:qq图片20220623151836.png
现在点增加之后会在后台增加数据,但是下边的表格不会即时显示出新增的行,需要刷新页面,怎样即时显示?