spf_barcode 0.0.13 → 0.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YjBlODFiOTJjNWFhMTc2NmI2ZTc2NzIzZmZhMTYyYTExMTY1MjEyMQ==
4
+ Yzc1N2Y0MWVhYmE3MmQwNjE1NzNmNDcxMzhiYzhhMTlhNjgxMGU5MA==
5
5
  data.tar.gz: !binary |-
6
- ZTRkMzI1MWUxMTViY2QwY2NmYTJkMmJlMDk1NWEwZDJmMzNmMmEzNw==
6
+ NDBiNTk2M2I2OTBmM2QyZmU3MGFhNzFhNDY3NDFhZGIxMDY3ZDcxNQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- Y2Q3NjQ2MGMyMTQ0N2U5ZjU0ZDgzYzdiZjFkNDkxNjE5OWU2OTUxZGZkMTgw
10
- Nzk0YTFlZmE5YjM0ZmEzY2U5ZGUyNzFjNGNlZjgzZmJjYzA4NmE3MDBhNzMx
11
- MmFhYzViMGI5YjUxZGMzYzljMDg2NWY2MTUzZmY1YjAwYThmYzA=
9
+ ZjU0ZWI4NDcyYzIyMGY4ZjUyZGQ3NWYzMWMxNTZlOTYwYjgyMzcxMTNhZmEz
10
+ NjUzOTRjYmQ5NDc2NDNkODVjNjZlOTNmYmZhMTY4ZmZlOTkyYzkxMmU2NGYx
11
+ MjY5MGE2YTJjNDdkMzY0ZmUzN2Q2MDkwMzIzNjViMzg2ODA3MGU=
12
12
  data.tar.gz: !binary |-
13
- ZjZlYWU4ODY2Y2FlNDM3MGVhMGVhMzQwNDhlYTkxYTI2ZGE0MTc1YjFiM2Ix
14
- ZGI4ZTIzNWY5ZWZhODMzOGRjN2RmOWZiMDFhNDFjYzNiOWM5NGFlZjFhNzNj
15
- ODA4MjBlNjBhZDdiYTEwNjk5ZWQ3YjE4ZDAxNmFmMjdjZTU4ZWI=
13
+ NGVlMWQwMWQ2YmVjOTdiOTVlMTFkZWI5OTQ4YjRiOGM3YTBhZGIwNjM1MTJi
14
+ ZmI2MWY3YmE2M2E1M2QyZjA1MGQ2NWViYWU4MDQ3MGNhM2NkNmMyMjg0ODZl
15
+ NjA0N2ExMWU4ZWU4NDlkYjVhOWViZGM4YWIzYTM3YjAyNzg3NWY=
@@ -0,0 +1,47 @@
1
+ # encoding: utf-8
2
+
3
+ # ESTA CLASE GENERA UN NUMERO PARA ARMAR PAREJAS DE LAMINADOS
4
+ # PARA QUE SEA MAS FACIL LA IDENTIFICACION DE LOS MISMOS
5
+ # EN LUGAR DE FIJARSE EN UNA MEDIDA 1234*876
6
+ # SE VA A GENERAR UN NUMERO DEL 1 A N
7
+ # Y TMB 23-2 SIGNIFICA QUE LA MEDIDA 23 TIENE DOS VIDRIOS O LAMINADOS
8
+
9
+
10
+ class GeneradorOrden
11
+ def initialize(traz_lam)
12
+ @componente = traz_lam.componente
13
+ @linea_item = traz_lam.linea_item
14
+ @pedido = @linea_item.item.pedido
15
+ @composicion = traz_lam.composicion
16
+ end
17
+
18
+ def get
19
+ contador_medida = 1
20
+ # asigna el primer número
21
+ @pedido.items.order(:id).map(&:item_medidas).flatten.each do |im|
22
+ break if im == @linea_item
23
+ contador_medida += 1
24
+ end
25
+
26
+
27
+ return contador_medida.to_s unless @composicion.es_dvh?
28
+
29
+ array = []
30
+ @composicion.get_vidrios.each do |componente|
31
+ laminado_elementos = componente.elementos.sort{ |a,b| a.orden <=> b.orden }.map(&:elemento_de_componente).flatten
32
+ array << {componente: componente, elementos: laminado_elementos}
33
+ end
34
+
35
+ return contador_medida.to_s if array.map{|a| a[:elementos]}.uniq.length == 1
36
+
37
+ contador_componente = 1
38
+ array.map{ |a| a[:componente] }.each do |comp|
39
+ break if comp == @componente
40
+ contador_componente += 1
41
+ end
42
+
43
+
44
+ "#{contador_medida}/#{contador_componente.to_s36}"
45
+
46
+ end
47
+ end
@@ -1,4 +1,9 @@
1
1
  # encoding: utf-8
2
+
3
+ require 'to_barcode_alfanumerico'
4
+ require 'to_barcode_numerico'
5
+ require 'generador_orden'
6
+
2
7
  class BarcodeOptimaDecode
3
8
  def initialize(barcode)
4
9
  @barcode = barcode
@@ -57,6 +62,15 @@ class BarcodeOptimaDecode
57
62
  when '5' then @accion = 'SELECCIONAR'
58
63
  when '8' then @accion = 'REDIRECCION'
59
64
  end
65
+ elsif @barcode.length.between?(9,11)
66
+
67
+ @barcode_alfanumerico = @barcode
68
+ @barcode = @barcode.to_i36.to_s
69
+
70
+ decode_pedido
71
+ decode_item
72
+ decode_item_medida
73
+ decode_objeto
60
74
  else
61
75
 
62
76
  decode_pedido
@@ -1,3 +1,3 @@
1
1
  module SpfBarcode
2
- VERSION = "0.0.13"
2
+ VERSION = "0.0.14"
3
3
  end
@@ -0,0 +1,13 @@
1
+ class Numeric
2
+ Alpha36 = ("a".."z").to_a + ("0".."9").to_a
3
+ def to_s36
4
+ return "" if self < 1
5
+ s, q = "", self
6
+ loop do
7
+ q, r = (q - 1).divmod(36)
8
+ s.prepend(Alpha36[r])
9
+ break if q.zero?
10
+ end
11
+ s
12
+ end
13
+ end
@@ -0,0 +1,14 @@
1
+ class String
2
+ Alpha36 = ("a".."z").to_a + ("0".."9").to_a
3
+
4
+ def to_i36
5
+ result = 0
6
+ downcase!
7
+ (1..length).each do |i|
8
+ char = self[-i]
9
+ result += 36**(i-1) * (Alpha36.index(char) + 1)
10
+ end
11
+ result
12
+ end
13
+
14
+ end
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spf_barcode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Ramseyer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-18 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: rails
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ! '>='
18
- - !ruby/object:Gem::Version
19
- version: 4.0.2
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ! '>='
25
- - !ruby/object:Gem::Version
26
- version: 4.0.2
11
+ date: 2017-04-03 00:00:00.000000000 Z
12
+ dependencies: []
27
13
  description: Lector de codigo de barra
28
14
  email:
29
15
  - cmramseyer@gmail.com
@@ -34,9 +20,12 @@ files:
34
20
  - MIT-LICENSE
35
21
  - README.rdoc
36
22
  - Rakefile
23
+ - lib/generador_orden.rb
37
24
  - lib/spf_barcode.rb
38
25
  - lib/spf_barcode/version.rb
39
26
  - lib/tasks/spf_barcode_tasks.rake
27
+ - lib/to_barcode_alfanumerico.rb
28
+ - lib/to_barcode_numerico.rb
40
29
  - test/dummy/README.rdoc
41
30
  - test/dummy/Rakefile
42
31
  - test/dummy/app/assets/javascripts/application.js