Merge branch 'develop' into adiDev
This commit is contained in:
commit
21aa51ff99
4 changed files with 275 additions and 27 deletions
|
|
@ -397,35 +397,30 @@ export class PositionController extends Controller {
|
|||
orgRoot = await this.orgRootRepository.findOne({
|
||||
where: { id: requestBody.orgRootId },
|
||||
});
|
||||
SName = orgRoot.orgRootShortName;
|
||||
if (!orgRoot) {
|
||||
let orgChild1: any = null;
|
||||
if (requestBody.orgChild1Id != null)
|
||||
orgChild1 = await this.child1Repository.findOne({
|
||||
where: { id: requestBody.orgChild1Id },
|
||||
});
|
||||
SName = orgChild1.orgChild1ShortName;
|
||||
if (!orgChild1) {
|
||||
let orgChild2: any = null;
|
||||
if (requestBody.orgChild2Id != null)
|
||||
orgChild2 = await this.child2Repository.findOne({
|
||||
where: { id: requestBody.orgChild2Id },
|
||||
});
|
||||
SName = orgChild2.orgChild2ShortName;
|
||||
if (!orgChild2) {
|
||||
let orgChild3: any = null;
|
||||
if (requestBody.orgChild3Id != null)
|
||||
orgChild3 = await this.child3Repository.findOne({
|
||||
where: { id: requestBody.orgChild3Id },
|
||||
});
|
||||
SName = orgChild3.orgChild3ShortName;
|
||||
if (!orgChild3) {
|
||||
let orgChild4: any = null;
|
||||
if (requestBody.orgChild4Id != null)
|
||||
orgChild4 = await this.child4Repository.findOne({
|
||||
where: { id: requestBody.orgChild4Id },
|
||||
});
|
||||
SName = orgChild4.orgChild4ShortName;
|
||||
if (!orgChild4) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลโครงสร้าง");
|
||||
} else {
|
||||
|
|
@ -445,6 +440,7 @@ export class PositionController extends Controller {
|
|||
posMaster.orgChild3Id = orgChild4.orgChild3Id;
|
||||
posMaster.orgChild4Id = orgChild4.id;
|
||||
posMaster.orgRevisionId = orgChild4.orgRevisionId;
|
||||
SName = orgChild4.orgChild4ShortName;
|
||||
}
|
||||
} else {
|
||||
const order: any = await this.posMasterRepository.findOne({
|
||||
|
|
@ -463,6 +459,7 @@ export class PositionController extends Controller {
|
|||
posMaster.orgChild2Id = orgChild3.orgChild2Id;
|
||||
posMaster.orgChild3Id = orgChild3.id;
|
||||
posMaster.orgRevisionId = orgChild3.orgRevisionId;
|
||||
SName = orgChild3.orgChild3ShortName;
|
||||
}
|
||||
} else {
|
||||
const order: any = await this.posMasterRepository.findOne({
|
||||
|
|
@ -481,6 +478,7 @@ export class PositionController extends Controller {
|
|||
posMaster.orgChild1Id = orgChild2.orgChild1Id;
|
||||
posMaster.orgChild2Id = orgChild2.id;
|
||||
posMaster.orgRevisionId = orgChild2.orgRevisionId;
|
||||
SName = orgChild2.orgChild2ShortName;
|
||||
}
|
||||
} else {
|
||||
const order: any = await this.posMasterRepository.findOne({
|
||||
|
|
@ -499,6 +497,7 @@ export class PositionController extends Controller {
|
|||
posMaster.orgRootId = orgChild1.orgRootId;
|
||||
posMaster.orgChild1Id = orgChild1.id;
|
||||
posMaster.orgRevisionId = orgChild1.orgRevisionId;
|
||||
SName = orgChild1.orgChild1ShortName;
|
||||
}
|
||||
} else {
|
||||
const order: any = await this.posMasterRepository.findOne({
|
||||
|
|
@ -517,6 +516,7 @@ export class PositionController extends Controller {
|
|||
: 1;
|
||||
posMaster.orgRootId = orgRoot.id;
|
||||
posMaster.orgRevisionId = orgRoot.orgRevisionId;
|
||||
SName = orgRoot.orgRootShortName;
|
||||
}
|
||||
|
||||
const chk_SName0 = await this.posMasterRepository.findOne({
|
||||
|
|
@ -680,35 +680,30 @@ export class PositionController extends Controller {
|
|||
orgRoot = await this.orgRootRepository.findOne({
|
||||
where: { id: requestBody.orgRootId },
|
||||
});
|
||||
SName = orgRoot.orgRootShortName;
|
||||
if (!orgRoot) {
|
||||
let orgChild1: any = null;
|
||||
if (requestBody.orgChild1Id != null)
|
||||
orgChild1 = await this.child1Repository.findOne({
|
||||
where: { id: requestBody.orgChild1Id },
|
||||
});
|
||||
SName = orgChild1.orgChild1ShortName;
|
||||
if (!orgChild1) {
|
||||
let orgChild2: any = null;
|
||||
if (requestBody.orgChild2Id != null)
|
||||
orgChild2 = await this.child2Repository.findOne({
|
||||
where: { id: requestBody.orgChild2Id },
|
||||
});
|
||||
SName = orgChild2.orgChild2ShortName;
|
||||
if (!orgChild2) {
|
||||
let orgChild3: any = null;
|
||||
if (requestBody.orgChild3Id != null)
|
||||
orgChild3 = await this.child3Repository.findOne({
|
||||
where: { id: requestBody.orgChild3Id },
|
||||
});
|
||||
SName = orgChild3.orgChild3ShortName;
|
||||
if (!orgChild3) {
|
||||
let orgChild4: any = null;
|
||||
if (requestBody.orgChild4Id != null)
|
||||
orgChild4 = await this.child4Repository.findOne({
|
||||
where: { id: requestBody.orgChild4Id },
|
||||
});
|
||||
SName = orgChild4.orgChild4ShortName;
|
||||
if (!orgChild4) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลโครงสร้าง");
|
||||
} else {
|
||||
|
|
@ -718,6 +713,7 @@ export class PositionController extends Controller {
|
|||
posMaster.orgChild3Id = orgChild4.orgChild3Id;
|
||||
posMaster.orgChild4Id = orgChild4.id;
|
||||
posMaster.orgRevisionId = orgChild4.orgRevisionId;
|
||||
SName = orgChild4.orgChild4ShortName;
|
||||
}
|
||||
} else {
|
||||
posMaster.orgRootId = orgChild3.orgRootId;
|
||||
|
|
@ -725,21 +721,25 @@ export class PositionController extends Controller {
|
|||
posMaster.orgChild2Id = orgChild3.orgChild2Id;
|
||||
posMaster.orgChild3Id = orgChild3.id;
|
||||
posMaster.orgRevisionId = orgChild3.orgRevisionId;
|
||||
SName = orgChild3.orgChild3ShortName;
|
||||
}
|
||||
} else {
|
||||
posMaster.orgRootId = orgChild2.orgRootId;
|
||||
posMaster.orgChild1Id = orgChild2.orgChild1Id;
|
||||
posMaster.orgChild2Id = orgChild2.id;
|
||||
posMaster.orgRevisionId = orgChild2.orgRevisionId;
|
||||
SName = orgChild2.orgChild2ShortName;
|
||||
}
|
||||
} else {
|
||||
posMaster.orgRootId = orgChild1.orgRootId;
|
||||
posMaster.orgChild1Id = orgChild1.id;
|
||||
posMaster.orgRevisionId = orgChild1.orgRevisionId;
|
||||
SName = orgChild1.orgChild1ShortName;
|
||||
}
|
||||
} else {
|
||||
posMaster.orgRootId = orgRoot.id;
|
||||
posMaster.orgRevisionId = orgRoot.orgRevisionId;
|
||||
SName = orgRoot.orgRootShortName;
|
||||
}
|
||||
|
||||
const chk_SName0 = await this.posMasterRepository.findOne({
|
||||
|
|
@ -1971,10 +1971,7 @@ export class PositionController extends Controller {
|
|||
relations: ["positions"],
|
||||
});
|
||||
if (!dataMaster) {
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่พบข้อมูลตำแหน่งนี้"
|
||||
);
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งนี้");
|
||||
}
|
||||
dataMaster.positions.forEach(async (position) => {
|
||||
if (position.id === requestBody.position) {
|
||||
|
|
@ -2045,10 +2042,7 @@ export class PositionController extends Controller {
|
|||
},
|
||||
});
|
||||
if (!dataPublish) {
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่พบข้อมูลตำแหน่งนี้",
|
||||
);
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งนี้");
|
||||
}
|
||||
|
||||
const dataDraft = await this.posMasterRepository.findOne({
|
||||
|
|
@ -2057,10 +2051,7 @@ export class PositionController extends Controller {
|
|||
},
|
||||
});
|
||||
if (!dataDraft) {
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่พบข้อมูลตำแหน่งนี้"
|
||||
);
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งนี้");
|
||||
}
|
||||
|
||||
await this.posMasterRepository.update(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue