api เช็คสถานะโครงสร้าง

This commit is contained in:
Bright 2024-11-13 11:32:45 +07:00
parent 8d48dc8af7
commit 5bba5822ea
7 changed files with 57 additions and 448 deletions

View file

@ -3037,6 +3037,16 @@ export class CommandController extends Controller {
statusReport: "REPORT",
}));
await this.posMasterRepository.save(data);
if (posMasters && posMasters.length > 0) {
const orgRevision = await this.orgRevisionRepo.findOne({
where: { id: posMasters[0].orgRevisionId }
});
if (orgRevision != null) {
await this.orgRevisionRepo.update(orgRevision.id, {
isLock: true,
});
}
}
return new HttpSuccess();
}
@ -3531,6 +3541,19 @@ export class CommandController extends Controller {
statusReport: "PENDING",
}));
await this.posMasterRepository.save(data);
if (data && data.length > 0) {
const revisionId = data[0].orgRevisionId;
const orgRevision = await this.orgRevisionRepo.findOne({
where: { id: revisionId },
relations: ["posMasters"]
});
if (orgRevision != null && !orgRevision?.posMasters.filter(x => x.statusReport === "REPORT")
) {
await this.orgRevisionRepo.update(orgRevision.id, {
isLock: false,
});
}
}
return new HttpSuccess();
}