no message
This commit is contained in:
parent
6b2f1c99d8
commit
4ea60efd1a
1 changed files with 56 additions and 53 deletions
|
|
@ -607,9 +607,9 @@ export class PositionController extends Controller {
|
||||||
orgChild1Id: IsNull(),
|
orgChild1Id: IsNull(),
|
||||||
posMasterNo: requestBody.posMasterNo,
|
posMasterNo: requestBody.posMasterNo,
|
||||||
},
|
},
|
||||||
relations: ['orgRoot'],
|
relations: ["orgRoot"],
|
||||||
});
|
});
|
||||||
if (chk_SName0 != null){
|
if (chk_SName0 != null) {
|
||||||
throw new HttpError(
|
throw new HttpError(
|
||||||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||||
"ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
|
"ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
|
||||||
|
|
@ -623,9 +623,9 @@ export class PositionController extends Controller {
|
||||||
orgChild2Id: IsNull(),
|
orgChild2Id: IsNull(),
|
||||||
posMasterNo: requestBody.posMasterNo,
|
posMasterNo: requestBody.posMasterNo,
|
||||||
},
|
},
|
||||||
relations: ['orgChild1'],
|
relations: ["orgChild1"],
|
||||||
});
|
});
|
||||||
if (chk_SName1 != null){
|
if (chk_SName1 != null) {
|
||||||
throw new HttpError(
|
throw new HttpError(
|
||||||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||||
"ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
|
"ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
|
||||||
|
|
@ -639,9 +639,9 @@ export class PositionController extends Controller {
|
||||||
orgChild3Id: IsNull(),
|
orgChild3Id: IsNull(),
|
||||||
posMasterNo: requestBody.posMasterNo,
|
posMasterNo: requestBody.posMasterNo,
|
||||||
},
|
},
|
||||||
relations: ['orgChild2'],
|
relations: ["orgChild2"],
|
||||||
});
|
});
|
||||||
if (chk_SName2 != null){
|
if (chk_SName2 != null) {
|
||||||
throw new HttpError(
|
throw new HttpError(
|
||||||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||||
"ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
|
"ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
|
||||||
|
|
@ -655,9 +655,9 @@ export class PositionController extends Controller {
|
||||||
orgChild4Id: IsNull(),
|
orgChild4Id: IsNull(),
|
||||||
posMasterNo: requestBody.posMasterNo,
|
posMasterNo: requestBody.posMasterNo,
|
||||||
},
|
},
|
||||||
relations: ['orgChild3'],
|
relations: ["orgChild3"],
|
||||||
});
|
});
|
||||||
if (chk_SName3 != null){
|
if (chk_SName3 != null) {
|
||||||
throw new HttpError(
|
throw new HttpError(
|
||||||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||||
"ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
|
"ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
|
||||||
|
|
@ -670,9 +670,9 @@ export class PositionController extends Controller {
|
||||||
orgChild4: { orgChild4ShortName: SName },
|
orgChild4: { orgChild4ShortName: SName },
|
||||||
posMasterNo: requestBody.posMasterNo,
|
posMasterNo: requestBody.posMasterNo,
|
||||||
},
|
},
|
||||||
relations: ['orgChild4'],
|
relations: ["orgChild4"],
|
||||||
});
|
});
|
||||||
if (chk_SName4 != null){
|
if (chk_SName4 != null) {
|
||||||
throw new HttpError(
|
throw new HttpError(
|
||||||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||||
"ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
|
"ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
|
||||||
|
|
@ -689,9 +689,9 @@ export class PositionController extends Controller {
|
||||||
const position = Object.assign(new Position());
|
const position = Object.assign(new Position());
|
||||||
position.positionName = x.posDictName;
|
position.positionName = x.posDictName;
|
||||||
position.positionField = x.posDictField;
|
position.positionField = x.posDictField;
|
||||||
position.posTypeId = x.posTypeId;
|
position.posTypeId = x.posTypeId == "" ? null : x.posTypeId;
|
||||||
position.posLevelId = x.posLevelId;
|
position.posLevelId = x.posLevelId == "" ? null : x.posLevelId;
|
||||||
position.posExecutiveId = x.posExecutiveId;
|
position.posExecutiveId = x.posExecutiveId == "" ? null : x.posExecutiveId;
|
||||||
position.positionExecutiveField = x.posDictExecutiveField;
|
position.positionExecutiveField = x.posDictExecutiveField;
|
||||||
position.positionArea = x.posDictArea;
|
position.positionArea = x.posDictArea;
|
||||||
position.isSpecial = x.isSpecial;
|
position.isSpecial = x.isSpecial;
|
||||||
|
|
@ -909,11 +909,11 @@ export class PositionController extends Controller {
|
||||||
orgChild1: { orgChild1ShortName: SName },
|
orgChild1: { orgChild1ShortName: SName },
|
||||||
orgChild2Id: IsNull(),
|
orgChild2Id: IsNull(),
|
||||||
posMasterNo: requestBody.posMasterNo,
|
posMasterNo: requestBody.posMasterNo,
|
||||||
id: Not(posMaster.id)
|
id: Not(posMaster.id),
|
||||||
},
|
},
|
||||||
relations: ['orgChild1'],
|
relations: ["orgChild1"],
|
||||||
});
|
});
|
||||||
if (chk_SName1 != null){
|
if (chk_SName1 != null) {
|
||||||
throw new HttpError(
|
throw new HttpError(
|
||||||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||||
"ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
|
"ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
|
||||||
|
|
@ -926,11 +926,11 @@ export class PositionController extends Controller {
|
||||||
orgChild2: { orgChild2ShortName: SName },
|
orgChild2: { orgChild2ShortName: SName },
|
||||||
orgChild3Id: IsNull(),
|
orgChild3Id: IsNull(),
|
||||||
posMasterNo: requestBody.posMasterNo,
|
posMasterNo: requestBody.posMasterNo,
|
||||||
id: Not(posMaster.id)
|
id: Not(posMaster.id),
|
||||||
},
|
},
|
||||||
relations: ['orgChild2'],
|
relations: ["orgChild2"],
|
||||||
});
|
});
|
||||||
if (chk_SName2 != null){
|
if (chk_SName2 != null) {
|
||||||
throw new HttpError(
|
throw new HttpError(
|
||||||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||||
"ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
|
"ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
|
||||||
|
|
@ -943,11 +943,11 @@ export class PositionController extends Controller {
|
||||||
orgChild3: { orgChild3ShortName: SName },
|
orgChild3: { orgChild3ShortName: SName },
|
||||||
orgChild4Id: IsNull(),
|
orgChild4Id: IsNull(),
|
||||||
posMasterNo: requestBody.posMasterNo,
|
posMasterNo: requestBody.posMasterNo,
|
||||||
id: Not(posMaster.id)
|
id: Not(posMaster.id),
|
||||||
},
|
},
|
||||||
relations: ['orgChild3'],
|
relations: ["orgChild3"],
|
||||||
});
|
});
|
||||||
if (chk_SName3 != null){
|
if (chk_SName3 != null) {
|
||||||
throw new HttpError(
|
throw new HttpError(
|
||||||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||||
"ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
|
"ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
|
||||||
|
|
@ -959,11 +959,11 @@ export class PositionController extends Controller {
|
||||||
orgRevisionId: posMaster.orgRevisionId,
|
orgRevisionId: posMaster.orgRevisionId,
|
||||||
orgChild4: { orgChild4ShortName: SName },
|
orgChild4: { orgChild4ShortName: SName },
|
||||||
posMasterNo: requestBody.posMasterNo,
|
posMasterNo: requestBody.posMasterNo,
|
||||||
id: Not(posMaster.id)
|
id: Not(posMaster.id),
|
||||||
},
|
},
|
||||||
relations: ['orgChild4'],
|
relations: ["orgChild4"],
|
||||||
});
|
});
|
||||||
if (chk_SName4 != null){
|
if (chk_SName4 != null) {
|
||||||
throw new HttpError(
|
throw new HttpError(
|
||||||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||||
"ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
|
"ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
|
||||||
|
|
@ -976,13 +976,15 @@ export class PositionController extends Controller {
|
||||||
posMaster.lastUpdateFullName = request.user.name;
|
posMaster.lastUpdateFullName = request.user.name;
|
||||||
await this.posMasterRepository.save(posMaster);
|
await this.posMasterRepository.save(posMaster);
|
||||||
await this.positionRepository.delete({ posMasterId: posMaster.id });
|
await this.positionRepository.delete({ posMasterId: posMaster.id });
|
||||||
requestBody.positions.forEach(async (x: any) => {
|
|
||||||
|
await Promise.all(
|
||||||
|
requestBody.positions.map(async (x: any) => {
|
||||||
const position = Object.assign(new Position());
|
const position = Object.assign(new Position());
|
||||||
position.positionName = x.posDictName;
|
position.positionName = x.posDictName;
|
||||||
position.positionField = x.posDictField;
|
position.positionField = x.posDictField;
|
||||||
position.posTypeId = x.posTypeId;
|
position.posTypeId = x.posTypeId == "" ? null : x.posTypeId;
|
||||||
position.posLevelId = x.posLevelId;
|
position.posLevelId = x.posLevelId == "" ? null : x.posLevelId;
|
||||||
position.posExecutiveId = x.posExecutiveId;
|
position.posExecutiveId = x.posExecutiveId == "" ? null : x.posExecutiveId;
|
||||||
position.positionExecutiveField = x.posDictExecutiveField;
|
position.positionExecutiveField = x.posDictExecutiveField;
|
||||||
position.positionArea = x.posDictArea;
|
position.positionArea = x.posDictArea;
|
||||||
position.isSpecial = x.isSpecial;
|
position.isSpecial = x.isSpecial;
|
||||||
|
|
@ -993,7 +995,8 @@ export class PositionController extends Controller {
|
||||||
position.lastUpdateUserId = request.user.sub;
|
position.lastUpdateUserId = request.user.sub;
|
||||||
position.lastUpdateFullName = request.user.name;
|
position.lastUpdateFullName = request.user.name;
|
||||||
await this.positionRepository.save(position);
|
await this.positionRepository.save(position);
|
||||||
});
|
}),
|
||||||
|
);
|
||||||
return new HttpSuccess(posMaster.id);
|
return new HttpSuccess(posMaster.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue