FrmIncidVmsInfoF.cpp 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "ITSSkinF.h"
  4. #include "ITSUtilF.h"
  5. #include "ITSDbF.h"
  6. #include "AppGlobalF.h"
  7. #include "ITSLangTransF.h"
  8. #include "ITS_OPLibF.h"
  9. #pragma hdrstop
  10. #include "WindowMsgF.h"
  11. #include "FrmIncidVmsInfoF.h"
  12. #include "FrmLinkGradeSetF.h"
  13. #include "CDSNodeF.h"
  14. #include "CDSLinkF.h"
  15. #include "CDSIfscF.h"
  16. #include "CDSRoadF.h"
  17. #include "CDSTrafficGradeF.h"
  18. //---------------------------------------------------------------------------
  19. #pragma package(smart_init)
  20. #pragma link "cxButtons"
  21. #pragma link "cxClasses"
  22. #pragma link "cxContainer"
  23. #pragma link "cxControls"
  24. #pragma link "cxCustomData"
  25. #pragma link "cxData"
  26. #pragma link "cxDataStorage"
  27. #pragma link "cxEdit"
  28. #pragma link "cxFilter"
  29. #pragma link "cxGraphics"
  30. #pragma link "cxGrid"
  31. #pragma link "cxGridCustomTableView"
  32. #pragma link "cxGridCustomView"
  33. #pragma link "cxGridLevel"
  34. #pragma link "cxGridTableView"
  35. #pragma link "cxGroupBox"
  36. #pragma link "cxLabel"
  37. #pragma link "cxLookAndFeelPainters"
  38. #pragma link "cxLookAndFeels"
  39. #pragma link "cxStyles"
  40. #pragma link "cxTextEdit"
  41. #pragma link "dxSkinBlack"
  42. #pragma link "dxSkinBlue"
  43. #pragma link "dxSkinsCore"
  44. #pragma link "dxSkinscxPCPainter"
  45. #pragma link "dxSkinMcSkin"
  46. #pragma resource "*.dfm"
  47. TFrmIncidVmsInfo *FrmIncidVmsInfo = NULL;
  48. //---------------------------------------------------------------------------
  49. __fastcall TFrmIncidVmsInfo::TFrmIncidVmsInfo(TComponent* Owner)
  50. : TForm(Owner)
  51. {
  52. LangTrans->Translate(this, ITSDb_GetConnection());
  53. Width = 474;
  54. Height= 495;
  55. int nHeight = Height;
  56. int nWidth = Width;
  57. ITSSkin_Load(this);
  58. CMM_LoadForm(g_sFormsDir, this);
  59. Height = nHeight;
  60. Width = nWidth;
  61. Caption = " " + Caption;//" 돌발구간 VMS 정보";
  62. m_sLinkId = "";
  63. TvList->OptionsView->NoDataToDisplayInfoText = FrmLang->lblNoInfo->Caption;//"<해당 구간에 VMS 정보가 없습니다>";
  64. FCodeRDR = ItsCodeManager->FLists.Find("RDR"); // 도로등급
  65. }
  66. //---------------------------------------------------------------------------
  67. void __fastcall TFrmIncidVmsInfo::FormClose(TObject *Sender, TCloseAction &Action)
  68. {
  69. try
  70. {
  71. CMM_SaveForm(g_sFormsDir, this);
  72. }
  73. catch(...)
  74. {
  75. }
  76. Action = caFree;
  77. FrmIncidVmsInfo = NULL;
  78. }
  79. //---------------------------------------------------------------------------
  80. void __fastcall TFrmIncidVmsInfo::RefreshInfo()
  81. {
  82. ShowIncidVmsInfo(m_sLinkId);
  83. }
  84. //---------------------------------------------------------------------------
  85. void __fastcall TFrmIncidVmsInfo::ShowIncidVmsInfo(String ALinkId)
  86. {
  87. m_sLinkId = ALinkId;
  88. EdId->Text = ALinkId;
  89. EdLevel->Text = String(1);
  90. EdLength->Text = FormatFloat("##,##0", 0);
  91. EdStId->Text = "";
  92. EdEdId->Text = "";
  93. EdStName->Text = FrmLang->lblNoName->Caption;//"명칭없음";
  94. EdEdName->Text = FrmLang->lblNoName->Caption;//"명칭없음";
  95. EdRoadName->Text = "";
  96. EdRoadRank->Text = "";
  97. EdRoadRank->Visible = false;
  98. TItsNode *pNode;
  99. TItsLink *pLink;
  100. pLink = ItsLinkManager->FLists.Find(m_sLinkId);
  101. if (!pLink) return;
  102. EdStId->Text = pLink->F_NODE_ID;
  103. EdEdId->Text = pLink->T_NODE_ID;
  104. EdLength->Text = FormatFloat("##,##0", StrToFloat(pLink->LINK_LENG));
  105. pNode = ItsNodeManager->FLists.Find(pLink->F_NODE_ID);
  106. if (pNode) EdStName->Text = pNode->NODE_NAME.Trim();
  107. pNode = ItsNodeManager->FLists.Find(pLink->T_NODE_ID);
  108. if (pNode) EdEdName->Text = pNode->NODE_NAME.Trim();
  109. EdRoadName->Text = pLink->ROAD_NAME;
  110. String sRDR = "[" + pLink->ROAD_RANK + "] ";
  111. if (FCodeRDR)
  112. {
  113. TItsSubCode *pSubCode = FCodeRDR->FSubLists.Find(pLink->ROAD_RANK);
  114. if (pSubCode) sRDR = sRDR + pSubCode->CMMN_CD_KOR_NM;
  115. }
  116. EdRoadRank->Text = sRDR;
  117. //TItsTrafficLink *pTraf = ItsTrafficLinkManager->FList.Find(m_sLinkId);
  118. //if (pTraf)
  119. //{
  120. //}
  121. EdRoadRank->Visible = true;
  122. SelVmsInfo(ALinkId);
  123. }
  124. //---------------------------------------------------------------------------
  125. void __fastcall TFrmIncidVmsInfo::SelVmsInfo(String ALinkId)
  126. {
  127. String sQry;
  128. TADOQuery *pADO = NULL;
  129. CMM_ClearGridTableView(TvList);
  130. try
  131. {
  132. TvList->BeginUpdate();
  133. TcxDataController *pGDC = TvList->DataController;
  134. pADO = new TADOQuery(NULL);
  135. pADO->Close();
  136. pADO->Connection = ITSDb_GetConnection();
  137. try
  138. {
  139. #if 0
  140. //구간이 여러개 있기때문에 VMS가 중복으로 표출된다.
  141. sQry = "SELECT A.LINK_ID, A.IFSC_ID, B.VMS_IFSC_ID, C.VMS_CTLR_NMBR, \r\n"
  142. " D.VMS_CTLR_ID, D.VMS_NM \r\n"
  143. // " FROM TB_IFSC_RLTN_LINK A, \r\n"
  144. " FROM TB_IFSC_LINK_RLTN A, \r\n"
  145. " TB_VMS_IFSC_RLTN_IFSC B, \r\n"
  146. " TB_VMS_IFSC_RLTN C, \r\n"
  147. " TB_VMS_CTLR D \r\n"
  148. " WHERE A.IFSC_ID = B.IFSC_ID \r\n"
  149. " AND C.VMS_IFSC_ID = B.VMS_IFSC_ID \r\n"
  150. " AND C.VMS_CTLR_NMBR = D.VMS_CTLR_NMBR \r\n"
  151. " AND A.LINK_ID = :p01 \r\n"
  152. " ORDER BY C.VMS_CTLR_NMBR \r\n";
  153. #else
  154. sQry = "SELECT VMS_CTLR_NMBR, VMS_CTLR_ID, VMS_NM \r\n"
  155. " FROM TB_VMS_CTLR \r\n"
  156. " WHERE VMS_CTLR_NMBR IN (SELECT DISTINCT C.VMS_CTLR_NMBR AS VMS_CTLR_NMBR \r\n"
  157. // " FROM TB_IFSC_RLTN_LINK A, \r\n"
  158. " FROM TB_IFSC_LINK_RLTN A, \r\n"
  159. // " TB_VMS_IFSC_RLTN_IFSC B, \r\n"
  160. " TB_VMS_LINK_IFSC B, \r\n"
  161. " TB_VMS_IFSC_RLTN C \r\n"
  162. " WHERE A.IFSC_ID = B.IFSC_ID \r\n"
  163. " AND C.VMS_IFSC_ID = B.VMS_IFSC_ID \r\n"
  164. " AND A.LINK_ID = :p01 ) \r\n"
  165. " AND DEL_YN = 'N' \r\n"
  166. " ORDER BY VMS_CTLR_NMBR \r\n";
  167. #endif
  168. ITSDb_SQLText(pADO, sQry);
  169. ITSDb_SQLBind(pADO, "p01", ALinkId);
  170. ITSDb_SQLOpen(pADO);
  171. int nRow;
  172. for( ; !pADO->Eof; pADO->Next())
  173. {
  174. nRow = pGDC->AppendRecord();
  175. pGDC->Values[nRow][Column01->Index] = pADO->FieldByName("VMS_CTLR_NMBR")->AsString;
  176. pGDC->Values[nRow][Column12->Index] = pADO->FieldByName("VMS_CTLR_ID")->AsString;
  177. pGDC->Values[nRow][Column02->Index] = pADO->FieldByName("VMS_NM")->AsString;
  178. }
  179. }
  180. catch(EDatabaseError &E)
  181. {
  182. ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
  183. DBERRORMSG(Caption, String(E.ClassName()), E.Message, sQry);
  184. throw Exception(String(E.ClassName()) + E.Message);
  185. }
  186. catch(Exception &e)
  187. {
  188. ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
  189. DBERRORMSG(Caption, String(e.ClassName()), e.Message, sQry);
  190. throw Exception(String(e.ClassName()) + e.Message);
  191. }
  192. }
  193. __finally
  194. {
  195. if (pADO)
  196. {
  197. pADO->Close();
  198. delete pADO;
  199. }
  200. TvList->EndUpdate();
  201. }
  202. }
  203. //---------------------------------------------------------------------------
  204. void __fastcall TFrmIncidVmsInfo::BtnCloseClick(TObject *Sender)
  205. {
  206. Close();
  207. }
  208. //---------------------------------------------------------------------------