-
This commit is contained in:
1
Gemfile
1
Gemfile
@@ -45,6 +45,7 @@ gem 'simple_form'
|
|||||||
gem 'kaminari'
|
gem 'kaminari'
|
||||||
gem 'to_csv-rails'
|
gem 'to_csv-rails'
|
||||||
gem 'barby'
|
gem 'barby'
|
||||||
|
gem 'barby-chunky_png'
|
||||||
# gem 'bootstrap-multiselect-rails'
|
# gem 'bootstrap-multiselect-rails'
|
||||||
|
|
||||||
group :development, :test do
|
group :development, :test do
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ GEM
|
|||||||
sshkit (>= 1.6.1, != 1.7.0)
|
sshkit (>= 1.6.1, != 1.7.0)
|
||||||
arel (7.1.4)
|
arel (7.1.4)
|
||||||
barby (0.6.5)
|
barby (0.6.5)
|
||||||
|
barby-chunky_png (0.3.4)
|
||||||
|
chunky_png (= 0.8.0)
|
||||||
bcrypt (3.1.12)
|
bcrypt (3.1.12)
|
||||||
bindex (0.5.0)
|
bindex (0.5.0)
|
||||||
builder (3.2.3)
|
builder (3.2.3)
|
||||||
@@ -60,6 +62,7 @@ GEM
|
|||||||
capistrano-rbenv (2.1.3)
|
capistrano-rbenv (2.1.3)
|
||||||
capistrano (~> 3.1)
|
capistrano (~> 3.1)
|
||||||
sshkit (~> 1.3)
|
sshkit (~> 1.3)
|
||||||
|
chunky_png (0.8.0)
|
||||||
coffee-rails (4.2.2)
|
coffee-rails (4.2.2)
|
||||||
coffee-script (>= 2.2.0)
|
coffee-script (>= 2.2.0)
|
||||||
railties (>= 4.0.0)
|
railties (>= 4.0.0)
|
||||||
@@ -225,6 +228,7 @@ PLATFORMS
|
|||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
barby
|
barby
|
||||||
|
barby-chunky_png
|
||||||
bcrypt (~> 3.1.7)
|
bcrypt (~> 3.1.7)
|
||||||
byebug
|
byebug
|
||||||
capistrano
|
capistrano
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ class BatchLineItemsController < ApplicationController
|
|||||||
barcode = BatchLineItem.generate_barcode
|
barcode = BatchLineItem.generate_barcode
|
||||||
update_barcode = BatchLineItem.find_by_asset_identity(out[2])
|
update_barcode = BatchLineItem.find_by_asset_identity(out[2])
|
||||||
update_barcode.barcode = barcode
|
update_barcode.barcode = barcode
|
||||||
barcode_128 = Barby::Code128.new(barcode)
|
barcode_128 = Barby::Code128B.new(barcode)
|
||||||
update_barcode.barcode_format = barcode_128
|
update_barcode.barcode_format = barcode_128
|
||||||
update_barcode.save
|
update_barcode.save
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -42,11 +42,11 @@ class BatchLineItem < ApplicationRecord
|
|||||||
def self.generate_barcode
|
def self.generate_barcode
|
||||||
|
|
||||||
o = [('0'..'9')].map { |i| i.to_a }.flatten
|
o = [('0'..'9')].map { |i| i.to_a }.flatten
|
||||||
barcode = (0...10).map { o[rand(o.length)] }.join
|
barcode = (0...8).map { o[rand(o.length)] }.join
|
||||||
find_account_no = BatchLineItem.find_by_barcode(barcode)
|
find_account_no = BatchLineItem.find_by_barcode(barcode)
|
||||||
if !find_account_no.nil?
|
if !find_account_no.nil?
|
||||||
o = [('0'..'9')].map { |i| i.to_a }.flatten
|
o = [('0'..'9')].map { |i| i.to_a }.flatten
|
||||||
barcode = (0...10).map { o[rand(o.length)] }.join
|
barcode = (0...8).map { o[rand(o.length)] }.join
|
||||||
end
|
end
|
||||||
return barcode
|
return barcode
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user