Added ID barcode generator

This commit is contained in:
JackCarterSmith 2017-06-18 23:29:15 +02:00
parent e5ac69e7e9
commit 55527bc26d
9 changed files with 402 additions and 30 deletions

Binary file not shown.

View File

@ -1,6 +1,4 @@
Imports System.Data.SQLite
Public Class AddMachine_ID
Public Class AddMachine_ID
Private Sub AddMachine_ID_Load(sender As Object, e As EventArgs) Handles MyBase.Load
NextButton.Enabled = False
newIDBox.Focus()
@ -10,33 +8,8 @@ Public Class AddMachine_ID
Me.Close()
End Sub
Private Function CheckIDAlreadyUsed(idToCheck As String) As Boolean
Dim dtr As SQLiteDataReader
Try
Using con As New SQLiteConnection("URI=file:db.sqlite")
con.Open()
Using cmd As New SQLiteCommand(con)
cmd.CommandText = "SELECT * FROM computers_desc WHERE id=" & idToCheck & ";"
dtr = cmd.ExecuteReader()
While dtr.Read()
Return True
End While
Return False
End Using
con.Close()
End Using
Catch ex As Exception
Main.StatusLabel.Text = "Une erreur avec la base SQLite s'est produite !"
MsgBox(ex.Message)
End Try
Return True
End Function
Private Sub NextButton_Click(sender As Object, e As EventArgs) Handles NextButton.Click
If Not CheckIDAlreadyUsed(newIDBox.Text) Then
If Not Main.CheckIDAlreadyUsed(newIDBox.Text) Then
AddMachine.newID = newIDBox.Text
Me.Close()
Else

View File

@ -0,0 +1,140 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class IDGenerator
Inherits System.Windows.Forms.Form
'Form remplace la méthode Dispose pour nettoyer la liste des composants.
<System.Diagnostics.DebuggerNonUserCode()>
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Requise par le Concepteur Windows Form
Private components As System.ComponentModel.IContainer
'REMARQUE : la procédure suivante est requise par le Concepteur Windows Form
'Elle peut être modifiée à l'aide du Concepteur Windows Form.
'Ne la modifiez pas à l'aide de l'éditeur de code.
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(IDGenerator))
Me.Barcode1 = New IDAutomation.Windows.Forms.LinearBarCode.Barcode()
Me.GenerateNewIDButton = New System.Windows.Forms.Button()
Me.CloseButtonNewID = New System.Windows.Forms.Button()
Me.PictureBox1 = New System.Windows.Forms.PictureBox()
CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'Barcode1
'
Me.Barcode1.ApplyTilde = False
Me.Barcode1.BarHeightCM = 1.0!
Me.Barcode1.BearerBarHorizontal = 0
Me.Barcode1.BearerBarVertical = 0
Me.Barcode1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.Barcode1.CaptionAbove = ""
Me.Barcode1.CaptionBelow = ""
Me.Barcode1.CaptionBottomAlignment = System.Drawing.StringAlignment.Center
Me.Barcode1.CaptionBottomColor = System.Drawing.Color.Black
Me.Barcode1.CaptionBottomSpace = 0.1!
Me.Barcode1.CaptionFontAbove = New System.Drawing.Font("Times New Roman", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
Me.Barcode1.CaptionFontBelow = New System.Drawing.Font("Times New Roman", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Barcode1.CaptionTopAlignment = System.Drawing.StringAlignment.Center
Me.Barcode1.CaptionTopColor = System.Drawing.Color.Black
Me.Barcode1.CaptionTopSpace = 0.1!
Me.Barcode1.CharacterGrouping = 0
Me.Barcode1.CheckCharacter = False
Me.Barcode1.CheckCharacterInText = True
Me.Barcode1.CODABARStartChar = "A"
Me.Barcode1.CODABARStopChar = "B"
Me.Barcode1.Code128Set = IDAutomation.Windows.Forms.LinearBarCode.Code128CharacterSets.[Auto]
Me.Barcode1.DataToEncode = "0123456789"
Me.Barcode1.DoPaint = True
Me.Barcode1.FitControlToBarcode = True
Me.Barcode1.LeftMarginCM = 0.2!
Me.Barcode1.Location = New System.Drawing.Point(25, 53)
Me.Barcode1.Name = "Barcode1"
Me.Barcode1.NarrowToWideRatio = 2.0!
Me.Barcode1.OneBitPerPixelImage = False
Me.Barcode1.PostnetHeightShort = 0.127!
Me.Barcode1.PostnetHeightTall = 0.3226!
Me.Barcode1.PostnetSpacing = 0.064!
Me.Barcode1.Resolution = IDAutomation.Windows.Forms.LinearBarCode.Resolutions.Screen
Me.Barcode1.ResolutionCustomDPI = 96.0!
Me.Barcode1.ResolutionPrinterToUse = ""
Me.Barcode1.RotationAngle = IDAutomation.Windows.Forms.LinearBarCode.RotationAngles.Zero_Degrees
Me.Barcode1.ShowText = True
Me.Barcode1.ShowTextLocation = IDAutomation.Windows.Forms.LinearBarCode.HRTextPositions.Bottom
Me.Barcode1.Size = New System.Drawing.Size(173, 77)
Me.Barcode1.SuppSeparationCM = 0.5!
Me.Barcode1.SymbologyID = IDAutomation.Windows.Forms.LinearBarCode.Symbologies.Code39
Me.Barcode1.TabIndex = 0
Me.Barcode1.TextFontColor = System.Drawing.Color.Black
Me.Barcode1.TextMarginCM = 0.1!
Me.Barcode1.TopMarginCM = 0.2!
Me.Barcode1.UPCESystem = "0"
Me.Barcode1.WhiteBarIncrease = 0!
Me.Barcode1.XDimensionCM = 0.0298!
Me.Barcode1.XDimensionMILS = 11.7715!
'
'GenerateNewIDButton
'
Me.GenerateNewIDButton.Location = New System.Drawing.Point(12, 145)
Me.GenerateNewIDButton.Name = "GenerateNewIDButton"
Me.GenerateNewIDButton.Size = New System.Drawing.Size(198, 23)
Me.GenerateNewIDButton.TabIndex = 1
Me.GenerateNewIDButton.Text = "Générer nouvel ID"
Me.GenerateNewIDButton.UseVisualStyleBackColor = True
'
'CloseButtonNewID
'
Me.CloseButtonNewID.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.CloseButtonNewID.Location = New System.Drawing.Point(51, 170)
Me.CloseButtonNewID.Name = "CloseButtonNewID"
Me.CloseButtonNewID.Size = New System.Drawing.Size(126, 23)
Me.CloseButtonNewID.TabIndex = 2
Me.CloseButtonNewID.Text = "Fermer"
Me.CloseButtonNewID.UseVisualStyleBackColor = True
'
'PictureBox1
'
Me.PictureBox1.BackgroundImage = CType(resources.GetObject("PictureBox1.BackgroundImage"), System.Drawing.Image)
Me.PictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch
Me.PictureBox1.Location = New System.Drawing.Point(12, 12)
Me.PictureBox1.Name = "PictureBox1"
Me.PictureBox1.Size = New System.Drawing.Size(198, 127)
Me.PictureBox1.TabIndex = 3
Me.PictureBox1.TabStop = False
'
'IDGenerator
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.CancelButton = Me.CloseButtonNewID
Me.ClientSize = New System.Drawing.Size(224, 203)
Me.Controls.Add(Me.CloseButtonNewID)
Me.Controls.Add(Me.GenerateNewIDButton)
Me.Controls.Add(Me.Barcode1)
Me.Controls.Add(Me.PictureBox1)
Me.MaximizeBox = False
Me.MaximumSize = New System.Drawing.Size(240, 242)
Me.MinimizeBox = False
Me.MinimumSize = New System.Drawing.Size(240, 242)
Me.Name = "IDGenerator"
Me.ShowIcon = False
Me.Text = "Générer de nouveaux IDs"
CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
Friend WithEvents Barcode1 As Barcode
Friend WithEvents GenerateNewIDButton As Button
Friend WithEvents CloseButtonNewID As Button
Friend WithEvents PictureBox1 As PictureBox
End Class

View File

@ -0,0 +1,173 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="PictureBox1.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAATEAAADMCAIAAACUfANMAAAABGdBT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5u7ubyWRaW1v39va8PQDQcCRAybCjo8NuMpvNDg4ObmxseDsBoOFIgH19fZ2d
nZbUmcvlXr16NT4+7u0EgIYjAY6NjXV1dVnFYnF7e3t9ff3q1atLS0vefgBoIJKeBNjS0tLT02Pt7+/n
83lZN6enp9vb2z99+uSNAoCGINFJeqOjo/Lf3t5e6+DgYGdnZ2tra2Vlxd1KlgANww3y/v37169f7+7u
7u/vtw4PDwuFQjabXVtbW1xcHBkZkRE8xAI0AAnNDbK5ubmjo+PevXvDw8PW0dFR8Pi6vLw8Pz//8uVL
ebSV59o3b968f//eezcApIRkJXFJYhKaPJzKCilB3rlzZ2hoaGJiwjo+PpbHV1kqM5mMLJUS7tzc3NTU
1OTk5MDAQGtraxMApIpk1dfXNzY21tLSIuukPLLKCilBPnnyRNKzTk5OZKksFouyVG5ubq6uri4sLMzO
zso+SVZWUnnAle+d0nRXV1dnZ6cEfRMAzoFEJClJUJKVxCWJSWiSm0Q3Ozv7X9DU8hDC8tDzAAAAAElF
TkSuQmCC
</value>
</data>
</root>

View File

@ -0,0 +1,32 @@
Imports System.Text
Public Class IDGenerator
Private Sub IDGenerator_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Randomize()
GenerateNewIDBarcode()
End Sub
Private Sub GenerateNewIDBarcode()
'Génération d'un nouvel ID
Dim s As String = "0123456789"
Dim r As New Random
Dim sb As New StringBuilder
generate:
sb.Clear()
For i As Integer = 1 To 10
Dim idx As Integer = r.Next(0, 9)
sb.Append(s.Substring(idx, 1))
Next
'Vérification si pas déjà existant
If Not Main.CheckIDAlreadyUsed(sb.ToString()) Then Barcode1.DataToEncode = sb.ToString() Else GoTo generate
End Sub
Private Sub GenerateNewIDButton_Click(sender As Object, e As EventArgs) Handles GenerateNewIDButton.Click
GenerateNewIDBarcode()
End Sub
Private Sub CloseButtonNewID_Click(sender As Object, e As EventArgs) Handles CloseButtonNewID.Click
Me.Close()
End Sub
End Class

View File

@ -61,6 +61,9 @@
<SignManifests>false</SignManifests>
</PropertyGroup>
<ItemGroup>
<Reference Include="IDAutomation.LinearBarCode">
<HintPath>..\..\..\IDAutomation_LinearFormsControlFREE\IDAutomation.LinearBarCode.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Data.SQLite, Version=1.0.104.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
@ -76,6 +79,8 @@
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup>
<Import Include="IDAutomation.Windows.Forms.LinearBarCode" />
<Import Include="IDAutomation.Windows.Forms.LinearBarCode.PropertyPage" />
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
@ -107,6 +112,12 @@
<Compile Include="AddMachine.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="IDGenerator.Designer.vb">
<DependentUpon>IDGenerator.vb</DependentUpon>
</Compile>
<Compile Include="IDGenerator.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="Main.vb">
<SubType>Form</SubType>
</Compile>
@ -146,6 +157,9 @@
<EmbeddedResource Include="AddMachine.resx">
<DependentUpon>AddMachine.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="IDGenerator.resx">
<DependentUpon>IDGenerator.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Main.resx">
<DependentUpon>Main.vb</DependentUpon>
</EmbeddedResource>

View File

@ -59,6 +59,7 @@ Partial Class Main
Me.OSBox = New System.Windows.Forms.TextBox()
Me.ArchBox = New System.Windows.Forms.TextBox()
Me.EditButton = New System.Windows.Forms.Button()
Me.GénérerDesIDsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.MenuStrip1.SuspendLayout()
Me.StatusStrip1.SuspendLayout()
Me.GroupBox1.SuspendLayout()
@ -68,7 +69,7 @@ Partial Class Main
'
'MenuStrip1
'
Me.MenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.AddComputerToolMenuItem, Me.AboutToolMenuItem})
Me.MenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.AddComputerToolMenuItem, Me.GénérerDesIDsToolStripMenuItem, Me.AboutToolMenuItem})
Me.MenuStrip1.Location = New System.Drawing.Point(0, 0)
Me.MenuStrip1.Name = "MenuStrip1"
Me.MenuStrip1.Size = New System.Drawing.Size(874, 24)
@ -434,6 +435,12 @@ Partial Class Main
Me.EditButton.Text = "Editer le suivi"
Me.EditButton.UseVisualStyleBackColor = False
'
'GénérerDesIDsToolStripMenuItem
'
Me.GénérerDesIDsToolStripMenuItem.Name = "GénérerDesIDsToolStripMenuItem"
Me.GénérerDesIDsToolStripMenuItem.Size = New System.Drawing.Size(100, 20)
Me.GénérerDesIDsToolStripMenuItem.Text = "Générer des IDs"
'
'Main
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
@ -504,4 +511,5 @@ Partial Class Main
Friend WithEvents EditButton As Button
Friend WithEvents IDBox As MaskedTextBox
Private WithEvents AddComputerToolMenuItem As ToolStripMenuItem
Friend WithEvents GénérerDesIDsToolStripMenuItem As ToolStripMenuItem
End Class

View File

@ -19,6 +19,31 @@ Public Class Main
End If
End Sub
Public Function CheckIDAlreadyUsed(idToCheck As String) As Boolean
Dim dtr As SQLiteDataReader
Try
Using con As New SQLiteConnection("URI=file:db.sqlite")
con.Open()
Using cmd As New SQLiteCommand(con)
cmd.CommandText = "SELECT * FROM computers_desc WHERE id=" & idToCheck & ";"
dtr = cmd.ExecuteReader()
While dtr.Read()
Return True
End While
Return False
End Using
con.Close()
End Using
Catch ex As Exception
StatusLabel.Text = "Une erreur avec la base SQLite s'est produite !"
MsgBox(ex.Message)
End Try
Return True
End Function
Private Sub RegenerateDB()
Dim genesis_seq As String = "
CREATE TABLE `computers_desc` (
@ -317,4 +342,11 @@ Public Class Main
IDBox.Text = IDBox.Text & "9"
End Select
End Sub
Private Sub GénérerDesIDsToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles GénérerDesIDsToolStripMenuItem.Click
Dim idGeneratorForm As IDGenerator
idGeneratorForm = New IDGenerator()
idGeneratorForm.Show()
idGeneratorForm = Nothing
End Sub
End Class

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB