From 5443e3612d607b8a7c6078d5166779378fce689e Mon Sep 17 00:00:00 2001 From: mamoss <> Date: Sat, 9 Aug 2025 20:39:26 +0700 Subject: [PATCH] =?UTF-8?q?1729=201729=201792-=E0=B8=AA=E0=B8=96=E0=B8=B2?= =?UTF-8?q?=E0=B8=99=E0=B8=B0=E0=B8=A3=E0=B8=B1=E0=B8=81=E0=B8=A9=E0=B8=B2?= =?UTF-8?q?=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B8=AB=E0=B8=A5=E0=B8=B1=E0=B8=87?= =?UTF-8?q?=E0=B8=AD=E0=B8=AD=E0=B8=81=E0=B8=84=E0=B8=B3=E0=B8=AA=E0=B8=B1?= =?UTF-8?q?=E0=B9=88=E0=B8=87=E0=B8=A3=E0=B8=B1=E0=B8=81=E0=B8=A9=E0=B8=B2?= =?UTF-8?q?=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B8=99=E0=B9=88=E0=B8=B2=E0=B8=88?= =?UTF-8?q?=E0=B8=B0=E0=B8=95=E0=B9=89=E0=B8=AD=E0=B8=87=E0=B9=80=E0=B8=9B?= =?UTF-8?q?=E0=B9=87=E0=B8=99=E0=B9=83=E0=B8=8A=E0=B9=89=E0=B8=87=E0=B8=B2?= =?UTF-8?q?=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/CommandController.ts | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/controllers/CommandController.ts b/src/controllers/CommandController.ts index 6724eabb..9fbf9199 100644 --- a/src/controllers/CommandController.ts +++ b/src/controllers/CommandController.ts @@ -6673,23 +6673,11 @@ export class CommandController extends Controller { }; try { - // 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. ปิดสถานะรักษาการ + // 8. ปิดสถานะรักษาการ const existingActPositions = await this.actpositionRepository.find({ where: { profileId: item.posMasterChild.current_holderId, status: true, - id: Not(dataAct.id), }, }); @@ -6702,6 +6690,17 @@ export class CommandController extends Controller { 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) { console.error(`Error processing item ${item.id}:`, error); throw new HttpError(