aggiunti metodi x filtro PODL
This commit is contained in:
@@ -598,11 +598,25 @@ namespace MP.Data.Controllers
|
||||
/// <param name="codArt">Cod articolo</param>
|
||||
/// <param name="keyRichPart">KeyRich (parziale) da cercare (es cod stato x yacht)</param>
|
||||
/// <returns></returns>
|
||||
public List<PODLModel> ListPODLFilt(string codArt, string keyRichPart)
|
||||
public List<PODLExpModel> ListPODLFilt(bool lanciato, string keyRichPart, string idxMacchina, string codGruppo)
|
||||
{
|
||||
List<PODLModel> dbResult = new List<PODLModel>();
|
||||
|
||||
List<PODLExpModel> dbResult = new List<PODLExpModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var Lanciato = new SqlParameter("@Lanciato", lanciato);
|
||||
var CodGruppo = new SqlParameter("@CodGruppo", codGruppo);
|
||||
var KeyRich = new SqlParameter("@KeyRich", keyRichPart);
|
||||
var IdxMacc = new SqlParameter("@IdxMacchina", idxMacchina);
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetPODLExp
|
||||
.FromSqlRaw("EXEC stp_PODL_getByFiltSpec @Lanciato, @KeyRich, @CodGruppo, @IdxMacchina", Lanciato, KeyRich, codGruppo, IdxMacc)
|
||||
.AsNoTracking()
|
||||
//.AsEnumerable()
|
||||
.ToList();
|
||||
}
|
||||
#if false
|
||||
dbResult = dbCtx
|
||||
.DbSetPODL
|
||||
.Where(x => (x.IdxOdl == 0) && (x.KeyRichiesta.Contains(keyRichPart) || keyRichPart == "*") && (codArt == "*" || x.CodArticolo.Contains(codArt)))
|
||||
@@ -611,7 +625,7 @@ namespace MP.Data.Controllers
|
||||
.Include(a => a.ArticoloNav)
|
||||
.OrderByDescending(x => x.InsertDate)
|
||||
.ToList();
|
||||
}
|
||||
#endif
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
@@ -945,7 +959,7 @@ namespace MP.Data.Controllers
|
||||
/// <param name="pzPallet"></param>
|
||||
/// <param name="note"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> PODL_startSetup(PODLModel editRec, int matrOpr, double tcRich, int pzPallet, string note)
|
||||
public async Task<bool> PODL_startSetup(PODLExpModel editRec, int matrOpr, double tcRich, int pzPallet, string note)
|
||||
{
|
||||
bool answ = false;
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
@@ -953,7 +967,7 @@ namespace MP.Data.Controllers
|
||||
try
|
||||
{
|
||||
var currRec = dbCtx
|
||||
.DbSetPODL
|
||||
.DbSetPODLExp
|
||||
.AsNoTracking()
|
||||
.Where(x => x.IdxPromessa == editRec.IdxPromessa)
|
||||
.FirstOrDefault();
|
||||
@@ -988,7 +1002,7 @@ namespace MP.Data.Controllers
|
||||
/// </summary>
|
||||
/// <param name="currRec"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> PODLDeleteRecord(PODLModel currRec)
|
||||
public async Task<bool> PODLDeleteRecord(PODLExpModel currRec)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
@@ -996,11 +1010,11 @@ namespace MP.Data.Controllers
|
||||
try
|
||||
{
|
||||
var currVal = dbCtx
|
||||
.DbSetPODL
|
||||
.DbSetPODLExp
|
||||
.Where(x => x.IdxPromessa == currRec.IdxPromessa)
|
||||
.FirstOrDefault();
|
||||
dbCtx
|
||||
.DbSetPODL
|
||||
.DbSetPODLExp
|
||||
.Remove(currVal);
|
||||
await dbCtx.SaveChangesAsync();
|
||||
fatto = true;
|
||||
@@ -1018,7 +1032,7 @@ namespace MP.Data.Controllers
|
||||
/// </summary>
|
||||
/// <param name="currRec"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> PODLUpdateRecord(PODLModel editRec)
|
||||
public async Task<bool> PODLUpdateRecord(PODLExpModel editRec)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
@@ -1026,7 +1040,7 @@ namespace MP.Data.Controllers
|
||||
try
|
||||
{
|
||||
var currRec = dbCtx
|
||||
.DbSetPODL
|
||||
.DbSetPODLExp
|
||||
.Where(x => x.IdxPromessa == editRec.IdxPromessa)
|
||||
.FirstOrDefault();
|
||||
if (currRec != null)
|
||||
@@ -1045,7 +1059,7 @@ namespace MP.Data.Controllers
|
||||
else
|
||||
{
|
||||
dbCtx
|
||||
.DbSetPODL
|
||||
.DbSetPODLExp
|
||||
.Add(editRec);
|
||||
}
|
||||
await dbCtx.SaveChangesAsync();
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
|
||||
#nullable disable
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
namespace MP.Data.DatabaseModels
|
||||
{
|
||||
public partial class PODLExpModel
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Key]
|
||||
public int IdxPromessa { get; set; }
|
||||
[MaxLength(50)]
|
||||
public string KeyRichiesta { get; set; }
|
||||
[MaxLength(50)]
|
||||
public string KeyBCode { get; set; }
|
||||
public bool Attivabile { get; set; } = false;
|
||||
public int IdxOdl { get; set; } = 0;
|
||||
[MaxLength(50)]
|
||||
public string CodArticolo { get; set; } = "";
|
||||
[MaxLength(50)]
|
||||
public string CodGruppo { get; set; } = "";
|
||||
[MaxLength(50)]
|
||||
public string IdxMacchina { get; set; }
|
||||
public int NumPezzi { get; set; } = 1;
|
||||
public decimal Tcassegnato { get; set; } = 1;
|
||||
public DateTime? DueDate { get; set; }
|
||||
public int Priorita { get; set; } = 1;
|
||||
public int PzPallet { get; set; } = 1;
|
||||
[MaxLength(2500)]
|
||||
public string Note { get; set; } = "";
|
||||
[MaxLength(50)]
|
||||
public string CodCli { get; set; } = "";
|
||||
public DateTime InsertDate { get; set; } = DateTime.Now;
|
||||
|
||||
[NotMapped]
|
||||
public string CodFase
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "*";
|
||||
var allData = KeyRichiesta.Split('_');
|
||||
if (allData.Length > 0)
|
||||
{
|
||||
answ = allData[0];
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Navigazione oggetto Machine
|
||||
/// </summary>
|
||||
[ForeignKey("IdxMacchina")]
|
||||
public virtual Macchine MachineNav { get; set; } = null!;
|
||||
/// <summary>
|
||||
/// Navigazione oggetto Articolo
|
||||
/// </summary>
|
||||
[ForeignKey("CodArticolo")]
|
||||
public virtual AnagArticoli ArticoloNav { get; set; } = null!;
|
||||
|
||||
public string DescArticolo { get; set; } = "";
|
||||
public string CodMacchina { get; set; } = "";
|
||||
public string Nome { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -46,6 +46,7 @@ namespace MP.Data
|
||||
public virtual DbSet<LinkMenu> DbSetLinkMenu { get; set; }
|
||||
public virtual DbSet<ODLModel> DbSetODL { get; set; }
|
||||
public virtual DbSet<ODLExpModel> DbSetODLExp { get; set; }
|
||||
public virtual DbSet<PODLExpModel> DbSetPODLExp { get; set; }
|
||||
public virtual DbSet<PODLModel> DbSetPODL { get; set; }
|
||||
public virtual DbSet<FluxLog> DbSetFluxLog { get; set; }
|
||||
public virtual DbSet<DossierModel> DbSetDossiers { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user