Merge branch 'develop' of github.com:Frappet/bma-ehr-organization into develop
This commit is contained in:
commit
b42af12a5f
1 changed files with 0 additions and 145 deletions
|
|
@ -451,17 +451,6 @@ export class PositionController extends Controller {
|
||||||
},
|
},
|
||||||
order: { posMasterOrder: "DESC" },
|
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 =
|
posMaster.posMasterOrder =
|
||||||
order !== null && order !== undefined && order.posMasterOrder
|
order !== null && order !== undefined && order.posMasterOrder
|
||||||
? order.posMasterOrder + 1
|
? order.posMasterOrder + 1
|
||||||
|
|
@ -481,18 +470,6 @@ export class PositionController extends Controller {
|
||||||
},
|
},
|
||||||
order: { posMasterOrder: "DESC" },
|
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 =
|
posMaster.posMasterOrder =
|
||||||
order !== null && order !== undefined && order.posMasterOrder
|
order !== null && order !== undefined && order.posMasterOrder
|
||||||
? order.posMasterOrder + 1
|
? order.posMasterOrder + 1
|
||||||
|
|
@ -512,19 +489,6 @@ export class PositionController extends Controller {
|
||||||
},
|
},
|
||||||
order: { posMasterOrder: "DESC" },
|
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 =
|
posMaster.posMasterOrder =
|
||||||
order !== null && order !== undefined && order.posMasterOrder
|
order !== null && order !== undefined && order.posMasterOrder
|
||||||
? order.posMasterOrder + 1
|
? order.posMasterOrder + 1
|
||||||
|
|
@ -544,20 +508,6 @@ export class PositionController extends Controller {
|
||||||
},
|
},
|
||||||
order: { posMasterOrder: "DESC" },
|
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 =
|
posMaster.posMasterOrder =
|
||||||
order !== null && order !== undefined && order.posMasterOrder
|
order !== null && order !== undefined && order.posMasterOrder
|
||||||
? order.posMasterOrder + 1
|
? order.posMasterOrder + 1
|
||||||
|
|
@ -577,21 +527,6 @@ export class PositionController extends Controller {
|
||||||
},
|
},
|
||||||
order: { posMasterOrder: "DESC" },
|
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 =
|
posMaster.posMasterOrder =
|
||||||
order !== null && order !== undefined && order.posMasterOrder
|
order !== null && order !== undefined && order.posMasterOrder
|
||||||
? order.posMasterOrder + 1
|
? order.posMasterOrder + 1
|
||||||
|
|
@ -793,20 +728,6 @@ export class PositionController extends Controller {
|
||||||
if (!orgChild4) {
|
if (!orgChild4) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลโครงสร้าง");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลโครงสร้าง");
|
||||||
} else {
|
} 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.orgRootId = orgChild4.orgRootId;
|
||||||
posMaster.orgChild1Id = orgChild4.orgChild1Id;
|
posMaster.orgChild1Id = orgChild4.orgChild1Id;
|
||||||
posMaster.orgChild2Id = orgChild4.orgChild2Id;
|
posMaster.orgChild2Id = orgChild4.orgChild2Id;
|
||||||
|
|
@ -815,21 +736,6 @@ export class PositionController extends Controller {
|
||||||
posMaster.orgRevisionId = orgChild4.orgRevisionId;
|
posMaster.orgRevisionId = orgChild4.orgRevisionId;
|
||||||
}
|
}
|
||||||
} else {
|
} 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.orgRootId = orgChild3.orgRootId;
|
||||||
posMaster.orgChild1Id = orgChild3.orgChild1Id;
|
posMaster.orgChild1Id = orgChild3.orgChild1Id;
|
||||||
posMaster.orgChild2Id = orgChild3.orgChild2Id;
|
posMaster.orgChild2Id = orgChild3.orgChild2Id;
|
||||||
|
|
@ -837,68 +743,17 @@ export class PositionController extends Controller {
|
||||||
posMaster.orgRevisionId = orgChild3.orgRevisionId;
|
posMaster.orgRevisionId = orgChild3.orgRevisionId;
|
||||||
}
|
}
|
||||||
} else {
|
} 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.orgRootId = orgChild2.orgRootId;
|
||||||
posMaster.orgChild1Id = orgChild2.orgChild1Id;
|
posMaster.orgChild1Id = orgChild2.orgChild1Id;
|
||||||
posMaster.orgChild2Id = orgChild2.id;
|
posMaster.orgChild2Id = orgChild2.id;
|
||||||
posMaster.orgRevisionId = orgChild2.orgRevisionId;
|
posMaster.orgRevisionId = orgChild2.orgRevisionId;
|
||||||
}
|
}
|
||||||
} else {
|
} 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.orgRootId = orgChild1.orgRootId;
|
||||||
posMaster.orgChild1Id = orgChild1.id;
|
posMaster.orgChild1Id = orgChild1.id;
|
||||||
posMaster.orgRevisionId = orgChild1.orgRevisionId;
|
posMaster.orgRevisionId = orgChild1.orgRevisionId;
|
||||||
}
|
}
|
||||||
} else {
|
} 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.orgRootId = orgRoot.id;
|
||||||
posMaster.orgRevisionId = orgRoot.orgRevisionId;
|
posMaster.orgRevisionId = orgRoot.orgRevisionId;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue