gestione master detail MOVIB_m

This commit is contained in:
Marco Audiffredi 2024-07-26 10:46:42 +02:00
parent ebe47444bf
commit 86d7c6349e
5 changed files with 34 additions and 6 deletions

View File

@ -675,7 +675,30 @@ namespace ApiSoftway.Controllers
DateTime dateTime = DateTime.Now;
Consegna t = fillConsegna(model, token, dateTime);
//Step 1 : testata
//Step 1: mi calcolo il nuovo seriale
_consegne = _consegne_context.Cons;
var ser = await _consegne.Take(1).OrderByDescending(t => t.Pisergir).ToListAsync();
string ultSer = "0";
if (ser != null && ser.Count > 0)
{
ultSer = ser.First().Pisergir;
}
string newSer = calcolaNuovoSeriale(ultSer);
t.Pisergir = newSer;
//Steo 2: mi ricavo i dati da inserire i GESASMOVIB. Li leggo dalla GESASBR_ORD
_sbrord = _sbrord_context.Cons;
var ti = await _sbrord.Where(t => t.Brserial.Equals(model.Serial)).FirstAsync();
string _committente = ti.Brcodcom;
string _cliFatturazione = ti.Brclifat;
t.Cca = _committente;
t.Ccda=_cliFatturazione;
t.Tcda = "C";
t.Tca = "C";
//Step 3 : testata
Consegna_m m = new Consegna_m();
m.Pisergir = t.Pisergir;
m.Data = dateTime;
@ -687,7 +710,7 @@ namespace ApiSoftway.Controllers
transactionM.Commit();
}
//step 2 : riga (è sempre e solo una)
//step 4 : riga (è sempre e solo una)
using (var transaction = _consegne_context.Database.BeginTransaction())
{
await _consegne_context.Cons.AddAsync(t);
@ -891,14 +914,14 @@ namespace ApiSoftway.Controllers
r.Tipob =i.Tipob;
r.Sdoc = i.Sdoc;
r.Pisergir = i.Pisergir;
//r.Tcda=i.Tcda;
r.Tcda = "S";
r.Tcda=i.Tcda;
r.Tca = i.Tca;
r.Cca = i.Cca;
r.Dca = i.Dca;
r.Piconseg = i.Piconseg;
r.Pimezzo = i.Pimezzo;
r.Piimport= i.Piimport;
r.Serial=i.Serial;

View File

@ -35,6 +35,7 @@ namespace ApiSoftway.Models
public decimal? Piimport { get; set; }
public string? Pinotimp { get; set; }
public string? Pinotban { get; set; }
public string? Serial { get; set; }
}
}

View File

@ -33,6 +33,7 @@ namespace ApiSoftway.Models
public string? Pinotimp { get; set; }
public string? Pinotban { get; set; }
public string? Serial { get; set; }
/// <summary>errore titolo</summary>
public string? err_title { get; set; }

View File

@ -7,5 +7,8 @@ namespace ApiSoftway.Models
[Key]
public string? Brserial { get; set; }
public string? Pisergir { get; set; }
public string? Brcodcom { get; set; }
public string? Brclifat { get; set; }
public int? Brnumseq { get; set; }
}
}

View File

@ -74,5 +74,5 @@ app.UseAuthorization();
app.MapControllers();
//app.Run();
app.Run("http://localhost:6000");
app.Run();
//app.Run("http://localhost:6000");