Merge pull request #144 from Frappet/task/1729-สถานะรักษาการหลังออกคำสั่งรักษาการน่าจะต้องเป็นใช้งาน
1729
This commit is contained in:
commit
b10f17b5dc
1 changed files with 12 additions and 13 deletions
|
|
@ -6673,23 +6673,11 @@ export class CommandController extends Controller {
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 8. บันทึกข้อมูลใหม่
|
// 8. ปิดสถานะรักษาการ
|
||||||
const dataAct = new ProfileActposition();
|
|
||||||
Object.assign(dataAct, metaAct);
|
|
||||||
|
|
||||||
const historyAct = new ProfileActpositionHistory();
|
|
||||||
Object.assign(historyAct, { ...dataAct, id: undefined });
|
|
||||||
|
|
||||||
await this.actpositionRepository.save(dataAct);
|
|
||||||
historyAct.profileActpositionId = dataAct.id;
|
|
||||||
await this.actpositionHistoryRepository.save(historyAct);
|
|
||||||
|
|
||||||
// 9. ปิดสถานะรักษาการ
|
|
||||||
const existingActPositions = await this.actpositionRepository.find({
|
const existingActPositions = await this.actpositionRepository.find({
|
||||||
where: {
|
where: {
|
||||||
profileId: item.posMasterChild.current_holderId,
|
profileId: item.posMasterChild.current_holderId,
|
||||||
status: true,
|
status: true,
|
||||||
id: Not(dataAct.id),
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -6702,6 +6690,17 @@ export class CommandController extends Controller {
|
||||||
|
|
||||||
await this.actpositionRepository.save(updatedActPositions);
|
await this.actpositionRepository.save(updatedActPositions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 9. บันทึกข้อมูลใหม่
|
||||||
|
const dataAct = new ProfileActposition();
|
||||||
|
Object.assign(dataAct, metaAct);
|
||||||
|
|
||||||
|
const historyAct = new ProfileActpositionHistory();
|
||||||
|
Object.assign(historyAct, { ...dataAct, id: undefined });
|
||||||
|
|
||||||
|
await this.actpositionRepository.save(dataAct);
|
||||||
|
historyAct.profileActpositionId = dataAct.id;
|
||||||
|
await this.actpositionHistoryRepository.save(historyAct);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`Error processing item ${item.id}:`, error);
|
console.error(`Error processing item ${item.id}:`, error);
|
||||||
throw new HttpError(
|
throw new HttpError(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue