Пример #1
0
        public void SetContents(
            AdminShellPackageEnv package, DefinitionsZveiTechnicalData.SetOfDefs theDefs, string defaultLang,
            AdminShell.Submodel sm)
        {
            // access
            if (sm == null)
            {
                return;
            }

            // section General
            var smcFurther = sm.submodelElements.FindFirstSemanticIdAs <AdminShell.SubmodelElementCollection>(
                theDefs.CD_FurtherInformation.GetSingleKey());

            if (smcFurther != null)
            {
                // single items
                TextBoxValidDate.Text = "" + smcFurther.value.FindFirstSemanticIdAs <AdminShell.Property>(
                    theDefs.CD_ValidDate.GetSingleKey())?.value;

                // Lines
                var tsl = new List <string>();
                foreach (var smw in
                         smcFurther.value.FindAllSemanticId(
                             theDefs.CD_TextStatement.GetSingleKey(), allowedTypes: AdminShell.SubmodelElement.PROP_MLP))
                {
                    tsl.Add("" + smw?.submodelElement?.ValueAsText(defaultLang));
                }


                ItemsControlStatements.ItemsSource = tsl;
            }
        }
Пример #2
0
        public void InitReferable(FormDescSubmodel desc, AdminShell.Submodel source)
        {
            if (desc == null)
            {
                return;
            }

            // create sm here! (different than handling of SME!!)
            this.sm       = new AdminShell.Submodel();
            this.sourceSM = source;

            sm.idShort = desc.PresetIdShort;
            if (source?.idShort != null)
            {
                sm.idShort = source.idShort;
            }
            sm.category = desc.PresetCategory;
            if (desc.PresetDescription != null)
            {
                sm.description = new AdminShell.Description(desc.PresetDescription);
            }
            if (source?.description != null)
            {
                sm.description = new AdminShell.Description(source.description);
            }

            if (desc.KeySemanticId != null)
            {
                sm.semanticId = AdminShell.SemanticId.CreateFromKey(desc.KeySemanticId);
            }
        }
Пример #3
0
        public static void ExportAsTemplate(AdminShell.Submodel sm, string fn)
        {
            // access
            if (fn == null || sm == null || sm.submodelElements == null)
            {
                return;
            }

            // make submodel template
            var templateArr = new List <FormDescSubmodel>();
            var tsm         = new FormDescSubmodel(
                "Submodel",
                sm.semanticId?.GetAsExactlyOneKey(),
                sm.idShort,
                "");

            tsm.SubmodelElements = new FormDescListOfElement();
            templateArr.Add(tsm);

            // ok, export all SubmodelElems
            RecurseExportAsTemplate(sm.submodelElements, tsm.SubmodelElements);

            // write
            var settings = AasxPluginOptionSerialization.GetDefaultJsonSettings(new[] { typeof(FormDescBase) });

            settings.Formatting = Newtonsoft.Json.Formatting.Indented;
            var json = Newtonsoft.Json.JsonConvert.SerializeObject(templateArr, templateArr.GetType(), settings);

            File.WriteAllText(fn, json);
        }
Пример #4
0
            public SetOfDefs(AasxDefinitionBase bs)
            {
                this.SM_TechnicalData = bs.RetrieveReferable <AdminShell.Submodel>("SM_TechnicalData");

                this.CD_GeneralInformation = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_GeneralInformation");
                this.CD_ManufacturerName = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_ManufacturerName");
                this.CD_ManufacturerLogo = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_ManufacturerLogo");
                this.CD_ManufacturerProductDesignation = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_ManufacturerProductDesignation");
                this.CD_ManufacturerPartNumber = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_ManufacturerPartNumber");
                this.CD_ManufacturerOrderCode = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_ManufacturerOrderCode");
                this.CD_ProductImage           = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_ProductImage");
                this.CD_ProductClassifications = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_ProductClassifications");
                this.CD_ProductClassificationItem = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_ProductClassificationItem");
                this.CD_ClassificationSystem = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_ClassificationSystem");
                this.CD_SystemVersion       = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_SystemVersion");
                this.CD_ProductClass        = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_ProductClass");
                this.CD_TechnicalProperties = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_TechnicalProperties");
                this.CD_NonstandardizedProperty = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_NonstandardizedProperty");
                this.CD_MainSection        = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_MainSection");
                this.CD_SubSection         = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_SubSection");
                this.CD_FurtherInformation = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_FurtherInformation");
                this.CD_TextStatement = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_TextStatement");
                this.CD_ValidDate     = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_ValidDate");
            }
        public ImportPopulateByTable(
            LogInstance log,
            ExportTableRecord job,
            AdminShell.Submodel sm,
            AdminShell.AdministrationShellEnv env,
            ExportTableOptions options)
        {
            // context
            _log     = log;
            _job     = job;
            _sm      = sm;
            _env     = env;
            _options = options;

            // prepare Submodel
            if (sm == null || _job.Top == null || _job.Body == null)
            {
                return;
            }
            if (sm.submodelElements == null)
            {
                sm.submodelElements = new AdminShell.SubmodelElementWrapperCollection();
            }

            // prepare matchers
            _matcherTop  = _job.Top.Select((s) => ImportCellMatcherBase.Create(s)).ToList();
            _matcherBody = _job.Body.Select((s) => ImportCellMatcherBase.Create(s)).ToList();
        }
            public SetOfNameplate(AasxDefinitionBase bs)
            {
                this.SM_Nameplate = bs.RetrieveReferable <AdminShell.Submodel>("SM_Nameplate");

                this.CD_ManufacturerName = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_ManufacturerName");
                this.CD_ManufacturerProductDesignation = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_ManufacturerProductDesignation");
                this.CD_PhysicalAddress           = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_PhysicalAddress");
                this.CD_CountryCode               = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_CountryCode");
                this.CD_Street                    = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_Street");
                this.CD_Zip                       = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_Zip");
                this.CD_CityTown                  = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_CityTown");
                this.CD_StateCounty               = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_StateCounty");
                this.CD_ManufacturerProductFamily = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_ManufacturerProductFamily");
                this.CD_SerialNumber           = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_SerialNumber");
                this.CD_BatchNumber            = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_BatchNumber");
                this.CD_ProductCountryOfOrigin = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_ProductCountryOfOrigin");
                this.CD_YearOfConstruction = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_YearOfConstruction");
                this.CD_ProductMarking         = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_ProductMarking");
                this.CD_CEQualificationPresent = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_CEQualificationPresent");
                this.CD_File = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_File");
                this.CD_CRUUSLabelingPresent = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_CRUUSLabelingPresent");
            }
Пример #7
0
        public static void ExportAsGenericFormsOptions(
            AdminShell.AdministrationShellEnv env, AdminShell.Submodel sm, string fn)
        {
            // access
            if (fn == null || env == null || sm == null || sm.submodelElements == null)
            {
                return;
            }

            // make submodel template
            var tsm = new FormDescSubmodel(
                "Submodel",
                sm.semanticId?.GetAsExactlyOneKey(),
                sm.idShort,
                "");

            tsm.SubmodelElements = new FormDescListOfElement();

            // will collect a list of CDs
            var cds = new AdminShell.ListOfConceptDescriptions();

            // ok, export all SubmodelElems into tsm
            RecurseExportAsTemplate(sm.submodelElements, tsm.SubmodelElements, env, cds);

            // fill out record
            var rec = new ExportAsGenericFormsOptions_OptionsRecord();

            rec.FormTag = "TBD";
            var q = sm.qualifiers?.FindType("FormTag");

            if (q != null)
            {
                rec.FormTag = "" + q.value;
            }

            rec.FormTitle = "TBD/" + sm.idShort;
            q             = sm.qualifiers?.FindType("FormTitle");
            if (q != null)
            {
                rec.FormTitle = "" + q.value;
            }

            rec.FormSubmodel        = tsm;
            rec.ConceptDescriptions = cds;

            // fill out overall data
            var overall = new ExportAsGenericFormsOptions_OptionsOverall();

            overall.Records.Add(rec);

            // write
            var settings = AasxPluginOptionSerialization.GetDefaultJsonSettings(new[] { typeof(FormDescBase) });

            settings.Formatting = Newtonsoft.Json.Formatting.Indented;
            var json = Newtonsoft.Json.JsonConvert.SerializeObject(overall, overall.GetType(), settings);

            File.WriteAllText(fn, json);
        }
 public ExportTableAasEntitiesItem(
     int depth, AdminShell.Submodel sm = null, AdminShell.SubmodelElement sme = null,
     AdminShell.ConceptDescription cd  = null)
 {
     this.depth = depth;
     this.sm    = sm;
     this.sme   = sme;
     this.cd    = cd;
 }
            public SetOfIdentification(AasxDefinitionBase bs)
            {
                this.SM_Identification = bs.RetrieveReferable <AdminShell.Submodel>("SM_Identification");

                this.CD_ManufacturerName  = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_ManufacturerName");
                this.CD_GLNOfManufacturer = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_GLNOfManufacturer");
                this.CD_SupplierOfTheIdentifier = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_SupplierOfTheIdentifier");
                this.CD_MAN_PROD_NUM = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_MAN_PROD_NUM");
                this.CD_ManufacturerProductDesignation = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_ManufacturerProductDesignation");
                this.CD_ManufacturerProductDescription = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_ManufacturerProductDescription");
                this.CD_NameOfSupplier     = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_NameOfSupplier");
                this.CD_GLNOfSupplier      = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_GLNOfSupplier");
                this.CD_SupplierIdProvider = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_SupplierIdProvider");
                this.CD_SUP_PROD_NUM = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_SUP_PROD_NUM");
                this.CD_SupplierProductDesignation = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_SupplierProductDesignation");
                this.CD_SupplierProductDescription = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_SupplierProductDescription");
                this.CD_ManufacturerProductFamily = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_ManufacturerProductFamily");
                this.CD_ClassificationSystem = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_ClassificationSystem");
                this.CD_SecondaryKeyTyp      = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_SecondaryKeyTyp");
                this.CD_TypThumbnail         = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_TypThumbnail");
                this.CD_AssetId              = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_AssetId");
                this.CD_SerialNumber         = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_SerialNumber");
                this.CD_BatchNumber          = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_BatchNumber");
                this.CD_SecondaryKeyInstance = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_SecondaryKeyInstance");
                this.CD_DateOfManufacture = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_DateOfManufacture");
                this.CD_DeviceRevision          = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_DeviceRevision");
                this.CD_SoftwareRevision        = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_SoftwareRevision");
                this.CD_HardwareRevision        = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_HardwareRevision");
                this.CD_QrCode                  = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_QrCode");
                this.CD_OrganisationContactInfo = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_OrganisationContactInfo");
                this.CD_ContactInfo_Role = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_ContactInfo_Role");
                this.CD_PhysicalAddress  = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_PhysicalAddress");
                this.CD_CountryCode      = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_CountryCode");
                this.CD_Street           = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_Street");
                this.CD_Zip         = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_Zip");
                this.CD_CityTown    = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_CityTown");
                this.CD_StateCounty = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_StateCounty");
                this.CD_Email       = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_Email");
                this.CD_URL         = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_URL");
                this.CD_PhoneNumber = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_PhoneNumber");
                this.CD_Fax         = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_Fax");
                this.CD_CompanyLogo = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_CompanyLogo");
            }
        private Microsoft.Msagl.Drawing.Graph CreateGraph(
            AdminShellPackageEnv env,
            AdminShell.Submodel sm,
            GenericBomCreatorOptions options)
        {
            // access
            if (env == null || sm == null || options == null)
            {
                return(null);
            }

            //create a graph object
            Microsoft.Msagl.Drawing.Graph graph = new Microsoft.Msagl.Drawing.Graph("BOM-graph");

#if FALSE
            //create the graph content
            graph.AddEdge("A", "B");
            var e1 = graph.AddEdge("B", "C");
            // e1.LabelText = "Dumpf!";
            e1.LabelText = "hbhbjhbjhb";
            // e1.Label = new Microsoft.Msagl.Drawing.Label("Dumpf!!");
            graph.AddEdge("A", "C").Attr.Color = Microsoft.Msagl.Drawing.Color.Green;
            graph.FindNode("A").Attr.FillColor = Microsoft.Msagl.Drawing.Color.Magenta;
            graph.FindNode("B").Attr.FillColor = Microsoft.Msagl.Drawing.Color.MistyRose;
            Microsoft.Msagl.Drawing.Node c = graph.FindNode("C");
            graph.FindNode("B").LabelText = "HalliHallo";
            c.Attr.FillColor = Microsoft.Msagl.Drawing.Color.PaleGreen;
            c.Attr.Shape     = Microsoft.Msagl.Drawing.Shape.Diamond;
            c.Label.FontSize = 28;
#else
            var creator = new GenericBomCreator(
                env?.AasEnv,
                _bomRecords,
                options);

            using (var tw = new StreamWriter("bomgraph.log"))
            {
                creator.RecurseOnLayout(1, graph, null, sm.submodelElements, 1, tw);
                creator.RecurseOnLayout(2, graph, null, sm.submodelElements, 1, tw);
                creator.RecurseOnLayout(3, graph, null, sm.submodelElements, 1, tw);
            }

            // make default or (already) preferred settings
            var settings = GivePresetSettings(options.LayoutIndex);
            if (this.preferredPresetIndex != null && this.preferredPresetIndex.ContainsKey(sm))
            {
                settings = GivePresetSettings(this.preferredPresetIndex[sm]);
            }
            if (settings != null)
            {
                graph.LayoutAlgorithmSettings = settings;
            }
#endif
            return(graph);
        }
Пример #11
0
 public CopyPasteItemSubmodel(
     object parentContainer,
     object entity,
     AdminShell.SubmodelRef smref,
     AdminShell.Submodel sm)
 {
     this.parentContainer = parentContainer;
     this.smref           = smref;
     this.sm = sm;
     TryFixSmRefIfNull();
 }
 public CopyPasteItemSubmodel(
     object parentContainer,
     object entity,
     AdminShell.SubmodelRef smref,
     AdminShell.Submodel sm)
 {
     this.parentContainer = parentContainer;
     this.entity          = entity;
     this.smref           = smref;
     this.sm = sm;
 }
 public void Start(
     AdminShellPackageEnv thePackage,
     AdminShell.Submodel theSubmodel,
     AasxPluginMtpViewer.MtpViewerOptions theOptions,
     PluginEventStack eventStack)
 {
     this.thePackage    = thePackage;
     this.theSubmodel   = theSubmodel;
     this.theOptions    = theOptions;
     this.theEventStack = eventStack;
 }
            public SetOfDocumentation(AasxDefinitionBase bs)
            {
                this.SM_Document = bs.RetrieveReferable <AdminShell.Submodel>("SM_Document");

                this.CD_DocumentationItem = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_DocumentationItem");
                this.CD_DocumentType           = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_DocumentType");
                this.CD_VDI2770_DomainId       = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_VDI2770_DomainId");
                this.CD_VDI2770_IdType         = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_VDI2770_IdType");
                this.CD_DocumentId             = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_DocumentId");
                this.CD_DocumentDomainId       = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_DocumentDomainId");
                this.CD_VDI2770_Role           = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_VDI2770_Role");
                this.CD_VDI2770_OrganisationId = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_OrganisationId");
                this.CD_VDI2770_OrganisationName = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_OrganisationName");
                this.CD_VDI2770_OrganisationOfficialName = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_OrganisationOfficialName");
                this.CD_VDI2770_Description = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_Description");
                this.CD_DocumentPartId = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_DocumentPartId");
                this.CD_DocumentClassification_ClassId = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_DocumentClassification_ClassId");
                this.CD_VDI2770_ClassName = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_ClassName");
                this.CD_VDI2770_ClassificationSystem = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_ClassificationSystem");
                this.CD_DocumentVersionId = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_DocumentVersionId");
                this.CD_DocumentVersion_LanguageCode = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_DocumentVersion_LanguageCode");
                this.CD_VDI2770_Title       = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_VDI2770_Title");
                this.CD_VDI2770_Summary     = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_VDI2770_Summary");
                this.CD_VDI2770_Keywords    = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_VDI2770_Keywords");
                this.CD_VDI2770_StatusValue = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_StatusValue");
                this.CD_VDI2770_SetDate          = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_VDI2770_SetDate");
                this.CD_VDI2770_Purpose          = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_VDI2770_Purpose");
                this.CD_VDI2770_BasedOnProcedure = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_BasedOnProcedure");
                this.CD_VDI2770_Comments = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_VDI2770_Comments");
                this.CD_VDI2770_ReferencedObject_Type = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_ReferencedObject_Type");
                this.CD_VDI2770_ReferencedObject_RefType = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_ReferencedObject_RefType");
                this.CD_VDI2770_ReferencedObject_ObjectId = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_ReferencedObject_ObjectId");
                this.CD_VDI2770_FileId     = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_VDI2770_FileId");
                this.CD_VDI2770_FileName   = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_VDI2770_FileName");
                this.CD_VDI2770_FileFormat = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_FileFormat");
                this.CD_File = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_DigitalFile");
            }
 public void Start(
     LogInstance log,
     AdminShellPackageEnv thePackage,
     AdminShell.Submodel theSubmodel,
     KnownSubmodelsOptions theOptions,
     PluginEventStack eventStack)
 {
     _log        = log;
     _package    = thePackage;
     _submodel   = theSubmodel;
     _options    = theOptions;
     _eventStack = eventStack;
 }
Пример #16
0
        public void Start(
            AdminShellPackageEnv thePackage,
            AdminShell.Submodel theSubmodel,
            AasxPluginMtpViewer.MtpViewerOptions theOptions,
            PluginEventStack eventStack)
        {
            this.thePackage    = thePackage;
            this.theSubmodel   = theSubmodel;
            this.theOptions    = theOptions;
            this.theEventStack = eventStack;

            this.theDefs = new DefinitionsMTP.ModuleTypePackage(new DefinitionsMTP());
        }
Пример #17
0
 public void Start(
     LogInstance log,
     AdminShellPackageEnv thePackage,
     AdminShell.Submodel theSubmodel,
     AasxPluginDocumentShelf.DocumentShelfOptions theOptions,
     PluginEventStack eventStack)
 {
     this.Log           = log;
     this.thePackage    = thePackage;
     this.theSubmodel   = theSubmodel;
     this.theOptions    = theOptions;
     this.theEventStack = eventStack;
 }
Пример #18
0
        private void PublishSingleValues_FirstTimeSubmodel(
            AdminShell.AdministrationShell aas,
            AdminShell.Submodel sm,
            AdminShell.KeyList startPath)
        {
            // trivial
            if (aas == null || sm == null)
            {
                return;
            }

            // give this to (recursive) function
            sm.RecurseOnSubmodelElements(null, (o, parents, sme) =>
            {
                // assumption is, the sme is now "leaf" of a SME-hierarchy
                if (sme is AdminShell.IEnumerateChildren)
                {
                    return(true);
                }

                // value of the leaf
                var valStr = sme.ValueAsText();

                // build a complete path of keys
                var path    = startPath + parents.ToKeyList() + sme?.ToKey();
                var pathStr = path.BuildIdShortPath();

                // publish
                if (_diaData.LogDebug)
                {
                    _logger?.Info("Publish single value (first time)");
                }

                var msg = new MqttApplicationMessageBuilder()
                          .WithTopic(GenerateTopic(
                                         _diaData.SingleValueTopic, defaultIfNull: "SingleValue",
                                         aasIdShort: aas.idShort, aasId: aas.identification,
                                         smIdShort: sm.idShort, smId: sm.identification,
                                         path: pathStr))
                          .WithPayload(valStr)
                          .WithExactlyOnceQoS()
                          .WithRetainFlag(_diaData.MqttRetain)
                          .Build();
                _mqttClient.PublishAsync(msg).GetAwaiter().GetResult();
                LogStatus(incSingleValue: 1);

                // recurse
                return(true);
            });
        }
Пример #19
0
            public void RebuildFromSubmodel(AdminShell.Submodel sm, string lang)
            {
                // clear & access
                this.Clear();
                if (sm == null)
                {
                    return;
                }

                // find all SME with appropriate Qualifer
                var temp = new List <PlotItem>();

                sm.RecurseOnSubmodelElements(this, (state, parents, sme) =>
                {
                    // qualifier
                    var q = sme.HasQualifierOfType("Plotting.Args");
                    if (q == null)
                    {
                        return;
                    }

                    // select for SME type
                    /* TODO (MIHO, 2021-01-04): consider at least to include MLP, as well */
                    if (!(sme is AdminShell.Property))
                    {
                        return;
                    }

                    // build path
                    var path = sme.idShort;
                    if (parents != null)
                    {
                        foreach (var par in parents)
                        {
                            path = "" + par.idShort + " / " + path;
                        }
                    }

                    // add
                    temp.Add(new PlotItem(sme, "" + q.value, path, "" + sme.ValueAsText(), sme.description, lang));
                });

                // sort them for continous grouping
                temp.Sort();
                foreach (var t in temp)
                {
                    this.Add(t);
                }
            }
Пример #20
0
        public void Start(
            AdminShellPackageEnv package,
            AdminShell.Submodel sm,
            PlottingOptions options,
            PluginEventStack eventStack)
        {
            // set the context
            this.thePackage    = package;
            this.theSubmodel   = sm;
            this.theOptions    = options;
            this.theEventStack = eventStack;

            // ok, directly set contents
            SetContents();
        }
        public void Add(
            SignificantAasElement kind,
            AdminShell.Submodel sm,
            AdminShell.ListOfReferable parents,
            AdminShell.SubmodelElement sme)
        {
            var r = new SignificantAasElemRecord()
            {
                Kind      = kind,
                Reference = sm?.GetReference()
                            + parents?.GetReference()
                            + sme?.GetReference(includeParents: false)
            };

            _records.Add(kind, r);
        }
Пример #22
0
 public VisualElementSubmodelRef(VisualElementGeneric parent, TreeViewLineCache cache, AdminShell.AdministrationShellEnv env, AdminShell.SubmodelRef smr, AdminShell.Submodel sm)
     : base()
 {
     this.Parent         = parent;
     this.Cache          = cache;
     this.theEnv         = env;
     this.theSubmodelRef = smr;
     this.theSubmodel    = sm;
     this.Background     = (SolidColorBrush)(new BrushConverter().ConvertFrom("#CBD8EB"));
     this.Border         = (SolidColorBrush)(new BrushConverter().ConvertFrom("#4370B3"));
     this.TagString      = "Sub";
     this.TagBg          = this.Border;
     this.TagFg          = Brushes.White;
     RefreshFromMainData();
     RestoreFromCache();
 }
Пример #23
0
        /// <summary>
        /// Generates a Submodel with default elements based on the description.
        /// Needs to get a unique Identification.
        /// </summary>
        /// <returns></returns>
        public AdminShell.Submodel GenerateDefault()
        {
            var res = new AdminShell.Submodel();

            // is Referable
            this.InitReferable(res);

            // has SemanticId
            if (this.KeySemanticId != null)
            {
                res.semanticId = AdminShell.SemanticId.CreateFromKey(this.KeySemanticId);
            }

            // has elements
            res.submodelElements = this.SubmodelElements.GenerateDefault();

            return(res);
        }
Пример #24
0
        public void Start(
            AdminShellPackageEnv package,
            AdminShell.Submodel sm,
            TechnicalDataOptions options,
            PluginEventStack eventStack)
        {
            // set the context
            this.thePackage    = package;
            this.theSubmodel   = sm;
            this.theOptions    = options;
            this.theEventStack = eventStack;

            // retrieve the Definitions
            this.theDefs = new DefinitionsZveiTechnicalData.SetOfDefs(new DefinitionsZveiTechnicalData());

            // ok, directly set contents
            SetContents();
        }
Пример #25
0
        public string UpdatePropertyValue(
            AdminShell.AdministrationShellEnv env, AdminShell.Submodel submodel, AdminShell.SubmodelElement sme)
        {
            // trivial fails
            if (env == null || sme == null)
            {
                return(null);
            }

            // need AAS, indirect
            var aas = env.FindAASwithSubmodel(submodel.identification);

            if (aas == null)
            {
                return(null);
            }

            // build path
            var aasId      = aas.idShort;
            var submodelId = submodel.idShort;
            var elementId  = sme.CollectIdShortByParent();
            var reqpath    = "./aas/" + aasId + "/submodels/" + submodelId + "/elements/" + elementId + "/property";

            // request
            var request = new RestRequest(reqpath);

            if (this.proxy != null)
            {
                request.Proxy = this.proxy;
            }
            var respose = client.Execute(request);

            if (respose.StatusCode != Grapevine.Shared.HttpStatusCode.Ok)
            {
                throw new Exception(
                          $"REST {respose.ResponseUri} response {respose.StatusCode} with {respose.StatusDescription}");
            }

            var json   = respose.GetContent();
            var parsed = JObject.Parse(json);
            var value  = parsed.SelectToken("value").Value <string>();

            return(value);
        }
        public void InitFromSubmodel(AdminShell.Submodel sm)
        {
            var defsV10 = new AasxPredefinedConcepts.DefinitionsZveiTechnicalData.SetOfDefs(
                new AasxPredefinedConcepts.DefinitionsZveiTechnicalData());

            if (sm.semanticId.MatchesExactlyOneKey(
                    defsV10.SM_TechnicalData.GetSemanticKey(), AdminShellV20.Key.MatchMode.Relaxed))
            {
                InitFromVersion(Version.V1_0);
            }

            var defsV11 = AasxPredefinedConcepts.ZveiTechnicalDataV11.Static;

            if (sm.semanticId.MatchesExactlyOneKey(
                    defsV11.SM_TechnicalData.GetSemanticKey(), AdminShellV20.Key.MatchMode.Relaxed))
            {
                InitFromVersion(Version.V1_1);
            }
        }
Пример #27
0
            public SetOfDefsVDI2770(AasxDefinitionBase bs)
            {
                this.SM_VDI2770_Documentation = bs.RetrieveReferable <AdminShell.Submodel>("SM_VDI2770_Documentation");

                this.CD_VDI2770_Document        = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_VDI2770_Document");
                this.CD_VDI2770_DocumentIdValue = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_DocumentIdValue");
                this.CD_VDI2770_DocumentClassId = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_DocumentClassId");
                this.CD_VDI2770_DocumentClassName = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_DocumentClassName");
                this.CD_VDI2770_DocumentClassificationSystem = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_DocumentClassificationSystem");
                this.CD_VDI2770_OrganizationName = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_OrganizationName");
                this.CD_VDI2770_OrganizationOfficialName = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_OrganizationOfficialName");
                this.CD_VDI2770_DocumentVersion = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_DocumentVersion");
                this.CD_VDI2770_Language = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_VDI2770_Language");
                this.CD_VDI2770_Title    = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_VDI2770_Title");
                this.CD_VDI2770_Date     = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_VDI2770_Date");
                this.CD_VDI2770_DocumentVersionIdValue = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_DocumentVersionIdValue");
                this.CD_VDI2770_DigitalFile = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_DigitalFile");

                /* new, Birgit */
                this.CD_VDI2770_DocumentId = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_DocumentId");
                this.CD_VDI2770_IsPrimaryDocumentId = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_IsPrimaryDocumentId");
                this.CD_VDI2770_DocumentVersionId = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_DocumentVersionId");
                this.CD_VDI2770_Summary     = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_VDI2770_Summary");
                this.CD_VDI2770_Keywords    = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_VDI2770_Keywords");
                this.CD_VDI2770_StatusValue = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_StatusValue");
                this.CD_VDI2770_Role             = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_VDI2770_Role");
                this.CD_VDI2770_DomainId         = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_VDI2770_DomainId");
                this.CD_VDI2770_ReferencedObject = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_ReferencedObject");
            }
        public void Index(AdminShell.Submodel sm)
        {
            // access
            if (sm == null)
            {
                return;
            }

            // make curr ref and index
            var currRef = sm.GetReference();

            dict.Add(ComputeHashOnReference(currRef), sm);

            // recurse
            foreach (var sme in sm.EnumerateChildren())
            {
                RecurseIndexSME(currRef, sme?.submodelElement);
            }
        }
        public VisualElementSubmodelRef(
            VisualElementGeneric parent, TreeViewLineCache cache, AdminShell.AdministrationShellEnv env,
            AdminShell.SubmodelRef smr, AdminShell.Submodel sm)
            : base()
        {
            this.Parent         = parent;
            this.Cache          = cache;
            this.theEnv         = env;
            this.theSubmodelRef = smr;
            this.theSubmodel    = sm;

            this.Background = (SolidColorBrush)System.Windows.Application.Current.Resources["LightAccentColor"];
            this.Border     = (SolidColorBrush)System.Windows.Application.Current.Resources["DarkestAccentColor"];
            this.TagBg      = (SolidColorBrush)System.Windows.Application.Current.Resources["DarkestAccentColor"];
            this.TagFg      = Brushes.White;

            this.TagString = "SM";
            RefreshFromMainData();
            RestoreFromCache();
        }
Пример #30
0
        public static void TakeOverSmToSme(AdminShell.Submodel sm, AdminShell.Submodel sme)
        {
            // access
            if (sme == null || sm == null)
            {
                return;
            }

            // tedious, manual, nor elegant
            if (sm.description != null)
            {
                sme.description = sm.description;
            }

            if (sm.idShort.HasContent())
            {
                sme.idShort = sm.idShort;
            }

            if (sm.category.HasContent())
            {
                sme.category = sm.category;
            }

            if (sm.semanticId != null)
            {
                sme.semanticId = sm.semanticId;
            }

            if (sm.qualifiers != null)
            {
                if (sme.qualifiers == null)
                {
                    sme.qualifiers = new AdminShell.QualifierCollection();
                }
                sme.qualifiers.AddRange(sm.qualifiers);
            }
        }