Compare commits

..

3 Commits

Author SHA1 Message Date
Demetrio Cassarino ecaedb0ed2 controllo errore script aggiunta pezzo 2024-01-24 10:31:25 +01:00
Demetrio Cassarino 9a0f478529 -aggiunto controllo quando execbeam fallisce 2024-01-18 17:52:24 +01:00
Demetrio Cassarino 70761248ff aggiunto a travi, rotazione e inversione 2024-01-17 09:17:16 +01:00
74 changed files with 683 additions and 5898 deletions
+2
View File
@@ -144,6 +144,8 @@
Public Const BTL_PRT_INVERTED As String = "INVERTED"
Public Const BTL_PRT_MATERIAL As String = "MATERIAL"
Public Const BTL_PRT_VOLUME As String = "VOLUME"
Public Const BTL_PRT_ROT As String = "ROT"
Public Const BTL_PRT_FLIP As String = "FLIP"
' parametri pezzo
Public Const BTL_PRT_SINGLEMEMBERNUM = "SINGLEMEMBERNUMBER"
Public Const BTL_PRT_ASSEMBLYNUM = "ASSEMBLYNUMBER"
@@ -23,6 +23,5 @@
Public Const COL_USAGE As String = "colUSAGE"
Public Const COL_WASTE As String = "colWASTE"
Public Const COL_ARCHIVED As String = "colARCHIVED"
Public Const COL_USEQTY As String = "colUSEQTY"
End Module
-3
View File
@@ -47,7 +47,6 @@ Public Module ConstIni
Public Const K_FASTPRODUCE As String = "FastProduce"
Public Const K_ADDPROJ As String = "AddProj"
Public Const K_PROJECTMODE As String = "ProjectMode"
Public Const K_NETWAREHOUSE As String = "NetWarehouse"
'Public Const S_LANGUAGES As String = "Languages"
'Public Const K_LANGUAGE As String = "Language"
@@ -163,8 +162,6 @@ Public Module ConstIni
Public Const S_WAREHOUSE As String = "Warehouse"
Public Const K_TYPE As String = "Type"
Public Const K_DEFAULTQUANTITY As String = "DefaultQuantity"
Public Const K_LASTSYNCHRONIZATION As String = "LastSynchronization"
Public Const K_USENETWAREHOUSE As String = "UseNetWarehouse"
Public Const S_BACKUPANDRESTORE As String = "Backup&Restore"
Public Const K_EXTERNALBACKUPACTIVE As String = "ExternalBackupActive"
-3
View File
@@ -116,7 +116,6 @@
<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" />
@@ -146,7 +145,6 @@
<Compile Include="Lib\MachGroupPanelM.vb" />
<Compile Include="MachGroupModel\MyMachGroupPanelM.vb" />
<Compile Include="Utility\ManageWindow.vb" />
<Compile Include="Utility\RawPart.vb" />
<Compile Include="Utility\MyMachine.vb" />
<Compile Include="OpenProjectFileDialog\OpenProjectFileDialogV.xaml.vb">
<DependentUpon>OpenProjectFileDialogV.xaml</DependentUpon>
@@ -159,7 +157,6 @@
<Compile Include="ProjectManager\ProjectFileVM.vb" />
<Compile Include="ProjectManager\ProjFileVM.vb" />
<Compile Include="ProjectFileVM\ProjFileM.vb" />
<Compile Include="Utility\Material.vb" />
<Compile Include="Utility\SectionXMaterial.vb" />
<Compile Include="Utility\BTLIniFile.vb" />
<Compile Include="Utility\CoreMap.vb" />
+2
View File
@@ -482,6 +482,8 @@ Public Class PartM
EgtGetInfo(nPartId, BTL_PRT_GROUP, NewPartM.m_sGROUP)
EgtGetInfo(nPartId, BTL_PRT_STOREY, NewPartM.m_sSTOREY)
EgtGetInfo(nPartId, BTL_PRT_MATERIAL, NewPartM.m_sMATERIAL)
EgtGetInfo(nPartId, BTL_PRT_ROT, NewPartM.m_dROT)
EgtGetInfo(nPartId, BTL_PRT_FLIP, NewPartM.m_nFLIP)
Dim nTemp As Integer = 0
If Not EgtGetInfo(nPartId, BTL_PRT_ROTATED, nTemp) Then
nTemp = 0
@@ -779,3 +779,94 @@ 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,8 +42,6 @@ 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
@@ -440,7 +438,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()
Public Overridable Sub RefreshProjectList(Optional GoToProd As Boolean = False)
End Sub
Protected Sub LoadColumns(ProjectType As ProjectType)
+1 -37
View File
@@ -14,13 +14,6 @@ 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
@@ -41,16 +34,6 @@ Public Class ProdFileM
End Set
End Property
Protected m_nProjCloudId As Integer
Public Property nProjCloudId As Integer
Get
Return m_nProjCloudId
End Get
Set(value As Integer)
m_nProjCloudId = value
End Set
End Property
#Region "CONSTRUCTORS"
Protected Sub New()
@@ -61,7 +44,7 @@ Public Class ProdFileM
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, Optional nProjCloudId As Integer = 0) As ProdFileM
sMachine As String, sLockedBy As String, dtLock As DateTime, bIsActive As Boolean, bIsProduced As Boolean, bIsArchived As Boolean) As ProdFileM
Dim NewProjectFileM As New ProdFileM
NewProjectFileM.m_nProdId = nProdId
NewProjectFileM.m_nProjIdList = nProjIdList
@@ -74,25 +57,6 @@ Public Class ProdFileM
NewProjectFileM.m_bIsActive = bIsActive
NewProjectFileM.m_bIsProduced = bIsProduced
NewProjectFileM.m_bIsArchived = bIsArchived
NewProjectFileM.m_nProjCloudId = nProjCloudId
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
-116
View File
@@ -1,116 +0,0 @@
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
+10 -21
View File
@@ -29,35 +29,25 @@ Public Class ProjFileM
End Property
Protected m_sDescription As String = String.Empty
Public Property sDescription As String
Get
Return m_sDescription
End Get
Set(value As String)
m_sDescription = value
End Set
End Property
Protected m_nProjCloudId As Integer
Public Property nProjCloudId As Integer
Get
Return m_nProjCloudId
End Get
Set(value As Integer)
m_nProjCloudId = value
End Set
End Property
Public Property sDescription As String
Get
Return m_sDescription
End Get
Set(value As String)
m_sDescription = value
End Set
End Property
#Region "CONSTRUCTORS"
Protected Sub New()
Protected Sub New()
End Sub
Public Shared Function CreateNewProjFileM() As ProjFileM
Return New ProjFileM
End Function
Public Shared Function CreateProjFileM(nProjId As Integer, nProdId As Integer, dtCreateProjDate As DateTime, dtExportDate As DateTime, sListName As String, sBTLFileName As String, sDescription As String, IsNew As Boolean, IsLocked As Boolean, nType As BWType, sMachine As String, bIsActive As Boolean, bIsArchived As Boolean, Optional nProjCloudId As Integer = 0) As ProjFileM
Public Shared Function CreateProjFileM(nProjId As Integer, nProdId As Integer, dtCreateProjDate As DateTime, dtExportDate As DateTime, sListName As String, sBTLFileName As String, sDescription As String, IsNew As Boolean, IsLocked As Boolean, nType As BWType, sMachine As String, bIsActive As Boolean, bIsArchived As Boolean) As ProjFileM
Dim NewProjectFileM As New ProjFileM
NewProjectFileM.m_nProjId = nProjId
NewProjectFileM.m_nProdId = nProdId
@@ -72,7 +62,6 @@ Public Class ProjFileM
NewProjectFileM.m_sMachine = sMachine
NewProjectFileM.m_bIsActive = bIsActive
NewProjectFileM.m_bIsArchived = bIsArchived
NewProjectFileM.m_nProjCloudId = nProjCloudId
Return NewProjectFileM
End Function
-90
View File
@@ -1,90 +0,0 @@
Imports System.Windows
Imports EgtUILib
Imports EgtWPFLib5
Public Class MaterialM
Protected m_nId As Integer
Public ReadOnly Property nId As Integer
Get
Return m_nId
End Get
End Property
Public Sub SetId(nId As Integer)
m_nId = nId
End Sub
Protected m_sMaterial As String
Public ReadOnly Property sMaterial As String
Get
Return m_sMaterial
End Get
End Property
Protected m_sWarehouseMaterial As String
Public ReadOnly Property sWarehouseMaterial As String
Get
Return m_sWarehouseMaterial
End Get
End Property
Protected m_dW As Double = 0
Public ReadOnly Property dW As Double
Get
Return m_dW
End Get
End Property
Protected m_dH As Double = 0
Public ReadOnly Property dH As Double
Get
Return m_dH
End Get
End Property
Protected m_dL As Double = 0
Public ReadOnly Property dL As Double
Get
Return m_dL
End Get
End Property
Shared Operator =(ByVal S1 As MaterialM, ByVal S2 As MaterialM) As Boolean
If IsNothing(S1) OrElse IsNothing(S2) Then Return False
Return (Math.Abs(S1.m_dH - S2.m_dH) < 100 * EPS_SMALL AndAlso
Math.Abs(S1.m_dW - S2.m_dW) < 100 * EPS_SMALL AndAlso
Math.Abs(S1.m_dL - S2.m_dL) < 100 * EPS_SMALL AndAlso
S1.m_sWarehouseMaterial = S2.m_sWarehouseMaterial)
End Operator
Shared Operator <>(ByVal S1 As MaterialM, ByVal S2 As MaterialM) As Boolean
Return Not S1 = S2
End Operator
Public Overrides Function Equals(ByVal obj As Object) As Boolean
If TypeOf obj Is MaterialM Then
Return Me = DirectCast(obj, MaterialM) '(m_dH = obj.dH AndAlso m_dW = obj.dW AndAlso m_dL = obj.dL AndAlso m_Material.Any(Function(x) DirectCast(obj.sMaterial, List(Of String)).Any(Function(y) y = x)))
End If
Return False
End Function
Sub New(dW As Double, dH As Double, dL As Double, sMaterial As String, sWarehouseMaterial As String)
m_dW = dW
m_dH = dH
m_dL = dL
m_sMaterial = sMaterial
m_sWarehouseMaterial = sWarehouseMaterial
End Sub
Sub New(nId As Integer, dW As Double, dH As Double, dL As Double, sMaterial As String, sWarehouseMaterial As String)
m_nId = nId
m_dW = dW
m_dH = dH
m_dL = dL
m_sMaterial = sMaterial
m_sWarehouseMaterial = sWarehouseMaterial
End Sub
End Class
-107
View File
@@ -1,107 +0,0 @@
Imports EgtWPFLib5
Public Class RawPartM
Inherits VMBase
Protected m_nId As Integer
Public ReadOnly Property nId As Integer
Get
Return m_nId
End Get
End Property
Public Sub SetId(nId As Integer)
m_nId = nId
End Sub
Private m_bActive As Boolean
Public Property bActive As Boolean
Get
Return m_bActive
End Get
Set(value As Boolean)
m_bActive = value
End Set
End Property
Private m_Material As MaterialM
Public Property Material As MaterialM
Get
Return m_Material
End Get
Set(value As MaterialM)
m_Material = value
End Set
End Property
Private m_dW As Double
Public Property dW As Double
Get
Return m_dW
End Get
Set(value As Double)
m_dW = value
End Set
End Property
Private m_dL As Double
Public Property dL As Double
Get
Return m_dL
End Get
Set(value As Double)
m_dL = value
End Set
End Property
Private m_nQuantity As Integer
Public Property nQuantity As Integer
Get
Return m_nQuantity
End Get
Set(value As Integer)
m_nQuantity = value
End Set
End Property
Private m_bUseQuantity As Boolean
Public Property bUseQuantity As Boolean
Get
Return m_bUseQuantity
End Get
Set(value As Boolean)
m_bUseQuantity = value
End Set
End Property
Sub New(SxM As MaterialM, W As Double, L As Double, Qty As Integer, Active As Boolean)
m_Material = SxM
m_dW = W
m_dL = L
m_nQuantity = Qty
m_bActive = Active
End Sub
Sub New(nId As Integer, SxM As MaterialM, W As Double, L As Double, Qty As Integer, bUseQty As Boolean, Active As Boolean)
m_nId = nId
m_Material = SxM
m_dW = W
m_dL = L
m_nQuantity = Qty
m_bUseQuantity = bUseQty
m_bActive = Active
End Sub
Public Sub Update(RawPart As RawPartM)
m_Material = RawPart.m_Material
m_dW = RawPart.dW
m_dL = RawPart.dL
m_nQuantity = RawPart.m_nQuantity
m_bUseQuantity = RawPart.m_bUseQuantity
m_bActive = RawPart.m_bActive
End Sub
Public Function Copy() As RawPartM
Return New RawPartM(m_nId, m_Material, m_dW, m_dL, m_nQuantity, bUseQuantity, bActive)
End Function
End Class
+45 -47
View File
@@ -15,15 +15,10 @@ Public Class SectionXMaterial
m_nType = nType
End Sub
Public ReadOnly Property sMaterial As String
Protected m_Material As List(Of String)
Public ReadOnly Property sMaterial As List(Of String)
Get
Return m_MaterialM.sMaterial
End Get
End Property
Public ReadOnly Property sWarehouseMaterial As String
Get
Return m_MaterialM.sWarehouseMaterial
Return m_Material
End Get
End Property
@@ -47,59 +42,50 @@ Public Class SectionXMaterial
End Set
End Property
Protected m_MaterialM As MaterialM
Public ReadOnly Property MaterialM As MaterialM
Get
Return m_MaterialM
End Get
End Property
Protected m_dW As Double = 0
Public ReadOnly Property dW As Double
Get
Return m_MaterialM.dW
Return m_dW
End Get
End Property
Protected m_dH As Double = 0
Public ReadOnly Property dH As Double
Get
Return m_MaterialM.dH
Return m_dH
End Get
End Property
Protected m_dL As Double = 0
Public ReadOnly Property dL As Double
Get
Return m_MaterialM.dL
Return m_dL
End Get
End Property
Public ReadOnly Property sSectionXMaterial As String
Get
Dim sAlias As String = String.Empty
For Each sMatItem In sMaterial
sAlias &= sMatItem & ";"
Next
sAlias = sAlias.TrimEnd(";")
If Me = Empty Then
Return ""
ElseIf m_nType = MachineType.BEAM Then
Return LenToString(m_MaterialM.dW, 3) & " x " & LenToString(m_MaterialM.dH, 3) & " " & If(GetMainPrivateProfileInt(S_WAREHOUSE, K_SHOWWAREHOUSEMATERIAL, 0) = 1, sWarehouseMaterial, sMaterial)
Return LenToString(m_dW, 3) & " x " & LenToString(m_dH, 3) & " " & sAlias
ElseIf m_nType = MachineType.WALL Then
Return LenToString(m_MaterialM.dH, 3) & " " & If(GetMainPrivateProfileInt(S_WAREHOUSE, K_SHOWWAREHOUSEMATERIAL, 0) = 1, sWarehouseMaterial, sMaterial)
Else Return ""
End If
End Get
End Property
Public ReadOnly Property sWarehouseSectionXMaterial As String
Get
If Me = Empty Then
Return ""
ElseIf m_nType = MachineType.BEAM Then
Return LenToString(m_MaterialM.dW, 3) & " x " & LenToString(m_MaterialM.dH, 3) & " " & sWarehouseMaterial
ElseIf m_nType = MachineType.WALL Then
Return LenToString(m_MaterialM.dH, 3) & " " & sWarehouseMaterial
Return LenToString(m_dH, 3) & " " & sAlias
Else Return ""
End If
End Get
End Property
Shared Operator =(ByVal S1 As SectionXMaterial, ByVal S2 As SectionXMaterial) As Boolean
Return S1.m_MaterialM = S2.m_MaterialM
Return (Math.Abs( S1.m_dH - S2.m_dH) < 100 * EPS_SMALL AndAlso
Math.Abs( S1.m_dW - S2.m_dW) < 100 * EPS_SMALL AndAlso
Math.Abs( S1.m_dL - S2.m_dL) < 100 * EPS_SMALL AndAlso
S1.m_Material.Any(Function(x) S2.m_Material.Any(Function(y) y = x)))
End Operator
Shared Operator <>(ByVal S1 As SectionXMaterial, ByVal S2 As SectionXMaterial) As Boolean
@@ -113,21 +99,25 @@ Public Class SectionXMaterial
Return False
End Function
Sub New(dW As Double, dH As Double, dL As Double, sMaterial As String, sWarehouseMaterial As String)
Sub New(dW As Double, dH As Double, dL As Double, sMaterial As String)
If m_nType = BWType.BEAM Then
m_MaterialM = New MaterialM(dW, dH, 0, sMaterial, sWarehouseMaterial)
m_dW = dW
m_dH = dH
ElseIf m_nType = BWType.WALL Then
m_MaterialM = New MaterialM(0, dH, 0, sMaterial, sWarehouseMaterial)
m_dH = dH
Else
m_MaterialM = New MaterialM(dW, dH, dL, sMaterial, sWarehouseMaterial)
m_dW = dW
m_dH = dH
m_dL = dL
End If
m_Material = New List(Of String)
Dim sMaterialArray() As String = Split(sMaterial, ";")
For Each sMatItem In sMaterialArray
m_Material.Add(sMatItem)
Next
End Sub
Sub New(MaterialM As MaterialM)
m_MaterialM = MaterialM
End Sub
Public Shared Empty As New SectionXMaterial(-1, -1, -1, "", "")
Public Shared Empty As New SectionXMaterial(-1, -1, -1, "")
#Region "Import BTL <-> Warehouse"
@@ -205,14 +195,22 @@ Public Class SectionXMaterial
End Get
End Property
Sub New(dW As Double, dH As Double, dL As Double, sMaterial As String, nQuantity As Integer, sWarehouseMaterial As String)
Sub New(dW As Double, dH As Double, dL As Double, sMaterial As String, nQuantity As Integer)
If m_nType = BWType.BEAM Then
m_MaterialM = New MaterialM(dW, dH, 0, sMaterial, sWarehouseMaterial)
m_dW = dW
m_dH = dH
ElseIf m_nType = BWType.WALL Then
m_MaterialM = New MaterialM(0, dH, 0, sMaterial, sWarehouseMaterial)
m_dH = dH
Else
m_MaterialM = New MaterialM(dW, dH, dL, sMaterial, sWarehouseMaterial)
m_dW = dW
m_dH = dH
m_dL = dL
End If
m_Material = New List(Of String)
Dim sMaterialArray() As String = Split(sMaterial, ";")
For Each sMatItem In sMaterialArray
m_Material.Add(sMatItem)
Next
m_nQuantity = nQuantity
End Sub
+2 -14
View File
@@ -13,7 +13,7 @@
</providers>
</entityFramework>
<connectionStrings>
<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" />
<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" />
</connectionStrings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
@@ -31,7 +31,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="K4os.Compression.LZ4.Streams" publicKeyToken="2186fa9121ef231d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.3.6.0" newVersion="1.3.6.0" />
<bindingRedirect oldVersion="0.0.0.0-1.3.5.0" newVersion="1.3.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="BouncyCastle.Crypto" publicKeyToken="0e99375e54769942" culture="neutral" />
@@ -41,18 +41,6 @@
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO.Pipelines" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.3" newVersion="6.0.0.3" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="K4os.Compression.LZ4" publicKeyToken="2186fa9121ef231d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.2.5.0" newVersion="1.2.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="K4os.Hash.xxHash" publicKeyToken="32cd54395057cec3" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.0.8.0" newVersion="1.0.8.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup>
@@ -1,247 +0,0 @@
using EgtBEAMWALL.DataLayer.DatabaseModels;
using EgwProxy.MagMan.DTO;
using NLog;
using System;
using System.Collections.Generic;
using System.Linq;
namespace EgtBEAMWALL.DataLayer.Controllers
{
/// <summary>
/// Gestione Alias su DB (es: materiali da BTL e su DB)
/// </summary>
public class AliasController : IDisposable
{
#region Public Constructors
public AliasController()
{
}
#endregion Public Constructors
#if false
/// <summary>
/// Conversion of DB model class to base class
/// </summary>
/// <param name="coreMat"></param>
/// <returns></returns>
public static Core.AliasM ConvToCore(AliasModel dbRec)
{
Core.AliasM answ = new Core.AliasM(dbRec.ValueOriginal, dbRec.ValueAlias);
return answ;
}
#endif
#region Public Methods
/// <summary>
/// Helper conversione a DTO
/// </summary>
/// <param name="currRec"></param>
/// <returns></returns>
public static AliasDTO ConvToDto(AliasModel currRec)
{
AliasDTO answ = new AliasDTO()
{
ValOrig = currRec.ValueOriginal,
ValAlias = currRec.ValueAlias
};
return answ;
}
/// <summary>
/// Helper conversione da DTO
/// </summary>
/// <param name="currRec"></param>
/// <param name="family"></param>
/// <returns></returns>
public static AliasModel ConvToModel(AliasDTO currRec, string family)
{
AliasModel answ = new AliasModel()
{
Family = family,
ValueOriginal = currRec.ValOrig,
ValueAlias = currRec.ValAlias
};
return answ;
}
/// <summary>
/// Delete by key
/// </summary>
/// <param name="Family"></param>
/// <param name="ValueOriginal"></param>
/// <returns></returns>
public bool DeleteByKey(string Family, string ValueOriginal)
{
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var items2del = localDbCtx
.AliasList
.Where(x => x.Family == Family && x.ValueOriginal == ValueOriginal);
try
{
// Add to database
localDbCtx.AliasList.RemoveRange(items2del);
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Log.Error($"EXCEPTION on Alias.DeleteByKey: {Environment.NewLine}{exc}");
}
}
return done;
}
public void Dispose()
{
}
/// <summary>
/// Get record by Key
/// </summary>
/// <param name="MatId"></param>
/// <returns></returns>
public AliasModel FindByDbId(string ValueOriginal)
{
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
string Family = "MatCode";
return localDbCtx
.AliasList
.Where(x => x.Family == Family && x.ValueOriginal.ToLower() == ValueOriginal.ToLower())
.SingleOrDefault();
}
}
/// <summary>
/// Get record by Key
/// </summary>
/// <param name="MatId"></param>
/// <returns></returns>
public AliasModel FindByDbId(string ValueOriginal, string Family)
{
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
return localDbCtx
.AliasList
.Where(x => x.Family == Family && x.ValueOriginal.ToLower() == ValueOriginal.ToLower())
.SingleOrDefault();
}
}
/// <summary>
/// Elenco Alias x famiglia
/// </summary>
/// <param name="Family">se "" restituisce tutti</param>
/// <returns></returns>
public List<AliasModel> GetFilt(string Family)
{
// retrieve
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
return localDbCtx
.AliasList
.Where(x => x.Family == Family)
.OrderBy(x => x.ValueOriginal)
.ToList();
}
}
/// <summary>
/// Update or insert Alias record
/// </summary>
/// <param name="updItem"></param>
/// <returns></returns>
public bool Upsert(AliasModel updItem)
{
bool fatto = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
try
{
var item2update = localDbCtx
.AliasList
.Where(x => x.Family == updItem.Family && x.ValueOriginal == updItem.ValueOriginal)
.SingleOrDefault();
if (item2update != null)
{
// update, vers 1...
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
}
else
{
localDbCtx.AliasList.Add(updItem);
}
// Commit changes
localDbCtx.SaveChanges();
fatto = true;
}
catch (Exception exc)
{
Log.Error($"EXCEPTION on Alias.Upsert: {Environment.NewLine}{exc}");
}
}
return fatto;
}
/// <summary>
/// Update or insert Alias record list
/// </summary>
/// <param name="updList"></param>
/// <returns></returns>
public bool UpsertList(List<AliasModel> updList)
{
bool fatto = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
try
{
foreach (var updItem in updList)
{
var item2update = localDbCtx
.AliasList
.Where(x => x.Family == updItem.Family && x.ValueOriginal.ToLower() == updItem.ValueOriginal.ToLower())
.SingleOrDefault();
if (item2update != null)
{
if (item2update.ValueAlias.ToLower() != updItem.ValueAlias.ToLower())
{
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
}
}
else
{
localDbCtx.AliasList.Add(updItem);
}
}
// Commit changes
localDbCtx.SaveChanges();
fatto = true;
}
catch (Exception exc)
{
Log.Error($"EXCEPTION on Alias.UpsertList: {Environment.NewLine}{exc}");
}
}
return fatto;
}
#endregion Public Methods
#region Private Fields
/// <summary>
/// Istanza logger
/// </summary>
private Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
}
}
File diff suppressed because it is too large Load Diff
@@ -1,233 +0,0 @@
using EgtBEAMWALL.DataLayer.DatabaseModels;
using EgwProxy.MagMan.DTO;
using NLog;
using System;
using System.Collections.Generic;
using System.Linq;
namespace EgtBEAMWALL.DataLayer.Controllers
{
/// <summary>
/// Gestione MagmanSync su DB (registrazione operazioni di sync con MagMan online)
/// </summary>
public class MagmanSyncController : IDisposable
{
#region Public Constructors
public MagmanSyncController()
{
}
#endregion Public Constructors
#region Public Methods
/// <summary>
/// Purge dei record inviati oltre periodo di giorni indicato
/// </summary>
/// <param name="NumDayMax">Num gg max da mantenere in registro</param>
/// <returns></returns>
public bool DeleteOlder(int NumDayMax)
{
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
DateTime adesso = DateTime.Now;
var items2del = localDbCtx
.SyncList
.Where(x => x.DtExe != null && adesso.Subtract(x.DtReq).TotalDays > NumDayMax);
try
{
// Add to database
localDbCtx.SyncList.RemoveRange(items2del);
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Log.Error($"EXCEPTION on Alias.DeleteOlder | NumDayMax: {NumDayMax}{Environment.NewLine}{exc}");
}
}
return done;
}
public void Dispose()
{
}
/// <summary>
/// Lista record filtrati
/// </summary>
/// <param name="SyncType">Tipo di record richiesti, se "" = tutti</param>
/// <param name="DtMax">Data-Ora limite per recupero ordinato DESC</param>
/// <param name="NumMax">num max di record da restituire</param>
/// <returns></returns>
public List<MagmanSyncModel> GetFilt(string SyncType, DateTime DtMax, int NumMax)
{
List<MagmanSyncModel> dbResult = new List<MagmanSyncModel>();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
dbResult = localDbCtx
.SyncList
.Where(x => (string.IsNullOrEmpty(SyncType) || x.SyncType == SyncType) && x.DtReq <= DtMax)
.OrderByDescending(x => x.DtReq)
.Take(NumMax)
.ToList();
}
return dbResult;
}
/// <summary>
/// Insert record MagmanSync
/// </summary>
/// <param name="newRec"></param>
/// <returns>ID record inserito</returns>
public int Insert(MagmanSyncModel newRec)
{
int newId = 0;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
try
{
// inserisco record
localDbCtx.SyncList.Add(newRec);
// Commit changes
localDbCtx.SaveChanges();
newId = newRec.SyncId;
}
catch (Exception exc)
{
Log.Error($"EXCEPTION on MagmanSync.Insert: {Environment.NewLine}{exc}");
}
}
return newId;
}
/// <summary>
/// Update con indicazione DtExt di completamento
/// </summary>
/// <param name="SyncId">ID record</param>
/// <param name="DtExe">Data-Ora exe</param>
/// <returns></returns>
public bool SetCompleted(int SyncId, DateTime DtExe)
{
bool fatto = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
try
{
var item2update = localDbCtx
.SyncList
.Where(x => x.SyncId == SyncId)
.SingleOrDefault();
if (item2update != null)
{
// update
item2update.DtExe = DtExe;
localDbCtx.Entry(item2update).State = System.Data.Entity.EntityState.Modified;
}
// Commit changes
localDbCtx.SaveChanges();
fatto = true;
}
catch (Exception exc)
{
Log.Error($"EXCEPTION on MagmanSync.SetCompleted: {Environment.NewLine}{exc}");
}
}
return fatto;
}
/// <summary>
/// Update or insert record MagmanSync
/// </summary>
/// <param name="updItem"></param>
/// <returns></returns>
public bool Upsert(MagmanSyncModel updItem)
{
bool fatto = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
try
{
var item2update = localDbCtx
.SyncList
.Where(x => x.SyncId == updItem.SyncId)
.SingleOrDefault();
if (item2update != null)
{
// update, vers 1...
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
}
else
{
localDbCtx.SyncList.Add(updItem);
}
// Commit changes
localDbCtx.SaveChanges();
fatto = true;
}
catch (Exception exc)
{
Log.Error($"EXCEPTION on MagmanSync.Upsert: {Environment.NewLine}{exc}");
}
}
return fatto;
}
/// <summary>
/// Update or insert Alias record list
/// </summary>
/// <param name="updList"></param>
/// <returns></returns>
public bool UpsertList(List<MagmanSyncModel> updList)
{
bool fatto = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
try
{
foreach (var updItem in updList)
{
var item2update = localDbCtx
.SyncList
.Where(x => x.SyncId == updItem.SyncId)
.SingleOrDefault();
if (item2update != null)
{
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
}
else
{
localDbCtx.SyncList.Add(updItem);
}
}
// Commit changes
localDbCtx.SaveChanges();
fatto = true;
}
catch (Exception exc)
{
Log.Error($"EXCEPTION on MagmanSync.UpsertList: {Environment.NewLine}{exc}");
}
}
return fatto;
}
#endregion Public Methods
#region Private Fields
/// <summary>
/// Istanza logger
/// </summary>
private Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
}
}
@@ -1,454 +0,0 @@
using EgtBEAMWALL.DataLayer.DatabaseModels;
using EgwProxy.MagMan.DTO;
using NLog;
using System;
using System.Collections.Generic;
using System.Linq;
using static EgtBEAMWALL.DataLayer.Controllers.MaterialsController.SearchResult;
namespace EgtBEAMWALL.DataLayer.Controllers
{
/// <summary>
/// Gestione Materiali su DB (= magazzino locale)
/// </summary>
public class MaterialsController : IDisposable
{
#region Public Constructors
public MaterialsController()
{
}
#endregion Public Constructors
#region Public Methods
/// <summary>
/// Conversion of DB model class to base class
/// </summary>
/// <param name="coreMat"></param>
/// <returns></returns>
public static Core.MaterialM ConvToCore(MaterialModel dbRec)
{
Core.MaterialM answ = new Core.MaterialM(dbRec.MatId, (double)dbRec.WMm, (double)dbRec.HMm, (double)dbRec.LMm, dbRec.MatCode);
return answ;
}
/// <summary>
/// Helper conversione a DTO
/// </summary>
/// <param name="currRec"></param>
/// <returns></returns>
public static MaterialDTO ConvToDto(MaterialModel currRec)
{
MaterialDTO answ = new MaterialDTO()
{
MatCloudId = currRec.MatCloudId,
MatLocalId = currRec.MatId,
MatCode = currRec.MatCode,
MatDesc = currRec.MatDesc,
HMm = currRec.HMm,
LMm = currRec.LMm,
WMm = currRec.WMm
};
return answ;
}
/// <summary>
/// Helper conversione da DTO
/// </summary>
/// <param name="currRec"></param>
/// <returns></returns>
public static MaterialModel ConvToModel(MaterialDTO currRec)
{
MaterialModel answ = new MaterialModel()
{
MatCloudId = currRec.MatCloudId,
MatId = currRec.MatLocalId,
MatCode = currRec.MatCode,
MatDesc = currRec.MatDesc,
HMm = currRec.HMm,
LMm = currRec.LMm,
WMm = currRec.WMm
};
return answ;
}
/// <summary>
/// Conversion of base class to DB model class
/// </summary>
/// <param name="coreRec"></param>
/// <returns></returns>
public static MaterialModel ConvToModel(Core.MaterialM coreRec)
{
MaterialModel answ = new MaterialModel();
if (coreRec != null)
{
answ = new MaterialModel()
{
MatId = coreRec.nId,
MatCode = coreRec.sMaterial,
HMm = (decimal)coreRec.dH,
LMm = (decimal)coreRec.dL,
WMm = (decimal)coreRec.dW,
};
}
return answ;
}
/// <summary>
/// Delete by key
/// </summary>
/// <param name="MatId"></param>
/// <returns></returns>
public bool DeleteByKey(int MatId)
{
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var items2del = localDbCtx
.MaterialsList
.Where(x => x.MatId == MatId);
try
{
// Add to database
localDbCtx.MaterialsList.RemoveRange(items2del);
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Log.Error($"EXCEPTION on Materials.DeleteByKey: {Environment.NewLine}{exc}");
}
}
return done;
}
public void Dispose()
{
}
/// <summary>
/// Get record by Key
/// </summary>
/// <param name="MatId"></param>
/// <returns></returns>
public Core.MaterialM FindByDbId(int MatId)
{
Core.MaterialM result = new Core.MaterialM(0, 0, 0, "NONE");
var rawData = FindByDbIdModel(MatId);
if (rawData != null)
{
result = ConvToCore(rawData);
}
return result;
}
/// <summary>
/// Get record by Key in formato Model
/// </summary>
/// <param name="MatId"></param>
/// <returns></returns>
public MaterialModel FindByDbIdModel(int MatId)
{
MaterialModel result = new MaterialModel();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
result = localDbCtx
.MaterialsList
.Where(x => x.MatId == MatId)
.SingleOrDefault();
}
return result;
}
/// <summary>
/// Get Material (filtro x MatId) in formato Core
/// </summary>
/// <param name="MatCode">se "" restituisce tutti</param>
/// <returns></returns>
public List<Core.MaterialM> GetFilt(string MatCode)
{
// recupero e converto
List<Core.MaterialM> result = new List<Core.MaterialM>();
var rawData = GetFiltModel(MatCode);
if (rawData != null)
{
result = rawData.Select(x => ConvToCore(x)).ToList();
}
return result;
}
/// <summary>
/// Get Material (filtro x MatId) in formato Model
/// </summary>
/// <param name="MatCode">se "" restituisce tutti</param>
/// <returns></returns>
public List<MaterialModel> GetFiltModel(string MatCode)
{
List<MaterialModel> result = new List<MaterialModel>();
// retrieve
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
result = localDbCtx
.MaterialsList
.Where(x => string.IsNullOrEmpty(MatCode) || x.MatCode == MatCode)
.OrderBy(x => x.MatDesc)
.ToList();
}
return result;
}
/// <summary>
/// Insert Material record from CoreM if missing or return existing (for Id)
/// </summary>
/// <param name="coreItem"></param>
/// <returns>MatId (existing or new)</returns>
public int Insert(Core.MaterialM coreItem)
{
int newIdx = 0;
// converto
MaterialModel updItem = ConvToModel(coreItem);
newIdx = Insert(updItem);
return newIdx;
}
/// <summary>
/// Insert Material record
/// </summary>
/// <param name="updItem"></param>
/// <returns>MatId (existing or new)</returns>
public int Insert(MaterialModel updItem)
{
int newIdx = 0;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
try
{
var item2update = localDbCtx
.MaterialsList
.Where(x => (updItem.MatId > 0 && x.MatId == updItem.MatId)
|| (updItem.MatCloudId > 0 && x.MatCloudId == updItem.MatCloudId)
|| (x.MatCode == updItem.MatCode && x.WMm == updItem.WMm && x.HMm == updItem.HMm && x.LMm == updItem.LMm))
.SingleOrDefault();
if (item2update != null)
{
newIdx = item2update.MatId;
}
else
{
localDbCtx.MaterialsList.Add(updItem);
// Commit changes
localDbCtx.SaveChanges();
newIdx = updItem.MatId;
}
}
catch (Exception exc)
{
Log.Error($"EXCEPTION on Materials.Insert: {Environment.NewLine}{exc}");
}
}
return newIdx;
}
/// <summary>
/// Restituisce il primo materiale (se esiste) per MatCode (diretto o tramite Alias)
/// </summary>
/// <param name="MatCode">Non accetta ""</param>
/// <returns></returns>
public SearchResult SearchFilt(string MatCode)
{
// init valori esito ricerca + risultato
TypeFound esito = string.IsNullOrEmpty(MatCode) ? TypeFound.MISSING_CODE : TypeFound.NOT_FOUND;
List<Core.MaterialM> result = new List<Core.MaterialM>();
// solo se ho una VERA ricerca x MatCode
if (!string.IsNullOrEmpty(MatCode))
{
// cerco nei materiali
var rawData = GetFiltModel(MatCode);
if (rawData != null && rawData.Count > 0)
{
// ...e converto
result = rawData.Select(x => ConvToCore(x)).ToList();
esito = TypeFound.MATERIAL;
}
else
{
// cerco negli alias...
using (AliasController aliasDbContr = new AliasController())
{
var aliasRec = aliasDbContr.FindByDbId(MatCode);
if (aliasRec != null)
{
rawData = GetFiltModel(aliasRec.ValueAlias);
if (rawData != null && rawData.Count > 0)
{
// ...e converto
result = rawData.Select(x => ConvToCore(x)).ToList();
esito = TypeFound.ALIAS;
}
}
}
}
}
// compongo risposta!
SearchResult answ = new SearchResult()
{
Tipo = esito,
Result = result
};
return answ;
}
/// <summary>
/// Update Material record from CoreM
/// </summary>
/// <param name="coreItem"></param>
/// <returns>Returns 0 if not found</returns>
public int Update(Core.MaterialM coreItem)
{
int newIdx = 0;
// converto
MaterialModel updItem = ConvToModel(coreItem);
newIdx = Update(updItem);
return newIdx;
}
/// <summary>
/// Update Material record
/// </summary>
/// <param name="updItem"></param>
/// <returns>Returns 0 if not found</returns>
public int Update(MaterialModel updItem)
{
int newIdx = 0;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
try
{
var item2update = localDbCtx
.MaterialsList
.Where(x => (updItem.MatId > 0 && x.MatId == updItem.MatId)
|| (updItem.MatCloudId > 0 && x.MatCloudId == updItem.MatCloudId)
|| (x.MatCode == updItem.MatCode && x.WMm == updItem.WMm && x.HMm == updItem.HMm && x.LMm == updItem.LMm))
.SingleOrDefault();
if (item2update != null)
{
//// update, vers 1...
//localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
item2update.MatCloudId = updItem.MatCloudId;
item2update.MatDesc = updItem.MatDesc;
localDbCtx.Entry(item2update).State = System.Data.Entity.EntityState.Modified;
// Commit changes
localDbCtx.SaveChanges();
newIdx = item2update.MatId;
}
}
catch (Exception exc)
{
Log.Error($"EXCEPTION on Materials.Update: {Environment.NewLine}{exc}");
}
}
return newIdx;
}
/// <summary>
/// Upsert Material record
/// </summary>
/// <param name="updItem"></param>
/// <returns>MatId (existing or new)</returns>
public int Upsert(MaterialModel updItem)
{
int newIdx = 0;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
try
{
var item2update = localDbCtx
.MaterialsList
.Where(x => (updItem.MatId > 0 && x.MatId == updItem.MatId)
|| (updItem.MatCloudId > 0 && x.MatCloudId == updItem.MatCloudId)
|| (x.MatCode == updItem.MatCode && x.WMm == updItem.WMm && x.HMm == updItem.HMm && x.LMm == updItem.LMm))
.SingleOrDefault();
if (item2update != null)
{
//// update, vers 1...
//localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
item2update.MatCloudId = updItem.MatCloudId;
item2update.MatDesc = updItem.MatDesc;
localDbCtx.Entry(item2update).State = System.Data.Entity.EntityState.Modified;
// Commit changes
localDbCtx.SaveChanges();
newIdx = item2update.MatId;
}
else
{
localDbCtx.MaterialsList.Add(updItem);
// Commit changes
localDbCtx.SaveChanges();
newIdx = updItem.MatId;
}
}
catch (Exception exc)
{
Log.Error($"EXCEPTION on Materials.Insert: {Environment.NewLine}{exc}");
}
}
return newIdx;
}
#endregion Public Methods
#region Public Classes
/// <summary>
/// Risultato ricerca materiali
/// </summary>
public class SearchResult
{
#region Public Enums
/// <summary>
/// Enum del risultato della ricerca materiali
/// </summary>
public enum TypeFound
{
MISSING_CODE = 0,
NOT_FOUND,
ALIAS,
MATERIAL
}
#endregion Public Enums
#region Public Properties
/// <summary>
/// Materiali trovati
/// </summary>
public List<Core.MaterialM> Result { get; set; } = new List<Core.MaterialM>();
/// <summary>
/// Tipologia oggetto trovato
/// </summary>
public TypeFound Tipo { get; set; } = TypeFound.MISSING_CODE;
#endregion Public Properties
}
#endregion Public Classes
#region Private Fields
/// <summary>
/// Istanza logger
/// </summary>
private NLog.Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
}
}
@@ -1,9 +1,7 @@
using EgtBEAMWALL.DataLayer.DatabaseModels;
using EgwProxy.MagMan.DTO;
using NLog;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using static EgtBEAMWALL.Core.ConstBeam;
@@ -59,75 +57,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
return done;
}
/// <summary>
/// Helper conversione a ProjectDTO
/// </summary>
/// <param name="currRec">record in formato ProdModel</param>
/// <returns></returns>
public static ProjectDTO ConvToDto(ProdModel currRec)
{
// ho valori mancanti che saranno calcolati dal cloud e valori messi a zero di default
ProjectDTO answ = new ProjectDTO()
{
ProjCloudId = currRec.ProjCloudId,
ProjLocalId = currRec.ProdDbId,
ProjExtId = currRec.ProdId,
// è calcolato sul cloud, da token --> machine ID
MachineCloudId = 0,
// è calcolato sul cloud, da token --> KeyNum
KeyNum = 0,
// disponibile solo su PROJ
BTLFileName = "",
PType = (EgwProxy.MagMan.BWType)currRec.PType,
Machine = currRec.Machine,
ProjDescription = currRec.Description,
DtCreated = currRec.DtCreated,
DtLastAction = DateTime.MinValue,
DtSchedule = DateTime.MinValue,
DtStartProd = DateTime.MinValue,
// disponibile solo su PROJ
ListName = "",
ProcTimeEst = 0,
ProcTimeReal = 0,
IsActive = currRec.IsActive,
IsArchived = currRec.IsArchived
};
return answ;
}
/// <summary>
/// Helper conversione modelli verso Core.ProdItem
/// </summary>
/// <param name="currProd"></param>
/// <returns></returns>
public Core.ProdItem ConvToCore(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, j.ProjCloudId)).ToList());
return answ;
}
/// <summary>
/// Helper conversione modelli verso Core.ProdItem
/// </summary>
/// <param name="currProd"></param>
/// <returns></returns>
public Core.ProdItem ConvToCore(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, currProj.ProjCloudId));
return answ;
}
/// <summary>
/// Helper conversione modelli
/// </summary>
/// <param name="currProd"></param>
/// <returns></returns>
public Core.ProdFileM ConvToCoreFile(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, currProd.ProjCloudId);
//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.ProdId, 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>
/// Delete Prod(+proj...) logically / on DB by ProdId
/// </summary>
@@ -273,17 +202,17 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
return null;
}
return Core.ProdFileM.CreateProdFileM(currProd.ProdId, ProjIdByProd(ProdId), currProd.DtCreated, currProd.Description, currProd.PType, currProd.Machine, currProd.LockedBy, currProd.LockDate, currProd.IsActive, currProd.IsProduced, currProd.IsArchived, currProd.ProjCloudId);
return Core.ProdFileM.CreateProdFileM(currProd.ProdId, ProjIdByProd(ProdId), currProd.DtCreated, currProd.Description, currProd.PType, currProd.Machine, currProd.LockedBy, currProd.LockDate, currProd.IsActive, currProd.IsProduced, currProd.IsArchived);
}
/// <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);
@@ -291,9 +220,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
@@ -306,25 +235,25 @@ namespace EgtBEAMWALL.DataLayer.Controllers
(p, e) => p)
.Distinct()
.OrderByDescending(x => x.ProdId)
.Take(NumRecord)
.Take(numRecord)
.ToList();
}
// conversione
result = dbResult.Select(x => Core.ProdFileM.CreateProdFileM(x.ProdId, ProjIdByProd(x.ProdId), x.DtCreated, x.Description, x.PType, x.Machine, x.LockedBy, x.LockDate, x.IsActive, x.IsProduced, x.IsArchived, x.ProjCloudId)).ToList();
result = dbResult.Select(x => Core.ProdFileM.CreateProdFileM(x.ProdId, ProjIdByProd(x.ProdId), x.DtCreated, x.Description, x.PType, x.Machine, x.LockedBy, x.LockDate, x.IsActive, x.IsProduced, x.IsArchived)).ToList();
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="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);
@@ -332,14 +261,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,
@@ -347,189 +276,12 @@ namespace EgtBEAMWALL.DataLayer.Controllers
(p, e) => p)
.Distinct()
.OrderByDescending(x => x.ProdId)
.Take(NumRecord)
.Take(numRecord)
.ToList();
}
// conversione
result = dbResult.Select(x => Core.ProdFileM.CreateProdFileM(x.ProdId, ProjIdByProd(x.ProdId), x.DtCreated, x.Description, x.PType, x.Machine, x.LockedBy, x.LockDate, x.IsActive, x.IsProduced, x.IsArchived, x.ProjCloudId)).ToList();
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 => ConvToCore(x)).ToList();
var resProj = dbResultProj.Select(x => ConvToCore(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 => ConvToCore(x)).ToList();
var resProj = dbResultProj.Select(x => ConvToCore(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 => ConvToCore(x)).ToList();
var resProj = dbResultProj.Select(x => ConvToCore(x)).ToList();
// sommo i risultati
result.AddRange(resProj);
result = dbResult.Select(x => Core.ProdFileM.CreateProdFileM(x.ProdId, ProjIdByProd(x.ProdId), x.DtCreated, x.Description, x.PType, x.Machine, x.LockedBy, x.LockDate, x.IsActive, x.IsProduced, x.IsArchived)).ToList();
return result;
}
@@ -786,64 +538,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
return fatto;
}
/// <summary>
/// Update record su DB x ProjectCloudId
/// </summary>
/// <param name="ProdId"></param>
/// <param name="Description"></param>
/// <returns></returns>
public Core.ProdFileM UpdateCloudId(int ProdId, int ProjCloudId)
{
// cerco specifico Proj
ProdModel currData;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
currData = localDbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.SingleOrDefault();
if (currData != null)
{
try
{
// aggiorno valore BTL
currData.ProjCloudId = ProjCloudId;
// salvo record PROD
localDbCtx.SaveChanges();
// cerco se ci siano prod colelgati ed aggiorno pure loro...
var projList = localDbCtx
.ProjList
.Where(x => x.ProdDbId == currData.ProdDbId)
.ToList();
if (projList != null)
{
foreach (var item in projList)
{
item.ProjCloudId = ProjCloudId;
}
// salvo modifihce ai PROJ
localDbCtx.SaveChanges();
}
}
catch (Exception exc)
{
string errMessage = $"EXCEPTION on Prod.UpdateCloudId:{Environment.NewLine}{exc}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
else
{
string errMessage = $"ERROR on Prod.UpdateCloudId: req item was not found | ProdId {ProdId} | ProjCloudId {ProjCloudId}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
return ConvToCoreFile(currData);
}
/// <summary>
/// Update record su DB x Description
/// </summary>
@@ -1113,7 +807,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
Log.Error(errMessage);
}
}
return ConvToCoreFile(currData);
return coreConv(currData);
}
/// <summary>
@@ -1135,7 +829,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
.SingleOrDefault();
if (currData != null)
{
// aggiorno valore tipo
// aggiorno valore BTL
currData.PType = PType;
// Commit changes
@@ -1155,7 +849,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
Log.Error(errMessage);
}
}
return ConvToCoreFile(currData);
return coreConv(currData);
}
/// <summary> Return User Code/Key that Locks by ProdId (proj & prod) </summary> <param
@@ -1208,6 +902,17 @@ namespace EgtBEAMWALL.DataLayer.Controllers
#region Protected Methods
/// <summary>
/// Helper conversione modelli
/// </summary>
/// <param name="currProd"></param>
/// <returns></returns>
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);
return answ;
}
protected List<int> ProjIdByProd(int ProdId)
{
var ProjCtr = new ProjController();
@@ -1,5 +1,4 @@
using EgtBEAMWALL.DataLayer.DatabaseModels;
using EgwProxy.MagMan.DTO;
using NLog;
using System;
using System.Collections.Generic;
@@ -20,72 +19,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
#region Public Methods
/// <summary>
/// Helper conversione a ProjectDTO
/// </summary>
/// <param name="currRec">record in formato ProjModel</param>
/// <returns></returns>
public static ProjectDTO ConvToDto(ProjModel currRec)
{
// ho valori mancanti che saranno calcolati dal cloud e valori messi a zero di default
ProjectDTO answ = new ProjectDTO()
{
ProjCloudId = currRec.ProjCloudId,
ProjLocalId = currRec.ProjDbId,
ProjExtId = currRec.ProjId,
// è calcolato sul cloud, da token --> machine ID
MachineCloudId = 0,
// è calcolato sul cloud, da token --> KeyNum
KeyNum = 0,
BTLFileName = currRec.BTLFileName,
PType = (EgwProxy.MagMan.BWType)currRec.PType,
Machine = currRec.Machine,
ProjDescription = currRec.ProjDescription,
DtCreated = currRec.DtCreated,
DtLastAction = DateTime.MinValue,
DtSchedule = DateTime.MinValue,
DtStartProd = DateTime.MinValue,
ListName = currRec.ListName,
ProcTimeEst = 0,
ProcTimeReal = 0,
IsActive = currRec.IsActive,
IsArchived = currRec.IsArchived
};
return answ;
}
/// <summary>
/// Helper conversione a ProjModel
/// </summary>
/// <param name="currRec"></param>
/// <param name="isActive"></param>
/// <returns></returns>
public static ProjModel ConvToModel(ProjectDTO currRec, bool isActive)
{
ProjModel answ = new ProjModel()
{
ProjCloudId = currRec.ProjCloudId,
ProjDbId = currRec.ProjLocalId,
ProjId = currRec.ProjExtId,
//MachineID = currRec.MachineCloudId,
//KeyNum = currRec.KeyNum,
BTLFileName = currRec.BTLFileName,
PType = (BWType)currRec.PType,
Machine = currRec.Machine,
ProjDescription = currRec.ProjDescription,
DtCreated = currRec.DtCreated,
//DtLastAction = currRec.DtLastAction,
//DtSchedule = currRec.DtSchedule,
//DtStartProd = currRec.DtStartProd,
ListName = currRec.ListName,
//ProcTimeEst = currRec.ProcTimeEst,
//ProcTimeReal = currRec.ProcTimeReal,
IsActive = currRec.IsActive,
IsArchived = currRec.IsArchived
};
return answ;
}
/// <summary>
/// Search for already imported BTL from FileName (only)
/// =0 : NOT found &gt;0 : ProjId (already present) for overwrite
@@ -100,8 +33,6 @@ 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...
@@ -113,21 +44,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
return answ;
}
/// <summary>
/// Helper conversione modelli
/// </summary>
/// <param name="currRec">record in formato ProjModel</param>
/// <returns></returns>
public Core.ProjFileM ConvToCore(ProjModel currRec)
{
Core.ProjFileM answ = null;
if (currRec != null)
{
answ = Core.ProjFileM.CreateProjFileM(currRec.ProjId, ProdIdByProdDbId(currRec.ProdDbId), currRec.DtCreated, currRec.DtExported, currRec.ListName, currRec.BTLFileName, currRec.ProjDescription, currRec.IsNew, currRec.Locked, currRec.PType, currRec.Machine, currRec.IsActive, currRec.IsArchived, currRec.ProjCloudId);
}
return answ;
}
/// <summary>
/// Delete Proj logically / on DB by ProjId
/// </summary>
@@ -280,7 +196,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public Core.ProjFileM FindByProjIdConv(int ProjId)
{
return ConvToCore(FindByProjId(ProjId));
return coreConv(FindByProjId(ProjId));
}
/// <summary>
@@ -318,7 +234,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
.OrderBy(x => x.ProdDbId)
.ToList();
// conversione
answ = dbRes.Select(x => ConvToCore(x)).ToList();
answ = dbRes.Select(x => coreConv(x)).ToList();
}
return answ;
}
@@ -358,7 +274,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
.OrderByDescending(x => x.ProdDbId)
.ToList();
// conversione
answ = dbRes.Select(x => ConvToCore(x)).ToList();
answ = dbRes.Select(x => coreConv(x)).ToList();
}
return answ;
}
@@ -411,7 +327,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
.Take(numRecord)
.ToList();
// conversione
answ = dbRes.Select(x => ConvToCore(x)).ToList();
answ = dbRes.Select(x => coreConv(x)).ToList();
}
return answ;
}
@@ -442,7 +358,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
.Take(numRecord)
.ToList();
// conversione
answ = dbRes.Select(x => ConvToCore(x)).ToList();
answ = dbRes.Select(x => coreConv(x)).ToList();
}
return answ;
}
@@ -475,7 +391,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
.Take(numRecord)
.ToList();
// conversione
answ = dbRes.Select(x => ConvToCore(x)).ToList();
answ = dbRes.Select(x => coreConv(x)).ToList();
}
return answ;
}
@@ -581,7 +497,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
// salvataggio
localDbCtx.SaveChanges();
}
return ConvToCore(currProj);
return coreConv(currProj);
}
/// <summary>
@@ -611,7 +527,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
currProj.IsNew = false;
localDbCtx.SaveChanges();
}
return ConvToCore(currProj);
return coreConv(currProj);
}
/// <summary>
@@ -665,7 +581,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// Update record su DB x elenco BTLParts
/// </summary>
/// <param name="ProjId"></param>
/// <param name="BtlPartList"></param>
/// <param name="newBTLFileName"></param>
/// <returns></returns>
public ProjModel UpdateBtlParts(int ProjId, List<Core.BTLPartM> BtlPartList)
{
@@ -794,7 +710,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
}
}
return ConvToCore(currData);
return coreConv(currData);
}
/// <summary>
@@ -885,7 +801,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
}
}
return ConvToCore(currData);
return coreConv(currData);
}
/// <summary>
@@ -927,7 +843,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
Log.Error(errMessage);
}
}
return ConvToCore(currData);
return coreConv(currData);
}
/// <summary>
@@ -970,13 +886,28 @@ namespace EgtBEAMWALL.DataLayer.Controllers
Log.Error(errMessage);
}
}
return ConvToCore(currData);
return coreConv(currData);
}
#endregion Public Methods
#region Protected Methods
/// <summary>
/// Helper conversione modelli
/// </summary>
/// <param name="currProj"></param>
/// <returns></returns>
protected Core.ProjFileM coreConv(ProjModel currProj)
{
Core.ProjFileM answ = null;
if (currProj != null)
{
answ = Core.ProjFileM.CreateProjFileM(currProj.ProjId, ProdIdByProdDbId(currProj.ProdDbId), currProj.DtCreated, currProj.DtExported, currProj.ListName, currProj.BTLFileName, currProj.ProjDescription, currProj.IsNew, currProj.Locked, currProj.PType, currProj.Machine, currProj.IsActive, currProj.IsArchived);
}
return answ;
}
/// <summary>
/// Get LAST paginated data from DB (DESC ordered)
/// </summary>
@@ -1,352 +0,0 @@
using EgtBEAMWALL.DataLayer.DatabaseModels;
using EgwProxy.MagMan.DTO;
using NLog;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
namespace EgtBEAMWALL.DataLayer.Controllers
{
/// <summary>
/// Gestione RawItem (barre) su DB (= magazzino locale)
/// </summary>
public class RawItemsController : IDisposable
{
#region Public Constructors
public RawItemsController()
{
}
#endregion Public Constructors
#region Public Methods
/// <summary>
/// Helper conversion da DB model class a base class (VB)
/// </summary>
/// <param name="dbRec"></param>
/// <returns></returns>
public static Core.RawPartM ConvToCore(RawItemModel dbRec)
{
// converto in primis il materiale relativo
Core.MaterialM matRec = MaterialsController.ConvToCore(dbRec.MaterialNav);
Core.RawPartM answ = new Core.RawPartM(dbRec.RawItemId, matRec, (double)dbRec.WMm, (double)dbRec.LMm, dbRec.QtyAvail, dbRec.UseQty, dbRec.IsActive);
return answ;
}
/// <summary>
/// Helper conversione a ItemDTO
/// </summary>
/// <param name="currRec"></param>
/// <returns></returns>
public static ItemDTO ConvToItemDto(RawItemModel currRec)
{
ItemDTO answ = new ItemDTO()
{
MatCloudId = currRec.MaterialNav != null ? currRec.MaterialNav.MatCloudId : 0,
MatLocalId = currRec.MatId,
RawItemCloudId = currRec.RawItemCloudId,
RawItemLocalId = currRec.RawItemId,
IsRemn = currRec.IsRemn,
QtyAvail = currRec.QtyAvail,
HMm = currRec.HMm,
LMm = currRec.LMm,
WMm = currRec.WMm,
Note = currRec.Note
};
return answ;
}
/// <summary>
/// Helper conversione da ItemDTO
/// </summary>
/// <param name="currRec"></param>
/// <param name="isActive"></param>
/// <returns></returns>
public static RawItemModel ConvToModel(ItemDTO currRec, bool isActive)
{
RawItemModel answ = new RawItemModel()
{
RawItemCloudId = currRec.RawItemCloudId,
RawItemId = currRec.RawItemLocalId,
QtyAvail = currRec.QtyAvail,
HMm = currRec.HMm,
LMm = currRec.LMm,
WMm = currRec.WMm,
MatId = currRec.MatLocalId,
IsRemn = currRec.IsRemn,
IsActive = isActive,
UseQty = true,
Note = currRec.Note
};
return answ;
}
/// <summary>
/// Helper conversione da ResourceExpDTO
/// </summary>
/// <param name="currRec"></param>
/// <param name="matLocalId"></param>
/// <returns></returns>
public static RawItemModel ConvToModel(ResourceExpDTO currRec, int matLocalId)
{
RawItemModel answ = new RawItemModel()
{
RawItemCloudId = currRec.RawItemCloudId,
RawItemId = currRec.RawItemLocalId,
QtyAvail = currRec.Qty,
HMm = currRec.HMm,
LMm = currRec.LMm,
WMm = currRec.WMm,
MatId = matLocalId,
IsRemn = currRec.IsRemn,
IsActive = currRec.IsActive,
UseQty = true,
Note = currRec.Note
};
return answ;
}
/// <summary>
/// Conversion of base class to DB model class
/// </summary>
/// <param name="coreRec"></param>
/// <returns></returns>
public static RawItemModel ConvToModel(Core.RawPartM coreRec)
{
RawItemModel answ = new RawItemModel();
if (coreRec != null)
{
answ = new RawItemModel()
{
RawItemId = coreRec.nId,
MatId = coreRec.Material.nId,
HMm = (decimal)coreRec.Material.dH,
LMm = (decimal)coreRec.dL,
WMm = coreRec.dW > 0 ? (decimal)coreRec.dW : (decimal)coreRec.Material.dW,
IsActive = coreRec.bActive,
UseQty = coreRec.bUseQuantity,
QtyAvail = coreRec.nQuantity
};
}
return answ;
}
/// <summary>
/// Helper conversione a ResourceDTO
/// </summary>
/// <param name="currRec"></param>
/// <returns></returns>
public static ResourceDTO ConvToResDto(RawItemModel currRec)
{
ResourceDTO answ = new ResourceDTO()
{
RawItemCloudId = currRec.RawItemCloudId,
RawItemLocalId = currRec.RawItemId,
Qty = currRec.QtyAvail
};
return answ;
}
///// <summary>
///// Helper conversione a ResourceDTO con garanzia valori Qty negativi
///// </summary>
///// <param name="currRec"></param>
///// <returns></returns>
//public static ResourceDTO ConvToResDtoNeg(RawItemModel currRec)
//{
// ResourceDTO answ = new ResourceDTO()
// {
// RawItemCloudId = currRec.RawItemCloudId,
// RawItemLocalId = currRec.RawItemId,
// Qty = -Math.Abs(currRec.QtyAvail)
// };
// return answ;
//}
/// <summary>
/// Delete by key
/// </summary>
/// <param name="RawItemId"></param>
/// <returns></returns>
public bool DeleteByKey(int RawItemId)
{
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var items2del = localDbCtx
.RawItemList
.Where(x => x.RawItemId == RawItemId);
try
{
// Add to database
localDbCtx.RawItemList.RemoveRange(items2del);
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Log.Error($"EXCEPTION on RawItems.DeleteByKey: {Environment.NewLine}{exc}");
}
}
return done;
}
public void Dispose()
{
}
/// <summary>
/// Get record by Key / Core
/// </summary>
/// <param name="RawItemId"></param>
/// <returns></returns>
public Core.RawPartM FindByDbId(int RawItemId)
{
var rawdata = FindByDbIdModel(RawItemId);
var result = ConvToCore(rawdata);
return result;
}
/// <summary>
/// Get record by Key / Db Model
/// </summary>
/// <param name="RawItemId"></param>
/// <returns></returns>
public RawItemModel FindByDbIdModel(int RawItemId)
{
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
return localDbCtx
.RawItemList
.Where(x => x.RawItemId == RawItemId)
.Include(m => m.MaterialNav)
.SingleOrDefault();
}
}
/// <summary>
/// Get Material (filtro x MatId) / Core
/// </summary>
/// <param name="MatId">0 = tutti</param>
/// <returns></returns>
public List<Core.RawPartM> GetFilt(int MatId)
{
var rawList = GetFiltModel(MatId);
var result = rawList.Select(x => ConvToCore(x)).ToList();
return result;
}
/// <summary>
/// Get Material (filtro x MatId)
/// </summary>
/// <param name="MatId">0 = tutti</param>
/// <returns></returns>
public List<RawItemModel> GetFiltModel(int MatId)
{
// retrieve
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
return localDbCtx
.RawItemList
.Include(j => j.MaterialNav)
.Where(x => MatId == 0 || x.MatId == MatId)
.OrderBy(x => x.LMm)
.ThenBy(x => x.WMm)
.ToList();
}
}
/// <summary>
/// Update or insert RawItem record
/// </summary>
/// <param name="updItem">Recorda da registrare</param>
/// <param name="changeUseQty">Indica se, in caso di modifica, vada aggiornato UseQty</param>
/// <param name="changeQtyAvail">Indica se, in caso di modifica, vada aggiornato QtyAvail</param>
/// <returns></returns>
public int Upsert(RawItemModel updItem, bool changeUseQty, bool changeQtyAvail)
{
int newIdx = 0;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
try
{
var item2update = localDbCtx
.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();
if (item2update != null)
{
//// update, vers 1...
//localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);\
item2update.RawItemCloudId = updItem.RawItemCloudId;
item2update.HMm = updItem.HMm;
item2update.LMm = updItem.LMm;
item2update.WMm = updItem.WMm;
item2update.IsActive = updItem.IsActive;
item2update.IsRemn = updItem.IsRemn;
if (changeUseQty)
{
item2update.UseQty = updItem.UseQty;
}
if (changeQtyAvail)
{
item2update.QtyAvail = updItem.QtyAvail;
item2update.LastSync = DateTime.Now;
}
localDbCtx.Entry(item2update).State = EntityState.Modified;
}
else
{
localDbCtx.RawItemList.Add(updItem);
}
// Commit changes
localDbCtx.SaveChanges();
if (item2update != null)
{
newIdx = item2update.RawItemId;
}
else
{
newIdx = updItem.RawItemId;
}
}
catch (Exception exc)
{
Log.Error($"EXCEPTION on RawItems.Upsert: {Environment.NewLine}{exc}");
}
}
return newIdx;
}
/// <summary>
/// Update or insert RawItem record from CoreM
/// </summary>
/// <param name="coreItem"></param>
/// <returns></returns>
public int Upsert(Core.RawPartM coreItem)
{
int newIdx = 0;
// converto
RawItemModel updItem = ConvToModel(coreItem);
newIdx = Upsert(updItem, true, true);
return newIdx;
}
#endregion Public Methods
#region Private Fields
/// <summary>
/// Istanza logger
/// </summary>
private NLog.Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
}
}
-20
View File
@@ -80,26 +80,6 @@ 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; }
/// <summary>
/// Alias management
/// </summary>
public DbSet<MagmanSyncModel> SyncList { get; set; }
#endregion Public Properties
#region Public Methods
@@ -1,34 +0,0 @@
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 in cui viene convertito
/// </summary>
public string ValueAlias { get; set; } = "";
}
}
@@ -1,58 +0,0 @@
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("MagmanSync")]
public partial class MagmanSyncModel
{
/// <summary>
/// Primary Key AUTO
/// </summary>
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int SyncId { get; set; }
/// <summary>
/// Tipologia Sync
/// </summary>
public string SyncType { get; set; } = "";
/// <summary>
/// Id riferimento remoto cloud x invio (es ProjCloudId)
/// </summary>
public int CloudId { get; set; } = 0;
/// <summary>
/// DataOra inserimento richiesta
/// </summary>
public DateTime DtReq { get; set; } = DateTime.Now;
/// <summary>
/// DataOra esecuzione richiesta
/// </summary>
public DateTime? DtExe { get; set; } = null;
/// <summary>
/// Payload trasmesso/da trasmettere (serializzato)
/// </summary>
public string Payload { get; set; } = "";
/// <summary>
/// Record inviato se DtExe != null && >= dtReq
/// </summary>
[NotMapped]
public bool Sent
{
get => DtExe != null && DtExe > DtReq;
}
}
}
@@ -1,119 +0,0 @@
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 DB esterno del magazzino in sync)
/// </summary>
public int MatCloudId { 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
/// <summary>
/// Verifica che sia Beam, quando L == 0
/// </summary>
[NotMapped]
public bool IsBeam
{
get => (LMm == 0 && (HMm > 0 && WMm > 0));
}
/// <summary>
/// Verifica che sia Wall, quando W/L == 0
/// </summary>
[NotMapped]
public bool IsWall
{
get => (LMm == 0 && WMm == 0);
}
public virtual ICollection<RawItemModel> RawItemList { get; set; }
}
}
@@ -1,5 +1,7 @@
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;
@@ -17,11 +19,6 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
{
#region Public Properties
public ProdModel()
{
ProjListNav = new HashSet<ProjModel>();
}
/// <summary>
/// Chiave univoca DB
/// </summary>
@@ -57,11 +54,6 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
[Index]
public int ProdId { get; set; }
/// <summary>
/// Codice Proj per sync info (Identificativo DB esterno del magazzino in sync)
/// </summary>
public int ProjCloudId { get; set; } = 0;
/// <summary>
/// Tipologia del progetto (Travi, Pareti, ...)
/// </summary>
@@ -106,11 +98,6 @@ 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
}
}
@@ -65,11 +65,6 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
[Index]
public int ProjId { get; set; }
/// <summary>
/// Codice Proj per sync info (Identificativo DB esterno del magazzino in sync)
/// </summary>
public int ProjCloudId { get; set; } = 0;
/// <summary>
/// Tipologia del progetto (Travi, Pareti, ...)
/// </summary>
@@ -1,124 +0,0 @@
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>
/// Codice RawMat univoco e in sync (Identificativo DB esterno del magazzino in sync)
/// </summary>
public int RawItemCloudId { get; set; } = 0;
/// <summary>
/// ForeignKey Materiale
/// </summary>
public int MatId { get; set; } = 0;
/// <summary>
/// Qty available on wharehouse
/// </summary>
public int QtyAvail { get; set; } = 0;
/// <summary>
/// Active/ = can be used
/// </summary>
public bool IsActive { get; set; } = false;
/// <summary>
/// Remnant
/// </summary>
public bool IsRemn { 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; } = "";
/// <summary>
/// Indica se debba usare qty effettiva o indefinita (x nesting/schedulazione a capacita illimitata)
/// </summary>
public bool UseQty { get; set; } = false;
/// <summary>
/// DataOra ultimo aggiornamento dal cloud dei dati (in particolare giacenza)
/// </summary>
public DateTime LastSync { get; set; } = DateTime.Now;
#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; }
}
}
+2 -2
View File
@@ -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;uid=root;pwd=Egalware_24068!;)
/// DB Connection string, per effettuare migration riportare valore connessione admin cablato (server=localhost;port=3306;database=EgtBwDb_000102;)
/// </summary>
public static string CONNECTION_STRING { get; set; } = "server=localhost;port=3306;database=EgtBwDb_000470;uid=root;pwd=Egalware_24068!";
public static string CONNECTION_STRING { get; set; } = "";
#endregion Public Properties
@@ -46,9 +46,6 @@
<Reference Include="EgtWPFLib5">
<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.2402.2912\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>
</Reference>
@@ -58,18 +55,15 @@
<Reference Include="Google.Protobuf, Version=3.21.9.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Protobuf.3.21.9\lib\net45\Google.Protobuf.dll</HintPath>
</Reference>
<Reference Include="K4os.Compression.LZ4, Version=1.3.6.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Compression.LZ4.1.3.6\lib\net462\K4os.Compression.LZ4.dll</HintPath>
<Reference Include="K4os.Compression.LZ4, Version=1.3.5.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Compression.LZ4.1.3.5\lib\net462\K4os.Compression.LZ4.dll</HintPath>
</Reference>
<Reference Include="K4os.Compression.LZ4.Streams, Version=1.3.6.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Compression.LZ4.Streams.1.3.6\lib\net462\K4os.Compression.LZ4.Streams.dll</HintPath>
<Reference Include="K4os.Compression.LZ4.Streams, Version=1.3.5.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Compression.LZ4.Streams.1.3.5\lib\net462\K4os.Compression.LZ4.Streams.dll</HintPath>
</Reference>
<Reference Include="K4os.Hash.xxHash, Version=1.0.8.0, Culture=neutral, PublicKeyToken=32cd54395057cec3, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Hash.xxHash.1.0.8\lib\net462\K4os.Hash.xxHash.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.7.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="MySql.Data, Version=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.8.0.21\lib\net452\MySql.Data.dll</HintPath>
</Reference>
@@ -85,9 +79,6 @@
<Reference Include="Renci.SshNet, Version=2016.1.0.0, Culture=neutral, PublicKeyToken=1cee9f8bde3db106, processorArchitecture=MSIL">
<HintPath>..\packages\SSH.NET.2016.1.0\lib\net40\Renci.SshNet.dll</HintPath>
</Reference>
<Reference Include="RestSharp, Version=110.2.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
<HintPath>..\packages\RestSharp.110.2.0\lib\net471\RestSharp.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
@@ -100,14 +91,13 @@
<Reference Include="System.Drawing" />
<Reference Include="System.Drawing.Design" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Pipelines, Version=6.0.0.3, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Pipelines.6.0.3\lib\net461\System.IO.Pipelines.dll</HintPath>
<Reference Include="System.IO.Pipelines, Version=5.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Pipelines.5.0.2\lib\net461\System.IO.Pipelines.dll</HintPath>
</Reference>
<Reference Include="System.Management" />
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http" />
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
@@ -118,20 +108,10 @@
<Reference Include="System.Security" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Text.Encodings.Web, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Encodings.Web.7.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath>
</Reference>
<Reference Include="System.Text.Json, Version=7.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Json.7.0.2\lib\net462\System.Text.Json.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Transactions" />
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
@@ -146,15 +126,6 @@
</ItemGroup>
<ItemGroup>
<Compile Include="AdminContext.cs" />
<Compile Include="Controllers\MagmanSyncController.cs" />
<Compile Include="Controllers\MagmanController.cs" />
<Compile Include="Controllers\AliasController.cs" />
<Compile Include="Controllers\RawItemsController.cs" />
<Compile Include="Controllers\MaterialsController.cs" />
<Compile Include="DatabaseModels\AliasModel.cs" />
<Compile Include="DatabaseModels\MagmanSyncModel.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" />
@@ -216,34 +187,6 @@
<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\202401291722150_FixMatItemCloudId.cs" />
<Compile Include="Migrations\202401291722150_FixMatItemCloudId.designer.cs">
<DependentUpon>202401291722150_FixMatItemCloudId.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\202401310830146_FixItemRemn.cs" />
<Compile Include="Migrations\202401310830146_FixItemRemn.designer.cs">
<DependentUpon>202401310830146_FixItemRemn.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\202402141003461_RawItemAddUseQty.cs" />
<Compile Include="Migrations\202402141003461_RawItemAddUseQty.designer.cs">
<DependentUpon>202402141003461_RawItemAddUseQty.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\202402290716188_AddProjCloudId.cs" />
<Compile Include="Migrations\202402290716188_AddProjCloudId.Designer.cs">
<DependentUpon>202402290716188_AddProjCloudId.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\202403120645357_RawItemAddLastSync.cs" />
<Compile Include="Migrations\202403120645357_RawItemAddLastSync.Designer.cs">
<DependentUpon>202403120645357_RawItemAddLastSync.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\202403120803297_AddMagmanSyncTab.cs" />
<Compile Include="Migrations\202403120803297_AddMagmanSyncTab.Designer.cs">
<DependentUpon>202403120803297_AddMagmanSyncTab.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\Configuration.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utils.cs" />
@@ -292,27 +235,6 @@
<EmbeddedResource Include="Migrations\202308250853396_AddProjArchivedField.resx">
<DependentUpon>202308250853396_AddProjArchivedField.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\202401181534084_AddAliasMaterialRawItemsModel.resx">
<DependentUpon>202401181534084_AddAliasMaterialRawItemsModel.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\202401291722150_FixMatItemCloudId.resx">
<DependentUpon>202401291722150_FixMatItemCloudId.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\202401310830146_FixItemRemn.resx">
<DependentUpon>202401310830146_FixItemRemn.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\202402141003461_RawItemAddUseQty.resx">
<DependentUpon>202402141003461_RawItemAddUseQty.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\202402290716188_AddProjCloudId.resx">
<DependentUpon>202402290716188_AddProjCloudId.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\202403120645357_RawItemAddLastSync.resx">
<DependentUpon>202403120645357_RawItemAddLastSync.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\202403120803297_AddMagmanSyncTab.resx">
<DependentUpon>202403120803297_AddMagmanSyncTab.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
@@ -1,29 +0,0 @@
// <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"); }
}
}
}
@@ -1,63 +0,0 @@
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
@@ -1,29 +0,0 @@
// <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 FixMatItemCloudId : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(FixMatItemCloudId));
string IMigrationMetadata.Id
{
get { return "202401291722150_FixMatItemCloudId"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}
@@ -1,22 +0,0 @@
namespace EgtBEAMWALL.DataLayer.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class FixMatItemCloudId : DbMigration
{
public override void Up()
{
AddColumn("dbo.MaterialsList", "MatCloudId", c => c.Int(nullable: false));
AddColumn("dbo.RawItemList", "RawItemCloudId", c => c.Int(nullable: false));
DropColumn("dbo.MaterialsList", "MatExtId");
}
public override void Down()
{
AddColumn("dbo.MaterialsList", "MatExtId", c => c.Int(nullable: false));
DropColumn("dbo.RawItemList", "RawItemCloudId");
DropColumn("dbo.MaterialsList", "MatCloudId");
}
}
}
File diff suppressed because one or more lines are too long
@@ -1,29 +0,0 @@
// <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 FixItemRemn : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(FixItemRemn));
string IMigrationMetadata.Id
{
get { return "202401310830146_FixItemRemn"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}
@@ -1,18 +0,0 @@
namespace EgtBEAMWALL.DataLayer.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class FixItemRemn : DbMigration
{
public override void Up()
{
AddColumn("dbo.RawItemList", "IsRemn", c => c.Boolean(nullable: false));
}
public override void Down()
{
DropColumn("dbo.RawItemList", "IsRemn");
}
}
}
File diff suppressed because one or more lines are too long
@@ -1,29 +0,0 @@
// <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 RawItemAddUseQty : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(RawItemAddUseQty));
string IMigrationMetadata.Id
{
get { return "202402141003461_RawItemAddUseQty"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}
@@ -1,18 +0,0 @@
namespace EgtBEAMWALL.DataLayer.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class RawItemAddUseQty : DbMigration
{
public override void Up()
{
AddColumn("dbo.RawItemList", "UseQty", c => c.Boolean(nullable: false));
}
public override void Down()
{
DropColumn("dbo.RawItemList", "UseQty");
}
}
}
File diff suppressed because one or more lines are too long
@@ -1,29 +0,0 @@
// <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 AddProjCloudId : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(AddProjCloudId));
string IMigrationMetadata.Id
{
get { return "202402290716188_AddProjCloudId"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}
@@ -1,20 +0,0 @@
namespace EgtBEAMWALL.DataLayer.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class AddProjCloudId : DbMigration
{
public override void Up()
{
AddColumn("dbo.ProjList", "ProjCloudId", c => c.Int(nullable: false));
AddColumn("dbo.ProdList", "ProjCloudId", c => c.Int(nullable: false));
}
public override void Down()
{
DropColumn("dbo.ProdList", "ProjCloudId");
DropColumn("dbo.ProjList", "ProjCloudId");
}
}
}
File diff suppressed because one or more lines are too long
@@ -1,29 +0,0 @@
// <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 RawItemAddLastSync : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(RawItemAddLastSync));
string IMigrationMetadata.Id
{
get { return "202403120645357_RawItemAddLastSync"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}
@@ -1,18 +0,0 @@
namespace EgtBEAMWALL.DataLayer.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class RawItemAddLastSync : DbMigration
{
public override void Up()
{
AddColumn("dbo.RawItemList", "LastSync", c => c.DateTime(nullable: false, precision: 0));
}
public override void Down()
{
DropColumn("dbo.RawItemList", "LastSync");
}
}
}
File diff suppressed because one or more lines are too long
@@ -1,29 +0,0 @@
// <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 AddMagmanSyncTab : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(AddMagmanSyncTab));
string IMigrationMetadata.Id
{
get { return "202403120803297_AddMagmanSyncTab"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}
@@ -1,30 +0,0 @@
namespace EgtBEAMWALL.DataLayer.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class AddMagmanSyncTab : DbMigration
{
public override void Up()
{
CreateTable(
"dbo.MagmanSync",
c => new
{
SyncId = c.Int(nullable: false, identity: true),
SyncType = c.String(unicode: false),
CloudId = c.Int(nullable: false),
DtReq = c.DateTime(nullable: false, precision: 0),
DtExe = c.DateTime(precision: 0),
Payload = c.String(unicode: false),
})
.PrimaryKey(t => t.SyncId);
}
public override void Down()
{
DropTable("dbo.MagmanSync");
}
}
}
File diff suppressed because one or more lines are too long
+3 -9
View File
@@ -2,27 +2,21 @@
<packages>
<package id="BouncyCastle" version="1.8.5" targetFramework="net472" />
<package id="DotNetZip" version="1.16.0" targetFramework="net472" />
<package id="EgwProxy.MagMan" version="1.0.2402.2912" targetFramework="net472" />
<package id="EntityFramework" version="6.4.4" targetFramework="net452" />
<package id="Google.Protobuf" version="3.21.9" targetFramework="net472" />
<package id="K4os.Compression.LZ4" version="1.3.6" targetFramework="net472" />
<package id="K4os.Compression.LZ4.Streams" version="1.3.6" targetFramework="net472" />
<package id="K4os.Compression.LZ4" version="1.3.5" targetFramework="net472" />
<package id="K4os.Compression.LZ4.Streams" version="1.3.5" targetFramework="net472" />
<package id="K4os.Hash.xxHash" version="1.0.8" targetFramework="net472" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="7.0.0" targetFramework="net472" />
<package id="MySql.Data" version="8.0.21" targetFramework="net472" />
<package id="MySql.Data.EntityFramework" version="8.0.21" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net452" />
<package id="NLog" version="5.0.1" targetFramework="net472" />
<package id="Portable.BouncyCastle" version="1.9.0" targetFramework="net472" />
<package id="RestSharp" version="110.2.0" targetFramework="net472" />
<package id="SSH.NET" version="2016.1.0" targetFramework="net472" />
<package id="System.Buffers" version="4.5.1" targetFramework="net472" />
<package id="System.IO.Pipelines" version="6.0.3" targetFramework="net472" />
<package id="System.IO.Pipelines" version="5.0.2" targetFramework="net472" />
<package id="System.Memory" version="4.5.5" targetFramework="net472" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net472" />
<package id="System.Text.Encodings.Web" version="7.0.0" targetFramework="net472" />
<package id="System.Text.Json" version="7.0.2" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
</packages>
@@ -11,14 +11,13 @@ 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()
RefreshProjectList(GoToProd)
Else
m_ProjectList = New ObservableCollection(Of ProjectFileVM)(CurrProjectList)
NotifyPropertyChanged(NameOf(ProjectList))
@@ -27,7 +26,7 @@ Public Class OpenProjectFileDialogVM
m_ProjectList_View.Filter = AddressOf ProjectFilter
End Function
Public Overrides Sub RefreshProjectList()
Public Overrides Sub RefreshProjectList(Optional GoToProd As Boolean = False)
m_ProjectList.Clear()
' calcolo periodo e righe
Dim dtStart As DateTime
@@ -452,20 +452,25 @@ Public Class BTLPartVM
OldSection = Map.refProjectVM.BTLStructureVM.SectionList.FirstOrDefault(Function(x) x = Section)
End If
m_BTLPartM.sMATERIAL = value
' se sezione nuova non presente
If Not Map.refProjectVM.BTLStructureVM.SectionList.Contains(Section) Then
' creo nuova sezione
Dim nMaterialId As Integer = DbControllers.m_MaterialsController.Insert(Section.MaterialM)
Dim NewSection = Section
Map.refProjectVM.BTLStructureVM.SectionList.Add(NewSection)
If nMaterialId <> 0 Then
NewSection.MaterialM.SetId(nMaterialId)
' aggiorno sezione
If bOtherSection Then
' se sezione nuova non presente
If Not Map.refProjectVM.BTLStructureVM.SectionList.Contains(Section) Then
' creo nuova sezione
Map.refProjectVM.BTLStructureVM.SectionList.Add(Section)
End If
Else
' se sezione nuova gia' presente
If Map.refProjectVM.BTLStructureVM.SectionList.Contains(Section) Then
' cancello sezione vecchia
Map.refProjectVM.BTLStructureVM.SectionList.Remove(OldSection)
Else
' altrimenti la modifico
If Not IsNothing(OldSection) Then
OldSection.sMaterial.Clear()
OldSection.sMaterial.Add(sMATERIAL)
End If
End If
End If
' se sezione vecchia non utilizzata da altri pezzi
If Not bOtherSection Then
' cancello sezione vecchia
Map.refProjectVM.BTLStructureVM.SectionList.Remove(OldSection)
End If
End If
NotifyPropertyChanged(NameOf(sMATERIAL))
@@ -1995,7 +2000,7 @@ Public Class BTLPartVM
' se progetto travi e sezione precedente diversa da vuota (tutti i pezzi)
If bUpdateSection AndAlso Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM AndAlso CurrSection <> SectionXMaterial.Empty Then
' se esiste, imposto sezione inversa
Dim InverseSection As SectionXMaterial = Map.refProjectVM.BTLStructureVM.SectionList.FirstOrDefault(Function(x) x.dH = CurrSection.dW AndAlso x.dW = CurrSection.dH AndAlso x.sMaterial = CurrSection.sMaterial)
Dim InverseSection As SectionXMaterial = Map.refProjectVM.BTLStructureVM.SectionList.FirstOrDefault(Function(x) x.dH = CurrSection.dW AndAlso x.dW = CurrSection.dH AndAlso x.sMaterial(0) = CurrSection.sMaterial(0))
If Not IsNothing(InverseSection) Then Map.refProjectVM.BTLStructureVM.SetSelSection(InverseSection)
End If
End Sub
@@ -2026,7 +2031,7 @@ Public Class BTLPartVM
' se progetto travi e sezione precedente diversa da vuota (tutti i pezzi)
If bUpdateSection AndAlso Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM AndAlso CurrSection <> SectionXMaterial.Empty Then
' se esiste, imposto sezione inversa
Dim InverseSection As SectionXMaterial = Map.refProjectVM.BTLStructureVM.SectionList.FirstOrDefault(Function(x) x.dH = CurrSection.dW AndAlso x.dW = CurrSection.dH AndAlso x.sMaterial = CurrSection.sMaterial)
Dim InverseSection As SectionXMaterial = Map.refProjectVM.BTLStructureVM.SectionList.FirstOrDefault(Function(x) x.dH = CurrSection.dW AndAlso x.dW = CurrSection.dH AndAlso x.sMaterial(0) = CurrSection.sMaterial(0))
If Not IsNothing(InverseSection) Then Map.refProjectVM.BTLStructureVM.SetSelSection(InverseSection)
End If
End Sub
@@ -998,12 +998,7 @@ Public Class BTLStructureVM
For Each BTLPartVM As BTLPartVM In m_BTLPartVMList
' verifico sezione, gruppo e sottogruppo per inserirli nei filtri
If Not SectionList.Contains(BTLPartVM.Section) Then
Dim nMaterialId As Integer = DbControllers.m_MaterialsController.Insert(BTLPartVM.Section.MaterialM)
Dim NewSection = BTLPartVM.Section
Map.refProjectVM.BTLStructureVM.SectionList.Add(NewSection)
If nMaterialId <> 0 Then
NewSection.MaterialM.SetId(nMaterialId)
End If
SectionList.Add(BTLPartVM.Section)
End If
If Not GroupList.Contains(BTLPartVM.sGROUP) Then
GroupList.Add(BTLPartVM.sGROUP)
@@ -152,9 +152,6 @@
<SpecificVersion>False</SpecificVersion>
<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.2402.619\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>
</Reference>
@@ -173,9 +170,6 @@
<Reference Include="K4os.Hash.xxHash, Version=1.0.8.0, Culture=neutral, PublicKeyToken=32cd54395057cec3, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Hash.xxHash.1.0.8\lib\net462\K4os.Hash.xxHash.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.7.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="MigraDoc.DocumentObjectModel-wpf, Version=1.50.5147.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
<HintPath>..\packages\PDFsharp-MigraDoc-wpf.1.50.5147\lib\net30\MigraDoc.DocumentObjectModel-wpf.dll</HintPath>
@@ -192,9 +186,6 @@
<Reference Include="MySql.Data.EntityFramework, Version=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.EntityFramework.8.0.21\lib\net452\MySql.Data.EntityFramework.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.5.0.1\lib\net46\NLog.dll</HintPath>
</Reference>
@@ -207,9 +198,6 @@
<Reference Include="Renci.SshNet, Version=2016.1.0.0, Culture=neutral, PublicKeyToken=1cee9f8bde3db106, processorArchitecture=MSIL">
<HintPath>..\packages\SSH.NET.2016.1.0\lib\net40\Renci.SshNet.dll</HintPath>
</Reference>
<Reference Include="RestSharp, Version=110.2.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
<HintPath>..\packages\RestSharp.110.2.0\lib\net471\RestSharp.dll</HintPath>
</Reference>
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
@@ -228,7 +216,6 @@
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http" />
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
@@ -237,20 +224,10 @@
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Security" />
<Reference Include="System.Text.Encodings.Web, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Encodings.Web.7.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath>
</Reference>
<Reference Include="System.Text.Json, Version=7.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Json.7.0.2\lib\net462\System.Text.Json.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Transactions" />
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
@@ -794,6 +794,12 @@ Public Class LeftPanelVM
EgtSetMode(nDuploId, GDB_MD.STD)
nPartDuploIdList.Add(nDuploId)
Next
'' salvo lista info
Dim saveInfoBeamList As MyMachGroupVM = BeamMachGroup
'Dim saveInfoBeamList As New List(Of PartVM)
'For Each info As PartVM In BeamMachGroup.PartVMList
' saveInfoBeamList.Add(info)
'Next
' calcolo posizione nuovo pezzo per rispettare ordine lunghezze
Dim nInsertIndex As Integer
' scrivo dati di tutti i pezzi
@@ -852,7 +858,38 @@ Public Class LeftPanelVM
End While
Dim sLogPath As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\RawPartLog.txt"
If Not ExecBeam(sLogPath, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdTypes.RAWPART, False) Then
Return False
EgtOutLog("Fallito inserimento grezzo nella barra in AddPartToBeam")
' elimino duplo
For Each nDuploId In nPartDuploIdList
EgtErase(nDuploId)
EgtRemoveRawPart(nDuploId)
Next
' rimuovo info duplo e aggiorno info grezzo
nPartIndex = 0
For nIndex = 0 To BeamMachGroup.PartVMList.Count - 1
If nPartIndex < nPartDuploIdList.Count() AndAlso BeamMachGroup.PartVMList(nIndex).dL > PartsToAdd(0).dL Then
EgtRemoveInfo(BeamMachGroup.Id, MGR_RPT_PART & nIndex + 1)
nPartIndex += 1
ElseIf nPartIndex < nPartDuploIdList.Count() AndAlso BeamMachGroup.PartVMList(nIndex).dL < PartsToAdd(0).dL Then
EgtRemoveInfo(BeamMachGroup.Id, MGR_RPT_PART & nIndex + 1)
nPartIndex += 1
End If
EgtRemoveInfo(BeamMachGroup.Id, MGR_RPT_PART & nIndex + nPartIndex + 1)
EgtSetInfo(BeamMachGroup.Id, MGR_RPT_PART & nIndex + 1, BeamMachGroup.PartVMList(nIndex).nPartId & "," & DoubleToString(BeamMachGroup.PartVMList(nIndex).dPOSX, 3))
Next
' elimino vecchio grezzo ed eseguo script creazione nuovo
nRawId = EgtGetFirstRawPart()
While nRawId <> GDB_ID.NULL
EgtRemoveRawPart(nRawId)
nRawId = EgtGetFirstRawPart()
End While
If Not ExecBeam(sLogPath, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdTypes.RAWPART, False) Then
EgtOutLog("Fallita esecuzione ExecBeam. ERRORE")
End If
End If
For nDuploIndex = 0 To PartsToAdd.Count - 1
EgtSetInfo(nPartDuploIdList(nDuploIndex), MGR_PRT_ROT, PartsToAdd(nDuploIndex).nROTATED)
@@ -861,7 +898,11 @@ Public Class LeftPanelVM
' aggiorno lista pezzi
BeamMachGroup.MyMachGroupM.RefreshPartList()
' seleziono pezzo aggiunto
If BeamMachGroup.PartVMList.Count > nInsertIndex Then BeamMachGroup.SelPart = BeamMachGroup.PartVMList(nInsertIndex)
If BeamMachGroup.PartVMList.Count > nInsertIndex Then
BeamMachGroup.SelPart = BeamMachGroup.PartVMList(nInsertIndex)
Else
BeamMachGroup.SelPart = BeamMachGroup.PartVMList(nInsertIndex - 1)
End If
Return True
End Function
@@ -1031,12 +1072,7 @@ Public Class LeftPanelVM
Map.refProjectVM.BTLStructureVM.SetSelBTLPart(NewPartVM, False, True)
' verifico se aggiungere sezione alla lista
If Not Map.refProjectVM.BTLStructureVM.SectionList.Contains(NewPartVM.Section) Then
Dim nMaterialId As Integer = DbControllers.m_MaterialsController.Insert(NewPartVM.Section.MaterialM)
Dim NewSection = NewPartVM.Section
Map.refProjectVM.BTLStructureVM.SectionList.Add(NewSection)
If nMaterialId <> 0 Then
NewSection.MaterialM.SetId(nMaterialId)
End If
Map.refProjectVM.BTLStructureVM.SectionList.Add(NewPartVM.Section)
End If
End If
End If
@@ -1189,7 +1225,7 @@ Public Class LeftPanelVM
' se progetto travi e sezione precedente diversa da vuota (tutti i pezzi)
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM AndAlso CurrSection <> SectionXMaterial.Empty Then
' se esiste, imposto sezione inversa
Dim InverseSection As SectionXMaterial = Map.refProjectVM.BTLStructureVM.SectionList.FirstOrDefault(Function(x) x.dH = CurrSection.dW AndAlso x.dW = CurrSection.dH AndAlso x.sMaterial = CurrSection.sMaterial)
Dim InverseSection As SectionXMaterial = Map.refProjectVM.BTLStructureVM.SectionList.FirstOrDefault(Function(x) x.dH = CurrSection.dW AndAlso x.dW = CurrSection.dH AndAlso x.sMaterial(0) = CurrSection.sMaterial(0))
If Not IsNothing(InverseSection) Then Map.refProjectVM.BTLStructureVM.SetSelSection(InverseSection)
End If
EgtDraw()
@@ -1233,7 +1269,7 @@ Public Class LeftPanelVM
' se progetto travi e sezione precedente diversa da vuota (tutti i pezzi)
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM AndAlso CurrSection <> SectionXMaterial.Empty Then
' se esiste, imposto sezione inversa
Dim InverseSection As SectionXMaterial = Map.refProjectVM.BTLStructureVM.SectionList.FirstOrDefault(Function(x) x.dH = CurrSection.dW AndAlso x.dW = CurrSection.dH AndAlso x.sMaterial = CurrSection.sMaterial)
Dim InverseSection As SectionXMaterial = Map.refProjectVM.BTLStructureVM.SectionList.FirstOrDefault(Function(x) x.dH = CurrSection.dW AndAlso x.dW = CurrSection.dH AndAlso x.sMaterial(0) = CurrSection.sMaterial(0))
If Not IsNothing(InverseSection) Then Map.refProjectVM.BTLStructureVM.SetSelSection(InverseSection)
End If
EgtDraw()
@@ -201,19 +201,47 @@ Public Class PartVM
' recupero box del layer box
Dim b3Box As New BBox3d
EgtGetBBoxGlob(nBoxLayerId, GDB_BB.STANDARD, b3Box)
If EgtRotate(nPartId, b3Box.Center, Vector3d.X_AX, 180, GDB_RT.GLOB) Then
Dim vtAxes As Vector3d
' se travi ruoto attorno all'asse Z
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.BEAM Then
vtAxes = Vector3d.Z_AX
' se pareti ruoto attorno all'asse X
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.WALL Then
vtAxes = Vector3d.X_AX
End If
If EgtRotate(nPartId, b3Box.Center, vtAxes, 180, GDB_RT.GLOB) Then
m_PartM.nFLIP = If(value, 180, 0)
EgtSetInfo(nPartId, MGR_PRT_FLIP, If(value, 180, 0))
Else
NotifyPropertyChanged(NameOf(bFLIP))
End If
' recupero box del pezzo
Dim b3Part As New BBox3d
EgtGetBBoxGlob(nPartId, GDB_BB.STANDARD, b3Part)
' calcolo distanza tra i box
Dim vtDeltaBox As Vector3d = b3Box.Min - b3Part.Min
' reinserisco il pezzo nel grezzo
EgtAddPartToRawPart(nPartId, New Point3d(dTempPosX - vtDeltaBox.x, dTempPosY - vtDeltaBox.y, 0), ParentMachGroupVM.MyMachGroupM.nRawPartId)
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL Then
' recupero box del pezzo
Dim b3Part As New BBox3d
EgtGetBBoxGlob(nPartId, GDB_BB.STANDARD, b3Part)
' calcolo distanza tra i box
Dim vtDeltaBox As Vector3d = b3Box.Min - b3Part.Min
' reinserisco il pezzo nel grezzo
EgtAddPartToRawPart(nPartId, New Point3d(dTempPosX - vtDeltaBox.x, dTempPosY - vtDeltaBox.y, 0), ParentMachGroupVM.MyMachGroupM.nRawPartId)
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM Then
' elimino vecchio grezzo ed eseguo script creazione nuovo
DeleteOldRaw()
Dim sLogPath As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\RawPartLog.txt"
If Not ExecBeam(sLogPath, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdTypes.RAWPART, False) Then
EgtOutLog("Fallita creazione barra nell'ExecBeam in bFlip")
' elimino vecchio grezzo ed eseguo script creazione nuovo
DeleteOldRaw()
If EgtRotate(nPartId, b3Box.Center, vtAxes, 180, GDB_RT.GLOB) Then
m_PartM.nFLIP = 180
EgtSetInfo(nPartId, MGR_PRT_FLIP, 180)
Else
NotifyPropertyChanged(NameOf(m_PartM.nFLIP))
End If
If Not ExecBeam(sLogPath, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdTypes.RAWPART, False) Then
EgtOutLog("Fallita esecuzione ExecBeam. ERRORE")
End If
End If
End If
' lo riseleziono
EgtSelectObj(nPartId)
' resetto validazione del pezzo
@@ -289,66 +317,140 @@ Public Class PartVM
End Sub
Private Sub Rotate(IsPositive As Boolean)
' salvo posizione
Dim dTempPosX As Double = m_PartM.dPOSX
Dim dTempPosY As Double = m_PartM.dPOSY
' tolgo il pezzo dal grezzo
EgtRemovePartFromRawPart(nPartId)
' recupero layer del box
Dim nBoxLayerId As Integer = EgtGetFirstNameInGroup(nPartId, "Box")
' recupero box del layer box
Dim b3Box As New BBox3d
EgtGetBBoxGlob(nBoxLayerId, GDB_BB.STANDARD, b3Box)
' se invertito lo reinverto
Dim bFliped As Boolean = bFLIP
If bFliped Then EgtRotate(nPartId, b3Box.Center, Vector3d.X_AX, 180, GDB_RT.GLOB)
Dim dAng As Double = If(IsPositive, 90, -90)
' eseguo rotazione
Dim bOk As Boolean = EgtRotate(nPartId, b3Box.Center, -Vector3d.Z_AX, dAng, GDB_RT.GLOB)
If bOk Then
Dim TempRot = m_PartM.dROT
TempRot += dAng
If TempRot >= 360 Then
TempRot -= 360
ElseIf TempRot < 0 Then
TempRot += 360
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM Then
' elimino vecchio grezzo ed eseguo script creazione nuovo
DeleteOldRaw()
' recupero layer del box
Dim nBoxLayerId As Integer = EgtGetFirstNameInGroup(nPartId, "Box")
' recupero box del layer box
Dim b3Box As New BBox3d
EgtGetBBoxGlob(nBoxLayerId, GDB_BB.STANDARD, b3Box)
' se invertito lo reinverto
If bFLIP Then EgtRotate(nPartId, b3Box.Center, Vector3d.Z_AX, 180, GDB_RT.GLOB)
' eseguo rotazione attorno asse X
Dim dRot As Integer = 0
If dW <> dH Then
dRot = If(IsPositive, 180, -180)
ElseIf dW = dH Then
dRot = If(IsPositive, 90, -90)
End If
m_PartM.dROT = TempRot
EgtSetInfo(nPartId, MGR_PRT_ROT, m_PartM.dROT)
End If
' ripristino eventuale inversione
If bFliped Then EgtRotate(nPartId, b3Box.Center, Vector3d.X_AX, 180, GDB_RT.GLOB)
' recupero box del pezzo
Dim b3Part As New BBox3d
EgtGetBBoxGlob(nPartId, GDB_BB.STANDARD, b3Part)
'aggiorno box del box con rotazione
EgtGetBBoxGlob(nBoxLayerId, GDB_BB.STANDARD, b3Box)
' calcolo distanza tra i box
Dim vtDeltaBox As Vector3d = b3Box.Min - b3Part.Min ' Vector3d.NULL
' calcolo posizione rispetto al riferimento
Select Case Map.refProjectVM.BTLStructureVM.nPROJTYPE
Case BWType.WALL
' se parete, valuto angolo di posizionamento
Select Case CurrentMachine.NestingCorner
Case MCH_CR.TL
'vtDeltaBox = New Vector3d(b3Box.Min.x - b3Part.Min.x, b3Box.Max.y - b3Part.Max.y, 0)
dTempPosY = dTempPosY - dW + dL
Case MCH_CR.BL
Dim bOk As Boolean = EgtRotate(nPartId, b3Box.Center, Vector3d.X_AX, dRot, GDB_RT.GLOB)
If bOk Then
Dim TempRot = m_PartM.dROT
TempRot += dRot
If TempRot >= 360 Then
TempRot -= 360
ElseIf TempRot < 0 Then
TempRot += 360
End If
m_PartM.dROT = TempRot
EgtSetInfo(nPartId, MGR_PRT_ROT, m_PartM.dROT)
End If
' ripristino eventuale inversione
If bFLIP Then EgtRotate(nPartId, b3Box.Center, Vector3d.Z_AX, 180, GDB_RT.GLOB)
Dim sLogPath As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\RawPartLog.txt"
If Not ExecBeam(sLogPath, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdTypes.RAWPART, False) Then
EgtOutLog("Fallita creazione barra nell'ExecBeam in Rotate")
' elimino vecchio grezzo ed eseguo script creazione nuovo
DeleteOldRaw()
' annullo Flip
If bFLIP Then EgtRotate(nPartId, b3Box.Center, Vector3d.Z_AX, 180, GDB_RT.GLOB)
' ripristino rotazione
Dim dRotation As Integer = 0
If dW <> dH Then
dRotation = m_PartM.dROT + dRot
m_PartM.dROT = dRotation
If dRotation >= 360 Then
dRotation = dRot
m_PartM.dROT = 0
End If
ElseIf dW = dH Then
dRotation = m_PartM.dROT - dRot
If dRotation = 0 Then
dRotation = 3 * dRot
m_PartM.dROT = 0
ElseIf dRotation = 90 Then
dRotation += 2 * dRot
m_PartM.dROT = 90
ElseIf dRotation = 180 Then
dRotation += dRot
m_PartM.dROT = 180
ElseIf dRotation < 0 Then
dRotation += 4 * dRot
m_PartM.dROT = 270
End If
End If
EgtRotate(nPartId, b3Box.Center, Vector3d.X_AX, dRotation, GDB_RT.GLOB)
' salvo informazione
EgtSetInfo(nPartId, MGR_PRT_ROT, m_PartM.dROT)
' annullo Flip
If bFLIP Then EgtRotate(nPartId, b3Box.Center, Vector3d.Z_AX, 180, GDB_RT.GLOB)
If Not ExecBeam(sLogPath, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdTypes.RAWPART, False) Then
EgtOutLog("Fallita esecuzione ExecBeam. ERRORE")
End If
NotifyPropertyChanged(NameOf(m_PartM.dROT))
End If
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL Then
' salvo posizione
Dim dTempPosX As Double = m_PartM.dPOSX
Dim dTempPosY As Double = m_PartM.dPOSY
' tolgo il pezzo dal grezzo
EgtRemovePartFromRawPart(nPartId)
' recupero layer del box
Dim nBoxLayerId As Integer = EgtGetFirstNameInGroup(nPartId, "Box")
' recupero box del layer box
Dim b3Box As New BBox3d
EgtGetBBoxGlob(nBoxLayerId, GDB_BB.STANDARD, b3Box)
' se invertito lo reinverto
If bFLIP Then EgtRotate(nPartId, b3Box.Center, Vector3d.X_AX, 180, GDB_RT.GLOB)
Dim dAng As Double = If(IsPositive, 90, -90)
' eseguo rotazione
Dim bOk As Boolean = EgtRotate(nPartId, b3Box.Center, -Vector3d.Z_AX, dAng, GDB_RT.GLOB)
If bOk Then
Dim TempRot = m_PartM.dROT
TempRot += dAng
If TempRot >= 360 Then
TempRot -= 360
ElseIf TempRot < 0 Then
TempRot += 360
End If
m_PartM.dROT = TempRot
EgtSetInfo(nPartId, MGR_PRT_ROT, m_PartM.dROT)
End If
' ripristino eventuale inversione
If bFLIP Then EgtRotate(nPartId, b3Box.Center, Vector3d.X_AX, 180, GDB_RT.GLOB)
' recupero box del pezzo
Dim b3Part As New BBox3d
EgtGetBBoxGlob(nPartId, GDB_BB.STANDARD, b3Part)
'aggiorno box del box con rotazione
EgtGetBBoxGlob(nBoxLayerId, GDB_BB.STANDARD, b3Box)
' calcolo distanza tra i box
Dim vtDeltaBox As Vector3d = b3Box.Min - b3Part.Min ' Vector3d.NULL
' calcolo posizione rispetto al riferimento
Select Case Map.refProjectVM.BTLStructureVM.nPROJTYPE
Case BWType.WALL
' se parete, valuto angolo di posizionamento
Select Case CurrentMachine.NestingCorner
Case MCH_CR.TL
'vtDeltaBox = New Vector3d(b3Box.Min.x - b3Part.Min.x, b3Box.Max.y - b3Part.Max.y, 0)
dTempPosY = dTempPosY - dW + dL
Case MCH_CR.BL
'vtDeltaBox = b3Box.Min - b3Part.Min
' non cambio posizioni
Case MCH_CR.TR
'vtDeltaBox = b3Box.Max - b3Part.Max
dTempPosX = dTempPosX - dL + dW
dTempPosY = dTempPosY - dW + dL
Case MCH_CR.BR
'vtDeltaBox = New Vector3d(b3Box.Max.x - b3Part.Max.x, b3Box.Min.y - b3Part.Min.y, 0)
dTempPosX = dTempPosX - dL + dW
End Select
Case Else
' non cambio nulla
End Select
' reinserisco il pezzo nel grezzo
EgtAddPartToRawPart(nPartId, New Point3d(dTempPosX - vtDeltaBox.x, dTempPosY - vtDeltaBox.y, 0), ParentMachGroupVM.MyMachGroupM.nRawPartId)
Case MCH_CR.TR
'vtDeltaBox = b3Box.Max - b3Part.Max
dTempPosX = dTempPosX - dL + dW
dTempPosY = dTempPosY - dW + dL
Case MCH_CR.BR
'vtDeltaBox = New Vector3d(b3Box.Max.x - b3Part.Max.x, b3Box.Min.y - b3Part.Min.y, 0)
dTempPosX = dTempPosX - dL + dW
End Select
Case Else
' non cambio nulla
End Select
' reinserisco il pezzo nel grezzo
EgtAddPartToRawPart(nPartId, New Point3d(dTempPosX - vtDeltaBox.x, dTempPosY - vtDeltaBox.y, 0), ParentMachGroupVM.MyMachGroupM.nRawPartId)
End If
' lo riseleziono
EgtSelectObj(nPartId)
' resetto validazione del pezzo
@@ -356,6 +458,14 @@ Public Class PartVM
NotifyPropertyChanged(NameOf(sROT))
End Sub
Private Sub DeleteOldRaw()
Dim nRawId As Integer = EgtGetFirstRawPart()
While nRawId <> GDB_ID.NULL
EgtRemoveRawPart(nRawId)
nRawId = EgtGetFirstRawPart()
End While
End Sub
Friend Sub SelectBTLPart()
' eseguo la selezione nella lista pezzi
Dim nBTLPartId As Integer = MyMachGroupPanelM.DuploGetOriginal(nPartId)
@@ -4,10 +4,8 @@ Imports EgtBEAMWALL.Core.ConstGen
Imports EgtBEAMWALL.Core.ConstIni
Imports EgtUILib
Imports EgtWPFLib5
Imports System.Collections.ObjectModel
Imports System.IO
Imports System.Threading
Imports System.Windows.Media.Media3D
Imports System.Windows.Threading
Public Class MainWindowVM
@@ -15,7 +13,6 @@ Public Class MainWindowVM
Private m_SupervisorCommThread As Thread
Private m_Supervisor_Timer As New DispatcherTimer
Private m_MaterialSyncroThread As Thread
' Riferimento al Model della MainWindow
Private m_MainWindowM As MainWindowM
@@ -174,141 +171,7 @@ Public Class MainWindowVM
' avvio thread di gestione della macchina che avvia la connessione
m_SupervisorCommThread.Start()
' verifico se devo copiare file warehouse in Db
Dim sWarehousePath As String = Map.refMainWindowVM.MainWindowM.sWarehouseDir & "\" & WH_MEDIUM_INI_FILE_NAME
If File.Exists(sWarehousePath) Then
Dim bOk As Boolean = False
' leggo materiali da file
Dim MaterialList As New List(Of IdMaterial)
Dim SectXMatList As New List(Of SectionXMaterial)
Dim nSectXMatIndex As Integer = 1
Dim sSxMValue As String = ""
While EgtUILib.GetPrivateProfileString(S_BEAM_LIST, nSectXMatIndex, String.Empty, sSxMValue, sWarehousePath)
Dim sSectXMatValues() As String = sSxMValue.Split(","c)
' creo parametro
Dim dW As Double = 0
Dim dH As Double = 0
StringToLenAdv(sSectXMatValues(0), dW)
StringToLenAdv(sSectXMatValues(1), dH)
Dim NewMaterial As New MaterialM(dW, dH, 0, sSectXMatValues(2))
NewMaterial.SetId(DbControllers.m_MaterialsController.Insert(NewMaterial))
MaterialList.Add(New IdMaterial(nSectXMatIndex, NewMaterial))
nSectXMatIndex += 1
End While
Dim ParamIndex As Integer = 1
Dim sValue As String = String.Empty
' leggo grezzi da file
While EgtUILib.GetPrivateProfileString(S_BEAM, "L" & ParamIndex, String.Empty, sValue, sWarehousePath)
Dim sParamValues() As String = sValue.Split(","c)
' verifico numero minimo di parametri
If sParamValues.Count >= 2 Then
' cancello spazi
For Index = 0 To sParamValues.Count - 1
sParamValues(Index) = sParamValues(Index).Trim()
Next
Dim RawPartIdMaterial As IdMaterial = MaterialList.FirstOrDefault(Function(x) x.nIndex = sParamValues(0))
' creo parametro
Dim dL As Double = 0
Dim nQty As Integer = 0
Dim nActive As Integer = 1
StringToLenAdv(sParamValues(1), dL)
If sParamValues.Count >= 3 Then Integer.TryParse(sParamValues(2), nQty)
If sParamValues.Count >= 4 Then Integer.TryParse(sParamValues(3), nActive)
DbControllers.m_RawItemsController.Upsert(New RawPartM(RawPartIdMaterial.Material, 0, dL, nQty, nActive > 0))
End If
ParamIndex += 1
End While
' ricavo SectionXMaterial tramite Wall_List
MaterialList.Clear()
nSectXMatIndex = 1
sSxMValue = ""
While EgtUILib.GetPrivateProfileString(S_WALL_LIST, nSectXMatIndex, String.Empty, sSxMValue, sWarehousePath)
Dim sSectXMatValues() As String = sSxMValue.Split(","c)
' creo parametro
Dim dH As Double = 0
StringToLenAdv(sSectXMatValues(0), dH)
Dim NewMaterial As New MaterialM(0, dH, 0, sSectXMatValues(1))
NewMaterial.SetId(DbControllers.m_MaterialsController.Insert(NewMaterial))
MaterialList.Add(New IdMaterial(nSectXMatIndex, NewMaterial))
nSectXMatIndex += 1
End While
ParamIndex = 1
While EgtUILib.GetPrivateProfileString(S_WALL, "S" & ParamIndex, String.Empty, sValue, sWarehousePath)
Dim sParamValues() As String = sValue.Split(","c)
' verifico numero minimo di parametri
If sParamValues.Count >= 3 Then
' cancello spazi
For Index = 0 To sParamValues.Count - 1
sParamValues(Index) = sParamValues(Index).Trim()
Next
Dim RawPartIdMaterial As IdMaterial = MaterialList.FirstOrDefault(Function(x) x.nIndex = sParamValues(0))
' creo parametro
Dim dW As Double = 0
Dim dL As Double = 0
Dim nQty As Integer = 0
Dim nActive As Integer = 1
StringToLenAdv(sParamValues(1), dW)
StringToLenAdv(sParamValues(2), dL)
If sParamValues.Count >= 4 Then Integer.TryParse(sParamValues(3), nQty)
If sParamValues.Count >= 5 Then Integer.TryParse(sParamValues(4), nActive)
DbControllers.m_RawItemsController.Upsert(New RawPartM(RawPartIdMaterial.Material, dW, dL, nQty, nActive > 0))
End If
ParamIndex += 1
End While
'If bOk Then
' File.Move(sWarehousePath, Path.ChangeExtension(sWarehousePath, ".old.ini"))
'End If
End If
m_MaterialSyncroThread = New Thread(Sub()
' sincronizzo magazzino con versione online
'DbControllers.m_MagmanController.ResourcesForceSyncAll()
'Dim nIndex As Integer = 0
'Dim nMaterialOk As DataLayer.Controllers.MagmanController.SyncResult = DataLayer.Controllers.MagmanController.SyncResult.ERR_ND
'While nMaterialOk <> DataLayer.Controllers.MagmanController.SyncResult.ALL_OK And nIndex < 5
' nMaterialOk = DbControllers.m_MagmanController.ResourcesForceSyncAll()
' nIndex += 1
'End While
'Dim nRawOk As DataLayer.Controllers.MagmanController.SyncResult = DataLayer.Controllers.MagmanController.SyncResult.ERR_ND
'While nRawOk <> DataLayer.Controllers.MagmanController.SyncResult.ERR_Res2SendEmpty And nIndex < 5
' nRawOk = DbControllers.m_MagmanController.ResourcesSync(New List(Of Integer)({19}))
' nIndex += 1
'End While
'Dim nMaterialOk = DbControllers.m_MagmanController.ResourcesForceSyncAll()
'Dim bCurrMaterialOK As DataLayer.Controllers.MagmanController.SyncResult = DbControllers.m_MagmanController.ResourcesSync(New List(Of Integer)({19}))
'Dim nIndex As Integer = 0
'Dim bMaterialOk As Boolean = False
'While Not bMaterialOk And nIndex < 5
' bMaterialOk = DbControllers.m_MagmanController.MaterialsSyncro()
' nIndex += 1
'End While
'If bMaterialOk Then
' 'nIndex = 0
' 'Dim bRawPartOk As Boolean = False
' 'While Not bRawPartOk And nIndex < 5
' ' Dim MaterialList As List(Of MaterialM) = DbControllers.m_MaterialsController.GetFilt("")
' ' For Each Material In MaterialList
' ' Dim bCurrMaterialOK As Boolean = DbControllers.m_MagmanController.ResourcesSync(New List(Of Integer)({Material.nId}))
' ' If Not bCurrMaterialOK Then
' ' bRawPartOk = False
' ' Exit For
' ' End If
' ' Next
' ' nIndex += 1
' 'End While
'End If
End Sub)
m_MaterialSyncroThread.SetApartmentState(ApartmentState.STA)
' avvio thread di gestione della macchina che avvia la connessione
m_MaterialSyncroThread.Start()
' sincronizzo magazzino con versione online
'DbControllers.m_MagmanController.MaterialsSyncro()
' ' verifico se richiedere di fare backup
' verifico se richiedere di fare backup
If Map.refConfigurationPageVM.SelReminder.Id <> 0 Then
Dim sBackupFolder As String = Map.refMainWindowVM.MainWindowM.sDataDir & "\Backup"
Dim nYear As Integer = 0
@@ -526,26 +389,3 @@ Public Class MainWindowVM
#End Region ' COMMANDS
End Class
Public Class IdMaterial
Private m_nIndex As Integer
Public ReadOnly Property nIndex As Integer
Get
Return m_nIndex
End Get
End Property
Private m_Material As MaterialM
Public ReadOnly Property Material As MaterialM
Get
Return m_Material
End Get
End Property
Sub New(nIndex As Integer, Material As MaterialM)
m_nIndex = nIndex
m_Material = Material
End Sub
End Class
@@ -275,7 +275,7 @@ Public Class NestingRunningWndVM
Dim nIndex As Integer = 1
' aggiungo le sezioni con diverse lunghezze in base al warehouse
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.BEAM Then
' leggo start offset
' leggo start offset
dStartOffset = WarehouseHelper.GetStartOffset()
' leggo lunghezza barra e quantity
WarehouseHelper.GetDimensionsAndQuantityForList(Map.refProjectVM.BTLStructureVM.nPROJTYPE, m_SectionProgressList)
@@ -302,37 +302,6 @@ Public Class NestingRunningWndVM
Select x.BTLPartM).ToList()
SectionProgress.SetSectionPartList(SectionPartList)
Next
' se magazzino di rete attivo e non impostato per utilizzo diretto
If GetMainPrivateProfileInt(S_GENERAL, K_NETWAREHOUSE, 0) = 1 Then
If Map.refOptimizePanelVM.UseNetWarehouse_IsChecked Then
' modifico quantita' per grezzi considerando quelli gia' presenti nel progetto
For Each SectionProgress In m_SectionProgressList
For Each Raw In SectionProgress.SParamList
Dim nProjectRawCnt As Integer = 0
For Each MachGroup As MyMachGroupVM In Map.refMachGroupPanelVM.MachGroupVMList
If MachGroup.Section = Raw.SectXMat AndAlso MachGroup.dL = Raw.dL Then
nProjectRawCnt += 1
End If
Next
Raw.nQuantity = Math.Max(Raw.nQuantity - nProjectRawCnt, 0)
Next
Next
Else
' modifico quantita' per grezzi con flag quantita' infinita
For Each SectionProgress In m_SectionProgressList
For Each Raw In SectionProgress.SParamList
If Raw.bUseQuantity Then Raw.nQuantity = SectionProgress.SectionPartList.Sum(Function(x) x.m_nCNT)
Next
Next
End If
Else
' modifico quantita' per grezzi con flag quantita' infinita
For Each SectionProgress In m_SectionProgressList
For Each Raw In SectionProgress.SParamList
If Raw.bUseQuantity Then Raw.nQuantity = SectionProgress.SectionPartList.Count
Next
Next
End If
' avvio timer avanzamento nesting
m_CurrState = SectionProgress.NestStates.NULL
m_TotTime = 0
@@ -12,7 +12,6 @@ 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))
@@ -20,7 +19,7 @@ Public Class OpenProjectFileDialogVM
' carico lista progetti
If IsNothing(CurrProjectList) OrElse CurrProjectList.Count = 0 Then
SetFixedProjectList(False)
RefreshProjectList()
RefreshProjectList(GoToProd)
Else
SetFixedProjectList(True)
m_ProjectList = New ObservableCollection(Of ProjectFileVM)(CurrProjectList)
@@ -30,7 +29,7 @@ Public Class OpenProjectFileDialogVM
m_ProjectList_View.Filter = AddressOf ProjectFilter
End Function
Public Overrides Sub RefreshProjectList()
Public Overrides Sub RefreshProjectList(Optional GoToProd As Boolean = False)
m_ProjectList.Clear()
' calcolo periodo e righe
Dim dtStart As DateTime
@@ -67,15 +66,30 @@ Public Class OpenProjectFileDialogVM
Else
DbProjectList = DbControllers.m_ProjController.GetLastByExpDesc(dtStart, dtEnd, nRowQuantity, False)
End If
If m_GoToProd Then
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
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.sProjsDir & "\" & Project.nProjId.ToString("0000") & "\" & Project.nProjId.ToString("0000") & ".nge"
Dim sPath As String = Map.refMainWindowVM.MainWindowM.sProdsDir & "\" & Project.nProdId.ToString("0000") & "\" & Project.nProdId.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 ProjFileVM(Project))
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"))
@@ -85,31 +99,16 @@ Public Class OpenProjectFileDialogVM
Else
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 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 ProjFileVM(Project))
m_ProjectList.Add(New ProdFileVM(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"))
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
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
@@ -70,15 +70,7 @@
<Image Source="/Resources/OptimizePanel/UnlockRotation.png" Stretch="Uniform"/>
</Button>
<ToggleButton ToolTip="{Binding UseNetWarehouse_ToolTip}"
IsChecked="{Binding UseNetWarehouse_IsChecked}"
Style="{StaticResource ToolBar_ToggleButton}"
Visibility="{Binding UseNetWarehouse_Visibility}">
<Image Source="/Resources/OptimizePanel/Warehouse.png" Stretch="Uniform"/>
</ToggleButton>
<Button ToolTip="{Binding Warehouse_ToolTip}"
IsEnabled="{Binding Warehouse_IsEnabled}"
Style="{StaticResource ToolBar_Button}"
Command="{Binding Warehouse_Command}"
Visibility="{Binding MachiningPage_Visibility}">
@@ -136,29 +136,6 @@ Public Class OptimizePanelVM
End Get
End Property
Public Property UseNetWarehouse_IsChecked As Boolean
Get
Return GetMainPrivateProfileInt(S_WAREHOUSE, K_USENETWAREHOUSE, 0) = 1
End Get
Set(value As Boolean)
WriteMainPrivateProfileString(S_WAREHOUSE, K_USENETWAREHOUSE, If(value, 1, 0))
NotifyPropertyChanged(NameOf(Warehouse_IsEnabled))
End Set
End Property
Private m_UseNetWarehouse_Visibility As Visibility
Public ReadOnly Property UseNetWarehouse_Visibility As Visibility
Get
Return If(GetMainPrivateProfileInt(S_GENERAL, K_NETWAREHOUSE, 0) = 1 AndAlso Map.refMainMenuVM.SelPage = Pages.MACHINING, Visibility.Visible, Visibility.Collapsed)
End Get
End Property
Public ReadOnly Property Warehouse_IsEnabled As Boolean
Get
Return If(GetMainPrivateProfileInt(S_GENERAL, K_NETWAREHOUSE, 0) = 1, Not UseNetWarehouse_IsChecked, True)
End Get
End Property
#Region "Messages"
Public ReadOnly Property LongDrillArea_Msg As String
@@ -203,15 +180,6 @@ Public Class OptimizePanelVM
End Get
End Property
Public ReadOnly Property UseNetWarehouse_ToolTip As String
Get
Dim sLastSynchronization As String = ""
GetMainPrivateProfileString(S_GENERAL, K_LASTSYNCHRONIZATION, "", sLastSynchronization)
Return "Use net warehouse" & Environment.NewLine &
String.Format("Last successfull synchronization done on {0}", sLastSynchronization)
End Get
End Property
#End Region ' Messages
' Definizione comandi
@@ -435,27 +403,6 @@ Public Class OptimizePanelVM
Friend Sub Optimize()
If IsNothing(m_SelPartType) OrElse IsNothing(m_SelOriginType) Then Return
If IsNothing(Map.refProjectVM.BTLStructureVM) OrElse IsNothing(Map.refProjectVM.BTLStructureVM.BTLPartVMList) OrElse Map.refProjectVM.BTLStructureVM.BTLPartVMList.Count = 0 Then Return
' se magazzino in rete
If GetMainPrivateProfileInt(S_GENERAL, K_NETWAREHOUSE, 0) = 1 And UseNetWarehouse_IsChecked Then
' sincronizzo magazzino locale con rete
Dim ProjectMatIdList As List(Of Integer) = (From SectionXMat In Map.refProjectVM.BTLStructureVM.SectionList
Where SectionXMat <> SectionXMaterial.Empty
Select SectionXMat.MaterialM.nId).ToList()
Dim SyncResult As DataLayer.Controllers.MagmanController.SyncResult = DbControllers.m_MagmanController.ResourcesSync(ProjectMatIdList)
If SyncResult = DataLayer.Controllers.MagmanController.SyncResult.ALL_OK OrElse
SyncResult = DataLayer.Controllers.MagmanController.SyncResult.ERR_MergeMatEmpty OrElse
SyncResult = DataLayer.Controllers.MagmanController.SyncResult.ERR_CloudMatEmpty OrElse
SyncResult = DataLayer.Controllers.MagmanController.SyncResult.ERR_Res2SendEmpty Then
WriteMainPrivateProfileString(S_GENERAL, K_LASTSYNCHRONIZATION, DateTime.Now.ToString())
NotifyPropertyChanged(NameOf(UseNetWarehouse_ToolTip))
Else
Dim sLastSynchronization As String = ""
GetMainPrivateProfileString(S_GENERAL, K_LASTSYNCHRONIZATION, "", sLastSynchronization)
MessageBox.Show("Net Warehouse Synchronization failed! Last successfull synchronization done on " & sLastSynchronization, "Error", MessageBoxButton.OK, MessageBoxImage.Error)
Return
End If
End If
' se nessun grezzo, rendo tutti i pezzi visibili
If Map.refProjectVM.MachGroupPanelVM.MachGroupVMList.Count = 0 Then
Map.refProjectVM.BTLStructureVM.ShowAll(False)
@@ -1091,12 +1091,7 @@ Public Class ProjManagerVM
Dim AddedBTLPart As BTLPartVM = Map.refProjectVM.BTLStructureVM.BTLPartVMList.FirstOrDefault(Function(x) x.BTLPartM Is NewPart)
' verifico se aggiungere sezione alla lista
If Not Map.refProjectVM.BTLStructureVM.SectionList.Contains(AddedBTLPart.Section) Then
Dim nMaterialId As Integer = DbControllers.m_MaterialsController.Insert(AddedBTLPart.Section.MaterialM)
Dim NewSection = AddedBTLPart.Section
Map.refProjectVM.BTLStructureVM.SectionList.Add(NewSection)
If nMaterialId <> 0 Then
NewSection.MaterialM.SetId(nMaterialId)
End If
Map.refProjectVM.BTLStructureVM.SectionList.Add(AddedBTLPart.Section)
End If
nNewPartId = EgtGetNextPart(nNewPartId)
End While
@@ -1312,12 +1307,7 @@ Public Class ProjManagerVM
End If
' verifico se aggiungere sezione alla lista
If Not Map.refProjectVM.BTLStructureVM.SectionList.Contains(AddedBTLPart.Section) Then
Dim nMaterialId As Integer = DbControllers.m_MaterialsController.Insert(AddedBTLPart.Section.MaterialM)
Dim NewSection = AddedBTLPart.Section
Map.refProjectVM.BTLStructureVM.SectionList.Add(NewSection)
If nMaterialId <> 0 Then
NewSection.MaterialM.SetId(nMaterialId)
End If
Map.refProjectVM.BTLStructureVM.SectionList.Add(AddedBTLPart.Section)
End If
nAddedPartId = EgtGetNextPart(nAddedPartId)
End While
@@ -175,7 +175,6 @@ Public Class ProjectVM
Map.refOptimizePanelVM.NotifyPropertyChanged(NameOf(Map.refOptimizePanelVM.ViewPage_Visibility))
Map.refOptimizePanelVM.NotifyPropertyChanged(NameOf(Map.refOptimizePanelVM.MachiningPage_Visibility))
Map.refOptimizePanelVM.NotifyPropertyChanged(NameOf(Map.refOptimizePanelVM.NestingOption_Visibility))
Map.refOptimizePanelVM.NotifyPropertyChanged(NameOf(Map.refOptimizePanelVM.UseNetWarehouse_Visibility))
End Sub
Friend Sub NotifyCalcPanel_Visibility()
@@ -298,7 +298,7 @@ Public Class StatisticsVM
Select Case Map.refProdManagerVM.CurrProd.nType
Case BWType.BEAM
For Each MachGroup As MyMachGroupVM In Map.refProjectVM.MachGroupPanelVM.MachGroupVMList
Dim RawPart As SParam = m_RawPartList.FirstOrDefault(Function(x) x.SectXMat.dW = MachGroup.dW AndAlso x.SectXMat.dH = MachGroup.dH AndAlso x.dL = MachGroup.dL AndAlso x.SectXMat.sMaterial = MachGroup.Section.sMaterial)
Dim RawPart As SParam = m_RawPartList.FirstOrDefault(Function(x) x.SectXMat.dW = MachGroup.dW AndAlso x.SectXMat.dH = MachGroup.dH AndAlso x.dL = MachGroup.dL AndAlso x.SectXMat.sMaterial.Any(Function(y) MachGroup.Section.sMaterial.Any(Function(z) z = y)))
If Not IsNothing(RawPart) Then
RawPart.nQuantity += 1
Else
@@ -307,7 +307,7 @@ Public Class StatisticsVM
Next
Case BWType.WALL
For Each MachGroup As MyMachGroupVM In Map.refProjectVM.MachGroupPanelVM.MachGroupVMList
Dim RawPart As SParam = m_RawPartList.FirstOrDefault(Function(x) x.dW = MachGroup.dW AndAlso x.SectXMat.dH = MachGroup.dH AndAlso x.dL = MachGroup.dL AndAlso x.SectXMat.sMaterial = MachGroup.Section.sMaterial)
Dim RawPart As SParam = m_RawPartList.FirstOrDefault(Function(x) x.dW = MachGroup.dW AndAlso x.SectXMat.dH = MachGroup.dH AndAlso x.dL = MachGroup.dL AndAlso x.SectXMat.sMaterial.Any(Function(y) MachGroup.Section.sMaterial.Any(Function(z) z = y)))
If Not IsNothing(RawPart) Then
RawPart.nQuantity += 1
Else
@@ -18,9 +18,6 @@ Public Module DbControllers
Public m_MachGroupController As DataLayer.Controllers.MachGroupController
Public m_StatusMapController As DataLayer.Controllers.StatusMapController
Public m_PartController As DataLayer.Controllers.PartController
Public m_MaterialsController As DataLayer.Controllers.MaterialsController
Public m_RawItemsController As DataLayer.Controllers.RawItemsController
Public m_MagmanController As DataLayer.Controllers.MagmanController
Sub Init()
End Sub
@@ -98,9 +95,6 @@ Public Module DbControllers
m_MachGroupController = New DataLayer.Controllers.MachGroupController
m_StatusMapController = New DataLayer.Controllers.StatusMapController
m_PartController = New DataLayer.Controllers.PartController
m_MaterialsController = New DataLayer.Controllers.MaterialsController
m_RawItemsController = New DataLayer.Controllers.RawItemsController
m_MagmanController = New DataLayer.Controllers.MagmanController("magman.egalware.com", "22fa4426-6670-41ad-ac2b-d7b5c3dfe849")
End Sub
End Module
@@ -7,7 +7,7 @@ Public Class SectionXMaterialToBeAdded
Inherits SectionXMaterial
Sub New(SectXMat As SectionXMaterial)
MyBase.New(SectXMat.dW, SectXMat.dH, SectXMat.dL, SectXMat.sMaterial)
MyBase.New(SectXMat.dW, SectXMat.dH, SectXMat.dL, SectXMat.sMaterial(0))
End Sub
Private m_Alias_IsChecked As Boolean
@@ -150,54 +150,48 @@ Module WarehouseHelper
Public Function GetDimensionsAndQuantityForList(Type As BWType, ByRef SectionList As List(Of SectionProgress)) As Boolean
Dim nIndex As Integer = 1
Dim sSection As String = ""
For Each SectionProgress In SectionList
Dim RawPartList As List(Of RawPartM) = DbControllers.m_RawItemsController.GetFilt(SectionProgress.Section.MaterialM.nId)
For Each RawPart In RawPartList
SectionProgress.SParamList.Add(New SParam(RawPart))
Next
Next
'While GenInterface.GetPrivateProfileString(If(Type = BWType.BEAM, WRH_BEAM, WRH_WALL), If(Type = BWType.BEAM, WRH_L, WRH_S) & nIndex, "", sSection, GetWarehouseIniPath()) > 0
' If String.IsNullOrWhiteSpace(sSection) Then Continue While
' Dim sSectionValues() As String = sSection.Split(","c)
' Dim dW As Double = 0
' Dim dL As Double = 0
' Dim nQty As Integer = 0
' Dim nActive As Integer = 0
' Dim sSectionData As String = ""
' GetPrivateProfileString(If(Type = BWType.BEAM, S_BEAM_LIST, S_WALL_LIST), sSectionValues(0), "", sSectionData, GetWarehouseIniPath())
' Dim SectionData() As String = sSectionData.Split(","c)
' Select Case Type
' Case BWType.BEAM
' Dim dSectionW As Double = 0 : StringToDoubleAdv( SectionData(0), dSectionW)
' Dim dSectionH As Double = 0 : StringToDoubleAdv( SectionData(1), dSectionH)
' For Each SectionProgress In SectionList
' If Math.Abs(SectionProgress.Section.dW - dSectionW) < 0.1 AndAlso
' Math.Abs(SectionProgress.Section.dH - dSectionH) < 0.1 AndAlso SectionProgress.Section.sMaterial = SectionData(2) Then
' If Not StringToDoubleAdv(sSectionValues(1), dL) Then Continue While
' If Not Integer.TryParse(sSectionValues(2), nQty) Then Continue While
' If sSectionValues.Count >= 4 AndAlso Integer.TryParse(sSectionValues(3), nActive) Then
' If nActive > 0 Then SectionProgress.SParamList.Add(New SParam(SectionProgress.Section, dL, nQty, nActive > 0))
' Else
' SectionProgress.SParamList.Add(New SParam(SectionProgress.Section, dL, nQty, True))
' nIndex += 1
' Continue While
' End If
' End If
' Next
' Case BWType.WALL
' Dim dSectionH As Double = 0 : StringToDoubleAdv( SectionData(0), dSectionH)
' For Each SectionProgress In SectionList
' If Math.Abs(SectionProgress.Section.dH - dSectionH) < 0.1 AndAlso SectionProgress.Section.sMaterial = SectionData(1) Then
' If Not StringToDoubleAdv(sSectionValues(1), dW) Then Continue While
' If Not StringToDoubleAdv(sSectionValues(2), dL) Then Continue While
' If Not Integer.TryParse(sSectionValues(3), nQty) Then Continue While
' If Not Integer.TryParse(sSectionValues(4), nActive) Then Continue While
' If nActive > 0 Then SectionProgress.SParamList.Add(New SParam(SectionProgress.Section, dW, dL, nQty, nActive > 0))
' End If
' Next
' End Select
' nIndex += 1
'End While
While GenInterface.GetPrivateProfileString(If(Type = BWType.BEAM, WRH_BEAM, WRH_WALL), If(Type = BWType.BEAM, WRH_L, WRH_S) & nIndex, "", sSection, GetWarehouseIniPath()) > 0
If String.IsNullOrWhiteSpace(sSection) Then Continue While
Dim sSectionValues() As String = sSection.Split(","c)
Dim dW As Double = 0
Dim dL As Double = 0
Dim nQty As Integer = 0
Dim nActive As Integer = 0
Dim sSectionData As String = ""
GetPrivateProfileString(If(Type = BWType.BEAM, S_BEAM_LIST, S_WALL_LIST), sSectionValues(0), "", sSectionData, GetWarehouseIniPath())
Dim SectionData() As String = sSectionData.Split(","c)
Select Case Type
Case BWType.BEAM
Dim dSectionW As Double = 0 : StringToDoubleAdv( SectionData(0), dSectionW)
Dim dSectionH As Double = 0 : StringToDoubleAdv( SectionData(1), dSectionH)
For Each SectionProgress In SectionList
If Math.Abs( SectionProgress.Section.dW - dSectionW) < 0.1 AndAlso
Math.Abs( SectionProgress.Section.dH - dSectionH) < 0.1 AndAlso SectionProgress.Section.sMaterial.Contains(SectionData(2)) Then
If Not StringToDoubleAdv(sSectionValues(1), dL) Then Continue While
If Not Integer.TryParse(sSectionValues(2), nQty) Then Continue While
If sSectionValues.Count >= 4 AndAlso Integer.TryParse(sSectionValues(3), nActive) Then
If nActive > 0 Then SectionProgress.SParamList.Add(New SParam(SectionProgress.Section, dL, nQty, nActive > 0))
Else
SectionProgress.SParamList.Add(New SParam(SectionProgress.Section, dL, nQty, True))
nIndex += 1
Continue While
End If
End If
Next
Case BWType.WALL
Dim dSectionH As Double = 0 : StringToDoubleAdv( SectionData(0), dSectionH)
For Each SectionProgress In SectionList
If Math.Abs( SectionProgress.Section.dH - dSectionH) < 0.1 AndAlso SectionProgress.Section.sMaterial.Contains(SectionData(1)) Then
If Not StringToDoubleAdv(sSectionValues(1), dW) Then Continue While
If Not StringToDoubleAdv(sSectionValues(2), dL) Then Continue While
If Not Integer.TryParse(sSectionValues(3), nQty) Then Continue While
If Not Integer.TryParse(sSectionValues(4), nActive) Then Continue While
If nActive > 0 Then SectionProgress.SParamList.Add(New SParam(SectionProgress.Section, dW, dL, nQty, nActive > 0))
End If
Next
End Select
nIndex += 1
End While
Return True
End Function
@@ -269,7 +263,7 @@ Module WarehouseHelper
Dim sMaterial As String = sSectXMatValues(2)
StringToLenAdv(sSectXMatValues(0), dW)
StringToLenAdv(sSectXMatValues(1), dH)
If SectXMat.dW = dW AndAlso SectXMat.dH = dH AndAlso SectXMat.sMaterial = sMaterial Then
If SectXMat.dW = dW AndAlso SectXMat.dH = dH AndAlso SectXMat.sMaterial(0) = sMaterial Then
If sSectXMatValues.Length <= 3 Then Return Nothing
Dim sValue As String = ""
If EgtUILib.GetPrivateProfileString(S_BEAM, "L" & sSectXMatValues(3), String.Empty, sValue, sWarehousePath) Then
@@ -300,7 +294,7 @@ Module WarehouseHelper
Dim dH As Double = 0
Dim sMaterial As String = sSectXMatValues(1)
StringToLenAdv(sSectXMatValues(0), dH)
If SectXMat.dH = dH AndAlso SectXMat.sMaterial = sMaterial Then
If SectXMat.dH = dH AndAlso SectXMat.sMaterial(0) = sMaterial Then
If sSectXMatValues.Length <= 2 Then Return Nothing
Dim sValue As String = ""
If EgtUILib.GetPrivateProfileString(S_WALL, "S" & sSectXMatValues(2), String.Empty, sValue, sWarehousePath) Then
@@ -343,7 +337,7 @@ Module WarehouseHelper
Dim sMaterial As String = sSectXMatValues(2)
StringToLenAdv(sSectXMatValues(0), dW)
StringToLenAdv(sSectXMatValues(1), dH)
If SectXMat.dW = dW AndAlso SectXMat.dH = dH AndAlso SectXMat.sMaterial = sMaterial Then
If SectXMat.dW = dW AndAlso SectXMat.dH = dH AndAlso SectXMat.sMaterial(0) = sMaterial Then
' recupero indice di SParam
Dim SParamIndex As Integer = 1
Dim sValue As String = ""
@@ -385,7 +379,7 @@ Module WarehouseHelper
Dim dH As Double = 0
Dim sMaterial As String = sSectXMatValues(1)
StringToLenAdv(sSectXMatValues(0), dH)
If SectXMat.dH = dH AndAlso SectXMat.sMaterial = sMaterial Then
If SectXMat.dH = dH AndAlso SectXMat.sMaterial(0) = sMaterial Then
' recupero indice di SParam
Dim SParamIndex As Integer = 1
Dim sValue As String = ""
@@ -435,7 +429,7 @@ Module WarehouseHelper
Dim sMaterial As String = sSectionValues(2)
StringToLenAdv(sSectionValues(0), dW)
StringToLenAdv(sSectionValues(1), dH)
If Section.dW = dW AndAlso Section.dH = dH AndAlso Section.sMaterial = sMaterial Then
If Section.dW = dW AndAlso Section.dH = dH AndAlso Section.sMaterial(0) = sMaterial Then
' se l'ho trovato esco dal while, il SectXMatIndex è l'indice che cercavamo
Return nIndex
End If
@@ -443,7 +437,7 @@ Module WarehouseHelper
Dim dH As Double = 0
Dim sMaterial As String = sSectionValues(1)
StringToLenAdv(sSectionValues(0), dH)
If Section.dH = dH AndAlso Section.sMaterial = sMaterial Then
If Section.dH = dH AndAlso Section.sMaterial(0) = sMaterial Then
' se l'ho trovato esco dal while, il SectXMatIndex è l'indice che cercavamo
Return nIndex
End If
@@ -24,7 +24,6 @@
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
@@ -32,7 +31,7 @@
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid>
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="2*"/>
@@ -175,12 +174,7 @@
</Grid>
<Button Grid.Row="1"
Content="Update Warehouse Quantity"
Command="{Binding UpdateNetQuantity_Command}"
ToolTip="{Binding UpdateNetQuantity_ToolTip}"/>
<GroupBox Header="{Binding SParams_Msg}" Grid.Row="2" Grid.Column="0" Margin="0,0,0,5" Visibility="{Binding Basic_Visibility}">
<GroupBox Header="{Binding SParams_Msg}" Grid.Row="1" Grid.Column="0" Margin="0,0,0,5" Visibility="{Binding Basic_Visibility}">
<ListBox ItemsSource="{Binding SParamList}"
SelectedItem="{Binding SelSParam}"
DisplayMemberPath="sValue"
@@ -188,7 +182,7 @@
MinHeight="40"/>
</GroupBox>
<GroupBox Header="{Binding SParams_Msg}" Grid.Row="2" Grid.Column="0" Margin="0,0,0,5" Visibility="{Binding Medium_Visibility}">
<GroupBox Header="{Binding SParams_Msg}" Grid.Row="1" Grid.Column="0" Margin="0,0,0,5" Visibility="{Binding Medium_Visibility}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
@@ -271,33 +265,19 @@
</DataGridTextColumn.HeaderTemplate>
</DataGridTextColumn>
<!-- Quantity -->
<DataGridTextColumn x:Key="colQTY" Binding="{Binding sQuantity}">
<DataGridTextColumn x:Key="colQTY" Binding="{Binding nQuantity}">
<DataGridTextColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=DataContext.Quantity_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:WarehouseWndV}}}"/>
</DataTemplate>
</DataGridTextColumn.HeaderTemplate>
</DataGridTextColumn>
<!-- Use Quantity -->
<DataGridTemplateColumn x:Key="colUSEQTY" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<CheckBox IsChecked="{Binding bUseQuantity, UpdateSourceTrigger=PropertyChanged}"
VerticalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="∞"/>
</DataTemplate>
</DataGridTemplateColumn.HeaderTemplate>
</DataGridTemplateColumn>
</DataGrid.Resources>
</EgtBEAMWALLCORE:EgtDataGrid>
</Grid>
</GroupBox>
<Grid Grid.Row="3" Margin="0,0,0,5" Visibility="{Binding AddRemoveBtns_Visibility}">
<Grid Grid.Row="2" Margin="0,0,0,5" Visibility="{Binding AddRemoveBtns_Visibility}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
@@ -326,7 +306,7 @@
</Button>
</Grid>
<GroupBox Header="{Binding NewParam_Msg}" Margin="0,0,0,5" Grid.Row="4" Visibility="{Binding NewBeamParam_Visibility}">
<GroupBox Header="{Binding NewParam_Msg}" Margin="0,0,0,5" Grid.Row="3" Visibility="{Binding NewBeamParam_Visibility}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
@@ -363,7 +343,7 @@
</Grid>
</GroupBox>
<GroupBox Header="{Binding NewParam_Msg}" Margin="0,0,0,5" Grid.Row="4" Visibility="{Binding NewWallParam_Visibility}">
<GroupBox Header="{Binding NewParam_Msg}" Margin="0,0,0,5" Grid.Row="3" Visibility="{Binding NewWallParam_Visibility}">
<Grid >
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
@@ -410,7 +390,7 @@
</Grid>
</GroupBox>
<Grid Grid.Row="5"
<Grid Grid.Row="4"
Margin="0,0,0,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
@@ -1,6 +1,7 @@
Imports EgtWPFLib5
Imports EgtUILib
Imports System.Collections.ObjectModel
Imports System.Windows.Forms
Imports EgtBEAMWALL.Core
Public Class WarehouseWndVM
@@ -152,15 +153,6 @@ Public Class WarehouseWndVM
End Get
End Property
Public ReadOnly Property UpdateNetQuantity_ToolTip As String
Get
Dim sLastSynchronization As String = ""
GetMainPrivateProfileString(S_GENERAL, K_LASTSYNCHRONIZATION, "", sLastSynchronization)
Return "Use net warehouse" & Environment.NewLine &
String.Format("Last successfull synchronization done on {0}", sLastSynchronization)
End Get
End Property
#End Region ' Messages
#Region "FIELDS & PROPERTIES"
@@ -437,7 +429,6 @@ Public Class WarehouseWndVM
Private m_cmdRemoveMediumParam As ICommand
Private m_cmdAddWhWallParam As ICommand
Private m_cmdRemoveWhWallParam As ICommand
Private m_cmdUpdateNetQuantity As ICommand
#End Region ' FIELDS & PROPERTIES
@@ -524,29 +515,27 @@ Public Class WarehouseWndVM
EgtUILib.GetPrivateProfileString(S_BEAM, K_OFFSET, String.Empty, sValue, sWarehousePath)
StringToLenAdv(sValue, dOffset)
'SParamList = New ObservableCollection(Of SParam)
'SectionXMaterialList = New ObservableCollection(Of SectionXMaterial)(GetSectionXMaterialsFromWarehouse())
'While EgtUILib.GetPrivateProfileString(S_BEAM, "L" & ParamIndex, String.Empty, sValue, sWarehousePath)
' Dim SParam = GetSParamFromWarehouse(ParamIndex)
' If Not IsNothing(SParam) Then
' SParamList.Add(SParam)
' End If
' ParamIndex += 1
'End While
SParamList = New ObservableCollection(Of SParam)
SectionXMaterialList = New ObservableCollection(Of SectionXMaterial)(GetSectionXMaterialsFromWarehouse())
While EgtUILib.GetPrivateProfileString(S_BEAM, "L" & ParamIndex, String.Empty, sValue, sWarehousePath)
Dim SParam = GetSParamFromWarehouse(ParamIndex)
If Not IsNothing(SParam) Then
SParamList.Add(SParam)
End If
ParamIndex += 1
End While
'' per ogni SParam seleziono il SectionXMaterial corrispondente dalla lista della Warehouse
'For Each SParam In SParamList
' Dim i As Integer = 0
' For Each SectXMat In SectionXMaterialList
' If SectXMat.sSectionXMaterial = SParam.SectXMat.sSectionXMaterial Then
' SParam.nSelSectionXMaterial = i
' End If
' i += 1
' Next
'Next
' per ogni SParam seleziono il SectionXMaterial corrispondente dalla lista della Warehouse
For Each SParam In SParamList
Dim i As Integer = 0
For Each SectXMat In SectionXMaterialList
If SectXMat.sSectionXMaterial = SParam.SectXMat.sSectionXMaterial Then
SParam.nSelSectionXMaterial = i
End If
i += 1
Next
Next
SectionXMaterialList = New ObservableCollection(Of SectionXMaterial)(DbControllers.m_MaterialsController.GetFilt("").Select(Of SectionXMaterial)(Function(x) New SectionXMaterial(x)).ToList())
SParamList = New ObservableCollection(Of SParam)(DbControllers.m_RawItemsController.GetFilt(0).Select(Of SParam)(Function(x) New SParam(x)).ToList())
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.WALL Then
Kerf_Visibility = Visibility.Visible
Offset_Visibility = Visibility.Collapsed
@@ -561,29 +550,27 @@ Public Class WarehouseWndVM
ParamIndex += 1
End While
'SParamList = New ObservableCollection(Of SParam)
'SectionXMaterialList = New ObservableCollection(Of SectionXMaterial)(GetSectionXMaterialsFromWarehouse())
'ParamIndex = 1
'While EgtUILib.GetPrivateProfileString(S_WALL, "S" & ParamIndex, String.Empty, sValue, sWarehousePath)
' Dim SParamItem As SParam = GetSParamFromWarehouse(ParamIndex)
' If Not IsNothing(SParamItem) Then
' SParamList.Add(SParamItem)
' End If
' ParamIndex += 1
'End While
SParamList = New ObservableCollection(Of SParam)
SectionXMaterialList = New ObservableCollection(Of SectionXMaterial)(GetSectionXMaterialsFromWarehouse())
ParamIndex = 1
While EgtUILib.GetPrivateProfileString(S_WALL, "S" & ParamIndex, String.Empty, sValue, sWarehousePath)
Dim SParamItem As SParam = GetSParamFromWarehouse(ParamIndex)
If Not IsNothing(SParamItem) Then
SParamList.Add(SParamItem)
End If
ParamIndex += 1
End While
'' per ogni SParam seleziono il SectionXMaterial corrispondente dalla lista della Warehouse
'For Each SParam In SParamList
' Dim i As Integer = 0
' For Each SectXMat In SectionXMaterialList
' If SectXMat.sSectionXMaterial = SParam.SectXMat.sSectionXMaterial Then
' SParam.nSelSectionXMaterial = i
' End If
' i += 1
' Next
'Next
SectionXMaterialList = New ObservableCollection(Of SectionXMaterial)(DbControllers.m_MaterialsController.GetFilt("").Select(Of SectionXMaterial)(Function(x) New SectionXMaterial(x)).ToList())
SParamList = New ObservableCollection(Of SParam)(DbControllers.m_RawItemsController.GetFilt(0).Select(Of SParam)(Function(x) New SParam(x)).ToList())
' per ogni SParam seleziono il SectionXMaterial corrispondente dalla lista della Warehouse
For Each SParam In SParamList
Dim i As Integer = 0
For Each SectXMat In SectionXMaterialList
If SectXMat.sSectionXMaterial = SParam.SectXMat.sSectionXMaterial Then
SParam.nSelSectionXMaterial = i
End If
i += 1
Next
Next
End If
@@ -695,41 +682,40 @@ Public Class WarehouseWndVM
WritePrivateProfileString(S_BEAM, K_OFFSET, LenToString(dOffset, 3), sWarehousePath)
ParamIndex = 1
For Each SPItem In SParamList
'Dim sL As String = String.Empty
'sL = LenToString(SParamList(ParamIndex - 1).dL, 3)
Dim sL As String = String.Empty
sL = LenToString(SParamList(ParamIndex - 1).dL, 3)
'' ricavo l'indice del SecionXMaterial dalla Beam_List
'Dim SectXMatIndex As Integer = GetSectIndexFromSection(MachineType.BEAM, SParamList(ParamIndex - 1).SectXMat)
''Dim sSxMValue As String = ""
''While EgtUILib.GetPrivateProfileString(S_BEAM_LIST, SectXMatIndex, String.Empty, sSxMValue, sWarehousePath)
'' Dim sSectXMatValues() As String = sSxMValue.Split(","c)
'' ' creo parametro
'' Dim dW As Double = 0
'' Dim dH As Double = 0
'' Dim sMaterial As String = sSectXMatValues(2)
'' StringToLenAdv(sSectXMatValues(0), dW)
'' StringToLenAdv(sSectXMatValues(1), dH)
'' If SParamList(ParamIndex - 1).SectXMat.dW = dW AndAlso SParamList(ParamIndex - 1).SectXMat.dH = dH AndAlso SParamList(ParamIndex - 1).SectXMat.sMaterial(0) = sMaterial Then
'' ' se l'ho trovato esco dal while, il SectXMatIndex è l'indice che cercavamo
'' Exit While
'' End If
'' SectXMatIndex += 1
''End While
'If SectXMatIndex > 0 Then
' WritePrivateProfileString(S_BEAM, K_L & ParamIndex,
' SectXMatIndex & "," & sL & "," & SParamList(ParamIndex - 1).nQuantity & "," & If(SParamList(ParamIndex - 1).bActive, 1, 0),
' sWarehousePath)
' ParamIndex += 1
'Else
' EgtOutLog("Error in material creation, section not found!")
'End If
DbControllers.m_RawItemsController.Upsert(SPItem.RawPart)
' ricavo l'indice del SecionXMaterial dalla Beam_List
Dim SectXMatIndex As Integer = GetSectIndexFromSection(MachineType.BEAM, SParamList(ParamIndex - 1).SectXMat)
'Dim sSxMValue As String = ""
'While EgtUILib.GetPrivateProfileString(S_BEAM_LIST, SectXMatIndex, String.Empty, sSxMValue, sWarehousePath)
' Dim sSectXMatValues() As String = sSxMValue.Split(","c)
' ' creo parametro
' Dim dW As Double = 0
' Dim dH As Double = 0
' Dim sMaterial As String = sSectXMatValues(2)
' StringToLenAdv(sSectXMatValues(0), dW)
' StringToLenAdv(sSectXMatValues(1), dH)
' If SParamList(ParamIndex - 1).SectXMat.dW = dW AndAlso SParamList(ParamIndex - 1).SectXMat.dH = dH AndAlso SParamList(ParamIndex - 1).SectXMat.sMaterial(0) = sMaterial Then
' ' se l'ho trovato esco dal while, il SectXMatIndex è l'indice che cercavamo
' Exit While
' End If
' SectXMatIndex += 1
'End While
If SectXMatIndex > 0 Then
WritePrivateProfileString(S_BEAM, K_L & ParamIndex,
SectXMatIndex & "," & sL & "," & SParamList(ParamIndex - 1).nQuantity & "," & If(SParamList(ParamIndex - 1).bActive, 1, 0),
sWarehousePath)
ParamIndex += 1
Else
EgtOutLog("Error in material creation, section not found!")
End If
Next
' Se ci sono parametri da rimuovere li rimuovo
For Index = ParamIndex To ParamIndex + m_RemovedParamsCount
WritePrivateProfileString(S_BEAM, K_L & Index, Nothing, sWarehousePath)
Next
'' Se ci sono parametri da rimuovere li rimuovo
'For Index = ParamIndex To ParamIndex + m_RemovedParamsCount
' WritePrivateProfileString(S_BEAM, K_L & Index, Nothing, sWarehousePath)
'Next
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.WALL Then
' Verifico che i valori siano tutti > 0
If dKerf < 0 OrElse dOffset < 0 Then
@@ -938,7 +924,7 @@ Public Class WarehouseWndVM
Public Sub RemoveParam()
If Not IsNothing(SelSParam) Then
If SelSParam.Equals(SelCurrentS) Then
If MessageBox.Show(RemoveCurrent_Msg, Attention_Msg, MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.Yes Then
If MessageBox.Show(RemoveCurrent_Msg, Attention_Msg, MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.Yes Then
SParamList.Remove(SelSParam)
m_RemovedParamsCount += 1
If SParamList.Count > 0 Then
@@ -1048,45 +1034,6 @@ Public Class WarehouseWndVM
#End Region ' RemoveWhWallParam
#Region "UpdateNetQuantity"
Public ReadOnly Property UpdateNetQuantity_Command As ICommand
Get
If m_cmdUpdateNetQuantity Is Nothing Then
m_cmdUpdateNetQuantity = New Command(AddressOf UpdateNetQuantity)
End If
Return m_cmdUpdateNetQuantity
End Get
End Property
Public Sub UpdateNetQuantity()
Dim ProjectMatIdList As List(Of Integer) = (From SectionXMat In Map.refProjectVM.BTLStructureVM.SectionList
Where SectionXMat <> SectionXMaterial.Empty
Select SectionXMat.MaterialM.nId).ToList()
Dim SyncResult As DataLayer.Controllers.MagmanController.SyncResult = DbControllers.m_MagmanController.ResourcesSync(ProjectMatIdList)
If SyncResult = DataLayer.Controllers.MagmanController.SyncResult.ALL_OK OrElse
SyncResult = DataLayer.Controllers.MagmanController.SyncResult.ERR_MergeMatEmpty OrElse
SyncResult = DataLayer.Controllers.MagmanController.SyncResult.ERR_CloudMatEmpty OrElse
SyncResult = DataLayer.Controllers.MagmanController.SyncResult.ERR_Res2SendEmpty Then
WriteMainPrivateProfileString(S_GENERAL, K_LASTSYNCHRONIZATION, DateTime.Now.ToString())
Map.refOptimizePanelVM.NotifyPropertyChanged(NameOf(Map.refOptimizePanelVM.UseNetWarehouse_ToolTip))
NotifyPropertyChanged(NameOf(UpdateNetQuantity_ToolTip))
Else
Dim sLastSynchronization As String = ""
GetMainPrivateProfileString(S_GENERAL, K_LASTSYNCHRONIZATION, "", sLastSynchronization)
MessageBox.Show("Net Warehouse Synchronization failed! Last successfull synchronization done on " & sLastSynchronization, "Error", MessageBoxButton.OK, MessageBoxImage.Error)
End If
' aggiorno elementi in lista
For Each SParam In m_SParamList
If ProjectMatIdList.Contains(SParam.RawPart.Material.nId) Then
SParam.UpdateRawPart()
End If
Next
End Sub
#End Region ' RemoveWhWallParam
#End Region ' COMMANDS
#Region "METHODS"
@@ -1101,11 +1048,7 @@ Public Class WarehouseWndVM
End If
' aggiorno la visibilità delle colonne
For Each col In SParamColumns
If col.Name = COL_USEQTY Then
col.ColumnVisibility = If(GetMainPrivateProfileInt(S_GENERAL, K_NETWAREHOUSE, 0) = 1, Visibility.Visible, Visibility.Collapsed)
Else
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
End If
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
Next
End Sub
@@ -1161,7 +1104,7 @@ Public Class WarehouseWndVM
Dim dH As Double = 0
StringToLenAdv(sSectXMatValues(0), dW)
StringToLenAdv(sSectXMatValues(1), dH)
If Not SectXMatList.Any(Function(x) x.dW = dW AndAlso x.dH = dH AndAlso x.sMaterial = sSectXMatValues(2)) Then
If Not SectXMatList.Any(Function(x) x.dW = dW AndAlso x.dH = dH AndAlso x.sMaterial(0) = sSectXMatValues(2)) Then
SectXMatList.Add(New SectionXMaterial(dW, dH, 0, sSectXMatValues(2)))
End If
sSectXMatIndex += 1
@@ -1175,7 +1118,7 @@ Public Class WarehouseWndVM
' creo parametro
Dim dH As Double = 0
StringToLenAdv(sSectXMatValues(0), dH)
If Not SectXMatList.Any(Function(x) x.dH = dH AndAlso x.sMaterial = sSectXMatValues(1)) Then
If Not SectXMatList.Any(Function(x) x.dH = dH AndAlso x.sMaterial(0) = sSectXMatValues(1)) Then
SectXMatList.Add(New SectionXMaterial(0, dH, 0, sSectXMatValues(1)))
End If
sSectXMatIndex += 1
@@ -1191,37 +1134,35 @@ Public Class WarehouseWndVM
Dim sWarehousePath As String = Map.refMainWindowVM.MainWindowM.sWarehouseDir & "\" & WH_MEDIUM_INI_FILE_NAME
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.BEAM Then
'' ricavo SectionXMaterial tramite Beam_List
'While EgtUILib.GetPrivateProfileString(S_BEAM_LIST, sSectXMatIndex, String.Empty, sSxMValue, sWarehousePath) > 0
' ' verifico se uguale
' Dim sSectXMatValues() As String = sSxMValue.Split(","c)
' ' creo parametro
' Dim dW As Double = 0
' Dim dH As Double = 0
' StringToLenAdv(sSectXMatValues(0), dW)
' StringToLenAdv(sSectXMatValues(1), dH)
' Dim ReadSection As New SectionXMaterial(dW, dH, 0, sSectXMatValues(2))
' If ReadSection = SectionXMaterial Then Return False
' sSectXMatIndex += 1
'End While
'WritePrivateProfileString(S_BEAM_LIST, sSectXMatIndex, LenToString(SectionXMaterial.dW, 3) & "," &
' LenToString(SectionXMaterial.dH, 3) & "," &
' SectionXMaterial.sMaterial, sWarehousePath)
DbControllers.m_MaterialsController.Insert(SectionXMaterial.MaterialM)
' ricavo SectionXMaterial tramite Beam_List
While EgtUILib.GetPrivateProfileString(S_BEAM_LIST, sSectXMatIndex, String.Empty, sSxMValue, sWarehousePath) > 0
' verifico se uguale
Dim sSectXMatValues() As String = sSxMValue.Split(","c)
' creo parametro
Dim dW As Double = 0
Dim dH As Double = 0
StringToLenAdv(sSectXMatValues(0), dW)
StringToLenAdv(sSectXMatValues(1), dH)
Dim ReadSection As New SectionXMaterial(dW, dH, 0, sSectXMatValues(2))
If ReadSection = SectionXMaterial Then Return False
sSectXMatIndex += 1
End While
WritePrivateProfileString(S_BEAM_LIST, sSectXMatIndex, LenToString(SectionXMaterial.dW, 3) & "," &
LenToString(SectionXMaterial.dH, 3) & "," &
SectionXMaterial.sMaterial(0), sWarehousePath)
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.WALL Then
'' ricavo SectionXMaterial tramite Wall_List
'While EgtUILib.GetPrivateProfileString(S_WALL_LIST, sSectXMatIndex, String.Empty, sSxMValue, sWarehousePath)
' Dim sSectXMatValues() As String = sSxMValue.Split(","c)
' ' creo parametro
' Dim dH As Double = 0
' StringToLenAdv(sSectXMatValues(0), dH)
' Dim ReadSection As New SectionXMaterial(0, dH, 0, sSectXMatValues(1))
' If ReadSection = SectionXMaterial Then Return False
' sSectXMatIndex += 1
'End While
'WritePrivateProfileString(S_WALL_LIST, sSectXMatIndex, LenToString(SectionXMaterial.dH, 3) & "," &
' SectionXMaterial.sMaterial, sWarehousePath)
DbControllers.m_MaterialsController.Insert(SectionXMaterial.MaterialM)
' ricavo SectionXMaterial tramite Wall_List
While EgtUILib.GetPrivateProfileString(S_WALL_LIST, sSectXMatIndex, String.Empty, sSxMValue, sWarehousePath)
Dim sSectXMatValues() As String = sSxMValue.Split(","c)
' creo parametro
Dim dH As Double = 0
StringToLenAdv(sSectXMatValues(0), dH)
Dim ReadSection As New SectionXMaterial(0, dH, 0, sSectXMatValues(1))
If ReadSection = SectionXMaterial Then Return False
sSectXMatIndex += 1
End While
WritePrivateProfileString(S_WALL_LIST, sSectXMatIndex, LenToString(SectionXMaterial.dH, 3) & "," &
SectionXMaterial.sMaterial(0), sWarehousePath)
End If
Return True
End Function
@@ -1366,13 +1307,6 @@ Public Class SParam
Inherits VMBase
Implements IComparable
Private m_RawPart As RawPartM
Public ReadOnly Property RawPart As RawPartM
Get
Return m_RawPart
End Get
End Property
Public ReadOnly Property W_Msg As String
Get
Return EgtMsg(61759)
@@ -1391,12 +1325,13 @@ Public Class SParam
End Get
End Property
Private m_bActive As Boolean
Public Property bActive As Boolean
Get
Return m_RawPart.bActive
Return m_bActive
End Get
Set(value As Boolean)
m_RawPart.bActive = value
m_bActive = value
End Set
End Property
@@ -1407,55 +1342,36 @@ Public Class SParam
End Get
Set(value As SectionXMaterial)
m_SectXMat = value
If Not IsNothing(m_SectXMat) AndAlso Not IsNothing(m_SectXMat.MaterialM) Then
m_RawPart.Material = m_SectXMat.MaterialM
End If
End Set
End Property
Private m_dW As Double
Public Property dW As Double
Get
Return m_RawPart.dW
Return m_dW
End Get
Set(value As Double)
m_RawPart.dW = value
m_dW = value
End Set
End Property
Private m_dL As Double
Public Property dL As Double
Get
Return m_RawPart.dL
Return m_dL
End Get
Set(value As Double)
m_RawPart.dL = value
m_dL = value
End Set
End Property
Private m_nQuantity As Integer
Public Property nQuantity As Integer
Get
Return m_RawPart.nQuantity
Return m_nQuantity
End Get
Set(value As Integer)
m_RawPart.nQuantity = value
End Set
End Property
Public Property sQuantity As String
Get
Return If(GetMainPrivateProfileInt(S_GENERAL, K_NETWAREHOUSE, 0) = 1 And bUseQuantity, "---", m_RawPart.nQuantity)
End Get
Set(value As String)
m_RawPart.nQuantity = value
End Set
End Property
Public Property bUseQuantity As Boolean
Get
Return m_RawPart.bUseQuantity
End Get
Set(value As Boolean)
m_RawPart.bUseQuantity = value
NotifyPropertyChanged(NameOf(sQuantity))
m_nQuantity = value
End Set
End Property
@@ -1580,37 +1496,36 @@ Public Class SParam
Public ReadOnly Property sMaterial As String
Get
Return If(IsNothing(SectXMat), "", SectXMat.sMaterial)
Return If(IsNothing(SectXMat), "", SectXMat.sMaterial(0))
End Get
End Property
#End Region ' For Statistics
Sub New(W As Double, L As Double)
m_RawPart = New RawPartM(Nothing, W, L, 0, False)
m_dW = W
m_dL = L
End Sub
Sub New(L As Double)
m_RawPart = New RawPartM(Nothing, 0, L, 0, False)
m_dL = L
End Sub
Sub New(SxM As SectionXMaterial, W As Double, L As Double, Qty As Integer, Active As Boolean)
m_RawPart = New RawPartM(If(Not IsNothing(SxM), SxM.MaterialM, Nothing), W, L, Qty, Active)
m_SectXMat = SxM
m_dW = W
m_dL = L
m_nQuantity = Qty
m_bActive = Active
MediumW_Visibility = Visibility.Visible
Quantity_Visibility = Visibility.Visible
End Sub
Sub New(SxM As SectionXMaterial, L As Double, Qty As Integer, Active As Boolean)
m_RawPart = New RawPartM(If(Not IsNothing(SxM), SxM.MaterialM, Nothing), 0, L, Qty, Active)
m_SectXMat = SxM
Quantity_Visibility = Visibility.Visible
End Sub
Sub New(RawPartM As RawPartM)
m_RawPart = RawPartM
m_SectXMat = New SectionXMaterial(RawPart.Material)
' m_SectXMat = Map.refWarehouseWndVM.SectionXMaterialList.FirstOrDefault(Function(x) x.MaterialM = RawPart.Material)
m_dL = L
m_nQuantity = Qty
m_bActive = Active
Quantity_Visibility = Visibility.Visible
End Sub
@@ -1635,17 +1550,6 @@ Public Class SParam
End Get
End Property
Friend Sub UpdateRawPart()
Dim UpdatedRawPart As RawPartM = DbControllers.m_RawItemsController.FindByDbId(RawPart.nId)
m_RawPart.Update(UpdatedRawPart)
NotifyPropertyChanged(NameOf(dW))
NotifyPropertyChanged(NameOf(dL))
NotifyPropertyChanged(NameOf(sQuantity))
NotifyPropertyChanged(NameOf(bUseQuantity))
NotifyPropertyChanged(NameOf(bActive))
End Sub
End Class
Public Class WhWallParam
@@ -2,28 +2,21 @@
<packages>
<package id="BouncyCastle" version="1.8.5" targetFramework="net472" />
<package id="DotNetZip" version="1.16.0" targetFramework="net472" />
<package id="EgwProxy.MagMan" version="1.0.2402.619" targetFramework="net472" />
<package id="EntityFramework" version="6.4.4" targetFramework="net452" />
<package id="Google.Protobuf" version="3.21.9" targetFramework="net472" />
<package id="K4os.Compression.LZ4" version="1.3.5" targetFramework="net472" />
<package id="K4os.Compression.LZ4.Streams" version="1.3.5" targetFramework="net472" />
<package id="K4os.Hash.xxHash" version="1.0.8" targetFramework="net472" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="7.0.0" targetFramework="net472" />
<package id="MySql.Data" version="8.0.21" targetFramework="net472" />
<package id="MySql.Data.EntityFramework" version="8.0.21" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net472" />
<package id="NLog" version="5.0.1" targetFramework="net472" />
<package id="PDFsharp-MigraDoc-wpf" version="1.50.5147" targetFramework="net472" />
<package id="Portable.BouncyCastle" version="1.9.0" targetFramework="net472" />
<package id="RestSharp" version="110.2.0" targetFramework="net472" />
<package id="SSH.NET" version="2016.1.0" targetFramework="net472" />
<package id="System.Buffers" version="4.5.1" targetFramework="net472" />
<package id="System.IO.Pipelines" version="5.0.2" targetFramework="net472" />
<package id="System.Memory" version="4.5.5" targetFramework="net472" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net472" />
<package id="System.Text.Encodings.Web" version="7.0.0" targetFramework="net472" />
<package id="System.Text.Json" version="7.0.2" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
</packages>
Binary file not shown.
Binary file not shown.