COmpletato import RegGIacenze (con test)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using MapoDb;
|
||||
using MagData;
|
||||
using MapoDb;
|
||||
using MapoSDK;
|
||||
using Newtonsoft.Json;
|
||||
using SteamWare;
|
||||
@@ -1251,6 +1252,7 @@ namespace MP_IO.Controllers
|
||||
if (content != "")
|
||||
{
|
||||
DataLayer DataLayerObj = new DataLayer();
|
||||
MagDataLayer DataLayerMagObj = new MagDataLayer();
|
||||
// deserializzo come un dictionary generico di oggetti rawDataType/string
|
||||
List<BaseRawTransf> receivedData = new List<BaseRawTransf>();
|
||||
// procedo a deserializzare in blocco l'oggetto...
|
||||
@@ -1273,7 +1275,6 @@ namespace MP_IO.Controllers
|
||||
{
|
||||
// per ora salvo su REDIS ultimo x tipo
|
||||
DataLayerObj.lastRawTrasfData = JsonConvert.SerializeObject(item.mesContent);
|
||||
//DataLayerObj.lastRawTrasfData = item.mesContent;
|
||||
|
||||
// !!! FixMe ToDo fare deserializzazione e salvataggio su MongoDB
|
||||
// salvataggio su tab RawTrasf su DB IS
|
||||
@@ -1281,15 +1282,36 @@ namespace MP_IO.Controllers
|
||||
// in base al tipo processo...
|
||||
switch (item.mesType)
|
||||
{
|
||||
case rawTransfType.ND:
|
||||
break;
|
||||
|
||||
case rawTransfType.IcoelBatch:
|
||||
break;
|
||||
|
||||
case rawTransfType.IcoelVarInfo:
|
||||
break;
|
||||
|
||||
case rawTransfType.RegGiacenze:
|
||||
// elenco ODL da svuotare preventivamente x insert...
|
||||
List<int> listOdl = new List<int>();
|
||||
// processo scrittura giacenze... processo 1:1 record di RegGiacenze
|
||||
List<RegGiacenze> recData = new List<RegGiacenze>();
|
||||
foreach (var singleRow in item.mesContent)
|
||||
{
|
||||
var listGiac = JsonConvert.DeserializeObject<RegGiacenze>(singleRow.Value.ToString());
|
||||
recData.Add(listGiac);
|
||||
if (!listOdl.Contains(listGiac.IdxODL))
|
||||
{
|
||||
listOdl.Add(listGiac.IdxODL);
|
||||
}
|
||||
}
|
||||
// svuoto le giacenze degli ODL oggetto di import...
|
||||
bool fatto = DataLayerMagObj.resetRegGiacByOdl(listOdl);
|
||||
if (fatto)
|
||||
{
|
||||
// invio x salvare
|
||||
fatto = DataLayerMagObj.salvaRegGiac(recData);
|
||||
}
|
||||
break;
|
||||
|
||||
case rawTransfType.ND:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -385,6 +385,10 @@
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MagData\MagData.csproj">
|
||||
<Project>{973245E4-02C0-4ED1-A81B-1727C5F4CA59}</Project>
|
||||
<Name>MagData</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\MapoDb\MapoDb.csproj">
|
||||
<Project>{4617a665-d6e3-4ceb-a689-ce2eecd45713}</Project>
|
||||
<Name>MapoDb</Name>
|
||||
|
||||
+2
-1
@@ -35,7 +35,8 @@
|
||||
<add key="aspnet:MaxJsonDeserializerMembers" value="150000" />
|
||||
<!--stringhe connessione-->
|
||||
<add key="DbConfConnectionString" value="Data Source=SQL2016DEV;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=keyhammer16;" />
|
||||
<add key="MoonProConnectionString" value="Data Source=SQL2016DEV;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=keyhammer16;" />
|
||||
<add key="MoonProConnectionString" value="Data Source=SQL2016DEV;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=keyhammer16;" />
|
||||
<add key="MagDataConnectionString" value="Data Source=SQL2016DEV;Initial Catalog=MoonPro_MAG;Persist Security Info=True;User ID=sa;Password=keyhammer16;" />
|
||||
<add key="PermessiConnectionString" value="Data Source=SQL2016DEV;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=keyhammer16;" />
|
||||
<add key="UtenteCdcConnectionString" value="Data Source=SQL2016DEV;Initial Catalog=MoonPro_Anagrafica;Persist Security Info=True;User ID=sa;Password=keyhammer16;" />
|
||||
<add key="VocabolarioConnectionString" value="Data Source=SQL2016DEV;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=keyhammer16;" />
|
||||
|
||||
@@ -268,6 +268,12 @@
|
||||
<Content Include="Core\Compression\Snappy\lib\win\snappy64.dll" />
|
||||
<Content Include="Core\Compression\Zstandard\lib\win\libzstd.dll" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MapoSDK\MapoSDK.csproj">
|
||||
<Project>{D07211B6-CF67-4C7F-8040-5B8C3B12BB4B}</Project>
|
||||
<Name>MapoSDK</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\MongoDB.Libmongocrypt.1.3.0\build\MongoDB.Libmongocrypt.targets" Condition="Exists('..\packages\MongoDB.Libmongocrypt.1.3.0\build\MongoDB.Libmongocrypt.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
|
||||
+186
-137
@@ -1,4 +1,5 @@
|
||||
using Newtonsoft.Json;
|
||||
using MapoSDK;
|
||||
using Newtonsoft.Json;
|
||||
using SteamWare.IO;
|
||||
using SteamWare.Reports;
|
||||
using System;
|
||||
@@ -239,141 +240,6 @@ namespace MagData
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Verifica esistenza record da NOME CODA stampa + tipoDoc + chiave...
|
||||
/// </summary>
|
||||
/// <param name="printQueue"></param>
|
||||
/// <param name="tipoDoc"></param>
|
||||
/// <param name="keyParam"></param>
|
||||
/// <returns></returns>
|
||||
private bool checkDoc(string printQueue, tipoDocumento tipoDoc, string keyParam)
|
||||
{
|
||||
bool answ = false;
|
||||
reportRichiesto tipoReport = reportRichiesto.ND;
|
||||
|
||||
// se ho un TIPO DOC --> cerco
|
||||
if (tipoDoc != tipoDocumento.docND)
|
||||
{
|
||||
//cerco in setup queueConf
|
||||
var repConf = reportConfRedis.Find(a => a.name == $"{tipoDoc}");
|
||||
if (repConf != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
tipoReport = (reportRichiesto)Enum.Parse(typeof(reportRichiesto), repConf.template.Replace(".rdlc", ""));
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
}
|
||||
// se non trovato esplicitamente
|
||||
if (tipoReport == reportRichiesto.ND)
|
||||
{
|
||||
//cerco in setup queueConf
|
||||
var coda = queueConfRedis.Find(a => a.name == printQueue);
|
||||
if (coda != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
tipoReport = (reportRichiesto)Enum.Parse(typeof(reportRichiesto), coda.template.Replace(".rdlc", ""));
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
}
|
||||
// ricerco!
|
||||
switch (tipoReport)
|
||||
{
|
||||
case reportRichiesto.CartellinoFinitiOdette:
|
||||
var tabFiniti = taCFOdette.GetData(keyParam);
|
||||
answ = tabFiniti.Count > 0;
|
||||
break;
|
||||
|
||||
case reportRichiesto.CartellinoPedane:
|
||||
var tabPedane = taCPed.GetData(keyParam);
|
||||
answ = tabPedane.Count > 0;
|
||||
break;
|
||||
|
||||
case reportRichiesto.CartellinoSemilavorati:
|
||||
var tabSemilav = taCSemil.GetData(keyParam);
|
||||
answ = tabSemilav.Count > 0;
|
||||
break;
|
||||
|
||||
case reportRichiesto.ReportPackList:
|
||||
var tabPackList = taRepPL.GetData(keyParam, false);
|
||||
answ = tabPackList.Count > 0;
|
||||
break;
|
||||
|
||||
case reportRichiesto.ReportPackListFull:
|
||||
var tabPackListFull = taRepPLFull.GetData(keyParam, false);
|
||||
answ = tabPackListFull.Count > 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
private void initTA()
|
||||
{
|
||||
// reports
|
||||
taPJQ = new DS_ReportTableAdapters.PrintJobQueueTableAdapter();
|
||||
taCFOdette = new DS_ReportTableAdapters.stp_prt_CartellinoFinitiOdetteTableAdapter();
|
||||
taCPed = new DS_ReportTableAdapters.stp_prt_CartellinoPedaneTableAdapter();
|
||||
taCSemil = new DS_ReportTableAdapters.stp_prt_CartellinoSemilavoratiTableAdapter();
|
||||
taRepPL = new DS_ReportTableAdapters.stp_prt_ReportPackListTableAdapter();
|
||||
taRepPLFull = new DS_ReportTableAdapters.stp_prt_ReportPackListFullTableAdapter();
|
||||
|
||||
taAA = new DS_MagTableAdapters.AnagArtTableAdapter();
|
||||
taAA2C = new DS_MagTableAdapters.AnagArticoli2ClientiTableAdapter();
|
||||
taACF = new DS_MagTableAdapters.AnagClientiTableAdapter();
|
||||
taADC= new DS_MagTableAdapters.AnagDestinClientiTableAdapter();
|
||||
taEA2U = new DS_MagTableAdapters.ElencoAL2UDCTableAdapter();
|
||||
taEAL = new DS_MagTableAdapters.ElencoALTableAdapter();
|
||||
taEL = new DS_MagTableAdapters.ElencoLottiTableAdapter();
|
||||
taEP2Q = new DS_MagTableAdapters.Elencopost2QueueTableAdapter();
|
||||
taEUdc = new DS_MagTableAdapters.ElencoUdcTableAdapter();
|
||||
taODL = new DS_MagTableAdapters.ODLTableAdapter();
|
||||
taRegGia = new DS_MagTableAdapters.RegGiacenzeTableAdapter();
|
||||
|
||||
taEOL = new DS_PackListTableAdapters.ExtOrdersListTableAdapter();
|
||||
taOList = new DS_PackListTableAdapters.OrdersListTableAdapter();
|
||||
taPList = new DS_PackListTableAdapters.PackListTableAdapter();
|
||||
}
|
||||
|
||||
private void setupConnString()
|
||||
{
|
||||
string connString = memLayer.ML.CRS("MagDataConnectionString");
|
||||
// reports
|
||||
taPJQ.Connection.ConnectionString = connString;
|
||||
taCFOdette.Connection.ConnectionString = connString;
|
||||
taCPed.Connection.ConnectionString = connString;
|
||||
taCSemil.Connection.ConnectionString = connString;
|
||||
taRepPL.Connection.ConnectionString = connString;
|
||||
taRepPLFull.Connection.ConnectionString = connString;
|
||||
|
||||
taAA.Connection.ConnectionString = connString;
|
||||
taAA2C.Connection.ConnectionString = connString;
|
||||
taACF.Connection.ConnectionString = connString;
|
||||
taADC.Connection.ConnectionString = connString;
|
||||
taEA2U.Connection.ConnectionString = connString;
|
||||
taEAL.Connection.ConnectionString = connString;
|
||||
taEL.Connection.ConnectionString = connString;
|
||||
taEP2Q.Connection.ConnectionString = connString;
|
||||
taEUdc.Connection.ConnectionString = connString;
|
||||
taODL.Connection.ConnectionString = connString;
|
||||
taRegGia.Connection.ConnectionString = connString;
|
||||
|
||||
taEOL.Connection.ConnectionString = connString;
|
||||
taOList.Connection.ConnectionString = connString;
|
||||
taPList.Connection.ConnectionString = connString;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
@@ -504,11 +370,59 @@ namespace MagData
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue svuotamento giacenze dato elenco ODL...
|
||||
/// </summary>
|
||||
/// <param name="listODL"></param>
|
||||
/// <returns></returns>
|
||||
public bool resetRegGiacByOdl(List<int> listODL)
|
||||
{
|
||||
bool fatto = false;
|
||||
if (listODL.Count > 0)
|
||||
{
|
||||
foreach (var item in listODL)
|
||||
{
|
||||
taRegGia.DeleteByOdl(item);
|
||||
fatto = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fatto = true;
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue salvataggio records giacenze...
|
||||
/// </summary>
|
||||
/// <param name="listGiacenze"></param>
|
||||
/// <returns></returns>
|
||||
public bool salvaRegGiac(List<RegGiacenze> listGiacenze)
|
||||
{
|
||||
bool fatto = false;
|
||||
if (listGiacenze.Count > 0)
|
||||
{
|
||||
foreach (var item in listGiacenze)
|
||||
{
|
||||
taRegGia.InsertQuery(item.IdxODL, item.IdentRG, item.Product, item.Variety, item.Supplier, item.ExtDoc, item.DateRif, item.QtyTot, item.NumPack, item.Notes);
|
||||
fatto = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fatto = true;
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// effettua la stampa di un documento
|
||||
/// </summary>
|
||||
/// <param name="keyParam">Codice UNIVOCO del documento</param>
|
||||
/// <param name="printQueue">stampante specifica (da postazione o std da web.config, a cura dell'utente</param>
|
||||
/// <param name="printQueue">
|
||||
/// stampante specifica (da postazione o std da web.config, a cura dell'utente
|
||||
/// </param>
|
||||
/// <param name="tipoDoc">Tipo documento richiesto</param>
|
||||
/// <param name="clientIp">IP del chiamante</param>
|
||||
/// <returns></returns>
|
||||
@@ -539,5 +453,140 @@ namespace MagData
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Verifica esistenza record da NOME CODA stampa + tipoDoc + chiave...
|
||||
/// </summary>
|
||||
/// <param name="printQueue"></param>
|
||||
/// <param name="tipoDoc"></param>
|
||||
/// <param name="keyParam"></param>
|
||||
/// <returns></returns>
|
||||
private bool checkDoc(string printQueue, tipoDocumento tipoDoc, string keyParam)
|
||||
{
|
||||
bool answ = false;
|
||||
reportRichiesto tipoReport = reportRichiesto.ND;
|
||||
|
||||
// se ho un TIPO DOC --> cerco
|
||||
if (tipoDoc != tipoDocumento.docND)
|
||||
{
|
||||
//cerco in setup queueConf
|
||||
var repConf = reportConfRedis.Find(a => a.name == $"{tipoDoc}");
|
||||
if (repConf != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
tipoReport = (reportRichiesto)Enum.Parse(typeof(reportRichiesto), repConf.template.Replace(".rdlc", ""));
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
}
|
||||
// se non trovato esplicitamente
|
||||
if (tipoReport == reportRichiesto.ND)
|
||||
{
|
||||
//cerco in setup queueConf
|
||||
var coda = queueConfRedis.Find(a => a.name == printQueue);
|
||||
if (coda != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
tipoReport = (reportRichiesto)Enum.Parse(typeof(reportRichiesto), coda.template.Replace(".rdlc", ""));
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
}
|
||||
// ricerco!
|
||||
switch (tipoReport)
|
||||
{
|
||||
case reportRichiesto.CartellinoFinitiOdette:
|
||||
var tabFiniti = taCFOdette.GetData(keyParam);
|
||||
answ = tabFiniti.Count > 0;
|
||||
break;
|
||||
|
||||
case reportRichiesto.CartellinoPedane:
|
||||
var tabPedane = taCPed.GetData(keyParam);
|
||||
answ = tabPedane.Count > 0;
|
||||
break;
|
||||
|
||||
case reportRichiesto.CartellinoSemilavorati:
|
||||
var tabSemilav = taCSemil.GetData(keyParam);
|
||||
answ = tabSemilav.Count > 0;
|
||||
break;
|
||||
|
||||
case reportRichiesto.ReportPackList:
|
||||
var tabPackList = taRepPL.GetData(keyParam, false);
|
||||
answ = tabPackList.Count > 0;
|
||||
break;
|
||||
|
||||
case reportRichiesto.ReportPackListFull:
|
||||
var tabPackListFull = taRepPLFull.GetData(keyParam, false);
|
||||
answ = tabPackListFull.Count > 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
private void initTA()
|
||||
{
|
||||
// reports
|
||||
taPJQ = new DS_ReportTableAdapters.PrintJobQueueTableAdapter();
|
||||
taCFOdette = new DS_ReportTableAdapters.stp_prt_CartellinoFinitiOdetteTableAdapter();
|
||||
taCPed = new DS_ReportTableAdapters.stp_prt_CartellinoPedaneTableAdapter();
|
||||
taCSemil = new DS_ReportTableAdapters.stp_prt_CartellinoSemilavoratiTableAdapter();
|
||||
taRepPL = new DS_ReportTableAdapters.stp_prt_ReportPackListTableAdapter();
|
||||
taRepPLFull = new DS_ReportTableAdapters.stp_prt_ReportPackListFullTableAdapter();
|
||||
|
||||
taAA = new DS_MagTableAdapters.AnagArtTableAdapter();
|
||||
taAA2C = new DS_MagTableAdapters.AnagArticoli2ClientiTableAdapter();
|
||||
taACF = new DS_MagTableAdapters.AnagClientiTableAdapter();
|
||||
taADC = new DS_MagTableAdapters.AnagDestinClientiTableAdapter();
|
||||
taEA2U = new DS_MagTableAdapters.ElencoAL2UDCTableAdapter();
|
||||
taEAL = new DS_MagTableAdapters.ElencoALTableAdapter();
|
||||
taEL = new DS_MagTableAdapters.ElencoLottiTableAdapter();
|
||||
taEP2Q = new DS_MagTableAdapters.Elencopost2QueueTableAdapter();
|
||||
taEUdc = new DS_MagTableAdapters.ElencoUdcTableAdapter();
|
||||
taODL = new DS_MagTableAdapters.ODLTableAdapter();
|
||||
taRegGia = new DS_MagTableAdapters.RegGiacenzeTableAdapter();
|
||||
|
||||
taEOL = new DS_PackListTableAdapters.ExtOrdersListTableAdapter();
|
||||
taOList = new DS_PackListTableAdapters.OrdersListTableAdapter();
|
||||
taPList = new DS_PackListTableAdapters.PackListTableAdapter();
|
||||
}
|
||||
|
||||
private void setupConnString()
|
||||
{
|
||||
string connString = memLayer.ML.CRS("MagDataConnectionString");
|
||||
// reports
|
||||
taPJQ.Connection.ConnectionString = connString;
|
||||
taCFOdette.Connection.ConnectionString = connString;
|
||||
taCPed.Connection.ConnectionString = connString;
|
||||
taCSemil.Connection.ConnectionString = connString;
|
||||
taRepPL.Connection.ConnectionString = connString;
|
||||
taRepPLFull.Connection.ConnectionString = connString;
|
||||
|
||||
taAA.Connection.ConnectionString = connString;
|
||||
taAA2C.Connection.ConnectionString = connString;
|
||||
taACF.Connection.ConnectionString = connString;
|
||||
taADC.Connection.ConnectionString = connString;
|
||||
taEA2U.Connection.ConnectionString = connString;
|
||||
taEAL.Connection.ConnectionString = connString;
|
||||
taEL.Connection.ConnectionString = connString;
|
||||
taEP2Q.Connection.ConnectionString = connString;
|
||||
taEUdc.Connection.ConnectionString = connString;
|
||||
taODL.Connection.ConnectionString = connString;
|
||||
taRegGia.Connection.ConnectionString = connString;
|
||||
|
||||
taEOL.Connection.ConnectionString = connString;
|
||||
taOList.Connection.ConnectionString = connString;
|
||||
taPList.Connection.ConnectionString = connString;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
+6
-1
@@ -197,7 +197,12 @@ namespace MapoSDK
|
||||
/// <summary>
|
||||
/// Icoel: Variety + layout info relative
|
||||
/// </summary>
|
||||
IcoelVarInfo
|
||||
IcoelVarInfo,
|
||||
|
||||
/// <summary>
|
||||
/// Info tipo tabella RegGiacenze (MAG)
|
||||
/// </summary>
|
||||
RegGiacenze
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -496,6 +496,27 @@ namespace MapoSDK
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tracciato RegGiacenze x insert da IOB
|
||||
/// </summary>
|
||||
public class RegGiacenze
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public DateTime DateRif { get; set; } = DateTime.Today;
|
||||
public string ExtDoc { get; set; } = "";
|
||||
public string IdentRG { get; set; } = "";
|
||||
public int IdxODL { get; set; } = 0;
|
||||
public string Notes { get; set; } = "";
|
||||
public int NumPack { get; set; } = 0;
|
||||
public string Product { get; set; } = "";
|
||||
public double QtyTot { get; set; } = 0;
|
||||
public string Supplier { get; set; } = "";
|
||||
public string Variety { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
public class StCheckOverride
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
Reference in New Issue
Block a user