VDSM010MF.cpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "ITSSkinF.h"
  4. #include "ITSUtilF.h"
  5. #include "AppGlobalF.h"
  6. #include "CDSCodeF.h"
  7. #include "CDSFacilityF.h"
  8. #include "ITSLangTransF.h"
  9. #pragma hdrstop
  10. #include "VDSM010MF.h"
  11. //---------------------------------------------------------------------------
  12. #pragma package(smart_init)
  13. #pragma link "FRAME_VdsListF"
  14. #pragma link "cxButtons"
  15. #pragma link "cxCheckBox"
  16. #pragma link "cxContainer"
  17. #pragma link "cxControls"
  18. #pragma link "cxDropDownEdit"
  19. #pragma link "cxEdit"
  20. #pragma link "cxGraphics"
  21. #pragma link "cxGroupBox"
  22. #pragma link "cxLabel"
  23. #pragma link "cxLookAndFeelPainters"
  24. #pragma link "cxLookAndFeels"
  25. #pragma link "cxMaskEdit"
  26. #pragma link "cxSpinEdit"
  27. #pragma link "cxSplitter"
  28. #pragma link "cxTextEdit"
  29. #pragma link "dxSkinBlack"
  30. #pragma link "dxSkinBlue"
  31. #pragma link "dxSkinsCore"
  32. #pragma link "FRAME_GoogleMapF"
  33. #pragma link "GMClasses"
  34. #pragma link "GMLinkedComponents"
  35. #pragma link "GMMap"
  36. #pragma link "GMMarker"
  37. #pragma link "GMMarkerVCL"
  38. #pragma resource "*.dfm"
  39. TVDSM010M *VDSM010M = NULL;
  40. //---------------------------------------------------------------------------
  41. __fastcall TVDSM010M::TVDSM010M(TComponent* Owner)
  42. : TForm(Owner)
  43. {
  44. LangTrans->Translate(this, ITSDb_GetConnection());
  45. ITSSkin_Load(this);
  46. CMM_LoadForm(g_sFormsDir, this);
  47. FTitle = Caption;//"VDS-제어기 관리";
  48. FUpdate= false;
  49. MapStart = false;
  50. FRAMEVdsList1->PnlTop->Visible = false;
  51. FRAMEVdsList1->PnlBottom->Visible = false;
  52. FRAMEVdsList1->ColumnSel->Visible = false;
  53. FRAMEVdsList1->Column02->Visible = false;
  54. m_pGDC = FRAMEVdsList1->TvList->DataController;
  55. FSelMkr = NULL;
  56. FNewMkr = GMMarkerNew->Items[0];
  57. FNewMkr->Icon = g_AppCfg.vds.ICON[icon_s];
  58. EditMode = false;
  59. }
  60. //---------------------------------------------------------------------------
  61. /*
  62. * 닫기버튼 이나 x버튼 클릭시 공통으로 처리하는 로직이들어간다..
  63. * Form과 DataModule class를 delete시킨다.
  64. * arguments
  65. *
  66. * return
  67. * void
  68. */
  69. void __fastcall TVDSM010M::CommClose()
  70. {
  71. try
  72. {
  73. CMM_SaveForm(g_sFormsDir, this);
  74. }
  75. catch(...)
  76. {
  77. }
  78. }
  79. //---------------------------------------------------------------------------
  80. /*
  81. * Form을 보여줄때 호출되는 event 메서드이다.
  82. * arguments
  83. * Sender : event handler 객체
  84. * return
  85. * void
  86. */
  87. void __fastcall TVDSM010M::FormShow(TObject *Sender)
  88. {
  89. Refresh();
  90. CbTypeCd->Properties->Items->Clear();
  91. TItsCode *FCodeRMF = ItsCodeManager->FLists.Find("RMF");
  92. if (FCodeRMF)
  93. {
  94. FOR_STL(TItsSubCode *, pSubCode, FCodeRMF->FSubLists)
  95. {
  96. if (pSubCode->USE_YN == "N") continue;
  97. CbTypeCd->Properties->Items->Add(" [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM);
  98. }
  99. }
  100. CbTypeCd->ItemIndex = 0;
  101. try
  102. {
  103. FRAMEVdsList1->MyItsVdsManager->FLists.Lock();
  104. FOR_STL(TItsVds*, pObj, FRAMEVdsList1->MyItsVdsManager->FLists)
  105. {
  106. if (pObj->DEL_YN == "Y") continue;
  107. pObj->FData3 = NULL;
  108. }
  109. }
  110. __finally
  111. {
  112. FRAMEVdsList1->MyItsVdsManager->FLists.UnLock();
  113. }
  114. FormInit();
  115. ChangeEditMode(1);
  116. TmrShow->Enabled = true;
  117. }
  118. //---------------------------------------------------------------------------
  119. /*
  120. * form 초기화
  121. *
  122. * arguments
  123. *
  124. * return
  125. * void
  126. */
  127. void __fastcall TVDSM010M::FormInit()
  128. {
  129. EdId->Text = "";
  130. EdMngmNmbr->Text = "";
  131. CbTypeCd->ItemIndex = 0;
  132. CbValidYn->ItemIndex = 0;
  133. SePosX->Value = 0;
  134. SePosY->Value = 0;
  135. EdLctn->Text = "";
  136. EdIP->Text = "";
  137. EdPort->Text = "";
  138. EdVdsId->Text = "";
  139. SeClctCycle->Value = 0;
  140. SeSttsCycl->Value = 0;
  141. SeBordNum->Value = 0;
  142. if (FSelMkr)
  143. {
  144. FSelMkr->Icon = g_AppCfg.vds.ICON[icon_r];
  145. FSelMkr->Draggable = false;
  146. FSelMkr = NULL;
  147. }
  148. FNewMkr->Visible = false;
  149. FNewDb = false;
  150. }
  151. //---------------------------------------------------------------------------
  152. /*
  153. * Form이 Show되고 난 후 최초 1회 수행되는 타이머 이벤트
  154. * arguments
  155. * Sender : event handler 객체
  156. * return
  157. * void
  158. */
  159. void __fastcall TVDSM010M::TmrShowTimer(TObject *Sender)
  160. {
  161. TmrShow->Enabled = false;
  162. #if 0
  163. FRAMEGisMap1->LinkLevel = 1;
  164. FRAMEGisMap1->LoadGisMap();
  165. #else
  166. FRAMEGoogleMap1->LinkLevel = 1;
  167. FRAMEGoogleMap1->LoadGisMap();
  168. MapStart = true;
  169. #endif
  170. FRAMEVdsList1->UpdateList();
  171. UpdateIcon();
  172. }
  173. //---------------------------------------------------------------------------
  174. /*
  175. * Close 버튼 클릭 이벤트 핸들러
  176. * arguments
  177. * Sender : event handler 객체
  178. * return
  179. * void
  180. */
  181. void __fastcall TVDSM010M::BtnCloseClick(TObject *Sender)
  182. {
  183. Close();
  184. }
  185. //---------------------------------------------------------------------------
  186. void __fastcall TVDSM010M::FormClose(TObject *Sender, TCloseAction &Action)
  187. {
  188. CommClose();
  189. VDSM010M = NULL;
  190. Action = caFree;
  191. }
  192. //---------------------------------------------------------------------------
  193. void __fastcall TVDSM010M::FormCloseQuery(TObject *Sender, bool &CanClose)
  194. {
  195. if (FUpdate)
  196. {
  197. POST_MSG(Application->MainForm->Handle, WM_DATABASE_REFRESH, WP_MSG_14, 0);
  198. }
  199. FRAMEVdsList1->OnCloseQuery(CanClose);
  200. }
  201. //---------------------------------------------------------------------------
  202. TMarker * _fastcall TVDSM010M::FindObjectMarker(String AId)
  203. {
  204. TItsVds* pObj = FRAMEVdsList1->MyItsVdsManager->FLists.Find(AId);
  205. if (pObj)
  206. {
  207. return (TMarker*)pObj->FData3;
  208. }
  209. return (TMarker*)NULL;
  210. }
  211. //---------------------------------------------------------------------------
  212. void __fastcall TVDSM010M::DisplayInfo(TItsVds* AObj, bool AMoveVms/*=false*/)
  213. {
  214. FormInit();
  215. if (!AObj) return;
  216. FSelMkr = FindObjectMarker(AObj->CTLR_MNGM_NMBR);
  217. if (FSelMkr)
  218. {
  219. FSelMkr->Icon = g_AppCfg.vds.ICON[icon_s];
  220. if (AMoveVms)
  221. {
  222. FSelMkr->CenterMapTo();
  223. }
  224. }
  225. EdId->Text = AObj->CTLR_MNGM_NMBR;
  226. EdMngmNmbr->Text = AObj->CTLR_MNGM_NMBR;
  227. CMM_SetComboBoxItem(CbTypeCd, AObj->CTLR_TYPE_CD);
  228. CbValidYn->Text = AObj->VALD_YN;
  229. SePosX->Value = StrToFloatDef(AObj->X_CRDN, 0);
  230. SePosY->Value = StrToFloatDef(AObj->Y_CRDN, 0);
  231. EdLctn->Text = AObj->LCTN;
  232. EdIP->Text = AObj->TRMN_IP;
  233. EdPort->Text = AObj->TRMN_PORT;
  234. SeClctCycle->Value = AObj->CTLR_CLCT_CYCL.ToIntDef(0);
  235. SeSttsCycl->Value = AObj->CTLR_STTS_CYCL.ToIntDef(0);
  236. SeBordNum->Value = AObj->DLTR_NMBR.ToIntDef(0);
  237. EdVdsId->Text = AObj->VDS_CTLR_ID;
  238. //FRAMEGisMap1->SelectObjectByPos(SePosX->Value, SePosY->Value, true);
  239. ChangeEditMode(3);
  240. }
  241. //---------------------------------------------------------------------------
  242. void __fastcall TVDSM010M::SelListData()
  243. {
  244. /* Google 아이콘 삭제 */
  245. FSelMkr = NULL;
  246. TGMMarker *pObjMarker = (TGMMarker*)GMMarker1;
  247. try
  248. {
  249. pObjMarker->Map = NULL;
  250. int nObjs = pObjMarker->Count;
  251. for (int ii = nObjs - 1; ii >= 0; ii--)
  252. {
  253. pObjMarker->Items[ii]->Visible = false;
  254. pObjMarker->Delete(ii);
  255. }
  256. pObjMarker->Clear();
  257. }
  258. catch(Exception &e)
  259. {
  260. }
  261. FRAMEVdsList1->UpdateList();
  262. UpdateIcon();
  263. }
  264. //---------------------------------------------------------------------------
  265. void __fastcall TVDSM010M::UpdateIcon()
  266. {
  267. if (!MapStart) return;
  268. TGMMarker *pMarker = GMMarker1;
  269. TMarker *pMk = NULL;
  270. TItsFacility *pFacility;
  271. FRAMEGoogleMap->RemoveMarker(pMarker);
  272. try
  273. {
  274. try
  275. {
  276. FRAMEVdsList1->MyItsVdsManager->FLists.Lock();
  277. FOR_STL(TItsVds*, pObj, FRAMEVdsList1->MyItsVdsManager->FLists)
  278. {
  279. if (pObj->DEL_YN == "Y") continue;
  280. pMk = pMarker->Add(pObj->Y_CRDN.ToDouble(), pObj->X_CRDN.ToDouble(), pObj->CTLR_MNGM_NMBR);
  281. if (!pMk)
  282. {
  283. pObj->FData3 = NULL;
  284. continue;
  285. }
  286. pObj->FData3 = pMk;
  287. pMk->Tag = (int)pObj;
  288. pMk->Title = pObj->VDS_CTLR_ID;//LCTN;
  289. pMk->MarkerType = mtStyledMarker;//mtStandard; //mtStyledMarker
  290. pMk->StyledMarker->StyledIcon = siMarker;
  291. //pMk->StyledMarker->StyledIcon = siBubble;
  292. pMk->StyledMarker->BackgroundColor = clBlue;
  293. pMk->StyledMarker->TextColor = clWhite;
  294. pMk->StyledMarker->StarColor = clRed;
  295. String sContent = "";
  296. sContent += "<div style='width:135px; height:70px; float:left'>";
  297. sContent += "<font style=\"font-weight:bold;color:#0000FF\">" + (pObj->CTLR_MNGM_NMBR) + "</font><br>";
  298. sContent += pObj->VDS_CTLR_ID + "<br>";
  299. sContent += pObj->LCTN;
  300. sContent += "</div>";
  301. sContent += "<html:hidden [VDS]" + (pObj->CTLR_MNGM_NMBR) + " />";
  302. pMk->InfoWindow->DisableAutoPan = true;
  303. pMk->InfoWindow->HTMLContent = sContent;
  304. pMk->ShowInfoWinMouseOver = true;
  305. pMk->Icon = g_AppCfg.vds.ICON[icon_r];
  306. pMk->Visible = true;
  307. pMk->Clickable = true;
  308. }
  309. }
  310. __finally
  311. {
  312. FRAMEVdsList1->MyItsVdsManager->FLists.UnLock();
  313. if (ChkViewIcon->Checked)
  314. {
  315. pMarker->Map = FRAMEGoogleMap1->GMMap1;
  316. }
  317. }
  318. }
  319. catch(Exception &e)
  320. {
  321. }
  322. }
  323. //---------------------------------------------------------------------------
  324. void __fastcall TVDSM010M::ChkViewIconClick(TObject *Sender)
  325. {
  326. if (ChkViewIcon->Checked)
  327. {
  328. GMMarker1->Map = FRAMEGoogleMap1->GMMap1;
  329. }
  330. else
  331. {
  332. GMMarker1->Map = NULL;
  333. }
  334. }
  335. //---------------------------------------------------------------------------
  336. void __fastcall TVDSM010M::BtnEditClick(TObject *Sender)
  337. {
  338. if (BtnEdit->Caption == FrmLang->lblEdit->Caption)//"편집")
  339. {
  340. //편집모드 시작
  341. if (FSelMkr)
  342. {
  343. FSelMkr->Draggable = true;
  344. }
  345. ChangeEditMode(0);
  346. FNewDb = false;
  347. }
  348. else
  349. {
  350. //편집모드 취소
  351. String sId = EdId->Text;
  352. TItsVds *pObj = FRAMEVdsList1->MyItsVdsManager->FLists.Find(sId);
  353. if (FSelMkr)
  354. {
  355. if (pObj)
  356. {
  357. FSelMkr->Position->Lng = StrToFloatDef(pObj->X_CRDN, 0);
  358. FSelMkr->Position->Lat = StrToFloatDef(pObj->Y_CRDN, 0);
  359. }
  360. FSelMkr->Draggable = false;
  361. }
  362. ChangeEditMode(1);
  363. if (pObj)
  364. {
  365. CMM_SetGridRow(FRAMEVdsList1->CxList, FRAMEVdsList1->TvList, sId, FRAMEVdsList1->Column01->Index);
  366. DisplayInfo(pObj);
  367. }
  368. }
  369. }
  370. //---------------------------------------------------------------------------
  371. void __fastcall TVDSM010M::ChangeEditMode(int AEdit)
  372. {
  373. bool bEnabled = false;
  374. switch(AEdit)
  375. {
  376. case 0: //편집버튼클릭
  377. {
  378. BtnEdit->Enabled = true;
  379. BtnInsert->Enabled = false;
  380. BtnDelete->Enabled = false;
  381. BtnSave->Enabled = true;
  382. BtnEdit->Caption = FrmLang->lblCancel->Caption;//"취소";
  383. BtnEdit->Hint = FrmLang->lblCancel->Hint;//데이터 편집 취소";
  384. EditMode = true;
  385. }
  386. break;
  387. case 1: //편집[취소]버튼클릭
  388. {
  389. FormInit(); //화면을 모두 지운다.
  390. BtnEdit->Enabled = false;
  391. BtnInsert->Enabled = true;
  392. BtnDelete->Enabled = false;
  393. BtnSave->Enabled = false;
  394. BtnEdit->Caption = FrmLang->lblEdit->Caption;//"편집";
  395. BtnEdit->Hint = FrmLang->lblEdit->Hint;//데이터 편집";
  396. //bEnabled = true;
  397. EditMode = false;
  398. }
  399. break;
  400. case 2: //추가
  401. {
  402. BtnEdit->Enabled = true;
  403. BtnInsert->Enabled = false;
  404. BtnDelete->Enabled = false;
  405. BtnSave->Enabled = true;
  406. BtnEdit->Caption = FrmLang->lblCancel->Caption;//"취소";
  407. BtnEdit->Hint = FrmLang->lblCancel->Hint;//데이터 편집 취소";
  408. EditMode = true;
  409. }
  410. break;
  411. case 3: //수정모드
  412. {
  413. BtnEdit->Enabled = true;
  414. BtnInsert->Enabled = true;
  415. BtnDelete->Enabled = true;
  416. BtnSave->Enabled = false;
  417. BtnEdit->Caption = FrmLang->lblEdit->Caption;//"편집";
  418. BtnEdit->Hint = FrmLang->lblEdit->Hint;//데이터 편집";
  419. bEnabled = true;
  420. EditMode = false;
  421. }
  422. break;
  423. }
  424. if (AEdit == 0 || AEdit == 2)
  425. {
  426. FRAMEVdsList1->CxList->Enabled = false;
  427. }
  428. else
  429. {
  430. FRAMEVdsList1->CxList->Enabled = true;
  431. }
  432. PnlEdit->Enabled = EditMode;
  433. #if 0
  434. EdId->Properties->ReadOnly = bEnabled;
  435. EdMngmNmbr->Properties->ReadOnly = bEnabled;
  436. CbTypeCd->Properties->ReadOnly = bEnabled;
  437. CbValidYn->Properties->ReadOnly = bEnabled;
  438. SePosX->Properties->ReadOnly = bEnabled;
  439. SePosY->Properties->ReadOnly = bEnabled;
  440. EdLctn->Properties->ReadOnly = bEnabled;
  441. EdIP->Properties->ReadOnly = bEnabled;
  442. EdPort->Properties->ReadOnly = bEnabled;
  443. SeClctCycle->Properties->ReadOnly = bEnabled;
  444. SeSttsCycl->Properties->ReadOnly = bEnabled;
  445. SeBordNum->Properties->ReadOnly = bEnabled;
  446. EdVdsId->Properties->ReadOnly = bEnabled;
  447. #endif
  448. }
  449. //---------------------------------------------------------------------------
  450. void __fastcall TVDSM010M::BtnInsertClick(TObject *Sender)
  451. {
  452. FormInit();
  453. int nMsgType = MB_OK|MB_ICONERROR|MB_APPLMODAL;
  454. //신규아이디를 얻어와서 화면을 초기화한다.
  455. String sId = InputBox(lblInput->Caption,//"제어기 관리번호",
  456. lblInQry->Caption,//"신규 제어기 관리번호를 입력하세요(20Byte).",
  457. lblInput->Caption);//"최대20자리" );
  458. sId = sId.Trim();
  459. if (sId == lblInput->Caption //"제어기 관리번호"
  460. || sId == "")
  461. {
  462. return;
  463. }
  464. if (AnsiString(sId).Length() > 20)
  465. {
  466. Application->MessageBox(lblDigitErr->Caption.c_str(),//L"제어기 관리번호는 20Byte를 초과할 수 없습니다.",
  467. FTitle.c_str(),
  468. nMsgType);
  469. return;
  470. }
  471. TItsVds *pDb = (TItsVds *)FRAMEVdsList1->MyItsVdsManager->FLists.Find(sId);
  472. if (pDb)
  473. {
  474. String sErr = FrmLang->lbIdErr->Caption + "[" + sId + "]";
  475. Application->MessageBox(sErr.c_str(),//("[" + sId + "]는 사용할 수 없는 제어기 관리번호 입니다.").c_str(),
  476. FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  477. return;
  478. }
  479. EdId->Text = sId;
  480. EdMngmNmbr->Text = sId;
  481. FNewMkr = GMMarkerNew->Items[0];
  482. FNewMkr->Position->Lat = FRAMEGoogleMap1->FCenterLat;
  483. FNewMkr->Position->Lng = FRAMEGoogleMap1->FCenterLng;
  484. FNewMkr->Visible = true;
  485. SePosX->Value = FNewMkr->Position->Lng;
  486. SePosY->Value = FNewMkr->Position->Lat;
  487. ChangeEditMode(2);
  488. FNewDb = true;
  489. }
  490. //---------------------------------------------------------------------------
  491. void __fastcall TVDSM010M::BtnDeleteClick(TObject *Sender)
  492. {
  493. if (!MapStart) return;
  494. int nIdx = m_pGDC->FocusedRecordIndex;
  495. if (nIdx < 0) return;
  496. String sId = EdId->Text;
  497. if (sId.IsEmpty())
  498. {
  499. Application->MessageBox(lblDel1->Caption.c_str(),//L"삭제할 VDS-제어기를 목록에서 선택하세요.\r\n목록에서 더블클릭하여 선택합니다.",
  500. FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  501. return;
  502. }
  503. String sMsg;
  504. sMsg = "ID: " + sId;
  505. sMsg+= lblDel2->Caption;//"\r\n선택하신 VDS-제어기 정보를 삭제하시겠습니까?";
  506. if (Application->MessageBox(sMsg.c_str(), FTitle.c_str(), MB_YESNO|MB_ICONQUESTION|MB_APPLMODAL) != IDYES) return;
  507. TItsVds *pObj = FRAMEVdsList1->MyItsVdsManager->FLists.Find(sId);
  508. if (pObj)
  509. {
  510. if (FRAMEVdsList1->MyItsVdsManager->DeleteVds(pObj))
  511. {
  512. pObj->DEL_YN = "Y";
  513. FRAMEVdsList1->UpdateList();
  514. UpdateIcon();
  515. }
  516. TItsFacility *pFacility = ItsFacilityManager->FLists.Find(sId);
  517. if (pFacility)
  518. {
  519. FUpdate = true;
  520. }
  521. Application->MessageBox(lblDel3->Caption.c_str(),//L"VDS-제어기 정보삭제\r\nVDS-제어기 정보를 삭제 하였습니다.",
  522. FTitle.c_str(), MB_OK|MB_ICONINFORMATION|MB_APPLMODAL);
  523. FSelMkr = NULL;
  524. FormInit();
  525. ChangeEditMode(1);
  526. }
  527. }
  528. //---------------------------------------------------------------------------
  529. void __fastcall TVDSM010M::BtnSaveClick(TObject *Sender)
  530. {
  531. if (EdId->Text.IsEmpty() ||
  532. EdVdsId->Text.IsEmpty() ||
  533. EdLctn->Text.Trim().IsEmpty()||
  534. SePosX->Value == 0 ||
  535. SePosY->Value == 0 )
  536. //CbTypeCd->Text.IsEmpty() )
  537. {
  538. Application->MessageBox(FrmLang->lblCnfm->Caption.c_str(),//L"★항목은 필수 입력 항목입니다.\r\n모두 입력후 진행해 주세요.",
  539. FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  540. return;
  541. }
  542. String sId = EdId->Text;
  543. TItsVds *pObj;
  544. if (FNewDb)
  545. pObj = new TItsVds();
  546. else
  547. pObj = FRAMEVdsList1->MyItsVdsManager->FLists.Find(sId);
  548. if (pObj)
  549. {
  550. pObj->CTLR_MNGM_NMBR = sId;
  551. pObj->CTLR_TYPE_CD = ITSUtil_GetCode(CbTypeCd->Text);
  552. pObj->VALD_YN = CbValidYn->Text;
  553. pObj->X_CRDN = VarToStr(SePosX->Value);
  554. pObj->Y_CRDN = VarToStr(SePosY->Value);
  555. pObj->LCTN = EdLctn->Text.Trim();
  556. pObj->TRMN_IP = EdIP->Text.Trim();
  557. pObj->TRMN_PORT = EdPort->Text.Trim();
  558. pObj->CTLR_CLCT_CYCL = VarToStr(SeClctCycle->Value);
  559. pObj->CTLR_STTS_CYCL = VarToStr(SeSttsCycl->Value);
  560. pObj->DLTR_NMBR = VarToStr(SeBordNum->Value);
  561. pObj->DEL_YN = "N";
  562. pObj->VDS_CTLR_ID = EdVdsId->Text.Trim();
  563. bool bResult;
  564. if (FNewDb)
  565. {
  566. bResult = FRAMEVdsList1->MyItsVdsManager->InsertVds(pObj);
  567. if (bResult)
  568. {
  569. FRAMEVdsList1->MyItsVdsManager->FLists.Push(sId, pObj);
  570. }
  571. }
  572. else
  573. {
  574. bResult = FRAMEVdsList1->MyItsVdsManager->UpdateVds(pObj);
  575. }
  576. if (bResult)
  577. {
  578. Application->MessageBox(FrmLang->lblDbSave->Caption.c_str(),//L"VDS-제어기 정보저장\r\nVDS-제어기 정보를 저장 하였습니다.",
  579. FTitle.c_str(), MB_OK|MB_ICONINFORMATION|MB_APPLMODAL);
  580. FUpdate = true;
  581. FRAMEVdsList1->UpdateList();
  582. UpdateIcon();
  583. CMM_SetGridRow(FRAMEVdsList1->CxList, FRAMEVdsList1->TvList, sId, FRAMEVdsList1->Column01->Index);
  584. DisplayInfo(pObj, true);
  585. }
  586. }
  587. }
  588. //---------------------------------------------------------------------------
  589. void __fastcall TVDSM010M::FRAMEVdsList1TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
  590. TMouseButton AButton, TShiftState AShift, bool &AHandled)
  591. {
  592. if (!ACellViewInfo) return;
  593. int nRow = FRAMEVdsList1->TvList->DataController->FocusedRecordIndex;
  594. if( nRow <= -1 )
  595. return;
  596. int nMemPtr = FRAMEVdsList1->TvList->DataController->Values[nRow][FRAMEVdsList1->Column99->Index];
  597. TItsVds* pObj = (TItsVds*)nMemPtr;
  598. DisplayInfo(pObj, true);
  599. }
  600. //---------------------------------------------------------------------------
  601. void __fastcall TVDSM010M::GMMarker1Click(TObject *Sender, TLatLng *LatLng, int Index,
  602. TLinkedComponent *LinkedComponent)
  603. {
  604. try
  605. {
  606. TMarker *pMkr = GMMarker1->Items[Index];
  607. if (EditMode)
  608. {
  609. //pMkr->Draggable = true;
  610. }
  611. else
  612. {
  613. int nTag = pMkr->Tag;
  614. TItsVds *pObj = (TItsVds*)nTag;
  615. if (!pObj) return;
  616. CMM_SetGridRow(FRAMEVdsList1->CxList, FRAMEVdsList1->TvList, pObj->CTLR_MNGM_NMBR, FRAMEVdsList1->Column01->Index);
  617. DisplayInfo(pObj);
  618. }
  619. }
  620. catch(Exception &e)
  621. {
  622. }
  623. }
  624. //---------------------------------------------------------------------------
  625. void __fastcall TVDSM010M::GMMarker1DragEnd(TObject *Sender, TLatLng *LatLng, int Index,
  626. TLinkedComponent *LinkedComponent)
  627. {
  628. SePosY->Value = FRAMEGoogleMap1->FLat;//LatLng->Lat;
  629. SePosX->Value = FRAMEGoogleMap1->FLng;//LatLng->Lng;
  630. }
  631. //---------------------------------------------------------------------------
  632. void __fastcall TVDSM010M::GMMarkerNewDragEnd(TObject *Sender, TLatLng *LatLng, int Index,
  633. TLinkedComponent *LinkedComponent)
  634. {
  635. #if 0
  636. TGMMarker *pMarker = (TGMMarker*)Sender;
  637. TMarker *pMkr = pMarker->Items[Index];
  638. ShowMessage(pMkr->ToString());
  639. SePosY->Value = pMkr->Position->Lat;//LatLng->Lat;
  640. SePosX->Value = pMkr->Position->Lng;//LatLng->Lng;
  641. return;
  642. #endif
  643. SePosY->Value = FRAMEGoogleMap1->FLat;//FNewMkr->Position->Lat;//LatLng->Lat;
  644. SePosX->Value = FRAMEGoogleMap1->FLng;//FNewMkr->Position->Lng;//LatLng->Lng;
  645. }
  646. //---------------------------------------------------------------------------