Dim e As RequestEventArgs = args(0)
Dim wb As New weui
If e.PostValues.Count = 0 Then '生成增加订单网页
wb.AddTopTips("","toptip1","") '用于显示动态错误提示
wb.AddForm("","form1","addnew.htm") .Attribute="" '验证表单receive.htm
With wb.AddInputGroup("form1","ipg1","增加报表")
Dim xm As String = e.Cookies("username")
xm= DecryptText(xm,"123","123")
With .AddInput("姓名","姓名","text")
.Value= xm '.AddHiddenValue后面做隐藏的
.Readonly=True
End With
' Dim gjs1 As List(of String) = DataTables("员工资料表").SQLGetValues("姓名","绩效工资= 1","部门 desc")
' .AddSelect("姓名","姓名","|" & String.Join("|",gjs1.ToArray)).Required =True '.Attribute = "" '调用js函数.
Dim gjs As List(of String) = DataTables("员工资料表").sqlGetValues("设备","排计划= 1","序号")
With .AddSelect("机台","机台","|" & String.Join("|",gjs.ToArray)) '.Attribute = "" '调用js函数.
.Required =True
.Attribute = ""
End With
With .AddInput("订单编号","订单编号R","number") '写在一起,如 "
.Attribute = """
End With
.AddInput("产品","产品","").Readonly=True
.AddInput("订单数量","订单数量","number").Readonly=True '自动输入订单数量
With .AddSelect("工序","工序","")
.Attribute = ""
End With
.AddInput("详细工作内容","详情","text").Placeholder= "可输入详细内容:如机台维护,换刀..."
Dim time As Date = #00:01:00#
'With .AddInputCell("ic3",2) '通过InputCell增加输入框, 2表示突出显示(含图标)
'.AddLabel("lmm","机器时间",0) '增加标签,0显示在左边
'.AddInput("机器时间","机器时间",1).value = Format(time,"HH:mm:ss") '.PlaceHolder= "请输入密码" '增加输入框,1表示显示在中间
'End With
With .AddInput("机器时间","机器时间","text")
.value = Format(time,"HH:mm:ss")
End With
.AddInput("单次数量生产","单次数量","number").Value =1
Dim Date1 As Date = Date.Now
.AddInput("起始时间","起始日期","datetime-local").value = Format(Date1,"yyyy-MM-ddT08:00")
.AddInput("结束时间","结束日期","datetime-local").value = format(Date1,"yyyy-MM-ddT08:00")
.AddInput("实际产量","实际产量","number")
With .AddUploader("质检报告图片","检验报表/交货照片",False)
.AllowDelete = True '允许删除
.Incremental = True '允许重复选择文件或连续拍照
' .Rotate = 1 '顺时钟旋转90°
.ScaleWidth = 1500 '自动压缩图片宽度为400个像素,高度等比例压缩
End With
With wb.AddButtonGroup("form1","btg1",True)
With .Add("btn1", "确定提交", "button")
.Kind = 0 ' .Attribute= "" '调用js函数上传
.Attribute="""
End With
.add("btn2","返回主页","","default.htm").Kind = 1
End With
wb.AddToast("","tst1", "正在上传",1)
wb.AddToast("","tst2", "上传成功",0)
wb.AddToast("","tst3", "上传失败",0).Icon= "warn"
End With
Else '保存新增的订单
Dim dr As DataRow = DataTables("生产日报表").AddNew()
Dim nms() As String = {"姓名","机台","订单编号","工序","机器时间","单次数量生产","起始时间","结束时间","实际产量","质检报告图片","详细工作内容"}
For Each nm As String In nms
dr(nm) = e.PostValues(nm)
Next
Dim flm As String '记录多个文件名
For Each key As String In e.Files.Keys '应该是这段保存文件报错,
For Each fln As String In e.Files(key)
If fln IsNot Nothing Then
e.SaveFile(key,fln,"d:\myftp\sctp\" & fln) '保存接收到的文件
flm = flm & vbcrlf & "/sctp/" & fln '
End If
Next
Next
flm = flm.TrimStart()
dr("质检报告图片")= flm '这里及以后没执行
Dim p As String = IIF(dr.RowState = DataRowState.Added, "A#", "U#")
dr.Save()
Dim msg As String = p & dr.DataTable.Name & "#" & dr("_Identify")
e.WriteString("OK")
End If
wb.AppendHTML("<script src='./lib/ajaxform.js'></script>") '引入脚本文件
e.WriteString(wb.Build) '生成网页