Class: Inventory::EmptyPromisedDateReminder
- Inherits:
-
BaseService
- Object
- BaseService
- Inventory::EmptyPromisedDateReminder
- Defined in:
- app/services/inventory/empty_promised_date_reminder.rb
Overview
Service object: empty promised date reminder.
Instance Method Summary collapse
Instance Method Details
#process ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'app/services/inventory/empty_promised_date_reminder.rb', line 4 def process items = PurchaseOrderItem.left_joins(:purchase_order_shipments) .where(purchase_order_shipments: { promised_delivery_date: nil }) .where.not(state: %w[cancelled fully_receipted]) .where(purchase_order_items: { created_at: ...3.days.ago }) .joins(:purchase_order) .where.not(purchase_orders: { state: %w[cancelled landed_costs fully_receipted] }) .includes(purchase_order: %i[supplier store]) return 'No items found' unless items.any? InventoryMailer.empty_promised_date_reminder(items).deliver 'Reminder sent' end |