check duplicate record
This commit is contained in:
@@ -143,24 +143,29 @@ class Api::BatchLineItemsController < ApplicationController
|
||||
barcode = params[:barcode]
|
||||
manufacture_uid = params[:manufacture_uid]
|
||||
batch_line_item = BatchLineItem.find_by_asset_identity(account_no)
|
||||
if !batch_line_item.nil?
|
||||
batch_line_item.manufacture_uid = manufacture_uid
|
||||
batch_line_item.barcode = barcode
|
||||
batch_line_item.save
|
||||
|
||||
# update batch
|
||||
batch = Batch.find_by_id(batch_line_item.batch_id)
|
||||
card_qty=batch.qty_processing.to_i
|
||||
success_qty=batch.qty_success
|
||||
if !batch_line_item.nil?
|
||||
if batch_line_item.manufacture_uid.nil?
|
||||
batch_line_item.manufacture_uid = manufacture_uid
|
||||
batch_line_item.barcode = barcode
|
||||
batch_line_item.save
|
||||
|
||||
batch.qty_processing=card_qty+1
|
||||
batch.qty_success=success_qty+1
|
||||
batch.save
|
||||
# update batch
|
||||
batch = Batch.find_by_id(batch_line_item.batch_id)
|
||||
card_qty=batch.qty_processing.to_i
|
||||
success_qty=batch.qty_success
|
||||
|
||||
@out = true,"success"
|
||||
else
|
||||
@out = false,"error"
|
||||
end
|
||||
batch.qty_processing=card_qty+1
|
||||
batch.qty_success=success_qty+1
|
||||
batch.save
|
||||
|
||||
@out = true,"success"
|
||||
else
|
||||
@out = false,"Duplicate Record"
|
||||
end
|
||||
else
|
||||
@out = false,"error"
|
||||
end
|
||||
end
|
||||
|
||||
def get_item_by_batch
|
||||
@@ -203,6 +208,24 @@ class Api::BatchLineItemsController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def update_barcode_and_account_no
|
||||
session_token = params[:session_token]
|
||||
barcode =params[:barcode]
|
||||
user = Member.find_by_session_token(session_token)
|
||||
if !user.nil?
|
||||
user_id = user.user_id
|
||||
find_barcode = BatchLineItem.find_by_barcode(barcode)
|
||||
if !find_barcode.nil?
|
||||
@out = true,find_barcode
|
||||
else
|
||||
@out = false,"Invalid"
|
||||
end
|
||||
else
|
||||
@out = false, "Not Authorized"
|
||||
end
|
||||
end
|
||||
|
||||
# def check_ticket
|
||||
# session_token = params[:session_token]
|
||||
# barcode =params[:barcode]
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
if @out[0] == true
|
||||
json.set! :status, @out[0]
|
||||
json.set! :message, @out[1]
|
||||
else
|
||||
json.set! :status, @out[0]
|
||||
json.set! :message, @out[1]
|
||||
end
|
||||
3
app/views/api/batches/get_ticket_settings.json.jbuilder
Normal file
3
app/views/api/batches/get_ticket_settings.json.jbuilder
Normal file
@@ -0,0 +1,3 @@
|
||||
|
||||
json.set! :status, @out[0]
|
||||
json.set! :message, @out[1]
|
||||
Reference in New Issue
Block a user