Class: Crm::WarehousesController
- Inherits:
-
CrmController
- Object
- ActionController::Base
- ApplicationController
- CrmController
- Crm::WarehousesController
- Defined in:
- app/controllers/crm/warehouses_controller.rb
Overview
Per-store warehouse dashboard: pick-slip/serial-number printing, mass
actions on deliveries, Speedee driver manifest generation, and the
state-based delivery/order tabs.
Constant Summary collapse
- TAB_ACTIONS =
Tab fragments never render standalone — non-frame hits redirect to show ?tab=.
%i[tab_pre_pack tab_at_warehouse tab_picking tab_pending_ship_labels tab_pending_ship_label_review tab_pending_pickup_confirm tab_pending_manifest_completion tab_pending_carrier_confirm tab_pending_ship_confirm tab_future_release tab_shipped_invoiced tab_held_orders tab_awaiting_carrier_assignment_orders tab_back_orders tab_amazon_items tab_serial_numbers tab_rmas_pending_to_receive_today tab_backordered_items tab_orders_need_attention tab_items_need_packaging_review tab_items_need_restock tab_problematic_deliveries].freeze
Constants included from Controllers::WarehouseStreamActions
Controllers::WarehouseStreamActions::WAREHOUSE_TAB_CONTENT_FRAME
Constants included from Controllers::ReferenceFindable
Controllers::ReferenceFindable::ID_EMBEDDED_PATTERNS
Constants included from Controllers::AnalyticsEvents
Controllers::AnalyticsEvents::MAX_QUEUED_EVENTS, Controllers::AnalyticsEvents::SESSION_KEY
Constants included from Controllers::ErrorRendering
Controllers::ErrorRendering::NON_CONTENT_PATH_PREFIXES
Instance Method Summary collapse
-
#cancel_picking ⇒ void
Places the orders behind the selected deliveries into CR Hold.
-
#dismiss_problematic_shipment ⇒ Object
Manual resolution: stamps the shipment — and any sibling rows sharing its tracking number on the same delivery (the tab collapses those to one row) — so it leaves the tab and the hourly sweep stops alerting.
-
#mass_action ⇒ void
Dispatches the selected bulk action (pick slip, ship confirm, hold, picked, serial labels, release) on the checked deliveries/serials.
-
#mass_ship_confirm ⇒ Object
Mass ship confirm page - shows deliveries filtered by carrier for bulk ship confirmation.
-
#mass_ship_confirmed ⇒ Object
Executes mass ship confirm from the warehouse dashboard.
-
#picked ⇒ void
Marks the selected deliveries as picked.
-
#print_pick_slip(split_kits = nil) ⇒ void
Sends pick slips for the selected deliveries to the store's shipping document print profile (or enqueues a downloadable job when none is configured).
-
#print_serial_number_labels ⇒ void
Generates and streams a combined super-label PDF for the selected serial numbers, marking them printed.
-
#release_now ⇒ void
Releases the selected deliveries immediately, overriding their future release date.
-
#serial_numbers ⇒ void
Shows serial numbers pending a printed label for the store.
-
#show ⇒ void
Renders the warehouse dashboard shell for the store loaded by #set_store.
-
#speedee_delivery_close ⇒ void
Generates the end-of-day Speedee manifest, once every Speedee delivery has moved past the pre-ship states.
-
#speedee_delivery_summary_pdf ⇒ void
Streams today's most recent Speedee driver summary PDF, if one exists.
-
#speedee_summary ⇒ void
Renders (HTML preview or PDF) the Speedee driver summary for a manifest — the most recent one by default, or a specific one for reprinting.
-
#tab_amazon_items ⇒ void
Tab: Amazon orders.
-
#tab_at_warehouse ⇒ void
Tab: deliveries at the warehouse.
-
#tab_awaiting_carrier_assignment_orders ⇒ void
Tab: orders awaiting carrier assignment.
-
#tab_back_orders ⇒ void
Tab: back-ordered orders.
-
#tab_backordered_items ⇒ void
Tab: store items backordered and out of stock.
-
#tab_future_release ⇒ void
Tab: deliveries with a future release date.
-
#tab_held_orders ⇒ void
Tab: held orders.
-
#tab_items_need_packaging_review ⇒ void
Tab: items flagged for weight/packaging review.
-
#tab_items_need_restock ⇒ void
Tab: store items needing restock.
-
#tab_orders_need_attention ⇒ void
Tab: orders that need attention.
-
#tab_pending_carrier_confirm ⇒ void
Tab: deliveries pending carrier confirmation.
-
#tab_pending_manifest_completion ⇒ void
Tab: deliveries pending manifest completion.
-
#tab_pending_pickup_confirm ⇒ void
Tab: deliveries pending pickup confirmation.
-
#tab_pending_ship_confirm ⇒ void
Tab: deliveries pending ship confirmation.
-
#tab_pending_ship_label_review ⇒ void
Tab: deliveries pending ship-label review.
-
#tab_pending_ship_labels ⇒ void
Tab: deliveries pending ship labels.
-
#tab_picking ⇒ void
Tab: deliveries being picked.
-
#tab_pre_pack ⇒ void
Tab: pre-pack deliveries.
-
#tab_problematic_deliveries ⇒ Object
Parcels flagged by the ProblematicDeliverySweep criteria (carrier exception, delivered to a pickup location in lieu of the address, overdue with no delivered scan).
-
#tab_rmas_pending_to_receive_today ⇒ void
Tab: RMAs with return shipments estimated to arrive today.
-
#tab_serial_numbers ⇒ void
Tab: serial numbers pending a printed label.
-
#tab_shipped_invoiced ⇒ void
Tab: recently shipped and invoiced deliveries.
Methods included from Controllers::RequireTurboFrame
require_in_pane_tab_frames, require_turbo_frame
Methods included from Controllers::WarehouseStreamActions
Methods included from FileDownloadPresenter
Methods inherited from CrmController
#access_denied, #context_id, #context_object, #crm_home_path, #current_ability, #default_url_options, #download_temp, #get_tempfile_path_for_download, #init_status_job_collector, #initialize_crm_lazy_chunks, #persist_enqueued_status_jobs, #record_not_found, #redirect_to_job_or_fallback, #render_edit_action, #set_context, #set_download_path, #stash_file_for_temp_download, #sync_admin_presence_cookie, #touch_employee_last_seen
Methods inherited from ApplicationController
#account_impersonated?, #add_to_flash, #after_sign_in_path_for, #bypass_forgery_protection?, #chat_enabled?, #cloudflare_cleared?, #default_catalog, #default_url_options, #enable_turbo_frames, #find_publication, #fix_invalid_accept_header, #init_js_utils, #is_globals_call?, #layout_by_resource, #locale_store, #redirect_to, #require_employee_for_crm, #set_base_host, #set_real_ip, #set_report_errors_for, #should_render_layout?, #skip_layout_for_turbo_frame?, #stamp_impersonation_context, #tab_frame_breakout_request?, #warmlyyours_canada_ip?, #warmlyyours_ip?, #y
Methods included from Controllers::ReturnPathHandling
#check_for_return_path, #redirect_to_return_path_or_default
Methods included from Controllers::AnalyticsEvents
#consume_queued_analytics_events, #registration_lead_type, #track_event
Methods included from Controllers::DeviceDetection
Methods included from Controllers::SubdomainDetection
#is_crm_request?, #is_www_request?, #json_request?
Methods included from Controllers::TurboSafeRedirect
Methods included from Controllers::TrackingDetection
#bot_request?, #gdpr_country?, #gdpr_country_data, #prevent_bots, #set_tracking_cookie, #track_visitor?
Methods included from Controllers::AcceleratedFileSending
#send_file_accelerated, #send_upload_accelerated
Methods included from Controllers::ErrorRendering
#excp_string, #mail_to_for_error_reporting, #render_400, #render_404, #render_406, #render_410, #render_500, #render_invalid_authenticity_token, #render_ip_spoof_error, #render_unpermitted_parameters, #safe_referer_or_fallback
Methods included from Controllers::TurnstileVerification
#load_turnstile_script_tag, #turnstile_lazy_widget, #turnstile_script_tag, #turnstile_widget, #validate_turnstile!
Methods included from Controllers::CloudflareCaching
edge_cached, #edge_cached_action?, #reset_cloudflare_cache, #set_cloudflare_cache, #skip_edge_cache!, #skip_session
Methods included from Controllers::Webpackable
#preload_webpack_fonts, #webpack_css_include, #webpack_css_url, #webpack_js_include, #wpd_is_running?
Methods included from Controllers::Localizable
#cloudflare_country_locale, #determine_request_locale, #geocoder_locale, #guest_user_locale_check, #locale_optional_www_auth_path?, #param_locale, #set_locale, #set_request_locale, #skip_localization?, #warmlyyours_ip_locale
Methods included from Controllers::Authenticable
#access_denied, #authenticate_account, #authenticate_account!, #authenticate_account_from_login_token!, #check_is_a_manager, #check_is_a_sales_manager, #check_is_an_admin, #check_is_an_employee, #check_party, #clear_mismatched_guest_user, #create_guest_user, #credentials?, #current_or_guest_user, #current_or_guest_user_id_read_only, #current_user, #devise_mapping, #fully_logged_in?, #generate_bot_id, #guest_user, #identifiable?, #init_current_user, #initialize_guest, #load_context_user, #logging_in, #resource, #resource_name, #restrict_access_for_non_employees, #scrubbed_request_path, #user_object, #warn_on_session_guest_id_leak
Methods included from UrlsHelper
#catalog_breadcrumb_links, #catalog_link, #catalog_link_for_product_line, #catalog_link_for_sku, #cms_link, #delocalized_path, #path_to_sales_product_sku, #path_to_sales_product_sku_for_product_line, #path_to_sales_product_sku_for_product_line_slug, #product_line_from_catalog_link, #protocol_neutral_url, #sanitize_external_url, #valid_external_url?
Instance Method Details
#cancel_picking ⇒ void
This method returns an undefined value.
Places the orders behind the selected deliveries into CR Hold.
60 61 62 63 64 65 66 67 |
# File 'app/controllers/crm/warehouses_controller.rb', line 60 def cancel_picking @orders = Order.joins(:deliveries).where(deliveries: { id: params[:delivery_ids] }) @orders.each do |order| order.quick_note("placed in CR Hold by warehouse, from state: #{order.state}") order.cr_hold! end redirect_back_or_to root_path end |
#dismiss_problematic_shipment ⇒ Object
Manual resolution: stamps the shipment — and any sibling rows sharing
its tracking number on the same delivery (the tab collapses those to
one row) — so it leaves the tab and the hourly sweep stops alerting.
501 502 503 504 505 506 507 508 509 510 |
# File 'app/controllers/crm/warehouses_controller.rb', line 501 def dismiss_problematic_shipment set_store shipment = Shipment.where(delivery_id: Delivery.by_store_id(@store.id).select(:id)) .find(params.expect(:shipment_id)) Shipment.where(delivery_id: shipment.delivery_id, tracking_number: shipment.tracking_number, problematic_dismissed_at: nil) .update_all(problematic_dismissed_at: Time.current, problematic_dismissed_by_id: current_user.id) flash[:info] = "Dismissed #{shipment.tracking_number} — it will no longer alert or appear here." redirect_to tab_problematic_deliveries_warehouse_path(@store) end |
#mass_action ⇒ void
This method returns an undefined value.
Dispatches the selected bulk action (pick slip, ship confirm, hold,
picked, serial labels, release) on the checked deliveries/serials.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'app/controllers/crm/warehouses_controller.rb', line 29 def mass_action unless params[:delivery_ids].present? || params[:serial_number_ids].present? flash[:info] = 'You must select one or more deliveries' redirect_back_or_to root_path and return end set_store selected_action = params[:selected_action].presence&.parameterize case selected_action when 'print-pick-slip', 'reprint-pick-slip' print_pick_slip when 'print-pick-slip-split-kits', 'reprint-pick-slip-split-kits' print_pick_slip(true) when 'mass-ship-confirm' mass_ship_confirmed when 'cancel-picking', 'cr-hold' cancel_picking when 'picked' picked when 'print-serial-number-labels' print_serial_number_labels when 'release-now' release_now else flash[:error] = "Mass action #{params[:selected_action]} not recognized." redirect_back_or_to root_path end end |
#mass_ship_confirm ⇒ Object
Mass ship confirm page - shows deliveries filtered by carrier for bulk ship confirmation
361 362 363 364 365 366 367 |
# File 'app/controllers/crm/warehouses_controller.rb', line 361 def mass_ship_confirm set_store carrier = params[:mass_ship_confirm_for_carrier] render_deliveries :pending_ship_confirm, deliveries: @store.query_mass_ship_confirm_delivery_candidates(carrier), mass_ship_confirm_for_carrier: carrier end |
#mass_ship_confirmed ⇒ Object
Executes mass ship confirm from the warehouse dashboard.
Runs synchronously so warehouse staff see immediate results instead of
waiting for background jobs with no feedback.
Uses the state machine's shipped! directly — its guards (LTL/PRO,
empty delivery) are the single source of truth. The old path through
individual_auto_ship_confirm added an extra shipments.completed.empty?
check that silently skipped deliveries whose shipments were in
label_complete state, even though the state machine would allow them.
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'app/controllers/crm/warehouses_controller.rb', line 78 def mass_ship_confirmed @deliveries = Delivery.where(id: params[:delivery_ids]) confirmed = [] skipped = [] failed = [] @deliveries.find_each do |delivery| if delivery.can_shipped? delivery.shipped! confirmed << delivery.id else skipped << delivery.id end rescue StandardError => e failed << delivery.id Rails.logger.error "Mass ship confirm failed for delivery #{delivery.id}: #{e.}" end = [] << "Ship confirmed #{confirmed.size} #{'delivery'.pluralize(confirmed.size)}." if confirmed.present? << "#{skipped.size} #{'delivery'.pluralize(skipped.size)} could not be confirmed (not ready or invalid state)." if skipped.present? << "#{failed.size} #{'delivery'.pluralize(failed.size)} failed with errors." if failed.present? if confirmed.present? flash[:success] = .shift flash[:warning] = .join(' ') if .any? elsif .any? flash[:error] = .join(' ') else flash[:warning] = 'No deliveries selected for ship confirm.' end redirect_to_return_path_or_default warehouse_path(@store, tab: 'pending_ship_confirm') end |
#picked ⇒ void
This method returns an undefined value.
Marks the selected deliveries as picked.
115 116 117 118 119 |
# File 'app/controllers/crm/warehouses_controller.rb', line 115 def picked @deliveries = Delivery.where(id: params[:delivery_ids]) @deliveries.each(&:picked) redirect_back_or_to root_path end |
#print_pick_slip(split_kits = nil) ⇒ void
This method returns an undefined value.
Sends pick slips for the selected deliveries to the store's shipping
document print profile (or enqueues a downloadable job when none is
configured).
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 |
# File 'app/controllers/crm/warehouses_controller.rb', line 215 def print_pick_slip(split_kits = nil) set_store if (print_profile = shipping_document_print_profile) # Stream them deliveries = Delivery.where(id: params[:delivery_ids]) print_item_labels = false deliveries.each do |delivery| # If split kits is not specified, then we determine based on the presence # of serial numbers in the kit components = { delivery_ids: [delivery.id], store_id: @store.id, print_profile_id: print_profile&.id, current_user_id: @context_user.id, split_kits: }.stringify_keys GeneratePickSlipWorker.perform_async() delivery.picking! if delivery.at_warehouse? print_item_labels = true if !print_item_labels && delivery.should_print_heating_element_labels? end flash[:info] = "#{view_context.pluralize(deliveries.size, 'slip')} sent to print profile #{print_profile.name}" if print_item_labels redirect_to (delivery_ids: params[:delivery_ids], heating_elements_only: true, return_path: @return_path || warehouse_path(@store)) else redirect_to_return_path_or_default warehouse_path(@store) end else = { delivery_ids: params[:delivery_ids], store_id: @store.id, print_profile_id: print_profile&.id, current_user_id: @context_user.id, split_kits: }.stringify_keys job_id = GeneratePickSlipWorker.perform_async() redirect_to_job_or_fallback(job_id, warehouse_path(@store)) end end |
#print_serial_number_labels ⇒ void
This method returns an undefined value.
Generates and streams a combined super-label PDF for the selected
serial numbers, marking them printed.
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
# File 'app/controllers/crm/warehouses_controller.rb', line 269 def print_serial_number_labels @serial_numbers = SerialNumber.where(id: params[:serial_number_ids]) if @serial_numbers.present? # get all of the serial number labels and join them together, serial number also get marked as PRINTED here pdf = SerialNumber.generate_super_label_pdf(@serial_numbers) if pdf session[:download_path] = upload_url(pdf) session[:download_disposition] = :inline flash[:info] = "Super label generated. If the file doesn't open automatically please click <a href='#{session[:download_path]}' target='_blank' rel='noopener'>here</a>" else flash[:error] = 'No labels could be generated.' end else flash[:error] = 'No labels selected' end redirect_back_or_to root_path end |
#release_now ⇒ void
This method returns an undefined value.
Releases the selected deliveries immediately, overriding their future
release date.
125 126 127 128 129 130 131 132 |
# File 'app/controllers/crm/warehouses_controller.rb', line 125 def release_now @deliveries = Delivery.where(id: params[:delivery_ids]) @deliveries.each do |d| d.override_future_release_date = true d.release! end redirect_back_or_to root_path end |
#serial_numbers ⇒ void
This method returns an undefined value.
Shows serial numbers pending a printed label for the store.
259 260 261 262 263 |
# File 'app/controllers/crm/warehouses_controller.rb', line 259 def serial_numbers set_store @serial_numbers_pending_print = @store.query_serial_numbers_pending_print puts "serial_number_labels!!!: @store: #{@store}" end |
#show ⇒ void
This method returns an undefined value.
Renders the warehouse dashboard shell for the store loaded by
#set_store.
20 21 22 23 |
# File 'app/controllers/crm/warehouses_controller.rb', line 20 def show set_store @return_path = warehouse_path(@store.id) end |
#speedee_delivery_close ⇒ void
This method returns an undefined value.
Generates the end-of-day Speedee manifest, once every Speedee delivery
has moved past the pre-ship states.
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 |
# File 'app/controllers/crm/warehouses_controller.rb', line 185 def speedee_delivery_close Delivery.transaction do remaining_speedee_deliveries = Delivery.with_shipment_carrier('SpeedeeDelivery').where(state: %w[at_warehouse pending_ship_labels]).size set_store if remaining_speedee_deliveries.zero? result = Shipping::SpeedeeManifestGenerator.new.process(@store) # puts result if result.success # everything ok, print the manifest summary PDF # send the file to the browser session[:download_path] = upload_url(result.summary_pdf_upload) session[:download_disposition] = :inline flash[:info] = "Speedee Manifest generated, if the summary PDF does not open automatically please click <a href='#{session[:download_path]}' target='_blank' rel='noopener'>here</a>." else flash[:error] = "Could not generate end of day manifest. #{result.}" end else flash[:error] = "Could not generate end of day manifest. #{remaining_speedee_deliveries} Speedee deliveries remain to be processed. Either HOLD them or ship label them to proceed." end redirect_back_or_to root_path end end |
#speedee_delivery_summary_pdf ⇒ void
This method returns an undefined value.
Streams today's most recent Speedee driver summary PDF, if one exists.
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'app/controllers/crm/warehouses_controller.rb', line 137 def speedee_delivery_summary_pdf set_store # puts result sm = SpeedeeManifest.last if (sm.transmitted_at.to_date == Time.current.to_date) && sm.uploads.summary_pdfs.last.present? # check we have a recent manifest generated today # everything ok, print the manifest summary PDF # send the file to the browser session[:download_path] = upload_url(sm.uploads.summary_pdfs.last) session[:download_disposition] = :inline flash[:info] = "Most recent Speedee driver summary PDF for today found, if the summary PDF does not open automatically please click <a href='#{session[:download_path]}' target='_blank' rel='noopener'>here</a>." else flash[:error] = "Could not find today's Speedee driver summary PDF" end redirect_back_or_to root_path end |
#speedee_summary ⇒ void
This method returns an undefined value.
Renders (HTML preview or PDF) the Speedee driver summary for a
manifest — the most recent one by default, or a specific one for
reprinting.
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
# File 'app/controllers/crm/warehouses_controller.rb', line 158 def speedee_summary set_store # Defaults to the most recent manifest (the driver-summary menu link passes # nothing); the manifest browser's Reprint passes an id so a superseded # sheet can be reprinted after the fact. speedee_manifest = SpeedeeManifest.find_by(id: params[:speedee_manifest_id]) || SpeedeeManifest.last respond_to do |format| format.html do render layout: 'layouts/pdf/speedee_summary', locals: { store: @store, speedee_manifest: } end format.pdf do summary_result = Pdf::Document::SpeedeeSummary.call(@store, speedee_manifest) send_data summary_result.pdf, filename: summary_result.pdf_file_name, type: 'application/pdf', disposition: 'inline' end end end |
#tab_amazon_items ⇒ void
This method returns an undefined value.
Tab: Amazon orders.
423 424 425 426 427 |
# File 'app/controllers/crm/warehouses_controller.rb', line 423 def tab_amazon_items set_store @orders = @store.query_warehouse_amazon_orders render 'tab_amazon_items', layout: should_render_layout? end |
#tab_at_warehouse ⇒ void
This method returns an undefined value.
Tab: deliveries at the warehouse.
299 300 301 302 |
# File 'app/controllers/crm/warehouses_controller.rb', line 299 def tab_at_warehouse set_store render_deliveries :at_warehouse end |
#tab_awaiting_carrier_assignment_orders ⇒ void
This method returns an undefined value.
Tab: orders awaiting carrier assignment.
403 404 405 406 407 408 |
# File 'app/controllers/crm/warehouses_controller.rb', line 403 def tab_awaiting_carrier_assignment_orders set_store @orders = @store.query_awaiting_carrier_assignment_orders @tab_frame_id = 'awaiting_carrier_assignment_orders' render 'tab_orders', layout: should_render_layout? end |
#tab_back_orders ⇒ void
This method returns an undefined value.
Tab: back-ordered orders.
413 414 415 416 417 418 |
# File 'app/controllers/crm/warehouses_controller.rb', line 413 def tab_back_orders set_store @orders = @store.query_warehouse_back_orders @tab_frame_id = 'back_orders' render 'tab_orders', layout: should_render_layout? end |
#tab_backordered_items ⇒ void
This method returns an undefined value.
Tab: store items backordered and out of stock.
453 454 455 456 457 |
# File 'app/controllers/crm/warehouses_controller.rb', line 453 def tab_backordered_items set_store @store_items = Query::StoreItemQuery.new.out_of_stock_items_on_backorders(@store.id) render 'tab_backordered_items', layout: should_render_layout? end |
#tab_future_release ⇒ void
This method returns an undefined value.
Tab: deliveries with a future release date.
372 373 374 375 376 |
# File 'app/controllers/crm/warehouses_controller.rb', line 372 def tab_future_release set_store deliveries = @store.query_warehouse_deliveries(state: :future_release).order(:future_release_date, :created_at) render_deliveries :future_release, deliveries: end |
#tab_held_orders ⇒ void
This method returns an undefined value.
Tab: held orders.
393 394 395 396 397 398 |
# File 'app/controllers/crm/warehouses_controller.rb', line 393 def tab_held_orders set_store @orders = @store.query_warehouse_held_orders @tab_frame_id = 'held_orders' render 'tab_orders', layout: should_render_layout? end |
#tab_items_need_packaging_review ⇒ void
This method returns an undefined value.
Tab: items flagged for weight/packaging review.
472 473 474 475 476 |
# File 'app/controllers/crm/warehouses_controller.rb', line 472 def tab_items_need_packaging_review set_store @items = Item.active.where('review_product_weight_flag IS true OR review_product_packaging_flag IS true') render 'tab_items_need_packaging_review', layout: should_render_layout? end |
#tab_items_need_restock ⇒ void
This method returns an undefined value.
Tab: store items needing restock.
481 482 483 484 485 |
# File 'app/controllers/crm/warehouses_controller.rb', line 481 def tab_items_need_restock set_store @store_items = Query::StoreItemQuery.new.restock_items(@store.id) render 'tab_items_need_restock', layout: should_render_layout? end |
#tab_orders_need_attention ⇒ void
This method returns an undefined value.
Tab: orders that need attention.
462 463 464 465 466 467 |
# File 'app/controllers/crm/warehouses_controller.rb', line 462 def tab_orders_need_attention set_store @orders = @store.query_warehouse_orders_need_attention @tab_frame_id = 'orders_need_attention' render 'tab_orders', layout: should_render_layout? end |
#tab_pending_carrier_confirm ⇒ void
This method returns an undefined value.
Tab: deliveries pending carrier confirmation.
347 348 349 350 |
# File 'app/controllers/crm/warehouses_controller.rb', line 347 def tab_pending_carrier_confirm set_store render_deliveries :pending_carrier_confirm end |
#tab_pending_manifest_completion ⇒ void
This method returns an undefined value.
Tab: deliveries pending manifest completion.
339 340 341 342 |
# File 'app/controllers/crm/warehouses_controller.rb', line 339 def tab_pending_manifest_completion set_store render_deliveries :pending_manifest_completion end |
#tab_pending_pickup_confirm ⇒ void
This method returns an undefined value.
Tab: deliveries pending pickup confirmation.
331 332 333 334 |
# File 'app/controllers/crm/warehouses_controller.rb', line 331 def tab_pending_pickup_confirm set_store render_deliveries :pending_pickup_confirm end |
#tab_pending_ship_confirm ⇒ void
This method returns an undefined value.
Tab: deliveries pending ship confirmation.
355 356 357 358 |
# File 'app/controllers/crm/warehouses_controller.rb', line 355 def tab_pending_ship_confirm set_store render_deliveries :pending_ship_confirm end |
#tab_pending_ship_label_review ⇒ void
This method returns an undefined value.
Tab: deliveries pending ship-label review.
323 324 325 326 |
# File 'app/controllers/crm/warehouses_controller.rb', line 323 def tab_pending_ship_label_review set_store render_deliveries :pending_ship_label_review end |
#tab_pending_ship_labels ⇒ void
This method returns an undefined value.
Tab: deliveries pending ship labels.
315 316 317 318 |
# File 'app/controllers/crm/warehouses_controller.rb', line 315 def tab_pending_ship_labels set_store render_deliveries :pending_ship_labels end |
#tab_picking ⇒ void
This method returns an undefined value.
Tab: deliveries being picked.
307 308 309 310 |
# File 'app/controllers/crm/warehouses_controller.rb', line 307 def tab_picking set_store render_deliveries :picking end |
#tab_pre_pack ⇒ void
This method returns an undefined value.
Tab: pre-pack deliveries.
290 291 292 293 294 |
# File 'app/controllers/crm/warehouses_controller.rb', line 290 def tab_pre_pack set_store deliveries = @store.query_warehouse_deliveries(state: :pre_pack).order(:order_id, :quote_id, :future_release_date, :created_at) render_deliveries :pre_pack, deliveries: end |
#tab_problematic_deliveries ⇒ Object
Parcels flagged by the ProblematicDeliverySweep criteria (carrier
exception, delivered to a pickup location in lieu of the address,
overdue with no delivered scan). Rows disappear when tracking catches
up (delivered scan), the shipment ages out of the 30-day lookback, or
warehouse staff dismiss them below.
492 493 494 495 496 |
# File 'app/controllers/crm/warehouses_controller.rb', line 492 def tab_problematic_deliveries set_store @flagged = ProblematicDeliverySweep.flagged(store: @store) render 'tab_problematic_deliveries', layout: should_render_layout? end |
#tab_rmas_pending_to_receive_today ⇒ void
This method returns an undefined value.
Tab: RMAs with return shipments estimated to arrive today.
441 442 443 444 445 446 447 448 |
# File 'app/controllers/crm/warehouses_controller.rb', line 441 def tab_rmas_pending_to_receive_today set_store @rmas = Rma.joins(:return_shipments) .where(shipments: { estimated_delivery_date: Time.zone.today }) .where(shipments: { tracking_state: %w[in_transit delivered exception delivery_attempt delivered_to_collection_location] }) .where(company_id: @store.id).select('rmas.*,shipments.estimated_delivery_date,shipments.tracking_state').uniq render 'tab_rmas_pending_to_receive_today', layout: should_render_layout? end |
#tab_serial_numbers ⇒ void
This method returns an undefined value.
Tab: serial numbers pending a printed label.
432 433 434 435 436 |
# File 'app/controllers/crm/warehouses_controller.rb', line 432 def tab_serial_numbers set_store @serial_numbers_pending_print = @store.query_serial_numbers_pending_print render 'tab_serial_numbers', layout: should_render_layout? end |
#tab_shipped_invoiced ⇒ void
This method returns an undefined value.
Tab: recently shipped and invoiced deliveries.
381 382 383 384 385 386 387 388 |
# File 'app/controllers/crm/warehouses_controller.rb', line 381 def tab_shipped_invoiced set_store @state = :shipped_invoiced @deliveries = @store.query_recently_shipped.order(:created_at) preload_delivery_tracking_events! @mass_actions = [] render 'tab_deliveries', layout: should_render_layout? end |