251212:1650 Frontend: refactor Document Numbering)
Some checks failed
Spec Validation / validate-markdown (push) Has been cancelled
Spec Validation / validate-diagrams (push) Has been cancelled
Spec Validation / check-todos (push) Has been cancelled

This commit is contained in:
admin
2025-12-12 16:50:52 +07:00
parent 2473c4c474
commit d964546c8d
16 changed files with 233 additions and 14925 deletions

9656
backend/pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -121,12 +121,18 @@ export class CorrespondenceService {
try {
const orgCode = 'ORG'; // TODO: Fetch real ORG Code from Organization Entity
// Extract recipient organization from details
const recipientOrganizationId = createDto.details?.to_organization_id as
| number
| undefined;
const docNumber = await this.numberingService.generateNextNumber({
projectId: createDto.projectId,
originatorId: userOrgId,
typeId: createDto.typeId,
disciplineId: createDto.disciplineId,
subTypeId: createDto.subTypeId,
recipientOrganizationId, // [v1.5.1] Pass recipient for document number format
year: new Date().getFullYear(),
customTokens: {
TYPE_CODE: type.typeCode,

View File

@@ -298,7 +298,7 @@ export class DocumentNumberingService implements OnModuleInit, OnModuleDestroy {
where: { projectId, correspondenceTypeId: typeId },
});
// Default Fallback Format (ตาม Req 2.1)
return format ? format.formatTemplate : '{ORG}-{ORG}-{SEQ:4}-{YEAR}';
return format ? format.formatTemplate : '{ORG}-{RECIPIENT}-{SEQ:4}-{YEAR}';
}
/**