123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266 |
- /****************************************************************************
- * @source :
- * @description :
- ****************************************************************************
- * DATE AUTHOR DESCRIPTION
- * --------------------------------------------------------------------------
- * 2011/12/24 정승호 최초작성
- *
- ****************************************************************************/
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #include "ITSSkinF.h"
- #include "ITSUtilF.h"
- #include "ITSDbF.h"
- #include "AppGlobalF.h"
- #include "CDSFacilityF.h"
- #include "CDSFacilityFailF.h"
- #pragma hdrstop
- #include "IFM0030MF.h"
- #include "IHS0050MF.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma link "cxCalc"
- #pragma link "cxCheckBox"
- #pragma link "cxClasses"
- #pragma link "cxCustomData"
- #pragma link "cxData"
- #pragma link "cxDataStorage"
- #pragma link "cxFilter"
- #pragma link "cxGrid"
- #pragma link "cxGridCustomTableView"
- #pragma link "cxGridCustomView"
- #pragma link "cxGridLevel"
- #pragma link "cxGridTableView"
- #pragma link "cxLabel"
- #pragma link "cxStyles"
- #pragma link "dxSkinscxPCPainter"
- #pragma link "FRAME_FacilityFailF"
- #pragma link "FRAME_FacilityFailActionF"
- #pragma link "dxSkinsForm"
- #pragma resource "*.dfm"
- TIFM0030M *IFM0030M = NULL;
- //---------------------------------------------------------------------------
- __fastcall TIFM0030M::TIFM0030M(TComponent* Owner)
- : TForm(Owner)
- {
- #ifdef D_GJ
- BtnErrorHistory->Visible = true;
- #else
- BtnErrorHistory->Visible = false;
- #endif
- ITSSkin_Load(this);
- CMM_LoadForm(g_sFormsDir, this);
- FRAMEFacilityList1->PnlTop->Visible = false;
- FRAMEFacilityList1->TvList->OptionsData->Editing = false;
- }
- //---------------------------------------------------------------------------
- /*
- * 닫기버튼 이나 x버튼 클릭시 공통으로 처리하는 로직이들어간다..
- * Form과 DataModule class를 delete시킨다.
- * arguments
- *
- * return
- * void
- */
- void __fastcall TIFM0030M::CommClose()
- {
- try
- {
- CMM_SaveForm(g_sFormsDir, this);
- }
- catch(...)
- {
- }
- }
- //---------------------------------------------------------------------------
- /*
- * form 초기화
- *
- * arguments
- *
- * return
- * void
- */
- void __fastcall TIFM0030M::FormInit()
- {
- m_pGDC = FRAMEFacilityList1->TvList->DataController;
- }
- //---------------------------------------------------------------------------
- /*
- * Form을 보여줄때 호출되는 event 메서드이다.
- * arguments
- * Sender : event handler 객체
- * return
- * void
- */
- void __fastcall TIFM0030M::FormShow(TObject *Sender)
- {
- Refresh();
- FormInit();
- TmrShow->Enabled = true;
- }
- //---------------------------------------------------------------------------
- /*
- * Form이 Show되고 난 후 최초 1회 수행되는 타이머 이벤트
- * arguments
- * Sender : event handler 객체
- * return
- * void
- */
- void __fastcall TIFM0030M::TmrShowTimer(TObject *Sender)
- {
- TmrShow->Enabled = false;
- BtnSearchClick((TObject*)BtnSearch);
- }
- //---------------------------------------------------------------------------
- /*
- * Search 버튼 클릭 이벤트 핸들러
- * arguments
- * Sender : event handler 객체
- * return
- * void
- */
- void __fastcall TIFM0030M::BtnSearchClick(TObject *Sender)
- {
- RefreshData();
- }
- //---------------------------------------------------------------------------
- /*
- * Refresh Data Event Function
- * arguments
- *
- * return
- * void
- */
- void __fastcall TIFM0030M::RefreshData()
- {
- FRAMEFacilityList1->UpdateList();
- }
- //---------------------------------------------------------------------------
- /*
- * Close 버튼 클릭 이벤트 핸들러
- * arguments
- * Sender : event handler 객체
- * return
- * void
- */
- void __fastcall TIFM0030M::BtnCloseClick(TObject *Sender)
- {
- Close();
- }
- //---------------------------------------------------------------------------
- void __fastcall TIFM0030M::FormClose(TObject *Sender, TCloseAction &Action)
- {
- CommClose();
- IFM0030M = NULL;
- Action = caFree;
- }
- //---------------------------------------------------------------------------
- void __fastcall TIFM0030M::FRAMEFacilityList1TvListFocusedRecordChanged(TcxCustomGridTableView *Sender, TcxCustomGridRecord *APrevFocusedRecord,
- TcxCustomGridRecord *AFocusedRecord, bool ANewItemRecordFocusingChanged)
- {
- if (!AFocusedRecord)
- {
- FRAMEFacilityFail1->UpdateCheck();
- FRAMEFacilityFail1->UpdateList(NULL);
- return;
- }
- if (FRAMEFacilityList1->TvList->ViewData->RecordCount <= 0) return;
- int nIndex = m_pGDC->FocusedRecordIndex;
- if (nIndex < 0) return;
- int nMemPtr = m_pGDC->Values[nIndex][FRAMEFacilityList1->Column99->Index];
- if (nMemPtr == 0) return;
- FRAMEFacilityFail1->UpdateCheck();
- FRAMEFacilityFail1->UpdateList((TItsFacility*)nMemPtr);
- }
- //---------------------------------------------------------------------------
- void __fastcall TIFM0030M::FRAMEFacilityFail1TvListFocusedRecordChanged(TcxCustomGridTableView *Sender, TcxCustomGridRecord *APrevFocusedRecord,
- TcxCustomGridRecord *AFocusedRecord, bool ANewItemRecordFocusingChanged)
- {
- if (!AFocusedRecord)
- {
- FRAMEFacilityFailAction1->UpdateCheck();
- FRAMEFacilityFailAction1->UpdateList(NULL);
- return;
- }
- if (FRAMEFacilityFail1->TvList->ViewData->RecordCount <= 0) return;
- int nIndex = FRAMEFacilityFail1->TvList->DataController->FocusedRecordIndex;
- if (nIndex < 0) return;
- int nMemPtr = FRAMEFacilityFail1->TvList->DataController->Values[nIndex][FRAMEFacilityFail1->Column99->Index];
- if (nMemPtr == 0) return;
- FRAMEFacilityFailAction1->UpdateCheck();
- FRAMEFacilityFailAction1->UpdateList((TItsFacilityFail*)nMemPtr);
- }
- //---------------------------------------------------------------------------
- void __fastcall TIFM0030M::FormCloseQuery(TObject *Sender, bool &CanClose)
- {
- FRAMEFacilityFailAction1->OnCloseQuery(CanClose);
- FRAMEFacilityFail1->OnCloseQuery(CanClose);
- try
- {
- if (ItsFacilityFailManager)
- {
- delete ItsFacilityFailManager;
- ItsFacilityFailManager = NULL;
- }
- }
- catch(...)
- {
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TIFM0030M::BtnErrorHistoryClick(TObject *Sender)
- {
- if (IHS0050M)
- {
- try {
- ShowWindow(IHS0050M->Handle, SW_RESTORE);
- IHS0050M->BringToFront();
- } catch(...) {}
- }
- else
- {
- Application->CreateForm(__classid(TIHS0050M), &IHS0050M);
- if (IHS0050M) IHS0050M->Show();
- }
- }
- //---------------------------------------------------------------------------
- DWORD CUSTOM_ITEMS[2] = { COLOR_ACTIVECAPTION, COLOR_CAPTIONTEXT };
- TColor CUSTOM_COLORS[2] = { clRed, clYellow };
- TColor FStandardColors[2];
- void __fastcall TIFM0030M::FormActivate(TObject *Sender)
- {
- #if 0
- FStandardColors[0] = GetSysColor(COLOR_ACTIVECAPTION);
- FStandardColors[1] = GetSysColor(COLOR_CAPTIONTEXT );
- SetSysColors(2, (CONST INT *)CUSTOM_ITEMS, (CONST COLORREF *)CUSTOM_COLORS);
- #endif
- }
- //---------------------------------------------------------------------------
|