Modifica modelli x gestiione Img rivisitata

This commit is contained in:
Samuele Locatelli
2026-03-12 05:43:02 +01:00
parent c582cfa122
commit 5a05490212
12 changed files with 84 additions and 29 deletions
+19
View File
@@ -77,6 +77,25 @@
BomAlt
}
/// <summary>
/// Tipologia immagine
/// </summary>
public enum ImageType
{
/// <summary>
/// Non definita (da calcolare...)
/// </summary>
ND = 0,
/// <summary>
/// Calcolata (es JWD, BTL)
/// </summary>
Calculated,
/// <summary>
/// Fissa (tipicamente prodotto da rivendita/servizio)
/// </summary>
Fixed
}
/// <summary>
/// Tipologia item per Source (modalità costruzione)
/// </summary>
@@ -4439,9 +4439,10 @@ namespace EgwCoreLib.Lux.Data.Controllers
if (currRec != null)
{
currRec.FileName = updRec.FileName;
#if false
currRec.FileResource = updRec.FileResource;
currRec.FileSize = updRec.FileSize;
currRec.SerStruct = updRec.SerStruct;
currRec.FileSize = updRec.FileSize;
#endif
dbCtx.Entry(currRec).State = EntityState.Modified;
}
@@ -84,6 +84,11 @@ namespace EgwCoreLib.Lux.Data.DbModel.Items
/// </summary>
public string ItemSteps { get; set; } = "";
/// <summary>
/// Tipo immagine da visualizzare
/// </summary>
public ImageType ImgType { get; set; } = ImageType.ND;
/// <summary>
/// Restituisce UID da impiegare x immagine
/// </summary>
@@ -93,21 +98,23 @@ namespace EgwCoreLib.Lux.Data.DbModel.Items
get => ImgUrl(SellingItemID);
}
#if false
/// <summary>
/// Nomi risorsa file associato alla riga offerta (es per BTL)
/// URI come risorsa dentro folder offerta/riga-offerta/guid
/// </summary>
public string FileResource { get; set; } = "";
/// <summary>
/// Nomi file originale associato alla riga offerta (es per BTL)
/// </summary>
public string FileName { get; set; } = "";
/// <summary>
/// Dimensione del file (per visualizzazione rapida)
/// </summary>
public long FileSize { get; set; } = 0;
public long FileSize { get; set; } = 0;
#endif
/// <summary>
/// Nomi file (fixed) da mostrare e salvare
/// </summary>
public string FileName { get; set; } = "";
/// <summary>
/// Indica protetto = NON consentito edit completo (da definire...)
@@ -63,17 +63,24 @@ namespace EgwCoreLib.Lux.Data.DbModel.Sales
[NotMapped]
public bool CalcEnabled
{
get
{
get => ImgType == ImageType.Calculated;
#if false
{
bool answ = false;
if (SellingItemNav != null)
{
answ = SellingItemNav.SourceType == ItemSourceType.Jwd || SellingItemNav.SourceType == ItemSourceType.FileBTL;
}
return answ;
}
}
#endif
}
/// <summary>
/// Tipo immagine da visualizzare
/// </summary>
public ImageType ImgType { get; set; } = ImageType.ND;
/// <summary>
/// Restituisce UID da impiegare x immagine
/// </summary>
@@ -102,7 +109,6 @@ namespace EgwCoreLib.Lux.Data.DbModel.Sales
//answ = $"SP.{SellingItemID:X12}";
answ = SellingItemModel.ImgUrl(SellingItemID);
}
//if (TemplateRowID > 0 && TemplateRowNav != null)
//{
// answ = TemplateRowNav.ImgUID;
@@ -151,17 +151,24 @@ namespace EgwCoreLib.Lux.Data.DbModel.Sales
[NotMapped]
public bool CalcEnabled
{
get
{
get => ImgType == ImageType.Calculated;
#if false
{
bool answ = false;
if (SellingItemNav != null)
{
answ = SellingItemNav.SourceType == ItemSourceType.Jwd || SellingItemNav.SourceType == ItemSourceType.FileBTL;
}
return answ;
}
}
#endif
}
/// <summary>
/// Tipo immagine da visualizzare
/// </summary>
public ImageType ImgType { get; set; } = ImageType.ND;
/// <summary>
/// Restituisce UID da impiegare x immagine
/// </summary>
@@ -179,14 +186,16 @@ namespace EgwCoreLib.Lux.Data.DbModel.Sales
else
{
// cerco in primis se ha template...
if (TemplateRowID > 0 && TemplateRowNav != null)
if (TemplateRowID != null && TemplateRowID > 0)
{
answ = TemplateRowNav.TemplateRowUID;
//answ= $"TR.{TemplateRowID:X16}";
answ = TemplateRowModel.ImgUrl(TemplateRowID ?? 0);
}
// altrimenti da selling item...
else if (SellingItemID > 0 && SellingItemNav != null)
else if (SellingItemID > 0)
{
answ = $"PROD.{SellingItemID:X12}";
//answ = $"SP.{SellingItemID:X12}";
answ = SellingItemModel.ImgUrl(SellingItemID);
}
}
return answ;
@@ -1,6 +1,7 @@
using EgwCoreLib.Lux.Data.DbModel.Items;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using static EgwCoreLib.Lux.Core.Enums;
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
@@ -60,6 +61,11 @@ namespace EgwCoreLib.Lux.Data.DbModel.Sales
get => ImgUrl(TemplateRowID);
}
/// <summary>
/// Tipo immagine da visualizzare
/// </summary>
public ImageType ImgType { get; set; } = ImageType.ND;
/// <summary>
/// ID dell'articolo di vendita di riferimento
/// </summary>
+1 -1
View File
@@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>1.1.2603.1119</Version>
<Version>1.1.2603.1205</Version>
</PropertyGroup>
<ItemGroup>
@@ -101,17 +101,24 @@ namespace Lux.UI.Components.Compo.Item
{
// calcolo path + nome del file trusted...
string folderPath = FolderPath();
string trustedFileName = Path.GetRandomFileName();
#if false
string trustedFileName = Path.GetRandomFileName();
#endif
// Estensione originale
string extension = Path.GetExtension(file.Name);
string newFileName = $"{CurrRecord.ImgUID}{extension}";
// elimino vecchio file...
FService.DeleteOldFile(folderPath, CurrRecord.FileResource);
FService.DeleteOldFile(folderPath, CurrRecord.FileName);
// salvo nuovo file...
FService.SaveFileContent(folderPath, trustedFileName, rawContent);
FService.SaveFileContent(folderPath, newFileName, rawContent);
// aggiorno dati sul DB...
CurrRecord.FileResource = trustedFileName;
CurrRecord.FileName = file.Name;
CurrRecord.FileSize = rawContent.LongCount();
#if false
CurrRecord.FileResource = newFileName;
CurrRecord.FileSize = rawContent.LongCount();
#endif
await DLService.SellingItemUpdateFileDataAsync(CurrRecord);
}
}
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>aspnet-Lux.UI-a758c101-a2f4-4e38-977d-1c4887dbbd50</UserSecretsId>
<Version>1.1.2603.1119</Version>
<Version>1.1.2603.1205</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>LUX - Web Windows MES</i>
<h4>Versione: 1.1.2603.1119</h4>
<h4>Versione: 1.1.2603.1205</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.1.2603.1119
1.1.2603.1205
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.1.2603.1119</version>
<version>1.1.2603.1205</version>
<url>http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.UI.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html</changelog>
<mandatory>false</mandatory>