# Bulk Transfer Import Flow Documentation

This document explains the end-to-end flow for importing scanned bulk transfer items from Excel/CSV and generating the SQL insert for a transfer request.

## 1) Select a transfer request

From the transfer request list, choose a record such as:

- TRN10003899

The request list page shows the available outbound transfer requests and their status.

Image reference: first screenshot

### Expected behavior
- User clicks a transfer request row
- The system opens the transfer detail page for that request
- The page displays the scanned item list and transfer details for the selected outbound code

---

## 2) Open the transfer detail page

After clicking the transfer record, the system shows the bulk transfer detail page for that outbound code.

This screen includes:
- transfer header information
- transfer code and date
- item details table
- the Import Scanned Items button

Image reference: second screenshot

### Important action
Click the button:

- Import Scanned Items

This opens the import workflow.

---

## 3) Upload scanned items from Excel or CSV

When the user clicks Import Scanned Items, the system opens the import modal.

The workflow allows the user to:
- choose an Excel or CSV file
- read the file contents
- map the uploaded columns to the transfer item fields
- generate the SQL insert statement automatically

Image reference: third screenshot

### Generated SQL modal
The modal contains:
- the generated SQL insert text area
- Copy SQL button
- Run SQL Query button
- Close button

### Available actions
1. Copy SQL
   - Copies the generated SQL into the clipboard
   - Useful for review or manual execution

2. Run SQL Query
   - Confirms the insert action
   - Sends the generated SQL to the backend endpoint
   - Saves the scanned items into the database

### Notes
- The SQL is generated based on the uploaded file rows
- Duplicate barcode rows keep their original row count, but the requested quantity is summed for the same barcode
- The generated SQL is shown before execution so the user can review it

---

## 4) After successful insert

After the SQL is executed successfully, the scanned items appear in the transfer list as posted/scanned records.

Image reference: fourth screenshot

### Resulting page behavior
- items are listed in the bulk transfer order details table
- quantity scanned is populated
- quantity requested is updated based on the imported data
- status shows as scanned/posted depending on the workflow state

---

## Example flow summary

1. Select outbound transfer request
2. Open transfer detail page
3. Click Import Scanned Items
4. Upload Excel/CSV file
5. Review generated SQL in modal
6. Click Copy SQL or Run SQL Query
7. Confirm database insert
8. View the imported scanned items on the final list screen

---

## Typical use case

This is used when warehouse staff have a file of scanned items and need to import them for a transfer request quickly without manually entering each record one-by-one.
