编辑 | blame | 历史 | 原始文档

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Project Overview

This is a Manufacturing Execution System (MES) API built with ASP.NET Core 8.0 and Oracle database. The solution consists of two main projects:

  • MESApplication: Web API project with controllers and startup configuration
  • MES.Service: Service layer with business logic, data models, and database operations

Database Environment

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

  • PL/SQL Release 11.2.0.1.0 - Production
  • CORE 11.2.0.1.0 Production
  • TNS for 64-bit Windows: Version 11.2.0.1.0 - Production
  • NLSRTL Version 11.2.0.1.0 - Production

IMPORTANT: All code must be compatible with Oracle 11g Release 11.2.0.1.0
所有的回答都需要基于这个版本可以兼容的做法

Architecture

The project follows a layered architecture:

  • Controllers: Located in MESApplication/Controllers/ organized by domain (BasicData, QC, Warehouse)
  • Services: Business logic in MES.Service/service/ with managers for each domain
  • Models: Data models in MES.Service/Modes/ representing database entities
  • DTOs: Data transfer objects in MES.Service/Dto/ for API communication
  • Database: Oracle database access via SqlSugar ORM in MES.Service/DB/

Key Technologies

  • ASP.NET Core 8.0 Web API
  • Oracle Database with SqlSugar ORM
  • Swagger for API documentation
  • Newtonsoft.Json for JSON serialization
  • CORS enabled for cross-origin requests

Development Commands

Build and Run

# Build the entire solution
dotnet build MESApplication.sln

# Run the application in development mode
dotnet run --project MESApplication

# Run with specific profile
dotnet run --project MESApplication --launch-profile http

Development Server

  • Default URL: http://localhost:5184
  • Swagger UI: http://localhost:5184/swagger
  • IIS Express: http://localhost:10054

Database Operations

  • Uses SqlSugar ORM with Oracle database
  • Connection string configured in appsettings.json
  • Database context in MES.Service/DB/SqlSugarHelper.cs
  • SQL logging enabled in development for debugging

Project Structure

Domain Organization

The API is organized into several business domains:

  • BasicData: Core master data (customers, items, suppliers, etc.)
  • QC: Quality control processes (inspection, testing, suspension)
  • Warehouse: Inventory management (stock, movements, receipts)
  • MessageCenter: System notifications and messaging

Key Patterns

  • Repository pattern implemented in MES.Service/DB/Repository.cs
  • Service layer with manager classes for each entity
  • DTO pattern for API request/response objects
  • Action filters for cross-cutting concerns in MESApplication/Filter/

Configuration

Database Configuration

  • Oracle database connection in appsettings.json under AppSettings.DataBaseConn
  • ERP integration URLs configured in AppSettings section

API Configuration

  • Swagger documentation enabled in development
  • CORS configured to allow all origins
  • JSON serialization uses camelCase naming
  • XML documentation generation enabled

Testing

Use the MESApplication.http file for API testing with HTTP requests.

Development Notes

  • The application uses Chinese comments and naming conventions
  • Database entities follow Oracle naming conventions
  • API responses follow camelCase JSON format
  • All controllers inherit from base controller classes
  • Transaction support available through SqlSugarHelper.UseTransactionWithOracle()