Skip to content

Glc showcase - #390

Merged
whamm86 merged 16 commits into
mainfrom
glc_showcase
Sep 9, 2026
Merged

Glc showcase#390
whamm86 merged 16 commits into
mainfrom
glc_showcase

Conversation

@whamm86

@whamm86 whamm86 commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Add GLC showcase:

  • Adds /glc page.
  • A simple control cabinet with its aas is displayed.
  • Without using an BOM, but simply displays all AAS known to the server as part of the control cabinet in a list.
  • Also calculates PCF in a naive way.

Important Bugfix in FileService:

  • Correct opening and reading of zip files

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-advanced-security github-advanced-security AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

Comment thread src/AasxServerStandardBib/AasxTaskService.cs Fixed
Comment thread src/AasxServerStandardBib/AasxTaskService.cs Fixed
Comment thread src/AasxServerStandardBib/AasxTaskService.cs Fixed
Comment thread src/AasxServerBlazor/Shared/MainLayout.razor Fixed
Comment thread src/AasxServerBlazor/Shared/MainLayout.razor Fixed
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;
Comment thread src/AasxServerBlazor/Data/GlcLinks.cs Fixed
Comment thread src/AasxServerBlazor/Data/GlcLinks.cs Fixed
{
if (string.IsNullOrEmpty(_input))
{
_input = "anonymous";
whamm86 and others added 2 commits September 9, 2026 12:31
… empty catch block'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@whamm86
whamm86 merged commit 99c463b into main Sep 9, 2026
5 of 6 checks passed
Comment on lines +102 to +105
catch (Exception ex)
{
Console.Error.WriteLine($"GetImageLink failed: {ex}");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants