Riorganizzazione commenti --> note
This commit is contained in:
@@ -302,6 +302,38 @@ namespace MP.Data.Controllers
|
||||
_configuration = null;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Eliminazione record EventList (SE trovato)
|
||||
/// </summary>
|
||||
/// <param name="newRec"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> EvListDelete(string idxMacchina, DateTime dtEvento)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
try
|
||||
{
|
||||
var item2del = dbCtx
|
||||
.DbSetEvList
|
||||
.Where(x => x.IdxMacchina == idxMacchina && x.InizioStato == dtEvento)
|
||||
.FirstOrDefault();
|
||||
if (item2del != null)
|
||||
{
|
||||
dbCtx.DbSetEvList.Remove(item2del);
|
||||
await dbCtx.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione durante EvListDelete{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
await Task.Delay(1);
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiunta record EventList
|
||||
/// </summary>
|
||||
|
||||
@@ -414,7 +414,8 @@ namespace MP.Data.Objects
|
||||
public enum tipoInputEvento
|
||||
{
|
||||
barcode,
|
||||
hw
|
||||
hw,
|
||||
commento
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -424,29 +424,13 @@ namespace MP.Data.Services
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// scrive una riga di evento inviato da Barcode nel db
|
||||
/// Scrive una riga in EventList inviato nel db + check
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina">codice macchina</param>
|
||||
/// <param name="idxTipo">idx evento</param>
|
||||
/// <param name="codArticolo">Codice Articolo</param>
|
||||
/// <param name="value">valore</param>
|
||||
/// <param name="matrOpr">matricola operatore</param>
|
||||
/// <param name="pallet">pallet (vuoto se nd)</param>
|
||||
/// <param name="newRec">Record da registrare</param>
|
||||
/// <returns></returns>
|
||||
public async Task<inputComandoMapo> scriviRigaEventoBarcode(string idxMacchina, int idxTipo, string codArticolo, string value, int matrOpr, string pallet)
|
||||
public async Task<inputComandoMapo> EvListInsert(EventListModel newRec, tipoInputEvento tipoEv)
|
||||
{
|
||||
bool inserito = false;
|
||||
DateTime adesso = DateTime.Now;
|
||||
EventListModel newRec = new EventListModel()
|
||||
{
|
||||
IdxMacchina = idxMacchina,
|
||||
InizioStato = adesso,
|
||||
IdxTipo = idxTipo,
|
||||
CodArticolo = codArticolo,
|
||||
Value = value,
|
||||
MatrOpr = matrOpr,
|
||||
pallet = pallet
|
||||
};
|
||||
try
|
||||
{
|
||||
// inserisco evento
|
||||
@@ -454,18 +438,22 @@ namespace MP.Data.Services
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string logMsg = $"Eccezione in fase di scrittura evento con i seguenti dati | macchina: {idxMacchina} | IdxTipo: {idxTipo} | CodArticolo: {codArticolo} | Value {value} | MatrOpr {matrOpr} | Pallet {pallet}{Environment.NewLine}{exc}";
|
||||
string logMsg = $"Eccezione in fase di scrittura evento con i seguenti dati | macchina: {newRec.IdxMacchina} | IdxTipo: {newRec.IdxTipo} | CodArticolo: {newRec.CodArticolo} | Value {newRec.Value} | MatrOpr {newRec.MatrOpr} | Pallet {newRec.pallet}{Environment.NewLine}{exc}";
|
||||
Log.Error(logMsg);
|
||||
}
|
||||
try
|
||||
// se non è un commento...
|
||||
if (tipoEv != tipoInputEvento.commento)
|
||||
{
|
||||
// faccio controllo per eventuale cambio stato da tab transizioni...
|
||||
dbTabController.CheckCambiaStatoBatch(tipoInputEvento.barcode, idxMacchina, adesso, idxTipo, codArticolo, value, matrOpr, pallet);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string logMsg = $"Eccezione in checkCambiaStatoBatch(6) | tipoInputEvento: {tipoInputEvento.barcode} | macchina: {idxMacchina} | dataOra: {adesso} | IdxTipo: {idxTipo} | CodArticolo: {codArticolo} | Value {value} | MatrOpr {matrOpr} | Pallet {pallet}{Environment.NewLine}{exc}";
|
||||
Log.Error(logMsg);
|
||||
try
|
||||
{
|
||||
// faccio controllo per eventuale cambio stato da tab transizioni...
|
||||
dbTabController.CheckCambiaStatoBatch(tipoEv, newRec.IdxMacchina, newRec.InizioStato ?? DateTime.Now, newRec.IdxTipo, newRec.CodArticolo, newRec.Value, newRec.MatrOpr, newRec.pallet);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string logMsg = $"Eccezione in checkCambiaStatoBatch(6) | tipoInputEvento: {tipoEv} |macchina: {newRec.IdxMacchina} | IdxTipo: {newRec.IdxTipo} | CodArticolo: {newRec.CodArticolo} | Value {newRec.Value} | MatrOpr {newRec.MatrOpr} | Pallet {newRec.pallet}{Environment.NewLine}{exc}";
|
||||
Log.Error(logMsg);
|
||||
}
|
||||
}
|
||||
// formatto output
|
||||
inputComandoMapo answ = new inputComandoMapo();
|
||||
@@ -474,6 +462,28 @@ namespace MP.Data.Services
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elimina una riga in EventList se trovata
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <param name="dtEvento"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> EvListDelete(string idxMacchina, DateTime dtEvento)
|
||||
{
|
||||
bool fatto = false;
|
||||
try
|
||||
{
|
||||
// inserisco evento
|
||||
fatto = await dbTabController.EvListDelete(idxMacchina, dtEvento);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string logMsg = $"Eccezione in EvListDelete | macchina: {idxMacchina} | DataEv: {dtEvento}{Environment.NewLine}{exc}";
|
||||
Log.Error(logMsg);
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupero Righe (Actual) della scheda tecnica da GRUPPO + ODL
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user