[CLAUDE] PurchaseEvaluation: Mig 56 ngan sach MA TRAN 3 cot (Du an|PRO|CCM) + badge quyen NS theo role
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 4m57s

S76 (anh Kiet FDC + chi Tra Sol) — form ngan sach + hien thi quyen nhap NS trong flow:
- Part 1: form ngan sach -> MA TRAN 3 cot, moi phong nhap+dieu chinh cot minh
  (PRO canEditPro / CCM canEditCcm / Du an FE hien-thi-only). Mig 56
  +ProInitialAmount/ProAdjustmentAmount (additive-nullable + data-migrate
  ProEstimate->ProInitial). full moi cot = ban hanh + hieu chinh.
- Part 2: Workflow Designer (fe-admin) +badge "NS PRO/CCM" canh approver
  (suy tu role Admin|Procurement / Admin|CostControl, hien-thi-only no-authz).
- Part 3: flow quy trinh fe-user/fe-admin (Duyet NCC) +badge tuong tu.
- Fix race mat-du-lieu Part 1 (useIsFetching khoa Luu khi refetch — dong
  cua-so stale-echo, reviewer Part2/3 bat).
- Test 339->344 (+5). 2 workflow review (Part 1 PASS + Part 2/3 PASS).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
pqhuy1987
2026-06-19 11:02:47 +07:00
parent 70c13d4ac8
commit e33481efb6
19 changed files with 6974 additions and 325 deletions

View File

@ -10,21 +10,26 @@ namespace SolutionErp.Domain.PurchaseEvaluations;
// Loose-Guid convention PE (giống PE.ProjectId/WorkItemId/SelectedSupplierId):
// KHÔNG FK vật lý, KHÔNG navigation property.
//
// Quyền nhập theo ROLE (anh Kiệt chốt S61):
// - PRO (Procurement): ProEstimateAmount (dự trù lần đầu) + ProNote.
// - CCM (CostControl): InitialAmount (Ban hành lần đầu) + AdjustmentAmount
// (NS V0 hiệu chỉnh tăng/giảm — cho phép ÂM) + CcmNote (ghi chú CCM, Mig 55).
// [S76 — anh Kiệt FDC] Form ngân sách MA TRẬN 3 cột (DỰ ÁN | PRO | CCM), mỗi
// phòng nhập + điều chỉnh ngân sách của CHÍNH cột phòng đó (quyền theo ROLE):
// - PRO (Procurement | Admin): ProInitialAmount (ban hành lần đầu) +
// ProAdjustmentAmount (V0/hiệu chỉnh — cho phép ÂM) + ProNote.
// - CCM (CostControl | Admin): InitialAmount (ban hành lần đầu) +
// AdjustmentAmount (V0/hiệu chỉnh — cho phép ÂM) + CcmNote.
// - DỰ ÁN: hiển thị FE-only (chưa wire BE — sau mới có người dự án nhập).
//
// "Ngân sách full gói thầu" KHÔNG lưu cột — BE compute:
// full = (InitialAmount ?? 0) + (AdjustmentAmount ?? 0);
// cả Initial + Adjustment đều null → fallback ProEstimateAmount ?? 0
// với cờ fullIsEstimate=true (FE badge "dự trù PRO").
// "Ngân sách full" mỗi cột = Initial + Adjustment (cột đó). Authoritative full
// (Block B công thức) = CCM nếu CCM đã nhập, else PRO (fullIsEstimate=true → FE
// badge "ngân sách PRO"). ProEstimateAmount = LEGACY single-estimate (≤S75) —
// Mig 56 migrate → ProInitialAmount, FE KHÔNG dùng nữa; giữ cột back-compat.
public class PeWorkItemBudget : AuditableEntity
{
public Guid ProjectId { get; set; } // loose-Guid Projects.Id
public Guid WorkItemId { get; set; } // loose-Guid WorkItems.Id
public decimal? ProEstimateAmount { get; set; } // PRO dự trù lần đầu (đ)
public decimal? ProEstimateAmount { get; set; } // [LEGACY ≤S75] PRO dự trù 1 số — Mig 56 migrate → ProInitialAmount
public decimal? ProInitialAmount { get; set; } // [S76] PRO "Ban hành lần đầu" (đ)
public decimal? ProAdjustmentAmount { get; set; } // [S76] PRO "V0/hiệu chỉnh tăng giảm" (đ, cho phép ÂM)
public string? ProNote { get; set; } // "Ghi chú từ PRO"
public decimal? InitialAmount { get; set; } // CCM "Ngân sách Ban hành lần đầu" (đ)
public decimal? AdjustmentAmount { get; set; } // CCM "NS V0/hiệu chỉnh tăng giảm" (đ, cho phép ÂM)