Rss & SiteMap
Foxtable(狐表) http://www.foxtable.com
'''
Dim T1,T2 As String
T1 = "CK" & Format(Date.today,"yyyyMM")
T2 = "[出库单号] like '" & T1 & "*'and "
T2 = T2 & "[ID] < " & e.DataRow("ID")
Dim dr As DataRow = e.DataTable.Find(T2,"ID DESC")
e.DataRow("日期") = Date.today
If dr is Nothing then
e.DataRow("出库单号") = T1 & "001"
Else
Dim n As Integer = Cint(Right(dr("出库单号"),3))+1
e.DataRow("出库单号") = T1 & Format(n,"000")
End If
好东西,收藏
If e.DataRow.IsNull("产品") Then
Return
ElseIf e.DataRow.IsNull("编号") = False AndAlso e.DataRow("编号").StartsWith(e.DataRow("产品")) Then
Return
End If
Dim cmd1 As New SQLCommand
Dim cmd2 As New SQLCommand
Dim cmd3 As New SQLCommand
Dim Key As Integer
cmd1.C
cmd2.C
cmd3.C
cmd1.commandText = "Select [编号] From [编号] Where [产品] = '" & e.DataRow("产品") & "'"
Key = cmd1.ExecuteScalar()
cmd2.commandText = "Update [编号] Set [编号] = " & (Key + 1) & " Where [编号] = " & Key & " And [产品] = '" &e.DataRow("产品") & "'"
cmd3.commandText = "Select Count(*) From [编号] Where [产品] = '" & e.DataRow("产品") & "'"
If cmd3.ExecuteScalar = 0 Then
cmd3.commandtext = "Insert Into 编号 (产品, 编号) Values('" & e.DataRow("产品") & "',1)"
cmd3.ExecuteNonQuery
End If
Do
If cmd2.ExecuteNonQuery() > 0 Then
Exit Do
Else
Key = cmd1.ExecuteScalar()
cmd2.commandText = "Update [编号] Set [编号] = " & (Key + 1) & " Where [编号] = " & Key & " And [产品] = '" &e.DataRow("产品") & "'"
End If
Loop
e.DataRow("编号") = e.DataRow("产品") & "-" & Format(Key,"0000")
这个代码能否使用简单一点啊,如
KP0903001
KP0903002
....