Merge remote-tracking branch 'origin/feature/NewWarehouse' into DataLayer

This commit is contained in:
Samuele Locatelli
2024-02-14 10:57:33 +01:00
18 changed files with 440 additions and 146 deletions
@@ -23,5 +23,6 @@
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
+1
View File
@@ -47,6 +47,7 @@ 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"
+4
View File
@@ -10,6 +10,9 @@ Public Class MaterialM
Return m_nId
End Get
End Property
Public Sub SetId(nId As Integer)
m_nId = nId
End Sub
Protected m_Material As String
Public ReadOnly Property sMaterial As String
@@ -41,6 +44,7 @@ Public Class MaterialM
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
+15 -1
View File
@@ -9,6 +9,9 @@ Public Class RawPartM
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
@@ -60,6 +63,16 @@ Public Class RawPartM
End Set
End Property
Private m_bUseQuantity As Integer
Public Property bUseQuantity As Integer
Get
Return m_bUseQuantity
End Get
Set(value As Integer)
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
@@ -68,12 +81,13 @@ Public Class RawPartM
m_bActive = Active
End Sub
Sub New(nId As Integer, SxM As MaterialM, W As Double, L As Double, Qty As Integer, Active As Boolean)
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
+5 -1
View File
@@ -18,7 +18,7 @@ Public Class SectionXMaterial
Protected m_Material As String
Public ReadOnly Property sMaterial As String
Get
Return m_Material
Return m_MaterialM.sMaterial
End Get
End Property
@@ -106,6 +106,10 @@ Public Class SectionXMaterial
m_Material = sMaterial
End Sub
Sub New(MaterialM As MaterialM)
m_MaterialM = MaterialM
End Sub
Public Shared Empty As New SectionXMaterial(-1, -1, -1, "")
#Region "Import BTL <-> Warehouse"
@@ -32,7 +32,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
// 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.IsActive);
Core.RawPartM answ = new Core.RawPartM(dbRec.RawItemId, matRec, (double)dbRec.WMm, (double)dbRec.LMm, dbRec.QtyAvail, true, dbRec.IsActive);
return answ;
}
@@ -998,7 +998,11 @@ 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)
SectionList.Add(BTLPartVM.Section)
If nMaterialId <> 0 Then
SectionList(SectionList.Count - 1).MaterialM.SetId(nMaterialId)
End If
End If
If Not GroupList.Contains(BTLPartVM.sGROUP) Then
GroupList.Add(BTLPartVM.sGROUP)
@@ -152,6 +152,9 @@
<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>
@@ -170,6 +173,9 @@
<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>
@@ -186,6 +192,9 @@
<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>
@@ -198,6 +207,9 @@
<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>
@@ -216,6 +228,7 @@
<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>
@@ -224,10 +237,20 @@
<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" />
@@ -4,8 +4,10 @@ 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
@@ -13,6 +15,7 @@ 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
@@ -171,7 +174,139 @@ Public Class MainWindowVM
' avvio thread di gestione della macchina che avvia la connessione
m_SupervisorCommThread.Start()
' verifico se richiedere di fare backup
' 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 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
If Map.refConfigurationPageVM.SelReminder.Id <> 0 Then
Dim sBackupFolder As String = Map.refMainWindowVM.MainWindowM.sDataDir & "\Backup"
Dim nYear As Integer = 0
@@ -389,3 +524,26 @@ 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)
@@ -70,7 +70,15 @@
<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,6 +136,30 @@ Public Class OptimizePanelVM
End Get
End Property
Private m_UseNetWarehouse_IsChecked As Boolean
Public Property UseNetWarehouse_IsChecked As Boolean
Get
Return m_UseNetWarehouse_IsChecked
End Get
Set(value As Boolean)
m_UseNetWarehouse_IsChecked = value
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 m_UseNetWarehouse_IsChecked, True)
End Get
End Property
#Region "Messages"
Public ReadOnly Property LongDrillArea_Msg As String
@@ -175,6 +175,7 @@ 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()
@@ -19,6 +19,8 @@ Public Module DbControllers
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
@@ -97,6 +99,8 @@ Public Module DbControllers
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
@@ -150,48 +150,54 @@ 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 = ""
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
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
Return True
End Function
@@ -272,6 +272,14 @@
</DataTemplate>
</DataGridTextColumn.HeaderTemplate>
</DataGridTextColumn>
<DataGridTemplateColumn x:Key="colUSEQTY" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<CheckBox IsChecked="{Binding bUseQuantity, UpdateSourceTrigger=PropertyChanged}"
VerticalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Resources>
</EgtBEAMWALLCORE:EgtDataGrid>
</Grid>
@@ -515,27 +515,29 @@ 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
@@ -550,27 +552,29 @@ 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
'' 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())
End If
@@ -682,40 +686,41 @@ 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
Next
' Se ci sono parametri da rimuovere li rimuovo
For Index = ParamIndex To ParamIndex + m_RemovedParamsCount
WritePrivateProfileString(S_BEAM, K_L & Index, Nothing, sWarehousePath)
'' 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)
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
@@ -1048,7 +1053,11 @@ Public Class WarehouseWndVM
End If
' aggiorno la visibilità delle colonne
For Each col In SParamColumns
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
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
Next
End Sub
@@ -1134,35 +1143,37 @@ 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)
'' 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)
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)
'' 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)
End If
Return True
End Function
@@ -1381,6 +1392,15 @@ Public Class SParam
End Set
End Property
Public Property bUseQuantity As Boolean
Get
Return m_RawPart.nQuantity
End Get
Set(value As Boolean)
m_RawPart.nQuantity = value
End Set
End Property
Private m_nSelSectionXMaterial As Integer
Public Property nSelSectionXMaterial As Integer
Get
@@ -1529,6 +1549,13 @@ Public Class SParam
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)
Quantity_Visibility = Visibility.Visible
End Sub
' definizione di CompareTo per il Sort degli SParam (Materiale -> 1^ dimensione -> 2^ dimensione)
Public Function CompareTo(obj As Object) As Integer Implements IComparable.CompareTo
Dim SParamItem As SParam = DirectCast(obj, SParam)
@@ -2,21 +2,28 @@
<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>