Rss & SiteMap
Foxtable(狐表) http://www.foxtable.com
问题:服务器端程序重启后,afteropenproject 根据datatable生成的字典里面没有数据,造成编码从1开始编。请老师帮助看一下,谢谢! 下载信息 [文件大小: 下载次数: ] 点击浏览该文件:项目.zip
afteropenproject:
Forms("QQServer").Open()
Dim dt As DataTable
Dim cmd As New SQLCommand
cmd.CommandText = "Se-lect 工程代码,Year(制单日期) As 年, Month(制单日期) As 月, Max(单据编号) as 单据编号 From {编码表} Group By 工程代码,Year(制单日期), Month(制单日期)"
dt = cmd.ExecuteReader
flbhs.Clear()
For Each dr As DataRow In dt.DataRows
Dim qz As String = dr("工程代码") & dr("年") & Format(dr("月"), "00") '编号前缀,4位工程代码,4位年,2位月
Dim bh As String = dr("单据编号")
Dim id As Integer
If bh.Length = 14 Then
bh = bh.SubString(10)
If Integer.TryParse(bh, id) Then
flbhs.Add(qz, id)
End If
End If
Next
receivemessage:
If e.Message = "GetDate" Then
e.ReturnValue = Date.Now
End If
Dim msg As String = e.Message
If msg.StartsWith(":g") AndAlso msg.EndsWith("g:") Then
msg = msg.SubString(2, msg.Length - 4)
'Output.Show(msg)
If flbhs.ContainsKey(msg) Then '如果存在这个月的编号
flbhs(msg) = flbhs(msg) + 1 '将该月最大编号加1
Else
flbhs.Add(msg, 1) '如果这个月的首次编号,则编号等于1
End If
e.ReturnValue = flbhs(msg)
Dim dr As DataRow = DataTables("编码表").AddNew()
dr("工程代码") = msg.Substring(0, 2)
dr("制单日期") = Date.Today
dr("单据编号") = msg & Format(flbhs(msg), "0000")
DataTables("编码表").Save()
End If