fix create position
This commit is contained in:
parent
2f94ee747e
commit
b222cbae3f
1 changed files with 12 additions and 3 deletions
|
|
@ -964,34 +964,40 @@ export class PositionController extends Controller {
|
|||
|
||||
let orgRoot: any = null;
|
||||
let SName: any = null;
|
||||
let revisionId:any = null;
|
||||
if (requestBody.orgRootId != null)
|
||||
orgRoot = await this.orgRootRepository.findOne({
|
||||
where: { id: requestBody.orgRootId },
|
||||
});
|
||||
revisionId = orgRoot.orgRevisionId;
|
||||
if (!orgRoot) {
|
||||
let orgChild1: any = null;
|
||||
if (requestBody.orgChild1Id != null)
|
||||
orgChild1 = await this.child1Repository.findOne({
|
||||
where: { id: requestBody.orgChild1Id },
|
||||
});
|
||||
revisionId = orgChild1.orgRevisionId;
|
||||
if (!orgChild1) {
|
||||
let orgChild2: any = null;
|
||||
if (requestBody.orgChild2Id != null)
|
||||
orgChild2 = await this.child2Repository.findOne({
|
||||
where: { id: requestBody.orgChild2Id },
|
||||
});
|
||||
revisionId = orgChild2.orgRevisionId;
|
||||
if (!orgChild2) {
|
||||
let orgChild3: any = null;
|
||||
if (requestBody.orgChild3Id != null)
|
||||
orgChild3 = await this.child3Repository.findOne({
|
||||
where: { id: requestBody.orgChild3Id },
|
||||
});
|
||||
revisionId = orgChild3.orgRevisionId;
|
||||
if (!orgChild3) {
|
||||
let orgChild4: any = null;
|
||||
if (requestBody.orgChild4Id != null)
|
||||
orgChild4 = await this.child4Repository.findOne({
|
||||
where: { id: requestBody.orgChild4Id },
|
||||
});
|
||||
revisionId = orgChild4.orgRevisionId;
|
||||
if (!orgChild4) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลโครงสร้าง");
|
||||
} else {
|
||||
|
|
@ -1169,9 +1175,12 @@ export class PositionController extends Controller {
|
|||
);
|
||||
}
|
||||
const before = null;
|
||||
const chkRevision = await this.orgRevisionRepository.findOne({
|
||||
where: { id: orgRoot.orgRevisionId },
|
||||
});
|
||||
let chkRevision:any = null;
|
||||
if(revisionId){
|
||||
chkRevision = await this.orgRevisionRepository.findOne({
|
||||
where: { id: revisionId },
|
||||
});
|
||||
}
|
||||
posMaster.createdUserId = request.user.sub;
|
||||
posMaster.createdFullName = request.user.name;
|
||||
posMaster.lastUpdateUserId = request.user.sub;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue