//--------------------------------------------------------------------------- #include #include "ITSSkinF.h" #include "ITSUtilF.h" #include "AppGlobalF.h" #include "CDSItsCrossInfoF.h" #include "ITSLangTransF.h" #pragma hdrstop #include "IHS0070MF.h" #include "IHS00701F.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma link "FRAME_ItsCrossF" #pragma link "cxButtons" #pragma link "cxCalendar" #pragma link "cxContainer" #pragma link "cxControls" #pragma link "cxDropDownEdit" #pragma link "cxEdit" #pragma link "cxGraphics" #pragma link "cxGroupBox" #pragma link "cxLabel" #pragma link "cxLookAndFeelPainters" #pragma link "cxLookAndFeels" #pragma link "cxMaskEdit" #pragma link "cxPC" #pragma link "cxPCdxBarPopupMenu" #pragma link "cxSpinEdit" #pragma link "cxSplitter" #pragma link "cxTextEdit" #pragma link "cxTimeEdit" #pragma link "dxSkinBlack" #pragma link "dxSkinBlue" #pragma link "dxSkinsCore" #pragma link "dxSkinscxPCPainter" #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 "cxStyles" #pragma link "dxSkinMcSkin" #pragma resource "*.dfm" TIHS0070M *IHS0070M = NULL; //--------------------------------------------------------------------------- __fastcall TIHS0070M::TIHS0070M(TComponent* Owner) : TForm(Owner) { LangTrans->Translate(this, ITSDb_GetConnection()); FTitle = Caption;//"¼öÁýµ¥ÀÌÅÍ ºÐ¼®"; ITSSkin_Load(this); CMM_LoadForm(g_sFormsDir, this); m_pFormList = new TList(); TsList01->TabVisible = false; TabHour->TabVisible = false; TabHour->Visible = false; TabTime->TabVisible = false; TabTime->Visible = false; PgQry->ActivePage = TabTerm; PnlQry->Height = 190; if (!RCrossManager) { RCrossManager = new TRCrossManager(); RCrossManager->LoadCrossRoad(); RCrossManager->LoadCross(); RCrossManager->LoadCrossDir(); } } //--------------------------------------------------------------------------- void __fastcall TIHS0070M::CommClose() { try { for (int idx = m_pFormList->Count-1; idx >= 0; idx--) { m_pFormList->Delete(idx); } delete m_pFormList; CMM_SaveForm(g_sFormsDir, this); } catch(...) { } } //--------------------------------------------------------------------------- void __fastcall TIHS0070M::FormShow(TObject *Sender) { Refresh(); FormInit(); TmrShow->Enabled = true; } //--------------------------------------------------------------------------- void __fastcall TIHS0070M::FormInit() { DtStDate->Date = Now() - 1; DtEdDate->Date = Now() - 1; //DtStTime->EditValue = Now().FormatString("hh"); //DtEdTime->EditValue = Now().FormatString("hh"); DtStTime->Time = StrToDateTime("00:00"); DtEdTime->Time = StrToDateTime("23:59"); } //--------------------------------------------------------------------------- void __fastcall TIHS0070M::TmrShowTimer(TObject *Sender) { TmrShow->Enabled = false; FRAMEItsCross1->InitFilter(true); FRAMEItsCross1->InitItsCross(); } //--------------------------------------------------------------------------- void __fastcall TIHS0070M::RefreshData() { // °Ë»öÁ¶°Ç¿¡ ÀÇÇÑ ¸µÅ© µ¥ÀÌÅÍ Á¶È¸ try { //SelListData(); } __finally { } } //--------------------------------------------------------------------------- void __fastcall TIHS0070M::BtnSearchClick(TObject *Sender) { Application->ProcessMessages(); TSqlCursor sqlCrs((TControl*)BtnSearch); TcxGrid *pCxList = NULL; TcxGridTableView *pTvList = NULL; int nIdCol = -1; STCondition m_CrossCond; FRAMEItsCross1->GetCondition(m_CrossCond); String sWhere = m_CrossCond.ToSQLInString("(A.VDS_CTLR_NMBR, A.VDS_CMRA_NO)"); FIdList = sWhere; String sTitle = FRAMEItsCross1->FSelNm; String sStTime, sEdTime, sTemp; switch(CbStatType->ItemIndex) { case 0: //¼öÁý±³Åë·® case 1: //5ºÐ±³Åë·® case 2: //15ºÐ Åë°è case 3: //½Ã°£ Åë°è(1½Ã°£) sStTime = DtStDate->Date.FormatString("yyyyMMdd") + DtStTime->Time.FormatString("hh"); sEdTime = DtEdDate->Date.FormatString("yyyyMMdd") + DtEdTime->Time.FormatString("hh"); FStTime = sStTime + "0000"; FEdTime = sEdTime + "5959"; break; case 4: //ÀÏ Åë°è(1ÀÏ) sStTime = DtStDate->Date.FormatString("yyyyMMdd"); sEdTime = DtEdDate->Date.FormatString("yyyyMMdd"); FStTime = sStTime + "000000"; FEdTime = sEdTime + "235959"; break; case 5: //¿ù Åë°è(1°³¿ù) sStTime = DtStDate->Date.FormatString("yyyyMM"); sEdTime = DtEdDate->Date.FormatString("yyyyMM"); sTemp.printf(L"%02d", ITSUtil_GetMonthLastDay(AnsiString(sEdTime).c_str())); //FStTime = sStTime + "01000000"; FStTime = sStTime + "00000000"; FEdTime = sEdTime + sTemp + "235959"; break; case 6: //³â Åë°è(1³â) sStTime = DtStDate->Date.FormatString("yyyy"); sEdTime = DtEdDate->Date.FormatString("yyyy"); //FStTime = sStTime + "0101000000"; FStTime = sStTime + "0000000000"; FEdTime = sEdTime + "1231235959"; break; default: return; } if (FStTime > FEdTime) { Application->MessageBox(FrmLang->lblQryDtErr->Caption.c_str(),//L"°Ë»ö ½ÃÀ۽ð¢ÀÌ °Ë»ö Á¾·á½Ã°¢ º¸´Ù Å®´Ï´Ù.", FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL); ActiveControl = DtStDate; return; } FStatType = CbStatType->ItemIndex; #if 0 sTitle.printf(L"%s - %s(%s~%s) %s ", PgQry->Properties->ActivePage->Caption.c_str(), CbStatType->Text.c_str(), FStTime.c_str(), FEdTime.c_str(), FIdList.c_str()); #else sTitle.printf(L"%s - %s(%s~%s) ", PgQry->Properties->ActivePage->Caption.c_str(), CbStatType->Text.c_str(), FStTime.c_str(), FEdTime.c_str()); #endif try { Application->ProcessMessages(); LockWindowUpdate(Handle); TcxTabSheet *pSheet = CMM_AddTabSheet(PgTab, sTitle); if (!pSheet) return; IHS00701 = new TIHS00701(this, Handle, FStTime, FEdTime, FIdList, CbStatType->ItemIndex); IHS00701->Parent = pSheet; IHS00701->Show(); PgTab->ActivePage = pSheet; pSheet = PgTab->ActivePage; m_pFormList->Add(IHS00701); } __finally { LockWindowUpdate(0); } return; #if 0 Application->ProcessMessages(); TSqlCursor sqlCrs((TControl*)BtnSearch); #if 0 FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hh"); FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hh"); #else FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hhnn"); FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hhnn"); #endif if (FStDateTime > FEdDateTime) { Application->MessageBox(FrmLang->lblQryDtErr->Caption.c_str(),//L"°Ë»ö ½ÃÀ۽ð¢ÀÌ °Ë»ö Á¾·á½Ã°¢ º¸´Ù Å®´Ï´Ù.", FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL); ActiveControl = DtStDate; return; } #if 0 FStDateTime = FStDateTime + "0000"; FEdDateTime = FEdDateTime + "5959"; #else FStDateTime = FStDateTime + "00"; FEdDateTime = FEdDateTime + "59"; #endif FIdList = ""; #if 0 int nSelects = FRAMELinkList1->GetSelLinkIds(FIdList); if (0 == nSelects) { Application->MessageBox(FrmLang->lblSelLstErr->Caption.c_str(),//L"°Ë»ö ¸ñ·ÏÀ» ¼±ÅÃÇÏÁö ¾Ê¾Ò½À´Ï´Ù.", FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL); FRAMELinkList1->CxList->SetFocus(); return; } #endif STCodeCondition m_CrossCond; FRAMEItsCross1->GetCondition(m_CrossCond); String sWhere = m_CrossCond.ToSQLInString("A.LINK_ID"); FIdList = sWhere; #if 0 String sTitle = "[" + FStDateTime + "-" + FEdDateTime + "]"; #else String sTitle = FRAMEItsCross1->FSelNm; #endif try { Application->ProcessMessages(); LockWindowUpdate(Handle); TcxTabSheet *pSheet = CMM_AddTabSheet(PgTab, sTitle); if (!pSheet) return; IHS00701 = new TIHS00701(this, Handle, FStDateTime, FEdDateTime, FIdList); IHS00701->Parent = pSheet; IHS00701->Show(); PgTab->ActivePage = pSheet; pSheet = PgTab->ActivePage; m_pFormList->Add(IHS00701); } __finally { LockWindowUpdate(0); } #endif } //--------------------------------------------------------------------------- void __fastcall TIHS0070M::BtnCloseClick(TObject *Sender) { Close(); } //--------------------------------------------------------------------------- void __fastcall TIHS0070M::OnSubFormClose(TMessage Msg) { int nActiveIdx = PgTab->ActivePageIndex; if (nActiveIdx <= 0) return; LockWindowUpdate(Handle); TcxTabSheet *pSheet = PgTab->ActivePage; if (pSheet) { delete pSheet; } nActiveIdx--; // ù¹øÂ° ÅÇÀº È­¸é¿¡ ¼û°ÜÁ® ÀÖ´Ù. m_pFormList->Delete(nActiveIdx); LockWindowUpdate(0); } //--------------------------------------------------------------------------- void __fastcall TIHS0070M::PgTabDblClick(TObject *Sender) { TPoint APoint; APoint = PgTab->MouseDownPos; if (PgTab->IndexOfTabAt(APoint.x, APoint.y) != -1) POST_MSG(Handle, WM_SUBFORM_CLOSE, 0, 0); } //--------------------------------------------------------------------------- void __fastcall TIHS0070M::FormClose(TObject *Sender, TCloseAction &Action) { CommClose(); IHS0070M = NULL; Action = caFree; } //--------------------------------------------------------------------------- void __fastcall TIHS0070M::btnFilterClick(TObject *Sender) { String sFilter = EdFilter->Text.Trim(); FRAMEItsCross1->FilterItsCross(sFilter); //fnUpdateConditionHtmlState(); } //--------------------------------------------------------------------------- void __fastcall TIHS0070M::EdFilterKeyPress(TObject *Sender, wchar_t &Key) { if (VK_RETURN == Key) { btnFilterClick(NULL); } } //--------------------------------------------------------------------------- void __fastcall TIHS0070M::PgTabCanCloseEx(TObject *Sender, int ATabIndex, bool &ACanClose) { int nActiveIdx = ATabIndex; if (nActiveIdx <= 0) return; nActiveIdx--; // ù¹øÂ° ÅÇÀº È­¸é¿¡ ¼û°ÜÁ® ÀÖ´Ù. m_pFormList->Delete(nActiveIdx); } //--------------------------------------------------------------------------- void __fastcall TIHS0070M::PgQryPageChanging(TObject *Sender, TcxTabSheet *NewPage, bool &AllowChange) { switch(NewPage->PageIndex) { case 0 : PnlQry->Height = 190; break; case 1 : PnlQry->Height = 220; break; case 2 : PnlQry->Height = 300; break; } } //--------------------------------------------------------------------------- void __fastcall TIHS0070M::CbStatTypePropertiesChange(TObject *Sender) { switch(CbStatType->ItemIndex) { case 0: //¼öÁý±³Åë·® case 1: //5ºÐ±³Åë·® case 2: //15ºÐ Åë°è case 3: //½Ã°£ Åë°è(1½Ã°£) DtStDate->Format = " yyyy³â MM¿ù ddÀÏ"; DtEdDate->Format = " yyyy³â MM¿ù ddÀÏ"; DtStTime->Visible = true; DtEdTime->Visible = true; break; case 4: //ÀÏ Åë°è(1ÀÏ) DtStDate->Format = " yyyy³â MM¿ù ddÀÏ"; DtEdDate->Format = " yyyy³â MM¿ù ddÀÏ"; DtStTime->Visible = false; DtEdTime->Visible = false; break; case 5: //¿ù Åë°è(1°³¿ù) DtStDate->Format = " yyyy³â MM¿ù"; DtEdDate->Format = " yyyy³â MM¿ù"; DtStTime->Visible = false; DtEdTime->Visible = false; break; case 6: //³â Åë°è(1³â) DtStDate->Format = " yyyy³â"; DtEdDate->Format = " yyyy³â"; DtStTime->Visible = false; DtEdTime->Visible = false; break; } DtStDate->SetFocus(); } //---------------------------------------------------------------------------