giri da creare
This commit is contained in:
parent
e22f749987
commit
1b2ab58488
@ -3,6 +3,7 @@ using ApiSoftway.Models.Gesa_DbContext;
|
|||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion.Internal;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.IdentityModel.Tokens;
|
using Microsoft.IdentityModel.Tokens;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
@ -26,6 +27,8 @@ namespace ApiSoftway.Controllers
|
|||||||
private readonly GESA_SBR_ORD_DbContext _sbrord_context;
|
private readonly GESA_SBR_ORD_DbContext _sbrord_context;
|
||||||
private readonly GESA_PERSONALE_DbContext _personale_context;
|
private readonly GESA_PERSONALE_DbContext _personale_context;
|
||||||
private readonly IConfiguration? _configuration;
|
private readonly IConfiguration? _configuration;
|
||||||
|
private readonly GESA_GIRICONSEGNEDACREARE_DbContext _daCreare_context;
|
||||||
|
|
||||||
private DbSet<Giri>? _giri;
|
private DbSet<Giri>? _giri;
|
||||||
private DbSet<GiriConsegna>? _giriCons;
|
private DbSet<GiriConsegna>? _giriCons;
|
||||||
private DbSet<GiriConsegnaView>? _giriConsView;
|
private DbSet<GiriConsegnaView>? _giriConsView;
|
||||||
@ -33,9 +36,10 @@ namespace ApiSoftway.Controllers
|
|||||||
private DbSet<Consegna>? _consegne;
|
private DbSet<Consegna>? _consegne;
|
||||||
private DbSet<Sbr_ord>? _sbrord;
|
private DbSet<Sbr_ord>? _sbrord;
|
||||||
private DbSet<Personale>? _personale;
|
private DbSet<Personale>? _personale;
|
||||||
|
private DbSet<GiriConsegnaDaCreare>? _GiriDaCreare;
|
||||||
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_PERSONALE_DbContext personale_context, GESA_GIRICONSEGNEDACREARE_DbContext daCreare_context)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_configuration = configuration;
|
_configuration = configuration;
|
||||||
@ -46,6 +50,7 @@ namespace ApiSoftway.Controllers
|
|||||||
_consegnevista_context = consegnevista_context;
|
_consegnevista_context = consegnevista_context;
|
||||||
_sbrord_context = sbrord_context;
|
_sbrord_context = sbrord_context;
|
||||||
_personale_context= personale_context;
|
_personale_context= personale_context;
|
||||||
|
_daCreare_context = daCreare_context;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("listaGiri")]
|
[HttpGet("listaGiri")]
|
||||||
@ -68,6 +73,16 @@ namespace ApiSoftway.Controllers
|
|||||||
return gc;
|
return gc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet("listaGiriDaCreare")]
|
||||||
|
public async Task<ActionResult<IEnumerable<GiriConsegnaDaCreare>>> listaGiriDaCreare()
|
||||||
|
{
|
||||||
|
List<GiriConsegnaDaCreare> lst = new List<GiriConsegnaDaCreare>();
|
||||||
|
_GiriDaCreare = _daCreare_context.GiriDaCreare;
|
||||||
|
var gc = await _GiriDaCreare.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()
|
||||||
{
|
{
|
||||||
@ -376,6 +391,13 @@ namespace ApiSoftway.Controllers
|
|||||||
o.ItemList = formattaDestinazione(d);
|
o.ItemList = formattaDestinazione(d);
|
||||||
o.ImportoDaRitirare = d.ImportoDaRitirare;
|
o.ImportoDaRitirare = d.ImportoDaRitirare;
|
||||||
o.serialeGiro=d.serialeGiro;
|
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;
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(d.consFattaSerial))
|
if (!string.IsNullOrEmpty(d.consFattaSerial))
|
||||||
{
|
{
|
||||||
ConsegnaFatta cf=new ConsegnaFatta();
|
ConsegnaFatta cf=new ConsegnaFatta();
|
||||||
@ -400,13 +422,13 @@ namespace ApiSoftway.Controllers
|
|||||||
return lst;
|
return lst;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("listaDestinazioniByAutistaData")]
|
[HttpGet("listaDestinazioniByAutistaDataMezzo")]
|
||||||
public async Task<ActionResult<IEnumerable<Destinazioni_out>>> listaDestinazioniByAutistaData(string autista, DateTime? dataGiro)
|
public async Task<ActionResult<IEnumerable<Destinazioni_out>>> listaDestinazioniByAutistaData(string autista, DateTime? dataGiro,string mezzo)
|
||||||
{
|
{
|
||||||
|
|
||||||
List<Destinazioni_out> lst = new List<Destinazioni_out>();
|
List<Destinazioni_out> lst = new List<Destinazioni_out>();
|
||||||
_destinazioni = _destinazioni_context.Destinazioni;
|
_destinazioni = _destinazioni_context.Destinazioni;
|
||||||
var r = await _destinazioni.Where(t => t.CodAutista != null && t.CodAutista.Equals(autista) && t.DataCarico != null && t.DataCarico == dataGiro).OrderByDescending(t => t.DataCarico).ToListAsync();
|
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).ToListAsync();
|
||||||
foreach (Destinazioni d in r)
|
foreach (Destinazioni d in r)
|
||||||
{
|
{
|
||||||
Destinazioni_out o = new Destinazioni_out();
|
Destinazioni_out o = new Destinazioni_out();
|
||||||
@ -443,6 +465,15 @@ namespace ApiSoftway.Controllers
|
|||||||
o.ItemList = formattaDestinazione(d);
|
o.ItemList = formattaDestinazione(d);
|
||||||
o.ImportoDaRitirare = d.ImportoDaRitirare;
|
o.ImportoDaRitirare = d.ImportoDaRitirare;
|
||||||
o.serialeGiro = d.serialeGiro;
|
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;
|
||||||
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(d.consFattaSerial))
|
if (!string.IsNullOrEmpty(d.consFattaSerial))
|
||||||
{
|
{
|
||||||
ConsegnaFatta cf = new ConsegnaFatta();
|
ConsegnaFatta cf = new ConsegnaFatta();
|
||||||
@ -609,6 +640,44 @@ namespace ApiSoftway.Controllers
|
|||||||
string ind = !string.IsNullOrEmpty(d.IndirizzoSede) ? d.IndirizzoSede.Trim() : string.Empty;
|
string ind = !string.IsNullOrEmpty(d.IndirizzoSede) ? d.IndirizzoSede.Trim() : string.Empty;
|
||||||
sb.Append("<b>Indirizzo</b> " + ind);
|
sb.Append("<b>Indirizzo</b> " + ind);
|
||||||
sb.Append("<br> ");
|
sb.Append("<br> ");
|
||||||
|
|
||||||
|
string _casse=d.Casse!=null && d.Casse >0 ? Convert.ToInt16(d.Casse).ToString() : string.Empty;
|
||||||
|
if(!string.IsNullOrEmpty(_casse))
|
||||||
|
{
|
||||||
|
sb.Append("<b>Casse</b> " + _casse + " ");
|
||||||
|
}
|
||||||
|
string _trasf = d.Trasf != null && d.Trasf > 0 ? Convert.ToInt16( d.Trasf).ToString() : string.Empty;
|
||||||
|
if (!string.IsNullOrEmpty(_trasf))
|
||||||
|
{
|
||||||
|
sb.Append("<b>Trasf</b> " + _trasf + " ");
|
||||||
|
}
|
||||||
|
string _colli = d.Colli != null && d.Colli > 0 ? Convert.ToInt16(d.Colli).ToString() : string.Empty;
|
||||||
|
if (!string.IsNullOrEmpty(_colli))
|
||||||
|
{
|
||||||
|
sb.Append("<b>Colli</b> " + _colli + " ");
|
||||||
|
}
|
||||||
|
string _num_cons = d.num_cons != null && d.num_cons > 0 ? Convert.ToInt16(d.num_cons).ToString() : string.Empty;
|
||||||
|
if (!string.IsNullOrEmpty(_num_cons))
|
||||||
|
{
|
||||||
|
sb.Append("<b>Nr.Cons</b> " + _num_cons + " ");
|
||||||
|
}
|
||||||
|
string _uova = d.Uova != null && d.Uova > 0 ? d.Uova.ToString() : string.Empty;
|
||||||
|
if (!string.IsNullOrEmpty(_uova))
|
||||||
|
{
|
||||||
|
sb.Append("<b>Uova</b> " + _uova + " ");
|
||||||
|
}
|
||||||
|
string _cist = d.Cist != null && d.Cist > 0 ? d.Cist.ToString() : string.Empty;
|
||||||
|
if (!string.IsNullOrEmpty(_cist))
|
||||||
|
{
|
||||||
|
sb.Append("<b>Cist</b> " + _cist + " ");
|
||||||
|
}
|
||||||
|
string _note=!string.IsNullOrEmpty(d.Note) ? d.Note.Trim() :string.Empty;
|
||||||
|
if (!string.IsNullOrEmpty(_note))
|
||||||
|
{
|
||||||
|
sb.Append("<br> ");
|
||||||
|
sb.Append("<b>Note</b> " + _note);
|
||||||
|
}
|
||||||
|
|
||||||
item = sb.ToString();
|
item = sb.ToString();
|
||||||
sb = null;
|
sb = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,5 +39,17 @@ namespace ApiSoftway.Models
|
|||||||
|
|
||||||
public string? serialeGiro { get; set; }
|
public string? serialeGiro { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
[System.ComponentModel.DataAnnotations.Schema.Column(TypeName = "decimal(18, 4)")]
|
||||||
|
public decimal? Casse { get; set; }
|
||||||
|
[System.ComponentModel.DataAnnotations.Schema.Column(TypeName = "decimal(18, 4)")]
|
||||||
|
public decimal? Trasf { get; set; }
|
||||||
|
[System.ComponentModel.DataAnnotations.Schema.Column(TypeName = "decimal(18, 4)")]
|
||||||
|
public decimal? Colli { get; set; }
|
||||||
|
public int? num_cons { get; set; }
|
||||||
|
public int? Uova { get; set; }
|
||||||
|
public int? Cist { get; set; }
|
||||||
|
public string? Note { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,17 @@ namespace ApiSoftway.Models
|
|||||||
public string? ItemList { get; set; }
|
public string? ItemList { get; set; }
|
||||||
public ConsegnaFatta? ConsFatta { get; set; }
|
public ConsegnaFatta? ConsFatta { get; set; }
|
||||||
public string? serialeGiro { get; set; }
|
public string? serialeGiro { get; set; }
|
||||||
|
|
||||||
|
[System.ComponentModel.DataAnnotations.Schema.Column(TypeName = "decimal(18, 4)")]
|
||||||
|
public decimal? Casse { get; set; }
|
||||||
|
[System.ComponentModel.DataAnnotations.Schema.Column(TypeName = "decimal(18, 4)")]
|
||||||
|
public decimal? Trasf { get; set; }
|
||||||
|
[System.ComponentModel.DataAnnotations.Schema.Column(TypeName = "decimal(18, 4)")]
|
||||||
|
public decimal? Colli { get; set; }
|
||||||
|
public int? num_cons { get; set; }
|
||||||
|
public int? Uova { get; set; }
|
||||||
|
public int? Cist { get; set; }
|
||||||
|
public string? Note { get; set; }
|
||||||
}
|
}
|
||||||
public class ConsegnaFatta
|
public class ConsegnaFatta
|
||||||
{
|
{
|
||||||
|
|||||||
16
Models/Gesa_DbContext/GESA_GIRICONSEGNEDACREARE_DbContext.cs
Normal file
16
Models/Gesa_DbContext/GESA_GIRICONSEGNEDACREARE_DbContext.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace ApiSoftway.Models.Gesa_DbContext
|
||||||
|
{
|
||||||
|
public class GESA_GIRICONSEGNEDACREARE_DbContext : DbContext
|
||||||
|
{
|
||||||
|
public DbSet<GiriConsegnaDaCreare>? GiriDaCreare { get; set; }
|
||||||
|
public GESA_GIRICONSEGNEDACREARE_DbContext(DbContextOptions<GESA_GIRICONSEGNEDACREARE_DbContext> options) : base(options)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
modelBuilder.Entity<GiriConsegnaDaCreare>().ToView("API_GIRICONSEGNA_DA_CREARE");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
14
Models/GiriConsegnaDaCreare.cs
Normal file
14
Models/GiriConsegnaDaCreare.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace ApiSoftway.Models
|
||||||
|
{
|
||||||
|
[Keyless]
|
||||||
|
public class GiriConsegnaDaCreare
|
||||||
|
{
|
||||||
|
public string? CodAutomezzo { get; set; }
|
||||||
|
public string? CodAutista { get; set; }
|
||||||
|
public string? Autista { get; set; }
|
||||||
|
public string? Automezzo { get; set; }
|
||||||
|
public DateTime? DataGiro { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
21
Models/GiriConsegnaDaCreare_out.cs
Normal file
21
Models/GiriConsegnaDaCreare_out.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace ApiSoftway.Models
|
||||||
|
{
|
||||||
|
[Keyless]
|
||||||
|
public class GiriConsegnaDaCreare_out
|
||||||
|
{
|
||||||
|
public string? CodAutomezzo { get; set; }
|
||||||
|
public string? CodAutista { get; set; }
|
||||||
|
public string? Autista { get; set; }
|
||||||
|
public string? Automezzo { get; set; }
|
||||||
|
public DateTime? DataGiro { get; set; }
|
||||||
|
|
||||||
|
/// <summary>errore titolo</summary>
|
||||||
|
public string? err_title { get; set; }
|
||||||
|
/// <summary>errore dettaglio</summary>
|
||||||
|
public string? err_detail { get; set; }
|
||||||
|
/// <summary>errore status code (200, 500)</summary>
|
||||||
|
public string? err_status_code { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -19,5 +19,8 @@ namespace ApiSoftway.Models
|
|||||||
public decimal? ImportoRecuperato { get; set; }
|
public decimal? ImportoRecuperato { get; set; }
|
||||||
public DateTime? DataChiusura { get; set; }
|
public DateTime? DataChiusura { get; set; }
|
||||||
|
|
||||||
|
public string? CodMezzo { get; set; }
|
||||||
|
public string? Automezzo { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,6 +39,9 @@ builder.Services.AddDbContext<GESA_GIRICONSEGNEVISTA_DbContext>(options => optio
|
|||||||
builder.Services.AddDbContext<GESA_SBR_ORD_DbContext>(options => options.UseSqlServer(builder.Configuration.GetConnectionString("GESA")
|
builder.Services.AddDbContext<GESA_SBR_ORD_DbContext>(options => options.UseSqlServer(builder.Configuration.GetConnectionString("GESA")
|
||||||
, options => { options.CommandTimeout(commandTimeoutInSeconds); }
|
, options => { options.CommandTimeout(commandTimeoutInSeconds); }
|
||||||
));
|
));
|
||||||
|
builder.Services.AddDbContext<GESA_GIRICONSEGNEDACREARE_DbContext>(options => options.UseSqlServer(builder.Configuration.GetConnectionString("GESA")
|
||||||
|
, options => { options.CommandTimeout(commandTimeoutInSeconds); }
|
||||||
|
));
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user