- correzioni al warehouse con last material

This commit is contained in:
Emmanuele Sassi
2022-12-23 17:55:27 +01:00
parent 6a0ebb9fee
commit e207ed7ece
3 changed files with 94 additions and 50 deletions
@@ -580,32 +580,36 @@ Public Class LeftPanelVM
Dim sL As String = String.Empty
sL = LenToString(CurrSParam.dL, 3)
' ricavo l'indice del SecionXMaterial dalla Beam_List
Dim SectXMatIndex As Integer = 1
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)
StringToLen(sSectXMatValues(0), dW)
StringToLen(sSectXMatValues(1), dH)
If CurrSParam.SectXMat.dW = dW AndAlso CurrSParam.SectXMat.dH = dH AndAlso CurrSParam.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
Dim SectXMatIndex As Integer = GetSectIndexFromSection(MachineType.BEAM, CurrSParam.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)
' StringToLen(sSectXMatValues(0), dW)
' StringToLen(sSectXMatValues(1), dH)
' If CurrSParam.SectXMat.dW = dW AndAlso CurrSParam.SectXMat.dH = dH AndAlso CurrSParam.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
' ricavo nuovo indice materiale
Dim ParamIndex As Integer = 1
Dim sParam As String = ""
While GetPrivateProfileString(S_BEAM, K_L & ParamIndex, "", sParam, sWarehousePath) > 0
ParamIndex += 1
End While
' lo aggiungo in warehouse
WritePrivateProfileString(S_BEAM, K_L & ParamIndex,
If SectXMatIndex > 0 Then
' lo aggiungo in warehouse
WritePrivateProfileString(S_BEAM, K_L & ParamIndex,
SectXMatIndex & "," & sL & "," & CurrSParam.nQuantity & "," & If(CurrSParam.bActive, 1, 0),
sWarehousePath)
Else
EgtOutLog("Error in material creation, section not found!")
End If
Return CurrSParam
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.WALL Then
' creo sParam
@@ -339,4 +339,35 @@ Module WarehouseHelper
End If
End Sub
Friend Function GetSectIndexFromSection(Type As BWType, Section As SectionXMaterial) As Integer
Dim nIndex As Integer = 1
Dim sSectionData As String = ""
While GetPrivateProfileString(If(Type = BWType.BEAM, S_BEAM_LIST, S_WALL_LIST), nIndex, "", sSectionData, GetWarehouseIniPath()) > 0
If String.IsNullOrWhiteSpace(sSectionData) Then Continue While
Dim sSectionValues() As String = sSectionData.Split(","c)
Select Case Type
Case BWType.BEAM
Dim dW As Double = 0
Dim dH As Double = 0
Dim sMaterial As String = sSectionValues(2)
StringToLen(sSectionValues(0), dW)
StringToLen(sSectionValues(1), dH)
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
Case BWType.WALL
Dim dH As Double = 0
Dim sMaterial As String = sSectionValues(1)
StringToLen(sSectionValues(0), dH)
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
End Select
nIndex += 1
End While
Return -1
End Function
End Module
@@ -682,28 +682,32 @@ Public Class WarehouseWndVM
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 = 1
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)
StringToLen(sSectXMatValues(0), dW)
StringToLen(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
WritePrivateProfileString(S_BEAM, K_L & ParamIndex,
' 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)
' StringToLen(sSectXMatValues(0), dW)
' StringToLen(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
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
@@ -745,20 +749,23 @@ Public Class WarehouseWndVM
sL = LenToString(SParamList(ParamIndex - 1).dL, 3)
' ricavo l'indice del SecionXMaterial dalla Wall_List
Dim SectXMatIndex As Integer = 1
Dim sSxMValue As String = ""
While EgtUILib.GetPrivateProfileString(S_WALL_LIST, SectXMatIndex, String.Empty, sSxMValue, sWarehousePath)
If sSxMValue = SParamList(ParamIndex - 1).sValue Then
' se l'ho trovato esco dal while, il SectXMatIndex è l'indice che cercavamo
Exit While
End If
SectXMatIndex += 1
End While
WritePrivateProfileString(S_WALL, K_S & ParamIndex,
Dim SectXMatIndex As Integer = GetSectIndexFromSection(MachineType.WALL, SParamList(ParamIndex - 1).SectXMat)
'Dim sSxMValue As String = ""
'While EgtUILib.GetPrivateProfileString(S_WALL_LIST, SectXMatIndex, String.Empty, sSxMValue, sWarehousePath)
' If sSxMValue = SParamList(ParamIndex - 1).sValue 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_WALL, K_S & ParamIndex,
SectXMatIndex & "," & sW & "," & sL & "," & SParamList(ParamIndex - 1).nQuantity & "," & If(SParamList(ParamIndex - 1).bActive, 1, 0),
sWarehousePath)
ParamIndex += 1
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
@@ -1108,7 +1115,9 @@ Public Class WarehouseWndVM
' creo parametro
Dim dH As Double = 0
StringToLen(sSectXMatValues(0), dH)
SectXMatList.Add(New SectionXMaterial(0, dH, 0, sSectXMatValues(1)))
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
End While
End If