update cups restart for order
This commit is contained in:
@@ -7,15 +7,27 @@ App.call_waiter = App.cable.subscriptions.create('CallWaiterChannel', {
|
|||||||
|
|
||||||
received: function(data) {
|
received: function(data) {
|
||||||
table = data.table
|
table = data.table
|
||||||
|
time = data.time
|
||||||
|
|
||||||
// for Notificaiotn message
|
// for Notificaiotn message
|
||||||
var element = "#notify-wrapper"
|
var element = "#notify-wrapper"
|
||||||
var placementFrom = "top";
|
|
||||||
var placementAlign = "center";
|
|
||||||
var animateEnter = "";
|
var animateEnter = "";
|
||||||
var animateExit = "";
|
var animateExit = "";
|
||||||
var colorName = "alert-warning";
|
|
||||||
var text = " Calling Waiter <br> "+table.name ;
|
if (time == 'print_error') {
|
||||||
|
var colorName = "alert-danger";
|
||||||
|
var placementFrom = "center";
|
||||||
|
var placementAlign = "center";
|
||||||
|
var text = " Hello <br> "+table ;
|
||||||
|
style =""
|
||||||
|
}else{
|
||||||
|
var colorName = "alert-warning";
|
||||||
|
var placementFrom = "top";
|
||||||
|
var placementAlign = "center";
|
||||||
|
var text = " Calling Waiter <br> "+table.name ;
|
||||||
|
style ="width:180px !important;"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (text != null || colorName != null){
|
if (text != null || colorName != null){
|
||||||
showNotification(element, colorName, text, placementFrom, placementAlign, animateEnter, animateExit);
|
showNotification(element, colorName, text, placementFrom, placementAlign, animateEnter, animateExit);
|
||||||
@@ -43,7 +55,7 @@ App.call_waiter = App.cable.subscriptions.create('CallWaiterChannel', {
|
|||||||
enter: animateEnter,
|
enter: animateEnter,
|
||||||
exit: animateExit
|
exit: animateExit
|
||||||
},
|
},
|
||||||
template: '<div data-notify="container" style="width:180px !important;" class="bootstrap-notify-container alert alert-dismissible {0} ' + (allowDismiss ? "p-r-30" : "") + '" role="alert">' +
|
template: '<div data-notify="container" style="'+style+'" class="bootstrap-notify-container alert alert-dismissible {0} ' + (allowDismiss ? "p-r-30" : "") + '" role="alert">' +
|
||||||
'<button type="button" aria-hidden="true" class="close notify-close float-right m-l-5 m-t--5" data-notify="dismiss">×</button>' +
|
'<button type="button" aria-hidden="true" class="close notify-close float-right m-l-5 m-t--5" data-notify="dismiss">×</button>' +
|
||||||
'<span data-notify="icon"></span> ' +
|
'<span data-notify="icon"></span> ' +
|
||||||
'<span data-notify="title">{1}</span> ' +
|
'<span data-notify="title">{1}</span> ' +
|
||||||
|
|||||||
@@ -278,19 +278,34 @@ class Order < ApplicationRecord
|
|||||||
#Process order items and send to order queue
|
#Process order items and send to order queue
|
||||||
def process_order_queue
|
def process_order_queue
|
||||||
#Send to background job for processing
|
#Send to background job for processing
|
||||||
OrderQueueProcessorJob.perform_later(self.id, self.table_id)
|
|
||||||
# order = Order.find(order_id)
|
|
||||||
|
|
||||||
# #Execute orders and send to order stations
|
cup_status = `#{"sudo service cups status"}`
|
||||||
# if order
|
print_status = check_cup_status(cup_status)
|
||||||
# oqs = OrderQueueStation.new
|
|
||||||
# oqs.process_order(order, table_id)
|
if print_status
|
||||||
# end
|
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
|
||||||
|
|
||||||
# assign_order = AssignedOrderItem.assigned_order_item_by_job(order_id)
|
|
||||||
# ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
|
|
||||||
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
|
#send order items and send to order queue
|
||||||
def send_order_broadcast(booking)
|
def send_order_broadcast(booking)
|
||||||
|
|||||||
@@ -123,24 +123,8 @@ class OrderQueueStation < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
|
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||||
cup_status = `#{"sudo service cups status"}`
|
order_queue_printer.print_order_summary(print_settings, oqs,order.order_id, order_items, print_status="")
|
||||||
print_status = check_cup_status(cup_status)
|
|
||||||
|
|
||||||
if print_status
|
|
||||||
order_queue_printer = Printer::OrderQueuePrinter.new(print_settings)
|
|
||||||
order_queue_printer.print_order_summary(print_settings, oqs,order.order_id, order_items, print_status="")
|
|
||||||
else
|
|
||||||
cup_start = `#{"sudo service cups start"}`
|
|
||||||
cup_status = `#{"sudo service cups status"}`
|
|
||||||
print_status = check_cup_status(cup_status)
|
|
||||||
|
|
||||||
if print_status
|
|
||||||
order_queue_printer = Printer::OrderQueuePrinter.new(print_settings)
|
|
||||||
order_queue_printer.print_order_summary(print_settings, oqs,order.order_id, order_items, print_status="")
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
AssignedOrderItem.where("order_id = '#{ order.order_id }'").find_each do |ai|
|
AssignedOrderItem.where("order_id = '#{ order.order_id }'").find_each do |ai|
|
||||||
# update print status for order items
|
# update print status for order items
|
||||||
@@ -175,23 +159,8 @@ class OrderQueueStation < ApplicationRecord
|
|||||||
order_item = OrderItem.where("order_id='#{assigned_item.order_id}' AND item_instance_code='#{assigned_item.instance_code}'").first()
|
order_item = OrderItem.where("order_id='#{assigned_item.order_id}' AND item_instance_code='#{assigned_item.instance_code}'").first()
|
||||||
# print when complete click
|
# print when complete click
|
||||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
|
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||||
cup_status = `#{"sudo service cups status"}`
|
order_queue_printer.print_order_item(print_settings, oqs,item.order_id, order_item.order_items_id, print_status="" )
|
||||||
print_status = check_cup_status(cup_status)
|
|
||||||
|
|
||||||
if print_status
|
|
||||||
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
|
||||||
order_queue_printer.print_order_item(print_settings, oqs,item.order_id, order_item.order_items_id, print_status="" )
|
|
||||||
else
|
|
||||||
cup_start = `#{"sudo service cups start"}`
|
|
||||||
cup_status = `#{"sudo service cups status"}`
|
|
||||||
print_status = check_cup_status(cup_status)
|
|
||||||
|
|
||||||
if print_status
|
|
||||||
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
|
||||||
order_queue_printer.print_order_item(print_settings, oqs,item.order_id, order_item.order_items_id, print_status="" )
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# update print status for completed same order items
|
# update print status for completed same order items
|
||||||
assigned_order_item.each do |ai|
|
assigned_order_item.each do |ai|
|
||||||
@@ -199,12 +168,4 @@ class OrderQueueStation < ApplicationRecord
|
|||||||
ai.save
|
ai.save
|
||||||
end
|
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
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user