Compare commits

...

5 Commits

Author SHA1 Message Date
Samuele Locatelli 52c1fa654e Correzione naming e nuova dll sync 2024-08-05 14:39:23 +02:00
Samuele Locatelli 43ebd3db5b Modifica controller rawitems
- sync stato cancellato
- fix upsert a fine modifica magazzino che riporta a zero cloudID
2024-08-05 14:06:05 +02:00
Samuele Locatelli 3aab1d8d8c Aggiunta cancellazione logica x rawItemsID 2024-08-05 14:05:33 +02:00
Samuele Locatelli 96e78e1c72 Update in aggiornamento rawItem: trova duplicato e da errore 2024-08-02 10:45:17 +02:00
Samuele Locatelli 7cc1eb1561 Fix update materiali: descrizione aggioranta SOLO SE !=null 2024-07-29 13:46:33 +02:00
8 changed files with 234 additions and 21 deletions
@@ -88,9 +88,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
MatId = coreRec.nId,
MatCode = coreRec.sWarehouseMaterial,
HMm = (decimal)Math.Round(coreRec.dH,2),
LMm = (decimal)Math.Round(coreRec.dL,2),
WMm = (decimal)Math.Round(coreRec.dW,2),
HMm = (decimal)Math.Round(coreRec.dH, 2),
LMm = (decimal)Math.Round(coreRec.dL, 2),
WMm = (decimal)Math.Round(coreRec.dW, 2),
};
}
return answ;
@@ -416,7 +416,11 @@ namespace EgtBEAMWALL.DataLayer.Controllers
//// update, vers 1...
//localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
item2update.MatCloudId = updItem.MatCloudId;
item2update.MatDesc = updItem.MatDesc;
// aggiorno SE presente...
if (!string.IsNullOrEmpty(updItem.MatDesc))
{
item2update.MatDesc = updItem.MatDesc;
}
localDbCtx.Entry(item2update).State = System.Data.Entity.EntityState.Modified;
// Commit changes
localDbCtx.SaveChanges();
@@ -455,7 +459,11 @@ namespace EgtBEAMWALL.DataLayer.Controllers
//// update, vers 1...
//localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
item2update.MatCloudId = updItem.MatCloudId;
item2update.MatDesc = updItem.MatDesc;
// aggiorno SE presente...
if (!string.IsNullOrEmpty(updItem.MatDesc))
{
item2update.MatDesc = updItem.MatDesc;
}
localDbCtx.Entry(item2update).State = System.Data.Entity.EntityState.Modified;
// Commit changes
localDbCtx.SaveChanges();
@@ -50,6 +50,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
RawItemCloudId = currRec.RawItemCloudId,
RawItemLocalId = currRec.RawItemId,
IsRemn = currRec.IsRemn,
IsDeleted = currRec.IsDeleted,
QtyAvail = currRec.QtyAvail,
HMm = currRec.HMm,
LMm = currRec.LMm,
@@ -76,7 +77,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
LMm = currRec.LMm,
WMm = currRec.WMm,
MatId = currRec.MatLocalId,
IsDeleted = currRec.IsDeleted,
IsRemn = currRec.IsRemn,
// attivo = selezionato x nesting
IsActive = isActive,
UseQty = true,
Note = currRec.Note
@@ -102,7 +105,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
WMm = currRec.WMm,
MatId = matLocalId,
IsRemn = currRec.IsRemn,
IsActive = currRec.IsActive,
IsDeleted = currRec.IsDeleted,
UseQty = true,
Note = currRec.Note
};
@@ -123,8 +126,8 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
RawItemId = coreRec.nId,
MatId = coreRec.Material.nId,
HMm = (decimal)Math.Round(coreRec.Material.dH,2),
LMm = (decimal)Math.Round(coreRec.dL,2),
HMm = (decimal)Math.Round(coreRec.Material.dH, 2),
LMm = (decimal)Math.Round(coreRec.dL, 2),
WMm = coreRec.dW > 0 ? (decimal)Math.Round(coreRec.dW, 2) : (decimal)Math.Round(coreRec.Material.dW, 2),
IsActive = coreRec.bActive,
UseQty = coreRec.bUseQuantity,
@@ -178,13 +181,27 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
var items2del = localDbCtx
.RawItemList
.Where(x => x.RawItemId == RawItemId);
.Where(x => x.RawItemId == RawItemId)
.FirstOrDefault();
try
{
// Add to database
localDbCtx.RawItemList.RemoveRange(items2del);
// Commit changes
localDbCtx.SaveChanges();
// verifico SE esista
if (items2del != null)
{
// verifico seabbia un cloud id (fa canc logica)...
if (items2del.RawItemCloudId > 0)
{
items2del.IsDeleted = true;
localDbCtx.Entry(items2del).State = EntityState.Modified;
}
else
{
// ...o meno: fa eliminazione vera
localDbCtx.RawItemList.Remove(items2del);
}
// Commit changes
localDbCtx.SaveChanges();
}
done = true;
}
catch (Exception exc)
@@ -278,17 +295,20 @@ namespace EgtBEAMWALL.DataLayer.Controllers
.RawItemList
.Where(x => (updItem.RawItemId > 0 && x.RawItemId == updItem.RawItemId)
|| (x.MatId == updItem.MatId && x.WMm == updItem.WMm && x.HMm == updItem.HMm && x.LMm == updItem.LMm))
.SingleOrDefault();
.FirstOrDefault();
if (item2update != null)
{
//// update, vers 1...
//localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);\
item2update.RawItemCloudId = updItem.RawItemCloudId;
// se ho un valore > 0 x CloudId sennò NON modifica
if (updItem.RawItemCloudId > 0)
{
item2update.RawItemCloudId = updItem.RawItemCloudId;
}
item2update.HMm = updItem.HMm;
item2update.LMm = updItem.LMm;
item2update.WMm = updItem.WMm;
item2update.IsActive = updItem.IsActive;
item2update.IsDeleted = updItem.IsDeleted;
item2update.IsRemn = updItem.IsRemn;
if (changeUseQty)
{
@@ -297,7 +317,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
if (changeQtyAvail)
{
item2update.QtyAvail = updItem.QtyAvail;
item2update.LastSync = DateTime.Now;
item2update.LastSync = DateTime.Now;
}
localDbCtx.Entry(item2update).State = EntityState.Modified;
}
@@ -37,7 +37,7 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
public int QtyAvail { get; set; } = 0;
/// <summary>
/// Active/ = can be used
/// Active = can be used
/// </summary>
public bool IsActive { get; set; } = false;
@@ -46,6 +46,11 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
/// </summary>
public bool IsRemn { get; set; } = false;
/// <summary>
/// Deleted = from cloud, not to use
/// </summary>
public bool IsDeleted { get; set; } = false;
/// <summary>
/// Item's Lenght
/// </summary>
@@ -47,7 +47,7 @@
<HintPath>..\ExtLibs\EgtWPFLib5.dll</HintPath>
</Reference>
<Reference Include="EgwProxy.MagMan, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\EgwProxy.MagMan.1.0.2407.1708\lib\EgwProxy.MagMan.dll</HintPath>
<HintPath>..\packages\EgwProxy.MagMan.1.0.2408.514\lib\EgwProxy.MagMan.dll</HintPath>
</Reference>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
@@ -277,6 +277,10 @@
<Compile Include="Migrations\202407170704518_AddProdDtLastMod.Designer.cs">
<DependentUpon>202407170704518_AddProdDtLastMod.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\202408051054365_AddRawItemLogicalDelete.cs" />
<Compile Include="Migrations\202408051054365_AddRawItemLogicalDelete.Designer.cs">
<DependentUpon>202408051054365_AddRawItemLogicalDelete.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\Configuration.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utils.cs" />
@@ -364,6 +368,9 @@
<EmbeddedResource Include="Migrations\202407170704518_AddProdDtLastMod.resx">
<DependentUpon>202407170704518_AddProdDtLastMod.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\202408051054365_AddRawItemLogicalDelete.resx">
<DependentUpon>202408051054365_AddRawItemLogicalDelete.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Content Include="SqlScripts\Stored\stp_LogMachineFixPid.sql">
@@ -0,0 +1,29 @@
// <auto-generated />
namespace EgtBEAMWALL.DataLayer.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
public sealed partial class AddRawItemLogicalDelete : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(AddRawItemLogicalDelete));
string IMigrationMetadata.Id
{
get { return "202408051054365_AddRawItemLogicalDelete"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}
@@ -0,0 +1,18 @@
namespace EgtBEAMWALL.DataLayer.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class AddRawItemLogicalDelete : DbMigration
{
public override void Up()
{
AddColumn("dbo.RawItemList", "IsDeleted", c => c.Boolean(nullable: false, defaultValue: false, defaultValueSql: "0"));
}
public override void Down()
{
DropColumn("dbo.RawItemList", "IsDeleted");
}
}
}
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -2,7 +2,7 @@
<packages>
<package id="BouncyCastle.Cryptography" version="2.4.0" targetFramework="net472" />
<package id="DotNetZip" version="1.16.0" targetFramework="net472" />
<package id="EgwProxy.MagMan" version="1.0.2407.1708" targetFramework="net472" />
<package id="EgwProxy.MagMan" version="1.0.2408.514" targetFramework="net472" />
<package id="EntityFramework" version="6.4.4" targetFramework="net452" />
<package id="Google.Protobuf" version="3.27.0" targetFramework="net472" />
<package id="K4os.Compression.LZ4" version="1.3.8" targetFramework="net472" />