no message
This commit is contained in:
parent
89beced8cc
commit
ed862a3802
1 changed files with 198 additions and 188 deletions
|
|
@ -335,13 +335,14 @@ export class PositionController extends Controller {
|
|||
if (!orgChild4) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลโครงสร้าง");
|
||||
} else {
|
||||
const order:any = await this.posMasterRepository.findOne({
|
||||
const order: any = await this.posMasterRepository.findOne({
|
||||
where: {
|
||||
orgChild4Id: orgChild4.id
|
||||
orgChild4Id: orgChild4.id,
|
||||
},
|
||||
order: { posMasterNo: "DESC" }
|
||||
})
|
||||
posMaster.posMasterOrder = order.posMasterOrder == null ? 1: order.posMasterOrder+1
|
||||
order: { posMasterNo: "DESC" },
|
||||
});
|
||||
posMaster.posMasterOrder =
|
||||
order.posMasterOrder == null ? 1 : order.posMasterOrder + 1;
|
||||
posMaster.orgRootId = orgChild4.orgRootId;
|
||||
posMaster.orgChild1Id = orgChild4.orgChild1Id;
|
||||
posMaster.orgChild2Id = orgChild4.orgChild2Id;
|
||||
|
|
@ -350,14 +351,14 @@ export class PositionController extends Controller {
|
|||
posMaster.orgRevisionId = orgChild4.orgRevisionId;
|
||||
}
|
||||
} else {
|
||||
const order:any = await this.posMasterRepository.findOne({
|
||||
where: {
|
||||
const order: any = await this.posMasterRepository.findOne({
|
||||
where: {
|
||||
orgChild3Id: orgChild3.id,
|
||||
orgChild4Id: IsNull() || ""
|
||||
orgChild4Id: IsNull() || "",
|
||||
},
|
||||
order: { posMasterNo: "DESC" }
|
||||
})
|
||||
posMaster.posMasterOrder = order.posMasterOrder == null ? 1: order.posMasterOrder+1
|
||||
order: { posMasterNo: "DESC" },
|
||||
});
|
||||
posMaster.posMasterOrder = order.posMasterOrder == null ? 1 : order.posMasterOrder + 1;
|
||||
posMaster.orgRootId = orgChild3.orgRootId;
|
||||
posMaster.orgChild1Id = orgChild3.orgChild1Id;
|
||||
posMaster.orgChild2Id = orgChild3.orgChild2Id;
|
||||
|
|
@ -365,47 +366,47 @@ export class PositionController extends Controller {
|
|||
posMaster.orgRevisionId = orgChild3.orgRevisionId;
|
||||
}
|
||||
} else {
|
||||
const order:any = await this.posMasterRepository.findOne({
|
||||
where: {
|
||||
const order: any = await this.posMasterRepository.findOne({
|
||||
where: {
|
||||
orgChild2Id: orgChild2.id,
|
||||
orgChild3Id: IsNull() || "",
|
||||
orgChild4Id: IsNull() || "",
|
||||
},
|
||||
order: { posMasterNo: "DESC" }
|
||||
})
|
||||
posMaster.posMasterOrder = order.posMasterOrder == null ? 1: order.posMasterOrder+1
|
||||
order: { posMasterNo: "DESC" },
|
||||
});
|
||||
posMaster.posMasterOrder = order.posMasterOrder == null ? 1 : order.posMasterOrder + 1;
|
||||
posMaster.orgRootId = orgChild2.orgRootId;
|
||||
posMaster.orgChild1Id = orgChild2.orgChild1Id;
|
||||
posMaster.orgChild2Id = orgChild2.id;
|
||||
posMaster.orgRevisionId = orgChild2.orgRevisionId;
|
||||
}
|
||||
} else {
|
||||
const order:any = await this.posMasterRepository.findOne({
|
||||
where: {
|
||||
const order: any = await this.posMasterRepository.findOne({
|
||||
where: {
|
||||
orgChild1Id: orgChild1.id,
|
||||
orgChild2Id: IsNull() || "",
|
||||
orgChild3Id: IsNull() || "",
|
||||
orgChild4Id: IsNull() || "",
|
||||
},
|
||||
order: { posMasterNo: "DESC" }
|
||||
})
|
||||
posMaster.posMasterOrder = order.posMasterOrder == null ? 1: order.posMasterOrder+1
|
||||
order: { posMasterNo: "DESC" },
|
||||
});
|
||||
posMaster.posMasterOrder = order.posMasterOrder == null ? 1 : order.posMasterOrder + 1;
|
||||
posMaster.orgRootId = orgChild1.orgRootId;
|
||||
posMaster.orgChild1Id = orgChild1.id;
|
||||
posMaster.orgRevisionId = orgChild1.orgRevisionId;
|
||||
}
|
||||
} else {
|
||||
const order:any = await this.posMasterRepository.findOne({
|
||||
where: {
|
||||
const order: any = await this.posMasterRepository.findOne({
|
||||
where: {
|
||||
orgRootId: orgRoot.id,
|
||||
orgChild1Id: IsNull() || "",
|
||||
orgChild2Id: IsNull() || "",
|
||||
orgChild3Id: IsNull() || "",
|
||||
orgChild4Id: IsNull() || "",
|
||||
},
|
||||
order: { posMasterNo: "DESC" }
|
||||
})
|
||||
posMaster.posMasterOrder = order.posMasterOrder == null ? 1: order.posMasterOrder+1
|
||||
order: { posMasterNo: "DESC" },
|
||||
});
|
||||
posMaster.posMasterOrder = order.posMasterOrder == null ? 1 : order.posMasterOrder + 1;
|
||||
posMaster.orgRootId = orgRoot.id;
|
||||
posMaster.orgRevisionId = orgRoot.orgRevisionId;
|
||||
}
|
||||
|
|
@ -790,47 +791,47 @@ export class PositionController extends Controller {
|
|||
let shortName = "";
|
||||
|
||||
// if (body.isAll === true) {
|
||||
if (
|
||||
posMaster.orgRootId !== null &&
|
||||
posMaster.orgChild1Id == null &&
|
||||
posMaster.orgChild2Id == null &&
|
||||
posMaster.orgChild3Id == null
|
||||
) {
|
||||
body.type = 0;
|
||||
shortName = posMaster.orgRoot.orgRootShortName;
|
||||
} else if (
|
||||
posMaster.orgRootId !== null &&
|
||||
posMaster.orgChild1Id !== null &&
|
||||
posMaster.orgChild2Id == null &&
|
||||
posMaster.orgChild3Id == null
|
||||
) {
|
||||
body.type = 1;
|
||||
shortName = posMaster.orgChild1.orgChild1ShortName;
|
||||
} else if (
|
||||
posMaster.orgRootId !== null &&
|
||||
posMaster.orgChild1Id !== null &&
|
||||
posMaster.orgChild2Id !== null &&
|
||||
posMaster.orgChild3Id == null
|
||||
) {
|
||||
body.type = 2;
|
||||
shortName = posMaster.orgChild2.orgChild2ShortName;
|
||||
} else if (
|
||||
posMaster.orgRootId !== null &&
|
||||
posMaster.orgChild1Id !== null &&
|
||||
posMaster.orgChild2Id !== null &&
|
||||
posMaster.orgChild3Id !== null
|
||||
) {
|
||||
body.type = 3;
|
||||
shortName = posMaster.orgChild3.orgChild3ShortName;
|
||||
} else if (
|
||||
posMaster.orgRootId !== null &&
|
||||
posMaster.orgChild1Id !== null &&
|
||||
posMaster.orgChild2Id !== null &&
|
||||
posMaster.orgChild3Id !== null
|
||||
) {
|
||||
body.type = 4;
|
||||
shortName = posMaster.orgChild4.orgChild4ShortName;
|
||||
}
|
||||
if (
|
||||
posMaster.orgRootId !== null &&
|
||||
posMaster.orgChild1Id == null &&
|
||||
posMaster.orgChild2Id == null &&
|
||||
posMaster.orgChild3Id == null
|
||||
) {
|
||||
body.type = 0;
|
||||
shortName = posMaster.orgRoot.orgRootShortName;
|
||||
} else if (
|
||||
posMaster.orgRootId !== null &&
|
||||
posMaster.orgChild1Id !== null &&
|
||||
posMaster.orgChild2Id == null &&
|
||||
posMaster.orgChild3Id == null
|
||||
) {
|
||||
body.type = 1;
|
||||
shortName = posMaster.orgChild1.orgChild1ShortName;
|
||||
} else if (
|
||||
posMaster.orgRootId !== null &&
|
||||
posMaster.orgChild1Id !== null &&
|
||||
posMaster.orgChild2Id !== null &&
|
||||
posMaster.orgChild3Id == null
|
||||
) {
|
||||
body.type = 2;
|
||||
shortName = posMaster.orgChild2.orgChild2ShortName;
|
||||
} else if (
|
||||
posMaster.orgRootId !== null &&
|
||||
posMaster.orgChild1Id !== null &&
|
||||
posMaster.orgChild2Id !== null &&
|
||||
posMaster.orgChild3Id !== null
|
||||
) {
|
||||
body.type = 3;
|
||||
shortName = posMaster.orgChild3.orgChild3ShortName;
|
||||
} else if (
|
||||
posMaster.orgRootId !== null &&
|
||||
posMaster.orgChild1Id !== null &&
|
||||
posMaster.orgChild2Id !== null &&
|
||||
posMaster.orgChild3Id !== null
|
||||
) {
|
||||
body.type = 4;
|
||||
shortName = posMaster.orgChild4.orgChild4ShortName;
|
||||
}
|
||||
// }
|
||||
|
||||
return {
|
||||
|
|
@ -1051,7 +1052,12 @@ export class PositionController extends Controller {
|
|||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งตามไอดีนี้ : " + id);
|
||||
}
|
||||
const posMasters = await this.posMasterRepository.find({
|
||||
where: { ancestorDNA: posMaster.ancestorDNA },
|
||||
where: {
|
||||
ancestorDNA:
|
||||
posMaster.ancestorDNA == null || posMaster.ancestorDNA == ""
|
||||
? "123"
|
||||
: posMaster.ancestorDNA,
|
||||
},
|
||||
order: { lastUpdatedAt: "DESC" },
|
||||
relations: ["orgRoot", "orgChild1", "orgChild2", "orgChild3", "orgChild4"],
|
||||
});
|
||||
|
|
@ -1069,10 +1075,10 @@ export class PositionController extends Controller {
|
|||
: item.orgChild4 == null
|
||||
? item.orgChild3.orgChild3ShortName
|
||||
: item.orgChild4.orgChild4ShortName,
|
||||
lastUpdatedAt: item.lastUpdatedAt?item.posMasterNo:null,
|
||||
posMasterNoPrefix: item.posMasterNoPrefix?item.posMasterNoPrefix:null,
|
||||
posMasterNo: item.posMasterNo?item.posMasterNo:null,
|
||||
posMasterNoSuffix: item.posMasterNoSuffix?item.posMasterNoSuffix:null,
|
||||
lastUpdatedAt: item.lastUpdatedAt ? item.posMasterNo : null,
|
||||
posMasterNoPrefix: item.posMasterNoPrefix ? item.posMasterNoPrefix : null,
|
||||
posMasterNo: item.posMasterNo ? item.posMasterNo : null,
|
||||
posMasterNoSuffix: item.posMasterNoSuffix ? item.posMasterNoSuffix : null,
|
||||
}));
|
||||
return new HttpSuccess(_data);
|
||||
}
|
||||
|
|
@ -1183,7 +1189,7 @@ export class PositionController extends Controller {
|
|||
let totalPositionNextUse: any;
|
||||
let totalPositionNextVacant: any;
|
||||
|
||||
if(requestBody.isNode === true){
|
||||
if (requestBody.isNode === true) {
|
||||
switch (requestBody.type) {
|
||||
case 0: {
|
||||
const NodeId = await this.posMasterRepository.findOne({
|
||||
|
|
@ -1383,8 +1389,7 @@ export class PositionController extends Controller {
|
|||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
switch (requestBody.type) {
|
||||
case 0: {
|
||||
const NodeId = await this.posMasterRepository.findOne({
|
||||
|
|
@ -1399,49 +1404,49 @@ export class PositionController extends Controller {
|
|||
totalPosition = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgRootId: requestBody.id,
|
||||
orgChild1Id : IsNull() || "",
|
||||
orgChild2Id : IsNull() || "",
|
||||
orgChild3Id : IsNull() || "",
|
||||
orgChild4Id : IsNull() || "",
|
||||
orgChild1Id: IsNull() || "",
|
||||
orgChild2Id: IsNull() || "",
|
||||
orgChild3Id: IsNull() || "",
|
||||
orgChild4Id: IsNull() || "",
|
||||
},
|
||||
});
|
||||
totalPositionCurrentUse = await this.posMasterRepository.count({
|
||||
where: {
|
||||
where: {
|
||||
orgRootId: requestBody.id,
|
||||
orgChild1Id : IsNull() || "",
|
||||
orgChild2Id : IsNull() || "",
|
||||
orgChild3Id : IsNull() || "",
|
||||
orgChild4Id : IsNull() || "",
|
||||
orgChild1Id: IsNull() || "",
|
||||
orgChild2Id: IsNull() || "",
|
||||
orgChild3Id: IsNull() || "",
|
||||
orgChild4Id: IsNull() || "",
|
||||
current_holderId: Not(IsNull()) || Not(""),
|
||||
},
|
||||
});
|
||||
totalPositionCurrentVacant = await this.posMasterRepository.count({
|
||||
where: {
|
||||
where: {
|
||||
orgRootId: requestBody.id,
|
||||
orgChild1Id : IsNull() || "",
|
||||
orgChild2Id : IsNull() || "",
|
||||
orgChild3Id : IsNull() || "",
|
||||
orgChild4Id : IsNull() || "",
|
||||
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() || "",
|
||||
orgChild1Id: IsNull() || "",
|
||||
orgChild2Id: IsNull() || "",
|
||||
orgChild3Id: IsNull() || "",
|
||||
orgChild4Id: IsNull() || "",
|
||||
next_holderId: Not(IsNull()) || Not(""),
|
||||
},
|
||||
});
|
||||
totalPositionNextVacant = await this.posMasterRepository.count({
|
||||
where: {
|
||||
where: {
|
||||
orgRootId: requestBody.id,
|
||||
orgChild1Id : IsNull() || "",
|
||||
orgChild2Id : IsNull() || "",
|
||||
orgChild3Id : IsNull() || "",
|
||||
orgChild4Id : IsNull() || "",
|
||||
orgChild1Id: IsNull() || "",
|
||||
orgChild2Id: IsNull() || "",
|
||||
orgChild3Id: IsNull() || "",
|
||||
orgChild4Id: IsNull() || "",
|
||||
next_holderId: IsNull() || "",
|
||||
},
|
||||
});
|
||||
|
|
@ -1460,49 +1465,49 @@ export class PositionController extends Controller {
|
|||
totalPosition = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgRootId: Not(IsNull()) || Not(""),
|
||||
orgChild1Id : requestBody.id,
|
||||
orgChild2Id : IsNull() || "",
|
||||
orgChild3Id : IsNull() || "",
|
||||
orgChild4Id : IsNull() || "",
|
||||
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() || "",
|
||||
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() || "",
|
||||
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() || "",
|
||||
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() || "",
|
||||
orgChild1Id: requestBody.id,
|
||||
orgChild2Id: IsNull() || "",
|
||||
orgChild3Id: IsNull() || "",
|
||||
orgChild4Id: IsNull() || "",
|
||||
next_holderId: IsNull() && "",
|
||||
},
|
||||
});
|
||||
|
|
@ -1521,49 +1526,49 @@ export class PositionController extends Controller {
|
|||
totalPosition = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgRootId: Not(IsNull()) || Not(""),
|
||||
orgChild1Id : Not(IsNull()) || Not(""),
|
||||
orgChild2Id : requestBody.id,
|
||||
orgChild3Id : IsNull() || "",
|
||||
orgChild4Id : IsNull() || "",
|
||||
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() || "",
|
||||
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() || "",
|
||||
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() || "",
|
||||
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() || "",
|
||||
orgChild1Id: Not(IsNull()) || Not(""),
|
||||
orgChild2Id: requestBody.id,
|
||||
orgChild3Id: IsNull() || "",
|
||||
orgChild4Id: IsNull() || "",
|
||||
next_holderId: IsNull() && "",
|
||||
},
|
||||
});
|
||||
|
|
@ -1582,49 +1587,49 @@ export class PositionController extends Controller {
|
|||
totalPosition = await this.posMasterRepository.count({
|
||||
where: {
|
||||
orgRootId: Not(IsNull()) || Not(""),
|
||||
orgChild1Id : Not(IsNull()) || Not(""),
|
||||
orgChild2Id : Not(IsNull()) || Not(""),
|
||||
orgChild3Id : requestBody.id,
|
||||
orgChild4Id : IsNull() || "",
|
||||
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() || "",
|
||||
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() || "",
|
||||
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() || "",
|
||||
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() || "",
|
||||
orgChild1Id: Not(IsNull()) || Not(""),
|
||||
orgChild2Id: Not(IsNull()) || Not(""),
|
||||
orgChild3Id: requestBody.id,
|
||||
orgChild4Id: IsNull() || "",
|
||||
next_holderId: IsNull() && "",
|
||||
},
|
||||
});
|
||||
|
|
@ -1642,50 +1647,50 @@ export class PositionController extends Controller {
|
|||
}
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
orgRootId: Not(IsNull()) || Not(""),
|
||||
orgChild1Id: Not(IsNull()) || Not(""),
|
||||
orgChild2Id: Not(IsNull()) || Not(""),
|
||||
orgChild3Id: Not(IsNull()) || Not(""),
|
||||
orgChild4Id: requestBody.id,
|
||||
next_holderId: IsNull() && "",
|
||||
},
|
||||
});
|
||||
|
|
@ -1789,23 +1794,28 @@ export class PositionController extends Controller {
|
|||
*
|
||||
*/
|
||||
@Post("dna")
|
||||
async dna(@Body() requestBody: { draftPositionId: string; publishPositionId: string;}) {
|
||||
async dna(@Body() requestBody: { draftPositionId: string; publishPositionId: string }) {
|
||||
const dataDraft = await this.posMasterRepository.findOne({
|
||||
where: { id: requestBody.draftPositionId },
|
||||
});
|
||||
if (!dataDraft) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดีนี้(draftPositionId) : " + requestBody.draftPositionId);
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่พบข้อมูลไอดีนี้(draftPositionId) : " + requestBody.draftPositionId,
|
||||
);
|
||||
}
|
||||
|
||||
const dataPublish = await this.posMasterRepository.findOne({
|
||||
where: { id: requestBody.publishPositionId },
|
||||
});
|
||||
if (!dataPublish) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดีนี้(publishPositionId) : " + requestBody.publishPositionId);
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่พบข้อมูลไอดีนี้(publishPositionId) : " + requestBody.publishPositionId,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
|
||||
dataDraft.ancestorDNA = dataPublish.ancestorDNA;
|
||||
await this.posMasterRepository.save(dataDraft);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue