26ff8d9b4f
Set up repository with legacy .NET Framework 4.8 source (OLD/), new .NET 10 Blazor solution (NEW/), OpenSpec specifications, documentation, and project configuration.
474 lines
17 KiB
Markdown
474 lines
17 KiB
Markdown
# Search Creation Page - Functionality Analysis
|
|
|
|
This document provides a comprehensive analysis of the legacy search creation page (`OLD/WebInterface/Views/Search/Create.cshtml`) for migration to the new .NET 10 Blazor application.
|
|
|
|
## Overview
|
|
|
|
The search creation page allows users to create complex manufacturing/ERP searches by combining various filter criteria. It uses Kendo UI for data binding and widgets, jQuery FileUpload for Excel file handling, and SignalR for real-time status updates.
|
|
|
|
---
|
|
|
|
## Page Structure
|
|
|
|
### Header Section
|
|
- **Title**: "Search"
|
|
- **Submit Button**: Triggers validation and saves the search
|
|
|
|
### Search Details Panel
|
|
| Field | Type | Behavior |
|
|
|-------|------|----------|
|
|
| Search Type | Dropdown | **Required**. Selects from 16 predefined filter combinations. Controls which filter panels are visible. |
|
|
| Name | Text input | **Required**. User-friendly name for the search. |
|
|
| Submitted At | Read-only text | Displays when search was submitted (formatted: `MM/dd/yyyy hh:mm:ss tt`) |
|
|
| Started At | Read-only text | Displays when processing started |
|
|
| Completed At | Read-only text | Displays when processing completed |
|
|
| User | Read-only text | Username of search creator (auto-populated) |
|
|
| Status | Read-only text | Current status with color coding (red background for Error status) |
|
|
| Download Results | Button | Visible only when `Status === 'Ended'`. Downloads Excel results. |
|
|
|
|
### Read-Only Mode
|
|
When a search has been submitted (`Status !== 'New'`):
|
|
- Submit button is hidden
|
|
- All inputs are disabled
|
|
- Template upload/download/clear buttons are hidden
|
|
- A warning notice is displayed with a **Copy** button to duplicate the search
|
|
|
|
---
|
|
|
|
## Valid Search Type Combinations
|
|
|
|
The system enforces 16 predefined filter combinations defined in `OLD/WebInterface/Scripts/model/models.js`:
|
|
|
|
| ID | Name | Timespan | Work Order | Item Number | Profit Center | Work Center | Component Lot | Operator | Item/Op/MIS | Extract MIS |
|
|
|----|------|----------|------------|-------------|---------------|-------------|---------------|----------|-------------|-------------|
|
|
| 10 | Work Order | | x | | | | | | | |
|
|
| 20 | Component Lot | | | | | | x | | | |
|
|
| 30 | Time Span + Profit Center | x | | | x | | | | | |
|
|
| 40 | Time Span + Work Center | x | | | | x | | | | |
|
|
| 50 | Time Span + Operator | x | | | | | | x | | |
|
|
| 60 | Time Span + Profit Center + Item Number | x | | x | x | | | | | |
|
|
| 70 | Time Span + Profit Center + Item/Operation/MIS | x | | | x | | | | x | |
|
|
| 80 | Time Span + Profit Center + Work Order + Item/Operation/MIS | x | x | | x | | | | x | |
|
|
| 90 | Time Span + Profit Center + Extract MIS | x | | | x | | | | | x |
|
|
| 100 | Time Span + Work Center + Item Number | x | | x | | x | | | | |
|
|
| 110 | Time Span + Work Center + Extract MIS | x | | | | x | | | | x |
|
|
| 120 | Time Span + Work Center + Item/Operation/MIS | x | | | | x | | | x | |
|
|
| 130 | Time Span + Work Center + Work Order + Item/Operation/MIS | x | x | | | x | | | x | |
|
|
| 140 | Time Span + Item Number | x | | x | | | | | | |
|
|
| 150 | Time Span + Work Center + Operator | x | | | | x | | x | | |
|
|
| 160 | Time Span + Profit Center + Operator | x | | | x | | | x | | |
|
|
|
|
---
|
|
|
|
## Filter Panels
|
|
|
|
### 1. Time Span Filter
|
|
**Panel Header**: "Filter by timespan"
|
|
|
|
| Field | Type | Validation | Notes |
|
|
|-------|------|------------|-------|
|
|
| Min Date | Kendo DatePicker | **Required** when filter is active. Must be valid date. | Min: Nov 1, 2002. Max: Today or Max Date if set. |
|
|
| Max Date | Kendo DatePicker | **Required** when filter is active. Must be valid date. | Min: Nov 1, 2002 or Min Date if set. Max: Today. |
|
|
|
|
**Interactions**:
|
|
- Min/Max pickers constrain each other (selecting min date sets min of max picker, and vice versa)
|
|
- Custom validation prevents invalid date text
|
|
|
|
---
|
|
|
|
### 2. Work Order Filter
|
|
**Panel Header**: "Filter by work order"
|
|
|
|
**Data Display**: Kendo Grid showing:
|
|
- Work Order Number
|
|
- Item Number (looked up from database)
|
|
|
|
**File Operations**:
|
|
| Button | Action | Endpoint |
|
|
|--------|--------|----------|
|
|
| Download Template | Downloads Excel with current data | `POST FileIO/DownloadWorkOrders` → `GET FileIO/DownloadWorkOrders?key` |
|
|
| Upload Data | Uploads Excel file, validates work orders against DB | `POST FileIO/UploadWorkOrders` |
|
|
| Clear Data | Clears grid after confirmation dialog | Local action |
|
|
|
|
**Upload Format**: Excel file with column "Work Order Number" (starting row 2)
|
|
|
|
**Validation**: At least one work order required when filter is active
|
|
|
|
---
|
|
|
|
### 3. Item Number Filter
|
|
**Panel Header**: "Filter by item number"
|
|
|
|
**Input Method**: Kendo ComboBox with server-side autocomplete
|
|
- Minimum 3 characters to trigger search
|
|
- Filter: "contains"
|
|
- Template displays: Item Number | Description
|
|
- Endpoint: `GET Lookup/FindItem?itemNumber=...`
|
|
|
|
**Data Display**: Kendo Grid showing:
|
|
- Item Number
|
|
- Description
|
|
- Delete action button
|
|
|
|
**Actions**:
|
|
| Button | Action |
|
|
|--------|--------|
|
|
| Add to filter | Adds selected item from combobox to grid |
|
|
| Delete (per row) | Removes item from grid |
|
|
| Clear Data | Clears grid after confirmation |
|
|
| Download Template | Downloads Excel with current items |
|
|
| Upload Data | Uploads Excel file of item numbers |
|
|
|
|
**File Operations**:
|
|
| Button | Endpoint |
|
|
|--------|----------|
|
|
| Download Template | `POST FileIO/DownloadPartNumbers` → `GET FileIO/DownloadPartNumbers?key` |
|
|
| Upload Data | `POST FileIO/UploadPartNumbers` |
|
|
|
|
**Upload Format**: Excel file with column "Item Number" (starting row 2)
|
|
|
|
**Validation**: At least one item required when filter is active
|
|
|
|
---
|
|
|
|
### 4. Profit Center Filter
|
|
**Panel Header**: "Filter by profit center"
|
|
|
|
**Input Method**: Kendo ComboBox with server-side autocomplete
|
|
- Minimum 3 characters to trigger search
|
|
- Filter: "contains"
|
|
- Template displays: Code | Description
|
|
- Endpoint: `GET Lookup/FindProfitCenter?profitCenter=...`
|
|
|
|
**Data Display**: Kendo Grid showing:
|
|
- Code (Profit Center)
|
|
- Description
|
|
- Delete action button
|
|
|
|
**Actions**:
|
|
| Button | Action |
|
|
|--------|--------|
|
|
| Add to filter | Adds selected profit center from combobox to grid |
|
|
| Delete (per row) | Removes profit center from grid |
|
|
| Clear Data | Clears grid after confirmation |
|
|
|
|
**No file upload/download** for this filter.
|
|
|
|
**Validation**: At least one profit center required when filter is active
|
|
|
|
---
|
|
|
|
### 5. Work Center Filter
|
|
**Panel Header**: "Filter by work center"
|
|
|
|
**Input Method**: Kendo ComboBox with server-side autocomplete
|
|
- Minimum 3 characters to trigger search
|
|
- Filter: "contains"
|
|
- Template displays: Code | Description
|
|
- Endpoint: `GET Lookup/FindWorkCenter?workCenter=...`
|
|
|
|
**Data Display**: Kendo Grid showing:
|
|
- Code (Work Center)
|
|
- Description
|
|
- Delete action button
|
|
|
|
**Actions**:
|
|
| Button | Action |
|
|
|--------|--------|
|
|
| Add to filter | Adds selected work center from combobox to grid |
|
|
| Delete (per row) | Removes work center from grid |
|
|
| Clear Data | Clears grid after confirmation |
|
|
|
|
**No file upload/download** for this filter.
|
|
|
|
**Validation**: At least one work center required when filter is active
|
|
|
|
---
|
|
|
|
### 6. Component Lot Filter
|
|
**Panel Header**: "Filter by component lot"
|
|
|
|
**Data Display**: Kendo Grid showing:
|
|
- Lot Number
|
|
- Item Number
|
|
|
|
**File Operations**:
|
|
| Button | Action | Endpoint |
|
|
|--------|--------|----------|
|
|
| Download Template | Downloads Excel with current data | `POST FileIO/DownloadComponentLots` → `GET FileIO/DownloadComponentLots?key` |
|
|
| Upload Data | Uploads Excel file, validates lots against DB | `POST FileIO/UploadComponentLots` |
|
|
| Clear Data | Clears grid after confirmation dialog | Local action |
|
|
|
|
**Upload Format**: Excel file with columns "Component Lot Number", "Component Item Number" (starting row 2)
|
|
|
|
**Validation**: At least one component lot required when filter is active
|
|
|
|
---
|
|
|
|
### 7. Operator Filter
|
|
**Panel Header**: "Filter by operator"
|
|
|
|
**Input Method**: Kendo ComboBox with server-side autocomplete
|
|
- Minimum 3 characters to trigger search
|
|
- Filter: "contains"
|
|
- Template displays: Address Number | User ID | Full Name
|
|
- Endpoint: `GET Lookup/FindOperator?operatorName=...`
|
|
|
|
**Data Display**: Kendo Grid showing:
|
|
- Address Number
|
|
- User ID
|
|
- Full Name
|
|
- Delete action button
|
|
|
|
**Actions**:
|
|
| Button | Action |
|
|
|--------|--------|
|
|
| Add to filter | Adds selected operator from combobox to grid |
|
|
| Delete (per row) | Removes operator from grid |
|
|
| Clear Data | Clears grid after confirmation |
|
|
|
|
**No file upload/download** for this filter.
|
|
|
|
**Validation**: At least one operator required when filter is active
|
|
|
|
---
|
|
|
|
### 8. Item/Operation/MIS Filter
|
|
**Panel Header**: "Filter By Item/Operation/MIS"
|
|
|
|
**Data Display**: Kendo Grid showing:
|
|
- Item Number
|
|
- Operation Step Number
|
|
- MIS Number
|
|
- MIS Revision
|
|
|
|
**File Operations**:
|
|
| Button | Action | Endpoint |
|
|
|--------|--------|----------|
|
|
| Download Template | Downloads Excel with current data | `POST FileIO/DownloadPartOperations` → `GET FileIO/DownloadPartOperations?key` |
|
|
| Upload Data | Uploads Excel file (no DB validation) | `POST FileIO/UploadPartOperations` |
|
|
| Clear Data | Clears grid after confirmation dialog | Local action |
|
|
|
|
**Upload Format**: Excel file with columns "Item Number", "Operation Number", "MIS Number", "MIS Revision" (starting row 2)
|
|
|
|
**Note**: Operation numbers with decimals are truncated to integers during upload.
|
|
|
|
**Validation**: At least one entry required when filter is active
|
|
|
|
---
|
|
|
|
### 9. Extract MIS Data Option
|
|
**Panel Header**: "Extract MIS data"
|
|
|
|
**Display**: Read-only checkbox that is automatically checked when this search type is selected. Not user-editable.
|
|
|
|
---
|
|
|
|
## API Endpoints Summary
|
|
|
|
### Search Operations
|
|
| Endpoint | Method | Purpose |
|
|
|----------|--------|---------|
|
|
| `Search/Create` | GET | Renders the search creation view |
|
|
| `Search/GetSearch?id=` | GET | Loads existing search or creates blank search |
|
|
| `Search/CopySearch?id=` | GET | Creates copy of existing search (resets status/timestamps) |
|
|
| `Search/Save` | POST | Saves search criteria, queues for processing |
|
|
| `Search/GetResults?id=` | GET | Downloads Excel results for completed search |
|
|
|
|
### Lookup/Autocomplete
|
|
| Endpoint | Method | Purpose |
|
|
|----------|--------|---------|
|
|
| `Lookup/FindItem?itemNumber=` | GET | Searches items by number (contains filter) |
|
|
| `Lookup/FindProfitCenter?profitCenter=` | GET | Searches profit centers by code |
|
|
| `Lookup/FindWorkCenter?workCenter=` | GET | Searches work centers by code |
|
|
| `Lookup/FindOperator?operatorName=` | GET | Searches operators by name |
|
|
|
|
### File I/O
|
|
| Endpoint | Method | Purpose | Template File |
|
|
|----------|--------|---------|---------------|
|
|
| `FileIO/UploadWorkOrders` | POST | Upload work order Excel | - |
|
|
| `FileIO/DownloadWorkOrders` | POST/GET | Download work order template | `work_order_template.xlsx` |
|
|
| `FileIO/UploadPartNumbers` | POST | Upload item number Excel | - |
|
|
| `FileIO/DownloadPartNumbers` | POST/GET | Download item template | `item_number_template.xlsx` |
|
|
| `FileIO/UploadComponentLots` | POST | Upload component lot Excel | - |
|
|
| `FileIO/DownloadComponentLots` | POST/GET | Download component lot template | `component_lot_template.xlsx` |
|
|
| `FileIO/UploadPartOperations` | POST | Upload item/op/MIS Excel | - |
|
|
| `FileIO/DownloadPartOperations` | POST/GET | Download item/op/MIS template | `item_operations_mis_template.xlsx` |
|
|
|
|
---
|
|
|
|
## JavaScript Architecture
|
|
|
|
### Libraries Used
|
|
- **Kendo UI**: Observable viewModel, DataSource, Grid, ComboBox, DatePicker, DropDownList, Validator, Alert, Window
|
|
- **jQuery FileUpload**: Handles Excel file uploads with iframe transport
|
|
- **SignalR 2.2.1**: Real-time status updates from server
|
|
- **js-cookie**: Cookie handling (included but usage not prominent)
|
|
- **jQuery UI**: General UI utilities
|
|
|
|
### ViewModel Structure
|
|
The page uses a Kendo Observable viewModel with the following properties:
|
|
|
|
```javascript
|
|
{
|
|
// Search details
|
|
ID: null,
|
|
Name: null,
|
|
SubmitDT: null,
|
|
StartDT: null,
|
|
EndDT: null,
|
|
UserName: null,
|
|
Status: null,
|
|
StatusColor: function(), // Returns '#FF6347' for Error, '#eee' otherwise
|
|
|
|
// Filter flags (control panel visibility)
|
|
TimeSpan_FilterFlag: false,
|
|
LotNumbers_FilterFlag: false,
|
|
PartNumbers_FilterFlag: false,
|
|
ProfitCenters_FilterFlag: false,
|
|
WorkCenters_FilterFlag: false,
|
|
ComponentLotNumbers_FilterFlag: false,
|
|
OperatorIDs_FilterFlag: false,
|
|
PartOperations_FilterFlag: false,
|
|
ExtractMisData_FilterFlag: false,
|
|
|
|
// Filter data
|
|
MinimumDT: null,
|
|
MaximumDT: null,
|
|
LotNumbers: DataSource,
|
|
PartNumbers: DataSource,
|
|
ProfitCenters: DataSource,
|
|
WorkCenters: DataSource,
|
|
ComponentLotNumbers: DataSource,
|
|
OperatorIDs: DataSource,
|
|
PartOperations: DataSource,
|
|
|
|
// Combobox selection state
|
|
PartNumbers_AddItem: null,
|
|
ProfitCenters_AddItem: null,
|
|
WorkCenters_AddItem: null,
|
|
OperatorIDs_AddItem: null,
|
|
|
|
// UI state
|
|
IsReadOnly: true,
|
|
HasResults: false,
|
|
ValidCombinations: [...], // 16 valid search types
|
|
SearchType: null
|
|
}
|
|
```
|
|
|
|
### Key Functions
|
|
|
|
| Function | Purpose |
|
|
|----------|---------|
|
|
| `viewModel.setData(data)` | Populates viewModel from server response, determines search type from filter flags |
|
|
| `viewModel.SearchType_Change()` | Shows/hides filter panels based on selected search type |
|
|
| `submitSearch()` | Extracts form data, sends to server, handles timeout/errors |
|
|
| `loadSearchDetails(id)` | Loads existing search from server |
|
|
| `copySearchDetails(id)` | Loads search for copying (resets ID to 0) |
|
|
| `showConfirmationWindow(message)` | Displays Kendo confirmation dialog, returns Promise |
|
|
| `getParameterByName(name)` | Extracts URL query parameter |
|
|
|
|
---
|
|
|
|
## SignalR Integration
|
|
|
|
### Hub Connection
|
|
- Connects to `StatusHub` via `/signalr/hubs`
|
|
- Auto-reconnects after 5 seconds on disconnect
|
|
|
|
### Events
|
|
| Event | Purpose |
|
|
|-------|---------|
|
|
| `searchUpdate` | Receives status updates when search status changes. Updates SubmitDT, StartDT, EndDT, Status, HasResults. |
|
|
|
|
### Status Values
|
|
| Status | Description | UI Behavior |
|
|
|--------|-------------|-------------|
|
|
| `New` | Not yet submitted | Editable mode |
|
|
| `Queued` | Waiting to be processed | Read-only mode |
|
|
| `Running` | Currently processing | Read-only mode |
|
|
| `Ended` | Completed successfully | Read-only mode, Download Results visible |
|
|
| `Error` | Failed | Read-only mode, Status field has red background |
|
|
|
|
---
|
|
|
|
## Validation Rules
|
|
|
|
### Form-Level Validation (Kendo Validator)
|
|
1. **Search Type**: Required
|
|
2. **Name**: Required
|
|
3. **Date Pickers**: Must be valid dates when visible
|
|
|
|
### Filter-Level Validation (Submit Handler)
|
|
When a filter panel is active, its data collection must have at least one item:
|
|
|
|
| Filter | Validation Message |
|
|
|--------|-------------------|
|
|
| Work Orders | "At least one work order must be specified for the work order filter." |
|
|
| Item Numbers | "At least one item number must be specified for the item number filter." |
|
|
| Profit Centers | "At least one profit center must be specified for the profit center filter." |
|
|
| Work Centers | "At least one work center must be specified for the work center filter." |
|
|
| Component Lots | "At least one component lot must be specified for the component lot filter." |
|
|
| Operators | "At least one operator must be specified for the operator filter." |
|
|
| Part Operations | "At least one item/operation/MIS entry must be specified for the MIS data filter." |
|
|
|
|
### Confirmation Dialogs
|
|
Shown before:
|
|
- Submitting the search
|
|
- Clearing any filter data collection
|
|
|
|
---
|
|
|
|
## File Upload/Download Flow
|
|
|
|
### Upload Flow
|
|
1. User clicks hidden file input via styled label
|
|
2. jQuery FileUpload sends file to endpoint with `autoUpload: true`
|
|
3. Server parses Excel, optionally validates against database
|
|
4. Server returns `{ WasSuccessful: true/false, Data: [...], ErrorMessage: "..." }`
|
|
5. On success, viewModel DataSource is updated with returned data
|
|
6. On failure, `alert()` displays error message
|
|
|
|
### Download Flow
|
|
1. User clicks Download Template button
|
|
2. Current data is POSTed to server
|
|
3. Server generates Excel, caches it with GUID key (1 minute TTL)
|
|
4. Server returns cache key
|
|
5. Client appends hidden iframe with `src` pointing to GET endpoint with key
|
|
6. Browser downloads file via iframe
|
|
|
|
---
|
|
|
|
## Dead Code / Legacy References
|
|
|
|
- `CheckCamstar_Flag`: Referenced in submit payload (`Create.cshtml:1343`) but no corresponding viewModel property or UI element exists. Likely deprecated functionality.
|
|
|
|
---
|
|
|
|
## Migration Considerations
|
|
|
|
### UI Framework Changes
|
|
- Replace Kendo UI with MudBlazor or similar Blazor component library
|
|
- Replace Kendo Observable with Blazor component state
|
|
- Replace Kendo DataSource with standard .NET collections
|
|
- Replace Kendo Validator with Blazor EditForm validation
|
|
|
|
### File Handling
|
|
- Replace jQuery FileUpload with Blazor file upload (InputFile component)
|
|
- Keep EPPlus for Excel generation
|
|
- Consider streaming large files
|
|
|
|
### Real-Time Updates
|
|
- Replace legacy SignalR with ASP.NET Core SignalR
|
|
- Update hub connection patterns for Blazor
|
|
|
|
### API Structure
|
|
- Keep similar endpoint structure
|
|
- Update controllers for ASP.NET Core
|
|
- Consider REST API patterns with proper HTTP methods
|
|
|
|
### State Management
|
|
- Consider Fluxor or similar state management for complex form state
|
|
- Or use cascading parameters for simpler approach
|