Compare commits
349 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 88eda5ecf7 | |||
| 807fcd8b07 | |||
| 512c999be0 | |||
| e826a0ed1d | |||
| d79f3aa848 | |||
| 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 | |||
| 70f3010529 | |||
| f3ed0cf817 | |||
| b836fbf5df | |||
| 26f96d42c6 | |||
| 8624dd6fc6 | |||
| 90dc9ddd4e | |||
| d8c2a94c75 | |||
| f24dcd0bc5 | |||
| 3b368ac504 | |||
| f5ac9ddac2 | |||
| 3f4547179c | |||
| 3e4ac3bbd6 | |||
| a5866a8eb6 | |||
| ae736a9fff | |||
| 05da1f2d9e | |||
| a8c2154444 | |||
| bac7b490be | |||
| 907e8c355c | |||
| ab2925ba74 | |||
| 747e25315d | |||
| 922b1a4787 | |||
| 1a926d8f49 | |||
| b4140ce9ab | |||
| b6f255695c | |||
| 29250f344c | |||
| b3b7ea865a | |||
| 9903c41009 | |||
| d4fc382a51 | |||
| 846597b01f | |||
| 83e9f051a5 | |||
| 3e06412d7d | |||
| 685d899df0 | |||
| 8fcdbca3cf | |||
| 8618fd332e | |||
| 941d896ffa | |||
| ae90109936 | |||
| 88dd388fe3 | |||
| 7aef151a44 | |||
| d7edf38d57 | |||
| 85f9703353 | |||
| 9aa27dd21d | |||
| a48cb4482c | |||
| 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 | |||
| 8b41603061 | |||
| 2f8ef75ce7 | |||
| fc1a9828dc | |||
| f7c7e3a7f5 | |||
| 3eb25c3533 | |||
| 208ee3a883 | |||
| 4c1289ed2d | |||
| 91798cdd00 | |||
| dceabbfa37 | |||
| a477a93186 | |||
| dd536c8cbb | |||
| b1ce12e110 | |||
| c28555080a | |||
| 95f867dfe3 | |||
| e5c8544c59 | |||
| 70082e03a5 | |||
| 3f7f352919 | |||
| 60260ea451 | |||
| 2fc81d3258 | |||
| 9d2b78fd4d | |||
| 5486af7b63 | |||
| 376f54ab37 | |||
| 07a26632dd | |||
| 58c80321c4 | |||
| 23ac186eb1 | |||
| ceb9bf2d18 | |||
| bb772e4a1f | |||
| bab90cf7dc | |||
| 7664d46554 | |||
| 4471fd4564 | |||
| 4d9211ae20 | |||
| e14101134c | |||
| e660032b42 | |||
| f73e59a434 | |||
| 4ed15194b4 | |||
| c652d5930f | |||
| 5935f621cf | |||
| 23cbb48527 | |||
| dd17b66484 | |||
| da52cd0884 | |||
| ddc36ba729 | |||
| 443bd8e9d8 | |||
| 9450f686a0 | |||
| cbcbc3e854 | |||
| 1368f15957 | |||
| c26a186dcb | |||
| a341659996 | |||
| 0857ec3c1b | |||
| 37d6941eeb | |||
| bbdbaf823c | |||
| 2d34c70a1b | |||
| 18745e3158 | |||
| 184fc1ad77 | |||
| 011ae90053 | |||
| 9caf440696 | |||
| b167342437 | |||
| 376cdfaff9 | |||
| ff839b5d8a | |||
| 9b86c92639 | |||
| 8cb610cdf9 | |||
| 24594a4d24 | |||
| ebcba6dec3 | |||
| d99d34af7f | |||
| 084220230c | |||
| 4177c1a0ae | |||
| dbf0d6211b | |||
| c77e8bd6a5 | |||
| 5a39cd80d3 | |||
| 2295305bf1 | |||
| fcff7cfbb7 | |||
| 025c57d78f | |||
| 49d75d575a | |||
| 4e9e17d937 | |||
| bc47a8d419 | |||
| 41f0224d6c | |||
| a2ba210f74 | |||
| e5695049fe | |||
| 6b340a6ec8 | |||
| 57e7d8e099 | |||
| ee422c8e17 | |||
| 0457bed4ba | |||
| 49c30cbb5b | |||
| bbf97f7066 | |||
| 814b94bf97 | |||
| 86bd547f8d | |||
| 7dca4d63b4 | |||
| 528bbf6fb6 | |||
| 5b29302b93 | |||
| 2f325ff7fd | |||
| 5ec47d3a9c | |||
| d89fd7e42a | |||
| eb52018b83 | |||
| 807759a331 | |||
| 9dccb99d38 | |||
| 9de97768b3 | |||
| daf8045b10 | |||
| f8c2c28ada | |||
| 83eeb2504f | |||
| 985c28332f | |||
| 5494838ed4 | |||
| c5308cb6f5 | |||
| 92f7d9b773 | |||
| 19c42bfa8e | |||
| 32f6f72a1a | |||
| 3a113c97bb | |||
| 515ce5ef33 | |||
| f7730c57ce | |||
| 7fc702df50 | |||
| 272c6f46db | |||
| fb4be7bfcd | |||
| 1786e5d4d8 | |||
| e64a89f3f1 | |||
| 1ebffd8e93 | |||
| 8d8ae29cc8 | |||
| 828da5502f | |||
| 6b7d3ce6b5 | |||
| 53ed0b4775 | |||
| 5e69f0dd5c | |||
| 86feb7e9a3 | |||
| 74dfb67dae | |||
| bd9e3def79 | |||
| faf746bfc0 | |||
| 2f03f59eea | |||
| 421e2e2214 | |||
| 00d43473f5 | |||
| afe64db075 | |||
| d039e39205 | |||
| 96538f600f | |||
| f39d8904c3 | |||
| ca37a2f3c2 | |||
| 415ae0a39c | |||
| 8c6be948d0 | |||
| ddf0629eb8 | |||
| e7489dc6b7 | |||
| 14f1e18a00 | |||
| b1188bdc4c | |||
| 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
|
||||
@@ -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
|
||||
@@ -1,257 +1,400 @@
|
||||
Public Module ConstBeam
|
||||
|
||||
Public Enum BTLParamType As Integer
|
||||
DOUBLE_ = 1
|
||||
STRING_ = 2
|
||||
COMBO = 3
|
||||
LENGTH = 4
|
||||
CHECKBOX = 5
|
||||
End Enum
|
||||
Friend Const BTL_FTR_DES As String = "DES"
|
||||
|
||||
Public Enum BTLPartParam As Integer
|
||||
NULL = 0
|
||||
PDN = 1
|
||||
NAM = 2
|
||||
GRP = 3
|
||||
End Enum
|
||||
Friend Const BTL_FTR_DO As String = "DO"
|
||||
|
||||
Public Enum GRPType As Integer
|
||||
L = 0
|
||||
T = 1
|
||||
End Enum
|
||||
Friend Const BTL_FTR_FRAME As String = "FRAME"
|
||||
|
||||
Enum MachineType As Integer
|
||||
NULL = 0
|
||||
BEAM = 1
|
||||
WALL = 2
|
||||
End Enum
|
||||
Friend Const BTL_FTR_GRP As String = "GRP"
|
||||
|
||||
Enum CalcStates As Integer
|
||||
NOTCALCULATED = -1
|
||||
OK = 0
|
||||
WARNING = 1
|
||||
ERROR_ = 2
|
||||
End Enum
|
||||
Friend Const BTL_FTR_MAINID As String = "MAINID"
|
||||
|
||||
Public Enum Range As Integer
|
||||
STANDARD = 1
|
||||
EXTENDED = 2
|
||||
End Enum
|
||||
Friend Const BTL_FTR_NAME As String = "NAME"
|
||||
|
||||
Public Enum PartOffset_RefSideFixClamp As Integer
|
||||
INACTIVE = 0
|
||||
REFSIDE1 = 1
|
||||
REFSIDE2 = 2
|
||||
REFSIDE3 = 3
|
||||
REFSIDE4 = 4
|
||||
End Enum
|
||||
Friend Const BTL_FTR_PRC As String = "PRC"
|
||||
|
||||
Public Enum ProcessingQuality As Integer
|
||||
AUTOMATIC = 1
|
||||
VISIBLE = 2
|
||||
FAST = 3
|
||||
End Enum
|
||||
Friend Const BTL_FTR_PRID As String = "PRID"
|
||||
|
||||
Public Enum Recess As Integer
|
||||
AUTOMATIC = 1
|
||||
MANUAL = 2
|
||||
End Enum
|
||||
Friend Const BTL_FTR_SIDE As String = "SIDE"
|
||||
|
||||
Public Enum StoreyType As Integer
|
||||
CEILING = 1
|
||||
ROOF = 2
|
||||
WALL = 3
|
||||
End Enum
|
||||
Friend Const BTL_GEN_ARCHITECT = "ARCHITECT"
|
||||
|
||||
Public Enum AlignmentLocation As Integer
|
||||
INACTIV = 0
|
||||
BR = 1
|
||||
TR = 2
|
||||
BA = 3
|
||||
TA = 4
|
||||
HC = 5
|
||||
VC = 6
|
||||
AC = 7
|
||||
End Enum
|
||||
Friend Const BTL_GEN_COMPUTERNAME = "COMPUTERNAME"
|
||||
|
||||
Public Enum AlignmentEndtype As Integer
|
||||
R = 1
|
||||
A = 2
|
||||
D = 3
|
||||
End Enum
|
||||
Friend Const BTL_GEN_CUSTOMER = "CUSTOMER"
|
||||
|
||||
Public Enum MaterialType As Integer
|
||||
INACTIV = 0
|
||||
BA = 1
|
||||
CL = 2
|
||||
MT = 3
|
||||
ME_ = 4
|
||||
GB = 5
|
||||
GF = 6
|
||||
IN_ = 7
|
||||
SH = 8
|
||||
FB = 9
|
||||
PB = 10
|
||||
PL = 11
|
||||
End Enum
|
||||
Friend Const BTL_GEN_DELIVDATE = "DELIVERYDATE"
|
||||
|
||||
Public Enum MoveDirections As Integer
|
||||
UP = -1
|
||||
DOWN = 1
|
||||
End Enum
|
||||
Friend Const BTL_GEN_EDITOR = "EDITOR"
|
||||
|
||||
Public Const BTLFEATURES_FILE_NAME As String = "BTLFeatures.ini"
|
||||
Friend Const BTL_GEN_EXPDATE = "EXPORTDATE"
|
||||
|
||||
'Public Const S_GENERAL As String = "General"
|
||||
'Public Const K_DEBUG As String = "Debug"
|
||||
Friend Const BTL_GEN_EXPFILE = "EXPORTFILE"
|
||||
|
||||
' Tipo di progetto
|
||||
Public Enum ProjectType As Integer
|
||||
PROJ = 1
|
||||
PROD = 2
|
||||
End Enum
|
||||
Friend Const BTL_GEN_EXPRELEASE = "EXPORTRELEASE"
|
||||
|
||||
Friend Const PROJ As String = "PROJ"
|
||||
Friend Const FILENAMESEPARATOR As Char = "^"c
|
||||
Friend Const BTLINFO As String = "BtlInfo"
|
||||
Friend Const BTL_GEN_EXPTIME = "EXPORTTIME"
|
||||
|
||||
' info parametri BTL
|
||||
Friend Const BTL_PRT_PDN As String = "PDN"
|
||||
Friend Const BTL_PRT_DO As String = "DO"
|
||||
Friend Const BTL_PRT_NAM As String = "NAM"
|
||||
Friend Const BTL_PRT_L As String = "L"
|
||||
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_ROTATED As String = "ROTATED"
|
||||
Friend Const BTL_PRT_INVERTED As String = "INVERTED"
|
||||
Friend Const BTL_PRT_MATERIAL As String = "MATERIAL"
|
||||
' parametri pezzo
|
||||
Friend Const BTL_PRT_SINGLEMEMBERNUM = "SINGLEMEMBERNUMBER"
|
||||
Friend Const BTL_PRT_ASSEMBLYNUM = "ASSEMBLYNUMBER"
|
||||
Friend Const BTL_PRT_ORDERNUM = "ORDERNUMBER"
|
||||
Friend Const BTL_PRT_DESIGNATION = "DESIGNATION"
|
||||
Friend Const BTL_PRT_ANNOTATION = "ANNOTATION"
|
||||
Friend Const BTL_PRT_STOREY = "STOREY"
|
||||
Friend Const BTL_PRT_GROUP = "GROUP"
|
||||
Friend Const BTL_PRT_PACKAGE = "PACKAGE"
|
||||
Friend Const BTL_PRT_TIMBERGRADE = "TIMBERGRADE"
|
||||
Friend Const BTL_PRT_QUALITYGRADE = "QUALITYGRADE"
|
||||
Friend Const BTL_PRT_COLOUR = "COLOUR"
|
||||
Friend Const BTL_PRT_PLANINGLENGTH = "PLANINGLENGTH"
|
||||
Friend Const BTL_PRT_STARTOFFSET = "STARTOFFSET"
|
||||
Friend Const BTL_PRT_ENDOFFSET = "ENDOFFSET"
|
||||
Friend Const BTL_PRT_UID = "UID"
|
||||
Friend Const BTL_PRT_TRANSFORMATION = "TRANSFORMATION"
|
||||
Friend Const BTL_PRT_CAMBER = "CAMBER"
|
||||
Friend Const BTL_PRT_PARTOFFSET = "PARTOFFSET"
|
||||
Friend Const BTL_PRT_PROCESSINGQUALITY = "PROCESSINGQUALITY"
|
||||
Friend Const BTL_PRT_RECESS = "RECESS"
|
||||
Friend Const BTL_PRT_STOREYTYPE = "STOREYTYPE"
|
||||
Friend Const BTL_PRT_ELEMENTNUM = "ELEMENTNUMBER"
|
||||
Friend Const BTL_PRT_LAYER = "LAYER"
|
||||
Friend Const BTL_PRT_MODULENUM = "MODULENUMBER"
|
||||
'Friend Const BTL_PRT_USERATTRIBUTE = "USERATTRIBUTE"
|
||||
Friend Const BTL_PRT_COMMENT = "COMMENT"
|
||||
Friend Const BTL_PRT_GRAINDIR = "GRAINDIRECTION"
|
||||
Friend Const BTL_PRT_REFSIDE = "REFERENCESIDE"
|
||||
Friend Const BTL_PRT_ALIGNMENT = "ALIGNMENT"
|
||||
Friend Const BTL_PRT_MATERIALTYPE = "MATERIALTYPE"
|
||||
Friend Const BTL_GEN_LANGUAGE = "LANGUAGE"
|
||||
|
||||
' parametri generici
|
||||
Friend Const BTL_GEN_PROJNUM = "PROJECTNUMBER"
|
||||
Friend Const BTL_GEN_PROJNAME = "PROJECTNAME"
|
||||
Friend Const BTL_GEN_PROJPART = "PROJECTPART"
|
||||
Friend Const BTL_GEN_PROJGUID = "PROJECTGUID"
|
||||
Friend Const BTL_GEN_LISTNAME = "LISTNAME"
|
||||
Friend Const BTL_GEN_CUSTOMER = "CUSTOMER"
|
||||
Friend Const BTL_GEN_ARCHITECT = "ARCHITECT"
|
||||
Friend Const BTL_GEN_EDITOR = "EDITOR"
|
||||
Friend Const BTL_GEN_DELIVDATE = "DELIVERYDATE"
|
||||
Friend Const BTL_GEN_EXPDATE = "EXPORTDATE"
|
||||
Friend Const BTL_GEN_EXPTIME = "EXPORTTIME"
|
||||
Friend Const BTL_GEN_EXPRELEASE = "EXPORTRELEASE"
|
||||
Friend Const BTL_GEN_LANGUAGE = "LANGUAGE"
|
||||
Friend Const BTL_GEN_RANGE = "RANGE"
|
||||
Friend Const BTL_GEN_COMPUTERNAME = "COMPUTERNAME"
|
||||
Friend Const BTL_GEN_USER = "USER"
|
||||
Friend Const BTL_GEN_SRCFILE = "SOURCEFILE"
|
||||
Friend Const BTL_GEN_EXPFILE = "EXPORTFILE"
|
||||
Friend Const BTL_GEN_USERATTRIBUTE = "USERATTRIBUTE"
|
||||
Friend Const BTL_GEN_LISTNAME = "LISTNAME"
|
||||
|
||||
Friend Const PROCESSINGS As String = "Processings"
|
||||
Friend Const OUTLINE As String = "Outline"
|
||||
Friend Const BTL_FTR_GRP As String = "GRP"
|
||||
Friend Const BTL_FTR_PRC As String = "PRC"
|
||||
Friend Const BTL_FTR_DO As String = "DO"
|
||||
Friend Const BTL_FTR_SIDE As String = "SIDE"
|
||||
Friend Const BTL_FTR_NAME As String = "NAME"
|
||||
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_GEN_PROJGUID = "PROJECTGUID"
|
||||
|
||||
' parametri machgroup grezzi
|
||||
Friend Const MGR_RPT_ID As String = "ID"
|
||||
Friend Const MGR_RPT_L As String = "L"
|
||||
Friend Const MGR_RPT_W As String = "W"
|
||||
Friend Const MGR_RPT_H As String = "H"
|
||||
Friend Const MGR_RPT_WASTE As String = "WASTE"
|
||||
Friend Const MGR_RPT_USAGE As String = "USAGE"
|
||||
Friend Const MGR_RPT_STARTCUT As String = "STARTCUT"
|
||||
Friend Const MGR_RPT_MATERIAL As String = "MATERIAL"
|
||||
Friend Const BTL_GEN_PROJNAME = "PROJECTNAME"
|
||||
|
||||
Friend Const MGR_PRT_PDN As String = "PDN"
|
||||
Friend Const MGR_PRT_L As String = "L"
|
||||
Friend Const MGR_PRT_W As String = "W"
|
||||
Friend Const MGR_PRT_H As String = "H"
|
||||
Friend Const MGR_PRT_DES As String = "DES"
|
||||
Friend Const MGR_PRT_STARTCUT As String = "STARTCUT"
|
||||
Friend Const MGR_PRT_MATERIAL As String = "MATERIAL"
|
||||
' parametri generici
|
||||
Friend Const BTL_GEN_PROJNUM = "PROJECTNUMBER"
|
||||
|
||||
Friend Const MGR_FTR_GRP As String = "GRP"
|
||||
Friend Const MGR_FTR_PRC As String = "PRC"
|
||||
Friend Const MGR_FTR_DO As String = "DO"
|
||||
Friend Const MGR_FTR_SIDE As String = "SIDE"
|
||||
Friend Const MGR_FTR_NAME As String = "NAME"
|
||||
Friend Const MGR_FTR_DES As String = "DES"
|
||||
Friend Const MGR_FTR_PRID As String = "PRID"
|
||||
Friend Const MGR_FTR_FRAME As String = "FRAME"
|
||||
Friend Const BTL_GEN_PROJPART = "PROJECTPART"
|
||||
|
||||
' parametri creazione barre
|
||||
Friend Const MGR_RPT_BARLEN As String = "BARLEN"
|
||||
Friend Const MGR_RPT_BARHEIGHT As String = "BARHEIGHT"
|
||||
Friend Const MGR_RPT_BARWIDTH As String = "BARWIDTH"
|
||||
Friend Const MGR_RPT_PANELLEN As String = "PANELLEN"
|
||||
Friend Const MGR_RPT_PANELWIDTH As String = "PANELWIDTH"
|
||||
Friend Const MGR_RPT_PANELHEIGHT As String = "PANELHEIGHT"
|
||||
Friend Const MGR_RPT_PART As String = "PART"
|
||||
Friend Const BTL_GEN_PROJTYPE = "PROJECTTYPE"
|
||||
|
||||
' parametri errori integration
|
||||
Friend Const ITG_CUTID As String = "CUTID"
|
||||
Friend Const ITG_TASKID As String = "TASKID"
|
||||
Friend Const ITG_PROJ_ERR As String = "PROJ_ERR"
|
||||
Friend Const ITG_PROJ_MSG As String = "PROJ_MSG"
|
||||
Friend Const ITG_PROJ_ROT As String = "PROJ_ROT"
|
||||
Friend Const ITG_PROJ_FALL As String = "PROJ_FALL"
|
||||
Friend Const ITG_PROJ_TIME As String = "PROJ_TIME"
|
||||
Friend Const BTL_GEN_RANGE = "RANGE"
|
||||
|
||||
' parametri errori integration
|
||||
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_TIME As String = "PROD_TIME"
|
||||
Friend Const BTL_GEN_SRCFILE = "SOURCEFILE"
|
||||
|
||||
' parametri errori integration
|
||||
Friend Const DUPLO_TODELETE As String = "DUPLO_TODELETE"
|
||||
Friend Const BTL_GEN_USER = "USER"
|
||||
|
||||
' parametri warehouse
|
||||
Friend Const WRH_BEAM As String = "BEAM"
|
||||
Friend Const WRH_WALL As String = "WALL"
|
||||
Friend Const WRH_CURRENT As String = "Current"
|
||||
Friend Const WRH_STARTOFFSET As String = "StartOffset"
|
||||
Friend Const WRH_OFFSET As String = "Offset"
|
||||
Friend Const WRH_L As String = "L"
|
||||
Friend Const WRH_KERF As String = "Kerf"
|
||||
Friend Const WRH_S As String = "S"
|
||||
Friend Const BTL_GEN_USERATTRIBUTE = "USERATTRIBUTE"
|
||||
|
||||
End Module
|
||||
Friend Const BTL_PRT_ADDED As String = "ADDED"
|
||||
|
||||
Friend Const BTL_PRT_ALIGNMENT = "ALIGNMENT"
|
||||
|
||||
Friend Const BTL_PRT_ANNOTATION = "ANNOTATION"
|
||||
|
||||
Friend Const BTL_PRT_ASSEMBLYNUM = "ASSEMBLYNUMBER"
|
||||
|
||||
Friend Const BTL_PRT_CAMBER = "CAMBER"
|
||||
|
||||
Friend Const BTL_PRT_CNT As String = "CNT"
|
||||
|
||||
Friend Const BTL_PRT_COLOUR = "COLOUR"
|
||||
|
||||
'Friend Const BTL_PRT_USERATTRIBUTE = "USERATTRIBUTE"
|
||||
Friend Const BTL_PRT_COMMENT = "COMMENT"
|
||||
|
||||
Friend Const BTL_PRT_DESIGNATION = "DESIGNATION"
|
||||
|
||||
Friend Const BTL_PRT_DO As String = "DO"
|
||||
|
||||
Friend Const BTL_PRT_DONE As String = "DONE"
|
||||
|
||||
Friend Const BTL_PRT_ELEMENTNUM = "ELEMENTNUMBER"
|
||||
|
||||
Friend Const BTL_PRT_ENDOFFSET = "ENDOFFSET"
|
||||
|
||||
Friend Const BTL_PRT_GRAINDIR = "GRAINDIRECTION"
|
||||
|
||||
Friend Const BTL_PRT_GROUP = "GROUP"
|
||||
|
||||
Friend Const BTL_PRT_H As String = "H"
|
||||
|
||||
Friend Const BTL_PRT_INVERTED As String = "INVERTED"
|
||||
|
||||
Friend Const BTL_PRT_L As String = "L"
|
||||
|
||||
Friend Const BTL_PRT_LAYER = "LAYER"
|
||||
|
||||
Friend Const BTL_PRT_MATERIAL As String = "MATERIAL"
|
||||
|
||||
Friend Const BTL_PRT_MATERIALTYPE = "MATERIALTYPE"
|
||||
|
||||
Friend Const BTL_PRT_MODULENUM = "MODULENUMBER"
|
||||
|
||||
Friend Const BTL_PRT_NAM As String = "NAM"
|
||||
|
||||
Friend Const BTL_PRT_ORDERNUM = "ORDERNUMBER"
|
||||
|
||||
Friend Const BTL_PRT_PACKAGE = "PACKAGE"
|
||||
|
||||
Friend Const BTL_PRT_PARTOFFSET = "PARTOFFSET"
|
||||
|
||||
Friend Const BTL_PRT_PDN As String = "PDN"
|
||||
|
||||
Friend Const BTL_PRT_PLANINGLENGTH = "PLANINGLENGTH"
|
||||
|
||||
Friend Const BTL_PRT_PROCESSINGQUALITY = "PROCESSINGQUALITY"
|
||||
|
||||
' info parametri BTL
|
||||
Friend Const BTL_PRT_PROJ As String = "PROJ"
|
||||
|
||||
Friend Const BTL_PRT_QUALITYGRADE = "QUALITYGRADE"
|
||||
|
||||
Friend Const BTL_PRT_RECESS = "RECESS"
|
||||
|
||||
Friend Const BTL_PRT_REFSIDE = "REFERENCESIDE"
|
||||
|
||||
Friend Const BTL_PRT_ROTATED As String = "ROTATED"
|
||||
|
||||
' parametri pezzo
|
||||
Friend Const BTL_PRT_SINGLEMEMBERNUM = "SINGLEMEMBERNUMBER"
|
||||
|
||||
Friend Const BTL_PRT_STARTOFFSET = "STARTOFFSET"
|
||||
|
||||
Friend Const BTL_PRT_STOREY = "STOREY"
|
||||
|
||||
Friend Const BTL_PRT_STOREYTYPE = "STOREYTYPE"
|
||||
|
||||
Friend Const BTL_PRT_TIMBERGRADE = "TIMBERGRADE"
|
||||
|
||||
Friend Const BTL_PRT_TRANSFORMATION = "TRANSFORMATION"
|
||||
|
||||
Friend Const BTL_PRT_UID = "UID"
|
||||
|
||||
Friend Const BTL_PRT_W As String = "W"
|
||||
|
||||
Friend Const BTLINFO As String = "BtlInfo"
|
||||
|
||||
' parametri errori integration
|
||||
Friend Const DUPLO_TODELETE As String = "DUPLO_TODELETE"
|
||||
|
||||
Friend Const FILENAMESEPARATOR As Char = "^"c
|
||||
|
||||
' parametri errori integration
|
||||
Friend Const ITG_CUTID As String = "CUTID"
|
||||
|
||||
' parametri errori integration
|
||||
Friend Const ITG_PROD_ERR As String = "PROD_ERR"
|
||||
|
||||
Friend Const ITG_PROD_FALL As String = "PROD_FALL"
|
||||
|
||||
Friend Const ITG_PROD_MSG As String = "PROD_MSG"
|
||||
|
||||
Friend Const ITG_PROD_ROT As String = "PROD_ROT"
|
||||
|
||||
Friend Const ITG_PROD_TIME As String = "PROD_TIME"
|
||||
|
||||
Friend Const ITG_PROJ_ERR As String = "PROJ_ERR"
|
||||
|
||||
Friend Const ITG_PROJ_FALL As String = "PROJ_FALL"
|
||||
|
||||
Friend Const ITG_PROJ_MSG As String = "PROJ_MSG"
|
||||
|
||||
Friend Const ITG_PROJ_ROT As String = "PROJ_ROT"
|
||||
|
||||
Friend Const ITG_PROJ_TIME As String = "PROJ_TIME"
|
||||
|
||||
Friend Const ITG_TASKID As String = "TASKID"
|
||||
|
||||
Friend Const MGR_FTR_DES As String = "DES"
|
||||
|
||||
Friend Const MGR_FTR_DO As String = "DO"
|
||||
|
||||
Friend Const MGR_FTR_FRAME As String = "FRAME"
|
||||
|
||||
Friend Const MGR_FTR_GRP As String = "GRP"
|
||||
|
||||
Friend Const MGR_FTR_NAME As String = "NAME"
|
||||
|
||||
Friend Const MGR_FTR_PRC As String = "PRC"
|
||||
|
||||
Friend Const MGR_FTR_PRID As String = "PRID"
|
||||
|
||||
Friend Const MGR_FTR_SIDE As String = "SIDE"
|
||||
|
||||
Friend Const MGR_PRT_DES As String = "DES"
|
||||
|
||||
Friend Const MGR_PRT_FLIP As String = "FLIP"
|
||||
|
||||
Friend Const MGR_PRT_H As String = "H"
|
||||
|
||||
Friend Const MGR_PRT_L As String = "L"
|
||||
|
||||
Friend Const MGR_PRT_MATERIAL As String = "MATERIAL"
|
||||
|
||||
Friend Const MGR_PRT_PDN As String = "PDN"
|
||||
|
||||
Friend Const MGR_PRT_POSX As String = "POSX"
|
||||
|
||||
Friend Const MGR_PRT_POSY As String = "POSY"
|
||||
|
||||
Friend Const MGR_PRT_ROT As String = "ROT"
|
||||
|
||||
Friend Const MGR_PRT_STARTCUT As String = "STARTCUT"
|
||||
|
||||
Friend Const MGR_PRT_W As String = "W"
|
||||
|
||||
Friend Const MGR_RPT_BARHEIGHT As String = "BARHEIGHT"
|
||||
|
||||
' parametri creazione barre
|
||||
Friend Const MGR_RPT_BARLEN As String = "BARLEN"
|
||||
|
||||
Friend Const MGR_RPT_BARWIDTH As String = "BARWIDTH"
|
||||
|
||||
Friend Const MGR_RPT_H As String = "H"
|
||||
|
||||
' parametri machgroup grezzi
|
||||
Friend Const MGR_RPT_ID As String = "ID"
|
||||
|
||||
Friend Const MGR_RPT_L As String = "L"
|
||||
|
||||
Friend Const MGR_RPT_MATERIAL As String = "MATERIAL"
|
||||
|
||||
Friend Const MGR_RPT_PANELHEIGHT As String = "PANELHEIGHT"
|
||||
|
||||
Friend Const MGR_RPT_PANELLEN As String = "PANELLEN"
|
||||
|
||||
Friend Const MGR_RPT_PANELWIDTH As String = "PANELWIDTH"
|
||||
|
||||
Friend Const MGR_RPT_PART As String = "PART"
|
||||
|
||||
Friend Const MGR_RPT_STARTCUT As String = "STARTCUT"
|
||||
|
||||
Friend Const MGR_RPT_USAGE As String = "USAGE"
|
||||
|
||||
Friend Const MGR_RPT_W As String = "W"
|
||||
|
||||
Friend Const MGR_RPT_WASTE As String = "WASTE"
|
||||
|
||||
Friend Const OUTLINE As String = "Outline"
|
||||
|
||||
Friend Const PROCESSINGS As String = "Processings"
|
||||
|
||||
Friend Const PROJ As String = "PROJ"
|
||||
|
||||
' parametri warehouse
|
||||
Friend Const WRH_BEAM As String = "BEAM"
|
||||
|
||||
Friend Const WRH_CURRENT As String = "Current"
|
||||
|
||||
Friend Const WRH_KERF As String = "Kerf"
|
||||
|
||||
Friend Const WRH_L As String = "L"
|
||||
|
||||
Friend Const WRH_OFFSET As String = "Offset"
|
||||
|
||||
Friend Const WRH_S As String = "S"
|
||||
|
||||
Friend Const WRH_STARTOFFSET As String = "StartOffset"
|
||||
|
||||
Friend Const WRH_WALL As String = "WALL"
|
||||
|
||||
Public Const BTLFEATURES_FILE_NAME As String = "BTLFeatures.ini"
|
||||
|
||||
Public Const BTLFILENAME As String = "BTLFILENAME"
|
||||
|
||||
Public Const EXP_PROD As String = "EXPORTPROD"
|
||||
|
||||
' parametri import/export
|
||||
Public Const EXP_PROJ As String = "EXPORTPROJ"
|
||||
|
||||
Public Enum AlignmentEndtype As Integer
|
||||
R = 1
|
||||
A = 2
|
||||
D = 3
|
||||
End Enum
|
||||
|
||||
Public Enum AlignmentLocation As Integer
|
||||
INACTIV = 0
|
||||
BR = 1
|
||||
TR = 2
|
||||
BA = 3
|
||||
TA = 4
|
||||
HC = 5
|
||||
VC = 6
|
||||
AC = 7
|
||||
End Enum
|
||||
|
||||
Public Enum BTLParamType As Integer
|
||||
DOUBLE_ = 1
|
||||
STRING_ = 2
|
||||
COMBO = 3
|
||||
LENGTH = 4
|
||||
CHECKBOX = 5
|
||||
End Enum
|
||||
|
||||
Public Enum BTLPartParam As Integer
|
||||
NULL = 0
|
||||
PDN = 1
|
||||
NAM = 2
|
||||
GRP = 3
|
||||
End Enum
|
||||
|
||||
' Tipo di progetto (Beam o Wall)
|
||||
Public Enum BWType As Integer
|
||||
NULL = 0
|
||||
BEAM = 1
|
||||
WALL = 2
|
||||
End Enum
|
||||
|
||||
Enum CalcStates As Integer
|
||||
NOTCALCULATED = -1
|
||||
OK = 0
|
||||
WARNING = 1
|
||||
ERROR_ = 2
|
||||
End Enum
|
||||
|
||||
Public Enum GRPType As Integer
|
||||
L = 0
|
||||
T = 1
|
||||
End Enum
|
||||
|
||||
Enum MachineType As Integer
|
||||
NULL = 0
|
||||
BEAM = 1
|
||||
WALL = 2
|
||||
BOTH = 3
|
||||
End Enum
|
||||
|
||||
Public Enum MaterialType As Integer
|
||||
INACTIV = 0
|
||||
BA = 1
|
||||
CL = 2
|
||||
MT = 3
|
||||
ME_ = 4
|
||||
GB = 5
|
||||
GF = 6
|
||||
IN_ = 7
|
||||
SH = 8
|
||||
FB = 9
|
||||
PB = 10
|
||||
PL = 11
|
||||
End Enum
|
||||
|
||||
Public Enum MoveDirections As Integer
|
||||
UP = -1
|
||||
DOWN = 1
|
||||
End Enum
|
||||
|
||||
Public Enum PartOffset_RefSideFixClamp As Integer
|
||||
INACTIVE = 0
|
||||
REFSIDE1 = 1
|
||||
REFSIDE2 = 2
|
||||
REFSIDE3 = 3
|
||||
REFSIDE4 = 4
|
||||
End Enum
|
||||
|
||||
Public Enum ProcessingQuality As Integer
|
||||
AUTOMATIC = 1
|
||||
VISIBLE = 2
|
||||
FAST = 3
|
||||
End Enum
|
||||
|
||||
' Tipo di progetto
|
||||
Public Enum ProjectType As Integer
|
||||
PROJ = 1
|
||||
PROD = 2
|
||||
End Enum
|
||||
|
||||
Public Enum Range As Integer
|
||||
STANDARD = 1
|
||||
EXTENDED = 2
|
||||
End Enum
|
||||
|
||||
Public Enum Recess As Integer
|
||||
AUTOMATIC = 1
|
||||
MANUAL = 2
|
||||
End Enum
|
||||
|
||||
Public Enum StoreyType As Integer
|
||||
CEILING = 1
|
||||
ROOF = 2
|
||||
WALL = 3
|
||||
End Enum
|
||||
|
||||
'Public Const S_GENERAL As String = "General"
|
||||
'Public Const K_DEBUG As String = "Debug"
|
||||
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,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
|
||||
@@ -44,11 +44,13 @@
|
||||
<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" />
|
||||
@@ -71,17 +73,24 @@
|
||||
<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="Constants\ConstColumns.vb" />
|
||||
<Compile Include="Constants\ConstMachComm.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="MachLog.vb" />
|
||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||
<Compile Include="My Project\Application.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
@@ -97,8 +106,12 @@
|
||||
<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="PartM.vb" />
|
||||
<Compile Include="ProdFileM.vb" />
|
||||
<Compile Include="ProjectFileM.vb" />
|
||||
<Compile Include="ProjFileM.vb" />
|
||||
@@ -106,8 +119,8 @@
|
||||
<Compile Include="Utility\BTLIniFile.vb" />
|
||||
<Compile Include="Utility\Command.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">
|
||||
@@ -130,6 +143,6 @@
|
||||
</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>
|
||||
@@ -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
|
||||
|
||||
Private 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
|
||||
|
||||
Private 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,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")>
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -2,41 +2,55 @@
|
||||
Imports EgtUILib
|
||||
|
||||
Public Class ProdFileM
|
||||
Inherits ProjectFileM
|
||||
Inherits ProjectFileM
|
||||
|
||||
Protected m_nProjIdList As List(Of Integer)
|
||||
Public ReadOnly Property nProjIdList As List(Of Integer)
|
||||
Get
|
||||
Return m_nProjIdList
|
||||
End Get
|
||||
End Property
|
||||
#Region "Protected Fields"
|
||||
|
||||
Protected m_sName As String
|
||||
Public ReadOnly Property sName As String
|
||||
Get
|
||||
Return m_sName
|
||||
End Get
|
||||
End Property
|
||||
Protected m_nProjIdList As List(Of Integer)
|
||||
Protected m_sName As String
|
||||
|
||||
#Region "CONSTRUCTORS"
|
||||
#End Region
|
||||
|
||||
Protected Sub New()
|
||||
End Sub
|
||||
#Region "Protected Constructors"
|
||||
|
||||
Public Shared Function CreateNewProdFileM() As ProdFileM
|
||||
Return New ProdFileM
|
||||
End Function
|
||||
Protected Sub New()
|
||||
End Sub
|
||||
|
||||
Public Shared Function CreateProdFileM(nProdId As Integer, nProjIdList As List(Of Integer),
|
||||
dtCreateProjDate As DateTime, sName As String) As ProdFileM
|
||||
Dim NewProjectFileM As New ProdFileM
|
||||
NewProjectFileM.m_nProdId = nProdId
|
||||
NewProjectFileM.m_nProjIdList = nProjIdList
|
||||
NewProjectFileM.m_dtCreateDate = dtCreateProjDate
|
||||
NewProjectFileM.m_sName = sName
|
||||
Return NewProjectFileM
|
||||
End Function
|
||||
#End Region
|
||||
|
||||
#End Region ' CONSTRUCTORS
|
||||
#Region "Public Properties"
|
||||
|
||||
Public ReadOnly Property nProjIdList As List(Of Integer)
|
||||
Get
|
||||
Return m_nProjIdList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sName As String
|
||||
Get
|
||||
Return m_sName
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "Public Methods"
|
||||
|
||||
Public Shared Function CreateNewProdFileM() As ProdFileM
|
||||
Return New ProdFileM
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateProdFileM(nProdId As Integer, nProjIdList As List(Of Integer), dtCreateProjDate As DateTime, sName As String, nType As BWType) As ProdFileM
|
||||
Dim NewProjectFileM As New ProdFileM
|
||||
NewProjectFileM.m_nProdId = nProdId
|
||||
NewProjectFileM.m_nProjIdList = nProjIdList
|
||||
NewProjectFileM.m_dtCreateDate = dtCreateProjDate
|
||||
NewProjectFileM.m_sName = sName
|
||||
NewProjectFileM.m_nType = nType
|
||||
|
||||
Return NewProjectFileM
|
||||
End Function
|
||||
|
||||
#End Region
|
||||
|
||||
End Class
|
||||
@@ -2,50 +2,71 @@
|
||||
Imports EgtUILib
|
||||
|
||||
Public Class ProjFileM
|
||||
Inherits ProjectFileM
|
||||
Inherits ProjectFileM
|
||||
|
||||
Protected m_dtExportDate As DateTime
|
||||
Public ReadOnly Property dtExportDate As DateTime
|
||||
Get
|
||||
Return m_dtExportDate
|
||||
End Get
|
||||
End Property
|
||||
#Region "Protected Fields"
|
||||
|
||||
Protected m_sListName As String
|
||||
Public ReadOnly Property sListName As String
|
||||
Get
|
||||
Return m_sListName
|
||||
End Get
|
||||
End Property
|
||||
Protected m_dtExportDate As DateTime
|
||||
Protected m_sBTLFileName As String = String.Empty
|
||||
|
||||
Protected m_sBTLFileName As String = String.Empty
|
||||
Public ReadOnly Property sBTLFileName As String
|
||||
Get
|
||||
Return m_sBTLFileName
|
||||
End Get
|
||||
End Property
|
||||
Protected m_sListName As String
|
||||
|
||||
#Region "CONSTRUCTORS"
|
||||
#End Region
|
||||
|
||||
Protected Sub New()
|
||||
End Sub
|
||||
#Region "Protected Constructors"
|
||||
|
||||
Public Shared Function CreateNewProjFileM() As ProjFileM
|
||||
Return New ProjFileM
|
||||
End Function
|
||||
Protected Sub New()
|
||||
End Sub
|
||||
|
||||
Public Shared Function CreateProjFileM(nProjId As Integer, nProdId As Integer, dtCreateProjDate As DateTime,
|
||||
dtExportDate As DateTime, sListName As String, sBTLFileName As String) As ProjFileM
|
||||
Dim NewProjectFileM As New ProjFileM
|
||||
#End Region
|
||||
|
||||
#Region "Public Properties"
|
||||
|
||||
Public ReadOnly Property dtExportDate As DateTime
|
||||
Get
|
||||
Return m_dtExportDate
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Property sBTLFileName As String
|
||||
Get
|
||||
Return m_sBTLFileName
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_sBTLFileName = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sListName As String
|
||||
Get
|
||||
Return m_sListName
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "Public Methods"
|
||||
|
||||
Public Shared Function CreateNewProjFileM() As ProjFileM
|
||||
Return New ProjFileM
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateProjFileM(nProjId As Integer, nProdId As Integer, dtCreateProjDate As DateTime,
|
||||
dtExportDate As DateTime, sListName As String, sBTLFileName As String, IsNew As Boolean, IsLocked As Boolean, nType As BWType) 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
|
||||
End Function
|
||||
NewProjectFileM.m_bIsNew = IsNew
|
||||
NewProjectFileM.m_bIsLocked = IsLocked
|
||||
NewProjectFileM.m_nType = nType
|
||||
|
||||
#End Region ' CONSTRUCTORS
|
||||
Return NewProjectFileM
|
||||
End Function
|
||||
|
||||
#End Region
|
||||
|
||||
End Class
|
||||
@@ -3,60 +3,85 @@ Imports EgtUILib
|
||||
|
||||
Public Class ProjectFileM
|
||||
|
||||
'Protected m_nProjectType As ProjectType
|
||||
'Public ReadOnly Property nProjectType As ProjectType
|
||||
' Get
|
||||
' Return m_nProjectType
|
||||
' End Get
|
||||
'End Property
|
||||
'Public Sub SetProjectType(nProjectType As ProjectType)
|
||||
' m_nProjectType = nProjectType
|
||||
'End Sub
|
||||
'Protected m_nProjectType As ProjectType
|
||||
'Public ReadOnly Property nProjectType As ProjectType
|
||||
' Get
|
||||
' Return m_nProjectType
|
||||
' End Get
|
||||
'End Property
|
||||
'Public Sub SetProjectType(nProjectType As ProjectType)
|
||||
' m_nProjectType = nProjectType
|
||||
'End Sub
|
||||
|
||||
Protected m_nProjId As Integer = 0
|
||||
Public ReadOnly Property nProjId As Integer
|
||||
Get
|
||||
Return m_nProjId
|
||||
End Get
|
||||
End Property
|
||||
#Region "Protected Fields"
|
||||
|
||||
Protected m_nProdId As Integer = 0
|
||||
Public ReadOnly Property nProdId As Integer
|
||||
Get
|
||||
Return m_nProdId
|
||||
End Get
|
||||
End Property
|
||||
Protected m_bIsLocked As Boolean
|
||||
Protected m_bIsNew As Boolean
|
||||
Protected m_dtCreateDate As DateTime
|
||||
Protected m_nProdId As Integer = 0
|
||||
Protected m_nProjId As Integer = 0
|
||||
Protected m_nType As BWType
|
||||
|
||||
Protected m_dtCreateDate As DateTime
|
||||
Public ReadOnly Property dtCreateDate As DateTime
|
||||
Get
|
||||
Return m_dtCreateDate
|
||||
End Get
|
||||
End Property
|
||||
#End Region
|
||||
|
||||
Protected m_bIsNew As Boolean
|
||||
Public Property bIsNew As Boolean
|
||||
Get
|
||||
Return m_bIsNew
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_bIsNew = value
|
||||
End Set
|
||||
End Property
|
||||
#Region "Public Properties"
|
||||
|
||||
#Region "CONSTRUCTORS"
|
||||
Public Property bIsLocked As Boolean
|
||||
Get
|
||||
Return m_bIsLocked
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_bIsLocked = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'Sub New(nProjectType As ProjectType, nProjId As Integer, nProdId As Integer, sBTLFileName As String)
|
||||
' m_nProjectType = nProjectType
|
||||
' If m_nProjectType = ProjectType.PROJ Then
|
||||
' m_nProjId = nProjId
|
||||
' m_nProdId = nProdId
|
||||
' m_BTLFileName = sBTLFileName
|
||||
' ElseIf m_nProjectType = ProjectType.PROD Then
|
||||
' m_nProdId = nProdId
|
||||
' End If
|
||||
'End Sub
|
||||
Public Property bIsNew As Boolean
|
||||
Get
|
||||
Return m_bIsNew
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_bIsNew = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#End Region ' CONSTRUCTORS
|
||||
Public ReadOnly Property dtCreateDate As DateTime
|
||||
Get
|
||||
Return m_dtCreateDate
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property nProdId As Integer
|
||||
Get
|
||||
Return m_nProdId
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property nProjId As Integer
|
||||
Get
|
||||
Return m_nProjId
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Property nType As BWType
|
||||
Get
|
||||
Return m_nType
|
||||
End Get
|
||||
Set(value As BWType)
|
||||
m_nType = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#End Region
|
||||
|
||||
'Sub New(nProjectType As ProjectType, nProjId As Integer, nProdId As Integer, sBTLFileName As String)
|
||||
' m_nProjectType = nProjectType
|
||||
' If m_nProjectType = ProjectType.PROJ Then
|
||||
' m_nProjId = nProjId
|
||||
' m_nProdId = nProdId
|
||||
' m_BTLFileName = sBTLFileName
|
||||
' ElseIf m_nProjectType = ProjectType.PROD Then
|
||||
' m_nProdId = nProdId
|
||||
' End If
|
||||
'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,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, Core.ConstBeam.BWType.NULL);
|
||||
}
|
||||
|
||||
/// <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, Core.ConstBeam.BWType.NULL)).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)
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
using static EgtBEAMWALL.Core.ConstBeam;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
@@ -19,13 +20,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, currProj.PType);
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get LAST paginated data from DB (DESC ordered)
|
||||
/// </summary>
|
||||
@@ -92,6 +104,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
dbCtx.ProjList.Remove(currProj);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
@@ -114,10 +127,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 +146,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 +193,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 +208,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 +228,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 +245,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 +292,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 +306,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 +372,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 +418,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 +486,52 @@ 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, BWType PType)
|
||||
{
|
||||
var currData = FindByProjId(ProjId);
|
||||
// aggiorno valore BTL
|
||||
currData.BTLFileName = newBTLFileName;
|
||||
currData.BTLFileName = BTLFileName;
|
||||
currData.DtExported = DtExported;
|
||||
currData.ListName = ListName;
|
||||
currData.PType = PType;
|
||||
|
||||
// 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
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using static EgtBEAMWALL.Core.ConstBeam;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
{
|
||||
@@ -60,6 +61,11 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
[Column("Id")]
|
||||
public int ProjId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Tipologia del progetto (Travi, Pareti, ...)
|
||||
/// </summary>
|
||||
public BWType PType { get; set; } = BWType.NULL;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -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,52 @@
|
||||
<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\202107141618197_AddBwProjType.cs" />
|
||||
<Compile Include="Migrations\202107141618197_AddBwProjType.designer.cs">
|
||||
<DependentUpon>202107141618197_AddBwProjType.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 +133,25 @@
|
||||
</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>
|
||||
<EmbeddedResource Include="Migrations\202107141618197_AddBwProjType.resx">
|
||||
<DependentUpon>202107141618197_AddBwProjType.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
@@ -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 AddBwProjType : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(AddBwProjType));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "202107141618197_AddBwProjType"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class AddBwProjType : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("dbo.ProjList", "PType", c => c.Int(nullable: false));
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropColumn("dbo.ProjList", "PType");
|
||||
}
|
||||
}
|
||||
}
|
||||
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>
|
||||
@@ -1,29 +0,0 @@
|
||||
<?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="System.Data.Entity.Infrastructure.SqlConnectionFactory, 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>
|
||||
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/></startup>
|
||||
<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>
|
||||
</configuration>
|
||||
@@ -1,19 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace EgtBEAMWALL.DbDataLayer
|
||||
{
|
||||
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 = "root";
|
||||
public const string DATABASE_PWD = "viacremasca";
|
||||
public static int DATABASE_PROCESS_TIMEOUT = 5;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,292 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using EgtBEAMWALL.DbDataLayer.DatabaseModels;
|
||||
|
||||
namespace EgtBEAMWALL.DbDataLayer.Controllers
|
||||
{
|
||||
public class BTLPartController : IDisposable
|
||||
{
|
||||
private DatabaseContext dbCtx;
|
||||
|
||||
public BTLPartController()
|
||||
{
|
||||
// Initialize database context
|
||||
dbCtx = new DatabaseContext();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database context
|
||||
dbCtx.Dispose();
|
||||
}
|
||||
/// <summary>
|
||||
/// Get record by Id
|
||||
/// </summary>
|
||||
/// <param name="PartDbId"></param>
|
||||
/// <returns></returns>
|
||||
public BTLPartModel FindByDbId(int PartDbId)
|
||||
{
|
||||
return dbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.PartDbId == PartDbId)
|
||||
.SingleOrDefault();
|
||||
}
|
||||
/// <summary>
|
||||
/// Get record by ExtId
|
||||
/// </summary>
|
||||
/// <param name="PartId"></param>
|
||||
/// <returns></returns>
|
||||
public BTLPartModel FindByPartId(int PartId)
|
||||
{
|
||||
return dbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.PartId == PartId)
|
||||
.SingleOrDefault();
|
||||
}
|
||||
/// <summary>
|
||||
/// Get paginated data from DB (ASC ordered)
|
||||
/// </summary>
|
||||
/// <param name="PartDbIdStart"></param>
|
||||
/// <param name="numRecord"></param>
|
||||
/// <returns></returns>
|
||||
public List<BTLPartModel> GetPaginatedAsc(int PartDbIdStart, int numRecord)
|
||||
{
|
||||
int numEnd = PartDbIdStart - numRecord;
|
||||
// check numEnd
|
||||
if (numEnd < 0)
|
||||
numEnd = 0;
|
||||
// retrieve
|
||||
return dbCtx
|
||||
.BTLPartList
|
||||
.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<BTLPartModel> GetPaginatedDesc(int PartDbIdStart, int numRecord)
|
||||
{
|
||||
int numEnd = PartDbIdStart - numRecord;
|
||||
// check numEnd
|
||||
if (numEnd < 0)
|
||||
numEnd = 0;
|
||||
// retrieve
|
||||
return dbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.PartDbId <= PartDbIdStart)
|
||||
.OrderByDescending(x => x.PartDbId)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
/// <summary>
|
||||
/// Get filtered data by ProjectId (ASC ordered)
|
||||
/// </summary>
|
||||
/// <param name="ProjDbId"></param>
|
||||
/// <returns></returns>
|
||||
public List<BTLPartModel> GetByProjectAsc(int ProjDbId)
|
||||
{
|
||||
// retrieve
|
||||
return dbCtx
|
||||
.BTLPartList
|
||||
.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<BTLPartModel> GetByProjectDesc(int ProjDbId)
|
||||
{
|
||||
// retrieve
|
||||
return dbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.ProjDbId == ProjDbId)
|
||||
.OrderByDescending(x => x.PartDbId)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create multiple (empty) Part record associated to Project
|
||||
/// </summary>
|
||||
/// <param name="ProjDbId"></param>
|
||||
/// <param name="rawListData"></param>
|
||||
/// <returns></returns>
|
||||
public List<BTLPartModel> CreateBaseObj(int ProjDbId, List<int> rawListData)
|
||||
{
|
||||
List<BTLPartModel> partData = new List<BTLPartModel>();
|
||||
|
||||
foreach (var item in rawListData)
|
||||
{
|
||||
BTLPartModel newItem = new BTLPartModel() { ProjDbId = ProjDbId, PartId = item };
|
||||
partData.Add(newItem);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
dbCtx.BTLPartList.AddRange(partData);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
|
||||
return partData;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Create multipole Part record associated to Project
|
||||
/// </summary>
|
||||
/// <param name="ProjID"></param>
|
||||
/// <param name="partData"></param>
|
||||
/// <returns></returns>
|
||||
public List<BTLPartModel> Create(int ProjID, List<BTLPartModel> partData)
|
||||
{
|
||||
// se è adv mode --> uso TUTTI i dati
|
||||
if (DbManager.AdvDataModel)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
dbCtx.BTLPartList.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(ProjID, partIdList);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete single Part
|
||||
/// </summary>
|
||||
/// <param name="updItem"></param>
|
||||
/// <returns></returns>
|
||||
public bool Update(BTLPartModel updItem)
|
||||
{
|
||||
bool done = false;
|
||||
var item2del = dbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.PartDbId == updItem.PartDbId)
|
||||
.SingleOrDefault();
|
||||
try
|
||||
{
|
||||
// update, vers 1...
|
||||
dbCtx.Entry(item2del).CurrentValues.SetValues(updItem);
|
||||
|
||||
//// update, vers 2
|
||||
//dbCtx.BTLPartList.Remove(item2del);
|
||||
//dbCtx.BTLPartList.Add(updItem);
|
||||
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return done;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete single Part
|
||||
/// </summary>
|
||||
/// <param name="PartDbId"></param>
|
||||
/// <returns></returns>
|
||||
public bool Delete(int PartDbId)
|
||||
{
|
||||
bool done = false;
|
||||
var item2del = dbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.PartDbId == PartDbId)
|
||||
.SingleOrDefault();
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
dbCtx.BTLPartList.Remove(item2del);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return done;
|
||||
}
|
||||
/// <summary>
|
||||
/// Delete Part by project
|
||||
/// </summary>
|
||||
/// <param name="ProjDbId"></param>
|
||||
/// <returns></returns>
|
||||
public bool DeleteByProject(int ProjDbId)
|
||||
{
|
||||
bool done = false;
|
||||
var items2del = dbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.ProjDbId == ProjDbId);
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
dbCtx.BTLPartList.RemoveRange(items2del);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return done;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// COnversion of base class to DB model class
|
||||
/// </summary>
|
||||
/// <param name="corePart"></param>
|
||||
/// <returns></returns>
|
||||
public BTLPartModel Convert(Core.BTLPart corePart)
|
||||
{
|
||||
BTLPartModel answ = new BTLPartModel();
|
||||
if (corePart != null)
|
||||
{
|
||||
answ = new BTLPartModel()
|
||||
{
|
||||
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,
|
||||
State = (int)corePart.nState
|
||||
};
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,142 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using EgtBEAMWALL.DbDataLayer.DatabaseModels;
|
||||
|
||||
namespace EgtBEAMWALL.DbDataLayer.Controllers
|
||||
{
|
||||
public class ProjController : IDisposable
|
||||
{
|
||||
private DatabaseContext dbCtx;
|
||||
|
||||
public ProjController()
|
||||
{
|
||||
// Initialize database context
|
||||
dbCtx = new DatabaseContext();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database context
|
||||
dbCtx.Dispose();
|
||||
}
|
||||
/// <summary>
|
||||
/// Get record by ProjDbId
|
||||
/// </summary>
|
||||
/// <param name="ProjDbId"></param>
|
||||
/// <returns></returns>
|
||||
public ProjModel FindByProjDbId(int ProjDbId)
|
||||
{
|
||||
return dbCtx
|
||||
.ProjList
|
||||
.Where(x => x.ProjDbId == ProjDbId)
|
||||
.SingleOrDefault();
|
||||
}
|
||||
/// <summary>
|
||||
/// Get record by ProjId
|
||||
/// </summary>
|
||||
/// <param name="ProjId"></param>
|
||||
/// <returns></returns>
|
||||
public ProjModel FindByProjId(int ProjId)
|
||||
{
|
||||
return dbCtx
|
||||
.ProjList
|
||||
.Where(x => x.ProjId == ProjId)
|
||||
.SingleOrDefault();
|
||||
}
|
||||
/// <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();
|
||||
}
|
||||
/// <summary>
|
||||
/// Get filtered data by ProjectId (ASC ordered)
|
||||
/// </summary>
|
||||
/// <param name="ProdDbId"></param>
|
||||
/// <returns></returns>
|
||||
public List<ProjModel> GetByProdAsc(int ProdDbId)
|
||||
{
|
||||
// retrieve
|
||||
return dbCtx
|
||||
.ProjList
|
||||
.Where(x => x.ProdDbId == ProdDbId)
|
||||
.OrderBy(x => x.ProdDbId)
|
||||
.ToList();
|
||||
}
|
||||
/// <summary>
|
||||
/// Get filtered data by ProjectId (DESC ordered)
|
||||
/// </summary>
|
||||
/// <param name="ProdDbId"></param>
|
||||
/// <returns></returns>
|
||||
public List<ProjModel> GetByProdDesc(int ProdDbId)
|
||||
{
|
||||
// retrieve
|
||||
return dbCtx
|
||||
.ProjList
|
||||
.Where(x => x.ProdDbId == ProdDbId)
|
||||
.OrderByDescending(x => x.ProdDbId)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create record on DB
|
||||
/// </summary>
|
||||
/// <param name="newProjId"></param>
|
||||
/// <param name="newBTLFileName"></param>
|
||||
/// <returns></returns>
|
||||
public ProjModel Create(int newProjId, string newBTLFileName)
|
||||
{
|
||||
ProjModel newProj = new ProjModel() { ProjId=newProjId, BTLFileName=newBTLFileName };
|
||||
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
dbCtx.ProjList.Add(newProj);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
|
||||
return newProj;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
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.DbDataLayer.DatabaseModels;
|
||||
using EgtBEAMWALL.DbDataLayer.Migrations;
|
||||
using System.ServiceProcess;
|
||||
//using EgtBEAMWALL.DataLayer.Migrations;
|
||||
//using EgtBEAMWALL.DataLayer.Controllers;
|
||||
|
||||
namespace EgtBEAMWALL.DbDataLayer
|
||||
{
|
||||
|
||||
[DbConfigurationType(typeof(MySqlEFConfiguration))]
|
||||
public class DatabaseContext : DbContext
|
||||
{
|
||||
/// <summary>
|
||||
/// BTLParts management
|
||||
/// </summary>
|
||||
public DbSet<BTLPartModel> BTLPartList { get; set; }
|
||||
/// <summary>
|
||||
/// Parts management
|
||||
/// </summary>
|
||||
public DbSet<ProdModel> ProdList { get; set; }
|
||||
/// <summary>
|
||||
/// Parts management
|
||||
/// </summary>
|
||||
public DbSet<ProjModel> ProjList { get; set; }
|
||||
/// <summary>
|
||||
/// Parts management
|
||||
/// </summary>
|
||||
public DbSet<RawPartModel> RawPartList { get; set; }
|
||||
/// <summary>
|
||||
/// Parts management
|
||||
/// </summary>
|
||||
public DbSet<PartModel> PartList { get; set; }
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Db data mode
|
||||
/// </summary>
|
||||
public static bool AdvDataModel { get; set; } = false;
|
||||
#endif
|
||||
|
||||
//providerName="System.Data.EntityClient"
|
||||
|
||||
|
||||
public static string CONNECTION_STRING = $"server={Constants.DATABASE_SERV};port=3306;database={Constants.DATABASE_NAME};uid={Constants.DATABASE_USER};pwd={Constants.DATABASE_PWD};";
|
||||
|
||||
public DatabaseContext() : base(CONNECTION_STRING)
|
||||
{
|
||||
}
|
||||
|
||||
public static DatabaseContext Create()
|
||||
{
|
||||
return new DatabaseContext();
|
||||
}
|
||||
|
||||
private static string getDbServiceName()
|
||||
{
|
||||
ServiceController[] services = ServiceController.GetServices();
|
||||
var service = services.FirstOrDefault(s => s.ServiceName == "MariaDB");
|
||||
if (service != null)
|
||||
return service.DisplayName;
|
||||
|
||||
service = services.FirstOrDefault(s => s.ServiceName == "MySQL");
|
||||
if (service != null)
|
||||
return service.DisplayName;
|
||||
|
||||
return "";
|
||||
|
||||
}
|
||||
|
||||
public static bool SetUpDbConnectionAndDbConfig()
|
||||
{
|
||||
try
|
||||
{
|
||||
String serviceName = getDbServiceName();
|
||||
if (serviceName.Equals(""))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
ServiceController service = new ServiceController(serviceName);
|
||||
try
|
||||
{
|
||||
TimeSpan timeout = TimeSpan.FromSeconds(Constants.DATABASE_PROCESS_TIMEOUT);
|
||||
service.WaitForStatus(ServiceControllerStatus.Running, timeout);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
System.Data.Entity.Database.SetInitializer<DatabaseContext>(null);
|
||||
var migrator = new DbMigrator(new Configuration());
|
||||
|
||||
if (migrator.GetPendingMigrations().Any())
|
||||
{
|
||||
// Run migrations and seed.
|
||||
migrator.Update();
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace EgtBEAMWALL.DbDataLayer.DatabaseModels
|
||||
{
|
||||
[Table("BTLPartList")]
|
||||
public class BTLPartModel
|
||||
{
|
||||
[Key, Column("BTLPartDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int PartDbId { get; set; }
|
||||
|
||||
[Column("BTLPartId")]
|
||||
public int PartId { get; set; }
|
||||
|
||||
[Column("BTLPart_PDN")]
|
||||
public int PDN { get; set; } = 0;
|
||||
|
||||
[Column("BTLPart_DO")]
|
||||
public bool DO { get; set; } = false;
|
||||
|
||||
[Column("BTLPart_NAM")]
|
||||
public string NAM { get; set; } = "";
|
||||
|
||||
[Column("BTLPart_W")]
|
||||
public double W { get; set; } = 0;
|
||||
|
||||
[Column("BTLPart_L")]
|
||||
public double L { get; set; } = 0;
|
||||
|
||||
[Column("BTLPart_H")]
|
||||
public double H { get; set; } = 0;
|
||||
|
||||
[Column("BTLPart_MAT")]
|
||||
public string MAT { get; set; } = "";
|
||||
|
||||
[Column("BTLPart_CNT")]
|
||||
public int CNT { get; set; } = 0;
|
||||
|
||||
[Column("BTLPart_TBP")]
|
||||
public int TBP { get; set; } = 0;
|
||||
|
||||
[Column("BTLPart_DON")]
|
||||
public int DON { get; set; } = 0;
|
||||
|
||||
[Column("BTLPart_ROT")]
|
||||
public int ROT { get; set; } = 0;
|
||||
|
||||
[Column("BTLPart_GRP")]
|
||||
public string GRP { get; set; } = "";
|
||||
|
||||
[Column("BTLPart_UNT")]
|
||||
public int UNT { get; set; } = 0;
|
||||
|
||||
[Column("BTLPart_State")]
|
||||
public int State { get; set; } = -1;
|
||||
|
||||
[Column("ProjDbId")]
|
||||
public int ProjDbId { get; set; }
|
||||
|
||||
[ForeignKey("ProjDbId")]
|
||||
public ProjModel Project { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace EgtBEAMWALL.DbDataLayer.DatabaseModels
|
||||
{
|
||||
[Table("PartList")]
|
||||
public class PartModel
|
||||
{
|
||||
[Key, Column("PartDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int PartDbId { get; set; }
|
||||
|
||||
[Column("PartId")]
|
||||
public int PartId { get; set; }
|
||||
|
||||
[Column("Part_PDN")]
|
||||
public int PDN { get; set; } = 0;
|
||||
|
||||
[Column("Part_NAM")]
|
||||
public string NAM { get; set; } = "";
|
||||
|
||||
[Column("Part_W")]
|
||||
public double W { get; set; } = 0;
|
||||
|
||||
[Column("Part_L")]
|
||||
public double L { get; set; } = 0;
|
||||
|
||||
[Column("Part_H")]
|
||||
public double H { get; set; } = 0;
|
||||
|
||||
[Column("Part_MAT")]
|
||||
public string MAT { get; set; } = "";
|
||||
|
||||
[Column("Part_ROT")]
|
||||
public int ROT { get; set; } = 0;
|
||||
|
||||
[Column("Part_GRP")]
|
||||
public string GRP { get; set; } = "";
|
||||
|
||||
[Column("Part_State")]
|
||||
public int State { get; set; } = -1;
|
||||
|
||||
[Column("BTLPartDbId")]
|
||||
public int BTLPartDbId { get; set; }
|
||||
|
||||
[ForeignKey("BTLPartDbId")]
|
||||
public BTLPartModel BTLPart { get; set; }
|
||||
|
||||
[Column("RawPartDbId")]
|
||||
public int? RawPartDbId { get; set; }
|
||||
|
||||
[ForeignKey("RawPartDbId")]
|
||||
public virtual RawPartModel RawPart { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace EgtBEAMWALL.DbDataLayer.DatabaseModels
|
||||
{
|
||||
[Table("ProdList")]
|
||||
public class ProdModel
|
||||
{
|
||||
[Key, Column("ProdDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int ProdDbId { get; set; }
|
||||
|
||||
[Column("ProdId")]
|
||||
public int ProdId { get; set; }
|
||||
|
||||
[Column("Prod_Description")]
|
||||
public string Description { get; set; } = "";
|
||||
|
||||
[Column("Prod_Lock")]
|
||||
public bool Locked { get; set; } = false;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace EgtBEAMWALL.DbDataLayer.DatabaseModels
|
||||
{
|
||||
[Table("ProjList")]
|
||||
public class ProjModel
|
||||
{
|
||||
[Key, Column("ProjDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int ProjDbId { get; set; }
|
||||
|
||||
[Column("ProjId")]
|
||||
public int ProjId { get; set; }
|
||||
|
||||
[Column("Proj_BTLFileName")]
|
||||
public string BTLFileName { get; set; } = "";
|
||||
|
||||
[Column("ProdDbId")]
|
||||
public int? ProdDbId { get; set; }
|
||||
|
||||
[ForeignKey("ProdDbId")]
|
||||
public virtual ProdModel Prod { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace EgtBEAMWALL.DbDataLayer.DatabaseModels
|
||||
{
|
||||
[Table("RawPartList")]
|
||||
public class RawPartModel
|
||||
{
|
||||
[Key, Column("RawPartDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int RawPartDbId { get; set; }
|
||||
|
||||
[Column("RawPartId")]
|
||||
public int RawPartId { get; set; }
|
||||
|
||||
[Column("RawPart_Descript")]
|
||||
public string Description { get; set; } = "";
|
||||
|
||||
[Column("RawPart_Lock")]
|
||||
public bool Locked { get; set; } = false;
|
||||
|
||||
[Column("ProdDbId")]
|
||||
public int ProdDbId { get; set; }
|
||||
|
||||
[ForeignKey("ProdDbId")]
|
||||
public ProdModel Prod { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace EgtBEAMWALL.DbDataLayer
|
||||
{
|
||||
public class DbManager
|
||||
{
|
||||
public static bool AdvDataModel { get; set; } = false;
|
||||
|
||||
public DbManager()
|
||||
{
|
||||
}
|
||||
|
||||
public Controllers.ProjController ProjCtr = new Controllers.ProjController();
|
||||
public Controllers.BTLPartController BtlPartCtr = new Controllers.BTLPartController();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\packages\EntityFramework.6.4.4\build\EntityFramework.props" Condition="Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.props')" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{5F1CDE84-FD6A-4107-968C-ECC4D64F8043}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>EgtBEAMWALL.DbDataLayer</RootNamespace>
|
||||
<AssemblyName>EgtBEAMWALL.DbDataLayer</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MySql.Data, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MySql.Data.6.10.9\lib\net452\MySql.Data.dll</HintPath>
|
||||
</Reference>
|
||||
<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="System" />
|
||||
<Reference Include="System.ComponentModel" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Configuration.Install" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Drawing.Design" />
|
||||
<Reference Include="System.Management" />
|
||||
<Reference Include="System.Security" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.ServiceProcess" />
|
||||
<Reference Include="System.Transactions" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Constants.cs" />
|
||||
<Compile Include="Controllers\BTLPartController.cs" />
|
||||
<Compile Include="Controllers\ProjController.cs" />
|
||||
<Compile Include="DatabaseContext.cs" />
|
||||
<Compile Include="DatabaseModels\BTLPartModel.cs" />
|
||||
<Compile Include="DatabaseModels\PartModel.cs" />
|
||||
<Compile Include="DatabaseModels\ProdModel.cs" />
|
||||
<Compile Include="DatabaseModels\ProjModel.cs" />
|
||||
<Compile Include="DatabaseModels\RawPartModel.cs" />
|
||||
<Compile Include="DbManager.cs" />
|
||||
<Compile Include="Migrations\202103031756343_InitDb.cs" />
|
||||
<Compile Include="Migrations\202103031756343_InitDb.designer.cs">
|
||||
<DependentUpon>202103031756343_InitDb.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\Configuration.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\EgtBEAMWALL.Core\EgtBEAMWALL.Core.vbproj">
|
||||
<Project>{f22835a1-83d8-4334-91bb-baaeb9cf59b1}</Project>
|
||||
<Name>EgtBEAMWALL.Core</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Migrations\202103031756343_InitDb.resx">
|
||||
<DependentUpon>202103031756343_InitDb.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\EntityFramework.6.4.4\build\EntityFramework.props'))" />
|
||||
<Error Condition="!Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\EntityFramework.6.4.4\build\EntityFramework.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\packages\EntityFramework.6.4.4\build\EntityFramework.targets" Condition="Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.targets')" />
|
||||
</Project>
|
||||
@@ -1,119 +0,0 @@
|
||||
namespace EgtBEAMWALL.DbDataLayer.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class InitDb : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
CreateTable(
|
||||
"dbo.BTLPartList",
|
||||
c => new
|
||||
{
|
||||
BTLPartDbId = c.Int(nullable: false, identity: true),
|
||||
BTLPartId = c.Int(nullable: false),
|
||||
BTLPart_PDN = c.Int(nullable: false),
|
||||
BTLPart_DO = c.Boolean(nullable: false),
|
||||
BTLPart_NAM = c.String(unicode: false),
|
||||
BTLPart_W = c.Double(nullable: false),
|
||||
BTLPart_L = c.Double(nullable: false),
|
||||
BTLPart_H = c.Double(nullable: false),
|
||||
BTLPart_MAT = c.String(unicode: false),
|
||||
BTLPart_CNT = c.Int(nullable: false),
|
||||
BTLPart_TBP = c.Int(nullable: false),
|
||||
BTLPart_DON = c.Int(nullable: false),
|
||||
BTLPart_ROT = c.Int(nullable: false),
|
||||
BTLPart_GRP = c.String(unicode: false),
|
||||
BTLPart_UNT = c.Int(nullable: false),
|
||||
BTLPart_State = c.Int(nullable: false),
|
||||
ProjDbId = c.Int(nullable: false),
|
||||
})
|
||||
.PrimaryKey(t => t.BTLPartDbId)
|
||||
.ForeignKey("dbo.ProjList", t => t.ProjDbId, cascadeDelete: true)
|
||||
.Index(t => t.ProjDbId);
|
||||
|
||||
CreateTable(
|
||||
"dbo.ProjList",
|
||||
c => new
|
||||
{
|
||||
ProjDbId = c.Int(nullable: false, identity: true),
|
||||
ProjId = c.Int(nullable: false),
|
||||
Proj_BTLFileName = c.String(unicode: false),
|
||||
ProdDbId = c.Int(),
|
||||
})
|
||||
.PrimaryKey(t => t.ProjDbId)
|
||||
.ForeignKey("dbo.ProdList", t => t.ProdDbId)
|
||||
.Index(t => t.ProdDbId);
|
||||
|
||||
CreateTable(
|
||||
"dbo.ProdList",
|
||||
c => new
|
||||
{
|
||||
ProdDbId = c.Int(nullable: false, identity: true),
|
||||
ProdId = c.Int(nullable: false),
|
||||
Prod_Description = c.String(unicode: false),
|
||||
Prod_Lock = c.Boolean(nullable: false),
|
||||
})
|
||||
.PrimaryKey(t => t.ProdDbId);
|
||||
|
||||
CreateTable(
|
||||
"dbo.PartList",
|
||||
c => new
|
||||
{
|
||||
PartDbId = c.Int(nullable: false, identity: true),
|
||||
PartId = c.Int(nullable: false),
|
||||
Part_PDN = c.Int(nullable: false),
|
||||
Part_NAM = c.String(unicode: false),
|
||||
Part_W = c.Double(nullable: false),
|
||||
Part_L = c.Double(nullable: false),
|
||||
Part_H = c.Double(nullable: false),
|
||||
Part_MAT = c.String(unicode: false),
|
||||
Part_ROT = c.Int(nullable: false),
|
||||
Part_GRP = c.String(unicode: false),
|
||||
Part_State = c.Int(nullable: false),
|
||||
BTLPartDbId = c.Int(nullable: false),
|
||||
RawPartDbId = c.Int(),
|
||||
})
|
||||
.PrimaryKey(t => t.PartDbId)
|
||||
.ForeignKey("dbo.BTLPartList", t => t.BTLPartDbId, cascadeDelete: true)
|
||||
.ForeignKey("dbo.RawPartList", t => t.RawPartDbId)
|
||||
.Index(t => t.BTLPartDbId)
|
||||
.Index(t => t.RawPartDbId);
|
||||
|
||||
CreateTable(
|
||||
"dbo.RawPartList",
|
||||
c => new
|
||||
{
|
||||
RawPartDbId = c.Int(nullable: false, identity: true),
|
||||
RawPartId = c.Int(nullable: false),
|
||||
RawPart_Descript = c.String(unicode: false),
|
||||
RawPart_Lock = c.Boolean(nullable: false),
|
||||
ProdDbId = c.Int(nullable: false),
|
||||
})
|
||||
.PrimaryKey(t => t.RawPartDbId)
|
||||
.ForeignKey("dbo.ProdList", t => t.ProdDbId, cascadeDelete: true)
|
||||
.Index(t => t.ProdDbId);
|
||||
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropForeignKey("dbo.PartList", "RawPartDbId", "dbo.RawPartList");
|
||||
DropForeignKey("dbo.RawPartList", "ProdDbId", "dbo.ProdList");
|
||||
DropForeignKey("dbo.PartList", "BTLPartDbId", "dbo.BTLPartList");
|
||||
DropForeignKey("dbo.BTLPartList", "ProjDbId", "dbo.ProjList");
|
||||
DropForeignKey("dbo.ProjList", "ProdDbId", "dbo.ProdList");
|
||||
DropIndex("dbo.RawPartList", new[] { "ProdDbId" });
|
||||
DropIndex("dbo.PartList", new[] { "RawPartDbId" });
|
||||
DropIndex("dbo.PartList", new[] { "BTLPartDbId" });
|
||||
DropIndex("dbo.ProjList", new[] { "ProdDbId" });
|
||||
DropIndex("dbo.BTLPartList", new[] { "ProjDbId" });
|
||||
DropTable("dbo.RawPartList");
|
||||
DropTable("dbo.PartList");
|
||||
DropTable("dbo.ProdList");
|
||||
DropTable("dbo.ProjList");
|
||||
DropTable("dbo.BTLPartList");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
namespace EgtBEAMWALL.DbDataLayer.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Linq;
|
||||
|
||||
internal sealed class Configuration : DbMigrationsConfiguration<EgtBEAMWALL.DbDataLayer.DatabaseContext>
|
||||
{
|
||||
public Configuration()
|
||||
{
|
||||
AutomaticMigrationsEnabled = false;
|
||||
}
|
||||
|
||||
protected override void Seed(EgtBEAMWALL.DbDataLayer.DatabaseContext context)
|
||||
{
|
||||
// This method will be called after migrating to the latest version.
|
||||
|
||||
// You can use the DbSet<T>.AddOrUpdate() helper extension method
|
||||
// to avoid creating duplicate seed data.
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("EgtBEAMWALL.DbDataLayer")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("EgtBEAMWALL.DbDataLayer")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2021")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("5f1cde84-fd6a-4107-968c-ecc4d64f8043")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// 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("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<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" />
|
||||
</packages>
|
||||
@@ -23,8 +23,8 @@ namespace EgtBEAMWALL.StressTest
|
||||
#region Public Fields
|
||||
|
||||
public List<Core.BTLPartM> BtlPartList = new List<Core.BTLPartM>();
|
||||
public List<Core.MyMachGroup> MachGroupList = new List<Core.MyMachGroup>();
|
||||
public List<Core.Part> PartList = new List<Core.Part>();
|
||||
public List<Core.MyMachGroupM> MachGroupList = new List<Core.MyMachGroupM>();
|
||||
public List<Core.PartM> PartList = new List<Core.PartM>();
|
||||
public List<Core.ProjectFileM> ProdList = new List<Core.ProjectFileM>();
|
||||
public List<Core.ProjectFileM> ProjList = new List<Core.ProjectFileM>();
|
||||
|
||||
@@ -77,9 +77,9 @@ namespace EgtBEAMWALL.StressTest
|
||||
currProjId = ProjCtr.GetNextIndex();
|
||||
var currProjRecord = ProjCtr.FindByProjId(currProjId);
|
||||
List<DataLayer.DatabaseModels.BTLPartModel> currPartList = new List<DataLayer.DatabaseModels.BTLPartModel>();
|
||||
List<DataLayer.DatabaseModels.MachGroupModel> currMachGroupList = new List<DataLayer.DatabaseModels.MachGroupModel>();
|
||||
List<DataLayer.DatabaseModels.PartModel> currMGPartList = new List<DataLayer.DatabaseModels.PartModel>();
|
||||
ProjCtr.UpdateName(currProjId, $"{DateTime.Now:yyyyMMdd_HHmmssfff}");
|
||||
List<Core.MyMachGroupM> currMachGroupList = new List<Core.MyMachGroupM>();
|
||||
List<Core.PartM> currMGPartList = new List<Core.PartM>();
|
||||
ProjCtr.UpdateInfo(currProjId, $"{DateTime.Now:yyyyMMdd_HHmmssfff}", $"LN_{DateTime.Now:yyyyMMdd_HHmm}", DateTime.Now.AddSeconds(15));
|
||||
// genero le BTLParts ed assegno..
|
||||
for (int j = 0; j < currRandom.BtlPart2Proj; j++)
|
||||
{
|
||||
@@ -96,7 +96,7 @@ namespace EgtBEAMWALL.StressTest
|
||||
numMG = (numPart2make / currRandom.Part2MachGroup) + 1;
|
||||
for (int k = 0; k < numMG; k++)
|
||||
{
|
||||
currMachGroupList.Add(new DataLayer.DatabaseModels.MachGroupModel() { Locked = true, LogRev = k, MachGroupId = k, Name = $"MG{k:000}", H = 20 * k, L = 100 * k, W = 10 * k, State = Core.ItemState.Assigned, ProdDbId = currProdRecord.ProdDbId });
|
||||
currMGPartList = new List<Core.PartM>();
|
||||
|
||||
if (BPIdx >= currPartList.Count)
|
||||
{
|
||||
@@ -107,14 +107,27 @@ namespace EgtBEAMWALL.StressTest
|
||||
{
|
||||
for (int l = 0; l < currRandom.Part2MachGroup; l++)
|
||||
{
|
||||
// FixME!!! non può creare x loop in CreateBeamDL che vuole nParentMachGroup
|
||||
// genero le Part x MachGroup ed assegno
|
||||
currMGPartList.Add(new DataLayer.DatabaseModels.PartModel() { BTLPartDbId = currBTLPart.BTLPartDbId, PDN = l * k * currRandom.Part2MachGroup, PartId = l, H = 10 * l, L = 50 * l, W = 5 * l });
|
||||
Core.PartM currPart = Core.BeamM.CreateBeamDL(null, currPartList[BPIdx].PartId, 1);
|
||||
currMGPartList.Add(currPart);
|
||||
//currMGPartList.Add(new DataLayer.DatabaseModels.PartModel() { BTLPartDbId = currBTLPart.BTLPartDbId, PDN = l * k * currRandom.Part2MachGroup, PartId = l, H = 10 * l, L = 50 * l, W = 5 * l });
|
||||
}
|
||||
}
|
||||
BPIdx++;
|
||||
|
||||
//Core.MachGroupM currMGroup = new Core.BeamMachGroupM.CreateBeamMachGroupDL(1, $"MG{k:000}", "MAC01", currMGPartList);
|
||||
|
||||
//currMGroup.PartMList
|
||||
|
||||
//currMachGroupList.Add(new DataLayer.DatabaseModels.MachGroupModel() { Locked = true, LogRev = k, MachGroupId = k, Name = $"MG{k:000}", H = 20 * k, L = 100 * k, W = 10 * k, State = Core.ItemState.Assigned, ProdDbId = currProdRecord.ProdDbId });
|
||||
}
|
||||
// salvo in blocco!
|
||||
ProdCtr.UpdateMachGroupDB(currProdId, currMachGroupList, currMGPartList);
|
||||
ProdCtr.UpdateMachGroup(currProdId, currMachGroupList);
|
||||
ProdCtr.UpdateMachGroup(currProdId, currMachGroupList);
|
||||
|
||||
//ProdCtr.UpdateMachGroupDB(currProdId, currMachGroupList, currMGPartList);
|
||||
//ProdCtr.UpdateMachGroupDB(currProdId, currMachGroupList, currMGPartList);
|
||||
|
||||
// nuovo random!
|
||||
currRandom = RandomParamSet;
|
||||
@@ -123,6 +136,11 @@ namespace EgtBEAMWALL.StressTest
|
||||
return done;
|
||||
}
|
||||
|
||||
public void initDb()
|
||||
{
|
||||
var firstData = ProjCtr.GetLastDesc(1);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user