# apiwat1229/ytrc-mrp-c- architecture

> Architecture diagram of the GitHub repository apiwat1229/ytrc-mrp-c-, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/apiwat1229/ytrc-mrp-c-
- Repository: https://github.com/apiwat1229/ytrc-mrp-c-

## Overview

YTRC-MRP Desktop is a Windows WPF client for YTRC ERP. A user signs in against the ERP API, then works through role-aware department and administration screens; supported workflows include SI export, device settings and truck-scale operations. The application also checks for updates and exports loaded data. The graph shows the documented layered boundaries and sampled runtime wiring; several department workflows are documented but their implementation details were not sampled, so their internal calls are not inferred.

Main entry points: [`src/YTRC.ERP.Wpf/Presentation/Shell/MainWindow.Navigation.cs`](https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Wpf/Presentation/Shell/MainWindow.Navigation.cs) (Role-aware navigation), [`src/YTRC.ERP.Wpf/App.xaml.cs`](https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Wpf/App.xaml.cs) (Startup composition), [`src/YTRC.ERP.Infrastructure/Api/ApiClient.cs`](https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Infrastructure/Api/ApiClient.cs) (ERP API client), [`src/YTRC.ERP.Wpf/Features/SIExport/SIExportPage.cs`](https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Wpf/Features/SIExport/SIExportPage.cs) (SI export workspace)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shell["Desktop shell"]
  node_app["Startup composition<br/>[App.xaml.cs]"]
  node_login["Sign-in window"]
  node_shellwindow["Workspace shell<br/>[MainWindow.xaml.cs]"]
  node_navigation["Role-aware navigation"]
end

subgraph group_workflows["ERP workflows"]
  node_dashboard["Dashboard<br/>[DashboardPage.cs]"]
  node_department["Department workspaces<br/>[Departments]"]
  node_booking["Booking queue"]
  node_marking["Marking preparation"]
  node_purchasing["Purchasing workflows<br/>[PurchasingPage.cs]"]
  node_siui["SI export workspace<br/>[SIExportPage.cs]"]
  node_sieditor["SI export editor"]
  node_si_history["SI export history"]
  node_settingsui["Administration settings<br/>[SettingsPages.cs]"]
  node_accounts["User accounts"]
  node_scaleui["Truck scale operations<br/>[TruckScalePage.cs]"]
  node_search["Search<br/>[SearchPage.cs]"]
end

subgraph group_application["Application and domain"]
  node_signin["Sign-in use case<br/>[SignInUseCase.cs]"]
  node_contracts["Application contracts<br/>[Services.cs]"]
  node_models["ERP domain models<br/>[ErpModels.cs]"]
  node_settings["Application settings<br/>[AppSettings.cs]"]
  node_serverurl["Server URL rules<br/>[ServerUrl.cs]"]
  node_si_models["SI export models<br/>[SIExportModels.cs]"]
  node_si_excel["SI Excel writer"]
  node_csv["CSV export"]
  node_mapper["API row mapper<br/>[ApiRowMapper.cs]"]
end

subgraph group_adapters["Infrastructure adapters"]
  node_api["ERP API client<br/>[ApiClient.cs]"]
  node_si_service["SI export API adapter<br/>[SIExportService.cs]"]
  node_store[("Local settings store")]
  node_scale["Serial scale adapter"]
  node_updates["Update service<br/>[UpdateService.cs]"]
end

node_user(("Desktop user"))
node_erp{{"YTRC ERP API"}}
node_serial{{"Serial scales"}}
node_updatehost{{"Update host"}}

node_user -->|"starts"| node_app
node_app -->|"loads settings"| node_store
node_app -->|"creates"| node_api
node_app -->|"creates"| node_signin
node_app -->|"creates"| node_scale
node_app -->|"creates"| node_updates
node_app -->|"opens"| node_login
node_app -->|"opens after login"| node_shellwindow
node_login -->|"requests sign-in"| node_signin
node_signin -->|"authenticates through"| node_api
node_api -->|"sends API requests"| node_erp
node_shellwindow -.->|"hosts navigation"| node_navigation
node_navigation -.->|"routes to"| node_dashboard
node_navigation -.->|"routes to"| node_department
node_navigation -.->|"routes to"| node_booking
node_navigation -.->|"routes to"| node_marking
node_navigation -.->|"routes to"| node_purchasing
node_navigation -.->|"routes to"| node_siui
node_navigation -.->|"routes to"| node_settingsui
node_navigation -.->|"routes to"| node_scaleui
node_navigation -.->|"routes to"| node_search
node_siui -->|"opens editor"| node_sieditor
node_siui -->|"opens history"| node_si_history
node_siui -.->|"requests SI data"| node_si_service
node_si_service -->|"calls API client"| node_api
node_si_service -->|"reads and writes SI"| node_erp
node_si_history -->|"exports workbook"| node_si_excel
node_siui -->|"exports workbook"| node_si_excel
node_scaleui -.->|"uses scale service"| node_scale
node_scale -->|"reads scale frames"| node_serial
node_app -->|"provides update service"| node_updates
node_updates -->|"checks and downloads"| node_updatehost
node_settingsui -.->|"persists preferences"| node_store
node_accounts -.->|"administrates accounts"| node_settingsui
node_csv -.->|"exports loaded data"| node_dashboard
node_api -->|"normalizes base URL"| node_serverurl
node_api -.->|"parses user profile"| node_models
node_mapper -.->|"maps API rows"| node_models

click node_app "https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Wpf/App.xaml.cs"
click node_login "https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Wpf/LoginWindow.xaml.cs"
click node_shellwindow "https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Wpf/MainWindow.xaml.cs"
click node_navigation "https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Wpf/Presentation/Shell/MainWindow.Navigation.cs"
click node_dashboard "https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Wpf/Features/Dashboard/DashboardPage.cs"
click node_department "https://github.com/apiwat1229/ytrc-mrp-c-/tree/main/src/YTRC.ERP.Wpf/Features/Departments"
click node_booking "https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Wpf/Features/Departments/BookingQueuePage.cs"
click node_marking "https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Wpf/Features/Departments/MarkingPreparationPage.cs"
click node_purchasing "https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Wpf/Features/Departments/PurchasingPage.cs"
click node_siui "https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Wpf/Features/SIExport/SIExportPage.cs"
click node_sieditor "https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Wpf/Features/SIExport/SIExportEditorWindow.cs"
click node_si_history "https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Wpf/Features/SIExport/SIExportHistoryWindow.cs"
click node_settingsui "https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Wpf/Features/Settings/SettingsPages.cs"
click node_accounts "https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Wpf/Features/Settings/UserAccountsPage.cs"
click node_scaleui "https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Wpf/Features/TruckScale/TruckScalePage.cs"
click node_search "https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Wpf/Features/Search/SearchPage.cs"
click node_signin "https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Application/Features/Authentication/SignInUseCase.cs"
click node_contracts "https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Application/Contracts/Services.cs"
click node_models "https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Domain/Models/ErpModels.cs"
click node_settings "https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Application/Configuration/AppSettings.cs"
click node_serverurl "https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Domain/Configuration/ServerUrl.cs"
click node_si_models "https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Application/Features/SIExport/SIExportModels.cs"
click node_si_excel "https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Application/Export/SIExportExcelWriter.cs"
click node_csv "https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Application/Export/CsvExportService.cs"
click node_mapper "https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Application/Mapping/ApiRowMapper.cs"
click node_api "https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Infrastructure/Api/ApiClient.cs"
click node_si_service "https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Infrastructure/Api/SIExportService.cs"
click node_store "https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Infrastructure/Configuration/AppSettingsStore.cs"
click node_scale "https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Infrastructure/Devices/HardwareScaleService.cs"
click node_updates "https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Infrastructure/Updates/UpdateService.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_login,node_shellwindow,node_navigation,node_user toneBlue
class node_dashboard,node_department,node_booking,node_marking,node_purchasing,node_siui,node_sieditor,node_si_history,node_settingsui,node_accounts,node_scaleui,node_search toneAmber
class node_signin,node_contracts,node_models,node_settings,node_serverurl,node_si_models,node_si_excel,node_csv,node_mapper,node_erp toneMint
class node_api,node_si_service,node_store,node_scale,node_updates toneRose
class node_serial,node_updatehost toneIndigo
```

## Components

### Desktop shell

- [Startup composition](https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Wpf/App.xaml.cs): `src/YTRC.ERP.Wpf/App.xaml.cs`
- [Sign-in window](https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Wpf/LoginWindow.xaml.cs): `src/YTRC.ERP.Wpf/LoginWindow.xaml.cs`
- [Workspace shell](https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Wpf/MainWindow.xaml.cs): `src/YTRC.ERP.Wpf/MainWindow.xaml.cs`
- [Role-aware navigation](https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Wpf/Presentation/Shell/MainWindow.Navigation.cs): `src/YTRC.ERP.Wpf/Presentation/Shell/MainWindow.Navigation.cs`

### ERP workflows

- [Dashboard](https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Wpf/Features/Dashboard/DashboardPage.cs): `src/YTRC.ERP.Wpf/Features/Dashboard/DashboardPage.cs`
- [Department workspaces](https://github.com/apiwat1229/ytrc-mrp-c-/tree/main/src/YTRC.ERP.Wpf/Features/Departments): `src/YTRC.ERP.Wpf/Features/Departments`
- [Booking queue](https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Wpf/Features/Departments/BookingQueuePage.cs): `src/YTRC.ERP.Wpf/Features/Departments/BookingQueuePage.cs`
- [Marking preparation](https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Wpf/Features/Departments/MarkingPreparationPage.cs): `src/YTRC.ERP.Wpf/Features/Departments/MarkingPreparationPage.cs`
- [Purchasing workflows](https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Wpf/Features/Departments/PurchasingPage.cs): `src/YTRC.ERP.Wpf/Features/Departments/PurchasingPage.cs`
- [SI export workspace](https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Wpf/Features/SIExport/SIExportPage.cs): `src/YTRC.ERP.Wpf/Features/SIExport/SIExportPage.cs`
- [SI export editor](https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Wpf/Features/SIExport/SIExportEditorWindow.cs): `src/YTRC.ERP.Wpf/Features/SIExport/SIExportEditorWindow.cs`
- [SI export history](https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Wpf/Features/SIExport/SIExportHistoryWindow.cs): `src/YTRC.ERP.Wpf/Features/SIExport/SIExportHistoryWindow.cs`
- [Administration settings](https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Wpf/Features/Settings/SettingsPages.cs): `src/YTRC.ERP.Wpf/Features/Settings/SettingsPages.cs`
- [User accounts](https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Wpf/Features/Settings/UserAccountsPage.cs): `src/YTRC.ERP.Wpf/Features/Settings/UserAccountsPage.cs`
- [Truck scale operations](https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Wpf/Features/TruckScale/TruckScalePage.cs): `src/YTRC.ERP.Wpf/Features/TruckScale/TruckScalePage.cs`
- [Search](https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Wpf/Features/Search/SearchPage.cs): `src/YTRC.ERP.Wpf/Features/Search/SearchPage.cs`

### Application and domain

- [Sign-in use case](https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Application/Features/Authentication/SignInUseCase.cs): `src/YTRC.ERP.Application/Features/Authentication/SignInUseCase.cs`
- [Application contracts](https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Application/Contracts/Services.cs): `src/YTRC.ERP.Application/Contracts/Services.cs`
- [ERP domain models](https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Domain/Models/ErpModels.cs): `src/YTRC.ERP.Domain/Models/ErpModels.cs`
- [Application settings](https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Application/Configuration/AppSettings.cs): `src/YTRC.ERP.Application/Configuration/AppSettings.cs`
- [Server URL rules](https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Domain/Configuration/ServerUrl.cs): `src/YTRC.ERP.Domain/Configuration/ServerUrl.cs`
- [SI export models](https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Application/Features/SIExport/SIExportModels.cs): `src/YTRC.ERP.Application/Features/SIExport/SIExportModels.cs`
- [SI Excel writer](https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Application/Export/SIExportExcelWriter.cs): `src/YTRC.ERP.Application/Export/SIExportExcelWriter.cs`
- [CSV export](https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Application/Export/CsvExportService.cs): `src/YTRC.ERP.Application/Export/CsvExportService.cs`
- [API row mapper](https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Application/Mapping/ApiRowMapper.cs): `src/YTRC.ERP.Application/Mapping/ApiRowMapper.cs`

### Infrastructure adapters

- [ERP API client](https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Infrastructure/Api/ApiClient.cs): `src/YTRC.ERP.Infrastructure/Api/ApiClient.cs`
- [SI export API adapter](https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Infrastructure/Api/SIExportService.cs): `src/YTRC.ERP.Infrastructure/Api/SIExportService.cs`
- [Local settings store](https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Infrastructure/Configuration/AppSettingsStore.cs): `src/YTRC.ERP.Infrastructure/Configuration/AppSettingsStore.cs`
- [Serial scale adapter](https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Infrastructure/Devices/HardwareScaleService.cs): `src/YTRC.ERP.Infrastructure/Devices/HardwareScaleService.cs`
- [Update service](https://github.com/apiwat1229/ytrc-mrp-c-/blob/main/src/YTRC.ERP.Infrastructure/Updates/UpdateService.cs): `src/YTRC.ERP.Infrastructure/Updates/UpdateService.cs`

### Other components

- **Desktop user**
- **YTRC ERP API**
- **Serial scales**
- **Update host**

## Connections

- Desktop user → Startup composition: starts (evidence: `README.md`)
- Startup composition → Local settings store: loads settings (evidence: `src/YTRC.ERP.Wpf/App.xaml.cs`)
- Startup composition → ERP API client: creates (evidence: `src/YTRC.ERP.Wpf/App.xaml.cs`)
- Startup composition → Sign-in use case: creates (evidence: `src/YTRC.ERP.Wpf/App.xaml.cs`)
- Startup composition → Serial scale adapter: creates (evidence: `src/YTRC.ERP.Wpf/App.xaml.cs`)
- Startup composition → Update service: creates (evidence: `src/YTRC.ERP.Wpf/App.xaml.cs`)
- Startup composition → Sign-in window: opens (evidence: `src/YTRC.ERP.Wpf/App.xaml.cs`)
- Startup composition → Workspace shell: opens after login (evidence: `src/YTRC.ERP.Wpf/App.xaml.cs`)
- Sign-in window → Sign-in use case: requests sign-in (evidence: `src/YTRC.ERP.Wpf/LoginWindow.xaml.cs`)
- Sign-in use case → ERP API client: authenticates through (evidence: `src/YTRC.ERP.Wpf/App.xaml.cs`)
- ERP API client → YTRC ERP API: sends API requests (evidence: `src/YTRC.ERP.Infrastructure/Api/ApiClient.cs`)
- Workspace shell → Role-aware navigation: hosts navigation
- Role-aware navigation → Dashboard: routes to
- Role-aware navigation → Department workspaces: routes to
- Role-aware navigation → Booking queue: routes to
- Role-aware navigation → Marking preparation: routes to
- Role-aware navigation → Purchasing workflows: routes to
- Role-aware navigation → SI export workspace: routes to
- Role-aware navigation → Administration settings: routes to
- Role-aware navigation → Truck scale operations: routes to
- Role-aware navigation → Search: routes to
- SI export workspace → SI export editor: opens editor (evidence: `src/YTRC.ERP.Wpf/Features/SIExport/SIExportPage.cs`)
- SI export workspace → SI export history: opens history (evidence: `src/YTRC.ERP.Wpf/Features/SIExport/SIExportPage.cs`)
- SI export workspace → SI export API adapter: requests SI data (evidence: `src/YTRC.ERP.Infrastructure/Api/SIExportService.cs`)
- SI export API adapter → ERP API client: calls API client (evidence: `src/YTRC.ERP.Infrastructure/Api/SIExportService.cs`)
- SI export API adapter → YTRC ERP API: reads and writes SI (evidence: `src/YTRC.ERP.Infrastructure/Api/SIExportService.cs`)
- SI export history → SI Excel writer: exports workbook (evidence: `src/YTRC.ERP.Wpf/Features/SIExport/SIExportHistoryWindow.cs`)
- SI export workspace → SI Excel writer: exports workbook (evidence: `src/YTRC.ERP.Wpf/Features/SIExport/SIExportPage.cs`)
- Truck scale operations → Serial scale adapter: uses scale service
- Serial scale adapter → Serial scales: reads scale frames (evidence: `src/YTRC.ERP.Infrastructure/Devices/HardwareScaleService.cs`)
- Startup composition → Update service: provides update service (evidence: `src/YTRC.ERP.Wpf/App.xaml.cs`)
- Update service → Update host: checks and downloads (evidence: `src/YTRC.ERP.Infrastructure/Updates/UpdateService.cs`)
- Administration settings → Local settings store: persists preferences
- User accounts → Administration settings: administrates accounts
- CSV export → Dashboard: exports loaded data (evidence: `README.md`)
- ERP API client → Server URL rules: normalizes base URL (evidence: `src/YTRC.ERP.Infrastructure/Api/ApiClient.cs`)
- ERP API client → ERP domain models: parses user profile
- API row mapper → ERP domain models: maps API rows
