print_channel with shop_code

This commit is contained in:
Thein Lin Kyaw
2020-08-06 14:05:20 +06:30
parent 4a2dd294ab
commit 61a1189083
6 changed files with 11 additions and 8 deletions

View File

@@ -1,6 +1,6 @@
class PrintChannel < ApplicationCable::Channel
def subscribed
stream_from "print_channel"
stream_from "print_channel_#{params[:shop_code]}"
end
def unsubscribed

View File

@@ -132,7 +132,7 @@ class Origami::ShiftsController < BaseOrigamiController
p "close cashier print<==============================="
p @other_charges
p @total_amount_by_account
ActionCable.server.broadcast("print_channel",
ActionCable.server.broadcast("print_channel_#{Shop.current_shop.shop_code}",
queue: "Cashier",
unique_code: print_settings.unique_code,
print_copies: print_settings.print_copies,

View File

@@ -87,7 +87,7 @@ class Printer::CashierStationPrinter < Printer::PrinterWorker
if print_settings.unique_code == "SaleItemsPdf"
pdf = SaleItemsPdf.new(print_settings, shop_details, period_name, type, account, from_date, to_date, shift_name, sale_items, total_other_charges)
ActionCable.server.broadcast("print_channel",
ActionCable.server.broadcast("print_channel_#{Shop.current_shop.shop_code}",
queue: 'Cashier',
unique_code: print_settings.unique_code,
print_copies: print_settings.print_copies,

View File

@@ -15,7 +15,8 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
pdf = print_settings.unique_code.constantize.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name, before_updated_qty)
booking_id = Booking.get_booking_id(order_id)
# end
ActionCable.server.broadcast("print_channel",
puts "print_channel_#{Shop.current_shop.shop_code}"
ActionCable.server.broadcast("print_channel_#{Shop.current_shop.shop_code}",
queue: oqs.station_name,
unique_code: print_settings.unique_code,
print_copies: print_settings.print_copies,
@@ -98,7 +99,9 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
self.print(filename, oqs.printer_name)
end
booking_id = Booking.get_booking_id(order_id) #order[0].order_id
ActionCable.server.broadcast("print_channel",
puts "printing>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
puts "print_channel_#{Shop.current_shop.shop_code}"
ActionCable.server.broadcast("print_channel_#{Shop.current_shop.shop_code}",
queue: oqs.station_name,
unique_code: print_settings.unique_code,
print_copies: print_settings.print_copies,

View File

@@ -106,7 +106,7 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
pdf = ReceiptBillOrderPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data,other_amount,latest_order_no,card_balance_amount,order_reservation)
end
ActionCable.server.broadcast("print_channel",
ActionCable.server.broadcast("print_channel_#{Shop.current_shop.shop_code}",
queue: "Cashier",
unique_code: print_settings.unique_code,
print_copies: print_settings.print_copies,
@@ -211,7 +211,7 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
#no print in cloud server
self.print("tmp/print_move_table.pdf", oqs.printer_name)
end
ActionCable.server.broadcast("print_channel",
ActionCable.server.broadcast("print_channel_#{Shop.current_shop.shop_code}",
queue: oqs.station_name,
unique_code: print_settings.unique_code,
print_copies: print_settings.print_copies,

View File

@@ -8,7 +8,7 @@ class Shop < ApplicationRecord
accepts_nested_attributes_for :display_images
def file_data=(input_data)
self.data = input_data.read
self.data = input_data.read
end
def self.current_shop