FRAME_IncidentProcessF.cpp 69 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "ITSSkinF.h"
  4. #include "ITSUtilF.h"
  5. #include "WindowMsgF.h"
  6. #include "AppGlobalF.h"
  7. #include "ITSSEL1MF.h"
  8. #include "ITSSELAMF.h"
  9. #include "CDSLinkF.h"
  10. #include "CDSNodeF.h"
  11. #include "ITSLangTransF.h"
  12. #pragma hdrstop
  13. #include "FRAME_IncidentProcessF.h"
  14. #include "FrmIncidVmsInfoF.h"
  15. #include "ITS00MAPF.h"
  16. //---------------------------------------------------------------------------
  17. #pragma package(smart_init)
  18. #pragma link "cxButtons"
  19. #pragma link "cxCalc"
  20. #pragma link "cxCalendar"
  21. #pragma link "cxCheckBox"
  22. #pragma link "cxClasses"
  23. #pragma link "cxContainer"
  24. #pragma link "cxControls"
  25. #pragma link "cxCustomData"
  26. #pragma link "cxData"
  27. #pragma link "cxDataStorage"
  28. #pragma link "cxDropDownEdit"
  29. #pragma link "cxEdit"
  30. #pragma link "cxFilter"
  31. #pragma link "cxGraphics"
  32. #pragma link "cxGrid"
  33. #pragma link "cxGridCustomTableView"
  34. #pragma link "cxGridCustomView"
  35. #pragma link "cxGridLevel"
  36. #pragma link "cxGridTableView"
  37. #pragma link "cxGroupBox"
  38. #pragma link "cxLabel"
  39. #pragma link "cxLookAndFeelPainters"
  40. #pragma link "cxLookAndFeels"
  41. #pragma link "cxMaskEdit"
  42. #pragma link "cxSpinEdit"
  43. #pragma link "cxSplitter"
  44. #pragma link "cxStyles"
  45. #pragma link "cxTextEdit"
  46. #pragma link "dxGDIPlusClasses"
  47. #pragma link "dxSkinBlack"
  48. #pragma link "dxSkinBlue"
  49. #pragma link "dxSkinsCore"
  50. #pragma link "dxSkinscxPCPainter"
  51. #pragma resource "*.dfm"
  52. TFRAMEIncidentProcess *FRAMEIncidentProcess;
  53. //---------------------------------------------------------------------------
  54. __fastcall TFRAMEIncidentProcess::TFRAMEIncidentProcess(TComponent* Owner)
  55. : TFrame(Owner)
  56. {
  57. LangTrans->Translate(this, ITSDb_GetConnection());
  58. ITSSkin_Load((TForm*)this);
  59. FTitle = Caption;//"돌발 진행상황 처리";
  60. FOcrrType = 0;
  61. FLinkId = "";
  62. FINCD_OCRR_ID = "";
  63. TvList->OptionsView->NoDataToDisplayInfoText = FrmLang->lblNoInfo->Caption;//"<등록된 돌발정보가 없습니다>";
  64. FCodeIST = ItsCodeManager->FLists.Find("IST"); //돌발상황 원본 코드 : IST
  65. FCodeLTCU = ItsCodeManager->FLists.Find("LTCU"); //소통 등급 코드 : LTCU
  66. FCodeICM = ItsCodeManager->FLists.Find("ICM"); //돌발상황 확인 방법 코드 : ICM
  67. FCodeIDTU = ItsCodeManager->FLists.Find("IDTU"); //돌발상황 유형 분류 코드 : IDTU
  68. FCodeACTU = ItsCodeManager->FLists.Find("ACTU"); //돌발상황 유형 코드 : ACTU, CRTU, EVTU, WETU 중 하나
  69. FCodeCRTU = ItsCodeManager->FLists.Find("CRTU"); //돌발상황 유형 코드 : ACTU, CRTU, EVTU, WETU 중 하나
  70. FCodeEVTU = ItsCodeManager->FLists.Find("EVTU"); //돌발상황 유형 코드 : ACTU, CRTU, EVTU, WETU 중 하나
  71. FCodeWETU = ItsCodeManager->FLists.Find("WETU"); //돌발상황 유형 코드 : ACTU, CRTU, EVTU, WETU 중 하나
  72. FCodeSRLU = ItsCodeManager->FLists.Find("SRLU"); //돌발상황 심각도 코드 : SRLU
  73. FCodePRTU = ItsCodeManager->FLists.Find("PRTU"); //통행 제한 유형 코드 : PRTU
  74. FCodeRSL = ItsCodeManager->FLists.Find("RSL"); //대응 수준 코드 : RSL
  75. FCodeISS = ItsCodeManager->FLists.Find("ISS"); //돌발상황 진행 단계 코드 : ISS
  76. FCodeICM = ItsCodeManager->FLists.Find("ICM"); //돌발상황 종료 확인 방법 코드 : ICM
  77. FCodeDFW = ItsCodeManager->FLists.Find("DFW"); //기상 코드 : DFW
  78. FCodeVIT = ItsCodeManager->FLists.Find("VIT"); //VMS 돌발 유형 코드 : VIT
  79. FCodeIDT = ItsCodeManager->FLists.Find("IDT"); //VMS 돌발 유형 세부 코드 : IDT
  80. FCodeEDT = ItsCodeManager->FLists.Find("EDT"); //VMS 돌발 유형 세부 코드 : EDT
  81. FCodeVRT = ItsCodeManager->FLists.Find("VRT"); //VMS 돌발 통제 코드 : VRT
  82. InitForm();
  83. }
  84. //---------------------------------------------------------------------------
  85. void __fastcall TFRAMEIncidentProcess::InitForm()
  86. {
  87. FSelLink.nSelLink = 0;
  88. for(int ii = 0; ii < MAX_INCLINK; ii++)
  89. {
  90. FSelLink.info[ii].sIncidentId = "";
  91. FSelLink.info[ii].sLinkId = "";
  92. FSelLink.info[ii].FPosX = 0;
  93. FSelLink.info[ii].FPosY = 0;
  94. }
  95. DtINCD_STRT_DT->Date = Now();
  96. DtINCD_END_PRAR_DT->Date = Now() + ( 1 / 24 );
  97. CbINCD_ORGN_CD->Properties->Items->Clear();
  98. if (FCodeIST)
  99. {
  100. FOR_STL(TItsSubCode *, pSubCode, FCodeIST->FSubLists)
  101. {
  102. if (pSubCode->USE_YN == "N") continue;
  103. CbINCD_ORGN_CD->Properties->Items->Add(" [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM);
  104. }
  105. }
  106. CbINCD_ORGN_CD->ItemIndex = 0;
  107. CbCMTR_GRAD_CD->Properties->Items->Clear();
  108. if (FCodeLTCU)
  109. {
  110. FOR_STL(TItsSubCode *, pSubCode, FCodeLTCU->FSubLists)
  111. {
  112. if (pSubCode->USE_YN == "N") continue;
  113. CbCMTR_GRAD_CD->Properties->Items->Add(" [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM);
  114. }
  115. }
  116. CbCMTR_GRAD_CD->ItemIndex = 0;
  117. CbINCD_CNFM_MTHD_CD->Properties->Items->Clear();
  118. if (FCodeICM)
  119. {
  120. FOR_STL(TItsSubCode *, pSubCode, FCodeICM->FSubLists)
  121. {
  122. if (pSubCode->USE_YN == "N") continue;
  123. CbINCD_CNFM_MTHD_CD->Properties->Items->Add(" [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM);
  124. }
  125. }
  126. CbINCD_CNFM_MTHD_CD->ItemIndex = 0;
  127. CbINCD_SERN_CD->Properties->Items->Clear();
  128. if (FCodeSRLU)
  129. {
  130. FOR_STL(TItsSubCode *, pSubCode, FCodeSRLU->FSubLists)
  131. {
  132. if (pSubCode->USE_YN == "N") continue;
  133. CbINCD_SERN_CD->Properties->Items->Add(" [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM);
  134. }
  135. }
  136. CbINCD_SERN_CD->ItemIndex = 0;
  137. CbINCD_TYPE_CLSF_CD->Properties->Items->Clear();
  138. if (FCodeIDTU)
  139. {
  140. FOR_STL(TItsSubCode *, pSubCode, FCodeIDTU->FSubLists)
  141. {
  142. if (pSubCode->USE_YN == "N") continue;
  143. CbINCD_TYPE_CLSF_CD->Properties->Items->Add(" [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM);
  144. }
  145. }
  146. CbINCD_TYPE_CLSF_CD->ItemIndex = 0;
  147. CbINCD_TYPE_CLSF_CDClick((TObject *)CbINCD_TYPE_CLSF_CD);
  148. #if 0
  149. if (FCodeACTU)
  150. {
  151. FOR_STL(TItsSubCode *, pSubCode , FCodeACTU->FSubLists)
  152. {
  153. if (pSubCode->USE_YN == "N") continue;
  154. CbINCD_TYPE_CD->Properties->Items->Add( " [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM);
  155. }
  156. }
  157. if (FCodeCRTU)
  158. {
  159. FOR_STL(TItsSubCode *, pSubCode , FCodeCRTU->FSubLists)
  160. {
  161. if (pSubCode->USE_YN == "N") continue;
  162. CbINCD_TYPE_CD->Properties->Items->Add( " [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM);
  163. }
  164. }
  165. if (FCodeEVTU)
  166. {
  167. FOR_STL(TItsSubCode *, pSubCode , FCodeEVTU->FSubLists)
  168. {
  169. if (pSubCode->USE_YN == "N") continue;
  170. CbINCD_TYPE_CD->Properties->Items->Add( " [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM);
  171. }
  172. }
  173. if (FCodeWETU)
  174. {
  175. FOR_STL(TItsSubCode *, pSubCode , FCodeWETU->FSubLists)
  176. {
  177. if (pSubCode->USE_YN == "N") continue;
  178. CbINCD_TYPE_CD->Properties->Items->Add( " [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM);
  179. }
  180. }
  181. #endif
  182. //통행 제한 유형 코드 : PRTU
  183. if (FCodePRTU)
  184. {
  185. FOR_STL(TItsSubCode *, pSubCode , FCodePRTU->FSubLists)
  186. {
  187. if (pSubCode->USE_YN == "N") continue;
  188. CbTRVL_LMNT_TYPE_CD->Properties->Items->Add( " [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM);
  189. }
  190. }
  191. //대응 수준 코드 : RSL
  192. if (FCodeRSL)
  193. {
  194. FOR_STL(TItsSubCode *, pSubCode , FCodeRSL->FSubLists)
  195. {
  196. if (pSubCode->USE_YN == "N") continue;
  197. CbRESP_LVL_CD->Properties->Items->Add( " [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM);
  198. }
  199. }
  200. //기상 코드 : DFW
  201. if (FCodeDFW)
  202. {
  203. FOR_STL(TItsSubCode *, pSubCode , FCodeDFW->FSubLists)
  204. {
  205. if (pSubCode->USE_YN == "N") continue;
  206. CbWTHR_CD->Properties->Items->Add( " [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM);
  207. }
  208. }
  209. //VMS 돌발 유형 코드 : VIT
  210. if (FCodeVIT)
  211. {
  212. FOR_STL(TItsSubCode *, pSubCode , FCodeVIT->FSubLists)
  213. {
  214. if (pSubCode->USE_YN == "N") continue;
  215. CbVMS_INCD_TYPE_CD->Properties->Items->Add( " [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM);
  216. }
  217. }
  218. //VMS 돌발 통제 코드 : VRT
  219. if (FCodeVRT)
  220. {
  221. FOR_STL(TItsSubCode *, pSubCode , FCodeVRT->FSubLists)
  222. {
  223. if (pSubCode->USE_YN == "N") continue;
  224. CbVMS_INCD_RSTR_TYPE_CD->Properties->Items->Add( " [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM);
  225. }
  226. }
  227. }
  228. //---------------------------------------------------------------------------
  229. void __fastcall TFRAMEIncidentProcess::InitScreen()
  230. {
  231. FSelLink.nSelLink = 0;
  232. for(int ii = 0; ii < MAX_INCLINK; ii++)
  233. {
  234. FSelLink.info[ii].sIncidentId = "";
  235. FSelLink.info[ii].sLinkId = "";
  236. FSelLink.info[ii].FPosX = 0;
  237. FSelLink.info[ii].FPosY = 0;
  238. }
  239. EdINCD_OCRR_ID->Text = "";
  240. EdRGST_DT->Text = "";
  241. EdRegDt->Text = "";
  242. CbINCD_ORGN_CD->Text = "";
  243. EdOCRR_LCTN_NM->Text = "";
  244. EdLINK_ID->Text = "";
  245. EdLinkId->Text = "";
  246. SePosX->Value = 0;
  247. SePosY->Value = 0;
  248. EdINCD_EXPL->Text = "";
  249. CbCMTR_GRAD_CD->Text = "";
  250. EdIFMR_NM->Text = "";
  251. CbINCD_CNFM_MTHD_CD->Text = "";
  252. CbINCD_SERN_CD->Text = "";
  253. EdINCD_TITL->Text = "";
  254. CbINCD_TYPE_CLSF_CD->Text = "";
  255. CbINCD_TYPE_CD->Text = "";
  256. DtINCD_STRT_DT->Date = Now();
  257. DtINCD_END_PRAR_DT->Date = Now();
  258. ChkINCD_OCRR_LANE_Extra->Checked = false;
  259. ChkINCD_OCRR_LANE_1->Checked = false;
  260. ChkINCD_OCRR_LANE_2->Checked = false;
  261. ChkINCD_OCRR_LANE_3->Checked = false;
  262. ChkINCD_OCRR_LANE_4->Checked = false;
  263. ChkINCD_OCRR_LANE_5->Checked = false;
  264. ChkINCD_CLSR_LANE_Extra->Checked = false;
  265. ChkINCD_CLSR_LANE_1->Checked = false;
  266. ChkINCD_CLSR_LANE_2->Checked = false;
  267. ChkINCD_CLSR_LANE_3->Checked = false;
  268. ChkINCD_CLSR_LANE_4->Checked = false;
  269. ChkINCD_CLSR_LANE_5->Checked = false;
  270. SeDELY_LNGT->Value = 0;
  271. SeINCD_LNGT->Value = 0;
  272. SeSMLT_VHCL_UNUM->Value = 0;
  273. SeMDLT_VHCL_UNUM->Value = 0;
  274. SeINJR_PNUM->Value = 0;
  275. SeFTLT_PNUM->Value = 0;
  276. CbWTHR_CD->Text = "";
  277. CbRESP_LVL_CD->Text = "";
  278. if (ChkUTIS_CNCT_YN->Enabled) ChkUTIS_CNCT_YN->Checked = false;
  279. ChkTRUB_VHCL_YN->Checked = false;
  280. ChkFALT_YN->Checked = false;
  281. ChkFRWT_YN->Checked = false;
  282. CbTRVL_LMNT_TYPE_CD->Text = "";
  283. ChkVMS_DSPL_YN->Checked = false;
  284. EdSTRT_LCTN_NM->Text = "";
  285. EdEND_LCTN_NM->Text = "";
  286. CbVMS_INCD_TYPE_CD->Text = "";
  287. CbVMS_INCD_DETL_TYPE_CD->Text = "";
  288. #ifdef YONGIN_INC
  289. CbVMS_INCD_RSTR_TYPE_CD->Text = "";
  290. #endif
  291. }
  292. //---------------------------------------------------------------------------
  293. void __fastcall TFRAMEIncidentProcess::UpdateList()
  294. {
  295. InitScreen();
  296. TItsSubCode *pSubCode;
  297. CMM_ClearGridTableView(TvList);
  298. TcxDataController *pGDC = TvList->DataController;
  299. int nRow = 0;
  300. try
  301. {
  302. TvList->BeginUpdate();
  303. try
  304. {
  305. ItsIncidentManager->FLists.Lock();
  306. FOR_STL(TItsIncident *, pObj, ItsIncidentManager->FLists)
  307. {
  308. #if 0
  309. if (pObj->INCD_PRGR_STEP_CD != "ISS1" &&
  310. pObj->INCD_PRGR_STEP_CD != "ISS2") continue;
  311. #else
  312. if (pObj->INCD_PRGR_STEP_CD != "ISS2") continue;
  313. #endif
  314. nRow = pGDC->AppendRecord();
  315. String sIST = "";
  316. if (pObj->INCD_ORGN_CD != "") sIST = " [" + pObj->INCD_ORGN_CD + "] ";
  317. String sLTCU= "";
  318. if (pObj->CMTR_GRAD_CD != "") sLTCU = " [" + pObj->CMTR_GRAD_CD + "] ";
  319. String sICM = "";
  320. if (pObj->INCD_CNFM_MTHD_CD != "") sICM = " [" + pObj->INCD_CNFM_MTHD_CD + "] ";
  321. String sSRLU= "";
  322. if (pObj->INCD_SERN_CD != "") sSRLU = " [" + pObj->INCD_SERN_CD + "] ";
  323. String sIDTU = "";
  324. if (pObj->INCD_TYPE_CLSF_CD != "") sIDTU = " [" + pObj->INCD_TYPE_CLSF_CD + "] ";
  325. String sACTU = "";
  326. if (pObj->INCD_TYPE_CD != "") sACTU = " [" + pObj->INCD_TYPE_CD + "] ";
  327. String sISS = "";
  328. if (pObj->INCD_PRGR_STEP_CD != "") sISS = " [" + pObj->INCD_PRGR_STEP_CD + "] ";
  329. String sDFW = "";
  330. if (pObj->WTHR_CD != "") sDFW = " [" + pObj->WTHR_CD + "] ";
  331. String sRSL = "";
  332. if (pObj->RESP_LVL_CD != "") sRSL = " [" + pObj->RESP_LVL_CD + "] ";
  333. String sPRTU = "";
  334. if (pObj->TRVL_LMNT_TYPE_CD != "") sPRTU = " [" + pObj->TRVL_LMNT_TYPE_CD + "] ";
  335. if (FCodeIST)
  336. {
  337. pSubCode = FCodeIST->FSubLists.Find(pObj->INCD_ORGN_CD);
  338. if (pSubCode) sIST = sIST + pSubCode->CMMN_CD_KOR_NM;
  339. }
  340. if (FCodeLTCU)
  341. {
  342. pSubCode = FCodeLTCU->FSubLists.Find(pObj->CMTR_GRAD_CD);
  343. if (pSubCode) sLTCU = sLTCU + pSubCode->CMMN_CD_KOR_NM;
  344. }
  345. if (FCodeICM)
  346. {
  347. pSubCode = FCodeICM->FSubLists.Find(pObj->INCD_CNFM_MTHD_CD);
  348. if (pSubCode) sICM = sICM + pSubCode->CMMN_CD_KOR_NM;
  349. }
  350. if (FCodeSRLU)
  351. {
  352. pSubCode = FCodeSRLU->FSubLists.Find(pObj->INCD_SERN_CD);
  353. if (pSubCode) sSRLU = sSRLU + pSubCode->CMMN_CD_KOR_NM;
  354. }
  355. if (FCodeIDTU)
  356. {
  357. pSubCode = FCodeIDTU->FSubLists.Find(pObj->INCD_TYPE_CLSF_CD);
  358. if (pSubCode) sIDTU = sIDTU + pSubCode->CMMN_CD_KOR_NM;
  359. }
  360. if (!pObj->INCD_TYPE_CLSF_CD.IsEmpty() && !pObj->INCD_TYPE_CD.IsEmpty())
  361. {
  362. if (pObj->INCD_TYPE_CLSF_CD == "1")
  363. {
  364. if (FCodeACTU)
  365. {
  366. pSubCode = FCodeACTU->FSubLists.Find(pObj->INCD_TYPE_CD);
  367. if (pSubCode) sACTU = sACTU + pSubCode->CMMN_CD_KOR_NM;
  368. }
  369. }
  370. else if (pObj->INCD_TYPE_CLSF_CD == "2")
  371. {
  372. if (FCodeCRTU)
  373. {
  374. pSubCode = FCodeCRTU->FSubLists.Find(pObj->INCD_TYPE_CD);
  375. if (pSubCode) sACTU = sACTU + pSubCode->CMMN_CD_KOR_NM;
  376. }
  377. }
  378. else if (pObj->INCD_TYPE_CLSF_CD == "3")
  379. {
  380. if (FCodeEVTU)
  381. {
  382. pSubCode = FCodeEVTU->FSubLists.Find(pObj->INCD_TYPE_CD);
  383. if (pSubCode) sACTU = sACTU + pSubCode->CMMN_CD_KOR_NM;
  384. }
  385. }
  386. else if (pObj->INCD_TYPE_CLSF_CD == "4")
  387. {
  388. if (FCodeWETU)
  389. {
  390. pSubCode = FCodeWETU->FSubLists.Find(pObj->INCD_TYPE_CD);
  391. if (pSubCode) sACTU = sACTU + pSubCode->CMMN_CD_KOR_NM;
  392. }
  393. }
  394. }
  395. if (FCodeISS)
  396. {
  397. pSubCode = FCodeISS->FSubLists.Find(pObj->INCD_PRGR_STEP_CD);
  398. if (pSubCode) sISS = sISS + pSubCode->CMMN_CD_KOR_NM;
  399. }
  400. if (FCodeDFW)
  401. {
  402. pSubCode = FCodeISS->FSubLists.Find(pObj->WTHR_CD);
  403. if (pSubCode) sDFW = sDFW + pSubCode->CMMN_CD_KOR_NM;
  404. }
  405. if (FCodeRSL)
  406. {
  407. pSubCode = FCodeRSL->FSubLists.Find(pObj->RESP_LVL_CD);
  408. if (pSubCode) sRSL = sRSL + pSubCode->CMMN_CD_KOR_NM;
  409. }
  410. if (FCodePRTU)
  411. {
  412. pSubCode = FCodePRTU->FSubLists.Find(pObj->TRVL_LMNT_TYPE_CD);
  413. if (pSubCode) sPRTU = sPRTU + pSubCode->CMMN_CD_KOR_NM;
  414. }
  415. pGDC->Values[nRow][Column01->Index] = pObj->INCD_OCRR_ID; //돌발상황 발생 ID
  416. pGDC->Values[nRow][Column02->Index] = ITSUtil_StrToTime(pObj->RGST_DT); //등록 일시
  417. pGDC->Values[nRow][Column03->Index] = sISS;//pObj->INCD_PRGR_STEP_CD; //돌발상황 진행 단계 코드 : ISS
  418. pGDC->Values[nRow][Column04->Index] = sIST;//pObj->INCD_ORGN_CD; //돌발상황 원본 코드 : IST
  419. pGDC->Values[nRow][Column05->Index] = pObj->OCRR_LCTN_NM; //발생 위치 명
  420. pGDC->Values[nRow][Column06->Index] = pObj->LINK_ID; //돌발발생 LINK ID
  421. pGDC->Values[nRow][Column07->Index] = pObj->X_CRDN; //X 좌표
  422. pGDC->Values[nRow][Column08->Index] = pObj->Y_CRDN; //Y 좌표
  423. pGDC->Values[nRow][Column09->Index] = pObj->INCD_EXPL; //돌발상황 설명
  424. pGDC->Values[nRow][Column10->Index] = sLTCU;//pObj->CMTR_GRAD_CD; //소통 등급 코드 : LTCU
  425. pGDC->Values[nRow][Column11->Index] = pObj->IFMR_NM; //제보자 명
  426. pGDC->Values[nRow][Column12->Index] = sICM;//pObj->INCD_CNFM_MTHD_CD; //돌발상황 확인 방법 코드 : ICM
  427. pGDC->Values[nRow][Column13->Index] = sSRLU;//pObj->INCD_SERN_CD; //돌발상황 심각도 코드 : SRLU
  428. pGDC->Values[nRow][Column14->Index] = pObj->INCD_TITL; //돌발상황 제목
  429. pGDC->Values[nRow][Column15->Index] = sIDTU;//pObj->INCD_TYPE_CLSF_CD; //돌발상황 유형 분류 코드 : IDTU
  430. pGDC->Values[nRow][Column16->Index] = sACTU;//pObj->INCD_TYPE_CD; //돌발상황 유형 코드 : ACTU, CRTU, EVTU, WETU 중 하나
  431. pGDC->Values[nRow][Column17->Index] = ITSUtil_StrToTime(pObj->INCD_STRT_DT); //돌발상황 시작 일시
  432. pGDC->Values[nRow][Column18->Index] = ITSUtil_StrToTime(pObj->INCD_END_PRAR_DT); //돌발상황 종료 예정 일시
  433. pGDC->Values[nRow][Column19->Index] = pObj->INCD_OCRR_LANE; //돌발상황 발생 차로
  434. pGDC->Values[nRow][Column20->Index] = pObj->INCD_CLSR_LANE; //돌발상황 차단 차로
  435. pGDC->Values[nRow][Column21->Index] = pObj->DELY_LNGT; //지체 길이
  436. pGDC->Values[nRow][Column22->Index] = pObj->INCD_LNGT; //돌발상황 길이
  437. pGDC->Values[nRow][Column23->Index] = pObj->SMLT_VHCL_UNUM; //소형 차량 대수
  438. pGDC->Values[nRow][Column24->Index] = pObj->MDLT_VHCL_UNUM; //중대형 차량 대수
  439. pGDC->Values[nRow][Column25->Index] = pObj->INJR_PNUM; //부상자 인원수
  440. pGDC->Values[nRow][Column26->Index] = pObj->FTLT_PNUM; //사망자 인원수
  441. pGDC->Values[nRow][Column27->Index] = sDFW;//pObj->WTHR_CD; //기상 코드 : DFW
  442. pGDC->Values[nRow][Column28->Index] = sRSL;//pObj->RESP_LVL_CD; //대응 수준 코드 : RSL
  443. pGDC->Values[nRow][Column29->Index] = pObj->UTIS_CNCT_YN; //UTIS 연계 여부
  444. pGDC->Values[nRow][Column30->Index] = pObj->TRUB_VHCL_YN; //고장 차량 여부
  445. pGDC->Values[nRow][Column31->Index] = pObj->FALT_YN; //낙하물 여부
  446. pGDC->Values[nRow][Column32->Index] = pObj->FRWT_YN; //화재위험물 여부
  447. pGDC->Values[nRow][Column33->Index] = sPRTU;//pObj->TRVL_LMNT_TYPE_CD; //통행 제한 유형 코드 : PRTU
  448. pGDC->Values[nRow][Column34->Index] = pObj->VMS_DSPL_YN; //VMS 표출 여부
  449. pGDC->Values[nRow][Column35->Index] = ITSUtil_StrToDateTime(pObj->INCD_CNFM_DT); //VMS 표출 여부
  450. pGDC->Values[nRow][Column99->Index] = (int)pObj;
  451. }
  452. }
  453. __finally
  454. {
  455. ItsIncidentManager->FLists.UnLock();
  456. }
  457. }
  458. __finally
  459. {
  460. LblRecords->Caption = "("+FormatFloat("##,##0", pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", pGDC->RecordCount) + ")";
  461. TvList->EndUpdate();
  462. TvList->DataController->GotoFirst();
  463. TvList->DataController->FocusedRecordIndex = 0;
  464. }
  465. #if 0
  466. if (FINCD_OCRR_ID != "")
  467. {
  468. CMM_SetGridRow(CxList, TvList, FINCD_OCRR_ID, Column01->Index);
  469. DisplayIncidentInfo();
  470. }
  471. #endif
  472. }
  473. //---------------------------------------------------------------------------
  474. void __fastcall TFRAMEIncidentProcess::TvListDataControllerFilterChanged(TObject *Sender)
  475. {
  476. CMM_SetFilterLike(TvList);
  477. TcxDataController *pGDC = TvList->DataController;
  478. LblRecords->Caption = "("+FormatFloat("##,##0", pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", pGDC->RecordCount) + ")";
  479. }
  480. //---------------------------------------------------------------------------
  481. void __fastcall TFRAMEIncidentProcess::BtnExlSaveClick(TObject *Sender)
  482. {
  483. TcxGrid *pGrid = CxList;
  484. TcxGridTableView *pView = TvList;
  485. String sTitle= lblFileName->Caption;//"등록된 돌발정보";
  486. CMM_ExportToExcelFile(sTitle, pGrid, pView, (TForm*)this);
  487. }
  488. //---------------------------------------------------------------------------
  489. void __fastcall TFRAMEIncidentProcess::CbINCD_TYPE_CLSF_CDClick(TObject *Sender)
  490. {
  491. if (CbINCD_TYPE_CLSF_CD->ItemIndex < 0) return;
  492. CbINCD_TYPE_CD->Properties->Items->Clear();
  493. String sCode = ITSUtil_GetCode(CbINCD_TYPE_CLSF_CD->Text);
  494. if (sCode == "1")
  495. {
  496. if (FCodeACTU)
  497. {
  498. FOR_STL(TItsSubCode *, pSubCode, FCodeACTU->FSubLists)
  499. {
  500. if (pSubCode->USE_YN == "N") continue;
  501. CbINCD_TYPE_CD->Properties->Items->Add(" [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM);
  502. }
  503. }
  504. }
  505. else
  506. if (sCode == "2")
  507. {
  508. if (FCodeCRTU)
  509. {
  510. FOR_STL(TItsSubCode *, pSubCode, FCodeCRTU->FSubLists)
  511. {
  512. if (pSubCode->USE_YN == "N") continue;
  513. CbINCD_TYPE_CD->Properties->Items->Add(" [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM);
  514. }
  515. }
  516. }
  517. else
  518. if (sCode == "3")
  519. {
  520. if (FCodeEVTU)
  521. {
  522. FOR_STL(TItsSubCode *, pSubCode, FCodeEVTU->FSubLists)
  523. {
  524. if (pSubCode->USE_YN == "N") continue;
  525. CbINCD_TYPE_CD->Properties->Items->Add(" [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM);
  526. }
  527. }
  528. }
  529. else
  530. if (sCode == "4")
  531. {
  532. if (FCodeWETU)
  533. {
  534. FOR_STL(TItsSubCode *, pSubCode, FCodeWETU->FSubLists)
  535. {
  536. if (pSubCode->USE_YN == "N") continue;
  537. CbINCD_TYPE_CD->Properties->Items->Add(" [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM);
  538. }
  539. }
  540. }
  541. CbINCD_TYPE_CD->ItemIndex = 0;
  542. }
  543. //---------------------------------------------------------------------------
  544. void __fastcall TFRAMEIncidentProcess::CbVMS_INCD_TYPE_CDClick(TObject *Sender)
  545. {
  546. if (CbVMS_INCD_TYPE_CD->ItemIndex < 0) return;
  547. CbVMS_INCD_DETL_TYPE_CD->Properties->Items->Clear();
  548. String strText = CbVMS_INCD_TYPE_CD->Text;
  549. cxLabel_VMS_INCD_TYPE_CD->Caption = strText.SubString( 0, strText.Pos( "[" )-1 );
  550. String sCode = ITSUtil_GetCode(CbVMS_INCD_TYPE_CD->Text);
  551. if (sCode == "VIT1")
  552. {
  553. if (FCodeIDT)
  554. {
  555. FOR_STL(TItsSubCode *, pSubCode, FCodeIDT->FSubLists)
  556. {
  557. if (pSubCode->USE_YN == "N") continue;
  558. CbVMS_INCD_DETL_TYPE_CD->Properties->Items->Add(" [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM);
  559. }
  560. }
  561. }
  562. else
  563. if (sCode == "VIT2" )
  564. {
  565. if (FCodeEDT)
  566. {
  567. FOR_STL(TItsSubCode *, pSubCode, FCodeEDT->FSubLists)
  568. {
  569. if (pSubCode->USE_YN == "N") continue;
  570. CbVMS_INCD_DETL_TYPE_CD->Properties->Items->Add(" [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM);
  571. }
  572. }
  573. }
  574. }
  575. //---------------------------------------------------------------------------
  576. void __fastcall TFRAMEIncidentProcess::DisplayIncidentInfo()
  577. {
  578. FLinkId = "";
  579. //BtnVmsTarget->Enabled = false;
  580. TcxDataController *pGDC = TvList->DataController;
  581. int nRow = pGDC->FocusedRecordIndex;
  582. if( nRow <= -1 )
  583. return;
  584. TItsSubCode *pSubCode;
  585. //TItsIncident *pObj = NULL;
  586. //int nMemPtr = pGDC->Values[nRow][Column99->Index];
  587. //pObj = (TItsIncident *)nMemPtr;
  588. try
  589. {
  590. String sINCD_OCRR_ID = pGDC->Values[nRow][Column01->Index];
  591. FINCD_OCRR_ID = sINCD_OCRR_ID;
  592. TItsIncident *pObj = ItsIncidentManager->FLists.Find(sINCD_OCRR_ID);
  593. if (!pObj) return;
  594. //InitScreen();
  595. String sIST = "";
  596. String sLTCU = "";
  597. String sICM = "";
  598. String sSRLU = "";
  599. String sIDTU = "";
  600. String sACTU = "";
  601. String sISS = "";
  602. String sDFW = "";
  603. String sRSL = "";
  604. String sPRTU = "";
  605. if (pObj->INCD_ORGN_CD != "") sIST = " [" + pObj->INCD_ORGN_CD + "] ";
  606. if (pObj->CMTR_GRAD_CD != "") sLTCU = " [" + pObj->CMTR_GRAD_CD + "] ";
  607. if (pObj->INCD_CNFM_MTHD_CD != "") sICM = " [" + pObj->INCD_CNFM_MTHD_CD + "] ";
  608. if (pObj->INCD_SERN_CD != "") sSRLU = " [" + pObj->INCD_SERN_CD + "] ";
  609. if (pObj->INCD_TYPE_CLSF_CD != "") sIDTU = " [" + pObj->INCD_TYPE_CLSF_CD + "] ";
  610. if (pObj->INCD_TYPE_CD != "") sACTU = " [" + pObj->INCD_TYPE_CD + "] ";
  611. if (pObj->INCD_PRGR_STEP_CD != "") sISS = " [" + pObj->INCD_PRGR_STEP_CD + "] ";
  612. if (pObj->WTHR_CD != "") sDFW = " [" + pObj->WTHR_CD + "] ";
  613. if (pObj->RESP_LVL_CD != "") sRSL = " [" + pObj->RESP_LVL_CD + "] ";
  614. if (pObj->TRVL_LMNT_TYPE_CD != "") sPRTU = " [" + pObj->TRVL_LMNT_TYPE_CD + "] ";
  615. if (FCodeIST)
  616. {
  617. pSubCode = FCodeIST->FSubLists.Find(pObj->INCD_ORGN_CD);
  618. if (pSubCode) sIST = sIST + pSubCode->CMMN_CD_KOR_NM;
  619. }
  620. if (FCodeLTCU)
  621. {
  622. pSubCode = FCodeLTCU->FSubLists.Find(pObj->CMTR_GRAD_CD);
  623. if (pSubCode) sLTCU = sLTCU + pSubCode->CMMN_CD_KOR_NM;
  624. }
  625. if (FCodeICM)
  626. {
  627. pSubCode = FCodeICM->FSubLists.Find(pObj->INCD_CNFM_MTHD_CD);
  628. if (pSubCode) sICM = sICM + pSubCode->CMMN_CD_KOR_NM;
  629. }
  630. if (FCodeSRLU)
  631. {
  632. pSubCode = FCodeSRLU->FSubLists.Find(pObj->INCD_SERN_CD);
  633. if (pSubCode) sSRLU = sSRLU + pSubCode->CMMN_CD_KOR_NM;
  634. }
  635. if (FCodeIDTU)
  636. {
  637. pSubCode = FCodeIDTU->FSubLists.Find(pObj->INCD_TYPE_CLSF_CD);
  638. if (pSubCode) sIDTU = sIDTU + pSubCode->CMMN_CD_KOR_NM;
  639. }
  640. if (!pObj->INCD_TYPE_CLSF_CD.IsEmpty() && !pObj->INCD_TYPE_CD.IsEmpty())
  641. {
  642. if (pObj->INCD_TYPE_CLSF_CD == "1")
  643. {
  644. if (FCodeACTU)
  645. {
  646. pSubCode = FCodeACTU->FSubLists.Find(pObj->INCD_TYPE_CD);
  647. if (pSubCode) sACTU = sACTU + pSubCode->CMMN_CD_KOR_NM;
  648. }
  649. }
  650. else if (pObj->INCD_TYPE_CLSF_CD == "2")
  651. {
  652. if (FCodeCRTU)
  653. {
  654. pSubCode = FCodeCRTU->FSubLists.Find(pObj->INCD_TYPE_CD);
  655. if (pSubCode) sACTU = sACTU + pSubCode->CMMN_CD_KOR_NM;
  656. }
  657. }
  658. else if (pObj->INCD_TYPE_CLSF_CD == "3")
  659. {
  660. if (FCodeEVTU)
  661. {
  662. pSubCode = FCodeEVTU->FSubLists.Find(pObj->INCD_TYPE_CD);
  663. if (pSubCode) sACTU = sACTU + pSubCode->CMMN_CD_KOR_NM;
  664. }
  665. }
  666. else if (pObj->INCD_TYPE_CLSF_CD == "4")
  667. {
  668. if (FCodeWETU)
  669. {
  670. pSubCode = FCodeWETU->FSubLists.Find(pObj->INCD_TYPE_CD);
  671. if (pSubCode) sACTU = sACTU + pSubCode->CMMN_CD_KOR_NM;
  672. }
  673. }
  674. }
  675. if (FCodeISS)
  676. {
  677. pSubCode = FCodeISS->FSubLists.Find(pObj->INCD_PRGR_STEP_CD);
  678. if (pSubCode) sISS = sISS + pSubCode->CMMN_CD_KOR_NM;
  679. }
  680. if (FCodeDFW)
  681. {
  682. pSubCode = FCodeDFW->FSubLists.Find(pObj->WTHR_CD);
  683. if (pSubCode) sDFW = sDFW + pSubCode->CMMN_CD_KOR_NM;
  684. }
  685. if (FCodeRSL)
  686. {
  687. pSubCode = FCodeRSL->FSubLists.Find(pObj->RESP_LVL_CD);
  688. if (pSubCode) sRSL = sRSL + pSubCode->CMMN_CD_KOR_NM;
  689. }
  690. if (FCodePRTU)
  691. {
  692. pSubCode = FCodePRTU->FSubLists.Find(pObj->TRVL_LMNT_TYPE_CD);
  693. if (pSubCode) sPRTU = sPRTU + pSubCode->CMMN_CD_KOR_NM;
  694. }
  695. EdINCD_OCRR_ID->Text = pObj->INCD_OCRR_ID;
  696. EdRGST_DT->Text = ITSUtil_StrToDateTime(pObj->RGST_DT);
  697. EdRegDt->Text = pObj->RGST_DT;
  698. CbINCD_ORGN_CD->Text = sIST;
  699. EdOCRR_LCTN_NM->Text = pObj->OCRR_LCTN_NM;
  700. EdLINK_ID->Text = pObj->LINK_ID;
  701. EdLinkId->Text = pObj->LINK_ID;
  702. FLinkId = pObj->LINK_ID;
  703. if (pObj->X_CRDN.IsEmpty()) pObj->X_CRDN = "0.0";
  704. SePosX->Value = StrToFloat(pObj->X_CRDN);
  705. if (pObj->Y_CRDN.IsEmpty()) pObj->Y_CRDN = "0.0";
  706. SePosY->Value = StrToFloat(pObj->Y_CRDN);
  707. FSelLink.nSelLink = 0;
  708. FSelLink.info[FSelLink.nSelLink].sIncidentId = EdINCD_OCRR_ID->Text;
  709. FSelLink.info[FSelLink.nSelLink].sLinkId = FLinkId;
  710. FSelLink.info[FSelLink.nSelLink].FPosX = SePosX->Value;
  711. FSelLink.info[FSelLink.nSelLink].FPosY = SePosY->Value;
  712. FSelLink.nSelLink++;
  713. EdINCD_EXPL->Text = pObj->INCD_EXPL;
  714. CbCMTR_GRAD_CD->Text = sLTCU;
  715. EdIFMR_NM->Text = pObj->IFMR_NM;
  716. CbINCD_CNFM_MTHD_CD->Text = sICM;
  717. CbINCD_SERN_CD->Text = sSRLU;
  718. CbINCD_TYPE_CLSF_CD->Text = sIDTU;
  719. CbINCD_TYPE_CLSF_CDClick((TObject *)CbINCD_TYPE_CLSF_CD);
  720. CbINCD_TYPE_CD->Text = sACTU;
  721. EdINCD_TITL->Text = pObj->INCD_TITL;
  722. DtINCD_STRT_DT->Date = ITSUtil_StrToDateTime(pObj->INCD_STRT_DT);
  723. DtINCD_END_PRAR_DT->Date = ITSUtil_StrToDateTime(pObj->INCD_END_PRAR_DT);
  724. String sTemp;
  725. sTemp = pObj->INCD_OCRR_LANE; //돌발상황 발생 차로
  726. if (sTemp.IsEmpty())
  727. {
  728. sTemp = "000000";
  729. }
  730. else
  731. if (sTemp.Length() != 6)
  732. {
  733. sTemp = "000000";
  734. }
  735. int A1, A2, A3, A4, A5, A6;
  736. A1 = sTemp.SubString(1, 1).ToIntDef(0);
  737. A2 = sTemp.SubString(2, 1).ToIntDef(0);
  738. A3 = sTemp.SubString(3, 1).ToIntDef(0);
  739. A4 = sTemp.SubString(4, 1).ToIntDef(0);
  740. A5 = sTemp.SubString(5, 1).ToIntDef(0);
  741. A6 = sTemp.SubString(6, 1).ToIntDef(0);
  742. ChkINCD_OCRR_LANE_Extra->Checked = sTemp.SubString(1, 1).ToIntDef(0);
  743. ChkINCD_OCRR_LANE_1->Checked = sTemp.SubString(2, 1).ToIntDef(0);
  744. ChkINCD_OCRR_LANE_2->Checked = sTemp.SubString(3, 1).ToIntDef(0);
  745. ChkINCD_OCRR_LANE_3->Checked = sTemp.SubString(4, 1).ToIntDef(0);
  746. ChkINCD_OCRR_LANE_4->Checked = sTemp.SubString(5, 1).ToIntDef(0);
  747. ChkINCD_OCRR_LANE_5->Checked = sTemp.SubString(6, 1).ToIntDef(0);
  748. sTemp = pObj->INCD_CLSR_LANE; //돌발상황 차단 차로
  749. ChkINCD_CLSR_LANE_Extra->Checked = sTemp.SubString(1, 1).ToIntDef(0);
  750. ChkINCD_CLSR_LANE_1->Checked = sTemp.SubString(2, 1).ToIntDef(0);
  751. ChkINCD_CLSR_LANE_2->Checked = sTemp.SubString(3, 1).ToIntDef(0);
  752. ChkINCD_CLSR_LANE_3->Checked = sTemp.SubString(4, 1).ToIntDef(0);
  753. ChkINCD_CLSR_LANE_4->Checked = sTemp.SubString(5, 1).ToIntDef(0);
  754. ChkINCD_CLSR_LANE_5->Checked = sTemp.SubString(6, 1).ToIntDef(0);
  755. SeDELY_LNGT->Value = pObj->DELY_LNGT.ToIntDef(0);
  756. SeINCD_LNGT->Value = pObj->INCD_LNGT.ToIntDef(0);
  757. SeSMLT_VHCL_UNUM->Value = pObj->SMLT_VHCL_UNUM.ToIntDef(0);
  758. SeMDLT_VHCL_UNUM->Value = pObj->MDLT_VHCL_UNUM.ToIntDef(0);
  759. SeINJR_PNUM->Value = pObj->INJR_PNUM.ToIntDef(0);
  760. SeFTLT_PNUM->Value = pObj->FTLT_PNUM.ToIntDef(0);
  761. CbWTHR_CD->Text = sDFW;
  762. CbRESP_LVL_CD->Text = sRSL;
  763. //공단에서 넘어온 돌발은 공단연계가 표출안되게
  764. if (pObj->INCD_ORGN_CD == "IST5")
  765. {
  766. ChkUTIS_CNCT_YN->Checked = false;
  767. ChkUTIS_CNCT_YN->Enabled = false;
  768. }
  769. else
  770. {
  771. ChkUTIS_CNCT_YN->Enabled = true;
  772. ChkUTIS_CNCT_YN->Checked = pObj->UTIS_CNCT_YN == "Y" ? true : false;
  773. }
  774. ChkTRUB_VHCL_YN->Checked = pObj->TRUB_VHCL_YN == "Y" ? true : false;
  775. ChkFALT_YN->Checked = pObj->FALT_YN == "Y" ? true : false;
  776. ChkFRWT_YN->Checked = pObj->FRWT_YN == "Y" ? true : false;
  777. CbTRVL_LMNT_TYPE_CD->Text = sPRTU;
  778. ChkVMS_DSPL_YN->Checked = pObj->VMS_DSPL_YN == "Y" ? true : false;
  779. EdSTRT_LCTN_NM->Text = "";
  780. EdEND_LCTN_NM->Text = "";
  781. CbVMS_INCD_TYPE_CD->Text = "";
  782. CbVMS_INCD_DETL_TYPE_CD->Text = "";
  783. CbVMS_INCD_RSTR_TYPE_CD->Text = "";
  784. TItsVmsIncident *pVmsObj = ItsIncidentManager->FVmsLists.Find(pObj->INCD_OCRR_ID);
  785. if (pVmsObj)
  786. {
  787. String sVIT;
  788. String sIDT;
  789. String sVRT;
  790. if (FCodeVIT)
  791. {
  792. pSubCode = FCodeVIT->FSubLists.Find(pVmsObj->VMS_INCD_TYPE_CD);
  793. if (pSubCode)
  794. {
  795. sVIT = " [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM;
  796. if (pSubCode->CMMN_CD == "VIT1")
  797. {
  798. if (FCodeIDT)
  799. {
  800. pSubCode = FCodeIDT->FSubLists.Find(pVmsObj->VMS_INCD_DETL_TYPE_CD);
  801. if (pSubCode)
  802. {
  803. sIDT = " [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM;
  804. }
  805. }
  806. }
  807. else if (pSubCode->CMMN_CD == "VIT2")
  808. {
  809. if (FCodeEDT)
  810. {
  811. pSubCode = FCodeEDT->FSubLists.Find(pVmsObj->VMS_INCD_DETL_TYPE_CD);
  812. if (pSubCode)
  813. {
  814. sIDT = " [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM;
  815. }
  816. }
  817. }
  818. }
  819. }
  820. if (FCodeVRT)
  821. {
  822. pSubCode = FCodeVRT->FSubLists.Find(pVmsObj->VMS_INCD_RSTR_TYPE_CD);
  823. if (pSubCode)
  824. {
  825. sVRT = " [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM;
  826. }
  827. }
  828. EdSTRT_LCTN_NM->Text = pVmsObj->STRT_LCTN_NM;
  829. EdEND_LCTN_NM->Text = pVmsObj->END_LCTN_NM;
  830. CbVMS_INCD_TYPE_CD->Text = sVIT;//pVmsObj->VMS_INCD_TYPE_CD
  831. CbVMS_INCD_DETL_TYPE_CD->Text = sIDT;//pVmsObj->VMS_INCD_DETL_TYPE_CD
  832. CbVMS_INCD_RSTR_TYPE_CD->Text = sVRT;
  833. }
  834. FOcrrType = 0;
  835. if (FLinkId != "")
  836. {
  837. //BtnVmsTarget->Enabled = true;
  838. }
  839. }
  840. catch(...)
  841. {
  842. }
  843. }
  844. //---------------------------------------------------------------------------
  845. void __fastcall TFRAMEIncidentProcess::TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
  846. TMouseButton AButton, TShiftState AShift, bool &AHandled)
  847. {
  848. DisplayIncidentInfo();
  849. }
  850. //---------------------------------------------------------------------------
  851. void __fastcall TFRAMEIncidentProcess::BtnSelectClick(TObject *Sender)
  852. {
  853. PopupSelLink->Popup(BtnSelect->ClientOrigin.x, BtnSelect->ClientOrigin.y + BtnSelect->Height);
  854. }
  855. //---------------------------------------------------------------------------
  856. void __fastcall TFRAMEIncidentProcess::BtnInfoCancelClick(TObject *Sender)
  857. {
  858. InitScreen();
  859. FOcrrType = 0;
  860. }
  861. //---------------------------------------------------------------------------
  862. void __fastcall TFRAMEIncidentProcess::BtnMissInfoClick(TObject *Sender)
  863. {
  864. if (EdINCD_OCRR_ID->Text.IsEmpty())
  865. {
  866. Application->MessageBox(L"돌발 오보 판정\r\n돌발 구간을 먼저 선택하세요.",
  867. FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  868. return;
  869. }
  870. if (FOcrrType == 1)
  871. {
  872. Application->MessageBox(L"돌발 오보 판정\r\n돌발 예상구간 정보는 오보로 판정할 수 없습니다.",
  873. FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  874. return;
  875. }
  876. if (Application->MessageBox(L"돌발 오보 판정\r\n현재 돌발 정보를 오보로 판정 하시겠습니까?",
  877. FTitle.c_str(), MB_YESNO|MB_ICONQUESTION|MB_APPLMODAL) != IDYES) return;
  878. TItsIncident *pObj = ItsIncidentManager->FLists.Find(EdINCD_OCRR_ID->Text);
  879. if (!pObj) return;
  880. if (UpdateMissIncident(pObj->INCD_OCRR_ID))
  881. {
  882. pObj->INCD_PRGR_STEP_CD = "ISS4"; // 오보판정
  883. UpdateList();
  884. InitScreen();
  885. Application->ProcessMessages();
  886. POST_MSG(Application->MainForm->Handle, WM_DATABASE_REFRESH, WP_MSG_02, 0);
  887. }
  888. }
  889. //---------------------------------------------------------------------------
  890. bool __fastcall TFRAMEIncidentProcess::UpdateMissIncident(String AINCD_OCRR_ID)
  891. {
  892. String sQry;
  893. TADOQuery *pADO = NULL;
  894. try
  895. {
  896. try
  897. {
  898. pADO = new TADOQuery(NULL);
  899. pADO->Close();
  900. pADO->Connection = ITSDb_GetConnection();
  901. ITSDb_GetConnection()->BeginTrans();
  902. sQry = "UPDATE TB_INCD_OCRR \r\n"
  903. " SET INCD_PRGR_STEP_CD = 'ISS4' \r\n"
  904. " WHERE INCD_OCRR_ID = :p01 \r\n";
  905. ITSDb_SQLText(pADO, sQry);
  906. ITSDb_SQLBind(pADO, "p01", AINCD_OCRR_ID);
  907. ITSDb_SQLExec(pADO);
  908. ITSDb_GetConnection()->CommitTrans();
  909. // 공단연계 정보도 삭제해 버리자.
  910. ItsIncidentManager->DeleteIncidentLoc(AINCD_OCRR_ID);
  911. Application->MessageBox(FrmLang->lblDbSave->Caption.c_str(),//L"돌발정보를 오보 판정 돌발 정보로 저장 하였습니다.",
  912. FTitle.c_str(), MB_OK|MB_ICONINFORMATION|MB_APPLMODAL);
  913. }
  914. catch(EDatabaseError &E)
  915. {
  916. ITSDb_GetConnection()->RollbackTrans();
  917. ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
  918. ShowMessage(String(E.ClassName()) + E.Message);
  919. }
  920. catch(Exception &exception)
  921. {
  922. ITSDb_GetConnection()->RollbackTrans();
  923. ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
  924. ShowMessage(String(exception.ClassName()) + exception.Message);
  925. }
  926. catch(...)
  927. {
  928. ITSDb_GetConnection()->RollbackTrans();
  929. ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
  930. ShowMessage(FrmLang->lblDbErr->Caption);//"데이터 작업 중에 알수없는 DB 오류가 발생하였습니다.");
  931. }
  932. }
  933. __finally
  934. {
  935. if (pADO)
  936. {
  937. pADO->Close();
  938. delete pADO;
  939. }
  940. }
  941. return true;
  942. }
  943. //---------------------------------------------------------------------------
  944. void __fastcall TFRAMEIncidentProcess::BtnSaveClick(TObject *Sender)
  945. {
  946. //입력
  947. if (EdINCD_OCRR_ID->Text.Trim().IsEmpty())
  948. {
  949. Application->MessageBox(L"돌발정보입력\r\n목록에서 돌발정보를 선택하신 후에 작업을 진행하세요.",
  950. FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  951. return;
  952. }
  953. if (CbINCD_ORGN_CD->Text.IsEmpty())
  954. {
  955. Application->MessageBox(L"★[돌발구분] 항목은 필수 입력 항목입니다.\r\n입력후 진행해 주세요.",
  956. FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  957. if (CbINCD_ORGN_CD->CanFocus()) CbINCD_ORGN_CD->SetFocus();
  958. return;
  959. }
  960. if (CbINCD_CNFM_MTHD_CD->Text.IsEmpty())
  961. {
  962. Application->MessageBox(L"★[확인방법] 항목은 필수 입력 항목입니다.\r\n입력후 진행해 주세요.",
  963. FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  964. if (CbINCD_CNFM_MTHD_CD->CanFocus()) CbINCD_CNFM_MTHD_CD->SetFocus();
  965. return;
  966. }
  967. if (CbINCD_TYPE_CLSF_CD->Text.IsEmpty())
  968. {
  969. Application->MessageBox(L"★[돌발유형] 항목은 필수 입력 항목입니다.\r\n입력후 진행해 주세요.",
  970. FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  971. if (CbINCD_TYPE_CLSF_CD->CanFocus()) CbINCD_TYPE_CLSF_CD->SetFocus();
  972. return;
  973. }
  974. if (CbINCD_SERN_CD->Text.IsEmpty())
  975. {
  976. Application->MessageBox(L"★[심각도] 항목은 필수 입력 항목입니다.\r\n입력후 진행해 주세요.",
  977. FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  978. if (CbINCD_SERN_CD->CanFocus()) CbINCD_SERN_CD->SetFocus();
  979. return;
  980. }
  981. if (CbINCD_TYPE_CD->Text.IsEmpty())
  982. {
  983. Application->MessageBox(L"★[돌발세부유형] 항목은 필수 입력 항목입니다.\r\n입력후 진행해 주세요.",
  984. FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  985. if (CbINCD_TYPE_CD->CanFocus()) CbINCD_TYPE_CD->SetFocus();
  986. return;
  987. }
  988. if (DtINCD_STRT_DT->EditValue.IsEmpty())
  989. {
  990. Application->MessageBox(L"★[돌발시작시각] 항목은 필수 입력 항목입니다.\r\n입력후 진행해 주세요.",
  991. FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  992. if (DtINCD_STRT_DT->CanFocus()) DtINCD_STRT_DT->SetFocus();
  993. return;
  994. }
  995. if (DtINCD_END_PRAR_DT->EditValue.IsEmpty())
  996. {
  997. Application->MessageBox(L"★[종료예정시각] 항목은 필수 입력 항목입니다.\r\n입력후 진행해 주세요.",
  998. FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  999. if (DtINCD_END_PRAR_DT->CanFocus()) DtINCD_END_PRAR_DT->SetFocus();
  1000. return;
  1001. }
  1002. if (EdLinkId->Text.Trim().IsEmpty())
  1003. {
  1004. Application->MessageBox(L"★[발생구간(링크)] 항목은 필수 입력 항목입니다.\r\n입력후 진행해 주세요.",
  1005. FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  1006. if (EdLinkId->CanFocus()) EdLinkId->SetFocus();
  1007. return;
  1008. }
  1009. if (SePosX->Value == 0 ||
  1010. SePosY->Value == 0)
  1011. {
  1012. Application->MessageBox(L"★발생구간(링크) 좌표값은 0이 될수 없습니다.] 항목은 필수 입력 항목입니다.\r\n입력후 진행해 주세요.",
  1013. FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  1014. if (SePosX->CanFocus()) SePosX->SetFocus();
  1015. return;
  1016. }
  1017. if (EdINCD_EXPL->Text.Trim().IsEmpty())
  1018. {
  1019. Application->MessageBox(L"★[돌발상황설명] 항목은 필수 입력 항목입니다.\r\n입력후 진행해 주세요.",
  1020. FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  1021. if (EdINCD_EXPL->CanFocus()) EdINCD_EXPL->SetFocus();
  1022. return;
  1023. }
  1024. if (EdINCD_TITL->Text.Trim().IsEmpty())
  1025. {
  1026. Application->MessageBox(L"★[돌발제목] 항목은 필수 입력 항목입니다.\r\n입력후 진행해 주세요.",
  1027. FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  1028. if (EdINCD_TITL->CanFocus()) EdINCD_TITL->SetFocus();
  1029. return;
  1030. }
  1031. String sStartTm = DtINCD_STRT_DT->Date.FormatString("YYYYMMDDHHNNSS");
  1032. String sEndTm = DtINCD_END_PRAR_DT->Date.FormatString("YYYYMMDDHHNNSS");
  1033. if (sStartTm >= sEndTm)
  1034. {
  1035. Application->MessageBox(L"돌발종료예정시각이 돌발시작시각과 같거나 큽니다.\r\n확인 후 진행해 주세요",
  1036. FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  1037. if (DtINCD_STRT_DT->CanFocus()) DtINCD_STRT_DT->SetFocus();
  1038. return;
  1039. }
  1040. if (Application->MessageBox(L"돌발정보입력\r\n현재 입력 정보를 저장 하시겠습니까?",
  1041. FTitle.c_str(), MB_YESNO|MB_ICONQUESTION|MB_APPLMODAL) != IDYES) return;
  1042. String sIncidentId = EdINCD_OCRR_ID->Text;
  1043. TItsIncident *pObj = ItsIncidentManager->FLists.Find(sIncidentId);
  1044. if (!pObj && FOcrrType == 1)
  1045. {
  1046. //돌발감지 정보를 돌발 정보로 등록한다.
  1047. if (InsertAutoIncident(sIncidentId, EdRegDt->Text))
  1048. {
  1049. ItsIncidentManager->LoadFromDb();
  1050. pObj = ItsIncidentManager->FLists.Find(sIncidentId);
  1051. if (!pObj) return; //신규로 정보가 저장되지 않은 것이다.
  1052. }
  1053. }
  1054. String sINCD_OCRR_LANE;
  1055. String sINCD_CLSR_LANE;
  1056. sINCD_OCRR_LANE.sprintf(L"%d%d%d%d%d%d",
  1057. ChkINCD_OCRR_LANE_Extra->Checked,
  1058. ChkINCD_OCRR_LANE_1->Checked,
  1059. ChkINCD_OCRR_LANE_2->Checked,
  1060. ChkINCD_OCRR_LANE_3->Checked,
  1061. ChkINCD_OCRR_LANE_4->Checked,
  1062. ChkINCD_OCRR_LANE_5->Checked);
  1063. sINCD_CLSR_LANE.sprintf(L"%d%d%d%d%d%d",
  1064. ChkINCD_CLSR_LANE_Extra->Checked,
  1065. ChkINCD_CLSR_LANE_1->Checked,
  1066. ChkINCD_CLSR_LANE_2->Checked,
  1067. ChkINCD_CLSR_LANE_3->Checked,
  1068. ChkINCD_CLSR_LANE_4->Checked,
  1069. ChkINCD_CLSR_LANE_5->Checked);
  1070. pObj->INCD_ORGN_CD = ITSUtil_GetCode(CbINCD_ORGN_CD->Text);
  1071. pObj->OCRR_LCTN_NM = EdOCRR_LCTN_NM->Text.Trim();
  1072. pObj->X_CRDN = VarToStr(SePosX->Value);
  1073. pObj->Y_CRDN = VarToStr(SePosY->Value);
  1074. pObj->INCD_EXPL = EdINCD_EXPL->Text.Trim();
  1075. pObj->CMTR_GRAD_CD = ITSUtil_GetCode(CbCMTR_GRAD_CD->Text);
  1076. pObj->IFMR_NM = EdIFMR_NM->Text.Trim();
  1077. pObj->INCD_CNFM_MTHD_CD = ITSUtil_GetCode(CbINCD_CNFM_MTHD_CD->Text);
  1078. pObj->INCD_STRT_DT = DtINCD_STRT_DT->Date.FormatString("YYYYMMDDHHNNSS");
  1079. pObj->INCD_END_PRAR_DT = DtINCD_END_PRAR_DT->Date.FormatString("YYYYMMDDHHNNSS");
  1080. pObj->INCD_TYPE_CLSF_CD = ITSUtil_GetCode(CbINCD_TYPE_CLSF_CD->Text);
  1081. pObj->INCD_TYPE_CD = ITSUtil_GetCode(CbINCD_TYPE_CD->Text);
  1082. pObj->INCD_TITL = EdINCD_TITL->Text.Trim();
  1083. pObj->INCD_SERN_CD = ITSUtil_GetCode(CbINCD_SERN_CD->Text);
  1084. pObj->DELY_LNGT = SeDELY_LNGT->Value;
  1085. pObj->INCD_LNGT = SeINCD_LNGT->Value;
  1086. pObj->INCD_OCRR_LANE = sINCD_OCRR_LANE;
  1087. pObj->INCD_CLSR_LANE = sINCD_CLSR_LANE;
  1088. pObj->TRVL_LMNT_TYPE_CD = ITSUtil_GetCode(CbTRVL_LMNT_TYPE_CD->Text);
  1089. pObj->TRUB_VHCL_YN = ChkTRUB_VHCL_YN->Checked ? "Y" : "N";
  1090. pObj->FALT_YN = ChkFALT_YN->Checked ? "Y" : "N";
  1091. pObj->FRWT_YN = ChkFRWT_YN->Checked ? "Y" : "N";
  1092. pObj->UTIS_CNCT_YN = ChkUTIS_CNCT_YN->Checked ? "Y" : "N";
  1093. pObj->SMLT_VHCL_UNUM = SeSMLT_VHCL_UNUM->Value;
  1094. pObj->MDLT_VHCL_UNUM = SeMDLT_VHCL_UNUM->Value;
  1095. pObj->INJR_PNUM = SeINJR_PNUM->Value;
  1096. pObj->FTLT_PNUM = SeFTLT_PNUM->Value;
  1097. pObj->WTHR_CD = ITSUtil_GetCode(CbWTHR_CD->Text);
  1098. pObj->RESP_LVL_CD = ITSUtil_GetCode(CbRESP_LVL_CD->Text);
  1099. pObj->VMS_DSPL_YN = ChkVMS_DSPL_YN->Checked ? "Y" : "N";
  1100. pObj->LINK_ID = EdLinkId->Text.Trim();
  1101. pObj->INCD_PRGR_STEP_CD = "ISS2"; // 현재는 진행단계이다.
  1102. if (!ItsIncidentManager->UpdateIncidentInfo(pObj))
  1103. {
  1104. return;
  1105. }
  1106. if (FOcrrType == 1)
  1107. {
  1108. UpdateAutoIncident(pObj->LINK_ID, pObj->RGST_DT);
  1109. }
  1110. ItsIncidentManager->MergeVmsIncidentInfo(pObj->INCD_OCRR_ID, // '돌발상황 발생 ID
  1111. EdSTRT_LCTN_NM->Text, // '시작 위치 명
  1112. EdEND_LCTN_NM->Text, // '종료 위치 명
  1113. pObj->OCRR_LCTN_NM, // '발생 위치 명
  1114. pObj->CMTR_GRAD_CD, // '소통 등급 코드
  1115. sINCD_CLSR_LANE, // '돌발상황 차단 차로
  1116. pObj->VMS_DSPL_YN, // 'VMS 표출 여부
  1117. pObj->INCD_PRGR_STEP_CD, // '돌발상황 진행 단계 코드
  1118. pObj->INCD_STRT_DT, // '돌발상황 시작 일시
  1119. pObj->INCD_END_PRAR_DT, // '돌발상황 종료 예정 일시
  1120. pObj->LINK_ID, // '링크ID
  1121. ITSUtil_GetCode(CbVMS_INCD_TYPE_CD->Text), // 'VMS 돌발유형코드
  1122. ITSUtil_GetCode(CbVMS_INCD_DETL_TYPE_CD->Text), // 'VMS 돌발세부유형코드
  1123. ITSUtil_GetCode(CbVMS_INCD_RSTR_TYPE_CD->Text)
  1124. );
  1125. if (FSelLink.nSelLink > 1)
  1126. {
  1127. bool bResult;
  1128. for (int ii = 1; ii < FSelLink.nSelLink; ii++)
  1129. {
  1130. String sIncidentId = "";
  1131. if (!ItsIncidentManager->GetNextIncidentId(CenterId, sIncidentId))
  1132. {
  1133. Application->MessageBox(L"신규 돌발 ID를 조회하지 못하였습니다.\r\n데이터베이스 관리자에게 확인 후에 작업하세요.",
  1134. FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  1135. break;
  1136. }
  1137. bResult = InsertToDb(sIncidentId,
  1138. pObj->INCD_ORGN_CD,
  1139. pObj->OCRR_LCTN_NM,
  1140. pObj->INCD_EXPL,
  1141. pObj->CMTR_GRAD_CD,
  1142. pObj->IFMR_NM,
  1143. pObj->INCD_CNFM_MTHD_CD,
  1144. pObj->INCD_SERN_CD,
  1145. pObj->INCD_TYPE_CLSF_CD,
  1146. pObj->INCD_TYPE_CD,
  1147. pObj->INCD_CNFM_DT,
  1148. pObj->INCD_STRT_DT,
  1149. pObj->INCD_END_PRAR_DT,
  1150. pObj->LINK_ID,
  1151. pObj->INCD_TITL);
  1152. pObj->INCD_OCRR_ID = sIncidentId;
  1153. pObj->LINK_ID = FSelLink.info[ii].sLinkId;
  1154. pObj->X_CRDN = VarToStr(FSelLink.info[ii].FPosX);
  1155. pObj->Y_CRDN = VarToStr(FSelLink.info[ii].FPosY);
  1156. ItsIncidentManager->UpdateIncidentInfo(pObj);
  1157. }
  1158. }
  1159. Application->MessageBox(FrmLang->lblDbSave->Caption.c_str(),//L"입력하신 돌발정보를 저장 하였습니다.",
  1160. FTitle.c_str(), MB_OK|MB_ICONINFORMATION|MB_APPLMODAL);
  1161. ItsIncidentManager->LoadFromDb();
  1162. ItsIncidentManager->LoadFromVmsIncident();
  1163. if (FOcrrType == 1)
  1164. {
  1165. ItsIncidentManager->LoadFromAutoIncident();
  1166. }
  1167. UpdateList();
  1168. InitScreen();
  1169. FOcrrType = 0;
  1170. Application->ProcessMessages();
  1171. POST_MSG(Application->MainForm->Handle, WM_DATABASE_REFRESH, WP_MSG_02, 0);
  1172. //if (cxPageControl1->ActivePage == cxTabSheet1)
  1173. CMM_SetGridFocusRow(CxList, TvList, sIncidentId, Column01->Index);
  1174. DisplayIncidentInfo();
  1175. //else
  1176. // CMM_SetGridRow(CxList, TvList, sIncidentId, Column01->Index);
  1177. }
  1178. //---------------------------------------------------------------------------
  1179. bool __fastcall TFRAMEIncidentProcess::InsertToDb(String AINCD_OCRR_ID, //돌발ID
  1180. String AINCD_ORGN_CD, //돌발상황 원본 코드 : IST
  1181. String AOCRR_LCTN_NM, //발생 위치 명
  1182. String AINCD_EXPL, //돌발상황 설명
  1183. String ACMTR_GRAD_CD, //소통 등급 코드 : LTCU
  1184. String AIFMR_NM, //제보자 명
  1185. String AINCD_CNFM_MTHD_CD, //돌발상황 확인 방법 코드 : ICM
  1186. String AINCD_SERN_CD, //돌발상황 심각도 코드 : SRLU
  1187. String AINCD_TYPE_CLSF_CD, //돌발상황 유형 분류 코드 : IDTU
  1188. String AINCD_TYPE_CD, //돌발상황 유형 코드 : ACTU, CRTU, EVTU, WETU 중 하나
  1189. String AINCD_CNFM_DT, //돌발상황 확인 일시
  1190. String AINCD_STRT_DT, //돌발상황 시작 일시
  1191. String AINCD_END_PRAR_DT, //돌발상황 종료 예정 일시
  1192. String ALINK_ID,
  1193. String AINCD_TITL) //돌발제목
  1194. {
  1195. String sQry;
  1196. TADOQuery *pADO = NULL;
  1197. try
  1198. {
  1199. try
  1200. {
  1201. pADO = new TADOQuery(NULL);
  1202. pADO->Close();
  1203. pADO->Connection = ITSDb_GetConnection();
  1204. ITSDb_GetConnection()->BeginTrans();
  1205. sQry = "INSERT INTO TB_INCD_OCRR(INCD_OCRR_ID, RGST_DT, INCD_ORGN_CD, OCRR_LCTN_NM, \r\n"
  1206. " INCD_EXPL, CMTR_GRAD_CD, IFMR_NM, INCD_CNFM_MTHD_CD, \r\n"
  1207. " INCD_CNFM_DT, INCD_STRT_DT, INCD_END_PRAR_DT, INCD_TYPE_CLSF_CD, \r\n"
  1208. " INCD_TYPE_CD, INCD_SERN_CD, INCD_PRGR_STEP_CD, LINK_ID, INCD_TITL ) \r\n"
  1209. " VALUES(:p01, :p02, :p03, :p04, \r\n"
  1210. " :p05, :p06, :p07, :p08, \r\n"
  1211. " :p09, :p10, :p11, :p12, \r\n"
  1212. " :p13, :p14, 'ISS2', :p15, :p16 ) \r\n";
  1213. ITSDb_SQLText(pADO, sQry);
  1214. ITSDb_SQLBind(pADO, "p01", AINCD_OCRR_ID);
  1215. ITSDb_SQLBind(pADO, "p02", Now().FormatString("YYYYMMDDHHNNSS"));
  1216. ITSDb_SQLBind(pADO, "p03", AINCD_ORGN_CD);
  1217. ITSDb_SQLBind(pADO, "p04", AOCRR_LCTN_NM);
  1218. ITSDb_SQLBind(pADO, "p05", AINCD_EXPL);
  1219. ITSDb_SQLBind(pADO, "p06", ACMTR_GRAD_CD);
  1220. ITSDb_SQLBind(pADO, "p07", AIFMR_NM);
  1221. ITSDb_SQLBind(pADO, "p08", AINCD_CNFM_MTHD_CD);
  1222. ITSDb_SQLBind(pADO, "p09", AINCD_CNFM_DT);
  1223. ITSDb_SQLBind(pADO, "p10", AINCD_STRT_DT);
  1224. ITSDb_SQLBind(pADO, "p11", AINCD_END_PRAR_DT);
  1225. ITSDb_SQLBind(pADO, "p12", AINCD_TYPE_CLSF_CD);
  1226. ITSDb_SQLBind(pADO, "p13", AINCD_TYPE_CD);
  1227. ITSDb_SQLBind(pADO, "p14", AINCD_SERN_CD);
  1228. ITSDb_SQLBind(pADO, "p15", ALINK_ID);
  1229. ITSDb_SQLBind(pADO, "p16", AINCD_TITL);
  1230. ITSDb_SQLExec(pADO);
  1231. ITSDb_GetConnection()->CommitTrans();
  1232. //Application->MessageBox(FrmLang->lblDbSave->Caption.c_str(),//L"돌발 확정 정보를 저장 하였습니다.",
  1233. // FTitle.c_str(), MB_OK|MB_ICONINFORMATION|MB_APPLMODAL);
  1234. }
  1235. catch(EDatabaseError &E)
  1236. {
  1237. ITSDb_GetConnection()->RollbackTrans();
  1238. ShowMessage(String(E.ClassName()) + E.Message);
  1239. }
  1240. catch(Exception &exception)
  1241. {
  1242. ITSDb_GetConnection()->RollbackTrans();
  1243. ShowMessage(String(exception.ClassName()) + exception.Message);
  1244. }
  1245. catch(...)
  1246. {
  1247. ITSDb_GetConnection()->RollbackTrans();
  1248. ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
  1249. ShowMessage(FrmLang->lblDbErr->Caption);//"데이터 작업 중에 알수없는 DB 오류가 발생하였습니다.");
  1250. }
  1251. }
  1252. __finally
  1253. {
  1254. if (pADO)
  1255. {
  1256. pADO->Close();
  1257. delete pADO;
  1258. }
  1259. }
  1260. return true;
  1261. }
  1262. //---------------------------------------------------------------------------
  1263. bool __fastcall TFRAMEIncidentProcess::UpdateAutoIncident(String AINCD_OCRR_ID, String ARGST_DT)
  1264. {
  1265. String sQry;
  1266. TADOQuery *pADO = NULL;
  1267. try
  1268. {
  1269. try
  1270. {
  1271. pADO = new TADOQuery(NULL);
  1272. pADO->Close();
  1273. pADO->Connection = ITSDb_GetConnection();
  1274. ITSDb_GetConnection()->BeginTrans();
  1275. sQry = "UPDATE TB_INCD_ESTM_SECT \r\n"
  1276. " SET REAL_YN = 'Y' \r\n"
  1277. " WHERE LINK_ID = :p01 \r\n"
  1278. " AND DETC_DT = :p02 \r\n";
  1279. ITSDb_SQLText(pADO, sQry);
  1280. ITSDb_SQLBind(pADO, "p01", AINCD_OCRR_ID);
  1281. ITSDb_SQLBind(pADO, "p02", ARGST_DT);
  1282. ITSDb_SQLExec(pADO);
  1283. ITSDb_GetConnection()->CommitTrans();
  1284. //Application->MessageBox(FrmLang->lblDbSave->Caption.c_str(),//L"돌발정보를 오보 판정 돌발 정보로 저장 하였습니다.",
  1285. // FTitle.c_str(), MB_OK|MB_ICONINFORMATION|MB_APPLMODAL);
  1286. }
  1287. catch(EDatabaseError &E)
  1288. {
  1289. ITSDb_GetConnection()->RollbackTrans();
  1290. ShowMessage(String(E.ClassName()) + E.Message);
  1291. }
  1292. catch(Exception &exception)
  1293. {
  1294. ITSDb_GetConnection()->RollbackTrans();
  1295. ShowMessage(String(exception.ClassName()) + exception.Message);
  1296. }
  1297. catch(...)
  1298. {
  1299. ITSDb_GetConnection()->RollbackTrans();
  1300. ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
  1301. ShowMessage(FrmLang->lblDbErr->Caption);//"데이터 작업 중에 알수없는 DB 오류가 발생하였습니다.");
  1302. }
  1303. }
  1304. __finally
  1305. {
  1306. if (pADO)
  1307. {
  1308. pADO->Close();
  1309. delete pADO;
  1310. }
  1311. }
  1312. return true;
  1313. }
  1314. //---------------------------------------------------------------------------
  1315. bool __fastcall TFRAMEIncidentProcess::InsertAutoIncident(String AINCD_OCRR_ID, String ARGST_DT)
  1316. {
  1317. String sQry;
  1318. TADOQuery *pADO = NULL;
  1319. try
  1320. {
  1321. try
  1322. {
  1323. pADO = new TADOQuery(NULL);
  1324. pADO->Close();
  1325. pADO->Connection = ITSDb_GetConnection();
  1326. ITSDb_GetConnection()->BeginTrans();
  1327. sQry = "INSERT INTO TB_INCD_OCRR(INCD_OCRR_ID, RGST_DT, INCD_PRGR_STEP_CD) \r\n"
  1328. " VALUES(:p01, :p02, 'ISS1' ) \r\n";
  1329. ITSDb_SQLText(pADO, sQry);
  1330. ITSDb_SQLBind(pADO, "p01", AINCD_OCRR_ID);
  1331. ITSDb_SQLBind(pADO, "p02", ARGST_DT);
  1332. ITSDb_SQLExec(pADO);
  1333. ITSDb_GetConnection()->CommitTrans();
  1334. //Application->MessageBox(FrmLang->lblDbSave->Caption.c_str(),//L"돌발정보를 오보 판정 돌발 정보로 저장 하였습니다.",
  1335. // FTitle.c_str(), MB_OK|MB_ICONINFORMATION|MB_APPLMODAL);
  1336. }
  1337. catch(EDatabaseError &E)
  1338. {
  1339. ITSDb_GetConnection()->RollbackTrans();
  1340. ShowMessage(String(E.ClassName()) + E.Message);
  1341. }
  1342. catch(Exception &exception)
  1343. {
  1344. ITSDb_GetConnection()->RollbackTrans();
  1345. ShowMessage(String(exception.ClassName()) + exception.Message);
  1346. }
  1347. catch(...)
  1348. {
  1349. ITSDb_GetConnection()->RollbackTrans();
  1350. ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
  1351. ShowMessage(FrmLang->lblDbErr->Caption);//"데이터 작업 중에 알수없는 DB 오류가 발생하였습니다.");
  1352. }
  1353. }
  1354. __finally
  1355. {
  1356. if (pADO)
  1357. {
  1358. pADO->Close();
  1359. delete pADO;
  1360. }
  1361. }
  1362. return true;
  1363. }
  1364. //---------------------------------------------------------------------------
  1365. void __fastcall TFRAMEIncidentProcess::MnuListAddClick(TObject *Sender)
  1366. {
  1367. if (EdINCD_OCRR_ID->Text.Trim().IsEmpty())
  1368. {
  1369. Application->MessageBox(L"돌발정보입력\r\n목록에서 돌발정보를 선택하신 후에 작업을 진행하세요.",
  1370. FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  1371. return;
  1372. }
  1373. TITSSEL1M *pSelForm = NULL;
  1374. try
  1375. {
  1376. try {
  1377. pSelForm = new TITSSEL1M(this);
  1378. pSelForm->m_bSelected = false;
  1379. pSelForm->MultiSelect = false;
  1380. pSelForm->ShowModal();
  1381. if (pSelForm->m_bSelected)
  1382. {
  1383. String sLinkId = pSelForm->m_sSelLinkId;
  1384. TItsLink *pLink = ItsLinkManager->FLists.Find(sLinkId);
  1385. if (!pLink)
  1386. {
  1387. Application->MessageBox(L"정보가 없는 구간을 선택하였습니다. 다른 구간을 선택하세요.",
  1388. FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  1389. return;
  1390. }
  1391. EdLinkId->Text = sLinkId;
  1392. EdLINK_ID->Text = sLinkId;
  1393. TItsNode *pNode;
  1394. String sFNode = "";
  1395. pNode = ItsNodeManager->FLists.Find(pLink->F_NODEID);
  1396. if (pNode)
  1397. {
  1398. sFNode = sFNode + pNode->NODE_NAME;
  1399. SePosX->Value = StrToFloat(pNode->FX_CRDN);
  1400. SePosY->Value = StrToFloat(pNode->FY_CRDN);
  1401. }
  1402. String sTNode = "";
  1403. pNode = ItsNodeManager->FLists.Find(pLink->T_NODEID);
  1404. if (pNode) sTNode = sTNode + pNode->NODE_NAME;
  1405. EdLINK_ID->Text = "[" + sLinkId + "] " + sFNode + "→" + sTNode;
  1406. }
  1407. } catch(...) { }
  1408. }
  1409. __finally
  1410. {
  1411. if (pSelForm) delete pSelForm;
  1412. }
  1413. }
  1414. //---------------------------------------------------------------------------
  1415. void __fastcall TFRAMEIncidentProcess::MnuGisAddClick(TObject *Sender)
  1416. {
  1417. if (EdINCD_OCRR_ID->Text.Trim().IsEmpty())
  1418. {
  1419. Application->MessageBox(L"돌발정보입력\r\n목록에서 돌발정보를 선택하신 후에 작업을 진행하세요.",
  1420. FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  1421. return;
  1422. }
  1423. TITSSELAM *pSelForm = NULL;
  1424. try
  1425. {
  1426. try {
  1427. pSelForm = new TITSSELAM(this);
  1428. pSelForm->MultiSelect = true;
  1429. pSelForm->LinkLevel = 1;
  1430. pSelForm->FRefreshId = EdLinkId->Text;
  1431. pSelForm->FSelPosX = VarToStr(SePosX->Value);
  1432. pSelForm->FSelPosY = VarToStr(SePosY->Value);
  1433. String sOrgLinkId = EdLinkId->Text;
  1434. int nRow;
  1435. TcxDataController *pGDC = pSelForm->TvList->DataController;
  1436. for (int ii = 0; ii < FSelLink.nSelLink; ii++)
  1437. {
  1438. if (FSelLink.info[ii].sLinkId == "") continue;
  1439. nRow = pGDC->AppendRecord();
  1440. pGDC->Values[nRow][pSelForm->Column01->Index] = FSelLink.info[ii].sLinkId;
  1441. pGDC->Values[nRow][pSelForm->Column02->Index] = FSelLink.info[ii].FPosX;
  1442. pGDC->Values[nRow][pSelForm->Column03->Index] = FSelLink.info[ii].FPosY;
  1443. }
  1444. pSelForm->ShowModal();
  1445. Application->ProcessMessages();
  1446. if (pSelForm->Selected)
  1447. {
  1448. #if 0
  1449. String sLinkId = pSelForm->TvList->DataController->Values[0][pSelForm->Column01->Index];
  1450. TItsLink *pLink = ItsLinkManager->FLists.Find(sLinkId);
  1451. if (!pLink)
  1452. {
  1453. Application->MessageBox(L"정보가 없는 구간을 선택하였습니다. 다른 구간을 선택하세요.",
  1454. FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  1455. return;
  1456. }
  1457. SePosX->Value = pSelForm->FPosX;
  1458. SePosY->Value = pSelForm->FPosY;
  1459. EdLinkId->Text = sLinkId;
  1460. EdLINK_ID->Text = sLinkId;
  1461. TItsNode *pNode;
  1462. String sFNode = "";
  1463. pNode = ItsNodeManager->FLists.Find(pLink->F_NODEID);
  1464. if (pNode)
  1465. {
  1466. sFNode = sFNode + pNode->NODE_NAME;
  1467. }
  1468. String sTNode = "";
  1469. pNode = ItsNodeManager->FLists.Find(pLink->T_NODEID);
  1470. if (pNode) sTNode = sTNode + pNode->NODE_NAME;
  1471. EdLINK_ID->Text = "[" + sLinkId + "] " + sFNode + "→" + sTNode;
  1472. #else
  1473. String sFLinkId = "";
  1474. double dX = 0;
  1475. double dY = 0;
  1476. try
  1477. {
  1478. int nRow;
  1479. TcxDataController *pGDC = pSelForm->TvList->DataController;
  1480. pSelForm->TvList->BeginUpdate();
  1481. try
  1482. {
  1483. int ii;
  1484. for (ii = 0; ii < pGDC->RecordCount; ii++)
  1485. {
  1486. String sTmpLinkId = pGDC->Values[ii][pSelForm->Column01->Index];
  1487. if (sOrgLinkId == sTmpLinkId)
  1488. {
  1489. sFLinkId = sTmpLinkId;
  1490. String sX = pGDC->Values[ii][pSelForm->Column02->Index];
  1491. String sY = pGDC->Values[ii][pSelForm->Column03->Index];
  1492. dX = sX.ToDouble();
  1493. dY = sY.ToDouble();
  1494. break;
  1495. }
  1496. }
  1497. FSelLink.nSelLink = 0;
  1498. //무조건 첫번째는 업데이트를 해야 하기 때문에 ID를 추가하자
  1499. //나머지는 ID ==""로 처리해서 Insert 하도록 하자
  1500. FSelLink.info[FSelLink.nSelLink].sIncidentId = EdINCD_OCRR_ID->Text;
  1501. if (sFLinkId != "")
  1502. {
  1503. FSelLink.info[FSelLink.nSelLink].sLinkId = sFLinkId;
  1504. FSelLink.info[FSelLink.nSelLink].FPosX = dX;
  1505. FSelLink.info[FSelLink.nSelLink].FPosY = dY;
  1506. FSelLink.nSelLink++;
  1507. }
  1508. {
  1509. for (ii = 0; ii < pGDC->RecordCount; ii++)
  1510. {
  1511. String sTmpLinkId = pGDC->Values[ii][pSelForm->Column01->Index];
  1512. if (sFLinkId != "" && sFLinkId == sTmpLinkId)
  1513. {
  1514. //이미 위에서 첫번째 인덱스에 저장했다
  1515. continue;
  1516. }
  1517. String sX = pGDC->Values[ii][pSelForm->Column02->Index];
  1518. String sY = pGDC->Values[ii][pSelForm->Column03->Index];
  1519. dX = sX.ToDouble();
  1520. dY = sY.ToDouble();
  1521. FSelLink.info[FSelLink.nSelLink].sLinkId = sTmpLinkId;
  1522. FSelLink.info[FSelLink.nSelLink].FPosX = dX;
  1523. FSelLink.info[FSelLink.nSelLink].FPosY = dY;
  1524. FSelLink.nSelLink++;
  1525. }
  1526. }
  1527. TItsLink *pLink = ItsLinkManager->FLists.Find(FSelLink.info[0].sLinkId);
  1528. if (!pLink)
  1529. {
  1530. Application->MessageBox(L"정보가 없는 구간을 선택하였습니다. 다른 구간을 선택하세요.",
  1531. FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  1532. return;
  1533. }
  1534. SePosX->Value = FSelLink.info[0].FPosX;
  1535. SePosY->Value = FSelLink.info[0].FPosY;
  1536. EdLinkId->Text = FSelLink.info[0].sLinkId;
  1537. EdLINK_ID->Text = FSelLink.info[0].sLinkId;
  1538. TItsNode *pNode;
  1539. String sFNode = "";
  1540. pNode = ItsNodeManager->FLists.Find(pLink->LINK_ID);
  1541. if (pNode)
  1542. {
  1543. sFNode = sFNode + pNode->NODE_NAME;
  1544. }
  1545. String sTNode = "";
  1546. pNode = ItsNodeManager->FLists.Find(pLink->T_NODEID);
  1547. if (pNode) sTNode = sTNode + pNode->NODE_NAME;
  1548. EdLINK_ID->Text = "[" + FSelLink.info[0].sLinkId + "] " + sFNode + "→" + sTNode;
  1549. }
  1550. catch(...)
  1551. {
  1552. }
  1553. }
  1554. __finally
  1555. {
  1556. pSelForm->TvList->EndUpdate();
  1557. }
  1558. #endif
  1559. }
  1560. } catch(...) { }
  1561. }
  1562. __finally
  1563. {
  1564. if (pSelForm) delete pSelForm;
  1565. }
  1566. }
  1567. //---------------------------------------------------------------------------
  1568. void __fastcall TFRAMEIncidentProcess::BtnMoveGisClick(TObject *Sender)
  1569. {
  1570. #if 0
  1571. if (EdLinkId->Text.IsEmpty()) return;
  1572. g_SelLink.pForm = NULL;
  1573. g_SelLink.Level = 1;
  1574. g_SelLink.Id = EdLinkId->Text;
  1575. POST_MSG(Application->MainForm->Handle, WM_PLUGINFORM, WP_MSG_15, LP_MSG_15);
  1576. #else
  1577. float sDx = SePosX->Value;
  1578. float sDy = SePosY->Value;
  1579. if (sDx != 0 && sDy != 0)
  1580. {
  1581. if (ITS00MAP) ITS00MAP->SelectObjectByPos(sDx, sDy, true);
  1582. }
  1583. else
  1584. {
  1585. if (EdLinkId->Text.IsEmpty()) return;
  1586. if (ITS00MAP) ITS00MAP->SelectLinkById(1, EdLinkId->Text, true);
  1587. #if 0
  1588. g_SelLink.pForm = NULL;
  1589. g_SelLink.Level = 1;
  1590. g_SelLink.Id = EdLinkId->Text;
  1591. POST_MSG(Application->MainForm->Handle, WM_PLUGINFORM, WP_MSG_15, LP_MSG_15);
  1592. #endif
  1593. }
  1594. #endif
  1595. }
  1596. //---------------------------------------------------------------------------
  1597. void __fastcall TFRAMEIncidentProcess::BtnVmsTargetClick(TObject *Sender)
  1598. {
  1599. if (!ChkVMS_DSPL_YN->Checked) return;
  1600. if (EdLinkId->Text.IsEmpty()) return;
  1601. String sLinkId = EdLinkId->Text.Trim();
  1602. //if (FLinkId == "") return;
  1603. //String sLinkId = FLinkId;
  1604. try
  1605. {
  1606. if (FrmIncidVmsInfo == NULL)
  1607. {
  1608. FrmIncidVmsInfo = new TFrmIncidVmsInfo(Application);
  1609. }
  1610. FrmIncidVmsInfo->Show();
  1611. FrmIncidVmsInfo->ShowIncidVmsInfo(sLinkId);
  1612. }
  1613. catch(...)
  1614. {
  1615. }
  1616. }
  1617. //---------------------------------------------------------------------------