Compare commits
No commits in common. "fff3c273d7becb7ccc1a9910376edc54c36489db" and "4bc8b1597ff8258278e9c3d5798b8214ac912948" have entirely different histories.
fff3c273d7
...
4bc8b1597f
@ -31,9 +31,6 @@ namespace ApiSoftway.Controllers
|
|||||||
private readonly IConfiguration? _configuration;
|
private readonly IConfiguration? _configuration;
|
||||||
private readonly GESA_GIRICONSEGNEDACREARE_DbContext _daCreare_context;
|
private readonly GESA_GIRICONSEGNEDACREARE_DbContext _daCreare_context;
|
||||||
private readonly GESA_CONSEGNE_M_DbContext _consegne_m_context;
|
private readonly GESA_CONSEGNE_M_DbContext _consegne_m_context;
|
||||||
private readonly GESA_PI_GIRI_SERIALI_DbContext _giriseriali_context;
|
|
||||||
private readonly GESA_GIRICONSEGNEDACREARE_DESTINAZIONI_DbContext _daCreareDest_context;
|
|
||||||
private readonly GESA_DESTINAZIONI_WEB_DbContext _destinazioni_web_context;
|
|
||||||
|
|
||||||
private DbSet<Giri>? _giri;
|
private DbSet<Giri>? _giri;
|
||||||
private DbSet<GiriConsegna>? _giriCons;
|
private DbSet<GiriConsegna>? _giriCons;
|
||||||
@ -45,12 +42,10 @@ namespace ApiSoftway.Controllers
|
|||||||
private DbSet<Automezzi>? _automezzi;
|
private DbSet<Automezzi>? _automezzi;
|
||||||
private DbSet<GiriConsegnaDaCreare>? _GiriDaCreare;
|
private DbSet<GiriConsegnaDaCreare>? _GiriDaCreare;
|
||||||
private DbSet<Consegna_m>? _testate;
|
private DbSet<Consegna_m>? _testate;
|
||||||
private DbSet<GiriConsegnaDaCreareDest>? _GiriDaCreareDest;
|
|
||||||
public GiriController(ILogger<LoginController> logger, IConfiguration? configuration, GESA_GIRI_DbContext giri_context, GESA_DESTINAZIONI_DbContext destinazioni_context
|
public GiriController(ILogger<LoginController> logger, IConfiguration? configuration, GESA_GIRI_DbContext giri_context, GESA_DESTINAZIONI_DbContext destinazioni_context
|
||||||
, GESA_CONSEGNE_DbContext consegne_context, GESA_GIRICONSEGNE_DbContext giricons_context, GESA_GIRICONSEGNEVISTA_DbContext consegnevista_context, GESA_SBR_ORD_DbContext sbrord_context
|
, GESA_CONSEGNE_DbContext consegne_context, GESA_GIRICONSEGNE_DbContext giricons_context, GESA_GIRICONSEGNEVISTA_DbContext consegnevista_context, GESA_SBR_ORD_DbContext sbrord_context
|
||||||
, GESA_PERSONALE_DbContext personale_context, GESA_AUTOMEZZI_DbContext automezzi_context, GESA_GIRICONSEGNEDACREARE_DbContext daCreare_context
|
, GESA_PERSONALE_DbContext personale_context, GESA_AUTOMEZZI_DbContext automezzi_context, GESA_GIRICONSEGNEDACREARE_DbContext daCreare_context
|
||||||
, GESA_CONSEGNE_M_DbContext consegne_m_context, GESA_PI_GIRI_SERIALI_DbContext giriseriali_context, GESA_GIRICONSEGNEDACREARE_DESTINAZIONI_DbContext daCreareDest_context
|
, GESA_CONSEGNE_M_DbContext consegne_m_context)
|
||||||
, GESA_DESTINAZIONI_WEB_DbContext destinazioni_web_context)
|
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_configuration = configuration;
|
_configuration = configuration;
|
||||||
@ -64,9 +59,6 @@ namespace ApiSoftway.Controllers
|
|||||||
_automezzi_context = automezzi_context;
|
_automezzi_context = automezzi_context;
|
||||||
_daCreare_context = daCreare_context;
|
_daCreare_context = daCreare_context;
|
||||||
_consegne_m_context = consegne_m_context;
|
_consegne_m_context = consegne_m_context;
|
||||||
_giriseriali_context = giriseriali_context;
|
|
||||||
_daCreareDest_context = daCreareDest_context;
|
|
||||||
_destinazioni_web_context = destinazioni_web_context;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("listaGiri")]
|
[HttpGet("listaGiri")]
|
||||||
@ -99,16 +91,6 @@ namespace ApiSoftway.Controllers
|
|||||||
return gc;
|
return gc;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("listaGiriDaCreareByData")]
|
|
||||||
public async Task<ActionResult<IEnumerable<GiriConsegnaDaCreare>>> listaGiriDaCreareByData(DateTime dt)
|
|
||||||
{
|
|
||||||
List<GiriConsegnaDaCreare> lst = new List<GiriConsegnaDaCreare>();
|
|
||||||
_GiriDaCreare = _daCreare_context.GiriDaCreare;
|
|
||||||
var gc = await _GiriDaCreare.Where(t=>t.DataGiro.Equals(dt)).OrderByDescending(t => t.DataGiro).ToListAsync();
|
|
||||||
|
|
||||||
return gc;
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet("listaAutisti")]
|
[HttpGet("listaAutisti")]
|
||||||
public async Task<ActionResult<IEnumerable<Personale>>> listaAutisti()
|
public async Task<ActionResult<IEnumerable<Personale>>> listaAutisti()
|
||||||
{
|
{
|
||||||
@ -219,48 +201,22 @@ namespace ApiSoftway.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
//step 3 aggiorno con il seriale le righe delle destinazioni
|
//step 3 aggiorno con il seriale le righe delle destinazioni
|
||||||
|
_destinazioni = _destinazioni_context.Destinazioni;
|
||||||
//_destinazioni = _destinazioni_context.Destinazioni;
|
var dest = await _destinazioni.Where(t => t.CodAutista != null && t.CodAutista.Equals(model.CodAutista)
|
||||||
//var dest = await _destinazioni.Where(t => t.CodAutista != null && t.CodAutista.Equals(model.CodAutista)
|
&& t.DataCarico != null && t.DataCarico == model.DataGiro
|
||||||
//&& t.DataCarico != null && t.DataCarico == model.DataGiro
|
&& t.serialeGiro == null
|
||||||
////&& t.serialeGiro == null
|
&& t.CodAutomezzo!=null && t.CodAutomezzo.Equals(model.CodMezzo)).OrderByDescending(t => t.DataCarico).ToListAsync();
|
||||||
//&& t.CodAutomezzo!=null && t.CodAutomezzo.Equals(model.CodMezzo)).OrderByDescending(t => t.DataCarico).ToListAsync();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_destinazioni = _daCreareDest_context.GiriDaCreare;
|
|
||||||
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)
|
foreach (Destinazioni d in dest)
|
||||||
{
|
{
|
||||||
//20241018: cambiato sistema inserisco in tabella di raccordo GESAPI_GIRI_SERIALI
|
|
||||||
GiriSeriali g =new GiriSeriali();
|
|
||||||
g.Brserial = d.Brserial;
|
|
||||||
g.Pisergir = newSer;
|
|
||||||
using (var transactionDest = _giriseriali_context.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
await _giriseriali_context.Cons.AddAsync(g);
|
|
||||||
await _giriseriali_context.SaveChangesAsync();
|
|
||||||
transactionDest.Commit();
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
Sbr_ord sbr_Ord = new Sbr_ord();
|
Sbr_ord sbr_Ord = new Sbr_ord();
|
||||||
sbr_Ord.Brserial = d.Brserial;
|
sbr_Ord.Brserial = d.Brserial;
|
||||||
sbr_Ord.Pisergir = newSer;
|
sbr_Ord.Pisergir = newSer;
|
||||||
//ATTENZIONE!! fa l'aggiornamento su tutti i campi dell'oggetto
|
|
||||||
|
|
||||||
using (var transactionDest = _sbrord_context.Database.BeginTransaction())
|
using (var transactionDest = _sbrord_context.Database.BeginTransaction())
|
||||||
{
|
{
|
||||||
//_sbrord_context.Entry(sbr_Ord).State = EntityState.Modified;
|
_sbrord_context.Entry(sbr_Ord).State = EntityState.Modified;
|
||||||
_sbrord_context.Entry(sbr_Ord).Property(x => x.Pisergir).IsModified = true;
|
|
||||||
|
|
||||||
await _sbrord_context.SaveChangesAsync();
|
await _sbrord_context.SaveChangesAsync();
|
||||||
transactionDest.Commit();
|
transactionDest.Commit();
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var giro = await _giriConsView.Where(t => t.SerialeGiro.Equals(newSer)).ToListAsync();
|
var giro = await _giriConsView.Where(t => t.SerialeGiro.Equals(newSer)).ToListAsync();
|
||||||
@ -477,7 +433,6 @@ namespace ApiSoftway.Controllers
|
|||||||
_destinazioni = _destinazioni_context.Destinazioni;
|
_destinazioni = _destinazioni_context.Destinazioni;
|
||||||
var r = await _destinazioni.Where(t => t.CodAutista != null && t.CodAutista.Equals(usr) && t.DataCarico != null && t.DataCarico == data
|
var r = await _destinazioni.Where(t => t.CodAutista != null && t.CodAutista.Equals(usr) && t.DataCarico != null && t.DataCarico == data
|
||||||
&& !string.IsNullOrEmpty(t.serialeGiro)
|
&& !string.IsNullOrEmpty(t.serialeGiro)
|
||||||
|
|
||||||
).OrderBy(t => t.serialeGiro).ToListAsync();
|
).OrderBy(t => t.serialeGiro).ToListAsync();
|
||||||
|
|
||||||
|
|
||||||
@ -644,176 +599,6 @@ namespace ApiSoftway.Controllers
|
|||||||
return lst;
|
return lst;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("listaDestinazioniByAutistaDataMezzoWeb")]
|
|
||||||
public async Task<ActionResult<IEnumerable<Destinazioni_out>>> listaDestinazioniByAutistaDataWeb(string autista, DateTime? dataGiro, string mezzo)
|
|
||||||
{
|
|
||||||
|
|
||||||
List<Destinazioni_out> lst = new List<Destinazioni_out>();
|
|
||||||
_destinazioni = _destinazioni_web_context.Destinazioni;
|
|
||||||
var r = await _destinazioni.Where(t => t.CodAutista != null && t.CodAutista.Equals(autista) && t.DataCarico != null && t.DataCarico == dataGiro && t.CodAutomezzo != null && t.CodAutomezzo.Equals(mezzo)).OrderByDescending(t => t.DataCarico).ThenBy(t => t.Seq).ToListAsync();
|
|
||||||
foreach (Destinazioni d in r)
|
|
||||||
{
|
|
||||||
Destinazioni_out o = new Destinazioni_out();
|
|
||||||
string _aut = !string.IsNullOrEmpty(d.Autista) ? d.Autista.Trim() : string.Empty;
|
|
||||||
o.Autista = _aut;
|
|
||||||
|
|
||||||
string _autCod = !string.IsNullOrEmpty(d.CodAutista) ? d.CodAutista.Trim() : string.Empty;
|
|
||||||
o.CodAutista = _autCod;
|
|
||||||
|
|
||||||
string _automezzo = !string.IsNullOrEmpty(d.DescAutomezzo) ? d.DescAutomezzo.Trim() : string.Empty;
|
|
||||||
o.DescAutomezzo = _automezzo;
|
|
||||||
|
|
||||||
string _automezzoCod = !string.IsNullOrEmpty(d.CodAutomezzo) ? d.CodAutomezzo.Trim() : string.Empty;
|
|
||||||
o.CodAutomezzo = d.CodAutomezzo;
|
|
||||||
|
|
||||||
o.DataCarico = d.DataCarico;
|
|
||||||
o.Brserial = d.Brserial;
|
|
||||||
o.Brmerce = d.Brmerce;
|
|
||||||
o.Brnote = d.Brnote;
|
|
||||||
o.Cproword = d.Cproword;
|
|
||||||
o.Cprownum = d.Cprownum;
|
|
||||||
|
|
||||||
string _sedeInd = !string.IsNullOrEmpty(d.IndirizzoSede) ? d.IndirizzoSede.Trim() : string.Empty;
|
|
||||||
o.IndirizzoSede = _sedeInd;
|
|
||||||
|
|
||||||
string _sede = !string.IsNullOrEmpty(d.Sede) ? d.Sede.Trim() : string.Empty;
|
|
||||||
o.Sede = _sede;
|
|
||||||
o.CodCommittente = d.CodCommittente;
|
|
||||||
|
|
||||||
string _committente = !string.IsNullOrEmpty(d.Committente) ? d.Committente.Trim() : string.Empty;
|
|
||||||
o.Committente = _committente;
|
|
||||||
|
|
||||||
o.CodSede = d.CodSede;
|
|
||||||
o.ItemList = formattaDestinazione(d);
|
|
||||||
o.ImportoDaRitirare = d.ImportoDaRitirare;
|
|
||||||
o.serialeGiro = d.serialeGiro;
|
|
||||||
o.Casse = d.Casse;
|
|
||||||
o.Trasf = d.Trasf;
|
|
||||||
o.Colli = d.Colli;
|
|
||||||
o.num_cons = d.num_cons;
|
|
||||||
o.Uova = d.Uova;
|
|
||||||
o.Cist = d.Cist;
|
|
||||||
o.Note = d.Note;
|
|
||||||
o.Seq = d.Seq;
|
|
||||||
o.Prog = d.Prog;
|
|
||||||
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(d.consFattaSerial))
|
|
||||||
{
|
|
||||||
ConsegnaFatta cf = new ConsegnaFatta();
|
|
||||||
cf.consFattaSerial = d.consFattaSerial;
|
|
||||||
cf.consFattaRow = d.consFattaRow;
|
|
||||||
cf.consFattaAut = d.consFattaAut;
|
|
||||||
cf.consFattaBanSca = d.consFattaBanSca;
|
|
||||||
cf.consFattaBanCar = d.consFattaBanCar;
|
|
||||||
string nota = !string.IsNullOrEmpty(d.consFattaNotBan) ? d.consFattaNotBan.Trim() : string.Empty;
|
|
||||||
cf.consFattaNotBan = nota;
|
|
||||||
cf.consFattaImpor = d.consFattaImpor;
|
|
||||||
cf.consFattaMezzo = d.consFattaMezzo;
|
|
||||||
string nota2 = !string.IsNullOrEmpty(d.consFattaNotImp) ? d.consFattaNotImp.Trim() : string.Empty;
|
|
||||||
cf.consFattaNotImp = nota2;
|
|
||||||
cf.consFattaFlagCons = d.consFattaFlagCons;
|
|
||||||
cf.consFattaDataOra = d.consFattaDataOra;
|
|
||||||
|
|
||||||
o.ConsFatta = cf;
|
|
||||||
}
|
|
||||||
|
|
||||||
lst.Add(o);
|
|
||||||
}
|
|
||||||
return lst;
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet("listaDestinazioniByAutistaDataMezzoNonValidate")]
|
|
||||||
public async Task<ActionResult<IEnumerable<Destinazioni_out>>> listaDestinazioniByAutistaDataMezzoNonValidate(string autista, DateTime? dataGiro, string mezzo)
|
|
||||||
{
|
|
||||||
|
|
||||||
List<Destinazioni_out> lst = new List<Destinazioni_out>();
|
|
||||||
//_destinazioni = _destinazioni_context.Destinazioni;
|
|
||||||
//var r = await _destinazioni.Where(t => t.CodAutista != null && t.CodAutista.Equals(autista) && t.DataCarico != null && t.DataCarico == dataGiro && t.CodAutomezzo != null && t.CodAutomezzo.Equals(mezzo)).OrderByDescending(t => t.DataCarico).ThenBy(t => t.Seq).ToListAsync();
|
|
||||||
|
|
||||||
_destinazioni = _daCreareDest_context.GiriDaCreare;
|
|
||||||
var dest = await _destinazioni.Where(t => t.CodAutista != null && t.CodAutista.Equals(autista)
|
|
||||||
&& t.DataCarico != null && t.DataCarico == dataGiro
|
|
||||||
//&& t.serialeGiro == null
|
|
||||||
&& t.CodAutomezzo != null && t.CodAutomezzo.Equals(mezzo)).OrderByDescending(t => t.DataCarico).ToListAsync();
|
|
||||||
|
|
||||||
|
|
||||||
foreach (Destinazioni d in dest)
|
|
||||||
{
|
|
||||||
Destinazioni_out o = new Destinazioni_out();
|
|
||||||
string _aut = !string.IsNullOrEmpty(d.Autista) ? d.Autista.Trim() : string.Empty;
|
|
||||||
o.Autista = _aut;
|
|
||||||
|
|
||||||
string _autCod = !string.IsNullOrEmpty(d.CodAutista) ? d.CodAutista.Trim() : string.Empty;
|
|
||||||
o.CodAutista = _autCod;
|
|
||||||
|
|
||||||
string _automezzo = !string.IsNullOrEmpty(d.DescAutomezzo) ? d.DescAutomezzo.Trim() : string.Empty;
|
|
||||||
o.DescAutomezzo = _automezzo;
|
|
||||||
|
|
||||||
string _automezzoCod = !string.IsNullOrEmpty(d.CodAutomezzo) ? d.CodAutomezzo.Trim() : string.Empty;
|
|
||||||
o.CodAutomezzo = _automezzoCod;
|
|
||||||
|
|
||||||
o.DataCarico = d.DataCarico;
|
|
||||||
o.Brserial = d.Brserial;
|
|
||||||
|
|
||||||
//step 1: leggo da sbr_ord con seriale
|
|
||||||
|
|
||||||
|
|
||||||
o.Brmerce = d.Brmerce;
|
|
||||||
o.Brnote = d.Brnote;
|
|
||||||
o.Cproword = d.Cproword;
|
|
||||||
o.Cprownum = d.Cprownum;
|
|
||||||
|
|
||||||
string _sedeInd = !string.IsNullOrEmpty(d.IndirizzoSede) ? d.IndirizzoSede.Trim() : string.Empty;
|
|
||||||
o.IndirizzoSede = _sedeInd;
|
|
||||||
|
|
||||||
string _sede = !string.IsNullOrEmpty(d.Sede) ? d.Sede.Trim() : string.Empty;
|
|
||||||
o.Sede = _sede;
|
|
||||||
o.CodCommittente = d.CodCommittente;
|
|
||||||
|
|
||||||
string _committente = !string.IsNullOrEmpty(d.Committente) ? d.Committente.Trim() : string.Empty;
|
|
||||||
o.Committente = _committente;
|
|
||||||
|
|
||||||
o.CodSede = d.CodSede;
|
|
||||||
o.ItemList = formattaDestinazione(d);
|
|
||||||
o.ImportoDaRitirare = d.ImportoDaRitirare;
|
|
||||||
o.serialeGiro = d.serialeGiro;
|
|
||||||
o.Casse = d.Casse;
|
|
||||||
o.Trasf = d.Trasf;
|
|
||||||
o.Colli = d.Colli;
|
|
||||||
o.num_cons = d.num_cons;
|
|
||||||
o.Uova = d.Uova;
|
|
||||||
o.Cist = d.Cist;
|
|
||||||
o.Note = d.Note;
|
|
||||||
o.Seq = d.Seq;
|
|
||||||
o.Prog = d.Prog;
|
|
||||||
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(d.consFattaSerial))
|
|
||||||
{
|
|
||||||
ConsegnaFatta cf = new ConsegnaFatta();
|
|
||||||
cf.consFattaSerial = d.consFattaSerial;
|
|
||||||
cf.consFattaRow = d.consFattaRow;
|
|
||||||
cf.consFattaAut = d.consFattaAut;
|
|
||||||
cf.consFattaBanSca = d.consFattaBanSca;
|
|
||||||
cf.consFattaBanCar = d.consFattaBanCar;
|
|
||||||
string nota = !string.IsNullOrEmpty(d.consFattaNotBan) ? d.consFattaNotBan.Trim() : string.Empty;
|
|
||||||
cf.consFattaNotBan = nota;
|
|
||||||
cf.consFattaImpor = d.consFattaImpor;
|
|
||||||
cf.consFattaMezzo = d.consFattaMezzo;
|
|
||||||
string nota2 = !string.IsNullOrEmpty(d.consFattaNotImp) ? d.consFattaNotImp.Trim() : string.Empty;
|
|
||||||
cf.consFattaNotImp = nota2;
|
|
||||||
cf.consFattaFlagCons = d.consFattaFlagCons;
|
|
||||||
cf.consFattaDataOra = d.consFattaDataOra;
|
|
||||||
|
|
||||||
o.ConsFatta = cf;
|
|
||||||
}
|
|
||||||
|
|
||||||
lst.Add(o);
|
|
||||||
}
|
|
||||||
return lst;
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet("listaDestinazioneBySerial")]
|
[HttpGet("listaDestinazioneBySerial")]
|
||||||
public async Task<ActionResult<Destinazioni_out>> listaDestinazioneBySerial(string seriale)
|
public async Task<ActionResult<Destinazioni_out>> listaDestinazioneBySerial(string seriale)
|
||||||
{
|
{
|
||||||
@ -910,17 +695,32 @@ namespace ApiSoftway.Controllers
|
|||||||
DateTime dateTime = DateTime.Now;
|
DateTime dateTime = DateTime.Now;
|
||||||
ConsegnaTable t = fillConsegna(model, token, dateTime);
|
ConsegnaTable t = fillConsegna(model, token, dateTime);
|
||||||
|
|
||||||
//Step 1: il seriale è quello della GESAPI_GIRI_SERIALI che ho scritto in validazione
|
/*
|
||||||
// lo leggo dalle destinazioni filtrando per il seriale della destinazione. contemporaneamente mi ricavo anche gli altri valori
|
//Step 1: mi calcolo il nuovo seriale
|
||||||
//che devo scrivere successivamente
|
|
||||||
_destinazioni = _destinazioni_context.Destinazioni;
|
|
||||||
var ti = await _destinazioni.Where(t => t.Brserial.Equals(model.Serial)).FirstAsync();
|
|
||||||
|
|
||||||
string _committente = ti.CodCommittente;
|
_consegne = _consegne_context.Cons;
|
||||||
string _cliFatturazione = ti.CliFatt;
|
var ser = await _consegne.Take(1).OrderByDescending(t => t.Pisergir).ToListAsync();
|
||||||
string _codSede = ti.CodSede;
|
string ultSer = "0";
|
||||||
string _pisergir = ti.serialeGiro;
|
if (ser != null && ser.Count > 0)
|
||||||
int _seque = ti.Seq.Value;
|
{
|
||||||
|
ultSer = ser.First().Pisergir;
|
||||||
|
}
|
||||||
|
|
||||||
|
string newSer = calcolaNuovoSeriale(ultSer);
|
||||||
|
t.Pisergir = newSer;
|
||||||
|
*/
|
||||||
|
|
||||||
|
//Step 1: il seriale è quello della PIGIRCON che ho scritto nelle righe di SBR_ORD
|
||||||
|
// lo leggo da li passando il seriale della destinazione. contemporaneamente mi ricavo anche gli altri valori
|
||||||
|
//che devo scrivere successivamente
|
||||||
|
|
||||||
|
_sbrord = _sbrord_context.Cons;
|
||||||
|
var ti = await _sbrord.Where(t => t.Brserial.Equals(model.Serial)).FirstAsync();
|
||||||
|
string _committente = ti.Brcodcom;
|
||||||
|
string _cliFatturazione = ti.Brclifat;
|
||||||
|
string _codSede = ti.Brcodsed;
|
||||||
|
string _pisergir = ti.Pisergir;
|
||||||
|
int _seque = ti.Brnumseq.Value;
|
||||||
t.Cca = _committente;
|
t.Cca = _committente;
|
||||||
t.Ccda=_cliFatturazione;
|
t.Ccda=_cliFatturazione;
|
||||||
t.Cprownum = _seque;
|
t.Cprownum = _seque;
|
||||||
@ -990,17 +790,29 @@ namespace ApiSoftway.Controllers
|
|||||||
DateTime dateTime = DateTime.Now;
|
DateTime dateTime = DateTime.Now;
|
||||||
ConsegnaTable t = fillConsegnaNonEffettuata(model, token);
|
ConsegnaTable t = fillConsegnaNonEffettuata(model, token);
|
||||||
|
|
||||||
//Step 1: il seriale è quello della GESAPI_GIRI_SERIALI che ho scritto in validazione
|
////Step 1: mi calcolo il nuovo seriale
|
||||||
// lo leggo dalle destinazioni filtrando per il seriale della destinazione. contemporaneamente mi ricavo anche gli altri valori
|
//_consegne = _consegne_context.Cons;
|
||||||
//che devo scrivere successivamente
|
//var ser = await _consegne.Take(1).OrderByDescending(t => t.Pisergir).ToListAsync();
|
||||||
_destinazioni = _destinazioni_context.Destinazioni;
|
//string ultSer = "0";
|
||||||
var ti = await _destinazioni.Where(t => t.Brserial.Equals(model.Serial)).FirstAsync();
|
//if (ser != null && ser.Count > 0)
|
||||||
|
//{
|
||||||
|
// ultSer = ser.First().Pisergir;
|
||||||
|
//}
|
||||||
|
|
||||||
string _committente = ti.CodCommittente;
|
//string newSer = calcolaNuovoSeriale(ultSer);
|
||||||
string _cliFatturazione = ti.CliFatt;
|
//t.Pisergir = newSer;
|
||||||
string _codSede = ti.CodSede;
|
|
||||||
string _pisergir = ti.serialeGiro;
|
//Step 1: il seriale è quello della PIGIRCON che ho scritto nelle righe di SBR_ORD
|
||||||
int _seque = ti.Seq.Value;
|
// lo leggo da li passando il seriale della destinazione. contemporaneamente mi ricavo anche gli altri valori
|
||||||
|
//che devo scrivere successivamente
|
||||||
|
|
||||||
|
_sbrord = _sbrord_context.Cons;
|
||||||
|
var ti = await _sbrord.Where(t => t.Brserial.Equals(model.Serial)).FirstAsync();
|
||||||
|
string _committente = ti.Brcodcom;
|
||||||
|
string _cliFatturazione = ti.Brclifat;
|
||||||
|
string _codSede = ti.Brcodsed;
|
||||||
|
string _pisergir = ti.Pisergir;
|
||||||
|
int _seque = ti.Brnumseq.Value;
|
||||||
t.Cca = _committente;
|
t.Cca = _committente;
|
||||||
t.Ccda = _cliFatturazione;
|
t.Ccda = _cliFatturazione;
|
||||||
t.Cprownum = _seque;
|
t.Cprownum = _seque;
|
||||||
|
|||||||
@ -33,7 +33,7 @@ namespace ApiSoftway.Controllers
|
|||||||
|
|
||||||
//step 0: se esiste un record con quel seriale, prima cancello e poi inserisco di nuovo
|
//step 0: se esiste un record con quel seriale, prima cancello e poi inserisco di nuovo
|
||||||
_modgir = _modgiri_context.Mod;
|
_modgir = _modgiri_context.Mod;
|
||||||
List<Modgir> lst = _modgir.Where(t => t.Piserial.Equals(model.Piserial) && !t.Pitiprec.Equals("A")).ToList();
|
List<Modgir> lst = _modgir.Where(t => t.Piserial.Equals(model.Piserial)).ToList();
|
||||||
foreach (Modgir item in lst)
|
foreach (Modgir item in lst)
|
||||||
{
|
{
|
||||||
using (var transaction = _modgiri_context.Database.BeginTransaction())
|
using (var transaction = _modgiri_context.Database.BeginTransaction())
|
||||||
@ -67,14 +67,6 @@ namespace ApiSoftway.Controllers
|
|||||||
gc.Piautist = model.Piautist;
|
gc.Piautist = model.Piautist;
|
||||||
gc.Pitiprec = model.Pitiprec;
|
gc.Pitiprec = model.Pitiprec;
|
||||||
gc.Pisergir = model.Pisergir;
|
gc.Pisergir = model.Pisergir;
|
||||||
gc.Picasse = model.Picasse;
|
|
||||||
gc.Pitrasf = model.Pitrasf;
|
|
||||||
gc.Picolli = model.Picolli;
|
|
||||||
gc.Pinumcons = model.Pinumcons;
|
|
||||||
gc.Piuova = model.Piuova;
|
|
||||||
gc.Picist = model.Picist;
|
|
||||||
gc.Piseq = model.Piseq;
|
|
||||||
gc.Pinote = model.Pinote;
|
|
||||||
|
|
||||||
using (var transactionGiri = _modgiri_context.Database.BeginTransaction())
|
using (var transactionGiri = _modgiri_context.Database.BeginTransaction())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -54,9 +54,5 @@ namespace ApiSoftway.Models
|
|||||||
|
|
||||||
//progressivo- chiave tabella pimodgir
|
//progressivo- chiave tabella pimodgir
|
||||||
public string? Prog { get; set; }
|
public string? Prog { get; set; }
|
||||||
public string? CliFatt { get; set; }
|
|
||||||
public int? BancaliIniziali { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,17 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace ApiSoftway.Models.Gesa_DbContext
|
|
||||||
{
|
|
||||||
public class GESA_DESTINAZIONI_WEB_DbContext : DbContext
|
|
||||||
{
|
|
||||||
public DbSet<Destinazioni>? Destinazioni { get; set; }
|
|
||||||
public GESA_DESTINAZIONI_WEB_DbContext(DbContextOptions<GESA_DESTINAZIONI_WEB_DbContext> options) : base(options)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
modelBuilder.Entity<Destinazioni>().ToView("API_DESTINAZIONI_WEB");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,17 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace ApiSoftway.Models.Gesa_DbContext
|
|
||||||
{
|
|
||||||
public class GESA_GIRICONSEGNEDACREARE_DESTINAZIONI_DbContext:DbContext
|
|
||||||
{
|
|
||||||
public DbSet<Destinazioni>? GiriDaCreare { get; set; }
|
|
||||||
public GESA_GIRICONSEGNEDACREARE_DESTINAZIONI_DbContext(DbContextOptions<GESA_GIRICONSEGNEDACREARE_DESTINAZIONI_DbContext> options) : base(options)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
modelBuilder.Entity<Destinazioni>().ToView("API_GIRICONSEGNA_DA_CREARE_DESTINAZIONI");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace ApiSoftway.Models.Gesa_DbContext
|
|
||||||
{
|
|
||||||
public class GESA_PI_GIRI_SERIALI_DbContext:DbContext
|
|
||||||
{
|
|
||||||
public DbSet<GiriSeriali>? Cons { get; set; }
|
|
||||||
|
|
||||||
/// <summary></summary>
|
|
||||||
public GESA_PI_GIRI_SERIALI_DbContext(DbContextOptions<GESA_PI_GIRI_SERIALI_DbContext> options) : base(options)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary></summary>
|
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
modelBuilder.Entity<GiriSeriali>().ToTable("GESAPI_GIRI_SERIALI");
|
|
||||||
modelBuilder.Entity<GiriSeriali>().HasKey(table => new {
|
|
||||||
table.Brserial,table.Pisergir
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -10,6 +10,5 @@ namespace ApiSoftway.Models
|
|||||||
public string? Autista { get; set; }
|
public string? Autista { get; set; }
|
||||||
public string? Automezzo { get; set; }
|
public string? Automezzo { get; set; }
|
||||||
public DateTime? DataGiro { get; set; }
|
public DateTime? DataGiro { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,15 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace ApiSoftway.Models
|
|
||||||
{
|
|
||||||
[Keyless]
|
|
||||||
public class GiriConsegnaDaCreareDest
|
|
||||||
{
|
|
||||||
public string? CodMezzo { get; set; }
|
|
||||||
public string? CodAutista { get; set; }
|
|
||||||
public string? Autista { get; set; }
|
|
||||||
public string? Automezzo { get; set; }
|
|
||||||
public DateTime? DataGiro { get; set; }
|
|
||||||
public string? Seriale { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
|
|
||||||
namespace ApiSoftway.Models
|
|
||||||
{
|
|
||||||
public class GiriSeriali
|
|
||||||
{
|
|
||||||
[Key]
|
|
||||||
public string? Brserial { get; set; }
|
|
||||||
|
|
||||||
[Key]
|
|
||||||
public string? Pisergir { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -6,7 +6,6 @@ namespace ApiSoftway.Models
|
|||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
public string? Piprogre { get; set; }
|
public string? Piprogre { get; set; }
|
||||||
|
|
||||||
public string? Piserial { get; set; }
|
public string? Piserial { get; set; }
|
||||||
public DateTime? Pidata { get; set; }
|
public DateTime? Pidata { get; set; }
|
||||||
public string? Picommit { get; set; }
|
public string? Picommit { get; set; }
|
||||||
@ -16,13 +15,5 @@ namespace ApiSoftway.Models
|
|||||||
public string? Pitiprec { get; set; }
|
public string? Pitiprec { get; set; }
|
||||||
public string? Pirigele { get; set; }
|
public string? Pirigele { get; set; }
|
||||||
public string ? Pisergir { get; set; }
|
public string ? Pisergir { get; set; }
|
||||||
public decimal? Picasse { get; set; }
|
|
||||||
public decimal? Pitrasf { get; set; }
|
|
||||||
public decimal? Picolli { get; set; }
|
|
||||||
public int? Pinumcons { get; set; }
|
|
||||||
public decimal? Piuova { get; set; }
|
|
||||||
public decimal? Picist { get; set; }
|
|
||||||
public int? Piseq { get; set; }
|
|
||||||
public string? Pinote { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,16 +15,6 @@ namespace ApiSoftway.Models
|
|||||||
public string? Pitiprec { get; set; }
|
public string? Pitiprec { get; set; }
|
||||||
public string? Pirigele { get; set; }
|
public string? Pirigele { get; set; }
|
||||||
public string? Pisergir { get; set; }
|
public string? Pisergir { get; set; }
|
||||||
public decimal? Picasse { get; set; }
|
|
||||||
public decimal? Pitrasf { get; set; }
|
|
||||||
public decimal? Picolli { get; set; }
|
|
||||||
public int? Pinumcons { get; set; }
|
|
||||||
public decimal? Piuova { get; set; }
|
|
||||||
public decimal? Picist { get; set; }
|
|
||||||
public int? Piseq { get; set; }
|
|
||||||
public string? Pinote { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>errore titolo</summary>
|
/// <summary>errore titolo</summary>
|
||||||
public string? err_title { get; set; }
|
public string? err_title { get; set; }
|
||||||
|
|||||||
34
Program.cs
34
Program.cs
@ -2,7 +2,6 @@ using ApiSoftway.Models.Gesa_DbContext;
|
|||||||
using ApiSoftway.Models;
|
using ApiSoftway.Models;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.OpenApi.Models;
|
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
@ -55,40 +54,13 @@ builder.Services.AddDbContext<GESA_CONSEGNE_M_DbContext>(options => options.UseS
|
|||||||
builder.Services.AddDbContext<GESA_SEDECONSEGNA_DbContext>(options => options.UseSqlServer(builder.Configuration.GetConnectionString("GESA")
|
builder.Services.AddDbContext<GESA_SEDECONSEGNA_DbContext>(options => options.UseSqlServer(builder.Configuration.GetConnectionString("GESA")
|
||||||
, options => { options.CommandTimeout(commandTimeoutInSeconds); }
|
, options => { options.CommandTimeout(commandTimeoutInSeconds); }
|
||||||
));
|
));
|
||||||
builder.Services.AddDbContext<GESA_PI_GIRI_SERIALI_DbContext>(options => options.UseSqlServer(builder.Configuration.GetConnectionString("GESA")
|
|
||||||
, options => { options.CommandTimeout(commandTimeoutInSeconds); }
|
|
||||||
));
|
|
||||||
builder.Services.AddDbContext<GESA_GIRICONSEGNEDACREARE_DESTINAZIONI_DbContext>(options => options.UseSqlServer(builder.Configuration.GetConnectionString("GESA")
|
|
||||||
, options => { options.CommandTimeout(commandTimeoutInSeconds); }
|
|
||||||
));
|
|
||||||
builder.Services.AddDbContext<GESA_DESTINAZIONI_WEB_DbContext>(options => options.UseSqlServer(builder.Configuration.GetConnectionString("GESA")
|
|
||||||
, options => { options.CommandTimeout(commandTimeoutInSeconds); }
|
|
||||||
));
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||||
builder.Services.AddEndpointsApiExplorer();
|
builder.Services.AddEndpointsApiExplorer();
|
||||||
builder.Services.AddSwaggerGen(gen =>
|
builder.Services.AddSwaggerGen();
|
||||||
{
|
|
||||||
|
|
||||||
gen.ResolveConflictingActions(apiDescription => apiDescription.First());
|
|
||||||
//gen.SwaggerDoc("v1", new OpenApiInfo { Title = "POLO API WS2016", Version = "v3.3" });
|
|
||||||
DateTime oggi = DateTime.Now;
|
|
||||||
string dt = oggi.ToString();
|
|
||||||
gen.SwaggerDoc("v1", new OpenApiInfo { Title = "GESA API - v.app 1.1", Version = dt });
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
builder.Services.AddLogging(opt =>
|
|
||||||
{
|
|
||||||
opt.AddConsole(c =>
|
|
||||||
{
|
|
||||||
c.TimestampFormat = "[yyyy-MM-dd HH:mm:ss] ";
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
@ -99,8 +71,8 @@ if (app.Environment.IsDevelopment() || app.Environment.IsProduction())
|
|||||||
app.UseSwaggerUI();
|
app.UseSwaggerUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
//app.UseHttpsRedirection();
|
app.UseHttpsRedirection();
|
||||||
app.UseRouting();
|
|
||||||
app.UseAuthorization();
|
app.UseAuthorization();
|
||||||
|
|
||||||
app.MapControllers();
|
app.MapControllers();
|
||||||
|
|||||||
@ -8,9 +8,9 @@
|
|||||||
"AllowedHosts": "*",
|
"AllowedHosts": "*",
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
|
|
||||||
"GESA": "Data Source=windowstest.polo;Initial Catalog=AHRGESA;User Id=sa; Password=p0l01nf.;Integrated Security=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
|
"GESA": "Data Source=10.0.0.10;Initial Catalog=AHRGESA;User Id=sa; Password=p0l01nf.;Integrated Security=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
|
||||||
//"GESA": "Data Source=10.0.0.10;Initial Catalog=AHR80_GESA;User Id=sa; Password=p0l01nf.;Integrated Security=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
|
//"GESA": "Data Source=10.0.0.10;Initial Catalog=AHR80_GESA;User Id=sa; Password=p0l01nf.;Integrated Security=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
|
||||||
"ApiStr": "Data Source=windowstest.polo;Initial Catalog=API_POLO;User Id=sa; Password=p0l01nf.;Integrated Security=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False"
|
"ApiStr": "Data Source=10.0.0.10;Initial Catalog=API_POLO;User Id=sa; Password=p0l01nf.;Integrated Security=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False"
|
||||||
},
|
},
|
||||||
"JWT": {
|
"JWT": {
|
||||||
"ValidAudience": "http://localhost:4200",
|
"ValidAudience": "http://localhost:4200",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user