FruitBankHybridApp/.github/copilot-instructions.md

4.2 KiB
Raw Blame History

FruitBankHybridApp — Domain Rules

This is the single source of truth for domain rules. Do not duplicate these elsewhere. For detailed docs see: README.mddocs/ For core framework rules see: ../../../Aycode/Source/AyCode.Core/.github/copilot-instructions.md For UI framework rules see: ../../../Aycode/Source/AyCode.Blazor/.github/copilot-instructions.md For nopCommerce library rules see: ../NopCommerce.Common/4.70/Libraries/.github/copilot-instructions.md

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

  1. IsMeasurable=false → weights are 0.0, only TrayQuantity is recorded. A Pallet record is still created.
  2. NetWeight = GrossWeight PalletWeight (TrayQuantity × TareWeight) — this formula is universal across ShippingItemPallet, OrderItemPallet, and StockTakingItemPallet.
  3. MeasuringStatus.Finnished — intentional legacy typo with double-n. Do NOT fix the spelling.
  4. MeasuringStatus progression: NotStarted(0) → Started(10) → Finnished(20) → Audited(30). OrderItemPallet adds Audited when RevisorId > 0.

Data Model

  1. GenericAttribute = polymorphic key-value store. KeyGroup = owner type name, EntityId = owner ID. ProductDto reads IsMeasurable, Tare, AverageWeight, IncomingQuantity, NetWeight from GenericAttributes.
  2. Three parallel measurement hierarchies share the same base (MeasuringItemPalletBase):
    • Shipping: ShippingItem → ShippingItemPallet
    • Order: OrderItemDto → OrderItemPallet (adds RevisorId for audit)
    • StockTaking: StockTakingItem → StockTakingItemPallet

Technical

  1. SignalR uses AcBinaryHubProtocol (custom binary), not default JSON.
  2. Do not suggest removal/rollback as a solution — find a fix for the problem.
  3. All AyCode references are via DLL (not ProjectReference) — this is intentional. nopCommerce 4.80.9 requirement.
  4. No redundant code — before writing new logic, search for existing methods. Reuse or extract shared logic into smaller methods rather than duplicating.
  5. Keep all .md files in sync — when you modify code, update any affected .md file (README.md, docs/, GLOSSARY, ARCHITECTURE, CONVENTIONS, SCHEMA, etc.). If you notice any .md content does not match the current code, fix it automatically.
  6. MgGridBase (AyCode.Blazor) is the canonical grid base for all data screens. New grids inherit FruitBankGridBase<TEntity>, set CRUD tags in the constructor, and use MgGridWithInfoPanel for layout. See AyCode.Blazor/docs/MGGRID.md for the full technical reference. Do NOT create parallel grid base classes.
  7. AyCode.Core solution (../../../Aycode/Source/AyCode.Core/) contains all core framework code: SignalR base classes, serialization, binary protocol, data sources, logging. When a type is referenced but not defined in this solution, look it up in AyCode.Core source and docs.
  8. AyCode.Blazor solution (../../../Aycode/Source/AyCode.Blazor/) contains all UI framework code: MgGridBase, MgGridWithInfoPanel, toolbar, layout persistence, Blazor component infrastructure. When a UI base class or component is not found here, look it up in AyCode.Blazor source and docs.
  9. Mango.Nop Libraries (../NopCommerce.Common/4.70/Libraries/) — independent shared library with its own .github/copilot-instructions.md and docs/. Contains DTOs, entities, data access, and service base classes. When a DTO or entity base class is not found in this solution, look it up in the Libraries source and docs.
  10. 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. When a server-side endpoint or service is referenced, look it up here.