diff --git a/DbBackup/StockMan.bak b/DbBackup/StockMan.bak index 6c12a3b..bfe4eae 100644 Binary files a/DbBackup/StockMan.bak and b/DbBackup/StockMan.bak differ diff --git a/StockManMVC/Controllers/ItemFluxesController.cs b/StockManMVC/Controllers/ItemFluxesController.cs index 2f233a8..1be4af4 100644 --- a/StockManMVC/Controllers/ItemFluxesController.cs +++ b/StockManMVC/Controllers/ItemFluxesController.cs @@ -105,11 +105,11 @@ namespace StockManMVC.Controllers default: if (Sort == "dsc") { - answ = answ.OrderByDescending(x => x.dtMov); + answ = answ.OrderByDescending(x => x.ID); } else { - answ = answ.OrderBy(x => x.dtMov); + answ = answ.OrderBy(x => x.ID); } break; } diff --git a/StockManMVC/Controllers/MagStatusController.cs b/StockManMVC/Controllers/MagStatusController.cs index 4380dc2..a4422d8 100644 --- a/StockManMVC/Controllers/MagStatusController.cs +++ b/StockManMVC/Controllers/MagStatusController.cs @@ -43,17 +43,30 @@ namespace StockManMVC.Controllers ViewBag.LocationID = LocationID; ViewBag.LocationIDTo = LocationIDTo; ViewBag.ShowMove = ShowMove; - return PartialView("_StockByLocation",CurrStock.ToList()); + return PartialView("_StockByLocation", CurrStock.ToList()); } public ActionResult Move(int ID, string LocationID, string LocationIDTo) { + // recupero operatore... + IEnumerable listOper = OperatorsController.Select(User.Identity.Name); + string currOperID = "ND"; + if (listOper.Count() == 1) + { + currOperID = listOper.First().ID; + } + // chiamo la stored x il move + using (var ctx = new StockManEntities()) + { + // esegue stored procedure come function, SE id == 0 processa TUTTI... + int rowMod = ctx.stp_ItemStockMove(ID, LocationID, LocationIDTo, currOperID); + } // appoggio variabili - string SelSX = LocationIDTo; - string SelDX = LocationID; + string SelSX = LocationID; + string SelDX = LocationIDTo; // restituisco la view principale... return RedirectToAction("Index", new { LocationID_SX = SelSX, LocationID_DX = SelDX }); } diff --git a/StockManMVC/Controllers/OperatorsController.cs b/StockManMVC/Controllers/OperatorsController.cs index d2d4e06..fb9fdf7 100644 --- a/StockManMVC/Controllers/OperatorsController.cs +++ b/StockManMVC/Controllers/OperatorsController.cs @@ -20,6 +20,26 @@ namespace StockManMVC.Controllers return View(db.Operator.ToList()); } + + + /// + /// Selezione operatore da ricerca chiave... + /// + /// + /// + public static IEnumerable Select(string SearchVal) + { + StockManEntities db = new StockManEntities(); + if (SearchVal == null) + { + SearchVal = "##########"; + } + var answ = db.Operator.Where( s => s.CodExt == SearchVal + || s.ID ==SearchVal + ); + return answ; + } + // GET: Operators/Details/5 public ActionResult Details(string id) { diff --git a/StockManMVC/Models/SMModel.Context.cs b/StockManMVC/Models/SMModel.Context.cs index a25b38a..4fb87bc 100644 --- a/StockManMVC/Models/SMModel.Context.cs +++ b/StockManMVC/Models/SMModel.Context.cs @@ -64,5 +64,26 @@ namespace StockManMVC.Models return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("stp_ItemDuplicate", mergeOption, original_IDParameter); } + + public virtual int stp_ItemStockMove(Nullable stockID, string locationID_FROM, string locationID_TO, string operatorID) + { + var stockIDParameter = stockID.HasValue ? + new ObjectParameter("StockID", stockID) : + new ObjectParameter("StockID", typeof(int)); + + var locationID_FROMParameter = locationID_FROM != null ? + new ObjectParameter("LocationID_FROM", locationID_FROM) : + new ObjectParameter("LocationID_FROM", typeof(string)); + + var locationID_TOParameter = locationID_TO != null ? + new ObjectParameter("LocationID_TO", locationID_TO) : + new ObjectParameter("LocationID_TO", typeof(string)); + + var operatorIDParameter = operatorID != null ? + new ObjectParameter("OperatorID", operatorID) : + new ObjectParameter("OperatorID", typeof(string)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("stp_ItemStockMove", stockIDParameter, locationID_FROMParameter, locationID_TOParameter, operatorIDParameter); + } } } diff --git a/StockManMVC/Models/SMModel.edmx b/StockManMVC/Models/SMModel.edmx index 8e1caf3..194f223 100644 --- a/StockManMVC/Models/SMModel.edmx +++ b/StockManMVC/Models/SMModel.edmx @@ -229,6 +229,12 @@ avviso 6002: Nessuna chiave primaria definita per la tabella/visualizzazione 'St + + + + + + @@ -474,6 +480,12 @@ avviso 6002: Nessuna chiave primaria definita per la tabella/visualizzazione 'St + + + + + + @@ -631,6 +643,16 @@ avviso 6002: Nessuna chiave primaria definita per la tabella/visualizzazione 'St + + + + + + + + + + @@ -755,6 +777,8 @@ avviso 6002: Nessuna chiave primaria definita per la tabella/visualizzazione 'St + + diff --git a/StockManMVC/Models/stp_ItemStockMove_Result.cs b/StockManMVC/Models/stp_ItemStockMove_Result.cs new file mode 100644 index 0000000..d1852b7 --- /dev/null +++ b/StockManMVC/Models/stp_ItemStockMove_Result.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// +// Codice generato da un modello. +// +// Le modifiche manuali a questo file potrebbero causare un comportamento imprevisto dell'applicazione. +// Se il codice viene rigenerato, le modifiche manuali al file verranno sovrascritte. +// +//------------------------------------------------------------------------------ + +namespace StockManMVC.Models +{ + using System; + + public partial class stp_ItemStockMove_Result + { + public int ItemID { get; set; } + public string LocationID { get; set; } + public string Column1 { get; set; } + public string Column2 { get; set; } + public Nullable Column3 { get; set; } + public int QtyConf { get; set; } + public string Column4 { get; set; } + public Nullable Column5 { get; set; } + } +} diff --git a/StockManMVC/StockManMVC.csproj b/StockManMVC/StockManMVC.csproj index dbaeb77..d359e20 100644 --- a/StockManMVC/StockManMVC.csproj +++ b/StockManMVC/StockManMVC.csproj @@ -233,6 +233,9 @@ SMModel.tt + + SMModel.tt + SMModel.tt diff --git a/StockManMVC/Views/Items/Details.cshtml b/StockManMVC/Views/Items/Details.cshtml index 321b92d..0b06c5e 100644 --- a/StockManMVC/Views/Items/Details.cshtml +++ b/StockManMVC/Views/Items/Details.cshtml @@ -119,12 +119,6 @@ Scarico - diff --git a/StockManMVC/Views/Shared/_Layout.cshtml b/StockManMVC/Views/Shared/_Layout.cshtml index 2e7b831..25616ea 100644 --- a/StockManMVC/Views/Shared/_Layout.cshtml +++ b/StockManMVC/Views/Shared/_Layout.cshtml @@ -43,7 +43,6 @@ @**@ diff --git a/StockManMVC/bin/StockManMVC.dll b/StockManMVC/bin/StockManMVC.dll index 66284b8..ef7dae1 100644 Binary files a/StockManMVC/bin/StockManMVC.dll and b/StockManMVC/bin/StockManMVC.dll differ