gestione calendario
This commit is contained in:
parent
1da535c397
commit
c22e2ef0e3
@ -329,7 +329,12 @@ namespace ApiSoftway.Controllers
|
|||||||
d.BRDATINS = newData != null ? newData.Value.AddDays(-1) : DateTime.Now;
|
d.BRDATINS = newData != null ? newData.Value.AddDays(-1) : DateTime.Now;
|
||||||
d.BRDATVAR = newData != null ? newData.Value.AddDays(-1) : DateTime.Now;
|
d.BRDATVAR = newData != null ? newData.Value.AddDays(-1) : DateTime.Now;
|
||||||
d.BRDATSCA = newData;
|
d.BRDATSCA = newData;
|
||||||
d.Brnote = "*****"+newData.ToString() + d.Brnote;
|
string nota= "*****" + newData.ToString() + d.Brnote;
|
||||||
|
if(nota.Length>50)
|
||||||
|
{
|
||||||
|
nota = nota.Substring(0, 50);
|
||||||
|
}
|
||||||
|
d.Brnote = nota;
|
||||||
|
|
||||||
using (var transactionDest = _sbrordTable_context.Database.BeginTransaction())
|
using (var transactionDest = _sbrordTable_context.Database.BeginTransaction())
|
||||||
{
|
{
|
||||||
@ -552,39 +557,52 @@ namespace ApiSoftway.Controllers
|
|||||||
string usr = getClaimValueByToken(token, "codice");
|
string usr = getClaimValueByToken(token, "codice");
|
||||||
bool btnChiudiVisible = true;
|
bool btnChiudiVisible = true;
|
||||||
bool btnNonChiudiVisible = true;
|
bool btnNonChiudiVisible = true;
|
||||||
|
List<Destinazioni> lstDest=new List<Destinazioni>();
|
||||||
|
List<Destinazioni_out> lst = new List<Destinazioni_out>();
|
||||||
|
|
||||||
if (dataGiro == null)
|
if (dataGiro == null)
|
||||||
{
|
{
|
||||||
//step 1: ricavo la data a partire dal login
|
|
||||||
//_giri = _giri_context.Giri;
|
|
||||||
//var g = await _giri.Where(t => t.Brautist != null && t.Brautist.Equals(usr)).OrderByDescending(t => t.Brdatcar).Take(1).ToListAsync();
|
|
||||||
//data = g.First().Brdatcar;
|
|
||||||
|
|
||||||
data = DateTime.Today;
|
data = DateTime.Today;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
data= dataGiro;
|
data= dataGiro;
|
||||||
if(data!=DateTime.Today)
|
|
||||||
{
|
|
||||||
btnChiudiVisible = false;
|
|
||||||
btnNonChiudiVisible = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Destinazioni_out> lst = new List<Destinazioni_out>();
|
if (data != DateTime.Today)
|
||||||
_destinazioni = _destinazioni_context.Destinazioni;
|
{
|
||||||
var r = await _destinazioni.Where(t => t.CodAutista != null && t.CodAutista.Equals(usr) && t.DataCarico != null && t.DataCarico == data
|
//Sto visualizzando le destinazioni FUTURE che non posso consegnare
|
||||||
&& !string.IsNullOrEmpty(t.serialeGiro)
|
//la data è diversa dalla data odierna: disabilito i bottoni e cerco le destinazioni tra quelle che che NON sono state validate
|
||||||
|
//e che quindi NON hanno caricato i bancali (serialeGiro nullo)
|
||||||
|
btnChiudiVisible = false;
|
||||||
|
btnNonChiudiVisible = false;
|
||||||
|
|
||||||
).OrderBy(t => t.serialeGiro).ToListAsync();
|
_destinazioni = _daCreareDest_context.GiriDaCreare;
|
||||||
|
lstDest = await _destinazioni.Where(t => t.CodAutista != null && t.CodAutista.Equals(usr)
|
||||||
|
&& t.DataCarico != null && t.DataCarico == dataGiro).OrderByDescending(t => t.DataCarico).ToListAsync();
|
||||||
|
|
||||||
|
string serFake = DateTime.Now.ToString("yyyyMMddHHmmss");
|
||||||
|
//devo valorizzare un seriale giro fake per rispettare l'ordinamento/filtro che faccio sotto
|
||||||
|
foreach (Destinazioni d in lstDest)
|
||||||
|
{
|
||||||
|
|
||||||
|
d.serialeGiro = serFake;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Sto visualizzando le destinazioni di OGGI che devo lavorare
|
||||||
|
// sono nella data odierna: devo far vedere SOLO le destinazioni validate con i bancali caricati (serialeGiro NON nullo)
|
||||||
|
_destinazioni = _destinazioni_context.Destinazioni;
|
||||||
|
lstDest = await _destinazioni.Where(t => t.CodAutista != null && t.CodAutista.Equals(usr) && t.DataCarico != null && t.DataCarico == data
|
||||||
|
&& !string.IsNullOrEmpty(t.serialeGiro)).OrderBy(t => t.serialeGiro).ToListAsync();
|
||||||
|
}
|
||||||
|
|
||||||
//2024-07-29: se un autista ha due o più giri da fare nello stesso giorno li devo separare. li ho ordinati per seriale giro e gli do quelli del primo
|
//2024-07-29: se un autista ha due o più giri da fare nello stesso giorno li devo separare. li ho ordinati per seriale giro e gli do quelli del primo
|
||||||
// giro disponibile che non sia chiuso (PIDATCHI di GESAPIGIRCON deve essere nulla)
|
// giro disponibile che non sia chiuso (PIDATCHI di GESAPIGIRCON deve essere nulla)
|
||||||
int giro = 0;
|
int giro = 0;
|
||||||
string seriale_attuale = string.Empty;
|
string seriale_attuale = string.Empty;
|
||||||
foreach (Destinazioni d in r)
|
foreach (Destinazioni d in lstDest)
|
||||||
{
|
{
|
||||||
if(giro==0)
|
if(giro==0)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user