ERP Enterprise Resource Planning

Core Positioning

ERP is the enterprise’s “purchase-sales-inventory hub” — managing the complete flow of physical goods and funds from supplier procurement, warehouse inventory to customer sales. 30+ tables cover five core areas: procurement, sales, inventory, products, and finance, suitable for daily operations management of trading and manufacturing enterprises.

In one sentence: Manage your goods and money, making every transaction traceable.


Problems Solved

Pain PointHow ERP Solves It
Inventory quantities rely on manual counting, often mismatchedEvery inbound/outbound transaction auto-updates inventory, real-time and accurate
Procurement and sales processes are opaqueDocument approval workflow + status tracking
Unclear how much profit is madeProcurement cost vs. sales revenue, auto-calculated
Multi-warehouse transfers are chaoticStock transfer operations are recorded, inventory locations are clear
Financial receivables and payables are hard to manageSettlement accounts + payment/receipt records

User Roles

graph LR subgraph Roles PURCHASER["Purchaser
Manage suppliers
Create purchase orders
Handle purchase inbound and returns"] SALES2["Salesperson
Manage customers
Create sales orders
Handle sales outbound and returns"] WAREHOUSE["Warehouse Keeper
Confirm inbound/outbound
Manage inventory
Execute stocktaking"] FINANCE["Finance
Manage settlement accounts
Handle payments/receipts
Review documents"] MANAGER2["Manager
Approve documents
View reports"] end

Five Core Modules

graph TB subgraph Procurement["Procurement Management"] P1["Supplier Management"] P2["Purchase Orders"] P3["Purchase Inbound"] P4["Purchase Returns"] end subgraph Sales["Sales Management"] S1["Customer Management"] S2["Sales Orders"] S3["Sales Outbound"] S4["Sales Returns"] end subgraph Inventory["Inventory Management"] I1["Inventory Query"] I2["Inventory Flow"] I3["Stock Transfer"] I4["Stocktaking"] end subgraph Products["Product Management"] PR1["Product Categories"] PR2["Product Information"] PR3["Product Units"] end subgraph Finance["Financial Management"] F1["Settlement Accounts"] F2["Purchase Payments"] F3["Sales Receipts"] end PI["Purchase Inbound"] -->|Inventory Increase| Inventory PR["Purchase Returns"] -->|Inventory Decrease| Inventory SO["Sales Outbound"] -->|Inventory Decrease| Inventory SR["Sales Returns"] -->|Inventory Increase| Inventory PO["Purchase Orders"] -->|Payment| Finance SO["Sales Orders"] -->|Receipt| Finance

Procurement Process

sequenceDiagram participant P as Purchaser participant ERP3 as ERP participant S as Supplier participant WH as Warehouse P->>ERP3: Select supplier, create purchase order ERP3->>ERP3: Order status: Pending Approval Note over ERP3: Can integrate BPM workflow approval ERP3->>ERP3: Approved P->>S: Notify supplier to ship S->>WH: Goods delivered WH->>ERP3: Create purchase inbound order ERP3->>ERP3: Inbound approved ERP3->>ERP3: Inventory increased Note over ERP3: If return needed P->>ERP3: Create purchase return order ERP3->>ERP3: Return approved → Inventory decreased

Sales Process

sequenceDiagram participant C as Customer participant S2 as Salesperson participant ERP4 as ERP participant WH2 as Warehouse C->>S2: Place purchase demand S2->>ERP4: Create sales order ERP4->>ERP4: Order approved S2->>WH2: Notify warehouse to prepare goods WH2->>ERP4: Create sales outbound order ERP4->>ERP4: Outbound approved ERP4->>ERP4: Inventory decreased WH2->>C: Ship goods Note over ERP4: If return needed S2->>ERP4: Create sales return order ERP4->>ERP4: Return approved → Inventory increased

Core Table Structure

erDiagram ERP_PRODUCT ||--o{ ERP_PURCHASE_ORDER_ITEM : "Procurement" ERP_PRODUCT ||--o{ ERP_SALE_ORDER_ITEM : "Sales" ERP_PRODUCT ||--o{ ERP_STOCK : "Inventory" ERP_PURCHASE_ORDER ||--o{ ERP_PURCHASE_ORDER_ITEM : "Contains" ERP_PURCHASE_ORDER ||--o{ ERP_PURCHASE_IN : "Inbound" ERP_SALE_ORDER ||--o{ ERP_SALE_ORDER_ITEM : "Contains" ERP_SALE_ORDER ||--o{ ERP_SALE_OUT : "Outbound" ERP_STOCK { bigint id PK bigint product_id FK "Product" bigint warehouse_id FK "Warehouse" int stock "Inventory Qty" } ERP_PURCHASE_ORDER { bigint id PK varchar no "Document No." bigint supplier_id FK "Supplier" tinyint status "Status" decimal total_price "Total Amount" } ERP_SALE_ORDER { bigint id PK varchar no "Document No." bigint customer_id FK "Customer" tinyint status "Status" decimal total_price "Total Amount" }

Document Number Rules

Format: {prefix}{yyyyMMdd}{6-digit auto-increment}
Example: CGD20240625000001 (Purchase Order)
          XSD20240625000001 (Sales Order)

Approval Mechanism

All inbound/outbound documents have an approval status (ErpAuditStatus):

StatusDescription
Not ApprovedDraft status, editable
ApprovedApproved, triggers inventory change

Key Rule: Only approved documents affect inventory; rejected documents produce no inventory changes.


Dependencies

ERP Purchase-Sales-Inventory
  └── BPM Workflow (Optional) —— Approval process
docs