Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a464c989c3 | |||
| 559206cd70 | |||
| 819928805f | |||
| 24300e8805 | |||
| 5896862614 | |||
| 70078533d2 | |||
| 07b7ad6ee3 | |||
| fc1ce2ce53 | |||
| 958421f4f5 | |||
| c32715a4b5 | |||
| a83752e565 | |||
| ec2ce96b3b | |||
| d131e0b42d | |||
| efea14db89 | |||
| c09d8a6b0f | |||
| 946ad1d29c | |||
| c5f1d1669f | |||
| 689e81219b | |||
| 05ec565f84 | |||
| 0e7866922d | |||
| fb92f9faea | |||
| f65d07ab22 | |||
| f140b6df54 | |||
| 441ddc4397 | |||
| 8c42493382 |
@@ -116,6 +116,7 @@
|
||||
<DependentUpon>NewOpenProjectFileDialogV.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="NewOpenProjectFileDialog\NewOpenProjectFileDialogVM.vb" />
|
||||
<Compile Include="ProjectFileVM\ProdItem.vb" />
|
||||
<Compile Include="Utility\DimensionsIniFile.vb" />
|
||||
<Compile Include="Utility\Enum.vb" />
|
||||
<Compile Include="MachGroupPanel\MyMachGroupPanelVM.vb" />
|
||||
|
||||
@@ -779,94 +779,3 @@ Public MustInherit Class NewOpenProjectFileDialogVM
|
||||
|
||||
End Class
|
||||
|
||||
Public Class ProdItem
|
||||
Inherits VMBase
|
||||
|
||||
Public Shared m_delIsModifiedSetUp As Action(Of Boolean)
|
||||
|
||||
Protected m_ProdFileVM As ProdFileVM
|
||||
Public ReadOnly Property ProdFileVM As ProdFileVM
|
||||
Get
|
||||
Return m_ProdFileVM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_ProjFileList As New List(Of ProjectFileVM)
|
||||
Public ReadOnly Property ProjFileList As List(Of ProjectFileVM)
|
||||
Get
|
||||
Return m_ProjFileList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sProdId As String
|
||||
Get
|
||||
Return If(Not IsNothing(m_ProdFileVM), m_ProdFileVM.sProdId, "")
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Overridable Property sName As String
|
||||
Get
|
||||
Return If(Not IsNothing(m_ProdFileVM), m_ProdFileVM.sName, "")
|
||||
End Get
|
||||
Set(value As String)
|
||||
If Not IsNothing(m_ProdFileVM) Then
|
||||
m_ProdFileVM.sName = value
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property dtCreateDate As Date
|
||||
Get
|
||||
Return If(Not IsNothing(m_ProdFileVM), {m_ProdFileVM.dtCreateDate, m_ProjFileList.Min(Function(x) x.dtCreateDate)}.Min(), m_ProjFileList.Min(Function(x) x.dtCreateDate))
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property sCreateDate As String
|
||||
Get
|
||||
Return dtCreateDate.ToString()
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sMachine As String
|
||||
Get
|
||||
If Not IsNothing(m_ProdFileVM) Then
|
||||
Return m_ProdFileVM.sMachine
|
||||
ElseIf Not IsNothing(m_ProjFileList(0)) Then
|
||||
Return m_ProjFileList(0).sMachine
|
||||
Else Return ""
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property bIsArchived As Boolean
|
||||
Get
|
||||
If Not IsNothing(m_ProdFileVM) Then
|
||||
Return m_ProdFileVM.bIsArchived
|
||||
ElseIf Not IsNothing(m_ProjFileList(0)) Then
|
||||
Return m_ProjFileList(0).bIsArchived
|
||||
Else
|
||||
Return True
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Archived_Visibility As Visibility
|
||||
Get
|
||||
Return If(bIsArchived, Visibility.Visible, Visibility.Collapsed)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Sub New(ProdFileVM As ProdFileVM, ProjFileVM As ProjFileVM)
|
||||
m_ProdFileVM = ProdFileVM
|
||||
m_ProjFileList.Add(ProjFileVM)
|
||||
End Sub
|
||||
|
||||
Sub New(ProjFileVM As ProjFileVM)
|
||||
m_ProjFileList = New List(Of ProjectFileVM)({ProjFileVM})
|
||||
End Sub
|
||||
|
||||
Sub New(ProdFileVM As ProjectFileVM, ProjFileVMList As List(Of ProjectFileVM))
|
||||
m_ProdFileVM = ProdFileVM
|
||||
m_ProjFileList = ProjFileVMList
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
@@ -42,6 +42,8 @@ Public MustInherit Class OpenProjectFileDialogVM
|
||||
|
||||
Friend Event m_CloseWindow(bDialogResult As Boolean)
|
||||
|
||||
Protected m_GoToProd As Boolean = False
|
||||
|
||||
Protected m_ProjectColumns As New ObservableCollection(Of EgtDataGridColumn)
|
||||
Public Property ProjectColumns As ObservableCollection(Of EgtDataGridColumn)
|
||||
Get
|
||||
@@ -438,7 +440,7 @@ Public MustInherit Class OpenProjectFileDialogVM
|
||||
#Region "METHODS"
|
||||
|
||||
Public MustOverride Function Init(ProjectType As ProjectType, Optional CurrProjectList As List(Of ProjectFileVM) = Nothing, Optional GoToProd As Boolean = False) As Boolean?
|
||||
Public Overridable Sub RefreshProjectList(Optional GoToProd As Boolean = False)
|
||||
Public Overridable Sub RefreshProjectList()
|
||||
End Sub
|
||||
|
||||
Protected Sub LoadColumns(ProjectType As ProjectType)
|
||||
|
||||
@@ -14,6 +14,13 @@ Public Class ProdFileM
|
||||
m_nProjIdList = value
|
||||
End Sub
|
||||
|
||||
Protected m_ProjMList As List(Of ProjFileM)
|
||||
Public ReadOnly Property ProjMList As List(Of ProjFileM)
|
||||
Get
|
||||
Return m_ProjMList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_sName As String
|
||||
Public Property sName As String
|
||||
Get
|
||||
@@ -60,6 +67,24 @@ Public Class ProdFileM
|
||||
Return NewProjectFileM
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateProdFileM(nProdId As Integer, nProjIdList As List(Of Integer), dtCreateProjDate As DateTime, sName As String, nType As BWType,
|
||||
sMachine As String, sLockedBy As String, dtLock As DateTime, bIsActive As Boolean, bIsProduced As Boolean, bIsArchived As Boolean, ProjMList As List(Of ProjFileM)) As ProdFileM
|
||||
Dim NewProjectFileM As New ProdFileM
|
||||
NewProjectFileM.m_nProdId = nProdId
|
||||
NewProjectFileM.m_nProjIdList = nProjIdList
|
||||
NewProjectFileM.m_dtCreateDate = dtCreateProjDate
|
||||
NewProjectFileM.m_sName = sName
|
||||
NewProjectFileM.m_nType = nType
|
||||
NewProjectFileM.m_sMachine = sMachine
|
||||
NewProjectFileM.m_sLockedBy = sLockedBy
|
||||
NewProjectFileM.m_dtLock = dtLock
|
||||
NewProjectFileM.m_bIsActive = bIsActive
|
||||
NewProjectFileM.m_bIsProduced = bIsProduced
|
||||
NewProjectFileM.m_bIsArchived = bIsArchived
|
||||
NewProjectFileM.m_ProjMList = ProjMList
|
||||
Return NewProjectFileM
|
||||
End Function
|
||||
|
||||
#End Region ' CONSTRUCTORS
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,116 @@
|
||||
|
||||
Imports EgtWPFLib5
|
||||
Imports System.Windows
|
||||
|
||||
Public Class ProdItem
|
||||
Inherits VMBase
|
||||
|
||||
Public Shared m_delIsModifiedSetUp As Action(Of Boolean)
|
||||
|
||||
Protected m_ProdFileVM As ProdFileVM
|
||||
Public ReadOnly Property ProdFileVM As ProdFileVM
|
||||
Get
|
||||
Return m_ProdFileVM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_ProjFileList As New List(Of ProjectFileVM)
|
||||
Public ReadOnly Property ProjFileList As List(Of ProjectFileVM)
|
||||
Get
|
||||
Return m_ProjFileList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sProdId As String
|
||||
Get
|
||||
Return If(Not IsNothing(m_ProdFileVM), m_ProdFileVM.sProdId, "")
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Overridable Property sName As String
|
||||
Get
|
||||
Return If(Not IsNothing(m_ProdFileVM), m_ProdFileVM.sName, "")
|
||||
End Get
|
||||
Set(value As String)
|
||||
If Not IsNothing(m_ProdFileVM) Then
|
||||
m_ProdFileVM.sName = value
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property dtCreateDate As Date
|
||||
Get
|
||||
Return If(Not IsNothing(m_ProdFileVM), {m_ProdFileVM.dtCreateDate, m_ProjFileList.Min(Function(x) x.dtCreateDate)}.Min(), m_ProjFileList.Min(Function(x) x.dtCreateDate))
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property sCreateDate As String
|
||||
Get
|
||||
Return dtCreateDate.ToString()
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sMachine As String
|
||||
Get
|
||||
If Not IsNothing(m_ProdFileVM) Then
|
||||
Return m_ProdFileVM.sMachine
|
||||
ElseIf Not IsNothing(m_ProjFileList(0)) Then
|
||||
Return m_ProjFileList(0).sMachine
|
||||
Else Return ""
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property bIsArchived As Boolean
|
||||
Get
|
||||
If Not IsNothing(m_ProdFileVM) Then
|
||||
Return m_ProdFileVM.bIsArchived
|
||||
ElseIf Not IsNothing(m_ProjFileList(0)) Then
|
||||
Return m_ProjFileList(0).bIsArchived
|
||||
Else
|
||||
Return True
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Archived_Visibility As Visibility
|
||||
Get
|
||||
Return If(bIsArchived, Visibility.Visible, Visibility.Collapsed)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Sub New(ProdFileVM As ProdFileVM, ProjFileVM As ProjFileVM)
|
||||
m_ProdFileVM = ProdFileVM
|
||||
m_ProjFileList.Add(ProjFileVM)
|
||||
End Sub
|
||||
|
||||
Sub New(ProjFileVM As ProjFileVM)
|
||||
m_ProjFileList = New List(Of ProjectFileVM)({ProjFileVM})
|
||||
End Sub
|
||||
|
||||
Sub New(ProdFileVM As ProjectFileVM, ProjFileVMList As List(Of ProjectFileVM))
|
||||
m_ProdFileVM = ProdFileVM
|
||||
m_ProjFileList = ProjFileVMList
|
||||
End Sub
|
||||
|
||||
|
||||
Public Shared Function CreateProdItem(nProdId As Integer, nProjIdList As List(Of Integer), dtCreateProjDate As DateTime, sName As String, nType As BWType,
|
||||
sMachine As String, sLockedBy As String, dtLock As DateTime, bIsActive As Boolean, bIsProduced As Boolean, bIsArchived As Boolean, ProjMList As List(Of ProjFileM)) As ProdItem
|
||||
|
||||
|
||||
Dim NewProdFileM = ProdFileM.CreateProdFileM(nProdId, nProjIdList, dtCreateProjDate, sName, nType, sMachine, sLockedBy, dtLock, bIsActive, bIsProduced, bIsArchived)
|
||||
Dim NewProdFileVM = New ProdFileVM(NewProdFileM)
|
||||
Dim NewProjFileVM As IEnumerable(Of ProjectFileVM)
|
||||
NewProjFileVM = ProjMList.Select(Of ProjFileVM)(Function(j) New ProjFileVM(j)).ToList
|
||||
Dim NewProdItem = New ProdItem(NewProdFileVM, NewProjFileVM.ToList)
|
||||
|
||||
Return NewProdItem
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateProdItem(ProjFileM As ProjFileM) As ProdItem
|
||||
|
||||
Dim NewProdItem = New ProdItem(New ProjFileVM(ProjFileM))
|
||||
|
||||
Return NewProdItem
|
||||
End Function
|
||||
|
||||
End Class
|
||||
@@ -13,7 +13,7 @@
|
||||
</providers>
|
||||
</entityFramework>
|
||||
<connectionStrings>
|
||||
<add name="DefaultConnection" connectionString="server=localhost;port=3306;User Id=steamware;password=Egalware_24068!;Persist Security Info=True;database=EgtBwDb_000470;SslMode=none" providerName="MySql.Data.MySqlClient" />
|
||||
<add name="DefaultConnection" connectionString="server=localhost;port=3306;User Id=steamware;password=steamware_password;Persist Security Info=True;database=EgtBwDb_000470;SslMode=none" providerName="MySql.Data.MySqlClient" />
|
||||
</connectionStrings>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Entity;
|
||||
using System.Linq;
|
||||
using static EgtBEAMWALL.Core.ConstBeam;
|
||||
|
||||
@@ -208,11 +209,11 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <summary>
|
||||
/// Elenco prod
|
||||
/// </summary>
|
||||
/// <param name="numRecord">Num max record da recuperare</param>
|
||||
/// <param name="NumRecord">Num max record da recuperare</param>
|
||||
/// <param name="OnlyActive">Solo con ALMENO 1 PROJ attivo (senza cancellazione logica)</param>
|
||||
/// <param name="ShowArchived">Se true: mostra anche archiviati (default li nasconde)</param>
|
||||
/// <returns></returns>
|
||||
public List<Core.ProdFileM> GetLastDesc(int numRecord, bool OnlyActive, bool ShowArchived = false)
|
||||
public List<Core.ProdFileM> GetLastDesc(int NumRecord, bool OnlyActive, bool ShowArchived = false)
|
||||
{
|
||||
List<Core.ProdFileM> result = new List<Core.ProdFileM>();
|
||||
//List<ProdModel> dbResult = GetLastDbModelDesc(numRecord);
|
||||
@@ -220,9 +221,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// se numRecord = 0 --> passo tutti
|
||||
if (numRecord == 0)
|
||||
if (NumRecord == 0)
|
||||
{
|
||||
numRecord = localDbCtx.ProdList.Count();
|
||||
NumRecord = localDbCtx.ProdList.Count();
|
||||
}
|
||||
// retrieve
|
||||
dbResult = localDbCtx
|
||||
@@ -235,7 +236,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
(p, e) => p)
|
||||
.Distinct()
|
||||
.OrderByDescending(x => x.ProdId)
|
||||
.Take(numRecord)
|
||||
.Take(NumRecord)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
@@ -247,13 +248,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <summary>
|
||||
/// Elenco prod
|
||||
/// </summary>
|
||||
/// <param name="dtStart">Inizio periodo estrazione</param>
|
||||
/// <param name="dtEnd">Fine periodo estrazione</param>
|
||||
/// <param name="numRecord">Num max record da recuperare</param>
|
||||
/// <param name="DtStart">Inizio periodo estrazione</param>
|
||||
/// <param name="DtEnd">Fine periodo estrazione</param>
|
||||
/// <param name="NumRecord">Num max record da recuperare</param>
|
||||
/// <param name="OnlyActive">Solo con ALMENO 1 PROJ attivo (senza cancellazione logica)</param>
|
||||
/// <param name="ShowArchived">Se true: mostra anche archiviati (default li nasconde)</param>
|
||||
/// <returns></returns>
|
||||
public List<Core.ProdFileM> GetLastDesc(DateTime dtStart, DateTime dtEnd, int numRecord, bool OnlyActive, bool ShowArchived = false)
|
||||
public List<Core.ProdFileM> GetLastDesc(DateTime DtStart, DateTime DtEnd, int NumRecord, bool OnlyActive, bool ShowArchived = false)
|
||||
{
|
||||
List<Core.ProdFileM> result = new List<Core.ProdFileM>();
|
||||
//List<ProdModel> dbResult = GetLastDbModelDesc(numRecord);
|
||||
@@ -261,14 +262,14 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// se numRecord = 0 --> passo tutti
|
||||
if (numRecord == 0)
|
||||
if (NumRecord == 0)
|
||||
{
|
||||
numRecord = localDbCtx.ProdList.Count();
|
||||
NumRecord = localDbCtx.ProdList.Count();
|
||||
}
|
||||
// retrieve
|
||||
dbResult = localDbCtx
|
||||
.ProdList
|
||||
.Where(x => x.DtCreated >= dtStart && x.DtCreated <= dtEnd && (!x.IsArchived || ShowArchived))
|
||||
.Where(x => x.DtCreated >= DtStart && x.DtCreated <= DtEnd && (!x.IsArchived || ShowArchived))
|
||||
// condizione join sui PROJ
|
||||
.Join(localDbCtx.ProjList.Where(x => x.IsActive || !OnlyActive),
|
||||
p => p.ProdDbId,
|
||||
@@ -276,7 +277,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
(p, e) => p)
|
||||
.Distinct()
|
||||
.OrderByDescending(x => x.ProdId)
|
||||
.Take(numRecord)
|
||||
.Take(NumRecord)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
@@ -285,6 +286,183 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco prod
|
||||
/// </summary>
|
||||
/// <param name="NumRecord">Num max record da recuperare</param>
|
||||
/// <param name="OnlyActive">Solo con ALMENO 1 PROJ attivo (senza cancellazione logica)</param>
|
||||
/// <param name="ShowArchived">Se true: mostra anche archiviati (default li nasconde)</param>
|
||||
/// <returns></returns>
|
||||
public List<Core.ProdItem> GetLastDescFull(int NumRecord, bool OnlyActive, bool ShowArchived = false)
|
||||
{
|
||||
List<Core.ProdItem> result = new List<Core.ProdItem>();
|
||||
// elenco prod completi
|
||||
List<ProdModel> dbResultProd = new List<ProdModel>();
|
||||
// elenco proj "orfani"
|
||||
List<ProjModel> dbResultProj = new List<ProjModel>();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// se numRecord = 0 --> passo tutti
|
||||
if (NumRecord == 0)
|
||||
{
|
||||
NumRecord = localDbCtx.ProdList.Count();
|
||||
}
|
||||
// recupero PROD + proj relativi
|
||||
dbResultProd = localDbCtx
|
||||
.ProdList
|
||||
.Where(x => (!x.IsArchived || ShowArchived))
|
||||
//.Include(j => j.)
|
||||
// condizione join sui PROJ
|
||||
.Join(localDbCtx.ProjList.Where(x => x.IsActive || !OnlyActive),
|
||||
p => p.ProdDbId,
|
||||
e => e.ProdDbId,
|
||||
(p, e) => p)
|
||||
.Distinct()
|
||||
.Include(j => j.ProjListNav)
|
||||
.OrderByDescending(x => x.ProdId)
|
||||
.Take(NumRecord)
|
||||
.ToList();
|
||||
|
||||
// recupero i proj "orfani"
|
||||
dbResultProj = localDbCtx
|
||||
.ProjList
|
||||
.Where(x => (x.IsActive || !OnlyActive) && x.Prod == null)
|
||||
.OrderByDescending(x => x.ProjId)
|
||||
.Take(NumRecord)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
// conversione
|
||||
result = dbResultProd.Select(x => coreItemConv(x)).ToList();
|
||||
var resProj = dbResultProj.Select(x => coreItemConv(x)).ToList();
|
||||
// sommo i risultati
|
||||
result.AddRange(resProj);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco prod
|
||||
/// </summary>
|
||||
/// <param name="DtStart">Inizio periodo estrazione</param>
|
||||
/// <param name="DtEnd">Fine periodo estrazione</param>
|
||||
/// <param name="NumRecord">Num max record da recuperare</param>
|
||||
/// <param name="OnlyActive">Solo con ALMENO 1 PROJ attivo (senza cancellazione logica)</param>
|
||||
/// <param name="ShowArchived">Se true: mostra anche archiviati (default li nasconde)</param>
|
||||
/// <returns></returns>
|
||||
public List<Core.ProdItem> GetLastDescFull(DateTime DtStart, DateTime DtEnd, int NumRecord, bool OnlyActive, bool ShowArchived = false)
|
||||
{
|
||||
List<Core.ProdItem> result = new List<Core.ProdItem>();
|
||||
// elenco prod completi
|
||||
List<ProdModel> dbResultProd = new List<ProdModel>();
|
||||
// elenco proj "orfani"
|
||||
List<ProjModel> dbResultProj = new List<ProjModel>();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// se numRecord = 0 --> passo tutti
|
||||
if (NumRecord == 0)
|
||||
{
|
||||
NumRecord = localDbCtx.ProdList.Count();
|
||||
}
|
||||
// retrieve
|
||||
dbResultProd = localDbCtx
|
||||
.ProdList
|
||||
.Where(x => x.DtCreated >= DtStart && x.DtCreated <= DtEnd && (!x.IsArchived || ShowArchived))
|
||||
// condizione join sui PROJ
|
||||
.Join(localDbCtx.ProjList.Where(x => x.IsActive || !OnlyActive),
|
||||
p => p.ProdDbId,
|
||||
e => e.ProdDbId,
|
||||
(p, e) => p)
|
||||
.Distinct()
|
||||
.Include(j => j.ProjListNav)
|
||||
.OrderByDescending(x => x.ProdId)
|
||||
.Take(NumRecord)
|
||||
.ToList();
|
||||
|
||||
// recupero i proj "orfani"
|
||||
dbResultProj = localDbCtx
|
||||
.ProjList
|
||||
.Where(x => (x.IsActive || !OnlyActive) && x.Prod == null && (x.DtCreated >= DtStart && x.DtCreated <= DtEnd))
|
||||
.OrderByDescending(x => x.ProjId)
|
||||
.Take(NumRecord)
|
||||
.ToList();
|
||||
}
|
||||
// conversione
|
||||
result = dbResultProd.Select(x => coreItemConv(x)).ToList();
|
||||
var resProj = dbResultProj.Select(x => coreItemConv(x)).ToList();
|
||||
// sommo i risultati
|
||||
result.AddRange(resProj);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco prod
|
||||
/// </summary>
|
||||
/// <param name="DtStart">Inizio periodo estrazione</param>
|
||||
/// <param name="DtEnd">Fine periodo estrazione</param>
|
||||
/// <param name="DtIsCreation">Ture: usa data creazione / False: usa data export</param>
|
||||
/// <param name="NumRecord">Num max record da recuperare</param>
|
||||
/// <param name="OnlyActive">Solo con ALMENO 1 PROJ attivo (senza cancellazione logica)</param>
|
||||
/// <param name="Machine">Nome Macchina (default vuoto = non usato)</param>
|
||||
/// <param name="BtlFileName">Nome file BTL (default vuoto = non usato)</param>
|
||||
/// <param name="ListName">Nome List (default vuoto = non usato)</param>
|
||||
/// <param name="ShowArchived">Se true: mostra anche archiviati (default li nasconde)</param>
|
||||
/// <returns></returns>
|
||||
public List<Core.ProdItem> GetLastDescFull(DateTime DtStart, DateTime DtEnd, bool DtIsCreation, int NumRecord, bool OnlyActive, string Machine = "", string BtlFileName = "", string ListName = "", bool ShowArchived = false)
|
||||
{
|
||||
List<Core.ProdItem> result = new List<Core.ProdItem>();
|
||||
List<ProdModel> dbResultProd = new List<ProdModel>();
|
||||
// elenco proj "orfani"
|
||||
List<ProjModel> dbResultProj = new List<ProjModel>();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// se numRecord = 0 --> passo tutti
|
||||
if (NumRecord == 0)
|
||||
{
|
||||
NumRecord = localDbCtx.ProdList.Count();
|
||||
}
|
||||
// retrieve
|
||||
dbResultProd = localDbCtx
|
||||
.ProdList
|
||||
.Where(x => (!x.IsArchived || ShowArchived))
|
||||
// condizione join sui PROJ
|
||||
.Join(localDbCtx.ProjList.Where(x =>
|
||||
(x.IsActive || !OnlyActive)
|
||||
&& (string.IsNullOrEmpty(Machine) || x.Machine.ToLower().Contains(Machine.ToLower()))
|
||||
&& (string.IsNullOrEmpty(BtlFileName) || x.BTLFileName.ToLower().Contains( BtlFileName.ToLower()))
|
||||
&& (string.IsNullOrEmpty(ListName) || x.ListName.ToLower().Contains(ListName.ToLower()))
|
||||
&& ((DtIsCreation && (x.DtCreated >= DtStart && x.DtCreated <= DtEnd)) || (!DtIsCreation && (x.DtExported >= DtStart && x.DtExported <= DtEnd)))
|
||||
),
|
||||
p => p.ProdDbId,
|
||||
e => e.ProdDbId,
|
||||
(p, e) => p)
|
||||
.Distinct()
|
||||
.Include(j => j.ProjListNav)
|
||||
.OrderByDescending(x => x.ProdId)
|
||||
.Take(NumRecord)
|
||||
.ToList();
|
||||
|
||||
// recupero i proj "orfani"
|
||||
dbResultProj = localDbCtx
|
||||
.ProjList
|
||||
.Where(x =>
|
||||
(x.IsActive || !OnlyActive)
|
||||
&& x.Prod == null
|
||||
&& (string.IsNullOrEmpty(Machine) || x.Machine.ToLower().Contains(Machine.ToLower()))
|
||||
&& (string.IsNullOrEmpty(BtlFileName) || x.BTLFileName.ToLower().Contains(BtlFileName.ToLower()))
|
||||
&& (string.IsNullOrEmpty(ListName) || x.ListName.ToLower().Contains(ListName.ToLower()))
|
||||
&& ((DtIsCreation && (x.DtCreated >= DtStart && x.DtCreated <= DtEnd)) || (!DtIsCreation && (x.DtExported >= DtStart && x.DtExported <= DtEnd))))
|
||||
.OrderByDescending(x => x.ProjId)
|
||||
.Take(NumRecord)
|
||||
.ToList();
|
||||
}
|
||||
// conversione
|
||||
result = dbResultProd.Select(x => coreItemConv(x)).ToList();
|
||||
var resProj = dbResultProj.Select(x => coreItemConv(x)).ToList();
|
||||
// sommo i risultati
|
||||
result.AddRange(resProj);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fornisce nuovo indice VUOTO da usare (allocando sul DB)
|
||||
/// </summary>
|
||||
@@ -910,6 +1088,29 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
protected Core.ProdFileM coreConv(ProdModel currProd)
|
||||
{
|
||||
Core.ProdFileM answ = Core.ProdFileM.CreateProdFileM(currProd.ProdId, ProjIdByProd(currProd.ProdId), currProd.DtCreated, currProd.Description, currProd.PType, currProd.Machine, currProd.LockedBy, currProd.LockDate, currProd.IsActive, currProd.IsProduced, currProd.IsArchived);
|
||||
//Core.ProdFileM answ = Core.ProdFileM.CreateProdFileM(currProd.ProdId, ProjIdByProd(currProd.ProdId), currProd.DtCreated, currProd.Description, currProd.PType, currProd.Machine, currProd.LockedBy, currProd.LockDate, currProd.IsActive, currProd.IsProduced, currProd.IsArchived, currProd.ProjListNav.Select(j => Core.ProjFileM.CreateProjFileM(j.ProjId, currProd.ProdId, j.DtCreated, j.DtExported, j.ListName, j.BTLFileName, j.ProjDescription, j.IsNew, j.Locked, j.PType, j.Machine, j.IsActive, j.IsActive)).ToList());
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper conversione modelli verso prodItem
|
||||
/// </summary>
|
||||
/// <param name="currProd"></param>
|
||||
/// <returns></returns>
|
||||
protected Core.ProdItem coreItemConv(ProdModel currProd)
|
||||
{
|
||||
Core.ProdItem answ = Core.ProdItem.CreateProdItem(currProd.ProdId, ProjIdByProd(currProd.ProdId), currProd.DtCreated, currProd.Description, currProd.PType, currProd.Machine, currProd.LockedBy, currProd.LockDate, currProd.IsActive, currProd.IsProduced, currProd.IsArchived, currProd.ProjListNav.Select(j => Core.ProjFileM.CreateProjFileM(j.ProjId, currProd.ProdId, j.DtCreated, j.DtExported, j.ListName, j.BTLFileName, j.ProjDescription, j.IsNew, j.Locked, j.PType, j.Machine, j.IsActive, j.IsActive)).ToList());
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper conversione modelli verso prodItem da singolo proj
|
||||
/// </summary>
|
||||
/// <param name="currProd"></param>
|
||||
/// <returns></returns>
|
||||
protected Core.ProdItem coreItemConv(ProjModel currProj)
|
||||
{
|
||||
Core.ProdItem answ = Core.ProdItem.CreateProdItem(Core.ProjFileM.CreateProjFileM(currProj.ProjId, 0, currProj.DtCreated, currProj.DtExported, currProj.ListName, currProj.BTLFileName, currProj.ProjDescription, currProj.IsNew, currProj.Locked, currProj.PType, currProj.Machine, currProj.IsActive, currProj.IsActive));
|
||||
return answ;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,8 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
var dbResult = localDbCtx
|
||||
.ProjList
|
||||
.Where(x => x.BTLFileName == BTLFileName)
|
||||
//valutare se usare solo attivi...
|
||||
//.Where(x => x.BTLFileName == BTLFileName && x.IsActive == true)
|
||||
.FirstOrDefault();
|
||||
|
||||
//se avesse trovato-- > riporto id...
|
||||
@@ -581,7 +583,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// Update record su DB x elenco BTLParts
|
||||
/// </summary>
|
||||
/// <param name="ProjId"></param>
|
||||
/// <param name="newBTLFileName"></param>
|
||||
/// <param name="BtlPartList"></param>
|
||||
/// <returns></returns>
|
||||
public ProjModel UpdateBtlParts(int ProjId, List<Core.BTLPartM> BtlPartList)
|
||||
{
|
||||
|
||||
@@ -80,6 +80,21 @@ namespace EgtBEAMWALL.DataLayer
|
||||
/// </summary>
|
||||
public DbSet<StatusMapModel> StatusMapList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Wharehouse materials management
|
||||
/// </summary>
|
||||
public DbSet<MaterialModel> MaterialsList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Wharehouse items management
|
||||
/// </summary>
|
||||
public DbSet<RawItemModel> RawItemList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Alias management
|
||||
/// </summary>
|
||||
public DbSet<AliasModel> AliasList { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
[Table("AliasList")]
|
||||
public class AliasModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Famiglia di sinonimi
|
||||
/// </summary>
|
||||
[Column("Family", Order = 1), Key]
|
||||
public string Family { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Codice originale (da trasformare)
|
||||
/// </summary>
|
||||
[Column("ValueOriginal", Order = 2), Key]
|
||||
public string ValueOriginal { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Codice Alias <inheritdoccui viene convertito/>
|
||||
/// </summary>
|
||||
public string ValueAlias { get; set; } = "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
[Table("MaterialsList")]
|
||||
public partial class MaterialModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Init classe
|
||||
/// </summary>
|
||||
public MaterialModel()
|
||||
{
|
||||
RawItemList = new HashSet<RawItemModel>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Primary Key AUTO
|
||||
/// </summary>
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int MatId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Codice materiale (Identificativo esterno del magazzino in sync)
|
||||
/// </summary>
|
||||
public int MatExtId { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Codice Materiale
|
||||
/// </summary>
|
||||
public string MatCode { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Descrizione Materiale
|
||||
/// </summary>
|
||||
public string MatDesc { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Lenght/Lunghezza in mm
|
||||
/// </summary>
|
||||
public decimal LMm { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// Width/Larghezza in mm
|
||||
/// </summary>
|
||||
public decimal WMm { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// Height (Thikness/Spessore) in mm
|
||||
/// </summary>
|
||||
public decimal HMm { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// ID dell'ultimo articolo (variante) usato per il materiale
|
||||
/// </summary>
|
||||
public int RawItemIdLast { get; set; } = 0;
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Lenght/Lunghezza in inch
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public decimal LIn
|
||||
{
|
||||
get => Math.Round(LMm / (decimal)25.4, 3);
|
||||
}
|
||||
/// <summary>
|
||||
/// Width/Larghezza in inch
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public decimal WIn
|
||||
{
|
||||
get => Math.Round(WMm / (decimal)25.4, 3);
|
||||
}
|
||||
/// <summary>
|
||||
/// Height/Altezza (Thikness/Spessore) in inch
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public decimal HIn
|
||||
{
|
||||
get => Math.Round(HMm / (decimal)25.4, 3);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Codice materiale x QR/Datamatrix
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public string MatDtmx
|
||||
{
|
||||
get => $"MT{MatExtId:00000000}";
|
||||
}
|
||||
#endif
|
||||
|
||||
public virtual ICollection<RawItemModel> RawItemList { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using static EgtBEAMWALL.Core.ConstBeam;
|
||||
@@ -19,6 +17,11 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public ProdModel()
|
||||
{
|
||||
ProjListNav = new HashSet<ProjModel>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Chiave univoca DB
|
||||
/// </summary>
|
||||
@@ -98,6 +101,11 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
[Column("IsArchived")]
|
||||
public bool IsArchived { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Collezione oggetti Proj associati (almeno 1 by design)
|
||||
/// </summary>
|
||||
public virtual ICollection<ProjModel> ProjListNav { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
//[Index(nameof(Installazione), nameof(Active), nameof(DiskStatus))]
|
||||
[Table("RawItemList")]
|
||||
public partial class RawItemModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Primary Key AUTO
|
||||
/// </summary>
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int RawItemId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ForeignKey Materiale
|
||||
/// </summary>
|
||||
public int MatId { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Qty available on wharehouse
|
||||
/// </summary>
|
||||
public int QtyAvail { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Check if is a Remnant
|
||||
/// </summary>
|
||||
public bool IsActive { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Item's Lenght
|
||||
/// </summary>
|
||||
public decimal LMm { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Item's Width
|
||||
/// </summary>
|
||||
public decimal WMm { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Item's Height (Thikness/Spessore) in mm
|
||||
/// </summary>
|
||||
public decimal HMm { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Note (optional)
|
||||
/// </summary>
|
||||
public string Note { get; set; } = "";
|
||||
|
||||
#if false
|
||||
[NotMapped]
|
||||
public decimal LIn
|
||||
{
|
||||
get => Math.Round(LMm / (decimal)25.4, 3);
|
||||
}
|
||||
[NotMapped]
|
||||
public decimal WIn
|
||||
{
|
||||
get => Math.Round(WMm / (decimal)25.4, 3);
|
||||
}
|
||||
[NotMapped]
|
||||
public decimal HIn
|
||||
{
|
||||
get => Math.Round(HMm / (decimal)25.4, 3);
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public decimal Area
|
||||
{
|
||||
get => LMm * WMm;
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public string ItemDtmx
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = $"MT99999999-{LMm * 1000:00000000}";
|
||||
if (MaterialNav != null)
|
||||
{
|
||||
answ = $"MT{MaterialNav.MatExtId:00000000}-{LMm * 1000:00000000}";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Navigation property to Material
|
||||
/// </summary>
|
||||
[ForeignKey("MatId")]
|
||||
public virtual MaterialModel MaterialNav { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -33,9 +33,9 @@ namespace EgtBEAMWALL.DataLayer
|
||||
public static string ADMIN_CONNECTION_STRING { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// DB Connection string, per effettuare migration riportare valore connessione admin cablato (server=localhost;port=3306;database=EgtBwDb_000102;)
|
||||
/// DB Connection string, per effettuare migration riportare valore connessione admin cablato (server=localhost;port=3306;database=EgtBwDb_000102;uid=root;pwd=Egalware_24068!;)
|
||||
/// </summary>
|
||||
public static string CONNECTION_STRING { get; set; } = "";
|
||||
public static string CONNECTION_STRING { get; set; } = "server=localhost;port=3306;database=EgtBwDb_000470;uid=root;pwd=Egalware_24068!";
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
|
||||
@@ -126,6 +126,9 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AdminContext.cs" />
|
||||
<Compile Include="DatabaseModels\AliasModel.cs" />
|
||||
<Compile Include="DatabaseModels\MaterialModel.cs" />
|
||||
<Compile Include="DatabaseModels\RawItemModel.cs" />
|
||||
<Compile Include="DatabaseModels\UserPrivModel.cs" />
|
||||
<Compile Include="DbConfig.cs" />
|
||||
<Compile Include="Controllers\LogMachineController.cs" />
|
||||
@@ -187,6 +190,10 @@
|
||||
<Compile Include="Migrations\202308250853396_AddProjArchivedField.designer.cs">
|
||||
<DependentUpon>202308250853396_AddProjArchivedField.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202401181534084_AddAliasMaterialRawItemsModel.cs" />
|
||||
<Compile Include="Migrations\202401181534084_AddAliasMaterialRawItemsModel.designer.cs">
|
||||
<DependentUpon>202401181534084_AddAliasMaterialRawItemsModel.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\Configuration.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Utils.cs" />
|
||||
@@ -235,6 +242,9 @@
|
||||
<EmbeddedResource Include="Migrations\202308250853396_AddProjArchivedField.resx">
|
||||
<DependentUpon>202308250853396_AddProjArchivedField.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202401181534084_AddAliasMaterialRawItemsModel.resx">
|
||||
<DependentUpon>202401181534084_AddAliasMaterialRawItemsModel.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
|
||||
Generated
+29
@@ -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 AddAliasMaterialRawItemsModel : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(AddAliasMaterialRawItemsModel));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "202401181534084_AddAliasMaterialRawItemsModel"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class AddAliasMaterialRawItemsModel : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
CreateTable(
|
||||
"dbo.AliasList",
|
||||
c => new
|
||||
{
|
||||
Family = c.String(nullable: false, maxLength: 128, storeType: "nvarchar"),
|
||||
ValueOriginal = c.String(nullable: false, maxLength: 128, storeType: "nvarchar"),
|
||||
ValueAlias = c.String(unicode: false),
|
||||
})
|
||||
.PrimaryKey(t => new { t.Family, t.ValueOriginal });
|
||||
|
||||
CreateTable(
|
||||
"dbo.MaterialsList",
|
||||
c => new
|
||||
{
|
||||
MatId = c.Int(nullable: false, identity: true),
|
||||
MatExtId = c.Int(nullable: false),
|
||||
MatCode = c.String(unicode: false),
|
||||
MatDesc = c.String(unicode: false),
|
||||
LMm = c.Decimal(nullable: false, precision: 18, scale: 2),
|
||||
WMm = c.Decimal(nullable: false, precision: 18, scale: 2),
|
||||
HMm = c.Decimal(nullable: false, precision: 18, scale: 2),
|
||||
RawItemIdLast = c.Int(nullable: false),
|
||||
})
|
||||
.PrimaryKey(t => t.MatId);
|
||||
|
||||
CreateTable(
|
||||
"dbo.RawItemList",
|
||||
c => new
|
||||
{
|
||||
RawItemId = c.Int(nullable: false, identity: true),
|
||||
MatId = c.Int(nullable: false),
|
||||
QtyAvail = c.Int(nullable: false),
|
||||
IsActive = c.Boolean(nullable: false),
|
||||
LMm = c.Decimal(nullable: false, precision: 18, scale: 2),
|
||||
WMm = c.Decimal(nullable: false, precision: 18, scale: 2),
|
||||
HMm = c.Decimal(nullable: false, precision: 18, scale: 2),
|
||||
Note = c.String(unicode: false),
|
||||
})
|
||||
.PrimaryKey(t => t.RawItemId)
|
||||
.ForeignKey("dbo.MaterialsList", t => t.MatId, cascadeDelete: true)
|
||||
.Index(t => t.MatId);
|
||||
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropForeignKey("dbo.RawItemList", "MatId", "dbo.MaterialsList");
|
||||
DropIndex("dbo.RawItemList", new[] { "MatId" });
|
||||
DropTable("dbo.RawItemList");
|
||||
DropTable("dbo.MaterialsList");
|
||||
DropTable("dbo.AliasList");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -11,13 +11,14 @@ Public Class OpenProjectFileDialogVM
|
||||
|
||||
Public Overrides Function Init(ProjectType As ProjectType, Optional CurrProjectList As List(Of ProjectFileVM) = Nothing, Optional GoToProd As Boolean = False) As Boolean?
|
||||
m_ProjectType = ProjectType
|
||||
m_GoToProd = GoToProd
|
||||
' carico colonne
|
||||
LoadColumns(m_ProjectType)
|
||||
NotifyPropertyChanged(NameOf(FilterTypeList))
|
||||
m_SelFilterType = m_FilterTypeList(0)
|
||||
' carico lista progetti
|
||||
If IsNothing(CurrProjectList) OrElse CurrProjectList.Count = 0 Then
|
||||
RefreshProjectList(GoToProd)
|
||||
RefreshProjectList()
|
||||
Else
|
||||
m_ProjectList = New ObservableCollection(Of ProjectFileVM)(CurrProjectList)
|
||||
NotifyPropertyChanged(NameOf(ProjectList))
|
||||
@@ -26,7 +27,7 @@ Public Class OpenProjectFileDialogVM
|
||||
m_ProjectList_View.Filter = AddressOf ProjectFilter
|
||||
End Function
|
||||
|
||||
Public Overrides Sub RefreshProjectList(Optional GoToProd As Boolean = False)
|
||||
Public Overrides Sub RefreshProjectList()
|
||||
m_ProjectList.Clear()
|
||||
' calcolo periodo e righe
|
||||
Dim dtStart As DateTime
|
||||
|
||||
@@ -12,6 +12,7 @@ Public Class OpenProjectFileDialogVM
|
||||
|
||||
Public Overrides Function Init(ProjectType As ProjectType, Optional CurrProjectList As List(Of ProjectFileVM) = Nothing, Optional GoToProd As Boolean = False) As Boolean?
|
||||
m_ProjectType = ProjectType
|
||||
m_GoToProd = GoToProd
|
||||
' carico colonne
|
||||
LoadColumns(ProjectType)
|
||||
NotifyPropertyChanged(NameOf(FilterTypeList))
|
||||
@@ -19,7 +20,7 @@ Public Class OpenProjectFileDialogVM
|
||||
' carico lista progetti
|
||||
If IsNothing(CurrProjectList) OrElse CurrProjectList.Count = 0 Then
|
||||
SetFixedProjectList(False)
|
||||
RefreshProjectList(GoToProd)
|
||||
RefreshProjectList()
|
||||
Else
|
||||
SetFixedProjectList(True)
|
||||
m_ProjectList = New ObservableCollection(Of ProjectFileVM)(CurrProjectList)
|
||||
@@ -29,7 +30,7 @@ Public Class OpenProjectFileDialogVM
|
||||
m_ProjectList_View.Filter = AddressOf ProjectFilter
|
||||
End Function
|
||||
|
||||
Public Overrides Sub RefreshProjectList(Optional GoToProd As Boolean = False)
|
||||
Public Overrides Sub RefreshProjectList()
|
||||
m_ProjectList.Clear()
|
||||
' calcolo periodo e righe
|
||||
Dim dtStart As DateTime
|
||||
@@ -66,30 +67,15 @@ Public Class OpenProjectFileDialogVM
|
||||
Else
|
||||
DbProjectList = DbControllers.m_ProjController.GetLastByExpDesc(dtStart, dtEnd, nRowQuantity, False)
|
||||
End If
|
||||
For Each Project In DbProjectList
|
||||
' recupero path per verificare esista
|
||||
If IsNothing(Project.nProjId) OrElse Project.nProjId = 0 Then Continue For
|
||||
Dim sPath As String = Map.refMainWindowVM.MainWindowM.sProjsDir & "\" & Project.nProjId.ToString("0000") & "\" & Project.nProjId.ToString("0000") & ".nge"
|
||||
If File.Exists(sPath) Then
|
||||
m_ProjectList.Add(New ProjFileVM(Project))
|
||||
Else
|
||||
' CheckMe impostata come cancellazione FISICA dal DB...
|
||||
DbControllers.m_ProjController.DeleteProj(Project.nProjId, False)
|
||||
EgtOutLog("Found project on Db without the folder and erased it! Proj number " & Project.nProjId.ToString("0000"))
|
||||
End If
|
||||
Next
|
||||
ElseIf m_ProjectType = ProjectType.PROD Then
|
||||
Dim DbProjectList As New List(Of ProdFileM)
|
||||
DbProjectList = DbControllers.m_ProdController.GetLastDesc(dtStart, dtEnd, nRowQuantity, True)
|
||||
If GoToProd Then
|
||||
If m_GoToProd Then
|
||||
For Each Project In DbProjectList
|
||||
' recupero path per verificare esista
|
||||
If IsNothing(Project.nProdId) OrElse Project.nProdId = 0 Then Continue For
|
||||
Dim sPath As String = Map.refMainWindowVM.MainWindowM.sProdsDir & "\" & Project.nProdId.ToString("0000") & "\" & Project.nProdId.ToString("0000") & ".nge"
|
||||
Dim sPath As String = Map.refMainWindowVM.MainWindowM.sProjsDir & "\" & Project.nProjId.ToString("0000") & "\" & Project.nProjId.ToString("0000") & ".nge"
|
||||
If Project.sMachine = Map.refProjManagerVM.CurrProj.sMachine AndAlso
|
||||
Project.nType = Map.refProjManagerVM.CurrProj.nType Then
|
||||
If File.Exists(sPath) Then
|
||||
m_ProjectList.Add(New ProdFileVM(Project))
|
||||
m_ProjectList.Add(New ProjFileVM(Project))
|
||||
Else
|
||||
DbControllers.m_ProdController.DeleteProd(Project.nProdId, True)
|
||||
EgtOutLog("Found project on Db without the folder and erased it! Prod number " & Project.nProdId.ToString("0000"))
|
||||
@@ -99,16 +85,31 @@ Public Class OpenProjectFileDialogVM
|
||||
Else
|
||||
For Each Project In DbProjectList
|
||||
' recupero path per verificare esista
|
||||
If IsNothing(Project.nProdId) OrElse Project.nProdId = 0 Then Continue For
|
||||
Dim sPath As String = Map.refMainWindowVM.MainWindowM.sProdsDir & "\" & Project.nProdId.ToString("0000") & "\" & Project.nProdId.ToString("0000") & ".nge"
|
||||
If IsNothing(Project.nProjId) OrElse Project.nProjId = 0 Then Continue For
|
||||
Dim sPath As String = Map.refMainWindowVM.MainWindowM.sProjsDir & "\" & Project.nProjId.ToString("0000") & "\" & Project.nProjId.ToString("0000") & ".nge"
|
||||
If File.Exists(sPath) Then
|
||||
m_ProjectList.Add(New ProdFileVM(Project))
|
||||
m_ProjectList.Add(New ProjFileVM(Project))
|
||||
Else
|
||||
DbControllers.m_ProdController.DeleteProd(Project.nProdId, True)
|
||||
EgtOutLog("Found project on Db without the folder and erased it! Prod number " & Project.nProdId.ToString("0000"))
|
||||
' CheckMe impostata come cancellazione FISICA dal DB...
|
||||
DbControllers.m_ProjController.DeleteProj(Project.nProjId, False)
|
||||
EgtOutLog("Found project on Db without the folder and erased it! Proj number " & Project.nProjId.ToString("0000"))
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
ElseIf m_ProjectType = ProjectType.PROD Then
|
||||
Dim DbProjectList As New List(Of ProdFileM)
|
||||
DbProjectList = DbControllers.m_ProdController.GetLastDesc(dtStart, dtEnd, nRowQuantity, True)
|
||||
For Each Project In DbProjectList
|
||||
' recupero path per verificare esista
|
||||
If IsNothing(Project.nProdId) OrElse Project.nProdId = 0 Then Continue For
|
||||
Dim sPath As String = Map.refMainWindowVM.MainWindowM.sProdsDir & "\" & Project.nProdId.ToString("0000") & "\" & Project.nProdId.ToString("0000") & ".nge"
|
||||
If File.Exists(sPath) Then
|
||||
m_ProjectList.Add(New ProdFileVM(Project))
|
||||
Else
|
||||
DbControllers.m_ProdController.DeleteProd(Project.nProdId, True)
|
||||
EgtOutLog("Found project on Db without the folder and erased it! Prod number " & Project.nProdId.ToString("0000"))
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user