diff --git a/app/models/order_queue_station.rb b/app/models/order_queue_station.rb index 889491ed..1541828c 100755 --- a/app/models/order_queue_station.rb +++ b/app/models/order_queue_station.rb @@ -57,7 +57,11 @@ class OrderQueueStation < ApplicationRecord if oqs.auto_print && order_source != "quick_service" if oqs_order_items.length > 0 - print_slip(oqs, order, oqs_order_items) + if oqs.cut_per_item + print_slip_item(oqs, order, oqs_order_items) + else + print_slip(oqs, order, oqs_order_items) + end is_auto_printed = true end end @@ -91,8 +95,12 @@ class OrderQueueStation < ApplicationRecord end if oqs.auto_print && order_source != "quick_service" - if oqs_order_items.length > 0 - print_slip(oqs, order, oqs_order_items) + if oqs_order_items.length > 0 + if oqs.cut_per_item + print_slip_item(oqs, order, oqs_order_items) + else + print_slip(oqs, order, oqs_order_items) + end is_auto_printed = true end end @@ -137,8 +145,12 @@ class OrderQueueStation < ApplicationRecord end if oqs.auto_print - if oqs_order_items.length > 0 - print_slip(oqs, order, oqs_order_items) + if oqs_order_items.length > 0 + if oqs.cut_per_item + print_slip_item(oqs, order, oqs_order_items) + else + print_slip(oqs, order, oqs_order_items) + end is_auto_printed = true end end @@ -165,8 +177,12 @@ class OrderQueueStation < ApplicationRecord end if oqs.auto_print - if oqs_order_items.length > 0 - print_slip(oqs, order, oqs_order_items) + if oqs_order_items.length > 0 + if oqs.cut_per_item + print_slip_item(oqs, order, oqs_order_items) + else + print_slip(oqs, order, oqs_order_items) + end is_auto_printed = true end end @@ -211,7 +227,7 @@ class OrderQueueStation < ApplicationRecord end #Print order_item in 1 slip per item - def print_slip_item(oqs, assigned_item) + def print_slip_item(oqs, order, assigned_items) order_slim_pdf = Lookup.collection_of("print_settings") #print_settings with name:OrderSlimPdf unique_code="OrderItemPdf" if !order_slim_pdf.empty? @@ -232,14 +248,17 @@ class OrderQueueStation < ApplicationRecord end end - 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_settings=PrintSetting.find_by_unique_code(unique_code) 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="" ) - + if !assigned_items.nil? + assigned_items.each do |order_item| + order_queue_printer.print_order_item(print_settings, oqs,order_item.order_id, order_item.order_items_id, print_status="" ) + end + end # update print status for completed same order items - assigned_order_item.each do |ai| + AssignedOrderItem.where("order_id = '#{ order.order_id }'").find_each do |ai| ai.print_status=true ai.save end diff --git a/config/puma.rb b/config/puma.rb deleted file mode 100755 index c8e0145e..00000000 --- a/config/puma.rb +++ /dev/null @@ -1,48 +0,0 @@ -# Puma can serve each request in a thread from an internal thread pool. -# The `threads` method setting takes two numbers a minimum and maximum. -# Any libraries that use thread pools should be configured to match -# the maximum value specified for Puma. Default is set to 5 threads for minimum -# and maximum, this matches the default thread size of Active Record. -# -threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i -threads threads_count, threads_count - -# Specifies the `port` that Puma will listen on to receive requests, default is 3000. -# -port ENV.fetch("PORT") { 3000 } - -# Specifies the `environment` that Puma will run in. -# -environment ENV.fetch("RAILS_ENV") { "development" } - -# Specifies the number of `workers` to boot in clustered mode. -# Workers are forked webserver processes. If using threads and workers together -# the concurrency of the application would be max `threads` * `workers`. -# Workers do not work on JRuby or Windows (both of which do not support -# processes). -# -# workers ENV.fetch("WEB_CONCURRENCY") { 2 } - -# Use the `preload_app!` method when specifying a `workers` number. -# This directive tells Puma to first boot the application and load code -# before forking the application. This takes advantage of Copy On Write -# process behavior so workers use less memory. If you use this option -# you need to make sure to reconnect any threads in the `on_worker_boot` -# block. -# -# preload_app! - -# The code in the `on_worker_boot` will be called if you are using -# clustered mode by specifying a number of `workers`. After each worker -# process is booted this block will be run, if you are using `preload_app!` -# option you will want to use this block to reconnect to any threads -# or connections that may have been created at application boot, Ruby -# cannot share connections between processes. -# -# on_worker_boot do -# ActiveRecord::Base.establish_connection if defined?(ActiveRecord) -# end - -# Allow puma to be restarted by `rails restart` command. - -plugin :tmp_restart