Anuncio de abahe

Foro

 

5 posts

Problema na geração do code 128c

13/05/2015 a las 23:10

Pessoal

Veja se alguém poderia me ajudar :

Tenho o seguinte código abaixo para gerar aos dados no formato para imprimir depois pelo code128, fiz alguns ajustes, comparando com uma dll, de teste, só que percebi que na minha está gerando um valor diferente da dll de teste, e está gerando de outra forma, e não consegui identificar o porque caso alguém saiba ou tenha passado por isto, e puder me avisa eu agradeço.
Pois o valor gerado pela dll de teste, está imprimindo sem problema, e o meu não.

Dado de origem : 35150409228249000123550650000006091911962393

Meu

'ÍC/$)6rQ !7W&R &)3+Ä7}OÎ'
Fiz o ajuste para
'ÒC/$)6rQ !7W&R &)3+Ä7}OÓ'
Agora a diferença está parte não consegui entender
Meu : Ä Dll de teste : É

Dll de teste
'ÒC/$)6rQ !7W&R &)3+É7}OÓ'

Public Shared Function GeraCode128C(ByVal f_nrCode128cIn As String, ByVal nmProcesso As String) As Boolean
'Code 128 includes 108 symbols: 103 data symbols, 3 start symbols, and 2 stop symbols.
'128A (Code Set A) - ASCII characters 00 to 95 (0-9, A-Z and control codes), special characters, and FNC 1-4
'128B (Code Set B) - ASCII characters 32 to 127 (0-9, A-Z, a-z), special characters, and FNC 1-4
'128C (Code Set C) - 00-99 (encodes each two digits with one code) and FNC1
Dim f_icRetorno As Boolean = False
Dim f_qtCode128cIn As Integer = 0
Dim f_nrCode128cPos As Integer = 0
Dim f_nrCode128cSum As Integer = 105
Dim f_nrCode128cDigitoNormal As Integer = 0
Dim f_nrCode128cDigitoChk As Integer = 0
Try
If (f_nrCode128cIn.Length Mod 2 <> 0) Then
f_nrCode128cIn = String.Concat("0", f_nrCode128cIn)
End If
f_qtCode128cIn = f_nrCode128cIn.Length / 2
Dim f_stbCode128c As New System.Text.StringBuilder((f_qtCode128cIn + 3), (f_qtCode128cIn + 3))
f_stbCode128c.Append(Convert.ToChar(205))
Do
f_nrCode128cDigitoNormal = Convert.ToInt16(f_nrCode128cIn.Substring(f_nrCode128cPos * 2, 2))
f_nrCode128cSum += (f_nrCode128cDigitoNormal * (f_nrCode128cPos + 1))
If (f_nrCode128cDigitoNormal >= 95) Then
f_stbCode128c.Append(Convert.ToChar((f_nrCode128cDigitoNormal + 100)))
Else
f_stbCode128c.Append(Convert.ToChar((f_nrCode128cDigitoNormal + 32)))
End If
f_nrCode128cPos = f_nrCode128cPos + 1
Loop While f_nrCode128cPos < f_qtCode128cIn
f_nrCode128cDigitoChk = f_nrCode128cSum Mod 103
If (f_nrCode128cDigitoChk >= 95) Then
f_nrCode128cDigitoChk += 100
Else
f_nrCode128cDigitoChk += 32
End If
f_stbCode128c.Append(Convert.ToChar(f_nrCode128cDigitoChk))
f_stbCode128c.Append(Convert.ToChar(206))
c_dsCode128c = f_stbCode128c.ToString
f_icRetorno = True
Catch f_dsException As Exception
c_icErrorLevel = 1
c_dsMensagemStatus = String.Format(cMsg_Padrao_Erro_Sistema_Classe, f_dsException.Message, nmProcesso, "GeraCode128C")
End Try
Return f_icRetorno
End Function



15/05/2015 a las 15:22

Pessoal

Pesquisando um pouco mais acabei descobrindo que existe alguma coisa relacionado a versão do code128c v.1 e v.2, alguém sabei alguma coisa sobre isto melhor ?

Onde na versão v.1 soma +100 e na versão v.2 soma +105.


15/05/2015 a las 15:26

Staff

See if anyone could help me:

I have the following code below to generate the data in the format to print after the code128, made some adjustments, compared to a dll, test, only I realized that the mine is generating a different value of the test dll, and is generating another way, and I could not identify it because if anyone knows or has gone through this, and you can let me know I appreciate it.
Because the value generated by the test dll is printing without problem, and mine did not.

Data source: 35150409228249000123550650000006091911962393

my
'ÍC/$)6rQ !7W&R &)3+Ä7}OÎ'

I made the adjustment to
'ÒC/$)6rQ !7W&R &)3+Ä7}OÓ'

Now the difference is part could not understand
My: Ä test Dll: É

Test dll
'ÒC/$)6rQ !7W&R &)3+É7}OÓ'


Public Shared Function GeraCode128C(ByVal f_nrCode128cIn As String, ByVal nmProcesso As String) As Boolean
'Code 128 includes 108 symbols: 103 data symbols, 3 start symbols, and 2 stop symbols.
'128A (Code Set A) - ASCII characters 00 to 95 (0-9, A-Z and control codes), special characters, and FNC 1-4
'128B (Code Set B) - ASCII characters 32 to 127 (0-9, A-Z, a-z), special characters, and FNC 1-4
'128C (Code Set C) - 00-99 (encodes each two digits with one code) and FNC1
Dim f_icRetorno As Boolean = False
Dim f_qtCode128cIn As Integer = 0
Dim f_nrCode128cPos As Integer = 0
Dim f_nrCode128cSum As Integer = 105
Dim f_nrCode128cDigitoNormal As Integer = 0
Dim f_nrCode128cDigitoChk As Integer = 0
Try
If (f_nrCode128cIn.Length Mod 2 <> 0) Then
f_nrCode128cIn = String.Concat("0", f_nrCode128cIn)
End If
f_qtCode128cIn = f_nrCode128cIn.Length / 2
Dim f_stbCode128c As New System.Text.StringBuilder((f_qtCode128cIn + 3), (f_qtCode128cIn + 3))
f_stbCode128c.Append(Convert.ToChar(205))
Do
f_nrCode128cDigitoNormal = Convert.ToInt16(f_nrCode128cIn.Substring(f_nrCode128cPos * 2, 2))
f_nrCode128cSum += (f_nrCode128cDigitoNormal * (f_nrCode128cPos + 1))
If (f_nrCode128cDigitoNormal >= 95) Then
f_stbCode128c.Append(Convert.ToChar((f_nrCode128cDigitoNormal + 100)))
Else
f_stbCode128c.Append(Convert.ToChar((f_nrCode128cDigitoNormal + 32)))
End If
f_nrCode128cPos = f_nrCode128cPos + 1
Loop While f_nrCode128cPos < f_qtCode128cIn
f_nrCode128cDigitoChk = f_nrCode128cSum Mod 103
If (f_nrCode128cDigitoChk >= 95) Then
f_nrCode128cDigitoChk += 100
Else
f_nrCode128cDigitoChk += 32
End If
f_stbCode128c.Append(Convert.ToChar(f_nrCode128cDigitoChk))
f_stbCode128c.Append(Convert.ToChar(206))
c_dsCode128c = f_stbCode128c.ToString
f_icRetorno = True
Catch f_dsException As Exception
c_icErrorLevel = 1
c_dsMensagemStatus = String.Format(cMsg_Padrao_Erro_Sistema_Classe, f_dsException.Message, nmProcesso, "GeraCode128C")
End Try
Return f_icRetorno
End Function


15/05/2015 a las 15:27

Staff

Searching a bit more I discovered that there is something related to version v.1 and v.2 code128c, someone then know something about this better?

Where in version v.1 sum +100 and +105 sum v.2 version.


15/05/2015 a las 15:31

Sorry but you seem to be on the wrong forum for this kind of question.



Huso horario CEST. Ahora son las 10:51


 
Política de Privacidad  -  Contacto