Merge branch 'adminbsb_material_ui'

This commit is contained in:
Aung Myo
2018-03-08 18:09:14 +06:30
3 changed files with 49 additions and 11 deletions

View File

@@ -286,23 +286,51 @@ class Order < ApplicationRecord
#Process order items and send to order queue
def process_order_queue
#Send to background job for processing
cup_status = `#{"sudo service cups status"}`
order = Order.find(self.id)
cup_status = `#{"sudo service cups status"}`
print_status = check_cup_status(cup_status)
sidekiq = Lookup.find_by_lookup_type("sidekiq")
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
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)
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
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)
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
@@ -310,8 +338,18 @@ class Order < ApplicationRecord
#Process order items and send to order queue
def self.pay_process_order_queue(id,table_id)
#Send to background job for processing
OrderQueueProcessorJob.perform_later(id, table_id)
sidekiq = Lookup.find_by_lookup_type("sidekiq")
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
def check_cup_status(status)

View File

@@ -123,11 +123,11 @@ delete from sym_node;
insert into sym_trigger
(trigger_id,source_table_name,channel_id,last_update_time,create_time)
values('tax_profiles','customers','setting',current_timestamp,current_timestamp);
values('tax_profiles','tax_profiles','setting',current_timestamp,current_timestamp);
insert into sym_trigger
(trigger_id,source_table_name,channel_id,last_update_time,create_time)
values('display_images','customers','setting',current_timestamp,current_timestamp);
values('display_images','display_images','setting',current_timestamp,current_timestamp);
# Create Trigger for Dining Channel

View File

@@ -86,7 +86,7 @@ namespace :consolidate do
@receipt_no = sale.receipt_no
@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_gross_sales += sale.price
@total_sales += sale.price