order queue processing
This commit is contained in:
@@ -1,2 +1,47 @@
|
||||
|
||||
# Order Queue station is where order are submitted to
|
||||
# Order can send from tablet | table
|
||||
# Source of order will determin where it will appear
|
||||
class OrderQueueStation < ApplicationRecord
|
||||
has_many :assigned_order_items
|
||||
has_many :order_items
|
||||
|
||||
scope :active, -> {where(is_active: true)}
|
||||
|
||||
def process_order (order)
|
||||
oqs_stations = OrderQueueStation.active
|
||||
|
||||
order_items = order.order_items
|
||||
#Assign OQS id to order Items
|
||||
oqs_stations.each do |oqs|
|
||||
#Get List of items -
|
||||
pq_items = JSON.parse(oqs.processing_items)
|
||||
|
||||
#Loop through the processing items
|
||||
pq_items.each do |pq_item|
|
||||
#Processing through the looping items
|
||||
order_items.each do |order_item|
|
||||
if (pq_item == order_item.item_code)
|
||||
#Same Order_items can appear in two location.
|
||||
AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
#Print OQS where printing is require
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
#Print order_items in 1 slip
|
||||
def print_slip
|
||||
|
||||
end
|
||||
|
||||
#Print order_items in 1 slip per item
|
||||
def print_slip_item
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user