Glc showcase - #390
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
|
Contributor
There was a problem hiding this comment.
CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
Comment on lines
+3312
to
+3448
| foreach (var smr in aas.Submodels) | ||
| { | ||
| var sm = env.AasEnv.FindSubmodel(smr); | ||
| if (sm != null && sm.IdShort != null) | ||
| { | ||
| if (sm.IdShort == "tasks") | ||
| continue; | ||
|
|
||
| glcNode.submodels.Add(glcMakeSubmodelNode(sm)); | ||
|
|
||
| if (glcCleanupIdShort(sm.IdShort) == "CarbonFootprint") | ||
| glcNode.pcfCO2eq = glcFindPcfCO2eq(sm); | ||
|
|
||
| if (sm.IdShort.Contains("BillOfMaterial")) | ||
| { | ||
| //if (sm.IdShort.Contains(" - NO ACCESS")) | ||
| //{ | ||
| // Console.WriteLine("NO ACCESS: aas " + aas.IdShort + " sm " + sm.IdShort); | ||
| // cfpValid = false; | ||
| //} | ||
|
|
||
| if (sm.SubmodelElements != null) | ||
| { | ||
| glcNode.bomTimestamp = sm.TimeStampTree; | ||
| List<string> bom = new List<string>(); | ||
| foreach (var v in sm.SubmodelElements) | ||
| { | ||
| string s = ""; | ||
| if (v is Entity e) | ||
| { | ||
| s = e?.GlobalAssetId; | ||
| if (s != "") | ||
| { | ||
| // check if first entity is newer than last cfp creation | ||
| //TODO jtikekar:Whether to use GlobalAssetId or SpecificAssetId | ||
| //s = e?.assetRef?.Keys?[ 0 ].Value; | ||
| s = e?.GlobalAssetId; | ||
| if (s != "") | ||
| { | ||
| bom.Add(s); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // assetBOM.Add(assetId, bom); | ||
| glcNode.bom = bom; | ||
| } | ||
| } | ||
|
|
||
| if (sm.IdShort.Contains("TechnicalData") && sm.SubmodelElements != null) | ||
| { | ||
| foreach (var v in sm.SubmodelElements) | ||
| { | ||
| if (v is SubmodelElementCollection c) | ||
| { | ||
| if (c.IdShort == "GeneralInformation") | ||
| { | ||
| foreach (var sme in c.Value) | ||
| { | ||
| if (sme is AasCore.Aas3_1.File f) | ||
| { | ||
| if (f.IdShort == "ManufacturerLogo" || f.IdShort == "CompanyLogo") | ||
| glcNode.manufacturerLogo = f; | ||
| if (f.IdShort == "ProductImage") | ||
| glcNode.productImage = f; | ||
| } | ||
| if (sme.IdShort == "ProductImages" && sme is SubmodelElementList l) | ||
| { | ||
| if (l.Value != null && l.Value[0] is SubmodelElementCollection cc) | ||
| { | ||
| if (cc.Value?[0].IdShort == "ImageFile" && cc.Value[0] is AasCore.Aas3_1.File ff) | ||
| { | ||
| glcNode.productImage = ff; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| if (sm.IdShort.Contains("Nameplate") && sm.SubmodelElements != null) | ||
| { | ||
| foreach (var v in sm.SubmodelElements) | ||
| { | ||
| if (v is MultiLanguageProperty p) | ||
| { | ||
| if (p.IdShort == "ManufacturerProductDesignation") | ||
| { | ||
| if (p.Value != null) | ||
| { | ||
| string s = null; | ||
| foreach (var ls in p.Value) | ||
| { | ||
| if (ls.Language.ToLower() == "en") | ||
| { | ||
| s = ls.Text; | ||
| break; //english has priority over German | ||
| } | ||
|
|
||
| if (ls.Language.ToLower() == "de") | ||
| { | ||
| if (s != null) | ||
| s = ls.Text; | ||
| } | ||
| } | ||
|
|
||
| if (s != null) | ||
| glcNode.productDesignation = s; | ||
| } | ||
| } | ||
|
|
||
| // ZVEI nameplate 2/0 declares the article number as MLP. | ||
| // GetDefaultString() prefers "en" and falls back to the | ||
| // first entry (Extensions/ExtendLangStringSet.cs:45). | ||
| if (p.IdShort == "ProductArticleNumberOfManufacturer") | ||
| npArticleNumber = p.Value?.GetDefaultString(); | ||
| if (p.IdShort == "ManufacturerProductType") | ||
| npProductType = p.Value?.GetDefaultString(); | ||
| } | ||
| else if (v is Property np) | ||
| { | ||
| // some suppliers model the article number as a plain | ||
| // Property instead of an MLP - accept both | ||
| if (np.IdShort == "ProductArticleNumberOfManufacturer") | ||
| npArticleNumber = np.Value; | ||
|
|
||
| // Property, xs:string, e.g. ".../qr/2900542" | ||
| if (np.IdShort == "URIOfTheProduct") | ||
| npProductUri = np.Value; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
| } | ||
| else if (p is ISubmodelElement) | ||
| { | ||
| idShortPath = (p as ISubmodelElement).IdShort + "." + idShortPath; |
| { | ||
| if (string.IsNullOrEmpty(_input)) | ||
| { | ||
| _input = "anonymous"; |
… empty catch block' Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Comment on lines
+102
to
+105
| catch (Exception ex) | ||
| { | ||
| Console.Error.WriteLine($"GetImageLink failed: {ex}"); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add GLC showcase:
Important Bugfix in FileService: