[CLAUDE] PurchaseEvaluation: luy ke TAM TINH vs CHINH XAC — ComputePendingAsync + 5-field DTO + FE 2-app sub-dong amber/banner man duyet + D4 audit-note (UAT anh Kiet 15-07, 0 mig, test 520→528)
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 5m27s
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 5m27s
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@ -1021,6 +1021,36 @@ public class PurchaseEvaluationWorkflowService(
|
||||
evaluation.ApprovedBudgetPrevSubmittedCount = acc.PrevSubmittedCount;
|
||||
evaluation.ApprovedBudgetPrevSelectedTotal = acc.PrevSelectedTotal;
|
||||
evaluation.ApprovedBudgetPrevSelectedCount = acc.PrevSelectedCount;
|
||||
|
||||
// [S134 pending-prior] D4 audit-note — nếu finalize phiếu này mà VẪN còn phiếu TRƯỚC
|
||||
// cùng gói CHƯA duyệt xong (nháp/đang trình/trả lại) → ghi 1 changelog Action=Update
|
||||
// (KHÔNG Transition — caller đã ghi row Transition riêng qua LogTransitionAsync; 2 row
|
||||
// Transition = UI hiểu nhầm 2 lần chuyển phase, gotcha #49). KHÔNG SaveChanges (caller lo).
|
||||
var pending = await SolutionErp.Application.PurchaseEvaluations.PeBudgetAccumulator.ComputePendingAsync(
|
||||
db, evaluation.ProjectId, wiKey, evaluation.Id, evaluation.CreatedAt, ct);
|
||||
if (pending.PriorPes.Count > 0)
|
||||
{
|
||||
static string PendingPhaseLabel(int phase) => phase switch
|
||||
{
|
||||
(int)PurchaseEvaluationPhase.DangSoanThao => "Nháp",
|
||||
(int)PurchaseEvaluationPhase.ChoDuyet => "Đã gửi duyệt",
|
||||
(int)PurchaseEvaluationPhase.TraLai => "Trả lại",
|
||||
_ => "Đang duyệt",
|
||||
};
|
||||
var priorList = string.Join(", ", pending.PriorPes.Select(pr =>
|
||||
$"{pr.MaPhieu ?? "(chưa có mã)"} ({PendingPhaseLabel(pr.Phase)})"));
|
||||
db.PurchaseEvaluationChangelogs.Add(new PurchaseEvaluationChangelog
|
||||
{
|
||||
PurchaseEvaluationId = evaluation.Id,
|
||||
EntityType = PurchaseEvaluationEntityType.Workflow,
|
||||
Action = ChangelogAction.Update,
|
||||
PhaseAtChange = PurchaseEvaluationPhase.DaDuyet,
|
||||
UserId = null,
|
||||
UserName = "Hệ thống",
|
||||
Summary = "Duyệt khi còn phiếu trước cùng gói chưa duyệt",
|
||||
ContextNote = $"[S134 pending-prior] Duyệt khi {pending.PriorPes.Count} phiếu trước cùng gói chưa duyệt: {priorList}",
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user