以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 帮助中edit怎么传递到save的 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=121142) |
-- 作者:rjh4078 -- 发布时间:2018/6/29 20:43:00 -- 帮助中edit怎么传递到save的 我新建了一个几乎一样的页面 只是字段不同 取名 newlist,newedit,newsave newlist到newedit的跳转都很正常,但是在newedit页面点击保存时,无法触发newsave的代码 在save页面代码用messagebox也无任何反应
|
-- 作者:有点蓝 -- 发布时间:2018/6/29 20:51:00 -- 具体代码实例。 |
-- 作者:rjh4078 -- 发布时间:2018/6/29 21:08:00 -- edit页面 Dim e As RequestEventArgs = args(0) Dim wb As New weui wb.AddPage("","p1") \'增加两个page wb.AddPage("","p3",False) \'删除订单明细 If e.GetValues.ContainsKey("deldid") Then DataTables("调拨明细").SQLDeleteFor("[_Identify] = " & e.GetValues("deldid")) End If \'订单编辑 Dim pr As DataRow \'订单 Dim srs As List(of DataRow) \'订单明细集合 Dim Page As Integer \'页码变量 If e.GetValues.ContainsKey("page") Then \'如果地址中有page参数 Integer.TryParse(e.GetValues("page"), page) \'提取page参数 End If If e.GetValues.ContainsKey("oid") = False Then \'如果没有传递订单编号,则新增与一个订单 pr = DataTables("调拨单").SQLAddNew() \' pr("调拨单号") ="DB" & Functions.Execute("GetOrderID") \'利用自定义函数GetOrderID为新增订单生成编号. Else \'如果传递了订单编号,则找出此订单进行编辑 pr = DataTables("调拨单").SQLFind("调拨单号=\'" & e.GetValues("oid") & "\'") If pr Is Nothing Then \'多用户情况下,必须考虑其他用户删除订单的可能. wb.InSertHtml("此单据已被其他用户删除!") e.WriteString(wb.Build) Return "" \'必须返回 End If srs = DataTables("调拨明细").SQLSelect("调拨单号=\'" & pr("调拨单号") & "\'") \'获取订单明细 End If Dim url As String = "dbedit.htm?page=" & page & "&oid=" & pr("调拨单号") \'传递页码和订单编号 wb.AddForm("p1","form1",url) With wb.AddInputGroup("form1","ipg1",iif(e.GetValues.ContainsKey("oid"),"编辑","新增")) With .AddInput("调拨单号","调拨单号","text") .Value = pr("调拨单号") .Readonly = True End With .AddInput("制单人","制单人","text").Value =iif(pr("制单人")="",e.Cookies("xm"),pr("制单人")) With .AddInput("出库库房","出库库房","text") .Value = iif(pr("出库库房")="",e.Cookies("bm"),pr("出库库房")) .Readonly=True End With .addselect("入库库房","入库库房",iif(pr("入库库房")="",DataTables("调拨单").SQLGetComboListString("入库库房"),pr("入库库房"))) With .Addinput("流转代码","流转代码","") .Value=pr("流转代码") \'\'.Attribute =""" .Readonly=True End With With .AddInput("费用","费用","number") .Value = pr("费用") .Step="0.01" End With .AddInput("备注","备注","text").Value = pr("备注") With .AddInput("调拨日期","调拨日期","date") If pr("调拨日期") >"2000-12-31" Then .Value = pr("调拨日期") Else .Value = Date.Today End If End With With .AddInput("调拨金额","调拨金额","number") .Value = pr("调拨金额") .Step="0.01" .Readonly = True End With End With \'订单明细编辑 Dim mr As DataRow \'要编辑的订单明细 Dim IsNew As Boolean \'此变量用于标记是否要新增明细 If e.GetValues.ContainsKey("oid") = False OrElse e.GetValues.ContainsKey("addnext") \'如果是新增订单,或这包括addnext参数 IsNew = True \'将IsNew参数设置为True,表明需要新增订单明细 ElseIf e.GetValues.ContainsKey("did") Then \'如果传递了订单明细主键 mr = DataTables("调拨明细").SQLFind("[_Identify]=" & e.GetValues("did")) \'找出此订单明细进行编辑 End If If IsNew OrElse mr IsNot Nothing Then With wb.AddInputGroup("form1","ipg2",iif(IsNew,"新增明细","编辑明细")) .Attribute = "" \'调用js函数,自动计算金额 If IsNew Then \'如果是新增订单明细 \'\'\'.Addselect("药材编码","药材编码","").Attribute =""" With .Addinput("药材编码","药材编码","") .Attribute =""" .Readonly=True End With |
-- 作者:rjh4078 -- 发布时间:2018/6/29 21:09:00 -- With .AddInput("名称","名称","text") .Readonly=True End With With .AddInput("数量","数量","number") .Step= "0.01" End With With .AddInput("调拨单价","调拨单价","number") .Step= "0.01" End With With .AddInput("调拨金额11","调拨金额","number") .Step="0.01" .Readonly=True End With Else .AddHiddenValue("dbDetailID",mr("_Identify")) \'插入一个隐藏的订单明细主键,此值将随表单数据一并提交到服务器. .AddInput("药材编码","药材编码","text") With .AddInput("名称","名称","text") .Value = mr("名称") .Readonly=True End With With .AddInput("数量","数量","number") .Step= "0.01" .value = mr("数量") End With With .AddInput("调拨单价","调拨单价","number") .Step= "0.01" .value = mr("调拨单价") End With With .AddInput("调拨金额11","调拨金额","number") .value = mr("调拨金额") \'后台没有金额列,要通过数量和零售价计算得出 .Step="0.01" End With End If End With End If \'生成订单明细表格 If e.GetValues.ContainsKey("oid") AndAlso srs.count > 0 Then \'如果不是新增订单,且订单明细行数大于0,则生成订单明细表格. With wb.AddTable("form1","detailTable") \'为了区分,明细表的名字设为detailTable .head.AddRow("药材编码","名称","数量","调拨单价","调拨金额") .ActiveSheet = "menu" \'指定菜单 For Each sr As DataRow In srs With .Body.AddRow(sr("药材编码"),sr("名称"),sr("数量"),sr("调拨单价"),sr("调拨金额")) \'\'.AddCell(sr("数量") * sr("零售价")) .Primarykey = sr("_Identify") \'为此行指定主键值 End With Next Dim amt As Double amt = DataTables("调拨明细").sqlcompute("sum(调拨金额)","调拨单号=\'" & e.GetValues("oid") & "\'") With .Body.AddRow() .Attribute = "style=\'background-color:#F0FFFF\'" .AddCell("合计: ","colspan=\'3\'") .AddCells("",amt) End With End With \'设计菜单 With wb.AddActionSheet("","menu") .Add("mnudAdd", "增加明细").Attribute="" \'调用js函数 .Add("mnuEdit", "编辑明细").Attribute ="" .Add("mnuDelete", "删除明细").Attribute =""" .Add("mnuCancel","取消","",True) End With End If With wb.AddDialog("","dlg1", "删除确认","您确定要删除当前明细吗?") .AddButton("btnCancel","取消").Kind = 1 .AddButton("btnOK","确定").Attribute = "" End With With wb.AddButtonGroup("form1","btg1",False) .Add("btn1", "增加明细", "submit").FormAction = url & "&addnext=true" \'加上addnext参数,表示保存后进入增加明细状态 .Add("btn2", "保存", "submit") \'正常提交,保存后进入编辑状态 If e.GetValues.ContainsKey("oid") = False Then \'如过是新增订单 .Add("btn3", "取消", "button","dblist.htm?page=" & page & "&deloid=" & pr("调拨单号")) \'删除新增订单后返回列表 ElseIf IsNew OrElse mr IsNot Nothing Then \'如果在给旧订单新增或修改明细,则直接返回编辑状态 .Add("btn3", "取消", "button",url) \'返回编辑状态 Else .Add("btn3", "返回", "button","dblist.htm?page=" & page) \'返回列表 End If End With \'\'\'P3页面 wb.AddForm("p3","form3","spmhcxxz.htm") With wb.AddInputGroup("form3","ipg3","商品查询") .AddInput("gjz","关键字","text") With .AddInput("bm","库房","text") .Value = e.Cookies("bm") .Readonly = True End With End With With wb.AddButtonGroup("form3","btg3",True) .Add("btn3", "查询", "button").Attribute= "" \'\'.Add("btn3", "查询", "submit") End With wb.insertHtml("p3","<div id=\'p333\' style=\'margin:0.5em\'></div>") \'插入一个div,用于显示服务器返回的 页面 wb.AppendHTML("<script src=\'./lib/ajaxform.js\'></script>") \'引入脚本文件 pr.Save() \'必须保存,而且必须在最后保存,因为SQLAddNew增加的行,保存之后就会销毁,无法再调用 If e.PostValues.Count > 0 Then \'如果是通过提交按钮访问,则给一个已经保存的提示给用户,时长500毫秒 wb.AddToast("","t1", "已经保存",0).Msec= 500 End If wb.AppendHTML("<script src=\'./lib/order.js\'></script>") \'引入脚本文件 wb.AppendHTML("<script src=\'./lib/choice.js\'></script>") e.WriteString(wb.Build) \'生成网页 |
-- 作者:rjh4078 -- 发布时间:2018/6/29 21:09:00 -- save代码 Dim e As RequestEventArgs = args(0) \'保存订单 Dim dr As DataRow = DataTables("调拨单").SQLFind("调拨单号=\'" & e.PostValues("调拨单号") & "\'") Dim nms() As String = {"调拨日期","制单人","出库库房","入库库房","备注","费用","流转代码","调拨金额"} \'"" If dr IsNot Nothing Then For Each nm As String In nms If e.PostValues.ContainsKey(nm) Then dr(nm)= e.PostValues(nm) End If Next End If dr.Save() \'保存明细 Dim valid As Boolean \'用于判断用户是否 输入了订单明细数据 nms = New String() {"药材编码","名称","数量","调拨单价","调拨金额"} For Each nm As String In nms If e.PostValues.ContainsKey(nm) Then valid = True \'如果 输入了订单明细数据,将valid变量设置为True End If Next If valid Then \'如果提交了订单明细数据 Dim sr As DataRow If e.PostValues.ContainsKey("dbDetailID") Then \'如果传递了订单明细主键 sr = DataTables("调拨明细").SQLFind("[_Identify]=" & e.PostValues("dbDetailID")) If sr Is Nothing Then \'多用户环境,必须考虑其他用户删除此明细的可能,避免程序报错 Return "" End If Else sr = DataTables("调拨明细").SQLAddNew() \'增加一个订单明细 sr("调拨单号") = dr("调拨单号") End If For Each nm As String In nms sr(nm) = e.PostValues(nm) If nm="药材编码" Then Dim tr As DataRow=DataTables("产品资料").SQLFind("药材编码=\'" & e.PostValues("药材编码") & "\'") If tr IsNot Nothing Then sr("当前成本价")=tr("成本均价") sr("规格")=tr("规格") sr("型号")=tr("型号") sr("类型")=tr("类型") sr("品牌")=tr("品牌") sr("单位")=tr("单位") End If End If Next sr("调拨金额")=sr("调拨单价")*sr("数量") sr("流转代码")=Functions.Execute("流转代码",sr("调拨金额")) sr.locked=True sr.Save() \'必须保存,而且必须在最后保存,因为用SQLAddNew增加的行,一旦保存,就不能再引用此行 End If Dim kr As DataRow=DataTables("调拨单").sqlfind("调拨单号=\'" & e.PostValues("调拨单号") & "\'") If kr IsNot Nothing Then kr("调拨金额")=DataTables("调拨明细").SQLCompute("sum(调拨单价*数量)","调拨单号=\'" & e.PostValues("调拨单号") & "\'") DataTables("调拨明细").SQLReplaceFor("入库库房",e.PostValues("入库库房"),"调拨单号=\'" & e.PostValues("调拨单号") & "\'") DataTables("调拨明细").SQLReplaceFor("出库库房",e.PostValues("出库库房"),"调拨单号=\'" & e.PostValues("调拨单号") & "\'") DataTables("调拨明细").SQLReplaceFor("调拨日期",e.PostValues("调拨日期"),"调拨单号=\'" & e.PostValues("调拨单号") & "\'") kr("流转代码")=Functions.Execute("流转代码",kr("调拨金额")) kr.Locked=True kr.Save() End If |
-- 作者:有点蓝 -- 发布时间:2018/6/29 21:26:00 -- HttpRequest事件代码看看 |
-- 作者:rjh4078 -- 发布时间:2018/6/29 21:35:00 -- Dim fl As String = ProjectPath & "web\\" & e.path MessageBox.show(e.Path) If filesys.FileExists(fl) Dim idx As Integer = fl.LastIndexOf(".") Dim ext As String = fl.SubString(idx) Select Case ext Case ".jpg",".gif",".png",".bmp",".wmf",".js",".css" ,".html",".htm",".zip",".rar" e.WriteFile(fl) Return \'这里必须返回 End Select End If Dim wb As New weui \'身份验证 Dim Verified As Boolean \'用于标记用户是否通过了身份验证 Dim zh As String = e.Cookies("zh") \'从cookie中获取用户名 Dim bh As String = e.Cookies("bh") Dim bm As String = e.Cookies("bm") Dim xm As String=e.Cookies("xm") Dim mm As String =e.Cookies("mm") \'从cookie中获取用户密码 If e.Path = "logon.htm" \'如果是通过登录页面访问,从PostValues即可中提取用户名和密码 If e.PostValues.ContainsKey("bh") AndAlso e.PostValues.ContainsKey("mm") Then bh = e.PostValues("bh") mm = e.PostValues("mm") \' End If End If If bh>"" AndAlso mm>"" Then Dim tr As DataRow=DataTables("人员表").sqlfind("编号=\'" & bh & "\' and 启用=1 and 密码=\'" & EncryptText(mm,"a5","erp") & "\'" ) If tr IsNot Nothing Then Verified = True zh=tr("姓名") bm=tr("部门") Else wb.AddTopTips("","toptip5","用户名或密码错误!").msec = 2000 End If End If If Verified AndAlso e.Path = "logon.htm" Then \'如果用户访问的是登录页,且身份验证成功 wb.AppendCookie("bh",bh) \'将用户名和密码写入cookie wb.AppendCookie("mm",mm) wb.AppendCookie("bm",bm) wb.AppendCookie("xm",zh) wb.InsertHTML("<meta http-equiv=\'Refresh\' c>") \'直接跳转到首页 e.WriteString(wb.Build) \'生成网页 Return \'必须的 ElseIf Verified = False AndAlso e.Path <> "logon.htm" Then \'如果用户身份验证失败,且访问的不是登录页面 wb.InsertHTML("<meta http-equiv=\'Refresh\' c>") \'那么直接跳转到登录页面 e.WriteString(wb.Build) \'生成网页 Return \'必须的 End If \'开始生成网页 Select Case e.path Case "logon.htm" \'登录页面 wb.InsertHTML("<p align=\'center\'><img width=\'200\' height=\'190\' src=\'" & "./images/logo.png" & "\'/></p>") If e.PostValues.ContainsKey("bh") AndAlso e.PostValues.ContainsKey("mm") Then \'判断是否是验证失败后的重新登录 wb.AddTopTips("","toptip1","用户名或密码错误!").msec = 2000 \'如果用户通过登录按钮访问,则给用户一个2秒的提示. End If wb.AddForm("","form1","logon.htm") With wb.AddInputGroup("form1","ipg1") With .AddInput("bh","账号","text") If e.Cookies("bh")>"" Then .Value=e.Cookies("bh") End If End With .AddInput("mm","密码","password") End With With wb.AddButtonGroup("form1","btg1",True) .Add("btn1", "登录", "submit") End With Case "exit.htm" \'退出登录 wb.DeleteCookie("mm") wb.InsertHTML("<meta http-equiv=\'Refresh\' c>") \'那么直接跳转到登录页面 Case "index.htm" \'首页 wb.AddPageTitle("","pageheader","A5 ESA","神户医药") With wb.AddGrid("","g1") .Add("c1","销售订单", "./images/销售订单.png","list.htm") .Add("c2","上传订单图片", "./images/upload.png", "ddupload.htm") .Add("c3","订单查询", "./images/订单查询.png", "ordersearch.htm") .Add("c4","库存查询", "./images/库存查询.png", "psearch.htm") .Add("c5","订单图片查询", "./images/ddupload.png", "ddtpsearch.htm") .Add("c61","调拨单", "./images/调拨单.png", "dblist.htm") .Add("c62","调拨查询", "./images/调拨查询.png", "dbdcx.htm") .Add("c7","客户", "./images/客户查询.png", "custj.htm") .Add("c8","供应商", "./images/供应商查询.png", "suppliertj.htm") .Add("c9","上传产品图片", "./images/upload.png", "upload.htm") .Add("c12","退出", "./images/退出.png", "exit.htm") \'退出登录 End With Dim dr As DataRow dr=Functions.Execute("业务员销售统计",bh) If dr IsNot Nothing Then With wb.AddPageFooter("","pf1","Copyright © 2009-2017 bhufine.com") .AddLink("你好," & zh & "!" & Date.now.month &"月累计销售额:" & dr("销售金额") & "元.排名第" & dr("排名") & "!","") End With Else With wb.AddPageFooter("","pf1","Copyright © 2009-2017 zhufine.com") .AddLink("你好," & zh & "!" & Date.now.month &"月累计销售额:0元,暂无排名!" ,"") End With End If Case "list.htm" Functions.Execute("List",e) \'分页显示 Case "edit.htm" If e.PostValues.Count > 0 Then Functions.Execute("Save",e) \'保存表单数据 End If Functions.Execute("Edit",e) \'生成订单编辑页面 Case "psearch.htm" Functions.Execute("商品查询条件",e) Case "cpchaxun.htm" Functions.Execute("psearch",e) Case "ordersearch.htm" Functions.Execute("订单明细查询条件",e) Case "orderesults.htm" Functions.Execute("订单汇总查询",e) Case "orderdetails.htm" Functions.Execute("订单明细查询",e) |
-- 作者:rjh4078 -- 发布时间:2018/6/29 21:35:00 -- Case "upload.htm" Functions.Execute("upload",e) Case "suppliertj.htm" Functions.Execute("suppliertj",e) Case "supplier.htm" Functions.Execute("supplier",e) Case "custj.htm" Functions.Execute("custj",e) Case "cus.htm" Functions.Execute("cus",e) Case "cusaddnew.htm" Functions.Execute("cusaddnew",e) Case "receive.htm" If e.PostValues("药材类目")<>"" For Each key As String In e.Files.Keys For Each fln As String In e.Files(key) e.SaveFile(key,fln,ProjectPath & "web\\images\\药材类目\\" & e.PostValues("药材类目") & ".jpg") \'保存接收到的文件 Next Next e.WriteString("OK") Else wb.InsertHTML("药材类目不能为空!") End If Case "ddupload.htm" Functions.Execute("ddupload",e) \' Case "ddreceive.htm" Functions.Execute("ddreceive",e) Case "ddtpsearch.htm" Functions.Execute("订单图片查询条件",e) Case "ddtpchaxun.htm" Functions.Execute("ddtpsearch",e) Case "xstp.htm" Functions.Execute("xstp",e) Case "spscjg.htm" Functions.Execute("商品图片上传结果",e) Case "ddscjg.htm" Functions.Execute("订单图片上传结果",e) Case "khmhcx.htm" Functions.Execute("客户模糊查询选择",e) Case "spmhcxxz.htm" Functions.Execute("商品模糊查询选择",e) Case "dbdcx.htm" Functions.Execute("调拨单查询条件",e) Case "dbdcxhz.htm" Functions.Execute("调拨单汇总查询",e) Case "dbdetails.htm" Functions.Execute("调拨单明细查询",e) Case "dblist.htm" Functions.Execute("dblist",e) Case "dbedit.htm" Functions.Execute("dbedit",e) Case "dbsave.htm" Functions.Execute("dbsave",e) End Select e.WriteString(wb.Build) \'生成网页 |
-- 作者:有点蓝 -- 发布时间:2018/6/29 21:49:00 -- wb.AddForm("p1","form1","dbsave.htm") With wb.AddInputGroup("form1","ipg1",iif(e.GetValues.ContainsKey("oid"),"编辑","新增")) With .AddInput("调拨单号","调拨单号","text") .Value = pr("调拨单号") .Readonly = True End With |
-- 作者:rjh4078 -- 发布时间:2018/6/29 22:00:00 -- 如果改成这样 页面直接跳到dbsave.htm了 我看帮助里的源代码是
|