check duplicate record
This commit is contained in:
@@ -139,15 +139,14 @@ class Api::BatchLineItemsController < ApplicationController
|
||||
end
|
||||
|
||||
def update_manufacture_uid
|
||||
account_no = params[:account_no]
|
||||
# account_no = params[:account_no]
|
||||
barcode = params[:barcode]
|
||||
manufacture_uid = params[:manufacture_uid]
|
||||
batch_line_item = BatchLineItem.find_by_asset_identity(account_no)
|
||||
batch_line_item = BatchLineItem.find_by_barcode(barcode)
|
||||
|
||||
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
|
||||
|
||||
# update batch
|
||||
@@ -159,7 +158,7 @@ class Api::BatchLineItemsController < ApplicationController
|
||||
batch.qty_success=success_qty+1
|
||||
batch.save
|
||||
|
||||
@out = true,"success"
|
||||
@out = true,batch_line_item.asset_identity
|
||||
else
|
||||
@out = false,"Duplicate Record"
|
||||
end
|
||||
@@ -217,7 +216,8 @@ class Api::BatchLineItemsController < ApplicationController
|
||||
user_id = user.user_id
|
||||
find_barcode = BatchLineItem.find_by_barcode(barcode)
|
||||
if !find_barcode.nil?
|
||||
@out = true,find_barcode
|
||||
@out = true,find_barcode
|
||||
|
||||
else
|
||||
@out = false,"Invalid"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user