Dim e As RequestEventArgs = args(0)
Dim path As String = "foxtableAppTest"
Dim fl As String = "d:\web\" & 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",".txt"
e.WriteFile(fl)
Return "" '这里必须返回
End Select
End If
Select Case e.path
Case "prod.htm"
Dim wb As new weui
wb.AppendHTML("<script type='text/javascript' src='/" & path & "/js/common.js'></script>", True)
wb.AppendHTML("<link rel='stylesheet' href='/" & path & "/css/common.css' Type='text/css' charset='utf-8'/>", True)
wb.AppendHTML("<script src='./lib/ajaxform.js'></script>") '引入脚本文件
If e.PostValues.Count = 0 Then
wb.AddForm("","form1","prod.htm")
With wb.AddInputGroup("form1","ipg1","现场盘点")
Dim UserName As String = e.Cookies("username") '从cookie中获取用户名
Dim Val1 As String = DecryptText(UserName,"123","123") '解密,两个密钥必须和加密的时候
Dim Val2 As Date = Date.today
.AddHiddenValue("统计员",Val1)
.AddHiddenValue("日期",Val2)
With .AddInput("图号","图号","")
.Attribute = "" '调用js函数
End With
.AddInput("名称","名称","Text")
.AddInput("类别","类别","Text")
.AddInput("数量","数量","Number")
.AddInput("备注","备注","Text")
End With
With wb.AddButtonGroup("form1","btg1",False)
.Add("btn1", "确定", "submit")
.Add("btn1", "扫一扫", "button").Attribute = " & path & "/plus/barcode_scan.html',true,true);"""
.Add("btn1", "返回", "button").Attribute = ""
End With
wb.InsertHTML("<script>function scaned( t, r, f ) {document.getElementById('图号').value=r;setCodes();}</script>")
e.WriteString(wb.Build)
' msgbox(th) '这里弹出什么内容
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() {"统计员","日期","图号","名称","类别","数量","备注"} '重新定义了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","继续增加","prod.htm")
End With
e.WriteString(wb.Build)
End If
Case "getCodes.htm" '根据输入的省和县,获取区号有邮编
Dim y As Integer = Date.Today.Year
Dim m As Integer = Date.Today.Month
Dim mt As New Date(y, m, 1)
Dim cmd As New SQLCommand
Dim dt As DataTable
Dim cr As DataRow
cmd.C
cmd.CommandText = "Select * Fr om {期初表} Where 日期 = #" & mt & "# "
dt = cmd.ExecuteReader
Dim dr As DataRow = dt.Find("零件图号='" & e.Values("图号") & "'")
If dr IsNot Nothing Then
e.WriteString(dr("零件名称") & "|" & dr("备注"))
End If
End Select