FRAME_ProcessStatusListF.cpp 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "ITSSkinF.h"
  4. #include "ITSUtilF.h"
  5. #include "CDSProcessF.h"
  6. #include "FrmResourceF.h"
  7. #include "ITSLangTransF.h"
  8. #pragma hdrstop
  9. #include "FRAME_ProcessStatusListF.h"
  10. //---------------------------------------------------------------------------
  11. #pragma package(smart_init)
  12. #pragma link "cxClasses"
  13. #pragma link "cxControls"
  14. #pragma link "cxCustomData"
  15. #pragma link "cxData"
  16. #pragma link "cxDataStorage"
  17. #pragma link "cxEdit"
  18. #pragma link "cxFilter"
  19. #pragma link "cxGraphics"
  20. #pragma link "cxGrid"
  21. #pragma link "cxGridCustomTableView"
  22. #pragma link "cxGridCustomView"
  23. #pragma link "cxGridLevel"
  24. #pragma link "cxGridTableView"
  25. #pragma link "cxLookAndFeelPainters"
  26. #pragma link "cxLookAndFeels"
  27. #pragma link "cxStyles"
  28. #pragma link "cxTextEdit"
  29. #pragma link "dxSkinBlack"
  30. #pragma link "dxSkinBlue"
  31. #pragma link "dxSkinsCore"
  32. #pragma link "dxSkinscxPCPainter"
  33. #pragma link "dxSkinMcSkin"
  34. #pragma resource "*.dfm"
  35. //TFRAMEProcessStatusList *FRAMEProcessStatusList;
  36. //---------------------------------------------------------------------------
  37. __fastcall TFRAMEProcessStatusList::TFRAMEProcessStatusList(TComponent* Owner)
  38. : TFrame(Owner)
  39. {
  40. LangTrans->Translate(this, ITSDb_GetConnection());
  41. m_pGDC = TvList->DataController;
  42. TvList->OptionsView->NoDataToDisplayInfoText = FrmLang->lblNoInfo->Caption;//"<프로세스 정보가 없습니다>";
  43. FCodeCMS = ItsCodeManager->FLists.Find("CMS");
  44. FCodeCDS = ItsCodeManager->FLists.Find("CDS");
  45. }
  46. //---------------------------------------------------------------------------
  47. void __fastcall TFRAMEProcessStatusList::UpdateList()
  48. {
  49. CMM_ClearGridTableView(TvList);
  50. int nRow = 0;
  51. try
  52. {
  53. TvList->BeginUpdate();
  54. TItsSubCode *pSubCode;
  55. try
  56. {
  57. ItsProcessManager->FLists.Lock();
  58. FOR_STL(TItsProcess*, pObj, ItsProcessManager->FLists)
  59. {
  60. pObj->FGridIndex = -1;
  61. if (pObj->DEL_YN == "Y") continue;
  62. if (pObj->STTS_DSPL_YN == "N") continue;
  63. nRow = m_pGDC->AppendRecord();
  64. pObj->FGridIndex = nRow;
  65. #if 0
  66. String sCMS = pObj->CommStatus;
  67. if (FCodeCMS)
  68. {
  69. pSubCode = FCodeCMS->FSubLists.Find(sCMS);
  70. if (pSubCode) sCMS = pSubCode->CMMN_CD_KOR_NM;
  71. }
  72. String sCDS = pObj->DoorStatus;
  73. if (FCodeCDS)
  74. {
  75. pSubCode = FCodeCDS->FSubLists.Find(sCDS);
  76. if (pSubCode) sCDS = pSubCode->CMMN_CD_KOR_NM;
  77. }
  78. #endif
  79. m_pGDC->Values[nRow][Column00->Index] = pObj->SYST_TYPE;
  80. m_pGDC->Values[nRow][Column01->Index] = pObj->SYST_NM;
  81. m_pGDC->Values[nRow][Column02->Index] = pObj->SYST_ID;
  82. m_pGDC->Values[nRow][Column03->Index] = pObj->CommStatus;
  83. m_pGDC->Values[nRow][Column04->Index] = pObj->CommStatus;
  84. //m_pGDC->Values[nRow][Column99->Index] = 0;
  85. }
  86. }
  87. __finally
  88. {
  89. ItsProcessManager->FLists.UnLock();
  90. }
  91. }
  92. __finally
  93. {
  94. TvList->EndUpdate();
  95. }
  96. }
  97. //---------------------------------------------------------------------------
  98. void __fastcall TFRAMEProcessStatusList::RefreshList()
  99. {
  100. int nRow = 0;
  101. try
  102. {
  103. int nTotalRows = m_pGDC->RecordCount;
  104. TvList->BeginUpdate();
  105. TItsSubCode *pSubCode;
  106. try
  107. {
  108. ItsProcessManager->FLists.Lock();
  109. FOR_STL(TItsProcess*, pObj, ItsProcessManager->FLists)
  110. {
  111. if (pObj->DEL_YN == "Y") continue;
  112. if (pObj->STTS_DSPL_YN == "N") continue;
  113. if (pObj->FGridIndex < 0) continue;
  114. nRow = pObj->FGridIndex;
  115. #if 0
  116. String sCMS = pObj->CommStatus;
  117. if (FCodeCMS)
  118. {
  119. pSubCode = FCodeCMS->FSubLists.Find(sCMS);
  120. if (pSubCode) sCMS = pSubCode->CMMN_CD_KOR_NM;
  121. }
  122. #endif
  123. m_pGDC->Values[nRow][Column03->Index] = pObj->CommStatus;
  124. m_pGDC->Values[nRow][Column04->Index] = pObj->CommStatus;
  125. }
  126. }
  127. __finally
  128. {
  129. ItsProcessManager->FLists.UnLock();
  130. }
  131. }
  132. __finally
  133. {
  134. TvList->EndUpdate();
  135. }
  136. }
  137. //---------------------------------------------------------------------------
  138. void __fastcall TFRAMEProcessStatusList::Column03CustomDrawCell(TcxCustomGridTableView *Sender, TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo,
  139. bool &ADone)
  140. {
  141. if (AViewInfo->GridRecord->RecordIndex < 0) return;
  142. Graphics::TBitmap *pBmp = NULL;
  143. pBmp = ImgState1->Picture->Bitmap;
  144. if (!VarIsNull(AViewInfo->GridRecord->DisplayTexts[Column03->Index]))
  145. {
  146. String sCode = AViewInfo->GridRecord->DisplayTexts[Column03->Index];
  147. if (sCode == "0") pBmp = ImgState1->Picture->Bitmap;
  148. else if (sCode == "1") pBmp = ImgState0->Picture->Bitmap;
  149. else if (sCode == "2") pBmp = ImgState2->Picture->Bitmap;
  150. }
  151. if (!pBmp) return;
  152. pBmp->Transparent = true;
  153. int nW, nH;
  154. nW = nH = 21;
  155. try
  156. {
  157. TColor bBrush = ACanvas->Brush->Color;
  158. if (AViewInfo->GridRecord->Selected)
  159. {
  160. if (AViewInfo->GridRecord->Index % 2 == 0)
  161. {
  162. bBrush = Sender->LookAndFeelPainter->DefaultContentEvenColor();
  163. }
  164. else
  165. {
  166. bBrush = Sender->LookAndFeelPainter->DefaultContentOddColor();
  167. }
  168. }
  169. ACanvas->Brush->Color = bBrush;
  170. TRect rc;
  171. TRect rcOrg = AViewInfo->Bounds;
  172. ACanvas->FillRect(rcOrg);
  173. nW = rcOrg.Bottom - rcOrg.Top - 4;
  174. rc.Top = rcOrg.Top+2;
  175. rc.Bottom = rcOrg.Bottom - 2;
  176. rc.Left = rcOrg.Left + (rcOrg.Width() - nW) / 2;
  177. rc.Right = rc.Left + nW;
  178. ACanvas->Canvas->StretchDraw(rc, pBmp);
  179. //ACanvas->Draw(AViewInfo->ContentBounds.Left, AViewInfo->ContentBounds.Top, pBmp);
  180. ADone = true;
  181. }
  182. catch(...) {}
  183. }
  184. //---------------------------------------------------------------------------
  185. void __fastcall TFRAMEProcessStatusList::TvListCustomDrawCell(TcxCustomGridTableView *Sender, TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo,
  186. bool &ADone)
  187. {
  188. //OptionsSelection.InvertSelect = False
  189. //OptionsView.FocusRect = False
  190. if (AViewInfo->GridRecord->Selected)
  191. {
  192. //ACanvas->Brush->Color = Sender->LookAndFeelPainter->DefaultContentColor();
  193. //ACanvas->Font->Color = Sender->LookAndFeelPainter->DefaultContentTextColor();
  194. if (AViewInfo->GridRecord->Index % 2 == 0)
  195. {
  196. ACanvas->Brush->Color = Sender->LookAndFeelPainter->DefaultContentEvenColor();
  197. ACanvas->Font->Color = Sender->LookAndFeelPainter->DefaultContentTextColor();
  198. }
  199. else
  200. {
  201. ACanvas->Brush->Color = Sender->LookAndFeelPainter->DefaultContentOddColor();
  202. ACanvas->Font->Color = Sender->LookAndFeelPainter->DefaultContentTextColor();
  203. }
  204. }
  205. else
  206. {
  207. }
  208. }
  209. //---------------------------------------------------------------------------