error exe command 40
This commit is contained in:
parent
3f735accdd
commit
e24e5de129
1 changed files with 22 additions and 22 deletions
|
|
@ -6540,13 +6540,11 @@ export class CommandController extends Controller {
|
|||
}[];
|
||||
},
|
||||
) {
|
||||
// อัปเดตสถานะรวดเดียว
|
||||
await this.posMasterActRepository.update(
|
||||
{ id: In(body.refIds.map((x) => x.refId)) },
|
||||
{ statusReport: "DONE" },
|
||||
);
|
||||
|
||||
// ดึงข้อมูลที่จำเป็น
|
||||
const posMasters = await this.posMasterActRepository.find({
|
||||
where: { id: In(body.refIds.map((x) => x.refId)) },
|
||||
relations: [
|
||||
|
|
@ -6564,7 +6562,6 @@ export class CommandController extends Controller {
|
|||
await Promise.all(
|
||||
posMasters.map(async (item) => {
|
||||
if (item.posMasterChild?.current_holderId) {
|
||||
// ปรับ shortName ให้สั้น
|
||||
const shortName =
|
||||
[
|
||||
item.posMaster?.orgChild4?.orgChild4ShortName,
|
||||
|
|
@ -6572,31 +6569,34 @@ export class CommandController extends Controller {
|
|||
item.posMaster?.orgChild2?.orgChild2ShortName,
|
||||
item.posMaster?.orgChild1?.orgChild1ShortName,
|
||||
item.posMaster?.orgRoot?.orgRootShortName,
|
||||
].find(Boolean) || "";
|
||||
].find(Boolean) ?? "";
|
||||
|
||||
const metaAct = {
|
||||
profileId: item.posMasterChild.current_holderId,
|
||||
dateStart: body.refIds[0].commandDateAffect,
|
||||
profileId: item.posMasterChild.current_holderId ?? null,
|
||||
dateStart: body.refIds[0]?.commandDateAffect ?? null,
|
||||
dateEnd: null,
|
||||
position: item.posMaster.current_holder.position,
|
||||
position: item.posMaster?.current_holder?.position ?? "-",
|
||||
status: true,
|
||||
commandId: body.refIds[0].commandId,
|
||||
createdUserId: req.user.sub,
|
||||
createdFullName: req.user.name,
|
||||
lastUpdateUserId: req.user.sub,
|
||||
lastUpdateFullName: req.user.name,
|
||||
commandId: body.refIds[0]?.commandId ?? null,
|
||||
createdUserId: req.user?.sub ?? null,
|
||||
createdFullName: req.user?.name ?? null,
|
||||
lastUpdateUserId: req.user?.sub ?? null,
|
||||
lastUpdateFullName: req.user?.name ?? null,
|
||||
createdAt: new Date(),
|
||||
lastUpdatedAt: new Date(),
|
||||
commandNo: body.refIds[0].commandNo,
|
||||
refCommandNo: `${body.refIds[0].commandNo}/${body.refIds[0].commandYear}`,
|
||||
commandYear: body.refIds[0].commandYear,
|
||||
posNo: `${shortName} ${item.posMaster.posMasterNo}`,
|
||||
commandNo: body.refIds[0]?.commandNo ?? null,
|
||||
refCommandNo: `${body.refIds[0]?.commandNo ?? ""}/${body.refIds[0]?.commandYear ?? ""}`,
|
||||
commandYear: body.refIds[0]?.commandYear ?? null,
|
||||
posNo:
|
||||
shortName && item.posMaster?.posMasterNo
|
||||
? `${shortName} ${item.posMaster.posMasterNo}`
|
||||
: item.posMaster?.posMasterNo ?? "-",
|
||||
posNoAbb: shortName,
|
||||
commandDateAffect: body.refIds[0].commandDateAffect,
|
||||
commandDateSign: body.refIds[0].commandDateSign,
|
||||
commandCode: body.refIds[0].commandCode,
|
||||
commandName: body.refIds[0].commandName,
|
||||
remark: body.refIds[0].remark,
|
||||
commandDateAffect: body.refIds[0]?.commandDateAffect ?? null,
|
||||
commandDateSign: body.refIds[0]?.commandDateSign ?? null,
|
||||
commandCode: body.refIds[0]?.commandCode ?? null,
|
||||
commandName: body.refIds[0]?.commandName ?? null,
|
||||
remark: body.refIds[0]?.remark ?? null,
|
||||
};
|
||||
|
||||
const dataAct = new ProfileActposition();
|
||||
|
|
@ -6615,7 +6615,7 @@ export class CommandController extends Controller {
|
|||
const profileActs = _actposition.map((_data) => ({
|
||||
..._data,
|
||||
status: false,
|
||||
dateEnd: _data.status == true ? new Date() : _data.dateEnd,
|
||||
dateEnd: _data.status === true ? new Date() : _data.dateEnd,
|
||||
}));
|
||||
await this.actpositionRepository.save(profileActs);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue