This commit is contained in:
nandar
2018-07-26 16:40:42 +06:30
parent 275a7658ce
commit db8bb5687f
4 changed files with 8 additions and 3 deletions

View File

@@ -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