From dbccbf487dc2aeefc6ade8e22a79992013fe829c Mon Sep 17 00:00:00 2001 From: Loretta Date: Thu, 2 Apr 2026 09:02:55 +0200 Subject: [PATCH] Enforce strict AI agent protocol, doc sync, and glossary - Added "AI AGENT CORE PROTOCOL" to all copilot-instructions.md files: mandates [LOADED_DOCS] prefix, hard-gates tool usage, enforces no-re-read of .md files, and requires user consent for doc/code changes. - Updated CLAUDE.md to require reading copilot-instructions.md first. - Added topic-based doc separation and folder navigation rules. - Changed doc sync: agent now passively detects discrepancies and asks before updating docs. - Every code-modifying response must end with a [DOCUMENTATION CHECK] section. - Centralized measurement system and domain traps in new FruitBank.Common/docs/GLOSSARY.md; updated references in FruitBankHybridApp GLOSSARY.md. - Clarified schema and doc locations in FruitBankHybridApp README.md. - Added hybrid execution model section to AyCode.Core BINARY_FEATURES.md. - Removed unnecessary BeginUpdate/EndUpdate calls in MgGridBase.cs for layout persistence. - Removed full Toon schema from plugin SCHEMA.md to avoid duplication. --- .github/copilot-instructions.md | 39 +- CLAUDE.md | 2 +- FruitBank.Common/docs/GLOSSARY.md | 40 ++ README.md | 2 +- docs/GLOSSARY.md | 36 +- docs/SCHEMA.md | 635 ------------------------------ 6 files changed, 80 insertions(+), 674 deletions(-) create mode 100644 FruitBank.Common/docs/GLOSSARY.md delete mode 100644 docs/SCHEMA.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 23fbb739..8143ee54 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -1,5 +1,37 @@ # FruitBankHybridApp β€” Domain Rules +## πŸ›‘ AI AGENT CORE PROTOCOL (CRITICAL ENFORCEMENT) +You are operating in a multi-repo, documentation-first architecture. You MUST STRICTLY follow this protocol for every response. Failure to do so will break the workspace rules. + +1. **MANDATORY OUTPUT PREFIX:** Your response MUST begin exactly with this format on the very first line: + `[LOADED_DOCS: ]` + *(If no .md files are loaded yet, write `[LOADED_DOCS: NONE]`.)* + +2. **HARD-GATE DELAY (DOCS BEFORE CODE) & TOOL EXECUTION BLOCK:** + - If `[LOADED_DOCS: NONE]` applies, you **MUST STOP** and you are **STRICTLY FORBIDDEN** to use the following tools: `code_search`, `get_symbols_by_name`, `find_symbol`, or `get_file` (for non-markdown files). + - Your VERY FIRST AND ONLY allowed tool calls must be `file_search` or `get_file` targeting the `.md` documentation in the relevant `docs/` folders or `README.md`. + - Do not answer the user's core question until the `[LOADED_DOCS]` list is populated with the base architecture files. + - **CRITICAL EXCEPTION:** Do **NOT** re-read `.md` files that are already mapped in your context or `LOADED_DOCS` list (strictly maintain rule 21). + +3. **STRICT NO-RE-READ POLICY (ANTI-LOOP):** + You are PHYSICALLY FORBIDDEN from calling `get_file` or `file_search` on any `.md` file that is already listed in your `[LOADED_DOCS]` prefix. + - Once an `.md` file is in your context, it STAYS in your context. + - Re-reading them wastes tokens and breaks the protocol. + - ONLY re-read an `.md` file if the user EXPLICITLY states "the file has changed on disk, read it again". + - If the user simply mentions a glossary term or requests info found in a loaded doc, answer directly from memory. DO NOT search for it again. + +4. **CONTEXT RECOVERY (SMART READ):** + If the user asks a domain/architecture specific question and you realize the essential `.md` files are NO LONGER in your current context (they dropped out of memory), you **MUST automatically re-read** the necessary documentation before answering. + Do NOT wait for the user to explicitly tell you to re-read them. Prioritize scanning the `docs/` folders to recover the lost context. + + Directories to read (when recovering context): + - `docs/` (in this repository root) + - `../NopCommerce.Common/4.70/Plugins/Nop.Plugin.Misc.AIPlugin/docs/` + +5. **EXPLICIT CONSENT FOR MODIFICATIONS:** + NEVER rewrite, create, or delete code/files without the user's explicit permission. If the user does not specifically request a code modification (e.g., using phrases like "we are just thinking," "what do you think," "let's plan"), you MUST ONLY provide text-based analysis and planning. You are FORBIDDEN from using file-modifying tools (`replace_string_in_file`, `edit_file`, `create_file`, etc.) until the user explicitly says "ok", "go ahead", "implement", or a similar unambiguous approval. + +## Workspace Dependencies # own-dep-repos: "name: path" β€” paths are relative to this repo root (.github/..) @repo { name = "FruitBankHybridApp" @@ -18,7 +50,6 @@ > For UI framework rules see: `.github/copilot-instructions.md` (in AyCode.Blazor repo) > For nopCommerce library rules see: `.github/copilot-instructions.md` (in Mango.Nop Libraries repo) > For nopCommerce plugin (server side) rules see: `../NopCommerce.Common/4.70/Plugins/Nop.Plugin.Misc.AIPlugin/README.md` (in Mango.Nop Plugins repo) -> On first use, read `../NopCommerce.Common/4.70/Plugins/Nop.Plugin.Misc.AIPlugin/docs/SCHEMA.md` β€” full TOON domain model (rule 21 prevents re-reading) > External repos in `own-dep-repos` are fully accessible β€” read their source code, docs, and `.github/copilot-instructions.md` freely when you need type definitions, base classes, or context. Do not limit yourself to the current workspace. ## Business Domain @@ -44,7 +75,10 @@ 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. nopCommerce 4.80.9 requirement. 13. **No redundant code** β€” before writing new logic, check whether similar methods already exist in the current context. Reuse or extract shared logic into smaller methods rather than duplicating. -14. **Keep all .md files in sync** β€” when you modify code and you know which .md file documents it, update that .md file too. If you notice a contradiction between code and an .md file, automatically update the .md to match the code (code is the source of truth). When fixing a reference, check other .md files that may share the same broken reference. If the root cause is at a lower layer, fix it there first. During code review, if you find useful behavior or conventions not yet documented, briefly suggest what to document and where β€” but do not add new content without approval. +14. **Keep all .md documentation in sync (PASSIVE DETECTION & ASK FIRST)** β€” If you notice *any contradiction, error, or missing information* between the code and your currently loaded `.md` files, **briefly notify the user and ask for permission before making changes**. Do NOT automatically update `.md` files or trigger new searches yet. Once the user approves, you may actively search, read, and update the necessary docs in the correct layer. +**Identify missing documentation:** If you notice during your task that a frequently used pattern, underlying logic, or important behavior is missing from the docs, **and adding it would improve future LLM context-efficiency (saving searches/tokens)**, briefly notify the user to get approval. +**Topic-based separation:** When creating or expanding documentation, keep logically distinct features or domains in separate `.md` files (e.g., architecture, data model, billing) and only reference them in the main/index documents. Do not cram everything into a single monolithic file. Keep in mind: these `.md` files are primarily for LLM grounding and context providing. Keep them concise, structured, and focused on rules/patterns rather than human-readable prose. +**ENFORCEMENT:** At the end of EVERY code-modifying response, append a **`[DOCUMENTATION CHECK]`** section. Evaluate ONLY the `.md` files *already in your context*. State in 1-2 sentences if you found discrepancies or missing concepts, and ask if they should be documented. **DO NOT trigger searches or tool calls for this initial check**. 15. **MgGridBase** (AyCode.Blazor) is the canonical grid base for all data screens. New grids inherit `FruitBankGridBase`, set CRUD tags in the constructor, and use `MgGridWithInfoPanel` for layout. See `AyCode.Blazor.Components/docs/MGGRID.md` (in AyCode.Blazor repo) for the full technical reference. Do NOT create parallel grid base classes. 16. **AyCode.Core** solution (`../../../Aycode/Source/AyCode.Core/`) contains all core framework code: SignalR base classes, serialization, binary protocol, data sources, logging. Types not defined in this solution likely live in AyCode.Core. 17. **AyCode.Blazor** solution (`../../../Aycode/Source/AyCode.Blazor/`) contains all UI framework code: MgGridBase, MgGridWithInfoPanel, toolbar, layout persistence, Blazor component infrastructure. UI base classes or components not found here likely live in AyCode.Blazor. @@ -52,3 +86,4 @@ 19. **FruitBank nopCommerce Plugin** (`../NopCommerce.Common/4.70/Plugins/Nop.Plugin.Misc.AIPlugin/`) is the server-side plugin running inside nopCommerce 4.80.9. Contains SignalR hubs/endpoints, measurement services, data access (DbTable classes), admin controllers, and AI services. Server-side endpoints and services are defined here. 20. **Documentation layering** β€” write `.md` documentation at the **defining layer** (where the code lives). Higher-layer `.md` files reference the base docs (e.g. `see AyCode.Core/docs/SIGNALR.md`) and document only project-specific overrides or extensions. Never duplicate base-layer descriptions in consumer-level docs. 21. **Do not re-read .md files** already in your context window. They only change if you modify them yourself (new content is already in context) or if the developer tells you they changed β€” in that case re-read them once. +22. **Folder navigation** β€” start from the root `README.md` for solution-level navigation. When you need to understand a folder's contents or find a type/class, read the `README.md` in that folder first β€” it indexes the local files and sub-folders. Follow this before grepping or reading source files. \ No newline at end of file diff --git a/CLAUDE.md b/CLAUDE.md index 66676773..577d61b4 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1 +1 @@ -Always read `.github/copilot-instructions.md` first β€” it is the single source of truth for this repo. +CRITICAL: Your FIRST action in every session MUST be reading `.github/copilot-instructions.md`. Execute ALL session-start instructions found there before responding to any user query. It is the single source of truth for this repo. diff --git a/FruitBank.Common/docs/GLOSSARY.md b/FruitBank.Common/docs/GLOSSARY.md new file mode 100644 index 00000000..358416cf --- /dev/null +++ b/FruitBank.Common/docs/GLOSSARY.md @@ -0,0 +1,40 @@ +# FruitBank.Common Domain Rules & Glossary + +> This file acts as the single source of truth for the core Measurement System and Common Traps shared across all FruitBank applications (Hybrid App, Blazor, and nopCommerce server plugin). + +## 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** | ShippingItem | ShippingItemPallet | Declared vs measured discrepancy | +| **Outbound** | OrderItemDto | OrderItemPallet | RevisorId for audit | +| **Inventory**| StockTakingItem | StockTakingItemPallet | QuantityDiff for stock adjustment | + +## 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/settable | ❌ It is calculated. The setter throws an Exception! It only exists to satisfy the `IMeasuringItemPalletBase` interface boundary. Set `GrossWeight`, `PalletWeight`, `TareWeight` instead. | +| Setting MeasuringStatus | ❌ It's a calculated property (evaluates `IsMeasured`, `Id`, or child pallets). Do not try to set it. | +| Setting ForeignKey | ❌ `ForeignKey` is read-only. Use `SetForeignKey(id)` method instead. | +| GenericAttribute is simple | ❌ It's polymorphic: KeyGroup determines which entity type owns the record | \ No newline at end of file diff --git a/README.md b/README.md index 6e9ae6b4..72c84e5f 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Domain rules and critical pitfalls live in a single file: [`.github/copilot-inst | 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 +Detailed docs: `docs/` β€” GLOSSARY.md, ARCHITECTURE.md, CONVENTIONS.md. Domain model schema (TOON) lives in the plugin: `NopCommerce.Common/4.70/Plugins/Nop.Plugin.Misc.AIPlugin/docs/SCHEMA.md` ## Solution Structure diff --git a/docs/GLOSSARY.md b/docs/GLOSSARY.md index 4c78c6ea..b8eba883 100644 --- a/docs/GLOSSARY.md +++ b/docs/GLOSSARY.md @@ -2,6 +2,7 @@ > For core framework glossary see: `GLOSSARY.md` (in AyCode.Core repo) > For UI framework glossary see: `GLOSSARY.md` (in AyCode.Blazor repo) +> For core measurement system rules and common domain traps, see: `../FruitBank.Common/docs/GLOSSARY.md` Domain terminology for the FruitBank system. **Read this before making changes.** @@ -18,30 +19,6 @@ Domain terminology for the FruitBank system. **Read this before making changes.* | **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: @@ -51,17 +28,6 @@ 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 | - ## UI / Grid Components For MgGrid framework terms (MgGridBase, MgGridWithInfoPanel, MgGridToolbarBase, MgGridDataColumn, MgGridInfoPanel, IMgGridBase, etc.) see `GLOSSARY.md` (in AyCode.Blazor repo) and `AyCode.Blazor.Components/docs/MGGRID.md` (in AyCode.Blazor repo). diff --git a/docs/SCHEMA.md b/docs/SCHEMA.md deleted file mode 100644 index 7236c454..00000000 --- a/docs/SCHEMA.md +++ /dev/null @@ -1,635 +0,0 @@ -# Domain Model Schema (Toon Format) - -> Full domain model in Toon (Token-Oriented Object Notation) format β€” see `AyCode.Core/Serializers/Toons/README.md` (in AyCode.Core repo). -> 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 -}