update remove sidekiq

This commit is contained in:
Aung Myo
2018-03-08 18:08:36 +06:30
parent 1503462cea
commit 3de5c173b5
2 changed files with 47 additions and 9 deletions

View File

@@ -286,23 +286,51 @@ 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
order = Order.find(self.id)
cup_status = `#{"sudo service cups status"}` cup_status = `#{"sudo service cups status"}`
print_status = check_cup_status(cup_status) print_status = check_cup_status(cup_status)
sidekiq = Lookup.find_by_lookup_type("sidekiq")
if print_status if print_status
OrderQueueProcessorJob.perform_later(self.id, self.table_id) if !sidekiq.nil?
OrderQueueProcessorJob.perform_later(self.id, self.table_id)
else
if order
oqs = OrderQueueStation.new
oqs.process_order(order, self.table_id)
end
assign_order = AssignedOrderItem.assigned_order_item_by_job(self.id)
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
end
else else
cup_start = `#{"sudo service cups start"}` cup_start = `#{"sudo service cups start"}`
cup_status = `#{"sudo service cups status"}` cup_status = `#{"sudo service cups status"}`
print_status = check_cup_status(cup_status) print_status = check_cup_status(cup_status)
if print_status if print_status
OrderQueueProcessorJob.perform_later(self.id, self.table_id) if !sidekiq.nil?
OrderQueueProcessorJob.perform_later(self.id, self.table_id)
else
if order
oqs = OrderQueueStation.new
oqs.process_order(order, self.table_id)
end
assign_order = AssignedOrderItem.assigned_order_item_by_job(self.id)
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
end
else else
msg = ' Print Error ! Please contact to service' msg = ' Print Error ! Please contact to service'
ActionCable.server.broadcast "call_waiter_channel",table: msg,time:'print_error' ActionCable.server.broadcast "call_waiter_channel",table: msg,time:'print_error'
OrderQueueProcessorJob.perform_later(self.id, self.table_id) if !sidekiq.nil?
OrderQueueProcessorJob.perform_later(self.id, self.table_id)
else
if order
oqs = OrderQueueStation.new
oqs.process_order(order, self.table_id)
end
assign_order = AssignedOrderItem.assigned_order_item_by_job(self.id)
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
end
end end
end end
@@ -310,8 +338,18 @@ class Order < ApplicationRecord
#Process order items and send to order queue #Process order items and send to order queue
def self.pay_process_order_queue(id,table_id) def self.pay_process_order_queue(id,table_id)
#Send to background job for processing sidekiq = Lookup.find_by_lookup_type("sidekiq")
OrderQueueProcessorJob.perform_later(id, table_id) if !sidekiq.nil?
OrderQueueProcessorJob.perform_later(id, table_id)
else
order = Order.find(id)
if order
oqs = OrderQueueStation.new
oqs.process_order(order, table_id)
end
assign_order = AssignedOrderItem.assigned_order_item_by_job(id)
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
end
end end
def check_cup_status(status) def check_cup_status(status)

View File

@@ -86,7 +86,7 @@ namespace :consolidate do
@receipt_no = sale.receipt_no @receipt_no = sale.receipt_no
@requested_at = sale.requested_at @requested_at = sale.requested_at
if sale_id == sale.sale_id || count == 0 || @z =0 if sale_id == sale.sale_id || count == 0 || @z ==0
@total_qty += sale.qty @total_qty += sale.qty
@total_gross_sales += sale.price @total_gross_sales += sale.price
@total_sales += sale.price @total_sales += sale.price