Skip to content

feat: add comprehensive inventory management system#351

Draft
ljluestc wants to merge 2 commits intosuyuan32:mainfrom
ljluestc:feature/inventory-management-system
Draft

feat: add comprehensive inventory management system#351
ljluestc wants to merge 2 commits intosuyuan32:mainfrom
ljluestc:feature/inventory-management-system

Conversation

@ljluestc
Copy link

1. 环境准备

# 确保 MySQL 和 Redis 正在运行
brew services start mysql
brew services start redis

# 创建数据库
mysql -u root -e "CREATE DATABASE simple_admin;"

2. 启动服务

# 启动 RPC 服务
cd rpc && go run . &

# 启动 API 服务
cd api && go run . &

3. 测试仓库管理

# 创建仓库
curl -X POST http://localhost:9100/warehouse/create \
  -H "Content-Type: application/json" \
  -d '{
    "name": "主仓库",
    "location": "123 工业街",
    "capacity": 10000,
    "description": "主要存储仓库"
  }'

# 查询仓库列表
curl -X POST http://localhost:9100/warehouse/list \
  -H "Content-Type: application/json" \
  -d '{"page": 1, "pageSize": 10}'

4. 测试产品管理

# 创建产品
curl -X POST http://localhost:9100/product/create \
  -H "Content-Type: application/json" \
  -d '{
    "name": "笔记本电脑",
    "sku": "LT-001",
    "price": 1299.99,
    "category": "电子产品",
    "brand": "TechCorp"
  }'

# 查询产品列表
curl -X POST http://localhost:9100/product/list \
  -H "Content-Type: application/json" \
  -d '{"page": 1, "pageSize": 10}'

5. 测试库存管理

# 创建库存记录
curl -X POST http://localhost:9100/inventory/create \
  -H "Content-Type: application/json" \
  -d '{
    "product_id": 1,
    "warehouse_id": 1,
    "quantity": 100,
    "min_stock_level": 10,
    "max_stock_level": 500
  }'

# 查询库存列表
curl -X POST http://localhost:9100/inventory/list \
  -H "Content-Type: application/json" \
  -d '{"page": 1, "pageSize": 10}'

6. 测试库存变动

# 记录入库操作
curl -X POST http://localhost:9100/stock_movement/create \
  -H "Content-Type: application/json" \
  -d '{
    "product_id": 1,
    "warehouse_id": 1,
    "movement_type": "IN",
    "quantity": 25,
    "reference": "PO-2024-001",
    "notes": "收到新库存"
  }'

# 查询库存变动记录
curl -X POST http://localhost:9100/stock_movement/list \
  -H "Content-Type: application/json" \
  -d '{"page": 1, "pageSize": 10}'

- Add warehouse management with full CRUD operations
- Add product catalog management with full CRUD operations
- Add inventory tracking per warehouse with stock levels
- Add stock movement audit trail for inventory changes
- Implement Ent ORM entities for all inventory components
- Add gRPC services and REST API endpoints (16 total)
- Add proper data validation and error handling
- Update protobuf definitions and generated code
- Add Kubernetes deployment configurations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant