题目
1.项目调用第三方dll,使用bartender软件制作标签
2.输入内部批号信息,可根据内部批号带出其他基本信息,并体现在标签上
3.根据标签内容,可显示 条形码,二维码等信息,并可用BarCode 扫描内容,并显示正确文章来源:https://www.toymoban.com/news/detail-511812.html
4.数量计算规则:标签个数= 打印批号的当前数量 / 1000 (一箱数量)文章来源地址https://www.toymoban.com/news/detail-511812.html
代码
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim datestr As Date = Date.Now
datestr = datestr.ToStri``ng("yyyy/MM/dd")
Dim btapp As BarTender.Application
Dim btFormat As BarTender.Format
btapp = New BarTender.Application
Dim ds As New SqlClient.SqlConnection
Dim dm As New SqlClient.SqlCommand
ds.ConnectionString = "Data Source=服务器名;Initial Catalog=数据表;User ID=***;Password=****;"
dm.Connection = ds
dm.CommandText = "select CUSTENG ,***,CustLotNo ,CustProduct,CurrentQTY from WIPLOT where *** = '" & TextBox1.Text & "' "
Dim dataAdapter As New SqlClient.SqlDataAdapter
dataAdapter.SelectCommand = dm
Dim mydataset As New DataSet()
ds.Open()
dataAdapter.SelectCommand.ExecuteNonQuery()
dataAdapter.Fill(mydataset, "wiplot")
Dim s As Integer
If mydataset.Tables("wiplot").Rows(0).ItemArray(4) Mod 1000 = 0 Then
s = mydataset.Tables("wiplot").Rows(0).ItemArray(4) \ 1000
Else
s = Fix(mydataset.Tables("wiplot").Rows(0).ItemArray(4) \ 1000 + 1)
End If
TextBox2.Text = s
If mydataset.Tables("wiplot").Rows(0).ItemArray(4) Mod 1000 = 0 Then
For i = 1 To s
Dim cust = mydataset.Tables("wiplot").Rows(0).Item("CUSTENG").ToString
Dim ilot = mydataset.Tables("wiplot").Rows(0).ItemArray(1).ToString
Dim clot = mydataset.Tables("wiplot").Rows(0).ItemArray(2).ToString
Dim cprod = mydataset.Tables("wiplot").Rows(0).ItemArray(3).ToString
Dim BID As String = cprod + "," + ilot + "," + cprod + "," & 1000
Dim Box_No = i & "/" & s
btFormat = btapp.Formats.Open("C:\Users\Administrator\Desktop\实习计划\2022-02-23\H-inlabel.btw", False, "")
btFormat.PrintSetup.NumberSerializedLabels = 2
btFormat.SetNamedSubStringValue("cust", cust)
btFormat.SetNamedSubStringValue("ilot", ilot)
btFormat.SetNamedSubStringValue("clot", clot)
btFormat.SetNamedSubStringValue("cprod", cprod)
btFormat.SetNamedSubStringValue("BID", BID)
btFormat.SetNamedSubStringValue("Indate", datestr)
btFormat.SetNamedSubStringValue("Box_No", Box_No)
btFormat.PrintOut(True, False)
Next
Else
For i = 1 To s
Dim cust = mydataset.Tables("wiplot").Rows(0).ItemArray(0).ToString
Dim ilot = mydataset.Tables("wiplot").Rows(0).ItemArray(1).ToString
Dim clot = mydataset.Tables("wiplot").Rows(0).ItemArray(2).ToString
Dim cprod = mydataset.Tables("wiplot").Rows(0).ItemArray(3).ToString
Dim BID As String
Dim Box_No = i & "/" & s
If i = s Then
BID = cprod + "," + ilot + "," + cprod + "," & mydataset.Tables("wiplot").Rows(0).ItemArray(4) Mod 1000
btFormat = btapp.Formats.Open("C:\Users\Administrator\Desktop\实习计划\2022-02-23\H-inlabel.btw", False, "")
btFormat.PrintSetup.NumberSerializedLabels = 2
btFormat.SetNamedSubStringValue("cust", cust)
btFormat.SetNamedSubStringValue("ilot", ilot)
btFormat.SetNamedSubStringValue("clot", clot)
btFormat.SetNamedSubStringValue("cprod", cprod)
btFormat.SetNamedSubStringValue("BID", BID)
btFormat.SetNamedSubStringValue("Indate", datestr)
btFormat.SetNamedSubStringValue("Box_No", Box_No)
btFormat.PrintOut(True, False)
Exit For
End If
BID = cprod + "," + ilot + "," + cprod + "," & 1000
btFormat = btapp.Formats.Open("C:\Users\Administrator\Desktop\实习计划\2022-02-23\H-***.btw", False, "")
btFormat.PrintSetup.NumberSerializedLabels = 2
btFormat.SetNamedSubStringValue("cust", cust)
btFormat.SetNamedSubStringValue("ilot", ilot)
btFormat.SetNamedSubStringValue("clot", clot)
btFormat.SetNamedSubStringValue("cprod", cprod)
btFormat.SetNamedSubStringValue("BID", BID)
btFormat.SetNamedSubStringValue("Indate", datestr)
btFormat.SetNamedSubStringValue("Box_No", Box_No)
btFormat.PrintOut(True, False)
Next
End If
btFormat.Close()
btapp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)
End Sub
End Class
到了这里,关于使用vb.net调用bartender并打印标签的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!