0c62e241d088dbb4f5c4a1a001de39c0a829081c
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 3m2s
Migration 19 `AlterPeDeptApprovalsUniqueFilteredForInnerSteps` — fix
UNIQUE constraint conflict khi N-stage có nhiều inner step cùng dept:
- Drop UX_PEDeptApprovals_PE_Phase_Dept_Stage (Mig 16)
- Recreate filtered: UNIQUE (PEId, Phase, Dept, Stage) WHERE InnerStepId IS NULL
(legacy 2-stage rows giữ nguyên invariant)
- New filtered: UNIQUE (PEId, Phase, InnerStepId) WHERE InnerStepId IS NOT NULL
(N-stage 1 row per inner step per phase)
PurchaseEvaluationWorkflowService.TransitionAsync refactor:
- Load definition with InnerSteps eager (.Include ThenInclude)
- Reject branch: clear N-stage approval rows tại fromPhase (resume sẽ
approve lại từ inner step đầu — clean state)
- Department approval block split:
* hasInnerSteps=true → N-stage logic:
- Yêu cầu actor có DepartmentId + PositionLevel set (else throw 403)
- Match firstPending inner step (Order asc, IsRequired only):
same dept AND (exact PositionLevel OR canBypass + level ≥ pending)
- exact match: upsert 1 row (Stage=Confirm, InnerStepId=that)
- bypass: batch upsert NV+PP+TP cùng dept ≤ actor level (audit
IsBypassed=true cho cấp dưới skip)
- Recheck stillPending → BLOCK transition + log Approval/Changelog
"đã duyệt cấp X (còn Y cấp pending)"
- All done → fall through phase transition
* hasInnerSteps=false → Legacy 2-stage (Mig 16) — giữ nguyên logic
NV.Review/TPB.Confirm + InnerStepId=null filter
Backward compat: workflow cũ (no InnerSteps configured) chạy đúng logic
2-stage Mig 16. Data legacy InnerStepId=null vẫn match unique cũ qua
filtered index. Tests 83 pass — no regression.
Verify:
- dotnet build SolutionErp.slnx 0 error
- dotnet ef database update LocalDB applied Mig 19
- dotnet test 83 pass
Pending Chunk D: Tests N-stage workflow (~6-7 test mới: sequential pass /
bypass cùng dept / reject reset / resume jump-back / legacy fallback).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
SOLUTION_ERP
Hệ thống quản lý Hợp đồng Nhà cung cấp / Thầu phụ / Tổ đội cho Công ty TNHH Xây dựng Solutions.
📘 AI context:
CLAUDE.md(pointer) →docs/CLAUDE.md(full)
Quick start (dev)
Yêu cầu: .NET 10 SDK, Node 20+, SQL Server (local hoặc qua Docker).
# 1. DB — chạy SQL Server qua Docker (nếu chưa có local)
docker compose up -d
# 2. Backend — migration + run Api (port 5443)
dotnet ef database update --project src/Backend/SolutionErp.Infrastructure --startup-project src/Backend/SolutionErp.Api
dotnet run --project src/Backend/SolutionErp.Api
# 3. Frontend admin (port 8082) — terminal mới
cd fe-admin
npm install
npm run dev
# 4. Frontend user (port 8080) — terminal mới
cd fe-user
npm install
npm run dev
Admin mặc định (sẽ seed sau Phase 1): admin@solutionerp.local / Admin@123456
Architecture
fe-admin (:8082) fe-user (:8080)
│ │
└────── /api proxy ──────┘
▼
SolutionErp.Api (:5443)
│
┌──────────────┼──────────────┐
▼ ▼ ▼
Application Domain Infrastructure ── SQL Server
Tech stack
- Backend: .NET 10 + Clean Architecture + CQRS (MediatR) + FluentValidation + AutoMapper + EF Core + ASP.NET Identity + JWT
- Frontend: React 18 + Vite + TypeScript + Tailwind + shadcn/ui + TanStack Query
- DB: SQL Server 2022
- Deploy: Windows Server + IIS
Roadmap
| Phase | Tuần | Focus |
|---|---|---|
| 0 Draft | T1 | Scaffold, parse FORM + QUY_TRINH |
| 1 Alpha Core | T2-4 | Auth, Permission, CRUD master |
| 2 Form Engine | T5-6 | Render template docx/xlsx |
| 3 Workflow | T7-9 | State machine 9 phase |
| 4 Report + Polish | T10-11 | Dashboard + Excel export |
| 5 Production | T12-13 | CI/CD IIS, UAT, go-live |
Chi tiết ở docs/changelog/migration-todos.md.
License
Proprietary — Công ty TNHH Xây dựng Solutions.
Description
Languages
C#
55%
TypeScript
42.7%
PowerShell
1.3%
JavaScript
0.3%
CSS
0.3%
Other
0.3%