edit
This commit is contained in:
@@ -53,11 +53,9 @@ class BatchLineItem < ApplicationRecord
|
||||
CSV.generate(headers: true) do |csv|
|
||||
csv << attributes
|
||||
all.each do |encoder|
|
||||
if encoder.product_type_id ==1
|
||||
puts 'Card'
|
||||
if encoder.product_type_id ==1
|
||||
str="account_no="+encoder.asset_identity.to_s+"&manufacture_uid="+encoder.manufacture_uid.to_s+"&serial_no="+encoder.serial_no.to_s
|
||||
else
|
||||
puts 'Tickets'
|
||||
else
|
||||
str="manufacture_uid="+encoder.manufacture_uid.to_s+"&serial_no="+encoder.serial_no.to_s
|
||||
end
|
||||
|
||||
@@ -96,20 +94,33 @@ class BatchLineItem < ApplicationRecord
|
||||
batchLineItem.encoded_at = DateTime.now.beginning_of_day.utc.to_time.strftime("%Y-%m-%d")
|
||||
batchLineItem.verified_at =DateTime.now.beginning_of_day.utc.to_time.strftime("%Y-%m-%d")
|
||||
|
||||
batch=Batch.find_by_id(batch_id)
|
||||
|
||||
if batchLineItem.save
|
||||
lookup=Lookup.find_by_name('generate_serial_no')
|
||||
max_serail_no=lookup.max_value
|
||||
lookup.max_value=max_serail_no.to_i+1
|
||||
lookup.save
|
||||
|
||||
card_qty=batch.qty_processing.to_i
|
||||
success_qty=batch.qty_success
|
||||
|
||||
batch.qty_processing=card_qty+1
|
||||
batch.qty_success=success_qty+1
|
||||
batch.save
|
||||
|
||||
@result = true,batchLineItem.serial_no,batchLineItem.asset_identity
|
||||
else
|
||||
@result=false,'Error occurs in registration encoder!'
|
||||
qty_fail=batch.qty_fail
|
||||
batch.qty_fail=qty_fail+1
|
||||
batch.save
|
||||
|
||||
@result=false,'Error occurs in registration encoder!'
|
||||
end
|
||||
end
|
||||
def self.get_array
|
||||
arr=Array.new
|
||||
(1..50).each do |i|
|
||||
(1..1000).each do |i|
|
||||
str= SecureRandom.hex
|
||||
uid=str[0..13]
|
||||
arr.push(uid)
|
||||
|
||||
Reference in New Issue
Block a user