Compare commits
321 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 651de09d7d | |||
| 23844a542f | |||
| 895af630e3 | |||
| e826a0ed1d | |||
| d79f3aa848 | |||
| 2361e1f6f8 | |||
| f1640f75f8 | |||
| a58f7d9fda | |||
| a20f40085c | |||
| 89975169a2 | |||
| 8a2d9fc4ea | |||
| ed68b0da5c | |||
| 2a5ecc4a09 | |||
| 095d155f1a | |||
| fdc7adb0da | |||
| b67bf887e9 | |||
| ddad3ea228 | |||
| 60032d5336 | |||
| 2d9dcfa12a | |||
| 97727d097e | |||
| bece291a6e | |||
| 80dd455ef3 | |||
| 82bfdb7473 | |||
| 7a0d4f33f1 | |||
| 37df943c08 | |||
| da972cdd0a | |||
| 454024d4bd | |||
| 1828b88382 | |||
| 891bbd4a08 | |||
| 1fb7699382 | |||
| c9f47e23f2 | |||
| c0b007994a | |||
| 18d1368c8c | |||
| 49610fba06 | |||
| da5456b13a | |||
| 1cddcb28dc | |||
| b9517e1cc5 | |||
| f3ed0cf817 | |||
| 26f96d42c6 | |||
| 8624dd6fc6 | |||
| 90dc9ddd4e | |||
| d8c2a94c75 | |||
| f24dcd0bc5 | |||
| 3b368ac504 | |||
| f5ac9ddac2 | |||
| 3f4547179c | |||
| a5866a8eb6 | |||
| ae736a9fff | |||
| 05da1f2d9e | |||
| a8c2154444 | |||
| bac7b490be | |||
| 907e8c355c | |||
| ab2925ba74 | |||
| 747e25315d | |||
| 922b1a4787 | |||
| 1a926d8f49 | |||
| b4140ce9ab | |||
| b6f255695c | |||
| 29250f344c | |||
| b3b7ea865a | |||
| 9903c41009 | |||
| d4fc382a51 | |||
| 846597b01f | |||
| 83e9f051a5 | |||
| 685d899df0 | |||
| 8fcdbca3cf | |||
| 8618fd332e | |||
| 941d896ffa | |||
| 88dd388fe3 | |||
| 7aef151a44 | |||
| d7edf38d57 | |||
| 85f9703353 | |||
| 9aa27dd21d | |||
| f01f6b9ef6 | |||
| b8f8ae8af1 | |||
| c3c45157d3 | |||
| 29accd4f35 | |||
| c6c5936f41 | |||
| 25dd993b7c | |||
| 6f9e4e43bf | |||
| cfefeaa4c5 | |||
| e76f650ced | |||
| 9580911f63 | |||
| d3b4afb8ff | |||
| 26779d2120 | |||
| 4ae90231e1 | |||
| bb55e2acb4 | |||
| 66b2fbca9a | |||
| b977e106ef | |||
| 5f4cd60bd3 | |||
| 6117506135 | |||
| 84fa23e76c | |||
| 5c38d688b1 | |||
| ee7bfba114 | |||
| a8fb99c9cf | |||
| f58fa27908 | |||
| 898f9a7703 | |||
| 8d95fccef2 | |||
| f62792c650 | |||
| fc8730683f | |||
| 2075661927 | |||
| bbb0545ff4 | |||
| e11c3991ac | |||
| f8d7b95149 | |||
| 276a2d21a3 | |||
| 31a06ab64a | |||
| 0b5ae544a5 | |||
| c09a74e92c | |||
| 3b9749ef67 | |||
| a938f2cc6e | |||
| 699bc24318 | |||
| f4b12de2f0 | |||
| 2f8ef75ce7 | |||
| fc1a9828dc | |||
| f7c7e3a7f5 | |||
| 3eb25c3533 | |||
| 208ee3a883 | |||
| 4c1289ed2d | |||
| 91798cdd00 | |||
| dceabbfa37 | |||
| a477a93186 | |||
| dd536c8cbb | |||
| b1ce12e110 | |||
| c28555080a | |||
| 95f867dfe3 | |||
| e5c8544c59 | |||
| 70082e03a5 | |||
| 3f7f352919 | |||
| 60260ea451 | |||
| 2fc81d3258 | |||
| 9d2b78fd4d | |||
| 376f54ab37 | |||
| 07a26632dd | |||
| 23ac186eb1 | |||
| ceb9bf2d18 | |||
| bb772e4a1f | |||
| bab90cf7dc | |||
| 4471fd4564 | |||
| 4d9211ae20 | |||
| e14101134c | |||
| f73e59a434 | |||
| 4ed15194b4 | |||
| c652d5930f | |||
| 23cbb48527 | |||
| ddc36ba729 | |||
| 443bd8e9d8 | |||
| cbcbc3e854 | |||
| 1368f15957 | |||
| c26a186dcb | |||
| a341659996 | |||
| 0857ec3c1b | |||
| 37d6941eeb | |||
| bbdbaf823c | |||
| 2d34c70a1b | |||
| 18745e3158 | |||
| 184fc1ad77 | |||
| 9caf440696 | |||
| b167342437 | |||
| 376cdfaff9 | |||
| ff839b5d8a | |||
| 9b86c92639 | |||
| 8cb610cdf9 | |||
| 24594a4d24 | |||
| ebcba6dec3 | |||
| d99d34af7f | |||
| 084220230c | |||
| 4177c1a0ae | |||
| dbf0d6211b | |||
| c77e8bd6a5 | |||
| 5a39cd80d3 | |||
| 2295305bf1 | |||
| fcff7cfbb7 | |||
| 025c57d78f | |||
| 49d75d575a | |||
| 4e9e17d937 | |||
| bc47a8d419 | |||
| a2ba210f74 | |||
| e5695049fe | |||
| 6b340a6ec8 | |||
| 57e7d8e099 | |||
| ee422c8e17 | |||
| 0457bed4ba | |||
| 49c30cbb5b | |||
| bbf97f7066 | |||
| 814b94bf97 | |||
| 86bd547f8d | |||
| 7dca4d63b4 | |||
| 528bbf6fb6 | |||
| 5b29302b93 | |||
| 2f325ff7fd | |||
| 5ec47d3a9c | |||
| eb52018b83 | |||
| 807759a331 | |||
| 9dccb99d38 | |||
| 9de97768b3 | |||
| daf8045b10 | |||
| f8c2c28ada | |||
| 985c28332f | |||
| 5494838ed4 | |||
| c5308cb6f5 | |||
| 19c42bfa8e | |||
| 32f6f72a1a | |||
| 3a113c97bb | |||
| 515ce5ef33 | |||
| 7fc702df50 | |||
| 272c6f46db | |||
| e64a89f3f1 | |||
| 1ebffd8e93 | |||
| 8d8ae29cc8 | |||
| 6b7d3ce6b5 | |||
| 53ed0b4775 | |||
| 5e69f0dd5c | |||
| 86feb7e9a3 | |||
| 74dfb67dae | |||
| bd9e3def79 | |||
| 2f03f59eea | |||
| 421e2e2214 | |||
| 00d43473f5 | |||
| afe64db075 | |||
| d039e39205 | |||
| 96538f600f | |||
| ca37a2f3c2 | |||
| 415ae0a39c | |||
| b576276c7a | |||
| af17747b38 | |||
| 152d57de16 | |||
| 78505e0f2b | |||
| 540afe7c6a | |||
| 180068f667 | |||
| be50c87b7f | |||
| 11e6cc449c | |||
| cd23546c4b | |||
| f4fb37c9d2 | |||
| a128b42bb4 | |||
| 81d4f42849 | |||
| f9328f9684 | |||
| b99c7b8ba6 | |||
| f82cc3be10 | |||
| fb7b160512 | |||
| bfa01f1d8d | |||
| 44014b9144 | |||
| a25e80dd49 | |||
| e64cbb521b | |||
| 5b7f50686c | |||
| 7ac80309e8 | |||
| fa63d82dc5 | |||
| 4b06fbfaf3 | |||
| a252ff0568 | |||
| cde144de29 | |||
| b7b50ed222 | |||
| 7f9e637626 | |||
| 30aba16ed3 | |||
| f355f80743 | |||
| 60dddcbba4 | |||
| 7b89a46487 | |||
| 21f2695cfe | |||
| dd920d2bff | |||
| f865d73ec3 | |||
| da501c6e68 | |||
| a1bfaeee75 | |||
| b50732100b | |||
| 4e35f56bcb | |||
| f194128738 | |||
| c153189ffa | |||
| 7b2425773d | |||
| 4dc269ebf7 | |||
| 7599503601 | |||
| 9ceed14f85 | |||
| ffd4ae2e46 | |||
| 8f0b47bd64 | |||
| 6295d882a0 | |||
| 3bd0d4759f | |||
| c1b7e80d6f | |||
| 9e5bbfcb39 | |||
| 7c06122527 | |||
| 90dc459d99 | |||
| 48957218be | |||
| cc1eb18ca2 | |||
| 79da5a3ac0 | |||
| 42424414b3 | |||
| 78106ea7ca | |||
| e2cc1b3ae8 | |||
| 75c791666a | |||
| 29c371fcae | |||
| 0698dd4c0c | |||
| 636abf6402 | |||
| 2ece2b096a | |||
| 6e6861b803 | |||
| a8bcb1cef3 | |||
| ca749abe53 | |||
| 2d366b5ac2 | |||
| 95a70cb6d4 | |||
| 1697185723 | |||
| c04a38177a | |||
| ee872d762c | |||
| 0560862d5f | |||
| 7b72f03b9b | |||
| bb2e666695 | |||
| 26b802c5ed | |||
| 969eb267af | |||
| b6bced549f | |||
| 463d4962e0 | |||
| ec4eb8adb5 | |||
| a5f05181c4 | |||
| 3dbd1b43ea | |||
| b8c8ec9e79 | |||
| 07231a4bcf | |||
| d93f1fae04 | |||
| b1994e504a | |||
| 7e34c83653 | |||
| e1e388ff9d | |||
| 8a5a1997b3 | |||
| a522044c12 | |||
| 6483a2812d | |||
| 19d1344263 | |||
| b34580450f | |||
| 5609e073bb | |||
| 475a8299bd | |||
| ac7d85ce9d | |||
| 7e07024942 | |||
| 3dd82f8c16 |
+106
-64
@@ -171,16 +171,6 @@ Public Class BTLFeatureM
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_nCALC_FALL As Integer
|
||||
Public Property nCALC_FALL As Integer
|
||||
Get
|
||||
Return m_nCALC_FALL
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_nCALC_FALL = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_sCALC_MSG As String
|
||||
Public Property sCALC_MSG As String
|
||||
Get
|
||||
@@ -255,51 +245,55 @@ Public Class BTLFeatureM
|
||||
NewBTLFeature.m_ParentPart = ParentPart
|
||||
NewBTLFeature.m_nFeatureId = nFeatureId
|
||||
' leggo gruppo, numero feature e lato
|
||||
EgtGetInfo(nFeatureId, BTL_FTR_GRP, NewBTLFeature.nSelGRP)
|
||||
EgtGetInfo(nFeatureId, BTL_FTR_PRC, NewBTLFeature.nPRC)
|
||||
EgtGetInfo(nFeatureId, BTL_FTR_SIDE, NewBTLFeature.nSelSIDE)
|
||||
EgtGetInfo(nFeatureId, BTL_FTR_GRP, NewBTLFeature.m_nSelGRP)
|
||||
EgtGetInfo(nFeatureId, BTL_FTR_PRC, NewBTLFeature.m_nPRC)
|
||||
EgtGetInfo(nFeatureId, BTL_FTR_SIDE, NewBTLFeature.m_nSelSIDE)
|
||||
Dim nDO As Integer = 1
|
||||
If EgtGetInfo(nFeatureId, BTL_FTR_DO, nDO) Then
|
||||
NewBTLFeature.bDO = (nDO <> 0)
|
||||
NewBTLFeature.m_bDO = (nDO <> 0)
|
||||
Else
|
||||
NewBTLFeature.bDO = True
|
||||
NewBTLFeature.m_bDO = True
|
||||
End If
|
||||
' leggo des,prid e frame
|
||||
EgtGetInfo(nFeatureId, BTL_FTR_DES, NewBTLFeature.sDES)
|
||||
EgtGetInfo(nFeatureId, BTL_FTR_PRID, NewBTLFeature.nPRID)
|
||||
EgtGetInfo(nFeatureId, BTL_FTR_FRAME, NewBTLFeature.frFRAME)
|
||||
EgtGetInfo(nFeatureId, BTL_FTR_DES, NewBTLFeature.m_sDES)
|
||||
EgtGetInfo(nFeatureId, BTL_FTR_PRID, NewBTLFeature.m_nPRID)
|
||||
EgtGetInfo(nFeatureId, BTL_FTR_FRAME, NewBTLFeature.m_frFRAME)
|
||||
' leggo calc error
|
||||
Dim nErr As Integer = 0
|
||||
Dim nRot As Integer = 0
|
||||
Dim nFall As Integer = 0
|
||||
Dim sMsg As String = ""
|
||||
Dim bCalc As Boolean = False
|
||||
bCalc = EgtGetInfo(NewBTLFeature.nFeatureId, ITG_PROJ_ERR, nErr)
|
||||
EgtGetInfo(nFeatureId, ITG_PROJ_ROT, nRot)
|
||||
EgtGetInfo(nFeatureId, ITG_PROJ_FALL, nFall)
|
||||
EgtGetInfo(nFeatureId, ITG_PROJ_MSG, sMsg)
|
||||
If Not bCalc Then
|
||||
NewBTLFeature.nState = CalcStates.NOTCALCULATED
|
||||
NewBTLFeature.nCALC_ERR = 0
|
||||
NewBTLFeature.nCALC_ROT = 0
|
||||
NewBTLFeature.nCALC_FALL = 0
|
||||
NewBTLFeature.sCALC_MSG = ""
|
||||
If IsNothing(ParentPart) Then
|
||||
bCalc = EgtGetInfo(NewBTLFeature.nFeatureId, ITG_PROD_ERR, nErr)
|
||||
EgtGetInfo(nFeatureId, ITG_PROD_ROT, nRot)
|
||||
EgtGetInfo(nFeatureId, ITG_PROD_MSG, sMsg)
|
||||
Else
|
||||
NewBTLFeature.nCALC_ERR = nErr
|
||||
NewBTLFeature.nCALC_ROT = nRot
|
||||
NewBTLFeature.nCALC_FALL = nFall
|
||||
NewBTLFeature.sCALC_MSG = sMsg
|
||||
bCalc = EgtGetInfo(NewBTLFeature.nFeatureId, ITG_PROJ_ERR, nErr)
|
||||
EgtGetInfo(nFeatureId, ITG_PROJ_ROT, nRot)
|
||||
EgtGetInfo(nFeatureId, ITG_PROJ_MSG, sMsg)
|
||||
End If
|
||||
If Not bCalc Then
|
||||
NewBTLFeature.m_nState = CalcStates.NOTCALCULATED
|
||||
NewBTLFeature.m_nCALC_ERR = 0
|
||||
NewBTLFeature.m_nCALC_ROT = 0
|
||||
NewBTLFeature.m_sCALC_MSG = ""
|
||||
Else
|
||||
NewBTLFeature.m_nCALC_ERR = nErr
|
||||
NewBTLFeature.m_nCALC_ROT = nRot
|
||||
NewBTLFeature.m_sCALC_MSG = sMsg
|
||||
If nErr = 0 Then
|
||||
NewBTLFeature.nState = 0
|
||||
ElseIf nErr > 1 Then
|
||||
NewBTLFeature.nState = 1
|
||||
ElseIf nErr < 1 Then
|
||||
NewBTLFeature.nState = -1
|
||||
NewBTLFeature.nState = CalcStates.OK
|
||||
ElseIf nErr = 17 Then
|
||||
NewBTLFeature.nState = CalcStates.WARNING
|
||||
ElseIf nErr > 0 Then
|
||||
NewBTLFeature.nState = CalcStates.ERROR_
|
||||
ElseIf nErr < 0 Then
|
||||
NewBTLFeature.nState = CalcStates.INFO
|
||||
End If
|
||||
End If
|
||||
' leggo parametri della feature
|
||||
GetBeamPrivateProfileGRPList(CalcBeamPrivateProfileGRP(NewBTLFeature.nSelGRP), NewBTLFeature.nPRC, NewBTLFeature.GRPList)
|
||||
GetBeamPrivateProfileName(NewBTLFeature.nSelGRP, NewBTLFeature.nPRC, NewBTLFeature)
|
||||
GetBeamPrivateProfileGRPList(CalcBeamPrivateProfileGRP(NewBTLFeature.m_nSelGRP), NewBTLFeature.m_nPRC, NewBTLFeature.m_GRPList)
|
||||
GetBeamPrivateProfileName(NewBTLFeature.m_nSelGRP, NewBTLFeature.m_nPRC, NewBTLFeature)
|
||||
' crea parametri per questa feature da file ini
|
||||
NewBTLFeature.CreateFeatureParams(NewBTLFeature)
|
||||
' leggo parametri delle feature
|
||||
@@ -309,10 +303,10 @@ Public Class BTLFeatureM
|
||||
|
||||
Public Shared Function CreateBTLFeature(nPRC As Integer, nGRP As Integer, nSIDE As Integer) As BTLFeatureM
|
||||
Dim NewBTLFeature As New BTLFeatureM
|
||||
NewBTLFeature.nPRC = nPRC
|
||||
NewBTLFeature.nSelGRP = nGRP
|
||||
NewBTLFeature.nSelSIDE = nSIDE
|
||||
NewBTLFeature.bDO = True
|
||||
NewBTLFeature.m_nPRC = nPRC
|
||||
NewBTLFeature.m_nSelGRP = nGRP
|
||||
NewBTLFeature.m_nSelSIDE = nSIDE
|
||||
NewBTLFeature.m_bDO = True
|
||||
' crea parametri per questa feature da file ini
|
||||
NewBTLFeature.CreateFeatureParams(NewBTLFeature)
|
||||
Return NewBTLFeature
|
||||
@@ -389,6 +383,7 @@ Public Class BTLFeatureM
|
||||
Return ReadFeatureParams(m_PBTLParamMList) And ReadFeatureParams(m_QBTLParamMList)
|
||||
End Function
|
||||
Private Function ReadFeatureParams(ParamList As List(Of BTLParamM)) As Boolean
|
||||
Dim bToRecalc As Boolean = False
|
||||
' leggo valore parametro da struttura geometrica
|
||||
For Each Param As BTLParamM In ParamList
|
||||
If Param.nType = BTLParamType.DOUBLE_ Or Param.nType = BTLParamType.LENGTH Then
|
||||
@@ -396,18 +391,43 @@ Public Class BTLFeatureM
|
||||
If Not EgtGetInfo(m_nFeatureId, Param.sName, dParamValue) Then
|
||||
dParamValue = 0
|
||||
End If
|
||||
Param.dValue = dParamValue
|
||||
' se è un parametro P setto il valore letto nel DB
|
||||
If Param.bIsP Then
|
||||
Param.SetValue(dParamValue)
|
||||
Else
|
||||
' se è un parametro Q verifico nel progetto se sia un valore custom
|
||||
Dim nCustom As Integer = 0
|
||||
EgtGetInfo(nFeatureId, Param.sName & "A", nCustom)
|
||||
If nCustom = 1 Then
|
||||
Param.SetValue(dParamValue)
|
||||
Param.bCustom = True
|
||||
' altrimenti lo setto al valore di default
|
||||
Else
|
||||
Param.SetValue(Param.dDefault)
|
||||
Dim dReadValue As Double = 0
|
||||
EgtGetInfo(m_nFeatureId, Param.sName, dReadValue)
|
||||
If dReadValue <> Param.dDefault Then
|
||||
EgtSetInfo(m_nFeatureId, Param.sName, Param.dDefault)
|
||||
bToRecalc = True
|
||||
End If
|
||||
Param.bCustom = False
|
||||
End If
|
||||
End If
|
||||
ElseIf Param.nType = BTLParamType.STRING_ Then
|
||||
Dim sParamValue As String = String.Empty
|
||||
EgtGetInfo(m_nFeatureId, Param.sName, sParamValue)
|
||||
Param.sValue = sParamValue
|
||||
Param.SetValue(sParamValue)
|
||||
ElseIf Param.nType = BTLParamType.COMBO Then
|
||||
Dim nParamValue As Integer
|
||||
EgtGetInfo(m_nFeatureId, Param.sName, nParamValue)
|
||||
Param.nSelValue = nParamValue
|
||||
End If
|
||||
Next
|
||||
Return False
|
||||
' Se necessario ricalcolo, lo eseguo
|
||||
If bToRecalc Then
|
||||
UpdateParams()
|
||||
End If
|
||||
Return True
|
||||
End Function
|
||||
|
||||
' funzione che setta i valori di default a tutti i parametri
|
||||
@@ -418,9 +438,9 @@ Public Class BTLFeatureM
|
||||
' leggo valore parametro da struttura geometrica
|
||||
For Each Param As BTLParamM In ParamList
|
||||
If Param.nType = BTLParamType.DOUBLE_ Or Param.nType = BTLParamType.LENGTH Then
|
||||
Param.dValue = Param.dDefault
|
||||
Param.SetValue(Param.dDefault)
|
||||
ElseIf Param.nType = BTLParamType.STRING_ Then
|
||||
Param.sValue = ""
|
||||
Param.SetValue("")
|
||||
ElseIf Param.nType = BTLParamType.COMBO Then
|
||||
Param.nSelValue = Param.dDefault
|
||||
End If
|
||||
@@ -429,10 +449,10 @@ Public Class BTLFeatureM
|
||||
End Function
|
||||
|
||||
' funzione che calcola array dei valori dei parametri
|
||||
Public Function CalcParamArray(ByRef vPar() As Double, ByRef sPar As String) As Boolean
|
||||
Public Function CalcParamArray(ByRef vPar() As Double, ByRef sPar As String, ByRef vParQ() As String) As Boolean
|
||||
' verifico che lista parametri non sia vuota
|
||||
If IsNothing(m_PBTLParamMList) OrElse m_PBTLParamMList.Count = 0 Then Return False
|
||||
' caclcolo lunghezza array
|
||||
' calcolo lunghezza array Parametri
|
||||
Dim nLastParId As Integer = m_PBTLParamMList(m_PBTLParamMList.Count - 1).nId - 1
|
||||
Dim vTempPar(nLastParId) As Double
|
||||
Dim sTempPar As String = String.Empty
|
||||
@@ -450,34 +470,56 @@ Public Class BTLFeatureM
|
||||
End Select
|
||||
Next
|
||||
vPar = vTempPar
|
||||
If String.IsNullOrEmpty(sTempPar) Then
|
||||
sPar = " "
|
||||
Else
|
||||
sPar = sTempPar
|
||||
End If
|
||||
sPar = If(String.IsNullOrEmpty(sTempPar), " ", sTempPar)
|
||||
' Determino parametri Q
|
||||
Dim vTempParQ(m_QBTLParamMList.Count) As String
|
||||
For ParQIndex = 0 To m_QBTLParamMList.Count - 1
|
||||
Dim ParQ As BTLParamM = m_QBTLParamMList(ParQIndex)
|
||||
vTempParQ(ParQIndex) = ParQ.sName & ":" & If(ParQ.nType <> BTLParamType.STRING_, DoubleToString(ParQ.dValue, 3), ParQ.sValue)
|
||||
Next
|
||||
Dim sDO As String = ""
|
||||
If Not bDO Then sDO = 0
|
||||
vTempParQ(m_QBTLParamMList.Count) = "DO:" & sDO
|
||||
vParQ = vTempParQ
|
||||
Return True
|
||||
End Function
|
||||
|
||||
' funzione che aggiorna parametri della feature
|
||||
Public Function UpdateParams(nNewGRP As Integer, nNewPRC As Integer, nNewSIDE As Integer, sNewDesc As String, nNewProcId As Integer,
|
||||
frNewRef As Frame3d, vNewPar() As Double, sNewPar As String) As Boolean
|
||||
frNewRef As Frame3d, vNewParP() As Double, sNewPar As String, vNewParQ As String()) As Boolean
|
||||
' aggiorno la feature con nuovo valore
|
||||
Dim vPar() As Double = Nothing
|
||||
Dim sPar As String = String.Empty
|
||||
CalcParamArray(vPar, sPar)
|
||||
Dim vParQ() As String = Nothing
|
||||
CalcParamArray(vPar, sPar, vParQ)
|
||||
Dim nFeatureId As Integer = EgtBeamModifyProcess(Me.nFeatureId, nNewGRP, nNewPRC, nNewSIDE, sNewDesc, nNewProcId,
|
||||
frNewRef, vNewPar, sNewPar)
|
||||
If nFeatureId <> GDB_ID.NULL Then
|
||||
frNewRef, vNewParP, sNewPar, vNewParQ)
|
||||
Dim bOk As Boolean = nFeatureId <> GDB_ID.NULL
|
||||
If bOk Then
|
||||
' riporto parametri Q custom
|
||||
For Each QPar In QBTLParamMList
|
||||
If QPar.bCustom Then EgtSetInfo(nFeatureId, QPar.sName & "A", 1)
|
||||
Next
|
||||
SetFeatureId(nFeatureId)
|
||||
' imposto modificato per copie
|
||||
EgtDuploSetModified(ParentPart.nPartId)
|
||||
Return True
|
||||
bOk = True
|
||||
Else
|
||||
MessageBox.Show("Impossible create feature with this values", "Error")
|
||||
nFeatureId = EgtBeamModifyProcess(Me.nFeatureId, Me.nSelGRP, Me.nPRC, Me.nSelSIDE, "", Me.nPRID, New Frame3d(), vPar, sPar)
|
||||
' Impossibile creare una feature con questi valori - ERRORE
|
||||
MessageBox.Show(EgtMsg(61852), EgtMsg(30007))
|
||||
nFeatureId = EgtBeamModifyProcess(Me.nFeatureId, Me.nSelGRP, Me.nPRC, Me.nSelSIDE, "", Me.nPRID, New Frame3d(), vPar, sPar, vParQ)
|
||||
SetFeatureId(nFeatureId)
|
||||
Return False
|
||||
bOk = False
|
||||
End If
|
||||
Return bOk
|
||||
End Function
|
||||
Public Function UpdateParams() As Boolean
|
||||
' aggiorno la feature con nuovo valore
|
||||
Dim vPar() As Double = Nothing
|
||||
Dim sPar As String = String.Empty
|
||||
Dim vParQ() As String = Nothing
|
||||
CalcParamArray(vPar, sPar, vParQ)
|
||||
Return UpdateParams(Me.nSelGRP, Me.nPRC, Me.nSelSIDE, Me.sDES, Me.nPRID, Me.frFRAME, vPar, sPar, vParQ)
|
||||
End Function
|
||||
|
||||
' funzione che restituisce se la feature è un contorno libero
|
||||
@@ -7,7 +7,6 @@ Imports EgtWPFLib5
|
||||
|
||||
Public Class BTLParamM
|
||||
|
||||
|
||||
' parametro che dice se il parametro e' P o Q
|
||||
Protected m_bIsP As Boolean = True
|
||||
Public ReadOnly Property bIsP As Boolean
|
||||
@@ -16,6 +15,17 @@ Public Class BTLParamM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
' parametro che dice se il parametro e' stato modificato
|
||||
Protected m_bIsModified As Boolean
|
||||
Public Property bIsModified As Boolean
|
||||
Get
|
||||
Return m_bIsModified
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_bIsModified = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' parametri da struttura
|
||||
Protected m_sName As String
|
||||
Public Property sName As String
|
||||
@@ -82,6 +92,10 @@ Public Class BTLParamM
|
||||
m_dValue = value
|
||||
End Set
|
||||
End Property
|
||||
Public Sub SetValue(value As Double)
|
||||
m_dValue = value
|
||||
End Sub
|
||||
|
||||
Protected m_sValue As String
|
||||
Public Overridable Property sValue As String
|
||||
Get
|
||||
@@ -91,6 +105,9 @@ Public Class BTLParamM
|
||||
m_sValue = value
|
||||
End Set
|
||||
End Property
|
||||
Public Sub SetValue(value As String)
|
||||
m_sValue = value
|
||||
End Sub
|
||||
|
||||
Protected m_nSelValue As Integer
|
||||
Public Property nSelValue As Integer
|
||||
@@ -103,10 +120,13 @@ Public Class BTLParamM
|
||||
End Property
|
||||
|
||||
Protected m_dDefault As Double
|
||||
Public ReadOnly Property dDefault As Double
|
||||
Public Property dDefault As Double
|
||||
Get
|
||||
Return m_dDefault
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_dDefault = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' tipo della variabile
|
||||
@@ -125,6 +145,16 @@ Public Class BTLParamM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_bCustom As Boolean
|
||||
Public Property bCustom As Boolean
|
||||
Get
|
||||
Return m_bCustom
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_bCustom = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#Region "MESSAGES"
|
||||
|
||||
Public ReadOnly Property Name_Msg As String
|
||||
@@ -56,33 +56,33 @@ Public Class BTLPartM
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public m_dL As Double
|
||||
Public Property dL As Double
|
||||
Public m_dBtlL As Double
|
||||
Public Property dBtlL As Double
|
||||
Get
|
||||
Return m_dL
|
||||
Return m_dBtlL
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_dL = value
|
||||
m_dBtlL = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public m_dW As Double
|
||||
Public Property dW As Double
|
||||
Public m_dBtlW As Double
|
||||
Public Property dBtlW As Double
|
||||
Get
|
||||
Return m_dW
|
||||
Return m_dBtlW
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_dW = value
|
||||
m_dBtlW = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public m_dH As Double
|
||||
Public Property dH As Double
|
||||
Public m_dBtlH As Double
|
||||
Public Property dBtlH As Double
|
||||
Get
|
||||
Return m_dH
|
||||
Return m_dBtlH
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_dH = value
|
||||
m_dBtlH = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
@@ -548,6 +548,7 @@ Public Class BTLPartM
|
||||
|
||||
#End Region ' Parametri pezzo
|
||||
|
||||
' numero di pezzi da fare da BTL
|
||||
Public m_nCNT As Integer
|
||||
Public Property nCNT As Integer
|
||||
Get
|
||||
@@ -558,6 +559,37 @@ Public Class BTLPartM
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' numero di pezzi aggiunti (da fare in piu' rispetto a CNT)
|
||||
Public m_nADDED As Integer
|
||||
Public Property nADDED As Integer
|
||||
Get
|
||||
Return m_nADDED
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_nADDED = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' numero di pezzi inseriti nelle barre (in PROD), quindi numero di duplo del pezzo
|
||||
Public ReadOnly Property nINPROD As Integer
|
||||
Get
|
||||
Dim INPROD As Integer = 0
|
||||
EgtDuploCount(m_nPartId, INPROD)
|
||||
Return INPROD
|
||||
End Get
|
||||
End Property
|
||||
|
||||
' numero di pezzi gia' prodotti
|
||||
Public m_nDONE As Integer
|
||||
Public Property nDONE As Integer
|
||||
Get
|
||||
Return m_nDONE
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_nDONE = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_nINVERTED As Integer
|
||||
Public Property nINVERTED As Integer
|
||||
Get
|
||||
@@ -638,6 +670,16 @@ Public Class BTLPartM
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_nCALC_GlobalERR As Integer
|
||||
Public Property nCALC_GlobalERR As Integer
|
||||
Get
|
||||
Return m_nCALC_GlobalERR
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_nCALC_GlobalERR = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public m_nState As CalcStates = -1
|
||||
Public Property nState As CalcStates
|
||||
Get
|
||||
@@ -675,7 +717,7 @@ Public Class BTLPartM
|
||||
Dim sValArray() As String
|
||||
Dim sValue As String = String.Empty
|
||||
Dim nValue As Integer = 0
|
||||
EgtGetInfo(nPartId, BTL_PRT_PDN, NewBTLPart.nPDN)
|
||||
EgtGetInfo(nPartId, BTL_PRT_PDN, NewBTLPart.m_nPDN)
|
||||
Dim nDO As Integer = 1
|
||||
If EgtGetInfo(nPartId, BTL_PRT_DO, nDO) Then
|
||||
NewBTLPart.m_bDO = (nDO <> 0)
|
||||
@@ -683,10 +725,11 @@ Public Class BTLPartM
|
||||
NewBTLPart.m_bDO = True
|
||||
End If
|
||||
EgtGetInfo(nPartId, BTL_PRT_NAM, NewBTLPart.m_sNAM)
|
||||
EgtGetInfo(nPartId, BTL_PRT_L, NewBTLPart.m_dL)
|
||||
EgtGetInfo(nPartId, BTL_PRT_W, NewBTLPart.m_dW)
|
||||
EgtGetInfo(nPartId, BTL_PRT_H, NewBTLPart.m_dH)
|
||||
EgtGetInfo(nPartId, BTL_PRT_L, NewBTLPart.m_dBtlL)
|
||||
EgtGetInfo(nPartId, BTL_PRT_W, NewBTLPart.m_dBtlW)
|
||||
EgtGetInfo(nPartId, BTL_PRT_H, NewBTLPart.m_dBtlH)
|
||||
EgtGetInfo(nPartId, BTL_PRT_CNT, NewBTLPart.m_nCNT)
|
||||
EgtGetInfo(nPartId, BTL_PRT_ADDED, NewBTLPart.m_nADDED)
|
||||
EgtGetInfo(nPartId, BTL_PRT_ASSEMBLYNUM, NewBTLPart.m_sASSEMBLYNUM)
|
||||
EgtGetInfo(nPartId, BTL_PRT_ORDERNUM, NewBTLPart.m_nORDERNUM)
|
||||
EgtGetInfo(nPartId, BTL_PRT_DESIGNATION, NewBTLPart.m_sDESIGN)
|
||||
@@ -813,8 +856,7 @@ Public Class BTLPartM
|
||||
If Not EgtGetInfo(nPartId, BTL_PRT_INVERTED, NewBTLPart.m_nINVERTED) Then
|
||||
NewBTLPart.m_nINVERTED = 0
|
||||
End If
|
||||
If EgtGetInfo(nPartId, BTL_PRT_MATERIAL, NewBTLPart.m_sMATERIAL) Then
|
||||
End If
|
||||
EgtGetInfo(nPartId, BTL_PRT_MATERIAL, NewBTLPart.m_sMATERIAL)
|
||||
' Leggo outline e features
|
||||
NewBTLPart.m_BTLFeatureMList = LoadFeatures(nPartId, NewBTLPart)
|
||||
' leggo calc error
|
||||
@@ -828,24 +870,27 @@ Public Class BTLPartM
|
||||
EgtGetInfo(nPartId, ITG_PROJ_FALL, nFall)
|
||||
EgtGetInfo(nPartId, ITG_PROJ_MSG, sMsg)
|
||||
If Not bCalc Then
|
||||
NewBTLPart.nState = CalcStates.NOTCALCULATED
|
||||
NewBTLPart.nCALC_ERR = -1
|
||||
NewBTLPart.nCALC_ROT = 0
|
||||
NewBTLPart.nCALC_FALL = 0
|
||||
NewBTLPart.sCALC_MSG = ""
|
||||
NewBTLPart.m_nState = CalcStates.NOTCALCULATED
|
||||
NewBTLPart.m_nCALC_ERR = 0
|
||||
NewBTLPart.m_nCALC_ROT = 0
|
||||
NewBTLPart.m_nCALC_FALL = 0
|
||||
NewBTLPart.m_sCALC_MSG = ""
|
||||
Else
|
||||
NewBTLPart.nCALC_ERR = nErr
|
||||
NewBTLPart.nCALC_ROT = nRot
|
||||
NewBTLPart.nCALC_FALL = nFall
|
||||
NewBTLPart.sCALC_MSG = sMsg
|
||||
NewBTLPart.m_nCALC_ERR = nErr
|
||||
NewBTLPart.m_nCALC_ROT = nRot
|
||||
NewBTLPart.m_nCALC_FALL = nFall
|
||||
NewBTLPart.m_sCALC_MSG = sMsg
|
||||
If nErr = 0 Then
|
||||
NewBTLPart.nState = CalcStates.OK
|
||||
ElseIf nErr > 1 Then
|
||||
ElseIf nErr = 17 Then
|
||||
NewBTLPart.nState = CalcStates.WARNING
|
||||
ElseIf nErr > 0 Then
|
||||
NewBTLPart.nState = CalcStates.ERROR_
|
||||
ElseIf nErr < 1 Then
|
||||
NewBTLPart.nState = CalcStates.NOTCALCULATED
|
||||
ElseIf nErr < 0 Then
|
||||
NewBTLPart.nState = CalcStates.INFO
|
||||
End If
|
||||
End If
|
||||
EgtGetInfo(nPartId, ITG_PROJ_TIME, NewBTLPart.m_nCALC_TIME)
|
||||
Return NewBTLPart
|
||||
End Function
|
||||
|
||||
@@ -869,9 +914,12 @@ Public Class BTLPartM
|
||||
While nFeatureId <> GDB_ID.NULL
|
||||
' verifico che sia una feature
|
||||
Dim nGRP As Integer
|
||||
If EgtGetInfo(nFeatureId, BTL_FTR_GRP, nGRP) Then
|
||||
If EgtGetInfo(nFeatureId, BTL_FTR_GRP, nGRP) AndAlso Not EgtExistsInfo(nFeatureId, BTL_FTR_MAINID) Then
|
||||
' creo la feature
|
||||
TempList.Add(BTLFeatureM.CreateBTLFeature(NewBTLPart, nFeatureId))
|
||||
Dim NewFeature As BTLFeatureM = BTLFeatureM.CreateBTLFeature(NewBTLPart, nFeatureId)
|
||||
TempList.Add(NewFeature)
|
||||
' aggiorno Id feature perchè potrebbe essere stata ricalcolata
|
||||
nFeatureId = NewFeature.nFeatureId
|
||||
End If
|
||||
nFeatureId = EgtGetNext(nFeatureId)
|
||||
End While
|
||||
@@ -1087,6 +1135,83 @@ Public Class BTLPartM
|
||||
Return New List(Of BTLFeatureM)(m_BTLFeatureMList)
|
||||
End Function
|
||||
|
||||
Public Function Rotation(IsPositive As Boolean, SelectedMachineType As MachineType) As Boolean
|
||||
' recupero il box del pezzo
|
||||
Dim nLs As Integer = EgtGetFirstNameInGroup(nPartId, "Box")
|
||||
Dim b3Solid As New BBox3d
|
||||
EgtGetBBoxGlob(nLs, GDB_BB.STANDARD, b3Solid)
|
||||
If b3Solid.IsEmpty() Then
|
||||
EgtOutLog("ERROR: Box non definito per la trave " & sNAM)
|
||||
Return False
|
||||
End If
|
||||
' eseguo rotazione di 90 gradi attorno asse X
|
||||
Dim dRot = If(IsPositive, 90, -90)
|
||||
Dim vtAxes As Vector3d
|
||||
' se travi ruoto attorno all'asse X
|
||||
If SelectedMachineType = MachineType.BEAM Then
|
||||
vtAxes = Vector3d.X_AX
|
||||
' se pareti ruoto attorno all'asse Z
|
||||
ElseIf SelectedMachineType = MachineType.WALL Then
|
||||
vtAxes = -Vector3d.Z_AX
|
||||
End If
|
||||
' se invertito
|
||||
Dim bInverted As Boolean = m_nINVERTED <> 0
|
||||
If bInverted Then
|
||||
' annullo inversione
|
||||
Inversion(SelectedMachineType)
|
||||
End If
|
||||
' eseguo rotazione
|
||||
Dim bOk As Boolean = EgtRotate(nPartId, b3Solid.Center, vtAxes, dRot, GDB_RT.GLOB)
|
||||
If bOk Then
|
||||
Select Case m_nROTATED
|
||||
Case 0
|
||||
m_nROTATED = If(IsPositive, 90, 270)
|
||||
Case 90
|
||||
m_nROTATED = If(IsPositive, 180, 0)
|
||||
Case 180
|
||||
m_nROTATED = If(IsPositive, 270, 90)
|
||||
Case 270
|
||||
m_nROTATED = If(IsPositive, 0, 180)
|
||||
End Select
|
||||
EgtSetInfo(nPartId, BTL_PRT_ROTATED, m_nROTATED)
|
||||
' imposto modificato per copie
|
||||
EgtDuploSetModified(nPartId)
|
||||
End If
|
||||
' se era invertito
|
||||
If bInverted Then
|
||||
' ripristino inversione
|
||||
Inversion(SelectedMachineType)
|
||||
End If
|
||||
EgtDraw()
|
||||
Return bOk
|
||||
End Function
|
||||
|
||||
Public Sub Inversion(SelectedMachineType As MachineType)
|
||||
' recupero il box del pezzo
|
||||
Dim nLs As Integer = EgtGetFirstNameInGroup(nPartId, "Box")
|
||||
Dim b3Solid As New BBox3d
|
||||
EgtGetBBoxGlob(nLs, GDB_BB.STANDARD, b3Solid)
|
||||
If b3Solid.IsEmpty() Then
|
||||
EgtOutLog("ERROR: Box non definito per la trave " & sNAM)
|
||||
Return
|
||||
End If
|
||||
Dim vtAxes As Vector3d
|
||||
' se travi ruoto attorno all'asse Z
|
||||
If SelectedMachineType = MachineType.BEAM Then
|
||||
vtAxes = Vector3d.Z_AX
|
||||
' se pareti ruoto attorno all'asse X
|
||||
ElseIf SelectedMachineType = MachineType.WALL Then
|
||||
vtAxes = Vector3d.X_AX
|
||||
End If
|
||||
' eseguo rotazione di 180 gradi
|
||||
If EgtRotate(nPartId, b3Solid.Center, vtAxes, 180, GDB_RT.GLOB) Then
|
||||
m_nINVERTED = If(m_nINVERTED = 0, 180, 0)
|
||||
EgtSetInfo(nPartId, BTL_PRT_INVERTED, m_nINVERTED)
|
||||
' imposto modificato per copie
|
||||
EgtDuploSetModified(nPartId)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Function NewProcId() As Integer
|
||||
Dim nMaxProcId As Integer = 0
|
||||
If Not IsNothing(BTLFeatureMList) AndAlso BTLFeatureMList.Count > 0 Then
|
||||
+56
-6
@@ -1,4 +1,5 @@
|
||||
Imports EgtUILib
|
||||
Imports System.IO
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class BTLStructureM
|
||||
@@ -66,6 +67,16 @@ Public Class BTLStructureM
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public m_nPROJTYPE As Integer
|
||||
Public Property nPROJTYPE As Integer
|
||||
Get
|
||||
Return m_nPROJTYPE
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_nPROJTYPE = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public m_sLISTNAME As String
|
||||
Public Property sLISTNAME As String
|
||||
Get
|
||||
@@ -356,14 +367,31 @@ Public Class BTLStructureM
|
||||
Return New BTLStructureM
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateBTLStructure() As BTLStructureM
|
||||
Public Shared Function CreateBTLStructure(ProjId As Integer) As BTLStructureM
|
||||
Dim NewBTLStructure As New BTLStructureM
|
||||
Dim sValue As String = String.Empty
|
||||
NewBTLStructure.m_nBTLInfoId = EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO)
|
||||
' se devo filtrare un progetto
|
||||
If ProjId > 0 Then
|
||||
' cerco tra i layer BTLInfo
|
||||
Dim nBTLInfoLayerId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO)
|
||||
While nBTLInfoLayerId <> GDB_ID.NULL
|
||||
' verifico se il layer appartiene al ProjId
|
||||
Dim nBTLInfoLayerProjId As Integer
|
||||
EgtGetInfo(nBTLInfoLayerId, BTL_PRT_PROJ, nBTLInfoLayerProjId)
|
||||
If nBTLInfoLayerProjId = ProjId Then
|
||||
NewBTLStructure.m_nBTLInfoId = nBTLInfoLayerId
|
||||
Exit While
|
||||
End If
|
||||
nBTLInfoLayerId = EgtGetNextName(nBTLInfoLayerId, BTLINFO)
|
||||
End While
|
||||
Else
|
||||
NewBTLStructure.m_nBTLInfoId = EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO)
|
||||
End If
|
||||
EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_PROJNUM, NewBTLStructure.m_sPROJNUM)
|
||||
EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_PROJNAME, NewBTLStructure.m_sPROJNAME)
|
||||
EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_PROJPART, NewBTLStructure.m_sPROJPART)
|
||||
EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_PROJGUID, NewBTLStructure.m_sPROJGUID)
|
||||
EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_PROJTYPE, NewBTLStructure.m_nPROJTYPE)
|
||||
EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_LISTNAME, NewBTLStructure.m_sLISTNAME)
|
||||
EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_CUSTOMER, NewBTLStructure.m_sCUSTOMER)
|
||||
EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_ARCHITECT, NewBTLStructure.m_sARCHITECT)
|
||||
@@ -385,7 +413,7 @@ Public Class BTLStructureM
|
||||
NewBTLStructure.m_SelRECESS = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValue, NewBTLStructure.ocRECESS), NewBTLStructure.ocRECESS)
|
||||
EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_USERATTRIBUTE, NewBTLStructure.m_sUSERATTRIBUTE)
|
||||
' recupero i part
|
||||
NewBTLStructure.m_BTLPartMList = LoadParts()
|
||||
NewBTLStructure.m_BTLPartMList = LoadParts(ProjId)
|
||||
'Dim nPartId As Integer = EgtGetFirstPart()
|
||||
'While nPartId <> GDB_ID.NULL
|
||||
' NewBTLStructure.m_BTLPartMList.Add(BTLPartM.CreateBTLPart(nPartId))
|
||||
@@ -394,11 +422,22 @@ Public Class BTLStructureM
|
||||
Return NewBTLStructure
|
||||
End Function
|
||||
|
||||
Private Shared Function LoadParts() As List(Of BTLPartM)
|
||||
Private Shared Function LoadParts(ProjId As Integer) As List(Of BTLPartM)
|
||||
Dim TempList As New List(Of BTLPartM)
|
||||
Dim nPartId As Integer = EgtGetFirstPart()
|
||||
While nPartId <> GDB_ID.NULL
|
||||
TempList.Add(BTLPartM.CreateBTLPart(nPartId))
|
||||
' se devo filtrare un progetto
|
||||
If ProjId > 0 Then
|
||||
' verifico se il pezzo appartiene al ProjId
|
||||
Dim nPartProjId As Integer
|
||||
EgtGetInfo(nPartId, BTL_PRT_PROJ, nPartProjId)
|
||||
If nPartProjId = ProjId Then
|
||||
TempList.Add(BTLPartM.CreateBTLPart(nPartId))
|
||||
End If
|
||||
Else
|
||||
' altrimenti carico tutti
|
||||
TempList.Add(BTLPartM.CreateBTLPart(nPartId))
|
||||
End If
|
||||
nPartId = EgtGetNextPart(nPartId)
|
||||
End While
|
||||
Return TempList
|
||||
@@ -418,6 +457,13 @@ Public Class BTLStructureM
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Sub RemoveBTLPart(BTLPartM As BTLPartM)
|
||||
If IsNothing(BTLPartM) Then Return
|
||||
If Not m_BTLPartMList.Contains(BTLPartM) Then Return
|
||||
m_BTLPartMList.Remove(BTLPartM)
|
||||
'RaiseEvent BTLPartAdded(Me, New BTLPartAddedEventArgs(BTLPartM))
|
||||
End Sub
|
||||
|
||||
Public Function GetBTLParts() As List(Of BTLPartM)
|
||||
Return New List(Of BTLPartM)(m_BTLPartMList)
|
||||
End Function
|
||||
@@ -430,6 +476,10 @@ Public Class BTLStructureM
|
||||
Return nMaxPDN + 1
|
||||
End Function
|
||||
|
||||
Public Sub UpdateBTLInfoLayer()
|
||||
m_nBTLInfoId = EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO)
|
||||
End Sub
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,259 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.Collections.Specialized
|
||||
Imports System.ComponentModel
|
||||
Imports System.Windows
|
||||
Imports System.Windows.Media
|
||||
Imports EgtBEAMWALL.Core
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class BTLFeatureVM
|
||||
Inherits VMBase
|
||||
|
||||
Protected WithEvents m_BTLFeatureM As BTLFeatureM
|
||||
Public ReadOnly Property BTLFeatureM As BTLFeatureM
|
||||
Get
|
||||
Return m_BTLFeatureM
|
||||
End Get
|
||||
End Property
|
||||
Protected m_BTLPartM As BTLPartM
|
||||
|
||||
Public ReadOnly Property nFeatureId As Integer
|
||||
Get
|
||||
Return m_BTLFeatureM.nFeatureId
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Overridable Property nSelGRP As Integer
|
||||
Get
|
||||
Return m_BTLFeatureM.nSelGRP
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_BTLFeatureM.nSelGRP = value
|
||||
End Set
|
||||
End Property
|
||||
Public ReadOnly Property sDescGRP As String
|
||||
Get
|
||||
Dim sDescConstruction As String = String.Empty
|
||||
If CalcBeamPrivateProfileGRP(m_BTLFeatureM.nSelGRP) = 0 Then
|
||||
sDescConstruction = "L"
|
||||
Else
|
||||
sDescConstruction = "T"
|
||||
End If
|
||||
sDescConstruction &= m_BTLFeatureM.nPRC.ToString("000")
|
||||
Return sDescConstruction
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Property nPRC As Integer
|
||||
Get
|
||||
Return m_BTLFeatureM.nPRC
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_BTLFeatureM.nPRC = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' Lato
|
||||
Public Overridable Property nSelSIDE As Integer
|
||||
Get
|
||||
Return m_BTLFeatureM.nSelSIDE
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_BTLFeatureM.nSelSIDE = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sName As String
|
||||
Get
|
||||
Return m_BTLFeatureM.sName
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Overridable Property bDO As Boolean
|
||||
Get
|
||||
Return m_BTLFeatureM.bDO
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_BTLFeatureM.bDO = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property nPRID As Integer
|
||||
Get
|
||||
Return m_BTLFeatureM.nPRID
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_BTLFeatureM.nPRID = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property sDES As String
|
||||
Get
|
||||
Return m_BTLFeatureM.sDES
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_BTLFeatureM.sDES = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property frFRAME As Frame3d
|
||||
Get
|
||||
Return m_BTLFeatureM.frFRAME
|
||||
End Get
|
||||
Set(value As Frame3d)
|
||||
m_BTLFeatureM.frFRAME = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' proprieta' che mostra la descrizione in interfaccia
|
||||
Public ReadOnly Property sDesc As String
|
||||
Get
|
||||
Return sDescGRP & " " & sName
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property nState As CalcStates
|
||||
Get
|
||||
Return m_BTLFeatureM.nState
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property nCALC_ERR As Integer
|
||||
Get
|
||||
Return m_BTLFeatureM.nCALC_ERR
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property nCALC_ROT As Integer
|
||||
Get
|
||||
Return m_BTLFeatureM.nCALC_ROT
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sCALC_MSG As String
|
||||
Get
|
||||
Return m_BTLFeatureM.sCALC_MSG
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Calc_Background As SolidColorBrush
|
||||
Get
|
||||
If Not m_BTLFeatureM.bDO Then
|
||||
Return Brushes.Aqua
|
||||
ElseIf m_BTLFeatureM.nState = CalcStates.OK Then
|
||||
Return Brushes.Green
|
||||
ElseIf m_BTLFeatureM.nState = CalcStates.NOTCALCULATED Then
|
||||
Return Brushes.LightGray
|
||||
ElseIf m_BTLFeatureM.nState = CalcStates.INFO Then
|
||||
Return Brushes.Green
|
||||
ElseIf m_BTLFeatureM.nState = CalcStates.WARNING Then
|
||||
Return Brushes.Orange
|
||||
ElseIf m_BTLFeatureM.nState = CalcStates.ERROR_ Then
|
||||
Return Brushes.Red
|
||||
Else
|
||||
Return Brushes.Red
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property CALC_ROT_Visibility As Visibility
|
||||
Get
|
||||
Return If(m_BTLFeatureM.nCALC_ROT <> 0, Visibility.Visible, Visibility.Collapsed)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property CALC_ERR_Letter As String
|
||||
Get
|
||||
Select Case m_BTLFeatureM.nCALC_ERR
|
||||
Case 22
|
||||
Return "c"
|
||||
Case 19, 23, 24, 25
|
||||
Return "e"
|
||||
Case 17
|
||||
Return "w"
|
||||
Case < 0
|
||||
Return "i"
|
||||
Case Else
|
||||
Return ""
|
||||
End Select
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property CALC_ERR_Foreground As SolidColorBrush
|
||||
Get
|
||||
Select Case m_BTLFeatureM.nState
|
||||
Case CalcStates.ERROR_
|
||||
Return Brushes.Red
|
||||
Case CalcStates.WARNING
|
||||
Return Brushes.Orange
|
||||
Case CalcStates.INFO
|
||||
Return Brushes.Green
|
||||
Case Else
|
||||
Return Brushes.Red
|
||||
End Select
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
'Sub New(BTLFeatureM As BTLFeatureM, BTLPartM As BTLPartM)
|
||||
' m_BTLFeatureM = BTLFeatureM
|
||||
' AddHandler m_BTLFeatureM.PBTLParamAdded, AddressOf OnPBTLParamAdded
|
||||
' AddHandler m_BTLFeatureM.QBTLParamAdded, AddressOf OnQBTLParamAdded
|
||||
' m_BTLPartM = BTLPartM
|
||||
' CreatePBTLParamVMList()
|
||||
' CreateQBTLParamVMList()
|
||||
' NotifyPropertyChanged(NameOf(Calc_Background))
|
||||
' NotifyPropertyChanged(NameOf(CALC_ROT_Visibility))
|
||||
' NotifyPropertyChanged(NameOf(CALC_ERR_Letter))
|
||||
' NotifyPropertyChanged(NameOf(CALC_ERR_Foreground))
|
||||
'End Sub
|
||||
|
||||
Sub New()
|
||||
End Sub
|
||||
|
||||
Sub New(BTLFeatureM As BTLFeatureM)
|
||||
m_BTLFeatureM = BTLFeatureM
|
||||
m_BTLPartM = Nothing
|
||||
NotifyPropertyChanged(NameOf(Calc_Background))
|
||||
NotifyPropertyChanged(NameOf(CALC_ROT_Visibility))
|
||||
NotifyPropertyChanged(NameOf(CALC_ERR_Letter))
|
||||
NotifyPropertyChanged(NameOf(CALC_ERR_Foreground))
|
||||
End Sub
|
||||
|
||||
#End Region ' CONSTRUCTOR
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
' funzione che seleziona la feature nella geometria
|
||||
Public Sub SelGeomFeature()
|
||||
EgtDeselectAll()
|
||||
SelGeomFeature(nFeatureId)
|
||||
End Sub
|
||||
Private Sub SelGeomFeature(nMyFeatureId As Integer)
|
||||
EgtSelectObj(nMyFeatureId)
|
||||
Dim sVal As String = ""
|
||||
If EgtGetInfo(nMyFeatureId, BTL_FTR_ADJID, sVal) Then
|
||||
Dim vAdjId() As String = sVal.Split(","c)
|
||||
For Each sAdjId In vAdjId
|
||||
Dim nAdjId As Integer
|
||||
If Integer.TryParse(sAdjId, nAdjId) Then
|
||||
SelGeomFeature(nMyFeatureId + nAdjId)
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
If EgtGetInfo(nMyFeatureId, BTL_FTR_AUXID, sVal) Then
|
||||
Dim vAuxId() As String = sVal.Split(","c)
|
||||
For Each sAuxId In vAuxId
|
||||
Dim nAuxId As Integer
|
||||
If Integer.TryParse(sAuxId, nAuxId) Then
|
||||
EgtSelectObj(nMyFeatureId + nAuxId)
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
End Class
|
||||
@@ -1,39 +0,0 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.IO
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class Beam
|
||||
Inherits Part
|
||||
|
||||
Protected m_dOffset As Double
|
||||
Public ReadOnly Property dOffset As Double
|
||||
Get
|
||||
Return m_dOffset
|
||||
End Get
|
||||
End Property
|
||||
|
||||
' Id del grezzo
|
||||
Protected m_nRawPartId As Integer = GDB_ID.NULL
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Sub New(nParentMachGroup As Core.MyMachGroup, nPartId As Integer, nRawPartId As Integer)
|
||||
MyBase.New(nParentMachGroup, nPartId)
|
||||
m_nRawPartId = nRawPartId
|
||||
End Sub
|
||||
|
||||
#End Region ' CONSTRUCTOR
|
||||
|
||||
Friend Sub UpdateOffset()
|
||||
' calcolo offset
|
||||
Dim nBeamIndex As Integer = ParentMachGroup.PartList.IndexOf(Me)
|
||||
If nBeamIndex > 0 Then
|
||||
m_dOffset = dPOSX - (ParentMachGroup.PartList(nBeamIndex - 1).dPOSX + ParentMachGroup.PartList(nBeamIndex - 1).dL)
|
||||
Else
|
||||
Dim BeamMachGroup As BeamMachGroup = DirectCast(ParentMachGroup, BeamMachGroup)
|
||||
m_dOffset = BeamMachGroup.dStartCut
|
||||
End If
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,205 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.IO
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class BeamM
|
||||
Inherits PartM
|
||||
|
||||
Protected m_dOffset As Double
|
||||
Public Property dOffset As Double
|
||||
Get
|
||||
Return m_dOffset
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_dOffset = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' Id del grezzo
|
||||
Protected m_nRawPartId As Integer = GDB_ID.NULL
|
||||
|
||||
'#Region "CONSTRUCTOR"
|
||||
|
||||
' Sub New(nParentMachGroup As MyMachGroupM, nPartId As Integer, nRawPartId As Integer)
|
||||
' MyBase.New(nParentMachGroup, nPartId)
|
||||
' m_nRawPartId = nRawPartId
|
||||
' End Sub
|
||||
|
||||
'#End Region ' CONSTRUCTOR
|
||||
|
||||
#Region "CONSTRUCTORS"
|
||||
|
||||
Protected Sub New(nParentMachGroup As MyMachGroupM, nPartId As Integer)
|
||||
MyBase.New(nParentMachGroup, nPartId)
|
||||
End Sub
|
||||
|
||||
'Public Shared Function CreateNewBeam() As BeamM
|
||||
' Return New BeamM
|
||||
'End Function
|
||||
|
||||
Public Shared Function CreateBeam(nParentMachGroup As MyMachGroupM, nPartId As Integer, nRawPartId As Integer) As BeamM
|
||||
Dim NewBeamM As New BeamM(nParentMachGroup, nPartId)
|
||||
NewBeamM.m_nRawPartId = nRawPartId
|
||||
' leggo info pezzo
|
||||
EgtGetInfo(nPartId, BTL_PRT_PROJ, NewBeamM.m_nProjId)
|
||||
EgtGetInfo(nPartId, BTL_PRT_PDN, NewBeamM.m_nPDN)
|
||||
EgtGetInfo(nPartId, BTL_PRT_NAM, NewBeamM.m_sNAM)
|
||||
EgtGetInfo(nPartId, BTL_PRT_L, NewBeamM.m_dBtlL)
|
||||
EgtGetInfo(nPartId, BTL_PRT_W, NewBeamM.m_dBtlW)
|
||||
EgtGetInfo(nPartId, BTL_PRT_H, NewBeamM.m_dBtlH)
|
||||
EgtGetInfo(nPartId, BTL_PRT_CNT, NewBeamM.m_nCNT)
|
||||
EgtGetInfo(nPartId, BTL_PRT_GROUP, NewBeamM.m_sGROUP)
|
||||
EgtGetInfo(nPartId, BTL_PRT_MATERIAL, NewBeamM.m_sMATERIAL)
|
||||
Dim nTemp As Integer = 0
|
||||
If Not EgtGetInfo(nPartId, BTL_PRT_ROTATED, nTemp) Then
|
||||
nTemp = 0
|
||||
End If
|
||||
NewBeamM.SetRotated(nTemp)
|
||||
If Not EgtGetInfo(nPartId, BTL_PRT_INVERTED, nTemp) Then
|
||||
nTemp = 0
|
||||
End If
|
||||
NewBeamM.SetInverted(nTemp)
|
||||
' leggo PosX
|
||||
Dim sInfo As String = ""
|
||||
Dim Index = 1
|
||||
Dim sSplitInfo() As String = Nothing
|
||||
Dim bFound As Boolean = False
|
||||
While EgtGetInfo(NewBeamM.m_ParentMachGroup.Id, MGR_RPT_PART & Index, sInfo)
|
||||
If Not String.IsNullOrWhiteSpace(sInfo) Then
|
||||
sSplitInfo = sInfo.Split(","c)
|
||||
If sSplitInfo(0) = nPartId Then
|
||||
bFound = True
|
||||
Exit While
|
||||
End If
|
||||
End If
|
||||
Index += 1
|
||||
End While
|
||||
If bFound Then
|
||||
StringToDouble(sSplitInfo(1), NewBeamM.m_dPOSX)
|
||||
End If
|
||||
' leggo feature
|
||||
NewBeamM.m_FeatureMList = LoadBTLFeatures(nPartId)
|
||||
' leggo calc error
|
||||
Dim nErr As Integer = 0
|
||||
Dim nRot As Integer = 0
|
||||
Dim nFall As Integer = 0
|
||||
Dim sMsg As String = ""
|
||||
Dim bCalc As Boolean = False
|
||||
bCalc = EgtGetInfo(nPartId, ITG_PROD_ERR, nErr)
|
||||
EgtGetInfo(nPartId, ITG_PROD_ROT, nRot)
|
||||
EgtGetInfo(nPartId, ITG_PROD_FALL, nFall)
|
||||
EgtGetInfo(nPartId, ITG_PROD_MSG, sMsg)
|
||||
If Not bCalc Then
|
||||
NewBeamM.m_nCALC_State = CalcStates.NOTCALCULATED
|
||||
NewBeamM.m_nCALC_ERR = -1
|
||||
NewBeamM.m_nCALC_ROT = 0
|
||||
NewBeamM.m_nCALC_FALL = 0
|
||||
NewBeamM.m_sCALC_MSG = ""
|
||||
Else
|
||||
NewBeamM.m_nCALC_ERR = nErr
|
||||
NewBeamM.m_nCALC_ROT = nRot
|
||||
NewBeamM.m_nCALC_FALL = nFall
|
||||
NewBeamM.m_sCALC_MSG = sMsg
|
||||
If nErr = 0 Then
|
||||
NewBeamM.m_nCALC_State = CalcStates.OK
|
||||
ElseIf nErr > 1 Then
|
||||
NewBeamM.m_nCALC_State = CalcStates.ERROR_
|
||||
ElseIf nErr < 1 Then
|
||||
NewBeamM.m_nCALC_State = CalcStates.NOTCALCULATED
|
||||
End If
|
||||
End If
|
||||
EgtGetInfo(nPartId, ITG_PROD_TIME, NewBeamM.m_nCALC_TIME)
|
||||
ReadMachGroupData(NewBeamM)
|
||||
Return NewBeamM
|
||||
End Function
|
||||
|
||||
#End Region ' CONSTRUCTORS
|
||||
|
||||
#Region "X DataLayer"
|
||||
|
||||
Public Shared Function CreateBeamDL(nParentMachGroup As MyMachGroupM, nPartId As Integer, nRawPartId As Integer) As BeamM
|
||||
Dim NewBeamM As New BeamM(nParentMachGroup, nPartId)
|
||||
NewBeamM.m_nRawPartId = nRawPartId
|
||||
'' leggo info pezzo
|
||||
'EgtGetInfo(nPartId, BTL_PRT_PROJ, NewBeamM.nProjId)
|
||||
'EgtGetInfo(nPartId, BTL_PRT_PDN, NewBeamM.nPDN)
|
||||
'EgtGetInfo(nPartId, BTL_PRT_NAM, NewBeamM.sNAM)
|
||||
'EgtGetInfo(nPartId, BTL_PRT_L, NewBeamM.dL)
|
||||
'EgtGetInfo(nPartId, BTL_PRT_W, NewBeamM.dW)
|
||||
'EgtGetInfo(nPartId, BTL_PRT_H, NewBeamM.dH)
|
||||
'EgtGetInfo(nPartId, BTL_PRT_CNT, NewBeamM.nCNT)
|
||||
'Dim nTemp As Integer = 0
|
||||
'If Not EgtGetInfo(nPartId, BTL_PRT_ROTATED, nTemp) Then
|
||||
' nTemp = 0
|
||||
'End If
|
||||
'NewBeamM.SetRotated(nTemp)
|
||||
'If Not EgtGetInfo(nPartId, BTL_PRT_INVERTED, nTemp) Then
|
||||
' nTemp = 0
|
||||
'End If
|
||||
'NewBeamM.SetInverted(nTemp)
|
||||
'' leggo PosX
|
||||
'Dim sInfo As String = ""
|
||||
'Dim Index = 1
|
||||
'Dim sSplitInfo() As String
|
||||
'Dim bFound As Boolean = False
|
||||
'While EgtGetInfo(NewBeamM.m_ParentMachGroup.Id, MGR_RPT_PART & Index, sInfo)
|
||||
' If Not String.IsNullOrWhiteSpace(sInfo) Then
|
||||
' sSplitInfo = sInfo.Split(","c)
|
||||
' If sSplitInfo(0) = nPartId Then
|
||||
' bFound = True
|
||||
' Exit While
|
||||
' End If
|
||||
' End If
|
||||
' Index += 1
|
||||
'End While
|
||||
'If bFound Then
|
||||
' StringToDouble(sSplitInfo(1), NewBeamM.dPOSX)
|
||||
'End If
|
||||
'' leggo feature
|
||||
'NewBeamM.m_FeatureMList = LoadBTLFeatures(nPartId)
|
||||
Return NewBeamM
|
||||
End Function
|
||||
|
||||
#End Region
|
||||
|
||||
Private Shared Function LoadBTLFeatures(nPartId As Integer) As List(Of BTLFeatureM)
|
||||
Dim TempList As New List(Of BTLFeatureM)
|
||||
' Aggiungo outline
|
||||
Dim nOutLayerId As Integer = EgtGetFirstNameInGroup(nPartId, OUTLINE)
|
||||
Dim nOutlineId As Integer = EgtGetFirstInGroup(nOutLayerId)
|
||||
While nOutlineId <> GDB_ID.NULL
|
||||
' verifico che sia una feature
|
||||
Dim nGRP As Integer
|
||||
If EgtGetInfo(nOutlineId, BTL_FTR_GRP, nGRP) AndAlso Not EgtExistsInfo(nOutlineId, BTL_FTR_MAINID) Then
|
||||
' creo la feature
|
||||
TempList.Add(BTLFeatureM.CreateBTLFeature(Nothing, nOutlineId))
|
||||
End If
|
||||
nOutlineId = EgtGetNext(nOutlineId)
|
||||
End While
|
||||
' Aggiungo feature
|
||||
Dim nProcessingId As Integer = EgtGetFirstNameInGroup(nPartId, PROCESSINGS)
|
||||
Dim nFeatureId As Integer = EgtGetFirstInGroup(nProcessingId)
|
||||
While nFeatureId <> GDB_ID.NULL
|
||||
' verifico che sia una feature
|
||||
Dim nGRP As Integer
|
||||
If EgtGetInfo(nFeatureId, BTL_FTR_GRP, nGRP) AndAlso Not EgtExistsInfo(nFeatureId, BTL_FTR_MAINID) Then
|
||||
' creo la feature
|
||||
TempList.Add(BTLFeatureM.CreateBTLFeature(Nothing, nFeatureId))
|
||||
End If
|
||||
nFeatureId = EgtGetNext(nFeatureId)
|
||||
End While
|
||||
Return TempList
|
||||
End Function
|
||||
|
||||
Public Sub UpdateOffset()
|
||||
' calcolo offset
|
||||
Dim nBeamIndex As Integer = ParentMachGroup.PartMList.IndexOf(Me)
|
||||
If nBeamIndex > 0 Then
|
||||
m_dOffset = dPOSX - (ParentMachGroup.PartMList(nBeamIndex - 1).dPOSX + ParentMachGroup.PartMList(nBeamIndex - 1).dL)
|
||||
Else
|
||||
m_dOffset = dPOSX
|
||||
End If
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -1,60 +0,0 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.IO
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class BeamMachGroup
|
||||
Inherits MyMachGroup
|
||||
|
||||
Protected m_dStartCut As Double
|
||||
Public ReadOnly Property dStartCut As Double
|
||||
Get
|
||||
Return m_dStartCut
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Sub New(nId As Integer, sName As String, sMachine As String)
|
||||
MyBase.New(nId, sName, sMachine)
|
||||
SetMachineType(MachineType.BEAM)
|
||||
EgtGetInfo(nId, MGR_RPT_BARLEN, dL)
|
||||
EgtGetInfo(nId, MGR_RPT_BARHEIGHT, dH)
|
||||
EgtGetInfo(nId, MGR_RPT_BARWIDTH, dW)
|
||||
m_dTotMat = dL
|
||||
For Each Part In PartList
|
||||
m_dMatForPart += Part.dL
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Public Overrides Sub RefreshPartList()
|
||||
' leggo StartCut da posizione primo pezzo
|
||||
Dim sInfo As String = ""
|
||||
Dim sSplitInfo() As String
|
||||
Dim bFound As Boolean = False
|
||||
EgtGetInfo(Id, MGR_RPT_PART & 1, sInfo)
|
||||
If Not String.IsNullOrWhiteSpace(sInfo) Then
|
||||
sSplitInfo = sInfo.Split(","c)
|
||||
StringToDouble(sSplitInfo(1), m_dStartCut)
|
||||
Else
|
||||
m_dStartCut = 0
|
||||
End If
|
||||
' aggiorno lista pezzi
|
||||
PartList.Clear()
|
||||
Dim nRawPartId As Integer = EgtGetFirstRawPart()
|
||||
While nRawPartId <> GDB_ID.NULL
|
||||
Dim nPartId As Integer = EgtGetFirstPartInRawPart(nRawPartId)
|
||||
If nPartId <> GDB_ID.NULL Then
|
||||
Dim NewBeam As Beam = New Beam(Me, nPartId, nRawPartId)
|
||||
PartList.Add(NewBeam)
|
||||
NewBeam.UpdateOffset()
|
||||
End If
|
||||
nRawPartId = EgtGetNextRawPart(nRawPartId)
|
||||
End While
|
||||
End Sub
|
||||
|
||||
Public Overrides Sub RefreshGroupData()
|
||||
EgtGetInfo(Id, MGR_RPT_BARLEN, dL)
|
||||
EgtGetInfo(Id, MGR_RPT_BARHEIGHT, dH)
|
||||
EgtGetInfo(Id, MGR_RPT_BARWIDTH, dW)
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -24,6 +24,7 @@
|
||||
NULL = 0
|
||||
BEAM = 1
|
||||
WALL = 2
|
||||
BOTH = 3
|
||||
End Enum
|
||||
|
||||
Enum CalcStates As Integer
|
||||
@@ -111,11 +112,18 @@
|
||||
PROD = 2
|
||||
End Enum
|
||||
|
||||
' Tipo di progetto (Beam o Wall)
|
||||
Public Enum BWType As Integer
|
||||
BEAM = 1
|
||||
WALL = 2
|
||||
End Enum
|
||||
|
||||
Friend Const PROJ As String = "PROJ"
|
||||
Friend Const FILENAMESEPARATOR As Char = "^"c
|
||||
Friend Const BTLINFO As String = "BtlInfo"
|
||||
|
||||
' info parametri BTL
|
||||
Friend Const BTL_PRT_PROJ As String = "PROJ"
|
||||
Friend Const BTL_PRT_PDN As String = "PDN"
|
||||
Friend Const BTL_PRT_DO As String = "DO"
|
||||
Friend Const BTL_PRT_NAM As String = "NAM"
|
||||
@@ -123,6 +131,8 @@
|
||||
Friend Const BTL_PRT_W As String = "W"
|
||||
Friend Const BTL_PRT_H As String = "H"
|
||||
Friend Const BTL_PRT_CNT As String = "CNT"
|
||||
Friend Const BTL_PRT_ADDED As String = "ADDED"
|
||||
Friend Const BTL_PRT_DONE As String = "DONE"
|
||||
Friend Const BTL_PRT_ROTATED As String = "ROTATED"
|
||||
Friend Const BTL_PRT_INVERTED As String = "INVERTED"
|
||||
Friend Const BTL_PRT_MATERIAL As String = "MATERIAL"
|
||||
@@ -163,6 +173,7 @@
|
||||
Friend Const BTL_GEN_PROJNAME = "PROJECTNAME"
|
||||
Friend Const BTL_GEN_PROJPART = "PROJECTPART"
|
||||
Friend Const BTL_GEN_PROJGUID = "PROJECTGUID"
|
||||
Friend Const BTL_GEN_PROJTYPE = "PROJECTTYPE"
|
||||
Friend Const BTL_GEN_LISTNAME = "LISTNAME"
|
||||
Friend Const BTL_GEN_CUSTOMER = "CUSTOMER"
|
||||
Friend Const BTL_GEN_ARCHITECT = "ARCHITECT"
|
||||
@@ -189,6 +200,9 @@
|
||||
Friend Const BTL_FTR_DES As String = "DES"
|
||||
Friend Const BTL_FTR_PRID As String = "PRID"
|
||||
Friend Const BTL_FTR_FRAME As String = "FRAME"
|
||||
Friend Const BTL_FTR_MAINID As String = "MAINID"
|
||||
Friend Const BTL_FTR_ADJID As String = "ADJID"
|
||||
Friend Const BTL_FTR_AUXID As String = "AUXID"
|
||||
|
||||
' parametri machgroup grezzi
|
||||
Friend Const MGR_RPT_ID As String = "ID"
|
||||
@@ -207,6 +221,10 @@
|
||||
Friend Const MGR_PRT_DES As String = "DES"
|
||||
Friend Const MGR_PRT_STARTCUT As String = "STARTCUT"
|
||||
Friend Const MGR_PRT_MATERIAL As String = "MATERIAL"
|
||||
Friend Const MGR_PRT_ROT As String = "ROT"
|
||||
Friend Const MGR_PRT_FLIP As String = "FLIP"
|
||||
Friend Const MGR_PRT_POSX As String = "POSX"
|
||||
Friend Const MGR_PRT_POSY As String = "POSY"
|
||||
|
||||
Friend Const MGR_FTR_GRP As String = "GRP"
|
||||
Friend Const MGR_FTR_PRC As String = "PRC"
|
||||
@@ -239,6 +257,7 @@
|
||||
Friend Const ITG_PROD_ERR As String = "PROD_ERR"
|
||||
Friend Const ITG_PROD_MSG As String = "PROD_MSG"
|
||||
Friend Const ITG_PROD_ROT As String = "PROD_ROT"
|
||||
Friend Const ITG_PROD_FALL As String = "PROD_FALL"
|
||||
Friend Const ITG_PROD_TIME As String = "PROD_TIME"
|
||||
|
||||
' parametri errori integration
|
||||
@@ -254,4 +273,9 @@
|
||||
Friend Const WRH_KERF As String = "Kerf"
|
||||
Friend Const WRH_S As String = "S"
|
||||
|
||||
' parametri import/export
|
||||
Public Const EXP_PROJ As String = "EXPORTPROJ"
|
||||
Public Const EXP_PROD As String = "EXPORTPROD"
|
||||
Public Const BTLFILENAME As String = "BTLFILENAME"
|
||||
|
||||
End Module
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
Public Module ConstColumns
|
||||
|
||||
' RawPartList
|
||||
Public Const COL_NAME As String = "colNAME"
|
||||
Public Const COL_CALC As String = "colCALC"
|
||||
Public Const COL_STARTCUT As String = "colSTARTCUT"
|
||||
Public Const COL_W As String = "colW"
|
||||
Public Const COL_H As String = "colH"
|
||||
Public Const COL_L As String = "colL"
|
||||
Public Const COL_MATERIAL As String = "colMATERIAL"
|
||||
Public Const COL_USAGE As String = "colUSAGE"
|
||||
Public Const COL_WASTE As String = "colWASTE"
|
||||
|
||||
' PartInRawPartList
|
||||
Public Const COL_PDN As String = "colPDN"
|
||||
Public Const COL_NAM As String = "colNAM"
|
||||
Public Const COL_ROT As String = "colROT"
|
||||
Public Const COL_FLIP As String = "colFLIP"
|
||||
Public Const COL_POSX As String = "colPOSX"
|
||||
Public Const COL_POSY As String = "colPOSY"
|
||||
Public Const COL_OFFSET As String = "colOFFSET"
|
||||
|
||||
End Module
|
||||
@@ -0,0 +1,13 @@
|
||||
Public Module ConstDataGridColumnsIni
|
||||
|
||||
Public Const DATAGRIDCOLUMNS_FILE_NAME As String = "DataGridColumns.ini"
|
||||
|
||||
Public Const S_FEATURELIST As String = "DG_FeatureList"
|
||||
Public Const S_OPENPROJFILEDLG_PROJ As String = "DG_OpenProjectFileDialog_PROJ"
|
||||
Public Const S_OPENPROJFILEDLG_PROD As String = "DG_OpenProjectFileDialog_PROD"
|
||||
Public Const S_RAWPARTLIST_BEAM As String = "DG_RawPartList_BEAM"
|
||||
Public Const S_RAWPARTLIST_WALL As String = "DG_RawPartList_WALL"
|
||||
Public Const S_PARTINRAWPARTLIST_BEAM As String = "DG_PartInRawPartList_BEAM"
|
||||
Public Const S_PARTINRAWPARTLIST_WALL As String = "DG_PartInRawPartList_WALL"
|
||||
|
||||
End Module
|
||||
@@ -0,0 +1,56 @@
|
||||
Public Module ConstMachComm
|
||||
|
||||
Public Enum ResultTypes As Integer
|
||||
NULL = 0
|
||||
EXECUTED = 1
|
||||
RESULT = 2
|
||||
End Enum
|
||||
|
||||
Public Enum CommandTypes As Integer
|
||||
ERROR_ = 1
|
||||
CONNECT = 2
|
||||
DISCONNECT = 3
|
||||
START = 4
|
||||
SOFTSTART = 5
|
||||
STOP_ = 6
|
||||
RESET = 7
|
||||
STEP_ = 8
|
||||
SETPOINT = 9
|
||||
SENDPROG = 10
|
||||
REMOVEPROG = 11
|
||||
REMOVEALLPROG = 12
|
||||
READ = 13
|
||||
WRITE = 14
|
||||
DELETEALARMS = 15
|
||||
SETOP = 16
|
||||
End Enum
|
||||
|
||||
Public Enum LogCommandTypes As Integer
|
||||
NULL = 0
|
||||
ERROR_ = 1
|
||||
CONNECT = 2
|
||||
DISCONNECT = 3
|
||||
START = 4
|
||||
SOFTSTART = 5
|
||||
STOP_ = 6
|
||||
RESET = 7
|
||||
STEP_ = 8
|
||||
SETPOINT = 9
|
||||
SENDPROG = 10
|
||||
REMOVEPROG = 11
|
||||
REMOVEALLPROG = 12
|
||||
READ = 13
|
||||
WRITE = 14
|
||||
DELETEALARMS = 15
|
||||
SETOP = 16
|
||||
ALARM = 17
|
||||
NEWOP = 18
|
||||
End Enum
|
||||
|
||||
Public Enum CommandStates As Integer
|
||||
NULL = 0
|
||||
ERROR_ = 1
|
||||
OK = 2
|
||||
End Enum
|
||||
|
||||
End Module
|
||||
@@ -0,0 +1,18 @@
|
||||
Public Class PartAddedEventArgs
|
||||
Inherits EventArgs
|
||||
|
||||
Public m_NewPart As PartM
|
||||
Public Property NewPart As PartM
|
||||
Get
|
||||
Return m_NewPart
|
||||
End Get
|
||||
Private Set(value As PartM)
|
||||
m_NewPart = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Sub New(NewBTLFeature As PartM)
|
||||
Me.NewPart = NewBTLFeature
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -10,8 +10,9 @@
|
||||
<AssemblyName>EgtBEAMWALL.Core</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<MyType>Windows</MyType>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -21,6 +22,7 @@
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DocumentationFile>EgtBEAMWALL.Core.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -30,6 +32,7 @@
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DocumentationFile>EgtBEAMWALL.Core.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionExplicit>On</OptionExplicit>
|
||||
@@ -44,16 +47,20 @@
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="EgtUILib">
|
||||
<HintPath>..\dll\EgtUILib.dll</HintPath>
|
||||
<Reference Include="EgtUILib, Version=2.3.4.3, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\EgtProg\Dll32\EgtUILib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EgtWPFLib5">
|
||||
<HintPath>..\dll\EgtWPFLib5.dll</HintPath>
|
||||
<Reference Include="EgtWPFLib5, Version=2.3.4.3, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\EgtProg\Dll32\EgtWPFLib5.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xaml" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
@@ -71,21 +78,42 @@
|
||||
<Import Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Beam.vb" />
|
||||
<Compile Include="BeamMachGroup.vb" />
|
||||
<Compile Include="Model\BTLParamAddedEventArgs.vb" />
|
||||
<Compile Include="Model\BTLFeatureM.vb" />
|
||||
<Compile Include="Model\BTLParamM.vb" />
|
||||
<Compile Include="Model\BTLFeatureAddedEventArgs.vb" />
|
||||
<Compile Include="Model\BTLPartAddedEventArgs.vb" />
|
||||
<Compile Include="Model\BTLPartM.vb" />
|
||||
<Compile Include="Model\BTLStructureM.vb" />
|
||||
<Compile Include="BeamM.vb" />
|
||||
<Compile Include="BTL ViewModel\BTLFeatureVM.vb" />
|
||||
<Compile Include="Constants\ConstColumns.vb" />
|
||||
<Compile Include="Constants\ConstDataGridColumnsIni.vb" />
|
||||
<Compile Include="Constants\ConstMachComm.vb" />
|
||||
<Compile Include="EgtDataGrid\EgtDataGrid.xaml.vb">
|
||||
<DependentUpon>EgtDataGrid.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="EgtDataGrid\DataGridColumnsIniFile.vb" />
|
||||
<Compile Include="MachGroup Model\BeamMachGroupM.vb" />
|
||||
<Compile Include="DataAccess\PartAddedEventArgs.vb" />
|
||||
<Compile Include="DataAccess\BTLParamAddedEventArgs.vb" />
|
||||
<Compile Include="Lib\MachGroupAddedEventArgs.vb" />
|
||||
<Compile Include="Lib\MachGroupVM.vb" />
|
||||
<Compile Include="Lib\NewMachGroupPanelVM.vb" />
|
||||
<Compile Include="BTL Model\BTLFeatureM.vb" />
|
||||
<Compile Include="BTL Model\BTLParamM.vb" />
|
||||
<Compile Include="DataAccess\BTLFeatureAddedEventArgs.vb" />
|
||||
<Compile Include="DataAccess\BTLPartAddedEventArgs.vb" />
|
||||
<Compile Include="BTL Model\BTLPartM.vb" />
|
||||
<Compile Include="BTL Model\BTLStructureM.vb" />
|
||||
<Compile Include="Constants\ConstBeam.vb" />
|
||||
<Compile Include="Enum.vb" />
|
||||
<Compile Include="MachGroupPanel\BeamMachGroupVM.vb" />
|
||||
<Compile Include="MachGroupPanel\BeamVM.vb" />
|
||||
<Compile Include="MachGroupPanel\MyMachGroupPanelVM.vb" />
|
||||
<Compile Include="MachGroupPanel\MyMachGroupVM.vb" />
|
||||
<Compile Include="MachGroupPanel\PartVM.vb" />
|
||||
<Compile Include="MachGroupPanel\WallMachGroupVM.vb" />
|
||||
<Compile Include="MachGroupPanel\WallVM.vb" />
|
||||
<Compile Include="MachLog.vb" />
|
||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||
<Compile Include="My Project\Application.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Application.myapp</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<Compile Include="My Project\Resources.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
@@ -97,17 +125,29 @@
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<Compile Include="MyMachGroup.vb" />
|
||||
<Compile Include="Part.vb" />
|
||||
<Compile Include="MachGroup Model\MyMachGroupM.vb" />
|
||||
<Compile Include="Lib\MachGroupM.vb" />
|
||||
<Compile Include="Lib\MachGroupPanelM.vb" />
|
||||
<Compile Include="MachGroup Model\MyMachGroupPanelM.vb" />
|
||||
<Compile Include="MyMachine.vb" />
|
||||
<Compile Include="OpenProjectFileDialog\OpenProjectFileDialogV.xaml.vb">
|
||||
<DependentUpon>OpenProjectFileDialogV.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="OpenProjectFileDialog\OpenProjectFileDialogVM.vb" />
|
||||
<Compile Include="PartM.vb" />
|
||||
<Compile Include="ProdFileM.vb" />
|
||||
<Compile Include="ProjectFileM.vb" />
|
||||
<Compile Include="ProjectManager\ProdFileVM.vb" />
|
||||
<Compile Include="ProjectManager\ProjectFileVM.vb" />
|
||||
<Compile Include="ProjectManager\ProjFileVM.vb" />
|
||||
<Compile Include="ProjFileM.vb" />
|
||||
<Compile Include="SectionXMaterial.vb" />
|
||||
<Compile Include="Utility\BTLIniFile.vb" />
|
||||
<Compile Include="Utility\Command.vb" />
|
||||
<Compile Include="Utility\CoreMap.vb" />
|
||||
<Compile Include="Utility\VMBase.vb" />
|
||||
<Compile Include="Wall.vb" />
|
||||
<Compile Include="WallMachGroup.vb" />
|
||||
<Compile Include="WallM.vb" />
|
||||
<Compile Include="WallMachGroupM.vb" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="My Project\Resources.resx">
|
||||
@@ -128,8 +168,18 @@
|
||||
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Include="EgtDataGrid\EgtDataGrid.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="OpenProjectFileDialog\OpenProjectFileDialogV.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>copy $(TargetPath) c:\EgtProg\EgtBEAMWALL\ViewerOptimizer\EgtBEAMWALL.Core.dll</PostBuildEvent>
|
||||
<PostBuildEvent>copy $(TargetPath) c:\EgtProg\EgtBEAMWALL\EgtBEAMWALL.Core.dll</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,42 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.Windows.Controls
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Module DataGridColumnsIniFile
|
||||
|
||||
Public m_sDataGridColumnsIniFile As String
|
||||
|
||||
Public Function GetPrivateProfileColumns(ParentDGName As String, ByRef ocColumns As ObservableCollection(Of EgtDataGridColumn)) As Boolean
|
||||
Dim colIndex As Integer = 0
|
||||
Dim str = String.Empty
|
||||
While EgtUILib.GetPrivateProfileString(ParentDGName, colIndex, String.Empty, str, m_sDataGridColumnsIniFile) > 0
|
||||
Dim sColumnParams() As String = str.Split(","c)
|
||||
' verifico numero minimo di parametri
|
||||
If sColumnParams.Count >= 7 Then
|
||||
' cancello spazi
|
||||
For index = 0 To sColumnParams.Count - 1
|
||||
sColumnParams(index) = sColumnParams(index).Trim()
|
||||
Next
|
||||
' creo colonna
|
||||
Dim sName = sColumnParams(0)
|
||||
Dim bReorder As Boolean = sColumnParams(1).Equals("1")
|
||||
Dim bResize As Boolean = sColumnParams(2).Equals("1")
|
||||
Dim bSort As Boolean = sColumnParams(3).Equals("1")
|
||||
Dim bIsReadOnly As Boolean = sColumnParams(4).Equals("1")
|
||||
Dim Width As Double
|
||||
Dim WidthType As DataGridLengthUnitType
|
||||
StringToDouble(sColumnParams(5), Width)
|
||||
Integer.TryParse(sColumnParams(6), WidthType)
|
||||
ocColumns.Add(New EgtDataGridColumn(ParentDGName, sName, bReorder, bResize, bSort, bIsReadOnly, New DataGridLength(Width, WidthType)))
|
||||
End If
|
||||
colIndex += 1
|
||||
End While
|
||||
Return ocColumns.Count > 0
|
||||
End Function
|
||||
|
||||
Public Function WriteColumnPrivateProfileParam(ParentDataGridName As String, DisplayIndex As String, sColumnParams As String) As Boolean
|
||||
Return WritePrivateProfileString(ParentDataGridName, DisplayIndex, sColumnParams, m_sDataGridColumnsIniFile)
|
||||
End Function
|
||||
|
||||
End Module
|
||||
@@ -0,0 +1,13 @@
|
||||
<DataGrid x:Class="EgtDataGrid"
|
||||
x:Name="CurrDataGrid"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<DataGrid.ColumnHeaderStyle>
|
||||
<Style TargetType="DataGridColumnHeader">
|
||||
<EventSetter Event="SizeChanged" Handler="Cell_SizedChanged" />
|
||||
</Style>
|
||||
</DataGrid.ColumnHeaderStyle>
|
||||
|
||||
</DataGrid>
|
||||
|
||||
|
||||
@@ -0,0 +1,275 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.Collections.Specialized
|
||||
Imports System.Windows
|
||||
Imports System.Windows.Controls
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class EgtDataGrid
|
||||
|
||||
Sub New()
|
||||
InitializeComponent()
|
||||
End Sub
|
||||
|
||||
Public Shadows Property BindingColumns As ObservableCollection(Of EgtDataGridColumn)
|
||||
Get
|
||||
Return CType(MyBase.GetValue(BindingColumnsProperty), ObservableCollection(Of EgtDataGridColumn))
|
||||
End Get
|
||||
Set(value As ObservableCollection(Of EgtDataGridColumn))
|
||||
MyBase.SetValue(BindingColumnsProperty, value)
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Shared ReadOnly BindingColumnsProperty As DependencyProperty = DependencyProperty.Register("BindingColumns", GetType(ObservableCollection(Of EgtDataGridColumn)), GetType(EgtDataGrid), New FrameworkPropertyMetadata(New ObservableCollection(Of EgtDataGridColumn), New PropertyChangedCallback(AddressOf OnDataGridColumnsPropertyChanged)) With {.BindsTwoWayByDefault = True})
|
||||
|
||||
Private Shared Sub OnDataGridColumnsPropertyChanged(ByVal source As DependencyObject, ByVal e As DependencyPropertyChangedEventArgs)
|
||||
Dim context = TryCast(source, EgtDataGrid)
|
||||
Dim oldItems = TryCast(e.OldValue, ObservableCollection(Of EgtDataGridColumn))
|
||||
|
||||
If oldItems IsNot Nothing Then
|
||||
|
||||
For Index = 0 To oldItems.Count - 1
|
||||
Dim Column As DataGridColumn = context.FindResource(oldItems(Index))
|
||||
context.Columns.Remove(Column)
|
||||
Next
|
||||
|
||||
RemoveHandler oldItems.CollectionChanged, AddressOf context.collectionChanged
|
||||
End If
|
||||
|
||||
Dim newItems = TryCast(e.NewValue, ObservableCollection(Of EgtDataGridColumn))
|
||||
|
||||
If newItems IsNot Nothing Then
|
||||
|
||||
For Index = 0 To newItems.Count - 1
|
||||
Dim col As DataGridColumn = context.FindResource(newItems(Index).Name)
|
||||
newItems(Index).InitColumn(col)
|
||||
context.Columns.Add(col)
|
||||
Next
|
||||
|
||||
AddHandler newItems.CollectionChanged, AddressOf context.collectionChanged
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub collectionChanged(ByVal sender As Object, ByVal e As NotifyCollectionChangedEventArgs)
|
||||
Select Case e.Action
|
||||
Case NotifyCollectionChangedAction.Add
|
||||
|
||||
If e.NewItems IsNot Nothing Then
|
||||
|
||||
For Each one As EgtDataGridColumn In e.NewItems
|
||||
Dim col As DataGridColumn = CurrDataGrid.FindResource(one.Name)
|
||||
one.InitColumn(col)
|
||||
CurrDataGrid.Columns.Insert(e.NewStartingIndex, col)
|
||||
If col.DisplayIndex <> e.NewStartingIndex Then
|
||||
CurrDataGrid.Columns(e.NewStartingIndex).DisplayIndex = e.NewStartingIndex
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
Case NotifyCollectionChangedAction.Remove
|
||||
|
||||
If e.OldItems IsNot Nothing Then
|
||||
|
||||
For Each one As EgtDataGridColumn In e.OldItems
|
||||
Dim col As DataGridColumn = CurrDataGrid.FindResource(one.Name)
|
||||
CurrDataGrid.Columns.Remove(col)
|
||||
Next
|
||||
End If
|
||||
|
||||
Case NotifyCollectionChangedAction.Move
|
||||
'Dim col As DataGridColumn = CurrDataGrid.FindResource(BindingColumns(e.OldStartingIndex))
|
||||
'col.DisplayIndex = e.NewStartingIndex
|
||||
CurrDataGrid.Columns.Move(e.OldStartingIndex, e.NewStartingIndex)
|
||||
CurrDataGrid.Columns(e.NewStartingIndex).DisplayIndex = e.NewStartingIndex
|
||||
'Dim x = CurrDataGrid.Columns(e.OldStartingIndex).DisplayIndex
|
||||
Case NotifyCollectionChangedAction.Reset
|
||||
CurrDataGrid.Columns.Clear()
|
||||
|
||||
If e.NewItems IsNot Nothing Then
|
||||
|
||||
For Each one As DataGridColumn In e.NewItems
|
||||
Dim col As DataGridColumn = CurrDataGrid.FindResource(one)
|
||||
CurrDataGrid.Columns.Add(col)
|
||||
Next
|
||||
End If
|
||||
Case NotifyCollectionChangedAction.Replace
|
||||
Dim col As DataGridColumn = CurrDataGrid.FindResource(e.NewItems(0))
|
||||
CurrDataGrid.Columns(e.NewStartingIndex) = col
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Private Sub Cell_SizedChanged(sender As Object, e As SizeChangedEventArgs)
|
||||
' ad ogni ridimensionamento della cella del ColumnHeader salvo le nuove dimensioni nell'ini
|
||||
If Not IsNothing(e.OriginalSource.Column) AndAlso Not IsNothing(BindingColumns(e.OriginalSource.Column.DisplayIndex)) Then
|
||||
BindingColumns(e.OriginalSource.Column.DisplayIndex).SaveDataGridColumn()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public OldIndex As Integer = 0
|
||||
|
||||
Private Sub CurrDataGrid_ColumnReordering(sender As Object, e As DataGridColumnEventArgs) Handles CurrDataGrid.ColumnReordering
|
||||
' conservo il vecchio indice in modo da effettuare lo scambio in BindingColumns una volta riordinate graficamente
|
||||
OldIndex = e.Column.DisplayIndex
|
||||
End Sub
|
||||
|
||||
Private Sub CurrDataGrid_ColumnReordered(sender As Object, e As DataGridColumnEventArgs) Handles CurrDataGrid.ColumnReordered
|
||||
' scambio le colonne in BindingColumns
|
||||
BindingColumns.Move(OldIndex, e.Column.DisplayIndex)
|
||||
' scrivo tutte le colonne interessate dallo spostamento
|
||||
' (se OldIndex > e.Column.DisplayIndex, il ciclo non viene eseguito quindi lo faccio nell'altro senso)
|
||||
For index = OldIndex To e.Column.DisplayIndex
|
||||
BindingColumns(index).SaveDataGridColumn()
|
||||
Next
|
||||
For index = e.Column.DisplayIndex To OldIndex
|
||||
BindingColumns(index).SaveDataGridColumn()
|
||||
Next
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
Public Class EgtDataGridColumn
|
||||
|
||||
Private m_dgColumn As DataGridColumn
|
||||
|
||||
Private Property m_ParentDataGridName As String
|
||||
Public Property ParentDataGridName As String
|
||||
Get
|
||||
Return m_ParentDataGridName
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_ParentDataGridName = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property m_Name As String
|
||||
Public Property Name As String
|
||||
Get
|
||||
Return m_Name
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_Name = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property m_Width As DataGridLength
|
||||
Public Property Width As DataGridLength
|
||||
Get
|
||||
Return m_dgColumn.Width
|
||||
End Get
|
||||
Set(value As DataGridLength)
|
||||
If Not IsNothing(m_dgColumn) Then
|
||||
m_dgColumn.Width = value
|
||||
Else
|
||||
m_Width = value
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property m_DisplayIndex As Integer
|
||||
Public Property DisplayIndex As Integer
|
||||
Get
|
||||
Return m_dgColumn.DisplayIndex
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
If Not IsNothing(m_dgColumn) Then
|
||||
m_dgColumn.DisplayIndex = value
|
||||
Else
|
||||
m_DisplayIndex = value
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property m_IsReadOnly As Boolean = True
|
||||
Public Property IsReadOnly As Boolean
|
||||
Get
|
||||
Return m_dgColumn.IsReadOnly
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
If Not IsNothing(m_dgColumn) Then
|
||||
m_dgColumn.IsReadOnly = value
|
||||
Else
|
||||
m_IsReadOnly = value
|
||||
End If
|
||||
SaveDataGridColumn()
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_CanUserReorder As Boolean
|
||||
Public Property CanUserReorder As Boolean
|
||||
Get
|
||||
Return m_dgColumn.CanUserReorder
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
If Not IsNothing(m_dgColumn) Then
|
||||
m_dgColumn.CanUserReorder = value
|
||||
Else
|
||||
m_CanUserReorder = value
|
||||
End If
|
||||
SaveDataGridColumn()
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_CanUserResize As Boolean
|
||||
Public Property CanUserResize As Boolean
|
||||
Get
|
||||
Return m_dgColumn.CanUserResize
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
If Not IsNothing(m_dgColumn) Then
|
||||
m_dgColumn.CanUserResize = value
|
||||
Else
|
||||
m_CanUserResize = value
|
||||
End If
|
||||
SaveDataGridColumn()
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_CanUserSort As Boolean
|
||||
Public Property CanUserSort As Boolean
|
||||
Get
|
||||
Return m_dgColumn.CanUserSort
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
If Not IsNothing(m_dgColumn) Then
|
||||
m_dgColumn.CanUserSort = value
|
||||
Else
|
||||
m_CanUserSort = value
|
||||
End If
|
||||
SaveDataGridColumn()
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Sub New(sName As String)
|
||||
m_Name = sName
|
||||
End Sub
|
||||
|
||||
Sub New(sParentDG As String, sName As String, bCanUserReorder As Boolean, bCanUserResize As Boolean, bCanUserSort As Boolean, bIsReadOnly As Boolean, Width As DataGridLength)
|
||||
m_ParentDataGridName = sParentDG
|
||||
m_Name = sName
|
||||
m_CanUserReorder = bCanUserReorder
|
||||
m_CanUserResize = bCanUserResize
|
||||
m_CanUserSort = bCanUserSort
|
||||
m_IsReadOnly = bIsReadOnly
|
||||
m_Width = Width
|
||||
End Sub
|
||||
|
||||
Friend Sub InitColumn(dgColumn As DataGridColumn)
|
||||
m_dgColumn = dgColumn
|
||||
m_dgColumn.CanUserReorder = m_CanUserReorder
|
||||
m_dgColumn.CanUserResize = m_CanUserResize
|
||||
m_dgColumn.CanUserSort = m_CanUserSort
|
||||
m_dgColumn.IsReadOnly = m_IsReadOnly
|
||||
'm_dgColumn.DisplayIndex = m_DisplayIndex
|
||||
m_dgColumn.Width = m_Width
|
||||
End Sub
|
||||
|
||||
' funzione per calcolare e scrivere la stringa dei parametri della colonna nell'INI
|
||||
Public Function SaveDataGridColumn() As Boolean
|
||||
Dim bOk As Boolean
|
||||
Dim sColumnParams = String.Empty
|
||||
sColumnParams = Name & "," & If(CanUserReorder, 1, 0) & "," & If(CanUserResize, 1, 0) & "," & If(CanUserSort, 1, 0) & "," & If(IsReadOnly, 1, 0) & "," & DoubleToString(Width.Value, 6) & "," & Width.UnitType
|
||||
bOk = WriteColumnPrivateProfileParam(ParentDataGridName, DisplayIndex, sColumnParams)
|
||||
Return bOk
|
||||
End Function
|
||||
|
||||
End Class
|
||||
@@ -1,8 +1,15 @@
|
||||
Public Enum CalcStates As Integer
|
||||
NOTCALCULATED = -1
|
||||
OK = 0
|
||||
WARNING = 1
|
||||
ERROR_ = 2
|
||||
NOTCALCULATED = -1
|
||||
OK = 0
|
||||
INFO = 1
|
||||
WARNING = 2
|
||||
ERROR_ = 3
|
||||
End Enum
|
||||
|
||||
Public Enum EventType
|
||||
ND = -1
|
||||
Started = 0
|
||||
Ended = 1
|
||||
End Enum
|
||||
|
||||
Public Enum ItemState As Integer
|
||||
@@ -13,4 +20,34 @@ Public Enum ItemState As Integer
|
||||
WIP = 2
|
||||
Produced = 3
|
||||
Scrapped = 4
|
||||
End Enum
|
||||
|
||||
Public Enum LogSupportLevel
|
||||
ND = -1
|
||||
I = 0
|
||||
E = 1
|
||||
End Enum
|
||||
|
||||
Public Enum LogSupportTarget
|
||||
ND = -1
|
||||
Supervisor = 0
|
||||
LoadProject = 1
|
||||
End Enum
|
||||
|
||||
Public Enum StatusMapItemType
|
||||
ND = -1
|
||||
Prod = 0
|
||||
MachGroup = 1
|
||||
End Enum
|
||||
|
||||
Public Enum StatusMapOpType
|
||||
ND = -1
|
||||
Startup = 0
|
||||
PartStart = 1
|
||||
PartEnd = 2
|
||||
MachGroupAdd = 3
|
||||
MachGroupMod = 4
|
||||
MachGroupRem = 5
|
||||
MachGroupNeedRedo = 6
|
||||
|
||||
End Enum
|
||||
@@ -0,0 +1,18 @@
|
||||
Public Class MachGroupAddedEventArgs
|
||||
Inherits EventArgs
|
||||
|
||||
Public m_NewMachGroupM As MachGroupM
|
||||
Public Property NewMachGroupM As MachGroupM
|
||||
Get
|
||||
Return m_NewMachGroupM
|
||||
End Get
|
||||
Private Set(value As MachGroupM)
|
||||
m_NewMachGroupM = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Sub New(NewMachGroupM As MachGroupM)
|
||||
Me.NewMachGroupM = NewMachGroupM
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,69 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.IO
|
||||
Imports System.Windows
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class MachGroupM
|
||||
|
||||
Protected m_Id As Integer
|
||||
Public ReadOnly Property Id As Integer
|
||||
Get
|
||||
Return m_Id
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_Name As String
|
||||
Public ReadOnly Property Name As String
|
||||
Get
|
||||
Return m_Name
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_Machine As String
|
||||
Public ReadOnly Property Machine As String
|
||||
Get
|
||||
Return m_Machine
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_IsEnabled As Boolean
|
||||
Public Property IsEnabled As Boolean
|
||||
Get
|
||||
Return m_IsEnabled
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_IsEnabled = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#Region "CONSTRUCTORS"
|
||||
|
||||
Protected Sub New()
|
||||
End Sub
|
||||
|
||||
Public Shared Function CreateNewMachGroup() As MachGroupM
|
||||
Return New MachGroupM
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateMachGroup(nId As Integer, sName As String, sMachine As String) As MachGroupM
|
||||
Dim NewMachGroupM As New MachGroupM
|
||||
NewMachGroupM.m_Id = nId
|
||||
NewMachGroupM.m_Name = sName
|
||||
NewMachGroupM.m_Machine = sMachine
|
||||
Return NewMachGroupM
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateMachGroup(sName As String, sMachine As String) As MachGroupM
|
||||
Dim NewMachGroupM As New MachGroupM
|
||||
' Creo il nuovo gruppo di lavorazione con i dati ottenuti a seconda del caso in cui mi trovo
|
||||
NewMachGroupM.m_Id = EgtAddMachGroup(sName, sMachine)
|
||||
If NewMachGroupM.m_Id = GDB_ID.NULL Then Return Nothing
|
||||
NewMachGroupM.m_Name = sName
|
||||
NewMachGroupM.m_Machine = sMachine
|
||||
Return NewMachGroupM
|
||||
End Function
|
||||
|
||||
#End Region ' CONSTRUCTORS
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,243 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.IO
|
||||
Imports System.Windows
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class MachGroupPanelM
|
||||
|
||||
#Region "FIELDS & PROPERTIES"
|
||||
|
||||
' Lista delle macchine disponibili
|
||||
Protected m_MachineList As List(Of Machine)
|
||||
|
||||
' Macchina di default
|
||||
Protected m_DefaultMachine As String = String.Empty
|
||||
Public ReadOnly Property DefaultMachine As String
|
||||
Get
|
||||
Return m_DefaultMachine
|
||||
End Get
|
||||
End Property
|
||||
' Variabile che definisce se il nome è automatico
|
||||
Protected m_IsGroupNameAutomatic As Boolean = True
|
||||
' Variabile che definisce se ci sono più gruppi di lavorazione
|
||||
Protected m_IsMultiMachGroup As Boolean
|
||||
Public ReadOnly Property IsMultiMachGroup As Boolean
|
||||
Get
|
||||
Return m_IsMultiMachGroup
|
||||
End Get
|
||||
End Property
|
||||
' Nome base dei gruppi
|
||||
Protected m_BaseName As String
|
||||
|
||||
Protected m_MachGroupMList As New List(Of MachGroupM)
|
||||
Public Property MachGroupMList As List(Of MachGroupM)
|
||||
Get
|
||||
Return m_MachGroupMList
|
||||
End Get
|
||||
Set(value As List(Of MachGroupM))
|
||||
m_MachGroupMList = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_MachGroupPanel_Visibility As Visibility
|
||||
Public Property MachGroupPanel_Visibility As Visibility
|
||||
Get
|
||||
Return m_MachGroupPanel_Visibility
|
||||
End Get
|
||||
Set(value As Visibility)
|
||||
m_MachGroupPanel_Visibility = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' Variabile che permette di abilitare/disabilitare i bottoni aggiungi e togli MachGroup
|
||||
Protected m_IsEnabledAddRemove As Boolean
|
||||
Public Property IsEnabledAddRemove As Boolean
|
||||
Get
|
||||
Return m_IsEnabledAddRemove
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_IsEnabledAddRemove = value
|
||||
End Set
|
||||
End Property
|
||||
' Variabile che definisce lo stato (attivi/disattivi) di tutti i gruppi tranne quello selezionato
|
||||
Protected m_IsEnabledMachGroups As Boolean
|
||||
Public Property IsEnabledMachGroups As Boolean
|
||||
Get
|
||||
Return m_IsEnabledMachGroups
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_IsEnabledMachGroups = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#End Region ' FIELDS & PROPERTIES
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Protected Sub New()
|
||||
End Sub
|
||||
|
||||
Public Shared Function CreateNewMachGroupPanel() As MachGroupPanelM
|
||||
Return New MachGroupPanelM
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateMachGroupPanel(IsMultiMachGroup As Boolean,
|
||||
MachineList As List(Of Machine), DefaultMachine As String,
|
||||
Optional sBaseName As String = "MachGroup_1") As MachGroupPanelM
|
||||
Dim NewMachGroupPanelM As New MachGroupPanelM
|
||||
NewMachGroupPanelM.m_IsMultiMachGroup = IsMultiMachGroup
|
||||
' Assegno nome base
|
||||
NewMachGroupPanelM.m_BaseName = sBaseName
|
||||
' Recupero lista macchine
|
||||
NewMachGroupPanelM.m_MachineList = MachineList
|
||||
' Assegno macchina di default
|
||||
NewMachGroupPanelM.m_DefaultMachine = DefaultMachine
|
||||
' recupero i MachGroup
|
||||
NewMachGroupPanelM.m_MachGroupMList = LoadMachGroups()
|
||||
|
||||
Return NewMachGroupPanelM
|
||||
End Function
|
||||
|
||||
Public Shared Function LoadMachGroups() As List(Of MachGroupM)
|
||||
Dim TempList As New List(Of MachGroupM)
|
||||
Dim nId = EgtGetFirstMachGroup()
|
||||
While nId <> GDB_ID.NULL
|
||||
EgtSetCurrMachGroup(nId)
|
||||
Dim sName As String = String.Empty
|
||||
Dim sMachine As String = String.Empty
|
||||
EgtGetMachGroupName(nId, sName)
|
||||
EgtGetMachGroupMachineName(nId, sMachine)
|
||||
TempList.Add(MachGroupM.CreateMachGroup(nId, sName, sMachine))
|
||||
nId = EgtGetNextMachGroup(nId)
|
||||
End While
|
||||
Return TempList
|
||||
End Function
|
||||
|
||||
#End Region ' CONSTRUCTOR
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Public Event MachGroupAdded As EventHandler(Of MachGroupAddedEventArgs)
|
||||
|
||||
Public Overridable Sub AddMachGroup(MachGroupM As MachGroupM)
|
||||
If IsNothing(MachGroupM) Then Return
|
||||
If Not m_MachGroupMList.Contains(MachGroupM) Then
|
||||
m_MachGroupMList.Add(MachGroupM)
|
||||
RaiseEvent MachGroupAdded(Me, New MachGroupAddedEventArgs(MachGroupM))
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Function GetMachGroups() As List(Of MachGroupM)
|
||||
Return New List(Of MachGroupM)(m_MachGroupMList)
|
||||
End Function
|
||||
|
||||
'Public Function InitMachGroupPanel(IsMultiMachGroup As Boolean,
|
||||
' MachineList As List(Of Machine), DefaultMachine As String,
|
||||
' Optional sBaseName As String = "MachGroup_1") As Boolean
|
||||
' m_IsMultiMachGroup = IsMultiMachGroup
|
||||
' ' se è a gruppo singolo, nascondo il panel
|
||||
' If Not m_IsMultiMachGroup Then SetMachGroupPanelVisibility(False)
|
||||
' ' Assegno nome base
|
||||
' m_BaseName = sBaseName
|
||||
' ' Recupero lista macchine
|
||||
' m_MachineList = MachineList
|
||||
' ' Assegno macchina di default
|
||||
' m_DefaultMachine = DefaultMachine
|
||||
' Return MachineList.Count > 0
|
||||
'End Function
|
||||
|
||||
'Public Overridable Sub LoadMachGroupList()
|
||||
' ' Carico i gruppi di lavorazione nella lista
|
||||
' Dim nId = EgtGetFirstMachGroup()
|
||||
' While nId <> GDB_ID.NULL
|
||||
' Dim sName As String = String.Empty
|
||||
' Dim sMachine As String = String.Empty
|
||||
' EgtGetMachGroupName(nId, sName)
|
||||
' EgtGetMachGroupMachineName(nId, sMachine)
|
||||
' MachGroupMList.Add(New MachGroup(nId, sName, sMachine))
|
||||
' nId = EgtGetNextMachGroup(nId)
|
||||
' End While
|
||||
'End Sub
|
||||
|
||||
Public Overridable Function NewMachGroup() As MachGroupM
|
||||
' Sistemazioni preliminari
|
||||
OnPreNewMachGroup()
|
||||
' Se non ci sono macchine disponibili esco con errore
|
||||
If m_MachineList.Count <= 0 Then Return Nothing
|
||||
' Creo il VM per chiedere nome e macchina a seconda del caso in cui mi trovo
|
||||
Dim NewMachGroupWndVM As NewMachGroupWndVM = Nothing
|
||||
Dim sNewMGrpName As String = m_BaseName
|
||||
Dim sNewMachName As String = m_MachineList(0).Name
|
||||
If m_IsMultiMachGroup Then
|
||||
EgtGetMachGroupNewName(sNewMGrpName)
|
||||
If m_MachineList.Count = 1 Then
|
||||
If Not m_IsGroupNameAutomatic Then
|
||||
NewMachGroupWndVM = New NewMachGroupWndVM(sNewMGrpName)
|
||||
End If
|
||||
Else
|
||||
If m_IsGroupNameAutomatic Then
|
||||
NewMachGroupWndVM = New NewMachGroupWndVM(m_DefaultMachine, m_MachineList)
|
||||
Else
|
||||
NewMachGroupWndVM = New NewMachGroupWndVM(sNewMGrpName, m_DefaultMachine, m_MachineList)
|
||||
End If
|
||||
End If
|
||||
ElseIf EgtGetMachGroupCount() = 0 Then
|
||||
If m_MachineList.Count > 1 Then
|
||||
NewMachGroupWndVM = New NewMachGroupWndVM(m_DefaultMachine, m_MachineList)
|
||||
End If
|
||||
End If
|
||||
' Se necessario, lancio finestra di acquisizione dati
|
||||
If Not IsNothing(NewMachGroupWndVM) Then
|
||||
' Se non esistono gruppi nella lista, rendo la finestra non chiudibile senza scelta
|
||||
If m_MachGroupMList.Count = 0 Then NewMachGroupWndVM.IsClosable = False
|
||||
' Lancio finestra
|
||||
Dim NewMachGroupWndV As New NewMachGroupWndV(Application.Current.MainWindow, NewMachGroupWndVM)
|
||||
If NewMachGroupWndV.ShowDialog() = False Then Return Nothing
|
||||
' Recupero dati
|
||||
If Not IsNothing(NewMachGroupWndVM.Name) Then sNewMGrpName = NewMachGroupWndVM.Name
|
||||
If Not IsNothing(NewMachGroupWndVM.SelectedMachine) Then sNewMachName = NewMachGroupWndVM.SelectedMachine.Name
|
||||
End If
|
||||
' Creo il nuovo gruppo di lavorazione con i dati ottenuti a seconda del caso in cui mi trovo
|
||||
Dim MachGroupM As MachGroupM = MachGroupM.CreateMachGroup(sNewMGrpName, sNewMachName)
|
||||
If IsNothing(MachGroupM) Then Return Nothing
|
||||
AddMachGroup(MachGroupM)
|
||||
' Sistemazioni finali
|
||||
m_DefaultMachine = sNewMachName
|
||||
OnPostNewMachGroup()
|
||||
Return MachGroupM
|
||||
End Function
|
||||
|
||||
Public Function NewMachGroupWithDefaults() As MachGroupM
|
||||
' Sistemazioni preliminari
|
||||
OnPreNewMachGroup()
|
||||
' Se non ci sono macchine disponibili esco con errore
|
||||
If m_MachineList.Count <= 0 Then Return Nothing
|
||||
' Assegno valori di default
|
||||
Dim sNewMGrpName As String = m_BaseName
|
||||
Dim sNewMachName As String = If(Machine.ExistsMachine(m_DefaultMachine, m_MachineList), m_DefaultMachine, m_MachineList(0).Name)
|
||||
' Creo il nuovo gruppo di lavorazione con i dati ottenuti a seconda del caso in cui mi trovo
|
||||
Dim MachGroupM As MachGroupM = MachGroupM.CreateMachGroup(sNewMGrpName, sNewMachName)
|
||||
If IsNothing(MachGroupM) Then Return Nothing
|
||||
AddMachGroup(MachGroupM)
|
||||
' Sistemazioni finali
|
||||
m_DefaultMachine = sNewMachName
|
||||
OnPostNewMachGroup()
|
||||
Return MachGroupM
|
||||
End Function
|
||||
|
||||
Public Overridable Function OnPreNewMachGroup() As Boolean
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Public Overridable Function OnPostNewMachGroup() As Boolean
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Public Overridable Function OnPreRemoveCurrMachGroup() As Boolean
|
||||
Return True
|
||||
End Function
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,60 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.IO
|
||||
Imports System.Windows
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class MachGroupVM
|
||||
Inherits VMBase
|
||||
|
||||
Protected m_MachGroupM As MachGroupM
|
||||
Public ReadOnly Property MachGroupM As MachGroupM
|
||||
Get
|
||||
Return m_MachGroupM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Id As Integer
|
||||
Get
|
||||
Return m_MachGroupM.Id
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Name As String
|
||||
Get
|
||||
Return m_MachGroupM.Name
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Machine As String
|
||||
Get
|
||||
Return m_MachGroupM.Machine
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Property IsEnabled As Boolean
|
||||
Get
|
||||
Return m_MachGroupM.IsEnabled
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_MachGroupM.IsEnabled = value
|
||||
NotifyPropertyChanged(NameOf(IsEnabled))
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#Region "ToolTip"
|
||||
|
||||
Public Overridable ReadOnly Property MachGroupToolTip As String
|
||||
Get
|
||||
Return "Name: " & m_MachGroupM.Name & Environment.NewLine &
|
||||
"Machine: " & m_MachGroupM.Machine
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region ' ToolTip
|
||||
|
||||
Sub New(MachGroupM As MachGroupM)
|
||||
m_MachGroupM = MachGroupM
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,290 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.Collections.Specialized
|
||||
Imports System.ComponentModel
|
||||
Imports System.IO
|
||||
Imports System.Windows
|
||||
Imports System.Windows.Input
|
||||
Imports EgtBEAMWALL.Core
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class NewMachGroupPanelVM
|
||||
Inherits VMBase
|
||||
|
||||
#Region "FIELDS & PROPERTIES"
|
||||
|
||||
Protected m_MachGroupPanelM As MachGroupPanelM
|
||||
|
||||
Public ReadOnly Property DefaultMachine As String
|
||||
Get
|
||||
Return m_MachGroupPanelM.DefaultMachine
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_MachGroupVMList As ObservableCollection(Of MachGroupVM)
|
||||
Public Property MachGroupVMList As ObservableCollection(Of MachGroupVM)
|
||||
Get
|
||||
Return m_MachGroupVMList
|
||||
End Get
|
||||
Set(value As ObservableCollection(Of MachGroupVM))
|
||||
m_MachGroupVMList = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_SelectedMachGroup As MachGroupVM
|
||||
Public Property SelectedMachGroup As MachGroupVM
|
||||
Get
|
||||
Return m_SelectedMachGroup
|
||||
End Get
|
||||
Set(value As MachGroupVM)
|
||||
m_SelectedMachGroup = value
|
||||
If Not IsNothing(value) Then
|
||||
OnPreSetCurrMachGroup()
|
||||
EgtSetCurrMachGroup(value.Id)
|
||||
OnPostSetCurrMachGroup()
|
||||
End If
|
||||
NotifyPropertyChanged(NameOf(SelectedMachGroup))
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property MachGroupPanel_Visibility As Visibility
|
||||
Get
|
||||
Return m_MachGroupPanelM.MachGroupPanel_Visibility
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub SetMachGroupPanelVisibility(IsVisible As Boolean)
|
||||
If IsVisible Then
|
||||
m_MachGroupPanelM.MachGroupPanel_Visibility = Visibility.Visible
|
||||
Else
|
||||
m_MachGroupPanelM.MachGroupPanel_Visibility = Visibility.Collapsed
|
||||
End If
|
||||
NotifyPropertyChanged(NameOf(MachGroupPanel_Visibility))
|
||||
End Sub
|
||||
|
||||
|
||||
' Variabile che permette di abilitare/disabilitare i bottoni aggiungi e togli MachGroup
|
||||
Public Property IsEnabledAddRemove As Boolean
|
||||
Get
|
||||
Return m_MachGroupPanelM.IsEnabledAddRemove
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_MachGroupPanelM.IsEnabledAddRemove = value
|
||||
NotifyPropertyChanged(NameOf(IsEnabledAddRemove))
|
||||
End Set
|
||||
End Property
|
||||
' Variabile che definisce lo stato (attivi/disattivi) di tutti i gruppi tranne quello selezionato
|
||||
Public ReadOnly Property IsEnabledMachGroups As Boolean
|
||||
Get
|
||||
Return m_MachGroupPanelM.IsEnabledMachGroups
|
||||
End Get
|
||||
End Property
|
||||
|
||||
' Definizione comandi
|
||||
Private m_cmdSetCurrMachGroup As ICommand
|
||||
Private m_cmdAddMachGroup As ICommand
|
||||
Private m_cmdRemoveMachGroup As ICommand
|
||||
|
||||
#End Region ' FIELDS & PROPERTIES
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Sub New(MachGroupPanelM As MachGroupPanelM)
|
||||
m_MachGroupPanelM = MachGroupPanelM
|
||||
AddHandler m_MachGroupPanelM.MachGroupAdded, AddressOf OnMachGroupAdded
|
||||
If Not MachGroupPanelM.IsMultiMachGroup Then SetMachGroupPanelVisibility(False)
|
||||
CreateMachGroupVMList()
|
||||
' Creo riferimento a questa classe in LibMap
|
||||
'''LibMap.SetRefMachGroupPanelVM(Me)
|
||||
End Sub
|
||||
|
||||
#End Region ' CONSTRUCTOR
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Protected Overridable Sub CreateMachGroupVMList()
|
||||
Dim all As List(Of MachGroupVM) = (From MachGroupM In m_MachGroupPanelM.GetMachGroups()
|
||||
Select New MachGroupVM(MachGroupM)).ToList()
|
||||
|
||||
For Each MachGroupvM As MachGroupVM In all
|
||||
AddHandler MachGroupvM.PropertyChanged, AddressOf OnMachGroupVMPropertyChanged
|
||||
Next
|
||||
|
||||
m_MachGroupVMList = New ObservableCollection(Of MachGroupVM)(all)
|
||||
AddHandler m_MachGroupVMList.CollectionChanged, AddressOf OnMachGroupVMListChanged
|
||||
End Sub
|
||||
|
||||
Public Overridable Function InitMachGroupList(Optional bUseDefaults As Boolean = False) As Boolean
|
||||
' Svuoto precedente lista di MachGroup
|
||||
m_MachGroupPanelM.MachGroupMList.Clear()
|
||||
' verifico se esistono già gruppi di lavorazione o se devo creare il primo
|
||||
Dim bOk As Boolean
|
||||
Dim nId = EgtGetFirstMachGroup()
|
||||
If nId <> GDB_ID.NULL Then
|
||||
bOk = EgtSetCurrMachGroup(nId)
|
||||
Else
|
||||
If bUseDefaults Then
|
||||
bOk = Not IsNothing(m_MachGroupPanelM.NewMachGroupWithDefaults())
|
||||
Else
|
||||
bOk = Not IsNothing(m_MachGroupPanelM.NewMachGroup())
|
||||
End If
|
||||
End If
|
||||
If Not bOk Then Return False
|
||||
' Sistemazioni finali
|
||||
m_MachGroupPanelM.MachGroupMList = MachGroupPanelM.LoadMachGroups()
|
||||
SelectedMachGroup = MachGroupVMList(0)
|
||||
Return True
|
||||
End Function
|
||||
|
||||
' Funzione che permette di abilitare o disabilitare tutti i gruppi tranne quello selezionato più i bottni Add/Remove
|
||||
Public Function SetMachGroupState(bState As Boolean) As Boolean
|
||||
If bState Then
|
||||
For Each Group In MachGroupVMList
|
||||
Group.IsEnabled = True
|
||||
Next
|
||||
m_MachGroupPanelM.IsEnabledAddRemove = True
|
||||
NotifyPropertyChanged(NameOf(IsEnabledAddRemove))
|
||||
m_MachGroupPanelM.IsEnabledMachGroups = True
|
||||
Return True
|
||||
Else
|
||||
For Each Group In MachGroupVMList
|
||||
If Group Is SelectedMachGroup Then
|
||||
Group.IsEnabled = True
|
||||
Else
|
||||
Group.IsEnabled = False
|
||||
End If
|
||||
Next
|
||||
m_MachGroupPanelM.IsEnabledAddRemove = False
|
||||
NotifyPropertyChanged(NameOf(IsEnabledAddRemove))
|
||||
m_MachGroupPanelM.IsEnabledMachGroups = False
|
||||
Return True
|
||||
End If
|
||||
Return False
|
||||
End Function
|
||||
|
||||
Public Overridable Function OnPreSetCurrMachGroup() As Boolean
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Public Overridable Function OnPostSetCurrMachGroup() As Boolean
|
||||
Return True
|
||||
End Function
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
#Region "COMMANDS"
|
||||
|
||||
#Region "AddMachGroupCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that set the selected MachGroup as the Current one.
|
||||
''' </summary>
|
||||
Public ReadOnly Property AddMachGroupCommand As ICommand
|
||||
Get
|
||||
If m_cmdAddMachGroup Is Nothing Then
|
||||
m_cmdAddMachGroup = New Command(AddressOf AddMachGroup)
|
||||
End If
|
||||
Return m_cmdAddMachGroup
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Overridable Sub AddMachGroup()
|
||||
Dim MachGroupM As MachGroupM = m_MachGroupPanelM.NewMachGroup()
|
||||
If IsNothing(MachGroupM) Then Return
|
||||
' lo seleziono
|
||||
SelectedMachGroup = MachGroupVMList.FirstOrDefault(Function(x) x.MachGroupM Is MachGroupM)
|
||||
EgtZoom(ZM.ALL)
|
||||
End Sub
|
||||
|
||||
#End Region ' AddMachGroupCommand
|
||||
|
||||
#Region "RemoveMachGroupCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that set the selected MachGroup as the Current one.
|
||||
''' </summary>
|
||||
Public ReadOnly Property RemoveMachGroupCommand As ICommand
|
||||
Get
|
||||
If m_cmdRemoveMachGroup Is Nothing Then
|
||||
m_cmdRemoveMachGroup = New Command(AddressOf RemoveMachGroup)
|
||||
End If
|
||||
Return m_cmdRemoveMachGroup
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Overridable Sub RemoveMachGroup()
|
||||
' Calcolo indice del gruppo da cancellare
|
||||
Dim nSelectedMachGroupIndex As Integer = MachGroupVMList.IndexOf(SelectedMachGroup)
|
||||
If MachGroupVMList.Count = 1 Then
|
||||
'chiedo conferma prima di resettare il gruppo di lavorazione
|
||||
Select Case MessageBox.Show("Eliminare?", "", MessageBoxButton.YesNo, MessageBoxImage.Question)
|
||||
Case MessageBoxResult.Yes
|
||||
' cancello il gruppo corrente e ne creo uno nuovo con lo stesso nome
|
||||
m_MachGroupPanelM.OnPreRemoveCurrMachGroup()
|
||||
EgtRemoveMachGroup(MachGroupVMList(0).Id)
|
||||
MachGroupVMList.Clear()
|
||||
AddMachGroup()
|
||||
EgtZoom(ZM.ALL)
|
||||
Case MessageBoxResult.No
|
||||
Return
|
||||
End Select
|
||||
Else
|
||||
'chiedo conferma prima di cancellare il gruppo di lavorazione
|
||||
Select Case MessageBox.Show("Eliminare?", "", MessageBoxButton.YesNo, MessageBoxImage.Question)
|
||||
Case MessageBoxResult.Yes
|
||||
' cancello quello selezionato (ovvero il corrente)
|
||||
m_MachGroupPanelM.OnPreRemoveCurrMachGroup()
|
||||
EgtRemoveMachGroup(MachGroupVMList(nSelectedMachGroupIndex).Id)
|
||||
' rendo corrente il gruppo di lavorazione successivo a quello da cancellare
|
||||
If nSelectedMachGroupIndex = 0 And MachGroupVMList.Count > 1 Then
|
||||
EgtSetCurrMachGroup(MachGroupVMList(nSelectedMachGroupIndex + 1).Id)
|
||||
SelectedMachGroup = MachGroupVMList(nSelectedMachGroupIndex + 1)
|
||||
' rendo corrente il gruppo di lavorazione precedente a quello da cancellare
|
||||
ElseIf nSelectedMachGroupIndex > 0 Then
|
||||
EgtSetCurrMachGroup(MachGroupVMList(nSelectedMachGroupIndex - 1).Id)
|
||||
SelectedMachGroup = MachGroupVMList(nSelectedMachGroupIndex - 1)
|
||||
End If
|
||||
EgtZoom(ZM.ALL)
|
||||
' aggiorno la lista dei gruppi
|
||||
MachGroupVMList.RemoveAt(nSelectedMachGroupIndex)
|
||||
Case MessageBoxResult.No
|
||||
Return
|
||||
End Select
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region ' RemoveMachGroupCommand
|
||||
|
||||
#End Region ' COMMANDS
|
||||
|
||||
#Region "EVENTS"
|
||||
|
||||
Protected Overridable Sub OnMachGroupAdded(sender As Object, e As MachGroupAddedEventArgs)
|
||||
Dim MachGroupVM As MachGroupVM = New MachGroupVM(e.NewMachGroupM)
|
||||
m_MachGroupVMList.Add(MachGroupVM)
|
||||
NotifyPropertyChanged(NameOf(MachGroupVMList))
|
||||
End Sub
|
||||
|
||||
Protected Sub OnMachGroupVMListChanged(sender As Object, e As NotifyCollectionChangedEventArgs)
|
||||
If Not IsNothing(e.NewItems) AndAlso e.NewItems.Count > 0 Then
|
||||
For Each MachGroupVM As MachGroupVM In e.NewItems
|
||||
AddHandler MachGroupVM.PropertyChanged, AddressOf OnMachGroupVMPropertyChanged
|
||||
Next
|
||||
End If
|
||||
If Not IsNothing(e.OldItems) AndAlso e.OldItems.Count > 0 Then
|
||||
For Each MachGroupVM As MachGroupVM In e.OldItems
|
||||
RemoveHandler MachGroupVM.PropertyChanged, AddressOf OnMachGroupVMPropertyChanged
|
||||
Next
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Overridable Sub OnMachGroupVMPropertyChanged(sender As Object, e As PropertyChangedEventArgs)
|
||||
Select Case e.PropertyName
|
||||
'Case nameof(sender.sMATERIAL)
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
#End Region ' EVENTS
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,133 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.IO
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class BeamMachGroupM
|
||||
Inherits MyMachGroupM
|
||||
|
||||
Protected m_dStartCut As Double
|
||||
Public Property dStartCut As Double
|
||||
Get
|
||||
Return m_dStartCut
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_dStartCut = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#Region "CONSTRUCTORS"
|
||||
|
||||
Protected Sub New()
|
||||
End Sub
|
||||
|
||||
Public Shared Function CreateNewBeamMachGroup() As MachGroupM
|
||||
Return New MachGroupM
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateBeamMachGroup(nId As Integer, sName As String, sMachine As String) As MachGroupM
|
||||
Dim NewMachGroupM As New BeamMachGroupM
|
||||
NewMachGroupM.m_Id = nId
|
||||
NewMachGroupM.m_Name = sName
|
||||
NewMachGroupM.m_Machine = sMachine
|
||||
NewMachGroupM.SetMachineType(MachineType.BEAM)
|
||||
EgtGetInfo(NewMachGroupM.m_Id, MGR_RPT_BARLEN, NewMachGroupM.m_dL)
|
||||
EgtGetInfo(NewMachGroupM.m_Id, MGR_RPT_BARHEIGHT, NewMachGroupM.m_dH)
|
||||
EgtGetInfo(NewMachGroupM.m_Id, MGR_RPT_BARWIDTH, NewMachGroupM.m_dW)
|
||||
NewMachGroupM.m_dTotMat = NewMachGroupM.m_dL
|
||||
NewMachGroupM.m_PartMList = LoadParts(NewMachGroupM)
|
||||
For Each Part As BeamM In NewMachGroupM.m_PartMList
|
||||
Part.UpdateOffset()
|
||||
NewMachGroupM.m_dMatForPart += Part.dL
|
||||
Next
|
||||
ReadMachGroupData(NewMachGroupM)
|
||||
Return NewMachGroupM
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateBeamMachGroup(sName As String, sMachine As String) As MachGroupM
|
||||
Dim NewMachGroupM As New BeamMachGroupM
|
||||
' Creo il nuovo gruppo di lavorazione con i dati ottenuti a seconda del caso in cui mi trovo
|
||||
NewMachGroupM.m_Id = EgtAddMachGroup(sName, sMachine)
|
||||
If NewMachGroupM.m_Id = GDB_ID.NULL Then Return Nothing
|
||||
NewMachGroupM.m_Name = sName
|
||||
NewMachGroupM.m_Machine = sMachine
|
||||
NewMachGroupM.SetMachineType(MachineType.BEAM)
|
||||
EgtGetInfo(NewMachGroupM.m_Id, MGR_RPT_BARLEN, NewMachGroupM.m_dL)
|
||||
EgtGetInfo(NewMachGroupM.m_Id, MGR_RPT_BARHEIGHT, NewMachGroupM.m_dH)
|
||||
EgtGetInfo(NewMachGroupM.m_Id, MGR_RPT_BARWIDTH, NewMachGroupM.m_dW)
|
||||
NewMachGroupM.m_dTotMat = NewMachGroupM.m_dL
|
||||
For Each Part In NewMachGroupM.m_PartMList
|
||||
NewMachGroupM.m_dMatForPart += Part.dL
|
||||
Next
|
||||
ReadMachGroupData(NewMachGroupM)
|
||||
Return NewMachGroupM
|
||||
End Function
|
||||
|
||||
#End Region ' CONSTRUCTORS
|
||||
|
||||
#Region "X DataLayer"
|
||||
|
||||
Public Shared Function CreateBeamMachGroupDL(nId As Integer, sName As String, sMachine As String, PartMList As List(Of PartM)) As MachGroupM
|
||||
Dim NewMachGroupM As New BeamMachGroupM
|
||||
NewMachGroupM.m_Id = nId
|
||||
NewMachGroupM.m_Name = sName
|
||||
NewMachGroupM.m_Machine = sMachine
|
||||
NewMachGroupM.SetMachineType(MachineType.BEAM)
|
||||
'EgtGetInfo(NewMachGroupM.m_Id, MGR_RPT_BARLEN, NewMachGroupM.m_dL)
|
||||
'EgtGetInfo(NewMachGroupM.m_Id, MGR_RPT_BARHEIGHT, NewMachGroupM.m_dH)
|
||||
'EgtGetInfo(NewMachGroupM.m_Id, MGR_RPT_BARWIDTH, NewMachGroupM.m_dW)
|
||||
'NewMachGroupM.m_dTotMat = NewMachGroupM.m_dL
|
||||
NewMachGroupM.m_PartMList = PartMList
|
||||
Return NewMachGroupM
|
||||
End Function
|
||||
|
||||
#End Region
|
||||
|
||||
Private Shared Function LoadParts(NewBeamMachGroupM As BeamMachGroupM) As List(Of PartM)
|
||||
Dim TempList As New List(Of PartM)
|
||||
Dim nRawPartId As Integer = EgtGetFirstRawPart()
|
||||
While nRawPartId <> GDB_ID.NULL
|
||||
Dim nPartId As Integer = EgtGetFirstPartInRawPart(nRawPartId)
|
||||
If nPartId <> GDB_ID.NULL Then
|
||||
Dim NewBeam As BeamM = BeamM.CreateBeam(NewBeamMachGroupM, nPartId, nRawPartId)
|
||||
TempList.Add(NewBeam)
|
||||
End If
|
||||
nRawPartId = EgtGetNextRawPart(nRawPartId)
|
||||
End While
|
||||
Return TempList
|
||||
End Function
|
||||
|
||||
Public Overrides Sub RefreshPartList()
|
||||
' leggo StartCut da posizione primo pezzo
|
||||
Dim sInfo As String = ""
|
||||
Dim sSplitInfo() As String
|
||||
Dim bFound As Boolean = False
|
||||
EgtGetInfo(Id, MGR_RPT_PART & 1, sInfo)
|
||||
If Not String.IsNullOrWhiteSpace(sInfo) Then
|
||||
sSplitInfo = sInfo.Split(","c)
|
||||
StringToDouble(sSplitInfo(1), m_dStartCut)
|
||||
Else
|
||||
m_dStartCut = 0
|
||||
End If
|
||||
' aggiorno lista pezzi
|
||||
RemoveAllParts()
|
||||
Dim nRawPartId As Integer = EgtGetFirstRawPart()
|
||||
While nRawPartId <> GDB_ID.NULL
|
||||
Dim nPartId As Integer = EgtGetFirstPartInRawPart(nRawPartId)
|
||||
If nPartId <> GDB_ID.NULL Then
|
||||
Dim NewBeam As BeamM = BeamM.CreateBeam(Me, nPartId, nRawPartId)
|
||||
AddPart(NewBeam)
|
||||
NewBeam.UpdateOffset()
|
||||
End If
|
||||
nRawPartId = EgtGetNextRawPart(nRawPartId)
|
||||
End While
|
||||
End Sub
|
||||
|
||||
Public Overrides Sub RefreshGroupData()
|
||||
EgtGetInfo(Id, MGR_RPT_BARLEN, dL)
|
||||
EgtGetInfo(Id, MGR_RPT_BARHEIGHT, dH)
|
||||
EgtGetInfo(Id, MGR_RPT_BARWIDTH, dW)
|
||||
EgtGetInfo(Id, MGR_RPT_MATERIAL, sMATERIAL)
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,332 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.IO
|
||||
Imports System.Windows.Input
|
||||
Imports System.Windows.Media
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public MustInherit Class MyMachGroupM
|
||||
Inherits MachGroupM
|
||||
|
||||
Protected m_nMachineType As MachineType
|
||||
Public ReadOnly Property nMachineType As MachineType
|
||||
Get
|
||||
Return m_nMachineType
|
||||
End Get
|
||||
End Property
|
||||
Public Sub SetMachineType(nMachineType As MachineType)
|
||||
m_nMachineType = nMachineType
|
||||
End Sub
|
||||
|
||||
Protected 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
|
||||
|
||||
Protected 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
|
||||
|
||||
Protected m_dH As Double
|
||||
Public Property dH As Double
|
||||
Get
|
||||
Return m_dH
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_dH = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_dtStartTime As DateTime
|
||||
Public Property dtStartTime As DateTime
|
||||
Get
|
||||
Return m_dtStartTime
|
||||
End Get
|
||||
Set(value As DateTime)
|
||||
m_dtStartTime = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_dtEndTime As DateTime
|
||||
Public Property dtEndTime As DateTime
|
||||
Get
|
||||
Return m_dtEndTime
|
||||
End Get
|
||||
Set(value As DateTime)
|
||||
m_dtEndTime = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_dMatForPart As Double = 0
|
||||
Public ReadOnly Property dMatForPart As Double
|
||||
Get
|
||||
Return m_dMatForPart
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_nProdIndex As Integer = 0
|
||||
Public Property nProdIndex As Integer
|
||||
Get
|
||||
Return m_nProdIndex
|
||||
End Get
|
||||
Set
|
||||
m_nProdIndex = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Sub SetMatForPart(dMatForPart As Double)
|
||||
m_dMatForPart = dMatForPart
|
||||
End Sub
|
||||
|
||||
Protected m_dTotMat As Double = 0
|
||||
Public ReadOnly Property dTotMat As Double
|
||||
Get
|
||||
Return m_dTotMat
|
||||
End Get
|
||||
End Property
|
||||
Public Sub SetTotMat(TotMat As Double)
|
||||
m_dTotMat = TotMat
|
||||
End Sub
|
||||
|
||||
Protected m_sMATERIAL As String
|
||||
Public Property sMATERIAL As String
|
||||
Get
|
||||
Return m_sMATERIAL
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_sMATERIAL = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' lista dei pezzi che sono nel grezzo
|
||||
Protected m_PartMList As New List(Of PartM)
|
||||
Public Property PartMList As List(Of PartM)
|
||||
Get
|
||||
Return m_PartMList
|
||||
End Get
|
||||
Set(value As List(Of PartM))
|
||||
m_PartMList = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_nCALC_ERR As Integer
|
||||
Public Property nCALC_ERR As Integer
|
||||
Get
|
||||
Return m_nCALC_ERR
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_nCALC_ERR = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_nCALC_FALL As Integer
|
||||
Public Property nCALC_FALL As Integer
|
||||
Get
|
||||
Return m_nCALC_FALL
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_nCALC_FALL = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_sCALC_MSG As String
|
||||
Public Property sCALC_MSG As String
|
||||
Get
|
||||
Return m_sCALC_MSG
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_sCALC_MSG = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public m_nCALC_ROT As Integer
|
||||
Public Property nCALC_ROT As Integer
|
||||
Get
|
||||
Return m_nCALC_ROT
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_nCALC_ROT = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public m_nCALC_TIME As Integer
|
||||
Public Property nCALC_TIME As Integer
|
||||
Get
|
||||
Return m_nCALC_TIME
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_nCALC_TIME = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public m_nCALC_GlobalState As CalcStates = CalcStates.NOTCALCULATED
|
||||
Public Property nCALC_GlobalState As CalcStates
|
||||
Get
|
||||
Return m_nCALC_GlobalState
|
||||
End Get
|
||||
Set(value As CalcStates)
|
||||
m_nCALC_GlobalState = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_nCALC_GlobalERR As Integer
|
||||
Public Property nCALC_GlobalERR As Integer
|
||||
Get
|
||||
Return m_nCALC_GlobalERR
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_nCALC_GlobalERR = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public m_nCALC_State As CalcStates = CalcStates.NOTCALCULATED
|
||||
Public Property nCALC_State As CalcStates
|
||||
Get
|
||||
Return m_nCALC_State
|
||||
End Get
|
||||
Set(value As CalcStates)
|
||||
m_nCALC_State = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_sSupervisorId As String
|
||||
Public Property sSupervisorId As String
|
||||
Get
|
||||
Return m_sSupervisorId
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_sSupervisorId = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_nPriorityIndex As Integer
|
||||
Public Property nPriorityIndex As Integer
|
||||
Get
|
||||
Return m_nPriorityIndex
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_nPriorityIndex = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_nProductionState As Integer = 0
|
||||
Public ReadOnly Property nProductionState As Integer
|
||||
Get
|
||||
Return m_nProductionState
|
||||
End Get
|
||||
End Property
|
||||
Public Sub SetState(nState As CalcStates)
|
||||
m_nProductionState = nState
|
||||
End Sub
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
'Sub New(nId As Integer, sName As String, sMachine As String)
|
||||
' MyBase.New(nId, sName, sMachine)
|
||||
' 'aggiorno lista pezzi
|
||||
' RefreshPartList()
|
||||
'End Sub
|
||||
|
||||
#End Region ' CONSTRUCTOR
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Public Event PartAdded As EventHandler(Of PartAddedEventArgs)
|
||||
Public Event PartRemoved As EventHandler(Of PartAddedEventArgs)
|
||||
|
||||
Public Sub AddPart(PartM As PartM)
|
||||
If IsNothing(PartM) Then Return
|
||||
If Not m_PartMList.Contains(PartM) Then
|
||||
m_PartMList.Add(PartM)
|
||||
RaiseEvent PartAdded(Me, New PartAddedEventArgs(PartM))
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Sub RemovePart(PartM As PartM)
|
||||
If IsNothing(PartM) Then Return
|
||||
If m_PartMList.Contains(PartM) AndAlso m_PartMList.Remove(PartM) Then
|
||||
RaiseEvent PartRemoved(Me, New PartAddedEventArgs(PartM))
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Sub RemoveAllParts()
|
||||
If IsNothing(m_PartMList) Then Return
|
||||
For PartIndex = m_PartMList.Count - 1 To 0 Step -1
|
||||
Dim PartM As PartM = m_PartMList(PartIndex)
|
||||
If m_PartMList.Remove(PartM) Then
|
||||
RaiseEvent PartRemoved(Me, New PartAddedEventArgs(PartM))
|
||||
End If
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Public Function GetParts() As List(Of PartM)
|
||||
Return New List(Of PartM)(m_PartMList)
|
||||
End Function
|
||||
|
||||
Public Shared Sub ReadMachGroupData(NewMachgroup As MyMachGroupM)
|
||||
' leggo materiale
|
||||
EgtGetInfo(NewMachgroup.Id, MGR_RPT_MATERIAL, NewMachgroup.sMATERIAL)
|
||||
' leggo calc error
|
||||
Dim nErr As Integer = 0
|
||||
Dim nRot As Integer = 0
|
||||
Dim nFall As Integer = 0
|
||||
Dim sMsg As String = ""
|
||||
Dim bCalc As Boolean = False
|
||||
bCalc = EgtGetInfo(NewMachgroup.Id, ITG_PROD_ERR, nErr)
|
||||
EgtGetInfo(NewMachgroup.Id, ITG_PROD_ROT, nRot)
|
||||
EgtGetInfo(NewMachgroup.Id, ITG_PROD_MSG, sMsg)
|
||||
If Not bCalc Then
|
||||
NewMachgroup.m_nCALC_State = CalcStates.NOTCALCULATED
|
||||
NewMachgroup.m_nCALC_ERR = 0
|
||||
NewMachgroup.m_nCALC_ROT = 0
|
||||
NewMachgroup.m_sCALC_MSG = ""
|
||||
Else
|
||||
NewMachgroup.m_nCALC_ERR = nErr
|
||||
NewMachgroup.m_nCALC_ROT = nRot
|
||||
NewMachgroup.m_sCALC_MSG = sMsg
|
||||
If nErr = 0 Then
|
||||
NewMachgroup.nCALC_State = CalcStates.OK
|
||||
ElseIf nErr = 17 Then
|
||||
NewMachgroup.nCALC_State = CalcStates.WARNING
|
||||
ElseIf nErr > 0 Then
|
||||
NewMachgroup.nCALC_State = CalcStates.ERROR_
|
||||
ElseIf nErr < 0 Then
|
||||
NewMachgroup.nCALC_State = CalcStates.INFO
|
||||
End If
|
||||
End If
|
||||
EgtGetInfo(NewMachgroup.Id, ITG_PROD_TIME, NewMachgroup.m_nCALC_TIME)
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
Public MustOverride Sub RefreshPartList()
|
||||
|
||||
Public MustOverride Sub RefreshGroupData()
|
||||
|
||||
Public Overridable Sub DeleteMachGroup()
|
||||
' elimino tutte le copie
|
||||
Dim nRawPartId As Integer = EgtGetFirstRawPart()
|
||||
Dim nBeamId As Integer = EgtGetFirstPartInRawPart(nRawPartId)
|
||||
While nRawPartId <> GDB_ID.NULL
|
||||
EgtRemovePartFromRawPart(nBeamId)
|
||||
EgtErase(nBeamId)
|
||||
nRawPartId = EgtGetNextRawPart(nRawPartId)
|
||||
nBeamId = EgtGetFirstPartInRawPart(nRawPartId)
|
||||
End While
|
||||
' elimino MachGroup
|
||||
EgtRemoveMachGroup(Me.Id)
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,221 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.IO
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class MyMachGroupPanelM
|
||||
Inherits MachGroupPanelM
|
||||
|
||||
#Region "FIELDS & PROPERTIES"
|
||||
|
||||
#End Region ' FIELDS & PROPERTIES
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Public Shared Function CreateMyMachGroupPanel(MachineList As List(Of Machine)) As MachGroupPanelM
|
||||
Dim NewMyMachGroupPanelM As New MyMachGroupPanelM
|
||||
NewMyMachGroupPanelM.m_IsMultiMachGroup = False
|
||||
' Assegno nome base
|
||||
NewMyMachGroupPanelM.m_BaseName = ""
|
||||
' Recupero lista macchine
|
||||
NewMyMachGroupPanelM.m_MachineList = MachineList
|
||||
' Assegno macchina di default
|
||||
NewMyMachGroupPanelM.m_DefaultMachine = ""
|
||||
' aggiorno copie
|
||||
UpdateDuplo()
|
||||
' recupero i MachGroup
|
||||
NewMyMachGroupPanelM.m_MachGroupMList = LoadMyMachGroups(MachineList)
|
||||
Return NewMyMachGroupPanelM
|
||||
End Function
|
||||
|
||||
#End Region ' CONSTRUCTOR
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Public Shared Function LoadMyMachGroups(MachineList As List(Of Machine)) As List(Of MachGroupM)
|
||||
Dim TempList As New List(Of MachGroupM)
|
||||
' Carico i gruppi di lavorazione nella lista
|
||||
Dim nId = EgtGetFirstMachGroup()
|
||||
While nId <> GDB_ID.NULL
|
||||
EgtSetCurrMachGroup(nId)
|
||||
Dim sName As String = String.Empty
|
||||
Dim sMachine As String = String.Empty
|
||||
EgtGetMachGroupName(nId, sName)
|
||||
EgtGetMachGroupMachineName(nId, sMachine)
|
||||
' cerco la macchina tra quelle presenti
|
||||
Dim UsedMachine As MyMachine = Nothing
|
||||
Dim bOk As Boolean = Machine.SearchMachine(sMachine, MachineList, UsedMachine)
|
||||
If Not bOk OrElse UsedMachine.nType = MachineType.NULL Then
|
||||
EgtOutLog("Machine incompatible with beam & wall machining!!")
|
||||
ElseIf UsedMachine.nType = MachineType.BEAM Then
|
||||
TempList.Add(BeamMachGroupM.CreateBeamMachGroup(nId, sName, sMachine))
|
||||
ElseIf UsedMachine.nType = MachineType.WALL Then
|
||||
TempList.Add(WallMachGroupM.CreateWallMachGroup(nId, sName, sMachine))
|
||||
End If
|
||||
nId = EgtGetNextMachGroup(nId)
|
||||
End While
|
||||
EgtResetCurrMachGroup()
|
||||
Return TempList
|
||||
End Function
|
||||
|
||||
' funzione che aggiunge solo i gruppi di lavorazione creati nel nesting
|
||||
Public Shared Function UpdateFromNestingMyMachGroups(MachineList As List(Of Machine)) As List(Of MachGroupM)
|
||||
Dim TempList As New List(Of MachGroupM)
|
||||
' Carico i gruppi di lavorazione nella lista
|
||||
Dim nId = EgtGetFirstMachGroup()
|
||||
While nId <> GDB_ID.NULL
|
||||
Dim UpdateUI As Integer = 0
|
||||
If EgtGetInfo(nId, "UPDATEUI", UpdateUI) AndAlso UpdateUI = 1 Then
|
||||
EgtSetCurrMachGroup(nId)
|
||||
Dim sName As String = String.Empty
|
||||
Dim sMachine As String = String.Empty
|
||||
EgtGetMachGroupName(nId, sName)
|
||||
EgtGetMachGroupMachineName(nId, sMachine)
|
||||
' cerco la macchina tra quelle presenti
|
||||
Dim UsedMachine As MyMachine = Nothing
|
||||
Dim bOk As Boolean = Machine.SearchMachine(sMachine, MachineList, UsedMachine)
|
||||
If Not bOk OrElse UsedMachine.nType = MachineType.NULL Then
|
||||
EgtOutLog("Machine incompatible with beam & wall machining!!")
|
||||
ElseIf UsedMachine.nType = MachineType.BEAM Then
|
||||
TempList.Add(BeamMachGroupM.CreateBeamMachGroup(nId, sName, sMachine))
|
||||
ElseIf UsedMachine.nType = MachineType.WALL Then
|
||||
TempList.Add(WallMachGroupM.CreateWallMachGroup(nId, sName, sMachine))
|
||||
End If
|
||||
' rimuovo info
|
||||
EgtRemoveInfo(nId, "UPDATEUI")
|
||||
End If
|
||||
nId = EgtGetNextMachGroup(nId)
|
||||
End While
|
||||
EgtResetCurrMachGroup()
|
||||
Return TempList
|
||||
End Function
|
||||
|
||||
Public Function NewMyMachGroup(sMachName As String, nMachineType As MachineType) As MachGroupM
|
||||
' Sistemazioni preliminari
|
||||
OnPreNewMachGroup()
|
||||
' Se non ci sono macchine disponibili esco con errore
|
||||
If m_MachineList.Count <= 0 Then Return Nothing
|
||||
' Creo il nuovo gruppo di lavorazione con i dati ottenuti a seconda del caso in cui mi trovo
|
||||
Dim MachGroupM As MachGroupM
|
||||
If nMachineType = MachineType.NULL Then
|
||||
EgtOutLog("Machine incompatible with beam & wall machining!!")
|
||||
Return Nothing
|
||||
ElseIf nMachineType = MachineType.BEAM Then
|
||||
MachGroupM = BeamMachGroupM.CreateBeamMachGroup(NewMachGroupID(), sMachName)
|
||||
ElseIf nMachineType = MachineType.WALL Then
|
||||
MachGroupM = WallMachGroupM.CreateWallMachGroup(NewMachGroupID(), sMachName)
|
||||
End If
|
||||
If IsNothing(MachGroupM) Then Return Nothing
|
||||
AddMachGroup(MachGroupM)
|
||||
' Sistemazioni finali
|
||||
m_DefaultMachine = sMachName
|
||||
OnPostNewMachGroup()
|
||||
Return MachGroupM
|
||||
End Function
|
||||
|
||||
Public Overrides Function OnPreNewMachGroup() As Boolean
|
||||
'EgtSetCurrentContext(Map.refSceneHostVM.MainScene.GetCtx())
|
||||
Return True
|
||||
End Function
|
||||
|
||||
' NB: Anche se ho già aggiunto il nuovo gruppo di lavorazione, non l'ho ancora reso corrente (viene fatto dopo), quindi
|
||||
' non posso usare CurrentMachine perchè è ancora impostata quella precedente!!!
|
||||
Public Overrides Function OnPostNewMachGroup() As Boolean
|
||||
' Salvo macchina del gruppo come nuovo default
|
||||
Dim sCurrMachName As String = String.Empty
|
||||
EgtGetCurrMachineName(sCurrMachName)
|
||||
WriteMainPrivateProfileString(S_MACH, K_CURRMACH, sCurrMachName)
|
||||
'' leggo nome attrezzaggio di default
|
||||
'Dim sDefaultSetUpName As String = String.Empty
|
||||
'Dim sMachineIniPath As String = Map.refMainWindowVM.MainWindowM.sMachinesRoot & "\" & sCurrMachName & "\" & sCurrMachName & ".ini"
|
||||
'EgtUILib.GetPrivateProfileString(S_SETUP, K_DEFAULT, "", sDefaultSetUpName, sMachineIniPath)
|
||||
'' se è attiva l'opzione, rendo corrente l'attrezzaggio di default
|
||||
'If Not String.IsNullOrEmpty(sDefaultSetUpName) Then
|
||||
' If Not EgtImportSetup(sDefaultSetUpName) Then
|
||||
' EgtOutLog("Error loading default setup " & sDefaultSetUpName)
|
||||
' MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 9) & " " & sDefaultSetUpName, EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK, MessageBoxImage.Exclamation)
|
||||
' End If
|
||||
'End If
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Public Overrides Function OnPreRemoveCurrMachGroup() As Boolean
|
||||
'EgtSetCurrentContext(Map.refSceneHostVM.MainScene.GetCtx())
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Public Function NewMachGroupID() As Integer
|
||||
Dim nTemp As Integer = 0
|
||||
If Not IsNothing(MachGroupMList) AndAlso MachGroupMList.Count > 0 Then Return MachGroupMList.Select(Of Integer)(Function(x) If(Integer.TryParse(x.Name, nTemp), nTemp, 0)).Max() + 1
|
||||
Return 1
|
||||
End Function
|
||||
|
||||
' funzione che fa l'update di tutte le copie dei pezzi modificati
|
||||
Public Shared Sub UpdateDuplo()
|
||||
Dim nPartId As Integer = EgtGetFirstPart()
|
||||
While nPartId <> GDB_ID.NULL
|
||||
Dim bIsModified As Boolean = False
|
||||
If EgtDuploGetModified(nPartId, bIsModified) AndAlso bIsModified Then
|
||||
EgtDuploUpdate(nPartId)
|
||||
End If
|
||||
nPartId = EgtGetNextPart(nPartId)
|
||||
End While
|
||||
End Sub
|
||||
|
||||
' funzione che cancella tutti i pezzi segnati da eliminare
|
||||
Public Shared Sub DeleteDuplo()
|
||||
' reset necessario per poter accedere direttamente al grezzo dalle info pezzo e al MachGroup tramite la gerarchia Db geometrico
|
||||
EgtResetCurrMachGroup()
|
||||
Dim nPartId As Integer = EgtGetFirstPart()
|
||||
While nPartId <> GDB_ID.NULL
|
||||
Dim bIsToDelete As Boolean = False
|
||||
If DuploGetToDelete(nPartId, bIsToDelete) AndAlso bIsToDelete Then
|
||||
' verifico se ci sono copie
|
||||
Dim nDuploCount As Integer = 0
|
||||
EgtDuploCount(nPartId, nDuploCount)
|
||||
Dim DuploList As New List(Of Integer)
|
||||
If nDuploCount > 0 AndAlso EgtDuploList(nPartId, DuploList) Then
|
||||
' cancello tutti i pezzi copia nelle barre
|
||||
For Each nDuploId In DuploList
|
||||
' recupero grezzo cui appartiene
|
||||
Dim nRawPartId As Integer
|
||||
EgtGetInfo(nDuploId, "!LST", nRawPartId)
|
||||
' recupero gruppo di lavorazione
|
||||
Dim nMachGroupId As Integer = EgtGetParent(EgtGetParent(EgtGetParent(nRawPartId)))
|
||||
' lo setto come corrente
|
||||
EgtSetCurrMachGroup(nMachGroupId)
|
||||
' elimino pezzo copia
|
||||
EgtRemovePartFromRawPart(nDuploId)
|
||||
EgtErase(nDuploId)
|
||||
'' recupero gruppo di lavorazione e trave dell'interfaccia
|
||||
'Dim BeamMachGroup As BeamMachGroupM = MachGroupMList.FirstOrDefault(Function(x) x.Id = nMachGroupId)
|
||||
'Dim Beam As BeamM = BeamMachGroup.PartMList.FirstOrDefault(Function(x) x.nPartId = nDuploId)
|
||||
'EgtSetCurrMachGroup(BeamMachGroup.Id)
|
||||
'''Beam.DeletePart()
|
||||
Next
|
||||
End If
|
||||
DuploResetToDelete(nPartId)
|
||||
End If
|
||||
nPartId = EgtGetNextPart(nPartId)
|
||||
End While
|
||||
EgtResetCurrMachGroup()
|
||||
End Sub
|
||||
|
||||
Friend Shared Function DuploGetToDelete(nSouId As Integer, ByRef bToDelete As Boolean) As Boolean
|
||||
If IsNothing(nSouId) Then Return False
|
||||
Return EgtGetInfo(nSouId, DUPLO_TODELETE, bToDelete)
|
||||
End Function
|
||||
|
||||
Public Shared Function DuploSetToDelete(nSouId As Integer) As Boolean
|
||||
If IsNothing(nSouId) Then Return False
|
||||
Return EgtSetInfo(nSouId, DUPLO_TODELETE, True)
|
||||
End Function
|
||||
|
||||
Private Shared Function DuploResetToDelete(nSouId As Integer) As Boolean
|
||||
If IsNothing(nSouId) Then Return False
|
||||
Return EgtSetInfo(nSouId, DUPLO_TODELETE, "")
|
||||
End Function
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,126 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.Collections.Specialized
|
||||
Imports System.ComponentModel
|
||||
Imports System.IO
|
||||
Imports EgtBEAMWALL.Core
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class BeamMachGroupVM
|
||||
Inherits MyMachGroupVM
|
||||
|
||||
Public ReadOnly Property m_BeamMachGroupM As BeamMachGroupM
|
||||
Get
|
||||
Return m_MachGroupM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Overridable Property sStartCut As String
|
||||
Get
|
||||
Return LenToString(m_BeamMachGroupM.dStartCut, 3)
|
||||
End Get
|
||||
Set(value As String)
|
||||
StringToLen(value, m_BeamMachGroupM.dStartCut)
|
||||
End Set
|
||||
End Property
|
||||
Public Property dStartCut As Double
|
||||
Get
|
||||
Return m_BeamMachGroupM.dStartCut
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_BeamMachGroupM.dStartCut = value
|
||||
NotifyPropertyChanged(NameOf(sStartCut))
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property SelBeam As BeamVM
|
||||
Get
|
||||
Return m_SelPart
|
||||
End Get
|
||||
Set(value As BeamVM)
|
||||
m_SelPart = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#Region "CONSTRUCTORS"
|
||||
|
||||
Sub New(BeamMachGroupM As BeamMachGroupM)
|
||||
MyBase.New(BeamMachGroupM)
|
||||
AddHandler m_BeamMachGroupM.PartAdded, AddressOf OnBeamAdded
|
||||
AddHandler m_BeamMachGroupM.PartRemoved, AddressOf OnBeamRemoved
|
||||
CreateBeamVMList()
|
||||
' Aggiorno stato da stati feature
|
||||
CalcGlobalUpdate()
|
||||
NotifyPropertyChanged(NameOf(CALC_FALL_Visibility))
|
||||
End Sub
|
||||
|
||||
#End Region ' CONSTRUCTORS
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Private Sub CreateBeamVMList()
|
||||
Dim all As List(Of BeamVM) = (From BeamM In m_BeamMachGroupM.GetParts()
|
||||
Select New BeamVM(BeamM, Me)).ToList()
|
||||
|
||||
For Each BeamVM As BeamVM In all
|
||||
AddHandler BeamVM.PropertyChanged, AddressOf OnBeamVMPropertyChanged
|
||||
Next
|
||||
|
||||
m_PartVMList = New ObservableCollection(Of PartVM)(all)
|
||||
AddHandler m_PartVMList.CollectionChanged, AddressOf OnBeamVMListChanged
|
||||
End Sub
|
||||
|
||||
Public Overrides Sub RefreshPartList()
|
||||
End Sub
|
||||
|
||||
Public Overrides Sub RefreshGroupData()
|
||||
End Sub
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
#Region "COMMANDS"
|
||||
|
||||
#End Region ' COMMANDS
|
||||
|
||||
#Region "EVENTS"
|
||||
|
||||
Private Sub OnBeamAdded(sender As Object, e As PartAddedEventArgs)
|
||||
Dim BeamVM As BeamVM = New BeamVM(e.NewPart, Me)
|
||||
PartVMList.Add(BeamVM)
|
||||
End Sub
|
||||
Private Sub OnBeamRemoved(sender As Object, e As PartAddedEventArgs)
|
||||
Dim BeamVM As BeamVM = PartVMList.FirstOrDefault(Function(x) x.PartM Is e.m_NewPart)
|
||||
If Not IsNothing(BeamVM) Then PartVMList.Remove(BeamVM)
|
||||
End Sub
|
||||
|
||||
Private Sub OnBeamVMListChanged(sender As Object, e As NotifyCollectionChangedEventArgs)
|
||||
If e.Action = NotifyCollectionChangedAction.Add Then
|
||||
If Not IsNothing(e.NewItems) AndAlso e.NewItems.Count > 0 Then
|
||||
For Each BeamVM As BeamVM In e.NewItems
|
||||
AddHandler BeamVM.PropertyChanged, AddressOf OnBeamVMPropertyChanged
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
If e.Action = NotifyCollectionChangedAction.Remove Then
|
||||
If Not IsNothing(e.OldItems) AndAlso e.OldItems.Count > 0 Then
|
||||
For Each BeamVM As BeamVM In e.OldItems
|
||||
RemoveHandler BeamVM.PropertyChanged, AddressOf OnBeamVMPropertyChanged
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
If e.Action = NotifyCollectionChangedAction.Move Then
|
||||
Dim ItemVM As PartVM = e.OldItems(0)
|
||||
m_BeamMachGroupM.PartMList.RemoveAt(e.OldStartingIndex)
|
||||
m_BeamMachGroupM.PartMList.Insert(e.NewStartingIndex, ItemVM.PartM)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub OnBeamVMPropertyChanged(sender As Object, e As PropertyChangedEventArgs)
|
||||
'Select Case e.PropertyName
|
||||
' Case NameOf(sender.nSelGRP), NameOf(sender.nSelSIDE)
|
||||
'End Select
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,47 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.IO
|
||||
Imports EgtBEAMWALL.Core
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class BeamVM
|
||||
Inherits PartVM
|
||||
|
||||
Public ReadOnly Property m_BeamM As BeamM
|
||||
Get
|
||||
Return m_PartM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Overridable Property sOffset As String
|
||||
Get
|
||||
Return LenToString(m_BeamM.dOffset, 3)
|
||||
End Get
|
||||
Set(value As String)
|
||||
StringToLen(value, m_BeamM.dOffset)
|
||||
End Set
|
||||
End Property
|
||||
Public ReadOnly Property dOffset As Double
|
||||
Get
|
||||
Return m_BeamM.dOffset
|
||||
End Get
|
||||
End Property
|
||||
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Sub New(BeamM As BeamM)
|
||||
MyBase.New(BeamM)
|
||||
End Sub
|
||||
|
||||
Sub New(BeamM As BeamM, ParentMachGroupVM As BeamMachGroupVM)
|
||||
MyBase.New(BeamM, ParentMachGroupVM)
|
||||
End Sub
|
||||
|
||||
#End Region ' CONSTRUCTOR
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,187 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.ComponentModel
|
||||
Imports System.IO
|
||||
Imports EgtBEAMWALL.Core
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class MyMachGroupPanelVM
|
||||
Inherits NewMachGroupPanelVM
|
||||
|
||||
#Region "FIELDS & PROPERTIES"
|
||||
|
||||
Public ReadOnly Property m_MyMachGroupPanelM As MyMachGroupPanelM
|
||||
Get
|
||||
Return m_MachGroupPanelM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sTotMachGroups As String
|
||||
Get
|
||||
Return m_MachGroupVMList.Count()
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sTotVolume As String
|
||||
Get
|
||||
Dim dMMTotVolume As Double = m_MachGroupVMList.Sum(CType(Function(x As MyMachGroupVM) x.dUnitVolume, Func(Of MachGroupVM, Double)))
|
||||
Return If(EgtUiUnitsAreMM(), DoubleToString(dMMTotVolume / 1000000000, 3), DoubleToString(dMMTotVolume * (12 / ONEINCH), 3))
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sTotTime As String
|
||||
Get
|
||||
Return TimeSpan.FromSeconds(m_MachGroupVMList.Sum(CType(Function(x As MyMachGroupVM) x.nCALC_TIME, Func(Of MachGroupVM, Double)))).ToString()
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region ' FIELDS & PROPERTIES
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Sub New(MachGroupPanelM As MachGroupPanelM)
|
||||
MyBase.New(MachGroupPanelM)
|
||||
' Creo riferimento a questa classe in Map
|
||||
CoreMap.SetRefMachGroupPanelVM(Me)
|
||||
End Sub
|
||||
|
||||
#End Region ' CONSTRUCTOR
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Protected Overrides Sub CreateMachGroupVMList()
|
||||
Dim all As New List(Of MachGroupVM)
|
||||
For Each MachGroupM In m_MachGroupPanelM.GetMachGroups()
|
||||
If DirectCast(MachGroupM, MyMachGroupM).nMachineType = MachineType.BEAM Then
|
||||
all.Add(New BeamMachGroupVM(MachGroupM))
|
||||
Else
|
||||
all.Add(New WallMachGroupVM(MachGroupM))
|
||||
End If
|
||||
Next
|
||||
|
||||
For Each MachGroupvM As MachGroupVM In all
|
||||
AddHandler MachGroupvM.PropertyChanged, AddressOf OnMachGroupVMPropertyChanged
|
||||
Next
|
||||
|
||||
MachGroupVMList = New ObservableCollection(Of MachGroupVM)(all)
|
||||
AddHandler MachGroupVMList.CollectionChanged, AddressOf OnMachGroupVMListChanged
|
||||
End Sub
|
||||
|
||||
Public Overrides Function InitMachGroupList(Optional bUseDefaults As Boolean = False) As Boolean
|
||||
' Svuoto precedente lista di MachGroup
|
||||
MachGroupVMList.Clear()
|
||||
' aggiorno copie
|
||||
MyMachGroupPanelM.UpdateDuplo()
|
||||
' verifico se esistono già gruppi di lavorazione o se devo creare il primo
|
||||
Dim bOk As Boolean = False
|
||||
Dim nId = EgtGetFirstMachGroup()
|
||||
If nId <> GDB_ID.NULL Then
|
||||
bOk = EgtSetCurrMachGroup(nId)
|
||||
End If
|
||||
If Not bOk Then Return True
|
||||
' carico lista dei gruppi di lavorazione
|
||||
m_MachGroupPanelM.MachGroupMList = MyMachGroupPanelM.LoadMyMachGroups(CoreMap.refMachinePanelVM.MachineList.ToList())
|
||||
' elimino copie da cancellare
|
||||
MyMachGroupPanelM.DeleteDuplo()
|
||||
If bOk Then SelectedMachGroup = MachGroupVMList(0)
|
||||
EgtZoom(ZM.ALL)
|
||||
Return True
|
||||
End Function
|
||||
|
||||
'Public Overrides Sub AddMachGroup()
|
||||
' Dim MyMachGroupM As MyMachGroupM = m_MyMachGroupPanelM.NewMyMachGroup(CurrentMachine.sMachineName, Map.refProjectVM.BTLStructureVM.nPROJTYPE)
|
||||
' ' e lo seleziono
|
||||
' SelectedMachGroup = MachGroupVMList.FirstOrDefault(Function(x) x.MachGroupM Is MyMachGroupM)
|
||||
'End Sub
|
||||
|
||||
Public Overrides Function OnPreSetCurrMachGroup() As Boolean
|
||||
EgtSetCurrentContext(CoreMap.refSceneHostVM.MainScene.GetCtx())
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Public Overrides Function OnPostSetCurrMachGroup() As Boolean
|
||||
' resetto eventuale selezione pezzo
|
||||
DirectCast(SelectedMachGroup, MyMachGroupVM).SelPart = Nothing
|
||||
' Imposto vista solo tavola
|
||||
EgtSetMachineLook(MCH_LOOK.TAB)
|
||||
Dim View As VT
|
||||
For Each Mach As MyMachine In CoreMap.refMachinePanelVM.MachineList
|
||||
If Mach.Name = SelectedMachGroup.Machine Then
|
||||
If Mach.nType = Core.ConstBeam.MachineType.BEAM Then
|
||||
View = VT.ISO_SW
|
||||
Else
|
||||
View = VT.TOP
|
||||
End If
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
EgtSetView(View, False)
|
||||
EgtZoom(ZM.ALL)
|
||||
Return True
|
||||
End Function
|
||||
|
||||
' funzione che seleziona primo gruppo
|
||||
'Friend Sub SelFirstMachGroup()
|
||||
' If Not IsNothing(Me) AndAlso Not IsNothing(MachGroupVMList) AndAlso MachGroupVMList.Count > 0 Then
|
||||
' SelectedMachGroup = MachGroupVMList(0)
|
||||
' Else
|
||||
' SelectedMachGroup = Nothing
|
||||
' EgtResetCurrMachGroup()
|
||||
' ' nascondo tutti i pezzi
|
||||
' Map.refProjectVM.BTLStructureVM.HideAll()
|
||||
' End If
|
||||
'End Sub
|
||||
|
||||
' funzione che seleziona ultimo gruppo
|
||||
Public Sub SelLastMachGroup()
|
||||
If Not IsNothing(Me) AndAlso Not IsNothing(MachGroupVMList) AndAlso MachGroupVMList.Count > 0 Then
|
||||
SelectedMachGroup = MachGroupVMList(MachGroupVMList.Count - 1)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Function GetLastMachGroup() As MachGroupVM
|
||||
If Not IsNothing(Me) AndAlso Not IsNothing(MachGroupVMList) AndAlso MachGroupVMList.Count > 0 Then
|
||||
Return MachGroupVMList(MachGroupVMList.Count - 1)
|
||||
End If
|
||||
Return Nothing
|
||||
End Function
|
||||
|
||||
' funzione che aggiorna totale tempi a fine calcolo
|
||||
Public Sub CalcGlobalTime()
|
||||
NotifyPropertyChanged(NameOf(sTotTime))
|
||||
End Sub
|
||||
|
||||
' funzione che aggiorna numero gruppi di lavorazione e volume totale
|
||||
Public Sub CalcGlobalUpdate()
|
||||
NotifyPropertyChanged(NameOf(sTotMachGroups))
|
||||
NotifyPropertyChanged(NameOf(sTotVolume))
|
||||
NotifyPropertyChanged(NameOf(sTotTime))
|
||||
End Sub
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
#Region "EVENTS"
|
||||
|
||||
Protected Overrides Sub OnMachGroupAdded(sender As Object, e As MachGroupAddedEventArgs)
|
||||
Dim MachGroupVM As MachGroupVM = Nothing
|
||||
Select Case DirectCast(e.NewMachGroupM, MyMachGroupM).nMachineType
|
||||
Case Core.ConstBeam.MachineType.BEAM
|
||||
MachGroupVM = New BeamMachGroupVM(e.NewMachGroupM)
|
||||
Case Core.ConstBeam.MachineType.WALL
|
||||
MachGroupVM = New WallMachGroupVM(e.NewMachGroupM)
|
||||
Case Core.ConstBeam.MachineType.NULL
|
||||
Return
|
||||
End Select
|
||||
MachGroupVMList.Add(MachGroupVM)
|
||||
NotifyPropertyChanged(NameOf(MachGroupVMList))
|
||||
End Sub
|
||||
|
||||
Protected Overrides Sub OnMachGroupVMPropertyChanged(sender As Object, e As PropertyChangedEventArgs)
|
||||
Select Case e.PropertyName
|
||||
'Case nameof(sender.sMATERIAL)
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
#End Region ' EVENTS
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,422 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.IO
|
||||
Imports System.Windows
|
||||
Imports System.Windows.Input
|
||||
Imports System.Windows.Media
|
||||
Imports EgtBEAMWALL.Core
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public MustInherit Class MyMachGroupVM
|
||||
Inherits MachGroupVM
|
||||
|
||||
Public ReadOnly Property MyMachGroupM As MyMachGroupM
|
||||
Get
|
||||
Return m_MachGroupM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property nMachineType As MachineType
|
||||
Get
|
||||
Return MyMachGroupM.nMachineType
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Property dL As Double
|
||||
Get
|
||||
Return MyMachGroupM.dL
|
||||
End Get
|
||||
Set(value As Double)
|
||||
MyMachGroupM.dL = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property dW As Double
|
||||
Get
|
||||
Return MyMachGroupM.dW
|
||||
End Get
|
||||
Set(value As Double)
|
||||
MyMachGroupM.dW = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property dH As Double
|
||||
Get
|
||||
Return MyMachGroupM.dH
|
||||
End Get
|
||||
Set(value As Double)
|
||||
MyMachGroupM.dH = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property dtStartTime As DateTime
|
||||
Get
|
||||
Return MyMachGroupM.dtStartTime
|
||||
End Get
|
||||
Set(value As DateTime)
|
||||
MyMachGroupM.dtStartTime = value
|
||||
NotifyPropertyChanged(NameOf(Production_Background))
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property dtEndTime As DateTime
|
||||
Get
|
||||
Return MyMachGroupM.dtEndTime
|
||||
End Get
|
||||
Set(value As DateTime)
|
||||
MyMachGroupM.dtEndTime = value
|
||||
NotifyPropertyChanged(NameOf(Production_Background))
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property dUsage As Double
|
||||
Get
|
||||
Return If(MyMachGroupM.dMatForPart > 0 AndAlso MyMachGroupM.dTotMat > 0, MyMachGroupM.dMatForPart / MyMachGroupM.dTotMat * 100, 0)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property dWaste As Double
|
||||
Get
|
||||
Return If(MyMachGroupM.dMatForPart > 0 AndAlso MyMachGroupM.dTotMat > 0, (MyMachGroupM.dTotMat - MyMachGroupM.dMatForPart) / MyMachGroupM.dTotMat * 100, 0)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sUsage As String
|
||||
Get
|
||||
Return DoubleToString(dUsage, 3)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sWaste As String
|
||||
Get
|
||||
Return DoubleToString(dWaste, 3)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Property sMATERIAL As String
|
||||
Get
|
||||
Return MyMachGroupM.sMATERIAL
|
||||
End Get
|
||||
Set(value As String)
|
||||
MyMachGroupM.sMATERIAL = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' lista dei pezzi che sono nel grezzo
|
||||
Protected m_PartVMList As New ObservableCollection(Of PartVM)
|
||||
Public Property PartVMList As ObservableCollection(Of PartVM)
|
||||
Get
|
||||
Return m_PartVMList
|
||||
End Get
|
||||
Set(value As ObservableCollection(Of PartVM))
|
||||
m_PartVMList = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_SelPart As PartVM
|
||||
Public Overridable Property SelPart As PartVM
|
||||
Get
|
||||
Return m_SelPart
|
||||
End Get
|
||||
Set(value As PartVM)
|
||||
m_SelPart = value
|
||||
' seleziono pezzo
|
||||
EgtDeselectAll()
|
||||
If Not IsNothing(value) Then EgtSelectObj(SelPart.nPartId)
|
||||
EgtDraw()
|
||||
NotifyPropertyChanged(NameOf(SelPart))
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property nCALC_ERR As Integer
|
||||
Get
|
||||
Return MyMachGroupM.nCALC_ERR
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property nCALC_FALL As Integer
|
||||
Get
|
||||
Return MyMachGroupM.nCALC_FALL
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sCALC_MSG As String
|
||||
Get
|
||||
Return MyMachGroupM.sCALC_MSG
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Property nCALC_ROT As Integer
|
||||
Get
|
||||
Return MyMachGroupM.nCALC_ROT
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
MyMachGroupM.nCALC_ROT = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property nCALC_TIME As Integer
|
||||
Get
|
||||
Return MyMachGroupM.nCALC_TIME
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
MyMachGroupM.nCALC_TIME = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property nGlobalState As CalcStates
|
||||
Get
|
||||
Return MyMachGroupM.nCALC_GlobalState
|
||||
End Get
|
||||
Set(value As CalcStates)
|
||||
MyMachGroupM.nCALC_GlobalState = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property nCALC_State As CalcStates
|
||||
Get
|
||||
Return MyMachGroupM.nCALC_State
|
||||
End Get
|
||||
Set(value As CalcStates)
|
||||
MyMachGroupM.nCALC_State = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Calc_Background As SolidColorBrush
|
||||
Get
|
||||
If MyMachGroupM.nCALC_GlobalState = CalcStates.OK Then
|
||||
Return Brushes.Green
|
||||
ElseIf MyMachGroupM.nCALC_GlobalState = CalcStates.NOTCALCULATED Then
|
||||
Return Brushes.LightGray
|
||||
ElseIf MyMachGroupM.nCALC_GlobalState = CalcStates.INFO Then
|
||||
Return Brushes.Green
|
||||
ElseIf MyMachGroupM.nCALC_GlobalState = CalcStates.WARNING Then
|
||||
Return Brushes.Gold
|
||||
ElseIf MyMachGroupM.nCALC_GlobalState = CalcStates.ERROR_ Then
|
||||
Return Brushes.Red
|
||||
Else
|
||||
Return Brushes.Red
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property nProduction_State As Integer
|
||||
Get
|
||||
Return MyMachGroupM.nProductionState
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Overridable ReadOnly Property Production_Background As SolidColorBrush
|
||||
Get
|
||||
If dtEndTime <> DateTime.MinValue Then ' barra finita
|
||||
Return Brushes.LightGray
|
||||
ElseIf dtStartTime <> DateTime.MinValue Then ' barra iniziata
|
||||
Return Brushes.Green
|
||||
Else ' barra in coda
|
||||
Return Brushes.White
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property CALC_ROT_Visibility As Visibility
|
||||
Get
|
||||
Return If(MyMachGroupM.nCALC_ROT <> 0, Visibility.Visible, Visibility.Collapsed)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property CALC_FALL_Visibility As Visibility
|
||||
Get
|
||||
Return If(MyMachGroupM.nCALC_FALL <> 0, Visibility.Visible, Visibility.Collapsed)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property CALC_ERR_Letter As String
|
||||
Get
|
||||
Select Case MyMachGroupM.nCALC_GlobalERR
|
||||
Case 22
|
||||
Return "c"
|
||||
Case 19, 23, 24, 25
|
||||
Return "e"
|
||||
Case 17
|
||||
Return "w"
|
||||
Case < 0
|
||||
Return "i"
|
||||
Case Else
|
||||
Return ""
|
||||
End Select
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property CALC_ERR_Foreground As SolidColorBrush
|
||||
Get
|
||||
Select Case MyMachGroupM.m_nCALC_GlobalState
|
||||
Case CalcStates.ERROR_
|
||||
Return Brushes.Red
|
||||
Case CalcStates.WARNING
|
||||
Return Brushes.Orange
|
||||
Case CalcStates.INFO
|
||||
Return Brushes.Green
|
||||
Case Else
|
||||
Return Brushes.Red
|
||||
End Select
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sUnitTime As String
|
||||
Get
|
||||
Return TimeSpan.FromSeconds(nCALC_TIME).ToString()
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property dUnitVolume As Double
|
||||
Get
|
||||
Return dL * dW * dH
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Section As SectionXMaterial
|
||||
Get
|
||||
Return New SectionXMaterial(dW, dH, dL, MyMachGroupM.sMATERIAL)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
' definizione comandi
|
||||
Private m_cmdDeleteMachGroup As ICommand
|
||||
|
||||
#Region "CONSTRUCTORS"
|
||||
|
||||
Sub New(MyMachGroupM As MyMachGroupM)
|
||||
MyBase.New(MyMachGroupM)
|
||||
'aggiorno lista pezzi
|
||||
RefreshPartList()
|
||||
End Sub
|
||||
|
||||
#End Region ' CONSTRUCTORS
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Public Overridable Function Copy() As MyMachGroupVM
|
||||
Return Nothing
|
||||
End Function
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
Public MustOverride Sub RefreshPartList()
|
||||
|
||||
Public MustOverride Sub RefreshGroupData()
|
||||
|
||||
' funzione che aggiorna lo stato e gli errori dopo calcolo
|
||||
Public Sub CalcMachGroupUpdate(ERR As Integer, ROT As Integer, MSG As String)
|
||||
EgtSetInfo(Id, ITG_PROD_ERR, ERR, True)
|
||||
EgtSetInfo(Id, ITG_PROD_MSG, MSG, True)
|
||||
EgtSetInfo(Id, ITG_PROD_ROT, ROT, True)
|
||||
MyMachGroupM.nCALC_ERR = ERR
|
||||
MyMachGroupM.nCALC_ROT = ROT
|
||||
MyMachGroupM.sCALC_MSG = MSG
|
||||
If ERR = 0 Then
|
||||
nCALC_State = CalcStates.OK
|
||||
ElseIf ERR = 17 Then
|
||||
nCALC_State = CalcStates.WARNING
|
||||
ElseIf ERR > 0 Then
|
||||
nCALC_State = CalcStates.ERROR_
|
||||
ElseIf ERR < 0 Then
|
||||
nCALC_State = CalcStates.INFO
|
||||
End If
|
||||
NotifyPropertyChanged(NameOf(Calc_Background))
|
||||
End Sub
|
||||
|
||||
Public Sub ResetCalcMachGroup()
|
||||
EgtRemoveInfo(Id, ITG_PROD_ERR)
|
||||
EgtRemoveInfo(Id, ITG_PROD_MSG)
|
||||
EgtRemoveInfo(Id, ITG_PROD_ROT)
|
||||
MyMachGroupM.nCALC_GlobalState = CalcStates.NOTCALCULATED
|
||||
MyMachGroupM.nCALC_State = CalcStates.NOTCALCULATED
|
||||
MyMachGroupM.nCALC_GlobalERR = 0
|
||||
MyMachGroupM.nCALC_ERR = 0
|
||||
MyMachGroupM.nCALC_ROT = 0
|
||||
MyMachGroupM.nCALC_FALL = 0
|
||||
MyMachGroupM.sCALC_MSG = ""
|
||||
NotifyPropertyChanged(NameOf(Calc_Background))
|
||||
NotifyPropertyChanged(NameOf(CALC_FALL_Visibility))
|
||||
NotifyPropertyChanged(NameOf(CALC_ROT_Visibility))
|
||||
NotifyPropertyChanged(NameOf(CALC_ERR_Letter))
|
||||
NotifyPropertyChanged(NameOf(CALC_ERR_Foreground))
|
||||
End Sub
|
||||
|
||||
' funzione che aggiorna lo stato e gli errori dopo calcolo
|
||||
Public Sub CalcGlobalUpdate()
|
||||
MyMachGroupM.nCALC_GlobalERR = nCALC_ERR
|
||||
MyMachGroupM.nCALC_GlobalState = nCALC_State
|
||||
For Each Part In MyMachGroupM.PartMList
|
||||
If Part.nCALC_GlobalState = CalcStates.NOTCALCULATED Then
|
||||
MyMachGroupM.nCALC_GlobalState = CalcStates.NOTCALCULATED
|
||||
Exit For
|
||||
ElseIf Part.nCALC_GlobalState = CalcStates.OK AndAlso MyMachGroupM.m_nCALC_GlobalState = Core.CalcStates.NOTCALCULATED Then
|
||||
MyMachGroupM.nCALC_GlobalState = CalcStates.OK
|
||||
ElseIf Part.nCALC_GlobalState = CalcStates.INFO And (MyMachGroupM.nCALC_GlobalState = CalcStates.OK Or MyMachGroupM.nCALC_GlobalState = CalcStates.NOTCALCULATED) Then
|
||||
MyMachGroupM.nCALC_GlobalState = CalcStates.INFO
|
||||
ElseIf Part.nCALC_GlobalState = CalcStates.WARNING And (MyMachGroupM.nCALC_GlobalState = CalcStates.OK Or MyMachGroupM.nCALC_GlobalState = CalcStates.INFO Or MyMachGroupM.nCALC_GlobalState = CalcStates.NOTCALCULATED) Then
|
||||
MyMachGroupM.nCALC_GlobalState = CalcStates.WARNING
|
||||
ElseIf Part.nCALC_GlobalState = CalcStates.ERROR_ And (MyMachGroupM.nCALC_GlobalState = CalcStates.OK Or MyMachGroupM.nCALC_GlobalState = CalcStates.INFO Or MyMachGroupM.nCALC_GlobalState = CalcStates.WARNING Or MyMachGroupM.nCALC_GlobalState = CalcStates.NOTCALCULATED) Then
|
||||
MyMachGroupM.nCALC_GlobalState = CalcStates.ERROR_
|
||||
End If
|
||||
If Part.nCALC_GlobalERR = 22 Then
|
||||
MyMachGroupM.nCALC_GlobalERR = 22
|
||||
ElseIf Part.nCALC_GlobalERR > 0 And MyMachGroupM.nCALC_GlobalERR <= 0 Then
|
||||
MyMachGroupM.nCALC_GlobalERR = Part.nCALC_GlobalERR
|
||||
ElseIf Part.nCALC_GlobalERR < 0 And MyMachGroupM.nCALC_GlobalERR = 0 Then
|
||||
MyMachGroupM.nCALC_GlobalERR = Part.nCALC_GlobalERR
|
||||
End If
|
||||
If Part.nCALC_ROT <> 0 Then
|
||||
MyMachGroupM.m_nCALC_ROT = Part.nCALC_ROT
|
||||
End If
|
||||
If Part.nCALC_FALL <> 0 Then
|
||||
MyMachGroupM.nCALC_FALL = Part.nCALC_FALL
|
||||
End If
|
||||
Next
|
||||
NotifyPropertyChanged(NameOf(Calc_Background))
|
||||
NotifyPropertyChanged(NameOf(CALC_FALL_Visibility))
|
||||
NotifyPropertyChanged(NameOf(CALC_ROT_Visibility))
|
||||
NotifyPropertyChanged(NameOf(CALC_ERR_Letter))
|
||||
NotifyPropertyChanged(NameOf(CALC_ERR_Foreground))
|
||||
End Sub
|
||||
|
||||
Public Sub CalcTimeUpdate(TIME As Integer)
|
||||
EgtSetInfo(Id, ITG_PROD_TIME, TIME, True)
|
||||
nCALC_TIME = TIME
|
||||
NotifyPropertyChanged(NameOf(sUnitTime))
|
||||
End Sub
|
||||
|
||||
#Region "COMMANDS"
|
||||
|
||||
#Region "DeleteMachGroup"
|
||||
|
||||
' Returns a command that manage the MainWindow_Unloaded command
|
||||
Public ReadOnly Property DeleteMachGroup_Command As ICommand
|
||||
Get
|
||||
If m_cmdDeleteMachGroup Is Nothing Then
|
||||
m_cmdDeleteMachGroup = New Command(AddressOf DeleteMachGroup)
|
||||
End If
|
||||
Return m_cmdDeleteMachGroup
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Overridable Sub DeleteMachGroup()
|
||||
' elimino tutte le copie
|
||||
Dim nRawPartId As Integer = EgtGetFirstRawPart()
|
||||
Dim nBeamId As Integer = EgtGetFirstPartInRawPart(nRawPartId)
|
||||
While nRawPartId <> GDB_ID.NULL
|
||||
EgtRemovePartFromRawPart(nBeamId)
|
||||
EgtErase(nBeamId)
|
||||
nRawPartId = EgtGetNextRawPart(nRawPartId)
|
||||
nBeamId = EgtGetFirstPartInRawPart(nRawPartId)
|
||||
End While
|
||||
' elimino MachGroup
|
||||
EgtRemoveMachGroup(Me.Id)
|
||||
End Sub
|
||||
|
||||
#End Region ' DeleteMachGroup
|
||||
|
||||
#End Region ' COMMANDS
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,507 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.Collections.Specialized
|
||||
Imports System.ComponentModel
|
||||
Imports System.IO
|
||||
Imports System.Windows
|
||||
Imports System.Windows.Input
|
||||
Imports System.Windows.Media
|
||||
Imports EgtBEAMWALL.Core
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public MustInherit Class PartVM
|
||||
Inherits VMBase
|
||||
|
||||
#Region "FIELDS & PROPERTIES"
|
||||
|
||||
Protected m_PartM As PartM
|
||||
Public ReadOnly Property PartM As PartM
|
||||
Get
|
||||
Return m_PartM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_ParentMachGroupVM As MyMachGroupVM
|
||||
Public ReadOnly Property ParentMachGroupVM As MyMachGroupVM
|
||||
Get
|
||||
Return m_ParentMachGroupVM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
' Id geometrico del pezzo
|
||||
Public ReadOnly Property nPartId As Integer
|
||||
Get
|
||||
Return m_PartM.nPartId
|
||||
End Get
|
||||
End Property
|
||||
|
||||
' Proj del pezzo
|
||||
Public Property nProjId As Integer
|
||||
Get
|
||||
Return m_PartM.nProjId
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_PartM.nProjId = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' Info del pezzo
|
||||
Public ReadOnly Property nPDN As Integer
|
||||
Get
|
||||
Return m_PartM.nPDN
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sNAM As String
|
||||
Get
|
||||
Return m_PartM.sNAM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sL As String
|
||||
Get
|
||||
Return LenToString(m_PartM.dL, 3)
|
||||
End Get
|
||||
End Property
|
||||
Public Property dL As Double
|
||||
Get
|
||||
Return m_PartM.dL
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_PartM.dL = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sW As String
|
||||
Get
|
||||
Return LenToString(m_PartM.dW, 3)
|
||||
End Get
|
||||
End Property
|
||||
Public Property dW As Double
|
||||
Get
|
||||
Return m_PartM.dW
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_PartM.dW = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sH As String
|
||||
Get
|
||||
Return LenToString(m_PartM.dH, 3)
|
||||
End Get
|
||||
End Property
|
||||
Public Property dH As Double
|
||||
Get
|
||||
Return m_PartM.dH
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_PartM.dH = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Overridable Property sPOSX As String
|
||||
Get
|
||||
Return LenToString(m_PartM.dPOSX, 3)
|
||||
End Get
|
||||
Set(value As String)
|
||||
StringToLen(value, m_PartM.dPOSX)
|
||||
End Set
|
||||
End Property
|
||||
Public Property dPOSX As Double
|
||||
Get
|
||||
Return m_PartM.dPOSX
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_PartM.dPOSX = value
|
||||
NotifyPropertyChanged(NameOf(sPOSX))
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property nCNT As Integer
|
||||
Get
|
||||
Return m_PartM.nCNT
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_PartM.nCNT = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sINVERTED As String
|
||||
Get
|
||||
Return m_PartM.nINVERTED & "°"
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sROTATED As String
|
||||
Get
|
||||
Return m_PartM.nROTATED & "°"
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Property sMATERIAL As String
|
||||
Get
|
||||
Return m_PartM.sMATERIAL
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_PartM.sMATERIAL = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property nGlobalState As CalcStates
|
||||
Get
|
||||
Return m_PartM.nCALC_GlobalState
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Property nCALC_GlobalERR As Integer
|
||||
Get
|
||||
Return m_PartM.nCALC_GlobalERR
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_PartM.nCALC_GlobalERR = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property nCALC_State As CalcStates
|
||||
Get
|
||||
Return m_PartM.nCALC_State
|
||||
End Get
|
||||
Set(value As CalcStates)
|
||||
m_PartM.nCALC_State = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Calc_Background As SolidColorBrush
|
||||
Get
|
||||
If m_PartM.nCALC_GlobalState = CalcStates.OK Then
|
||||
Return Brushes.Green
|
||||
ElseIf m_PartM.nCALC_GlobalState = CalcStates.NOTCALCULATED Then
|
||||
Return Brushes.LightGray
|
||||
ElseIf m_PartM.nCALC_GlobalState = CalcStates.INFO Then
|
||||
Return Brushes.Green
|
||||
ElseIf m_PartM.nCALC_GlobalState = CalcStates.WARNING Then
|
||||
Return Brushes.Orange
|
||||
ElseIf m_PartM.nCALC_GlobalState = CalcStates.ERROR_ Then
|
||||
Return Brushes.Red
|
||||
Else
|
||||
Return Brushes.Red
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Property nProduction_State As CalcStates
|
||||
Get
|
||||
Return m_PartM.nProductionState
|
||||
End Get
|
||||
Set(value As CalcStates)
|
||||
m_PartM.SetProductionState(value)
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Production_Background As SolidColorBrush
|
||||
Get
|
||||
If dtEndTime <> DateTime.MinValue Then ' barra finita
|
||||
Return Brushes.LightGray
|
||||
ElseIf dtStartTime <> DateTime.MinValue Then ' barra iniziata
|
||||
Return Brushes.Green
|
||||
Else ' barra in coda
|
||||
Return Brushes.White
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property CALC_ROT_Visibility As Visibility
|
||||
Get
|
||||
Return If(m_PartM.nCALC_ROT <> 0, Visibility.Visible, Visibility.Collapsed)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property CALC_FALL_Visibility As Visibility
|
||||
Get
|
||||
Return If(m_PartM.nCALC_FALL <> 0, Visibility.Visible, Visibility.Collapsed)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property CALC_ERR_Letter As String
|
||||
Get
|
||||
Select Case m_PartM.nCALC_GlobalERR
|
||||
Case 22
|
||||
Return "c"
|
||||
Case 19, 23, 24, 25
|
||||
Return "e"
|
||||
Case 17
|
||||
Return "w"
|
||||
Case < 0
|
||||
Return "i"
|
||||
Case Else
|
||||
Return ""
|
||||
End Select
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property CALC_ERR_Foreground As SolidColorBrush
|
||||
Get
|
||||
Select Case m_PartM.nCALC_GlobalState
|
||||
Case CalcStates.ERROR_
|
||||
Return Brushes.Red
|
||||
Case CalcStates.WARNING
|
||||
Return Brushes.Orange
|
||||
Case CalcStates.INFO
|
||||
Return Brushes.Green
|
||||
Case Else
|
||||
Return Brushes.Red
|
||||
End Select
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property nCALC_ERR As Integer
|
||||
Get
|
||||
Return m_PartM.nCALC_ERR
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sCALC_MSG As String
|
||||
Get
|
||||
Return m_PartM.sCALC_MSG
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Property nCALC_ROT As Integer
|
||||
Get
|
||||
Return m_PartM.nCALC_ROT
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_PartM.nCALC_ROT = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property nCALC_FALL As Integer
|
||||
Get
|
||||
Return m_PartM.nCALC_FALL
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_PartM.nCALC_FALL = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property nCALC_TIME As Integer
|
||||
Get
|
||||
Return m_PartM.nCALC_TIME
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_PartM.nCALC_TIME = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' lista delle feature del pezzo
|
||||
Protected m_FeatureVMList As ObservableCollection(Of BTLFeatureVM)
|
||||
Public Property FeatureVMList As ObservableCollection(Of BTLFeatureVM)
|
||||
Get
|
||||
Return m_FeatureVMList
|
||||
End Get
|
||||
Set(value As ObservableCollection(Of BTLFeatureVM))
|
||||
m_FeatureVMList = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_SelFeatureVM As BTLFeatureVM
|
||||
Public Property SelFeatureVM As BTLFeatureVM
|
||||
Get
|
||||
Return m_SelFeatureVM
|
||||
End Get
|
||||
Set(value As BTLFeatureVM)
|
||||
m_SelFeatureVM = value
|
||||
If Not IsNothing(m_SelFeatureVM) Then
|
||||
DirectCast(m_SelFeatureVM, BTLFeatureVM).SelGeomFeature()
|
||||
Else
|
||||
EgtDeselectAll()
|
||||
End If
|
||||
EgtDraw()
|
||||
NotifyPropertyChanged(NameOf(SelFeatureVM))
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property dtStartTime As DateTime
|
||||
Get
|
||||
Return m_PartM.dtStartTime
|
||||
End Get
|
||||
Set(value As DateTime)
|
||||
m_PartM.dtStartTime = value
|
||||
NotifyPropertyChanged(NameOf(Production_Background))
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property dtEndTime As DateTime
|
||||
Get
|
||||
Return m_PartM.dtEndTime
|
||||
End Get
|
||||
Set(value As DateTime)
|
||||
m_PartM.dtEndTime = value
|
||||
NotifyPropertyChanged(NameOf(Production_Background))
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' definizione comandi
|
||||
Private m_cmdDeletePart As ICommand
|
||||
|
||||
#End Region ' FIELDS & PROPERTIES
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Sub New(PartM As PartM)
|
||||
m_PartM = PartM
|
||||
AddHandler m_PartM.BTLFeatureAdded, AddressOf OnBTLFeatureAdded
|
||||
CreateBTLFeatureVMList()
|
||||
End Sub
|
||||
|
||||
Sub New(PartM As PartM, ParentMachGroupVM As MyMachGroupVM)
|
||||
m_PartM = PartM
|
||||
m_ParentMachGroupVM = ParentMachGroupVM
|
||||
AddHandler m_PartM.BTLFeatureAdded, AddressOf OnBTLFeatureAdded
|
||||
CreateBTLFeatureVMList()
|
||||
' Aggiorno stato da stati feature
|
||||
CalcGlobalUpdate()
|
||||
NotifyPropertyChanged(NameOf(CALC_FALL_Visibility))
|
||||
End Sub
|
||||
|
||||
#End Region ' CONSTRUCTOR
|
||||
|
||||
Private Sub CreateBTLFeatureVMList()
|
||||
Dim all As List(Of BTLFeatureVM) = (From BTLFeatureM In m_PartM.GetBTLFeatures()
|
||||
Select New BTLFeatureVM(BTLFeatureM)).ToList()
|
||||
|
||||
For Each BTLFeatureVM As BTLFeatureVM In all
|
||||
AddHandler BTLFeatureVM.PropertyChanged, AddressOf OnBTLFeatureVMPropertyChanged
|
||||
Next
|
||||
|
||||
m_FeatureVMList = New ObservableCollection(Of BTLFeatureVM)(all)
|
||||
AddHandler m_FeatureVMList.CollectionChanged, AddressOf OnBTLFeatureVMListChanged
|
||||
End Sub
|
||||
|
||||
' funzione che aggiorna lo stato e gli errori dopo calcolo
|
||||
Public Sub CalcPartUpdate(ERR As Integer, ROT As Integer, MSG As String)
|
||||
EgtSetInfo(nPartId, ITG_PROD_ERR, ERR, True)
|
||||
EgtSetInfo(nPartId, ITG_PROD_MSG, MSG, True)
|
||||
EgtSetInfo(nPartId, ITG_PROD_ROT, ROT, True)
|
||||
m_PartM.nCALC_ERR = ERR
|
||||
m_PartM.nCALC_ROT = ROT
|
||||
m_PartM.sCALC_MSG = MSG
|
||||
If ERR = 0 Then
|
||||
nCALC_State = CalcStates.OK
|
||||
ElseIf ERR = 17 Then
|
||||
nCALC_State = CalcStates.WARNING
|
||||
ElseIf ERR > 0 Then
|
||||
nCALC_State = CalcStates.ERROR_
|
||||
ElseIf ERR < 0 Then
|
||||
nCALC_State = CalcStates.INFO
|
||||
End If
|
||||
NotifyPropertyChanged(NameOf(Calc_Background))
|
||||
End Sub
|
||||
|
||||
Public Sub ResetCalcPart()
|
||||
EgtRemoveInfo(nPartId, ITG_PROD_ERR)
|
||||
EgtRemoveInfo(nPartId, ITG_PROD_MSG)
|
||||
EgtRemoveInfo(nPartId, ITG_PROD_ROT)
|
||||
EgtRemoveInfo(nPartId, ITG_PROD_FALL)
|
||||
m_PartM.nCALC_GlobalState = CalcStates.NOTCALCULATED
|
||||
m_PartM.nCALC_State = CalcStates.NOTCALCULATED
|
||||
m_PartM.nCALC_GlobalERR = 0
|
||||
m_PartM.nCALC_ERR = 0
|
||||
m_PartM.nCALC_ROT = 0
|
||||
m_PartM.nCALC_FALL = 0
|
||||
m_PartM.sCALC_MSG = ""
|
||||
NotifyPropertyChanged(NameOf(Calc_Background))
|
||||
NotifyPropertyChanged(NameOf(CALC_FALL_Visibility))
|
||||
NotifyPropertyChanged(NameOf(CALC_ROT_Visibility))
|
||||
NotifyPropertyChanged(NameOf(CALC_ERR_Letter))
|
||||
NotifyPropertyChanged(NameOf(CALC_ERR_Foreground))
|
||||
ParentMachGroupVM.ResetCalcMachGroup()
|
||||
End Sub
|
||||
|
||||
Public Sub CalcFallUpdate(FALL As Integer)
|
||||
EgtSetInfo(nPartId, ITG_PROD_FALL, FALL, True)
|
||||
m_PartM.nCALC_FALL = 0
|
||||
NotifyPropertyChanged(NameOf(nCALC_FALL))
|
||||
End Sub
|
||||
|
||||
' funzione che aggiorna lo stato e gli errori dopo calcolo
|
||||
Public Sub CalcGlobalUpdate()
|
||||
m_PartM.nCALC_GlobalState = nCALC_State
|
||||
For Each Feature In FeatureVMList
|
||||
If Not Feature.bDO Then
|
||||
ElseIf Feature.nState = CalcStates.NOTCALCULATED Then
|
||||
m_PartM.nCALC_GlobalState = CalcStates.NOTCALCULATED
|
||||
Exit For
|
||||
ElseIf Feature.nState = CalcStates.INFO And m_PartM.nCALC_GlobalState = CalcStates.OK Then
|
||||
m_PartM.nCALC_GlobalState = CalcStates.INFO
|
||||
ElseIf Feature.nState = CalcStates.WARNING And (m_PartM.nCALC_GlobalState = CalcStates.OK Or m_PartM.nCALC_GlobalState = CalcStates.INFO) Then
|
||||
m_PartM.nCALC_GlobalState = CalcStates.WARNING
|
||||
ElseIf Feature.nState = CalcStates.ERROR_ And (m_PartM.nCALC_GlobalState = CalcStates.OK Or m_PartM.nCALC_GlobalState = CalcStates.INFO Or m_PartM.nCALC_GlobalState = CalcStates.WARNING) Then
|
||||
m_PartM.nCALC_GlobalState = CalcStates.ERROR_
|
||||
End If
|
||||
If Feature.nCALC_ERR = 22 Then
|
||||
m_PartM.nCALC_GlobalERR = 22
|
||||
ElseIf Feature.nCALC_ERR > 0 And m_PartM.nCALC_GlobalERR <= 0 Then
|
||||
m_PartM.nCALC_GlobalERR = Feature.nCALC_ERR
|
||||
ElseIf Feature.nCALC_ERR < 0 And m_PartM.nCALC_GlobalERR = 0 Then
|
||||
m_PartM.nCALC_GlobalERR = Feature.nCALC_ERR
|
||||
End If
|
||||
Next
|
||||
NotifyPropertyChanged(NameOf(Calc_Background))
|
||||
NotifyPropertyChanged(NameOf(CALC_ROT_Visibility))
|
||||
NotifyPropertyChanged(NameOf(CALC_ERR_Letter))
|
||||
NotifyPropertyChanged(NameOf(CALC_ERR_Foreground))
|
||||
End Sub
|
||||
|
||||
#Region "COMMANDS"
|
||||
|
||||
#Region "DeletePart"
|
||||
|
||||
' Returns a command that manage the MainWindow_Unloaded command
|
||||
Public ReadOnly Property DeletePart_Command() As ICommand
|
||||
Get
|
||||
If m_cmdDeletePart Is Nothing Then
|
||||
m_cmdDeletePart = New Command(AddressOf DeletePart)
|
||||
End If
|
||||
Return m_cmdDeletePart
|
||||
End Get
|
||||
End Property
|
||||
|
||||
' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
|
||||
Public Overridable Sub DeletePart()
|
||||
End Sub
|
||||
|
||||
#End Region ' DeletePart
|
||||
|
||||
#End Region ' COMMANDS
|
||||
|
||||
#Region "EVENTS"
|
||||
|
||||
Private Sub OnBTLFeatureAdded(sender As Object, e As BTLFeatureAddedEventArgs)
|
||||
Dim BTLFeatureVM As BTLFeatureVM = New BTLFeatureVM(e.NewBTLFeature)
|
||||
FeatureVMList.Add(BTLFeatureVM)
|
||||
End Sub
|
||||
|
||||
Private Sub OnBTLFeatureVMListChanged(sender As Object, e As NotifyCollectionChangedEventArgs)
|
||||
If Not IsNothing(e.NewItems) AndAlso e.NewItems.Count > 0 Then
|
||||
For Each BTLFeatureVM As BTLFeatureVM In e.NewItems
|
||||
AddHandler BTLFeatureVM.PropertyChanged, AddressOf OnBTLFeatureVMPropertyChanged
|
||||
Next
|
||||
End If
|
||||
If Not IsNothing(e.OldItems) AndAlso e.OldItems.Count > 0 Then
|
||||
For Each BTLFeatureVM As BTLFeatureVM In e.OldItems
|
||||
RemoveHandler BTLFeatureVM.PropertyChanged, AddressOf OnBTLFeatureVMPropertyChanged
|
||||
Next
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub OnBTLFeatureVMPropertyChanged(sender As Object, e As PropertyChangedEventArgs)
|
||||
'Select Case e.PropertyName
|
||||
' Case NameOf(sender.nSelGRP), NameOf(sender.nSelSIDE)
|
||||
'End Select
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,90 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.Collections.Specialized
|
||||
Imports System.ComponentModel
|
||||
Imports System.IO
|
||||
Imports EgtBEAMWALL.Core
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class WallMachGroupVM
|
||||
Inherits MyMachGroupVM
|
||||
|
||||
Public ReadOnly Property m_WallMachGroupM As WallMachGroupM
|
||||
Get
|
||||
Return m_MachGroupM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#Region "CONSTRUCTORS"
|
||||
|
||||
Sub New(WallMachGroupM As WallMachGroupM)
|
||||
MyBase.New(WallMachGroupM)
|
||||
AddHandler m_WallMachGroupM.PartAdded, AddressOf OnWallAdded
|
||||
AddHandler m_WallMachGroupM.PartRemoved, AddressOf OnWallRemoved
|
||||
CreateWallVMList()
|
||||
' Aggiorno stato da stati feature
|
||||
CalcGlobalUpdate()
|
||||
NotifyPropertyChanged(NameOf(CALC_FALL_Visibility))
|
||||
End Sub
|
||||
|
||||
#End Region ' CONSTRUCTORS
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Private Sub CreateWallVMList()
|
||||
Dim all As List(Of WallVM) = (From WallM In m_WallMachGroupM.GetParts()
|
||||
Select New WallVM(WallM, Me)).ToList()
|
||||
|
||||
For Each WallVM As WallVM In all
|
||||
AddHandler WallVM.PropertyChanged, AddressOf OnWallVMPropertyChanged
|
||||
Next
|
||||
|
||||
m_PartVMList = New ObservableCollection(Of PartVM)(all)
|
||||
AddHandler m_PartVMList.CollectionChanged, AddressOf OnWallVMListChanged
|
||||
End Sub
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
Public Overrides Sub RefreshPartList()
|
||||
End Sub
|
||||
|
||||
Public Overrides Sub RefreshGroupData()
|
||||
End Sub
|
||||
|
||||
#Region "COMMANDS"
|
||||
|
||||
#End Region ' COMMANDS
|
||||
|
||||
#Region "EVENTS"
|
||||
|
||||
Private Sub OnWallAdded(sender As Object, e As PartAddedEventArgs)
|
||||
Dim WallVM As WallVM = New WallVM(e.NewPart, Me)
|
||||
PartVMList.Add(WallVM)
|
||||
End Sub
|
||||
Private Sub OnWallRemoved(sender As Object, e As PartAddedEventArgs)
|
||||
Dim WallVM As WallVM = PartVMList.FirstOrDefault(Function(x) x.PartM Is e.m_NewPart)
|
||||
If Not IsNothing(WallVM) Then PartVMList.Remove(WallVM)
|
||||
End Sub
|
||||
|
||||
Private Sub OnWallVMListChanged(sender As Object, e As NotifyCollectionChangedEventArgs)
|
||||
If Not IsNothing(e.NewItems) AndAlso e.NewItems.Count > 0 Then
|
||||
For Each WallVM As WallVM In e.NewItems
|
||||
AddHandler WallVM.PropertyChanged, AddressOf OnWallVMPropertyChanged
|
||||
Next
|
||||
End If
|
||||
If Not IsNothing(e.OldItems) AndAlso e.OldItems.Count > 0 Then
|
||||
For Each WallVM As WallVM In e.OldItems
|
||||
RemoveHandler WallVM.PropertyChanged, AddressOf OnWallVMPropertyChanged
|
||||
Next
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub OnWallVMPropertyChanged(sender As Object, e As PropertyChangedEventArgs)
|
||||
'Select Case e.PropertyName
|
||||
' Case NameOf(sender.nSelGRP), NameOf(sender.nSelSIDE)
|
||||
'End Select
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,69 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.IO
|
||||
Imports System.Windows.Input
|
||||
Imports EgtBEAMWALL.Core
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class WallVM
|
||||
Inherits PartVM
|
||||
|
||||
Public ReadOnly Property m_WallM As WallM
|
||||
Get
|
||||
Return m_PartM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Overrides Property sPOSX As String
|
||||
Get
|
||||
Return LenToString(m_WallM.dPOSX, 3)
|
||||
End Get
|
||||
Set(value As String)
|
||||
StringToLen(value, m_WallM.dPOSX)
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Overridable Property sPOSY As String
|
||||
Get
|
||||
Return LenToString(m_WallM.dPOSY, 3)
|
||||
End Get
|
||||
Set(value As String)
|
||||
StringToLen(value, m_WallM.dPOSY)
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property sROT As String
|
||||
Get
|
||||
Return LenToString(m_WallM.dROT, 3) & "°"
|
||||
End Get
|
||||
Set(value As String)
|
||||
StringToLen(value, m_WallM.dROT)
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Overridable Property bFLIP As Boolean
|
||||
Get
|
||||
Return m_WallM.bFLIP
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_WallM.bFLIP = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Sub New(WallM As WallM, ParentMachGroupVM As WallMachGroupVM)
|
||||
MyBase.New(WallM, ParentMachGroupVM)
|
||||
End Sub
|
||||
|
||||
#End Region ' CONSTRUCTOR
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
#Region "COMMANDS"
|
||||
|
||||
#End Region ' COMMANDS
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,194 @@
|
||||
Public Class MachLog
|
||||
|
||||
#Region "Private Fields"
|
||||
|
||||
Private m_AlarmCode As String
|
||||
Private m_AlarmDateTime As DateTime
|
||||
Private m_AlarmMessage As String
|
||||
Private m_AlarmOperation As Integer
|
||||
Private m_AlarmType As Integer
|
||||
Private m_CommandExecutedCorrectly As Boolean
|
||||
Private m_CommandState As CommandStates
|
||||
Private m_CommandType As LogCommandTypes
|
||||
Private m_Description As String
|
||||
|
||||
Private m_newOpState As Integer
|
||||
|
||||
Private m_ResultType As ResultTypes
|
||||
|
||||
Private m_VarAddress As String
|
||||
|
||||
Private m_VarValue As String
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "Protected Constructors"
|
||||
|
||||
Protected Sub New()
|
||||
m_AlarmCode = ""
|
||||
m_AlarmDateTime = DateTime.MinValue
|
||||
m_AlarmMessage = ""
|
||||
m_AlarmOperation = 0
|
||||
m_AlarmType = 0
|
||||
m_CommandExecutedCorrectly = False
|
||||
m_CommandState = CommandStates.NULL
|
||||
m_CommandType = LogCommandTypes.NULL
|
||||
m_Description = ""
|
||||
m_newOpState = 0
|
||||
m_ResultType = ResultTypes.NULL
|
||||
m_VarAddress = ""
|
||||
m_VarValue = ""
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "Public Properties"
|
||||
|
||||
Public ReadOnly Property AlarmCode As String
|
||||
Get
|
||||
Return m_AlarmCode
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property AlarmDateTime As Date
|
||||
Get
|
||||
Return m_AlarmDateTime
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property AlarmMessage As String
|
||||
Get
|
||||
Return m_AlarmMessage
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property AlarmOperation As Integer
|
||||
Get
|
||||
Return m_AlarmOperation
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property AlarmType As Integer
|
||||
Get
|
||||
Return m_AlarmType
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property CommandExecutedCorrectly As Boolean
|
||||
Get
|
||||
Return m_CommandExecutedCorrectly
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property CommandState As CommandStates
|
||||
Get
|
||||
Return m_CommandState
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property CommandType As LogCommandTypes
|
||||
Get
|
||||
Return m_CommandType
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Description As String
|
||||
Get
|
||||
Return m_Description
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property newOpState As Integer
|
||||
Get
|
||||
Return m_newOpState
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property ResultType As ResultTypes
|
||||
Get
|
||||
Return m_ResultType
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property VarAddress As String
|
||||
Get
|
||||
Return m_VarAddress
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property VarValue As String
|
||||
Get
|
||||
Return m_VarValue
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "Internal Methods"
|
||||
|
||||
Public Shared Function CreateAlarmLog(AlarmOperation As Integer, AlarmType As Integer, AlarmMessage As String, AlarmCode As String, AlarmDateTime As String)
|
||||
Dim NewMachLog As New MachLog
|
||||
NewMachLog.m_CommandType = LogCommandTypes.ALARM
|
||||
NewMachLog.m_AlarmOperation = AlarmOperation
|
||||
NewMachLog.m_AlarmType = AlarmType
|
||||
NewMachLog.m_AlarmMessage = AlarmMessage
|
||||
NewMachLog.m_AlarmCode = AlarmCode
|
||||
DateTime.TryParse(AlarmDateTime, NewMachLog.m_AlarmDateTime)
|
||||
Return NewMachLog
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateOPStateLog(newOpState As Integer)
|
||||
Dim NewMachLog As New MachLog
|
||||
NewMachLog.m_CommandType = LogCommandTypes.NEWOP
|
||||
NewMachLog.m_newOpState = newOpState
|
||||
NewMachLog.m_AlarmDateTime = DateTime.Now()
|
||||
Return NewMachLog
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateReadLog(CommandExecutedCorrectly As Boolean, VarAddress As String, VarValue As String)
|
||||
Dim NewMachLog As New MachLog
|
||||
NewMachLog.m_CommandType = CommandTypes.READ
|
||||
NewMachLog.m_CommandExecutedCorrectly = CommandExecutedCorrectly
|
||||
NewMachLog.m_VarAddress = VarAddress
|
||||
NewMachLog.m_VarValue = VarValue
|
||||
NewMachLog.m_AlarmDateTime = DateTime.Now()
|
||||
Return NewMachLog
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateResultLog(CommandType As LogCommandTypes, CommandState As CommandStates, ResultType As ResultTypes, Description As String)
|
||||
Dim NewMachLog As New MachLog
|
||||
NewMachLog.m_CommandType = CommandType
|
||||
NewMachLog.m_CommandState = CommandState
|
||||
NewMachLog.m_ResultType = ResultType
|
||||
NewMachLog.m_Description = Description
|
||||
NewMachLog.m_AlarmDateTime = DateTime.Now()
|
||||
Return NewMachLog
|
||||
End Function
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "Public Methods"
|
||||
|
||||
Public Shared Function CreateMacLog(AlarmCode As String, AlarmDateTime As Date, AlarmMessage As String, AlarmOperation As Integer, AlarmType As Integer, CommandExecutedCorrectly As Boolean, CommandState As CommandStates, CommandType As LogCommandTypes, Description As String, newOpState As Integer, ResultType As ResultTypes, VarAddress As String, VarValue As String) As MachLog
|
||||
|
||||
Dim NewMachLog As New MachLog
|
||||
NewMachLog.m_AlarmCode = AlarmCode
|
||||
NewMachLog.m_AlarmDateTime = AlarmDateTime
|
||||
NewMachLog.m_AlarmMessage = AlarmMessage
|
||||
NewMachLog.m_AlarmOperation = AlarmOperation
|
||||
NewMachLog.m_AlarmType = AlarmType
|
||||
NewMachLog.m_CommandExecutedCorrectly = CommandExecutedCorrectly
|
||||
NewMachLog.m_CommandState = CommandState
|
||||
NewMachLog.m_CommandType = CommandType
|
||||
NewMachLog.m_Description = Description
|
||||
NewMachLog.m_newOpState = newOpState
|
||||
NewMachLog.m_ResultType = ResultType
|
||||
NewMachLog.m_VarAddress = VarAddress
|
||||
NewMachLog.m_VarValue = VarValue
|
||||
|
||||
Return NewMachLog
|
||||
End Function
|
||||
|
||||
#End Region
|
||||
|
||||
End Class
|
||||
@@ -8,11 +8,15 @@ Imports System.Runtime.InteropServices
|
||||
|
||||
' Review the values of the assembly attributes
|
||||
|
||||
<Assembly: AssemblyTitle("EgtBEAMWALL.Core")>
|
||||
#If DEBUG Then
|
||||
<Assembly: AssemblyTitle("EgtBEAMWALL.Core Debug AnyCPU")>
|
||||
#Else
|
||||
<Assembly: AssemblyTitle("EgtBEAMWALL.Core Release AnyCPU")>
|
||||
#End If
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("")>
|
||||
<Assembly: AssemblyCompany("EgalWare s.r.l.")>
|
||||
<Assembly: AssemblyProduct("EgtBEAMWALL.Core")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2020")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2021 by EgalWare s.r.l.")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
@@ -31,5 +35,5 @@ Imports System.Runtime.InteropServices
|
||||
' by using the '*' as shown below:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.0.0.0")>
|
||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||
<Assembly: AssemblyVersion("2.3.6.2")>
|
||||
<Assembly: AssemblyFileVersion("2.3.6.2")>
|
||||
|
||||
+12
-11
@@ -11,6 +11,7 @@
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
Imports System
|
||||
|
||||
Namespace My.Resources
|
||||
|
||||
@@ -21,20 +22,20 @@ Namespace My.Resources
|
||||
'''<summary>
|
||||
''' A strongly-typed resource class, for looking up localized strings, etc.
|
||||
'''</summary>
|
||||
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
|
||||
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0"), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
|
||||
Friend Module Resources
|
||||
|
||||
|
||||
Private resourceMan As Global.System.Resources.ResourceManager
|
||||
|
||||
|
||||
Private resourceCulture As Global.System.Globalization.CultureInfo
|
||||
|
||||
|
||||
'''<summary>
|
||||
''' Returns the cached ResourceManager instance used by this class.
|
||||
'''</summary>
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
|
||||
Get
|
||||
If Object.ReferenceEquals(resourceMan, Nothing) Then
|
||||
@@ -44,17 +45,17 @@ Namespace My.Resources
|
||||
Return resourceMan
|
||||
End Get
|
||||
End Property
|
||||
|
||||
|
||||
'''<summary>
|
||||
''' Overrides the current thread's CurrentUICulture property for all
|
||||
''' resource lookups using this strongly typed resource class.
|
||||
'''</summary>
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Friend Property Culture() As Global.System.Globalization.CultureInfo
|
||||
Get
|
||||
Return resourceCulture
|
||||
End Get
|
||||
Set(ByVal value As Global.System.Globalization.CultureInfo)
|
||||
Set
|
||||
resourceCulture = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
+25
-25
@@ -13,42 +13,42 @@ Option Explicit On
|
||||
|
||||
|
||||
Namespace My
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0"), _
|
||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0"), _
|
||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Partial Friend NotInheritable Class MySettings
|
||||
Inherits Global.System.Configuration.ApplicationSettingsBase
|
||||
|
||||
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)
|
||||
|
||||
|
||||
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
|
||||
|
||||
#Region "My.Settings Auto-Save Functionality"
|
||||
#If _MyType = "WindowsForms" Then
|
||||
Private Shared addedHandler As Boolean
|
||||
Private Shared addedHandler As Boolean
|
||||
|
||||
Private Shared addedHandlerLockObject As New Object
|
||||
Private Shared addedHandlerLockObject As New Object
|
||||
|
||||
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
|
||||
If My.Application.SaveMySettingsOnExit Then
|
||||
My.Settings.Save()
|
||||
End If
|
||||
End Sub
|
||||
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs)
|
||||
If My.Application.SaveMySettingsOnExit Then
|
||||
My.Settings.Save()
|
||||
End If
|
||||
End Sub
|
||||
#End If
|
||||
#End Region
|
||||
|
||||
|
||||
Public Shared ReadOnly Property [Default]() As MySettings
|
||||
Get
|
||||
|
||||
|
||||
#If _MyType = "WindowsForms" Then
|
||||
If Not addedHandler Then
|
||||
SyncLock addedHandlerLockObject
|
||||
If Not addedHandler Then
|
||||
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
|
||||
addedHandler = True
|
||||
End If
|
||||
End SyncLock
|
||||
End If
|
||||
If Not addedHandler Then
|
||||
SyncLock addedHandlerLockObject
|
||||
If Not addedHandler Then
|
||||
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
|
||||
addedHandler = True
|
||||
End If
|
||||
End SyncLock
|
||||
End If
|
||||
#End If
|
||||
Return defaultInstance
|
||||
End Get
|
||||
|
||||
@@ -1,168 +0,0 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.IO
|
||||
Imports System.Windows.Input
|
||||
Imports System.Windows.Media
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public MustInherit Class MyMachGroup
|
||||
Inherits MachGroup
|
||||
|
||||
Protected m_nMachineType As MachineType
|
||||
Public ReadOnly Property nMachineType As MachineType
|
||||
Get
|
||||
Return m_nMachineType
|
||||
End Get
|
||||
End Property
|
||||
Public Sub SetMachineType(nMachineType As MachineType)
|
||||
m_nMachineType = nMachineType
|
||||
End Sub
|
||||
|
||||
Protected 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
|
||||
|
||||
Protected 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
|
||||
|
||||
Protected m_dH As Double
|
||||
Public Property dH As Double
|
||||
Get
|
||||
Return m_dH
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_dH = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_dMatForPart As Double = 0
|
||||
Protected m_dTotMat As Double = 0
|
||||
Public ReadOnly Property dUsage As Double
|
||||
Get
|
||||
Return If(m_dMatForPart > 0 AndAlso m_dTotMat > 0, m_dMatForPart / m_dTotMat * 100, 0)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property dWaste As Double
|
||||
Get
|
||||
Return If(m_dMatForPart > 0 AndAlso m_dTotMat > 0, (m_dTotMat - m_dMatForPart) / m_dTotMat * 100, 0)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sUsage As String
|
||||
Get
|
||||
Return dUsage & "%"
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sWaste As String
|
||||
Get
|
||||
Return dWaste & "%"
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_sMATERIAL As String
|
||||
Public Property sMATERIAL As String
|
||||
Get
|
||||
Return m_sMATERIAL
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_sMATERIAL = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' lista dei pezzi che sono nel grezzo
|
||||
Private m_PartList As New ObservableCollection(Of Part)
|
||||
Public Property PartList As ObservableCollection(Of Part)
|
||||
Get
|
||||
Return m_PartList
|
||||
End Get
|
||||
Set(value As ObservableCollection(Of Part))
|
||||
m_PartList = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_SelPart As Part
|
||||
Public Overridable Property SelPart As Part
|
||||
Get
|
||||
Return m_SelPart
|
||||
End Get
|
||||
Set(value As Part)
|
||||
m_SelPart = value
|
||||
' seleziono pezzo
|
||||
EgtDeselectAll()
|
||||
If Not IsNothing(value) Then EgtSelectObj(SelPart.nPartId)
|
||||
EgtDraw()
|
||||
NotifyPropertyChanged(NameOf(SelPart))
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_nState As CalcStates = -1
|
||||
Public ReadOnly Property nState As CalcStates
|
||||
Get
|
||||
Return m_nState
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Calc_Background As SolidColorBrush
|
||||
Get
|
||||
If m_nState = 0 Then
|
||||
Return Brushes.Green
|
||||
ElseIf m_nState < 0 Then
|
||||
Return Brushes.LightGray
|
||||
ElseIf m_nState > 0 Then
|
||||
Return Brushes.Red
|
||||
Else
|
||||
Return Brushes.Red
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Sub New(nId As Integer, sName As String, sMachine As String)
|
||||
MyBase.New(nId, sName, sMachine)
|
||||
'aggiorno lista pezzi
|
||||
RefreshPartList()
|
||||
End Sub
|
||||
|
||||
Public MustOverride Sub RefreshPartList()
|
||||
|
||||
Public MustOverride Sub RefreshGroupData()
|
||||
|
||||
Public Overridable Sub DeleteMachGroup()
|
||||
' elimino tutte le copie
|
||||
Dim nRawPartId As Integer = EgtGetFirstRawPart()
|
||||
Dim nBeamId As Integer = EgtGetFirstPartInRawPart(nRawPartId)
|
||||
While nRawPartId <> GDB_ID.NULL
|
||||
EgtRemovePartFromRawPart(nBeamId)
|
||||
EgtErase(nBeamId)
|
||||
nRawPartId = EgtGetNextRawPart(nRawPartId)
|
||||
nBeamId = EgtGetFirstPartInRawPart(nRawPartId)
|
||||
End While
|
||||
' elimino MachGroup
|
||||
EgtRemoveMachGroup(Me.Id)
|
||||
End Sub
|
||||
|
||||
Public Sub CalcMachGroupUpdate()
|
||||
m_nState = CalcStates.OK
|
||||
For Each Part In PartList
|
||||
If Part.nGlobalState > 0 AndAlso m_nState = CalcStates.OK Then
|
||||
m_nState = CalcStates.ERROR_
|
||||
End If
|
||||
Next
|
||||
NotifyPropertyChanged(NameOf(Calc_Background))
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,48 @@
|
||||
Imports System.IO
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class MyMachine
|
||||
Inherits Machine
|
||||
|
||||
Private m_nType As MachineType
|
||||
Public ReadOnly Property nType As MachineType
|
||||
Get
|
||||
Return m_nType
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Sub New(sDirPath As String, sIniPath As String)
|
||||
MyBase.New(sDirPath, sIniPath)
|
||||
' verifico esistenza cartella Beam e Wall per assegnare tipo
|
||||
If Directory.Exists(sDirPath & "/Beam") AndAlso Directory.Exists(sDirPath & "/Wall") Then
|
||||
m_nType = MachineType.BOTH
|
||||
ElseIf Directory.Exists(sDirPath & "/Beam") Then
|
||||
m_nType = MachineType.BEAM
|
||||
ElseIf Directory.Exists(sDirPath & "/Wall") Then
|
||||
m_nType = MachineType.WALL
|
||||
Else
|
||||
m_nType = MachineType.NULL
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Shared Shadows Function MachineListInit(sMachinesRootDir As String, MachineList As IList(Of Machine)) As Boolean
|
||||
' Se direttorio base macchine non definito o non esiste, ritorno
|
||||
If String.IsNullOrWhiteSpace(sMachinesRootDir) OrElse
|
||||
Not Directory.Exists(sMachinesRootDir) Then
|
||||
MachineList = Nothing
|
||||
Return False
|
||||
End If
|
||||
' Cerco le macchine
|
||||
Dim Machines As String() = Directory.GetDirectories(sMachinesRootDir)
|
||||
For i As Integer = 0 To Machines.Count - 1
|
||||
Dim PathIni As String = Machines(i) & "\" & Path.GetFileName(Machines(i)) & ".ini"
|
||||
Dim PathBeam As String = Machines(i) & "\" & "Beam"
|
||||
Dim PathWall As String = Machines(i) & "\" & "Wall"
|
||||
If File.Exists(PathIni) AndAlso (Directory.Exists(PathBeam) OrElse Directory.Exists(PathWall)) Then
|
||||
MachineList.Add(New MyMachine(Machines(i), PathIni))
|
||||
End If
|
||||
Next
|
||||
Return True
|
||||
End Function
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,201 @@
|
||||
<EgtWPFLib5:EgtCustomWindow x:Class="OpenProjectFileDialogV"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
|
||||
xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.Core"
|
||||
Title="{Binding Title}"
|
||||
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
|
||||
WindowStyle="None" ResizeMode="NoResize" TitleBarHeight="30" IsResizable="False"
|
||||
IsMinimizable="False" WindowStartupLocation="CenterScreen" ShowInTaskbar="False"
|
||||
Height="500" Width="500" Topmost="True"
|
||||
DataContext="{Binding RelativeSource={RelativeSource Self}}">
|
||||
|
||||
<EgtWPFLib5:EgtCustomWindow.Resources>
|
||||
<EgtWPFLib5:FileNameConverter x:Key="FileNameConverter"/>
|
||||
</EgtWPFLib5:EgtCustomWindow.Resources>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="5*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel>
|
||||
<Grid Grid.Row="0" Margin="5">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="1*" />
|
||||
<RowDefinition Height="1*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Text="{Binding FilterType_Msg}"
|
||||
Grid.Row="0" Grid.Column="0"
|
||||
Style="{StaticResource OptionTextBlock}"/>
|
||||
<ComboBox ItemsSource="{Binding SearchColumnList}"
|
||||
SelectedItem="{Binding SelSearchColumn}"
|
||||
Width="Auto"
|
||||
Margin="5"
|
||||
Grid.Row="0" Grid.Column="1"
|
||||
Style="{StaticResource FeatureComboBox}"/>
|
||||
<TextBlock Text="{Binding Search_Msg}"
|
||||
Margin="0,5,0,0"
|
||||
Grid.Row="1" Grid.Column="0"
|
||||
Style="{StaticResource OptionTextBlock}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding SearchText}"
|
||||
Margin="5"
|
||||
Grid.Row="1" Grid.Column="1"
|
||||
Visibility="{Binding SearchText_Visibility}"/>
|
||||
<Calendar SelectedDatesChanged="Calendar_SelectedDatesChanged"
|
||||
SelectionMode="MultipleRange"
|
||||
Grid.Row="1" Grid.Column="1"
|
||||
Visibility="{Binding SearchDate_Visibility}"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
||||
<EgtBEAMWALL:EgtDataGrid Grid.Row="1"
|
||||
ItemsSource="{Binding ProjectList}"
|
||||
SelectedItem="{Binding SelProject}"
|
||||
CanUserAddRows="False"
|
||||
AutoGenerateColumns="False"
|
||||
CanUserResizeRows="False"
|
||||
SelectionMode="Single"
|
||||
ScrollViewer.CanContentScroll="True"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
|
||||
Margin="5"
|
||||
BindingColumns="{Binding ProjectColumns}">
|
||||
<DataGrid.Resources>
|
||||
<!-- ProjId -->
|
||||
<DataGridTextColumn x:Key="colPROJID" Binding="{Binding sProjId}">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=DataContext.Id_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OpenProjectFileDialogV}}}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
</DataGridTextColumn>
|
||||
<!-- ProdId -->
|
||||
<DataGridTextColumn x:Key="colPRODID" Binding="{Binding sProdId}">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=DataContext.Id_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OpenProjectFileDialogV}}}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
</DataGridTextColumn>
|
||||
<!-- BTL FileName -->
|
||||
<DataGridTextColumn x:Key="colBTLNAME" Binding="{Binding sBTLFileName}">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=DataContext.BTLFileName_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OpenProjectFileDialogV}}}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
</DataGridTextColumn>
|
||||
<!-- ListName -->
|
||||
<DataGridTextColumn x:Key="colLISTNAME" Binding="{Binding sListName}">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=DataContext.ListName_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OpenProjectFileDialogV}}}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
</DataGridTextColumn>
|
||||
<!-- Exported date -->
|
||||
<DataGridTextColumn x:Key="colEXPDATE" Binding="{Binding dtExportDate}">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=DataContext.ExportDate_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OpenProjectFileDialogV}}}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
</DataGridTextColumn>
|
||||
<!-- Creation date -->
|
||||
<DataGridTextColumn x:Key="colCRTDATE" Binding="{Binding dtCreateDate}">
|
||||
<DataGridTextColumn.Header>
|
||||
<TextBlock Text="{Binding Path=DataContext.CreateDate_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OpenProjectFileDialogV}}}"/>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
<!-- Name (per Prod) -->
|
||||
<DataGridTextColumn x:Key="colNAME" Binding="{Binding sName}">
|
||||
<DataGridTextColumn.Header>
|
||||
<TextBlock Text="{Binding Path=DataContext.Name_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OpenProjectFileDialogV}}}"/>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
<!-- Delete -->
|
||||
<!--
|
||||
<DataGridTemplateColumn x:Key="colDELETE"
|
||||
Width="Auto"
|
||||
IsReadOnly="True">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Button Content="X"
|
||||
Command="{Binding Delete_Command}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>-->
|
||||
</DataGrid.Resources>
|
||||
<!--<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding OpenFileName}"
|
||||
Padding="4,1,4,1">
|
||||
<TextBlock.InputBindings>
|
||||
<MouseBinding MouseAction="LeftDoubleClick"
|
||||
Command="{Binding DataContext.ProjectDoubleClick_Command, RelativeSource={RelativeSource AncestorType={x:Type ListBox}}}"
|
||||
CommandParameter="{Binding nProjId}" />
|
||||
</TextBlock.InputBindings>
|
||||
</TextBlock>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>-->
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="DataGridRow">
|
||||
<EventSetter Event="MouseDoubleClick" Handler="ProjectList_MouseDoubleClick"/>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
</EgtBEAMWALL:EgtDataGrid>
|
||||
|
||||
<!--<ListBox Grid.Row="0"
|
||||
ItemsSource="{Binding ProjectList}"
|
||||
SelectedItem="{Binding SelProject}"
|
||||
Margin="5">
|
||||
-->
|
||||
<!--<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding ProjFileName}"/>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>-->
|
||||
<!--
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
|
||||
<Setter Property="Padding" Value="0"></Setter>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding OpenFileName}"
|
||||
Padding="4,1,4,1">
|
||||
<TextBlock.InputBindings>
|
||||
<MouseBinding MouseAction="LeftDoubleClick"
|
||||
Command="{Binding DataContext.ProjectDoubleClick_Command, RelativeSource={RelativeSource AncestorType={x:Type ListBox}}}"
|
||||
CommandParameter="{Binding nProjId}" />
|
||||
</TextBlock.InputBindings>
|
||||
</TextBlock>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>-->
|
||||
|
||||
|
||||
<UniformGrid Columns="3" Grid.Row="2" Margin="0,0,0,5">
|
||||
<Button IsDefault="True" Name="OpenBtn"
|
||||
Content="{Binding Open_Msg}" Style="{DynamicResource EgtWPFLib5_InputButton}"/>
|
||||
<Button Content="{Binding Delete_Msg}"
|
||||
Command="{Binding Delete_Command}"
|
||||
Style="{DynamicResource EgtWPFLib5_InputButton}"/>
|
||||
<Button IsCancel="True"
|
||||
Content="{Binding Cancel_Msg}"
|
||||
Style="{DynamicResource EgtWPFLib5_InputButton}"/>
|
||||
</UniformGrid>
|
||||
|
||||
</Grid>
|
||||
|
||||
</EgtWPFLib5:EgtCustomWindow>
|
||||
@@ -0,0 +1,63 @@
|
||||
Imports System.ComponentModel
|
||||
Imports System.IO
|
||||
Imports System.Windows
|
||||
Imports System.Windows.Controls
|
||||
Imports System.Windows.Input
|
||||
Imports EgtBEAMWALL.Core.ConstBeam
|
||||
Imports EgtUILib
|
||||
|
||||
Public Class OpenProjectFileDialogV
|
||||
|
||||
Private WithEvents m_OpenProjFileDialogVM As OpenProjectFileDialogVM
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Sub New(Owner As Window, OpenProjFileDialogVM As OpenProjectFileDialogVM)
|
||||
' Funzione che interpreta l'xaml
|
||||
InitializeComponent()
|
||||
Me.Owner = Owner
|
||||
Me.DataContext = OpenProjFileDialogVM
|
||||
' Assegno al riferimento locale al VM il VM preso dal DataContext
|
||||
m_OpenProjFileDialogVM = OpenProjFileDialogVM
|
||||
End Sub
|
||||
|
||||
#End Region ' CONSTRUCTOR
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Public Function EgtShowDialog(ProjectType As ProjectType) As Boolean?
|
||||
m_OpenProjFileDialogVM.Init(ProjectType)
|
||||
' mostro la finestra di dialogo
|
||||
Return Me.ShowDialog()
|
||||
End Function
|
||||
Public Function EgtShowDialog(ProjectType As ProjectType, ProjectList As List(Of ProjectFileVM)) As Boolean?
|
||||
m_OpenProjFileDialogVM.Init(ProjectType, ProjectList)
|
||||
' mostro la finestra di dialogo
|
||||
Return Me.ShowDialog()
|
||||
End Function
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
#Region "EVENTS"
|
||||
|
||||
Private Sub ProjectList_MouseDoubleClick(sender As Object, e As MouseButtonEventArgs)
|
||||
m_OpenProjFileDialogVM.ProjDoubleClick()
|
||||
End Sub
|
||||
|
||||
#End Region ' EVENTS
|
||||
|
||||
Private Sub OpenBtn_Click(sender As Object, e As RoutedEventArgs) Handles OpenBtn.Click
|
||||
DialogResult = m_OpenProjFileDialogVM.VerifySelected()
|
||||
End Sub
|
||||
|
||||
Private Sub CloseWindow(bDialogResult As Boolean) Handles m_OpenProjFileDialogVM.m_CloseWindow
|
||||
Me.DialogResult = bDialogResult
|
||||
End Sub
|
||||
|
||||
Private Sub Calendar_SelectedDatesChanged(sender As Object, e As SelectionChangedEventArgs)
|
||||
Dim cal As System.Windows.Controls.Calendar = sender
|
||||
m_OpenProjFileDialogVM.m_SearchDate = cal.SelectedDates
|
||||
m_OpenProjFileDialogVM.m_ProjectList_View.Refresh()
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,355 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.IO
|
||||
Imports System.Windows
|
||||
Imports System.Windows.Controls
|
||||
Imports System.Windows.Data
|
||||
Imports System.Windows.Input
|
||||
Imports EgtBEAMWALL.Core
|
||||
Imports EgtBEAMWALL.Core.ConstBeam
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public MustInherit Class OpenProjectFileDialogVM
|
||||
Inherits VMBase
|
||||
|
||||
Friend Event m_CloseWindow(bDialogResult As Boolean)
|
||||
|
||||
Protected m_ProjectColumns As New ObservableCollection(Of EgtDataGridColumn)
|
||||
Public Property ProjectColumns As ObservableCollection(Of EgtDataGridColumn)
|
||||
Get
|
||||
Return m_ProjectColumns
|
||||
End Get
|
||||
Set(value As ObservableCollection(Of EgtDataGridColumn))
|
||||
m_ProjectColumns = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_ProjectType As ProjectType
|
||||
|
||||
Protected m_sFilter As String
|
||||
Public Property Filter As String
|
||||
Get
|
||||
Return m_sFilter
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_sFilter = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_sFileNameFilter As Predicate(Of String)
|
||||
Public Property FileNameFilter As Predicate(Of String)
|
||||
Get
|
||||
Return m_sFileNameFilter
|
||||
End Get
|
||||
Set(value As Predicate(Of String))
|
||||
m_sFileNameFilter = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_sExtensions As New List(Of String)
|
||||
Public ReadOnly Property Extensions As List(Of String)
|
||||
Get
|
||||
Return m_sExtensions
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public m_ProjectList_View As CollectionView = Nothing
|
||||
Protected m_ProjectList As New ObservableCollection(Of ProjectFileVM)
|
||||
Public ReadOnly Property ProjectList As ObservableCollection(Of ProjectFileVM)
|
||||
Get
|
||||
Return m_ProjectList
|
||||
End Get
|
||||
'Set(value As List(Of ProjFile))
|
||||
' m_ProjList = value
|
||||
' NotifyPropertyChanged("ProjList")
|
||||
'End Set
|
||||
End Property
|
||||
|
||||
Protected m_SelProject As ProjectFileVM
|
||||
Public Property SelProject As ProjectFileVM
|
||||
Get
|
||||
Return m_SelProject
|
||||
End Get
|
||||
Set(value As ProjectFileVM)
|
||||
m_SelProject = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_FileName As String
|
||||
Public Property FileName As String
|
||||
Get
|
||||
Return m_FileName
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_FileName = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' lista campi per ricerca testuale e con datepicker
|
||||
Protected m_SearchColumnList As New ObservableCollection(Of IdNameStruct)
|
||||
Public ReadOnly Property SearchColumnList As ObservableCollection(Of IdNameStruct)
|
||||
Get
|
||||
Return m_SearchColumnList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_SelSearchColumn As IdNameStruct = Nothing
|
||||
Public Property SelSearchColumn As IdNameStruct
|
||||
Get
|
||||
Return m_SelSearchColumn
|
||||
End Get
|
||||
Set(value As IdNameStruct)
|
||||
' resetto il contenuto della barra di ricerca testuale
|
||||
m_SearchText = ""
|
||||
NotifyPropertyChanged(NameOf(SearchText))
|
||||
' resetto le selezioni sul calendario
|
||||
If Not IsNothing(SearchDate) Then SearchDate.Clear()
|
||||
' setto il Tipo Filtro a NULL e refresho la lista dei progetti (in modo da averli visibili tutti)
|
||||
m_SelSearchColumn = m_SearchColumnList(0)
|
||||
m_ProjectList_View.Refresh()
|
||||
' ora setto il valore scelto come Tipo Filtro
|
||||
m_SelSearchColumn = value
|
||||
Select Case m_SelSearchColumn.Id
|
||||
Case OpenProjFileColumn.ID, OpenProjFileColumn.BTLFILENAME, OpenProjFileColumn.LISTNAME
|
||||
SearchText_Visibility = Visibility.Visible
|
||||
SearchDate_Visibility = Visibility.Collapsed
|
||||
Case OpenProjFileColumn.EXPORTDATE, OpenProjFileColumn.CREATEDATE
|
||||
SearchText_Visibility = Visibility.Collapsed
|
||||
SearchDate_Visibility = Visibility.Visible
|
||||
Case Else
|
||||
SearchText_Visibility = Visibility.Collapsed
|
||||
SearchDate_Visibility = Visibility.Collapsed
|
||||
End Select
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_SearchText As String = ""
|
||||
Public Property SearchText As String
|
||||
Get
|
||||
Return m_SearchText
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_SearchText = value
|
||||
m_ProjectList_View.Refresh()
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Friend m_SearchDate As SelectedDatesCollection = Nothing
|
||||
Public ReadOnly Property SearchDate As SelectedDatesCollection
|
||||
Get
|
||||
Return m_SearchDate
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_SearchText_Visibility As Visibility = Visibility.Collapsed
|
||||
Public Property SearchText_Visibility As Visibility
|
||||
Get
|
||||
Return m_SearchText_Visibility
|
||||
End Get
|
||||
Set(value As Visibility)
|
||||
m_SearchText_Visibility = value
|
||||
NotifyPropertyChanged(NameOf(SearchText_Visibility))
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_SearchDate_Visibility As Visibility = Visibility.Collapsed
|
||||
Public Property SearchDate_Visibility As Visibility
|
||||
Get
|
||||
Return m_SearchDate_Visibility
|
||||
End Get
|
||||
Set(value As Visibility)
|
||||
m_SearchDate_Visibility = value
|
||||
NotifyPropertyChanged(NameOf(SearchDate_Visibility))
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Enum OpenProjFileColumn As Integer
|
||||
NULL = 0
|
||||
ID = 1
|
||||
BTLFILENAME = 2
|
||||
LISTNAME = 3
|
||||
EXPORTDATE = 4
|
||||
CREATEDATE = 5
|
||||
End Enum
|
||||
|
||||
#Region "Messages"
|
||||
|
||||
Public ReadOnly Property FilterType_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61836)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property Search_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61837)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Id_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61815)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property BTLFileName_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61819)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property ListName_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61820)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property ExportDate_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61821)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property CreateDate_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61822)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property Name_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61808)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Open_Msg As String
|
||||
Get
|
||||
Return EgtMsg(30006)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property Delete_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61823)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property Cancel_Msg As String
|
||||
Get
|
||||
Return EgtMsg(30002)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region
|
||||
|
||||
' Definizione comandi
|
||||
Private m_cmdProjectDoubleClick As ICommand
|
||||
Private m_cmdDelete As ICommand
|
||||
|
||||
Public MustOverride Function Init(ProjectType As ProjectType, Optional CurrProjectList As List(Of ProjectFileVM) = Nothing) As Boolean?
|
||||
|
||||
Protected Sub LoadColumns(ProjectType As ProjectType)
|
||||
If ProjectType = ProjectType.PROJ Then
|
||||
' carico le colonne della datagrid
|
||||
GetPrivateProfileColumns(S_OPENPROJFILEDLG_PROJ, ProjectColumns)
|
||||
' carico campi su cui eseguire il filtro di ricerca
|
||||
m_SearchColumnList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(OpenProjFileColumn.NULL, ""),
|
||||
New IdNameStruct(OpenProjFileColumn.ID, Id_Msg),
|
||||
New IdNameStruct(OpenProjFileColumn.BTLFILENAME, BTLFileName_Msg),
|
||||
New IdNameStruct(OpenProjFileColumn.LISTNAME, ListName_Msg),
|
||||
New IdNameStruct(OpenProjFileColumn.EXPORTDATE, ExportDate_Msg),
|
||||
New IdNameStruct(OpenProjFileColumn.CREATEDATE, CreateDate_Msg)})
|
||||
ElseIf ProjectType = ProjectType.PROD Then
|
||||
' carico le colonne della datagrid
|
||||
GetPrivateProfileColumns(S_OPENPROJFILEDLG_PROD, ProjectColumns)
|
||||
' carico campi su cui eseguire il filtro di ricerca
|
||||
m_SearchColumnList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(OpenProjFileColumn.NULL, ""),
|
||||
New IdNameStruct(OpenProjFileColumn.ID, Id_Msg),
|
||||
New IdNameStruct(OpenProjFileColumn.BTLFILENAME, BTLFileName_Msg),
|
||||
New IdNameStruct(OpenProjFileColumn.CREATEDATE, CreateDate_Msg)})
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Friend Function VerifySelected() As Boolean
|
||||
If IsNothing(SelProject) Then Return False
|
||||
Dim AllFilesInDir As IEnumerable(Of String)
|
||||
If m_ProjectType = Core.ConstBeam.ProjectType.PROJ Then
|
||||
' verifico se esiste ProdId
|
||||
AllFilesInDir = IO.Directory.EnumerateFiles(SelProject.sProjDirPath)
|
||||
ElseIf m_ProjectType = Core.ConstBeam.ProjectType.PROD Then
|
||||
AllFilesInDir = IO.Directory.EnumerateFiles(SelProject.sProdDirPath)
|
||||
End If
|
||||
For Each File In AllFilesInDir
|
||||
If Path.GetExtension(File).ToLower() = ".nge" Then
|
||||
Return True
|
||||
End If
|
||||
Next
|
||||
Return False
|
||||
End Function
|
||||
|
||||
Protected Function ProjectFilter(Proj As Object) As Boolean
|
||||
Dim bProjectOk As Boolean = True
|
||||
If m_ProjectType = ProjectType.PROJ Then
|
||||
Dim CurrProj As ProjFileVM = DirectCast(Proj, ProjFileVM)
|
||||
If m_SelSearchColumn.Id <> OpenProjFileColumn.NULL AndAlso (
|
||||
(m_SelSearchColumn.Id = OpenProjFileColumn.EXPORTDATE AndAlso Not SearchDate.Contains(CurrProj.dtExportDate.Date)) OrElse
|
||||
(m_SelSearchColumn.Id = OpenProjFileColumn.CREATEDATE AndAlso Not SearchDate.Contains(CurrProj.dtCreateDate.Date))) Then bProjectOk = False
|
||||
If m_SelSearchColumn.Id <> OpenProjFileColumn.NULL AndAlso m_SearchText <> String.Empty AndAlso (
|
||||
(m_SelSearchColumn.Id = OpenProjFileColumn.ID AndAlso CurrProj.sProjId.ToString.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
|
||||
(m_SelSearchColumn.Id = OpenProjFileColumn.BTLFILENAME AndAlso CurrProj.sBTLFileName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
|
||||
(m_SelSearchColumn.Id = OpenProjFileColumn.LISTNAME AndAlso CurrProj.sListName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) Then bProjectOk = False
|
||||
ElseIf m_ProjectType = ProjectType.PROD Then
|
||||
Dim CurrProj As ProdFileVM = DirectCast(Proj, ProdFileVM)
|
||||
If m_SelSearchColumn.Id <> OpenProjFileColumn.NULL AndAlso (
|
||||
(m_SelSearchColumn.Id = OpenProjFileColumn.CREATEDATE AndAlso Not SearchDate.Contains(CurrProj.dtCreateDate.Date))) Then bProjectOk = False
|
||||
If m_SelSearchColumn.Id <> OpenProjFileColumn.NULL AndAlso m_SearchText <> String.Empty AndAlso (
|
||||
(m_SelSearchColumn.Id = OpenProjFileColumn.ID AndAlso CurrProj.sProdId.ToString.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
|
||||
(m_SelSearchColumn.Id = OpenProjFileColumn.BTLFILENAME AndAlso CurrProj.sBTLFileName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) Then bProjectOk = False
|
||||
End If
|
||||
Return bProjectOk
|
||||
End Function
|
||||
|
||||
#Region "COMMANDS"
|
||||
|
||||
#Region "ProjectDoubleClick"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do New.
|
||||
''' </summary>
|
||||
Public ReadOnly Property ProjectDoubleClick_Command As ICommand
|
||||
Get
|
||||
If m_cmdProjectDoubleClick Is Nothing Then
|
||||
m_cmdProjectDoubleClick = New Command(AddressOf ProjDoubleClick)
|
||||
End If
|
||||
Return m_cmdProjectDoubleClick
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the New. This method is invoked by the NewCommand.
|
||||
''' </summary>
|
||||
Friend Sub ProjDoubleClick()
|
||||
If VerifySelected() Then
|
||||
RaiseEvent m_CloseWindow(True)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region ' ProjectDoubleClick
|
||||
|
||||
#Region "Delete"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do New.
|
||||
''' </summary>
|
||||
Public ReadOnly Property Delete_Command As ICommand
|
||||
Get
|
||||
If m_cmdDelete Is Nothing Then
|
||||
m_cmdDelete = New Command(AddressOf Delete)
|
||||
End If
|
||||
Return m_cmdDelete
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the New. This method is invoked by the NewCommand.
|
||||
''' </summary>
|
||||
Friend Overridable Sub Delete()
|
||||
End Sub
|
||||
|
||||
#End Region ' Delete
|
||||
|
||||
#End Region ' Commands
|
||||
|
||||
End Class
|
||||
@@ -1,364 +0,0 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.IO
|
||||
Imports System.Windows.Input
|
||||
Imports System.Windows.Media
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public MustInherit Class Part
|
||||
Inherits VMBase
|
||||
|
||||
#Region "FIELDS & PROPERTIES"
|
||||
|
||||
Protected m_ParentMachGroup As MyMachGroup
|
||||
Public ReadOnly Property ParentMachGroup As MyMachGroup
|
||||
Get
|
||||
Return m_ParentMachGroup
|
||||
End Get
|
||||
End Property
|
||||
|
||||
' Id geometrico del pezzo
|
||||
Protected m_nPartId As Integer
|
||||
Public ReadOnly Property nPartId As Integer
|
||||
Get
|
||||
Return m_nPartId
|
||||
End Get
|
||||
End Property
|
||||
Friend Sub SetPartId(nPartId As Integer)
|
||||
m_nPartId = nPartId
|
||||
End Sub
|
||||
|
||||
' Proj del pezzo
|
||||
Protected m_nProjId As Integer = 0
|
||||
Public Property nProjId As Integer
|
||||
Get
|
||||
Return m_nProjId
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_nProjId = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' Info del pezzo
|
||||
Protected m_nPDN As Integer
|
||||
Public ReadOnly Property nPDN As Integer
|
||||
Get
|
||||
Return m_nPDN
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_sNAM As String
|
||||
Public ReadOnly Property sNAM As String
|
||||
Get
|
||||
Return m_sNAM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected 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
|
||||
|
||||
Protected 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
|
||||
|
||||
Protected m_dH As Double
|
||||
Public Property dH As Double
|
||||
Get
|
||||
Return m_dH
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_dH = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_dPOSX As Double
|
||||
Public Property sPOSX As String
|
||||
Get
|
||||
Return LenToString(m_dPOSX, 3)
|
||||
End Get
|
||||
Set(value As String)
|
||||
StringToLen(value, m_dPOSX)
|
||||
End Set
|
||||
End Property
|
||||
Public Property dPOSX As Double
|
||||
Get
|
||||
Return m_dPOSX
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_dPOSX = value
|
||||
NotifyPropertyChanged(NameOf(sPOSX))
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_nCNT As Integer
|
||||
Public Property nCNT As Integer
|
||||
Get
|
||||
Return m_nCNT
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_nCNT = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_nINVERTED As Integer
|
||||
Public ReadOnly Property sINVERTED As String
|
||||
Get
|
||||
Return m_nINVERTED & "°"
|
||||
End Get
|
||||
End Property
|
||||
Public Sub SetInverted(nInverted As Integer)
|
||||
m_nINVERTED = nInverted
|
||||
End Sub
|
||||
|
||||
Protected m_nROTATED As Integer
|
||||
Public ReadOnly Property sROTATED As String
|
||||
Get
|
||||
Return m_nROTATED & "°"
|
||||
End Get
|
||||
End Property
|
||||
Public Sub SetRotated(nRotated As Integer)
|
||||
m_nROTATED = nRotated
|
||||
End Sub
|
||||
|
||||
Protected m_sMATERIAL As String
|
||||
Public Property sMATERIAL As String
|
||||
Get
|
||||
Return m_sMATERIAL
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_sMATERIAL = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_nGlobalState As CalcStates = -1
|
||||
Public ReadOnly Property nGlobalState As CalcStates
|
||||
Get
|
||||
Return m_nGlobalState
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_nState As CalcStates = -1
|
||||
Public Property nState As CalcStates
|
||||
Get
|
||||
Return m_nState
|
||||
End Get
|
||||
Set(value As CalcStates)
|
||||
m_nState = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Calc_Background As SolidColorBrush
|
||||
Get
|
||||
If m_nGlobalState = 0 Then
|
||||
Return Brushes.Green
|
||||
ElseIf m_nGlobalState < 0 Then
|
||||
Return Brushes.LightGray
|
||||
ElseIf m_nGlobalState > 0 Then
|
||||
Return Brushes.Red
|
||||
Else
|
||||
Return Brushes.Red
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_nCALC_ERR As Integer
|
||||
Public ReadOnly Property nCALC_ERR As Integer
|
||||
Get
|
||||
Return m_nCALC_ERR
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_sCALC_MSG As String = String.Empty
|
||||
Public ReadOnly Property nCALC_MSG As String
|
||||
Get
|
||||
Return m_sCALC_MSG
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_nCALC_ROT As Integer
|
||||
Public Property nCALC_ROT As Integer
|
||||
Get
|
||||
Return m_nCALC_ROT
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_nCALC_ROT = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_nCALC_FALL As Integer
|
||||
Public Property nCALC_FALL As Integer
|
||||
Get
|
||||
Return m_nCALC_FALL
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_nCALC_FALL = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_nCALC_TIME As Integer
|
||||
Public Property nCALC_TIME As Integer
|
||||
Get
|
||||
Return m_nCALC_TIME
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_nCALC_TIME = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' lista delle feature del pezzo
|
||||
Protected m_FeatureList As ObservableCollection(Of BTLFeatureM)
|
||||
Public Property FeatureList As ObservableCollection(Of BTLFeatureM)
|
||||
Get
|
||||
Return m_FeatureList
|
||||
End Get
|
||||
Set(value As ObservableCollection(Of BTLFeatureM))
|
||||
m_FeatureList = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_SelFeature As BTLFeatureM
|
||||
Public Property SelFeature As BTLFeatureM
|
||||
Get
|
||||
Return m_SelFeature
|
||||
End Get
|
||||
Set(value As BTLFeatureM)
|
||||
m_SelFeature = value
|
||||
EgtDeselectAll()
|
||||
If Not IsNothing(value) Then EgtSelectObj(m_SelFeature.nFeatureId)
|
||||
EgtDraw()
|
||||
NotifyPropertyChanged(NameOf(SelFeature))
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' definizione comandi
|
||||
Private m_cmdDeletePart As ICommand
|
||||
|
||||
#End Region ' FIELDS & PROPERTIES
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Sub New(nParentMachGroup As MyMachGroup, nPartId As Integer)
|
||||
m_ParentMachGroup = nParentMachGroup
|
||||
SetPartId(nPartId)
|
||||
m_FeatureList = New ObservableCollection(Of BTLFeatureM)
|
||||
End Sub
|
||||
|
||||
#End Region ' CONSTRUCTOR
|
||||
|
||||
' funzione che aggiorna lo stato e gli errori dopo calcolo
|
||||
Public Sub CalcPartUpdate(bCalc As Boolean, ERR As Integer, ROT As Integer, FALL As Integer, MSG As String)
|
||||
If Not bCalc Then
|
||||
nState = CalcStates.NOTCALCULATED
|
||||
m_nCALC_ERR = 0
|
||||
m_nCALC_ROT = 0
|
||||
m_nCALC_FALL = 0
|
||||
m_sCALC_MSG = ""
|
||||
Else
|
||||
m_nCALC_ERR = ERR
|
||||
m_nCALC_ROT = ROT
|
||||
m_nCALC_FALL = 0
|
||||
m_sCALC_MSG = MSG
|
||||
If ERR = 0 Then
|
||||
nState = CalcStates.OK
|
||||
ElseIf ERR > 1 Then
|
||||
nState = CalcStates.ERROR_
|
||||
ElseIf ERR < 1 Then
|
||||
nState = CalcStates.NOTCALCULATED
|
||||
End If
|
||||
End If
|
||||
NotifyPropertyChanged(NameOf(Calc_Background))
|
||||
End Sub
|
||||
|
||||
' funzione che aggiorna lo stato e gli errori dopo calcolo
|
||||
Public Sub CalcFeatureUpdate()
|
||||
m_nGlobalState = nState
|
||||
For Each Feature In FeatureList
|
||||
If Not Feature.bDO Then
|
||||
|
||||
ElseIf Feature.nState < 0 Then
|
||||
m_nGlobalState = CalcStates.NOTCALCULATED
|
||||
Exit For
|
||||
ElseIf Feature.nState > 0 AndAlso m_nGlobalState = CalcStates.OK Then
|
||||
m_nGlobalState = CalcStates.ERROR_
|
||||
End If
|
||||
Next
|
||||
NotifyPropertyChanged(NameOf(Calc_Background))
|
||||
End Sub
|
||||
|
||||
#Region "COMMANDS"
|
||||
|
||||
#Region "DeletePart"
|
||||
|
||||
' Returns a command that manage the MainWindow_Unloaded command
|
||||
Public ReadOnly Property DeletePart_Command() As ICommand
|
||||
Get
|
||||
If m_cmdDeletePart Is Nothing Then
|
||||
m_cmdDeletePart = New Command(AddressOf DeletePart)
|
||||
End If
|
||||
Return m_cmdDeletePart
|
||||
End Get
|
||||
End Property
|
||||
|
||||
' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
|
||||
Public Overridable Sub DeletePart()
|
||||
EgtRemovePartFromRawPart(Me.m_nPartId)
|
||||
' elimino pezzo copia
|
||||
EgtErase(Me.m_nPartId)
|
||||
' elimino info pezzo su mach group
|
||||
Dim sInfo As String = ""
|
||||
Dim Index As Integer = 1
|
||||
Dim sSplitInfo() As String
|
||||
Dim bFound As Boolean = False
|
||||
While EgtGetInfo(m_ParentMachGroup.Id, MGR_RPT_PART & Index, sInfo)
|
||||
If Not String.IsNullOrWhiteSpace(sInfo) Then
|
||||
sSplitInfo = sInfo.Split(","c)
|
||||
If bFound Then
|
||||
EgtSetInfo(m_ParentMachGroup.Id, MGR_RPT_PART & Index - 1, sInfo)
|
||||
End If
|
||||
If sSplitInfo(0) = nPartId Then
|
||||
bFound = True
|
||||
End If
|
||||
End If
|
||||
Index += 1
|
||||
End While
|
||||
If bFound Then
|
||||
EgtSetInfo(m_ParentMachGroup.Id, MGR_RPT_PART & Index - 1, "")
|
||||
End If
|
||||
' rimuovo dalla lista pezzi
|
||||
Index = ParentMachGroup.PartList.IndexOf(Me)
|
||||
If Index = 0 Then
|
||||
If ParentMachGroup.PartList.Count > 0 Then
|
||||
ParentMachGroup.SelPart = ParentMachGroup.PartList(0)
|
||||
Else
|
||||
ParentMachGroup.SelPart = Nothing
|
||||
End If
|
||||
ElseIf Index = ParentMachGroup.PartList.Count - 1 Then
|
||||
If ParentMachGroup.PartList.Count > 1 Then
|
||||
ParentMachGroup.SelPart = ParentMachGroup.PartList(ParentMachGroup.PartList.Count - 2)
|
||||
Else
|
||||
ParentMachGroup.SelPart = Nothing
|
||||
End If
|
||||
Else
|
||||
ParentMachGroup.SelPart = ParentMachGroup.PartList(Index - 1)
|
||||
End If
|
||||
ParentMachGroup.PartList.Remove(Me)
|
||||
End Sub
|
||||
|
||||
#End Region ' DeletePart
|
||||
|
||||
#End Region ' COMMANDS
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,381 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.IO
|
||||
Imports System.Windows.Input
|
||||
Imports System.Windows.Media
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public MustInherit Class PartM
|
||||
Inherits VMBase
|
||||
|
||||
#Region "FIELDS & PROPERTIES"
|
||||
|
||||
Protected m_ParentMachGroup As MyMachGroupM
|
||||
Public ReadOnly Property ParentMachGroup As MyMachGroupM
|
||||
Get
|
||||
Return m_ParentMachGroup
|
||||
End Get
|
||||
End Property
|
||||
|
||||
' Id geometrico del pezzo
|
||||
Protected m_nPartId As Integer
|
||||
Public ReadOnly Property nPartId As Integer
|
||||
Get
|
||||
Return m_nPartId
|
||||
End Get
|
||||
End Property
|
||||
Friend Sub SetPartId(nPartId As Integer)
|
||||
m_nPartId = nPartId
|
||||
End Sub
|
||||
|
||||
' Proj del pezzo
|
||||
Protected m_nProjId As Integer = 0
|
||||
Public Property nProjId As Integer
|
||||
Get
|
||||
Return m_nProjId
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_nProjId = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' Info del pezzo
|
||||
Protected m_nPDN As Integer
|
||||
Public ReadOnly Property nPDN As Integer
|
||||
Get
|
||||
Return m_nPDN
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_sNAM As String
|
||||
Public ReadOnly Property sNAM As String
|
||||
Get
|
||||
Return m_sNAM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_dBtlL As Double
|
||||
Public ReadOnly Property dBtlL As String
|
||||
Get
|
||||
Return m_dBtlL
|
||||
End Get
|
||||
End Property
|
||||
Public Property dL As Double
|
||||
Get
|
||||
Dim frBeam As New Frame3d
|
||||
EgtGetGroupGlobFrame( nPartId, frBeam)
|
||||
If IsX( frBeam.VersX(), EPS_SMALL) Then
|
||||
Return m_dBtlL
|
||||
ElseIf IsX( frBeam.VersY(), EPS_SMALL) Then
|
||||
Return m_dBtlH
|
||||
Else
|
||||
Return m_dBtlW
|
||||
End If
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_dBtlL = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_dBtlW As Double
|
||||
Public ReadOnly Property dBtlW As String
|
||||
Get
|
||||
Return m_dBtlW
|
||||
End Get
|
||||
End Property
|
||||
Public Property dW As Double
|
||||
Get
|
||||
Dim frBeam As New Frame3d
|
||||
EgtGetGroupGlobFrame( nPartId, frBeam)
|
||||
If IsY( frBeam.VersX()) Then
|
||||
Return m_dBtlL
|
||||
ElseIf IsY( frBeam.VersY()) Then
|
||||
Return m_dBtlH
|
||||
Else
|
||||
Return m_dBtlW
|
||||
End If
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_dBtlW = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_dBtlH As Double
|
||||
Public ReadOnly Property dBtlH As String
|
||||
Get
|
||||
Return m_dBtlH
|
||||
End Get
|
||||
End Property
|
||||
Public Property dH As Double
|
||||
Get
|
||||
Dim frBeam As New Frame3d
|
||||
EgtGetGroupGlobFrame( nPartId, frBeam)
|
||||
If IsZ( frBeam.VersX()) Then
|
||||
Return m_dBtlL
|
||||
ElseIf IsZ( frBeam.VersY()) Then
|
||||
Return m_dBtlH
|
||||
Else
|
||||
Return m_dBtlW
|
||||
End If
|
||||
Return m_dBtlH
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_dBtlH = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_dPOSX As Double
|
||||
Public Property dPOSX As Double
|
||||
Get
|
||||
Return m_dPOSX
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_dPOSX = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_nCNT As Integer
|
||||
Public Property nCNT As Integer
|
||||
Get
|
||||
Return m_nCNT
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_nCNT = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_nINVERTED As Integer
|
||||
Public ReadOnly Property nINVERTED As Integer
|
||||
Get
|
||||
Return m_nINVERTED
|
||||
End Get
|
||||
End Property
|
||||
Public Sub SetInverted(nInverted As Integer)
|
||||
m_nINVERTED = nInverted
|
||||
End Sub
|
||||
|
||||
Protected m_nROTATED As Integer
|
||||
Public ReadOnly Property nROTATED As Integer
|
||||
Get
|
||||
Return m_nROTATED
|
||||
End Get
|
||||
End Property
|
||||
Public Sub SetRotated(nRotated As Integer)
|
||||
m_nROTATED = nRotated
|
||||
End Sub
|
||||
|
||||
Protected m_sMATERIAL As String
|
||||
Public Property sMATERIAL As String
|
||||
Get
|
||||
Return m_sMATERIAL
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_sMATERIAL = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public m_sGROUP As String
|
||||
Public Property sGROUP As String
|
||||
Get
|
||||
Return m_sGROUP
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_sGROUP = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_nCALC_GlobalState As CalcStates = -1
|
||||
Public Property nCALC_GlobalState As CalcStates
|
||||
Get
|
||||
Return m_nCALC_GlobalState
|
||||
End Get
|
||||
Set(value As CalcStates)
|
||||
m_nCALC_GlobalState = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_nCALC_GlobalERR As Integer
|
||||
Public Property nCALC_GlobalERR As Integer
|
||||
Get
|
||||
Return m_nCALC_GlobalERR
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_nCALC_GlobalERR = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_nCALC_State As CalcStates = -1
|
||||
Public Property nCALC_State As CalcStates
|
||||
Get
|
||||
Return m_nCALC_State
|
||||
End Get
|
||||
Set(value As CalcStates)
|
||||
m_nCALC_State = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_nCALC_ERR As Integer
|
||||
Public Property nCALC_ERR As Integer
|
||||
Get
|
||||
Return m_nCALC_ERR
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_nCALC_ERR = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_sCALC_MSG As String = String.Empty
|
||||
Public Property sCALC_MSG As String
|
||||
Get
|
||||
Return m_sCALC_MSG
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_sCALC_MSG = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_nCALC_ROT As Integer
|
||||
Public Property nCALC_ROT As Integer
|
||||
Get
|
||||
Return m_nCALC_ROT
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_nCALC_ROT = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_nCALC_FALL As Integer
|
||||
Public Property nCALC_FALL As Integer
|
||||
Get
|
||||
Return m_nCALC_FALL
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_nCALC_FALL = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_nCALC_TIME As Integer
|
||||
Public Property nCALC_TIME As Integer
|
||||
Get
|
||||
Return m_nCALC_TIME
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_nCALC_TIME = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' lista delle feature del pezzo
|
||||
Protected m_FeatureMList As List(Of BTLFeatureM)
|
||||
Public Property FeatureMList As List(Of BTLFeatureM)
|
||||
Get
|
||||
Return m_FeatureMList
|
||||
End Get
|
||||
Set(value As List(Of BTLFeatureM))
|
||||
m_FeatureMList = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_dtStartTime As DateTime
|
||||
Public Property dtStartTime As DateTime
|
||||
Get
|
||||
Return m_dtStartTime
|
||||
End Get
|
||||
Set(value As DateTime)
|
||||
m_dtStartTime = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_dtEndTime As DateTime
|
||||
Public Property dtEndTime As DateTime
|
||||
Get
|
||||
Return m_dtEndTime
|
||||
End Get
|
||||
Set(value As DateTime)
|
||||
m_dtEndTime = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_nProductionState As Integer = 0
|
||||
Public ReadOnly Property nProductionState As Integer
|
||||
Get
|
||||
Return m_nProductionState
|
||||
End Get
|
||||
End Property
|
||||
Public Sub SetProductionState(nState As CalcStates)
|
||||
m_nProductionState = nState
|
||||
End Sub
|
||||
|
||||
Protected m_nBTLPartId As Integer
|
||||
Public ReadOnly Property nBTLPartId As Integer
|
||||
Get
|
||||
Return m_nBTLPartId
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region ' FIELDS & PROPERTIES
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Sub New(nParentMachGroup As MyMachGroupM, nPartId As Integer)
|
||||
m_ParentMachGroup = nParentMachGroup
|
||||
SetPartId(nPartId)
|
||||
' imposto BtlPart da cui deriva questo Duplo
|
||||
Dim c As Integer = EgtGetCurrMachGroup()
|
||||
EgtResetCurrMachGroup()
|
||||
m_nBTLPartId = EgtDuploGetOriginal(nPartId)
|
||||
EgtSetCurrMachGroup(c)
|
||||
End Sub
|
||||
|
||||
#End Region ' CONSTRUCTOR
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Public Event BTLFeatureAdded As EventHandler(Of BTLFeatureAddedEventArgs)
|
||||
|
||||
Public Sub AddBTLFeature(BTLFeatureM As BTLFeatureM)
|
||||
If IsNothing(BTLFeatureM) Then Return
|
||||
If Not m_FeatureMList.Contains(BTLFeatureM) Then
|
||||
m_FeatureMList.Add(BTLFeatureM)
|
||||
RaiseEvent BTLFeatureAdded(Me, New BTLFeatureAddedEventArgs(BTLFeatureM))
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Function GetBTLFeatures() As List(Of BTLFeatureM)
|
||||
Return New List(Of BTLFeatureM)(m_FeatureMList)
|
||||
End Function
|
||||
|
||||
Public Shared Sub ReadMachGroupData(NewPart As PartM)
|
||||
' leggo calc error
|
||||
Dim nErr As Integer = 0
|
||||
Dim nRot As Integer = 0
|
||||
Dim nFall As Integer = 0
|
||||
Dim sMsg As String = ""
|
||||
Dim bCalc As Boolean = False
|
||||
bCalc = EgtGetInfo(NewPart.nPartId, ITG_PROD_ERR, nErr)
|
||||
EgtGetInfo(NewPart.nPartId, ITG_PROD_ROT, nRot)
|
||||
EgtGetInfo(NewPart.nPartId, ITG_PROD_MSG, sMsg)
|
||||
If Not bCalc Then
|
||||
NewPart.m_nCALC_State = CalcStates.NOTCALCULATED
|
||||
NewPart.m_nCALC_ERR = 0
|
||||
NewPart.m_nCALC_ROT = 0
|
||||
NewPart.m_sCALC_MSG = ""
|
||||
Else
|
||||
NewPart.m_nCALC_ERR = nErr
|
||||
NewPart.m_nCALC_ROT = nRot
|
||||
NewPart.m_sCALC_MSG = sMsg
|
||||
If nErr = 0 Then
|
||||
NewPart.nCALC_State = CalcStates.OK
|
||||
ElseIf nErr = 17 Then
|
||||
NewPart.nCALC_State = CalcStates.WARNING
|
||||
ElseIf nErr > 0 Then
|
||||
NewPart.nCALC_State = CalcStates.ERROR_
|
||||
ElseIf nErr < 0 Then
|
||||
NewPart.nCALC_State = CalcStates.INFO
|
||||
End If
|
||||
End If
|
||||
EgtGetInfo(NewPart.nPartId, ITG_PROD_TIME, NewPart.m_nCALC_TIME)
|
||||
End Sub
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
End Class
|
||||
@@ -19,10 +19,13 @@ Public Class ProjFileM
|
||||
End Property
|
||||
|
||||
Protected m_sBTLFileName As String = String.Empty
|
||||
Public ReadOnly Property sBTLFileName As String
|
||||
Public Property sBTLFileName As String
|
||||
Get
|
||||
Return m_sBTLFileName
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_sBTLFileName = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#Region "CONSTRUCTORS"
|
||||
@@ -35,15 +38,17 @@ Public Class 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) As ProjFileM
|
||||
dtExportDate As DateTime, sListName As String, sBTLFileName As String, IsNew As Boolean, IsLocked As Boolean) As ProjFileM
|
||||
Dim NewProjectFileM As New ProjFileM
|
||||
NewProjectFileM.m_nProjId = nProjId
|
||||
NewProjectFileM.m_nProdId = nProdId
|
||||
NewProjectFileM.m_dtCreateDate = dtCreateProjDate
|
||||
NewProjectFileM.m_dtExportDate = dtExportDate
|
||||
NewProjectFileM.m_sListName = sListName
|
||||
NewProjectFileM.m_sBTLFileName = sBTLFileName
|
||||
Return NewProjectFileM
|
||||
NewProjectFileM.m_nProjId = nProjId
|
||||
NewProjectFileM.m_nProdId = nProdId
|
||||
NewProjectFileM.m_dtCreateDate = dtCreateProjDate
|
||||
NewProjectFileM.m_dtExportDate = dtExportDate
|
||||
NewProjectFileM.m_sListName = sListName
|
||||
NewProjectFileM.m_sBTLFileName = sBTLFileName
|
||||
NewProjectFileM.m_bIsNew = IsNew
|
||||
NewProjectFileM.m_bIsLocked = IsLocked
|
||||
Return NewProjectFileM
|
||||
End Function
|
||||
|
||||
#End Region ' CONSTRUCTORS
|
||||
|
||||
@@ -44,6 +44,16 @@ Public Class ProjectFileM
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_bIsLocked As Boolean
|
||||
Public Property bIsLocked As Boolean
|
||||
Get
|
||||
Return m_bIsLocked
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_bIsLocked = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#Region "CONSTRUCTORS"
|
||||
|
||||
'Sub New(nProjectType As ProjectType, nProjId As Integer, nProdId As Integer, sBTLFileName As String)
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
Imports System.IO
|
||||
|
||||
Public Class ProdFile
|
||||
|
||||
'Private m_nProjId As Integer = 0
|
||||
'Public ReadOnly Property nProjId As Integer
|
||||
' Get
|
||||
' Return m_nProjId
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
'Friend ReadOnly Property sProjPath As String
|
||||
' Get
|
||||
' Dim sPath As String = String.Empty
|
||||
' If IsNothing(m_nProjId) OrElse m_nProjId = 0 Then Return String.Empty
|
||||
' sPath = refMainWindowVM.MainWindowM.sProjsDir & "\" & nProjId.ToString("0000") & "\" & nProjId.ToString("0000") & FILENAMESEPARATOR
|
||||
' If Not IsNothing(m_nProdId) AndAlso m_nProdId > 0 Then
|
||||
' sPath &= nProjId.ToString("0000")
|
||||
' End If
|
||||
' sPath &= FILENAMESEPARATOR & BTLFileName & ".nge"
|
||||
' Return sPath
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
Private m_nProdId As Integer = 0
|
||||
Public ReadOnly Property nProdId As Integer
|
||||
Get
|
||||
Return m_nProdId
|
||||
End Get
|
||||
End Property
|
||||
Friend ReadOnly Property sProdPath As String
|
||||
Get
|
||||
Dim sPath As String = String.Empty
|
||||
If IsNothing(m_nProdId) OrElse m_nProdId = 0 Then Return String.Empty
|
||||
Return refMainWindowVM.MainWindowM.sProdsDir & "\" & nProdId.ToString("0000") & "\" & nProdId.ToString("0000") & ".nge"
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'Private m_BTLFileName As String = String.Empty
|
||||
'Public ReadOnly Property BTLFileName As String
|
||||
' Get
|
||||
' Return m_BTLFileName
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
Private m_NewProd As Boolean
|
||||
Friend Property NewProd As Boolean
|
||||
Get
|
||||
Return m_NewProd
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_NewProd = value
|
||||
End Set
|
||||
End Property
|
||||
Public ReadOnly Property ProjectFileName As String
|
||||
Get
|
||||
Return m_nProdId.ToString("0000")
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Sub New(ProdFileName As String)
|
||||
Integer.TryParse(Path.GetFileNameWithoutExtension(ProdFileName), m_nProdId)
|
||||
End Sub
|
||||
|
||||
Friend Sub SetProdId(nProdId As Integer)
|
||||
m_nProdId = nProdId
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,105 @@
|
||||
Imports System.IO
|
||||
Imports EgtBEAMWALL.Core
|
||||
Imports EgtUILib
|
||||
|
||||
Public Class ProdFileVM
|
||||
Inherits ProjectFileVM
|
||||
|
||||
Public ReadOnly Property ProdFileM As ProdFileM
|
||||
Get
|
||||
Return m_ProjectFileM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property nProjIdList As List(Of Integer)
|
||||
Get
|
||||
Return ProdFileM.nProjIdList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Overrides ReadOnly Property nProdId As Integer
|
||||
Get
|
||||
Return ProdFileM.nProdId
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Overrides ReadOnly Property sProdDirPath As String
|
||||
Get
|
||||
Dim sPath As String = String.Empty
|
||||
If IsNothing(ProdFileM.nProdId) OrElse ProdFileM.nProdId = 0 Then Return String.Empty
|
||||
Return m_sProdsDir & "\" & nProdId.ToString("0000")
|
||||
End Get
|
||||
End Property
|
||||
Public Overrides ReadOnly Property sProdPath As String
|
||||
Get
|
||||
Dim sPath As String = String.Empty
|
||||
If IsNothing(ProdFileM.nProdId) OrElse ProdFileM.nProdId = 0 Then Return String.Empty
|
||||
Return m_sProdsDir & "\" & nProdId.ToString("0000") & "\" & nProdId.ToString("0000") & ".nge"
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Overrides Property bIsNew As Boolean
|
||||
Get
|
||||
Return ProdFileM.bIsNew
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
ProdFileM.bIsNew = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sName As String
|
||||
Get
|
||||
Return ProdFileM.sName
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_sBTLFileName As String
|
||||
Public ReadOnly Property sBTLFileName As String
|
||||
Get
|
||||
Return m_sBTLFileName
|
||||
End Get
|
||||
End Property
|
||||
Protected Sub SetBTLFileName(value As String)
|
||||
m_sBTLFileName = value
|
||||
End Sub
|
||||
#Region "CONSTRUCTORS"
|
||||
|
||||
Sub New(ProdFileM As ProdFileM)
|
||||
m_ProjectFileM = ProdFileM
|
||||
End Sub
|
||||
|
||||
#End Region ' CONSTRUCTORS
|
||||
|
||||
Friend Function GetProjPath(nProjId As Integer)
|
||||
Dim sPath As String = String.Empty
|
||||
If nProjId = 0 Then Return String.Empty
|
||||
Return m_sProjsDir & "\" & nProjId.ToString("0000") & "\" & nProjId.ToString("0000") & ".nge"
|
||||
End Function
|
||||
|
||||
' funzione che restituisce le parti di nome file
|
||||
Friend Shared Function VerifyProjectFile(nProjectType As ProjectType, ProjectFileName As String, ByRef nProjId As Integer, ByRef nProdId As Integer, ByRef sBTLFileName As String) As Boolean
|
||||
If nProjectType = ProjectType.PROJ Then
|
||||
Dim DataFromFileName As String() = ProjectFileName.Split(FILENAMESEPARATOR)
|
||||
If DataFromFileName.Count = 3 Then
|
||||
If Not String.IsNullOrEmpty(DataFromFileName(0)) Then
|
||||
Integer.TryParse(DataFromFileName(0), nProjId)
|
||||
Else Return False
|
||||
End If
|
||||
If Not String.IsNullOrEmpty(DataFromFileName(1)) Then
|
||||
Integer.TryParse(DataFromFileName(1), nProdId)
|
||||
Else
|
||||
nProdId = 0
|
||||
End If
|
||||
If Not String.IsNullOrEmpty(DataFromFileName(2)) Then
|
||||
sBTLFileName = DataFromFileName(2)
|
||||
End If
|
||||
Return True
|
||||
Else Return False
|
||||
End If
|
||||
ElseIf nProjectType = ProjectType.PROD Then
|
||||
Return Integer.TryParse(ProjectFileName, nProdId)
|
||||
Else Return False
|
||||
End If
|
||||
End Function
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,125 @@
|
||||
Imports System.IO
|
||||
Imports EgtBEAMWALL.Core
|
||||
Imports EgtUILib
|
||||
|
||||
Public Class ProjFileVM
|
||||
Inherits ProjectFileVM
|
||||
|
||||
Public ReadOnly Property ProjFileM As ProjFileM
|
||||
Get
|
||||
Return m_ProjectFileM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Overrides ReadOnly Property nProjId As Integer
|
||||
Get
|
||||
Return ProjFileM.nProjId
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Overrides ReadOnly Property nProdId As Integer
|
||||
Get
|
||||
Return ProjFileM.nProdId
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Overrides ReadOnly Property sProjDirPath As String
|
||||
Get
|
||||
If IsNothing(ProjFileM.nProjId) OrElse ProjFileM.nProjId = 0 Then Return String.Empty
|
||||
Return m_sProjsDir & "\" & nProjId.ToString("0000")
|
||||
End Get
|
||||
End Property
|
||||
Public Overrides ReadOnly Property sProjPath As String
|
||||
Get
|
||||
Dim sPath As String = String.Empty
|
||||
If IsNothing(ProjFileM.nProjId) OrElse ProjFileM.nProjId = 0 Then Return String.Empty
|
||||
sPath = m_sProjsDir & "\" & nProjId.ToString("0000") & "\" & nProjId.ToString("0000") & ".nge"
|
||||
Return sPath
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Overrides ReadOnly Property sProdDirPath As String
|
||||
Get
|
||||
Dim sPath As String = String.Empty
|
||||
If IsNothing(ProjFileM.nProdId) OrElse ProjFileM.nProdId = 0 Then Return String.Empty
|
||||
Return m_sProdsDir & "\" & nProdId.ToString("0000")
|
||||
End Get
|
||||
End Property
|
||||
Public Overrides ReadOnly Property sProdPath As String
|
||||
Get
|
||||
Dim sPath As String = String.Empty
|
||||
If IsNothing(ProjFileM.nProdId) OrElse ProjFileM.nProdId = 0 Then Return String.Empty
|
||||
Return m_sProdsDir & "\" & nProdId.ToString("0000") & "\" & nProdId.ToString("0000") & ".nge"
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Overrides Property bIsNew As Boolean
|
||||
Get
|
||||
Return ProjFileM.bIsNew
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
ProjFileM.bIsNew = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sBTLFileName As String
|
||||
Get
|
||||
Return ProjFileM.sBTLFileName
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sListName As String
|
||||
Get
|
||||
Return ProjFileM.sListName
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property dtExportDate As DateTime
|
||||
Get
|
||||
Return ProjFileM.dtExportDate
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#Region "CONSTRUCTORS"
|
||||
|
||||
Sub New(ProjectFileM As ProjFileM)
|
||||
m_ProjectFileM = ProjectFileM
|
||||
End Sub
|
||||
|
||||
#End Region ' CONSTRUCTORS
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Public Sub SetBTLFileName(BTLFileName As String)
|
||||
ProjFileM.sBTLFileName = BTLFileName
|
||||
End Sub
|
||||
|
||||
' funzione che restituisce le parti di nome file
|
||||
Friend Shared Function VerifyProjectFile(nProjectType As ProjectType, ProjectFileName As String, ByRef nProjId As Integer, ByRef nProdId As Integer, ByRef sBTLFileName As String) As Boolean
|
||||
If nProjectType = ProjectType.PROJ Then
|
||||
Dim DataFromFileName As String() = ProjectFileName.Split(FILENAMESEPARATOR)
|
||||
If DataFromFileName.Count = 3 Then
|
||||
If Not String.IsNullOrEmpty(DataFromFileName(0)) Then
|
||||
Integer.TryParse(DataFromFileName(0), nProjId)
|
||||
Else Return False
|
||||
End If
|
||||
If Not String.IsNullOrEmpty(DataFromFileName(1)) Then
|
||||
Integer.TryParse(DataFromFileName(1), nProdId)
|
||||
Else
|
||||
nProdId = 0
|
||||
End If
|
||||
If Not String.IsNullOrEmpty(DataFromFileName(2)) Then
|
||||
sBTLFileName = DataFromFileName(2)
|
||||
End If
|
||||
Return True
|
||||
Else Return False
|
||||
End If
|
||||
ElseIf nProjectType = ProjectType.PROD Then
|
||||
Return Integer.TryParse(ProjectFileName, nProdId)
|
||||
Else Return False
|
||||
End If
|
||||
End Function
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,145 @@
|
||||
Imports System.IO
|
||||
Imports EgtBEAMWALL.Core
|
||||
Imports EgtUILib
|
||||
|
||||
Public Class ProjectFileVM
|
||||
Inherits VMBase
|
||||
|
||||
Protected Shared m_sProjsDir As String
|
||||
Protected Shared m_sProdsDir As String
|
||||
|
||||
Protected m_ProjectFileM As ProjectFileM
|
||||
|
||||
Public Overridable ReadOnly Property nProjId As Integer
|
||||
Get
|
||||
Return m_ProjectFileM.nProjId
|
||||
End Get
|
||||
End Property
|
||||
Public Overridable ReadOnly Property sProjId As String
|
||||
Get
|
||||
Return m_ProjectFileM.nProjId.ToString("0000")
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Overridable ReadOnly Property nProdId As Integer
|
||||
Get
|
||||
Return m_ProjectFileM.nProdId
|
||||
End Get
|
||||
End Property
|
||||
Public Overridable ReadOnly Property sProdId As String
|
||||
Get
|
||||
Return m_ProjectFileM.nProdId.ToString("0000")
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Overridable ReadOnly Property sProjDirPath As String
|
||||
Get
|
||||
If IsNothing(m_ProjectFileM.nProjId) OrElse m_ProjectFileM.nProjId = 0 Then Return String.Empty
|
||||
Return m_sProjsDir & "\" & nProjId.ToString("0000")
|
||||
End Get
|
||||
End Property
|
||||
Public Overridable ReadOnly Property sProjPath As String
|
||||
Get
|
||||
Dim sPath As String = String.Empty
|
||||
If IsNothing(m_ProjectFileM.nProjId) OrElse m_ProjectFileM.nProjId = 0 Then Return String.Empty
|
||||
sPath = m_sProjsDir & "\" & nProjId.ToString("0000") & "\" & nProjId.ToString("0000") & ".nge"
|
||||
Return sPath
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Overridable ReadOnly Property sProdDirPath As String
|
||||
Get
|
||||
Dim sPath As String = String.Empty
|
||||
If IsNothing(m_ProjectFileM.nProdId) OrElse m_ProjectFileM.nProdId = 0 Then Return String.Empty
|
||||
Return m_sProdsDir & "\" & nProdId.ToString("0000")
|
||||
End Get
|
||||
End Property
|
||||
Public Overridable ReadOnly Property sProdPath As String
|
||||
Get
|
||||
Dim sPath As String = String.Empty
|
||||
If IsNothing(m_ProjectFileM.nProdId) OrElse m_ProjectFileM.nProdId = 0 Then Return String.Empty
|
||||
Return m_sProdsDir & "\" & nProdId.ToString("0000") & "\" & nProdId.ToString("0000") & ".nge"
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Overridable Property bIsNew As Boolean
|
||||
Get
|
||||
Return m_ProjectFileM.bIsNew
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_ProjectFileM.bIsNew = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Overridable Property bIsLocked As Boolean
|
||||
Get
|
||||
Return m_ProjectFileM.bIsLocked
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_ProjectFileM.bIsLocked = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property dtCreateDate As DateTime
|
||||
Get
|
||||
Return m_ProjectFileM.dtCreateDate
|
||||
End Get
|
||||
End Property
|
||||
|
||||
' variabile che indica se ricaricare il progetto
|
||||
Private m_bReloadProject As Boolean = True
|
||||
Friend ReadOnly Property bReloadProject As Boolean
|
||||
Get
|
||||
Return m_bReloadProject
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#Region "Messages"
|
||||
|
||||
Public ReadOnly Property Id_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61815)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property BTLFileName_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61819)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property ListName_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61820)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property ExportDate_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61821)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property CreateDate_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61822)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property Name_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61808)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region ' Messages
|
||||
|
||||
#Region "CONSTRUCTORS"
|
||||
|
||||
#End Region ' CONSTRUCTORS
|
||||
|
||||
Public Sub SetReloadProject(bValue As Boolean)
|
||||
m_bReloadProject = bValue
|
||||
End Sub
|
||||
|
||||
Public Shared Sub Init(sProjsDir As String, sProdsDir As String)
|
||||
m_sProjsDir = sProjsDir
|
||||
m_sProdsDir = sProdsDir
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -77,16 +77,19 @@ Public Class SectionXMaterial
|
||||
End Property
|
||||
|
||||
Shared Operator =(ByVal S1 As SectionXMaterial, ByVal S2 As SectionXMaterial) As Boolean
|
||||
Return (S1.m_dH = S2.m_dH AndAlso S1.m_dW = S2.m_dW AndAlso S1.m_dL = S2.m_dL AndAlso S1.m_Material.Any(Function(x) S2.m_Material.Any(Function(y) y = x)))
|
||||
Return (S1.m_dH < S2.m_dH + 100 * EPS_SMALL AndAlso S1.m_dH > S2.m_dH - 100 * EPS_SMALL AndAlso
|
||||
S1.m_dW < S2.m_dW + 100 * EPS_SMALL AndAlso S1.m_dW > S2.m_dW - 100 * EPS_SMALL AndAlso
|
||||
S1.m_dL < S2.m_dL + 100 * EPS_SMALL AndAlso 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
|
||||
Return (S1.m_dH <> S2.m_dH OrElse S1.m_dW <> S2.m_dW OrElse S1.m_dL <> S2.m_dL) OrElse Not S1.m_Material.Any(Function(x) S2.m_Material.Any(Function(y) y = x))
|
||||
Return Not S1 = S2
|
||||
End Operator
|
||||
|
||||
Public Overrides Function Equals(ByVal obj As Object) As Boolean
|
||||
If TypeOf obj Is SectionXMaterial Then
|
||||
Return (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)))
|
||||
Return Me = DirectCast(obj, SectionXMaterial) '(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
|
||||
|
||||
@@ -0,0 +1,330 @@
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Module CoreMap
|
||||
|
||||
'Private m_refMainWindowVM As MainWindowVM
|
||||
'Private m_refMyStatusBarVM As MyStatusBarVM
|
||||
'Private m_refProjManagerVM As ProjManagerVM
|
||||
'Private m_refProdManagerVM As ProdManagerVM
|
||||
'Private m_refProjectVM As ProjectVM
|
||||
'Private m_refMainMenuVM As MainMenuVM
|
||||
Private m_refMachinePanelVM As MachinePanelVM
|
||||
Private m_refMyMachGroupPanelVM As MyMachGroupPanelVM
|
||||
'Private m_refLeftPanelVM As LeftPanelVM
|
||||
'Private m_refBottomPanelVM As BottomPanelVM
|
||||
'Private m_refShowBeamPanelVM As ShowBeamPanelVM
|
||||
'Private m_refConfigurationPageVM As ConfigurationPageVM
|
||||
'Private m_refRawPartListVM As RawPartListVM
|
||||
'Private m_refPartInRawPartListVM As PartInRawPartListVM
|
||||
'Private m_refWarehouseWndVM As WarehouseWndVM
|
||||
'Private m_refFeatureListVM As FeatureListVM
|
||||
'Private m_refFreeContourManagerVM As FreeContourManagerVM
|
||||
'Private m_refFreeContourInputVM As FreeContourInputVM
|
||||
'Private m_refPartManagerVM As PartManagerVM
|
||||
'Private m_refInstrumentPanelVM As InstrumentPanelVM
|
||||
'Private m_refTopPanelVM As TopPanelVM
|
||||
'Private m_refOptimizePanelVM As OptimizePanelVM
|
||||
'Private m_refOpenProjectFileDialogVM As OpenProjectFileDialogVM
|
||||
|
||||
#Region "Get"
|
||||
|
||||
'Public ReadOnly Property refMainWindowVM As MainWindowVM
|
||||
' Get
|
||||
' Return m_refMainWindowVM
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
'Public ReadOnly Property refMyStatusBarVM As MyStatusBarVM
|
||||
' Get
|
||||
' Return LibMap.refStatusBarVM
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
'Public ReadOnly Property refProjManagerVM As ProjManagerVM
|
||||
' Get
|
||||
' Return m_refProjManagerVM
|
||||
' End Get
|
||||
'End Property
|
||||
'Public ReadOnly Property refProdManagerVM As ProdManagerVM
|
||||
' Get
|
||||
' Return m_refProdManagerVM
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
'Public ReadOnly Property refProjectVM As ProjectVM
|
||||
' Get
|
||||
' Return m_refProjectVM
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
Public ReadOnly Property refSceneHostVM As SceneHostVM
|
||||
Get
|
||||
Return LibMap.refSceneHostVM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'Public ReadOnly Property refShowPanelVM As ShowPanelVM
|
||||
' Get
|
||||
' Return LibMap.refShowPanelVM
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
'Public ReadOnly Property refMainMenuVM As MainMenuVM
|
||||
' Get
|
||||
' Return m_refMainMenuVM
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
Public ReadOnly Property refMachinePanelVM As MachinePanelVM
|
||||
Get
|
||||
Return m_refMachinePanelVM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'Public ReadOnly Property refLeftPanelVM As LeftPanelVM
|
||||
' Get
|
||||
' Return m_refLeftPanelVM
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
Public ReadOnly Property refMachGroupPanelVM As MyMachGroupPanelVM
|
||||
Get
|
||||
Return m_refMyMachGroupPanelVM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'Public ReadOnly Property refBottomPanelVM As BottomPanelVM
|
||||
' Get
|
||||
' Return m_refBottomPanelVM
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
'Public ReadOnly Property refShowBeamPanelVM As ShowBeamPanelVM
|
||||
' Get
|
||||
' Return m_refShowBeamPanelVM
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
'Public ReadOnly Property refConfigurationPageVM As ConfigurationPageVM
|
||||
' Get
|
||||
' Return m_refConfigurationPageVM
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
'Public ReadOnly Property refRawPartListVM As RawPartListVM
|
||||
' Get
|
||||
' Return m_refRawPartListVM
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
'Public ReadOnly Property refPartInRawPartListVM As PartInRawPartListVM
|
||||
' Get
|
||||
' Return m_refPartInRawPartListVM
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
'Public ReadOnly Property refWarehouseWndVM As WarehouseWndVM
|
||||
' Get
|
||||
' Return m_refWarehouseWndVM
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
'Public ReadOnly Property refFeatureListVM As FeatureListVM
|
||||
' Get
|
||||
' Return m_refFeatureListVM
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
'Public ReadOnly Property refFreeContourManagerVM As FreeContourManagerVM
|
||||
' Get
|
||||
' Return m_refFreeContourManagerVM
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
'Public ReadOnly Property refFreeContourInputVM As FreeContourInputVM
|
||||
' Get
|
||||
' Return m_refFreeContourInputVM
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
'Public ReadOnly Property refPartManagerVM As PartManagerVM
|
||||
' Get
|
||||
' Return m_refPartManagerVM
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
'Public ReadOnly Property refInstrumentPanelVM As MyInstrumentPanelVM
|
||||
' Get
|
||||
' Return m_refInstrumentPanelVM
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
'Public ReadOnly Property refTopPanelVM As TopPanelVM
|
||||
' Get
|
||||
' Return m_refTopPanelVM
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
'Public ReadOnly Property refOptimizePanelVM As OptimizePanelVM
|
||||
' Get
|
||||
' Return m_refOptimizePanelVM
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
'Public ReadOnly Property refOpenProjectFileDialogVM As OpenProjectFileDialogVM
|
||||
' Get
|
||||
' Return m_refOpenProjectFileDialogVM
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
#End Region ' Get
|
||||
|
||||
#Region "Set"
|
||||
|
||||
'Friend Function SetRefMyStatusBarVM(MyStatusBarVM As MyStatusBarVM) As Boolean
|
||||
' LibMap.SetRefStatusBarVM(MyStatusBarVM)
|
||||
' Return Not IsNothing(LibMap.refStatusBarVM)
|
||||
'End Function
|
||||
|
||||
'Friend Function SetRefProjManagerVM(ProjManagerVM As ProjManagerVM) As Boolean
|
||||
' m_refProjManagerVM = ProjManagerVM
|
||||
' Return Not IsNothing(m_refProjManagerVM)
|
||||
'End Function
|
||||
|
||||
'Friend Function SetRefProdManagerVM(ProdManagerVM As ProdManagerVM) As Boolean
|
||||
' m_refProdManagerVM = ProdManagerVM
|
||||
' Return Not IsNothing(m_refProdManagerVM)
|
||||
'End Function
|
||||
|
||||
'Friend Function SetRefProjectVM(ProjectVM As ProjectVM) As Boolean
|
||||
' m_refProjectVM = ProjectVM
|
||||
' Return Not IsNothing(m_refProjectVM)
|
||||
'End Function
|
||||
|
||||
'Friend Function SetRefMainMenuVM(MainMenuVM As MainMenuVM) As Boolean
|
||||
' m_refMainMenuVM = MainMenuVM
|
||||
' Return Not IsNothing(m_refMainMenuVM)
|
||||
'End Function
|
||||
|
||||
Public Function SetRefSceneHostVM(SceneHostVM As SceneHostVM) As Boolean
|
||||
LibMap.SetRefSceneHostVM(SceneHostVM)
|
||||
Return Not IsNothing(LibMap.refSceneHostVM)
|
||||
End Function
|
||||
|
||||
'Friend Function SetRefShowPanelVM(ShowPanelVM As ShowPanelVM) As Boolean
|
||||
' LibMap.SetRefShowPanelVM(ShowPanelVM)
|
||||
' Return Not IsNothing(LibMap.refShowPanelVM)
|
||||
'End Function
|
||||
|
||||
Public Function SetRefMachinePanelVM(MachinePanelVM As MachinePanelVM) As Boolean
|
||||
m_refMachinePanelVM = MachinePanelVM
|
||||
Return Not IsNothing(m_refMachinePanelVM)
|
||||
End Function
|
||||
|
||||
'Friend Function SetRefLeftPanelVM(LeftPanelVM As LeftPanelVM) As Boolean
|
||||
' m_refLeftPanelVM = LeftPanelVM
|
||||
' Return Not IsNothing(m_refLeftPanelVM)
|
||||
'End Function
|
||||
|
||||
Public Function SetRefMachGroupPanelVM(MachGroupPanelVM As MyMachGroupPanelVM) As Boolean
|
||||
m_refMyMachGroupPanelVM = MachGroupPanelVM
|
||||
Return Not IsNothing(m_refMyMachGroupPanelVM)
|
||||
End Function
|
||||
|
||||
'Friend Function SetRefBottomPanelVM(BottomPanelVM As BottomPanelVM) As Boolean
|
||||
' m_refBottomPanelVM = BottomPanelVM
|
||||
' Return Not IsNothing(m_refBottomPanelVM)
|
||||
'End Function
|
||||
|
||||
'Friend Function SetRefShowBeamPanelVM(ShowBeamPanelVM As ShowBeamPanelVM) As Boolean
|
||||
' m_refShowBeamPanelVM = ShowBeamPanelVM
|
||||
' Return Not IsNothing(m_refShowBeamPanelVM)
|
||||
'End Function
|
||||
|
||||
'Friend Function SetRefConfigurationPageVM(ConfigurationPageVM As ConfigurationPageVM) As Boolean
|
||||
' m_refConfigurationPageVM = ConfigurationPageVM
|
||||
' Return Not IsNothing(m_refConfigurationPageVM)
|
||||
'End Function
|
||||
|
||||
'Friend Function SetRefRawPartListVM(RawPartListVM As RawPartListVM) As Boolean
|
||||
' m_refRawPartListVM = RawPartListVM
|
||||
' Return Not IsNothing(m_refRawPartListVM)
|
||||
'End Function
|
||||
|
||||
'Friend Function SetRefPartInRawPartListVM(PartInRawPartListVM As PartInRawPartListVM) As Boolean
|
||||
' m_refPartInRawPartListVM = PartInRawPartListVM
|
||||
' Return Not IsNothing(m_refPartInRawPartListVM)
|
||||
'End Function
|
||||
|
||||
'Friend Function SetRefWarehouseWndVM(WarehouseWndVM As WarehouseWndVM) As Boolean
|
||||
' m_refWarehouseWndVM = WarehouseWndVM
|
||||
' Return Not IsNothing(m_refWarehouseWndVM)
|
||||
'End Function
|
||||
|
||||
'Friend Function SetRefFeatureListVM(FeatureListVM As FeatureListVM) As Boolean
|
||||
' m_refFeatureListVM = FeatureListVM
|
||||
' Return Not IsNothing(m_refFeatureListVM)
|
||||
'End Function
|
||||
|
||||
'Friend Function SetRefFreeContourManagerVM(FreeContourManagerVM As FreeContourManagerVM) As Boolean
|
||||
' m_refFreeContourManagerVM = FreeContourManagerVM
|
||||
' Return Not IsNothing(m_refFreeContourManagerVM)
|
||||
'End Function
|
||||
|
||||
'Friend Function SetRefFreeContourInputVM(FreeContourInputVM As FreeContourInputVM) As Boolean
|
||||
' m_refFreeContourInputVM = FreeContourInputVM
|
||||
' Return Not IsNothing(m_refFreeContourInputVM)
|
||||
'End Function
|
||||
|
||||
'Friend Function SetRefPartManagerVM(PartManagerVM As PartManagerVM) As Boolean
|
||||
' m_refPartManagerVM = PartManagerVM
|
||||
' Return Not IsNothing(m_refPartManagerVM)
|
||||
'End Function
|
||||
|
||||
'Friend Function SetRefInstrumentPanelVM(InstrumentPanelVM As InstrumentPanelVM) As Boolean
|
||||
' m_refInstrumentPanelVM = InstrumentPanelVM
|
||||
' Return Not IsNothing(m_refInstrumentPanelVM)
|
||||
'End Function
|
||||
|
||||
'Friend Function SetRefTopPanelVM(TopPanelVM As TopPanelVM) As Boolean
|
||||
' m_refTopPanelVM = TopPanelVM
|
||||
' Return Not IsNothing(m_refTopPanelVM)
|
||||
'End Function
|
||||
|
||||
'Friend Function SetRefOptimizePanelVM(OptimizePanelVM As OptimizePanelVM) As Boolean
|
||||
' m_refOptimizePanelVM = OptimizePanelVM
|
||||
' Return Not IsNothing(m_refOptimizePanelVM)
|
||||
'End Function
|
||||
|
||||
'Friend Function SetRefOpenProjectFileDialogVM(OpenProjectFileDialogVM As OpenProjectFileDialogVM) As Boolean
|
||||
' m_refOpenProjectFileDialogVM = OpenProjectFileDialogVM
|
||||
' Return Not IsNothing(m_refOpenProjectFileDialogVM)
|
||||
'End Function
|
||||
|
||||
#End Region ' Set
|
||||
|
||||
#Region "Init"
|
||||
|
||||
'Friend Function BeginInit(MainWindowVM As MainWindowVM) As Boolean
|
||||
' m_refMainWindowVM = MainWindowVM
|
||||
' Return Not IsNothing(m_refMainWindowVM)
|
||||
'End Function
|
||||
Friend Function EndInit() As Boolean
|
||||
'Return Not IsNothing(m_refMainWindowVM) AndAlso Not IsNothing(m_refMainMenuVM) AndAlso
|
||||
' Not IsNothing(LibMap.refStatusBarVM) AndAlso Not IsNothing(m_refProjManagerVM) AndAlso
|
||||
' Not IsNothing(m_refProdManagerVM) AndAlso Not IsNothing(m_refConfigurationPageVM) AndAlso
|
||||
' Not IsNothing(LibMap.refSceneHostVM) AndAlso Not IsNothing(LibMap.refShowPanelVM) AndAlso
|
||||
' Not IsNothing(m_refMachinePanelVM) AndAlso Not IsNothing(LibMap.refMachGroupPanelVM) AndAlso
|
||||
' Not IsNothing(m_refRawPartListVM) AndAlso Not IsNothing(m_refWarehouseWndVM) AndAlso
|
||||
' Not IsNothing(m_refFeatureListVM) AndAlso Not IsNothing(m_refPartInRawPartListVM) AndAlso
|
||||
' Not IsNothing(m_refFreeContourManagerVM) AndAlso Not IsNothing(m_refFreeContourInputVM) AndAlso
|
||||
' Not IsNothing(m_refInstrumentPanelVM) AndAlso Not IsNothing(m_refTopPanelVM) AndAlso
|
||||
' Not IsNothing(m_refPartManagerVM) AndAlso Not IsNothing(m_refOptimizePanelVM) AndAlso
|
||||
' Not IsNothing(m_refShowBeamPanelVM) AndAlso Not IsNothing(m_refOpenProjectFileDialogVM) AndAlso
|
||||
' LibMap.EndInit()
|
||||
Return Not IsNothing(m_refMachinePanelVM) AndAlso Not IsNothing(LibMap.refMachGroupPanelVM)
|
||||
End Function
|
||||
|
||||
#End Region ' Init
|
||||
|
||||
End Module
|
||||
@@ -0,0 +1,121 @@
|
||||
Imports EgtBEAMWALL.Core
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Module LuaExec
|
||||
|
||||
Friend Function ExecBeam(sFile As String, sMachine As String, nFlag As Integer, bBtl As Boolean) As Boolean
|
||||
EgtOutLog("-- Start ExecBeam --")
|
||||
' Recupero lo script da eseguire
|
||||
Dim sExecPath As String = ""
|
||||
Dim sExecName As String = ""
|
||||
GetMainPrivateProfileString(S_BEAM, K_BEAMBWEEXEC, "", sExecName)
|
||||
sExecPath = (Map.refMainWindowVM.MainWindowM.sBeamRoot & "\" & sExecName).TrimEnd({"\"c})
|
||||
If Not My.Computer.FileSystem.FileExists(sExecPath) Then
|
||||
EgtOutLog("Not found BeamExec script " & sExecPath)
|
||||
Return False
|
||||
End If
|
||||
' Assegno i dati
|
||||
EgtLuaCreateGlobTable("BEAM")
|
||||
EgtLuaSetGlobStringVar("BEAM.FILE", sFile)
|
||||
EgtLuaSetGlobStringVar("BEAM.MACHINE", sMachine)
|
||||
EgtLuaSetGlobIntVar("BEAM.FLAG", nFlag)
|
||||
' Eseguo lo script
|
||||
Dim bOk As Boolean = False
|
||||
If EgtLuaExecFile(sExecPath) Then
|
||||
' Recupero i risultati
|
||||
Dim nErr As Integer = 999
|
||||
EgtLuaGetGlobIntVar("BEAM.ERR", nErr)
|
||||
bOk = (nErr <= 0)
|
||||
If Not bOk Then EgtOutLog("BeamExec Err=" & nErr.ToString())
|
||||
Else
|
||||
EgtOutLog("Error executing Beam Exec script " & sExecPath)
|
||||
Return False
|
||||
End If
|
||||
' Cancello tavola globale
|
||||
EgtLuaResetGlobVar("BEAM")
|
||||
Return bOk
|
||||
End Function
|
||||
|
||||
Friend Function ExecWall(sFile As String, sMachine As String, nFlag As Integer, bBtl As Boolean) As Boolean
|
||||
EgtOutLog("-- Start ExecWall --")
|
||||
' Recupero lo script da eseguire
|
||||
Dim sExecPath As String = ""
|
||||
Dim sExecName As String = ""
|
||||
GetMainPrivateProfileString(S_WALL, K_WALLBWEEXEC, "", sExecName)
|
||||
sExecPath = (Map.refMainWindowVM.MainWindowM.sWallRoot & "\" & sExecName).TrimEnd({"\"c})
|
||||
If Not My.Computer.FileSystem.FileExists(sExecPath) Then
|
||||
EgtOutLog("Not found WallExec script " & sExecPath)
|
||||
Return False
|
||||
End If
|
||||
' Assegno i dati
|
||||
EgtLuaCreateGlobTable("WALL")
|
||||
EgtLuaSetGlobStringVar("WALL.FILE", sFile)
|
||||
EgtLuaSetGlobStringVar("WALL.MACHINE", sMachine)
|
||||
EgtLuaSetGlobIntVar("WALL.FLAG", nFlag)
|
||||
' Eseguo lo script
|
||||
Dim bOk As Boolean = False
|
||||
If EgtLuaExecFile(sExecPath) Then
|
||||
' Recupero i risultati
|
||||
Dim nErr As Integer = 999
|
||||
EgtLuaGetGlobIntVar("WALL.ERR", nErr)
|
||||
bOk = (nErr <= 0)
|
||||
If Not bOk Then EgtOutLog("WallExec Err=" & nErr.ToString())
|
||||
Else
|
||||
bOk = False
|
||||
EgtOutLog("Error executing Wall Exec script " & sExecPath)
|
||||
End If
|
||||
' Cancello tavola globale
|
||||
EgtLuaResetGlobVar("WALL")
|
||||
Return bOk
|
||||
End Function
|
||||
|
||||
Friend Function ExecNesting(sFile As String, sMachine As String, PartList As List(Of BTLPartM), dLength As Double, dWidth As Double, dStartOffset As Double, dOffset As Double, dKerf As Double) As Boolean
|
||||
EgtOutLog("-- Start ExecNest --")
|
||||
' Recupero lo script da eseguire
|
||||
Dim sExecPath As String = ""
|
||||
Dim sExecName As String = ""
|
||||
GetMainPrivateProfileString(S_NEST, K_NESTEXEC, "", sExecName)
|
||||
Dim sRoot As String = ""
|
||||
If Map.refMachinePanelVM.SelectedMachine.nType = MachineType.BEAM Then
|
||||
sRoot = Map.refMainWindowVM.MainWindowM.sBeamRoot
|
||||
ElseIf Map.refMachinePanelVM.SelectedMachine.nType = MachineType.WALL Then
|
||||
sRoot = Map.refMainWindowVM.MainWindowM.sWallRoot
|
||||
End If
|
||||
sExecPath = (sRoot & "\" & sExecName).TrimEnd({"\"c})
|
||||
If Not My.Computer.FileSystem.FileExists(sExecPath) Then
|
||||
EgtOutLog("Not found NestExec script " & sExecPath)
|
||||
Return False
|
||||
End If
|
||||
' Assegno i dati
|
||||
EgtLuaCreateGlobTable("NEST")
|
||||
EgtLuaSetGlobStringVar("NEST.FILE", sFile)
|
||||
EgtLuaSetGlobStringVar("NEST.MACHINE", sMachine)
|
||||
EgtLuaSetGlobNumVar("NEST.LEN", dLength)
|
||||
EgtLuaSetGlobNumVar("NEST.WIDTH", dWidth)
|
||||
EgtLuaSetGlobNumVar("NEST.STARTOFFSET", dStartOffset)
|
||||
EgtLuaSetGlobNumVar("NEST.OFFSET", dOffset)
|
||||
EgtLuaSetGlobNumVar("NEST.KERF", dKerf)
|
||||
EgtLuaCreateGlobTable("PART")
|
||||
For PartIndex = 0 To PartList.Count - 1
|
||||
EgtLuaSetGlobIntVar("PART." & PartList(PartIndex).nPartId.ToString(), PartList(PartIndex).nCNT - PartList(PartIndex).nINPROD)
|
||||
Next
|
||||
' Eseguo lo script
|
||||
Dim bOk As Boolean = False
|
||||
If EgtLuaExecFile(sExecPath) Then
|
||||
' Recupero i risultati
|
||||
Dim nErr As Integer = 999
|
||||
EgtLuaGetGlobIntVar("NEST.ERR", nErr)
|
||||
bOk = (nErr <= 0)
|
||||
If Not bOk Then EgtOutLog("NestExec Err=" & nErr.ToString())
|
||||
Else
|
||||
bOk = False
|
||||
EgtOutLog("Error executing Nest Exec script " & sExecPath)
|
||||
End If
|
||||
' Cancello tavola globale
|
||||
EgtLuaResetGlobVar("NEST")
|
||||
EgtLuaResetGlobVar("PART")
|
||||
Return bOk
|
||||
End Function
|
||||
|
||||
End Module
|
||||
@@ -1,47 +0,0 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.IO
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class Wall
|
||||
Inherits Part
|
||||
|
||||
Protected m_dPOSY As Double
|
||||
Public Property dPOSY As Double
|
||||
Get
|
||||
Return m_dPOSY
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_dPOSY = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_dROT As Double
|
||||
Public Property dROT As Double
|
||||
Get
|
||||
Return m_dROT
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_dROT = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_dFLIP As Double
|
||||
Public Property dFLIP As Double
|
||||
Get
|
||||
Return m_dFLIP
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_dFLIP = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Sub New(nParentMachGroup As MyMachGroup, nPartId As Integer)
|
||||
MyBase.New(nParentMachGroup, nPartId)
|
||||
End Sub
|
||||
|
||||
#End Region ' CONSTRUCTOR
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,110 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.IO
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class WallM
|
||||
Inherits PartM
|
||||
|
||||
Protected m_dPOSY As Double
|
||||
Public Property dPOSY As Double
|
||||
Get
|
||||
Return m_dPOSY
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_dPOSY = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_dROT As Double
|
||||
Public Property dROT As Double
|
||||
Get
|
||||
Return m_dROT
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_dROT = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_bFLIP As Boolean
|
||||
Public Property bFLIP As Boolean
|
||||
Get
|
||||
Return m_bFLIP
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_bFLIP = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Protected Sub New(nParentMachGroup As MyMachGroupM, nPartId As Integer)
|
||||
MyBase.New(nParentMachGroup, nPartId)
|
||||
End Sub
|
||||
|
||||
Public Shared Function CreateWall(nParentMachGroup As MyMachGroupM, nPartId As Integer, nRawPartId As Integer) As WallM
|
||||
Dim NewWallM As New WallM(nParentMachGroup, nPartId)
|
||||
' leggo info pezzo
|
||||
EgtGetInfo(nPartId, BTL_PRT_PROJ, NewWallM.m_nProjId)
|
||||
EgtGetInfo(nPartId, BTL_PRT_PDN, NewWallM.m_nPDN)
|
||||
EgtGetInfo(nPartId, BTL_PRT_NAM, NewWallM.m_sNAM)
|
||||
EgtGetInfo(nPartId, BTL_PRT_L, NewWallM.m_dBtlL)
|
||||
EgtGetInfo(nPartId, BTL_PRT_W, NewWallM.m_dBtlW)
|
||||
EgtGetInfo(nPartId, BTL_PRT_H, NewWallM.m_dBtlH)
|
||||
EgtGetInfo(nPartId, BTL_PRT_CNT, NewWallM.m_nCNT)
|
||||
Dim nTemp As Integer = 0
|
||||
If Not EgtGetInfo(nPartId, BTL_PRT_ROTATED, nTemp) Then
|
||||
nTemp = 0
|
||||
End If
|
||||
NewWallM.SetRotated(nTemp)
|
||||
If Not EgtGetInfo(nPartId, BTL_PRT_INVERTED, nTemp) Then
|
||||
nTemp = 0
|
||||
End If
|
||||
NewWallM.SetInverted(nTemp)
|
||||
' leggo PosX, PosY, Rot e Flip
|
||||
EgtGetInfo(nPartId, MGR_PRT_POSX, NewWallM.m_dPOSX)
|
||||
EgtGetInfo(nPartId, MGR_PRT_POSY, NewWallM.m_dPOSY)
|
||||
EgtGetInfo(nPartId, MGR_PRT_ROT, NewWallM.m_dROT)
|
||||
EgtGetInfo(nPartId, MGR_PRT_FLIP, NewWallM.m_bFLIP)
|
||||
' leggo feature
|
||||
NewWallM.m_FeatureMList = LoadBTLFeatures(nPartId)
|
||||
ReadMachGroupData(NewWallM)
|
||||
Return NewWallM
|
||||
End Function
|
||||
|
||||
#End Region ' CONSTRUCTOR
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Private Shared Function LoadBTLFeatures(nPartId As Integer) As List(Of BTLFeatureM)
|
||||
Dim TempList As New List(Of BTLFeatureM)
|
||||
' Aggiungo outline
|
||||
Dim nOutLayerId As Integer = EgtGetFirstNameInGroup(nPartId, OUTLINE)
|
||||
Dim nOutlineId As Integer = EgtGetFirstInGroup(nOutLayerId)
|
||||
While nOutlineId <> GDB_ID.NULL
|
||||
' verifico che sia una feature
|
||||
Dim nGRP As Integer
|
||||
If EgtGetInfo(nOutlineId, BTL_FTR_GRP, nGRP) AndAlso Not EgtExistsInfo(nOutlineId, BTL_FTR_MAINID) Then
|
||||
' creo la feature
|
||||
TempList.Add(BTLFeatureM.CreateBTLFeature(Nothing, nOutlineId))
|
||||
End If
|
||||
nOutlineId = EgtGetNext(nOutlineId)
|
||||
End While
|
||||
' Aggiungo feature
|
||||
Dim nProcessingId As Integer = EgtGetFirstNameInGroup(nPartId, PROCESSINGS)
|
||||
Dim nFeatureId As Integer = EgtGetFirstInGroup(nProcessingId)
|
||||
While nFeatureId <> GDB_ID.NULL
|
||||
' verifico che sia una feature
|
||||
Dim nGRP As Integer
|
||||
If EgtGetInfo(nFeatureId, BTL_FTR_GRP, nGRP) AndAlso Not EgtExistsInfo(nFeatureId, BTL_FTR_MAINID) Then
|
||||
' creo la feature
|
||||
TempList.Add(BTLFeatureM.CreateBTLFeature(Nothing, nFeatureId))
|
||||
End If
|
||||
nFeatureId = EgtGetNext(nFeatureId)
|
||||
End While
|
||||
Return TempList
|
||||
End Function
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
End Class
|
||||
@@ -1,45 +0,0 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.IO
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class WallMachGroup
|
||||
Inherits MyMachGroup
|
||||
|
||||
Protected m_nRawPartId As Integer = GDB_ID.NULL
|
||||
Public ReadOnly Property nRawPartId As Integer
|
||||
Get
|
||||
Return m_nRawPartId
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Sub New(nId As Integer, sName As String, sMachine As String)
|
||||
MyBase.New(nId, sName, sMachine)
|
||||
SetMachineType(MachineType.WALL)
|
||||
m_nRawPartId = EgtGetFirstRawPart()
|
||||
EgtGetInfo(nId, MGR_RPT_PANELLEN, dL)
|
||||
EgtGetInfo(nId, MGR_RPT_PANELWIDTH, dW)
|
||||
EgtGetInfo(nId, MGR_RPT_PANELHEIGHT, dH)
|
||||
m_dTotMat = dL * dW
|
||||
For Each Part In PartList
|
||||
m_dMatForPart += (Part.dL * Part.dW)
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Public Overrides Sub RefreshPartList()
|
||||
m_nRawPartId = EgtGetFirstRawPart()
|
||||
PartList.Clear()
|
||||
Dim nPartId As Integer = EgtGetFirstPartInRawPart(m_nRawPartId)
|
||||
While nPartId <> GDB_ID.NULL
|
||||
PartList.Add(New Wall(Me, nPartId))
|
||||
nPartId = EgtGetNextPartInRawPart(nPartId)
|
||||
End While
|
||||
End Sub
|
||||
|
||||
Public Overrides Sub RefreshGroupData()
|
||||
EgtGetInfo(Id, MGR_RPT_PANELLEN, dL)
|
||||
EgtGetInfo(Id, MGR_RPT_PANELWIDTH, dW)
|
||||
EgtGetInfo(Id, MGR_RPT_PANELHEIGHT, dH)
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,103 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.IO
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class WallMachGroupM
|
||||
Inherits MyMachGroupM
|
||||
|
||||
Protected m_nRawPartId As Integer = GDB_ID.NULL
|
||||
Public ReadOnly Property nRawPartId As Integer
|
||||
Get
|
||||
Return m_nRawPartId
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#Region "CONSTRUCTORS"
|
||||
|
||||
Protected Sub New()
|
||||
End Sub
|
||||
|
||||
Public Shared Function CreateNewWallMachGroup() As MachGroupM
|
||||
Return New MachGroupM
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateWallMachGroup(nId As Integer, sName As String, sMachine As String) As MachGroupM
|
||||
Dim NewMachGroupM As New WallMachGroupM
|
||||
NewMachGroupM.m_Id = nId
|
||||
NewMachGroupM.m_Name = sName
|
||||
NewMachGroupM.m_Machine = sMachine
|
||||
NewMachGroupM.SetMachineType(MachineType.WALL)
|
||||
NewMachGroupM.m_nRawPartId = EgtGetFirstRawPart()
|
||||
EgtGetInfo(NewMachGroupM.m_Id, MGR_RPT_PANELLEN, NewMachGroupM.m_dL)
|
||||
EgtGetInfo(NewMachGroupM.m_Id, MGR_RPT_PANELWIDTH, NewMachGroupM.m_dW)
|
||||
EgtGetInfo(NewMachGroupM.m_Id, MGR_RPT_PANELHEIGHT, NewMachGroupM.m_dH)
|
||||
NewMachGroupM.m_dTotMat = NewMachGroupM.m_dL * NewMachGroupM.m_dW
|
||||
NewMachGroupM.m_PartMList = LoadParts(NewMachGroupM)
|
||||
For Each Part In NewMachGroupM.m_PartMList
|
||||
NewMachGroupM.m_dMatForPart += (Part.dL * Part.dW)
|
||||
Next
|
||||
ReadMachGroupData(NewMachGroupM)
|
||||
Return NewMachGroupM
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateWallMachGroup(sName As String, sMachine As String) As MachGroupM
|
||||
Dim NewMachGroupM As New WallMachGroupM
|
||||
' Creo il nuovo gruppo di lavorazione con i dati ottenuti a seconda del caso in cui mi trovo
|
||||
NewMachGroupM.m_Id = EgtAddMachGroup(sName, sMachine)
|
||||
If NewMachGroupM.m_Id = GDB_ID.NULL Then Return Nothing
|
||||
NewMachGroupM.m_Name = sName
|
||||
NewMachGroupM.m_Machine = sMachine
|
||||
NewMachGroupM.SetMachineType(MachineType.WALL)
|
||||
NewMachGroupM.m_nRawPartId = EgtGetFirstRawPart()
|
||||
EgtGetInfo(NewMachGroupM.m_Id, MGR_RPT_PANELLEN, NewMachGroupM.m_dL)
|
||||
EgtGetInfo(NewMachGroupM.m_Id, MGR_RPT_PANELWIDTH, NewMachGroupM.m_dW)
|
||||
EgtGetInfo(NewMachGroupM.m_Id, MGR_RPT_PANELHEIGHT, NewMachGroupM.m_dH)
|
||||
NewMachGroupM.m_dTotMat = NewMachGroupM.m_dL * NewMachGroupM.m_dW
|
||||
For Each Part In NewMachGroupM.m_PartMList
|
||||
NewMachGroupM.m_dMatForPart += (Part.dL * Part.dW)
|
||||
Next
|
||||
ReadMachGroupData(NewMachGroupM)
|
||||
Return NewMachGroupM
|
||||
End Function
|
||||
|
||||
#End Region ' CONSTRUCTORS
|
||||
|
||||
Private Shared Function LoadParts(NewWallMachGroupM As WallMachGroupM) As List(Of PartM)
|
||||
Dim TempList As New List(Of PartM)
|
||||
Dim nWallId As Integer = EgtGetFirstPartInRawPart(NewWallMachGroupM.m_nRawPartId)
|
||||
While nWallId <> GDB_ID.NULL
|
||||
If nWallId <> GDB_ID.NULL Then
|
||||
Dim NewWall As WallM = WallM.CreateWall(NewWallMachGroupM, nWallId, NewWallMachGroupM.m_nRawPartId)
|
||||
TempList.Add(NewWall)
|
||||
End If
|
||||
nWallId = EgtGetNextPartInRawPart(nWallId)
|
||||
End While
|
||||
Return TempList
|
||||
End Function
|
||||
|
||||
Public Overrides Sub RefreshPartList()
|
||||
' aggiorno lista pezzi
|
||||
RemoveAllParts()
|
||||
Dim nRawPartId As Integer = EgtGetFirstRawPart()
|
||||
If nRawPartId <> GDB_ID.NULL Then
|
||||
Me.m_nRawPartId = nRawPartId
|
||||
End If
|
||||
Dim nWallId As Integer = EgtGetFirstPartInRawPart(m_nRawPartId)
|
||||
While nWallId <> GDB_ID.NULL
|
||||
If nWallId <> GDB_ID.NULL Then
|
||||
Dim NewWall As WallM = WallM.CreateWall(Me, nWallId, m_nRawPartId)
|
||||
AddPart(NewWall)
|
||||
End If
|
||||
nWallId = EgtGetNextPartInRawPart(nWallId)
|
||||
End While
|
||||
End Sub
|
||||
|
||||
Public Overrides Sub RefreshGroupData()
|
||||
EgtGetInfo(Id, MGR_RPT_PANELLEN, dL)
|
||||
EgtGetInfo(Id, MGR_RPT_PANELWIDTH, dW)
|
||||
EgtGetInfo(Id, MGR_RPT_PANELHEIGHT, dH)
|
||||
EgtGetInfo(Id, MGR_RPT_MATERIAL, sMATERIAL)
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Entity;
|
||||
using System.Data.Entity.Migrations;
|
||||
using MySql.Data.Entity;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
using EgtBEAMWALL.DataLayer.Migrations;
|
||||
using System.ServiceProcess;
|
||||
using System.IO;
|
||||
using System.Data.Entity.Infrastructure;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer
|
||||
{
|
||||
[DbConfigurationType(typeof(MySqlEFConfiguration))]
|
||||
//[DbConfigurationType(typeof(aMySqlConfiguration))]
|
||||
public class AdminContext : DbContext
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
[Obsolete("This constructor should never be used directly, and is only needed to generate entityframework stuff. Connection string can be adapted as pleased.")]
|
||||
public AdminContext() : base("DefaultConnection")
|
||||
{
|
||||
}
|
||||
|
||||
public AdminContext(string connectionString) : base(connectionString)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// User management
|
||||
/// </summary>
|
||||
public DbSet<UserPriv> UserList { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -1,35 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
|
||||
<section name="entityFramework"
|
||||
type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||
requirePermission="false"/>
|
||||
</configSections>
|
||||
<entityFramework>
|
||||
<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6"/>
|
||||
<providers>
|
||||
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
|
||||
|
||||
<provider invariantName="MySql.Data.MySqlClient"
|
||||
type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d">
|
||||
</provider></providers>
|
||||
</entityFramework>
|
||||
<connectionStrings>
|
||||
<add name="DefaultConnection"
|
||||
connectionString="server=localhost;port=3306;User Id=EgtUser;password=viacremasca;Persist Security Info=True;database=EgtBwDb;SslMode=none"
|
||||
providerName="MySql.Data.MySqlClient"/>
|
||||
</connectionStrings>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.10.9.0" newVersion="6.10.9.0"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
|
||||
</startup>
|
||||
<configSections>
|
||||
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
|
||||
<section name="entityFramework"
|
||||
type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||
requirePermission="false" />
|
||||
</configSections>
|
||||
<entityFramework>
|
||||
<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6" />
|
||||
<providers>
|
||||
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
|
||||
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
|
||||
</providers>
|
||||
</entityFramework>
|
||||
<connectionStrings>
|
||||
<add name="DefaultConnection"
|
||||
connectionString="server=localhost;port=3306;User Id=EgtUser;password=viacremasca;Persist Security Info=True;database=EgtBwDb;SslMode=none"
|
||||
providerName="MySql.Data.MySqlClient" />
|
||||
</connectionStrings>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.10.9.0" newVersion="6.10.9.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||
</startup>
|
||||
</configuration>
|
||||
@@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer
|
||||
{
|
||||
public static class Constants
|
||||
{
|
||||
|
||||
// Database config
|
||||
public const string DATABASE_SERV = "127.0.0.1";
|
||||
public const string DATABASE_NAME = "EgtBwDb";
|
||||
public const string DATABASE_USER = "EgtUser";
|
||||
public const string DATABASE_PWD = "viacremasca";
|
||||
public static int DATABASE_PROCESS_TIMEOUT = 5;
|
||||
|
||||
public static string CONNECTION_STRING = $"server={DATABASE_SERV};port=3306;database={DATABASE_NAME};uid={DATABASE_USER};pwd={DATABASE_PWD};sslmode=None";
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public BTLPartController()
|
||||
{
|
||||
// Initialize database context
|
||||
dbCtx = new DatabaseContext(Constants.CONNECTION_STRING);
|
||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
@@ -43,9 +43,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
PDN = corePart.nPDN,
|
||||
DO = corePart.bDO,
|
||||
NAM = corePart.sNAM,
|
||||
W = corePart.dW,
|
||||
L = corePart.dL,
|
||||
H = corePart.dH,
|
||||
W = corePart.dBtlW,
|
||||
L = corePart.dBtlL,
|
||||
H = corePart.dBtlH,
|
||||
Material = corePart.sMATERIAL,
|
||||
CNT = corePart.nCNT,
|
||||
//TBP = corePart.nTBP,
|
||||
@@ -76,9 +76,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
PDN = corePart.nPDN,
|
||||
DO = corePart.bDO,
|
||||
NAM = corePart.sNAM,
|
||||
W = corePart.dW,
|
||||
L = corePart.dL,
|
||||
H = corePart.dH,
|
||||
W = corePart.dBtlW,
|
||||
L = corePart.dBtlL,
|
||||
H = corePart.dBtlH,
|
||||
Material = corePart.sMATERIAL,
|
||||
CNT = corePart.nCNT,
|
||||
//TBP = corePart.nTBP,
|
||||
@@ -109,6 +109,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
dbCtx.BTLPartList.AddRange(partData);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
@@ -150,6 +151,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
dbCtx.BTLPartList.AddRange(partData);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
@@ -177,6 +179,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
dbCtx.BTLPartList.Remove(item2del);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
@@ -203,6 +206,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
dbCtx.BTLPartList.RemoveRange(items2del);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
@@ -330,6 +334,15 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reinizializzaizone del controller
|
||||
/// </summary>
|
||||
public void ResetController()
|
||||
{
|
||||
// Re-Initialize database context
|
||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update single BTLPart
|
||||
/// </summary>
|
||||
@@ -359,6 +372,8 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on Update: {exc}");
|
||||
}
|
||||
// reset...
|
||||
ResetController();
|
||||
return done;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,62 +6,92 @@ using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
public class DbController : IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
public class DbController : IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private DatabaseContext dbCtx;
|
||||
private AdminContext adbCtx;
|
||||
|
||||
#endregion Private Fields
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Fields
|
||||
#region Public Fields
|
||||
|
||||
/// <summary>
|
||||
/// Singleton gestione
|
||||
/// </summary>
|
||||
public static DbController man = new DbController();
|
||||
/// <summary>
|
||||
/// Singleton gestione
|
||||
/// </summary>
|
||||
public static DbController man = new DbController();
|
||||
|
||||
#endregion Public Fields
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Constructors
|
||||
#region Public Constructors
|
||||
|
||||
public DbController()
|
||||
{
|
||||
// Initialize database context
|
||||
dbCtx = new DatabaseContext(Constants.CONNECTION_STRING);
|
||||
}
|
||||
public DbController()
|
||||
{
|
||||
// Initialize database context for ADMIN
|
||||
adbCtx = new AdminContext(DbConfig.ADMIN_CONNECTION_STRING);
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database context
|
||||
dbCtx.Dispose();
|
||||
}
|
||||
public bool checkCreateUser(string username, string pwd)
|
||||
{
|
||||
bool answ = false;
|
||||
// ricerca utente...
|
||||
var numUser = adbCtx
|
||||
.UserList
|
||||
.Where(x => x.User == username)
|
||||
.ToList()
|
||||
.Count;
|
||||
if (numUser > 0)
|
||||
{
|
||||
answ = true;
|
||||
}
|
||||
if (!answ)
|
||||
{
|
||||
// creo utente
|
||||
string sqlCommand = "FLUSH PRIVILEGES;";
|
||||
//string sqlCommand = $"CREATE USER '{username}'@'localhost' IDENTIFIED BY '{pwd}'; GRANT ALL ON *.* TO '{username}'@'localhost'; FLUSH PRIVILEGES;";
|
||||
//string sqlCommand = $"CREATE USER '{username}'@'localhost' IDENTIFIED BY '{pwd}'; GRANT ALL ON *.* TO '{username}'@'localhost'; FLUSH PRIVILEGES;";
|
||||
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
|
||||
sqlCommand = $"CREATE USER '{username}'@'localhost' IDENTIFIED BY '{pwd}';";
|
||||
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
|
||||
sqlCommand = $"GRANT ALL ON *.* TO '{username}'@'localhost';";
|
||||
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
|
||||
sqlCommand = "FLUSH PRIVILEGES;";
|
||||
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
public bool ResetDb()
|
||||
{
|
||||
bool answ = false;
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database context
|
||||
adbCtx.Dispose();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
dbCtx
|
||||
.Database
|
||||
.SqlQuery<int>("CALL stp_ResetDb()");
|
||||
answ = true;
|
||||
public bool ResetDb()
|
||||
{
|
||||
bool answ = false;
|
||||
|
||||
dbCtx.SaveChanges();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on ResetDb: {exc}");
|
||||
}
|
||||
try
|
||||
{
|
||||
adbCtx
|
||||
.Database
|
||||
.SqlQuery<int>("CALL stp_ResetDb()");
|
||||
answ = true;
|
||||
|
||||
return answ;
|
||||
}
|
||||
adbCtx.SaveChanges();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on ResetDb: {exc}");
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,230 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
public class LogMachineController : IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private DatabaseContext dbCtx;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public LogMachineController()
|
||||
{
|
||||
// Initialize database context
|
||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Conversion of base class to DB model class
|
||||
/// </summary>
|
||||
/// <param name="coreMacLog"></param>
|
||||
/// <returns></returns>
|
||||
public static LogMachineModel ConvertFromCore(Core.MachLog coreMacLog)
|
||||
{
|
||||
LogMachineModel answ = new LogMachineModel();
|
||||
if (coreMacLog != null)
|
||||
{
|
||||
answ = new LogMachineModel()
|
||||
{
|
||||
AlarmCode = coreMacLog.AlarmCode,
|
||||
AlarmDatetime = coreMacLog.AlarmDateTime,
|
||||
AlarmMessage = coreMacLog.AlarmMessage,
|
||||
AlarmOperation = coreMacLog.AlarmOperation,
|
||||
AlarmType = coreMacLog.AlarmType,
|
||||
CommandExecutedCorrectly = coreMacLog.CommandExecutedCorrectly,
|
||||
CommandState = coreMacLog.CommandState,
|
||||
CommandType = coreMacLog.CommandType,
|
||||
Description = coreMacLog.Description,
|
||||
NewOpState = coreMacLog.newOpState,
|
||||
ResultType = coreMacLog.ResultType,
|
||||
VarAddress = coreMacLog.VarAddress,
|
||||
VarValue = coreMacLog.VarValue
|
||||
};
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Conversion from DB to Core class
|
||||
/// </summary>
|
||||
/// <param name="dbLog"></param>
|
||||
/// <returns></returns>
|
||||
public static Core.MachLog ConvertToCore(LogMachineModel dbLog)
|
||||
{
|
||||
var newRecord = Core.MachLog.CreateMacLog(dbLog.AlarmCode, dbLog.AlarmDatetime, dbLog.AlarmMessage, dbLog.AlarmOperation, dbLog.AlarmType, dbLog.CommandExecutedCorrectly, dbLog.CommandState, dbLog.CommandType, dbLog.Description, dbLog.NewOpState, dbLog.ResultType, dbLog.VarAddress, dbLog.VarValue);
|
||||
return newRecord;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create machine LOG record
|
||||
/// </summary>
|
||||
/// <param name="newLogMac"></param>
|
||||
/// <returns></returns>
|
||||
public bool Create(LogMachineModel newLogMac)
|
||||
{
|
||||
bool fatto = false;
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var currDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// Add to database
|
||||
currDbCtx.LogMachineList.Add(newLogMac);
|
||||
// Commit changes
|
||||
currDbCtx.SaveChanges();
|
||||
ResetController();
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on Create LogMachine: {exc}");
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create machine LOG record (da modello dati CORE)
|
||||
/// </summary>
|
||||
/// <param name="newLogMac"></param>
|
||||
/// <returns></returns>
|
||||
public bool Create(Core.MachLog newMachLog)
|
||||
{
|
||||
var dbLogModel = ConvertFromCore(newMachLog);
|
||||
return Create(dbLogModel);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete by key
|
||||
/// </summary>
|
||||
/// <param name="LogDbId"></param>
|
||||
/// <returns></returns>
|
||||
public bool DeleteByKey(int LogDbId)
|
||||
{
|
||||
bool done = false;
|
||||
var items2del = dbCtx
|
||||
.LogMachineList
|
||||
.Where(x => x.LogDbId == LogDbId);
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
dbCtx.LogMachineList.RemoveRange(items2del);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on DeleteByKey: {exc}");
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database context
|
||||
dbCtx.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get record by LogDbId
|
||||
/// </summary>
|
||||
/// <param name="LogDbId"></param>
|
||||
/// <returns></returns>
|
||||
public LogMachineModel FindByDbId(int LogDbId)
|
||||
{
|
||||
return dbCtx
|
||||
.LogMachineList
|
||||
.Where(x => x.LogDbId == LogDbId)
|
||||
.SingleOrDefault();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get paginated data from DB (ASC ordered)
|
||||
/// </summary>
|
||||
/// <param name="dtStart"></param>
|
||||
/// <param name="dtEnd"></param>
|
||||
/// <returns></returns>
|
||||
public List<LogMachineModel> GetAsc(DateTime dtStart, DateTime dtEnd)
|
||||
{
|
||||
// retrieve
|
||||
return dbCtx
|
||||
.LogMachineList
|
||||
.Where(x => x.AlarmDatetime >= dtStart && x.AlarmDatetime <= dtEnd)
|
||||
.OrderBy(x => x.AlarmDatetime)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get paginated data from DB (DESC ordered)
|
||||
/// </summary>
|
||||
/// <param name="dtStart"></param>
|
||||
/// <param name="dtEnd"></param>
|
||||
/// <returns></returns>
|
||||
public List<LogMachineModel> GetDesc(DateTime dtStart, DateTime dtEnd)
|
||||
{
|
||||
// retrieve
|
||||
return dbCtx
|
||||
.LogMachineList
|
||||
.Where(x => x.AlarmDatetime >= dtStart && x.AlarmDatetime <= dtEnd)
|
||||
.OrderByDescending(x => x.AlarmDatetime)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reinizializzaizone del controller
|
||||
/// </summary>
|
||||
public void ResetController()
|
||||
{
|
||||
// Re-Initialize database context
|
||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update single LogMachineModel
|
||||
/// </summary>
|
||||
/// <param name="updItem"></param>
|
||||
/// <returns></returns>
|
||||
public bool Update(LogMachineModel updItem)
|
||||
{
|
||||
bool done = false;
|
||||
var item2update = dbCtx
|
||||
.LogMachineList
|
||||
.Where(x => x.LogDbId == updItem.LogDbId)
|
||||
.SingleOrDefault();
|
||||
try
|
||||
{
|
||||
// update, vers 1...
|
||||
dbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on Update: {exc}");
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
public class LogSupportController : IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private DatabaseContext dbCtx;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public LogSupportController()
|
||||
{
|
||||
// Initialize database context
|
||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Create support LOG record
|
||||
/// </summary>
|
||||
/// <param name="dtCreated"></param>
|
||||
/// <param name="fileName"></param>
|
||||
/// <param name="dtExported"></param>
|
||||
/// <param name="sn"></param>
|
||||
/// <param name="description"></param>
|
||||
/// <param name="eventType"></param>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public bool Create(DateTime dtCreated, Core.LogSupportLevel level, Core.LogSupportTarget target, string message)
|
||||
{
|
||||
bool fatto = false;
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
LogSupportModel newItem = new LogSupportModel() { DtEvent = dtCreated, Level = level, Target = target, Message = message };
|
||||
// Add to database
|
||||
dbCtx.LogSupportList.Add(newItem);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on Create LogSupport: {exc}");
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete by key
|
||||
/// </summary>
|
||||
/// <param name="LogDbId"></param>
|
||||
/// <returns></returns>
|
||||
public bool DeleteByKey(int LogDbId)
|
||||
{
|
||||
bool done = false;
|
||||
var items2del = dbCtx
|
||||
.LogSupportList
|
||||
.Where(x => x.LogDbId == LogDbId);
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
dbCtx.LogSupportList.RemoveRange(items2del);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on DeleteByKey: {exc}");
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database context
|
||||
dbCtx.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get record by LogDbId
|
||||
/// </summary>
|
||||
/// <param name="LogDbId"></param>
|
||||
/// <returns></returns>
|
||||
public LogSupportModel FindByDbId(int LogDbId)
|
||||
{
|
||||
return dbCtx
|
||||
.LogSupportList
|
||||
.Where(x => x.LogDbId == LogDbId)
|
||||
.SingleOrDefault();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get paginated data from DB (ASC ordered)
|
||||
/// </summary>
|
||||
/// <param name="dtStart"></param>
|
||||
/// <param name="dtEnd"></param>
|
||||
/// <returns></returns>
|
||||
public List<LogSupportModel> GetPaginatedAsc(DateTime dtStart, DateTime dtEnd)
|
||||
{
|
||||
// retrieve
|
||||
return dbCtx
|
||||
.LogSupportList
|
||||
.Where(x => x.DtEvent >= dtStart && x.DtEvent <= dtEnd)
|
||||
.OrderBy(x => x.DtEvent)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get paginated data from DB (DESC ordered)
|
||||
/// </summary>
|
||||
/// <param name="dtStart"></param>
|
||||
/// <param name="dtEnd"></param>
|
||||
/// <returns></returns>
|
||||
public List<LogSupportModel> GetPaginatedDesc(DateTime dtStart, DateTime dtEnd)
|
||||
{
|
||||
// retrieve
|
||||
return dbCtx
|
||||
.LogSupportList
|
||||
.Where(x => x.DtEvent >= dtStart && x.DtEvent <= dtEnd)
|
||||
.OrderByDescending(x => x.DtEvent)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reinizializzaizone del controller
|
||||
/// </summary>
|
||||
public void ResetController()
|
||||
{
|
||||
// Re-Initialize database context
|
||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update single LogMachineModel
|
||||
/// </summary>
|
||||
/// <param name="updItem"></param>
|
||||
/// <returns></returns>
|
||||
public bool Update(LogSupportModel updItem)
|
||||
{
|
||||
bool done = false;
|
||||
var item2update = dbCtx
|
||||
.LogSupportList
|
||||
.Where(x => x.LogDbId == updItem.LogDbId)
|
||||
.SingleOrDefault();
|
||||
try
|
||||
{
|
||||
// update, vers 1...
|
||||
dbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on Update: {exc}");
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -25,56 +25,11 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public MachGroupController()
|
||||
{
|
||||
// Initialize database context
|
||||
dbCtx = new DatabaseContext(Constants.CONNECTION_STRING);
|
||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Get paginated data from DB (ASC ordered)
|
||||
/// </summary>
|
||||
/// <param name="MachGroupDbIdStart"></param>
|
||||
/// <param name="numRecord"></param>
|
||||
/// <returns></returns>
|
||||
public List<MachGroupModel> GetPaginatedAsc(int MachGroupDbIdStart, int numRecord)
|
||||
{
|
||||
int numEnd = MachGroupDbIdStart - numRecord;
|
||||
// check numEnd
|
||||
if (numEnd < 0)
|
||||
numEnd = 0;
|
||||
// retrieve
|
||||
return dbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.MachGroupDbId <= MachGroupDbIdStart)
|
||||
.OrderBy(x => x.MachGroupDbId)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get paginated data from DB (DESC ordered)
|
||||
/// </summary>
|
||||
/// <param name="PartDbIdStart"></param>
|
||||
/// <param name="numRecord"></param>
|
||||
/// <returns></returns>
|
||||
public List<MachGroupModel> GetPaginatedDesc(int PartDbIdStart, int numRecord)
|
||||
{
|
||||
int numEnd = PartDbIdStart - numRecord;
|
||||
// check numEnd
|
||||
if (numEnd < 0)
|
||||
numEnd = 0;
|
||||
// retrieve
|
||||
return dbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.MachGroupDbId <= PartDbIdStart)
|
||||
.OrderByDescending(x => x.MachGroupDbId)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
@@ -83,14 +38,14 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <param name="coreMachGroup"></param>
|
||||
/// <param name="currProdDbId"></param>
|
||||
/// <returns></returns>
|
||||
public static MachGroupModel ConvertFromCore(Core.MyMachGroup coreMachGroup, int currProdDbId)
|
||||
public static MachGroupModel ConvertFromCore(Core.MyMachGroupM coreMachGroup, int currProdDbId)
|
||||
{
|
||||
MachGroupModel answ = new MachGroupModel();
|
||||
if (coreMachGroup != null)
|
||||
{
|
||||
answ = new MachGroupModel()
|
||||
{
|
||||
Assign = "",
|
||||
SupervisorId = "",
|
||||
Name = coreMachGroup.Name,
|
||||
Locked = true,
|
||||
MachGroupId = coreMachGroup.Id,
|
||||
@@ -99,12 +54,92 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
H = coreMachGroup.dH,
|
||||
L = coreMachGroup.dL,
|
||||
W = coreMachGroup.dW,
|
||||
Material = coreMachGroup.sMATERIAL
|
||||
DtStart = coreMachGroup.dtStartTime,
|
||||
DtEnd = coreMachGroup.dtEndTime,
|
||||
Material = coreMachGroup.sMATERIAL,
|
||||
// indice ordinale SOLO SE è >= 0
|
||||
ProdIndex = coreMachGroup.nProdIndex >= 0 ? coreMachGroup.nProdIndex : 10000
|
||||
};
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add MachGroup as rebuilt from NeedRedo (on top of order priority)
|
||||
/// <param name="ProdId">Id del Prod</param>
|
||||
/// <param name="newMachGroup">Nuovo MachGroup da associare</param>
|
||||
/// <returns></returns>
|
||||
public ProdModel AddMachGroupRedo(int ProdId, Core.MyMachGroupM newMachGroup)
|
||||
{
|
||||
// Recupero il PROD
|
||||
ProdModel currData = ProdController.man.FindByProdId(ProdId);
|
||||
List<PartModel> PartList2Add = new List<PartModel>();
|
||||
try
|
||||
{
|
||||
var convCurrMG = MachGroupController.ConvertFromCore(newMachGroup, currData.ProdDbId);
|
||||
|
||||
convCurrMG.ProdIndex = 1;
|
||||
|
||||
// aggiungo MachGroup
|
||||
dbCtx.MachGroupList.Add(convCurrMG);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
|
||||
int MachGroupDbId = MachGroupController.man.FindByMachGroupId(ProdId, newMachGroup.Id).MachGroupDbId;
|
||||
// verifico se uguali o meno...
|
||||
foreach (var currPartM in newMachGroup.PartMList)
|
||||
{
|
||||
var currPart = dbCtx
|
||||
.PartList
|
||||
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == newMachGroup.Id && x.PartId == currPartM.nPartId)
|
||||
.SingleOrDefault();
|
||||
var convCurrPartM = PartController.ConvertFromCore(currPartM, MachGroupDbId);
|
||||
if (currPart != null)
|
||||
{
|
||||
// se non identico x equality limitata a ViewOptim...
|
||||
if (!currPart.ViewOptimEquals(convCurrPartM))
|
||||
{
|
||||
// aggiorno con nuovi valori ricevuti
|
||||
currPart.H = convCurrPartM.H;
|
||||
currPart.L = convCurrPartM.L;
|
||||
currPart.W = convCurrPartM.W;
|
||||
currPart.Material = convCurrPartM.Material;
|
||||
currPart.CALC_State = convCurrPartM.CALC_State;
|
||||
currPart.ROT = convCurrPartM.ROT;
|
||||
currPart.PDN = convCurrPartM.PDN;
|
||||
currPart.NAM = convCurrPartM.NAM;
|
||||
// salvo
|
||||
dbCtx.SaveChanges();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PartList2Add.Add(convCurrPartM);
|
||||
}
|
||||
}
|
||||
|
||||
// aggiungo PartList
|
||||
dbCtx.PartList.AddRange(PartList2Add);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
|
||||
// aggiorno valore isNew a false x PROD
|
||||
currData.IsNew = false;
|
||||
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", ProdId, newMachGroup.Id, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupAdd, "");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on UpdateMachGroup: {exc}");
|
||||
}
|
||||
|
||||
return currData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create record on DB
|
||||
/// </summary>
|
||||
@@ -121,6 +156,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
dbCtx.MachGroupList.Add(newMachGroup);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
@@ -130,6 +166,47 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
return newMachGroup;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete MachGroup + Parts
|
||||
/// </summary>
|
||||
/// <param name="ProdId"></param>
|
||||
/// <param name="MachGroupId"></param>
|
||||
/// <returns></returns>
|
||||
public bool Delete(int ProdId, int MachGroupId)
|
||||
{
|
||||
bool done = false;
|
||||
// inizio eliminando le part
|
||||
var parts2del = dbCtx
|
||||
.PartList
|
||||
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId)
|
||||
.ToList();
|
||||
|
||||
var MG2Del = dbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
|
||||
.SingleOrDefault();
|
||||
|
||||
try
|
||||
{
|
||||
// Remove to database
|
||||
dbCtx.PartList.RemoveRange(parts2del);
|
||||
dbCtx.MachGroupList.Remove(MG2Del);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on Delete: ProdId: {ProdId} | MachGroupId: {MachGroupId}{Environment.NewLine}{exc}");
|
||||
}
|
||||
|
||||
// se fatto aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupRem, "");
|
||||
|
||||
return done;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database context
|
||||
@@ -154,29 +231,14 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// </summary>
|
||||
/// <param name="MachGroupId"></param>
|
||||
/// <returns></returns>
|
||||
public MachGroupModel FindByMachGroupId(int MachGroupId)
|
||||
public MachGroupModel FindByMachGroupId(int ProdId, int MachGroupId)
|
||||
{
|
||||
return dbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.MachGroupId == MachGroupId)
|
||||
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
|
||||
.SingleOrDefault();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get filtered data by Assign (ASC ordered)
|
||||
/// </summary>
|
||||
/// <param name="Assign"></param>
|
||||
/// <returns></returns>
|
||||
public List<MachGroupModel> GetByAssign(string Assign)
|
||||
{
|
||||
return dbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.Assign == Assign)
|
||||
.OrderBy(x => x.Order)
|
||||
.ThenBy(x => x.MachGroupId)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get filtered data by ProdId (ASC ordered)
|
||||
/// </summary>
|
||||
@@ -184,7 +246,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public List<MachGroupModel> GetByProdAsc(int ProdId)
|
||||
{
|
||||
// recupero
|
||||
// verificare fattibilità in 1 solo passo
|
||||
int ProdDbId = 0;
|
||||
try
|
||||
{
|
||||
@@ -204,7 +266,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
return dbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.ProdDbId == ProdDbId)
|
||||
.OrderBy(x => x.Order)
|
||||
.OrderBy(x => x.ProdIndex)
|
||||
.ThenBy(x => x.MachGroupId)
|
||||
.ToList();
|
||||
}
|
||||
@@ -218,6 +280,8 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
// recupero
|
||||
int ProdDbId = 0;
|
||||
|
||||
// verificare fattibilità in 1 solo passo
|
||||
try
|
||||
{
|
||||
var currProd = dbCtx
|
||||
@@ -236,11 +300,69 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
return dbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.ProdDbId == ProdDbId)
|
||||
.OrderByDescending(x => x.Order)
|
||||
.OrderByDescending(x => x.ProdIndex)
|
||||
.ThenByDescending(x => x.MachGroupId)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get filtered data by Assign (ASC ordered)
|
||||
/// </summary>
|
||||
/// <param name="ProdId"></param>
|
||||
/// <param name="SupervisorId"></param>
|
||||
/// <returns></returns>
|
||||
public List<MachGroupModel> GetByProdSupervisor(int ProdId, string SupervisorId)
|
||||
{
|
||||
return dbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.Prod.ProdId == ProdId && x.SupervisorId == SupervisorId)
|
||||
.OrderBy(x => x.ProdIndex)
|
||||
.ThenBy(x => x.MachGroupId)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reinizializzaizone del controller
|
||||
/// </summary>
|
||||
public void ResetController()
|
||||
{
|
||||
// Re-Initialize database context
|
||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set MachGroup as NeedRedo (ripresa = da rigenerare)
|
||||
/// </summary>
|
||||
/// <param name="MachGroupId"></param>
|
||||
/// <param name="newState"></param>
|
||||
/// <param name="Value">Value to save for regenerate</param>
|
||||
/// <returns></returns>
|
||||
public bool SetNeedRedo(int ProdId, int MachGroupId, Core.ItemState newState, string Value)
|
||||
{
|
||||
bool done = false;
|
||||
try
|
||||
{
|
||||
// aggiorno
|
||||
dbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
|
||||
.FirstOrDefault()
|
||||
.State = newState;
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupNeedRedo, Value);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on UpdateStatus: {exc}");
|
||||
}
|
||||
|
||||
return done;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update single MachGroup
|
||||
/// </summary>
|
||||
@@ -258,13 +380,12 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
// update, vers 1...
|
||||
dbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
|
||||
//// update, vers 2
|
||||
//dbCtx.BTLPartList.Remove(item2del);
|
||||
//dbCtx.BTLPartList.Add(updItem);
|
||||
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", updItem.Prod.ProdId, updItem.MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
@@ -274,12 +395,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set Status for MachGroup
|
||||
/// Set END for MachGroup
|
||||
/// </summary>
|
||||
/// <param name="newAssign"></param>
|
||||
/// <param name="newState"></param>
|
||||
/// <param name="ProdId"></param>
|
||||
/// <param name="MachGroupId"></param>
|
||||
/// <param name="DtEnd"></param>
|
||||
/// <returns></returns>
|
||||
public bool UpdateAssign(int MachGroupId, string newAssign)
|
||||
public bool UpdateEnd(int ProdId, int MachGroupId, DateTime DtEnd)
|
||||
{
|
||||
bool done = false;
|
||||
try
|
||||
@@ -287,19 +409,127 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
// aggiorno
|
||||
var currRecord = dbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.MachGroupId == MachGroupId)
|
||||
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
|
||||
.FirstOrDefault();
|
||||
|
||||
currRecord.Assign = newAssign;
|
||||
currRecord.State = Core.ItemState.Assigned;
|
||||
currRecord.DtEnd = DtEnd;
|
||||
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on UpdateAssign: {exc}");
|
||||
Console.WriteLine($"EXCEPTION on UpdateStartEnd: {exc}");
|
||||
}
|
||||
|
||||
return done;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set ProdIndex for MachGroup
|
||||
/// </summary>
|
||||
/// <param name="ProdId"></param>
|
||||
/// <param name="MachGroupId"></param>
|
||||
/// <param name="newProdIndex"></param>
|
||||
/// <returns></returns>
|
||||
public bool UpdateOrder(int ProdId, int MachGroupId, int newProdIndex)
|
||||
{
|
||||
bool done = false;
|
||||
try
|
||||
{
|
||||
// aggiorno
|
||||
dbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
|
||||
.FirstOrDefault()
|
||||
.ProdIndex = newProdIndex;
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on UpdateOrder: {exc}");
|
||||
}
|
||||
|
||||
return done;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set START for MachGroup
|
||||
/// </summary>
|
||||
/// <param name="ProdId"></param>
|
||||
/// <param name="MachGroupId"></param>
|
||||
/// <param name="PartId"></param>
|
||||
/// <param name="DtStart"></param>
|
||||
/// <returns></returns>
|
||||
public bool UpdateStart(int ProdId, int MachGroupId, DateTime DtStart)
|
||||
{
|
||||
bool done = false;
|
||||
try
|
||||
{
|
||||
// aggiorno
|
||||
var currRecord = dbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
|
||||
.FirstOrDefault();
|
||||
|
||||
currRecord.DtStart = DtStart;
|
||||
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on UpdateStartEnd: {exc}");
|
||||
}
|
||||
|
||||
return done;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set START/END for MachGroup
|
||||
/// </summary>
|
||||
/// <param name="ProdId"></param>
|
||||
/// <param name="MachGroupId"></param>
|
||||
/// <param name="DtStart"></param>
|
||||
/// <param name="DtEnd"></param>
|
||||
/// <returns></returns>
|
||||
public bool UpdateStartEnd(int ProdId, int MachGroupId, DateTime DtStart, DateTime DtEnd)
|
||||
{
|
||||
bool done = false;
|
||||
try
|
||||
{
|
||||
// aggiorno
|
||||
var currRecord = dbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
|
||||
.FirstOrDefault();
|
||||
|
||||
currRecord.DtStart = DtStart;
|
||||
currRecord.DtEnd = DtEnd;
|
||||
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on UpdateStartEnd: {exc}");
|
||||
}
|
||||
|
||||
return done;
|
||||
@@ -311,7 +541,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <param name="MachGroupId"></param>
|
||||
/// <param name="newState"></param>
|
||||
/// <returns></returns>
|
||||
public bool UpdateStatus(int MachGroupId, Core.ItemState newState)
|
||||
public bool UpdateStatus(int ProdId, int MachGroupId, Core.ItemState newState)
|
||||
{
|
||||
bool done = false;
|
||||
try
|
||||
@@ -319,12 +549,15 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
// aggiorno
|
||||
dbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.MachGroupId == MachGroupId)
|
||||
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
|
||||
.FirstOrDefault()
|
||||
.State = newState;
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
@@ -334,6 +567,42 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
return done;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set Supervisor & state for MachGroup
|
||||
/// </summary>
|
||||
/// <param name="ProdId"></param>
|
||||
/// <param name="MachGroupId"></param>
|
||||
/// <param name="SupervisorId"></param>
|
||||
/// <returns></returns>
|
||||
public bool UpdateSupervisor(int ProdId, int MachGroupId, string SupervisorId)
|
||||
{
|
||||
bool done = false;
|
||||
try
|
||||
{
|
||||
// aggiorno
|
||||
var currRecord = dbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
|
||||
.FirstOrDefault();
|
||||
|
||||
currRecord.SupervisorId = SupervisorId;
|
||||
currRecord.State = Core.ItemState.Assigned;
|
||||
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on UpdateSupervisor: {exc}");
|
||||
}
|
||||
|
||||
return done;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public PartController()
|
||||
{
|
||||
// Initialize database context
|
||||
dbCtx = new DatabaseContext(Constants.CONNECTION_STRING);
|
||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
@@ -42,10 +42,11 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
int BtlPartDbId = 0;
|
||||
|
||||
#if false
|
||||
var currProj = dbCtx
|
||||
.ProjList
|
||||
.Where(x => x.ProjId == ProjId)
|
||||
.FirstOrDefault();
|
||||
.ProjList
|
||||
.Where(x => x.ProjId == ProjId)
|
||||
.FirstOrDefault();
|
||||
|
||||
if (currProj != null)
|
||||
{
|
||||
@@ -59,6 +60,40 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
BtlPartDbId = btlPart.BTLPartDbId;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
var btlPart = dbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.Project.ProjId == ProjId && x.PDN == PDN)
|
||||
.SingleOrDefault();
|
||||
|
||||
if (btlPart != null)
|
||||
{
|
||||
BtlPartDbId = btlPart.BTLPartDbId;
|
||||
}
|
||||
|
||||
return BtlPartDbId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get BtlPartDBId by ProjId + BtlPartId
|
||||
/// </summary>
|
||||
/// <param name="ProjId"></param>
|
||||
/// <param name="BtlPartId"></param>
|
||||
/// <returns></returns>
|
||||
protected int FindBtlPartByBPI(int ProjId, int BtlPartId)
|
||||
{
|
||||
int BtlPartDbId = 0;
|
||||
|
||||
var btlPart = dbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.Project.ProjId == ProjId && x.PartId == BtlPartId)
|
||||
.SingleOrDefault();
|
||||
|
||||
if (btlPart != null)
|
||||
{
|
||||
BtlPartDbId = btlPart.BTLPartDbId;
|
||||
}
|
||||
|
||||
return BtlPartDbId;
|
||||
}
|
||||
@@ -73,16 +108,17 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <param name="corePart"></param>
|
||||
/// <param name="currMachGroupDbId"></param>
|
||||
/// <returns></returns>
|
||||
public static PartModel ConvertFromCore(Core.Part corePart, int currMachGroupDbId)
|
||||
public static PartModel ConvertFromCore(Core.PartM corePart, int currMachGroupDbId)
|
||||
{
|
||||
PartModel answ = new PartModel();
|
||||
if (corePart != null)
|
||||
{
|
||||
int BTLPartId = man.FindBtlPartByBPI(corePart.nProjId, corePart.nBTLPartId);
|
||||
answ = new PartModel()
|
||||
{
|
||||
PartId = corePart.nPartId,
|
||||
PDN = corePart.nPDN,
|
||||
BTLPartDbId = man.FindBtlPart(corePart.nProjId, corePart.nPDN),
|
||||
BTLPartDbId = BTLPartId,
|
||||
MachGroupDbId = currMachGroupDbId,
|
||||
State = Core.ItemState.Assigned,
|
||||
NAM = corePart.sNAM,
|
||||
@@ -90,7 +126,8 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
L = corePart.dL,
|
||||
H = corePart.dH,
|
||||
Material = corePart.sMATERIAL,
|
||||
|
||||
DtStart = corePart.dtStartTime,
|
||||
DtEnd = corePart.dtEndTime,
|
||||
//DO = corePart.bDO,
|
||||
//CNT = corePart.nCNT,
|
||||
//TBP = corePart.nTBP,
|
||||
@@ -98,210 +135,43 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
ROT = corePart.nCALC_ROT,
|
||||
//GRP = corePart.sGRP,
|
||||
//UNT = corePart.nUNT,
|
||||
CALC_State = (int)corePart.nState
|
||||
};
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Conversion of base class to DB model class
|
||||
/// </summary>
|
||||
/// <param name="corePart"></param>
|
||||
/// <returns></returns>
|
||||
public PartModel Convert(Core.Part corePart)
|
||||
{
|
||||
PartModel answ = new PartModel();
|
||||
if (corePart != null)
|
||||
{
|
||||
answ = new PartModel()
|
||||
{
|
||||
PartId = corePart.nPartId,
|
||||
PDN = corePart.nPDN,
|
||||
DO = corePart.bDO,
|
||||
NAM = corePart.sNAM,
|
||||
W = corePart.dW,
|
||||
L = corePart.dL,
|
||||
H = corePart.dH,
|
||||
MAT = corePart.sMATERIAL,
|
||||
CNT = corePart.nCNT,
|
||||
TBP = corePart.nTBP,
|
||||
DON = corePart.nDON,
|
||||
ROT = corePart.nROT,
|
||||
GRP = corePart.sGRP,
|
||||
UNT = corePart.nUNT,
|
||||
CALC_State = (int)corePart.nState
|
||||
CALC_State = (int)corePart.nCALC_State
|
||||
};
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create multiple Part record associated to MachGroup
|
||||
/// Delete single Part
|
||||
/// </summary>
|
||||
/// <param name="MachGroupID"></param>
|
||||
/// <param name="partData"></param>
|
||||
/// <param name="ProdId"></param>
|
||||
/// <param name="MachGroupId"></param>
|
||||
/// <param name="PartId"></param>
|
||||
/// <returns></returns>
|
||||
public List<PartModel> Create(int MachGroupID, List<PartModel> partData)
|
||||
{
|
||||
// se è adv mode --> uso TUTTI i dati
|
||||
if (DbManager.AdvDataModel)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
dbCtx.PartList.AddRange(partData);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return partData;
|
||||
}
|
||||
// se non adv --> faccio solo copia degli id...
|
||||
else
|
||||
{
|
||||
List<int> partIdList = new List<int>();
|
||||
foreach (var item in partData)
|
||||
{
|
||||
partIdList.Add(item.PartId);
|
||||
}
|
||||
return CreateBaseObj(MachGroupID, partIdList);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create multiple (empty) Part record associated to Project
|
||||
/// </summary>
|
||||
/// <param name="ProjDbId"></param>
|
||||
/// <param name="rawListData"></param>
|
||||
/// <returns></returns>
|
||||
public List<PartModel> CreateBaseObj(int ProjDbId, List<int> rawListData)
|
||||
{
|
||||
List<PartModel> partData = new List<PartModel>();
|
||||
|
||||
foreach (var item in rawListData)
|
||||
{
|
||||
PartModel newItem = new PartModel() { ProjDbId = ProjDbId, PartId = item };
|
||||
partData.Add(newItem);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
dbCtx.PartList.AddRange(partData);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
|
||||
return partData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get filtered data by ProjectId (ASC ordered)
|
||||
/// </summary>
|
||||
/// <param name="ProjDbId"></param>
|
||||
/// <returns></returns>
|
||||
public List<PartModel> GetByProjectAsc(int ProjDbId)
|
||||
{
|
||||
// retrieve
|
||||
return dbCtx
|
||||
.PartList
|
||||
.Where(x => x.ProjDbId == ProjDbId)
|
||||
.OrderBy(x => x.PartDbId)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get filtered data by ProjectId (DESC ordered)
|
||||
/// </summary>
|
||||
/// <param name="ProjDbId"></param>
|
||||
/// <returns></returns>
|
||||
public List<PartModel> GetByProjectDesc(int ProjDbId)
|
||||
{
|
||||
// retrieve
|
||||
return dbCtx
|
||||
.PartList
|
||||
.Where(x => x.ProjDbId == ProjDbId)
|
||||
.OrderByDescending(x => x.PartDbId)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get paginated data from DB (ASC ordered)
|
||||
/// </summary>
|
||||
/// <param name="PartDbIdStart"></param>
|
||||
/// <param name="numRecord"></param>
|
||||
/// <returns></returns>
|
||||
public List<PartModel> GetPaginatedAsc(int PartDbIdStart, int numRecord)
|
||||
{
|
||||
int numEnd = PartDbIdStart - numRecord;
|
||||
// check numEnd
|
||||
if (numEnd < 0)
|
||||
numEnd = 0;
|
||||
// retrieve
|
||||
return dbCtx
|
||||
.PartList
|
||||
.Where(x => x.PartDbId <= PartDbIdStart)
|
||||
.OrderBy(x => x.PartDbId)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get paginated data from DB (DESC ordered)
|
||||
/// </summary>
|
||||
/// <param name="PartDbIdStart"></param>
|
||||
/// <param name="numRecord"></param>
|
||||
/// <returns></returns>
|
||||
public List<PartModel> GetPaginatedDesc(int PartDbIdStart, int numRecord)
|
||||
{
|
||||
int numEnd = PartDbIdStart - numRecord;
|
||||
// check numEnd
|
||||
if (numEnd < 0)
|
||||
numEnd = 0;
|
||||
// retrieve
|
||||
return dbCtx
|
||||
.PartList
|
||||
.Where(x => x.PartDbId <= PartDbIdStart)
|
||||
.OrderByDescending(x => x.PartDbId)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update single Part
|
||||
/// </summary>
|
||||
/// <param name="updItem"></param>
|
||||
/// <returns></returns>
|
||||
public bool Update(PartModel updItem)
|
||||
public bool Delete(int ProdId, int MachGroupId, int PartId)
|
||||
{
|
||||
bool done = false;
|
||||
var item2update = dbCtx
|
||||
var item2del = dbCtx
|
||||
.PartList
|
||||
.Where(x => x.PartDbId == updItem.PartDbId)
|
||||
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
|
||||
.SingleOrDefault();
|
||||
try
|
||||
{
|
||||
// update, vers 1...
|
||||
dbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
|
||||
//// update, vers 2
|
||||
//dbCtx.PartList.Remove(item2del);
|
||||
//dbCtx.PartList.Add(updItem);
|
||||
|
||||
// Remove from database
|
||||
dbCtx.PartList.Remove(item2del);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on Delete: ProdId: {ProdId} | MachGroupId: {MachGroupId} | PartId: {PartId}{Environment.NewLine}{exc}");
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return done;
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Delete single Part
|
||||
@@ -321,6 +191,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
dbCtx.PartList.Remove(item2del);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
@@ -347,6 +218,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
dbCtx.PartList.RemoveRange(items2del);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
@@ -389,12 +261,54 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set Status for Part
|
||||
/// Reinizializzaizone del controller
|
||||
/// </summary>
|
||||
public void ResetController()
|
||||
{
|
||||
// Re-Initialize database context
|
||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update single Part
|
||||
/// </summary>
|
||||
/// <param name="updItem"></param>
|
||||
/// <returns></returns>
|
||||
public bool Update(PartModel updItem)
|
||||
{
|
||||
bool done = false;
|
||||
var item2update = dbCtx
|
||||
.PartList
|
||||
.Where(x => x.PartDbId == updItem.PartDbId)
|
||||
.SingleOrDefault();
|
||||
try
|
||||
{
|
||||
// update, vers 1...
|
||||
dbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
|
||||
//// update, vers 2
|
||||
//dbCtx.PartList.Remove(item2del);
|
||||
//dbCtx.PartList.Add(updItem);
|
||||
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", updItem.MachGroup.Prod.ProdId, updItem.MachGroup.MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return done;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set EndDate for Part
|
||||
/// </summary>
|
||||
/// <param name="PartId"></param>
|
||||
/// <param name="newState"></param>
|
||||
/// <param name="DtEnd"></param>
|
||||
/// <returns></returns>
|
||||
public bool UpdateStatus(int PartId, Core.ItemState newState)
|
||||
public bool UpdateEnd(int ProdId, int MachGroupId, int PartId, DateTime DtEnd)
|
||||
{
|
||||
bool done = false;
|
||||
try
|
||||
@@ -402,12 +316,79 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
// aggiorno
|
||||
dbCtx
|
||||
.PartList
|
||||
.Where(x => x.PartId == PartId)
|
||||
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
|
||||
.FirstOrDefault()
|
||||
.DtEnd = DtEnd;
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.PartEnd, "");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on UpdateStatus: {exc}");
|
||||
}
|
||||
|
||||
return done;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set StartDate for Part
|
||||
/// </summary>
|
||||
/// <param name="PartId"></param>
|
||||
/// <param name="DtStart"></param>
|
||||
/// <returns></returns>
|
||||
public bool UpdateStart(int ProdId, int MachGroupId, int PartId, DateTime DtStart)
|
||||
{
|
||||
bool done = false;
|
||||
try
|
||||
{
|
||||
// aggiorno
|
||||
dbCtx
|
||||
.PartList
|
||||
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
|
||||
.FirstOrDefault()
|
||||
.DtStart = DtStart;
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.PartStart, "");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on UpdateStatus: {exc}");
|
||||
}
|
||||
|
||||
return done;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set Status for Part
|
||||
/// </summary>
|
||||
/// <param name="PartId"></param>
|
||||
/// <param name="newState"></param>
|
||||
/// <returns></returns>
|
||||
public bool UpdateStatus(int ProdId, int MachGroupId, int PartId, Core.ItemState newState)
|
||||
{
|
||||
bool done = false;
|
||||
try
|
||||
{
|
||||
// aggiorno
|
||||
dbCtx
|
||||
.PartList
|
||||
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
|
||||
.FirstOrDefault()
|
||||
.State = newState;
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
|
||||
@@ -14,143 +14,22 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Fields
|
||||
|
||||
public static ProdController man = new ProdController();
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public ProdController()
|
||||
{
|
||||
// Initialize database context
|
||||
dbCtx = new DatabaseContext(Constants.CONNECTION_STRING);
|
||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Create record on DB
|
||||
/// </summary>
|
||||
/// <param name="newProdId"></param>
|
||||
/// <param name="Description"></param>
|
||||
/// <returns></returns>
|
||||
public ProdModel Create(int newProdId, string Description)
|
||||
{
|
||||
ProdModel newProd = new ProdModel() { ProdId = newProdId, Description = Description };
|
||||
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
dbCtx.ProdList.Add(newProd);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
|
||||
return newProd;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get paginated data from DB (ASC ordered)
|
||||
/// </summary>
|
||||
/// <param name="ProdDbIdStart"></param>
|
||||
/// <param name="numRecord"></param>
|
||||
/// <returns></returns>
|
||||
public List<ProdModel> GetPaginatedAsc(int ProdDbIdStart, int numRecord)
|
||||
{
|
||||
int numEnd = ProdDbIdStart - numRecord;
|
||||
// check numEnd
|
||||
if (numEnd < 0)
|
||||
numEnd = 0;
|
||||
// retrieve
|
||||
return dbCtx
|
||||
.ProdList
|
||||
.Where(x => x.ProdDbId <= ProdDbIdStart)
|
||||
.OrderBy(x => x.ProdDbId)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get paginated data from DB (DESC ordered)
|
||||
/// </summary>
|
||||
/// <param name="PartDbIdStart"></param>
|
||||
/// <param name="numRecord"></param>
|
||||
/// <returns></returns>
|
||||
public List<ProdModel> GetPaginatedDesc(int PartDbIdStart, int numRecord)
|
||||
{
|
||||
int numEnd = PartDbIdStart - numRecord;
|
||||
// check numEnd
|
||||
if (numEnd < 0)
|
||||
numEnd = 0;
|
||||
// retrieve
|
||||
return dbCtx
|
||||
.ProdList
|
||||
.Where(x => x.ProdDbId <= PartDbIdStart)
|
||||
.OrderByDescending(x => x.ProdDbId)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get filtered data by ProdectId (ASC ordered)
|
||||
/// </summary>
|
||||
/// <param name="ProdDbId"></param>
|
||||
/// <returns></returns>
|
||||
public List<ProdModel> GetByProdAsc(int ProdDbId)
|
||||
{
|
||||
// retrieve
|
||||
return dbCtx
|
||||
.ProdList
|
||||
.Where(x => x.ProdDbId == ProdDbId)
|
||||
.OrderBy(x => x.ProdDbId)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get filtered data by ProdectId (DESC ordered)
|
||||
/// </summary>
|
||||
/// <param name="ProdDbId"></param>
|
||||
/// <returns></returns>
|
||||
public List<ProdModel> GetByProdDesc(int ProdDbId)
|
||||
{
|
||||
// retrieve
|
||||
return dbCtx
|
||||
.ProdList
|
||||
.Where(x => x.ProdDbId == ProdDbId)
|
||||
.OrderByDescending(x => x.ProdDbId)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get record by RawPartDbId
|
||||
/// </summary>
|
||||
/// <param name="RawPartDbId"></param>
|
||||
/// <returns></returns>
|
||||
public ProdModel FindByRawPartDbId(int RawPartDbId)
|
||||
{
|
||||
var rawPart = dbCtx
|
||||
.RawPartList
|
||||
.Where(x => x.RawPartDbId == RawPartDbId)
|
||||
.SingleOrDefault();
|
||||
|
||||
return FindByProdDbId(rawPart.ProdDbId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get record by RawPartId
|
||||
/// </summary>
|
||||
/// <param name="RawPartId "></param>
|
||||
/// <returns></returns>
|
||||
public ProdModel FindByRawPartId(int RawPartId)
|
||||
{
|
||||
var rawPart = dbCtx
|
||||
.RawPartList
|
||||
.Where(x => x.RawPartId == RawPartId)
|
||||
.SingleOrDefault();
|
||||
|
||||
return FindByProdDbId(rawPart.ProdDbId);
|
||||
}
|
||||
#endif
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
@@ -173,6 +52,11 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
.ToList();
|
||||
}
|
||||
|
||||
protected List<int> ProjIdByProd(int ProdId)
|
||||
{
|
||||
return DbManager.obj.ProjCtr.GetByProdAsc(ProdId).Select(y => y.nProjId).ToList();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
@@ -200,10 +84,12 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
.FirstOrDefault();
|
||||
|
||||
// lo aggiorno
|
||||
currProj.ProjDbId = currProd.ProdDbId;
|
||||
currProj.ProdDbId = currProd.ProdDbId;
|
||||
currProj.Locked = true;
|
||||
|
||||
// salvo
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
|
||||
return done;
|
||||
}
|
||||
@@ -214,18 +100,44 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
|
||||
var currProd = FindByProdId(ProdId);
|
||||
|
||||
// sel delle BTLParts da proj
|
||||
// sel dei proj da aggiornare...
|
||||
var proj2update = dbCtx
|
||||
.ProjList
|
||||
.Where(x => x.ProdDbId == currProd.ProdDbId)
|
||||
.ToList();
|
||||
|
||||
// sel dei MachGroup da prod
|
||||
var machGroup2del = dbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.ProdDbId == currProd.ProdDbId);
|
||||
.Where(x => x.ProdDbId == currProd.ProdDbId)
|
||||
.ToList();
|
||||
|
||||
// selezione dei part da machgroup
|
||||
var part2del = dbCtx
|
||||
.PartList
|
||||
.Where(x => x.MachGroup.ProdDbId == currProd.ProdDbId)
|
||||
.ToList();
|
||||
|
||||
try
|
||||
{
|
||||
// update proj...
|
||||
foreach (var item in proj2update)
|
||||
{
|
||||
item.ProdDbId = null;
|
||||
}
|
||||
//// salvo
|
||||
//dbCtx.SaveChanges();
|
||||
// remove from database
|
||||
dbCtx.PartList.RemoveRange(part2del);
|
||||
//// salvo
|
||||
//dbCtx.SaveChanges();
|
||||
dbCtx.MachGroupList.RemoveRange(machGroup2del);
|
||||
//// salvo
|
||||
//dbCtx.SaveChanges();
|
||||
dbCtx.ProdList.Remove(currProd);
|
||||
// Commit changes
|
||||
// salvo
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
@@ -248,10 +160,16 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public ProdModel FindByProdDbId(int ProdDbId)
|
||||
{
|
||||
return dbCtx
|
||||
var answ = dbCtx
|
||||
.ProdList
|
||||
.Where(x => x.ProdDbId == ProdDbId)
|
||||
.SingleOrDefault();
|
||||
// forzo rilettura
|
||||
if (answ != null)
|
||||
{
|
||||
dbCtx.Entry(answ).Reload();
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -261,10 +179,28 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public ProdModel FindByProdId(int ProdId)
|
||||
{
|
||||
return dbCtx
|
||||
var answ = dbCtx
|
||||
.ProdList
|
||||
.Where(x => x.ProdId == ProdId)
|
||||
.SingleOrDefault();
|
||||
// forzo rilettura
|
||||
if (answ != null)
|
||||
{
|
||||
dbCtx.Entry(answ).Reload();
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get record by ProdId ass Core.ProdFileM
|
||||
/// </summary>
|
||||
/// <param name="ProdId"></param>
|
||||
/// <returns></returns>
|
||||
public Core.ProdFileM FindCoreByProdId(int ProdId)
|
||||
{
|
||||
var currProd = FindByProdId(ProdId);
|
||||
|
||||
return Core.ProdFileM.CreateProdFileM(currProd.ProdId, ProjIdByProd(ProdId), currProd.DtCreated, currProd.Description);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -275,12 +211,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public List<Core.ProdFileM> GetLastDesc(int numRecord)
|
||||
{
|
||||
List<Core.ProdFileM> result = new List<Core.ProdFileM>();
|
||||
|
||||
var dbResult = GetLastDbModelDesc(numRecord);
|
||||
|
||||
// conversione
|
||||
result = dbResult.Select(x => Core.ProdFileM.CreateProdFileM(x.ProdId, DbManager.obj.ProjCtr.GetByProdAsc(x.ProdId).Select(y => y.ProjId).ToList(), x.DtCreated, x.Description)).ToList();
|
||||
|
||||
result = dbResult.Select(x => Core.ProdFileM.CreateProdFileM(x.ProdId, ProjIdByProd(x.ProdId), x.DtCreated, x.Description)).ToList();
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -311,10 +244,20 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
nextId = maxRecord.ProdId + 1;
|
||||
}
|
||||
|
||||
// creo nuovo...
|
||||
var newRec = dbCtx
|
||||
// creo nuovo PROD...
|
||||
var newProd = dbCtx
|
||||
.ProdList
|
||||
.Add(new ProdModel() { ProdId = nextId, Locked = true });
|
||||
.Add(new ProdModel() { ProdId = nextId, Locked = true, DtCreated = DateTime.Now });
|
||||
|
||||
// cerco Proj
|
||||
var currProj = dbCtx
|
||||
.ProjList
|
||||
.Where(x => x.ProjId == ProjId)
|
||||
.FirstOrDefault();
|
||||
|
||||
// aggiungo proj-prod
|
||||
currProj.ProdDbId = newProd.ProdDbId;
|
||||
currProj.Locked = true;
|
||||
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
@@ -322,6 +265,23 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
return nextId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica prod assegnato a supervisor:
|
||||
/// ...se c'e' anche un solo machgroup del prod assegnato ad un supervisor o in stato 0 (dovrebbe essere la stessa cosa?)
|
||||
/// </summary>
|
||||
/// <param name="ProdId"></param>
|
||||
/// <returns></returns>
|
||||
public bool IsAnyInSupervisor(int ProdId)
|
||||
{
|
||||
// cerco se ci siano assegnati a supervisor
|
||||
var numAssigned = dbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.Prod.ProdId == ProdId && (!string.IsNullOrEmpty(x.SupervisorId) || x.State >= 0))
|
||||
.Count();
|
||||
|
||||
return numAssigned > 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Manage Lock by ProdId (proj & prod)
|
||||
/// </summary>
|
||||
@@ -335,120 +295,172 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
.ProdList
|
||||
.Where(x => x.ProdId == ProdId)
|
||||
.SingleOrDefault();
|
||||
currProd.Locked = Locked;
|
||||
|
||||
var currProj = dbCtx
|
||||
.ProjList
|
||||
.Where(x => x.ProdDbId == currProd.ProdDbId)
|
||||
.ToList();
|
||||
if (currProd != null)
|
||||
{
|
||||
currProd.Locked = Locked;
|
||||
dbCtx.Entry(currProd).State = System.Data.Entity.EntityState.Modified;
|
||||
|
||||
currProj.ForEach(x => x.Locked = Locked);
|
||||
var currProj = dbCtx
|
||||
.ProjList
|
||||
.Where(x => x.ProdDbId == currProd.ProdDbId)
|
||||
.ToList();
|
||||
|
||||
//currProj.ForEach(x => x.Locked = Locked);
|
||||
foreach (var item in currProj)
|
||||
{
|
||||
item.Locked = Locked;
|
||||
dbCtx.Entry(item).State = System.Data.Entity.EntityState.Modified;
|
||||
}
|
||||
}
|
||||
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
|
||||
return currProd;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update record su DB x elenco MachGroup
|
||||
/// Reinizializzaizone del controller
|
||||
/// </summary>
|
||||
/// <param name="ProdId">Id del Prod</param>
|
||||
/// <param name="MachGroupList">Elenco MachGroup da associare</param>
|
||||
/// <returns></returns>
|
||||
public ProdModel UpdateMachGroup(int ProdId, List<Core.MyMachGroup> MachGroupList)
|
||||
public void ResetController()
|
||||
{
|
||||
// Recupero il PROD
|
||||
ProdModel currData = FindByProdId(ProdId);
|
||||
|
||||
// converto le MachGroup
|
||||
List<MachGroupModel> itemsMG2add = MachGroupList.Select(x => MachGroupController.ConvertFromCore(x, currData.ProdDbId)).ToList();
|
||||
|
||||
// sel delle BTLParts da proj
|
||||
IQueryable<MachGroupModel> itemsMG2del = dbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.ProdDbId == currData.ProdDbId);
|
||||
|
||||
try
|
||||
{
|
||||
// per ogni itemsMG2del rimuovo Part
|
||||
foreach (var item in itemsMG2del)
|
||||
{
|
||||
PartController.man.DeleteByMachGroup(item.MachGroupDbId);
|
||||
}
|
||||
|
||||
// elimino dal DB i MG
|
||||
dbCtx.MachGroupList.RemoveRange(itemsMG2del);
|
||||
// aggiungo le nuove
|
||||
dbCtx.MachGroupList.AddRange(itemsMG2add);
|
||||
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
|
||||
// per ogni item in MachGroupList aggiungo Part
|
||||
foreach (var item in MachGroupList)
|
||||
{
|
||||
int MachGroupDbId = MachGroupController.man.FindByMachGroupId(item.Id).MachGroupDbId;
|
||||
// converto le corePartList
|
||||
List<PartModel> PartList2Add = item.PartList.Select(x => PartController.ConvertFromCore(x, MachGroupDbId)).ToList();
|
||||
|
||||
// aggiungo
|
||||
dbCtx.PartList.AddRange(PartList2Add);
|
||||
}
|
||||
|
||||
// aggiorno valore isNew a false
|
||||
currData.IsNew = false;
|
||||
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on UpdateMachGroup: {exc}");
|
||||
}
|
||||
|
||||
return currData;
|
||||
// Re-Initialize database context
|
||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update record su DB x elenco MachGroupDB
|
||||
/// Update single PROD
|
||||
/// </summary>
|
||||
/// <param name="updItem"></param>
|
||||
/// <returns></returns>
|
||||
public bool Update(ProdModel updItem)
|
||||
{
|
||||
bool done = false;
|
||||
var item2update = dbCtx
|
||||
.ProdList
|
||||
.Where(x => x.ProdDbId == updItem.ProdDbId)
|
||||
.SingleOrDefault();
|
||||
try
|
||||
{
|
||||
// update, vers 1...
|
||||
dbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
|
||||
//// update, vers 2
|
||||
//dbCtx.PartList.Remove(item2del);
|
||||
//dbCtx.PartList.Add(updItem);
|
||||
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return done;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update record su DB x elenco MachGroup:
|
||||
/// - NON vengono eliminati record (se ce ne son altri sul DB non saranno toccati)
|
||||
/// - i record ESISTENTI (per MachGroup.ID) saranno aggiornati (tranne start/end/status)
|
||||
/// - i record NON ESISTENTI (per MachGroup.ID) saranno AGGIUNTI (tranne start/end/status)
|
||||
/// </summary>
|
||||
/// <param name="ProdId">Id del Prod</param>
|
||||
/// <param name="MachGroupList">Elenco MachGroup da associare</param>
|
||||
/// <returns></returns>
|
||||
public ProdModel UpdateMachGroupDB(int ProdId, List<MachGroupModel> itemsMG2add, List<PartModel> PartList2Add)
|
||||
public ProdModel UpdateMachGroup(int ProdId, List<Core.MyMachGroupM> MachGroupList)
|
||||
{
|
||||
// Recupero il PROD
|
||||
ProdModel currData = FindByProdId(ProdId);
|
||||
|
||||
// sel delle BTLParts da proj
|
||||
IQueryable<MachGroupModel> itemsMG2del = dbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.ProdDbId == currData.ProdDbId);
|
||||
|
||||
try
|
||||
{
|
||||
// per ogni itemsMG2del rimuovo Part
|
||||
foreach (var item in itemsMG2del)
|
||||
// preparo elenco
|
||||
List<MachGroupModel> itemsMG2Add = new List<MachGroupModel>();
|
||||
List<Core.MyMachGroupM> MachGroupList2Add = new List<Core.MyMachGroupM>();
|
||||
List<PartModel> PartList2Add = new List<PartModel>();
|
||||
// cerco le MG esistenti --> aggiorno
|
||||
foreach (var item in MachGroupList)
|
||||
{
|
||||
PartController.man.DeleteByMachGroup(item.MachGroupDbId);
|
||||
var currMG = dbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == item.Id)
|
||||
.SingleOrDefault();
|
||||
var convCurrMG = MachGroupController.ConvertFromCore(item, currData.ProdDbId);
|
||||
if (currMG != null)
|
||||
{
|
||||
// se non identico x equality limitata a ViewOptim...
|
||||
if (!currMG.ViewOptimEquals(convCurrMG))
|
||||
{
|
||||
// aggiorno con nuovi valori ricevuti
|
||||
currMG.H = convCurrMG.H;
|
||||
currMG.L = convCurrMG.L;
|
||||
currMG.W = convCurrMG.W;
|
||||
currMG.Material = convCurrMG.Material;
|
||||
currMG.Name = convCurrMG.Name;
|
||||
// salvo
|
||||
dbCtx.SaveChanges();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
itemsMG2Add.Add(convCurrMG);
|
||||
}
|
||||
}
|
||||
|
||||
// elimino dal DB i MG
|
||||
dbCtx.MachGroupList.RemoveRange(itemsMG2del);
|
||||
// aggiungo le nuove
|
||||
dbCtx.MachGroupList.AddRange(itemsMG2add);
|
||||
|
||||
// aggiungo MachGroup
|
||||
dbCtx.MachGroupList.AddRange(itemsMG2Add);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
|
||||
// aggiungo Parts
|
||||
dbCtx.PartList.AddRange(PartList2Add);
|
||||
// verifico di nuovo l'elenco delle MG x le relative PART...
|
||||
foreach (var item in MachGroupList)
|
||||
{
|
||||
int MachGroupDbId = MachGroupController.man.FindByMachGroupId(ProdId, item.Id).MachGroupDbId;
|
||||
// verifico se uguali o meno...
|
||||
foreach (var currPartM in item.PartMList)
|
||||
{
|
||||
var currPart = dbCtx
|
||||
.PartList
|
||||
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == item.Id && x.PartId == currPartM.nPartId)
|
||||
.SingleOrDefault();
|
||||
var convCurrPartM = PartController.ConvertFromCore(currPartM, MachGroupDbId);
|
||||
if (currPart != null)
|
||||
{
|
||||
// se non identico x equality limitata a ViewOptim...
|
||||
if (!currPart.ViewOptimEquals(convCurrPartM))
|
||||
{
|
||||
// aggiorno con nuovi valori ricevuti
|
||||
currPart.H = convCurrPartM.H;
|
||||
currPart.L = convCurrPartM.L;
|
||||
currPart.W = convCurrPartM.W;
|
||||
currPart.Material = convCurrPartM.Material;
|
||||
currPart.CALC_State = convCurrPartM.CALC_State;
|
||||
currPart.ROT = convCurrPartM.ROT;
|
||||
currPart.PDN = convCurrPartM.PDN;
|
||||
currPart.NAM = convCurrPartM.NAM;
|
||||
// salvo
|
||||
dbCtx.SaveChanges();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PartList2Add.Add(convCurrPartM);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// aggiorno valore isNew a false
|
||||
// aggiungo PartList
|
||||
dbCtx.PartList.AddRange(PartList2Add);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
|
||||
// aggiorno valore isNew a false x PROD
|
||||
currData.IsNew = false;
|
||||
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
|
||||
@@ -19,13 +19,24 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public ProjController()
|
||||
{
|
||||
// Initialize database context
|
||||
dbCtx = new DatabaseContext(Constants.CONNECTION_STRING);
|
||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Helper conversione modelli
|
||||
/// </summary>
|
||||
/// <param name="currProj"></param>
|
||||
/// <returns></returns>
|
||||
protected Core.ProjFileM coreConv(ProjModel currProj)
|
||||
{
|
||||
Core.ProjFileM answ = Core.ProjFileM.CreateProjFileM(currProj.ProjId, ProdIdByProdDbId(currProj.ProdDbId), currProj.DtCreated, currProj.DtExported, currProj.ListName, currProj.BTLFileName, currProj.IsNew, currProj.Locked);
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get LAST paginated data from DB (DESC ordered)
|
||||
/// </summary>
|
||||
@@ -92,6 +103,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
dbCtx.ProjList.Remove(currProj);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
@@ -114,10 +126,16 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public ProjModel FindByProjDbId(int ProjDbId)
|
||||
{
|
||||
return dbCtx
|
||||
ProjModel answ = dbCtx
|
||||
.ProjList
|
||||
.Where(x => x.ProjDbId == ProjDbId)
|
||||
.SingleOrDefault();
|
||||
// forzo rilettura
|
||||
if (answ != null)
|
||||
{
|
||||
dbCtx.Entry(answ).Reload();
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -127,64 +145,36 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public ProjModel FindByProjId(int ProjId)
|
||||
{
|
||||
return dbCtx
|
||||
.ProjList
|
||||
var answ = dbCtx
|
||||
.ProjList
|
||||
.Where(x => x.ProjId == ProjId)
|
||||
.SingleOrDefault();
|
||||
// forzo rilettura
|
||||
if (answ != null)
|
||||
{
|
||||
dbCtx.Entry(answ).Reload();
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Get paginated data from DB (ASC ordered)
|
||||
/// </summary>
|
||||
/// <param name="ProjDbIdStart"></param>
|
||||
/// <param name="numRecord"></param>
|
||||
/// <returns></returns>
|
||||
public List<ProjModel> GetPaginatedAsc(int ProjDbIdStart, int numRecord)
|
||||
{
|
||||
int numEnd = ProjDbIdStart - numRecord;
|
||||
// check numEnd
|
||||
if (numEnd < 0)
|
||||
numEnd = 0;
|
||||
// retrieve
|
||||
return dbCtx
|
||||
.ProjList
|
||||
.Where(x => x.ProjDbId <= ProjDbIdStart)
|
||||
.OrderBy(x => x.ProjDbId)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get paginated data from DB (DESC ordered)
|
||||
/// </summary>
|
||||
/// <param name="PartDbIdStart"></param>
|
||||
/// <param name="numRecord"></param>
|
||||
/// <returns></returns>
|
||||
public List<ProjModel> GetPaginatedDesc(int PartDbIdStart, int numRecord)
|
||||
{
|
||||
int numEnd = PartDbIdStart - numRecord;
|
||||
// check numEnd
|
||||
if (numEnd < 0)
|
||||
numEnd = 0;
|
||||
// retrieve
|
||||
return dbCtx
|
||||
.ProjList
|
||||
.Where(x => x.ProjDbId <= PartDbIdStart)
|
||||
.OrderByDescending(x => x.ProjDbId)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
#endif
|
||||
/// <summary>
|
||||
/// Get record by ProjId converted
|
||||
/// </summary>
|
||||
/// <param name="ProjId"></param>
|
||||
/// <returns></returns>
|
||||
public Core.ProjFileM FindByProjIdConv(int ProjId)
|
||||
{
|
||||
return coreConv(FindByProjId(ProjId));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get filtered data by ProdId (ASC ordered)
|
||||
/// </summary>
|
||||
/// <param name="ProdDbId"></param>
|
||||
/// <returns></returns>
|
||||
public List<ProjModel> GetByProdAsc(int ProdId)
|
||||
public List<Core.ProjFileM> GetByProdAsc(int ProdId)
|
||||
{
|
||||
List<Core.ProjFileM> answ = new List<Core.ProjFileM>();
|
||||
int ProdDbId = 0;
|
||||
try
|
||||
{
|
||||
@@ -202,11 +192,14 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
Console.WriteLine($"EXCEPTION on GetByProdAsc: {exc}");
|
||||
}
|
||||
// retrieve
|
||||
return dbCtx
|
||||
var dbRes = dbCtx
|
||||
.ProjList
|
||||
.Where(x => x.ProdDbId == ProdDbId)
|
||||
.OrderBy(x => x.ProdDbId)
|
||||
.ToList();
|
||||
// conversione
|
||||
answ = dbRes.Select(x => coreConv(x)).ToList();
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -214,8 +207,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// </summary>
|
||||
/// <param name="ProdDbId"></param>
|
||||
/// <returns></returns>
|
||||
public List<ProjModel> GetByProdDesc(int ProdId)
|
||||
public List<Core.ProjFileM> GetByProdDesc(int ProdId)
|
||||
{
|
||||
List<Core.ProjFileM> answ = new List<Core.ProjFileM>();
|
||||
int ProdDbId = 0;
|
||||
try
|
||||
{
|
||||
@@ -233,11 +227,14 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
Console.WriteLine($"EXCEPTION on GetByProdAsc: {exc}");
|
||||
}
|
||||
// retrieve
|
||||
return dbCtx
|
||||
var dbRes = dbCtx
|
||||
.ProjList
|
||||
.Where(x => x.ProdDbId == ProdDbId)
|
||||
.OrderByDescending(x => x.ProdDbId)
|
||||
.ToList();
|
||||
// conversione
|
||||
answ = dbRes.Select(x => coreConv(x)).ToList();
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -247,14 +244,22 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public List<Core.ProjFileM> GetLastDesc(int numRecord)
|
||||
{
|
||||
List<Core.ProjFileM> result = new List<Core.ProjFileM>();
|
||||
|
||||
var dbResult = GetLastDbModelDesc(numRecord);
|
||||
List<Core.ProjFileM> answ = new List<Core.ProjFileM>();
|
||||
|
||||
// se numRecord = 0 --> passo tutti
|
||||
if (numRecord == 0)
|
||||
{
|
||||
numRecord = dbCtx.ProjList.Count();
|
||||
}
|
||||
// retrieve
|
||||
var dbRes = dbCtx
|
||||
.ProjList
|
||||
.OrderByDescending(x => x.ProjId)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
// conversione
|
||||
result = dbResult.Select(x => Core.ProjFileM.CreateProjFileM(x.ProjId, ProdIdByProdDbId(x.ProdDbId), x.DtCreated, x.DtExported, x.ListName, x.BTLFileName)).ToList();
|
||||
|
||||
return result;
|
||||
answ = dbRes.Select(x => coreConv(x)).ToList();
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -286,7 +291,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
// creo nuovo...
|
||||
var newRec = dbCtx
|
||||
.ProjList
|
||||
.Add(new ProjModel() { ProjId = nextId, BTLFileName = "", Locked = true });
|
||||
.Add(new ProjModel() { ProjId = nextId, BTLFileName = "", IsNew = true, Locked = true, DtCreated = DateTime.Now });
|
||||
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
@@ -300,7 +305,65 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <param name="ProjId">ProjID</param>
|
||||
/// <param name="Locked">Stato Lock da impostare</param>
|
||||
/// <returns></returns>
|
||||
public ProjModel LockByProjId(int ProjId, bool Locked)
|
||||
public Core.ProjFileM LockByProjId(int ProjId, bool Locked)
|
||||
{
|
||||
var currProj = dbCtx
|
||||
.ProjList
|
||||
.Where(x => x.ProjId == ProjId)
|
||||
.SingleOrDefault();
|
||||
// aggiorno stato del proj
|
||||
currProj.Locked = Locked;
|
||||
dbCtx.Entry(currProj).State = System.Data.Entity.EntityState.Modified;
|
||||
|
||||
// seleziono il prod e lo blocco...
|
||||
var currProd = dbCtx
|
||||
.ProdList
|
||||
.Where(x => x.ProdDbId == currProj.ProdDbId)
|
||||
.SingleOrDefault();
|
||||
|
||||
if (currProd != null)
|
||||
{
|
||||
// blocco prod corrente
|
||||
currProd.Locked = Locked;
|
||||
dbCtx.Entry(currProd).State = System.Data.Entity.EntityState.Modified;
|
||||
|
||||
// ora blocco altri proj del prod...
|
||||
var currProjs = dbCtx
|
||||
.ProjList
|
||||
.Where(x => x.ProdDbId == currProd.ProdDbId && x.ProjId != ProjId)
|
||||
.ToList();
|
||||
|
||||
//currProjs.ForEach(x => x.Locked = Locked);
|
||||
foreach (var item in currProjs)
|
||||
{
|
||||
//item.ProdDbId = currProd.ProdDbId;
|
||||
item.Locked = Locked;
|
||||
dbCtx.Entry(item).State = System.Data.Entity.EntityState.Modified;
|
||||
}
|
||||
}
|
||||
// salvataggio
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
|
||||
return coreConv(currProj);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reinizializzaizone del controller
|
||||
/// </summary>
|
||||
public void ResetController()
|
||||
{
|
||||
// Re-Initialize database context
|
||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reimposta come NEW
|
||||
/// </summary>
|
||||
/// <param name="ProjId">ProjID</param>
|
||||
/// <param name="Locked">Stato Lock da impostare</param>
|
||||
/// <returns></returns>
|
||||
public Core.ProjFileM ResetNew(int ProjId)
|
||||
{
|
||||
var currProj = dbCtx
|
||||
.ProjList
|
||||
@@ -308,18 +371,42 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
.SingleOrDefault();
|
||||
|
||||
// aggiorno stato
|
||||
currProj.Locked = Locked;
|
||||
|
||||
// seleziono il prod...
|
||||
var currProd = dbCtx
|
||||
.ProdList
|
||||
.Where(x => x.ProdDbId == currProj.ProdDbId)
|
||||
.SingleOrDefault();
|
||||
currProd.Locked = Locked;
|
||||
|
||||
currProj.IsNew = false;
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
|
||||
return currProj;
|
||||
return coreConv(currProj);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update single PROJ
|
||||
/// </summary>
|
||||
/// <param name="updItem"></param>
|
||||
/// <returns></returns>
|
||||
public bool Update(ProjModel updItem)
|
||||
{
|
||||
bool done = false;
|
||||
var item2update = dbCtx
|
||||
.ProjList
|
||||
.Where(x => x.ProjDbId == updItem.ProjDbId)
|
||||
.SingleOrDefault();
|
||||
try
|
||||
{
|
||||
// update, vers 1...
|
||||
dbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
|
||||
//// update, vers 2
|
||||
//dbCtx.PartList.Remove(item2del);
|
||||
//dbCtx.PartList.Add(updItem);
|
||||
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return done;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -330,22 +417,65 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public ProjModel UpdateBtlParts(int ProjId, List<Core.BTLPartM> BtlPartList)
|
||||
{
|
||||
// record del proj corrente
|
||||
var currData = FindByProjId(ProjId);
|
||||
|
||||
// sel delle BTLParts da proj
|
||||
var items2del = dbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.ProjDbId == currData.ProjDbId);
|
||||
// 2021.05.03 modifica update: esistenti le MODIFICO, nuove aggiungo, inesistenti elimino in cascata con Part
|
||||
|
||||
// converto le BtlParts
|
||||
var items2add = BtlPartList.Select(x => BTLPartController.ConvertFromCore(x, currData.ProjDbId)).ToList();
|
||||
// sel delle BTLParts del proj
|
||||
List<BTLPartModel> oldBtlParts = dbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.ProjDbId == currData.ProjDbId)
|
||||
.ToList();
|
||||
|
||||
// converto le BtlParts da core --> DB
|
||||
List<BTLPartModel> newBtlParts = BtlPartList.Select(x => BTLPartController.ConvertFromCore(x, currData.ProjDbId)).ToList();
|
||||
|
||||
try
|
||||
{
|
||||
// elimino dal DB
|
||||
dbCtx.BTLPartList.RemoveRange(items2del);
|
||||
// aggiungo le nuove
|
||||
dbCtx.BTLPartList.AddRange(items2add);
|
||||
// elementi BtlPartId NON + presenti da eliminare
|
||||
List<int> bpi2rem = oldBtlParts.Select(x => x.PartId).Except(newBtlParts.Select(y => y.PartId)).ToList();
|
||||
List<int> bpi2add = newBtlParts.Select(x => x.PartId).Except(oldBtlParts.Select(y => y.PartId)).ToList();
|
||||
List<int> bpiExis = newBtlParts.Select(x => x.PartId).Intersect(oldBtlParts.Select(y => y.PartId)).ToList();
|
||||
|
||||
// aggiorno existing...
|
||||
foreach (var currPartId in bpiExis)
|
||||
{
|
||||
// recupero item da aggiornare...
|
||||
var oldItem = oldBtlParts.Where(x => x.PartId == currPartId).FirstOrDefault();
|
||||
// dati nuovo item
|
||||
var newItem = newBtlParts.Where(x => x.PartId == currPartId).FirstOrDefault();
|
||||
if (newItem != null && oldItem != null)
|
||||
{
|
||||
oldItem.CALC_State = newItem.CALC_State;
|
||||
oldItem.CNT = newItem.CNT;
|
||||
oldItem.DO = newItem.DO;
|
||||
oldItem.H = newItem.H;
|
||||
oldItem.L = newItem.L;
|
||||
oldItem.W = newItem.W;
|
||||
oldItem.Material = newItem.Material;
|
||||
oldItem.NAM = newItem.NAM;
|
||||
oldItem.PDN = newItem.PDN;
|
||||
}
|
||||
}
|
||||
|
||||
// aggiungo le nuove part
|
||||
foreach (var newPartId in bpi2add)
|
||||
{
|
||||
var newItem = newBtlParts.Where(x => x.PartId == newPartId).FirstOrDefault();
|
||||
dbCtx.BTLPartList.Add(newItem);
|
||||
}
|
||||
|
||||
// elimino dal DB i non + esistenti
|
||||
foreach (var oldPartId in bpi2rem)
|
||||
{
|
||||
// elimino parts nei MachGroup
|
||||
var oldIstPartList = dbCtx.PartList.Where(x => x.BTLPart.PartId == oldPartId).ToList();
|
||||
dbCtx.PartList.RemoveRange(oldIstPartList);
|
||||
// elimino BtlParts
|
||||
var oldItem = oldBtlParts.Where(x => x.PartId == oldPartId).FirstOrDefault();
|
||||
dbCtx.BTLPartList.Remove(oldItem);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
@@ -355,26 +485,51 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
|
||||
return currData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update record su DB x nome
|
||||
/// Update record su DB x nomeBTL, ListName, ExportDate
|
||||
/// </summary>
|
||||
/// <param name="ProjId"></param>
|
||||
/// <param name="newBTLFileName"></param>
|
||||
/// <param name="BTLFileName"></param>
|
||||
/// <param name="ListName"></param>
|
||||
/// <param name="DtExported"></param>
|
||||
/// <returns></returns>
|
||||
public ProjModel UpdateName(int ProjId, string newBTLFileName)
|
||||
public Core.ProjFileM UpdateInfo(int ProjId, string BTLFileName, string ListName, DateTime DtExported)
|
||||
{
|
||||
var currData = FindByProjId(ProjId);
|
||||
// aggiorno valore BTL
|
||||
currData.BTLFileName = newBTLFileName;
|
||||
currData.BTLFileName = BTLFileName;
|
||||
currData.DtExported = DtExported;
|
||||
currData.ListName = ListName;
|
||||
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
|
||||
return currData;
|
||||
return coreConv(currData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update record su DB x nomeBTL, ListName, ExportDate
|
||||
/// </summary>
|
||||
/// <param name="ProjId"></param>
|
||||
/// <param name="ListName"></param>
|
||||
/// <returns></returns>
|
||||
public Core.ProjFileM UpdateListName(int ProjId, string ListName)
|
||||
{
|
||||
var currData = FindByProjId(ProjId);
|
||||
// aggiorno valore BTL
|
||||
currData.ListName = ListName;
|
||||
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
|
||||
return coreConv(currData);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
@@ -0,0 +1,244 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
public class StatusMapController : IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private DatabaseContext dbCtx;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Fields
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto statico per gestione chiamate da altre classi
|
||||
/// </summary>
|
||||
public static StatusMapController man = new StatusMapController();
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public StatusMapController()
|
||||
{
|
||||
// Initialize database context
|
||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Elimina i dati di una sessione (SupervisorId) precedente
|
||||
/// </summary>
|
||||
/// <param name="Session">Se vuoto --> tutti</param>
|
||||
/// <returns></returns>
|
||||
public bool DeleteSession(string Session)
|
||||
{
|
||||
bool done = false;
|
||||
DateTime adesso = DateTime.Now;
|
||||
List<StatusMapModel> SM2Del = new List<StatusMapModel>();
|
||||
|
||||
// svuoto la tab mappa precedente (da rivalutare in futuro)
|
||||
if (string.IsNullOrEmpty(Session))
|
||||
{
|
||||
SM2Del = dbCtx
|
||||
.StatusMapList
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SM2Del = dbCtx
|
||||
.StatusMapList
|
||||
.Where(x => x.Session == Session)
|
||||
.ToList();
|
||||
}
|
||||
try
|
||||
{
|
||||
// Remove to database
|
||||
dbCtx.StatusMapList.RemoveRange(SM2Del);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on DeleteSession: {exc}");
|
||||
}
|
||||
|
||||
return done;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database context
|
||||
dbCtx.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get ALL data for session ordered by index DESC
|
||||
/// </summary>
|
||||
/// <param name="Session"></param>
|
||||
/// <returns></returns>
|
||||
public List<StatusMapModel> GetBySession(string Session = "")
|
||||
{
|
||||
// retrieve
|
||||
return dbCtx
|
||||
.StatusMapList
|
||||
.Where(x => x.Session == Session)
|
||||
.OrderByDescending(x => x.Index)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get data for session where Index > minIndex ordered by index DESC
|
||||
/// </summary>
|
||||
/// <param name="minIndex"></param>
|
||||
/// <returns></returns>
|
||||
public List<StatusMapModel> GetFrom(int minIndex = 0)
|
||||
{
|
||||
// retrieve
|
||||
return dbCtx
|
||||
.StatusMapList
|
||||
.Where(x => x.Index >= minIndex)
|
||||
.OrderByDescending(x => x.Index)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get PROD data for session
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<StatusMapModel> GetProd()
|
||||
{
|
||||
// retrieve
|
||||
return dbCtx
|
||||
.StatusMapList
|
||||
.Where(x => x.ItemType == Core.StatusMapItemType.Prod)
|
||||
.OrderByDescending(x => x.Index)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reinizializzaizone del controller
|
||||
/// </summary>
|
||||
public void ResetController()
|
||||
{
|
||||
// Re-Initialize database context
|
||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indica che si inizia a prendere in carico un PROD dal supervisor
|
||||
/// </summary>
|
||||
/// <param name="ProdId"></param>
|
||||
/// <param name="ProjId"></param>
|
||||
/// <returns></returns>
|
||||
public bool StartProd(int ProdId, string SupervisorId)
|
||||
{
|
||||
bool done = false;
|
||||
DateTime adesso = DateTime.Now;
|
||||
|
||||
// svuoto dati precedenti
|
||||
done = DeleteSession("");
|
||||
|
||||
// se ho fatto inserisco nuovo
|
||||
if (done)
|
||||
{
|
||||
// reset validità
|
||||
done = false;
|
||||
// inserisco dato prod
|
||||
StatusMapModel prodSMRecord = new StatusMapModel() { Session = SupervisorId, Index = 0, ItemId = ProdId, ItemType = Core.StatusMapItemType.Prod, Operation = Core.StatusMapOpType.Startup, DtEvent = adesso, Val = "" };
|
||||
// aggiungo
|
||||
dbCtx.StatusMapList.Add(prodSMRecord);
|
||||
|
||||
// recupero MachGroup da PROD
|
||||
var MGList = dbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.Prod.ProdId == ProdId)
|
||||
.ToList();
|
||||
|
||||
var mgSMRecords = MGList.Select(x => new StatusMapModel() { Session = SupervisorId, Index = 0, ItemId = x.MachGroupId, ItemType = Core.StatusMapItemType.MachGroup, Operation = Core.StatusMapOpType.Startup, DtEvent = adesso, Val = "" }).ToList();
|
||||
// aggiungo
|
||||
dbCtx.StatusMapList.AddRange(mgSMRecords);
|
||||
|
||||
// salvo
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiornamento di un record (e del prod) come da richiesta
|
||||
/// </summary>
|
||||
/// <param name="Session"></param>
|
||||
/// <param name="ProdId"></param>
|
||||
/// <param name="ItemId"></param>
|
||||
/// <param name="ItemType"></param>
|
||||
/// <param name="Operation"></param>
|
||||
/// <param name="Value"></param>
|
||||
/// <returns></returns>
|
||||
public bool UpdateAction(String Session, int ProdId, int ItemId, Core.StatusMapItemType ItemType, Core.StatusMapOpType Operation, string Value)
|
||||
{
|
||||
bool fatto = false;
|
||||
// Recupero il record PROD (che è ultimo indice)
|
||||
StatusMapModel prodData = new StatusMapModel();
|
||||
// se è un prod --> vado x ID
|
||||
if (Session == "")
|
||||
{
|
||||
prodData = dbCtx
|
||||
.StatusMapList
|
||||
.Where(x => x.ItemType == Core.StatusMapItemType.Prod && x.ItemId == ProdId)
|
||||
.SingleOrDefault();
|
||||
}
|
||||
else
|
||||
{
|
||||
prodData = dbCtx
|
||||
.StatusMapList
|
||||
.Where(x => x.ItemType == Core.StatusMapItemType.Prod && x.Session == Session)
|
||||
.SingleOrDefault();
|
||||
}
|
||||
// se ho trovato
|
||||
if (prodData != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
// aggiorno indice PROD
|
||||
prodData.Index++;
|
||||
// recupero record richiesto
|
||||
var currRecor = dbCtx
|
||||
.StatusMapList
|
||||
.Where(x => x.ItemType == ItemType && x.ItemId == ItemId && x.Session == Session)
|
||||
.SingleOrDefault();
|
||||
|
||||
// aggiorno
|
||||
currRecor.Index = prodData.Index;
|
||||
currRecor.Operation = Operation;
|
||||
currRecor.Val = Value;
|
||||
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on UpdateAction: {exc}");
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ using System.Data.Entity.Infrastructure.MappingViews;
|
||||
|
||||
[assembly: DbMappingViewCacheTypeAttribute(
|
||||
typeof(EgtBEAMWALL.DataLayer.DatabaseContext),
|
||||
typeof(Edm_EntityMappingGeneratedViews.ViewsForBaseEntitySetsd48adf5bc101fdf35f60fe4b1751d23ae6e1294bd960d91e6583c77061593779))]
|
||||
typeof(Edm_EntityMappingGeneratedViews.ViewsForBaseEntitySets2a70b5e578abdbcbb91ea4a5002c25750fd61f2b76495520401ff22a445540d2))]
|
||||
|
||||
namespace Edm_EntityMappingGeneratedViews
|
||||
{
|
||||
@@ -23,14 +23,14 @@ namespace Edm_EntityMappingGeneratedViews
|
||||
/// Implements a mapping view cache.
|
||||
/// </summary>
|
||||
[GeneratedCode("Entity Framework 6 Power Tools", "0.9.2.0")]
|
||||
internal sealed class ViewsForBaseEntitySetsd48adf5bc101fdf35f60fe4b1751d23ae6e1294bd960d91e6583c77061593779 : DbMappingViewCache
|
||||
internal sealed class ViewsForBaseEntitySets2a70b5e578abdbcbb91ea4a5002c25750fd61f2b76495520401ff22a445540d2 : DbMappingViewCache
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a hash value computed over the mapping closure.
|
||||
/// </summary>
|
||||
public override string MappingHashValue
|
||||
{
|
||||
get { return "d48adf5bc101fdf35f60fe4b1751d23ae6e1294bd960d91e6583c77061593779"; }
|
||||
get { return "2a70b5e578abdbcbb91ea4a5002c25750fd61f2b76495520401ff22a445540d2"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -97,6 +97,36 @@ namespace Edm_EntityMappingGeneratedViews
|
||||
return GetView9();
|
||||
}
|
||||
|
||||
if (extentName == "CodeFirstDatabase.LogMachineModel")
|
||||
{
|
||||
return GetView10();
|
||||
}
|
||||
|
||||
if (extentName == "DatabaseContext.LogMachineList")
|
||||
{
|
||||
return GetView11();
|
||||
}
|
||||
|
||||
if (extentName == "CodeFirstDatabase.LogSupportModel")
|
||||
{
|
||||
return GetView12();
|
||||
}
|
||||
|
||||
if (extentName == "DatabaseContext.LogSupportList")
|
||||
{
|
||||
return GetView13();
|
||||
}
|
||||
|
||||
if (extentName == "CodeFirstDatabase.StatusMapModel")
|
||||
{
|
||||
return GetView14();
|
||||
}
|
||||
|
||||
if (extentName == "DatabaseContext.StatusMapList")
|
||||
{
|
||||
return GetView15();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -108,15 +138,13 @@ namespace Edm_EntityMappingGeneratedViews
|
||||
{
|
||||
return new DbMappingView(@"
|
||||
SELECT VALUE -- Constructing BTLPartModel
|
||||
[CodeFirstDatabaseSchema.BTLPartModel](T1.BTLPartModel_DbId, T1.BTLPartModel_CalcState, T1.BTLPartModel_CNT, T1.BTLPartModel_DO, T1.BTLPartModel_DON, T1.BTLPartModel_GRP, T1.BTLPartModel_H, T1.BTLPartModel_L, T1.BTLPartModel_Material, T1.BTLPartModel_NAM, T1.BTLPartModel_Id, T1.BTLPartModel_PDN, T1.BTLPartModel_ProjDbId, T1.BTLPartModel_ROT, T1.BTLPartModel_TBP, T1.BTLPartModel_UNT, T1.BTLPartModel_W)
|
||||
[CodeFirstDatabaseSchema.BTLPartModel](T1.BTLPartModel_DbId, T1.BTLPartModel_CalcState, T1.BTLPartModel_CNT, T1.BTLPartModel_DO, T1.BTLPartModel_H, T1.BTLPartModel_L, T1.BTLPartModel_Material, T1.BTLPartModel_NAM, T1.BTLPartModel_Id, T1.BTLPartModel_PDN, T1.BTLPartModel_ProjDbId, T1.BTLPartModel_W)
|
||||
FROM (
|
||||
SELECT
|
||||
T.BTLPartDbId AS BTLPartModel_DbId,
|
||||
T.CALC_State AS BTLPartModel_CalcState,
|
||||
T.CNT AS BTLPartModel_CNT,
|
||||
T.DO AS BTLPartModel_DO,
|
||||
T.DON AS BTLPartModel_DON,
|
||||
T.GRP AS BTLPartModel_GRP,
|
||||
T.H AS BTLPartModel_H,
|
||||
T.L AS BTLPartModel_L,
|
||||
T.Material AS BTLPartModel_Material,
|
||||
@@ -124,9 +152,6 @@ namespace Edm_EntityMappingGeneratedViews
|
||||
T.PartId AS BTLPartModel_Id,
|
||||
T.PDN AS BTLPartModel_PDN,
|
||||
T.ProjDbId AS BTLPartModel_ProjDbId,
|
||||
T.ROT AS BTLPartModel_ROT,
|
||||
T.TBP AS BTLPartModel_TBP,
|
||||
T.UNT AS BTLPartModel_UNT,
|
||||
T.W AS BTLPartModel_W,
|
||||
True AS _from0
|
||||
FROM DatabaseContext.BTLPartList AS T
|
||||
@@ -141,12 +166,15 @@ namespace Edm_EntityMappingGeneratedViews
|
||||
{
|
||||
return new DbMappingView(@"
|
||||
SELECT VALUE -- Constructing ProjModel
|
||||
[CodeFirstDatabaseSchema.ProjModel](T1.ProjModel_ProjDbId, T1.ProjModel_BTLFileName, T1.ProjModel_IsNew, T1.ProjModel_Lock, T1.ProjModel_ProdDbId, T1.ProjModel_Id)
|
||||
[CodeFirstDatabaseSchema.ProjModel](T1.ProjModel_ProjDbId, T1.ProjModel_BTLFileName, T1.ProjModel_DtCreated, T1.ProjModel_DtExported, T1.ProjModel_IsNew, T1.ProjModel_ListName, T1.ProjModel_Lock, T1.ProjModel_ProdDbId, T1.ProjModel_Id)
|
||||
FROM (
|
||||
SELECT
|
||||
T.ProjDbId AS ProjModel_ProjDbId,
|
||||
T.BTLFileName AS ProjModel_BTLFileName,
|
||||
T.DtCreated AS ProjModel_DtCreated,
|
||||
T.DtExported AS ProjModel_DtExported,
|
||||
T.IsNew AS ProjModel_IsNew,
|
||||
T.ListName AS ProjModel_ListName,
|
||||
T.Locked AS ProjModel_Lock,
|
||||
T.ProdDbId AS ProjModel_ProdDbId,
|
||||
T.ProjId AS ProjModel_Id,
|
||||
@@ -163,11 +191,12 @@ namespace Edm_EntityMappingGeneratedViews
|
||||
{
|
||||
return new DbMappingView(@"
|
||||
SELECT VALUE -- Constructing ProdModel
|
||||
[CodeFirstDatabaseSchema.ProdModel](T1.ProdModel_ProdDbId, T1.ProdModel_Description, T1.ProdModel_IsNew, T1.ProdModel_Lock, T1.ProdModel_Id)
|
||||
[CodeFirstDatabaseSchema.ProdModel](T1.ProdModel_ProdDbId, T1.ProdModel_Description, T1.ProdModel_DtCreated, T1.ProdModel_IsNew, T1.ProdModel_Lock, T1.ProdModel_Id)
|
||||
FROM (
|
||||
SELECT
|
||||
T.ProdDbId AS ProdModel_ProdDbId,
|
||||
T.Description AS ProdModel_Description,
|
||||
T.DtCreated AS ProdModel_DtCreated,
|
||||
T.IsNew AS ProdModel_IsNew,
|
||||
T.Locked AS ProdModel_Lock,
|
||||
T.ProdId AS ProdModel_Id,
|
||||
@@ -184,11 +213,12 @@ namespace Edm_EntityMappingGeneratedViews
|
||||
{
|
||||
return new DbMappingView(@"
|
||||
SELECT VALUE -- Constructing MachGroupModel
|
||||
[CodeFirstDatabaseSchema.MachGroupModel](T1.MachGroupModel_DbId, T1.MachGroupModel_Assign, T1.MachGroupModel_H, T1.MachGroupModel_L, T1.MachGroupModel_Lock, T1.MachGroupModel_LogRev, T1.MachGroupModel_Id, T1.MachGroupModel_Material, T1.MachGroupModel_Name, T1.MachGroupModel_Order, T1.MachGroupModel_ProdDbId, T1.MachGroupModel_State, T1.MachGroupModel_W)
|
||||
[CodeFirstDatabaseSchema.MachGroupModel](T1.MachGroupModel_DbId, T1.MachGroupModel_DtEnd, T1.MachGroupModel_DtStart, T1.MachGroupModel_H, T1.MachGroupModel_L, T1.MachGroupModel_Lock, T1.MachGroupModel_LogRev, T1.MachGroupModel_Id, T1.MachGroupModel_Material, T1.MachGroupModel_Name, T1.MachGroupModel_ProdDbId, T1.MachGroupModel_ProdIndex, T1.MachGroupModel_State, T1.MachGroupModel_SupervisorId, T1.MachGroupModel_W)
|
||||
FROM (
|
||||
SELECT
|
||||
T.MachGroupDbId AS MachGroupModel_DbId,
|
||||
T.Assign AS MachGroupModel_Assign,
|
||||
T.DtEnd AS MachGroupModel_DtEnd,
|
||||
T.DtStart AS MachGroupModel_DtStart,
|
||||
T.H AS MachGroupModel_H,
|
||||
T.L AS MachGroupModel_L,
|
||||
T.Locked AS MachGroupModel_Lock,
|
||||
@@ -196,9 +226,10 @@ namespace Edm_EntityMappingGeneratedViews
|
||||
T.MachGroupId AS MachGroupModel_Id,
|
||||
T.Material AS MachGroupModel_Material,
|
||||
T.Name AS MachGroupModel_Name,
|
||||
T.[Order] AS MachGroupModel_Order,
|
||||
T.ProdDbId AS MachGroupModel_ProdDbId,
|
||||
T.ProdIndex AS MachGroupModel_ProdIndex,
|
||||
CAST(T.State AS [Edm.Int32]) AS MachGroupModel_State,
|
||||
T.SupervisorId AS MachGroupModel_SupervisorId,
|
||||
T.W AS MachGroupModel_W,
|
||||
True AS _from0
|
||||
FROM DatabaseContext.MachGroupList AS T
|
||||
@@ -213,12 +244,14 @@ namespace Edm_EntityMappingGeneratedViews
|
||||
{
|
||||
return new DbMappingView(@"
|
||||
SELECT VALUE -- Constructing PartModel
|
||||
[CodeFirstDatabaseSchema.PartModel](T1.PartModel_DbId, T1.PartModel_BTLPartDbId, T1.PartModel_CalcState, T1.PartModel_GRP, T1.PartModel_H, T1.PartModel_L, T1.PartModel_MachGroupDbId, T1.PartModel_Material, T1.PartModel_NAM, T1.PartModel_Id, T1.PartModel_PDN, T1.PartModel_ROT, T1.PartModel_State, T1.PartModel_W)
|
||||
[CodeFirstDatabaseSchema.PartModel](T1.PartModel_DbId, T1.PartModel_BTLPartDbId, T1.PartModel_CalcState, T1.PartModel_DtEnd, T1.PartModel_DtStart, T1.PartModel_GRP, T1.PartModel_H, T1.PartModel_L, T1.PartModel_MachGroupDbId, T1.PartModel_Material, T1.PartModel_NAM, T1.PartModel_Id, T1.PartModel_PDN, T1.PartModel_ROT, T1.PartModel_State, T1.PartModel_W)
|
||||
FROM (
|
||||
SELECT
|
||||
T.PartDbId AS PartModel_DbId,
|
||||
T.BTLPartDbId AS PartModel_BTLPartDbId,
|
||||
T.CALC_State AS PartModel_CalcState,
|
||||
T.DtEnd AS PartModel_DtEnd,
|
||||
T.DtStart AS PartModel_DtStart,
|
||||
T.GRP AS PartModel_GRP,
|
||||
T.H AS PartModel_H,
|
||||
T.L AS PartModel_L,
|
||||
@@ -243,15 +276,13 @@ namespace Edm_EntityMappingGeneratedViews
|
||||
{
|
||||
return new DbMappingView(@"
|
||||
SELECT VALUE -- Constructing BTLPartList
|
||||
[EgtBEAMWALL.DataLayer.BTLPartModel](T1.BTLPartModel_BTLPartDbId, T1.[BTLPartModel.CALC_State], T1.BTLPartModel_CNT, T1.BTLPartModel_DO, T1.BTLPartModel_DON, T1.BTLPartModel_GRP, T1.BTLPartModel_H, T1.BTLPartModel_L, T1.BTLPartModel_Material, T1.BTLPartModel_NAM, T1.BTLPartModel_PartId, T1.BTLPartModel_PDN, T1.BTLPartModel_ProjDbId, T1.BTLPartModel_ROT, T1.BTLPartModel_TBP, T1.BTLPartModel_UNT, T1.BTLPartModel_W)
|
||||
[EgtBEAMWALL.DataLayer.BTLPartModel](T1.BTLPartModel_BTLPartDbId, T1.[BTLPartModel.CALC_State], T1.BTLPartModel_CNT, T1.BTLPartModel_DO, T1.BTLPartModel_H, T1.BTLPartModel_L, T1.BTLPartModel_Material, T1.BTLPartModel_NAM, T1.BTLPartModel_PartId, T1.BTLPartModel_PDN, T1.BTLPartModel_ProjDbId, T1.BTLPartModel_W)
|
||||
FROM (
|
||||
SELECT
|
||||
T.DbId AS BTLPartModel_BTLPartDbId,
|
||||
T.CalcState AS [BTLPartModel.CALC_State],
|
||||
T.CNT AS BTLPartModel_CNT,
|
||||
T.DO AS BTLPartModel_DO,
|
||||
T.DON AS BTLPartModel_DON,
|
||||
T.GRP AS BTLPartModel_GRP,
|
||||
T.H AS BTLPartModel_H,
|
||||
T.L AS BTLPartModel_L,
|
||||
T.Material AS BTLPartModel_Material,
|
||||
@@ -259,9 +290,6 @@ namespace Edm_EntityMappingGeneratedViews
|
||||
T.Id AS BTLPartModel_PartId,
|
||||
T.PDN AS BTLPartModel_PDN,
|
||||
T.ProjDbId AS BTLPartModel_ProjDbId,
|
||||
T.ROT AS BTLPartModel_ROT,
|
||||
T.TBP AS BTLPartModel_TBP,
|
||||
T.UNT AS BTLPartModel_UNT,
|
||||
T.W AS BTLPartModel_W,
|
||||
True AS _from0
|
||||
FROM CodeFirstDatabase.BTLPartModel AS T
|
||||
@@ -276,12 +304,15 @@ namespace Edm_EntityMappingGeneratedViews
|
||||
{
|
||||
return new DbMappingView(@"
|
||||
SELECT VALUE -- Constructing ProjList
|
||||
[EgtBEAMWALL.DataLayer.ProjModel](T1.ProjModel_ProjDbId, T1.ProjModel_BTLFileName, T1.ProjModel_IsNew, T1.ProjModel_Locked, T1.ProjModel_ProdDbId, T1.ProjModel_ProjId)
|
||||
[EgtBEAMWALL.DataLayer.ProjModel](T1.ProjModel_ProjDbId, T1.ProjModel_BTLFileName, T1.ProjModel_DtCreated, T1.ProjModel_DtExported, T1.ProjModel_IsNew, T1.ProjModel_ListName, T1.ProjModel_Locked, T1.ProjModel_ProdDbId, T1.ProjModel_ProjId)
|
||||
FROM (
|
||||
SELECT
|
||||
T.ProjDbId AS ProjModel_ProjDbId,
|
||||
T.BTLFileName AS ProjModel_BTLFileName,
|
||||
T.DtCreated AS ProjModel_DtCreated,
|
||||
T.DtExported AS ProjModel_DtExported,
|
||||
T.IsNew AS ProjModel_IsNew,
|
||||
T.ListName AS ProjModel_ListName,
|
||||
T.Lock AS ProjModel_Locked,
|
||||
T.ProdDbId AS ProjModel_ProdDbId,
|
||||
T.Id AS ProjModel_ProjId,
|
||||
@@ -298,11 +329,12 @@ namespace Edm_EntityMappingGeneratedViews
|
||||
{
|
||||
return new DbMappingView(@"
|
||||
SELECT VALUE -- Constructing ProdList
|
||||
[EgtBEAMWALL.DataLayer.ProdModel](T1.ProdModel_ProdDbId, T1.ProdModel_Description, T1.ProdModel_IsNew, T1.ProdModel_Locked, T1.ProdModel_ProdId)
|
||||
[EgtBEAMWALL.DataLayer.ProdModel](T1.ProdModel_ProdDbId, T1.ProdModel_Description, T1.ProdModel_DtCreated, T1.ProdModel_IsNew, T1.ProdModel_Locked, T1.ProdModel_ProdId)
|
||||
FROM (
|
||||
SELECT
|
||||
T.ProdDbId AS ProdModel_ProdDbId,
|
||||
T.Description AS ProdModel_Description,
|
||||
T.DtCreated AS ProdModel_DtCreated,
|
||||
T.IsNew AS ProdModel_IsNew,
|
||||
T.Lock AS ProdModel_Locked,
|
||||
T.Id AS ProdModel_ProdId,
|
||||
@@ -319,11 +351,12 @@ namespace Edm_EntityMappingGeneratedViews
|
||||
{
|
||||
return new DbMappingView(@"
|
||||
SELECT VALUE -- Constructing MachGroupList
|
||||
[EgtBEAMWALL.DataLayer.MachGroupModel](T1.MachGroupModel_MachGroupDbId, T1.MachGroupModel_Assign, T1.MachGroupModel_H, T1.MachGroupModel_L, T1.MachGroupModel_Locked, T1.MachGroupModel_LogRev, T1.MachGroupModel_MachGroupId, T1.MachGroupModel_Material, T1.MachGroupModel_Name, T1.MachGroupModel_Order, T1.MachGroupModel_ProdDbId, T1.MachGroupModel_State, T1.MachGroupModel_W)
|
||||
[EgtBEAMWALL.DataLayer.MachGroupModel](T1.MachGroupModel_MachGroupDbId, T1.MachGroupModel_DtEnd, T1.MachGroupModel_DtStart, T1.MachGroupModel_H, T1.MachGroupModel_L, T1.MachGroupModel_Locked, T1.MachGroupModel_LogRev, T1.MachGroupModel_MachGroupId, T1.MachGroupModel_Material, T1.MachGroupModel_Name, T1.MachGroupModel_ProdDbId, T1.MachGroupModel_ProdIndex, T1.MachGroupModel_State, T1.MachGroupModel_SupervisorId, T1.MachGroupModel_W)
|
||||
FROM (
|
||||
SELECT
|
||||
T.DbId AS MachGroupModel_MachGroupDbId,
|
||||
T.Assign AS MachGroupModel_Assign,
|
||||
T.DtEnd AS MachGroupModel_DtEnd,
|
||||
T.DtStart AS MachGroupModel_DtStart,
|
||||
T.H AS MachGroupModel_H,
|
||||
T.L AS MachGroupModel_L,
|
||||
T.Lock AS MachGroupModel_Locked,
|
||||
@@ -331,9 +364,10 @@ namespace Edm_EntityMappingGeneratedViews
|
||||
T.Id AS MachGroupModel_MachGroupId,
|
||||
T.Material AS MachGroupModel_Material,
|
||||
T.Name AS MachGroupModel_Name,
|
||||
T.[Order] AS MachGroupModel_Order,
|
||||
T.ProdDbId AS MachGroupModel_ProdDbId,
|
||||
T.ProdIndex AS MachGroupModel_ProdIndex,
|
||||
CAST(T.State AS [EgtBEAMWALL.DataLayer.ItemState]) AS MachGroupModel_State,
|
||||
T.SupervisorId AS MachGroupModel_SupervisorId,
|
||||
T.W AS MachGroupModel_W,
|
||||
True AS _from0
|
||||
FROM CodeFirstDatabase.MachGroupModel AS T
|
||||
@@ -348,12 +382,14 @@ namespace Edm_EntityMappingGeneratedViews
|
||||
{
|
||||
return new DbMappingView(@"
|
||||
SELECT VALUE -- Constructing PartList
|
||||
[EgtBEAMWALL.DataLayer.PartModel](T1.PartModel_PartDbId, T1.PartModel_BTLPartDbId, T1.[PartModel.CALC_State], T1.PartModel_GRP, T1.PartModel_H, T1.PartModel_L, T1.PartModel_MachGroupDbId, T1.PartModel_Material, T1.PartModel_NAM, T1.PartModel_PartId, T1.PartModel_PDN, T1.PartModel_ROT, T1.PartModel_State, T1.PartModel_W)
|
||||
[EgtBEAMWALL.DataLayer.PartModel](T1.PartModel_PartDbId, T1.PartModel_BTLPartDbId, T1.[PartModel.CALC_State], T1.PartModel_DtEnd, T1.PartModel_DtStart, T1.PartModel_GRP, T1.PartModel_H, T1.PartModel_L, T1.PartModel_MachGroupDbId, T1.PartModel_Material, T1.PartModel_NAM, T1.PartModel_PartId, T1.PartModel_PDN, T1.PartModel_ROT, T1.PartModel_State, T1.PartModel_W)
|
||||
FROM (
|
||||
SELECT
|
||||
T.DbId AS PartModel_PartDbId,
|
||||
T.BTLPartDbId AS PartModel_BTLPartDbId,
|
||||
T.CalcState AS [PartModel.CALC_State],
|
||||
T.DtEnd AS PartModel_DtEnd,
|
||||
T.DtStart AS PartModel_DtStart,
|
||||
T.GRP AS PartModel_GRP,
|
||||
T.H AS PartModel_H,
|
||||
T.L AS PartModel_L,
|
||||
@@ -367,6 +403,156 @@ namespace Edm_EntityMappingGeneratedViews
|
||||
T.W AS PartModel_W,
|
||||
True AS _from0
|
||||
FROM CodeFirstDatabase.PartModel AS T
|
||||
) AS T1");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the view for CodeFirstDatabase.LogMachineModel.
|
||||
/// </summary>
|
||||
/// <returns>The mapping view.</returns>
|
||||
private static DbMappingView GetView10()
|
||||
{
|
||||
return new DbMappingView(@"
|
||||
SELECT VALUE -- Constructing LogMachineModel
|
||||
[CodeFirstDatabaseSchema.LogMachineModel](T1.LogMachineModel_DbId, T1.LogMachineModel_AlarmCode, T1.LogMachineModel_AlarmDtEvent, T1.LogMachineModel_AlarmMessage, T1.LogMachineModel_AlarmOperation, T1.LogMachineModel_AlarmType, T1.LogMachineModel_CommExecuted, T1.LogMachineModel_CommandState, T1.LogMachineModel_CommandType, T1.LogMachineModel_Description, T1.LogMachineModel_NewOpState, T1.LogMachineModel_ResultType, T1.LogMachineModel_VarAddress, T1.LogMachineModel_VarValue)
|
||||
FROM (
|
||||
SELECT
|
||||
T.LogDbId AS LogMachineModel_DbId,
|
||||
T.AlarmCode AS LogMachineModel_AlarmCode,
|
||||
T.AlarmDatetime AS LogMachineModel_AlarmDtEvent,
|
||||
T.AlarmMessage AS LogMachineModel_AlarmMessage,
|
||||
T.AlarmOperation AS LogMachineModel_AlarmOperation,
|
||||
T.AlarmType AS LogMachineModel_AlarmType,
|
||||
T.CommandExecutedCorrectly AS LogMachineModel_CommExecuted,
|
||||
CAST(T.CommandState AS [Edm.Int32]) AS LogMachineModel_CommandState,
|
||||
CAST(T.CommandType AS [Edm.Int32]) AS LogMachineModel_CommandType,
|
||||
T.Description AS LogMachineModel_Description,
|
||||
T.NewOpState AS LogMachineModel_NewOpState,
|
||||
CAST(T.ResultType AS [Edm.Int32]) AS LogMachineModel_ResultType,
|
||||
T.VarAddress AS LogMachineModel_VarAddress,
|
||||
T.VarValue AS LogMachineModel_VarValue,
|
||||
True AS _from0
|
||||
FROM DatabaseContext.LogMachineList AS T
|
||||
) AS T1");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the view for DatabaseContext.LogMachineList.
|
||||
/// </summary>
|
||||
/// <returns>The mapping view.</returns>
|
||||
private static DbMappingView GetView11()
|
||||
{
|
||||
return new DbMappingView(@"
|
||||
SELECT VALUE -- Constructing LogMachineList
|
||||
[EgtBEAMWALL.DataLayer.LogMachineModel](T1.LogMachineModel_LogDbId, T1.LogMachineModel_AlarmCode, T1.LogMachineModel_AlarmDatetime, T1.LogMachineModel_AlarmMessage, T1.LogMachineModel_AlarmOperation, T1.LogMachineModel_AlarmType, T1.LogMachineModel_CommandExecutedCorrectly, T1.LogMachineModel_CommandState, T1.LogMachineModel_CommandType, T1.LogMachineModel_Description, T1.LogMachineModel_NewOpState, T1.LogMachineModel_ResultType, T1.LogMachineModel_VarAddress, T1.LogMachineModel_VarValue)
|
||||
FROM (
|
||||
SELECT
|
||||
T.DbId AS LogMachineModel_LogDbId,
|
||||
T.AlarmCode AS LogMachineModel_AlarmCode,
|
||||
T.AlarmDtEvent AS LogMachineModel_AlarmDatetime,
|
||||
T.AlarmMessage AS LogMachineModel_AlarmMessage,
|
||||
T.AlarmOperation AS LogMachineModel_AlarmOperation,
|
||||
T.AlarmType AS LogMachineModel_AlarmType,
|
||||
T.CommExecuted AS LogMachineModel_CommandExecutedCorrectly,
|
||||
CAST(T.CommandState AS [EgtBEAMWALL.DataLayer.CommandStates]) AS LogMachineModel_CommandState,
|
||||
CAST(T.CommandType AS [EgtBEAMWALL.DataLayer.LogCommandTypes]) AS LogMachineModel_CommandType,
|
||||
T.Description AS LogMachineModel_Description,
|
||||
T.NewOpState AS LogMachineModel_NewOpState,
|
||||
CAST(T.ResultType AS [EgtBEAMWALL.DataLayer.ResultTypes]) AS LogMachineModel_ResultType,
|
||||
T.VarAddress AS LogMachineModel_VarAddress,
|
||||
T.VarValue AS LogMachineModel_VarValue,
|
||||
True AS _from0
|
||||
FROM CodeFirstDatabase.LogMachineModel AS T
|
||||
) AS T1");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the view for CodeFirstDatabase.LogSupportModel.
|
||||
/// </summary>
|
||||
/// <returns>The mapping view.</returns>
|
||||
private static DbMappingView GetView12()
|
||||
{
|
||||
return new DbMappingView(@"
|
||||
SELECT VALUE -- Constructing LogSupportModel
|
||||
[CodeFirstDatabaseSchema.LogSupportModel](T1.LogSupportModel_DbId, T1.LogSupportModel_DtEvent, T1.LogSupportModel_Level, T1.LogSupportModel_Message, T1.LogSupportModel_Target)
|
||||
FROM (
|
||||
SELECT
|
||||
T.LogDbId AS LogSupportModel_DbId,
|
||||
T.DtEvent AS LogSupportModel_DtEvent,
|
||||
CAST(T.Level AS [Edm.Int32]) AS LogSupportModel_Level,
|
||||
T.Message AS LogSupportModel_Message,
|
||||
CAST(T.Target AS [Edm.Int32]) AS LogSupportModel_Target,
|
||||
True AS _from0
|
||||
FROM DatabaseContext.LogSupportList AS T
|
||||
) AS T1");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the view for DatabaseContext.LogSupportList.
|
||||
/// </summary>
|
||||
/// <returns>The mapping view.</returns>
|
||||
private static DbMappingView GetView13()
|
||||
{
|
||||
return new DbMappingView(@"
|
||||
SELECT VALUE -- Constructing LogSupportList
|
||||
[EgtBEAMWALL.DataLayer.LogSupportModel](T1.LogSupportModel_LogDbId, T1.LogSupportModel_DtEvent, T1.LogSupportModel_Level, T1.LogSupportModel_Message, T1.LogSupportModel_Target)
|
||||
FROM (
|
||||
SELECT
|
||||
T.DbId AS LogSupportModel_LogDbId,
|
||||
T.DtEvent AS LogSupportModel_DtEvent,
|
||||
CAST(T.Level AS [EgtBEAMWALL.DataLayer.LogSupportLevel]) AS LogSupportModel_Level,
|
||||
T.Message AS LogSupportModel_Message,
|
||||
CAST(T.Target AS [EgtBEAMWALL.DataLayer.LogSupportTarget]) AS LogSupportModel_Target,
|
||||
True AS _from0
|
||||
FROM CodeFirstDatabase.LogSupportModel AS T
|
||||
) AS T1");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the view for CodeFirstDatabase.StatusMapModel.
|
||||
/// </summary>
|
||||
/// <returns>The mapping view.</returns>
|
||||
private static DbMappingView GetView14()
|
||||
{
|
||||
return new DbMappingView(@"
|
||||
SELECT VALUE -- Constructing StatusMapModel
|
||||
[CodeFirstDatabaseSchema.StatusMapModel](T1.StatusMapModel_DbId, T1.StatusMapModel_DtEvent, T1.StatusMapModel_Index, T1.StatusMapModel_Id, T1.StatusMapModel_ItemType, T1.StatusMapModel_Operation, T1.StatusMapModel_Session, T1.StatusMapModel_Val)
|
||||
FROM (
|
||||
SELECT
|
||||
T.StatusId AS StatusMapModel_DbId,
|
||||
T.DtEvent AS StatusMapModel_DtEvent,
|
||||
T.Index AS StatusMapModel_Index,
|
||||
T.ItemId AS StatusMapModel_Id,
|
||||
CAST(T.ItemType AS [Edm.Int32]) AS StatusMapModel_ItemType,
|
||||
CAST(T.Operation AS [Edm.Int32]) AS StatusMapModel_Operation,
|
||||
T.Session AS StatusMapModel_Session,
|
||||
T.Val AS StatusMapModel_Val,
|
||||
True AS _from0
|
||||
FROM DatabaseContext.StatusMapList AS T
|
||||
) AS T1");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the view for DatabaseContext.StatusMapList.
|
||||
/// </summary>
|
||||
/// <returns>The mapping view.</returns>
|
||||
private static DbMappingView GetView15()
|
||||
{
|
||||
return new DbMappingView(@"
|
||||
SELECT VALUE -- Constructing StatusMapList
|
||||
[EgtBEAMWALL.DataLayer.StatusMapModel](T1.StatusMapModel_StatusId, T1.StatusMapModel_DtEvent, T1.StatusMapModel_Index, T1.StatusMapModel_ItemId, T1.StatusMapModel_ItemType, T1.StatusMapModel_Operation, T1.StatusMapModel_Session, T1.StatusMapModel_Val)
|
||||
FROM (
|
||||
SELECT
|
||||
T.DbId AS StatusMapModel_StatusId,
|
||||
T.DtEvent AS StatusMapModel_DtEvent,
|
||||
T.Index AS StatusMapModel_Index,
|
||||
T.Id AS StatusMapModel_ItemId,
|
||||
CAST(T.ItemType AS [EgtBEAMWALL.DataLayer.StatusMapItemType]) AS StatusMapModel_ItemType,
|
||||
CAST(T.Operation AS [EgtBEAMWALL.DataLayer.StatusMapOpType]) AS StatusMapModel_Operation,
|
||||
T.Session AS StatusMapModel_Session,
|
||||
T.Val AS StatusMapModel_Val,
|
||||
True AS _from0
|
||||
FROM CodeFirstDatabase.StatusMapModel AS T
|
||||
) AS T1");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,23 +11,26 @@ using System.ServiceProcess;
|
||||
using System.IO;
|
||||
using System.Data.Entity.Infrastructure;
|
||||
|
||||
//using EgtBEAMWALL.DataLayer.Migrations;
|
||||
//using EgtBEAMWALL.DataLayer.Controllers;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer
|
||||
{
|
||||
//[DbConfigurationType(typeof(MyDbConfiguration))]
|
||||
[DbConfigurationType(typeof(MySqlEFConfiguration))]
|
||||
public class DatabaseContext : DbContext
|
||||
//[DbConfigurationType(typeof(MySqlEFConfiguration))]
|
||||
public class aMySqlConfiguration : MySqlEFConfiguration
|
||||
{
|
||||
#if false
|
||||
//providerName="System.Data.EntityClient"
|
||||
public DatabaseContext() : base("DefaultConnection")
|
||||
#region Public Constructors
|
||||
|
||||
public aMySqlConfiguration() : base()
|
||||
{
|
||||
var path = Path.GetDirectoryName(this.GetType().Assembly.Location);
|
||||
SetModelStore(new DefaultDbModelStore(path));
|
||||
}
|
||||
|
||||
#endif
|
||||
#endregion Public Constructors
|
||||
}
|
||||
|
||||
[DbConfigurationType(typeof(MySqlEFConfiguration))]
|
||||
//[DbConfigurationType(typeof(aMySqlConfiguration))]
|
||||
public class DatabaseContext : DbContext
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
[Obsolete("This constructor should never be used directly, and is only needed to generate entityframework stuff. Connection string can be adapted as pleased.")]
|
||||
@@ -51,6 +54,16 @@ namespace EgtBEAMWALL.DataLayer
|
||||
/// </summary>
|
||||
public DbSet<BTLPartModel> BTLPartList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Machine Log management
|
||||
/// </summary>
|
||||
public DbSet<LogMachineModel> LogMachineList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Support Log management
|
||||
/// </summary>
|
||||
public DbSet<LogSupportModel> LogSupportList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Parts management
|
||||
/// </summary>
|
||||
@@ -71,6 +84,11 @@ namespace EgtBEAMWALL.DataLayer
|
||||
/// </summary>
|
||||
public DbSet<ProjModel> ProjList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// StatusMap management
|
||||
/// </summary>
|
||||
public DbSet<StatusMapModel> StatusMapList { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#if false
|
||||
@@ -102,7 +120,7 @@ namespace EgtBEAMWALL.DataLayer
|
||||
|
||||
public static DatabaseContext Create()
|
||||
{
|
||||
return new DatabaseContext(Constants.CONNECTION_STRING);
|
||||
return new DatabaseContext(DbConfig.CONNECTION_STRING);
|
||||
}
|
||||
|
||||
public static bool SetUpDbConnectionAndDbConfig()
|
||||
@@ -118,7 +136,7 @@ namespace EgtBEAMWALL.DataLayer
|
||||
ServiceController service = new ServiceController(serviceName);
|
||||
try
|
||||
{
|
||||
TimeSpan timeout = TimeSpan.FromSeconds(Constants.DATABASE_PROCESS_TIMEOUT);
|
||||
TimeSpan timeout = TimeSpan.FromSeconds(DbConfig.DATABASE_PROCESS_TIMEOUT);
|
||||
service.WaitForStatus(ServiceControllerStatus.Running, timeout);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -145,18 +163,4 @@ namespace EgtBEAMWALL.DataLayer
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
|
||||
public class MyDbConfiguration : MySqlEFConfiguration
|
||||
//public class MyDbConfiguration : DbConfiguration
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public MyDbConfiguration() : base()
|
||||
{
|
||||
var path = Path.GetDirectoryName(this.GetType().Assembly.Location);
|
||||
SetModelStore(new DefaultDbModelStore(path));
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
}
|
||||
}
|
||||
@@ -33,11 +33,11 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
[Column("DO")]
|
||||
public bool DO { get; set; } = false;
|
||||
|
||||
[Column("DON")]
|
||||
public int DON { get; set; } = 0;
|
||||
//[Column("DON")]
|
||||
//public int DON { get; set; } = 0;
|
||||
|
||||
[Column("GRP")]
|
||||
public string GRP { get; set; } = "";
|
||||
//[Column("GRP")]
|
||||
//public string GRP { get; set; } = "";
|
||||
|
||||
[Column("H")]
|
||||
public double H { get; set; } = 0;
|
||||
@@ -66,14 +66,14 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
[ForeignKey("ProjDbId")]
|
||||
public ProjModel Project { get; set; }
|
||||
|
||||
[Column("ROT")]
|
||||
public int ROT { get; set; } = 0;
|
||||
//[Column("ROT")]
|
||||
//public int ROT { get; set; } = 0;
|
||||
|
||||
[Column("TBP")]
|
||||
public int TBP { get; set; } = 0;
|
||||
//[Column("TBP")]
|
||||
//public int TBP { get; set; } = 0;
|
||||
|
||||
[Column("UNT")]
|
||||
public int UNT { get; set; } = 0;
|
||||
//[Column("UNT")]
|
||||
//public int UNT { get; set; } = 0;
|
||||
|
||||
[Column("W")]
|
||||
public double W { get; set; } = 0;
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
{
|
||||
/// <summary>
|
||||
/// Tabella dei LOG Macchina
|
||||
/// </summary>
|
||||
[Table("LogMachine")]
|
||||
public class LogMachineModel
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Codice Allarme
|
||||
/// </summary>
|
||||
[Column("AlarmCode")]
|
||||
public string AlarmCode { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Data Evento
|
||||
/// </summary>
|
||||
[Column("AlarmDtEvent")]
|
||||
public DateTime AlarmDatetime { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Messaggio Allarme
|
||||
/// </summary>
|
||||
[Column("AlarmMessage")]
|
||||
public string AlarmMessage { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Alarm Operation
|
||||
/// </summary>
|
||||
[Column("AlarmOperation")]
|
||||
public int AlarmOperation { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Alarm Type
|
||||
/// </summary>
|
||||
[Column("AlarmType")]
|
||||
public int AlarmType { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Esaecuzione comando corretta
|
||||
/// </summary>
|
||||
[Column("CommExecuted")]
|
||||
public bool CommandExecutedCorrectly { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Stato da enum Core
|
||||
/// </summary>
|
||||
[Column("CommandState")]
|
||||
public Core.ConstMachComm.CommandStates CommandState { get; set; } = Core.ConstMachComm.CommandStates.NULL;
|
||||
|
||||
/// <summary>
|
||||
/// Tipo Comando da enum Core
|
||||
/// </summary>
|
||||
[Column("CommandType")]
|
||||
public Core.ConstMachComm.LogCommandTypes CommandType { get; set; } = Core.ConstMachComm.LogCommandTypes.NULL;
|
||||
|
||||
/// <summary>
|
||||
/// Descrizione
|
||||
/// </summary>
|
||||
[Column("Description")]
|
||||
public string Description { get; set; } = "";
|
||||
|
||||
[Key, Column("DbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int LogDbId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// New OP State
|
||||
/// </summary>
|
||||
[Column("NewOpState")]
|
||||
public int NewOpState { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Stato da enum Core
|
||||
/// </summary>
|
||||
[Column("ResultType")]
|
||||
public Core.ConstMachComm.ResultTypes ResultType { get; set; } = Core.ConstMachComm.ResultTypes.NULL;
|
||||
|
||||
/// <summary>
|
||||
/// Indirizzo VAR
|
||||
/// </summary>
|
||||
[Column("VarAddress")]
|
||||
public string VarAddress { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Valore VAR
|
||||
/// </summary>
|
||||
[Column("VarValue")]
|
||||
public string VarValue { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// MachineId del BTL
|
||||
/// </summary>
|
||||
[Column("MachineId")]
|
||||
public string MachineId { get; set; } = "";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
{
|
||||
/// <summary>
|
||||
/// Tabella dei LOG Applicativo
|
||||
/// </summary>
|
||||
[Table("LogSupport")]
|
||||
public class LogSupportModel
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Data Evento
|
||||
/// </summary>
|
||||
[Column("DtEvent")]
|
||||
public DateTime DtEvent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Livello da enum Core
|
||||
/// </summary>
|
||||
[Column("Level")]
|
||||
public Core.LogSupportLevel Level { get; set; } = Core.LogSupportLevel.ND;
|
||||
|
||||
[Key, Column("DbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int LogDbId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Messaggio
|
||||
/// </summary>
|
||||
[Column("Message")]
|
||||
public string Message { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Target da enum Core
|
||||
/// </summary>
|
||||
[Column("Target")]
|
||||
public Core.LogSupportTarget Target { get; set; } = Core.LogSupportTarget.ND;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -15,8 +15,17 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Column("Assign")]
|
||||
public string Assign { get; set; } = "";
|
||||
/// <summary>
|
||||
/// Data End
|
||||
/// </summary>
|
||||
[Column("DtEnd")]
|
||||
public DateTime DtEnd { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Data Start
|
||||
/// </summary>
|
||||
[Column("DtStart")]
|
||||
public DateTime DtStart { get; set; }
|
||||
|
||||
[Column("H")]
|
||||
public double H { get; set; } = 0;
|
||||
@@ -48,24 +57,63 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
[Column("Name")]
|
||||
public string Name { get; set; } = "";
|
||||
|
||||
[Column("Order")]
|
||||
public int Order { get; set; } = 1;
|
||||
|
||||
[ForeignKey("ProdDbId")]
|
||||
public ProdModel Prod { get; set; }
|
||||
|
||||
[Column("ProdDbId")]
|
||||
public int ProdDbId { get; set; }
|
||||
|
||||
[Column("ProdIndex")]
|
||||
public int ProdIndex { get; set; } = 10000;
|
||||
|
||||
/// <summary>
|
||||
/// MachGroup state
|
||||
/// </summary>
|
||||
[Column("State")]
|
||||
public Core.ItemState State { get; set; } = Core.ItemState.ND;
|
||||
|
||||
[Column("SupervisorId")]
|
||||
public string SupervisorId { get; set; } = "";
|
||||
|
||||
[Column("W")]
|
||||
public double W { get; set; } = 0;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Funzione di verifica equals limitata ai campi di pertinenza del ViewOptyimizer
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
/// <returns></returns>
|
||||
public bool ViewOptimEquals(object obj)
|
||||
{
|
||||
if (!(obj is MachGroupModel item))
|
||||
return false;
|
||||
|
||||
if (H != item.H)
|
||||
return false;
|
||||
if (L != item.L)
|
||||
return false;
|
||||
if (W != item.W)
|
||||
return false;
|
||||
if (MachGroupId != item.MachGroupId)
|
||||
return false;
|
||||
if (Material != item.Material)
|
||||
return false;
|
||||
if (Name != item.Name)
|
||||
return false;
|
||||
if (ProdDbId != item.ProdDbId)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -19,11 +19,23 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
public BTLPartModel BTLPart { get; set; }
|
||||
|
||||
[Column("BTLPartDbId")]
|
||||
public int BTLPartDbId { get; set; }
|
||||
public int? BTLPartDbId { get; set; }
|
||||
|
||||
[Column("CalcState")]
|
||||
public int CALC_State { get; set; } = -1;
|
||||
|
||||
/// <summary>
|
||||
/// Data End
|
||||
/// </summary>
|
||||
[Column("DtEnd")]
|
||||
public DateTime DtEnd { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Data Start
|
||||
/// </summary>
|
||||
[Column("DtStart")]
|
||||
public DateTime DtStart { get; set; }
|
||||
|
||||
[Column("GRP")]
|
||||
public string GRP { get; set; } = "";
|
||||
|
||||
@@ -67,5 +79,44 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
public double W { get; set; } = 0;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Funzione di verifica equals limitata ai campi di pertinenza del ViewOptyimizer
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
/// <returns></returns>
|
||||
public bool ViewOptimEquals(object obj)
|
||||
{
|
||||
if (!(obj is PartModel item))
|
||||
return false;
|
||||
|
||||
if (H != item.H)
|
||||
return false;
|
||||
if (L != item.L)
|
||||
return false;
|
||||
if (W != item.W)
|
||||
return false;
|
||||
if (CALC_State != item.CALC_State)
|
||||
return false;
|
||||
if (Material != item.Material)
|
||||
return false;
|
||||
if (ROT != item.ROT)
|
||||
return false;
|
||||
if (PDN != item.PDN)
|
||||
return false;
|
||||
if (NAM != item.NAM)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
{
|
||||
/// <summary>
|
||||
/// Tabella dello stato attività WORK (PROD/SUPERVISORE)
|
||||
/// </summary>
|
||||
[Table("StatusMap")]
|
||||
public class StatusMapModel
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Data evento
|
||||
/// </summary>
|
||||
[Column("DtEvent")]
|
||||
public DateTime DtEvent { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Indice di revisione informativa (per recupero rapido modifiche)
|
||||
/// </summary>
|
||||
[Column("Index")]
|
||||
public int Index { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Id dell'item (diventa chaive secondo il tipo)
|
||||
/// </summary>
|
||||
[Column("Id")]
|
||||
public int ItemId { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Tipo oggetto registrato
|
||||
/// </summary>
|
||||
[Column("ItemType")]
|
||||
public Core.StatusMapItemType ItemType { get; set; } = Core.StatusMapItemType.ND;
|
||||
|
||||
/// <summary>
|
||||
/// Operazione tracciata
|
||||
/// </summary>
|
||||
[Column("Operation")]
|
||||
public Core.StatusMapOpType Operation { get; set; } = Core.StatusMapOpType.ND;
|
||||
|
||||
/// <summary>
|
||||
/// Sessione (es supervisore)
|
||||
/// </summary>
|
||||
[Column("Session")]
|
||||
public string Session { get; set; } = "";
|
||||
|
||||
[Key, Column("DbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int StatusId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Valore (free) associato all'evento
|
||||
/// </summary>
|
||||
[Column("Val")]
|
||||
public string Val { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (!(obj is StatusMapModel item))
|
||||
return false;
|
||||
|
||||
if (Index != item.Index)
|
||||
return false;
|
||||
if (DtEvent != item.DtEvent)
|
||||
return false;
|
||||
if (Session != item.Session)
|
||||
return false;
|
||||
if (ItemType != item.ItemType)
|
||||
return false;
|
||||
if (ItemId != item.ItemId)
|
||||
return false;
|
||||
if (Operation != item.Operation)
|
||||
return false;
|
||||
if (Val != item.Val)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
{
|
||||
/// <summary>
|
||||
/// Tabella dei USER di MySql
|
||||
/// </summary>
|
||||
[Table("user")]
|
||||
public class UserPriv
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Column("Host", Order = 1), Key]
|
||||
public string Host { get; set; } = "";
|
||||
|
||||
[Column("User", Order = 2), Key]
|
||||
public string User { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer
|
||||
{
|
||||
public static class DbConfig
|
||||
{
|
||||
#region Public Fields
|
||||
|
||||
public static string DATABASE_NAME = "EgtBwDb";
|
||||
|
||||
public static int DATABASE_PROCESS_TIMEOUT = 5;
|
||||
public static string DATABASE_PWD = "viacremasca";
|
||||
|
||||
// Database config
|
||||
public static string DATABASE_SERV = "127.0.0.1";
|
||||
|
||||
public static string DATABASE_USER = "EgtUser";
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// DB Connection string per azioni amministrative
|
||||
/// </summary>
|
||||
public static string ADMIN_CONNECTION_STRING { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// DB Connection string
|
||||
/// </summary>
|
||||
public static string CONNECTION_STRING { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public static void InitDb(string server, string nKey, string sKey)
|
||||
{
|
||||
DATABASE_SERV = server;
|
||||
DATABASE_NAME = $"EgtBwDb_{nKey}";
|
||||
DATABASE_USER = $"user_{nKey}";
|
||||
DATABASE_PWD = $"pwd_{sKey}";
|
||||
CONNECTION_STRING = $"server={DATABASE_SERV};port=3306;database={DATABASE_NAME};uid={DATABASE_USER};pwd={DATABASE_PWD};sslmode=None";
|
||||
// stringa admin con utente root egalware...
|
||||
ADMIN_CONNECTION_STRING = $"server={DATABASE_SERV};port=3306;database=mysql;uid=root;pwd=Egalware_24068!;sslmode=None";
|
||||
}
|
||||
|
||||
public static bool CheckUser(string nKey, string sKey)
|
||||
{
|
||||
// esecuzione script di install locale
|
||||
return Controllers.DbController.man.checkCreateUser(DATABASE_USER, DATABASE_PWD);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,8 @@ namespace EgtBEAMWALL.DataLayer
|
||||
|
||||
public static DbManager obj = new DbManager();
|
||||
public Controllers.BTLPartController BtlPartCtr = new Controllers.BTLPartController();
|
||||
public Controllers.LogMachineController LogMacCtr = new Controllers.LogMachineController();
|
||||
public Controllers.LogSupportController LogSupCtr = new Controllers.LogSupportController();
|
||||
public Controllers.MachGroupController MachGroupCtr = new Controllers.MachGroupController();
|
||||
public Controllers.PartController PartCtr = new Controllers.PartController();
|
||||
public Controllers.ProdController ProdCtr = new Controllers.ProdController();
|
||||
|
||||
@@ -37,8 +37,8 @@
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="EgtWPFLib5, Version=2.3.1.1, Culture=neutral, PublicKeyToken=null">
|
||||
<HintPath>..\dll\EgtWPFLib5.dll</HintPath>
|
||||
<Reference Include="EgtWPFLib5">
|
||||
<HintPath>..\..\..\EgtProg\DllD32\EgtWPFLib5.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>
|
||||
@@ -52,6 +52,9 @@
|
||||
<Reference Include="MySql.Data.Entity.EF6, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MySql.Data.Entity.6.10.9\lib\net452\MySql.Data.Entity.EF6.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="System" />
|
||||
<Reference Include="System.ComponentModel" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
@@ -72,31 +75,48 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Constants.cs" />
|
||||
<Compile Include="AdminContext.cs" />
|
||||
<Compile Include="DatabaseModels\UserPrivModel.cs" />
|
||||
<Compile Include="DbConfig.cs" />
|
||||
<Compile Include="Controllers\LogMachineController.cs" />
|
||||
<Compile Include="Controllers\DbController.cs" />
|
||||
<Compile Include="Controllers\LogSupportController.cs" />
|
||||
<Compile Include="Controllers\PartController .cs" />
|
||||
<Compile Include="Controllers\StatusMapController.cs" />
|
||||
<Compile Include="Controllers\ProdController.cs" />
|
||||
<Compile Include="Controllers\MachGroupController.cs" />
|
||||
<Compile Include="Controllers\ProjController.cs" />
|
||||
<Compile Include="Controllers\BTLPartController.cs" />
|
||||
<Compile Include="DatabaseContext.cs" />
|
||||
<Compile Include="DatabaseContext.Views.cs" />
|
||||
<Compile Include="DatabaseModels\LogSupportModel.cs" />
|
||||
<Compile Include="DatabaseModels\PartModel.cs" />
|
||||
<Compile Include="DatabaseModels\BTLPartModel.cs" />
|
||||
<Compile Include="DatabaseModels\ProdModel.cs" />
|
||||
<Compile Include="DatabaseModels\LogMachineModel.cs" />
|
||||
<Compile Include="DatabaseModels\ProjModel.cs" />
|
||||
<Compile Include="DatabaseModels\MachGroupModel.cs" />
|
||||
<Compile Include="DatabaseModels\StatusMapModel.cs" />
|
||||
<Compile Include="DbManager.cs" />
|
||||
<Compile Include="Migrations\202103061456017_InitDb.cs" />
|
||||
<Compile Include="Migrations\202103061456017_InitDb.Designer.cs">
|
||||
<DependentUpon>202103061456017_InitDb.cs</DependentUpon>
|
||||
<Compile Include="Migrations\202104150749157_FullDbInit.cs" />
|
||||
<Compile Include="Migrations\202104150749157_FullDbInit.designer.cs">
|
||||
<DependentUpon>202104150749157_FullDbInit.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202104031327316_UpdateProjProd.cs" />
|
||||
<Compile Include="Migrations\202104031327316_UpdateProjProd.designer.cs">
|
||||
<DependentUpon>202104031327316_UpdateProjProd.cs</DependentUpon>
|
||||
<Compile Include="Migrations\202104231625149_LogMachineUpgrade.cs" />
|
||||
<Compile Include="Migrations\202104231625149_LogMachineUpgrade.designer.cs">
|
||||
<DependentUpon>202104231625149_LogMachineUpgrade.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202104301636100_StatusMap.cs" />
|
||||
<Compile Include="Migrations\202104301636100_StatusMap.designer.cs">
|
||||
<DependentUpon>202104301636100_StatusMap.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202105051121209_renameIndex.cs" />
|
||||
<Compile Include="Migrations\202105051121209_renameIndex.designer.cs">
|
||||
<DependentUpon>202105051121209_renameIndex.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\Configuration.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Utils.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
@@ -109,16 +129,22 @@
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Migrations\202103061456017_InitDb.resx">
|
||||
<DependentUpon>202103061456017_InitDb.cs</DependentUpon>
|
||||
<EmbeddedResource Include="Migrations\202104150749157_FullDbInit.resx">
|
||||
<DependentUpon>202104150749157_FullDbInit.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202104031327316_UpdateProjProd.resx">
|
||||
<DependentUpon>202104031327316_UpdateProjProd.cs</DependentUpon>
|
||||
<EmbeddedResource Include="Migrations\202104231625149_LogMachineUpgrade.resx">
|
||||
<DependentUpon>202104231625149_LogMachineUpgrade.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202104301636100_StatusMap.resx">
|
||||
<DependentUpon>202104301636100_StatusMap.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202105051121209_renameIndex.resx">
|
||||
<DependentUpon>202105051121209_renameIndex.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>copy $(TargetPath) c:\EgtProg\EgtBEAMWALL\ViewerOptimizer\EgtBEAMWALL.DataLayer.dll</PostBuildEvent>
|
||||
<PostBuildEvent>copy $(TargetPath) c:\EgtProg\EgtBEAMWALL\EgtBEAMWALL.DataLayer.dll</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class UpdateProjProd : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("dbo.ProjList", "DtCreated", c => c.DateTime(nullable: false, precision: 0));
|
||||
AddColumn("dbo.ProjList", "DtExported", c => c.DateTime(nullable: false, precision: 0));
|
||||
AddColumn("dbo.ProjList", "ListName", c => c.String(unicode: false));
|
||||
AddColumn("dbo.ProdList", "DtCreated", c => c.DateTime(nullable: false, precision: 0));
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropColumn("dbo.ProdList", "DtCreated");
|
||||
DropColumn("dbo.ProjList", "ListName");
|
||||
DropColumn("dbo.ProjList", "DtExported");
|
||||
DropColumn("dbo.ProjList", "DtCreated");
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -7,13 +7,13 @@ namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
using System.Resources;
|
||||
|
||||
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
|
||||
public sealed partial class UpdateProjProd : IMigrationMetadata
|
||||
public sealed partial class FullDbInit : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(UpdateProjProd));
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(FullDbInit));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "202104031327316_UpdateProjProd"; }
|
||||
get { return "202104150749157_FullDbInit"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
+45
-11
@@ -1,9 +1,9 @@
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class InitDb : DbMigration
|
||||
public partial class FullDbInit : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
@@ -15,8 +15,6 @@ namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
CalcState = c.Int(nullable: false),
|
||||
CNT = c.Int(nullable: false),
|
||||
DO = c.Boolean(nullable: false),
|
||||
DON = c.Int(nullable: false),
|
||||
GRP = c.String(unicode: false),
|
||||
H = c.Double(nullable: false),
|
||||
L = c.Double(nullable: false),
|
||||
Material = c.String(unicode: false),
|
||||
@@ -24,9 +22,6 @@ namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
Id = c.Int(nullable: false),
|
||||
PDN = c.Int(nullable: false),
|
||||
ProjDbId = c.Int(nullable: false),
|
||||
ROT = c.Int(nullable: false),
|
||||
TBP = c.Int(nullable: false),
|
||||
UNT = c.Int(nullable: false),
|
||||
W = c.Double(nullable: false),
|
||||
})
|
||||
.PrimaryKey(t => t.DbId)
|
||||
@@ -39,7 +34,10 @@ namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
ProjDbId = c.Int(nullable: false, identity: true),
|
||||
BTLFileName = c.String(unicode: false),
|
||||
DtCreated = c.DateTime(nullable: false, precision: 0),
|
||||
DtExported = c.DateTime(nullable: false, precision: 0),
|
||||
IsNew = c.Boolean(nullable: false),
|
||||
ListName = c.String(unicode: false),
|
||||
Lock = c.Boolean(nullable: false),
|
||||
ProdDbId = c.Int(),
|
||||
Id = c.Int(nullable: false),
|
||||
@@ -54,18 +52,49 @@ namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
ProdDbId = c.Int(nullable: false, identity: true),
|
||||
Description = c.String(unicode: false),
|
||||
DtCreated = c.DateTime(nullable: false, precision: 0),
|
||||
IsNew = c.Boolean(nullable: false),
|
||||
Lock = c.Boolean(nullable: false),
|
||||
Id = c.Int(nullable: false),
|
||||
})
|
||||
.PrimaryKey(t => t.ProdDbId);
|
||||
|
||||
CreateTable(
|
||||
"dbo.LogMachine",
|
||||
c => new
|
||||
{
|
||||
DbId = c.Int(nullable: false, identity: true),
|
||||
CncFileName = c.String(unicode: false),
|
||||
Description = c.String(unicode: false),
|
||||
DtEvent = c.DateTime(nullable: false, precision: 0),
|
||||
DtExported = c.DateTime(nullable: false, precision: 0),
|
||||
EventType = c.Int(nullable: false),
|
||||
MachineId = c.String(unicode: false),
|
||||
Message = c.String(unicode: false),
|
||||
SN = c.Int(nullable: false),
|
||||
Value = c.Double(nullable: false),
|
||||
})
|
||||
.PrimaryKey(t => t.DbId);
|
||||
|
||||
CreateTable(
|
||||
"dbo.LogSupport",
|
||||
c => new
|
||||
{
|
||||
DbId = c.Int(nullable: false, identity: true),
|
||||
DtEvent = c.DateTime(nullable: false, precision: 0),
|
||||
Level = c.Int(nullable: false),
|
||||
Message = c.String(unicode: false),
|
||||
Target = c.Int(nullable: false),
|
||||
})
|
||||
.PrimaryKey(t => t.DbId);
|
||||
|
||||
CreateTable(
|
||||
"dbo.MachGroupList",
|
||||
c => new
|
||||
{
|
||||
DbId = c.Int(nullable: false, identity: true),
|
||||
Assign = c.String(unicode: false),
|
||||
DtEnd = c.DateTime(nullable: false, precision: 0),
|
||||
DtStart = c.DateTime(nullable: false, precision: 0),
|
||||
H = c.Double(nullable: false),
|
||||
L = c.Double(nullable: false),
|
||||
Lock = c.Boolean(nullable: false),
|
||||
@@ -76,6 +105,7 @@ namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
Order = c.Int(nullable: false),
|
||||
ProdDbId = c.Int(nullable: false),
|
||||
State = c.Int(nullable: false),
|
||||
SupervisorId = c.String(unicode: false),
|
||||
W = c.Double(nullable: false),
|
||||
})
|
||||
.PrimaryKey(t => t.DbId)
|
||||
@@ -87,8 +117,10 @@ namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
c => new
|
||||
{
|
||||
DbId = c.Int(nullable: false, identity: true),
|
||||
BTLPartDbId = c.Int(nullable: false),
|
||||
BTLPartDbId = c.Int(),
|
||||
CalcState = c.Int(nullable: false),
|
||||
DtEnd = c.DateTime(nullable: false, precision: 0),
|
||||
DtStart = c.DateTime(nullable: false, precision: 0),
|
||||
GRP = c.String(unicode: false),
|
||||
H = c.Double(nullable: false),
|
||||
L = c.Double(nullable: false),
|
||||
@@ -102,7 +134,7 @@ namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
W = c.Double(nullable: false),
|
||||
})
|
||||
.PrimaryKey(t => t.DbId)
|
||||
.ForeignKey("dbo.BTLPartList", t => t.BTLPartDbId, cascadeDelete: true)
|
||||
.ForeignKey("dbo.BTLPartList", t => t.BTLPartDbId)
|
||||
.ForeignKey("dbo.MachGroupList", t => t.MachGroupDbId)
|
||||
.Index(t => t.BTLPartDbId)
|
||||
.Index(t => t.MachGroupDbId);
|
||||
@@ -119,10 +151,12 @@ namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
DropIndex("dbo.PartList", new[] { "MachGroupDbId" });
|
||||
DropIndex("dbo.PartList", new[] { "BTLPartDbId" });
|
||||
DropIndex("dbo.MachGroupList", new[] { "ProdDbId" });
|
||||
DropIndex("dbo.BTLPartList", new[] { "ProjDbId" });
|
||||
DropIndex("dbo.ProjList", new[] { "ProdDbId" });
|
||||
DropIndex("dbo.BTLPartList", new[] { "ProjDbId" });
|
||||
DropTable("dbo.PartList");
|
||||
DropTable("dbo.MachGroupList");
|
||||
DropTable("dbo.LogSupport");
|
||||
DropTable("dbo.LogMachine");
|
||||
DropTable("dbo.ProdList");
|
||||
DropTable("dbo.ProjList");
|
||||
DropTable("dbo.BTLPartList");
|
||||
+1
-1
@@ -118,7 +118,7 @@
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Target" xml:space="preserve">
|
||||
<value>H4sIAAAAAAAEAO0d227juPW9QP9B0GMxYyeZLtAGzi4SO5kx1naMONn0LWAkxqOuLq5EpwmKflkf+kn9hVJ3UiIpkqIdJ7vYfYgpnkPy3HnIw/nff/47+ukl8K1nGCdeFJ7Zx4Mj24KhE7leuD6zt+jp81/sn3784x9Gl27wYv1S9vuS9sOQYXJmf0doczocJs53GIBkEHhOHCXRExo4UTAEbjQ8OTr66/D4eAgxChvjsqzRzTZEXgCzH/jnOAoduEFb4M8jF/pJ0Y6/rDKs1gIEMNkAB57Zl2t0cXk+vz+fzQYTgMAMvMLYts59D+DJrKD/ZFsgDCMEEJ7q6V0CVyiOwvVqgxuAf/u6gbjfE/ATWCzhtO4uu5qjk3Q1wxqwROVsExQFigiPvxTkGTbBtYhsV+TDBLzEhEav6aozIp7ZF7ezJYhRRmjbag54OvbjtDOHztlfjyCBOZ8GJLJPFhPkUyU1J4OTwTH+/5M13vpoG8OzEG5RDDDkcvvoe87P8PU2+hWGZ+HW98lV4HXgb1QDblrG0QbG6PUGPtFrmzxOXdsa0giGTQwVPAs4p8E0RF9ObGuBpwMefViJDUGvFYpi+BWGMAYIukuAEIwx16cuzAjfmkZj0PH5bPywwrhg15gdeBa3/RBMrkv4iyjyIQg1MCz6TeHrzbJEgFUWGyDbmoOXGQzX6PuZjf+0rSvvBbplS4H0LvSwvcJAKN52jvGtHGESYZGDynOc9YSfY07H2AztfKGL8/nOx0jVpVtZOnBMekoN/vl3GZ0VY7m57qk/txfLfgju+mrwvapoLsCzt86sGIOk0EG2dQP97Hvy3dvkvpWy+A9Vx6s4Cm4iv+Feyu8Pq2gbO6mFiwSdbkG8hoie5WhY+y+hV0uRmHFpFaYD8Ge1bKs6M1mtMOfJME+vPB+mP3ZueCZoHMN0lpXI4x+3XqBujyfo8mUTxSZQTZMF/GdfJzrzErQXEs4i59d60brTxT9dhph1W2xley0yVi7TUlWK/JB3qW0U/aVlnRqf+9ol15hdcg/ILrnadoklMDu0SxOYOLG3yXdT78YumTEmxnRcTV2ltWMOnO9f42i7MaMiNLoD0JNqQnrK0gDfl8acJ4m33r2yvPVWzIx2zKL1DXzuF7lXfO67i9nf7nIfIcp17KaZvZ6bQyl3I8ZC5Wey2GKKYFC0vuUujR340GawFf0wPrdCIFaffnGQsZTjIeUb9ZON+880KqQ395Oy/G2k+/ge/FBM+W8lUdg7xXeYbqDQa/YWuEqyVb2IXXDzY3sj3OrB8gGiyVXy3zE9oh9rgtVnwRTrPmqOahsQbopg6DS58sG6PiqUc1tjbKNrsaBdVPqt9k7Hg6P0P0nnhPUNB0P+K9ZPUoRpNsxh8AhjKopPA9xfgL/FDUcttlH9x1H45MUBAXAsBrifLquubXNGdU3jh61DoP4i7r9yYrDZEP3/LO6/mFQ9Px+3GZ+zmGzExIkcL+NjM4Gcx0v0YJeha4lTR7VNIDLRc8xZb4N5iQXvzP5Taw1ctKUE02hdJtqjwaDNKByiwDiNC4CP+ZpgufJC1I5nvNDxNsAXTqIBpZQPSslfjdL8MoEbGKbBi5C0fYevRmkEaF0UGg0JGRGLDvNIhMdp8flIzW/6mF5ekoRHKzJietwk+eg6nEAfImidO/mVhjFIHOC2fRRWNdeAHIqWICkOzFMTJWkU8anvJPYgk6w9IE9khBvCWmKayTp5mRTtJmVM3NuLpGAFe7OPAja9AyPZDkW5vpAflxKyomMb+fGspOF9e0HkLkFGBATXo9Q8NY9DBiaxV1Gstx3dIsPYgxgTx/beRdruGgz/+NOR4avwrENTvFo0NzIR4yKWby0xDMIQ1aakzFum7fAFMXaQd/hjvolMijxKU1RSvCuIaNVJ7wjYVr2fZRqultTRqNLwhIOHiAy7kbh8JK4ckopdHExN8e+aE59AfOoQfKVJRGbQiU7sGwZNQevcNVZzJ/nRktfOXSKNxmWhoUQX95RYPvuiV5sI3bsf+f0PsRJK1gU0Ee53JAisQRnm+UqbMJ0huHQQTiyjoS0CwoiC7t1IDCPbyNAZcRwoGQmSC5CREn7kJydyvahBJDdF9OAEI9LhiD5N2uGHrMQJ6FJmXCu3WH0bDfOqjqJhNOSUf4zmYLPxwjVRDlK0WKu8FmT8eaVeIRHkOIZOwiiUqGZbjYSiGKxh42uaLnXhlRcnqHTztjV2g1a3ZhDAcV7laG0/3+Zf6dVKmPTvHI59fkrFBe0AqkBzhVcZpDFYdszY1goOuJWW6AAfxKLTxnHkb4OwiIqYQRkfEXnaSOIZA98pmhWQpXesKSxpgzx8WiRBLeZaDXrRBF+owGcHpiR81iAP/42G/qYCO6NhZyqw9VEmiaJulceUnVWSSLIGefjyHJJEoSaO2SkkCZ41KMBXaUEKCTdZyMeUHWeSSLIGefisYIGEzxrk4e+aunSnpkv3NPQ9C3Y0bFin1l6uZQ5bWRfawkrZ3ypW7G98682UuuUVwO5evKjr/CQy6oOC8auvxlImsG5WwVVf2qeR1e3y2IqrtpRNyJsUzGN1bZ+yklWrAqbiViKFB7cpGhmXKQWcBLBYnuQM5tupqmtOVd0eqsqD3T2TqBvulD6QH95GVY0olyGVOGhBprdZ/aW5kTZTF+kuBPxoj0q/9on9y4voJI6y7fDDXhNiW94up3HkbSoBOHG/XD/2NRjHt1ylqpss7oaTKIqmt3CTjP2p8t70kONhc8mIPpkIjTSEmRwEN5khPMvk4zOa03i/WQGun+g4wRPh/D3TYCo/8CFsWisJ3exSjV4loxtJ51GRAO5+mKiVEc672BYmyrPnptng+evqH35mDQfZn2Pfwwuue8xB6D3BBOUXf+0fBj80HjY6nEeGhkni+owEOu+lIZpnUtU1epU1ZKWFlxK3s25Gtf6lttLEKPrv9eiA16/1PEaR3+epHp3RicodPwrX+e2GGodSYY7bszBHE75ZXqO7DqJ6RhdFQ1z1y2K0wBvvhGQ4WhdVpqELX87sf2VAp9b0bw8l3CcrC7tPrSPr330qcnTmTjy5owN+108F75UkUOMhGw2LyUv0qr8XsxPLyXgiRldpWi8tuPgHyl5aWMbQ8fJnCo8MvAdjCDH1oIOW0W4+DaNLujwH0WMi9Q5Z2Wa4Ipth2lhqPNKip3OG3kLZic4xnj85NJ0zoBp9RXonYiXKoL7rCJh+IOS9hoC9hYZ++kMnhugX+hmLYQ04FeqtDs1AdCdORb2y+5CCwQ+4fWa8QyHLawK0F7uN7OA/xCaY8TqFLDMo4D4h3e9bcSO74QOxYX0q68uKEe2yd0aphG5tvm4FPfcKifzOwdKqmn8PRaBKlfKKLDRam8muL+lRoN/vQYa3KXv/aHXuihZmRwLVrGfrUWH/XmxU512kgzNU8tXqWvZhR6LFnsiurZSyyTBXIPwBC861zUNXQPQmsqGh+XuWjkOpFm/XkzU5yawFL5jXUQye30TAkf1jhNmfx/SiakdWtThvJOIba5glr+6WVUwuGMMVj8GuYeXWmvMGanZgjSYuiGTVo3OXJeYQlz17KFenWdG4497WEmbUzixlafmzQylMV5y4IAjgFU/2X/pOKs/7cJutUKz74/0Xb7y8XItrPKfKvKdqctEGq8i1ubajxSuUirdv42FPTPxjgjgayJ69LFGk/7RgCB3KB1d9puFTVEYEjRmVXZq5SoiAix30eYy8J+Ag/NmBSZK9mls8QHkZPEJ3Gl5v0WaL8JJh8OhTjzOnIYVo/Kwenp7z6Do7wE1MLAFP00sPbq/Di63n109sXjFyfBwUaaxSnAikvETpycD6tcK0iEJJRAX5qhDrFgYbHyNLrsMVeIY6c7tL4AyugfO6LO5U8pF0M4Im+2jigXUMgqTAUcPjn1iG3eDlx/8Dq4P311NzAAA=</value>
|
||||
<value>H4sIAAAAAAAEAO1dX2/juBF/L9DvIOix2LOT3R7QBs4dsnaya5ydBHH2tm8LRmK8utMfV6LSBEU/WR/6kfoVSv0nRYoiKcp2tou7hzVF/kgOZ4bDIWfy33//Z/bzc+BbTzBOvCg8t08nJ7YFQydyvXB7bqfo8Ye/2D//9Mc/zC7d4Nn6tar3LquHW4bJuf0Vod3ZdJo4X2EAkkngOXGURI9o4kTBFLjR9O3JyV+np6dTiCFsjGVZs7s0RF4A8x/45zwKHbhDKfDXkQv9pCzHXzY5qnUNApjsgAPP7csten95sf58sVpNFgCBFXiBsW1d+B7Ag9lA/9G2QBhGCCA81LNPCdygOAq3mx0uAP79yw7ieo/AT2A5hbOmuuxsTt5ms5k2DSsoJ01QFCgCnr4ryTNtN9cisl2TDxPwEhMavWSzzol4br+/X92CGOWEtq12h2dzP84qd9A5/9cDSGCxThMS7I3FbfKm5pq3k7eTU/z/G2ue+iiN4XkIUxQD3PI2ffA95xf4ch/9DsPzMPV9chZ4HvgbVYCLbuNoB2P0cgcf6bktHpaubU1pgGkboW7Pa1zQYBmid29t6xoPBzz4sGYbgl4bFMXwAwxhDBB0bwFCMMarvnRhTnhmGK1O5xer+ZcNxoJ9ffbgXN8PA1jcVO3fR5EPQaiM8LECWER4NaFy+9XA9mtMxBhLeAWDxR4rMdtag+cVDLfoa1bl2bauvGfoViUl8qfQwzoPN0Jx2tvR9cV69D4yTuznwx6MxfVAgDj6TUYcxCifVdf1Gjx521y6OOOBDrKtO+jn35Ov3q7Q+ZQm+lJXvIqj4C7yW2qv+v5lE6Wxk0leJKh0D+ItRPQoZ9NGrwq1bQZiRtXWSEegZxvGUFWysixlTsPiNb3yfJj9GF1qF2gew2yUNcvjH/deoK7MFujyeRfFJqCWyTX8x1DlvvIStBcSriLn92bSusPFP10Om/WrO2VlJ1JWLldT1YL8pajS6Cj6C6OdWp+H6iXXmF5yj0gvudp6iccwI+qlBUyc2NsVVv6r0UtmlIkxGVcTV2npWEXbNXC+eiE0IyMtvCOQFDwiPUGpG+7thBQ6+9u/9yqTl0+YAsdkKeQDyjDqyWf7FVGqfCLLeb7hltGIuYZJArbjM8hm4InqV+CnUOk8pKKzNuku4wRjOovE+66zVPZ2Q7K9gk/Qp4SxWZXym6pI7klQKuOUO/TqoxnGz7TMhzhKd2b4noY7AravB6TH/K3mexSB0MQxeINAPFyQDu2bNGPxYgm6g0/DdqCaHYa69fbnbt2H5XcTu9kt0kBvqdQRssfCIO8Ccr25RDAoS1WxUvzryUuieA8mmFE3L99zQqtmxn3C+cz4UHh1hjlSjN2lHdNFmv4t2v6v0Lrv7fZz9XZcO92Hu9vRRf3Qu6nIpDmWTev/5Y7w7mbgxbPJDc/cHlQqFb4Dv74irGsRPvz2R9aNz9TgbUCiwdX83zM8oh5vgPVnwRCbOmq7ZBoQeyThQVomVz7YNg9w5PbMOd4gGj8UvT9m35qt8XRykv0nuTNiecNmn/+C5ZNkYXoZ1jB4gHHDrYWrLffknNsnzKpR1fHOQFQ+FVe+XtQ1fzhlCV2QVEBmxjcwgNgtrEOSfClN7P0TuhIKI5QuwA7K3fWBQZbmqwi49WuL/VCf2B4GkL1GOSS9L5LE24by6mQehY9eHMirlM/L27oqaxxRVbOjUOoQ0O/E9TdODHY7ov6fDS87Jk7kePk6th/TFEc/ujOsai3xNXpjYRCvctZ4Zb0dXku8jZ3bf2Lm0AnL8XASl+o07Mlkwi4UPm3BODviAB+va4L5ygsRezTzQsfbAV84iFYrpbvxjPx1L+0vC7iDYXYOE5J2aPd1L62zZh+FZlOCR8Ssw30e1rXS4rdizXrTT2nlOUn4zEyGTU/bJJ/dhAvoQwStC6d4djwHiQNc1uLFouYa4EPRFCTZgfuCTIkbRes0dBB74EmeO6uLZYS+rYZj2nch8jwpcozJqLjDs6RgBnvTj4JlegVKkj3Ydu6F3adcgld0dGP36VhS8Rrca7uGIrOUglAEtR23i9IGBrFXlmqcEf1Lz/FMGGMr1qMhrT/HYC1mODLrKrwS1mQvhuZGBmKcxQqHE26DcIv6cFFdpWTl8BlxToKf8MfiMJiU3tU2q2S4G4ho0cnePdtW4+XiKiCG62iozMzowCEsvH4QtxvElQNp3iF2QDEPH/sBKzdRJyD9KqkHsGaoDry2gPZRrXsJu9eP4Dx6EclrR6IS/113WxR6z6f12EmOYSSq9zxKw7g8GEq4cE2J6fPDa1gi9J+z5E9axEwoaRTQRHiykiCwBmW4l9IsYXqNfWlzn5hGS1oEhBGZ9+NwDOeWhCMzYotT0uYkJyDDJd02phzLDaIGcSkjokeHuSRtMOnThDWQZDlOQJfqpqjeuOtvs2kR410WzKYdweCzNdjtvHBLBIeXJdamiAyf/7BRj5cOCoypk3DCpuvR1j2hKAZb2PqaOWZdeOXFCaoMEduauwFTrW2mdGxeVW+sJcKuX7WrVW2yf5fXIdxHJ5Tlwpp4JcwVnmWQWYn52wxWKjqaW1nAPvBBLHqiMY/8NAhLu41rNnYDkW82SJw58J2yWAEsi5mmULIC+fZZyDQ1mRuV1h/pxh9V2q7otiuVts0TCBKiKZVHyt84kCB5gXz76v0CCaHGDvnrBbJ5XqDQvnYAUiCdbsFupM80xGde29m0JV3MaYkRZ8ZRRmsIKf1R2zrDlUdzXFHXHIK24y8PFQRMglEfFES/CaijNEBTrILVBPDQYE25PFoZoEfJVFGkoF7qYF9Ky9SlCkjlu2cKB5cpCqnL5YIOV6mYn+QUzuFE1TUnqu4AUe1qO/4iUTF4lDyQHw4jqkaEy5BIHDUjtxxNw9m57ZhSZ+pehO4F2xowXMkoVsrmJD8cUkrKiLXWDlQUHmozIx4OkmBEsYrdWwej0oZvXayAVUXRUUhVoTzOpmW+bpSs1zKYlAQoi45JD5D+YSN6gPIna+kBMcKoesCUnJUvPKlNpCjaPxdXbiIShv+kueCkg3Ai7bgazoitiwh1PuwDEOkx4sptIDOGrJ4OFTHKuBUapSw8fneICXOsisukMYoytQ2qjszU94kY9O8wxoqqlVJGVZIQZdEhjn8cv6Gyz5AOqaSgqC/fhufInNt5iM9Zw+Fsxtvc6bYWvqvpxjPqvT4m5Z0HHZIYecHxK3/BXtrzskWE+d2/TgUHku3zgv1q7IPrV+bqs12l7r2+Am1ddc7Ka8f+5NjMPWRRxbYwUZ48N7uDXL9s/u7nmnmS/3Pue/nZo6qxBqH3CBNUBLbYP05+bCXXPp5E19MkcX3OtS0RLNR9XykXCK8XBE/GJXsZcXtD3FXTPTc7BtGLfs5oneZNxuiHKFLPRFQHkbsDg8g127dDwf0o3BZvBxsgxUhvXYgWs+iHcGs1b2XkzTGY55PL0IXP5/Y/80Zn1vJvX6p2b6zcpD+zTqx/6QdsSy2iRtZlDZHvul9UT248iuhz8hnr8h2TFtTFP1CedeI2ho5X/K2HEwMpCQ0BU9lHtbROO4+xLukKF8GAgTQHWGWxc0ViZ1rfaGQU1pM5Q4l7R5E5Tl7QY5M5A6IxlKVHYSvhtd3rtuHYxLbaTGWSP6nUlce+IzApa3VMICZPrS7xWtk1dWE2gww6KsesWbtKeHf2qoVxHLan8rdqcaYZhqIj3QxqZ9El1mvnh9C8WUyleDOEeuhz9GCzgc5qqiMlw87PxhwBBjZyKg2p5ml+lGOFeio3ndHzEpbqknIs18I36E3kZNCU5Rui6ZATqRF/5uvR2USSTl32PrTa5+bglOUaqvEQvvnuxCXu1Qbo3aGiZ0bZDsn4VUXAa6fj4gRW6+YM083s1flgX95hZmll83oNyWmUMngpLqHR5EX8aPQBicOGJYo7TDquby3/lqKGGYmh2tkvpDPXvF4d1fvO9ugUlXwWLS390Ld5cQHH1jbKom8ucdE3mAhLW8yPkjc0JHjP3HEsWazYLBLtleTmqCoXj8lwRH8uXoJhC/0hwstf2OaiHCecBFS/dfVEfON1c9uVbYfThyvowxX3wc9cw0lZRae44uWsomvw+msqyfRI58Di9UjX6OixrNTbY1tLMB22K/D6E6d6YZZOwIg9XNjJgntIxEWzWyv6mdUE3BMGN8kBY9YdS8otxYELDJautDDDpz5KTq0hq80XKF4c1/DJG0+cpbVqXYYDNy7D5KQN5sfSXrWRJq+QBIt98Y2tjTTMfM/FrwXM/3RABTHDmCF0KDujrrMMH6PK6mmNqKrC3Dsj4GIj5CJG3iNwEP7swCTJ/45RmcT/MniA7jK8SdEuRXjKMHjwqb/VlZlNov7zTF/0mGc3+RuWxMQU8DC9zF1/E75PPb/5MwVXHH9kB0Rmj5XXLNlaouy6ZftSI11H7c2/C6gkX21G3sNg52Ow5CbcgCeoM7ZPCVzBLXBebst3+90g/QtBk3228MA2BkFSYjTt8U/Mw27w/NP/ANNWx+47jAAA</value>
|
||||
</data>
|
||||
<data name="DefaultSchema" xml:space="preserve">
|
||||
<value>dbo</value>
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// <auto-generated />
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
|
||||
public sealed partial class LogMachineUpgrade : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(LogMachineUpgrade));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "202104231625149_LogMachineUpgrade"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class LogMachineUpgrade : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("dbo.LogMachine", "AlarmCode", c => c.String(unicode: false));
|
||||
AddColumn("dbo.LogMachine", "AlarmDtEvent", c => c.DateTime(nullable: false, precision: 0));
|
||||
AddColumn("dbo.LogMachine", "AlarmMessage", c => c.String(unicode: false));
|
||||
AddColumn("dbo.LogMachine", "AlarmOperation", c => c.Int(nullable: false));
|
||||
AddColumn("dbo.LogMachine", "AlarmType", c => c.Int(nullable: false));
|
||||
AddColumn("dbo.LogMachine", "CommExecuted", c => c.Boolean(nullable: false));
|
||||
AddColumn("dbo.LogMachine", "CommandState", c => c.Int(nullable: false));
|
||||
AddColumn("dbo.LogMachine", "CommandType", c => c.Int(nullable: false));
|
||||
AddColumn("dbo.LogMachine", "NewOpState", c => c.Int(nullable: false));
|
||||
AddColumn("dbo.LogMachine", "ResultType", c => c.Int(nullable: false));
|
||||
AddColumn("dbo.LogMachine", "VarAddress", c => c.String(unicode: false));
|
||||
AddColumn("dbo.LogMachine", "VarValue", c => c.String(unicode: false));
|
||||
DropColumn("dbo.LogMachine", "CncFileName");
|
||||
DropColumn("dbo.LogMachine", "DtEvent");
|
||||
DropColumn("dbo.LogMachine", "DtExported");
|
||||
DropColumn("dbo.LogMachine", "EventType");
|
||||
DropColumn("dbo.LogMachine", "MachineId");
|
||||
DropColumn("dbo.LogMachine", "Message");
|
||||
DropColumn("dbo.LogMachine", "SN");
|
||||
DropColumn("dbo.LogMachine", "Value");
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
AddColumn("dbo.LogMachine", "Value", c => c.Double(nullable: false));
|
||||
AddColumn("dbo.LogMachine", "SN", c => c.Int(nullable: false));
|
||||
AddColumn("dbo.LogMachine", "Message", c => c.String(unicode: false));
|
||||
AddColumn("dbo.LogMachine", "MachineId", c => c.String(unicode: false));
|
||||
AddColumn("dbo.LogMachine", "EventType", c => c.Int(nullable: false));
|
||||
AddColumn("dbo.LogMachine", "DtExported", c => c.DateTime(nullable: false, precision: 0));
|
||||
AddColumn("dbo.LogMachine", "DtEvent", c => c.DateTime(nullable: false, precision: 0));
|
||||
AddColumn("dbo.LogMachine", "CncFileName", c => c.String(unicode: false));
|
||||
DropColumn("dbo.LogMachine", "VarValue");
|
||||
DropColumn("dbo.LogMachine", "VarAddress");
|
||||
DropColumn("dbo.LogMachine", "ResultType");
|
||||
DropColumn("dbo.LogMachine", "NewOpState");
|
||||
DropColumn("dbo.LogMachine", "CommandType");
|
||||
DropColumn("dbo.LogMachine", "CommandState");
|
||||
DropColumn("dbo.LogMachine", "CommExecuted");
|
||||
DropColumn("dbo.LogMachine", "AlarmType");
|
||||
DropColumn("dbo.LogMachine", "AlarmOperation");
|
||||
DropColumn("dbo.LogMachine", "AlarmMessage");
|
||||
DropColumn("dbo.LogMachine", "AlarmDtEvent");
|
||||
DropColumn("dbo.LogMachine", "AlarmCode");
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+4
-4
@@ -1,5 +1,5 @@
|
||||
// <auto-generated />
|
||||
namespace EgtBEAMWALL.DbDataLayer.Migrations
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Data.Entity.Migrations;
|
||||
@@ -7,13 +7,13 @@ namespace EgtBEAMWALL.DbDataLayer.Migrations
|
||||
using System.Resources;
|
||||
|
||||
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
|
||||
public sealed partial class InitDb : IMigrationMetadata
|
||||
public sealed partial class StatusMap : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(InitDb));
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(StatusMap));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "202103031756343_InitDb"; }
|
||||
get { return "202104301636100_StatusMap"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
@@ -0,0 +1,32 @@
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class StatusMap : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
CreateTable(
|
||||
"dbo.StatusMap",
|
||||
c => new
|
||||
{
|
||||
DbId = c.Int(nullable: false, identity: true),
|
||||
DtEvent = c.DateTime(nullable: false, precision: 0),
|
||||
Index = c.Int(nullable: false),
|
||||
Id = c.Int(nullable: false),
|
||||
ItemType = c.Int(nullable: false),
|
||||
Operation = c.Int(nullable: false),
|
||||
Session = c.String(unicode: false),
|
||||
Val = c.String(unicode: false),
|
||||
})
|
||||
.PrimaryKey(t => t.DbId);
|
||||
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropTable("dbo.StatusMap");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
+5
-5
@@ -1,4 +1,4 @@
|
||||
// <auto-generated />
|
||||
// <auto-generated />
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System.CodeDom.Compiler;
|
||||
@@ -6,14 +6,14 @@ namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
[GeneratedCode("EntityFramework.Migrations", "6.0.0-20911")]
|
||||
public sealed partial class InitDb : IMigrationMetadata
|
||||
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
|
||||
public sealed partial class renameIndex : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(InitDb));
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(renameIndex));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "202103061456017_InitDb"; }
|
||||
get { return "202105051121209_renameIndex"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
@@ -0,0 +1,20 @@
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class renameIndex : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("dbo.MachGroupList", "ProdIndex", c => c.Int(nullable: false));
|
||||
DropColumn("dbo.MachGroupList", "Order");
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
AddColumn("dbo.MachGroupList", "Order", c => c.Int(nullable: false));
|
||||
DropColumn("dbo.MachGroupList", "ProdIndex");
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("2.2.12.1")]
|
||||
[assembly: AssemblyFileVersion("2.2.12.1")]
|
||||
[assembly: AssemblyVersion("2.3.6.2")]
|
||||
[assembly: AssemblyFileVersion("2.3.6.2")]
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer
|
||||
{
|
||||
public static partial class LinqExtensions
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
public static IEnumerable<T> ExceptUsingJSonCompare<T>
|
||||
(this IEnumerable<T> first, IEnumerable<T> second)
|
||||
{
|
||||
return first.Except(second, new JSonEqualityComparer<T>());
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Comparer generico basato su Json
|
||||
/// https://stackoverflow.com/questions/7042090/linq-except-with-custom-iequalitycomparer/7098076#7098076
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public class JSonEqualityComparer<T> : IEqualityComparer<T>
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
public bool Equals(T x, T y)
|
||||
{
|
||||
return String.Equals
|
||||
(
|
||||
Newtonsoft.Json.JsonConvert.SerializeObject(x),
|
||||
Newtonsoft.Json.JsonConvert.SerializeObject(y)
|
||||
);
|
||||
}
|
||||
|
||||
public int GetHashCode(T obj)
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(obj).GetHashCode();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -3,4 +3,5 @@
|
||||
<package id="EntityFramework" version="6.4.4" targetFramework="net452" />
|
||||
<package id="MySql.Data" version="6.10.9" targetFramework="net452" />
|
||||
<package id="MySql.Data.Entity" version="6.10.9" targetFramework="net452" />
|
||||
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net452" />
|
||||
</packages>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user