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 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 '自动输入订单数量
'如果录入订单编号就 插入图片 不知道怎么写
Dim tpstring As String = "默认图片"
wb.InsertHTML("<img src='./images/" & tpstring & "' width='200px'/>")
'有问题
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
dr.Save() '先保存一遍,防止后面出错没保存
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) '生成网页
getCodes.html 代码
Dim e As RequestEventArgs = args(0)
Dim dr As DataRow = DataTables("订单表").SQLFind("订单表序号='R" & e.Values("订单编号") & "'")
If dr IsNot Nothing Then
Dim dr1 As DataRow = DataTables("产品资料表").SQLFind("产品名称= '" & dr("产品名称") & "'")
If dr1 IsNot Nothing Then
e.WriteString(dr("产品名称") & "|" & dr("订单数量") & "|" & dr1("图片"))
Else
e.WriteString(dr("产品名称") & "|" & dr("订单数量"))
End If
End If