This commit is contained in:
Sunandar
2017-03-07 15:27:36 +06:30
parent 4845001bd6
commit adc3daaae8
2 changed files with 18 additions and 14 deletions

View File

@@ -4,7 +4,7 @@ class Api::BatchLineItemsController < ApplicationController
batch_id=params[:batch_id] batch_id=params[:batch_id]
session_token=params[:session_token] session_token=params[:session_token]
manufacture_uid = params[:card_manufacture] manufacture_uid = params[:card_manufacture]
card_account_no=params[:card_account_no]
client_id="" client_id=""
check_member= Member.authenticate_session_token(session_token) check_member= Member.authenticate_session_token(session_token)
@@ -27,7 +27,6 @@ class Api::BatchLineItemsController < ApplicationController
location_code=find_user.location_code location_code=find_user.location_code
client_id=find_user.id client_id=find_user.id
if !encrypt_key.nil? if !encrypt_key.nil?
check_manufacture = BatchLineItem.find_by_manufacture_uid(manufacture_uid) check_manufacture = BatchLineItem.find_by_manufacture_uid(manufacture_uid)
if check_manufacture.nil? if check_manufacture.nil?
@@ -49,20 +48,24 @@ class Api::BatchLineItemsController < ApplicationController
if check_asset.nil? if check_asset.nil?
@out=BatchLineItem.create_product(asset_identity,serial_no,batch_id,manufacture_uid,card_type) @out=BatchLineItem.create_product(asset_identity,serial_no,batch_id,manufacture_uid,card_type)
else else
@out=false,'Asset Identity is already registered!' @out=false,'Asset Identity is already registered!',nil
end end
end end
else 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 end
else else
@out=false,'Invalid User!' @out=false,'Invalid User!',nil
end end
else else
@out=false,"Client doesn't exist!" @out=false,"Client doesn't exist!",nil
end end
else else
@out=false,"Product Category doesn't exist!" @out=false,"Product Category doesn't exist!",nil
end end
else else
@out=false,"Batch doesn't exist!" @out=false,"Batch doesn't exist!"

View File

@@ -5,4 +5,5 @@
else else
json.set! :status, @out[0] json.set! :status, @out[0]
json.set! :message,@out[1] json.set! :message,@out[1]
json.set! :data,@out[2]
end end