251212:1650 Frontend: refactor Document Numbering)
This commit is contained in:
9656
backend/pnpm-lock.yaml
generated
9656
backend/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -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,
|
||||
|
||||
@@ -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}';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user