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