Merge branch 'develop' of github.com:Frappet/bma-ehr-organization into develop
This commit is contained in:
commit
b2d8fa6bf8
1 changed files with 506 additions and 193 deletions
|
|
@ -1140,7 +1140,7 @@ export class PositionController extends Controller {
|
|||
*
|
||||
*/
|
||||
@Post("summary")
|
||||
async PositionSummary(@Body() requestBody: { id: string; type: number }) {
|
||||
async PositionSummary(@Body() requestBody: { id: string; type: number; isNode: boolean }) {
|
||||
try {
|
||||
let summary: any;
|
||||
let totalPosition: any;
|
||||
|
|
@ -1149,204 +1149,517 @@ export class PositionController extends Controller {
|
|||
let totalPositionNextUse: any;
|
||||
let totalPositionNextVacant: any;
|
||||
|
||||
switch (requestBody.type) {
|
||||
case 0: {
|
||||
const NodeId = await this.posMasterRepository.findOne({
|
||||
where: { orgRootId: requestBody.id },
|
||||
});
|
||||
if (!NodeId) {
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id,
|
||||
);
|
||||
if(requestBody.isNode === true){
|
||||
switch (requestBody.type) {
|
||||
case 0: {
|
||||
const NodeId = await this.posMasterRepository.findOne({
|
||||
where: { orgRootId: requestBody.id },
|
||||
});
|
||||
if (!NodeId) {
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id,
|
||||
);
|
||||
}
|
||||
totalPosition = await this.posMasterRepository.count({
|
||||
where: { orgRootId: requestBody.id },
|
||||
});
|
||||
totalPositionCurrentUse = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgRootId: requestBody.id,
|
||||
current_holderId: Not(IsNull()) && Not(""),
|
||||
},
|
||||
});
|
||||
totalPositionCurrentVacant = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgRootId: requestBody.id,
|
||||
current_holderId: IsNull() && "",
|
||||
},
|
||||
});
|
||||
totalPositionNextUse = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgRootId: requestBody.id,
|
||||
next_holderId: Not(IsNull()) && Not(""),
|
||||
},
|
||||
});
|
||||
totalPositionNextVacant = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgRootId: requestBody.id,
|
||||
next_holderId: IsNull() && "",
|
||||
},
|
||||
});
|
||||
break;
|
||||
}
|
||||
totalPosition = await this.posMasterRepository.count({
|
||||
where: { orgRootId: requestBody.id },
|
||||
});
|
||||
totalPositionCurrentUse = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgRootId: requestBody.id,
|
||||
current_holderId: Not(IsNull()) && Not(""),
|
||||
},
|
||||
});
|
||||
totalPositionCurrentVacant = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgRootId: requestBody.id,
|
||||
current_holderId: IsNull() && "",
|
||||
},
|
||||
});
|
||||
totalPositionNextUse = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgRootId: requestBody.id,
|
||||
next_holderId: Not(IsNull()) && Not(""),
|
||||
},
|
||||
});
|
||||
totalPositionNextVacant = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgRootId: requestBody.id,
|
||||
next_holderId: IsNull() && "",
|
||||
},
|
||||
});
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
const NodeId = await this.posMasterRepository.findOne({
|
||||
where: { orgChild1Id: requestBody.id },
|
||||
});
|
||||
if (!NodeId) {
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id,
|
||||
);
|
||||
case 1: {
|
||||
const NodeId = await this.posMasterRepository.findOne({
|
||||
where: { orgChild1Id: requestBody.id },
|
||||
});
|
||||
if (!NodeId) {
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id,
|
||||
);
|
||||
}
|
||||
totalPosition = await this.posMasterRepository.count({
|
||||
where: { orgChild1Id: requestBody.id },
|
||||
});
|
||||
totalPositionCurrentUse = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgChild1Id: requestBody.id,
|
||||
current_holderId: Not(IsNull()) && Not(""),
|
||||
},
|
||||
});
|
||||
totalPositionCurrentVacant = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgChild1Id: requestBody.id,
|
||||
current_holderId: IsNull() && "",
|
||||
},
|
||||
});
|
||||
totalPositionNextUse = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgChild1Id: requestBody.id,
|
||||
next_holderId: Not(IsNull()) && Not(""),
|
||||
},
|
||||
});
|
||||
totalPositionNextVacant = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgChild1Id: requestBody.id,
|
||||
next_holderId: IsNull() && "",
|
||||
},
|
||||
});
|
||||
break;
|
||||
}
|
||||
totalPosition = await this.posMasterRepository.count({
|
||||
where: { orgChild1Id: requestBody.id },
|
||||
});
|
||||
totalPositionCurrentUse = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgChild1Id: requestBody.id,
|
||||
current_holderId: Not(IsNull()) && Not(""),
|
||||
},
|
||||
});
|
||||
totalPositionCurrentVacant = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgChild1Id: requestBody.id,
|
||||
current_holderId: IsNull() && "",
|
||||
},
|
||||
});
|
||||
totalPositionNextUse = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgChild1Id: requestBody.id,
|
||||
next_holderId: Not(IsNull()) && Not(""),
|
||||
},
|
||||
});
|
||||
totalPositionNextVacant = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgChild1Id: requestBody.id,
|
||||
next_holderId: IsNull() && "",
|
||||
},
|
||||
});
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
const NodeId = await this.posMasterRepository.findOne({
|
||||
where: { orgChild2Id: requestBody.id },
|
||||
});
|
||||
if (!NodeId) {
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id,
|
||||
);
|
||||
case 2: {
|
||||
const NodeId = await this.posMasterRepository.findOne({
|
||||
where: { orgChild2Id: requestBody.id },
|
||||
});
|
||||
if (!NodeId) {
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id,
|
||||
);
|
||||
}
|
||||
totalPosition = await this.posMasterRepository.count({
|
||||
where: { orgChild2Id: requestBody.id },
|
||||
});
|
||||
totalPositionCurrentUse = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgChild2Id: requestBody.id,
|
||||
current_holderId: Not(IsNull()) && Not(""),
|
||||
},
|
||||
});
|
||||
totalPositionCurrentVacant = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgChild2Id: requestBody.id,
|
||||
current_holderId: IsNull() && "",
|
||||
},
|
||||
});
|
||||
totalPositionNextUse = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgChild2Id: requestBody.id,
|
||||
next_holderId: Not(IsNull()) && Not(""),
|
||||
},
|
||||
});
|
||||
totalPositionNextVacant = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgChild2Id: requestBody.id,
|
||||
next_holderId: IsNull() && "",
|
||||
},
|
||||
});
|
||||
break;
|
||||
}
|
||||
totalPosition = await this.posMasterRepository.count({
|
||||
where: { orgChild2Id: requestBody.id },
|
||||
});
|
||||
totalPositionCurrentUse = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgChild2Id: requestBody.id,
|
||||
current_holderId: Not(IsNull()) && Not(""),
|
||||
},
|
||||
});
|
||||
totalPositionCurrentVacant = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgChild2Id: requestBody.id,
|
||||
current_holderId: IsNull() && "",
|
||||
},
|
||||
});
|
||||
totalPositionNextUse = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgChild2Id: requestBody.id,
|
||||
next_holderId: Not(IsNull()) && Not(""),
|
||||
},
|
||||
});
|
||||
totalPositionNextVacant = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgChild2Id: requestBody.id,
|
||||
next_holderId: IsNull() && "",
|
||||
},
|
||||
});
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
const NodeId = await this.posMasterRepository.findOne({
|
||||
where: { orgChild3Id: requestBody.id },
|
||||
});
|
||||
if (!NodeId) {
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id,
|
||||
);
|
||||
case 3: {
|
||||
const NodeId = await this.posMasterRepository.findOne({
|
||||
where: { orgChild3Id: requestBody.id },
|
||||
});
|
||||
if (!NodeId) {
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id,
|
||||
);
|
||||
}
|
||||
totalPosition = await this.posMasterRepository.count({
|
||||
where: { orgChild3Id: requestBody.id },
|
||||
});
|
||||
totalPositionCurrentUse = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgChild3Id: requestBody.id,
|
||||
current_holderId: Not(IsNull()) && Not(""),
|
||||
},
|
||||
});
|
||||
totalPositionCurrentVacant = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgChild3Id: requestBody.id,
|
||||
current_holderId: IsNull() && "",
|
||||
},
|
||||
});
|
||||
totalPositionNextUse = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgChild3Id: requestBody.id,
|
||||
next_holderId: Not(IsNull()) && Not(""),
|
||||
},
|
||||
});
|
||||
totalPositionNextVacant = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgChild3Id: requestBody.id,
|
||||
next_holderId: IsNull() && "",
|
||||
},
|
||||
});
|
||||
break;
|
||||
}
|
||||
totalPosition = await this.posMasterRepository.count({
|
||||
where: { orgChild3Id: requestBody.id },
|
||||
});
|
||||
totalPositionCurrentUse = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgChild3Id: requestBody.id,
|
||||
current_holderId: Not(IsNull()) && Not(""),
|
||||
},
|
||||
});
|
||||
totalPositionCurrentVacant = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgChild3Id: requestBody.id,
|
||||
current_holderId: IsNull() && "",
|
||||
},
|
||||
});
|
||||
totalPositionNextUse = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgChild3Id: requestBody.id,
|
||||
next_holderId: Not(IsNull()) && Not(""),
|
||||
},
|
||||
});
|
||||
totalPositionNextVacant = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgChild3Id: requestBody.id,
|
||||
next_holderId: IsNull() && "",
|
||||
},
|
||||
});
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
const NodeId = await this.posMasterRepository.findOne({
|
||||
where: { orgChild4Id: requestBody.id },
|
||||
});
|
||||
if (!NodeId) {
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id,
|
||||
);
|
||||
case 4: {
|
||||
const NodeId = await this.posMasterRepository.findOne({
|
||||
where: { orgChild4Id: requestBody.id },
|
||||
});
|
||||
if (!NodeId) {
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id,
|
||||
);
|
||||
}
|
||||
totalPosition = await this.posMasterRepository.count({
|
||||
where: { orgChild4Id: requestBody.id },
|
||||
});
|
||||
totalPositionCurrentUse = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgChild4Id: requestBody.id,
|
||||
current_holderId: Not(IsNull()) && Not(""),
|
||||
},
|
||||
});
|
||||
totalPositionCurrentVacant = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgChild4Id: requestBody.id,
|
||||
current_holderId: IsNull() && "",
|
||||
},
|
||||
});
|
||||
totalPositionNextUse = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgChild4Id: requestBody.id,
|
||||
next_holderId: Not(IsNull()) && Not(""),
|
||||
},
|
||||
});
|
||||
totalPositionNextVacant = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgChild4Id: requestBody.id,
|
||||
next_holderId: IsNull() && "",
|
||||
},
|
||||
});
|
||||
break;
|
||||
}
|
||||
totalPosition = await this.posMasterRepository.count({
|
||||
where: { orgChild4Id: requestBody.id },
|
||||
});
|
||||
totalPositionCurrentUse = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgChild4Id: requestBody.id,
|
||||
current_holderId: Not(IsNull()) && Not(""),
|
||||
},
|
||||
});
|
||||
totalPositionCurrentVacant = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgChild4Id: requestBody.id,
|
||||
current_holderId: IsNull() && "",
|
||||
},
|
||||
});
|
||||
totalPositionNextUse = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgChild4Id: requestBody.id,
|
||||
next_holderId: Not(IsNull()) && Not(""),
|
||||
},
|
||||
});
|
||||
totalPositionNextVacant = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgChild4Id: requestBody.id,
|
||||
next_holderId: IsNull() && "",
|
||||
},
|
||||
});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch (requestBody.type) {
|
||||
case 0: {
|
||||
const NodeId = await this.posMasterRepository.findOne({
|
||||
where: { orgRootId: requestBody.id },
|
||||
});
|
||||
if (!NodeId) {
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id,
|
||||
);
|
||||
}
|
||||
totalPosition = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgRootId: requestBody.id,
|
||||
orgChild1Id : IsNull() || "",
|
||||
orgChild2Id : IsNull() || "",
|
||||
orgChild3Id : IsNull() || "",
|
||||
orgChild4Id : IsNull() || "",
|
||||
},
|
||||
});
|
||||
totalPositionCurrentUse = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgRootId: requestBody.id,
|
||||
orgChild1Id : IsNull() || "",
|
||||
orgChild2Id : IsNull() || "",
|
||||
orgChild3Id : IsNull() || "",
|
||||
orgChild4Id : IsNull() || "",
|
||||
current_holderId: Not(IsNull()) || Not(""),
|
||||
},
|
||||
});
|
||||
totalPositionCurrentVacant = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgRootId: requestBody.id,
|
||||
orgChild1Id : IsNull() || "",
|
||||
orgChild2Id : IsNull() || "",
|
||||
orgChild3Id : IsNull() || "",
|
||||
orgChild4Id : IsNull() || "",
|
||||
current_holderId: IsNull() || "",
|
||||
},
|
||||
});
|
||||
totalPositionNextUse = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgRootId: requestBody.id,
|
||||
orgChild1Id : IsNull() || "",
|
||||
orgChild2Id : IsNull() || "",
|
||||
orgChild3Id : IsNull() || "",
|
||||
orgChild4Id : IsNull() || "",
|
||||
next_holderId: Not(IsNull()) || Not(""),
|
||||
},
|
||||
});
|
||||
totalPositionNextVacant = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgRootId: requestBody.id,
|
||||
orgChild1Id : IsNull() || "",
|
||||
orgChild2Id : IsNull() || "",
|
||||
orgChild3Id : IsNull() || "",
|
||||
orgChild4Id : IsNull() || "",
|
||||
next_holderId: IsNull() || "",
|
||||
},
|
||||
});
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
const NodeId = await this.posMasterRepository.findOne({
|
||||
where: { orgChild1Id: requestBody.id },
|
||||
});
|
||||
if (!NodeId) {
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id,
|
||||
);
|
||||
}
|
||||
totalPosition = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgRootId: Not(IsNull()) || Not(""),
|
||||
orgChild1Id : requestBody.id,
|
||||
orgChild2Id : IsNull() || "",
|
||||
orgChild3Id : IsNull() || "",
|
||||
orgChild4Id : IsNull() || "",
|
||||
},
|
||||
});
|
||||
totalPositionCurrentUse = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgRootId: Not(IsNull()) || Not(""),
|
||||
orgChild1Id : requestBody.id,
|
||||
orgChild2Id : IsNull() || "",
|
||||
orgChild3Id : IsNull() || "",
|
||||
orgChild4Id : IsNull() || "",
|
||||
current_holderId: Not(IsNull()) && Not(""),
|
||||
},
|
||||
});
|
||||
totalPositionCurrentVacant = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgRootId: Not(IsNull()) || Not(""),
|
||||
orgChild1Id : requestBody.id,
|
||||
orgChild2Id : IsNull() || "",
|
||||
orgChild3Id : IsNull() || "",
|
||||
orgChild4Id : IsNull() || "",
|
||||
current_holderId: IsNull() && "",
|
||||
},
|
||||
});
|
||||
totalPositionNextUse = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgRootId: Not(IsNull()) || Not(""),
|
||||
orgChild1Id : requestBody.id,
|
||||
orgChild2Id : IsNull() || "",
|
||||
orgChild3Id : IsNull() || "",
|
||||
orgChild4Id : IsNull() || "",
|
||||
next_holderId: Not(IsNull()) && Not(""),
|
||||
},
|
||||
});
|
||||
totalPositionNextVacant = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgRootId: Not(IsNull()) || Not(""),
|
||||
orgChild1Id : requestBody.id,
|
||||
orgChild2Id : IsNull() || "",
|
||||
orgChild3Id : IsNull() || "",
|
||||
orgChild4Id : IsNull() || "",
|
||||
next_holderId: IsNull() && "",
|
||||
},
|
||||
});
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
const NodeId = await this.posMasterRepository.findOne({
|
||||
where: { orgChild2Id: requestBody.id },
|
||||
});
|
||||
if (!NodeId) {
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id,
|
||||
);
|
||||
}
|
||||
totalPosition = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgRootId: Not(IsNull()) || Not(""),
|
||||
orgChild1Id : Not(IsNull()) || Not(""),
|
||||
orgChild2Id : requestBody.id,
|
||||
orgChild3Id : IsNull() || "",
|
||||
orgChild4Id : IsNull() || "",
|
||||
},
|
||||
});
|
||||
totalPositionCurrentUse = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgRootId: Not(IsNull()) || Not(""),
|
||||
orgChild1Id : Not(IsNull()) || Not(""),
|
||||
orgChild2Id : requestBody.id,
|
||||
orgChild3Id : IsNull() || "",
|
||||
orgChild4Id : IsNull() || "",
|
||||
current_holderId: Not(IsNull()) && Not(""),
|
||||
},
|
||||
});
|
||||
totalPositionCurrentVacant = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgRootId: Not(IsNull()) || Not(""),
|
||||
orgChild1Id : Not(IsNull()) || Not(""),
|
||||
orgChild2Id : requestBody.id,
|
||||
orgChild3Id : IsNull() || "",
|
||||
orgChild4Id : IsNull() || "",
|
||||
current_holderId: IsNull() && "",
|
||||
},
|
||||
});
|
||||
totalPositionNextUse = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgRootId: Not(IsNull()) || Not(""),
|
||||
orgChild1Id : Not(IsNull()) || Not(""),
|
||||
orgChild2Id : requestBody.id,
|
||||
orgChild3Id : IsNull() || "",
|
||||
orgChild4Id : IsNull() || "",
|
||||
next_holderId: Not(IsNull()) && Not(""),
|
||||
},
|
||||
});
|
||||
totalPositionNextVacant = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgRootId: Not(IsNull()) || Not(""),
|
||||
orgChild1Id : Not(IsNull()) || Not(""),
|
||||
orgChild2Id : requestBody.id,
|
||||
orgChild3Id : IsNull() || "",
|
||||
orgChild4Id : IsNull() || "",
|
||||
next_holderId: IsNull() && "",
|
||||
},
|
||||
});
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
const NodeId = await this.posMasterRepository.findOne({
|
||||
where: { orgChild3Id: requestBody.id },
|
||||
});
|
||||
if (!NodeId) {
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id,
|
||||
);
|
||||
}
|
||||
totalPosition = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgRootId: Not(IsNull()) || Not(""),
|
||||
orgChild1Id : Not(IsNull()) || Not(""),
|
||||
orgChild2Id : Not(IsNull()) || Not(""),
|
||||
orgChild3Id : requestBody.id,
|
||||
orgChild4Id : IsNull() || "",
|
||||
},
|
||||
});
|
||||
totalPositionCurrentUse = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgRootId: Not(IsNull()) || Not(""),
|
||||
orgChild1Id : Not(IsNull()) || Not(""),
|
||||
orgChild2Id : Not(IsNull()) || Not(""),
|
||||
orgChild3Id : requestBody.id,
|
||||
orgChild4Id : IsNull() || "",
|
||||
current_holderId: Not(IsNull()) && Not(""),
|
||||
},
|
||||
});
|
||||
totalPositionCurrentVacant = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgRootId: Not(IsNull()) || Not(""),
|
||||
orgChild1Id : Not(IsNull()) || Not(""),
|
||||
orgChild2Id : Not(IsNull()) || Not(""),
|
||||
orgChild3Id : requestBody.id,
|
||||
orgChild4Id : IsNull() || "",
|
||||
current_holderId: IsNull() && "",
|
||||
},
|
||||
});
|
||||
totalPositionNextUse = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgRootId: Not(IsNull()) || Not(""),
|
||||
orgChild1Id : Not(IsNull()) || Not(""),
|
||||
orgChild2Id : Not(IsNull()) || Not(""),
|
||||
orgChild3Id : requestBody.id,
|
||||
orgChild4Id : IsNull() || "",
|
||||
next_holderId: Not(IsNull()) && Not(""),
|
||||
},
|
||||
});
|
||||
totalPositionNextVacant = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgRootId: Not(IsNull()) || Not(""),
|
||||
orgChild1Id : Not(IsNull()) || Not(""),
|
||||
orgChild2Id : Not(IsNull()) || Not(""),
|
||||
orgChild3Id : requestBody.id,
|
||||
orgChild4Id : IsNull() || "",
|
||||
next_holderId: IsNull() && "",
|
||||
},
|
||||
});
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
const NodeId = await this.posMasterRepository.findOne({
|
||||
where: { orgChild4Id: requestBody.id },
|
||||
});
|
||||
if (!NodeId) {
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id,
|
||||
);
|
||||
}
|
||||
totalPosition = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgRootId: Not(IsNull()) || Not(""),
|
||||
orgChild1Id : Not(IsNull()) || Not(""),
|
||||
orgChild2Id : Not(IsNull()) || Not(""),
|
||||
orgChild3Id : Not(IsNull()) || Not(""),
|
||||
orgChild4Id : requestBody.id,
|
||||
},
|
||||
});
|
||||
totalPositionCurrentUse = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgRootId: Not(IsNull()) || Not(""),
|
||||
orgChild1Id : Not(IsNull()) || Not(""),
|
||||
orgChild2Id : Not(IsNull()) || Not(""),
|
||||
orgChild3Id : Not(IsNull()) || Not(""),
|
||||
orgChild4Id : requestBody.id,
|
||||
current_holderId: Not(IsNull()) && Not(""),
|
||||
},
|
||||
});
|
||||
totalPositionCurrentVacant = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgRootId: Not(IsNull()) || Not(""),
|
||||
orgChild1Id : Not(IsNull()) || Not(""),
|
||||
orgChild2Id : Not(IsNull()) || Not(""),
|
||||
orgChild3Id : Not(IsNull()) || Not(""),
|
||||
orgChild4Id : requestBody.id,
|
||||
current_holderId: IsNull() && "",
|
||||
},
|
||||
});
|
||||
totalPositionNextUse = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgRootId: Not(IsNull()) || Not(""),
|
||||
orgChild1Id : Not(IsNull()) || Not(""),
|
||||
orgChild2Id : Not(IsNull()) || Not(""),
|
||||
orgChild3Id : Not(IsNull()) || Not(""),
|
||||
orgChild4Id : requestBody.id,
|
||||
next_holderId: Not(IsNull()) && Not(""),
|
||||
},
|
||||
});
|
||||
totalPositionNextVacant = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgRootId: Not(IsNull()) || Not(""),
|
||||
orgChild1Id : Not(IsNull()) || Not(""),
|
||||
orgChild2Id : Not(IsNull()) || Not(""),
|
||||
orgChild3Id : Not(IsNull()) || Not(""),
|
||||
orgChild4Id : requestBody.id,
|
||||
next_holderId: IsNull() && "",
|
||||
},
|
||||
});
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
summary = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue