以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- e.GetValues的问题 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=134783) |
-- 作者:zenbu -- 发布时间:2019/5/6 14:51:00 -- e.GetValues的问题 无法获得Primarykey可以给看一下吗? 现在因为无法获取Primarykey,所以无法从搜索的表格中选择数据以后加到另外一个表中。 Dim e As RequestEventArgs = args(0) Dim UserCompany As String = e.Cookies("usercompany") \'从cookie中获取 Dim gjs As List(of String) = DataTables("SalesPriceCalculation").SQLGetValues("GroupName") Dim Page As Integer If e.GetValues.ContainsKey("page") Then Integer.TryParse(e.GetValues("page"), page) End If Dim wb As New weui wb.AddForm("","form1","") Dim pgs As String = e.Cookies("page") Dim odn As String = e.Cookies("orderno") Dim p As String = "order_edit.htm?page=" & pgs & "&oid=" & odn \'返回的页面 For Each r As String In e.PostValues.Keys msgbox(r) Next For Each rr As String In e.GetValues.Keys \'现在接受不到这个 msgbox("get:" & rr) Next \'增加基本页面 With wb.AddInputGroup("form1","ipg1","搜索") .AddInput("stocklist_orderno","定单编号","text").Value = odn .AddSelect("stocklist_group","产品组","|" & String.Join("|",gjs.ToArray)).Attribute = "" \'调用js函数. .AddInput("stocklist_product","产品名称","text") End With With wb.AddButtonGroup("form1","btg2",False) .Add("btn22", "搜索", "submit") .Add("btn11", "返回","",p) End With If e.PostValues.Count > 0 Then Dim group As String Dim pnm As String Dim ftl As String For Each key As String In e.PostValues.Keys If key = "stocklist_group" Then group = e.PostValues(Key) ElseIf key = "stocklist_product" Then pnm = e.PostValues(Key) End If Next If pnm > "" Then Dim Names() As String = pnm.Split(" ") For Each name As String In Names If name > "" Then ftl = ftl & "pname_1 Like N\'%" & name & "%\' or pname_2 Like N\'%" & name & "%\' and " End If Next ftl = ftl.SubString(0,ftl.Length - 4) \'获取关键字 End If If group > "" Then If ftl > "" Then ftl = ftl & " and " End If ftl = "GroupName Like N\'%" & group & "%\'" End If Dim ug As String = e.Cookies("usercompany") \'从cookie中获取 With wb.AddTable("form1","table2") Dim nms() As String = {"ID","产品编号","产品名称","采购单价","建议售价"} .Head.AddRow(nms) .Highlight = 1 \'仅高亮显示行 .PageNumber = 0 \'设置页码 If ftl > "" Then For Each r As DataRow In DataTables("SalesPriceCalculation").SQLSelect(ftl) With .Body.AddRow(r("pid"),r("pno"),r("pname_2")) .Primarykey = r("pid") \'设置主键 Dim amt As Double = 0 amt = Functions.Execute("计算客户价格网页用",e,r("pid"),ug) .AddCell(Format (amt,"#,###")) .AddCell(r("RetailPrice")) End With Next End If End With End If \'主键传递 Dim idx As String If e.GetValues.ContainsKey("ospa") Then \'如果含产品id,增加详情 \'如果含主键就增加数据到详情页 idx = e.GetValues("ospa") Dim pr As DataRow = DataTables("order_add_dtail").SQLAddNew() Dim dr1 As DataRow = DataTables("SalesPriceCalculation").SQLFind("pid = \'" & idx & "\'") If dr1 IsNot Nothing Then pr("OrderNo") = odn pr("pid") = dr1("pid") pr("pno") = dr1("pno") pr("pname") = dr1("pname_2") pr.save End If End If With wb.AddButtonGroup("form1","btg31",False) .Add("btnAdd", "增加产品").Attribute = "" End With \'显示定单明细 If odn > "" Then Dim srs As List(of DataRow) \'订单明细集合 srs = DataTables("order_add_dtail").SQLSelect("OrderNo=\'" & odn & "\'") \'获取订单明细 With wb.AddTable("form1","listtable") .head.AddRow("产品","单价") .Highlight = 1 \'高亮显示行 For Each sr As DataRow In srs With .Body.AddRow(sr("pname"),sr("price")) .Primarykey = sr("_Identify") \'为此行指定主键值 End With Next End With End If wb.AppendHTML("<script src=\'./lib/order.js\'></script>") \'引入脚本文件 wb.AppendHTML("<script src=\'./lib/product_group.js\'></script>") \'引入脚本文件 e.WriteString(wb.Build) \'生成网页 js的名称为order.js 代码为 function ospAdd(){ location="order_search_product.htm?page=" + table2.pagenumber + "&ospa=" + table2.primarykey; } |
-- 作者:有点甜 -- 发布时间:2019/5/6 14:58:00 -- js函数改成,看弹出什么
alert(123); function ospAdd(){
alert(table.primarykey);
location="order_search_product.htm?page=" + table2.pagenumber + "&ospa=" + table2.primarykey;
} |
-- 作者:有点甜 -- 发布时间:2019/5/6 15:00:00 --
如果js弹出正确,在你的httprequest事件那里,加入msgbox,看弹出执行到哪里去了。
|
-- 作者:zenbu -- 发布时间:2019/5/6 15:01:00 -- 弹出的还是123 |
-- 作者:zenbu -- 发布时间:2019/5/6 15:08:00 -- PostValues是正常,所以需要搜索的产品也好产品组也好都正常,但是GetValues的参数无法获得 |
-- 作者:有点甜 -- 发布时间:2019/5/6 15:18:00 -- 以下是引用zenbu在2019/5/6 15:01:00的发言:
弹出的还是123
你的意思是 ospAdd 函数没有被执行?你在什么时候执行这个函数ospAdd?你在哪里绑定了事件?
|
-- 作者:zenbu -- 发布时间:2019/5/6 15:30:00 -- 是的,是ospAdd 函数没有被执行 是需要搜索到产品以后产生一个表格,选择这个表格中的数据以后按增加产品以后再执行ospAdd函数 目的是把找到的产品数据加入到另外一个表中
|
-- 作者:zenbu -- 发布时间:2019/5/6 16:01:00 -- 重新式了一下JS中代码弹出正确,有主键 order_search_product.htm?page=0&ospa=PID-19041500521
但是再代码中无法接受 For Each tt As String In e.GetValues.Keys msgbox(tt) Next |
-- 作者:zenbu -- 发布时间:2019/5/6 16:21:00 -- 现在的页面是http://127.0.0.1/order_search_product.htm 要返回的页面是http://127.0.0.1/order_search_product.htm?page=0&ospa=PID-19041500521 是因为这个原因无法获得primarykey吗?
|
-- 作者:有点甜 -- 发布时间:2019/5/6 16:22:00 -- 在代码最上面执行
msgbox(123) msgbox(e.values.count) msgbox(e.values("ospa")) |