Ниже приведен пример использования операции GetMs для удаления уравнения. В запросе передаются: экземпляр открытого контейнера моделирования, параметры выполнения операции и шаблон получения измененных данных. В результате выполнения операция возвращает модель без уравнения.
{ "GetMs" : { "tMs" : { "id" : "CEOHFIGABHNBFOAEACLDIHAAFIBLHLNEJJHHIHEGOIMCAOGA!M!S!CPOKJBJGABHNBFOAEFABNMBGBLLNHOPAEHKDKCJFDLLMFBFKJ" }, "tArg" : { "pattern" : { "obInst" : "true", "scenarios" : "Get", "item" : { "key" : "92145", "problem" : { "metamodel" : { "calculationChain" : "Get", "mmParams" : "Get", "tag" : "true", "calcChainPattern" : { "modelPattern" : { "transform" : { "transformVariable" : { "slices" : "Get", "transformSlice" : { "selection" : "Get" } } } } }, "visualControllerPattern" : { "variableRubricatorKey" : "true", "useSourceName" : "false", "levelFormat" : "Short" } }, "scenarios" : "Get", "details" : "true", "useSavedCoefficients" : "true" } } }, "execParams" : { "modelKeys" : { "l" : "3" }, "execRemoveModel" : "true" } } } }
{ "GetMsResult" : { "id" : { "id" : "CEOHFIGABHNBFOAEACLDIHAAFIBLHLNEJJHHIHEGOIMCAOGA!M!S!CPOKJBJGABHNBFOAEFABNMBGBLLNHOPAEHKDKCJFDLLMFBFKJ" }, "meta" : { "obInst" : { "obDesc" : { "@fullUrl" : "http:\/\/v-shp-development.dev.fs.fsight.world\/", "@isShortcut" : "0", "@isLink" : "0", "@ver" : "6", "@hf" : "0", "i" : "MODELSPACE", "n" : "Контейнер моделирования", "k" : "1581", "c" : "5121", "p" : "1580", "h" : "0", "hasPrv" : "0", "ic" : "0", "isPermanent" : "1", "isTemp" : "0" } }, "dirty" : "0", "scenarios" : { "nodes" : { "it" : [ { "@isFolder" : "0", "k" : "1628", "id" : "OBJ1628", "n" : "Базовый", "vis" : "1", "scenDesc" : { "@fullUrl" : "http:\/\/v-shp-development.dev.fs.fsight.world\/", "@isShortcut" : "0", "@isLink" : "0", "@ver" : "0", "@hf" : "0", "i" : "OBJ1628", "n" : "Базовый", "k" : "1628", "c" : "5124", "p" : "1627", "h" : "0", "hasPrv" : "0", "ic" : "0" }, "internalKey" : "1629" }, { "@isFolder" : "0", "k" : "5371", "id" : "OBJ5371", "n" : "Базовый (копия1)", "vis" : "1", "scenDesc" : { "@fullUrl" : "http:\/\/v-shp-development.dev.fs.fsight.world\/", "@isShortcut" : "0", "@isLink" : "0", "@ver" : "0", "@hf" : "0", "i" : "OBJ5371", "n" : "Базовый (копия1)", "k" : "5371", "c" : "5124", "p" : "1627", "h" : "0", "hasPrv" : "0", "ic" : "0" }, "internalKey" : "5372" } ] } }, "item" : { "k" : "92145", "id" : "MODEL_DEL", "n" : "MODEL_DEL", "vis" : "1", "type" : "Problem", "problemMd" : { "metamodel" : { "k" : "92146", "calculationChain" : { "its" : { "Item" : [ { "k" : "1", "n" : "Переменная моделирования 1", "vis" : "1", "type" : "Variable", "excluded" : "0", "graphMeta" : "{"Geometry":{"x":10,"y":10,"width":150,"height":50}}", "chainVariable" : { "slice" : { "k" : "0", "id" : "Переменная моделирования 1|A", "n" : "Переменная моделирования 1|A", "vis" : "1", "variableKey" : "1", "stubKey" : "92147", "selections" : { "its" : { "Item" : { "id" : { "id" : "92159" }, "variant" : "1" } } }, "aggregator" : "None", "parametrizedDimensions" : { "its" : { "Item" : { "dimension" : "0", "parameter" : "0" } } }, "unitInfo" : { "unit" : "4294967295", "measure" : "4294967295", "baseUnit" : "4294967295", "unitsDimensionKey" : "0" }, "level" : "Year" }, "fullName" : "Переменная моделирования 1|A", "originalName" : "Переменная моделирования 1", "originalShortName" : "Переменная моделирования 1", "useCustomName" : "0" } }, { "k" : "3", "n" : "Переменная моделирования 2", "vis" : "1", "type" : "Variable", "excluded" : "0", "graphMeta" : "{"Geometry":{"x":10,"y":70,"width":150,"height":50}}", "chainVariable" : { "slice" : { "k" : "0", "id" : "Переменная моделирования 2|A", "n" : "Переменная моделирования 2|A", "vis" : "1", "variableKey" : "2", "stubKey" : "92147", "selections" : { "its" : { "Item" : { "id" : { "id" : "92159" }, "variant" : "2" } } }, "aggregator" : "None", "parametrizedDimensions" : { "its" : { "Item" : { "dimension" : "0", "parameter" : "0" } } }, "unitInfo" : { "unit" : "4294967295", "measure" : "4294967295", "baseUnit" : "4294967295", "unitsDimensionKey" : "0" }, "level" : "Year" }, "fullName" : "Переменная моделирования 2|A", "originalName" : "Переменная моделирования 2", "originalShortName" : "Переменная моделирования 2", "useCustomName" : "0" } } ] } }, "mmParams" : { "its" : "" }, "visualController" : { "variableRubricatorKey" : "92147", "userRPath" : "", "isRExist" : "0" }, "suppressEmptyFilter" : { "suppressEmpty" : "0", "suppressEmptyArea" : "SerieBounds" }, "readOnly" : "0", "variableTestUseR" : "0", "calculateIdentOnFact" : "0" }, "scenarios" : { "its" : "" }, "details" : { "period" : { "identificationStartDate" : "1969-01-01", "identificationEndDate" : "2018-05-23", "forecastStartDate" : "2018-05-24", "forecastEndDate" : "2020-12-31", "identificationStartDateParamID" : "", "identificationEndDateParamID" : "", "forecastStartDateParamID" : "", "forecastEndDateParamID" : "", "autoPeriod" : "0", "identificationStartOffset" : "0", "identificationEndOffset" : "0", "forecastEndOffset" : "0", "isIdentStartCorrect" : "1", "isIdentEndCorrect" : "1", "isForecastEndCorrect" : "1" }, "currentPoint" : "2018-05-24" }, "useSavedCoefficients" : "0", "useScenarios" : "0", "readOnly" : "0" } } } } }
Функция GetMsDelEq удаляет указанное уравнение из модели. Входные параметры:
ms. Экземпляр открытого контейнера моделирования;
modelKey. Ключ модели, содержащей уравнение;
eqKey. Ключ открытого уравнения.
В результате выполнения функция возвращает модель без уравнения.
public static MsItem GetMsDelEq(MsId ms, ulong modelKey, long eqKey) { var getMsOp = new GetMs(); getMsOp.tMs = ms; getMsOp.tArg = new GetMsArg() { // Задаем шаблон изменения данных pattern = new MsMdPattern() { item = new MsItemPattern() { key = modelKey, problem = new MsProblemPattern() { details = true, scenarios = ListOperation.Get, useSavedCoefficients = true, metamodel = new MsMetaModelPattern() { tag = true, calculationChain = ListOperation.Get, mmParams = ListOperation.Get, calcChainPattern = new MsCalculationChainPattern() { modelPattern = new MsModelPattern() { transform = new MsFormulaTransformPattern() { transformVariable = new MsFormulaTransformVariablePattern() { slices = ListOperation.Get, transformSlice = new MsFormulaTransformSlicePattern() { selection = ListOperation.Get } } } } }, visualControllerPattern = new MsMetaModelVisualControllerPattern() { levelFormat = MsLevelFormat.Short, useSourceName = false, variableRubricatorKey = true } } } }, scenarios = ListOperation.Get }, execParams = new MsMdExecParams() { modelKeys = new long[] { eqKey }, execRemoveModel = true } }; // Создаем прокси-объект для выполнения операции var somClient = new SomPortTypeClient(); // Задаем параметры выполнения операции var result = somClient.GetMs(getMsOp); return result.meta.item; }
См. также: