以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 自动编码异常 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=139962) |
-- 作者:有点蓝 -- 发布时间:2019/8/26 17:19:00 -- 参考:http://www.foxtable.com/webhelp/topics/2403.htm,看四、按日期和类别编号 |
-- 作者:有点蓝 -- 发布时间:2019/8/26 17:31:00 -- 开头的那几个字母不是单独列,那么是怎么来的?如果没有类别,那么编码规则只能有一种,否则无法正常使用。 |
-- 作者:2900819580 -- 发布时间:2019/8/26 17:33:00 -- max = Tables("总任务库").DataTable.SQLCompute("Max(任务编码)","下达日期 = \'" & e.DataRow("下达日期") & "\' And [_Identify] <> " &e.DataRow("_Identify") & "and 任务编码 like \'RWSQ%\'") \'取得该天的最大编号 |
-- 作者:有点蓝 -- 发布时间:2019/9/10 9:53:00 -- Else e.DataRow.save Dim bh As String = "RWSQ" & Format(e.DataRow("下达日期"),"yyMMdd") \' 取得编号的8位前缀 If e.DataRow("任务编码").StartsWith(bh) = False \'如果编号的前8位不符 Dim dt2 As DataTable = DataTables("总任务库") Dim max As String Dim idx As Integer max = Tables("总任务库").DataTable.SQLCompute("Max(任务编码)","下达日期 = \'" & e.DataRow("下达日期") & "\' And [_Identify] <> " & e.DataRow("_Identify") & " and 任务编码 like \'RWSQ%\'") \'取得该天的最大编号 If max > "" Then \'如果存在最大编号 idx = CInt(max.Substring(10,3)) + 1 \'获得最大编号的后三位顺序号,并加1 Else idx = 1 \'否则顺序号等于1 End If e.DataRow("任务编码") = bh & Format(idx,"000") e.DataRow.save End If End If |