Compare commits
30 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 11e8a3c7f8 | |||
| 65e3769eb2 | |||
| 4dd6098619 | |||
| 70e49f0556 | |||
| 73572b6211 | |||
| 2439d5e24d | |||
| 977167a0db | |||
| fa0da0b159 | |||
| 823a9a64e2 | |||
| 0a2f0eb4a1 | |||
| 8dabffc08a | |||
| 88e3d58664 | |||
| 477bd693c1 | |||
| 279d1760ef | |||
| 70824c2afb | |||
| 99943d9871 | |||
| b34b0dd7d6 | |||
| 15dc3685df | |||
| 0256898d53 | |||
| 9a5254d06e | |||
| b330f5f1bf | |||
| 6a7a01621d | |||
| 419f067405 | |||
| b038181ebf | |||
| 7cef465ba3 | |||
| 2816e31075 | |||
| 8104437992 | |||
| d5097ad809 | |||
| 4695de8783 | |||
| 284cac18f3 |
@@ -0,0 +1,63 @@
|
|||||||
|
name: Frontend CI Pipeline
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main, master, "feature/**" ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ main, master ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
ci-frontend-8-steps:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Source Code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup Node.js Environment
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: '20'
|
||||||
|
cache: 'npm'
|
||||||
|
cache-dependency-path: 'src/frontend/package-lock.json'
|
||||||
|
|
||||||
|
- name: 1. Install Dependencies
|
||||||
|
run: |
|
||||||
|
cd src/frontend
|
||||||
|
npm ci
|
||||||
|
|
||||||
|
- name: 2. TypeScript Strict TypeCheck
|
||||||
|
run: |
|
||||||
|
cd src/frontend
|
||||||
|
npm run type-check
|
||||||
|
|
||||||
|
- name: 3. Lint & Boundary Rules Check
|
||||||
|
run: |
|
||||||
|
cd src/frontend
|
||||||
|
echo "Checking import boundary rules..."
|
||||||
|
# Prevent direct domain -> Vue/Router imports
|
||||||
|
! grep -r "import.*from ['\"]vue['\"]" src/domain 2>/dev/null || exit 1
|
||||||
|
|
||||||
|
- name: 4. Unit Testing (Vitest)
|
||||||
|
run: |
|
||||||
|
cd src/frontend
|
||||||
|
npm run test:unit
|
||||||
|
|
||||||
|
- name: 5. Enterprise Contract Parity Test
|
||||||
|
run: |
|
||||||
|
python tools/validate_enterprise_crud_specification_v1.py
|
||||||
|
|
||||||
|
- name: 6. Vite Production Build
|
||||||
|
run: |
|
||||||
|
cd src/frontend
|
||||||
|
npm run build
|
||||||
|
|
||||||
|
- name: 7. End-to-End Testing (Playwright)
|
||||||
|
run: |
|
||||||
|
cd src/frontend
|
||||||
|
npx playwright install --with-deps chromium
|
||||||
|
npm run test:e2e --if-present
|
||||||
|
|
||||||
|
- name: 8. Security Audit & Secret Detection
|
||||||
|
run: |
|
||||||
|
cd src/frontend
|
||||||
|
npm audit --audit-level=high || true
|
||||||
@@ -1,644 +0,0 @@
|
|||||||
name: Deploy to Production
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ main ]
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
# Phase 4: Manual-only deployment (improved & hardened)
|
|
||||||
# Automatic deployment moved to merge-to-main.yml (Stage 5)
|
|
||||||
# Use this workflow for manual deployments when needed
|
|
||||||
#
|
|
||||||
# Error handling: Comprehensive logging + automatic rollback
|
|
||||||
# Security: SSH key validation, deployment verification
|
|
||||||
# Observability: Detailed stage reporting + Telegram notifications
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: deploy-prod-main
|
|
||||||
cancel-in-progress: false
|
|
||||||
|
|
||||||
env:
|
|
||||||
DEPLOY_HOST: quant.taxbaik.com
|
|
||||||
DEPLOY_USER: kjh2064
|
|
||||||
SERVICE_NAME: quantengine
|
|
||||||
DOTNET_VERSION: '10.0.x'
|
|
||||||
QUANTENGINE_DB_NAME: quantenginedb
|
|
||||||
QUANTENGINE_DB_USER: quantengine_app
|
|
||||||
TELEGRAM_BOT_TOKEN_DEFAULT: "8734507814:AAFyacLMai8GB4K-hQ_Nd3t3D01A-H1ZdV0"
|
|
||||||
TELEGRAM_CHAT_ID_DEFAULT: "-5460205872"
|
|
||||||
DEPLOY_TIMEOUT: "600"
|
|
||||||
HEALTH_CHECK_RETRIES: "5"
|
|
||||||
HEALTH_CHECK_DELAY: "3"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-and-deploy:
|
|
||||||
name: Build & Deploy to Production
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
timeout-minutes: 30
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout Code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Setup .NET
|
|
||||||
uses: actions/setup-dotnet@v3
|
|
||||||
with:
|
|
||||||
dotnet-version: ${{ env.DOTNET_VERSION }}
|
|
||||||
|
|
||||||
- name: Setup Python
|
|
||||||
uses: actions/setup-python@v4
|
|
||||||
with:
|
|
||||||
python-version: '3.10'
|
|
||||||
|
|
||||||
- name: Install Python Dependencies
|
|
||||||
run: pip install pyyaml openpyxl requests
|
|
||||||
|
|
||||||
- name: "[GATE] Run Core Validations"
|
|
||||||
run: |
|
|
||||||
echo " Running critical CI validations..."
|
|
||||||
python3 tools/validate_no_direct_api_trading_v1.py || exit 1
|
|
||||||
python3 tools/validate_specs.py || exit 1
|
|
||||||
echo " All critical validations passed"
|
|
||||||
|
|
||||||
- name: Ensure Temp Directory and Mock Packet
|
|
||||||
run: |
|
|
||||||
mkdir -p Temp
|
|
||||||
if [ ! -f Temp/final_decision_packet_active.json ]; then
|
|
||||||
echo '{"active_decision": "PASS", "details": "CI dummy packet"}' > Temp/final_decision_packet_active.json
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Restore Dependencies
|
|
||||||
run: dotnet restore src/dotnet/QuantEngine.Web/QuantEngine.Web.csproj
|
|
||||||
|
|
||||||
- name: Build Release
|
|
||||||
run: |
|
|
||||||
dotnet build src/dotnet/QuantEngine.Web/QuantEngine.Web.csproj \
|
|
||||||
-c Release \
|
|
||||||
--no-restore
|
|
||||||
|
|
||||||
- name: Run Unit Tests
|
|
||||||
run: |
|
|
||||||
dotnet test src/dotnet/QuantEngine.Core.Tests/QuantEngine.Core.Tests.csproj \
|
|
||||||
-c Release \
|
|
||||||
--no-build
|
|
||||||
|
|
||||||
- name: Publish Release Package
|
|
||||||
run: |
|
|
||||||
dotnet publish src/dotnet/QuantEngine.Web/QuantEngine.Web.csproj \
|
|
||||||
-c Release \
|
|
||||||
--no-build \
|
|
||||||
-o ./publish
|
|
||||||
|
|
||||||
- name: Generate Build Info
|
|
||||||
run: |
|
|
||||||
COMMIT_HASH=$(git rev-parse --short HEAD)
|
|
||||||
BUILD_TIME=$(date -d "+9 hours" +'%Y-%m-%d %H:%M:%S KST')
|
|
||||||
mkdir -p ./publish/wwwroot
|
|
||||||
printf '{\n "version": "1.0.%s-%s",\n "built": "%s"\n}\n' "${{ github.run_number }}" "$COMMIT_HASH" "$BUILD_TIME" > ./publish/wwwroot/version.json
|
|
||||||
echo " Generated version info: 1.0.${{ github.run_number }}-$COMMIT_HASH @ $BUILD_TIME"
|
|
||||||
|
|
||||||
- name: Prepare & Validate QuantEngine DB Env
|
|
||||||
run: |
|
|
||||||
echo " Preparing database environment..."
|
|
||||||
|
|
||||||
DB_PASSWORD="${{ secrets.QUANTENGINE_DB_PASSWORD }}"
|
|
||||||
if [ -z "$DB_PASSWORD" ]; then
|
|
||||||
echo " QUANTENGINE_DB_PASSWORD secret not configured in Gitea"
|
|
||||||
echo " Please set secret in Repository Settings > Secrets"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${{ env.QUANTENGINE_DB_NAME }}" ] || [ -z "${{ env.QUANTENGINE_DB_USER }}" ]; then
|
|
||||||
echo " DB configuration environment variables not set"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
mkdir -p ./deploy
|
|
||||||
printf 'ConnectionStrings__DefaultConnection=Host=127.0.0.1;Database=%s;Username=%s;Password=%s;Search Path=quantengine;\n' \
|
|
||||||
"${{ env.QUANTENGINE_DB_NAME }}" \
|
|
||||||
"${{ env.QUANTENGINE_DB_USER }}" \
|
|
||||||
"$DB_PASSWORD" > ./deploy/quantengine.env
|
|
||||||
chmod 600 ./deploy/quantengine.env
|
|
||||||
|
|
||||||
# appsettings.Production.json
|
|
||||||
mkdir -p ./publish
|
|
||||||
cat <<EOF > ./publish/appsettings.Production.json
|
|
||||||
{
|
|
||||||
"ConnectionStrings": {
|
|
||||||
"DefaultConnection": "Host=127.0.0.1;Database=${{ env.QUANTENGINE_DB_NAME }};Username=${{ env.QUANTENGINE_DB_USER }};Password=${DB_PASSWORD};Search Path=quantengine;"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
chmod 600 ./publish/appsettings.Production.json
|
|
||||||
|
|
||||||
if [ ! -f ./deploy/quantengine.env ] || [ ! -f ./publish/appsettings.Production.json ]; then
|
|
||||||
echo " Failed to create database config files"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo " Database configuration prepared"
|
|
||||||
|
|
||||||
- name: Copy Deployment Scripts
|
|
||||||
run: |
|
|
||||||
echo " Copying deployment scripts..."
|
|
||||||
cp deploy_gb.sh ./publish/deploy_gb.sh
|
|
||||||
mkdir -p ./publish/scripts
|
|
||||||
cp scripts/validate_migrations.sh ./publish/scripts/validate_migrations.sh
|
|
||||||
chmod +x ./publish/deploy_gb.sh ./publish/scripts/validate_migrations.sh
|
|
||||||
echo " Deployment scripts copied"
|
|
||||||
|
|
||||||
- name: Package Artifact
|
|
||||||
run: |
|
|
||||||
echo " Creating deployment package..."
|
|
||||||
|
|
||||||
if ! tar -czf quantengine.tar.gz -C ./publish .; then
|
|
||||||
echo " Failed to create package"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
PACKAGE_SIZE=$(du -sh quantengine.tar.gz | cut -f1)
|
|
||||||
PACKAGE_BYTES=$(stat -c%s quantengine.tar.gz 2>/dev/null || echo "0")
|
|
||||||
|
|
||||||
if [ -z "$PACKAGE_BYTES" ] || [ "$PACKAGE_BYTES" -lt 1000000 ]; then
|
|
||||||
echo " Warning: Package seems too small ($PACKAGE_SIZE)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -f quantengine.tar.gz ]; then
|
|
||||||
echo " Package file not created"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo " Package created: $PACKAGE_SIZE"
|
|
||||||
tar -tzf quantengine.tar.gz | head -n 5 || true
|
|
||||||
|
|
||||||
- name: Pre-Deployment Migration Validation
|
|
||||||
run: |
|
|
||||||
echo "=== Pre-Deployment Database Check ==="
|
|
||||||
|
|
||||||
# ()
|
|
||||||
TEMP_DEPLOY="/tmp/quantengine_validate"
|
|
||||||
mkdir -p "$TEMP_DEPLOY"
|
|
||||||
tar -xzf quantengine.tar.gz -C "$TEMP_DEPLOY"
|
|
||||||
|
|
||||||
#
|
|
||||||
chmod +x "$TEMP_DEPLOY/scripts/validate_migrations.sh"
|
|
||||||
"$TEMP_DEPLOY/scripts/validate_migrations.sh" "$TEMP_DEPLOY"
|
|
||||||
|
|
||||||
#
|
|
||||||
rm -rf "$TEMP_DEPLOY"
|
|
||||||
|
|
||||||
- name: Pre-Deployment Verification
|
|
||||||
run: |
|
|
||||||
echo "=== PRE-DEPLOYMENT CHECKS ==="
|
|
||||||
|
|
||||||
# 1. SSH
|
|
||||||
if [ ! -f ~/.ssh/id_rsa ]; then
|
|
||||||
echo "ERROR: SSH key not found"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "OK: SSH key present"
|
|
||||||
|
|
||||||
# 2.
|
|
||||||
if [ ! -f quantengine.tar.gz ]; then
|
|
||||||
echo "ERROR: Build artifact (quantengine.tar.gz) not found"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
ARTIFACT_SIZE=$(stat -c%s quantengine.tar.gz)
|
|
||||||
if [ "$ARTIFACT_SIZE" -lt 1000000 ]; then
|
|
||||||
echo "WARNING: Artifact seems small (${ARTIFACT_SIZE} bytes), but proceeding"
|
|
||||||
fi
|
|
||||||
echo "OK: Build artifact present (${ARTIFACT_SIZE} bytes)"
|
|
||||||
|
|
||||||
# 3.
|
|
||||||
for file in deploy/quantengine.env deploy_gb.sh; do
|
|
||||||
if [ ! -f "$file" ]; then
|
|
||||||
echo "ERROR: Required file missing: $file"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
echo "OK: All required deployment files present"
|
|
||||||
|
|
||||||
# 4.
|
|
||||||
if [ -z "${{ secrets.QUANTENGINE_DB_PASSWORD }}" ]; then
|
|
||||||
echo "ERROR: DB password secret not configured"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "OK: DB credentials configured"
|
|
||||||
|
|
||||||
echo "=== ALL PRE-DEPLOYMENT CHECKS PASSED ==="
|
|
||||||
|
|
||||||
- name: Local Deploy (Green-Blue)
|
|
||||||
id: deploy
|
|
||||||
run: |
|
|
||||||
set -e
|
|
||||||
|
|
||||||
#
|
|
||||||
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
|
|
||||||
COMMIT=$(git rev-parse --short HEAD)
|
|
||||||
RUN_NUM="${{ github.run_number }}"
|
|
||||||
DEPLOY_BASE="/home/kjh2064/deployments"
|
|
||||||
ACTIVE_LINK="/home/kjh2064/quantengine_active"
|
|
||||||
TARGET_DIR="${DEPLOY_BASE}/quantengine_${TIMESTAMP}_${COMMIT}_${RUN_NUM}"
|
|
||||||
DEPLOYMENT_LOG="./deployment_${TIMESTAMP}.log"
|
|
||||||
|
|
||||||
TELEGRAM_BOT_TOKEN="${{ secrets.TELEGRAM_BOT_TOKEN }}"
|
|
||||||
[ -z "$TELEGRAM_BOT_TOKEN" ] && TELEGRAM_BOT_TOKEN="${{ env.TELEGRAM_BOT_TOKEN_DEFAULT }}"
|
|
||||||
TELEGRAM_CHAT_ID="${{ secrets.TELEGRAM_CHAT_ID }}"
|
|
||||||
[ -z "$TELEGRAM_CHAT_ID" ] && TELEGRAM_CHAT_ID="${{ env.TELEGRAM_CHAT_ID_DEFAULT }}"
|
|
||||||
|
|
||||||
send_telegram() {
|
|
||||||
local text="$1"
|
|
||||||
curl -fsS -X POST "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage" \
|
|
||||||
-d "chat_id=${TELEGRAM_CHAT_ID}" \
|
|
||||||
--data-urlencode "text=${text}" \
|
|
||||||
-d "parse_mode=HTML" >/dev/null || true
|
|
||||||
}
|
|
||||||
|
|
||||||
trap 'on_error' ERR
|
|
||||||
on_error() {
|
|
||||||
echo "DEPLOYMENT FAILED" | tee -a "$DEPLOYMENT_LOG"
|
|
||||||
send_telegram "DEPLOYMENT FAILED: $COMMIT at $(date)"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
echo "=== DEPLOYMENT START: $TIMESTAMP ==="
|
|
||||||
echo "Commit: $COMMIT"
|
|
||||||
echo "Run: $RUN_NUM"
|
|
||||||
echo "Target: $TARGET_DIR"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
#
|
|
||||||
echo "[1/8] Creating deployment directories..."
|
|
||||||
mkdir -p "${DEPLOY_BASE}" || { echo "FATAL: Cannot create deploy base"; exit 1; }
|
|
||||||
mkdir -p "${TARGET_DIR}" || { echo "FATAL: Cannot create target dir"; exit 1; }
|
|
||||||
echo "OK: Directories created"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
#
|
|
||||||
echo "[2/8] Extracting build artifact..."
|
|
||||||
if ! tar -xzf quantengine.tar.gz -C "${TARGET_DIR}"; then
|
|
||||||
echo "FATAL: Failed to extract artifact"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "OK: Artifact extracted"
|
|
||||||
ls "${TARGET_DIR}" | head -10
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
#
|
|
||||||
echo "[3/8] Normalizing deployment structure..."
|
|
||||||
if [ -d "${TARGET_DIR}/net10.0" ]; then
|
|
||||||
echo "Found net10.0 subdirectory, moving to root..."
|
|
||||||
if ! mv "${TARGET_DIR}/net10.0"/* "${TARGET_DIR}/"; then
|
|
||||||
echo "WARNING: Some files could not be moved from net10.0"
|
|
||||||
fi
|
|
||||||
if [ -d "${TARGET_DIR}/net10.0" ]; then
|
|
||||||
rmdir "${TARGET_DIR}/net10.0" 2>/dev/null || echo "Warning: Could not remove net10.0 dir"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
echo "OK: Structure normalized"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
#
|
|
||||||
echo "[4/8] Validating deployment contents..."
|
|
||||||
if [ ! -f "${TARGET_DIR}/QuantEngine.Web.dll" ]; then
|
|
||||||
echo "FATAL: QuantEngine.Web.dll not found in deployment"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [ ! -f "${TARGET_DIR}/appsettings.json" ]; then
|
|
||||||
echo "FATAL: appsettings.json not found"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "OK: All required files present"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
#
|
|
||||||
echo "[5/8] Installing environment configuration..."
|
|
||||||
mkdir -p /home/kjh2064/.config || { echo "WARNING: Cannot create config dir"; }
|
|
||||||
install -m 600 ./deploy/quantengine.env /home/kjh2064/.config/quantengine.env || { echo "WARNING: Config file install failed"; }
|
|
||||||
echo "OK: Configuration installed"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
# appsettings.Production.json
|
|
||||||
echo "[6/8] Creating production appsettings..."
|
|
||||||
mkdir -p "${TARGET_DIR}"
|
|
||||||
DB_PASSWORD="${{ secrets.QUANTENGINE_DB_PASSWORD }}"
|
|
||||||
cat > "${TARGET_DIR}/appsettings.Production.json" << EOF
|
|
||||||
{
|
|
||||||
"Logging": {
|
|
||||||
"LogLevel": {
|
|
||||||
"Default": "Information",
|
|
||||||
"Microsoft.AspNetCore": "Warning"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"AllowedHosts": "*",
|
|
||||||
"ConnectionStrings": {
|
|
||||||
"DefaultConnection": "Host=127.0.0.1;Database=quantenginedb;Username=quantengine_app;Password=${DB_PASSWORD};Search Path=quantengine;"
|
|
||||||
},
|
|
||||||
"AdminSettings": {
|
|
||||||
"Username": "admin",
|
|
||||||
"Password": "quant123!"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
chmod 600 "${TARGET_DIR}/appsettings.Production.json"
|
|
||||||
echo "OK: appsettings.Production.json created"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
} | tee "$DEPLOYMENT_LOG"
|
|
||||||
|
|
||||||
echo "timestamp=${TIMESTAMP}" >> $GITHUB_OUTPUT
|
|
||||||
echo "commit=${COMMIT}" >> $GITHUB_OUTPUT
|
|
||||||
echo "target_dir=${TARGET_DIR}" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
# ()
|
|
||||||
PREV_VERSION="none"
|
|
||||||
if [ -L "${ACTIVE_LINK}" ]; then
|
|
||||||
PREV_VERSION=$(readlink -f "${ACTIVE_LINK}")
|
|
||||||
PREV_TIMESTAMP=$(basename "${PREV_VERSION}")
|
|
||||||
else
|
|
||||||
PREV_TIMESTAMP="none"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "[7/8] Executing Green-Blue deployment..."
|
|
||||||
export DEPLOY_FROM_CI=1
|
|
||||||
chmod +x "${TARGET_DIR}/deploy_gb.sh"
|
|
||||||
|
|
||||||
if ! "${TARGET_DIR}/deploy_gb.sh" >> "$DEPLOYMENT_LOG" 2>&1; then
|
|
||||||
echo "DEPLOYMENT FAILED: Green-Blue swap error"
|
|
||||||
send_telegram "DEPLOYMENT FAILED: Green-Blue swap failed for $COMMIT"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "OK: Green-Blue deployment completed"
|
|
||||||
|
|
||||||
#
|
|
||||||
cat > "${TARGET_DIR}/.deployment_info" << EOF
|
|
||||||
Deployed: $(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
|
||||||
Commit: ${COMMIT}
|
|
||||||
Timestamp: ${TIMESTAMP}
|
|
||||||
Run: ${RUN_NUM}
|
|
||||||
Previous: ${PREV_TIMESTAMP}
|
|
||||||
Status: DEPLOYED
|
|
||||||
EOF
|
|
||||||
|
|
||||||
echo "timestamp=${TIMESTAMP}" >> $GITHUB_OUTPUT
|
|
||||||
echo "commit=${COMMIT}" >> $GITHUB_OUTPUT
|
|
||||||
echo "target_dir=${TARGET_DIR}" >> $GITHUB_OUTPUT
|
|
||||||
echo "prev_version=${PREV_TIMESTAMP}" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Health Check & Verification
|
|
||||||
id: health-check
|
|
||||||
run: |
|
|
||||||
TIMESTAMP="${{ steps.deploy.outputs.timestamp }}"
|
|
||||||
COMMIT="${{ steps.deploy.outputs.commit }}"
|
|
||||||
TARGET_DIR="${{ steps.deploy.outputs.target_dir }}"
|
|
||||||
PREV_TIMESTAMP="${{ steps.deploy.outputs.prev_version }}"
|
|
||||||
DEPLOY_BASE="/home/kjh2064/deployments"
|
|
||||||
ACTIVE_LINK="/home/kjh2064/quantengine_active"
|
|
||||||
|
|
||||||
TELEGRAM_BOT_TOKEN="${{ secrets.TELEGRAM_BOT_TOKEN }}"
|
|
||||||
[ -z "$TELEGRAM_BOT_TOKEN" ] && TELEGRAM_BOT_TOKEN="${{ env.TELEGRAM_BOT_TOKEN_DEFAULT }}"
|
|
||||||
TELEGRAM_CHAT_ID="${{ secrets.TELEGRAM_CHAT_ID }}"
|
|
||||||
[ -z "$TELEGRAM_CHAT_ID" ] && TELEGRAM_CHAT_ID="${{ env.TELEGRAM_CHAT_ID_DEFAULT }}"
|
|
||||||
|
|
||||||
send_telegram() {
|
|
||||||
local text="$1"
|
|
||||||
curl -fsS -X POST "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage" \
|
|
||||||
-d "chat_id=${TELEGRAM_CHAT_ID}" \
|
|
||||||
--data-urlencode "text=${text}" \
|
|
||||||
-d "parse_mode=HTML" >/dev/null || true
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "=== POST-DEPLOYMENT HEALTH CHECKS ==="
|
|
||||||
|
|
||||||
# 1.
|
|
||||||
echo "[1/4] Verifying deployment directory..."
|
|
||||||
if [ ! -d "$TARGET_DIR" ]; then
|
|
||||||
echo "FATAL: Deployment directory not found: $TARGET_DIR"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [ ! -f "${TARGET_DIR}/QuantEngine.Web.dll" ]; then
|
|
||||||
echo "FATAL: Application DLL not found in deployment"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "OK: Deployment directory verified"
|
|
||||||
|
|
||||||
# 2. Loopback
|
|
||||||
echo "[2/4] Performing loopback health checks..."
|
|
||||||
health_check_passed=0
|
|
||||||
for i in $(seq 1 ${{ env.HEALTH_CHECK_RETRIES }}); do
|
|
||||||
echo " Attempt $i/${{ env.HEALTH_CHECK_RETRIES }}..."
|
|
||||||
if timeout 10 curl -s -f -o /dev/null -w '%{http_code}' http://127.0.0.1:5000/ 2>/dev/null | grep -qE '^(200|302|401)$'; then
|
|
||||||
echo " OK: Service responding"
|
|
||||||
health_check_passed=1
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
if [ $i -lt ${{ env.HEALTH_CHECK_RETRIES }} ]; then
|
|
||||||
sleep ${{ env.HEALTH_CHECK_DELAY }}
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ $health_check_passed -eq 0 ]; then
|
|
||||||
echo "FAILED: Health check did not pass after ${{ env.HEALTH_CHECK_RETRIES }} attempts"
|
|
||||||
echo "status=failed" >> $GITHUB_OUTPUT
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "OK: Loopback health check passed"
|
|
||||||
|
|
||||||
# 3.
|
|
||||||
echo "[3/4] Verifying database connectivity..."
|
|
||||||
if timeout 10 bash -c 'cat /home/kjh2064/.config/quantengine.env | grep -q "postgresql"' 2>/dev/null; then
|
|
||||||
echo "OK: Database credentials configured"
|
|
||||||
else
|
|
||||||
echo "WARNING: Could not verify database credentials"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 4.
|
|
||||||
echo "[4/4] Checking service status..."
|
|
||||||
if systemctl is-active --quiet quantengine; then
|
|
||||||
echo "OK: Service is running"
|
|
||||||
else
|
|
||||||
echo "WARNING: Service may not be running, but health checks passed"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "status=success" >> $GITHUB_OUTPUT
|
|
||||||
echo "=== ALL HEALTH CHECKS PASSED ==="
|
|
||||||
send_telegram "OK: QuantEngine deployed successfully (commit: ${COMMIT})"
|
|
||||||
|
|
||||||
- name: Auto-Rollback on Health Check Failure
|
|
||||||
if: failure() && steps.health-check.outcome == 'failure'
|
|
||||||
run: |
|
|
||||||
COMMIT="${{ steps.deploy.outputs.commit }}"
|
|
||||||
PREV_TIMESTAMP="${{ steps.deploy.outputs.prev_version }}"
|
|
||||||
DEPLOY_BASE="/home/kjh2064/deployments"
|
|
||||||
ACTIVE_LINK="/home/kjh2064/quantengine_active"
|
|
||||||
|
|
||||||
TELEGRAM_BOT_TOKEN="${{ secrets.TELEGRAM_BOT_TOKEN }}"
|
|
||||||
[ -z "$TELEGRAM_BOT_TOKEN" ] && TELEGRAM_BOT_TOKEN="${{ env.TELEGRAM_BOT_TOKEN_DEFAULT }}"
|
|
||||||
TELEGRAM_CHAT_ID="${{ secrets.TELEGRAM_CHAT_ID }}"
|
|
||||||
[ -z "$TELEGRAM_CHAT_ID" ] && TELEGRAM_CHAT_ID="${{ env.TELEGRAM_CHAT_ID_DEFAULT }}"
|
|
||||||
|
|
||||||
send_telegram() {
|
|
||||||
local text="$1"
|
|
||||||
curl -fsS -X POST "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage" \
|
|
||||||
-d "chat_id=${TELEGRAM_CHAT_ID}" \
|
|
||||||
--data-urlencode "text=${text}" \
|
|
||||||
-d "parse_mode=HTML" >/dev/null || true
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "=== AUTOMATIC ROLLBACK INITIATED ==="
|
|
||||||
echo "Health check failed, rolling back to previous version..."
|
|
||||||
|
|
||||||
if [ "$PREV_TIMESTAMP" != "none" ]; then
|
|
||||||
PREV_DEPLOY="${DEPLOY_BASE}/quantengine_${PREV_TIMESTAMP}"
|
|
||||||
if [ -d "$PREV_DEPLOY" ]; then
|
|
||||||
echo "Restoring symlink to: $PREV_DEPLOY"
|
|
||||||
ln -sfn "${PREV_DEPLOY}" "${ACTIVE_LINK}"
|
|
||||||
echo "Restarting service..."
|
|
||||||
systemctl restart quantengine 2>&1 || echo "WARNING: Service restart may have issues"
|
|
||||||
sleep 3
|
|
||||||
echo "Rollback completed"
|
|
||||||
send_telegram "ROLLBACK: Deployment of ${COMMIT} failed, rolled back to ${PREV_TIMESTAMP}"
|
|
||||||
else
|
|
||||||
echo "ERROR: Previous deployment directory not found"
|
|
||||||
send_telegram "CRITICAL: Rollback failed - previous deployment not found"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "ERROR: No previous deployment available for rollback"
|
|
||||||
send_telegram "CRITICAL: Health check failed - no previous deployment to rollback to"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "=== Verifying Database Connectivity ==="
|
|
||||||
db_status=$(psql -U quantengine_app -d quantenginedb -h 127.0.0.1 -c 'SELECT 1;' 2>&1 | head -1)
|
|
||||||
|
|
||||||
if echo "$db_status" | grep -q "1"; then
|
|
||||||
echo " Database connectivity verified"
|
|
||||||
else
|
|
||||||
echo " Database connectivity check: $db_status"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Post-Deployment Verification
|
|
||||||
if: success()
|
|
||||||
run: |
|
|
||||||
echo "=== POST-DEPLOYMENT VERIFICATION ==="
|
|
||||||
|
|
||||||
# Public endpoints
|
|
||||||
echo "[1/3] Verifying public endpoints..."
|
|
||||||
for endpoint in "/" "/Account/Login"; do
|
|
||||||
code=$(curl -s -o /dev/null -w "%{http_code}" --connect-timeout 5 "https://quant.taxbaik.com${endpoint}")
|
|
||||||
echo " https://quant.taxbaik.com${endpoint} -> $code"
|
|
||||||
if ! echo "$code" | grep -qE '^(200|302|401)$'; then
|
|
||||||
echo " WARNING: Unexpected response code"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# Nginx
|
|
||||||
echo "[2/3] Verifying Nginx configuration..."
|
|
||||||
if nginx -t 2>&1 | grep -q "successful"; then
|
|
||||||
echo " OK: Nginx syntax valid"
|
|
||||||
else
|
|
||||||
echo " WARNING: Nginx validation may have issues"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
echo "[3/3] Creating deployment record..."
|
|
||||||
DEPLOYMENT_SUMMARY="deployment_summary_${{ steps.deploy.outputs.timestamp }}.txt"
|
|
||||||
cat > "$DEPLOYMENT_SUMMARY" << EOF
|
|
||||||
DEPLOYMENT SUCCESSFUL
|
|
||||||
=====================
|
|
||||||
|
|
||||||
Timestamp: ${{ steps.deploy.outputs.timestamp }}
|
|
||||||
Commit: ${{ steps.deploy.outputs.commit }}
|
|
||||||
Target: ${{ steps.deploy.outputs.target_dir }}
|
|
||||||
Previous: ${{ steps.deploy.outputs.prev_version }}
|
|
||||||
Status: ACTIVE
|
|
||||||
|
|
||||||
Health Check: PASSED
|
|
||||||
Service: RUNNING
|
|
||||||
Database: CONNECTED
|
|
||||||
Public Endpoints: RESPONDING
|
|
||||||
|
|
||||||
EOF
|
|
||||||
|
|
||||||
echo "OK: Deployment record created"
|
|
||||||
echo "=== VERIFICATION COMPLETE ==="
|
|
||||||
|
|
||||||
- name: Cleanup Old Deployments
|
|
||||||
if: always()
|
|
||||||
run: |
|
|
||||||
DEPLOY_BASE="/home/kjh2064/deployments"
|
|
||||||
KEEP_COUNT=5
|
|
||||||
|
|
||||||
echo "Cleaning up old deployments (keeping $KEEP_COUNT most recent)..."
|
|
||||||
cd "$DEPLOY_BASE"
|
|
||||||
|
|
||||||
count=$(ls -d quantengine_* 2>/dev/null | wc -l)
|
|
||||||
if [ $count -gt $KEEP_COUNT ]; then
|
|
||||||
remove_count=$((count - KEEP_COUNT))
|
|
||||||
echo "Removing $remove_count old deployment(s)..."
|
|
||||||
ls -dt quantengine_* | tail -n +$((KEEP_COUNT + 1)) | while read -r old_dir; do
|
|
||||||
echo " Removing: $old_dir"
|
|
||||||
rm -rf "$old_dir" 2>/dev/null || echo " WARNING: Could not remove $old_dir"
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Cleanup complete. Current deployments:"
|
|
||||||
ls -ldt quantengine_* | head -5 | awk '{print $9, "(" $5 " bytes)"}'
|
|
||||||
|
|
||||||
- name: Notify Success
|
|
||||||
if: success()
|
|
||||||
run: |
|
|
||||||
TELEGRAM_BOT_TOKEN="${{ secrets.TELEGRAM_BOT_TOKEN }}"
|
|
||||||
[ -z "$TELEGRAM_BOT_TOKEN" ] && TELEGRAM_BOT_TOKEN="${{ env.TELEGRAM_BOT_TOKEN_DEFAULT }}"
|
|
||||||
TELEGRAM_CHAT_ID="${{ secrets.TELEGRAM_CHAT_ID }}"
|
|
||||||
[ -z "$TELEGRAM_CHAT_ID" ] && TELEGRAM_CHAT_ID="${{ env.TELEGRAM_CHAT_ID_DEFAULT }}"
|
|
||||||
|
|
||||||
curl -fsS -X POST "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage" \
|
|
||||||
-d "chat_id=${TELEGRAM_CHAT_ID}" \
|
|
||||||
--data-urlencode "text=SUCCESS: QuantEngine deployment complete (commit: ${{ steps.deploy.outputs.commit }})" \
|
|
||||||
-d "parse_mode=HTML" >/dev/null || true
|
|
||||||
|
|
||||||
- name: Notify Failure
|
|
||||||
if: failure()
|
|
||||||
run: |
|
|
||||||
TELEGRAM_BOT_TOKEN="${{ secrets.TELEGRAM_BOT_TOKEN }}"
|
|
||||||
[ -z "$TELEGRAM_BOT_TOKEN" ] && TELEGRAM_BOT_TOKEN="${{ env.TELEGRAM_BOT_TOKEN_DEFAULT }}"
|
|
||||||
TELEGRAM_CHAT_ID="${{ secrets.TELEGRAM_CHAT_ID }}"
|
|
||||||
[ -z "$TELEGRAM_CHAT_ID" ] && TELEGRAM_CHAT_ID="${{ env.TELEGRAM_CHAT_ID_DEFAULT }}"
|
|
||||||
|
|
||||||
curl -fsS -X POST "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage" \
|
|
||||||
-d "chat_id=${TELEGRAM_CHAT_ID}" \
|
|
||||||
--data-urlencode "text=FAILURE: QuantEngine deployment failed (commit: ${{ steps.deploy.outputs.commit }})
|
|
||||||
|
|
||||||
Logs: https://gitea.taxbaik.com/kjh2064/QuantEngineByItz/actions/runs/${{ github.run_id }}" \
|
|
||||||
-d "parse_mode=HTML" >/dev/null || true
|
|
||||||
|
|
||||||
- name: Cleanup Old Deployments
|
|
||||||
run: |
|
|
||||||
DEPLOY_BASE="/home/kjh2064/deployments"
|
|
||||||
echo "Cleaning up obsolete deployments (keeping last 5)..."
|
|
||||||
cd "${DEPLOY_BASE}"
|
|
||||||
ls -dt quantengine_* | tail -n +6 | while read -r old_dir; do
|
|
||||||
echo "Removing old release: ${old_dir}"
|
|
||||||
rm -rf "${old_dir}"
|
|
||||||
done
|
|
||||||
echo "Cleanup complete"
|
|
||||||
ls -ldt quantengine_* | head -5
|
|
||||||
|
|
||||||
- name: Notify Failure
|
|
||||||
if: failure()
|
|
||||||
run: |
|
|
||||||
COMMIT=$(git rev-parse --short HEAD)
|
|
||||||
TELEGRAM_BOT_TOKEN="${{ secrets.TELEGRAM_BOT_TOKEN }}"
|
|
||||||
[ -z "$TELEGRAM_BOT_TOKEN" ] && TELEGRAM_BOT_TOKEN="${{ env.TELEGRAM_BOT_TOKEN_DEFAULT }}"
|
|
||||||
TELEGRAM_CHAT_ID="${{ secrets.TELEGRAM_CHAT_ID }}"
|
|
||||||
[ -z "$TELEGRAM_CHAT_ID" ] && TELEGRAM_CHAT_ID="${{ env.TELEGRAM_CHAT_ID_DEFAULT }}"
|
|
||||||
|
|
||||||
curl -fsS -X POST "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage" \
|
|
||||||
-d "chat_id=${TELEGRAM_CHAT_ID}" \
|
|
||||||
--data-urlencode "text= QuantEngine \n: ${COMMIT}\n: https://gitea.taxbaik.com/kjh2064/QuantEngineByItz/actions/runs/${{ github.run_id }}" \
|
|
||||||
-d "parse_mode=HTML" || true
|
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
name: Daily T+20 Outcome Ledger Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 8 * * 1-5' # KST 17:00 (Mon-Fri)
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-t20-ledger:
|
||||||
|
runs-on: self-hosted
|
||||||
|
steps:
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Build T+20 Outcome Ledger
|
||||||
|
run: |
|
||||||
|
python3 tools/build_operational_t20_outcome_ledger_v1.py
|
||||||
@@ -28,6 +28,12 @@ src/dotnet/QuantEngine.Web/wwwroot/_framework/
|
|||||||
# 런타임 감사 로그 (append-only, 매 DAG 실행마다 증가)
|
# 런타임 감사 로그 (append-only, 매 DAG 실행마다 증가)
|
||||||
runtime/lineage_events.jsonl
|
runtime/lineage_events.jsonl
|
||||||
|
|
||||||
|
# .NET 런타임 로그 (Serilog 등, 실행마다 재생성)
|
||||||
|
**/logs/*.log
|
||||||
|
|
||||||
|
# Playwright 테스트 산출물 (스크린샷/트레이스, 실행마다 재생성)
|
||||||
|
test-results/
|
||||||
|
|
||||||
# OS / 에디터
|
# OS / 에디터
|
||||||
...
|
...
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|||||||
@@ -53,6 +53,8 @@
|
|||||||
- `spec/12_field_dictionary.yaml`
|
- `spec/12_field_dictionary.yaml`
|
||||||
- `spec/13_formula_registry.yaml`
|
- `spec/13_formula_registry.yaml`
|
||||||
- `docs/ENTERPRISE_CRUD_DESIGN_SPECIFICATION.md`
|
- `docs/ENTERPRISE_CRUD_DESIGN_SPECIFICATION.md`
|
||||||
|
- `docs/PHASE0_DISCOVERY_REPORT.md`
|
||||||
|
- `docs/WBS_ENTERPRISE_CRUD_COMMERCIALIZATION_MASTER.yaml`
|
||||||
|
|
||||||
## 2. 문서 역할
|
## 2. 문서 역할
|
||||||
- `AGENTS.md`: 운영 헌법과 링크 인덱스.
|
- `AGENTS.md`: 운영 헌법과 링크 인덱스.
|
||||||
@@ -102,6 +104,7 @@
|
|||||||
- `docs/CLOUD_SERVER_SETUP.md`: 클라우드 서버(hz-prod-01, 178.104.200.7) 설정 하네스 가이드. 시놀로지 → 클라우드 마이그레이션 매핑 포함.
|
- `docs/CLOUD_SERVER_SETUP.md`: 클라우드 서버(hz-prod-01, 178.104.200.7) 설정 하네스 가이드. 시놀로지 → 클라우드 마이그레이션 매핑 포함.
|
||||||
- `docs/ENTERPRISE_CRUD_DESIGN_SPECIFICATION.md`: OMS·WMS·ERP CRUD 화면 및 입력 컴포넌트 상용화 지침 명세 (엔터프라이즈 컴포넌트/트랜잭션 헌법).
|
- `docs/ENTERPRISE_CRUD_DESIGN_SPECIFICATION.md`: OMS·WMS·ERP CRUD 화면 및 입력 컴포넌트 상용화 지침 명세 (엔터프라이즈 컴포넌트/트랜잭션 헌법).
|
||||||
- `docs/ROADMAP_ENTERPRISE_TEMPLATES_WBS.md`: OMS·WMS·ERP 공통 CRUD 화면 템플릿 상용화 WBS & 로드맵.
|
- `docs/ROADMAP_ENTERPRISE_TEMPLATES_WBS.md`: OMS·WMS·ERP 공통 CRUD 화면 템플릿 상용화 WBS & 로드맵.
|
||||||
|
- `docs/QUANTENGINE_MASTERPIECE_ROADMAP.md`: 프로젝트 냉정 분석 & 마스터피스 3-Stream 로드맵 (Alpha Validation / Platform Consolidation / Professional Operation).
|
||||||
- `src/frontend/src/types/enterpriseTemplateContracts.ts`: OMS·WMS·ERP 11대 표준 템플릿 TypeScript 공통 계약.
|
- `src/frontend/src/types/enterpriseTemplateContracts.ts`: OMS·WMS·ERP 11대 표준 템플릿 TypeScript 공통 계약.
|
||||||
- `docs/GITEA_SECRETS_SETUP.md`: Gitea secrets setup and verification guide.
|
- `docs/GITEA_SECRETS_SETUP.md`: Gitea secrets setup and verification guide.
|
||||||
- `docs/GATHERTRADINGDATA_XLSX_OPERATING_RUNBOOK.md`: `GatherTradingData.xlsx` 보조 자산 런북.
|
- `docs/GATHERTRADINGDATA_XLSX_OPERATING_RUNBOOK.md`: `GatherTradingData.xlsx` 보조 자산 런북.
|
||||||
@@ -177,10 +180,12 @@
|
|||||||
- 클라우드 서버(hz-prod-01)는 `/usr/bin/python3`를 사용하므로 `.gitea/workflows/ci.yml`은 `python3` 유지
|
- 클라우드 서버(hz-prod-01)는 `/usr/bin/python3`를 사용하므로 `.gitea/workflows/ci.yml`은 `python3` 유지
|
||||||
- **임시 파일 관리**: 개발/디버깅 목적의 모든 휘발성 임시 파일 및 로그는 반드시 `Temp/` 디렉토리 하위에서만 생성해야 하며, 루트나 다른 패키지 경로에 임시 파일을 만드는 것은 금지한다. 불가피하게 생성할 경우 반드시 접두사/접미사 규칙(`debug_*`, `tmp_*`, `mock_*`, `*_temp.*`)을 준수하여 `.gitignore`에 필터링되도록 한다.
|
- **임시 파일 관리**: 개발/디버깅 목적의 모든 휘발성 임시 파일 및 로그는 반드시 `Temp/` 디렉토리 하위에서만 생성해야 하며, 루트나 다른 패키지 경로에 임시 파일을 만드는 것은 금지한다. 불가피하게 생성할 경우 반드시 접두사/접미사 규칙(`debug_*`, `tmp_*`, `mock_*`, `*_temp.*`)을 준수하여 `.gitignore`에 필터링되도록 한다.
|
||||||
|
|
||||||
## 5b. Vue 3 + Vite 프론트엔드 개발 규칙 (표준 기술 스택 적용)
|
## 5b. 표준 기술 스택 및 아키텍처 가이드라인 (Standard Tech Stack Specification)
|
||||||
- **핵심 아키텍처 원칙**: 어드민 웹 및 클라이언트 프론트엔드는 Section 5e의 표준 기술 스택 명세에 따라 **Vue 3 / Vite 8 / Single File Component (.vue)** 아키텍처를 고수한다. (기존 Razor Pages SSR 단독 고정 규칙은 폐기됨)
|
- **백엔드 (Backend)**: **.NET 10 / ASP.NET Core 10**, **Modular Monolith**, **Vertical Slice Architecture**, **FastEndpoints (REPR)**, **PostgreSQL / Npgsql / Dapper**, **DbUp**, **Hangfire**, **SignalR**, **Outbox + Inbox Pattern**, **BCrypt.Net-Next**, **Polly**, **Swashbuckle.AspNetCore (OpenAPI/Swagger)**
|
||||||
- **컴포넌트 & 데이터 그리드 표준**: UI 컴포넌트 및 데이터 그리드는 **PrimeVue** 및 **AG Grid** 표준 컴포넌트를 활용하며, 상태 관리는 **Pinia**, 데이터 페칭은 **TanStack Query (Vue Query)**를 적용한다.
|
- **프론트엔드 (Frontend)**: **Vue 3 / Vite 8 / pnpm / TypeScript strict**, **vue-router**, **axios**, **TanStack Query (Vue Query) / Pinia**, **vee-validate / Zod**, **PrimeVue / AG Grid**
|
||||||
- **보안 및 CSRF 방어**: 모든 POST/CUD 액션 처리 시 안티포저리 토큰(`@Html.AntiForgeryToken()`) 유효성 검증을 필수로 수행하여 CSRF 공격을 전면 차단한다.
|
- **테스트 & CI/CD**: **xUnit / Vitest / Playwright**, **Gitea Actions (8단계 CI 품질 게이트)**
|
||||||
|
- **관측성 & 알림 (Observability)**: **Serilog / OpenTelemetry / Telegram Bot Alerting**
|
||||||
|
- **보안 및 CSRF 방어**: 모든 POST/CUD 액션 처리 시 안티포저리 토큰(`@Html.AntiForgeryToken()`) 유효성 검증 및 CSRF 방어 토큰 연동을 필수로 수행한다.
|
||||||
- **UI/UX 구현**:
|
- **UI/UX 구현**:
|
||||||
- Tabler 기반 테이블 뷰와 모달 대화상자(Modal Dialog) 패턴을 일관되게 활용하여 CRUD 및 데이터 수정 저장을 플래시 없이 유연하게 연동한다.
|
- Tabler 기반 테이블 뷰와 모달 대화상자(Modal Dialog) 패턴을 일관되게 활용하여 CRUD 및 데이터 수정 저장을 플래시 없이 유연하게 연동한다.
|
||||||
- 상태 및 등급 구분에는 시각적 가시성을 위한 Status Color Chips(Success, Warning, Error)를 적용한다.
|
- 상태 및 등급 구분에는 시각적 가시성을 위한 Status Color Chips(Success, Warning, Error)를 적용한다.
|
||||||
|
|||||||
@@ -28,15 +28,12 @@ CI 스케줄러는 `GatherTradingData.json`을 seed snapshot으로 사용하고,
|
|||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
npm install
|
npm install
|
||||||
node core_satellite_collector.js
|
|
||||||
```
|
```
|
||||||
|
|
||||||
OpenDART 공시까지 확인하려면:
|
**⚠️ 2026-07-30 정정**: 이 섹션은 예전에 `node core_satellite_collector.js`를 실행 커맨드로
|
||||||
|
안내했지만, 그 파일은 git 히스토리에 한 번도 존재한 적이 없다 (`package.json`의 `ops:dev`
|
||||||
```powershell
|
스크립트도 같은 phantom 파일을 가리키고 있어 같은 날 함께 정리함). 실제 수집기는
|
||||||
$env:DART_API_KEY="발급받은키"
|
Python으로 구현되어 있다 — 아래 커맨드를 사용할 것.
|
||||||
node core_satellite_collector.js
|
|
||||||
```
|
|
||||||
|
|
||||||
SQLite 기반 데이터 수집을 실행하려면:
|
SQLite 기반 데이터 수집을 실행하려면:
|
||||||
|
|
||||||
@@ -44,6 +41,15 @@ SQLite 기반 데이터 수집을 실행하려면:
|
|||||||
$env:KIS_APP_Key="실제계좌키"
|
$env:KIS_APP_Key="실제계좌키"
|
||||||
$env:KIS_APP_Secret="실제계좌시크릿"
|
$env:KIS_APP_Secret="실제계좌시크릿"
|
||||||
python tools/run_kis_data_collection_v1.py --input-json GatherTradingData.json --sqlite-db src/quant_engine/kis_data_collection.db --output-json Temp/kis_data_collection_v1.json --kis-account real
|
python tools/run_kis_data_collection_v1.py --input-json GatherTradingData.json --sqlite-db src/quant_engine/kis_data_collection.db --output-json Temp/kis_data_collection_v1.json --kis-account real
|
||||||
|
# 또는: npm run ops:data-collect
|
||||||
|
```
|
||||||
|
|
||||||
|
OpenDART 공시까지 확인하려면 (2026-07-30 기준 `_dart_fundamentals()`는 아직 스텁 — 실제
|
||||||
|
호출은 미구현, `tools/ingest_fundamental_raw.py` 참고):
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
$env:OPENDART_OPENAPI_KEY="발급받은키"
|
||||||
|
python tools/ingest_fundamental_raw.py
|
||||||
```
|
```
|
||||||
|
|
||||||
### Snapshot admin web UI
|
### Snapshot admin web UI
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
# QuantEngine API Reference
|
||||||
|
|
||||||
|
Full API endpoint tables, extracted from CLAUDE.md (2026-07-30) to keep the main file within
|
||||||
|
the character budget.
|
||||||
|
|
||||||
|
## Workspace & History (Phase 1)
|
||||||
|
All endpoints prefixed with `/api/`:
|
||||||
|
|
||||||
|
| Route | Purpose |
|
||||||
|
|-------|---------|
|
||||||
|
| `GET /state` | Full UI state snapshot |
|
||||||
|
| `GET /tables` | Browsable tables list |
|
||||||
|
| `GET /table-rows` | Paginated rows |
|
||||||
|
| `POST /settings/save` | Save settings |
|
||||||
|
| `POST /account-snapshot/save` | Save snapshots |
|
||||||
|
| `POST /bootstrap` | Seed DB from JSON |
|
||||||
|
| `POST /account-snapshot/import-tsv` | Import TSV |
|
||||||
|
| `POST /autofix` | Auto-correct data |
|
||||||
|
|
||||||
|
## Collection Pipeline (Phase 2)
|
||||||
|
| Route | Purpose |
|
||||||
|
|-------|---------|
|
||||||
|
| `GET /collection/state` | Dashboard summary (runs, snapshots, errors) |
|
||||||
|
| `GET /collection/runs` | Recent collection runs (paginated) |
|
||||||
|
| `GET /collection/runs/{runId}/snapshots` | Snapshots from a run |
|
||||||
|
| `GET /collection/runs/{runId}/errors` | Errors from a run |
|
||||||
|
| `GET /collection/latest/{ticker}` | Latest snapshots for ticker |
|
||||||
|
| `POST /collection/run` | Start new collection run (async) |
|
||||||
|
|
||||||
|
## Collection Run Status Values
|
||||||
|
| Status | Meaning | UI Badge | Transitions |
|
||||||
|
|--------|---------|----------|------------|
|
||||||
|
| `running` | Collection in progress | <span class="badge bg-warning">진행 중</span> | → completed or failed |
|
||||||
|
| `completed` | Collection finished (may have errors) | <span class="badge bg-success">완료</span> | (final) |
|
||||||
|
| `failed` | Collection crashed/aborted | <span class="badge bg-danger">실패</span> | (final) |
|
||||||
|
| `pending` | Queued, not yet started | <span class="badge bg-secondary">대기 중</span> | → running |
|
||||||
|
|
||||||
|
## Collection Run Success Criteria
|
||||||
|
**Success** is defined as:
|
||||||
|
- Status = `completed` (not `failed`)
|
||||||
|
- `TotalSnapshots > 0` (at least one snapshot captured)
|
||||||
|
- `TotalErrors == 0` OR `TotalErrors < TotalSnapshots * 0.1` (error rate < 10%)
|
||||||
|
|
||||||
|
**Partial Success** (warning state):
|
||||||
|
- Status = `completed`
|
||||||
|
- `TotalSnapshots > 0` (some data captured)
|
||||||
|
- `TotalErrors > 0` (has errors, but not total loss)
|
||||||
|
|
||||||
|
**Failure**:
|
||||||
|
- Status = `failed` OR
|
||||||
|
- Status = `completed` + `TotalSnapshots == 0` (no data captured)
|
||||||
|
|
||||||
|
UI: `Pages/Admin/Collection/Index.cshtml` — status 값에 따라 배지 색상 결정, 향후 TotalSnapshots/TotalErrors로 상세 상태 표시
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
# QuantEngine CI/CD Pipeline Structure
|
||||||
|
|
||||||
|
Full Gitea Actions workflow structure, extracted from CLAUDE.md (2026-07-30) to keep the main
|
||||||
|
file within the character budget.
|
||||||
|
|
||||||
|
## Workflow Architecture Refactoring (2026-07-24)
|
||||||
|
|
||||||
|
**2026-07-24 refactoring**: Single-job ci.yml (30+ steps, ~40min runtime) → **9-job parallel pipeline** (~15-20min runtime).
|
||||||
|
|
||||||
|
## CI Pipeline Jobs (ci.yml)
|
||||||
|
|
||||||
|
| Job | Dependencies | Purpose | Parallelizable |
|
||||||
|
|-----|--------------|---------|---|
|
||||||
|
| **core** | — | CRITICAL: .NET tests, API trading gate, KIS creds, DB migrations | ✗ (blocks others) |
|
||||||
|
| **wbs-audit** | core | WBS validation, platform migration, coverage audits | ✓ |
|
||||||
|
| **dotnet-contracts** | core | .NET parity, provenance, scheduler, normalization contracts | ✓ |
|
||||||
|
| **ui-storage** | — | Admin UI, storage backend, integration tests | ✓ |
|
||||||
|
| **database-schema** | — | DB pipeline, PostgreSQL schema, history contracts | ✓ |
|
||||||
|
| **calibration-pipeline** | core | Calibration priority, change ledger, qualitative sell strategy | ✓ |
|
||||||
|
| **operational-reporting** | calibration | Decision packet, operational report, performance metrics | ✗ (depends on calibration) |
|
||||||
|
| **security-validation** | — | Secrets contract, workflow validation | ✓ |
|
||||||
|
| **workflow-lint** | — | CI workflow structure, secrets contract | ✓ |
|
||||||
|
| **notify-results** | ALL | PR notification with job status summary | — |
|
||||||
|
|
||||||
|
**Dependency Graph**:
|
||||||
|
```
|
||||||
|
core ─┬─> wbs-audit ─────────────────────┐
|
||||||
|
├─> dotnet-contracts ─────────────┤
|
||||||
|
└─> calibration-pipeline ────────┤
|
||||||
|
└─> operational-reporting ─┤
|
||||||
|
└─> notify-results
|
||||||
|
ui-storage ────────────────────────────────┘
|
||||||
|
database-schema ──────────────────────────┘
|
||||||
|
security-validation ───────────────────────┘
|
||||||
|
workflow-lint ─────────────────────────────┘
|
||||||
|
```
|
||||||
|
|
||||||
|
## Other Workflow Files
|
||||||
|
|
||||||
|
| File | Trigger | Purpose | Status |
|
||||||
|
|------|---------|---------|--------|
|
||||||
|
| **kis_data_collection.yml** | cron (00:30 KST M-F) + dispatch | Validate KIS credentials & PostgreSQL pipeline | ✓ 2026-07-24 |
|
||||||
|
| **qualitative_sell_strategy.yml** | cron (00:15 KST M-F) + push + dispatch | Validate sell strategy pipeline & store | ✓ 2026-07-24 |
|
||||||
|
| **ci_lint.yml** | push (.gitea/workflows/) + dispatch | Lint all workflow files, validate job dependencies, secrets contract | ✓ 2026-07-24 |
|
||||||
|
| **snapshot_admin.yml** | push (snapshot_admin_*) + dispatch | Validate snapshot admin workflow & UI (2 jobs) | ✓ 2026-07-24 |
|
||||||
|
| **ci-frontend.yml** | push (main/master/feature/**) + PR | 8-step `src/frontend/` pipeline: install, typecheck, import-boundary lint, unit test, enterprise CRUD contract parity, Vite build, Playwright E2E, npm audit | ✓ (undocumented until 2026-07-30) |
|
||||||
|
| **t20_ledger.yml** | cron (17:00 KST M-F) + dispatch | Build `tools/build_operational_t20_outcome_ledger_v1.py` daily T+20 outcome ledger | ✓ (undocumented until 2026-07-30) |
|
||||||
|
| **prepare-release.yml** | workflow_run (ci.yml success) + dispatch | Build, tag, create Gitea Release with artifact + checksums | — |
|
||||||
|
| **deploy-prod.yml** | dispatch | Deploy release, run health checks, report status (3 jobs) | — |
|
||||||
|
|
||||||
|
**Note (2026-07-30)**: An earlier version of this table claimed `ci_lint.yml` had been renamed to
|
||||||
|
`workflow_lint.yml`. That rename was never actually carried out — the file on disk is still
|
||||||
|
`ci_lint.yml`. Corrected here after direct verification against `.gitea/workflows/`.
|
||||||
|
|
||||||
|
## Performance Improvements (2026-07-24)
|
||||||
|
|
||||||
|
**ci.yml refactoring results**:
|
||||||
|
- **Before**: 1 job, 30+ sequential steps, ~40min runtime
|
||||||
|
- **After**: 9 jobs, 7 in parallel, ~15-20min total runtime
|
||||||
|
- **Speedup**: ~2-2.5x faster CI feedback (core branch blocks only downstream, others parallel)
|
||||||
|
- **Fault isolation**: Single validation failure no longer blocks unrelated checks
|
||||||
|
|
||||||
|
**Key changes**:
|
||||||
|
1. **Setup consolidation**: Database migrations, Python, .NET setup in `core` job only
|
||||||
|
2. **Parallel validation groups**: 7 jobs run independently from core (ui-storage, database-schema, security-validation, workflow-lint, etc.)
|
||||||
|
3. **Dependency clarity**: `needs:` explicitly defines blocking relationships
|
||||||
|
4. **Error reporting**: `notify-results` summarizes all 9 job statuses in PR comment
|
||||||
|
|
||||||
|
## Workflow Maintenance Checklist
|
||||||
|
|
||||||
|
When modifying workflows (.gitea/workflows/*.yml):
|
||||||
|
|
||||||
|
1. ✅ Update `ci_lint.yml` if adding new triggers or job dependencies
|
||||||
|
2. ✅ Test locally with `python3 tools/validate_gitea_ci_workflow_lint_v1.py`
|
||||||
|
3. ✅ Verify all `needs:` references point to existing jobs
|
||||||
|
4. ✅ Document new jobs in this section above
|
||||||
|
5. ✅ Validate YAML syntax: `python3 -m yaml < .gitea/workflows/new.yml`
|
||||||
|
6. ✅ Ensure no hardcoded secrets in workflow files (env vars only)
|
||||||
|
|
||||||
|
## Troubleshooting Workflows
|
||||||
|
|
||||||
|
**Symptom**: CI job timeout
|
||||||
|
- **Check**: Does your job need PostgreSQL? Only `core` provides it; others must be independent.
|
||||||
|
- **Fix**: Add `services: postgres:` block or restructure to parallel-safe job.
|
||||||
|
|
||||||
|
**Symptom**: Cascading failure (multiple jobs fail)
|
||||||
|
- **Check**: Does your job have missing dependencies? Review `needs:` and dependency graph above.
|
||||||
|
- **Fix**: Add explicit `needs: [job_name]` if job depends on another's output.
|
||||||
|
|
||||||
|
**Symptom**: "job not found" error in notify-results
|
||||||
|
- **Check**: Job name typo in `notify-results.needs` list.
|
||||||
|
- **Fix**: Match job name exactly (case-sensitive).
|
||||||
|
|
||||||
|
## Workflow Trigger Schedule (2026-07-24)
|
||||||
|
|
||||||
|
| Time (KST) | Workflow | Trigger | Purpose |
|
||||||
|
|-----------|----------|---------|---------|
|
||||||
|
| 00:15 | qualitative_sell_strategy.yml | cron (M-F) | Validate sell strategy before daily operations |
|
||||||
|
| 00:30 | kis_data_collection.yml | cron (M-F) | Validate KIS API & DB pipeline before data collection |
|
||||||
|
| Push | ci.yml | on:push (main) | Validate code on every push to main |
|
||||||
|
| PR | ci.yml | on:pull_request | Gate PR merges with full validation suite |
|
||||||
|
| Manual | prepare-release.yml | workflow_dispatch | Create release tag & artifact |
|
||||||
|
| Manual | deploy-prod.yml | workflow_dispatch | Deploy release to production |
|
||||||
|
|
||||||
|
**Dependencies**:
|
||||||
|
- Release creation (prepare-release.yml) is gated by ci.yml success (workflow_run trigger)
|
||||||
|
- Deployment (deploy-prod.yml) is manual — only after release artifact exists
|
||||||
@@ -0,0 +1,337 @@
|
|||||||
|
# QuantEngine Deployment Runbook
|
||||||
|
|
||||||
|
Full deployment procedure, extracted from CLAUDE.md (2026-07-30) to keep the main file within
|
||||||
|
the character budget. CLAUDE.md keeps the CRITICAL rules (CI/CD-only mandate, DB secret
|
||||||
|
management); this file has the complete step-by-step runbook.
|
||||||
|
|
||||||
|
**Production Server**: Hetzner Cloud `178.104.200.7` (kjh2064@178.104.200.7)
|
||||||
|
|
||||||
|
Projects on server:
|
||||||
|
1. **TaxBaik** (홈페이지) — Nginx location `/taxbaik`
|
||||||
|
2. **QuantEngine** (데이터 수집/분석) — Nginx location `/quantengine`
|
||||||
|
|
||||||
|
## ⚠️ CRITICAL: CI/CD-Only Deployment Mandate
|
||||||
|
|
||||||
|
**Rule**: ALL production deployments MUST go through Gitea Actions CI/CD. Manual SSH deployments are **FORBIDDEN**.
|
||||||
|
|
||||||
|
**Why**:
|
||||||
|
- Automatic validation (build, health checks, version verification)
|
||||||
|
- Audit trail (all deployments logged in Gitea Actions)
|
||||||
|
- Consistent process (no manual errors)
|
||||||
|
- Rollback safety (deployment history retained)
|
||||||
|
- Release traceability (version control via git tags)
|
||||||
|
|
||||||
|
## ⚠️ CRITICAL: DB Secret Management (Incident 2026-07-12)
|
||||||
|
|
||||||
|
**Incident**: `quant.taxbaik.com/login`이 `28P01 password authentication failed`로 장애 발생.
|
||||||
|
원인: `appsettings.Production.json`에 하드코딩되어 배포된 DB 비밀번호가, 실제 DB 비밀번호가
|
||||||
|
로테이션된 이후에도 계속 옛날 값(심지어 이전 세션에서 검증 없이 넣은 placeholder였던 적도 있음)
|
||||||
|
그대로 배포되고 있었음.
|
||||||
|
|
||||||
|
**Rule**: **DB 접속 문자열(`ConnectionStrings`)은 절대 `appsettings.Production.json`이나
|
||||||
|
워크플로우 파일에 하드코딩하지 않는다.** `prepare-release.yml`이 생성하는
|
||||||
|
`appsettings.Production.json`에는 `Logging` 설정만 있고 `ConnectionStrings`는 없다 —
|
||||||
|
이는 의도된 설계다 (Gitea Release는 누구나 다운로드 가능한 아티팩트이므로 시크릿을
|
||||||
|
담으면 안 됨).
|
||||||
|
|
||||||
|
**실제 DB 비밀번호의 출처**: 프로덕션 서버의 `/home/kjh2064/.config/quantengine.env`
|
||||||
|
파일 (`ConnectionStrings__DefaultConnection=...` 형식) 하나뿐이며,
|
||||||
|
`quantengine.service.d/env.conf` drop-in의 `EnvironmentFile=` 지시자로 systemd가
|
||||||
|
이 값을 환경변수로 주입한다. ASP.NET Core 설정 우선순위상 **환경변수가
|
||||||
|
`appsettings.Production.json`을 오버라이드**하므로, 배포되는 아티팩트 자체에는
|
||||||
|
DB 정보가 없어도 서비스는 정상 동작한다.
|
||||||
|
|
||||||
|
**DB 비밀번호가 바뀌면** (로테이션 등): `/home/kjh2064/.config/quantengine.env` 파일만
|
||||||
|
갱신하고 `sudo systemctl restart quantengine`. 워크플로우 파일이나 Gitea Secrets는
|
||||||
|
건드릴 필요 없음 (배포 파이프라인은 DB 비밀번호를 모른 채로 동작해야 정상).
|
||||||
|
|
||||||
|
**배포 전 체크리스트에 추가**:
|
||||||
|
- ✅ 새 릴리즈 배포 후 반드시 `/Account/Login` 실제 HTTP 응답 + `journalctl -u quantengine`에서
|
||||||
|
`28P01`/`password authentication failed` 부재 확인 (단순 프로세스 `active` 상태만으로는
|
||||||
|
DB 연결 실패를 못 잡음 — ASP.NET Core는 DB 없이도 기동은 되고 로그인 요청 시점에야 실패함)
|
||||||
|
- ✅ `.config/quantengine.env`의 존재와 `quantengine.service.d/env.conf`의
|
||||||
|
`EnvironmentFile=` 배선이 서버에 유지되고 있는지 (systemd unit 자체를 재생성/덮어쓰는
|
||||||
|
배포 방식으로 전환할 경우 이 drop-in이 날아가지 않는지 확인 필요)
|
||||||
|
|
||||||
|
## Production Deployment Strategy (Release-Based)
|
||||||
|
|
||||||
|
**Architecture**: Two-Workflow System (Release Creation → Deployment)
|
||||||
|
|
||||||
|
### Workflow 1: prepare-release.yml (Release Creation)
|
||||||
|
|
||||||
|
**Purpose**: Create a release with built artifact
|
||||||
|
|
||||||
|
**Trigger**: Manual (`workflow_dispatch`)
|
||||||
|
```bash
|
||||||
|
# Visit Gitea Actions and select prepare-release.yml
|
||||||
|
# Input version: v0.1.20260711 (or any semantic version)
|
||||||
|
```
|
||||||
|
|
||||||
|
**What it does**:
|
||||||
|
1. ✓ Build (restore, build, publish)
|
||||||
|
2. ✓ Generate `appsettings.Production.json`
|
||||||
|
3. ✓ Package artifact: `.tar.gz`
|
||||||
|
4. ✓ Create git tag: `v0.1.20260711`
|
||||||
|
5. ✓ Create Gitea Release with artifact attached
|
||||||
|
6. ✓ Notify: Release ready for deployment
|
||||||
|
|
||||||
|
**Output**: Gitea Release with downloadable artifact
|
||||||
|
|
||||||
|
### Workflow 2: deploy-prod.yml (Deployment)
|
||||||
|
|
||||||
|
**Purpose**: Deploy a release to production
|
||||||
|
|
||||||
|
**Trigger**: Manual (`workflow_dispatch`)
|
||||||
|
```bash
|
||||||
|
# Visit Gitea Actions and select deploy-prod.yml
|
||||||
|
# Input release: v0.1.20260711 (optional — uses latest if empty)
|
||||||
|
```
|
||||||
|
|
||||||
|
**What it does**:
|
||||||
|
1. ✓ Fetch Release (from Gitea Releases)
|
||||||
|
2. ✓ Download artifact
|
||||||
|
3. ✓ Verify SSH credentials
|
||||||
|
4. ✓ Upload to production server
|
||||||
|
5. ✓ Extract and symlink
|
||||||
|
6. ✓ Restart service
|
||||||
|
7. ✓ 6-point health checks
|
||||||
|
8. ✓ Report deployment status
|
||||||
|
|
||||||
|
**Deployment Pipeline (5 Stages)**:
|
||||||
|
|
||||||
|
| Stage | Purpose | Timeout |
|
||||||
|
|-------|---------|---------|
|
||||||
|
| 1. Fetch Release | Query Gitea Releases, download artifact | 10min |
|
||||||
|
| 2. Pre-Check | Verify SSH keys, secrets, release | 5min |
|
||||||
|
| 3. Deploy | Upload, extract, symlink, restart service | 30min |
|
||||||
|
| 4. Health Check | 6-point verification (HTTP, CSS, login, service, release, DB auth) | 10min |
|
||||||
|
| 5. Report | Final deployment status | Auto |
|
||||||
|
|
||||||
|
**Health Checks (Automatic)**:
|
||||||
|
- ✓ HTTP 200 on `/Account/Login`
|
||||||
|
- ✓ Login page content verification
|
||||||
|
- ✓ CSS file loads (`/css/admin.css`)
|
||||||
|
- ✓ Service status (systemctl active)
|
||||||
|
- ✓ Release verification (deployed release tag matches)
|
||||||
|
- ✓ **DB authentication check** (`journalctl`에서 `28P01`/`password authentication failed`
|
||||||
|
부재 확인 — GET `/Account/Login`은 DB가 끊겨도 200을 반환하므로 이 체크가 없으면
|
||||||
|
DB 장애를 배포 파이프라인이 놓친다. 2026-07-12 사고 이후 추가됨)
|
||||||
|
|
||||||
|
**Complete Deployment Flow**:
|
||||||
|
```
|
||||||
|
1. Code committed to main branch
|
||||||
|
2. Create release: prepare-release.yml workflow_dispatch (manual)
|
||||||
|
→ Builds code
|
||||||
|
→ Creates Gitea Release with artifact
|
||||||
|
→ Tags repository
|
||||||
|
3. Deploy release: deploy-prod.yml workflow_dispatch (manual)
|
||||||
|
→ Selects release version
|
||||||
|
→ Downloads artifact from Gitea Release
|
||||||
|
→ Deploys to production server
|
||||||
|
→ Runs health checks
|
||||||
|
→ Reports status
|
||||||
|
```
|
||||||
|
|
||||||
|
## Pre-Deployment Checklist
|
||||||
|
|
||||||
|
**Before creating a release**, verify:
|
||||||
|
1. ✅ Local build: `dotnet build src/dotnet/QuantEngine.Web/QuantEngine.Web.csproj -c Release` (0 errors, 0 warnings)
|
||||||
|
2. ✅ E2E tests pass: `npx playwright test`
|
||||||
|
3. ✅ Admin pages verified (200 status, no 500 errors)
|
||||||
|
4. ✅ All changes committed and pushed to main branch
|
||||||
|
5. ✅ No uncommitted changes: `git status`
|
||||||
|
|
||||||
|
## Release & Deployment Workflow
|
||||||
|
|
||||||
|
**Step 1: Create Release (prepare-release.yml)**
|
||||||
|
```bash
|
||||||
|
# Visit Gitea Actions
|
||||||
|
# https://gitea.taxbaik.com/kjh2064/QuantEngineByItz/actions
|
||||||
|
|
||||||
|
# Run prepare-release.yml workflow
|
||||||
|
# Input: version = v0.1.20260711
|
||||||
|
|
||||||
|
# Workflow will:
|
||||||
|
# - Build and publish
|
||||||
|
# - Package artifact
|
||||||
|
# - Create git tag
|
||||||
|
# - Create Gitea Release
|
||||||
|
# - Attach artifact
|
||||||
|
```
|
||||||
|
|
||||||
|
**Step 2: Deploy Release (deploy-prod.yml)**
|
||||||
|
```bash
|
||||||
|
# Visit Gitea Actions (same page)
|
||||||
|
# Run deploy-prod.yml workflow
|
||||||
|
# Input: release = v0.1.20260711 (leave empty for latest)
|
||||||
|
|
||||||
|
# Workflow will:
|
||||||
|
# - Download artifact from release
|
||||||
|
# - Deploy to production server
|
||||||
|
# - Run health checks
|
||||||
|
# - Report status
|
||||||
|
```
|
||||||
|
|
||||||
|
## SSH Key Configuration (Required)
|
||||||
|
|
||||||
|
**Setup (One-time)**:
|
||||||
|
1. Generate ED25519 key locally (or reuse existing):
|
||||||
|
```bash
|
||||||
|
ssh-keygen -t ed25519 -f ~/.ssh/quantengine_deploy -C "QuantEngine CI/CD"
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Add public key to production server:
|
||||||
|
```bash
|
||||||
|
ssh-copy-id -i ~/.ssh/quantengine_deploy.pub kjh2064@178.104.200.7
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Get private key in base64 format:
|
||||||
|
```bash
|
||||||
|
# macOS/Linux
|
||||||
|
base64 -w 0 ~/.ssh/quantengine_deploy > /tmp/key_b64.txt
|
||||||
|
cat /tmp/key_b64.txt | pbcopy
|
||||||
|
|
||||||
|
# Or Windows PowerShell
|
||||||
|
$key = Get-Content ~/.ssh/quantengine_deploy -Raw
|
||||||
|
[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes($key)) | Set-Clipboard
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Configure in Gitea:
|
||||||
|
- URL: https://gitea.taxbaik.com/kjh2064/QuantEngineByItz/settings/secrets
|
||||||
|
- Add secret: `DEPLOY_SSH_KEY_B64` (base64-encoded private key)
|
||||||
|
- Or: `DEPLOY_SSH_KEY` (raw PEM format)
|
||||||
|
- Also add: `GITEA_TOKEN` (for release API access)
|
||||||
|
- Generate at: https://gitea.taxbaik.com/user/settings/applications
|
||||||
|
- Required permissions: `repo` + `read:actions`
|
||||||
|
|
||||||
|
## Deployment Monitoring
|
||||||
|
|
||||||
|
**During Deployment**:
|
||||||
|
- Watch live in Gitea Actions UI
|
||||||
|
- Jobs complete in order: Build → Pre-Check → Deploy → Health Check → Report
|
||||||
|
|
||||||
|
**After Deployment**:
|
||||||
|
```bash
|
||||||
|
# SSH into server
|
||||||
|
ssh kjh2064@178.104.200.7
|
||||||
|
|
||||||
|
# Check active deployment
|
||||||
|
readlink ~/quantengine_active
|
||||||
|
|
||||||
|
# View service status
|
||||||
|
systemctl status quantengine
|
||||||
|
|
||||||
|
# Tail live logs
|
||||||
|
journalctl -u quantengine -f
|
||||||
|
|
||||||
|
# Health check
|
||||||
|
curl -I http://127.0.0.1:5000/Account/Login
|
||||||
|
```
|
||||||
|
|
||||||
|
## Automatic Rollback (if health check fails)
|
||||||
|
|
||||||
|
If health check fails, deployment stops automatically:
|
||||||
|
1. Service restart may fail
|
||||||
|
2. Symlink update reverts to previous deployment
|
||||||
|
3. Gitea Actions marks deployment as FAILED
|
||||||
|
4. Logs include failure details
|
||||||
|
|
||||||
|
Manual rollback (if needed):
|
||||||
|
```bash
|
||||||
|
# List deployments
|
||||||
|
ls -lht ~/deployments/quantengine_*
|
||||||
|
|
||||||
|
# Revert symlink to previous version
|
||||||
|
ln -sfn /home/kjh2064/deployments/quantengine_YYYYMMDD_HHMMSS_COMMIT ~/quantengine_active
|
||||||
|
|
||||||
|
# Restart service
|
||||||
|
sudo systemctl restart quantengine
|
||||||
|
|
||||||
|
# Verify
|
||||||
|
curl http://127.0.0.1:5000/Account/Login
|
||||||
|
```
|
||||||
|
|
||||||
|
## Troubleshooting Deployment Failures
|
||||||
|
|
||||||
|
**Issue**: Build fails
|
||||||
|
- Check: `dotnet build` locally first
|
||||||
|
- Ensure: No compilation errors, 0 warnings
|
||||||
|
|
||||||
|
**Issue**: Health check timeout
|
||||||
|
- Check: Service logs: `journalctl -u quantengine -n 50`
|
||||||
|
- Check: Port 5000 listening: `ss -tlnp | grep 5000`
|
||||||
|
- Check: DB connectivity in appsettings.Production.json
|
||||||
|
|
||||||
|
**Issue**: SSH key error
|
||||||
|
- Verify: `DEPLOY_SSH_KEY_B64` or `DEPLOY_SSH_KEY` in Gitea Secrets
|
||||||
|
- Check: Public key added to `~/.ssh/authorized_keys` on server
|
||||||
|
- Test: `ssh -i ~/.ssh/key_file kjh2064@178.104.200.7 echo OK`
|
||||||
|
|
||||||
|
## Git Repository
|
||||||
|
|
||||||
|
**Gitea Server** (동일 호스트):
|
||||||
|
- **HTTP**: `https://gitea.taxbaik.com/kjh2064/QuantEngineByItz.git`
|
||||||
|
- **SSH**: `ssh://git@gitea.taxbaik.com:2222/kjh2064/QuantEngineByItz.git`
|
||||||
|
|
||||||
|
## Active Gitea Workflows (summary)
|
||||||
|
|
||||||
|
1. **prepare-release.yml** — Release creation (workflow_dispatch only)
|
||||||
|
- Build → Publish → Package → Tag → Gitea Release
|
||||||
|
- Does NOT write ConnectionStrings into the artifact (see DB Secret Management above) —
|
||||||
|
only `Logging` config ships in `appsettings.Production.json`
|
||||||
|
2. **deploy-prod.yml** — Production deployment (workflow_dispatch only, takes a release tag)
|
||||||
|
- 5 stages: Fetch Release → Pre-Check → Deploy → Health Check → Report
|
||||||
|
- 6-point health checks (HTTP, login page, CSS, service, release, DB auth)
|
||||||
|
- SSH-based deployment with artifact validation
|
||||||
|
3. **ci.yml** — PR validation (on:pull_request), 29 validators, runs on every pull request
|
||||||
|
|
||||||
|
**Accessing Gitea Actions**:
|
||||||
|
- Web UI: https://gitea.taxbaik.com/kjh2064/QuantEngineByItz/actions
|
||||||
|
- Runs API: https://gitea.taxbaik.com/api/v1/repos/kjh2064/QuantEngineByItz/actions/runs
|
||||||
|
|
||||||
|
## API Monitoring (CLI)
|
||||||
|
|
||||||
|
Monitor deployment status from command line:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
# Setup (one-time)
|
||||||
|
$env:GITEA_TOKEN_TAXBAIK = "your_gitea_personal_token"
|
||||||
|
|
||||||
|
# List recent deployment runs
|
||||||
|
$token = $env:GITEA_TOKEN_TAXBAIK
|
||||||
|
$response = Invoke-WebRequest `
|
||||||
|
-Uri "https://gitea.taxbaik.com/api/v1/repos/kjh2064/QuantEngineByItz/actions/runs?limit=5" `
|
||||||
|
-Headers @{ "Authorization" = "token $token" }
|
||||||
|
($response.Content | ConvertFrom-Json).workflow_runs | ForEach-Object {
|
||||||
|
Write-Host "Run #$($_.id): $($_.display_title) [$($_.conclusion)]"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Get specific run details
|
||||||
|
$run_id = 1234 # Replace with actual run ID
|
||||||
|
$response = Invoke-WebRequest `
|
||||||
|
-Uri "https://gitea.taxbaik.com/api/v1/repos/kjh2064/QuantEngineByItz/actions/runs/$run_id" `
|
||||||
|
-Headers @{ "Authorization" = "token $token" }
|
||||||
|
$run = $response.Content | ConvertFrom-Json
|
||||||
|
Write-Host "Commit: $($run.head_sha)"
|
||||||
|
Write-Host "Status: $($run.status) / $($run.conclusion)"
|
||||||
|
```
|
||||||
|
|
||||||
|
See `docs/GITEA_ACTIONS_API_GUIDE.md` for the complete API reference.
|
||||||
|
|
||||||
|
## Deployment Secrets Configuration
|
||||||
|
|
||||||
|
**Required Secrets** (Gitea Repository Settings → Secrets):
|
||||||
|
|
||||||
|
| Secret | Type | Purpose |
|
||||||
|
|--------|------|---------|
|
||||||
|
| `DEPLOY_SSH_KEY_B64` | Base64 (recommended) | ED25519 private key for SSH |
|
||||||
|
| `DEPLOY_SSH_KEY` | PEM (alternative) | Raw private key format |
|
||||||
|
| `DEPLOY_HOST` | Text | Production server IP (178.104.200.7) |
|
||||||
|
| `DEPLOY_USER` | Text | SSH username (kjh2064) |
|
||||||
|
|
||||||
|
**How to add secrets**:
|
||||||
|
1. Go to: https://gitea.taxbaik.com/kjh2064/QuantEngineByItz/settings/secrets
|
||||||
|
2. Click "Add Secret"
|
||||||
|
3. Name: `DEPLOY_SSH_KEY_B64`
|
||||||
|
4. Value: `base64 -w 0 ~/.ssh/deploy_key | pbcopy` (macOS) or `certutil -encode deploy_key deploy_key.b64` (Windows)
|
||||||
|
5. Save
|
||||||
@@ -0,0 +1,137 @@
|
|||||||
|
# QuantEngine Development Workflows & Common Scenarios
|
||||||
|
|
||||||
|
Full day-to-day workflow walkthroughs, extracted from CLAUDE.md (2026-07-30) to keep the main
|
||||||
|
file within the character budget.
|
||||||
|
|
||||||
|
## Scenario 1: Day-to-Day Development (Code Change)
|
||||||
|
|
||||||
|
1. **Make code changes** (C# Razor Pages / .NET API / Python tools)
|
||||||
|
2. **Local validation**:
|
||||||
|
```powershell
|
||||||
|
dotnet build src/dotnet/QuantEngine.Web/QuantEngine.Web.csproj -c Release
|
||||||
|
dotnet test src/dotnet/QuantEngine.Core.Tests -c Release
|
||||||
|
```
|
||||||
|
3. **Test admin pages locally** (with SSH tunnel):
|
||||||
|
```powershell
|
||||||
|
ssh -L 127.0.0.1:5432:localhost:5432 kjh2064@178.104.200.7 -N &
|
||||||
|
dotnet watch run --project QuantEngine.Web
|
||||||
|
# Verify: /Admin/Dashboard, /Admin/Users, /Admin/Collection, etc. all return 200
|
||||||
|
```
|
||||||
|
4. **Commit & push**: Changes automatically trigger ci.yml
|
||||||
|
- Core validators run first (blocking others)
|
||||||
|
- Parallel validators (contracts, UI, DB, calibration) run independently
|
||||||
|
- notify-results summarizes all 9 jobs in PR comment
|
||||||
|
- Expected CI time: ~15-20min (was ~40min before 2026-07-24 refactor)
|
||||||
|
|
||||||
|
## Scenario 2: Data Collection Setup (KIS API Validation)
|
||||||
|
|
||||||
|
1. **Obtain KIS credentials** (real or mock account)
|
||||||
|
2. **Validate with mock account**:
|
||||||
|
```powershell
|
||||||
|
$env:KIS_APP_Key_TEST="<test_key>"
|
||||||
|
$env:KIS_APP_Secret_TEST="<test_secret>"
|
||||||
|
python tools/validate_kis_api_credentials_v1.py --account mock --ticker 005930 --dry-run
|
||||||
|
```
|
||||||
|
3. **Run real collection** (if approved):
|
||||||
|
```powershell
|
||||||
|
$env:KIS_APP_Key="<real_key>"
|
||||||
|
$env:KIS_APP_Secret="<real_secret>"
|
||||||
|
python tools/run_kis_data_collection_v1.py --input-json GatherTradingData.json --sqlite-db src/quant_engine/kis_data_collection.db --output-json Temp/kis_data_collection_v1.json --kis-account real
|
||||||
|
```
|
||||||
|
4. **Verify database**:
|
||||||
|
```sql
|
||||||
|
SELECT COUNT(*) FROM kis_collection_runs;
|
||||||
|
SELECT COUNT(*) FROM kis_collection_snapshots;
|
||||||
|
```
|
||||||
|
|
||||||
|
## Scenario 3: Admin Data Editing (Snapshot Admin Web UI)
|
||||||
|
|
||||||
|
1. **Start snapshot admin server**:
|
||||||
|
```powershell
|
||||||
|
python tools/run_snapshot_admin_server_v1.py --host 127.0.0.1 --port 8787 --db src/quant_engine/snapshot_admin.db --seed GatherTradingData.json
|
||||||
|
```
|
||||||
|
2. **Access web UI**: http://127.0.0.1:8787
|
||||||
|
3. **Edit settings / account_snapshot** in browser (like Excel)
|
||||||
|
4. **Manage changes**: Approval & Locks area handles change history, undo, approval workflow
|
||||||
|
5. **Export for CI**: `/api/export` → JSON or "Export approval packet" button
|
||||||
|
|
||||||
|
## Scenario 4: Release & Deployment (Multi-Stage)
|
||||||
|
|
||||||
|
**Stage 1: Local validation**
|
||||||
|
```powershell
|
||||||
|
npm run ops:validate # Warn-only (allow some issues)
|
||||||
|
npm run full-gate # Strict (all gates PASS)
|
||||||
|
```
|
||||||
|
|
||||||
|
**Stage 2: Create release** (manual via Gitea Actions)
|
||||||
|
```
|
||||||
|
→ Visit https://gitea.taxbaik.com/kjh2064/QuantEngineByItz/actions
|
||||||
|
→ Run "prepare-release.yml" workflow_dispatch
|
||||||
|
- Builds and publishes .NET
|
||||||
|
- Creates git tag (e.g., quant_20260724.0.abc1234)
|
||||||
|
- Generates Gitea Release with artifact + checksums
|
||||||
|
- Packages as .tar.gz
|
||||||
|
```
|
||||||
|
|
||||||
|
**Stage 3: Deploy** (manual, only after release exists)
|
||||||
|
```
|
||||||
|
→ Run "deploy-prod.yml" workflow_dispatch
|
||||||
|
- Downloads release artifact from Gitea
|
||||||
|
- Validates checksums and manifest
|
||||||
|
- Verifies upstream CI success
|
||||||
|
- SSH uploads to production server (178.104.200.7)
|
||||||
|
- Extracts and symlinks
|
||||||
|
- Restarts systemd service
|
||||||
|
- 6-point health checks (HTTP, login page, CSS, service, release tag, DB auth)
|
||||||
|
- Reports final status
|
||||||
|
```
|
||||||
|
|
||||||
|
**Pre-deployment checklist** (MANDATORY):
|
||||||
|
- ✅ Local build: 0 errors, 0 warnings
|
||||||
|
- ✅ E2E tests pass: `npx playwright test`
|
||||||
|
- ✅ All admin pages tested locally (200 status, no 500)
|
||||||
|
- ✅ `git status` clean (no uncommitted changes)
|
||||||
|
- ✅ Commit pushed to main
|
||||||
|
|
||||||
|
Full runbook: [DEPLOYMENT_RUNBOOK.md](DEPLOYMENT_RUNBOOK.md)
|
||||||
|
|
||||||
|
## Scenario 5: CI Workflow Debugging
|
||||||
|
|
||||||
|
**Problem**: A specific validation fails in CI
|
||||||
|
1. Identify failing job from PR comment (notify-results output)
|
||||||
|
2. Reproduce locally:
|
||||||
|
```powershell
|
||||||
|
# For core, wbs-audit, dotnet-contracts: run relevant Python validators
|
||||||
|
python tools/validate_dotnet_migration_execution_plan_v1.py
|
||||||
|
python tools/validate_dotnet_parity_contract_v1.py
|
||||||
|
# etc.
|
||||||
|
```
|
||||||
|
3. Fix and re-push (triggers ci.yml again)
|
||||||
|
4. Monitor in Gitea Actions dashboard
|
||||||
|
|
||||||
|
**Problem**: Workflow syntax error
|
||||||
|
1. Validate locally:
|
||||||
|
```powershell
|
||||||
|
python tools/validate_gitea_ci_workflow_lint_v1.py --workflow .gitea/workflows/ci.yml
|
||||||
|
```
|
||||||
|
2. Fix YAML and test again
|
||||||
|
|
||||||
|
## Scenario 6: Database Schema Changes
|
||||||
|
|
||||||
|
1. **Create migration**: `src/dotnet/QuantEngine.Infrastructure/Migrations/V003.sql`
|
||||||
|
2. **Update DBML**: `docs/db/quantengine.dbml` (same commit)
|
||||||
|
- DbUp auto-applies migrations on startup
|
||||||
|
- DBML is reference documentation
|
||||||
|
3. **Test locally** (with SSH tunnel): Migrations must apply cleanly
|
||||||
|
4. **Commit both** (SQL + DBML) together
|
||||||
|
5. **CI validates**: ci.yml applies migrations to test PostgreSQL service
|
||||||
|
|
||||||
|
## When Things Break
|
||||||
|
|
||||||
|
| Issue | Root Cause | Fix |
|
||||||
|
|-------|-----------|-----|
|
||||||
|
| Admin page returns 500 | Likely unhandled DB exception or auth issue | Check journalctl, verify ConnectionStrings in production env |
|
||||||
|
| KIS API fails with "not found" | Ticker doesn't exist in KIS | Use fallback (Naver → Yahoo → OpenDART) |
|
||||||
|
| Snapshot admin won't load | SQLite DB corrupted or missing | Delete and re-seed from GatherTradingData.json |
|
||||||
|
| CI takes >25min | core job is slow or parallel jobs stalling | Profile individual job logs; likely DB migrations or large test suite |
|
||||||
|
| Deployment health check fails (DB 28P01) | DB password rotated but not updated in production env | Update `/home/kjh2064/.config/quantengine.env` on server only (not in repo) |
|
||||||
@@ -1,294 +1,77 @@
|
|||||||
# OMS·WMS·ERP 입력 컴포넌트 및 CRUD 상세 명세
|
# OMS·WMS·ERP CRUD 화면 및 입력 컴포낸트 상용화 설계 명세서 (Enterprise Specification)
|
||||||
|
|
||||||
## 0. 템플릿 체계 (TPL-LIST-01 ~ TPL-HISTORY-01)
|
> **Authority**: 30년 시니어 현장 실무 전문가 패널 (Architect, PM, PL, Dev, AX/UX Designer, QA Tester, Warehouse User)
|
||||||
|
> **Source Documents**:
|
||||||
| 템플릿 ID | 화면 유형 | 대표 업무 |
|
> 1. `OMS·WMS·ERP CRUD 화면 및 입력 컴포낸트 상용화 제안.pdf.txt`
|
||||||
| :--- | :--- | :--- |
|
> 2. `OMS·WMS·ERP 공통 CRUD 화면 템플릿 상세 명세.pdf.txt`
|
||||||
| `TPL-LIST-01` | 목록·검색 | 주문 목록, 재고 현황, 전표 목록 |
|
> 3. `OMS·WMS·ERP 입력 컴포낸트 상세 명세.pdf.txt`
|
||||||
| `TPL-CREATE-01` | 단일 등록 | 거래처, 품목, 단순 주문 |
|
> 4. `Vue 3·TypeScript OMS·WMS·ERP 아키텍처.pdf.txt`
|
||||||
| `TPL-CREATE-02` | 헤더·라인 등록 | 주문, 발주, 입고 예정, 전표 |
|
> 5. `Vue 3·TypeScript 기반 OMS·WMS·ERP 단계별 구축 백로그.pdf.txt`
|
||||||
| `TPL-CREATE-03` | 단계형 등록 | 복합 주문, 반품, 계약 |
|
|
||||||
| `TPL-DETAIL-01` | 상세 조회 | 주문 상세, 입고 상세, 전표 상세 |
|
|
||||||
| `TPL-EDIT-01` | 일반 수정 | 마스터, 주문 임시 상태 수정 |
|
|
||||||
| `TPL-BULK-01` | 일괄 수정 | 담당자, 예정일, 상태 일괄 변경 |
|
|
||||||
| `TPL-DELETE-01` | 삭제 | 미사용 임시 데이터 삭제 |
|
|
||||||
| `TPL-CANCEL-01` | 취소·역처리 | 주문 취소, 출고 취소, 전표 역분개 |
|
|
||||||
| `TPL-APPROVAL-01` | 승인·반려 | 발주 승인, 전표 승인 |
|
|
||||||
| `TPL-HISTORY-01` | 변경 이력 | 값 변경, 상태 전이, 시스템 처리 이력 |
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 1. 목적과 적용 범위
|
## 1. SOLID Design Principles & Single Responsibility Specification
|
||||||
본 명세의 목적은 OMS·WMS·ERP에서 사용하는 모든 입력 컴포넌트를 표준화하는 것이다.
|
## 2. Dual-model Data Architecture (Normalized Master / Denormalized Read Model)
|
||||||
* 사용자가 잘못 입력하기 어렵게 한다.
|
## 3. Strict Client-Schema-Server-DB 4-Layer Validation Guard
|
||||||
* 잘못 입력해도 쉽게 발견하고 복구할 수 있게 한다.
|
## 4. Zero Vibe Coding & Hallucination Elimination
|
||||||
* 화면과 서버의 데이터 해석이 달라지지 않게 한다.
|
## 5. Field Status (13 States) & Value Source (8 Provenances) Contract
|
||||||
* 사용자 입력, 시스템 계산, 외부 연동, AI 추천값을 구분한다.
|
## 6. Touch Density & Offline Command Buffer for WMS Field Operations
|
||||||
* 적용 범위: OMS(주문/반품/배송/결제), WMS(입고/피킹/출고/재고), ERP(발주/전표/비용), 마스터(조직/사용자/코드/창고/단위).
|
## 7. 20대 핵심 엔지니어링 헌법 (Core Engineering Principles)
|
||||||
|
## 8. Layer 1 Primitives Components (BaseInput, BaseButton, BaseStatusBadge, SelectInput)
|
||||||
|
## 9. Layer 2 Typed Fields Components (TextField, CodeField, DecimalField, DateField, TypedFieldBase)
|
||||||
|
## 10. Layer 3 Domain Fields Components (QuantityField, MoneyField, LotField, BarcodeInput, LocationPicker, ApprovalStatusBadge)
|
||||||
|
## 11. Layer 4 Business Composites Components (AISuggestedField, OrderLineEditor, AddressEditor, InventoryAllocationEditor)
|
||||||
|
## 12. FieldStatus: idle State Specification
|
||||||
|
## 13. FieldStatus: focused State Specification
|
||||||
|
## 14. FieldStatus: valid State Specification
|
||||||
|
## 15. FieldStatus: invalid State Specification
|
||||||
|
## 16. FieldStatus: dirty State Specification
|
||||||
|
## 17. FieldStatus: readonly State Specification
|
||||||
|
## 18. FieldStatus: disabled State Specification
|
||||||
|
## 19. FieldStatus: loading State Specification
|
||||||
|
## 20. FieldStatus: suggested State Specification
|
||||||
|
## 21. FieldStatus: accepted State Specification
|
||||||
|
## 22. FieldStatus: rejected State Specification
|
||||||
|
## 23. FieldStatus: overridden State Specification
|
||||||
|
## 24. FieldStatus: blocked State Specification
|
||||||
|
## 25. ValueSource: user Specification
|
||||||
|
## 26. ValueSource: default Specification
|
||||||
|
## 27. ValueSource: computed Specification
|
||||||
|
## 28. ValueSource: db Specification
|
||||||
|
## 29. ValueSource: ai Specification
|
||||||
|
## 30. ValueSource: scan Specification
|
||||||
|
## 31. ValueSource: external_api Specification
|
||||||
|
## 32. ValueSource: system_rule Specification
|
||||||
|
## 33. TPL-LIST-01: 표준 목록 및 다중 조건 검색 템플릿
|
||||||
|
## 34. TPL-CREATE-01: 단일 데이터 등록 템플릿
|
||||||
|
## 35. TPL-CREATE-02: 헤더-라인 복합 데이터 등록 템플릿
|
||||||
|
## 36. TPL-CREATE-03: 단계별 위자드(Wizard) 등록 템플릿
|
||||||
|
## 37. TPL-DETAIL-01: 데이터 상세 조회 템플릿
|
||||||
|
## 38. TPL-EDIT-01: 단일 데이터 수정 템플릿
|
||||||
|
## 39. TPL-BULK-01: 일괄 데이터 처리 및 엑셀 맵퍼 템플릿
|
||||||
|
## 40. TPL-APPROVAL-01: 승인 및 결재 처리 템플릿
|
||||||
|
## 41. TPL-CANCEL-01: 취소·반제·역처리 트랜잭션 템플릿
|
||||||
|
## 42. TPL-DELETE-01: 데이터 삭제 처리 템플릿 (Maker-Checker)
|
||||||
|
## 43. TPL-HISTORY-01: 이력 및 감사 로그 조회 템플릿
|
||||||
|
## 44. 3종 Touch Density Standard (Compact 28px, Comfortable 36px, Touch 44px)
|
||||||
|
## 45. Standard Anatomy 8부 구조 명세
|
||||||
|
## 46. WMS 초고속 GS1-128 바코드 스캔 <100ms 파싱 명세
|
||||||
|
## 47. AX/AI 보조 및 R0~R4 위험 거버넌스 헌법
|
||||||
|
## 48. ACID 역처리 및 시점 스냅샷 데이터 무결성
|
||||||
|
## 49. Client-Schema-Server-DB 4계층 검증 경계
|
||||||
|
## 50. Dual-model Read Engine & Performance Optimization
|
||||||
|
## 51. Strict Typecheck & Vue-TSC Build Quality Gate
|
||||||
|
## 52. Gitea Actions CI/CD Pipeline Integration
|
||||||
|
## 53. 30년 시니어 현장 실무 전문가 패널 7대 뷰포인트 가이드
|
||||||
|
## 54. 상용화 WBS 마스터 및 가이드 하네스 지침
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 2. 입력 컴포넌트 계층 (4계층 아키텍처)
|
### 30년 실무 전문가 패널 핵심 요약
|
||||||
```text
|
- **Architect**: 4계층 검증 경계 및 Master 정규화 / Read Model 역정규화 격리
|
||||||
Primitive (`components/primitives/`)
|
- **PM**: 계량화된 KPI (Build exit code 0, vue-tsc 0 errors, Harness Pass 100%)
|
||||||
↓
|
- **PL**: Waterfall 선형 순차 프로세스 및 수식 AI 위임 차단
|
||||||
Typed Field (`components/fields/`)
|
- **Dev**: 19종 컴포넌트 & 11대 템플릿 표준 계약 준수
|
||||||
↓
|
- **AX/UX**: Compact(28px), Comfortable(36px), Touch(44px) 3종 밀도
|
||||||
Domain Field (`components/domain-fields/`)
|
- **QA**: Barcode Parse <100ms & OfflineCommand 큐 E2E 자동 검증
|
||||||
↓
|
- **User**: 물류 현장 장갑 착용 시 44px 터치 타겟과 음향/진동/컬러 피드백
|
||||||
Business Composite (`components/business-composites/`)
|
|
||||||
```
|
|
||||||
* **2.1 Primitive**: TextInput, Button, Checkbox, Select, Dialog 등 시각/상호작용 업무 무지 컴포넌트.
|
|
||||||
* **2.2 Typed Field**: StringField, IntegerField, DecimalField, DateField, CodeField 등 데이터 타입 이해 컴포넌트.
|
|
||||||
* **2.3 Domain Field**: QuantityField, MoneyField, LotField, SerialNumberInput, ItemLookup 등 업무 도메인 이해 컴포넌트.
|
|
||||||
* **2.4 Business Composite**: AddressEditor, OrderLineEditor, InventoryAllocationEditor, BarcodeWorkInput 등 여러 필드 및 규칙 묶음.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 3. 공통 필드 해부 구조
|
|
||||||
Label, Required Indicator, Business Status Indicator, Input Control, Prefix/Suffix, Supporting Information, Validation Message, Audit/Source Information으로 구성.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 4. 공통 데이터 모델 (`FieldDefinition` / `FieldState`)
|
|
||||||
`FieldDefinition` 및 `FieldState` 모델 정의. `FieldMessage` 오류 코드로 통제.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 5. 필드 상태 의미 (`FieldStatus`)
|
|
||||||
`idle`, `focused`, `dirty`, `validating`, `valid`, `warning`, `invalid`, `saving`, `saved`, `conflict`, `readonly`, `disabled`, `blocked` 13가지 상태 엄격 구분.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 6. 값 처리 파이프라인
|
|
||||||
`Raw Input` → `Parse` → `Normalize` → `Local Validate` → `Cross-field Validate` → `Async Validate` → `Server Validate` → `Persist` → `Format`.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 7. 공통 Props 계약 (`BaseFieldProps`)
|
|
||||||
`BaseFieldProps` 및 `FieldChangeMeta` 인터페이스 정의.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 8. 텍스트 입력 `TextField`
|
|
||||||
IME 조합 중 강제 변환 금지, 글자 수 제한 잘라내기 금지, 정규화 지원.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 9. 코드 입력 `CodeField`
|
|
||||||
대문자 자동 정규화, 중복 확인 비동기 요청 Debounce 및 요청 취소.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 10. 숫자 입력 `NumberField`
|
|
||||||
정수/소수 구분, Decimal 문자열 사용, 불완전 입력 중 `0` 강제 치환 금지.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 11. 수량 입력 `QuantityField`
|
|
||||||
`amount` / `unitCode` / `baseAmount` / `baseUnitCode` 모델, 가용재고 및 포장단위 환산 검증.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 12. 금액 입력 `MoneyField`
|
|
||||||
`amount` / `currencyCode` 모델, 부동소수점 금지, 통화별 소수 자릿수, 조정 사유 필수.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 13. 비율 입력 `PercentageField`
|
|
||||||
0~100 제한, 할인 적용 순서 및 반올림 시점 명시.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 14. 날짜 입력 `DateField`
|
|
||||||
`LocalDateString` (`YYYY-MM-DD`), 영업일/마감일/회계기간 검증.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 15. 일시 입력 `DateTimeField`
|
|
||||||
`ZonedDateTimeValue` (`instant`, `timeZone`, `localDisplay`), 서버/로컬 시간대 구분.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 16. 단일 선택 `SelectField`
|
|
||||||
소수 항목(2~20개) 대상, 키보드 방향키 및 Enter/Escape 단축키 패턴.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 17. 참조 검색 `ReferenceLookup`
|
|
||||||
품목/거래처/창고/계정 대용량 참조, 초성/코드 동시 검색, Debounce 및 오래된 응답 취소.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 18. 자동완성 `AutocompleteField`
|
|
||||||
`AutocompleteValue` (`selected` vs `free-text`) 구분.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 19. Checkbox·Switch
|
|
||||||
독립 복수 선택 Checkbox, 즉시 반영 Switch, 삼상태 Checkbox(`변경하지 않음` 구분).
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 20. Radio Group
|
|
||||||
상호 배타적 소수 선택지 비교.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 21. 주소 입력 `AddressEditor`
|
|
||||||
`AddressValue` 모델, 우편번호 검색, 도서산간 배송비 검증, 개인정보 마스킹.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 22. 전화번호·사업자번호 입력
|
|
||||||
원문 저장과 표시 하이픈 분리, 사업자번호 체크섬 및 중복 검증.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 23. 바코드 입력 `BarcodeInput`
|
|
||||||
`BarcodeSource` (`hardware-scanner`/`camera`/`keyboard`/`paste`), 100ms 이내 판정, 연속 스캔, 음향/진동 피드백.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 24. 로트 입력 `LotField`
|
|
||||||
`LotValue` 모델, FEFO/FIFO 정책 추천, 제조일/유효기간/격리 상태 검증.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 25. 시리얼 입력 `SerialNumberInput`
|
|
||||||
`SerialEntry` 집계 뷰어, 스캔 리스트, 대량 붙여넣기 미리보기 및 실패 행만 재입력.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 26. 창고·로케이션 입력 `LocationLookup`
|
|
||||||
`LocationReference` 모델, 보관조건/혼적/용량/온도대 검증, 추천 로케이션.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 27. 파일 업로드 `FileUpload`
|
|
||||||
`UploadedFile` 모델, MIME 검증, 진행률, 악성코드 검사, 보안 상태 구분.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 28. Grid Cell Editor
|
|
||||||
`GridChangeSet` 모델, 셀 편집 키보드 이동, 붙여넣기 미리보기, 가상화.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 29. 계산 필드 `CalculatedField`
|
|
||||||
`CalculatedValue` 모델, 기본 Readonly, 계산 근거 및 수식 버전 표출, 클라이언트 미리보기.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 30. AI 추천 필드 `AISuggestedField`
|
|
||||||
`AISuggestion` 모델 (`proposedValue`, `confidence`, `rationale`, `evidence`), 초안/추천 국한, 홀루시네이션 및 고위험 수식 차단.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 31. 입력 출처 표시
|
|
||||||
`user`, `scanner`, `import`, `integration`, `system`, `calculation`, `ai`, `default` 출처 표출.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 32. 기본값 정책
|
|
||||||
안전한 기본값만 적용, 이전 거래처/창고 자동 적용 위험 차단.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 33. 조건부 필드
|
|
||||||
Visible/Required/Editable When 조건 제어, 숨겨진 값 유지/초기화 정책 명시.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 34. 교차 필드 검증
|
|
||||||
`CrossFieldRule` 인터페이스 기반 수량/일자/금액 간 종속 관계 검증.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 35. 비동기 검증
|
|
||||||
Debounce, 요청 취소, 최신 요청만 반영, 저장 시 서버 재검증.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 36. 오류 표시 표준
|
|
||||||
필드 하단, Section 요약, 화면 전체 요약 3단계 위치 제공 및 포커스 이동.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 37. 접근성 요구사항 (WCAG 2.2 AA / WAI-ARIA)
|
|
||||||
Label 프로그램적 바인딩, `aria-invalid`, `aria-describedby`, 터치 영역(44x44 CSSpx).
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 38. 키보드 표준
|
|
||||||
Tab/Shift+Tab, Enter, Escape, Arrow, Space, Ctrl+S, F2 셀 편집 단축키 패턴.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 39. 모바일·산업용 단말 정책
|
|
||||||
사무용(고밀도 키보드) vs 현장용(스캔/큰 버튼/오프라인/자동 포커스) UX 단순화.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 40. 오프라인 입력 정책
|
|
||||||
`OfflineCommand` 모델, 로컬 큐 적재, 자동 재연결 동기화, Idempotency Key.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 41. 권한과 필드 보안
|
|
||||||
`FieldPermission` (visible, readable, editable, masked), 서버 API 이중 검증.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 42. 민감정보 컴포넌트
|
|
||||||
기본 마스킹, 보기 시 추가 인증, AI 프롬프트 전송 전 비식별화.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 43. 감사 이력
|
|
||||||
`FieldAuditChange` (before, after, valueSource, changedBy, changedAt, reasonCode).
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 44. 컴포넌트 이벤트 표준
|
|
||||||
`focus`, `change`, `normalize`, `validate`, `clear`, `aiSuggestionAccepted` 표준 이벤트.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 45. 디자인 토큰
|
|
||||||
Compact(ERP), Standard(OMS), Touch(WMS) 밀도 모드 토큰 분리.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 46. 컴포넌트 API 설계 원칙
|
|
||||||
Boolean Props 남용 금지, 업무 Composite 컴포넌트 분리.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 47. 컴포넌트 디렉터리 구조
|
|
||||||
`primitives/`, `fields/`, `domain-fields/`, `business-composites/`, `form/` 4계층 배치.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 48. 테스트 전략
|
|
||||||
Primitive, Typed Field, Domain Field, Composite 계층별 단위/계약/현장/접근성 테스트 매트릭스.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 49. Storybook 문서 기준
|
|
||||||
Default, Required, Readonly, Disabled, Blocked, Error, Touch, Korean IME, AI Suggested 등 20여 가지 Story 제공.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 50. Definition of Done (DoD)
|
|
||||||
기능/데이터/UX/접근성/품질 5대 영역 DoD 통과.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 51. 우선 구축 대상
|
|
||||||
1차 기반(TextField/CodeField/SelectField/FormErrorSummary) → 2차 핵심(QuantityField/MoneyField/AddressEditor) → 3차 현장(BarcodeInput/LotField) → 4차 AX(AISuggestedField).
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 52. 핵심 설계 결론
|
|
||||||
입력 컴포넌트는 단순 UI가 아니며 정규화, 검증, 권한, 출처, 이력을 보장하는 표준 계약의 핵심이다.
|
|
||||||
|
|||||||
@@ -0,0 +1,101 @@
|
|||||||
|
# QuantEngine Migration Status (Historical Log)
|
||||||
|
|
||||||
|
Detailed phase-by-phase migration history, extracted from CLAUDE.md (2026-07-30) to keep the
|
||||||
|
main file within the character budget. CLAUDE.md keeps a short summary; this file is the
|
||||||
|
full historical record.
|
||||||
|
|
||||||
|
## Migration Phases Status (2026-07-11)
|
||||||
|
|
||||||
|
**Phase 1: Web UI Migration** ✅ 완료 (2026-07-11)
|
||||||
|
- **새로운 표준**: Razor Pages (Server-Rendered) + Cookie Authentication + Tabler UI
|
||||||
|
- **폐기 대상**: Blazor Interactive WebAssembly, MudBlazor, SmartAdmin
|
||||||
|
- **완료 기준 — Phase 1 Success Criteria**:
|
||||||
|
- ✅ Cookie 인증 구현 (AuthService + IpLockoutService + BCrypt)
|
||||||
|
- ✅ Razor Pages 렌더링 (Admin 레이아웃 + 3개 이상 기본 페이지)
|
||||||
|
- ✅ 공용 UI 컴포넌트 (4개 이상 shared partials)
|
||||||
|
- ✅ 보안: 백도어 제거, 무솔트 해시 마이그레이션, IP 잠금
|
||||||
|
- ✅ 빌드 성공: 0 errors, 0 warnings
|
||||||
|
- ✅ CLAUDE.md 업데이트 (UI 기준 + 인증 정책)
|
||||||
|
- **✅ 모든 기준 충족됨** (2026-07-11)
|
||||||
|
- **구현 완료**:
|
||||||
|
- ✅ Cookie 기반 인증 (AuthService + IpLockoutService)
|
||||||
|
- ✅ Razor Pages CRUD 레이아웃 (_AdminLayout.cshtml, shared partials)
|
||||||
|
- ✅ Admin 페이지: Dashboard, Collection, Users (기본 구조)
|
||||||
|
- ✅ 공용 UI 컴포넌트: _ValidationSummary, _Pagination, _StatusBadge, _EmptyState
|
||||||
|
- ✅ 보안 개선: BCrypt 해싱, IP 잠금, 하드코딩된 백도어 제거
|
||||||
|
- ✅ 빌드: 0 errors, 0 warnings (Newtonsoft.Json 보안 경고 제외)
|
||||||
|
- ✅ CLAUDE.md 완전 업데이트 (UI 기준, 인증, 상태 정의)
|
||||||
|
- **구현 미완료 (향후 작업)**:
|
||||||
|
- 🔄 Users 페이지: Create/Edit 폼 완성
|
||||||
|
- 🔄 Collection 페이지: 스냅샷/에러 조회 상세화
|
||||||
|
- 🔄 E2E 테스트: Playwright 스펙 업데이트
|
||||||
|
|
||||||
|
**Phase 2: KIS Data Collection Pipeline** ✅ 95% COMPLETE
|
||||||
|
- ✅ KIS API Client: Full implementation complete
|
||||||
|
- IKisApiClient interface (5 quotation methods)
|
||||||
|
- KisApiClient with real HTTP implementation + token caching
|
||||||
|
- All governance rules enforced (no trading APIs)
|
||||||
|
- Windows env var + registry fallback for credentials
|
||||||
|
- Build: 0 errors, 0 warnings
|
||||||
|
- ✅ PostgreSQL Infrastructure: Complete
|
||||||
|
- PostgresTokenCache (token management, 10-min skew)
|
||||||
|
- CollectionRepository (full CRUD + dashboard aggregations)
|
||||||
|
- Auto-creates kis_tokens, kis_collection_runs, kis_collection_snapshots, kis_collection_errors
|
||||||
|
- Dapper ORM + parameterized SQL (injection-proof)
|
||||||
|
- ✅ Web API Endpoints: Complete
|
||||||
|
- CollectionEndpoints (6 endpoints: state, runs, snapshots, errors, latest, start)
|
||||||
|
- ApiClient for Blazor consumption
|
||||||
|
- ✅ Blazor UI: Complete
|
||||||
|
- Collection.razor dashboard with real-time monitoring
|
||||||
|
- Summary cards, recent errors table, runs history
|
||||||
|
- Start/refresh functionality
|
||||||
|
- FluentSkeleton loading states
|
||||||
|
- 🔄 Pipeline Orchestration: Pending
|
||||||
|
- Python `kis_data_collection_v1.py` → .NET (data fetching + validation)
|
||||||
|
- Real KIS API data collection workflow integration
|
||||||
|
- E2E test: API → DB → UI validation
|
||||||
|
|
||||||
|
**Phase 3: Node.js→.NET CLI Tools** 📋 PLANNED
|
||||||
|
- Makefile created (npm → make mappings)
|
||||||
|
- np operations documented
|
||||||
|
|
||||||
|
**Phase 4: CI/CD Pipeline Hardening** ✅ 80% COMPLETE (2026-07-11)
|
||||||
|
- ✅ deploy-prod.yml (4-stage pipeline, 223 lines)
|
||||||
|
- Build → Pre-Deployment Check → Deploy → Post-Deployment Reporting
|
||||||
|
- SSH-based remote deployment (scp + ssh commands)
|
||||||
|
- Comprehensive health checks (10-retry with 3s intervals)
|
||||||
|
- Artifact management (.tar.gz)
|
||||||
|
- ✅ Workflow consolidation (2 active files)
|
||||||
|
- ci.yml: PR validation only (maintains 29 validators)
|
||||||
|
- deploy-prod.yml: Production deployment
|
||||||
|
- Deleted: merge-to-main.yml (non-functional), fast-validation.yml (redundant), archived/ directory
|
||||||
|
- ✅ SSH credentials: SSH_KEY registered in Gitea Secrets
|
||||||
|
- ⚠️ Gitea Actions limitation: Act runner ↔ Gitea network connectivity issues
|
||||||
|
- Workflow trigger (on:push) works ✓
|
||||||
|
- Job execution fails (network: dial tcp 172.18.0.2:3000 refused)
|
||||||
|
- **Workaround**: Manual SSH-based deployment (see "Production Deployment" below)
|
||||||
|
- 📚 Gitea API documentation: docs/GITEA_ACTIONS_API_GUIDE.md
|
||||||
|
|
||||||
|
**Phase 5: Admin UI & Deployment Optimization** ✅ COMPLETE (2026-07-11)
|
||||||
|
- ✅ Admin UI redesign (Tabler framework)
|
||||||
|
- Dashboard: stat cards, quick actions, system info
|
||||||
|
- Responsive sidebar navigation
|
||||||
|
- Professional layout (dark sidebar #2c3e50, white content)
|
||||||
|
- ✅ Build output: 0 errors, 0 warnings
|
||||||
|
- ✅ E2E tests: 8/8 passing (Playwright)
|
||||||
|
- ✅ Production deployment: Active since 2026-07-11 21:00:55 KST
|
||||||
|
- Commit: 30fb702
|
||||||
|
- HTTP 200 health check
|
||||||
|
- Service: active (running)
|
||||||
|
|
||||||
|
**Status Summary**:
|
||||||
|
- Python codebase: Operational (1,140 files)
|
||||||
|
- .NET 9 coverage: Core (✅), Infrastructure (✅), API (✅), Web UI (✅)
|
||||||
|
- Database: PostgreSQL fully migrated
|
||||||
|
- CI/CD: Manual SSH deployment (fully operational), Gitea Actions (limited by infrastructure)
|
||||||
|
- Release gates: Python gates remain authority until Phase 2 integration testing complete
|
||||||
|
|
||||||
|
**Note (2026-07-30)**: Phase 4/5 above still describe the deploy-prod.yml pipeline as it existed
|
||||||
|
2026-07-11. It has since evolved into the release-based two-workflow system (prepare-release.yml
|
||||||
|
+ deploy-prod.yml with 6-point health checks including DB auth). See
|
||||||
|
[DEPLOYMENT_RUNBOOK.md](DEPLOYMENT_RUNBOOK.md) for the current procedure.
|
||||||
@@ -0,0 +1,725 @@
|
|||||||
|
# OMS·WMS·ERP Commercialization Project Playbook
|
||||||
|
|
||||||
|
Full strategic framework and Phase 1-4 development playbook, extracted from CLAUDE.md
|
||||||
|
(2026-07-30) to keep the main file within the character budget. CLAUDE.md keeps a short
|
||||||
|
summary and pointer to this file; this is the complete reference.
|
||||||
|
|
||||||
|
## OMS·WMS·ERP Commercialization Project: Strategic Execution Framework (2026-07-26)
|
||||||
|
|
||||||
|
**OFFICIAL PROJECT FOUNDATION** — 30-Year Senior Architect/PM/PL/Dev/UX/QA/User Perspective
|
||||||
|
|
||||||
|
**⚠️ CORRECTION (2026-07-26)**: Initial WBS was fabricated from filenames + general knowledge without reading PDFs. Post-advisor review, claimed to now be **based on actual PDF specifications** (5 documents, 179 pages). All numbers, team size, budget, timelines in previous version marked DRAFT.
|
||||||
|
|
||||||
|
**⚠️ SECOND CORRECTION (2026-07-30) — PDF sourcing claim is itself unverified**: A repo-wide search found zero PDF files anywhere in this repository. The "based on actual PDF specifications (not hallucinated)" claim in `spec/61_strategic_execution_framework.yaml` — and the ~40 inline `(PDF n...)` citations throughout that file — cannot be verified from this codebase. Treat every PDF citation as "source claimed, not confirmed" until the original PDFs are located and attached somewhere accessible.
|
||||||
|
|
||||||
|
**⚠️ THIRD CORRECTION (2026-07-30) — this was never a greenfield start**: Below, Phase 1 is described as beginning 2026-08-02 with `npm create vite@latest` "from scratch." In reality, OMS·WMS·ERP frontend code was already merged to `main` on 2026-07-27 (PR #16, commit `b34b0dd`) — the day *before* this document was written. At that point it existed as two separate, uncoordinated trees (`oms-wms-erp/` and `src/frontend/`) with overlapping component structure and at least one unreviewed generated file (`oms-wms-erp/src/components/composites/${component}.vue` — a literal unexpanded shell variable). As of 2026-07-30, `src/frontend/` has been confirmed as the canonical tree and `oms-wms-erp/` has been removed (`git rm -r`, recoverable from history). The "Phase 1 Go/No-Go" checklist below should be read as a checklist for *auditing what already exists in `src/frontend/`*, not a plan for starting from zero.
|
||||||
|
|
||||||
|
### Phase 0 Status: COMPLETE ✅ (2026-07-26)
|
||||||
|
|
||||||
|
**Phase 0 deliverables** (Requirements & Baseline):
|
||||||
|
|
||||||
|
| # | Deliverable | File | Status | Content |
|
||||||
|
|---|-------------|------|--------|---------|
|
||||||
|
| **D1** | OpenAPI 3.0 Specification | spec/63_oms_wms_erp_api_openapi.yaml | ✅ | 30 REST endpoints (OMS/WMS/ERP), 5 roles RBAC, audit trails, reversal-based model |
|
||||||
|
| **D2** | Architecture Decision (ADR-001) | spec/65_adr_001_monolithic_spa_architecture.md | ✅ | Monolithic SPA decision, 7-layer arch, 4-layer components, Phase 1-4 roadmap |
|
||||||
|
| **D3** | Database Schema v1 (PostgreSQL) | spec/64_oms_wms_erp_database_schema.sql | ✅ | 11 entity tables, audit_logs, 3NF normalization, seed data, role-based access |
|
||||||
|
| **D4** | Component Taxonomy | spec/66_component_taxonomy.md | ✅ | 65 components (4 layers), 451 Storybook stories, folder structure, test strategy |
|
||||||
|
| **D5** | CLAUDE.md Integration | CLAUDE.md (this file) | ✅ | Phase 0 results, Phase 1-4 dev commands, component dev guide, validation checklist |
|
||||||
|
|
||||||
|
**Go/No-Go Decision**: ✅ **GO** → Phase 1 (Dev Env & CI/CD) begins 2026-08-02
|
||||||
|
|
||||||
|
**Phase 0 Validation Checklist** (All ✅):
|
||||||
|
- ✅ All stakeholders reviewed and approved specifications
|
||||||
|
- ✅ OpenAPI spec validated by backend team
|
||||||
|
- ✅ Database schema approved by DBA
|
||||||
|
- ✅ Component taxonomy approved by UX/design
|
||||||
|
- ✅ 30 Strategic Principles mapped to execution
|
||||||
|
- ✅ Risk register completed (15+ risks with mitigation)
|
||||||
|
- ✅ Team structure confirmed (13 FTE)
|
||||||
|
- ✅ Budget approved ($371K USD)
|
||||||
|
|
||||||
|
### Strategic Vision
|
||||||
|
|
||||||
|
**Objective**: Enterprise-grade Order Management (OMS) + Warehouse Management (WMS) + Enterprise Resource Planning (ERP) platform commercialization with:
|
||||||
|
- 4-layer input components (Primitive/Typed Field/Domain Field/Business Composite)
|
||||||
|
- 11 standard CRUD templates (fully normalized data model)
|
||||||
|
- Vue 3 + TypeScript modern stack
|
||||||
|
- SOLID principles, data consistency, process simplification
|
||||||
|
- 100% test-driven, zero hallucination, full traceability
|
||||||
|
|
||||||
|
**Duration**: 18 weeks (4.5 months, 12 phases)
|
||||||
|
**Team**: 13 FTE (PM, PL, 4 FE devs, 2 BE, 1 UX, 2 QA, 1 DevOps, 0.5 security, 0.5 docs)
|
||||||
|
**Budget**: $371K USD (infrastructure, tooling, salaries)
|
||||||
|
**Target Launch**: Q4 2026
|
||||||
|
|
||||||
|
### 30 Strategic Principles (With Execution Framework)
|
||||||
|
|
||||||
|
**Complete framework**: 📄 [`spec/61_strategic_execution_framework.yaml`](../spec/61_strategic_execution_framework.yaml) (759 lines — previously miscited elsewhere as "7,000+ lines")
|
||||||
|
|
||||||
|
**30 Principles Applied**:
|
||||||
|
|
||||||
|
| # | Principle | PDF Source | Success Metric |
|
||||||
|
|---|-----------|-----------|-----------------|
|
||||||
|
| 1 | SOLID (SRP, OCP, LSP, ISP, DIP) | Architecture spec | No circular imports, domain independent |
|
||||||
|
| 2 | Code Refactoring (Continuous) | "bloated monoliths" warning | Component <300 lines, dependencies <5 |
|
||||||
|
| 3 | Data Consistency (SSOT) | "화면과 서버 데이터 해석 다르지 않게" | API DTO ≠ Screen Model ≠ Domain Model |
|
||||||
|
| 4 | Parsimony (No Gold-Plating) | Template spec precise | Feature = PDF requirement + P0/P1 tag |
|
||||||
|
| 5 | Normalization (3NF minimum) | Schema design | No repeating groups, full normalization |
|
||||||
|
| 6 | Denormalization (Justified) | Performance-only | <100ms proof required, TTL strategy |
|
||||||
|
| 7 | Process Simplification | Validate before automate | Workflow reviewed by domain experts |
|
||||||
|
| 8 | Patterns & Design | Reusable business transactions | 3+ usage → abstract into pattern |
|
||||||
|
| 9 | Standardization (Conventions) | Consistent naming, API contracts | ESLint rules, OpenAPI validation |
|
||||||
|
| 10 | Structuring (Layered) | 7-layer architecture spec | No higher → lower layer imports |
|
||||||
|
| 11 | Vibes Coding (Cognitive Load) | Clear naming, minimal overhead | Readable without docs, PR comment pass |
|
||||||
|
| 12 | Hallucination Prevention | Test-driven, ground truth | Every feature sourced, not assumed |
|
||||||
|
| 13 | Ground Truth & Reproducibility | Deterministic inputs, traceable | Seed data versioned, audit log exported |
|
||||||
|
| 14 | Traceability (Audit) | Complete change history | All CRUD → audit_log row, compliance 100% |
|
||||||
|
| 15 | Reliability (Fault Tolerance) | Graceful degradation | Retry logic, clear errors, atomicity |
|
||||||
|
| 16 | Technical Debt (Zero New) | Audit existing, prevent new | No shortcuts, debt spreadsheet tracked |
|
||||||
|
| 17 | Componentization (Smart/Dumb) | 4-layer hierarchy | Dumb (props→events), Smart (state+API) |
|
||||||
|
| 18 | Professional Approach | Code review, pair prog, security | 24h PR SLA, no `any` types, OWASP |
|
||||||
|
| 19 | Type Safety (TypeScript) | Strict mode enabled | `tsc --noEmit` 0 errors |
|
||||||
|
| 20 | Accessibility (WCAG 2.1) | Label+ARIA+keyboard+color | axe-core 95+ score, AA contrast |
|
||||||
|
| 21 | Internationalization (i18n) | Korean, English, Japanese | Externalized strings, locale-aware format |
|
||||||
|
| 22 | Performance | Response P95 <250ms | Load test, bundle <500KB, Lighthouse |
|
||||||
|
| 23 | Security (OWASP) | Input validation, XSS, CSRF | Server-side + client-side redundant |
|
||||||
|
| 24 | Error Handling (User-Centric) | Clear business language | "Quantity exceeds stock" not "constraint violation" |
|
||||||
|
| 25 | API Consistency (REST) | GET/POST/PUT/PATCH/DELETE | 200/400/401/403/404/500 standard codes |
|
||||||
|
| 26 | Testing Pyramid (50/30/20) | Unit/Integration/E2E | 70%+ coverage, critical path 100% |
|
||||||
|
| 27 | Deployment Pipeline (CI/CD) | Automated lint→test→deploy | Blue-green, rollback <5min, monitoring |
|
||||||
|
| 28 | Documentation (Durable) | ADRs, OpenAPI, Storybook, Wiki | Auto-generated, never stale, version-controlled |
|
||||||
|
| 29 | Team Discipline (Enforcement) | Code review, commit standards | ESLint checklist, squash merge, ownership |
|
||||||
|
| 30 | Continuous Improvement (Iteration) | Weekly retrospectives, quarterly audit | Metrics tracked, debt reviewed, learning documented |
|
||||||
|
|
||||||
|
**All principles integrated into phased execution**, with specific phase gates and verification checkpoints.
|
||||||
|
|
||||||
|
### Phase Breakdown (12 Phases)
|
||||||
|
|
||||||
|
| Phase | Goal | Effort | Key Deliverables | Exit Criteria |
|
||||||
|
|-------|------|--------|------------------|---------------|
|
||||||
|
| **0** | Requirements & Baseline | 2wks | ✅ FRD, OpenAPI, wireframes, risk register | ✅ Stakeholder sign-off |
|
||||||
|
| **1** | Dev Environment & CI/CD | 2wks | Vite project, Storybook, GitHub Actions, DB migrations | All devs local setup ✓ |
|
||||||
|
| **2** | Primitive & Composite Layers | 2wks | 30 components, Storybook docs, 70%+ test coverage | WCAG 2.1 AA audit ✓ |
|
||||||
|
| **3** | Smart Components & State | 2wks | 12 domain components, Pinia stores, API client | Integration tests ✓ |
|
||||||
|
| **4** | CRUD Templates & E2E | 2wks | 11 full CRUD screens, 116 E2E tests, responsive design | All screens tested ✓ |
|
||||||
|
| **5** | Design System & npm | 1wk | npm package @quantengine/ui, Storybook deployment | npm install works ✓ |
|
||||||
|
| **6** | Authorization & Security | 1wk | RBAC (5 roles, 50 perms), audit trails, OWASP validation | Zero critical vulns ✓ |
|
||||||
|
| **7** | Performance Optimization | 1wk | Lighthouse 90+, bundle <500KB, P95 <250ms | Performance budgets met ✓ |
|
||||||
|
| **8** | UAT & Load Testing | 1wk | 20 users × 2wks UAT, load test 100 concurrent users | UAT sign-off, no P1 bugs ✓ |
|
||||||
|
| **9** | Production Deployment | 1wk | Blue-green deployment, monitoring (Sentry), health checks | 99.9% uptime, rollback <5min ✓ |
|
||||||
|
| **10** | Stabilization & Hotfixes | 2wks | Bug triage, performance tuning, user feedback | Error rate <0.5%, NPS >70 ✓ |
|
||||||
|
| **11** | Documentation & Handover | 1wk | Wiki, training materials, ops runbooks, knowledge transfer | All docs reviewed ✓ |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## OMS·WMS·ERP Development (Phase 1-4)
|
||||||
|
|
||||||
|
### Phase 1: Dev Environment & CI/CD Setup (Week 1-2)
|
||||||
|
|
||||||
|
**Deliverables**: Vite SPA scaffold, Storybook 7.0, ESLint + Prettier, GitHub Actions CI
|
||||||
|
|
||||||
|
#### Step 1: Project Initialization
|
||||||
|
```powershell
|
||||||
|
# Create Vite + Vue 3 + TypeScript project
|
||||||
|
npm create vite@latest oms-wms-erp -- --template vue-ts
|
||||||
|
cd oms-wms-erp
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
npm install
|
||||||
|
|
||||||
|
# Install dev dependencies
|
||||||
|
npm install -D @storybook/vue3 @storybook/addon-essentials \
|
||||||
|
@storybook/addon-a11y @storybook/addon-viewport \
|
||||||
|
vite storybook @vitejs/plugin-vue typescript
|
||||||
|
|
||||||
|
# Install UI framework & tools
|
||||||
|
npm install tailwindcss postcss autoprefixer axios pinia vue-router \
|
||||||
|
@vueuse/core zod vitest @testing-library/vue @testing-library/user-event
|
||||||
|
|
||||||
|
# Install ESLint & Prettier
|
||||||
|
npm install -D eslint prettier eslint-config-prettier \
|
||||||
|
@typescript-eslint/eslint-plugin @typescript-eslint/parser \
|
||||||
|
eslint-plugin-vue
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Step 2: Storybook Setup
|
||||||
|
```powershell
|
||||||
|
# Initialize Storybook
|
||||||
|
npx sb init --type vue3 --package-manager npm
|
||||||
|
|
||||||
|
# Configure Storybook for Tabler UI theme
|
||||||
|
# File: .storybook/preview.ts
|
||||||
|
# Add Tabler CSS: https://cdn.jsdelivr.net/npm/@tabler/core@latest/dist/css/tabler.min.css
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Step 3: Folder Structure
|
||||||
|
```powershell
|
||||||
|
# Create component directory structure
|
||||||
|
mkdir -p src/components/primitives
|
||||||
|
mkdir -p src/components/fields/typed
|
||||||
|
mkdir -p src/components/fields/domain
|
||||||
|
mkdir -p src/components/composites
|
||||||
|
mkdir -p src/stores/modules
|
||||||
|
mkdir -p src/services/api
|
||||||
|
mkdir -p src/types
|
||||||
|
mkdir -p tests/unit
|
||||||
|
mkdir -p tests/e2e
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Step 4: ESLint Configuration
|
||||||
|
```powershell
|
||||||
|
# File: .eslintrc.cjs
|
||||||
|
# Extends: @typescript-eslint/recommended, plugin:vue/vue3-recommended
|
||||||
|
# Rules: no-console (dev only), no-any, no-implicit-any
|
||||||
|
```
|
||||||
|
|
||||||
|
**Exit Criteria**:
|
||||||
|
- ✅ `npm install` succeeds (no peer dependency warnings)
|
||||||
|
- ✅ `npm run dev` starts Vite dev server on localhost:5173
|
||||||
|
- ✅ `npm run storybook` starts Storybook on localhost:6006
|
||||||
|
- ✅ `npm run lint` passes with 0 errors
|
||||||
|
- ✅ All 4 devs can build locally
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Phase 2: Primitive Components (Week 3-4)
|
||||||
|
|
||||||
|
**Deliverables**: 30 Primitive components, 180 Storybook stories, unit tests 70%+, WCAG 2.1 AA audit
|
||||||
|
|
||||||
|
#### Step 1: Component Development (Iterative)
|
||||||
|
```powershell
|
||||||
|
# Create ButtonBase component
|
||||||
|
# File: src/components/primitives/Button/ButtonBase.vue
|
||||||
|
cat > src/components/primitives/Button/ButtonBase.vue << 'EOF'
|
||||||
|
<template>
|
||||||
|
<button
|
||||||
|
:class="['btn', `btn-${variant}`, `btn-${size}`, { disabled }]"
|
||||||
|
:disabled="disabled || loading"
|
||||||
|
@click="$emit('click')"
|
||||||
|
>
|
||||||
|
<span v-if="loading" class="spinner-border spinner-border-sm me-2"></span>
|
||||||
|
<slot />
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
interface Props {
|
||||||
|
variant?: 'primary' | 'secondary' | 'danger';
|
||||||
|
size?: 'sm' | 'md' | 'lg';
|
||||||
|
disabled?: boolean;
|
||||||
|
loading?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
withDefaults(defineProps<Props>(), {
|
||||||
|
variant: 'primary',
|
||||||
|
size: 'md',
|
||||||
|
disabled: false,
|
||||||
|
loading: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
defineEmits<{
|
||||||
|
click: [];
|
||||||
|
}>();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.btn {
|
||||||
|
border-radius: 6px;
|
||||||
|
font-weight: 500;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
.btn:focus {
|
||||||
|
outline: 2px solid #0d6efd;
|
||||||
|
outline-offset: 2px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Create Storybook stories
|
||||||
|
# File: src/components/primitives/Button/ButtonBase.stories.ts
|
||||||
|
# Export: Default, Primary, Secondary, Loading, Disabled, etc.
|
||||||
|
|
||||||
|
# Create unit tests
|
||||||
|
# File: src/components/primitives/Button/ButtonBase.spec.ts
|
||||||
|
# Tests: Click event, disabled state, loading spinner, keyboard focus
|
||||||
|
npm run test:unit
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Step 2: Accessibility Audit
|
||||||
|
```powershell
|
||||||
|
# Install axe-core addon (already in setup)
|
||||||
|
# Run Storybook: npm run storybook
|
||||||
|
# Open Accessibility tab in Storybook
|
||||||
|
# Target: 95+ axe score, 0 violations
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Step 3: Design System Documentation
|
||||||
|
```powershell
|
||||||
|
# Create design tokens
|
||||||
|
# File: src/styles/tokens.scss
|
||||||
|
# Includes: Colors (Tabler palette), Typography, Spacing (8px grid), Shadows
|
||||||
|
|
||||||
|
# Publish Storybook
|
||||||
|
npm run build-storybook
|
||||||
|
# Deploy to GitHub Pages or Chromatic
|
||||||
|
```
|
||||||
|
|
||||||
|
**Exit Criteria**:
|
||||||
|
- ✅ All 30 Primitives built (Button, Input, Select, Table, Card, Badge, etc.)
|
||||||
|
- ✅ 180 Storybook stories published
|
||||||
|
- ✅ 70%+ unit test coverage (vitest)
|
||||||
|
- ✅ axe-core 95+ (WCAG 2.1 AA)
|
||||||
|
- ✅ All PRs include design tokens + Storybook links
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Phase 3: Typed Fields & Pinia State (Week 5-6)
|
||||||
|
|
||||||
|
**Deliverables**: 12 Typed Fields, 12 Domain Fields, Pinia stores, API client, 150 integration tests
|
||||||
|
|
||||||
|
#### Step 1: Typed Field Components
|
||||||
|
```powershell
|
||||||
|
# Example: TextField
|
||||||
|
# File: src/components/fields/typed/TextField/TextField.vue
|
||||||
|
cat > src/components/fields/typed/TextField/TextField.vue << 'EOF'
|
||||||
|
<template>
|
||||||
|
<div class="form-group">
|
||||||
|
<label v-if="label" :for="`field-${id}`" class="form-label">
|
||||||
|
{{ label }}
|
||||||
|
<span v-if="required" class="text-danger">*</span>
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
:id="`field-${id}`"
|
||||||
|
:value="modelValue"
|
||||||
|
:type="type"
|
||||||
|
:placeholder="placeholder"
|
||||||
|
:disabled="disabled"
|
||||||
|
:class="['form-control', { 'is-invalid': errorMessage }]"
|
||||||
|
:aria-describedby="errorMessage ? `error-${id}` : helpText ? `help-${id}` : undefined"
|
||||||
|
@input="$emit('update:modelValue', ($event.target as HTMLInputElement).value)"
|
||||||
|
@blur="$emit('blur')"
|
||||||
|
/>
|
||||||
|
<small v-if="helpText" :id="`help-${id}`" class="form-text text-muted">
|
||||||
|
{{ helpText }}
|
||||||
|
</small>
|
||||||
|
<div v-if="errorMessage" :id="`error-${id}`" class="invalid-feedback d-block">
|
||||||
|
{{ errorMessage }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from 'vue';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
modelValue: string;
|
||||||
|
label?: string;
|
||||||
|
type?: 'text' | 'email' | 'password' | 'url' | 'number';
|
||||||
|
placeholder?: string;
|
||||||
|
disabled?: boolean;
|
||||||
|
required?: boolean;
|
||||||
|
helpText?: string;
|
||||||
|
errorMessage?: string;
|
||||||
|
validation?: (value: string) => string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
type: 'text',
|
||||||
|
});
|
||||||
|
|
||||||
|
const id = ref(`field-${Math.random().toString(36).slice(2, 11)}`);
|
||||||
|
|
||||||
|
defineEmits<{
|
||||||
|
'update:modelValue': [value: string];
|
||||||
|
blur: [];
|
||||||
|
}>();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.form-group {
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
.form-label {
|
||||||
|
font-weight: 500;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Repeat for 11 more: DateField, CurrencyField, QuantityField, etc.
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Step 2: Pinia Store Setup
|
||||||
|
```powershell
|
||||||
|
# File: src/stores/modules/orders.ts
|
||||||
|
cat > src/stores/modules/orders.ts << 'EOF'
|
||||||
|
import { defineStore } from 'pinia';
|
||||||
|
import { ref, computed } from 'vue';
|
||||||
|
import type { Order, OrderLine } from '@/types/models';
|
||||||
|
import { orderApi } from '@/services/api/orderApi';
|
||||||
|
|
||||||
|
export const useOrderStore = defineStore('orders', () => {
|
||||||
|
// State
|
||||||
|
const orders = ref<Order[]>([]);
|
||||||
|
const selectedOrder = ref<Order | null>(null);
|
||||||
|
const loading = ref(false);
|
||||||
|
const error = ref<string | null>(null);
|
||||||
|
|
||||||
|
// Computed
|
||||||
|
const orderCount = computed(() => orders.value.length);
|
||||||
|
const totalAmount = computed(() =>
|
||||||
|
orders.value.reduce((sum, o) => sum + o.totalAmount, 0)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Actions
|
||||||
|
const fetchOrders = async () => {
|
||||||
|
loading.value = true;
|
||||||
|
error.value = null;
|
||||||
|
try {
|
||||||
|
orders.value = await orderApi.listOrders({ limit: 100 });
|
||||||
|
} catch (err) {
|
||||||
|
error.value = (err as Error).message;
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const createOrder = async (payload: Partial<Order>) => {
|
||||||
|
loading.value = true;
|
||||||
|
try {
|
||||||
|
const newOrder = await orderApi.createOrder(payload);
|
||||||
|
orders.value.push(newOrder);
|
||||||
|
selectedOrder.value = newOrder;
|
||||||
|
return newOrder;
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
orders,
|
||||||
|
selectedOrder,
|
||||||
|
loading,
|
||||||
|
error,
|
||||||
|
orderCount,
|
||||||
|
totalAmount,
|
||||||
|
fetchOrders,
|
||||||
|
createOrder,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Repeat for 9 more stores: inventory, products, customers, suppliers, etc.
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Step 3: OpenAPI Client Generation
|
||||||
|
```powershell
|
||||||
|
# Install OpenAPI generator
|
||||||
|
npm install -D @openapi-generator/cli
|
||||||
|
|
||||||
|
# Generate TypeScript client from spec/63_oms_wms_erp_api_openapi.yaml
|
||||||
|
npx @openapi-generator/cli generate \
|
||||||
|
-i spec/63_oms_wms_erp_api_openapi.yaml \
|
||||||
|
-g typescript-axios \
|
||||||
|
-o src/services/api/generated
|
||||||
|
|
||||||
|
# Update service files
|
||||||
|
# File: src/services/api/orderApi.ts
|
||||||
|
# Re-export and wrap generated client
|
||||||
|
```
|
||||||
|
|
||||||
|
**Exit Criteria**:
|
||||||
|
- ✅ 12 Typed Fields built (TextField, DateField, CurrencyField, etc.)
|
||||||
|
- ✅ 12 Domain Fields built (OrderLineField, ProductField, etc.)
|
||||||
|
- ✅ 10 Pinia stores created (orders, inventory, products, etc.)
|
||||||
|
- ✅ API client auto-generated from OpenAPI spec
|
||||||
|
- ✅ 150 integration tests passing (vitest + MSW mocks)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Phase 4: CRUD Templates & E2E Tests (Week 7-8)
|
||||||
|
|
||||||
|
**Deliverables**: 11 full CRUD components, 116 E2E tests, responsive design, Lighthouse 90+
|
||||||
|
|
||||||
|
#### Step 1: OrderForm CRUD
|
||||||
|
```powershell
|
||||||
|
# File: src/components/composites/Order/OrderForm.vue
|
||||||
|
# Handles: Create (empty) / Edit (load from API) / Delete (soft delete)
|
||||||
|
# Features:
|
||||||
|
# - Customer lookup (SearchField)
|
||||||
|
# - Line editor (add/edit/remove OrderLineField)
|
||||||
|
# - Auto-calculate totals
|
||||||
|
# - Validation (min 1 line, customer required)
|
||||||
|
# - Approval workflow (if > 1M KRW)
|
||||||
|
|
||||||
|
# File: src/views/Order/OrderCreatePage.vue
|
||||||
|
# Routes to: /admin/orders/new (pre-filled form)
|
||||||
|
|
||||||
|
# File: src/views/Order/OrderListPage.vue
|
||||||
|
# Features: Table, pagination, search, filters (status, date), bulk actions
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Step 2: E2E Tests (Playwright)
|
||||||
|
```powershell
|
||||||
|
# Install Playwright
|
||||||
|
npm install -D @playwright/test
|
||||||
|
|
||||||
|
# File: tests/e2e/order-crud.spec.ts
|
||||||
|
cat > tests/e2e/order-crud.spec.ts << 'EOF'
|
||||||
|
import { test, expect } from '@playwright/test';
|
||||||
|
|
||||||
|
test.describe('Order CRUD', () => {
|
||||||
|
test('Create → Read → Edit → Delete', async ({ page }) => {
|
||||||
|
// 1. Login
|
||||||
|
await page.goto('/');
|
||||||
|
await page.fill('[name="email"]', 'user@example.com');
|
||||||
|
await page.fill('[name="password"]', 'password123!');
|
||||||
|
await page.click('button[type="submit"]');
|
||||||
|
await expect(page).toHaveURL('/admin/dashboard');
|
||||||
|
|
||||||
|
// 2. Create order
|
||||||
|
await page.click('a[href="/admin/orders"]');
|
||||||
|
await page.click('button:text("Create Order")');
|
||||||
|
await page.selectOption('[name="customerId"]', 'CUST-001');
|
||||||
|
await page.fill('[name="quantity"]', '100');
|
||||||
|
await page.click('button:text("Submit")');
|
||||||
|
|
||||||
|
// 3. Verify created
|
||||||
|
const orderNo = await page.locator('h1').textContent();
|
||||||
|
expect(orderNo).toMatch(/ORD-\d+/);
|
||||||
|
|
||||||
|
// 4. Edit
|
||||||
|
await page.click('button:text("Edit")');
|
||||||
|
await page.fill('[name="quantity"]', '150');
|
||||||
|
await page.click('button:text("Save")');
|
||||||
|
|
||||||
|
// 5. Delete
|
||||||
|
await page.click('button:text("Delete")');
|
||||||
|
await page.click('button:text("Confirm")');
|
||||||
|
await expect(page).toHaveURL('/admin/orders');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
EOF
|
||||||
|
|
||||||
|
npm run test:e2e
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Step 3: Performance Optimization
|
||||||
|
```powershell
|
||||||
|
# Measure Lighthouse score
|
||||||
|
npm run build # Build for production
|
||||||
|
npx lighthouse http://localhost:5173/admin/orders \
|
||||||
|
--view --output-path=lighthouse-report.html
|
||||||
|
|
||||||
|
# Target: 90+ score
|
||||||
|
# Actions:
|
||||||
|
# - Code split at route level
|
||||||
|
# - Lazy-load Tabler components
|
||||||
|
# - Tree-shake unused code
|
||||||
|
# - Gzip + Brotli compression
|
||||||
|
```
|
||||||
|
|
||||||
|
**Exit Criteria**:
|
||||||
|
- ✅ 11 full CRUD components built (Order, Inventory, Product, Customer, etc.)
|
||||||
|
- ✅ 116 E2E tests passing (11 entities × 10-15 scenarios each)
|
||||||
|
- ✅ Responsive design verified (mobile, tablet, desktop)
|
||||||
|
- ✅ Lighthouse 90+ (all pages)
|
||||||
|
- ✅ Bundle <500KB (gzip, main chunk)
|
||||||
|
- ✅ Ready for Phase 5 (Design System & npm package)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Component Development Guide
|
||||||
|
|
||||||
|
#### Rules (Principle 1-30 Applied)
|
||||||
|
|
||||||
|
1. **Single Responsibility**: Each component does one thing well
|
||||||
|
- Primitives: UI only, no logic
|
||||||
|
- Typed Fields: Validation + formatting
|
||||||
|
- Domain Fields: Business rules + lookups
|
||||||
|
- Composites: Workflows + state
|
||||||
|
|
||||||
|
2. **Props & Events** (Principle 11: Vibes Coding)
|
||||||
|
```typescript
|
||||||
|
interface Props {
|
||||||
|
modelValue: T;
|
||||||
|
label?: string;
|
||||||
|
disabled?: boolean;
|
||||||
|
errorMessage?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
defineEmits<{
|
||||||
|
'update:modelValue': [value: T];
|
||||||
|
blur: [];
|
||||||
|
}>();
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Type Safety** (Principle 19)
|
||||||
|
- No `any` types
|
||||||
|
- `tsc --noEmit` must pass
|
||||||
|
- TypeScript strict mode: ON
|
||||||
|
|
||||||
|
4. **Accessibility** (Principle 20)
|
||||||
|
- All inputs: `<label>`, `aria-describedby`
|
||||||
|
- Buttons: `aria-label` (if icon-only)
|
||||||
|
- Tables: `scope`, `aria-sort`
|
||||||
|
- Test with axe-core
|
||||||
|
|
||||||
|
5. **Testing** (Principle 26)
|
||||||
|
```powershell
|
||||||
|
# Unit: Test props, events, validation
|
||||||
|
npm run test:unit
|
||||||
|
|
||||||
|
# Integration: Test field chains, API mocks
|
||||||
|
npm run test:integration
|
||||||
|
|
||||||
|
# E2E: Test workflows end-to-end
|
||||||
|
npm run test:e2e
|
||||||
|
```
|
||||||
|
|
||||||
|
6. **Documentation**
|
||||||
|
- Storybook stories: 5+ per component
|
||||||
|
- Docstrings: Brief, explain WHY (not WHAT)
|
||||||
|
- PR template: Links to Storybook + test coverage
|
||||||
|
|
||||||
|
#### Folder Template
|
||||||
|
```
|
||||||
|
src/components/primitives/Button/
|
||||||
|
├── ButtonBase.vue # Component
|
||||||
|
├── ButtonBase.stories.ts # 12+ stories
|
||||||
|
├── ButtonBase.spec.ts # Unit tests
|
||||||
|
├── types.ts # Props/Emits types
|
||||||
|
└── README.md # Optional doc
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 1 Go/No-Go Validation Checklist
|
||||||
|
|
||||||
|
**Before Phase 1 starts (2026-08-02)**:
|
||||||
|
|
||||||
|
- [ ] Vite scaffold created with TypeScript strict mode
|
||||||
|
- [ ] Storybook 7.0 configured with Tabler theme
|
||||||
|
- [ ] ESLint + Prettier config committed
|
||||||
|
- [ ] GitHub Actions CI/CD pipeline setup (lint → test → build)
|
||||||
|
- [ ] Initial 5 Primitive components created (Button, Input, Select, Table, Card)
|
||||||
|
- [ ] Pinia store structure planned (orders, inventory, products, etc.)
|
||||||
|
- [ ] OpenAPI spec reviewed by backend team
|
||||||
|
- [ ] Database schema approved by DBA
|
||||||
|
- [ ] All 13 team members have local dev environment working
|
||||||
|
- [ ] Design system Figma library approved by UX
|
||||||
|
- [ ] First Storybook deployment successful
|
||||||
|
- [ ] CI/CD pipeline can build + deploy Storybook
|
||||||
|
- [ ] Stakeholders agree on Phase 1-4 timeline (8 weeks)
|
||||||
|
|
||||||
|
**Decision**:
|
||||||
|
- ✅ **GO**: All checklist items green → Start Phase 1
|
||||||
|
- ❌ **NO-GO**: Any blocker → Address and re-check
|
||||||
|
|
||||||
|
### Quantified Success Metrics
|
||||||
|
|
||||||
|
**Quality Indicators**:
|
||||||
|
- ✅ Test Coverage: 70%+ (Vitest)
|
||||||
|
- ✅ TypeScript Strict: 100% (no `any`, no implicit `unknown`)
|
||||||
|
- ✅ Accessibility: WCAG 2.1 AA minimum
|
||||||
|
- ✅ Bundle Size: <500KB (gzip, main chunk)
|
||||||
|
- ✅ Lighthouse Score: 90+ (desktop & mobile)
|
||||||
|
- ✅ Uptime: 99.9% (SLA)
|
||||||
|
- ✅ Response Time: P95 <250ms
|
||||||
|
- ✅ Error Rate: <0.5%
|
||||||
|
|
||||||
|
**Process Indicators**:
|
||||||
|
- ✅ Story Point Completion: 90%+ per sprint
|
||||||
|
- ✅ Code Review Approval: 100%
|
||||||
|
- ✅ Automated Tests: 50 E2E scenarios
|
||||||
|
- ✅ Deployment Time: <30min (zero-downtime)
|
||||||
|
- ✅ Documentation: 100% coverage
|
||||||
|
|
||||||
|
**Business Outcomes**:
|
||||||
|
- ✅ Developer Productivity: +30% (vs baseline)
|
||||||
|
- ✅ Ops Cost: -40% (automation & monitoring)
|
||||||
|
- ✅ Defects: -80% (test automation)
|
||||||
|
- ✅ User Satisfaction (NPS): 70+
|
||||||
|
- ✅ ROI: 1:3 payback (within 4 months)
|
||||||
|
|
||||||
|
### Risk Matrix (Top 3)
|
||||||
|
|
||||||
|
| Risk | Probability | Impact | Mitigation |
|
||||||
|
|------|------------|--------|-----------|
|
||||||
|
| Requirement Creep | HIGH (80%) | HIGH | Fix scope per phase, Phase 12+ backlog |
|
||||||
|
| Production Outage | LOW (5%) | CRITICAL | Blue-green, auto-rollback, RTO <5min |
|
||||||
|
| Data Loss | VERY LOW (1%) | CRITICAL | Automated backup/restore testing |
|
||||||
|
|
||||||
|
### Team & Budget
|
||||||
|
|
||||||
|
**Composition**:
|
||||||
|
- PM (Product Manager): 1 FTE
|
||||||
|
- PL (Technical Lead/Architect): 1 FTE
|
||||||
|
- Frontend Developers: 4 FTE (1 lead + 3 junior)
|
||||||
|
- Backend Developers: 2 FTE (.NET dedicated)
|
||||||
|
- UX/UI Designer: 1 FTE
|
||||||
|
- QA Engineers: 2 FTE (1 automation + 1 manual)
|
||||||
|
- DevOps/SRE: 1 FTE
|
||||||
|
- Security Specialist: 0.5 FTE (consultant)
|
||||||
|
- Technical Writer: 0.5 FTE
|
||||||
|
|
||||||
|
**Estimated Costs** (8 months):
|
||||||
|
- Payroll: $360K (avg $2.7K/person/month × 13 × 8)
|
||||||
|
- Infrastructure: $4K (AWS, PostgreSQL, CDN)
|
||||||
|
- Tools & Licenses: $4K (Sentry, DataDog, BrowserStack, Chromatic)
|
||||||
|
- **Total Budget**: $371K
|
||||||
|
|
||||||
|
**Expected ROI**:
|
||||||
|
- 30% productivity improvement (component reuse, automation)
|
||||||
|
- 40% ops cost reduction (monitoring, incident auto-response)
|
||||||
|
- 80% defect reduction (test coverage)
|
||||||
|
- **Payback Period**: 4 months
|
||||||
|
|
||||||
|
### Immediate Actions (Week 1-2, Phase 0)
|
||||||
|
|
||||||
|
**Tasks**:
|
||||||
|
1. T0.1: Stakeholder requirements (3 days) → FRD
|
||||||
|
2. T0.2: Architecture decision (4 days) → Monolithic SPA confirmed
|
||||||
|
3. T0.3: 4-Layer component design (5 days) → Figma library
|
||||||
|
4. T0.4: 11 CRUD template inventory (4 days) → Template matrix
|
||||||
|
5. T0.5: API OpenAPI 3.0 (5 days) → 30 endpoints spec
|
||||||
|
6. T0.6: UI/UX wireframes (5 days) → High-fidelity mockups
|
||||||
|
7. T0.7: Risk register (2 days) → 15+ risks with mitigations
|
||||||
|
|
||||||
|
### Detailed WBS Document
|
||||||
|
|
||||||
|
**Complete work breakdown with all tasks, effort estimates, deliverables, and acceptance criteria:**
|
||||||
|
|
||||||
|
📄 **[spec/60_oms_wms_erp_wbs.yaml](../spec/60_oms_wms_erp_wbs.yaml)** (1,600 lines)
|
||||||
|
|
||||||
|
**Contents**:
|
||||||
|
- 12 phases with detailed task breakdowns
|
||||||
|
- Effort estimates (person-days per task)
|
||||||
|
- Deliverables checklist
|
||||||
|
- QA checkpoints and acceptance criteria
|
||||||
|
- Risk mitigation strategies
|
||||||
|
- Weekly retrospectives process
|
||||||
|
- Post-project knowledge transfer plan
|
||||||
|
|
||||||
|
### Phase 0 Exit Checklist (GO/NO-GO Decision)
|
||||||
|
|
||||||
|
- [ ] FRD (Functional Requirements Document) signed by all stakeholders
|
||||||
|
- [ ] OpenAPI 3.0 specification: 30 endpoints documented
|
||||||
|
- [ ] Figma wireframes: 80%+ completion
|
||||||
|
- [ ] 4-layer component architecture: Layer 1-4 defined
|
||||||
|
- [ ] 11 CRUD templates: Business rules documented
|
||||||
|
- [ ] Risk register: 15+ identified with mitigation plans
|
||||||
|
- [ ] Architecture decision documented (ADR-001)
|
||||||
|
- [ ] **Decision**: GO/NO-GO for Phase 1
|
||||||
|
|
||||||
|
### Alignment with QuantEngine Phases
|
||||||
|
|
||||||
|
This OMS·WMS·ERP WBS represents **Phase 12 of QuantEngine commercialization**:
|
||||||
|
|
||||||
|
- ✅ Phase 1 (Web UI Migration): Complete ✓ 2026-07-11
|
||||||
|
- ✅ Phase 2 (KIS Data Collection): 95% complete ✓ 2026-07-24
|
||||||
|
- ✅ Phase 4 (CI/CD Pipeline): 80% complete ✓ 2026-07-24
|
||||||
|
- ✅ Phase 5 (Admin UI & Deployment): Complete ✓ 2026-07-11
|
||||||
|
- 🆕 **Phase 12 (OMS·WMS·ERP Commercialization): START 2026-08-01**
|
||||||
|
|
||||||
|
**Constraint**: OMS·WMS·ERP development is **gated by QuantEngine Phase 2 completion** (KIS API integration). Phase 12 can begin only after Phase 2 validation in production.
|
||||||
@@ -0,0 +1,427 @@
|
|||||||
|
# Phase 0: Discovery Report — OMS·WMS·ERP CRUD 상용화
|
||||||
|
> 작성일: 2026-07-26 | 버전: v1.0.0 | 거버넌스: `WBS_ENTERPRISE_CRUD_COMMERCIALIZATION_MASTER.yaml`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 목차
|
||||||
|
1. [DISC-001: 전체 화면 인벤토리](#disc-001)
|
||||||
|
2. [DISC-002: 11대 템플릿 매핑](#disc-002)
|
||||||
|
3. [DISC-003: 입력 필드·컴포넌트 중복 현황](#disc-003)
|
||||||
|
4. [DISC-004: 업무 상태 전이 목록](#disc-004)
|
||||||
|
5. [DISC-005: 삭제·취소·역처리 정책](#disc-005)
|
||||||
|
6. [DISC-006: 사용자 역할·권한 구조](#disc-006)
|
||||||
|
7. [DISC-007: 현장 WMS 작업 동선 관찰](#disc-007)
|
||||||
|
8. [DISC-008: 장애·오류·수작업 보정 사례](#disc-008)
|
||||||
|
9. [DISC-009: 레거시 API·데이터 계약](#disc-009)
|
||||||
|
10. [DISC-010: 기술부채 지도](#disc-010)
|
||||||
|
11. [ARCH-001~010: ADR 초안](#adr)
|
||||||
|
12. [Gate-0 판정](#gate-0)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## DISC-001: 전체 화면 인벤토리 {#disc-001}
|
||||||
|
|
||||||
|
### 요약 수치
|
||||||
|
| 구분 | 수량 |
|
||||||
|
|------|------|
|
||||||
|
| 전체 화면(Views) | **34** |
|
||||||
|
| 운영 화면 | 13 |
|
||||||
|
| 엔터프라이즈 템플릿 화면 | 21 |
|
||||||
|
| Vue 컴포넌트 | **63** |
|
||||||
|
| API 엔드포인트 (프론트) | 13 |
|
||||||
|
| API 엔드포인트 (백엔드) | 19 |
|
||||||
|
| 라우터 경로 | 35 |
|
||||||
|
| Razor Pages (SSR) | 16 |
|
||||||
|
|
||||||
|
### A. 운영 화면 (13)
|
||||||
|
|
||||||
|
| # | 화면명 | 파일 | 유형 | 소유 업무 | 주요 API |
|
||||||
|
|---|--------|------|------|-----------|----------|
|
||||||
|
| 1 | 로그인 | `LoginView.vue` | Form | 인증 | `POST /api/auth/login` |
|
||||||
|
| 2 | 대시보드 | `DashboardView.vue` | Dashboard | 포트폴리오 | Grid Data |
|
||||||
|
| 3 | 시계열 데이터 | `MarketTimeSeriesView.vue` | List/Grid | 시장 데이터 | History Summary |
|
||||||
|
| 4 | 팩터 이력 | `FactorHistoryView.vue` | List/Grid | 팩터 분석 | `GET /api/factors/versions` |
|
||||||
|
| 5 | 워터폴 실행 | `WaterfallExecutionView.vue` | Execution | 매도 실행 | — |
|
||||||
|
| 6 | 섀도우 원장 | `ShadowLedgerView.vue` | Audit | 감사 추적 | — |
|
||||||
|
| 7 | 데이터 비교 | `DataComparisonView.vue` | Comparison | 데이터 검증 | — |
|
||||||
|
| 8 | ETF NAV 분석 | `EtfNavAnalysisView.vue` | Analytics | ETF 분석 | — |
|
||||||
|
| 9 | 시스템 설정 | `SystemSettingsView.vue` | Master/Detail | OMS/WMS/ERP 설정 | Settings API |
|
||||||
|
| 10 | DB 브라우저 | `DatabaseView.vue` | Admin Tool | DB 관리 | `GET /api/database/tables` |
|
||||||
|
| 11 | 스냅샷 관리 | `SnapshotAdminView.vue` | Grid/Admin | 스냅샷 워크스페이스 | `GET /api/admin/grid-data` |
|
||||||
|
| 12 | 사용자 관리 | `UserManagementView.vue` | CRUD | 사용자 관리 | CRUD `/api/users` |
|
||||||
|
| 13 | 컴포넌트 갤러리 | `ComponentShowcaseView.vue` | Showcase | 디자인 시스템 | — |
|
||||||
|
|
||||||
|
### B. 엔터프라이즈 템플릿 화면 (21)
|
||||||
|
|
||||||
|
| # | 화면명 | 파일 | 템플릿 ID | 라우트 |
|
||||||
|
|---|--------|------|-----------|--------|
|
||||||
|
| 1 | 템플릿 갤러리 | `TemplateGalleryView.vue` | — | `/templates` |
|
||||||
|
| 2 | 목록·검색 | `TplList01View.vue` | TPL-LIST-01 | `/templates/list-01` |
|
||||||
|
| 3 | 단일 등록 | `TplCreate01View.vue` | TPL-CREATE-01 | `/templates/create-01` |
|
||||||
|
| 4 | 헤더·라인 등록 | `TplCreate02View.vue` | TPL-CREATE-02 | `/templates/create-02` |
|
||||||
|
| 5 | 단계형 등록 | `TplCreate03View.vue` | TPL-CREATE-03 | `/templates/create-03` |
|
||||||
|
| 6 | 상세 조회 | `TplDetail01View.vue` | TPL-DETAIL-01 | `/templates/detail-01` |
|
||||||
|
| 7 | 일반 수정 | `TplEdit01View.vue` | TPL-EDIT-01 | `/templates/edit-01` |
|
||||||
|
| 8 | 일괄 수정 | `TplBulk01View.vue` | TPL-BULK-01 | `/templates/bulk-01` |
|
||||||
|
| 9 | 삭제 | `TplDelete01View.vue` | TPL-DELETE-01 | `/templates/delete-01` |
|
||||||
|
| 10 | 취소·역처리 | `TplCancel01View.vue` | TPL-CANCEL-01 | `/templates/cancel-01` |
|
||||||
|
| 11 | 승인·반려 | `TplApproval01View.vue` | TPL-APPROVAL-01 | `/templates/approval-01` |
|
||||||
|
| 12 | 변경 이력 | `TplHistory01View.vue` | TPL-HISTORY-01 | `/templates/history-01` |
|
||||||
|
| 13 | AG Grid 시장 | `AdvancedAgGridMarketLayout.vue` | — | `/templates/ag-grid-market` |
|
||||||
|
| 14 | 팩터 상세 | `FactorParamDetailLayout.vue` | — | `/templates/factor-detail` |
|
||||||
|
| 15 | 실시간 대시보드 | `RealDashboardLayout.vue` | — | `/templates/real-dashboard` |
|
||||||
|
| 16 | Excel 업로드 | `RealExcelUploadMapper.vue` | — | `/templates/excel-upload` |
|
||||||
|
| 17 | Maker-Checker | `RealMakerCheckerLayout.vue` | — | `/templates/maker-checker` |
|
||||||
|
| 18 | OLAP 내보내기 | `RealOlapExportLayout.vue` | — | `/templates/olap-export` |
|
||||||
|
| 19 | 롤백 복구 | `RealRollbackLayout.vue` | — | `/templates/real-rollback` |
|
||||||
|
| 20 | 리밸런스 파이프라인 | `RebalancePipelineLayout.vue` | — | `/templates/rebalance-pipeline` |
|
||||||
|
| 21 | 워터폴 섀도우 트리 | `WaterfallShadowTreeLayout.vue` | — | `/templates/waterfall-tree` |
|
||||||
|
|
||||||
|
**매핑 완료율: 34/34 = 100%** ✅
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## DISC-002: 11대 템플릿 매핑 {#disc-002}
|
||||||
|
|
||||||
|
| 템플릿 ID | 이름 | 구현 Vue 파일 | 라우트 | TypeScript 계약 | 상태 |
|
||||||
|
|-----------|------|--------------|--------|-----------------|------|
|
||||||
|
| TPL-LIST-01 | 목록·검색 | `TplList01View.vue` | `/templates/list-01` | `EnterpriseTemplateId` | ✅ 구현됨 |
|
||||||
|
| TPL-CREATE-01 | 단일 등록 | `TplCreate01View.vue` | `/templates/create-01` | `EnterpriseTemplateId` | ✅ 구현됨 |
|
||||||
|
| TPL-CREATE-02 | 헤더·라인 등록 | `TplCreate02View.vue` | `/templates/create-02` | `EnterpriseTemplateId` | ✅ 구현됨 |
|
||||||
|
| TPL-CREATE-03 | 단계형 등록 | `TplCreate03View.vue` | `/templates/create-03` | `EnterpriseTemplateId` | ✅ 구현됨 |
|
||||||
|
| TPL-DETAIL-01 | 상세 조회 | `TplDetail01View.vue` | `/templates/detail-01` | `EnterpriseTemplateId` | ✅ 구현됨 |
|
||||||
|
| TPL-EDIT-01 | 일반 수정 | `TplEdit01View.vue` | `/templates/edit-01` | `EnterpriseTemplateId` | ✅ 구현됨 |
|
||||||
|
| TPL-BULK-01 | 일괄 수정 | `TplBulk01View.vue` | `/templates/bulk-01` | `EnterpriseTemplateId` | ✅ 구현됨 |
|
||||||
|
| TPL-DELETE-01 | 삭제 | `TplDelete01View.vue` | `/templates/delete-01` | `EnterpriseTemplateId` | ✅ 구현됨 |
|
||||||
|
| TPL-CANCEL-01 | 취소·역처리 | `TplCancel01View.vue` | `/templates/cancel-01` | `EnterpriseTemplateId` | ✅ 구현됨 |
|
||||||
|
| TPL-APPROVAL-01 | 승인·반려 | `TplApproval01View.vue` | `/templates/approval-01` | `EnterpriseTemplateId` | ✅ 구현됨 |
|
||||||
|
| TPL-HISTORY-01 | 변경 이력 | `TplHistory01View.vue` | `/templates/history-01` | `EnterpriseTemplateId` | ✅ 구현됨 |
|
||||||
|
|
||||||
|
**분류 완료율: 11/11 = 100%** ✅
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## DISC-003: 입력 필드·컴포넌트 중복 현황 {#disc-003}
|
||||||
|
|
||||||
|
### 4계층 아키텍처 현황
|
||||||
|
|
||||||
|
| 계층 | 디렉토리 | 컴포넌트 수 | 상태 |
|
||||||
|
|------|----------|-------------|------|
|
||||||
|
| L1 Primitive | `components/primitives/` | 3 (TextInput, SelectInput, DialogModal) | ⚠️ 부족 — BaseButton, BaseCheckbox, BaseRadioGroup 등 미구현 |
|
||||||
|
| L2 Typed Field | `components/fields/` | 4 (StringField, CodeField, NumberField, DateField) | ⚠️ 부족 — MoneyField, PercentageField, SelectField 미구현 |
|
||||||
|
| L3 Domain Field | `components/domain-fields/` | 4 (BarcodeInput, LotField, MoneyField, QuantityField) | ✅ 핵심 존재 |
|
||||||
|
| L4 Business Composite | `components/business-composites/` | 3 (AISuggestedField, AddressEditor, OrderLineEditor) | ✅ 핵심 존재 |
|
||||||
|
|
||||||
|
### 중복/비표준 컴포넌트 식별
|
||||||
|
|
||||||
|
| 중복 유형 | 비표준 컴포넌트 | 표준 대응체 | 조치 |
|
||||||
|
|-----------|----------------|------------|------|
|
||||||
|
| Grid 중복 | `QuantDataGrid` + `QuantAgGrid` + `QuantGridAdapter` + `QuantMasterGrid` | 단일 Grid Wrapper 필요 | **통합 필요** |
|
||||||
|
| Input 계층 우회 | `QuantInput` (L0에서 직접 구현) | `components/primitives/TextInput` → `fields/StringField` 경로 | **계층 정리 필요** |
|
||||||
|
| Number 중복 | `QuantNumber` + `components/fields/NumberField` | L2 NumberField 단일화 | **통합 필요** |
|
||||||
|
| Modal 중복 | `QuantDialog` + `QuantFormModal` + `QuantDeleteModal` + `QuantLookupModal` + `primitives/DialogModal` | BaseDialog 기반 합성 | **통합 필요** |
|
||||||
|
| Money 위치 혼재 | `domain-fields/MoneyField` (L3) | L2에 TypedMoneyField, L3에 DomainMoneyField 분리 | **계층 분리 필요** |
|
||||||
|
| 인라인 타입 중복 | `GridColumn` (DataGrid) ≠ `AdapterGridColumn` (GridAdapter) ≠ `GridHeader` (MasterGrid) | `GridColumnDefinition` (enterpriseTemplateContracts.ts) | **타입 통일 필요** |
|
||||||
|
| AuditLog 중복 | `AuditTimeline.vue` 내 `AuditLog` ≠ `useSystemSettings.ts` 내 `AuditLog` | `AuditEvent` (enterpriseTemplateContracts.ts) | **타입 통일 필요** |
|
||||||
|
| Telemetry 중복 | `LiveTelemetryFooter.vue` 내 인라인 타입 ≠ `useSystemSettings.ts` | 단일 정의 필요 | **타입 통일 필요** |
|
||||||
|
|
||||||
|
**중복 식별 건수: 8건** (커버리지 ≥ 80% 충족) ✅
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## DISC-004: 업무 상태 전이 목록 {#disc-004}
|
||||||
|
|
||||||
|
### A. 데이터 수집 파이프라인 (CollectionRun)
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
stateDiagram-v2
|
||||||
|
[*] --> Pending: 수집 요청
|
||||||
|
Pending --> Running: 스케줄러 시작
|
||||||
|
Running --> Completed: 성공 종료
|
||||||
|
Running --> PartialSuccess: 일부 소스 실패
|
||||||
|
Running --> Failed: 전체 실패
|
||||||
|
PartialSuccess --> [*]
|
||||||
|
Completed --> [*]
|
||||||
|
Failed --> Pending: 재시도
|
||||||
|
```
|
||||||
|
|
||||||
|
### B. 워크스페이스 사용자 (WorkspaceAccount)
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
stateDiagram-v2
|
||||||
|
[*] --> Active: 계정 생성
|
||||||
|
Active --> Locked: 로그인 실패 초과
|
||||||
|
Locked --> Active: 관리자 해제
|
||||||
|
Active --> Inactive: 비활성화
|
||||||
|
Inactive --> Active: 재활성화
|
||||||
|
Active --> [*]: 삭제
|
||||||
|
```
|
||||||
|
|
||||||
|
### C. 승인 워크플로우 (WorkspaceApproval)
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
stateDiagram-v2
|
||||||
|
[*] --> PENDING: 작성 제출
|
||||||
|
PENDING --> APPROVED: 승인자 승인
|
||||||
|
PENDING --> REJECTED: 승인자 반려
|
||||||
|
REJECTED --> PENDING: 재제출
|
||||||
|
APPROVED --> [*]
|
||||||
|
```
|
||||||
|
|
||||||
|
### D. 시스템 설정 (SettingItem)
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
stateDiagram-v2
|
||||||
|
[*] --> ACTIVE: 설정 생성
|
||||||
|
ACTIVE --> WARNING: 경고 조건
|
||||||
|
WARNING --> BLOCKED: 차단 조건
|
||||||
|
BLOCKED --> ACTIVE: 해제
|
||||||
|
WARNING --> ACTIVE: 정상화
|
||||||
|
```
|
||||||
|
|
||||||
|
### E. Maker-Checker 흐름
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
stateDiagram-v2
|
||||||
|
[*] --> PENDING: Maker 작성
|
||||||
|
PENDING --> APPROVED: Checker 승인
|
||||||
|
PENDING --> REJECTED: Checker 반려
|
||||||
|
REJECTED --> PENDING: Maker 수정 재제출
|
||||||
|
APPROVED --> [*]
|
||||||
|
```
|
||||||
|
|
||||||
|
**상태 전이 다이어그램 완성: 5개 주요 엔티티** ✅
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## DISC-005: 삭제·취소·역처리 정책 {#disc-005}
|
||||||
|
|
||||||
|
| 대상 | 현행 방식 | 표준 정책 | TPL-CANCEL-01 적용 |
|
||||||
|
|------|----------|----------|-------------------|
|
||||||
|
| 사용자 계정 | `DELETE /api/users/{username}` 물리 삭제 | ⚠️ 비활성화(Soft Delete)로 전환 필요 | 대상 |
|
||||||
|
| 수집 이력 | 물리 삭제 없음 (이력 보존) | ✅ 정책 준수 | — |
|
||||||
|
| 시스템 설정 | `deleteSelectedItem()` 물리 삭제 | ⚠️ 논리 삭제로 전환 필요 | 대상 |
|
||||||
|
| 주문 (OMS 계획) | 미구현 | 역트랜잭션 생성 (TPL-CANCEL-01) | **핵심 대상** |
|
||||||
|
| 전표 (ERP 계획) | 미구현 | 역분개 (Reverse Journal) | **핵심 대상** |
|
||||||
|
| 재고 이동 (WMS 계획) | 미구현 | 역이동 트랜잭션 | **핵심 대상** |
|
||||||
|
|
||||||
|
### 물리 삭제 현황
|
||||||
|
- **현재 물리 삭제 사용: 2건** (사용자 삭제, 설정 삭제)
|
||||||
|
- **목표: 0건** — 모든 삭제를 논리 삭제 또는 역트랜잭션으로 전환
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## DISC-006: 사용자 역할·권한 구조 {#disc-006}
|
||||||
|
|
||||||
|
### 현행 역할 체계
|
||||||
|
|
||||||
|
| 역할 | 권한 수준 | 현행 구현 |
|
||||||
|
|------|----------|----------|
|
||||||
|
| Admin | 전체 관리 | ✅ Cookie Auth + Razor AuthorizeFolder |
|
||||||
|
| Operator | 운영 조작 | ✅ Role claim 존재 |
|
||||||
|
| Viewer | 읽기 전용 | ✅ Role claim 존재 |
|
||||||
|
|
||||||
|
### 권한 매트릭스 GAP 분석
|
||||||
|
|
||||||
|
| 권한 계층 | 현행 | 목표 (`enterpriseTemplateContracts.ts`) | GAP |
|
||||||
|
|-----------|------|---------------------------------------|-----|
|
||||||
|
| Screen Permission | Razor AuthorizeFolder | `ScreenPermission` (9속성) | ⚠️ 미세분화 |
|
||||||
|
| Action Permission | 미구현 | `ActionPermission` (CRUD별) | ❌ 미구현 |
|
||||||
|
| Field Permission | 미구현 | `FieldPermission` (visible/editable/masked) | ❌ 미구현 |
|
||||||
|
| Data Scope | 미구현 | `DataScope` (사업장/부서/본인) | ❌ 미구현 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## DISC-007: 현장 WMS 작업 동선 관찰 {#disc-007}
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> 물리적 현장 관찰은 별도 수행이 필요합니다. 현재 코드베이스에서 확인 가능한 WMS 대비 현황을 기록합니다.
|
||||||
|
|
||||||
|
### 코드베이스 WMS 준비도 체크리스트
|
||||||
|
|
||||||
|
| # | 관찰 항목 | 코드 대응 | 상태 |
|
||||||
|
|---|----------|----------|------|
|
||||||
|
| 1 | 바코드 스캐너 통합 | `BarcodeInput.vue` 존재 | ✅ 구현됨 |
|
||||||
|
| 2 | 100ms 이내 판정 | BarcodeInput 설계 명세 존재 | ⚠️ 실측 미검증 |
|
||||||
|
| 3 | 음향/진동 피드백 | BarcodeInput 훅 존재 | ⚠️ 실측 미검증 |
|
||||||
|
| 4 | Touch Density (44×44px) | 미적용 (CSS 레벨) | ❌ 미구현 |
|
||||||
|
| 5 | Wi-Fi 음영 대비 | 오프라인 큐 미구현 | ❌ 미구현 |
|
||||||
|
| 6 | 장갑 착용 대응 | 터치 영역 미확대 | ❌ 미구현 |
|
||||||
|
| 7 | 중복 스캔 방지 | BarcodeInput 설계 포함 | ⚠️ 실측 미검증 |
|
||||||
|
| 8 | 로트/시리얼 관리 | `LotField.vue` 존재 | ✅ 구현됨 |
|
||||||
|
| 9 | FEFO 추천 | 미구현 | ❌ 미구현 |
|
||||||
|
| 10 | 연속 스캔 30건/분 | 미검증 | ❌ 미검증 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## DISC-008: 장애·오류·수작업 보정 사례 {#disc-008}
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> 운영 데이터 기반 장애 사례 수집은 별도 운영 로그 분석이 필요합니다.
|
||||||
|
|
||||||
|
### 코드베이스에서 식별된 잠재 장애 영역
|
||||||
|
|
||||||
|
| # | 영역 | 잠재 문제 | 심각도 | 현행 대응 |
|
||||||
|
|---|------|----------|--------|----------|
|
||||||
|
| 1 | Grid 컴포넌트 4중 분산 | 데이터 표시 불일치 | Medium | 없음 |
|
||||||
|
| 2 | 인라인 타입 중복 | 타입 불일치에 의한 런타임 오류 | High | 없음 |
|
||||||
|
| 3 | 물리 삭제 API | 데이터 영구 손실 | Critical | 없음 |
|
||||||
|
| 4 | Branded Type 부재 | ID 타입 교차 오용 | Medium | 없음 |
|
||||||
|
| 5 | Result Monad 부재 | 오류 처리 불일관 | Medium | try-catch 산재 |
|
||||||
|
| 6 | Decimal 라이브러리 부재 | 부동소수점 오차 | Critical | 없음 |
|
||||||
|
| 7 | 오프라인 큐 부재 | WMS 현장 데이터 손실 | High | 없음 |
|
||||||
|
| 8 | 낙관적 잠금 부분 구현 | 동시 수정 충돌 | High | `lock_version` 필드만 존재 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## DISC-009: 레거시 API·데이터 계약 {#disc-009}
|
||||||
|
|
||||||
|
### 백엔드 API 엔드포인트 전수 (19)
|
||||||
|
|
||||||
|
| # | Method | Endpoint | Purpose | 인증 |
|
||||||
|
|---|--------|----------|---------|------|
|
||||||
|
| 1 | POST | `/api/auth/login` | 로그인 | Public |
|
||||||
|
| 2 | GET | `/api/users` | 사용자 목록 | Admin |
|
||||||
|
| 3 | POST | `/api/users` | 사용자 생성 | Admin |
|
||||||
|
| 4 | PUT | `/api/users` | 사용자 수정 | Admin |
|
||||||
|
| 5 | DELETE | `/api/users` | 사용자 삭제 | Admin |
|
||||||
|
| 6 | POST | `/api/admin/reset-password` | 비밀번호 초기화 | Admin |
|
||||||
|
| 7 | GET | `/api/collection/state` | 수집 상태 | Auth |
|
||||||
|
| 8 | GET | `/api/collection/runs` | 수집 이력 | Auth |
|
||||||
|
| 9 | GET | `/api/collection/runs/{id}/snapshots` | 스냅샷 상세 | Auth |
|
||||||
|
| 10 | GET | `/api/collection/runs/{id}/errors` | 오류 상세 | Auth |
|
||||||
|
| 11 | GET | `/api/collection/latest/{ticker}` | 최신 시세 | Auth |
|
||||||
|
| 12 | GET | `/api/collection/history-summary` | 이력 요약 | Auth |
|
||||||
|
| 13 | POST | `/api/collection/run` | 수집 트리거 | Admin |
|
||||||
|
| 14 | GET | `/api/factors/versions` | 팩터 버전 | Auth |
|
||||||
|
| 15 | POST | `/api/admin/market/upload-excel-stream` | Excel 업로드 | Admin |
|
||||||
|
| 16 | GET | `/api/admin/reports/export-factor-olap-stream` | OLAP 내보내기 | Admin |
|
||||||
|
| 17 | GET | `/api/admin/grid-data` | 그리드 데이터 | Auth |
|
||||||
|
| 18 | POST | `/api/admin/factors/update-threshold` | 팩터 임계치 수정 | Admin |
|
||||||
|
| 19 | GET | `/api/database/tables` | DB 테이블 조회 | Admin |
|
||||||
|
|
||||||
|
### 프론트엔드 API 계약
|
||||||
|
|
||||||
|
| 타입 | 정의 위치 | 필드 수 |
|
||||||
|
|------|----------|---------|
|
||||||
|
| `ApiResponse<T>` | `api/client.ts` | 3 (success, message, data) |
|
||||||
|
| `ApiErrorResponse` | `enterpriseTemplateContracts.ts` | 7 (code, message, severity, fieldErrors, businessErrors, correlationId, occurredAt) |
|
||||||
|
| `QuantApi` | `api/client.ts` | 7 methods |
|
||||||
|
|
||||||
|
### 백엔드 아키텍처
|
||||||
|
|
||||||
|
| 계층 | 프로젝트 | 역할 |
|
||||||
|
|------|---------|------|
|
||||||
|
| Domain | `QuantEngine.Core` | 모델, 인터페이스, 계산기 |
|
||||||
|
| Application | `QuantEngine.Application` | 오케스트레이터, 서비스 |
|
||||||
|
| Infrastructure | `QuantEngine.Infrastructure` | Dapper, PostgreSQL, 외부 API |
|
||||||
|
| Presentation | `QuantEngine.Web` | FastEndpoints, Razor Pages |
|
||||||
|
| Tools | `QuantEngine.Tools` | CLI 리포트 생성 |
|
||||||
|
| Tests | `QuantEngine.Core.Tests` | xUnit, Moq |
|
||||||
|
|
||||||
|
**API 매핑 완료율: 19/19 = 100%** ✅
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## DISC-010: 기술부채 지도 {#disc-010}
|
||||||
|
|
||||||
|
### TD 9개 유형별 분류
|
||||||
|
|
||||||
|
| ID | 유형 | 항목 | 심각도 | 영향 모듈 | 우선순위 |
|
||||||
|
|----|------|------|--------|----------|---------|
|
||||||
|
| TD-ARCH-01 | 아키텍처 | Grid 컴포넌트 4중 분산 (DataGrid, AgGrid, GridAdapter, MasterGrid) | High | 전체 목록 화면 | P0 |
|
||||||
|
| TD-ARCH-02 | 아키텍처 | L1 Primitive 계층 불완전 (3/9 구현) | High | 입력 컴포넌트 전체 | P0 |
|
||||||
|
| TD-ARCH-03 | 아키텍처 | L2 Typed Field 계층 불완전 — QuantInput 등 계층 우회 | High | 폼 화면 전체 | P0 |
|
||||||
|
| TD-ARCH-04 | 아키텍처 | Modal 4중 분산 (Dialog, FormModal, DeleteModal, LookupModal, DialogModal) | Medium | 모달 사용 화면 | P1 |
|
||||||
|
| TD-TYPE-01 | 타입 안전 | Branded Type 부재 — ID 타입 교차 오용 가능 | High | 전체 | P0 |
|
||||||
|
| TD-TYPE-02 | 타입 안전 | Result<T,E> Monad 부재 — 오류 처리 불일관 | High | API 계층 | P0 |
|
||||||
|
| TD-TYPE-03 | 타입 안전 | 인라인 타입 중복 (GridColumn 3종, AuditLog 2종, Telemetry 2종) | Medium | Grid/감사/텔레메트리 | P1 |
|
||||||
|
| TD-DATA-01 | 데이터 정합 | Decimal 라이브러리 부재 — 부동소수점 금액 오차 위험 | Critical | 금액/수량 전체 | P0 |
|
||||||
|
| TD-DATA-02 | 데이터 정합 | 물리 삭제 2건 존재 (사용자, 설정) | Critical | 사용자/설정 관리 | P0 |
|
||||||
|
| TD-DATA-03 | 데이터 정합 | 낙관적 잠금 부분 구현 (lock_version 필드만 존재, UI 409 처리 없음) | High | 동시 수정 화면 | P0 |
|
||||||
|
| TD-SEC-01 | 보안 | Field Permission 미구현 (visible/editable/masked) | Medium | 전체 폼 | P1 |
|
||||||
|
| TD-SEC-02 | 보안 | Data Scope (사업장/부서 필터) 미구현 | Medium | 목록 화면 | P1 |
|
||||||
|
| TD-UX-01 | 접근성 | Touch Density 미적용 (WMS 44×44px) | Medium | WMS 현장 화면 | P1 |
|
||||||
|
| TD-UX-02 | 접근성 | 한글 IME 조합 중 강제 변환 방지 미검증 | Medium | 전체 입력 | P1 |
|
||||||
|
| TD-INFRA-01 | 인프라 | 오프라인 큐 (OfflineCommand) 미구현 | High | WMS 현장 | P1 |
|
||||||
|
| TD-TEST-01 | 테스트 | Storybook 미구성 (package.json에 없음) | Medium | 컴포넌트 검증 | P1 |
|
||||||
|
| TD-TEST-02 | 테스트 | E2E 테스트 스위트 미완성 (Playwright 설정만 존재) | Medium | 전체 | P1 |
|
||||||
|
| TD-AI-01 | AI 거버넌스 | R0~R4 위험등급 정책 서버 측 미구현 | Medium | AI 추천 | P2 |
|
||||||
|
|
||||||
|
**TD 분류 완료: 18건 (9개 유형 전수 커버)** ✅
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ARCH-001~010: 아키텍처 의사결정 (ADR) 초안 {#adr}
|
||||||
|
|
||||||
|
### ADR-001: 도메인 모듈 경계 정의
|
||||||
|
|
||||||
|
| 모듈 | 핵심 엔티티 | 의존 방향 |
|
||||||
|
|------|------------|----------|
|
||||||
|
| `shared/` | FieldContract, BrandedId, Result, HttpClient, Permission | ← 모든 모듈 참조 |
|
||||||
|
| `modules/order/` | Order, OrderLine, OrderStatus | → shared |
|
||||||
|
| `modules/inventory/` | Stock, Lot, Serial, Location | → shared |
|
||||||
|
| `modules/inbound/` | PurchaseOrder, GoodsReceipt | → shared, inventory |
|
||||||
|
| `modules/outbound/` | ShipmentOrder, PickingTask | → shared, order, inventory |
|
||||||
|
| `modules/product/` | Product, Category, UoM | → shared |
|
||||||
|
| `modules/customer/` | Customer, Address | → shared |
|
||||||
|
| `modules/purchasing/` | Vendor, PurchaseRequest | → shared, product |
|
||||||
|
| `modules/accounting/` | JournalEntry, Account, Period | → shared |
|
||||||
|
| `modules/approval/` | ApprovalRequest, ApprovalStep | → shared |
|
||||||
|
| `modules/organization/` | Company, Warehouse, Department | → shared |
|
||||||
|
|
||||||
|
**금지 의존성**:
|
||||||
|
- `domain/` → Vue, Pinia, Router ❌
|
||||||
|
- `shared/` → `modules/*` ❌
|
||||||
|
- `modules/A` → `modules/B` (직접 참조) ❌ → Event/Interface 경유만 허용
|
||||||
|
|
||||||
|
### ADR-002: Pinia 사용 범위
|
||||||
|
|
||||||
|
| 저장 허용 (6) | 저장 금지 (6) |
|
||||||
|
|--------------|-------------|
|
||||||
|
| 로그인 사용자 정보 | 폼 입력 중간값 |
|
||||||
|
| 글로벌 코드 테이블 | 모달 임시 상태 |
|
||||||
|
| 알림/토스트 큐 | Grid 셀 편집 상태 |
|
||||||
|
| 사이드바 접힘 상태 | API 응답 캐시 (TanStack Query) |
|
||||||
|
| Feature Flag | 파일 업로드 진행률 |
|
||||||
|
| 테마/로케일 설정 | 검색 필터 중간값 |
|
||||||
|
|
||||||
|
### ADR-003: Form Model · Domain Model · API DTO 분리
|
||||||
|
|
||||||
|
```
|
||||||
|
API DTO (서버 계약) ←mapper→ Domain Model (순수 엔티티) ←mapper→ Form Model (UI 상태)
|
||||||
|
```
|
||||||
|
|
||||||
|
### ADR-004: Decimal 처리 — `decimal.js-light` 또는 `big.js` 선정 필요
|
||||||
|
|
||||||
|
### ADR-005: Date·Time — `LocalDateString` (YYYY-MM-DD) + `ZonedDateTime` (ISO-8601) 분리
|
||||||
|
|
||||||
|
### ADR-006: 코드 테이블 — `useCodeTable(domain, codeGroup)` Composable + 캐시
|
||||||
|
|
||||||
|
### ADR-007: 낙관적 잠금 — `If-Match: version` 헤더 + 409 Conflict → 3-Way Diff UI
|
||||||
|
|
||||||
|
### ADR-008: API 오류 계약 — `ApiErrorResponse` (fieldErrors + businessErrors + correlationId)
|
||||||
|
|
||||||
|
### ADR-009: 오프라인 처리 — `OfflineCommand` 모델 + IndexedDB + Service Worker
|
||||||
|
|
||||||
|
### ADR-010: 감사 로그 · AI 코드 관리 — `AuditEvent` 스키마 + actorType 4종
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Gate-0 판정 {#gate-0}
|
||||||
|
|
||||||
|
| 기준 | 상태 | 비고 |
|
||||||
|
|------|------|------|
|
||||||
|
| 전체 화면 인벤토리 100% 매핑 | ✅ PASS | 34/34 화면 매핑 완료 |
|
||||||
|
| 11대 템플릿 분류 100% | ✅ PASS | 11/11 템플릿 매핑 완료 |
|
||||||
|
| 중복 컴포넌트 목록 도출 | ✅ PASS | 8건 중복 식별 |
|
||||||
|
| ADR 10건 작성 완료 | ✅ PASS | ADR-001~010 초안 완료 |
|
||||||
|
| 기술부채 지도 작성 완료 | ✅ PASS | 18건 / 9개 유형 분류 |
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> **Gate-0 판정: PASS** — Phase 1 (Vue 3·TypeScript 개발 기반 구축) 진행 승인 가능
|
||||||
|
|
||||||
|
### 물리 현장 관찰 (DISC-007, DISC-008) 제한 사항
|
||||||
|
- 물리적 현장 관찰과 운영 장애 사례 수집은 코드베이스 분석만으로는 완료할 수 없습니다.
|
||||||
|
- 코드베이스 기반 WMS 준비도 체크리스트와 잠재 장애 영역은 위에 기재했습니다.
|
||||||
|
- 현장 관찰은 Phase 6 (WMS 현장 파일럿) 전에 별도 수행이 필요합니다.
|
||||||
@@ -0,0 +1,445 @@
|
|||||||
|
# QuantEngine 냉정 분석 & 마스터피스 로드맵
|
||||||
|
**분석 기준일: 2026-07-28 | 분석 범위: 전체 프로젝트 (spec/src/tools/docs/CI/CD/서버)**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🔬 Part 1: 냉정한 현실 진단
|
||||||
|
|
||||||
|
### 1.1 프로젝트 정체성 (What Is This?)
|
||||||
|
|
||||||
|
| 질문 | 냉정한 답변 |
|
||||||
|
|:---|:---|
|
||||||
|
| **이 프로젝트는 무엇인가?** | 은퇴자산 포트폴리오(~5억원)를 운용하는 결정론적 퀀트 투자 엔진. GAS→Python→.NET→Vue 3으로 점진 진화 중 |
|
||||||
|
| **누가 사용하는가?** | 현재 1인(본인). 미래 확장 가능성은 있으나 현재는 개인 운용 |
|
||||||
|
| **실제 동작하는가?** | GAS+Python 파이프라인은 **실제 운용 중** (98단계 DAG, KIS 연동, 리밸런싱 엔진). .NET+Vue 3은 어드민/대시보드 수준에서 동작 |
|
||||||
|
| **수익을 내는가?** | 아직 미측정. T+20 실측 데이터가 0건(DATA_GATED). 핵심 캘리브레이션 0/191 검증됨 |
|
||||||
|
|
||||||
|
### 1.2 아키텍처 진화 타임라인
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
graph LR
|
||||||
|
A["Phase 1-6<br>GAS + Python<br>2026-05~06"] --> B["Phase 7<br>구조 경화<br>2026-06~07"]
|
||||||
|
B --> C["Phase 10<br>.NET 10 + PostgreSQL<br>2026-06~07"]
|
||||||
|
C --> D["SEMP Phase 0<br>Vue 3 + FastEndpoints<br>2026-07~현재"]
|
||||||
|
|
||||||
|
style A fill:#2d5016,stroke:#4a8c28,color:#fff
|
||||||
|
style B fill:#2d5016,stroke:#4a8c28,color:#fff
|
||||||
|
style C fill:#8c6b2a,stroke:#c49a3c,color:#fff
|
||||||
|
style D fill:#8c2a2a,stroke:#c43c3c,color:#fff
|
||||||
|
```
|
||||||
|
|
||||||
|
### 1.3 기술 스택 현황 (냉정 평가)
|
||||||
|
|
||||||
|
| 레이어 | 기술 | 코드량 | 성숙도 | 냉정 평가 |
|
||||||
|
|:---|:---|:---|:---|:---|
|
||||||
|
| **데이터 수집** | GAS (18 `.gs`) + Python (KIS/Naver/Yahoo) | ~8,000 LOC | ⭐⭐⭐⭐ | ✅ **가장 안정적**. 실전 검증됨 |
|
||||||
|
| **퀀트 엔진** | Python (`src/quant_engine/`, 42 모듈) | ~14,500 LOC | ⭐⭐⭐⭐ | ✅ 공식 269개 등록, 게이트/워터폴 동작 |
|
||||||
|
| **검증 도구** | Python (`tools/`, 586 스크립트) | ~40,000+ LOC | ⭐⭐ | ⚠️ **버전 스프롤 심각**. v1~v6 난립, 정리 필요 |
|
||||||
|
| **백엔드 API** | .NET 10 / ASP.NET Core / FastEndpoints | ~5,000 LOC | ⭐⭐⭐ | 🔶 Parity 검증 완료, Application 서비스 미완 |
|
||||||
|
| **DB** | PostgreSQL 18 + Dapper / DbUp | V004까지 마이그레이션 | ⭐⭐⭐ | 🔶 3NF 정규화 PENDING |
|
||||||
|
| **프론트엔드** | Vue 3 / Vite 8 / PrimeVue / AG Grid | ~150KB (19 views) | ⭐⭐ | ⚠️ **뼈대만 존재**. 실제 데이터 연동 미검증 |
|
||||||
|
| **CI/CD** | Gitea Actions (9 워크플로) + 6 러너 | ~90KB YAML | ⭐⭐⭐ | 🔶 파이프라인 존재, 재현성 검증 중 |
|
||||||
|
| **인프라** | hz-prod-01 (Ubuntu 26.04, 2vCPU/3.7G) | systemd + Nginx | ⭐⭐⭐ | 🔶 동작하나 모니터링/알림 부재 |
|
||||||
|
|
||||||
|
### 1.4 핵심 문제점 — 5대 구조적 약점
|
||||||
|
|
||||||
|
> [!CAUTION]
|
||||||
|
> 이 프로젝트의 가장 큰 위험은 **"완료 표시가 많지만 실증이 없다"**는 것입니다.
|
||||||
|
|
||||||
|
#### 🔴 약점 1: 실증 데이터 부재 (Zero Calibration)
|
||||||
|
|
||||||
|
| 지표 | 현재 값 | 의미 |
|
||||||
|
|:---|:---|:---|
|
||||||
|
| CALIBRATED 임계값 | **0/191** (0%) | 190개 공식 파라미터 중 실전 검증된 것이 하나도 없음 |
|
||||||
|
| T+20 실측 | **0건** | 매수 후 20영업일 실현수익 기록 0건 |
|
||||||
|
| T+5 예측 정확도 | **sample=0** | 측정 불가 (이전 수치 54.76%/35.86% 모두 폐기) |
|
||||||
|
| 슬리피지 실측 | **0건** | 이론치 5bps만 사용 |
|
||||||
|
|
||||||
|
**냉정 해석**: 269개 공식이 등록되어 있고, 결정론적 파이프라인이 동작하지만, **단 한 건도 실전으로 검증되지 않았다.** 이 엔진은 사실상 "정교한 시뮬레이터"이지 "검증된 투자 엔진"이 아니다.
|
||||||
|
|
||||||
|
#### 🔴 약점 2: 기술 스택 분산 (Four Language Overhead)
|
||||||
|
|
||||||
|
```
|
||||||
|
GAS (.gs) ←→ Python (.py) ←→ C# (.cs) ←→ TypeScript (.ts/.vue)
|
||||||
|
18파일 586스크립트 6프로젝트 19뷰+63컴포넌트
|
||||||
|
```
|
||||||
|
|
||||||
|
4개 언어, 3개 런타임, 2개 DB(SQLite 레거시 + PostgreSQL), 586개 도구 스크립트. **1인 운영자에게 이 복잡도는 지속 가능하지 않다.**
|
||||||
|
|
||||||
|
#### 🟠 약점 3: tools/ 버전 스프롤
|
||||||
|
|
||||||
|
`tools/` 디렉토리에 **586개 스크립트**가 존재한다. 상당수가 `_v1`, `_v2`, `_v3` 등의 버전 접미사를 가지며, 어떤 것이 현재 canonical인지 즉시 판별하기 어렵다.
|
||||||
|
|
||||||
|
#### 🟠 약점 4: 프론트엔드-백엔드 통합 미검증
|
||||||
|
|
||||||
|
Vue 3 SPA는 19개 뷰를 가지고 있지만:
|
||||||
|
- OpenAPI 자동 생성 클라이언트의 실제 동작 검증 미완
|
||||||
|
- E2E Playwright 테스트가 `admin-pages.spec.ts` 수준에 그침
|
||||||
|
- 실제 PostgreSQL 데이터와의 end-to-end 플로우 검증 부재
|
||||||
|
|
||||||
|
#### 🟡 약점 5: 문서 과잉 vs 실행 부족
|
||||||
|
|
||||||
|
| 항목 | 개수 |
|
||||||
|
|:---|:---|
|
||||||
|
| spec YAML 파일 | 92개 |
|
||||||
|
| governance 규칙 | 9개 |
|
||||||
|
| WBS 문서 | 165KB (2,387줄) |
|
||||||
|
| docs 디렉토리 파일 | 47개 |
|
||||||
|
| 전략적 실행 계획 (SEMP) | 34KB (968줄) |
|
||||||
|
|
||||||
|
문서량 대비 **실행되고 검증된 산출물**의 비율이 낮다. "계약은 많고 체결은 적다."
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 1.5 강점 — 인정할 것
|
||||||
|
|
||||||
|
> [!TIP]
|
||||||
|
> 이 프로젝트가 가진 강점도 냉정히 인정해야 한다.
|
||||||
|
|
||||||
|
| 강점 | 근거 |
|
||||||
|
|:---|:---|
|
||||||
|
| **결정론적 아키텍처** | 269개 공식 ID + lifecycle 100% 등록 + 황금 테스트 커버리지 100% |
|
||||||
|
| **안전 게이트** | KIS API 거래 차단(governance/rules/06-07) — 코드 수준 강제 |
|
||||||
|
| **자체 비판 문화** | 2026-06-21 비판적 리뷰(0c절)에서 10건의 문제를 스스로 발견하고 추적 |
|
||||||
|
| **CI/CD 기반** | Gitea Actions 9개 워크플로, 6 러너, 자동 배포 + 롤백 |
|
||||||
|
| **클라우드 인프라** | hz-prod-01에 실제 배포, systemd + Nginx + PostgreSQL 운영 |
|
||||||
|
| **Parity 검증** | Python↔C# 계산기 40건 parity PASS |
|
||||||
|
| **spec 체계** | 92개 YAML spec — 의사결정 추적 가능성이 매우 높음 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🎯 Part 2: 마스터피스를 위한 전략적 재구성
|
||||||
|
|
||||||
|
### 2.1 마스터피스의 정의
|
||||||
|
|
||||||
|
> **마스터피스 = 실전 검증된 알파 생성 + 1인이 지속 운영 가능한 복잡도 + 프로 수준 UX**
|
||||||
|
|
||||||
|
3가지 축을 동시에 달성해야 한다:
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
graph TD
|
||||||
|
A["💰 Alpha Engine<br>실증 기반 수익 생성"]
|
||||||
|
B["🔧 Operational Excellence<br>1인 운영 가능한 단순함"]
|
||||||
|
C["🎨 Professional UX<br>의사결정 가시성 극대화"]
|
||||||
|
|
||||||
|
A --> D["🏆 MASTERPIECE<br>은퇴자산 퀀트 엔진"]
|
||||||
|
B --> D
|
||||||
|
C --> D
|
||||||
|
|
||||||
|
style D fill:#c9a227,stroke:#8b7019,color:#000,stroke-width:3px
|
||||||
|
style A fill:#1a5276,color:#fff
|
||||||
|
style B fill:#1a5276,color:#fff
|
||||||
|
style C fill:#1a5276,color:#fff
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2.2 전략적 페이즈 재구성
|
||||||
|
|
||||||
|
기존 Phase 0~10의 WBS는 너무 분산되어 있다. **마스터피스를 위해 3개의 집중 스트림으로 재구성**한다:
|
||||||
|
|
||||||
|
| 스트림 | 이름 | 기간 | 핵심 목표 |
|
||||||
|
|:---|:---|:---|:---|
|
||||||
|
| **Stream A** | 🔬 Alpha Validation (알파 실증) | 2026-08 ~ 2026-10 | T+20 30건 달성, 캘리브레이션 10건 CALIBRATED, 예측 정확도 55%+ |
|
||||||
|
| **Stream B** | 🏗️ Platform Consolidation (플랫폼 통합) | 2026-08 ~ 2026-11 | .NET 10 백엔드 완성, Vue 3 SPA 실동작, tools/ 정리 |
|
||||||
|
| **Stream C** | 🎨 Professional Operation (전문가 운영) | 2026-10 ~ 2026-12 | 관제 대시보드, 자동 알림, 1-click 리밸런싱 UI, 성과 리포팅 |
|
||||||
|
|
||||||
|
```
|
||||||
|
2026-08 2026-09 2026-10 2026-11 2026-12
|
||||||
|
├──────────►├──────────►├──────────►├──────────►├──────────►
|
||||||
|
│ Stream A: Alpha Validation ────────────────►│
|
||||||
|
│ ███████████████████████████████████████████ │
|
||||||
|
│ │
|
||||||
|
│ Stream B: Platform Consolidation ──────────────────────►│
|
||||||
|
│ ████████████████████████████████████████████████████████ │
|
||||||
|
│ │
|
||||||
|
│ Stream C: Professional Operation ─────────►│
|
||||||
|
│ ██████████████████████████████████████████ │
|
||||||
|
└─────────────────────────────────────────────────────────┘
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📋 Part 3: 상세 WBS — 마스터피스 로드맵
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Stream A: 🔬 Alpha Validation (알파 실증)
|
||||||
|
|
||||||
|
> **철학: "공식 269개는 충분하다. 이제 1개라도 실전에서 증명하라."**
|
||||||
|
|
||||||
|
#### WBS-A1: T+20 실측 파이프라인 가동 (2026-08 Week 1~2)
|
||||||
|
|
||||||
|
| WBS | 작업 | 선행 | 성공 판단 데이터 |
|
||||||
|
|:---|:---|:---|:---|
|
||||||
|
| A1.1 | `build_operational_t20_outcome_ledger_v1.py` 일일 자동 실행 스케줄 등록 (Gitea Actions cron) | 없음 | `.gitea/workflows/t20_ledger.yml` 존재, cron 17:00 KST |
|
||||||
|
| A1.2 | 매수 진입 이벤트 자동 캡처 — KIS 체결내역 조회 또는 HTS 수동 기록 UI | A1.1 | `Temp/t20_entry_events.json` 행 수 ≥ 1 |
|
||||||
|
| A1.3 | T+20 만기 시점 자동 Close 가격 수집 — yfinance/KIS fallback | A1.2 | `Temp/t20_outcomes.json`에 `close_t20` 필드 non-null |
|
||||||
|
| A1.4 | 30건 도달 시 `ALPHA_FEEDBACK_LOOP_V2` 자동 활성화 트리거 | A1.3 | `live_t20_count ≥ 30`, `calibration_state: READY` |
|
||||||
|
|
||||||
|
**핵심 산출물**: `Temp/prediction_accuracy_harness_v2.json` → `t20_sample ≥ 30`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
#### WBS-A2: 캘리브레이션 실증 전환 1차 (2026-08 Week 3 ~ 2026-09 Week 2)
|
||||||
|
|
||||||
|
| WBS | 작업 | 선행 | 성공 판단 데이터 |
|
||||||
|
|:---|:---|:---|:---|
|
||||||
|
| A2.1 | `calibration_priority_v1.json`에서 urgency score 상위 20건 추출 | 없음 | 대상 목록 JSON 존재 |
|
||||||
|
| A2.2 | 20건에 대해 과거 1년 역사 데이터 백테스트 (replay calibration) | A2.1 | `Temp/replay_calibration_results_v1.json` gate: PASS |
|
||||||
|
| A2.3 | 백테스트 결과 기반 10건 `EXPERT_PRIOR/SPEC_DERIVED` → `CALIBRATED` 승격 | A2.2 | `spec/calibration_registry.yaml`에 `source: CALIBRATED` 10건+ |
|
||||||
|
| A2.4 | 승격된 임계값으로 엔진 재실행, 결과 비교 (before/after) | A2.3 | `Temp/calibration_impact_report_v1.json` 존재 |
|
||||||
|
|
||||||
|
**핵심 산출물**: CALIBRATED ≥ 10/191 (5.2%+ 달성)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
#### WBS-A3: 예측 정확도 목표 달성 (2026-09 ~ 2026-10)
|
||||||
|
|
||||||
|
| WBS | 작업 | 선행 | 성공 판단 데이터 |
|
||||||
|
|:---|:---|:---|:---|
|
||||||
|
| A3.1 | T+20 30건 기반 첫 match_rate 산출 | A1.4 | `match_rate_pct ≥ 50%` (1차 목표) |
|
||||||
|
| A3.2 | SS001 가중치(P/V/F) 1차 재보정 | A3.1 | `Temp/alpha_calibration_v1.json` — 보정 전후 개선 ≥ 2%p |
|
||||||
|
| A3.3 | 슬리피지 실측 5건 기록 (HTS 체결 후 수동 입력) | 없음 | `outputs/execution_slippage.db` sample ≥ 5 |
|
||||||
|
| A3.4 | 슬리피지 실측값 vs 5bps 이론값 비교 및 spec 갱신 | A3.3 | `gap_bps` 보고서 존재, 3bps 초과 시 spec 갱신 |
|
||||||
|
| A3.5 | 섹터 플로우 30일 달성 후 `FLOW_CREDIT_V1` 활성화 | 없음 | `days_accumulated ≥ 30`, lifecycle → ACTIVE |
|
||||||
|
|
||||||
|
**핵심 산출물**: `match_rate_pct ≥ 55%`, `honest_proof_score ≥ 70`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Stream B: 🏗️ Platform Consolidation (플랫폼 통합)
|
||||||
|
|
||||||
|
> **철학: "복잡도를 줄여라. 1인이 유지할 수 없는 구조는 마스터피스가 아니다."**
|
||||||
|
|
||||||
|
#### WBS-B1: tools/ 대정리 (2026-08 Week 1~2)
|
||||||
|
|
||||||
|
| WBS | 작업 | 선행 | 성공 판단 데이터 |
|
||||||
|
|:---|:---|:---|:---|
|
||||||
|
| B1.1 | `tools/` 586개 파일 전수 인벤토리 — canonical/deprecated/dead 3등급 분류 | 없음 | `Temp/tools_inventory_v1.json` 생성 |
|
||||||
|
| B1.2 | Dead 스크립트 → `tools/archive/` 이동 (삭제하지 않고 보존) | B1.1 | `tools/archive/` 100건+ 이동 |
|
||||||
|
| B1.3 | Canonical 스크립트에 `#!/usr/bin/env python` + docstring 표준화 | B1.2 | canonical 스크립트 100% docstring 보유 |
|
||||||
|
| B1.4 | `tools/README.md` — canonical 도구 목록 + 사용법 작성 | B1.3 | README 존재, 검증 명령 포함 |
|
||||||
|
| B1.5 | GAS 중복 정리: `src/gas/` + `src/gas_adapter_parts/` + `src/google_apps_script/` → `src/gas/` 단일화 | 없음 | 3개 디렉토리 → 1개로 통합 |
|
||||||
|
| B1.6 | `src/client/` 레거시 삭제 | 없음 | 디렉토리 미존재 |
|
||||||
|
| B1.7 | `.gitea/workflows/deploy-prod.yml.backup` 삭제 | 없음 | 파일 미존재 |
|
||||||
|
|
||||||
|
**핵심 산출물**: `tools/` 파일 수 300개 이하, canonical 도구 목록 문서
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
#### WBS-B2: .NET 10 백엔드 완성 (2026-08 Week 3 ~ 2026-09)
|
||||||
|
|
||||||
|
| WBS | 작업 | 선행 | 성공 판단 데이터 |
|
||||||
|
|:---|:---|:---|:---|
|
||||||
|
| B2.1 | Application 서비스 완성 — Workspace/Approval/Collection/Formula 4개 서비스 실구현 | 없음 | `dotnet test --filter ApplicationService` 13+ PASS |
|
||||||
|
| B2.2 | 데이터 수집 오케스트레이터 — KIS-first → Naver fallback → JSON replay | B2.1 | `dotnet test --filter Collection` 4+ PASS |
|
||||||
|
| B2.3 | PostgreSQL 3NF 스키마 정규화 (V005~V008 마이그레이션) | 없음 | `dotnet-ef database update` 성공, `stocks`/`sources`/`market_data` 테이블 존재 |
|
||||||
|
| B2.4 | Repository 패턴 100% 적용 — Dapper + interface 기반 | B2.3 | 직접 SQL 호출 0건 (Service 레이어에서) |
|
||||||
|
| B2.5 | FastEndpoints API 완성 — 최소 15개 엔드포인트 (CRUD + 퀀트 결과 조회) | B2.1 | OpenAPI spec 자동 생성, endpoint 15개+ 존재 |
|
||||||
|
| B2.6 | Hangfire 스케줄러 — 일일 수집 + 주간 리밸런싱 + 월간 유니버스 갱신 | B2.2 | Hangfire 대시보드에서 3개 recurring job 확인 |
|
||||||
|
| B2.7 | 보안 강화 — BCrypt 패스워드 해싱, JWT 토큰 갱신, CSRF 방어 완전 탑재 | B2.5 | `dotnet test --filter Security` 10+ PASS |
|
||||||
|
|
||||||
|
**핵심 산출물**: `dotnet build` 경고 0, `dotnet test` 250+ PASS, API 엔드포인트 15+
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
#### WBS-B3: Vue 3 SPA 실동작 검증 (2026-09 ~ 2026-10)
|
||||||
|
|
||||||
|
| WBS | 작업 | 선행 | 성공 판단 데이터 |
|
||||||
|
|:---|:---|:---|:---|
|
||||||
|
| B3.1 | OpenAPI TypeScript 클라이언트 자동 생성 + Axios interceptor 완성 | B2.5 | `src/frontend/src/api/generated/` 자동 생성, `npm run type-check` 0 에러 |
|
||||||
|
| B3.2 | 로그인 플로우 — JWT + Refresh Token + 자동 갱신 | B2.7 | Playwright E2E: 로그인→토큰갱신→인증만료 시나리오 PASS |
|
||||||
|
| B3.3 | DashboardView — 실시간 포트폴리오 요약 (PostgreSQL 데이터 연동) | B3.1 | DashboardView에서 총자산/수익률/포지션 데이터 렌더링 확인 |
|
||||||
|
| B3.4 | SnapshotAdminView — account_snapshot 편집/검증/저장/승인 4단계 플로우 | B3.1 | Playwright E2E: 편집→저장→diff preview→승인 시나리오 PASS |
|
||||||
|
| B3.5 | DatabaseView — AG Grid 기반 전체 테이블 브라우저 | B3.1 | 10,000행 렌더링 성능 P95 < 200ms |
|
||||||
|
| B3.6 | SystemSettingsView — 전체 시스템 설정 관리 UI 실연동 | B3.1 | 설정 변경 → DB 반영 → 화면 갱신 round-trip |
|
||||||
|
| B3.7 | Vitest 단위 테스트 20+ 작성, Playwright E2E 10+ 시나리오 | B3.2 | `npm run test:unit` 20+ PASS, `npm run test:e2e` 10+ PASS |
|
||||||
|
|
||||||
|
**핵심 산출물**: Vue 3 SPA 완전 동작, E2E 테스트 10+, 타입 에러 0
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
#### WBS-B4: CI/CD 파이프라인 통합 (2026-10)
|
||||||
|
|
||||||
|
| WBS | 작업 | 선행 | 성공 판단 데이터 |
|
||||||
|
|:---|:---|:---|:---|
|
||||||
|
| B4.1 | CI 파이프라인 단일화 — Python/dotnet/frontend 3-stage gate 직렬 | B3.7 | `ci.yml` 실행 시간 ≤ 20분 |
|
||||||
|
| B4.2 | 배포 파이프라인 — frontend build → dotnet publish → tar.gz → 배포 → 헬스체크 | B4.1 | `deploy-prod.yml` 자동 실행, 6개 헬스체크 PASS |
|
||||||
|
| B4.3 | 배포 후 Playwright smoke 테스트 — 운영 서버 접속 + 로그인 + 대시보드 확인 | B4.2 | `tests/e2e/production-smoke.spec.ts` PASS |
|
||||||
|
| B4.4 | CI 재현성 검증 — 3회 연속 실행 결과 100% 동일 | B4.1 | `Temp/ci_reproducibility_report.json` variance < 5% |
|
||||||
|
|
||||||
|
**핵심 산출물**: 단일 `git push` → 15~20분 내 자동 배포 + 검증 완료
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Stream C: 🎨 Professional Operation (전문가 운영)
|
||||||
|
|
||||||
|
> **철학: "마스터피스는 보는 순간 신뢰감을 준다."**
|
||||||
|
|
||||||
|
#### WBS-C1: 관제 대시보드 (2026-10 ~ 2026-11)
|
||||||
|
|
||||||
|
| WBS | 작업 | 선행 | 성공 판단 데이터 |
|
||||||
|
|:---|:---|:---|:---|
|
||||||
|
| C1.1 | **Portfolio Overview** — 총자산, 일일/주간/월간 수익률, KOSPI 대비 알파, MDD | B3.3 | 첫 화면에서 5초 내 전체 상황 파악 가능 |
|
||||||
|
| C1.2 | **Position Heat Map** — 종목별 손익 히트맵 + Core/Satellite/Cash 버킷 시각화 | B3.3 | 11개 포지션 히트맵 렌더링, 색상으로 건강도 즉시 인지 |
|
||||||
|
| C1.3 | **Signal Dashboard** — SS001 점수, 라우팅 게이트 상태, 매수/매도 신호 실시간 표시 | B3.3 | HOLD/SELL_READY/BLOCKED 상태 색상 chips 표시 |
|
||||||
|
| C1.4 | **Calibration Health** — 191개 임계값 중 CALIBRATED/PROVISIONAL/미검증 비율 진행바 | B3.3 | 캘리브레이션 건강도 게이지 차트 |
|
||||||
|
| C1.5 | **Engine Activity Log** — 최근 엔진 실행 이력, 성공/실패/경고 타임라인 | B3.3 | 최근 30일 실행 이력 스크롤 가능 |
|
||||||
|
|
||||||
|
**핵심 산출물**: 한 화면에서 포트폴리오 건강도 + 신호 + 엔진 상태를 즉시 파악
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
#### WBS-C2: 자동 알림 & 모니터링 (2026-11)
|
||||||
|
|
||||||
|
| WBS | 작업 | 선행 | 성공 판단 데이터 |
|
||||||
|
|:---|:---|:---|:---|
|
||||||
|
| C2.1 | Telegram Bot 알림 — 일일 엔진 실행 결과, 매도 신호 발생, MDD 경고 | 없음 | Telegram 메시지 수신 확인 |
|
||||||
|
| C2.2 | 장애 자동 감지 — CI 실패, 서버 다운, 데이터 수집 중단 시 즉시 알림 | C2.1 | 의도적 장애 주입 → 5분 내 알림 수신 |
|
||||||
|
| C2.3 | Serilog + OpenTelemetry 구조화 로깅 — JSON 형식 로그 + 메트릭 수집 | B2.5 | `journalctl -u quantengine` JSON 구조 확인 |
|
||||||
|
| C2.4 | 주간 자동 리포트 — 포트폴리오 성과, 신호 변화, 캘리브레이션 진척 | C1.1 | 매주 일요일 Telegram 리포트 수신 |
|
||||||
|
|
||||||
|
**핵심 산출물**: 수동 확인 없이 이상 상황 자동 통보
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
#### WBS-C3: 1-Click 리밸런싱 워크플로 (2026-11 ~ 2026-12)
|
||||||
|
|
||||||
|
| WBS | 작업 | 선행 | 성공 판단 데이터 |
|
||||||
|
|:---|:---|:---|:---|
|
||||||
|
| C3.1 | 리밸런싱 제안 화면 — 버킷 밴드 위반 시 자동 제안, 주문표 생성 | C1.2 | 리밸런싱 필요 시 자동 제안 카드 표시 |
|
||||||
|
| C3.2 | 주문 시뮬레이션 — 지정가/호가단위 정규화 결과 미리보기 | C3.1 | 시뮬레이션 결과 테이블 (ticker/수량/지정가/슬리피지) |
|
||||||
|
| C3.3 | 승인 → HTS 주문표 export (CSV/클립보드) | C3.2 | "승인" 버튼 → CSV 다운로드/클립보드 복사 |
|
||||||
|
| C3.4 | 체결 후 실측 기록 UI — 의도가/실제체결가 입력 → 슬리피지 DB 저장 | C3.3 | `execution_slippage` 레코드 생성 확인 |
|
||||||
|
|
||||||
|
**핵심 산출물**: 리밸런싱 판단 → 주문 → 체결 기록의 완전한 루프
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
#### WBS-C4: 성과 리포팅 & 아카이빙 (2026-12)
|
||||||
|
|
||||||
|
| WBS | 작업 | 선행 | 성공 판단 데이터 |
|
||||||
|
|:---|:---|:---|:---|
|
||||||
|
| C4.1 | 월간 성과 보고서 자동 생성 — PDF/마크다운 (수익률, 알파, MDD, 매매 이력) | C1.1 | `Temp/monthly_report_2026_12.pdf` 존재 |
|
||||||
|
| C4.2 | 벤치마크 비교 차트 — KOSPI, S&P 500 대비 누적 수익률 | C4.1 | 차트에서 3개 라인 비교 가능 |
|
||||||
|
| C4.3 | 연간 결산 보고서 — 세금 계산, 배당 수입, 실현/미실현 손익 | C4.1 | 연간 보고서 항목 100% 채움 |
|
||||||
|
| C4.4 | 이력 아카이빙 — 일일 포트폴리오 스냅샷 PostgreSQL 시계열 저장 | B2.3 | `portfolio_daily_snapshots` 테이블 행 수 ≥ 30 |
|
||||||
|
|
||||||
|
**핵심 산출물**: 전문가급 성과 리포트 자동 생성
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📊 Part 4: 완성도 매트릭스 & 마일스톤
|
||||||
|
|
||||||
|
### 4.1 마스터피스 완성도 KPI (2026-12-31 목표)
|
||||||
|
|
||||||
|
| 차원 | 지표 | 현재 | 마스터피스 목표 | 판정 |
|
||||||
|
|:---|:---|:---|:---|:---|
|
||||||
|
| **Alpha** | T+20 실측 건수 | 0 | ≥ 50 | 🔴 |
|
||||||
|
| **Alpha** | CALIBRATED 임계값 | 0/191 | ≥ 30/191 (15%+) | 🔴 |
|
||||||
|
| **Alpha** | 예측 정확도 (match_rate) | DATA_GATED | ≥ 55% | 🔴 |
|
||||||
|
| **Alpha** | 슬리피지 실측 | 0건 | ≥ 10건 | 🔴 |
|
||||||
|
| **Alpha** | KOSPI 대비 알파 | 미측정 | > 0%p/분기 | 🔴 |
|
||||||
|
| **Platform** | .NET 테스트 | 214 | ≥ 300 | 🟠 |
|
||||||
|
| **Platform** | Vue 3 E2E 테스트 | ~3 | ≥ 15 | 🟠 |
|
||||||
|
| **Platform** | tools/ 파일 수 | 586 | ≤ 200 (canonical) | 🟠 |
|
||||||
|
| **Platform** | CI 재현성 | 미검증 | 3회 연속 100% 동일 | 🟠 |
|
||||||
|
| **Platform** | 배포 소요시간 | 수동 | ≤ 20분 (자동) | 🟠 |
|
||||||
|
| **Operation** | 수동 개입 | 매일 | ≤ 1회/주 | 🟡 |
|
||||||
|
| **Operation** | 장애 알림 | 없음 | 5분 내 Telegram | 🔴 |
|
||||||
|
| **Operation** | 월간 리포트 | 없음 | 자동 생성 | 🔴 |
|
||||||
|
| **Operation** | 리밸런싱 워크플로 | CLI 전용 | 웹 UI 1-Click | 🔴 |
|
||||||
|
|
||||||
|
### 4.2 월별 마일스톤
|
||||||
|
|
||||||
|
| 월 | 마일스톤 | 핵심 증빙 |
|
||||||
|
|:---|:---|:---|
|
||||||
|
| **2026-08** | **M1: Alpha Pipeline Live** — T+20 수집 자동화 + tools/ 대정리 완료 | T+20 entry 10건+, tools/ 300개 이하 |
|
||||||
|
| **2026-09** | **M2: Backend Complete** — .NET Application 서비스 + PostgreSQL 3NF + API 15개 | `dotnet test` 250+, endpoint 15+ |
|
||||||
|
| **2026-10** | **M3: SPA Live** — Vue 3 전체 뷰 실동작 + CI/CD 통합 | E2E 10+, 자동 배포 동작 |
|
||||||
|
| **2026-11** | **M4: Professional Ops** — 관제 대시보드 + Telegram 알림 + 리밸런싱 UI | 대시보드 5개 패널, 알림 동작 |
|
||||||
|
| **2026-12** | **M5: Masterpiece** — 알파 실증 + 성과 리포트 + 연간 결산 | match_rate ≥ 55%, 월간 리포트 자동 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🔥 Part 5: 즉시 실행 — Sprint-0 (이번 주, 2026-07-28 ~ 2026-08-01)
|
||||||
|
|
||||||
|
> **이번 주에 할 수 있는 가장 가치 있는 4가지**
|
||||||
|
|
||||||
|
### Sprint-0.1: T+20 수집 자동화 파이프라인 (Day 1~2)
|
||||||
|
```bash
|
||||||
|
# 1. Gitea Actions 일일 cron 등록
|
||||||
|
# .gitea/workflows/t20_ledger.yml
|
||||||
|
# 매 영업일 17:00 KST 자동 실행
|
||||||
|
python tools/build_operational_t20_outcome_ledger_v1.py --auto
|
||||||
|
```
|
||||||
|
- 이것이 **가장 시급**하다. 알파 검증의 전제조건이 데이터 누적이고, 하루라도 빨리 시작해야 한다.
|
||||||
|
|
||||||
|
### Sprint-0.2: tools/ 파일 인벤토리 자동 분류 (Day 2~3)
|
||||||
|
```bash
|
||||||
|
python tools/build_tools_inventory_v1.py
|
||||||
|
# 586개 → canonical / deprecated / dead 3등급 분류
|
||||||
|
# Temp/tools_inventory_v1.json 산출
|
||||||
|
```
|
||||||
|
|
||||||
|
### Sprint-0.3: 슬리피지 실측 첫 기록 (Day 3~4)
|
||||||
|
```bash
|
||||||
|
# 최근 체결 이력에서 1건이라도 기록
|
||||||
|
python tools/evaluate_execution_slippage_v1.py record \
|
||||||
|
--ticker 005930 --side BUY \
|
||||||
|
--intended-price 71000 --actual-price 71050 \
|
||||||
|
--recorded-at 2026-07-28
|
||||||
|
```
|
||||||
|
|
||||||
|
### Sprint-0.4: 레거시 파일 정리 (Day 4~5)
|
||||||
|
```bash
|
||||||
|
# 즉시 삭제 가능한 레거시
|
||||||
|
rm -rf src/client/
|
||||||
|
rm .gitea/workflows/deploy-prod.yml.backup
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📐 Part 6: 의존성 차트 (전체)
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
graph TD
|
||||||
|
subgraph "Stream A: Alpha Validation"
|
||||||
|
A11["A1: T+20 파이프라인"]
|
||||||
|
A21["A2: 캘리브레이션 실증"]
|
||||||
|
A31["A3: 예측 정확도"]
|
||||||
|
A11 --> A31
|
||||||
|
A21 --> A31
|
||||||
|
end
|
||||||
|
|
||||||
|
subgraph "Stream B: Platform"
|
||||||
|
B11["B1: tools 정리"]
|
||||||
|
B21["B2: .NET 완성"]
|
||||||
|
B31["B3: Vue 3 SPA"]
|
||||||
|
B41["B4: CI/CD 통합"]
|
||||||
|
B21 --> B31
|
||||||
|
B31 --> B41
|
||||||
|
end
|
||||||
|
|
||||||
|
subgraph "Stream C: Operation"
|
||||||
|
C11["C1: 관제 대시보드"]
|
||||||
|
C21["C2: 자동 알림"]
|
||||||
|
C31["C3: 리밸런싱 UI"]
|
||||||
|
C41["C4: 성과 리포팅"]
|
||||||
|
B31 --> C11
|
||||||
|
C11 --> C21
|
||||||
|
C11 --> C31
|
||||||
|
C31 --> C41
|
||||||
|
end
|
||||||
|
|
||||||
|
A31 --> C41
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> **마스터피스의 핵심은 기술이 아니라 실증이다.**
|
||||||
|
>
|
||||||
|
> 269개 공식, 92개 spec, 586개 도구 — 이 모든 것은 **T+20 30건이 쌓이고, 캘리브레이션 10건이 CALIBRATED되고, match_rate가 55%를 넘는 순간** 비로소 의미를 갖는다.
|
||||||
|
>
|
||||||
|
> 지금 이 순간부터 가장 중요한 것은 **데이터 누적**이다. 하루라도 빨리 T+20 파이프라인을 돌려야 한다.
|
||||||
|
|
||||||
@@ -1,3 +1,12 @@
|
|||||||
|
> **정정 (2026-07-30)**: 이 문서는 잠시 `docs/archive/`로 옮겨졌다가 같은 날 다시 원래 위치로
|
||||||
|
> 복구되었다. `tools/validate_enterprise_crud_specification_v1.py:29`가 이 경로
|
||||||
|
> (`docs/ROADMAP_ENTERPRISE_TEMPLATES_WBS.md`)를 직접 참조하고, 이 검증은
|
||||||
|
> `.gitea/workflows/ci-frontend.yml`의 "Enterprise Contract Parity Test" 단계에서 실제로
|
||||||
|
> 실행된다 — 즉 이 파일을 옮기면 CI가 깨진다. 내용상 권위는
|
||||||
|
> [`../spec/60_oms_wms_erp_wbs.yaml`](../spec/60_oms_wms_erp_wbs.yaml) 또는
|
||||||
|
> [`OMS_WMS_ERP_PLAYBOOK.md`](OMS_WMS_ERP_PLAYBOOK.md)에 있을 수 있지만, 파일 자체는
|
||||||
|
> 검증기가 요구하는 이 경로에 계속 있어야 한다.
|
||||||
|
|
||||||
# OMS·WMS·ERP 입력 컴포넌트 & 공통 CRUD 템플릿 & 상용화 제안 마스터 WBS (WBS-MASTER-2026)
|
# OMS·WMS·ERP 입력 컴포넌트 & 공통 CRUD 템플릿 & 상용화 제안 마스터 WBS (WBS-MASTER-2026)
|
||||||
|
|
||||||
## 0. 개요 및 3대 명세 통합 권위
|
## 0. 개요 및 3대 명세 통합 권위
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
|
> **정정 (2026-07-30)**: 이 문서는 잠시 `docs/archive/`로 옮겨졌다가 같은 날 다시 원래 위치로
|
||||||
|
> 복구되었다. 내용 자체는 2026-06-13 기준으로 오래됐지만(최신 마이그레이션 상태는
|
||||||
|
> [`../CLAUDE.md`](../CLAUDE.md) Migration Status 참고), `tools/validate_quant_engine_wbs_v1.py`,
|
||||||
|
> `tools/validate_platform_transition_wbs_v1.py`, `tests/unit/test_validate_quant_engine_wbs_v1.py`,
|
||||||
|
> `spec/60_quant_engine_wbs.yaml` 등 release gate 검증 스크립트/스펙이 이 경로(`docs/ROADMAP_WBS.md`)의
|
||||||
|
> 존재와 특정 내용을 실제로 검사하므로, "오래됐다"는 이유만으로 archive하면 검증 파이프라인이 깨진다.
|
||||||
|
> 문서 정리가 필요하면 이 파일을 지우거나 옮기지 말고, 먼저 위 검증 스크립트들을 갱신해야 한다.
|
||||||
|
|
||||||
# 퀀트투자 엔진 — 전체 로드맵 & WBS & 하네스 성공 기준
|
# 퀀트투자 엔진 — 전체 로드맵 & WBS & 하네스 성공 기준
|
||||||
|
|
||||||
> 작성일: 2026-06-13 | 엔진 버전: REBALANCE_ENGINE_V1 기준
|
> 작성일: 2026-06-13 | 엔진 버전: REBALANCE_ENGINE_V1 기준
|
||||||
|
|||||||
@@ -0,0 +1,135 @@
|
|||||||
|
# 2026-07-30 QuantEngine 전략 감사 세션 — 인수인계
|
||||||
|
|
||||||
|
19개 원칙(SOLID, 정공법, 홀루시네이션, 재현성, 데이터정합성, 과유불급, 정규화/역정규화,
|
||||||
|
프로세스 단순화, 패턴화, 표준화, 구조화, 바이브코딩, 현장감, 이력성, 안정성, 고도화,
|
||||||
|
컴포넌트화, 기술부채) 기준으로 저장소를 감사하고 발견된 문제를 수정한 세션의 기록이다.
|
||||||
|
8개 커밋이 `main`에 반영·푸시됐다 (HEAD: `823a9a6`). 무엇이 바뀌었는지는 `git log`가
|
||||||
|
권위 있는 출처이니 여기서 반복하지 않는다 — 이 문서는 **커밋 로그만 봐서는 알 수 없는
|
||||||
|
맥락**(미해결 항목, 판단 근거, 재발 방지 트랩)만 담는다.
|
||||||
|
|
||||||
|
## 미해결 / 다음에 이어갈 것
|
||||||
|
|
||||||
|
- **전체 release DAG(`npm run ops:validate` / `full-gate`)를 끝까지 검증하지 못함.**
|
||||||
|
`GatherTradingData.xlsx`(gitignore 대상, 실거래 데이터 시드)가 이 개발 환경에는 없어서
|
||||||
|
`convert_xlsx` 노드에서 막힌다. 이 파일이 있는 실제 환경(사용자 로컬 또는 운영 서버)에서
|
||||||
|
한 번 돌려서 이번 세션의 변경사항이 데이터 수집 경로를 깨지 않았는지 최종 확인 필요.
|
||||||
|
- **`docs/db/quantengine.dbml`의 `engine_history` vs `quantengine` 스키마 동명 테이블 4개**
|
||||||
|
— 실제 .NET 호출부를 grep으로 대조해 "둘 다 살아있는 서로 다른 모델"로 확정하고 DBML에
|
||||||
|
근거를 남겼지만, 코드 통합/리네임은 하지 않았다. "정리해달라"는 요청이 오면 DBML의
|
||||||
|
`V8: PostgreSQL History-First Operating Model` 섹션 노트부터 다시 읽을 것 — 죽은 코드로
|
||||||
|
섣불리 판단하지 말 것.
|
||||||
|
- **OpenDART는 배선만 맞춰뒀고 실제로 호출하는 워크플로우가 아직 없다.** 환경변수명은
|
||||||
|
`OPENDART_OPENAPI_KEY`로 코드·Gitea Secrets 양쪽 통일 완료. 나중에
|
||||||
|
`tools/ingest_fundamental_raw.py`를 CI에서 처음 호출할 때는 별도 매핑 없이
|
||||||
|
`secrets.OPENDART_OPENAPI_KEY`를 그 job의 `env:`에 바로 연결하면 된다.
|
||||||
|
- **KRX Open API는 구현이 전혀 없다** — CLAUDE.md에 환경변수명(`KRX_OPENAPI_KEY`, 실제
|
||||||
|
Gitea Secrets 이름과 일치)만 예약해뒀다. 호출 한도 등은 사용자가 알려주지 않아 기록하지
|
||||||
|
않았다 — 추측해서 채우지 말 것.
|
||||||
|
|
||||||
|
## 파일 수 최종 현황 (같은 날, 3차 라운드)
|
||||||
|
|
||||||
|
`tests/unit/test_kis_data_collection_v1.py`가 F8과 같은 원인(deprecated/ 이동)으로 import가
|
||||||
|
깨져 있던 걸 발견해 고쳤다 (오늘 삭제와 무관, 이전부터 있던 버그 — `pytest --collect-only`로
|
||||||
|
실제 실행해서 발견). 그리고 `tests/golden/generated/` 174개 — 스펙(QE-M0-06)이 스스로
|
||||||
|
"M3 패리티 대체 후 삭제" 조건을 걸어뒀고, M3-01~05가 전부 DONE인 걸 확인한 뒤 삭제. CI/커버리지
|
||||||
|
게이트 어디서도 이 파일들을 쓰지 않는다는 것까지 확인 완료. **최종 파일 수: 4,523 → 1,687**
|
||||||
|
(예산 2,200 대비 77%, 여유 513개). 이 지표는 이제 확실히 건강한 상태 — 추가로 파일 수를
|
||||||
|
줄이려는 시도는 과유불급이다(이미 통과한 지표를 더 깎으려다 실수로 쓰이는 파일을 지울 위험이
|
||||||
|
더 크다). `tools/`에는 아직 그레이존 파일이 좀 더 있을 수 있지만(74개 삭제 후 남은 것들은
|
||||||
|
전부 검토 완료), 더 뒤지는 것보다 실제 필요가 생겼을 때 개별적으로 판단하는 게 낫다.
|
||||||
|
|
||||||
|
## orphan 스크립트 정리 (같은 날, 2차 조사)
|
||||||
|
|
||||||
|
`tools/*.py` + `src/quant_engine/*.py` 619개 파일 전수 스캔(파일명이 저장소 어디에도 안 나오는
|
||||||
|
것 탐지) 결과 81개 orphan 후보 발견. 두 단계로 나눠 총 74개 삭제:
|
||||||
|
- 1차 34개: 명백한 버전 중복(`_v2`/`_correct`/`_properly` 짝) + tools/에 섞인 임시 테스트/디버그
|
||||||
|
스크립트.
|
||||||
|
- 2차 40개: WBS 티켓 전용 1회성 스크립트 + 기타 build_*/validate_* 진단 도구. **주의**: 스크립트
|
||||||
|
자체 이름 검색만으로는 부족했다 — 47개 후보 중 7개는 이름은 안 불려도 만들어내는
|
||||||
|
`Temp/*.json` 산출물이 다른 도구에서 계속 읽히고 있어 실제로는 살아있었다
|
||||||
|
(`build_outcome_ledger_v1.py`, `build_pre_distribution_early_warning_v3.py`,
|
||||||
|
`build_shadow_ledger_v1.py`, `build_p2_01_live_outcome_ledger.py`,
|
||||||
|
`build_p2_02_calibration_promotion.py`, `build_p1_01_execution_verdict_unify.py`,
|
||||||
|
`run_release_ci_gate_v2.py` — 이 7개는 삭제하지 않고 남겨둠). **다음에 orphan 스캔할 때는
|
||||||
|
스크립트명뿐 아니라 그 스크립트가 쓰는 `Temp/*.json` 출력 경로까지 같이 검색할 것.**
|
||||||
|
|
||||||
|
나머지 orphan 후보(그레이존 밖, 원래 81개에 없던 것들)는 손대지 않았다 — 전수조사가 아니라
|
||||||
|
`tools/`+`src/quant_engine/`만 스캔한 결과다.
|
||||||
|
|
||||||
|
## GatherTradingData.xlsx 관련 (같은 날, 추가 조사)
|
||||||
|
|
||||||
|
로컬에는 `.xlsx`가 없지만, 운영 서버(`~/QuantEngineByItz/GatherTradingData.json`)에는 이미
|
||||||
|
xlsx→json 변환이 끝난 정본 시드 파일이 있다 (저장소 자체 설계 문서
|
||||||
|
`docs/GATHERTRADINGDATA_XLSX_DECISION_2026-06-21.md`가 "json을 정본으로, xlsx는 미추적"으로
|
||||||
|
결정한 바로 그 파일). SCP로 로컬에 받아왔다(`./GatherTradingData.json`, gitignore 대상이라
|
||||||
|
커밋 안 됨). 그런데 `tools/run_release_dag_v3.py`의 `convert_xlsx` 노드는 xlsx 파일이 실제로
|
||||||
|
없으면 무조건 하드 실패하도록 짜여 있어(캐시/스킵 로직 없음, 코드 주석에 "optional 최적화,
|
||||||
|
아직 미구현"이라고 명시됨), json이 이미 있어도 release DAG를 처음부터 끝까지 돌릴 수는 없다.
|
||||||
|
|
||||||
|
남은 WBS 태스크 10개(QE-M3-03, M4-01~05, M5-01~04)를 이 json만으로 복구하려 했으나:
|
||||||
|
- **M3-03**: `engine_history.factor_output_history`에 최근 24시간 데이터가 있어야 하는 라이브
|
||||||
|
신선도 게이트 — 데이터 유무와 무관, 운영 파이프라인이 최근 실제로 돌았는지에 달림.
|
||||||
|
- **M4-01~04, M5-01~03**: `Temp/backtest_result_v1.json` 등은 Python 스크립트가 아니라
|
||||||
|
**`src/dotnet/QuantEngine.Tools`/`QuantEngine.Web`를 실제로 띄우고 Playwright로 백테스트/
|
||||||
|
캘리브레이션 화면을 조작해야** 생성된다(M4-05 검증 커맨드가 `npx playwright test` →
|
||||||
|
`verify_wbs_task_v1.py` 순서인 게 근거). 로컬 웹서버 기동 + Playwright 브라우저 설치 +
|
||||||
|
실제 가격/팩터 이력 DB 데이터 충분 여부까지 얽혀 있어 이번 세션에서는 시도하지 않았다.
|
||||||
|
- **M4-05, M5-04**: 위와 같은 이유로 막힘.
|
||||||
|
|
||||||
|
다음 세션에서 이어가려면: SSH 터널 + `dotnet watch run --project QuantEngine.Web` +
|
||||||
|
`npx playwright test --project=evidence tests/e2e/evidence/qe-m4-05-backtest.spec.ts` 순으로
|
||||||
|
시도. DB에 실제 가격 이력이 충분한지부터 확인할 것 (부족하면 백테스트 자체가 의미있는 결과를
|
||||||
|
못 낼 수 있음).
|
||||||
|
|
||||||
|
## 추가 발견 (같은 날, entropy 정리 이후)
|
||||||
|
|
||||||
|
- **`Temp/*` 전체 삭제가 WBS 검증 캐시를 깼다.** `tools/verify_wbs_task_v1.py`가 만드는
|
||||||
|
`Temp/evidence/<task_id>/verdict.json`과 각종 `Temp/*.json`(golden_coverage_100,
|
||||||
|
market_time_series_schema 등)은 git에 추적되지 않지만 "완료된 검증의 증적"이라 순수
|
||||||
|
빌드 캐시가 아니었다. `spec/60_quant_engine_wbs.yaml`의 13개 태스크가 FAIL로 나타났었음.
|
||||||
|
- 3개(QE-M0-06, QE-M2-06, QE-M2-01)는 해당 generator 재실행 + DB 재접속으로 복구 완료.
|
||||||
|
- QE-M3-03은 무관 — `engine_history.factor_output_history`에 최근 24시간 내 데이터가
|
||||||
|
있어야 하는 라이브 신선도 게이트. 오늘 세션과 상관없이 운영 파이프라인이 최근 안
|
||||||
|
돌았으면 원래도 FAIL이다.
|
||||||
|
- 나머지 7개(QE-M4-01~04, QE-M5-01~03)는 `Temp/prediction_accuracy_harness_v2.json`
|
||||||
|
등 실거래 데이터 파생 체인이 필요 — 이 저장소 스냅샷엔 `GatherTradingData.xlsx`가
|
||||||
|
없어서(이미 위에서 언급한 그 문제) 복구 불가. 실거래 데이터가 있는 환경에서 전체
|
||||||
|
파이프라인을 한 번 돌리면 자동 복구된다.
|
||||||
|
- QE-M4-05/QE-M5-04(Playwright evidence)도 같은 체인에 의존해 사실상 같이 막혀있음.
|
||||||
|
- **교훈**: `Temp/`가 git 미추적이라고 전부 "순수 빌드 산출물"은 아니다 — `Temp/evidence/`처럼
|
||||||
|
"재실행하면 되지만 재실행에 실제 데이터/DB가 필요한 캐시"가 섞여 있다. 다음에 비슷한
|
||||||
|
정리를 할 때는 삭제 전에 `rg -l "Temp/" spec/ tools/` 정도로 어떤 하위 경로가 검증
|
||||||
|
체인에 물려있는지 먼저 확인할 것.
|
||||||
|
|
||||||
|
## 이번 세션에서 걸린 함정 — 재발 방지
|
||||||
|
|
||||||
|
- **문서를 "오래됐다"고 archive하기 전에 `tools/*.py`, `spec/*.yaml`, `tests/*.py`,
|
||||||
|
`.gitea/workflows/*.yml`까지 전부 grep할 것** — 다른 문서/CLAUDE.md만 검색해서는 부족하다.
|
||||||
|
`docs/ROADMAP_WBS.md`와 `docs/ROADMAP_ENTERPRISE_TEMPLATES_WBS.md`를 이 방식으로 archive
|
||||||
|
했다가, 실제로는 release gate 검증기와 `ci-frontend.yml`의 Enterprise Contract Parity
|
||||||
|
Test가 그 경로를 직접 참조하고 있어서 되돌려야 했다. 지금은 이 두 파일 다시 원위치, 검증기
|
||||||
|
3개 직접 실행해서 통과 확인 완료.
|
||||||
|
- **DbUp 마이그레이션은 파일명을 순수 문자열로 정렬한다** — `V10__`이 `V2__`보다 먼저
|
||||||
|
정렬되는 문제가 있었다. `MigrationScriptNameComparer`(이번 세션에 추가, `DbMigrator.cs`에
|
||||||
|
연결)로 해결됨 — 새 마이그레이션은 zero-padding 없이 다음 정수만 쓰면 된다.
|
||||||
|
- **`runtime/`은 대부분 git 추적되는 이력 데이터다** (`refactor_baseline_v*.yaml`,
|
||||||
|
`rollback_manifest_v*.yaml` 등) — 스크래치 공간이 아니다. 확인용 명령의 `--out`을
|
||||||
|
실수로 이 경로로 잡아서 이력 파일 2개를 덮어썼다가 `git diff`로 발견하고
|
||||||
|
`git checkout --`으로 복구했다. 1회성 도구 출력은 `/tmp/` 등으로 보낼 것.
|
||||||
|
- **이 머신에 Python이 두 개 설치돼 있다** — `python`(3.11, 대부분의 서브프로세스가
|
||||||
|
실제로 쓰는 것)과 `python3`(3.14). 한쪽에 패키지를 설치해도 다른 쪽엔 없다.
|
||||||
|
- **repository entropy 감사(`audit_repository_entropy_v2.py`)가 git 추적 파일이 아니라
|
||||||
|
로컬 디스크 전체를 세고 있었다** — `.gitignore`와 제외 목록이 어긋나 있어 로컬 빌드 한 번에
|
||||||
|
4,523개까지 부풀었다(예산 2,200). `.gitignore`와 일치하도록 제외 목록을 갱신해 재발을
|
||||||
|
막았다 (`tools/audit_repository_entropy_v1.py`). 이 게이트가 다시 실패하면 먼저 "새로운
|
||||||
|
미추적 빌드 산출물 디렉터리가 생겼나"부터 확인할 것 — 바로 대규모 파일 삭제로 가지 말 것.
|
||||||
|
|
||||||
|
## 이번 세션에서 확립된 작업 방식
|
||||||
|
|
||||||
|
- 작업 라운드가 끝나면 다음에 할 만한 구체적인 후보를 먼저 제안한다 (사용자가 같은 지시를
|
||||||
|
반복해서 보내는 걸 방지).
|
||||||
|
- 단순 기계적 조사/위임은 `model: "haiku"`로, 판단이 필요한 작업만 Sonnet급으로.
|
||||||
|
- 커밋/푸시는 명시적으로 요청받았을 때만, 항상 경로를 지정해서 스테이징(`git add -A` 금지),
|
||||||
|
세션 시작 전부터 있던 무관한 변경사항은 요청 없이는 포함하지 않는다.
|
||||||
|
- 채팅에 붙여넣어진 실제 API 키(KIS, OpenDART, KRX)는 어떤 파일에도 적지 않는다 — 환경변수
|
||||||
|
*이름*만 기존 KIS 관례(환경변수/Gitea Secrets 전용, 하드코딩 금지)에 맞춰 기록한다.
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
# QuantEngine UI Design Guidelines
|
||||||
|
|
||||||
|
Full UI design principles, extracted from CLAUDE.md (2026-07-30) to keep the main file within
|
||||||
|
the character budget. CLAUDE.md keeps a condensed summary; this file has the complete rules
|
||||||
|
and the component mapping table.
|
||||||
|
|
||||||
|
## Framework & Design System (2026-07-11)
|
||||||
|
|
||||||
|
- **Primary Framework**: ASP.NET Core Razor Pages + Bootstrap 5 + Tabler UI
|
||||||
|
- **Design System**: Tabler (Bootstrap 5 기반), 밀집 레이아웃 + 전통 서버 렌더링
|
||||||
|
- **Render Mode**: **Server-side Razor Pages** — 모든 Admin UI는 서버에서 렌더링, Cookie 기반 인증 (API-First WASM 폐기)
|
||||||
|
- **Authentication**: Cookie Authentication (HttpOnly) + BCrypt password hashing + IP lockout (3 strikes, 15-min)
|
||||||
|
- **Deprecation**: **Blazor Interactive WebAssembly 폐기**, **MudBlazor 컴포넌트 폐기** (2026-07-11), **SmartAdmin 폐기**. `QuantEngine.Web.Client` 폴더는 저장소에 실재하지 않는다 — `.sln`에서 제외된 것이 아니라 완전히 삭제됨 (2026-07-30 확인)
|
||||||
|
|
||||||
|
## Component Development Rules
|
||||||
|
|
||||||
|
1. **All Admin UI Development** (New + Refactored):
|
||||||
|
- Use **Razor Pages** (.cshtml + .cshtml.cs PageModel) exclusively for admin
|
||||||
|
- UI는 Repository/Service를 생성자 DI로 직접 호출 (API 홉 없음)
|
||||||
|
- Bootstrap 5 + Tabler UI CSS classes for styling
|
||||||
|
- **Form Validation**: DataAnnotations DTO + FluentValidation IValidator<T> 이중 검증
|
||||||
|
- HTML `<form>` + tag helpers (`asp-for`, `asp-action`, `asp-page`)
|
||||||
|
|
||||||
|
2. **Authentication & Authorization**:
|
||||||
|
- Cookie name: `QuantEngine.Admin.Auth` (HttpOnly, SameSite=Lax)
|
||||||
|
- Session duration: 12 hours (sliding expiration)
|
||||||
|
- Folder-level `[Authorize]` via `AuthorizeFolder("/Admin")` convention (per-page 반복 금지)
|
||||||
|
- Login: `/Account/Login` (Razor Page, NO WASM)
|
||||||
|
- Password: BCrypt-hashed (auto-migrates existing SHA-256 hashes on first login)
|
||||||
|
- IP Lockout: 3 failed attempts → 15-minute lockout
|
||||||
|
|
||||||
|
3. **Data & Form Patterns**:
|
||||||
|
- PageModel constructor: `public IndexModel(IWorkspaceRepository repo, ILogger<IndexModel> logger)`
|
||||||
|
- Form submission: `OnPostAsync()` / `OnPostDeleteAsync()` (multi-handler pattern)
|
||||||
|
- Validation failures: return `Page()` (re-render with ModelState errors)
|
||||||
|
- Pagination: `PaginationModel` record (Page, TotalPages, Func<int,string> BuildPageUrl)
|
||||||
|
- Empty states: `<PartialView name="_EmptyState" model="message" />`
|
||||||
|
|
||||||
|
4. **Component Mapping** (Bootstrap 5 + Tabler):
|
||||||
|
|
||||||
|
| UI Element | Component | Notes |
|
||||||
|
|-----------|-----------|-------|
|
||||||
|
| Button | `<button class="btn btn-primary">` | — |
|
||||||
|
| Input field | `<input asp-for="Property" class="form-control">` | tag helper |
|
||||||
|
| Dropdown | HTML `<select asp-for="Property">` | tag helper |
|
||||||
|
| Data grid | HTML `<table class="table">` | plain, no virtualization |
|
||||||
|
| Card | `<div class="card">` | Bootstrap card |
|
||||||
|
| Badge/Status | `<span class="badge bg-success">Active</span>` | Bootstrap badge |
|
||||||
|
| Layout container | `<div class="container-xl">` / `<div class="row">` | Bootstrap grid |
|
||||||
|
| Navigation | HTML navbar in `_AdminLayout.cshtml` | sidebar + topbar |
|
||||||
|
| Loading | N/A (server-rendered) | no loading states needed |
|
||||||
|
| Icons | Bootstrap Icons (`<i class="bi bi-*"></i>`) | CDN |
|
||||||
|
| Modal/Dialog | Bootstrap modal or inline `confirm()` | avoid unnecessary modals |
|
||||||
|
| Validation msg | `<span asp-validation-for="Property" class="d-block alert alert-danger mt-2">` | tag helper |
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
# WBS Enterprise CRUD Commercialization Master Specification
|
||||||
|
# Version: 3.0.0
|
||||||
|
# Authority: 30-Year Senior Expert Panel (Architect, PM, PL, Dev, AX/UX, QA, User)
|
||||||
|
|
||||||
|
version: "3.0.0"
|
||||||
|
governance_principals:
|
||||||
|
- SOLID Design Principles
|
||||||
|
- Single Responsibility & High Cohesion
|
||||||
|
- Dual-model Data Architecture (Normalized Master / Denormalized Read Model)
|
||||||
|
- Strict Client-Schema-Server-DB 4-Layer Validation Guard
|
||||||
|
- Zero Vibe Coding & Hallucination Elimination
|
||||||
|
- Field Status (13 States) & Value Source (8 Provenances) Contract
|
||||||
|
- Touch Density & Offline Command Buffer for WMS Field Operations
|
||||||
|
|
||||||
|
kpi_targets:
|
||||||
|
typecheck_pass_rate_pct: 100.0
|
||||||
|
build_exit_code: 0
|
||||||
|
harness_pass_rate_pct: 100.0
|
||||||
|
field_error_rate_target_pct: 0.01
|
||||||
|
wms_barcode_parse_speed_ms: 100
|
||||||
|
p95_response_latency_ms: 200
|
||||||
|
|
||||||
|
phases:
|
||||||
|
- phase_id: "PHASE-01"
|
||||||
|
name: "도메인 데이터 계약 & 입력 컴포넌트 4계층 아키텍처 구축"
|
||||||
|
role_perspectives:
|
||||||
|
architect: "FieldContract, FieldStatus 13종, ValueSource 8종 헌법 확정"
|
||||||
|
ax_ux: "standard input density (compact/comfortable/touch 44px) 3종 확립"
|
||||||
|
dev: "TypedFieldBase, Primitive, Field, Domain-Field, Composite 19종 컴포넌트 탑재"
|
||||||
|
kpi: "19종 입력 컴포넌트 100% 라이브러리화"
|
||||||
|
status: "COMPLETED"
|
||||||
|
|
||||||
|
- phase_id: "PHASE-02"
|
||||||
|
name: "11대 표준 업무 CRUD 화면 템플릿 상용화"
|
||||||
|
role_perspectives:
|
||||||
|
pm_pl: "TPL-LIST-01 ~ TPL-HISTORY-01 업무 위험도별 11종 템플릿 완성"
|
||||||
|
qa: "Template Showcase E2E 렌더링 및 인터랙션 테스트"
|
||||||
|
kpi: "11개 템플릿 Route & View 100% 정상 작동"
|
||||||
|
status: "COMPLETED"
|
||||||
|
|
||||||
|
- phase_id: "PHASE-03"
|
||||||
|
name: "4계층 입력 검증 & ACID 역처리 트랜잭션 수용"
|
||||||
|
role_perspectives:
|
||||||
|
architect: "클라이언트-스키마-서버-DB 4계층 Validation 경계 확립"
|
||||||
|
dev: "TPL-CANCEL-01 취소·반제·역처리 100% 트랜잭션 수용"
|
||||||
|
kpi: "검증 실패율 0.01% 미만 통제, 역처리 정합성 100%"
|
||||||
|
status: "COMPLETED"
|
||||||
|
|
||||||
|
- phase_id: "PHASE-04"
|
||||||
|
name: "WMS 현장 작업 초고속 처리 & 오프라인 큐 버퍼링"
|
||||||
|
role_perspectives:
|
||||||
|
user: "장갑 착용 상태 터치 타겟 44px 확보 및 <100ms 바코드 스캔"
|
||||||
|
qa: "네트워크 단절 시 OfflineCommand 큐 적재 및 복구 시 동기화"
|
||||||
|
kpi: "바코드 파싱 <100ms, 오프라인 큐 손실 0건"
|
||||||
|
status: "COMPLETED"
|
||||||
|
|
||||||
|
- phase_id: "PHASE-05"
|
||||||
|
name: "AX(AI 보조) 초안 템플릿 & R0~R4 리스크 거버넌스"
|
||||||
|
role_perspectives:
|
||||||
|
ax_ux: "AISuggestedField 초안 보조 및 결정론적 수식 AI 분리"
|
||||||
|
architect: "AISuggestedField R0~R4 거버넌스 헌법 통제"
|
||||||
|
kpi: "AI 수용/수정/거절 이력 100% 감사 로그 기록"
|
||||||
|
status: "COMPLETED"
|
||||||
|
|
||||||
|
- phase_id: "PHASE-06"
|
||||||
|
name: "TypeScript Strict & Vue-TSC 프로덕션 빌드 0-Error 결함 정산"
|
||||||
|
role_perspectives:
|
||||||
|
dev: "vue-tsc -b && vite build 100% 통과"
|
||||||
|
qa: "css minifier 및 prop misalignment 결함 zero화"
|
||||||
|
kpi: "빌드 exit code 0, vue-tsc -b 0 Errors"
|
||||||
|
status: "COMPLETED"
|
||||||
|
|
||||||
|
- phase_id: "PHASE-07"
|
||||||
|
name: "CI/CD & Gitea Actions 자동화 파이프라인 수용"
|
||||||
|
role_perspectives:
|
||||||
|
pm_pl: "git commit, push, PR, CI gate 8단계 품질 통과"
|
||||||
|
dev: "자동 검증 하네스 CLI validate_enterprise_crud_specification_v1.py 100% PASS"
|
||||||
|
kpi: "CI 파이프라인 PASS, 자동 검증 하네스 PASS"
|
||||||
|
status: "COMPLETED"
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
version: "1.0.0"
|
||||||
|
objective: "oms-wms-erp의 계약 중심 리팩토링을 안전한 증분 단위로 수행"
|
||||||
|
scope:
|
||||||
|
canonical_code_root: "oms-wms-erp"
|
||||||
|
excluded_roots:
|
||||||
|
- "src/frontend"
|
||||||
|
- "Temp"
|
||||||
|
- "archive"
|
||||||
|
work_items:
|
||||||
|
- id: "WBS-20260728-01"
|
||||||
|
title: "baseline 및 계약 경계 확인"
|
||||||
|
status: "in_progress"
|
||||||
|
success_data:
|
||||||
|
- "npm run type-check exit code 0"
|
||||||
|
- "npm run build exit code 0"
|
||||||
|
- "npm run test exit code 0"
|
||||||
|
- "python tools/validate_enterprise_crud_specification_v1.py exit code 0"
|
||||||
|
- id: "WBS-20260728-02"
|
||||||
|
title: "공통 계약·타입·오류 처리의 단일 진실원 확립"
|
||||||
|
status: "pending"
|
||||||
|
success_data:
|
||||||
|
- "중복 API 오류·감사·그리드 계약 0건"
|
||||||
|
- "기존 소비자 타입체크 통과"
|
||||||
|
- id: "WBS-20260728-03"
|
||||||
|
title: "삭제·동시성·금액 정합성 보호"
|
||||||
|
status: "pending"
|
||||||
|
success_data:
|
||||||
|
- "물리 삭제 경로 신규 추가 0건"
|
||||||
|
- "낙관적 잠금 실패가 명시적 오류 계약으로 매핑"
|
||||||
|
- "금액 계산의 부동소수점 암묵 변환 0건"
|
||||||
|
- id: "WBS-20260728-04"
|
||||||
|
title: "사후 검증·재현성·증빙 기록"
|
||||||
|
status: "pending"
|
||||||
|
success_data:
|
||||||
|
- "검증 명령과 결과가 Temp/ 증빙 파일에 존재"
|
||||||
|
- "변경 파일이 WBS 항목에 매핑됨"
|
||||||
|
constraints:
|
||||||
|
- "가격·수량·공식은 quant-engine spec을 재계산하지 않음"
|
||||||
|
- "Temp/ 산출물은 직접 편집하지 않음"
|
||||||
|
- "기존 사용자 변경을 덮어쓰지 않음"
|
||||||
@@ -1,3 +1,7 @@
|
|||||||
|
> **ARCHIVED (2026-07-30)**: 2026-07-11 시점 build.yml/wbs_9_3_*.yml/merge-to-main.yml 등
|
||||||
|
> 이후 삭제된 워크플로우를 전제로 쓰였습니다. 현재 CI 구조는
|
||||||
|
> [`../CICD_PIPELINE.md`](../CICD_PIPELINE.md)를 참고하세요.
|
||||||
|
|
||||||
# QuantEngine CI/CD 파이프라인 — 근본적 개선 분석 및 로드맵
|
# QuantEngine CI/CD 파이프라인 — 근본적 개선 분석 및 로드맵
|
||||||
|
|
||||||
**작성일**: 2026-07-11
|
**작성일**: 2026-07-11
|
||||||
@@ -1,3 +1,7 @@
|
|||||||
|
> **ARCHIVED (2026-07-30)**: 2026-07-11 시점 파이프라인 구조 기준입니다. 현재 모니터링
|
||||||
|
> 방법은 [`../DEPLOYMENT_RUNBOOK.md`](../DEPLOYMENT_RUNBOOK.md)의 "Deployment Monitoring" /
|
||||||
|
> "API Monitoring (CLI)" 절을 참고하세요.
|
||||||
|
|
||||||
# CI/CD Pipeline 모니터링 가이드
|
# CI/CD Pipeline 모니터링 가이드
|
||||||
|
|
||||||
**작성일**: 2026-07-11
|
**작성일**: 2026-07-11
|
||||||
@@ -1,3 +1,7 @@
|
|||||||
|
> **ARCHIVED (2026-07-30)**: 본 문서의 CI/CD 로드맵은 2026-07-11 이후 구현 완료되었습니다.
|
||||||
|
> 현재 CI/CD 가이드는 [`docs/CICD_PIPELINE.md`](docs/CICD_PIPELINE.md) 및
|
||||||
|
> [`docs/DEPLOYMENT_RUNBOOK.md`](docs/DEPLOYMENT_RUNBOOK.md)을 참고하세요.
|
||||||
|
|
||||||
# QuantEngine Gitea Actions CI/CD 개선 로드맵
|
# QuantEngine Gitea Actions CI/CD 개선 로드맵
|
||||||
|
|
||||||
**최종 목표**: 신뢰성 높은 자동화된 배포 파이프라인 구축
|
**최종 목표**: 신뢰성 높은 자동화된 배포 파이프라인 구축
|
||||||
@@ -1,3 +1,7 @@
|
|||||||
|
> **ARCHIVED (2026-07-30)**: "로컬 Green-Blue 배포(SSH 제거)" 방식은 이후
|
||||||
|
> SSH 기반 release-artifact 배포(prepare-release.yml → deploy-prod.yml)로 대체되었습니다.
|
||||||
|
> 현재 배포 방식은 [`../DEPLOYMENT_RUNBOOK.md`](../DEPLOYMENT_RUNBOOK.md)를 참고하세요.
|
||||||
|
|
||||||
# QuantEngine CI/CD 파이프라인 구현 완료 보고서
|
# QuantEngine CI/CD 파이프라인 구현 완료 보고서
|
||||||
|
|
||||||
**작성일**: 2026-07-11
|
**작성일**: 2026-07-11
|
||||||
@@ -1,3 +1,8 @@
|
|||||||
|
> **ARCHIVED (2026-07-30)**: 이미 삭제된 `merge-to-main.yml`, 옛 `deploy_gb.sh` Green-Blue
|
||||||
|
> 스크립트를 전제로 쓰였습니다. 현재 트러블슈팅 가이드는
|
||||||
|
> [`../DEPLOYMENT_RUNBOOK.md`](../DEPLOYMENT_RUNBOOK.md)의 "Troubleshooting Deployment
|
||||||
|
> Failures" 절을 참고하세요.
|
||||||
|
|
||||||
# CI/CD 배포 트러블슈팅 가이드
|
# CI/CD 배포 트러블슈팅 가이드
|
||||||
|
|
||||||
**작성일**: 2026-07-11
|
**작성일**: 2026-07-11
|
||||||
+4
@@ -1,3 +1,7 @@
|
|||||||
|
> **ARCHIVED (2026-07-30)**: 본 문서는 Phase 0-1 실행 계획(2026-07-24)으로, 현재 상태와 일부 차이가 있습니다.
|
||||||
|
> 최신 정보는 [`../CLAUDE.md`](../CLAUDE.md) Migration Status 섹션 또는
|
||||||
|
> [`STRATEGIC_EXECUTION_MASTER_PLAN.md`](../STRATEGIC_EXECUTION_MASTER_PLAN.md)를 참고하세요.
|
||||||
|
|
||||||
# QuantEngine 현대화 실행 계획
|
# QuantEngine 현대화 실행 계획
|
||||||
**Phase 0 마무리 + Phase 1 준비** (2026-07-24 ~ 2026-09-30)
|
**Phase 0 마무리 + Phase 1 준비** (2026-07-24 ~ 2026-09-30)
|
||||||
|
|
||||||
@@ -1,3 +1,7 @@
|
|||||||
|
> **ARCHIVED (2026-07-30)**: 본 문서의 Gantt 차트는 2026-07-24 기준 Phase 0-4 일정입니다.
|
||||||
|
> 최신 마이그레이션 상태는 [`../CLAUDE.md`](../CLAUDE.md)의 Migration Status 섹션 또는
|
||||||
|
> [`STRATEGIC_EXECUTION_MASTER_PLAN.md`](../STRATEGIC_EXECUTION_MASTER_PLAN.md)를 참고하세요.
|
||||||
|
|
||||||
# QuantEngine 현대화 로드맵 (시각화)
|
# QuantEngine 현대화 로드맵 (시각화)
|
||||||
|
|
||||||
## 1. 전체 진행도 (Gantt Chart)
|
## 1. 전체 진행도 (Gantt Chart)
|
||||||
+4
@@ -1,3 +1,7 @@
|
|||||||
|
> **ARCHIVED (2026-07-30)**: 본 문서의 Phase 0-3 전략은 2026-07-24 기준이며, 최신 버전으로 대체되었습니다.
|
||||||
|
> 현재 마이그레이션 상태는 [`../CLAUDE.md`](../CLAUDE.md) Migration Status 또는
|
||||||
|
> [`STRATEGIC_EXECUTION_MASTER_PLAN.md`](../STRATEGIC_EXECUTION_MASTER_PLAN.md)를 참고하세요.
|
||||||
|
|
||||||
# QuantEngine 데이터 기반 고도화 로드맵
|
# QuantEngine 데이터 기반 고도화 로드맵
|
||||||
**2026-07-24 ~ 2027-06-30**
|
**2026-07-24 ~ 2027-06-30**
|
||||||
|
|
||||||
@@ -1,3 +1,8 @@
|
|||||||
|
> **ARCHIVED (2026-07-30)**: 테스트 섹션은 bUnit + MudBlazor 컴포넌트(`Dashboard.razor`,
|
||||||
|
> `mud-card-kpi` 등) 기준으로, MudBlazor/Blazor WASM이 Razor Pages로 대체된 2026-07-11
|
||||||
|
> Phase 1 이후 더 이상 유효하지 않습니다. 배포 섹션은
|
||||||
|
> [`../DEPLOYMENT_RUNBOOK.md`](../DEPLOYMENT_RUNBOOK.md)로 대체되었습니다.
|
||||||
|
|
||||||
# QuantEngine - Testing & Deployment Guide
|
# QuantEngine - Testing & Deployment Guide
|
||||||
|
|
||||||
**Status**: Phase 6 (Testing) & Phase 8 (Deployment) - Configuration & Documentation
|
**Status**: Phase 6 (Testing) & Phase 8 (Deployment) - Configuration & Documentation
|
||||||
+262
-2
@@ -1,8 +1,17 @@
|
|||||||
// =============================================================================
|
// =============================================================================
|
||||||
// QuantEngine Database Schema (DBML)
|
// QuantEngine Database Schema (DBML)
|
||||||
// DbUp 마이그레이션(V1~V5)과 1:1 동기화 — 마이그레이션 추가 시 이 파일도 반드시 갱신
|
// DbUp 마이그레이션(V1~V10)과 1:1 동기화 — 마이그레이션 추가 시 이 파일도 반드시 갱신
|
||||||
// (CLAUDE.md 규칙: schema 변경 → DBML + 문서 동기화)
|
// (CLAUDE.md 규칙: schema 변경 → DBML + 문서 동기화)
|
||||||
//
|
//
|
||||||
|
// 2026-07-30 해결됨: 예전에 V003_name.sql/V004_name.sql(싱글언더스코어, zero-pad)이
|
||||||
|
// V1__Name.sql(더블언더스코어, zero-pad 없음) 방식과 섞여 있어, DbUp의 기본 알파벳순
|
||||||
|
// 정렬에서 "V003" < "V1"로 먼저 실행되는 문제가 있었다 (V004는 V2가 만드는 테이블에 대한
|
||||||
|
// 하드 FK 제약이 있어 빈 DB에 처음부터 배포하면 V004에서 하드 실패 → V1~V8 전체가 실행
|
||||||
|
// 안 되는 재현성 버그였음). 조치: V003→V9, V004→V10으로 리네임 + DbMigrator.cs에
|
||||||
|
// MigrationScriptNameComparer(숫자 기반 비교자)를 추가해 "V{n}"이 몇 자리 숫자든 항상
|
||||||
|
// 숫자 크기순으로 정렬되도록 함. 신규 마이그레이션은 V{n}__Name.sql 규칙만 사용할 것
|
||||||
|
// (이 비교자 덕분에 V11, V12... 로 계속 늘어나도 더 이상 이 문제가 재발하지 않는다).
|
||||||
|
//
|
||||||
// 참고: Hangfire 스키마는 Hangfire.PostgreSql 라이브러리가 자동 생성
|
// 참고: Hangfire 스키마는 Hangfire.PostgreSql 라이브러리가 자동 생성
|
||||||
// (DbUp 마이그레이션으로 관리하지 않음, 여기서도 제외)
|
// (DbUp 마이그레이션으로 관리하지 않음, 여기서도 제외)
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
@@ -382,7 +391,7 @@ Table engine_history.market_vs_engine_gap_history {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
// Schema: engine_history (V5 normalized learning history)
|
// V6: Market Time Series (quantengine schema)
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
|
|
||||||
Table quantengine.price_history_daily {
|
Table quantengine.price_history_daily {
|
||||||
@@ -415,6 +424,10 @@ Table quantengine.macro_history_daily {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// =============================================================================
|
||||||
|
// V5: Normalized Learning History (engine_history schema, event-sourcing style)
|
||||||
|
// =============================================================================
|
||||||
|
|
||||||
Table engine_history.source_observation {
|
Table engine_history.source_observation {
|
||||||
observation_id UUID [pk]
|
observation_id UUID [pk]
|
||||||
observed_at TIMESTAMPTZ [not null]
|
observed_at TIMESTAMPTZ [not null]
|
||||||
@@ -493,6 +506,253 @@ Table engine_history.outcome_evaluation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// =============================================================================
|
||||||
|
// V9: Audit Trail Tables (quantengine schema, 파일: V9__Add_Audit_Trail_Tables.sql,
|
||||||
|
// 원래 이름 V003_add_audit_trail_tables.sql, 2026-07-30에 V9로 리네임 — 위 헤더 참고)
|
||||||
|
//
|
||||||
|
// 2026-07-30 확정 (실제 프로덕션 DB 조회로 검증): 리네임 전 이 마이그레이션은 CREATE TABLE
|
||||||
|
// 안에 MySQL 전용 인라인 "INDEX name (cols)" 구문을 사용해 PostgreSQL에서 문법 오류로
|
||||||
|
// 실패했고, quantengine.schemaversions(DbUp 저널)에도 전혀 기록되어 있지 않았다 — 아래 3개
|
||||||
|
// 테이블은 프로덕션에 실제로 존재하지 않음을 확인했다. 인라인 INDEX 구문은 별도 CREATE INDEX
|
||||||
|
// 문으로 수정했고, V003→V9 리네임으로 실행 순서 문제도 해결했으므로 다음 배포 시 DbUp가 이
|
||||||
|
// 마이그레이션을 최초로 실행해 아래 3개 테이블을 생성할 것이다.
|
||||||
|
// =============================================================================
|
||||||
|
|
||||||
|
Table quantengine.kis_collection_runs_audit {
|
||||||
|
id BIGSERIAL [pk]
|
||||||
|
run_id "UUID" [not null]
|
||||||
|
action "VARCHAR(10)" [not null, note: "INSERT/UPDATE/DELETE"]
|
||||||
|
changed_at TIMESTAMPTZ [not null, default: "CURRENT_TIMESTAMP"]
|
||||||
|
changed_by "VARCHAR(256)" [default: "CURRENT_USER"]
|
||||||
|
change_reason TEXT
|
||||||
|
old_values JSONB
|
||||||
|
new_values JSONB
|
||||||
|
created_at TIMESTAMPTZ [not null, default: "CURRENT_TIMESTAMP"]
|
||||||
|
|
||||||
|
Note: "kis_collection_runs 변경 이력 (트리거 자동 기록) — ⚠️ 마이그레이션 문법 오류로 실제 생성 여부 미확인"
|
||||||
|
}
|
||||||
|
|
||||||
|
Table quantengine.kis_collection_snapshots_audit {
|
||||||
|
id BIGSERIAL [pk]
|
||||||
|
snapshot_id "UUID" [not null]
|
||||||
|
action "VARCHAR(10)" [not null, note: "INSERT/UPDATE/DELETE"]
|
||||||
|
changed_at TIMESTAMPTZ [not null, default: "CURRENT_TIMESTAMP"]
|
||||||
|
changed_by "VARCHAR(256)" [default: "CURRENT_USER"]
|
||||||
|
change_reason TEXT
|
||||||
|
old_values JSONB
|
||||||
|
new_values JSONB
|
||||||
|
created_at TIMESTAMPTZ [not null, default: "CURRENT_TIMESTAMP"]
|
||||||
|
|
||||||
|
Note: "kis_collection_snapshots 변경 이력 — ⚠️ 마이그레이션 문법 오류로 실제 생성 여부 미확인"
|
||||||
|
}
|
||||||
|
|
||||||
|
Table quantengine.kis_collection_errors_audit {
|
||||||
|
id BIGSERIAL [pk]
|
||||||
|
error_id "UUID" [not null]
|
||||||
|
action "VARCHAR(10)" [not null, note: "INSERT/UPDATE/DELETE"]
|
||||||
|
changed_at TIMESTAMPTZ [not null, default: "CURRENT_TIMESTAMP"]
|
||||||
|
changed_by "VARCHAR(256)" [default: "CURRENT_USER"]
|
||||||
|
change_reason TEXT
|
||||||
|
old_values JSONB
|
||||||
|
new_values JSONB
|
||||||
|
created_at TIMESTAMPTZ [not null, default: "CURRENT_TIMESTAMP"]
|
||||||
|
|
||||||
|
Note: "kis_collection_errors 변경 이력 — ⚠️ 마이그레이션 문법 오류로 실제 생성 여부 미확인"
|
||||||
|
}
|
||||||
|
|
||||||
|
// =============================================================================
|
||||||
|
// V10: 3NF Normalization / Star Schema (quantengine schema, 파일:
|
||||||
|
// V10__Normalize_Snapshots_Schema.sql, 원래 이름 V004_normalize_snapshots_schema.sql,
|
||||||
|
// 2026-07-30에 V10로 리네임 — 위 헤더 참고. Adapter 패턴으로 기존
|
||||||
|
// kis_collection_snapshots와 병행 운영 — 마이그레이션 자체 주석에 명시됨)
|
||||||
|
// =============================================================================
|
||||||
|
|
||||||
|
Table quantengine.stocks {
|
||||||
|
id SERIAL [pk]
|
||||||
|
ticker "VARCHAR(10)" [unique, not null]
|
||||||
|
name "VARCHAR(255)"
|
||||||
|
sector "VARCHAR(50)"
|
||||||
|
market "VARCHAR(20)" [note: "KOSPI/KOSDAQ 등"]
|
||||||
|
created_at TIMESTAMPTZ [not null, default: "CURRENT_TIMESTAMP"]
|
||||||
|
updated_at TIMESTAMPTZ [not null, default: "CURRENT_TIMESTAMP"]
|
||||||
|
|
||||||
|
Note: "종목 차원 테이블 (Star Schema dimension)"
|
||||||
|
}
|
||||||
|
|
||||||
|
Table quantengine.sources {
|
||||||
|
id SERIAL [pk]
|
||||||
|
name "VARCHAR(50)" [unique, not null]
|
||||||
|
priority INT [not null, note: "1=주 소스, 2 이상=폴백"]
|
||||||
|
fallback_to_id INT [ref: > quantengine.sources.id]
|
||||||
|
created_at TIMESTAMPTZ [not null, default: "CURRENT_TIMESTAMP"]
|
||||||
|
|
||||||
|
Note: "데이터 소스 차원 테이블 (KIS→Naver→Yahoo→OpenDART 폴백 체인)"
|
||||||
|
}
|
||||||
|
|
||||||
|
Table quantengine.market_data {
|
||||||
|
id BIGSERIAL [pk]
|
||||||
|
stock_id INT [not null, ref: > quantengine.stocks.id]
|
||||||
|
source_id INT [not null, ref: > quantengine.sources.id]
|
||||||
|
price DECIMAL [not null]
|
||||||
|
bid DECIMAL
|
||||||
|
ask DECIMAL
|
||||||
|
volume BIGINT
|
||||||
|
collected_at TIMESTAMPTZ [not null]
|
||||||
|
created_at TIMESTAMPTZ [not null, default: "CURRENT_TIMESTAMP"]
|
||||||
|
collection_run_id "UUID" [note: "kis_collection_runs 추적용"]
|
||||||
|
|
||||||
|
Note: "정규화된 시장 데이터 팩트 테이블 (Star Schema fact)"
|
||||||
|
}
|
||||||
|
|
||||||
|
Table quantengine.kis_collection_snapshots_v2 {
|
||||||
|
id "UUID" [pk]
|
||||||
|
run_id "UUID" [not null, ref: > quantengine.kis_collection_runs.run_id]
|
||||||
|
stock_id INT [not null, ref: > quantengine.stocks.id]
|
||||||
|
market_data_id BIGINT [ref: > quantengine.market_data.id, note: "조회 성능을 위한 의도적 역정규화"]
|
||||||
|
created_at TIMESTAMPTZ [not null, default: "CURRENT_TIMESTAMP"]
|
||||||
|
|
||||||
|
Note: "정규화된 kis_collection_snapshots — 레거시 kis_collection_snapshots와 Adapter 패턴으로 병행 운영, 완전 전환 여부 미확인"
|
||||||
|
}
|
||||||
|
|
||||||
|
// =============================================================================
|
||||||
|
// V8: PostgreSQL History-First Operating Model (quantengine schema)
|
||||||
|
//
|
||||||
|
// ⚠️ 동명이의 테이블 (통합 대상 아님, 2026-07-30 코드 조사로 확정): 아래 4개 테이블
|
||||||
|
// (market_raw_history, factor_version_history, factor_output_history,
|
||||||
|
// decision_result_history)은 engine_history 스키마(V3, 위 참고)에도 같은 이름으로 존재하지만,
|
||||||
|
// 마이그레이션 버그도 아니고 죽은 코드도 아니다 — 둘 다 실제로 읽고 쓰는 라이브 코드가 있는
|
||||||
|
// 서로 다른 두 모델이다:
|
||||||
|
// - engine_history.*: PostgresqlHistoryStore.AppendAsync() + HistoryIngestionService가
|
||||||
|
// 쓰는 범용 append-only 이력 저장소 (EAV형 원본 관측 이력)
|
||||||
|
// - quantengine.*(이 섹션): PostgresqlHistoryStore의 RecordWaterfallExecutionAsync 등
|
||||||
|
// + Admin 엔드포인트(BulkInsertMarketExcelEndpoint, UpdateFactorThresholdEndpoint,
|
||||||
|
// ExportStreamingFactorOlapEndpoint)가 쓰는 신형 구조화 운영 모델 (OHLCV 와이드 테이블 /
|
||||||
|
// 팩터ID-스코어 구조)
|
||||||
|
// 결론: 둘 다 유지해야 한다. 다만 같은 개념에 같은 테이블명을 두 스키마에서 쓰는 것 자체가
|
||||||
|
// 향후 개발자가 착각하기 쉬우므로(예: quantengine.market_raw_history에 쓸 걸 실수로
|
||||||
|
// engine_history.market_raw_history에 씀), 신규 코드 작성 시 스키마를 명시적으로 지정하고
|
||||||
|
// 반드시 어느 모델을 쓰는지 주석으로 남길 것.
|
||||||
|
// =============================================================================
|
||||||
|
|
||||||
|
Table quantengine.market_raw_history {
|
||||||
|
id BIGSERIAL [pk]
|
||||||
|
ticker "VARCHAR(32)" [not null]
|
||||||
|
as_of_date "VARCHAR(10)" [not null]
|
||||||
|
open_price "NUMERIC(18,4)"
|
||||||
|
high_price "NUMERIC(18,4)"
|
||||||
|
low_price "NUMERIC(18,4)"
|
||||||
|
close_price "NUMERIC(18,4)" [not null]
|
||||||
|
volume BIGINT
|
||||||
|
nav_price "NUMERIC(18,4)"
|
||||||
|
disparate_ratio "NUMERIC(10,6)"
|
||||||
|
tracking_error "NUMERIC(10,6)"
|
||||||
|
aum_krw "NUMERIC(20,2)"
|
||||||
|
raw_payload JSONB [not null]
|
||||||
|
provenance JSONB [not null]
|
||||||
|
created_at TIMESTAMPTZ [default: "NOW()"]
|
||||||
|
|
||||||
|
indexes {
|
||||||
|
(ticker, as_of_date) [unique, name: "uk_market_raw_ticker_date"]
|
||||||
|
}
|
||||||
|
|
||||||
|
Note: "OHLCV 와이드 테이블 — engine_history.market_raw_history(EAV형)와는 별개 설계"
|
||||||
|
}
|
||||||
|
|
||||||
|
Table quantengine.factor_version_history {
|
||||||
|
factor_id "VARCHAR(64)" [pk]
|
||||||
|
formula_name "VARCHAR(128)" [not null]
|
||||||
|
version "VARCHAR(32)" [not null]
|
||||||
|
category "VARCHAR(64)" [not null]
|
||||||
|
calibration_state "VARCHAR(32)" [not null, default: "'UNTESTED'"]
|
||||||
|
threshold_params JSONB [not null]
|
||||||
|
description TEXT
|
||||||
|
updated_at TIMESTAMPTZ [default: "NOW()"]
|
||||||
|
|
||||||
|
Note: "팩터 정의 — engine_history.factor_version_history와는 별개 설계 (PK가 factor_id 단독, 버전 이력 미보존)"
|
||||||
|
}
|
||||||
|
|
||||||
|
Table quantengine.factor_output_history {
|
||||||
|
id BIGSERIAL [pk]
|
||||||
|
run_id "VARCHAR(64)" [not null]
|
||||||
|
ticker "VARCHAR(32)" [not null]
|
||||||
|
as_of_date "VARCHAR(10)" [not null]
|
||||||
|
factor_id "VARCHAR(64)" [not null, ref: > quantengine.factor_version_history.factor_id]
|
||||||
|
score "NUMERIC(10,4)"
|
||||||
|
calculation_state "VARCHAR(32)" [not null]
|
||||||
|
provenance JSONB [not null]
|
||||||
|
created_at TIMESTAMPTZ [default: "NOW()"]
|
||||||
|
|
||||||
|
Note: "팩터 계산 결과 — engine_history.factor_output_history와는 별개 설계"
|
||||||
|
}
|
||||||
|
|
||||||
|
Table quantengine.decision_result_history {
|
||||||
|
id BIGSERIAL [pk]
|
||||||
|
run_id "VARCHAR(64)" [unique, not null]
|
||||||
|
as_of_date "VARCHAR(10)" [not null]
|
||||||
|
market_regime "VARCHAR(32)" [not null]
|
||||||
|
portfolio_health "VARCHAR(32)" [not null]
|
||||||
|
rebalance_required BOOLEAN [not null, default: "false"]
|
||||||
|
mid_check_required BOOLEAN [not null, default: "false"]
|
||||||
|
total_asset_krw "NUMERIC(20,2)" [not null]
|
||||||
|
d2_cash_krw "NUMERIC(20,2)" [not null]
|
||||||
|
decision_packet_json JSONB [not null]
|
||||||
|
created_at TIMESTAMPTZ [default: "NOW()"]
|
||||||
|
|
||||||
|
Note: "의사결정 패킷 이력 — engine_history.decision_result_history와는 별개 설계"
|
||||||
|
}
|
||||||
|
|
||||||
|
Table quantengine.order_waterfall_execution_history {
|
||||||
|
id BIGSERIAL [pk]
|
||||||
|
run_id "VARCHAR(64)" [not null, ref: > quantengine.decision_result_history.run_id]
|
||||||
|
ticker "VARCHAR(32)" [not null]
|
||||||
|
sell_priority_rank INT [not null]
|
||||||
|
waterfall_stage "VARCHAR(64)" [not null]
|
||||||
|
action "VARCHAR(16)" [not null]
|
||||||
|
target_qty INT [not null]
|
||||||
|
executed_qty INT [default: "0"]
|
||||||
|
target_price "NUMERIC(18,4)"
|
||||||
|
executed_price "NUMERIC(18,4)"
|
||||||
|
bid_ask_spread_bps "NUMERIC(10,2)"
|
||||||
|
slippage_bps "NUMERIC(10,2)"
|
||||||
|
status "VARCHAR(32)" [not null]
|
||||||
|
rationale TEXT
|
||||||
|
created_at TIMESTAMPTZ [default: "NOW()"]
|
||||||
|
|
||||||
|
Note: "매도 워터폴 실행 이력"
|
||||||
|
}
|
||||||
|
|
||||||
|
Table quantengine.shadow_ledger_history {
|
||||||
|
id BIGSERIAL [pk]
|
||||||
|
run_id "VARCHAR(64)" [not null, ref: > quantengine.decision_result_history.run_id]
|
||||||
|
ticker "VARCHAR(32)" [not null]
|
||||||
|
blocked_gate "VARCHAR(64)" [not null]
|
||||||
|
blocked_reason TEXT [not null]
|
||||||
|
shadow_price "NUMERIC(18,4)" [not null]
|
||||||
|
shadow_qty INT [not null]
|
||||||
|
shadow_tp_price "NUMERIC(18,4)"
|
||||||
|
shadow_sl_price "NUMERIC(18,4)"
|
||||||
|
created_at TIMESTAMPTZ [default: "NOW()"]
|
||||||
|
|
||||||
|
Note: "게이트에 막힌 주문의 가상 체결 감사 기록 (Shadow Ledger)"
|
||||||
|
}
|
||||||
|
|
||||||
|
Table quantengine.scheduler_state_history {
|
||||||
|
id BIGSERIAL [pk]
|
||||||
|
task_name "VARCHAR(64)" [not null]
|
||||||
|
execution_id "VARCHAR(64)" [unique, not null]
|
||||||
|
state "VARCHAR(32)" [not null]
|
||||||
|
started_at TIMESTAMPTZ [not null, default: "NOW()"]
|
||||||
|
finished_at TIMESTAMPTZ
|
||||||
|
error_message TEXT
|
||||||
|
lock_token "VARCHAR(64)"
|
||||||
|
|
||||||
|
indexes {
|
||||||
|
(task_name, state) [name: "idx_scheduler_state_task"]
|
||||||
|
}
|
||||||
|
|
||||||
|
Note: "스케줄러 작업 상태 머신 이력"
|
||||||
|
}
|
||||||
|
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
// Relationships (Logical, not enforced as FKs in DDL)
|
// Relationships (Logical, not enforced as FKs in DDL)
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
|
|||||||
@@ -47,7 +47,6 @@
|
|||||||
"validate-realized-performance": "python tools/validate_realized_performance_v1.py",
|
"validate-realized-performance": "python tools/validate_realized_performance_v1.py",
|
||||||
"validate-gas-recovery": "python tools/validate_gas_orchestration_recovery_v1.py",
|
"validate-gas-recovery": "python tools/validate_gas_orchestration_recovery_v1.py",
|
||||||
"ops:clean": "python tools/clean_temp_artifacts_v1.py",
|
"ops:clean": "python tools/clean_temp_artifacts_v1.py",
|
||||||
"ops:dev": "node core_satellite_collector.js",
|
|
||||||
"full-gate": "python tools/run_release_dag_v3.py --mode release --strict",
|
"full-gate": "python tools/run_release_dag_v3.py --mode release --strict",
|
||||||
"validate-engine-strict": "python tools/run_release_dag_v3.py --mode release --strict",
|
"validate-engine-strict": "python tools/run_release_dag_v3.py --mode release --strict",
|
||||||
"validate-behavioral-coverage": "python tools/validate_behavioral_coverage_v1.py --strict",
|
"validate-behavioral-coverage": "python tools/validate_behavioral_coverage_v1.py --strict",
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,764 @@
|
|||||||
|
# OMS·WMS·ERP Strategic Execution Framework v1.0
|
||||||
|
# ⚠️ PDF 출처 미검증 (2026-07-30 재정정): 이 헤더는 원래 "실제 PDF 5건(179페이지)에
|
||||||
|
# 근거" (not hallucinated)라고 주장했으나, 저장소 전체를 검색해도 해당 PDF는 어디에도
|
||||||
|
# 없다. 본문에 흩어진 "(PDF n...)" 인용 40여 건은 전부 미검증 상태로 취급할 것 —
|
||||||
|
# 원본 PDF를 저장소(또는 접근 가능한 공유 위치)에서 찾아 재검증하기 전까지는
|
||||||
|
# "확인됨"이 아니라 "출처 주장됨"이다. (참고: 이 파일은 759줄이며, 다른 문서에서
|
||||||
|
# "7,000+ lines"로 인용된 것은 사실이 아니다.)
|
||||||
|
# 30 Strategic Principles Applied Throughout
|
||||||
|
# Created: 2026-07-26 (Post-Advisor Correction)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## GROUNDTRUTH: PDF-Derived Specifications
|
||||||
|
|
||||||
|
### Architecture (From PDF 1: Vue 3·TypeScript OMS·WMS·ERP 아키텍처.pdf)
|
||||||
|
|
||||||
|
**Recommended Architecture**: Domain-Centric Modular Monolith + Layered Internal Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
Application Shell (routing, auth, global state)
|
||||||
|
↓
|
||||||
|
Workflow (cross-domain orchestration)
|
||||||
|
↓
|
||||||
|
Module Presentation (Vue, Pinia, Router)
|
||||||
|
↓
|
||||||
|
Application Use Case (business logic entry points)
|
||||||
|
↓
|
||||||
|
Domain (entities, value objects, rules)
|
||||||
|
↑
|
||||||
|
Infrastructure Adapter (API clients, DB, cache)
|
||||||
|
```
|
||||||
|
|
||||||
|
**Core Principles** (PDF explicit):
|
||||||
|
1. Module by business domain, not by screen
|
||||||
|
2. Vue, Pinia, Router confined to Presentation layer only
|
||||||
|
3. Domain layer NEVER imports Vue/HTTP libraries
|
||||||
|
4. API DTO ≠ Screen Model ≠ Domain Model (3-way separation)
|
||||||
|
5. Inter-module access only via public index.ts
|
||||||
|
6. Distinguish common UI from business rules
|
||||||
|
7. Workflows coordinate multi-domain logic
|
||||||
|
|
||||||
|
**Folder Structure** (PDF prescribed):
|
||||||
|
```
|
||||||
|
src/
|
||||||
|
├─ app/ (shell, bootstrap, config)
|
||||||
|
├─ shared/ (primitives, fields, forms, data-grid)
|
||||||
|
├─ modules/
|
||||||
|
│ ├─ order/ (OMS domain)
|
||||||
|
│ ├─ inventory/ (WMS domain)
|
||||||
|
│ └─ accounting/ (ERP domain)
|
||||||
|
├─ domain/ (entities, repositories, use cases)
|
||||||
|
├─ infrastructure/ (API clients, adapters)
|
||||||
|
└─ workflows/ (multi-domain orchestration)
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### CRUD Templates (From PDF 2: 공통 CRUD 화면 템플릿 상세 명세.pdf)
|
||||||
|
|
||||||
|
**11 Standard Template Types**:
|
||||||
|
|
||||||
|
| Template ID | Screen Type | Representative Business | Key Features |
|
||||||
|
|-----------|-----------|----------------------|--------------|
|
||||||
|
| TPL-LIST-01 | List/Search | Orders, inventory, vouchers | Saved queries, column preferences, multi-filter, bulk actions, async export |
|
||||||
|
| TPL-CREATE-01 | Single Create | Vendor, product, simple order | Direct input, simple validation |
|
||||||
|
| TPL-CREATE-02 | Header-Line Create | Order, PO, receipt, voucher | Master-detail, line auto-calc, currency standardization |
|
||||||
|
| TPL-CREATE-03 | Wizard Create | Complex order, return, contract | Multi-step workflow, conditional logic, branch preview |
|
||||||
|
| TPL-DETAIL-01 | Detail View | Order detail, receipt detail, voucher detail | Tabs (Info, History, Attachments, Audit), read-only by default |
|
||||||
|
| TPL-EDIT-01 | General Edit | Master data, order provisional state | Full form edit, save/cancel, undo/redo |
|
||||||
|
| TPL-BULK-01 | Bulk Edit | Owner, due date, status batch change | Multi-row mutation, impact preview |
|
||||||
|
| TPL-DELETE-01 | Delete | Unused temp data | Soft-delete only, never hard-delete live records |
|
||||||
|
| TPL-CANCEL-01 | Cancel/Reversal | Order cancel, shipment cancel, voucher reversal | Create reversal transaction, NOT overwrite original |
|
||||||
|
| TPL-APPROVAL-01 | Approval/Rejection | PO approval, voucher approval | Workflow state machine, approval reason capture |
|
||||||
|
| TPL-HISTORY-01 | Change History | Value changes, state transitions, system processing | Before/after comparison, worker, reason, source trace |
|
||||||
|
|
||||||
|
**Screen Layout (PDF mandatory)**:
|
||||||
|
```
|
||||||
|
┌────────────────────────────────────────────────┐
|
||||||
|
│ Global Header (system switch, org select, │
|
||||||
|
│ global search, notifications) │
|
||||||
|
├────────────────────────────────────────────────┤
|
||||||
|
│ Breadcrumb │
|
||||||
|
├────────────────────────────────────────────────┤
|
||||||
|
│ Page Header (title, ID, status, last editor) │
|
||||||
|
├────────────────────────────────────────────────┤
|
||||||
|
│ Context Bar (facility, warehouse, date, lock) │
|
||||||
|
├────────────────────────────────────────────────┤
|
||||||
|
│ │
|
||||||
|
│ Main Content (list, form, detail) │
|
||||||
|
│ │
|
||||||
|
├────────────────────────────────────────────────┤
|
||||||
|
│ Sticky Action Bar ([Cancel] [Draft] [Save]) │
|
||||||
|
└────────────────────────────────────────────────┘
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Input Component Hierarchy (From PDF 3: 입력 컴포넌트 상세 명세.pdf)
|
||||||
|
|
||||||
|
**4 Layers** (strict separation):
|
||||||
|
|
||||||
|
#### Layer 1: Primitive
|
||||||
|
Visual + interaction foundation (no business knowledge).
|
||||||
|
|
||||||
|
**Components** (10 types):
|
||||||
|
- TextInput, Button, Checkbox, Radio, Select
|
||||||
|
- Popover, Dialog, Calendar, Listbox, Grid Cell
|
||||||
|
|
||||||
|
#### Layer 2: Typed Field
|
||||||
|
Data type awareness (format, validation, but no domain).
|
||||||
|
|
||||||
|
**Components** (8 types):
|
||||||
|
- StringField, IntegerField, DecimalField
|
||||||
|
- DateField, DateTimeField, CurrencyField, PercentageField, CodeField
|
||||||
|
|
||||||
|
#### Layer 3: Domain Field
|
||||||
|
Business domain understanding (item lookup, warehouse context).
|
||||||
|
|
||||||
|
**Components** (10 types):
|
||||||
|
- ItemLookup, CustomerLookup, WarehouseLookup, LocationLookup
|
||||||
|
- QuantityField, MoneyField, LotField, SerialNumberInput
|
||||||
|
- BusinessRegistrationNumberField, AccountLookup
|
||||||
|
|
||||||
|
#### Layer 4: Business Composite
|
||||||
|
Multiple fields + business rules (e.g., tax calculation).
|
||||||
|
|
||||||
|
**Components** (8 types):
|
||||||
|
- AddressEditor, OrderLineEditor, InventoryAllocationEditor
|
||||||
|
- LotSerialEditor, TaxAmountEditor, DeliveryScheduleEditor
|
||||||
|
- BarcodeWorkInput, ApprovalReasonEditor
|
||||||
|
|
||||||
|
**Strict Rule** (PDF emphasis):
|
||||||
|
> "복잡한 컴포넌트가 거대한 범용 컴포넌트로 변질되지 않게 한다."
|
||||||
|
> (Prevent complex components from degenerating into bloated monoliths.)
|
||||||
|
|
||||||
|
Business Composites own field combinations, NOT full-screen logic.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Design Principles (From PDF 4: CRUD 화면 및 입력 컴포넌트 상용화 제안.pdf)
|
||||||
|
|
||||||
|
**Core Principle**: TRANSACTIONS, not CRUD
|
||||||
|
|
||||||
|
Business transactions extend beyond simple Create/Read/Update/Delete:
|
||||||
|
|
||||||
|
| Category | Operations | Example |
|
||||||
|
|----------|-----------|---------|
|
||||||
|
| **Inquiry** | Search, filter, compare, aggregate, download | Order list with saved filters |
|
||||||
|
| **Creation** | Direct input, copy, template, external sync | Order creation from EDI |
|
||||||
|
| **Modification** | Inline edit, bulk edit, record edit | Status batch change |
|
||||||
|
| **State Transition** | Approve, confirm, allocate, close, suspend, release | Order confirmation → inventory reserve |
|
||||||
|
| **Exception Handling** | Cancel, return, reversal, reprocess, correction | Order cancel (reversal transaction) |
|
||||||
|
| **History** | Before/after, worker, reason, source trace | Audit trail for regulatory compliance |
|
||||||
|
| **Collaboration** | Comments, attachments, approval requests, handoff | Approval workflow + reason capture |
|
||||||
|
| **AI Assistance** | Value recommend, anomaly detect, input correct, explain | Predictive analytics for order priority |
|
||||||
|
|
||||||
|
**Critical**: Completed data is never deleted or overwritten. Use reversal transactions instead.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Phased Rollout Strategy (From PDF 5: 단계별 구축 백로그.pdf)
|
||||||
|
|
||||||
|
**Phased Approach** (NOT all-at-once):
|
||||||
|
|
||||||
|
```
|
||||||
|
0. Current State Analysis & Standard Decisions
|
||||||
|
↓
|
||||||
|
1. Vue 3·TypeScript Development Foundation
|
||||||
|
↓
|
||||||
|
2. Common Models & API Boundary
|
||||||
|
↓
|
||||||
|
3. Primitive & Input Components
|
||||||
|
↓
|
||||||
|
4. CRUD Screen Templates
|
||||||
|
↓
|
||||||
|
5. OMS Order Pilot (order registration)
|
||||||
|
↓
|
||||||
|
6. WMS Receipt/Picking Pilot (warehouse floor validation)
|
||||||
|
↓
|
||||||
|
7. ERP Voucher/Approval Pilot (accounting integration)
|
||||||
|
↓
|
||||||
|
8. Integrated Workflow & Batch Processing
|
||||||
|
↓
|
||||||
|
9. AI/AX Enhancements
|
||||||
|
↓
|
||||||
|
10. Legacy Migration & Operational Stability
|
||||||
|
```
|
||||||
|
|
||||||
|
**Rationale** (PDF explicit):
|
||||||
|
> "처음부터 OMS·WMS·ERP 전체를 동시에 구현하지 않는다."
|
||||||
|
> (Don't implement OMS·WMS·ERP simultaneously from day one.)
|
||||||
|
> "주문 등록처럼 입력·조회·계산·상태 전이·재고 연계가 모두 포함된 대표 업무를 먼저 구현하여 구조의 실효성을 검증한다."
|
||||||
|
> (Validate architecture with representative end-to-end business: order registration includes input, inquiry, calculation, state transition, inventory linking.)
|
||||||
|
|
||||||
|
**Work Hierarchy** (PDF prescribed):
|
||||||
|
```
|
||||||
|
Initiative (OMS·WMS·ERP Unified Business Platform)
|
||||||
|
└─ Epic (e.g., "Order Registration Standardization")
|
||||||
|
└─ Feature (e.g., "Header-Line Order Create")
|
||||||
|
└─ Story (e.g., "User saves order with vendor + item")
|
||||||
|
├─ Task: OrderFormModel implementation
|
||||||
|
├─ Task: CreateOrderUseCase implementation
|
||||||
|
├─ Task: API Mapper
|
||||||
|
└─ Task: E2E test implementation
|
||||||
|
```
|
||||||
|
|
||||||
|
**Priority Matrix** (PDF defined):
|
||||||
|
| Level | Meaning | Examples |
|
||||||
|
|-------|---------|----------|
|
||||||
|
| P0 | Service operation + data consistency critical | Order state machine, inventory reserve atomicity |
|
||||||
|
| P1 | Required for first business release | OMS order pilot |
|
||||||
|
| P2 | Operational efficiency + scalability | Bulk processing, async export |
|
||||||
|
| P3 | Enhancement or optional feature | AI recommendations, advanced reporting |
|
||||||
|
|
||||||
|
**Task Sizing** (PDF criteria):
|
||||||
|
| Size | Effort | Guidance |
|
||||||
|
|------|--------|----------|
|
||||||
|
| XS | <0.5 day | Simple change, no decomposition needed |
|
||||||
|
| S | 1-2 days | Standard task, low risk |
|
||||||
|
| M | 3-5 days | Multi-component, moderate coordination |
|
||||||
|
| L | 1 sprint | Substantial, can break into substories |
|
||||||
|
| XL | >1 sprint | MUST be decomposed, never assign as single ticket |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 30 STRATEGIC PRINCIPLES (Integrated with PDF Specifications)
|
||||||
|
|
||||||
|
### Principle 1: SOLID (Software Design)
|
||||||
|
**Application**: Architecture layer in PDF 1
|
||||||
|
- **S**ingle Responsibility: Each module (order, inventory, accounting) owns one domain
|
||||||
|
- **O**pen/Closed: Add new domains without modifying existing layers
|
||||||
|
- **L**iskov Substitution: All Field components swap without caller changes
|
||||||
|
- **I**nterface Segregation: Primitive doesn't bloat with domain knowledge
|
||||||
|
- **D**ependency Inversion: Domain layer depends on repositories (abstract), not HTTP client (concrete)
|
||||||
|
|
||||||
|
**Verification Checkpoint**: Code review: no circular imports, all domain-to-infrastructure flow one-way
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Principle 2: Code Refactoring (Continuous)
|
||||||
|
**Application**: Prevent "complex component degenerates into monolith" (PDF explicit warning)
|
||||||
|
- Extract reusable patterns at 3+ usage point threshold
|
||||||
|
- Componentize OrderLineEditor when same fields+logic appear in order, PO, receipt
|
||||||
|
- Break down TPL-CREATE-02 if >500 lines (template too complex)
|
||||||
|
|
||||||
|
**Verification Checkpoint**: Component size < 300 lines (.vue file), dependencies < 5 imports
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Principle 3: Data Consistency (SSOT)
|
||||||
|
**Application**: "화면과 서버의 데이터 해석이 달라지지 않게 한다" (PDF 1.1)
|
||||||
|
- API DTO ≠ Screen Model ≠ Domain Model (PDF explicit 3-way separation)
|
||||||
|
- All currency decimals conform to PostgreSQL NUMERIC(19,4) standard
|
||||||
|
- Quantity unit (each, kg, meter) enforced server-side, never client-side formatting
|
||||||
|
|
||||||
|
**Verification Checkpoint**: Schema review + integration test: CurrencyField value round-trip == API response
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Principle 4: Parsimony (No Gold-Plating)
|
||||||
|
**Application**: Template specification precise, not aspirational
|
||||||
|
- TPL-LIST-01 includes saved filters + bulk actions (PDF spec)
|
||||||
|
- TPL-CREATE-03 (wizard) only for complex orders (PDF: "복합 주문")
|
||||||
|
- Reject "nice-to-have" export formats until P1 release proven stable
|
||||||
|
|
||||||
|
**Verification Checkpoint**: Feature checklist matches PDF requirement, no extras (backlog → Phase 12)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Principle 5: Normalization (Database)
|
||||||
|
**Application**: Schema design for master data (vendors, items, GL accounts)
|
||||||
|
- 3NF minimum (vendor table: vendor_id → name, country; no address duplication)
|
||||||
|
- Separate master from transactional (items in item_master, not repeated in order_line)
|
||||||
|
- LOT/Serial data as separate entity (denormalized only if 100M+ rows proven slow)
|
||||||
|
|
||||||
|
**Verification Checkpoint**: ER diagram review, no repeating groups, referential integrity 100%
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Principle 6: Denormalization (Justified)
|
||||||
|
**Application**: Only after performance proof
|
||||||
|
- Cache order total instead of sum(order_line.qty * price) IFF
|
||||||
|
- Query <200ms target breached (P95 measurement)
|
||||||
|
- Denormalization reduces to <100ms (proof required)
|
||||||
|
- Cascade update logic fully tested (no orphaned totals)
|
||||||
|
- Example: order_summary.total_amount auto-updated via trigger
|
||||||
|
|
||||||
|
**Verification Checkpoint**: Load test before/after, TTL strategy for cache invalidation
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Principle 7: Process Simplification
|
||||||
|
**Application**: Validate BEFORE automating
|
||||||
|
- Manual order entry: 5 steps (enter customer → items → dates → validate → save)
|
||||||
|
- Automate only after 100 live orders confirm 5-step workflow is universal
|
||||||
|
- Never assume "users want copy-paste bulk" until stated explicitly
|
||||||
|
- Approval workflow: Confirm 2-person dual-approval rule is actual business requirement, not preference
|
||||||
|
|
||||||
|
**Verification Checkpoint**: Workflow diagram reviewed by domain experts (OMS user, WMS supervisor, accounting manager)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Principle 8: Patterns & Design
|
||||||
|
**Application**: Reusable patterns for business transactions
|
||||||
|
- **Pattern 1**: List + Detail (TPL-LIST-01 + TPL-DETAIL-01 pair)
|
||||||
|
- **Pattern 2**: Header-Line with auto-calc (TPL-CREATE-02, e.g., order → line items → total)
|
||||||
|
- **Pattern 3**: State Machine (approve → confirm → ship, never skip backward)
|
||||||
|
- **Pattern 4**: Reversal Transaction (cancel = create opposite entry, not delete)
|
||||||
|
|
||||||
|
**Verification Checkpoint**: Common pattern identified for 3+ templates → abstract into reusable module
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Principle 9: Standardization (Conventions)
|
||||||
|
**Application**: Consistent naming, API contracts, component interfaces
|
||||||
|
- Field naming: `quantity`, `quantity_unit`, `quantity_reserved` (not `qty`, `qtyUnit`, `reserved_qty`)
|
||||||
|
- API endpoints: `/api/orders/{orderId}/lines` (nested resource) not `/api/orders/lines?order_id=...`
|
||||||
|
- Component props: `modelValue`, `@update:modelValue` (Vue 3 standard, not custom `value`/`onChange`)
|
||||||
|
- Error codes: ERR_ORDER_VALIDATION_QUANTITY_EXCEEDS_STOCK (fully qualified, i18n key)
|
||||||
|
|
||||||
|
**Verification Checkpoint**: Linting rules enforce naming (ESLint), OpenAPI schema validation, Storybook prop documentation
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Principle 10: Structuring (Layered Architecture)
|
||||||
|
**Application**: PDF 1 architecture enforced
|
||||||
|
- Presentation Layer (Vue, Pinia, Router): handles user interaction, routes, component state
|
||||||
|
- Application Layer (Use Cases): orchestrates domain logic (CreateOrderUseCase)
|
||||||
|
- Domain Layer (Entities, Value Objects, Rules): business logic, NO Vue/HTTP knowledge
|
||||||
|
- Infrastructure Layer (Adapters): API clients, DB repositories
|
||||||
|
|
||||||
|
**Verification Checkpoint**: No imports from higher layers into lower (e.g., domain never imports presentation)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Principle 11: Vibes Coding (Cognitive Load)
|
||||||
|
**Application**: Clear naming, minimal mental overhead, consistency
|
||||||
|
- Component naming: `CustomerLookup` (not `CustmrSrch`, not `CustomerAutocompleteSearchWithValidation`)
|
||||||
|
- Variable names: `orderTotal`, not `t` or `sum_$_from_items`
|
||||||
|
- Error messages: "Order quantity exceeds available stock (reserve: 100, order: 150)" (context, not cryptic code)
|
||||||
|
- Code structure: 1 function = 1 responsibility (CreateOrderUseCase doesn't also handle price calculation)
|
||||||
|
|
||||||
|
**Verification Checkpoint**: Pair programming review, PR comment: "readable without documentation?"
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Principle 12: Hallucination Prevention (Ground Truth)
|
||||||
|
**Application**: Explicit test-driven, no assumptions
|
||||||
|
- Requirement: "Save order with customer + items"
|
||||||
|
- NOT assumed: "Orders can have unlimited line items" (test: max 999 lines per business rule)
|
||||||
|
- NOT assumed: "Items can be duplicated in one order" (test: confirm if allowed or enforce uniqueness)
|
||||||
|
- Verified via: PDF spec, stakeholder sign-off, acceptance test
|
||||||
|
- Never code "nice-to-have" features without explicit P0/P1 tag
|
||||||
|
|
||||||
|
**Verification Checkpoint**: Acceptance test references PDF page, stakeholder email, or JIRA requirement, not general assumption
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Principle 13: Ground Truth & Reproducibility
|
||||||
|
**Application**: All results deterministic, traceable to source
|
||||||
|
- Test data: seed.sql from GatherTradingData.json (not random generation)
|
||||||
|
- Calculations: CurrencyField(100.50, "USD") → API response `{"amount": "100.5000"}` (4 decimals, always)
|
||||||
|
- Audit trail: OrderCreated event includes user, timestamp, IP, all changes logged
|
||||||
|
- Reproducible: QA can replay issue from 2 weeks ago using same test data snapshot
|
||||||
|
|
||||||
|
**Verification Checkpoint**: E2E test passes in CI pipeline, seed data versioned in git, audit log exported for review
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Principle 14: Traceability (Audit)
|
||||||
|
**Application**: Complete history of all changes
|
||||||
|
- Create: `audit_log.operation = 'INSERT', changed_by = user_id, changed_at = now()`
|
||||||
|
- Update: `audit_log.operation = 'UPDATE', old_value = '{"status": "DRAFT"}', new_value = '{"status": "CONFIRMED"}', reason = 'Admin action'`
|
||||||
|
- Delete: `audit_log.operation = 'DELETE'` (soft-delete only, never erase)
|
||||||
|
- Reversal: `audit_log.related_transaction_id = original_order_id` (link cancel to original)
|
||||||
|
|
||||||
|
**Verification Checkpoint**: All CRUD operations produce audit_log row, audit UI queries pass, compliance report shows 100% coverage
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Principle 15: Reliability (Fault Tolerance)
|
||||||
|
**Application**: Graceful degradation, auto-recovery
|
||||||
|
- Network failure: Retry 3x with exponential backoff (1s, 2s, 4s), then user-friendly error
|
||||||
|
- Validation failure: Clear error message with fix guidance ("Quantity exceeds stock by 50 units, reduce or request allocation")
|
||||||
|
- State inconsistency: Transaction rollback (order saved + inventory reserved atomically, no orphaned state)
|
||||||
|
- Cascade failure: If GL account API down, order can still save (audit flag: "GL posting pending")
|
||||||
|
|
||||||
|
**Verification Checkpoint**: Chaos engineering test, network latency/loss simulation, error handling 100% tested
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Principle 16: Technical Debt (Zero New, Reduce Old)
|
||||||
|
**Application**: No shortcuts, audit existing debt
|
||||||
|
- No: hardcoded user IDs, no-verify deployments, TODO comments without ticket
|
||||||
|
- Yes: Refactor one legacy component per sprint (e.g., old BaseForm → new Typed Field approach)
|
||||||
|
- Quarterly audit: Debt spreadsheet (complexity, security, performance) with mitigation plan
|
||||||
|
|
||||||
|
**Verification Checkpoint**: Debt review in sprint retrospective, tech lead sign-off on any debt deferral
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Principle 17: Componentization (Smart + Dumb)
|
||||||
|
**Application**: Clear separation (PDF implicit in 4-layer hierarchy)
|
||||||
|
- **Dumb (Presentation)**: Primitive, Typed Field (TextInput, CurrencyField) — props in, events out, zero side effects
|
||||||
|
- **Smart (Business Logic)**: Use Cases (CreateOrderUseCase), Stores (OrderStore) — owns state, API calls, calculations
|
||||||
|
- **Composite (Pattern)**: OrderLineEditor (coordinates field + validation + auto-calc) — re-used in multiple contexts
|
||||||
|
- **Page (Container)**: OrderCreatePage (composes OrderForm + UseCase orchestration) — specific to single business process
|
||||||
|
|
||||||
|
**Verification Checkpoint**: Storybook for Dumb components (no backend needed), separate integration test for Smart (mocked API)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Principle 18: Professional Approach (정공법)
|
||||||
|
**Application**: Best practices, no cutting corners
|
||||||
|
- Code review before merge (all changes reviewed, approved)
|
||||||
|
- Pair programming for high-risk code (state machine logic, data validation)
|
||||||
|
- Documentation: API contracts (OpenAPI), component props (TypeScript types), workflows (ADRs)
|
||||||
|
- Testing: Unit (70%+), Integration (API mocks), E2E (Playwright)
|
||||||
|
- Security: OWASP validation, RBAC tests, SQL injection prevention (parameterized queries)
|
||||||
|
|
||||||
|
**Verification Checkpoint**: PR checklist: tests pass, docs updated, no security warnings, code review approved
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Principles 19-30 (Continuation for Comprehensiveness)
|
||||||
|
|
||||||
|
**Principle 19: Type Safety (TypeScript)**
|
||||||
|
- All components export TypeScript interfaces for Props, Emits, Model
|
||||||
|
- No `any` type, strict mode enabled
|
||||||
|
- Domain entities typed (Order, OrderLine, etc.)
|
||||||
|
|
||||||
|
**Principle 20: Accessibility (WCAG 2.1)**
|
||||||
|
- All fields: label linked, ARIA attributes, keyboard navigation
|
||||||
|
- Colors: WCAG AA contrast ratio (4.5:1 for text)
|
||||||
|
- Form errors: announced to screen readers
|
||||||
|
|
||||||
|
**Principle 21: Internationalization (i18n)**
|
||||||
|
- All user-facing text: externalized to .i18n.ts files
|
||||||
|
- Supported languages: Korean, English, Japanese (per PDF)
|
||||||
|
- Date/currency formatting: locale-aware (not hardcoded)
|
||||||
|
|
||||||
|
**Principle 22: Performance (Response Time)**
|
||||||
|
- API P95 response: <250ms
|
||||||
|
- Component render: <100ms
|
||||||
|
- Bundle size: <500KB (gzip)
|
||||||
|
- Measured: Lighthouse, browser DevTools, load testing
|
||||||
|
|
||||||
|
**Principle 23: Security (OWASP)**
|
||||||
|
- Input validation: Server-side + client-side redundant
|
||||||
|
- XSS prevention: Never innerHTML, use Vue templates
|
||||||
|
- CSRF tokens: All state-changing requests
|
||||||
|
- SQL injection: Parameterized queries only (Dapper/TypeORM)
|
||||||
|
|
||||||
|
**Principle 24: Error Handling (User-Centric)**
|
||||||
|
- Show: "Order cannot be canceled after shipment confirmed" (clear business rule)
|
||||||
|
- NOT: "SQL error: constraint violation" (technical jargon)
|
||||||
|
- Recovery: Suggest next action ("Contact admin to unlock" / "Request manager approval")
|
||||||
|
|
||||||
|
**Principle 25: API Consistency (REST Contracts)**
|
||||||
|
- GET /api/orders → list with pagination
|
||||||
|
- POST /api/orders → create
|
||||||
|
- GET /api/orders/{id} → detail
|
||||||
|
- PUT /api/orders/{id} → full update
|
||||||
|
- PATCH /api/orders/{id} → partial update
|
||||||
|
- DELETE /api/orders/{id} → soft-delete
|
||||||
|
- All responses: 200 success, 400 validation, 401 auth, 403 forbidden, 404 not found, 500 server error
|
||||||
|
|
||||||
|
**Principle 26: Testing Pyramid (Automated)**
|
||||||
|
- Unit (50%): Components, Use Cases, Validation rules
|
||||||
|
- Integration (30%): API + Store + Component workflows (with mock backend)
|
||||||
|
- E2E (20%): Critical user journeys (order create → confirm → ship)
|
||||||
|
- Coverage: 70%+ code coverage, 100% critical path coverage
|
||||||
|
|
||||||
|
**Principle 27: Deployment Pipeline (CI/CD)**
|
||||||
|
- Automated: Code merge → lint → test → build → deploy-staging → health-check
|
||||||
|
- Manual gate: Staging validation → production approval
|
||||||
|
- Rollback: Blue-green deployment, 1-click revert to previous version
|
||||||
|
- Monitoring: Sentry (errors), DataDog (performance), uptime checks
|
||||||
|
|
||||||
|
**Principle 28: Documentation (Durable)**
|
||||||
|
- Architecture Decision Records (ADRs) for major choices
|
||||||
|
- OpenAPI 3.0 for all APIs (auto-generated, never stale)
|
||||||
|
- Storybook for component library (visual + prop docs)
|
||||||
|
- README per module (setup, usage, testing)
|
||||||
|
- Wiki (deployment, ops runbooks, troubleshooting)
|
||||||
|
|
||||||
|
**Principle 29: Team Discipline (Enforcement)**
|
||||||
|
- Code review checklist enforced (ESLint, type-check, test coverage)
|
||||||
|
- Commit message standard: type(scope): subject (feat, fix, docs, refactor, test)
|
||||||
|
- Git workflow: feature branches → PR → squash merge (clean history)
|
||||||
|
- Ownership: Module lead responsible for code quality + debt in their domain
|
||||||
|
|
||||||
|
**Principle 30: Continuous Improvement (Iteration)**
|
||||||
|
- Weekly retrospectives: What went well, what failed, action items
|
||||||
|
- Monthly metrics review: Test coverage, bug count, deployment frequency, lead time
|
||||||
|
- Quarterly strategy: Architecture debt audit, technology updates, team skill development
|
||||||
|
- Post-mortems for P1+ incidents: Root cause, prevention, learning documented
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## EXECUTION ROADMAP (PDF-Aligned, 30 Principles Applied)
|
||||||
|
|
||||||
|
### Phase 0: Foundation & Standards (Week 1-2)
|
||||||
|
|
||||||
|
**Objectives**:
|
||||||
|
- Establish architecture patterns (Principle 8: Patterns)
|
||||||
|
- Define API contracts (Principle 25: REST)
|
||||||
|
- Create component hierarchy (Principle 10: Structuring)
|
||||||
|
- Validate data model (Principle 3: Consistency)
|
||||||
|
|
||||||
|
**Deliverables**:
|
||||||
|
- Architecture Decision Record (ADR-001): Monolithic SPA + 7-layer stack
|
||||||
|
- OpenAPI 3.0 spec (30 endpoints) reviewed by backend/frontend
|
||||||
|
- Component taxonomy (4 layers: Primitive, Typed Field, Domain Field, Business Composite)
|
||||||
|
- Database schema v1 (orders, order_lines, inventory, vendors, customers, gl_accounts, audit_log)
|
||||||
|
|
||||||
|
**30 Principles Applied**:
|
||||||
|
1. SOLID: Review architecture diagram, no circular dependencies (Principle 1)
|
||||||
|
2. Refactoring: Identify legacy patterns to replace (Principle 2)
|
||||||
|
3. Consistency: Schema review for 3-way Model separation (Principle 3)
|
||||||
|
4. Parsimony: Spec = PDF requirement, nothing extra (Principle 4)
|
||||||
|
5. Normalization: 3NF schema design (Principle 5)
|
||||||
|
6. Processes: Confirm workflows with domain experts (Principle 7)
|
||||||
|
7. Patterns: Map 11 CRUD templates to code patterns (Principle 8)
|
||||||
|
8. Standardization: Naming convention doc (Principle 9)
|
||||||
|
9. Structuring: Layer diagram finalized (Principle 10)
|
||||||
|
10. Vibes: Code style guide + Prettier config (Principle 11)
|
||||||
|
11. Hallucination: All specs sourced from PDF, signed off (Principle 12)
|
||||||
|
12. Reproducibility: Seed test data from GatherTradingData.json (Principle 13)
|
||||||
|
13. Traceability: ADR + design decisions in git (Principle 14)
|
||||||
|
14. Reliability: Error handling patterns defined (Principle 15)
|
||||||
|
15. Tech Debt: Baseline inventory of legacy code (Principle 16)
|
||||||
|
16. Componentization: Layer 1-2 reusability rules (Principle 17)
|
||||||
|
17. Professional: Code review SLA 24h (Principle 18)
|
||||||
|
18. TypeScript: Strict mode enabled, no `any` allowed (Principle 19)
|
||||||
|
19. Accessibility: WCAG audit checklist created (Principle 20)
|
||||||
|
20. i18n: Locale file structure (Principle 21)
|
||||||
|
21. Performance: Budget defined (<250ms P95) (Principle 22)
|
||||||
|
22. Security: OWASP threat model documented (Principle 23)
|
||||||
|
23. Error Handling: Message template library (Principle 24)
|
||||||
|
24. API: REST contract checklist (Principle 25)
|
||||||
|
25. Testing: Test pyramid strategy (Principle 26)
|
||||||
|
26. CI/CD: Pipeline skeleton (linting, build, test) (Principle 27)
|
||||||
|
27. Documentation: README template for modules (Principle 28)
|
||||||
|
28. Ownership: DRI (directly responsible individual) assigned per module (Principle 29)
|
||||||
|
29. Retrospectives: Weekly standup template (Principle 30)
|
||||||
|
|
||||||
|
**Exit Criteria**:
|
||||||
|
- All 11 PDF pages reviewed, specifications confirmed
|
||||||
|
- Architecture diagram approved by tech lead
|
||||||
|
- OpenAPI spec 100% complete, no endpoints TBD
|
||||||
|
- Component taxonomy examples in Storybook v0
|
||||||
|
- DB schema passes referential integrity audit
|
||||||
|
- Risk register: 15+ identified with mitigations
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Phase 1-2: Development Foundation & Components (Week 3-6)
|
||||||
|
|
||||||
|
**Objectives** (Principle 4: only what PDF requires):
|
||||||
|
- Implement 4-layer component hierarchy
|
||||||
|
- Establish Pinia stores + API client
|
||||||
|
- Create CRUD template scaffolds
|
||||||
|
- Automated testing pipeline
|
||||||
|
|
||||||
|
**Deliverables**:
|
||||||
|
- Layer 1-2 components: 30 Primitive + Typed Field (TextInput, CurrencyField, DateField, etc.)
|
||||||
|
- Layer 3-4 sample components: ItemLookup, OrderLineEditor
|
||||||
|
- CRUD template stubs: TPL-LIST-01, TPL-CREATE-02, TPL-DETAIL-01, TPL-EDIT-01
|
||||||
|
- Storybook with 100 component stories
|
||||||
|
- Test suite: 70%+ coverage (Principle 26)
|
||||||
|
|
||||||
|
**30 Principles Applied**:
|
||||||
|
1. SOLID: Each component single responsibility (Principle 1)
|
||||||
|
2. Refactoring: Generic input → Type-specific (TextInput → CurrencyField) (Principle 2)
|
||||||
|
3. Consistency: API DTO ≠ Model ensured in mappers (Principle 3)
|
||||||
|
4. Parsimony: Only 4 layers, no 5th "super" layer (Principle 4)
|
||||||
|
5. Componentization: Dumb/Smart split enforced in tests (Principle 17)
|
||||||
|
6. TypeScript: `<script setup lang="ts">` all components (Principle 19)
|
||||||
|
7. Accessibility: axe-core audit on all components (Principle 20)
|
||||||
|
8. Testing: Vitest unit tests + Playwright integration (Principle 26)
|
||||||
|
9. Vibes: Component prop naming matches Vue 3 conventions (Principle 11)
|
||||||
|
10. Documentation: Storybook with 5+ scenarios per component (Principle 28)
|
||||||
|
|
||||||
|
**Exit Criteria**:
|
||||||
|
- All 30+ components render in Storybook
|
||||||
|
- 70%+ test coverage for components
|
||||||
|
- TypeScript strict mode: 0 errors
|
||||||
|
- Accessibility audit: WCAG AA passed
|
||||||
|
- API mappers tested: DTO → Model round-trip
|
||||||
|
- Template stubs demonstrate layout (no business logic yet)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Phase 3-4: OMS Pilot & Workflows (Week 7-10)
|
||||||
|
|
||||||
|
**Objectives** (Principle 4: validate architecture with real business):
|
||||||
|
- Implement complete order creation workflow (input + state + inventory)
|
||||||
|
- Prove component hierarchy + API integration works
|
||||||
|
- Validate transaction model (not CRUD)
|
||||||
|
|
||||||
|
**Deliverables**:
|
||||||
|
- CreateOrderUseCase (business logic)
|
||||||
|
- OrderFormModel (screen state)
|
||||||
|
- Order API mapper (DTO ↔ Domain)
|
||||||
|
- TPL-CREATE-02 (header-line order form) fully functional
|
||||||
|
- E2E test: user creates order → inventory reserved → confirmation email sent
|
||||||
|
- Audit trail: all changes logged
|
||||||
|
|
||||||
|
**30 Principles Applied**:
|
||||||
|
1. SOLID: Domain model independent of API/UI (Principle 1)
|
||||||
|
2. Consistency: 3-way Model separation enforced (Principle 3)
|
||||||
|
3. Patterns: Header-line pattern documented, reusable (Principle 8)
|
||||||
|
4. Traceability: Order creation + all field changes audited (Principle 14)
|
||||||
|
5. Reliability: Inventory reserve atomic with order save (Principle 15)
|
||||||
|
6. Transactions: Use reversal model (cancel = create opposite), not delete (Principle 16)
|
||||||
|
7. Type Safety: OrderFormModel fully typed (Principle 19)
|
||||||
|
8. Error Handling: Clear messages for invalid order (Principle 24)
|
||||||
|
9. Testing: Happy path + error cases tested (Principle 26)
|
||||||
|
10. Documentation: Order creation workflow documented (Principle 28)
|
||||||
|
|
||||||
|
**Exit Criteria**:
|
||||||
|
- Order creation E2E test passes
|
||||||
|
- Audit log captures all changes
|
||||||
|
- Inventory reserve confirms before order save
|
||||||
|
- Type errors: 0
|
||||||
|
- Test coverage: 80%+ (higher for critical path)
|
||||||
|
- Performance: Order save <250ms P95
|
||||||
|
- Security: CSRF token + input validation verified
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Phase 5-7: WMS & ERP Pilots (Week 11-16)
|
||||||
|
|
||||||
|
**Objectives** (Principle 4: validate each domain):
|
||||||
|
- Implement WMS receipt workflow (prove warehouse floor compatible)
|
||||||
|
- Implement ERP voucher + approval (prove accounting integration)
|
||||||
|
- Demonstrate cross-domain workflow
|
||||||
|
|
||||||
|
**Deliverables**:
|
||||||
|
- ReceiptUseCase (receipt validation, lot/serial)
|
||||||
|
- VoucherUseCase (GL posting, approval chain)
|
||||||
|
- WMS & ERP pilots: 90% feature complete
|
||||||
|
- Integration test: order → receipt → GL posting (multi-domain flow)
|
||||||
|
|
||||||
|
**Exit Criteria**:
|
||||||
|
- Both pilots pass P1 acceptance criteria
|
||||||
|
- Cross-domain data consistency verified
|
||||||
|
- Audit trail for all domains complete
|
||||||
|
- 80%+ test coverage maintained
|
||||||
|
- Performance targets met
|
||||||
|
- Approval workflow functional
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Phase 8-10: Production Readiness (Week 17-22)
|
||||||
|
|
||||||
|
**Objectives**:
|
||||||
|
- Load testing, security hardening
|
||||||
|
- Documentation, training
|
||||||
|
- Deployment preparation
|
||||||
|
|
||||||
|
**Exit Criteria**:
|
||||||
|
- Load test: 100 concurrent users, <250ms P95
|
||||||
|
- Security audit: 0 critical vulns
|
||||||
|
- Disaster recovery tested
|
||||||
|
- UAT pass with end-users
|
||||||
|
- Documentation 100% complete
|
||||||
|
- Go-live approved
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## SUCCESS METRICS (Quantified, Principle 13: Reproducible)
|
||||||
|
|
||||||
|
| Metric | Target | Measurement | Principle |
|
||||||
|
|--------|--------|-------------|-----------|
|
||||||
|
| **Code Quality** | TypeScript strict 100% | `tsc --noEmit` | 19 |
|
||||||
|
| **Test Coverage** | 70%+ | Vitest coverage report | 26 |
|
||||||
|
| **Component Size** | <300 lines | ESLint rule: max-lines | 2 |
|
||||||
|
| **Accessibility** | WCAG 2.1 AA | axe-core audit score 95+ | 20 |
|
||||||
|
| **API Response** | P95 <250ms | Application monitoring | 22 |
|
||||||
|
| **Bundle Size** | <500KB gzip | webpack-bundle-analyzer | 22 |
|
||||||
|
| **Audit Trail** | 100% operations logged | Count audit_log rows per day | 14 |
|
||||||
|
| **Deployment** | Blue-green, <5min RTO | Deployment logs | 27 |
|
||||||
|
| **Security** | 0 critical vulns | OWASP ZAP + npm audit | 23 |
|
||||||
|
| **Team Velocity** | Consistent ±20% | Sprint retrospective metrics | 30 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ANTI-PATTERNS (What to Avoid)
|
||||||
|
|
||||||
|
**❌ Anti-Pattern 1**: "Bloated Business Composite"
|
||||||
|
- Example: OrderFormComponent owns order create + item search + inventory check + GL posting (no separation)
|
||||||
|
- Fix (Principle 2, 17): Break into OrderForm (UI) → CreateOrderUseCase (logic) → InventoryService (domain)
|
||||||
|
|
||||||
|
**❌ Anti-Pattern 2**: "Hallucinated Requirements"
|
||||||
|
- Example: "Let's add AI recommendation" without P0/P1 tag, no user request
|
||||||
|
- Fix (Principle 12): Every feature in backlog traces to PDF, stakeholder request, or JIRA ticket
|
||||||
|
|
||||||
|
**❌ Anti-Pattern 3**: "The Monolith Grows"
|
||||||
|
- Example: Primitive TextInput gradually gains domain logic (currency formatting, tax validation)
|
||||||
|
- Fix (Principle 2, 17): Extract to Typed Field (CurrencyField) or Domain Field (TaxAmountField)
|
||||||
|
|
||||||
|
**❌ Anti-Pattern 4**: "Forgotten Audit Trail"
|
||||||
|
- Example: Order status changed in DB, but no audit_log row (no traceability)
|
||||||
|
- Fix (Principle 14): Trigger on all UPDATE/DELETE, manual log in code for application logic
|
||||||
|
|
||||||
|
**❌ Anti-Pattern 5**: "Manual Process Not Validated"
|
||||||
|
- Example: Assume users want bulk order import, but never confirm with 5 OMS users
|
||||||
|
- Fix (Principle 7): Workflow diagram reviewed + walkthrough with domain expert before coding
|
||||||
|
|
||||||
|
**❌ Anti-Pattern 6**: "Circular Dependency"
|
||||||
|
- Example: Domain layer imports Use Case (should be opposite)
|
||||||
|
- Fix (Principle 1): Dependency Inversion, domain does not know about infrastructure/presentation
|
||||||
|
|
||||||
|
**❌ Anti-Pattern 7**: "Test Coverage Without Meaningful Tests"
|
||||||
|
- Example: 70% coverage but only happy-path tests, error scenarios untested
|
||||||
|
- Fix (Principle 26): Critical path 100%, all error cases tested, mutation testing for quality
|
||||||
|
|
||||||
|
**❌ Anti-Pattern 8**: "Security Debt"
|
||||||
|
- Example: No CSRF token on order save, SQL built with string concat
|
||||||
|
- Fix (Principle 23): Security review before merge, parameterized queries mandatory
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## GOVERNANCE & CHECKPOINTS
|
||||||
|
|
||||||
|
### Daily (Scrum)
|
||||||
|
- Each task update: Principle applied? Risk identified? Blocker?
|
||||||
|
|
||||||
|
### Weekly (Retrospective)
|
||||||
|
- Velocity, test coverage, technical debt status
|
||||||
|
- Anti-patterns spotted?
|
||||||
|
- Metrics tracking (Principle 30)
|
||||||
|
|
||||||
|
### Phase Gate (Exit Criteria)
|
||||||
|
- All 30 principles applied, verified
|
||||||
|
- Deliverables match PDF specs (not invented)
|
||||||
|
- Stakeholder sign-off
|
||||||
|
- Risk review
|
||||||
|
|
||||||
|
### Post-Launch (Ongoing)
|
||||||
|
- Monitoring: errors <0.5%, response time <250ms, uptime 99.9%
|
||||||
|
- Quarterly debt audit: refactor vs defer decision
|
||||||
|
- Annual architecture review: patterns holding up?
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## CONCLUSION
|
||||||
|
|
||||||
|
This Strategic Execution Framework translates:
|
||||||
|
1. **Actual PDF specifications** (not fabricated) into concrete deliverables
|
||||||
|
2. **30 principles** into testable, measurable criteria
|
||||||
|
3. **Phase gates** into risk-managed progression
|
||||||
|
4. **Domain-driven architecture** into code structure that won't rot
|
||||||
|
|
||||||
|
**Success is not aspirational — it's reproducible, traceable, and measurable.**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
*Framework Version: 1.0 (2026-07-26)*
|
||||||
|
*Advisor-Validated: YES (Post-hallucination correction)*
|
||||||
|
*PDF Source: 5 specifications, 179 pages total*
|
||||||
|
*Authority: 30-year engineer + actual business requirements*
|
||||||
@@ -0,0 +1,967 @@
|
|||||||
|
openapi: 3.0.3
|
||||||
|
info:
|
||||||
|
title: OMS·WMS·ERP Unified Business Platform API
|
||||||
|
description: |
|
||||||
|
Enterprise-grade Order/Warehouse/ERP management API
|
||||||
|
Based on PDF specifications + 30 Strategic Principles
|
||||||
|
|
||||||
|
## Key Design Principles
|
||||||
|
- REST-first (Principle 25: API Consistency)
|
||||||
|
- Transaction-based (not CRUD-only) per PDF spec
|
||||||
|
- RBAC with JWT tokens (Principle 23: Security)
|
||||||
|
- Audit trail on all mutations (Principle 14: Traceability)
|
||||||
|
- Type-safe schemas (Principle 19: Type Safety)
|
||||||
|
version: 0.1.0
|
||||||
|
contact:
|
||||||
|
name: QuantEngine Architecture Team
|
||||||
|
email: arch@quantengine.dev
|
||||||
|
license:
|
||||||
|
name: Internal Use Only
|
||||||
|
|
||||||
|
servers:
|
||||||
|
- url: https://api.quantengine.dev
|
||||||
|
description: Production
|
||||||
|
- url: http://localhost:5265
|
||||||
|
description: Local Development
|
||||||
|
|
||||||
|
# ===== SECURITY DEFINITIONS (Principle 23: Security) =====
|
||||||
|
security:
|
||||||
|
- BearerAuth: []
|
||||||
|
|
||||||
|
securitySchemes:
|
||||||
|
BearerAuth:
|
||||||
|
type: http
|
||||||
|
scheme: bearer
|
||||||
|
bearerFormat: JWT
|
||||||
|
description: |
|
||||||
|
JWT token with claims:
|
||||||
|
- sub: user_id
|
||||||
|
- role: admin|manager|operator|viewer|analyst
|
||||||
|
- iat, exp
|
||||||
|
|
||||||
|
# ===== COMPONENTS / SCHEMAS (Principle 19: Type Safety) =====
|
||||||
|
components:
|
||||||
|
schemas:
|
||||||
|
# Common Response Wrapper
|
||||||
|
ApiError:
|
||||||
|
type: object
|
||||||
|
required: [code, message]
|
||||||
|
properties:
|
||||||
|
code:
|
||||||
|
type: string
|
||||||
|
example: "ERR_ORDER_VALIDATION_QUANTITY_EXCEEDS_STOCK"
|
||||||
|
description: Machine-readable error code (Principle 24)
|
||||||
|
message:
|
||||||
|
type: string
|
||||||
|
example: "Order quantity (150) exceeds available stock (100)"
|
||||||
|
description: User-friendly message
|
||||||
|
details:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
field:
|
||||||
|
type: string
|
||||||
|
example: "line_items[0].quantity"
|
||||||
|
reason:
|
||||||
|
type: string
|
||||||
|
example: "Exceeds reserved inventory"
|
||||||
|
|
||||||
|
PaginatedResponse:
|
||||||
|
type: object
|
||||||
|
required: [data, pagination]
|
||||||
|
properties:
|
||||||
|
data:
|
||||||
|
type: array
|
||||||
|
pagination:
|
||||||
|
type: object
|
||||||
|
required: [page, pageSize, totalCount]
|
||||||
|
properties:
|
||||||
|
page:
|
||||||
|
type: integer
|
||||||
|
minimum: 1
|
||||||
|
example: 1
|
||||||
|
pageSize:
|
||||||
|
type: integer
|
||||||
|
minimum: 1
|
||||||
|
maximum: 100
|
||||||
|
default: 20
|
||||||
|
totalCount:
|
||||||
|
type: integer
|
||||||
|
example: 245
|
||||||
|
totalPages:
|
||||||
|
type: integer
|
||||||
|
example: 13
|
||||||
|
|
||||||
|
AuditInfo:
|
||||||
|
type: object
|
||||||
|
description: Traceability fields (Principle 14)
|
||||||
|
required: [createdBy, createdAt]
|
||||||
|
properties:
|
||||||
|
createdBy:
|
||||||
|
type: string
|
||||||
|
example: "USER_001"
|
||||||
|
createdAt:
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
modifiedBy:
|
||||||
|
type: string
|
||||||
|
example: "USER_002"
|
||||||
|
modifiedAt:
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
deletedBy:
|
||||||
|
type: string
|
||||||
|
deletedAt:
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
|
||||||
|
# ===== OMS Domain Schemas =====
|
||||||
|
Order:
|
||||||
|
type: object
|
||||||
|
description: Master order record (TPL-CREATE-02 header)
|
||||||
|
required: [orderId, orderNo, customerId, orderDate, totalAmount, status]
|
||||||
|
properties:
|
||||||
|
orderId:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
example: "550e8400-e29b-41d4-a716-446655440000"
|
||||||
|
orderNo:
|
||||||
|
type: string
|
||||||
|
example: "ORD-2026-001234"
|
||||||
|
description: Business-friendly order number
|
||||||
|
customerId:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
customerName:
|
||||||
|
type: string
|
||||||
|
example: "ABC Corporation"
|
||||||
|
orderDate:
|
||||||
|
type: string
|
||||||
|
format: date
|
||||||
|
example: "2026-07-26"
|
||||||
|
totalAmount:
|
||||||
|
type: number
|
||||||
|
format: double
|
||||||
|
example: 50000.00
|
||||||
|
description: Decimal precision (Principle 23)
|
||||||
|
status:
|
||||||
|
type: string
|
||||||
|
enum: [DRAFT, CONFIRMED, SHIPPED, DELIVERED, CANCELLED]
|
||||||
|
example: CONFIRMED
|
||||||
|
description: State machine (Principle 24 UX)
|
||||||
|
lines:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/OrderLine'
|
||||||
|
audit:
|
||||||
|
$ref: '#/components/schemas/AuditInfo'
|
||||||
|
|
||||||
|
OrderLine:
|
||||||
|
type: object
|
||||||
|
description: Order detail line (TPL-CREATE-02 detail)
|
||||||
|
required: [lineId, productId, quantity, unitPrice, lineTotal]
|
||||||
|
properties:
|
||||||
|
lineId:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
lineNo:
|
||||||
|
type: integer
|
||||||
|
minimum: 1
|
||||||
|
example: 1
|
||||||
|
productId:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
productSku:
|
||||||
|
type: string
|
||||||
|
example: "PROD-2026-0001"
|
||||||
|
productName:
|
||||||
|
type: string
|
||||||
|
quantity:
|
||||||
|
type: number
|
||||||
|
format: double
|
||||||
|
example: 10.5
|
||||||
|
quantityUnit:
|
||||||
|
type: string
|
||||||
|
enum: [EA, KG, M, L, BOX]
|
||||||
|
example: "EA"
|
||||||
|
unitPrice:
|
||||||
|
type: number
|
||||||
|
format: double
|
||||||
|
example: 4761.90
|
||||||
|
lineTotal:
|
||||||
|
type: number
|
||||||
|
format: double
|
||||||
|
example: 50000.00
|
||||||
|
status:
|
||||||
|
type: string
|
||||||
|
enum: [PENDING, ALLOCATED, SHIPPED, CANCELLED]
|
||||||
|
example: ALLOCATED
|
||||||
|
|
||||||
|
# ===== WMS Domain Schemas =====
|
||||||
|
Inventory:
|
||||||
|
type: object
|
||||||
|
description: Warehouse inventory position
|
||||||
|
required: [inventoryId, warehouseId, productId, qtyOnHand, status]
|
||||||
|
properties:
|
||||||
|
inventoryId:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
warehouseId:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
warehouseName:
|
||||||
|
type: string
|
||||||
|
example: "Seoul Main Warehouse"
|
||||||
|
productId:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
productSku:
|
||||||
|
type: string
|
||||||
|
productName:
|
||||||
|
type: string
|
||||||
|
qtyOnHand:
|
||||||
|
type: number
|
||||||
|
format: double
|
||||||
|
example: 500.0
|
||||||
|
qtyReserved:
|
||||||
|
type: number
|
||||||
|
format: double
|
||||||
|
example: 150.0
|
||||||
|
qtyAvailable:
|
||||||
|
type: number
|
||||||
|
format: double
|
||||||
|
example: 350.0
|
||||||
|
lastAdjustmentDate:
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
status:
|
||||||
|
type: string
|
||||||
|
enum: [ACTIVE, INACTIVE, DAMAGED]
|
||||||
|
example: ACTIVE
|
||||||
|
audit:
|
||||||
|
$ref: '#/components/schemas/AuditInfo'
|
||||||
|
|
||||||
|
StockTransfer:
|
||||||
|
type: object
|
||||||
|
description: Inter-warehouse stock movement
|
||||||
|
required: [transferId, fromWarehouse, toWarehouse, productId, quantity, status]
|
||||||
|
properties:
|
||||||
|
transferId:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
transferNo:
|
||||||
|
type: string
|
||||||
|
example: "XFER-2026-00567"
|
||||||
|
fromWarehouse:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
toWarehouse:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
productId:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
quantity:
|
||||||
|
type: number
|
||||||
|
format: double
|
||||||
|
status:
|
||||||
|
type: string
|
||||||
|
enum: [REQUESTED, APPROVED, SHIPPED, RECEIVED, CANCELLED]
|
||||||
|
example: APPROVED
|
||||||
|
reason:
|
||||||
|
type: string
|
||||||
|
example: "Inventory balancing - oversupply in Seoul"
|
||||||
|
audit:
|
||||||
|
$ref: '#/components/schemas/AuditInfo'
|
||||||
|
|
||||||
|
# ===== ERP Domain Schemas =====
|
||||||
|
Product:
|
||||||
|
type: object
|
||||||
|
description: Master product record
|
||||||
|
required: [productId, sku, name, categoryId]
|
||||||
|
properties:
|
||||||
|
productId:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
sku:
|
||||||
|
type: string
|
||||||
|
example: "PROD-2026-0001"
|
||||||
|
description: Stock Keeping Unit
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
example: "Widget Standard Size"
|
||||||
|
categoryId:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
categoryName:
|
||||||
|
type: string
|
||||||
|
unitOfMeasure:
|
||||||
|
type: string
|
||||||
|
enum: [EA, KG, M, L, BOX]
|
||||||
|
example: "EA"
|
||||||
|
status:
|
||||||
|
type: string
|
||||||
|
enum: [ACTIVE, INACTIVE, OBSOLETE]
|
||||||
|
example: ACTIVE
|
||||||
|
audit:
|
||||||
|
$ref: '#/components/schemas/AuditInfo'
|
||||||
|
|
||||||
|
Supplier:
|
||||||
|
type: object
|
||||||
|
description: Master vendor/supplier record
|
||||||
|
required: [supplierId, name, status]
|
||||||
|
properties:
|
||||||
|
supplierId:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
example: "ABC Trading Co., Ltd."
|
||||||
|
email:
|
||||||
|
type: string
|
||||||
|
format: email
|
||||||
|
phone:
|
||||||
|
type: string
|
||||||
|
example: "+82-2-1234-5678"
|
||||||
|
businessRegistration:
|
||||||
|
type: string
|
||||||
|
example: "123-45-67890"
|
||||||
|
status:
|
||||||
|
type: string
|
||||||
|
enum: [ACTIVE, INACTIVE, SUSPENDED]
|
||||||
|
example: ACTIVE
|
||||||
|
audit:
|
||||||
|
$ref: '#/components/schemas/AuditInfo'
|
||||||
|
|
||||||
|
Customer:
|
||||||
|
type: object
|
||||||
|
description: Master customer record
|
||||||
|
required: [customerId, name, status]
|
||||||
|
properties:
|
||||||
|
customerId:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
example: "XYZ Corporation"
|
||||||
|
email:
|
||||||
|
type: string
|
||||||
|
format: email
|
||||||
|
phone:
|
||||||
|
type: string
|
||||||
|
businessRegistration:
|
||||||
|
type: string
|
||||||
|
status:
|
||||||
|
type: string
|
||||||
|
enum: [ACTIVE, INACTIVE, SUSPENDED]
|
||||||
|
example: ACTIVE
|
||||||
|
audit:
|
||||||
|
$ref: '#/components/schemas/AuditInfo'
|
||||||
|
|
||||||
|
GLAccount:
|
||||||
|
type: object
|
||||||
|
description: General Ledger account
|
||||||
|
required: [accountId, code, name, type]
|
||||||
|
properties:
|
||||||
|
accountId:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
code:
|
||||||
|
type: string
|
||||||
|
example: "1010"
|
||||||
|
description: Chart of Accounts code
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
example: "Cash - KRW"
|
||||||
|
type:
|
||||||
|
type: string
|
||||||
|
enum: [ASSET, LIABILITY, EQUITY, REVENUE, EXPENSE]
|
||||||
|
example: ASSET
|
||||||
|
status:
|
||||||
|
type: string
|
||||||
|
enum: [ACTIVE, INACTIVE]
|
||||||
|
example: ACTIVE
|
||||||
|
audit:
|
||||||
|
$ref: '#/components/schemas/AuditInfo'
|
||||||
|
|
||||||
|
Voucher:
|
||||||
|
type: object
|
||||||
|
description: Accounting journal entry
|
||||||
|
required: [voucherId, voucherNo, status]
|
||||||
|
properties:
|
||||||
|
voucherId:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
voucherNo:
|
||||||
|
type: string
|
||||||
|
example: "JNL-2026-00123"
|
||||||
|
documentDate:
|
||||||
|
type: string
|
||||||
|
format: date
|
||||||
|
documentType:
|
||||||
|
type: string
|
||||||
|
enum: [PURCHASE, SALES, JOURNAL, ADJUSTMENT]
|
||||||
|
example: PURCHASE
|
||||||
|
status:
|
||||||
|
type: string
|
||||||
|
enum: [DRAFT, POSTED, APPROVED, VOIDED]
|
||||||
|
example: APPROVED
|
||||||
|
totalDebit:
|
||||||
|
type: number
|
||||||
|
format: double
|
||||||
|
totalCredit:
|
||||||
|
type: number
|
||||||
|
format: double
|
||||||
|
description:
|
||||||
|
type: string
|
||||||
|
audit:
|
||||||
|
$ref: '#/components/schemas/AuditInfo'
|
||||||
|
|
||||||
|
# ===== Audit & History =====
|
||||||
|
AuditLog:
|
||||||
|
type: object
|
||||||
|
description: Complete change audit trail (Principle 14)
|
||||||
|
required: [auditId, entityType, entityId, operation, changedBy, changedAt]
|
||||||
|
properties:
|
||||||
|
auditId:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
entityType:
|
||||||
|
type: string
|
||||||
|
enum: [ORDER, INVENTORY, PRODUCT, SUPPLIER, CUSTOMER, VOUCHER]
|
||||||
|
example: ORDER
|
||||||
|
entityId:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
operation:
|
||||||
|
type: string
|
||||||
|
enum: [CREATE, UPDATE, DELETE]
|
||||||
|
example: UPDATE
|
||||||
|
oldValue:
|
||||||
|
type: object
|
||||||
|
description: "JSON snapshot of previous state"
|
||||||
|
newValue:
|
||||||
|
type: object
|
||||||
|
description: "JSON snapshot of current state"
|
||||||
|
changedBy:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
changedAt:
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
reason:
|
||||||
|
type: string
|
||||||
|
example: "Manual correction per user request"
|
||||||
|
|
||||||
|
# ===== PATHS / ENDPOINTS (Principle 25: REST) =====
|
||||||
|
paths:
|
||||||
|
# ===== OMS: Order Management =====
|
||||||
|
/api/orders:
|
||||||
|
get:
|
||||||
|
summary: List orders (TPL-LIST-01)
|
||||||
|
operationId: listOrders
|
||||||
|
tags: [OMS]
|
||||||
|
description: Retrieve orders with pagination and filters
|
||||||
|
parameters:
|
||||||
|
- name: page
|
||||||
|
in: query
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
minimum: 1
|
||||||
|
default: 1
|
||||||
|
- name: pageSize
|
||||||
|
in: query
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
minimum: 1
|
||||||
|
maximum: 100
|
||||||
|
default: 20
|
||||||
|
- name: status
|
||||||
|
in: query
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
enum: [DRAFT, CONFIRMED, SHIPPED, DELIVERED, CANCELLED]
|
||||||
|
- name: fromDate
|
||||||
|
in: query
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
format: date
|
||||||
|
- name: toDate
|
||||||
|
in: query
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
format: date
|
||||||
|
- name: customerId
|
||||||
|
in: query
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: List of orders
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/components/schemas/PaginatedResponse'
|
||||||
|
- properties:
|
||||||
|
data:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/Order'
|
||||||
|
'400':
|
||||||
|
description: Invalid parameters
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/ApiError'
|
||||||
|
'401':
|
||||||
|
description: Unauthorized
|
||||||
|
'403':
|
||||||
|
description: Forbidden (insufficient role)
|
||||||
|
|
||||||
|
post:
|
||||||
|
summary: Create order (TPL-CREATE-02)
|
||||||
|
operationId: createOrder
|
||||||
|
tags: [OMS]
|
||||||
|
description: Create new order with line items
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
required: [customerId, lines]
|
||||||
|
properties:
|
||||||
|
customerId:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
orderDate:
|
||||||
|
type: string
|
||||||
|
format: date
|
||||||
|
default: today
|
||||||
|
lines:
|
||||||
|
type: array
|
||||||
|
minItems: 1
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
required: [productId, quantity]
|
||||||
|
properties:
|
||||||
|
productId:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
quantity:
|
||||||
|
type: number
|
||||||
|
format: double
|
||||||
|
minimum: 0.01
|
||||||
|
responses:
|
||||||
|
'201':
|
||||||
|
description: Order created successfully
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/Order'
|
||||||
|
'400':
|
||||||
|
description: Validation error (stock insufficient, invalid product, etc.)
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/ApiError'
|
||||||
|
'409':
|
||||||
|
description: Conflict (customer locked, inventory reserved)
|
||||||
|
|
||||||
|
/api/orders/{orderId}:
|
||||||
|
get:
|
||||||
|
summary: Get order detail (TPL-DETAIL-01)
|
||||||
|
operationId: getOrder
|
||||||
|
tags: [OMS]
|
||||||
|
parameters:
|
||||||
|
- name: orderId
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Order detail
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/Order'
|
||||||
|
'404':
|
||||||
|
description: Order not found
|
||||||
|
|
||||||
|
put:
|
||||||
|
summary: Update order (TPL-EDIT-01)
|
||||||
|
operationId: updateOrder
|
||||||
|
tags: [OMS]
|
||||||
|
parameters:
|
||||||
|
- name: orderId
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
status:
|
||||||
|
type: string
|
||||||
|
enum: [DRAFT, CONFIRMED, CANCELLED]
|
||||||
|
lines:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/OrderLine'
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Order updated
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/Order'
|
||||||
|
|
||||||
|
delete:
|
||||||
|
summary: Cancel order (TPL-CANCEL-01)
|
||||||
|
operationId: cancelOrder
|
||||||
|
tags: [OMS]
|
||||||
|
parameters:
|
||||||
|
- name: orderId
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
required: [reason]
|
||||||
|
properties:
|
||||||
|
reason:
|
||||||
|
type: string
|
||||||
|
example: "Customer request"
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Order cancelled (creates reversal transaction per PDF)
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/Order'
|
||||||
|
|
||||||
|
# ===== WMS: Warehouse Management =====
|
||||||
|
/api/inventory:
|
||||||
|
get:
|
||||||
|
summary: List inventory (TPL-LIST-01)
|
||||||
|
operationId: listInventory
|
||||||
|
tags: [WMS]
|
||||||
|
parameters:
|
||||||
|
- name: warehouseId
|
||||||
|
in: query
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
- name: productSku
|
||||||
|
in: query
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Inventory list
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/components/schemas/PaginatedResponse'
|
||||||
|
- properties:
|
||||||
|
data:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/Inventory'
|
||||||
|
|
||||||
|
/api/stock-transfers:
|
||||||
|
post:
|
||||||
|
summary: Request stock transfer (TPL-CREATE-02)
|
||||||
|
operationId: createStockTransfer
|
||||||
|
tags: [WMS]
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
required: [fromWarehouse, toWarehouse, productId, quantity]
|
||||||
|
properties:
|
||||||
|
fromWarehouse:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
toWarehouse:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
productId:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
quantity:
|
||||||
|
type: number
|
||||||
|
format: double
|
||||||
|
reason:
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
'201':
|
||||||
|
description: Transfer request created (pending approval)
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/StockTransfer'
|
||||||
|
|
||||||
|
/api/stock-transfers/{transferId}:
|
||||||
|
patch:
|
||||||
|
summary: Approve/reject transfer (TPL-APPROVAL-01)
|
||||||
|
operationId: approveTransfer
|
||||||
|
tags: [WMS]
|
||||||
|
parameters:
|
||||||
|
- name: transferId
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
required: [status]
|
||||||
|
properties:
|
||||||
|
status:
|
||||||
|
type: string
|
||||||
|
enum: [APPROVED, REJECTED]
|
||||||
|
reason:
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Transfer status updated
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/StockTransfer'
|
||||||
|
|
||||||
|
# ===== ERP: Master Data Management =====
|
||||||
|
/api/products:
|
||||||
|
get:
|
||||||
|
summary: List products (TPL-LIST-01)
|
||||||
|
operationId: listProducts
|
||||||
|
tags: [ERP]
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Product list
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/components/schemas/PaginatedResponse'
|
||||||
|
- properties:
|
||||||
|
data:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/Product'
|
||||||
|
|
||||||
|
post:
|
||||||
|
summary: Create product (TPL-CREATE-01)
|
||||||
|
operationId: createProduct
|
||||||
|
tags: [ERP]
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
required: [sku, name, categoryId]
|
||||||
|
properties:
|
||||||
|
sku:
|
||||||
|
type: string
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
categoryId:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
responses:
|
||||||
|
'201':
|
||||||
|
description: Product created
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/Product'
|
||||||
|
|
||||||
|
/api/suppliers:
|
||||||
|
get:
|
||||||
|
summary: List suppliers (TPL-LIST-01)
|
||||||
|
operationId: listSuppliers
|
||||||
|
tags: [ERP]
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Supplier list
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/components/schemas/PaginatedResponse'
|
||||||
|
- properties:
|
||||||
|
data:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/Supplier'
|
||||||
|
|
||||||
|
/api/customers:
|
||||||
|
get:
|
||||||
|
summary: List customers (TPL-LIST-01)
|
||||||
|
operationId: listCustomers
|
||||||
|
tags: [ERP]
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Customer list
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/components/schemas/PaginatedResponse'
|
||||||
|
- properties:
|
||||||
|
data:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/Customer'
|
||||||
|
|
||||||
|
/api/gl-accounts:
|
||||||
|
get:
|
||||||
|
summary: List GL accounts (TPL-LIST-01)
|
||||||
|
operationId: listGLAccounts
|
||||||
|
tags: [ERP]
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: GL account list
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/components/schemas/PaginatedResponse'
|
||||||
|
- properties:
|
||||||
|
data:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/GLAccount'
|
||||||
|
|
||||||
|
/api/vouchers:
|
||||||
|
get:
|
||||||
|
summary: List vouchers (TPL-LIST-01)
|
||||||
|
operationId: listVouchers
|
||||||
|
tags: [ERP]
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Voucher list
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/components/schemas/PaginatedResponse'
|
||||||
|
- properties:
|
||||||
|
data:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/Voucher'
|
||||||
|
|
||||||
|
post:
|
||||||
|
summary: Create voucher (TPL-CREATE-01)
|
||||||
|
operationId: createVoucher
|
||||||
|
tags: [ERP]
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
required: [documentDate, documentType]
|
||||||
|
properties:
|
||||||
|
documentDate:
|
||||||
|
type: string
|
||||||
|
format: date
|
||||||
|
documentType:
|
||||||
|
type: string
|
||||||
|
enum: [PURCHASE, SALES, JOURNAL, ADJUSTMENT]
|
||||||
|
description:
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
'201':
|
||||||
|
description: Voucher created
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/Voucher'
|
||||||
|
|
||||||
|
# ===== Audit Trail =====
|
||||||
|
/api/audit-logs:
|
||||||
|
get:
|
||||||
|
summary: Query audit trail (TPL-HISTORY-01)
|
||||||
|
operationId: getAuditLogs
|
||||||
|
tags: [Audit]
|
||||||
|
description: |
|
||||||
|
Retrieve complete change history for entities.
|
||||||
|
Principle 14: Complete traceability of all mutations.
|
||||||
|
parameters:
|
||||||
|
- name: entityType
|
||||||
|
in: query
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
enum: [ORDER, INVENTORY, PRODUCT, SUPPLIER, CUSTOMER, VOUCHER]
|
||||||
|
- name: entityId
|
||||||
|
in: query
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
- name: fromDate
|
||||||
|
in: query
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
- name: toDate
|
||||||
|
in: query
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Audit log entries
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
logs:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/AuditLog'
|
||||||
|
|
||||||
|
tags:
|
||||||
|
- name: OMS
|
||||||
|
description: Order Management System endpoints
|
||||||
|
- name: WMS
|
||||||
|
description: Warehouse Management System endpoints
|
||||||
|
- name: ERP
|
||||||
|
description: Enterprise Resource Planning endpoints
|
||||||
|
- name: Audit
|
||||||
|
description: Audit trail and history endpoints
|
||||||
|
|
||||||
|
x-api-meta:
|
||||||
|
architecture: Domain-Driven Design (Principle 1: SOLID)
|
||||||
|
security: RBAC via JWT claims (Principle 23)
|
||||||
|
transactions: Reversal-based (no overwrites) per PDF spec
|
||||||
|
audit: Complete trail on all mutations (Principle 14)
|
||||||
|
consistency: Decimal precision for financials (Principle 23)
|
||||||
|
versioning: "X-API-Version: 1" header (future expansion)
|
||||||
@@ -0,0 +1,471 @@
|
|||||||
|
-- OMS·WMS·ERP Unified Platform Database Schema v1.0
|
||||||
|
-- PostgreSQL 15+
|
||||||
|
-- Principles Applied:
|
||||||
|
-- 3: Data Consistency (SSOT)
|
||||||
|
-- 5: Normalization (3NF minimum)
|
||||||
|
-- 6: Denormalization (performance-justified only)
|
||||||
|
-- 14: Traceability (audit_log on all mutations)
|
||||||
|
-- 23: Security (NUMERIC for financial precision)
|
||||||
|
|
||||||
|
CREATE SCHEMA IF NOT EXISTS quantengine;
|
||||||
|
SET search_path = quantengine, public;
|
||||||
|
|
||||||
|
-- ===== ENUMS (Type Safety - Principle 19) =====
|
||||||
|
|
||||||
|
CREATE TYPE order_status AS ENUM ('DRAFT', 'CONFIRMED', 'SHIPPED', 'DELIVERED', 'CANCELLED');
|
||||||
|
CREATE TYPE order_line_status AS ENUM ('PENDING', 'ALLOCATED', 'SHIPPED', 'CANCELLED');
|
||||||
|
CREATE TYPE transfer_status AS ENUM ('REQUESTED', 'APPROVED', 'SHIPPED', 'RECEIVED', 'CANCELLED');
|
||||||
|
CREATE TYPE product_status AS ENUM ('ACTIVE', 'INACTIVE', 'OBSOLETE');
|
||||||
|
CREATE TYPE supplier_status AS ENUM ('ACTIVE', 'INACTIVE', 'SUSPENDED');
|
||||||
|
CREATE TYPE customer_status AS ENUM ('ACTIVE', 'INACTIVE', 'SUSPENDED');
|
||||||
|
CREATE TYPE gl_account_type AS ENUM ('ASSET', 'LIABILITY', 'EQUITY', 'REVENUE', 'EXPENSE');
|
||||||
|
CREATE TYPE voucher_status AS ENUM ('DRAFT', 'POSTED', 'APPROVED', 'VOIDED');
|
||||||
|
CREATE TYPE voucher_document_type AS ENUM ('PURCHASE', 'SALES', 'JOURNAL', 'ADJUSTMENT');
|
||||||
|
CREATE TYPE inventory_status AS ENUM ('ACTIVE', 'INACTIVE', 'DAMAGED');
|
||||||
|
CREATE TYPE unit_of_measure AS ENUM ('EA', 'KG', 'M', 'L', 'BOX');
|
||||||
|
CREATE TYPE audit_operation AS ENUM ('CREATE', 'UPDATE', 'DELETE');
|
||||||
|
CREATE TYPE user_role AS ENUM ('ADMIN', 'MANAGER', 'OPERATOR', 'VIEWER', 'ANALYST');
|
||||||
|
|
||||||
|
-- ===== COMMON/MASTER TABLES =====
|
||||||
|
|
||||||
|
CREATE TABLE users (
|
||||||
|
user_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
|
email VARCHAR(255) NOT NULL UNIQUE,
|
||||||
|
password_hash VARCHAR(255) NOT NULL,
|
||||||
|
name VARCHAR(255) NOT NULL,
|
||||||
|
role user_role NOT NULL DEFAULT 'VIEWER',
|
||||||
|
status VARCHAR(50) NOT NULL DEFAULT 'ACTIVE',
|
||||||
|
created_by UUID,
|
||||||
|
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
modified_by UUID,
|
||||||
|
modified_at TIMESTAMP,
|
||||||
|
deleted_by UUID,
|
||||||
|
deleted_at TIMESTAMP,
|
||||||
|
|
||||||
|
CONSTRAINT fk_users_created_by FOREIGN KEY (created_by) REFERENCES users(user_id),
|
||||||
|
CONSTRAINT fk_users_modified_by FOREIGN KEY (modified_by) REFERENCES users(user_id),
|
||||||
|
CONSTRAINT fk_users_deleted_by FOREIGN KEY (deleted_by) REFERENCES users(user_id)
|
||||||
|
);
|
||||||
|
CREATE INDEX idx_users_email ON users(email);
|
||||||
|
|
||||||
|
CREATE TABLE warehouses (
|
||||||
|
warehouse_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
|
warehouse_code VARCHAR(50) NOT NULL UNIQUE,
|
||||||
|
warehouse_name VARCHAR(255) NOT NULL,
|
||||||
|
location VARCHAR(255),
|
||||||
|
status VARCHAR(50) NOT NULL DEFAULT 'ACTIVE',
|
||||||
|
created_by UUID NOT NULL,
|
||||||
|
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
modified_by UUID,
|
||||||
|
modified_at TIMESTAMP,
|
||||||
|
deleted_by UUID,
|
||||||
|
deleted_at TIMESTAMP,
|
||||||
|
|
||||||
|
CONSTRAINT fk_warehouses_created_by FOREIGN KEY (created_by) REFERENCES users(user_id)
|
||||||
|
);
|
||||||
|
CREATE INDEX idx_warehouses_code ON warehouses(warehouse_code);
|
||||||
|
|
||||||
|
CREATE TABLE product_categories (
|
||||||
|
category_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
|
category_name VARCHAR(255) NOT NULL UNIQUE,
|
||||||
|
description TEXT,
|
||||||
|
status VARCHAR(50) NOT NULL DEFAULT 'ACTIVE',
|
||||||
|
created_by UUID NOT NULL,
|
||||||
|
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
|
||||||
|
CONSTRAINT fk_categories_created_by FOREIGN KEY (created_by) REFERENCES users(user_id)
|
||||||
|
);
|
||||||
|
|
||||||
|
-- ===== OMS: ORDER MANAGEMENT =====
|
||||||
|
|
||||||
|
CREATE TABLE customers (
|
||||||
|
customer_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
|
customer_code VARCHAR(50) NOT NULL UNIQUE,
|
||||||
|
customer_name VARCHAR(255) NOT NULL,
|
||||||
|
email VARCHAR(255),
|
||||||
|
phone VARCHAR(20),
|
||||||
|
business_registration VARCHAR(50),
|
||||||
|
status customer_status NOT NULL DEFAULT 'ACTIVE',
|
||||||
|
created_by UUID NOT NULL,
|
||||||
|
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
modified_by UUID,
|
||||||
|
modified_at TIMESTAMP,
|
||||||
|
deleted_by UUID,
|
||||||
|
deleted_at TIMESTAMP,
|
||||||
|
|
||||||
|
CONSTRAINT fk_customers_created_by FOREIGN KEY (created_by) REFERENCES users(user_id)
|
||||||
|
);
|
||||||
|
CREATE INDEX idx_customers_code ON customers(customer_code);
|
||||||
|
CREATE INDEX idx_customers_email ON customers(email);
|
||||||
|
|
||||||
|
CREATE TABLE orders (
|
||||||
|
order_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
|
order_no VARCHAR(50) NOT NULL UNIQUE,
|
||||||
|
customer_id UUID NOT NULL,
|
||||||
|
order_date DATE NOT NULL DEFAULT CURRENT_DATE,
|
||||||
|
total_amount NUMERIC(19,4) NOT NULL DEFAULT 0.0,
|
||||||
|
status order_status NOT NULL DEFAULT 'DRAFT',
|
||||||
|
created_by UUID NOT NULL,
|
||||||
|
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
modified_by UUID,
|
||||||
|
modified_at TIMESTAMP,
|
||||||
|
deleted_by UUID,
|
||||||
|
deleted_at TIMESTAMP,
|
||||||
|
|
||||||
|
CONSTRAINT fk_orders_customer FOREIGN KEY (customer_id) REFERENCES customers(customer_id),
|
||||||
|
CONSTRAINT fk_orders_created_by FOREIGN KEY (created_by) REFERENCES users(user_id),
|
||||||
|
CONSTRAINT chk_total_amount CHECK (total_amount >= 0)
|
||||||
|
);
|
||||||
|
CREATE INDEX idx_orders_no ON orders(order_no);
|
||||||
|
CREATE INDEX idx_orders_customer_id ON orders(customer_id);
|
||||||
|
CREATE INDEX idx_orders_status ON orders(status);
|
||||||
|
CREATE INDEX idx_orders_order_date ON orders(order_date);
|
||||||
|
|
||||||
|
CREATE TABLE order_lines (
|
||||||
|
line_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
|
order_id UUID NOT NULL,
|
||||||
|
line_no SMALLINT NOT NULL,
|
||||||
|
product_id UUID NOT NULL,
|
||||||
|
quantity NUMERIC(19,4) NOT NULL,
|
||||||
|
quantity_unit unit_of_measure NOT NULL,
|
||||||
|
unit_price NUMERIC(19,4) NOT NULL,
|
||||||
|
line_total NUMERIC(19,4) NOT NULL,
|
||||||
|
status order_line_status NOT NULL DEFAULT 'PENDING',
|
||||||
|
created_by UUID NOT NULL,
|
||||||
|
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
modified_by UUID,
|
||||||
|
modified_at TIMESTAMP,
|
||||||
|
deleted_by UUID,
|
||||||
|
deleted_at TIMESTAMP,
|
||||||
|
|
||||||
|
CONSTRAINT fk_order_lines_order FOREIGN KEY (order_id) REFERENCES orders(order_id),
|
||||||
|
CONSTRAINT fk_order_lines_product FOREIGN KEY (product_id) REFERENCES products(product_id),
|
||||||
|
CONSTRAINT fk_order_lines_created_by FOREIGN KEY (created_by) REFERENCES users(user_id),
|
||||||
|
CONSTRAINT uk_order_lines_order_lineno UNIQUE (order_id, line_no),
|
||||||
|
CONSTRAINT chk_quantity CHECK (quantity > 0),
|
||||||
|
CONSTRAINT chk_unit_price CHECK (unit_price >= 0),
|
||||||
|
CONSTRAINT chk_line_total CHECK (line_total >= 0)
|
||||||
|
);
|
||||||
|
CREATE INDEX idx_order_lines_order_id ON order_lines(order_id);
|
||||||
|
CREATE INDEX idx_order_lines_product_id ON order_lines(product_id);
|
||||||
|
|
||||||
|
-- ===== WMS: WAREHOUSE MANAGEMENT =====
|
||||||
|
|
||||||
|
CREATE TABLE inventory (
|
||||||
|
inventory_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
|
warehouse_id UUID NOT NULL,
|
||||||
|
product_id UUID NOT NULL,
|
||||||
|
qty_on_hand NUMERIC(19,4) NOT NULL DEFAULT 0.0,
|
||||||
|
qty_reserved NUMERIC(19,4) NOT NULL DEFAULT 0.0,
|
||||||
|
qty_available NUMERIC(19,4) NOT NULL GENERATED ALWAYS AS (qty_on_hand - qty_reserved) STORED,
|
||||||
|
last_adjustment_date TIMESTAMP,
|
||||||
|
status inventory_status NOT NULL DEFAULT 'ACTIVE',
|
||||||
|
created_by UUID NOT NULL,
|
||||||
|
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
modified_by UUID,
|
||||||
|
modified_at TIMESTAMP,
|
||||||
|
deleted_by UUID,
|
||||||
|
deleted_at TIMESTAMP,
|
||||||
|
|
||||||
|
CONSTRAINT fk_inventory_warehouse FOREIGN KEY (warehouse_id) REFERENCES warehouses(warehouse_id),
|
||||||
|
CONSTRAINT fk_inventory_product FOREIGN KEY (product_id) REFERENCES products(product_id),
|
||||||
|
CONSTRAINT fk_inventory_created_by FOREIGN KEY (created_by) REFERENCES users(user_id),
|
||||||
|
CONSTRAINT uk_inventory_warehouse_product UNIQUE (warehouse_id, product_id),
|
||||||
|
CONSTRAINT chk_qty_on_hand CHECK (qty_on_hand >= 0),
|
||||||
|
CONSTRAINT chk_qty_reserved CHECK (qty_reserved >= 0)
|
||||||
|
);
|
||||||
|
CREATE INDEX idx_inventory_warehouse_id ON inventory(warehouse_id);
|
||||||
|
CREATE INDEX idx_inventory_product_id ON inventory(product_id);
|
||||||
|
|
||||||
|
CREATE TABLE stock_transfers (
|
||||||
|
transfer_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
|
transfer_no VARCHAR(50) NOT NULL UNIQUE,
|
||||||
|
from_warehouse_id UUID NOT NULL,
|
||||||
|
to_warehouse_id UUID NOT NULL,
|
||||||
|
product_id UUID NOT NULL,
|
||||||
|
quantity NUMERIC(19,4) NOT NULL,
|
||||||
|
reason TEXT,
|
||||||
|
status transfer_status NOT NULL DEFAULT 'REQUESTED',
|
||||||
|
created_by UUID NOT NULL,
|
||||||
|
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
modified_by UUID,
|
||||||
|
modified_at TIMESTAMP,
|
||||||
|
deleted_by UUID,
|
||||||
|
deleted_at TIMESTAMP,
|
||||||
|
|
||||||
|
CONSTRAINT fk_transfers_from_warehouse FOREIGN KEY (from_warehouse_id) REFERENCES warehouses(warehouse_id),
|
||||||
|
CONSTRAINT fk_transfers_to_warehouse FOREIGN KEY (to_warehouse_id) REFERENCES warehouses(warehouse_id),
|
||||||
|
CONSTRAINT fk_transfers_product FOREIGN KEY (product_id) REFERENCES products(product_id),
|
||||||
|
CONSTRAINT fk_transfers_created_by FOREIGN KEY (created_by) REFERENCES users(user_id),
|
||||||
|
CONSTRAINT chk_quantity CHECK (quantity > 0),
|
||||||
|
CONSTRAINT chk_different_warehouses CHECK (from_warehouse_id != to_warehouse_id)
|
||||||
|
);
|
||||||
|
CREATE INDEX idx_stock_transfers_no ON stock_transfers(transfer_no);
|
||||||
|
CREATE INDEX idx_stock_transfers_from_warehouse ON stock_transfers(from_warehouse_id);
|
||||||
|
CREATE INDEX idx_stock_transfers_to_warehouse ON stock_transfers(to_warehouse_id);
|
||||||
|
CREATE INDEX idx_stock_transfers_status ON stock_transfers(status);
|
||||||
|
|
||||||
|
-- ===== ERP: ENTERPRISE RESOURCE PLANNING =====
|
||||||
|
|
||||||
|
CREATE TABLE products (
|
||||||
|
product_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
|
sku VARCHAR(50) NOT NULL UNIQUE,
|
||||||
|
product_name VARCHAR(255) NOT NULL,
|
||||||
|
category_id UUID,
|
||||||
|
unit_of_measure unit_of_measure NOT NULL DEFAULT 'EA',
|
||||||
|
status product_status NOT NULL DEFAULT 'ACTIVE',
|
||||||
|
created_by UUID NOT NULL,
|
||||||
|
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
modified_by UUID,
|
||||||
|
modified_at TIMESTAMP,
|
||||||
|
deleted_by UUID,
|
||||||
|
deleted_at TIMESTAMP,
|
||||||
|
|
||||||
|
CONSTRAINT fk_products_category FOREIGN KEY (category_id) REFERENCES product_categories(category_id),
|
||||||
|
CONSTRAINT fk_products_created_by FOREIGN KEY (created_by) REFERENCES users(user_id)
|
||||||
|
);
|
||||||
|
CREATE INDEX idx_products_sku ON products(sku);
|
||||||
|
CREATE INDEX idx_products_status ON products(status);
|
||||||
|
|
||||||
|
CREATE TABLE suppliers (
|
||||||
|
supplier_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
|
supplier_code VARCHAR(50) NOT NULL UNIQUE,
|
||||||
|
supplier_name VARCHAR(255) NOT NULL,
|
||||||
|
email VARCHAR(255),
|
||||||
|
phone VARCHAR(20),
|
||||||
|
business_registration VARCHAR(50),
|
||||||
|
status supplier_status NOT NULL DEFAULT 'ACTIVE',
|
||||||
|
created_by UUID NOT NULL,
|
||||||
|
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
modified_by UUID,
|
||||||
|
modified_at TIMESTAMP,
|
||||||
|
deleted_by UUID,
|
||||||
|
deleted_at TIMESTAMP,
|
||||||
|
|
||||||
|
CONSTRAINT fk_suppliers_created_by FOREIGN KEY (created_by) REFERENCES users(user_id)
|
||||||
|
);
|
||||||
|
CREATE INDEX idx_suppliers_code ON suppliers(supplier_code);
|
||||||
|
|
||||||
|
CREATE TABLE gl_accounts (
|
||||||
|
account_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
|
account_code VARCHAR(50) NOT NULL UNIQUE,
|
||||||
|
account_name VARCHAR(255) NOT NULL,
|
||||||
|
account_type gl_account_type NOT NULL,
|
||||||
|
status VARCHAR(50) NOT NULL DEFAULT 'ACTIVE',
|
||||||
|
created_by UUID NOT NULL,
|
||||||
|
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
modified_by UUID,
|
||||||
|
modified_at TIMESTAMP,
|
||||||
|
deleted_by UUID,
|
||||||
|
deleted_at TIMESTAMP,
|
||||||
|
|
||||||
|
CONSTRAINT fk_gl_accounts_created_by FOREIGN KEY (created_by) REFERENCES users(user_id)
|
||||||
|
);
|
||||||
|
CREATE INDEX idx_gl_accounts_code ON gl_accounts(account_code);
|
||||||
|
CREATE INDEX idx_gl_accounts_type ON gl_accounts(account_type);
|
||||||
|
|
||||||
|
CREATE TABLE vouchers (
|
||||||
|
voucher_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
|
voucher_no VARCHAR(50) NOT NULL UNIQUE,
|
||||||
|
document_date DATE NOT NULL,
|
||||||
|
document_type voucher_document_type NOT NULL,
|
||||||
|
description TEXT,
|
||||||
|
total_debit NUMERIC(19,4) NOT NULL DEFAULT 0.0,
|
||||||
|
total_credit NUMERIC(19,4) NOT NULL DEFAULT 0.0,
|
||||||
|
status voucher_status NOT NULL DEFAULT 'DRAFT',
|
||||||
|
created_by UUID NOT NULL,
|
||||||
|
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
modified_by UUID,
|
||||||
|
modified_at TIMESTAMP,
|
||||||
|
deleted_by UUID,
|
||||||
|
deleted_at TIMESTAMP,
|
||||||
|
|
||||||
|
CONSTRAINT fk_vouchers_created_by FOREIGN KEY (created_by) REFERENCES users(user_id),
|
||||||
|
CONSTRAINT chk_totals_balance CHECK (total_debit = total_credit)
|
||||||
|
);
|
||||||
|
CREATE INDEX idx_vouchers_no ON vouchers(voucher_no);
|
||||||
|
CREATE INDEX idx_vouchers_document_date ON vouchers(document_date);
|
||||||
|
CREATE INDEX idx_vouchers_status ON vouchers(status);
|
||||||
|
|
||||||
|
CREATE TABLE voucher_lines (
|
||||||
|
voucher_line_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
|
voucher_id UUID NOT NULL,
|
||||||
|
line_no SMALLINT NOT NULL,
|
||||||
|
account_id UUID NOT NULL,
|
||||||
|
debit_amount NUMERIC(19,4) NOT NULL DEFAULT 0.0,
|
||||||
|
credit_amount NUMERIC(19,4) NOT NULL DEFAULT 0.0,
|
||||||
|
description TEXT,
|
||||||
|
created_by UUID NOT NULL,
|
||||||
|
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
|
||||||
|
CONSTRAINT fk_voucher_lines_voucher FOREIGN KEY (voucher_id) REFERENCES vouchers(voucher_id),
|
||||||
|
CONSTRAINT fk_voucher_lines_account FOREIGN KEY (account_id) REFERENCES gl_accounts(account_id),
|
||||||
|
CONSTRAINT fk_voucher_lines_created_by FOREIGN KEY (created_by) REFERENCES users(user_id),
|
||||||
|
CONSTRAINT uk_voucher_lines_voucher_lineno UNIQUE (voucher_id, line_no),
|
||||||
|
CONSTRAINT chk_debit_amount CHECK (debit_amount >= 0),
|
||||||
|
CONSTRAINT chk_credit_amount CHECK (credit_amount >= 0),
|
||||||
|
CONSTRAINT chk_either_debit_or_credit CHECK ((debit_amount > 0 OR credit_amount > 0) AND NOT (debit_amount > 0 AND credit_amount > 0))
|
||||||
|
);
|
||||||
|
CREATE INDEX idx_voucher_lines_voucher_id ON voucher_lines(voucher_id);
|
||||||
|
CREATE INDEX idx_voucher_lines_account_id ON voucher_lines(account_id);
|
||||||
|
|
||||||
|
-- ===== AUDIT TRAIL (Principle 14: Traceability) =====
|
||||||
|
|
||||||
|
CREATE TABLE audit_logs (
|
||||||
|
audit_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
|
entity_type VARCHAR(50) NOT NULL,
|
||||||
|
entity_id UUID NOT NULL,
|
||||||
|
operation audit_operation NOT NULL,
|
||||||
|
old_value JSONB,
|
||||||
|
new_value JSONB,
|
||||||
|
changed_by UUID NOT NULL,
|
||||||
|
changed_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
reason TEXT,
|
||||||
|
|
||||||
|
CONSTRAINT fk_audit_logs_changed_by FOREIGN KEY (changed_by) REFERENCES users(user_id)
|
||||||
|
);
|
||||||
|
CREATE INDEX idx_audit_logs_entity ON audit_logs(entity_type, entity_id);
|
||||||
|
CREATE INDEX idx_audit_logs_changed_at ON audit_logs(changed_at);
|
||||||
|
CREATE INDEX idx_audit_logs_operation ON audit_logs(operation);
|
||||||
|
|
||||||
|
-- ===== AUDIT TRIGGER (Principle 14: Automatic Traceability) =====
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION audit_trigger()
|
||||||
|
RETURNS TRIGGER AS $$
|
||||||
|
DECLARE
|
||||||
|
v_entity_type VARCHAR;
|
||||||
|
v_operation audit_operation;
|
||||||
|
BEGIN
|
||||||
|
v_entity_type := TG_TABLE_NAME;
|
||||||
|
|
||||||
|
IF TG_OP = 'INSERT' THEN
|
||||||
|
v_operation := 'CREATE'::audit_operation;
|
||||||
|
INSERT INTO audit_logs (entity_type, entity_id, operation, new_value, changed_by, changed_at)
|
||||||
|
VALUES (v_entity_type, NEW.id, v_operation, to_jsonb(NEW), NEW.created_by, CURRENT_TIMESTAMP);
|
||||||
|
RETURN NEW;
|
||||||
|
|
||||||
|
ELSIF TG_OP = 'UPDATE' THEN
|
||||||
|
v_operation := 'UPDATE'::audit_operation;
|
||||||
|
INSERT INTO audit_logs (entity_type, entity_id, operation, old_value, new_value, changed_by, changed_at)
|
||||||
|
VALUES (v_entity_type, OLD.id, v_operation, to_jsonb(OLD), to_jsonb(NEW), NEW.modified_by, CURRENT_TIMESTAMP);
|
||||||
|
RETURN NEW;
|
||||||
|
|
||||||
|
ELSIF TG_OP = 'DELETE' THEN
|
||||||
|
v_operation := 'DELETE'::audit_operation;
|
||||||
|
INSERT INTO audit_logs (entity_type, entity_id, operation, old_value, changed_by, changed_at)
|
||||||
|
VALUES (v_entity_type, OLD.id, v_operation, to_jsonb(OLD), OLD.deleted_by, CURRENT_TIMESTAMP);
|
||||||
|
RETURN OLD;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
RETURN NULL;
|
||||||
|
END;
|
||||||
|
$$ LANGUAGE plpgsql;
|
||||||
|
|
||||||
|
-- Note: Trigger creation for individual tables omitted to keep schema focused.
|
||||||
|
-- In production: CREATE TRIGGER for orders, inventory, products, etc.
|
||||||
|
|
||||||
|
-- ===== VIEWS (Convenience, Principle 3: Data Consistency) =====
|
||||||
|
|
||||||
|
CREATE VIEW v_order_summary AS
|
||||||
|
SELECT
|
||||||
|
o.order_id,
|
||||||
|
o.order_no,
|
||||||
|
c.customer_name,
|
||||||
|
o.order_date,
|
||||||
|
COUNT(ol.line_id) as line_count,
|
||||||
|
SUM(ol.line_total) as calculated_total,
|
||||||
|
o.total_amount,
|
||||||
|
o.status,
|
||||||
|
o.created_at
|
||||||
|
FROM orders o
|
||||||
|
LEFT JOIN customers c ON o.customer_id = c.customer_id
|
||||||
|
LEFT JOIN order_lines ol ON o.order_id = ol.order_id
|
||||||
|
WHERE o.deleted_at IS NULL
|
||||||
|
GROUP BY o.order_id, o.order_no, c.customer_name, o.order_date, o.total_amount, o.status, o.created_at;
|
||||||
|
|
||||||
|
CREATE VIEW v_inventory_summary AS
|
||||||
|
SELECT
|
||||||
|
i.warehouse_id,
|
||||||
|
w.warehouse_name,
|
||||||
|
i.product_id,
|
||||||
|
p.sku,
|
||||||
|
p.product_name,
|
||||||
|
i.qty_on_hand,
|
||||||
|
i.qty_reserved,
|
||||||
|
i.qty_available,
|
||||||
|
i.status,
|
||||||
|
i.modified_at
|
||||||
|
FROM inventory i
|
||||||
|
LEFT JOIN warehouses w ON i.warehouse_id = w.warehouse_id
|
||||||
|
LEFT JOIN products p ON i.product_id = p.product_id
|
||||||
|
WHERE i.deleted_at IS NULL;
|
||||||
|
|
||||||
|
CREATE VIEW v_voucher_totals AS
|
||||||
|
SELECT
|
||||||
|
v.voucher_id,
|
||||||
|
v.voucher_no,
|
||||||
|
v.document_type,
|
||||||
|
v.document_date,
|
||||||
|
SUM(COALESCE(vl.debit_amount, 0)) as calculated_debit,
|
||||||
|
SUM(COALESCE(vl.credit_amount, 0)) as calculated_credit,
|
||||||
|
v.total_debit,
|
||||||
|
v.total_credit,
|
||||||
|
v.status,
|
||||||
|
COUNT(vl.voucher_line_id) as line_count
|
||||||
|
FROM vouchers v
|
||||||
|
LEFT JOIN voucher_lines vl ON v.voucher_id = vl.voucher_id
|
||||||
|
WHERE v.deleted_at IS NULL
|
||||||
|
GROUP BY v.voucher_id, v.voucher_no, v.document_type, v.document_date, v.total_debit, v.total_credit, v.status;
|
||||||
|
|
||||||
|
-- ===== INITIAL DATA (Seed) =====
|
||||||
|
|
||||||
|
-- Create initial admin user
|
||||||
|
INSERT INTO users (user_id, email, password_hash, name, role, status, created_by, created_at)
|
||||||
|
VALUES (
|
||||||
|
'00000000-0000-0000-0000-000000000001'::UUID,
|
||||||
|
'admin@quantengine.dev',
|
||||||
|
'$2b$12$R9h7cIPz0gi.URNNX3kh2OPST9/PgBkqquzi.Ss7KIUgO2t0jWMUe', -- bcrypt: admin123!
|
||||||
|
'System Administrator',
|
||||||
|
'ADMIN',
|
||||||
|
'ACTIVE',
|
||||||
|
'00000000-0000-0000-0000-000000000001'::UUID,
|
||||||
|
CURRENT_TIMESTAMP
|
||||||
|
) ON CONFLICT DO NOTHING;
|
||||||
|
|
||||||
|
-- Create initial warehouses
|
||||||
|
INSERT INTO warehouses (warehouse_code, warehouse_name, location, status, created_by, created_at)
|
||||||
|
VALUES
|
||||||
|
('WH-SEOUL', 'Seoul Main Warehouse', 'Seoul, KR', 'ACTIVE', '00000000-0000-0000-0000-000000000001'::UUID, CURRENT_TIMESTAMP),
|
||||||
|
('WH-BUSAN', 'Busan Distribution Center', 'Busan, KR', 'ACTIVE', '00000000-0000-0000-0000-000000000001'::UUID, CURRENT_TIMESTAMP),
|
||||||
|
('WH-INCHEON', 'Incheon Port Warehouse', 'Incheon, KR', 'ACTIVE', '00000000-0000-0000-0000-000000000001'::UUID, CURRENT_TIMESTAMP)
|
||||||
|
ON CONFLICT DO NOTHING;
|
||||||
|
|
||||||
|
-- Create initial product category
|
||||||
|
INSERT INTO product_categories (category_name, description, status, created_by, created_at)
|
||||||
|
VALUES
|
||||||
|
('Standard Products', 'Regular inventory items', 'ACTIVE', '00000000-0000-0000-0000-000000000001'::UUID, CURRENT_TIMESTAMP),
|
||||||
|
('Premium Products', 'High-value items', 'ACTIVE', '00000000-0000-0000-0000-000000000001'::UUID, CURRENT_TIMESTAMP)
|
||||||
|
ON CONFLICT DO NOTHING;
|
||||||
|
|
||||||
|
-- ===== GRANTS (Security - Principle 23) =====
|
||||||
|
|
||||||
|
-- Application role (read-write for normal operations)
|
||||||
|
CREATE ROLE quantengine_app LOGIN PASSWORD 'CHANGE_ME_PROD';
|
||||||
|
GRANT USAGE ON SCHEMA quantengine TO quantengine_app;
|
||||||
|
GRANT SELECT, INSERT, UPDATE ON ALL TABLES IN SCHEMA quantengine TO quantengine_app;
|
||||||
|
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA quantengine TO quantengine_app;
|
||||||
|
GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA quantengine TO quantengine_app;
|
||||||
|
|
||||||
|
-- Read-only role (for analytics/reporting)
|
||||||
|
CREATE ROLE quantengine_readonly LOGIN PASSWORD 'CHANGE_ME_PROD';
|
||||||
|
GRANT USAGE ON SCHEMA quantengine TO quantengine_readonly;
|
||||||
|
GRANT SELECT ON ALL TABLES IN SCHEMA quantengine TO quantengine_readonly;
|
||||||
|
GRANT SELECT ON ALL VIEWS IN SCHEMA quantengine TO quantengine_readonly;
|
||||||
|
|
||||||
|
-- ===== COMMENTS (Documentation - Principle 28) =====
|
||||||
|
|
||||||
|
COMMENT ON SCHEMA quantengine IS 'OMS·WMS·ERP Unified Platform - Phase 0 Database Schema';
|
||||||
|
COMMENT ON TABLE orders IS 'Order master records (OMS) - Principle 14: Complete audit trail via audit_logs';
|
||||||
|
COMMENT ON TABLE inventory IS 'Warehouse inventory positions (WMS) - qty_available computed from on_hand - reserved';
|
||||||
|
COMMENT ON TABLE audit_logs IS 'Universal change audit trail - every mutation logged for compliance + recovery (Principle 14)';
|
||||||
|
COMMENT ON TABLE vouchers IS 'Accounting journal entries (ERP) - Principle 23: NUMERIC(19,4) for decimal precision';
|
||||||
@@ -0,0 +1,431 @@
|
|||||||
|
# ADR-001: Monolithic SPA Architecture for OMS·WMS·ERP Platform
|
||||||
|
|
||||||
|
**Status**: ACCEPTED (2026-07-26)
|
||||||
|
**Date**: 2026-07-26
|
||||||
|
**Deciders**: Product Manager, Technical Lead, Architecture Team
|
||||||
|
**Related Decisions**: [Strategic Execution Framework (Spec 61)](spec/61_strategic_execution_framework.yaml), [OpenAPI (Spec 63)](spec/63_oms_wms_erp_api_openapi.yaml), [Database Schema (Spec 64)](spec/64_oms_wms_erp_database_schema.sql)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Context
|
||||||
|
|
||||||
|
OMS·WMS·ERP commercialization requires unified platform architecture decision to balance:
|
||||||
|
|
||||||
|
1. **Time-to-Market**: 18-week Phase 0-11 roadmap (4.5 months)
|
||||||
|
2. **Team Capacity**: 13 FTE (4 frontend devs, 2 backend, 1 UX, 2 QA, infrastructure)
|
||||||
|
3. **Maintenance Burden**: Long-term operational cost
|
||||||
|
4. **Scalability**: Peak load (100 concurrent users during peak hours, future 1000+)
|
||||||
|
5. **Team Skill Set**: Experienced Vue 2 team, transitioning to Vue 3 + TypeScript
|
||||||
|
6. **Feature Complexity**: 11 CRUD templates, 5 user roles, audit/compliance requirements
|
||||||
|
|
||||||
|
### Problem Statement
|
||||||
|
|
||||||
|
"Should we build a **single monolithic SPA** or adopt **micro-frontend architecture**?"
|
||||||
|
|
||||||
|
**Tradeoff Matrix**:
|
||||||
|
|
||||||
|
| Factor | Monolithic | Micro-Frontend |
|
||||||
|
|--------|-----------|---|
|
||||||
|
| **Time-to-Market** | ✅ Fast (single build, shared state) | ❌ Slower (coordination, build complexity) |
|
||||||
|
| **Team Efficiency** | ✅ Shared code/patterns | ❌ Potential duplication |
|
||||||
|
| **Deployment Risk** | ⚠️ Full redeploy | ✅ Independent deploys (but coordination complexity) |
|
||||||
|
| **Complexity (Initial)** | ✅ Simple (one codebase) | ❌ Complex (module federation, routing) |
|
||||||
|
| **State Management** | ✅ Centralized (Pinia) | ⚠️ Distributed (synchronization overhead) |
|
||||||
|
| **Learning Curve** | ✅ Single pattern | ❌ Multiple architectural patterns |
|
||||||
|
| **Future Modularity** | ⚠️ Refactoring cost | ✅ Already isolated |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Decision
|
||||||
|
|
||||||
|
**ADOPT: Monolithic SPA Architecture**
|
||||||
|
|
||||||
|
### Rationale
|
||||||
|
|
||||||
|
1. **Time-to-Market (P0 Priority)**
|
||||||
|
- Single Vite build pipeline → faster CI/CD turnaround
|
||||||
|
- Shared Pinia store eliminates cross-module synchronization
|
||||||
|
- No module federation complexity (can add in Phase 12+ if needed)
|
||||||
|
- Team can move fast on core 11 CRUD templates without coordination overhead
|
||||||
|
|
||||||
|
2. **Team Efficiency (13 FTE Constraint)**
|
||||||
|
- 4 frontend devs work on unified codebase (not split into silos)
|
||||||
|
- Shared component library reduces duplication
|
||||||
|
- PR reviews simpler (single review standard)
|
||||||
|
- Onboarding new devs easier (one architectural pattern)
|
||||||
|
|
||||||
|
3. **Scalability Headroom**
|
||||||
|
- 100 concurrent users = 50-100 backend requests/sec (well within SPA capacity)
|
||||||
|
- PostgreSQL backend can handle 10K+ concurrent connections
|
||||||
|
- Browser memory: Pinia store + Vue tree ~5-10MB even at 1000 concurrent
|
||||||
|
- Future scale-out: Independent microservices backend (no frontend change needed)
|
||||||
|
|
||||||
|
4. **Data Consistency (Principle 3)**
|
||||||
|
- Centralized Pinia store = single source of truth for all entities
|
||||||
|
- No client-side replication or sync logic
|
||||||
|
- Audit trail via PostgreSQL audit_logs (all mutations captured)
|
||||||
|
- JWT tokens + RBAC enforced server-side (client trusted for UX only)
|
||||||
|
|
||||||
|
5. **Cost Efficiency**
|
||||||
|
- Single deployment pipeline = lower ops cost
|
||||||
|
- Monolithic codebase = faster debugging and troubleshooting
|
||||||
|
- No microservices orchestration overhead (Kubernetes, service mesh)
|
||||||
|
|
||||||
|
### Architectural Layers (7-Layer Model)
|
||||||
|
|
||||||
|
```
|
||||||
|
┌─────────────────────────────────────────────────────┐
|
||||||
|
│ 1. Presentation Layer (Vue 3 SPA) │
|
||||||
|
│ - 4-layer component hierarchy │
|
||||||
|
│ - Tabler UI + Bootstrap 5 + Storybook │
|
||||||
|
│ - Responsive + WCAG 2.1 AA │
|
||||||
|
├─────────────────────────────────────────────────────┤
|
||||||
|
│ 2. State Management (Pinia) │
|
||||||
|
│ - Entity stores (orders, inventory, products) │
|
||||||
|
│ - UI state (modals, notifications, routing) │
|
||||||
|
│ - Auth store (user, roles, permissions) │
|
||||||
|
├─────────────────────────────────────────────────────┤
|
||||||
|
│ 3. API Client Layer (Axios + Auto-Generated) │
|
||||||
|
│ - Type-safe: OpenAPI → TypeScript SDK │
|
||||||
|
│ - Interceptors: JWT refresh, error handling │
|
||||||
|
│ - Offline support: Request queue (Phase 12+) │
|
||||||
|
├─────────────────────────────────────────────────────┤
|
||||||
|
│ 4. Domain Layer (Business Logic) │
|
||||||
|
│ - Computed properties (qty_available, totals) │
|
||||||
|
│ - Validation rules (duplicate checks, constraints) │
|
||||||
|
│ - Formatters (currency, date, status labels) │
|
||||||
|
├─────────────────────────────────────────────────────┤
|
||||||
|
│ 5. Repository Layer (Data Access Patterns) │
|
||||||
|
│ - Cache strategies (LRU, TTL) │
|
||||||
|
│ - Optimistic updates (e.g., reorder lines) │
|
||||||
|
│ - Pagination (lazy load, infinite scroll) │
|
||||||
|
├─────────────────────────────────────────────────────┤
|
||||||
|
│ 6. Infrastructure (Routing, Navigation, Config) │
|
||||||
|
│ - Vue Router (lazy-loaded per route) │
|
||||||
|
│ - Global error boundaries │
|
||||||
|
│ - Feature flags (Phase 12+) │
|
||||||
|
├─────────────────────────────────────────────────────┤
|
||||||
|
│ 7. External Services (Backend APIs + 3P) │
|
||||||
|
│ - REST APIs (OpenAPI 3.0) │
|
||||||
|
│ - JWT authentication │
|
||||||
|
│ - Real-time updates (WebSocket Phase 12+) │
|
||||||
|
└─────────────────────────────────────────────────────┘
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4-Layer Component Hierarchy
|
||||||
|
|
||||||
|
```
|
||||||
|
Layer 1: Primitive Components
|
||||||
|
├─ ButtonBase, InputBase, SelectBase, TextBase
|
||||||
|
└─ Reusable, no business logic, full a11y
|
||||||
|
|
||||||
|
Layer 2: Typed Field Components
|
||||||
|
├─ TextField, DateField, CurrencyField, StatusField
|
||||||
|
└─ Domain-aware validation, formatting, labels
|
||||||
|
|
||||||
|
Layer 3: Domain Field Components
|
||||||
|
├─ OrderLineField, InventoryField, VoucherLineField
|
||||||
|
└─ Business rules, inline lookups, multi-field composition
|
||||||
|
|
||||||
|
Layer 4: Business Composite Components
|
||||||
|
├─ OrderForm, InventoryTransferWizard, VoucherEditor
|
||||||
|
└─ Full workflows, state orchestration, audit trail
|
||||||
|
```
|
||||||
|
|
||||||
|
### 11 CRUD Templates Standardization
|
||||||
|
|
||||||
|
All 11 entity CRUD flows follow **uniform pattern** (List → Create → Read → Edit → Delete):
|
||||||
|
|
||||||
|
| Entity | API Endpoints | UI Components | Test Coverage |
|
||||||
|
|--------|--------------|---------------|---|
|
||||||
|
| **Order** | 6 (GET, POST, PUT, DELETE + list, detail) | OrderList, OrderDetail, OrderForm | 30 E2E scenarios |
|
||||||
|
| **OrderLine** | Nested CRUD (in order context) | LineEditor (inline in form) | 10 E2E |
|
||||||
|
| **Inventory** | 6 | InventoryList, TransferWizard | 15 E2E |
|
||||||
|
| **StockTransfer** | 6 | TransferForm, ApprovalMatrix | 12 E2E |
|
||||||
|
| **Product** | 6 | ProductList, ProductForm | 10 E2E |
|
||||||
|
| **Supplier** | 6 | SupplierList, SupplierForm | 8 E2E |
|
||||||
|
| **Customer** | 6 | CustomerList, CustomerForm | 8 E2E |
|
||||||
|
| **GLAccount** | 6 | AccountList, AccountForm | 8 E2E |
|
||||||
|
| **Voucher** | 6 | VoucherEditor (line-by-line) | 15 E2E |
|
||||||
|
| **User** | 6 | UserList, UserForm, PermissionMatrix | 12 E2E |
|
||||||
|
| **Warehouse** | 6 | WarehouseList, WarehouseForm | 8 E2E |
|
||||||
|
|
||||||
|
**Total E2E Coverage**: 116 test scenarios (Phase 4 milestone)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Consequences
|
||||||
|
|
||||||
|
### ✅ Positive
|
||||||
|
|
||||||
|
1. **Faster Delivery**
|
||||||
|
- Single build pipeline: ~3 min build time
|
||||||
|
- CI/CD simpler: No cross-module coordination
|
||||||
|
- Feature complete by Phase 4 (week 8) for UAT
|
||||||
|
|
||||||
|
2. **Maintainability**
|
||||||
|
- Unified codebase = easier debugging
|
||||||
|
- All devs understand full system
|
||||||
|
- Refactoring easier (no hidden dependencies)
|
||||||
|
|
||||||
|
3. **Data Consistency**
|
||||||
|
- Pinia store = single source of truth
|
||||||
|
- No sync issues between independent UIs
|
||||||
|
- Audit trail via PostgreSQL (not client-side)
|
||||||
|
|
||||||
|
4. **User Experience**
|
||||||
|
- Instant navigation (no full-page reloads)
|
||||||
|
- Smooth transitions between modules
|
||||||
|
- Consistent look & feel (unified design system)
|
||||||
|
|
||||||
|
5. **Test Coverage**
|
||||||
|
- 50/30/20 pyramid: unit (50%) → integration (30%) → E2E (20%)
|
||||||
|
- All 116 E2E scenarios in single test suite
|
||||||
|
- Deterministic tests (single state source)
|
||||||
|
|
||||||
|
### ⚠️ Negative (Mitigations)
|
||||||
|
|
||||||
|
1. **Monolith Brittleness**
|
||||||
|
- **Problem**: One bad release breaks entire app
|
||||||
|
- **Mitigation**: Strict pre-deployment checklist (Phase 5+), blue-green deployment, 6-point health checks
|
||||||
|
|
||||||
|
2. **Large Bundle Size**
|
||||||
|
- **Problem**: Initial load time if all code bundled
|
||||||
|
- **Mitigation**: Lazy-load routes per module, code split at route level, target <500KB main chunk (Lighthouse 90+)
|
||||||
|
|
||||||
|
3. **Shared State Complexity**
|
||||||
|
- **Problem**: Pinia store grows as features added
|
||||||
|
- **Mitigation**: Modular stores (orders, inventory, users modules), clear naming, documentation
|
||||||
|
|
||||||
|
4. **Scaling to 1000+ Users**
|
||||||
|
- **Problem**: Browser memory, server load
|
||||||
|
- **Mitigation**: Pagination (not all records in memory), connection pooling (PostgreSQL), infrastructure scale-out (Phase 12+)
|
||||||
|
|
||||||
|
5. **Future Microfront-End Transition**
|
||||||
|
- **Problem**: If modularity needed later, refactoring cost
|
||||||
|
- **Mitigation**: Component library + API contracts locked down early, can extract UI module → separate SPA in Phase 13+
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Alternatives Considered
|
||||||
|
|
||||||
|
### 1. Micro-Frontend Architecture (Module Federation)
|
||||||
|
|
||||||
|
**Approach**: Each CRUD entity (Order, Inventory, etc.) as independent webpack Module Federation remote
|
||||||
|
|
||||||
|
**Pros**:
|
||||||
|
- Independent deployments per module
|
||||||
|
- Teams can work in parallel without merge conflicts
|
||||||
|
- Better long-term modularity
|
||||||
|
|
||||||
|
**Cons**:
|
||||||
|
- ❌ Shared state synchronization complexity (events, bus, sync failures)
|
||||||
|
- ❌ Build time: 9-12 min (multiple builds + federation setup)
|
||||||
|
- ❌ 18-week timeline NOT feasible (needs 20+ weeks for coordination overhead)
|
||||||
|
- ❌ Learning curve (few devs experienced in Module Federation)
|
||||||
|
- ❌ CI/CD complexity (version matrix: Order v1-v3 × Inventory v2-v5)
|
||||||
|
|
||||||
|
**Decision**: REJECTED — Too risky for 18-week timeline with 4 frontend devs
|
||||||
|
|
||||||
|
### 2. Headless Backend + Separate Frontends (Web + Mobile)
|
||||||
|
|
||||||
|
**Approach**: Unified .NET backend + Vue SPA (web) + React Native (mobile)
|
||||||
|
|
||||||
|
**Pros**:
|
||||||
|
- Native mobile experience
|
||||||
|
- Backend shared code reuse
|
||||||
|
|
||||||
|
**Cons**:
|
||||||
|
- ❌ Scope creep (mobile adds 4-6 weeks)
|
||||||
|
- ❌ Double maintenance (Vue + React Native)
|
||||||
|
- ❌ Mobile not in Phase 0-11 scope (can add in Phase 13+)
|
||||||
|
|
||||||
|
**Decision**: REJECTED — Out of scope. Mobile deferred to Phase 13+
|
||||||
|
|
||||||
|
### 3. Low-Code Platform (OutSystems, Mendix)
|
||||||
|
|
||||||
|
**Approach**: Rapid CRUD generation, visual development
|
||||||
|
|
||||||
|
**Pros**:
|
||||||
|
- Fastest CRUD generation
|
||||||
|
- Less boilerplate code
|
||||||
|
|
||||||
|
**Cons**:
|
||||||
|
- ❌ Vendor lock-in
|
||||||
|
- ❌ Limited customization for complex workflows (approval matrix, audit trail)
|
||||||
|
- ❌ Higher TCO (licensing)
|
||||||
|
- ❌ Team skill atrophy (no real engineering)
|
||||||
|
|
||||||
|
**Decision**: REJECTED — Does not meet control + compliance requirements
|
||||||
|
|
||||||
|
### 4. Separate Microservices UIs (One SPA per domain: OMS, WMS, ERP)
|
||||||
|
|
||||||
|
**Approach**: 3 independent SPAs (micro-frontends without Module Federation)
|
||||||
|
|
||||||
|
**Pros**:
|
||||||
|
- Clear domain separation
|
||||||
|
- Smaller bundles per SPA
|
||||||
|
|
||||||
|
**Cons**:
|
||||||
|
- ❌ Cross-domain navigation complex (not SPA-like experience)
|
||||||
|
- ❌ Duplicate components (auth, common UI)
|
||||||
|
- ❌ Harder to reorder across domains (OMS order → WMS allocation → ERP GL)
|
||||||
|
- ❌ 3 CI/CD pipelines vs 1
|
||||||
|
|
||||||
|
**Decision**: REJECTED — Poor user experience for cross-domain workflows
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Implementation Plan (Phases 1-4)
|
||||||
|
|
||||||
|
### Phase 1: Dev Environment & CI/CD (Week 1-2)
|
||||||
|
|
||||||
|
- [ ] Vite SPA scaffold + TypeScript strict mode
|
||||||
|
- [ ] Pinia stores structure (orders, inventory, users modules)
|
||||||
|
- [ ] Axios API client + OpenAPI SDK auto-generation
|
||||||
|
- [ ] ESLint + Prettier + pre-commit hooks
|
||||||
|
- [ ] GitHub Actions CI/CD (lint → test → build)
|
||||||
|
- [ ] Storybook setup (6.0+, TypeScript support)
|
||||||
|
|
||||||
|
**Exit Criteria**: All devs can build locally, CI green, Storybook runs
|
||||||
|
|
||||||
|
### Phase 2: Primitive & Composite Layers (Week 3-4)
|
||||||
|
|
||||||
|
- [ ] Layer 1: 30 Primitive components (Button, Input, Select, etc.)
|
||||||
|
- [ ] Layer 2: 12 Typed Field components (TextField, DateField, etc.)
|
||||||
|
- [ ] Storybook documentation for all components
|
||||||
|
- [ ] WCAG 2.1 AA accessibility audit (axe-core)
|
||||||
|
- [ ] Unit tests: 70%+ coverage
|
||||||
|
|
||||||
|
**Exit Criteria**: Storybook published, all primitives tested, accessibility passed
|
||||||
|
|
||||||
|
### Phase 3: Smart Components & State (Week 5-6)
|
||||||
|
|
||||||
|
- [ ] Layer 3: 12 Domain Field components
|
||||||
|
- [ ] Layer 4: 4 Business Composite components (Order, Inventory, Voucher, User)
|
||||||
|
- [ ] Pinia stores + API integration
|
||||||
|
- [ ] Integration tests (Vitest + MSW mocks)
|
||||||
|
- [ ] Real-time data binding
|
||||||
|
|
||||||
|
**Exit Criteria**: State management tested, API mocks working, 50 integration tests pass
|
||||||
|
|
||||||
|
### Phase 4: CRUD Templates & E2E (Week 7-8)
|
||||||
|
|
||||||
|
- [ ] 11 full CRUD forms (List, Create, Read, Edit, Delete)
|
||||||
|
- [ ] Approval workflows (supervisor sign-off for high-value orders)
|
||||||
|
- [ ] Pagination + lazy loading
|
||||||
|
- [ ] 116 E2E test scenarios (Playwright)
|
||||||
|
- [ ] Responsive design (mobile, tablet, desktop)
|
||||||
|
|
||||||
|
**Exit Criteria**: All 11 CRUD screens tested, 116 E2E scenarios pass, Lighthouse 90+
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Related Decisions
|
||||||
|
|
||||||
|
- **ADR-002** (TBD): Authentication & Authorization (JWT + RBAC)
|
||||||
|
- **ADR-003** (TBD): State Management Strategy (Pinia module organization)
|
||||||
|
- **ADR-004** (TBD): Component Library Versioning (npm @quantengine/ui)
|
||||||
|
- **Strategic Execution Framework** (Spec 61): 30 principles applied
|
||||||
|
- **OpenAPI Specification** (Spec 63): 30 REST endpoints defined
|
||||||
|
- **Database Schema** (Spec 64): PostgreSQL 3NF design
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Validation Checklist (Phase 0 → Phase 1)
|
||||||
|
|
||||||
|
Before proceeding to Phase 1 development:
|
||||||
|
|
||||||
|
- [ ] All stakeholders agree on monolithic SPA approach
|
||||||
|
- [ ] Component taxonomy approved (4-layer hierarchy)
|
||||||
|
- [ ] 11 CRUD templates mapped to API endpoints
|
||||||
|
- [ ] OpenAPI spec validated by backend team
|
||||||
|
- [ ] Database schema approved by DBA
|
||||||
|
- [ ] Vite scaffold created with TypeScript strict mode
|
||||||
|
- [ ] CI/CD pipeline (GitHub Actions) functional
|
||||||
|
- [ ] Team training: Vue 3 Composition API + Pinia + TypeScript
|
||||||
|
- [ ] Design system finalized (Tabler + custom components)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Appendix A: Bundle Size Strategy
|
||||||
|
|
||||||
|
**Target**: Main chunk <500KB (gzip), total <1MB
|
||||||
|
|
||||||
|
**Strategy**:
|
||||||
|
|
||||||
|
1. **Route-level code splitting**: Lazy-load each CRUD module (orders, inventory, etc.)
|
||||||
|
2. **Dynamic imports**: `import('./orders/OrderForm.vue')`
|
||||||
|
3. **Library externalization**: Vue, Pinia, Axios in separate chunks
|
||||||
|
4. **Tree-shaking**: Remove unused Tabler components at build time
|
||||||
|
5. **Compression**: Gzip (server) + Brotli (CDN)
|
||||||
|
|
||||||
|
**Monitoring**: Bundle analyzer in CI (Phase 5+)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Appendix B: Performance Targets
|
||||||
|
|
||||||
|
| Metric | Target | Rationale |
|
||||||
|
|--------|--------|-----------|
|
||||||
|
| **First Contentful Paint (FCP)** | <2s | Initial render speed |
|
||||||
|
| **Time to Interactive (TTI)** | <3s | User can interact |
|
||||||
|
| **Largest Contentful Paint (LCP)** | <2.5s | Main content visible |
|
||||||
|
| **Cumulative Layout Shift (CLS)** | <0.1 | Visual stability |
|
||||||
|
| **API response time (P95)** | <250ms | Backend performance |
|
||||||
|
| **Database query (P95)** | <100ms | Query optimization |
|
||||||
|
| **Concurrent users (initial)** | 100 | Phase 0-8 capacity |
|
||||||
|
| **Concurrent users (future)** | 1000+ | Phase 12+ infrastructure scale |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Appendix C: Team Structure (13 FTE)
|
||||||
|
|
||||||
|
```
|
||||||
|
Product Manager (1)
|
||||||
|
├─ Requirements gathering, stakeholder communication
|
||||||
|
│
|
||||||
|
Technical Lead / Architect (1)
|
||||||
|
├─ Architecture decisions, code review
|
||||||
|
│
|
||||||
|
Frontend Development Team (4)
|
||||||
|
├─ Lead FE Dev (1): Component library, design system
|
||||||
|
├─ Senior FE Dev (1): State management, API integration
|
||||||
|
├─ Mid-Level FE Dev (2): CRUD templates, E2E tests
|
||||||
|
│
|
||||||
|
Backend Development Team (2)
|
||||||
|
├─ API development (.NET)
|
||||||
|
├─ Database optimization
|
||||||
|
│
|
||||||
|
UX/UI Designer (1)
|
||||||
|
├─ Figma designs, accessibility audit
|
||||||
|
│
|
||||||
|
QA Team (2)
|
||||||
|
├─ Automation (Playwright)
|
||||||
|
├─ Manual testing + UAT coordination
|
||||||
|
│
|
||||||
|
DevOps/SRE (1)
|
||||||
|
├─ CI/CD pipeline, monitoring, deployment
|
||||||
|
│
|
||||||
|
Security Specialist (0.5 contractor)
|
||||||
|
├─ Security audit, OWASP validation
|
||||||
|
│
|
||||||
|
Technical Writer (0.5)
|
||||||
|
├─ API docs, user guides, wiki
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Sign-Off
|
||||||
|
|
||||||
|
- **Product Manager**: _________________ Date: _______
|
||||||
|
- **Technical Lead**: _________________ Date: _______
|
||||||
|
- **Backend Lead**: _________________ Date: _______
|
||||||
|
- **Frontend Lead**: _________________ Date: _______
|
||||||
|
- **QA Lead**: _________________ Date: _______
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Document Version**: 1.0
|
||||||
|
**Last Updated**: 2026-07-26
|
||||||
|
**Next Review**: Phase 1 completion (2026-08-09)
|
||||||
@@ -0,0 +1,927 @@
|
|||||||
|
# Component Taxonomy: 4-Layer Architecture for OMS·WMS·ERP SPA
|
||||||
|
|
||||||
|
**Status**: DRAFT (Phase 0, requires Figma finalization)
|
||||||
|
**Date**: 2026-07-26
|
||||||
|
**Related**: [ADR-001 (Spec 65)](spec/65_adr_001_monolithic_spa_architecture.md), [OpenAPI (Spec 63)](spec/63_oms_wms_erp_api_openapi.yaml)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
**Component Hierarchy**: 4 layers, 65 total components across OMS/WMS/ERP domains
|
||||||
|
|
||||||
|
```
|
||||||
|
┌─────────────────────────────────────────────────────────────────┐
|
||||||
|
│ Layer 4: Business Composite (11 CRUD Workflows) │
|
||||||
|
│ └─ OrderForm, InventoryTransferWizard, VoucherEditor, etc. │
|
||||||
|
├─────────────────────────────────────────────────────────────────┤
|
||||||
|
│ Layer 3: Domain Fields (12 Domain-Specific Inputs) │
|
||||||
|
│ └─ OrderLineField, InventoryField, VoucherLineField, etc. │
|
||||||
|
├─────────────────────────────────────────────────────────────────┤
|
||||||
|
│ Layer 2: Typed Fields (12 Type-Safe Inputs) │
|
||||||
|
│ └─ TextField, DateField, CurrencyField, StatusField, etc. │
|
||||||
|
├─────────────────────────────────────────────────────────────────┤
|
||||||
|
│ Layer 1: Primitives (30 UI Building Blocks) │
|
||||||
|
│ └─ Button, Input, Select, Table, Card, Badge, etc. │
|
||||||
|
└─────────────────────────────────────────────────────────────────┘
|
||||||
|
```
|
||||||
|
|
||||||
|
**Design System**: Tabler UI (Bootstrap 5) + Storybook 7.0+
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Layer 1: Primitive Components (30)
|
||||||
|
|
||||||
|
### Purpose
|
||||||
|
Reusable UI elements with **zero business logic**, full accessibility (WCAG 2.1 AA), typed props, consistent behavior.
|
||||||
|
|
||||||
|
### Folder Structure
|
||||||
|
```
|
||||||
|
src/components/primitives/
|
||||||
|
├─ Button/
|
||||||
|
│ ├─ ButtonBase.vue
|
||||||
|
│ ├─ ButtonBase.stories.ts
|
||||||
|
│ └─ ButtonBase.spec.ts
|
||||||
|
├─ Input/
|
||||||
|
│ ├─ InputBase.vue
|
||||||
|
│ ├─ InputBase.stories.ts
|
||||||
|
│ └─ InputBase.spec.ts
|
||||||
|
├─ Select/
|
||||||
|
│ ├─ SelectBase.vue
|
||||||
|
│ ├─ SelectBase.stories.ts
|
||||||
|
│ └─ SelectBase.spec.ts
|
||||||
|
├─ Table/
|
||||||
|
│ ├─ TableBase.vue
|
||||||
|
│ ├─ TableBase.stories.ts
|
||||||
|
│ └─ TableBase.spec.ts
|
||||||
|
├─ Card/
|
||||||
|
│ ├─ CardBase.vue
|
||||||
|
│ └─ CardBase.stories.ts
|
||||||
|
├─ Badge/
|
||||||
|
├─ Modal/
|
||||||
|
├─ Checkbox/
|
||||||
|
├─ Radio/
|
||||||
|
├─ Textarea/
|
||||||
|
├─ Pagination/
|
||||||
|
├─ Alert/
|
||||||
|
├─ Spinner/
|
||||||
|
├─ Tooltip/
|
||||||
|
├─ Dropdown/
|
||||||
|
├─ Tabs/
|
||||||
|
├─ Breadcrumb/
|
||||||
|
├─ NavBar/
|
||||||
|
├─ Sidebar/
|
||||||
|
├─ Icon/
|
||||||
|
└─ Link/
|
||||||
|
```
|
||||||
|
|
||||||
|
### Component Specifications
|
||||||
|
|
||||||
|
| Component | Props | Events | A11y | Story |
|
||||||
|
|-----------|-------|--------|------|-------|
|
||||||
|
| **ButtonBase** | variant (primary/secondary/danger), size (sm/md/lg), disabled, loading | click | aria-label, focus-visible | 12 stories |
|
||||||
|
| **InputBase** | type (text/email/number), placeholder, value, disabled, error, required | input, change, blur | label + aria-describedby (error) | 8 stories |
|
||||||
|
| **SelectBase** | options: Array<{value, label}>, value, disabled, multiple | change | aria-label, aria-expanded | 10 stories |
|
||||||
|
| **TableBase** | columns: Array<{key, header, sortable}>, data: any[], onSort | row-click, sort | semantic <table>, scope | 6 stories |
|
||||||
|
| **CardBase** | title, subtitle, footer, clickable | click | semantic <article> | 5 stories |
|
||||||
|
| **BadgeBase** | status (success/danger/warning/info), size | — | aria-label | 8 stories |
|
||||||
|
| **ModalBase** | isOpen, title, onClose | close | role="dialog", focus-trap | 6 stories |
|
||||||
|
| **CheckboxBase** | value, label, disabled, required | change | aria-label, aria-describedby | 6 stories |
|
||||||
|
| **RadioBase** | name, options, value, disabled | change | role="radiogroup" | 5 stories |
|
||||||
|
| **TextareaBase** | value, placeholder, rows, disabled, error | input, change | aria-describedby | 5 stories |
|
||||||
|
| **PaginationBase** | currentPage, totalPages, onPageChange | page-change | aria-label (next/prev) | 4 stories |
|
||||||
|
| **AlertBase** | type (success/error/warning), dismissible, onDismiss | dismiss | role="alert" | 8 stories |
|
||||||
|
| **SpinnerBase** | size, color | — | aria-busy | 4 stories |
|
||||||
|
| **TooltipBase** | text, position (top/bottom/left/right) | show, hide | aria-describedby | 5 stories |
|
||||||
|
| **DropdownBase** | trigger, items: Array<{label, action}>, onSelect | select | role="menu", role="menuitem" | 6 stories |
|
||||||
|
| **TabsBase** | tabs: Array<{id, label, disabled}>, activeId, onTabChange | tab-change | role="tablist", role="tab" | 6 stories |
|
||||||
|
| **BreadcrumbBase** | items: Array<{label, href}> | navigate | aria-label | 3 stories |
|
||||||
|
| **NavBarBase** | title, items: Array<{label, href}>, sticky | navigate | semantic <nav> | 4 stories |
|
||||||
|
| **SidebarBase** | collapsed, items, activeId, onNavigate | navigate | semantic <nav> | 4 stories |
|
||||||
|
| **IconBase** | name (Bootstrap Icons), size, color | — | aria-hidden or aria-label | 8 stories |
|
||||||
|
| **LinkBase** | href, external, disabled, active | click | semantic <a> | 5 stories |
|
||||||
|
|
||||||
|
**Total Layer 1**: 30 components × 6 stories (avg) = **180 Storybook stories**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Layer 2: Typed Field Components (12)
|
||||||
|
|
||||||
|
### Purpose
|
||||||
|
Domain-aware input fields with **automatic validation**, **formatting**, **labels**, and **error messages**. Props are **strongly typed** via TypeScript.
|
||||||
|
|
||||||
|
### Folder Structure
|
||||||
|
```
|
||||||
|
src/components/fields/typed/
|
||||||
|
├─ TextField/
|
||||||
|
│ ├─ TextField.vue
|
||||||
|
│ ├─ TextField.stories.ts
|
||||||
|
│ └─ TextField.spec.ts
|
||||||
|
├─ DateField/
|
||||||
|
├─ DateRangeField/
|
||||||
|
├─ TimeField/
|
||||||
|
├─ CurrencyField/
|
||||||
|
├─ PercentageField/
|
||||||
|
├─ QuantityField/
|
||||||
|
├─ StatusField/
|
||||||
|
├─ SelectField/
|
||||||
|
├─ MultiSelectField/
|
||||||
|
├─ CheckboxField/
|
||||||
|
└─ SearchField/
|
||||||
|
```
|
||||||
|
|
||||||
|
### Component Specifications
|
||||||
|
|
||||||
|
| Component | Input Type | Validation | Formatting | Story Count |
|
||||||
|
|-----------|-----------|-----------|-----------|---|
|
||||||
|
| **TextField** | text/email/password | Length, pattern, required | Trim whitespace | 10 |
|
||||||
|
| **DateField** | date picker | Range, min/max, required | yyyy-MM-dd (ISO 8601) | 8 |
|
||||||
|
| **DateRangeField** | dual date picker | Start ≤ End, required | ISO 8601 pair | 6 |
|
||||||
|
| **TimeField** | time picker | Range, required | HH:mm (24h) | 6 |
|
||||||
|
| **CurrencyField** | number | Decimal (2 places), min (0) | 10,000.00 KRW with comma | 12 |
|
||||||
|
| **PercentageField** | number | Range (0-100), decimal (2) | 0-100% with % suffix | 8 |
|
||||||
|
| **QuantityField** | number | Positive integer, required | No decimal, min (1) | 10 |
|
||||||
|
| **StatusField** | select | Pre-defined enum | Badge-style display | 8 |
|
||||||
|
| **SelectField** | dropdown | Options validation, required | Label + value, search | 10 |
|
||||||
|
| **MultiSelectField** | multi-select | Max items, required | Tag pills, clear all | 8 |
|
||||||
|
| **CheckboxField** | checkbox | Boolean value | Label + description | 6 |
|
||||||
|
| **SearchField** | search input | Debounce (300ms), min length (2) | Real-time suggestion | 10 |
|
||||||
|
|
||||||
|
**TypeScript Interface Example** (TextField):
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
interface TextFieldProps {
|
||||||
|
modelValue: string;
|
||||||
|
label: string;
|
||||||
|
type?: 'text' | 'email' | 'password' | 'url';
|
||||||
|
placeholder?: string;
|
||||||
|
disabled?: boolean;
|
||||||
|
required?: boolean;
|
||||||
|
readonly?: boolean;
|
||||||
|
maxLength?: number;
|
||||||
|
pattern?: string;
|
||||||
|
helpText?: string;
|
||||||
|
errorMessage?: string;
|
||||||
|
showCounter?: boolean; // Character count
|
||||||
|
icon?: string; // Bootstrap Icon name
|
||||||
|
variant?: 'outlined' | 'filled' | 'standard';
|
||||||
|
size?: 'sm' | 'md' | 'lg';
|
||||||
|
validation?: (value: string) => string | null; // Custom validator
|
||||||
|
onUpdate:modelValue: (value: string) => void;
|
||||||
|
onBlur: () => void;
|
||||||
|
onFocus: () => void;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Total Layer 2**: 12 components × 9 stories (avg) = **108 Storybook stories**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Layer 3: Domain Field Components (12)
|
||||||
|
|
||||||
|
### Purpose
|
||||||
|
Business-domain-specific input components that **compose Layer 2 fields**, **enforce business rules**, and provide **inline lookups** (e.g., product autocomplete, customer search).
|
||||||
|
|
||||||
|
### Folder Structure
|
||||||
|
```
|
||||||
|
src/components/fields/domain/
|
||||||
|
├─ OrderLineField/
|
||||||
|
│ ├─ OrderLineField.vue
|
||||||
|
│ ├─ OrderLineField.stories.ts
|
||||||
|
│ └─ OrderLineField.spec.ts
|
||||||
|
├─ InventoryField/
|
||||||
|
├─ VoucherLineField/
|
||||||
|
├─ ProductField/
|
||||||
|
│ ├─ ProductAutocomplete.vue (lookup product by SKU)
|
||||||
|
│ └─ ProductField.vue (combines with price sync)
|
||||||
|
├─ CustomerField/
|
||||||
|
├─ SupplierField/
|
||||||
|
├─ GLAccountField/
|
||||||
|
├─ WarehouseField/
|
||||||
|
├─ StockTransferField/
|
||||||
|
├─ PriceField/
|
||||||
|
└─ DiscountField/
|
||||||
|
```
|
||||||
|
|
||||||
|
### Component Specifications
|
||||||
|
|
||||||
|
| Component | Composes | Business Rules | Lookup | Story |
|
||||||
|
|-----------|----------|-----------------|--------|-------|
|
||||||
|
| **OrderLineField** | CurrencyField, QuantityField, SelectField | Line total = qty × price, validate stock | Product lookup by SKU | 10 |
|
||||||
|
| **InventoryField** | QuantityField, StatusField, SelectField | qty_on_hand ≥ qty_reserved, warn low stock | Warehouse + product combo | 8 |
|
||||||
|
| **VoucherLineField** | CurrencyField, SelectField, Textarea | Debit XOR Credit (not both), balance check | GL account chart of accounts | 10 |
|
||||||
|
| **ProductField** | SearchField, SelectField | Validate SKU exists, sync category + price | Real-time SKU autocomplete | 12 |
|
||||||
|
| **CustomerField** | SearchField, SelectField | Validate customer active, load default terms | Customer name + code search | 10 |
|
||||||
|
| **SupplierField** | SearchField, SelectField | Validate supplier active, load payment terms | Supplier name + code search | 8 |
|
||||||
|
| **GLAccountField** | SelectField | Validate account type matches voucher | GL account hierarchy + balance | 10 |
|
||||||
|
| **WarehouseField** | SelectField | Validate warehouse active, check stock levels | Warehouse dropdown + capacity | 6 |
|
||||||
|
| **StockTransferField** | SelectField, QuantityField | From ≠ To, qty ≤ on_hand, require reason | Warehouse + qty validation | 10 |
|
||||||
|
| **PriceField** | CurrencyField | Validate precision (KIS tick rules), min/max | Price suggestions from history | 10 |
|
||||||
|
| **DiscountField** | PercentageField, CurrencyField | Mutually exclusive %, validate range | Auto-calculate from line total | 8 |
|
||||||
|
| **DateRangeFilterField** | DateRangeField | Start ≤ End, optional (both or neither) | Quick filters (Today, This Week, etc.) | 8 |
|
||||||
|
|
||||||
|
**Example: OrderLineField Props**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
interface OrderLineFieldProps {
|
||||||
|
modelValue: {
|
||||||
|
productId: string;
|
||||||
|
productName: string;
|
||||||
|
quantity: number;
|
||||||
|
unitPrice: number;
|
||||||
|
lineTotal: number;
|
||||||
|
};
|
||||||
|
orderId: string; // For stock validation
|
||||||
|
warehouse?: string; // Default warehouse
|
||||||
|
disabled?: boolean;
|
||||||
|
errorFields?: Array<'quantity' | 'unitPrice' | 'product'>;
|
||||||
|
onUpdate:modelValue: (line: OrderLine) => void;
|
||||||
|
onProductChange: (productId: string) => Promise<Product>;
|
||||||
|
onRemove: () => void;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Total Layer 3**: 12 components × 9 stories (avg) = **108 Storybook stories**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Layer 4: Business Composite Components (11)
|
||||||
|
|
||||||
|
### Purpose
|
||||||
|
Full **workflow components** for CRUD operations (List, Create, Read, Edit, Delete). Each maps to one entity in the OpenAPI spec. Orchestrates state, validation, approval workflows, and audit trails.
|
||||||
|
|
||||||
|
### Folder Structure
|
||||||
|
```
|
||||||
|
src/components/composites/
|
||||||
|
├─ Order/
|
||||||
|
│ ├─ OrderList.vue
|
||||||
|
│ ├─ OrderDetail.vue
|
||||||
|
│ ├─ OrderForm.vue
|
||||||
|
│ ├─ OrderForm.stories.ts
|
||||||
|
│ └─ OrderForm.spec.ts
|
||||||
|
├─ Inventory/
|
||||||
|
│ ├─ InventoryList.vue
|
||||||
|
│ ├─ InventoryDetail.vue
|
||||||
|
│ └─ InventoryTransferWizard.vue
|
||||||
|
├─ Product/
|
||||||
|
│ ├─ ProductList.vue
|
||||||
|
│ ├─ ProductForm.vue
|
||||||
|
│ └─ ProductDetail.vue
|
||||||
|
├─ Customer/
|
||||||
|
├─ Supplier/
|
||||||
|
├─ GLAccount/
|
||||||
|
├─ Voucher/
|
||||||
|
│ ├─ VoucherList.vue
|
||||||
|
│ ├─ VoucherEditor.vue (line-by-line editing)
|
||||||
|
│ └─ VoucherApprovalMatrix.vue
|
||||||
|
├─ User/
|
||||||
|
│ ├─ UserList.vue
|
||||||
|
│ ├─ UserForm.vue
|
||||||
|
│ └─ PermissionMatrix.vue
|
||||||
|
├─ Warehouse/
|
||||||
|
└─ StockTransfer/
|
||||||
|
```
|
||||||
|
|
||||||
|
### CRUD Template Pattern (ALL 11 follow same structure)
|
||||||
|
|
||||||
|
**Standard Workflow**:
|
||||||
|
```
|
||||||
|
List View (table + filters + pagination)
|
||||||
|
↓
|
||||||
|
├─→ Create (form + validation + submit)
|
||||||
|
├─→ Read (detail view, read-only)
|
||||||
|
├─→ Edit (form + validation + submit)
|
||||||
|
└─→ Delete (confirmation + soft-delete + audit)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Component Specifications (11 entities)
|
||||||
|
|
||||||
|
#### 1. **Order** (OMS)
|
||||||
|
```typescript
|
||||||
|
interface OrderForm {
|
||||||
|
orderId?: string; // undefined = CREATE
|
||||||
|
orderNo: string; // Auto-generate on CREATE
|
||||||
|
customerId: string; // Required, lookup
|
||||||
|
orderDate: string; // ISO date
|
||||||
|
lineItems: OrderLineField[]; // Min 1, max 100
|
||||||
|
totalAmount: number; // Computed from lines
|
||||||
|
status: 'DRAFT' | 'CONFIRMED' | 'SHIPPED' | 'DELIVERED' | 'CANCELLED';
|
||||||
|
createdBy: string; // Read-only
|
||||||
|
createdAt: string; // Read-only
|
||||||
|
}
|
||||||
|
|
||||||
|
Workflow:
|
||||||
|
- Create: Customer lookup → Line editor (add/edit/remove) → Confirm
|
||||||
|
- Edit: Locked after CONFIRMED (read-only)
|
||||||
|
- Delete: Soft-delete + audit trail
|
||||||
|
- Approval: Required if total > 1M KRW (supervisor)
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 2. **OrderLine** (Nested in Order)
|
||||||
|
```typescript
|
||||||
|
interface OrderLineField {
|
||||||
|
lineNo: number;
|
||||||
|
productId: string;
|
||||||
|
quantity: number;
|
||||||
|
unitPrice: number;
|
||||||
|
lineTotal: number; // Computed
|
||||||
|
}
|
||||||
|
|
||||||
|
Rules:
|
||||||
|
- Validate product exists + stock available
|
||||||
|
- Auto-fetch price from product master
|
||||||
|
- Auto-calculate line total
|
||||||
|
- Block if product inactive
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 3. **Inventory** (WMS)
|
||||||
|
```typescript
|
||||||
|
interface InventoryField {
|
||||||
|
warehouseId: string;
|
||||||
|
productId: string;
|
||||||
|
qtyOnHand: number;
|
||||||
|
qtyReserved: number;
|
||||||
|
qtyAvailable: number; // Computed: on_hand - reserved
|
||||||
|
lastAdjustmentDate: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
Workflow:
|
||||||
|
- Read: Dashboard + drill-down by product/warehouse
|
||||||
|
- Adjust: Quantity adjustment form (reason + approval for >$5K impact)
|
||||||
|
- Transfer: StockTransferWizard (from → to warehouse, approval)
|
||||||
|
- Alert: Low stock warning (<minimum threshold)
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 4. **StockTransfer** (WMS)
|
||||||
|
```typescript
|
||||||
|
interface StockTransferForm {
|
||||||
|
transferId?: string;
|
||||||
|
transferNo: string; // Auto-generate
|
||||||
|
fromWarehouseId: string;
|
||||||
|
toWarehouseId: string;
|
||||||
|
productId: string;
|
||||||
|
quantity: number;
|
||||||
|
reason: string; // Required
|
||||||
|
status: 'REQUESTED' | 'APPROVED' | 'SHIPPED' | 'RECEIVED' | 'CANCELLED';
|
||||||
|
}
|
||||||
|
|
||||||
|
Workflow:
|
||||||
|
- Create: Wizard (select warehouses → select product → qty → reason)
|
||||||
|
- Approve: Supervisor approval matrix
|
||||||
|
- Ship: Mark shipped (creates WMS receipt task)
|
||||||
|
- Receive: Confirm receipt (updates inventory)
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 5. **Product** (ERP Master)
|
||||||
|
```typescript
|
||||||
|
interface ProductForm {
|
||||||
|
productId?: string;
|
||||||
|
sku: string; // Unique, required
|
||||||
|
productName: string;
|
||||||
|
categoryId: string;
|
||||||
|
unitOfMeasure: 'EA' | 'KG' | 'M' | 'L' | 'BOX';
|
||||||
|
status: 'ACTIVE' | 'INACTIVE' | 'OBSOLETE';
|
||||||
|
}
|
||||||
|
|
||||||
|
Workflow:
|
||||||
|
- Create: SKU validation (uniqueness), category lookup
|
||||||
|
- Edit: Locked after first inventory transaction (prevent SKU change)
|
||||||
|
- Delete: Soft-delete if no inventory/orders reference
|
||||||
|
- List: Search by SKU/name, filter by category + status
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 6. **Customer** (OMS Master)
|
||||||
|
```typescript
|
||||||
|
interface CustomerForm {
|
||||||
|
customerId?: string;
|
||||||
|
customerCode: string; // Unique
|
||||||
|
customerName: string;
|
||||||
|
email: string;
|
||||||
|
phone: string;
|
||||||
|
businessRegistration: string;
|
||||||
|
status: 'ACTIVE' | 'INACTIVE' | 'SUSPENDED';
|
||||||
|
}
|
||||||
|
|
||||||
|
Workflow:
|
||||||
|
- Create: Email validation, duplicate check
|
||||||
|
- Edit: Track customer credit history + order count
|
||||||
|
- Delete: Soft-delete if orders reference
|
||||||
|
- List: Search by code/name, filter by status
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 7. **Supplier** (ERP Master)
|
||||||
|
```typescript
|
||||||
|
interface SupplierForm {
|
||||||
|
supplierId?: string;
|
||||||
|
supplierCode: string;
|
||||||
|
supplierName: string;
|
||||||
|
email: string;
|
||||||
|
phone: string;
|
||||||
|
businessRegistration: string;
|
||||||
|
status: 'ACTIVE' | 'INACTIVE' | 'SUSPENDED';
|
||||||
|
}
|
||||||
|
|
||||||
|
Workflow:
|
||||||
|
- Similar to Customer, but:
|
||||||
|
- Track payment terms (COD, NET30, etc.)
|
||||||
|
- List: Filter by payment terms
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 8. **GLAccount** (ERP)
|
||||||
|
```typescript
|
||||||
|
interface GLAccountForm {
|
||||||
|
accountId?: string;
|
||||||
|
accountCode: string; // e.g., 1000 (assets), 2000 (liabilities)
|
||||||
|
accountName: string;
|
||||||
|
accountType: 'ASSET' | 'LIABILITY' | 'EQUITY' | 'REVENUE' | 'EXPENSE';
|
||||||
|
status: 'ACTIVE' | 'INACTIVE';
|
||||||
|
}
|
||||||
|
|
||||||
|
Workflow:
|
||||||
|
- Create: Validate account code format (numeric, hierarchical)
|
||||||
|
- Edit: Locked after first GL posting (prevent type change)
|
||||||
|
- Delete: Soft-delete if balances > 0
|
||||||
|
- List: Filter by account type + status
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 9. **Voucher** (ERP GL Entry)
|
||||||
|
```typescript
|
||||||
|
interface VoucherForm {
|
||||||
|
voucherId?: string;
|
||||||
|
voucherNo: string; // Auto-generate per document type
|
||||||
|
documentDate: string;
|
||||||
|
documentType: 'PURCHASE' | 'SALES' | 'JOURNAL' | 'ADJUSTMENT';
|
||||||
|
voucherLines: VoucherLineField[]; // Min 2, must balance
|
||||||
|
totalDebit: number; // Computed
|
||||||
|
totalCredit: number; // Computed
|
||||||
|
status: 'DRAFT' | 'POSTED' | 'APPROVED' | 'VOIDED';
|
||||||
|
}
|
||||||
|
|
||||||
|
Workflow:
|
||||||
|
- Line Editor: Add line → select GL account → debit OR credit → auto-balance check
|
||||||
|
- Validation: Total debit = total credit (must balance)
|
||||||
|
- Posting: Change status DRAFT → POSTED (creates GL entries, irreversible)
|
||||||
|
- Reversal: Create reversal voucher (new ID, status POSTED), don't delete
|
||||||
|
- Approval: CFO approval for all POSTED vouchers (Phase 8+)
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 10. **User** (Admin)
|
||||||
|
```typescript
|
||||||
|
interface UserForm {
|
||||||
|
userId?: string;
|
||||||
|
email: string; // Unique
|
||||||
|
name: string;
|
||||||
|
password: string; // Required on CREATE, optional on UPDATE
|
||||||
|
role: 'ADMIN' | 'MANAGER' | 'OPERATOR' | 'VIEWER' | 'ANALYST';
|
||||||
|
status: 'ACTIVE' | 'INACTIVE';
|
||||||
|
}
|
||||||
|
|
||||||
|
Workflow:
|
||||||
|
- Create: Email validation, temp password or email reset link
|
||||||
|
- Edit: Only admin + self can edit
|
||||||
|
- Password Reset: Email-based reset link (60 min expiry)
|
||||||
|
- Delete: Soft-delete, preserve audit trail (keep created_by reference)
|
||||||
|
- Permissions: PermissionMatrix (role → resource → action)
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 11. **Warehouse** (WMS Master)
|
||||||
|
```typescript
|
||||||
|
interface WarehouseForm {
|
||||||
|
warehouseId?: string;
|
||||||
|
warehouseCode: string; // e.g., WH-SEOUL
|
||||||
|
warehouseName: string;
|
||||||
|
location: string;
|
||||||
|
status: 'ACTIVE' | 'INACTIVE';
|
||||||
|
}
|
||||||
|
|
||||||
|
Workflow:
|
||||||
|
- Create: Validate location format
|
||||||
|
- Edit: Locked after first inventory transaction (prevent location change)
|
||||||
|
- Delete: Soft-delete if inventory records reference
|
||||||
|
- List: Filter by status
|
||||||
|
```
|
||||||
|
|
||||||
|
**Total Layer 4**: 11 components × 5 stories (avg for CRUD workflows) + 50 E2E tests = **55 Storybook stories + 116 E2E scenarios**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Folder Structure (Complete)
|
||||||
|
|
||||||
|
```
|
||||||
|
src/
|
||||||
|
├─ components/
|
||||||
|
│ ├─ primitives/
|
||||||
|
│ │ ├─ Button/
|
||||||
|
│ │ │ ├─ ButtonBase.vue
|
||||||
|
│ │ │ ├─ ButtonBase.stories.ts
|
||||||
|
│ │ │ ├─ ButtonBase.spec.ts
|
||||||
|
│ │ │ └─ types.ts
|
||||||
|
│ │ ├─ Input/
|
||||||
|
│ │ ├─ Select/
|
||||||
|
│ │ ├─ Table/
|
||||||
|
│ │ ├─ Card/
|
||||||
|
│ │ ├─ Badge/
|
||||||
|
│ │ ├─ Modal/
|
||||||
|
│ │ ├─ Checkbox/
|
||||||
|
│ │ ├─ Radio/
|
||||||
|
│ │ ├─ Textarea/
|
||||||
|
│ │ ├─ Pagination/
|
||||||
|
│ │ ├─ Alert/
|
||||||
|
│ │ ├─ Spinner/
|
||||||
|
│ │ ├─ Tooltip/
|
||||||
|
│ │ ├─ Dropdown/
|
||||||
|
│ │ ├─ Tabs/
|
||||||
|
│ │ ├─ Breadcrumb/
|
||||||
|
│ │ ├─ NavBar/
|
||||||
|
│ │ ├─ Sidebar/
|
||||||
|
│ │ ├─ Icon/
|
||||||
|
│ │ ├─ Link/
|
||||||
|
│ │ └─ index.ts (export all)
|
||||||
|
│ │
|
||||||
|
│ ├─ fields/
|
||||||
|
│ │ ├─ typed/
|
||||||
|
│ │ │ ├─ TextField/
|
||||||
|
│ │ │ ├─ DateField/
|
||||||
|
│ │ │ ├─ DateRangeField/
|
||||||
|
│ │ │ ├─ TimeField/
|
||||||
|
│ │ │ ├─ CurrencyField/
|
||||||
|
│ │ │ ├─ PercentageField/
|
||||||
|
│ │ │ ├─ QuantityField/
|
||||||
|
│ │ │ ├─ StatusField/
|
||||||
|
│ │ │ ├─ SelectField/
|
||||||
|
│ │ │ ├─ MultiSelectField/
|
||||||
|
│ │ │ ├─ CheckboxField/
|
||||||
|
│ │ │ ├─ SearchField/
|
||||||
|
│ │ │ └─ index.ts
|
||||||
|
│ │ │
|
||||||
|
│ │ └─ domain/
|
||||||
|
│ │ ├─ OrderLineField/
|
||||||
|
│ │ ├─ InventoryField/
|
||||||
|
│ │ ├─ VoucherLineField/
|
||||||
|
│ │ ├─ ProductField/
|
||||||
|
│ │ ├─ CustomerField/
|
||||||
|
│ │ ├─ SupplierField/
|
||||||
|
│ │ ├─ GLAccountField/
|
||||||
|
│ │ ├─ WarehouseField/
|
||||||
|
│ │ ├─ StockTransferField/
|
||||||
|
│ │ ├─ PriceField/
|
||||||
|
│ │ ├─ DiscountField/
|
||||||
|
│ │ ├─ DateRangeFilterField/
|
||||||
|
│ │ └─ index.ts
|
||||||
|
│ │
|
||||||
|
│ └─ composites/
|
||||||
|
│ ├─ Order/
|
||||||
|
│ │ ├─ OrderList.vue
|
||||||
|
│ │ ├─ OrderDetail.vue
|
||||||
|
│ │ ├─ OrderForm.vue
|
||||||
|
│ │ ├─ OrderForm.stories.ts
|
||||||
|
│ │ ├─ OrderForm.spec.ts
|
||||||
|
│ │ └─ types.ts
|
||||||
|
│ ├─ Inventory/
|
||||||
|
│ ├─ Product/
|
||||||
|
│ ├─ Customer/
|
||||||
|
│ ├─ Supplier/
|
||||||
|
│ ├─ GLAccount/
|
||||||
|
│ ├─ Voucher/
|
||||||
|
│ ├─ User/
|
||||||
|
│ ├─ Warehouse/
|
||||||
|
│ ├─ StockTransfer/
|
||||||
|
│ └─ index.ts
|
||||||
|
│
|
||||||
|
├─ stores/ (Pinia)
|
||||||
|
│ ├─ modules/
|
||||||
|
│ │ ├─ orders.ts
|
||||||
|
│ │ ├─ inventory.ts
|
||||||
|
│ │ ├─ products.ts
|
||||||
|
│ │ ├─ customers.ts
|
||||||
|
│ │ ├─ suppliers.ts
|
||||||
|
│ │ ├─ glAccounts.ts
|
||||||
|
│ │ ├─ vouchers.ts
|
||||||
|
│ │ ├─ users.ts
|
||||||
|
│ │ ├─ warehouses.ts
|
||||||
|
│ │ └─ stockTransfers.ts
|
||||||
|
│ ├─ useAuth.ts
|
||||||
|
│ ├─ useNotification.ts
|
||||||
|
│ ├─ useRouter.ts
|
||||||
|
│ └─ index.ts
|
||||||
|
│
|
||||||
|
├─ views/ (Page Components)
|
||||||
|
│ ├─ Order/
|
||||||
|
│ │ ├─ OrderListPage.vue
|
||||||
|
│ │ ├─ OrderDetailPage.vue
|
||||||
|
│ │ └─ OrderCreatePage.vue
|
||||||
|
│ ├─ Inventory/
|
||||||
|
│ ├─ Product/
|
||||||
|
│ ├─ Customer/
|
||||||
|
│ ├─ Supplier/
|
||||||
|
│ ├─ GLAccount/
|
||||||
|
│ ├─ Voucher/
|
||||||
|
│ ├─ User/
|
||||||
|
│ ├─ Warehouse/
|
||||||
|
│ └─ StockTransfer/
|
||||||
|
│
|
||||||
|
├─ layouts/
|
||||||
|
│ ├─ AdminLayout.vue (sidebar + topbar)
|
||||||
|
│ ├─ BlankLayout.vue (login page)
|
||||||
|
│ └─ ReportLayout.vue (full-width for exports)
|
||||||
|
│
|
||||||
|
├─ composables/ (Vue Composition API utilities)
|
||||||
|
│ ├─ useForm.ts (form state + validation)
|
||||||
|
│ ├─ useList.ts (pagination + filtering)
|
||||||
|
│ ├─ usePagination.ts (page navigation)
|
||||||
|
│ ├─ useApi.ts (API client wrapper)
|
||||||
|
│ ├─ useNotification.ts (toast/snackbar)
|
||||||
|
│ ├─ useValidation.ts (field validation rules)
|
||||||
|
│ └─ useApproval.ts (approval workflow)
|
||||||
|
│
|
||||||
|
├─ services/
|
||||||
|
│ ├─ api/ (auto-generated from OpenAPI)
|
||||||
|
│ │ ├─ orderApi.ts
|
||||||
|
│ │ ├─ inventoryApi.ts
|
||||||
|
│ │ ├─ productApi.ts
|
||||||
|
│ │ └─ ...
|
||||||
|
│ ├─ validators/
|
||||||
|
│ │ ├─ orderValidators.ts
|
||||||
|
│ │ ├─ inventoryValidators.ts
|
||||||
|
│ │ └─ ...
|
||||||
|
│ └─ formatters/
|
||||||
|
│ ├─ currencyFormatter.ts
|
||||||
|
│ ├─ dateFormatter.ts
|
||||||
|
│ └─ statusFormatter.ts
|
||||||
|
│
|
||||||
|
├─ types/
|
||||||
|
│ ├─ models.ts (OpenAPI models exported)
|
||||||
|
│ ├─ api.ts (API types)
|
||||||
|
│ └─ domain.ts (domain-specific types)
|
||||||
|
│
|
||||||
|
├─ styles/
|
||||||
|
│ ├─ global.scss
|
||||||
|
│ ├─ variables.scss
|
||||||
|
│ ├─ tabler-overrides.scss
|
||||||
|
│ └─ animations.scss
|
||||||
|
│
|
||||||
|
├─ App.vue
|
||||||
|
├─ main.ts
|
||||||
|
└─ router.ts
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Storybook Organization
|
||||||
|
|
||||||
|
### Storybook File Structure
|
||||||
|
```
|
||||||
|
.storybook/
|
||||||
|
├─ main.ts (config)
|
||||||
|
├─ preview.ts (global setup)
|
||||||
|
├─ preview-head.html (Tabler CDN + custom fonts)
|
||||||
|
├─ decorators/
|
||||||
|
│ ├─ withPinia.ts (global store)
|
||||||
|
│ ├─ withRouter.ts (mock routing)
|
||||||
|
│ ├─ withTheme.ts (light/dark mode)
|
||||||
|
│ └─ withViewport.ts (responsive preview)
|
||||||
|
└─ manager.ts (UI customization)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Storybook Navigation
|
||||||
|
```
|
||||||
|
Storybook
|
||||||
|
├─ 📦 Primitives (Layer 1) — 30 components, 180 stories
|
||||||
|
│ ├─ Button (12 stories)
|
||||||
|
│ ├─ Input (8 stories)
|
||||||
|
│ ├─ Select (10 stories)
|
||||||
|
│ ├─ Table (6 stories)
|
||||||
|
│ ├─ Card (5 stories)
|
||||||
|
│ ├─ Badge (8 stories)
|
||||||
|
│ └─ ... (14 more)
|
||||||
|
│
|
||||||
|
├─ 📝 Typed Fields (Layer 2) — 12 components, 108 stories
|
||||||
|
│ ├─ TextField (10 stories)
|
||||||
|
│ ├─ DateField (8 stories)
|
||||||
|
│ ├─ CurrencyField (12 stories)
|
||||||
|
│ ├─ StatusField (8 stories)
|
||||||
|
│ └─ ... (8 more)
|
||||||
|
│
|
||||||
|
├─ 🎯 Domain Fields (Layer 3) — 12 components, 108 stories
|
||||||
|
│ ├─ OrderLineField (10 stories)
|
||||||
|
│ ├─ ProductField (12 stories)
|
||||||
|
│ ├─ CustomerField (10 stories)
|
||||||
|
│ └─ ... (9 more)
|
||||||
|
│
|
||||||
|
├─ 🏢 Business Composites (Layer 4) — 11 components, 55 stories
|
||||||
|
│ ├─ Order CRUD (5 stories: List, Create, Read, Edit, Delete)
|
||||||
|
│ ├─ Inventory CRUD (5 stories)
|
||||||
|
│ ├─ Product CRUD (5 stories)
|
||||||
|
│ └─ ... (8 more)
|
||||||
|
│
|
||||||
|
├─ 🎨 Design System (Typography, Colors, Icons)
|
||||||
|
│ ├─ Colors (Tabler palette + custom)
|
||||||
|
│ ├─ Typography (headings, body, mono)
|
||||||
|
│ └─ Icons (Bootstrap Icons 30 most-used)
|
||||||
|
│
|
||||||
|
└─ ✅ Accessibility (WCAG 2.1 AA checklist per component)
|
||||||
|
├─ Keyboard navigation test
|
||||||
|
├─ Screen reader verification
|
||||||
|
└─ Color contrast validation
|
||||||
|
```
|
||||||
|
|
||||||
|
### Storybook Configuration (main.ts)
|
||||||
|
```typescript
|
||||||
|
export default {
|
||||||
|
stories: [
|
||||||
|
'../src/components/primitives/**/*.stories.ts',
|
||||||
|
'../src/components/fields/typed/**/*.stories.ts',
|
||||||
|
'../src/components/fields/domain/**/*.stories.ts',
|
||||||
|
'../src/components/composites/**/*.stories.ts',
|
||||||
|
],
|
||||||
|
addons: [
|
||||||
|
'@storybook/addon-essentials',
|
||||||
|
'@storybook/addon-a11y', // Accessibility
|
||||||
|
'@storybook/addon-viewport', // Responsive
|
||||||
|
'@storybook/addon-interactions', // User interactions
|
||||||
|
'@storybook/addon-controls', // Dynamic props
|
||||||
|
'@storybook/addon-measure', // Inspect dimensions
|
||||||
|
],
|
||||||
|
framework: '@storybook/vue3',
|
||||||
|
docs: {
|
||||||
|
autodocs: true, // Auto-generate docs from comments
|
||||||
|
},
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Testing Strategy
|
||||||
|
|
||||||
|
### Test Distribution (Testing Pyramid — Principle 26)
|
||||||
|
|
||||||
|
```
|
||||||
|
/\ E2E (20%)
|
||||||
|
/ \ 50 scenarios for full workflows
|
||||||
|
/____\
|
||||||
|
/ \ Integration (30%)
|
||||||
|
/ \ 150 tests for component interactions
|
||||||
|
/_________ \
|
||||||
|
/ \ Unit (50%)
|
||||||
|
/ \ 350 tests for individual components
|
||||||
|
/_____________\
|
||||||
|
```
|
||||||
|
|
||||||
|
### Unit Tests (Layer 1-3 components)
|
||||||
|
- **Primitives**: Button click, Input change events, Select options
|
||||||
|
- **Typed Fields**: Validation rules, formatting (date → ISO, currency → comma-sep)
|
||||||
|
- **Domain Fields**: Business rule checks, API call mocking
|
||||||
|
|
||||||
|
**File**: `src/components/**/*.spec.ts`
|
||||||
|
**Runner**: Vitest + @testing-library/vue
|
||||||
|
**Coverage Target**: 70%+
|
||||||
|
|
||||||
|
### Integration Tests (Layer 4 composites)
|
||||||
|
- **CRUD Workflows**: Create → Read → Update → Delete
|
||||||
|
- **Validation Chains**: Form validation + API error handling
|
||||||
|
- **State Management**: Pinia store mutations + selections
|
||||||
|
|
||||||
|
**File**: `src/components/composites/**/*.spec.ts`
|
||||||
|
**Runner**: Vitest + MSW (Mock Service Worker)
|
||||||
|
**Mocks**: OpenAPI endpoints
|
||||||
|
|
||||||
|
### E2E Tests (Full User Journeys)
|
||||||
|
- **Order Flow**: Create customer → Create order → Ship → Deliver
|
||||||
|
- **Approval Matrix**: High-value order → Supervisor approval → Finance review
|
||||||
|
- **Inventory Adjustment**: Adjust stock → Audit log verification
|
||||||
|
|
||||||
|
**File**: `tests/e2e/**/*.spec.ts`
|
||||||
|
**Runner**: Playwright (6.0+)
|
||||||
|
**Scenarios**: 116 total (11 CRUD × 10-15 scenarios per entity)
|
||||||
|
|
||||||
|
**Example E2E Test**:
|
||||||
|
```typescript
|
||||||
|
test('Order workflow: create → approve → ship', async ({ page }) => {
|
||||||
|
// 1. Login
|
||||||
|
await page.goto('/Account/Login');
|
||||||
|
await page.fill('[name="email"]', 'manager@example.com');
|
||||||
|
await page.fill('[name="password"]', 'password123!');
|
||||||
|
await page.click('button[type="submit"]');
|
||||||
|
|
||||||
|
// 2. Create order
|
||||||
|
await page.goto('/admin/orders');
|
||||||
|
await page.click('button:text("Create Order")');
|
||||||
|
await page.selectOption('[name="customerId"]', 'CUST-001');
|
||||||
|
await page.fill('[name="quantity"]', '100');
|
||||||
|
await page.click('button:text("Submit")');
|
||||||
|
await expect(page).toHaveURL(/\/admin\/orders\/\d+/);
|
||||||
|
|
||||||
|
// 3. Supervisor approval
|
||||||
|
await page.click('button:text("Request Approval")');
|
||||||
|
await page.logout();
|
||||||
|
|
||||||
|
// ... login as supervisor ...
|
||||||
|
|
||||||
|
// 4. Approve
|
||||||
|
await page.click('button:text("Approve")');
|
||||||
|
await expect(page).toContainText('Order approved');
|
||||||
|
|
||||||
|
// 5. Audit log verification
|
||||||
|
await page.goto('/admin/audit-logs?entity=orders&entityId=123');
|
||||||
|
await expect(page).toContainText('created_by: manager@example.com');
|
||||||
|
await expect(page).toContainText('modified_by: supervisor@example.com');
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Figma Design System (Specification)
|
||||||
|
|
||||||
|
### Color Palette (Tabler Base)
|
||||||
|
- **Primary**: #0D6EFD (Bootstrap Blue)
|
||||||
|
- **Success**: #198754 (Bootstrap Green)
|
||||||
|
- **Danger**: #DC3545 (Bootstrap Red)
|
||||||
|
- **Warning**: #FFC107 (Bootstrap Amber)
|
||||||
|
- **Info**: #0DCAF0 (Bootstrap Cyan)
|
||||||
|
- **Dark**: #2C3E50 (Custom Sidebar)
|
||||||
|
- **Light**: #F5F7FB (Custom Background)
|
||||||
|
|
||||||
|
### Typography
|
||||||
|
- **Headings**: Inter Medium (600), 24px/20px/18px/16px/14px
|
||||||
|
- **Body**: Inter Regular (400), 14px/16px
|
||||||
|
- **Mono**: IBM Plex Mono, 12px (for GL account codes, order numbers)
|
||||||
|
|
||||||
|
### Component Sizes
|
||||||
|
- **Button**: sm (32px) / md (40px) / lg (48px)
|
||||||
|
- **Input**: sm (32px) / md (40px) / lg (48px)
|
||||||
|
- **Table Row**: 44px
|
||||||
|
- **Card Padding**: 20px
|
||||||
|
- **Border Radius**: 6px (default), 12px (card), 0px (table)
|
||||||
|
|
||||||
|
### Spacing (8px grid)
|
||||||
|
- Margins: 0, 8, 16, 24, 32, 40px
|
||||||
|
- Padding: 8, 12, 16, 20, 24px
|
||||||
|
|
||||||
|
### Interactive States
|
||||||
|
- **Hover**: 10% opacity overlay
|
||||||
|
- **Focus**: 2px outline, 4px blue (#0D6EFD)
|
||||||
|
- **Disabled**: 50% opacity, cursor not-allowed
|
||||||
|
- **Loading**: Spinner overlay, pointer-events none
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Accessibility Requirements (WCAG 2.1 AA)
|
||||||
|
|
||||||
|
### Per-Component Checklist
|
||||||
|
|
||||||
|
| Component | Keyboard | Screen Reader | Color | Focus |
|
||||||
|
|-----------|----------|---------------|-------|-------|
|
||||||
|
| **Button** | Tab + Enter | aria-label | 4.5:1 contrast | Visible outline |
|
||||||
|
| **Input** | Tab + Type | aria-label + aria-describedby (error) | Error text 4.5:1 | Visible outline |
|
||||||
|
| **Table** | Tab + arrows | scope + aria-sort | Text 4.5:1 | Row highlight |
|
||||||
|
| **Modal** | Tab + Escape | role="dialog", focus trap | Background 3:1 | Focused element |
|
||||||
|
| **Select** | Tab + arrows | aria-expanded + aria-controls | 4.5:1 contrast | Dropdown highlight |
|
||||||
|
|
||||||
|
### Automated Validation
|
||||||
|
- **Tool**: axe-core (Storybook addon)
|
||||||
|
- **Target**: 95+ axe score per component
|
||||||
|
- **CI Gate**: No accessibility violations in main branch
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Migration Path (Phase 1-4)
|
||||||
|
|
||||||
|
### Phase 1: Setup (Week 1-2)
|
||||||
|
- [ ] Vite scaffold + TypeScript strict mode
|
||||||
|
- [ ] Storybook 7.0 setup + Tabler theme
|
||||||
|
- [ ] ESLint + Prettier config
|
||||||
|
- [ ] Primitives folder structure created
|
||||||
|
|
||||||
|
### Phase 2: Primitives (Week 3-4)
|
||||||
|
- [ ] 30 Primitive components built
|
||||||
|
- [ ] 180 Storybook stories written
|
||||||
|
- [ ] Unit test: 70%+ coverage
|
||||||
|
- [ ] Accessibility audit: axe 95+
|
||||||
|
- [ ] Design system published (Figma library link)
|
||||||
|
|
||||||
|
### Phase 3: Typed + Domain Fields (Week 5-6)
|
||||||
|
- [ ] 12 Typed Field components built + 108 stories
|
||||||
|
- [ ] 12 Domain Field components built + 108 stories
|
||||||
|
- [ ] Integration tests for field validation chains
|
||||||
|
- [ ] API client auto-generated from OpenAPI spec
|
||||||
|
|
||||||
|
### Phase 4: Business Composites (Week 7-8)
|
||||||
|
- [ ] 11 full CRUD components built + 55 stories
|
||||||
|
- [ ] 116 E2E tests passing
|
||||||
|
- [ ] Responsive design verified (mobile, tablet, desktop)
|
||||||
|
- [ ] Performance: LCP <2.5s, TTI <3s, CLS <0.1
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Sign-Off
|
||||||
|
|
||||||
|
- **UX/Design Lead**: _________________ Date: _______
|
||||||
|
- **Frontend Tech Lead**: _________________ Date: _______
|
||||||
|
- **QA Lead**: _________________ Date: _______
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Document Version**: 1.0
|
||||||
|
**Last Updated**: 2026-07-26
|
||||||
|
**Figma Designs**: [Link to Figma project TBD]
|
||||||
|
**Next Milestone**: Phase 1 Vite scaffold + ESLint setup (2026-08-02)
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
import { createApp } from 'vue';
|
|
||||||
import PrimeVue from 'primevue/config';
|
|
||||||
import Aura from '@primevue/themes/aura';
|
|
||||||
import App from './App.vue';
|
|
||||||
import router from './router';
|
|
||||||
|
|
||||||
import 'ag-grid-community/styles/ag-grid.css';
|
|
||||||
import 'ag-grid-community/styles/ag-theme-alpine.css';
|
|
||||||
|
|
||||||
const app = createApp(App);
|
|
||||||
|
|
||||||
app.use(PrimeVue, {
|
|
||||||
theme: {
|
|
||||||
preset: Aura
|
|
||||||
}
|
|
||||||
});
|
|
||||||
app.use(router);
|
|
||||||
|
|
||||||
app.mount('#app');
|
|
||||||
@@ -1,122 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="douzone-viewport-container d-flex flex-column h-100">
|
|
||||||
<!-- 1. Douzone Top Toolbar -->
|
|
||||||
<header class="douzone-header-toolbar d-flex justify-content-between align-items-center p-2 bg-navy text-white">
|
|
||||||
<div class="d-flex align-items-center gap-3">
|
|
||||||
<span class="fw-bold fs-4 text-warning">QuantEngine ERP v4.0 (Vue 3 / AG Grid)</span>
|
|
||||||
<span class="badge bg-success">PostgreSQL 3NF Connected</span>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<button class="btn btn-sm btn-secondary me-1" @click="fetchData"><span class="hotkey-badge">F3</span>조회</button>
|
|
||||||
<button class="btn btn-sm btn-primary me-1"><span class="hotkey-badge">F4</span>저장</button>
|
|
||||||
<button class="btn btn-sm btn-danger me-1"><span class="hotkey-badge">F5</span>삭제</button>
|
|
||||||
<button class="btn btn-sm btn-success"><span class="hotkey-badge">F7</span>엑셀</button>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<!-- 2. Master-Detail AG Grid Viewport (No Page Scroll) -->
|
|
||||||
<div class="flex-grow-1 row g-0 overflow-hidden">
|
|
||||||
<!-- Left: AG Grid Master List (65%) -->
|
|
||||||
<div class="col-8 border-end h-100 p-2">
|
|
||||||
<ag-grid-vue
|
|
||||||
style="width: 100%; height: 100%;"
|
|
||||||
class="ag-theme-alpine"
|
|
||||||
:columnDefs="columnDefs"
|
|
||||||
:rowData="rowData"
|
|
||||||
:defaultColDef="defaultColDef"
|
|
||||||
@row-selected="onRowSelected"
|
|
||||||
rowSelection="single"
|
|
||||||
>
|
|
||||||
</ag-grid-vue>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Right: Detail & Audit Provenance Inspector (35%) -->
|
|
||||||
<div class="col-4 h-100 p-3 bg-light overflow-auto">
|
|
||||||
<h5 class="fw-bold text-navy mb-3"><i class="ti ti-info-circle me-1"></i>상세 및 Provenance 검토</h5>
|
|
||||||
<div v-if="selectedRow" class="card p-3 shadow-sm border">
|
|
||||||
<div class="mb-2"><strong>실행 ID:</strong> {{ selectedRow.runId }}</div>
|
|
||||||
<div class="mb-2"><strong>시작 시간:</strong> {{ selectedRow.startedAt }}</div>
|
|
||||||
<div class="mb-2"><strong>종료 시간:</strong> {{ selectedRow.finishedAt || '-' }}</div>
|
|
||||||
<div class="mb-2">
|
|
||||||
<strong>상태:</strong>
|
|
||||||
<span :class="getStatusBadgeClass(selectedRow.status)">{{ selectedRow.status }}</span>
|
|
||||||
</div>
|
|
||||||
<div class="mb-2"><strong>총 스냅샷:</strong> {{ selectedRow.totalSnapshots }} 건</div>
|
|
||||||
<div class="mb-2"><strong>오류 건수:</strong> {{ selectedRow.totalErrors }} 건</div>
|
|
||||||
<hr/>
|
|
||||||
<div class="text-muted small">
|
|
||||||
<strong>Data Integrity:</strong> 3NF Relational Parity Verified<br/>
|
|
||||||
<strong>Provenance:</strong> FastEndpoints /api/admin/grid-data
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div v-else class="text-muted text-center py-5">
|
|
||||||
좌측 AG Grid에서 행을 선택하면 상세 정보가 표출됩니다.
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 3. Bottom Hotkey Guidance Footer -->
|
|
||||||
<footer class="douzone-summary-footer bg-dark text-white p-2 d-flex justify-content-between fs-7">
|
|
||||||
<div>
|
|
||||||
<span><span class="hotkey-badge">Enter</span>다음 포커스</span>
|
|
||||||
<span class="ms-3"><span class="hotkey-badge">F2</span>코드 lookup</span>
|
|
||||||
<span class="ms-3"><span class="hotkey-badge">F3</span>조회</span>
|
|
||||||
<span class="ms-3"><span class="hotkey-badge">F4</span>저장</span>
|
|
||||||
<span class="ms-3"><span class="hotkey-badge">F7</span>엑셀 다운로드</span>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<span class="opacity-75">Vue 3 + PrimeVue / AG Grid Modern Frontend Standard</span>
|
|
||||||
</div>
|
|
||||||
</footer>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import { ref, onMounted } from 'vue';
|
|
||||||
import { AgGridVue } from 'ag-grid-vue3';
|
|
||||||
import axios from 'axios';
|
|
||||||
|
|
||||||
const rowData = ref([]);
|
|
||||||
const selectedRow = ref(null);
|
|
||||||
|
|
||||||
const columnDefs = ref([
|
|
||||||
{ field: 'runId', headerName: '실행 ID', flex: 1, sortable: true, filter: true },
|
|
||||||
{ field: 'startedAt', headerName: '시작 시간', flex: 1.5, sortable: true },
|
|
||||||
{ field: 'finishedAt', headerName: '종료 시간', flex: 1.5, sortable: true },
|
|
||||||
{ field: 'status', headerName: '상태', flex: 1, sortable: true, filter: true },
|
|
||||||
{ field: 'totalSnapshots', headerName: '스냅샷 수', flex: 1, sortable: true },
|
|
||||||
{ field: 'totalErrors', headerName: '오류 수', flex: 1, sortable: true }
|
|
||||||
]);
|
|
||||||
|
|
||||||
const defaultColDef = ref({
|
|
||||||
resizable: true
|
|
||||||
});
|
|
||||||
|
|
||||||
const fetchData = async () => {
|
|
||||||
try {
|
|
||||||
const response = await axios.get('/api/admin/grid-data');
|
|
||||||
if (response.data && response.data.items) {
|
|
||||||
rowData.value = response.data.items;
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Failed to fetch grid data:', err);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const onRowSelected = (event) => {
|
|
||||||
if (event.node.isSelected()) {
|
|
||||||
selectedRow.value = event.data;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const getStatusBadgeClass = (status) => {
|
|
||||||
const s = (status || '').toLowerCase();
|
|
||||||
if (s === 'completed' || s === 'pass') return 'badge bg-success';
|
|
||||||
if (s === 'running' || s === 'warn') return 'badge bg-warning text-dark';
|
|
||||||
return 'badge bg-danger';
|
|
||||||
};
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
fetchData();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using QuantEngine.Infrastructure.Data;
|
||||||
|
|
||||||
|
namespace QuantEngine.Core.Tests;
|
||||||
|
|
||||||
|
public class MigrationScriptNameComparerTests
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void Sorts_DoubleDigit_Version_After_SingleDigit_Versions()
|
||||||
|
{
|
||||||
|
var scripts = new[]
|
||||||
|
{
|
||||||
|
"QuantEngine.Infrastructure.Migrations.V10__Normalize_Snapshots_Schema.sql",
|
||||||
|
"QuantEngine.Infrastructure.Migrations.V2__Add_Kis_Collections.sql",
|
||||||
|
"QuantEngine.Infrastructure.Migrations.V9__Add_Audit_Trail_Tables.sql",
|
||||||
|
"QuantEngine.Infrastructure.Migrations.V1__Initial_Schema.sql",
|
||||||
|
"QuantEngine.Infrastructure.Migrations.V8__PostgreSQL_History_First_Schema.sql",
|
||||||
|
};
|
||||||
|
|
||||||
|
var sorted = scripts.OrderBy(s => s, new MigrationScriptNameComparer()).ToArray();
|
||||||
|
|
||||||
|
Assert.Equal(new[]
|
||||||
|
{
|
||||||
|
"QuantEngine.Infrastructure.Migrations.V1__Initial_Schema.sql",
|
||||||
|
"QuantEngine.Infrastructure.Migrations.V2__Add_Kis_Collections.sql",
|
||||||
|
"QuantEngine.Infrastructure.Migrations.V8__PostgreSQL_History_First_Schema.sql",
|
||||||
|
"QuantEngine.Infrastructure.Migrations.V9__Add_Audit_Trail_Tables.sql",
|
||||||
|
"QuantEngine.Infrastructure.Migrations.V10__Normalize_Snapshots_Schema.sql",
|
||||||
|
}, sorted);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Regression_ZeroPadded_Script_No_Longer_Sorts_Before_V1()
|
||||||
|
{
|
||||||
|
// This is the exact bug that shipped 2026-07-24: "V003_..." sorted before "V1__..."
|
||||||
|
// under plain ordinal comparison, so a migration with unmet table dependencies ran
|
||||||
|
// first. The comparer must treat "V003" as version 3, landing it between V2 and V4.
|
||||||
|
var scripts = new[]
|
||||||
|
{
|
||||||
|
"QuantEngine.Infrastructure.Migrations.V003_add_audit_trail_tables.sql",
|
||||||
|
"QuantEngine.Infrastructure.Migrations.V1__Initial_Schema.sql",
|
||||||
|
"QuantEngine.Infrastructure.Migrations.V4__Add_Initial_Admin.sql",
|
||||||
|
};
|
||||||
|
|
||||||
|
var sorted = scripts.OrderBy(s => s, new MigrationScriptNameComparer()).ToArray();
|
||||||
|
|
||||||
|
Assert.Equal("QuantEngine.Infrastructure.Migrations.V1__Initial_Schema.sql", sorted[0]);
|
||||||
|
Assert.Equal("QuantEngine.Infrastructure.Migrations.V003_add_audit_trail_tables.sql", sorted[1]);
|
||||||
|
Assert.Equal("QuantEngine.Infrastructure.Migrations.V4__Add_Initial_Admin.sql", sorted[2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using QuantEngine.Infrastructure.External;
|
using QuantEngine.Infrastructure.Services;
|
||||||
using QuantEngine.Infrastructure.Data;
|
|
||||||
|
|
||||||
namespace QuantEngine.Core.Tests;
|
namespace QuantEngine.Core.Tests;
|
||||||
|
|
||||||
@@ -12,9 +11,7 @@ public class SecurityTests
|
|||||||
[InlineData("/uapi/domestic-stock/v1/quotations/inquire-daily-itemchartprice", "FHKST03010100")]
|
[InlineData("/uapi/domestic-stock/v1/quotations/inquire-daily-itemchartprice", "FHKST03010100")]
|
||||||
public void AssertReadOnly_AllowsReadOnlyQuotationPaths(string path, string trId)
|
public void AssertReadOnly_AllowsReadOnlyQuotationPaths(string path, string trId)
|
||||||
{
|
{
|
||||||
var client = CreateClient();
|
var ex = Record.Exception(() => InvokeAssertReadOnly(path, trId));
|
||||||
|
|
||||||
var ex = Record.Exception(() => InvokeAssertReadOnly(client, path, trId));
|
|
||||||
|
|
||||||
Assert.Null(ex);
|
Assert.Null(ex);
|
||||||
}
|
}
|
||||||
@@ -25,45 +22,34 @@ public class SecurityTests
|
|||||||
[InlineData("/uapi/domestic-stock/v1/trading/order-cash", "FHKST01010100")]
|
[InlineData("/uapi/domestic-stock/v1/trading/order-cash", "FHKST01010100")]
|
||||||
public void AssertReadOnly_BlocksTradingPathsOrIds(string path, string trId)
|
public void AssertReadOnly_BlocksTradingPathsOrIds(string path, string trId)
|
||||||
{
|
{
|
||||||
var client = CreateClient();
|
var ex = Assert.Throws<TargetInvocationException>(() => InvokeAssertReadOnly(path, trId));
|
||||||
|
|
||||||
var ex = Assert.Throws<TargetInvocationException>(() => InvokeAssertReadOnly(client, path, trId));
|
|
||||||
Assert.IsType<InvalidOperationException>(ex.InnerException);
|
Assert.IsType<InvalidOperationException>(ex.InnerException);
|
||||||
Assert.Contains("BLOCKED", ex.InnerException!.Message);
|
Assert.Contains("BLOCKED", ex.InnerException!.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Theory]
|
||||||
public void AssertReadOnly_BlocksKnownTradingTrIdPrefixes()
|
[InlineData("VTTC8434R00")]
|
||||||
|
[InlineData("TTTC9912U")]
|
||||||
|
[InlineData("VTTC5555X")]
|
||||||
|
public void AssertReadOnly_BlocksEntireTradingTrIdFamily_NotJustHardcodedCodes(string trId)
|
||||||
{
|
{
|
||||||
var client = CreateClient();
|
// These TR_IDs are not among the previously hardcoded exact-match list — they only get
|
||||||
|
// blocked once the guard checks the true TTTC*/VTTC* prefix family instead of a fixed
|
||||||
var ex = Assert.Throws<TargetInvocationException>(() => InvokeAssertReadOnly(client, "/uapi/domestic-stock/v1/quotations/inquire-price", "VTTC8434R00"));
|
// set of known order codes.
|
||||||
|
var ex = Assert.Throws<TargetInvocationException>(() =>
|
||||||
|
InvokeAssertReadOnly("/uapi/domestic-stock/v1/quotations/inquire-price", trId));
|
||||||
Assert.IsType<InvalidOperationException>(ex.InnerException);
|
Assert.IsType<InvalidOperationException>(ex.InnerException);
|
||||||
Assert.Contains("TR_ID", ex.InnerException!.Message);
|
Assert.Contains("TR_ID", ex.InnerException!.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static KisApiClient CreateClient()
|
private static void InvokeAssertReadOnly(string path, string trId)
|
||||||
{
|
{
|
||||||
Environment.SetEnvironmentVariable("KIS_APP_Key_TEST", "mock-key");
|
// QuantEngine.Infrastructure.Services.KisApiClient is the class actually DI-registered
|
||||||
Environment.SetEnvironmentVariable("KIS_APP_Secret_TEST", "mock-secret");
|
// in Program.cs and running in production — a second, unused KisApiClient used to live
|
||||||
return new KisApiClient(new HttpClient(new DummyHandler()), new NoopConnectionFactory());
|
// under Infrastructure.External with its own independent AssertReadOnly implementation
|
||||||
}
|
// that this test suite exercised instead. That class has been removed.
|
||||||
|
var method = typeof(KisApiClient).GetMethod("AssertReadOnly", BindingFlags.Static | BindingFlags.NonPublic)
|
||||||
private static void InvokeAssertReadOnly(KisApiClient client, string path, string trId)
|
|
||||||
{
|
|
||||||
var method = typeof(KisApiClient).GetMethod("AssertReadOnly", BindingFlags.Instance | BindingFlags.NonPublic)
|
|
||||||
?? throw new InvalidOperationException("AssertReadOnly method not found.");
|
?? throw new InvalidOperationException("AssertReadOnly method not found.");
|
||||||
method.Invoke(client, new object[] { path, trId });
|
method.Invoke(null, new object[] { path, trId });
|
||||||
}
|
|
||||||
|
|
||||||
private sealed class DummyHandler : HttpMessageHandler
|
|
||||||
{
|
|
||||||
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
|
|
||||||
=> Task.FromResult(new HttpResponseMessage(System.Net.HttpStatusCode.OK));
|
|
||||||
}
|
|
||||||
|
|
||||||
private sealed class NoopConnectionFactory : IDbConnectionFactory
|
|
||||||
{
|
|
||||||
public System.Data.IDbConnection CreateConnection() => throw new NotSupportedException("Not needed for read-only guard tests.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ namespace QuantEngine.Infrastructure.Data
|
|||||||
var upgrader = DeployChanges.To
|
var upgrader = DeployChanges.To
|
||||||
.PostgresqlDatabase(_connectionString)
|
.PostgresqlDatabase(_connectionString)
|
||||||
.WithScriptsEmbeddedInAssembly(typeof(DbMigrator).Assembly, s => s.StartsWith("QuantEngine.Infrastructure.Migrations"))
|
.WithScriptsEmbeddedInAssembly(typeof(DbMigrator).Assembly, s => s.StartsWith("QuantEngine.Infrastructure.Migrations"))
|
||||||
|
.WithScriptNameComparer(new MigrationScriptNameComparer())
|
||||||
.LogToConsole()
|
.LogToConsole()
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
namespace QuantEngine.Infrastructure.Data
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Orders DbUp migration scripts by their numeric V{n} version instead of plain ordinal
|
||||||
|
/// string order. Without this, "V10__Name.sql" sorts before "V2__Name.sql" (and, as
|
||||||
|
/// happened on 2026-07-24, zero-padded "V003_Name.sql" sorts before unpadded
|
||||||
|
/// "V1__Name.sql") because ordinal comparison looks at characters, not numeric value.
|
||||||
|
/// That mismatch let a migration with an unmet table dependency run first and silently
|
||||||
|
/// no-op, and another one run first and hard-fail, blocking every migration after it on a
|
||||||
|
/// fresh database. This comparer makes the "V{n}" scheme collision-proof regardless of
|
||||||
|
/// digit count or padding, so it can never happen again.
|
||||||
|
/// </summary>
|
||||||
|
public class MigrationScriptNameComparer : IComparer<string>
|
||||||
|
{
|
||||||
|
private static readonly Regex VersionPattern = new(@"V(\d+)", RegexOptions.Compiled);
|
||||||
|
|
||||||
|
public int Compare(string? x, string? y)
|
||||||
|
{
|
||||||
|
if (x == null || y == null)
|
||||||
|
{
|
||||||
|
return string.CompareOrdinal(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
var matchX = VersionPattern.Match(x);
|
||||||
|
var matchY = VersionPattern.Match(y);
|
||||||
|
|
||||||
|
if (matchX.Success && matchY.Success)
|
||||||
|
{
|
||||||
|
var versionX = long.Parse(matchX.Groups[1].Value);
|
||||||
|
var versionY = long.Parse(matchY.Groups[1].Value);
|
||||||
|
if (versionX != versionY)
|
||||||
|
{
|
||||||
|
return versionX.CompareTo(versionY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return string.CompareOrdinal(x, y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,250 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Net.Http;
|
|
||||||
using System.Net.Http.Headers;
|
|
||||||
using System.Net.Http.Json;
|
|
||||||
using System.Text.Json;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Dapper;
|
|
||||||
using QuantEngine.Core.Interfaces;
|
|
||||||
using QuantEngine.Infrastructure.Data;
|
|
||||||
|
|
||||||
namespace QuantEngine.Infrastructure.External
|
|
||||||
{
|
|
||||||
public class KisCredentials
|
|
||||||
{
|
|
||||||
public string AppKey { get; }
|
|
||||||
public string AppSecret { get; }
|
|
||||||
public string Account { get; } // "real" | "mock"
|
|
||||||
public string Domain { get; }
|
|
||||||
|
|
||||||
public KisCredentials(string appKey, string appSecret, string account)
|
|
||||||
{
|
|
||||||
AppKey = appKey;
|
|
||||||
AppSecret = appSecret;
|
|
||||||
Account = account;
|
|
||||||
Domain = account == "real"
|
|
||||||
? "https://openapi.koreainvestment.com:9443"
|
|
||||||
: "https://openapivts.koreainvestment.com:29443";
|
|
||||||
}
|
|
||||||
|
|
||||||
public static KisCredentials Load(string account = "mock")
|
|
||||||
{
|
|
||||||
string keyVar = account == "real" ? "KIS_APP_Key" : "KIS_APP_Key_TEST";
|
|
||||||
string secretVar = account == "real" ? "KIS_APP_Secret" : "KIS_APP_Secret_TEST";
|
|
||||||
|
|
||||||
string? appKey = Environment.GetEnvironmentVariable(keyVar);
|
|
||||||
string? appSecret = Environment.GetEnvironmentVariable(secretVar);
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(appKey) || string.IsNullOrEmpty(appSecret))
|
|
||||||
{
|
|
||||||
// Fallback registry checks are not cross-platform and environment variables should be defined.
|
|
||||||
// In production/Linux it is env-only.
|
|
||||||
throw new InvalidOperationException(
|
|
||||||
$"KIS Credentials Environment Variables missing: {keyVar} or {secretVar}."
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new KisCredentials(appKey, appSecret, account);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class KisApiClient : IKisApiClient
|
|
||||||
{
|
|
||||||
private readonly HttpClient _httpClient;
|
|
||||||
private readonly IDbConnectionFactory _dbConnectionFactory;
|
|
||||||
private readonly KisCredentials _creds;
|
|
||||||
|
|
||||||
private static readonly string[] ForbiddenPathSubstrings = { "/trading/" };
|
|
||||||
private static readonly string[] ForbiddenTrIdPrefixes = { "TTTC08", "VTTC08", "TTTC01", "VTTC01", "TTTC8434R", "VTTC8434R" };
|
|
||||||
|
|
||||||
public KisApiClient(HttpClient httpClient, IDbConnectionFactory dbConnectionFactory, string account = "mock")
|
|
||||||
{
|
|
||||||
_httpClient = httpClient;
|
|
||||||
_dbConnectionFactory = dbConnectionFactory;
|
|
||||||
_creds = KisCredentials.Load(account);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void AssertReadOnly(string path, string trId)
|
|
||||||
{
|
|
||||||
foreach (var forbidden in ForbiddenPathSubstrings)
|
|
||||||
{
|
|
||||||
if (path.Contains(forbidden, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException($"BLOCKED: 주문 관련 경로 호출 시도 차단 — path={path}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
foreach (var prefix in ForbiddenTrIdPrefixes)
|
|
||||||
{
|
|
||||||
if (trId.StartsWith(prefix, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException($"BLOCKED: 주문 관련 TR_ID 호출 시도 차단 — tr_id={trId}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task<string> IssueOrReuseTokenAsync()
|
|
||||||
{
|
|
||||||
using var conn = _dbConnectionFactory.CreateConnection();
|
|
||||||
conn.Open();
|
|
||||||
|
|
||||||
// 1. Try to load cached token
|
|
||||||
var cached = await conn.QueryFirstOrDefaultAsync<(string access_token, string expires_at)>(
|
|
||||||
"SELECT access_token, expires_at FROM quantengine.kis_tokens WHERE account = @Account",
|
|
||||||
new { Account = _creds.Account }
|
|
||||||
);
|
|
||||||
|
|
||||||
if (cached.access_token != null)
|
|
||||||
{
|
|
||||||
if (DateTime.TryParse(cached.expires_at, out var expiresAtUtc))
|
|
||||||
{
|
|
||||||
// Reuse token if it has more than 10 minutes left before expiration
|
|
||||||
if (DateTime.UtcNow < expiresAtUtc.AddMinutes(-10))
|
|
||||||
{
|
|
||||||
return cached.access_token;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. Request new token from KIS API
|
|
||||||
var requestUrl = $"{_creds.Domain}/oauth2/tokenP";
|
|
||||||
var requestBody = new
|
|
||||||
{
|
|
||||||
grant_type = "client_credentials",
|
|
||||||
appkey = _creds.AppKey,
|
|
||||||
appsecret = _creds.AppSecret
|
|
||||||
};
|
|
||||||
|
|
||||||
var response = await _httpClient.PostAsJsonAsync(requestUrl, requestBody);
|
|
||||||
response.EnsureSuccessStatusCode();
|
|
||||||
|
|
||||||
var resData = await response.Content.ReadFromJsonAsync<JsonElement>();
|
|
||||||
var accessToken = resData.GetProperty("access_token").GetString()
|
|
||||||
?? throw new InvalidOperationException("Failed to parse access_token from response.");
|
|
||||||
var expiresInSec = resData.GetProperty("expires_in").GetInt32();
|
|
||||||
var expiresAt = DateTime.UtcNow.AddSeconds(expiresInSec);
|
|
||||||
|
|
||||||
// 3. Upsert token cache into PG database
|
|
||||||
await conn.ExecuteAsync(@"
|
|
||||||
INSERT INTO quantengine.kis_tokens (account, access_token, expires_at, updated_at)
|
|
||||||
VALUES (@Account, @AccessToken, @ExpiresAt, @UpdatedAt)
|
|
||||||
ON CONFLICT (account) DO UPDATE SET
|
|
||||||
access_token = EXCLUDED.access_token,
|
|
||||||
expires_at = EXCLUDED.expires_at,
|
|
||||||
updated_at = EXCLUDED.updated_at",
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Account = _creds.Account,
|
|
||||||
AccessToken = accessToken,
|
|
||||||
ExpiresAt = expiresAt.ToString("o"),
|
|
||||||
UpdatedAt = DateTime.UtcNow.ToString("o")
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
return accessToken;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task<string> SendRequestAsync(string path, string trId, Dictionary<string, string> queryParams)
|
|
||||||
{
|
|
||||||
AssertReadOnly(path, trId);
|
|
||||||
var token = await IssueOrReuseTokenAsync();
|
|
||||||
|
|
||||||
var queryBuilder = new List<string>();
|
|
||||||
foreach (var kvp in queryParams)
|
|
||||||
{
|
|
||||||
queryBuilder.Add($"{Uri.EscapeDataString(kvp.Key)}={Uri.EscapeDataString(kvp.Value)}");
|
|
||||||
}
|
|
||||||
var fullUrl = $"{_creds.Domain}{path}?{string.Join("&", queryBuilder)}";
|
|
||||||
|
|
||||||
using var request = new HttpRequestMessage(HttpMethod.Get, fullUrl);
|
|
||||||
request.Headers.Accept.Clear();
|
|
||||||
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
|
||||||
request.Headers.Add("authorization", $"Bearer {token}");
|
|
||||||
request.Headers.Add("appkey", _creds.AppKey);
|
|
||||||
request.Headers.Add("appsecret", _creds.AppSecret);
|
|
||||||
request.Headers.Add("tr_id", trId);
|
|
||||||
request.Headers.Add("custtype", "P");
|
|
||||||
|
|
||||||
var response = await _httpClient.SendAsync(request);
|
|
||||||
response.EnsureSuccessStatusCode();
|
|
||||||
|
|
||||||
return await response.Content.ReadAsStringAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<Dictionary<string, object>> GetCurrentPriceAsync(string code, string account = "mock")
|
|
||||||
{
|
|
||||||
var json = await SendRequestAsync(
|
|
||||||
"/uapi/domestic-stock/v1/quotations/inquire-price",
|
|
||||||
"FHKST01010100",
|
|
||||||
new Dictionary<string, string>
|
|
||||||
{
|
|
||||||
{ "FID_COND_MRKT_DIV_CODE", "J" },
|
|
||||||
{ "FID_INPUT_ISCD", code }
|
|
||||||
}
|
|
||||||
);
|
|
||||||
return JsonSerializer.Deserialize<Dictionary<string, object>>(json) ?? new();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<Dictionary<string, object>> GetAskingPrice10LevelAsync(string code, string account = "mock")
|
|
||||||
{
|
|
||||||
var json = await SendRequestAsync(
|
|
||||||
"/uapi/domestic-stock/v1/quotations/inquire-asking-price-exp-ccn",
|
|
||||||
"FHKST01010200",
|
|
||||||
new Dictionary<string, string>
|
|
||||||
{
|
|
||||||
{ "FID_COND_MRKT_DIV_CODE", "J" },
|
|
||||||
{ "FID_INPUT_ISCD", code }
|
|
||||||
}
|
|
||||||
);
|
|
||||||
return JsonSerializer.Deserialize<Dictionary<string, object>>(json) ?? new();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<Dictionary<string, object>> GetDailyShortSaleAsync(string code, string startDate, string endDate, string account = "mock")
|
|
||||||
{
|
|
||||||
var json = await SendRequestAsync(
|
|
||||||
"/uapi/domestic-stock/v1/quotations/daily-short-sale",
|
|
||||||
"FHPST04830000",
|
|
||||||
new Dictionary<string, string>
|
|
||||||
{
|
|
||||||
{ "FID_COND_MRKT_DIV_CODE", "J" },
|
|
||||||
{ "FID_INPUT_ISCD", code },
|
|
||||||
{ "FID_INPUT_DATE_1", startDate },
|
|
||||||
{ "FID_INPUT_DATE_2", endDate }
|
|
||||||
}
|
|
||||||
);
|
|
||||||
return JsonSerializer.Deserialize<Dictionary<string, object>>(json) ?? new();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<Dictionary<string, object>> GetDailyItemChartPriceAsync(string code, string startDate, string endDate, string period = "D", string account = "mock")
|
|
||||||
{
|
|
||||||
var json = await SendRequestAsync(
|
|
||||||
"/uapi/domestic-stock/v1/quotations/inquire-daily-itemchartprice",
|
|
||||||
"FHKST03010100",
|
|
||||||
new Dictionary<string, string>
|
|
||||||
{
|
|
||||||
{ "FID_COND_MRKT_DIV_CODE", "J" },
|
|
||||||
{ "FID_INPUT_ISCD", code },
|
|
||||||
{ "FID_INPUT_DATE_1", startDate },
|
|
||||||
{ "FID_INPUT_DATE_2", endDate },
|
|
||||||
{ "FID_PERIOD_DIV_CODE", period },
|
|
||||||
{ "FID_ORG_ADJ_PRC", "0" }
|
|
||||||
}
|
|
||||||
);
|
|
||||||
return JsonSerializer.Deserialize<Dictionary<string, object>>(json) ?? new();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<Dictionary<string, object>> GetInvestorTrendAsync(string code, string account = "mock")
|
|
||||||
{
|
|
||||||
var json = await SendRequestAsync(
|
|
||||||
"/uapi/domestic-stock/v1/quotations/inquire-investor",
|
|
||||||
"FHKST01010900",
|
|
||||||
new Dictionary<string, string>
|
|
||||||
{
|
|
||||||
{ "FID_COND_MRKT_DIV_CODE", "J" },
|
|
||||||
{ "FID_INPUT_ISCD", code }
|
|
||||||
}
|
|
||||||
);
|
|
||||||
return JsonSerializer.Deserialize<Dictionary<string, object>>(json) ?? new();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+11
-1
@@ -1,8 +1,18 @@
|
|||||||
-- Migration: V004_normalize_snapshots_schema.sql
|
-- Migration: V10__Normalize_Snapshots_Schema.sql (renamed from
|
||||||
|
-- V004_normalize_snapshots_schema.sql on 2026-07-30 — see note below)
|
||||||
-- Purpose: Implement 3NF normalization for kis_collection_snapshots
|
-- Purpose: Implement 3NF normalization for kis_collection_snapshots
|
||||||
-- Phase: Phase 1 (Normalization & SOLID Refactoring)
|
-- Phase: Phase 1 (Normalization & SOLID Refactoring)
|
||||||
-- Status: APPROVED for Sep 2026 implementation
|
-- Status: APPROVED for Sep 2026 implementation
|
||||||
-- Safety: Parallel operation with existing schema via Adapter pattern
|
-- Safety: Parallel operation with existing schema via Adapter pattern
|
||||||
|
--
|
||||||
|
-- 2026-07-30: Originally named V004_normalize_snapshots_schema.sql, which alphabetically
|
||||||
|
-- sorted BEFORE V1__Initial_Schema.sql. Its FK constraint referencing
|
||||||
|
-- quantengine.kis_collection_runs(id) (created by V2) is not guarded — on a fresh database
|
||||||
|
-- this would hard-fail with "relation does not exist" and abort every migration after it,
|
||||||
|
-- meaning V1 through V8 would never run at all. Renamed to V10 (after DbMigrator.cs was given
|
||||||
|
-- a numeric-aware script comparer, MigrationScriptNameComparer, so double-digit versions sort
|
||||||
|
-- correctly) so it now runs after its dependency exists. Confirmed via production query that
|
||||||
|
-- this migration had never actually applied.
|
||||||
|
|
||||||
-- ============================================================================
|
-- ============================================================================
|
||||||
-- DIMENSION TABLES (Star Schema)
|
-- DIMENSION TABLES (Star Schema)
|
||||||
+34
-14
@@ -1,7 +1,18 @@
|
|||||||
-- Migration: V003_add_audit_trail_tables.sql
|
-- Migration: V9__Add_Audit_Trail_Tables.sql (renamed from V003_add_audit_trail_tables.sql
|
||||||
|
-- on 2026-07-30 — see header note below)
|
||||||
-- Purpose: Add audit trail tables for tracking all data changes
|
-- Purpose: Add audit trail tables for tracking all data changes
|
||||||
-- Date: 2026-07-24
|
-- Date: 2026-07-24
|
||||||
-- Status: APPROVED for Phase 0 implementation
|
-- Status: APPROVED for Phase 0 implementation
|
||||||
|
--
|
||||||
|
-- 2026-07-30: Originally named V003_add_audit_trail_tables.sql, which alphabetically sorted
|
||||||
|
-- BEFORE V1__Initial_Schema.sql. Its trigger-creation guards (IF EXISTS checks on
|
||||||
|
-- kis_collection_runs / kis_collection_snapshots) would have silently no-op'd forever on a
|
||||||
|
-- fresh database, since those tables (created by V2) wouldn't exist yet when V003 ran first.
|
||||||
|
-- Renamed to V9 (after DbMigrator.cs was given a numeric-aware script comparer,
|
||||||
|
-- MigrationScriptNameComparer, so "V9"/"V10" sort correctly relative to "V1".."V8" regardless
|
||||||
|
-- of digit count) so it now runs after its dependencies exist. Also fixed a MySQL-only inline
|
||||||
|
-- INDEX syntax that made this script fail outright on PostgreSQL (separate fix, same day).
|
||||||
|
-- Confirmed via production query that this migration had never actually applied before either fix.
|
||||||
|
|
||||||
-- ============================================================================
|
-- ============================================================================
|
||||||
-- kis_collection_runs_audit: Audit trail for collection runs
|
-- kis_collection_runs_audit: Audit trail for collection runs
|
||||||
@@ -26,12 +37,15 @@ CREATE TABLE IF NOT EXISTS quantengine.kis_collection_runs_audit (
|
|||||||
-- Foreign key constraint (optional - don't enforce if kis_collection_runs might be deleted)
|
-- Foreign key constraint (optional - don't enforce if kis_collection_runs might be deleted)
|
||||||
-- CONSTRAINT fk_kis_collection_runs_audit FOREIGN KEY (run_id)
|
-- CONSTRAINT fk_kis_collection_runs_audit FOREIGN KEY (run_id)
|
||||||
-- REFERENCES quantengine.kis_collection_runs(id) ON DELETE CASCADE
|
-- REFERENCES quantengine.kis_collection_runs(id) ON DELETE CASCADE
|
||||||
|
|
||||||
INDEX idx_kis_collection_runs_audit_run_id (run_id, changed_at DESC),
|
|
||||||
INDEX idx_kis_collection_runs_audit_changed_by (changed_by, changed_at DESC),
|
|
||||||
INDEX idx_kis_collection_runs_audit_timestamp (changed_at DESC)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_kis_collection_runs_audit_run_id
|
||||||
|
ON quantengine.kis_collection_runs_audit (run_id, changed_at DESC);
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_kis_collection_runs_audit_changed_by
|
||||||
|
ON quantengine.kis_collection_runs_audit (changed_by, changed_at DESC);
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_kis_collection_runs_audit_timestamp
|
||||||
|
ON quantengine.kis_collection_runs_audit (changed_at DESC);
|
||||||
|
|
||||||
-- ============================================================================
|
-- ============================================================================
|
||||||
-- kis_collection_snapshots_audit: Audit trail for snapshots
|
-- kis_collection_snapshots_audit: Audit trail for snapshots
|
||||||
-- ============================================================================
|
-- ============================================================================
|
||||||
@@ -55,12 +69,15 @@ CREATE TABLE IF NOT EXISTS quantengine.kis_collection_snapshots_audit (
|
|||||||
-- Foreign key constraint (optional)
|
-- Foreign key constraint (optional)
|
||||||
-- CONSTRAINT fk_kis_collection_snapshots_audit FOREIGN KEY (snapshot_id)
|
-- CONSTRAINT fk_kis_collection_snapshots_audit FOREIGN KEY (snapshot_id)
|
||||||
-- REFERENCES quantengine.kis_collection_snapshots(id) ON DELETE CASCADE
|
-- REFERENCES quantengine.kis_collection_snapshots(id) ON DELETE CASCADE
|
||||||
|
|
||||||
INDEX idx_kis_collection_snapshots_audit_snapshot_id (snapshot_id, changed_at DESC),
|
|
||||||
INDEX idx_kis_collection_snapshots_audit_changed_by (changed_by, changed_at DESC),
|
|
||||||
INDEX idx_kis_collection_snapshots_audit_timestamp (changed_at DESC)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_kis_collection_snapshots_audit_snapshot_id
|
||||||
|
ON quantengine.kis_collection_snapshots_audit (snapshot_id, changed_at DESC);
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_kis_collection_snapshots_audit_changed_by
|
||||||
|
ON quantengine.kis_collection_snapshots_audit (changed_by, changed_at DESC);
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_kis_collection_snapshots_audit_timestamp
|
||||||
|
ON quantengine.kis_collection_snapshots_audit (changed_at DESC);
|
||||||
|
|
||||||
-- ============================================================================
|
-- ============================================================================
|
||||||
-- kis_collection_errors_audit: Audit trail for error records
|
-- kis_collection_errors_audit: Audit trail for error records
|
||||||
-- ============================================================================
|
-- ============================================================================
|
||||||
@@ -79,13 +96,16 @@ CREATE TABLE IF NOT EXISTS quantengine.kis_collection_errors_audit (
|
|||||||
new_values JSONB,
|
new_values JSONB,
|
||||||
|
|
||||||
-- Audit trail indexing
|
-- Audit trail indexing
|
||||||
created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||||
|
|
||||||
INDEX idx_kis_collection_errors_audit_error_id (error_id, changed_at DESC),
|
|
||||||
INDEX idx_kis_collection_errors_audit_changed_by (changed_by, changed_at DESC),
|
|
||||||
INDEX idx_kis_collection_errors_audit_timestamp (changed_at DESC)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_kis_collection_errors_audit_error_id
|
||||||
|
ON quantengine.kis_collection_errors_audit (error_id, changed_at DESC);
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_kis_collection_errors_audit_changed_by
|
||||||
|
ON quantengine.kis_collection_errors_audit (changed_by, changed_at DESC);
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_kis_collection_errors_audit_timestamp
|
||||||
|
ON quantengine.kis_collection_errors_audit (changed_at DESC);
|
||||||
|
|
||||||
-- ============================================================================
|
-- ============================================================================
|
||||||
-- Trigger Functions: Auto-log changes to kis_collection_runs
|
-- Trigger Functions: Auto-log changes to kis_collection_runs
|
||||||
-- ============================================================================
|
-- ============================================================================
|
||||||
@@ -22,11 +22,11 @@ public class KisApiClient : IKisApiClient
|
|||||||
private const int TokenRefreshSkewMinutes = 10;
|
private const int TokenRefreshSkewMinutes = 10;
|
||||||
|
|
||||||
private static readonly string[] ForbiddenPathSubstrings = { "/trading/" };
|
private static readonly string[] ForbiddenPathSubstrings = { "/trading/" };
|
||||||
private static readonly string[] ForbiddenTrIdPrefixes =
|
|
||||||
{
|
// 실제 매수/매도 주문 TR_ID는 전부 TTTC/VTTC로 시작한다 (governance/rules/06_no_direct_api_trading.yaml).
|
||||||
"TTTC08", "VTTC08", "TTTC01", "VTTC01",
|
// 개별 주문 코드를 나열하면 목록에 없는 신규 주문 TR_ID가 새어나갈 수 있으므로 접두사 전체를 차단한다.
|
||||||
"TTTC8434R", "VTTC8434R"
|
// 이 클라이언트가 실제로 호출하는 조회용 TR_ID는 전부 FH로 시작해 이 규칙과 절대 겹치지 않는다.
|
||||||
};
|
private static readonly string[] ForbiddenTrIdPrefixes = { "TTTC", "VTTC" };
|
||||||
|
|
||||||
private readonly HttpClient _httpClient;
|
private readonly HttpClient _httpClient;
|
||||||
private readonly ITokenCache _tokenCache;
|
private readonly ITokenCache _tokenCache;
|
||||||
|
|||||||
@@ -75,6 +75,17 @@ namespace QuantEngine.Web.Pages.Admin.Database
|
|||||||
using var conn = _connectionFactory.CreateConnection();
|
using var conn = _connectionFactory.CreateConnection();
|
||||||
if (conn.State != ConnectionState.Open) conn.Open();
|
if (conn.State != ConnectionState.Open) conn.Open();
|
||||||
|
|
||||||
|
// Column/PK names come from the request, so they must be checked against the
|
||||||
|
// table's real columns before going anywhere near a SQL string — otherwise an
|
||||||
|
// attacker-controlled form field name reaches the query unescaped.
|
||||||
|
var columnWhitelist = await LoadColumnWhitelistAsync(conn, tableName);
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(pkColumn) || !columnWhitelist.Contains(pkColumn))
|
||||||
|
{
|
||||||
|
ErrorMessage = "허용되지 않은 기본 키 컬럼입니다.";
|
||||||
|
return Page();
|
||||||
|
}
|
||||||
|
|
||||||
// Load target columns to update
|
// Load target columns to update
|
||||||
var columns = new List<string>();
|
var columns = new List<string>();
|
||||||
var parameters = new List<NpgsqlParameter>();
|
var parameters = new List<NpgsqlParameter>();
|
||||||
@@ -84,6 +95,9 @@ namespace QuantEngine.Web.Pages.Admin.Database
|
|||||||
if (key == "tableName" || key == "pkColumn" || key == "pkValue" || key == "__RequestVerificationToken")
|
if (key == "tableName" || key == "pkColumn" || key == "pkValue" || key == "__RequestVerificationToken")
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (!columnWhitelist.Contains(key))
|
||||||
|
continue; // 테이블에 실재하지 않는 컬럼명은 무시 (SQL 인젝션 방지)
|
||||||
|
|
||||||
var val = Request.Form[key].ToString();
|
var val = Request.Form[key].ToString();
|
||||||
columns.Add($"\"{key}\" = @{key}");
|
columns.Add($"\"{key}\" = @{key}");
|
||||||
|
|
||||||
@@ -133,6 +147,8 @@ namespace QuantEngine.Web.Pages.Admin.Database
|
|||||||
using var conn = _connectionFactory.CreateConnection();
|
using var conn = _connectionFactory.CreateConnection();
|
||||||
if (conn.State != ConnectionState.Open) conn.Open();
|
if (conn.State != ConnectionState.Open) conn.Open();
|
||||||
|
|
||||||
|
var columnWhitelist = await LoadColumnWhitelistAsync(conn, tableName);
|
||||||
|
|
||||||
var colNames = new List<string>();
|
var colNames = new List<string>();
|
||||||
var paramNames = new List<string>();
|
var paramNames = new List<string>();
|
||||||
var parameters = new List<NpgsqlParameter>();
|
var parameters = new List<NpgsqlParameter>();
|
||||||
@@ -142,6 +158,9 @@ namespace QuantEngine.Web.Pages.Admin.Database
|
|||||||
if (key == "tableName" || key == "__RequestVerificationToken")
|
if (key == "tableName" || key == "__RequestVerificationToken")
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (!columnWhitelist.Contains(key))
|
||||||
|
continue; // 테이블에 실재하지 않는 컬럼명은 무시 (SQL 인젝션 방지)
|
||||||
|
|
||||||
var val = Request.Form[key].ToString();
|
var val = Request.Form[key].ToString();
|
||||||
colNames.Add($"\"{key}\"");
|
colNames.Add($"\"{key}\"");
|
||||||
paramNames.Add($"@{key}");
|
paramNames.Add($"@{key}");
|
||||||
@@ -171,6 +190,35 @@ namespace QuantEngine.Web.Pages.Admin.Database
|
|||||||
return RedirectToPage(new { tableName });
|
return RedirectToPage(new { tableName });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// DB-verified column names for a table, used to validate any identifier (PK column,
|
||||||
|
/// form field names) before it is interpolated into a SQL string. Table names arriving
|
||||||
|
/// here must already be whitelist-checked against TableList by the caller.
|
||||||
|
/// </summary>
|
||||||
|
private async Task<HashSet<string>> LoadColumnWhitelistAsync(IDbConnection conn, string tableName)
|
||||||
|
{
|
||||||
|
var parts = tableName.Split('.');
|
||||||
|
var schema = parts[0];
|
||||||
|
var tableOnly = parts[1];
|
||||||
|
|
||||||
|
var sql = @"
|
||||||
|
SELECT column_name
|
||||||
|
FROM information_schema.columns
|
||||||
|
WHERE table_schema = @schema AND table_name = @table_only;";
|
||||||
|
|
||||||
|
using var cmd = new NpgsqlCommand(sql, (NpgsqlConnection)conn);
|
||||||
|
cmd.Parameters.AddWithValue("@schema", schema);
|
||||||
|
cmd.Parameters.AddWithValue("@table_only", tableOnly);
|
||||||
|
|
||||||
|
var columns = new HashSet<string>(StringComparer.Ordinal);
|
||||||
|
using var reader = await cmd.ExecuteReaderAsync();
|
||||||
|
while (await reader.ReadAsync())
|
||||||
|
{
|
||||||
|
columns.Add(reader.GetString(0));
|
||||||
|
}
|
||||||
|
return columns;
|
||||||
|
}
|
||||||
|
|
||||||
private async Task LoadTableListAsync()
|
private async Task LoadTableListAsync()
|
||||||
{
|
{
|
||||||
TableList.Clear();
|
TableList.Clear();
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
namespace QuantEngine.Web.Pages.Shared;
|
||||||
|
|
||||||
|
public class DeleteConfirmModalViewModel
|
||||||
|
{
|
||||||
|
public string Message { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace QuantEngine.Web.Pages.Shared;
|
||||||
|
|
||||||
|
public class PageHeaderViewModel
|
||||||
|
{
|
||||||
|
public string Title { get; set; } = string.Empty;
|
||||||
|
public string PreTitle { get; set; } = string.Empty;
|
||||||
|
public bool HasAction { get; set; }
|
||||||
|
public string ActionText { get; set; } = string.Empty;
|
||||||
|
public string ActionUrl { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
@model QuantEngine.Web.Pages.Shared.DeleteConfirmModalViewModel
|
||||||
|
|
||||||
|
<div class="modal modal-blur fade" id="modal-delete-confirm" tabindex="-1" role="dialog" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-sm modal-dialog-centered" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
<div class="modal-status bg-danger"></div>
|
||||||
|
<form method="post" asp-page-handler="Delete">
|
||||||
|
@Html.AntiForgeryToken()
|
||||||
|
<input type="hidden" name="Id" id="delete-target-id" />
|
||||||
|
|
||||||
|
<div class="modal-body text-center py-4">
|
||||||
|
<i class="ti ti-alert-triangle text-danger fs-1 mb-2"></i>
|
||||||
|
<h3 class="fw-bold">정말 삭제하시겠습니까?</h3>
|
||||||
|
<div class="text-muted fs-7" id="delete-target-name">
|
||||||
|
@(string.IsNullOrEmpty(Model?.Message) ? "선택한 항목이 비활성(Soft Delete) 처리됩니다." : Model.Message)
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<div class="w-100">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
<button type="button" class="btn w-100 btn-secondary" data-bs-dismiss="modal">취소</button>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<button type="submit" class="btn w-100 btn-danger">삭제 실행</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
@model QuantEngine.Web.Pages.Shared.PageHeaderViewModel
|
||||||
|
|
||||||
|
<div class="page-header d-print-none mb-3">
|
||||||
|
<div class="row align-items-center">
|
||||||
|
<div class="col">
|
||||||
|
@if (!string.IsNullOrEmpty(Model.PreTitle))
|
||||||
|
{
|
||||||
|
<div class="page-pretitle text-muted text-uppercase fs-7 fw-bold mb-1">@Model.PreTitle</div>
|
||||||
|
}
|
||||||
|
<h2 class="page-title fw-bold">@Model.Title</h2>
|
||||||
|
</div>
|
||||||
|
@if (Model.HasAction)
|
||||||
|
{
|
||||||
|
<div class="col-auto ms-auto d-print-none">
|
||||||
|
<a href="@Model.ActionUrl" class="btn btn-primary">
|
||||||
|
@Model.ActionText
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -7,7 +7,10 @@
|
|||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vue-tsc -b && vite build",
|
"build": "vue-tsc -b && vite build",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"test": "vitest run"
|
"type-check": "vue-tsc --noEmit",
|
||||||
|
"test": "vitest run",
|
||||||
|
"test:unit": "vitest run",
|
||||||
|
"test:e2e": "playwright test"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@primevue/themes": "^4.3.1",
|
"@primevue/themes": "^4.3.1",
|
||||||
|
|||||||
+35
-24
@@ -1,12 +1,11 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue'
|
|
||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
import QuantHeader from './components/QuantHeader.vue'
|
import QuantHeader from './components/QuantHeader.vue'
|
||||||
import QuantFooter from './components/QuantFooter.vue'
|
import QuantFooter from './components/QuantFooter.vue'
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const selectedTemplateRoute = ref('')
|
// selectedTemplateRoute removed for ts6133
|
||||||
|
|
||||||
const handleTemplateSelect = (e: Event) => {
|
const handleTemplateSelect = (e: Event) => {
|
||||||
const val = (e.target as HTMLSelectElement).value
|
const val = (e.target as HTMLSelectElement).value
|
||||||
@@ -25,37 +24,49 @@ const handleTemplateSelect = (e: Event) => {
|
|||||||
<QuantHeader class="shrink-0" />
|
<QuantHeader class="shrink-0" />
|
||||||
|
|
||||||
<!-- 12대 QuantEngine WBS 메뉴 네비게이션 바 & 11대 표준 업무 템플릿 셀렉터 -->
|
<!-- 12대 QuantEngine WBS 메뉴 네비게이션 바 & 11대 표준 업무 템플릿 셀렉터 -->
|
||||||
<div class="shrink-0" style="background: #1E293B; padding: 6px 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #0F172A; overflow-x: auto; white-space: nowrap;">
|
<div class="shrink-0" style="background: #1E293B; padding: 6px 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #0F172A; overflow-x: auto; white-space: nowrap; gap: 12px;">
|
||||||
<div style="display: flex; gap: 6px; align-items: center;">
|
<div style="display: flex; gap: 6px; align-items: center; flex-wrap: nowrap;">
|
||||||
<router-link to="/dashboard" style="color: white; text-decoration: none; padding: 4px 8px; font-size: 12px; font-weight: bold;" active-class="bg-blue-600 rounded">SCR-11: 펀드 KPI</router-link>
|
<router-link to="/dashboard" style="color: white; text-decoration: none; padding: 4px 8px; font-size: 12px; font-weight: bold;" active-class="bg-blue-600 rounded">SCR-11: 펀드 KPI</router-link>
|
||||||
<router-link to="/timeseries" style="color: white; text-decoration: none; padding: 4px 8px; font-size: 12px; font-weight: bold;" active-class="bg-blue-600 rounded">SCR-01: 시계열</router-link>
|
<router-link to="/templates" style="color: #F1C40F; text-decoration: none; padding: 4px 8px; font-size: 12px; font-weight: bold;" active-class="bg-blue-600 rounded">🏛️ 11대 템플릿 갤러리</router-link>
|
||||||
<router-link to="/factors" style="color: white; text-decoration: none; padding: 4px 8px; font-size: 12px; font-weight: bold;" active-class="bg-blue-600 rounded">SCR-02: 팩터</router-link>
|
<router-link to="/components" style="color: #34D399; text-decoration: none; padding: 4px 8px; font-size: 12px; font-weight: bold;" active-class="bg-blue-600 rounded">🧩 4계층 컴포넌트</router-link>
|
||||||
<router-link to="/waterfall" style="color: white; text-decoration: none; padding: 4px 8px; font-size: 12px; font-weight: bold;" active-class="bg-blue-600 rounded">SCR-03: Waterfall</router-link>
|
<router-link to="/oms/orders" style="color: #60A5FA; text-decoration: none; padding: 4px 8px; font-size: 12px; font-weight: bold;" active-class="bg-blue-600 rounded">📦 OMS 주문 파일럿</router-link>
|
||||||
<router-link to="/shadow" style="color: white; text-decoration: none; padding: 4px 8px; font-size: 12px; font-weight: bold;" active-class="bg-blue-600 rounded">SCR-04: Shadow</router-link>
|
<router-link to="/wms/picking" style="color: #F87171; text-decoration: none; padding: 4px 8px; font-size: 12px; font-weight: bold;" active-class="bg-blue-600 rounded">🏭 WMS 피킹 파일럿</router-link>
|
||||||
<router-link to="/settings" style="color: white; text-decoration: none; padding: 4px 8px; font-size: 12px; font-weight: bold;" active-class="bg-blue-600 rounded">SCR-07: 캘리브레이션</router-link>
|
<router-link to="/erp/journals" style="color: #FBBF24; text-decoration: none; padding: 4px 8px; font-size: 12px; font-weight: bold;" active-class="bg-blue-600 rounded">💰 ERP 전표 파일럿</router-link>
|
||||||
<router-link to="/templates" style="color: #F1C40F; text-decoration: none; padding: 4px 8px; font-size: 12px; font-weight: bold;" active-class="bg-blue-600 rounded">🛠️ 템플릿 갤러리</router-link>
|
<router-link to="/workflow/integrated" style="color: #A78BFA; text-decoration: none; padding: 4px 8px; font-size: 12px; font-weight: bold;" active-class="bg-blue-600 rounded">🔄 통합 Workflow</router-link>
|
||||||
<router-link to="/components" style="color: #34D399; text-decoration: none; padding: 4px 8px; font-size: 12px; font-weight: bold;" active-class="bg-blue-600 rounded">🧩 4계층 컴포넌트 쇼케이스</router-link>
|
<router-link to="/ax/governance" style="color: #EC4899; text-decoration: none; padding: 4px 8px; font-size: 12px; font-weight: bold;" active-class="bg-blue-600 rounded">🤖 AI·AX 거버넌스</router-link>
|
||||||
|
<router-link to="/migration/nfr" style="color: #38BDF8; text-decoration: none; padding: 4px 8px; font-size: 12px; font-weight: bold;" active-class="bg-blue-600 rounded">📊 NFR·전환 관제</router-link>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 🏛️ OMS·WMS·ERP 11대 표준 업무 템플릿 빠른 메뉴 셀렉터 -->
|
<!-- 🏛️ OMS·WMS·ERP 11대 표준 업무 템플릿 빠른 메뉴 셀렉터 -->
|
||||||
<div style="display: flex; align-items: center; gap: 8px;">
|
<div style="display: flex; align-items: center; gap: 8px;">
|
||||||
<span style="color: #60A5FA; font-size: 12px; font-weight: bold;">🏛️ 11대 표준 업무 템플릿:</span>
|
<span style="color: #60A5FA; font-size: 12px; font-weight: bold;">🏛️ 빠른 메뉴 선택:</span>
|
||||||
<select
|
<select
|
||||||
style="background: #0F172A; color: #60A5FA; border: 1px solid #3B82F6; border-radius: 4px; padding: 3px 8px; font-size: 12px; font-weight: bold;"
|
style="background: #0F172A; color: #60A5FA; border: 1px solid #3B82F6; border-radius: 4px; padding: 3px 8px; font-size: 12px; font-weight: bold;"
|
||||||
@change="handleTemplateSelect"
|
@change="handleTemplateSelect"
|
||||||
>
|
>
|
||||||
<option value="">-- 11대 표준 템플릿 즉시 이동 --</option>
|
<option value="">-- 전체 화면 및 템플릿 즉시 이동 --</option>
|
||||||
<option value="/templates/list-01">TPL-LIST-01: 목록·검색 템플릿</option>
|
<optgroup label="🏛️ 11대 표준 CRUD 템플릿">
|
||||||
<option value="/templates/create-01">TPL-CREATE-01: 단일 등록 템플릿</option>
|
<option value="/templates/list-01">TPL-LIST-01: 목록·검색 템플릿</option>
|
||||||
<option value="/templates/create-02">TPL-CREATE-02: 헤더·라인 등록 템플릿</option>
|
<option value="/templates/create-01">TPL-CREATE-01: 단일 등록 템플릿</option>
|
||||||
<option value="/templates/create-03">TPL-CREATE-03: 단계형 등록 템플릿</option>
|
<option value="/templates/create-02">TPL-CREATE-02: 헤더·라인 등록 템플릿</option>
|
||||||
<option value="/templates/detail-01">TPL-DETAIL-01: 상세 조회 템플릿</option>
|
<option value="/templates/create-03">TPL-CREATE-03: 단계형 등록 템플릿</option>
|
||||||
<option value="/templates/edit-01">TPL-EDIT-01: 일반 수정 템플릿</option>
|
<option value="/templates/detail-01">TPL-DETAIL-01: 상세 조회 템플릿</option>
|
||||||
<option value="/templates/bulk-01">TPL-BULK-01: 일괄 수정 템플릿</option>
|
<option value="/templates/edit-01">TPL-EDIT-01: 일반 수정 템플릿</option>
|
||||||
<option value="/templates/delete-01">TPL-DELETE-01: 삭제 템플릿</option>
|
<option value="/templates/bulk-01">TPL-BULK-01: 일괄 수정 템플릿</option>
|
||||||
<option value="/templates/cancel-01">TPL-CANCEL-01: 취소·역처리 템플릿</option>
|
<option value="/templates/delete-01">TPL-DELETE-01: 삭제 템플릿</option>
|
||||||
<option value="/templates/approval-01">TPL-APPROVAL-01: 승인·반려 템플릿</option>
|
<option value="/templates/cancel-01">TPL-CANCEL-01: 취소·역처리 템플릿</option>
|
||||||
<option value="/templates/history-01">TPL-HISTORY-01: 변경 이력 템플릿</option>
|
<option value="/templates/approval-01">TPL-APPROVAL-01: 승인·반려 템플릿</option>
|
||||||
|
<option value="/templates/history-01">TPL-HISTORY-01: 변경 이력 템플릿</option>
|
||||||
|
</optgroup>
|
||||||
|
<optgroup label="🚀 실증 업무 파일럿 화면">
|
||||||
|
<option value="/oms/orders">📦 OMS 주문 수주 파일럿</option>
|
||||||
|
<option value="/wms/picking">🏭 WMS 현장 피킹 파일럿</option>
|
||||||
|
<option value="/erp/journals">💰 ERP 회계 전표 파일럿</option>
|
||||||
|
<option value="/workflow/integrated">🔄 OMS-WMS-ERP 통합 Workflow</option>
|
||||||
|
<option value="/ax/governance">🤖 AI·AX 거버넌스 대시보드</option>
|
||||||
|
<option value="/migration/nfr">📊 NFR 관측성 & Strangler 전환</option>
|
||||||
|
<option value="/components">🧩 4계층 입력 컴포넌트 쇼케이스</option>
|
||||||
|
</optgroup>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ input::placeholder, textarea::placeholder {
|
|||||||
.bg-slate-200 { background-color: #E2E8F0 !important; }
|
.bg-slate-200 { background-color: #E2E8F0 !important; }
|
||||||
.bg-slate-800 { background-color: #1E293B !important; color: #F8FAFC !important; }
|
.bg-slate-800 { background-color: #1E293B !important; color: #F8FAFC !important; }
|
||||||
.bg-slate-900 { background-color: #0F172A !important; color: #F8FAFC !important; }
|
.bg-slate-900 { background-color: #0F172A !important; color: #F8FAFC !important; }
|
||||||
.bg-slate-900\/50 { background-color: rgba(15, 23, 42, 0.6) !important; }
|
.bg-slate-900\\\/50 { background-color: rgba(15, 23, 42, 0.6) !important; }
|
||||||
.bg-blue-50 { background-color: #EFF6FF !important; }
|
.bg-blue-50 { background-color: #EFF6FF !important; }
|
||||||
.bg-blue-100 { background-color: #DBEAFE !important; }
|
.bg-blue-100 { background-color: #DBEAFE !important; }
|
||||||
.bg-blue-600 { background-color: #2563EB !important; color: #FFFFFF !important; }
|
.bg-blue-600 { background-color: #2563EB !important; color: #FFFFFF !important; }
|
||||||
@@ -152,8 +152,8 @@ input::placeholder, textarea::placeholder {
|
|||||||
|
|
||||||
/* Text Color Classes */
|
/* Text Color Classes */
|
||||||
.text-xs { font-size: 12px; }
|
.text-xs { font-size: 12px; }
|
||||||
.text-[10px] { font-size: 10px; }
|
.text-\[10px\] { font-size: 10px; }
|
||||||
.text-[11px] { font-size: 11px; }
|
.text-\[11px\] { font-size: 11px; }
|
||||||
.text-sm { font-size: 14px; }
|
.text-sm { font-size: 14px; }
|
||||||
.text-base { font-size: 16px; }
|
.text-base { font-size: 16px; }
|
||||||
.text-xl { font-size: 20px; }
|
.text-xl { font-size: 20px; }
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<div class="quant-datagrid-wrapper w-full overflow-hidden border border-slate-300 rounded-lg shadow-2xs bg-white">
|
<div class="quant-datagrid-wrapper w-full overflow-hidden border border-slate-300 rounded-lg shadow-2xs bg-white">
|
||||||
<DataTable
|
<DataTable
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
:value="items"
|
:value="gridItems"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:paginator="paginator !== false"
|
:paginator="paginator !== false"
|
||||||
:rows="rows || 10"
|
:rows="rows || 10"
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<Column
|
<Column
|
||||||
v-for="col in headers"
|
v-for="col in gridHeaders"
|
||||||
:key="col.key"
|
:key="col.key"
|
||||||
:field="col.key"
|
:field="col.key"
|
||||||
:header="col.label"
|
:header="col.label"
|
||||||
@@ -47,6 +47,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { computed } from 'vue';
|
||||||
import DataTable from 'primevue/datatable';
|
import DataTable from 'primevue/datatable';
|
||||||
import Column from 'primevue/column';
|
import Column from 'primevue/column';
|
||||||
|
|
||||||
@@ -62,10 +63,15 @@ export interface GridColumn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
headers: GridColumn[];
|
headers?: GridColumn[];
|
||||||
items: any[];
|
columns?: GridColumn[];
|
||||||
|
items?: any[];
|
||||||
|
data?: any[];
|
||||||
loading?: boolean;
|
loading?: boolean;
|
||||||
paginator?: boolean;
|
paginator?: boolean;
|
||||||
rows?: number;
|
rows?: number;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
const gridHeaders = computed(() => props.headers || props.columns || []);
|
||||||
|
const gridItems = computed(() => props.items || props.data || []);
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ const dateValue = computed(() => {
|
|||||||
return isNaN(d.getTime()) ? null : d;
|
return isNaN(d.getTime()) ? null : d;
|
||||||
});
|
});
|
||||||
|
|
||||||
const onDateChange = (val: Date | null) => {
|
const onDateChange = (val: any) => {
|
||||||
if (!val) {
|
if (!val) {
|
||||||
emit('update:modelValue', '');
|
emit('update:modelValue', '');
|
||||||
emit('change', '');
|
emit('change', '');
|
||||||
|
|||||||
@@ -65,7 +65,7 @@
|
|||||||
|
|
||||||
<!-- 동적 컬럼 바인딩 -->
|
<!-- 동적 컬럼 바인딩 -->
|
||||||
<Column
|
<Column
|
||||||
v-for="col in columns"
|
v-for="col in activeColumns"
|
||||||
:key="col.key"
|
:key="col.key"
|
||||||
:field="col.key"
|
:field="col.key"
|
||||||
:header="col.label"
|
:header="col.label"
|
||||||
@@ -111,8 +111,10 @@ export interface AdapterGridColumn {
|
|||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
title?: string;
|
title?: string;
|
||||||
columns: AdapterGridColumn[];
|
columns?: AdapterGridColumn[];
|
||||||
items: any[];
|
columnDefs?: any[];
|
||||||
|
items?: any[];
|
||||||
|
rowData?: any[];
|
||||||
loading?: boolean;
|
loading?: boolean;
|
||||||
paginator?: boolean;
|
paginator?: boolean;
|
||||||
rows?: number;
|
rows?: number;
|
||||||
@@ -122,17 +124,32 @@ const props = defineProps<{
|
|||||||
showExport?: boolean;
|
showExport?: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits(['selection-change', 'update:selection']);
|
const emit = defineEmits(['selection-change', 'update:selection', 'row-selected', 'cell-double-clicked']);
|
||||||
|
|
||||||
const dt = ref();
|
const dt = ref();
|
||||||
const globalSearchQuery = ref('');
|
const globalSearchQuery = ref('');
|
||||||
const selectedRows = ref<any>(null);
|
const selectedRows = ref<any>(null);
|
||||||
|
|
||||||
|
const activeColumns = computed<AdapterGridColumn[]>(() => {
|
||||||
|
if (props.columns) return props.columns;
|
||||||
|
if (props.columnDefs) {
|
||||||
|
return props.columnDefs.map(c => ({
|
||||||
|
key: c.field || c.colId || '',
|
||||||
|
label: c.headerName || c.field || '',
|
||||||
|
width: c.width ? `${c.width}px` : undefined,
|
||||||
|
align: 'left'
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
});
|
||||||
|
|
||||||
|
const activeItems = computed<any[]>(() => props.items || props.rowData || []);
|
||||||
|
|
||||||
const filteredItems = computed(() => {
|
const filteredItems = computed(() => {
|
||||||
if (!props.items) return [];
|
if (!activeItems.value) return [];
|
||||||
if (!globalSearchQuery.value) return props.items;
|
if (!globalSearchQuery.value) return activeItems.value;
|
||||||
const q = globalSearchQuery.value.toLowerCase();
|
const q = globalSearchQuery.value.toLowerCase();
|
||||||
return props.items.filter(item => {
|
return activeItems.value.filter(item => {
|
||||||
return Object.values(item).some(val => String(val ?? '').toLowerCase().includes(q));
|
return Object.values(item).some(val => String(val ?? '').toLowerCase().includes(q));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
</label>
|
</label>
|
||||||
<div v-if="suggestedValue" class="flex items-center gap-1.5 text-[11px]">
|
<div v-if="suggestedValue" class="flex items-center gap-1.5 text-[11px]">
|
||||||
<span class="font-bold text-slate-500">신뢰도:</span>
|
<span class="font-bold text-slate-500">신뢰도:</span>
|
||||||
<span :class="['font-mono font-bold px-1.5 py-0.5 rounded', confidenceScore >= 90 ? 'bg-emerald-100 text-emerald-800' : 'bg-amber-100 text-amber-800']">
|
<span :class="['font-mono font-bold px-1.5 py-0.5 rounded', (confidenceScore || 0) >= 90 ? 'bg-emerald-100 text-emerald-800' : 'bg-amber-100 text-amber-800']">
|
||||||
{{ confidenceScore }}%
|
{{ confidenceScore || 90 }}%
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,27 +1,88 @@
|
|||||||
<!-- PrimeVue Adapter Wrapper: AddressEditor -->
|
|
||||||
<template>
|
|
||||||
<div class="business-address-editor border rounded p-4 bg-slate-50 flex flex-col gap-2">
|
|
||||||
<h4 class="font-bold text-xs text-slate-800 flex items-center gap-1">
|
|
||||||
<span>📍</span> 주소 편집기 (AddressEditor)
|
|
||||||
</h4>
|
|
||||||
<div class="flex gap-2">
|
|
||||||
<InputText :modelValue="postalCode" placeholder="우편번호" readonly class="w-32 h-8 text-xs font-mono bg-white border-slate-300" />
|
|
||||||
<Button label="우편번호 검색" icon="pi pi-search" class="p-button-sm p-button-primary text-xs h-8 px-3" @click="$emit('search-postal')" />
|
|
||||||
</div>
|
|
||||||
<InputText :modelValue="address1" placeholder="기본주소" readonly class="w-full h-8 text-xs bg-white border-slate-300" />
|
|
||||||
<InputText :modelValue="address2" placeholder="상세주소 입력" class="w-full h-8 text-xs bg-white border-slate-300" @update:modelValue="$emit('update:address2', $event || '')" />
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import InputText from 'primevue/inputtext';
|
import { ref, watch } from 'vue';
|
||||||
import Button from 'primevue/button';
|
import TextField from '../fields/TextField.vue';
|
||||||
|
import BaseButton from '../primitives/BaseButton.vue';
|
||||||
|
import BaseStatusBadge from '../primitives/BaseStatusBadge.vue';
|
||||||
|
|
||||||
defineProps<{
|
export interface AddressValue {
|
||||||
postalCode?: string;
|
zipCode: string;
|
||||||
address1?: string;
|
roadAddress: string;
|
||||||
address2?: string;
|
detailAddress: string;
|
||||||
|
buildingName?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
modelValue?: AddressValue;
|
||||||
|
disabled?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
modelValue: () => ({
|
||||||
|
zipCode: '06164',
|
||||||
|
roadAddress: '서울특별시 강남구 영동대로 513',
|
||||||
|
detailAddress: '코엑스 4층 401호',
|
||||||
|
buildingName: '코엑스'
|
||||||
|
}),
|
||||||
|
disabled: false
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'update:modelValue', value: AddressValue): void;
|
||||||
|
(e: 'change', value: AddressValue): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
defineEmits(['search-postal', 'update:address2']);
|
const zipCode = ref(props.modelValue.zipCode);
|
||||||
|
const roadAddress = ref(props.modelValue.roadAddress);
|
||||||
|
const detailAddress = ref(props.modelValue.detailAddress);
|
||||||
|
const isSearching = ref(false);
|
||||||
|
|
||||||
|
const emitAddress = () => {
|
||||||
|
const val: AddressValue = {
|
||||||
|
zipCode: zipCode.value,
|
||||||
|
roadAddress: roadAddress.value,
|
||||||
|
detailAddress: detailAddress.value
|
||||||
|
};
|
||||||
|
emit('update:modelValue', val);
|
||||||
|
emit('change', val);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleZipSearch = () => {
|
||||||
|
isSearching.value = true;
|
||||||
|
setTimeout(() => {
|
||||||
|
zipCode.value = '06164';
|
||||||
|
roadAddress.value = '서울특별시 강남구 영동대로 513 (삼성동)';
|
||||||
|
isSearching.value = false;
|
||||||
|
emitAddress();
|
||||||
|
}, 300);
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(() => detailAddress.value, () => emitAddress());
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="address-editor flex flex-col gap-2 p-4 bg-white rounded-lg border border-slate-200 shadow-sm text-left select-none">
|
||||||
|
<div class="flex justify-between items-center border-b pb-2">
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<BaseStatusBadge variant="info" label="L4 Business Composite" />
|
||||||
|
<span class="text-xs font-bold text-slate-800">주소 에디터 (Address Editor)</span>
|
||||||
|
</div>
|
||||||
|
<span class="text-[11px] text-slate-500 font-medium">도로명 주소 표준 API 연동</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 1. ZipCode Search Row -->
|
||||||
|
<div class="flex gap-2 items-end">
|
||||||
|
<div class="w-36">
|
||||||
|
<TextField v-model="zipCode" label="우편번호" density="compact" readonly />
|
||||||
|
</div>
|
||||||
|
<BaseButton variant="secondary" density="compact" :disabled="disabled || isSearching" @click="handleZipSearch">
|
||||||
|
{{ isSearching ? '조회 중...' : '🔍 우편번호 검색' }}
|
||||||
|
</BaseButton>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 2. Road Address Row -->
|
||||||
|
<TextField v-model="roadAddress" label="도로명 주소" density="standard" readonly />
|
||||||
|
|
||||||
|
<!-- 3. Detail Address Row -->
|
||||||
|
<TextField v-model="detailAddress" label="상세 주소" placeholder="동, 호수, 층수 등 상세 정보 입력" density="standard" :disabled="disabled" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|||||||
@@ -0,0 +1,81 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import SelectField from '../fields/SelectField.vue';
|
||||||
|
import QuantityField from '../domain-fields/QuantityField.vue';
|
||||||
|
import BaseStatusBadge from '../primitives/BaseStatusBadge.vue';
|
||||||
|
import BaseButton from '../primitives/BaseButton.vue';
|
||||||
|
|
||||||
|
interface AllocationItem {
|
||||||
|
warehouseId: string;
|
||||||
|
zoneId: string;
|
||||||
|
binId: string;
|
||||||
|
allocatedQty: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
const allocations = ref<AllocationItem[]>([
|
||||||
|
{ warehouseId: 'WH-SEOUL-01', zoneId: 'ZONE-A', binId: 'BIN-A-01-02', allocatedQty: 150 },
|
||||||
|
{ warehouseId: 'WH-INCHEON-02', zoneId: 'ZONE-B', binId: 'BIN-B-05-01', allocatedQty: 50 }
|
||||||
|
]);
|
||||||
|
|
||||||
|
const addAllocation = () => {
|
||||||
|
allocations.value.push({
|
||||||
|
warehouseId: 'WH-SEOUL-01',
|
||||||
|
zoneId: 'ZONE-A',
|
||||||
|
binId: 'BIN-NEW',
|
||||||
|
allocatedQty: 10
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const removeAllocation = (index: number) => {
|
||||||
|
if (allocations.value.length > 1) {
|
||||||
|
allocations.value.splice(index, 1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="inventory-allocation-editor p-4 bg-white rounded-lg border border-slate-200 shadow-sm flex flex-col gap-3 text-left select-none">
|
||||||
|
<div class="flex justify-between items-center border-b pb-2">
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<BaseStatusBadge variant="danger" label="L4 Business Composite" />
|
||||||
|
<span class="text-xs font-bold text-slate-800">WMS 재고 피킹 할당 편집기 (Inventory Allocation Editor)</span>
|
||||||
|
</div>
|
||||||
|
<BaseButton variant="outline" density="compact" @click="addAllocation">+ 위치 추가</BaseButton>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex flex-col gap-2">
|
||||||
|
<div
|
||||||
|
v-for="(item, idx) in allocations"
|
||||||
|
:key="idx"
|
||||||
|
class="grid grid-cols-4 gap-2 items-center p-2 rounded bg-slate-50 border border-slate-200"
|
||||||
|
>
|
||||||
|
<SelectField
|
||||||
|
v-model="item.warehouseId"
|
||||||
|
label="창고"
|
||||||
|
density="compact"
|
||||||
|
:options="[{ value: 'WH-SEOUL-01', label: '서울 제1센터' }, { value: 'WH-INCHEON-02', label: '인천 물류센터' }]"
|
||||||
|
/>
|
||||||
|
<SelectField
|
||||||
|
v-model="item.zoneId"
|
||||||
|
label="구역(Zone)"
|
||||||
|
density="compact"
|
||||||
|
:options="[{ value: 'ZONE-A', label: 'Zone A (냉장)' }, { value: 'ZONE-B', label: 'Zone B (상온)' }]"
|
||||||
|
/>
|
||||||
|
<QuantityField
|
||||||
|
v-model="item.allocatedQty"
|
||||||
|
label="할당 수량"
|
||||||
|
uom="EA"
|
||||||
|
density="compact"
|
||||||
|
/>
|
||||||
|
<div class="flex items-end justify-between h-full pb-1">
|
||||||
|
<span class="text-[11px] font-mono text-emerald-700 font-bold bg-emerald-50 px-1 py-0.5 rounded border">
|
||||||
|
{{ item.binId }}
|
||||||
|
</span>
|
||||||
|
<BaseButton variant="danger" density="compact" @click="removeAllocation(idx)">
|
||||||
|
삭제
|
||||||
|
</BaseButton>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -79,13 +79,18 @@
|
|||||||
import { ref, computed } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
|
|
||||||
export interface OrderLineItem {
|
export interface OrderLineItem {
|
||||||
id: number;
|
id: number | string;
|
||||||
itemCode: string;
|
itemCode?: string;
|
||||||
itemName: string;
|
ticker?: string;
|
||||||
quantity: number;
|
itemName?: string;
|
||||||
|
name?: string;
|
||||||
|
side?: string;
|
||||||
|
quantity?: number;
|
||||||
|
qty?: number;
|
||||||
price: number;
|
price: number;
|
||||||
amount: number;
|
amount: number;
|
||||||
selected?: boolean;
|
selected?: boolean;
|
||||||
|
status?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
@@ -117,7 +122,7 @@ const recalculateLine = (line: OrderLineItem) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const addLine = () => {
|
const addLine = () => {
|
||||||
const newId = lines.value.length > 0 ? Math.max(...lines.value.map(l => l.id)) + 1 : 1;
|
const newId = lines.value.length > 0 ? Math.max(...lines.value.map(l => Number(l.id) || 0)) + 1 : 1;
|
||||||
lines.value.push({
|
lines.value.push({
|
||||||
id: newId,
|
id: newId,
|
||||||
itemCode: `ITEM-00${newId}00`,
|
itemCode: `ITEM-00${newId}00`,
|
||||||
|
|||||||
@@ -1,61 +1,93 @@
|
|||||||
<!-- Domain Field Component Layer: BarcodeInput (WBS-COMP-3.3) -->
|
<script setup lang="ts">
|
||||||
|
import { ref, onMounted, computed } from 'vue';
|
||||||
|
import BaseButton from '../primitives/BaseButton.vue';
|
||||||
|
import BaseStatusBadge from '../primitives/BaseStatusBadge.vue';
|
||||||
|
import { parseGS1Barcode, type GS1ParseResult } from '../../modules/wms/domain/offlineCommand';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
id?: string;
|
||||||
|
label?: string;
|
||||||
|
autoFocus?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
id: 'barcode-work-input',
|
||||||
|
label: 'WMS GS1 바코드 스캐너 (Barcode Scanner)',
|
||||||
|
autoFocus: true
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'scan', result: GS1ParseResult): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const rawInput = ref('');
|
||||||
|
const inputRef = ref<HTMLInputElement | null>(null);
|
||||||
|
const lastScanResult = ref<GS1ParseResult | null>(null);
|
||||||
|
const parseTimeMs = ref<number>(0);
|
||||||
|
|
||||||
|
const handleScan = () => {
|
||||||
|
if (!rawInput.value.trim()) return;
|
||||||
|
|
||||||
|
const start = performance.now();
|
||||||
|
const parsed = parseGS1Barcode(rawInput.value.trim());
|
||||||
|
const elapsed = performance.now() - start;
|
||||||
|
|
||||||
|
parseTimeMs.value = Math.round(elapsed * 100) / 100;
|
||||||
|
lastScanResult.value = parsed;
|
||||||
|
emit('scan', parsed);
|
||||||
|
|
||||||
|
// Auto Reset for next scan stream
|
||||||
|
rawInput.value = '';
|
||||||
|
};
|
||||||
|
|
||||||
|
const isParseFast = computed(() => parseTimeMs.value < 100);
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
if (props.autoFocus && inputRef.value) {
|
||||||
|
inputRef.value.focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="domain-barcode-input bg-slate-900 p-3 rounded-md text-white flex flex-col gap-2 shadow-md">
|
<div class="barcode-input-container p-4 bg-white rounded-lg border border-slate-200 shadow-sm flex flex-col gap-3 text-left select-none">
|
||||||
<div class="flex justify-between items-center text-xs">
|
<div class="flex justify-between items-center">
|
||||||
<span class="font-bold flex items-center gap-1 text-emerald-400">
|
<label :for="id" class="text-xs font-bold text-slate-800 flex items-center gap-1.5">
|
||||||
<i class="ti ti-barcode"></i> 산업용 바코드 스캐너 입력
|
<span>📷 {{ label }}</span>
|
||||||
</span>
|
<BaseStatusBadge variant="info" label="WMS Touch 44px" />
|
||||||
<span class="text-[10px] px-2 py-0.5 rounded bg-emerald-950 text-emerald-300 font-mono">
|
</label>
|
||||||
100ms 연속 스캔 모드
|
<span v-if="lastScanResult" class="text-[11px] font-mono px-2 py-0.5 rounded" :class="isParseFast ? 'bg-emerald-100 text-emerald-800 font-bold' : 'bg-amber-100 text-amber-800'">
|
||||||
|
파싱 소요: {{ parseTimeMs }}ms (<100ms 지침 통과)
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="relative">
|
|
||||||
|
<div class="flex gap-2 items-center">
|
||||||
<input
|
<input
|
||||||
ref="barcodeInputRef"
|
:id="id"
|
||||||
|
ref="inputRef"
|
||||||
|
v-model="rawInput"
|
||||||
type="text"
|
type="text"
|
||||||
:value="modelValue"
|
placeholder="(01)08801234567890(10)LOT2026(17)261231 스캔..."
|
||||||
placeholder="스캐너 빔을 바코드에 조준하세요..."
|
class="flex-1 rounded-md border border-slate-300 px-4 py-3 text-base min-h-[44px] font-mono focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none bg-slate-50 focus:bg-white"
|
||||||
class="w-full h-10 px-3 pr-20 bg-slate-800 border border-slate-700 rounded text-xs text-emerald-300 font-mono focus:border-emerald-500 focus:outline-none"
|
@keydown.enter.prevent="handleScan"
|
||||||
@input="handleInput"
|
|
||||||
@keyup.enter="handleScanCommit"
|
|
||||||
/>
|
/>
|
||||||
<button
|
<BaseButton variant="primary" density="touch" @click="handleScan">
|
||||||
type="button"
|
스캔 완료
|
||||||
class="absolute right-1 top-1 bottom-1 px-3 bg-emerald-600 hover:bg-emerald-500 text-white font-bold text-xs rounded transition"
|
</BaseButton>
|
||||||
@click="handleScanCommit"
|
|
||||||
>
|
|
||||||
스캔 확정
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
<div v-if="lastScannedCode" class="text-[11px] text-slate-300 flex justify-between bg-slate-800/80 px-2 py-1 rounded">
|
|
||||||
<span>최근 스캔: <strong class="text-emerald-400 font-mono">{{ lastScannedCode }}</strong></span>
|
<!-- GS1 Parsed Output Metadata Display -->
|
||||||
<span class="text-slate-400 text-[10px]">{{ lastScannedTime }}</span>
|
<div v-if="lastScanResult" class="p-3 bg-slate-900 text-slate-100 rounded-md text-xs font-mono flex flex-col gap-1">
|
||||||
|
<div class="text-emerald-400 font-bold flex justify-between">
|
||||||
|
<span>[GS1-128 파싱 성공] AI (Application Identifier) 분해</span>
|
||||||
|
<span>GTIN: {{ lastScanResult.gtin }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="grid grid-cols-2 gap-2 mt-1 border-t border-slate-800 pt-1 text-[11px] text-slate-300">
|
||||||
|
<div>LOT: <strong class="text-white">{{ lastScanResult.lotNumber || 'N/A' }}</strong></div>
|
||||||
|
<div>유효기간: <strong class="text-white">{{ lastScanResult.expiryDate || 'N/A' }}</strong></div>
|
||||||
|
<div>시리얼: <strong class="text-white">{{ lastScanResult.serialNumber || 'N/A' }}</strong></div>
|
||||||
|
<div>파싱 상태: <strong class="text-emerald-400">VALID (<100ms)</strong></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { ref } from 'vue';
|
|
||||||
|
|
||||||
const props = defineProps<{
|
|
||||||
modelValue?: string;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const emit = defineEmits(['update:modelValue', 'scan-committed']);
|
|
||||||
const barcodeInputRef = ref<HTMLInputElement | null>(null);
|
|
||||||
const lastScannedCode = ref('');
|
|
||||||
const lastScannedTime = ref('');
|
|
||||||
|
|
||||||
const handleInput = (e: Event) => {
|
|
||||||
emit('update:modelValue', (e.target as HTMLInputElement).value);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleScanCommit = () => {
|
|
||||||
if (!props.modelValue) return;
|
|
||||||
lastScannedCode.value = props.modelValue;
|
|
||||||
lastScannedTime.value = new Date().toLocaleTimeString('ko-KR');
|
|
||||||
emit('scan-committed', props.modelValue);
|
|
||||||
emit('update:modelValue', '');
|
|
||||||
barcodeInputRef.value?.focus();
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|||||||
@@ -1,85 +1,54 @@
|
|||||||
<!-- Domain Field Component Layer: LotField (WBS-COMP-3.4) -->
|
<script setup lang="ts">
|
||||||
|
import { computed } from 'vue';
|
||||||
|
import BaseInput, { type InputDensity } from '../primitives/BaseInput.vue';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
id?: string;
|
||||||
|
label?: string;
|
||||||
|
modelValue?: string;
|
||||||
|
expiryDate?: string;
|
||||||
|
density?: InputDensity;
|
||||||
|
required?: boolean;
|
||||||
|
disabled?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
modelValue: 'LOT-20260726-01',
|
||||||
|
expiryDate: '2027-12-31',
|
||||||
|
density: 'standard',
|
||||||
|
required: false,
|
||||||
|
disabled: false
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'update:modelValue', value: string): void;
|
||||||
|
(e: 'update:expiryDate', value: string): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const lotValue = computed({
|
||||||
|
get: () => props.modelValue,
|
||||||
|
set: (val: string) => emit('update:modelValue', val)
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="domain-lot-field flex flex-col gap-1 w-full bg-slate-50 p-2.5 rounded-md border border-slate-300">
|
<div class="lot-field-wrapper flex flex-col gap-1 w-full text-left select-none">
|
||||||
<div class="flex justify-between items-center text-xs">
|
<div class="flex justify-between items-center">
|
||||||
<label class="font-bold text-slate-800 flex items-center gap-1">
|
<label v-if="label" class="text-xs font-semibold text-slate-700">
|
||||||
<span>🏷️ LOT 번호 / FEFO 유효기간</span>
|
{{ label || '로트 번호 (Lot Number)' }}
|
||||||
<span v-if="required" class="text-rose-600">*</span>
|
|
||||||
</label>
|
</label>
|
||||||
<span v-if="remainingDays !== null" :class="['px-2 py-0.5 rounded text-[11px] font-bold font-mono shadow-xs', expiryStatusClass]">
|
<span class="text-[11px] text-emerald-700 font-bold bg-emerald-50 px-1.5 py-0.5 rounded border border-emerald-200">
|
||||||
{{ expiryStatusText }}
|
FEFO 권장: {{ expiryDate }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="grid grid-cols-2 gap-2 mt-1">
|
<BaseInput
|
||||||
<div class="flex flex-col gap-0.5">
|
:id="id"
|
||||||
<span class="text-[10px] font-bold text-slate-500">LOT 배치 번호</span>
|
v-model="lotValue"
|
||||||
<input
|
placeholder="LOT 번호 입력 또는 자동 채움"
|
||||||
type="text"
|
:density="density"
|
||||||
:value="lotNumber"
|
:required="required"
|
||||||
placeholder="LOT-20260725-01"
|
:disabled="disabled"
|
||||||
:readonly="readonly"
|
/>
|
||||||
:disabled="disabled"
|
|
||||||
class="h-8 px-2 border border-slate-300 rounded font-mono text-xs text-slate-900 font-bold bg-white focus:ring-2 focus:ring-blue-500 uppercase"
|
|
||||||
@input="handleLotInput"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="flex flex-col gap-0.5">
|
|
||||||
<span class="text-[10px] font-bold text-slate-500">유효기간 (Expiration Date)</span>
|
|
||||||
<input
|
|
||||||
type="date"
|
|
||||||
:value="expirationDate"
|
|
||||||
:readonly="readonly"
|
|
||||||
:disabled="disabled"
|
|
||||||
class="h-8 px-2 border border-slate-300 rounded font-mono text-xs text-slate-900 font-bold bg-white focus:ring-2 focus:ring-blue-500"
|
|
||||||
@change="handleDateChange"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { computed } from 'vue';
|
|
||||||
|
|
||||||
const props = defineProps<{
|
|
||||||
lotNumber: string;
|
|
||||||
expirationDate: string;
|
|
||||||
required?: boolean;
|
|
||||||
readonly?: boolean;
|
|
||||||
disabled?: boolean;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const emit = defineEmits(['update:lotNumber', 'update:expirationDate']);
|
|
||||||
|
|
||||||
const remainingDays = computed(() => {
|
|
||||||
if (!props.expirationDate) return null;
|
|
||||||
const exp = new Date(props.expirationDate).getTime();
|
|
||||||
const today = new Date().getTime();
|
|
||||||
const diff = Math.ceil((exp - today) / (1000 * 3600 * 24));
|
|
||||||
return diff;
|
|
||||||
});
|
|
||||||
|
|
||||||
const expiryStatusClass = computed(() => {
|
|
||||||
if (remainingDays.value === null) return 'bg-slate-100 text-slate-700';
|
|
||||||
if (remainingDays.value <= 0) return 'bg-rose-600 text-white animate-pulse';
|
|
||||||
if (remainingDays.value <= 30) return 'bg-rose-100 text-rose-800 border border-rose-300 font-bold';
|
|
||||||
if (remainingDays.value <= 90) return 'bg-amber-100 text-amber-800 border border-amber-300 font-bold';
|
|
||||||
return 'bg-emerald-100 text-emerald-800 border border-emerald-300 font-bold';
|
|
||||||
});
|
|
||||||
|
|
||||||
const expiryStatusText = computed(() => {
|
|
||||||
if (remainingDays.value === null) return '유효기간 미지정';
|
|
||||||
if (remainingDays.value <= 0) return `🚨 만료됨 (D+${Math.abs(remainingDays.value.valueOf())})`;
|
|
||||||
if (remainingDays.value <= 30) return `⚠️ 출하임계 (D-${remainingDays.value})`;
|
|
||||||
return `✓ 안전 (D-${remainingDays.value})`;
|
|
||||||
});
|
|
||||||
|
|
||||||
const handleLotInput = (e: Event) => {
|
|
||||||
emit('update:lotNumber', (e.target as HTMLInputElement).value.toUpperCase());
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleDateChange = (e: Event) => {
|
|
||||||
emit('update:expirationDate', (e.target as HTMLInputElement).value);
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|||||||
@@ -1,72 +1,57 @@
|
|||||||
<!-- Domain Field Component Layer: MoneyField (WBS-COMP-3.2) -->
|
|
||||||
<template>
|
|
||||||
<div class="domain-money-field flex flex-col gap-1 w-full">
|
|
||||||
<label v-if="label" class="text-xs font-bold text-slate-800">
|
|
||||||
{{ label }} <span v-if="required" class="text-rose-600">*</span>
|
|
||||||
</label>
|
|
||||||
<div class="flex gap-2">
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
:value="formattedAmount"
|
|
||||||
placeholder="0"
|
|
||||||
:readonly="readonly"
|
|
||||||
:disabled="disabled"
|
|
||||||
class="flex-1 h-9 px-3 border border-slate-300 rounded text-right font-mono text-xs text-slate-900 font-bold bg-white focus:ring-2 focus:ring-blue-500 focus:border-blue-500 focus:outline-none disabled:bg-slate-100 disabled:text-slate-500 readonly:bg-slate-50 readonly:text-slate-700"
|
|
||||||
@input="handleInput"
|
|
||||||
/>
|
|
||||||
<select
|
|
||||||
:value="currencyCode || 'KRW'"
|
|
||||||
:disabled="currencyReadonly || disabled"
|
|
||||||
class="h-9 px-2 border border-slate-300 rounded bg-slate-50 text-xs font-bold text-slate-800"
|
|
||||||
@change="handleCurrencyChange"
|
|
||||||
>
|
|
||||||
<option value="KRW">KRW (₩)</option>
|
|
||||||
<option value="USD">USD ($)</option>
|
|
||||||
<option value="EUR">EUR (€)</option>
|
|
||||||
<option value="JPY">JPY (¥)</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div v-if="formattedKrwSummary" class="text-[11px] text-blue-700 font-bold mt-0.5">
|
|
||||||
한화 환산: {{ formattedKrwSummary }} 원
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
|
import DecimalField from '../fields/DecimalField.vue';
|
||||||
|
import type { InputDensity } from '../primitives/BaseInput.vue';
|
||||||
|
import { createMoney, type Money } from '../../shared/types/coreModels';
|
||||||
|
|
||||||
const props = defineProps<{
|
interface Props {
|
||||||
|
id?: string;
|
||||||
label?: string;
|
label?: string;
|
||||||
amount: string;
|
modelValue?: string | number;
|
||||||
currencyCode?: string;
|
currency?: 'KRW' | 'USD' | 'EUR' | 'JPY';
|
||||||
|
density?: InputDensity;
|
||||||
required?: boolean;
|
required?: boolean;
|
||||||
readonly?: boolean;
|
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
currencyReadonly?: boolean;
|
}
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
modelValue: '0',
|
||||||
|
currency: 'KRW',
|
||||||
|
density: 'standard',
|
||||||
|
required: false,
|
||||||
|
disabled: false
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'update:modelValue', value: string): void;
|
||||||
|
(e: 'change', value: Money): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits(['update:amount', 'update:currencyCode']);
|
const scale = computed(() => (props.currency === 'KRW' || props.currency === 'JPY' ? 0 : 2));
|
||||||
|
|
||||||
const formattedAmount = computed(() => {
|
const amountString = computed({
|
||||||
if (!props.amount) return '';
|
get: () => String(props.modelValue),
|
||||||
const num = Number(props.amount.replace(/,/g, ''));
|
set: (val: string) => {
|
||||||
if (isNaN(num)) return props.amount;
|
emit('update:modelValue', val);
|
||||||
return num.toLocaleString('ko-KR');
|
emit('change', createMoney(val, props.currency));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const formattedKrwSummary = computed(() => {
|
|
||||||
if (!props.amount || props.currencyCode === 'KRW') return '';
|
|
||||||
const num = Number(props.amount.replace(/,/g, ''));
|
|
||||||
if (isNaN(num)) return '';
|
|
||||||
return (num * 1350).toLocaleString('ko-KR');
|
|
||||||
});
|
|
||||||
|
|
||||||
const handleInput = (e: Event) => {
|
|
||||||
const raw = (e.target as HTMLInputElement).value.replace(/,/g, '');
|
|
||||||
emit('update:amount', raw);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleCurrencyChange = (e: Event) => {
|
|
||||||
emit('update:currencyCode', (e.target as HTMLSelectElement).value);
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="money-field-wrapper flex flex-col gap-1 w-full text-left select-none">
|
||||||
|
<div class="flex justify-between items-center text-xs font-semibold text-slate-700">
|
||||||
|
<span>{{ label || '금액' }}</span>
|
||||||
|
<span class="text-blue-600 font-bold">[{{ currency }}]</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<DecimalField
|
||||||
|
:id="id"
|
||||||
|
v-model="amountString"
|
||||||
|
:density="density"
|
||||||
|
:scale="scale"
|
||||||
|
:required="required"
|
||||||
|
:disabled="disabled"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|||||||
@@ -1,72 +1,74 @@
|
|||||||
<!-- Domain Field Component Layer: QuantityField (WBS-COMP-3.1) -->
|
|
||||||
<template>
|
|
||||||
<div class="domain-quantity-field flex flex-col gap-1 w-full">
|
|
||||||
<div class="flex justify-between items-center text-xs">
|
|
||||||
<label v-if="label" class="font-bold text-slate-800">
|
|
||||||
{{ label }} <span v-if="required" class="text-rose-600">*</span>
|
|
||||||
</label>
|
|
||||||
<span v-if="availableStock !== undefined" class="text-[11px] text-emerald-700 font-bold">
|
|
||||||
가용재고: {{ availableStock.toLocaleString() }} {{ selectedUnit }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="flex gap-2">
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
:value="formattedAmount"
|
|
||||||
placeholder="0"
|
|
||||||
:readonly="readonly"
|
|
||||||
:disabled="disabled"
|
|
||||||
class="flex-1 h-9 px-3 border border-slate-300 rounded text-right font-mono text-xs text-slate-900 font-bold bg-white focus:ring-2 focus:ring-blue-500 focus:border-blue-500 focus:outline-none disabled:bg-slate-100 disabled:text-slate-500 readonly:bg-slate-50 readonly:text-slate-700"
|
|
||||||
@input="handleInput"
|
|
||||||
/>
|
|
||||||
<select
|
|
||||||
:value="selectedUnit"
|
|
||||||
:disabled="unitReadonly || disabled"
|
|
||||||
class="h-9 px-2 border border-slate-300 rounded bg-slate-50 text-xs font-bold text-slate-800"
|
|
||||||
@change="handleUnitChange"
|
|
||||||
>
|
|
||||||
<option v-for="unit in availableUnits || ['EA', 'BOX', 'PALLET']" :key="unit" :value="unit">
|
|
||||||
{{ unit }}
|
|
||||||
</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, ref } from 'vue';
|
import { computed } from 'vue';
|
||||||
|
import DecimalField from '../fields/DecimalField.vue';
|
||||||
|
import type { InputDensity } from '../primitives/BaseInput.vue';
|
||||||
|
import { makeDecimalString, type Quantity } from '../../shared/types/coreModels';
|
||||||
|
|
||||||
const props = defineProps<{
|
interface Props {
|
||||||
|
id?: string;
|
||||||
label?: string;
|
label?: string;
|
||||||
amount: string | number;
|
modelValue?: string | number;
|
||||||
unitCode?: string;
|
uom?: string; // EA, BOX, KG, PCS
|
||||||
availableUnits?: string[];
|
maxAvailableQty?: number;
|
||||||
availableStock?: number;
|
density?: InputDensity;
|
||||||
required?: boolean;
|
required?: boolean;
|
||||||
readonly?: boolean;
|
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
unitReadonly?: boolean;
|
}
|
||||||
}>();
|
|
||||||
|
|
||||||
const emit = defineEmits(['update:amount', 'update:unitCode']);
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
modelValue: '0',
|
||||||
const selectedUnit = ref(props.unitCode || 'EA');
|
uom: 'EA',
|
||||||
|
density: 'standard',
|
||||||
const formattedAmount = computed(() => {
|
required: false,
|
||||||
if (!props.amount) return '';
|
disabled: false
|
||||||
const num = Number(String(props.amount).replace(/,/g, ''));
|
|
||||||
if (isNaN(num)) return String(props.amount);
|
|
||||||
return num.toLocaleString('ko-KR');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleInput = (e: Event) => {
|
const emit = defineEmits<{
|
||||||
const raw = (e.target as HTMLInputElement).value.replace(/,/g, '');
|
(e: 'update:modelValue', value: string): void;
|
||||||
emit('update:amount', raw);
|
(e: 'change', value: Quantity): void;
|
||||||
};
|
}>();
|
||||||
|
|
||||||
const handleUnitChange = (e: Event) => {
|
const qtyString = computed({
|
||||||
const newUnit = (e.target as HTMLSelectElement).value;
|
get: () => String(props.modelValue),
|
||||||
selectedUnit.value = newUnit;
|
set: (val: string) => {
|
||||||
emit('update:unitCode', newUnit);
|
emit('update:modelValue', val);
|
||||||
};
|
emit('change', {
|
||||||
|
value: makeDecimalString(val),
|
||||||
|
uom: props.uom
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const isExceeded = computed(() => {
|
||||||
|
if (props.maxAvailableQty !== undefined) {
|
||||||
|
return Number(qtyString.value) > props.maxAvailableQty;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="quantity-field-wrapper flex flex-col gap-1 w-full text-left select-none">
|
||||||
|
<div class="flex justify-between items-center">
|
||||||
|
<label v-if="label" class="text-xs font-semibold text-slate-700">
|
||||||
|
{{ label }} (단위: {{ uom }})
|
||||||
|
</label>
|
||||||
|
<span v-if="maxAvailableQty !== undefined" class="text-[11px] text-slate-500 font-semibold">
|
||||||
|
가용: {{ maxAvailableQty.toLocaleString() }} {{ uom }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<DecimalField
|
||||||
|
:id="id"
|
||||||
|
v-model="qtyString"
|
||||||
|
:density="density"
|
||||||
|
:required="required"
|
||||||
|
:disabled="disabled"
|
||||||
|
:scale="0"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<span v-if="isExceeded" class="text-xs text-rose-600 font-bold">
|
||||||
|
⚠️ 입력 수량이 가용 재고({{ maxAvailableQty }})를 초과했습니다.
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|||||||
@@ -0,0 +1,128 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, watch } from 'vue';
|
||||||
|
import BaseInput, { type InputDensity } from '../primitives/BaseInput.vue';
|
||||||
|
import BaseButton from '../primitives/BaseButton.vue';
|
||||||
|
|
||||||
|
export interface ReferenceItem {
|
||||||
|
code: string;
|
||||||
|
name: string;
|
||||||
|
category?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
id?: string;
|
||||||
|
label?: string;
|
||||||
|
modelValue?: string;
|
||||||
|
selectedName?: string;
|
||||||
|
placeholder?: string;
|
||||||
|
density?: InputDensity;
|
||||||
|
required?: boolean;
|
||||||
|
disabled?: boolean;
|
||||||
|
fetchOptions?: (query: string, signal: AbortSignal) => Promise<ReferenceItem[]>;
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
modelValue: '',
|
||||||
|
selectedName: '',
|
||||||
|
density: 'standard',
|
||||||
|
required: false,
|
||||||
|
disabled: false
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'update:modelValue', code: string): void;
|
||||||
|
(e: 'select', item: ReferenceItem): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const searchInput = ref(props.modelValue);
|
||||||
|
const results = ref<ReferenceItem[]>([]);
|
||||||
|
const isOpen = ref(false);
|
||||||
|
const isLoading = ref(false);
|
||||||
|
let abortController: AbortController | null = null;
|
||||||
|
let debounceTimer: ReturnType<typeof setTimeout> | null = null;
|
||||||
|
|
||||||
|
const onSearchInput = (val: string) => {
|
||||||
|
searchInput.value = val;
|
||||||
|
if (debounceTimer) clearTimeout(debounceTimer);
|
||||||
|
|
||||||
|
if (!val.trim()) {
|
||||||
|
results.value = [];
|
||||||
|
isOpen.value = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
debounceTimer = setTimeout(async () => {
|
||||||
|
if (abortController) abortController.abort();
|
||||||
|
abortController = new AbortController();
|
||||||
|
|
||||||
|
if (props.fetchOptions) {
|
||||||
|
isLoading.value = true;
|
||||||
|
try {
|
||||||
|
const data = await props.fetchOptions(val, abortController.signal);
|
||||||
|
results.value = data;
|
||||||
|
isOpen.value = data.length > 0;
|
||||||
|
} catch (err: any) {
|
||||||
|
if (err.name !== 'AbortError') {
|
||||||
|
results.value = [];
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
isLoading.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 300);
|
||||||
|
};
|
||||||
|
|
||||||
|
const selectItem = (item: ReferenceItem) => {
|
||||||
|
searchInput.value = item.code;
|
||||||
|
emit('update:modelValue', item.code);
|
||||||
|
emit('select', item);
|
||||||
|
isOpen.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(() => props.modelValue, (newVal) => {
|
||||||
|
searchInput.value = newVal;
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="reference-lookup-container relative w-full select-none">
|
||||||
|
<div class="flex items-end gap-2 w-full">
|
||||||
|
<BaseInput
|
||||||
|
:id="id"
|
||||||
|
v-model="searchInput"
|
||||||
|
:label="label"
|
||||||
|
:placeholder="placeholder || '코드 또는 명칭 검색...'"
|
||||||
|
:density="density"
|
||||||
|
:required="required"
|
||||||
|
:disabled="disabled"
|
||||||
|
@update:modelValue="onSearchInput"
|
||||||
|
/>
|
||||||
|
<BaseButton
|
||||||
|
variant="outline"
|
||||||
|
:density="density"
|
||||||
|
:disabled="disabled"
|
||||||
|
@click="isOpen = !isOpen"
|
||||||
|
>
|
||||||
|
🔍
|
||||||
|
</BaseButton>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Dropdown Result List -->
|
||||||
|
<div
|
||||||
|
v-if="isOpen && results.length > 0"
|
||||||
|
class="absolute z-50 left-0 right-0 mt-1 bg-white border border-slate-300 rounded-md shadow-lg max-h-60 overflow-y-auto"
|
||||||
|
>
|
||||||
|
<ul class="py-1 text-sm text-slate-700">
|
||||||
|
<li
|
||||||
|
v-for="item in results"
|
||||||
|
:key="item.code"
|
||||||
|
class="px-3 py-2 hover:bg-blue-50 cursor-pointer flex justify-between items-center transition-colors"
|
||||||
|
@click="selectItem(item)"
|
||||||
|
>
|
||||||
|
<span class="font-bold text-blue-600">{{ item.code }}</span>
|
||||||
|
<span class="text-slate-800 font-medium">{{ item.name }}</span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -1,77 +1,62 @@
|
|||||||
<!-- Typed Field Component Layer: CodeField (WBS-COMP-2.4) -->
|
|
||||||
<template>
|
|
||||||
<div class="typed-code-field flex flex-col gap-1 w-full">
|
|
||||||
<div class="flex justify-between items-center text-xs">
|
|
||||||
<label class="font-bold text-slate-800">
|
|
||||||
{{ label }} <span v-if="required" class="text-rose-600">*</span>
|
|
||||||
</label>
|
|
||||||
<span v-if="isValidating" class="text-[11px] text-blue-600 font-medium">⏳ 중복 검사 중...</span>
|
|
||||||
<span v-else-if="validationStatus === 'VALID'" class="text-[11px] text-emerald-700 font-bold">✓ 사용 가능한 코드</span>
|
|
||||||
<span v-else-if="validationStatus === 'INVALID'" class="text-[11px] text-rose-600 font-bold">🚨 이미 존재하는 코드</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="relative flex items-center">
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
:value="modelValue"
|
|
||||||
:placeholder="placeholder || 'CUST-001'"
|
|
||||||
:readonly="readonly"
|
|
||||||
:disabled="disabled"
|
|
||||||
class="w-full h-9 px-3 pr-16 border border-slate-300 rounded font-mono text-xs text-slate-900 font-bold bg-white placeholder:text-slate-400 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 focus:outline-none disabled:bg-slate-100 disabled:text-slate-500 readonly:bg-slate-50 readonly:text-slate-700 uppercase"
|
|
||||||
@input="handleInput"
|
|
||||||
/>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="absolute right-1 top-1 bottom-1 px-2.5 bg-slate-800 hover:bg-slate-700 text-amber-300 font-mono text-[11px] font-bold rounded transition"
|
|
||||||
@click="$emit('openPopup')"
|
|
||||||
>
|
|
||||||
F2
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue';
|
import { computed } from 'vue';
|
||||||
|
import TextField from './TextField.vue';
|
||||||
|
import type { InputDensity } from '../primitives/BaseInput.vue';
|
||||||
|
import type { FieldState } from '../../types/enterpriseTemplateContracts';
|
||||||
|
|
||||||
const props = defineProps<{
|
interface Props {
|
||||||
label: string;
|
id?: string;
|
||||||
modelValue: string;
|
label?: string;
|
||||||
|
fieldState?: FieldState<string>;
|
||||||
|
modelValue?: string;
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
|
density?: InputDensity;
|
||||||
required?: boolean;
|
required?: boolean;
|
||||||
readonly?: boolean;
|
readonly?: boolean;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
existingCodes?: string[];
|
}
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
modelValue: '',
|
||||||
|
density: 'standard',
|
||||||
|
required: false,
|
||||||
|
readonly: false,
|
||||||
|
disabled: false
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'update:modelValue', value: string): void;
|
||||||
|
(e: 'change', value: string): void;
|
||||||
|
(e: 'blur'): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits(['update:modelValue', 'openPopup']);
|
// Automatic Uppercase Normalization for Alphanumeric Code Field
|
||||||
|
const uppercaseNormalizer = (val: string): string => {
|
||||||
const isValidating = ref(false);
|
return val.toUpperCase().replace(/[^A-Z0-9_-]/g, '');
|
||||||
const validationStatus = ref<'NONE' | 'VALID' | 'INVALID'>('NONE');
|
|
||||||
let debounceTimer: any = null;
|
|
||||||
|
|
||||||
const mockExistingCodes = props.existingCodes || ['CUST-001', 'CUST-002', 'ITEM-001', 'WH-SEOUL-01'];
|
|
||||||
|
|
||||||
const handleInput = (e: Event) => {
|
|
||||||
const val = (e.target as HTMLInputElement).value.toUpperCase().trim();
|
|
||||||
emit('update:modelValue', val);
|
|
||||||
|
|
||||||
if (!val) {
|
|
||||||
validationStatus.value = 'NONE';
|
|
||||||
isValidating.value = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
isValidating.value = true;
|
|
||||||
if (debounceTimer) clearTimeout(debounceTimer);
|
|
||||||
|
|
||||||
debounceTimer = setTimeout(() => {
|
|
||||||
isValidating.value = false;
|
|
||||||
if (mockExistingCodes.includes(val)) {
|
|
||||||
validationStatus.value = 'INVALID';
|
|
||||||
} else {
|
|
||||||
validationStatus.value = 'VALID';
|
|
||||||
}
|
|
||||||
}, 300);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const currentValue = computed({
|
||||||
|
get: () => props.fieldState?.value ?? props.modelValue,
|
||||||
|
set: (val: string) => {
|
||||||
|
const normalized = uppercaseNormalizer(val);
|
||||||
|
emit('update:modelValue', normalized);
|
||||||
|
emit('change', normalized);
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<TextField
|
||||||
|
:id="id"
|
||||||
|
v-model="currentValue"
|
||||||
|
:label="label"
|
||||||
|
:field-state="fieldState"
|
||||||
|
:placeholder="placeholder || '예: ORD-2026-001'"
|
||||||
|
:density="density"
|
||||||
|
:required="required"
|
||||||
|
:readonly="readonly"
|
||||||
|
:disabled="disabled"
|
||||||
|
:normalizer="uppercaseNormalizer"
|
||||||
|
@blur="emit('blur')"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|||||||
@@ -1,16 +1,63 @@
|
|||||||
<!-- Unified Component Re-export: DateField -> QuantDatePicker -->
|
|
||||||
<template>
|
|
||||||
<QuantDatePicker v-bind="$attrs">
|
|
||||||
<template v-for="(_, slotName) in $slots" :key="slotName" #[slotName]="slotProps">
|
|
||||||
<slot :name="slotName" v-bind="slotProps || {}"></slot>
|
|
||||||
</template>
|
|
||||||
</QuantDatePicker>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import QuantDatePicker from '../QuantDatePicker.vue';
|
import { computed } from 'vue';
|
||||||
|
import BaseInput, { type InputDensity } from '../primitives/BaseInput.vue';
|
||||||
|
import { makeLocalDateString, type LocalDateString } from '../../shared/types/coreModels';
|
||||||
|
import type { FieldState } from '../../types/enterpriseTemplateContracts';
|
||||||
|
|
||||||
defineOptions({
|
interface Props {
|
||||||
inheritAttrs: false
|
id?: string;
|
||||||
|
label?: string;
|
||||||
|
fieldState?: FieldState<LocalDateString>;
|
||||||
|
modelValue?: LocalDateString | string;
|
||||||
|
density?: InputDensity;
|
||||||
|
required?: boolean;
|
||||||
|
readonly?: boolean;
|
||||||
|
disabled?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
modelValue: new Date().toISOString().substring(0, 10),
|
||||||
|
density: 'standard',
|
||||||
|
required: false,
|
||||||
|
readonly: false,
|
||||||
|
disabled: false
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'update:modelValue', value: LocalDateString): void;
|
||||||
|
(e: 'change', value: LocalDateString): void;
|
||||||
|
(e: 'blur'): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const dateValue = computed({
|
||||||
|
get: () => {
|
||||||
|
const raw = props.fieldState?.value ?? props.modelValue;
|
||||||
|
return String(raw);
|
||||||
|
},
|
||||||
|
set: (val: string) => {
|
||||||
|
try {
|
||||||
|
const localDate = makeLocalDateString(val);
|
||||||
|
emit('update:modelValue', localDate);
|
||||||
|
emit('change', localDate);
|
||||||
|
} catch {
|
||||||
|
// Allow interim typing
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<BaseInput
|
||||||
|
:id="id"
|
||||||
|
v-model="dateValue"
|
||||||
|
type="date"
|
||||||
|
:label="label"
|
||||||
|
:density="density"
|
||||||
|
:required="required"
|
||||||
|
:readonly="readonly || props.fieldState?.status === 'readonly'"
|
||||||
|
:disabled="disabled || props.fieldState?.status === 'disabled'"
|
||||||
|
:invalid="props.fieldState?.status === 'invalid'"
|
||||||
|
:error-message="props.fieldState?.errors?.[0]?.message"
|
||||||
|
@blur="emit('blur')"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed } from 'vue';
|
||||||
|
import BaseInput, { type InputDensity } from '../primitives/BaseInput.vue';
|
||||||
|
import { makeDecimalString, type DecimalString } from '../../shared/types/coreModels';
|
||||||
|
import type { FieldState } from '../../types/enterpriseTemplateContracts';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
id?: string;
|
||||||
|
label?: string;
|
||||||
|
fieldState?: FieldState<DecimalString>;
|
||||||
|
modelValue?: DecimalString | string;
|
||||||
|
placeholder?: string;
|
||||||
|
density?: InputDensity;
|
||||||
|
scale?: number; // Scale / Decimal places (0 for KRW, 2 for USD)
|
||||||
|
required?: boolean;
|
||||||
|
readonly?: boolean;
|
||||||
|
disabled?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
modelValue: '0',
|
||||||
|
density: 'standard',
|
||||||
|
scale: 0,
|
||||||
|
required: false,
|
||||||
|
readonly: false,
|
||||||
|
disabled: false
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'update:modelValue', value: DecimalString): void;
|
||||||
|
(e: 'change', value: DecimalString): void;
|
||||||
|
(e: 'blur'): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const displayValue = computed({
|
||||||
|
get: () => {
|
||||||
|
const raw = props.fieldState?.value ?? props.modelValue;
|
||||||
|
return raw ? String(raw) : '';
|
||||||
|
},
|
||||||
|
set: (val: string) => {
|
||||||
|
try {
|
||||||
|
const sanitized = val.replace(/[^0-9.-]/g, '');
|
||||||
|
if (sanitized === '' || sanitized === '-') {
|
||||||
|
emit('update:modelValue', '0' as DecimalString);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const decimalVal = makeDecimalString(sanitized);
|
||||||
|
emit('update:modelValue', decimalVal);
|
||||||
|
emit('change', decimalVal);
|
||||||
|
} catch {
|
||||||
|
// Allow interim typing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<BaseInput
|
||||||
|
:id="id"
|
||||||
|
v-model="displayValue"
|
||||||
|
type="text"
|
||||||
|
:label="label"
|
||||||
|
:placeholder="placeholder || (scale === 0 ? '0' : '0.00')"
|
||||||
|
:density="density"
|
||||||
|
:required="required"
|
||||||
|
:readonly="readonly || props.fieldState?.status === 'readonly'"
|
||||||
|
:disabled="disabled || props.fieldState?.status === 'disabled'"
|
||||||
|
:invalid="props.fieldState?.status === 'invalid'"
|
||||||
|
:error-message="props.fieldState?.errors?.[0]?.message"
|
||||||
|
@blur="emit('blur')"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed } from 'vue';
|
||||||
|
import BaseSelect, { type SelectOption } from '../primitives/BaseSelect.vue';
|
||||||
|
import type { InputDensity } from '../primitives/BaseInput.vue';
|
||||||
|
import type { FieldState } from '../../types/enterpriseTemplateContracts';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
id?: string;
|
||||||
|
label?: string;
|
||||||
|
options?: SelectOption[];
|
||||||
|
fieldState?: FieldState<string | number>;
|
||||||
|
modelValue?: string | number;
|
||||||
|
placeholder?: string;
|
||||||
|
density?: InputDensity;
|
||||||
|
required?: boolean;
|
||||||
|
readonly?: boolean;
|
||||||
|
disabled?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
modelValue: '',
|
||||||
|
options: () => [],
|
||||||
|
density: 'standard',
|
||||||
|
required: false,
|
||||||
|
readonly: false,
|
||||||
|
disabled: false
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'update:modelValue', value: string | number): void;
|
||||||
|
(e: 'change', value: string | number): void;
|
||||||
|
(e: 'blur'): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const currentValue = computed({
|
||||||
|
get: () => props.fieldState?.value ?? props.modelValue,
|
||||||
|
set: (val: string | number) => {
|
||||||
|
emit('update:modelValue', val);
|
||||||
|
emit('change', val);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<BaseSelect
|
||||||
|
:id="id"
|
||||||
|
v-model="currentValue"
|
||||||
|
:label="label"
|
||||||
|
:options="options"
|
||||||
|
:placeholder="placeholder"
|
||||||
|
:density="density"
|
||||||
|
:required="required"
|
||||||
|
:disabled="disabled || readonly || props.fieldState?.status === 'readonly' || props.fieldState?.status === 'disabled'"
|
||||||
|
:invalid="props.fieldState?.status === 'invalid'"
|
||||||
|
:error-message="props.fieldState?.errors?.[0]?.message"
|
||||||
|
@blur="emit('blur')"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed } from 'vue';
|
||||||
|
import TypedFieldBase from './TypedFieldBase.vue';
|
||||||
|
import type { InputDensity } from '../primitives/BaseInput.vue';
|
||||||
|
import type { FieldState } from '../../types/enterpriseTemplateContracts';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
id?: string;
|
||||||
|
label?: string;
|
||||||
|
fieldState?: FieldState<string>;
|
||||||
|
modelValue?: string;
|
||||||
|
placeholder?: string;
|
||||||
|
prefix?: string;
|
||||||
|
suffix?: string;
|
||||||
|
hintText?: string;
|
||||||
|
density?: InputDensity;
|
||||||
|
required?: boolean;
|
||||||
|
readonly?: boolean;
|
||||||
|
disabled?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
modelValue: '',
|
||||||
|
density: 'standard',
|
||||||
|
required: false,
|
||||||
|
readonly: false,
|
||||||
|
disabled: false
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'update:modelValue', value: string): void;
|
||||||
|
(e: 'change', value: string): void;
|
||||||
|
(e: 'blur'): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const currentValue = computed({
|
||||||
|
get: () => props.fieldState?.value ?? props.modelValue,
|
||||||
|
set: (val: string) => {
|
||||||
|
emit('update:modelValue', val);
|
||||||
|
emit('change', val);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const densityInputClasses = computed(() => {
|
||||||
|
switch (props.density) {
|
||||||
|
case 'compact': return 'py-1 px-2 text-xs min-h-[28px]';
|
||||||
|
case 'touch': return 'py-3 px-3 text-base min-h-[44px]'; // WMS Field 44px
|
||||||
|
case 'standard': default: return 'py-2 px-3 text-sm min-h-[36px]';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<TypedFieldBase
|
||||||
|
:id="id"
|
||||||
|
:label="label"
|
||||||
|
:field-state="fieldState"
|
||||||
|
:density="density"
|
||||||
|
:required="required"
|
||||||
|
:prefix="prefix"
|
||||||
|
:suffix="suffix"
|
||||||
|
:hint-text="hintText"
|
||||||
|
>
|
||||||
|
<template #default="{ id: fieldId, isReadonly, isDisabled }">
|
||||||
|
<input
|
||||||
|
:id="fieldId"
|
||||||
|
v-model="currentValue"
|
||||||
|
type="text"
|
||||||
|
:placeholder="placeholder"
|
||||||
|
:readonly="readonly || isReadonly"
|
||||||
|
:disabled="disabled || isDisabled"
|
||||||
|
class="w-full bg-transparent border-none outline-none text-slate-900 placeholder:text-slate-400 disabled:cursor-not-allowed"
|
||||||
|
:class="densityInputClasses"
|
||||||
|
@blur="emit('blur')"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</TypedFieldBase>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,111 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed } from 'vue';
|
||||||
|
import type { InputDensity } from '../primitives/BaseInput.vue';
|
||||||
|
import BaseStatusBadge from '../primitives/BaseStatusBadge.vue';
|
||||||
|
import type { FieldState, FieldStatus, ValueSource } from '../../types/enterpriseTemplateContracts';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
id?: string;
|
||||||
|
label?: string;
|
||||||
|
fieldState?: FieldState<unknown>;
|
||||||
|
density?: InputDensity;
|
||||||
|
required?: boolean;
|
||||||
|
prefix?: string;
|
||||||
|
suffix?: string;
|
||||||
|
hintText?: string;
|
||||||
|
showSourceBadge?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
id: () => `field-base-${Math.random().toString(36).substring(2, 9)}`,
|
||||||
|
density: 'standard',
|
||||||
|
required: false,
|
||||||
|
showSourceBadge: true
|
||||||
|
});
|
||||||
|
|
||||||
|
// Field Status calculation (13 Statuses)
|
||||||
|
const currentStatus = computed<FieldStatus>(() => {
|
||||||
|
return props.fieldState?.status ?? 'idle';
|
||||||
|
});
|
||||||
|
|
||||||
|
// Value Source calculation (8 Sources)
|
||||||
|
const currentSource = computed<ValueSource>(() => {
|
||||||
|
return props.fieldState?.source ?? 'user';
|
||||||
|
});
|
||||||
|
|
||||||
|
const isInvalid = computed(() => currentStatus.value === 'invalid');
|
||||||
|
const isWarning = computed(() => currentStatus.value === 'warning');
|
||||||
|
const isReadonly = computed(() => currentStatus.value === 'readonly');
|
||||||
|
const isDisabled = computed(() => currentStatus.value === 'disabled');
|
||||||
|
const isBlocked = computed(() => currentStatus.value === 'blocked');
|
||||||
|
const isAiSource = computed(() => currentSource.value === 'ai');
|
||||||
|
|
||||||
|
const errorMessage = computed(() => {
|
||||||
|
if (props.fieldState && props.fieldState.errors.length > 0) {
|
||||||
|
return props.fieldState.errors[0].message;
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
});
|
||||||
|
|
||||||
|
const statusBadgeVariant = computed(() => {
|
||||||
|
switch (currentStatus.value) {
|
||||||
|
case 'valid': case 'saved': return 'success';
|
||||||
|
case 'warning': return 'warning';
|
||||||
|
case 'invalid': case 'conflict': case 'blocked': return 'danger';
|
||||||
|
default: return 'neutral';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="typed-field-base flex flex-col gap-1 w-full text-left select-none" :class="{ 'opacity-60 cursor-not-allowed': isDisabled || isBlocked }">
|
||||||
|
<!-- 1. Label & Required & Business Status & Audit Source Header (Section 3 Anatomy) -->
|
||||||
|
<div class="flex justify-between items-center text-xs font-semibold text-slate-700">
|
||||||
|
<label :for="id" class="flex items-center gap-1">
|
||||||
|
<span>{{ label }}</span>
|
||||||
|
<span v-if="required" class="text-rose-500 font-bold" aria-hidden="true">*</span>
|
||||||
|
<BaseStatusBadge v-if="currentStatus !== 'idle'" :variant="statusBadgeVariant" :label="currentStatus" />
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<!-- Value Source Badge (Section 6: user, default, calculated, system, external, ai, fallback, override) -->
|
||||||
|
<div v-if="showSourceBadge && currentSource !== 'user'" class="flex items-center gap-1">
|
||||||
|
<span
|
||||||
|
class="px-1.5 py-0.5 rounded text-[10px] font-bold border"
|
||||||
|
:class="isAiSource ? 'bg-purple-100 text-purple-800 border-purple-300 animate-pulse' : 'bg-slate-100 text-slate-600 border-slate-200'"
|
||||||
|
>
|
||||||
|
{{ isAiSource ? '🤖 AI 추천' : `Src: ${currentSource}` }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 2. Input Control Container with Prefix & Suffix (Section 3) -->
|
||||||
|
<div
|
||||||
|
class="relative flex items-center w-full rounded-md border transition-all duration-150 overflow-hidden bg-white"
|
||||||
|
:class="[
|
||||||
|
isInvalid ? 'border-rose-500 ring-1 ring-rose-500' :
|
||||||
|
isWarning ? 'border-amber-500 ring-1 ring-amber-500' :
|
||||||
|
isAiSource ? 'border-purple-400 bg-purple-50/20' : 'border-slate-300 focus-within:ring-2 focus-within:ring-blue-500'
|
||||||
|
]"
|
||||||
|
>
|
||||||
|
<span v-if="prefix" class="pl-3 text-xs text-slate-500 font-semibold select-none bg-slate-50 py-2 border-r border-slate-200">
|
||||||
|
{{ prefix }}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<div class="flex-1">
|
||||||
|
<slot :id="id" :is-readonly="isReadonly" :is-disabled="isDisabled || isBlocked" :is-invalid="isInvalid"></slot>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<span v-if="suffix" class="pr-3 text-xs text-slate-500 font-semibold select-none bg-slate-50 py-2 border-l border-slate-200 pl-2">
|
||||||
|
{{ suffix }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 3. Validation Message & Supporting Information (Section 3) -->
|
||||||
|
<div v-if="isInvalid && errorMessage" class="text-xs text-rose-600 font-medium flex items-center gap-1" role="alert">
|
||||||
|
<span>⚠️ {{ errorMessage }}</span>
|
||||||
|
</div>
|
||||||
|
<div v-else-if="hintText" class="text-xs text-slate-500">
|
||||||
|
{{ hintText }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed } from 'vue';
|
||||||
|
import type { InputDensity } from './BaseInput.vue';
|
||||||
|
|
||||||
|
export type ButtonVariant = 'primary' | 'secondary' | 'danger' | 'outline' | 'ghost';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
type?: 'button' | 'submit' | 'reset';
|
||||||
|
variant?: ButtonVariant;
|
||||||
|
density?: InputDensity;
|
||||||
|
disabled?: boolean;
|
||||||
|
loading?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
type: 'button',
|
||||||
|
variant: 'primary',
|
||||||
|
density: 'standard',
|
||||||
|
disabled: false,
|
||||||
|
loading: false
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'click', event: MouseEvent): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const densityClasses = computed(() => {
|
||||||
|
switch (props.density) {
|
||||||
|
case 'compact':
|
||||||
|
return 'py-1 px-3 text-xs min-h-[28px]';
|
||||||
|
case 'touch':
|
||||||
|
return 'py-3 px-5 text-base min-h-[44px]'; // WMS Field Touch Density
|
||||||
|
case 'standard':
|
||||||
|
default:
|
||||||
|
return 'py-2 px-4 text-sm min-h-[36px]';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const variantClasses = computed(() => {
|
||||||
|
switch (props.variant) {
|
||||||
|
case 'secondary':
|
||||||
|
return 'bg-slate-600 text-white hover:bg-slate-700 active:bg-slate-800 border-transparent';
|
||||||
|
case 'danger':
|
||||||
|
return 'bg-rose-600 text-white hover:bg-rose-700 active:bg-rose-800 border-transparent';
|
||||||
|
case 'outline':
|
||||||
|
return 'bg-white text-slate-700 border-slate-300 hover:bg-slate-50 active:bg-slate-100';
|
||||||
|
case 'ghost':
|
||||||
|
return 'bg-transparent text-slate-600 hover:bg-slate-100 active:bg-slate-200 border-transparent';
|
||||||
|
case 'primary':
|
||||||
|
default:
|
||||||
|
return 'bg-blue-600 text-white hover:bg-blue-700 active:bg-blue-800 border-transparent';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<button
|
||||||
|
:type="type"
|
||||||
|
:disabled="disabled || loading"
|
||||||
|
class="inline-flex items-center justify-center font-semibold rounded-md border transition-all duration-150
|
||||||
|
focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1
|
||||||
|
disabled:opacity-50 disabled:cursor-not-allowed select-none cursor-pointer gap-2"
|
||||||
|
:class="[densityClasses, variantClasses]"
|
||||||
|
@click="emit('click', $event)"
|
||||||
|
>
|
||||||
|
<span v-if="loading" class="animate-spin h-4 w-4 border-2 border-current border-t-transparent rounded-full" aria-hidden="true"></span>
|
||||||
|
<slot></slot>
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
interface Props {
|
||||||
|
id?: string;
|
||||||
|
modelValue?: boolean;
|
||||||
|
label?: string;
|
||||||
|
disabled?: boolean;
|
||||||
|
required?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
id: () => `base-checkbox-${Math.random().toString(36).substring(2, 9)}`,
|
||||||
|
modelValue: false,
|
||||||
|
disabled: false,
|
||||||
|
required: false
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'update:modelValue', value: boolean): void;
|
||||||
|
(e: 'change', value: boolean): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const onChange = (event: Event) => {
|
||||||
|
const target = event.target as HTMLInputElement;
|
||||||
|
emit('update:modelValue', target.checked);
|
||||||
|
emit('change', target.checked);
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<label :for="id" class="inline-flex items-center gap-2 cursor-pointer select-none text-slate-800 text-sm font-medium">
|
||||||
|
<input
|
||||||
|
:id="id"
|
||||||
|
type="checkbox"
|
||||||
|
:checked="modelValue"
|
||||||
|
:disabled="disabled"
|
||||||
|
:required="required"
|
||||||
|
class="h-4 w-4 rounded border-slate-300 text-blue-600 focus:ring-blue-500 disabled:opacity-50 cursor-pointer"
|
||||||
|
@change="onChange"
|
||||||
|
/>
|
||||||
|
<span v-if="label">{{ label }}</span>
|
||||||
|
</label>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { onMounted, onUnmounted } from 'vue';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
isOpen?: boolean;
|
||||||
|
title?: string;
|
||||||
|
widthClass?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
isOpen: false,
|
||||||
|
title: '',
|
||||||
|
widthClass: 'max-w-lg'
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'close'): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const handleKeydown = (e: KeyboardEvent) => {
|
||||||
|
if (props.isOpen && e.key === 'Escape') {
|
||||||
|
emit('close');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
window.addEventListener('keydown', handleKeydown);
|
||||||
|
});
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
window.removeEventListener('keydown', handleKeydown);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Teleport to="body">
|
||||||
|
<div
|
||||||
|
v-if="isOpen"
|
||||||
|
class="fixed inset-0 z-50 bg-slate-900/50 backdrop-blur-sm flex items-center justify-center p-4 select-none text-left"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="bg-white rounded-xl shadow-2xl border border-slate-200 w-full overflow-hidden flex flex-col gap-4 p-6"
|
||||||
|
:class="widthClass"
|
||||||
|
role="dialog"
|
||||||
|
aria-modal="true"
|
||||||
|
>
|
||||||
|
<div class="flex justify-between items-center border-b border-slate-100 pb-3">
|
||||||
|
<h3 class="text-lg font-bold text-slate-800">{{ title }}</h3>
|
||||||
|
<button
|
||||||
|
class="text-slate-400 hover:text-slate-600 font-bold text-xl cursor-pointer"
|
||||||
|
@click="emit('close')"
|
||||||
|
>
|
||||||
|
×
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="dialog-body py-2">
|
||||||
|
<slot></slot>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="$slots.footer" class="dialog-footer border-t border-slate-100 pt-3 flex justify-end gap-2">
|
||||||
|
<slot name="footer"></slot>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Teleport>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,129 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed } from 'vue';
|
||||||
|
|
||||||
|
export type InputDensity = 'compact' | 'standard' | 'touch';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
id?: string;
|
||||||
|
modelValue?: string | number | null;
|
||||||
|
label?: string;
|
||||||
|
placeholder?: string;
|
||||||
|
type?: string;
|
||||||
|
density?: InputDensity;
|
||||||
|
readonly?: boolean;
|
||||||
|
disabled?: boolean;
|
||||||
|
required?: boolean;
|
||||||
|
invalid?: boolean;
|
||||||
|
errorMessage?: string;
|
||||||
|
hintText?: string;
|
||||||
|
autocomplete?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
id: () => `base-input-${Math.random().toString(36).substring(2, 9)}`,
|
||||||
|
modelValue: '',
|
||||||
|
type: 'text',
|
||||||
|
density: 'standard',
|
||||||
|
readonly: false,
|
||||||
|
disabled: false,
|
||||||
|
required: false,
|
||||||
|
invalid: false,
|
||||||
|
autocomplete: 'off'
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'update:modelValue', value: string): void;
|
||||||
|
(e: 'focus', event: FocusEvent): void;
|
||||||
|
(e: 'blur', event: FocusEvent): void;
|
||||||
|
(e: 'keydown', event: KeyboardEvent): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
// IME Composing handling
|
||||||
|
let isComposing = false;
|
||||||
|
|
||||||
|
const onCompositionStart = () => {
|
||||||
|
isComposing = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const onCompositionEnd = (event: Event) => {
|
||||||
|
isComposing = false;
|
||||||
|
onInput(event);
|
||||||
|
};
|
||||||
|
|
||||||
|
const onInput = (event: Event) => {
|
||||||
|
if (isComposing) return;
|
||||||
|
const target = event.target as HTMLInputElement;
|
||||||
|
emit('update:modelValue', target.value);
|
||||||
|
};
|
||||||
|
|
||||||
|
const densityClasses = computed(() => {
|
||||||
|
switch (props.density) {
|
||||||
|
case 'compact':
|
||||||
|
return 'py-1 px-2 text-xs min-h-[28px]';
|
||||||
|
case 'touch':
|
||||||
|
return 'py-3 px-4 text-base min-h-[44px]'; // WMS Field Touch Density (min 44px)
|
||||||
|
case 'standard':
|
||||||
|
default:
|
||||||
|
return 'py-2 px-3 text-sm min-h-[36px]';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="base-input-wrapper flex flex-col gap-1 w-full text-left select-none">
|
||||||
|
<label
|
||||||
|
v-if="label"
|
||||||
|
:for="id"
|
||||||
|
class="text-xs font-semibold text-slate-700 flex items-center gap-1"
|
||||||
|
>
|
||||||
|
<span>{{ label }}</span>
|
||||||
|
<span v-if="required" class="text-rose-500 font-bold" aria-hidden="true">*</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<div class="relative flex items-center w-full">
|
||||||
|
<input
|
||||||
|
:id="id"
|
||||||
|
:type="type"
|
||||||
|
:value="modelValue ?? ''"
|
||||||
|
:placeholder="placeholder"
|
||||||
|
:readonly="readonly"
|
||||||
|
:disabled="disabled"
|
||||||
|
:required="required"
|
||||||
|
:autocomplete="autocomplete"
|
||||||
|
:aria-invalid="invalid"
|
||||||
|
:aria-describedby="invalid && errorMessage ? `${id}-error` : (hintText ? `${id}-hint` : undefined)"
|
||||||
|
class="w-full rounded-md border transition-all duration-150 outline-none
|
||||||
|
bg-white text-slate-900 placeholder:text-slate-400
|
||||||
|
focus:ring-2 focus:ring-blue-500 focus:border-blue-500
|
||||||
|
disabled:bg-slate-100 disabled:text-slate-400 disabled:cursor-not-allowed
|
||||||
|
readonly:bg-slate-50 readonly:text-slate-600"
|
||||||
|
:class="[
|
||||||
|
densityClasses,
|
||||||
|
invalid ? 'border-rose-500 focus:ring-rose-500 focus:border-rose-500' : 'border-slate-300'
|
||||||
|
]"
|
||||||
|
@input="onInput"
|
||||||
|
@compositionstart="onCompositionStart"
|
||||||
|
@compositionend="onCompositionEnd"
|
||||||
|
@focus="$emit('focus', $event)"
|
||||||
|
@blur="$emit('blur', $event)"
|
||||||
|
@keydown="$emit('keydown', $event)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<span
|
||||||
|
v-if="invalid && errorMessage"
|
||||||
|
:id="`${id}-error`"
|
||||||
|
class="text-xs text-rose-600 font-medium"
|
||||||
|
role="alert"
|
||||||
|
>
|
||||||
|
{{ errorMessage }}
|
||||||
|
</span>
|
||||||
|
<span
|
||||||
|
v-else-if="hintText"
|
||||||
|
:id="`${id}-hint`"
|
||||||
|
class="text-xs text-slate-500"
|
||||||
|
>
|
||||||
|
{{ hintText }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed } from 'vue';
|
||||||
|
import type { InputDensity } from './BaseInput.vue';
|
||||||
|
|
||||||
|
export interface SelectOption {
|
||||||
|
value: string | number;
|
||||||
|
label: string;
|
||||||
|
disabled?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
id?: string;
|
||||||
|
modelValue?: string | number | null;
|
||||||
|
options?: SelectOption[];
|
||||||
|
label?: string;
|
||||||
|
placeholder?: string;
|
||||||
|
density?: InputDensity;
|
||||||
|
disabled?: boolean;
|
||||||
|
required?: boolean;
|
||||||
|
invalid?: boolean;
|
||||||
|
errorMessage?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
id: () => `base-select-${Math.random().toString(36).substring(2, 9)}`,
|
||||||
|
modelValue: '',
|
||||||
|
options: () => [],
|
||||||
|
density: 'standard',
|
||||||
|
disabled: false,
|
||||||
|
required: false,
|
||||||
|
invalid: false
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'update:modelValue', value: string | number): void;
|
||||||
|
(e: 'change', value: string | number): void;
|
||||||
|
(e: 'blur'): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const densityClasses = computed(() => {
|
||||||
|
switch (props.density) {
|
||||||
|
case 'compact': return 'py-1 px-2 text-xs min-h-[28px]';
|
||||||
|
case 'touch': return 'py-3 px-4 text-base min-h-[44px]'; // WMS Field Touch Density 44px
|
||||||
|
case 'standard': default: return 'py-2 px-3 text-sm min-h-[36px]';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const onChange = (event: Event) => {
|
||||||
|
const target = event.target as HTMLSelectElement;
|
||||||
|
emit('update:modelValue', target.value);
|
||||||
|
emit('change', target.value);
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="base-select-wrapper flex flex-col gap-1 w-full text-left select-none">
|
||||||
|
<label v-if="label" :for="id" class="text-xs font-semibold text-slate-700 flex items-center gap-1">
|
||||||
|
<span>{{ label }}</span>
|
||||||
|
<span v-if="required" class="text-rose-500 font-bold" aria-hidden="true">*</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<select
|
||||||
|
:id="id"
|
||||||
|
:value="modelValue ?? ''"
|
||||||
|
:disabled="disabled"
|
||||||
|
:required="required"
|
||||||
|
:aria-invalid="invalid"
|
||||||
|
class="w-full rounded-md border bg-white text-slate-900 transition-all duration-150 outline-none
|
||||||
|
focus:ring-2 focus:ring-blue-500 focus:border-blue-500
|
||||||
|
disabled:bg-slate-100 disabled:text-slate-400 disabled:cursor-not-allowed cursor-pointer"
|
||||||
|
:class="[
|
||||||
|
densityClasses,
|
||||||
|
invalid ? 'border-rose-500 focus:ring-rose-500 focus:border-rose-500' : 'border-slate-300'
|
||||||
|
]"
|
||||||
|
@change="onChange"
|
||||||
|
@blur="emit('blur')"
|
||||||
|
>
|
||||||
|
<option v-if="placeholder" value="" disabled selected>{{ placeholder }}</option>
|
||||||
|
<option
|
||||||
|
v-for="opt in options"
|
||||||
|
:key="opt.value"
|
||||||
|
:value="opt.value"
|
||||||
|
:disabled="opt.disabled"
|
||||||
|
>
|
||||||
|
{{ opt.label }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<span v-if="invalid && errorMessage" class="text-xs text-rose-600 font-medium" role="alert">
|
||||||
|
{{ errorMessage }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed } from 'vue';
|
||||||
|
|
||||||
|
export type StatusBadgeVariant = 'success' | 'warning' | 'danger' | 'info' | 'neutral';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
variant?: StatusBadgeVariant;
|
||||||
|
label?: string;
|
||||||
|
dot?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
variant: 'neutral',
|
||||||
|
label: '',
|
||||||
|
dot: true
|
||||||
|
});
|
||||||
|
|
||||||
|
const variantClasses = computed(() => {
|
||||||
|
switch (props.variant) {
|
||||||
|
case 'success':
|
||||||
|
return 'bg-emerald-50 text-emerald-700 border-emerald-200';
|
||||||
|
case 'warning':
|
||||||
|
return 'bg-amber-50 text-amber-700 border-amber-200';
|
||||||
|
case 'danger':
|
||||||
|
return 'bg-rose-50 text-rose-700 border-rose-200';
|
||||||
|
case 'info':
|
||||||
|
return 'bg-sky-50 text-sky-700 border-sky-200';
|
||||||
|
case 'neutral':
|
||||||
|
default:
|
||||||
|
return 'bg-slate-100 text-slate-700 border-slate-200';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const dotClasses = computed(() => {
|
||||||
|
switch (props.variant) {
|
||||||
|
case 'success': return 'bg-emerald-500';
|
||||||
|
case 'warning': return 'bg-amber-500';
|
||||||
|
case 'danger': return 'bg-rose-500';
|
||||||
|
case 'info': return 'bg-sky-500';
|
||||||
|
case 'neutral': default: return 'bg-slate-400';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<span
|
||||||
|
class="inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-semibold border select-none"
|
||||||
|
:class="variantClasses"
|
||||||
|
>
|
||||||
|
<span v-if="dot" class="h-1.5 w-1.5 rounded-full" :class="dotClasses" aria-hidden="true"></span>
|
||||||
|
<slot>{{ label }}</slot>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<!-- Unified Component Re-export: SelectInput -> QuantComboBox -->
|
<!-- Unified Component Re-export: SelectInput -> QuantComboBox -->
|
||||||
<template>
|
<template>
|
||||||
<QuantComboBox v-bind="$attrs">
|
<QuantComboBox v-bind="{ options: [], ...$attrs }">
|
||||||
<template v-for="(_, slotName) in $slots" :key="slotName" #[slotName]="slotProps">
|
<template v-for="(_, slotName) in $slots" :key="slotName" #[slotName]="slotProps">
|
||||||
<slot :name="slotName" v-bind="slotProps || {}"></slot>
|
<slot :name="slotName" v-bind="slotProps || {}"></slot>
|
||||||
</template>
|
</template>
|
||||||
@@ -10,6 +10,12 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import QuantComboBox from '../QuantComboBox.vue';
|
import QuantComboBox from '../QuantComboBox.vue';
|
||||||
|
|
||||||
|
withDefaults(defineProps<{
|
||||||
|
options?: (string | { label: string; value: string | number })[];
|
||||||
|
}>(), {
|
||||||
|
options: () => []
|
||||||
|
});
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
inheritAttrs: false
|
inheritAttrs: false
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,84 @@
|
|||||||
|
/**
|
||||||
|
* ERP Accounting Journal Entry & Approval Models
|
||||||
|
*
|
||||||
|
* Governance: docs/ENTERPRISE_CRUD_DESIGN_SPECIFICATION.md
|
||||||
|
* WBS: Phase 7 (ERP-01 ~ ERP-04)
|
||||||
|
*/
|
||||||
|
|
||||||
|
import type { DecimalString, UserId } from '../../../shared/types/coreModels';
|
||||||
|
|
||||||
|
export type JournalStatus = 'DRAFT' | 'PENDING_APPROVAL' | 'APPROVED' | 'REJECTED' | 'REVERSED';
|
||||||
|
|
||||||
|
export interface JournalLineModel {
|
||||||
|
lineNo: number;
|
||||||
|
accountCode: string;
|
||||||
|
accountName: string;
|
||||||
|
debitAmount: number; // 차변 금액
|
||||||
|
creditAmount: number; // 대변 금액
|
||||||
|
description?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface JournalEntryModel {
|
||||||
|
journalId: string;
|
||||||
|
entryDate: string;
|
||||||
|
periodYearMonth: string; // YYYY-MM
|
||||||
|
status: JournalStatus;
|
||||||
|
creatorId: UserId;
|
||||||
|
approverId?: UserId;
|
||||||
|
isPeriodClosed: boolean;
|
||||||
|
lines: JournalLineModel[];
|
||||||
|
totalDebit: DecimalString;
|
||||||
|
totalCredit: DecimalString;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Check if Debit total equals Credit total */
|
||||||
|
export function validateJournalBalance(entry: JournalEntryModel): { isBalanced: boolean; diff: number } {
|
||||||
|
let debitSum = 0;
|
||||||
|
let creditSum = 0;
|
||||||
|
|
||||||
|
for (const line of entry.lines) {
|
||||||
|
debitSum += line.debitAmount;
|
||||||
|
creditSum += line.creditAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
const diff = Math.abs(debitSum - creditSum);
|
||||||
|
return {
|
||||||
|
isBalanced: diff === 0 && debitSum > 0,
|
||||||
|
diff
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Separation of Duties (SoD) Check: Creator cannot approve their own entry */
|
||||||
|
export function validateSoDApproval(creatorId: UserId, approverId: UserId): { allowed: boolean; reason?: string } {
|
||||||
|
if (creatorId === approverId) {
|
||||||
|
return {
|
||||||
|
allowed: false,
|
||||||
|
reason: '작성자와 승인자는 동일인일 수 없습니다 (직무분리 SoD 위반).'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return { allowed: true };
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create Reverse Journal Entry (역분개) */
|
||||||
|
export function createReverseJournalEntry(original: JournalEntryModel, newJournalId: string, currentUserId: UserId): JournalEntryModel {
|
||||||
|
const reversedLines: JournalLineModel[] = original.lines.map(line => ({
|
||||||
|
lineNo: line.lineNo,
|
||||||
|
accountCode: line.accountCode,
|
||||||
|
accountName: line.accountName,
|
||||||
|
debitAmount: line.creditAmount, // Reverse debit and credit
|
||||||
|
creditAmount: line.debitAmount,
|
||||||
|
description: `[역분개] ${line.description || ''}`
|
||||||
|
}));
|
||||||
|
|
||||||
|
return {
|
||||||
|
journalId: newJournalId,
|
||||||
|
entryDate: new Date().toISOString().substring(0, 10),
|
||||||
|
periodYearMonth: original.periodYearMonth,
|
||||||
|
status: 'APPROVED',
|
||||||
|
creatorId: currentUserId,
|
||||||
|
isPeriodClosed: false,
|
||||||
|
lines: reversedLines,
|
||||||
|
totalDebit: original.totalCredit,
|
||||||
|
totalCredit: original.totalDebit
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
/**
|
||||||
|
* OMS Order Pilot Domain & Form Models
|
||||||
|
*
|
||||||
|
* Governance: docs/ENTERPRISE_CRUD_DESIGN_SPECIFICATION.md
|
||||||
|
* WBS: Phase 5 (OMS-ORDER-01 ~ OMS-ORDER-04)
|
||||||
|
*/
|
||||||
|
|
||||||
|
import type { OrderId, CustomerId, DecimalString } from '../../../shared/types/coreModels';
|
||||||
|
|
||||||
|
export type OrderStatus = 'DRAFT' | 'CONFIRMED' | 'SHIPPED' | 'CANCELLED';
|
||||||
|
|
||||||
|
export interface OrderLineItemModel {
|
||||||
|
lineNo: number;
|
||||||
|
productId: string;
|
||||||
|
productName: string;
|
||||||
|
qty: number;
|
||||||
|
unitPrice: number;
|
||||||
|
amount: number; // qty * unitPrice
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface OrderHeaderModel {
|
||||||
|
orderId: OrderId;
|
||||||
|
customerId: CustomerId;
|
||||||
|
customerName: string;
|
||||||
|
orderDate: string;
|
||||||
|
status: OrderStatus;
|
||||||
|
version: number;
|
||||||
|
remarks?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface OrderFormModel {
|
||||||
|
header: OrderHeaderModel;
|
||||||
|
lines: OrderLineItemModel[];
|
||||||
|
totalAmount: DecimalString;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Cross-field Validation for Order Creation */
|
||||||
|
export function validateOrderForm(form: OrderFormModel): { isValid: boolean; errors: string[] } {
|
||||||
|
const errors: string[] = [];
|
||||||
|
|
||||||
|
if (!form.header.orderId) {
|
||||||
|
errors.push('주문 번호는 필수 입력 항목입니다.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!form.header.customerName) {
|
||||||
|
errors.push('거래처명은 필수 입력 항목입니다.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (form.lines.length === 0) {
|
||||||
|
errors.push('주문 라인 품목이 최소 1건 이상 존재해야 합니다.');
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const line of form.lines) {
|
||||||
|
if (line.qty <= 0) {
|
||||||
|
errors.push(`라인 [${line.productName}]: 수량은 0보다 커야 합니다.`);
|
||||||
|
}
|
||||||
|
if (line.unitPrice < 0) {
|
||||||
|
errors.push(`라인 [${line.productName}]: 단가는 0 이상이어야 합니다.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
isValid: errors.length === 0,
|
||||||
|
errors
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
/**
|
||||||
|
* WMS Offline Command & Scan Models
|
||||||
|
*
|
||||||
|
* Governance: docs/ENTERPRISE_CRUD_DESIGN_SPECIFICATION.md
|
||||||
|
* WBS: Phase 6 (WMS-01 ~ WMS-04)
|
||||||
|
*/
|
||||||
|
|
||||||
|
export type OfflineCommandStatus = 'queued' | 'syncing' | 'completed' | 'conflict' | 'failed';
|
||||||
|
|
||||||
|
export interface OfflineCommand {
|
||||||
|
commandId: string;
|
||||||
|
idempotencyKey: string;
|
||||||
|
actionType: 'RECEIVE' | 'PICK' | 'PUTAWAY' | 'MOVE';
|
||||||
|
payload: Record<string, unknown>;
|
||||||
|
status: OfflineCommandStatus;
|
||||||
|
createdAt: string;
|
||||||
|
syncedAt?: string;
|
||||||
|
retryCount: number;
|
||||||
|
errorMessage?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BarcodeScanResult {
|
||||||
|
rawBarcode: string;
|
||||||
|
itemCode?: string;
|
||||||
|
gtin?: string;
|
||||||
|
lotNumber?: string;
|
||||||
|
expiryDate?: string;
|
||||||
|
serialNumber?: string;
|
||||||
|
parseTimeMs: number;
|
||||||
|
isValid: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type GS1ParseResult = BarcodeScanResult;
|
||||||
|
|
||||||
|
/** GS1-128 Barcode Parser Simulator (<100ms parse requirement) */
|
||||||
|
export function parseGS1Barcode(barcode: string): BarcodeScanResult {
|
||||||
|
const startTime = performance.now();
|
||||||
|
const clean = barcode.trim();
|
||||||
|
|
||||||
|
// Basic GS1 AI Simulation: (01)ItemCode (10)LotNo (17)ExpiryDate
|
||||||
|
let itemCode = clean;
|
||||||
|
let lotNumber = 'LOT-20260726';
|
||||||
|
let expiryDate = '2027-12-31';
|
||||||
|
|
||||||
|
if (clean.includes('-')) {
|
||||||
|
const parts = clean.split('-');
|
||||||
|
itemCode = parts[0];
|
||||||
|
if (parts[1]) lotNumber = `LOT-${parts[1]}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const parseTimeMs = Math.round(performance.now() - startTime);
|
||||||
|
|
||||||
|
return {
|
||||||
|
rawBarcode: clean,
|
||||||
|
itemCode,
|
||||||
|
lotNumber,
|
||||||
|
expiryDate,
|
||||||
|
parseTimeMs,
|
||||||
|
isValid: clean.length >= 3
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -29,6 +29,12 @@ const router = createRouter({
|
|||||||
{ path: '/database', component: DatabaseView },
|
{ path: '/database', component: DatabaseView },
|
||||||
{ path: '/snapshots', component: SnapshotAdminView },
|
{ path: '/snapshots', component: SnapshotAdminView },
|
||||||
{ path: '/users', component: UserManagementView },
|
{ path: '/users', component: UserManagementView },
|
||||||
|
{ path: '/oms/orders', component: () => import('../views/OmsOrderPilotView.vue') },
|
||||||
|
{ path: '/wms/picking', component: () => import('../views/WmsInboundPickingView.vue') },
|
||||||
|
{ path: '/erp/journals', component: () => import('../views/ErpJournalEntryView.vue') },
|
||||||
|
{ path: '/workflow/integrated', component: () => import('../views/IntegratedWorkflowView.vue') },
|
||||||
|
{ path: '/ax/governance', component: () => import('../views/AiAxGovernanceView.vue') },
|
||||||
|
{ path: '/migration/nfr', component: () => import('../views/MigrationNfrDashboardView.vue') },
|
||||||
{ path: '/components', component: () => import('../views/ComponentShowcaseView.vue') },
|
{ path: '/components', component: () => import('../views/ComponentShowcaseView.vue') },
|
||||||
|
|
||||||
// 프로토타입 템플릿 경로 매핑 (Lazy-loaded for Performance & Bundle Splitting)
|
// 프로토타입 템플릿 경로 매핑 (Lazy-loaded for Performance & Bundle Splitting)
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
import { describe, it, expect } from 'vitest';
|
||||||
|
import {
|
||||||
|
makeOrderId,
|
||||||
|
createMoney,
|
||||||
|
makeDecimalString,
|
||||||
|
makeLocalDateString,
|
||||||
|
Result
|
||||||
|
} from '../types/coreModels';
|
||||||
|
import { AxiosHttpClientAdapter } from '../api/httpClient';
|
||||||
|
|
||||||
|
describe('Phase 2 Core Models & HttpClient Contract Suite', () => {
|
||||||
|
it('CORE-001: Branded OrderId construction works properly', () => {
|
||||||
|
const orderId = makeOrderId('ORD-2026-001');
|
||||||
|
expect(orderId).toBe('ORD-2026-001');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('CORE-002: Money & DecimalString precision handling for KRW and USD', () => {
|
||||||
|
const krwMoney = createMoney('500000000', 'KRW');
|
||||||
|
expect(krwMoney.amount).toBe('500000000');
|
||||||
|
expect(krwMoney.scale).toBe(0);
|
||||||
|
|
||||||
|
const usdMoney = createMoney('1234.56', 'USD');
|
||||||
|
expect(usdMoney.amount).toBe('1234.56');
|
||||||
|
expect(usdMoney.scale).toBe(2);
|
||||||
|
|
||||||
|
expect(() => makeDecimalString('invalid-number')).toThrow();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('CORE-003: LocalDateString YYYY-MM-DD validation', () => {
|
||||||
|
const dateStr = makeLocalDateString('2026-07-26');
|
||||||
|
expect(dateStr).toBe('2026-07-26');
|
||||||
|
expect(() => makeLocalDateString('2026/07/26')).toThrow();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('CORE-004: Result monad ok and err branching', () => {
|
||||||
|
const okResult = Result.ok<number>(42);
|
||||||
|
expect(okResult.isOk).toBe(true);
|
||||||
|
if (okResult.isOk) {
|
||||||
|
expect(okResult.value).toBe(42);
|
||||||
|
}
|
||||||
|
|
||||||
|
const errResult = Result.err({
|
||||||
|
category: 'VALIDATION_ERROR',
|
||||||
|
code: 'FIELD_REQUIRED',
|
||||||
|
message: 'Field is required'
|
||||||
|
});
|
||||||
|
expect(errResult.isErr).toBe(true);
|
||||||
|
if (errResult.isErr) {
|
||||||
|
expect(errResult.error.category).toBe('VALIDATION_ERROR');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it('CORE-021: AxiosHttpClientAdapter instantiates properly', () => {
|
||||||
|
const client = new AxiosHttpClientAdapter();
|
||||||
|
expect(client).toBeDefined();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
import { describe, it, expect } from 'vitest';
|
||||||
|
import { mount } from '@vue/test-utils';
|
||||||
|
import BaseInput from '../../components/primitives/BaseInput.vue';
|
||||||
|
import BaseSelect from '../../components/primitives/BaseSelect.vue';
|
||||||
|
import BaseCheckbox from '../../components/primitives/BaseCheckbox.vue';
|
||||||
|
import BaseButton from '../../components/primitives/BaseButton.vue';
|
||||||
|
import BaseStatusBadge from '../../components/primitives/BaseStatusBadge.vue';
|
||||||
|
import CodeField from '../../components/fields/CodeField.vue';
|
||||||
|
import MoneyField from '../../components/domain-fields/MoneyField.vue';
|
||||||
|
import QuantityField from '../../components/domain-fields/QuantityField.vue';
|
||||||
|
|
||||||
|
describe('Phase 3 Enterprise Input Components 4-Layer Architecture Full Suite', () => {
|
||||||
|
it('FIELD-P01: BaseInput renders with label, touch density, and accessibility attributes', () => {
|
||||||
|
const wrapper = mount(BaseInput, {
|
||||||
|
props: {
|
||||||
|
label: '품목 코드',
|
||||||
|
required: true,
|
||||||
|
density: 'touch',
|
||||||
|
modelValue: 'ITEM-001'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(wrapper.text()).toContain('품목 코드');
|
||||||
|
expect(wrapper.text()).toContain('*');
|
||||||
|
const input = wrapper.find('input');
|
||||||
|
expect(input.classes()).toContain('min-h-[44px]');
|
||||||
|
expect((input.element as HTMLInputElement).value).toBe('ITEM-001');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('FIELD-P02: BaseSelect & BaseCheckbox render and emit events properly', async () => {
|
||||||
|
const selectWrapper = mount(BaseSelect, {
|
||||||
|
props: {
|
||||||
|
options: [{ value: 'A', label: 'Option A' }]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
expect(selectWrapper.find('option[value="A"]').text()).toBe('Option A');
|
||||||
|
|
||||||
|
const checkWrapper = mount(BaseCheckbox, {
|
||||||
|
props: { modelValue: false, label: '동의' }
|
||||||
|
});
|
||||||
|
await checkWrapper.find('input').setValue(true);
|
||||||
|
expect(checkWrapper.emitted('update:modelValue')?.[0]).toEqual([true]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('FIELD-P03: BaseButton & BaseStatusBadge render variants correctly', () => {
|
||||||
|
const btnWrapper = mount(BaseButton, {
|
||||||
|
props: { variant: 'danger', density: 'touch' },
|
||||||
|
slots: { default: '삭제' }
|
||||||
|
});
|
||||||
|
expect(btnWrapper.classes()).toContain('bg-rose-600');
|
||||||
|
expect(btnWrapper.classes()).toContain('min-h-[44px]');
|
||||||
|
|
||||||
|
const badgeWrapper = mount(BaseStatusBadge, {
|
||||||
|
props: { variant: 'success', label: '정상' }
|
||||||
|
});
|
||||||
|
expect(badgeWrapper.classes()).toContain('bg-emerald-50');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('FIELD-T01: CodeField automatically normalizes input to uppercase alphanumeric', async () => {
|
||||||
|
const wrapper = mount(CodeField, {
|
||||||
|
props: { modelValue: 'ord-2026-abc' }
|
||||||
|
});
|
||||||
|
|
||||||
|
const input = wrapper.find('input');
|
||||||
|
await input.setValue('ord-2026-xyz!');
|
||||||
|
expect(wrapper.emitted('update:modelValue')?.[0]).toEqual(['ORD-2026-XYZ']);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('FIELD-D02: MoneyField & QuantityField handle domain units and scales', () => {
|
||||||
|
const moneyWrapper = mount(MoneyField, {
|
||||||
|
props: { modelValue: '50000', currency: 'KRW' }
|
||||||
|
});
|
||||||
|
expect(moneyWrapper.text()).toContain('[KRW]');
|
||||||
|
|
||||||
|
const qtyWrapper = mount(QuantityField, {
|
||||||
|
props: { modelValue: '600', maxAvailableQty: 500, uom: 'BOX' }
|
||||||
|
});
|
||||||
|
expect(qtyWrapper.text()).toContain('초과했습니다');
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
/**
|
||||||
|
* AI / AX Governance & Hallucination Prevention Framework
|
||||||
|
*
|
||||||
|
* Governance: docs/ENTERPRISE_CRUD_DESIGN_SPECIFICATION.md Section 8 (AI/AX Governance)
|
||||||
|
* WBS: Phase 9 (AX-01 ~ AX-04)
|
||||||
|
*/
|
||||||
|
|
||||||
|
export type AIRiskLevel = 'R0' | 'R1' | 'R2' | 'R3' | 'R4';
|
||||||
|
|
||||||
|
export interface AISuggestion<T = unknown> {
|
||||||
|
suggestionId: string;
|
||||||
|
fieldPath: string;
|
||||||
|
suggestedValue: T;
|
||||||
|
confidenceScore: number; // 0.0 ~ 1.0
|
||||||
|
rationale: string;
|
||||||
|
evidence: string;
|
||||||
|
riskLevel: AIRiskLevel;
|
||||||
|
modelInfo: {
|
||||||
|
modelName: string;
|
||||||
|
promptVersion: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AIDecisionLog {
|
||||||
|
suggestionId: string;
|
||||||
|
fieldPath: string;
|
||||||
|
riskLevel: AIRiskLevel;
|
||||||
|
userDecision: 'ACCEPTED' | 'MODIFIED' | 'REJECTED';
|
||||||
|
finalValue: unknown;
|
||||||
|
timestamp: string;
|
||||||
|
userId: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** R0 ~ R4 Risk Governance Guard Rules */
|
||||||
|
export function getAIRiskPolicy(riskLevel: AIRiskLevel): { actionAllowed: boolean; requiresApproval: boolean; isBlocked: boolean; label: string } {
|
||||||
|
switch (riskLevel) {
|
||||||
|
case 'R0':
|
||||||
|
return { actionAllowed: true, requiresApproval: false, isBlocked: false, label: 'R0: 조회·요약 (자동 허용)' };
|
||||||
|
case 'R1':
|
||||||
|
return { actionAllowed: true, requiresApproval: false, isBlocked: false, label: 'R1: 필드 추천 (사용자 적용)' };
|
||||||
|
case 'R2':
|
||||||
|
return { actionAllowed: true, requiresApproval: false, isBlocked: false, label: 'R2: 가역적 변경 (초안 확인 후 실행)' };
|
||||||
|
case 'R3':
|
||||||
|
return { actionAllowed: true, requiresApproval: true, isBlocked: false, label: 'R3: 출고·발주·금액 (명시적 승인 필요)' };
|
||||||
|
case 'R4':
|
||||||
|
default:
|
||||||
|
return { actionAllowed: false, requiresApproval: true, isBlocked: true, label: 'R4: 회계 확정·대량 삭제 (AI 직접 실행 금지)' };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Deterministic Formula Guard: Block AI from overriding exact financial math (Amount = Qty * Price) */
|
||||||
|
export function validateAIFormulaGuard(fieldPath: string, isDeterministicFormula: boolean): { isPermitted: boolean; errorReason?: string } {
|
||||||
|
if (isDeterministicFormula) {
|
||||||
|
return {
|
||||||
|
isPermitted: false,
|
||||||
|
errorReason: `[보안 차단] 필드 [${fieldPath}]는 결정론적 수식(금액/수량/세금 연산)이므로 AI 추천 입력을 전면 차단합니다.`
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return { isPermitted: true };
|
||||||
|
}
|
||||||
@@ -0,0 +1,149 @@
|
|||||||
|
/**
|
||||||
|
* Phase 2 HttpClient Port & Adapter
|
||||||
|
*
|
||||||
|
* Governance: docs/ENTERPRISE_CRUD_DESIGN_SPECIFICATION.md
|
||||||
|
* WBS: CORE-021
|
||||||
|
*/
|
||||||
|
|
||||||
|
import axios, { type AxiosInstance, type AxiosRequestConfig } from 'axios';
|
||||||
|
import { Result, type ApplicationError, type ErrorCategory } from '../types/coreModels';
|
||||||
|
|
||||||
|
export interface HttpRequestOptions {
|
||||||
|
headers?: Record<string, string>;
|
||||||
|
params?: Record<string, unknown>;
|
||||||
|
idempotencyKey?: string;
|
||||||
|
versionToken?: string; // Used for If-Match header in optimistic locking
|
||||||
|
signal?: AbortSignal;
|
||||||
|
timeoutMs?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface HttpClientPort {
|
||||||
|
get<T>(url: string, options?: HttpRequestOptions): Promise<Result<T, ApplicationError>>;
|
||||||
|
post<T>(url: string, body?: unknown, options?: HttpRequestOptions): Promise<Result<T, ApplicationError>>;
|
||||||
|
patch<T>(url: string, body?: unknown, options?: HttpRequestOptions): Promise<Result<T, ApplicationError>>;
|
||||||
|
put<T>(url: string, body?: unknown, options?: HttpRequestOptions): Promise<Result<T, ApplicationError>>;
|
||||||
|
delete<T>(url: string, options?: HttpRequestOptions): Promise<Result<T, ApplicationError>>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class AxiosHttpClientAdapter implements HttpClientPort {
|
||||||
|
private client: AxiosInstance;
|
||||||
|
|
||||||
|
constructor(baseURL?: string) {
|
||||||
|
this.client = axios.create({
|
||||||
|
baseURL: baseURL || import.meta.env.VITE_API_BASE_URL || '/api',
|
||||||
|
timeout: 15000,
|
||||||
|
withCredentials: true,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Accept': 'application/json'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Anti-CSRF Token Header Interceptor
|
||||||
|
this.client.interceptors.request.use((config) => {
|
||||||
|
const csrfToken = document.cookie
|
||||||
|
.split('; ')
|
||||||
|
.find(row => row.startsWith('XSRF-TOKEN='))
|
||||||
|
?.split('=')[1];
|
||||||
|
if (csrfToken && config.headers) {
|
||||||
|
config.headers['X-XSRF-TOKEN'] = csrfToken;
|
||||||
|
}
|
||||||
|
return config;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private buildConfig(options?: HttpRequestOptions): AxiosRequestConfig {
|
||||||
|
const config: AxiosRequestConfig = {
|
||||||
|
headers: { ...(options?.headers || {}) },
|
||||||
|
params: options?.params,
|
||||||
|
signal: options?.signal,
|
||||||
|
timeout: options?.timeoutMs
|
||||||
|
};
|
||||||
|
|
||||||
|
if (options?.idempotencyKey && config.headers) {
|
||||||
|
config.headers['Idempotency-Key'] = options.idempotencyKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options?.versionToken && config.headers) {
|
||||||
|
config.headers['If-Match'] = `"${options.versionToken}"`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
private handleError(error: unknown): ApplicationError {
|
||||||
|
if (axios.isAxiosError(error)) {
|
||||||
|
const status = error.response?.status;
|
||||||
|
const data = error.response?.data;
|
||||||
|
|
||||||
|
let category: ErrorCategory = 'UNEXPECTED_ERROR';
|
||||||
|
if (status === 400 || status === 422) category = 'VALIDATION_ERROR';
|
||||||
|
else if (status === 401 || status === 403) category = 'AUTHORIZATION_ERROR';
|
||||||
|
else if (status === 404) category = 'NOT_FOUND_ERROR';
|
||||||
|
else if (status === 409) category = 'CONFLICT_ERROR';
|
||||||
|
else if (error.code === 'ECONNABORTED' || !error.response) category = 'NETWORK_ERROR';
|
||||||
|
|
||||||
|
return {
|
||||||
|
category,
|
||||||
|
code: data?.code || `HTTP_${status || 'NETWORK'}`,
|
||||||
|
message: data?.message || error.message || 'An HTTP error occurred',
|
||||||
|
correlationId: data?.correlationId || (error.config?.headers?.['X-Correlation-ID'] as string),
|
||||||
|
fieldErrors: data?.fieldErrors,
|
||||||
|
remediation: data?.remediation
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
category: 'UNEXPECTED_ERROR',
|
||||||
|
code: 'UNEXPECTED_EXCEPTION',
|
||||||
|
message: error instanceof Error ? error.message : String(error)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
async get<T>(url: string, options?: HttpRequestOptions): Promise<Result<T, ApplicationError>> {
|
||||||
|
try {
|
||||||
|
const res = await this.client.get<T>(url, this.buildConfig(options));
|
||||||
|
return Result.ok(res.data);
|
||||||
|
} catch (err) {
|
||||||
|
return Result.err(this.handleError(err));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async post<T>(url: string, body?: unknown, options?: HttpRequestOptions): Promise<Result<T, ApplicationError>> {
|
||||||
|
try {
|
||||||
|
const res = await this.client.post<T>(url, body, this.buildConfig(options));
|
||||||
|
return Result.ok(res.data);
|
||||||
|
} catch (err) {
|
||||||
|
return Result.err(this.handleError(err));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async patch<T>(url: string, body?: unknown, options?: HttpRequestOptions): Promise<Result<T, ApplicationError>> {
|
||||||
|
try {
|
||||||
|
const res = await this.client.patch<T>(url, body, this.buildConfig(options));
|
||||||
|
return Result.ok(res.data);
|
||||||
|
} catch (err) {
|
||||||
|
return Result.err(this.handleError(err));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async put<T>(url: string, body?: unknown, options?: HttpRequestOptions): Promise<Result<T, ApplicationError>> {
|
||||||
|
try {
|
||||||
|
const res = await this.client.put<T>(url, body, this.buildConfig(options));
|
||||||
|
return Result.ok(res.data);
|
||||||
|
} catch (err) {
|
||||||
|
return Result.err(this.handleError(err));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async delete<T>(url: string, options?: HttpRequestOptions): Promise<Result<T, ApplicationError>> {
|
||||||
|
try {
|
||||||
|
const res = await this.client.delete<T>(url, this.buildConfig(options));
|
||||||
|
return Result.ok(res.data);
|
||||||
|
} catch (err) {
|
||||||
|
return Result.err(this.handleError(err));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const defaultHttpClient: HttpClientPort = new AxiosHttpClientAdapter();
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
/**
|
||||||
|
* Phase 10 NFR & Phase 11 Migration Governance
|
||||||
|
*
|
||||||
|
* Governance: docs/ENTERPRISE_CRUD_DESIGN_SPECIFICATION.md
|
||||||
|
* WBS: Phase 10 (NFR) & Phase 11 (MIG-01 ~ MIG-04)
|
||||||
|
*/
|
||||||
|
|
||||||
|
export interface PerformanceMetric {
|
||||||
|
inputLatencyMs: number; // Target < 100ms
|
||||||
|
barcodeParseMs: number; // Target < 100ms
|
||||||
|
searchP95Ms: number; // Target < 1000ms
|
||||||
|
saveP95Ms: number; // Target < 2000ms
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ReconciliationReport {
|
||||||
|
reconciliationId: string;
|
||||||
|
comparedAt: string;
|
||||||
|
legacyTotalAmount: number;
|
||||||
|
newTotalAmount: number;
|
||||||
|
discrepancyCount: number;
|
||||||
|
status: 'BALANCED' | 'MISMATCH';
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Sanitize input strings against XSS and control characters (OWASP) */
|
||||||
|
export function sanitizeInputString(input: string): string {
|
||||||
|
if (!input) return '';
|
||||||
|
return input
|
||||||
|
.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '')
|
||||||
|
.replace(/[<>'"]/g, '')
|
||||||
|
.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Run Daily Reconciliation Check between Legacy and New Engine (MIG-02) */
|
||||||
|
export function runReconciliationCheck(legacyTotal: number, newTotal: number): ReconciliationReport {
|
||||||
|
const diff = Math.abs(legacyTotal - newTotal);
|
||||||
|
return {
|
||||||
|
reconciliationId: `REC-${Date.now()}`,
|
||||||
|
comparedAt: new Date().toISOString(),
|
||||||
|
legacyTotalAmount: legacyTotal,
|
||||||
|
newTotalAmount: newTotal,
|
||||||
|
discrepancyCount: diff === 0 ? 0 : 1,
|
||||||
|
status: diff === 0 ? 'BALANCED' : 'MISMATCH'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Feature Flag Helper for Strangler Migration (MIG-01) */
|
||||||
|
export function isNewFeatureEnabled(flagKey: string, userGroup: string): boolean {
|
||||||
|
if (userGroup === 'ADMIN' || userGroup === 'POWER_USER') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return flagKey.startsWith('ENABLE_');
|
||||||
|
}
|
||||||
@@ -0,0 +1,169 @@
|
|||||||
|
/**
|
||||||
|
* Phase 2 Core Models Contract
|
||||||
|
*
|
||||||
|
* Governance: docs/ENTERPRISE_CRUD_DESIGN_SPECIFICATION.md
|
||||||
|
* WBS: Phase 2 (CORE-001 ~ CORE-005)
|
||||||
|
*/
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// CORE-001: Branded ID Types (Nominal / Tagged Types)
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
declare const __brand: unique symbol;
|
||||||
|
|
||||||
|
export type Brand<T, B> = T & { readonly [__brand]: B };
|
||||||
|
|
||||||
|
export type OrderId = Brand<string, 'OrderId'>;
|
||||||
|
export type CustomerId = Brand<string, 'CustomerId'>;
|
||||||
|
export type ProductId = Brand<string, 'ProductId'>;
|
||||||
|
export type WarehouseId = Brand<string, 'WarehouseId'>;
|
||||||
|
export type UserId = Brand<string, 'UserId'>;
|
||||||
|
export type TenantId = Brand<string, 'TenantId'>;
|
||||||
|
export type RunId = Brand<string, 'RunId'>;
|
||||||
|
export type SnapshotId = Brand<string, 'SnapshotId'>;
|
||||||
|
export type EntityId = Brand<string, 'EntityId'>;
|
||||||
|
|
||||||
|
/** Helper functions to construct Branded IDs safely */
|
||||||
|
export function makeOrderId(id: string): OrderId { return id as OrderId; }
|
||||||
|
export function makeCustomerId(id: string): CustomerId { return id as CustomerId; }
|
||||||
|
export function makeProductId(id: string): ProductId { return id as ProductId; }
|
||||||
|
export function makeWarehouseId(id: string): WarehouseId { return id as WarehouseId; }
|
||||||
|
export function makeUserId(id: string): UserId { return id as UserId; }
|
||||||
|
export function makeTenantId(id: string): TenantId { return id as TenantId; }
|
||||||
|
export function makeRunId(id: string): RunId { return id as RunId; }
|
||||||
|
export function makeSnapshotId(id: string): SnapshotId { return id as SnapshotId; }
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// CORE-002: DecimalString, Money, Quantity Types
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
export type DecimalString = Brand<string, 'DecimalString'>;
|
||||||
|
|
||||||
|
export interface Money {
|
||||||
|
/** Numeric amount represented as string to avoid IEEE 754 precision loss */
|
||||||
|
amount: DecimalString;
|
||||||
|
/** ISO 4217 Currency Code (e.g., 'KRW', 'USD', 'EUR') */
|
||||||
|
currency: 'KRW' | 'USD' | 'EUR' | 'JPY';
|
||||||
|
/** Scale / decimal places: KRW=0, USD=2 */
|
||||||
|
scale: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Quantity {
|
||||||
|
/** Quantity amount as DecimalString */
|
||||||
|
value: DecimalString;
|
||||||
|
/** Unit of Measure (e.g., 'EA', 'BOX', 'PCS', 'KG') */
|
||||||
|
uom: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Decimal helper functions for strict financial calculations */
|
||||||
|
export function makeDecimalString(val: string | number): DecimalString {
|
||||||
|
const str = typeof val === 'number' ? val.toString() : val;
|
||||||
|
if (!/^-?\d+(\.\d+)?$/.test(str.trim())) {
|
||||||
|
throw new Error(`Invalid DecimalString: ${val}`);
|
||||||
|
}
|
||||||
|
return str.trim() as DecimalString;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createMoney(amountStr: string, currency: 'KRW' | 'USD' | 'EUR' | 'JPY' = 'KRW'): Money {
|
||||||
|
const scale = currency === 'KRW' || currency === 'JPY' ? 0 : 2;
|
||||||
|
return {
|
||||||
|
amount: makeDecimalString(amountStr),
|
||||||
|
currency,
|
||||||
|
scale
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// CORE-003: Date & Time Types
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
/** ISO-8601 Date String format: YYYY-MM-DD */
|
||||||
|
export type LocalDateString = Brand<string, 'LocalDateString'>;
|
||||||
|
|
||||||
|
/** ISO-8601 ZonedDateTime String format: YYYY-MM-DDTHH:mm:ss.sssZ */
|
||||||
|
export type ZonedDateTime = Brand<string, 'ZonedDateTime'>;
|
||||||
|
|
||||||
|
export function makeLocalDateString(str: string): LocalDateString {
|
||||||
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(str)) {
|
||||||
|
throw new Error(`Invalid LocalDateString format (expected YYYY-MM-DD): ${str}`);
|
||||||
|
}
|
||||||
|
return str as LocalDateString;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function makeZonedDateTime(str: string): ZonedDateTime {
|
||||||
|
if (isNaN(Date.parse(str))) {
|
||||||
|
throw new Error(`Invalid ZonedDateTime string: ${str}`);
|
||||||
|
}
|
||||||
|
return str as ZonedDateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// CORE-004: Result<T, E> Monad & ApplicationError
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
export type ErrorCategory =
|
||||||
|
| 'VALIDATION_ERROR'
|
||||||
|
| 'AUTHORIZATION_ERROR'
|
||||||
|
| 'CONFLICT_ERROR'
|
||||||
|
| 'NOT_FOUND_ERROR'
|
||||||
|
| 'NETWORK_ERROR'
|
||||||
|
| 'UNEXPECTED_ERROR';
|
||||||
|
|
||||||
|
export interface FieldErrorDetail {
|
||||||
|
code: string;
|
||||||
|
fieldPath: string;
|
||||||
|
severity: 'error' | 'warning' | 'info';
|
||||||
|
message: string;
|
||||||
|
remediation?: string;
|
||||||
|
rejectedValue?: unknown;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ApplicationError {
|
||||||
|
category: ErrorCategory;
|
||||||
|
code: string;
|
||||||
|
message: string;
|
||||||
|
correlationId?: string;
|
||||||
|
fieldErrors?: FieldErrorDetail[];
|
||||||
|
remediation?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type Result<T, E = ApplicationError> =
|
||||||
|
| { readonly isOk: true; readonly isErr: false; readonly value: T }
|
||||||
|
| { readonly isOk: false; readonly isErr: true; readonly error: E };
|
||||||
|
|
||||||
|
export const Result = {
|
||||||
|
ok<T, E = ApplicationError>(value: T): Result<T, E> {
|
||||||
|
return { isOk: true, isErr: false, value };
|
||||||
|
},
|
||||||
|
err<T, E = ApplicationError>(error: E): Result<T, E> {
|
||||||
|
return { isOk: false, isErr: true, error };
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// CORE-005: Pagination & Search Types
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
export type SortDirection = 'ASC' | 'DESC';
|
||||||
|
|
||||||
|
export interface SortSpec {
|
||||||
|
field: string;
|
||||||
|
direction: SortDirection;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Pagination {
|
||||||
|
pageIndex: number;
|
||||||
|
pageSize: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SearchRequest<TFilter = Record<string, unknown>> {
|
||||||
|
filter: TFilter;
|
||||||
|
pagination: Pagination;
|
||||||
|
sort?: SortSpec[];
|
||||||
|
searchKeyword?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PageResult<T> {
|
||||||
|
items: T[];
|
||||||
|
totalCount: number;
|
||||||
|
pageIndex: number;
|
||||||
|
pageSize: number;
|
||||||
|
totalPages: number;
|
||||||
|
hasNext: boolean;
|
||||||
|
hasPrevious: boolean;
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
/**
|
||||||
|
* Integrated Workflow & Async Job Models
|
||||||
|
*
|
||||||
|
* Governance: docs/ENTERPRISE_CRUD_DESIGN_SPECIFICATION.md
|
||||||
|
* WBS: Phase 8 (FLOW-01 ~ FLOW-04)
|
||||||
|
*/
|
||||||
|
|
||||||
|
export interface WorkflowStep {
|
||||||
|
stepNo: number;
|
||||||
|
domain: 'OMS' | 'WMS' | 'ERP';
|
||||||
|
stepName: string;
|
||||||
|
status: 'PENDING' | 'IN_PROGRESS' | 'COMPLETED' | 'FAILED';
|
||||||
|
correlationId: string;
|
||||||
|
executedAt?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IntegratedWorkflowState {
|
||||||
|
workflowId: string;
|
||||||
|
workflowType: 'ORDER_TO_CASH' | 'PROCURE_TO_PAY' | 'RETURN_TO_REFUND';
|
||||||
|
currentStepIndex: number;
|
||||||
|
steps: WorkflowStep[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AsyncBatchJobState {
|
||||||
|
jobId: string;
|
||||||
|
jobName: string;
|
||||||
|
totalCount: number;
|
||||||
|
processedCount: number;
|
||||||
|
successCount: number;
|
||||||
|
failedCount: number;
|
||||||
|
progressPct: number;
|
||||||
|
status: 'QUEUED' | 'RUNNING' | 'COMPLETED' | 'FAILED';
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create End-to-End Order-to-Cash Workflow (FLOW-01) */
|
||||||
|
export function createOrderToCashWorkflow(orderId: string): IntegratedWorkflowState {
|
||||||
|
const corr = `CORR-${orderId}`;
|
||||||
|
return {
|
||||||
|
workflowId: `WF-${orderId}`,
|
||||||
|
workflowType: 'ORDER_TO_CASH',
|
||||||
|
currentStepIndex: 0,
|
||||||
|
steps: [
|
||||||
|
{ stepNo: 1, domain: 'OMS', stepName: '1. 주문 수주 확정', status: 'COMPLETED', correlationId: `${corr}-01`, executedAt: new Date().toISOString() },
|
||||||
|
{ stepNo: 2, domain: 'WMS', stepName: '2. 재고 할당 (Allocation)', status: 'COMPLETED', correlationId: `${corr}-02`, executedAt: new Date().toISOString() },
|
||||||
|
{ stepNo: 3, domain: 'WMS', stepName: '3. 피킹 및 검수', status: 'IN_PROGRESS', correlationId: `${corr}-03` },
|
||||||
|
{ stepNo: 4, domain: 'WMS', stepName: '4. 출고 확정 (Shipment)', status: 'PENDING', correlationId: `${corr}-04` },
|
||||||
|
{ stepNo: 5, domain: 'ERP', stepName: '5. 매출 전표 자동 생성', status: 'PENDING', correlationId: `${corr}-05` },
|
||||||
|
{ stepNo: 6, domain: 'ERP', stepName: '6. 전자세금계산서 발행', status: 'PENDING', correlationId: `${corr}-06` },
|
||||||
|
{ stepNo: 7, domain: 'ERP', stepName: '7. 입금 정산 완료', status: 'PENDING', correlationId: `${corr}-07` }
|
||||||
|
]
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,141 @@
|
|||||||
|
<!-- AiAxGovernanceView.vue -->
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import BaseStatusBadge from '../components/primitives/BaseStatusBadge.vue';
|
||||||
|
import BaseButton from '../components/primitives/BaseButton.vue';
|
||||||
|
import AISuggestedField from '../components/business-composites/AISuggestedField.vue';
|
||||||
|
import { validateAIFormulaGuard, type AIRiskLevel, type AIDecisionLog } from '../shared/ai/aiGovernance';
|
||||||
|
|
||||||
|
const customerCategory = ref('일반 거래처');
|
||||||
|
|
||||||
|
// Decision Logs Stream
|
||||||
|
const decisionLogs = ref<AIDecisionLog[]>([]);
|
||||||
|
|
||||||
|
const recordDecision = (suggestionId: string, fieldPath: string, riskLevel: AIRiskLevel, decision: 'ACCEPTED' | 'MODIFIED' | 'REJECTED', finalVal: unknown) => {
|
||||||
|
decisionLogs.value.unshift({
|
||||||
|
suggestionId,
|
||||||
|
fieldPath,
|
||||||
|
riskLevel,
|
||||||
|
userDecision: decision,
|
||||||
|
finalValue: finalVal,
|
||||||
|
timestamp: new Date().toLocaleTimeString(),
|
||||||
|
userId: 'USER-ADMIN-01'
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// Formula Guard Test
|
||||||
|
const formulaGuardMessage = ref<string | null>(null);
|
||||||
|
|
||||||
|
const testFormulaGuard = () => {
|
||||||
|
const result = validateAIFormulaGuard('header.totalAmount', true);
|
||||||
|
if (!result.isPermitted) {
|
||||||
|
formulaGuardMessage.value = result.errorReason || '차단됨';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="ai-ax-governance-container flex flex-col gap-4 p-6 bg-slate-50 min-h-full select-none text-left">
|
||||||
|
<!-- Header -->
|
||||||
|
<div class="flex justify-between items-center bg-white p-4 rounded-lg shadow-sm border border-slate-200">
|
||||||
|
<div>
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<BaseStatusBadge variant="info" label="Phase 9" />
|
||||||
|
<h1 class="text-xl font-bold text-slate-800">AI · AX 고도화 및 홀루시네이션 방지 거버넌스</h1>
|
||||||
|
</div>
|
||||||
|
<p class="text-xs text-slate-500 mt-1">AX-01 ~ 04: R0~R4 위험등급 통제, AISuggestedField 연동, 결정론적 수식 AI 위임 차단 가드</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- R0 ~ R4 Risk Policy Grid -->
|
||||||
|
<div class="bg-white p-6 rounded-lg shadow-sm border border-slate-200 flex flex-col gap-3">
|
||||||
|
<h2 class="text-base font-bold text-slate-800">1. AI R0 ~ R4 위험 등급 통제 정책 명세</h2>
|
||||||
|
<div class="grid grid-cols-1 md:grid-cols-5 gap-3 text-xs">
|
||||||
|
<div class="p-3 bg-slate-50 border rounded-lg flex flex-col gap-1">
|
||||||
|
<BaseStatusBadge variant="info" label="R0" />
|
||||||
|
<div class="font-bold mt-1">조회 · 요약</div>
|
||||||
|
<div class="text-slate-500">자동 허용 (위험 없음)</div>
|
||||||
|
</div>
|
||||||
|
<div class="p-3 bg-blue-50 border border-blue-200 rounded-lg flex flex-col gap-1">
|
||||||
|
<BaseStatusBadge variant="info" label="R1" />
|
||||||
|
<div class="font-bold mt-1 text-blue-900">필드 추천</div>
|
||||||
|
<div class="text-blue-700">사용자 확인 후 적용</div>
|
||||||
|
</div>
|
||||||
|
<div class="p-3 bg-amber-50 border border-amber-200 rounded-lg flex flex-col gap-1">
|
||||||
|
<BaseStatusBadge variant="warning" label="R2" />
|
||||||
|
<div class="font-bold mt-1 text-amber-900">가역적 변경</div>
|
||||||
|
<div class="text-amber-700">초안 확인 후 실행</div>
|
||||||
|
</div>
|
||||||
|
<div class="p-3 bg-rose-50 border border-rose-200 rounded-lg flex flex-col gap-1">
|
||||||
|
<BaseStatusBadge variant="danger" label="R3" />
|
||||||
|
<div class="font-bold mt-1 text-rose-900">출고 · 금액</div>
|
||||||
|
<div class="text-rose-700">명시적 승인 필수</div>
|
||||||
|
</div>
|
||||||
|
<div class="p-3 bg-slate-900 text-white rounded-lg flex flex-col gap-1">
|
||||||
|
<BaseStatusBadge variant="neutral" label="R4" />
|
||||||
|
<div class="font-bold mt-1">회계확정 · 대량삭제</div>
|
||||||
|
<div class="text-slate-300">AI 직접 실행 금지</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- AI Field Suggestion & Formula Guard Demo -->
|
||||||
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||||
|
<!-- AI Field Demo -->
|
||||||
|
<div class="bg-white p-6 rounded-lg shadow-sm border border-slate-200 flex flex-col gap-4">
|
||||||
|
<h2 class="text-base font-bold text-slate-800">2. AISuggestedField 컴포넌트 실증 (R1 위험도)</h2>
|
||||||
|
<AISuggestedField
|
||||||
|
v-model="customerCategory"
|
||||||
|
label="거래처 등급 분류"
|
||||||
|
suggested-value="우수 거래처 (VIP)"
|
||||||
|
confidence="94%"
|
||||||
|
rationale="최근 6개월 누적 수주 금액 1억 원 초과 및 결제 지연 0건"
|
||||||
|
@accept="recordDecision('SUG-01', 'customerCategory', 'R1', 'ACCEPTED', '우수 거래처 (VIP)')"
|
||||||
|
@reject="recordDecision('SUG-01', 'customerCategory', 'R1', 'REJECTED', customerCategory)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Formula Guard Demo -->
|
||||||
|
<div class="bg-white p-6 rounded-lg shadow-sm border border-slate-200 flex flex-col gap-4">
|
||||||
|
<h2 class="text-base font-bold text-slate-800">3. 결정론적 수식 AI 위임 차단 가드</h2>
|
||||||
|
<p class="text-xs text-slate-500">금액(Amount = Qty * Price)과 같은 결정론 수식은 AI의 임의 수식 변경을 원천 차단합니다.</p>
|
||||||
|
<BaseButton variant="danger" @click="testFormulaGuard">
|
||||||
|
🚨 산술 금액 필드 AI 위임 시도 (가드 테스트)
|
||||||
|
</BaseButton>
|
||||||
|
|
||||||
|
<div v-if="formulaGuardMessage" class="p-3 bg-rose-50 border border-rose-200 text-rose-800 text-xs font-bold rounded">
|
||||||
|
{{ formulaGuardMessage }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Decision Audit Logs -->
|
||||||
|
<div v-if="decisionLogs.length > 0" class="bg-white p-4 rounded-lg shadow-sm border border-slate-200">
|
||||||
|
<h3 class="text-xs font-bold text-slate-700 mb-2">AI 추천 수락 / 거절 감사 로그 (Audit Log)</h3>
|
||||||
|
<div class="border rounded overflow-hidden text-xs">
|
||||||
|
<table class="w-full text-left">
|
||||||
|
<thead class="bg-slate-100 font-semibold text-slate-700">
|
||||||
|
<tr>
|
||||||
|
<th class="p-2 border-b">시각</th>
|
||||||
|
<th class="p-2 border-b">필드명</th>
|
||||||
|
<th class="p-2 border-b">위험도</th>
|
||||||
|
<th class="p-2 border-b">사용자 결정</th>
|
||||||
|
<th class="p-2 border-b">최종 적용값</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr v-for="(log, idx) in decisionLogs" :key="idx" class="border-b">
|
||||||
|
<td class="p-2 font-mono">{{ log.timestamp }}</td>
|
||||||
|
<td class="p-2 font-bold">{{ log.fieldPath }}</td>
|
||||||
|
<td class="p-2"><BaseStatusBadge variant="info" :label="log.riskLevel" /></td>
|
||||||
|
<td class="p-2 font-bold" :class="log.userDecision === 'ACCEPTED' ? 'text-emerald-600' : 'text-rose-600'">
|
||||||
|
{{ log.userDecision }}
|
||||||
|
</td>
|
||||||
|
<td class="p-2 font-medium">{{ String(log.finalValue) }}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -1,302 +1,141 @@
|
|||||||
<!-- ComponentShowcaseView.vue: 35개 컴포넌트 파일 전수 100% 독립 렌더링 쇼케이스 -->
|
<!-- ComponentShowcaseView.vue -->
|
||||||
<template>
|
|
||||||
<div class="component-showcase-container p-6 bg-slate-100 min-h-full overflow-y-auto flex flex-col gap-6 select-none">
|
|
||||||
<!-- Showcase Header -->
|
|
||||||
<div class="bg-white p-5 rounded-lg border border-slate-300 shadow-sm flex justify-between items-center">
|
|
||||||
<div>
|
|
||||||
<h2 class="text-xl font-extrabold text-slate-900 flex items-center gap-2">
|
|
||||||
<span>🧩 OMS·WMS·ERP 35개 UI 컴포넌트 파일 전수 100% 완전 쇼케이스</span>
|
|
||||||
<span class="px-2.5 py-0.5 rounded bg-emerald-100 text-emerald-800 text-xs font-bold font-mono">35/35 전수 활성화</span>
|
|
||||||
</h2>
|
|
||||||
<p class="text-xs text-slate-500 mt-1">`src/frontend/src/components/` 하위의 모든 `.vue` 컴포넌트 파일(35개)이 단 1개도 빠짐없이 독립적인 시연 카드로 배치되어 있습니다.</p>
|
|
||||||
</div>
|
|
||||||
<div class="text-xs font-mono bg-slate-50 border border-slate-200 px-3 py-2 rounded text-slate-700 font-bold">
|
|
||||||
Inventory Coverage: <span class="text-emerald-700 font-bold">35 Vue Files (100%)</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Group 1: 4-Layer Business & Typed Input Components (14종 전수) -->
|
|
||||||
<div class="bg-white p-5 rounded-lg border border-slate-300 shadow-sm flex flex-col gap-4">
|
|
||||||
<h3 class="text-sm font-bold text-slate-900 pb-2 border-b border-slate-200 flex items-center gap-2">
|
|
||||||
<span class="px-2 py-0.5 rounded bg-blue-700 text-white font-mono text-xs font-bold">Layer 1 ~ 4</span>
|
|
||||||
<span>4계층 입력 컴포넌트 14종 전수 (Primitives / Typed / Domain / Business Composites)</span>
|
|
||||||
</h3>
|
|
||||||
|
|
||||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
|
||||||
<div class="p-3 bg-slate-50 rounded border flex flex-col gap-1">
|
|
||||||
<span class="text-xs font-bold text-slate-800">1. TextInput (원자 인풋)</span>
|
|
||||||
<TextInput v-model="primitiveText" placeholder="1-Click 삭제" />
|
|
||||||
</div>
|
|
||||||
<div class="p-3 bg-slate-50 rounded border flex flex-col gap-1">
|
|
||||||
<span class="text-xs font-bold text-slate-800">2. SelectInput (드롭다운)</span>
|
|
||||||
<SelectInput v-model="primitiveSelect" :options="['옵션 1', '옵션 2']" />
|
|
||||||
</div>
|
|
||||||
<div class="p-3 bg-slate-50 rounded border flex flex-col gap-1">
|
|
||||||
<span class="text-xs font-bold text-slate-800">3. DialogModal (ERP 다이얼로그)</span>
|
|
||||||
<button type="button" class="h-9 px-3 bg-slate-800 text-white font-bold text-xs rounded" @click="showModal = true">다이얼로그 열기</button>
|
|
||||||
<DialogModal :isOpen="showModal" title="표준 확인 다이얼로그" @close="showModal = false" @confirm="showModal = false">
|
|
||||||
<p class="text-xs text-slate-700">더존 ERP 스타일 표준 확인 다이얼로그입니다.</p>
|
|
||||||
</DialogModal>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="grid grid-cols-1 md:grid-cols-4 gap-4">
|
|
||||||
<div class="p-3 bg-slate-50 rounded border"><StringField label="4. StringField" v-model="typedString" required /></div>
|
|
||||||
<div class="p-3 bg-slate-50 rounded border"><NumberField label="5. NumberField" v-model="typedNumber" required /></div>
|
|
||||||
<div class="p-3 bg-slate-50 rounded border"><DateField label="6. DateField" v-model="typedDate" showTodayBtn required /></div>
|
|
||||||
<div class="p-3 bg-slate-50 rounded border"><CodeField label="7. CodeField (300ms 검증)" v-model="typedCode" required /></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="grid grid-cols-1 md:grid-cols-4 gap-4">
|
|
||||||
<div class="p-3 bg-slate-50 rounded border"><QuantityField label="8. QuantityField" v-model:amount="domainQty" v-model:unitCode="domainUnit" :availableStock="5000" required /></div>
|
|
||||||
<div class="p-3 bg-slate-50 rounded border"><MoneyField label="9. MoneyField" v-model:amount="domainMoney" v-model:currencyCode="domainCurrency" required /></div>
|
|
||||||
<div class="p-3 bg-slate-50 rounded border"><BarcodeInput label="10. BarcodeInput (스캐너)" v-model="domainBarcode" required /></div>
|
|
||||||
<div class="p-3 bg-slate-50 rounded border"><LotField lotNumber="LOT-20260725-01" expirationDate="2026-08-15" required /></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
||||||
<div class="p-3 bg-slate-50 rounded border flex flex-col gap-3">
|
|
||||||
<AddressEditor label="12. AddressEditor (주소 입력기)" postalCode="06164" baseAddress="서울특별시 강남구 영동대로 517" detailAddress="아셈타워 32층" />
|
|
||||||
<AISuggestedField label="13. AISuggestedField (AI 추천)" v-model="aiValue" suggestedValue="추천 거래처: 삼성전자(주)" :confidenceScore="94" reasoning="과거 1년 출고 이력 기준 최빈 거래처 자동 매칭" />
|
|
||||||
</div>
|
|
||||||
<div class="p-3 bg-slate-50 rounded border">
|
|
||||||
<span class="text-xs font-bold text-slate-800 mb-1.5 block">14. OrderLineEditor (주문 라인 인라인 에디터 & VAT 10% 연산)</span>
|
|
||||||
<OrderLineEditor />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Group 2: Enterprise Grids & Toolbars (21종 최상위 및 서브) -->
|
|
||||||
<div class="bg-white p-5 rounded-lg border border-slate-300 shadow-sm flex flex-col gap-4">
|
|
||||||
<h3 class="text-sm font-bold text-slate-900 pb-2 border-b border-slate-200 flex items-center gap-2">
|
|
||||||
<span class="px-2 py-0.5 rounded bg-amber-500 text-slate-950 font-mono text-xs font-bold">Grids & Toolbars</span>
|
|
||||||
<span>15. QuantDataGrid / 16. QuantMasterGrid / 17. QuantSearchHeaderBar / 18. CrudToolbar / 19. GridHeaderToolbar / 20. LiveTelemetryFooter / 21. AuditTimeline</span>
|
|
||||||
</h3>
|
|
||||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
||||||
<div class="flex flex-col gap-1.5 p-3 bg-slate-50 rounded border">
|
|
||||||
<span class="text-xs font-bold text-slate-800">15. QuantDataGrid (AG Grid 대량 가상화)</span>
|
|
||||||
<QuantDataGrid :rowData="showcaseRowData" :columnDefs="showcaseColumnDefs" :height="180" />
|
|
||||||
</div>
|
|
||||||
<div class="flex flex-col gap-1.5 p-3 bg-slate-50 rounded border">
|
|
||||||
<span class="text-xs font-bold text-slate-800">16. QuantMasterGrid (마스터-디테일 테이블)</span>
|
|
||||||
<QuantMasterGrid title="주문 마스터" :headers="masterGridHeaders" :items="showcaseRowData" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="p-3 bg-slate-50 rounded border flex flex-col gap-2">
|
|
||||||
<span class="text-xs font-bold text-slate-800">17. QuantGridAdapter (통합 PrimeVue 그리드 어댑터: 검색, 정렬, 엑셀 내보내기 내장)</span>
|
|
||||||
<QuantGridAdapter
|
|
||||||
title="OMS 주문 실시간 목록"
|
|
||||||
:columns="[
|
|
||||||
{ key: 'orderNo', label: '주문번호', width: '140px' },
|
|
||||||
{ key: 'customerName', label: '거래처명' },
|
|
||||||
{ key: 'amount', label: '금액', width: '130px', type: 'currency', align: 'right' },
|
|
||||||
{ key: 'orderDate', label: '주문일자', width: '110px', align: 'center' }
|
|
||||||
]"
|
|
||||||
:items="showcaseRowData"
|
|
||||||
selectionMode="multiple"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="p-3 bg-slate-50 rounded border">
|
|
||||||
<span class="text-xs font-bold text-slate-800 mb-1 block">17. QuantSearchHeaderBar</span>
|
|
||||||
<QuantSearchHeaderBar v-model:searchQuery="showcaseSearch" v-model:selectedStatus="showcaseStatus" :statusOptions="['전체', '승인완료', '검토중']" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="p-3 bg-slate-50 rounded border">
|
|
||||||
<span class="text-xs font-bold text-slate-800 mb-1 block">18. CrudToolbar & 19. GridHeaderToolbar</span>
|
|
||||||
<CrudToolbar title="OMS 주문 관리" :isNewMode="false" class="mb-2" />
|
|
||||||
<GridHeaderToolbar title="주문 내역 가상화 그리드" :totalCount="1285" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
||||||
<div class="p-3 bg-slate-50 rounded border">
|
|
||||||
<span class="text-xs font-bold text-slate-800 mb-1 block">20. LiveTelemetryFooter (실시간 관제)</span>
|
|
||||||
<LiveTelemetryFooter />
|
|
||||||
</div>
|
|
||||||
<div class="p-3 bg-slate-50 rounded border">
|
|
||||||
<span class="text-xs font-bold text-slate-800 mb-1 block">21. AuditTimeline (감사 타임라인)</span>
|
|
||||||
<AuditTimeline :logs="showcaseAuditLogs" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Group 3: Layouts & Modals & Base Elements -->
|
|
||||||
<div class="bg-white p-5 rounded-lg border border-slate-300 shadow-sm flex flex-col gap-4">
|
|
||||||
<h3 class="text-sm font-bold text-slate-900 pb-2 border-b border-slate-200 flex items-center gap-2">
|
|
||||||
<span class="px-2 py-0.5 rounded bg-purple-600 text-white font-mono text-xs font-bold">Layouts & Base Inputs</span>
|
|
||||||
<span>22 ~ 35. Layout, Chips, Modals, Forms & Base Elements</span>
|
|
||||||
</h3>
|
|
||||||
|
|
||||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
||||||
<div class="p-3 bg-slate-50 rounded border">
|
|
||||||
<span class="text-xs font-bold text-slate-800 mb-1 block">22. QuantTabPanel</span>
|
|
||||||
<QuantTabPanel :tabs="['기본 정보', '상세 이력']">
|
|
||||||
<template #tab-0><p class="text-xs text-slate-700 p-2">기본 주문 정보 패널입니다.</p></template>
|
|
||||||
<template #tab-1><p class="text-xs text-slate-700 p-2">상세 Audit 이력 패널입니다.</p></template>
|
|
||||||
</QuantTabPanel>
|
|
||||||
</div>
|
|
||||||
<div class="p-3 bg-slate-50 rounded border">
|
|
||||||
<span class="text-xs font-bold text-slate-800 mb-1 block">23. QuantSplitter</span>
|
|
||||||
<QuantSplitter leftWidth="40%" class="h-28 border rounded bg-white p-2">
|
|
||||||
<template #left><div class="text-xs p-2 bg-blue-50 h-full rounded text-blue-900 font-bold">좌측 40%</div></template>
|
|
||||||
<template #right><div class="text-xs p-2 bg-emerald-50 h-full rounded text-emerald-900 font-bold">우측 60%</div></template>
|
|
||||||
</QuantSplitter>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex items-center gap-6 p-3 bg-slate-50 rounded border">
|
|
||||||
<div class="flex items-center gap-2"><span class="text-xs font-bold text-slate-700">24. QuantStatusChip:</span><QuantStatusChip status="APPROVED" text="승인완료" /></div>
|
|
||||||
<div class="flex items-center gap-2"><span class="text-xs font-bold text-slate-700">25. ReturnChip:</span><ReturnChip :value="12.4" /></div>
|
|
||||||
<div class="flex items-center gap-2"><span class="text-xs font-bold text-slate-700">26. TickerBadge:</span><TickerBadge ticker="005930" name="삼성전자" /></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex gap-3">
|
|
||||||
<button type="button" class="px-3 py-1.5 bg-blue-600 text-white text-xs font-bold rounded shadow-xs" @click="showFormModal = true">27. QuantFormModal 열기</button>
|
|
||||||
<button type="button" class="px-3 py-1.5 bg-slate-800 text-amber-300 text-xs font-bold rounded shadow-xs" @click="showLookupModal = true">28. QuantLookupModal 열기</button>
|
|
||||||
<button type="button" class="px-3 py-1.5 bg-rose-600 text-white text-xs font-bold rounded shadow-xs" @click="showDeleteModal = true">29. QuantDeleteModal 열기</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<QuantFormModal :isOpen="showFormModal" title="주문 등록" @close="showFormModal = false" @save="showFormModal = false"><QuantInput label="주문번호" v-model="typedString" /></QuantFormModal>
|
|
||||||
<QuantLookupModal :isOpen="showLookupModal" title="Lookup 팝업" @close="showLookupModal = false" @select="showLookupModal = false" />
|
|
||||||
<QuantDeleteModal :isOpen="showDeleteModal" targetName="ORD-20260725-01" @close="showDeleteModal = false" @confirm="showDeleteModal = false" />
|
|
||||||
|
|
||||||
<div class="p-3 bg-slate-50 rounded border">
|
|
||||||
<span class="text-xs font-bold text-slate-800 mb-1.5 block">30. QuantCrudForm (CRUD 표준 폼)</span>
|
|
||||||
<QuantCrudForm title="주문 수기 생성 폼" :fields="showcaseCrudFields" v-model="crudFormModel" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="grid grid-cols-1 md:grid-cols-5 gap-3">
|
|
||||||
<div class="p-2.5 bg-slate-50 rounded border flex flex-col gap-1"><span class="text-[11px] font-bold text-slate-800">31. QuantAutoComplete</span><QuantAutoComplete v-model="autoCompleteVal" :suggestions="['삼성전자(주)']" placeholder="검색" /></div>
|
|
||||||
<div class="p-2.5 bg-slate-50 rounded border flex flex-col gap-1"><span class="text-[11px] font-bold text-slate-800">32. QuantComboBox</span><QuantComboBox v-model="comboBoxVal" :options="['선급금']" placeholder="선택" /></div>
|
|
||||||
<div class="p-2.5 bg-slate-50 rounded border flex flex-col gap-1"><QuantLabel text="33. QuantLabel & Input" required /><QuantInput v-model="baseInputVal" /></div>
|
|
||||||
<div class="p-2.5 bg-slate-50 rounded border flex flex-col gap-1"><QuantLabel text="34. QuantDatePicker" /><QuantDatePicker v-model="typedDate" /></div>
|
|
||||||
<div class="p-2.5 bg-slate-50 rounded border flex flex-col gap-1"><QuantLabel text="35. QuantTextArea" /><QuantTextArea v-model="textAreaVal" /></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
|
import BaseInput from '../components/primitives/BaseInput.vue';
|
||||||
// Layer 1 Primitives
|
import BaseSelect from '../components/primitives/BaseSelect.vue';
|
||||||
import TextInput from '../components/primitives/TextInput.vue';
|
import BaseCheckbox from '../components/primitives/BaseCheckbox.vue';
|
||||||
import SelectInput from '../components/primitives/SelectInput.vue';
|
import BaseButton from '../components/primitives/BaseButton.vue';
|
||||||
import DialogModal from '../components/primitives/DialogModal.vue';
|
import BaseStatusBadge from '../components/primitives/BaseStatusBadge.vue';
|
||||||
|
import BaseDialog from '../components/primitives/BaseDialog.vue';
|
||||||
// Layer 2 Typed
|
import TextField from '../components/fields/TextField.vue';
|
||||||
import StringField from '../components/fields/StringField.vue';
|
|
||||||
import NumberField from '../components/fields/NumberField.vue';
|
|
||||||
import DateField from '../components/fields/DateField.vue';
|
|
||||||
import CodeField from '../components/fields/CodeField.vue';
|
import CodeField from '../components/fields/CodeField.vue';
|
||||||
|
import DecimalField from '../components/fields/DecimalField.vue';
|
||||||
// Layer 3 Domain
|
import DateField from '../components/fields/DateField.vue';
|
||||||
import QuantityField from '../components/domain-fields/QuantityField.vue';
|
import QuantityField from '../components/domain-fields/QuantityField.vue';
|
||||||
import MoneyField from '../components/domain-fields/MoneyField.vue';
|
import MoneyField from '../components/domain-fields/MoneyField.vue';
|
||||||
import BarcodeInput from '../components/domain-fields/BarcodeInput.vue';
|
|
||||||
import LotField from '../components/domain-fields/LotField.vue';
|
import LotField from '../components/domain-fields/LotField.vue';
|
||||||
|
import ReferenceLookup from '../components/domain-fields/ReferenceLookup.vue';
|
||||||
// Layer 4 Composites
|
import BarcodeInput from '../components/domain-fields/BarcodeInput.vue';
|
||||||
import AddressEditor from '../components/business-composites/AddressEditor.vue';
|
|
||||||
import AISuggestedField from '../components/business-composites/AISuggestedField.vue';
|
import AISuggestedField from '../components/business-composites/AISuggestedField.vue';
|
||||||
import OrderLineEditor from '../components/business-composites/OrderLineEditor.vue';
|
import AddressEditor from '../components/business-composites/AddressEditor.vue';
|
||||||
|
import InventoryAllocationEditor from '../components/business-composites/InventoryAllocationEditor.vue';
|
||||||
|
|
||||||
// Submodules (CRUD & Grid)
|
// Primitive State
|
||||||
import CrudToolbar from '../components/crud/CrudToolbar.vue';
|
const sampleInput = ref('표준 입력 텍스트');
|
||||||
import AuditTimeline from '../components/crud/AuditTimeline.vue';
|
const sampleSelect = ref('OPT2');
|
||||||
import LiveTelemetryFooter from '../components/crud/LiveTelemetryFooter.vue';
|
const sampleCheck = ref(true);
|
||||||
import GridHeaderToolbar from '../components/grid/GridHeaderToolbar.vue';
|
const isDialogOpen = ref(false);
|
||||||
import ReturnChip from '../components/grid/ReturnChip.vue';
|
|
||||||
import TickerBadge from '../components/grid/TickerBadge.vue';
|
|
||||||
|
|
||||||
// Core Layout & Grids & Modals
|
// Typed Field State
|
||||||
import QuantDataGrid from '../components/QuantDataGrid.vue';
|
const sampleCode = ref('item-2026-xyz');
|
||||||
import QuantMasterGrid from '../components/QuantMasterGrid.vue';
|
const sampleDecimal = ref('1254000');
|
||||||
import QuantSearchHeaderBar from '../components/QuantSearchHeaderBar.vue';
|
const sampleDate = ref('2026-07-26');
|
||||||
import QuantStatusChip from '../components/QuantStatusChip.vue';
|
|
||||||
import QuantTabPanel from '../components/QuantTabPanel.vue';
|
|
||||||
import QuantSplitter from '../components/QuantSplitter.vue';
|
|
||||||
import QuantGridAdapter from '../components/QuantGridAdapter.vue';
|
|
||||||
|
|
||||||
import QuantFormModal from '../components/QuantFormModal.vue';
|
// Domain Field State
|
||||||
import QuantLookupModal from '../components/QuantLookupModal.vue';
|
const sampleQty = ref('250');
|
||||||
import QuantDeleteModal from '../components/QuantDeleteModal.vue';
|
const sampleMoney = ref('15000000');
|
||||||
import QuantCrudForm from '../components/QuantCrudForm.vue';
|
const sampleLot = ref('LOT-20260726-09');
|
||||||
import QuantAutoComplete from '../components/QuantAutoComplete.vue';
|
const sampleLookup = ref('CUST-001');
|
||||||
import QuantComboBox from '../components/QuantComboBox.vue';
|
|
||||||
import QuantInput from '../components/QuantInput.vue';
|
|
||||||
import QuantLabel from '../components/QuantLabel.vue';
|
|
||||||
import QuantCheckBox from '../components/QuantCheckBox.vue';
|
|
||||||
import QuantRadio from '../components/QuantRadio.vue';
|
|
||||||
import QuantTextArea from '../components/QuantTextArea.vue';
|
|
||||||
import QuantDatePicker from '../components/QuantDatePicker.vue';
|
|
||||||
|
|
||||||
const showcaseSearch = ref('');
|
// AI State
|
||||||
const showcaseStatus = ref('전체');
|
const aiFieldVal = ref('일반 배송');
|
||||||
const autoCompleteVal = ref('');
|
|
||||||
const comboBoxVal = ref('');
|
|
||||||
const aiValue = ref('');
|
|
||||||
|
|
||||||
const primitiveText = ref('테스트 데이터');
|
|
||||||
const primitiveSelect = ref('옵션 1');
|
|
||||||
const showModal = ref(false);
|
|
||||||
|
|
||||||
const showFormModal = ref(false);
|
|
||||||
const showLookupModal = ref(false);
|
|
||||||
const showDeleteModal = ref(false);
|
|
||||||
|
|
||||||
const baseInputVal = ref('기본 값');
|
|
||||||
const checkBoxChecked = ref(true);
|
|
||||||
const radioSelected = ref('OPT1');
|
|
||||||
const textAreaVal = ref('적요 메모');
|
|
||||||
|
|
||||||
const typedString = ref('ORD-2026-9901');
|
|
||||||
const typedNumber = ref(1500000);
|
|
||||||
const typedDate = ref('2026-07-26');
|
|
||||||
const typedCode = ref('CUST-001');
|
|
||||||
|
|
||||||
const domainQty = ref(120);
|
|
||||||
const domainUnit = ref('EA');
|
|
||||||
const domainMoney = ref('2500000');
|
|
||||||
const domainCurrency = ref('KRW');
|
|
||||||
const domainBarcode = ref('8801234567890');
|
|
||||||
|
|
||||||
const crudFormModel = ref({
|
|
||||||
orderNo: 'ORD-20260726-001',
|
|
||||||
customerName: '삼성전자(주)',
|
|
||||||
orderDate: '2026-07-26'
|
|
||||||
});
|
|
||||||
|
|
||||||
const showcaseCrudFields = ref([
|
|
||||||
{ key: 'orderNo', label: '주문번호', type: 'text' as const, required: true },
|
|
||||||
{ key: 'customerName', label: '거래처명', type: 'text' as const, required: true },
|
|
||||||
{ key: 'orderDate', label: '주문일자', type: 'date' as const }
|
|
||||||
]);
|
|
||||||
|
|
||||||
const masterGridHeaders = ref([
|
|
||||||
{ key: 'orderNo', label: '주문번호', width: '130px' },
|
|
||||||
{ key: 'customerName', label: '거래처명' },
|
|
||||||
{ key: 'orderDate', label: '주문일자', width: '110px', align: 'center' as const },
|
|
||||||
{ key: 'status', label: '상태', width: '90px', align: 'center' as const }
|
|
||||||
]);
|
|
||||||
|
|
||||||
const showcaseColumnDefs = ref([
|
|
||||||
{ field: 'orderNo', headerName: '주문번호', width: 140 },
|
|
||||||
{ field: 'customerName', headerName: '거래처명', width: 180 },
|
|
||||||
{ field: 'orderDate', headerName: '주문일자', width: 120 },
|
|
||||||
{ field: 'amount', headerName: '금액(KRW)', width: 150, valueFormatter: (p: any) => p.value?.toLocaleString() },
|
|
||||||
{ field: 'status', headerName: '상태', width: 110 }
|
|
||||||
]);
|
|
||||||
|
|
||||||
const showcaseRowData = ref([
|
|
||||||
{ orderNo: 'ORD-20260725-01', customerName: '삼성전자(주)', orderDate: '2026-07-25', amount: 141000000, status: '승인완료' },
|
|
||||||
{ orderNo: 'ORD-20260725-02', customerName: 'SK하이닉스(주)', orderDate: '2026-07-25', amount: 127500000, status: '검토대기' },
|
|
||||||
{ orderNo: 'ORD-20260725-03', customerName: 'LG에너지솔루션', orderDate: '2026-07-26', amount: 89000000, status: '출하주의' }
|
|
||||||
]);
|
|
||||||
|
|
||||||
const showcaseAuditLogs = ref([
|
|
||||||
{ timestamp: '2026-07-26 10:15:30', user: 'admin', action: '주문생성', fieldName: 'orderNo', oldValue: '-', newValue: 'ORD-20260725-01' },
|
|
||||||
{ timestamp: '2026-07-26 10:18:45', user: 'checker', action: '승인완료', fieldName: 'status', oldValue: 'PENDING', newValue: 'APPROVED' }
|
|
||||||
]);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="component-showcase flex flex-col gap-6 p-6 bg-slate-50 min-h-full select-none text-left">
|
||||||
|
<!-- Header -->
|
||||||
|
<div class="flex justify-between items-center bg-white p-4 rounded-lg shadow-sm border border-slate-200">
|
||||||
|
<div>
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<BaseStatusBadge variant="success" label="4-Layer Architecture" />
|
||||||
|
<h1 class="text-xl font-bold text-slate-800">OMS · WMS · ERP 4계층 입력 컴포넌트 카탈로그 쇼케이스</h1>
|
||||||
|
</div>
|
||||||
|
<p class="text-xs text-slate-500 mt-1">
|
||||||
|
명세 지침 (`docs/ENTERPRISE_CRUD_DESIGN_SPECIFICATION.md`) 4계층 컴포넌트 체계 실증
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- LAYER 1: PRIMITIVES -->
|
||||||
|
<div class="bg-white p-6 rounded-lg shadow-sm border border-slate-200 flex flex-col gap-4">
|
||||||
|
<div class="flex items-center gap-2 border-b pb-2">
|
||||||
|
<BaseStatusBadge variant="info" label="Layer 1" />
|
||||||
|
<h2 class="text-base font-bold text-slate-800">Primitives (시각/상호작용 무지 컴포넌트)</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="grid grid-cols-1 md:grid-cols-4 gap-4 items-end">
|
||||||
|
<BaseInput v-model="sampleInput" label="L1 BaseInput (Touch Density)" density="touch" />
|
||||||
|
<BaseSelect
|
||||||
|
v-model="sampleSelect"
|
||||||
|
label="L1 BaseSelect"
|
||||||
|
:options="[{ value: 'OPT1', label: '옵션 1' }, { value: 'OPT2', label: '옵션 2' }]"
|
||||||
|
/>
|
||||||
|
<div class="pb-2">
|
||||||
|
<BaseCheckbox v-model="sampleCheck" label="L1 BaseCheckbox 선택됨" />
|
||||||
|
</div>
|
||||||
|
<div class="flex gap-2">
|
||||||
|
<BaseButton variant="primary" @click="isDialogOpen = true">L1 BaseDialog 열기</BaseButton>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- LAYER 2: TYPED FIELDS -->
|
||||||
|
<div class="bg-white p-6 rounded-lg shadow-sm border border-slate-200 flex flex-col gap-4">
|
||||||
|
<div class="flex items-center gap-2 border-b pb-2">
|
||||||
|
<BaseStatusBadge variant="info" label="Layer 2" />
|
||||||
|
<h2 class="text-base font-bold text-slate-800">Typed Fields (데이터 타입 이해 컴포넌트)</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="grid grid-cols-1 md:grid-cols-4 gap-4">
|
||||||
|
<CodeField v-model="sampleCode" label="L2 CodeField (대문자 정규화)" />
|
||||||
|
<DecimalField v-model="sampleDecimal" label="L2 DecimalField (부동소수점 오차 0)" />
|
||||||
|
<DateField v-model="sampleDate" label="L2 DateField (ISO YYYY-MM-DD)" />
|
||||||
|
<TextField label="L2 TextField (오류 예시)" :field-state="{ value: '오류값', initialValue: '초기값', status: 'invalid', source: 'user', touched: true, dirty: true, required: true, errors: [{ code: 'REQ', message: '입력 필수 항목입니다', severity: 'error', blocking: true }], warnings: [], information: [] }" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- LAYER 3: DOMAIN FIELDS -->
|
||||||
|
<div class="bg-white p-6 rounded-lg shadow-sm border border-slate-200 flex flex-col gap-4">
|
||||||
|
<div class="flex items-center gap-2 border-b pb-2">
|
||||||
|
<BaseStatusBadge variant="warning" label="Layer 3" />
|
||||||
|
<h2 class="text-base font-bold text-slate-800">Domain Fields (업무 도메인 이해 컴포넌트)</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="grid grid-cols-1 md:grid-cols-4 gap-4">
|
||||||
|
<QuantityField v-model="sampleQty" label="L3 QuantityField" uom="BOX" :max-available-qty="500" />
|
||||||
|
<MoneyField v-model="sampleMoney" label="L3 MoneyField" currency="KRW" />
|
||||||
|
<LotField v-model="sampleLot" label="L3 LotField (FEFO 권장)" />
|
||||||
|
<ReferenceLookup v-model="sampleLookup" label="L3 ReferenceLookup (300ms Debounce)" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- LAYER 4: BUSINESS COMPOSITES -->
|
||||||
|
<div class="bg-white p-6 rounded-lg shadow-sm border border-slate-200 flex flex-col gap-4">
|
||||||
|
<div class="flex items-center gap-2 border-b pb-2">
|
||||||
|
<BaseStatusBadge variant="danger" label="Layer 4" />
|
||||||
|
<h2 class="text-base font-bold text-slate-800">Business Composites (복합 업무 규칙 컴포넌트)</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||||
|
<BarcodeInput />
|
||||||
|
<AISuggestedField
|
||||||
|
v-model="aiFieldVal"
|
||||||
|
label="L4 AISuggestedField (R1 위험도)"
|
||||||
|
suggested-value="긴급 당일 배송 (AI 추천)"
|
||||||
|
confidence="98%"
|
||||||
|
rationale="과거 주문 패턴 분석 결과 당일 배송 선호도 높음"
|
||||||
|
/>
|
||||||
|
<AddressEditor />
|
||||||
|
<InventoryAllocationEditor />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Sample BaseDialog -->
|
||||||
|
<BaseDialog :is-open="isDialogOpen" title="L1 BaseDialog 테스트" @close="isDialogOpen = false">
|
||||||
|
<p class="text-sm text-slate-600">BaseDialog 모달이 정상 동작합니다. ESC 키 또는 X 버튼을 눌러 닫을 수 있습니다.</p>
|
||||||
|
<template #footer>
|
||||||
|
<BaseButton variant="secondary" @click="isDialogOpen = false">닫기</BaseButton>
|
||||||
|
</template>
|
||||||
|
</BaseDialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|||||||
@@ -1,13 +1,20 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
|
|
||||||
const activeTab = ref('kpi')
|
const activeTab = ref('menu')
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div style="display: flex; flex-direction: column; height: 100%;">
|
<div style="display: flex; flex-direction: column; height: 100%;">
|
||||||
<!-- Vue 3 Anti-Scroll Tab Navigation -->
|
<!-- Vue 3 Anti-Scroll Tab Navigation -->
|
||||||
<div style="background: #E2E8F0; padding: 6px 12px; display: flex; gap: 8px; border-bottom: 1px solid #CBD5E1;">
|
<div style="background: #E2E8F0; padding: 6px 12px; display: flex; gap: 8px; border-bottom: 1px solid #CBD5E1;">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
:style="{ backgroundColor: activeTab === 'menu' ? '#2C3E50' : '#FFFFFF', color: activeTab === 'menu' ? '#FFFFFF' : '#2C3E50' }"
|
||||||
|
style="padding: 6px 16px; border: 1px solid #CBD5E1; font-weight: bold; border-radius: 4px; cursor: pointer;"
|
||||||
|
@click="activeTab = 'menu'">
|
||||||
|
🏛️ 전체 메뉴 & 실증 화면 카탈로그
|
||||||
|
</button>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
:style="{ backgroundColor: activeTab === 'kpi' ? '#2C3E50' : '#FFFFFF', color: activeTab === 'kpi' ? '#FFFFFF' : '#2C3E50' }"
|
:style="{ backgroundColor: activeTab === 'kpi' ? '#2C3E50' : '#FFFFFF', color: activeTab === 'kpi' ? '#FFFFFF' : '#2C3E50' }"
|
||||||
@@ -31,6 +38,54 @@ const activeTab = ref('kpi')
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Tab Pane 0: Menu Catalog -->
|
||||||
|
<div v-if="activeTab === 'menu'" style="padding: 16px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto;">
|
||||||
|
<div style="background: #FFFFFF; padding: 16px; border-radius: 8px; border: 1px solid #CBD5E1;">
|
||||||
|
<h3 style="margin: 0 0 12px 0; font-size: 14px; color: #1E293B;">🚀 파일럿 및 핵심 실증 화면 바로가기</h3>
|
||||||
|
<div style="display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px;">
|
||||||
|
<router-link to="/oms/orders" style="display: block; padding: 12px; border: 1px solid #93C5FD; background: #EFF6FF; border-radius: 6px; text-decoration: none; color: #1E40AF;">
|
||||||
|
<div style="font-weight: bold; font-size: 13px;">📦 OMS 주문 수주 파일럿</div>
|
||||||
|
<div style="font-size: 11px; color: #3B82F6; margin-top: 4px;">OrderFormModel, 수주등록</div>
|
||||||
|
</router-link>
|
||||||
|
|
||||||
|
<router-link to="/wms/picking" style="display: block; padding: 12px; border: 1px solid #FCA5A5; background: #FEF2F2; border-radius: 6px; text-decoration: none; color: #991B1B;">
|
||||||
|
<div style="font-weight: bold; font-size: 13px;">🏭 WMS 피킹 파일럿</div>
|
||||||
|
<div style="font-size: 11px; color: #EF4444; margin-top: 4px;">Touch 44px, GS1 <100ms 파서</div>
|
||||||
|
</router-link>
|
||||||
|
|
||||||
|
<router-link to="/erp/journals" style="display: block; padding: 12px; border: 1px solid #FDE68A; background: #FFFBEB; border-radius: 6px; text-decoration: none; color: #92400E;">
|
||||||
|
<div style="font-weight: bold; font-size: 13px;">💰 ERP 회계 전표 파일럿</div>
|
||||||
|
<div style="font-size: 11px; color: #F59E0B; margin-top: 4px;">차대 균형, SoD 직무분리, 역분개</div>
|
||||||
|
</router-link>
|
||||||
|
|
||||||
|
<router-link to="/workflow/integrated" style="display: block; padding: 12px; border: 1px solid #DDD6FE; background: #F5F3FF; border-radius: 6px; text-decoration: none; color: #5B21B6;">
|
||||||
|
<div style="font-weight: bold; font-size: 13px;">🔄 통합 Workflow 관제</div>
|
||||||
|
<div style="font-size: 11px; color: #8B5CF6; margin-top: 4px;">Order-to-Cash 7단계 & 비동기 Job</div>
|
||||||
|
</router-link>
|
||||||
|
|
||||||
|
<router-link to="/ax/governance" style="display: block; padding: 12px; border: 1px solid #FBCFE8; background: #FDF2F8; border-radius: 6px; text-decoration: none; color: #9D174D;">
|
||||||
|
<div style="font-weight: bold; font-size: 13px;">🤖 AI·AX 거버넌스</div>
|
||||||
|
<div style="font-size: 11px; color: #EC4899; margin-top: 4px;">R0~R4 위험등급, 수식 차단 가드</div>
|
||||||
|
</router-link>
|
||||||
|
|
||||||
|
<router-link to="/migration/nfr" style="display: block; padding: 12px; border: 1px solid #BAE6FD; background: #F0F9FF; border-radius: 6px; text-decoration: none; color: #075985;">
|
||||||
|
<div style="font-weight: bold; font-size: 13px;">📊 NFR 관측성 & Strangler</div>
|
||||||
|
<div style="font-size: 11px; color: #0284C7; margin-top: 4px;">OWASP 보안, Reconciliation 대조</div>
|
||||||
|
</router-link>
|
||||||
|
|
||||||
|
<router-link to="/components" style="display: block; padding: 12px; border: 1px solid #A7F3D0; background: #ECFDF5; border-radius: 6px; text-decoration: none; color: #065F46;">
|
||||||
|
<div style="font-weight: bold; font-size: 13px;">🧩 4계층 입력 컴포넌트</div>
|
||||||
|
<div style="font-size: 11px; color: #10B981; margin-top: 4px;">L1 Primitives ~ L4 Composites</div>
|
||||||
|
</router-link>
|
||||||
|
|
||||||
|
<router-link to="/templates" style="display: block; padding: 12px; border: 1px solid #FDE68A; background: #FEF3C7; border-radius: 6px; text-decoration: none; color: #78350F;">
|
||||||
|
<div style="font-weight: bold; font-size: 13px;">🏛️ 11대 표준 템플릿 갤러리</div>
|
||||||
|
<div style="font-size: 11px; color: #D97706; margin-top: 4px;">TPL-LIST-01 ~ TPL-HISTORY-01</div>
|
||||||
|
</router-link>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Tab Pane 1: KPI -->
|
<!-- Tab Pane 1: KPI -->
|
||||||
<div v-if="activeTab === 'kpi'" style="padding: 16px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;">
|
<div v-if="activeTab === 'kpi'" style="padding: 16px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;">
|
||||||
<div style="background: #FFFFFF; padding: 20px; border-radius: 6px; border: 1px solid #CBD5E1; box-shadow: 0 2px 4px rgba(0,0,0,0.05);">
|
<div style="background: #FFFFFF; padding: 20px; border-radius: 6px; border: 1px solid #CBD5E1; box-shadow: 0 2px 4px rgba(0,0,0,0.05);">
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ const realQuantData = ref<Array<{ symbol: string; name: string; sector: string;
|
|||||||
<td style="padding: 6px; border: 1px solid #CBD5E1; font-weight: bold;">{{ item.name }}</td>
|
<td style="padding: 6px; border: 1px solid #CBD5E1; font-weight: bold;">{{ item.name }}</td>
|
||||||
<td style="padding: 6px; border: 1px solid #CBD5E1; font-family: monospace; font-size: 11px;">{{ item.source }}</td>
|
<td style="padding: 6px; border: 1px solid #CBD5E1; font-family: monospace; font-size: 11px;">{{ item.source }}</td>
|
||||||
<td style="padding: 6px; border: 1px solid #CBD5E1; text-align: center;">
|
<td style="padding: 6px; border: 1px solid #CBD5E1; text-align: center;">
|
||||||
<QuantStatusChip :type="item.status" />
|
<QuantStatusChip :type="item.status === 'PASS' ? 'success' : (item.status === 'LIMIT' ? 'warning' : 'danger')" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -0,0 +1,175 @@
|
|||||||
|
<!-- ErpJournalEntryView.vue -->
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, computed } from 'vue';
|
||||||
|
import BaseStatusBadge from '../components/primitives/BaseStatusBadge.vue';
|
||||||
|
import BaseButton from '../components/primitives/BaseButton.vue';
|
||||||
|
import BaseInput from '../components/primitives/BaseInput.vue';
|
||||||
|
import CodeField from '../components/fields/CodeField.vue';
|
||||||
|
import TextField from '../components/fields/TextField.vue';
|
||||||
|
import { makeUserId, makeDecimalString } from '../shared/types/coreModels';
|
||||||
|
import { validateSoDApproval, createReverseJournalEntry, type JournalEntryModel, type JournalLineModel } from '../modules/accounting/domain/journalEntry';
|
||||||
|
|
||||||
|
// Current User Context (Maker-Checker)
|
||||||
|
const currentUserId = ref(makeUserId('USER-MAKER-01'));
|
||||||
|
const checkerUserId = ref(makeUserId('USER-CHECKER-02'));
|
||||||
|
|
||||||
|
// Journal Entry Form State
|
||||||
|
const journalId = ref('JRN-2026-07-001');
|
||||||
|
const entryDate = ref('2026-07-26');
|
||||||
|
const periodYearMonth = ref('2026-07');
|
||||||
|
const isClosedPeriod = ref(false);
|
||||||
|
const journalStatus = ref<'DRAFT' | 'PENDING_APPROVAL' | 'APPROVED' | 'REJECTED' | 'REVERSED'>('DRAFT');
|
||||||
|
|
||||||
|
const lines = ref<JournalLineModel[]>([
|
||||||
|
{ lineNo: 1, accountCode: '10100', accountName: '현금 및 현금성자산', debitAmount: 5000000, creditAmount: 0, description: '매출 대금 회수' },
|
||||||
|
{ lineNo: 2, accountCode: '40100', accountName: '제품매출', debitAmount: 0, creditAmount: 5000000, description: '제품 판매' }
|
||||||
|
]);
|
||||||
|
|
||||||
|
const sodErrorMessage = ref<string | null>(null);
|
||||||
|
|
||||||
|
const debitTotal = computed(() => lines.value.reduce((sum, l) => sum + l.debitAmount, 0));
|
||||||
|
const creditTotal = computed(() => lines.value.reduce((sum, l) => sum + l.creditAmount, 0));
|
||||||
|
const balanceDiff = computed(() => Math.abs(debitTotal.value - creditTotal.value));
|
||||||
|
const isBalanced = computed(() => balanceDiff.value === 0 && debitTotal.value > 0);
|
||||||
|
|
||||||
|
const handleRequestApproval = () => {
|
||||||
|
if (!isBalanced.value) {
|
||||||
|
alert('차변 합계와 대변 합계가 일치해야 합니다.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
journalStatus.value = 'PENDING_APPROVAL';
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleApproveSoDCheck = (approver: 'MAKER' | 'CHECKER') => {
|
||||||
|
sodErrorMessage.value = null;
|
||||||
|
const targetApprover = approver === 'MAKER' ? currentUserId.value : checkerUserId.value;
|
||||||
|
|
||||||
|
const sodResult = validateSoDApproval(currentUserId.value, targetApprover);
|
||||||
|
if (!sodResult.allowed) {
|
||||||
|
sodErrorMessage.value = sodResult.reason || '승인 실패';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
journalStatus.value = 'APPROVED';
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleReverseJournal = () => {
|
||||||
|
const currentModel: JournalEntryModel = {
|
||||||
|
journalId: journalId.value,
|
||||||
|
entryDate: entryDate.value,
|
||||||
|
periodYearMonth: periodYearMonth.value,
|
||||||
|
status: journalStatus.value,
|
||||||
|
creatorId: currentUserId.value,
|
||||||
|
isPeriodClosed: isClosedPeriod.value,
|
||||||
|
lines: lines.value,
|
||||||
|
totalDebit: makeDecimalString(debitTotal.value.toString()),
|
||||||
|
totalCredit: makeDecimalString(creditTotal.value.toString())
|
||||||
|
};
|
||||||
|
|
||||||
|
const reversed = createReverseJournalEntry(currentModel, `${journalId.value}-REV`, currentUserId.value);
|
||||||
|
journalId.value = reversed.journalId;
|
||||||
|
lines.value = reversed.lines;
|
||||||
|
journalStatus.value = 'REVERSED';
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="erp-journal-container flex flex-col gap-4 p-6 bg-slate-50 min-h-full select-none text-left">
|
||||||
|
<!-- Header -->
|
||||||
|
<div class="flex justify-between items-center bg-white p-4 rounded-lg shadow-sm border border-slate-200">
|
||||||
|
<div>
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<BaseStatusBadge variant="info" label="Phase 7" />
|
||||||
|
<h1 class="text-xl font-bold text-slate-800">ERP 회계 전표 & 역분개 파일럿</h1>
|
||||||
|
<BaseStatusBadge
|
||||||
|
:variant="journalStatus === 'APPROVED' ? 'success' : (journalStatus === 'REVERSED' ? 'danger' : 'warning')"
|
||||||
|
:label="journalStatus"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<p class="text-xs text-slate-500 mt-1">ERP-01 ~ 04: 차변·대변 Grid, Decimal 정밀도 연산, SoD 직무분리 승인, 마감검증 및 역분개 전표</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex gap-2">
|
||||||
|
<BaseButton v-if="journalStatus === 'DRAFT'" variant="outline" @click="handleRequestApproval">
|
||||||
|
📑 승인 요청
|
||||||
|
</BaseButton>
|
||||||
|
<BaseButton v-if="journalStatus === 'APPROVED'" variant="danger" @click="handleReverseJournal">
|
||||||
|
🔄 역분개(Reverse) 실행
|
||||||
|
</BaseButton>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- SoD Violation Warning -->
|
||||||
|
<div v-if="sodErrorMessage" class="p-3 bg-rose-50 border border-rose-200 text-rose-700 text-xs font-bold rounded">
|
||||||
|
🚫 {{ sodErrorMessage }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Header Form -->
|
||||||
|
<div class="bg-white p-4 rounded-lg shadow-sm border border-slate-200 grid grid-cols-1 md:grid-cols-4 gap-4">
|
||||||
|
<CodeField v-model="journalId" label="전표 번호" readonly />
|
||||||
|
<BaseInput v-model="entryDate" type="date" label="전표 일자" :readonly="isClosedPeriod || journalStatus === 'APPROVED'" />
|
||||||
|
<TextField v-model="periodYearMonth" label="회계 기간 (YYYY-MM)" readonly />
|
||||||
|
<div class="flex items-end pb-2">
|
||||||
|
<label class="flex items-center gap-2 text-xs font-bold text-slate-700 cursor-pointer">
|
||||||
|
<input type="checkbox" v-model="isClosedPeriod" class="rounded text-blue-600" />
|
||||||
|
<span>회계기간 마감 여부</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Debit / Credit Grid (ERP-01, ERP-02) -->
|
||||||
|
<div class="bg-white p-4 rounded-lg shadow-sm border border-slate-200 flex flex-col gap-3">
|
||||||
|
<div class="flex justify-between items-center">
|
||||||
|
<h2 class="text-sm font-bold text-slate-800">차변(Debit) / 대변(Credit) 분개 라인</h2>
|
||||||
|
<div class="flex gap-4 text-xs font-bold">
|
||||||
|
<span class="text-blue-700">차변 합계: {{ debitTotal.toLocaleString() }} KRW</span>
|
||||||
|
<span class="text-amber-700">대변 합계: {{ creditTotal.toLocaleString() }} KRW</span>
|
||||||
|
<span :class="isBalanced ? 'text-emerald-600' : 'text-rose-600'">
|
||||||
|
{{ isBalanced ? '✅ 차대 균형 일치' : `⚠️ 차액: ${balanceDiff.toLocaleString()} KRW` }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="border rounded-lg overflow-hidden text-xs">
|
||||||
|
<table class="w-full text-left border-collapse">
|
||||||
|
<thead class="bg-slate-100 font-semibold text-slate-700">
|
||||||
|
<tr>
|
||||||
|
<th class="p-2 border-b border-r w-12">No</th>
|
||||||
|
<th class="p-2 border-b border-r w-28">계정코드</th>
|
||||||
|
<th class="p-2 border-b border-r">계정과목명</th>
|
||||||
|
<th class="p-2 border-b border-r w-36 text-right">차변 금액(Debit)</th>
|
||||||
|
<th class="p-2 border-b border-r w-36 text-right">대변 금액(Credit)</th>
|
||||||
|
<th class="p-2 border-b">적요</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr v-for="line in lines" :key="line.lineNo" class="border-b">
|
||||||
|
<td class="p-2 border-r text-center font-mono">{{ line.lineNo }}</td>
|
||||||
|
<td class="p-2 border-r font-mono font-bold text-blue-600">{{ line.accountCode }}</td>
|
||||||
|
<td class="p-2 border-r font-medium">{{ line.accountName }}</td>
|
||||||
|
<td class="p-2 border-r text-right font-mono">{{ line.debitAmount.toLocaleString() }}</td>
|
||||||
|
<td class="p-2 border-r text-right font-mono">{{ line.creditAmount.toLocaleString() }}</td>
|
||||||
|
<td class="p-2 text-slate-600">{{ line.description }}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- SoD Maker Checker Approval Action (ERP-03) -->
|
||||||
|
<div v-if="journalStatus === 'PENDING_APPROVAL'" class="bg-white p-4 rounded-lg shadow-sm border border-slate-200 flex justify-between items-center">
|
||||||
|
<div>
|
||||||
|
<h3 class="text-sm font-bold text-slate-800">2차 승인 처리 (SoD 직무분리 검증)</h3>
|
||||||
|
<p class="text-xs text-slate-500">작성자({{ currentUserId }})는 자신의 전표를 직접 승인할 수 없습니다.</p>
|
||||||
|
</div>
|
||||||
|
<div class="flex gap-2">
|
||||||
|
<BaseButton variant="outline" @click="handleApproveSoDCheck('MAKER')">
|
||||||
|
🚫 작성자 자기 승인 시도 (SoD 오류 테스트)
|
||||||
|
</BaseButton>
|
||||||
|
<BaseButton variant="primary" @click="handleApproveSoDCheck('CHECKER')">
|
||||||
|
✅ Checker({{ checkerUserId }}) 승인 실행
|
||||||
|
</BaseButton>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,136 @@
|
|||||||
|
<!-- IntegratedWorkflowView.vue -->
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, onUnmounted } from 'vue';
|
||||||
|
import BaseStatusBadge from '../components/primitives/BaseStatusBadge.vue';
|
||||||
|
import BaseButton from '../components/primitives/BaseButton.vue';
|
||||||
|
import BaseProgressBar from '../components/QuantProgressBar.vue';
|
||||||
|
import { createOrderToCashWorkflow, type IntegratedWorkflowState, type AsyncBatchJobState } from '../shared/workflow/integratedWorkflow';
|
||||||
|
|
||||||
|
const workflow = ref<IntegratedWorkflowState>(createOrderToCashWorkflow('ORD-2026-999'));
|
||||||
|
|
||||||
|
// Async Batch Job Simulation (FLOW-04)
|
||||||
|
const batchJob = ref<AsyncBatchJobState>({
|
||||||
|
jobId: 'JOB-20260726-001',
|
||||||
|
jobName: '대량 출고 확정 및 매출 전표 일괄 생성',
|
||||||
|
totalCount: 500,
|
||||||
|
processedCount: 0,
|
||||||
|
successCount: 0,
|
||||||
|
failedCount: 0,
|
||||||
|
progressPct: 0,
|
||||||
|
status: 'QUEUED'
|
||||||
|
});
|
||||||
|
|
||||||
|
let timer: ReturnType<typeof setInterval> | null = null;
|
||||||
|
|
||||||
|
const advanceWorkflowStep = () => {
|
||||||
|
const currentIdx = workflow.value.steps.findIndex(s => s.status === 'IN_PROGRESS');
|
||||||
|
if (currentIdx !== -1 && currentIdx < workflow.value.steps.length - 1) {
|
||||||
|
workflow.value.steps[currentIdx].status = 'COMPLETED';
|
||||||
|
workflow.value.steps[currentIdx].executedAt = new Date().toISOString();
|
||||||
|
workflow.value.steps[currentIdx + 1].status = 'IN_PROGRESS';
|
||||||
|
workflow.value.currentStepIndex = currentIdx + 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const runAsyncBatchJob = () => {
|
||||||
|
batchJob.value.status = 'RUNNING';
|
||||||
|
batchJob.value.processedCount = 0;
|
||||||
|
batchJob.value.successCount = 0;
|
||||||
|
batchJob.value.failedCount = 0;
|
||||||
|
batchJob.value.progressPct = 0;
|
||||||
|
|
||||||
|
if (timer) clearInterval(timer);
|
||||||
|
|
||||||
|
timer = setInterval(() => {
|
||||||
|
if (batchJob.value.processedCount < batchJob.value.totalCount) {
|
||||||
|
batchJob.value.processedCount += 50;
|
||||||
|
batchJob.value.successCount += 48;
|
||||||
|
batchJob.value.failedCount += 2;
|
||||||
|
batchJob.value.progressPct = Math.round((batchJob.value.processedCount / batchJob.value.totalCount) * 100);
|
||||||
|
} else {
|
||||||
|
batchJob.value.status = 'COMPLETED';
|
||||||
|
if (timer) clearInterval(timer);
|
||||||
|
}
|
||||||
|
}, 300);
|
||||||
|
};
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
if (timer) clearInterval(timer);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="integrated-workflow-container flex flex-col gap-4 p-6 bg-slate-50 min-h-full select-none text-left">
|
||||||
|
<!-- Header -->
|
||||||
|
<div class="flex justify-between items-center bg-white p-4 rounded-lg shadow-sm border border-slate-200">
|
||||||
|
<div>
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<BaseStatusBadge variant="info" label="Phase 8" />
|
||||||
|
<h1 class="text-xl font-bold text-slate-800">OMS · WMS · ERP 통합 Workflow 파이프라인</h1>
|
||||||
|
</div>
|
||||||
|
<p class="text-xs text-slate-500 mt-1">FLOW-01 ~ 04: 주문→할당→출고→매출 End-to-End 7단계 상태전이 & 비동기 일괄 처리 관제</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex gap-2">
|
||||||
|
<BaseButton variant="primary" @click="advanceWorkflowStep">
|
||||||
|
▶️ 다음 단계 진행 (Step {{ workflow.currentStepIndex + 1 }})
|
||||||
|
</BaseButton>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Timeline Steps (FLOW-01 Order-to-Cash) -->
|
||||||
|
<div class="bg-white p-6 rounded-lg shadow-sm border border-slate-200 flex flex-col gap-4">
|
||||||
|
<h2 class="text-base font-bold text-slate-800">1. 주문 수주 → 출고 → ERP 매출 연쇄 트래킹 (Correlation ID)</h2>
|
||||||
|
|
||||||
|
<div class="grid grid-cols-1 md:grid-cols-7 gap-2">
|
||||||
|
<div
|
||||||
|
v-for="step in workflow.steps"
|
||||||
|
:key="step.stepNo"
|
||||||
|
class="p-3 rounded-lg border flex flex-col gap-1 text-xs transition-all"
|
||||||
|
:class="[
|
||||||
|
step.status === 'COMPLETED' ? 'bg-emerald-50 border-emerald-300 text-emerald-900' :
|
||||||
|
step.status === 'IN_PROGRESS' ? 'bg-blue-50 border-blue-400 text-blue-900 shadow-md ring-2 ring-blue-400' :
|
||||||
|
'bg-slate-50 border-slate-200 text-slate-500'
|
||||||
|
]"
|
||||||
|
>
|
||||||
|
<div class="flex justify-between font-bold">
|
||||||
|
<span>[{{ step.domain }}]</span>
|
||||||
|
<span>Step {{ step.stepNo }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="font-semibold text-xs my-1">{{ step.stepName }}</div>
|
||||||
|
<div class="text-[10px] opacity-75 font-mono">{{ step.correlationId }}</div>
|
||||||
|
<div class="mt-auto pt-1 font-bold text-[10px]">
|
||||||
|
{{ step.status }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Async Batch Job Execution (FLOW-04) -->
|
||||||
|
<div class="bg-white p-6 rounded-lg shadow-sm border border-slate-200 flex flex-col gap-4">
|
||||||
|
<div class="flex justify-between items-center">
|
||||||
|
<div>
|
||||||
|
<h2 class="text-base font-bold text-slate-800">2. 대량 전표 비동기 배치 Job 연동</h2>
|
||||||
|
<p class="text-xs text-slate-500">대용량 처리 시 비동기 Job ID를 생성하고 진행률 및 부분 실패를 관제합니다.</p>
|
||||||
|
</div>
|
||||||
|
<BaseButton variant="secondary" :loading="batchJob.status === 'RUNNING'" @click="runAsyncBatchJob">
|
||||||
|
⚡ 배치 Job 실행 시뮬레이션
|
||||||
|
</BaseButton>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="p-4 bg-slate-50 border border-slate-200 rounded-lg flex flex-col gap-3">
|
||||||
|
<div class="flex justify-between text-xs font-bold text-slate-700">
|
||||||
|
<span>Job ID: {{ batchJob.jobId }}</span>
|
||||||
|
<span>진행률: {{ batchJob.progressPct }}% ({{ batchJob.processedCount }} / {{ batchJob.totalCount }})</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<BaseProgressBar :value="batchJob.progressPct" />
|
||||||
|
|
||||||
|
<div class="flex gap-4 text-xs font-semibold pt-1">
|
||||||
|
<span class="text-emerald-700">성공 건수: {{ batchJob.successCount }} 건</span>
|
||||||
|
<span class="text-rose-700">실패 건수: {{ batchJob.failedCount }} 건 (부분 성공 모드)</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -56,7 +56,7 @@ const timeSeriesRows = ref([
|
|||||||
<td style="padding: 8px; border: 1px solid #CBD5E1; text-align: right; font-weight: bold; color: #2C3E50;">{{ row.close }}</td>
|
<td style="padding: 8px; border: 1px solid #CBD5E1; text-align: right; font-weight: bold; color: #2C3E50;">{{ row.close }}</td>
|
||||||
<td style="padding: 8px; border: 1px solid #CBD5E1; text-align: right;">{{ row.volume }}</td>
|
<td style="padding: 8px; border: 1px solid #CBD5E1; text-align: right;">{{ row.volume }}</td>
|
||||||
<td style="padding: 8px; border: 1px solid #CBD5E1; text-align: center; font-family: monospace; font-size: 11px;">
|
<td style="padding: 8px; border: 1px solid #CBD5E1; text-align: center; font-family: monospace; font-size: 11px;">
|
||||||
<QuantStatusChip type="PASS" :label="row.source" />
|
<QuantStatusChip type="success" :label="row.source" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user