no message
This commit is contained in:
parent
6b2f1c99d8
commit
cd30175423
1 changed files with 0 additions and 145 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue