update db + fix x gestione movimenti!!!

This commit is contained in:
Samuele E. Locatelli
2016-09-27 18:07:46 +02:00
parent 7190c308dd
commit 6556c00dfd
11 changed files with 111 additions and 12 deletions
Binary file not shown.
@@ -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;
}
+16 -3
View File
@@ -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<Operator> 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 });
}
@@ -20,6 +20,26 @@ namespace StockManMVC.Controllers
return View(db.Operator.ToList());
}
/// <summary>
/// Selezione operatore da ricerca chiave...
/// </summary>
/// <param name="SearchVal"></param>
/// <returns></returns>
public static IEnumerable<Operator> 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)
{
+21
View File
@@ -64,5 +64,26 @@ namespace StockManMVC.Models
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<Item>("stp_ItemDuplicate", mergeOption, original_IDParameter);
}
public virtual int stp_ItemStockMove(Nullable<int> 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);
}
}
}
+24
View File
@@ -229,6 +229,12 @@ avviso 6002: Nessuna chiave primaria definita per la tabella/visualizzazione 'St
<Function Name="stp_ItemDuplicate" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo">
<Parameter Name="Original_ID" Type="int" Mode="In" />
</Function>
<Function Name="stp_ItemStockMove" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo">
<Parameter Name="StockID" Type="int" Mode="In" />
<Parameter Name="LocationID_FROM" Type="nvarchar" Mode="In" />
<Parameter Name="LocationID_TO" Type="nvarchar" Mode="In" />
<Parameter Name="OperatorID" Type="nvarchar" Mode="In" />
</Function>
<EntityContainer Name="StockManModelStoreContainer">
<EntitySet Name="Item" EntityType="Self.Item" Schema="dbo" store:Type="Tables" />
<EntitySet Name="ItemFamily" EntityType="Self.ItemFamily" Schema="dbo" store:Type="Tables" />
@@ -474,6 +480,12 @@ avviso 6002: Nessuna chiave primaria definita per la tabella/visualizzazione 'St
<End Role="Location" EntitySet="Location" />
<End Role="vLocationVal" EntitySet="vLocationVal" />
</AssociationSet>
<FunctionImport Name="stp_ItemStockMove">
<Parameter Name="StockID" Mode="In" Type="Int32" />
<Parameter Name="LocationID_FROM" Mode="In" Type="String" />
<Parameter Name="LocationID_TO" Mode="In" Type="String" />
<Parameter Name="OperatorID" Mode="In" Type="String" />
</FunctionImport>
</EntityContainer>
<EntityType Name="ItemFamily">
<Key>
@@ -631,6 +643,16 @@ avviso 6002: Nessuna chiave primaria definita per la tabella/visualizzazione 'St
</Dependent>
</ReferentialConstraint>
</Association>
<ComplexType Name="stp_ItemStockMove_Result">
<Property Type="Int32" Name="ItemID" Nullable="false" />
<Property Type="String" Name="LocationID" Nullable="false" MaxLength="50" />
<Property Type="String" Name="Column1" Nullable="false" MaxLength="3" />
<Property Type="String" Name="Column2" Nullable="true" MaxLength="50" />
<Property Type="DateTime" Name="Column3" Nullable="true" Precision="23" />
<Property Type="Int32" Name="QtyConf" Nullable="false" />
<Property Type="String" Name="Column4" Nullable="true" MaxLength="50" />
<Property Type="DateTime" Name="Column5" Nullable="true" Precision="23" />
</ComplexType>
</Schema>
</edmx:ConceptualModels>
<!-- C-S mapping content -->
@@ -755,6 +777,8 @@ avviso 6002: Nessuna chiave primaria definita per la tabella/visualizzazione 'St
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<FunctionImportMapping FunctionImportName="stp_ItemStockMove" FunctionName="StockManModel.Store.stp_ItemStockMove">
</FunctionImportMapping>
</EntityContainerMapping>
</Mapping>
</edmx:Mappings>
@@ -0,0 +1,25 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
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<System.DateTime> Column3 { get; set; }
public int QtyConf { get; set; }
public string Column4 { get; set; }
public Nullable<System.DateTime> Column5 { get; set; }
}
}
+3
View File
@@ -233,6 +233,9 @@
<Compile Include="Models\stp_ItemDuplicate1_Result.cs">
<DependentUpon>SMModel.tt</DependentUpon>
</Compile>
<Compile Include="Models\stp_ItemStockMove_Result.cs">
<DependentUpon>SMModel.tt</DependentUpon>
</Compile>
<Compile Include="Models\vItemFlux2Save.cs">
<DependentUpon>SMModel.tt</DependentUpon>
</Compile>
-6
View File
@@ -119,12 +119,6 @@
Scarico
</a>
</div>
<div class="col-xs-4">
<a href="@Url.Action("CreatePrecompiled", "ItemFluxes", new { ItemID = Model.ID, MovTypeID = "MOV" })" class="btn btn-warning form-control">
<i class="glyphicon glyphicon-equalizer" aria-hidden="true"></i>
Movimento
</a>
</div>
</div>
</div>
</div>
-1
View File
@@ -43,7 +43,6 @@
<ul class="dropdown-menu">
<li>@Html.ActionLink("Stato Magazzino", "Index", "MagStatus")</li>
<li>@Html.ActionLink("Movimenti Aperti", "Index", "vItemFlux2Save")</li>
<li>@Html.ActionLink("Spostamento Articoli", "Move", "ItemStocks")</li>
</ul>
</li>
@**@
Binary file not shown.