以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  自动编号  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=91882)

--  作者:lk15502
--  发布时间:2016/10/21 7:56:00
--  自动编号
表中的缸号列,需要自动编号,项目的代码,有时候能产生编号,有时候没有反应,请求老师看看有什么不对,还有弹窗的问题,应该是代码设计不合理:
 \'Case "缸号"
        \'If e.DataRow("生产类型") = "生产" OrElse e.DataRow("生产类型")  = "改染"  Then
            \'Dim lb As String = Format(Date.Today,"yy")
  \'
                \'Dim max As String
                \'Dim idx As Integer
                \'max = e.DataTable.sqlcompute("max(缸号)","缸号 not like \'%-%\' and [_identify] <> " & e.DataRow("_identify") )
                \'If max > "" Then
                    \'idx = cint(max.Substring(2)) + 1
                \'Else
                    \'idx = 1
                \'End If
                \'e.DataRow("缸号") = lb & Format(idx,"00000")
                \'e.DataRow.save
            \'
        \'\'ElseIf e.DataRow("生产类型") = "回修" Then
            \'\'msgbox("回修允许使用重复缸号,请确认生产类型是否回修")
        \'\'ElseIf e.DataRow("生产类型")  = "生产-子缸号" OrElse e.DataRow("生产类型") = "改染-子缸号" Then
            \'\'msgbox("允许手工编写缸号,请仔细确认!")
        \'\'ElseIf e.DataRow.Isnull("生产类型") = True Then
            \'\'msgbox("请选择生产类型,才能输入缸号")
            \'\'e.DataRow("缸号") = Nothing
        \'End If


--  作者:有点蓝
--  发布时间:2016/10/21 8:50:00
--  
Case "生产类型"
    If e.DataRow("生产类型") = "生产" OrElse e.DataRow("生产类型")  = "改染"  Then
        Dim lb As String = Format(Date.Today,"yy")
        ......

--  作者:lk15502
--  发布时间:2016/10/21 10:49:00
--  
明白了,谢谢!