Merge branch 'develop' of github.com:Frappet/bma-ehr-organization into develop
This commit is contained in:
commit
b96b06cc0a
7 changed files with 57 additions and 448 deletions
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -668,6 +668,28 @@ export class OrganizationController extends Controller {
|
|||
return new HttpSuccess(revision);
|
||||
}
|
||||
|
||||
/**
|
||||
* API เช็คสถานะโครงสร้างว่าส่งคนไปออกคำสั่งหรือไม่
|
||||
*
|
||||
* @summary API เช็คสถานะโครงสร้างว่าส่งคนไปออกคำสั่งหรือไม่
|
||||
*
|
||||
* @param {string} id Id OrgRevison
|
||||
*/
|
||||
@Get("lock/{id}")
|
||||
async GetById(
|
||||
@Request() request: RequestWithUser,
|
||||
@Path() id: string,
|
||||
) {
|
||||
//add check permission
|
||||
const orgRevision = await this.orgRevisionRepository.findOne({
|
||||
where: { id: id }
|
||||
});
|
||||
if (!orgRevision) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลโครงสร้าง");
|
||||
}
|
||||
return new HttpSuccess(orgRevision.isLock);
|
||||
}
|
||||
|
||||
/**
|
||||
* API รายละเอียดโครงสร้าง
|
||||
*
|
||||
|
|
|
|||
|
|
@ -3112,6 +3112,8 @@ export class PositionController extends Controller {
|
|||
await this.posMasterRepository.update(id, {
|
||||
isSit: false,
|
||||
next_holderId: null,
|
||||
current_holderId: null,
|
||||
statusReport: "PENDING",
|
||||
});
|
||||
|
||||
dataMaster.positions.forEach(async (position) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue