Merge branch 'release/AddMagManSdk01'
This commit is contained in:
+121
-20
@@ -3,6 +3,8 @@ variables:
|
||||
NEXUS_PATH: 'MagMan'
|
||||
APP_NAME: 'MagMan.UI'
|
||||
SOL_NAME: 'MagMan.UI'
|
||||
NUGET_PATH: 'C:\Tools\nuget.exe'
|
||||
MSBUILD_PATH: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe'
|
||||
|
||||
# helper x fix pacchetti nuget da repo locale nexus.steamware.net
|
||||
.nuget-fix: &nuget-fix
|
||||
@@ -54,15 +56,59 @@ variables:
|
||||
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "Resources\manifest.xml" https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/manifest.xml
|
||||
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "Resources\ChangeLog.html" https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/ChangeLog.html
|
||||
|
||||
|
||||
# mCurl -v -u $env:NEXUS_USER:$env:NEXUS_PASSWD --upload-file bin/release/$env:APP_NAME.zip $env:NEXUS_SERVER/utility/$env:NEXUS_PATH/$version/$env:APP_NAME-$version.zip
|
||||
|
||||
# helper x fix version number
|
||||
.version-fix: &version-fix
|
||||
- |
|
||||
$env:NEW_REL = $env:VERS_MAIN+"."+(get-date -format yyMM)+"."+(get-date -format ddHH)
|
||||
$env:NUM_REL = $env:VERS_MAIN+"."+(get-date -format yyMM)+"."+(get-date -format dHH)
|
||||
$env:NUM_DEB = $env:VERS_MAIN+"."+(get-date -format yyMM)+"-beta."+(get-date -format dHH)
|
||||
$env:NEW_COPYRIGHT = "EgalWare @ 2021-" + (get-date -format yyyy)
|
||||
$contenuto = Get-Content -path 'VersGen\VersGen.cs' -Raw
|
||||
$newContenuto = $contenuto -replace '0.0.0.0', $env:NEW_REL
|
||||
$newContenuto = $newContenuto -replace 'EgalWare © 2021', $env:NEW_COPYRIGHT
|
||||
$newContenuto | Set-Content -Path 'VersGen\VersGen.cs'
|
||||
# display versioni generate
|
||||
$resoconto = "Effettuato fix file VersGen | release v: " + $env:NUM_REL + " | debug v: " + $env:NUM_DEB;
|
||||
Write-Output $resoconto;
|
||||
echo "Replace completati"
|
||||
|
||||
# helper x fix nuspec file
|
||||
.nuspec-fix: &nuspec-fix
|
||||
- |
|
||||
echo "Modifica dati file nuspec Release"
|
||||
$currRelease = $env:NUM_REL
|
||||
$currDebug = $env:NUM_DEB
|
||||
$find = "<version>(.|\n)*?</version>";
|
||||
$fileNameRel = "$env:APP_NAME.Release.nuspec";
|
||||
$replRel = "<version>" + $currRelease + "</version>";
|
||||
$nuspDataRel = Get-Content $fileNameRel;
|
||||
$nuspDataRelUpd = $nuspDataRel -replace $find, $replRel;
|
||||
$nuspDataRelUpd = $nuspDataRelUpd -replace "#copyright#", $replCopy;
|
||||
$nuspDataRelUpd = $nuspDataRelUpd -replace "#releaseNotes#", "Build $adesso";
|
||||
Set-Content -Path $fileNameRel -Value $nuspDataRelUpd;
|
||||
echo "Modifica dati file nuspec Debug"
|
||||
$fileNameDeb = "$env:APP_NAME.Debug.nuspec";
|
||||
$replDeb = "<version>" + $currDebug + "</version>";
|
||||
$nuspDataDeb = Get-Content $fileNameDeb;
|
||||
$nuspDataDebUpd = $nuspDataDeb -replace $find, $replDeb;
|
||||
$nuspDataDebUpd = $nuspDataDebUpd -replace "#copyright#", $replCopy;
|
||||
$nuspDataDebUpd = $nuspDataDebUpd -replace "#releaseNotes#", "Build $adesso";
|
||||
Set-Content -Path $fileNameDeb -Value $nuspDataDebUpd;
|
||||
echo "replace completati"
|
||||
|
||||
|
||||
stages:
|
||||
- build
|
||||
- staging
|
||||
- installer
|
||||
# - release
|
||||
- release
|
||||
|
||||
build:
|
||||
# --------------------------------
|
||||
# BUILD
|
||||
# --------------------------------
|
||||
MagMan.UI:build:
|
||||
stage: build
|
||||
tags:
|
||||
- win
|
||||
@@ -72,6 +118,49 @@ build:
|
||||
script:
|
||||
- echo $CI_COMMIT_BRANCH
|
||||
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
EgwProxy.MagMan:build:
|
||||
stage: build
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
APP_NAME: EgwProxy.MagMan
|
||||
SOL_NAME: EgwProxy.MagMan
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln" -verbosity quiet'
|
||||
script:
|
||||
- echo $CI_COMMIT_BRANCH
|
||||
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
# --------------------------------
|
||||
# STAGING (nuget beta)
|
||||
# --------------------------------
|
||||
EgwProxy.MagMan:staging:
|
||||
stage: staging
|
||||
needs: ["EgwProxy.MagMan:build"]
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
CONFIG: Debug
|
||||
APP_NAME: EgwProxy.MagMan
|
||||
SOL_NAME: EgwProxy.MagMan
|
||||
only:
|
||||
refs:
|
||||
- develop
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- '& "$env:NUGET_PATH" restore "$env:SOL_NAME.sln" -verbosity quiet'
|
||||
- *version-fix
|
||||
- *nuspec-fix
|
||||
script:
|
||||
# - '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=$env:CONFIG /p:Platform="Any CPU" /p:OutputPath=bin/$env:CONFIG /verbosity:minimal /m'
|
||||
- dotnet build "$env:APP_NAME\$env:APP_NAME.csproj"
|
||||
- '& Remove-Item *.nupkg'
|
||||
- '& $env:NUGET_PATH pack "$env:APP_NAME.Debug.nuspec"'
|
||||
- '& "$env:NUGET_PATH" setapikey $NUGET_API_KEY -source http://nexus.steamware.net/repository/nuget-hosted'
|
||||
- '& "$env:NUGET_PATH" push *$env:NUM_DEB.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted'
|
||||
|
||||
|
||||
installer:
|
||||
stage: installer
|
||||
@@ -83,7 +172,7 @@ installer:
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- dotnet restore "$env:SOL_NAME.sln"
|
||||
needs: ["build"]
|
||||
needs: ["MagMan.UI:build"]
|
||||
script:
|
||||
# - dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release MagMan.UI/MagMan.UI.csproj -o:publish
|
||||
# pubblico solo installer Linux x64: https://docs.microsoft.com/en-us/dotnet/core/deploying/
|
||||
@@ -92,19 +181,31 @@ installer:
|
||||
- *hashBuild
|
||||
- *nexusUpload
|
||||
|
||||
# release:
|
||||
# stage: release
|
||||
# tags:
|
||||
# - win
|
||||
# only:
|
||||
# #- feature/Deploy_CI_CD
|
||||
# # - main
|
||||
# - tags
|
||||
# except:
|
||||
# - branches
|
||||
# needs: ["build"]
|
||||
# artifacts:
|
||||
# paths:
|
||||
# - publish/
|
||||
# script:
|
||||
# - dotnet publish -c Release -o ./publish MagMan.UI/MagMan.UI.csproj
|
||||
# --------------------------------
|
||||
# RELEASE
|
||||
# --------------------------------
|
||||
|
||||
EgwProxy.MagMan:release:
|
||||
stage: release
|
||||
needs: ["EgwProxy.MagMan:build"]
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
CONFIG: Release
|
||||
APP_NAME: EgwProxy.MagMan
|
||||
SOL_NAME: EgwProxy.MagMan
|
||||
only:
|
||||
refs:
|
||||
- SDK
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- '& "$env:NUGET_PATH" restore "$env:SOL_NAME.sln" -verbosity quiet'
|
||||
- *version-fix
|
||||
- *nuspec-fix
|
||||
script:
|
||||
- dotnet build "$env:APP_NAME\$env:APP_NAME.csproj"
|
||||
#- '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=$env:CONFIG /p:Platform="Any CPU" /p:OutputPath=bin/$env:CONFIG /verbosity:minimal /m'
|
||||
- '& Remove-Item *.nupkg'
|
||||
- '& $env:NUGET_PATH pack "$env:APP_NAME.Debug.nuspec"'
|
||||
- '& "$env:NUGET_PATH" setapikey $NUGET_API_KEY -source http://nexus.steamware.net/repository/nuget-hosted'
|
||||
- '& "$env:NUGET_PATH" push *$env:NUM_DEB.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted'
|
||||
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>EgwProxy.MagMan</id>
|
||||
<version>#version#</version>
|
||||
<title>EgwProxy.MagMan</title>
|
||||
<authors>Samuele E. Locatelli, EgalWare</authors>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<license type="expression">MIT</license>
|
||||
<description>Libreria per comunicazione REST con server MagMan online/onsite per EgtBW - beta/unstable</description>
|
||||
<releaseNotes>#releaseNotes#</releaseNotes>
|
||||
<copyright>#copyright#</copyright>
|
||||
<tags>EgwProxy.MagMan MagMan Rest</tags>
|
||||
<dependencies>
|
||||
<dependency id="RestSharp" version="110.2.0.0" />
|
||||
<dependency id="Newtonsoft.Json" version="13.0.0.0" />
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="EgwProxy.MagMan\bin\Debug\EgwProxy.MagMan*.dll" target="lib" />
|
||||
<file src="EgwProxy.MagMan\bin\Debug\EgwProxy.MagMan*.config" target="lib" />
|
||||
<file src="EgwProxy.MagMan\bin\Debug\EgwProxy.MagMan*.pdb" target="lib" />
|
||||
</files>
|
||||
</package>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>EgwProxy.MagMan</id>
|
||||
<version>#version#</version>
|
||||
<title>EgwProxy.MagMan</title>
|
||||
<authors>Samuele E. Locatelli, EgalWare</authors>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<license type="expression">MIT</license>
|
||||
<description>Libreria per comunicazione REST con server MagMan online/onsite per EgtBW</description>
|
||||
<releaseNotes>#releaseNotes#</releaseNotes>
|
||||
<copyright>#copyright#</copyright>
|
||||
<tags>EgwProxy.MagMan MagMan Rest</tags>
|
||||
<dependencies>
|
||||
<dependency id="RestSharp" version="110.2.0.0" />
|
||||
<dependency id="Newtonsoft.Json" version="13.0.0.0" />
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="EgwProxy.MagMan\bin\Debug\EgwProxy.MagMan*.dll" target="lib" />
|
||||
<file src="EgwProxy.MagMan\bin\Debug\EgwProxy.MagMan*.config" target="lib" />
|
||||
</files>
|
||||
</package>
|
||||
@@ -0,0 +1,37 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.8.34408.163
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestConsoleApp", "TestConsoleApp\TestConsoleApp.csproj", "{57626C9A-AAE0-4A43-A7E9-610320DD9D31}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EgwProxy.MagMan", "EgwProxy.MagMan\EgwProxy.MagMan.csproj", "{1696D7A5-765A-4D25-8D29-CA7345023479}"
|
||||
EndProject
|
||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "TestWinFormVB", "TestWinFormVB\TestWinFormVB.vbproj", "{665C94F5-27A6-4CD0-9487-036D199CDC47}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{57626C9A-AAE0-4A43-A7E9-610320DD9D31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{57626C9A-AAE0-4A43-A7E9-610320DD9D31}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{57626C9A-AAE0-4A43-A7E9-610320DD9D31}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{57626C9A-AAE0-4A43-A7E9-610320DD9D31}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1696D7A5-765A-4D25-8D29-CA7345023479}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1696D7A5-765A-4D25-8D29-CA7345023479}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1696D7A5-765A-4D25-8D29-CA7345023479}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1696D7A5-765A-4D25-8D29-CA7345023479}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{665C94F5-27A6-4CD0-9487-036D199CDC47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{665C94F5-27A6-4CD0-9487-036D199CDC47}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{665C94F5-27A6-4CD0-9487-036D199CDC47}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{665C94F5-27A6-4CD0-9487-036D199CDC47}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {1A62D7FE-522B-4154-9525-DD9C529BF49B}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EgwProxy.MagMan.DTO
|
||||
{
|
||||
public class ItemDTO
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Codice Univoco (DB)
|
||||
/// </summary>
|
||||
public int ItemID { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// Codice Materiale di provenienza
|
||||
/// </summary>
|
||||
public int MatID { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Check if is a Remnant
|
||||
/// </summary>
|
||||
public bool IsRemn { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Location
|
||||
/// </summary>
|
||||
public string Location { get; set; } = "";
|
||||
/// <summary>
|
||||
/// Qty available on wharehouse
|
||||
/// </summary>
|
||||
public int QtyAvail { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// DateTime last modification
|
||||
/// </summary>
|
||||
public DateTime DtMod { get; set; } = DateTime.Now.AddYears(10);
|
||||
|
||||
/// <summary>
|
||||
/// Item's Lenght
|
||||
/// </summary>
|
||||
public decimal LMm { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Item's Width
|
||||
/// </summary>
|
||||
public decimal WMm { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Item's Thikness
|
||||
/// </summary>
|
||||
public decimal TMm { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// Note
|
||||
/// </summary>
|
||||
public string Note { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Codice QR/Matrix Item
|
||||
/// </summary>
|
||||
public string ItemDtmx { get; set; } = "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EgwProxy.MagMan.DTO
|
||||
{
|
||||
public class MaterialDTO
|
||||
{
|
||||
/// <summary>
|
||||
/// Codice Univoco (DB)
|
||||
/// </summary>
|
||||
public int MatID { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// Codice materiale (esterno)
|
||||
/// </summary>
|
||||
public int MatExtCode { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// Descrizione materiale
|
||||
/// </summary>
|
||||
public string MatDesc { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Lenght/Lunghezza in mm
|
||||
/// </summary>
|
||||
public decimal LMm { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// Width/Larghezza in mm
|
||||
/// </summary>
|
||||
public decimal WMm { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// Thikness/Spessore in mm
|
||||
/// </summary>
|
||||
public decimal TMm { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// Codice QR/Matrix materiale
|
||||
/// </summary>
|
||||
public string MatDtmx { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Elenco item e giancenze
|
||||
/// </summary>
|
||||
public List<ItemDTO> ItemList { get; set; } = new List<ItemDTO>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
using EgwProxy.MagMan.DTO;
|
||||
using Newtonsoft.Json;
|
||||
using RestSharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using RestSharp.Serializers.NewtonsoftJson;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
|
||||
namespace EgwProxy.MagMan
|
||||
{
|
||||
public class DataSyncro
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Inizializza la libreria di comunicazione con il token assegnato
|
||||
/// </summary>
|
||||
/// <param name="UserToken"></param>
|
||||
public DataSyncro(string serverUrl, string UserToken)
|
||||
{
|
||||
RestToken = UserToken;
|
||||
servAddr = serverUrl;
|
||||
apiUrl = $"https://{servAddr}/api/";
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Test ping x indirizzo indicato
|
||||
/// </summary>
|
||||
/// <param name="tgtAddr"></param>
|
||||
/// <returns></returns>
|
||||
public static IPStatus pingAddress(string tgtAddr)
|
||||
{
|
||||
IPStatus answ = IPStatus.Unknown;
|
||||
IPAddress address;
|
||||
PingReply reply;
|
||||
using (Ping pingSender = new Ping())
|
||||
{
|
||||
address = IPAddress.Loopback;
|
||||
int pingMsTimeout = 500;
|
||||
IPAddress.TryParse(tgtAddr, out address);
|
||||
try
|
||||
{
|
||||
// se != null --> uso tgtAddr...
|
||||
if (address != null)
|
||||
{
|
||||
reply = pingSender.Send(address, pingMsTimeout);
|
||||
}
|
||||
else
|
||||
{
|
||||
reply = pingSender.Send(tgtAddr, pingMsTimeout);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
reply = pingSender.Send(IPAddress.Loopback, pingMsTimeout);
|
||||
}
|
||||
answ = reply.Status;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua chiamata test sul server (ping)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool CheckRemote()
|
||||
{
|
||||
IPAddress address = IPAddress.Loopback;
|
||||
string srvIp = servAddr.Substring(0, servAddr.IndexOf(":"));
|
||||
return pingAddress(srvIp) == IPStatus.Success;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Materiali dato RestToken
|
||||
/// </summary>
|
||||
public async Task<List<MaterialDTO>> MaterialsGet()
|
||||
{
|
||||
List<MaterialDTO> answ = new List<MaterialDTO>();
|
||||
// cerco online
|
||||
RestClient client = new RestClient(apiUrl);
|
||||
string MKeyEnc = HttpUtility.UrlEncode(RestToken);
|
||||
var request = new RestRequest($"Materials/{MKeyEnc}", Method.Get);
|
||||
var response = await client.GetAsync(request);
|
||||
// controllo risposta
|
||||
if (response.StatusCode == HttpStatusCode.OK)
|
||||
{
|
||||
// contenuto serializzato
|
||||
string rawData = $"{response.Content}";
|
||||
answ = JsonConvert.DeserializeObject<List<MaterialDTO>>(rawData);
|
||||
}
|
||||
return await Task.FromResult(answ);
|
||||
}
|
||||
/// <summary>
|
||||
/// Invia un elenco (anche parziale) di Materiali, il server farà il merge
|
||||
/// </summary>
|
||||
public async Task<bool> MaterialsSend(List<MaterialDTO> List2Merge)
|
||||
{
|
||||
bool answ = false;
|
||||
// cerco online
|
||||
var client = new RestClient(apiUrl);
|
||||
string MKeyEnc = HttpUtility.UrlEncode(RestToken);
|
||||
var jsonBody = JsonConvert.SerializeObject(List2Merge);
|
||||
var request = new RestRequest($"Materials/upsert/{MKeyEnc}", Method.Post).AddJsonBody(jsonBody);
|
||||
var response = await client.PostAsync(request);
|
||||
// controllo risposta
|
||||
if (response.StatusCode == HttpStatusCode.OK)
|
||||
{
|
||||
// contenuto serializzato
|
||||
string rawData = $"{response.Content}";
|
||||
answ = rawData == "OK";
|
||||
}
|
||||
return await Task.FromResult(answ);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inventario per materiale
|
||||
/// </summary>
|
||||
/// <param name="MatID">Se 0 = tutto</param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<MaterialDTO>> InventoryGet(int MatID)
|
||||
{
|
||||
List<MaterialDTO> answ = new List<MaterialDTO>();
|
||||
// cerco online
|
||||
RestClient client = new RestClient(apiUrl);
|
||||
string MKeyEnc = HttpUtility.UrlEncode(RestToken);
|
||||
var request = new RestRequest($"Inventory/{MKeyEnc}?MatId={MatID}", Method.Get);
|
||||
var response = await client.GetAsync(request);
|
||||
// controllo risposta
|
||||
if (response.StatusCode == HttpStatusCode.OK)
|
||||
{
|
||||
// contenuto serializzato
|
||||
string rawData = $"{response.Content}";
|
||||
answ = JsonConvert.DeserializeObject<List<MaterialDTO>>(rawData);
|
||||
}
|
||||
return await Task.FromResult(answ);
|
||||
}
|
||||
/// <summary>
|
||||
/// Invia un elenco di RawItems associati ad un singolo materiale, il server farà il merge
|
||||
/// </summary>
|
||||
public async Task<bool> InventorySend(MaterialDTO Mat2Merge)
|
||||
{
|
||||
bool answ = false;
|
||||
// cerco online
|
||||
var client = new RestClient(apiUrl);
|
||||
string MKeyEnc = HttpUtility.UrlEncode(RestToken);
|
||||
var jsonBody = JsonConvert.SerializeObject(Mat2Merge.ItemList);
|
||||
var request = new RestRequest($"Inventory/upsert/{MKeyEnc}", Method.Post).AddJsonBody(jsonBody);
|
||||
var response = await client.PostAsync(request);
|
||||
// controllo risposta
|
||||
if (response.StatusCode == HttpStatusCode.OK)
|
||||
{
|
||||
// contenuto serializzato
|
||||
string rawData = $"{response.Content}";
|
||||
answ = rawData == "OK";
|
||||
}
|
||||
return await Task.FromResult(answ);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
/// <summary>
|
||||
/// URL dell'API x chiamate gestione licenze
|
||||
/// </summary>
|
||||
private string apiUrl = $"";
|
||||
|
||||
/// <summary>
|
||||
/// Token di chiamata per l'applicazione
|
||||
/// </summary>
|
||||
private string RestToken = "";
|
||||
|
||||
/// <summary>
|
||||
/// Indirizzo server (URL con eventuale porta)
|
||||
/// </summary>
|
||||
private string servAddr = $"";
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{1696D7A5-765A-4D25-8D29-CA7345023479}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>EgwProxy.MagMan</RootNamespace>
|
||||
<AssemblyName>EgwProxy.MagMan</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.7.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="RestSharp, Version=110.2.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\RestSharp.110.2.0\lib\net471\RestSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Text.Encodings.Web, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Text.Encodings.Web.7.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Text.Json, Version=7.0.0.3, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Text.Json.7.0.3\lib\net462\System.Text.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DataSyncro.cs" />
|
||||
<Compile Include="DTO\ItemDTO.cs" />
|
||||
<Compile Include="DTO\MaterialDTO.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("EgwProxy.MagMan")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("EgwProxy.MagMan")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2024")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("1696d7a5-765a-4d25-8d29-ca7345023479")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="RestSharp" publicKeyToken="598062e77f915f75" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-110.2.1.0" newVersion="110.2.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-7.0.0.3" newVersion="7.0.0.3" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Bcl.AsyncInterfaces" version="7.0.0" targetFramework="net472" />
|
||||
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" />
|
||||
<package id="RestSharp" version="110.2.0" targetFramework="net472" />
|
||||
<package id="System.Buffers" version="4.5.1" targetFramework="net472" />
|
||||
<package id="System.Memory" version="4.5.5" targetFramework="net472" />
|
||||
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net472" />
|
||||
<package id="System.Text.Encodings.Web" version="7.0.0" targetFramework="net472" />
|
||||
<package id="System.Text.Json" version="7.0.3" targetFramework="net472" />
|
||||
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
|
||||
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
|
||||
</packages>
|
||||
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MagMan.Core.DTO
|
||||
{
|
||||
public class ItemDTO
|
||||
{
|
||||
/// <summary>
|
||||
/// Ext ref for Material
|
||||
/// </summary>
|
||||
public int MatId { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Key del RawItem di riferimento (se zero da verificare con quote)
|
||||
/// </summary>
|
||||
public int RawItemId { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Check if is a Remnant
|
||||
/// </summary>
|
||||
public bool IsRemn { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Location
|
||||
/// </summary>
|
||||
public string Location { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Qty available on wharehouse
|
||||
/// </summary>
|
||||
public int QtyAvail { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Item's Lenght
|
||||
/// </summary>
|
||||
public decimal LMm { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Item's Width
|
||||
/// </summary>
|
||||
public decimal WMm { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Item's Thikness
|
||||
/// </summary>
|
||||
public decimal HMm { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Note (optional)
|
||||
/// </summary>
|
||||
public string Note { get; set; } = "";
|
||||
}
|
||||
}
|
||||
@@ -8,27 +8,21 @@ namespace MagMan.Core.DTO
|
||||
{
|
||||
public class MaterialDTO
|
||||
{
|
||||
/// <summary>
|
||||
/// Primary Key Materiale, 0 se proviente da EgtBeamWall
|
||||
/// </summary>
|
||||
public int MatId { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Codice materiale (esterno)
|
||||
/// Codice Materiale
|
||||
/// </summary>
|
||||
public int MatExtCode { get; set; } = 0;
|
||||
public string MatCode { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Descrizione materiale
|
||||
/// </summary>
|
||||
public string MatDesc { get; set; } = "";
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Data approvazione (se non approvato è nel futuro)
|
||||
/// </summary>
|
||||
public DateTime ApprovDate { get; set; } = DateTime.Now.AddYears(100);
|
||||
/// <summary>
|
||||
/// Utente approvazione amteriale
|
||||
/// </summary>
|
||||
public string ApprovUser { get; set; } = "";
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Lenght/Lunghezza in mm
|
||||
/// </summary>
|
||||
@@ -40,6 +34,6 @@ namespace MagMan.Core.DTO
|
||||
/// <summary>
|
||||
/// Thikness/Spessore in mm
|
||||
/// </summary>
|
||||
public decimal TMm { get; set; } = 0;
|
||||
public decimal HMm { get; set; } = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static MagMan.Core.Enums;
|
||||
|
||||
namespace MagMan.Core.DTO
|
||||
{
|
||||
public class ProjectDTO
|
||||
{
|
||||
/// <summary>
|
||||
/// Id macchina (MagMan)
|
||||
/// </summary>
|
||||
public int MachineID { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Key di riferimento per il progetto
|
||||
/// </summary>
|
||||
public int KeyNum { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// ID del DB EgtBW, univoco con KeyNum
|
||||
/// </summary>
|
||||
public int ProjExtDbId { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// ID esterno (da EgtBW)
|
||||
/// </summary>
|
||||
public int ProjExtId { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Nome file BTL originale
|
||||
/// </summary>
|
||||
public string BTLFileName { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Tipologia del progetto (Travi, Pareti, ...)
|
||||
/// </summary>
|
||||
public BWType PType { get; set; } = BWType.NULL;
|
||||
|
||||
/// <summary>
|
||||
/// Macchina (Costruttore/Modello)
|
||||
/// </summary>
|
||||
public string Machine { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Descrizione progetto (copiata da BTLFileName inizialmente)
|
||||
/// </summary>
|
||||
public string ProjDescription { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Data Creazione progetto
|
||||
/// </summary>
|
||||
public DateTime DtCreated { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Data di schedulazione (prevista)
|
||||
/// </summary>
|
||||
public DateTime DtSchedule { get; set; } = DateTime.Today.AddMonths(3);
|
||||
|
||||
/// <summary>
|
||||
/// Data Inizio Produzione
|
||||
/// </summary>
|
||||
public DateTime DtStartProd { get; set; } = DateTime.MinValue;
|
||||
|
||||
/// <summary>
|
||||
/// Data ora ultima operazione registrata
|
||||
/// </summary>
|
||||
public DateTime DtLastAction { get; set; } = DateTime.MinValue;
|
||||
|
||||
/// <summary>
|
||||
/// ListName del BTL
|
||||
/// </summary>
|
||||
public string ListName { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Tempo lavorazione previsto (stima) in minuti
|
||||
/// </summary>
|
||||
public double ProcTimeEst { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Tempo lavorazione reale in minuti (parziale o totale se chiuso/completato/archiviato)
|
||||
/// </summary>
|
||||
public double ProcTimeReal { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Record attivo (se false == cancellazione logica)
|
||||
/// </summary>
|
||||
public bool IsActive { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Stato Archiviato = NON visualizzabile normalmente, già prodotto/chiuso
|
||||
/// </summary>
|
||||
public bool IsArchived { get; set; } = false;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MagMan.Core.DTO
|
||||
{
|
||||
public class ResourceDTO
|
||||
{
|
||||
/// <summary>
|
||||
/// Ext ref for Material
|
||||
/// </summary>
|
||||
public int RawItemId { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// Qty, se > 0 rappresenta un IMPEGNO di qualsiasi tipo, se < 0 è un CONSUMO
|
||||
/// </summary>
|
||||
public int Qty { get; set; } = 0;
|
||||
|
||||
}
|
||||
}
|
||||
+47
-2
@@ -1,7 +1,18 @@
|
||||
namespace MagMan.Core
|
||||
using StackExchange.Redis;
|
||||
|
||||
namespace MagMan.Core
|
||||
{
|
||||
public class Enums
|
||||
{
|
||||
#region Public Enums
|
||||
|
||||
public enum BWType
|
||||
{
|
||||
NULL = 0,
|
||||
BEAM = 1,
|
||||
WALL = 2
|
||||
}
|
||||
|
||||
public enum ItemState
|
||||
{
|
||||
None,
|
||||
@@ -10,5 +21,39 @@
|
||||
|
||||
Request,
|
||||
}
|
||||
|
||||
public enum ProjResState
|
||||
{
|
||||
/// <summary>
|
||||
/// Registrazione consumo effettivo (update giacenza su tab RawItemList)
|
||||
/// </summary>
|
||||
Consumed = -1,
|
||||
/// <summary>
|
||||
/// Non definito
|
||||
/// </summary>
|
||||
ND = 0,
|
||||
/// <summary>
|
||||
/// Consumo stimato da nesting (solo simulazione)
|
||||
/// </summary>
|
||||
Estimated,
|
||||
/// <summary>
|
||||
/// Consumo confermato (da ordinare)
|
||||
/// </summary>
|
||||
Confirmed,
|
||||
/// <summary>
|
||||
/// Riservato (utile x calcolo quantità da ordinare)
|
||||
/// </summary>
|
||||
Reserved
|
||||
}
|
||||
|
||||
public enum ResultTypes
|
||||
{
|
||||
NULL = 0,
|
||||
EXECUTED = 1,
|
||||
RESULT = 2
|
||||
}
|
||||
|
||||
|
||||
#endregion Public Enums
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,9 +7,12 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Blazored.LocalStorage" Version="4.3.0" />
|
||||
<PackageReference Include="Blazored.SessionStorage" Version="2.4.0" />
|
||||
<PackageReference Include="MailKit" Version="4.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0" />
|
||||
<PackageReference Include="NLog" Version="5.2.7" />
|
||||
<PackageReference Include="StackExchange.Redis" Version="2.7.10" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using MagMan.Core.DTO;
|
||||
using static MagMan.Core.Enums;
|
||||
|
||||
namespace MagMan.Core
|
||||
{
|
||||
@@ -16,5 +17,28 @@ namespace MagMan.Core
|
||||
/// </summary>
|
||||
public List<MaterialDTO>? MatList { get; set; }
|
||||
}
|
||||
public class Items
|
||||
{
|
||||
/// <summary>
|
||||
/// Elenco Items x invio POST
|
||||
/// </summary>
|
||||
public List<ItemDTO>? ItemList { get; set; }
|
||||
}
|
||||
|
||||
public class Resources
|
||||
{
|
||||
/// <summary>
|
||||
/// ID progetto univoco esterno (da associare a KEY)
|
||||
/// </summary>
|
||||
public int ProjDbId { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// Tipo di registrazione dato inviata (previsione consumo, consumo effettivo...)
|
||||
/// </summary>
|
||||
public ProjResState ReqState { get; set; } = ProjResState.ND;
|
||||
/// <summary>
|
||||
/// Elenco Risorse x invio POST
|
||||
/// </summary>
|
||||
public List<ResourceDTO>? ResourceList { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,627 @@
|
||||
using Blazored.LocalStorage;
|
||||
using Blazored.SessionStorage;
|
||||
using NLog;
|
||||
using StackExchange.Redis;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace MagMan.Core.Services
|
||||
{
|
||||
public class MessageService
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public MessageService(ILocalStorageService genLocalStorage, ISessionStorageService sessStore, IConnectionMultiplexer RedConn)
|
||||
{
|
||||
// gestione sessioni in browser
|
||||
localStore = genLocalStorage;
|
||||
sessionStore = sessStore;
|
||||
// setup componenti REDIS
|
||||
redisConn = RedConn;
|
||||
redisDb = redisConn.GetDatabase();
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Events
|
||||
|
||||
public event Action EA_FilterUpdated = null!;
|
||||
|
||||
public event Action EA_HideSearch = null!;
|
||||
|
||||
public event Action EA_PageUpdated = null!;
|
||||
|
||||
public event Action EA_SearchUpdated = null!;
|
||||
|
||||
public event Action EA_ShowSearch = null!;
|
||||
|
||||
#endregion Public Events
|
||||
|
||||
#if false
|
||||
public SelectData DetailFilter
|
||||
{
|
||||
get => _detailFilter;
|
||||
set
|
||||
{
|
||||
if (_detailFilter != value)
|
||||
{
|
||||
_detailFilter = value;
|
||||
|
||||
if (EA_FilterUpdated != null)
|
||||
{
|
||||
EA_FilterUpdated?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public SelectOrderData Order_Filter { get; set; } = SelectOrderData.Init(5, 30);
|
||||
#endif
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public string PageIcon
|
||||
{
|
||||
get => _pageIcon;
|
||||
set
|
||||
{
|
||||
if (_pageIcon != value)
|
||||
{
|
||||
_pageIcon = value;
|
||||
ReportPageUpd();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string PageName
|
||||
{
|
||||
get => _pageName;
|
||||
set
|
||||
{
|
||||
if (_pageName != value)
|
||||
{
|
||||
_pageName = value;
|
||||
ReportPageUpd();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string SearchVal
|
||||
{
|
||||
get => _searchVal;
|
||||
set
|
||||
{
|
||||
if (_searchVal != value)
|
||||
{
|
||||
_searchVal = value;
|
||||
|
||||
if (EA_SearchUpdated != null)
|
||||
{
|
||||
EA_SearchUpdated?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string SelOrderCode { get; set; } = "";
|
||||
public string SelPlantId { get; set; } = "0";
|
||||
|
||||
public bool ShowSearch
|
||||
{
|
||||
get => _showSearch;
|
||||
set
|
||||
{
|
||||
if (_showSearch != value)
|
||||
{
|
||||
_showSearch = value;
|
||||
if (_showSearch)
|
||||
{
|
||||
if (EA_ShowSearch != null)
|
||||
{
|
||||
EA_ShowSearch?.Invoke();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (EA_HideSearch != null)
|
||||
{
|
||||
EA_HideSearch?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cliente selezionato (da browser data cache)
|
||||
/// </summary>
|
||||
public async Task<int> ClientIdGet()
|
||||
{
|
||||
var answ = await localStore.GetItemAsync<int>("ClientID");
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Imposta Cliente selezionato (browser data cache)
|
||||
/// </summary>
|
||||
public async Task ClientIdSet(int machSel)
|
||||
{
|
||||
await localStore.SetItemAsync("ClientID", machSel);
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Recupera CustomerID dal dizionario dei token noti o cercando sul DB
|
||||
/// </summary>
|
||||
/// <param name="RestToken"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<int> CustomerIdByToken(string RestToken)
|
||||
{
|
||||
string currKey = $"{Const.rKeyConfig}:Dict:Token2CustID";
|
||||
int answ = await RedisHashGetInt(currKey, RestToken);
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// salvataggio in dizionario Redis associativo Token / Customer
|
||||
/// </summary>
|
||||
/// <param name="RestToken"></param>
|
||||
/// <param name="CustId"></param>
|
||||
/// <returns></returns>
|
||||
public bool CustomerIdByTokenSet(string RestToken, int CustId)
|
||||
{
|
||||
string currKey = $"{Const.rKeyConfig}:Dict:Token2CustID";
|
||||
bool fatto = RedisHashSet(currKey, RestToken, $"{CustId}");
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera CustomerID dal dizionario dei token noti o cercando sul DB
|
||||
/// </summary>
|
||||
/// <param name="CustID"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<int> MainKeyByCustomer(int CustID)
|
||||
{
|
||||
string currKey = $"{Const.rKeyConfig}:Dict:Cust2MKey";
|
||||
int answ = await RedisHashGetInt(currKey, $"{CustID}");
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// salvataggio in dizionario Redis associativo Token / Customer
|
||||
/// </summary>
|
||||
/// <param name="RestToken"></param>
|
||||
/// <param name="CustId"></param>
|
||||
/// <returns></returns>
|
||||
public bool MainKeyByCustomerSet(int CustId, int MainKey)
|
||||
{
|
||||
string currKey = $"{Const.rKeyConfig}:Dict:Cust2MKey";
|
||||
bool fatto = RedisHashSet(currKey, $"{CustId}", $"{MainKey}");
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera MainKey dal dizionario dei token noti o cercando sul DB
|
||||
/// </summary>
|
||||
/// <param name="RestToken"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<int> MainKeyByToken(string RestToken)
|
||||
{
|
||||
string currKey = $"{Const.rKeyConfig}:Dict:Token2MKey";
|
||||
int answ = await RedisHashGetInt(currKey, RestToken);
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// salvataggio in dizionario Redis associativo Token / Customer
|
||||
/// </summary>
|
||||
/// <param name="RestToken"></param>
|
||||
/// <param name="CustId"></param>
|
||||
/// <returns></returns>
|
||||
public bool MainKeyByTokenSet(string RestToken, int CustId)
|
||||
{
|
||||
string currKey = $"{Const.rKeyConfig}:Dict:Token2MKey";
|
||||
bool fatto = RedisHashSet(currKey, RestToken, $"{CustId}");
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get single hash record
|
||||
/// </summary>
|
||||
/// <param name="currKey">Redis Key for Hashlist</param>
|
||||
/// <param name="chiave">Requested key on list</param>
|
||||
/// <returns>Value as Int</returns>
|
||||
public async Task<int> RedisHashGetInt(RedisKey currKey, string chiave)
|
||||
{
|
||||
int result = 0;
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
var hasVal = await redisDb.HashExistsAsync(currKey, chiave);
|
||||
if (hasVal)
|
||||
{
|
||||
var rawRes = await redisDb.HashGetAsync(currKey, chiave);
|
||||
if (rawRes.HasValue)
|
||||
{
|
||||
int.TryParse($"{rawRes}", out result);
|
||||
}
|
||||
}
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Trace($"RedisHashGetInt | {currKey} | in: {ts.TotalMilliseconds} ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get single hash record
|
||||
/// </summary>
|
||||
/// <param name="currKey">Redis Key for Hashlist</param>
|
||||
/// <param name="chiave">Requested key on list</param>
|
||||
/// <returns>Value as string</returns>
|
||||
public async Task<string> RedisHashGetString(RedisKey currKey, string chiave)
|
||||
{
|
||||
string result = "";
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
var hasVal = await redisDb.HashExistsAsync(currKey, chiave);
|
||||
if (hasVal)
|
||||
{
|
||||
var rawRes = await redisDb.HashGetAsync(currKey, chiave);
|
||||
if (rawRes.HasValue)
|
||||
{
|
||||
result = $"{rawRes}";
|
||||
}
|
||||
}
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Trace($"RedisHashGetString | {currKey} | in: {ts.TotalMilliseconds} ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove for single hash record
|
||||
/// </summary>
|
||||
/// <param name="currKey">Chiave redis della Hashlist</param>
|
||||
/// <param name="chiave">Chiave nella HashList</param>
|
||||
/// <returns>Esito rimozione</returns>
|
||||
public async Task<bool> RedisHashRemove(RedisKey currKey, string chiave)
|
||||
{
|
||||
bool fatto = false;
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
fatto = await redisDb.HashDeleteAsync(currKey, chiave);
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Trace($"RedisHashRemove | {currKey} | in: {ts.TotalMilliseconds} ms");
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resetta 1:1 i dizionari Hash in Redis
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool ResetHashDict()
|
||||
{
|
||||
bool fatto = false;
|
||||
string baseKey = $"{Const.rKeyConfig}:Dict";
|
||||
try
|
||||
{
|
||||
// salvo!
|
||||
RedisHashDictSet($"{baseKey}:Token2CustID", new Dictionary<string, string>());
|
||||
RedisHashDictSet($"{baseKey}:Token2MKey", new Dictionary<string, string>());
|
||||
RedisHashDictSet($"{baseKey}:Cust2MKey", new Dictionary<string, string>());
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in ResetHashDict{Environment.NewLine}{exc}");
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Svuota localstorage (clear)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> StoreLocalClear()
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
await localStore.ClearAsync();
|
||||
answ = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error($"Eccezione in StoreLocalClear{Environment.NewLine}{ex}");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce il valore richiesto da localstorage
|
||||
/// </summary>
|
||||
/// <param name="sKey">Chiave</param>
|
||||
/// <returns></returns>
|
||||
public async Task<string> StoreLocalGet(string sKey)
|
||||
{
|
||||
string answ = "";
|
||||
var result = await localStore.GetItemAsync<string>(sKey);
|
||||
if (result != null)
|
||||
{
|
||||
answ = result;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Scrive il valore nel localstorage
|
||||
/// </summary>
|
||||
/// <param name="sKey">Chiave</param>
|
||||
/// <param name="sVal">Valore associato</param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> StoreLocalSet(string sKey, string sVal)
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
await localStore.SetItemAsStringAsync(sKey, sVal);
|
||||
answ = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error($"Eccezione in StoreLocalSet{Environment.NewLine}{ex}");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Svuota sessionstorage (clear)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> StoreSessClear()
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
await sessionStore.ClearAsync();
|
||||
answ = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error($"Eccezione in StoreLocalClear{Environment.NewLine}{ex}");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce il valore richiesto da sessionstorage
|
||||
/// </summary>
|
||||
/// <param name="sKey">Chiave</param>
|
||||
/// <returns></returns>
|
||||
public async Task<string> StoreSessGet(string sKey)
|
||||
{
|
||||
string answ = "";
|
||||
var result = await sessionStore.GetItemAsync<string>(sKey);
|
||||
if (result != null)
|
||||
{
|
||||
answ = result;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Scrive il valore nel sessionstorage (tab)
|
||||
/// </summary>
|
||||
/// <param name="sKey">Chiave</param>
|
||||
/// <param name="sVal">Valore associato</param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> StoreSessSet(string sKey, string sVal)
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
await sessionStore.SetItemAsStringAsync(sKey, sVal);
|
||||
answ = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error($"Eccezione in StoreSessSet{Environment.NewLine}{ex}");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto per connessione a REDIS
|
||||
/// </summary>
|
||||
protected IConnectionMultiplexer redisConn = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto DB redis da impiegare x chiamate R/W
|
||||
/// </summary>
|
||||
protected IDatabase redisDb = null!;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected ILocalStorageService localStore { get; set; } = null!;
|
||||
protected ISessionStorageService sessionStore { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Effettua upsert in HasList redis
|
||||
/// </summary>
|
||||
/// <param name="currKey">Chiave redis della Hashlist</param>
|
||||
/// <param name="chiave">Chiave nella HashList</param>
|
||||
/// <param name="valore">Valore da salvare</param>
|
||||
/// <returns>Num record nella HashList</returns>
|
||||
protected async Task<long> RedisHashUpsert(RedisKey currKey, string chiave, string valore)
|
||||
{
|
||||
long numReq = 0;
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
await redisDb.HashSetAsync(currKey, chiave, valore);
|
||||
numReq = await redisDb.HashLengthAsync(currKey);
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Trace($"RedisHashUpsert | {currKey} | in: {ts.TotalMilliseconds} ms");
|
||||
return numReq;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#if false
|
||||
private SelectData _detailFilter = SelectData.Init(5, 15);
|
||||
#endif
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private string _pageIcon = "";
|
||||
private string _pageName = "";
|
||||
private string _searchVal = "";
|
||||
private bool _showSearch = false;
|
||||
private Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Recupero HashSet redis come Dictionary
|
||||
/// </summary>
|
||||
/// <param name="currKey"></param>
|
||||
/// <param name="dict"></param>
|
||||
private Dictionary<string, string> RedisHashDictGet(RedisKey currKey)
|
||||
{
|
||||
Dictionary<string, string> answ = new Dictionary<string, string>();
|
||||
try
|
||||
{
|
||||
answ = redisDb
|
||||
.HashGetAll(currKey)
|
||||
.ToDictionary(x => $"{x.Name}", x => $"{x.Value}");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Info($"Errore RedisHashDictGet | currKey: {currKey}{Environment.NewLine}{exc}");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Salvataggio Dictionary come HashSet Redis
|
||||
/// </summary>
|
||||
/// <param name="currKey"></param>
|
||||
/// <param name="dict"></param>
|
||||
private bool RedisHashDictSet(RedisKey currKey, Dictionary<string, string> dict)
|
||||
{
|
||||
bool fatto = false;
|
||||
try
|
||||
{
|
||||
HashEntry[] data2ins = new HashEntry[dict.Count];
|
||||
int i = 0;
|
||||
foreach (KeyValuePair<string, string> kvp in dict)
|
||||
{
|
||||
data2ins[i] = new HashEntry(kvp.Key, kvp.Value);
|
||||
i++;
|
||||
}
|
||||
// salvo!
|
||||
redisDb.HashSet(currKey, data2ins);
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in RedisHashDictSet | currKey: {currKey}{Environment.NewLine}{exc}");
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Salvataggio Dictionary come HashSet Redis
|
||||
/// </summary>
|
||||
/// <param name="currKey"></param>
|
||||
/// <param name="dict"></param>
|
||||
/// <param name="ttl"></param>
|
||||
private bool RedisHashDictSet(RedisKey currKey, Dictionary<string, string> dict, TimeSpan ttl)
|
||||
{
|
||||
bool fatto = false;
|
||||
try
|
||||
{
|
||||
HashEntry[] data2ins = new HashEntry[dict.Count];
|
||||
int i = 0;
|
||||
foreach (KeyValuePair<string, string> kvp in dict)
|
||||
{
|
||||
data2ins[i] = new HashEntry(kvp.Key, kvp.Value);
|
||||
i++;
|
||||
}
|
||||
// salvo!
|
||||
redisDb.HashSet(currKey, data2ins);
|
||||
redisDb.KeyExpire(currKey, ttl);
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in RedisHashDictSet(+TTL) | currKey: {currKey} | ttl: {ttl}{Environment.NewLine}{exc}");
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiunta KVP in HashSet Redis
|
||||
/// </summary>
|
||||
/// <param name="currKey"></param>
|
||||
/// <param name="dict"></param>
|
||||
private bool RedisHashSet(RedisKey currKey, string hashField, string value)
|
||||
{
|
||||
bool fatto = false;
|
||||
try
|
||||
{
|
||||
// salvo!
|
||||
redisDb.HashSet(currKey, hashField, value);
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in RedisHashSet | currKey: {currKey}{Environment.NewLine}{exc}");
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
private void ReportPageUpd()
|
||||
{
|
||||
if (EA_PageUpdated != null)
|
||||
{
|
||||
EA_PageUpdated?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
private void ReportSearch()
|
||||
{
|
||||
if (EA_SearchUpdated != null)
|
||||
{
|
||||
EA_SearchUpdated?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Dizionario totale preferenze utente
|
||||
/// </summary>
|
||||
public Dictionary<string, string> UsersPrefDict
|
||||
{
|
||||
get => RedisHashDictGet((RedisKey)$"{redisBaseKey}:{MatrOpr}");
|
||||
set => RedisHashDictSet((RedisKey)$"{redisBaseKey}:{MatrOpr}", value);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Blazored.LocalStorage" Version="4.4.0" />
|
||||
<PackageReference Include="Blazored.LocalStorage" Version="4.3.0" />
|
||||
<PackageReference Include="Blazored.SessionStorage" Version="2.4.0" />
|
||||
<PackageReference Include="MailKit" Version="4.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.25" />
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using MagMan.Core;
|
||||
using MagMan.Core.Services;
|
||||
using MagMan.Data.Admin.Controllers;
|
||||
using MagMan.Data.Admin.DbModels;
|
||||
using Microsoft.AspNetCore.Identity.UI.Services;
|
||||
@@ -14,12 +15,6 @@ namespace MagMan.Data.Admin.Services
|
||||
{
|
||||
public class MTAdminService : BaseServ
|
||||
{
|
||||
#region Public Fields
|
||||
|
||||
public static MTAdminController dbController = null!;
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public MTAdminService(IConfiguration configuration, IConnectionMultiplexer redisConnMult, IEmailSender emailSender)
|
||||
@@ -238,6 +233,34 @@ namespace MagMan.Data.Admin.Services
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera CustomerID dal dizionario dei token noti o cercando sul DB
|
||||
/// </summary>
|
||||
/// <param name="RestToken"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<int> CustomerIdByToken(string RestToken)
|
||||
{
|
||||
int answ = -1;
|
||||
if (TokenCustList.ContainsKey(RestToken))
|
||||
{
|
||||
answ = TokenCustList[RestToken];
|
||||
}
|
||||
else
|
||||
{
|
||||
// cerco nel DB
|
||||
var custList = await CustomerGetAll();
|
||||
var custRow = custList.FirstOrDefault(x => x.RestToken == RestToken);
|
||||
// se trovato salvo
|
||||
if (custRow != null)
|
||||
{
|
||||
answ = custRow.CustomerID;
|
||||
TokenCustList.Add(RestToken, answ);
|
||||
Log.Info($"TokenCustList: added {RestToken} --> {answ}");
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update record customer + refresh cache
|
||||
/// </summary>
|
||||
@@ -395,39 +418,36 @@ namespace MagMan.Data.Admin.Services
|
||||
return fatto;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Recupera CustomerID dal dizionario dei token noti o cercando sul DB
|
||||
/// </summary>
|
||||
/// <param name="RestToken"></param>
|
||||
/// <param name="CustID"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<int> CustomerIdByToken(string RestToken)
|
||||
public async Task<int> MainKeyByCustomer(int CustID)
|
||||
{
|
||||
int answ = -1;
|
||||
if (TokenCustList.ContainsKey(RestToken))
|
||||
if (CustMKeyList.ContainsKey(CustID))
|
||||
{
|
||||
answ = TokenCustList[RestToken];
|
||||
answ = CustMKeyList[CustID];
|
||||
}
|
||||
else
|
||||
{
|
||||
// cerco nel DB
|
||||
var custList = await CustomerGetAll();
|
||||
var custRow = custList.FirstOrDefault(x => x.RestToken == RestToken);
|
||||
var custRow = custList.FirstOrDefault(x => x.CustomerID == CustID);
|
||||
// se trovato salvo
|
||||
if (custRow != null)
|
||||
{
|
||||
answ = custRow.CustomerID;
|
||||
TokenCustList.Add(RestToken, answ);
|
||||
Log.Info($"TokenCustList: added {RestToken} --> {answ}");
|
||||
answ = custRow.MainKey;
|
||||
CustMKeyList.Add(CustID, answ);
|
||||
Log.Info($"TokenMKeyList: added {CustID} --> {answ}");
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera CustomerID dal dizionario dei token noti o cercando sul DB
|
||||
/// Recupera MainKey dal dizionario dei token noti o cercando sul DB
|
||||
/// </summary>
|
||||
/// <param name="RestToken"></param>
|
||||
/// <returns></returns>
|
||||
@@ -454,11 +474,16 @@ namespace MagMan.Data.Admin.Services
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected static MTAdminController dbController = null!;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Private Fields
|
||||
|
||||
|
||||
private static JsonSerializerSettings? JSSettings;
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
@@ -495,18 +520,22 @@ namespace MagMan.Data.Admin.Services
|
||||
#region Private Properties
|
||||
|
||||
/// <summary>
|
||||
/// Dizionario dei token 2 customer
|
||||
/// Dizionario customer 2 MainKey (x calcolo DB)
|
||||
/// </summary>
|
||||
private Dictionary<int, int> CustMKeyList { get; set; } = new Dictionary<int, int>();
|
||||
|
||||
/// <summary>
|
||||
/// Dizionario dei token 2 customer
|
||||
/// </summary>
|
||||
private Dictionary<string, int> TokenCustList { get; set; } = new Dictionary<string, int>();
|
||||
|
||||
/// <summary>
|
||||
/// Dizionario dei token 2 MainKey (x calcolo DB)
|
||||
/// Dizionario dei token 2 MainKey (x calcolo DB)
|
||||
/// </summary>
|
||||
private Dictionary<string, int> TokenMKeyList { get; set; } = new Dictionary<string, int>();
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using MagMan.Data.Tenant.DbModels;
|
||||
using MagMan.Data.Tenant.Services;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using NLog;
|
||||
@@ -45,7 +46,7 @@ namespace MagMan.Data.Tenant.Controllers
|
||||
/// <param name="connString">Stringa connessione (variabile x cliente)</param>
|
||||
/// <param name="rec2del">Item da eliminare</param>
|
||||
/// <returns></returns>
|
||||
public bool ItemDelete(string connString, ItemModel rec2del)
|
||||
public bool ItemDelete(string connString, RawItemModel rec2del)
|
||||
{
|
||||
bool done = false;
|
||||
using (MagManContext dbCtx = new MagManContext(connString))
|
||||
@@ -54,7 +55,7 @@ namespace MagMan.Data.Tenant.Controllers
|
||||
{
|
||||
var currData = dbCtx
|
||||
.DbSetItems
|
||||
.Where(x => x.ItemID == rec2del.ItemID)
|
||||
.Where(x => x.RawItemId == rec2del.RawItemId)
|
||||
.FirstOrDefault();
|
||||
if (currData != null)
|
||||
{
|
||||
@@ -78,16 +79,16 @@ namespace MagMan.Data.Tenant.Controllers
|
||||
/// </summary>
|
||||
/// <param name="connString">Stringa connessione (variabile x cliente)</param>
|
||||
/// <returns></returns>
|
||||
public List<ItemModel> ItemGetAll(string connString)
|
||||
public List<RawItemModel> ItemGetAll(string connString)
|
||||
{
|
||||
List<ItemModel> dbResult = new List<ItemModel>();
|
||||
List<RawItemModel> dbResult = new List<RawItemModel>();
|
||||
using (MagManContext dbCtx = new MagManContext(connString))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetItems
|
||||
//.Where(x => CustomerId == 0 || x.CustomerID == CustomerId)
|
||||
.Include(c => c.MaterialNav)
|
||||
.OrderBy(x => x.MatID)
|
||||
.OrderBy(x => x.MatId)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
@@ -99,52 +100,95 @@ namespace MagMan.Data.Tenant.Controllers
|
||||
/// <param name="connString">Stringa connessione (variabile x cliente)</param>
|
||||
/// <param name="matID">ID del materiale x cui filtrare, 0 = tutti</param>
|
||||
/// <returns></returns>
|
||||
public List<ItemModel> ItemGetByMat(string connString, int matID)
|
||||
public List<RawItemModel> ItemGetByMat(string connString, int matID)
|
||||
{
|
||||
List<ItemModel> dbResult = new List<ItemModel>();
|
||||
List<RawItemModel> dbResult = new List<RawItemModel>();
|
||||
using (MagManContext dbCtx = new MagManContext(connString))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetItems
|
||||
.Where(x => matID == 0 || x.MatID == matID)
|
||||
.Where(x => matID == 0 || x.MatId == matID)
|
||||
.Include(c => c.MaterialNav)
|
||||
//.OrderBy(x => x.MatID)
|
||||
//.OrderBy(x => x.MatId)
|
||||
.OrderBy(x => x.WMm)
|
||||
.ThenBy(x => x.TMm)
|
||||
.ThenBy(x => x.HMm)
|
||||
.ThenBy(x => x.LMm)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary> Aggiunge/Modifica un item in magazzino </summary> <param
|
||||
/// name="connString">Stringa connessione (variabile x cliente)</param> <param
|
||||
/// name="rec2upd">Record da aggiornare</param> <param name="deltaQty">quantità da
|
||||
/// aggiornare (se <0 è consumo)</param> <returns></returns>
|
||||
public bool ItemModQty(string connString, RawItemModel rec2upd, int deltaQty)
|
||||
{
|
||||
bool done = false;
|
||||
using (MagManContext dbCtx = new MagManContext(connString))
|
||||
{
|
||||
try
|
||||
{
|
||||
/*
|
||||
* Verifica se esistesse: deve essere valido TUTTO
|
||||
* - stesso materiale
|
||||
* - stesse dimensioni
|
||||
* */
|
||||
var currData = dbCtx
|
||||
.DbSetItems
|
||||
.Where(x => (x.RawItemId == rec2upd.RawItemId) ||
|
||||
(x.MatId == rec2upd.MatId && (x.WMm == rec2upd.WMm && x.HMm == rec2upd.HMm && x.LMm == rec2upd.LMm)))
|
||||
.FirstOrDefault();
|
||||
if (currData != null)
|
||||
{
|
||||
currData.QtyAvail += deltaQty;
|
||||
dbCtx.Entry(currData).State = EntityState.Modified;
|
||||
}
|
||||
dbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in ItemModQty{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiunge/Modifica un item in magazzino
|
||||
/// </summary>
|
||||
/// <param name="connString">Stringa connessione (variabile x cliente)</param>
|
||||
/// <param name="rec2upd">Record da aggiungere/aggiornare</param>
|
||||
/// <returns></returns>
|
||||
public bool ItemUpdate(string connString, ItemModel rec2upd)
|
||||
public bool ItemUpdate(string connString, RawItemModel rec2upd)
|
||||
{
|
||||
bool done = false;
|
||||
using (MagManContext dbCtx = new MagManContext(connString))
|
||||
{
|
||||
try
|
||||
{
|
||||
/*
|
||||
* Verifica se esistesse: deve essere valido TUTTO
|
||||
* - stesso materiale
|
||||
* - stesse dimensioni
|
||||
* */
|
||||
var currData = dbCtx
|
||||
.DbSetItems
|
||||
.Where(x => x.ItemID == rec2upd.ItemID)
|
||||
.Where(x => (x.RawItemId == rec2upd.RawItemId) ||
|
||||
(x.MatId == rec2upd.MatId && (x.WMm == rec2upd.WMm && x.HMm == rec2upd.HMm && x.LMm == rec2upd.LMm)))
|
||||
.FirstOrDefault();
|
||||
if (currData != null)
|
||||
{
|
||||
currData.MatID = rec2upd.MatID;
|
||||
currData.MatId = rec2upd.MatId;
|
||||
currData.QtyAvail = rec2upd.QtyAvail;
|
||||
currData.IsActive = rec2upd.IsActive;
|
||||
currData.IsRemn = rec2upd.IsRemn;
|
||||
currData.Location = rec2upd.Location;
|
||||
currData.QtyAvail = rec2upd.QtyAvail;
|
||||
currData.Note = rec2upd.Note;
|
||||
currData.LMm = rec2upd.LMm;
|
||||
currData.TMm = rec2upd.TMm;
|
||||
currData.HMm = rec2upd.HMm;
|
||||
currData.WMm = rec2upd.WMm;
|
||||
currData.DtMod = rec2upd.DtMod;
|
||||
currData.Note = rec2upd.Note;
|
||||
dbCtx.Entry(currData).State = EntityState.Modified;
|
||||
}
|
||||
else
|
||||
@@ -179,7 +223,7 @@ namespace MagMan.Data.Tenant.Controllers
|
||||
{
|
||||
var currData = dbCtx
|
||||
.DbSetMaterials
|
||||
.Where(x => x.MatID == rec2del.MatID)
|
||||
.Where(x => x.MatId == rec2del.MatId)
|
||||
.FirstOrDefault();
|
||||
if (currData != null)
|
||||
{
|
||||
@@ -203,18 +247,68 @@ namespace MagMan.Data.Tenant.Controllers
|
||||
/// </summary>
|
||||
/// <param name="connString">Stringa connessione (variabile x cliente)</param>
|
||||
/// <returns></returns>
|
||||
public List<MaterialModel> MaterialGetAll(string connString)
|
||||
public List<MaterialModel> MaterialGetAll(string connString, bool withChild)
|
||||
{
|
||||
List<MaterialModel> dbResult = new List<MaterialModel>();
|
||||
using (MagManContext dbCtx = new MagManContext(connString))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetMaterials
|
||||
.OrderBy(x => x.MatDesc)
|
||||
.ThenBy(x => x.WMm)
|
||||
.ThenBy(x => x.TMm)
|
||||
.ThenBy(x => x.LMm)
|
||||
.ToList();
|
||||
if (withChild)
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetMaterials
|
||||
.Include(x => x.RawItemList)
|
||||
.OrderBy(x => x.MatDesc)
|
||||
.ThenBy(x => x.WMm)
|
||||
.ThenBy(x => x.HMm)
|
||||
.ThenBy(x => x.LMm)
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetMaterials
|
||||
.OrderBy(x => x.MatDesc)
|
||||
.ThenBy(x => x.WMm)
|
||||
.ThenBy(x => x.HMm)
|
||||
.ThenBy(x => x.LMm)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
return dbResult;
|
||||
} /// <summary>
|
||||
|
||||
/// Elenco Materiali gestiti a magazzino </summary> <param name="connString">Stringa
|
||||
/// connessione (variabile x cliente)</param> <param name="numKey">Materiale richiesto, 0
|
||||
/// = tutti</param> <param name="withChild">Se true allora include record child
|
||||
/// (Items)</param> <returns></returns>
|
||||
public List<MaterialModel> MaterialGetFilt(string connString, int matID, bool withChild)
|
||||
{
|
||||
List<MaterialModel> dbResult = new List<MaterialModel>();
|
||||
using (MagManContext dbCtx = new MagManContext(connString))
|
||||
{
|
||||
if (withChild)
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetMaterials
|
||||
.Where(x => matID == 0 || x.MatId == matID)
|
||||
.Include(x => x.RawItemList)
|
||||
.OrderBy(x => x.MatDesc)
|
||||
.ThenBy(x => x.WMm)
|
||||
.ThenBy(x => x.HMm)
|
||||
.ThenBy(x => x.LMm)
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetMaterials
|
||||
.Where(x => matID == 0 || x.MatId == matID)
|
||||
.OrderBy(x => x.MatDesc)
|
||||
.ThenBy(x => x.WMm)
|
||||
.ThenBy(x => x.HMm)
|
||||
.ThenBy(x => x.LMm)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
@@ -232,18 +326,24 @@ namespace MagMan.Data.Tenant.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
/*
|
||||
* Ricerca equal: corrisponde se
|
||||
* - MatId identico
|
||||
* - se Uguali + NonNulli [MatCode oppure MatDescript] + uguali [W/H/L]...
|
||||
*/
|
||||
var currData = dbCtx
|
||||
.DbSetMaterials
|
||||
.Where(x => x.MatID == rec2upd.MatID || x.MatExtCode==rec2upd.MatExtCode)
|
||||
.Where(x => (rec2upd.MatId > 0 && x.MatId == rec2upd.MatId) ||
|
||||
((x.WMm == rec2upd.WMm && x.HMm == rec2upd.HMm && x.LMm == rec2upd.LMm) &&
|
||||
((!string.IsNullOrEmpty(rec2upd.MatCode) && x.MatCode == rec2upd.MatCode) || (!string.IsNullOrEmpty(rec2upd.MatDesc) && x.MatDesc == rec2upd.MatDesc))
|
||||
))
|
||||
.FirstOrDefault();
|
||||
if (currData != null)
|
||||
{
|
||||
currData.MatExtCode = rec2upd.MatExtCode;
|
||||
currData.MatCode = rec2upd.MatCode;
|
||||
currData.MatDesc = rec2upd.MatDesc;
|
||||
currData.ApprovDate = rec2upd.ApprovDate;
|
||||
currData.ApprovUser = rec2upd.ApprovUser;
|
||||
currData.LMm = rec2upd.LMm;
|
||||
currData.TMm = rec2upd.TMm;
|
||||
currData.HMm = rec2upd.HMm;
|
||||
currData.WMm = rec2upd.WMm;
|
||||
dbCtx.Entry(currData).State = EntityState.Modified;
|
||||
}
|
||||
@@ -264,6 +364,165 @@ namespace MagMan.Data.Tenant.Controllers
|
||||
return done;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elimina record Project
|
||||
/// </summary>
|
||||
/// <param name="connString">Stringa connessione (variabile x cliente)</param>
|
||||
/// <param name="rec2del">Item da eliminare</param>
|
||||
/// <returns></returns>
|
||||
public bool ProjectDelete(string connString, ProjModel rec2del)
|
||||
{
|
||||
bool done = false;
|
||||
using (MagManContext dbCtx = new MagManContext(connString))
|
||||
{
|
||||
try
|
||||
{
|
||||
var currData = dbCtx
|
||||
.DbSetProjects
|
||||
.Where(x => x.ProjDbId == rec2del.ProjDbId)
|
||||
.FirstOrDefault();
|
||||
if (currData != null)
|
||||
{
|
||||
dbCtx
|
||||
.DbSetProjects
|
||||
.Remove(currData);
|
||||
dbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in ProjectDelete{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Projects (all)
|
||||
/// </summary>
|
||||
/// <param name="connString">Stringa connessione (variabile x cliente)</param>
|
||||
/// <returns></returns>
|
||||
public List<ProjModel> ProjectGetAll(string connString)
|
||||
{
|
||||
List<ProjModel> dbResult = new List<ProjModel>();
|
||||
using (MagManContext dbCtx = new MagManContext(connString))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetProjects
|
||||
.OrderBy(x => x.DtCreated)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Items gestiti a magazzino dato Materiale
|
||||
/// </summary>
|
||||
/// <param name="connString">Stringa connessione (variabile x cliente)</param>
|
||||
/// <param name="numKey">ID del materiale x cui filtrare, 0 = tutti</param>
|
||||
/// <returns></returns>
|
||||
public List<ProjModel> ProjectGetByNumKey(string connString, int numKey)
|
||||
{
|
||||
List<ProjModel> dbResult = new List<ProjModel>();
|
||||
using (MagManContext dbCtx = new MagManContext(connString))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetProjects
|
||||
.Where(x => numKey == 0 || x.KeyNum == numKey)
|
||||
.OrderBy(x => x.DtCreated)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Items gestiti a magazzino dato Materiale
|
||||
/// </summary>
|
||||
/// <param name="connString">Stringa connessione (variabile x cliente)</param>
|
||||
/// <param name="numKey">ID master key, 0 = tutti</param>
|
||||
/// <param name="numKey">periodo x filtraggio</param>
|
||||
/// <returns></returns>
|
||||
public List<ProjModel> ProjectGetFilt(string connString, int numKey, SelectData period)
|
||||
{
|
||||
List<ProjModel> dbResult = new List<ProjModel>();
|
||||
using (MagManContext dbCtx = new MagManContext(connString))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetProjects
|
||||
.Where(x => (numKey == 0 || x.KeyNum == numKey) &&
|
||||
((x.DtCreated >= period.DateStart && x.DtCreated <= period.DateEnd)
|
||||
|| (x.DtSchedule >= period.DateStart && x.DtSchedule <= period.DateEnd)
|
||||
|| (x.DtLastAction >= period.DateStart && x.DtLastAction <= period.DateEnd)
|
||||
))
|
||||
.OrderBy(x => x.DtCreated)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiunge/Modifica un record Project
|
||||
/// </summary>
|
||||
/// <param name="connString">Stringa connessione (variabile x cliente)</param>
|
||||
/// <param name="rec2upd">Record da aggiungere/aggiornare</param>
|
||||
/// <returns></returns>
|
||||
public bool ProjectUpdate(string connString, ProjModel rec2upd)
|
||||
{
|
||||
bool done = false;
|
||||
using (MagManContext dbCtx = new MagManContext(connString))
|
||||
{
|
||||
try
|
||||
{
|
||||
/*
|
||||
* Ricerca:
|
||||
* - DbId corrisponde
|
||||
* - Key + Id remoti corrispondono
|
||||
* */
|
||||
var currData = dbCtx
|
||||
.DbSetProjects
|
||||
.Where(x => (x.ProjDbId == rec2upd.ProjDbId) ||
|
||||
(x.ProjExtDbId == rec2upd.ProjExtDbId && x.KeyNum == rec2upd.KeyNum) ||
|
||||
(x.ProjExtId == rec2upd.ProjExtId && x.KeyNum == rec2upd.KeyNum))
|
||||
.FirstOrDefault();
|
||||
if (currData != null)
|
||||
{
|
||||
currData.MachineID = rec2upd.MachineID;
|
||||
currData.KeyNum = rec2upd.KeyNum;
|
||||
currData.ProjExtDbId = rec2upd.ProjExtDbId;
|
||||
currData.ProjExtId = rec2upd.ProjExtId;
|
||||
currData.BTLFileName = rec2upd.BTLFileName;
|
||||
currData.PType = rec2upd.PType;
|
||||
currData.Machine = rec2upd.Machine;
|
||||
currData.ProjDescription = rec2upd.ProjDescription;
|
||||
currData.DtCreated = rec2upd.DtCreated;
|
||||
currData.DtLastAction = rec2upd.DtLastAction;
|
||||
currData.DtSchedule = rec2upd.DtSchedule;
|
||||
currData.DtStartProd = rec2upd.DtStartProd;
|
||||
currData.ListName = rec2upd.ListName;
|
||||
currData.ProcTimeEst = rec2upd.ProcTimeEst;
|
||||
currData.ProcTimeReal = rec2upd.ProcTimeReal;
|
||||
currData.IsActive = rec2upd.IsActive;
|
||||
currData.IsArchived = rec2upd.IsArchived;
|
||||
dbCtx.Entry(currData).State = EntityState.Modified;
|
||||
}
|
||||
else
|
||||
{
|
||||
dbCtx
|
||||
.DbSetProjects
|
||||
.Add(rec2upd);
|
||||
}
|
||||
dbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in ItemUpdate{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MagMan.Data.Tenant.DbModels
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
[Table("AliasList")]
|
||||
public class AliasModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Famiglia di sinonimi
|
||||
/// </summary>
|
||||
public string Family { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Codice originale (da trasformare)
|
||||
/// </summary>
|
||||
public string ValueOriginal { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Codice Alias in cui viene convertito
|
||||
/// </summary>
|
||||
public string ValueAlias { get; set; } = "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using static MagMan.Core.Enums;
|
||||
|
||||
namespace MagMan.Data.Tenant.DbModels
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
/// <summary>
|
||||
/// Tabella dei LOG Macchina (per macchina)
|
||||
/// </summary>
|
||||
[Table("LogMachine")]
|
||||
[Index(nameof(MachineID))]
|
||||
[Index(nameof(KeyNum))]
|
||||
public class LogMachineModel
|
||||
{
|
||||
[Key, Column("DbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int LogDbId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Id macchina (diMagMan)
|
||||
/// </summary>
|
||||
public int MachineID { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Key di riferimento per il progetto
|
||||
/// </summary>
|
||||
public int KeyNum { get; set; } = 0;
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Codice Allarme
|
||||
/// </summary>
|
||||
[Column("AlarmCode")]
|
||||
public string AlarmCode { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Data Evento
|
||||
/// </summary>
|
||||
[Column("AlarmDtEvent")]
|
||||
public DateTime AlarmDatetime { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Messaggio Allarme
|
||||
/// </summary>
|
||||
[Column("AlarmMessage")]
|
||||
public string AlarmMessage { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Alarm Operation
|
||||
/// </summary>
|
||||
[Column("AlarmOperation")]
|
||||
public int AlarmOperation { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Alarm Type
|
||||
/// </summary>
|
||||
[Column("AlarmType")]
|
||||
public int AlarmType { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Esaecuzione comando corretta
|
||||
/// </summary>
|
||||
[Column("CommExecuted")]
|
||||
public bool CommandExecutedCorrectly { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Stato da enum Core
|
||||
/// </summary>
|
||||
[Column("CommandState")]
|
||||
public Core.ConstMachComm.CommandStates CommandState { get; set; } = Core.ConstMachComm.CommandStates.NULL;
|
||||
|
||||
/// <summary>
|
||||
/// Tipo Comando da enum Core
|
||||
/// </summary>
|
||||
[Column("CommandType")]
|
||||
public Core.ConstMachComm.LogCommandTypes CommandType { get; set; } = Core.ConstMachComm.LogCommandTypes.NULL;
|
||||
|
||||
/// <summary>
|
||||
/// Descrizione
|
||||
/// </summary>
|
||||
[Column("Description")]
|
||||
public string Description { get; set; } = "";
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// New OP State
|
||||
/// </summary>
|
||||
[Column("NewOpState")]
|
||||
public int NewOpState { get; set; } = 0;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Stato da enum Core
|
||||
/// </summary>
|
||||
[Column("ResultType")]
|
||||
public ResultTypes ResultType { get; set; } = ResultTypes.NULL;
|
||||
|
||||
/// <summary>
|
||||
/// Indirizzo VAR
|
||||
/// </summary>
|
||||
[Column("VarAddress")]
|
||||
public string VarAddress { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Valore VAR
|
||||
/// </summary>
|
||||
[Column("VarValue")]
|
||||
public string VarValue { get; set; } = "";
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -11,30 +11,33 @@ namespace MagMan.Data.Tenant.DbModels
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
[Table("Materials")]
|
||||
[Table("MaterialsList")]
|
||||
public partial class MaterialModel
|
||||
{
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int MatID { get; set; }
|
||||
/// <summary>
|
||||
/// Init classe
|
||||
/// </summary>
|
||||
public MaterialModel()
|
||||
{
|
||||
RawItemList = new HashSet<RawItemModel>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Codice materiale (esterno)
|
||||
/// Primary Key AUTO
|
||||
/// </summary>
|
||||
public int MatExtCode { get; set; } = 0;
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int MatId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Codice Materiale
|
||||
/// </summary>
|
||||
public string MatCode { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Descrizione materiale
|
||||
/// </summary>
|
||||
public string MatDesc { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Data approvazione (se non approvato è nel futuro)
|
||||
/// </summary>
|
||||
public DateTime ApprovDate { get; set; } = DateTime.Now.AddYears(100);
|
||||
/// <summary>
|
||||
/// Utente approvazione amteriale
|
||||
/// </summary>
|
||||
public string ApprovUser { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Lenght/Lunghezza in mm
|
||||
/// </summary>
|
||||
@@ -44,10 +47,11 @@ namespace MagMan.Data.Tenant.DbModels
|
||||
/// </summary>
|
||||
public decimal WMm { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// Thikness/Spessore in mm
|
||||
/// Height (Thikness/Spessore) in mm
|
||||
/// </summary>
|
||||
public decimal TMm { get; set; } = 0;
|
||||
public decimal HMm { get; set; } = 0;
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Lenght/Lunghezza in inch
|
||||
/// </summary>
|
||||
@@ -68,10 +72,11 @@ namespace MagMan.Data.Tenant.DbModels
|
||||
/// Thikness/Spessore in inch
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public decimal TIn
|
||||
public decimal HIn
|
||||
{
|
||||
get => Math.Round(TMm / (decimal)25.4, 3);
|
||||
}
|
||||
get => Math.Round(HMm / (decimal)25.4, 3);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Codice materiale x QR/Datamatrix
|
||||
@@ -79,10 +84,30 @@ namespace MagMan.Data.Tenant.DbModels
|
||||
[NotMapped]
|
||||
public string MatDtmx
|
||||
{
|
||||
get => $"MT{MatExtCode:00000000}";
|
||||
get => $"MT{MatId:00000000}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica che sia Beam, quando L == 0
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public bool IsBeam
|
||||
{
|
||||
get => (LMm == 0 && (HMm > 0 && WMm > 0));
|
||||
}
|
||||
|
||||
public virtual ICollection<ItemModel>? ItemNav { get; set; }
|
||||
/// <summary>
|
||||
/// Verifica che sia Wall, quando W/L == 0
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public bool IsWall
|
||||
{
|
||||
get => (HMm > 0 && (LMm == 0 && WMm == 0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Navigazione ad oggetti child
|
||||
/// </summary>
|
||||
public virtual ICollection<RawItemModel>? RawItemList { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,8 +44,8 @@ namespace MagMan.Data.Tenant.DbModels
|
||||
/// <summary>
|
||||
/// Navigation property to Items
|
||||
/// </summary>
|
||||
[ForeignKey("ItemID")]
|
||||
public virtual ItemModel? ITemNav { get; set; }
|
||||
[ForeignKey("RawItemId")]
|
||||
public virtual RawItemModel? ITemNav { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static MagMan.Core.Enums;
|
||||
|
||||
namespace MagMan.Data.Tenant.DbModels
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
/// <summary>
|
||||
/// Tabella dei PROJ caricati da EgtBeamWall
|
||||
/// </summary>
|
||||
[Table("ProjList")]
|
||||
[Index(nameof(MachineID))]
|
||||
[Index(nameof(KeyNum))]
|
||||
[Index(nameof(ProjExtDbId))]
|
||||
[Index(nameof(IsActive))]
|
||||
[Index(nameof(IsArchived))]
|
||||
public class ProjModel
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Chiave univoca su DB
|
||||
/// </summary>
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int ProjDbId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Id macchina (MagMan)
|
||||
/// </summary>
|
||||
public int MachineID { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Key di riferimento per il progetto
|
||||
/// </summary>
|
||||
public int KeyNum { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// ID del DB EgtBW, univoco con KeyNum
|
||||
/// </summary>
|
||||
public int ProjExtDbId { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// ID esterno (da EgtBW)
|
||||
/// </summary>
|
||||
public int ProjExtId { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Nome file BTL originale
|
||||
/// </summary>
|
||||
public string BTLFileName { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Tipologia del progetto (Travi, Pareti, ...)
|
||||
/// </summary>
|
||||
public BWType PType { get; set; } = BWType.NULL;
|
||||
|
||||
/// <summary>
|
||||
/// Macchina (Costruttore/Modello)
|
||||
/// </summary>
|
||||
public string Machine { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Descrizione progetto (copiata da BTLFileName inizialmente)
|
||||
/// </summary>
|
||||
public string ProjDescription { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Data Creazione progetto
|
||||
/// </summary>
|
||||
public DateTime DtCreated { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Data di schedulazione (prevista)
|
||||
/// </summary>
|
||||
public DateTime DtSchedule { get; set; } = DateTime.Today.AddMonths(3);
|
||||
|
||||
/// <summary>
|
||||
/// Data Inizio Produzione
|
||||
/// </summary>
|
||||
public DateTime DtStartProd { get; set; } = DateTime.MinValue;
|
||||
|
||||
/// <summary>
|
||||
/// Data ora ultima operazione registrata
|
||||
/// </summary>
|
||||
public DateTime DtLastAction { get; set; } = DateTime.MinValue;
|
||||
|
||||
/// <summary>
|
||||
/// ListName del BTL
|
||||
/// </summary>
|
||||
public string ListName { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Tempo lavorazione previsto (stima) in minuti
|
||||
/// </summary>
|
||||
public double ProcTimeEst { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Tempo lavorazione reale in minuti (parziale o totale se chiuso/completato/archiviato)
|
||||
/// </summary>
|
||||
public double ProcTimeReal { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Record attivo (se false == cancellazione logica)
|
||||
/// </summary>
|
||||
public bool IsActive { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Stato Archiviato = NON visualizzabile normalmente, già prodotto/chiuso
|
||||
/// </summary>
|
||||
public bool IsArchived { get; set; } = false;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
+29
-27
@@ -12,19 +12,29 @@ namespace MagMan.Data.Tenant.DbModels
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
//[Index(nameof(Installazione), nameof(Active), nameof(DiskStatus))]
|
||||
[Table("ItemsList")]
|
||||
public partial class ItemModel
|
||||
[Table("RawItemList")]
|
||||
public partial class RawItemModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Primary Key AUTO
|
||||
/// </summary>
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int ItemID { get; set; }
|
||||
public int RawItemId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Ext ref for Material
|
||||
/// </summary>
|
||||
public int MatID { get; set; } = 0;
|
||||
public int MatId { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Qty available on wharehouse
|
||||
/// </summary>
|
||||
public int QtyAvail { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Check if is a Remnant
|
||||
/// </summary>
|
||||
public bool IsActive { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Check if is a Remnant
|
||||
@@ -35,16 +45,6 @@ namespace MagMan.Data.Tenant.DbModels
|
||||
/// Location
|
||||
/// </summary>
|
||||
public string Location { get; set; } = "";
|
||||
/// <summary>
|
||||
/// Qty available on wharehouse
|
||||
/// </summary>
|
||||
public int QtyAvail { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// DateTime last modification
|
||||
/// </summary>
|
||||
public DateTime DtMod { get; set; } = DateTime.Now.AddYears(10);
|
||||
|
||||
/// <summary>
|
||||
/// Item's Lenght
|
||||
/// </summary>
|
||||
@@ -56,10 +56,16 @@ namespace MagMan.Data.Tenant.DbModels
|
||||
public decimal WMm { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Item's Thikness
|
||||
/// Item's Height (Thikness/Spessore) in mm
|
||||
/// </summary>
|
||||
public decimal TMm { get; set; } = 0;
|
||||
public decimal HMm { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Note (optional)
|
||||
/// </summary>
|
||||
public string Note { get; set; } = "";
|
||||
|
||||
#if false
|
||||
[NotMapped]
|
||||
public decimal LIn
|
||||
{
|
||||
@@ -71,22 +77,18 @@ namespace MagMan.Data.Tenant.DbModels
|
||||
get => Math.Round(WMm / (decimal)25.4, 3);
|
||||
}
|
||||
[NotMapped]
|
||||
public decimal TIn
|
||||
public decimal HIn
|
||||
{
|
||||
get => Math.Round(TMm / (decimal)25.4, 3);
|
||||
}
|
||||
get => Math.Round(HMm / (decimal)25.4, 3);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Note (optional)
|
||||
/// </summary>
|
||||
public string Note { get; set; } = "";
|
||||
|
||||
[NotMapped]
|
||||
public decimal Area
|
||||
{
|
||||
get => LMm * WMm;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
[NotMapped]
|
||||
@@ -94,10 +96,10 @@ namespace MagMan.Data.Tenant.DbModels
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = $"MT99999999-{LMm * 1000:00000000}";
|
||||
string answ = $"MT99999999W{WMm * 10:000000}H{HMm * 10:000000}L{LMm * 10:000000}";
|
||||
if (MaterialNav != null)
|
||||
{
|
||||
answ = $"MT{MaterialNav.MatExtCode:00000000}-{LMm * 1000:00000000}";
|
||||
answ = $"MT{MaterialNav.MatId:00000000}W{WMm * 10:000000}H{HMm * 10:000000}L{LMm * 10:000000}";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
@@ -106,7 +108,7 @@ namespace MagMan.Data.Tenant.DbModels
|
||||
/// <summary>
|
||||
/// Navigation property to Material
|
||||
/// </summary>
|
||||
[ForeignKey("MatID")]
|
||||
[ForeignKey("MatId")]
|
||||
public virtual MaterialModel MaterialNav { get; set; } = null!;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static MagMan.Core.Enums;
|
||||
|
||||
namespace MagMan.Data.Tenant.DbModels
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
/// <summary>
|
||||
/// Tabella dei Piano Richieste associate a Proj
|
||||
/// </summary>
|
||||
[Table("RequestPlan")]
|
||||
public class RequestPlanModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Init classe
|
||||
/// </summary>
|
||||
public RequestPlanModel()
|
||||
{
|
||||
ResourcesList = new HashSet<ResourceModel>();
|
||||
}
|
||||
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int RequestId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Progetto di riferimento
|
||||
/// </summary>
|
||||
public int ProjDbId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Data richiesta
|
||||
/// </summary>
|
||||
public DateTime DtRequest { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Tipo richiesta
|
||||
/// </summary>
|
||||
public ProjResState ReqState { get; set; } = ProjResState.ND;
|
||||
|
||||
/// <summary>
|
||||
/// Record attivo (se false == NON è il piano scelto per i casi "previsionali" = ReqState >0 )
|
||||
/// </summary>
|
||||
public bool IsActive { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Navigazione ad oggetti child
|
||||
/// </summary>
|
||||
public virtual ICollection<ResourceModel>? ResourcesList { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static MagMan.Core.Enums;
|
||||
|
||||
namespace MagMan.Data.Tenant.DbModels
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
/// <summary>
|
||||
/// Tabella esplosione risorse (richiesta + items)
|
||||
/// </summary>
|
||||
[Table("ResourceList")]
|
||||
public class ResourceModel
|
||||
{
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int ResourceId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Riferimento richiesta parent
|
||||
/// </summary>
|
||||
public int RequestId { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Riferimento RawItem specifico
|
||||
/// </summary>
|
||||
public int RawItemId { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Qty, se > 0 rappresenta un IMPEGNO di qualsiasi tipo, se < 0 è un CONSUMO
|
||||
/// </summary>
|
||||
public int Qty { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Navigation property to RequestPlan
|
||||
/// </summary>
|
||||
[ForeignKey("RequestId")]
|
||||
public virtual RequestPlanModel RequestNav { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,11 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Blazored.LocalStorage" Version="4.4.0" />
|
||||
<Compile Remove="Services\MessageService.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Blazored.LocalStorage" Version="4.3.0" />
|
||||
<PackageReference Include="Blazored.SessionStorage" Version="2.4.0" />
|
||||
<PackageReference Include="MailKit" Version="4.2.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.25" />
|
||||
@@ -38,6 +42,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="DTO\" />
|
||||
<Folder Include="Migrations\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -33,56 +33,27 @@ namespace MagMan.Data.Tenant
|
||||
connString = currConnString;
|
||||
}
|
||||
|
||||
#if false
|
||||
public MagManContext(DbContextOptions<MagManContext> options) : base(options)
|
||||
{
|
||||
try
|
||||
{
|
||||
// se non ci fosse... crea o migra!
|
||||
Database.Migrate();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error(exc, "Exception during context initialization 02");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public virtual DbSet<ConfigModel> DbSetConfig { get; set; } = null!;
|
||||
|
||||
public virtual DbSet<ItemModel> DbSetItems { get; set; } = null!;
|
||||
public virtual DbSet<RawItemModel> DbSetItems { get; set; } = null!;
|
||||
public virtual DbSet<MaterialModel> DbSetMaterials { get; set; } = null!;
|
||||
public virtual DbSet<MovMagModel> DbSetMovMag { get; set; } = null!;
|
||||
public virtual DbSet<PrintJobQueueModel> DbSetPrintJob { get; set; } = null!;
|
||||
public virtual DbSet<RawItemModel> DbSetRawItem { get; set; } = null!;
|
||||
public virtual DbSet<AliasModel> DbSetAlias { get; set; } = null!;
|
||||
public virtual DbSet<ProjModel> DbSetProjects { get; set; } = null!;
|
||||
public virtual DbSet<RequestPlanModel> DbSetReqPlan { get; set; } = null!;
|
||||
public virtual DbSet<ResourceModel> DbSetResources { get; set; } = null!;
|
||||
|
||||
|
||||
#if false
|
||||
public virtual DbSet<AnKeyValModel> DbSetKeyVal { get; set; }
|
||||
|
||||
public virtual DbSet<ListValModel> DbSetListVal { get; set; }
|
||||
|
||||
public virtual DbSet<OrderModel> DbSetOrders { get; set; }
|
||||
|
||||
public virtual DbSet<ParamSendModel> DbSetParamSend { get; set; }
|
||||
|
||||
public virtual DbSet<ParamSetModel> DbSetParamSet { get; set; }
|
||||
|
||||
public virtual DbSet<PlantDetailModel> DbSetPlant { get; set; }
|
||||
|
||||
public virtual DbSet<PlantLogModel> DbSetPlantLog { get; set; }
|
||||
|
||||
public virtual DbSet<PlantStatusModel> DbSetPlantStatus { get; set; }
|
||||
|
||||
public virtual DbSet<WeekPlanModel> DbSetPlantSupplWeekPlan { get; set; }
|
||||
|
||||
public virtual DbSet<SupplierModel> DbSetSupplier { get; set; }
|
||||
|
||||
public virtual DbSet<TransporterModel> DbSetTransporter { get; set; }
|
||||
public virtual DbSet<MovMagModel> DbSetMovMag { get; set; } = null!;
|
||||
public virtual DbSet<PrintJobQueueModel> DbSetPrintJob { get; set; } = null!;
|
||||
#endif
|
||||
|
||||
|
||||
private string connString = "";
|
||||
|
||||
#endregion Public Properties
|
||||
@@ -99,6 +70,9 @@ namespace MagMan.Data.Tenant
|
||||
{
|
||||
if (!optionsBuilder.IsConfigured)
|
||||
{
|
||||
#if DEBUG
|
||||
connString = "Server=localhost;port=3306;database=MagMan_000470;uid=MagMan_DbUser;pwd=viad@nte16!;sslmode=None;";
|
||||
#endif
|
||||
var serverVersion = ServerVersion.AutoDetect(connString);
|
||||
optionsBuilder.UseMySql(connString, serverVersion);
|
||||
}
|
||||
@@ -117,13 +91,8 @@ namespace MagMan.Data.Tenant
|
||||
.HasComment("Valore di default/riferimento per la variabile");
|
||||
});
|
||||
|
||||
#if false
|
||||
modelBuilder.Entity<ListValModel>().HasKey(c => new { c.TabName, c.FieldName, c.Val });
|
||||
|
||||
modelBuilder.Entity<PlantStatusModel>().HasKey(c => new { c.PlantId, c.FluxType });
|
||||
|
||||
modelBuilder.Entity<ParamSendModel>().HasKey(c => new { c.PlantId, c.ParamUid });
|
||||
#endif
|
||||
modelBuilder.Entity<AliasModel>()
|
||||
.HasKey(c => new { c.Family, c.ValueOriginal});
|
||||
|
||||
modelBuilder.Seed();
|
||||
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
// <auto-generated />
|
||||
using MagMan.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MagMan.Data.Tenant.Migrations
|
||||
{
|
||||
[DbContext(typeof(MagManContext))]
|
||||
[Migration("20231222163946_InitDb")]
|
||||
partial class InitDb
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "6.0.25")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.DbModels.ConfigModel", b =>
|
||||
{
|
||||
b.Property<string>("KeyName")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnOrder(0);
|
||||
|
||||
b.Property<string>("Note")
|
||||
.IsRequired()
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)")
|
||||
.HasColumnOrder(3);
|
||||
|
||||
b.Property<string>("Val")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnOrder(1);
|
||||
|
||||
b.Property<string>("ValStd")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnOrder(2)
|
||||
.HasComment("Valore di default/riferimento per la variabile");
|
||||
|
||||
b.HasKey("KeyName");
|
||||
|
||||
b.ToTable("Config");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MagMan.Data.Tenant.Migrations
|
||||
{
|
||||
public partial class InitDb : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterDatabase()
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Config",
|
||||
columns: table => new
|
||||
{
|
||||
KeyName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Val = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ValStd = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "Valore di default/riferimento per la variabile")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Note = table.Column<string>(type: "varchar(250)", maxLength: 250, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Config", x => x.KeyName);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Config");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,149 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using MagMan.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MagMan.Data.Tenant.Migrations
|
||||
{
|
||||
[DbContext(typeof(MagManContext))]
|
||||
[Migration("20231222180319_AddMagBaseObj")]
|
||||
partial class AddMagBaseObj
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "6.0.25")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.DbModels.ConfigModel", b =>
|
||||
{
|
||||
b.Property<string>("KeyName")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnOrder(0);
|
||||
|
||||
b.Property<string>("Note")
|
||||
.IsRequired()
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)")
|
||||
.HasColumnOrder(3);
|
||||
|
||||
b.Property<string>("Val")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnOrder(1);
|
||||
|
||||
b.Property<string>("ValStd")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnOrder(2)
|
||||
.HasComment("Valore di default/riferimento per la variabile");
|
||||
|
||||
b.HasKey("KeyName");
|
||||
|
||||
b.ToTable("Config");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.DbModels.ItemModel", b =>
|
||||
{
|
||||
b.Property<int>("ItemID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DtMod")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsRemn")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<decimal>("LMm")
|
||||
.HasColumnType("decimal(65,30)");
|
||||
|
||||
b.Property<string>("Location")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("MatID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Note")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("QtyAvail")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<decimal>("TMm")
|
||||
.HasColumnType("decimal(65,30)");
|
||||
|
||||
b.Property<decimal>("WMm")
|
||||
.HasColumnType("decimal(65,30)");
|
||||
|
||||
b.HasKey("ItemID");
|
||||
|
||||
b.HasIndex("MatID");
|
||||
|
||||
b.ToTable("ItemsList");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.DbModels.MaterialModel", b =>
|
||||
{
|
||||
b.Property<int>("MatID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("ApprovDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("ApprovUser")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<decimal>("LMm")
|
||||
.HasColumnType("decimal(65,30)");
|
||||
|
||||
b.Property<string>("MatDesc")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("MatExtCode")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<decimal>("TMm")
|
||||
.HasColumnType("decimal(65,30)");
|
||||
|
||||
b.Property<decimal>("WMm")
|
||||
.HasColumnType("decimal(65,30)");
|
||||
|
||||
b.HasKey("MatID");
|
||||
|
||||
b.ToTable("Materials");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.DbModels.ItemModel", b =>
|
||||
{
|
||||
b.HasOne("MagMan.Data.DbModels.MaterialModel", "MaterialNav")
|
||||
.WithMany("ItemNav")
|
||||
.HasForeignKey("MatID")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("MaterialNav");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.DbModels.MaterialModel", b =>
|
||||
{
|
||||
b.Navigation("ItemNav");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MagMan.Data.Tenant.Migrations
|
||||
{
|
||||
public partial class AddMagBaseObj : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Materials",
|
||||
columns: table => new
|
||||
{
|
||||
MatID = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
MatExtCode = table.Column<int>(type: "int", nullable: false),
|
||||
MatDesc = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ApprovDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
ApprovUser = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
LMm = table.Column<decimal>(type: "decimal(65,30)", nullable: false),
|
||||
WMm = table.Column<decimal>(type: "decimal(65,30)", nullable: false),
|
||||
TMm = table.Column<decimal>(type: "decimal(65,30)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Materials", x => x.MatID);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ItemsList",
|
||||
columns: table => new
|
||||
{
|
||||
ItemID = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
MatID = table.Column<int>(type: "int", nullable: false),
|
||||
IsRemn = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
Location = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
QtyAvail = table.Column<int>(type: "int", nullable: false),
|
||||
DtMod = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
LMm = table.Column<decimal>(type: "decimal(65,30)", nullable: false),
|
||||
WMm = table.Column<decimal>(type: "decimal(65,30)", nullable: false),
|
||||
TMm = table.Column<decimal>(type: "decimal(65,30)", nullable: false),
|
||||
Note = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ItemsList", x => x.ItemID);
|
||||
table.ForeignKey(
|
||||
name: "FK_ItemsList_Materials_MatID",
|
||||
column: x => x.MatID,
|
||||
principalTable: "Materials",
|
||||
principalColumn: "MatID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ItemsList_MatID",
|
||||
table: "ItemsList",
|
||||
column: "MatID");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "ItemsList");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Materials");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,221 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using MagMan.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MagMan.Data.Tenant.Migrations
|
||||
{
|
||||
[DbContext(typeof(MagManContext))]
|
||||
[Migration("20231222180523_AddMagBaseObj01")]
|
||||
partial class AddMagBaseObj01
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "6.0.25")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.DbModels.ConfigModel", b =>
|
||||
{
|
||||
b.Property<string>("KeyName")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnOrder(0);
|
||||
|
||||
b.Property<string>("Note")
|
||||
.IsRequired()
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)")
|
||||
.HasColumnOrder(3);
|
||||
|
||||
b.Property<string>("Val")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnOrder(1);
|
||||
|
||||
b.Property<string>("ValStd")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnOrder(2)
|
||||
.HasComment("Valore di default/riferimento per la variabile");
|
||||
|
||||
b.HasKey("KeyName");
|
||||
|
||||
b.ToTable("Config");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.DbModels.ItemModel", b =>
|
||||
{
|
||||
b.Property<int>("ItemID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DtMod")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsRemn")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<decimal>("LMm")
|
||||
.HasColumnType("decimal(65,30)");
|
||||
|
||||
b.Property<string>("Location")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("MatID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Note")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("QtyAvail")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<decimal>("TMm")
|
||||
.HasColumnType("decimal(65,30)");
|
||||
|
||||
b.Property<decimal>("WMm")
|
||||
.HasColumnType("decimal(65,30)");
|
||||
|
||||
b.HasKey("ItemID");
|
||||
|
||||
b.HasIndex("MatID");
|
||||
|
||||
b.ToTable("ItemsList");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.DbModels.MaterialModel", b =>
|
||||
{
|
||||
b.Property<int>("MatID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("ApprovDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("ApprovUser")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<decimal>("LMm")
|
||||
.HasColumnType("decimal(65,30)");
|
||||
|
||||
b.Property<string>("MatDesc")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("MatExtCode")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<decimal>("TMm")
|
||||
.HasColumnType("decimal(65,30)");
|
||||
|
||||
b.Property<decimal>("WMm")
|
||||
.HasColumnType("decimal(65,30)");
|
||||
|
||||
b.HasKey("MatID");
|
||||
|
||||
b.ToTable("Materials");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.DbModels.MovMagModel", b =>
|
||||
{
|
||||
b.Property<int>("MovID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DtRec")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("ItemID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("QtyRec")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("MovID");
|
||||
|
||||
b.HasIndex("ItemID");
|
||||
|
||||
b.ToTable("MovMag");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.DbModels.PrintJobQueueModel", b =>
|
||||
{
|
||||
b.Property<int>("IdxPrintJob")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("DtEnd")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("DtLastTry")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime>("DtStart")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("KeyParam")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("PrtName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("Stato")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("TipoReport")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("IdxPrintJob");
|
||||
|
||||
b.ToTable("PrintJobQueue");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.DbModels.ItemModel", b =>
|
||||
{
|
||||
b.HasOne("MagMan.Data.DbModels.MaterialModel", "MaterialNav")
|
||||
.WithMany("ItemNav")
|
||||
.HasForeignKey("MatID")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("MaterialNav");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.DbModels.MovMagModel", b =>
|
||||
{
|
||||
b.HasOne("MagMan.Data.DbModels.ItemModel", "ITemNav")
|
||||
.WithMany()
|
||||
.HasForeignKey("ItemID")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("ITemNav");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.DbModels.MaterialModel", b =>
|
||||
{
|
||||
b.Navigation("ItemNav");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MagMan.Data.Tenant.Migrations
|
||||
{
|
||||
public partial class AddMagBaseObj01 : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MovMag",
|
||||
columns: table => new
|
||||
{
|
||||
MovID = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
DtRec = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
ItemID = table.Column<int>(type: "int", nullable: false),
|
||||
QtyRec = table.Column<int>(type: "int", nullable: false),
|
||||
UserId = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MovMag", x => x.MovID);
|
||||
table.ForeignKey(
|
||||
name: "FK_MovMag_ItemsList_ItemID",
|
||||
column: x => x.ItemID,
|
||||
principalTable: "ItemsList",
|
||||
principalColumn: "ItemID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PrintJobQueue",
|
||||
columns: table => new
|
||||
{
|
||||
IdxPrintJob = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
TipoReport = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
KeyParam = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
PrtName = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
DtStart = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
DtEnd = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
||||
Stato = table.Column<int>(type: "int", nullable: false),
|
||||
DtLastTry = table.Column<DateTime>(type: "datetime(6)", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PrintJobQueue", x => x.IdxPrintJob);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MovMag_ItemID",
|
||||
table: "MovMag",
|
||||
column: "ItemID");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "MovMag");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "PrintJobQueue");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,297 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using MagMan.Data.Tenant;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MagMan.Data.Tenant.Migrations
|
||||
{
|
||||
[DbContext(typeof(MagManContext))]
|
||||
[Migration("20240122174314_InitDb")]
|
||||
partial class InitDb
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "6.0.25")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.Tenant.DbModels.AliasModel", b =>
|
||||
{
|
||||
b.Property<string>("Family")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<string>("ValueOriginal")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<string>("ValueAlias")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Family", "ValueOriginal");
|
||||
|
||||
b.ToTable("AliasList");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.Tenant.DbModels.ConfigModel", b =>
|
||||
{
|
||||
b.Property<string>("KeyName")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnOrder(0);
|
||||
|
||||
b.Property<string>("Note")
|
||||
.IsRequired()
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)")
|
||||
.HasColumnOrder(3);
|
||||
|
||||
b.Property<string>("Val")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnOrder(1);
|
||||
|
||||
b.Property<string>("ValStd")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnOrder(2)
|
||||
.HasComment("Valore di default/riferimento per la variabile");
|
||||
|
||||
b.HasKey("KeyName");
|
||||
|
||||
b.ToTable("Config");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.Tenant.DbModels.MaterialModel", b =>
|
||||
{
|
||||
b.Property<int>("MatId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<decimal>("HMm")
|
||||
.HasColumnType("decimal(65,30)");
|
||||
|
||||
b.Property<decimal>("LMm")
|
||||
.HasColumnType("decimal(65,30)");
|
||||
|
||||
b.Property<string>("MatCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("MatDesc")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<decimal>("WMm")
|
||||
.HasColumnType("decimal(65,30)");
|
||||
|
||||
b.HasKey("MatId");
|
||||
|
||||
b.ToTable("MaterialsList");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.Tenant.DbModels.ProjModel", b =>
|
||||
{
|
||||
b.Property<int>("ProjDbId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("BTLFileName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("DtCreated")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime>("DtLastAction")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime>("DtSchedule")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime>("DtStartProd")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<bool>("IsArchived")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("KeyNum")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ListName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Machine")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("MachineID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("ProcTimeEst")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<double>("ProcTimeReal")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<string>("ProjDescription")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("ProjExtDbId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ProjExtId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("ProjDbId");
|
||||
|
||||
b.HasIndex("IsActive");
|
||||
|
||||
b.HasIndex("IsArchived");
|
||||
|
||||
b.HasIndex("KeyNum");
|
||||
|
||||
b.HasIndex("MachineID");
|
||||
|
||||
b.HasIndex("ProjExtDbId");
|
||||
|
||||
b.ToTable("ProjList");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.Tenant.DbModels.RawItemModel", b =>
|
||||
{
|
||||
b.Property<int>("RawItemId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<decimal>("HMm")
|
||||
.HasColumnType("decimal(65,30)");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<bool>("IsRemn")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<decimal>("LMm")
|
||||
.HasColumnType("decimal(65,30)");
|
||||
|
||||
b.Property<string>("Location")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("MatId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Note")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("QtyAvail")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<decimal>("WMm")
|
||||
.HasColumnType("decimal(65,30)");
|
||||
|
||||
b.HasKey("RawItemId");
|
||||
|
||||
b.HasIndex("MatId");
|
||||
|
||||
b.ToTable("RawItemList");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.Tenant.DbModels.RequestPlanModel", b =>
|
||||
{
|
||||
b.Property<int>("RequestId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DtRequest")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("ProjDbId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ReqState")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("RequestId");
|
||||
|
||||
b.ToTable("RequestPlan");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.Tenant.DbModels.ResourceModel", b =>
|
||||
{
|
||||
b.Property<int>("ResourceId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Qty")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("RawItemId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("RequestId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("ResourceId");
|
||||
|
||||
b.HasIndex("RequestId");
|
||||
|
||||
b.ToTable("ResourceList");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.Tenant.DbModels.RawItemModel", b =>
|
||||
{
|
||||
b.HasOne("MagMan.Data.Tenant.DbModels.MaterialModel", "MaterialNav")
|
||||
.WithMany("RawItemList")
|
||||
.HasForeignKey("MatId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("MaterialNav");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.Tenant.DbModels.ResourceModel", b =>
|
||||
{
|
||||
b.HasOne("MagMan.Data.Tenant.DbModels.RequestPlanModel", "RequestNav")
|
||||
.WithMany("ResourcesList")
|
||||
.HasForeignKey("RequestId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("RequestNav");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.Tenant.DbModels.MaterialModel", b =>
|
||||
{
|
||||
b.Navigation("RawItemList");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.Tenant.DbModels.RequestPlanModel", b =>
|
||||
{
|
||||
b.Navigation("ResourcesList");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,235 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MagMan.Data.Tenant.Migrations
|
||||
{
|
||||
public partial class InitDb : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterDatabase()
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AliasList",
|
||||
columns: table => new
|
||||
{
|
||||
Family = table.Column<string>(type: "varchar(255)", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ValueOriginal = table.Column<string>(type: "varchar(255)", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ValueAlias = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AliasList", x => new { x.Family, x.ValueOriginal });
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Config",
|
||||
columns: table => new
|
||||
{
|
||||
KeyName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Val = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ValStd = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "Valore di default/riferimento per la variabile")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Note = table.Column<string>(type: "varchar(250)", maxLength: 250, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Config", x => x.KeyName);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MaterialsList",
|
||||
columns: table => new
|
||||
{
|
||||
MatId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
MatCode = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
MatDesc = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
LMm = table.Column<decimal>(type: "decimal(65,30)", nullable: false),
|
||||
WMm = table.Column<decimal>(type: "decimal(65,30)", nullable: false),
|
||||
HMm = table.Column<decimal>(type: "decimal(65,30)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MaterialsList", x => x.MatId);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ProjList",
|
||||
columns: table => new
|
||||
{
|
||||
ProjDbId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
MachineID = table.Column<int>(type: "int", nullable: false),
|
||||
KeyNum = table.Column<int>(type: "int", nullable: false),
|
||||
ProjExtDbId = table.Column<int>(type: "int", nullable: false),
|
||||
ProjExtId = table.Column<int>(type: "int", nullable: false),
|
||||
BTLFileName = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
PType = table.Column<int>(type: "int", nullable: false),
|
||||
Machine = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ProjDescription = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
DtCreated = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
DtSchedule = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
DtStartProd = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
DtLastAction = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
ListName = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ProcTimeEst = table.Column<double>(type: "double", nullable: false),
|
||||
ProcTimeReal = table.Column<double>(type: "double", nullable: false),
|
||||
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
IsArchived = table.Column<bool>(type: "tinyint(1)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ProjList", x => x.ProjDbId);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "RequestPlan",
|
||||
columns: table => new
|
||||
{
|
||||
RequestId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
ProjDbId = table.Column<int>(type: "int", nullable: false),
|
||||
DtRequest = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
ReqState = table.Column<int>(type: "int", nullable: false),
|
||||
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_RequestPlan", x => x.RequestId);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "RawItemList",
|
||||
columns: table => new
|
||||
{
|
||||
RawItemId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
MatId = table.Column<int>(type: "int", nullable: false),
|
||||
QtyAvail = table.Column<int>(type: "int", nullable: false),
|
||||
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
IsRemn = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
Location = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
LMm = table.Column<decimal>(type: "decimal(65,30)", nullable: false),
|
||||
WMm = table.Column<decimal>(type: "decimal(65,30)", nullable: false),
|
||||
HMm = table.Column<decimal>(type: "decimal(65,30)", nullable: false),
|
||||
Note = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_RawItemList", x => x.RawItemId);
|
||||
table.ForeignKey(
|
||||
name: "FK_RawItemList_MaterialsList_MatId",
|
||||
column: x => x.MatId,
|
||||
principalTable: "MaterialsList",
|
||||
principalColumn: "MatId",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ResourceList",
|
||||
columns: table => new
|
||||
{
|
||||
ResourceId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
RequestId = table.Column<int>(type: "int", nullable: false),
|
||||
RawItemId = table.Column<int>(type: "int", nullable: false),
|
||||
Qty = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ResourceList", x => x.ResourceId);
|
||||
table.ForeignKey(
|
||||
name: "FK_ResourceList_RequestPlan_RequestId",
|
||||
column: x => x.RequestId,
|
||||
principalTable: "RequestPlan",
|
||||
principalColumn: "RequestId",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ProjList_IsActive",
|
||||
table: "ProjList",
|
||||
column: "IsActive");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ProjList_IsArchived",
|
||||
table: "ProjList",
|
||||
column: "IsArchived");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ProjList_KeyNum",
|
||||
table: "ProjList",
|
||||
column: "KeyNum");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ProjList_MachineID",
|
||||
table: "ProjList",
|
||||
column: "MachineID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ProjList_ProjExtDbId",
|
||||
table: "ProjList",
|
||||
column: "ProjExtDbId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_RawItemList_MatId",
|
||||
table: "RawItemList",
|
||||
column: "MatId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ResourceList_RequestId",
|
||||
table: "ResourceList",
|
||||
column: "RequestId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "AliasList");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Config");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ProjList");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "RawItemList");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ResourceList");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "MaterialsList");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "RequestPlan");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using MagMan.Data;
|
||||
using MagMan.Data.Tenant;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
@@ -19,7 +19,24 @@ namespace MagMan.Data.Tenant.Migrations
|
||||
.HasAnnotation("ProductVersion", "6.0.25")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.DbModels.ConfigModel", b =>
|
||||
modelBuilder.Entity("MagMan.Data.Tenant.DbModels.AliasModel", b =>
|
||||
{
|
||||
b.Property<string>("Family")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<string>("ValueOriginal")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<string>("ValueAlias")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Family", "ValueOriginal");
|
||||
|
||||
b.ToTable("AliasList");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.Tenant.DbModels.ConfigModel", b =>
|
||||
{
|
||||
b.Property<string>("KeyName")
|
||||
.HasMaxLength(50)
|
||||
@@ -50,15 +67,122 @@ namespace MagMan.Data.Tenant.Migrations
|
||||
b.ToTable("Config");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.DbModels.ItemModel", b =>
|
||||
modelBuilder.Entity("MagMan.Data.Tenant.DbModels.MaterialModel", b =>
|
||||
{
|
||||
b.Property<int>("ItemID")
|
||||
b.Property<int>("MatId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DtMod")
|
||||
b.Property<decimal>("HMm")
|
||||
.HasColumnType("decimal(65,30)");
|
||||
|
||||
b.Property<decimal>("LMm")
|
||||
.HasColumnType("decimal(65,30)");
|
||||
|
||||
b.Property<string>("MatCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("MatDesc")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<decimal>("WMm")
|
||||
.HasColumnType("decimal(65,30)");
|
||||
|
||||
b.HasKey("MatId");
|
||||
|
||||
b.ToTable("MaterialsList");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.Tenant.DbModels.ProjModel", b =>
|
||||
{
|
||||
b.Property<int>("ProjDbId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("BTLFileName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("DtCreated")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime>("DtLastAction")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime>("DtSchedule")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime>("DtStartProd")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<bool>("IsArchived")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("KeyNum")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ListName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Machine")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("MachineID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("ProcTimeEst")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<double>("ProcTimeReal")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<string>("ProjDescription")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("ProjExtDbId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ProjExtId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("ProjDbId");
|
||||
|
||||
b.HasIndex("IsActive");
|
||||
|
||||
b.HasIndex("IsArchived");
|
||||
|
||||
b.HasIndex("KeyNum");
|
||||
|
||||
b.HasIndex("MachineID");
|
||||
|
||||
b.HasIndex("ProjExtDbId");
|
||||
|
||||
b.ToTable("ProjList");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.Tenant.DbModels.RawItemModel", b =>
|
||||
{
|
||||
b.Property<int>("RawItemId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<decimal>("HMm")
|
||||
.HasColumnType("decimal(65,30)");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<bool>("IsRemn")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
@@ -69,7 +193,7 @@ namespace MagMan.Data.Tenant.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("MatID")
|
||||
b.Property<int>("MatId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Note")
|
||||
@@ -79,139 +203,91 @@ namespace MagMan.Data.Tenant.Migrations
|
||||
b.Property<int>("QtyAvail")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<decimal>("TMm")
|
||||
.HasColumnType("decimal(65,30)");
|
||||
|
||||
b.Property<decimal>("WMm")
|
||||
.HasColumnType("decimal(65,30)");
|
||||
|
||||
b.HasKey("ItemID");
|
||||
b.HasKey("RawItemId");
|
||||
|
||||
b.HasIndex("MatID");
|
||||
b.HasIndex("MatId");
|
||||
|
||||
b.ToTable("ItemsList");
|
||||
b.ToTable("RawItemList");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.DbModels.MaterialModel", b =>
|
||||
modelBuilder.Entity("MagMan.Data.Tenant.DbModels.RequestPlanModel", b =>
|
||||
{
|
||||
b.Property<int>("MatID")
|
||||
b.Property<int>("RequestId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("ApprovDate")
|
||||
b.Property<DateTime>("DtRequest")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("ApprovUser")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<decimal>("LMm")
|
||||
.HasColumnType("decimal(65,30)");
|
||||
|
||||
b.Property<string>("MatDesc")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("MatExtCode")
|
||||
b.Property<int>("ProjDbId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<decimal>("TMm")
|
||||
.HasColumnType("decimal(65,30)");
|
||||
b.Property<int>("ReqState")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<decimal>("WMm")
|
||||
.HasColumnType("decimal(65,30)");
|
||||
b.HasKey("RequestId");
|
||||
|
||||
b.HasKey("MatID");
|
||||
|
||||
b.ToTable("Materials");
|
||||
b.ToTable("RequestPlan");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.DbModels.MovMagModel", b =>
|
||||
modelBuilder.Entity("MagMan.Data.Tenant.DbModels.ResourceModel", b =>
|
||||
{
|
||||
b.Property<int>("MovID")
|
||||
b.Property<int>("ResourceId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DtRec")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("ItemID")
|
||||
b.Property<int>("Qty")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("QtyRec")
|
||||
b.Property<int>("RawItemId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
b.Property<int>("RequestId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("MovID");
|
||||
b.HasKey("ResourceId");
|
||||
|
||||
b.HasIndex("ItemID");
|
||||
b.HasIndex("RequestId");
|
||||
|
||||
b.ToTable("MovMag");
|
||||
b.ToTable("ResourceList");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.DbModels.PrintJobQueueModel", b =>
|
||||
modelBuilder.Entity("MagMan.Data.Tenant.DbModels.RawItemModel", b =>
|
||||
{
|
||||
b.Property<int>("IdxPrintJob")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("DtEnd")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("DtLastTry")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime>("DtStart")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("KeyParam")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("PrtName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("Stato")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("TipoReport")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("IdxPrintJob");
|
||||
|
||||
b.ToTable("PrintJobQueue");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.DbModels.ItemModel", b =>
|
||||
{
|
||||
b.HasOne("MagMan.Data.DbModels.MaterialModel", "MaterialNav")
|
||||
.WithMany("ItemNav")
|
||||
.HasForeignKey("MatID")
|
||||
b.HasOne("MagMan.Data.Tenant.DbModels.MaterialModel", "MaterialNav")
|
||||
.WithMany("RawItemList")
|
||||
.HasForeignKey("MatId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("MaterialNav");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.DbModels.MovMagModel", b =>
|
||||
modelBuilder.Entity("MagMan.Data.Tenant.DbModels.ResourceModel", b =>
|
||||
{
|
||||
b.HasOne("MagMan.Data.DbModels.ItemModel", "ITemNav")
|
||||
.WithMany()
|
||||
.HasForeignKey("ItemID")
|
||||
b.HasOne("MagMan.Data.Tenant.DbModels.RequestPlanModel", "RequestNav")
|
||||
.WithMany("ResourcesList")
|
||||
.HasForeignKey("RequestId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("ITemNav");
|
||||
b.Navigation("RequestNav");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.DbModels.MaterialModel", b =>
|
||||
modelBuilder.Entity("MagMan.Data.Tenant.DbModels.MaterialModel", b =>
|
||||
{
|
||||
b.Navigation("ItemNav");
|
||||
b.Navigation("RawItemList");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.Tenant.DbModels.RequestPlanModel", b =>
|
||||
{
|
||||
b.Navigation("ResourcesList");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
|
||||
Generated
-311
@@ -1,311 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using MagMan.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MagMan.Data.Migrations.UserIdentityDb
|
||||
{
|
||||
[DbContext(typeof(UserIdentityDbContext))]
|
||||
[Migration("20231222165912_CreateIdentitySchema")]
|
||||
partial class CreateIdentitySchema
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "6.0.25")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.DbModels.TableCount", b =>
|
||||
{
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("TableName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.ToTable("DbSetCounts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.Property<string>("NormalizedName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("RoleNameIndex");
|
||||
|
||||
b.ToTable("AspNetRoles", (string)null);
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = "eebed9c1-7433-4716-a62f-df9829dc0f09",
|
||||
ConcurrencyStamp = "4a1affe9-543f-4165-816a-2ed6d3f06c77",
|
||||
Name = "Undef",
|
||||
NormalizedName = "UNDEF"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = "ca44b425-5c7e-4812-a28a-047ec6aa2e68",
|
||||
ConcurrencyStamp = "a1357889-6a23-49cb-9d33-6bc5ef6eb4e6",
|
||||
Name = "User",
|
||||
NormalizedName = "USER"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = "86a8f484-ca14-4e4d-a786-3eba35da6e06",
|
||||
ConcurrencyStamp = "9dd579c3-bdfa-4c44-b6ca-6dd10d34debb",
|
||||
Name = "Admin",
|
||||
NormalizedName = "ADMIN"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = "f5bd74e5-df26-4c52-963e-2d87e858c4d6",
|
||||
ConcurrencyStamp = "1d620875-05b0-490d-91d5-6f21a83844f1",
|
||||
Name = "SuperAdmin",
|
||||
NormalizedName = "SUPERADMIN"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("RoleId")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetRoleClaims", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<int>("AccessFailedCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.Property<bool>("EmailConfirmed")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<bool>("LockoutEnabled")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<DateTimeOffset?>("LockoutEnd")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("NormalizedEmail")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.Property<string>("NormalizedUserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<bool>("PhoneNumberConfirmed")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("SecurityStamp")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<bool>("TwoFactorEnabled")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("UserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedEmail")
|
||||
.HasDatabaseName("EmailIndex");
|
||||
|
||||
b.HasIndex("NormalizedUserName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("UserNameIndex");
|
||||
|
||||
b.ToTable("AspNetUsers", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserClaims", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
||||
{
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<string>("ProviderKey")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<string>("ProviderDisplayName")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.HasKey("LoginProvider", "ProviderKey");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserLogins", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
||||
{
|
||||
b.Property<string>("UserId")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<string>("RoleId")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.HasKey("UserId", "RoleId");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetUserRoles", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
||||
{
|
||||
b.Property<string>("UserId")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("UserId", "LoginProvider", "Name");
|
||||
|
||||
b.ToTable("AspNetUserTokens", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,286 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MagMan.Data.Migrations.UserIdentityDb
|
||||
{
|
||||
public partial class CreateIdentitySchema : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterDatabase()
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AspNetRoles",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<string>(type: "varchar(255)", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Name = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
NormalizedName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ConcurrencyStamp = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetRoles", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AspNetUsers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<string>(type: "varchar(255)", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
UserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
NormalizedUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Email = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
NormalizedEmail = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
EmailConfirmed = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
PasswordHash = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
SecurityStamp = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ConcurrencyStamp = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
PhoneNumber = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
PhoneNumberConfirmed = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
TwoFactorEnabled = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
LockoutEnd = table.Column<DateTimeOffset>(type: "datetime(6)", nullable: true),
|
||||
LockoutEnabled = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
AccessFailedCount = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetUsers", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "DbSetCounts",
|
||||
columns: table => new
|
||||
{
|
||||
Count = table.Column<int>(type: "int", nullable: false),
|
||||
TableName = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AspNetRoleClaims",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
RoleId = table.Column<string>(type: "varchar(255)", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ClaimType = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ClaimValue = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
|
||||
column: x => x.RoleId,
|
||||
principalTable: "AspNetRoles",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AspNetUserClaims",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
UserId = table.Column<string>(type: "varchar(255)", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ClaimType = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ClaimValue = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_AspNetUserClaims_AspNetUsers_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AspNetUserLogins",
|
||||
columns: table => new
|
||||
{
|
||||
LoginProvider = table.Column<string>(type: "varchar(255)", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ProviderKey = table.Column<string>(type: "varchar(255)", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ProviderDisplayName = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
UserId = table.Column<string>(type: "varchar(255)", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey });
|
||||
table.ForeignKey(
|
||||
name: "FK_AspNetUserLogins_AspNetUsers_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AspNetUserRoles",
|
||||
columns: table => new
|
||||
{
|
||||
UserId = table.Column<string>(type: "varchar(255)", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
RoleId = table.Column<string>(type: "varchar(255)", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId });
|
||||
table.ForeignKey(
|
||||
name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
|
||||
column: x => x.RoleId,
|
||||
principalTable: "AspNetRoles",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_AspNetUserRoles_AspNetUsers_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AspNetUserTokens",
|
||||
columns: table => new
|
||||
{
|
||||
UserId = table.Column<string>(type: "varchar(255)", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
LoginProvider = table.Column<string>(type: "varchar(255)", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Name = table.Column<string>(type: "varchar(255)", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Value = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
|
||||
table.ForeignKey(
|
||||
name: "FK_AspNetUserTokens_AspNetUsers_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "AspNetRoles",
|
||||
columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ "86a8f484-ca14-4e4d-a786-3eba35da6e06", "9dd579c3-bdfa-4c44-b6ca-6dd10d34debb", "Admin", "ADMIN" },
|
||||
{ "ca44b425-5c7e-4812-a28a-047ec6aa2e68", "a1357889-6a23-49cb-9d33-6bc5ef6eb4e6", "User", "USER" },
|
||||
{ "eebed9c1-7433-4716-a62f-df9829dc0f09", "4a1affe9-543f-4165-816a-2ed6d3f06c77", "Undef", "UNDEF" },
|
||||
{ "f5bd74e5-df26-4c52-963e-2d87e858c4d6", "1d620875-05b0-490d-91d5-6f21a83844f1", "SuperAdmin", "SUPERADMIN" }
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AspNetRoleClaims_RoleId",
|
||||
table: "AspNetRoleClaims",
|
||||
column: "RoleId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "RoleNameIndex",
|
||||
table: "AspNetRoles",
|
||||
column: "NormalizedName",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AspNetUserClaims_UserId",
|
||||
table: "AspNetUserClaims",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AspNetUserLogins_UserId",
|
||||
table: "AspNetUserLogins",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AspNetUserRoles_RoleId",
|
||||
table: "AspNetUserRoles",
|
||||
column: "RoleId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "EmailIndex",
|
||||
table: "AspNetUsers",
|
||||
column: "NormalizedEmail");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "UserNameIndex",
|
||||
table: "AspNetUsers",
|
||||
column: "NormalizedUserName",
|
||||
unique: true);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "AspNetRoleClaims");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AspNetUserClaims");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AspNetUserLogins");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AspNetUserRoles");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AspNetUserTokens");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "DbSetCounts");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AspNetRoles");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AspNetUsers");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,309 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using MagMan.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MagMan.Data.Migrations.UserIdentityDb
|
||||
{
|
||||
[DbContext(typeof(UserIdentityDbContext))]
|
||||
partial class UserIdentityDbContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "6.0.25")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.DbModels.TableCount", b =>
|
||||
{
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("TableName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.ToTable("DbSetCounts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.Property<string>("NormalizedName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("RoleNameIndex");
|
||||
|
||||
b.ToTable("AspNetRoles", (string)null);
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = "eebed9c1-7433-4716-a62f-df9829dc0f09",
|
||||
ConcurrencyStamp = "4a1affe9-543f-4165-816a-2ed6d3f06c77",
|
||||
Name = "Undef",
|
||||
NormalizedName = "UNDEF"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = "ca44b425-5c7e-4812-a28a-047ec6aa2e68",
|
||||
ConcurrencyStamp = "a1357889-6a23-49cb-9d33-6bc5ef6eb4e6",
|
||||
Name = "User",
|
||||
NormalizedName = "USER"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = "86a8f484-ca14-4e4d-a786-3eba35da6e06",
|
||||
ConcurrencyStamp = "9dd579c3-bdfa-4c44-b6ca-6dd10d34debb",
|
||||
Name = "Admin",
|
||||
NormalizedName = "ADMIN"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = "f5bd74e5-df26-4c52-963e-2d87e858c4d6",
|
||||
ConcurrencyStamp = "1d620875-05b0-490d-91d5-6f21a83844f1",
|
||||
Name = "SuperAdmin",
|
||||
NormalizedName = "SUPERADMIN"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("RoleId")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetRoleClaims", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<int>("AccessFailedCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.Property<bool>("EmailConfirmed")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<bool>("LockoutEnabled")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<DateTimeOffset?>("LockoutEnd")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("NormalizedEmail")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.Property<string>("NormalizedUserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<bool>("PhoneNumberConfirmed")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("SecurityStamp")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<bool>("TwoFactorEnabled")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("UserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedEmail")
|
||||
.HasDatabaseName("EmailIndex");
|
||||
|
||||
b.HasIndex("NormalizedUserName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("UserNameIndex");
|
||||
|
||||
b.ToTable("AspNetUsers", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserClaims", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
||||
{
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<string>("ProviderKey")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<string>("ProviderDisplayName")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.HasKey("LoginProvider", "ProviderKey");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserLogins", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
||||
{
|
||||
b.Property<string>("UserId")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<string>("RoleId")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.HasKey("UserId", "RoleId");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetUserRoles", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
||||
{
|
||||
b.Property<string>("UserId")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("UserId", "LoginProvider", "Name");
|
||||
|
||||
b.ToTable("AspNetUserTokens", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,279 +0,0 @@
|
||||
using Blazored.LocalStorage;
|
||||
using Blazored.SessionStorage;
|
||||
using NLog;
|
||||
using NLog.Fluent;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection.Metadata;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MagMan.Data.Tenant.Services
|
||||
{
|
||||
public class MessageService
|
||||
{
|
||||
#region Public Events
|
||||
|
||||
public event Action EA_FilterUpdated = null!;
|
||||
|
||||
public event Action EA_HideSearch = null!;
|
||||
|
||||
public event Action EA_PageUpdated = null!;
|
||||
|
||||
public event Action EA_SearchUpdated = null!;
|
||||
|
||||
public event Action EA_ShowSearch = null!;
|
||||
|
||||
#endregion Public Events
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public SelectData DetailFilter
|
||||
{
|
||||
get => _detailFilter;
|
||||
set
|
||||
{
|
||||
if (_detailFilter != value)
|
||||
{
|
||||
_detailFilter = value;
|
||||
|
||||
if (EA_FilterUpdated != null)
|
||||
{
|
||||
EA_FilterUpdated?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public SelectOrderData Order_Filter { get; set; } = SelectOrderData.Init(5, 30);
|
||||
|
||||
public string PageIcon
|
||||
{
|
||||
get => _pageIcon;
|
||||
set
|
||||
{
|
||||
if (_pageIcon != value)
|
||||
{
|
||||
_pageIcon = value;
|
||||
ReportPageUpd();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string PageName
|
||||
{
|
||||
get => _pageName;
|
||||
set
|
||||
{
|
||||
if (_pageName != value)
|
||||
{
|
||||
_pageName = value;
|
||||
ReportPageUpd();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string SearchVal
|
||||
{
|
||||
get => _searchVal;
|
||||
set
|
||||
{
|
||||
if (_searchVal != value)
|
||||
{
|
||||
_searchVal = value;
|
||||
|
||||
if (EA_SearchUpdated != null)
|
||||
{
|
||||
EA_SearchUpdated?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string SelOrderCode { get; set; } = "";
|
||||
public string SelPlantId { get; set; } = "0";
|
||||
|
||||
public bool ShowSearch
|
||||
{
|
||||
get => _showSearch;
|
||||
set
|
||||
{
|
||||
if (_showSearch != value)
|
||||
{
|
||||
_showSearch = value;
|
||||
if (_showSearch)
|
||||
{
|
||||
if (EA_ShowSearch != null)
|
||||
{
|
||||
EA_ShowSearch?.Invoke();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (EA_HideSearch != null)
|
||||
{
|
||||
EA_HideSearch?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Svuota localstorage (clear)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> StoreLocalClear()
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
await localStore.ClearAsync();
|
||||
answ = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error($"Eccezione in StoreLocalClear{Environment.NewLine}{ex}");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce il valore richiesto da localstorage
|
||||
/// </summary>
|
||||
/// <param name="sKey">Chiave</param>
|
||||
/// <returns></returns>
|
||||
public async Task<string> StoreLocalGet(string sKey)
|
||||
{
|
||||
string answ = "";
|
||||
var result = await localStore.GetItemAsync<string>(sKey);
|
||||
if (result != null)
|
||||
{
|
||||
answ = result;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Scrive il valore nel localstorage
|
||||
/// </summary>
|
||||
/// <param name="sKey">Chiave</param>
|
||||
/// <param name="sVal">Valore associato</param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> StoreLocalSet(string sKey, string sVal)
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
await localStore.SetItemAsStringAsync(sKey, sVal);
|
||||
answ = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error($"Eccezione in StoreLocalSet{Environment.NewLine}{ex}");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Svuota sessionstorage (clear)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> StoreSessClear()
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
await sessionStore.ClearAsync();
|
||||
answ = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error($"Eccezione in StoreLocalClear{Environment.NewLine}{ex}");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce il valore richiesto da sessionstorage
|
||||
/// </summary>
|
||||
/// <param name="sKey">Chiave</param>
|
||||
/// <returns></returns>
|
||||
public async Task<string> StoreSessGet(string sKey)
|
||||
{
|
||||
string answ = "";
|
||||
var result = await sessionStore.GetItemAsync<string>(sKey);
|
||||
if (result != null)
|
||||
{
|
||||
answ = result;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Scrive il valore nel sessionstorage (tab)
|
||||
/// </summary>
|
||||
/// <param name="sKey">Chiave</param>
|
||||
/// <param name="sVal">Valore associato</param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> StoreSessSet(string sKey, string sVal)
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
await sessionStore.SetItemAsStringAsync(sKey, sVal);
|
||||
answ = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error($"Eccezione in StoreSessSet{Environment.NewLine}{ex}");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected ILocalStorageService localStore { get; set; } = null!;
|
||||
protected ISessionStorageService sessionStore { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private SelectData _detailFilter = SelectData.Init(5, 15);
|
||||
private string _pageIcon = "";
|
||||
private string _pageName = "";
|
||||
private string _searchVal = "";
|
||||
private bool _showSearch = false;
|
||||
private Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void ReportPageUpd()
|
||||
{
|
||||
if (EA_PageUpdated != null)
|
||||
{
|
||||
EA_PageUpdated?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
private void ReportSearch()
|
||||
{
|
||||
if (EA_SearchUpdated != null)
|
||||
{
|
||||
EA_SearchUpdated?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -60,7 +60,7 @@ namespace MagMan.Data.Tenant.Services
|
||||
/// <param name="nKey">Key di riferimento</param>
|
||||
/// <param name="rec2del">Item da eliminare</param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> ItemDelete(int nKey, ItemModel rec2del)
|
||||
public async Task<bool> ItemDelete(int nKey, RawItemModel rec2del)
|
||||
{
|
||||
bool fatto = false;
|
||||
string cString = ConnString(nKey);
|
||||
@@ -79,29 +79,53 @@ namespace MagMan.Data.Tenant.Services
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converte il DTO in ItemModel
|
||||
/// </summary>
|
||||
/// <param name="origItem">DTO di partenza</param>
|
||||
/// <param name="isActive">Parametro active da impostare</param>
|
||||
/// <returns></returns>
|
||||
public RawItemModel ItemFromDto(ItemDTO origItem, bool isActive)
|
||||
{
|
||||
RawItemModel answ = new RawItemModel()
|
||||
{
|
||||
MatId = origItem.MatId,
|
||||
Note = origItem.Note,
|
||||
LMm = origItem.LMm,
|
||||
WMm = origItem.WMm,
|
||||
HMm = origItem.HMm,
|
||||
IsRemn = origItem.IsRemn,
|
||||
Location = origItem.Location,
|
||||
QtyAvail = origItem.QtyAvail,
|
||||
IsActive = isActive
|
||||
};
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lista Items gestiti a magazzino
|
||||
/// </summary>
|
||||
/// <param name="nKey">Key di riferimento</param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<ItemModel>> ItemGetAll(int nKey)
|
||||
public async Task<List<RawItemModel>> ItemGetAll(int nKey)
|
||||
{
|
||||
string source = "DB";
|
||||
string cString = ConnString(nKey);
|
||||
List<ItemModel>? dbResult = new List<ItemModel>();
|
||||
List<RawItemModel>? dbResult = new List<RawItemModel>();
|
||||
try
|
||||
{
|
||||
string currKey = $"{Const.rKeyConfig}:{nKey}:ItemList";
|
||||
string currKey = $"{Const.rKeyConfig}:ItemList:{nKey}";
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
string? rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
source = "REDIS";
|
||||
var tempResult = JsonConvert.DeserializeObject<List<ItemModel>>(rawData);
|
||||
var tempResult = JsonConvert.DeserializeObject<List<RawItemModel>>(rawData);
|
||||
if (tempResult == null)
|
||||
{
|
||||
dbResult = new List<ItemModel>();
|
||||
dbResult = new List<RawItemModel>();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -116,7 +140,7 @@ namespace MagMan.Data.Tenant.Services
|
||||
}
|
||||
if (dbResult == null)
|
||||
{
|
||||
dbResult = new List<ItemModel>();
|
||||
dbResult = new List<RawItemModel>();
|
||||
}
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
@@ -135,24 +159,24 @@ namespace MagMan.Data.Tenant.Services
|
||||
/// <param name="nKey">Key di riferimento</param>
|
||||
/// <param name="matID">ID del materiale x cui filtrare, 0 = tutti</param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<ItemModel>> ItemGetByMat(int nKey, int matID)
|
||||
public async Task<List<RawItemModel>> ItemGetByMat(int nKey, int matID)
|
||||
{
|
||||
string source = "DB";
|
||||
string cString = ConnString(nKey);
|
||||
List<ItemModel>? dbResult = new List<ItemModel>();
|
||||
List<RawItemModel>? dbResult = new List<RawItemModel>();
|
||||
try
|
||||
{
|
||||
string currKey = $"{Const.rKeyConfig}:{nKey}:{matID}:ItemList";
|
||||
string currKey = $"{Const.rKeyConfig}:{nKey}:ItemList:{matID}";
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
string? rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
source = "REDIS";
|
||||
var tempResult = JsonConvert.DeserializeObject<List<ItemModel>>(rawData);
|
||||
var tempResult = JsonConvert.DeserializeObject<List<RawItemModel>>(rawData);
|
||||
if (tempResult == null)
|
||||
{
|
||||
dbResult = new List<ItemModel>();
|
||||
dbResult = new List<RawItemModel>();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -167,7 +191,7 @@ namespace MagMan.Data.Tenant.Services
|
||||
}
|
||||
if (dbResult == null)
|
||||
{
|
||||
dbResult = new List<ItemModel>();
|
||||
dbResult = new List<RawItemModel>();
|
||||
}
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
@@ -180,13 +204,35 @@ namespace MagMan.Data.Tenant.Services
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary> Update record Item + refresh cache </summary> <param name="nKey">Key di
|
||||
/// riferimento</param> <param name="currItem">Item interesato</param> <param
|
||||
/// name="deltaQty">quantità da aggiornare (se <0 è consumo)</param> <returns></returns>
|
||||
public async Task<bool> ItemModQty(int nKey, RawItemModel currItem, int deltaQty)
|
||||
{
|
||||
bool fatto = false;
|
||||
string cString = ConnString(nKey);
|
||||
try
|
||||
{
|
||||
fatto = dbController.ItemModQty(cString, currItem, deltaQty);
|
||||
if (fatto)
|
||||
{
|
||||
await FlushRedisCache();
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Error during ItemModQty:{Environment.NewLine}{exc}");
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update record Item + refresh cache
|
||||
/// </summary>
|
||||
/// <param name="nKey">Key di riferimento</param>
|
||||
/// <param name="currItem"></param>
|
||||
/// <param name="currItem">Item interesato</param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> ItemUpdate(int nKey, ItemModel currItem)
|
||||
public async Task<bool> ItemUpdate(int nKey, RawItemModel currItem)
|
||||
{
|
||||
bool fatto = false;
|
||||
string cString = ConnString(nKey);
|
||||
@@ -230,19 +276,41 @@ namespace MagMan.Data.Tenant.Services
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converte il DTO in MaterialModel
|
||||
/// </summary>
|
||||
/// <param name="origItem"></param>
|
||||
/// <returns></returns>
|
||||
public MaterialModel MaterialFromDto(MaterialDTO origItem)
|
||||
{
|
||||
MaterialModel answ = new MaterialModel()
|
||||
{
|
||||
MatId = origItem.MatId,
|
||||
MatCode = origItem.MatCode,
|
||||
MatDesc = origItem.MatDesc,
|
||||
LMm = origItem.LMm,
|
||||
WMm = origItem.WMm,
|
||||
HMm = origItem.HMm
|
||||
};
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lista Materiali gestiti a magazzino
|
||||
/// </summary>
|
||||
/// <param name="nKey">Key di riferimento</param>
|
||||
/// <param name="withChild">Se true allora include record child (Items)</param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<MaterialModel>> MaterialGetAll(int nKey)
|
||||
public async Task<List<MaterialModel>> MaterialGetAll(int nKey, bool withChild)
|
||||
{
|
||||
string source = "DB";
|
||||
string cString = ConnString(nKey);
|
||||
List<MaterialModel>? dbResult = new List<MaterialModel>();
|
||||
try
|
||||
{
|
||||
string currKey = $"{Const.rKeyConfig}:{nKey}:Materials";
|
||||
string dType = withChild ? "MaterialsFull" : "Materials";
|
||||
string currKey = $"{Const.rKeyConfig}:{dType}:{nKey}";
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
string? rawData = await redisDb.StringGetAsync(currKey);
|
||||
@@ -261,9 +329,15 @@ namespace MagMan.Data.Tenant.Services
|
||||
}
|
||||
else
|
||||
{
|
||||
dbResult = dbController.MaterialGetAll(cString);
|
||||
dbResult = dbController.MaterialGetAll(cString, withChild);
|
||||
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
|
||||
await redisDb.StringSetAsync(currKey, rawData, LongCache);
|
||||
// per evitare loopback uso deserialize...
|
||||
var tempResult = JsonConvert.DeserializeObject<List<MaterialModel>>(rawData);
|
||||
if (tempResult != null)
|
||||
{
|
||||
dbResult = tempResult;
|
||||
}
|
||||
}
|
||||
if (dbResult == null)
|
||||
{
|
||||
@@ -280,6 +354,65 @@ namespace MagMan.Data.Tenant.Services
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lista Materiali gestiti a magazzino
|
||||
/// </summary>
|
||||
/// <param name="nKey">Key di riferimento</param>
|
||||
/// <param name="matID">Materiale richiesto</param>
|
||||
/// <param name="withChild">Se true allora include record child (Items)</param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<MaterialModel>> MaterialGetFilt(int nKey, int matID, bool withChild)
|
||||
{
|
||||
string source = "DB";
|
||||
string cString = ConnString(nKey);
|
||||
List<MaterialModel>? dbResult = new List<MaterialModel>();
|
||||
try
|
||||
{
|
||||
string dType = withChild ? "MatInvFull" : "MatInv";
|
||||
string currKey = $"{Const.rKeyConfig}:{dType}:{nKey}:{matID}";
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
string? rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (!string.IsNullOrEmpty(rawData) && rawData.Length > 2)
|
||||
{
|
||||
source = "REDIS";
|
||||
var tempResult = JsonConvert.DeserializeObject<List<MaterialModel>>(rawData);
|
||||
if (tempResult == null)
|
||||
{
|
||||
dbResult = new List<MaterialModel>();
|
||||
}
|
||||
else
|
||||
{
|
||||
dbResult = tempResult;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dbResult = dbController.MaterialGetFilt(cString, matID, withChild);
|
||||
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
|
||||
await redisDb.StringSetAsync(currKey, rawData, LongCache);
|
||||
// per evitare loopback uso deserialize...
|
||||
var tempResult = JsonConvert.DeserializeObject<List<MaterialModel>>(rawData);
|
||||
if (tempResult != null)
|
||||
{
|
||||
dbResult = tempResult;
|
||||
}
|
||||
}
|
||||
if (dbResult == null)
|
||||
{
|
||||
dbResult = new List<MaterialModel>();
|
||||
}
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"MaterialGetFilt | {source} in: {ts.TotalMilliseconds} ms");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Error during MaterialGetFilt:{Environment.NewLine}{exc}");
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update record Materiale + refresh cache
|
||||
/// </summary>
|
||||
@@ -306,24 +439,186 @@ namespace MagMan.Data.Tenant.Services
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converte il DTO in MaterialModel
|
||||
/// Elimina record Project + refresh cache
|
||||
/// </summary>
|
||||
/// <param name="origItem"></param>
|
||||
/// <param name="nKey">Key di riferimento</param>
|
||||
/// <param name="rec2del">Item da eliminare</param>
|
||||
/// <returns></returns>
|
||||
public MaterialModel MaterialFromDto(MaterialDTO origItem)
|
||||
public async Task<bool> ProjectDelete(int nKey, ProjModel rec2del)
|
||||
{
|
||||
MaterialModel answ = new MaterialModel()
|
||||
bool fatto = false;
|
||||
string cString = ConnString(nKey);
|
||||
try
|
||||
{
|
||||
MatExtCode = origItem.MatExtCode,
|
||||
MatDesc = origItem.MatDesc,
|
||||
LMm = origItem.LMm,
|
||||
WMm = origItem.WMm,
|
||||
TMm = origItem.TMm
|
||||
fatto = dbController.ProjectDelete(cString, rec2del);
|
||||
if (fatto)
|
||||
{
|
||||
await FlushRedisCache();
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Error during ProjectDelete:{Environment.NewLine}{exc}");
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converte il DTO in ItemModel
|
||||
/// </summary>
|
||||
/// <param name="origItem">DTO di partenza</param>
|
||||
/// <returns></returns>
|
||||
public ProjModel ProjectFromDto(ProjectDTO origItem)
|
||||
{
|
||||
ProjModel answ = new ProjModel()
|
||||
{
|
||||
MachineID = origItem.MachineID,
|
||||
KeyNum = origItem.KeyNum,
|
||||
ProjExtDbId = origItem.ProjExtDbId,
|
||||
ProjExtId = origItem.ProjExtId,
|
||||
BTLFileName = origItem.BTLFileName,
|
||||
PType = origItem.PType,
|
||||
Machine = origItem.Machine,
|
||||
ProjDescription = origItem.ProjDescription,
|
||||
DtCreated = origItem.DtCreated,
|
||||
DtLastAction = origItem.DtLastAction,
|
||||
DtSchedule = origItem.DtSchedule,
|
||||
DtStartProd = origItem.DtStartProd,
|
||||
ListName = origItem.ListName,
|
||||
ProcTimeEst = origItem.ProcTimeEst,
|
||||
ProcTimeReal = origItem.ProcTimeReal,
|
||||
IsActive = origItem.IsActive,
|
||||
IsArchived = origItem.IsArchived
|
||||
};
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lista Projects gestiti a magazzino
|
||||
/// </summary>
|
||||
/// <param name="nKey">Key di riferimento</param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<ProjModel>> ProjectGetAll(int nKey)
|
||||
{
|
||||
string source = "DB";
|
||||
string cString = ConnString(nKey);
|
||||
List<ProjModel>? dbResult = new List<ProjModel>();
|
||||
try
|
||||
{
|
||||
string currKey = $"{Const.rKeyConfig}:ProjList:{nKey}";
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
string? rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
source = "REDIS";
|
||||
var tempResult = JsonConvert.DeserializeObject<List<ProjModel>>(rawData);
|
||||
if (tempResult == null)
|
||||
{
|
||||
dbResult = new List<ProjModel>();
|
||||
}
|
||||
else
|
||||
{
|
||||
dbResult = tempResult;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dbResult = dbController.ProjectGetAll(cString);
|
||||
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
|
||||
await redisDb.StringSetAsync(currKey, rawData, LongCache);
|
||||
}
|
||||
if (dbResult == null)
|
||||
{
|
||||
dbResult = new List<ProjModel>();
|
||||
}
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"ProjectGetAll | {source} in: {ts.TotalMilliseconds} ms");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Error during ProjectGetAll:{Environment.NewLine}{exc}");
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lista Items gestiti a magazzino x materiale
|
||||
/// </summary>
|
||||
/// <param name="nKey">Key di riferimento</param>
|
||||
/// <param name="numKey">ID del materiale x cui filtrare, 0 = tutti</param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<ProjModel>> ProjectGetByNumKey(int nKey, int numKey)
|
||||
{
|
||||
string source = "DB";
|
||||
string cString = ConnString(nKey);
|
||||
List<ProjModel>? dbResult = new List<ProjModel>();
|
||||
try
|
||||
{
|
||||
string currKey = $"{Const.rKeyConfig}:{nKey}:ProjList:{numKey}";
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
string? rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
source = "REDIS";
|
||||
var tempResult = JsonConvert.DeserializeObject<List<ProjModel>>(rawData);
|
||||
if (tempResult == null)
|
||||
{
|
||||
dbResult = new List<ProjModel>();
|
||||
}
|
||||
else
|
||||
{
|
||||
dbResult = tempResult;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dbResult = dbController.ProjectGetByNumKey(cString, numKey);
|
||||
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
|
||||
await redisDb.StringSetAsync(currKey, rawData, LongCache);
|
||||
}
|
||||
if (dbResult == null)
|
||||
{
|
||||
dbResult = new List<ProjModel>();
|
||||
}
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"ProjectGetByNumKey | {source} in: {ts.TotalMilliseconds} ms");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Error during ProjectGetByNumKey:{Environment.NewLine}{exc}");
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update record Item + refresh cache
|
||||
/// </summary>
|
||||
/// <param name="nKey">Key di riferimento</param>
|
||||
/// <param name="currItem">Item interesato</param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> ProjectUpdate(int nKey, ProjModel currItem)
|
||||
{
|
||||
bool fatto = false;
|
||||
string cString = ConnString(nKey);
|
||||
try
|
||||
{
|
||||
fatto = dbController.ProjectUpdate(cString, currItem);
|
||||
if (fatto)
|
||||
{
|
||||
await FlushRedisCache();
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Error during ProjectUpdate:{Environment.NewLine}{exc}");
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
@@ -370,42 +665,6 @@ namespace MagMan.Data.Tenant.Services
|
||||
return answ;
|
||||
}
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Dizionario dei token 2 connectionStrings
|
||||
/// </summary>
|
||||
private Dictionary<string, string> TokenList { get; set; } = new Dictionary<string, string>();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Recupera ConnectionString dal dizionario dei token noti o cercando sul DB
|
||||
/// </summary>
|
||||
/// <param name="RestToken"></param>
|
||||
/// <returns></returns>
|
||||
public string ConnStringByToken(string RestToken)
|
||||
{
|
||||
string answ = "";
|
||||
if (TokenList.ContainsKey(RestToken))
|
||||
{
|
||||
answ = TokenList[RestToken];
|
||||
}
|
||||
else
|
||||
{
|
||||
// cerco nel DB
|
||||
var custList = dbController.CustomerGetAll();
|
||||
var custRow = custList.FirstOrDefault(x => x.RestToken == RestToken);
|
||||
// se trovato salvo
|
||||
if (custRow != null)
|
||||
{
|
||||
answ = DbConfig.CustomerConnString(DbServerAddr, nKey);
|
||||
TokenList.Add(RestToken, answ);
|
||||
Log.Info($"TokenList: added {RestToken} --> {answ}");
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<div class="input-group">
|
||||
<label class="input-group-text">Cliente</label>
|
||||
<select class="form-select" @bind="@CustomerID">
|
||||
<option value="0">--- Selezionare Cliente ---</option>
|
||||
@if (CustomersList != null)
|
||||
{
|
||||
@foreach (var item in CustomersList)
|
||||
{
|
||||
<option value="@item.CustomerID">@item.Name [@item.CustomerID]</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
using MagMan.Core.Services;
|
||||
using MagMan.Data.Admin.DbModels;
|
||||
using MagMan.Data.Admin.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace MagMan.UI.Components
|
||||
{
|
||||
public partial class CmpSelCliente
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> E_CustSelected { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMService { get; set; } = null!;
|
||||
|
||||
protected int CustomerID
|
||||
{
|
||||
get => customerID;
|
||||
set
|
||||
{
|
||||
if (customerID != value)
|
||||
{
|
||||
customerID = value;
|
||||
E_CustSelected.InvokeAsync(value);
|
||||
InvokeAsync(() => AppMService.ClientIdSet(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Inject]
|
||||
protected MTAdminService MTService { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
CustomerID = await AppMService.ClientIdGet();
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task ReloadData()
|
||||
{
|
||||
CustomersList = await MTService.CustomerGetAll();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private int customerID = 0;
|
||||
|
||||
private List<CustomerModel>? CustomersList = null;
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,4 @@
|
||||
@using MagMan.UI.Components
|
||||
@using System.Security.Claims
|
||||
@using Microsoft.AspNetCore.Components.Authorization
|
||||
|
||||
@inject MessageService AppMessages
|
||||
|
||||
<div class="row pt-3">
|
||||
<div class="row pt-3">
|
||||
<div class="col-7 col-md-6 col-lg-4 col-xl-3">
|
||||
<LoginDisplay></LoginDisplay>
|
||||
</div>
|
||||
|
||||
@@ -1,22 +1,13 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MagMan.UI.Components;
|
||||
using System.Security.Claims;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using MagMan.Core.Services;
|
||||
|
||||
namespace MagMan.UI.Components
|
||||
{
|
||||
public partial class CmpTop
|
||||
{
|
||||
#region Private Properties
|
||||
|
||||
private string PageIcon { get; set; } = "";
|
||||
|
||||
private string PageName { get; set; } = "";
|
||||
|
||||
[CascadingParameter(Name = "ShowSearch")]
|
||||
private bool ShowSearch { get; set; } = false;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
@@ -36,6 +27,13 @@ namespace MagMan.UI.Components
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMessages { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override void OnInitialized()
|
||||
@@ -49,5 +47,16 @@ namespace MagMan.UI.Components
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private string PageIcon { get; set; } = "";
|
||||
|
||||
private string PageName { get; set; } = "";
|
||||
|
||||
[CascadingParameter(Name = "ShowSearch")]
|
||||
private bool ShowSearch { get; set; } = false;
|
||||
|
||||
#endregion Private Properties
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,19 @@
|
||||
@if (CurrRecord != null)
|
||||
{
|
||||
<div class="row g-1">
|
||||
<div class="col-md-7">
|
||||
<div class="col-md-6">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.Name">
|
||||
<label class="small">Nome</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-2">
|
||||
<div class="form-floating">
|
||||
<input type="number" class="form-control" @bind="@CurrRecord.MainKey">
|
||||
<label class="small">MainKey</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-floating">
|
||||
<input type="date" class="form-control" @bind="@CurrRecord.DtActivation">
|
||||
<label class="small">Data</label>
|
||||
@@ -29,7 +35,7 @@
|
||||
<label class="small">Note</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-9 pt-2">
|
||||
<div class="col-md-3 pt-2">
|
||||
<button class="btn btn-success w-100" @onclick="() => DoSave()"><i class="fa-solid fa-floppy-disk"></i> Save</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
@if (CurrRecord != null)
|
||||
{
|
||||
<div class="row g-1">
|
||||
<div class="col-md-8">
|
||||
<div class="input-group">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.QtyAvail">
|
||||
<label class="small">Giacenza</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.Note">
|
||||
<label class="small">Note</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.Location">
|
||||
<label class="small">Posizone</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="d-flex">
|
||||
<div class="input-group">
|
||||
@if (CurrRecord.MaterialNav.IsWall)
|
||||
{
|
||||
<div class="form-floating">
|
||||
<NumInput CssClass="form-control" DisplFormat="0.00" @bind-Value="@CurrRecord.WMm"></NumInput>
|
||||
<label class="small">W (mm)</label>
|
||||
</div>
|
||||
}
|
||||
@* <div class="form-floating">
|
||||
<NumInput CssClass="form-control" DisplFormat="0.00" Value="@CurrRecord.HMm"></NumInput>
|
||||
<label class="small">H (mm)</label>
|
||||
</div> *@
|
||||
<div class="form-floating">
|
||||
<NumInput CssClass="form-control" DisplFormat="0.00" @bind-Value="@CurrRecord.LMm"></NumInput>
|
||||
<label class="small">L (mm)</label>
|
||||
</div>
|
||||
<button class="btn btn-success w-10" @onclick="() => DoSave()"><i class="fa-solid fa-floppy-disk"></i> Save</button>
|
||||
@* <button class="btn btn-warning w-10" @onclick="() => DoCancel()"><i class="fa-solid fa-ban"></i> Cancel</button> *@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using MagMan.Data.Tenant.DbModels;
|
||||
using MagMan.Data.Tenant.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace MagMan.UI.Components
|
||||
{
|
||||
public partial class ItemEdit
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public RawItemModel? CurrRecord { get; set; } = null;
|
||||
|
||||
[Parameter]
|
||||
public int KeyNum { get; set; } = 0;
|
||||
[Parameter]
|
||||
public EventCallback<bool> EC_update { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected TenantService TService { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected async Task DoSave()
|
||||
{
|
||||
bool fatto = false;
|
||||
await Task.Delay(1);
|
||||
if (CurrRecord != null)
|
||||
{
|
||||
fatto = await TService.ItemUpdate(KeyNum, CurrRecord);
|
||||
}
|
||||
if (fatto)
|
||||
{
|
||||
await EC_update.InvokeAsync(true);
|
||||
}
|
||||
}
|
||||
protected async Task DoCancel()
|
||||
{
|
||||
await EC_update.InvokeAsync(true);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,117 @@
|
||||
<h3>ItemMan</h3>
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-2">
|
||||
<h3>Articoli</h3>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<div class="d-flex">
|
||||
<div class="px-2">
|
||||
@if (CurrItem == null)
|
||||
{
|
||||
<button class="btn btn-success" @onclick="()=>CreateNew()"><i class="fa-solid fa-square-plus"></i> Add New</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-warning" @onclick="()=> DoEdit(null)"><i class="fa-solid fa-ban"></i> Cancel</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@if (CurrItem != null)
|
||||
{
|
||||
<hr />
|
||||
<ItemEdit CurrRecord="CurrItem" EC_update="ForceReload"></ItemEdit>
|
||||
}
|
||||
</div>
|
||||
<div class="card-body p-1">
|
||||
@if (ListRecords == null || isLoading)
|
||||
{
|
||||
<EgwCoreLib.Razor.LoadingData></EgwCoreLib.Razor.LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-info">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table table-striped table-sm text-start">
|
||||
<thead>
|
||||
<tr class="">
|
||||
<th>
|
||||
<button class="btn btn-primary btn-sm" @onclick="() => DoEdit(null)"><i class="fa-solid fa-rotate"></i></button>
|
||||
</th>
|
||||
<th class="text-end">Qty <Sorter ParamName="Qty" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>ID <Sorter ParamName="RawItemId" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>Note <Sorter ParamName="Note" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>Posizione <Sorter ParamName="Location" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
@if (MaterialSel.IsWall)
|
||||
{
|
||||
<th class="text-end">W (mm) <Sorter ParamName="W" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
}
|
||||
@* <th class="text-end">H (mm) <Sorter ParamName="H" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th> *@
|
||||
<th class="text-end">L (mm) <Sorter ParamName="L" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
@* <th class="text-end"></th> *@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in ListRecords)
|
||||
{
|
||||
<tr class="align-middle @CheckSel(item)">
|
||||
<td>
|
||||
@* <button class="btn btn-info btn-sm" @onclick="() => DoSelect(item)"><i class="fa-solid fa-search"></i></button> *@
|
||||
<button class="btn btn-primary btn-sm" @onclick="() => DoEdit(item)"><i class="fa-solid fa-edit"></i></button>
|
||||
</td>
|
||||
<td class="text-end fs-5">
|
||||
<b>@item.QtyAvail</b>
|
||||
</td>
|
||||
<td>
|
||||
@if (item.IsActive)
|
||||
{
|
||||
<span class="border border-primary rounded px-1">
|
||||
<i class="fa-regular fa-thumbs-up"></i>
|
||||
</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="border border-info rounded px-1">
|
||||
<i class="fa-regular fa-thumbs-down"></i>
|
||||
</span>
|
||||
}
|
||||
@item.RawItemId
|
||||
</td>
|
||||
<td>
|
||||
@item.Note
|
||||
</td>
|
||||
<td>
|
||||
@item.Location
|
||||
</td>
|
||||
@if (MaterialSel.IsWall)
|
||||
{
|
||||
<td class="text-end">
|
||||
@($"{item.WMm:N2}")
|
||||
</td>
|
||||
}
|
||||
@* <td class="text-end">
|
||||
@($"{item.HMm:N2}")
|
||||
</td> *@
|
||||
<td class="text-end">
|
||||
@($"{item.LMm:N2}")
|
||||
</td>
|
||||
@* <td class="text-end">
|
||||
<button class="btn btn-sm btn-danger" @onclick="() => DeleteRecord(item)"><i class="fa-solid fa-trash-can"></i></button>
|
||||
</td> *@
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<EgwCoreLib.Razor.DataPager PageSize="@numRecord" currPage="@currPage" numRecordChanged="SetNumRec" numPageChanged="SetPage" totalCount="@totalCount" showLoading="@isLoading"></EgwCoreLib.Razor.DataPager>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,346 @@
|
||||
using EgwCoreLib.Razor;
|
||||
using MagMan.Core.Services;
|
||||
using MagMan.Data.Tenant.DbModels;
|
||||
using MagMan.Data.Tenant.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
|
||||
namespace MagMan.UI.Components
|
||||
{
|
||||
public partial class ItemMan
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public int CustomerId { get; set; } = 0;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> E_RawItemSel { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public int KeyNum { get; set; } = 0;
|
||||
|
||||
[Parameter]
|
||||
public MaterialModel MaterialSel { get; set; } = null!;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected IConfiguration Configuration { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
protected int totalCount { get; set; } = 0;
|
||||
|
||||
[Inject]
|
||||
protected TenantService TService { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected string CheckSel(RawItemModel curItem)
|
||||
{
|
||||
string answ = "";
|
||||
if (CurrItem != null)
|
||||
{
|
||||
answ = curItem.RawItemId == CurrItem.RawItemId ? "table-info" : "";
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = curItem.RawItemId == RawItemId ? "table-info" : "";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
|
||||
protected async Task CreateNew()
|
||||
{
|
||||
CurrItem = new RawItemModel()
|
||||
{
|
||||
MatId = MaterialSel.MatId,
|
||||
Location = "nd",
|
||||
Note = "...",
|
||||
QtyAvail = 0,
|
||||
IsActive = true,
|
||||
IsRemn = false,
|
||||
HMm = MaterialSel.HMm,
|
||||
LMm = MaterialSel.LMm,
|
||||
WMm = MaterialSel.WMm
|
||||
};
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
protected async Task DeleteRecord(RawItemModel selItem)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler eliminare il record?"))
|
||||
return;
|
||||
await TService.ItemDelete(KeyNum, selItem);
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected void DoEdit(RawItemModel? selItem)
|
||||
{
|
||||
CurrItem = selItem;
|
||||
if (selItem == null)
|
||||
{
|
||||
DoSelect(null);
|
||||
}
|
||||
}
|
||||
|
||||
protected void DoSelect(RawItemModel? selItem)
|
||||
{
|
||||
if (selItem != null)
|
||||
{
|
||||
RawItemId = selItem.MatId;
|
||||
}
|
||||
else
|
||||
{
|
||||
RawItemId = 0;
|
||||
}
|
||||
E_RawItemSel.InvokeAsync(RawItemId);
|
||||
}
|
||||
|
||||
protected async Task ForceReload(bool force)
|
||||
{
|
||||
CurrItem = null;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
currSearch = "";
|
||||
AppMService.EA_SearchUpdated += AppMService_EA_SearchUpdated;
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
CurrItem = null;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected void SetNumRec(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
currPage = 1;
|
||||
InvokeAsync(ReloadData);
|
||||
}
|
||||
|
||||
protected void SetPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
InvokeAsync(ReloadData);
|
||||
}
|
||||
|
||||
protected async Task SortRequested(Sorter.SortCallBack e)
|
||||
{
|
||||
sortField = e.ParamName;
|
||||
sortAsc = e.IsAscending;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private RawItemModel? CurrItem = null;
|
||||
private string currSearch = "";
|
||||
private int filtType = 0;
|
||||
private List<RawItemModel>? ListRecords = null;
|
||||
private int RawItemId = 0;
|
||||
private List<RawItemModel>? SearchRecords = null;
|
||||
|
||||
private bool sortAsc = true;
|
||||
|
||||
private string sortField = "";
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int currPage { get; set; } = 1;
|
||||
|
||||
private int FiltType
|
||||
{
|
||||
get => filtType;
|
||||
set
|
||||
{
|
||||
if (filtType != value)
|
||||
{
|
||||
filtType = value;
|
||||
InvokeAsync(ReloadData);
|
||||
InvokeAsync(StateHasChanged);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private int numRecord { get; set; } = 10;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async void AppMService_EA_SearchUpdated()
|
||||
{
|
||||
currSearch = AppMService.SearchVal;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
ListRecords = null;
|
||||
SearchRecords = await TService.ItemGetByMat(KeyNum, MaterialSel.MatId);
|
||||
// verifico filtro per ricerca
|
||||
if (!string.IsNullOrEmpty(currSearch))
|
||||
{
|
||||
SearchRecords = SearchRecords.Where(x => x.Note.Contains(currSearch, StringComparison.InvariantCultureIgnoreCase)).ToList();
|
||||
}
|
||||
totalCount = SearchRecords.Count;
|
||||
SortTable();
|
||||
isLoading = false;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private void SortTable()
|
||||
{
|
||||
if (SearchRecords != null)
|
||||
{
|
||||
// se ho ordinamento riordino...
|
||||
if (!string.IsNullOrEmpty(sortField))
|
||||
{
|
||||
switch (sortField)
|
||||
{
|
||||
case "RawItemId":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.RawItemId).ThenBy(x => x.Note).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.RawItemId).ThenByDescending(x => x.Note).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "Location":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.Location).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.Location).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "QtyAvail":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.QtyAvail).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.QtyAvail).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "Note":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.Note).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.Note).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "IsActive":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.IsActive).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.IsActive).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "IsRemn":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.IsRemn).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.IsRemn).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "W":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.WMm).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.WMm).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "H":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.HMm).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.HMm).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "L":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.LMm).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.LMm).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// filtro x display
|
||||
ListRecords = SearchRecords
|
||||
.Skip(numRecord * (currPage - 1))
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
ListRecords = new List<RawItemModel>();
|
||||
}
|
||||
}
|
||||
|
||||
private string textCss(bool isActive)
|
||||
{
|
||||
return isActive ? "text-dark" : "text-secondary text-decoration-line-through";
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -101,30 +101,6 @@ namespace MagMan.UI.Components
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#if false
|
||||
protected async Task CreateDb(MachineModel currRec)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
bool dbOk = Data.Admin.DbConfig.CheckCustDb(currRec.MainKey);
|
||||
if (!dbOk)
|
||||
{
|
||||
dbOk = Data.Admin.DbConfig.CheckCustDb(currRec.MainKey);
|
||||
}
|
||||
// se ok --> migration...
|
||||
if (dbOk || true)
|
||||
{
|
||||
string dbServerAddr = Configuration["DbConfig:Server"];
|
||||
Data.Tenant.DbConfig.InitDb(dbServerAddr, currRec.MainKey);
|
||||
// verifico se serve applicazione migrazioni
|
||||
Data.Tenant.DbConfig.ExecMigrationMain();
|
||||
}
|
||||
// aggiorno comunque status DB...
|
||||
currRec.HasDb = dbOk;
|
||||
await MTService.MachineUpdate(currRec);
|
||||
await ReloadData();
|
||||
}
|
||||
#endif
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private MachineModel? CurrItem = null;
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
@if (CurrRecord != null)
|
||||
{
|
||||
<div class="row g-1">
|
||||
<div class="col-md-6">
|
||||
<div class="input-group">
|
||||
<div class="form-floating w-25">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.MatCode">
|
||||
<label class="small">Codice</label>
|
||||
</div>
|
||||
<div class="form-floating w-75">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.MatDesc">
|
||||
<label class="small">Descrizione</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="d-flex">
|
||||
<div class="input-group">
|
||||
<div class="form-floating">
|
||||
<NumInput CssClass="form-control" DisplFormat="0.00" Value="@CurrRecord.WMm"></NumInput>
|
||||
<label class="small">W (mm)</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<NumInput CssClass="form-control" DisplFormat="0.00" Value="@CurrRecord.HMm"></NumInput>
|
||||
<label class="small">H (mm)</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<NumInput CssClass="form-control" DisplFormat="0.00" Value="@CurrRecord.LMm"></NumInput>
|
||||
<label class="small">L (mm)</label>
|
||||
</div>
|
||||
<button class="btn btn-success w-10" @onclick="() => DoSave()"><i class="fa-solid fa-floppy-disk"></i> Save</button>
|
||||
@* <button class="btn btn-warning w-10" @onclick="() => DoCancel()"><i class="fa-solid fa-ban"></i> Cancel</button> *@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
using MagMan.Data.Admin.DbModels;
|
||||
using MagMan.Data.Admin.Services;
|
||||
using MagMan.Data.Tenant.DbModels;
|
||||
using MagMan.Data.Tenant.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace MagMan.UI.Components
|
||||
{
|
||||
public partial class MaterialEdit
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public MaterialModel? CurrRecord { get; set; } = null;
|
||||
|
||||
[Parameter]
|
||||
public int KeyNum { get; set; } = 0;
|
||||
[Parameter]
|
||||
public EventCallback<bool> EC_update { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected TenantService TService { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected async Task DoSave()
|
||||
{
|
||||
bool fatto = false;
|
||||
await Task.Delay(1);
|
||||
if (CurrRecord != null)
|
||||
{
|
||||
fatto = await TService.MaterialUpdate(KeyNum, CurrRecord);
|
||||
}
|
||||
if (fatto)
|
||||
{
|
||||
await EC_update.InvokeAsync(true);
|
||||
}
|
||||
}
|
||||
protected async Task DoCancel()
|
||||
{
|
||||
await EC_update.InvokeAsync(true);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,124 @@
|
||||
<h3>MaterialMan</h3>
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-2">
|
||||
<h3>Materiali</h3>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<div class="d-flex">
|
||||
<div class="px-2">
|
||||
@if (CurrItem == null)
|
||||
{
|
||||
<button class="btn btn-success" @onclick="()=>CreateNew()"><i class="fa-solid fa-square-plus"></i> Add New</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-warning" @onclick="()=> DoEdit(null)"><i class="fa-solid fa-ban"></i> Cancel</button>
|
||||
}
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<div class="input-group">
|
||||
<span class="input-group-text" id="basic-addon1">Tipo Mat.</span>
|
||||
<select class="form-select" @bind="@FiltType">
|
||||
<option value="0">--- Tutti ---</option>
|
||||
<option value="1">Beam</option>
|
||||
<option value="2">Wall</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@if (CurrItem != null)
|
||||
{
|
||||
<hr />
|
||||
<MaterialEdit CurrRecord="CurrItem" EC_update="ForceReload"></MaterialEdit>
|
||||
}
|
||||
</div>
|
||||
<div class="card-body p-1">
|
||||
@if (ListRecords == null || isLoading)
|
||||
{
|
||||
<EgwCoreLib.Razor.LoadingData></EgwCoreLib.Razor.LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-info">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table table-striped table-sm text-start">
|
||||
<thead>
|
||||
<tr class="">
|
||||
<th>
|
||||
<button class="btn btn-primary btn-sm" @onclick="() => DoEdit(null)"><i class="fa-solid fa-rotate"></i></button>
|
||||
</th>
|
||||
<th>ID <Sorter ParamName="MatId" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>Mat.Code <Sorter ParamName="MatCode" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>Descr. <Sorter ParamName="MatDesc" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th class="text-end">W (mm) <Sorter ParamName="W" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th class="text-end">H (mm) <Sorter ParamName="H" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
@* <th class="text-end">L (mm) <Sorter ParamName="L" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th> *@
|
||||
@* <th class="text-end"></th> *@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in ListRecords)
|
||||
{
|
||||
<tr class="align-middle @CheckSel(item)">
|
||||
<td>
|
||||
<button class="btn btn-info btn-sm" @onclick="() => DoSelect(item)"><i class="fa-solid fa-search"></i></button>
|
||||
<button class="btn btn-primary btn-sm" @onclick="() => DoEdit(item)"><i class="fa-solid fa-edit"></i></button>
|
||||
</td>
|
||||
<td>
|
||||
@if (item.IsBeam)
|
||||
{
|
||||
<span class="border border-primary rounded px-1">
|
||||
<i class="fa-solid fa-lines-leaning"></i>
|
||||
</span>
|
||||
}
|
||||
else if (@item.IsWall)
|
||||
{
|
||||
<span class="border border-info rounded px-1">
|
||||
<i class="fa-solid fa-draw-polygon"></i>
|
||||
</span>
|
||||
}
|
||||
@item.MatId
|
||||
</td>
|
||||
<td>
|
||||
@item.MatCode
|
||||
</td>
|
||||
<td>
|
||||
@item.MatDesc
|
||||
</td>
|
||||
<td class="text-end">
|
||||
@if (item.IsBeam)
|
||||
{
|
||||
@($"{item.WMm:N2}")
|
||||
}
|
||||
else
|
||||
{
|
||||
<span>-</span>
|
||||
}
|
||||
</td>
|
||||
<td class="text-end">
|
||||
@($"{item.HMm:N2}")
|
||||
</td>
|
||||
@* <td class="text-end">
|
||||
@($"{item.LMm:N2}")
|
||||
</td> *@
|
||||
@* <td class="text-end">
|
||||
<button class="btn btn-sm btn-danger" @onclick="() => DeleteRecord(item)"><i class="fa-solid fa-trash-can"></i></button>
|
||||
</td> *@
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<EgwCoreLib.Razor.DataPager PageSize="@numRecord" currPage="@currPage" numRecordChanged="SetNumRec" numPageChanged="SetPage" totalCount="@totalCount" showLoading="@isLoading"></EgwCoreLib.Razor.DataPager>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,313 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this
|
||||
// file to you under the MIT license.
|
||||
using EgwCoreLib.Razor;
|
||||
using MagMan.Core.Services;
|
||||
using MagMan.Data.Admin.DbModels;
|
||||
using MagMan.Data.Admin.Services;
|
||||
using MagMan.Data.Tenant.DbModels;
|
||||
using MagMan.Data.Tenant.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MimeKit.Text;
|
||||
|
||||
namespace MagMan.UI.Components
|
||||
{
|
||||
public partial class MaterialMan
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public int CustomerId { get; set; } = 0;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<MaterialModel?> E_MaterialSel { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public int KeyNum { get; set; } = 0;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected IConfiguration Configuration { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
protected int totalCount { get; set; } = 0;
|
||||
|
||||
[Inject]
|
||||
protected TenantService TService { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected string CheckSel(MaterialModel curItem)
|
||||
{
|
||||
string answ = "";
|
||||
if (CurrItem != null)
|
||||
{
|
||||
answ = curItem.MatId == CurrItem.MatId ? "table-info" : "";
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = curItem.MatId == MaterialId ? "table-info" : "";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected async Task CreateNew()
|
||||
{
|
||||
CurrItem = new MaterialModel()
|
||||
{
|
||||
MatCode = "Mat_unique_code",
|
||||
MatDesc = "Material Description"
|
||||
};
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
protected async Task DeleteRecord(MaterialModel selItem)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler eliminare il record?"))
|
||||
return;
|
||||
await TService.MaterialDelete(KeyNum, selItem);
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected void DoEdit(MaterialModel? selItem)
|
||||
{
|
||||
CurrItem = selItem;
|
||||
if (selItem == null)
|
||||
{
|
||||
DoSelect(null);
|
||||
}
|
||||
}
|
||||
protected void DoSelect(MaterialModel? selItem)
|
||||
{
|
||||
if (selItem != null)
|
||||
{
|
||||
MaterialId = selItem.MatId;
|
||||
}
|
||||
else
|
||||
{
|
||||
MaterialId = 0;
|
||||
}
|
||||
E_MaterialSel.InvokeAsync(selItem);
|
||||
}
|
||||
|
||||
protected async Task ForceReload(bool force)
|
||||
{
|
||||
CurrItem = null;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
currSearch = "";
|
||||
AppMService.EA_SearchUpdated += AppMService_EA_SearchUpdated;
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected void SetNumRec(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
currPage = 1;
|
||||
InvokeAsync(ReloadData);
|
||||
}
|
||||
|
||||
protected void SetPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
DoSelect(null);
|
||||
InvokeAsync(ReloadData);
|
||||
}
|
||||
|
||||
protected async Task SortRequested(Sorter.SortCallBack e)
|
||||
{
|
||||
sortField = e.ParamName;
|
||||
sortAsc = e.IsAscending;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private MaterialModel? CurrItem = null;
|
||||
private int MaterialId = 0;
|
||||
|
||||
private string currSearch = "";
|
||||
private int filtType = 0;
|
||||
private List<MaterialModel>? ListRecords = null;
|
||||
|
||||
private List<MaterialModel>? SearchRecords = null;
|
||||
|
||||
private bool sortAsc = true;
|
||||
|
||||
private string sortField = "";
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int currPage { get; set; } = 1;
|
||||
|
||||
private int FiltType
|
||||
{
|
||||
get => filtType;
|
||||
set
|
||||
{
|
||||
if (filtType != value)
|
||||
{
|
||||
filtType = value;
|
||||
InvokeAsync(ReloadData);
|
||||
InvokeAsync(StateHasChanged);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private int numRecord { get; set; } = 10;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async void AppMService_EA_SearchUpdated()
|
||||
{
|
||||
currSearch = AppMService.SearchVal;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
ListRecords = null;
|
||||
SearchRecords = await TService.MaterialGetAll(KeyNum, false);
|
||||
// verifico se filtrare x beam/wall
|
||||
if (FiltType > 0)
|
||||
{
|
||||
SearchRecords = SearchRecords.Where(x => (x.IsBeam && FiltType == 1) || (x.IsWall && FiltType == 2)).ToList();
|
||||
}
|
||||
// verifico filtro per ricerca
|
||||
if (!string.IsNullOrEmpty(currSearch))
|
||||
{
|
||||
SearchRecords = SearchRecords.Where(x => x.MatCode.Contains(currSearch, StringComparison.InvariantCultureIgnoreCase) || x.MatDesc.Contains(currSearch, StringComparison.InvariantCultureIgnoreCase)).ToList();
|
||||
}
|
||||
totalCount = SearchRecords.Count;
|
||||
SortTable();
|
||||
isLoading = false;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private void SortTable()
|
||||
{
|
||||
if (SearchRecords != null)
|
||||
{
|
||||
// se ho ordinamento riordino...
|
||||
if (!string.IsNullOrEmpty(sortField))
|
||||
{
|
||||
switch (sortField)
|
||||
{
|
||||
case "RawItemId":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.MatId).ThenBy(x => x.MatCode).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.MatId).ThenByDescending(x => x.MatCode).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "MatCode":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.MatCode).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.MatCode).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "MatDesc":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.MatDesc).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.MatDesc).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "W":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.WMm).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.WMm).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "H":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.HMm).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.HMm).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "L":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.LMm).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.LMm).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// filtro x display
|
||||
ListRecords = SearchRecords
|
||||
.Skip(numRecord * (currPage - 1))
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
ListRecords = new List<MaterialModel>();
|
||||
}
|
||||
}
|
||||
|
||||
private string textCss(bool isActive)
|
||||
{
|
||||
return isActive ? "text-dark" : "text-secondary text-decoration-line-through";
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,6 @@
|
||||
|
||||
<div class="input-group input-group-sm">
|
||||
<input @bind-value="searchVal" @bind-value:event="oninput" type="text" class="form-control" title="Campo Ricerca" placeholder="Ricerca [ALT-R]" accesskey="R" />
|
||||
<div class="input-group-append">
|
||||
<button @onclick="reset" class="btn btn-success input-group-text">reset</button>
|
||||
</div>
|
||||
<button @onclick="reset" class="btn btn-success input-group-text">reset</button>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
using k8s.Models;
|
||||
using MagMan.Core;
|
||||
using MagMan.Core.DTO;
|
||||
using MagMan.Core.Services;
|
||||
using MagMan.Data.Admin.DbModels;
|
||||
using MagMan.Data.Admin.Services;
|
||||
using MagMan.Data.Tenant.DbModels;
|
||||
using MagMan.Data.Tenant.Services;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
using Org.BouncyCastle.Asn1.Pkcs;
|
||||
|
||||
namespace MagMan.UI.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class InventoryController : ControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Classe per logging
|
||||
/// </summary>
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private MTAdminService MTAdmService { get; set; } = null!;
|
||||
private static JsonSerializerSettings? JSSettings;
|
||||
private TenantService TService { get; set; } = null!;
|
||||
public InventoryController(MTAdminService MTDataService, TenantService TDataService)
|
||||
{
|
||||
MTAdmService = MTDataService;
|
||||
TService = TDataService;
|
||||
// json serializer... FIX errore loop circolare https://www.ryadel.com/en/jsonserializationexception-self-referencing-loop-detected-error-fix-entity-framework-asp-net-core/
|
||||
JSSettings = new JsonSerializerSettings()
|
||||
{
|
||||
ReferenceLoopHandling = ReferenceLoopHandling.Ignore
|
||||
};
|
||||
Log.Info("Avviata classe InventoryController");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Controllo status Alive
|
||||
/// GET: api/Inventory/alive
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("alive")]
|
||||
public string alive()
|
||||
{
|
||||
//Log.Debug("Chiamata alive");
|
||||
return $"OK";
|
||||
}
|
||||
|
||||
// GET api/Inventory
|
||||
[HttpGet]
|
||||
public async Task<List<RawItemModel>> Get()
|
||||
{
|
||||
// se non ho chiave --> vuoto!
|
||||
List<RawItemModel> ListRecords = new List<RawItemModel>();
|
||||
await Task.Delay(100);
|
||||
return ListRecords;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Materiali dato RestToken
|
||||
/// </summary>
|
||||
/// <param name="id">Rest Token cliente</param>
|
||||
/// <param name="MatId">ID del materiale cercato</param>
|
||||
/// <returns></returns>
|
||||
// GET api/Inventory/00000000-0000-0000-0000-000000000000
|
||||
[HttpGet("{id}")]
|
||||
public async Task<List<MaterialModel>> Get(string id, int MatId)
|
||||
{
|
||||
// in primis recupero codice chiave da token...
|
||||
int nKey = await MTAdmService.MainKeyByToken(id);
|
||||
// ora recupero direttametne i materiali
|
||||
var ListRecords = await TService.MaterialGetFilt(nKey, MatId, true);
|
||||
return ListRecords;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processa una chiamata POST per l'invio di un array Json di oggetti MaterialModel da salvare
|
||||
/// PUT: api/Inventory/upsert/00000000-0000-0000-0000-000000000000
|
||||
/// </summary>
|
||||
/// <param name="id">token comunicazione</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("upsert/{id}")]
|
||||
public async Task<string> upsert(string id, [FromBody] RestPayload.Items rawList)
|
||||
{
|
||||
string answ = "ND";
|
||||
bool fatto = false;
|
||||
// verifico ci sia valore
|
||||
if (!string.IsNullOrEmpty(id) && rawList != null && rawList.ItemList != null)
|
||||
{
|
||||
// in primis recupero codice chiave da token...
|
||||
int nKey = await MTAdmService.MainKeyByToken(id);
|
||||
if (nKey > 0)
|
||||
{
|
||||
// creo oggetti materiale da lista ricevuta
|
||||
List<RawItemModel> matList = rawList.ItemList.Select(jpl => TService.ItemFromDto(jpl, true)).ToList();
|
||||
|
||||
foreach (var item in matList)
|
||||
{
|
||||
try
|
||||
{
|
||||
await TService.ItemUpdate(nKey, item);
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"InventoryController.upsert | Errore in fase salvataggio ItemDto{Environment.NewLine}{exc}");
|
||||
fatto = false;
|
||||
}
|
||||
}
|
||||
// resetto cache redis
|
||||
await MTAdmService.FlushRedisCache();
|
||||
}
|
||||
}
|
||||
answ = fatto ? "OK" : "NO";
|
||||
return answ;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -19,12 +19,12 @@ namespace MagMan.UI.Controllers
|
||||
/// Classe per logging
|
||||
/// </summary>
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private MTAdminService MTAdminService { get; set; } = null!;
|
||||
private MTAdminService MTAdmService { get; set; } = null!;
|
||||
private static JsonSerializerSettings? JSSettings;
|
||||
private TenantService TService { get; set; } = null!;
|
||||
public MaterialsController(MTAdminService MTDataService, TenantService TDataService)
|
||||
{
|
||||
MTAdminService = MTDataService;
|
||||
MTAdmService = MTDataService;
|
||||
TService = TDataService;
|
||||
// json serializer... FIX errore loop circolare https://www.ryadel.com/en/jsonserializationexception-self-referencing-loop-detected-error-fix-entity-framework-asp-net-core/
|
||||
JSSettings = new JsonSerializerSettings()
|
||||
@@ -66,20 +66,20 @@ namespace MagMan.UI.Controllers
|
||||
public async Task<List<MaterialModel>> Get(string id)
|
||||
{
|
||||
// in primis recupero codice chiave da token...
|
||||
int nKey = await MTAdminService.MainKeyByToken(id);
|
||||
int nKey = await MTAdmService.MainKeyByToken(id);
|
||||
// ora recupero direttametne i materiali
|
||||
var ListRecords = await TService.MaterialGetAll(nKey);
|
||||
var ListRecords = await TService.MaterialGetAll(nKey, false);
|
||||
return ListRecords;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processa una chiamata POST per l'invio di un array Json di oggetti MaterialModel da salvare
|
||||
/// PUT: api/Materials/upsertMat/00000000-0000-0000-0000-000000000000
|
||||
/// PUT: api/Materials/upsert/00000000-0000-0000-0000-000000000000
|
||||
/// </summary>
|
||||
/// <param name="id">token comunicazione</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("upsertMat/{id}")]
|
||||
public async Task<string> upsertMat(string id, [FromBody] RestPayload.Materials rawList)
|
||||
[HttpPost("upsert/{id}")]
|
||||
public async Task<string> upsert(string id, [FromBody] RestPayload.Materials rawList)
|
||||
{
|
||||
string answ = "ND";
|
||||
bool fatto = false;
|
||||
@@ -87,22 +87,27 @@ namespace MagMan.UI.Controllers
|
||||
if (!string.IsNullOrEmpty(id) && rawList != null && rawList.MatList != null)
|
||||
{
|
||||
// in primis recupero codice chiave da token...
|
||||
int nKey = await MTAdminService.MainKeyByToken(id);
|
||||
// creo oggetti materiale da lista ricevuta
|
||||
List<MaterialModel> matList = rawList.MatList.Select(jpl => TService.MaterialFromDto(jpl)).ToList();
|
||||
|
||||
foreach (var item in matList)
|
||||
int nKey = await MTAdmService.MainKeyByToken(id);
|
||||
if (nKey > 0)
|
||||
{
|
||||
try
|
||||
// creo oggetti materiale da lista ricevuta
|
||||
List<MaterialModel> matList = rawList.MatList.Select(jpl => TService.MaterialFromDto(jpl)).ToList();
|
||||
|
||||
foreach (var item in matList)
|
||||
{
|
||||
await TService.MaterialUpdate(nKey, item);
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Errore in fase salvataggio MaterialDto{Environment.NewLine}{exc}");
|
||||
fatto = false;
|
||||
try
|
||||
{
|
||||
await TService.MaterialUpdate(nKey, item);
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"MaterialsController.upsert | Errore in fase salvataggio MaterialDto{Environment.NewLine}{exc}");
|
||||
fatto = false;
|
||||
}
|
||||
}
|
||||
// resetto cache redis
|
||||
await MTAdmService.FlushRedisCache();
|
||||
}
|
||||
}
|
||||
answ = fatto ? "OK" : "NO";
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
using k8s.Models;
|
||||
using MagMan.Core;
|
||||
using MagMan.Core.DTO;
|
||||
using MagMan.Data.Admin.DbModels;
|
||||
using MagMan.Data.Admin.Services;
|
||||
using MagMan.Data.Tenant.DbModels;
|
||||
using MagMan.Data.Tenant.Services;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace MagMan.UI.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class ProjectsController : ControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Classe per logging
|
||||
/// </summary>
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private MTAdminService MTAdmService { get; set; } = null!;
|
||||
private static JsonSerializerSettings? JSSettings;
|
||||
private TenantService TService { get; set; } = null!;
|
||||
public ProjectsController(MTAdminService MTDataService, TenantService TDataService)
|
||||
{
|
||||
MTAdmService = MTDataService;
|
||||
TService = TDataService;
|
||||
// json serializer... FIX errore loop circolare https://www.ryadel.com/en/jsonserializationexception-self-referencing-loop-detected-error-fix-entity-framework-asp-net-core/
|
||||
JSSettings = new JsonSerializerSettings()
|
||||
{
|
||||
ReferenceLoopHandling = ReferenceLoopHandling.Ignore
|
||||
};
|
||||
Log.Info("Avviata classe ProjectsController");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Controllo status Alive
|
||||
/// GET: api/Machines/alive
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("alive")]
|
||||
public string alive()
|
||||
{
|
||||
//Log.Debug("Chiamata alive");
|
||||
return $"OK";
|
||||
}
|
||||
|
||||
// GET api/Machines/5
|
||||
[HttpGet]
|
||||
public async Task<List<MachineModel>> Get()
|
||||
{
|
||||
// se non ho chaive --> vuoto!
|
||||
List<MachineModel> ListRecords = new List<MachineModel>();
|
||||
await Task.Delay(100);
|
||||
return ListRecords;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Macchine dato RestToken
|
||||
/// </summary>
|
||||
/// <param name="id">Rest Token cliente</param>
|
||||
/// <returns></returns>
|
||||
// GET api/Machines/2cba60c7-7be4-40b1-aa0d-52e7c71fc1a7
|
||||
[HttpGet("{id}")]
|
||||
public async Task<List<MachineModel>> Get(string id, int KeyNum)
|
||||
{
|
||||
var ListRecords = await MTAdmService.MachineGetByToken(id);
|
||||
return ListRecords;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processa una chiamata POST per l'invio di un oggetto di aggiornamento progetto
|
||||
/// PUT: api/Inventory/upsert/00000000-0000-0000-0000-000000000000
|
||||
/// </summary>
|
||||
/// <param name="id">token comunicazione</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("upsert/{id}")]
|
||||
public async Task<string> upsert(string id, [FromBody] ProjectDTO projectData)
|
||||
{
|
||||
string answ = "ND";
|
||||
bool fatto = false;
|
||||
// verifico ci sia valore
|
||||
if (!string.IsNullOrEmpty(id) && projectData != null)
|
||||
{
|
||||
// in primis recupero codice chiave da token...
|
||||
int nKey = await MTAdmService.MainKeyByToken(id);
|
||||
if (nKey > 0)
|
||||
{
|
||||
// converto ProjDto --> DB
|
||||
var currRec = TService.ProjectFromDto(projectData);
|
||||
try
|
||||
{
|
||||
await TService.ProjectUpdate(nKey, currRec);
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"ProjectsController.upsert | Errore in fase salvataggio ProjectDTO{Environment.NewLine}{exc}");
|
||||
fatto = false;
|
||||
}
|
||||
// resetto cache redis
|
||||
await MTAdmService.FlushRedisCache();
|
||||
|
||||
}
|
||||
}
|
||||
answ = fatto ? "OK" : "NO";
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
using k8s.Models;
|
||||
using MagMan.Core;
|
||||
using MagMan.Core.DTO;
|
||||
using MagMan.Data.Admin.DbModels;
|
||||
using MagMan.Data.Admin.Services;
|
||||
using MagMan.Data.Tenant.DbModels;
|
||||
using MagMan.Data.Tenant.Services;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
|
||||
namespace MagMan.UI.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class ResourcesController : ControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Classe per logging
|
||||
/// </summary>
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private MTAdminService MTAdmService { get; set; } = null!;
|
||||
private static JsonSerializerSettings? JSSettings;
|
||||
private TenantService TService { get; set; } = null!;
|
||||
public ResourcesController(MTAdminService MTDataService, TenantService TDataService)
|
||||
{
|
||||
MTAdmService = MTDataService;
|
||||
TService = TDataService;
|
||||
// json serializer... FIX errore loop circolare https://www.ryadel.com/en/jsonserializationexception-self-referencing-loop-detected-error-fix-entity-framework-asp-net-core/
|
||||
JSSettings = new JsonSerializerSettings()
|
||||
{
|
||||
ReferenceLoopHandling = ReferenceLoopHandling.Ignore
|
||||
};
|
||||
Log.Info("Avviata classe ResourcesController");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Controllo status Alive
|
||||
/// GET: api/Machines/alive
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("alive")]
|
||||
public string alive()
|
||||
{
|
||||
//Log.Debug("Chiamata alive");
|
||||
return $"OK";
|
||||
}
|
||||
|
||||
// GET api/Machines/5
|
||||
[HttpGet]
|
||||
public async Task<List<MachineModel>> Get()
|
||||
{
|
||||
// se non ho chaive --> vuoto!
|
||||
List<MachineModel> ListRecords = new List<MachineModel>();
|
||||
await Task.Delay(100);
|
||||
return ListRecords;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Macchine dato RestToken
|
||||
/// </summary>
|
||||
/// <param name="id">Rest Token cliente</param>
|
||||
/// <returns></returns>
|
||||
// GET api/Machines/2cba60c7-7be4-40b1-aa0d-52e7c71fc1a7
|
||||
[HttpGet("{id}")]
|
||||
public async Task<List<MachineModel>> Get(string id, int KeyNum)
|
||||
{
|
||||
var ListRecords = await MTAdmService.MachineGetByToken(id);
|
||||
return ListRecords;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processa una chiamata POST per l'invio di un oggetto di aggiornamento risorse progetto (RestPayload.Resources)
|
||||
/// PUT: api/Inventory/upsert/00000000-0000-0000-0000-000000000000
|
||||
/// </summary>
|
||||
/// <param name="id">token comunicazione</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("upsert/{id}")]
|
||||
public async Task<string> upsert(string id, [FromBody] RestPayload.Resources projectData)
|
||||
{
|
||||
string answ = "ND";
|
||||
bool fatto = false;
|
||||
// verifico ci sia valore
|
||||
if (!string.IsNullOrEmpty(id) && projectData != null)
|
||||
{
|
||||
// in primis recupero codice chiave da token...
|
||||
int nKey = await MTAdmService.MainKeyByToken(id);
|
||||
if (nKey > 0)
|
||||
{
|
||||
#if false
|
||||
// creo oggetti materiale da lista ricevuta
|
||||
List<RawItemModel> matList = item2Consume.ItemList.Select(jpl => TService.ItemFromDto(jpl, true)).ToList();
|
||||
|
||||
foreach (var item in matList)
|
||||
{
|
||||
try
|
||||
{
|
||||
await TService.ItemUpdate(nKey, item);
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"InventoryController.upsert | Errore in fase salvataggio ItemDto{Environment.NewLine}{exc}");
|
||||
fatto = false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// resetto cache redis
|
||||
await MTAdmService.FlushRedisCache();
|
||||
}
|
||||
}
|
||||
answ = fatto ? "OK" : "NO";
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Version>1.0.2401.1610</Version>
|
||||
<Version>1.0.2401.2220</Version>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<EnableNETAnalyzers>true</EnableNETAnalyzers>
|
||||
@@ -36,8 +36,8 @@
|
||||
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="6.0.5" />
|
||||
<PackageReference Include="AspNetCore.HealthChecks.UI.InMemory.Storage" Version="6.0.5" />
|
||||
<PackageReference Include="AspNetCore.HealthChecks.Uris" Version="6.0.3" />
|
||||
<PackageReference Include="EgwCoreLib.Razor" Version="1.4.2312.1510" />
|
||||
<PackageReference Include="EgwCoreLib.Utils" Version="1.4.2312.1510" />
|
||||
<PackageReference Include="EgwCoreLib.Razor" Version="1.4.2401.2209" />
|
||||
<PackageReference Include="EgwCoreLib.Utils" Version="1.4.2401.1911" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.25" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.25" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.23" />
|
||||
|
||||
@@ -22,19 +22,7 @@
|
||||
<div class="px-0">
|
||||
@if (currMode != CtMode.Company)
|
||||
{
|
||||
<div class="input-group">
|
||||
<label class="input-group-text" for="inputGroupSelect01">Cliente</label>
|
||||
<select class="form-select" @bind="@CustomerID">
|
||||
<option value="0">--- Selezionare Cliente ---</option>
|
||||
@if (CustomersList != null)
|
||||
{
|
||||
@foreach (var item in CustomersList)
|
||||
{
|
||||
<option value="@item.CustomerID">@item.Name [@item.CustomerID]</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<CmpSelCliente E_CustSelected="SaveCust"></CmpSelCliente>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this
|
||||
// file to you under the MIT license.
|
||||
using k8s.Models;
|
||||
using MagMan.Core.Services;
|
||||
using MagMan.Data.Admin.DbModels;
|
||||
using MagMan.Data.Admin.Services;
|
||||
using MagMan.Data.Tenant.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace MagMan.UI.Pages
|
||||
@@ -34,12 +31,16 @@ namespace MagMan.UI.Pages
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
AppMService.ShowSearch = false;
|
||||
AppMService.PageName = "Admin Area";
|
||||
AppMService.PageIcon = "fa-solid fa-house pr-2";
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected void SaveCust(int newCustId)
|
||||
{
|
||||
CustomerID = newCustId;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
@@ -47,14 +48,12 @@ namespace MagMan.UI.Pages
|
||||
#region Private Fields
|
||||
|
||||
private CtMode currMode = CtMode.Company;
|
||||
private int CustomerID = 0;
|
||||
private List<CustomerModel>? CustomersList = null;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
private int CustomerID { get; set; } = 0;
|
||||
|
||||
[Inject]
|
||||
private NavigationManager NavMan { get; set; } = null!;
|
||||
@@ -69,13 +68,6 @@ namespace MagMan.UI.Pages
|
||||
return answ;
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
CustomersList = await MTService.CustomerGetAll();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
private void SetMode(CtMode newMode)
|
||||
{
|
||||
currMode = newMode;
|
||||
|
||||
@@ -46,8 +46,8 @@
|
||||
<AuthorizeView Roles="SuperAdmin, Admin">
|
||||
<Authorized>
|
||||
<NavLink type="button" class="btn btn-block btn-primary text-light p-3 m-2 w-100" title="Scheda Fornitore" href="AdminArea">
|
||||
<i class="fa-solid fa-building fa-2x" aria-hidden="true"></i>
|
||||
<h5>Admin Area</h5>
|
||||
<i class="fa-solid fa-building fa-2x mb-2" aria-hidden="true"></i>
|
||||
<h4>Admin Area</h4>
|
||||
</NavLink>
|
||||
</Authorized>
|
||||
</AuthorizeView>
|
||||
@@ -55,9 +55,9 @@
|
||||
<div class="col-6 col-md-4">
|
||||
<AuthorizeView Roles="SuperAdmin, Admin, User">
|
||||
<Authorized>
|
||||
<NavLink type="button" class="btn btn-block btn-primary text-light p-3 m-2 w-100" title="Stato Impianti" href="PlantStatus">
|
||||
<i class="fa-solid fa-screwdriver-wrench fa-2x" aria-hidden="true"></i>
|
||||
<h5>Macchine</h5>
|
||||
<NavLink type="button" class="btn btn-block btn-primary text-light p-3 m-2 w-100" title="Stato Impianti" href="MachineStatus">
|
||||
<i class="fa-solid fa-screwdriver-wrench fa-2x mb-2" aria-hidden="true"></i>
|
||||
<h4>Dati Macchine</h4>
|
||||
</NavLink>
|
||||
</Authorized>
|
||||
</AuthorizeView>
|
||||
@@ -65,9 +65,9 @@
|
||||
<div class="col-6 col-md-4">
|
||||
<AuthorizeView Roles="SuperAdmin, Admin, User">
|
||||
<Authorized>
|
||||
<NavLink type="button" class="btn btn-block btn-primary text-light p-3 m-2 w-100" title="Scheda Stazione" href="GasStation">
|
||||
<i class="fa-solid fa-warehouse fa-2x" aria-hidden="true"></i>
|
||||
<h5>Magazzino</h5>
|
||||
<NavLink type="button" class="btn btn-block btn-primary text-light p-3 m-2 w-100" title="Scheda Stazione" href="WareHouse">
|
||||
<i class="fa-solid fa-warehouse fa-2x mb-2" aria-hidden="true"></i>
|
||||
<h4>Magazzino</h4>
|
||||
</NavLink>
|
||||
</Authorized>
|
||||
</AuthorizeView>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using MagMan.Data.Tenant.Services;
|
||||
using MagMan.Core.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System;
|
||||
|
||||
namespace MagMan.UI.Pages
|
||||
{
|
||||
|
||||
@@ -3,3 +3,4 @@
|
||||
<h3>MachineStatus</h3>
|
||||
|
||||
|
||||
Work In Progress
|
||||
@@ -1,11 +1,6 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
using k8s.KubeConfigModels;
|
||||
using MagMan.Core.Services;
|
||||
using MagMan.Data.Admin.Services;
|
||||
using MagMan.Data.Tenant.Services;
|
||||
using MagMan.UI.Shared;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System;
|
||||
|
||||
namespace MagMan.UI.Pages
|
||||
{
|
||||
|
||||
@@ -4,59 +4,31 @@
|
||||
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
<ul class="nav nav-tabs">
|
||||
@foreach (var item in Enum.GetValues(typeof(CtMode)))
|
||||
{
|
||||
<li class="nav-item">
|
||||
<button class="nav-link @IsActive((CtMode)item)" @onclick="()=> SetMode((CtMode)item)">@((CtMode)item)</button>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<div class="input-group">
|
||||
<label class="input-group-text">Cliente</label>
|
||||
<select class="form-select" @bind="@CustomerID">
|
||||
<option value="0">--- Selezionare Cliente ---</option>
|
||||
@if (CustomersList != null)
|
||||
{
|
||||
@foreach (var item in CustomersList)
|
||||
{
|
||||
<option value="@item.CustomerID">@item.Name [@item.CustomerID]</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
<label class="input-group-text">Key</label>
|
||||
<select class="form-select" @bind="@KeyNum">
|
||||
<option value="0">--- Selezionare Chiave ---</option>
|
||||
@if (KeyList != null)
|
||||
{
|
||||
@foreach (var item in KeyList)
|
||||
{
|
||||
<option value="@item.KeyNum">@item.KeyNum - @item.Note</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<CmpSelCliente E_CustSelected="SaveCust"></CmpSelCliente>
|
||||
</div>
|
||||
</div>
|
||||
@if (KeyNum == 0)
|
||||
@if (CustomerID == 0)
|
||||
{
|
||||
<div class="alert alert-info">
|
||||
<div class="fs-2">
|
||||
Key Undef
|
||||
Customer Undef
|
||||
</div>
|
||||
Prego selezionare Key valida per visualizzare dati Magazzino
|
||||
Prego selezionare Cliente per visualizzare dati Magazzino
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
@if (currMode == CtMode.Materials)
|
||||
{
|
||||
<MaterialMan></MaterialMan>
|
||||
}
|
||||
else if (currMode == CtMode.Items)
|
||||
{
|
||||
<ItemMan></ItemMan>
|
||||
}
|
||||
<div class="row">
|
||||
<div class="@mainCss">
|
||||
<MaterialMan CustomerId="@CustomerID" KeyNum="@nKey" E_MaterialSel="SaveMat"></MaterialMan>
|
||||
</div>
|
||||
@if (MaterialSel != null)
|
||||
{
|
||||
<div class="col-6">
|
||||
<ItemMan CustomerId="@CustomerID" KeyNum="@nKey" MaterialSel="@MaterialSel"></ItemMan>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
@@ -1,73 +1,83 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
using k8s.Models;
|
||||
using MagMan.Core.Services;
|
||||
using MagMan.Data.Admin.DbModels;
|
||||
using MagMan.Data.Admin.Services;
|
||||
using MagMan.Data.Tenant.Services;
|
||||
using MagMan.Data.Tenant.DbModels;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using YamlDotNet.Core.Tokens;
|
||||
|
||||
namespace MagMan.UI.Pages
|
||||
{
|
||||
public partial class WareHouse
|
||||
{
|
||||
#region Protected Fields
|
||||
|
||||
protected int nKey = 0;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMService { get; set; } = null!;
|
||||
|
||||
protected int CustomerID { get; set; } = 0;
|
||||
|
||||
protected string mainCss
|
||||
{
|
||||
get => MaterialSel == null ? "col-12" : "col-6 small";
|
||||
}
|
||||
|
||||
[Inject]
|
||||
protected MTAdminService MTService { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
AppMService.ShowSearch = false;
|
||||
AppMService.ShowSearch = true;
|
||||
AppMService.PageName = "Warehouse Area";
|
||||
AppMService.PageIcon = "fa-solid fa-warehouse pr-2";
|
||||
// rileggo dati
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task SaveCust(int newCustId)
|
||||
{
|
||||
CustomerID = newCustId;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected void SaveMat(MaterialModel? newMat)
|
||||
{
|
||||
MaterialSel = newMat;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private int KeyNum = 0;
|
||||
private MaterialModel? MaterialSel = null;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
CustomersList = await MTService.CustomerGetAll();
|
||||
KeyList = await MTService.AuthKeyByCustId(CustomerID);
|
||||
nKey = await MTService.MainKeyByCustomer(CustomerID);
|
||||
isLoading = false;
|
||||
}
|
||||
private bool isLoading { get; set; } = false;
|
||||
private CtMode currMode = CtMode.Materials;
|
||||
protected int CustomerID
|
||||
{
|
||||
get => customerID;
|
||||
set
|
||||
{
|
||||
if (customerID != value)
|
||||
{
|
||||
customerID = value;
|
||||
// update keys
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
private int customerID = 0;
|
||||
private int KeyNum = 0;
|
||||
private List<CustomerModel>? CustomersList = null;
|
||||
private List<AuthKeyModel>? KeyList = null;
|
||||
|
||||
protected enum CtMode
|
||||
{
|
||||
Materials,
|
||||
Items,
|
||||
//Deposit,
|
||||
//Pickup
|
||||
}
|
||||
|
||||
private string IsActive(CtMode modeReq)
|
||||
{
|
||||
string answ = currMode == modeReq ? "active" : "";
|
||||
return answ;
|
||||
}
|
||||
|
||||
private void SetMode(CtMode newMode)
|
||||
{
|
||||
currMode = newMode;
|
||||
}
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,5 @@
|
||||
@inherits LayoutComponentBase
|
||||
|
||||
@using MagMan.UI.Components
|
||||
@inject MessageService MessageService
|
||||
@implements IDisposable
|
||||
|
||||
|
||||
<PageTitle>MagMan UI</PageTitle>
|
||||
|
||||
<div class="page">
|
||||
@@ -27,46 +22,3 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
bool ShowSearch { get; set; } = false;
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
MessageService.EA_ShowSearch += OnShowSearch;
|
||||
MessageService.EA_HideSearch += OnHideSearch;
|
||||
}
|
||||
public void OnShowSearch()
|
||||
{
|
||||
ShowSearch = true;
|
||||
InvokeAsync(() =>
|
||||
{
|
||||
StateHasChanged();
|
||||
});
|
||||
}
|
||||
public void OnHideSearch()
|
||||
{
|
||||
ShowSearch = false;
|
||||
InvokeAsync(() =>
|
||||
{
|
||||
StateHasChanged();
|
||||
});
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
MessageService.EA_ShowSearch -= OnShowSearch;
|
||||
MessageService.EA_ShowSearch -= OnHideSearch;
|
||||
}
|
||||
|
||||
protected bool navLarge { get; set; } = true;
|
||||
|
||||
protected string sideClass { get; set; } = "sidebar";
|
||||
|
||||
protected void UpdateNavDisplay()
|
||||
{
|
||||
navLarge = !navLarge;
|
||||
sideClass = navLarge ? "sidebar" : "sidebarSmall";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
using MagMan.Core.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace MagMan.UI.Shared
|
||||
{
|
||||
public partial class MainLayout : IDisposable
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
MessageService.EA_ShowSearch -= OnShowSearch;
|
||||
MessageService.EA_ShowSearch -= OnHideSearch;
|
||||
}
|
||||
|
||||
public void OnHideSearch()
|
||||
{
|
||||
ShowSearch = false;
|
||||
InvokeAsync(() =>
|
||||
{
|
||||
StateHasChanged();
|
||||
});
|
||||
}
|
||||
|
||||
public void OnShowSearch()
|
||||
{
|
||||
ShowSearch = true;
|
||||
InvokeAsync(() =>
|
||||
{
|
||||
StateHasChanged();
|
||||
});
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService MessageService { get; set; } = null!;
|
||||
|
||||
protected bool navLarge { get; set; } = true;
|
||||
protected string sideClass { get; set; } = "sidebar";
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
MessageService.EA_ShowSearch += OnShowSearch;
|
||||
MessageService.EA_HideSearch += OnHideSearch;
|
||||
}
|
||||
|
||||
protected void UpdateNavDisplay()
|
||||
{
|
||||
navLarge = !navLarge;
|
||||
sideClass = navLarge ? "sidebar" : "sidebarSmall";
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private bool ShowSearch { get; set; } = false;
|
||||
|
||||
#endregion Private Properties
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,12 @@
|
||||
<Authorized>
|
||||
<div class="nav-item px-2">
|
||||
<NavLink class="nav-link py-0 px-2 mb-0" href="MachineStatus">
|
||||
<i class="fa-solid fa-screwdriver-wrench pe-2"></i> Macchine
|
||||
<i class="fa-solid fa-screwdriver-wrench pe-2"></i> Dati Macchine
|
||||
</NavLink>
|
||||
</div>
|
||||
<div class="nav-item px-2">
|
||||
<NavLink class="nav-link py-0 px-2 mb-0" href="ProjectsStatus">
|
||||
<i class="fa-solid fa-chart-gantt pe-2"></i> Progetti
|
||||
</NavLink>
|
||||
</div>
|
||||
<div class="nav-item px-2">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
@using EgwCoreLib.Razor
|
||||
@using MagMan.Core
|
||||
@using MagMan.Core.DTO
|
||||
@using MagMan.Core.Services
|
||||
@using MagMan.Data
|
||||
@using MagMan.Data.Admin
|
||||
@using MagMan.Data.Admin.DbModels
|
||||
|
||||
@@ -4,13 +4,13 @@ Gestione magazzino per applicazioni BeamWall, integrato con EgtBeamWall.
|
||||
|
||||
## Prerequisiti e versioni
|
||||
|
||||
Un prerequisito è il disaccoppiamento tra EgtB&W ed il componente MagMan: abbiamo che il sw EgtB&W è basato su **netFramework 4.7.2** mentre l'applciazione, che deve girare su windows e linux e quindi **dotNet Core 6.0** LTS o successivi, non può essere direttamente connessa tramite dll
|
||||
Un prerequisito è il disaccoppiamento tra EgtB&W ed il componente MagMan: abbiamo che il sw EgtB&W è basato su **netFramework 4.7.2** mentre l'applicazione, che deve girare su windows e linux e quindi **dotNet Core 6.0** LTS o successivi, non può essere direttamente connessa tramite dll
|
||||
|
||||
In particoalre il problema c'è a livello delle librerie di accesso EntityFramework.
|
||||
|
||||
Per superare il problema il disaccoppiamento sarà svolto tramite chaimate **REST** che il client (applicazione EgtB&W) farà al server.
|
||||
|
||||
Inoltre la distribuzione della funzionalità, per essere semplificata,a vverra tramite apposito pacchetto nuget ospitato sul repository nexus aziendale.
|
||||
Inoltre la distribuzione della funzionalità, per essere semplificata, avverrà tramite apposito pacchetto nuget ospitato sul repository nexus aziendale.
|
||||
|
||||
## Descrizione
|
||||
|
||||
@@ -23,6 +23,7 @@ Il sofware è previsto in modalità **multi-tenant**, dove verrà generato un DB
|
||||
Di base il sistema deve prevedere il riconoscimento degli utenti e/o dei software EgalWare licenziati e reindirizzare l'impiego delle funzionalità avanzate verso il DB dedicato al cliente.
|
||||
|
||||
<div style="page-break-after: always; visibility: hidden"></div>
|
||||
|
||||
## Architettura
|
||||
|
||||
Il progetto è pensato in architettura **multi-tenant** per la versione **online**, ovvero un unico indirizzo web (tramite load balancers x reverse proxy) che fornisce l'applicazione a tutti i clienti.
|
||||
@@ -135,11 +136,20 @@ Ogni nuovo user dovrà poi essere associato al bucket del cliente tramite un cod
|
||||
|
||||
<div style="page-break-after: always; visibility: hidden"></div>
|
||||
|
||||
## Gestione Sync DB
|
||||
|
||||
E' stato implementato un nuovo set di tabelle sul DB (locale) di EgtBeamWall per gestire materiali e grezzi non tramite file ma tramite DB e così gettare la base per la gestione del sync locale/cloud.
|
||||
|
||||
Nello stesso tempo, il sito web, oltre a proporre pagine utente, implementa web API rest che, tramite apposita libreria di comuncazione SDK (messa sul repo nuget aziendale) permette di comuncare, sincronizzare e gestire i dati.
|
||||
|
||||
<div style="page-break-after: always; visibility: hidden"></div>
|
||||
|
||||
## Revisione documento
|
||||
|
||||
|
||||
Version | Date | Editor | Note
|
||||
:--: |----------|----- | ----:
|
||||
0.5 | 2024.01.18 | S.E. Locatelli | Prime note sync DB online/locale
|
||||
0.3 | 2024.01.10 | S.E. Locatelli | Revisione modalità multi-tenant
|
||||
0.2 | 2024.01.05 | S.E. Locatelli | update ruoli e workflow
|
||||
0.1 | 2023.12.28 | S.E. Locatelli | Prima revisione documento
|
||||
|
||||
BIN
Binary file not shown.
+1
-1
File diff suppressed because one or more lines are too long
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>MagMan - Wood Warehouse Management System</i>
|
||||
<h4>Versione: 1.0.2401.1610</h4>
|
||||
<h4>Versione: 1.0.2401.2220</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.0.2401.1610
|
||||
1.0.2401.2220
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>1.0.2401.1610</version>
|
||||
<version>1.0.2401.2220</version>
|
||||
<url>http://nexus.steamware.net/repository/SWS/MagMan/stable/0/MagMan.UI.zip</url>
|
||||
<changelog>http://nexus.steamware.net/repository/SWS/MagMan/stable/0/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
</startup>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="RestSharp" publicKeyToken="598062e77f915f75" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-110.2.1.0" newVersion="110.2.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-7.0.0.3" newVersion="7.0.0.3" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
@@ -0,0 +1,105 @@
|
||||
using EgwProxy.MagMan;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DemoApp
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
|
||||
|
||||
static async Task Main(string[] args)
|
||||
{
|
||||
|
||||
#if DEBUG
|
||||
// Indirizzo server (DEBUG)
|
||||
string servAddr = "localhost:7207";
|
||||
|
||||
// token di auth
|
||||
string testToken = "91f4fec6-7e9c-4130-9df2-702d729ccdd3";
|
||||
#else
|
||||
// Indirizzo server (DEBUG)
|
||||
string servAddr = "magman.egalware.com";
|
||||
|
||||
// token di auth
|
||||
string testToken = "22fa4426-6670-41ad-ac2b-d7b5c3dfe849";
|
||||
#endif
|
||||
|
||||
string sep = "--------------------------------------------";
|
||||
string sepShort = "------------------";
|
||||
Console.WriteLine(sep);
|
||||
Console.WriteLine("- MagMan REST Demo App");
|
||||
Console.WriteLine(sep);
|
||||
Console.WriteLine();
|
||||
string answ = "";
|
||||
DataSyncro commLib = new DataSyncro(servAddr, testToken);
|
||||
Console.WriteLine("Premere ENT per check ping");
|
||||
answ = Console.ReadLine();
|
||||
bool servOk = commLib.CheckRemote();
|
||||
string esito = servOk ? "OK" : "KO";
|
||||
Console.WriteLine($"Esito controllo server: {esito}");
|
||||
Console.WriteLine("Premere un tasto per lettura archivio materiali");
|
||||
answ = Console.ReadLine();
|
||||
// leggo materiali
|
||||
var matList = await commLib.MaterialsGet();
|
||||
if (matList != null)
|
||||
{
|
||||
foreach (var item in matList)
|
||||
{
|
||||
Console.WriteLine(sep);
|
||||
Console.WriteLine($"Mat ID: {item.MatID}");
|
||||
Console.WriteLine($"Mat Code: {item.MatExtCode}");
|
||||
Console.WriteLine($"Dtmx Code: {item.MatDtmx}");
|
||||
Console.WriteLine($"descript: {item.MatDesc}");
|
||||
Console.WriteLine($"Dimensions W x T x L: {item.WMm:N3} x {item.TMm:N3} x {item.LMm:N3}");
|
||||
if (item.ItemNav != null)
|
||||
{
|
||||
Console.WriteLine($"Items count: {item.ItemNav.Count}");
|
||||
}
|
||||
Console.WriteLine(sep);
|
||||
Console.WriteLine();
|
||||
}
|
||||
}
|
||||
answ = Console.ReadLine();
|
||||
// leggo inventario
|
||||
var inventList = await commLib.InventarioGet(0);
|
||||
if (inventList != null)
|
||||
{
|
||||
foreach (var itemMat in inventList)
|
||||
{
|
||||
Console.WriteLine(sep);
|
||||
Console.WriteLine($"Mat ID: {itemMat.MatID}");
|
||||
Console.WriteLine($"Mat Code: {itemMat.MatExtCode}");
|
||||
Console.WriteLine($"Dtmx Code: {itemMat.MatDtmx}");
|
||||
Console.WriteLine($"descript: {itemMat.MatDesc}");
|
||||
Console.WriteLine($"Dimensions W x T x L: {itemMat.WMm:N3} x {itemMat.TMm:N3} x {itemMat.LMm:N3}");
|
||||
if (itemMat.ItemNav != null)
|
||||
{
|
||||
Console.WriteLine($"Items count: {itemMat.ItemNav.Count}");
|
||||
if (itemMat.ItemNav.Count > 0)
|
||||
{
|
||||
Console.WriteLine("Inventario:");
|
||||
foreach (var itemInv in itemMat.ItemNav)
|
||||
{
|
||||
Console.WriteLine(sepShort);
|
||||
Console.WriteLine($"ID: {itemInv.ItemID}");
|
||||
Console.WriteLine($"Location: {itemInv.Location}");
|
||||
Console.WriteLine($"Descript: {itemInv.Note}");
|
||||
Console.WriteLine($"Giacenza: {itemInv.QtyAvail}");
|
||||
Console.WriteLine($"Dimensions W x T x L: {itemInv.WMm:N3} x {itemInv.TMm:N3} x {itemInv.LMm:N3}");
|
||||
Console.WriteLine($"Dtmx Code: {itemInv.ItemDtmx}");
|
||||
}
|
||||
}
|
||||
}
|
||||
Console.WriteLine(sep);
|
||||
Console.WriteLine();
|
||||
}
|
||||
}
|
||||
|
||||
answ = Console.ReadLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("DemoApp")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("DemoApp")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2024")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("57626c9a-aae0-4a43-a7e9-610320dd9d31")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{57626C9A-AAE0-4A43-A7E9-610320DD9D31}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>DemoApp</RootNamespace>
|
||||
<AssemblyName>DemoApp</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\EgwProxy.MagMan\EgwProxy.MagMan.csproj">
|
||||
<Project>{1696d7a5-765a-4d25-8d29-ca7345023479}</Project>
|
||||
<Name>EgwProxy.MagMan</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
</startup>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
Generated
+100
@@ -0,0 +1,100 @@
|
||||
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
|
||||
Partial Class Form1
|
||||
Inherits System.Windows.Forms.Form
|
||||
|
||||
'Form overrides dispose to clean up the component list.
|
||||
<System.Diagnostics.DebuggerNonUserCode()> _
|
||||
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
|
||||
Try
|
||||
If disposing AndAlso components IsNot Nothing Then
|
||||
components.Dispose()
|
||||
End If
|
||||
Finally
|
||||
MyBase.Dispose(disposing)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
'Required by the Windows Form Designer
|
||||
Private components As System.ComponentModel.IContainer
|
||||
|
||||
'NOTE: The following procedure is required by the Windows Form Designer
|
||||
'It can be modified using the Windows Form Designer.
|
||||
'Do not modify it using the code editor.
|
||||
<System.Diagnostics.DebuggerStepThrough()> _
|
||||
Private Sub InitializeComponent()
|
||||
Me.Button1 = New System.Windows.Forms.Button()
|
||||
Me.lblServTest = New System.Windows.Forms.Label()
|
||||
Me.Button2 = New System.Windows.Forms.Button()
|
||||
Me.txtOut = New System.Windows.Forms.TextBox()
|
||||
Me.Button3 = New System.Windows.Forms.Button()
|
||||
Me.SuspendLayout()
|
||||
'
|
||||
'Button1
|
||||
'
|
||||
Me.Button1.Location = New System.Drawing.Point(12, 12)
|
||||
Me.Button1.Name = "Button1"
|
||||
Me.Button1.Size = New System.Drawing.Size(75, 23)
|
||||
Me.Button1.TabIndex = 0
|
||||
Me.Button1.Text = "Server Test"
|
||||
Me.Button1.UseVisualStyleBackColor = True
|
||||
'
|
||||
'lblServTest
|
||||
'
|
||||
Me.lblServTest.AutoSize = True
|
||||
Me.lblServTest.Location = New System.Drawing.Point(117, 17)
|
||||
Me.lblServTest.Name = "lblServTest"
|
||||
Me.lblServTest.Size = New System.Drawing.Size(16, 13)
|
||||
Me.lblServTest.TabIndex = 1
|
||||
Me.lblServTest.Text = "..."
|
||||
'
|
||||
'Button2
|
||||
'
|
||||
Me.Button2.Location = New System.Drawing.Point(12, 51)
|
||||
Me.Button2.Name = "Button2"
|
||||
Me.Button2.Size = New System.Drawing.Size(75, 23)
|
||||
Me.Button2.TabIndex = 2
|
||||
Me.Button2.Text = "Get Mater."
|
||||
Me.Button2.UseVisualStyleBackColor = True
|
||||
'
|
||||
'txtOut
|
||||
'
|
||||
Me.txtOut.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
|
||||
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
|
||||
Me.txtOut.Location = New System.Drawing.Point(103, 53)
|
||||
Me.txtOut.Multiline = True
|
||||
Me.txtOut.Name = "txtOut"
|
||||
Me.txtOut.Size = New System.Drawing.Size(685, 392)
|
||||
Me.txtOut.TabIndex = 3
|
||||
'
|
||||
'Button3
|
||||
'
|
||||
Me.Button3.Location = New System.Drawing.Point(12, 97)
|
||||
Me.Button3.Name = "Button3"
|
||||
Me.Button3.Size = New System.Drawing.Size(75, 23)
|
||||
Me.Button3.TabIndex = 4
|
||||
Me.Button3.Text = "Get Invent."
|
||||
Me.Button3.UseVisualStyleBackColor = True
|
||||
'
|
||||
'Form1
|
||||
'
|
||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
||||
Me.ClientSize = New System.Drawing.Size(800, 450)
|
||||
Me.Controls.Add(Me.Button3)
|
||||
Me.Controls.Add(Me.txtOut)
|
||||
Me.Controls.Add(Me.Button2)
|
||||
Me.Controls.Add(Me.lblServTest)
|
||||
Me.Controls.Add(Me.Button1)
|
||||
Me.Name = "Form1"
|
||||
Me.Text = "Form1"
|
||||
Me.ResumeLayout(False)
|
||||
Me.PerformLayout()
|
||||
|
||||
End Sub
|
||||
|
||||
Friend WithEvents Button1 As Button
|
||||
Friend WithEvents lblServTest As Label
|
||||
Friend WithEvents Button2 As Button
|
||||
Friend WithEvents txtOut As TextBox
|
||||
Friend WithEvents Button3 As Button
|
||||
End Class
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -0,0 +1,109 @@
|
||||
Imports EgwProxy.MagMan
|
||||
Imports Microsoft.SqlServer
|
||||
|
||||
Public Class Form1
|
||||
|
||||
|
||||
|
||||
#If DEBUG Then
|
||||
|
||||
' token di auth
|
||||
Private restToken As String = "91f4fec6-7e9c-4130-9df2-702d729ccdd3"
|
||||
' Indirizzo server (DEBUG)
|
||||
Private servAddr As String = "localhost:7207"
|
||||
|
||||
#Else
|
||||
|
||||
' token di auth
|
||||
Private restToken As String = "22fa4426-6670-41ad-ac2b-d7b5c3dfe849"
|
||||
' Indirizzo server (DEBUG)
|
||||
Private servAddr As String = "magman.egalware.com"
|
||||
|
||||
#End If
|
||||
|
||||
Private commLib As DataSyncro
|
||||
|
||||
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
||||
' esegue test comunicazione server (ping, alive)
|
||||
commLib = New DataSyncro(servAddr, restToken)
|
||||
Dim servOk As Boolean
|
||||
servOk = commLib.CheckRemote()
|
||||
Dim esito As String = ""
|
||||
If (servOk) Then
|
||||
esito = "Test Ping: OK"
|
||||
Else
|
||||
esito = "Test Ping: KO"
|
||||
End If
|
||||
lblServTest.Text = esito
|
||||
|
||||
End Sub
|
||||
|
||||
Private Async Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
|
||||
' recupera e mostra dati elenco materiali
|
||||
commLib = New DataSyncro(servAddr, restToken)
|
||||
|
||||
Dim result As String = ""
|
||||
|
||||
Dim matList = Await commLib.GetMaterials()
|
||||
If matList IsNot Nothing Then
|
||||
|
||||
For Each item In matList
|
||||
result += $"Mat ID: {item.MatID}{Environment.NewLine}"
|
||||
result += $"Mat Code: {item.MatExtCode}{Environment.NewLine}"
|
||||
result += $"Dtmx Code: {item.MatDtmx}{Environment.NewLine}"
|
||||
result += $"descript: {item.MatDesc}{Environment.NewLine}"
|
||||
result += $"Dimensions W x T x L: {item.WMm:N3} x {item.TMm:N3} x {item.LMm:N3}{Environment.NewLine}"
|
||||
If item.ItemNav IsNot Nothing Then
|
||||
'result += $"Items count: {item.ItemList.Count}"
|
||||
result += $"{Environment.NewLine}"
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
txtOut.Text = result
|
||||
|
||||
End Sub
|
||||
|
||||
Private Async Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
|
||||
' recupera e mostra dati elenco materiali
|
||||
commLib = New DataSyncro(servAddr, restToken)
|
||||
|
||||
Dim result As String = ""
|
||||
Dim sepShort As String = "----"
|
||||
|
||||
Dim matList = Await commLib.GetInventario(0)
|
||||
|
||||
If matList IsNot Nothing Then
|
||||
|
||||
For Each item In matList
|
||||
result += $"Mat ID: {item.MatID}{Environment.NewLine}"
|
||||
result += $"Mat Code: {item.MatExtCode}{Environment.NewLine}"
|
||||
result += $"Dtmx Code: {item.MatDtmx}{Environment.NewLine}"
|
||||
result += $"descript: {item.MatDesc}{Environment.NewLine}"
|
||||
result += $"Dimensions W x T x L: {item.WMm:N3} x {item.TMm:N3} x {item.LMm:N3}{Environment.NewLine}"
|
||||
If item.ItemNav IsNot Nothing Then
|
||||
result += $"Items count: {item.ItemNav.Count}"
|
||||
|
||||
If item.ItemNav.Count > 0 Then
|
||||
result += "Inventario:"
|
||||
|
||||
For Each itemInv In item.ItemNav
|
||||
result += $"{sepShort}{Environment.NewLine}"
|
||||
result += $"ID: {itemInv.ItemID}{Environment.NewLine}"
|
||||
result += $"Location: {itemInv.Location}{Environment.NewLine}"
|
||||
result += $"Descript: {itemInv.Note}{Environment.NewLine}"
|
||||
result += $"Giacenza: {itemInv.QtyAvail}{Environment.NewLine}"
|
||||
result += $"Dimensions W x T x L: {itemInv.WMm:N3} x {itemInv.TMm:N3} x {itemInv.LMm:N3}{Environment.NewLine}"
|
||||
result += $"Dtmx Code: {itemInv.ItemDtmx}{Environment.NewLine}"
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
|
||||
result += $"{Environment.NewLine}"
|
||||
Next
|
||||
End If
|
||||
|
||||
txtOut.Text = result
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' This code was generated by a tool.
|
||||
' Runtime Version:4.0.30319.42000
|
||||
'
|
||||
' Changes to this file may cause incorrect behavior and will be lost if
|
||||
' the code is regenerated.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
|
||||
Namespace My
|
||||
|
||||
'NOTE: This file is auto-generated; do not modify it directly. To make changes,
|
||||
' or if you encounter build errors in this file, go to the Project Designer
|
||||
' (go to Project Properties or double-click the My Project node in
|
||||
' Solution Explorer), and make changes on the Application tab.
|
||||
'
|
||||
Partial Friend Class MyApplication
|
||||
|
||||
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
|
||||
Public Sub New()
|
||||
MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
|
||||
Me.IsSingleInstance = false
|
||||
Me.EnableVisualStyles = true
|
||||
Me.SaveMySettingsOnExit = true
|
||||
Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
|
||||
End Sub
|
||||
|
||||
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
|
||||
Protected Overrides Sub OnCreateMainForm()
|
||||
Me.MainForm = Global.TestWinFormVB.Form1
|
||||
End Sub
|
||||
End Class
|
||||
End Namespace
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<MySubMain>true</MySubMain>
|
||||
<MainForm>Form1</MainForm>
|
||||
<SingleInstance>false</SingleInstance>
|
||||
<ShutdownMode>0</ShutdownMode>
|
||||
<EnableVisualStyles>true</EnableVisualStyles>
|
||||
<AuthenticationMode>0</AuthenticationMode>
|
||||
<ApplicationType>0</ApplicationType>
|
||||
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
|
||||
</MyApplicationData>
|
||||
@@ -0,0 +1,35 @@
|
||||
Imports System
|
||||
Imports System.Reflection
|
||||
Imports System.Runtime.InteropServices
|
||||
|
||||
' General Information about an assembly is controlled through the following
|
||||
' set of attributes. Change these attribute values to modify the information
|
||||
' associated with an assembly.
|
||||
|
||||
' Review the values of the assembly attributes
|
||||
|
||||
<Assembly: AssemblyTitle("TestWinFormVB")>
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("")>
|
||||
<Assembly: AssemblyProduct("TestWinFormVB")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2024")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
'The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
<Assembly: Guid("2ae4a20c-2f50-45c5-91bc-0673ade2acca")>
|
||||
|
||||
' Version information for an assembly consists of the following four values:
|
||||
'
|
||||
' Major Version
|
||||
' Minor Version
|
||||
' Build Number
|
||||
' Revision
|
||||
'
|
||||
' You can specify all the values or you can default the Build and Revision Numbers
|
||||
' by using the '*' as shown below:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.0.0.0")>
|
||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' This code was generated by a tool.
|
||||
' Runtime Version:4.0.30319.42000
|
||||
'
|
||||
' Changes to this file may cause incorrect behavior and will be lost if
|
||||
' the code is regenerated.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
|
||||
Namespace My.Resources
|
||||
|
||||
'This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
'class via a tool like ResGen or Visual Studio.
|
||||
'To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
'with the /str option, or rebuild your VS project.
|
||||
'''<summary>
|
||||
''' A strongly-typed resource class, for looking up localized strings, etc.
|
||||
'''</summary>
|
||||
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
|
||||
Friend Module Resources
|
||||
|
||||
Private resourceMan As Global.System.Resources.ResourceManager
|
||||
|
||||
Private resourceCulture As Global.System.Globalization.CultureInfo
|
||||
|
||||
'''<summary>
|
||||
''' Returns the cached ResourceManager instance used by this class.
|
||||
'''</summary>
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
|
||||
Get
|
||||
If Object.ReferenceEquals(resourceMan, Nothing) Then
|
||||
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("TestWinFormVB.Resources", GetType(Resources).Assembly)
|
||||
resourceMan = temp
|
||||
End If
|
||||
Return resourceMan
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'''<summary>
|
||||
''' Overrides the current thread's CurrentUICulture property for all
|
||||
''' resource lookups using this strongly typed resource class.
|
||||
'''</summary>
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Friend Property Culture() As Global.System.Globalization.CultureInfo
|
||||
Get
|
||||
Return resourceCulture
|
||||
End Get
|
||||
Set(ByVal value As Global.System.Globalization.CultureInfo)
|
||||
resourceCulture = value
|
||||
End Set
|
||||
End Property
|
||||
End Module
|
||||
End Namespace
|
||||
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' This code was generated by a tool.
|
||||
' Runtime Version:4.0.30319.42000
|
||||
'
|
||||
' Changes to this file may cause incorrect behavior and will be lost if
|
||||
' the code is regenerated.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
|
||||
Namespace My
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0"), _
|
||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Partial Friend NotInheritable Class MySettings
|
||||
Inherits Global.System.Configuration.ApplicationSettingsBase
|
||||
|
||||
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)
|
||||
|
||||
#Region "My.Settings Auto-Save Functionality"
|
||||
#If _MyType = "WindowsForms" Then
|
||||
Private Shared addedHandler As Boolean
|
||||
|
||||
Private Shared addedHandlerLockObject As New Object
|
||||
|
||||
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
|
||||
If My.Application.SaveMySettingsOnExit Then
|
||||
My.Settings.Save()
|
||||
End If
|
||||
End Sub
|
||||
#End If
|
||||
#End Region
|
||||
|
||||
Public Shared ReadOnly Property [Default]() As MySettings
|
||||
Get
|
||||
|
||||
#If _MyType = "WindowsForms" Then
|
||||
If Not addedHandler Then
|
||||
SyncLock addedHandlerLockObject
|
||||
If Not addedHandler Then
|
||||
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
|
||||
addedHandler = True
|
||||
End If
|
||||
End SyncLock
|
||||
End If
|
||||
#End If
|
||||
Return defaultInstance
|
||||
End Get
|
||||
End Property
|
||||
End Class
|
||||
End Namespace
|
||||
|
||||
Namespace My
|
||||
|
||||
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
|
||||
Friend Module MySettingsProperty
|
||||
|
||||
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
|
||||
Friend ReadOnly Property Settings() As Global.TestWinFormVB.My.MySettings
|
||||
Get
|
||||
Return Global.TestWinFormVB.My.MySettings.Default
|
||||
End Get
|
||||
End Property
|
||||
End Module
|
||||
End Namespace
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
@@ -0,0 +1,162 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{665C94F5-27A6-4CD0-9487-036D199CDC47}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<StartupObject>TestWinFormVB.My.MyApplication</StartupObject>
|
||||
<RootNamespace>TestWinFormVB</RootNamespace>
|
||||
<AssemblyName>TestWinFormVB</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<MyType>WindowsForms</MyType>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DocumentationFile>TestWinFormVB.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DocumentationFile>TestWinFormVB.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionExplicit>On</OptionExplicit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionCompare>Binary</OptionCompare>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionStrict>Off</OptionStrict>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="EgwProxy.MagMan, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EgwProxy.MagMan.0.9.2401-beta.1719\lib\EgwProxy.MagMan.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.7.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="RestSharp, Version=110.2.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\RestSharp.110.2.0\lib\net471\RestSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Text.Encodings.Web, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Text.Encodings.Web.7.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Text.Json, Version=7.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Text.Json.7.0.2\lib\net462\System.Text.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Import Include="Microsoft.VisualBasic" />
|
||||
<Import Include="System" />
|
||||
<Import Include="System.Collections" />
|
||||
<Import Include="System.Collections.Generic" />
|
||||
<Import Include="System.Data" />
|
||||
<Import Include="System.Drawing" />
|
||||
<Import Include="System.Diagnostics" />
|
||||
<Import Include="System.Windows.Forms" />
|
||||
<Import Include="System.Linq" />
|
||||
<Import Include="System.Xml.Linq" />
|
||||
<Import Include="System.Threading.Tasks" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Form1.vb">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Form1.Designer.vb">
|
||||
<DependentUpon>Form1.vb</DependentUpon>
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||
<Compile Include="My Project\Application.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Application.myapp</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="My Project\Resources.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="My Project\Settings.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Form1.resx">
|
||||
<DependentUpon>Form1.vb</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="My Project\Resources.resx">
|
||||
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
|
||||
<CustomToolNamespace>My.Resources</CustomToolNamespace>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="My Project\Application.myapp">
|
||||
<Generator>MyApplicationCodeGenerator</Generator>
|
||||
<LastGenOutput>Application.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
<None Include="My Project\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<CustomToolNamespace>My</CustomToolNamespace>
|
||||
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
<None Include="App.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
</Project>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user