Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into quick_service

This commit is contained in:
Aung Myo
2018-02-08 11:09:21 +06:30
33 changed files with 303 additions and 127 deletions

View File

@@ -276,16 +276,42 @@ class Order < ApplicationRecord
#Process order items and send to order queue
def process_order_queue
#Send to background job for processing
OrderQueueProcessorJob.perform_later(self.id, self.table_id)
end
cup_status = `#{"sudo service cups status"}`
print_status = check_cup_status(cup_status)
if print_status
OrderQueueProcessorJob.perform_later(self.id, self.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(self.id, self.table_id)
else
msg = ' Print Error ! Please contact to service'
ActionCable.server.broadcast "call_waiter_channel",table: msg,time:'print_error'
OrderQueueProcessorJob.perform_later(self.id, self.table_id)
end
end
end
def check_cup_status(status)
if status.include? "Active: active (running)" || "Active: active (exited)" #"Cup Server is already running"
return true
end
return false
end
#send order items and send to order queue
def send_order_broadcast(booking)
table = DiningFacility.find(booking.dining_facility_id)
type = 'order'
#Send to background job for processing
OrderBroadcastJob.perform_later(table,type)
# OrderBroadcastJob.perform_later(table,type)
ActionCable.server.broadcast "order_channel",table: table,type:type
end
#Origami: Cashier : to view order Table