采购申请,采购订单,收货项目和库存申请,他们分别有PR,PO,RI和SR的首字母。现在我为什么这么说呢?因为这个。
我之前说的每个模块都有自己的交易,每个交易都有自己的参考编号或将用作唯一ID的数据。
现在我的问题在于下面的图片
我该如何实现?(最好在文本框中显示)我想为每个模块提供这种唯一ID。
说真的,我不知道怎么做,因为这是我第一次这样做。
如果有专业人士和骗子,可以,我会为此设置参数。
我希望有人帮助我。
答案 0 :(得分:0)
这是我对自己问题的回答,但无论如何TYSM对那些没有回答我的问题的评论员反而给我一个否定的代码。
抱歉,我真的需要那些代码,对于那些想要这种代码的人来说,它是。
Dim con As MySqlConnection = New MySqlConnection("Your MySQL Connection")
Dim cmd As MySqlCommand = New MySqlCommand("select Max(Column_Of_Unique_ID) as UniqueValue from TableName", con)
Dim reader As MySqlDataReader
con.Open()
reader = cmd.ExecuteReader
Try
While reader.Read
'If its Purchase Order then PO
'If its Purchase Requisition then PR
'If its Receiving Items then RI
'If its Stock Requisition then SR
TextBox1.Text = reader.GetString("UniqueValue")
TextBox1.Text = TextBox1.Text.Replace("PO", "").Trim()
TextBox1.Text = TextBox1.Text + 1
If TextBox1.Text.Length = 1 Then
TextBox1.Text = "PO" & "0000000" & TextBox1.Text
ElseIf TextBox1.Text.Length = 2 Then
TextBox1.Text = "PO" & "000000" & TextBox1.Text
ElseIf TextBox1.Text.Length = 3 Then
TextBox1.Text = "PO" & "00000" & TextBox1.Text
ElseIf TextBox1.Text.Length = 4 Then
TextBox1.Text = "PO" & "0000" & TextBox1.Text
ElseIf TextBox1.Text.Length = 5 Then
TextBox1.Text = "PO" & "000" & TextBox1.Text
ElseIf TextBox1.Text.Length = 6 Then
TextBox1.Text = "PO" & "00" & TextBox1.Text
ElseIf TextBox1.Text.Length = 7 Then
TextBox1.Text = "PO" & "0" & TextBox1.Text
ElseIf TextBox1.Text.Length = 8 Then
TextBox1.Text = "PO" & TextBox1.Text
End If
End While
Catch
TextBox1.Text = "PO00000001"
End Try