add command code

This commit is contained in:
kittapath 2024-11-01 14:14:13 +07:00
parent c082ae8891
commit 2b07acf656

View file

@ -348,6 +348,7 @@ export class CommandController extends Controller {
commandAffectDate: command.commandAffectDate, commandAffectDate: command.commandAffectDate,
commandExcecuteDate: command.commandExcecuteDate, commandExcecuteDate: command.commandExcecuteDate,
commandTypeName: command.commandType?.name || null, commandTypeName: command.commandType?.name || null,
commandCode: command.commandType?.code || null,
commandSysId: command.commandType?.commandSysId || null, commandSysId: command.commandType?.commandSysId || null,
}; };
return new HttpSuccess(_command); return new HttpSuccess(_command);
@ -2664,7 +2665,7 @@ export class CommandController extends Controller {
await this.posMasterRepository.save(data); await this.posMasterRepository.save(data);
return new HttpSuccess(); return new HttpSuccess();
} }
@Post("command40/officer/report") @Post("command40/officer/report")
public async command40SalaryOfficer( public async command40SalaryOfficer(
@Request() req: RequestWithUser, @Request() req: RequestWithUser,
@ -3019,10 +3020,9 @@ export class CommandController extends Controller {
if (!posMaster) { if (!posMaster) {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบตำแหน่งดังกล่าว"); throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบตำแหน่งดังกล่าว");
} }
if(posMaster.next_holderId != null) { if (posMaster.next_holderId != null) {
const shortName = const shortName =
posMaster != null && posMaster.orgChild4 != null posMaster != null && posMaster.orgChild4 != null
? `${posMaster.orgChild4.orgChild4ShortName}${posMaster.posMasterNo}` ? `${posMaster.orgChild4.orgChild4ShortName}${posMaster.posMasterNo}`
: posMaster != null && posMaster.orgChild3 != null : posMaster != null && posMaster.orgChild3 != null
? `${posMaster.orgChild3.orgChild3ShortName}${posMaster.posMasterNo}` ? `${posMaster.orgChild3.orgChild3ShortName}${posMaster.posMasterNo}`
@ -3034,13 +3034,13 @@ export class CommandController extends Controller {
? `${posMaster.orgRoot.orgRootShortName}${posMaster.posMasterNo}` ? `${posMaster.orgRoot.orgRootShortName}${posMaster.posMasterNo}`
: null; : null;
const profile = await this.profileRepository.findOne({ const profile = await this.profileRepository.findOne({
where: { id: posMaster.next_holderId } where: { id: posMaster.next_holderId },
}); });
const position = await this.positionRepository.findOne({ const position = await this.positionRepository.findOne({
where: { where: {
posMasterId: posMaster.id, posMasterId: posMaster.id,
positionIsSelected: true positionIsSelected: true,
} },
}); });
const dest_item = await this.salaryRepo.findOne({ const dest_item = await this.salaryRepo.findOne({
where: { profileId: profile?.id }, where: { profileId: profile?.id },
@ -3121,7 +3121,9 @@ export class CommandController extends Controller {
}[]; }[];
}, },
) { ) {
const posMasters = await this.posMasterRepository.find({ where: { id: In(body.refIds.map(x => x.refId)) } }); const posMasters = await this.posMasterRepository.find({
where: { id: In(body.refIds.map((x) => x.refId)) },
});
const data = posMasters.map((_data) => ({ const data = posMasters.map((_data) => ({
..._data, ..._data,
statusReport: "PENDING", statusReport: "PENDING",