//--------------------------------------------------------------------------- #pragma hdrstop #include #include "ITSSkinF.h" #include "ITSUtilF.h" #include "AppGlobalF.h" #pragma hdrstop #include "FrmVmsFormEditF.h" #include "VMSM500MSRCF.h" //--------------------------------------------------------------------------- #pragma package(smart_init) //--------------------------------------------------------------------------- String __fastcall TFrmVmsFormEdit::GetVmsSizeTypeDesc(String AType) { TVmsSizeType *Obj = VmsSizeTypeManager->Find(AType); if (Obj) { return Obj->NAME; } return ""; } //--------------------------------------------------------------------------- String __fastcall TFrmVmsFormEdit::GetVmsFormTypeDesc(String AType) { TVmsCode *Obj = VmsFormTypeManager->Find(AType.ToIntDef(-1)); if (Obj) { return Obj->NAME; } return ""; } //--------------------------------------------------------------------------- void __fastcall TFrmVmsFormEdit::FillVmsSizeType(TcxComboBox *cboBox) { String sQry; TStrings *pStrItems; pStrItems = ((TcxComboBox *)cboBox)->Properties->Items; ((TcxComboBox *)cboBox)->Properties->Items->Clear(); FOR_STL(TVmsSizeType*, pObj, VmsSizeTypeManager->FLists) { if (!pObj->IsUse) continue; pStrItems->AddObject(" [" + pObj->CODE + "] " + pObj->NAME + " (" + String(pObj->WDTH) + "x" + String(pObj->HGHT) + ")", (TObject*)pObj); } cboBox->ItemIndex = 0; } //--------------------------------------------------------------------------- TVmsSizeType* __fastcall TFrmVmsFormEdit::GetVmsSizeTypeObject(TcxComboBox *cboBox) { TStrings *pStrItems; TVmsSizeType *Ov = NULL; int nItemIndex; pStrItems = ((TcxComboBox *)cboBox)->Properties->Items; nItemIndex= ((TcxComboBox *)cboBox)->ItemIndex; if (nItemIndex < 0) { return Ov; } Ov = (TVmsSizeType *)pStrItems->Objects[nItemIndex]; if (Ov == NULL) { Ov = NULL; } return Ov; } //--------------------------------------------------------------------------- //ÆûÀ¯Çü void __fastcall TFrmVmsFormEdit::FillVmsFormType(TcxComboBox *ACombo) { ACombo->Properties->Items->Clear(); try { FOR_STL(TVmsCode*, pObj, VmsFormTypeManager->FLists) { if (!pObj->IsUse) continue; ACombo->Properties->Items->Add(" [" + String(pObj->CODE) + "] " + pObj->NAME); } } __finally { ACombo->ItemIndex = 0; } } //--------------------------------------------------------------------------- //Ç¥Ãâ¹æ¹ý void __fastcall TFrmVmsFormEdit::FillVmsFormDispMthd(TcxComboBox *ACombo) { ACombo->Properties->Items->Clear(); try { FOR_STL(TVmsCode*, pObj, VmsDsplMthdManager->FLists) { if (!pObj->IsUse) continue; ACombo->Properties->Items->Add(" [" + String(pObj->CODE) + "] " + pObj->NAME); } } __finally { ACombo->ItemIndex = 0; } } //--------------------------------------------------------------------------- //Ç¥Ãâ¹æÇâ void __fastcall TFrmVmsFormEdit::FillVmsFormDispDrct(TcxComboBox *ACombo) { ACombo->Properties->Items->Clear(); try { FOR_STL(TVmsCode*, pObj, VmsDsplDrctManager->FLists) { if (!pObj->IsUse) continue; ACombo->Properties->Items->Add(" [" + String(pObj->CODE) + "] " + pObj->NAME); } } __finally { ACombo->ItemIndex = 0; } } //--------------------------------------------------------------------------- //VMS Font void __fastcall TFrmVmsFormEdit::FillVmsFont(TcxComboBox *ACombo) { ACombo->Properties->Items->Clear(); try { FOR_STL(TVmsCode*, pObj, VmsFontNameManager->FLists) { if (!pObj->IsUse) continue; ACombo->Properties->Items->Add(" [" + String(pObj->CODE) + "] " + pObj->NAME); } } __finally { ACombo->ItemIndex = 0; } } //--------------------------------------------------------------------------- String __fastcall TFrmVmsFormEdit::BitmapToBase64String(Graphics::TBitmap *ABitmap) { String result = ""; TIdEncoderMIME *Encodeur = new TIdEncoderMIME(NULL); TMemoryStream *TempMem = new TMemoryStream(); void *buffer = NULL; try { try { ABitmap->SaveToStream(TempMem); TBytes bytes; TempMem->Position = 0; int size = TempMem->Size; buffer = malloc(size); bytes.Length = size; TempMem->ReadBuffer(buffer, TempMem->Size); ZeroMemory(&bytes[0], TempMem->Size); CopyMemory(&bytes[0], buffer, TempMem->Size); result = Encodeur->EncodeBytes(bytes); } catch(Exception &e) { } } __finally { if (Encodeur) delete Encodeur; if (TempMem) delete TempMem; if (buffer) free(buffer); } return result; } //--------------------------------------------------------------------------- Graphics::TBitmap * __fastcall TFrmVmsFormEdit::Base64StringToBitmap(String AImageString) { TIdDecoderMIME *Decodeur = new TIdDecoderMIME(NULL); TMemoryStream *TempMem = new TMemoryStream(); Graphics::TBitmap *result = new Graphics::TBitmap(); try { try { Decodeur->DecodeBegin(TempMem); Decodeur->Decode(AImageString); Decodeur->DecodeEnd(); TempMem->Position = 0; result->LoadFromStream(TempMem); } catch(Exception &e) { } } __finally { if (Decodeur) delete Decodeur; if (TempMem) delete TempMem; } return result; } //--------------------------------------------------------------------------- void __fastcall TFrmVmsFormEdit::LoadFormObjectInfo(String AFormId, TVmsFormDesigner *ADesigner, String AFormType) { ADesigner->Clear(); //String apiUri = g_AppCfg.sRestApiUri + "/api/vms/form/manage/object/" + AFormId; String apiUri = g_AppCfg.sRestApiUri + "/api/vms/form/manage/form/detail/" + AFormId; TMcJsonItem *ObjList = NULL; try { ObjList = TRestObjectManager::RequestGet(apiUri); if (ObjList == NULL) { return; } try { int nDrawType; String sObjKind; if (ObjList->Count < 2) { return; } //TMcJsonItem *formInfo = ObjList->Items[0]; TMcJsonItem *formInfo = ObjList->Values["form"]; if (formInfo) { String formImageString = TRestObjectManager::GetValue(formInfo, "vms_form_imag"); Graphics::TBitmap *formBitmap = Base64StringToBitmap(formImageString); try { ImgForm->Picture->Bitmap->Assign(formBitmap); } catch(Exception &e) { } SAFE_DELETE(formBitmap); } //TMcJsonItem *objects = ObjList->Items[1]; TMcJsonItem *objects = ObjList->Values["objects"]; if (objects) { for (int ii = 0; ii < objects->Count; ii++) { int nFormId = TRestObjectManager::GetValue(objects->Items[ii], "vms_form_id").ToIntDef(0); int nObjId = TRestObjectManager::GetValue(objects->Items[ii], "form_object_id").ToIntDef(0); int nObjType = TRestObjectManager::GetValue(objects->Items[ii], "vms_form_object_type_cd").ToIntDef(-1); if (nObjType == 1 || //À̹ÌÁö ½Éº¼ nObjType == 2 || //ÆÄÀÏÀ̹ÌÁö nObjType == 3 || //¼ÒÅëÁ¤º¸À̹ÌÁö nObjType == 17 || //¼ÒÅëÀ̹ÌÁö1 nObjType == 27 || //¼ÒÅëÀ̹ÌÁö2 nObjType == 37 || //¼ÒÅëÀ̹ÌÁö3 nObjType == 47 || //¼ÒÅëÀ̹ÌÁö4 nObjType == 200 || //µ¿¿µ»ó nObjType == 300 || //½ºÆ®¸®¹Ö¿µ»ó nObjType == 406 || //@ÅëÇÕ´ë±âµî±Þ À̹ÌÁö nObjType == 407 || //@¹Ì¼¼¸ÕÁöµî±Þ À̹ÌÁö nObjType == 408 || //@Ãʹ̼¼¸ÕÁöµî±Þ À̹ÌÁö nObjType == 413 //@¿ÀÁ¸µî±ÞÀ̹ÌÁö ) { if (nObjType == 3) sObjKind = OBJKIND_IMAGE; else sObjKind = OBJKIND_IMAGEID; nDrawType = 1; //À̹ÌÁö±×¸®±â } else { sObjKind = OBJKIND_TEXT; //¹®ÀÚ¿­ nDrawType = 0; //¹®ÀÚ¿­±×¸®±â } int nBlinking = TRestObjectManager::GetValue(objects->Items[ii], "vms_dspl_blinking").ToIntDef(0); int nPosX = TRestObjectManager::GetValue(objects->Items[ii], "vms_dspl_xcrdn").ToIntDef(0); int nPosY = TRestObjectManager::GetValue(objects->Items[ii], "vms_dspl_ycrdn").ToIntDef(0); int nWidth = TRestObjectManager::GetValue(objects->Items[ii], "vms_dspl_width").ToIntDef(0); int nHeight = TRestObjectManager::GetValue(objects->Items[ii], "vms_dspl_height").ToIntDef(0); TVmsFormObject *pObj = ADesigner->AddObject((VmsObjectDrawType)nDrawType); if (!pObj) continue; if (nObjType == 200 || nObjType == 300) { pObj->EditMode = false; } String sIfscId = TRestObjectManager::GetValue(objects->Items[ii], "vms_ifsc_id"); String sFillCd = TRestObjectManager::GetValue(objects->Items[ii], "trfc_fill_cd"); pObj->ObjSeq = nObjId; pObj->ObjId = nObjId; pObj->ObjKind = sObjKind; pObj->Tag = sIfscId; if (AFormType == "15") { if (nObjType == 0 || nObjType == 1 || nObjType == 2) { pObj->Tag = sFillCd; } } pObj->ObjType = TRestObjectManager::GetValue(objects->Items[ii], "vms_form_object_type_cd"); pObj->ObjSize = TRestObjectManager::GetValue(objects->Items[ii], "vms_dspl_size").ToIntDef(0); pObj->BkColorCode = TRestObjectManager::GetValue(objects->Items[ii], "vms_dspl_bkcolor"); pObj->Blink = nBlinking == 1 ? true : false; pObj->ImageId = TRestObjectManager::GetValue(objects->Items[ii], "symb_lib_nmbr"); pObj->Text = TRestObjectManager::GetValue(objects->Items[ii], "vms_dspl_txt"); pObj->RunText = pObj->Text; pObj->SetPos(nPosX, nPosY); if (pObj->ObjKind == OBJKIND_TEXT) // ¹®ÀÚ¿­ { int nFontBold = TRestObjectManager::GetValue(objects->Items[ii], "vms_font_bold").ToIntDef(0); // TODO pObj->FontName = TRestObjectManager::GetValue(objects->Items[ii], "vms_font_name"); pObj->FontNameCode = TRestObjectManager::GetValue(objects->Items[ii], "vms_font_name_cd"); pObj->FontColorCode = TRestObjectManager::GetValue(objects->Items[ii], "vms_font_colr_cd"); pObj->FontSize = TRestObjectManager::GetValue(objects->Items[ii], "vms_font_size").ToIntDef(0); pObj->FontBold = nFontBold == 1 ? true : false; pObj->TextAlign = TRestObjectManager::GetValue(objects->Items[ii], "vms_font_align").ToIntDef(0); //pObj->SetPos(nPosX, nPosY); //pObj->SetSize(pADO->FieldByName("VMS_DSPL_WIDTH")->AsInteger, pADO->FieldByName("VMS_DSPL_HEIGHT")->AsInteger); } else //if (sObjKind == "1" || sObjKind == "2") // À̹ÌÁö(1), À̹ÌÁö ID(2) { if (pObj->ObjKind == OBJKIND_IMAGEID) { if (pObj->Text.Trim() == "") { pObj->Text = pObj->ImageId; } } String imageString = TRestObjectManager::GetValue(objects->Items[ii], "vms_dspl_figr"); Graphics::TBitmap *bitmap = Base64StringToBitmap(imageString); TStream *pStream = new TMemoryStream(); try { bitmap->SaveToStream(pStream); } catch(Exception &e) {} try { if (pStream && pStream->Size > 0) { Graphics::TBitmap *Bitmap = pObj->GetBitmap(); pStream->Position = 0; Bitmap->LoadFromStream(pStream); #ifdef IMAGE_RESIZE #if 0 if (nObjType == 1 || nObjType == 2) { pObj->GetImage()->AutoSize= false; pObj->GetImage()->Stretch = true; pObj->GetImage()->Width = nWidth; pObj->GetImage()->Height = nHeight; pObj->SetSize(nWidth, nHeight); pObj->SetPos(nPosX, nPosY); } else { pObj->SetSize(Bitmap->Width, Bitmap->Height); } #else switch(nObjType) { case 1: //½Éº¼ case 2: //À̹ÌÁö case 3: //¼ÒÅëÁ¤º¸¹è°æÀ̹ÌÁö case 17: //¼ÒÅëÁ¤º¸À̹ÌÁö1 case 27: //¼ÒÅëÁ¤º¸À̹ÌÁö2 case 37: //¼ÒÅëÁ¤º¸À̹ÌÁö3 case 47: //¼ÒÅëÁ¤º¸À̹ÌÁö4 case 167: //@¿ìȸ¼ÒÅëÁ¤º¸À̹ÌÁö case 200: //µ¿¿µ»óÀ̹ÌÁö case 300: //½ºÆ®¸®¹Ö¿µ»óÀ̹ÌÁö case 406: //@ÅëÇÕ´ë±âµî±Þ À̹ÌÁö case 407: //@¹Ì¼¼¸ÕÁöµî±Þ À̹ÌÁö case 408: //@Ãʹ̼¼¸ÕÁöµî±Þ À̹ÌÁö case 413: //@¿ÀÁ¸µî±ÞÀ̹ÌÁö pObj->GetImage()->AutoSize= false; pObj->GetImage()->Stretch = true; pObj->GetImage()->Width = nWidth; pObj->GetImage()->Height = nHeight; pObj->SetSize(nWidth, nHeight); pObj->SetPos(nPosX, nPosY); break; default: pObj->SetSize(Bitmap->Width, Bitmap->Height); pObj->SetPos(nPosX, nPosY); //TODO break; } #endif #else pObj->SetSize(Bitmap->Width, Bitmap->Height); pObj->SetPos(nPosX, nPosY); #endif } } __finally { SAFE_DELETE(pStream); SAFE_DELETE(bitmap); } } //pObj->SetPos(nPosX, nPosY); //if (pObj->Left < 0) pObj->Left = 0; //if (pObj->Top < 0) pObj->Top = 0; pObj->Show(); pObj->BringToFront(); } } } catch(Exception &exception) { throw Exception(String(exception.ClassName()) + exception.Message); } } __finally { if (ObjList) delete ObjList; } } //--------------------------------------------------------------------------- void __fastcall TFrmVmsFormEdit::LoadVmsForm() { FormClear(); int nFocusedIdx = TvList->DataController->FocusedRecordIndex; CMM_ClearGridTableView(TvList); ClearSymbloList(); TVmsSizeType *pVmsSizeType = GetVmsSizeTypeObject(CbSizeType); if (pVmsSizeType == NULL) return; String apiUri = g_AppCfg.sRestApiUri + "/api/vms/form/manage"; TMcJsonItem *ObjList = NULL; if (pVmsSizeType->CODE != "ALL") { apiUri = g_AppCfg.sRestApiUri + "/api/vms/form/manage/form/" + pVmsSizeType->CODE; } FVmsTypeCd = pVmsSizeType->CODE; FVmsWidth = pVmsSizeType->WDTH; FVmsHeight = pVmsSizeType->HGHT; FVmsCols = pVmsSizeType->COLS; FVmsRows = pVmsSizeType->ROWS; ImgForm->Width = FVmsWidth; ImgForm->Height = FVmsHeight; ImgForm->Picture->Bitmap->Width = FVmsWidth; ImgForm->Picture->Bitmap->Height = FVmsHeight; { PnlBack->Left = 5; PnlBack->Top = 5; PnlBack->Width = FVmsWidth+4; PnlBack->Height= FVmsHeight+4; } { PnlEdtBack->Width = FVmsWidth+4; PnlEdtBack->Height= FVmsHeight+4; PnlRePreview->Width = FVmsWidth+4; PnlRePreview->Height= FVmsHeight+4; PnlRePreview->Color = clWhite; ImgEdtPreview->Left = 2; ImgEdtPreview->Top = 2; ImgEdtPreview->Width = FVmsWidth; ImgEdtPreview->Height= FVmsHeight; ImgEdtPreview->Picture->Bitmap->Width = FVmsWidth; ImgEdtPreview->Picture->Bitmap->Height = FVmsHeight; m_pEdtDesigner->DrawPreviewModuleBack(ImgEdtPreview, clBlack, FVmsRows, FVmsCols); #if 0 #if 0 ReForm->Width = FVmsWidth+22+4; ReForm->Height= FVmsHeight+22+4; #else ReForm->Width = FVmsWidth+4; ReForm->Height= FVmsHeight+4; #endif #endif ReForm->Color = clBlack; m_pEdtDesigner->Clear(); m_pEdtDesigner->SizeType = FVmsTypeCd; m_pEdtDesigner->SetSize(FVmsWidth, FVmsHeight); m_pEdtDesigner->SetPos(0, 0); m_pEdtDesigner->BkColorCode = "0"; m_pEdtDesigner->EditMode = true; m_pEdtDesigner->Show(); } String sVmsSizeNm = pVmsSizeType->NAME; String sFirstFormId = ""; try { int nRow; TcxDataController *pGDC = TvList->DataController; TvList->BeginUpdate(); ObjList = TRestObjectManager::RequestGet(apiUri); if (ObjList == NULL) { return; } try { for (int ii = 0; ii < ObjList->Count; ii++) { nRow = pGDC->AppendRecord(); String sFormId = TRestObjectManager::GetValue(ObjList->Items[ii], "vms_form_id"); if (sFirstFormId == "") sFirstFormId = sFormId; pGDC->Values[nRow][Col01->Index] = sFormId; //ÆûID pGDC->Values[nRow][Col02->Index] = TRestObjectManager::GetValue(ObjList->Items[ii], "vms_form_nm"); //Æû¸íĪ pGDC->Values[nRow][Col03->Index] = TRestObjectManager::GetValue(ObjList->Items[ii], "vms_form_expl"); //Æû¼³¸í pGDC->Values[nRow][Col04->Index] = GetVmsFormTypeDesc(TRestObjectManager::GetValue(ObjList->Items[ii], "vms_form_type_cd")); pGDC->Values[nRow][Col05->Index] = GetVmsSizeTypeDesc(TRestObjectManager::GetValue(ObjList->Items[ii], "vms_type_cd")); pGDC->Values[nRow][Col06->Index] = TRestObjectManager::GetValue(ObjList->Items[ii], "vms_form_dspl_mthd_cd"); pGDC->Values[nRow][Col07->Index] = TRestObjectManager::GetValue(ObjList->Items[ii], "vms_form_dspl_drct_cd"); pGDC->Values[nRow][Col08->Index] = TRestObjectManager::GetValue(ObjList->Items[ii], "vms_form_colr_cd"); pGDC->Values[nRow][Col09->Index] = TRestObjectManager::GetValue(ObjList->Items[ii], "vms_form_type_cd"); pGDC->Values[nRow][Col10->Index] = TRestObjectManager::GetValue(ObjList->Items[ii], "vms_type_cd"); pGDC->Values[nRow][Col12->Index] = TRestObjectManager::GetValue(ObjList->Items[ii], "vms_dspl_txt"); } } catch(Exception &e) { throw Exception(String(e.ClassName()) + e.Message); } } __finally { if (ObjList) delete ObjList; TvList->EndUpdate(); if (TvList->DataController->RecordCount > 0) { //CMM_SetGridRow(CxList, TvList, sFirstFormId, Col01->Index); //DisplayInfo(); } } } //--------------------------------------------------------------------------- bool __fastcall TFrmVmsFormEdit::SaveVmsForm(String AVALID_YN) { bool result = false; int nFormId = EdFormId->Text.Trim().ToIntDef(0); String sVmsType = FVmsTypeCd; String sFormType = APP_GetCode(CbFormKind); String sName = EdFormName->Text.Trim(); String sExpl = EdFormDesc->Text.Trim(); String sFormColor = String(CbFormColor->ItemIndex); String sDispDir = APP_GetCode(CbFormDsplDrct); String sDispMode = APP_GetCode(CbFormDsplMthd); String sUpdtDt = Now().FormatString("yyyymmddhhnnss"); String resultVal; String key = "abcdefg1234567890x"; String apiUri = g_AppCfg.sRestApiUri + "/cs-api/vms/form/manage/merge/" + key + "/" + String(nFormId); TMcJsonItem *ObjList = new TMcJsonItem(); try { ObjList->Add("vms_form_id")->AsInteger = nFormId; ObjList->Add("vms_form_nm")->AsString = sName; ObjList->Add("vms_form_expl")->AsString = sExpl; ObjList->Add("vms_type_cd")->AsString = sVmsType; ObjList->Add("vms_form_type_cd")->AsInteger = sFormType.ToIntDef(0); ObjList->Add("vms_form_colr_cd")->AsInteger = sFormColor.ToIntDef(0); ObjList->Add("vms_form_dspl_drct_cd")->AsInteger = sDispDir.ToIntDef(0); ObjList->Add("vms_form_dspl_mthd_cd")->AsInteger = sDispMode.ToIntDef(0); ObjList->Add("vms_form_imag")->AsString = BitmapToBase64String(ImgForm->Picture->Bitmap); //ObjList->Add("symb_lib_nmbr")->AsInteger = jvtNull; ObjList->Add("updt_dt")->AsString = sUpdtDt; ObjList->Add("valid_yn")->AsString = AVALID_YN; TMcJsonItem *objects = ObjList->Add("objects", jitArray); TVmsFormObject *pObj; TcxGridDataController *pGDC = TvObjList->DataController; int nObjType; int nObjCnt = pGDC->RecordCount; for (int ii = 0; ii < nObjCnt; ii++) { TMcJsonItem *object = new TMcJsonItem(); String sObjSeq = VarToStr(pGDC->Values[ii][ColSeq->Index]); pObj = m_pEdtDesigner->FindObject(sObjSeq.ToInt()); if (!pObj) continue; nObjType = pObj->ObjType.ToIntDef(0); object->Add("vms_form_object_id")->AsInteger = ii+1; object->Add("vms_form_id")->AsInteger = nFormId; object->Add("vms_form_dspl_row")->AsInteger = 0; object->Add("vms_form_dspl_clmn")->AsInteger = 0; object->Add("vms_form_object_type_cd")->AsInteger = nObjType; object->Add("vms_font_name_cd")->AsInteger = pObj->FontNameCode.ToIntDef(0); object->Add("vms_font_colr_cd")->AsInteger = pObj->FontColorCode.ToIntDef(0); object->Add("vms_font_bold")->AsInteger = pObj->FontBold ? 1 : 0; object->Add("vms_font_size")->AsInteger = pObj->FontSize; object->Add("vms_font_align")->AsInteger = pObj->TextAlign; object->Add("vms_dspl_txt")->AsString = pObj->Text; TImage *pImg = pObj->GetImage(); if (!pImg) { object->Add("vms_dspl_figr")->AsString = BitmapToBase64String(ImgNull->Picture->Bitmap); } else { object->Add("vms_dspl_figr")->AsString = BitmapToBase64String(pImg->Picture->Bitmap); } object->Add("vms_dspl_xcrdn")->AsInteger = pObj->GetLeft(); object->Add("vms_dspl_ycrdn")->AsInteger = pObj->GetTop(); object->Add("vms_dspl_width")->AsInteger = pObj->GetWidth(); object->Add("vms_dspl_height")->AsInteger = pObj->GetHeight(); object->Add("vms_dspl_blinking")->AsInteger = pObj->Blink ? 1 : 0; object->Add("vms_dspl_bkcolor")->AsInteger = pObj->BkColorCode.ToIntDef(0); object->Add("vms_dspl_size")->AsInteger = pObj->ObjSize; String sFillIn = "N"; if (sFormType == "15") { if (nObjType == 0 || nObjType == 1 || nObjType == 2) { sFillIn = pObj->Tag; } } object->Add("trfc_fill_cd")->AsString = sFillIn; int symbLibNmbr = pObj->ImageId.ToIntDef(0); if (symbLibNmbr > 0) { //object->Add("symb_lib_nmbr")->AsInteger = symbLibNmbr == 0 ? jvtNull : symbLibNmbr; object->Add("symb_lib_nmbr")->AsInteger = symbLibNmbr; } else { object->Add("symb_lib_nmbr")->AsInteger = 0; // NOT NULL } String sIfscId = ""; if (nObjType == 91 || nObjType == 92) { sIfscId = pObj->Tag; } object->Add("vms_ifsc_id")->AsString = sIfscId; objects->Add(object); delete object; } result = TRestObjectManager::RequestPost(apiUri, ObjList->AsJSON, resultVal); if (!result) { return false; } } __finally { if (ObjList) delete ObjList; } return true; } //--------------------------------------------------------------------------- bool __fastcall TFrmVmsFormEdit::CheckVmsFormUse(String AFormId) { String apiUri = g_AppCfg.sRestApiUri + "/api/vms/form/manage/usage/" + AFormId; TMcJsonItem *ObjList = NULL; try { ObjList = TRestObjectManager::RequestGet(apiUri); if (ObjList == NULL) { return false; } if (ObjList->Count > 0) { String usages = TRestObjectManager::GetValue(ObjList, "count"); if (usages.ToIntDef(-1) > 0) { Application->MessageBox(L"VMS Æû »ç¿ëÈ®ÀÎ\r\n»èÁ¦ÇÒ VMS Æû Á¤º¸°¡ VMS ½ºÄÉÁì¿¡ »ç¿ëµÇ°í ÀÖ½À´Ï´Ù.\r\n¸ÕÀú ÇØ´ç Á¤º¸¸¦ »èÁ¦ÇØÁֽñ⠹ٶø´Ï´Ù.", FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL); return false; } } } __finally { if (ObjList) delete ObjList; } return true; } //--------------------------------------------------------------------------- bool __fastcall TFrmVmsFormEdit::DelVmsForm(String AFormId) { bool result = false; String resultVal; String key = "abcdefg1234567890x"; String apiUri = g_AppCfg.sRestApiUri + "/cs-api/vms/form/manage/delete/" + key + "/" + AFormId; try { result = TRestObjectManager::RequestPost(apiUri, "", resultVal); if (!result) { return false; } } __finally { } return result; } //--------------------------------------------------------------------------- bool __fastcall TFrmVmsFormEdit::GetNextVmsFormId(int &AFormId) { AFormId = -1; String apiUri = g_AppCfg.sRestApiUri + "/api/vms/form/manage/new-id"; TMcJsonItem *ObjList = NULL; try { ObjList = TRestObjectManager::RequestGet(apiUri); if (ObjList == NULL) { return false; } if (ObjList->Count > 0) { String newId = TRestObjectManager::GetValue(ObjList, "new_id"); AFormId = newId.ToIntDef(-1); } } __finally { if (ObjList) delete ObjList; } if (AFormId == -1) return false; return true; } //---------------------------------------------------------------------------