fixed print serviceaction cable
This commit is contained in:
@@ -15,18 +15,6 @@ 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
|
||||
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,
|
||||
data: {
|
||||
order_item: order_item[0].as_json(methods: :type),
|
||||
print_status: print_status.gsub(/[()]/, ""),
|
||||
booking_id: booking_id,
|
||||
precision: print_settings.precision
|
||||
}
|
||||
)
|
||||
|
||||
shop = Shop.current_shop
|
||||
directory_name = 'public/orders_'+shop.shop_code
|
||||
@@ -38,6 +26,18 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
|
||||
if ENV["SERVER_MODE"] != "cloud"
|
||||
self.print(filename, oqs.printer_name)
|
||||
else
|
||||
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,
|
||||
data: {
|
||||
order_item: order_item[0].as_json(methods: :type),
|
||||
print_status: print_status.gsub(/[()]/, ""),
|
||||
booking_id: booking_id,
|
||||
precision: print_settings.precision
|
||||
}
|
||||
)
|
||||
end
|
||||
#For print copy
|
||||
# pdf.render_file filename.gsub(".","-copy.")
|
||||
@@ -87,6 +87,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
end
|
||||
# For Print Order Summary
|
||||
else
|
||||
booking_id = Booking.get_booking_id(order_id) #order[0].order_id
|
||||
order = print_query('order_summary', order_id)
|
||||
|
||||
filename = directory_name + "/order_summary_#{order_id}.pdf"
|
||||
@@ -97,21 +98,20 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
#no print in cloud server
|
||||
if ENV["SERVER_MODE"] != "cloud"
|
||||
self.print(filename, oqs.printer_name)
|
||||
else
|
||||
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,
|
||||
data: {
|
||||
order_item: order_items,
|
||||
order: order.as_json(methods: :type),
|
||||
print_status: "",
|
||||
booking_id: booking_id,
|
||||
precision: print_settings.precision}
|
||||
)
|
||||
end
|
||||
booking_id = Booking.get_booking_id(order_id) #order[0].order_id
|
||||
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,
|
||||
data: {
|
||||
order_item: order_items,
|
||||
order: order.as_json(methods: :type),
|
||||
print_status: "",
|
||||
booking_id: booking_id,
|
||||
precision: print_settings.precision}
|
||||
)
|
||||
|
||||
#For print copy
|
||||
# pdf.render_file filename.gsub(".","-copy.")
|
||||
# self.print(filename.gsub(".","-copy."), oqs.printer_name)
|
||||
|
||||
Reference in New Issue
Block a user