diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 00000000..1b770d4f --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,27 @@ +# FruitBankHybridApp — Domain Rules + +> This is the **single source of truth** for domain rules. Do not duplicate these elsewhere. +> For detailed docs see: `README.md` → `docs/` + +## Business Domain +1. **FruitBank** = fruit & vegetable wholesaler. This is a **nopCommerce plugin** — Customer, Order, Product, GenericAttribute are nopCommerce entities. +2. **Shipping** = INBOUND delivery (supplier → warehouse). **Order** = OUTBOUND delivery (warehouse → customer). Never confuse the two directions. +3. **"Pallet"** (`XxxItemPallet`) = a **measurement record**, NOT a physical pallet. Always created for every item, even non-measurable ones. + +## Measurement Logic +4. **IsMeasurable=false** → weights are 0.0, only `TrayQuantity` is recorded. A Pallet record is still created. +5. **NetWeight = GrossWeight − PalletWeight − (TrayQuantity × TareWeight)** — this formula is universal across ShippingItemPallet, OrderItemPallet, and StockTakingItemPallet. +6. **MeasuringStatus.Finnished** — intentional legacy typo with double-n. Do NOT fix the spelling. +7. **MeasuringStatus** progression: NotStarted(0) → Started(10) → Finnished(20) → Audited(30). OrderItemPallet adds Audited when RevisorId > 0. + +## Data Model +8. **GenericAttribute** = polymorphic key-value store. `KeyGroup` = owner type name, `EntityId` = owner ID. ProductDto reads IsMeasurable, Tare, AverageWeight, IncomingQuantity, NetWeight from GenericAttributes. +9. **Three parallel measurement hierarchies** share the same base (`MeasuringItemPalletBase`): + - Shipping: ShippingItem → ShippingItemPallet + - Order: OrderItemDto → OrderItemPallet (adds RevisorId for audit) + - StockTaking: StockTakingItem → StockTakingItemPallet + +## Technical +10. SignalR uses **AcBinaryHubProtocol** (custom binary), not default JSON. +11. Do not suggest removal/rollback as a solution — find a fix for the problem. +12. All AyCode references are via **DLL** (not ProjectReference) — this is intentional. diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 00000000..e6d5c9f5 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,11 @@ +# FruitBankHybridApp — Claude Code Instructions + +Before writing any code, read these files: +1. `.github/copilot-instructions.md` — Domain rules and critical pitfalls (single source of truth) +2. `docs/GLOSSARY.md` — Domain terms, measurement logic, and common traps +3. `docs/SCHEMA.md` — Full domain model in Toon format +4. The relevant project's `README.md` for folder-specific context + +This solution depends on **AyCode.Core** and **AyCode.Blazor** frameworks. + +When modifying code, update the corresponding README.md if it becomes out of sync with the code. diff --git a/FruitBank.Common.Server/Interfaces/README.md b/FruitBank.Common.Server/Interfaces/README.md new file mode 100644 index 00000000..a833e99d --- /dev/null +++ b/FruitBank.Common.Server/Interfaces/README.md @@ -0,0 +1,13 @@ +# Interfaces + +Server-side marker interfaces extending the shared Common interfaces. Used for DI registration and type safety. + +## Key Files + +- **`IFruitBankDataControllerServer.cs`** — Extends IFruitBankDataControllerCommon. Empty server marker. +- **`ICustomOrderSignalREndpointServer.cs`** — Extends ICustomOrderSignalREndpointCommon. Empty server marker. +- **`IStockSignalREndpointServer.cs`** — Extends IStockSignalREndpointCommon. Empty server marker. + +--- + +> **LLM Maintenance:** If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code. diff --git a/FruitBank.Common.Server/README.md b/FruitBank.Common.Server/README.md new file mode 100644 index 00000000..dc242989 --- /dev/null +++ b/FruitBank.Common.Server/README.md @@ -0,0 +1,24 @@ +# FruitBank.Common.Server + +Server-side library: SignalR hubs, real-time broadcast service, logging infrastructure, and nopCommerce integration constants. + +## Folder Structure + +| Folder | Purpose | +|---|---| +| [`Interfaces/`](Interfaces/README.md) | Server-side endpoint marker interfaces | +| [`Services/`](Services/README.md) | SignalR hubs, broadcast service, logging | + +## Key Files (Root) + +- **`FruitBankConst.cs`** — Server constants: project GUID, role system names ("Measuring", "MeasuringRevisor"), product attribute "IsMeasurable", project salt. + +## Dependencies + +- nopCommerce via Mango.Nop.Core +- AyCode.Core, AyCode.Services.Server (DLL references) +- Microsoft.AspNetCore.SignalR + +--- + +> **LLM Maintenance:** If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code. diff --git a/FruitBank.Common.Server/Services/Loggers/README.md b/FruitBank.Common.Server/Services/Loggers/README.md new file mode 100644 index 00000000..f11701dd --- /dev/null +++ b/FruitBank.Common.Server/Services/Loggers/README.md @@ -0,0 +1,12 @@ +# Loggers + +Server-side logging implementations. + +## Key Files + +- **`ConsoleLogWriter.cs`** — Lightweight console logger extending AcConsoleLogWriter. Configurable by AppType, LogLevel, category. +- **`LoggerToLoggerApiController.cs`** — Aggregates multiple IAcLogWriterBase implementations into a single logger for API controllers. + +--- + +> **LLM Maintenance:** If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code. diff --git a/FruitBank.Common.Server/Services/README.md b/FruitBank.Common.Server/Services/README.md new file mode 100644 index 00000000..d36617e5 --- /dev/null +++ b/FruitBank.Common.Server/Services/README.md @@ -0,0 +1,14 @@ +# Services + +Server-side SignalR hubs, real-time broadcast, and logging infrastructure. + +## Subfolders + +| Folder | Purpose | +|---|---| +| [`Loggers/`](Loggers/README.md) | Console and API controller log writers | +| [`SignalRs/`](SignalRs/README.md) | SignalR hubs and broadcast service | + +--- + +> **LLM Maintenance:** If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code. diff --git a/FruitBank.Common.Server/Services/SignalRs/README.md b/FruitBank.Common.Server/Services/SignalRs/README.md new file mode 100644 index 00000000..59c46b63 --- /dev/null +++ b/FruitBank.Common.Server/Services/SignalRs/README.md @@ -0,0 +1,14 @@ +# SignalRs + +SignalR hub implementations and real-time broadcast service. + +## Key Files + +- **`DevAdminSignalRHub.cs`** — Main admin hub. Dependencies: IConfiguration, IFruitBankDataControllerServer, ICustomOrderSignalREndpointServer, IStockSignalREndpointServer. Registers all three endpoint interfaces with DynamicMethodRegistry. Uses AcBinary serialization. +- **`AcWebSignalRHubWithSessionBase.cs`** — Generic base hub with session management (OnConnected/OnDisconnected hooks). +- **`SignalRSendToClientService.cs`** — Broadcasts real-time notifications to all clients: SendOrderChanged, SendOrderItemChanged, SendShippingChanged, SendProductChanged, etc. +- **`LoggerSignalRHub.cs`** — Minimal hub for logging/diagnostics. + +--- + +> **LLM Maintenance:** If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code. diff --git a/FruitBank.Common/Databases/README.md b/FruitBank.Common/Databases/README.md new file mode 100644 index 00000000..0a9f108b --- /dev/null +++ b/FruitBank.Common/Databases/README.md @@ -0,0 +1,11 @@ +# Databases + +Local in-memory database abstraction for offline/cached data using ConcurrentDictionary. + +## Key Files + +- **`DatabaseLocalBase.cs`** — Abstract base with generic table management for IEntityInt entities. Thread-safe AddTable, GetRows, GetRow, AddRow, AddRows, DeleteRow. + +--- + +> **LLM Maintenance:** If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code. diff --git a/FruitBank.Common/Dtos/README.md b/FruitBank.Common/Dtos/README.md new file mode 100644 index 00000000..894cbf43 --- /dev/null +++ b/FruitBank.Common/Dtos/README.md @@ -0,0 +1,19 @@ +# Dtos + +Binary-serializable DTOs for efficient SignalR communication. All marked with `[AcBinarySerializable]`. + +## Key Files + +- **`OrderDto.cs`** — Order with items, measurement status, auditing, receipt date, GenericAttributes. Computed: IsMeasured, IsComplete, MeasuringStatus, RevisorId. +- **`OrderItemDto.cs`** — Order line item with OrderItemPallet collection. Computed: NetWeight, GrossWeight, AverageWeight, AverageWeightIsValid, IsMeasured, IsAudited. +- **`ProductDto.cs`** — Product with GenericAttribute-backed properties: IsMeasurable, Tare, AverageWeight, AverageWeightTreshold, IncomingQuantity, NetWeight. +- **`StockQuantityHistoryDto.cs`** — Stock history with net weight adjustments and inconsistency detection. +- **`GenericAttributeDto.cs`** — Key-value attribute wrapper. Polymorphic: KeyGroup = owner type, EntityId = owner ID. + +## Why DTOs Exist + +nopCommerce entities (Order, OrderItem, Product) are extended with measurement logic via these DTOs. The DTOs add computed properties and GenericAttribute access that the raw nopCommerce entities don't have. + +--- + +> **LLM Maintenance:** If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code. diff --git a/FruitBank.Common/Entities/README.md b/FruitBank.Common/Entities/README.md new file mode 100644 index 00000000..408db657 --- /dev/null +++ b/FruitBank.Common/Entities/README.md @@ -0,0 +1,37 @@ +# Entities + +Domain entities for inbound/outbound goods tracking and inventory. All map to `fb`-prefixed database tables. + +## Shipping (Inbound) + +- **`Shipping.cs`** — Physical delivery event (truck arrival). Table: `fbShipping`. +- **`ShippingDocument.cs`** — Supplier delivery note/invoice. Table: `fbShippingDocument`. +- **`ShippingItem.cs`** — Product line on document with declared vs measured discrepancies. Table: `fbShippingItem`. +- **`ShippingItemPallet.cs`** — Measurement record for incoming goods. Table: `fbShippingItemPallet`. +- **`ShippingDocumentToFiles.cs`** — Many-to-many link: document ↔ file with DocumentType. Table: `fbShippingDocumentToFiles`. +- **`Partner.cs`** — External supplier with address and tax info. Table: `fbPartner`. + +## Order (Outbound) + +- **`OrderItemPallet.cs`** — Measurement record for outgoing goods with RevisorId for audit. Table: `fbOrderItemPallet`. + +## Inventory + +- **`StockTaking.cs`** — Inventory session record. Table: `fbStockTaking`. +- **`StockTakingItem.cs`** — Line item reconciling snapshot vs measured quantities. Table: `fbStockTakingItem`. +- **`StockTakingItemPallet.cs`** — Measurement record for inventory. Table: `fbStockTakingItemPallet`. +- **`StockQuantityHistoryExt.cs`** — Extended weight metadata for stock reconciliation. + +## Shared + +- **`MeasuringItemPalletBase.cs`** — Abstract base for all three measurement hierarchies. Defines NetWeight formula, validation methods, CreatorId/ModifierId tracking. +- **`Pallet.cs`** — Physical pallet type definition (name, size, weight). Table: `fbPallet`. +- **`Files.cs`** — Uploaded file with OCR-extracted RawText. Table: `fbFiles`. + +## Critical: "Pallet" Naming + +Despite the name, `XxxItemPallet` entities are **measurement records**, NOT physical pallets. They are ALWAYS created for every item. For non-measurable products, weights = 0.0 and only TrayQuantity is tracked. + +--- + +> **LLM Maintenance:** If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code. diff --git a/FruitBank.Common/Enums/README.md b/FruitBank.Common/Enums/README.md new file mode 100644 index 00000000..a1fed4cb --- /dev/null +++ b/FruitBank.Common/Enums/README.md @@ -0,0 +1,11 @@ +# Enums + +Core enumeration types for measurement and document classification. + +## Key Files + +- **`MeasuringStatus.cs`** — NotStarted(0) → Started(10) → **Finnished**(20) → Audited(30). Note: "Finnished" is an intentional legacy typo — do NOT fix. + +--- + +> **LLM Maintenance:** If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code. diff --git a/FruitBank.Common/Helpers/README.md b/FruitBank.Common/Helpers/README.md new file mode 100644 index 00000000..a3b15bfc --- /dev/null +++ b/FruitBank.Common/Helpers/README.md @@ -0,0 +1,13 @@ +# Helpers + +Measurement aggregation utilities. + +## Key Files + +- **`MeasuringValuesHelper.cs`** — Static helper for rolling up pallet-level measurements to shipping item level. + - `SetShippingItemTotalMeasuringValues()` — Sums quantities and weights from all pallets. + - `GetTotalNetAndGrossWeightFromPallets()` — Returns (Quantity, NetWeight, GrossWeight) tuple. + +--- + +> **LLM Maintenance:** If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code. diff --git a/FruitBank.Common/Interfaces/README.md b/FruitBank.Common/Interfaces/README.md new file mode 100644 index 00000000..a6fc2c63 --- /dev/null +++ b/FruitBank.Common/Interfaces/README.md @@ -0,0 +1,33 @@ +# Interfaces + +SignalR endpoint contracts, measurement composition traits, and entity interfaces. + +## SignalR Endpoints + +- **`IFruitBankDataControllerCommon.cs`** / **`Client.cs`** — Core CRUD: Partners, Shipping, ShippingDocuments, ShippingItems, ShippingItemPallets, Products, Customers, GenericAttributes. +- **`ICustomOrderSignalREndpointCommon.cs`** / **`Client.cs`** — Order operations: GetAllOrderDtos, GetPendingOrderDtos, OrderItem/Pallet management, StartMeasuring, SetOrderStatusToComplete. +- **`IStockSignalREndpointCommon.cs`** / **`Client.cs`** — Inventory: StockTaking, StockTakingItem, StockTakingItemPallet CRUD, CloseStockTaking. + +## Measurement Traits (Composition Pattern) + +- **`IMeasuringValues`** = IMeasuringWeights + IMeasuringQuantity +- **`IMeasuringWeights`** = IMeasuringNetWeight + IMeasuringGrossWeight +- **`IMeasurable`** — IsMeasurable flag +- **`IMeasured`** — IsMeasured flag +- **`IMeasurableStatus`** — MeasuringStatus property +- **`IMeasuringItemPalletBase`** — Full measurement contract with validation + +## Entity & DTO Interfaces + +- **`IPallet`**, **`IPartner`**, **`IShipping`**, **`IShippingDocument`**, **`IShippingItem`**, **`IShippingItemPallet`**, **`IFiles`** +- **`IOrderDto`**, **`IOrderItemDto`**, **`IProductDto`**, **`IStockQuantityHistoryDto`** +- **`ITare`**, **`IAvailableQuantity`**, **`IIncomingQuantity`** — Quantity/weight property interfaces + +## Service Interfaces + +- **`IMeasurementServiceBase`** — Base service marker +- **`ISecureCredentialService`** — Save/retrieve/clear credentials with 2-day expiration + +--- + +> **LLM Maintenance:** If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code. diff --git a/FruitBank.Common/Loggers/README.md b/FruitBank.Common/Loggers/README.md new file mode 100644 index 00000000..c602f14e --- /dev/null +++ b/FruitBank.Common/Loggers/README.md @@ -0,0 +1,11 @@ +# Loggers + +SignalR client-to-server log writer. + +## Key Files + +- **`SignaRClientLogItemWriter.cs`** — Routes client logs to `{BaseUrl}/loggerHub` via SignalR. Configurable by AppType and LogLevel. + +--- + +> **LLM Maintenance:** If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code. diff --git a/FruitBank.Common/Models/README.md b/FruitBank.Common/Models/README.md new file mode 100644 index 00000000..51dbabf2 --- /dev/null +++ b/FruitBank.Common/Models/README.md @@ -0,0 +1,17 @@ +# Models + +Application and view models for UI state management. + +## Key Files + +- **`LoggedInModel.cs`** — Authentication state: IsLoggedIn, IsRevisor, IsAdministrator, IsDeveloper. Auto-login from stored credentials (2-day expiration). Customer and role management. +- **`MeasuringAttributeValues.cs`** — IMeasuringAttributeValues implementation: Id, NetWeight, IsMeasurable, HasMeasuringValues(). +- **`MeasuringModel.cs`** — ViewModel aggregating Shipping + Partners + ShippingItems + ShippingDocuments. + +## Subfolders + +- **`SignalRs/SignalRMessageToClientWithText.cs`** — Generic message wrapper with optional text and typed content. + +--- + +> **LLM Maintenance:** If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code. diff --git a/FruitBank.Common/README.md b/FruitBank.Common/README.md new file mode 100644 index 00000000..17382442 --- /dev/null +++ b/FruitBank.Common/README.md @@ -0,0 +1,34 @@ +# FruitBank.Common + +Shared domain library for the FruitBank nopCommerce plugin. Contains entities, DTOs, interfaces, measurement helpers, SignalR tags, and constants for fruit & vegetable wholesale operations. + +## Folder Structure + +| Folder | Purpose | +|---|---| +| [`Databases/`](Databases/README.md) | Local in-memory database abstraction for offline/cached data | +| [`Dtos/`](Dtos/README.md) | Binary-serializable DTOs for Order, OrderItem, Product, StockQuantityHistory | +| [`Entities/`](Entities/README.md) | Domain entities: Shipping, Partner, measurement pallets, inventory | +| [`Enums/`](Enums/README.md) | MeasuringStatus and DocumentType enums | +| [`Helpers/`](Helpers/README.md) | Measurement aggregation utilities | +| [`Interfaces/`](Interfaces/README.md) | SignalR endpoint contracts, measurement traits, entity interfaces | +| [`Loggers/`](Loggers/README.md) | SignalR client log writer | +| [`Models/`](Models/README.md) | Authentication state, measurement view models | +| [`Services/`](Services/README.md) | Measurement service base, credential persistence | +| [`SignalRs/`](SignalRs/README.md) | SignalR method tags (numeric constants) | + +## Key Files (Root) + +- **`FruitBankConstClient.cs`** — Global constants: BaseUrl, SignalR hubs, database table names, email templates, system settings. +- **`DocumentType.cs`** — Enum: ShippingDocument, OrderConfirmation, Invoice. + +## Key Domain Concepts + +- **Shipping = INBOUND** (supplier → warehouse), **Order = OUTBOUND** (warehouse → customer) +- **"Pallet" = measurement record**, always created even for non-measurable products +- **NetWeight = GrossWeight − PalletWeight − (TrayQuantity × TareWeight)** +- See [`docs/GLOSSARY.md`](../docs/GLOSSARY.md) for full terminology + +--- + +> **LLM Maintenance:** If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code. diff --git a/FruitBank.Common/Services/README.md b/FruitBank.Common/Services/README.md new file mode 100644 index 00000000..1b02cd23 --- /dev/null +++ b/FruitBank.Common/Services/README.md @@ -0,0 +1,14 @@ +# Services + +Business logic services and credential management. + +## Key Files + +- **`MeasurementServiceBase.cs`** — Abstract base with generic TLogger injection. +- **`ISecureCredentialService.cs`** — Interface: SaveCredentialsAsync (2-day expiry), GetCredentialsAsync, ClearCredentialsAsync. StoredCredentials sealed record. + +Platform implementations: MAUI → SecureStorage, Web → obfuscated localStorage, Server → no-op. + +--- + +> **LLM Maintenance:** If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code. diff --git a/FruitBank.Common/SignalRs/README.md b/FruitBank.Common/SignalRs/README.md new file mode 100644 index 00000000..3a3095fb --- /dev/null +++ b/FruitBank.Common/SignalRs/README.md @@ -0,0 +1,23 @@ +# SignalRs + +SignalR method identifiers as numeric constants for type-safe client-server communication. + +## Key Files + +- **`SignalRTags.cs`** — Constant int tags organized by domain: + - **0-10:** System (GetMeasuringModels) + - **20-27:** Partner CRUD + - **40-66:** Shipping, ShippingDocument, ShippingItem + - **70-83:** Customer, Product + - **94-98:** ShippingItemPallet + - **111-138:** Order (OrderDto, OrderItemDto, OrderItemPallet) + - **150-151:** StockQuantityHistory + - **160-169:** GenericAttribute + - **170-179:** StockTaking + - **195-200:** Authentication + - **500+:** Server→client notifications (SendOrderChanged, SendShippingChanged, etc.) + - **1000+:** Diagnostic/Logging + +--- + +> **LLM Maintenance:** If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code. diff --git a/FruitBankHybrid.Shared.Common/README.md b/FruitBankHybrid.Shared.Common/README.md new file mode 100644 index 00000000..424dac53 --- /dev/null +++ b/FruitBankHybrid.Shared.Common/README.md @@ -0,0 +1,7 @@ +# FruitBankHybrid.Shared.Common + +Shared common library. Currently a placeholder — no source files yet. .NET 10.0 with AOT enabled. + +--- + +> **LLM Maintenance:** If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code. diff --git a/FruitBankHybrid.Shared.Tests/README.md b/FruitBankHybrid.Shared.Tests/README.md new file mode 100644 index 00000000..30322629 --- /dev/null +++ b/FruitBankHybrid.Shared.Tests/README.md @@ -0,0 +1,25 @@ +# FruitBankHybrid.Shared.Tests + +MSTest integration and serialization tests. Covers SignalR client operations, JSON reference handling, binary serialization, Toon format, and bunit component rendering. + +## Folder Structure + +| Folder | Purpose | +|---|---| +| [`TestData/`](TestData/README.md) | Test models for Toon serialization | + +## Key Files + +- **`MSTestSettings.cs`** — Parallel test execution at MethodLevel. +- **`FruitBankClientTests.cs`** — (~667 lines) Full SignalR integration: Partner, Shipping, ShippingItem, ShippingDocument, Customer, Product, Order, Login tests. Localhost-only safety check. +- **`OrderClientTests.cs`** — Order and StockTaking retrieval/manipulation tests. +- **`JsonExtensionTests.cs`** — (~715 lines) JSON $id/$ref reference handling, 5-level hierarchies, circular references, DeepPopulateWithMerge. +- **`StockTakingSerializerTests.cs`** — Binary serialization round-trips, null collection handling, binary format analysis. +- **`ToonTests.cs`** — (~465 lines) Toon format: metadata generation, reference markers, type uniqueness, navigation metadata, property descriptions. +- **`SandboxEndpointSimpleTests.cs`** — Endpoint connectivity and SignalR negotiate tests. +- **`GridPartnerBaseTests.cs`** — Grid component tests (disabled). +- **`GridPartnerRazorTests.cs`** — bunit Blazor rendering tests (disabled). + +--- + +> **LLM Maintenance:** If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code. diff --git a/FruitBankHybrid.Shared.Tests/TestData/README.md b/FruitBankHybrid.Shared.Tests/TestData/README.md new file mode 100644 index 00000000..34646156 --- /dev/null +++ b/FruitBankHybrid.Shared.Tests/TestData/README.md @@ -0,0 +1,11 @@ +# TestData + +Demo models for Toon serialization testing. + +## Key Files + +- **`ToonTestData.cs`** — TestOrder, TestCustomer, TestOrderItem, TestProduct models with one-to-many relationships and back-references for testing complex object graph serialization. + +--- + +> **LLM Maintenance:** If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code. diff --git a/FruitBankHybrid.Shared/Components/Grids/README.md b/FruitBankHybrid.Shared/Components/Grids/README.md new file mode 100644 index 00000000..ecc510f3 --- /dev/null +++ b/FruitBankHybrid.Shared/Components/Grids/README.md @@ -0,0 +1,20 @@ +# Grids + +Domain-specific DevExpress grid components, one per entity type. All extend MgGridBase for layout persistence. + +## Subfolders + +| Folder | Entity | +|---|---| +| `GenericAttributes/` | GridGenericAttributeBase — context-based attribute grids | +| `OrderItems/` | GridOrderItem — order item grid (partial) | +| `Partners/` | GridPartnerBase — partner grid with SignalR | +| `Products/` | GridStockQuantityHistoryDtoBase — stock history visualization | +| `ShippingDocuments/` | GridShippingDocumentBase — shipping document management | +| `ShippingItems/` | GridShippingItemBase — shipping item detail with context awareness | +| `Shippings/` | GridShippingBase — master shipping grid | +| `StockTakingItems/` | GridStockTakingItemBase — stock taking item grid | + +--- + +> **LLM Maintenance:** If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code. diff --git a/FruitBankHybrid.Shared/Components/README.md b/FruitBankHybrid.Shared/Components/README.md new file mode 100644 index 00000000..3fda9c99 --- /dev/null +++ b/FruitBankHybrid.Shared/Components/README.md @@ -0,0 +1,22 @@ +# Components + +DevExpress Blazor grid wrappers, pallet measurement components, and toast notifications. + +## Key Files (Root) + +- **`MgGridBase.cs`** — Base class for all DevExpress grids with layout persistence via localStorage. +- **`GridProductDto.cs`** — Product data grid component. +- **`OrderNotificationToast.razor`** — Toast notification for order updates. +- **Pallet components** — PalletItemComponent.razor, GridShippingItemPallets.razor, GridDetailOrderItemPallets.razor. + +## Subfolders + +| Folder | Purpose | +|---|---| +| [`Grids/`](Grids/README.md) | Domain-specific grid components by entity type | +| [`FileUploads/`](FileUploads/README.md) | File upload components | +| [`StockTakings/`](StockTakings/README.md) | Stock taking UI components | + +--- + +> **LLM Maintenance:** If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code. diff --git a/FruitBankHybrid.Shared/Databases/README.md b/FruitBankHybrid.Shared/Databases/README.md new file mode 100644 index 00000000..9b9b2958 --- /dev/null +++ b/FruitBankHybrid.Shared/Databases/README.md @@ -0,0 +1,11 @@ +# Databases + +Client-side in-memory table cache using ConcurrentDictionary for offline/fast data access. + +## Key Files + +- **`DatabaseClient.cs`** — (~250 lines) Local client-side database with typed tables (Shipping, ShippingDocument, ShippingItem, etc.). ProductDtoTable and OrderDtoTable with semaphore-based async loading. DatabaseTableBase generic base. ObjectLock for thread-safe type-based locking. LoadingPanelVisibility global flag. + +--- + +> **LLM Maintenance:** If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code. diff --git a/FruitBankHybrid.Shared/Extensions/README.md b/FruitBankHybrid.Shared/Extensions/README.md new file mode 100644 index 00000000..f3fce043 --- /dev/null +++ b/FruitBankHybrid.Shared/Extensions/README.md @@ -0,0 +1,11 @@ +# Extensions + +DevExpress dialog helper extensions. + +## Key Files + +- **`DevexpressComponentExtensions.cs`** — ShowMessageBoxAsync() and ShowConfirmBoxAsync() for DevExpress dialogs. + +--- + +> **LLM Maintenance:** If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code. diff --git a/FruitBankHybrid.Shared/Layout/README.md b/FruitBankHybrid.Shared/Layout/README.md new file mode 100644 index 00000000..111d6bc9 --- /dev/null +++ b/FruitBankHybrid.Shared/Layout/README.md @@ -0,0 +1,13 @@ +# Layout + +Application shell: root layout, navigation menu, auto-login, and toast notifications. + +## Key Files + +- **`MainLayout.razor`** — Root layout with navigation menu. +- **`MainLayout.razor.cs`** — SignalR message handling, auto-login on first render, toast notification for orders, login/logout handling, navigation guards. +- **`NavMenu.razor`** — Navigation component. + +--- + +> **LLM Maintenance:** If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code. diff --git a/FruitBankHybrid.Shared/Models/README.md b/FruitBankHybrid.Shared/Models/README.md new file mode 100644 index 00000000..b38a0b30 --- /dev/null +++ b/FruitBankHybrid.Shared/Models/README.md @@ -0,0 +1,11 @@ +# Models + +View models for measuring pages. + +## Key Files + +- **`MeasuringDateSelectorModel.cs`** — Date picker model: ShippingId, DateTime, IsMeasured flag. + +--- + +> **LLM Maintenance:** If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code. diff --git a/FruitBankHybrid.Shared/Pages/README.md b/FruitBankHybrid.Shared/Pages/README.md new file mode 100644 index 00000000..c41f2eae --- /dev/null +++ b/FruitBankHybrid.Shared/Pages/README.md @@ -0,0 +1,17 @@ +# Pages + +Routed Blazor pages for the FruitBank application. + +## Key Files + +- **`Home.razor.cs`** — Landing page showing form factor and platform. +- **`Login.razor.cs`** — Authentication with user selection and password validation. +- **`ShippingsAdmin.razor.cs`** — Inbound shipping management with tabbed interface. +- **`OrdersAdmin.razor.cs`** — Outbound order management with product and order item tabs. +- **`MeasuringIn.razor.cs`** — Shipping measurement: calendar date picker, item detail, pallet recording. +- **`MeasuringOut.razor.cs`** — Order measurement/audit: measurement tracking, approval workflow, RevisorId assignment. +- **`StockTaking.razor.cs`** — Inventory management: stock taking sessions, item reconciliation. + +--- + +> **LLM Maintenance:** If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code. diff --git a/FruitBankHybrid.Shared/README.md b/FruitBankHybrid.Shared/README.md new file mode 100644 index 00000000..2d2f5984 --- /dev/null +++ b/FruitBankHybrid.Shared/README.md @@ -0,0 +1,28 @@ +# FruitBankHybrid.Shared + +Main Blazor UI library shared across all three deployment targets (Server, WASM, MAUI). Contains pages, DevExpress grid components, SignalR client, measurement service, and layout. + +## Folder Structure + +| Folder | Purpose | +|---|---| +| [`Components/`](Components/README.md) | DevExpress grid wrappers, pallet components, notifications | +| [`Pages/`](Pages/README.md) | Routed pages: Login, ShippingsAdmin, OrdersAdmin, MeasuringIn/Out, StockTaking | +| [`Services/`](Services/README.md) | SignalR client, measurement service, form factor, loggers | +| [`Layout/`](Layout/README.md) | MainLayout with navigation, auto-login, toast notifications | +| [`Models/`](Models/README.md) | Date selector model for measuring pages | +| [`Extensions/`](Extensions/README.md) | DevExpress MessageBox/ConfirmBox helpers | +| [`Databases/`](Databases/README.md) | Client-side ConcurrentDictionary table cache | + +## Key Files (Root) + +- **`_Imports.razor`** — Global Blazor imports. +- **`Routes.razor`** — Route definitions. + +## Target Framework + +.NET 10.0 with AOT compilation and WASM IL stripping enabled. + +--- + +> **LLM Maintenance:** If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code. diff --git a/FruitBankHybrid.Shared/Services/Loggers/README.md b/FruitBankHybrid.Shared/Services/Loggers/README.md new file mode 100644 index 00000000..aea7a603 --- /dev/null +++ b/FruitBankHybrid.Shared/Services/Loggers/README.md @@ -0,0 +1,11 @@ +# Loggers + +Custom logger implementations for the FruitBank client. + +## Key Files + +- **`LoggerClient.cs`** — Non-generic and generic `LoggerClient` extending AyCode logger base. + +--- + +> **LLM Maintenance:** If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code. diff --git a/FruitBankHybrid.Shared/Services/README.md b/FruitBankHybrid.Shared/Services/README.md new file mode 100644 index 00000000..0483dad1 --- /dev/null +++ b/FruitBankHybrid.Shared/Services/README.md @@ -0,0 +1,20 @@ +# Services + +Business logic, SignalR client, measurement helpers, and platform abstractions. + +## Key Files + +- **`IFormFactor.cs`** — Interface for device form factor detection. +- **`IMeasurementService.cs`** — Measurement operation interface. +- **`MeasurementService.cs`** — CSS styling for MeasuringStatus, pallet item creation/validation, status badge/text generation, shipping-level status calculation. + +## Subfolders + +| Folder | Purpose | +|---|---| +| [`Loggers/`](Loggers/README.md) | LoggerClient and LoggerClient extending AyCode logger | +| [`SignalRs/`](SignalRs/README.md) | FruitBankSignalRClient hub client + DataSource wrappers | + +--- + +> **LLM Maintenance:** If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code. diff --git a/FruitBankHybrid.Shared/Services/SignalRs/README.md b/FruitBankHybrid.Shared/Services/SignalRs/README.md new file mode 100644 index 00000000..a8d266c6 --- /dev/null +++ b/FruitBankHybrid.Shared/Services/SignalRs/README.md @@ -0,0 +1,12 @@ +# SignalRs + +Main SignalR hub client and data source wrappers. + +## Key Files + +- **`FruitBankSignalRClient.cs`** — (~343 lines) Central hub client for ALL server communication. Methods for Partners, Shippings, ShippingItems, ShippingDocuments, Orders, OrderItems, OrderItemPallets, Products, StockTaking, GenericAttributes, Authentication. +- **`SignalRDataSource.cs`** — `SignalRDataSourceList` and `SignalRDataSourceObservable` wrappers for DevExpress grid binding. + +--- + +> **LLM Maintenance:** If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code. diff --git a/FruitBankHybrid.Web.Client/README.md b/FruitBankHybrid.Web.Client/README.md new file mode 100644 index 00000000..012ef5aa --- /dev/null +++ b/FruitBankHybrid.Web.Client/README.md @@ -0,0 +1,18 @@ +# FruitBankHybrid.Web.Client + +Blazor WebAssembly client running in the browser after server prerendering. .NET 10.0. + +## Folder Structure + +| Folder | Purpose | +|---|---| +| [`Services/`](Services/README.md) | WASM-specific: FormFactor, credential storage, console logging | + +## Key Files (Root) + +- **`Program.cs`** — WASM startup, DI registration. +- **`_Imports.razor`** — Global imports. + +--- + +> **LLM Maintenance:** If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code. diff --git a/FruitBankHybrid.Web.Client/Services/README.md b/FruitBankHybrid.Web.Client/Services/README.md new file mode 100644 index 00000000..15b988f9 --- /dev/null +++ b/FruitBankHybrid.Web.Client/Services/README.md @@ -0,0 +1,16 @@ +# Services + +WASM-specific service implementations. + +## Key Files + +- **`FormFactor.cs`** — Returns "WebAssembly" as form factor. +- **`WebSecureCredentialService.cs`** — localStorage-backed credential storage with XOR obfuscation + Base64 encoding (NOT cryptographically secure). 2-day expiration. + +## Subfolders + +- **`Loggers/BrowserConsoleLogWriter.cs`** — Browser console logging via JS interop. + +--- + +> **LLM Maintenance:** If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code. diff --git a/FruitBankHybrid.Web/Components/README.md b/FruitBankHybrid.Web/Components/README.md new file mode 100644 index 00000000..fc68d162 --- /dev/null +++ b/FruitBankHybrid.Web/Components/README.md @@ -0,0 +1,13 @@ +# Components + +Blazor Server app shell components. + +## Key Files + +- **`App.razor`** — Root component: DevExpress theme, asset configuration, render mode. +- **`_Imports.razor`** — Global imports. +- **`Pages/Error.razor`** — Error page with request ID tracking. + +--- + +> **LLM Maintenance:** If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code. diff --git a/FruitBankHybrid.Web/README.md b/FruitBankHybrid.Web/README.md new file mode 100644 index 00000000..4cc91667 --- /dev/null +++ b/FruitBankHybrid.Web/README.md @@ -0,0 +1,19 @@ +# FruitBankHybrid.Web + +ASP.NET Core Blazor Server host. Serves the web interface, hosts SignalR hubs, and supports interactive WebAssembly rendering. + +## Folder Structure + +| Folder | Purpose | +|---|---| +| [`Services/`](Services/README.md) | Server-side FormFactor, SecureCredentialService (no-op), SignalR hub setup | +| [`Components/`](Components/README.md) | App.razor with DevExpress theme, Error page | +| `Controllers/` | Empty placeholder | + +## Key Files (Root) + +- **`Program.cs`** — DI, SignalR hub mapping (DevAdminSignalRHub, LoggerSignalRHub), 256KB max message size, DevExpress Fluent theme, static asset versioning. + +--- + +> **LLM Maintenance:** If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code. diff --git a/FruitBankHybrid.Web/Services/README.md b/FruitBankHybrid.Web/Services/README.md new file mode 100644 index 00000000..c944cea8 --- /dev/null +++ b/FruitBankHybrid.Web/Services/README.md @@ -0,0 +1,12 @@ +# Services + +Server-side service implementations. + +## Key Files + +- **`FormFactor.cs`** — Returns "Web" as form factor. +- **`ServerSecureCredentialService.cs`** — No-op implementation (clients handle credential storage). + +--- + +> **LLM Maintenance:** If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code. diff --git a/FruitBankHybrid/Platforms/README.md b/FruitBankHybrid/Platforms/README.md new file mode 100644 index 00000000..fff8f242 --- /dev/null +++ b/FruitBankHybrid/Platforms/README.md @@ -0,0 +1,14 @@ +# Platforms + +Per-platform entry points for MAUI. + +## Folders + +- **`Android/`** — MainActivity.cs, MainApplication.cs (custom keystore config). +- **`iOS/`** — AppDelegate.cs, Program.cs. +- **`MacCatalyst/`** — AppDelegate.cs, Program.cs. +- **`Windows/`** — App.xaml.cs (WinUI entry point). + +--- + +> **LLM Maintenance:** If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code. diff --git a/FruitBankHybrid/README.md b/FruitBankHybrid/README.md new file mode 100644 index 00000000..ed73329f --- /dev/null +++ b/FruitBankHybrid/README.md @@ -0,0 +1,22 @@ +# FruitBankHybrid + +.NET MAUI Hybrid cross-platform app hosting Blazor components via BlazorWebView. Targets Android (API 33+), iOS (15.0+), and Windows. + +## Folder Structure + +| Folder | Purpose | +|---|---| +| [`Services/`](Services/README.md) | Platform-specific: FormFactor, SecureCredentialService, BrowserConsoleLogWriter | +| [`Platforms/`](Platforms/README.md) | Per-platform entry points: Android, iOS, Windows | +| `Components/` | Razor component imports (_Imports.razor) | +| `Resources/` | AppIcon, splash screens, fonts, images | + +## Key Files (Root) + +- **`MauiProgram.cs`** — DI registration, DevExpress init, SignalR client setup. +- **`MainPage.xaml.cs`** — BlazorWebView host page. +- **`App.xaml.cs`** — MAUI Application entry point. + +--- + +> **LLM Maintenance:** If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code. diff --git a/FruitBankHybrid/Services/README.md b/FruitBankHybrid/Services/README.md new file mode 100644 index 00000000..c70f5593 --- /dev/null +++ b/FruitBankHybrid/Services/README.md @@ -0,0 +1,16 @@ +# Services + +MAUI platform-specific service implementations. + +## Key Files + +- **`FormFactor.cs`** — Device idiom detection (Phone, Tablet, Desktop). +- **`MauiSecureCredentialService.cs`** — SecureStorage-backed credential persistence with 2-day expiration. + +## Subfolders + +- **`Loggers/BrowserConsoleLogWriter.cs`** — Browser console logging bridge for BlazorWebView. + +--- + +> **LLM Maintenance:** If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code. diff --git a/README.md b/README.md new file mode 100644 index 00000000..37bbe917 --- /dev/null +++ b/README.md @@ -0,0 +1,37 @@ +# FruitBankHybridApp + +nopCommerce plugin for FruitBank, a fruit & vegetable wholesaler. Manages supplier inbound delivery (Shipping), outgoing orders (Order), warehouse weighing, and inventory stocktaking. Runs as Blazor Server, Blazor WASM, and MAUI Hybrid (Android/iOS/Windows). + +## LLM Context + +Domain rules and critical pitfalls live in a single file: [`.github/copilot-instructions.md`](.github/copilot-instructions.md) + +| Tool | Auto-loaded | Action needed | +|------|------------|---------------| +| GitHub Copilot | ✅ `copilot-instructions.md` | None | +| Claude Code | ✅ `CLAUDE.md` → references above | None | +| Cursor / Windsurf | ✅ `README.md` | Read `copilot-instructions.md` via @file | + +Detailed docs: [`docs/`](docs/) — GLOSSARY.md, ARCHITECTURE.md, CONVENTIONS.md, SCHEMA.md + +## Solution Structure + +| Project | Purpose | README | +|---|---|---| +| [`FruitBank.Common`](FruitBank.Common/README.md) | Shared domain: entities, DTOs, interfaces, SignalR tags, measurement helpers | [README](FruitBank.Common/README.md) | +| [`FruitBank.Common.Server`](FruitBank.Common.Server/README.md) | Server-side: SignalR hubs, broadcast service, logging, nopCommerce integration | [README](FruitBank.Common.Server/README.md) | +| [`FruitBankHybrid.Shared`](FruitBankHybrid.Shared/README.md) | Blazor UI: pages, grids, SignalR client, measurement service, layout | [README](FruitBankHybrid.Shared/README.md) | +| [`FruitBankHybrid.Shared.Common`](FruitBankHybrid.Shared.Common/README.md) | Shared common library (placeholder) | [README](FruitBankHybrid.Shared.Common/README.md) | +| [`FruitBankHybrid`](FruitBankHybrid/README.md) | MAUI Hybrid app: Android, iOS, Windows | [README](FruitBankHybrid/README.md) | +| [`FruitBankHybrid.Web`](FruitBankHybrid.Web/README.md) | Blazor Server host with SignalR hubs | [README](FruitBankHybrid.Web/README.md) | +| [`FruitBankHybrid.Web.Client`](FruitBankHybrid.Web.Client/README.md) | Blazor WebAssembly client | [README](FruitBankHybrid.Web.Client/README.md) | + +### Test Projects + +| Project | Purpose | README | +|---|---|---| +| [`FruitBankHybrid.Shared.Tests`](FruitBankHybrid.Shared.Tests/README.md) | Integration + serialization tests (SignalR, JSON, Toon, bunit) | [README](FruitBankHybrid.Shared.Tests/README.md) | + +--- + +> **LLM Maintenance:** If you modify this solution's structure, update this README to reflect the changes. diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md new file mode 100644 index 00000000..191d1424 --- /dev/null +++ b/docs/ARCHITECTURE.md @@ -0,0 +1,55 @@ +# Architecture + +## Solution Dependency Graph + +``` +FruitBank.Common (shared domain) + ↑ +FruitBank.Common.Server (server-side services, nopCommerce) + ↑ +FruitBankHybrid.Shared.Common (shared utilities, placeholder) + ↑ +FruitBankHybrid.Shared (Blazor UI components, pages, services) + ↑ ↑ ↑ +FruitBankHybrid FruitBankHybrid.Web FruitBankHybrid.Web.Client +(MAUI Hybrid) (Blazor Server) (Blazor WASM) +``` + +All projects also reference **AyCode.Core** and **AyCode.Blazor** via DLL references (not ProjectReference). + +## Three Deployment Targets + +| Target | Project | How UI Runs | +|---|---|---| +| **MAUI Hybrid** | FruitBankHybrid | Native app with BlazorWebView | +| **Blazor Server** | FruitBankHybrid.Web | Server-side rendering + SignalR | +| **Blazor WASM** | FruitBankHybrid.Web.Client | Downloaded to browser, runs in WASM | + +All three share the same UI components from `FruitBankHybrid.Shared`. + +## Data Flow + +``` +User → DevExpress Grid → AcSignalRDataSource → SignalR (AcBinary) → DevAdminSignalRHub + ↓ + DynamicMethodRegistry + ↓ + IFruitBankDataControllerServer + ICustomOrderSignalREndpointServer + IStockSignalREndpointServer + ↓ + nopCommerce Database +``` + +## Key Architectural Decisions + +- **nopCommerce plugin** — Customer, Order, Product are nopCommerce entities extended via GenericAttributes and DTOs +- **SignalR over REST** — all data flows through SignalR with AcBinary protocol +- **DevExpress Blazor 25.1.3** — exclusive UI component library +- **Three measurement hierarchies** — Shipping/Order/StockTaking share same base but have different audit rules +- **Client-side database** — `DatabaseClient` caches entities in ConcurrentDictionary for offline/fast access +- **Platform-specific credential storage** — MAUI uses SecureStorage, Web uses obfuscated localStorage, Server uses no-op + +--- + +> **LLM Maintenance:** If you modify the architecture, update this document. diff --git a/docs/CONVENTIONS.md b/docs/CONVENTIONS.md new file mode 100644 index 00000000..828b10ee --- /dev/null +++ b/docs/CONVENTIONS.md @@ -0,0 +1,38 @@ +# Conventions + +## Naming + +- **fb prefix** on database tables: `fbPallet`, `fbShipping`, `fbShippingItem`, etc. +- **Dto suffix** for DTOs wrapping nopCommerce entities: `OrderDto`, `OrderItemDto`, `ProductDto`. +- **XxxItemPallet** for measurement records: `ShippingItemPallet`, `OrderItemPallet`, `StockTakingItemPallet`. +- **Grid prefix** for Blazor grid components: `GridPartnerBase`, `GridShippingBase`, etc. +- **SignalRTags** constants use numeric ranges by domain (see `FruitBank.Common/SignalRs/`). + +## Patterns + +- **MeasuringItemPalletBase** as abstract base for all three measurement hierarchies. +- **GenericAttributes** for extending nopCommerce entities with custom data (IsMeasurable, Tare, AverageWeight). +- **Composition interfaces** for measurement traits: IMeasuringValues = IMeasuringWeights + IMeasuringQuantity. +- **DevExpress DxGrid** with `AcSignalRDataSource` for real-time grid data. +- **MgGridBase** for grid layout persistence via localStorage. +- **FruitBankSignalRClient** as single hub client for all server communication. +- **DatabaseClient** for client-side caching with ConcurrentDictionary tables. + +## Critical Rules + +- **MeasuringStatus.Finnished** — intentional legacy typo. Do NOT fix. +- **Shipping = INBOUND, Order = OUTBOUND** — never confuse directions. +- **Pallet = measurement record** — always created, even for non-measurable products. +- **NetWeight is calculated, never stored** — GrossWeight − PalletWeight − (TrayQuantity × TareWeight). +- **DLL references** to AyCode projects are intentional — do not convert to ProjectReference. +- Do not suggest removal/rollback as a solution — find a fix. + +## UI (Hungarian Locale) + +- Status labels and UI text are in Hungarian. +- MeasuringStatus display: "Nincs elkezdve", "Elkezdve", "Kész", "Auditált". +- Date format follows Hungarian conventions. + +--- + +> **LLM Maintenance:** If you establish new conventions, document them here. diff --git a/docs/GLOSSARY.md b/docs/GLOSSARY.md new file mode 100644 index 00000000..8a4a3434 --- /dev/null +++ b/docs/GLOSSARY.md @@ -0,0 +1,64 @@ +# Glossary / Fogalomtár + +Domain terminology for the FruitBank system. **Read this before making changes.** + +## Business Domain + +| English | Magyar | Definition | +|---|---|---| +| **Shipping** | Beszállítás | **INBOUND** delivery: supplier → warehouse. A truck arrival event. | +| **Order** | Megrendelés | **OUTBOUND** delivery: warehouse → customer. | +| **Pallet** (XxxItemPallet) | Mérési rekord | A **measurement record**, NOT a physical pallet. Always created, even for non-measurable products. | +| **Partner** | Partner / Beszállító | External supplier providing goods. | +| **ShippingDocument** | Szállítólevél | Supplier's delivery note or invoice, linked to a Shipping. | +| **ShippingItem** | Szállítólevél tétel | Product line on a shipping document. Tracks declared vs measured discrepancies. | +| **StockTaking** | Leltározás | Inventory session that freezes logical stock and reconciles with physical count. | +| **GenericAttribute** | Generikus attribútum | nopCommerce polymorphic key-value store. KeyGroup = owner type, EntityId = owner ID. | + +## Measurement System + +| Term | Definition | +|---|---| +| **IsMeasurable** | Product-level flag. If `false`: weights = 0.0, only TrayQuantity matters. A Pallet record is still created. | +| **NetWeight** | `GrossWeight − PalletWeight − (TrayQuantity × TareWeight)` — universal formula across all three hierarchies. | +| **TrayQuantity** | Always recorded, regardless of measurability. Count of trays/crates. | +| **GrossWeight** | Total weight including pallet and packaging. 0.0 if not measurable. | +| **PalletWeight** | Weight of the physical pallet. 0.0 if goods arrive without one. | +| **TareWeight** | Weight of a single tray/crate. Used in NetWeight calculation. | +| **AverageWeight** | Per-pallet average: `NetWeight / TrayQuantity`. Validated against threshold. | +| **MeasuringStatus** | NotStarted(0) → Started(10) → **Finnished**(20) → Audited(30). Note: "Finnished" is intentional. | +| **RevisorId** | Quality auditor's Customer ID. OrderItemPallet becomes "Audited" when RevisorId > 0. | + +## Three Measurement Hierarchies + +All share `MeasuringItemPalletBase` with the same NetWeight formula: + +| Flow | Parent | Pallet Record | Extra | +|---|---|---|---| +| **Inbound (Shipping)** | ShippingItem | ShippingItemPallet | Declared vs measured discrepancy | +| **Outbound (Order)** | OrderItemDto | OrderItemPallet | RevisorId for audit | +| **Inventory (StockTaking)** | StockTakingItem | StockTakingItemPallet | QuantityDiff for stock adjustment | + +## nopCommerce Entities + +These are **NOT custom FruitBank entities** — they come from nopCommerce: +- Customer, Order, OrderItem, OrderNote, Product, GenericAttribute + +FruitBank extends them via: +- **DTOs** (OrderDto, OrderItemDto, ProductDto) that wrap nopCommerce entities with measurement properties +- **GenericAttributes** for storing custom values (IsMeasurable, Tare, AverageWeight, etc.) + +## Common Traps + +| Trap | Correct Behavior | +|---|---| +| "Pallet" = physical pallet | ❌ It's a measurement record. Always created. | +| Shipping = outgoing | ❌ Shipping = INBOUND. Order = OUTBOUND. | +| Fix "Finnished" spelling | ❌ Intentional legacy typo. Do NOT fix. | +| IsMeasurable=false means no Pallet | ❌ Pallet is always created, weights just = 0.0 | +| NetWeight is stored | ❌ It's calculated: GrossWeight − PalletWeight − (TrayQuantity × TareWeight) | +| GenericAttribute is simple | ❌ It's polymorphic: KeyGroup determines which entity type owns the record | + +--- + +> **LLM Maintenance:** If you modify domain terminology or introduce new business concepts, update this glossary. diff --git a/docs/SCHEMA.md b/docs/SCHEMA.md new file mode 100644 index 00000000..bba5b0a7 --- /dev/null +++ b/docs/SCHEMA.md @@ -0,0 +1,635 @@ +# Domain Model Schema (Toon Format) + +> Full domain model in [Toon](../../AyCode.Core/AyCode.Core/Serializers/Toons/README.md) (Token-Oriented Object Notation) format. +> This is the authoritative schema for entities, DTOs, and enums in the FruitBank domain. + +@meta { + version = "1.0" + format = "toon" + source-code-language = "C#" + context = "This is a nopCommerce plugin developed for FruitBank, a fruit and vegetable wholesaler. The plugin manages supplier inbound delivery (receiving), warehouse weighing (net/gross/pallet/tare weights), and inventory stocktaking. The business logic is centered around FruitBank's requirement for precise physical measurement and quantity tracking." + types = ["OrderStatus", "ShippingStatus", "PaymentStatus", "GenericAttributeDto", "MeasuringStatus", "VatNumberStatus", "TaxDisplayType", "OrderNote", "DocumentType", "Files", "Pallet", "ProductDto", "Customer", "FullProcessModel", "OrderDto", "OrderItemDto", "OrderItemPallet", "Partner", "Shipping", "ShippingDocument", "ShippingDocumentToFiles", "ShippingItem", "ShippingItemPallet", "StockTaking", "StockTakingItem", "StockTakingItemPallet"] +} + +@types { + OrderStatus: enum + underlying-type: "int" + default-value: 10 + values: + Pending = 10 + Processing = 20 + Complete = 30 + Cancelled = 40 + + ShippingStatus: enum + underlying-type: "int" + default-value: 10 + values: + ShippingNotRequired = 10 + NotYetShipped = 20 + PartiallyShipped = 25 + Shipped = 30 + Delivered = 40 + + PaymentStatus: enum + underlying-type: "int" + default-value: 10 + values: + Pending = 10 + Authorized = 20 + Paid = 30 + PartiallyRefunded = 35 + Refunded = 40 + Voided = 50 + + GenericAttributeDto: "Data transfer object for GenericAttribute" + table-name: "GenericAttribute" + related-type: "dto-of GenericAttribute" + CreatedOrUpdatedDateUTC: DateTime? + EntityId: int + constraints: "polymorphic-fk(KeyGroup)" + Key: string + KeyGroup: string + StoreId: int + Value: string + purpose: "Raw string representation of the Key's value" + Id: int + purpose: "Primary key / unique identification" + primary-key: true + + MeasuringStatus: enum + underlying-type: "int" + default-value: 0 + values: + NotStarted = 0 + Started = 10 + Finnished = 20 + Audited = 30 + + VatNumberStatus: enum + underlying-type: "int" + default-value: 0 + values: + Unknown = 0 + Empty = 10 + Valid = 20 + Invalid = 30 + + TaxDisplayType: enum + underlying-type: "int" + default-value: 0 + values: + IncludingTax = 0 + ExcludingTax = 10 + + OrderNote: "NopCommerce order note entity" + table-name: "OrderNote" + CreatedOnUtc: DateTime + DisplayToCustomer: bool + DownloadId: int + Note: string + OrderId: int + description: "Foreign key to parent Order" + Id: int + purpose: "Primary key / unique identification" + primary-key: true + + DocumentType: enum + underlying-type: "int" + default-value: 0 + values: + NotSet = 0 + Unknown = 5 + ShippingDocument = 10 + OrderConfirmation = 15 + Invoice = 20 + + Files: "Uploaded file with extracted text content" + table-name: "fbFiles" + purpose: "A centralized repository for all uploaded binary content and metadata, featuring a 'RawText' field that stores OCR-extracted information for full-text search and automated data validation across the system" + Created: DateTime + FileExtension: string + FileHash: string + FileName: string + FileSubPath: string + IsCompressed: bool + purpose: "Status flag" + Modified: DateTime + RawText: string + Id: int + purpose: "Primary key / unique identification" + primary-key: true + + Pallet: "Pallet type definition with size and weight" + table-name: "fbPallet" + Created: DateTime + Modified: DateTime + Name: string + Size: string + Weight: double? + Id: int + purpose: "Primary key / unique identification" + primary-key: true + + ProductDto: "Product data with measurements and generic attributes" + table-name: "Product" + related-type: "dto-of Product" + AvailableQuantity: int + business-logic: "get => StockQuantity + IncomingQuantity" + constraints: "readonly, not-mapped" + AverageWeight: double + business-logic: "get => GenericAttributes.GetValueOrDefault('AverageWeight')" + constraints: "readonly, not-mapped" + AverageWeightTreshold: double + business-logic: "get => GenericAttributes.GetValueOrDefault('AverageWeightTreshold')" + constraints: "readonly, not-mapped" + GenericAttributes: List + navigation: "one-to-many" + IncomingQuantity: int + business-logic: "get => GenericAttributes.GetValueOrDefault('IncomingQuantity')" + constraints: "not-mapped" + IsMeasurable: bool + purpose: "Master flag: if false, the system bypasses weight validation but still creates one Measurement Record (PalletItem) with TrayQuantity." + business-logic: "get => GenericAttributes.GetValueOrDefault('IsMeasurable')" + constraints: "not-mapped" + NetWeight: double + business-logic: "get => GenericAttributes.GetValueOrDefault('NetWeight')" + constraints: "not-mapped" + Tare: double + business-logic: "get => GenericAttributes.GetValueOrDefault('Tare')" + constraints: "not-mapped" + Deleted: bool + FullDescription: string + Height: decimal + Length: decimal + LimitedToStores: bool + Name: string + ParentGroupedProductId: int + Price: decimal + ProductCost: decimal + ProductTypeId: int + ShortDescription: string + StockQuantity: int + SubjectToAcl: bool + WarehouseId: int + Weight: decimal + Width: decimal + Id: int + purpose: "Primary key / unique identification" + primary-key: true + + Customer: "NopCommerce customer entity" + table-name: "Customer" + Active: bool + AdminComment: string + AffiliateId: int + BillingAddressId: int? + CannotLoginUntilDateUtc: DateTime? + City: string + Company: string + CountryId: int + County: string + CreatedOnUtc: DateTime + CurrencyId: int? + CustomCustomerAttributesXML: string + CustomerGuid: Guid + DateOfBirth: DateTime? + Deleted: bool + Email: string + constraints: "email-format" + EmailToRevalidate: string + constraints: "email-format" + FailedLoginAttempts: int + Fax: string + FirstName: string + Gender: string + HasShoppingCartItems: bool + IsSystemAccount: bool + purpose: "Status flag" + IsTaxExempt: bool + purpose: "Status flag" + LanguageId: int? + constraints: "range: 0-150" + LastActivityDateUtc: DateTime + LastIpAddress: string + LastLoginDateUtc: DateTime? + LastName: string + MustChangePassword: bool + Phone: string + RegisteredInStoreId: int + RequireReLogin: bool + ShippingAddressId: int? + StateProvinceId: int + StreetAddress: string + StreetAddress2: string + SystemName: string + TaxDisplayType: TaxDisplayType? + TaxDisplayTypeId: int? + TimeZoneId: string + Username: string + VatNumber: string + VatNumberStatus: VatNumberStatus + VatNumberStatusId: int + VendorId: int + ZipPostalCode: string + Id: int + purpose: "Primary key / unique identification" + primary-key: true + + FullProcessModel: "Object of type FullProcessModel" + table-name: "FullProcessModel" + purpose: "Container model for Shipping, Order" + Orders: List + navigation: "one-to-many" + Shippings: List + navigation: "one-to-many" + StockTakings: List + navigation: "one-to-many" + + OrderDto: "Data transfer object for Order" + table-name: "Order" + related-type: "dto-of Order" + DateOfReceipt: DateTime? + business-logic: "get => GenericAttributes.GetValueOrNull('DateOfReceipt')" + constraints: "readonly, not-mapped" + DateOfReceiptOrCreated: DateTime + constraints: "readonly, not-mapped" + GenericAttributes: List + navigation: "one-to-many" + IsAllOrderItemAudited: bool + purpose: "Status flag" + business-logic: "get => OrderItemDtos.Count > 0 && OrderItemDtos.All(oi => oi.IsAudited)" + constraints: "readonly, not-mapped" + IsAllOrderItemAvgWeightValid: bool + purpose: "Status flag" + business-logic: "get => OrderItemDtos.All(oi => oi.AverageWeightIsValid)" + constraints: "readonly, not-mapped" + IsComplete: bool + purpose: "Status flag" + business-logic: "get => OrderStatus == OrderStatus.Complete" + constraints: "readonly, not-mapped" + IsMeasurable: bool + purpose: "Status flag" + business-logic: "get => OrderItemDtos.Any(oi => oi.IsMeasurable)" + constraints: "readonly, not-mapped" + IsMeasured: bool + purpose: "Status flag" + business-logic: "get => Id > 0 && OrderItemDtos.Count > 0 && OrderItemDtos.All(x => x.IsMeasured)" + constraints: "readonly, not-mapped" + MeasurementOwnerId: int + business-logic: "get => GenericAttributes.GetValueOrDefault('MeasurementOwnerId', 0)" + constraints: "readonly, not-mapped" + MeasuringStatus: MeasuringStatus + constraints: "readonly, not-mapped" + RevisorId: int + business-logic: "get => GenericAttributes.GetValueOrDefault('RevisorId', 0)" + constraints: "readonly, not-mapped" + TimeOfReceiptText: string + constraints: "readonly, not-mapped" + CreatedOnUtc: DateTime + CustomOrderNumber: string + CustomValuesXml: string + Customer: Customer + foreign-key: "CustomerId" + navigation: "many-to-one" + CustomerId: int + Deleted: bool + OrderDiscount: decimal + OrderGuid: Guid + OrderItemDtos: List + other-key: "OrderId" + navigation: "one-to-many" + inverse-property: "OrderDto" + OrderNotes: List + other-key: "OrderId" + navigation: "one-to-many" + OrderStatus: OrderStatus + purpose: "Enum wrapper" + business-logic: "get, set => OrderStatusId" + OrderStatusId: int + OrderTotal: decimal + PaidDateUtc: DateTime? + PaymentStatus: PaymentStatus + purpose: "Enum wrapper" + business-logic: "get, set => PaymentStatusId" + PaymentStatusId: int + ShippingMethod: string + ShippingStatus: ShippingStatus + purpose: "Enum wrapper" + business-logic: "get, set => ShippingStatusId" + ShippingStatusId: int + StoreId: int + Id: int + purpose: "Primary key / unique identification" + primary-key: true + + OrderItemDto: "Order item with measurements, pallets, and validation" + table-name: "OrderItem" + related-type: "dto-of OrderItem" + AverageWeight: double + business-logic: "get => IsMeasurable && OrderItemPallets.Count > 0 ? double.Round(OrderItemPallets.Sum(oip => oip.AverageWeight) / OrderItemPallets.Count, 1) : 0d" + constraints: "readonly, not-mapped" + AverageWeightDifference: double + business-logic: "get => IsMeasurable ? double.Round(ProductDto!.AverageWeight - AverageWeight, 1) : 0" + constraints: "readonly, not-mapped" + AverageWeightIsValid: bool + business-logic: "get => !IsMeasurable || (ProductDto!.AverageWeight > 0 && ((AverageWeightDifference / ProductDto!.AverageWeight) * 100) < ProductDto!.AverageWeightTreshold)" + constraints: "readonly, not-mapped" + GenericAttributes: List + navigation: "one-to-many" + GrossWeight: double + business-logic: "get => double.Round(OrderItemPallets.Sum(x => x.NetWeight), 1)" + constraints: "not-mapped" + IsAudited: bool + purpose: "Status flag" + business-logic: "get => OrderItemPallets.Count > 0 && OrderItemPallets.All(oip => oip.IsAudited)" + constraints: "readonly, not-mapped" + IsMeasurable: bool + purpose: "Status flag" + business-logic: "get => ProductDto!.IsMeasurable" + constraints: "not-mapped" + IsMeasured: bool + purpose: "Status flag" + business-logic: "get => IsMeasuredAndValid()" + constraints: "not-mapped" + MeasuringStatus: MeasuringStatus + business-logic: "get => complex conditional logic based on IsAudited, IsMeasured, and OrderItemPallets status" + constraints: "readonly, not-mapped" + NetWeight: double + business-logic: "get => double.Round(OrderItemPallets.Sum(x => x.NetWeight), 1)" + constraints: "not-mapped" + OrderDto: OrderDto + foreign-key: "OrderId" + navigation: "many-to-one" + inverse-property: "OrderItemDtos" + OrderItemPallets: List + other-key: "OrderItemId" + navigation: "one-to-many" + inverse-property: "OrderItemDto" + TrayQuantity: int + business-logic: "get => OrderItemPallets.Sum(x => x.TrayQuantity)" + constraints: "not-mapped" + AttributesXml: string + ItemWeight: decimal? + OrderId: int + OrderItemGuid: Guid + PriceExclTax: decimal + PriceInclTax: decimal + ProductDto: ProductDto + foreign-key: "ProductId" + navigation: "many-to-one" + ProductId: int + ProductName: string + business-logic: "get => ProductDto?.Name ?? 'ProductDto is null!!!'" + constraints: "readonly" + Quantity: int + UnitPriceExclTax: decimal + UnitPriceInclTax: decimal + Id: int + purpose: "Primary key / unique identification" + primary-key: true + + OrderItemPallet: "Pallet measurements for order items with audit tracking" + table-name: "fbOrderItemPallet" + purpose: "A measurement record for outgoing goods. NOTE: Despite the 'Pallet' name, this is a general measurement record that is ALWAYS created for every item." + AverageWeight: double + business-logic: "get => double.Round(NetWeight / TrayQuantity, 1)" + constraints: "readonly, not-mapped" + IsAudited: bool + purpose: "Status flag" + business-logic: "get => RevisorId > 0" + constraints: "readonly, not-mapped" + MeasuringStatus: MeasuringStatus + business-logic: "get => IsAudited ? MeasuringStatus.Audited : base.MeasuringStatus" + constraints: "readonly, not-mapped" + OrderItemDto: OrderItemDto + foreign-key: "OrderItemId" + navigation: "many-to-one" + inverse-property: "OrderItemPallets" + OrderItemId: int + RevisorId: int + purpose: "User/Customer ID of the quality auditor" + Created: DateTime + CreatorId: int? + GrossWeight: double + IsMeasured: bool + Modified: DateTime + ModifierId: int? + NetWeight: double + business-logic: "get => GrossWeight - PalletWeight - (TrayQuantity * TareWeight)" + constraints: "readonly, not-mapped" + PalletWeight: double + TareWeight: double + TrayQuantity: int + Id: int + primary-key: true + + Partner: "Business partner with address and tax information" + table-name: "fbPartner" + purpose: "External supplier providing goods" + CertificationNumber: string + City: string + Country: string + County: string + Created: DateTime + Modified: DateTime + Name: string + PostalCode: string + ShippingDocuments: List + navigation: "one-to-many" + State: string + Street: string + TaxId: string + Id: int + primary-key: true + + Shipping: "Inbound delivery event at warehouse" + table-name: "fbShipping" + CargoCompany: string + Comment: string + Created: DateTime + IsAllMeasured: bool + LicencePlate: string + MeasuredDate: DateTime? + Modified: DateTime + ShippingDate: DateTime + ShippingDocuments: List + navigation: "one-to-many" + Id: int + primary-key: true + + ShippingDocument: "Supplier delivery note or invoice" + table-name: "fbShippingDocument" + Comment: string + Country: string + Created: DateTime + DocumentIdNumber: string + IsAllMeasured: bool + Modified: DateTime + Partner: Partner + foreign-key: "PartnerId" + navigation: "many-to-one" + PartnerId: int + PdfFileName: string + Shipping: Shipping + foreign-key: "ShippingId" + navigation: "many-to-one" + ShippingDate: DateTime + ShippingDocumentToFiles: List + navigation: "one-to-many" + ShippingId: int? + ShippingItems: List + navigation: "one-to-many" + TotalPallets: int + Id: int + primary-key: true + + ShippingDocumentToFiles: "Links documents to files with type" + table-name: "fbShippingDocumentToFiles" + Created: DateTime + DocumentType: DocumentType + DocumentTypeId: int + FilesId: int + Modified: DateTime + ShippingDocument: ShippingDocument + foreign-key: "ShippingDocumentId" + navigation: "many-to-one" + ShippingDocumentFile: Files + foreign-key: "FilesId" + navigation: "many-to-one" + ShippingDocumentId: int + Id: int + primary-key: true + + ShippingItem: "Product line on shipping document" + table-name: "fbShippingItem" + Created: DateTime + GrossWeightOnDocument: double + HungarianName: string + IsMeasurable: bool + IsMeasured: bool + MeasuredGrossWeight: double + MeasuredNetWeight: double + MeasuredQuantity: int + MeasuringCount: int + MeasuringStatus: MeasuringStatus + constraints: "readonly, not-mapped" + Modified: DateTime + Name: string + NameOnDocument: string + NetWeightOnDocument: double + Pallet: Pallet + foreign-key: "PalletId" + navigation: "many-to-one" + PalletId: int? + PalletsOnDocument: int + ProductDto: ProductDto + foreign-key: "ProductId" + navigation: "many-to-one" + ProductId: int? + QuantityOnDocument: int + ShippingDocument: ShippingDocument + foreign-key: "ShippingDocumentId" + navigation: "many-to-one" + ShippingDocumentId: int + ShippingItemPallets: List + navigation: "one-to-many" + UnitPriceOnDocument: double + Id: int + primary-key: true + + ShippingItemPallet: "Measurement record for incoming goods" + table-name: "fbShippingItemPallet" + purpose: "Always created even without physical pallet" + ShippingItem: ShippingItem + foreign-key: "ShippingItemId" + navigation: "many-to-one" + ShippingItemId: int + Created: DateTime + CreatorId: int? + GrossWeight: double + IsMeasured: bool + MeasuringStatus: MeasuringStatus + constraints: "readonly, not-mapped" + Modified: DateTime + ModifierId: int? + NetWeight: double + business-logic: "get => GrossWeight - PalletWeight - (TrayQuantity * TareWeight)" + constraints: "readonly, not-mapped" + PalletWeight: double + TareWeight: double + TrayQuantity: int + Id: int + primary-key: true + + StockTaking: "Inventory session record" + table-name: "fbStockTaking" + Created: DateTime + Creator: int + IsClosed: bool + Modified: DateTime + StartDateTime: DateTime + StockTakingItems: List + navigation: "one-to-many" + Id: int + primary-key: true + + StockTakingItem: "Line item for product reconciliation" + table-name: "fbStockTakingItem" + purpose: "Reconciles snapshot quantity with physical count" + InProcessOrdersQuantity: int + IsInvalid: bool + constraints: "readonly, not-mapped" + IsMeasurable: bool + IsRequiredForMeasuring: bool + constraints: "readonly, not-mapped" + MeasuredNetWeight: double + NetWeightDiff: double + constraints: "readonly, not-mapped" + OriginalNetWeight: double + QuantityDiff: int + constraints: "readonly, not-mapped" + StockTakingItemPallets: List + navigation: "one-to-many" + TotalOriginalQuantity: int + constraints: "readonly, not-mapped" + Created: DateTime + IsMeasured: bool + MeasuredStockQuantity: int + Modified: DateTime + OriginalStockQuantity: int + Product: ProductDto + foreign-key: "ProductId" + navigation: "many-to-one" + ProductId: int + StockTaking: StockTaking + foreign-key: "StockTakingId" + navigation: "many-to-one" + StockTakingId: int + Id: int + primary-key: true + + StockTakingItemPallet: "Weight record for inventory item" + table-name: "fbStockTakingItemPallet" + purpose: "Mandatory for every inventory item, even non-measurable" + StockTakingItem: StockTakingItem + foreign-key: "StockTakingItemId" + navigation: "many-to-one" + StockTakingItemId: int + Created: DateTime + CreatorId: int? + GrossWeight: double + IsMeasured: bool + MeasuringStatus: MeasuringStatus + constraints: "readonly, not-mapped" + Modified: DateTime + ModifierId: int? + NetWeight: double + business-logic: "get => GrossWeight - PalletWeight - (TrayQuantity * TareWeight)" + constraints: "readonly, not-mapped" + PalletWeight: double + TareWeight: double + TrayQuantity: int + Id: int + primary-key: true +}