From a62394bcb7dd54d68804710c3c0ad228e6359b51 Mon Sep 17 00:00:00 2001 From: Marco Audiffredi Date: Tue, 23 Jul 2024 12:07:50 +0200 Subject: [PATCH] aa --- Controllers/GiriController.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Controllers/GiriController.cs b/Controllers/GiriController.cs index e3ccf19..191bc50 100644 --- a/Controllers/GiriController.cs +++ b/Controllers/GiriController.cs @@ -172,7 +172,12 @@ namespace ApiSoftway.Controllers //step 1 : calcolo il nuovo seriale _giriConsView = _consegnevista_context.GiriView; var ser = await _giriConsView.Take(1).OrderByDescending(t => t.SerialeGiro).ToListAsync(); - string ultSer = ser.First().SerialeGiro; + string ultSer = "0"; + if (ser!=null && ser.Count>0) + { + ultSer = ser.First().SerialeGiro; + } + string newSer = calcolaNuovoSeriale(ultSer); //step 2 : inserisco in PIGIRCON @@ -192,7 +197,10 @@ namespace ApiSoftway.Controllers //step 3 aggiorno con il seriale le righe delle destinazioni _destinazioni = _destinazioni_context.Destinazioni; - var dest = await _destinazioni.Where(t => t.CodAutista != null && t.CodAutista.Equals(model.CodAutista) && t.DataCarico != null && t.DataCarico == model.DataGiro && t.serialeGiro == null).OrderByDescending(t => t.DataCarico).ToListAsync(); + var dest = await _destinazioni.Where(t => t.CodAutista != null && t.CodAutista.Equals(model.CodAutista) + && t.DataCarico != null && t.DataCarico == model.DataGiro + && t.serialeGiro == null + && t.CodAutomezzo!=null && t.CodAutomezzo.Equals(model.CodMezzo)).OrderByDescending(t => t.DataCarico).ToListAsync(); foreach (Destinazioni d in dest) { Sbr_ord sbr_Ord = new Sbr_ord(); @@ -418,7 +426,9 @@ namespace ApiSoftway.Controllers List lst = new List(); _destinazioni = _destinazioni_context.Destinazioni; - var r = await _destinazioni.Where(t => t.CodAutista != null && t.CodAutista.Equals(usr) && t.DataCarico != null && t.DataCarico == data).OrderByDescending(t => t.DataCarico).ToListAsync(); + var r = await _destinazioni.Where(t => t.CodAutista != null && t.CodAutista.Equals(usr) && t.DataCarico != null && t.DataCarico == data + //&& !string.IsNullOrEmpty(t.serialeGiro) + ).OrderByDescending(t => t.DataCarico).ToListAsync(); foreach (Destinazioni d in r) { Destinazioni_out o = new Destinazioni_out();