Files
sx-fc/app/controllers/oqs/edit_controller.rb

40 lines
1.4 KiB
Ruby
Executable File

class Oqs::EditController < BaseOqsController
def index
assigned_item_id = params[:id]
assigned_item = AssignedOrderItem.find(assigned_item_id)
@order_item = OrderItem.where("order_id='#{ assigned_item.order_id }' AND item_instance_code='#{ assigned_item.instance_code }'");
end
def update
order_items_id = params[:order_items_id]
qty_weight = params[:qty_weight]
remarks = params[:remarks]
order_item = OrderItem.find(order_items_id);
order_item.item_order_by = current_user.name
order_item.qty = qty_weight
order_item.remark = remarks
order_item.save
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
# print
assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code)
# order queue stations
oqs = assigned_item.order_queue_station
order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf
unique_code="OrderItemPdf"
if !order_slim_pdf.nil?
if order_slim_pdf[0][1] == '1'
unique_code="OrderItemSlimPdf"
end
end
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, order_item.order_id, order_items_id, print_status=" (Updated)" )
end
end
end