This commit is contained in:
nandar
2018-07-26 15:34:11 +06:30
parent 55554707f0
commit 275a7658ce
10 changed files with 66 additions and 10 deletions

View File

@@ -81,9 +81,6 @@ class Api::BatchLineItemsController < ApplicationController
client_id=""
qty = params[:qty]
total_count=0
puts batch_id
puts 'ello'
puts params[:id]
# check_member= Member.authenticate_session_token(session_token)
# if !check_member.nil?
encrypt_key=""
@@ -264,5 +261,5 @@ class Api::BatchLineItemsController < ApplicationController
@out = false,"Not Authorized"
end
end
end

View File

@@ -3,6 +3,11 @@ class BatchLineItemsController < ApplicationController
skip_before_filter :verify_authenticity_token
before_action :authenticate_member!
require 'digest/md5'
require 'barby'
require 'barby/barcode/code_128'
require 'barby/outputter/ascii_outputter'
require 'barby/outputter/svg_outputter'
def index
# user_id=current_member.user_id
@@ -129,6 +134,9 @@ class BatchLineItemsController < ApplicationController
client_id=""
qty = params[:qty]
total_count=0
check = params[:barcode]
# check_member= Member.authenticate_session_token(session_token)
# if !check_member.nil?
@@ -137,7 +145,6 @@ class BatchLineItemsController < ApplicationController
find_batch = Batch.find_by_id(batch_id)
if !find_batch.nil?
puts 'hkjfklasj'
card_type=find_batch.adult_or_child.upcase
product_category_id=find_batch.product_category_id
find_product_category=ProductCategory.find_by_id(product_category_id)
@@ -159,6 +166,14 @@ class BatchLineItemsController < ApplicationController
asset_identity=BatchLineItem.generate_account_no(location_code)
security_code=BatchLineItem.generate_security_code
out=BatchLineItem.create_product(asset_identity,serial_no,batch_id,"","",security_code)
if check.present?
barcode = BatchLineItem.generate_barcode
update_barcode = BatchLineItem.find_by_asset_identity(out[2])
update_barcode.barcode = barcode
barcode_128 = Barby::Code128.new(barcode)
update_barcode.barcode_format = barcode_128
update_barcode.save
end
total_count+=1
end
respond_to do |format|