Aggiunta stored e funzionalità x duplicare le righe di flusso, vedi http://redmine.steamware.net/issues/623

This commit is contained in:
Samuele E. Locatelli
2016-12-01 13:55:18 +01:00
parent 206943eec3
commit 50ba4d86fa
9 changed files with 114 additions and 7 deletions
@@ -421,6 +421,31 @@ namespace StockManMVC.Controllers
return RedirectToAction("Details", "Items", new { ID = itemFlux.ItemID, StockItemID = itemFlux.ItemID });
}
// GET: Items/Duplicate/5
public ActionResult Duplicate(int? id)
{
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
int newId = 0;
int ItemID = 0;
// ora chiamo stored e recupero nuovo ID del record duplicato
using (var ctx = new StockManEntities())
{
// esegue stored procedure come function, recuperando nuovo ID creato...
var newItemFlux = ctx.stp_ItemFluxDuplicate(id).ToList();
newId = newItemFlux[0].ID;
ItemID = newItemFlux[0].ItemID;
}
// rimando in editing!
return RedirectToAction("Edit", "ItemFluxes", new { ID = newId, mode = "std" });
//return Edit(newId, "std");
//return RedirectToAction("Details", "Items", new { ID = ItemID, StockItemID = ItemID });
}
// GET: ItemFluxes/Edit/5
public ActionResult Edit(int? id, string mode)
{
+1 -1
View File
@@ -326,7 +326,7 @@ namespace StockManMVC.Controllers
using (var ctx = new StockManEntities())
{
// esegue stored procedure come function, recuperando nuovo ID creato...
var newItem = ctx.stp_ItemDuplicate(id).ToList<Item>();
var newItem = ctx.stp_ItemDuplicate(id).ToList();
newId = newItem[0].ID;
}
+18
View File
@@ -138,5 +138,23 @@ namespace StockManMVC.Models
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<CountersList>("stp_Counters_getNext", mergeOption, iDParameter);
}
public virtual ObjectResult<ItemFlux> stp_ItemFluxDuplicate(Nullable<int> original_ID)
{
var original_IDParameter = original_ID.HasValue ?
new ObjectParameter("Original_ID", original_ID) :
new ObjectParameter("Original_ID", typeof(int));
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<ItemFlux>("stp_ItemFluxDuplicate", original_IDParameter);
}
public virtual ObjectResult<ItemFlux> stp_ItemFluxDuplicate(Nullable<int> original_ID, MergeOption mergeOption)
{
var original_IDParameter = original_ID.HasValue ?
new ObjectParameter("Original_ID", original_ID) :
new ObjectParameter("Original_ID", typeof(int));
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<ItemFlux>("stp_ItemFluxDuplicate", mergeOption, original_IDParameter);
}
}
}
+23 -1
View File
@@ -4,7 +4,7 @@
<edmx:Runtime>
<!-- SSDL content -->
<edmx:StorageModels>
<Schema Namespace="StockManModel.Store" Provider="System.Data.SqlClient" ProviderManifestToken="2008" Alias="Self" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
<Schema Namespace="StockManModel.Store" Provider="System.Data.SqlClient" ProviderManifestToken="2012" Alias="Self" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
<EntityType Name="CountersList">
<Key>
<PropertyRef Name="ID" />
@@ -256,6 +256,9 @@ warning 6002: The table/view 'StockMan.dbo.vLocationVal' does not have a primary
<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_ItemFluxDuplicate" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo">
<Parameter Name="Original_ID" Type="int" Mode="In" />
</Function>
<Function Name="stp_ItemShrinkHist" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo">
<Parameter Name="ItemID" Type="int" Mode="In" />
</Function>
@@ -551,6 +554,9 @@ warning 6002: The table/view 'StockMan.dbo.vLocationVal' does not have a primary
<FunctionImport Name="stp_Counters_getNext" EntitySet="CountersList" ReturnType="Collection(StockManModel.CountersList)">
<Parameter Name="ID" Mode="In" Type="String" />
</FunctionImport>
<FunctionImport Name="stp_ItemFluxDuplicate" EntitySet="ItemFlux" ReturnType="Collection(StockManModel.ItemFlux)">
<Parameter Name="Original_ID" Mode="In" Type="Int32" />
</FunctionImport>
</EntityContainer>
<EntityType Name="ItemFamily">
<Key>
@@ -746,6 +752,20 @@ warning 6002: The table/view 'StockMan.dbo.vLocationVal' does not have a primary
<Property Type="String" Name="ID" Nullable="false" MaxLength="50" />
<Property Type="Int32" Name="NextNum" Nullable="false" />
</ComplexType>
<ComplexType Name="stp_ItemFluxDuplicate_Result">
<Property Type="Int32" Name="ID" Nullable="false" />
<Property Type="String" Name="Descr" Nullable="false" MaxLength="250" />
<Property Type="String" Name="CodInt" Nullable="false" MaxLength="50" />
<Property Type="String" Name="ItemFamilyID" Nullable="false" MaxLength="50" />
<Property Type="String" Name="CodExt" Nullable="false" MaxLength="250" />
<Property Type="String" Name="DescrExt" Nullable="false" MaxLength="250" />
<Property Type="Int32" Name="QtaMin" Nullable="false" />
<Property Type="Int32" Name="QtaBatch" Nullable="false" />
<Property Type="Decimal" Name="CurrValue" Nullable="false" Precision="18" Scale="6" />
<Property Type="Int32" Name="QtaCurr" Nullable="true" />
<Property Type="Int32" Name="QtaPend" Nullable="true" />
<Property Type="String" Name="UM" Nullable="false" MaxLength="50" />
</ComplexType>
</Schema>
</edmx:ConceptualModels>
<!-- C-S mapping content -->
@@ -889,6 +909,8 @@ warning 6002: The table/view 'StockMan.dbo.vLocationVal' does not have a primary
</EntitySetMapping>
<FunctionImportMapping FunctionImportName="stp_Counters_getNext" FunctionName="StockManModel.Store.stp_Counters_getNext">
</FunctionImportMapping>
<FunctionImportMapping FunctionImportName="stp_ItemFluxDuplicate" FunctionName="StockManModel.Store.stp_ItemFluxDuplicate">
</FunctionImportMapping>
</EntityContainerMapping>
</Mapping>
</edmx:Mappings>
@@ -0,0 +1,29 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated from a template.
//
// Manual changes to this file may cause unexpected behavior in your application.
// Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace StockManMVC.Models
{
using System;
public partial class stp_ItemFluxDuplicate_Result
{
public int ID { get; set; }
public string Descr { get; set; }
public string CodInt { get; set; }
public string ItemFamilyID { get; set; }
public string CodExt { get; set; }
public string DescrExt { get; set; }
public int QtaMin { get; set; }
public int QtaBatch { get; set; }
public decimal CurrValue { get; set; }
public Nullable<int> QtaCurr { get; set; }
public Nullable<int> QtaPend { get; set; }
public string UM { get; set; }
}
}
+11 -4
View File
@@ -238,6 +238,9 @@
<Compile Include="Models\stp_ItemDuplicate1_Result.cs">
<DependentUpon>SMModel.tt</DependentUpon>
</Compile>
<Compile Include="Models\stp_ItemFluxDuplicate_Result.cs">
<DependentUpon>SMModel.tt</DependentUpon>
</Compile>
<Compile Include="Models\stp_ItemStockMove_Result.cs">
<DependentUpon>SMModel.tt</DependentUpon>
</Compile>
@@ -326,6 +329,8 @@
<Content Include="Content\themes\base\tooltip.css" />
<Content Include="favicon.ico" />
<Content Include="fonts\fontawesome-webfont.svg" />
<Content Include="fonts\fontawesome-webfont.woff" />
<Content Include="fonts\fontawesome-webfont.woff2" />
<Content Include="fonts\glyphicons-halflings-regular.svg" />
<Content Include="Global.asax" />
<Content Include="fonts\glyphicons-halflings-regular.woff2" />
@@ -356,8 +361,6 @@
<DependentUpon>SMModel.edmx</DependentUpon>
</Content>
<Content Include="fonts\FontAwesome.otf" />
<Content Include="fonts\fontawesome-webfont.woff2" />
<Content Include="fonts\fontawesome-webfont.woff" />
<Content Include="fonts\fontawesome-webfont.ttf" />
<Content Include="fonts\fontawesome-webfont.eot" />
<Content Include="Content\Site.less" />
@@ -651,7 +654,9 @@
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>false</RunCodeAnalysis>
<CodeAnalysisRuleSet>
</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'IIS02|AnyCPU'">
<OutputPath>bin\</OutputPath>
@@ -660,7 +665,9 @@
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>false</RunCodeAnalysis>
<CodeAnalysisRuleSet>
</CodeAnalysisRuleSet>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
@@ -51,7 +51,8 @@
<td class="text-right">
@Html.DisplayFor(modelItem => item.Location1.Descr)
</td>
<td class="text-right">
<td class="text-left">
<button class="btn btn-xs btn-success" title="Clona" onclick="LoadItemFluxDupl(@item.ID);"><i class="glyphicon glyphicon-repeat"></i></button>
<button class="btn btn-xs btn-primary @delStyle" title="Modifica" onclick="LoadItemFluxEdit(@item.ID);"><i class="glyphicon glyphicon-edit"></i></button>
@Html.ActionLink(" ", "ConvOrder", new { ID = item.ID }, new { @class = "btn btn-xs btn-info glyphicon glyphicon-flash " + @delStyle + " " + @convStyle })
<button class="btn btn-xs btn-danger @delStyle" title="Elimina" onclick="LoadItemFluxDelete(@item.ID);"><i class="glyphicon glyphicon-trash"></i></button>
+5
View File
@@ -115,6 +115,11 @@
$("#divBtnIF").hide();
}
function LoadItemFluxDupl(ID) {
$("#divCreateMov").load('@(Url.Action("Duplicate", "ItemFluxes", null, Request.Url.Scheme))?ID=' + ID + '&mode=std');
$("#divBtnIF").hide();
}
function LoadItemFluxDelete(ID) {
$("#divCreateMov").load('@(Url.Action("Delete", "ItemFluxes", null, Request.Url.Scheme))?ID=' + ID + '&mode=std');
$("#divBtnIF").hide();
Binary file not shown.