CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
This is a .NET 8 MES (Manufacturing Execution System) solution built with ASP.NET Core Web API. The system is organized as a modular monolith with domain-separated projects for different business areas.
Solution Structure
The solution follows a modular architecture with these main projects:
- Gs.HostIIS: Main Web API host application with Swagger documentation
- Gs.Entity: Data entities organized by business domains (BaseInfo, QC, Sys, Warehouse)
- Gs.Toolbox: Core utilities, API framework, and dependency injection infrastructure
- Business Modules:
- Gs.BaseInfo: Basic information management (items, customers, suppliers, staff, etc.)
- Gs.Warehouse: Inventory and warehouse management
- GS.QC: Quality control functionality
- Gs.Sys: System administration and user management
- Gs.Report: Reporting functionality
- Gs.Wom: Work order management
- Gs.Sales: Sales management
- Gs.Pda: Mobile/handheld device support
- Gs.QiTaCk / Gs.QiTaRk: Additional business modules (其它出库/其它入库)
- Gs.Ww: Outsourcing management (委外)
- Gs.JJGZ: Piece-rate wage management (计件工资)
Development Commands
Build and Run
- Build entire solution:
dotnet build GsMesSolution.sln
- Run main API:
dotnet run --project Gs.HostIIS
- Build specific project:
dotnet build Gs.ProjectName/Gs.ProjectName.csproj
Development Server
- The API runs on default ports (check launchSettings.json for specific ports)
- Swagger UI is available at
/swagger
endpoint
- CORS is configured to allow all origins for development
Architecture Details
Custom API Framework
The solution uses a custom API framework built in Gs.Toolbox
:
- Custom dependency injection with lifecycle attributes (ITransient
, IScope
, ISingleton
)
- Custom controller convention via CustomApplicationModelConvention
- API grouping for Swagger documentation via ApiGroupAttribute
- Custom authorization with ApiAuthorizeAttribute
Data Access
- Uses SqlSugar ORM for database operations
- Connection string configured in
appsettings.json
- Repository pattern implemented in
Gs.Toolbox/Repository.cs
Configuration
- Database: SQL Server (connection string in appsettings.json)
- External services: ERP integration endpoints configured
- File paths: Services, logs, upload, and download paths configured
- Custom JSON serialization with Newtonsoft.Json
Key Components
- CustomContractResolver: Custom JSON property naming (converts to camelCase)
- ReturnDto: Standardized API response format with RtnCode, RtnData, RtnMsg
- PageList and PageQuery: Pagination support
- ExcelHelper: Excel import/export functionality
- LogHelper: Logging utilities
- DbHelperSQL: Additional database utilities
Framework Features
- Custom controller discovery via
CustomControllerFeatureProvider
- Module system with
IModule
interface for extensibility
- Dependency injection container with custom lifecycle management
- API grouping system for organized Swagger documentation
Business Domains
The system handles typical MES functionality organized by API groups:
- Base information (BaseInfo): Items, customers, suppliers, departments, staff
- Quality control (QC): Inspection projects and quality management
- Warehouse (PerMission): Inventory and warehouse operations
- Work orders (WOM): Manufacturing execution
- ERP integration (ErpMes): Data exchange with ERP systems
- Reporting (Report/Rport): Various business reports
- Mobile support (PDA): Handheld device operations
- Additional modules: Sales (XS), Outsourcing (WW), etc.
Development Notes
- All projects target .NET 8.0 (except Gs.Toolbox which targets .NET 6.0)
- Nullable reference types are enabled
- The system uses a Chinese interface (comments and some naming in Chinese)
- Custom API framework provides dependency injection and controller conventions
- Swagger documentation is automatically generated with XML comments from Services folder
- Response format follows ReturnDto pattern with standardized error codes
- File upload/download paths are configured and served as static files