set null ตำแหน่งติดเงื่อนไข
This commit is contained in:
parent
f307484707
commit
dda4488409
4 changed files with 198 additions and 113 deletions
|
|
@ -3083,6 +3083,7 @@ export class CommandController extends Controller {
|
|||
}
|
||||
|
||||
posMaster.current_holderId = item.profileId;
|
||||
posMaster.conditionReason = _null;
|
||||
if (posMasterOld != null) await this.posMasterRepository.save(posMasterOld);
|
||||
await this.posMasterRepository.save(posMaster);
|
||||
|
||||
|
|
@ -3333,7 +3334,7 @@ export class CommandController extends Controller {
|
|||
positionTypeNew?: string | null;
|
||||
positionLevelNew?: string | null;
|
||||
positionNameNew?: string | null;
|
||||
posmasterId?: string| null;
|
||||
posmasterId?: string | null;
|
||||
posTypeNameNew?: string | null;
|
||||
posLevelNameNew?: string | null;
|
||||
posNoNew?: string | null;
|
||||
|
|
@ -3403,7 +3404,7 @@ export class CommandController extends Controller {
|
|||
}
|
||||
let _commandYear = item.commandYear;
|
||||
if (item.commandYear) {
|
||||
_commandYear = item.commandYear > 2500 ? item.commandYear : item.commandYear+543
|
||||
_commandYear = item.commandYear > 2500 ? item.commandYear : item.commandYear + 543;
|
||||
}
|
||||
const returnWork = await checkReturnCommandType(String(item.commandId));
|
||||
const dest_item = await this.salaryRepo.findOne({
|
||||
|
|
@ -3424,7 +3425,7 @@ export class CommandController extends Controller {
|
|||
createdAt: new Date(),
|
||||
lastUpdatedAt: new Date(),
|
||||
};
|
||||
if(!returnWork) {
|
||||
if (!returnWork) {
|
||||
Object.assign(data, { ...item, ...meta });
|
||||
const history = new ProfileSalaryHistory();
|
||||
Object.assign(history, { ...data, id: undefined });
|
||||
|
|
@ -3486,13 +3487,14 @@ export class CommandController extends Controller {
|
|||
await this.positionRepository.save(clearPosition);
|
||||
}
|
||||
posMaster.current_holderId = profile.id;
|
||||
posMaster.conditionReason = _null;
|
||||
await this.posMasterRepository.save(posMaster);
|
||||
const positionNew = await this.positionRepository.findOne({
|
||||
where: {
|
||||
posMasterId: posMaster.id,
|
||||
},
|
||||
});
|
||||
if(positionNew) {
|
||||
if (positionNew) {
|
||||
positionNew.positionIsSelected = true;
|
||||
await this.positionRepository.save(positionNew, { data: req });
|
||||
}
|
||||
|
|
@ -3523,7 +3525,7 @@ export class CommandController extends Controller {
|
|||
commandName: item.commandName,
|
||||
remark: item.remark,
|
||||
};
|
||||
Object.assign(data, {...newMapProfileSalary, ...meta});
|
||||
Object.assign(data, { ...newMapProfileSalary, ...meta });
|
||||
const history = new ProfileSalaryHistory();
|
||||
Object.assign(history, { ...data, id: undefined });
|
||||
await this.salaryRepo.save(data);
|
||||
|
|
@ -3552,10 +3554,15 @@ export class CommandController extends Controller {
|
|||
// profile.birthDate.toISOString().slice(5, 7) +
|
||||
// gregorianYear;
|
||||
// password = formattedDate;
|
||||
const _date = new Date(profile.birthDate.toDateString()).getDate().toString().padStart(2, "0");
|
||||
const _month = (new Date(profile.birthDate.toDateString()).getMonth()+1).toString().padStart(2, "0");
|
||||
const _year = (new Date(profile.birthDate.toDateString()).getFullYear()+543);
|
||||
password = `${_date}${_month}${_year}`
|
||||
const _date = new Date(profile.birthDate.toDateString())
|
||||
.getDate()
|
||||
.toString()
|
||||
.padStart(2, "0");
|
||||
const _month = (new Date(profile.birthDate.toDateString()).getMonth() + 1)
|
||||
.toString()
|
||||
.padStart(2, "0");
|
||||
const _year = new Date(profile.birthDate.toDateString()).getFullYear() + 543;
|
||||
password = `${_date}${_month}${_year}`;
|
||||
}
|
||||
userKeycloakId = await createUser(profile.citizenId, password, {
|
||||
firstName: profile.firstName,
|
||||
|
|
@ -3694,7 +3701,7 @@ export class CommandController extends Controller {
|
|||
}
|
||||
let _commandYear = item.commandYear;
|
||||
if (item.commandYear) {
|
||||
_commandYear = item.commandYear > 2500 ? item.commandYear : item.commandYear+543
|
||||
_commandYear = item.commandYear > 2500 ? item.commandYear : item.commandYear + 543;
|
||||
}
|
||||
const dest_item = await this.salaryRepo.findOne({
|
||||
where: { profileEmployeeId: item.profileId },
|
||||
|
|
@ -3861,7 +3868,7 @@ export class CommandController extends Controller {
|
|||
}
|
||||
let _commandYear = item.commandYear;
|
||||
if (item.commandYear) {
|
||||
_commandYear = item.commandYear > 2500 ? item.commandYear : item.commandYear+543
|
||||
_commandYear = item.commandYear > 2500 ? item.commandYear : item.commandYear + 543;
|
||||
}
|
||||
const dest_item = await this.salaryRepo.findOne({
|
||||
where: { profileId: item.profileId },
|
||||
|
|
@ -4167,7 +4174,7 @@ export class CommandController extends Controller {
|
|||
body.data.map(async (item) => {
|
||||
let _commandYear = item.commandYear;
|
||||
if (item.commandYear) {
|
||||
_commandYear = item.commandYear > 2500 ? item.commandYear : item.commandYear+543
|
||||
_commandYear = item.commandYear > 2500 ? item.commandYear : item.commandYear + 543;
|
||||
}
|
||||
if (item.profileType && item.profileType.trim().toUpperCase() == "OFFICER") {
|
||||
const profile = await this.profileRepository.findOne({
|
||||
|
|
@ -4679,7 +4686,7 @@ export class CommandController extends Controller {
|
|||
}
|
||||
let _commandYear = item.commandYear;
|
||||
if (item.commandYear) {
|
||||
_commandYear = item.commandYear > 2500 ? item.commandYear : item.commandYear+543
|
||||
_commandYear = item.commandYear > 2500 ? item.commandYear : item.commandYear + 543;
|
||||
}
|
||||
// const orgRevision = await this.orgRevisionRepo.findOne({
|
||||
// where: {
|
||||
|
|
@ -5161,7 +5168,7 @@ export class CommandController extends Controller {
|
|||
}
|
||||
let _commandYear = item.commandYear;
|
||||
if (item.commandYear) {
|
||||
_commandYear = item.commandYear > 2500 ? item.commandYear : item.commandYear+543
|
||||
_commandYear = item.commandYear > 2500 ? item.commandYear : item.commandYear + 543;
|
||||
}
|
||||
const _profile = await this.profileRepository.findOne({
|
||||
where: { id: item.profileId },
|
||||
|
|
@ -5457,10 +5464,15 @@ export class CommandController extends Controller {
|
|||
// item.bodyProfile.birthDate.toISOString().slice(5, 7) +
|
||||
// gregorianYear;
|
||||
// password = formattedDate;
|
||||
const _date = new Date(item.bodyProfile.birthDate.toDateString()).getDate().toString().padStart(2, "0");
|
||||
const _month = (new Date(item.bodyProfile.birthDate.toDateString()).getMonth()+1).toString().padStart(2, "0");
|
||||
const _year = (new Date(item.bodyProfile.birthDate.toDateString()).getFullYear()+543);
|
||||
password = `${_date}${_month}${_year}`
|
||||
const _date = new Date(item.bodyProfile.birthDate.toDateString())
|
||||
.getDate()
|
||||
.toString()
|
||||
.padStart(2, "0");
|
||||
const _month = (new Date(item.bodyProfile.birthDate.toDateString()).getMonth() + 1)
|
||||
.toString()
|
||||
.padStart(2, "0");
|
||||
const _year = new Date(item.bodyProfile.birthDate.toDateString()).getFullYear() + 543;
|
||||
password = `${_date}${_month}${_year}`;
|
||||
}
|
||||
userKeycloakId = await createUser(item.bodyProfile.citizenId, password, {
|
||||
firstName: item.bodyProfile.firstName,
|
||||
|
|
@ -5501,7 +5513,7 @@ export class CommandController extends Controller {
|
|||
relations: ["roleKeycloaks", "profileInsignias"],
|
||||
});
|
||||
let _oldInsigniaIds: string[] = [];
|
||||
if (!profile) {
|
||||
if (!profile) {
|
||||
//กรณีลูกจ้างประจำมาสอบเป็นข้าราชการ ต้อง update สถานะโปรไฟล์เดิม
|
||||
let profileEmployee: any = await this.profileEmployeeRepository.findOne({
|
||||
where: { citizenId: item.bodyProfile.citizenId },
|
||||
|
|
@ -5525,14 +5537,14 @@ export class CommandController extends Controller {
|
|||
const history = new ProfileSalaryHistory();
|
||||
Object.assign(history, { ...profileEmpSalary, id: undefined });
|
||||
profileEmpSalary.dateGovernment = meta.createdAt;
|
||||
profileEmpSalary.profileId = _null,
|
||||
await this.salaryRepo.save(profileEmpSalary, { data: req });
|
||||
(profileEmpSalary.profileId = _null),
|
||||
await this.salaryRepo.save(profileEmpSalary, { data: req });
|
||||
setLogDataDiff(req, { before, after: profileEmpSalary });
|
||||
history.profileSalaryId = profileEmpSalary.id;
|
||||
await this.salaryHistoryRepo.save(history, { data: req });
|
||||
|
||||
if (profileEmployee.profileInsignias.length > 0) {
|
||||
_oldInsigniaIds = profileEmployee.profileInsignias.map((x:any) => x.id);
|
||||
_oldInsigniaIds = profileEmployee.profileInsignias.map((x: any) => x.id);
|
||||
}
|
||||
await removeProfileInOrganize(profileEmployee.id, "EMPLOYEE");
|
||||
if (profileEmployee.keycloak != null) {
|
||||
|
|
@ -5593,9 +5605,12 @@ export class CommandController extends Controller {
|
|||
//ขรก.ในระบบ หรือ ขรก.ในระบบที่สถานะพ้นจากราชการ
|
||||
else {
|
||||
//สร้างโปรไฟล์ใหม่ ถ้าสถานะพ้นราชการ คำสั่งโอนออกหรือคำสั่งขอลาออก
|
||||
if (profile.isLeave && ["PLACEMENT_TRANSFER", "RETIRE_RESIGN"].includes(profile.leaveType)) {
|
||||
if (
|
||||
profile.isLeave &&
|
||||
["PLACEMENT_TRANSFER", "RETIRE_RESIGN"].includes(profile.leaveType)
|
||||
) {
|
||||
if (profile.profileInsignias.length > 0) {
|
||||
_oldInsigniaIds = profile.profileInsignias.map((x:any) => x.id);
|
||||
_oldInsigniaIds = profile.profileInsignias.map((x: any) => x.id);
|
||||
}
|
||||
profile = Object.assign({ ...item.bodyProfile, ...meta });
|
||||
profile.dateRetire = _dateRetire;
|
||||
|
|
@ -5633,8 +5648,7 @@ export class CommandController extends Controller {
|
|||
profile.phone = item.bodyProfile.phone ?? null;
|
||||
await this.profileRepository.save(profile);
|
||||
setLogDataDiff(req, { before, after: profile });
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
profile.roleKeycloaks = result && roleKeycloak ? [roleKeycloak] : [];
|
||||
profile.keycloak =
|
||||
userKeycloakId && typeof userKeycloakId === "string" ? userKeycloakId : "";
|
||||
|
|
@ -5892,6 +5906,7 @@ export class CommandController extends Controller {
|
|||
}
|
||||
|
||||
posMaster.current_holderId = profile.id;
|
||||
posMaster.conditionReason = _null;
|
||||
if (posMasterOld != null) await this.posMasterRepository.save(posMasterOld);
|
||||
await this.posMasterRepository.save(posMaster);
|
||||
|
||||
|
|
@ -5912,8 +5927,8 @@ export class CommandController extends Controller {
|
|||
await this.positionRepository.save(positionNew, { data: req });
|
||||
}
|
||||
}
|
||||
// Insignia
|
||||
if(_oldInsigniaIds.length > 0) {
|
||||
// Insignia
|
||||
if (_oldInsigniaIds.length > 0) {
|
||||
const _insignias = await this.insigniaRepo.find({
|
||||
where: { id: In(_oldInsigniaIds) },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -6277,10 +6292,15 @@ export class CommandController extends Controller {
|
|||
// profile.birthDate.toISOString().slice(5, 7) +
|
||||
// gregorianYear;
|
||||
// password = formattedDate;
|
||||
const _date = new Date(profile.birthDate.toDateString()).getDate().toString().padStart(2, "0");
|
||||
const _month = (new Date(profile.birthDate.toDateString()).getMonth()+1).toString().padStart(2, "0");
|
||||
const _year = (new Date(profile.birthDate.toDateString()).getFullYear()+543);
|
||||
password = `${_date}${_month}${_year}`
|
||||
const _date = new Date(profile.birthDate.toDateString())
|
||||
.getDate()
|
||||
.toString()
|
||||
.padStart(2, "0");
|
||||
const _month = (new Date(profile.birthDate.toDateString()).getMonth() + 1)
|
||||
.toString()
|
||||
.padStart(2, "0");
|
||||
const _year = new Date(profile.birthDate.toDateString()).getFullYear() + 543;
|
||||
password = `${_date}${_month}${_year}`;
|
||||
}
|
||||
const userKeycloakId = await createUser(profile.citizenId, password, {
|
||||
firstName: profile.firstName,
|
||||
|
|
@ -6606,7 +6626,9 @@ export class CommandController extends Controller {
|
|||
: "-",
|
||||
dateEnd: "-",
|
||||
RemarkVertical: item.RemarkVertical ? Extension.ToThaiNumber(item.RemarkVertical) : "-",
|
||||
RemarkHorizontal: item.RemarkHorizontal ? Extension.ToThaiNumber(item.RemarkHorizontal) : "-",
|
||||
RemarkHorizontal: item.RemarkHorizontal
|
||||
? Extension.ToThaiNumber(item.RemarkHorizontal)
|
||||
: "-",
|
||||
order:
|
||||
posMasterAct.posMasterOrder == null
|
||||
? "-"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue