The Commercial Orders module is the commercial backbone of Dragon Guard WMS. It manages the four core business entities — customers, sellers, sales order documents, and purchase order documents — and provides the linkage layer that connects outgoing shipments to real commercial transactions. All entities are company-aware: every record is scoped to anDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/CodexaCP/DG_WEB/llms.txt
Use this file to discover all available pages before exploring further.
active_company_id through ApiControllerBase, preventing cross-tenant data exposure. The MAUI handheld is not involved in this phase; all operations are handled through the Angular web frontend.
Entity Model
The module is built around four entities, each with its own identity key and duplicate-control rules.Customer
Identified by
CompanyId + CustomerNo. Duplicate control is applied on tax ID and external identity.Seller
Identified by
CompanyId + SellerCode. Duplicate control is applied on email and external identity.Sales Order
Header + lines tracking customer, seller, dates, notes, totals, and Business Central (BC) identifiers.
Purchase Order
Header + lines tracking vendor snapshot, dates, notes, totals, and BC identifiers.
Entity Reference
Customer
| Field | Description |
|---|---|
CompanyId | Tenant company scope |
CustomerNo | Unique customer code within the company |
Name | Customer display name |
TaxId | Tax identification number (duplicate-controlled) |
ExternalIdentity | Third-party system identifier (duplicate-controlled) |
Address | Registered address |
Contact | Primary contact information |
Status | Active / Inactive |
Seller
| Field | Description |
|---|---|
CompanyId | Tenant company scope |
SellerCode | Unique seller code within the company |
Name | Seller display name |
Email | Seller email address (duplicate-controlled) |
ExternalIdentity | Third-party system identifier (duplicate-controlled) |
Status | Active / Inactive |
Sales Order Header / Line
| Field | Description |
|---|---|
CompanyId | Tenant company scope |
SalesOrderNo | Auto-generated document number |
CustomerId / CustomerName | Linked customer (snapshot at creation) |
SellerId / SellerCode | Assigned seller (snapshot at creation) |
OrderDate / ShipDate | Key dates |
Notes | Free-text notes |
Totals | Line-aggregated document totals |
BcIdentifiers | Business Central reference fields |
Purchase Order Header / Line
| Field | Description |
|---|---|
CompanyId | Tenant company scope |
PurchaseOrderNo | Auto-generated document number |
VendorNo / VendorName | Vendor snapshot at document creation |
TaxId | Vendor tax ID at creation time |
Address / Contact | Vendor contact snapshot |
OrderDate / ReceiveDate | Key dates |
Notes | Free-text notes |
Totals | Line-aggregated document totals |
BcIdentifiers | Business Central reference fields |
Snapshot Rule
Document creation stores a point-in-time snapshot of master data. When a sales order is created, the customer name, tax ID, address, and contact are copied into the document record. Subsequent changes to the customer master record do not modify existing documents. The same rule applies to vendor data on purchase orders and seller data on sales orders. This ensures that historical documents remain accurate and auditable regardless of future master-data edits.
Vendor Master
Although there is no dedicatedVendor entity exposed in the frontend at this phase, the purchase order stores a full vendor snapshot at creation time using the following fields:
| Field | Description |
|---|---|
CompanyId | Tenant company scope |
VendorNo | Unique vendor code |
Name | Vendor name |
TaxId | Tax identification (snapshot) |
Address | Registered address (snapshot) |
Contact | Primary contact (snapshot) |
Status | Active / Inactive |
Frontend Module Structure
All commercial order components live undersrc/app/sales/. The table below maps each functional area to its frontend location.
| Area | Location in sales/ | Description |
|---|---|---|
| Sales order list | sales-orders/ | Paginated list of all sales orders for the active company |
| Sales order create / detail | sales-orders/create or sales-orders/:id | Form for creating and viewing sales order headers and lines |
| Customer maintenance | customers/ | Create, list, and edit customers |
| Seller maintenance | sellers/ | Create, list, and edit sellers |
| Purchase order list | purchase-orders/ | Paginated list of all purchase orders |
| Purchase order create | purchase-orders/create | Form for creating purchase order headers and lines |
| Shipment create (sales link) | shipments/create | Includes the sales-order lookup dialog for linking shipments |
Shipment-to-Sales-Order Link
Shipment documents (ShipmentHeaders) support an optional SalesOrderId and SalesOrderNo field.
- Without Sales Order
- With Sales Order
The shipment is created as a standalone outbound document. Customer name and commercial fields are entered manually. No commercial validation is performed against the sales order layer.
Duplicate Validation
The backend enforces uniqueness constraints and returns localized error keys when violations occur. The web UI resolves these keys through the Angular i18n layer and displays them in a blocking modal.| Error Key | Entity | Duplicate Field |
|---|---|---|
validation.salesOrderDuplicate | Sales Order | Duplicate document reference or BC identifier |
validation.customerDuplicate | Customer | Tax ID or external identity already registered for the company |
Database Migrations
On application startup,Wms.Api calls Database.Migrate() to apply any pending Entity Framework migrations automatically. No manual migration steps are required for new deployments or updates. This ensures the schema is always in sync with the current version of the backend without operator intervention.
API Endpoints
All endpoints are company-aware throughApiControllerBase. The companyId claim is read from the JWT and applied server-side — it does not need to be passed as an explicit query parameter on POST and PUT requests.
| Method | Endpoint | Entity | Purpose |
|---|---|---|---|
GET | /api/customers | Customer | List all customers for the active company |
POST | /api/customers | Customer | Create a new customer |
PUT | /api/customers/{id} | Customer | Update an existing customer |
GET | /api/sellers | Seller | List all sellers for the active company |
POST | /api/sellers | Seller | Create a new seller |
PUT | /api/sellers/{id} | Seller | Update an existing seller |
GET | /api/sales-orders | Sales Order | List all sales orders for the active company |
POST | /api/sales-orders | Sales Order | Create a new sales order with lines |
PUT | /api/sales-orders/{id} | Sales Order | Update an existing sales order |
GET | /api/purchase-orders | Purchase Order | List all purchase orders for the active company |
POST | /api/purchase-orders | Purchase Order | Create a new purchase order with lines |
PUT | /api/purchase-orders/{id} | Purchase Order | Update an existing purchase order |
GET | /api/shipmentheaders | Shipment | List shipments (see Shipments module) |
POST | /api/shipmentheaders | Shipment | Create shipment, optionally linked to sales order |