//--------------------------------------------------------------------------- #include #include "ITSSkinF.h" #include "ITSUtilF.h" #include "ITSDbF.h" #include "AppGlobalF.h" #include "WindowMsgF.h" #pragma hdrstop #include "BDSH0101F.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma link "cxButtons" #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 "cxLookAndFeelPainters" #pragma link "cxLookAndFeels" #pragma link "cxSpinEdit" #pragma link "cxStyles" #pragma link "cxTextEdit" #pragma link "dxSkinBlack" #pragma link "dxSkinBlue" #pragma link "dxSkinsCore" #pragma link "dxSkinscxPCPainter" #pragma resource "*.dfm" TBDSH0101 *BDSH0101 = NULL; //--------------------------------------------------------------------------- __fastcall TBDSH0101::TBDSH0101(TComponent* Owner, HWND hHandle, String sFrom, String sTo, String sIdList) : TForm(Owner) { ITSSkin_Load(this); CMM_LoadForm(g_sFormsDir, this); FParent = hHandle; FStDateTime = sFrom; FEdDateTime = sTo; FIdList = sIdList; Caption = "ºí·¢¹Ú½º ¿ø½Ã ¼öÁý ÀÌ·Â"; Col16->Visible = false; Col16->VisibleForCustomization = false; } //--------------------------------------------------------------------------- __fastcall TBDSH0101::~TBDSH0101(void) { } //-------------------------------------------------------------------------- /* * form ÃʱâÈ­ * * arguments * * return * void */ void __fastcall TBDSH0101::FormInit() { ADOQry->Connection = ITSDb_GetConnection(); m_pGDC = TvList->DataController; TvList->OptionsView->NoDataToDisplayInfoText = FrmLang->lblNoInfo->Caption;//"<ºí·¢¹Ú½º ¿ø½Ã ¼öÁý ÀÌ·Â>"; //TvList->ViewInfo->GroupByBoxViewInfo->Text = "±×·ìÇÎÇÒ ÇʵåÀÇ Çì´õ¸¦ À̰÷À¸·Î µå·¡±× Çϼ¼¿ä"; LblSearch->Caption = "°Ë»öÁ¶°Ç: " + FStDateTime.SubString(1, 10) + " ~ " + FEdDateTime.SubString(1, 10); } //--------------------------------------------------------------------------- /* * formÀ» º¸¿©ÁÙ¶§ È£ÃâµÇ´Â event ¸Þ¼­µåÀÌ´Ù. * arguments * Sender : event handler °´Ã¼ * return * void */ void __fastcall TBDSH0101::FormShow(TObject *Sender) { FormInit(); Refresh(); TmrShow->Enabled = true; } //--------------------------------------------------------------------------- /* * ´Ý±â¹öư À̳ª x¹öư Ŭ¸¯½Ã °øÅëÀ¸·Î ó¸®ÇÏ´Â ·ÎÁ÷À̵é¾î°£´Ù.. * Form°ú DataModule class¸¦ delete½ÃŲ´Ù. * arguments * * return * void */ void __fastcall TBDSH0101::CommClose() { CMM_SaveForm(g_sFormsDir, this); //BDSH0101 = NULL; } //--------------------------------------------------------------------------- /* * ÃÖÃÊ 1ȸ ¼öÇàµÇ´Â ŸÀÌ¸Ó À̺¥Æ® * arguments * Sender : event handler °´Ã¼ * return * void */ void __fastcall TBDSH0101::TmrShowTimer(TObject *Sender) { TmrShow->Enabled = false; Application->ProcessMessages(); SelHistory(); } //--------------------------------------------------------------------------- void __fastcall TBDSH0101::ChkExpandClick(TObject *Sender) { CMM_ExpandCollapseChk(TvList, ChkExpand->Checked); } //--------------------------------------------------------------------------- /* * Refresh Data Event Function * arguments * * return * void */ void __fastcall TBDSH0101::SelHistory() { TSqlCursor sqlCrs; String sQry; TADOQuery *pADO = ADOQry; sQry = "SELECT A.*, \r\n" " B.OCRR_DT, \r\n" " B.TRMN_ID, \r\n" " B.EVT_TYPE, \r\n" " DECODE(B.EVT_TYPE, '1', '1.Áֱ⺸°í', \r\n" " '2', '2.»ç¿ëÀÚÀü¼Û', \r\n" " '3', '3.±ä±ÞÀü¼Û', \r\n" " '---') AS EVT_DESC, \r\n" " B.X_CRDN, \r\n" " B.Y_CRDN, \r\n" " B.GPS_DRCT, \r\n" " B.SPED, \r\n" " B.VHRN_MODE, \r\n" " DECODE(B.VHRN_MODE, '1', '1.ÁÖÇà¸ðµå', \r\n" " '2', '2.ÁÖÂ÷¸ðµå', \r\n" " '---') AS VHRN_DESC, \r\n" " B.TRMN_VER, \r\n" " B.LINK_ID, C.ROAD_NAME \r\n" " FROM TB_BDS_TRMN A, \r\n" " TB_BDS_RAW_CLCT B, \r\n" " TB_LINK C \r\n" " WHERE A.BDS_MNGM_NMBR IN(" + FIdList + ") \r\n" " AND A.BDS_MNGM_NMBR = B.BDS_MNGM_NMBR \r\n" " AND B.LINK_ID = C.LINK_ID(+) \r\n" " AND B.OCRR_DT BETWEEN :p01 \r\n" " AND :p02 \r\n"; //" ORDER BY A.BDS_MNGM_NMBR, B.OCRR_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 &exception) { ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2); DBERRORMSG(Caption, String(exception.ClassName()), exception.Message, sQry); throw Exception(String(exception.ClassName()) + exception.Message); } } //--------------------------------------------------------------------------- void __fastcall TBDSH0101::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++) { TvList->DataController->Values[nRow][Col00->Index] = pADO->FieldByName("BDS_MNGM_NMBR")->AsInteger; TvList->DataController->Values[nRow][Col01->Index] = pADO->FieldByName("OPNC_NMBR")->AsString; TvList->DataController->Values[nRow][Col02->Index] = pADO->FieldByName("MDM_NMBR")->AsString; TvList->DataController->Values[nRow][Col03->Index] = pADO->FieldByName("USIM_NMBR")->AsString; TvList->DataController->Values[nRow][Col04->Index] = pADO->FieldByName("VHCL_NMBR")->AsString; TvList->DataController->Values[nRow][Col05->Index] = pADO->FieldByName("OWNR_NM")->AsString; TvList->DataController->Values[nRow][Col06->Index] = pADO->FieldByName("PRCT_NM")->AsString; TvList->DataController->Values[nRow][Col07->Index] = ITSUtil_StrToDateTime(pADO->FieldByName("OCRR_DT")->AsString).FormatString(STR_DATETIME); TvList->DataController->Values[nRow][Col16->Index] = pADO->FieldByName("TRMN_ID")->AsString; TvList->DataController->Values[nRow][Col08->Index] = pADO->FieldByName("EVT_DESC")->AsString; TvList->DataController->Values[nRow][Col09->Index] = pADO->FieldByName("X_CRDN")->AsString; TvList->DataController->Values[nRow][Col10->Index] = pADO->FieldByName("Y_CRDN")->AsString; TvList->DataController->Values[nRow][Col11->Index] = pADO->FieldByName("GPS_DRCT")->AsString; TvList->DataController->Values[nRow][Col12->Index] = pADO->FieldByName("SPED")->AsString; TvList->DataController->Values[nRow][Col13->Index] = pADO->FieldByName("VHRN_DESC")->AsString; TvList->DataController->Values[nRow][Col14->Index] = pADO->FieldByName("TRMN_VER")->AsString; String LINK_ID = pADO->FieldByName("LINK_ID")->AsString; if (LINK_ID.Trim() == "0") LINK_ID = ""; TvList->DataController->Values[nRow][Col20->Index] = LINK_ID; TvList->DataController->Values[nRow][Col21->Index] = pADO->FieldByName("ROAD_NAME")->AsString; } } __finally { if (pADO) { pADO->Close(); } TvList->EndUpdate(); //CxList->SetFocus(); LblRecords->Caption = FormatFloat("##,##0", m_pGDC->RecordCount) + " °Ç"; String sEnd = "µ¥ÀÌÅÍ " + LblRecords->Caption + " ÀÌ Á¶È¸ µÇ¾ú½À´Ï´Ù."; Application->MessageBox(sEnd.c_str(), L"µ¥ÀÌÅÍ Á¶È¸ ¿Ï·á", MB_OK|MB_ICONINFORMATION|MB_APPLMODAL); } } catch(EDatabaseError &E) { throw Exception(String(E.ClassName()) + E.Message); } catch(...) { throw Exception(FrmLang->lblDbErr->Caption);//"¾Ë¼ö¾ø´Â ¿À·ù°¡ ¹ß»ýÇÏ¿´½À´Ï´Ù."); } } //--------------------------------------------------------------------------- void __fastcall TBDSH0101::OnMessage(TMessage &Msg) { switch (Msg.Msg) { case WM_PARAM_DATABASE: if (WP_DB_SELECT_OK == Msg.WParam) { //ShowMessage("Select Ok"); } break; } } //--------------------------------------------------------------------------- void __fastcall TBDSH0101::BtnExlSaveClick(TObject *Sender) { TcxGrid *pGrid = CxList; TcxGridTableView *pView = TvList; String sTitle = "ºí·¢¹Ú½º ¿ø½Ã ¼öÁý ÀÌ·Â"; CMM_ExportToExcelFile(sTitle, pGrid, pView, this); } //--------------------------------------------------------------------------- void __fastcall TBDSH0101::FormClose(TObject *Sender, TCloseAction &Action) { POST_MSG(FParent, WM_SUBFORM_CLOSE, 0, 0); CommClose(); //BDSH0101 = NULL; } //---------------------------------------------------------------------------