Commit Graph

31 Commits

Author SHA1 Message Date
Misaka_Company
afc540005c feat: support off-shelf location registration 2026-05-13 12:43:17 +08:00
Misaka_Company
905988bed8 feat: support editable boxing assignments 2026-05-13 11:22:49 +08:00
Misaka_Company
53abead657 chore: ignore agent workspace 2026-05-13 09:52:23 +08:00
Misaka_Company
7fe1fe7ef5 feat(box): include work order numbers in box info 2026-05-13 09:48:08 +08:00
Misaka_Company
25982b12bf feat: add one-to-one box mode with duplicate bind check
Add box_mode field to BoxSaveRequest and DuplicateZongpaiBindError
exception. In one-to-one mode, prevent the same zongpai from being
packed into multiple boxes, returning 409 with existing box info.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-12 15:44:00 +08:00
Misaka_Company
ee2b2f8f25 feat: add PostgreSQL database backend support
Add multi-database support allowing selection between SQL Server and
PostgreSQL via database.active config. Changes include dialect-aware
SQL generation, cross-database timestamp functions, PostgreSQL connection
URL builder, and psycopg dependency.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-12 12:33:48 +08:00
Misaka_Company
4b8c502a91 chore: add settings.yaml template file
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-12 09:58:12 +08:00
Misaka_Company
b1e369e9f3 chore: remove settings.yaml from tracking and add to .gitignore
Contains database credentials, should not be versioned.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-12 09:56:54 +08:00
Misaka_Company
7305ad9ae6 refactor: migrate configuration from .env to YAML
Migrate FastAPI configuration from environment files (.env) to YAML
using pydantic-yaml library for better readability and maintainability.

Changes:
- Add pydantic-yaml dependency
- Create config/ module with Settings, SqlServerConfig classes
- Add config/settings.yaml for database configuration
- Update all imports from app.core.config to config.settings
- Add error handling for config loading on startup
- Remove old .env and app/core/config.py
- Update README with YAML configuration documentation
- Add test coverage for config loading

Test results:
- All 15 tests passing
- 88% code coverage maintained

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-12 09:50:40 +08:00
Misaka_Company
fb759ebe33 docs: update README with YAML configuration instructions
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-12 09:47:10 +08:00
Misaka_Company
b9e13105e1 chore: ignore local YAML config overrides
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-12 09:45:06 +08:00
Misaka_Company
70cb6759ea refactor: remove old .env and config.py files
Remove deprecated app/core/config.py as configuration is now managed
through the new YAML-based config module (app/config/).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-12 09:44:03 +08:00
Misaka_Company
f94a18fee7 feat: add config error handling on startup
Add error handling for configuration loading at application startup.
If the config file is missing or invalid, the app will exit with
a clear error message instead of crashing later.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-12 09:42:45 +08:00
Misaka_Company
a6873ae2ee fix: resolve YAML config path relative to project root
Ensure config/settings.yaml can be found when running from any working
directory by resolving the path relative to the settings.py file location
rather than the current working directory.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-12 09:40:46 +08:00
Misaka_Company
8292de7747 refactor: update database.py to use new config module
Update import statement from app.core.config to config.settings as part
of YAML configuration migration.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-12 09:37:52 +08:00
Misaka_Company
2f73dd07b5 test: add configuration loading tests
- Add test_config.py with tests for load_settings function
- Add test_config.yaml fixture with test database configuration
- Tests cover: successful loading, file not found error, database URL generation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-12 09:36:30 +08:00
Misaka_Company
7478b7176f feat: add YAML configuration module with pydantic-yaml
- Created config directory with settings.py, __init__.py, and settings.yaml
- Implemented SqlServerConfig and DatabaseConfig classes for SQL Server connections
- Added Settings class with database_url property for SQLAlchemy URL construction
- Uses parse_yaml_raw_as for UTF-8 safe YAML loading on Windows
- Configuration validated successfully via import test

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-12 09:35:03 +08:00
Misaka_Company
33fee72e3f deps: add pydantic-yaml for YAML configuration support
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-12 09:32:53 +08:00
Misaka_Company
71d261af26 docs: add YAML configuration implementation plan
Add detailed step-by-step implementation plan for migrating
from .env to YAML configuration using pydantic-yaml.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-12 09:26:26 +08:00
Misaka_Company
01423ccccc docs: add YAML configuration design document
Add design document for migrating from .env to YAML configuration
using pydantic-yaml.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-12 09:25:46 +08:00
Misaka_Company
c370ca36bc feat: add boxing module API — GET /box/info and POST /box
- Add box schemas (BoxInfoResponse, BoxSaveRequest, BoxSaveResponse)
- Add box service with ERP view query and save logic (supports many2one append)
- Add box router with GET /box/info and POST /box endpoints
- Register exception handlers for InvalidZongpaiError, ZongpaiNotFoundError, DuplicateBoxItemError
- Update RequestValidationError handler to cover INVALID_BOX_NO and INVALID_QUANTITY
- Add 7 integration tests for box API

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-11 18:04:13 +08:00
Misaka_Company
6e0e9d9584 chore: add .claude/ to gitignore
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-11 13:09:15 +08:00
Misaka_Company
6b722323ec docs: add implementation plans for shelf registration and 409 fix
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-11 13:08:05 +08:00
Misaka_Company
e9bb9d6be0 fix: unify error response format with error_code, message and domain fields
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-11 12:38:37 +08:00
Misaka_Company
6a4ea34e24 test: add integration tests for location API
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-11 11:16:33 +08:00
Misaka_Company
d68d602411 feat: add POST /CargoTrace/location endpoint
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-11 11:12:33 +08:00
Misaka_Company
e352d6dc18 feat: add location registration service
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-11 11:09:38 +08:00
Misaka_Company
7a3cc42798 feat: add pydantic schemas for location API
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-11 11:06:00 +08:00
Misaka_Company
e203008866 feat: add ORM models for finished goods tables
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-11 11:02:24 +08:00
Misaka_Company
0e7950d4c7 feat: add project config and database connection
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-11 10:59:57 +08:00
Misaka_Company
2cc476b314 Initial commit: Setup FastAPI project structure 2026-05-11 09:44:34 +08:00