//--------------------------------------------------------------------------- #include #include "ITSSkinF.h" #include "ITSUtilF.h" #include "ITSDbF.h" #include "AppGlobalF.h" #include "WindowMsgF.h" #include "ITSLangTransF.h" #pragma hdrstop #include "VDSH0201F.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma link "cxButtons" #pragma link "cxCalc" #pragma link "cxCheckBox" #pragma link "cxClasses" #pragma link "cxContainer" #pragma link "cxControls" #pragma link "cxCustomData" #pragma link "cxData" #pragma link "cxDataStorage" #pragma link "cxEdit" #pragma link "cxFilter" #pragma link "cxGraphics" #pragma link "cxGrid" #pragma link "cxGridCustomTableView" #pragma link "cxGridCustomView" #pragma link "cxGridLevel" #pragma link "cxGridTableView" #pragma link "cxLabel" #pragma link "cxLookAndFeelPainters" #pragma link "cxLookAndFeels" #pragma link "cxStyles" #pragma link "cxTextEdit" #pragma link "dxSkinBlack" #pragma link "dxSkinBlue" #pragma link "dxSkinsCore" #pragma link "dxSkinscxPCPainter" #pragma resource "*.dfm" TVDSH0201 *VDSH0201 = NULL; //--------------------------------------------------------------------------- __fastcall TVDSH0201::TVDSH0201(TComponent* Owner, HWND hHandle, String sFrom, String sTo, String sIdList) : TForm(Owner) { LangTrans->Translate(this, ITSDb_GetConnection()); ITSSkin_Load(this); CMM_LoadForm(g_sFormsDir, this); FParent = hHandle; FStDateTime = sFrom; FEdDateTime = sTo; FIdList = sIdList; } //--------------------------------------------------------------------------- __fastcall TVDSH0201::~TVDSH0201(void) { } //-------------------------------------------------------------------------- void __fastcall TVDSH0201::FormInit() { ADOQry->Connection = ITSDb_GetConnection(); m_pGDC = TvList->DataController; TvList->OptionsView->NoDataToDisplayInfoText = FrmLang->lblNoInfo->Caption;//""; //TvList->ViewInfo->GroupByBoxViewInfo->Text = "±×·ìÇÎÇÒ ÇʵåÀÇ Çì´õ¸¦ À̰÷À¸·Î µå·¡±× Çϼ¼¿ä"; LblSearch->Caption = FrmLang->lblQryCond->Caption + FStDateTime.SubString(1, 12) + " ~ " + FEdDateTime.SubString(1, 12); } //--------------------------------------------------------------------------- void __fastcall TVDSH0201::FormShow(TObject *Sender) { FormInit(); Refresh(); TmrShow->Enabled = true; } //--------------------------------------------------------------------------- void __fastcall TVDSH0201::CommClose() { CMM_SaveForm(g_sFormsDir, this); //VDSH0201 = NULL; } //--------------------------------------------------------------------------- void __fastcall TVDSH0201::TmrShowTimer(TObject *Sender) { TmrShow->Enabled = false; Application->ProcessMessages(); SelHistory(); } //--------------------------------------------------------------------------- void __fastcall TVDSH0201::ChkExpandClick(TObject *Sender) { CMM_ExpandCollapseChk(TvList, ChkExpand->Checked); } //--------------------------------------------------------------------------- void __fastcall TVDSH0201::SelHistory() { TSqlCursor sqlCrs; String sQry; TADOQuery *pADO = ADOQry; sQry = "SELECT VDS_CTLR_NMBR, CRTN_DT, CMNC_STTS_CD AS CONN_STTS_CD, CBOX_DOOR_STTS_CD, \r\n" " FAN_STTS_CD, HETR_STTS_CD, VIDEO_INPUT \r\n" " FROM TB_VDS_CTLR_STTS_HS \r\n" " WHERE CRTN_DT BETWEEN :p01 AND :p02 \r\n" " AND VDS_CTLR_NMBR IN(" + FIdList + ") \r\n" " ORDER BY VDS_CTLR_NMBR, CRTN_DT \r\n"; try { ITSDb_SQLText(pADO, sQry); ITSDb_SQLBind(pADO, "p01", FStDateTime); ITSDb_SQLBind(pADO, "p02", FEdDateTime); ITSDb_SQLOpen(pADO); DspHistory(); } catch(EDatabaseError &E) { ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2); DBERRORMSG(Caption, String(E.ClassName()), E.Message, sQry); throw Exception(String(E.ClassName()) + E.Message); } catch(Exception &e) { ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2); DBERRORMSG(Caption, String(e.ClassName()), e.Message, sQry); throw Exception(String(e.ClassName()) + e.Message); } } //--------------------------------------------------------------------------- void __fastcall TVDSH0201::DspHistory() { TADOQuery *pADO = ADOQry; try { TcxGridChartSeries *pChart = NULL; CMM_ClearGridTableView(TvList); int nRow = 0; int nDataCnt = 0; try { TvList->BeginUpdate(); nDataCnt = pADO->RecordCount; m_pGDC->RecordCount = nDataCnt; for( ; !pADO->Eof; pADO->Next(), nRow++) { m_pGDC->Values[nRow][Column00->Index] = pADO->FieldByName("VDS_CTLR_NMBR")->AsString; String sDbDate = pADO->FieldByName("CRTN_DT")->AsString; m_pGDC->Values[nRow][Column01->Index] = ITSUtil_FormatStr(sDbDate, STR_DATETIME); String sCmnc = pADO->FieldByName("CONN_STTS_CD")->AsString; //String sPwer = pADO->FieldByName("PRNT_PWER_STTS_CD")->AsString; String sDoor = pADO->FieldByName("CBOX_DOOR_STTS_CD")->AsString; String sFan = pADO->FieldByName("FAN_STTS_CD")->AsString; String sHetr = pADO->FieldByName("HETR_STTS_CD")->AsString; m_pGDC->Values[nRow][Column02->Index] = sCmnc; //m_pGDC->Values[nRow][Column03->Index] = sPwer; m_pGDC->Values[nRow][Column04->Index] = sDoor; m_pGDC->Values[nRow][Column05->Index] = sFan; m_pGDC->Values[nRow][Column06->Index] = sHetr; //m_pGDC->Values[nRow][Column07->Index] = pADO->FieldByName("PRNT_PWER_VAL")->AsString; m_pGDC->Values[nRow][Column08->Index] = pADO->FieldByName("VIDEO_INPUT")->AsString == "0" ? "Á¤»ó" : "ÀԷ¾øÀ½"; } } __finally { if (pADO) { pADO->Close(); } TvList->EndUpdate(); //CxList->SetFocus(); LblRecords->Caption = FormatFloat("##,##0", m_pGDC->RecordCount) + FrmLang->lblEA->Caption;//" °Ç"; String sEnd = FrmLang->lblQrySel->Caption + " [" + LblRecords->Caption + "]";//"µ¥ÀÌÅÍ " + LblRecords->Caption + " ÀÌ Á¶È¸ µÇ¾ú½À´Ï´Ù."; Application->MessageBox(sEnd.c_str(), FrmLang->lblQryEnd->Caption.c_str(),//L"µ¥ÀÌÅÍ Á¶È¸ ¿Ï·á", MB_OK|MB_ICONINFORMATION|MB_APPLMODAL); } } catch(EDatabaseError &E) { ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2); DBERRORMSG(Caption, String(E.ClassName()), E.Message, pADO->SQL->Text); throw Exception(String(E.ClassName()) + E.Message); } catch(Exception &e) { ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2); DBERRORMSG(Caption, String(e.ClassName()), e.Message, pADO->SQL->Text); throw Exception(String(e.ClassName()) + e.Message); } } //--------------------------------------------------------------------------- void __fastcall TVDSH0201::OnMessage(TMessage &Msg) { switch (Msg.Msg) { case WM_PARAM_DATABASE: if (WP_DB_SELECT_OK == Msg.WParam) { //ShowMessage("Select Ok"); } break; } } //--------------------------------------------------------------------------- void __fastcall TVDSH0201::BtnExlSaveClick(TObject *Sender) { TcxGrid *pGrid = CxList; TcxGridTableView *pView = TvList; String sTitle= Caption;//"VDS-Á¦¾î±â À̺¥Æ®ÀÌ·Â"; CMM_ExportToExcelFile(sTitle, pGrid, pView, this); } //--------------------------------------------------------------------------- void __fastcall TVDSH0201::FormClose(TObject *Sender, TCloseAction &Action) { POST_MSG(FParent, WM_SUBFORM_CLOSE, 0, 0); CommClose(); //VDSH0201 = NULL; } //---------------------------------------------------------------------------