update pay first and print later
This commit is contained in:
@@ -301,8 +301,33 @@ class Order < ApplicationRecord
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
#Process order items and send to order queue
|
||||
def self.pay_process_order_queue(id,table_id)
|
||||
#Send to background job for processing
|
||||
|
||||
cup_status = `#{"sudo service cups status"}`
|
||||
print_status = check_cup_status(cup_status)
|
||||
|
||||
if print_status
|
||||
OrderQueueProcessorJob.perform_later(id, table_id)
|
||||
else
|
||||
cup_start = `#{"sudo service cups start"}`
|
||||
cup_status = `#{"sudo service cups status"}`
|
||||
print_status = check_cup_status(cup_status)
|
||||
|
||||
if print_status
|
||||
OrderQueueProcessorJob.perform_later(id, table_id)
|
||||
else
|
||||
msg = ' Print Error ! Please contact to service'
|
||||
ActionCable.server.broadcast "call_waiter_channel",table: msg,time:'print_error'
|
||||
OrderQueueProcessorJob.perform_later(id, table_id)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def check_cup_status(status)
|
||||
def self.check_cup_status(status)
|
||||
if status.include? "Active: active (running)" || "Active: active (exited)" #"Cup Server is already running"
|
||||
return true
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user