-
This commit is contained in:
@@ -170,7 +170,7 @@ class BatchLineItemsController < ApplicationController
|
||||
barcode = BatchLineItem.generate_barcode
|
||||
update_barcode = BatchLineItem.find_by_asset_identity(out[2])
|
||||
update_barcode.barcode = barcode
|
||||
barcode_128 = Barby::Code128.new(barcode)
|
||||
barcode_128 = Barby::Code128B.new(barcode)
|
||||
update_barcode.barcode_format = barcode_128
|
||||
update_barcode.save
|
||||
end
|
||||
|
||||
@@ -42,11 +42,11 @@ class BatchLineItem < ApplicationRecord
|
||||
def self.generate_barcode
|
||||
|
||||
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)
|
||||
if !find_account_no.nil?
|
||||
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
|
||||
return barcode
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user