Semplificazione MSFD call
This commit is contained in:
@@ -1813,23 +1813,17 @@ namespace MP.Data.Controllers
|
||||
/// </summary>
|
||||
/// <param name="idxMacc"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<VMSFDModel>> VMSFDGetByMaccAsync(string idxMacc)
|
||||
public async Task<VMSFDModel?> VMSFDGetByMaccAsync(string idxMacc)
|
||||
{
|
||||
List<VMSFDModel> dbResult = new List<VMSFDModel>();
|
||||
VMSFDModel? dbResult = null;
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacc);
|
||||
try
|
||||
{
|
||||
dbResult = await dbCtx
|
||||
.DbSetMSFD
|
||||
.FromSqlRaw("exec dbo.stp_MSFD_getMacc @IdxMacchina", IdxMacchina)
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
}
|
||||
dbResult = await dbCtx
|
||||
.DbSetMSFD
|
||||
.FromSqlRaw("exec dbo.stp_MSFD_getMacc @IdxMacchina", IdxMacchina)
|
||||
.AsNoTracking()
|
||||
.FirstOrDefaultAsync();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
@@ -4959,49 +4959,36 @@ namespace MP.IOC.Data
|
||||
stopWatch.Start();
|
||||
string readType = "DB";
|
||||
|
||||
var dbResults = await IocDbController.VMSFDGetByMaccAsync(idxMacc);
|
||||
#if false
|
||||
// recupero tutte e filtro a mano...
|
||||
var dbResults = await IocDbController.VMSFDGetAllAsync();
|
||||
#endif
|
||||
var dbResult = await IocDbController.VMSFDGetByMaccAsync(idxMacc);
|
||||
// converto in formato dizionario...
|
||||
if (dbResults != null && dbResults.Count > 0)
|
||||
{
|
||||
//var rowResult = dbResults[0];
|
||||
var rowResult = dbResults.FirstOrDefault();
|
||||
#if false
|
||||
var rowResult = dbResults.FirstOrDefault(x => x.IdxMacchina == idxMacc);
|
||||
#endif
|
||||
if (rowResult != null)
|
||||
{
|
||||
// salvo 1:1 i valori... STATO
|
||||
result.Add("IdxMicroStato", $"{rowResult.IdxMicroStato}");
|
||||
result.Add("IdxStato", $"{rowResult.IdxStato}");
|
||||
result.Add("CodArticolo", $"{rowResult.CodArticolo}");
|
||||
result.Add("insEnabled", $"{rowResult.InsEnabled}");
|
||||
result.Add("sLogEnabled", $"{rowResult.SLogEnabled}");
|
||||
result.Add("pallet", $"{rowResult.Pallet}");
|
||||
result.Add("CodArticolo_A", $"{rowResult.CodArticoloA}");
|
||||
result.Add("CodArticolo_B", $"{rowResult.CodArticoloB}");
|
||||
result.Add("TempoCicloBase", $"{rowResult.TempoCicloBase}");
|
||||
result.Add("PzPalletProd", $"{rowResult.PzPalletProd}");
|
||||
result.Add("MatrOpr", $"{rowResult.MatrOpr}");
|
||||
result.Add("lastVal", $"{rowResult.LastVal}");
|
||||
result.Add("TCBase", $"{rowResult.TempoCicloBase}");
|
||||
if (dbResult != null)
|
||||
{ // salvo 1:1 i valori... STATO
|
||||
result.Add("IdxMicroStato", $"{dbResult.IdxMicroStato}");
|
||||
result.Add("IdxStato", $"{dbResult.IdxStato}");
|
||||
result.Add("CodArticolo", $"{dbResult.CodArticolo}");
|
||||
result.Add("insEnabled", $"{dbResult.InsEnabled}");
|
||||
result.Add("sLogEnabled", $"{dbResult.SLogEnabled}");
|
||||
result.Add("pallet", $"{dbResult.Pallet}");
|
||||
result.Add("CodArticolo_A", $"{dbResult.CodArticoloA}");
|
||||
result.Add("CodArticolo_B", $"{dbResult.CodArticoloB}");
|
||||
result.Add("TempoCicloBase", $"{dbResult.TempoCicloBase}");
|
||||
result.Add("PzPalletProd", $"{dbResult.PzPalletProd}");
|
||||
result.Add("MatrOpr", $"{dbResult.MatrOpr}");
|
||||
result.Add("lastVal", $"{dbResult.LastVal}");
|
||||
result.Add("TCBase", $"{dbResult.TempoCicloBase}");
|
||||
|
||||
//...e SETUP
|
||||
result.Add("CodMacc", $"{rowResult.Codmacchina}");
|
||||
result.Add("IdxFamIn", $"{rowResult.IdxFamigliaIngresso}");
|
||||
result.Add("Multi", $"{rowResult.Multi}");
|
||||
result.Add("BitFilt", $"{rowResult.BitFilt}");
|
||||
result.Add("MaxVal", $"{rowResult.MaxVal}");
|
||||
result.Add("BSR", $"{rowResult.Bsr}");
|
||||
result.Add("ExplodeBit", $"{rowResult.ExplodeBit}");
|
||||
result.Add("NumBit", $"{rowResult.NumBit}");
|
||||
result.Add("IdxFamMacc", $"{rowResult.IdxFamiglia}");
|
||||
result.Add("simplePallet", $"{rowResult.SimplePallet}");
|
||||
result.Add("palletChange", $"{rowResult.PalletChange}");
|
||||
}
|
||||
//...e SETUP
|
||||
result.Add("CodMacc", $"{dbResult.Codmacchina}");
|
||||
result.Add("IdxFamIn", $"{dbResult.IdxFamigliaIngresso}");
|
||||
result.Add("Multi", $"{dbResult.Multi}");
|
||||
result.Add("BitFilt", $"{dbResult.BitFilt}");
|
||||
result.Add("MaxVal", $"{dbResult.MaxVal}");
|
||||
result.Add("BSR", $"{dbResult.Bsr}");
|
||||
result.Add("ExplodeBit", $"{dbResult.ExplodeBit}");
|
||||
result.Add("NumBit", $"{dbResult.NumBit}");
|
||||
result.Add("IdxFamMacc", $"{dbResult.IdxFamiglia}");
|
||||
result.Add("simplePallet", $"{dbResult.SimplePallet}");
|
||||
result.Add("palletChange", $"{dbResult.PalletChange}");
|
||||
}
|
||||
// cerco info Master/slave...
|
||||
var m2sTab = await Macchine2SlaveGetAllAsync();
|
||||
|
||||
Reference in New Issue
Block a user