edit
This commit is contained in:
@@ -3,8 +3,8 @@ class Api::BatchLineItemsController < ApplicationController
|
||||
def register
|
||||
batch_id=params[:batch_id]
|
||||
session_token=params[:session_token]
|
||||
manufacture_uid = params[:card_manufacture]
|
||||
|
||||
manufacture_uid = params[:card_manufacture]
|
||||
card_account_no=params[:card_account_no]
|
||||
client_id=""
|
||||
|
||||
check_member= Member.authenticate_session_token(session_token)
|
||||
@@ -13,12 +13,12 @@ class Api::BatchLineItemsController < ApplicationController
|
||||
asset_identity=""
|
||||
|
||||
find_batch = Batch.find_by_id(batch_id)
|
||||
if !find_batch.nil?
|
||||
if !find_batch.nil?
|
||||
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)
|
||||
|
||||
if !find_product_category.nil?
|
||||
if !find_product_category.nil?
|
||||
product_type=find_product_category.product_type_id
|
||||
|
||||
find_user=Client.find_by_id(find_batch.client_id)
|
||||
@@ -27,10 +27,9 @@ class Api::BatchLineItemsController < ApplicationController
|
||||
location_code=find_user.location_code
|
||||
|
||||
client_id=find_user.id
|
||||
|
||||
if !encrypt_key.nil?
|
||||
check_manufacture = BatchLineItem.find_by_manufacture_uid(manufacture_uid)
|
||||
if check_manufacture.nil?
|
||||
if !encrypt_key.nil?
|
||||
check_manufacture = BatchLineItem.find_by_manufacture_uid(manufacture_uid)
|
||||
if check_manufacture.nil?
|
||||
serial_no=BatchLineItem.generate_serial_no(client_id.to_s)
|
||||
|
||||
if product_type ==1 #CARD
|
||||
@@ -49,20 +48,24 @@ class Api::BatchLineItemsController < ApplicationController
|
||||
if check_asset.nil?
|
||||
@out=BatchLineItem.create_product(asset_identity,serial_no,batch_id,manufacture_uid,card_type)
|
||||
else
|
||||
@out=false,'Asset Identity is already registered!'
|
||||
@out=false,'Asset Identity is already registered!',nil
|
||||
end
|
||||
end
|
||||
else
|
||||
@out=false,'Manufacture UID is already registered!'
|
||||
if check_manufacture.asset_identity !=card_account_no
|
||||
@out=false,"Error",check_manufacture
|
||||
else
|
||||
@out=false,'Manufacture UID is already registered!',nil
|
||||
end
|
||||
end
|
||||
else
|
||||
@out=false,'Invalid User!'
|
||||
@out=false,'Invalid User!',nil
|
||||
end
|
||||
else
|
||||
@out=false,"Client doesn't exist!"
|
||||
@out=false,"Client doesn't exist!",nil
|
||||
end
|
||||
else
|
||||
@out=false,"Product Category doesn't exist!"
|
||||
@out=false,"Product Category doesn't exist!",nil
|
||||
end
|
||||
else
|
||||
@out=false,"Batch doesn't exist!"
|
||||
@@ -70,5 +73,5 @@ class Api::BatchLineItemsController < ApplicationController
|
||||
else
|
||||
@out=false,'Sorry!Unauthorized user!'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user