From cd301754237a94dc0482033ba9a0eef3381a5778 Mon Sep 17 00:00:00 2001 From: Bright Date: Wed, 21 Feb 2024 17:04:07 +0700 Subject: [PATCH] no message --- src/controllers/PositionController.ts | 145 -------------------------- 1 file changed, 145 deletions(-) diff --git a/src/controllers/PositionController.ts b/src/controllers/PositionController.ts index 40fb000b..18f7d311 100644 --- a/src/controllers/PositionController.ts +++ b/src/controllers/PositionController.ts @@ -451,17 +451,6 @@ export class PositionController extends Controller { }, order: { posMasterOrder: "DESC" }, }); - const dataDup: any = await this.posMasterRepository.findOne({ - where: { - orgChild4Id: orgChild4.id, - posMasterNo: requestBody.posMasterNo, - }, - }); - if (dataDup != null) - throw new HttpError( - HttpStatusCode.INTERNAL_SERVER_ERROR, - "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้", - ); posMaster.posMasterOrder = order !== null && order !== undefined && order.posMasterOrder ? order.posMasterOrder + 1 @@ -481,18 +470,6 @@ export class PositionController extends Controller { }, order: { posMasterOrder: "DESC" }, }); - const dataDup: any = await this.posMasterRepository.findOne({ - where: { - orgChild3Id: orgChild3.id, - orgChild4Id: IsNull() || "", - posMasterNo: requestBody.posMasterNo, - }, - }); - if (dataDup != null) - throw new HttpError( - HttpStatusCode.INTERNAL_SERVER_ERROR, - "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้", - ); posMaster.posMasterOrder = order !== null && order !== undefined && order.posMasterOrder ? order.posMasterOrder + 1 @@ -512,19 +489,6 @@ export class PositionController extends Controller { }, order: { posMasterOrder: "DESC" }, }); - const dataDup: any = await this.posMasterRepository.findOne({ - where: { - orgChild2Id: orgChild2.id, - orgChild3Id: IsNull() || "", - orgChild4Id: IsNull() || "", - posMasterNo: requestBody.posMasterNo, - }, - }); - if (dataDup != null) - throw new HttpError( - HttpStatusCode.INTERNAL_SERVER_ERROR, - "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้", - ); posMaster.posMasterOrder = order !== null && order !== undefined && order.posMasterOrder ? order.posMasterOrder + 1 @@ -544,20 +508,6 @@ export class PositionController extends Controller { }, order: { posMasterOrder: "DESC" }, }); - const dataDup: any = await this.posMasterRepository.findOne({ - where: { - orgChild1Id: orgChild1.id, - orgChild2Id: IsNull() || "", - orgChild3Id: IsNull() || "", - orgChild4Id: IsNull() || "", - posMasterNo: requestBody.posMasterNo, - }, - }); - if (dataDup != null) - throw new HttpError( - HttpStatusCode.INTERNAL_SERVER_ERROR, - "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้", - ); posMaster.posMasterOrder = order !== null && order !== undefined && order.posMasterOrder ? order.posMasterOrder + 1 @@ -577,21 +527,6 @@ export class PositionController extends Controller { }, order: { posMasterOrder: "DESC" }, }); - const dataDup: any = await this.posMasterRepository.findOne({ - where: { - orgRootId: orgRoot.id, - orgChild1Id: IsNull() || "", - orgChild2Id: IsNull() || "", - orgChild3Id: IsNull() || "", - orgChild4Id: IsNull() || "", - posMasterNo: requestBody.posMasterNo, - }, - }); - if (dataDup != null) - throw new HttpError( - HttpStatusCode.INTERNAL_SERVER_ERROR, - "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้", - ); posMaster.posMasterOrder = order !== null && order !== undefined && order.posMasterOrder ? order.posMasterOrder + 1 @@ -793,20 +728,6 @@ export class PositionController extends Controller { if (!orgChild4) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลโครงสร้าง"); } else { - const dataDup: any = await this.posMasterRepository.findOne({ - where: { - id: Not(posMaster.id), - orgChild4Id: orgChild4.id, - // posMasterNoPrefix: requestBody.posMasterNoPrefix, - posMasterNo: requestBody.posMasterNo, - // posMasterNoSuffix: requestBody.posMasterNoSuffix, - }, - }); - if (dataDup != null) - throw new HttpError( - HttpStatusCode.INTERNAL_SERVER_ERROR, - "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้", - ); posMaster.orgRootId = orgChild4.orgRootId; posMaster.orgChild1Id = orgChild4.orgChild1Id; posMaster.orgChild2Id = orgChild4.orgChild2Id; @@ -815,21 +736,6 @@ export class PositionController extends Controller { posMaster.orgRevisionId = orgChild4.orgRevisionId; } } else { - const dataDup: any = await this.posMasterRepository.findOne({ - where: { - id: Not(posMaster.id), - orgChild3Id: orgChild3.id, - orgChild4Id: IsNull() || "", - // posMasterNoPrefix: requestBody.posMasterNoPrefix, - posMasterNo: requestBody.posMasterNo, - // posMasterNoSuffix: requestBody.posMasterNoSuffix, - }, - }); - if (dataDup != null) - throw new HttpError( - HttpStatusCode.INTERNAL_SERVER_ERROR, - "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้", - ); posMaster.orgRootId = orgChild3.orgRootId; posMaster.orgChild1Id = orgChild3.orgChild1Id; posMaster.orgChild2Id = orgChild3.orgChild2Id; @@ -837,68 +743,17 @@ export class PositionController extends Controller { posMaster.orgRevisionId = orgChild3.orgRevisionId; } } else { - const dataDup: any = await this.posMasterRepository.findOne({ - where: { - id: Not(posMaster.id), - orgChild2Id: orgChild2.id, - orgChild3Id: IsNull() || "", - orgChild4Id: IsNull() || "", - // posMasterNoPrefix: requestBody.posMasterNoPrefix, - posMasterNo: requestBody.posMasterNo, - // posMasterNoSuffix: requestBody.posMasterNoSuffix, - }, - }); - if (dataDup != null) - throw new HttpError( - HttpStatusCode.INTERNAL_SERVER_ERROR, - "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้", - ); posMaster.orgRootId = orgChild2.orgRootId; posMaster.orgChild1Id = orgChild2.orgChild1Id; posMaster.orgChild2Id = orgChild2.id; posMaster.orgRevisionId = orgChild2.orgRevisionId; } } else { - const dataDup: any = await this.posMasterRepository.findOne({ - where: { - id: Not(posMaster.id), - orgChild1Id: orgChild1.id, - orgChild2Id: IsNull() || "", - orgChild3Id: IsNull() || "", - orgChild4Id: IsNull() || "", - // posMasterNoPrefix: requestBody.posMasterNoPrefix, - posMasterNo: requestBody.posMasterNo, - // posMasterNoSuffix: requestBody.posMasterNoSuffix, - }, - }); - if (dataDup != null) - throw new HttpError( - HttpStatusCode.INTERNAL_SERVER_ERROR, - "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้", - ); posMaster.orgRootId = orgChild1.orgRootId; posMaster.orgChild1Id = orgChild1.id; posMaster.orgRevisionId = orgChild1.orgRevisionId; } } else { - const dataDup: any = await this.posMasterRepository.findOne({ - where: { - id: Not(posMaster.id), - orgRootId: orgRoot.id, - orgChild1Id: IsNull() || "", - orgChild2Id: IsNull() || "", - orgChild3Id: IsNull() || "", - orgChild4Id: IsNull() || "", - // posMasterNoPrefix: requestBody.posMasterNoPrefix, - posMasterNo: requestBody.posMasterNo, - // posMasterNoSuffix: requestBody.posMasterNoSuffix, - }, - }); - if (dataDup != null) - throw new HttpError( - HttpStatusCode.INTERNAL_SERVER_ERROR, - "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้", - ); posMaster.orgRootId = orgRoot.id; posMaster.orgRevisionId = orgRoot.orgRevisionId; }