以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  移动端录入问题  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=123556)

--  作者:apple12123
--  发布时间:2018/8/17 15:52:00
--  移动端录入问题
老师  你好
移动端使用以下代码,在表中录入数据,经常出现的问题是,点一次确定按钮,连续增加好几条重复的数据。请老师给看看代码,有什么问题吗?  
 Case "ckpc.htm"
        If e.PostValues.Count = 0 Then
            wb.AddForm("","form1","ckpc.htm")
            With wb.AddInputGroup("form1","ipg1","出库批次录入")
                With .Addinput("出库日期","出库日期","date")
                    .Attribute = """
                End With
                With .AddSelect("排单顺序","排单顺序","")
                    .Attribute = """
                End With
                .AddSelect("产品名称","产品名称","")
                .AddInput("数量","数量","number")
                .AddInput("托盘流水号","托盘流水号","Text")
                .AddInput("详细批次2","手工批次","Text")
            End With
            With wb.AddButtonGroup("form1","btg1",False)
                .Add("btn1", "确定", "submit")
                .Add("btn2","首页","" ,"default.htm")
            End With
            e.WriteString(wb.Build) \'生成网页
        Else
            Dim nms() As String = {"出库日期","排单顺序","产品名称","数量"}
            For Each nm As String In nms
                If e.PostValues.ContainsKey(nm) = False Then \'生成错误提示页
                    With wb.AddMsgPage("","msgpage","增加失败", nm & "列不能为空!")
                        .icon = "Warn" \'改变图标
                        .AddButton("btn1","返回").Attribute = ""
                    End With
                    e.WriteString(wb.Build)
                    Return \'必须返回
                End If
            Next
            nms = New String() {"出库日期","排单顺序","产品名称","数量","托盘流水号","详细批次2"} \'重新定义了nms数组,增加了两列.
            Dim dr As DataRow = DataTables("出库批次台账").AddNew()
            For Each nm As String In nms
                If e.PostValues.ContainsKey(nm) Then
                    dr(nm) = e.PostValues(nm)
                End If
            Next
            dr.save()
            With wb.AddMsgPage("","msgpage","增加成功", "") \'生成成功提示页
            .AddButton("btn1","继续增加","ckpc.htm")
            End With
            e.WriteString(wb.Build)
        End If


--  作者:有点蓝
--  发布时间:2018/8/17 16:06:00
--  
这个事件或者函数的完整代码发出来。httprequest事件完整代码发上来
--  作者:apple12123
--  发布时间:2018/8/17 16:17:00
--  动端录入问题
 Case "ckpc.htm"
        If e.PostValues.Count = 0 Then
            wb.AddForm("","form1","ckpc.htm")
            With wb.AddInputGroup("form1","ipg1","出库批次录入")
                With .Addinput("出库日期","出库日期","date")
                    .Attribute = """
                End With
                With .AddSelect("排单顺序","排单顺序","")
                    .Attribute = """
                End With
                .AddSelect("产品名称","产品名称","")
                .AddInput("数量","数量","number")
                .AddInput("托盘流水号","托盘流水号","Text")
                .AddInput("详细批次2","手工批次","Text")
            End With
            With wb.AddButtonGroup("form1","btg1",False)
                .Add("btn1", "确定", "submit")
                .Add("btn2","首页","" ,"default.htm")
            End With
            e.WriteString(wb.Build) \'生成网页
        Else
            Dim nms() As String = {"出库日期","排单顺序","产品名称","数量"}
            For Each nm As String In nms
                If e.PostValues.ContainsKey(nm) = False Then \'生成错误提示页
                    With wb.AddMsgPage("","msgpage","增加失败", nm & "列不能为空!")
                        .icon = "Warn" \'改变图标
                        .AddButton("btn1","返回").Attribute = ""
                    End With
                    e.WriteString(wb.Build)
                    Return \'必须返回
                End If
            Next
            nms = New String() {"出库日期","排单顺序","产品名称","数量","托盘流水号","详细批次2"} \'重新定义了nms数组,增加了两列.
            Dim dr As DataRow = DataTables("出库批次台账").AddNew()
            For Each nm As String In nms
                If e.PostValues.ContainsKey(nm) Then
                    dr(nm) = e.PostValues(nm)
                End If
            Next
            dr.save()
            With wb.AddMsgPage("","msgpage","增加成功", "") \'生成成功提示页
                .AddButton("btn1","继续增加","ckpc.htm")
            End With
            e.WriteString(wb.Build)
        End If
    Case  "getcks1.htm"
        Dim vals As String
        If e.PostValues.Count = 1 Then
            vals  = "|" & DataTables("出库明细表").SQLGetComboListString("排单顺序","出库日期 = \'" & e.PostValues("出库日期") & "\'")
        ElseIf e.PostValues.Count = 2 Then
            Dim Filter As String = "出库日期 = \'" & e.PostValues("出库日期") & "\' And 排单顺序=\'" & e.PostValues("排单顺序") & "\'"
            vals = "|" & DataTables("出库明细表").SQLGetComboListString("产品名称", Filter)
        End If
        e.WriteString(vals)


--  作者:apple12123
--  发布时间:2018/8/17 16:18:00
--  动端录入问题
老师   相关的就是这些代码了     都复制了     不知道为什么发送不了
--  作者:有点蓝
--  发布时间:2018/8/17 16:22:00
--  
复制到记事本上传,或者直接上传项目文件


--  作者:apple12123
--  发布时间:2018/8/17 16:30:00
--  
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:httprequest事件完整代码.txt


--  作者:apple12123
--  发布时间:2018/8/17 16:32:00
--  
有时候有些按钮或者  .AddSelect    这类的选择框  点上没有反应
--  作者:有点蓝
--  发布时间:2018/8/17 16:46:00
--  
1、不能重复调用e.WriteString,如果某个case里使用到,后面必须加上return

[此贴子已经被作者于2018/8/17 17:05:26编辑过]

--  作者:apple12123
--  发布时间:2018/8/17 16:55:00
--  


图片点击可在新窗口打开查看此主题相关图片如下:_ga7d_y(l(r$js6k)jy(7jf.png
图片点击可在新窗口打开查看

 

提示出错了


--  作者:有点蓝
--  发布时间:2018/8/17 17:26:00
--  
看错了。第2个代码不用改。这个改改:

不能重复调用e.WriteString,如果某个case里使用到,后面必须加上return

如果还有问题,请上传具体实例测试