Merge branch 'release/TesLantekSoitaab01'

This commit is contained in:
Samuele E. Locatelli
2023-04-21 09:34:36 +02:00
466 changed files with 37292 additions and 2390 deletions
+81 -3
View File
@@ -35,9 +35,9 @@ variables:
# 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_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 @ 2006-" + (get-date -format yyyy)
$contenuto = Get-Content -path 'VersGen\VersGen.cs' -Raw
$newContenuto = $contenuto -replace '0.0.0.0', $env:NEW_REL
@@ -269,6 +269,23 @@ EgwProxy.OsaiCncLib:build:
script:
- '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.vbproj" -target:Build /p:Configuration=Release /p:Platform="x86" /p:OutputPath=bin/ /nodeReuse:false /verbosity:minimal /m'
EgwProxy.SqlDb:build:
stage: build
tags:
- win
variables:
APP_NAME: EgwProxy.SqlDb
only:
refs:
- develop
- SDK/SqlDb
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln" -verbosity quiet'
- *version-fix
script:
- '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=Release /p:Platform="x86" /p:OutputPath=bin/ /nodeReuse:false /verbosity:minimal /m'
# --------------------------------
# STAGING: (nuget beta)
@@ -367,6 +384,29 @@ EgwProxy.OsaiCncLib:build:staging:
- '& "$env:NUGET_PATH" setapikey fe387daa-d07c-3207-877e-96c8be1be91b -source http://nexus.steamware.net/repository/nuget-hosted'
- '& "$env:NUGET_PATH" push *$env:NUM_DEB.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted'
EgwProxy.SqlDb:build:staging:
stage: staging
needs: ["EgwProxy.SqlDb:build"]
tags:
- win
variables:
CONFIG: Debug
APP_NAME: EgwProxy.SqlDb
only:
refs:
- develop
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore "$env:APP_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'
- '& Remove-Item *.nupkg'
- '& $env:NUGET_PATH pack "$env:APP_NAME.Debug.nuspec"'
- '& "$env:NUGET_PATH" setapikey fe387daa-d07c-3207-877e-96c8be1be91b -source http://nexus.steamware.net/repository/nuget-hosted'
- '& "$env:NUGET_PATH" push *$env:NUM_DEB.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted'
# --------------------------------
# RELEASE
# --------------------------------
@@ -534,6 +574,30 @@ EgwProxy.OsaiCncLib:build:release:
- '& "$env:NUGET_PATH" setapikey fe387daa-d07c-3207-877e-96c8be1be91b -source http://nexus.steamware.net/repository/nuget-hosted'
- '& "$env:NUGET_PATH" push *$env:NUM_REL.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted'
EgwProxy.SqlDb:build:release:
stage: release
needs: ["EgwProxy.SqlDb:build"]
tags:
- win
variables:
CONFIG: Release
APP_NAME: EgwProxy.SqlDb
only:
refs:
- SDK/SqlDb
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore "$env:APP_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'
- '& Remove-Item *.nupkg'
- '& $env:NUGET_PATH pack "$env:APP_NAME.Release.nuspec"'
# - '& "$env:NUGET_PATH" pack "$env:APP_NAME\$env:APP_NAME.csproj" -properties Configuration=$env:CONFIG -Version $env:NUM_REL'
- '& "$env:NUGET_PATH" setapikey fe387daa-d07c-3207-877e-96c8be1be91b -source http://nexus.steamware.net/repository/nuget-hosted'
- '& "$env:NUGET_PATH" push *$env:NUM_REL.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted'
# --------------------------------
# DocFx
# --------------------------------
@@ -593,6 +657,20 @@ EgwProxy.OsaiCncLib:docfx:
- mv $env:APP_NAME/_site "docfx"
- *DocReplica
EgwProxy.SqlDb:docfx:
stage: docfx
needs: ["EgwProxy.Icoel:build"]
tags:
- win
variables:
APP_NAME: EgwProxy.Icoel
only:
- SDK/Icoel
script:
- docfx $env:APP_NAME/docfx.json
- mv $env:APP_NAME/_site "docfx"
- *DocReplica
IOB-WIN-NEXT:docfx:
stage: docfx
needs: ["IOB-WIN-NEXT:build"]
+72
View File
@@ -0,0 +1,72 @@
namespace EgwCApp.Core
{
/// <summary>
/// Implementazione di riferimento x un file di configurazione x esecuzione task tramite EgwCApp
/// </summary>
public class ConfigFile
{
#region Public Properties
/// <summary>
/// Path Archivio dove depositare file ORIGINALI processati (se !="" vanno archiviati)
/// </summary>
public string ArchiveDir { get; set; } = "";
/// <summary>
/// Path dove depositare file tradotti processati (se !="" vanno spostati li)
/// </summary>
public string ConvertDir { get; set; } = "";
/// <summary>
/// Path file da processare
/// </summary>
public string FileInPath { get; set; } = "demoIn.txt";
/// <summary>
/// Path file dove salvare
/// </summary>
public string FileOutPath { get; set; } = "";
/// <summary>
/// IdxODL da registrare
/// </summary>
public int IdxODL { get; set; } = 0;
/// <summary>
/// Parametri per processing file string --&gt; int
/// </summary>
public Dictionary<string, int> ProcessParamInt { get; set; } = new Dictionary<string, int>();
/// <summary>
/// Parametri per processing file string --&gt; string
/// </summary>
public Dictionary<string, string> ProcessParamStr { get; set; } = new Dictionary<string, string>();
/// <summary>
/// DB Redis dove salvare
/// </summary>
public int RedisDB { get; set; } = 0;
/// <summary>
/// Posizione Redis dove salvare (HashKey)
/// </summary>
public string RedisOut { get; set; } = "";
/// <summary>
/// Modalità ritorno risutlati
/// </summary>
public ReturnMode Return { get; set; } = ReturnMode.ND;
/// <summary>
/// Path file da processare
/// </summary>
public string TargetName { get; set; } = "";
/// <summary>
/// Tipologia di iport da condurre
/// </summary>
public ImportType Type { get; set; } = ImportType.ND;
#endregion Public Properties
}
}
+15
View File
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ExcelDataReader.DataSet" Version="3.6.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="StackExchange.Redis" Version="2.6.86" />
</ItemGroup>
</Project>
+37
View File
@@ -0,0 +1,37 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace EgwCApp.Core
{
/// <summary>
/// Tipologia file da importare
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum ImportType
{
ND = 0,
CSV,
Excel
}
[JsonConverter(typeof(StringEnumConverter))]
public enum rawTransfType
{
ND,
IcoelBatch,
IcoelVarInfo,
RegGiacenze
}
/// <summary>
/// Modalità ritorno risultati
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum ReturnMode
{
ND = 0,
Console,
File,
Redis
}
}
@@ -7,7 +7,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IOB_UT_NEXT
namespace EgwCApp.Core
{
/// <summary>
/// Gestione lettura excel:
@@ -37,6 +37,7 @@ namespace IOB_UT_NEXT
// Auto-detect format, supports:
// - Binary Excel files (2.0-2003 format; *.xls)
// - OpenXml Excel files (2007 format; *.xlsx, *.xlsb)
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
using (var reader = ExcelReaderFactory.CreateReader(stream))
{
// 2. Use the AsDataSet extension method
@@ -103,4 +104,4 @@ namespace IOB_UT_NEXT
return rows;
}
}
}
}
+32
View File
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EgwCApp.Core
{
public class RedisMan
{
protected string connString = "";
protected string servAddr = "";
protected int servPort = 0;
protected int redisDb = 0;
public RedisMan(string server, int port, int db)
{
servAddr = server;
servPort = port;
redisDb = db;
connString = $"{servAddr}:{servPort},db={redisDb},abortConnect=false,ssl=false";
}
public bool writeData(string redKey, string rawData)
{
return false;
}
public string getRSV(string redKey)
{
return "";
}
}
}
+28
View File
@@ -0,0 +1,28 @@
namespace EgwCApp.Core
{
public class WharehouseData
{
#region Public Classes
public class BatchRec
{
#region Public Properties
public DateTime DateRif { get; set; } = DateTime.Today;
public string ExtDoc { get; set; } = "Doc";
public string IdentRG { get; set; } = "NA";
public int IdxODL { get; set; } = 0;
public string Notes { get; set; } = "Notes";
public int NumPack { get; set; } = 0;
public string Product { get; set; } = "Prod";
public double QtyTot { get; set; } = 0.0;
public string Supplier { get; set; } = "Suppl";
public string Variety { get; set; } = "Var";
#endregion Public Properties
}
#endregion Public Classes
}
}
+37
View File
@@ -0,0 +1,37 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.2.32516.85
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EgwCApp.Testing", "EgwCApp.Testing\EgwCApp.Testing.csproj", "{E37013B7-E5C6-48ED-8051-0BA5F29CB234}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EgwCApp.ExcImport", "EgwCApp.ExcImport\EgwCApp.ExcImport.csproj", "{D689CB4E-14DB-4CD4-B0D6-D2029219EF7E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EgwCApp.Core", "EgwCApp.Core\EgwCApp.Core.csproj", "{DF02D478-2309-48B8-BF0D-90B02327AF02}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E37013B7-E5C6-48ED-8051-0BA5F29CB234}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E37013B7-E5C6-48ED-8051-0BA5F29CB234}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E37013B7-E5C6-48ED-8051-0BA5F29CB234}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E37013B7-E5C6-48ED-8051-0BA5F29CB234}.Release|Any CPU.Build.0 = Release|Any CPU
{D689CB4E-14DB-4CD4-B0D6-D2029219EF7E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D689CB4E-14DB-4CD4-B0D6-D2029219EF7E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D689CB4E-14DB-4CD4-B0D6-D2029219EF7E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D689CB4E-14DB-4CD4-B0D6-D2029219EF7E}.Release|Any CPU.Build.0 = Release|Any CPU
{DF02D478-2309-48B8-BF0D-90B02327AF02}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DF02D478-2309-48B8-BF0D-90B02327AF02}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DF02D478-2309-48B8-BF0D-90B02327AF02}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DF02D478-2309-48B8-BF0D-90B02327AF02}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2AF3181F-288A-47D5-8087-2AB660476D85}
EndGlobalSection
EndGlobal
@@ -0,0 +1,32 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AssemblyName>ExcImport</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="StackExchange.Redis" Version="2.6.86" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\EgwCApp.Core\EgwCApp.Core.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="testConfExcel.json">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</None>
<None Update="testConfCsv.json">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</None>
<None Update="testConf.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
+373
View File
@@ -0,0 +1,373 @@
using EgwCApp.Core;
using Newtonsoft.Json;
using static EgwCApp.Core.WharehouseData;
namespace EgwCApp.ExcImport
{
public class ImportProc
{
#region Public Constructors
/// <summary>
/// Init oggetto per import
/// </summary>
/// <param name="confFileName"></param>
public ImportProc(string confFileName)
{
if (!string.IsNullOrEmpty(confFileName))
{
fileConfName = confFileName;
}
}
#endregion Public Constructors
#region Public Methods
/// <summary>
/// Decodifica configurazione
/// </summary>
/// <returns></returns>
public bool decodeConfig()
{
bool answ = false;
if (!string.IsNullOrEmpty(fileConfName))
{
// deserializzo config
if (!File.Exists(fileConfName))
{
Console.WriteLine($"Error: ConfigFile not found | {fileConfName}");
}
else
{
string rawData = File.ReadAllText(fileConfName);
// se ho contenuto procedo
if (string.IsNullOrEmpty(rawData))
{
Console.WriteLine($"Error: ConfigFile empty! | {fileConfName}");
}
else
{
// deserializzo
taskConfig = JsonConvert.DeserializeObject<ConfigFile>(rawData);
answ = taskConfig != null;
}
}
}
return answ;
}
/// <summary>
/// Esegue import (se possibile)
/// </summary>
/// <returns></returns>
public bool doProcess()
{
bool answ = false;
if (taskConfig != null)
{
// verifico esista il file...
if (string.IsNullOrEmpty(taskConfig.FileInPath) && File.Exists(taskConfig.FileInPath))
{
// manca file ingresso!!! esco!
}
else
{
// verifico il tipo di process necessario...
switch (taskConfig.Type)
{
case ImportType.CSV:
fileReturnData = File.ReadAllText(taskConfig.FileInPath);
answ = true;
break;
case ImportType.Excel:
fileReturnData = processExcelImport(taskConfig.FileInPath);
answ = true;
break;
case ImportType.ND:
default:
break;
}
}
}
return answ;
}
/// <summary>
/// Esecuzione ritorno informazioni secondo configurazione...
/// </summary>
/// <returns></returns>
public bool doReturn()
{
bool answ = false;
if (taskConfig != null)
{
// verifico il tipo di return necessario...
switch (taskConfig.Return)
{
case ReturnMode.Console:
Console.WriteLine(fileReturnData);
answ = true;
break;
case ReturnMode.Redis:
break;
case ReturnMode.File:
// verifico path ci sia... sennò creo
string outPath = string.IsNullOrEmpty(taskConfig.FileOutPath) ? "FileOut.txt" : taskConfig.FileOutPath;
// verifico se vadano salvati in una folder differente...
if (!string.IsNullOrEmpty(taskConfig.ConvertDir))
{
if (!Directory.Exists(taskConfig.ConvertDir))
{
Directory.CreateDirectory(taskConfig.ConvertDir);
}
outPath = Path.Combine(taskConfig.ConvertDir, Path.GetFileName(outPath));
}
// salvo il file!
File.WriteAllText(outPath, fileReturnData);
answ = true;
break;
case ReturnMode.ND:
default:
break;
}
// se fatto eventualmente archivio
if (answ)
{
if (!string.IsNullOrEmpty(taskConfig.ArchiveDir))
{
// verifico cartella archivio
if (!Directory.Exists(taskConfig.ArchiveDir))
{
Directory.CreateDirectory(taskConfig.ArchiveDir);
}
// sposto file
string fName = Path.GetFileName(taskConfig.FileInPath);
File.Move(taskConfig.FileInPath, Path.Combine(taskConfig.ArchiveDir, fName), true);
}
}
}
return answ;
}
#endregion Public Methods
#region Protected Properties
/// <summary>
/// Nome del file config da processare
/// </summary>
protected string fileConfName { get; set; } = "";
/// <summary>
/// Contenuto del file da restituire come return data (serializzato)
/// </summary>
protected string fileReturnData { get; set; } = "";
/// <summary>
/// Configurazione del task da eseguire
/// </summary>
protected ConfigFile? taskConfig { get; set; } = new ConfigFile();
#endregion Protected Properties
#region Protected Methods
/// <summary>
/// Estrae da una riga l'i-esimo elemento
/// </summary>
/// <param name="riga"></param>
/// <param name="col"></param>
/// <returns></returns>
protected string getCellVal(System.Data.DataRow? riga, int col)
{
string answ = "";
if (riga != null)
{
try
{
answ = $"{riga.ItemArray[col]}".Trim();
}
catch
{ }
}
return answ;
}
/// <summary>
/// Cleanup stringa x impiego tipo ident da char dubbi
/// </summary>
/// <param name="origData"></param>
/// <returns></returns>
protected string strFixId(string origData)
{
return origData.Replace(".", "").Replace(" ", "_");
}
#endregion Protected Methods
#region Private Methods
/// <summary>
/// Importa un file excel e restituisce una
/// </summary>
/// <param name="fileItem"></param>
/// <returns></returns>
private string processExcelImport(string fileItem)
{
string outVal = "";
int numErr = 0;
// test procedura di import files excel x Giacovelli...
var currExcel = new ExcelMan(fileItem);
// creo lista dati in formato RegGiacenze...
Dictionary<string, BatchRec> listaGiac = new Dictionary<string, BatchRec>();
var dtSet = currExcel.getDataSet();
if (dtSet != null && dtSet.Tables != null && dtSet.Tables.Count > 0)
{
string nomeFile = Path.GetFileName(fileItem);
nomeFile = nomeFile.Substring(0, nomeFile.LastIndexOf("."));
var elSheet = dtSet.Tables;
int idxTab = 0;
// cerco lo sheet corretto se > 1
if (dtSet.Tables.Count > 1)
{
bool found = false;
for (int i = 0; i < dtSet.Tables.Count; i++)
{
if (nomeFile.Contains(dtSet.Tables[i].TableName))
{
idxTab = i;
found = true;
break;
}
// controllo parametro opzionale...
if (!found && taskConfig != null && !string.IsNullOrEmpty(taskConfig.TargetName))
{
if (dtSet.Tables[i].TableName == taskConfig.TargetName)
{
idxTab = i;
break;
}
}
}
}
var tabella = dtSet.Tables[idxTab];
int numRighe = tabella.Rows.Count;
int idxODL = taskConfig != null ? taskConfig.IdxODL : 0;
for (int i = 0; i < numRighe; i++)
{
if (taskConfig != null && taskConfig.ProcessParamInt != null && taskConfig.ProcessParamInt.Count > 5)
{
if (numErr < numRighe / 5)
{
try
{
// variabili di appoggio...
DateTime dtRif = DateTime.Today;
double qtyTot = 0;
int numPack = 0;
var riga = tabella.Rows[i];
if (riga != null)
{
string ddt = getCellVal(riga, taskConfig.ProcessParamInt["ExtDoc"]);
string sDate = getCellVal(riga, taskConfig.ProcessParamInt["DateRif"]);
string prod = getCellVal(riga, taskConfig.ProcessParamInt["Product"]);
// verifiche x import: header, data e DDT (vuoti o "-") --> SKIP!
bool checkHeaderKo = (ddt == "DDT" || prod == "PRODOTTO");
bool checkEmptyDdt = (string.IsNullOrEmpty(ddt) || ddt == "-");
bool checkEmptyDate = (string.IsNullOrEmpty(sDate) || sDate == "-");
if (checkHeaderKo)
{
//lgTrace($"SKIP header");
}
else if (checkEmptyDdt || checkEmptyDate)
{
//lgTrace($"SKIP linea vuota | i: {i} | ddt: {ddt} | date: {sDate} | prod: {prod}");
}
else
{
string variety = getCellVal(riga, taskConfig.ProcessParamInt["Variety"]);
string suppl = getCellVal(riga, taskConfig.ProcessParamInt["Supplier"]);
string sQty = getCellVal(riga, taskConfig.ProcessParamInt["QtyTot"]);
string sNum = getCellVal(riga, taskConfig.ProcessParamInt["NumPack"]);
string numPed = getCellVal(riga, taskConfig.ProcessParamInt["NumPed"]);
string packPed = getCellVal(riga, taskConfig.ProcessParamInt["PackPed"]);
string pesoPack = getCellVal(riga, taskConfig.ProcessParamInt["PesoPack"]);
DateTime.TryParse(sDate, out dtRif);
int.TryParse(sNum, out numPack);
double.TryParse(sQty, out qtyTot);
string identRG = ddt.Length > 2 ? $"{strFixId(ddt)}.{strFixId(prod)}.{strFixId(variety)}.{strFixId(suppl)}" : $"{dtRif:yyyyMMdd}.{strFixId(prod)}.{strFixId(variety)}.{strFixId(suppl)}";
string notes = $"{numPed}x{packPed}x{pesoPack}";
// verifico di avere dati per proseguire...
bool checkIdent = !string.IsNullOrEmpty($"{prod}{variety}{suppl}");
if (checkIdent)
{
BatchRec newRow = new BatchRec()
{
IdxODL = idxODL,
IdentRG = identRG,
DateRif = dtRif,
ExtDoc = ddt,
Product = prod,
Variety = variety,
Supplier = suppl,
NumPack = numPack,
QtyTot = qtyTot,
Notes = notes
};
// verifico: se manca aggiungo
if (!listaGiac.ContainsKey(identRG))
{
listaGiac.Add(identRG, newRow);
}
else
{
// altrimenti aggiorno giacenza con valori numerici
listaGiac[identRG].NumPack += newRow.NumPack;
listaGiac[identRG].QtyTot += newRow.QtyTot;
}
}
else
{
//lgError($"Errore verifica identità riga | prod: {prod} | variety: {variety} | suppl: {suppl}");
numErr++;
}
}
}
}
catch (Exception exc)
{
numErr++;
}
}
}
}
}
if (listaGiac.Count > 0)
{
// converto in una nuova lista...
int rCounter = 1;
Dictionary<int, BatchRec> list2Send = new Dictionary<int, BatchRec>();
foreach (var item in listaGiac)
{
list2Send.Add(rCounter, item.Value);
rCounter++;
}
// serializzo e restituisco file JSON...
var serVal = JsonConvert.SerializeObject(list2Send);
if (serVal != null && !string.IsNullOrEmpty(serVal))
{
outVal = serVal;
}
}
return outVal;
}
#endregion Private Methods
}
}
+61
View File
@@ -0,0 +1,61 @@
// See https://aka.ms/new-console-template for more information
// ExcImport: Excel Importer, per IobWin in logica lettura Giacenze
// parametri:
// $0: Path ConfigFile file per esecuzione
using EgwCApp.ExcImport;
string separator = "--------------------------------------";
string fileName = "";
// controllo args, se mancassero o incompleti mostro help
if (args.Length < 1)
{
Console.WriteLine(separator);
Console.WriteLine("- ExcelFileImporter - Core 6.0");
Console.WriteLine("- v.0.0.0.0 | @Egalware 2022+");
Console.WriteLine(separator);
Console.WriteLine();
Console.WriteLine("Mancano parametri per esecuzione:");
Console.WriteLine("");
Console.WriteLine("$0: ConfigFile da impiegare");
// provo a processare testConf...
fileName = "testConf.json";
}
else
{
fileName = args[0];
}
// ora processo se ho filename valido...
if (!string.IsNullOrEmpty(fileName))
{
// verifico se ho file...
if (File.Exists(fileName))
{
ImportProc importObj = new ImportProc(fileName);
bool stepOk = importObj.decodeConfig();
if (stepOk)
{
stepOk = importObj.doProcess();
if (!stepOk)
{
Console.WriteLine("Errore in processing file");
}
else
{
importObj.doReturn();
}
}
else
{
Console.WriteLine("Errore in processing config file");
}
}
else
{
Console.WriteLine("Errore file non trovato!");
}
}
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<Configuration>Release</Configuration>
<Platform>Any CPU</Platform>
<PublishDir>bin\Release\net6.0\win-x64\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<_TargetId>Folder</_TargetId>
<TargetFramework>net6.0</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>false</SelfContained>
<PublishSingleFile>true</PublishSingleFile>
<PublishReadyToRun>false</PublishReadyToRun>
</PropertyGroup>
</Project>
+4
View File
@@ -0,0 +1,4 @@
@echo off
REM compilo in publish
dotnet publish EgwCApp.ExcImport.csproj -p:PublishSingleFile=true -r win-x64 -c Release --self-contained false
+25
View File
@@ -0,0 +1,25 @@
{
"ArchiveDir": "C:\\temp\\import\\archive",
"ConvertDir": "C:\\temp\\import\\convert",
"FileInPath": "C:\\temp\\import\\01.12.xlsx",
"FileOutPath": "01.12.json",
"IdxODL": 987654321,
"ProcessParamInt": {
"Product": 3,
"Variety": 9,
"Supplier": 8,
"ExtDoc": 2,
"DateRif": 14,
"QtyTot": 22,
"NumPack": 21,
"NumPed": 17,
"PackPed": 18,
"PesoPack": 20
},
"ProcessParamStr": {},
"RedisDB": 0,
"RedisOut": "",
"Return": "File",
"TargetName": "DB Loco",
"Type": "Excel"
}
@@ -0,0 +1,6 @@
{
"FilePath": "C:\\Temp\\test.log",
"ProcessParams": {},
"Return": "Console",
"Type": "Excel"
}
@@ -0,0 +1,25 @@
{
"ArchiveDir": "C:\\temp\\import\\archive",
"ConvertDir": "C:\\temp\\import\\convert",
"FileInPath": "C:\\temp\\import\\01.12.xlsx",
"FileOutPath": "01.12.json",
"IdxODL": 987654321,
"ProcessParamInt": {
"Product": 3,
"Variety": 9,
"Supplier": 8,
"ExtDoc": 2,
"DateRif": 14,
"QtyTot": 22,
"NumPack": 21,
"NumPed": 17,
"PackPed": 18,
"PesoPack": 20
},
"ProcessParamStr": {},
"RedisDB": 0,
"RedisOut": "",
"Return": "File",
"TargetName": "DB Loco",
"Type": "Excel"
}
+9
View File
@@ -0,0 +1,9 @@
echo ------------ Parametri compilazione ------------
echo OutDir: $(OutDir)
echo Configuration: $(ConfigurationName)
echo ProjectDir: $(ProjectDir)
echo AssemblyName: $(AssemblyName)
echo TargetDir: $(TargetDir)
echo ------------ Parametri compilazione ------------
preBuild.bat $(SolutionDir)EgwCApp.ExcImport\EgwCApp.ExcImport.csproj $(SolutionDir)EgwCApp.ExcImport\bin\Release\net6.0\publish\win-x64\ $(ProjectDir)Utils
@@ -0,0 +1,42 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AssemblyName>$(MSBuildProjectName)</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>embedded</DebugType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DebugType>embedded</DebugType>
</PropertyGroup>
<ItemGroup>
<Folder Include="Tools\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\EgwCApp.Core\EgwCApp.Core.csproj" />
<ProjectReference Include="..\EgwCApp.ExcImport\EgwCApp.ExcImport.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="Tools\ExcImport.exe">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="preBuild.bat $(SolutionDir)EgwCApp.ExcImport\bin\Release\net6.0\win-x64\publish\ $(ProjectDir)Tools" />
</Target>
</Project>
+114
View File
@@ -0,0 +1,114 @@
using EgwCApp.Core;
using Newtonsoft.Json;
using System.Diagnostics;
namespace EgwCApp.Testing
{
public class FileProcMan
{
#region Public Constructors
public FileProcMan(string toolDir, string exeFileName)
{
this.confFileName = "conf.json";
this.baseDir = toolDir;
this.exeName = exeFileName;
appPath = $"./{baseDir}/{exeName}";
}
#endregion Public Constructors
#region Public Methods
/// <summary>
/// Processa il singolo file e riporta tempo esecuzione
/// </summary>
/// <returns></returns>
public TimeSpan doProcess(string fPath)
{
TimeSpan outVal = new TimeSpan();
Stopwatch sw = new Stopwatch();
// preparo file conf
createConfFile(fPath);
// avvio processing
Console.WriteLine("calling ext app with args:");
Console.WriteLine($"{appPath} {confFileName}");
Console.WriteLine();
ProcessStartInfo psi = new ProcessStartInfo
{
FileName = appPath,
Arguments = $"{confFileName}",
WindowStyle = ProcessWindowStyle.Minimized,
//WindowStyle = ProcessWindowStyle.Hidden,
UseShellExecute = false,
//CreateNoWindow = true,
RedirectStandardOutput = true,
RedirectStandardInput = true,
};
sw.Start();
Process p = Process.Start(psi);
string q = "";
while (!p.HasExited)
{
q += p.StandardOutput.ReadToEnd();
}
sw.Stop();
outVal = sw.Elapsed;
return outVal;
}
#endregion Public Methods
#region Protected Fields
protected string appPath = "";
protected string baseDir = "";
protected string confFileName = "";
protected string exeName = "";
#endregion Protected Fields
#region Private Methods
private void createConfFile(string item)
{
Dictionary<string, int> importParams = new Dictionary<string, int>();
importParams.Add("Product", 3);
importParams.Add("Variety", 9);
importParams.Add("Supplier", 8);
importParams.Add("ExtDoc", 2);
importParams.Add("DateRif", 14);
importParams.Add("QtyTot", 22);
importParams.Add("NumPack", 21);
importParams.Add("NumPed", 17);
importParams.Add("PackPed", 18);
importParams.Add("PesoPack", 20);
// calcolo nome file conf specifico
string outFileName = Path.GetFileName(item).Replace("xlsx", "json");
confFileName = $"conf_{outFileName}";
// calcolo outFIleName
var newConf = new ConfigFile()
{
ArchiveDir = @"C:\temp\import\archive\",
ConvertDir = @"C:\temp\import\convert\",
Type = ImportType.Excel,
FileInPath = item,
FileOutPath = outFileName,
Return = ReturnMode.File,
ProcessParamInt = importParams,
TargetName = "DB Loco"
};
// serializzo e salvo!
var rawData = JsonConvert.SerializeObject(newConf, Formatting.Indented);
File.WriteAllText(confFileName, rawData);
}
#endregion Private Methods
}
}
+65
View File
@@ -0,0 +1,65 @@
// See https://aka.ms/new-console-template for more information
using EgwCApp.Core;
using System.Diagnostics;
using Newtonsoft.Json;
using EgwCApp.Testing;
Dictionary<string, TimeSpan> statsColl = new Dictionary<string, TimeSpan>();
Stopwatch sw = new Stopwatch();
string separator = "--------------------------------------";
Console.WriteLine(separator);
Console.WriteLine("Console Test Application");
Console.WriteLine(separator);
Console.WriteLine();
// creo il file di configurazione...
string fileName = "conf.json";
ConfigFile newConf = new ConfigFile();
string rawData = "";
// test CSV
//newConf = new ConfigFile()
//{
// Type = ImportType.CSV,
// FileInPath = @"C:\Temp\test.log",
// Return = ReturnMode.Console
//};
// svuoto eventuali conf vecchi
var listaConf = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.json");
if (listaConf != null && listaConf.Count() > 0)
{
foreach (var file2del in listaConf)
{
File.Delete(file2del);
}
}
// cerco file xlsx e ciclo...
var listaFiles = Directory.GetFiles(@"C:\temp\import\", "*.xlsx");
if (listaFiles != null && listaFiles.Count() > 0)
{
FileProcMan fpm = new FileProcMan("Tools", "ExcImport.exe");
foreach (var item in listaFiles)
{
TimeSpan timeElaps = fpm.doProcess(item);
statsColl.Add($"Ext prog executed for {item}", timeElaps);
}
}
Console.WriteLine(separator);
Console.WriteLine("press enter to proceed...");
Console.ReadLine();
foreach (var item in statsColl)
{
Console.WriteLine($"{item.Key} {item.Value.TotalMilliseconds} ms");
}
//Console.WriteLine($"Display executed in {timeElaps.TotalMilliseconds} ms");
Console.ReadLine();
Binary file not shown.
+6
View File
@@ -0,0 +1,6 @@
@echo off
REM recupero versione compilata
ROBOCOPY %1 %2 *.exe /MIR
echo Eseguito restore CApp!
+37
View File
@@ -0,0 +1,37 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.2.32516.85
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EgwCApp.Core", "EgwCApp.Core\EgwCApp.Core.csproj", "{DF02D478-2309-48B8-BF0D-90B02327AF02}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EgwCApp.XmlProc", "EgwCApp.XmlProc\EgwCApp.XmlProc.csproj", "{64BC5889-BE30-489A-B78F-8B3EE08819CB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EgwCApp.XmlTesting", "EgwCApp.XmlTesting\EgwCApp.XmlTesting.csproj", "{52D72303-ACAB-4289-8856-0F56A50474FC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DF02D478-2309-48B8-BF0D-90B02327AF02}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DF02D478-2309-48B8-BF0D-90B02327AF02}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DF02D478-2309-48B8-BF0D-90B02327AF02}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DF02D478-2309-48B8-BF0D-90B02327AF02}.Release|Any CPU.Build.0 = Release|Any CPU
{64BC5889-BE30-489A-B78F-8B3EE08819CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{64BC5889-BE30-489A-B78F-8B3EE08819CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{64BC5889-BE30-489A-B78F-8B3EE08819CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{64BC5889-BE30-489A-B78F-8B3EE08819CB}.Release|Any CPU.Build.0 = Release|Any CPU
{52D72303-ACAB-4289-8856-0F56A50474FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{52D72303-ACAB-4289-8856-0F56A50474FC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{52D72303-ACAB-4289-8856-0F56A50474FC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{52D72303-ACAB-4289-8856-0F56A50474FC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2AF3181F-288A-47D5-8087-2AB660476D85}
EndGlobalSection
EndGlobal
@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\EgwCApp.Core\EgwCApp.Core.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="testConf.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
+378
View File
@@ -0,0 +1,378 @@
using EgwCApp.Core;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static EgwCApp.Core.WharehouseData;
namespace EgwCApp.XmlProc
{
public class ImportProc
{
#region Public Constructors
/// <summary>
/// Init oggetto per import
/// </summary>
/// <param name="confFileName"></param>
public ImportProc(string confFileName)
{
if (!string.IsNullOrEmpty(confFileName))
{
fileConfName = confFileName;
}
}
#endregion Public Constructors
#region Public Methods
/// <summary>
/// Decodifica configurazione
/// </summary>
/// <returns></returns>
public bool decodeConfig()
{
bool answ = false;
if (!string.IsNullOrEmpty(fileConfName))
{
// deserializzo config
if (!File.Exists(fileConfName))
{
Console.WriteLine($"Error: ConfigFile not found | {fileConfName}");
}
else
{
string rawData = File.ReadAllText(fileConfName);
// se ho contenuto procedo
if (string.IsNullOrEmpty(rawData))
{
Console.WriteLine($"Error: ConfigFile empty! | {fileConfName}");
}
else
{
// deserializzo
taskConfig = JsonConvert.DeserializeObject<ConfigFile>(rawData);
answ = taskConfig != null;
}
}
}
return answ;
}
/// <summary>
/// Esegue import (se possibile)
/// </summary>
/// <returns></returns>
public bool doProcess()
{
bool answ = false;
if (taskConfig != null)
{
// verifico esista il file...
if (string.IsNullOrEmpty(taskConfig.FileInPath) && File.Exists(taskConfig.FileInPath))
{
// manca file ingresso!!! esco!
}
else
{
// verifico il tipo di process necessario...
switch (taskConfig.Type)
{
case ImportType.CSV:
fileReturnData = File.ReadAllText(taskConfig.FileInPath);
answ = true;
break;
case ImportType.Excel:
fileReturnData = processExcelImport(taskConfig.FileInPath);
answ = true;
break;
case ImportType.ND:
default:
break;
}
}
}
return answ;
}
/// <summary>
/// Esecuzione ritorno informazioni secondo configurazione...
/// </summary>
/// <returns></returns>
public bool doReturn()
{
bool answ = false;
if (taskConfig != null)
{
// verifico il tipo di return necessario...
switch (taskConfig.Return)
{
case ReturnMode.Console:
Console.WriteLine(fileReturnData);
answ = true;
break;
case ReturnMode.Redis:
break;
case ReturnMode.File:
// verifico path ci sia... sennò creo
string outPath = string.IsNullOrEmpty(taskConfig.FileOutPath) ? "FileOut.txt" : taskConfig.FileOutPath;
// verifico se vadano salvati in una folder differente...
if (!string.IsNullOrEmpty(taskConfig.ConvertDir))
{
if (!Directory.Exists(taskConfig.ConvertDir))
{
Directory.CreateDirectory(taskConfig.ConvertDir);
}
outPath = Path.Combine(taskConfig.ConvertDir, Path.GetFileName(outPath));
}
// salvo il file!
File.WriteAllText(outPath, fileReturnData);
answ = true;
break;
case ReturnMode.ND:
default:
break;
}
// se fatto eventualmente archivio
if (answ)
{
if (!string.IsNullOrEmpty(taskConfig.ArchiveDir))
{
// verifico cartella archivio
if (!Directory.Exists(taskConfig.ArchiveDir))
{
Directory.CreateDirectory(taskConfig.ArchiveDir);
}
// sposto file
string fName = Path.GetFileName(taskConfig.FileInPath);
File.Move(taskConfig.FileInPath, Path.Combine(taskConfig.ArchiveDir, fName), true);
}
}
}
return answ;
}
#endregion Public Methods
#region Protected Properties
/// <summary>
/// Nome del file config da processare
/// </summary>
protected string fileConfName { get; set; } = "";
/// <summary>
/// Contenuto del file da restituire come return data (serializzato)
/// </summary>
protected string fileReturnData { get; set; } = "";
/// <summary>
/// Configurazione del task da eseguire
/// </summary>
protected ConfigFile? taskConfig { get; set; } = new ConfigFile();
#endregion Protected Properties
#region Protected Methods
/// <summary>
/// Estrae da una riga l'i-esimo elemento
/// </summary>
/// <param name="riga"></param>
/// <param name="col"></param>
/// <returns></returns>
protected string getCellVal(System.Data.DataRow? riga, int col)
{
string answ = "";
if (riga != null)
{
try
{
answ = $"{riga.ItemArray[col]}".Trim();
}
catch
{ }
}
return answ;
}
/// <summary>
/// Cleanup stringa x impiego tipo ident da char dubbi
/// </summary>
/// <param name="origData"></param>
/// <returns></returns>
protected string strFixId(string origData)
{
return origData.Replace(".", "").Replace(" ", "_");
}
#endregion Protected Methods
#region Private Methods
/// <summary>
/// Importa un file excel e restituisce una
/// </summary>
/// <param name="fileItem"></param>
/// <returns></returns>
private string processExcelImport(string fileItem)
{
string outVal = "";
int numErr = 0;
// test procedura di import files excel x Giacovelli...
var currExcel = new ExcelMan(fileItem);
// creo lista dati in formato RegGiacenze...
Dictionary<string, BatchRec> listaGiac = new Dictionary<string, BatchRec>();
var dtSet = currExcel.getDataSet();
if (dtSet != null && dtSet.Tables != null && dtSet.Tables.Count > 0)
{
string nomeFile = Path.GetFileName(fileItem);
nomeFile = nomeFile.Substring(0, nomeFile.LastIndexOf("."));
var elSheet = dtSet.Tables;
int idxTab = 0;
// cerco lo sheet corretto se > 1
if (dtSet.Tables.Count > 1)
{
bool found = false;
for (int i = 0; i < dtSet.Tables.Count; i++)
{
if (nomeFile.Contains(dtSet.Tables[i].TableName))
{
idxTab = i;
found = true;
break;
}
// controllo parametro opzionale...
if (!found && taskConfig != null && !string.IsNullOrEmpty(taskConfig.TargetName))
{
if (dtSet.Tables[i].TableName == taskConfig.TargetName)
{
idxTab = i;
break;
}
}
}
}
var tabella = dtSet.Tables[idxTab];
int numRighe = tabella.Rows.Count;
int idxODL = taskConfig != null ? taskConfig.IdxODL : 0;
for (int i = 0; i < numRighe; i++)
{
if (taskConfig != null && taskConfig.ProcessParamInt != null && taskConfig.ProcessParamInt.Count > 5)
{
if (numErr < numRighe / 5)
{
try
{
// variabili di appoggio...
DateTime dtRif = DateTime.Today;
double qtyTot = 0;
int numPack = 0;
var riga = tabella.Rows[i];
if (riga != null)
{
string ddt = getCellVal(riga, taskConfig.ProcessParamInt["ExtDoc"]);
string sDate = getCellVal(riga, taskConfig.ProcessParamInt["DateRif"]);
string prod = getCellVal(riga, taskConfig.ProcessParamInt["Product"]);
// verifiche x import: header, data e DDT (vuoti o "-") --> SKIP!
bool checkHeaderKo = (ddt == "DDT" || prod == "PRODOTTO");
bool checkEmptyDdt = (string.IsNullOrEmpty(ddt) || ddt == "-");
bool checkEmptyDate = (string.IsNullOrEmpty(sDate) || sDate == "-");
if (checkHeaderKo)
{
//lgTrace($"SKIP header");
}
else if (checkEmptyDdt || checkEmptyDate)
{
//lgTrace($"SKIP linea vuota | i: {i} | ddt: {ddt} | date: {sDate} | prod: {prod}");
}
else
{
string variety = getCellVal(riga, taskConfig.ProcessParamInt["Variety"]);
string suppl = getCellVal(riga, taskConfig.ProcessParamInt["Supplier"]);
string sQty = getCellVal(riga, taskConfig.ProcessParamInt["QtyTot"]);
string sNum = getCellVal(riga, taskConfig.ProcessParamInt["NumPack"]);
string numPed = getCellVal(riga, taskConfig.ProcessParamInt["NumPed"]);
string packPed = getCellVal(riga, taskConfig.ProcessParamInt["PackPed"]);
string pesoPack = getCellVal(riga, taskConfig.ProcessParamInt["PesoPack"]);
DateTime.TryParse(sDate, out dtRif);
int.TryParse(sNum, out numPack);
double.TryParse(sQty, out qtyTot);
string identRG = ddt.Length > 2 ? $"{strFixId(ddt)}.{strFixId(prod)}.{strFixId(variety)}.{strFixId(suppl)}" : $"{dtRif:yyyyMMdd}.{strFixId(prod)}.{strFixId(variety)}.{strFixId(suppl)}";
string notes = $"{numPed}x{packPed}x{pesoPack}";
// verifico di avere dati per proseguire...
bool checkIdent = !string.IsNullOrEmpty($"{prod}{variety}{suppl}");
if (checkIdent)
{
BatchRec newRow = new BatchRec()
{
IdxODL = idxODL,
IdentRG = identRG,
DateRif = dtRif,
ExtDoc = ddt,
Product = prod,
Variety = variety,
Supplier = suppl,
NumPack = numPack,
QtyTot = qtyTot,
Notes = notes
};
// verifico: se manca aggiungo
if (!listaGiac.ContainsKey(identRG))
{
listaGiac.Add(identRG, newRow);
}
else
{
// altrimenti aggiorno giacenza con valori numerici
listaGiac[identRG].NumPack += newRow.NumPack;
listaGiac[identRG].QtyTot += newRow.QtyTot;
}
}
else
{
//lgError($"Errore verifica identità riga | prod: {prod} | variety: {variety} | suppl: {suppl}");
numErr++;
}
}
}
}
catch (Exception exc)
{
numErr++;
}
}
}
}
}
if (listaGiac.Count > 0)
{
// converto in una nuova lista...
int rCounter = 1;
Dictionary<int, BatchRec> list2Send = new Dictionary<int, BatchRec>();
foreach (var item in listaGiac)
{
list2Send.Add(rCounter, item.Value);
rCounter++;
}
// serializzo e restituisco file JSON...
var serVal = JsonConvert.SerializeObject(list2Send);
if (serVal != null && !string.IsNullOrEmpty(serVal))
{
outVal = serVal;
}
}
return outVal;
}
#endregion Private Methods
}
}
+62
View File
@@ -0,0 +1,62 @@
// See https://aka.ms/new-console-template for more information
// ExcImport: Excel Importer, per IobWin in logica lettura Giacenze
// parametri:
// $0: Path ConfigFile file per esecuzione
using EgwCApp.XmlProc;
string separator = "--------------------------------------";
string fileName = "";
// controllo args, se mancassero o incompleti mostro help
if (args.Length < 1)
{
Console.WriteLine(separator);
Console.WriteLine("- ExcelFileImporter - Core 6.0");
Console.WriteLine("- v.0.0.0.0 | @Egalware 2022+");
Console.WriteLine(separator);
Console.WriteLine();
Console.WriteLine("Mancano parametri per esecuzione:");
Console.WriteLine("");
Console.WriteLine("$0: ConfigFile da impiegare");
// provo a processare testConf...
fileName = "testConf.json";
}
else
{
fileName = args[0];
}
// ora processo se ho filename valido...
if (!string.IsNullOrEmpty(fileName))
{
// verifico se ho file...
if (File.Exists(fileName))
{
ImportProc importObj = new ImportProc(fileName);
bool stepOk = importObj.decodeConfig();
if (stepOk)
{
stepOk = importObj.doProcess();
if (!stepOk)
{
Console.WriteLine("Errore in processing file");
}
else
{
importObj.doReturn();
}
}
else
{
Console.WriteLine("Errore in processing config file");
}
}
else
{
Console.WriteLine("Errore file non trovato!");
}
}
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<Configuration>Release</Configuration>
<Platform>Any CPU</Platform>
<PublishDir>bin\Release\net6.0\win-x64\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<_TargetId>Folder</_TargetId>
<TargetFramework>net6.0</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>false</SelfContained>
<PublishSingleFile>true</PublishSingleFile>
<PublishReadyToRun>false</PublishReadyToRun>
</PropertyGroup>
</Project>
+4
View File
@@ -0,0 +1,4 @@
@echo off
REM compilo in publish
dotnet publish EgwCApp.ExcImport.csproj -p:PublishSingleFile=true -r win-x64 -c Release --self-contained false
+25
View File
@@ -0,0 +1,25 @@
{
"ArchiveDir": "C:\\temp\\import\\archive",
"ConvertDir": "C:\\temp\\import\\convert",
"FileInPath": "C:\\temp\\import\\01.12.xlsx",
"FileOutPath": "01.12.json",
"IdxODL": 987654321,
"ProcessParamInt": {
"Product": 3,
"Variety": 9,
"Supplier": 8,
"ExtDoc": 2,
"DateRif": 14,
"QtyTot": 22,
"NumPack": 21,
"NumPed": 17,
"PackPed": 18,
"PesoPack": 20
},
"ProcessParamStr": {},
"RedisDB": 0,
"RedisOut": "",
"Return": "File",
"TargetName": "DB Loco",
"Type": "Excel"
}
+6
View File
@@ -0,0 +1,6 @@
{
"FilePath": "C:\\Temp\\test.log",
"ProcessParams": {},
"Return": "Console",
"Type": "Excel"
}
@@ -0,0 +1,25 @@
{
"ArchiveDir": "C:\\temp\\import\\archive",
"ConvertDir": "C:\\temp\\import\\convert",
"FileInPath": "C:\\temp\\import\\01.12.xlsx",
"FileOutPath": "01.12.json",
"IdxODL": 987654321,
"ProcessParamInt": {
"Product": 3,
"Variety": 9,
"Supplier": 8,
"ExtDoc": 2,
"DateRif": 14,
"QtyTot": 22,
"NumPack": 21,
"NumPed": 17,
"PackPed": 18,
"PesoPack": 20
},
"ProcessParamStr": {},
"RedisDB": 0,
"RedisOut": "",
"Return": "File",
"TargetName": "DB Loco",
"Type": "Excel"
}
+9
View File
@@ -0,0 +1,9 @@
echo ------------ Parametri compilazione ------------
echo OutDir: $(OutDir)
echo Configuration: $(ConfigurationName)
echo ProjectDir: $(ProjectDir)
echo AssemblyName: $(AssemblyName)
echo TargetDir: $(TargetDir)
echo ------------ Parametri compilazione ------------
preBuild.bat $(SolutionDir)EgwCApp.ExcImport\EgwCApp.ExcImport.csproj $(SolutionDir)EgwCApp.ExcImport\bin\Release\net6.0\publish\win-x64\ $(ProjectDir)Utils
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\EgwCApp.Core\EgwCApp.Core.csproj" />
<ProjectReference Include="..\EgwCApp.XmlProc\EgwCApp.XmlProc.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="Tools\ExcImport.exe">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
+120
View File
@@ -0,0 +1,120 @@
using System;
using System.Collections.Generic;
using EgwCApp.Core;
using Newtonsoft.Json;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EgwCApp.XmlTesting
{
public class FileProcMan
{
#region Public Constructors
public FileProcMan(string toolDir, string exeFileName)
{
this.confFileName = "conf.json";
this.baseDir = toolDir;
this.exeName = exeFileName;
appPath = $"./{baseDir}/{exeName}";
}
#endregion Public Constructors
#region Public Methods
/// <summary>
/// Processa il singolo file e riporta tempo esecuzione
/// </summary>
/// <returns></returns>
public TimeSpan doProcess(string fPath)
{
TimeSpan outVal = new TimeSpan();
Stopwatch sw = new Stopwatch();
// preparo file conf
createConfFile(fPath);
// avvio processing
Console.WriteLine("calling ext app with args:");
Console.WriteLine($"{appPath} {confFileName}");
Console.WriteLine();
ProcessStartInfo psi = new ProcessStartInfo
{
FileName = appPath,
Arguments = $"{confFileName}",
WindowStyle = ProcessWindowStyle.Minimized,
//WindowStyle = ProcessWindowStyle.Hidden,
UseShellExecute = false,
//CreateNoWindow = true,
RedirectStandardOutput = true,
RedirectStandardInput = true,
};
sw.Start();
Process p = Process.Start(psi);
string q = "";
while (!p.HasExited)
{
q += p.StandardOutput.ReadToEnd();
}
sw.Stop();
outVal = sw.Elapsed;
return outVal;
}
#endregion Public Methods
#region Protected Fields
protected string appPath = "";
protected string baseDir = "";
protected string confFileName = "";
protected string exeName = "";
#endregion Protected Fields
#region Private Methods
private void createConfFile(string item)
{
Dictionary<string, int> importParams = new Dictionary<string, int>();
importParams.Add("Product", 3);
importParams.Add("Variety", 9);
importParams.Add("Supplier", 8);
importParams.Add("ExtDoc", 2);
importParams.Add("DateRif", 14);
importParams.Add("QtyTot", 22);
importParams.Add("NumPack", 21);
importParams.Add("NumPed", 17);
importParams.Add("PackPed", 18);
importParams.Add("PesoPack", 20);
// calcolo nome file conf specifico
string outFileName = Path.GetFileName(item).Replace("xlsx", "json");
confFileName = $"conf_{outFileName}";
// calcolo outFIleName
var newConf = new ConfigFile()
{
ArchiveDir = @"C:\temp\import\archive\",
ConvertDir = @"C:\temp\import\convert\",
Type = ImportType.Excel,
FileInPath = item,
FileOutPath = outFileName,
Return = ReturnMode.File,
ProcessParamInt = importParams,
TargetName = "DB Loco"
};
// serializzo e salvo!
var rawData = JsonConvert.SerializeObject(newConf, Formatting.Indented);
File.WriteAllText(confFileName, rawData);
}
#endregion Private Methods
}
}
+65
View File
@@ -0,0 +1,65 @@
// See https://aka.ms/new-console-template for more information
using EgwCApp.Core;
using System.Diagnostics;
using Newtonsoft.Json;
using EgwCApp.XmlTesting;
Dictionary<string, TimeSpan> statsColl = new Dictionary<string, TimeSpan>();
Stopwatch sw = new Stopwatch();
string separator = "--------------------------------------";
Console.WriteLine(separator);
Console.WriteLine("Console Test Application");
Console.WriteLine(separator);
Console.WriteLine();
// creo il file di configurazione...
string fileName = "conf.json";
ConfigFile newConf = new ConfigFile();
string rawData = "";
// test CSV
//newConf = new ConfigFile()
//{
// Type = ImportType.CSV,
// FileInPath = @"C:\Temp\test.log",
// Return = ReturnMode.Console
//};
// svuoto eventuali conf vecchi
var listaConf = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.json");
if (listaConf != null && listaConf.Count() > 0)
{
foreach (var file2del in listaConf)
{
File.Delete(file2del);
}
}
// cerco file xlsx e ciclo...
var listaFiles = Directory.GetFiles(@"C:\temp\import\", "*.xlsx");
if (listaFiles != null && listaFiles.Count() > 0)
{
FileProcMan fpm = new FileProcMan("Tools", "ExcImport.exe");
foreach (var item in listaFiles)
{
TimeSpan timeElaps = fpm.doProcess(item);
statsColl.Add($"Ext prog executed for {item}", timeElaps);
}
}
Console.WriteLine(separator);
Console.WriteLine("press enter to proceed...");
Console.ReadLine();
foreach (var item in statsColl)
{
Console.WriteLine($"{item.Key} {item.Value.TotalMilliseconds} ms");
}
//Console.WriteLine($"Display executed in {timeElaps.TotalMilliseconds} ms");
Console.ReadLine();
Binary file not shown.
+6
View File
@@ -0,0 +1,6 @@
@echo off
REM recupero versione compilata
ROBOCOPY %1 %2 *.exe /MIR
echo Eseguito restore CApp!
+28 -28
View File
@@ -1,25 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
</startup>
<entityFramework>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<appSettings>
<add key="IndirizzoIpSizer" value="192.168.137.50" />
<add key="SizerTcpPort" value="8001" />
<add key="EntrataFrontiera" value="data source=192.168.137.10\sqlexpress;initial catalog=frontiera;persist security info=True;user id=egalware;password=egalware2022;MultipleActiveResultSets=True;App=IOB-WIN-NEXT" />
<add key="ExportIcoel" value="data source=192.168.137.10\sqlexpress;initial catalog=IcoelExport;persist security info=True;user id=egalware;password=egalware2022;MultipleActiveResultSets=True;App=IOB-WIN-NEXT" />
<add key="TrackerLotti" value="data source=192.168.250.250\sqlexpress;initial catalog=TrackerLotti3;persist security info=True;user id=egalware;password=egalware2022;MultipleActiveResultSets=True;App=IOB-WIN-NEXT" />
<add key="SyncState" value="data source=localhost\sqlexpress;initial catalog=MoonPro_ISF;persist security info=True;user id=egalware;password=egalware2022;MultipleActiveResultSets=True;App=IOB-WIN-NEXT" />
</appSettings>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
</startup>
<entityFramework>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<appSettings>
<add key="IndirizzoIpSizer" value="192.168.137.50" />
<add key="SizerTcpPort" value="8001" />
<add key="EntrataFrontiera" value="data source=192.168.137.10\sqlexpress;initial catalog=frontiera;persist security info=True;user id=egalware;password=egalware2022;MultipleActiveResultSets=True;App=IOB-WIN-NEXT" />
<add key="ExportIcoel" value="data source=192.168.137.10\sqlexpress;initial catalog=IcoelExport;persist security info=True;user id=egalware;password=egalware2022;MultipleActiveResultSets=True;App=IOB-WIN-NEXT" />
<add key="TrackerLotti" value="data source=192.168.250.250\sqlexpress;initial catalog=TrackerLotti3;persist security info=True;user id=egalware;password=egalware2022;MultipleActiveResultSets=True;App=IOB-WIN-NEXT" />
<add key="SyncState" value="data source=localhost\sqlexpress;initial catalog=MoonPro_ISF;persist security info=True;user id=egalware;password=egalware2022;MultipleActiveResultSets=True;App=IOB-WIN-NEXT" />
</appSettings>
<system.serviceModel>
<bindings>
<netNamedPipeBinding>
@@ -38,14 +38,14 @@
<endpoint address="net.pipe://localhost/Compac/8001/SizerService" binding="netNamedPipeBinding" bindingConfiguration="NetNamedPipeBinding_ISizerService" contract="SizerService.ISizerService" name="NetNamedPipeBinding_ISizerService" />
</client>
</system.serviceModel>
<!--
<connectionStrings>
<add name="EntrataFrontiera" connectionString="data source=192.168.137.10\sqlexpress;initial catalog=frontiera;persist security info=True;user id=egalware;password=egalware2022;MultipleActiveResultSets=True;App=IOB-WIN-NEXT" providerName="System.Data.SqlClient" />
<add name="ExportIcoel" connectionString="data source=192.168.137.10\sqlexpress;initial catalog=IcoelExport;persist security info=True;user id=egalware;password=egalware2022;MultipleActiveResultSets=True;App=IOB-WIN-NEXT" providerName="System.Data.SqlClient" />
<add name="TrackerLotti" connectionString="data source=192.168.250.250\sqlexpress;initial catalog=TrackerLotti3;persist security info=True;user id=egalware;password=egalware2022;MultipleActiveResultSets=True;App=IOB-WIN-NEXT" providerName="System.Data.SqlClient" />
<add name="SyncState" connectionString="data source=localhost\sqlexpress;initial catalog=MoonPro_ISF;persist security info=True;user id=egalware;password=egalware2022;MultipleActiveResultSets=True;App=IOB-WIN-NEXT" providerName="System.Data.SqlClient" />
</connectionStrings>
-->
<!--
<connectionStrings>
<add name="EntrataFrontiera" connectionString="data source=192.168.137.10\sqlexpress;initial catalog=frontiera;persist security info=True;user id=egalware;password=egalware2022;MultipleActiveResultSets=True;App=IOB-WIN-NEXT" providerName="System.Data.SqlClient" />
<add name="ExportIcoel" connectionString="data source=192.168.137.10\sqlexpress;initial catalog=IcoelExport;persist security info=True;user id=egalware;password=egalware2022;MultipleActiveResultSets=True;App=IOB-WIN-NEXT" providerName="System.Data.SqlClient" />
<add name="TrackerLotti" connectionString="data source=192.168.250.250\sqlexpress;initial catalog=TrackerLotti3;persist security info=True;user id=egalware;password=egalware2022;MultipleActiveResultSets=True;App=IOB-WIN-NEXT" providerName="System.Data.SqlClient" />
<add name="SyncState" connectionString="data source=localhost\sqlexpress;initial catalog=MoonPro_ISF;persist security info=True;user id=egalware;password=egalware2022;MultipleActiveResultSets=True;App=IOB-WIN-NEXT" providerName="System.Data.SqlClient" />
</connectionStrings>
-->
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
+24
View File
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<package >
<metadata>
<id>EgwProxy.SqlDb</id>
<version>#version#</version>
<title>EgwProxy.SqlDb</title>
<authors>Samuele E. Locatelli, EgalWare</authors>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<license type="expression">MIT</license>
<description>Libreria per comunicazione con generico DB SqlDb di frontiera x scambio dati (IOB-WIN-NEXT) - beta/unstable</description>
<releaseNotes>#releaseNotes#</releaseNotes>
<copyright>#copyright#</copyright>
<tags>EgwProxy.SqlDb EgwProxy SqlDb</tags>
<dependencies>
<dependency id="NLog" version="5.1.2" />
<dependency id="EntityFramework" version="6.4.4" />
</dependencies>
</metadata>
<files>
<file src="EgwProxy.SqlDb\bin\Debug\EgwProxy*.dll" target="lib" />
<file src="EgwProxy.SqlDb\bin\Debug\EgwProxy*.config" target="lib" />
<file src="EgwProxy.SqlDb\bin\Debug\EgwProxy*.pdb" target="lib" />
</files>
</package>
+23
View File
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<package >
<metadata>
<id>EgwProxy.SqlDb</id>
<version>#version#</version>
<title>EgwProxy.SqlDb</title>
<authors>Samuele E. Locatelli, EgalWare</authors>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<license type="expression">MIT</license>
<description>Libreria per comunicazione con generico DB SqlDb di frontiera x scambio dati (IOB-WIN-NEXT)</description>
<releaseNotes>#releaseNotes#</releaseNotes>
<copyright>#copyright#</copyright>
<tags>EgwProxy.SqlDb EgwProxy SqlDb</tags>
<dependencies>
<dependency id="NLog" version="5.1.2" />
<dependency id="EntityFramework" version="6.4.4" />
</dependencies>
</metadata>
<files>
<file src="EgwProxy.SqlDb\bin\Release\EgwProxy*.dll" target="lib" />
<file src="EgwProxy.SqlDb\bin\Release\EgwProxy*.config" target="lib" />
</files>
</package>
+25
View File
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
</startup>
<entityFramework>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<appSettings>
<add key="testFile" value="conf/testSetup.json" />
<add key="server" value="SQL2016DEV" />
<add key="userName" value="sa" />
<add key="passwd" value="keyhammer16" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
</appSettings>
<runtime>
</runtime>
</configuration>
@@ -0,0 +1,105 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\EntityFramework.6.4.4\build\EntityFramework.props" Condition="Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.props')" />
<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>{A11CA446-AE97-413D-A567-45A081F003DB}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>EgwProxy.SqlDb.Test</RootNamespace>
<AssemblyName>EgwProxy.SqlDb.Test</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</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>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Remote_DEBUG|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Remote_DEBUG\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
</Reference>
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.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="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" />
<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" />
<Compile Include="TestSetup.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="conf\.placeholder" />
<None Include="conf\testSetup.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="packages.config" />
<None Include="postBuildTgt.bat" />
<None Include="setupTgt.bat" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\EgwProxy.SqlDb\EgwProxy.SqlDb.csproj">
<Project>{a5f9e2c8-b866-4470-923c-11ba35270963}</Project>
<Name>EgwProxy.SqlDb</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\EntityFramework.6.4.4\build\EntityFramework.props'))" />
<Error Condition="!Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\EntityFramework.6.4.4\build\EntityFramework.targets'))" />
</Target>
<Import Project="..\packages\EntityFramework.6.4.4\build\EntityFramework.targets" Condition="Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.targets')" />
<PropertyGroup>
<PreBuildEvent>"$(ProjectDir)setupTgt.bat" "$(ConfigurationName)" "$(ProjectDir)"</PreBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>"$(ProjectDir)postBuildTgt.bat" "$(ConfigurationName)" "$(TargetDir)"</PostBuildEvent>
</PropertyGroup>
</Project>
+296
View File
@@ -0,0 +1,296 @@
using EgwProxy.SqlDb.Controllers;
using EgwProxy.SqlDb.DbModels;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Text;
using static System.Net.Mime.MediaTypeNames;
namespace EgwProxy.SqlDb.Test
{
internal class Program
{
#region Protected Methods
/// <summary>
/// legge conf in formato stringa
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
protected static string ReadSetting(string key)
{
string answ = "";
try
{
answ = $"{ConfigurationManager.AppSettings[key]}" ?? "";
}
catch (Exception exc)
{
Console.Write("Eccezione in ReadSettings");
Console.Write(exc.Message);
}
return answ;
}
#endregion Protected Methods
#region Private Fields
/// <summary>
/// Helper separatore dash
/// </summary>
private const string separator = "------------------------";
#endregion Private Fields
#region Private Methods
/// <summary>
/// Programma principale
/// </summary>
/// <param name="args"></param>
private static void Main(string[] args)
{
Console.WriteLine(separator);
Console.WriteLine("Test DB Client");
Console.WriteLine(separator);
Console.WriteLine();
string exePath = System.Reflection.Assembly.GetExecutingAssembly().Location;
string BaseDirectory = Path.GetDirectoryName(exePath);
string testFile = Path.Combine(BaseDirectory, ReadSetting("testFile"));
string connStr = "";
DbController dbClient = new DbController(connStr);
if (!string.IsNullOrEmpty(testFile))
{
Console.WriteLine(separator);
Console.WriteLine($"Mode json ({testFile})");
Console.WriteLine(separator);
Console.WriteLine();
if (File.Exists(testFile))
{
var rawData = File.ReadAllText(testFile);
if (!string.IsNullOrEmpty(rawData))
{
TestSetup testConf = new TestSetup();
try
{
testConf = JsonConvert.DeserializeObject<TestSetup>(rawData);
}
catch
{ }
// setup server
connStr = $"data source={testConf.server};initial catalog={testConf.dbName};persist security info=True;user id={testConf.user};password={testConf.password};MultipleActiveResultSets=True;App={testConf.app}";
dbClient = new DbController(connStr);
serverTest(dbClient);
// eseguo per ogni step
foreach (var item in testConf.steps)
{
Console.WriteLine($"------ Step {item.id} | {item.description} ------");
StringBuilder sb = new StringBuilder();
sb.AppendLine(separator);
switch (item.action)
{
case stepType.GetSyncState:
var currTab = dbClient.SyncStateGetAll();
if (currTab != null && currTab.Count > 0)
{
foreach (var syncRec in currTab)
{
sb.AppendLine($"{syncRec.TableName} | {syncRec.LastIdx} | {syncRec.Note} | {syncRec.LastUpdate}");
}
}
else
{
sb.AppendLine("Error: Table empty/missing!");
}
sb.AppendLine(separator);
break;
case stepType.ResetPodl:
sb.AppendLine("Inizio reset PODL");
var dbRes = dbClient.ResetPODLMes();
if (dbRes.Count == 0)
{
sb.AppendLine("Pulizia eseguita!");
}
else
{
sb.AppendLine("Problemi con svuotamento tab PODL");
}
sb.AppendLine(separator);
break;
case stepType.SetNewPodl:
sb.AppendLine($"Inizio inserimento {item.paramList.Count} rec");
// creo una lista di PODL da processare...
List<MesPODLReqModel> CurrPodlReq = new List<MesPODLReqModel>();
foreach (var podl in item.paramList)
{
int idxPodl = 0;
int.TryParse(podl, out idxPodl);
MesPODLReqModel newRec = new MesPODLReqModel()
{
Attivabile = true,
CodArticolo = "ART000000",
IdxMacchina = "SIMUL_01",
IdxODL = 0,
IdxPromessa = idxPodl,
NumPezzi = 1
};
CurrPodlReq.Add(newRec);
sb.AppendLine($"Aggiunto PODL{podl:0000000}");
}
// chiamo procedura insert PODL
bool fatto = dbClient.MesPodlWriteReq(CurrPodlReq);
sb.AppendLine($"Records Aggiunti!");
sb.AppendLine(separator);
break;
case stepType.DbMigrateAndSync:
try
{
var esitoMigrate = dbClient.DbForceMigrate();
sb.Append($"Migration: {esitoMigrate}");
}
catch (Exception exc)
{
sb.AppendLine($"eccezione in migrate:{Environment.NewLine}{exc}");
}
break;
case stepType.ExecExportAll:
try
{
var esitoExport = dbClient.SyncStateDoExportAll();
sb.Append($"ExportAll: {esitoExport}");
}
catch (Exception exc)
{
sb.AppendLine($"eccezione in ExportAll:{Environment.NewLine}{exc}");
}
break;
case stepType.ExecImportAll:
try
{
var esitoImport = dbClient.SyncStateDoImportAll();
sb.Append($"ImportAll: {esitoImport}");
}
catch (Exception exc)
{
sb.AppendLine($"eccezione in ImportAll:{Environment.NewLine}{exc}");
}
break;
case stepType.GetMachFluxLog:
try
{
var currFL = dbClient.MachFluxLogGetNew(0);
// mostro le righe
foreach (var fluxRow in currFL)
{
// aggiungo riga in out
sb.Append($"{fluxRow.Id:000} | {fluxRow.DtEvento} | {fluxRow.CodFlux} | {fluxRow.Valore}");
}
// aggiorno syncstate...
int lastIdx = currFL.Max(x => x.Id);
SyncStateModel currSync = new SyncStateModel()
{
LastIdx = lastIdx,
LastUpdate = DateTime.Now,
Note = "Test update",
TableName = "FluxLog"
};
dbClient.SyncStateUpsert(currSync);
}
catch (Exception exc)
{
sb.AppendLine($"eccezione in GetMachFluxLog:{Environment.NewLine}{exc}");
}
break;
case stepType.GetMachProdData:
try
{
var currFL = dbClient.MachProdDataGetNew(0);
// mostro le righe
foreach (var fluxRow in currFL)
{
// aggiungo riga in out
sb.Append($"{fluxRow.Id:000} | {fluxRow.DtEve} | {fluxRow.CodComm} | {fluxRow.Action}");
}
// aggiorno syncstate...
int lastIdx = currFL.Max(x => x.Id);
SyncStateModel currSync = new SyncStateModel()
{
LastIdx = lastIdx,
LastUpdate = DateTime.Now,
Note = "Test update",
TableName = "ProdData"
};
dbClient.SyncStateUpsert(currSync);
}
catch (Exception exc)
{
sb.AppendLine($"eccezione in GetMachProdData:{Environment.NewLine}{exc}");
}
break;
case stepType.GetMachSignLog:
try
{
var currFL = dbClient.MachSigLogGetNew(0);
// mostro le righe
foreach (var fluxRow in currFL)
{
// aggiungo riga in out
sb.Append($"{fluxRow.Id:000} | {fluxRow.DtEve} | {fluxRow.ValInt} | {fluxRow.Valore}");
}
// aggiorno syncstate...
int lastIdx = currFL.Max(x => x.Id);
SyncStateModel currSync = new SyncStateModel()
{
LastIdx = lastIdx,
LastUpdate = DateTime.Now,
Note = "Test update",
TableName = "SignLog"
};
dbClient.SyncStateUpsert(currSync);
}
catch (Exception exc)
{
sb.AppendLine($"eccezione in GetMachSignLog:{Environment.NewLine}{exc}");
}
break;
default:
break;
}
string esitoStep = sb.ToString();
Console.WriteLine(esitoStep);
Console.WriteLine($"------ Done Step {item.id} ------");
Console.WriteLine();
Console.WriteLine("Press a key to continue...");
Console.ReadKey();
}
}
}
}
}
private static void serverTest(DbController dbClient)
{
Console.WriteLine(separator);
string testServer = dbClient.ServerOk();
Console.WriteLine($"Test connessione: esito {testServer}");
Console.WriteLine(separator);
Console.WriteLine();
}
#endregion Private Methods
}
}
@@ -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.SqlDb.Test")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EgwProxy.SqlDb.Test")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[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("a11ca446-ae97-413d-a567-45a081f003db")]
// 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")]
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,107 @@
ALTER PROCEDURE [dbo].[GetMachineFluxLog]
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
BEGIN tran
-- dichiarazioni variabili x recupero dati
DECLARE @LastIdx INT = 0
DECLARE @NewIdx INT = 0
-- recupero valore ultima riga stato processata...
SELECT @LastIdx = ISNULL(LastIdx,0)
FROM SyncState
WHERE TableName = 'ToMachineFluxLog'
-- recupero nuovo MAX idx
SELECT @NewIdx = ISNULL(MAX(ID),0)
FROM syn_M2ERP_MACHINE_STATE
-- eseguo SOLO SE ho dati aggiuntivi...
IF(@NewIdx > @LastIdx)
BEGIN
/* --------------------------------------------------
* Invierò solo VARIAZIONI dei valori
* - CurrentPP (Part Program)
* - ActiveProdOrder (Ordine in esecuzione)
*
* andando ad incrociare ogni record col precedente...
* -------------------------------------------------- */
-- processo dati ORDINI
;WITH cteCurrOrd AS
(
SELECT ID
,ActiveProdOrder
,Targa as IdxMacchina
,[DateTime] AS DtEvento
FROM syn_M2ERP_MACHINE_STATE
WHERE ID > @LastIdx AND ID <= @NewIdx
)
, ctePrevOrd AS
(
SELECT ID
,ActiveProdOrder
,Targa as IdxMacchina
,[DateTime] AS DtEvento
FROM syn_M2ERP_MACHINE_STATE
WHERE ID >= @LastIdx AND ID < @NewIdx
)
-- lego i valori col precedente x calcolare se siano variati x insert valori
INSERT INTO MachineFluxLog(DtEvento, IdxMacchina, CodFlux, Valore, Cnt)
SELECT curr.DtEvento, curr.IdxMacchina, 'ProdOrd' AS CodFlux, curr.ActiveProdOrder as Valore, 0 as Cnt
FROM cteCurrOrd curr
INNER JOIN ctePrevOrd prev
ON curr.ID = prev.ID+1
WHERE curr.ActiveProdOrder <> prev.ActiveProdOrder
-- processo dati Part Program
;WITH cteCurrPP AS
(
SELECT ID
,CurrentPP
,Targa as IdxMacchina
,[DateTime] AS DtEvento
FROM syn_M2ERP_MACHINE_STATE
WHERE ID > @LastIdx AND ID <= @NewIdx
)
, ctePrevPP AS
(
SELECT ID
,CurrentPP
,Targa as IdxMacchina
,[DateTime] AS DtEvento
FROM syn_M2ERP_MACHINE_STATE
WHERE ID >= @LastIdx AND ID < @NewIdx
)
-- lego i valori col precedente x calcolare se siano variati x insert valori
INSERT INTO MachineFluxLog(DtEvento, IdxMacchina, CodFlux, Valore, Cnt)
SELECT curr.DtEvento, curr.IdxMacchina, 'PartProg' as CodFlux, curr.CurrentPP as Valore, 0 as Cnt
FROM cteCurrPP curr
INNER JOIN ctePrevPP prev
ON curr.ID = prev.ID+1
WHERE curr.CurrentPP <> prev.CurrentPP
-- aggiorno valore indice processato
MERGE SyncState AS tgt
USING (SELECT @NewIdx as LastIdx, 'ToMachineFluxLog' AS TableName) as src (LastIdx, TableName)
ON (tgt.TableName = src.TableName)
WHEN MATCHED THEN
UPDATE SET LastIdx = src.LastIdx
,Note = 'UPDATED from ' + CAST(@LastIdx AS NVARCHAR(50))
,LastUpdate = GETDATE()
WHEN NOT MATCHED THEN
INSERT (LastIdx, TableName, Note, LastUpdate)
VALUES (src.LastIdx, src.TableName, 'CREATED', GETDATE());
END
COMMIT tran
END
@@ -0,0 +1,166 @@
ALTER PROCEDURE [dbo].[stp_GetMachineProdData]
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
BEGIN tran
-- dichiarazioni variabili x recupero dati
DECLARE @LastIdx INT = 0
DECLARE @NewIdx INT = 0
-- recupero valore ultima riga stato processata...
SELECT @LastIdx = ISNULL(LastIdx,0)
FROM SyncState
WHERE TableName = 'ToMachineProdData'
-- recupero nuovo MAX idx
SELECT @NewIdx = ISNULL(MAX(ID),0)
FROM syn_M2ERP_PRODORDERS
-- eseguo SOLO SE ho dati aggiuntivi...
IF(@NewIdx > @LastIdx)
BEGIN
/* --------------------------------------------------
* Invierò solo VARIAZIONI dei valori
* - CurrentProdOrder (iniziato/concluso)
* - Quantità Produzione
* - dati FluxLog x ordini/quantità/tempi di produzione
*
* andando ad incrociare ogni record col precedente...
* -------------------------------------------------- */
-- processo dati ORDINI
;WITH cteCurrOrd AS
(
SELECT ID
,ProdOrder
,Targa as IdxMacchina
,[DateTime] AS DtEvento
,ProdOrderState
,ProdQty
FROM syn_M2ERP_PRODORDERS
WHERE ID > @LastIdx AND ID <= @NewIdx
)
, ctePrevOrd AS
(
SELECT ID
,ProdOrder
,Targa as IdxMacchina
,[DateTime] AS DtEvento
,ProdOrderState
,ProdQty
FROM syn_M2ERP_PRODORDERS
WHERE ID >= @LastIdx AND ID < @NewIdx
)
, cteActDec AS
(
SELECT curr.DtEvento as DtEve
,curr.IdxMacchina
,CASE
WHEN curr.ProdOrderState = 1 THEN 'StartOrd'
--WHEN curr.ProdOrderState = 2 THEN 'PauseOrd'
WHEN curr.ProdOrderState = 3 THEN 'EndOrd'
--WHEN curr.ProdOrderState = 6 THEN 'InsOrd'
ELSE 'NONE'
END AS OrdAction
,CASE
WHEN LEFT(curr.ProdOrder, 4) = 'PODL' THEN REPLACE(curr.ProdOrder,'PODL','')
ELSE 0 END AS IdxPodl
,CASE
WHEN LEFT(curr.ProdOrder, 3) = 'ODL' THEN REPLACE(curr.ProdOrder,'ODL','')
ELSE 0 END AS IdxOdl
,curr.ProdOrder as CodComm
,curr.ProdQty as PzCount
FROM cteCurrOrd curr
INNER JOIN ctePrevOrd prev
ON curr.ID = prev.ID+1
WHERE (curr.ProdOrder <> prev.ProdOrder)
OR (curr.ProdOrderState <> prev.ProdOrderState)
OR (curr.ProdQty <> prev.ProdQty)
)
-- lego i valori col precedente x calcolare se siano variati x insert valori
INSERT INTO MachineProdData(DtEve, IdxMacchina, Action, IdxPodl, IdxOdl, CodComm, PzCount)
SELECT DtEve, IdxMacchina, OrdAction, IdxPodl, IdxOdl, CodComm, PzCount
FROM cteActDec
WHERE OrdAction <> 'NONE'
-- ora processo ANCHE come fluxLog i record dei degli ordini (cod ordine, tempi...)
;WITH cteCurrOrd AS
(
SELECT ID
,ProdOrder
,Targa as IdxMacchina
,[DateTime] AS DtEvento
,ProdOrderState
,ProdQty
,ElapsedTime
FROM syn_M2ERP_PRODORDERS
WHERE ID > @LastIdx AND ID <= @NewIdx
)
, ctePrevOrd AS
(
SELECT ID
,ProdOrder
,Targa as IdxMacchina
,[DateTime] AS DtEvento
,ProdOrderState
,ProdQty
,ElapsedTime
FROM syn_M2ERP_PRODORDERS
WHERE ID >= @LastIdx AND ID < @NewIdx
)
, cteActDec AS
(
SELECT curr.DtEvento as DtEve
,curr.IdxMacchina
,CASE
WHEN curr.ProdOrderState = 1 THEN 'StartOrd'
--WHEN curr.ProdOrderState = 2 THEN 'PauseOrd'
WHEN curr.ProdOrderState = 3 THEN 'EndOrd'
--WHEN curr.ProdOrderState = 6 THEN 'InsOrd'
ELSE 'NONE'
END AS OrdAction
,CAST(CASE
WHEN LEFT(curr.ProdOrder, 4) = 'PODL' THEN REPLACE(curr.ProdOrder,'PODL','')
ELSE '0' END AS NVARCHAR(50)) AS IdxPodl
,CAST(CASE
WHEN LEFT(curr.ProdOrder, 3) = 'ODL' THEN REPLACE(curr.ProdOrder,'ODL','')
ELSE '0' END AS NVARCHAR(50)) AS IdxOdl
,CAST(curr.ProdOrder AS NVARCHAR(50)) as CodComm
,curr.ProdQty as PzCount
,CAST(curr.ElapsedTime AS NVARCHAR(50)) AS ElapsedTime
FROM cteCurrOrd curr
INNER JOIN ctePrevOrd prev
ON curr.ID = prev.ID+1
WHERE (curr.ProdOrder <> prev.ProdOrder)
OR (curr.ProdOrderState <> prev.ProdOrderState)
OR (curr.ProdQty <> prev.ProdQty)
)
-- lego i valori col precedente x calcolare se siano variati x insert valori
--INSERT INTO MachineFluxLog(DtEvento, IdxMacchina, CodFlux, Valore, Cnt)
SELECT DtEve as DtEvento, IdxMacchina, CodFlux, Valore,0 as Cnt
FROM cteActDec
UNPIVOT (Valore FOR CodFlux IN (CodComm, ElapsedTime, IdxOdl, IdxPOdl)) AS Unpvt
WHERE OrdAction <> 'NONE'
AND Valore <> '0'
-- aggiorno valore indice processato
MERGE SyncState AS tgt
USING (SELECT @NewIdx as LastIdx, 'ToMachineProdData' AS TableName) as src (LastIdx, TableName)
ON (tgt.TableName = src.TableName)
WHEN MATCHED THEN
UPDATE SET LastIdx = src.LastIdx
,Note = 'UPDATED from ' + CAST(@LastIdx AS NVARCHAR(50))
,LastUpdate = GETDATE()
WHEN NOT MATCHED THEN
INSERT (LastIdx, TableName, Note, LastUpdate)
VALUES (src.LastIdx, src.TableName, 'CREATED', GETDATE());
END
COMMIT tran
END
Binary file not shown.
@@ -0,0 +1,36 @@
/****** MoonPro_IOB-ISF_PAMA Script Date: 13/03/2023 19:03:53 ******/
-- creazione sinonimi
CREATE SYNONYM [dbo].[syn_ERP2M] FOR [P_HUB_PLD392].[dbo].[ERP2M]
CREATE SYNONYM [dbo].[syn_M2ERP_MACHINE_STATE] FOR [P_HUB_PLD392].[dbo].[M2ERP_MACHINE_STATE]
CREATE SYNONYM [dbo].[syn_M2ERP_PRODORDERS] FOR [P_HUB_PLD392].[dbo].[M2ERP_PRODORDERS]
GO
-- fix funzione
/***************************************
* FUNCTION f_padLeft
*
* fornisce una stringa della lunghezza desiderata aggiungendo a sx il carattere richiesto alla @string originale
*
* Steamware, S.E.L.
* mod: 2010.03.19
*
****************************************/
create FUNCTION [dbo].[f_padLeft] (@string VARCHAR(255), @desired_length INTEGER, @pad_character CHAR(1))
RETURNS VARCHAR(255) AS
BEGIN
-- Prefix the required number of spaces to bulk up the string and then replace the spaces with the desired character
RETURN CASE
WHEN LEN(@string) < @desired_length
THEN REPLACE(SPACE(@desired_length - LEN(@string)), ' ', @pad_character) + @string
ELSE @string
END
END
GO
-- fix stored specifiche
@@ -0,0 +1,98 @@
select * from ActType
select * from ActList
select * from SyncState
select * from MesPODL_last
select * from MesPODL_req
select * from MachineFluxLog
select * from MachineProdData
select * from MachineSignalLog
-- test scrittura PODL: OK!
exec dbo.SyncPodlToMachine
exec dbo.GetMachineSigLog
select * from SyncState
select * from MachineSignalLog
/*
truncate table MachineFluxLog
update SyncState
set lastidx=0
where TableName='ToMachineFluxLog'
*/
select top 2 * from MachineFluxLog order by 1 desc
select top 2 * from MachineProdData order by 1 desc
select top 10 * from MachineSignalLog order by 1 desc
select * from SyncState
exec dbo.GetMachineFluxLog
select * from MachineFluxLog
select * from syn_ERP2M
select * from syn_M2ERP_MACHINE_STATE
select * from syn_M2ERP_PRODORDERS
select top 10 * from syn_M2ERP_PRODORDERS
where ProdOrder LIKE 'PODL000%'
select top 10 * from syn_M2ERP_PRODORDERS
where ProdOrder LIKE '%ODL%'
order by 1 desc
EXEC GetMachineProdData
SELECT * FROM SyncState
SELECT * FROM MachineFluxLog
SELECT * FROM MachineProdData
SELECT * FROM MachineSignalLog
/*
truncate table MachineProdData
update SyncState
set lastidx=0
where TableName='ToMachineProdData'
*/
select * from ActType
/*
drop table __MigrationHistory
drop table ActList
drop table ActType
drop table MachineEventList
drop table MachineFluxLog
drop table MachinePODL
drop table MesPODL_last
drop table MesPODL_req
drop table SyncState
drop PROCEDURE dbo.BackupDb
drop PROCEDURE dbo.ExportAll
drop PROCEDURE dbo.GetMachineEvList
drop PROCEDURE dbo.GetMachineFluxLog
drop PROCEDURE dbo.ImportAll
drop PROCEDURE dbo.ResetPodlMes
drop PROCEDURE dbo.SyncPodlToMachine
*/
select * from ERP2M
select * from M2ERP_MACHINE_STATE where ActiveProdOrder = 'ODL0003743'
select * from M2ERP_PRODORDERS
select * from M2ERP_PRODORDERS where ProdOrder = 'ODL0003743'
@@ -0,0 +1,49 @@
-- =============================================
-- Author: S.E.L.
-- Create date: 2023.03.17
-- Description: Verifica ordini aperti - EXT schema/special
-- =============================================
CREATE PROCEDURE ext.stp_OrdState
(
@onlyOpen INT = 0 -- 1 = solo ordini rimasti aperti/validi
)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
IF (@onlyOpen = 0)
BEGIN
;WITH cteOrd AS
(
SELECT ProdOrder, MAX(id) as lastID
FROM syn_M2ERP_PRODORDERS
GROUP BY ProdOrder
)
SELECT m2erp.*
FROM syn_M2ERP_PRODORDERS m2erp
INNER JOIN cteord cte ON m2erp.ID=cte.lastID
ORDER BY 1 DESC
END
ELSE
BEGIN
;WITH cteOrd AS
(
SELECT ProdOrder, MAX(id) as lastID
FROM syn_M2ERP_PRODORDERS
GROUP BY ProdOrder
)
SELECT m2erp.*
FROM syn_M2ERP_PRODORDERS m2erp
INNER JOIN cteord cte ON m2erp.ID=cte.lastID
WHERE m2erp.ProdOrderState NOT IN (3,4)
ORDER BY 1 DESC
END
END
GO
+42
View File
@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EgwProxy.SqlDb.Test
{
public class TestSetup
{
public string app { get; set; } = "testApp";
public string server { get; set; } = "";
public string user { get; set; } = "";
public string password { get; set; } = "";
public string dbName { get; set; } = "MoonPro_IOB_ISF_PAMA";
public List<singleStep> steps { get; set; }
}
public class singleStep
{
public string id { get; set; } = "00";
public string description { get; set; } = "00";
public stepType action { get; set; } = stepType.None;
public List<string> paramList { get; set; } = new List<string>();
}
public enum stepType
{
None,
DbMigrateAndSync,
ExecExportAll,
ExecImportAll,
GetMachSignLog,
GetMachProdData,
GetMachFluxLog,
GetSyncState,
ResetPodl,
SetNewPodl,
//procPodl
}
}
+1
View File
@@ -0,0 +1 @@

+71
View File
@@ -0,0 +1,71 @@
{
"server": "308SERVER60\\LANTEK",
"user": "steamware",
"password": "viadante16",
"steps": [
{
"id": "00",
"description": "Db Migrate + SYNC",
"action": "DbMigrateAndSync",
"paramList": []
},
{
"id": "01",
"description": "Test SYNC",
"action": "GetSyncState",
"paramList": []
},
{
"id": "02",
"description": "Reset PODL MES",
"action": "ResetPodl",
"paramList": []
},
//{
// "id": "03",
// "description": "upload Test PODL",
// "action": "SetNewPodl",
// "paramList": [
// "1001",
// "1002",
// "1003"
// ]
//}
{
"id": "03",
"description": "Export All",
"action": "ExecExportAll",
"paramList": []
},
{
"id": "04",
"description": "Import All",
"action": "ExecImportAll",
"paramList": []
},
{
"id": "05",
"description": "Get SignLog",
"action": "GetMachSignLog",
"paramList": []
},
{
"id": "06",
"description": "Get ProdData",
"action": "GetMachProdData",
"paramList": []
},
{
"id": "07",
"description": "Get FluxLog",
"action": "GetMachFluxLog",
"paramList": []
},
{
"id": "08",
"description": "Test SYNC",
"action": "GetSyncState",
"paramList": []
}
]
}
+9
View File
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EntityFramework" version="6.4.4" targetFramework="net462" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net462" />
<package id="System.Configuration.ConfigurationManager" version="7.0.0" targetFramework="net462" />
<package id="System.Security.AccessControl" version="6.0.0" targetFramework="net462" />
<package id="System.Security.Permissions" version="7.0.0" targetFramework="net462" />
<package id="System.Security.Principal.Windows" version="5.0.0" targetFramework="net462" />
</packages>
+74
View File
@@ -0,0 +1,74 @@
@echo off
echo Effettua pulizia post build: configurazione %1. directory %2
RD /S /Q %2"\lib\da"
RD /S /Q %2"\lib\de"
RD /S /Q %2"\lib\es"
RD /S /Q %2"\lib\fr"
RD /S /Q %2"\lib\it"
RD /S /Q %2"\lib\ja-JP"
RD /S /Q %2"\lib\ko"
RD /S /Q %2"\lib\nl"
RD /S /Q %2"\lib\pl"
RD /S /Q %2"\lib\pt"
RD /S /Q %2"\lib\ru"
RD /S /Q %2"\lib\sv"
RD /S /Q %2"\lib\tr"
RD /S /Q %2"\lib\zh"
MOVE /Y %2"da" %2"lib\"
MOVE /Y %2"de" %2"lib\"
MOVE /Y %2"es" %2"lib\"
MOVE /Y %2"fr" %2"lib\"
MOVE /Y %2"it" %2"lib\"
MOVE /Y %2"ja-JP" %2"lib\"
MOVE /Y %2"ko" %2"lib\"
MOVE /Y %2"nl" %2"lib\"
MOVE /Y %2"pl" %2"lib\"
MOVE /Y %2"pt" %2"lib\"
MOVE /Y %2"ru" %2"lib\"
MOVE /Y %2"sv" %2"lib\"
MOVE /Y %2"tr" %2"lib\"
MOVE /Y %2"zh" %2"lib\"
if %1 == "Release" goto Release
if %1 == "Debug" goto Debug
if %1 == "Remote_DEBUG" goto RemoteDebug
:Release
REM INIZIO eliminando i files pdb
del /S %2"*.pdb""
del /S %2"lib/*.pdb""
echo Release: eliminato pdb!!!
goto END
:Debug
echo Debug: nulla da eliminare
REM copia script verso server remoto
REM ROBOCOPY . \\10.150.0.1\Steamware\SqlDbTest-DEB /MIR
goto END
:RemoteDebug
REM copia script verso server remoto
REM echo Debug remoto: effettuo robocopy sync (verificare remote per cliente)
REM FINASSI
REM ROBOCOPY . \\10.150.0.1\Steamware\SqlDbTest-DEB /MIR
REM Baglietto
REM ROBOCOPY . \\192.168.60.15\Steamware\SqlDbTest-DEB /MIR
REM GIACOVELLI LOCOROTONDO
REM ROBOCOPY . \\192.168.1.93\Steamware\SqlDbTest-DEB /MIR
REM IMI Remosa
ROBOCOPY . \\192.168.0.12\Steamware\SqlDbTest-DEB /MIR
REM IOB-WIN-SIM
REM ROBOCOPY . \\IOB-WIN-SIMULA\Steamware\SqlDbTest-DEB /MIR
goto END
:END
echo Fatto!
+25
View File
@@ -0,0 +1,25 @@
@echo off
echo Effettua setup dei file specifici per i vari ambienti pre build installer: verifica da nome configurazione %1
if %1 == "Release" goto Release
if %1 == "Debug" goto Debug
if %1 == "Remote_DEBUG" goto RemoteDebug
:Release
echo Release: nulla da copiare
goto END
:Debug
echo Debug: copia file ini x simulazione Debug
REM del %2"DATA\CONF\EsaKvara.ini"
REM copy %2"Resources\SCM\EsaKvara_SIM.ini" %2"DATA\CONF\EsaKvara.ini"
goto END
:RemoteDebug
echo RemoteDebug: nulla da copiare
goto END
:END
echo Fatto!
+36
View File
@@ -0,0 +1,36 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.33424.131
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EgwProxy.SqlDb", "EgwProxy.SqlDb\EgwProxy.SqlDb.csproj", "{A5F9E2C8-B866-4470-923C-11BA35270963}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EgwProxy.SqlDb.Test", "EgwProxy.SqlDb.Test\EgwProxy.SqlDb.Test.csproj", "{A11CA446-AE97-413D-A567-45A081F003DB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
Remote_DEBUG|Any CPU = Remote_DEBUG|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A5F9E2C8-B866-4470-923C-11BA35270963}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A5F9E2C8-B866-4470-923C-11BA35270963}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A5F9E2C8-B866-4470-923C-11BA35270963}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A5F9E2C8-B866-4470-923C-11BA35270963}.Release|Any CPU.Build.0 = Release|Any CPU
{A5F9E2C8-B866-4470-923C-11BA35270963}.Remote_DEBUG|Any CPU.ActiveCfg = Debug|Any CPU
{A5F9E2C8-B866-4470-923C-11BA35270963}.Remote_DEBUG|Any CPU.Build.0 = Debug|Any CPU
{A11CA446-AE97-413D-A567-45A081F003DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A11CA446-AE97-413D-A567-45A081F003DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A11CA446-AE97-413D-A567-45A081F003DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A11CA446-AE97-413D-A567-45A081F003DB}.Release|Any CPU.Build.0 = Release|Any CPU
{A11CA446-AE97-413D-A567-45A081F003DB}.Remote_DEBUG|Any CPU.ActiveCfg = Remote_DEBUG|Any CPU
{A11CA446-AE97-413D-A567-45A081F003DB}.Remote_DEBUG|Any CPU.Build.0 = Remote_DEBUG|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E2472E21-58D3-4EAD-BC4A-BC3915B18BEF}
EndGlobalSection
EndGlobal
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<connectionStrings>
<add name="SyncState" connectionString="data source=SQL2016DEV;initial catalog=MoonPro_IOB_ISF;persist security info=True;user id=sa;password=keyhammer16;MultipleActiveResultSets=True;App=EgwProxy.SqlDb" providerName="System.Data.SqlClient" />
</connectionStrings>
<entityFramework>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>
+316
View File
@@ -0,0 +1,316 @@
using EgwProxy.SqlDb.DbModels;
using NLog;
using System;
using System.Collections.Generic;
using System.Linq;
namespace EgwProxy.SqlDb.Controllers
{
/// <summary>
/// Controller accesso dati DB IOB_ISF
/// </summary>
public class DbController : IDisposable
{
#region Public Constructors
/// <summary>
/// Avvio dell'oggetto gestione DB con stringa di connessione specifica
/// </summary>
/// <param name="connSyncState">Connessione DB locale di SYNC</param>
public DbController(string connSyncState)
{
connString = connSyncState;
Log.Info("Avviata classe DbController");
}
#endregion Public Constructors
#region Public Methods
/// <summary>
/// Recupera la tab di ActList corrente
/// </summary>
/// <returns></returns>
public List<ActListModel> ActListGetAll()
{
List<ActListModel> dbResult = new List<ActListModel>();
using (var dbSyncStateCtx = new SyncStateDbContext(connString))
{
dbResult = dbSyncStateCtx
.DbSetActions
.ToList();
}
return dbResult;
}
/// <summary>
/// Recupera la tab di ActType corrente
/// </summary>
/// <returns></returns>
public List<ActTypeModel> ActTypeGetAll()
{
List<ActTypeModel> dbResult = new List<ActTypeModel>();
using (var dbSyncStateCtx = new SyncStateDbContext(connString))
{
dbResult = dbSyncStateCtx
.DbSetActListType
.ToList();
}
return dbResult;
}
public bool DbForceMigrate()
{
bool fatto = false;
using (var dbSyncStateCtx = new SyncStateDbContext(connString))
{
dbSyncStateCtx.DbForceMigrate();
fatto = true;
}
return fatto;
}
/// <summary>
/// Dispose classe
/// </summary>
public void Dispose()
{
// Clear database context
connString = "";
}
/// <summary>
/// Recupera la tab FluxLog x i record successivi all'ID già processato
/// </summary>
/// <param name="lastIdx"></param>
/// <returns></returns>
public List<MachFluxLogModel> MachFluxLogGetNew(long lastIdx)
{
List<MachFluxLogModel> dbResult = new List<MachFluxLogModel>();
using (var dbSyncStateCtx = new SyncStateDbContext(connString))
{
dbResult = dbSyncStateCtx
.DbSetMachFluxLog
.Where(x => x.Id > lastIdx)
.OrderBy(x => x.Id)
.ToList();
}
return dbResult;
}
/// <summary>
/// Recupera la tab PODL Macchina x i record successivi all'ID già processato
/// </summary>
/// <param name="lastIdx"></param>
/// <returns></returns>
public List<MachPODLModel> MachPOdlGetNew(long lastIdx)
{
List<MachPODLModel> dbResult = new List<MachPODLModel>();
using (var dbSyncStateCtx = new SyncStateDbContext(connString))
{
dbResult = dbSyncStateCtx
.DbSetMachPODL
.Where(x => x.IdxPromessa > lastIdx)
.OrderBy(x => x.IdxPromessa)
.ToList();
}
return dbResult;
}
/// <summary>
/// Recupera la tab ProdData x i record successivi all'ID già processato
/// </summary>
/// <param name="lastIdx"></param>
/// <returns></returns>
public List<MachProdDataModel> MachProdDataGetNew(long lastIdx)
{
List<MachProdDataModel> dbResult = new List<MachProdDataModel>();
using (var dbSyncStateCtx = new SyncStateDbContext(connString))
{
dbResult = dbSyncStateCtx
.DbSetMachProdData
.Where(x => x.Id > lastIdx)
.OrderBy(x => x.Id)
.ToList();
}
return dbResult;
}
/// <summary>
/// Recupera la tab EvList x i record successivi all'ID già processato
/// </summary>
/// <param name="lastIdx"></param>
/// <returns></returns>
public List<MachSigLogModel> MachSigLogGetNew(long lastIdx)
{
List<MachSigLogModel> dbResult = new List<MachSigLogModel>();
using (var dbSyncStateCtx = new SyncStateDbContext(connString))
{
dbResult = dbSyncStateCtx
.DbSetMachEvList
.Where(x => x.Id > lastIdx)
.OrderBy(x => x.Id)
.ToList();
}
return dbResult;
}
/// <summary>
/// Scrive elenco PODL attivi al momento x processing successivo
/// </summary>
/// <param name="CurrPodlReq"></param>
/// <returns></returns>
public bool MesPodlWriteReq(List<MesPODLReqModel> CurrPodlReq)
{
bool fatto = false;
using (var dbSyncStateCtx = new SyncStateDbContext(connString))
{
try
{
// in primis verifica SE sia vuota la tab req...
var oldData = dbSyncStateCtx
.DbSetMesPodlReq
.ToList();
// se vuota scrive i record e salva
if (oldData.Count == 0)
{
// aggiungo i nuovi record
var dbResult = dbSyncStateCtx
.DbSetMesPodlReq
.AddRange(CurrPodlReq);
// salvo
dbSyncStateCtx.SaveChanges();
fatto = true;
}
}
catch //(Exception exc)
{ }
}
return fatto;
}
/// <summary>
/// Esegue reset tabelle PODL MEs e restituisce elenco finale (vuoto)
/// </summary>
/// <returns></returns>
public List<MesPODLReqModel> ResetPODLMes()
{
List<MesPODLReqModel> dbResult = new List<MesPODLReqModel>();
using (var dbSyncStateCtx = new SyncStateDbContext(connString))
{
dbResult = dbSyncStateCtx
.Database
.SqlQuery<MesPODLReqModel>("EXEC dbo.stp_ResetPodlMes")
.ToList();
}
return dbResult;
}
public string ServerOk()
{
return SyncStateGetAll().Count() > 0 ? "OK" : "NA";
}
/// <summary>
/// Esegue una volta la stored di ImportAll (x recupero dati da DB esterni) e poi
/// restitusice in output la tab di SyncState x verificare lo stato
/// </summary>
/// <returns></returns>
public List<SyncStateModel> SyncStateDoExportAll()
{
List<SyncStateModel> dbResult = new List<SyncStateModel>();
using (var dbSyncStateCtx = new SyncStateDbContext(connString))
{
dbResult = dbSyncStateCtx
.Database
.SqlQuery<SyncStateModel>("EXEC dbo.stp_ExportAll")
.ToList();
}
return dbResult;
}
/// <summary>
/// Esegue una volta la stored di ImportAll (x recupero dati da DB esterni) e poi
/// restitusice in output la tab di SyncState x verificare lo stato
/// </summary>
/// <returns></returns>
public List<SyncStateModel> SyncStateDoImportAll()
{
List<SyncStateModel> dbResult = new List<SyncStateModel>();
using (var dbSyncStateCtx = new SyncStateDbContext(connString))
{
dbResult = dbSyncStateCtx
.Database
.SqlQuery<SyncStateModel>("EXEC dbo.stp_ImportAll")
.ToList();
}
return dbResult;
}
/// <summary>
/// recupera la tab di SyncState corrente
/// </summary>
/// <returns></returns>
public List<SyncStateModel> SyncStateGetAll()
{
List<SyncStateModel> dbResult = new List<SyncStateModel>();
using (var dbSyncStateCtx = new SyncStateDbContext(connString))
{
dbResult = dbSyncStateCtx
.DbSetSyncState
.ToList();
}
return dbResult;
}
/// <summary>
/// Aggiorna record SyncState corrente
/// </summary>
/// <returns></returns>
public bool SyncStateUpsert(SyncStateModel newVal)
{
bool fatto = false;
using (var dbSyncStateCtx = new SyncStateDbContext(connString))
{
// cerco record
var dbResult = dbSyncStateCtx
.DbSetSyncState
.Where(x => x.TableName == newVal.TableName)
.FirstOrDefault();
// se trovato aggiorno
if (dbResult != null)
{
dbResult.LastIdx = newVal.LastIdx;
dbResult.Note = newVal.Note;
dbResult.LastUpdate = newVal.LastUpdate;
//dbSyncStateCtx.Entry(dbResult).State = System.Data.Entity.EntityState.Modified;
}
// altrimenti aggiungo
else
{
dbSyncStateCtx.DbSetSyncState.Add(newVal);
}
// salvo
dbSyncStateCtx.SaveChanges();
fatto = true;
}
return fatto;
}
#endregion Public Methods
#region Protected Fields
protected static string connString = "";
#endregion Protected Fields
#region Private Fields
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
}
}
+35
View File
@@ -0,0 +1,35 @@
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 EgwProxy.SqlDb.DbModels
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
[Table("ActList")]
public partial class ActListModel
{
[Key, Column("IdxAct"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; } = 0;
public DateTime DtRif { get; set; } = DateTime.Today;
[StringLength(50)]
public string Source { get; set; } = "IN";
[StringLength(50)]
public string Dest { get; set; } = "OUT";
[StringLength(250)]
public string Action { get; set; } = "";
[StringLength(2500)]
public string Value { get; set; } = "";
}
}
+24
View File
@@ -0,0 +1,24 @@
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 EgwProxy.SqlDb.DbModels
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
[Table("ActType")]
public partial class ActTypeModel
{
[Key, StringLength(250)]
public string Action { get; set; } = "";
[StringLength(500)]
public string Description { get; set; } = "";
}
}
@@ -0,0 +1,34 @@
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 EgwProxy.SqlDb.DbModels
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
[Table("MachineFluxLog")]
public partial class MachFluxLogModel
{
[Key, Column("IdxFL"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; } = 0;
public DateTime DtEvento { get; set; } = DateTime.Now;
[StringLength(50)]
public string IdxMacchina { get; set; } = "";
[StringLength(50)]
public string CodFlux { get; set; } = "";
[StringLength(250)]
public string Valore { get; set; } = "";
public int Cnt { get; set; } = 0;
}
}
+57
View File
@@ -0,0 +1,57 @@
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 EgwProxy.SqlDb.DbModels
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
[Table("MachinePODL")]
public partial class MachPODLModel
{
[Key]
public int IdxRec { get; set; } = 0;
public int IdxPromessa { get; set; } = 0;
[StringLength(50)]
public string KeyRichiesta { get; set; } = "";
[StringLength(50)]
public string KeyBCode { get; set; } = "";
public bool Attivabile { get; set; } = false;
public int IdxODL { get; set; } = 0;
[StringLength(50)]
public string CodArticolo { get; set; } = "";
[StringLength(50)]
public string CodGruppo { get; set; } = "";
[StringLength(50)]
public string IdxMacchina { get; set; } = "";
public int NumPezzi { get; set; } = 0;
public decimal TCAssegnato { get; set; } = 0;
public DateTime DueDate { get; set; } = DateTime.Today;
public int Priorita { get; set; } = 0;
public int PzPallet { get; set; } = 0;
[StringLength(2500)]
public string Note { get; set; } = "";
[StringLength(50)]
public string CodCli { get; set; } = "";
public DateTime InsertDate { get; set; } = DateTime.Today;
}
}
@@ -0,0 +1,36 @@
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 EgwProxy.SqlDb.DbModels
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
[Table("MachineProdData")]
public partial class MachProdDataModel
{
[Key, Column("IdxPD"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; } = 0;
public DateTime DtEve { get; set; } = DateTime.Now;
[StringLength(50)]
public string IdxMacchina { get; set; } = "";
public string Action { get; set; } = "";
public string CodComm { get; set; } = "";
public int PzCount { get; set; } = 0;
public int IdxPodl { get; set; } = 0;
public int IdxOdl { get; set; } = 0;
}
}
@@ -0,0 +1,30 @@
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 EgwProxy.SqlDb.DbModels
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
[Table("MachineSignalLog")]
public partial class MachSigLogModel
{
[Key, Column("IdxEv"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; } = 0;
public DateTime DtEve { get; set; } = DateTime.Now;
[StringLength(50)]
public string IdxMacchina { get; set; } = "";
public int ValInt { get; set; } = 0;
public string Valore { get; set; } = "";
}
}
@@ -0,0 +1,57 @@
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 EgwProxy.SqlDb.DbModels
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
[Table("MesPODL_last")]
public partial class MesPODLLastModel
{
[Key]
public int IdxRec { get; set; } = 0;
public int IdxPromessa { get; set; } = 0;
[StringLength(50)]
public string KeyRichiesta { get; set; } = "";
[StringLength(50)]
public string KeyBCode { get; set; } = "";
public bool Attivabile { get; set; } = false;
public int IdxODL { get; set; } = 0;
[StringLength(50)]
public string CodArticolo { get; set; } = "";
[StringLength(50)]
public string CodGruppo { get; set; } = "";
[StringLength(50)]
public string IdxMacchina { get; set; } = "";
public int NumPezzi { get; set; } = 0;
public decimal TCAssegnato { get; set; } = 0;
public DateTime DueDate { get; set; } = DateTime.Today;
public int Priorita { get; set; } = 0;
public int PzPallet { get; set; } = 0;
[StringLength(2500)]
public string Note { get; set; } = "";
[StringLength(50)]
public string CodCli { get; set; } = "";
public DateTime InsertDate { get; set; } = DateTime.Today;
}
}
@@ -0,0 +1,57 @@
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 EgwProxy.SqlDb.DbModels
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
[Table("MesPODL_req")]
public partial class MesPODLReqModel
{
[Key]
public int IdxRec { get; set; } = 0;
public int IdxPromessa { get; set; } = 0;
[StringLength(50)]
public string KeyRichiesta { get; set; } = "";
[StringLength(50)]
public string KeyBCode { get; set; } = "";
public bool Attivabile { get; set; } = false;
public int IdxODL { get; set; } = 0;
[StringLength(50)]
public string CodArticolo { get; set; } = "";
[StringLength(50)]
public string CodGruppo { get; set; } = "";
[StringLength(50)]
public string IdxMacchina { get; set; } = "";
public int NumPezzi { get; set; } = 0;
public decimal TCAssegnato { get; set; } = 0;
public DateTime DueDate { get; set; } = DateTime.Today;
public int Priorita { get; set; } = 0;
public int PzPallet { get; set; } = 0;
[StringLength(2500)]
public string Note { get; set; } = "";
[StringLength(50)]
public string CodCli { get; set; } = "";
public DateTime InsertDate { get; set; } = DateTime.Today;
}
}
+26
View File
@@ -0,0 +1,26 @@
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;
namespace EgwProxy.SqlDb.DbModels
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
[Table("SyncState")]
public partial class SyncStateModel
{
[Key, StringLength(250)]
public string TableName { get; set; } = "";
public long LastIdx { get; set; } = 0;
public string Note { get; set; } = "";
public DateTime LastUpdate { get; set; } = DateTime.Today;
}
}
+162
View File
@@ -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="..\packages\EntityFramework.6.4.4\build\EntityFramework.props" Condition="Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.props')" />
<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>{A5F9E2C8-B866-4470-923C-11BA35270963}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>EgwProxy.SqlDb</RootNamespace>
<AssemblyName>EgwProxy.SqlDb</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</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>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Remote_DEBUG|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Remote_DEBUG\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
</Reference>
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll</HintPath>
</Reference>
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.5.1.2\lib\net46\NLog.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression" />
<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="Controllers\DbController.cs" />
<Compile Include="DbModels\MachProdDataModel.cs" />
<Compile Include="DbModels\MachSigLogModel.cs" />
<Compile Include="DbModels\MachFluxLogModel.cs" />
<Compile Include="DbModels\ActTypeModel.cs" />
<Compile Include="DbModels\MesPODLReqModel.cs" />
<Compile Include="DbModels\MesPODLLastModel.cs" />
<Compile Include="DbModels\MachPODLModel.cs" />
<Compile Include="DbModels\ActListModel.cs" />
<Compile Include="DbModels\SyncStateModel.cs" />
<Compile Include="Migrations\202303131052295_InitialDb.cs" />
<Compile Include="Migrations\202303131052295_InitialDb.designer.cs">
<DependentUpon>202303131052295_InitialDb.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\202303131054149_AddStoredProc.cs" />
<Compile Include="Migrations\202303131054149_AddStoredProc.designer.cs">
<DependentUpon>202303131054149_AddStoredProc.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\202303141853160_FixSigLogTable.cs" />
<Compile Include="Migrations\202303141853160_FixSigLogTable.designer.cs">
<DependentUpon>202303141853160_FixSigLogTable.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\202303150807341_AddMacProdData.cs" />
<Compile Include="Migrations\202303150807341_AddMacProdData.designer.cs">
<DependentUpon>202303150807341_AddMacProdData.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\ConfigurationInit.cs" />
<Compile Include="MyDbInitializer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SyncStateDbContext.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="docfx.json" />
<None Include="index.md" />
<None Include="packages.config" />
<None Include="toc.yml" />
</ItemGroup>
<ItemGroup>
<Content Include="SqlScript\AddFunc.sql">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="StoredProc\stp_GetMachineProdData.sql">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="StoredProc\stp_GetMachineEvList.sql">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="StoredProc\stp_ResetPodlMes.sql">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="StoredProc\stp_ExportAll.sql">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="StoredProc\stp_ImportAll.sql">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="StoredProc\stp_BackupDb.sql">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="StoredProc\stp_GetMachineFluxLog.sql">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="StoredProc\stp_GetMachineSigLog.sql">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="StoredProc\stp_SyncPodlToMachine.sql">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Migrations\202303131052295_InitialDb.resx">
<DependentUpon>202303131052295_InitialDb.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\202303131054149_AddStoredProc.resx">
<DependentUpon>202303131054149_AddStoredProc.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\202303141853160_FixSigLogTable.resx">
<DependentUpon>202303141853160_FixSigLogTable.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\202303150807341_AddMacProdData.resx">
<DependentUpon>202303150807341_AddMacProdData.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\EntityFramework.6.4.4\build\EntityFramework.props'))" />
<Error Condition="!Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\EntityFramework.6.4.4\build\EntityFramework.targets'))" />
</Target>
<Import Project="..\packages\EntityFramework.6.4.4\build\EntityFramework.targets" Condition="Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.targets')" />
</Project>
@@ -0,0 +1,29 @@
// <auto-generated />
namespace EgwProxy.SqlDb.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
public sealed partial class InitialDb : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(InitialDb));
string IMigrationMetadata.Id
{
get { return "202303131052295_InitialDb"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}
@@ -0,0 +1,157 @@
namespace EgwProxy.SqlDb.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class InitialDb : DbMigration
{
public override void Up()
{
CreateTable(
"dbo.ActList",
c => new
{
IdxAct = c.Int(nullable: false, identity: true),
DtRif = c.DateTime(nullable: false),
Source = c.String(maxLength: 50),
Dest = c.String(maxLength: 50),
Action = c.String(maxLength: 250),
Value = c.String(maxLength: 500),
})
.PrimaryKey(t => t.IdxAct);
CreateTable(
"dbo.ActType",
c => new
{
Action = c.String(nullable: false, maxLength: 250),
Description = c.String(maxLength: 500),
})
.PrimaryKey(t => t.Action);
CreateTable(
"dbo.MachineEventList",
c => new
{
IdxEv = c.Int(nullable: false, identity: true),
InizioStato = c.DateTime(nullable: false),
IdxMacchina = c.String(maxLength: 50),
IdxTipo = c.Int(nullable: false),
CodArticolo = c.String(maxLength: 50),
Value = c.String(maxLength: 250),
MatrOpr = c.Int(nullable: false),
Pallet = c.String(maxLength: 20),
})
.PrimaryKey(t => t.IdxEv);
CreateTable(
"dbo.MachineFluxLog",
c => new
{
IdxFL = c.Int(nullable: false, identity: true),
DtEvento = c.DateTime(nullable: false),
IdxMacchina = c.String(maxLength: 50),
CodFlux = c.String(maxLength: 50),
Valore = c.String(maxLength: 250),
Cnt = c.Int(nullable: false),
})
.PrimaryKey(t => t.IdxFL);
CreateTable(
"dbo.MachinePODL",
c => new
{
IdxRec = c.Int(nullable: false, identity: true),
IdxPromessa = c.Int(nullable: false),
KeyRichiesta = c.String(maxLength: 50),
KeyBCode = c.String(maxLength: 50),
Attivabile = c.Boolean(nullable: false),
IdxODL = c.Int(nullable: false),
CodArticolo = c.String(maxLength: 50),
CodGruppo = c.String(maxLength: 50),
IdxMacchina = c.String(maxLength: 50),
NumPezzi = c.Int(nullable: false),
TCAssegnato = c.Decimal(nullable: false, precision: 18, scale: 2),
DueDate = c.DateTime(nullable: false),
Priorita = c.Int(nullable: false),
PzPallet = c.Int(nullable: false),
Note = c.String(maxLength: 2500),
CodCli = c.String(maxLength: 50),
InsertDate = c.DateTime(nullable: false),
})
.PrimaryKey(t => t.IdxRec);
CreateTable(
"dbo.MesPODL_last",
c => new
{
IdxRec = c.Int(nullable: false, identity: true),
IdxPromessa = c.Int(nullable: false),
KeyRichiesta = c.String(maxLength: 50),
KeyBCode = c.String(maxLength: 50),
Attivabile = c.Boolean(nullable: false),
IdxODL = c.Int(nullable: false),
CodArticolo = c.String(maxLength: 50),
CodGruppo = c.String(maxLength: 50),
IdxMacchina = c.String(maxLength: 50),
NumPezzi = c.Int(nullable: false),
TCAssegnato = c.Decimal(nullable: false, precision: 18, scale: 2),
DueDate = c.DateTime(nullable: false),
Priorita = c.Int(nullable: false),
PzPallet = c.Int(nullable: false),
Note = c.String(maxLength: 2500),
CodCli = c.String(maxLength: 50),
InsertDate = c.DateTime(nullable: false),
})
.PrimaryKey(t => t.IdxRec);
CreateTable(
"dbo.MesPODL_req",
c => new
{
IdxRec = c.Int(nullable: false, identity: true),
IdxPromessa = c.Int(nullable: false),
KeyRichiesta = c.String(maxLength: 50),
KeyBCode = c.String(maxLength: 50),
Attivabile = c.Boolean(nullable: false),
IdxODL = c.Int(nullable: false),
CodArticolo = c.String(maxLength: 50),
CodGruppo = c.String(maxLength: 50),
IdxMacchina = c.String(maxLength: 50),
NumPezzi = c.Int(nullable: false),
TCAssegnato = c.Decimal(nullable: false, precision: 18, scale: 2),
DueDate = c.DateTime(nullable: false),
Priorita = c.Int(nullable: false),
PzPallet = c.Int(nullable: false),
Note = c.String(maxLength: 2500),
CodCli = c.String(maxLength: 50),
InsertDate = c.DateTime(nullable: false),
})
.PrimaryKey(t => t.IdxRec);
CreateTable(
"dbo.SyncState",
c => new
{
TableName = c.String(nullable: false, maxLength: 250),
LastIdx = c.Long(nullable: false),
Note = c.String(),
LastUpdate = c.DateTime(nullable: false),
})
.PrimaryKey(t => t.TableName);
}
public override void Down()
{
DropTable("dbo.SyncState");
DropTable("dbo.MesPODL_req");
DropTable("dbo.MesPODL_last");
DropTable("dbo.MachinePODL");
DropTable("dbo.MachineFluxLog");
DropTable("dbo.MachineEventList");
DropTable("dbo.ActType");
DropTable("dbo.ActList");
}
}
}
@@ -0,0 +1,126 @@
<?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>
<data name="Target" xml:space="preserve">
<value>H4sIAAAAAAAEAO1d227kNhJ9X2D/QdDTBphYtmezyA66E3i67cBYXxpuO68LtkS3hUhUR6K8bf9aHvaT9he2qCtJUS1RF9sTCPPiLpGnqGJdKLJY878//jv7ee97xjMO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E7/G+uoFTJBkibsGTF4Nl10kyAiGL/iDVgKghWitkGbt7gGhH3EWJwmgZmnh6fnEqFmD5OUSQrihxPkTzBpdbVJw60TuxWpAy0SuxO+qVJKi6TcGPqtm7eKF+NiGk27V+NiDyj0H5CYSWLskTVLT40EKRYiEYJeqqPKlTCqBlpA2i3SkIdVHGYEj5tJNe1Qs/IAmw6kW9t0dWz+FYGzbqNaM+K4jedrVqRaD+QHUq1bhJJ9L/ZMNDgms25g4+Q6th0eWMxpV49sCGtpP4IvbWNVA/PW9nIxdXIMU8sEfMBDUSqCDOcZnMFYIZSba7eS7Nad6z20k39BrhNN46Trl6g6+IQVNfnBtIU+bbcUOuvyuW4jav/3uLFuI8VPCq34IaLmCO5GvmOWxd5Km64OSPfcOvstOUbbp1CsXS/rQsGf9OnzhV3UT/uMttQule5u9ZS+N1rmkz+XgEz+fvJ30/+fvL3fxp/rz6Pntz95O4ndz+5+8nd/1nc/aHT5bevCDHY4YVU8GHjbodSlL/5aP+d7jxWqzoMMo9yVYfqXXFxVPK9e7EiQ0PBhvSkGUa+YZ4mHXHWovL6Ckbl0VhTJYcaRslN3yZGqiIOrSo9qJiydiDdomkr7mKxhxb1IA5wLspKtODL1YRoqhlxgONKkb5WZVepGNGiqISSadrq3x5qI1y5qERz2YlDPENWuaKBpVx2orEuhYohV9dCZdktylZUs0NmFv+/cM2WOHK3JQT7P7kITk6FS9C8zSV5DHLvBG/KjyhvIp+PYYrAXSG2bntENoXHNiygk/o3yYHc3Dz3N9i5JLcx3cWULUj8jSfUqptZh/kntTnEMc9uk7PnaIhXgGG6zOPekq+x6znFuC8UHrcGgvnW7EMERrWm7INk+1Ig3QSkJVAmviXeYcI+Y+6xv/MALLola/SMu4ztIcJXeIvslzzJpx6keSJEsc+WLtqGyI8yjLI//AQddvz9T/8HEgs/ooxuAAA=</value>
</data>
<data name="DefaultSchema" xml:space="preserve">
<value>dbo</value>
</data>
</root>
@@ -0,0 +1,29 @@
// <auto-generated />
namespace EgwProxy.SqlDb.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
public sealed partial class AddStoredProc : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(AddStoredProc));
string IMigrationMetadata.Id
{
get { return "202303131054149_AddStoredProc"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}
@@ -0,0 +1,49 @@
namespace EgwProxy.SqlDb.Migrations
{
using System;
using System.Data.Entity.Migrations;
using System.IO;
public partial class AddStoredProc : DbMigration
{
public override void Up()
{
AlterColumn("dbo.ActList", "Value", c => c.String(maxLength: 2500));
// aggiunta stored
addStoredProc("stp_SyncPodlToMachine");
addStoredProc("stp_GetMachineEvList");
addStoredProc("stp_GetMachineFluxLog");
addStoredProc("stp_GetMachineProdData");
addStoredProc("stp_GetMachineSigLog");
addStoredProc("stp_BackupDb");
addStoredProc("stp_ExportAll");
addStoredProc("stp_ImportAll");
addStoredProc("stp_ResetPodlMes");
}
public override void Down()
{
AlterColumn("dbo.ActList", "Value", c => c.String(maxLength: 500));
// drop delle stored
DropStoredProcedure("dbo.stp_SyncPodlToMachine");
DropStoredProcedure("dbo.stp_GetMachineEvList");
DropStoredProcedure("dbo.stp_GetMachineFluxLog");
DropStoredProcedure("dbo.stp_GetMachineProdData");
DropStoredProcedure("dbo.stp_GetMachineSigLog");
DropStoredProcedure("dbo.stp_BackupDb");
DropStoredProcedure("dbo.stp_ExportAll");
DropStoredProcedure("dbo.stp_ImportAll");
DropStoredProcedure("dbo.stp_ResetPodlMes");
}
private void addStoredProc(string storedName)
{
string path = Path.Combine("StoredProc", $"{storedName}.sql");
string storedBody = File.ReadAllText(path);
CreateStoredProcedure($"dbo.{storedName}", storedBody);
}
}
}
@@ -0,0 +1,126 @@
<?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>
<data name="Target" xml:space="preserve">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ugJdxnbQ4Sv8AbZz3mWTz1I80SIYp/MXbQJkR9lGGV/+Ak67Pi7z38B+y8WII5uAAA=</value>
</data>
<data name="DefaultSchema" xml:space="preserve">
<value>dbo</value>
</data>
</root>
@@ -0,0 +1,29 @@
// <auto-generated />
namespace EgwProxy.SqlDb.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
public sealed partial class FixSigLogTable : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(FixSigLogTable));
string IMigrationMetadata.Id
{
get { return "202303141853160_FixSigLogTable"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}
@@ -0,0 +1,45 @@
namespace EgwProxy.SqlDb.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class FixSigLogTable : DbMigration
{
public override void Up()
{
CreateTable(
"dbo.MachineSignalLog",
c => new
{
IdxEv = c.Int(nullable: false, identity: true),
DtEve = c.DateTime(nullable: false),
IdxMacchina = c.String(maxLength: 50),
ValInt = c.Int(nullable: false),
Valore = c.String(),
})
.PrimaryKey(t => t.IdxEv);
DropTable("dbo.MachineEventList");
}
public override void Down()
{
CreateTable(
"dbo.MachineEventList",
c => new
{
IdxEv = c.Int(nullable: false, identity: true),
InizioStato = c.DateTime(nullable: false),
IdxMacchina = c.String(maxLength: 50),
IdxTipo = c.Int(nullable: false),
CodArticolo = c.String(maxLength: 50),
Value = c.String(maxLength: 250),
MatrOpr = c.Int(nullable: false),
Pallet = c.String(maxLength: 20),
})
.PrimaryKey(t => t.IdxEv);
DropTable("dbo.MachineSignalLog");
}
}
}
@@ -0,0 +1,126 @@
<?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>
<data name="Target" xml:space="preserve">
<value>H4sIAAAAAAAEAO1d3W7jNha+L7DvIOhqF5hGSaZbdAd2i4ydFEHzY8RJbxe0RDvCSpQ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Y6nlZhkXvBi+ukJ+MRxf4Jq8AoCFqK2QZuXuEWEXcNPjiNiTLPT8/OhaQ77ycBjhVFjicJJuDizPYfpHeOcpYcoXeKck7apUEbLhvh1jhm1SBKPvMMYzYdnnmGvKDQfkZhLaSwRFVNNDMSZDXniBT0XB21kkZmH2gLar+sMT24OE66li5D1zcby565HmsAG0+pO+tz/Xy6kzqzZgfVZi7XSW9tlkSbj6R/1dQmyRAMSmySd+ufPtr9a0R+7D897kyQ+rlxJ4Jc3RyeIFyqkHfIESEzyHjMk/BmqOWfqZC5Z9aPfvQb4VbVQQgouUjVxwzIrlGNxBTx1tRYS4/aJamVq/7e1QtSfUZOcj1qPMWt3oYaCfdwpka869RnPCU3nZwD33TqbbTFm0593le859QHg7/x0XO9LKUfd6lpLO7V7jB1HPz+uS20vZfAaHuv7b2299re/23svfwoVpt7be61udfmXpv7v4u5bzpYPX5mgNG27YWL/yt3MxZROmzlyrtTvd0/yjyKt/vr14arvRKvYFdv5rdc3E8PWaHnK2Zp0h5nNWqvLxHEXdlvudG/R1By6bNNUO0yf/t1f5k4VgnGFeoR5CV3/DvIrd7475AUoEFykVugg1wuMUBb4oAGiQtJzFZdXC1tQIfMAlKhaa3/eqgDe2qZBdpzDzTJDFn6ghaRYu6B1uQEMoFccgOZTnfIXVAPiZhY/H8zNJnjCDhaQLD/dIjg5CS0BM3rXJN1kNsleFO+R3kVwWzdYorAUCG2Ylsjm8JjG5bOSQaU5FB5al76K+xck/uYbmPKliL+yqtkK5tYzfKTBA3VPk/uk/PWaIxXgG66zNbek8+x6zlFv68ktnYPBLOq2ScI9GpJ2afI5rVAugtIR6Bs+OZ4iwn7gHnE/tYDsOieLBE7F1Xv21OEb/AG2a95ZMt+kPaJqA77ZO6iTYj8KMMo28OfwGHH3/34FyLuJIxtawAA</value>
</data>
<data name="DefaultSchema" xml:space="preserve">
<value>dbo</value>
</data>
</root>
@@ -0,0 +1,29 @@
// <auto-generated />
namespace EgwProxy.SqlDb.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
public sealed partial class AddMacProdData : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(AddMacProdData));
string IMigrationMetadata.Id
{
get { return "202303150807341_AddMacProdData"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}
@@ -0,0 +1,32 @@
namespace EgwProxy.SqlDb.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class AddMacProdData : DbMigration
{
public override void Up()
{
CreateTable(
"dbo.MachineProdData",
c => new
{
IdxPD = c.Int(nullable: false, identity: true),
DtEve = c.DateTime(nullable: false),
IdxMacchina = c.String(maxLength: 50),
Action = c.String(),
CodComm = c.String(),
PzCount = c.Int(nullable: false),
IdxPodl = c.Int(nullable: false),
IdxOdl = c.Int(nullable: false),
})
.PrimaryKey(t => t.IdxPD);
}
public override void Down()
{
DropTable("dbo.MachineProdData");
}
}
}
@@ -0,0 +1,126 @@
<?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>
<data name="Target" xml:space="preserve">
<value>H4sIAAAAAAAEAO1dW2/juBV+L9D/YOipBWajJNMutgN7Fxk7WQTNxYiTfS1oiXaE6uKVqKwzf60P/Un7F3pI3UiKulCSnWQrzEtMid+hyO9cRB2e+f0//53+tPfcyQsOIyfwZ8bZyakxwb4V2I6/nRkx2Xz3g/HTj3/+0/TS9vaTX7L7PtP7oKcfzYxnQnZfTDOynrGHohPPscIgCjbkxAo8E9mBeX56+g/z7MzEAGEA1mQyfYh94niY/YCf88C38I7EyL0NbOxGaTtcWTHUyR3ycLRDFp4Zl9vflmGwfz1Z/eou1sbkwnUQjGKF3Y0xQb4fEERgjF+eIrwiYeBvVztoQO7j6w7DfRvkRjgd+5fi9raPcXpOH8MsOmZQVhyRwNMEPPuczospd+80u0Y+bzBzlzDD5JU+NZu9mXFhkRsnIm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WQ01gbSZIa30u54C0Umfa7aDazJ2j76zNinMiA+mfWGqMTUGvQmPZsP7iof1fB+RHdYZGa4KUczNaEeTq5vAE4Up3vUOOSJW6hmOegjd9Lf9ch8wdq3B1o98A5yEPQkDFEcguZkB1AHIgpsjnHYcKPUrHG9eO/nOLRxu7zJziYONwiiueYxwI93CmRj6l2GU+FWcU7QOfUexstOUzil2eVz6h2AWDP6vVMV5W0o87jjgU90qnD1tOfo9aU90Mfjk1opW9p93+jwNS9VtNi3BSzT+uVlMvLKkeUxcdk6oxdYS410HoXolpjHEUMGOMM8Y4Y4wzxjh/gBinLv1gNPejuR/N/WjuR3P/RzH3dckEx69jM9inKqlMzdrZDkWUTu+I5Vo0g6yjXIumXI5CHJVc2kOsI9NQZiZJLICRr6mlSUac3lF6fIWg4kNoU/2ZCkH0jkZBpdIzzcVpVOLoTTCvcJ+PXFaRpoVcsT5NixI2NZLzSjgt5HJlbJrK3NRIXCryFNXixBo3berg1InNC+o0iS5VwmlRLEcpOLnrXy5qQdxSsZzmcjp1MkNakadBpFxOp7HejkogV69HZU5alOMpZyBNTf5/2ZwucATqkUPQ/3PTx2yLrgDN7rn2N0FmEuFJ+RFlt0gW8xYTBDYS0WBxgywCly2I2lmpMJbDMTMuvTW2r/37mOxiQqMgb+0KZT2nZr18VnNIHPP0nqU3REM8AgzToWb+3v8aO66dj/tKYeYrIKhBT99+YFQrQt+Ctq850l3gtwRKp2+Bd9in706P2Nu5ABbd+ytEd331x/YU4Ru8RdZrlkhWDdK8EOK0TxcO2obIi1KMoj/8BA7b3v7H/wEMa4xTbHYAAA==</value>
</data>
<data name="DefaultSchema" xml:space="preserve">
<value>dbo</value>
</data>
</root>
@@ -0,0 +1,40 @@
namespace EgwProxy.SqlDb.Migrations
{
using EgwProxy.SqlDb.DbModels;
using System;
using System.Data.Entity;
using System.Data.Entity.Migrations;
using System.Linq;
//public class ConfigurationInit : DropCreateDatabaseAlways<SyncStateDbContext>
public class ConfigurationInit : DbMigrationsConfiguration<SyncStateDbContext>
{
public ConfigurationInit()
{
AutomaticMigrationsEnabled = false;
}
protected override void Seed(SyncStateDbContext context)
{
// aggiunta preliminare tipo attività sync ammessi
context.DbSetActListType.AddOrUpdate<ActTypeModel>(
new ActTypeModel() { Action = "SetPodlData", Description = "Sincronizzazione dati PODL | MES --> MACH" },
new ActTypeModel() { Action = "GetPodlData", Description = "Lettura stato macchina x avvio prod ODL da PODL e sync relativa | MACH --> MES" },
new ActTypeModel() { Action = "GetEvList", Description = "Lettura info da impianto e decodifica come EvList | MACH --> MES" },
new ActTypeModel() { Action = "GetFluxLog", Description = "Lettura info da impianto e decodifica come FluxLog | MACH --> MES" },
new ActTypeModel() { Action = "GetSigLog", Description = "Lettura info da impianto e decodifica come SignalLog | MACH --> MES" },
new ActTypeModel() { Action = "StartProd", Description = "Dichiarazione inizio lavorazione (commessa) | MACH --> MES" },
new ActTypeModel() { Action = "EndProd", Description = "Dichiarazione fine lavorazione (commessa) | MACH --> MES" }
);
context.DbSetSyncState.AddOrUpdate<SyncStateModel>(
new SyncStateModel() { TableName = "ActList", LastIdx = 0, Note = "NO EXEC", LastUpdate = DateTime.Today },
new SyncStateModel() { TableName = "PODL_req", LastIdx = 0, Note = "NO EXEC", LastUpdate = DateTime.Today },
new SyncStateModel() { TableName = "EvList", LastIdx = 0, Note = "NO EXEC", LastUpdate = DateTime.Today },
new SyncStateModel() { TableName = "FluxLog", LastIdx = 0, Note = "NO EXEC", LastUpdate = DateTime.Today }
);
base.Seed(context);
}
}
}
+35
View File
@@ -0,0 +1,35 @@
using EgwProxy.SqlDb.DbModels;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.Migrations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EgwProxy.SqlDb
{
public class MyDbInitializer : IDatabaseInitializer<SyncStateDbContext>
{
public void InitializeDatabase(SyncStateDbContext context)
{
// aggiunta preliminare tipo attività sync ammessi
context.DbSetActListType.AddOrUpdate<ActTypeModel>(
new ActTypeModel() { Action = "SetPodlData", Description = "Sincronizzazione dati PODL | MES --> MACH" },
new ActTypeModel() { Action = "GetPodlData", Description = "Lettura stato macchina x avvio prod ODL da PODL e sync relativa | MACH --> MES" },
new ActTypeModel() { Action = "GetEvList", Description = "Lettura info da impianto e decodifica come EvList | MACH --> MES" },
new ActTypeModel() { Action = "GetFluxLog", Description = "Lettura info da impianto e decodifica come FluxLog | MACH --> MES" }
);
context.DbSetSyncState.AddOrUpdate<SyncStateModel>(
new SyncStateModel() { TableName = "ActList", LastIdx = 0, Note = "NO EXEC", LastUpdate = DateTime.Today },
new SyncStateModel() { TableName = "PODL_req", LastIdx = 0, Note = "NO EXEC", LastUpdate = DateTime.Today },
new SyncStateModel() { TableName = "EvList", LastIdx = 0, Note = "NO EXEC", LastUpdate = DateTime.Today },
new SyncStateModel() { TableName = "FluxLog", LastIdx = 0, Note = "NO EXEC", LastUpdate = DateTime.Today }
);
context.SaveChanges();
}
}
}
+36
View File
@@ -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.SqlDb")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EgwProxy.SqlDb")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[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("a5f9e2c8-b866-4470-923c-11ba35270963")]
// 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")]
+24
View File
@@ -0,0 +1,24 @@
/***************************************
* FUNCTION f_padLeft
*
* fornisce una stringa della lunghezza desiderata aggiungendo a sx il carattere richiesto alla @string originale
*
* Steamware, S.E.L.
* mod: 2010.03.19
*
****************************************/
CREATE FUNCTION [dbo].[f_padLeft] (@string VARCHAR(255), @desired_length INTEGER, @pad_character CHAR(1))
RETURNS VARCHAR(255) AS
BEGIN
-- Prefix the required number of spaces to bulk up the string and then replace the spaces with the desired character
RETURN CASE
WHEN LEN(@string) < @desired_length
THEN REPLACE(SPACE(@desired_length - LEN(@string)), ' ', @pad_character) + @string
ELSE @string
END
END
GO;
@@ -0,0 +1,11 @@
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Effettua backjup del database nella cartella configurata (di default C:\DbBackup) per il DB di default --> modificare di conseguenza...
BACKUP DATABASE MoonPro_IOB_ISF
TO DISK = 'C:\Steamware\DbBackup\MoonPro_IOB_ISF.bak'
WITH FORMAT,
MEDIANAME = 'SQLServerBackups',
NAME = 'Full Backup of IOB ISF DB';
@@ -0,0 +1,7 @@
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Effettua tutte le chiamate di export specifiche per il processo e poi restituisce lettura tabella SyncState
SELECT *
FROM SyncState
@@ -0,0 +1,21 @@
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
/* --------------------------------------------------
* DECODIFICA STANDARD
* STATE MACHINE 60
* bitmap MAPO
* B0: POWER_ON
* B1: RUN
* B2: pzCount
* B3: allarme
* B4: manuale
* B5: slowTC
* B6: WarmUpCoolDown
* B7: emergenza
* -------------------------------------------------- */
-- Effettua le verifiche necessarie sulle varie tabelle, leggendo dall'ultimo punto precedente e popolando MachineEventList
SELECT *
FROM MachineEventList
@@ -0,0 +1,11 @@
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
/* --------------------------------------------------
* Popola le tabelle parametri secondo disponibilità per successivo sync/invio
* -------------------------------------------------- */
-- Effettua le verifiche necessarie sulle varie tabelle, leggendo dall'ultimo punto precedente e popolando MachineFluxLog
SELECT *
FROM MachineFluxLog
@@ -0,0 +1,9 @@
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Effettua le verifiche necessarie sulle varie tabelle, leggendo dall'ultimo punto precedente e popolando MachineEventList
SELECT *
FROM MachineProdData
@@ -0,0 +1,81 @@
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
BEGIN tran
-- dichiarazioni variabili x recupero dati
DECLARE @LastIdx INT = 0
DECLARE @NewIdx INT = 0
-- recupero valore ultima riga stato processata...
SELECT @LastIdx = ISNULL(LastIdx,0)
FROM SyncState
WHERE TableName = 'ToMachineSigLog'
-- recupero nuovo MAX idx
SELECT @NewIdx = ISNULL(MAX(ID),0)
FROM syn_M2ERP_MACHINE_STATE
-- eseguo SOLO SE ho dati aggiuntivi...
IF(@NewIdx > @LastIdx)
BEGIN
/* --------------------------------------------------
* DECODIFICA STANDARD
* STATE MACHINE 60
* bitmap MAPO
* B0: POWER_ON
* B1: RUN
* B2: pzCount
* B3: allarme
* B4: manuale
* B5: slowTC
* B6: WarmUpCoolDown
* B7: emergenza
* -------------------------------------------------- */
-- decodifica colonne PAMA:
-- M_ON --> PowerON (B0)
-- Auto --> Lavora (B1)
-- AlarmMode --> Allarme (B3)
-- ManualMode/Mda/Jog --> Manuale (B4)
-- Mda/Jog --> Manuale (B4)
-- ManualMode --> Manuale (B4)
-- recupero i nuovi record da processare...
;WITH cteSigLog AS
(
SELECT [DateTime] AS DtEve
,Targa AS IdxMacchina
, 128 -- B7: emergenza armata (B7 --> 128)
+ CASE WHEN M_ON = 1 THEN 1 ELSE 0 END -- B0: spenta
+ CASE WHEN [Auto] = 1 THEN 2 ELSE 0 END -- B1: lavora
+ CASE WHEN AlarmMode = 1 THEN 8 ELSE 0 END -- B3: allarme
+ CASE WHEN (ManualMode = 1 OR Mda = 1 OR Jog = 1) THEN 16 ELSE 0 END -- B4: manuale
AS ValInt
FROM syn_M2ERP_MACHINE_STATE
WHERE ID > @LastIdx AND ID <= @NewIdx
)
--vero insert valori
INSERT INTO MachineSignalLog(DtEve, IdxMacchina, ValInt, Valore)
SELECT *
,CONVERT(VARCHAR(1000),CONVERT(VARBINARY(2), ValInt), 2) AS Valore
--,CONVERT(VARBINARY(2), ValInt) AS Valore
FROM cteSigLog
-- aggiorno valore indice processato
MERGE SyncState AS tgt
USING (SELECT @NewIdx as LastIdx, 'ToMachineSigLog' AS TableName) as src (LastIdx, TableName)
ON (tgt.TableName = src.TableName)
WHEN MATCHED THEN
UPDATE SET LastIdx = src.LastIdx
,Note = 'UPDATED from ' + CAST(@LastIdx AS NVARCHAR(50))
,LastUpdate = GETDATE()
WHEN NOT MATCHED THEN
INSERT (LastIdx, TableName, Note, LastUpdate)
VALUES (src.LastIdx, src.TableName, 'CREATED', GETDATE());
END
COMMIT tran
@@ -0,0 +1,7 @@
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Effettua tutti i task di import e poi restituisce lettura tabella SyncState
SELECT *
FROM SyncState
@@ -0,0 +1,15 @@
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Effettua reset delle tabelle PODL (ATTENZIONE!!!), da decommentare
--TRUNCATE TABLE MesPODL_req;
--DBCC CHECKIDENT ('MesPODL_req', RESEED, 0);
--TRUNCATE TABLE MesPODL_last;
--DBCC CHECKIDENT ('MesPODL_last', RESEED, 0);
-- elenco righe finale
SELECT *
FROM MesPODL_req
@@ -0,0 +1,16 @@
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Calcola i NUOVI PODL e scrive ADD relativo
SELECT *
FROM MesPODL_last
-- Calcola i VECCHI PODL e scrive DELETE relativo
SELECT *
FROM MesPODL_req
-- Calcola i PODL modificati e scrive update relativo
SELECT *
FROM MesPODL_req

Some files were not shown because too many files have changed in this diff Show More