Compare commits
287 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 88b9226bcb | |||
| 9f4e025305 | |||
| ecbd6ecd66 | |||
| e701f54c07 | |||
| 2a2728505f | |||
| a5dc629e21 | |||
| c7fbe8a26a | |||
| b43a8ff2bb | |||
| 6cf303deca | |||
| 855762095f | |||
| 733fd4dc09 | |||
| 71a4985392 | |||
| 0d4d9a4520 | |||
| 622439de62 | |||
| 618d02d7c6 | |||
| d37df9d0f4 | |||
| 011673510d | |||
| ff52b9a79b | |||
| 85a5200e6b | |||
| 0e665ef1b0 | |||
| 2b99df6238 | |||
| 39ea11a8c4 | |||
| 79c7e3e536 | |||
| e4eb264abb | |||
| 500aa2eacf | |||
| b55810f235 | |||
| b898346efb | |||
| 586e4689ae | |||
| 7668aa5766 | |||
| e64090bfaf | |||
| 7c71fd4842 | |||
| 888bf0fcf8 | |||
| 009f22e146 | |||
| ef14b08737 | |||
| 8f9bd3ecb7 | |||
| 3eb6518ea4 | |||
| b15eb92785 | |||
| 96511ca335 | |||
| 974dee54da | |||
| 7e52ce986f | |||
| 4fc4875b91 | |||
| b3138d1982 | |||
| e87622ef5d | |||
| aafe52d2da | |||
| ffe53bf725 | |||
| 832ea7aec5 | |||
| 6d9a157b35 | |||
| 71afc6554e | |||
| bc40da74ab | |||
| 405fde996c | |||
| 8321f09af8 | |||
| 391583b9ea | |||
| 5cf0472806 | |||
| 89598c154e | |||
| 785792d63b | |||
| 5874a39b25 | |||
| 43f3f2f6d8 | |||
| 79a883a303 | |||
| e3f88296e5 | |||
| e207ed7ece | |||
| e97175765b | |||
| 6a0ebb9fee | |||
| 0a698dae34 | |||
| b74c052dd1 | |||
| 330e501277 | |||
| b7d62ace2c | |||
| c6f353ec35 | |||
| 0b7bdd6ade | |||
| 3febbbbcbf | |||
| 31874a8b92 | |||
| c75d9d6bc2 | |||
| 96dd92c3d3 | |||
| ebc41183bc | |||
| feb7982bef | |||
| f241b72453 | |||
| 2b306763c6 | |||
| f1b0a28e71 | |||
| 121f02fb0c | |||
| 848b6d98a5 | |||
| 0589565b8e | |||
| 1109a91dd9 | |||
| 37cb1dbb6a | |||
| 152788fe1b | |||
| 534b363a04 | |||
| 3f13706b97 | |||
| 1f804ab6fc | |||
| 21dd6fbbb1 | |||
| da73acc8a0 | |||
| f9825db2ac | |||
| a3ea3bd1eb | |||
| 805a3acf54 | |||
| f21f2a6422 | |||
| b25d73c0cb | |||
| 50d9603598 | |||
| fae8018df9 | |||
| 3b2715ee58 | |||
| d7c8e8e21d | |||
| 9d11e6e9ca | |||
| 8d90714a82 | |||
| 429d7f58e4 | |||
| 7e15ef9dd1 | |||
| 6060746412 | |||
| 2b4f3d93dc | |||
| f365c7a593 | |||
| fc797ff4a7 | |||
| 63b1f1532a | |||
| b861c647fc | |||
| fa7d95cc53 | |||
| cdb0414097 | |||
| 48ac0a878f | |||
| 804992e485 | |||
| 4ef9497514 | |||
| 3c939a9e5b | |||
| aaddb6897f | |||
| b0db630d56 | |||
| e608fd3a52 | |||
| 573cc1478a | |||
| 25d7516c7a | |||
| 8ac3c4879b | |||
| b551120fcc | |||
| b1846bb804 | |||
| 399a1f466f | |||
| c1ca70adce | |||
| 364520f9a3 | |||
| c0bfe75fd7 | |||
| 1d9618d797 | |||
| 1ac9f823a4 | |||
| 73950690ff | |||
| 2bc79ad2de | |||
| 9ad45b9ea4 | |||
| 89cb9e06f1 | |||
| 3b77f647a6 | |||
| 71c5b20782 | |||
| 08ac48d16e | |||
| 90ac144f2a | |||
| f5b98f803c | |||
| 8f05ef25f6 | |||
| 0022aacbd3 | |||
| ba64c8e231 | |||
| 431c30935c | |||
| 47d0fef508 | |||
| 6decc2f690 | |||
| 2bbd407019 | |||
| abc2c4fe07 | |||
| 2b8342111a | |||
| d57dd30fa0 | |||
| 06d3c53122 | |||
| 5a20897641 | |||
| ae65d448a9 | |||
| df9395e808 | |||
| 402e17b57d | |||
| 3d867dfa3a | |||
| 03a6936f8a | |||
| a4a48f3c3b | |||
| 1d7c390180 | |||
| adb4636513 | |||
| fb0c02e790 | |||
| b5ef4567b6 | |||
| 1a6c2fa340 | |||
| 21784ab491 | |||
| d5147e3dd1 | |||
| bfb1dea84b | |||
| e927a5334a | |||
| 3310eb039c | |||
| 946b4e0e42 | |||
| ff7661f1e0 | |||
| f4eaaf2d59 | |||
| b5fef75133 | |||
| 09035439bd | |||
| 22ed5c599c | |||
| 8822da5d09 | |||
| c4d01b7aff | |||
| c8e962d709 | |||
| cb7819c687 | |||
| ebd9092565 | |||
| 167c6bf39d | |||
| def20a48a3 | |||
| 0945aaf9d0 | |||
| 07dbd89849 | |||
| fa511c5c2c | |||
| 6c065fedfc | |||
| 7858480cde | |||
| c388cb7b21 | |||
| 4d11248b0e | |||
| e2040f2153 | |||
| b19b44f86d | |||
| eb37f8bb8f | |||
| b83a03e36a | |||
| 6d11f6345f | |||
| 32e8cf7923 | |||
| ac2167f5ea | |||
| 8236b0ff96 | |||
| 78cde47c01 | |||
| 2d51bbaeb5 | |||
| 620a87105a | |||
| ab40ad056c | |||
| 62f85d6f92 | |||
| 01ac9d36da | |||
| a466e85b70 | |||
| 5c9fd216bc | |||
| 4685717a8a | |||
| 08ae91e412 | |||
| 145b3ccbe8 | |||
| 4cea9959c9 | |||
| 7118efbc2d | |||
| 4a4613454d | |||
| 45464ab85d | |||
| 22539226e6 | |||
| e9eaff2685 | |||
| 66567d8ec6 | |||
| 1715b5c5b1 | |||
| 2ad4c5af21 | |||
| 27a1618265 | |||
| a3c9d256b4 | |||
| 5c6febf055 | |||
| feecab95ab | |||
| d5a338a902 | |||
| 8763400f06 | |||
| 34ddc826f8 | |||
| 1b3c46fbae | |||
| b05fbac9fe | |||
| 42353d4b04 | |||
| 52ce04727a | |||
| 87b4ebca64 | |||
| c7a50d88b7 | |||
| fef7112f46 | |||
| 98025f02a4 | |||
| f4b4d5ee90 | |||
| 6337113437 | |||
| b7b2606c84 | |||
| c79a584ab7 | |||
| f7435ab895 | |||
| ccd9a70c0c | |||
| 04c8f8eba2 | |||
| e8870ca050 | |||
| 6900eedd63 | |||
| 5848bc2b0c | |||
| 795f202b0c | |||
| e41cb24fc9 | |||
| ed72c7a4e1 | |||
| 8c3ff80547 | |||
| 28de1c6791 | |||
| 4e814d73c6 | |||
| 402015af8a | |||
| e4d1514047 | |||
| 33da807eb5 | |||
| 43a755febd | |||
| 24ed23f161 | |||
| ba6a718119 | |||
| 9a7db0207d | |||
| e35f51e0c8 | |||
| 4502f1162c | |||
| 70f26de43f | |||
| ef626eaaf9 | |||
| 2ebbfd5662 | |||
| 5244caf8e2 | |||
| 89ab7bf961 | |||
| 331b9341be | |||
| fe5d09a8bd | |||
| 312722d3c3 | |||
| 5f37a796e6 | |||
| 0a9fe6f8b6 | |||
| 8f12378299 | |||
| affd519bc8 | |||
| 9434211413 | |||
| 01959dde1f | |||
| fc6c07c613 | |||
| c6e59dd6bb | |||
| fc1f07a01b | |||
| 11d6425de3 | |||
| da79e8b833 | |||
| 4a1bdf2397 | |||
| 40bcfde47c | |||
| 08db55b69f | |||
| 914b7317e8 | |||
| be2c5e1774 | |||
| dcdc612569 | |||
| 6798c0faa5 | |||
| 3758957946 | |||
| cb755b8869 | |||
| ffedabc0f3 | |||
| 557f53bc66 | |||
| 24770cc9f4 | |||
| d07d441e5d | |||
| 457da42970 | |||
| e6047e51c6 | |||
| 456a4e6fb0 |
+121
@@ -0,0 +1,121 @@
|
||||
variables:
|
||||
NUGET_PATH: 'C:\Tools\nuget.exe'
|
||||
MSBUILD_PATH: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe'
|
||||
ASPNET_MERGE_PATH: 'C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools'
|
||||
EXE_RELEASE_FOLDER: 'c:\Projetcs\Compiled\GPW\Release'
|
||||
DEPLOY_FOLDER: 'c:\Projects\Deploy\GPW\Builds'
|
||||
APP_NAME: 'EgtBEAMWALL'
|
||||
APP_NAMEG: 'EgtBEAMWALL'
|
||||
NEW_REL: ''
|
||||
VERS_RD: 'Release'
|
||||
ARCH: 'x86'
|
||||
ARCH64: 'x64'
|
||||
OUTPUT_DIR: ''
|
||||
NET_SHARE: '\\10.74.82.201\Artifacts\EgtProg\EgtBEAMWALL'
|
||||
NET_USER: 'steamw\steamware'
|
||||
|
||||
# helper x mount cartella Artifacts su truenas
|
||||
.ReplicaCompiled: &ReplicaCompiled
|
||||
- |
|
||||
rm -Recurse Z:\$CI_COMMIT_BRANCH\$env:ARCH\*.*
|
||||
rm -Recurse Z:\$CI_COMMIT_BRANCH\$env:ARCH\*.*
|
||||
ROBOCOPY /E $env:APP_NAME\bin\$env:ARCH\$env:VERS_RD Z:\$CI_COMMIT_BRANCH\$env:ARCH /XF *.xml /XF *.pdb
|
||||
ROBOCOPY /E $env:APP_NAME2\bin\$env:ARCH\$env:VERS_RD Z:\$CI_COMMIT_BRANCH\$env:ARCH /XF *.xml /XF *.pdb
|
||||
SLEEP 2
|
||||
net use Z: /delete
|
||||
|
||||
.ReplicaCompileds2: &ReplicaCompileds2
|
||||
- |
|
||||
ROBOCOPY /E $env:APP_NAME\bin\$env:ARCH64\$env:VERS_RD Z:\$CI_COMMIT_BRANCH\$env:ARCH64 /XF *.xml /XF *.pdb
|
||||
ROBOCOPY /E $env:APP_NAME2\bin\$env:ARCH64\$env:VERS_RD Z:\$CI_COMMIT_BRANCH\$env:ARCH64 /XF *.xml /XF *.pdb
|
||||
SLEEP 2
|
||||
net use Z: /delete
|
||||
|
||||
.MakeFolderM: &MakeFolderM
|
||||
- |
|
||||
net use Z: /delete
|
||||
new-item c:\EgtProg\EgtBEAMWALL -itemtype directory
|
||||
net use Z: $env:NET_SHARE
|
||||
|
||||
.nuget-fix: &nuget-fix
|
||||
- |
|
||||
$hasSource = C:\Tools\nuget.exe sources list | find "`"Steamware Nexus`"" /C
|
||||
if ($hasSource -eq 0) {
|
||||
C:\Tools\nuget.exe sources Add -Name "`"Steamware Nexus`"" -Source https://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"$NEXUS_PASSWD`""
|
||||
} else {
|
||||
C:\Tools\nuget.exe sources Update -Name "`"Steamware Nexus`"" -Source https://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"$NEXUS_PASSWD`""
|
||||
}
|
||||
echo $hasSource
|
||||
|
||||
|
||||
# helper creazione hash files
|
||||
.hashBuild: &hashBuild
|
||||
- |
|
||||
$Target = "Releases\" + $CI_COMMIT_BRANCH + "\" + $env:APP_NAME + ".zip"
|
||||
$MD5 = Get-FileHash $Target -Algorithm MD5
|
||||
$SHA1 = Get-FileHash $Target -Algorithm SHA1
|
||||
New-Item $Target".md5"
|
||||
New-Item $Target".sha1"
|
||||
$MD5.Hash | Set-Content -Path $Target".md5"
|
||||
$SHA1.Hash | Set-Content -Path $Target".sha1"
|
||||
|
||||
echo "Created HASH files for $Target"
|
||||
|
||||
.cleanup-dir: &cleanup-dir
|
||||
- |
|
||||
rm $env:APP_NAME\bin\$env:ARCH\$env:VERS_RD\*.xml
|
||||
rm $env:APP_NAME\bin\$env:ARCH\$env:VERS_RD\*.pdb
|
||||
rm $env:APP_NAME\bin\$env:ARCH64\$env:VERS_RD\*.xml
|
||||
rm $env:APP_NAME\bin\$env:ARCH64\$env:VERS_RD\*.pdb
|
||||
|
||||
stages:
|
||||
- build
|
||||
- deploy
|
||||
|
||||
X86:build:
|
||||
stage: build
|
||||
tags:
|
||||
- win
|
||||
only:
|
||||
- main
|
||||
- master
|
||||
- develop
|
||||
variables:
|
||||
APP_NAME: EgtBEAMWALL.Supervisor
|
||||
APP_NAME2: EgtBEAMWALL.ViewerOptimizer
|
||||
VERS_RD: 'Release'
|
||||
ARCH: 'x86'
|
||||
ARCH64: 'x64'
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- '& "$env:NUGET_PATH" restore EgtBEAMWALL.sln -verbosity quiet'
|
||||
- *MakeFolderM
|
||||
script:
|
||||
- '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.vbproj" -target:Build /p:Configuration=$env:VERS_RD /p:Platform="$env:ARCH" /p:OutputPath=bin/$env:ARCH/$env:VERS_RD/ /verbosity:minimal /m'
|
||||
- '& "$env:MSBUILD_PATH" "$env:APP_NAME2\$env:APP_NAME2.vbproj" -target:Build /p:Configuration=$env:VERS_RD /p:Platform="$env:ARCH" /p:OutputPath=bin/$env:ARCH/$env:VERS_RD/ /verbosity:minimal /m'
|
||||
- *ReplicaCompiled
|
||||
|
||||
|
||||
X64:build:
|
||||
stage: build
|
||||
tags:
|
||||
- win
|
||||
only:
|
||||
- main
|
||||
- master
|
||||
- develop
|
||||
variables:
|
||||
APP_NAME: EgtBEAMWALL.Supervisor
|
||||
APP_NAME2: EgtBEAMWALL.ViewerOptimizer
|
||||
VERS_RD: 'Release'
|
||||
ARCH: 'x86'
|
||||
ARCH64: 'x64'
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- '& "$env:NUGET_PATH" restore EgtBEAMWALL.sln -verbosity quiet'
|
||||
- *MakeFolderM
|
||||
script:
|
||||
- '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.vbproj" -target:Build /p:Configuration=$env:VERS_RD /p:Platform="$env:ARCH64" /p:OutputPath=bin/$env:ARCH64/$env:VERS_RD/ /verbosity:minimal /m'
|
||||
- '& "$env:MSBUILD_PATH" "$env:APP_NAME2\$env:APP_NAME2.vbproj" -target:Build /p:Configuration=$env:VERS_RD /p:Platform="$env:ARCH64" /p:OutputPath=bin/$env:ARCH64/$env:VERS_RD/ /verbosity:minimal /m'
|
||||
- *ReplicaCompileds2
|
||||
|
||||
@@ -90,6 +90,16 @@ Public Class BTLFeatureM
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_nPriority As Integer = 0
|
||||
Public Overridable Property nPriority As Integer
|
||||
Get
|
||||
Return m_nPriority
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_nPriority = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' Nome
|
||||
Protected m_sName As String
|
||||
Public ReadOnly Property sName As String
|
||||
@@ -244,10 +254,11 @@ Public Class BTLFeatureM
|
||||
Dim NewBTLFeature As New BTLFeatureM
|
||||
NewBTLFeature.m_ParentPart = ParentPart
|
||||
NewBTLFeature.m_nFeatureId = nFeatureId
|
||||
' leggo gruppo, numero feature e lato
|
||||
' leggo gruppo, numero feature, lato e priorità
|
||||
EgtGetInfo(nFeatureId, BTL_FTR_GRP, NewBTLFeature.m_nSelGRP)
|
||||
EgtGetInfo(nFeatureId, BTL_FTR_PRC, NewBTLFeature.m_nPRC)
|
||||
EgtGetInfo(nFeatureId, BTL_FTR_SIDE, NewBTLFeature.m_nSelSIDE)
|
||||
EgtGetInfo(nFeatureId, BTL_FTR_PRIORITY, NewBTLFeature.m_nPRIORITY)
|
||||
Dim nDO As Integer = 1
|
||||
If EgtGetInfo(nFeatureId, BTL_FTR_DO, nDO) Then
|
||||
NewBTLFeature.m_bDO = (nDO <> 0)
|
||||
@@ -309,6 +320,7 @@ Public Class BTLFeatureM
|
||||
NewBTLFeature.m_nPRC = nPRC
|
||||
NewBTLFeature.m_nSelGRP = nGRP
|
||||
NewBTLFeature.m_nSelSIDE = nSIDE
|
||||
NewBTLFeature.m_nPriority = 0
|
||||
NewBTLFeature.m_bDO = True
|
||||
' crea parametri per questa feature da file ini
|
||||
NewBTLFeature.CreateFeatureParams(NewBTLFeature)
|
||||
@@ -467,7 +479,7 @@ Public Class BTLFeatureM
|
||||
If Param.nType = BTLParamType.DOUBLE_ Or Param.nType = BTLParamType.LENGTH Then
|
||||
Param.SetValue(Param.dDefault)
|
||||
ElseIf Param.nType = BTLParamType.STRING_ Then
|
||||
Param.SetValue("")
|
||||
Param.SetValue(Param.sDefault)
|
||||
ElseIf Param.nType = BTLParamType.COMBO Then
|
||||
Param.nSelValue = Param.dDefault
|
||||
End If
|
||||
@@ -533,6 +545,7 @@ Public Class BTLFeatureM
|
||||
For Each QPar In QBTLParamMList
|
||||
If QPar.bCustom Then EgtSetInfo(nFeatureId, QPar.sName & "A", 1)
|
||||
Next
|
||||
EgtSetInfo( nFeatureId, BTL_FTR_PRIORITY, nPriority)
|
||||
SetFeatureId(nFeatureId)
|
||||
' imposto modificato per copie
|
||||
EgtDuploSetModified(ParentPart.nPartId)
|
||||
|
||||
@@ -129,6 +129,16 @@ Public Class BTLParamM
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_sDefault As String
|
||||
Public Property sDefault As String
|
||||
Get
|
||||
Return m_sDefault
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_sDefault = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' tipo della variabile
|
||||
Protected m_nType As BTLParamType
|
||||
Public ReadOnly Property nType As BTLParamType
|
||||
@@ -136,6 +146,9 @@ Public Class BTLParamM
|
||||
Return m_nType
|
||||
End Get
|
||||
End Property
|
||||
Public Sub SetType(value As BTLParamType)
|
||||
m_nType = value
|
||||
End Sub
|
||||
|
||||
' Feature a cui appartiene il parametro
|
||||
Protected m_ParentFeature As BTLFeatureM
|
||||
@@ -245,16 +258,18 @@ Public Class BTLParamM
|
||||
End Function
|
||||
|
||||
' new per stringhe
|
||||
Public Shared Function CreateBTLParam(ParentFeature As BTLFeatureM, IsP As Boolean, nType As BTLParamType, sParamName As String, sDescription As String)
|
||||
Public Shared Function CreateBTLParam(ParentFeature As BTLFeatureM, IsP As Boolean, nType As BTLParamType, sParamName As String, sDefault As String, sDescription As String)
|
||||
Dim NewBTLParam As New BTLParamM
|
||||
NewBTLParam.StdInit(ParentFeature, IsP, nType, sParamName, sDescription)
|
||||
NewBTLParam.m_sDefault = sDefault
|
||||
Return NewBTLParam
|
||||
End Function
|
||||
|
||||
' new per stringhe (con tipo Beam o Wall)
|
||||
Public Shared Function CreateBTLParam(ParentFeature As BTLFeatureM, IsP As Boolean, nType As BTLParamType, sParamName As String, sDescription As String, sBWType As String)
|
||||
Public Shared Function CreateBTLParam(ParentFeature As BTLFeatureM, IsP As Boolean, nType As BTLParamType, sParamName As String, sDefault As String, sDescription As String, sBWType As String)
|
||||
Dim NewBTLParam As New BTLParamM
|
||||
NewBTLParam.StdInit(ParentFeature, IsP, nType, sParamName, sDescription)
|
||||
NewBTLParam.m_sDefault = sDefault
|
||||
NewBTLParam.m_sBWType = sBWType
|
||||
Return NewBTLParam
|
||||
End Function
|
||||
|
||||
@@ -797,15 +797,15 @@ Public Class BTLPartM
|
||||
Dim vtVersY As New Vector3d
|
||||
sValArray = sValue.Split({","}, StringSplitOptions.RemoveEmptyEntries)
|
||||
If sValArray.Count() >= 9 Then
|
||||
StringToLen(sValArray(0), ptOri.x)
|
||||
StringToLen(sValArray(1), ptOri.y)
|
||||
StringToLen(sValArray(2), ptOri.z)
|
||||
StringToDouble(sValArray(3), vtVersX.x)
|
||||
StringToDouble(sValArray(4), vtVersX.y)
|
||||
StringToDouble(sValArray(5), vtVersX.z)
|
||||
StringToDouble(sValArray(6), vtVersY.x)
|
||||
StringToDouble(sValArray(7), vtVersY.y)
|
||||
StringToDouble(sValArray(8), vtVersY.z)
|
||||
StringToLenAdv(sValArray(0), ptOri.x)
|
||||
StringToLenAdv(sValArray(1), ptOri.y)
|
||||
StringToLenAdv(sValArray(2), ptOri.z)
|
||||
StringToDoubleAdv(sValArray(3), vtVersX.x)
|
||||
StringToDoubleAdv(sValArray(4), vtVersX.y)
|
||||
StringToDoubleAdv(sValArray(5), vtVersX.z)
|
||||
StringToDoubleAdv(sValArray(6), vtVersY.x)
|
||||
StringToDoubleAdv(sValArray(7), vtVersY.y)
|
||||
StringToDoubleAdv(sValArray(8), vtVersY.z)
|
||||
NewBTLPart.m_refTransf.ChangeOrigin(ptOri)
|
||||
NewBTLPart.m_refTransf.Setup(ptOri, ptOri + vtVersX, ptOri + vtVersY)
|
||||
End If
|
||||
@@ -813,12 +813,12 @@ Public Class BTLPartM
|
||||
ind = ind + 1
|
||||
End While
|
||||
EgtGetInfo(nPartId, BTL_PRT_CAMBER, sValue)
|
||||
sValArray = sValue.Split(New String() {": ", " P"}, StringSplitOptions.RemoveEmptyEntries)
|
||||
If sValArray.Count() >= 5 Then
|
||||
StringToLen(sValArray(3), NewBTLPart.m_dCamberLen1)
|
||||
StringToLen(sValArray(5), NewBTLPart.m_dCamberLen2)
|
||||
StringToLen(sValArray(7), NewBTLPart.m_dCamberLen3)
|
||||
StringToLen(sValArray(9), NewBTLPart.m_dCamberCross3)
|
||||
sValArray = sValue.Split(New String() {":", "P"}, StringSplitOptions.RemoveEmptyEntries)
|
||||
If sValArray.Count() >= 10 Then
|
||||
StringToLenAdv(sValArray(3), NewBTLPart.m_dCamberLen1)
|
||||
StringToLenAdv(sValArray(5), NewBTLPart.m_dCamberLen2)
|
||||
StringToLenAdv(sValArray(7), NewBTLPart.m_dCamberLen3)
|
||||
StringToLenAdv(sValArray(9), NewBTLPart.m_dCamberCross3)
|
||||
End If
|
||||
Dim pFrom As Integer = sValue.IndexOf("SIDE: ") + "SIDE: ".Length
|
||||
Dim pTo As Integer = sValue.LastIndexOf(" P01")
|
||||
@@ -828,12 +828,12 @@ Public Class BTLPartM
|
||||
End If
|
||||
|
||||
EgtGetInfo(nPartId, BTL_PRT_PARTOFFSET, sValue)
|
||||
sValArray = sValue.Split(New String() {": ", " P"}, StringSplitOptions.RemoveEmptyEntries)
|
||||
If sValArray.Count() >= 5 Then
|
||||
StringToLen(sValArray(3), NewBTLPart.m_dPartOffsetSide1)
|
||||
StringToLen(sValArray(5), NewBTLPart.m_dPartOffsetSide2)
|
||||
StringToLen(sValArray(7), NewBTLPart.m_dPartOffsetSide3)
|
||||
StringToLen(sValArray(9), NewBTLPart.m_dPartOffsetSide4)
|
||||
sValArray = sValue.Split(New String() {":", "P"}, StringSplitOptions.RemoveEmptyEntries)
|
||||
If sValArray.Count() >= 10 Then
|
||||
StringToLenAdv(sValArray(3), NewBTLPart.m_dPartOffsetSide1)
|
||||
StringToLenAdv(sValArray(5), NewBTLPart.m_dPartOffsetSide2)
|
||||
StringToLenAdv(sValArray(7), NewBTLPart.m_dPartOffsetSide3)
|
||||
StringToLenAdv(sValArray(9), NewBTLPart.m_dPartOffsetSide4)
|
||||
End If
|
||||
pFrom = sValue.IndexOf("P04: ") + "P04: ".Length
|
||||
pTo = sValue.LastIndexOf(" P11")
|
||||
@@ -883,9 +883,9 @@ Public Class BTLPartM
|
||||
NewBTLPart.m_refGrainDir = New Vector3d
|
||||
sValArray = sValue.Split(New String() {",", ";"}, StringSplitOptions.RemoveEmptyEntries)
|
||||
If sValArray.Count() >= 4 Then
|
||||
StringToDouble(sValArray(0), NewBTLPart.m_refGrainDir.x)
|
||||
StringToDouble(sValArray(1), NewBTLPart.m_refGrainDir.y)
|
||||
StringToDouble(sValArray(2), NewBTLPart.m_refGrainDir.z)
|
||||
StringToDoubleAdv(sValArray(0), NewBTLPart.m_refGrainDir.x)
|
||||
StringToDoubleAdv(sValArray(1), NewBTLPart.m_refGrainDir.y)
|
||||
StringToDoubleAdv(sValArray(2), NewBTLPart.m_refGrainDir.z)
|
||||
NewBTLPart.m_bGRAINDIRALIGN = (CInt(sValArray(3)) = 1)
|
||||
End If
|
||||
|
||||
@@ -1044,15 +1044,15 @@ Public Class BTLPartM
|
||||
' Dim vtVersY As New Vector3d
|
||||
' sValArray = sValue.Split({","}, StringSplitOptions.RemoveEmptyEntries)
|
||||
' If sValArray.Count() >= 9 Then
|
||||
' StringToLen(sValArray(0), ptOri.x)
|
||||
' StringToLen(sValArray(1), ptOri.y)
|
||||
' StringToLen(sValArray(2), ptOri.z)
|
||||
' StringToDouble(sValArray(3), vtVersX.x)
|
||||
' StringToDouble(sValArray(4), vtVersX.y)
|
||||
' StringToDouble(sValArray(5), vtVersX.z)
|
||||
' StringToDouble(sValArray(6), vtVersY.x)
|
||||
' StringToDouble(sValArray(7), vtVersY.y)
|
||||
' StringToDouble(sValArray(8), vtVersY.z)
|
||||
' StringToLenAdv(sValArray(0), ptOri.x)
|
||||
' StringToLenAdv(sValArray(1), ptOri.y)
|
||||
' StringToLenAdv(sValArray(2), ptOri.z)
|
||||
' StringToDoubleAdv(sValArray(3), vtVersX.x)
|
||||
' StringToDoubleAdv(sValArray(4), vtVersX.y)
|
||||
' StringToDoubleAdv(sValArray(5), vtVersX.z)
|
||||
' StringToDoubleAdv(sValArray(6), vtVersY.x)
|
||||
' StringToDoubleAdv(sValArray(7), vtVersY.y)
|
||||
' StringToDoubleAdv(sValArray(8), vtVersY.z)
|
||||
' m_refTransf.ChangeOrigin(ptOri)
|
||||
' m_refTransf.Setup(ptOri, ptOri + vtVersX, ptOri + vtVersY)
|
||||
' End If
|
||||
@@ -1063,10 +1063,10 @@ Public Class BTLPartM
|
||||
' EgtGetInfo(nPartId, BTL_PRT_CAMBER, sValue)
|
||||
' sValArray = sValue.Split(New String() {": ", " P"}, StringSplitOptions.RemoveEmptyEntries)
|
||||
' If sValArray.Count() >= 5 Then
|
||||
' StringToLen(sValArray(3), m_dCamberLen1)
|
||||
' StringToLen(sValArray(5), m_dCamberLen2)
|
||||
' StringToLen(sValArray(7), m_dCamberLen3)
|
||||
' StringToLen(sValArray(9), m_dCamberCross3)
|
||||
' StringToLenAdv(sValArray(3), m_dCamberLen1)
|
||||
' StringToLenAdv(sValArray(5), m_dCamberLen2)
|
||||
' StringToLenAdv(sValArray(7), m_dCamberLen3)
|
||||
' StringToLenAdv(sValArray(9), m_dCamberCross3)
|
||||
' End If
|
||||
' Dim pFrom As Integer = sValue.IndexOf("SIDE: ") + "SIDE: ".Length
|
||||
' Dim pTo As Integer = sValue.LastIndexOf(" P01")
|
||||
@@ -1078,10 +1078,10 @@ Public Class BTLPartM
|
||||
' EgtGetInfo(nPartId, BTL_PRT_PARTOFFSET, sValue)
|
||||
' sValArray = sValue.Split(New String() {": ", " P"}, StringSplitOptions.RemoveEmptyEntries)
|
||||
' If sValArray.Count() >= 5 Then
|
||||
' StringToLen(sValArray(3), m_dPartOffsetSide1)
|
||||
' StringToLen(sValArray(5), m_dPartOffsetSide2)
|
||||
' StringToLen(sValArray(7), m_dPartOffsetSide3)
|
||||
' StringToLen(sValArray(9), m_dPartOffsetSide4)
|
||||
' StringToLenAdv(sValArray(3), m_dPartOffsetSide1)
|
||||
' StringToLenAdv(sValArray(5), m_dPartOffsetSide2)
|
||||
' StringToLenAdv(sValArray(7), m_dPartOffsetSide3)
|
||||
' StringToLenAdv(sValArray(9), m_dPartOffsetSide4)
|
||||
' End If
|
||||
' pFrom = sValue.IndexOf("P04: ") + "P04: ".Length
|
||||
' pTo = sValue.LastIndexOf(" P11")
|
||||
@@ -1105,9 +1105,9 @@ Public Class BTLPartM
|
||||
' m_refGrainDir = New Vector3d
|
||||
' sValArray = sValue.Split(New String() {",", ";"}, StringSplitOptions.RemoveEmptyEntries)
|
||||
' If sValArray.Count() >= 4 Then
|
||||
' StringToDouble(sValArray(0), m_refGrainDir.x)
|
||||
' StringToDouble(sValArray(1), m_refGrainDir.y)
|
||||
' StringToDouble(sValArray(2), m_refGrainDir.z)
|
||||
' StringToDoubleAdv(sValArray(0), m_refGrainDir.x)
|
||||
' StringToDoubleAdv(sValArray(1), m_refGrainDir.y)
|
||||
' StringToDoubleAdv(sValArray(2), m_refGrainDir.z)
|
||||
' m_bGRAINDIRALIGN = (CInt(sValArray(3)) = 1)
|
||||
' End If
|
||||
|
||||
@@ -1210,7 +1210,7 @@ Public Class BTLPartM
|
||||
Return New List(Of BTLFeatureM)(m_BTLFeatureMList)
|
||||
End Function
|
||||
|
||||
Public Function Rotation(IsPositive As Boolean, SelectedMachineType As MachineType, Optional dAng As Double = 90) As Boolean
|
||||
Public Function Rotation(IsPositive As Boolean, SelectedMachineType As MachineType, Optional bRedraw As Boolean = True, Optional dAng As Double = 90) As Boolean
|
||||
' recupero il box del pezzo
|
||||
Dim nLs As Integer = EgtGetFirstNameInGroup(nPartId, "Box")
|
||||
Dim b3Solid As New BBox3d
|
||||
@@ -1249,7 +1249,7 @@ Public Class BTLPartM
|
||||
' ripristino inversione
|
||||
Inversion(SelectedMachineType)
|
||||
End If
|
||||
EgtDraw()
|
||||
If bRedraw Then EgtDraw()
|
||||
Return bOk
|
||||
End Function
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@ Public Module CalcIntegration
|
||||
Public Event Calc_ProcessResult As EventHandler(Of CalcResultEventArgs)
|
||||
Public Event Calc_ProcessEnd As EventHandler(Of CalcProcessEndEventArgs)
|
||||
|
||||
Private m_bIsSupervisor As Boolean = False
|
||||
|
||||
Public Enum CmdTypes As Integer
|
||||
GENERATE = 0
|
||||
MODIFY = 1
|
||||
@@ -38,8 +40,9 @@ Public Module CalcIntegration
|
||||
|
||||
Delegate Sub CallbackDlg(dProgress As Double, sProgress As String, ByRef bCancel As Boolean)
|
||||
|
||||
Public Sub Run(vBar As Bar(), sProjDirPath As String, callback As CallbackDlg)
|
||||
Public Sub Run(vBar As Bar(), sProjDirPath As String, callback As CallbackDlg, Optional bIsSupervisor As Boolean = False)
|
||||
_thread = New Thread(Sub()
|
||||
m_bIsSupervisor = bIsSupervisor
|
||||
DoJob(vBar, sProjDirPath, callback)
|
||||
End Sub)
|
||||
_thread.Start()
|
||||
@@ -62,7 +65,7 @@ Public Module CalcIntegration
|
||||
End If
|
||||
ElseIf Bar.nProgramPage = ProjectType.PROD Then
|
||||
If Bar.nGlobState = CalcStates.NOTCALCULATED Then
|
||||
Bar.sBarPath = CreateNewProjectFromMachGroup(Bar.nBarId, sProjDirPath)
|
||||
Bar.sBarPath = CreateNewProjectFromMachGroup(Bar.nBarId, sProjDirPath, Bar.nGlobState)
|
||||
Else
|
||||
Dim sMachGroupName As String = ""
|
||||
EgtGetMachGroupName(Bar.nBarId, sMachGroupName)
|
||||
@@ -75,7 +78,7 @@ Public Module CalcIntegration
|
||||
If Bar.nProgramPage = ProjectType.PROJ Then
|
||||
Bar.sBarPath = CreateNewProjectFromPart(Bar.nBarId, sProjDirPath)
|
||||
ElseIf Bar.nProgramPage = ProjectType.PROD Then
|
||||
Bar.sBarPath = CreateNewProjectFromMachGroup(Bar.nBarId, sProjDirPath)
|
||||
Bar.sBarPath = CreateNewProjectFromMachGroup(Bar.nBarId, sProjDirPath, Bar.nGlobState)
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
@@ -352,27 +355,38 @@ Public Module CalcIntegration
|
||||
Return If(bOk, sPartFilePath, String.Empty)
|
||||
End Function
|
||||
|
||||
Private Function CreateNewProjectFromMachGroup(nMachGroupId As Integer, sProjDirPath As String) As String
|
||||
|
||||
' Aggiorno identificativi per segnalazione errori
|
||||
Dim nOldMachGroup As Integer = EgtGetCurrMachGroup()
|
||||
If nMachGroupId <> nOldMachGroup Then EgtSetCurrMachGroup(nMachGroupId)
|
||||
Dim nRawId As Integer = EgtGetFirstRawPart()
|
||||
While nRawId <> GDB_ID.NULL
|
||||
If EgtVerifyRawPartPhase(nRawId, 1) Then
|
||||
Dim nPartId As Integer = EgtGetFirstPartInRawPart(nRawId)
|
||||
While nPartId <> GDB_ID.NULL
|
||||
UpdateCutIdAndTaskId(nPartId)
|
||||
nPartId = EgtGetNextPartInRawPart(nPartId)
|
||||
End While
|
||||
Private Function CreateNewProjectFromMachGroup(nMachGroupId As Integer, sProjDirPath As String, nGlobState As Integer) As String
|
||||
' aggiorno cutid e taskid solo fuori dal supervisore o se pezzo ricalcolato
|
||||
If Not m_bIsSupervisor OrElse nGlobState = CalcStates.NOTCALCULATED Then
|
||||
Dim DisableMgr As DisableModifiedMgr = Nothing
|
||||
If m_bIsSupervisor Then
|
||||
' Disabilito segnalazione modificato
|
||||
DisableMgr = New DisableModifiedMgr
|
||||
End If
|
||||
nRawId = EgtGetNextRawPart(nRawId)
|
||||
End While
|
||||
If nMachGroupId <> nOldMachGroup Then
|
||||
If nOldMachGroup <> GDB_ID.NULL Then
|
||||
EgtSetCurrMachGroup(nOldMachGroup)
|
||||
Else
|
||||
EgtResetCurrMachGroup()
|
||||
' Aggiorno identificativi per segnalazione errori
|
||||
Dim nOldMachGroup As Integer = EgtGetCurrMachGroup()
|
||||
If nMachGroupId <> nOldMachGroup Then EgtSetCurrMachGroup(nMachGroupId)
|
||||
Dim nRawId As Integer = EgtGetFirstRawPart()
|
||||
While nRawId <> GDB_ID.NULL
|
||||
If EgtVerifyRawPartPhase(nRawId, 1) Then
|
||||
Dim nPartId As Integer = EgtGetFirstPartInRawPart(nRawId)
|
||||
While nPartId <> GDB_ID.NULL
|
||||
UpdateCutIdAndTaskId(nPartId)
|
||||
nPartId = EgtGetNextPartInRawPart(nPartId)
|
||||
End While
|
||||
End If
|
||||
nRawId = EgtGetNextRawPart(nRawId)
|
||||
End While
|
||||
If nMachGroupId <> nOldMachGroup Then
|
||||
If nOldMachGroup <> GDB_ID.NULL Then
|
||||
EgtSetCurrMachGroup(nOldMachGroup)
|
||||
Else
|
||||
EgtResetCurrMachGroup()
|
||||
End If
|
||||
End If
|
||||
If m_bIsSupervisor Then
|
||||
' Ripristino stato segnalazione modifica
|
||||
DisableMgr.ReEnable()
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
@@ -175,8 +175,10 @@
|
||||
Public Const BTL_PRT_REFSIDE = "REFERENCESIDE"
|
||||
Public Const BTL_PRT_ALIGNMENT = "ALIGNMENT"
|
||||
Public Const BTL_PRT_MATERIALTYPE = "MATERIALTYPE"
|
||||
Public Const BTL_PRT_DESCRIPTION = "NAM"
|
||||
|
||||
' parametri generici
|
||||
Public Const BTL_GEN_BTLPATH = "BTL"
|
||||
Public Const BTL_GEN_PROJNUM = "PROJECTNUMBER"
|
||||
Public Const BTL_GEN_PROJNAME = "PROJECTNAME"
|
||||
Public Const BTL_GEN_PROJPART = "PROJECTPART"
|
||||
@@ -204,6 +206,7 @@
|
||||
Public Const BTL_FTR_PRC As String = "PRC"
|
||||
Public Const BTL_FTR_DO As String = "DO"
|
||||
Public Const BTL_FTR_SIDE As String = "SIDE"
|
||||
Public Const BTL_FTR_PRIORITY As String = "PRIORITY"
|
||||
Public Const BTL_FTR_NAME As String = "NAME"
|
||||
Public Const BTL_FTR_DES As String = "DES"
|
||||
Public Const BTL_FTR_PRID As String = "PRID"
|
||||
@@ -251,6 +254,7 @@
|
||||
Public Const MGR_RPT_PANELLEN As String = "PANELLEN"
|
||||
Public Const MGR_RPT_PANELWIDTH As String = "PANELWIDTH"
|
||||
Public Const MGR_RPT_PANELHEIGHT As String = "PANELHEIGHT"
|
||||
Public Const MGR_RPT_PANELPOSZ As String = "PANELPOSZ"
|
||||
Public Const MGR_RPT_PART As String = "PART"
|
||||
|
||||
' parametri P per comunicazione con la macchina
|
||||
@@ -298,5 +302,10 @@
|
||||
Public Const BTLFILENAME As String = "BTLFILENAME"
|
||||
Public Const EXP_PART As String = "ImportExport"
|
||||
Public Const EXP_MACHINE As String = "Machine"
|
||||
' parametro che indica se il progetto e' stato appena importato e quindi bisogna riverificare i MachGroup
|
||||
Public Const IMP_VERIFYMACHGROUP As String = "VerifyMachGroup"
|
||||
|
||||
' parametri modifica percorsi free contour
|
||||
Public Const PATH_SIDEANGLAYER As String = "SideAngLayer"
|
||||
|
||||
End Module
|
||||
|
||||
@@ -6,11 +6,16 @@
|
||||
Public Const COL_STARTCUT As String = "colSTARTCUT"
|
||||
Public Const COL_W As String = "colW"
|
||||
Public Const COL_L As String = "colL"
|
||||
Public Const COL_POSZ As String = "colPOSZ"
|
||||
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"
|
||||
Public Const COL_REDO As String = "colREDO"
|
||||
Public Const COL_TYPE As String = "colTYPE"
|
||||
Public Const COL_DESCRIPTION As String = "colDESCRIPTION"
|
||||
Public Const COL_SUPERVISORID As String = "colSUPERVISORID"
|
||||
Public Const COL_PRIORITY As String = "colPRIORITY"
|
||||
|
||||
End Module
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
Public Const S_SECTXMATLIST_WALL As String = "DG_SectXMatList_WALL"
|
||||
Public Const S_VARIABLESLIST As String = "DG_VariablesList"
|
||||
Public Const S_MDICOMMANDS As String = "DG_MDICommands"
|
||||
Public Const S_MACHINELOG As String = "DG_MachineLog"
|
||||
Public Const S_UPDATEBTLPARTLIST As String = "DG_UpdateBTLPartList"
|
||||
|
||||
Public Const K_LOCKTABLE As String = "LockTable"
|
||||
|
||||
@@ -21,6 +21,7 @@ Public Module ConstGen
|
||||
' File con dati di licenza
|
||||
Public Const LIC_FILE_NAME As String = "EgtBEAMWALL.lic"
|
||||
Public Const S_LICENCE As String = "Licence"
|
||||
Public Const K_LOCKID As String = "LockId"
|
||||
Public Const K_KEY As String = "Key"
|
||||
Public Const K_NESTKEY As String = "NestKey"
|
||||
|
||||
@@ -41,6 +42,7 @@ Public Module ConstGen
|
||||
NESTING_AUTO = 4
|
||||
SUPERVISOR = 8
|
||||
NETWORK = 16
|
||||
ANY_DB = 32
|
||||
End Enum
|
||||
|
||||
' File di log generale
|
||||
|
||||
@@ -20,6 +20,7 @@ Public Module ConstIni
|
||||
'Public Const K_LICENCE As String = "Licence"
|
||||
'Public Const K_USERLEVEL As String = "UserLevel"
|
||||
'Public Const K_MAXINST As String = "MaxInstances"
|
||||
Public Const K_NETKEY As String = "NetKey"
|
||||
Public Const K_MAXCAMINST As String = "MaxCamInstances"
|
||||
Public Const K_VIEWOPTIM_INSTANCES As String = "ViewOptimInstances"
|
||||
Public Const K_SUPERVISOR_INSTANCES As String = "SupervisorInstances"
|
||||
@@ -27,6 +28,8 @@ Public Module ConstIni
|
||||
'Public Const K_MESSAGESDIR As String = "MessagesDir"
|
||||
'Public Const K_MESSAGES As String = "Messages"
|
||||
'Public Const K_WINPLACE As String = "WinPlace"
|
||||
Public Const K_VIEWOPTIMWINPLACE As String = "ViewOptimWinPlace"
|
||||
Public Const K_SUPERVISORWINPLACE As String = "SupervisorWinPlace"
|
||||
'Public Const K_LASTPROJ As String = "LastProj"
|
||||
'Public Const K_AUTOLOADLASTPROJ As String = "AutoLoadLastProj"
|
||||
Public Const K_LASTIMPDIR As String = "LastImpDir"
|
||||
@@ -35,11 +38,14 @@ Public Module ConstIni
|
||||
Public Const K_PROJSINDEX As String = "ProjsIndex"
|
||||
Public Const K_PRODSINDEX As String = "ProdsIndex"
|
||||
'Public Const K_SUPPORT As String = "Support"
|
||||
Public Const K_WAREHOUSE As String = "Warehouse"
|
||||
Public Const K_DBADDRESS As String = "DbAddress"
|
||||
Public Const K_DBMASTERKEY As String = "DbMasterKey"
|
||||
Public Const K_SHAREDFOLDER As String = "SharedFolder"
|
||||
Public Const K_UPDATEBTL As String = "UpdateBtl"
|
||||
Public Const K_DATADIR As String = "DataDir"
|
||||
Public Const K_ENABLEEDIT As String = "EnableEdit"
|
||||
Public Const K_FASTPRODUCE As String = "FastProduce"
|
||||
Public Const K_ADDPROJ As String = "AddProj"
|
||||
|
||||
'Public Const S_LANGUAGES As String = "Languages"
|
||||
'Public Const K_LANGUAGE As String = "Language"
|
||||
@@ -90,6 +96,7 @@ Public Module ConstIni
|
||||
Public Const S_IMPORT As String = "Import"
|
||||
Public Const K_BTLFLAG As String = "BtlFlag"
|
||||
Public Const K_WALLBTLFLAG As String = "WallBtlFlag"
|
||||
Public Const K_WALLOPPOSITESIDENESTING As String = "WallOppositeSideNesting"
|
||||
|
||||
'Public Const S_MACH As String = "Mach"
|
||||
'Public Const K_MACHINESDIR As String = "MachinesDir"
|
||||
@@ -97,6 +104,8 @@ Public Module ConstIni
|
||||
'Public Const K_CURRMACH As String = "CurrMach"
|
||||
Public Const K_SUPERVISORMACH As String = "SupervisorMach"
|
||||
Public Const K_PASSWORD As String = "Password"
|
||||
Public Const K_CHANGEMACH As String = "ChangeMach"
|
||||
Public Const K_EXPORTBWE As String = "ExpBwe"
|
||||
|
||||
'Public Const S_SIMUL As String = "Simul"
|
||||
'Public Const K_SLIDERX As String = "SliderX"
|
||||
@@ -111,6 +120,13 @@ Public Module ConstIni
|
||||
Public Const K_WALLBASEDIR As String = "BaseDir"
|
||||
Public Const K_WALLBWEEXEC As String = "BweExec"
|
||||
|
||||
Public Const S_MACHINELOGFILTER As String = "MachineLogFilters"
|
||||
Public Const K_PARTEVENTTYPE As String = "PartEventType"
|
||||
Public Const K_ENTITYTYPE As String = "EntityType"
|
||||
Public Const K_DAYTYPE As String = "DayType"
|
||||
Public Const K_STARTDATE As String = "StartDate"
|
||||
Public Const K_ENDDATE As String = "EndDate"
|
||||
|
||||
'Public Const S_NEST As String = "Nest"
|
||||
Public Const K_NESTEXEC As String = "NestExec"
|
||||
Public Const K_FLIPROT As String = "FlipRot"
|
||||
@@ -139,4 +155,8 @@ Public Module ConstIni
|
||||
Public Const S_BEAM_LIST As String = "Beam_List"
|
||||
Public Const S_WALL_LIST As String = "Wall_List"
|
||||
|
||||
Public Const S_WAREHOUSE As String = "Warehouse"
|
||||
Public Const K_TYPE As String = "Type"
|
||||
Public Const K_DEFAULTQUANTITY As String = "DefaultQuantity"
|
||||
|
||||
End Module
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
Public Module ConstMachIni
|
||||
|
||||
Public Const MACH_INI_FILE_NAME As String = "MachData.ini"
|
||||
Public Const GETBEAMDATA_FILE_NAME As String = "GetBeamData.lua"
|
||||
Public Const GETWALLDATA_FILE_NAME As String = "GetWallData.lua"
|
||||
Public Const GETTS3DATA_FILE_NAME As String = "GetTs3Data.lua"
|
||||
|
||||
Public Const K_NCTYPE As String = "NCType"
|
||||
Public Const K_CONNECTIONSTRING As String = "ConnectionString"
|
||||
|
||||
Public Const S_CHANNELS As String = "Channels"
|
||||
|
||||
|
||||
@@ -47,13 +47,11 @@
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="EgtUILib, Version=2.3.7.1, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\EgtProg\Dll32\EgtUILib.dll</HintPath>
|
||||
<Reference Include="EgtUILib">
|
||||
<HintPath>..\ExtLibs\EgtUILib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EgtWPFLib5, Version=2.3.4.3, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\EgtProg\Dll32\EgtWPFLib5.dll</HintPath>
|
||||
<Reference Include="EgtWPFLib5">
|
||||
<HintPath>..\ExtLibs\EgtWPFLib5.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
|
||||
@@ -28,7 +28,7 @@ Public Module DataGridColumnsIniFile
|
||||
Dim bIsReadOnly As Boolean = sColumnParams(4).Equals("1")
|
||||
Dim Width As Double
|
||||
Dim WidthType As DataGridLengthUnitType
|
||||
StringToDouble(sColumnParams(5), Width)
|
||||
StringToDoubleAdv(sColumnParams(5), Width)
|
||||
Integer.TryParse(sColumnParams(6), WidthType)
|
||||
Dim bVisible As Boolean = sColumnParams(7).Equals("1")
|
||||
Dim bCanUserEditVisible As Boolean = sColumnParams(8).Equals("1")
|
||||
@@ -65,7 +65,7 @@ Public Module DataGridColumnsIniFile
|
||||
Dim bIsReadOnly As Boolean = sColumnParams(4).Equals("1")
|
||||
Dim Width As Double
|
||||
Dim WidthType As DataGridLengthUnitType
|
||||
StringToDouble(sColumnParams(5), Width)
|
||||
StringToDoubleAdv(sColumnParams(5), Width)
|
||||
Integer.TryParse(sColumnParams(6), WidthType)
|
||||
Dim bVisible As Boolean = sColumnParams(7).Equals("1")
|
||||
Dim bCanUserEditVisible As Boolean = sColumnParams(8).Equals("1")
|
||||
|
||||
@@ -424,6 +424,7 @@ Public Class EgtDataGridColumn
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property m_OrigIsReadOnly As Boolean = True
|
||||
Private Property m_IsReadOnly As Boolean = True
|
||||
Public Property IsReadOnly As Boolean
|
||||
Get
|
||||
@@ -561,6 +562,7 @@ Public Class EgtDataGridColumn
|
||||
m_CanUserReorder = bCanUserReorder
|
||||
m_CanUserResize = bCanUserResize
|
||||
m_CanUserSort = bCanUserSort
|
||||
m_OrigIsReadOnly = bIsReadOnly
|
||||
m_IsReadOnly = bIsReadOnly
|
||||
m_Width = Width
|
||||
m_Visible = bVisible
|
||||
@@ -588,7 +590,7 @@ Public Class EgtDataGridColumn
|
||||
Public Function SaveDataGridColumn() As Boolean
|
||||
Dim bOk As Boolean
|
||||
Dim sColumnParams = String.Empty
|
||||
sColumnParams = Name & "," & If(CanUserReorder, 1, 0) & "," & If(CanUserResize, 1, 0) & "," & If(CanUserSort, 1, 0) & "," & If(IsReadOnly, 1, 0) & "," & DoubleToString(Width.Value, 6) & "," & Width.UnitType & "," & If(Visible, 1, 0) & "," & If(CanUserEditVisible, 1, 0) & "," & CInt(SortDirection)
|
||||
sColumnParams = Name & "," & If(CanUserReorder, 1, 0) & "," & If(CanUserResize, 1, 0) & "," & If(CanUserSort, 1, 0) & "," & If(m_OrigIsReadOnly, 1, 0) & "," & DoubleToString(Width.Value, 6) & "," & Width.UnitType & "," & If(Visible, 1, 0) & "," & If(CanUserEditVisible, 1, 0) & "," & CInt(SortDirection)
|
||||
bOk = WriteColumnPrivateProfileParam(ParentDataGridName, DisplayIndex, sColumnParams)
|
||||
Return bOk
|
||||
End Function
|
||||
|
||||
@@ -94,8 +94,6 @@ Public Class NewMachGroupPanelVM
|
||||
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
|
||||
|
||||
@@ -19,14 +19,14 @@ Public Module LoadingWndHelper
|
||||
End Enum
|
||||
|
||||
Dim m_MainWindow As Windows.Window
|
||||
Public Function SetMainWindow(MainWindow As Windows.Window)
|
||||
Public Sub SetMainWindow(MainWindow As Windows.Window)
|
||||
m_MainWindow = MainWindow
|
||||
End Function
|
||||
End Sub
|
||||
|
||||
Private m_bMainWindow_IsActive As Boolean = True
|
||||
Public Function SetMainWindowIsActive(IsActive As Boolean)
|
||||
Public Sub SetMainWindowIsActive(IsActive As Boolean)
|
||||
m_bMainWindow_IsActive = IsActive
|
||||
End Function
|
||||
End Sub
|
||||
|
||||
Delegate Sub CallbackLoadingDlg(ByRef CurrStep As Integer, ByRef StepText As String, ByRef nProgress As Integer, ByRef nNextProgress As Integer, ByRef MainWindow_IsActive As Boolean, ByRef bClose As Boolean)
|
||||
|
||||
@@ -52,7 +52,7 @@ Public Module LoadingWndHelper
|
||||
Dim Left As Double = m_MainWindow.Left + (m_MainWindow.Width / 2) - 150
|
||||
Dim WindowStartupLocation As Windows.WindowStartupLocation = Windows.WindowStartupLocation.Manual
|
||||
If m_MainWindow.WindowState = Windows.WindowState.Maximized Then
|
||||
WindowStartupLocation = Windows.WindowStartupLocation.CenterScreen
|
||||
WindowStartupLocation = Windows.WindowStartupLocation.CenterOwner
|
||||
End If
|
||||
m_thread = New Thread(Sub()
|
||||
m_LoadingWndVM = New Core.LoadingWndVM(nSteps, TotText, AddressOf LoadingCallback)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
Imports System.Windows
|
||||
Imports System.Windows.Input
|
||||
|
||||
Public Class LoadingWndV
|
||||
|
||||
@@ -25,4 +26,11 @@ Public Class LoadingWndV
|
||||
m_LoadingWndVM.StartFunction()
|
||||
End Sub
|
||||
|
||||
Private Sub ToolsDbView_Closing(sender As Object, e As ComponentModel.CancelEventArgs) Handles Me.Closing
|
||||
If (Keyboard.Modifiers And ModifierKeys.Alt) = ModifierKeys.Alt OrElse Keyboard.IsKeyDown(Key.F4) Then
|
||||
e.Cancel = True
|
||||
Return
|
||||
End If
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
@@ -149,6 +149,16 @@ Public Class MyMachGroupM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_dPosZ As Double = 0
|
||||
Public Property dPosZ As Double
|
||||
Get
|
||||
Return m_dPosZ
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_dPosZ = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#End Region ' Wall
|
||||
|
||||
#Region "Calc"
|
||||
@@ -300,17 +310,18 @@ Public Class MyMachGroupM
|
||||
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_dW * NewMachGroupM.m_dH
|
||||
NewMachGroupM.m_PartMList = LoadParts(NewMachGroupM)
|
||||
For Each Part In NewMachGroupM.m_PartMList
|
||||
Part.UpdateOffset()
|
||||
NewMachGroupM.m_dMatForPart += Part.dVolume
|
||||
NewMachGroupM.m_dTotMat += Part.dL + Part.dOffset
|
||||
NewMachGroupM.m_dMatForPart += Part.dL
|
||||
Next
|
||||
Else
|
||||
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)
|
||||
EgtGetInfo(NewMachGroupM.m_Id, MGR_RPT_PANELPOSZ, NewMachGroupM.m_dPosZ)
|
||||
NewMachGroupM.m_dTotMat = NewMachGroupM.m_dL * NewMachGroupM.m_dW * NewMachGroupM.m_dH
|
||||
NewMachGroupM.m_PartMList = LoadParts(NewMachGroupM)
|
||||
For Each Part In NewMachGroupM.m_PartMList
|
||||
@@ -336,13 +347,14 @@ Public Class MyMachGroupM
|
||||
NewMachGroupM.m_PartMList = LoadParts(NewMachGroupM)
|
||||
For Each Part In NewMachGroupM.m_PartMList
|
||||
Part.UpdateOffset()
|
||||
NewMachGroupM.m_dMatForPart += Part.dVolume
|
||||
NewMachGroupM.m_dMatForPart += Part.dL + Part.dOffset
|
||||
Next
|
||||
Else
|
||||
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)
|
||||
EgtGetInfo(NewMachGroupM.m_Id, MGR_RPT_PANELPOSZ, NewMachGroupM.m_dPosZ)
|
||||
NewMachGroupM.m_dTotMat = NewMachGroupM.m_dL * NewMachGroupM.m_dW
|
||||
NewMachGroupM.m_PartMList = LoadParts(NewMachGroupM)
|
||||
For Each Part In NewMachGroupM.m_PartMList
|
||||
@@ -408,7 +420,7 @@ Public Class MyMachGroupM
|
||||
EgtGetInfo(Id, MGR_RPT_PART & 1, sInfo)
|
||||
If Not String.IsNullOrWhiteSpace(sInfo) Then
|
||||
sSplitInfo = sInfo.Split(","c)
|
||||
StringToDouble(sSplitInfo(1), m_dStartCut)
|
||||
StringToDoubleAdv(sSplitInfo(1), m_dStartCut)
|
||||
Else
|
||||
m_dStartCut = 0
|
||||
End If
|
||||
|
||||
@@ -338,7 +338,8 @@ Public Class MyMachGroupPanelM
|
||||
End Class
|
||||
|
||||
' funzione che cancella tutti i pezzi segnati da eliminare
|
||||
Public Shared Sub DeleteDuplo()
|
||||
Public Shared Function DeleteDuplo() As List(Of Integer)
|
||||
Dim ToRedrawMachGroupList As New List(Of Integer)
|
||||
' 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()
|
||||
@@ -356,16 +357,37 @@ Public Class MyMachGroupPanelM
|
||||
Dim nRawPartId As Integer = DuploGetRawPart(nDuploId)
|
||||
' recupero gruppo di lavorazione
|
||||
Dim nMachGroupId As Integer = EgtGetParent(EgtGetParent(EgtGetParent(nRawPartId)))
|
||||
|
||||
' elimino eventuali successive info pezzi di troppo
|
||||
Dim nIndex As Integer = 0
|
||||
Dim sTemp As String = ""
|
||||
While EgtGetInfo(nMachGroupId, MGR_RPT_PART & nIndex, sTemp)
|
||||
Dim PartData() As String = sTemp.Split(","c)
|
||||
If PartData(0) <> nDuploId Then
|
||||
EgtSetInfo(nMachGroupId, MGR_RPT_PART & nIndex, sTemp)
|
||||
nIndex += 1
|
||||
End If
|
||||
End While
|
||||
ToRedrawMachGroupList.Add(nMachGroupId)
|
||||
|
||||
|
||||
|
||||
'' elimino vecchio grezzo ed eseguo script creazione nuovo
|
||||
'Dim nRawId As Integer = EgtGetFirstRawPart()
|
||||
'While nRawId <> GDB_ID.NULL
|
||||
' EgtRemovePartFromRawPart(EgtGetFirstPartInRawPart(nRawId))
|
||||
' EgtRemoveRawPart(nRawId)
|
||||
' nRawId = EgtGetFirstRawPart()
|
||||
'End While
|
||||
'If Not ExecBeam(Map.refMainWindowVM.MainWindowM.sTempDir, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdTypes.RAWPART, False) Then Return False
|
||||
|
||||
|
||||
|
||||
' 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)
|
||||
@@ -373,7 +395,8 @@ Public Class MyMachGroupPanelM
|
||||
nPartId = EgtGetNextPart(nPartId)
|
||||
End While
|
||||
EgtResetCurrMachGroup()
|
||||
End Sub
|
||||
Return ToRedrawMachGroupList
|
||||
End Function
|
||||
|
||||
Friend Shared Function DuploGetToDelete(nSouId As Integer, ByRef bToDelete As Boolean) As Boolean
|
||||
If IsNothing(nSouId) Then Return False
|
||||
@@ -402,12 +425,23 @@ Public Class MyMachGroupPanelM
|
||||
End Function
|
||||
|
||||
Public Shared Function DuploGetRawPart(nDuploId As Integer) As Integer
|
||||
Dim nRawId As Integer = GDB_ID.NULL
|
||||
If EgtGetInfo(nDuploId, GDB_SI_LIST, nRawId) AndAlso nRawId > 0 Then
|
||||
Return nRawId
|
||||
Else
|
||||
Return GDB_ID.NULL
|
||||
Dim nSwapItem As Integer = GDB_ID.NULL
|
||||
Dim sSwapItem As String = String.Empty
|
||||
EgtGetInfo(nDuploId, "!LST", sSwapItem)
|
||||
Dim LSTValues() As String = sSwapItem.Split(","c)
|
||||
If Not IsNothing(LSTValues(LSTValues.Count - 1)) AndAlso Integer.TryParse(LSTValues(LSTValues.Count - 1), nSwapItem) AndAlso nSwapItem > 0 Then
|
||||
Return EgtGetParent(nSwapItem)
|
||||
End If
|
||||
Return GDB_ID.NULL
|
||||
|
||||
|
||||
|
||||
'Dim nRawId As Integer = GDB_ID.NULL
|
||||
'If EgtGetInfo(nDuploId, GDB_SI_LIST, nRawId) AndAlso nRawId > 0 Then
|
||||
' Return nRawId
|
||||
'Else
|
||||
' Return GDB_ID.NULL
|
||||
'End If
|
||||
End Function
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
@@ -508,7 +508,7 @@ Public Class PartM
|
||||
Index += 1
|
||||
End While
|
||||
If bFound Then
|
||||
StringToDouble(sSplitInfo(1), NewPartM.m_dPOSX)
|
||||
StringToDoubleAdv(sSplitInfo(1), NewPartM.m_dPOSX)
|
||||
End If
|
||||
Else
|
||||
' leggo PosX, PosY, Rot e Flip
|
||||
|
||||
@@ -47,6 +47,18 @@ Public MustInherit Class MyMachGroupPanelVM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property dDoneTime As String
|
||||
Get
|
||||
Return m_MachGroupVMList.Sum(CType(Function(x As MyMachGroupVM) If(x.nProduction_State >= ItemState.Produced AndAlso Not IsNothing(x.dtEndTime) AndAlso x.dtEndTime <> DateTime.MinValue, (x.dtEndTime - x.dtStartTime).TotalSeconds(), 0), Func(Of MachGroupVM, Double)))
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sDoneTime As String
|
||||
Get
|
||||
Return TimeSpan.FromSeconds(dDoneTime).ToString()
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property dRemainingTime As String
|
||||
Get
|
||||
Return m_MachGroupVMList.Sum(CType(Function(x As MyMachGroupVM) If(x.nProduction_State < ItemState.Produced, x.nCALC_TIME, 0), Func(Of MachGroupVM, Double)))
|
||||
@@ -96,6 +108,21 @@ Public MustInherit Class MyMachGroupPanelVM
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Sub RedrawModifiedMachGroup(RedrawList As List(Of Integer))
|
||||
For Each nMachGroupId In RedrawList
|
||||
EgtSetCurrMachGroup(nMachGroupId)
|
||||
' elimino vecchio grezzo ed eseguo script creazione nuovo
|
||||
Dim nRawId As Integer = EgtGetFirstRawPart()
|
||||
While nRawId <> GDB_ID.NULL
|
||||
EgtRemovePartFromRawPart(EgtGetFirstPartInRawPart(nRawId))
|
||||
EgtRemoveRawPart(nRawId)
|
||||
nRawId = EgtGetFirstRawPart()
|
||||
End While
|
||||
'If Not ExecBeam(Map.refMainWindowVM.MainWindowM.sTempDir, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdTypes.RAWPART, False) Then Return False
|
||||
|
||||
Next
|
||||
End Sub
|
||||
|
||||
'Public Overrides Sub AddMachGroup()
|
||||
' Dim MyMachGroupM As MyMachGroupM = m_MyMachGroupPanelM.NewMyMachGroup(CurrentMachine.sMachineName, Map.refProjectVM.BTLStructureVM.nPROJTYPE)
|
||||
' ' e lo seleziono
|
||||
|
||||
@@ -85,13 +85,13 @@ Public MustInherit Class MyMachGroupVM
|
||||
|
||||
Public ReadOnly Property dUsage As Double
|
||||
Get
|
||||
Return If(MyMachGroupM.dMatForPart > 0 AndAlso MyMachGroupM.dTotMat > 0, MyMachGroupM.dMatForPart / MyMachGroupM.dTotMat * 100, 0)
|
||||
Return If(MyMachGroupM.dMatForPart > 0 AndAlso MyMachGroupM.dTotMat > 0, If(nType = BWType.WALL, MyMachGroupM.dMatForPart / MyMachGroupM.dTotMat * 100, MyMachGroupM.dMatForPart / MyMachGroupM.dL * 100), 0)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property dWaste As Double
|
||||
Get
|
||||
Return If(MyMachGroupM.dMatForPart > 0 AndAlso MyMachGroupM.dTotMat > 0, (MyMachGroupM.dTotMat - MyMachGroupM.dMatForPart) / MyMachGroupM.dTotMat * 100, 0)
|
||||
Return If(MyMachGroupM.dMatForPart > 0 AndAlso MyMachGroupM.dTotMat > 0, If(nType = BWType.WALL, (MyMachGroupM.dTotMat - MyMachGroupM.dMatForPart) / 1000000000, MyMachGroupM.dL - MyMachGroupM.dTotMat), 0)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
@@ -103,7 +103,7 @@ Public MustInherit Class MyMachGroupVM
|
||||
|
||||
Public ReadOnly Property sWaste As String
|
||||
Get
|
||||
Return DoubleToString(dWaste, 3)
|
||||
Return LenToString(dWaste, 3)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
@@ -169,7 +169,7 @@ Public MustInherit Class MyMachGroupVM
|
||||
Return LenToString(MyMachGroupM.dStartCut, 3)
|
||||
End Get
|
||||
Set(value As String)
|
||||
StringToLen(value, MyMachGroupM.dStartCut)
|
||||
StringToLenAdv(value, MyMachGroupM.dStartCut, True)
|
||||
End Set
|
||||
End Property
|
||||
Public Property dStartCut As Double
|
||||
@@ -481,13 +481,25 @@ Public MustInherit Class MyMachGroupVM
|
||||
End Function
|
||||
|
||||
Public Sub UpdateUsage()
|
||||
MyMachGroupM.SetTotMat(dL * dH * dW)
|
||||
MyMachGroupM.SetMatForPart(0)
|
||||
Dim dPartVolume As Double
|
||||
For Each Part In PartVMList
|
||||
dPartVolume += Part.dVolume
|
||||
Next
|
||||
MyMachGroupM.SetMatForPart(dPartVolume)
|
||||
If nType = BWType.BEAM Then
|
||||
MyMachGroupM.SetMatForPart(0)
|
||||
Dim dPartLength As Double
|
||||
Dim dPartOffsetLength As Double
|
||||
For Each Part In PartVMList
|
||||
dPartOffsetLength += Part.dL + Part.dOffset
|
||||
dPartLength += Part.dL
|
||||
Next
|
||||
MyMachGroupM.SetTotMat(dPartOffsetLength)
|
||||
MyMachGroupM.SetMatForPart(dPartLength)
|
||||
Else
|
||||
MyMachGroupM.SetTotMat(dL * dH * dW)
|
||||
MyMachGroupM.SetMatForPart(0)
|
||||
Dim dPartVolume As Double
|
||||
For Each Part In PartVMList
|
||||
dPartVolume += Part.dVolume
|
||||
Next
|
||||
MyMachGroupM.SetMatForPart(dPartVolume)
|
||||
End If
|
||||
NotifyPropertyChanged(NameOf(sUsage))
|
||||
NotifyPropertyChanged(NameOf(sWaste))
|
||||
End Sub
|
||||
@@ -620,13 +632,17 @@ Public MustInherit Class MyMachGroupVM
|
||||
Public ReadOnly Property DeleteMachGroup_Command As ICommand
|
||||
Get
|
||||
If m_cmdDeleteMachGroup Is Nothing Then
|
||||
m_cmdDeleteMachGroup = New Command(AddressOf DeleteMachGroup)
|
||||
m_cmdDeleteMachGroup = New Command(AddressOf DeleteMachGroupCmd)
|
||||
End If
|
||||
Return m_cmdDeleteMachGroup
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Overridable Sub DeleteMachGroup()
|
||||
Public Sub DeleteMachGroupCmd()
|
||||
DeleteMachGroup()
|
||||
End Sub
|
||||
|
||||
Public Overridable Sub DeleteMachGroup(Optional bMultipleCommand As Boolean = False)
|
||||
' elimino tutte le copie
|
||||
Dim nRawPartId As Integer = EgtGetFirstRawPart()
|
||||
Dim nBeamId As Integer = EgtGetFirstPartInRawPart(nRawPartId)
|
||||
|
||||
@@ -107,7 +107,7 @@ Public MustInherit Class PartVM
|
||||
Return LenToString(m_PartM.dPOSX, 3)
|
||||
End Get
|
||||
Set(value As String)
|
||||
StringToLen(value, m_PartM.dPOSX)
|
||||
StringToLenAdv(value, m_PartM.dPOSX, True)
|
||||
End Set
|
||||
End Property
|
||||
Public Property dPOSX As Double
|
||||
@@ -217,7 +217,7 @@ Public MustInherit Class PartVM
|
||||
Return LenToString(m_PartM.dOffset, 3)
|
||||
End Get
|
||||
Set(value As String)
|
||||
StringToLen(value, m_PartM.dOffset)
|
||||
StringToLenAdv(value, m_PartM.dOffset, True)
|
||||
End Set
|
||||
End Property
|
||||
Public ReadOnly Property dOffset As Double
|
||||
@@ -235,7 +235,7 @@ Public MustInherit Class PartVM
|
||||
Return LenToString(m_PartM.dPOSY, 3)
|
||||
End Get
|
||||
Set(value As String)
|
||||
StringToLen(value, m_PartM.dPOSY)
|
||||
StringToLenAdv(value, m_PartM.dPOSY, True)
|
||||
End Set
|
||||
End Property
|
||||
|
||||
@@ -250,7 +250,7 @@ Public MustInherit Class PartVM
|
||||
Return LenToString(m_PartM.dROT, 3) & "°"
|
||||
End Get
|
||||
Set(value As String)
|
||||
StringToLen(value, m_PartM.dROT)
|
||||
StringToLenAdv(value, m_PartM.dROT, True)
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ Imports System.Runtime.InteropServices
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("Egalware s.r.l.")>
|
||||
<Assembly: AssemblyProduct("EgtBEAMWALL.Core")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2020-2022 by Egalware s.r.l.")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2020-2023 by Egalware s.r.l.")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
@@ -35,5 +35,5 @@ Imports System.Runtime.InteropServices
|
||||
' by using the '*' as shown below:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("2.4.3.2")>
|
||||
<Assembly: AssemblyFileVersion("2.4.3.2")>
|
||||
<Assembly: AssemblyVersion("2.5.5.4")>
|
||||
<Assembly: AssemblyFileVersion("2.5.5.4")>
|
||||
|
||||
@@ -154,6 +154,7 @@
|
||||
</ListBox.ItemTemplate>-->
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="DataGridRow">
|
||||
<Setter Property="IsEnabled" Value="{Binding bIsEnabled}"/>
|
||||
<EventSetter Event="MouseDoubleClick" Handler="ProjectList_MouseDoubleClick"/>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
|
||||
@@ -278,12 +278,16 @@ Public MustInherit Class OpenProjectFileDialogVM
|
||||
|
||||
Friend Function VerifySelected() As Boolean
|
||||
If IsNothing(SelProject) Then Return False
|
||||
Dim AllFilesInDir As IEnumerable(Of String)
|
||||
Dim AllFilesInDir As IEnumerable(Of String) = Nothing
|
||||
If m_ProjectType = Core.ConstBeam.ProjectType.PROJ Then
|
||||
If String.IsNullOrWhiteSpace(SelProject.sProjDirPath) OrElse Not Directory.Exists(SelProject.sProjDirPath) Then Return False
|
||||
' verifico se esiste ProdId
|
||||
AllFilesInDir = IO.Directory.EnumerateFiles(SelProject.sProjDirPath)
|
||||
AllFilesInDir = Directory.EnumerateFiles(SelProject.sProjDirPath)
|
||||
ElseIf m_ProjectType = Core.ConstBeam.ProjectType.PROD Then
|
||||
AllFilesInDir = IO.Directory.EnumerateFiles(SelProject.sProdDirPath)
|
||||
If String.IsNullOrWhiteSpace(SelProject.sProdDirPath) OrElse Not Directory.Exists(SelProject.sProdDirPath) Then Return False
|
||||
AllFilesInDir = Directory.EnumerateFiles(SelProject.sProdDirPath)
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
For Each File In AllFilesInDir
|
||||
If Path.GetExtension(File).ToLower() = ".nge" Then
|
||||
|
||||
@@ -10,6 +10,9 @@ Public Class ProdFileM
|
||||
Return m_nProjIdList
|
||||
End Get
|
||||
End Property
|
||||
Public Sub SetProjIdList(value As List(Of Integer))
|
||||
m_nProjIdList = value
|
||||
End Sub
|
||||
|
||||
Protected m_sName As String
|
||||
Public ReadOnly Property sName As String
|
||||
@@ -27,7 +30,8 @@ Public Class 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, sMachine As String) As ProdFileM
|
||||
Public Shared Function CreateProdFileM(nProdId As Integer, nProjIdList As List(Of Integer), dtCreateProjDate As DateTime, sName As String, nType As BWType,
|
||||
sMachine As String, sLockedBy As String, dtLock As DateTime) As ProdFileM
|
||||
Dim NewProjectFileM As New ProdFileM
|
||||
NewProjectFileM.m_nProdId = nProdId
|
||||
NewProjectFileM.m_nProjIdList = nProjIdList
|
||||
@@ -35,6 +39,8 @@ Public Class ProdFileM
|
||||
NewProjectFileM.m_sName = sName
|
||||
NewProjectFileM.m_nType = nType
|
||||
NewProjectFileM.m_sMachine = sMachine
|
||||
NewProjectFileM.m_sLockedBy = sLockedBy
|
||||
NewProjectFileM.m_dtLock = dtLock
|
||||
Return NewProjectFileM
|
||||
End Function
|
||||
|
||||
|
||||
@@ -74,6 +74,26 @@ Public Class ProjectFileM
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_sLockedBy As String
|
||||
Public Property sLockedBy As String
|
||||
Get
|
||||
Return m_sLockedBy
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_sLockedBy = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_dtLock As DateTime
|
||||
Public Property dtLock As DateTime
|
||||
Get
|
||||
Return m_dtLock
|
||||
End Get
|
||||
Set(value As DateTime)
|
||||
m_dtLock = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#Region "CONSTRUCTORS"
|
||||
|
||||
#End Region ' CONSTRUCTORS
|
||||
|
||||
@@ -147,9 +147,9 @@ Public Module BTLIniFile
|
||||
Dim dMin As Double
|
||||
Dim dMax As Double
|
||||
Dim dDefault As Double
|
||||
StringToDouble(sBTLParamParams(2), dMin)
|
||||
StringToDouble(sBTLParamParams(3), dMax)
|
||||
StringToDouble(sBTLParamParams(4), dDefault)
|
||||
StringToDoubleAdv(sBTLParamParams(2), dMin)
|
||||
StringToDoubleAdv(sBTLParamParams(3), dMax)
|
||||
StringToDoubleAdv(sBTLParamParams(4), dDefault)
|
||||
Dim ParamType As BTLParamType
|
||||
If sBTLParamParams(0) = "d" Then
|
||||
ParamType = BTLParamType.DOUBLE_
|
||||
@@ -159,7 +159,7 @@ Public Module BTLIniFile
|
||||
IpBTLParam = BTLParamM.CreateBTLParam(IpParentFeature, IsP, ParamType, sBTLParamParams(1), dMin, dMax, dDefault, sBTLParamParams(5))
|
||||
Return Not IsNothing(IpBTLParam)
|
||||
ElseIf sBTLParamParams(0) = "s" Then
|
||||
IpBTLParam = BTLParamM.CreateBTLParam(IpParentFeature, IsP, BTLParamType.STRING_, sBTLParamParams(1), sBTLParamParams(5))
|
||||
IpBTLParam = BTLParamM.CreateBTLParam(IpParentFeature, IsP, BTLParamType.STRING_, sBTLParamParams(1), sBTLParamParams(4), sBTLParamParams(5))
|
||||
Return Not IsNothing(IpBTLParam)
|
||||
ElseIf sBTLParamParams(0) = "c" Then
|
||||
Dim nMin As Integer
|
||||
@@ -200,9 +200,9 @@ Public Module BTLIniFile
|
||||
Dim dMin As Double
|
||||
Dim dMax As Double
|
||||
Dim dDefault As Double
|
||||
StringToDouble(sBTLParamParams(2), dMin)
|
||||
StringToDouble(sBTLParamParams(3), dMax)
|
||||
StringToDouble(sBTLParamParams(4), dDefault)
|
||||
StringToDoubleAdv(sBTLParamParams(2), dMin)
|
||||
StringToDoubleAdv(sBTLParamParams(3), dMax)
|
||||
StringToDoubleAdv(sBTLParamParams(4), dDefault)
|
||||
Dim ParamType As BTLParamType
|
||||
If sBTLParamParams(0) = "d" Then
|
||||
ParamType = BTLParamType.DOUBLE_
|
||||
@@ -212,7 +212,7 @@ Public Module BTLIniFile
|
||||
IpBTLParam = BTLParamM.CreateBTLParam(IpParentFeature, IsP, ParamType, sBTLParamParams(1), dMin, dMax, dDefault, sBTLParamParams(5), sBWQParam)
|
||||
Return Not IsNothing(IpBTLParam)
|
||||
ElseIf sBTLParamParams(0) = "s" Then
|
||||
IpBTLParam = BTLParamM.CreateBTLParam(IpParentFeature, IsP, BTLParamType.STRING_, sBTLParamParams(1), sBTLParamParams(5), sBWQParam)
|
||||
IpBTLParam = BTLParamM.CreateBTLParam(IpParentFeature, IsP, BTLParamType.STRING_, sBTLParamParams(1), sBTLParamParams(4), sBTLParamParams(5), sBWQParam)
|
||||
Return Not IsNothing(IpBTLParam)
|
||||
ElseIf sBTLParamParams(0) = "c" Then
|
||||
Dim nMin As Integer
|
||||
|
||||
@@ -27,7 +27,7 @@ Public Module DimensionsIniFile
|
||||
Dim GridLenType As GridUnitType
|
||||
Integer.TryParse(sValueParams(0), nDimIndex)
|
||||
Integer.TryParse(sValueParams(1), nDimType)
|
||||
StringToDouble(sValueParams(2), GridLenValue)
|
||||
StringToDoubleAdv(sValueParams(2), GridLenValue)
|
||||
Integer.TryParse(sValueParams(3), GridLenType)
|
||||
GridDimsList.Add(New GridDimension(GridName, nDimIndex, nDimType, New GridLength(GridLenValue, GridLenType)))
|
||||
End If
|
||||
|
||||
@@ -58,9 +58,11 @@ Public Enum StatusMapOpType
|
||||
SupervisorReleaseStop = 11
|
||||
ResetPartStart = 12
|
||||
ResetPartEnd = 13
|
||||
ChangeProdInSupervisorRequest = 14
|
||||
ChangeProdInProdRequest = 15
|
||||
OpenPageInViewOptimRequest = 16
|
||||
SetPartScrapped = 14
|
||||
ChangeProdInSupervisorRequest = 15
|
||||
ChangeProdInProdRequest = 16
|
||||
OpenPageInViewOptimRequest = 17
|
||||
MachGroupValidationUpdate = 18
|
||||
End Enum
|
||||
|
||||
Public Enum DimensionType
|
||||
|
||||
@@ -14,7 +14,7 @@ Public Module LuaMsgManager
|
||||
If Not String.IsNullOrWhiteSpace(sMsg) Then
|
||||
Return sMsg
|
||||
Else
|
||||
EgtMsg(65000 + nMsg)
|
||||
Return EgtMsg(65000 + nMsg)
|
||||
End If
|
||||
Else
|
||||
Return EgtMsg(65000 + nMsg)
|
||||
@@ -25,6 +25,7 @@ Public Module LuaMsgManager
|
||||
Else
|
||||
Return LuaMsg
|
||||
End If
|
||||
Return ""
|
||||
End Function
|
||||
|
||||
End Module
|
||||
|
||||
@@ -2,6 +2,19 @@
|
||||
|
||||
#Region "Private Fields"
|
||||
|
||||
Public Enum MachLogTypes
|
||||
PART_STATUS = 1
|
||||
MACHGROUP_STATUS = 2
|
||||
MACHINE_MODE = 3
|
||||
MACHINE_STATUS = 4
|
||||
MACHINE_COMMAND = 5
|
||||
READ_VAR = 6
|
||||
WRITE_VAR = 7
|
||||
ALARM = 8
|
||||
OPERATOR_MSG = 9
|
||||
PROGRAM_SEND = 10
|
||||
End Enum
|
||||
|
||||
Private m_AlarmCode As String
|
||||
Private m_AlarmDateTime As DateTime
|
||||
Private m_AlarmMessage As String
|
||||
@@ -11,15 +24,74 @@
|
||||
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
|
||||
|
||||
' variabili del log macchina
|
||||
Public ReadOnly Property EventType As MachLogTypes
|
||||
Get
|
||||
Return m_ResultType
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property EventDateTime As DateTime
|
||||
Get
|
||||
Return m_AlarmDateTime
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property EventValue As String
|
||||
Get
|
||||
Return m_VarValue
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sEventType As String
|
||||
Get
|
||||
Select Case m_ResultType
|
||||
Case MachLogTypes.PART_STATUS
|
||||
Return String.Format("({0}) Stato pezzo", 1)
|
||||
Case MachLogTypes.MACHGROUP_STATUS
|
||||
Return String.Format("({0}) Stato barra", 2)
|
||||
Case MachLogTypes.MACHINE_MODE = 3
|
||||
Return String.Format("({0}) Modalità macchina", 3)
|
||||
Case MachLogTypes.MACHINE_STATUS = 4
|
||||
Return String.Format("({0}) Stato macchina", 4)
|
||||
Case MachLogTypes.MACHINE_COMMAND = 5
|
||||
Return String.Format("({0}) Comando macchina", 5)
|
||||
Case MachLogTypes.READ_VAR = 6
|
||||
Return String.Format("({0}) Lettura variabile", 6)
|
||||
Case MachLogTypes.WRITE_VAR = 7
|
||||
Return String.Format("({0}) Scrittura variabile", 7)
|
||||
Case MachLogTypes.ALARM = 8
|
||||
Return String.Format("({0}) Allarme", 8)
|
||||
Case MachLogTypes.OPERATOR_MSG = 9
|
||||
Return String.Format("({0}) Messaggio opertore", 9)
|
||||
Case MachLogTypes.PROGRAM_SEND = 10
|
||||
Return String.Format("({0}) Invio programma", 10)
|
||||
Case Else
|
||||
Return "Altro"
|
||||
End Select
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property sEventDateTime As String
|
||||
Get
|
||||
Return m_AlarmDateTime
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property sEventValue As String
|
||||
Get
|
||||
Return m_VarValue
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sPROD As String
|
||||
Get
|
||||
|
||||
Return m_VarValue
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "Protected Constructors"
|
||||
@@ -165,11 +237,20 @@
|
||||
Return NewMachLog
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateMachLog(EventType As MachLogTypes, EventDateTime As DateTime, Value As String, SupervisorID As String)
|
||||
Dim NewMachEvent As New MachLog
|
||||
NewMachEvent.m_ResultType = EventType
|
||||
NewMachEvent.m_AlarmDateTime = EventDateTime
|
||||
NewMachEvent.m_VarValue = Value
|
||||
NewMachEvent.m_VarAddress = SupervisorID
|
||||
Return NewMachEvent
|
||||
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
|
||||
Public Shared Function CreateMachLog(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
|
||||
|
||||
@@ -15,80 +15,80 @@ Public Class ViewPanelVM
|
||||
' Posizione vista
|
||||
Private Shared m_nViewDir As VT = VT.ISO_SW
|
||||
|
||||
Public Shared Function BWSetView(nView As VT, Optional bRedraw As Boolean = True)
|
||||
Public Shared Sub BWSetView(nView As VT, Optional bRedraw As Boolean = True)
|
||||
' condizioni che cambiano la vista del progetto
|
||||
Select Case m_Type
|
||||
Case BWType.BEAM
|
||||
Select Case nView
|
||||
Case VT.TOP
|
||||
EgtSetView(VT.TOP, bRedraw)
|
||||
Case VT.FRONT
|
||||
EgtSetView(VT.FRONT, bRedraw)
|
||||
Case VT.BACK
|
||||
EgtSetView(VT.BACK, bRedraw)
|
||||
Case VT.RIGHT
|
||||
EgtSetView(VT.RIGHT, bRedraw)
|
||||
Case VT.LEFT
|
||||
EgtSetView(VT.LEFT, bRedraw)
|
||||
Case VT.ISO_SW
|
||||
EgtSetView(VT.ISO_SW, bRedraw)
|
||||
Case Else ' VT.ISO_SW
|
||||
EgtSetView(VT.ISO_SW, bRedraw)
|
||||
'Select Case m_Type
|
||||
' Case BWType.BEAM
|
||||
' Select Case nView
|
||||
' Case VT.TOP
|
||||
' EgtSetView(VT.TOP, bRedraw)
|
||||
' Case VT.FRONT
|
||||
' EgtSetView(VT.FRONT, bRedraw)
|
||||
' Case VT.BACK
|
||||
' EgtSetView(VT.BACK, bRedraw)
|
||||
' Case VT.RIGHT
|
||||
' EgtSetView(VT.RIGHT, bRedraw)
|
||||
' Case VT.LEFT
|
||||
' EgtSetView(VT.LEFT, bRedraw)
|
||||
' Case VT.ISO_SW
|
||||
' EgtSetView(VT.ISO_SW, bRedraw)
|
||||
' Case Else ' VT.ISO_SW
|
||||
' EgtSetView(VT.ISO_SW, bRedraw)
|
||||
' End Select
|
||||
' Case BWType.WALL
|
||||
Select Case nView
|
||||
Case VT.TOP
|
||||
Select Case m_nViewDir
|
||||
Case VT.ISO_SW, VT.ISO_SE
|
||||
EgtSetGenericView(0, -90, bRedraw) ' equivalente a vista TOP
|
||||
Case VT.ISO_NW, VT.ISO_NE
|
||||
EgtSetGenericView(0, 90, bRedraw) ' equivalente a vista TOP ruotata di 180 su Z
|
||||
End Select
|
||||
Case BWType.WALL
|
||||
Select Case nView
|
||||
Case VT.TOP
|
||||
Select Case m_nViewDir
|
||||
Case VT.ISO_SW, VT.ISO_SE
|
||||
EgtSetGenericView(0, -90, bRedraw) ' equivalente a vista TOP
|
||||
Case VT.ISO_NW, VT.ISO_NE
|
||||
EgtSetGenericView(0, 90, bRedraw) ' equivalente a vista TOP ruotata di 180 su Z
|
||||
End Select
|
||||
Case VT.FRONT
|
||||
Select Case m_nViewDir
|
||||
Case VT.ISO_SW, VT.ISO_SE
|
||||
EgtSetGenericView(90, -90, bRedraw) ' equivalente a vista FRONT
|
||||
Case VT.ISO_NW, VT.ISO_NE
|
||||
EgtSetGenericView(90, 90, bRedraw) ' equivalente a vista FRONT ruotata di 180 su Z
|
||||
End Select
|
||||
Case VT.BACK
|
||||
Select Case m_nViewDir
|
||||
Case VT.ISO_SW, VT.ISO_SE
|
||||
EgtSetGenericView(-90, -90, bRedraw) ' equivalente a vista BACK
|
||||
Case VT.ISO_NW, VT.ISO_NE
|
||||
EgtSetGenericView(-90, 90, bRedraw) ' equivalente a vista BACK ruotata di 180 su Z
|
||||
End Select
|
||||
Case VT.RIGHT
|
||||
Select Case m_nViewDir
|
||||
Case VT.ISO_SW, VT.ISO_SE
|
||||
EgtSetGenericView(90, 0, bRedraw) ' equivalente a vista RIGHT
|
||||
Case VT.ISO_NW, VT.ISO_NE
|
||||
EgtSetGenericView(-90, 0, bRedraw) ' equivalente a vista RIGHT ruotata di 180 su Z
|
||||
End Select
|
||||
Case VT.LEFT
|
||||
Select Case m_nViewDir
|
||||
Case VT.ISO_SW, VT.ISO_SE
|
||||
EgtSetGenericView(-90, 0, bRedraw) ' equivalente a vista LEFT
|
||||
Case VT.ISO_NW, VT.ISO_NE
|
||||
EgtSetGenericView(90, 0, bRedraw) ' equivalente a vista LEFT ruotata di 180 su Z
|
||||
End Select
|
||||
Case VT.ISO_SW
|
||||
Select Case m_nViewDir
|
||||
Case VT.ISO_SW, VT.ISO_SE
|
||||
EgtSetGenericView(60, 225, bRedraw) ' equivalente a vista ISO_SW
|
||||
Case VT.ISO_NW, VT.ISO_NE
|
||||
EgtSetGenericView(60, 45, bRedraw) ' equivalente a vista ISO_SW ruotata di 180 su Z
|
||||
End Select
|
||||
Case Else ' VT.ISO_SW
|
||||
Select Case m_nViewDir
|
||||
Case VT.ISO_SW, VT.ISO_SE
|
||||
EgtSetGenericView(60, 225, bRedraw) ' equivalente a vista ISO_SW
|
||||
Case VT.ISO_NW, VT.ISO_NE
|
||||
EgtSetGenericView(60, 45, bRedraw) ' equivalente a vista ISO_SW ruotata di 180 su Z
|
||||
End Select
|
||||
Case VT.FRONT
|
||||
Select Case m_nViewDir
|
||||
Case VT.ISO_SW, VT.ISO_SE
|
||||
EgtSetGenericView(90, -90, bRedraw) ' equivalente a vista FRONT
|
||||
Case VT.ISO_NW, VT.ISO_NE
|
||||
EgtSetGenericView(90, 90, bRedraw) ' equivalente a vista FRONT ruotata di 180 su Z
|
||||
End Select
|
||||
Case VT.BACK
|
||||
Select Case m_nViewDir
|
||||
Case VT.ISO_SW, VT.ISO_SE
|
||||
EgtSetGenericView(-90, -90, bRedraw) ' equivalente a vista BACK
|
||||
Case VT.ISO_NW, VT.ISO_NE
|
||||
EgtSetGenericView(-90, 90, bRedraw) ' equivalente a vista BACK ruotata di 180 su Z
|
||||
End Select
|
||||
Case VT.RIGHT
|
||||
Select Case m_nViewDir
|
||||
Case VT.ISO_SW, VT.ISO_SE
|
||||
EgtSetGenericView(90, 0, bRedraw) ' equivalente a vista RIGHT
|
||||
Case VT.ISO_NW, VT.ISO_NE
|
||||
EgtSetGenericView(-90, 0, bRedraw) ' equivalente a vista RIGHT ruotata di 180 su Z
|
||||
End Select
|
||||
Case VT.LEFT
|
||||
Select Case m_nViewDir
|
||||
Case VT.ISO_SW, VT.ISO_SE
|
||||
EgtSetGenericView(-90, 0, bRedraw) ' equivalente a vista LEFT
|
||||
Case VT.ISO_NW, VT.ISO_NE
|
||||
EgtSetGenericView(90, 0, bRedraw) ' equivalente a vista LEFT ruotata di 180 su Z
|
||||
End Select
|
||||
Case VT.ISO_SW
|
||||
Select Case m_nViewDir
|
||||
Case VT.ISO_SW, VT.ISO_SE
|
||||
EgtSetGenericView(60, 225, bRedraw) ' equivalente a vista ISO_SW
|
||||
Case VT.ISO_NW, VT.ISO_NE
|
||||
EgtSetGenericView(60, 45, bRedraw) ' equivalente a vista ISO_SW ruotata di 180 su Z
|
||||
End Select
|
||||
Case Else ' VT.ISO_SW
|
||||
Select Case m_nViewDir
|
||||
Case VT.ISO_SW, VT.ISO_SE
|
||||
EgtSetGenericView(60, 225, bRedraw) ' equivalente a vista ISO_SW
|
||||
Case VT.ISO_NW, VT.ISO_NE
|
||||
EgtSetGenericView(60, 45, bRedraw) ' equivalente a vista ISO_SW ruotata di 180 su Z
|
||||
End Select
|
||||
End Select
|
||||
End Function
|
||||
'End Select
|
||||
End Sub
|
||||
|
||||
Public Shared Sub UpdateMachParam(ViewDir As VT)
|
||||
m_nViewDir = ViewDir
|
||||
|
||||
@@ -1,26 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
using EgtBEAMWALL.DataLayer.Migrations;
|
||||
using MySql.Data.EntityFramework;
|
||||
using System;
|
||||
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() : base(DbConfig.ADMIN_CONNECTION_STRING)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -38,5 +33,67 @@ namespace EgtBEAMWALL.DataLayer
|
||||
public DbSet<UserPriv> UserList { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public bool SetUpDbConnectionAndDbConfig()
|
||||
{
|
||||
try
|
||||
{
|
||||
String serviceName = getDbServiceName();
|
||||
if (serviceName.Equals(""))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ServiceController service = new ServiceController(serviceName);
|
||||
try
|
||||
{
|
||||
TimeSpan timeout = TimeSpan.FromSeconds(DbConfig.DATABASE_PROCESS_TIMEOUT);
|
||||
service.WaitForStatus(ServiceControllerStatus.Running, timeout);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//Database.SetInitializer<DatabaseContext>(null);
|
||||
Database.SetInitializer(new MigrateDatabaseToLatestVersion<DatabaseContext, Configuration>());
|
||||
var migrator = new DbMigrator(new Configuration());
|
||||
|
||||
if (migrator.GetPendingMigrations().Any())
|
||||
{
|
||||
// Run migrations and seed.
|
||||
migrator.Update();
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine(exc.ToString());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Methods
|
||||
|
||||
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 "";
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -1,29 +1,49 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?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" />
|
||||
</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.7.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.EntityFramework" />-->
|
||||
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/>
|
||||
<providers>
|
||||
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework, Version=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d">
|
||||
</provider>
|
||||
</providers>
|
||||
</entityFramework>
|
||||
<connectionStrings>
|
||||
<add name="DefaultConnection" connectionString="server=localhost;port=3306;User Id=steamware;password=Egalware_24068!;Persist Security Info=True;database=EgtBwDb_000470;SslMode=none" providerName="MySql.Data.MySqlClient" />
|
||||
</connectionStrings>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-8.0.21.0" newVersion="8.0.21.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Google.Protobuf" publicKeyToken="a7d26565bac4d604" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.21.9.0" newVersion="3.21.9.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="K4os.Compression.LZ4.Streams" publicKeyToken="2186fa9121ef231d" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.3.5.0" newVersion="1.3.5.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="BouncyCastle.Crypto" publicKeyToken="0e99375e54769942" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.9.0.0" newVersion="1.9.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
</startup>
|
||||
</configuration>
|
||||
@@ -1,25 +1,17 @@
|
||||
using System;
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
public class BTLPartController : IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private DatabaseContext dbCtx;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public BTLPartController()
|
||||
{
|
||||
// Initialize database context
|
||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
@@ -32,7 +24,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <param name="corePart"></param>
|
||||
/// <param name="currProjDbId"></param>
|
||||
/// <returns></returns>
|
||||
public static BTLPartModel ConvertFromCore(Core.BTLPartM corePart, int currProjDbId)
|
||||
public BTLPartModel ConvertFromCore(Core.BTLPartM corePart, int currProjDbId)
|
||||
{
|
||||
BTLPartModel answ = new BTLPartModel();
|
||||
if (corePart != null)
|
||||
@@ -105,15 +97,19 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
dbCtx.BTLPartList.AddRange(partData);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// Add to database
|
||||
localDbCtx.BTLPartList.AddRange(partData);
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on Create: {exc}");
|
||||
string errMessage = $"EXCEPTION on BTLPart.Create: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
return partData;
|
||||
}
|
||||
@@ -147,15 +143,19 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
dbCtx.BTLPartList.AddRange(partData);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// Add to database
|
||||
localDbCtx.BTLPartList.AddRange(partData);
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on CreateBaseObj: {exc}");
|
||||
string errMessage = $"EXCEPTION on BTLPart.CreateBaseObj: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
|
||||
return partData;
|
||||
@@ -169,22 +169,26 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public bool Delete(int PartDbId)
|
||||
{
|
||||
bool done = false;
|
||||
var item2del = dbCtx
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var item2del = localDbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.BTLPartDbId == PartDbId)
|
||||
.SingleOrDefault();
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
dbCtx.BTLPartList.Remove(item2del);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on Delete: {exc}");
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
localDbCtx.BTLPartList.Remove(item2del);
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on BTLPart.Delete: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
@@ -197,29 +201,31 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public bool DeleteByProject(int ProjDbId)
|
||||
{
|
||||
bool done = false;
|
||||
var items2del = dbCtx
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var items2del = localDbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.ProjDbId == ProjDbId);
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
dbCtx.BTLPartList.RemoveRange(items2del);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on DeleteByProject: {exc}");
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
localDbCtx.BTLPartList.RemoveRange(items2del);
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on BTLPart.DeleteByProject: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database context
|
||||
dbCtx.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -229,10 +235,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public BTLPartModel FindByDbId(int PartDbId)
|
||||
{
|
||||
return dbCtx
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
return localDbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.BTLPartDbId == PartDbId)
|
||||
.SingleOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -242,10 +251,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public BTLPartModel FindByPartId(int PartId)
|
||||
{
|
||||
return dbCtx
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
return localDbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.PartId == PartId)
|
||||
.SingleOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -256,10 +268,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public BTLPartModel FindByPartIdProjDbId(int PartId, int ProjDbId)
|
||||
{
|
||||
return dbCtx
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
return localDbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.PartId == PartId && x.ProjDbId == ProjDbId)
|
||||
.FirstOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -269,12 +284,15 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public List<BTLPartModel> GetByProjectAsc(int ProjDbId)
|
||||
{
|
||||
// retrieve
|
||||
return dbCtx
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// retrieve
|
||||
return localDbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.ProjDbId == ProjDbId)
|
||||
.OrderBy(x => x.BTLPartDbId)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -284,12 +302,15 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public List<BTLPartModel> GetByProjectDesc(int ProjDbId)
|
||||
{
|
||||
// retrieve
|
||||
return dbCtx
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// retrieve
|
||||
return localDbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.ProjDbId == ProjDbId)
|
||||
.OrderByDescending(x => x.BTLPartDbId)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -300,17 +321,22 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public List<BTLPartModel> GetPaginatedAsc(int PartDbIdStart, int numRecord)
|
||||
{
|
||||
List<BTLPartModel> answ = new List<BTLPartModel>();
|
||||
int numEnd = PartDbIdStart - numRecord;
|
||||
// check numEnd
|
||||
if (numEnd < 0)
|
||||
numEnd = 0;
|
||||
// retrieve
|
||||
return dbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.BTLPartDbId <= PartDbIdStart)
|
||||
.OrderBy(x => x.BTLPartDbId)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// retrieve
|
||||
answ = localDbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.BTLPartDbId <= PartDbIdStart)
|
||||
.OrderBy(x => x.BTLPartDbId)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -321,26 +347,22 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public List<BTLPartModel> GetPaginatedDesc(int PartDbIdStart, int numRecord)
|
||||
{
|
||||
List<BTLPartModel> answ = new List<BTLPartModel>();
|
||||
int numEnd = PartDbIdStart - numRecord;
|
||||
// check numEnd
|
||||
if (numEnd < 0)
|
||||
numEnd = 0;
|
||||
// retrieve
|
||||
return dbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.BTLPartDbId <= PartDbIdStart)
|
||||
.OrderByDescending(x => x.BTLPartDbId)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reinizializzaizone del controller
|
||||
/// </summary>
|
||||
public void ResetController()
|
||||
{
|
||||
// Re-Initialize database context
|
||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// retrieve
|
||||
answ = localDbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.BTLPartDbId <= PartDbIdStart)
|
||||
.OrderByDescending(x => x.BTLPartDbId)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -351,32 +373,44 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public bool Update(BTLPartModel updItem)
|
||||
{
|
||||
bool done = false;
|
||||
var item2update = dbCtx
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var item2update = localDbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.BTLPartDbId == updItem.BTLPartDbId)
|
||||
.SingleOrDefault();
|
||||
try
|
||||
{
|
||||
// update, vers 1...
|
||||
dbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
try
|
||||
{
|
||||
// update, vers 1...
|
||||
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
|
||||
//// update, vers 2
|
||||
//dbCtx.BTLPartList.Remove(item2del);
|
||||
//dbCtx.BTLPartList.Add(updItem);
|
||||
//// update, vers 2
|
||||
//localDbCtx.BTLPartList.Remove(item2del);
|
||||
//localDbCtx.BTLPartList.Add(updItem);
|
||||
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
done = true;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on BTLPart.Update: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on Update: {exc}");
|
||||
}
|
||||
// reset...
|
||||
ResetController();
|
||||
return done;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
/// <summary>
|
||||
/// Istanza logger
|
||||
/// </summary>
|
||||
private NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
using System.Threading;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
public class DbController : IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private AdminContext adbCtx;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Fields
|
||||
|
||||
/// <summary>
|
||||
@@ -29,6 +22,8 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
// Initialize database context for ADMIN
|
||||
adbCtx = new AdminContext(DbConfig.ADMIN_CONNECTION_STRING);
|
||||
// DB standard utente
|
||||
dbCtx = new AdminContext(DbConfig.CONNECTION_STRING);
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
@@ -46,39 +41,78 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
bool answ = false;
|
||||
string domain = isNetwork ? "%" : "localhost";
|
||||
// ricerca utente...
|
||||
var numUser = adbCtx
|
||||
.UserList
|
||||
.Where(x => x.User == username)
|
||||
.ToList()
|
||||
.Count;
|
||||
if (numUser > 0)
|
||||
answ = doCheckCreate(username, pwd, answ, domain, false);
|
||||
if (answ)
|
||||
{
|
||||
answ = true;
|
||||
}
|
||||
if (!answ)
|
||||
{
|
||||
// creo utente
|
||||
string sqlCommand = "FLUSH PRIVILEGES;";
|
||||
//string sqlCommand = $"CREATE USER '{username}'@'{domain}' IDENTIFIED BY '{pwd}'; GRANT ALL ON *.* TO '{username}'@'localhost'; FLUSH PRIVILEGES;";
|
||||
//string sqlCommand = $"CREATE USER '{username}'@'{domain}' IDENTIFIED BY '{pwd}'; GRANT ALL ON *.* TO '{username}'@'localhost'; FLUSH PRIVILEGES;";
|
||||
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
|
||||
sqlCommand = $"CREATE USER '{username}'@'{domain}' IDENTIFIED BY '{pwd}';";
|
||||
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
|
||||
sqlCommand = $"GRANT ALL ON *.* TO '{username}'@'{domain}';";
|
||||
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
|
||||
sqlCommand = "FLUSH PRIVILEGES;";
|
||||
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
|
||||
doGrantPriv(username, domain, "ALL ON *.*");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Migrazione esplicita del DB da parte dell'admin controller
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool checkMigrateDb()
|
||||
{
|
||||
return adbCtx.SetUpDbConnectionAndDbConfig();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database context
|
||||
adbCtx.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica esistenza views + utente relativo eventualmente ricreandole + fornendo accesso
|
||||
/// all'utente ReadOnly Essetre
|
||||
/// </summary>
|
||||
/// <param name="dbName"></param>
|
||||
/// <param name="username"></param>
|
||||
/// <param name="pwd"></param>
|
||||
/// <returns></returns>
|
||||
public bool refreshViews(string dbName, string username = "S3_User", string pwd = "S3_P4ssw0rd")
|
||||
{
|
||||
bool answ = false;
|
||||
|
||||
// in primis refresh delle view
|
||||
string sqlCommand = @"CREATE OR REPLACE VIEW v_expProdRaw AS
|
||||
SELECT DbId, AlarmDtEvent AS DtEvent, VarValue,
|
||||
SUBSTRING_INDEX(VarValue, ';', 1) AS Prod,
|
||||
SUBSTRING_INDEX(SUBSTRING_INDEX(VarValue, ';', 2), ';', -1) AS MachGroupId,
|
||||
SUBSTRING_INDEX(SUBSTRING_INDEX(VarValue, ';', -2), ';', 1) AS PartId,
|
||||
SUBSTRING_INDEX(VarValue, ';', -1) AS Status
|
||||
FROM logmachine
|
||||
WHERE ResultType = 1
|
||||
AND VarAddress = 1;
|
||||
|
||||
CREATE OR REPLACE VIEW v_expProd AS
|
||||
SELECT vp.DtEvent, vp.Prod, mgl.Name AS mgName, pl.PDN, vp.`Status`
|
||||
FROM v_expProdRaw AS vp
|
||||
INNER JOIN MachGroupList mgl ON vp.MachGroupId = mgl.Id
|
||||
INNER JOIN partlist pl ON vp.PartId = pl.Id;";
|
||||
dbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
|
||||
Thread.Sleep(100);
|
||||
|
||||
// ora setup parametri x utente
|
||||
string domain = "%";
|
||||
|
||||
// ora controllo utente con diritti
|
||||
answ = doCheckCreate(username, pwd, answ, domain, true);
|
||||
if (answ)
|
||||
{
|
||||
doGrantPriv(username, domain, "USAGE ON *.*");
|
||||
doGrantPriv(username, domain, $"SELECT ON {dbName}.v_expProd");
|
||||
}
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ATTENZIONE!!!! Procedura di Reset del DB
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool ResetDb()
|
||||
{
|
||||
bool answ = false;
|
||||
@@ -94,12 +128,100 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on ResetDb: {exc}");
|
||||
string errMessage = $"EXCEPTION on DbController.ResetDb: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private AdminContext adbCtx;
|
||||
private AdminContext dbCtx;
|
||||
|
||||
/// <summary>
|
||||
/// Istanza logger
|
||||
/// </summary>
|
||||
private NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Procedura interna effettiva di check utente ed eventuale creazione + grant level
|
||||
/// </summary>
|
||||
/// <param name="username"></param>
|
||||
/// <param name="pwd"></param>
|
||||
/// <param name="answ"></param>
|
||||
/// <param name="domain"></param>
|
||||
/// <param name="force">Force = esegue un drop prima...</param>
|
||||
/// <returns></returns>
|
||||
private bool doCheckCreate(string username, string pwd, bool answ, string domain, bool force)
|
||||
{
|
||||
// ricerca utente...
|
||||
var numUser = adbCtx
|
||||
.UserList
|
||||
.Where(x => x.User == username)
|
||||
.ToList()
|
||||
.Count;
|
||||
if (numUser > 0)
|
||||
{
|
||||
answ = true;
|
||||
}
|
||||
if (!answ)
|
||||
{
|
||||
// creo utente
|
||||
string sqlCommand = $"DROP USER IF EXISTS {username};";
|
||||
if (force)
|
||||
{
|
||||
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
sqlCommand = "FLUSH PRIVILEGES;";
|
||||
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
|
||||
Thread.Sleep(100);
|
||||
sqlCommand = $"CREATE USER '{username}'@'{domain}' IDENTIFIED BY '{pwd}';";
|
||||
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
|
||||
Thread.Sleep(100);
|
||||
sqlCommand = "FLUSH PRIVILEGES;";
|
||||
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
|
||||
Thread.Sleep(100);
|
||||
answ = true;
|
||||
}
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Procedura interna effettiva di grant level x utente
|
||||
/// </summary>
|
||||
/// <param name="username"></param>
|
||||
/// <param name="domain"></param>
|
||||
/// <param name="grantLevel"></param>
|
||||
/// <returns></returns>
|
||||
private bool doGrantPriv(string username, string domain, string grantLevel)
|
||||
{
|
||||
bool answ = false;
|
||||
|
||||
string sqlCommand = "FLUSH PRIVILEGES;";
|
||||
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
|
||||
Thread.Sleep(100);
|
||||
sqlCommand = $"GRANT {grantLevel} TO '{username}'@'{domain}';";
|
||||
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
|
||||
Thread.Sleep(100);
|
||||
sqlCommand = "FLUSH PRIVILEGES;";
|
||||
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
|
||||
Thread.Sleep(100);
|
||||
answ = true;
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -1,25 +1,17 @@
|
||||
using System;
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
using NLog;
|
||||
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
|
||||
@@ -31,7 +23,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// </summary>
|
||||
/// <param name="coreMacLog"></param>
|
||||
/// <returns></returns>
|
||||
public static LogMachineModel ConvertFromCore(Core.MachLog coreMacLog)
|
||||
public LogMachineModel ConvertFromCore(Core.MachLog coreMacLog)
|
||||
{
|
||||
LogMachineModel answ = new LogMachineModel();
|
||||
if (coreMacLog != null)
|
||||
@@ -61,9 +53,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// </summary>
|
||||
/// <param name="dbLog"></param>
|
||||
/// <returns></returns>
|
||||
public static Core.MachLog ConvertToCore(LogMachineModel dbLog)
|
||||
public 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);
|
||||
var newRecord = Core.MachLog.CreateMachLog(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;
|
||||
}
|
||||
|
||||
@@ -79,18 +71,19 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var currDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
using (var locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// Add to database
|
||||
currDbCtx.LogMachineList.Add(newLogMac);
|
||||
locallocalDbCtx.LogMachineList.Add(newLogMac);
|
||||
// Commit changes
|
||||
currDbCtx.SaveChanges();
|
||||
ResetController();
|
||||
locallocalDbCtx.SaveChanges();
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on Create LogMachine: {exc}");
|
||||
string errMessage = $"EXCEPTION on LogMachine.Create: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
catch
|
||||
@@ -117,29 +110,31 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public bool DeleteByKey(int LogDbId)
|
||||
{
|
||||
bool done = false;
|
||||
var items2del = dbCtx
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var items2del = localDbCtx
|
||||
.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}");
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
localDbCtx.LogMachineList.RemoveRange(items2del);
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on LogMachine.DeleteByKey: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database context
|
||||
dbCtx.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -149,10 +144,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public LogMachineModel FindByDbId(int LogDbId)
|
||||
{
|
||||
return dbCtx
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
return localDbCtx
|
||||
.LogMachineList
|
||||
.Where(x => x.LogDbId == LogDbId)
|
||||
.SingleOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -163,12 +161,41 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public List<LogMachineModel> GetAsc(DateTime dtStart, DateTime dtEnd)
|
||||
{
|
||||
// retrieve
|
||||
return dbCtx
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// retrieve
|
||||
return localDbCtx
|
||||
.LogMachineList
|
||||
.Where(x => x.AlarmDatetime >= dtStart && x.AlarmDatetime <= dtEnd)
|
||||
.OrderBy(x => x.AlarmDatetime)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get paginated data from DB (ASC ordered) in "core format"
|
||||
/// </summary>
|
||||
/// <param name="dtStart"></param>
|
||||
/// <param name="dtEnd"></param>
|
||||
/// <returns></returns>
|
||||
public List<Core.MachLog> GetCoreAsc(DateTime dtStart, DateTime dtEnd)
|
||||
{
|
||||
var rawData = GetAsc(dtStart, dtEnd);
|
||||
var coreData = rawData.Select(x => ConvertToCore(x)).ToList();
|
||||
return coreData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get paginated data from DB (DESC ordered) in "core format"
|
||||
/// </summary>
|
||||
/// <param name="dtStart"></param>
|
||||
/// <param name="dtEnd"></param>
|
||||
/// <returns></returns>
|
||||
public List<Core.MachLog> GetCoreDesc(DateTime dtStart, DateTime dtEnd)
|
||||
{
|
||||
var rawData = GetDesc(dtStart, dtEnd);
|
||||
var coreData = rawData.Select(x => ConvertToCore(x)).ToList();
|
||||
return coreData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -179,21 +206,15 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public List<LogMachineModel> GetDesc(DateTime dtStart, DateTime dtEnd)
|
||||
{
|
||||
// retrieve
|
||||
return dbCtx
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// retrieve
|
||||
return localDbCtx
|
||||
.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>
|
||||
@@ -204,27 +225,40 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public bool Update(LogMachineModel updItem)
|
||||
{
|
||||
bool done = false;
|
||||
var item2update = dbCtx
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var item2update = localDbCtx
|
||||
.LogMachineList
|
||||
.Where(x => x.LogDbId == updItem.LogDbId)
|
||||
.SingleOrDefault();
|
||||
try
|
||||
{
|
||||
// update, vers 1...
|
||||
dbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
try
|
||||
{
|
||||
// update, vers 1...
|
||||
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on Update: {exc}");
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on LogMachine.Update: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
/// <summary>
|
||||
/// Istanza logger
|
||||
/// </summary>
|
||||
private NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -1,25 +1,17 @@
|
||||
using System;
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
using NLog;
|
||||
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
|
||||
@@ -41,24 +33,28 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public bool Create(DateTime dtCreated, Core.LogSupportLevel level, Core.LogSupportTarget target, string message)
|
||||
{
|
||||
bool fatto = false;
|
||||
try
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
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}");
|
||||
try
|
||||
{
|
||||
LogSupportModel newItem = new LogSupportModel() { DtEvent = dtCreated, Level = level, Target = target, Message = message };
|
||||
// Add to database
|
||||
localDbCtx.LogSupportList.Add(newItem);
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on LogSupport.Create: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return fatto;
|
||||
}
|
||||
|
||||
@@ -70,29 +66,31 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public bool DeleteByKey(int LogDbId)
|
||||
{
|
||||
bool done = false;
|
||||
var items2del = dbCtx
|
||||
.LogSupportList
|
||||
.Where(x => x.LogDbId == LogDbId);
|
||||
try
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// Add to database
|
||||
dbCtx.LogSupportList.RemoveRange(items2del);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on DeleteByKey: {exc}");
|
||||
var items2del = localDbCtx
|
||||
.LogSupportList
|
||||
.Where(x => x.LogDbId == LogDbId);
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
localDbCtx.LogSupportList.RemoveRange(items2del);
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on LogSupport.DeleteByKey: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database context
|
||||
dbCtx.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -102,10 +100,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public LogSupportModel FindByDbId(int LogDbId)
|
||||
{
|
||||
return dbCtx
|
||||
.LogSupportList
|
||||
.Where(x => x.LogDbId == LogDbId)
|
||||
.SingleOrDefault();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
return localDbCtx
|
||||
.LogSupportList
|
||||
.Where(x => x.LogDbId == LogDbId)
|
||||
.SingleOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -117,11 +118,14 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public List<LogSupportModel> GetPaginatedAsc(DateTime dtStart, DateTime dtEnd)
|
||||
{
|
||||
// retrieve
|
||||
return dbCtx
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
return localDbCtx
|
||||
.LogSupportList
|
||||
.Where(x => x.DtEvent >= dtStart && x.DtEvent <= dtEnd)
|
||||
.OrderBy(x => x.DtEvent)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -133,20 +137,14 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public List<LogSupportModel> GetPaginatedDesc(DateTime dtStart, DateTime dtEnd)
|
||||
{
|
||||
// retrieve
|
||||
return dbCtx
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
return localDbCtx
|
||||
.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>
|
||||
@@ -157,27 +155,40 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public bool Update(LogSupportModel updItem)
|
||||
{
|
||||
bool done = false;
|
||||
var item2update = dbCtx
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var item2update = localDbCtx
|
||||
.LogSupportList
|
||||
.Where(x => x.LogDbId == updItem.LogDbId)
|
||||
.SingleOrDefault();
|
||||
try
|
||||
{
|
||||
// update, vers 1...
|
||||
dbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
try
|
||||
{
|
||||
// update, vers 1...
|
||||
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on Update: {exc}");
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on LogSupport.Update: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
/// <summary>
|
||||
/// Istanza logger
|
||||
/// </summary>
|
||||
private NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -7,24 +8,10 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
public class MachGroupController : IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private DatabaseContext dbCtx;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Fields
|
||||
|
||||
public static MachGroupController man = new MachGroupController();
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public MachGroupController()
|
||||
{
|
||||
// Initialize database context
|
||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
@@ -37,7 +24,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <param name="coreMachGroup"></param>
|
||||
/// <param name="currProdDbId"></param>
|
||||
/// <returns></returns>
|
||||
public static MachGroupModel ConvertFromCore(Core.MyMachGroupM coreMachGroup, int currProdDbId)
|
||||
public MachGroupModel ConvertFromCore(Core.MyMachGroupM coreMachGroup, int currProdDbId)
|
||||
{
|
||||
MachGroupModel answ = new MachGroupModel();
|
||||
if (coreMachGroup != null)
|
||||
@@ -63,21 +50,26 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
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>
|
||||
/// <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);
|
||||
ProdModel currData = new ProdModel();
|
||||
List<PartModel> PartList2Add = new List<PartModel>();
|
||||
var myPartCtrl = new PartController();
|
||||
var myStatusMapCtrl = new StatusMapController();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// Recupero il PROD nel contesto
|
||||
currData = localDbCtx
|
||||
.ProdList
|
||||
.Where(x => x.ProdId == ProdId)
|
||||
.SingleOrDefault();
|
||||
try
|
||||
{
|
||||
var convCurrMG = MachGroupController.ConvertFromCore(newMachGroup, currData.ProdDbId);
|
||||
var locMGCtrl = new MachGroupController();
|
||||
var convCurrMG = locMGCtrl.ConvertFromCore(newMachGroup, currData.ProdDbId);
|
||||
|
||||
convCurrMG.ProdIndex = 1;
|
||||
|
||||
@@ -86,15 +78,25 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
|
||||
int MachGroupDbId = MachGroupController.man.FindByMachGroupId(ProdId, newMachGroup.Id).MachGroupDbId;
|
||||
int MachGroupDbId = FindByMachGroupId(ProdId, newMachGroup.Id).MachGroupDbId;
|
||||
// 2023.05.10 leggo elenco part in una sola volta
|
||||
|
||||
var currMgPartList = localDbCtx
|
||||
.PartList
|
||||
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == newMachGroup.Id)
|
||||
.ToList();
|
||||
// verifico se uguali o meno...
|
||||
foreach (var currPartM in newMachGroup.PartMList)
|
||||
{
|
||||
var currPart = localDbCtx
|
||||
.PartList
|
||||
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == newMachGroup.Id && x.PartId == currPartM.nPartId)
|
||||
//var currPart = localDbCtx
|
||||
// .PartList
|
||||
// .Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == newMachGroup.Id && x.PartId == currPartM.nPartId)
|
||||
// .SingleOrDefault();
|
||||
var currPart = currMgPartList
|
||||
.Where(x => x.PartId == currPartM.nPartId)
|
||||
.SingleOrDefault();
|
||||
var convCurrPartM = PartController.ConvertFromCore(currPartM, MachGroupDbId);
|
||||
|
||||
var convCurrPartM = myPartCtrl.ConvertFromCore(currPartM, MachGroupDbId);
|
||||
if (currPart != null)
|
||||
{
|
||||
// se non identico x equality limitata a ViewOptim...
|
||||
@@ -130,11 +132,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", ProdId, newMachGroup.Id, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupAdd, "");
|
||||
myStatusMapCtrl.UpdateAction("", ProdId, newMachGroup.Id, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupAdd, "");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on UpdateMachGroup: {exc}");
|
||||
string errMessage = $"EXCEPTION on MachGroup.UpdateMachGroup: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return currData;
|
||||
@@ -161,7 +165,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on Create: {exc}");
|
||||
string errMessage = $"EXCEPTION on MachGroup.Create: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return newMachGroup;
|
||||
@@ -178,6 +184,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
bool done = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var myStatusMapCtrl = new StatusMapController();
|
||||
// inizio eliminando le part
|
||||
var parts2del = localDbCtx
|
||||
.PartList
|
||||
@@ -198,25 +205,25 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
localDbCtx.SaveChanges();
|
||||
|
||||
// registro modifica StatusMap
|
||||
StatusMapController.man.UpdateAction(MG2Del.SupervisorId, ProdId, MG2Del.MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupRem, "");
|
||||
myStatusMapCtrl.UpdateAction(MG2Del.SupervisorId, ProdId, MG2Del.MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupRem, "");
|
||||
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on Delete: ProdId: {ProdId} | MachGroupId: {MachGroupId}{Environment.NewLine}{exc}");
|
||||
string errMessage = $"EXCEPTION on MachGroup.Delete: ProdId: {ProdId} | MachGroupId: {MachGroupId}{Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
|
||||
// se fatto aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupRem, "");
|
||||
myStatusMapCtrl.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupRem, "");
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database context
|
||||
dbCtx.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -226,10 +233,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public MachGroupModel FindByMachGroupDbId(int MachGroupDbId)
|
||||
{
|
||||
return dbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.MachGroupDbId == MachGroupDbId)
|
||||
.SingleOrDefault();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
return localDbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.MachGroupDbId == MachGroupDbId)
|
||||
.SingleOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -239,7 +249,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public MachGroupModel FindByMachGroupId(int ProdId, int MachGroupId)
|
||||
{
|
||||
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
return localDbCtx
|
||||
@@ -258,27 +267,34 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
// verificare fattibilità in 1 solo passo
|
||||
int ProdDbId = 0;
|
||||
try
|
||||
List<MachGroupModel> answ = new List<MachGroupModel>();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var currProd = dbCtx
|
||||
.ProdList
|
||||
.Where(x => x.ProdId == ProdId)
|
||||
.FirstOrDefault();
|
||||
if (currProd != null)
|
||||
try
|
||||
{
|
||||
ProdDbId = currProd.ProdDbId;
|
||||
var currProd = localDbCtx
|
||||
.ProdList
|
||||
.Where(x => x.ProdId == ProdId)
|
||||
.FirstOrDefault();
|
||||
if (currProd != null)
|
||||
{
|
||||
ProdDbId = currProd.ProdDbId;
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on MachGroup.GetByProdAsc: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
answ = localDbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.ProdDbId == ProdDbId)
|
||||
.OrderBy(x => x.ProdIndex)
|
||||
.ThenBy(x => x.MachGroupId)
|
||||
.ToList();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on GetByProdAsc: {exc}");
|
||||
}
|
||||
return dbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.ProdDbId == ProdDbId)
|
||||
.OrderBy(x => x.ProdIndex)
|
||||
.ThenBy(x => x.MachGroupId)
|
||||
.ToList();
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -290,29 +306,35 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
// recupero
|
||||
int ProdDbId = 0;
|
||||
|
||||
// verificare fattibilità in 1 solo passo
|
||||
try
|
||||
List<MachGroupModel> answ = new List<MachGroupModel>();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var currProd = dbCtx
|
||||
.ProdList
|
||||
.Where(x => x.ProdId == ProdId)
|
||||
.FirstOrDefault();
|
||||
if (currProd != null)
|
||||
// verificare fattibilità in 1 solo passo
|
||||
try
|
||||
{
|
||||
ProdDbId = currProd.ProdDbId;
|
||||
var currProd = localDbCtx
|
||||
.ProdList
|
||||
.Where(x => x.ProdId == ProdId)
|
||||
.FirstOrDefault();
|
||||
if (currProd != null)
|
||||
{
|
||||
ProdDbId = currProd.ProdDbId;
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on MachGroup.GetByProdDesc: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
answ = localDbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.ProdDbId == ProdDbId)
|
||||
.OrderByDescending(x => x.ProdIndex)
|
||||
.ThenByDescending(x => x.MachGroupId)
|
||||
.ToList();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on GetByProdDesc: {exc}");
|
||||
}
|
||||
return dbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.ProdDbId == ProdDbId)
|
||||
.OrderByDescending(x => x.ProdIndex)
|
||||
.ThenByDescending(x => x.MachGroupId)
|
||||
.ToList();
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -323,12 +345,15 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <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();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
return localDbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.Prod.ProdId == ProdId && x.SupervisorId == SupervisorId)
|
||||
.OrderBy(x => x.ProdIndex)
|
||||
.ThenBy(x => x.MachGroupId)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -356,7 +381,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on UpdateOrder: {exc}");
|
||||
string errMessage = $"EXCEPTION on MachGroup.UpdateOrder: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -374,6 +401,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
bool done = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var myStatusMapCtrl = new StatusMapController();
|
||||
try
|
||||
{
|
||||
// aggiorno
|
||||
@@ -386,31 +414,30 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
currRecord.State = Core.ItemState.ND;
|
||||
currRecord.SupervisorId = "";
|
||||
currRecord.ProdIndex = 0;
|
||||
}
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupRemovedFromSupervisor, "");
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
// aggiorno info sullo status
|
||||
myStatusMapCtrl.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupRemovedFromSupervisor, "");
|
||||
|
||||
done = true;
|
||||
done = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on MachGroup.RemoveFromSupervisor: req item was not found | ProdId {ProdId} | MachGroupId {MachGroupId}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on RemoveFromSupervisor: {exc}");
|
||||
string errMessage = $"EXCEPTION on MachGroup.RemoveFromSupervisor: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
/// <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>
|
||||
@@ -423,23 +450,35 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
bool done = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var myStatusMapCtrl = new StatusMapController();
|
||||
try
|
||||
{
|
||||
// aggiorno
|
||||
localDbCtx
|
||||
var item2upd = localDbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
|
||||
.FirstOrDefault()
|
||||
.State = newState;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupNeedRedo, Value);
|
||||
.FirstOrDefault();
|
||||
if (item2upd != null)
|
||||
{
|
||||
item2upd.State = newState;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
myStatusMapCtrl.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupNeedRedo, Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on MachGroup.SetNeedRedo: req item was not found | ProdId {ProdId} | MachGroupId {MachGroupId} | newState {newState} | Value {Value}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on UpdateStatus: {exc}");
|
||||
string errMessage = $"EXCEPTION on MachGroup.SetNeedRedo: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
@@ -455,24 +494,36 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
bool done = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var item2update = localDbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.MachGroupDbId == updItem.MachGroupDbId)
|
||||
.SingleOrDefault();
|
||||
var myStatusMapCtrl = new StatusMapController();
|
||||
try
|
||||
{
|
||||
// update, vers 1...
|
||||
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
var item2update = localDbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.MachGroupDbId == updItem.MachGroupDbId)
|
||||
.SingleOrDefault();
|
||||
if (item2update != null)
|
||||
{
|
||||
// update, vers 1...
|
||||
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", updItem.Prod.ProdId, updItem.MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
myStatusMapCtrl.UpdateAction("", updItem.Prod.ProdId, updItem.MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on MachGroup.Update: req item was not found | ProdDbId {updItem.ProdDbId} | MachGroupId {updItem.MachGroupId} | ProdIndex {updItem.ProdIndex}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on Update: {exc}");
|
||||
string errMessage = $"EXCEPTION on MachGroup.Update: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
@@ -490,6 +541,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
bool done = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var myStatusMapCtrl = new StatusMapController();
|
||||
try
|
||||
{
|
||||
// aggiorno
|
||||
@@ -497,19 +549,27 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
.MachGroupList
|
||||
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
|
||||
.FirstOrDefault();
|
||||
|
||||
currRecord.DtEnd = DtEnd;
|
||||
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, DtEnd == DateTime.MinValue ? Core.StatusMapOpType.ResetPartEnd : Core.StatusMapOpType.PartEnd, "");
|
||||
if (currRecord != null)
|
||||
{
|
||||
currRecord.DtEnd = DtEnd;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
myStatusMapCtrl.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, DtEnd == DateTime.MinValue ? Core.StatusMapOpType.ResetPartEnd : Core.StatusMapOpType.PartEnd, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on MachGroup.UpdateEnd: req item was not found | ProdId {ProdId} | MachGroupId {MachGroupId} | DtEnd {DtEnd}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on UpdateStartEnd: {exc}");
|
||||
string errMessage = $"EXCEPTION on MachGroup.UpdateEnd: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
@@ -530,19 +590,29 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
try
|
||||
{
|
||||
// aggiorno
|
||||
localDbCtx
|
||||
var item2upd = localDbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
|
||||
.FirstOrDefault()
|
||||
.ProdIndex = newProdIndex;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
|
||||
done = true;
|
||||
.FirstOrDefault();
|
||||
if (item2upd != null)
|
||||
{
|
||||
item2upd.ProdIndex = newProdIndex;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on MachGroup.UpdateOrder: req item was not found | ProdId {ProdId} | MachGroupId {MachGroupId} | newProdIndex {newProdIndex}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on UpdateOrder: {exc}");
|
||||
string errMessage = $"EXCEPTION on MachGroup.UpdateOrder: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
@@ -561,6 +631,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
bool done = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var myStatusMapCtrl = new StatusMapController();
|
||||
try
|
||||
{
|
||||
// aggiorno
|
||||
@@ -568,19 +639,27 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
.MachGroupList
|
||||
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
|
||||
.FirstOrDefault();
|
||||
|
||||
currRecord.DtStart = DtStart;
|
||||
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, DtStart == DateTime.MinValue ? Core.StatusMapOpType.ResetPartStart : Core.StatusMapOpType.PartStart, "");
|
||||
if (currRecord != null)
|
||||
{
|
||||
currRecord.DtStart = DtStart;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
myStatusMapCtrl.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, DtStart == DateTime.MinValue ? Core.StatusMapOpType.ResetPartStart : Core.StatusMapOpType.PartStart, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on MachGroup.UpdateStart: req item was not found | ProdId {ProdId} | MachGroupId {MachGroupId} | DtStart {DtStart}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on UpdateStartEnd: {exc}");
|
||||
string errMessage = $"EXCEPTION on MachGroup.UpdateStart: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
@@ -599,6 +678,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
bool done = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var myStatusMapCtrl = new StatusMapController();
|
||||
try
|
||||
{
|
||||
// aggiorno
|
||||
@@ -606,19 +686,28 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
.MachGroupList
|
||||
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
|
||||
.FirstOrDefault();
|
||||
|
||||
currRecord.DtStart = DtStart;
|
||||
currRecord.DtEnd = DtEnd;
|
||||
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
|
||||
if (currRecord != null)
|
||||
{
|
||||
currRecord.DtStart = DtStart;
|
||||
currRecord.DtEnd = DtEnd;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
myStatusMapCtrl.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on MachGroup.UpdateStartEnd: req item was not found | ProdId {ProdId} | MachGroupId {MachGroupId} | DtStart {DtStart} | DtEnd {DtEnd}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on UpdateStartEnd: {exc}");
|
||||
string errMessage = $"EXCEPTION on MachGroup.UpdateStartEnd: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
@@ -635,67 +724,93 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
bool done = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var myStatusMapCtrl = new StatusMapController();
|
||||
try
|
||||
{
|
||||
// aggiorno
|
||||
localDbCtx
|
||||
var item2upd = localDbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
|
||||
.FirstOrDefault()
|
||||
.State = newState;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
|
||||
.FirstOrDefault();
|
||||
if (item2upd != null)
|
||||
{
|
||||
item2upd.State = newState;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
myStatusMapCtrl.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on MachGroup.UpdateStatus: req item was not found | ProdId {ProdId} | MachGroupId {MachGroupId} | newState {newState}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on UpdateStatus: {exc}");
|
||||
string errMessage = $"EXCEPTION on MachGroup.UpdateStatus: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set Supervisor & state for MachGroup
|
||||
/// </summary>
|
||||
/// <param name="ProdId"></param>
|
||||
/// <param name="MachGroupId"></param>
|
||||
/// <param name="SupervisorId"></param>
|
||||
/// <returns></returns>
|
||||
/// <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;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var myStatusMapCtrl = new StatusMapController();
|
||||
try
|
||||
{
|
||||
// aggiorno
|
||||
var currRecord = localDbCtx
|
||||
var item2upd = localDbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
|
||||
.FirstOrDefault();
|
||||
if (item2upd != null)
|
||||
{
|
||||
item2upd.SupervisorId = SupervisorId;
|
||||
item2upd.State = Core.ItemState.Assigned;
|
||||
|
||||
currRecord.SupervisorId = SupervisorId;
|
||||
currRecord.State = Core.ItemState.Assigned;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupAssignedToSupervisor, "");
|
||||
// aggiorno info sullo status
|
||||
myStatusMapCtrl.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupAssignedToSupervisor, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on MachGroup.UpdateSupervisor: req item was not found | ProdId {ProdId} | MachGroupId {MachGroupId} | SupervisorId {SupervisorId}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on UpdateSupervisor: {exc}");
|
||||
string errMessage = $"EXCEPTION on MachGroup.UpdateSupervisor: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
/// <summary>
|
||||
/// Istanza logger
|
||||
/// </summary>
|
||||
private NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -1,105 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
public class PartController : IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private DatabaseContext dbCtx;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Fields
|
||||
|
||||
public static PartController man = new PartController();
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public PartController()
|
||||
{
|
||||
// Initialize database context
|
||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
||||
}
|
||||
{ }
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Get BtlPartDBId by ProjId + PDN
|
||||
/// </summary>
|
||||
/// <param name="ProjId"></param>
|
||||
/// <param name="PDN"></param>
|
||||
/// <returns></returns>
|
||||
protected int FindBtlPart(int ProjId, int PDN)
|
||||
{
|
||||
int BtlPartDbId = 0;
|
||||
|
||||
#if false
|
||||
var currProj = dbCtx
|
||||
.ProjList
|
||||
.Where(x => x.ProjId == ProjId)
|
||||
.FirstOrDefault();
|
||||
|
||||
if (currProj != null)
|
||||
{
|
||||
var btlPart = dbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.ProjDbId == currProj.ProjDbId && x.PDN == PDN)
|
||||
.SingleOrDefault();
|
||||
|
||||
if (btlPart != null)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
@@ -108,12 +22,12 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <param name="corePart"></param>
|
||||
/// <param name="currMachGroupDbId"></param>
|
||||
/// <returns></returns>
|
||||
public static PartModel ConvertFromCore(Core.PartM corePart, int currMachGroupDbId)
|
||||
public PartModel ConvertFromCore(Core.PartM corePart, int currMachGroupDbId)
|
||||
{
|
||||
PartModel answ = new PartModel();
|
||||
if (corePart != null)
|
||||
{
|
||||
int BTLPartId = man.FindBtlPartByBPI(corePart.nProjId, corePart.nBTLPartId);
|
||||
int BTLPartId = FindBtlPartByBPI(corePart.nProjId, corePart.nBTLPartId);
|
||||
answ = new PartModel()
|
||||
{
|
||||
PartId = corePart.nPartId,
|
||||
@@ -151,24 +65,39 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public bool Delete(int ProdId, int MachGroupId, int PartId)
|
||||
{
|
||||
bool done = false;
|
||||
var item2del = dbCtx
|
||||
.PartList
|
||||
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
|
||||
.SingleOrDefault();
|
||||
try
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// 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}");
|
||||
var myStatusMapCtrl = new StatusMapController();
|
||||
var item2del = localDbCtx
|
||||
.PartList
|
||||
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
|
||||
.SingleOrDefault();
|
||||
|
||||
if (item2del != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Remove from database
|
||||
localDbCtx.PartList.Remove(item2del);
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
myStatusMapCtrl.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on Part.Delete: ProdId: {ProdId} | MachGroupId: {MachGroupId} | PartId: {PartId}{Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on Part.Delete (01): req item was not found | ProdId {ProdId} | MachGroupId {MachGroupId} | PartId {PartId}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
@@ -181,22 +110,36 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public bool Delete(int PartDbId)
|
||||
{
|
||||
bool done = false;
|
||||
var item2del = dbCtx
|
||||
.PartList
|
||||
.Where(x => x.PartDbId == PartDbId)
|
||||
.SingleOrDefault();
|
||||
try
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// Add to database
|
||||
dbCtx.PartList.Remove(item2del);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on Delete: {exc}");
|
||||
var item2del = localDbCtx
|
||||
.PartList
|
||||
.Where(x => x.PartDbId == PartDbId)
|
||||
.SingleOrDefault();
|
||||
|
||||
if (item2del != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
localDbCtx.PartList.Remove(item2del);
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on Part.Delete: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on Part.Delete (02): req item was not found | PartDbId {PartDbId}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
@@ -209,29 +152,31 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public bool DeleteByMachGroup(int MachGroupDbId)
|
||||
{
|
||||
bool done = false;
|
||||
var items2del = dbCtx
|
||||
.PartList
|
||||
.Where(x => x.MachGroupDbId == MachGroupDbId);
|
||||
try
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// Add to database
|
||||
dbCtx.PartList.RemoveRange(items2del);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on DeleteByMachGroup: {exc}");
|
||||
var items2del = localDbCtx
|
||||
.PartList
|
||||
.Where(x => x.MachGroupDbId == MachGroupDbId);
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
localDbCtx.PartList.RemoveRange(items2del);
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on Part.DeleteByMachGroup: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database context
|
||||
dbCtx.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -241,10 +186,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public PartModel FindByDbId(int PartDbId)
|
||||
{
|
||||
return dbCtx
|
||||
.PartList
|
||||
.Where(x => x.PartDbId == PartDbId)
|
||||
.SingleOrDefault();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
return localDbCtx
|
||||
.PartList
|
||||
.Where(x => x.PartDbId == PartDbId)
|
||||
.SingleOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -255,9 +203,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public PartModel FindByPartId(int ProdId, int PartId)
|
||||
{
|
||||
PartModel answ = null;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
using (DatabaseContext locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
answ = localDbCtx
|
||||
answ = locallocalDbCtx
|
||||
.PartList
|
||||
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.PartId == PartId)
|
||||
.FirstOrDefault();
|
||||
@@ -265,15 +213,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reinizializzaizone del controller
|
||||
/// </summary>
|
||||
public void ResetController()
|
||||
{
|
||||
// Re-Initialize database context
|
||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update single Part
|
||||
/// </summary>
|
||||
@@ -282,29 +221,43 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public bool Update(PartModel updItem)
|
||||
{
|
||||
bool done = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
using (DatabaseContext locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var item2update = localDbCtx
|
||||
var myStatusMapCtrl = new StatusMapController();
|
||||
var item2upd = locallocalDbCtx
|
||||
.PartList
|
||||
.Where(x => x.PartDbId == updItem.PartDbId)
|
||||
.SingleOrDefault();
|
||||
try
|
||||
if (item2upd != null)
|
||||
{
|
||||
// update, vers 1...
|
||||
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
try
|
||||
{
|
||||
// update, vers 1...
|
||||
locallocalDbCtx.Entry(item2upd).CurrentValues.SetValues(updItem);
|
||||
|
||||
//// update, vers 2
|
||||
//dbCtx.PartList.Remove(item2del);
|
||||
//dbCtx.PartList.Add(updItem);
|
||||
//// update, vers 2
|
||||
//localDbCtx.PartList.Remove(item2del);
|
||||
//localDbCtx.PartList.Add(updItem);
|
||||
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", updItem.MachGroup.Prod.ProdId, updItem.PartId, Core.StatusMapItemType.Part, Core.StatusMapOpType.MachGroupMod, "");
|
||||
// Commit changes
|
||||
locallocalDbCtx.SaveChanges();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
myStatusMapCtrl.UpdateAction("", updItem.MachGroup.Prod.ProdId, updItem.PartId, Core.StatusMapItemType.Part, Core.StatusMapOpType.MachGroupMod, "");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on Part.Update: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on Part.Update (01): req item was not found | PartId {updItem.PartId} | PartDbId {updItem.PartDbId} | BTLPartDbId {updItem.BTLPartDbId}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return done;
|
||||
}
|
||||
@@ -318,25 +271,38 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public bool UpdateEnd(int ProdId, int MachGroupId, int PartId, DateTime DtEnd)
|
||||
{
|
||||
bool done = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
using (DatabaseContext locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var myStatusMapCtrl = new StatusMapController();
|
||||
try
|
||||
{
|
||||
// aggiorno
|
||||
localDbCtx
|
||||
var item2upd = locallocalDbCtx
|
||||
.PartList
|
||||
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
|
||||
.FirstOrDefault()
|
||||
.DtEnd = DtEnd;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", ProdId, PartId, Core.StatusMapItemType.Part, DtEnd == DateTime.MinValue ? Core.StatusMapOpType.ResetPartEnd : Core.StatusMapOpType.PartEnd, "");
|
||||
.FirstOrDefault();
|
||||
|
||||
if (item2upd != null)
|
||||
{
|
||||
item2upd.DtEnd = DtEnd;
|
||||
// Commit changes
|
||||
locallocalDbCtx.SaveChanges();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
myStatusMapCtrl.UpdateAction("", ProdId, PartId, Core.StatusMapItemType.Part, DtEnd == DateTime.MinValue ? Core.StatusMapOpType.ResetPartEnd : Core.StatusMapOpType.PartEnd, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on Part.UpdateEnd: req item was not found | ProdId {ProdId} | MachGroupId {MachGroupId} | PartId {PartId} | DtEnd {DtEnd}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on UpdateStatus: {exc}");
|
||||
string errMessage = $"EXCEPTION on Part.UpdateEnd: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
@@ -351,25 +317,37 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public bool UpdateStart(int ProdId, int MachGroupId, int PartId, DateTime DtStart)
|
||||
{
|
||||
bool done = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
using (DatabaseContext locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var myStatusMapCtrl = new StatusMapController();
|
||||
try
|
||||
{
|
||||
// aggiorno
|
||||
localDbCtx
|
||||
var item2upd = locallocalDbCtx
|
||||
.PartList
|
||||
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
|
||||
.FirstOrDefault()
|
||||
.DtStart = DtStart;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", ProdId, PartId, Core.StatusMapItemType.Part, DtStart == DateTime.MinValue ? Core.StatusMapOpType.ResetPartStart : Core.StatusMapOpType.PartStart, "");
|
||||
.FirstOrDefault();
|
||||
if (item2upd != null)
|
||||
{
|
||||
item2upd.DtStart = DtStart;
|
||||
// Commit changes
|
||||
locallocalDbCtx.SaveChanges();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
myStatusMapCtrl.UpdateAction("", ProdId, PartId, Core.StatusMapItemType.Part, DtStart == DateTime.MinValue ? Core.StatusMapOpType.ResetPartStart : Core.StatusMapOpType.PartStart, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on Part.UpdateStart: req item was not found | ProdId {ProdId} | MachGroupId {MachGroupId} | PartId {PartId} | DtStart {DtStart}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on UpdateStatus: {exc}");
|
||||
string errMessage = $"EXCEPTION on Part.UpdateStart: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -385,25 +363,37 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public bool UpdateStatus(int ProdId, int MachGroupId, int PartId, Core.ItemState newState)
|
||||
{
|
||||
bool done = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
using (DatabaseContext locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var myStatusMapCtrl = new StatusMapController();
|
||||
try
|
||||
{
|
||||
// aggiorno
|
||||
localDbCtx
|
||||
var item2upd = locallocalDbCtx
|
||||
.PartList
|
||||
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
|
||||
.FirstOrDefault()
|
||||
.State = newState;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", ProdId, PartId, Core.StatusMapItemType.Part, Core.StatusMapOpType.MachGroupMod, "");
|
||||
.FirstOrDefault();
|
||||
if (item2upd != null)
|
||||
{
|
||||
item2upd.State = newState;
|
||||
// Commit changes
|
||||
locallocalDbCtx.SaveChanges();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
myStatusMapCtrl.UpdateAction("", ProdId, PartId, Core.StatusMapItemType.Part, newState == Core.ItemState.Scrapped ? Core.StatusMapOpType.SetPartScrapped : Core.StatusMapOpType.MachGroupMod, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on Part.UpdateStart: req item was not found | ProdId {ProdId} | MachGroupId {MachGroupId} | PartId {PartId} | newState {newState}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on UpdateStatus: {exc}");
|
||||
string errMessage = $"EXCEPTION on Part.UpdateStatus: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -411,5 +401,68 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Get BtlPartDBId by ProjId + PDN
|
||||
/// </summary>
|
||||
/// <param name="ProjId"></param>
|
||||
/// <param name="PDN"></param>
|
||||
/// <returns></returns>
|
||||
protected int FindBtlPart(int ProjId, int PDN)
|
||||
{
|
||||
int BtlPartDbId = 0;
|
||||
|
||||
using (DatabaseContext locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var btlPart = locallocalDbCtx
|
||||
.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;
|
||||
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var btlPart = localDbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.Project.ProjId == ProjId && x.PartId == BtlPartId)
|
||||
.SingleOrDefault();
|
||||
|
||||
if (btlPart != null)
|
||||
{
|
||||
BtlPartDbId = btlPart.BTLPartDbId;
|
||||
}
|
||||
}
|
||||
return BtlPartDbId;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
/// <summary>
|
||||
/// Istanza logger
|
||||
/// </summary>
|
||||
private NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,5 @@
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -7,27 +8,10 @@ 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
|
||||
@@ -37,7 +21,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <summary>
|
||||
/// Elimina i dati di una sessione (SupervisorId) precedente
|
||||
/// </summary>
|
||||
/// <param name="Session">Se vuoto --> tutti</param>
|
||||
/// <param name="Session">Se vuoto --> tutti</param>
|
||||
/// <returns></returns>
|
||||
public bool DeleteSession(string Session)
|
||||
{
|
||||
@@ -45,41 +29,42 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
DateTime adesso = DateTime.Now;
|
||||
List<StatusMapModel> SM2Del = new List<StatusMapModel>();
|
||||
|
||||
// svuoto la tab mappa precedente (da rivalutare in futuro)
|
||||
if (string.IsNullOrEmpty(Session))
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
SM2Del = dbCtx
|
||||
.StatusMapList
|
||||
.ToList();
|
||||
// svuoto la tab mappa precedente (da rivalutare in futuro)
|
||||
if (string.IsNullOrEmpty(Session))
|
||||
{
|
||||
SM2Del = localDbCtx
|
||||
.StatusMapList
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SM2Del = localDbCtx
|
||||
.StatusMapList
|
||||
.Where(x => x.Session == Session)
|
||||
.ToList();
|
||||
}
|
||||
try
|
||||
{
|
||||
// Remove to database
|
||||
localDbCtx.StatusMapList.RemoveRange(SM2Del);
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on StatusMap.DeleteSession: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
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>
|
||||
@@ -87,44 +72,51 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// </summary>
|
||||
/// <param name="Session"></param>
|
||||
/// <returns></returns>
|
||||
public List<StatusMapModel> GetBySession(string Session = "")
|
||||
public List<StatusMapModel> GetBySession(string Session)
|
||||
{
|
||||
// retrieve
|
||||
return dbCtx
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// retrieve
|
||||
return localDbCtx
|
||||
.StatusMapList
|
||||
.Where(x => x.Session == Session)
|
||||
.OrderByDescending(x => x.Index)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get data for session where Index > minIndex ordered by index DESC
|
||||
/// Get data for session where Index > minIndex ordered by index DESC
|
||||
/// </summary>
|
||||
/// <param name="Session"></param>
|
||||
/// <param name="minIndex"></param>
|
||||
/// <returns></returns>
|
||||
public List<StatusMapModel> GetFrom(int minIndex = 0)
|
||||
public List<StatusMapModel> GetFrom(string Session, int minIndex = 0)
|
||||
{
|
||||
ResetController();
|
||||
// retrieve
|
||||
return dbCtx
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// retrieve
|
||||
return localDbCtx
|
||||
.StatusMapList
|
||||
.Where(x => x.Index >= minIndex)
|
||||
.Where(x => x.Session == Session && x.Index >= minIndex)
|
||||
.OrderBy(x => x.Index)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get PROD data for session
|
||||
/// Get PROD (all)
|
||||
/// </summary>
|
||||
/// <param name="Session"></param>
|
||||
/// <returns></returns>
|
||||
public List<StatusMapModel> GetProd()
|
||||
{
|
||||
List<StatusMapModel> answ = new List<StatusMapModel>();
|
||||
// Initialize database context
|
||||
using (DatabaseContext myDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// retrieve
|
||||
answ = myDbCtx
|
||||
answ = localDbCtx
|
||||
.StatusMapList
|
||||
.Where(x => x.ItemType == Core.StatusMapItemType.Prod)
|
||||
.OrderByDescending(x => x.Index)
|
||||
@@ -134,12 +126,24 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reinizializzaizone del controller
|
||||
/// Get PROD for session
|
||||
/// </summary>
|
||||
public void ResetController()
|
||||
/// <param name="Session"></param>
|
||||
/// <returns></returns>
|
||||
public List<StatusMapModel> GetProd(string Session)
|
||||
{
|
||||
// Re-Initialize database context
|
||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
||||
List<StatusMapModel> answ = new List<StatusMapModel>();
|
||||
// Initialize database context
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// retrieve
|
||||
answ = localDbCtx
|
||||
.StatusMapList
|
||||
.Where(x => x.Session == Session && x.ItemType == Core.StatusMapItemType.Prod)
|
||||
.OrderByDescending(x => x.Index)
|
||||
.ToList();
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -163,22 +167,25 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
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);
|
||||
// Initialize database context
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// aggiungo
|
||||
localDbCtx.StatusMapList.Add(prodSMRecord);
|
||||
|
||||
// recupero MachGroup da PROD
|
||||
var MGList = dbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.Prod.ProdId == ProdId)
|
||||
.ToList();
|
||||
// recupero MachGroup da PROD
|
||||
var MGList = localDbCtx
|
||||
.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);
|
||||
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
|
||||
localDbCtx.StatusMapList.AddRange(mgSMRecords);
|
||||
|
||||
// salvo
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
// salvo
|
||||
localDbCtx.SaveChanges();
|
||||
}
|
||||
done = true;
|
||||
}
|
||||
return done;
|
||||
@@ -194,56 +201,70 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <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)
|
||||
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 == "")
|
||||
// Initialize database context
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
prodData = dbCtx
|
||||
.StatusMapList
|
||||
.Where(x => x.ItemType == Core.StatusMapItemType.Prod && x.ItemId == ProdId)
|
||||
.FirstOrDefault();
|
||||
}
|
||||
else
|
||||
{
|
||||
prodData = dbCtx
|
||||
.StatusMapList
|
||||
.Where(x => x.ItemType == Core.StatusMapItemType.Prod && x.Session == Session)
|
||||
.FirstOrDefault();
|
||||
}
|
||||
// se ho trovato
|
||||
if (prodData != null)
|
||||
{
|
||||
try
|
||||
// se è un prod --> vado x ID
|
||||
if (Session == "")
|
||||
{
|
||||
// aggiorno indice PROD
|
||||
prodData.Index++;
|
||||
// se session è nulla ma ho un PROD --> calcolo da li la sessione
|
||||
if (string.IsNullOrEmpty(Session))
|
||||
{
|
||||
Session = prodData.Session;
|
||||
}
|
||||
// creo un nuovo record
|
||||
DateTime adesso = DateTime.Now;
|
||||
var newRec = new StatusMapModel() { Session = Session, Index = prodData.Index, ItemId = ItemId, ItemType = ItemType, Operation = Operation, DtEvent = adesso, Val = Value };
|
||||
dbCtx.StatusMapList.Add(newRec);
|
||||
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
fatto = true;
|
||||
prodData = localDbCtx
|
||||
.StatusMapList
|
||||
.Where(x => x.ItemType == Core.StatusMapItemType.Prod && x.ItemId == ProdId)
|
||||
.FirstOrDefault();
|
||||
}
|
||||
catch (Exception exc)
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on UpdateAction: {exc}");
|
||||
prodData = localDbCtx
|
||||
.StatusMapList
|
||||
.Where(x => x.ItemType == Core.StatusMapItemType.Prod && x.Session == Session)
|
||||
.FirstOrDefault();
|
||||
}
|
||||
// se ho trovato
|
||||
if (prodData != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
// aggiorno indice PROD
|
||||
prodData.Index++;
|
||||
// se session è nulla ma ho un PROD --> calcolo da li la sessione
|
||||
if (string.IsNullOrEmpty(Session))
|
||||
{
|
||||
Session = prodData.Session;
|
||||
}
|
||||
// creo un nuovo record
|
||||
DateTime adesso = DateTime.Now;
|
||||
var newRec = new StatusMapModel() { Session = Session, Index = prodData.Index, ItemId = ItemId, ItemType = ItemType, Operation = Operation, DtEvent = adesso, Val = Value };
|
||||
localDbCtx.StatusMapList.Add(newRec);
|
||||
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on StatusMap.UpdateAction: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
/// <summary>
|
||||
/// Istanza logger
|
||||
/// </summary>
|
||||
private NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
using MySql.Data.EntityFramework;
|
||||
using System;
|
||||
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;
|
||||
using System.IO;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer
|
||||
{
|
||||
@@ -33,15 +27,13 @@ namespace EgtBEAMWALL.DataLayer
|
||||
#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 DatabaseContext() : base("DefaultConnection")
|
||||
public DatabaseContext() : base(DbConfig.CONNECTION_STRING)
|
||||
{
|
||||
}
|
||||
|
||||
public DatabaseContext(string connectionString) : base(connectionString)
|
||||
{
|
||||
//Database.CreateIfNotExists();
|
||||
////Database.SetInitializer(new MigrateDatabaseToLatestVersion<StratonLocalizerDatabase, Migrations.Configuration>());
|
||||
//Database.Initialize(false);
|
||||
Database.CreateIfNotExists();
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
@@ -90,24 +82,6 @@ namespace EgtBEAMWALL.DataLayer
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
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 "";
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public static DatabaseContext Create()
|
||||
@@ -115,44 +89,6 @@ namespace EgtBEAMWALL.DataLayer
|
||||
return new DatabaseContext(DbConfig.CONNECTION_STRING);
|
||||
}
|
||||
|
||||
public static bool SetUpDbConnectionAndDbConfig()
|
||||
{
|
||||
try
|
||||
{
|
||||
String serviceName = getDbServiceName();
|
||||
if (serviceName.Equals(""))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ServiceController service = new ServiceController(serviceName);
|
||||
try
|
||||
{
|
||||
TimeSpan timeout = TimeSpan.FromSeconds(DbConfig.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;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -98,12 +98,5 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// MachineId del BTL
|
||||
/// </summary>
|
||||
[Column("MachineId")]
|
||||
public string MachineId { get; set; } = "";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -97,6 +97,8 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
if (!(obj is PartModel item))
|
||||
return false;
|
||||
|
||||
if (BTLPartDbId != item.BTLPartDbId)
|
||||
return false;
|
||||
if (H != item.H)
|
||||
return false;
|
||||
if (L != item.L)
|
||||
|
||||
@@ -32,11 +32,23 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
public bool IsNew { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Stato locked (quando aperto da un dispositivo in rete)
|
||||
/// Stato locked, quando aperto da un dispositivo in rete
|
||||
/// </summary>
|
||||
[Column("Lock")]
|
||||
public bool Locked { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// ID utente che ha bloccato (NumKey), quando aperto da un dispositivo in rete
|
||||
/// </summary>
|
||||
[Column("LockedBy")]
|
||||
public string LockedBy { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// DataOra ultima operazione di Lock (o di rimozione di lock), quando aperto da un dispositivo in rete
|
||||
/// </summary>
|
||||
[Column("LockDate")]
|
||||
public DateTime LockDate { get; set; } = DateTime.MinValue;
|
||||
|
||||
/// <summary>
|
||||
/// Macchina
|
||||
/// </summary>
|
||||
|
||||
@@ -49,6 +49,18 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
[Column("Lock")]
|
||||
public bool Locked { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// ID utente che ha bloccato (NumKey), quando aperto da un dispositivo in rete
|
||||
/// </summary>
|
||||
[Column("LockedBy")]
|
||||
public string LockedBy { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// DataOra ultima operazione di Lock (o di rimozione di lock), quando aperto da un dispositivo in rete
|
||||
/// </summary>
|
||||
[Column("LockDate")]
|
||||
public DateTime LockDate { get; set; } = DateTime.MinValue;
|
||||
|
||||
/// <summary>
|
||||
/// Macchina
|
||||
/// </summary>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Diagnostics;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer
|
||||
{
|
||||
@@ -37,24 +37,103 @@ namespace EgtBEAMWALL.DataLayer
|
||||
|
||||
#region Public Methods
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Metodo di init standard per DB locale
|
||||
/// Effettua migrazione esplicita del DB
|
||||
/// </summary>
|
||||
/// <param name="server">Indirizzo del server (tipicamente localhost/127.0.0.1)</param>
|
||||
/// <param name="nKey">Numero chiave</param>
|
||||
/// <param name="sKey">Codice/pwd associato a chaive</param>
|
||||
public static void InitDb(string server, string nKey, string sKey)
|
||||
/// <returns></returns>
|
||||
public static bool CheckMigrateDb()
|
||||
{
|
||||
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;CHARSET=utf8";
|
||||
}
|
||||
#endif
|
||||
// esecuzione script di migrations del DB
|
||||
return Controllers.DbController.man.checkMigrateDb();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua verifica presenza utente
|
||||
/// </summary>
|
||||
/// <param name="nKey"></param>
|
||||
/// <param name="sKey"></param>
|
||||
/// <param name="isNetwork"></param>
|
||||
/// <returns></returns>
|
||||
public static bool CheckUser(string nKey, string sKey, bool isNetwork)
|
||||
{
|
||||
// esecuzione script di install locale
|
||||
return Controllers.DbController.man.checkCreateUser(DATABASE_USER, DATABASE_PWD, isNetwork);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua verifica presenza view prod + relativo utente
|
||||
/// </summary>
|
||||
/// <param name="nKey"></param>
|
||||
/// <param name="sKey"></param>
|
||||
/// <param name="isNetwork"></param>
|
||||
/// <returns></returns>
|
||||
public static bool CheckViews(string nKey, string sKey)
|
||||
{
|
||||
// esecuzione script di install locale
|
||||
return Controllers.DbController.man.refreshViews(DATABASE_NAME);
|
||||
}
|
||||
/// <summary>
|
||||
/// Effettua DUMP del DB dato utente admin + percorso salvataggio
|
||||
/// </summary>
|
||||
/// <param name="outFilePath">Percorso di salvataggio del dump (*.sql)</param>
|
||||
/// <returns></returns>
|
||||
public static bool DumpDB(string mysqlDumpPath, string outFilePath)
|
||||
{
|
||||
bool fatto = false;
|
||||
// aggiungo sql finale
|
||||
if (!outFilePath.EndsWith(".sql"))
|
||||
{
|
||||
outFilePath = $"{outFilePath}.sql";
|
||||
}
|
||||
// esecuzione script x dump del DB
|
||||
string dirPath = Path.GetDirectoryName(outFilePath);
|
||||
if (!Directory.Exists(dirPath))
|
||||
{
|
||||
Directory.CreateDirectory(dirPath);
|
||||
}
|
||||
// se ci fosse già file elimino...
|
||||
if (File.Exists(outFilePath))
|
||||
{
|
||||
File.Delete(outFilePath);
|
||||
}
|
||||
// chiamo script esterno...
|
||||
string callScript = $"\"{mysqlDumpPath}\" -u{DATABASE_USER} -p{DATABASE_PWD} {DATABASE_NAME} > {outFilePath}";
|
||||
ExecuteCommand(callScript);
|
||||
return fatto;
|
||||
}
|
||||
/// <summary>
|
||||
/// Esecuzione di un comando esterno
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
public static void ExecuteCommand(string command)
|
||||
{
|
||||
int exitCode;
|
||||
ProcessStartInfo processInfo;
|
||||
Process process;
|
||||
|
||||
processInfo = new ProcessStartInfo("cmd.exe", "/c " + command);
|
||||
processInfo.CreateNoWindow = true;
|
||||
processInfo.UseShellExecute = false;
|
||||
// *** Redirect the output ***
|
||||
processInfo.RedirectStandardError = true;
|
||||
processInfo.RedirectStandardOutput = true;
|
||||
|
||||
process = Process.Start(processInfo);
|
||||
process.WaitForExit();
|
||||
|
||||
// *** Read the streams ***
|
||||
// Warning: This approach can lead to deadlocks, see Edit #2
|
||||
string output = process.StandardOutput.ReadToEnd();
|
||||
string error = process.StandardError.ReadToEnd();
|
||||
|
||||
exitCode = process.ExitCode;
|
||||
|
||||
Console.WriteLine("output>>" + (String.IsNullOrEmpty(output) ? "(none)" : output));
|
||||
Console.WriteLine("error>>" + (String.IsNullOrEmpty(error) ? "(none)" : error));
|
||||
Console.WriteLine("ExitCode: " + exitCode.ToString(), "ExecuteCommand");
|
||||
process.Close();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Metodo di init standard per DB in rete con Master_Key
|
||||
@@ -71,15 +150,27 @@ namespace EgtBEAMWALL.DataLayer
|
||||
DATABASE_NAME = $"EgtBwDb_{masterKey}";
|
||||
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";
|
||||
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;CHARSET=utf8";
|
||||
ADMIN_CONNECTION_STRING = $"server={DATABASE_SERV};port=3306;database=mysql;uid=root;pwd=Egalware_24068!;SslMode=none;CHARSET=utf8";
|
||||
}
|
||||
|
||||
public static bool CheckUser(string nKey, string sKey, bool isNetwork)
|
||||
/// <summary>
|
||||
/// Aggiorna conf NLog x target DIR
|
||||
/// </summary>
|
||||
/// <param name="logDir"></param>
|
||||
public static void SetupLogDir(string logDir)
|
||||
{
|
||||
// esecuzione script di install locale
|
||||
return Controllers.DbController.man.checkCreateUser(DATABASE_USER, DATABASE_PWD, isNetwork);
|
||||
string appDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||
string filePath = Path.Combine(appDir, "NLog.config");
|
||||
// leggo il file NLog
|
||||
string rawData = File.ReadAllText(filePath);
|
||||
|
||||
// sostituzione livello minimo da selezione
|
||||
rawData = rawData.Replace("${basedir}", logDir);
|
||||
|
||||
// ri-scrivo file NLog
|
||||
File.WriteAllText(filePath, rawData);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
@@ -9,7 +9,6 @@ namespace EgtBEAMWALL.DataLayer
|
||||
{
|
||||
#region Public Fields
|
||||
|
||||
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();
|
||||
|
||||
@@ -37,8 +37,11 @@
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="BouncyCastle.Crypto, Version=1.9.0.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Portable.BouncyCastle.1.9.0\lib\net40\BouncyCastle.Crypto.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EgtWPFLib5">
|
||||
<HintPath>..\..\..\EgtProg\DllD32\EgtWPFLib5.dll</HintPath>
|
||||
<HintPath>..\ExtLibs\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>
|
||||
@@ -46,16 +49,37 @@
|
||||
<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 Include="Google.Protobuf, Version=3.21.9.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Google.Protobuf.3.21.9\lib\net45\Google.Protobuf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="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 Include="K4os.Compression.LZ4, Version=1.3.5.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\K4os.Compression.LZ4.1.3.5\lib\net462\K4os.Compression.LZ4.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="K4os.Compression.LZ4.Streams, Version=1.3.5.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\K4os.Compression.LZ4.Streams.1.3.5\lib\net462\K4os.Compression.LZ4.Streams.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="K4os.Hash.xxHash, Version=1.0.8.0, Culture=neutral, PublicKeyToken=32cd54395057cec3, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\K4os.Hash.xxHash.1.0.8\lib\net462\K4os.Hash.xxHash.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MySql.Data, Version=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MySql.Data.8.0.21\lib\net452\MySql.Data.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MySql.Data.EntityFramework, Version=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MySql.Data.EntityFramework.8.0.21\lib\net452\MySql.Data.EntityFramework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.5.0.1\lib\net46\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Renci.SshNet, Version=2016.1.0.0, Culture=neutral, PublicKeyToken=1cee9f8bde3db106, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SSH.NET.2016.1.0\lib\net40\Renci.SshNet.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.ComponentModel" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Configuration" />
|
||||
@@ -63,16 +87,39 @@
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Drawing.Design" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<Reference Include="System.IO.Pipelines, Version=5.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.IO.Pipelines.5.0.2\lib\net461\System.IO.Pipelines.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Management" />
|
||||
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.ServiceProcess" />
|
||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Transactions" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Ubiety.Dns.Core, Version=2.2.1.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MySql.Data.8.0.21\lib\net452\Ubiety.Dns.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Zstandard.Net, Version=1.1.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MySql.Data.8.0.21\lib\net452\Zstandard.Net.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AdminContext.cs" />
|
||||
@@ -121,12 +168,19 @@
|
||||
<Compile Include="Migrations\202109141058345_AddMachine2ProjProd.designer.cs">
|
||||
<DependentUpon>202109141058345_AddMachine2ProjProd.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202207051703296_UpgradeLockModel.cs" />
|
||||
<Compile Include="Migrations\202207051703296_UpgradeLockModel.designer.cs">
|
||||
<DependentUpon>202207051703296_UpgradeLockModel.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\Configuration.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Utils.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="NLog.config">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -154,6 +208,9 @@
|
||||
<EmbeddedResource Include="Migrations\202109141058345_AddMachine2ProjProd.resx">
|
||||
<DependentUpon>202109141058345_AddMachine2ProjProd.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202207051703296_UpgradeLockModel.resx">
|
||||
<DependentUpon>202207051703296_UpgradeLockModel.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
|
||||
+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 UpgradeLockModel : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(UpgradeLockModel));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "202207051703296_UpgradeLockModel"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class UpgradeLockModel : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("dbo.ProjList", "LockedBy", c => c.String(unicode: false, nullable: false, defaultValueSql:""));
|
||||
AddColumn("dbo.ProjList", "LockDate", c => c.DateTime(nullable: false, precision: 0, defaultValueSql: "DATE('1900-01-01')"));
|
||||
AddColumn("dbo.ProdList", "LockedBy", c => c.String(unicode: false, nullable: false, defaultValueSql: ""));
|
||||
AddColumn("dbo.ProdList", "LockDate", c => c.DateTime(nullable: false, precision: 0, defaultValueSql: "DATE('1900-01-01')"));
|
||||
//AddColumn("dbo.ProjList", "LockedBy", c => c.String(unicode: false));
|
||||
//AddColumn("dbo.ProjList", "LockDate", c => c.DateTime(nullable: false, precision: 0, defaultValueSql: "DATE('1900 - 01 - 01')"));
|
||||
//AddColumn("dbo.ProdList", "LockedBy", c => c.String(unicode: false));
|
||||
//AddColumn("dbo.ProdList", "LockDate", c => c.DateTime(nullable: false, precision: 0, defaultValueSql: "DATE('1900 - 01 - 01')"));
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropColumn("dbo.ProdList", "LockDate");
|
||||
DropColumn("dbo.ProdList", "LockedBy");
|
||||
DropColumn("dbo.ProjList", "LockDate");
|
||||
DropColumn("dbo.ProjList", "LockedBy");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -1,9 +1,6 @@
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Linq;
|
||||
|
||||
internal sealed class Configuration : DbMigrationsConfiguration<EgtBEAMWALL.DataLayer.DatabaseContext>
|
||||
{
|
||||
@@ -12,7 +9,6 @@ namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
public Configuration()
|
||||
{
|
||||
AutomaticMigrationsEnabled = true;
|
||||
//AutomaticMigrationsEnabled = false;
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
@@ -21,18 +17,14 @@ namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
|
||||
protected override void Seed(EgtBEAMWALL.DataLayer.DatabaseContext context)
|
||||
{
|
||||
// This method will be called after migrating to the latest version.
|
||||
// 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. E.g.
|
||||
//
|
||||
// context.People.AddOrUpdate(
|
||||
// p => p.FullName,
|
||||
// new Person { FullName = "Andrew Peters" },
|
||||
// new Person { FullName = "Brice Lambson" },
|
||||
// new Person { FullName = "Rowan Miller" }
|
||||
// );
|
||||
// You can use the DbSet<T>.AddOrUpdate() helper extension method to avoid creating
|
||||
// duplicate seed data. E.g.
|
||||
//
|
||||
// context.People.AddOrUpdate( p => p.FullName, new Person { FullName = "Andrew Peters"
|
||||
// }, new Person { FullName = "Brice Lambson" }, new Person { FullName = "Rowan Miller"
|
||||
// } );
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
|
||||
autoReload="true"
|
||||
throwExceptions="false"
|
||||
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
|
||||
|
||||
<variable name="logDir" value="${basedir}"/>
|
||||
<targets>
|
||||
<target xsi:type="File"
|
||||
name="f_base"
|
||||
fileName="${logDir}/${shortdate}.log"
|
||||
layout="${longdate} [${uppercase:${level}}] ${logger:shortName=true}|${message}"
|
||||
archiveFileName="${logDir}/${shortdate}.{###}.log"
|
||||
archiveNumbering="Sequence"
|
||||
archiveAboveSize="10240000"
|
||||
maxArchiveFiles="60"
|
||||
enableArchiveFileCompression="false"
|
||||
keepFileOpen="false"
|
||||
/>
|
||||
<target xsi:type="File"
|
||||
name="f_error"
|
||||
fileName="${logDir}/${shortdate}_err.log"
|
||||
layout="${longdate} [${uppercase:${level}}] ${logger:shortName=true}|${message}${newline}${exception:format=tostring}"
|
||||
archiveFileName="${logDir}/${shortdate}_err.{###}.log"
|
||||
archiveNumbering="Sequence"
|
||||
archiveAboveSize="10240000"
|
||||
maxArchiveFiles="60"
|
||||
enableArchiveFileCompression="false"
|
||||
keepFileOpen="false"
|
||||
/>
|
||||
</targets>
|
||||
<rules>
|
||||
<!-- Logging Levels (Trace, Debug, Info, Warn, Error, Fatal)-->
|
||||
<logger name="*" minlevel="Info" maxlevel="Warn" final="true" writeTo="f_base" />
|
||||
<logger name="*" minlevel="Error" writeTo="f_error" />
|
||||
</rules>
|
||||
</nlog>
|
||||
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Egalware s.r.l.")]
|
||||
[assembly: AssemblyProduct("EgtBEAMWALL.DataLayer")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2020-2022 by Egalware s.r.l.")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2020-2023 by Egalware s.r.l.")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
@@ -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.4.3.2")]
|
||||
[assembly: AssemblyFileVersion("2.4.3.2")]
|
||||
[assembly: AssemblyVersion("2.5.5.4")]
|
||||
[assembly: AssemblyFileVersion("2.5.5.4")]
|
||||
|
||||
@@ -1,7 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="BouncyCastle" version="1.8.5" targetFramework="net472" />
|
||||
<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="Google.Protobuf" version="3.21.9" targetFramework="net472" />
|
||||
<package id="K4os.Compression.LZ4" version="1.3.5" targetFramework="net472" />
|
||||
<package id="K4os.Compression.LZ4.Streams" version="1.3.5" targetFramework="net472" />
|
||||
<package id="K4os.Hash.xxHash" version="1.0.8" targetFramework="net472" />
|
||||
<package id="MySql.Data" version="8.0.21" targetFramework="net472" />
|
||||
<package id="MySql.Data.EntityFramework" version="8.0.21" targetFramework="net472" />
|
||||
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net452" />
|
||||
<package id="NLog" version="5.0.1" targetFramework="net472" />
|
||||
<package id="Portable.BouncyCastle" version="1.9.0" targetFramework="net472" />
|
||||
<package id="SSH.NET" version="2016.1.0" targetFramework="net472" />
|
||||
<package id="System.Buffers" version="4.5.1" targetFramework="net472" />
|
||||
<package id="System.IO.Pipelines" version="5.0.2" targetFramework="net472" />
|
||||
<package id="System.Memory" version="4.5.5" targetFramework="net472" />
|
||||
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net472" />
|
||||
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
|
||||
</packages>
|
||||
@@ -8,7 +8,7 @@
|
||||
<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6"/>
|
||||
<providers>
|
||||
|
||||
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"></provider>
|
||||
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"></provider>
|
||||
</providers>
|
||||
</entityFramework>
|
||||
<connectionStrings>
|
||||
|
||||
@@ -35,8 +35,20 @@
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="EgtUILib, Version=2.4.6.1, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EgtWPFLib5.2.4.7.1\lib\EgtUILib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EgtWPFLib, Version=2.4.5.1, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EgtWPFLib5.2.4.7.1\lib\EgtWPFLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EgtWPFLib5, Version=2.4.7.1, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EgtWPFLib5.2.4.7.1\lib\EgtWPFLib5.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Windows.Interactivity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EgtWPFLib5.2.4.7.1\lib\System.Windows.Interactivity.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
@@ -71,6 +83,7 @@
|
||||
<DependentUpon>StressTest.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<None Include="App.config" />
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace EgtBEAMWALL.StressTest
|
||||
List<DataLayer.DatabaseModels.BTLPartModel> currPartList = new List<DataLayer.DatabaseModels.BTLPartModel>();
|
||||
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));
|
||||
ProjCtr.UpdateInfo(currProjId, $"{DateTime.Now:yyyyMMdd_HHmmssfff}", $"LN_{DateTime.Now:yyyyMMdd_HHmm}", DateTime.Now.AddSeconds(15), Core.ConstBeam.BWType.BEAM, "SIM01");
|
||||
// genero le BTLParts ed assegno..
|
||||
for (int j = 0; j < currRandom.BtlPart2Proj; j++)
|
||||
{
|
||||
@@ -109,7 +109,7 @@ namespace EgtBEAMWALL.StressTest
|
||||
{
|
||||
// FixME!!! non può creare x loop in CreateBeamDL che vuole nParentMachGroup
|
||||
// genero le Part x MachGroup ed assegno
|
||||
Core.PartM currPart = Core.BeamM.CreateBeamDL(null, currPartList[BPIdx].PartId, 1);
|
||||
Core.PartM currPart = Core.PartM.CreatePart(Core.ConstBeam.BWType.BEAM, currMachGroupList.FirstOrDefault(), 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 });
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="EgtWPFLib5" version="2.4.7.1" targetFramework="net452" />
|
||||
</packages>
|
||||
@@ -3,8 +3,7 @@ Imports EgtBEAMWALL.Core
|
||||
|
||||
Public Class AboutBoxV
|
||||
|
||||
Private Sub AboutBoxWD_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
|
||||
Me.Owner = Application.Current.MainWindow
|
||||
Private Sub AboutBoxWD_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
|
||||
DescriptionLbl.Text = My.Application.Info.Description.ToString()
|
||||
VersionLbl.Text = "Version : " & My.Application.Info.Version.Major.ToString() &
|
||||
"." & My.Application.Info.Version.Minor.ToString() &
|
||||
@@ -25,6 +24,9 @@ Public Class AboutBoxV
|
||||
sInfo &= sKey & " - " & sKlev & " - " & sOpts & sLeftDays & Environment.NewLine
|
||||
sInfo &= "DataRoot " & Map.refMainWindowVM.MainWindowM.sDataRoot & Environment.NewLine
|
||||
sInfo &= "MachinesRoot " & Map.refMainWindowVM.MainWindowM.sMachinesRoot & Environment.NewLine
|
||||
Dim sOpSys As String = String.Empty
|
||||
EgtGetOsInfo( sOpSys)
|
||||
sInfo &= sOpSys & Environment.NewLine
|
||||
Dim sCPU As String = String.Empty
|
||||
EgtGetCpuInfo( sCPU)
|
||||
sInfo &= sCPU & Environment.NewLine
|
||||
@@ -32,7 +34,7 @@ Public Class AboutBoxV
|
||||
EgtGetSceneInfo(sScene)
|
||||
sInfo &= sScene
|
||||
InfoLbl.Text = sInfo
|
||||
ExitBtn.Content = EgtMsg(constmsg.MSG_MISSINGKEYWD + 4) 'Ok
|
||||
ExitBtn.Content = EgtMsg(MSG_MISSINGKEYWD + 4) 'Ok
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:EgtCOMMTest"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<ItemsControl ItemsSource="{Binding AxesList}">
|
||||
|
||||
@@ -16,6 +16,27 @@ Public Class CALCPanelVM
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_bMachineLog As Boolean = False
|
||||
Public Property bMachineLog As Boolean
|
||||
Get
|
||||
Return m_bMachineLog
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_bMachineLog = value
|
||||
If value Then
|
||||
Map.refProjectVM.SetSelTabPage(ProjectVM.TabPages.MACHINELOG)
|
||||
ElseIf Not IsNothing(Map.refLeftPanelVM.SelOPMode) AndAlso Map.refLeftPanelVM.SelOPMode.Id = OPModes.Mdi Then
|
||||
Map.refProjectVM.SetSelTabPage(ProjectVM.TabPages.MDI)
|
||||
Else
|
||||
Map.refProjectVM.SetSelTabPage(ProjectVM.TabPages.SCENE)
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
Friend Sub SetMachineLog(value As Boolean)
|
||||
m_bMachineLog = value
|
||||
NotifyPropertyChanged(NameOf(bMachineLog))
|
||||
End Sub
|
||||
|
||||
' Definizione comandi
|
||||
Private m_cmdVerify As ICommand
|
||||
Private m_cmdVerifyAll As ICommand
|
||||
@@ -85,6 +106,8 @@ Public Class CALCPanelVM
|
||||
m_ProcessResultList = New List(Of Integer)
|
||||
Map.refProjectVM.ManageIsEnabled(True)
|
||||
Map.refMyStatusBarVM.ResetStopProgress()
|
||||
' riabilito bottoni di comunicazione a fine invio programma
|
||||
Map.refMachCommandMessagePanelVM.SetCommBtnIsEnabled(True)
|
||||
End Sub
|
||||
|
||||
Private Sub Calc_ProcessEnded(sender As Object, e As CalcProcessEndEventArgs)
|
||||
@@ -95,6 +118,10 @@ Public Class CALCPanelVM
|
||||
End Sub
|
||||
|
||||
Private Shared Sub ProcessResults(Bar As Bar)
|
||||
If IsNothing(Bar) Then Return
|
||||
|
||||
' disabilito impostazione modificato
|
||||
Dim DisableMgr As New DisableModifiedMgr
|
||||
|
||||
Dim BtlPath As String = Bar.sBarPath
|
||||
Dim ResPath As String = Path.ChangeExtension(BtlPath, ".txt")
|
||||
@@ -116,14 +143,13 @@ Public Class CALCPanelVM
|
||||
Dim cutId As Integer = 0
|
||||
Dim taskId As Integer = 0
|
||||
Dim prevCutId As Integer = GDB_ID.NULL
|
||||
Dim currPart As PartVM
|
||||
|
||||
Dim lines As String() = System.IO.File.ReadAllLines(ResPath)
|
||||
For Each line As String In lines
|
||||
|
||||
If line.StartsWith("ERR=") Then
|
||||
Dim nVal As Integer? = GetVal(line, "ERR")
|
||||
nErr = (If(nVal IsNot Nothing, nVal.Value, 0))
|
||||
nErr = (If(Not IsNothing(nVal), nVal.Value, 0))
|
||||
sMsg = ""
|
||||
dRot = 0
|
||||
nFall = 0
|
||||
@@ -131,24 +157,24 @@ Public Class CALCPanelVM
|
||||
taskId = 0
|
||||
ElseIf line.StartsWith("ROT=") Then
|
||||
Dim nVal As Integer? = GetVal(line, "ROT")
|
||||
Dim nRot As Integer = (If(nVal IsNot Nothing, nVal.Value, 0))
|
||||
Dim nRot As Integer = (If(Not IsNothing(nVal), nVal.Value, 0))
|
||||
dRot = Math.Abs(((4 - nRot) Mod 4) * 90)
|
||||
dPartRot = Math.Max(dPartRot, dRot)
|
||||
dTotRot = Math.Max(dTotRot, dRot)
|
||||
ElseIf line.StartsWith("CUTID=") Then
|
||||
Dim nVal As Integer? = GetVal(line, "CUTID")
|
||||
cutId = If(nVal IsNot Nothing, nVal.Value, 0)
|
||||
cutId = If(Not IsNothing(nVal), nVal.Value, 0)
|
||||
ElseIf line.StartsWith("TASKID=") Then
|
||||
Dim nVal As Integer? = GetVal(line, "TASKID")
|
||||
taskId = (If(nVal IsNot Nothing, nVal.Value, 0))
|
||||
taskId = (If(Not IsNothing(nVal), nVal.Value, 0))
|
||||
ProcessResultAdd(ProcessResultList, ProcessResult.CreateTaskResult(cutId, taskId, nErr, sMsg, dRot), Bar)
|
||||
ElseIf line.StartsWith("FALL=") Then
|
||||
Dim nVal As Integer? = GetVal(line, "FALL")
|
||||
nFall = (If(nVal IsNot Nothing, nVal.Value, 0))
|
||||
nFall = (If(Not IsNothing(nVal), nVal.Value, 0))
|
||||
ProcessResultList.Add(ProcessResult.CreateFallResult(cutId, nErr, sMsg, nFall))
|
||||
ElseIf line.StartsWith("TIME=") Then
|
||||
Dim nVal As Integer? = GetVal(line, "TIME")
|
||||
nTotTime = (If(nVal IsNot Nothing, nVal.Value, 0))
|
||||
nTotTime = (If(Not IsNothing(nVal), nVal.Value, 0))
|
||||
ProcessResultList.Add(ProcessResult.CreateTimeResult(cutId, nTotTime))
|
||||
'If Bar.nBarType = ProjectType.PROJ AndAlso Not IsNothing(currBTLPart) Then
|
||||
' EgtSetInfo(currBTLPart.nPartId, If(Bar.nBarType = ProjectType.PROJ, ITG_PROJ_TIME, ITG_PROD_TIME), nTotTime, True)
|
||||
@@ -167,9 +193,9 @@ Public Class CALCPanelVM
|
||||
Machgroup.CalcMachGroupUpdate(0, 0, "")
|
||||
' Ciclo ...
|
||||
Dim nCUTID As Integer = -1
|
||||
Dim CurrPartVM As PartVM
|
||||
Dim CurrMachgroupVM As MyMachGroupVM
|
||||
Dim CurrBTLFeatureVM As BTLFeatureVM
|
||||
Dim CurrPartVM As PartVM = Nothing
|
||||
Dim CurrMachgroupVM As MyMachGroupVM = Nothing
|
||||
Dim CurrBTLFeatureVM As BTLFeatureVM = Nothing
|
||||
For Each Line In ProcessResultList
|
||||
' se necessario recupero part
|
||||
If Line.nCUTID <> 0 Then
|
||||
@@ -191,32 +217,39 @@ Public Class CALCPanelVM
|
||||
End If
|
||||
Select Case Line.Type
|
||||
Case ProcessResult.ProcessResultTypes.BAR
|
||||
CurrMachgroupVM.CalcMachGroupUpdate(Line.nERR, Line.dROT, Line.sMSG)
|
||||
If Not IsNothing(CurrMachgroupVM) Then CurrMachgroupVM.CalcMachGroupUpdate(Line.nERR, Line.dROT, Line.sMSG)
|
||||
Case ProcessResult.ProcessResultTypes.PART
|
||||
CurrPartVM.CalcPartUpdate(Line.nERR, Line.dROT, Line.sMSG)
|
||||
If Not IsNothing(CurrPartVM) Then CurrPartVM.CalcPartUpdate(Line.nERR, Line.dROT, Line.sMSG)
|
||||
Case ProcessResult.ProcessResultTypes.TASKID
|
||||
CurrBTLFeatureVM.CalcFeatureUpdate(Line.nERR, Line.dROT, Line.sMSG)
|
||||
If Not IsNothing(CurrBTLFeatureVM) Then CurrBTLFeatureVM.CalcFeatureUpdate(Line.nERR, Line.dROT, Line.sMSG)
|
||||
Case ProcessResult.ProcessResultTypes.FALL
|
||||
CurrPartVM.CalcFallUpdate(Line.nFALL)
|
||||
If Not IsNothing(CurrPartVM) Then CurrPartVM.CalcFallUpdate(Line.nFALL)
|
||||
Case ProcessResult.ProcessResultTypes.TIME
|
||||
If IsNothing(CurrMachgroupVM) Then CurrMachgroupVM = GetMachgroupVMFromMachgroupId(Bar.nBarId)
|
||||
CurrMachgroupVM.CalcTimeUpdate(Line.nTIME)
|
||||
If Not IsNothing(CurrMachgroupVM) Then CurrMachgroupVM.CalcTimeUpdate(Line.nTIME)
|
||||
End Select
|
||||
Next
|
||||
Machgroup = GetMachgroupVMFromMachgroupId(Bar.nBarId)
|
||||
For Each Part In Machgroup.PartVMList
|
||||
Part.CalcGlobalUpdate()
|
||||
Next
|
||||
Machgroup.CalcGlobalUpdate()
|
||||
If Not IsNothing(Machgroup) Then
|
||||
For Each Part In Machgroup.PartVMList
|
||||
Part.CalcGlobalUpdate()
|
||||
Next
|
||||
Machgroup.CalcGlobalUpdate()
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
' mando notifica aggiornamento ad ottimizzatore
|
||||
DbControllers.m_StatusMapController.UpdateAction(DbControllers.m_SupervisorId, Map.refSupervisorManagerVM.CurrProd.nProdId, Bar.nBarId, StatusMapItemType.MachGroup, StatusMapOpType.MachGroupValidationUpdate, "")
|
||||
|
||||
Else
|
||||
bErrors = True
|
||||
nLastErr = 25
|
||||
sLastMsg = "Execution Error"
|
||||
End If
|
||||
|
||||
' ripristino precedente impostazione modificato
|
||||
DisableMgr.ReEnable()
|
||||
End Sub
|
||||
|
||||
Private Shared Function GetVal(sText As String, sKey As String) As Integer?
|
||||
@@ -232,7 +265,7 @@ Public Class CALCPanelVM
|
||||
End Function
|
||||
|
||||
Private Shared Sub ProcessResultAdd(PRList As List(Of ProcessResult), NewPR As ProcessResult, Bar As Bar)
|
||||
Dim Prev As ProcessResult
|
||||
Dim Prev As ProcessResult = Nothing
|
||||
Select Case NewPR.Type
|
||||
Case ProcessResult.ProcessResultTypes.BAR
|
||||
If Bar.nProgramPage = ProjectType.PROJ Then
|
||||
@@ -264,6 +297,7 @@ Public Class CALCPanelVM
|
||||
Dim PartVM As PartVM = MachGroupVM.PartVMList.FirstOrDefault(Function(x) x.nPartId = nPartId)
|
||||
If Not IsNothing(PartVM) Then Return PartVM
|
||||
Next
|
||||
Return Nothing
|
||||
End Function
|
||||
|
||||
Private Shared Function GetMachgroupVMFromMachgroupId(nMachGroupId As Integer) As MyMachGroupVM
|
||||
@@ -346,7 +380,8 @@ Public Class CALCPanelVM
|
||||
.nProgramPage = ProjectType.PROD,
|
||||
.nProjType = ProjType,
|
||||
.bBarOk = True,
|
||||
.nMachineName = MachineName}
|
||||
.nMachineName = MachineName,
|
||||
.nGlobState = MachGroup.nGlobalState}
|
||||
Select Case MachGroup.nGlobalState
|
||||
Case Core.CalcStates.OK, Core.CalcStates.INFO
|
||||
Bar.nCmdType = CalcIntegration.CmdTypes.GENERATE
|
||||
@@ -362,7 +397,7 @@ Public Class CALCPanelVM
|
||||
' disabilito interfaccia
|
||||
Map.refProjectVM.ManageIsEnabled(False)
|
||||
' lancio calcolo
|
||||
EgtBEAMWALL.Core.CalcIntegration.Run(BarList, Map.refSupervisorManagerVM.CurrProd.sProdDirPath, AddressOf ManageCalc)
|
||||
EgtBEAMWALL.Core.CalcIntegration.Run(BarList, Map.refSupervisorManagerVM.CurrProd.sProdDirPath, AddressOf ManageCalc, True)
|
||||
End Sub
|
||||
|
||||
' funzione che gestisce risposta da thread di verifica, aggiorna progress e segnala comando di interruzione
|
||||
@@ -469,7 +504,7 @@ Public Class CALCPanelVM
|
||||
.bBarOk = True,
|
||||
.nMachineName = MachineName,
|
||||
.nCmdType = CalcIntegration.CmdTypes.SIMULATE}
|
||||
If SelMachGroup.nGlobalState <> Core.CalcStates.OK Then
|
||||
If SelMachGroup.nGlobalState = CalcStates.NOTCALCULATED Then
|
||||
Dim sMachGroupFilePath As String = Map.refSupervisorManagerVM.CurrProd.sProdDirPath & "\" & SelMachGroup.Name.ToString() & ".ori.bwe"
|
||||
If File.Exists(sMachGroupFilePath) Then File.Delete(sMachGroupFilePath)
|
||||
End If
|
||||
|
||||
@@ -29,5 +29,10 @@
|
||||
IsEnabled="{Binding CALCPanel_IsEnabled}">
|
||||
<Image Source="/Resources/CALCPanel/Simulate.png" Stretch="Uniform"/>
|
||||
</Button>
|
||||
<ToggleButton ToolTip="{Binding MachineLog_ToolTip}"
|
||||
Content="Log"
|
||||
IsChecked="{Binding bMachineLog}"
|
||||
Style="{StaticResource ToolBar_ToggleButton}">
|
||||
</ToggleButton>
|
||||
|
||||
</EgtFloating:EgtFloatingPanel>
|
||||
|
||||
@@ -0,0 +1,846 @@
|
||||
Imports EgtBEAMWALL.Core
|
||||
Imports EgtBEAMWALL.Core.ConstMachComm
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class NUMAxiumComm
|
||||
|
||||
Enum CNMode As Integer
|
||||
AUTO = 0
|
||||
SINGLE_ = 1
|
||||
MDI = 2
|
||||
MANUAL = 7
|
||||
End Enum
|
||||
|
||||
Private m_MachManaging As MachManaging
|
||||
Friend ReadOnly Property MachManaging As MachManaging
|
||||
Get
|
||||
Return m_MachManaging
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property bIsTransferActive As Boolean
|
||||
Get
|
||||
Return If(Not IsNothing(objDFileTransfer), objDFileTransfer.IsTransferActive(), False)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'Private objDRunTimeSystem As FXServer.DRunTimeSystem
|
||||
Private WithEvents objDGroupManager As APServer.DGroupManager
|
||||
Private WithEvents objDGeneralFunction As APServer.DGeneralFunctions
|
||||
Private WithEvents objDMainCncData As APServer.DMainCncData
|
||||
Private WithEvents objErrorHandler As APLog.ErrorHandler
|
||||
Private WithEvents objDReadELS As APServer.DReadELS
|
||||
Private WithEvents objDReadPlcVarList As APServer.DReadPlcVarList
|
||||
Private WithEvents objDFileTransfer As APServer.DFileTransfer
|
||||
Private WithEvents objDPosition As APServer.DPosition
|
||||
Private WithEvents objDMdiCommand As APServer.DMdiCommand
|
||||
Private WithEvents objDVariables As APServer.DVariables
|
||||
Private WithEvents objDCncMode As APServer.DCncMode
|
||||
Private WithEvents objDReadOperatorMessage As APServer.DReadOperatorMessage
|
||||
|
||||
Private m_CNCVersion As String = ""
|
||||
Private _PartProgramNumber As Single
|
||||
Private _CNCAxisChannelArray As String() = New String() {"Channel 1", "Channel 2"}
|
||||
Private m_ChannelList As New List(Of String)
|
||||
' Arraylist for read out the messages
|
||||
Private m_ReadFXMessages As New List(Of ReadMessages)
|
||||
Private m_ReadOperatorMessages As New List(Of ReadMessages)
|
||||
' lista variabili in lettura
|
||||
Private Shared m_ReadingVars(100) As CommVar
|
||||
Private m_BytesTransferedCounter As Integer
|
||||
Private m_LinearAxisPrecision As Integer
|
||||
|
||||
Public Sub New(MachManaging As MachManaging)
|
||||
m_MachManaging = MachManaging
|
||||
End Sub
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Friend Sub InitFxServer()
|
||||
End Sub
|
||||
|
||||
Friend Sub InitFxObjects()
|
||||
objDGroupManager = CreateObject("APServer.DGroupManager")
|
||||
AddHandler objDGroupManager.ErrorHandler, AddressOf objDGroupManager_ErrorHandler
|
||||
AddHandler objDGroupManager.AssignmentChanged, AddressOf objDGroupManager_AssignmentChanged
|
||||
objDGroupManager.CncNumber = 0
|
||||
objDGroupManager.AxisGroup = 0
|
||||
|
||||
objDMainCncData = CreateObject("APServer.DMainCncData")
|
||||
Dim s = objDMainCncData.Init(objDGroupManager.Handle)
|
||||
m_LinearAxisPrecision = objDMainCncData.GetLinearPrecision()
|
||||
Dim CncFxIdentifier As String = objDMainCncData.GetCncIdentifier()
|
||||
EgtOutLog("CncFxIdentifier: " & CncFxIdentifier)
|
||||
|
||||
m_CNCVersion = objDMainCncData.GetCncVersion()
|
||||
|
||||
' Initialize for Channel Change
|
||||
Dim CncGroupNumber As Integer = objDMainCncData.GetCncGroupNumber()
|
||||
Dim PlcGroupNumber As Integer = objDMainCncData.GetPlcGroupNumber()
|
||||
|
||||
Dim sumChannels As Integer = 0
|
||||
sumChannels = PlcGroupNumber + CncGroupNumber
|
||||
For i = 1 To sumChannels
|
||||
m_ChannelList.Add(i)
|
||||
Next
|
||||
|
||||
objDGeneralFunction = CreateObject("APServer.DGeneralFunctions")
|
||||
AddHandler objDGeneralFunction.ProgramActivated, AddressOf objDGeneralFunction_ProgramActivated
|
||||
AddHandler objDGeneralFunction.OnCncStart, AddressOf objDGeneralFunction_OnCncStart
|
||||
AddHandler objDGeneralFunction.OnCncStop, AddressOf objDGeneralFunction_OnCncStop
|
||||
AddHandler objDGeneralFunction.OnCncReset, AddressOf objDGeneralFunction_OnCncReset
|
||||
AddHandler objDGeneralFunction.CncModeWritten, AddressOf objDGeneralFunction_CncModeWritten
|
||||
AddHandler objDGeneralFunction.VariableWritten, AddressOf objDGeneralFunction_VariableWritten
|
||||
Dim l = objDGeneralFunction.Init(objDGroupManager.Handle)
|
||||
Dim MaxWaiting As Integer = 100
|
||||
Dim WaitingIndex As Integer = 0
|
||||
While objDGeneralFunction.ConnectionStatus <> 2 AndAlso WaitingIndex < MaxWaiting
|
||||
Threading.Thread.Sleep(100)
|
||||
UpdateUI()
|
||||
WaitingIndex += 1
|
||||
End While
|
||||
Dim j = objDGeneralFunction.ConnectionStatus
|
||||
Dim oi = objDGeneralFunction.ConnectionString
|
||||
' Initialize FXLog Objects
|
||||
objErrorHandler = CreateObject("APLog.ErrorHandler")
|
||||
'AddHandler objErrorHandler.ErrorFromActiveCnc, AddressOf objErrorHandler_ErrorFromActiveCnc2
|
||||
AddHandler objErrorHandler.ErrorOnCnc, AddressOf objErrorHandler_ErrorOnCnc
|
||||
AddHandler objErrorHandler.ErrorOnOtherChannel, AddressOf objErrorHandler_ErrorOnOtherChannel
|
||||
AddHandler objErrorHandler.Exception, AddressOf objErrorHandler_Exception
|
||||
'Initialisation config for testing
|
||||
'Accepting all messages
|
||||
'Consult the documentation for detailed information
|
||||
|
||||
objErrorHandler.AllError = 1
|
||||
objErrorHandler.ErrorGlobal = 0
|
||||
objErrorHandler.SetChannel(0, 0)
|
||||
objErrorHandler.AcceptBootSysMessage(1)
|
||||
objErrorHandler.AcceptException(0)
|
||||
|
||||
'Initialize FXServer class DFileTransferv
|
||||
objDFileTransfer = CreateObject("APServer.DFileTransfer")
|
||||
AddHandler objDFileTransfer.Completed, AddressOf objDFileTransfer_Completed
|
||||
AddHandler objDFileTransfer.TransferStarted, AddressOf objDFileTransfer_TransferStarted
|
||||
AddHandler objDFileTransfer.Failed, AddressOf objDFileTransfer_Failed
|
||||
AddHandler objDFileTransfer.BytesTransfered, AddressOf objDFileTransfer_BytesTransfered
|
||||
objDFileTransfer.Init(objDGroupManager.Handle)
|
||||
|
||||
objDPosition = CreateObject("APServer.DPosition")
|
||||
AddHandler objDPosition.PositionChanged, AddressOf objDPosition_PositionChanged
|
||||
objDPosition.ModeOP = 1
|
||||
objDPosition.Flag = 0
|
||||
objDPosition.Init(objDGroupManager.Handle)
|
||||
objDPosition.FireValidAxis()
|
||||
objDPosition.FireValues()
|
||||
|
||||
'Initialize FXServer class DMdiCommand
|
||||
objDMdiCommand = CreateObject("APServer.DMdiCommand")
|
||||
AddHandler objDMdiCommand.CommandWritten, AddressOf objDMdiCommand_CommandWritten
|
||||
objDMdiCommand.Init(objDGroupManager.Handle)
|
||||
|
||||
' Initialize FXServer class DCncMode
|
||||
objDCncMode = CreateObject("APServer.DCncMode")
|
||||
AddHandler objDCncMode.ValueChanged, AddressOf objDCncMode_ValueChanged
|
||||
objDCncMode.Init(objDGroupManager.Handle)
|
||||
|
||||
' Initialize FXServer class DReadOperatorMessage
|
||||
objDReadOperatorMessage = CreateObject("APServer.DReadOperatorMessage")
|
||||
AddHandler objDReadOperatorMessage.ValueChanged, AddressOf objDReadOperatorMessage_ValueChanged
|
||||
Dim tc = objDReadOperatorMessage.Init(objDGroupManager.Handle)
|
||||
If tc <> 0 Then EgtOutLog("Init failed ! return code : " + tc)
|
||||
|
||||
' Initialize FXServer class DReadELS
|
||||
'objDReadELS = CreateObject("APServer.DReadELS")
|
||||
'AddHandler objDReadELS.ValueChanged, AddressOf objDReadELS_ValueChanged
|
||||
'Dim y = objDReadELS.Init(objDGroupManager.Handle)
|
||||
|
||||
objDReadPlcVarList = CreateObject("APServer.DReadPlcVarList")
|
||||
AddHandler objDReadPlcVarList.ValueChanged, AddressOf objDPlcVariables_ReadPLCVariablesChanged
|
||||
' Init & send the list of requested variables
|
||||
'tc = objDReadPlcVarList.Init(objDGroupManager.Handle)
|
||||
'If tc <> 0 Then EgtOutLog(" objDReadPlcVarList.Init() Error : " + tc)
|
||||
|
||||
'Initialize FXServer class DVariables
|
||||
objDVariables = CreateObject("APServer.DVariables")
|
||||
'AddHandler objDVariables.ValueChanged, AddressOf objDVariables_ValueChanged
|
||||
' Init & send the list of requested variables
|
||||
'Dim rc As Short = objDVariables.Init(objDGroupManager.Handle, "E80000", 0)
|
||||
AddHandler objDVariables.VariableWritten, AddressOf objDVariables_VariableWritten
|
||||
AddHandler objDVariables.ValueChanged, AddressOf objDPlcVariables_ReadVariablesChanged
|
||||
'If rc <> 0 Then EgtOutLog(" objDVariables.Init() Error : " + rc)
|
||||
|
||||
' attivo programma main
|
||||
Map.refMachManaging.Num_Axium_APServer.ActivateProg(9000)
|
||||
|
||||
End Sub
|
||||
|
||||
Friend Sub CloseFxObjects()
|
||||
If Not IsNothing(objDReadOperatorMessage) Then
|
||||
objDReadOperatorMessage.Close()
|
||||
System.Runtime.InteropServices.Marshal.ReleaseComObject(objDReadOperatorMessage)
|
||||
objDReadOperatorMessage = Nothing
|
||||
End If
|
||||
If Not IsNothing(objDCncMode) Then
|
||||
System.Runtime.InteropServices.Marshal.ReleaseComObject(objDCncMode)
|
||||
objDCncMode = Nothing
|
||||
End If
|
||||
If Not IsNothing(objDReadPlcVarList) Then
|
||||
objDReadPlcVarList.Close()
|
||||
System.Runtime.InteropServices.Marshal.ReleaseComObject(objDReadPlcVarList)
|
||||
objDReadPlcVarList = Nothing
|
||||
End If
|
||||
If Not IsNothing(objDVariables) Then
|
||||
System.Runtime.InteropServices.Marshal.ReleaseComObject(objDVariables)
|
||||
objDVariables = Nothing
|
||||
End If
|
||||
If Not IsNothing(objDMdiCommand) Then
|
||||
System.Runtime.InteropServices.Marshal.ReleaseComObject(objDMdiCommand)
|
||||
objDMdiCommand = Nothing
|
||||
End If
|
||||
If Not IsNothing(objDPosition) Then
|
||||
System.Runtime.InteropServices.Marshal.ReleaseComObject(objDPosition)
|
||||
objDPosition = Nothing
|
||||
End If
|
||||
If Not IsNothing(objDFileTransfer) Then
|
||||
System.Runtime.InteropServices.Marshal.ReleaseComObject(objDFileTransfer)
|
||||
objDFileTransfer = Nothing
|
||||
End If
|
||||
If Not IsNothing(objDReadELS) Then
|
||||
objDReadELS.Close()
|
||||
System.Runtime.InteropServices.Marshal.ReleaseComObject(objDReadELS)
|
||||
objDReadELS = Nothing
|
||||
End If
|
||||
If Not IsNothing(objErrorHandler) Then
|
||||
System.Runtime.InteropServices.Marshal.ReleaseComObject(objErrorHandler)
|
||||
objErrorHandler = Nothing
|
||||
End If
|
||||
If Not IsNothing(objDGeneralFunction) Then
|
||||
objDGeneralFunction.Connect(0)
|
||||
System.Runtime.InteropServices.Marshal.ReleaseComObject(objDGeneralFunction)
|
||||
objDGeneralFunction = Nothing
|
||||
End If
|
||||
If Not IsNothing(objDMainCncData) Then
|
||||
System.Runtime.InteropServices.Marshal.ReleaseComObject(objDMainCncData)
|
||||
objDMainCncData = Nothing
|
||||
End If
|
||||
If Not IsNothing(objDGroupManager) Then
|
||||
System.Runtime.InteropServices.Marshal.ReleaseComObject(objDGroupManager)
|
||||
objDGroupManager = Nothing
|
||||
End If
|
||||
Dim ServerProcList As Process() = Process.GetProcessesByName("APServer")
|
||||
Dim LogProcList As Process() = Process.GetProcessesByName("APLog")
|
||||
For Each ServerProc In ServerProcList
|
||||
ServerProc.Kill()
|
||||
Next
|
||||
For Each LogProc In LogProcList
|
||||
LogProc.Kill()
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Friend Sub GetGeneralFunctions()
|
||||
Dim _GetConnectState As Int16 = 0
|
||||
Dim MaxWaiting As Integer = 100
|
||||
Dim WaitingIndex As Integer = 0
|
||||
While _GetConnectState <> 2 AndAlso WaitingIndex < MaxWaiting
|
||||
_GetConnectState = objDGeneralFunction.ConnectionStatus
|
||||
Threading.Thread.Sleep(100)
|
||||
UpdateUI()
|
||||
WaitingIndex += 1
|
||||
End While
|
||||
|
||||
Select Case _GetConnectState
|
||||
Case 0
|
||||
' Not connected
|
||||
m_MachManaging.SetConnected(False)
|
||||
m_ResultCallbackDlg(CommandTypes.CONNECT, CommandStates.NULL, ResultTypes.RESULT, "")
|
||||
Case 1
|
||||
' Connection error
|
||||
m_MachManaging.SetConnected(False)
|
||||
m_ResultCallbackDlg(CommandTypes.CONNECT, CommandStates.ERROR_, ResultTypes.RESULT, "")
|
||||
Case 2
|
||||
' Connected
|
||||
m_MachManaging.SetConnected(True)
|
||||
m_ResultCallbackDlg(CommandTypes.CONNECT, CommandStates.OK, ResultTypes.RESULT, "")
|
||||
' avvio lettura variabili
|
||||
'MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.READ_NUMFLEXIUM))
|
||||
StartReadList()
|
||||
StartReadPLCList()
|
||||
'StartReadELS()
|
||||
Case Else
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Friend Sub Start()
|
||||
objDGeneralFunction.CncStart()
|
||||
End Sub
|
||||
|
||||
Friend Sub Stop_()
|
||||
objDGeneralFunction.CncStop()
|
||||
End Sub
|
||||
|
||||
Friend Sub Reset()
|
||||
objDGeneralFunction.CncReset()
|
||||
End Sub
|
||||
|
||||
Friend Sub SetMode(value As CNMode)
|
||||
objDGeneralFunction.WriteCncMode(value, 0)
|
||||
End Sub
|
||||
|
||||
Friend Sub SetChannel(value As Integer)
|
||||
ChangeChannel(CShort(value))
|
||||
'objDGroupManager.AxisGroup = CShort(value)
|
||||
End Sub
|
||||
|
||||
Friend Sub ActivateProg(PartProgramNumberActivate As Integer)
|
||||
' attivo programma main
|
||||
Dim _FXReturn As Int16 = objDGeneralFunction.ActivateProgram(PartProgramNumberActivate * 10, 0)
|
||||
If _FXReturn <> 0 Then
|
||||
EgtOutLog("Error Activate Program:" & " " & _FXReturn.ToString())
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub ChangeChannel(Channel As Short)
|
||||
objErrorHandler.SetChannel(1, Channel)
|
||||
End Sub
|
||||
|
||||
Friend Sub StartReadList()
|
||||
'Dim AddressList() As String = (From CommVar In m_ReadingVars
|
||||
' Where Not IsNothing(CommVar) AndAlso CommVar.nType = CommVar.Types.PLC
|
||||
' Select CommVar.sAddress).ToArray()
|
||||
'm_PlcVariablesList = New ArrayList((From CommVar In m_ReadingVars
|
||||
' Where Not IsNothing(CommVar) AndAlso CommVar.nType = CommVar.Types.PLC
|
||||
' Select CommVar.sAddress).ToArray())
|
||||
Dim nPLCVarIndex As Integer = 0
|
||||
Dim PlcVariablesList As New ArrayList
|
||||
Dim sPLCVariableList = ""
|
||||
For VarIndex = 0 To m_ReadingVars.Length - 1
|
||||
Dim CommVar As CommVar = m_ReadingVars(VarIndex)
|
||||
If Not IsNothing(CommVar) AndAlso CommVar.Paragraph = CommVar.Paragraphs.MAIN AndAlso CommVar.nType = CommVar.Types.CN Then
|
||||
PlcVariablesList.Add(CommVar.sAddress)
|
||||
If Not String.IsNullOrWhiteSpace(sPLCVariableList) Then
|
||||
sPLCVariableList &= ","
|
||||
End If
|
||||
sPLCVariableList &= """" & CommVar.sAddress & """"
|
||||
CommVar.Index = nPLCVarIndex
|
||||
nPLCVarIndex += 1
|
||||
End If
|
||||
Next
|
||||
'Dim sPLCVariableList = ""
|
||||
'For VariableIndex = 0 To PlcVariablesList.Count - 1
|
||||
' If VariableIndex <> 0 Then
|
||||
' sPLCVariableList &= ","
|
||||
' End If
|
||||
' sPLCVariableList &= """" & PlcVariablesList(VariableIndex) & """"
|
||||
'Next
|
||||
Dim _FXReturn As Short = objDVariables.Init(objDGroupManager.Handle, sPLCVariableList, 1) 'PlcVariablesList.ToArray().ToString())
|
||||
'Dim _FXReturn As Short = objDVariables.ReadVariables(PlcVariablesList.ToArray())
|
||||
|
||||
'If _FXReturn <> 0 Then
|
||||
' EgtOutLog("Error ReadVariables:" & " " & _FXReturn.ToString())
|
||||
'End If
|
||||
End Sub
|
||||
|
||||
Friend Sub StartReadPLCList()
|
||||
'Dim AddressList() As String = (From CommVar In m_ReadingVars
|
||||
' Where Not IsNothing(CommVar) AndAlso CommVar.nType = CommVar.Types.PLC
|
||||
' Select CommVar.sAddress).ToArray()
|
||||
'm_PlcVariablesList = New ArrayList((From CommVar In m_ReadingVars
|
||||
' Where Not IsNothing(CommVar) AndAlso CommVar.nType = CommVar.Types.PLC
|
||||
' Select CommVar.sAddress).ToArray())
|
||||
Dim nPLCVarIndex As Integer = 0
|
||||
Dim PlcVariablesList As New ArrayList
|
||||
Dim sPLCVariableList = ""
|
||||
For VarIndex = 0 To m_ReadingVars.Length - 1
|
||||
Dim CommVar As CommVar = m_ReadingVars(VarIndex)
|
||||
If Not IsNothing(CommVar) AndAlso CommVar.nType = CommVar.Types.PLC AndAlso
|
||||
CommVar.Paragraph = CommVar.Paragraphs.MAIN Then
|
||||
PlcVariablesList.Add(CommVar.sAddress)
|
||||
If Not String.IsNullOrWhiteSpace(sPLCVariableList) Then
|
||||
sPLCVariableList &= ","
|
||||
End If
|
||||
sPLCVariableList &= CommVar.sAddress
|
||||
CommVar.Index = nPLCVarIndex
|
||||
nPLCVarIndex += 1
|
||||
End If
|
||||
Next
|
||||
objDReadPlcVarList.Argument = sPLCVariableList ' "%M5.L,%M5.B"
|
||||
Dim h = objDReadPlcVarList.Init(objDGroupManager.Handle)
|
||||
'Dim _FXReturn As Short = objDVariables.ReadVariables(PlcVariablesList.ToArray())
|
||||
|
||||
'If _FXReturn <> 0 Then
|
||||
' EgtOutLog("Error ReadVariables:" & " " & _FXReturn.ToString())
|
||||
'End If
|
||||
End Sub
|
||||
|
||||
Friend Sub CloseReadList()
|
||||
'objDPlcVariables.CloseReadList()
|
||||
End Sub
|
||||
|
||||
Private Sub ReadVariablesOnce(Address As String)
|
||||
'Dim _ReadSymbolicPlcVariableOnetime As String = "Application.IOCONFIG_GLOBALS.Flexium_NCK.RCNC.General.Mode"
|
||||
'Dim _FXReturn As Int16 = objDPlcVariables.ReadVariablesOnce(10, Address)
|
||||
|
||||
'If _FXReturn <> 0 Then
|
||||
' EgtOutLog("Error ReadVariablesOnce:" & " " & _FXReturn.ToString())
|
||||
'End If
|
||||
|
||||
End Sub
|
||||
|
||||
Friend Sub WritePlcVariables(Address As String, value As String)
|
||||
'Dim _WriteSymbolicPlcVariable As String = _txtReadWritePlcVariables0.Text
|
||||
'Dim _FXReturn As Int16 = objDPlcVariables.WriteVariables2(11, Address, value)
|
||||
'
|
||||
'If _FXReturn <> 0 Then
|
||||
' EgtOutLog("Error WriteVariables2 :" & " " & _FXReturn.ToString())
|
||||
'End If
|
||||
|
||||
End Sub
|
||||
|
||||
Public Shared Function InitVar(Variable As CommVar) As CommVar
|
||||
Dim Index As Integer = Array.IndexOf(m_ReadingVars, Nothing)
|
||||
m_ReadingVars(Index) = Variable
|
||||
Return m_ReadingVars(Index)
|
||||
End Function
|
||||
|
||||
Friend Sub StartReadELS()
|
||||
For Index = 0 To m_ReadingVars.Length - 1
|
||||
If IsNothing(m_ReadingVars(Index)) Then Continue For 'OrElse m_ReadingVars(Index).nType <> CommVar.Types.CN Then Continue For
|
||||
Dim rc As Short = objDReadELS.AddParameter(m_ReadingVars(Index).sAddress, Index + 1)
|
||||
If rc <> 0 Then EgtOutLog(" Error AddParameter2 : " & rc & " on Variable : " & m_ReadingVars(Index).sAddress)
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Friend Sub CloseReadELS()
|
||||
'objDPlcVariables.CloseReadList()
|
||||
End Sub
|
||||
|
||||
#Region "File transfer"
|
||||
|
||||
Friend Sub FileDownload(sFileType As String, sFilePath As String)
|
||||
Dim _Return_Download As Short
|
||||
|
||||
_Return_Download = objDFileTransfer.FileDownload(10, sFileType, sFilePath, "", 1)
|
||||
|
||||
If _Return_Download <> 0 Then
|
||||
EgtOutLog("Error: File not stored to the job list:" & " " & _Return_Download.ToString())
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub FileUpload(sFileType As String, sFilePath As String)
|
||||
Dim _Return_Upload As Short
|
||||
_Return_Upload = objDFileTransfer.FileUpload(20, sFileType, sFilePath, "")
|
||||
|
||||
If _Return_Upload <> 0 Then
|
||||
EgtOutLog("Error: File not stored to the job list:" & " " & _Return_Upload.ToString())
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Friend Sub FileDelete(sFileType As String, sFilePath As String)
|
||||
Dim _ReturnFileDelete As Short
|
||||
_ReturnFileDelete = objDFileTransfer.FileDelete(20, sFileType, "")
|
||||
|
||||
If _ReturnFileDelete <> 0 Then
|
||||
EgtOutLog("Error: File not deleted:" & " " & _ReturnFileDelete.ToString())
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Friend Sub StartTransfer()
|
||||
Dim _Return_StartTransfer As Short
|
||||
_Return_StartTransfer = objDFileTransfer.StartTransfer()
|
||||
|
||||
If _Return_StartTransfer <> 0 Then
|
||||
EgtOutLog("Error: Start transfer not executed:" & " " & _Return_StartTransfer.ToString())
|
||||
Else
|
||||
m_BytesTransferedCounter = 0
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region ' File transfer
|
||||
|
||||
#Region "MDI"
|
||||
|
||||
Friend Sub MDI_Execute(sCommand As String)
|
||||
Dim nRet As Int16 = objDMdiCommand.ExecuteCommand(sCommand)
|
||||
If nRet <> 0 Then
|
||||
EgtOutLog("Error ExecuteCommand :" & " " & nRet.ToString())
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region ' MDI
|
||||
|
||||
#Region "Variables"
|
||||
|
||||
Friend Sub WriteNCVariables(Address As String, value As String)
|
||||
Try
|
||||
Dim dValue As Double = 0
|
||||
StringToDoubleAdv(value, dValue)
|
||||
Dim rc As Short = objDVariables.WriteVariables(objDGroupManager.Handle, Address, value)
|
||||
|
||||
'If rc <> 0 Then EgtOutLog(" objDVariables.WriteVariables2() Error : " & rc)
|
||||
|
||||
Catch ex As Exception
|
||||
EgtOutLog(" objDVariables.WriteVariables2() Exception : " & ex.Message)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
#End Region ' Variables
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
#Region "EVENTS"
|
||||
|
||||
Private Sub objDRunTimeSystem_ServerInitializationFinished()
|
||||
InitFxObjects()
|
||||
GetGeneralFunctions()
|
||||
End Sub
|
||||
|
||||
Private Sub objDRunTimeSystem_ServerReinitializationStarted()
|
||||
CloseFxObjects()
|
||||
End Sub
|
||||
|
||||
Private Sub objDGeneralFunction_ProgramActivated(ByVal nerrorCode As Short)
|
||||
EgtOutLog("Part program activated:" & " " & nerrorCode)
|
||||
'DbControllers.m_LogMachineController.Create(MachLog.CreateResultLog(CommandTypes.SENDPROG, CommandStates.OK, ResultTypes.EXECUTED, "Part program activated:" & " " & nerrorCode))
|
||||
' scrivo evento programma attivato
|
||||
DbControllers.m_LogMachineController.Create(LogEvent.CreateMachCommandLog(LogEvent.MachineCommands.PROGRAM_ACTIVATION, "", nerrorCode, DbControllers.SupervisorId))
|
||||
End Sub
|
||||
|
||||
Private Sub objDGeneralFunction_OnCncStart(ByVal errorCode As Short)
|
||||
Dim bOk As Boolean = (errorCode = 0)
|
||||
m_MachManaging.SetStartPending(bOk)
|
||||
m_ResultCallbackDlg(CommandTypes.START, If(bOk, CommandStates.OK, CommandStates.ERROR_), ResultTypes.EXECUTED, If(bOk, "", "Error CNC Start: " & errorCode.ToString()))
|
||||
End Sub
|
||||
|
||||
Private Sub objDGeneralFunction_OnCncStop(ByVal errorCode As Short)
|
||||
Dim bOk As Boolean = (errorCode = 0)
|
||||
m_ResultCallbackDlg(CommandTypes.STOP_, If(bOk, CommandStates.OK, CommandStates.ERROR_), ResultTypes.EXECUTED, If(bOk, "", "Error Feed Hold: " & errorCode.ToString()))
|
||||
End Sub
|
||||
|
||||
Private Sub objDGeneralFunction_OnCncReset(ByVal errorCode As Short)
|
||||
Dim bOk As Boolean = (errorCode = 0)
|
||||
m_ResultCallbackDlg(CommandTypes.RESET, If(bOk, CommandStates.OK, CommandStates.ERROR_), ResultTypes.EXECUTED, If(bOk, "", "Error CNC Reset: " & errorCode.ToString()))
|
||||
End Sub
|
||||
|
||||
Private Sub objDGeneralFunction_CncModeWritten(ByVal errorCode As Short)
|
||||
If errorCode <> 0 Then EgtOutLog("Error CNC Mode selection completed:" & " " & errorCode.ToString())
|
||||
End Sub
|
||||
|
||||
Private Sub objDGroupManager_ErrorHandler(ByVal sError As String, ByVal nTextNumber As Short)
|
||||
EgtOutLog("ErrorHandler message:" & " " & sError & " " & "ErrorHandler number:" & " " & nTextNumber.ToString())
|
||||
End Sub
|
||||
|
||||
Private Sub objDGroupManager_AssignmentChanged(ByVal CncNumber As Short, ByVal AxisGroup As Short)
|
||||
m_ChannelCallbackDlg(AxisGroup)
|
||||
End Sub
|
||||
|
||||
Private Sub _comboCncAxisChannel_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
|
||||
'Select Case _comboCncAxisChannel.SelectedItem.ToString()
|
||||
' Case "Channel 1"
|
||||
' objDGroupManager.AxisGroup = 0
|
||||
' Case "Channel 2"
|
||||
' objDGroupManager.AxisGroup = 1
|
||||
' Case Else
|
||||
'End Select
|
||||
End Sub
|
||||
|
||||
Private Sub objDGeneralFunction_VariableWritten(ByVal errorCode As Short)
|
||||
If errorCode <> 0 Then
|
||||
MessageBox.Show("Error from VariableWritten:" & " " & errorCode.ToString())
|
||||
Else
|
||||
MessageBox.Show("VariableWritten successfully")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub objErrorHandler_ErrorOnCnc(ByVal cnc As Short, ByVal channel As Short, ByVal [set] As Short)
|
||||
'AplCncNumber.Add(cnc)
|
||||
'AplChannel.Add(channel)
|
||||
'AplSet.Add([set])
|
||||
End Sub
|
||||
|
||||
Private Sub objErrorHandler_ErrorOnOtherChannel(ByVal status As Short)
|
||||
'AplStatus = status
|
||||
End Sub
|
||||
|
||||
Private Sub objErrorHandler_Exception(ByVal status As Short)
|
||||
'ExceptStatus = status
|
||||
End Sub
|
||||
|
||||
Friend Sub objErrorHandler_ErrorFromActiveCnc2(ErrorNumber As List(Of Integer))
|
||||
' resetto stati bFound
|
||||
For Each Message In m_ReadFXMessages
|
||||
Message.bFound = False
|
||||
Next
|
||||
|
||||
For index As Integer = 0 To ErrorNumber.Count - 1
|
||||
Dim nIndex As Integer = index
|
||||
Dim NewMessageInList As ReadMessages = m_ReadFXMessages.FirstOrDefault(Function(x) x.CMsgCncNumber = 0.ToString() AndAlso
|
||||
x.CMsgErrorType = 6.ToString() AndAlso
|
||||
x.CMsgErrorIndex = "" AndAlso
|
||||
x.CMsgErrorNumber = ErrorNumber(nIndex).ToString() AndAlso
|
||||
x.CMsgErrorLine = "" AndAlso
|
||||
x.CMsgErrorMessage = "")
|
||||
' se il messaggio e' gia' in lista
|
||||
If Not IsNothing(NewMessageInList) Then
|
||||
' lo segno come trovato
|
||||
NewMessageInList.bFound = True
|
||||
Else
|
||||
' lo aggiungo
|
||||
Dim NewMessage As ReadMessages = New ReadMessages(0.ToString(),
|
||||
6.ToString(),
|
||||
"",
|
||||
ErrorNumber(index).ToString(),
|
||||
"",
|
||||
"",
|
||||
"")
|
||||
NewMessage.bFound = True
|
||||
m_ReadFXMessages.Add(NewMessage)
|
||||
m_NUMAlarmCallbackDlg(0, 0, 6.ToString(), "", ErrorNumber(index).ToString(), "", "", "")
|
||||
End If
|
||||
Next
|
||||
|
||||
' cancello messaggi non trovati
|
||||
For Index = m_ReadFXMessages.Count - 1 To 0 Step -1
|
||||
Dim Message As ReadMessages = m_ReadFXMessages(Index)
|
||||
If Not Message.bFound Then
|
||||
m_NUMAlarmCallbackDlg(Message.CMsgCncNumber, 1, Message.CMsgErrorType, Message.CMsgErrorIndex, Message.CMsgErrorNumber, Message.CMsgErrorLine, Message.CMsgErrorMessage, Message.CMsgErrorAdditional)
|
||||
m_ReadFXMessages.RemoveAt(Index)
|
||||
End If
|
||||
Next
|
||||
|
||||
End Sub
|
||||
|
||||
#Region "PLC Variables"
|
||||
|
||||
Private Sub objDPlcVariables_ReadVariablesChanged(ByVal index As Object, ByVal value As Object)
|
||||
Dim _ObjIndex As Object() = CType(index, Object())
|
||||
Dim _ObjValue As Object() = CType(value, Object())
|
||||
|
||||
For index = 0 To _ObjIndex.Length - 1
|
||||
Dim nObjIndex As Integer = Integer.Parse(_ObjIndex(index).ToString())
|
||||
Dim CommVar As CommVar = m_ReadingVars.FirstOrDefault(Function(x) Not IsNothing(x) AndAlso
|
||||
x.Paragraph = CommVar.Paragraphs.MAIN AndAlso
|
||||
x.nType = CommVar.Types.CN AndAlso
|
||||
x.Index = nObjIndex)
|
||||
If Not IsNothing(CommVar) Then
|
||||
CommVar.SetValue(_ObjValue(index).ToString())
|
||||
End If
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Private Sub objDPlcVariables_ReadPLCVariablesChanged(ByVal index As Object, ByVal value As Object)
|
||||
Dim _ObjIndex As Object() = CType(index, Object())
|
||||
Dim _ObjValue As Object() = CType(value, Object())
|
||||
|
||||
For index = 0 To _ObjIndex.Length - 1
|
||||
Dim nObjIndex As Integer = Integer.Parse(_ObjIndex(index).ToString())
|
||||
Dim CommVar As CommVar = m_ReadingVars.FirstOrDefault(Function(x) Not IsNothing(x) AndAlso
|
||||
x.Paragraph = CommVar.Paragraphs.MAIN AndAlso
|
||||
x.nType = CommVar.Types.PLC AndAlso
|
||||
x.Index = nObjIndex)
|
||||
If Not IsNothing(CommVar) Then
|
||||
CommVar.SetValue(_ObjValue(index).ToString())
|
||||
End If
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Private Sub objDPlcVariables_InvalidReadList(ByVal errorCode As Short)
|
||||
EgtOutLog("InvalidReadList - ErrorCode: " & errorCode)
|
||||
End Sub
|
||||
|
||||
Private Sub objDPlcVariables_AbortReadVariables()
|
||||
EgtOutLog("InvalidReadList - ErrorCode: ")
|
||||
End Sub
|
||||
|
||||
Private Sub objDPlcVariables_ReadOnceVariablesChanged(ByVal lHandle As Integer, ByVal value As Object)
|
||||
'Dim _ObjValue As Object() = CType(value, Object())
|
||||
|
||||
'If lHandle = 10 Then
|
||||
|
||||
' For i As Integer = 0 To _ObjValue.Length - 1
|
||||
' _ReadPlcVariableOnetime(i).Invoke(CType(Function()
|
||||
' _ReadPlcVariableOnetime(i).Text = _ObjValue(i).ToString()
|
||||
' End Function, MethodInvoker))
|
||||
' Next
|
||||
'End If
|
||||
End Sub
|
||||
|
||||
Private Sub objDPlcVariables_VariablesWritten2(ByVal lHandle As Integer, ByVal errorCode As Integer)
|
||||
Dim bOk As Boolean = (errorCode <> 0)
|
||||
m_ResultCallbackDlg(CommandTypes.WRITE, If(bOk, CommandStates.OK, CommandStates.ERROR_), ResultTypes.RESULT, If(bOk, "", "Error VariablesWritten2 :" & " " & errorCode.ToString()))
|
||||
End Sub
|
||||
|
||||
#End Region ' PLC Variables
|
||||
|
||||
#Region "ReadELS"
|
||||
|
||||
Private Sub objDReadELS_ValueChanged(ByVal nHandle As Short, ByVal dValue As Double, ByVal nerrorCode As Short)
|
||||
If nHandle < 1 OrElse nHandle > m_ReadingVars.Count - 1 Then Return
|
||||
If nerrorCode <> 0 Then EgtOutLog(" Error in Validchanged2 : " & nerrorCode & " Handle : " & nHandle)
|
||||
|
||||
Try
|
||||
m_ReadingVars(nHandle - 1).SetValue(dValue.ToString("F04"))
|
||||
Catch Ex As Exception
|
||||
EgtOutLog(Ex.Message)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
#End Region ' ReadELS
|
||||
|
||||
#Region "File transfer"
|
||||
|
||||
Private Sub objDFileTransfer_Completed(ByVal lHandle As Integer)
|
||||
If lHandle = 10 OrElse lHandle = 20 Then
|
||||
'resetto contatore di trasferimento
|
||||
m_BytesTransferedCounter = 0
|
||||
EgtOutLog("Up- or Download successful completed:" & " " & lHandle.ToString())
|
||||
' aggiorno variabili del MAIN
|
||||
Dim ISONumVariable As Variable = Map.refMachCommandMessagePanelVM.MainVariablesList.FirstOrDefault(Function(x) x.sName = ISO_NUM)
|
||||
Dim ISOSentVariable As Variable = Map.refMachCommandMessagePanelVM.MainVariablesList.FirstOrDefault(Function(x) x.sName = ISO_SENT)
|
||||
Dim SentMachGroup As MyMachGroupVM = Map.refSupervisorMachGroupPanelVM.MachGroupVMList.FirstOrDefault(Function(x As MyMachGroupVM) x.bSendingToMachine)
|
||||
If Not IsNothing(SentMachGroup) Then
|
||||
ISONumVariable.sValue = SentMachGroup.Name
|
||||
ISOSentVariable.sValue = 0
|
||||
SentMachGroup.SetSentToMachine(True)
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub objDFileTransfer_TransferStarted(ByVal lHandle As Integer)
|
||||
EgtOutLog("Transfer has been started !")
|
||||
End Sub
|
||||
|
||||
Private Sub objDFileTransfer_Failed(ByVal lHandle As Integer, ByVal nSeq As Short, ByVal nReason As Short)
|
||||
EgtOutLog("Sequence:" & " " & nSeq.ToString() & " " & "Reason:" & " " & nReason.ToString())
|
||||
End Sub
|
||||
|
||||
Private Sub objDFileTransfer_BytesTransfered(ByVal lHandle As Integer, ByVal lBytes As Integer)
|
||||
m_BytesTransferedCounter += lBytes
|
||||
End Sub
|
||||
|
||||
#End Region ' File transfer
|
||||
|
||||
#Region "Position"
|
||||
|
||||
Private Sub objDPosition_PositionChanged(ByVal vtArrayIndex As Object, ByVal vtArrayValues As Object)
|
||||
Dim _indexArray As Object() = CType(vtArrayIndex, Object())
|
||||
Dim _valueArray As Object() = CType(vtArrayValues, Object())
|
||||
|
||||
For _index As Integer = 0 To _indexArray.Length - 1
|
||||
|
||||
Dim _index1 As Int16 = CType(_indexArray.GetValue(_index), Int16)
|
||||
Dim _axisPosValue As Int32 = CType(_valueArray.GetValue(_index), Int32)
|
||||
Dim _axisRefPosValue As Single = CSng(_axisPosValue) / m_LinearAxisPrecision
|
||||
m_AxisCoordinatesCallbackDlg(_axisPosValue, _index1)
|
||||
|
||||
Next
|
||||
End Sub
|
||||
|
||||
#End Region ' Position
|
||||
|
||||
#Region "MDI"
|
||||
|
||||
Private Sub objDMdiCommand_CommandWritten(ByVal retVal As Short)
|
||||
If retVal <> 0 Then
|
||||
EgtOutLog("Error CommandWritten :" & " " & retVal.ToString())
|
||||
End If
|
||||
Map.refMDIPageVM.SendMDIResult(retVal)
|
||||
End Sub
|
||||
|
||||
#End Region ' MDI
|
||||
|
||||
#Region "Variables"
|
||||
|
||||
Private Sub objDVariables_VariableWritten2(ByVal lHandle As Integer, ByVal errorCode As Short)
|
||||
If lHandle <> 2 OrElse errorCode <> 0 Then
|
||||
EgtOutLog(" Error on objDVariables_VariableWritten2 : handle " & lHandle.ToString() & " errorCode : " & errorCode.ToString())
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub objDVariables_VariableWritten(ByVal errorCode As Short)
|
||||
If errorCode <> 0 Then
|
||||
EgtOutLog(" Error on objDVariables_VariableWritten errorCode : " & errorCode.ToString())
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub objDVariables_ValueChanged(ByVal vtArrayIndex As Object, ByVal vtArrayValues As Object)
|
||||
Dim AplArrayIndex As Object() = CType(vtArrayIndex, Object())
|
||||
Dim AplArrayValue As Object() = CType(vtArrayValues, Object())
|
||||
|
||||
For index As Integer = 0 To AplArrayIndex.Length - 1
|
||||
Dim nHandle As Integer = CType(AplArrayIndex.GetValue(index), Int16)
|
||||
If nHandle < 1 OrElse nHandle > m_ReadingVars.Count - 1 Then Return
|
||||
Dim dValue As Double = CDbl(AplArrayValue.GetValue(index))
|
||||
Try
|
||||
m_ReadingVars(nHandle - 1).SetValue(dValue.ToString("F04"))
|
||||
Catch Ex As Exception
|
||||
EgtOutLog(Ex.Message)
|
||||
End Try
|
||||
Next
|
||||
End Sub
|
||||
|
||||
#End Region ' Variables
|
||||
|
||||
#Region "CNCMode"
|
||||
|
||||
Private Sub objDCncMode_ValueChanged(ByVal mode As Short, ByVal preselected As Short)
|
||||
m_OpModeCallbackDlg(mode)
|
||||
End Sub
|
||||
|
||||
#End Region ' CNCMode
|
||||
|
||||
#Region "ReadOperatorMessage"
|
||||
|
||||
Private Sub objDReadOperatorMessage_ValueChanged(ByVal line As Object)
|
||||
' resetto stati bFound
|
||||
For Each Message In m_ReadOperatorMessages
|
||||
Message.bFound = False
|
||||
Next
|
||||
Dim objLine As String = TryCast(line, String)
|
||||
Dim OpMsgErrType As Integer = 30
|
||||
Dim NewMessageInList As ReadMessages = m_ReadOperatorMessages.FirstOrDefault(Function(x) x.CMsgCncNumber = 0 AndAlso
|
||||
x.CMsgErrorType = OpMsgErrType.ToString() AndAlso
|
||||
x.CMsgErrorIndex = "" AndAlso
|
||||
x.CMsgErrorNumber = "" AndAlso
|
||||
x.CMsgErrorLine = "" AndAlso
|
||||
x.CMsgErrorMessage = objLine AndAlso
|
||||
x.CMsgErrorAdditional = "")
|
||||
' se il messaggio e' gia' in lista
|
||||
If Not IsNothing(NewMessageInList) Then
|
||||
' lo segno come trovato
|
||||
NewMessageInList.bFound = True
|
||||
Else
|
||||
' se e' diverso da stringa vuota
|
||||
If Not String.IsNullOrWhiteSpace(objLine.ToString()) Then
|
||||
' lo aggiungo
|
||||
Dim NewMessage As ReadMessages = New ReadMessages(0,
|
||||
OpMsgErrType.ToString(),
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
objLine,
|
||||
"")
|
||||
NewMessage.bFound = True
|
||||
m_ReadOperatorMessages.Add(NewMessage)
|
||||
m_NUMAlarmCallbackDlg(0, 0, OpMsgErrType.ToString(), "", "", "", objLine, "")
|
||||
End If
|
||||
End If
|
||||
|
||||
' cancello messaggi non trovati
|
||||
If m_ReadOperatorMessages.Count > 0 Then
|
||||
For Index = m_ReadOperatorMessages.Count - 1 To 0 Step -1
|
||||
Dim Message As ReadMessages = m_ReadOperatorMessages(Index)
|
||||
If Not Message.bFound Then
|
||||
m_NUMAlarmCallbackDlg(Message.CMsgCncNumber, 1, Message.CMsgErrorType, Message.CMsgErrorIndex, Message.CMsgErrorNumber, Message.CMsgErrorLine, Message.CMsgErrorMessage, Message.CMsgErrorAdditional)
|
||||
m_ReadOperatorMessages.RemoveAt(Index)
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region ' ReadOperatorMessage
|
||||
|
||||
#End Region ' EVENTS
|
||||
|
||||
End Class
|
||||
File diff suppressed because it is too large
Load Diff
@@ -53,7 +53,7 @@ Public Class NUMFlexiumComm
|
||||
Private m_ReadFXMessages As New List(Of ReadMessages)
|
||||
Private m_ReadOperatorMessages As New List(Of ReadMessages)
|
||||
' lista variabili in lettura
|
||||
Private Shared m_ReadingVars(100) As CommVar
|
||||
Private Shared m_ReadingVars(230) As CommVar
|
||||
Private m_BytesTransferedCounter As Integer
|
||||
Private m_LinearAxisPrecision As Integer
|
||||
|
||||
@@ -368,6 +368,31 @@ Public Class NUMFlexiumComm
|
||||
|
||||
Friend Sub FileDownload(sFileType As String, sFilePath As String)
|
||||
Dim _Return_Download As Short
|
||||
'' leggo variabile E30099
|
||||
'Dim SendPermissionVariable As Variable = Map.refMachCommandMessagePanelVM.MainVariablesList.FirstOrDefault(Function(x) x.sName = SENDPERMISSION)
|
||||
'Dim dTemp As Double = 0
|
||||
'Dim nSendPermission As Integer = 0
|
||||
'EgtOutLog("Inizio invio programma")
|
||||
'While nSendPermission <> 2
|
||||
' Dim bFirstWriteOne = True
|
||||
' EgtOutLog("Inizio ciclo verifica diverso da 2")
|
||||
' ' leggo valore
|
||||
' If Not IsNothing(SendPermissionVariable.sValue) Then
|
||||
' StringToDoubleAdv(SendPermissionVariable.sValue, dTemp)
|
||||
' Integer.TryParse(dTemp, nSendPermission)
|
||||
' EgtOutLog("Lettura variabile E30099: " & nSendPermission)
|
||||
' Else
|
||||
' EgtOutLog("nSendPermission = -1")
|
||||
' nSendPermission = -1
|
||||
' End If
|
||||
' ' se uguale a zero ci scrivo uno
|
||||
' If nSendPermission = 0 And bFirstWriteOne Then
|
||||
' bFirstWriteOne = False
|
||||
' SendPermissionVariable.sValue = 1
|
||||
' EgtOutLog("Scrittura variabile E30099 = 1")
|
||||
' End If
|
||||
' Threading.Thread.Sleep(1000)
|
||||
'End While
|
||||
|
||||
_Return_Download = objDFileTransfer.FileDownload2(10, sFileType, sFilePath, "", 1, 0)
|
||||
|
||||
@@ -424,7 +449,7 @@ Public Class NUMFlexiumComm
|
||||
Friend Sub WriteNCVariables(Address As String, value As String)
|
||||
Try
|
||||
Dim dValue As Double = 0
|
||||
StringToDouble(value, dValue)
|
||||
StringToDoubleAdv(value, dValue)
|
||||
Dim rc As Short = objDVariables.WriteVariables2(2, objDGroupManager.Handle, Address, dValue)
|
||||
|
||||
If rc <> 0 Then EgtOutLog(" objDVariables.WriteVariables2() Error : " & rc)
|
||||
@@ -451,7 +476,9 @@ Public Class NUMFlexiumComm
|
||||
|
||||
Private Sub objDGeneralFunction_ProgramActivated(ByVal nerrorCode As Short)
|
||||
EgtOutLog("Part program activated:" & " " & nerrorCode)
|
||||
DbControllers.m_LogMachineController.Create(MachLog.CreateResultLog(CommandTypes.SENDPROG, CommandStates.OK, ResultTypes.EXECUTED, "Part program activated:" & " " & nerrorCode))
|
||||
'DbControllers.m_LogMachineController.Create(MachLog.CreateResultLog(CommandTypes.SENDPROG, CommandStates.OK, ResultTypes.EXECUTED, "Part program activated:" & " " & nerrorCode))
|
||||
' scrivo evento programma attivato
|
||||
DbControllers.m_LogMachineController.Create(LogEvent.CreateMachCommandLog(LogEvent.MachineCommands.PROGRAM_ACTIVATION, "", nerrorCode, DbControllers.SupervisorId))
|
||||
End Sub
|
||||
|
||||
Private Sub objDGeneralFunction_OnCncStart(ByVal errorCode As Short)
|
||||
@@ -529,13 +556,14 @@ Public Class NUMFlexiumComm
|
||||
Dim AplErrorAdditional As Object() = CType(ErrorAdditional, Object())
|
||||
|
||||
For index As Integer = 0 To numberOfError - 1
|
||||
Dim nIndex As Integer = index
|
||||
Dim NewMessageInList As ReadMessages = m_ReadFXMessages.FirstOrDefault(Function(x) x.CMsgCncNumber = AplCnCNumber AndAlso
|
||||
x.CMsgErrorType = AplErrorType(index).ToString() AndAlso
|
||||
x.CMsgErrorIndex = AplErrorIndex(index).ToString() AndAlso
|
||||
x.CMsgErrorNumber = AplErrorNumber(index).ToString() AndAlso
|
||||
x.CMsgErrorLine = AplErrorLine(index).ToString() AndAlso
|
||||
x.CMsgErrorMessage = AplErrorMessage(index).ToString() AndAlso
|
||||
x.CMsgErrorAdditional = AplErrorAdditional(index).ToString())
|
||||
x.CMsgErrorType = AplErrorType(nIndex).ToString() AndAlso
|
||||
x.CMsgErrorIndex = AplErrorIndex(nIndex).ToString() AndAlso
|
||||
x.CMsgErrorNumber = AplErrorNumber(nIndex).ToString() AndAlso
|
||||
x.CMsgErrorLine = AplErrorLine(nIndex).ToString() AndAlso
|
||||
x.CMsgErrorMessage = AplErrorMessage(nIndex).ToString() AndAlso
|
||||
x.CMsgErrorAdditional = AplErrorAdditional(nIndex).ToString())
|
||||
' se il messaggio e' gia' in lista
|
||||
If Not IsNothing(NewMessageInList) Then
|
||||
' lo segno come trovato
|
||||
@@ -889,12 +917,13 @@ Public Class NUMFlexiumComm
|
||||
Dim objLine As Object() = CType(line, Object())
|
||||
Dim OpMsgErrType As Integer = 30
|
||||
For index As Integer = 0 To objMsgNumber.Length - 1
|
||||
Dim nIndex As Integer = index
|
||||
Dim NewMessageInList As ReadMessages = m_ReadOperatorMessages.FirstOrDefault(Function(x) x.CMsgCncNumber = 0 AndAlso
|
||||
x.CMsgErrorType = OpMsgErrType.ToString() AndAlso
|
||||
x.CMsgErrorIndex = "" AndAlso
|
||||
x.CMsgErrorNumber = objMsgNumber(index).ToString() AndAlso
|
||||
x.CMsgErrorNumber = objMsgNumber(nIndex).ToString() AndAlso
|
||||
x.CMsgErrorLine = "" AndAlso
|
||||
x.CMsgErrorMessage = objLine(index).ToString() AndAlso
|
||||
x.CMsgErrorMessage = objLine(nIndex).ToString() AndAlso
|
||||
x.CMsgErrorAdditional = "")
|
||||
' se il messaggio e' gia' in lista
|
||||
If Not IsNothing(NewMessageInList) Then
|
||||
|
||||
@@ -93,7 +93,7 @@ Public Class TPAComm
|
||||
System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(channel, False)
|
||||
Dim remoteType As System.Runtime.Remoting.WellKnownClientTypeEntry = New System.Runtime.Remoting.WellKnownClientTypeEntry(GetType(ISOCNC.Remoting_Server), serverURI)
|
||||
System.Runtime.Remoting.RemotingConfiguration.RegisterWellKnownClientType(remoteType)
|
||||
Dim objectUri As String
|
||||
Dim objectUri As String = Nothing
|
||||
Dim messageSink As System.Runtime.Remoting.Messaging.IMessageSink = channel.CreateMessageSink("ipc://localhost:9090/IRemoteObject.rem", Nothing, objectUri)
|
||||
Console.WriteLine("The URI of the message sink is {0}.", objectUri)
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@ Module ConstCommVar
|
||||
NULL = 0
|
||||
TPA = 1
|
||||
NUM_FLEXIUM = 2
|
||||
NUM_AXIUM_APSERVER = 3
|
||||
NUM_AXIUM_PCTOOLKIT = 4
|
||||
End Enum
|
||||
|
||||
' Assi
|
||||
@@ -44,6 +46,14 @@ Module ConstCommVar
|
||||
Public Const RUNNING As String = "Running"
|
||||
' indice della lavorazione in corso (pareti NUM)
|
||||
Public Const MACHINDEX As String = "MachIndex"
|
||||
' indice dell'utensile montato sulla testa 1
|
||||
Public Const TOOLINDEX As String = "ToolIndex"
|
||||
' indice dell'utensile montato sulla testa 1
|
||||
Public Const TOOLINDEX2 As String = "ToolIndex2"
|
||||
' variabile per lettura errori PLC bit a bit
|
||||
Public Const PLC_MESSAGES As String = "PLC_Messages"
|
||||
' variabile per leggere e scrivere permesso invio cn a macchina
|
||||
Public Const SENDPERMISSION As String = "SendPermission"
|
||||
|
||||
Public Enum OPStates
|
||||
Start = 1
|
||||
|
||||
@@ -3,5 +3,7 @@
|
||||
Public Const MDI_MSG As String = "MDI"
|
||||
Public Const PLC_MSG As String = "PLC"
|
||||
Public Const CNC_MSG As String = "CNC"
|
||||
Public Const INPUT_MSG As String = "INPUT"
|
||||
Public Const OUTPUT_MSG As String = "OUTPUT"
|
||||
|
||||
End Module
|
||||
|
||||
@@ -99,20 +99,63 @@
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'RemoteDebug|AnyCPU'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>bin\RemoteDebug\</OutputPath>
|
||||
<DocumentationFile>EgtBEAMWALL.Supervisor.xml</DocumentationFile>
|
||||
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'RemoteDebug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>bin\x64\RemoteDebug\</OutputPath>
|
||||
<DocumentationFile>EgtBEAMWALL.Supervisor.xml</DocumentationFile>
|
||||
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'RemoteDebug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>bin\x86\RemoteDebug\</OutputPath>
|
||||
<DocumentationFile>EgtBEAMWALL.Supervisor.xml</DocumentationFile>
|
||||
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="BouncyCastle.Crypto, Version=1.8.2.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Portable.BouncyCastle.1.8.2\lib\net40\BouncyCastle.Crypto.dll</HintPath>
|
||||
<Reference Include="APLog">
|
||||
<HintPath>..\ExtLibs\APLog.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="APServer">
|
||||
<HintPath>..\ExtLibs\APServer.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="BouncyCastle.Crypto, Version=1.9.0.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Portable.BouncyCastle.1.9.0\lib\net40\BouncyCastle.Crypto.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Csv, Version=1.0.31.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Csv.1.0.31\lib\net40\Csv.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EgtUILib, Version=2.3.2.1, Culture=neutral, processorArchitecture=MSIL">
|
||||
<Reference Include="EgtUILib, Version=2.4.3.1, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\EgtProg\Dll32\EgtUILib.dll</HintPath>
|
||||
<HintPath>..\ExtLibs\EgtUILib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EgtWPFLib5, Version=2.3.1.1, Culture=neutral, processorArchitecture=MSIL">
|
||||
<Reference Include="EgtWPFLib5, Version=2.4.2.1, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\EgtProg\Dll32\EgtWPFLib5.dll</HintPath>
|
||||
<HintPath>..\ExtLibs\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>
|
||||
@@ -123,16 +166,31 @@
|
||||
<Reference Include="FluentFTP, Version=19.2.2.0, Culture=neutral, PublicKeyToken=f4af092b1d8df44f, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\FluentFTP.19.2.2\lib\net45\FluentFTP.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Google.Protobuf, Version=3.21.9.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Google.Protobuf.3.21.9\lib\net45\Google.Protobuf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Interop.FXLog">
|
||||
<HintPath>..\..\..\EgtProg\EgtBEAMWALL\Interop.FXLog.dll</HintPath>
|
||||
<HintPath>..\ExtLibs\Interop.FXLog.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Interop.FXServer">
|
||||
<HintPath>..\..\..\EgtProg\EgtBEAMWALL\Interop.FXServer.dll</HintPath>
|
||||
<HintPath>..\ExtLibs\Interop.FXServer.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Ionic.Zip, Version=1.9.1.8, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Ionic.Zip.1.9.1.8\lib\Ionic.Zip.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ISOCNC.Remoting">
|
||||
<HintPath>..\..\..\Albatros\Bin\ISOCNC.Remoting.dll</HintPath>
|
||||
<HintPath>..\ExtLibs\ISOCNC.Remoting.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="K4os.Compression.LZ4, Version=1.3.5.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\K4os.Compression.LZ4.1.3.5\lib\net462\K4os.Compression.LZ4.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="K4os.Compression.LZ4.Streams, Version=1.3.5.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\K4os.Compression.LZ4.Streams.1.3.5\lib\net462\K4os.Compression.LZ4.Streams.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="K4os.Hash.xxHash, Version=1.0.8.0, Culture=neutral, PublicKeyToken=32cd54395057cec3, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\K4os.Hash.xxHash.1.0.8\lib\net462\K4os.Hash.xxHash.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="Microsoft.DotNet.PlatformAbstractions, Version=2.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
@@ -141,15 +199,21 @@
|
||||
<Reference Include="Microsoft.Extensions.DependencyModel, Version=2.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.DependencyModel.2.1.0\lib\net451\Microsoft.Extensions.DependencyModel.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 Include="MySql.Data, Version=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MySql.Data.8.0.21\lib\net452\MySql.Data.dll</HintPath>
|
||||
</Reference>
|
||||
<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 Include="MySql.Data.EntityFramework, Version=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MySql.Data.EntityFramework.8.0.21\lib\net452\MySql.Data.EntityFramework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.5.0.1\lib\net46\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Renci.SshNet, Version=2016.1.0.0, Culture=neutral, PublicKeyToken=1cee9f8bde3db106, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SSH.NET.2016.1.0\lib\net40\Renci.SshNet.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SdkApi.Core, Version=2.15.2634.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Zebra.Printer.SDK.2.15.2634\lib\net471\SdkApi.Core.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -162,6 +226,9 @@
|
||||
<Reference Include="SharpSnmpLib, Version=10.0.9.0, Culture=neutral, PublicKeyToken=4c00852d3788e005, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Lextm.SharpSnmpLib.10.0.9\lib\net452\SharpSnmpLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Collections.Specialized, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Collections.Specialized.4.3.0\lib\net46\System.Collections.Specialized.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
@@ -174,7 +241,14 @@
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Drawing.Design" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<Reference Include="System.IO.Pipelines, Version=5.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.IO.Pipelines.5.0.2\lib\net461\System.IO.Pipelines.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Management" />
|
||||
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.NameResolution, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Net.NameResolution.4.3.0\lib\net46\System.Net.NameResolution.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
@@ -185,6 +259,13 @@
|
||||
<Private>True</Private>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.0.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
@@ -192,6 +273,9 @@
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.Remoting" />
|
||||
<Reference Include="System.Security" />
|
||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Transactions" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
@@ -208,6 +292,9 @@
|
||||
<Private>True</Private>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Ubiety.Dns.Core, Version=2.2.1.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MySql.Data.8.0.21\lib\net452\Ubiety.Dns.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
@@ -215,6 +302,9 @@
|
||||
<Reference Include="ZebraPrinterSdk, Version=2.15.2634.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Zebra.Printer.SDK.2.15.2634\lib\net471\ZebraPrinterSdk.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Zstandard.Net, Version=1.1.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MySql.Data.8.0.21\lib\net452\Zstandard.Net.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="Application.xaml">
|
||||
@@ -233,9 +323,15 @@
|
||||
<DependentUpon>CalcPanelV.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="CALCPanel\CALCPanelVM.vb" />
|
||||
<Compile Include="Comms\NUMAxiumComm.vb" />
|
||||
<Compile Include="Comms\NUMAxiumPcToolkitComm.vb" />
|
||||
<Compile Include="Comms\NUMFlexiumComm.vb" />
|
||||
<Compile Include="Comms\TPAComm.vb" />
|
||||
<Compile Include="Constants\ConstMachMsg.vb" />
|
||||
<Compile Include="MachineLogPage\MachineLogPageV.xaml.vb">
|
||||
<DependentUpon>MachineLogPageV.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MachineLogPage\MachineLogPageVM.vb" />
|
||||
<Compile Include="MDIPage\MDIPageV.xaml.vb">
|
||||
<DependentUpon>MDIPageV.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -318,6 +414,7 @@
|
||||
<DependentUpon>Dictionary.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Utility\DisableModifiedMgr.vb" />
|
||||
<Compile Include="Utility\LogEvent.vb" />
|
||||
<Compile Include="Utility\LuaExec.vb" />
|
||||
<Compile Include="Utility\ManageBTLParts.vb" />
|
||||
<Compile Include="Utility\Map.vb" />
|
||||
@@ -347,6 +444,10 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="MachineLogPage\MachineLogPageV.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="MDIPage\MDIPageV.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@@ -483,6 +584,7 @@
|
||||
<CustomToolNamespace>My.Resources</CustomToolNamespace>
|
||||
</EmbeddedResource>
|
||||
<None Include="app.config" />
|
||||
<None Include="app.manifest" />
|
||||
<None Include="My Project\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
|
||||
@@ -556,6 +658,18 @@
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\ProjectManager\Save.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft .NET Framework 4.7.2 %28x86 and x64%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
|
||||
@@ -81,6 +81,13 @@
|
||||
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:RawPartListV}}}"/>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
<!--PosZ - Posizione in Z-->
|
||||
<DataGridTextColumn x:Key="colPOSZ" Binding="{Binding sPosZ}">
|
||||
<DataGridTextColumn.Header>
|
||||
<TextBlock Text="{Binding Path=DataContext.PosZ_Msg,
|
||||
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:RawPartListV}}}"/>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
<!--MAT - Materiale-->
|
||||
<DataGridTextColumn x:Key="colMATERIAL" Binding="{Binding sMATERIAL}">
|
||||
<DataGridTextColumn.Header>
|
||||
@@ -106,6 +113,7 @@
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="DataGridRow" BasedOn="{StaticResource RowDataGrid_CustomHighLight}">
|
||||
<Setter Property="Background" Value="{Binding Production_Background}"/>
|
||||
<EventSetter Event="PreviewMouseDown" Handler="RawPartRow_PreviewMouseDown"/>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
|
||||
|
||||
@@ -1,3 +1,15 @@
|
||||
Public Class RawPartListV
|
||||
|
||||
' funzione che permette di selezionare un RawPart anche quando gia' selezionato
|
||||
Private Sub RawPartRow_PreviewMouseDown(sender As Object, e As MouseButtonEventArgs)
|
||||
If TypeOf sender Is DataGridRow Then
|
||||
Dim Row As DataGridRow = DirectCast(sender, DataGridRow)
|
||||
Dim RowVM As MyMachGroupVM = DirectCast(Row.DataContext, MyMachGroupVM)
|
||||
' se gia' selezionato rifaccio selezione perche' potrbbe essere selezionato un BTLPart
|
||||
If Not IsNothing(Row) AndAlso Row.IsSelected Then
|
||||
Map.refProjectVM.SupervisorMachGroupPanelVM.SelectedMachGroup = Map.refProjectVM.SupervisorMachGroupPanelVM.SelectedMachGroup
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
@@ -13,6 +13,13 @@ Public Class RawPartListVM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_colRawPart_PosZ As EgtDataGridColumn
|
||||
Public ReadOnly Property colRawPart_PosZ As EgtDataGridColumn
|
||||
Get
|
||||
Return m_colRawPart_PosZ
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_RawPartColumns As New ObservableCollection(Of EgtDataGridColumn)
|
||||
Public Property RawPartColumns As ObservableCollection(Of EgtDataGridColumn)
|
||||
Get
|
||||
@@ -55,6 +62,12 @@ Public Class RawPartListVM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property PosZ_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61728)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Material_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61607)
|
||||
@@ -84,23 +97,27 @@ Public Class RawPartListVM
|
||||
Map.SetRefRawPartListVM(Me)
|
||||
' carico le colonne della datagrid
|
||||
GetPrivateProfileColumns(S_RAWPARTLIST_SUPERVISOR, RawPartColumns)
|
||||
' recupero riferimento a colonna StartCut
|
||||
' recupero riferimento a colonna StartCut e PosZ
|
||||
m_colRawPart_StartCut = m_RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_STARTCUT)
|
||||
m_colRawPart_PosZ = m_RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_POSZ)
|
||||
End Sub
|
||||
|
||||
#End Region ' CONSTRUCTOR
|
||||
|
||||
Friend Sub UpdateColumns(nMachType As MachineType)
|
||||
If nMachType = MachineType.BEAM Then
|
||||
If Not IsNothing(m_colRawPart_StartCut) Then
|
||||
m_colRawPart_StartCut.ColumnVisibility = Visibility.Visible
|
||||
End If
|
||||
'RawPartColumns.Clear()
|
||||
'GetPrivateProfileColumns(S_RAWPARTLIST_BEAM, RawPartColumns)
|
||||
' aggiorno la visibilità delle colonne
|
||||
For Each col In RawPartColumns
|
||||
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
|
||||
Next
|
||||
If Not IsNothing(m_colRawPart_StartCut) Then
|
||||
m_colRawPart_StartCut.ColumnVisibility = Visibility.Visible
|
||||
End If
|
||||
If Not IsNothing(m_colRawPart_PosZ) Then
|
||||
m_colRawPart_PosZ.ColumnVisibility = Visibility.Collapsed
|
||||
End If
|
||||
'RawPartColumns.Clear()
|
||||
'GetPrivateProfileColumns(S_RAWPARTLIST_BEAM, RawPartColumns)
|
||||
ElseIf nMachType = MachineType.WALL Then
|
||||
' aggiorno la visibilità delle colonne
|
||||
For Each col In RawPartColumns
|
||||
@@ -109,6 +126,9 @@ Public Class RawPartListVM
|
||||
If Not IsNothing(m_colRawPart_StartCut) Then
|
||||
m_colRawPart_StartCut.ColumnVisibility = Visibility.Collapsed
|
||||
End If
|
||||
If Not IsNothing(m_colRawPart_PosZ) Then
|
||||
m_colRawPart_PosZ.ColumnVisibility = Visibility.Visible
|
||||
End If
|
||||
'RawPartColumns.Clear()
|
||||
'GetPrivateProfileColumns(S_RAWPARTLIST_WALL, RawPartColumns)
|
||||
End If
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="{Binding GridDims[0].GridLen, Mode=TwoWay}"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="{Binding GridDims[1].GridLen, Mode=TwoWay}"/>
|
||||
@@ -32,12 +33,28 @@
|
||||
<TextBlock Text="OPState"/>
|
||||
<TextBlock Text="{Binding SelOPState.Name}"/>
|
||||
</UniformGrid>
|
||||
<Expander Grid.Row="3"
|
||||
<UniformGrid Grid.Row="3"
|
||||
Columns="6"
|
||||
Visibility="{Binding E80000_Visibility}">
|
||||
<TextBlock Text="E80000: "/>
|
||||
<TextBlock Text="{Binding sE80000}"
|
||||
HorizontalAlignment="Left"/>
|
||||
<TextBlock Text="E80001: "/>
|
||||
<TextBlock Text="{Binding sE80001}"
|
||||
HorizontalAlignment="Left"/>
|
||||
<TextBlock Text="E80002: "
|
||||
Visibility="{Binding E80002_Visibility}"/>
|
||||
<TextBlock Text="{Binding sE80002}"
|
||||
HorizontalAlignment="Left"
|
||||
Visibility="{Binding E80002_Visibility}"/>
|
||||
</UniformGrid>
|
||||
<Expander Grid.Row="4"
|
||||
Header="Axis">
|
||||
<EgtBEAMWALL:AxesPanelV DataContext="{StaticResource AxesPanelVM}"/>
|
||||
</Expander>
|
||||
|
||||
<Grid Grid.Row="4">
|
||||
|
||||
<Grid Grid.Row="5">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
@@ -86,9 +103,9 @@
|
||||
Tag="{Binding Tag, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LeftPanelV}}}"/>
|
||||
</Grid>
|
||||
|
||||
<GridSplitter Height="3" HorizontalAlignment="Stretch" Grid.Row="5" ResizeDirection="Rows" ResizeBehavior="PreviousAndNext"/>
|
||||
<GridSplitter Height="3" HorizontalAlignment="Stretch" Grid.Row="6" ResizeDirection="Rows" ResizeBehavior="PreviousAndNext"/>
|
||||
|
||||
<Grid Grid.Row="6">
|
||||
<Grid Grid.Row="7">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
@@ -112,7 +129,10 @@
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
<Grid Grid.Row="1">
|
||||
<Grid Grid.Row="1" x:Name="PartFeatureGrid">
|
||||
<Grid.Resources>
|
||||
<EgtBEAMWALL:FeatureDataGridHeightConverter x:Key="FeatureDataGridHeightConverter"/>
|
||||
</Grid.Resources>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
@@ -120,7 +140,7 @@
|
||||
<EgtBEAMWALL:PartInRawPartListV DataContext="{StaticResource PartInRawPartListVM}"
|
||||
Tag="{Binding Tag.SelectedMachGroup, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LeftPanelV}}}"/>
|
||||
<EgtBEAMWALL:FeatureInPartInRawPartListV Grid.Row="1"
|
||||
Height="80"
|
||||
Height="{Binding ActualHeight, ElementName=PartFeatureGrid, Converter={StaticResource FeatureDataGridHeightConverter}}"
|
||||
DataContext="{StaticResource FeatureInPartInRawPartListVM}"
|
||||
Tag="{Binding Tag.SelectedMachGroup.SelPart, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LeftPanelV}}}"
|
||||
Visibility="{Binding DataContext.FeatureList_Visibility, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LeftPanelV}}}"/>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.Globalization
|
||||
Imports System.IO
|
||||
Imports System.Windows.Threading
|
||||
Imports EgtBEAMWALL.Core
|
||||
@@ -90,6 +91,9 @@ Public Class LeftPanelVM
|
||||
If value.Id = OPModes.Mdi Then
|
||||
' mostro pagina comandi MDI
|
||||
Map.refProjectVM.SetSelTabPage(ProjectVM.TabPages.MDI)
|
||||
ElseIf Map.refCALCPanelVM.bMachineLog Then
|
||||
' mostro log macchina
|
||||
Map.refProjectVM.SetSelTabPage(ProjectVM.TabPages.MACHINELOG)
|
||||
Else
|
||||
' mostro scena
|
||||
Map.refProjectVM.SetSelTabPage(ProjectVM.TabPages.SCENE)
|
||||
@@ -102,6 +106,9 @@ Public Class LeftPanelVM
|
||||
If value.Id = OPModes.Mdi Then
|
||||
' mostro pagina comandi MDI
|
||||
Map.refProjectVM.SetSelTabPage(ProjectVM.TabPages.MDI)
|
||||
ElseIf Map.refCALCPanelVM.bMachineLog Then
|
||||
' mostro log macchina
|
||||
Map.refProjectVM.SetSelTabPage(ProjectVM.TabPages.MACHINELOG)
|
||||
Else
|
||||
' mostro scena
|
||||
Map.refProjectVM.SetSelTabPage(ProjectVM.TabPages.SCENE)
|
||||
@@ -109,6 +116,36 @@ Public Class LeftPanelVM
|
||||
m_SelOPMode = value
|
||||
NotifyPropertyChanged(NameOf(SelOPMode))
|
||||
End Sub
|
||||
Public ReadOnly Property sE80000 As String
|
||||
Get
|
||||
Dim MachIndexVar As Variable = Map.refMachCommandMessagePanelVM.MainVariablesList.FirstOrDefault(Function(x) x.sName = MACHINDEX)
|
||||
Return If(IsNothing(MachIndexVar), "", MachIndexVar.sValue)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property sE80001 As String
|
||||
Get
|
||||
Dim ToolIndexVar As Variable = Map.refMachCommandMessagePanelVM.MainVariablesList.FirstOrDefault(Function(x) x.sName = TOOLINDEX)
|
||||
Return If(IsNothing(ToolIndexVar), "", ToolIndexVar.sValue)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property sE80002 As String
|
||||
Get
|
||||
Dim ToolIndex2Var As Variable = Map.refMachCommandMessagePanelVM.MainVariablesList.FirstOrDefault(Function(x) x.sName = TOOLINDEX2)
|
||||
Return If(IsNothing(ToolIndex2Var), "", ToolIndex2Var.sValue)
|
||||
End Get
|
||||
End Property
|
||||
Public Property m_E80000_Visibility As Visibility
|
||||
Public ReadOnly Property E80000_Visibility As Visibility
|
||||
Get
|
||||
Return m_E80000_Visibility
|
||||
End Get
|
||||
End Property
|
||||
Public Property m_E80002_Visibility As Visibility
|
||||
Public ReadOnly Property E80002_Visibility As Visibility
|
||||
Get
|
||||
Return m_E80002_Visibility
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_bRestart As Boolean = False
|
||||
Public Property bRestart As Boolean
|
||||
@@ -229,7 +266,7 @@ Public Class LeftPanelVM
|
||||
|
||||
Public ReadOnly Property OPMode_Visibility As Visibility
|
||||
Get
|
||||
Return If(CurrentMachine.NCType = NCTypes.NUM_FLEXIUM, Visibility.Visible, Visibility.Collapsed)
|
||||
Return If(CurrentMachine.NCType = NCTypes.NUM_FLEXIUM Or CurrentMachine.NCType = NCTypes.NUM_AXIUM_APSERVER Or CurrentMachine.NCType = NCTypes.NUM_AXIUM_PCTOOLKIT, Visibility.Visible, Visibility.Collapsed)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
@@ -341,7 +378,7 @@ Public Class LeftPanelVM
|
||||
' carico stati della macchina
|
||||
Select Case NCType
|
||||
Case NCTypes.TPA
|
||||
Case NCTypes.NUM_FLEXIUM
|
||||
Case NCTypes.NUM_FLEXIUM, NCTypes.NUM_AXIUM_APSERVER, NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||
m_ChannelList = New List(Of IdNameStruct)
|
||||
Dim ChannelIndex As Integer = 1
|
||||
Dim ChannelString As String = ""
|
||||
@@ -390,7 +427,7 @@ Public Class LeftPanelVM
|
||||
New OPState("Pending", OPStates.Pending),
|
||||
New OPState("Unspecified", OPStates.Unspecified)
|
||||
}
|
||||
Case NCTypes.NUM_FLEXIUM
|
||||
Case NCTypes.NUM_FLEXIUM, NCTypes.NUM_AXIUM_APSERVER, NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||
m_OPStateList = New List(Of OPState) From {
|
||||
New OPState("Start", OPStates.Start),
|
||||
New OPState("Stop", OPStates.Stop),
|
||||
@@ -410,7 +447,7 @@ Public Class LeftPanelVM
|
||||
m_OPModeList = New List(Of OPState) From {
|
||||
New OPState("Manual", OPModes.Manual)
|
||||
}
|
||||
Case NCTypes.NUM_FLEXIUM
|
||||
Case NCTypes.NUM_FLEXIUM, NCTypes.NUM_AXIUM_APSERVER, NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||
m_OPModeList = New List(Of OPState) From {
|
||||
New OPState("Auto", OPModes.Auto),
|
||||
New OPState("Single", OPModes.Single),
|
||||
@@ -421,6 +458,28 @@ Public Class LeftPanelVM
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Friend Sub SetE80000Visibility()
|
||||
' imposto visibilità variabili E80000 e seconda del tipo di controllo
|
||||
If CurrentMachine.NCType = NCTypes.TPA Then
|
||||
m_E80000_Visibility = Visibility.Collapsed
|
||||
m_E80002_Visibility = Visibility.Collapsed
|
||||
Else
|
||||
m_E80000_Visibility = Visibility.Visible
|
||||
m_E80002_Visibility = Visibility.Collapsed
|
||||
Dim ReadVar As String = ""
|
||||
Dim Index = 1
|
||||
While GetPrivateProfileString(S_MAINVARIABLES, Index, "", ReadVar, CurrentMachine.sMachIniFile) <> 0
|
||||
If ReadVar.StartsWith(TOOLINDEX2) Then
|
||||
m_E80002_Visibility = Visibility.Visible
|
||||
Exit While
|
||||
End If
|
||||
Index += 1
|
||||
End While
|
||||
End If
|
||||
NotifyPropertyChanged(NameOf(E80000_Visibility))
|
||||
NotifyPropertyChanged(NameOf(E80002_Visibility))
|
||||
End Sub
|
||||
|
||||
Friend Sub UpdateButtonIsEnabledState()
|
||||
NotifyPropertyChanged(NameOf(MoveRawPart_IsEnabled))
|
||||
NotifyPropertyChanged(NameOf(DoneRawPart_IsEnabled))
|
||||
@@ -502,6 +561,8 @@ Public Class LeftPanelVM
|
||||
If CurrentMachine.Flow = FlowTypes.ONEBYONE Then
|
||||
MyMachGroupVM.UpdateProduceIsEnabledForAll()
|
||||
End If
|
||||
' aggiorno log macchina
|
||||
Map.refMachineLogPageVM.UpdateMachineLogList(False)
|
||||
End Sub
|
||||
|
||||
#End Region ' DoneRawPart
|
||||
@@ -602,6 +663,12 @@ Public Class LeftPanelVM
|
||||
If IsNothing(MachGroup) OrElse IsNothing(Part) Then Return
|
||||
' se ora d'inizio non e' gia' fissata
|
||||
Dim Time As DateTime = DateTime.Now()
|
||||
If Part.nProduction_State = ItemState.Scrapped Then
|
||||
' fare domanda se modificare quantita' aggiunti se viene resettato un pezzo scraped??
|
||||
'If MessageBox.Show("There are scraped parts in this bar. Would you like to add them to the added quantity?", "", MessageBoxButton.YesNo, MessageBoxImage.Information) = MessageBoxResult.Yes Then
|
||||
' DbControllers.m_StatusMapController.UpdateAction("", Map.refSupervisorManagerVM.CurrProd.nProdId, Part.nPartId, StatusMapItemType.Part, StatusMapOpType.AddQtyForUnscraped, "")
|
||||
'End If
|
||||
End If
|
||||
If Part.dtStartTime <> DateTime.MinValue Then
|
||||
DbControllers.m_PartController.UpdateStart(Map.refSupervisorManagerVM.CurrProd.nProdId, MachGroup.Id, Part.nPartId, DateTime.MinValue)
|
||||
DbControllers.m_PartController.UpdateEnd(Map.refSupervisorManagerVM.CurrProd.nProdId, MachGroup.Id, Part.nPartId, DateTime.MinValue)
|
||||
@@ -734,6 +801,9 @@ Public Class LeftPanelVM
|
||||
End If
|
||||
Next
|
||||
SetDonePart(SelMachGroup, SelMachGroup.SelPart)
|
||||
Map.refProjectVM.SupervisorMachGroupPanelVM.SelectedMachGroup = SelMachGroup
|
||||
' aggiorno log macchina
|
||||
Map.refMachineLogPageVM.UpdateMachineLogList(False)
|
||||
End Sub
|
||||
|
||||
Public Sub SetDonePart(MachGroup As MyMachGroupVM, Part As PartVM)
|
||||
@@ -745,6 +815,8 @@ Public Class LeftPanelVM
|
||||
DbControllers.m_PartController.UpdateStatus(Map.refSupervisorManagerVM.CurrProd.nProdId, MachGroup.Id, Part.nPartId, ItemState.WIP)
|
||||
Part.dtStartTime = Time
|
||||
Part.nProduction_State = ItemState.WIP
|
||||
' scrivo evento inizio pezzo su DB
|
||||
DbControllers.m_LogMachineController.Create(LogEvent.CreatePartStateLog(Time - TimeSpan.FromSeconds(1), Map.refSupervisorManagerVM.CurrProd.nProdId, MachGroup.Id, Part.nPartId, 1, DbControllers.SupervisorId))
|
||||
' se e' il primo ad essere lavorato
|
||||
If Not MachGroup.PartVMList.Any(Function(x) x IsNot Part AndAlso x.dtStartTime > DateTime.MinValue) Then
|
||||
' se non e' gia' in coda per essere prodotto
|
||||
@@ -755,6 +827,14 @@ Public Class LeftPanelVM
|
||||
' sposto MachGroup in lista come ultimo dei pronti da produrre
|
||||
Dim OldIndex As Integer = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.IndexOf(MachGroup)
|
||||
MachGroup.SetProductionIndex(NewIndex + 1)
|
||||
' aggiorno indice di tutte le barre in coda
|
||||
For Each CurrMachGroup As MyMachGroupVM In Map.refSupervisorMachGroupPanelVM.MachGroupVMList
|
||||
If Not (CurrMachGroup Is MachGroup) AndAlso CurrMachGroup.nProductionIndex >= MachGroup.nProductionIndex AndAlso CurrMachGroup.nProductionIndex < 5000 Then
|
||||
CurrMachGroup.SetProductionIndex(CurrMachGroup.nProductionIndex + 1)
|
||||
DbControllers.m_MachGroupController.UpdateOrder(Map.refSupervisorManagerVM.CurrProd.nProdId, CurrMachGroup.Id, CurrMachGroup.nProductionIndex)
|
||||
End If
|
||||
Next
|
||||
' sposto machgroup impostato a Done
|
||||
DbControllers.m_MachGroupController.UpdateOrder(Map.refSupervisorManagerVM.CurrProd.nProdId, MachGroup.Id, MachGroup.nProductionIndex)
|
||||
Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Move(OldIndex, NewIndex)
|
||||
End If
|
||||
@@ -764,6 +844,8 @@ Public Class LeftPanelVM
|
||||
MachGroup.dtStartTime = Time
|
||||
MachGroup.nProduction_State = ItemState.WIP
|
||||
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.Production_Background))
|
||||
' scrivo evento inizio MachGroup su DB
|
||||
DbControllers.m_LogMachineController.Create(LogEvent.CreateMachGroupStateLog(Time - TimeSpan.FromSeconds(1), Map.refSupervisorManagerVM.CurrProd.nProdId, MachGroup.Id, 1, DbControllers.SupervisorId))
|
||||
' blocco produzione di tutti gli altri perche' iniziato questo
|
||||
MyMachGroupVM.UpdateProduceIsEnabledForAll()
|
||||
End If
|
||||
@@ -773,6 +855,8 @@ Public Class LeftPanelVM
|
||||
DbControllers.m_PartController.UpdateStatus(Map.refSupervisorManagerVM.CurrProd.nProdId, MachGroup.Id, Part.nPartId, ItemState.Produced)
|
||||
Part.dtEndTime = Time
|
||||
Part.nProduction_State = ItemState.Produced
|
||||
' scrivo evento fine pezzo su DB
|
||||
DbControllers.m_LogMachineController.Create(LogEvent.CreatePartStateLog(Time, Map.refSupervisorManagerVM.CurrProd.nProdId, MachGroup.Id, Part.nPartId, 2, DbControllers.SupervisorId))
|
||||
If MachGroup.PartVMList.All(Function(x) x.nProduction_State >= ItemState.Produced) Then
|
||||
'aggiorno anche fine MachGroup
|
||||
DbControllers.m_MachGroupController.UpdateEnd(Map.refSupervisorManagerVM.CurrProd.nProdId, MachGroup.Id, Time)
|
||||
@@ -788,6 +872,8 @@ Public Class LeftPanelVM
|
||||
NotifyPropertyChanged(NameOf(DoneRawPart_IsEnabled))
|
||||
NotifyPropertyChanged(NameOf(MoveRawPart_IsEnabled))
|
||||
NotifyPropertyChanged(NameOf(ResetRawPart_IsEnabled))
|
||||
' scrivo evento fine MachGroup su DB
|
||||
DbControllers.m_LogMachineController.Create(LogEvent.CreateMachGroupStateLog(Time, Map.refSupervisorManagerVM.CurrProd.nProdId, MachGroup.Id, 2, DbControllers.SupervisorId))
|
||||
' se avanzamento singolo, sblocco produzione di tutti gli altri
|
||||
If CurrentMachine.Flow = FlowTypes.ONEBYONE Then
|
||||
MyMachGroupVM.UpdateProduceIsEnabledForAll()
|
||||
@@ -922,14 +1008,48 @@ Public Class LeftPanelVM
|
||||
|
||||
Private Sub CreateDataFile(sFilePath As String, SelPart As PartVM, SelMachGroup As MyMachGroupVM)
|
||||
Dim sFileText As New List(Of String)
|
||||
Dim nBtlInfoId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO)
|
||||
Dim sInfo As String = ""
|
||||
Dim bOk As Boolean = False
|
||||
' inserisco il capitolo del [Main]
|
||||
sFileText.Add("[Main]")
|
||||
sFileText.Add("Var1=$PRODID$," & Map.refSupervisorManagerVM.CurrProd.sProdId)
|
||||
sFileText.Add("Var2=$MACHGROUPID$," & SelMachGroup.Id)
|
||||
sFileText.Add("Var2=$MACHGROUPID$," & SelMachGroup.nName)
|
||||
sFileText.Add("Var3=$PARTID$," & SelPart.nPDN)
|
||||
sFileText.Add("Var4=$MATERIAL$," & SelPart.sMATERIAL)
|
||||
'sFileText.Add("Var5=$Thickness$," & SelPart.Thickness)
|
||||
'sFileText.Add("Var6=$Storage$," & SelPart.WarehousePosition)
|
||||
bOk = EgtGetInfo(nBtlInfoId, BTL_GEN_PROJNUM, sInfo)
|
||||
sFileText.Add("Var5=$PROJECTNUMBER$," & If(bOk, sInfo, ""))
|
||||
bOk = EgtGetInfo(nBtlInfoId, BTL_GEN_PROJNAME, sInfo)
|
||||
sFileText.Add("Var6=$PROJECTNAME$," & If(bOk, sInfo, ""))
|
||||
bOk = EgtGetInfo(nBtlInfoId, BTL_GEN_CUSTOMER, sInfo)
|
||||
sFileText.Add("Var7=$CUSTOMER$," & If(bOk, sInfo, ""))
|
||||
bOk = EgtGetInfo(SelPart.nPartId, BTL_PRT_ASSEMBLYNUM, sInfo)
|
||||
sFileText.Add("Var8=$ASSEMBLYNUMBER$," & If(bOk, sInfo, ""))
|
||||
bOk = EgtGetInfo(SelPart.nPartId, BTL_PRT_ORDERNUM, sInfo)
|
||||
sFileText.Add("Var9=$ORDERNUMBER$," & If(bOk, sInfo, ""))
|
||||
bOk = EgtGetInfo(SelPart.nPartId, BTL_PRT_DESIGNATION, sInfo)
|
||||
sFileText.Add("Var10=$DESIGNATION$," & If(bOk, sInfo, ""))
|
||||
bOk = EgtGetInfo(SelPart.nPartId, BTL_PRT_ANNOTATION, sInfo)
|
||||
sFileText.Add("Var11=$ANNOTATION$," & If(bOk, sInfo, ""))
|
||||
sFileText.Add("Var12=$STOREY$," & SelPart.sSTOREY)
|
||||
sFileText.Add("Var13=$GROUP$," & SelPart.sGROUP)
|
||||
bOk = EgtGetInfo(SelPart.nPartId, BTL_PRT_PACKAGE, sInfo)
|
||||
sFileText.Add("Var14=$PACKAGE$," & If(bOk, sInfo, ""))
|
||||
sFileText.Add("Var15=$WHL$," & SelPart.sW & "x" & SelPart.sH & "x" & SelPart.sL)
|
||||
sFileText.Add("Var16=$PRODUCTIONDATE$," & Date.Now().ToString("yyyy-MM-dd"))
|
||||
' calcolo numero settimana corrente secondo ISO 8601
|
||||
Dim time As Date = Date.Now()
|
||||
Dim Day As DayOfWeek = CultureInfo.InvariantCulture.Calendar.GetDayOfWeek(time)
|
||||
If Day >= DayOfWeek.Monday AndAlso Day <= DayOfWeek.Wednesday Then time = time.AddDays(3)
|
||||
Dim nWeekOfYear As Integer = CultureInfo.InvariantCulture.Calendar.GetWeekOfYear(time, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday)
|
||||
sFileText.Add("Var17=$PRODUCTIONWEEK$," & nWeekOfYear)
|
||||
bOk = EgtGetInfo(SelPart.nPartId, BTL_PRT_DESCRIPTION, sInfo)
|
||||
sFileText.Add("Var18=$DESCRIPTION$," & If(bOk, sInfo, ""))
|
||||
bOk = EgtGetInfo(SelPart.nPartId, BTL_PRT_QUALITYGRADE, sInfo)
|
||||
sFileText.Add("Var19=$QUALITYGRADE$," & If(bOk, sInfo, ""))
|
||||
bOk = EgtGetInfo(nBtlInfoId, BTL_GEN_BTLPATH, sInfo)
|
||||
sFileText.Add("Var20=$BTLPATH$," & If(bOk, Path.GetFileNameWithoutExtension(sInfo), ""))
|
||||
|
||||
Try
|
||||
File.WriteAllLines(sFilePath, sFileText)
|
||||
Catch ex As Exception
|
||||
@@ -963,4 +1083,22 @@ Public Class OPState
|
||||
m_Id = Id
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
End Class
|
||||
|
||||
Public Class FeatureDataGridHeightConverter
|
||||
Implements IValueConverter
|
||||
|
||||
Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert
|
||||
Dim Height As Double = CDbl(value)
|
||||
If Not IsNothing(Height) Then
|
||||
Return Height / 2
|
||||
Else
|
||||
Return 200
|
||||
End If
|
||||
End Function
|
||||
|
||||
Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
|
||||
Throw New NotImplementedException
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
@@ -24,17 +24,21 @@
|
||||
<DataGrid.Resources>
|
||||
<!-- Command -->
|
||||
<DataGridTextColumn x:Key="colCOMMAND" Binding="{Binding sCommand}">
|
||||
<DataGridTextColumn.Header>
|
||||
<TextBlock Text="{Binding Path=DataContext.Command_Msg,
|
||||
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:MDIPageV}}}"/>
|
||||
</DataGridTextColumn.Header>
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=DataContext.Command_Msg,
|
||||
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:MDIPageV}}}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
</DataGridTextColumn>
|
||||
<!-- Descrizione -->
|
||||
<DataGridTextColumn x:Key="colDESCRIPTION" Binding="{Binding sDescription}">
|
||||
<DataGridTextColumn.Header>
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=DataContext.Description_Msg,
|
||||
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:MDIPageV}}}"/>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
</DataGridTextColumn>
|
||||
</DataGrid.Resources>
|
||||
|
||||
@@ -48,6 +52,7 @@
|
||||
<TextBox Text="{Binding sMDICommand_Text, UpdateSourceTrigger=PropertyChanged}"
|
||||
Background="{Binding MDIText_Background}"
|
||||
VerticalAlignment="Center"
|
||||
CharacterCasing="Upper"
|
||||
Margin="5,0,2.5,0"/>
|
||||
<Button Grid.Column="1"
|
||||
Command="{Binding SendMDI_Command}"
|
||||
@@ -57,5 +62,5 @@
|
||||
</Button>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
|
||||
</UserControl>
|
||||
|
||||
@@ -78,13 +78,13 @@ Public Class MDIPageVM
|
||||
|
||||
Public ReadOnly Property Command_Msg As String
|
||||
Get
|
||||
Return "Command"
|
||||
Return EgtMsg(62510)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Description_Msg As String
|
||||
Get
|
||||
Return "Description"
|
||||
Return EgtMsg(62511)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
|
||||
@@ -11,9 +11,6 @@
|
||||
Background="{Binding Message_Foreground}"/>
|
||||
<TextBlock Text="{Binding sErrSystem}"
|
||||
Background="{Binding ErrSystem_Foreground}"/>
|
||||
<Button Content="CANCELLA ALLARMI"
|
||||
Command="{Binding DeleteAlarms_Command}"
|
||||
Visibility="Collapsed"/>
|
||||
<WrapPanel Orientation="Horizontal" Width="{Binding ActualWidth, ElementName=TOPTRAY}">
|
||||
<Button Content="CONNECT"
|
||||
Command="{Binding Connect_Command}"
|
||||
@@ -21,23 +18,28 @@
|
||||
Style="{StaticResource ToolBar_TextButton}"/>
|
||||
<Button Content="START"
|
||||
Command="{Binding Start_Command}"
|
||||
Style="{StaticResource ToolBar_TextButton}"/>
|
||||
Style="{StaticResource ToolBar_TextButton}"
|
||||
IsEnabled="{Binding CommBtn_IsEnabled}"/>
|
||||
<Button Content="STOP"
|
||||
Command="{Binding Stop_Command}"
|
||||
Style="{StaticResource ToolBar_TextButton}"/>
|
||||
Style="{StaticResource ToolBar_TextButton}"
|
||||
IsEnabled="{Binding CommBtn_IsEnabled}"/>
|
||||
<Button Content="RESET"
|
||||
Command="{Binding Reset_Command}"
|
||||
Style="{StaticResource ToolBar_TextButton}"/>
|
||||
<Button Content="STEP"
|
||||
Style="{StaticResource ToolBar_TextButton}"
|
||||
IsEnabled="{Binding CommBtn_IsEnabled}"/>
|
||||
<!--<Button Content="STEP"
|
||||
Command="{Binding Step_Command}"
|
||||
Style="{StaticResource ToolBar_TextButton}"/>
|
||||
Style="{StaticResource ToolBar_TextButton}"/>-->
|
||||
<Button Content="SET POINT"
|
||||
Command="{Binding SetPoint_Command}"
|
||||
Style="{StaticResource ToolBar_TextButton}"/>
|
||||
Style="{StaticResource ToolBar_TextButton}"
|
||||
IsEnabled="{Binding CommBtn_IsEnabled}"/>
|
||||
<Button Content="DELETE ALARMS"
|
||||
Command="{Binding DeleteAlarms_Command}"
|
||||
Visibility="{Binding DeleteAlarm_Visibility}"
|
||||
Style="{StaticResource ToolBar_TextButton}"/>
|
||||
Style="{StaticResource ToolBar_TextButton}"
|
||||
IsEnabled="{Binding CommBtn_IsEnabled}"/>
|
||||
</WrapPanel>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
|
||||
@@ -4,6 +4,7 @@ Imports System.Windows.Threading
|
||||
Imports EgtBEAMWALL.Core.ConstMachComm
|
||||
Imports EgtBEAMWALL.Core
|
||||
Imports EgtWPFLib5
|
||||
Imports EgtUILib
|
||||
|
||||
Public Class MachCommandMessagePanelVM
|
||||
Inherits VMBase
|
||||
@@ -152,7 +153,7 @@ Public Class MachCommandMessagePanelVM
|
||||
Select Case CurrentMachine.NCType
|
||||
Case NCTypes.TPA
|
||||
Return If(Not IsNothing(ShownErr), ShownErr.sCode & ": " & ShownErr.sMessage, "")
|
||||
Case NCTypes.NUM_FLEXIUM
|
||||
Case NCTypes.NUM_FLEXIUM, NCTypes.NUM_AXIUM_APSERVER, NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||
Return If(Not IsNothing(ShownErr), ShownErr.sMessage, "")
|
||||
Case Else
|
||||
Return ""
|
||||
@@ -174,7 +175,7 @@ Public Class MachCommandMessagePanelVM
|
||||
Select Case CurrentMachine.NCType
|
||||
Case NCTypes.TPA
|
||||
Return If(Not IsNothing(ShownErr), ShownErr.sCode & ": " & ShownErr.sMessage, "")
|
||||
Case NCTypes.NUM_FLEXIUM
|
||||
Case NCTypes.NUM_FLEXIUM, NCTypes.NUM_AXIUM_APSERVER, NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||
Return If(Not IsNothing(ShownErr), ShownErr.sMessage, "")
|
||||
Case Else
|
||||
Return ""
|
||||
@@ -196,7 +197,7 @@ Public Class MachCommandMessagePanelVM
|
||||
Select Case CurrentMachine.NCType
|
||||
Case NCTypes.TPA
|
||||
Return If(Not IsNothing(ShownErr), ShownErr.sCode & ": " & ShownErr.sMessage, "")
|
||||
Case NCTypes.NUM_FLEXIUM
|
||||
Case NCTypes.NUM_FLEXIUM, NCTypes.NUM_AXIUM_APSERVER, NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||
Return If(Not IsNothing(ShownErr), ShownErr.sMessage, "")
|
||||
Case Else
|
||||
Return ""
|
||||
@@ -218,7 +219,7 @@ Public Class MachCommandMessagePanelVM
|
||||
Select Case CurrentMachine.NCType
|
||||
Case NCTypes.TPA
|
||||
Return If(Not IsNothing(ShownErr), ShownErr.sCode & ": " & ShownErr.sMessage, "")
|
||||
Case NCTypes.NUM_FLEXIUM
|
||||
Case NCTypes.NUM_FLEXIUM, NCTypes.NUM_AXIUM_APSERVER, NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||
Return If(Not IsNothing(ShownErr), ShownErr.sMessage, "")
|
||||
Case Else
|
||||
Return ""
|
||||
@@ -237,6 +238,17 @@ Public Class MachCommandMessagePanelVM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_CommBtn_IsEnabled As Boolean = True
|
||||
Public ReadOnly Property CommBtn_IsEnabled As Boolean
|
||||
Get
|
||||
Return m_CommBtn_IsEnabled
|
||||
End Get
|
||||
End Property
|
||||
Friend Sub SetCommBtnIsEnabled(value As Boolean)
|
||||
m_CommBtn_IsEnabled = value
|
||||
NotifyPropertyChanged(NameOf(CommBtn_IsEnabled))
|
||||
End Sub
|
||||
|
||||
' definizione comandi
|
||||
Private m_cmdConnect As ICommand
|
||||
Private m_cmdDisconnect As ICommand
|
||||
@@ -525,15 +537,22 @@ Public Class MachCommandMessagePanelVM
|
||||
MachineCommThread.StartTick()
|
||||
' inizializzo variabili
|
||||
Init()
|
||||
If CurrentMachine.NCType = NCTypes.NUM_AXIUM_APSERVER Then
|
||||
Map.refMachManaging.Num_Axium_APServer.GetGeneralFunctions()
|
||||
End If
|
||||
End If
|
||||
' scrivo evento programma attivato
|
||||
DbControllers.m_LogMachineController.Create(LogEvent.CreateMachCommandLog(LogEvent.MachineCommands.CONNECTION, "", 0, DbControllers.SupervisorId))
|
||||
End If
|
||||
Case CommandTypes.DISCONNECT
|
||||
If CommandState = CommandStates.OK Then
|
||||
_Connected = False
|
||||
NotifyPropertyChanged(NameOf(Connect_Background))
|
||||
' scrivo evento programma attivato
|
||||
DbControllers.m_LogMachineController.Create(LogEvent.CreateMachCommandLog(LogEvent.MachineCommands.DISCONNECTION, "", 0, DbControllers.SupervisorId))
|
||||
End If
|
||||
End Select
|
||||
DbControllers.m_LogMachineController.Create(MachLog.CreateResultLog(CommandType, CommandState, ResultType, Params))
|
||||
'DbControllers.m_LogMachineController.Create(MachLog.CreateResultLog(CommandType, CommandState, ResultType, Params))
|
||||
End Sub
|
||||
Friend Sub CloseCallbackDlg(ByRef bCancel As Boolean)
|
||||
' serve?
|
||||
@@ -600,7 +619,8 @@ Public Class MachCommandMessagePanelVM
|
||||
' fermo timer degli allarmi
|
||||
m_AlarmTimer.Stop()
|
||||
End If
|
||||
DbControllers.m_LogMachineController.Create(MachLog.CreateAlarmLog(AlarmOperation, AlarmType, AlarmMessage, AlarmCode, AlarmDateTime))
|
||||
'DbControllers.m_LogMachineController.Create(MachLog.CreateAlarmLog(AlarmOperation, AlarmType, AlarmMessage, AlarmCode, AlarmDateTime))
|
||||
DbControllers.m_LogMachineController.Create(LogEvent.CreateAlarmLog(DateTime.Now(), AlarmOperation & LogEvent.cSeparator & AlarmType & LogEvent.cSeparator & AlarmMessage & LogEvent.cSeparator & AlarmCode & LogEvent.cSeparator & AlarmDateTime, DbControllers.m_SupervisorId))
|
||||
End Sub
|
||||
|
||||
Friend Sub NUMAlarmCallbackDlg(ByVal CncNumber As Integer, ByVal AlarmOperation As Integer, ByVal ErrorTyp As String, ByVal ErrorIndex As String, ByVal ErrorNumber As String, ByVal ErrorLine As String, ByVal ErrorMessage As String, ByVal ErrorAdditional As String)
|
||||
@@ -646,10 +666,17 @@ Public Class MachCommandMessagePanelVM
|
||||
ErrorAdditionalMsg = "Line Number"
|
||||
ErrorNumberMsg = "CN:"
|
||||
End If
|
||||
Dim sErrorMessage As String = ErrorMessage
|
||||
If bMsgTranslationActive Then
|
||||
Dim sTranslatedMsg = MachMsg(MsgParagraphs.CNC, nErrorNumber)
|
||||
If Not String.IsNullOrWhiteSpace(sTranslatedMsg) Then
|
||||
sErrorMessage = sTranslatedMsg
|
||||
End If
|
||||
End If
|
||||
ErrorLineMsg = "Number from the Cnc Block"
|
||||
AlarmMessage = If(nErrorNumber <> 0, ErrorNumberMsg & ": " & nErrorNumber & " - ", "") &
|
||||
If(nErrorExtNumber <> 0, " - " & ErrorExtNumberMsg & ": " & nErrorExtNumber, "") &
|
||||
" " & ErrorMessage
|
||||
" " & sErrorMessage
|
||||
Case NUM_ErrorTypes.Drive_Error
|
||||
ErrorIndexMsg = "Azionamento: Asse"
|
||||
ErrorNumberMsg = "Ext"
|
||||
@@ -680,12 +707,17 @@ Public Class MachCommandMessagePanelVM
|
||||
End If
|
||||
ErrorNumberMsg = "PLC"
|
||||
ErrorTypMsg = "Classe"
|
||||
AlarmMessage = If(nErrorIndex <> 0, ErrorIndexMsg & ": " & nErrorIndex & " - ", "") &
|
||||
If(nErrorNumber <> 0, ErrorNumberMsg & ": " & nErrorNumber & " - ", "") &
|
||||
If(nErrorExtNumber <> 0, " - " & ErrorExtNumberMsg & ": " & nErrorExtNumber, "") &
|
||||
ErrorTypMsg & ": " & nErrorTyp - 5 &
|
||||
If(nErrorLine <> 0, " - " & ErrorLineMsg & ": " & nErrorLine, "") &
|
||||
" " & sErrorMessage & If(nErrorAdditional <> 0, " - " & ErrorAdditionalMsg & ": " & nErrorAdditional, "")
|
||||
If CurrentMachine.NCType = NCTypes.NUM_AXIUM_PCTOOLKIT OrElse CurrentMachine.NCType = NCTypes.NUM_AXIUM_APSERVER Then
|
||||
AlarmMessage = If(nErrorNumber <> 0, ErrorNumberMsg & ": " & nErrorNumber & " - ", "") &
|
||||
sErrorMessage
|
||||
Else
|
||||
AlarmMessage = If(nErrorIndex <> 0, ErrorIndexMsg & ": " & nErrorIndex & " - ", "") &
|
||||
If(nErrorNumber <> 0, ErrorNumberMsg & ": " & nErrorNumber & " - ", "") &
|
||||
If(nErrorExtNumber <> 0, " - " & ErrorExtNumberMsg & ": " & nErrorExtNumber, "") &
|
||||
ErrorTypMsg & ": " & nErrorTyp - 5 &
|
||||
If(nErrorLine <> 0, " - " & ErrorLineMsg & ": " & nErrorLine, "") &
|
||||
" " & sErrorMessage & If(nErrorAdditional <> 0, " - " & ErrorAdditionalMsg & ": " & nErrorAdditional, "")
|
||||
End If
|
||||
Case NUM_ErrorTypes.HMI_Message
|
||||
Case NUM_ErrorTypes.RTS_Message
|
||||
Case NUM_ErrorTypes.Drive_Warning
|
||||
@@ -752,7 +784,7 @@ Public Class MachCommandMessagePanelVM
|
||||
Select Case CurrentMachine.NCType
|
||||
Case NCTypes.TPA
|
||||
m_ErrSystem.RemoveAll(Function(x) x.sCode = AlarmCode)
|
||||
Case NCTypes.NUM_FLEXIUM
|
||||
Case NCTypes.NUM_FLEXIUM, NCTypes.NUM_AXIUM_APSERVER, NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||
m_ErrSystem.RemoveAll(Function(x) x.sMessage = AlarmMessage)
|
||||
End Select
|
||||
End If
|
||||
@@ -765,7 +797,8 @@ Public Class MachCommandMessagePanelVM
|
||||
' fermo timer degli allarmi
|
||||
m_AlarmTimer.Stop()
|
||||
End If
|
||||
DbControllers.m_LogMachineController.Create(MachLog.CreateAlarmLog(AlarmOperation, ErrorTyp, AlarmMessage, AlarmCode, DateTime.Now))
|
||||
'DbControllers.m_LogMachineController.Create(MachLog.CreateAlarmLog(AlarmOperation, ErrorTyp, AlarmMessage, AlarmCode, DateTime.Now))
|
||||
DbControllers.m_LogMachineController.Create(LogEvent.CreateAlarmLog(DateTime.Now(), AlarmOperation & LogEvent.cSeparator & ErrorTyp & LogEvent.cSeparator & AlarmMessage & LogEvent.cSeparator & AlarmCode & LogEvent.cSeparator, DbControllers.m_SupervisorId))
|
||||
End Sub
|
||||
|
||||
Friend Sub AxisCoordinatesCallbackDlg(AxisValue As Double, AxisIndex As Integer)
|
||||
@@ -785,25 +818,31 @@ Public Class MachCommandMessagePanelVM
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
Case NCTypes.NUM_FLEXIUM
|
||||
Case NCTypes.NUM_FLEXIUM, NCTypes.NUM_AXIUM_APSERVER, NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||
Map.refLeftPanelVM.SetOPState(NewState)
|
||||
End Select
|
||||
DbControllers.m_LogMachineController.Create(MachLog.CreateOPStateLog(newOpState))
|
||||
'DbControllers.m_LogMachineController.Create(MachLog.CreateOPStateLog(newOpState))
|
||||
DbControllers.m_LogMachineController.Create(LogEvent.CreateMachineStateLog(newOpState, DbControllers.m_SupervisorId))
|
||||
End Sub
|
||||
|
||||
Friend Sub OpModeCallbackDlg(newOpState As Integer)
|
||||
Dim NewState As OPState = Map.refLeftPanelVM.OPModeList.FirstOrDefault(Function(x) x.Id = newOpState)
|
||||
If IsNothing(NewState) Then
|
||||
EgtOutLog("Machine state not recognized, state " & newOpState)
|
||||
Return
|
||||
End If
|
||||
Select Case CurrentMachine.NCType
|
||||
Case NCTypes.NUM_FLEXIUM
|
||||
Case NCTypes.NUM_FLEXIUM, NCTypes.NUM_AXIUM_APSERVER, NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||
Map.refLeftPanelVM.SetOPMode(NewState)
|
||||
End Select
|
||||
DbControllers.m_LogMachineController.Create(MachLog.CreateOPStateLog(newOpState))
|
||||
'DbControllers.m_LogMachineController.Create(MachLog.CreateOPStateLog(newOpState))
|
||||
DbControllers.m_LogMachineController.Create(LogEvent.CreateMachineModeLog(newOpState, DbControllers.m_SupervisorId))
|
||||
End Sub
|
||||
|
||||
Friend Sub ChannelCallbackDlg(NewChannelId As Short)
|
||||
Dim NewChannel As IdNameStruct = Map.refLeftPanelVM.ChannelList.FirstOrDefault(Function(x) x.Id = NewChannelId)
|
||||
Select Case CurrentMachine.NCType
|
||||
Case NCTypes.NUM_FLEXIUM
|
||||
Case NCTypes.NUM_FLEXIUM, NCTypes.NUM_AXIUM_APSERVER, NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||
Map.refLeftPanelVM.SetChannel(NewChannel)
|
||||
End Select
|
||||
'DbControllers.m_LogMachineController.Create(MachLog.CreateOPStateLog(NewChannelId))
|
||||
@@ -816,8 +855,9 @@ Public Class MachCommandMessagePanelVM
|
||||
Case "AsseX", "AsseY", "AsseZ", "AsseC", "AsseB"
|
||||
SetAxisValue(VarName, VarValue)
|
||||
End Select
|
||||
'DbControllers.m_LogMachineController.Create(MachLog.CreateReadLog(CommandExecutedCorrectly, VarAddress, VarValue))
|
||||
DbControllers.m_LogMachineController.Create(LogEvent.CreateReadVarLog(VarAddress, VarValue, DbControllers.SupervisorId))
|
||||
End If
|
||||
DbControllers.m_LogMachineController.Create(MachLog.CreateReadLog(CommandExecutedCorrectly, VarAddress, VarValue))
|
||||
End Sub
|
||||
|
||||
Private Sub SetAxisValue(VarName As String, VarValue As String)
|
||||
|
||||
@@ -32,7 +32,7 @@ Public Class MyMachGroupVM
|
||||
' se c'e', attivo solo il pezzo non finito
|
||||
Return Not (Not IsNothing(ToBeRestartedPart) AndAlso Not ToBeRestartedPart Is Me)
|
||||
Else
|
||||
If Global.EgtBEAMWALL.Supervisor.CurrentMachine.Flow = Global.EgtBEAMWALL.Supervisor.CurrentMachine.FlowTypes.ONEBYONE Then
|
||||
If CurrentMachine.Flow = CurrentMachine.FlowTypes.ONEBYONE Then
|
||||
Select Case nProduction_State
|
||||
Case ItemState.Assigned, ItemState.Confirmed, ItemState.WIP
|
||||
Return Not m_bToBeProduced AndAlso Not m_bSentToMachine AndAlso Not Map.refSupervisorMachGroupPanelVM.MachGroupVMList.Any(Function(x As MyMachGroupVM) x.bToBeProduced)
|
||||
@@ -132,7 +132,7 @@ Public Class MyMachGroupVM
|
||||
EgtGetInfo(Id, MGR_RPT_PART & 1, sInfo)
|
||||
If Not String.IsNullOrWhiteSpace(sInfo) Then
|
||||
sSplitInfo = sInfo.Split(","c)
|
||||
StringToDouble(sSplitInfo(1), MyMachGroupM.dStartCut)
|
||||
StringToDoubleAdv(sSplitInfo(1), MyMachGroupM.dStartCut)
|
||||
Else
|
||||
MyMachGroupM.dStartCut = 0
|
||||
End If
|
||||
@@ -168,6 +168,8 @@ Public Class MyMachGroupVM
|
||||
Public Overrides Sub ProduceMachGroup()
|
||||
' se gia' in produzione, non devo fare nulla
|
||||
If m_bToBeProduced Then Return
|
||||
' disabilito bottoni di comunicazione durante invio programma
|
||||
Map.refMachCommandMessagePanelVM.SetCommBtnIsEnabled(False)
|
||||
' macchina bloccata con reset PER TEST!!!!
|
||||
'SetResetWhileCutting(True)
|
||||
' se ripartenza
|
||||
@@ -181,6 +183,8 @@ Public Class MyMachGroupVM
|
||||
Dim WaitingWnd As New WaitingWndV(Application.Current.MainWindow, New WaitingWndVM)
|
||||
Dim WaitingResult As Boolean = WaitingWnd.ShowDialog()
|
||||
If Not WaitingResult Then
|
||||
' riabilito bottoni di comunicazione a fine invio programma
|
||||
Map.refMachCommandMessagePanelVM.SetCommBtnIsEnabled(True)
|
||||
Return
|
||||
End If
|
||||
' ricarico progetto corrente
|
||||
@@ -188,6 +192,10 @@ Public Class MyMachGroupVM
|
||||
End If
|
||||
' creo nuova barra
|
||||
Dim RedoMachGroupVM As MyMachGroupVM = RedoRawPart()
|
||||
If IsNothing(RedoMachGroupVM) Then
|
||||
MessageBox.Show("New RawPart creation failed!")
|
||||
Return
|
||||
End If
|
||||
' salvo progetto con nuova barra
|
||||
Map.refSceneHostVM.SaveProject()
|
||||
Dim MyMachGroupList As New List(Of MyMachGroupM)
|
||||
@@ -209,23 +217,34 @@ Public Class MyMachGroupVM
|
||||
End If
|
||||
' riabilito produzione di tutti gli altri
|
||||
MyMachGroupVM.UpdateProduceIsEnabledForAll()
|
||||
' riabilito bottoni di comunicazione a fine invio programma
|
||||
Map.refMachCommandMessagePanelVM.SetCommBtnIsEnabled(True)
|
||||
' reimposto visualizzazione gruppo selezionato
|
||||
Map.refSupervisorMachGroupPanelVM.SelectedMachGroup = Map.refSupervisorMachGroupPanelVM.SelectedMachGroup
|
||||
Return
|
||||
End If
|
||||
' se progetto travi e lavorazione interrotta da reset
|
||||
If Map.refSupervisorManagerVM.CurrProd.nType = BWType.BEAM AndAlso (bResetWhileCutting OrElse dtStartTime <> DateTime.MinValue) And Not Map.refLeftPanelVM.bRestart Then
|
||||
' chiedo se riprendere o rifare la barra da zero
|
||||
Dim bRedo As MessageBoxResult = MessageBox.Show("Riprendere lavorazione barra corrente?", "", MessageBoxButton.YesNo, MessageBoxImage.Information)
|
||||
Dim bRedo As MessageBoxResult = MessageBox.Show(EgtMsg(62509), "", MessageBoxButton.YesNo, MessageBoxImage.Information)
|
||||
Select Case bRedo
|
||||
Case MessageBoxResult.Yes
|
||||
' segno da rifare pezzi non completamente lavorati
|
||||
For Each Part As PartVM In PartVMList
|
||||
Part.bDO = (Part.dtEndTime = DateTime.MinValue)
|
||||
If Part.dtEndTime <> DateTime.MinValue Then
|
||||
Part.bDO = False
|
||||
Else
|
||||
Part.SetDo(True)
|
||||
End If
|
||||
'Part.bDO = (Part.dtEndTime = DateTime.MinValue)
|
||||
'Part.NotifyPropertyChanged(NameOf(Part.bRedo))
|
||||
Next
|
||||
' se ripresa, mostro lista feature e colonne Redo
|
||||
Map.refLeftPanelVM.bRestart = True
|
||||
' blocco produzione di tutti gli altri
|
||||
MyMachGroupVM.UpdateProduceIsEnabledForAll()
|
||||
' riabilito bottoni di comunicazione a fine invio programma
|
||||
Map.refMachCommandMessagePanelVM.SetCommBtnIsEnabled(True)
|
||||
Return
|
||||
Case MessageBoxResult.No
|
||||
' annullo stati dei pezzi gia' fatti
|
||||
@@ -281,6 +300,7 @@ Public Class MyMachGroupVM
|
||||
|
||||
' lancio produzione pezzo
|
||||
Produce(New List(Of MachGroupVM)({Me}))
|
||||
|
||||
End Sub
|
||||
|
||||
Friend Shared Sub Produce(MachGroupList As List(Of MachGroupVM))
|
||||
@@ -325,6 +345,8 @@ Public Class MyMachGroupVM
|
||||
|
||||
Public Function RedoRawPart() As MyMachGroupVM
|
||||
If IsNothing(Map.refSupervisorManagerVM.CurrProd) Then Return Nothing
|
||||
' variabile che contiene anticipo di pinzaggio primo pezzo
|
||||
Dim dHCING As Double = 0
|
||||
' creo nuovo gruppo di lavorazione
|
||||
Map.refProjectVM.ProdMachGroupPanelVM.AddMachGroup()
|
||||
Dim nCurrMachGroup As Integer = EgtGetCurrMachGroup()
|
||||
@@ -353,6 +375,12 @@ Public Class MyMachGroupVM
|
||||
For Index = 0 To m_PartVMList.Count - 1
|
||||
Dim CurrPart As PartVM = m_PartVMList(Index)
|
||||
If CurrPart.bDO Then
|
||||
' se primo pezzo da fare
|
||||
If nDone = 0 Then
|
||||
' recupero anticipo di pinzaggio da vecchia barra
|
||||
dHCING = GetHCING(CurrPart.nPartId)
|
||||
dInitialCutOut += CurrPart.dOffset - 0.1
|
||||
End If
|
||||
nDone += 1
|
||||
' creo copia del pezzo
|
||||
Dim nPartDuploId As Integer = EgtDuploNew(PartList(Index).nPartId)
|
||||
@@ -386,14 +414,15 @@ Public Class MyMachGroupVM
|
||||
End If
|
||||
Return Nothing
|
||||
End If
|
||||
' aggiorno anticipo di pinzaggio in primo pezzo
|
||||
EgtSetInfo(EgtGetFirstRawPart(), "HCING", dHCING)
|
||||
'aggiorno lista pezzi
|
||||
BeamMachGroup.MyMachGroupM.RefreshPartList()
|
||||
BeamMachGroup.MyMachGroupM.RefreshGroupData()
|
||||
''' aggiorno dati utilizzo barra
|
||||
''BeamMachGroup.UpdateUsage()
|
||||
Core.ViewPanelVM.BWSetView(VT.ISO_SW, False)
|
||||
' salvo nuovo grezzo nel progetto
|
||||
Map.refSupervisorManagerVM.Save()
|
||||
Dim LastDonePart As PartVM = Nothing
|
||||
' segno pezzi non completati come scrap
|
||||
For Index = 0 To m_PartVMList.Count - 1
|
||||
Dim CurrPart As PartVM = m_PartVMList(Index)
|
||||
@@ -410,15 +439,22 @@ Public Class MyMachGroupVM
|
||||
Part.NotifyPropertyChanged(NameOf(Part.nProduction_State))
|
||||
' resetto stato redo
|
||||
Part.bRedo = False
|
||||
' scrivo data end su Db barra
|
||||
DbControllers.m_MachGroupController.UpdateEnd(nP_Prod, nP_Machgroup, DateTime.MinValue)
|
||||
DbControllers.m_MachGroupController.UpdateStatus(nP_Prod, nP_Machgroup, ItemState.Produced)
|
||||
' scrivo stato end
|
||||
MyMachGroupM.SetProductionState(ItemState.Produced)
|
||||
dtEndTime = DateTime.MinValue
|
||||
NotifyPropertyChanged(NameOf(nProduction_State))
|
||||
Else
|
||||
LastDonePart = CurrPart
|
||||
End If
|
||||
Next
|
||||
' imposto fine MachGroup su fine ultimo pezzo o inizio Machgroup + 1 secondo
|
||||
Dim MachGroupEnd As DateTime = dtStartTime + New TimeSpan(0, 0, 1)
|
||||
If Not IsNothing(LastDonePart) AndAlso LastDonePart.dtEndTime <> DateTime.MinValue Then
|
||||
MachGroupEnd = LastDonePart.dtEndTime
|
||||
End If
|
||||
' scrivo data end su Db barra
|
||||
DbControllers.m_MachGroupController.UpdateEnd(Map.refSupervisorManagerVM.CurrProd.nProdId, Id, MachGroupEnd)
|
||||
DbControllers.m_MachGroupController.UpdateStatus(Map.refSupervisorManagerVM.CurrProd.nProdId, Id, ItemState.Produced)
|
||||
' scrivo stato end
|
||||
MyMachGroupM.SetProductionState(ItemState.Produced)
|
||||
dtEndTime = MachGroupEnd
|
||||
NotifyPropertyChanged(NameOf(nProduction_State))
|
||||
NotifyPropertyChanged(NameOf(Produce_IsEnabled))
|
||||
MachGroup = BeamMachGroup
|
||||
ElseIf Map.refSupervisorManagerVM.CurrProd.nType = BWType.WALL Then
|
||||
@@ -456,7 +492,7 @@ Public Class MyMachGroupVM
|
||||
'WallMachGroup.UpdateUsage()
|
||||
'EgtSetView(VT.TOP, False)
|
||||
End If
|
||||
' aggiorno dati ultilizzo grezzo
|
||||
' aggiorno dati utilizzo grezzo
|
||||
MachGroup.UpdateUsage()
|
||||
'passo machgroup a supervisor su Db
|
||||
DbControllers.m_MachGroupController.UpdateSupervisor(Map.refSupervisorManagerVM.CurrProd.nProdId, MachGroup.Id, DbControllers.m_SupervisorId)
|
||||
@@ -464,6 +500,18 @@ Public Class MyMachGroupVM
|
||||
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.Background))
|
||||
' assegno a nuova barra indice successivo a quella di partenza
|
||||
MachGroup.SetProductionIndex(m_nProductionIndex + 1)
|
||||
' assegno stati a pezzi
|
||||
For Each Part As PartVM In MachGroup.PartVMList
|
||||
DbControllers.m_PartController.UpdateStatus(Map.refSupervisorManagerVM.CurrProd.nProdId, MachGroup.Id, Part.nPartId, ItemState.Assigned)
|
||||
Part.nProduction_State = ItemState.Assigned
|
||||
Part.NotifyPropertyChanged(NameOf(Part.Background))
|
||||
'' disabilito impostazione modificato
|
||||
'Dim DisableMgr As New DisableModifiedMgr
|
||||
'' blocco modifica del pezzo
|
||||
'EgtDuploSetLocked(Part.nPartId)
|
||||
'' ripristino precedente impostazione modificato
|
||||
'DisableMgr.ReEnable()
|
||||
Next
|
||||
' aggiorno indice di tutte le barre in coda
|
||||
For Each CurrMachGroup As MyMachGroupVM In Map.refSupervisorMachGroupPanelVM.MachGroupVMList
|
||||
If Not (CurrMachGroup Is MachGroup) AndAlso CurrMachGroup.nProductionIndex >= MachGroup.nProductionIndex AndAlso CurrMachGroup.nProductionIndex < 5000 Then
|
||||
@@ -477,10 +525,28 @@ Public Class MyMachGroupVM
|
||||
If Not IsNothing(MachGroup) Then Map.refProjectVM.SupervisorMachGroupPanelVM.AddMachGroupToSupervisor(MachGroup)
|
||||
' lo posiziono subito dopo il gruppo di ripartenza
|
||||
Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Move(Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Count - 1, Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.IndexOf(Me) + 1)
|
||||
EgtResetCurrMachGroup()
|
||||
EgtZoom(ZM.ALL)
|
||||
Return MachGroup
|
||||
End Function
|
||||
|
||||
Private Function GetHCING(nOrigPartId As Integer) As Double
|
||||
' inizializzo nuovo contesto
|
||||
Dim nCurrCtx As Integer = EgtGetCurrentContext()
|
||||
Dim nTempCtx As Integer = EgtInitContext()
|
||||
' inizializzo gestore lavorazioni
|
||||
EgtInitMachMgr(Map.refMainWindowVM.MainWindowM.sMachinesRoot, Map.refMainWindowVM.MainWindowM.sToolMakersDir)
|
||||
Dim g = EgtOpenFile(Map.refSupervisorManagerVM.CurrProd.sProdDirPath & "\" & Name & ".bwe")
|
||||
Dim nFirstId As Integer = EgtGetFirstMachGroup()
|
||||
Dim f = EgtSetCurrMachGroup(nFirstId)
|
||||
Dim nOldRawId As Integer = EgtGetRawPartFromPart(nOrigPartId)
|
||||
Dim dHCING As Double = 0
|
||||
EgtGetInfo(nOldRawId, "HCING", dHCING)
|
||||
EgtSetCurrentContext(nCurrCtx)
|
||||
EgtDeleteContext(nTempCtx)
|
||||
Return dHCING
|
||||
End Function
|
||||
|
||||
#End Region ' ProduceMachGroup
|
||||
|
||||
#End Region ' COMMANDS
|
||||
|
||||
@@ -14,6 +14,12 @@ Public Class SupervisorMachGroupPanelVM
|
||||
|
||||
Private m_ReloadProj_Timer As New DispatcherTimer
|
||||
Private m_bReloadProj As Boolean = False
|
||||
Private m_bReloadingProj As Boolean = False
|
||||
Public ReadOnly Property bReloadingProj As Boolean
|
||||
Get
|
||||
Return m_bReloadingProj
|
||||
End Get
|
||||
End Property
|
||||
|
||||
' lock per aggiunta elemento a lista MachGroup
|
||||
Private m_Lock_AddMachGroup As New Object
|
||||
@@ -52,9 +58,11 @@ Public Class SupervisorMachGroupPanelVM
|
||||
If MachGroupVMList.Count = 0 Then
|
||||
ManageBTLParts.ShowAll()
|
||||
End If
|
||||
SyncLock (m_Lock_AddMachGroup)
|
||||
MachGroupVMList.Add(MachGroup)
|
||||
End SyncLock
|
||||
If Not MachGroupVMList.Contains(MachGroup) Then
|
||||
SyncLock (m_Lock_AddMachGroup)
|
||||
MachGroupVMList.Add(MachGroup)
|
||||
End SyncLock
|
||||
End If
|
||||
' notifico stato
|
||||
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.Produce_IsEnabled))
|
||||
End Sub
|
||||
@@ -65,10 +73,12 @@ Public Class SupervisorMachGroupPanelVM
|
||||
|
||||
Public Sub ReloadProject_Tick()
|
||||
If Not m_bReloadProj Then Return
|
||||
m_bReloadingProj = True
|
||||
m_bReloadProj = False
|
||||
Map.refSceneHostVM.MainController.ResetModified()
|
||||
Map.refSceneHostVM.MainController.OpenProject(Map.refSupervisorManagerVM.CurrProd.sProdPath, False)
|
||||
RefreshSupervisorMachGroups(Map.refMachinePanelVM.MachineList.ToList())
|
||||
m_bReloadingProj = False
|
||||
End Sub
|
||||
|
||||
#End Region ' CONSTRUCTOR
|
||||
|
||||
@@ -36,6 +36,16 @@ Public Class MachManaging
|
||||
Return m_CN
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property Num_Axium_APServer As NUMAxiumComm
|
||||
Get
|
||||
Return m_CN
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property Num_Axium_PCToolkit As NUMAxiumPcToolkitComm
|
||||
Get
|
||||
Return m_CN
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private Shared WithEvents m_CommandList As New ObservableCollection(Of ThreadCommand)
|
||||
Public Shared ReadOnly Property CommandList As ObservableCollection(Of ThreadCommand)
|
||||
@@ -212,7 +222,7 @@ Public Class MachManaging
|
||||
' Threading.Thread.Sleep(300)
|
||||
' End If
|
||||
' End If
|
||||
Case NCTypes.NUM_FLEXIUM, NCTypes.TPA
|
||||
Case NCTypes.NUM_FLEXIUM, NCTypes.TPA, NCTypes.NUM_AXIUM_APSERVER, NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||
' eseguo ciclo principale
|
||||
Dim nReset_State As Integer
|
||||
Dim nStart_State As Boolean
|
||||
@@ -272,6 +282,146 @@ Public Class MachManaging
|
||||
If nCurrMachIndex > 0 AndAlso nReset_State = 0 Then
|
||||
m_nMachIndex = nCurrMachIndex
|
||||
End If
|
||||
Case NCTypes.NUM_AXIUM_APSERVER
|
||||
Dim dTemp As Double = 0
|
||||
Dim nTemp As Integer = 0
|
||||
If Not IsNothing(ResetVariable.sValue) Then
|
||||
Integer.TryParse(ResetVariable.sValue, nReset_State)
|
||||
Else
|
||||
nReset_State = 1
|
||||
End If
|
||||
If Not IsNothing(StartVariable.sValue) Then
|
||||
Integer.TryParse(StartVariable.sValue, nTemp)
|
||||
nStart_State = (nTemp = 1)
|
||||
Else
|
||||
nStart_State = -1
|
||||
End If
|
||||
If Not IsNothing(StopVariable.sValue) Then
|
||||
Integer.TryParse(StopVariable.sValue, nTemp)
|
||||
nStop_State = (nTemp = 1)
|
||||
Else
|
||||
nStop_State = -1
|
||||
End If
|
||||
If Not IsNothing(ProdVariable.sValue) Then
|
||||
Integer.TryParse(ProdVariable.sValue, nP_Prod)
|
||||
Else
|
||||
nP_Prod = -1
|
||||
End If
|
||||
If Not IsNothing(MachGroupVariable.sValue) Then
|
||||
Integer.TryParse(MachGroupVariable.sValue, nP_Machgroup)
|
||||
Else
|
||||
nP_Machgroup = -1
|
||||
End If
|
||||
If Not IsNothing(PartVariable.sValue) Then
|
||||
Integer.TryParse(PartVariable.sValue, nP_Part)
|
||||
Else
|
||||
nP_Part = -1
|
||||
End If
|
||||
If Not IsNothing(StateVariable.sValue) Then
|
||||
Integer.TryParse(StateVariable.sValue, nP_State)
|
||||
Else
|
||||
nP_State = -1
|
||||
End If
|
||||
If Not IsNothing(ISONumVariable.sValue) Then
|
||||
Integer.TryParse(ISONumVariable.sValue, nISO_Num)
|
||||
Else
|
||||
nISO_Num = -1
|
||||
End If
|
||||
If Not IsNothing(ISOSentVariable.sValue) Then
|
||||
Integer.TryParse(ISOSentVariable.sValue, nISO_Sent)
|
||||
Else
|
||||
nISO_Sent = -1
|
||||
End If
|
||||
If Not IsNothing(RunningVariable.sValue) Then
|
||||
Integer.TryParse(RunningVariable.sValue, nRunning)
|
||||
Else
|
||||
nRunning = -1
|
||||
End If
|
||||
If Not IsNothing(MachIndexVariable.sValue) Then
|
||||
Integer.TryParse(MachIndexVariable.sValue, nCurrMachIndex)
|
||||
Else
|
||||
nCurrMachIndex = -1
|
||||
End If
|
||||
' se indice lavorazione positivo, lo aggiorno
|
||||
If nCurrMachIndex > 0 AndAlso nReset_State = 0 Then
|
||||
m_nMachIndex = nCurrMachIndex
|
||||
End If
|
||||
' leggo messaggi plc
|
||||
ReadPLCMessages()
|
||||
Case NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||
' leggo tutte le variabili
|
||||
Num_Axium_PCToolkit.RefreshAllVars()
|
||||
'EgtOutLog("Post lettura variabili")
|
||||
Dim dTemp As Double = 0
|
||||
Dim nTemp As Integer = 0
|
||||
If Not IsNothing(ResetVariable.sValue) Then
|
||||
Integer.TryParse(ResetVariable.sValue, nReset_State)
|
||||
Else
|
||||
nReset_State = 1
|
||||
End If
|
||||
If Not IsNothing(StartVariable.sValue) Then
|
||||
Integer.TryParse(StartVariable.sValue, nTemp)
|
||||
nStart_State = (nTemp = 1)
|
||||
Else
|
||||
nStart_State = -1
|
||||
End If
|
||||
If Not IsNothing(StopVariable.sValue) Then
|
||||
Integer.TryParse(StopVariable.sValue, nTemp)
|
||||
nStop_State = (nTemp = 1)
|
||||
Else
|
||||
nStop_State = -1
|
||||
End If
|
||||
If Not IsNothing(ProdVariable.sValue) Then
|
||||
Integer.TryParse(ProdVariable.sValue, nP_Prod)
|
||||
Else
|
||||
nP_Prod = -1
|
||||
End If
|
||||
If Not IsNothing(MachGroupVariable.sValue) Then
|
||||
Integer.TryParse(MachGroupVariable.sValue, nP_Machgroup)
|
||||
Else
|
||||
nP_Machgroup = -1
|
||||
End If
|
||||
If Not IsNothing(PartVariable.sValue) Then
|
||||
Integer.TryParse(PartVariable.sValue, nP_Part)
|
||||
Else
|
||||
nP_Part = -1
|
||||
End If
|
||||
If Not IsNothing(StateVariable.sValue) Then
|
||||
Integer.TryParse(StateVariable.sValue, nP_State)
|
||||
Else
|
||||
nP_State = -1
|
||||
End If
|
||||
If Not IsNothing(ISONumVariable.sValue) Then
|
||||
Integer.TryParse(ISONumVariable.sValue, nISO_Num)
|
||||
Else
|
||||
nISO_Num = -1
|
||||
End If
|
||||
If Not IsNothing(ISOSentVariable.sValue) Then
|
||||
Integer.TryParse(ISOSentVariable.sValue, nISO_Sent)
|
||||
Else
|
||||
nISO_Sent = -1
|
||||
End If
|
||||
If Not IsNothing(RunningVariable.sValue) Then
|
||||
Integer.TryParse(RunningVariable.sValue, nRunning)
|
||||
Else
|
||||
nRunning = -1
|
||||
End If
|
||||
If Not IsNothing(MachIndexVariable.sValue) Then
|
||||
Integer.TryParse(MachIndexVariable.sValue, nCurrMachIndex)
|
||||
Else
|
||||
nCurrMachIndex = -1
|
||||
End If
|
||||
'EgtOutLog("Post scrittura variabili lette")
|
||||
' se indice lavorazione positivo, lo aggiorno
|
||||
If nCurrMachIndex > 0 AndAlso nReset_State = 0 Then
|
||||
m_nMachIndex = nCurrMachIndex
|
||||
End If
|
||||
' leggo messaggi plc
|
||||
ReadPLCMessages()
|
||||
Num_Axium_PCToolkit.ReadCncMode()
|
||||
'EgtOutLog("Pre lettura posizioni")
|
||||
Num_Axium_PCToolkit.ReadPosition()
|
||||
'EgtOutLog("Post lettura messaggi")
|
||||
End Select
|
||||
' se NUM aggiorno stato della macchina
|
||||
If CurrentMachine.NCType = NCTypes.NUM_FLEXIUM Then
|
||||
@@ -286,14 +436,34 @@ Public Class MachManaging
|
||||
If OpState <> Map.refLeftPanelVM.SelOPState.Id Then
|
||||
m_OpStateCallbackDlg(OpState)
|
||||
End If
|
||||
ElseIf CurrentMachine.NCType = NCTypes.NUM_AXIUM_APSERVER OrElse CurrentMachine.NCType = NCTypes.NUM_AXIUM_PCTOOLKIT Then
|
||||
Dim OpState As OPStates
|
||||
If nReset_State = 1 Then
|
||||
OpState = OPStates.End
|
||||
ElseIf nStop_State Then
|
||||
OpState = OPStates.Stop
|
||||
ElseIf nStart_State Then
|
||||
OpState = OPStates.Start
|
||||
Else
|
||||
OpState = OPStates.End
|
||||
End If
|
||||
If IsNothing(Map.refLeftPanelVM.SelOPState) OrElse OpState <> Map.refLeftPanelVM.SelOPState.Id Then
|
||||
m_OpStateCallbackDlg(OpState)
|
||||
End If
|
||||
End If
|
||||
' se TPA e non ancora fatto, preparo variabili barra successiva
|
||||
If CurrentMachine.NCType = NCTypes.TPA AndAlso CurrentMachine.Flow = FlowTypes.CONTINUOUS AndAlso m_NextBarId = 0 Then
|
||||
SetNextBarVars()
|
||||
' se macchina NUM, non sto gia' spedendo e variabile spedizione me lo permette
|
||||
ElseIf CurrentMachine.NCType = NCTypes.NUM_FLEXIUM AndAlso
|
||||
ElseIf (CurrentMachine.NCType = NCTypes.NUM_FLEXIUM AndAlso
|
||||
Not Num_Flexium.bIsTransferActive AndAlso
|
||||
nISO_Sent = 1 Then
|
||||
nISO_Sent = 1) OrElse
|
||||
(CurrentMachine.NCType = NCTypes.NUM_AXIUM_APSERVER AndAlso
|
||||
Not Num_Axium_APServer.bIsTransferActive AndAlso
|
||||
nISO_Sent = 1) OrElse
|
||||
(CurrentMachine.NCType = NCTypes.NUM_AXIUM_PCTOOLKIT AndAlso
|
||||
Not Num_Axium_PCToolkit.bIsTransferActive AndAlso
|
||||
nISO_Sent = 1) Then
|
||||
' verifico se c'e' un programma da lanciare
|
||||
SendNextProgram()
|
||||
End If
|
||||
@@ -348,31 +518,41 @@ Public Class MachManaging
|
||||
Dim MachGroup As MyMachGroupVM = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.FirstOrDefault(Function(x) x.Id = nP_Machgroup)
|
||||
' se pezzo = -1 devo dare start a tutti i pezzi del MachGroup
|
||||
If nP_Part = -1 Then
|
||||
For Each Part In MachGroup.PartVMList
|
||||
' scrivo data start su Db pezzo
|
||||
DbControllers.m_PartController.UpdateStart(nP_Prod, nP_Machgroup, Part.nPartId, dtStart)
|
||||
DbControllers.m_PartController.UpdateStatus(nP_Prod, nP_Machgroup, Part.nPartId, ItemState.WIP)
|
||||
' scrivo stato start
|
||||
Part.nProduction_State = ItemState.WIP
|
||||
Part.dtStartTime = dtStart
|
||||
Part.NotifyPropertyChanged(NameOf(Part.nProduction_State))
|
||||
Next
|
||||
If Not IsNothing(MachGroup) Then
|
||||
For Each Part In MachGroup.PartVMList
|
||||
' scrivo data start su Db pezzo
|
||||
DbControllers.m_PartController.UpdateStart(nP_Prod, nP_Machgroup, Part.nPartId, dtStart)
|
||||
DbControllers.m_PartController.UpdateStatus(nP_Prod, nP_Machgroup, Part.nPartId, ItemState.WIP)
|
||||
' scrivo stato start
|
||||
Part.nProduction_State = ItemState.WIP
|
||||
Part.dtStartTime = dtStart
|
||||
Part.NotifyPropertyChanged(NameOf(Part.nProduction_State))
|
||||
' scrivo evento inizio pezzo su DB
|
||||
DbControllers.m_LogMachineController.Create(LogEvent.CreatePartStateLog(dtStart, nP_Prod, nP_Machgroup, Part.nPartId, nP_State, DbControllers.SupervisorId))
|
||||
Next
|
||||
End If
|
||||
Else
|
||||
' scrivo data start su Db pezzo
|
||||
DbControllers.m_PartController.UpdateStart(nP_Prod, nP_Machgroup, nP_Part, dtStart)
|
||||
DbControllers.m_PartController.UpdateStatus(nP_Prod, nP_Machgroup, nP_Part, ItemState.WIP)
|
||||
' recupero pezzo
|
||||
Dim Part As PartVM = MachGroup.PartVMList.FirstOrDefault(Function(x) x.nPartId = nP_Part)
|
||||
' scrivo stato start
|
||||
Part.nProduction_State = ItemState.WIP
|
||||
Part.dtStartTime = dtStart
|
||||
Part.NotifyPropertyChanged(NameOf(Part.nProduction_State))
|
||||
If Not IsNothing(MachGroup) Then
|
||||
' recupero pezzo
|
||||
Dim Part As PartVM = MachGroup.PartVMList.FirstOrDefault(Function(x) x.nPartId = nP_Part)
|
||||
If Not IsNothing(Part) Then
|
||||
' scrivo stato start
|
||||
Part.nProduction_State = ItemState.WIP
|
||||
Part.dtStartTime = dtStart
|
||||
Part.NotifyPropertyChanged(NameOf(Part.nProduction_State))
|
||||
End If
|
||||
End If
|
||||
' scrivo evento inizio pezzo su DB
|
||||
DbControllers.m_LogMachineController.Create(LogEvent.CreatePartStateLog(dtStart, nP_Prod, nP_Machgroup, nP_Part, nP_State, DbControllers.SupervisorId))
|
||||
End If
|
||||
' azzero variabile per far ripartire macchina
|
||||
Select Case CurrentMachine.NCType
|
||||
Case NCTypes.TPA
|
||||
Tpa.RWVariableManager.WriteVarByName(P_STATE, 0)
|
||||
Case NCTypes.NUM_FLEXIUM
|
||||
Case NCTypes.NUM_FLEXIUM, NCTypes.NUM_AXIUM_APSERVER, NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||
StateVariable.sValue = "0"
|
||||
End Select
|
||||
' se nessun pezzo della barra diverso da quello corrente e' in start
|
||||
@@ -381,10 +561,16 @@ Public Class MachManaging
|
||||
DbControllers.m_MachGroupController.UpdateStart(nP_Prod, nP_Machgroup, dtStart)
|
||||
DbControllers.m_MachGroupController.UpdateStatus(nP_Prod, nP_Machgroup, ItemState.WIP)
|
||||
' scrivo stato start
|
||||
MachGroup.MyMachGroupM.SetProductionState(ItemState.WIP)
|
||||
MachGroup.dtStartTime = dtStart
|
||||
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.nProduction_State))
|
||||
If Not IsNothing(MachGroup) Then
|
||||
MachGroup.MyMachGroupM.SetProductionState(ItemState.WIP)
|
||||
MachGroup.dtStartTime = dtStart
|
||||
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.nProduction_State))
|
||||
End If
|
||||
' scrivo evento inizio MachGroup su DB
|
||||
DbControllers.m_LogMachineController.Create(LogEvent.CreateMachGroupStateLog(dtStart, nP_Prod, nP_Machgroup, nP_State, DbControllers.SupervisorId))
|
||||
End If
|
||||
' flag di aggiornamento log macchina
|
||||
Map.refMachineLogPageVM.UpdateMachineLogList(False)
|
||||
' attesa per essere sicuro che abbia scritto e riletto variabili
|
||||
Threading.Thread.Sleep(300)
|
||||
ElseIf nP_State = PartState.END_ Then
|
||||
@@ -393,41 +579,50 @@ Public Class MachManaging
|
||||
Dim MachGroup As MyMachGroupVM = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.FirstOrDefault(Function(x) x.Id = nP_Machgroup)
|
||||
' se pezzo = -1 devo dare end a tutti i pezzi del MachGroup
|
||||
If nP_Part = -1 Then
|
||||
For Each Part In MachGroup.PartVMList
|
||||
' scrivo data end su Db pezzo
|
||||
DbControllers.m_PartController.UpdateEnd(nP_Prod, nP_Machgroup, Part.nPartId, dtEnd)
|
||||
DbControllers.m_PartController.UpdateStatus(nP_Prod, nP_Machgroup, Part.nPartId, ItemState.Produced)
|
||||
' scrivo stato end
|
||||
Part.nProduction_State = ItemState.Produced
|
||||
Part.dtEndTime = dtEnd
|
||||
Part.NotifyPropertyChanged(NameOf(Part.nProduction_State))
|
||||
' resetto stato redo
|
||||
Part.bRedo = False
|
||||
' se non impostata data start
|
||||
If Part.dtStartTime = DateTime.MinValue Then
|
||||
' scrivo data start su Db pezzo
|
||||
Dim dtStart As DateTime = Part.dtEndTime - TimeSpan.FromSeconds(60)
|
||||
DbControllers.m_PartController.UpdateStart(nP_Prod, nP_Machgroup, Part.nPartId, dtStart)
|
||||
Part.dtStartTime = dtStart
|
||||
End If
|
||||
|
||||
Next
|
||||
If Not IsNothing(MachGroup) Then
|
||||
For Each Part In MachGroup.PartVMList
|
||||
' scrivo data end su Db pezzo
|
||||
DbControllers.m_PartController.UpdateEnd(nP_Prod, nP_Machgroup, Part.nPartId, dtEnd)
|
||||
DbControllers.m_PartController.UpdateStatus(nP_Prod, nP_Machgroup, Part.nPartId, ItemState.Produced)
|
||||
' scrivo stato end
|
||||
Part.nProduction_State = ItemState.Produced
|
||||
Part.dtEndTime = dtEnd
|
||||
Part.NotifyPropertyChanged(NameOf(Part.nProduction_State))
|
||||
' resetto stato redo
|
||||
Part.bRedo = False
|
||||
' se non impostata data start
|
||||
If Part.dtStartTime = DateTime.MinValue Then
|
||||
' scrivo data start su Db pezzo
|
||||
Dim dtStart As DateTime = Part.dtEndTime - TimeSpan.FromSeconds(60)
|
||||
DbControllers.m_PartController.UpdateStart(nP_Prod, nP_Machgroup, Part.nPartId, dtStart)
|
||||
Part.dtStartTime = dtStart
|
||||
End If
|
||||
' scrivo evento fine pezzo su DB
|
||||
DbControllers.m_LogMachineController.Create(LogEvent.CreatePartStateLog(dtEnd, nP_Prod, nP_Machgroup, Part.nPartId, nP_State, DbControllers.SupervisorId))
|
||||
Next
|
||||
End If
|
||||
Else
|
||||
' scrivo data end su Db pezzo
|
||||
DbControllers.m_PartController.UpdateEnd(nP_Prod, nP_Machgroup, nP_Part, dtEnd)
|
||||
DbControllers.m_PartController.UpdateStatus(nP_Prod, nP_Machgroup, nP_Part, ItemState.Produced)
|
||||
' recupero pezzo
|
||||
Dim Part As PartVM = MachGroup.PartVMList.FirstOrDefault(Function(x) x.nPartId = nP_Part)
|
||||
' scrivo stato end
|
||||
Part.nProduction_State = ItemState.Produced
|
||||
Part.dtEndTime = dtEnd
|
||||
Part.NotifyPropertyChanged(NameOf(Part.nProduction_State))
|
||||
' resetto stato redo
|
||||
Part.bRedo = False
|
||||
If Not IsNothing(MachGroup) Then
|
||||
' recupero pezzo
|
||||
Dim Part As PartVM = MachGroup.PartVMList.FirstOrDefault(Function(x) x.nPartId = nP_Part)
|
||||
If Not IsNothing(Part) Then
|
||||
' scrivo stato end
|
||||
Part.nProduction_State = ItemState.Produced
|
||||
Part.dtEndTime = dtEnd
|
||||
Part.NotifyPropertyChanged(NameOf(Part.nProduction_State))
|
||||
' resetto stato redo
|
||||
Part.bRedo = False
|
||||
End If
|
||||
End If
|
||||
' scrivo evento fine pezzo su DB
|
||||
DbControllers.m_LogMachineController.Create(LogEvent.CreatePartStateLog(dtEnd, nP_Prod, nP_Machgroup, nP_Part, nP_State, DbControllers.SupervisorId))
|
||||
End If
|
||||
|
||||
' se tutti i pezzi della barra sono in end
|
||||
If MachGroup.PartVMList.All(Function(x) x.nProduction_State >= 2) Then
|
||||
If Not IsNothing(MachGroup) AndAlso MachGroup.PartVMList.All(Function(x) x.nProduction_State >= 2) Then
|
||||
' scrivo data end su Db barra
|
||||
DbControllers.m_MachGroupController.UpdateEnd(nP_Prod, nP_Machgroup, dtEnd)
|
||||
DbControllers.m_MachGroupController.UpdateStatus(nP_Prod, nP_Machgroup, ItemState.Produced)
|
||||
@@ -435,6 +630,8 @@ Public Class MachManaging
|
||||
MachGroup.MyMachGroupM.SetProductionState(ItemState.Produced)
|
||||
MachGroup.dtEndTime = dtEnd
|
||||
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.nProduction_State))
|
||||
' scrivo evento fine MachGroup su DB
|
||||
DbControllers.m_LogMachineController.Create(LogEvent.CreateMachGroupStateLog(dtEnd, nP_Prod, nP_Machgroup, nP_State, DbControllers.SupervisorId))
|
||||
' azzero tutte le variabilli per iniziare barra successiva
|
||||
ProdVariable.sValue = "0"
|
||||
MachGroupVariable.sValue = "0"
|
||||
@@ -471,14 +668,20 @@ Public Class MachManaging
|
||||
End If
|
||||
' se pezzo = -1 stampo etichette di tutti i pezzi del MachGroup
|
||||
If nP_Part = -1 Then
|
||||
For Each Part In MachGroup.PartVMList
|
||||
Map.refLeftPanelVM.PrintLabel(MachGroup, Part)
|
||||
Next
|
||||
If Not IsNothing(MachGroup) Then
|
||||
For Each Part In MachGroup.PartVMList
|
||||
Map.refLeftPanelVM.PrintLabel(MachGroup, Part)
|
||||
Next
|
||||
End If
|
||||
Else
|
||||
' recupero pezzo
|
||||
Dim Part As PartVM = MachGroup.PartVMList.FirstOrDefault(Function(x) x.nPartId = nP_Part)
|
||||
Map.refLeftPanelVM.PrintLabel(MachGroup, Part)
|
||||
If Not IsNothing(Part) Then
|
||||
Map.refLeftPanelVM.PrintLabel(MachGroup, Part)
|
||||
End If
|
||||
End If
|
||||
' flag di aggiornamento log macchina
|
||||
Map.refMachineLogPageVM.UpdateMachineLogList(False)
|
||||
' attesa per essere sicuro che abbia scritto e riletto variabili
|
||||
Threading.Thread.Sleep(300)
|
||||
End If
|
||||
@@ -503,11 +706,13 @@ Public Class MachManaging
|
||||
For VParIndex = 1 To sVs.Length - 1
|
||||
Dim VPar() As String = sVs(VParIndex).Split("="c)
|
||||
VPar(1) = VPar(1).Trim
|
||||
StringToDouble(VPar(1), dVPars(VParIndex))
|
||||
StringToDoubleAdv(VPar(1), dVPars(VParIndex - 1))
|
||||
Next
|
||||
' li scrivo nel CN
|
||||
For Index As Integer = 1 To 10
|
||||
Tpa.RWVariableManager.WriteVarByName(VPAR & Index.ToString(), dVPars(Index))
|
||||
Dim sValue As String = ""
|
||||
sValue = DoubleToString(dVPars(Index - 1), 2)
|
||||
Tpa.RWVariableManager.WriteVarByName(VPAR & Index.ToString(), sValue)
|
||||
Next
|
||||
m_NextBarId = MyMachGroup.Id
|
||||
Return True
|
||||
@@ -521,36 +726,47 @@ Public Class MachManaging
|
||||
End Function
|
||||
|
||||
Private Function SendNextProgram() As Boolean
|
||||
EgtOutLog("Inizio SendNextProgram")
|
||||
Dim bSent As Boolean = False
|
||||
If (CurrentMachine.NCType = NCTypes.TPA AndAlso Not m_bStartPending AndAlso Tpa.opState = MachineOperatingState.Pending) OrElse
|
||||
(CurrentMachine.NCType = NCTypes.NUM_FLEXIUM AndAlso Not Num_Flexium.bIsTransferActive) Then ' Or Tpa.opState = MachineOperatingState.Start) Then
|
||||
(CurrentMachine.NCType = NCTypes.NUM_FLEXIUM AndAlso Not Num_Flexium.bIsTransferActive) OrElse
|
||||
(CurrentMachine.NCType = NCTypes.NUM_AXIUM_APSERVER AndAlso Not Num_Axium_APServer.bIsTransferActive) OrElse
|
||||
(CurrentMachine.NCType = NCTypes.NUM_AXIUM_PCTOOLKIT AndAlso Not Num_Axium_PCToolkit.bIsTransferActive) Then ' Or Tpa.opState = MachineOperatingState.Start) Then
|
||||
' verifico se c'e' un programma da lanciare
|
||||
If Not IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM) Then
|
||||
EgtOutLog("Start " & DateTime.Now())
|
||||
Dim bMachGroupNotReady As Boolean = False
|
||||
SyncLock m_Lock_SendProgram
|
||||
For Each MyMachGroup As MyMachGroupVM In Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList
|
||||
EgtOutLog("Ciclo su name: " & MyMachGroup.Name & " id: " & MyMachGroup.Id)
|
||||
If Not MyMachGroup.bSentToMachine AndAlso (MyMachGroup.dtStartTime = DateTime.MinValue OrElse
|
||||
(Map.refSupervisorManagerVM.CurrProd.nType = BWType.WALL AndAlso MyMachGroup.bResetWhileCutting)) Then
|
||||
EgtOutLog(MyMachGroup.Name & " id: " & MyMachGroup.Id & " è da fare")
|
||||
' verifico se ricalcolo finito
|
||||
If MyMachGroup.bReadyForMachining AndAlso If(CurrentMachine.NCType = NCTypes.NUM_FLEXIUM, Not MyMachGroup.bSendingToMachine, True) Then
|
||||
If MyMachGroup.bReadyForMachining AndAlso If(CurrentMachine.NCType = NCTypes.NUM_FLEXIUM Or CurrentMachine.NCType = NCTypes.NUM_AXIUM_APSERVER OrElse CurrentMachine.NCType = NCTypes.NUM_AXIUM_PCTOOLKIT, Not MyMachGroup.bSendingToMachine, True) Then
|
||||
EgtOutLog(MyMachGroup.Name & " id: " & MyMachGroup.Id & " pronto per essere lavorato")
|
||||
' lo lancio
|
||||
bSent = SendProgram(MyMachGroup.CnFilePath(), MyMachGroup.Name)
|
||||
EgtOutLog("Mandato " & DateTime.Now() & " " & MyMachGroup.Name & " " & bSent.ToString())
|
||||
EgtOutLog(MyMachGroup.Name & " id: " & MyMachGroup.Id & " mandato " & DateTime.Now() & " " & MyMachGroup.Name & " " & bSent.ToString())
|
||||
Select Case CurrentMachine.NCType
|
||||
Case NCTypes.TPA
|
||||
MyMachGroup.SetSentToMachine(bSent)
|
||||
Case NCTypes.NUM_FLEXIUM
|
||||
Case NCTypes.NUM_FLEXIUM, NCTypes.NUM_AXIUM_APSERVER, NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||
MyMachGroup.SetSendingToMachine(bSent)
|
||||
End Select
|
||||
m_NextBarId = 0
|
||||
Exit For
|
||||
Else
|
||||
' programma non ancora pronto, esco per attendere
|
||||
Return False
|
||||
bMachGroupNotReady = True
|
||||
EgtOutLog(MyMachGroup.Name & " id: " & MyMachGroup.Id & " non ancora pronto per essere mandato")
|
||||
Exit For
|
||||
'Return False
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
End SyncLock
|
||||
If bMachGroupNotReady Then Return False
|
||||
EgtOutLog("End " & DateTime.Now())
|
||||
End If
|
||||
End If
|
||||
@@ -591,6 +807,7 @@ Public Class MachManaging
|
||||
Case CommandTypes.READ_TPA
|
||||
Tpa.RWVariableManager.RefreshVar(Command.sVariable)
|
||||
Case CommandTypes.WRITE
|
||||
'EgtOutLog("Write" & Command.sVariable & " " & Command.sVariables(1) & " " & Command.nVariable)
|
||||
WriteVar(Command.sVariable, Command.sVariables(1), Command.nVariable)
|
||||
Case CommandTypes.DELETEALARMS
|
||||
DeleteAlarms()
|
||||
@@ -603,9 +820,9 @@ Public Class MachManaging
|
||||
Num_Flexium.CloseReadList()
|
||||
Num_Flexium.CloseReadELS()
|
||||
Case CommandTypes.MDI
|
||||
Num_Flexium.MDI_Execute(Command.sVariable)
|
||||
SendMDI(Command.sVariable)
|
||||
Case CommandTypes.SETCHANNEL
|
||||
Num_Flexium.SetChannel(Command.nVariable)
|
||||
SetChannel(Command.nVariable)
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
@@ -634,6 +851,31 @@ Public Class MachManaging
|
||||
m_ResultCallbackDlg(CommandTypes.CONNECT, CommandStates.ERROR_, ResultTypes.EXECUTED, "Errore: impossibile connettersi!")
|
||||
Return
|
||||
End Try
|
||||
Case NCTypes.NUM_AXIUM_APSERVER
|
||||
Try
|
||||
m_CN = New NUMAxiumComm(Me)
|
||||
Num_Axium_APServer.InitFxObjects()
|
||||
m_ResultCallbackDlg(CommandTypes.CONNECT, CommandStates.OK, ResultTypes.EXECUTED, "")
|
||||
' creo classe di gestione variabili
|
||||
Catch ex As Exception
|
||||
m_ResultCallbackDlg(CommandTypes.CONNECT, CommandStates.ERROR_, ResultTypes.EXECUTED, "Errore: impossibile connettersi!")
|
||||
Return
|
||||
End Try
|
||||
Case NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||
Try
|
||||
m_CN = New NUMAxiumPcToolkitComm(Me)
|
||||
If Num_Axium_PCToolkit.InitConnection() Then
|
||||
Num_Axium_PCToolkit.GetGeneralFunctions()
|
||||
m_ResultCallbackDlg(CommandTypes.CONNECT, CommandStates.OK, ResultTypes.EXECUTED, "")
|
||||
Else
|
||||
m_ResultCallbackDlg(CommandTypes.CONNECT, CommandStates.ERROR_, ResultTypes.EXECUTED, "Errore: impossibile connettersi!")
|
||||
Return
|
||||
End If
|
||||
' creo classe di gestione variabili
|
||||
Catch ex As Exception
|
||||
m_ResultCallbackDlg(CommandTypes.CONNECT, CommandStates.ERROR_, ResultTypes.EXECUTED, "Errore: impossibile connettersi!")
|
||||
Return
|
||||
End Try
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
@@ -652,6 +894,20 @@ Public Class MachManaging
|
||||
' chiudo classe Num_Flexium
|
||||
Me.OnDispose()
|
||||
'Num_Flexium.OnDispose()
|
||||
Case NCTypes.NUM_AXIUM_APSERVER
|
||||
m_bConnected = False
|
||||
Num_Axium_APServer.CloseFxObjects()
|
||||
m_ResultCallbackDlg(CommandTypes.DISCONNECT, CommandStates.OK, ResultTypes.EXECUTED, "")
|
||||
' chiudo classe Num_Flexium
|
||||
Me.OnDispose()
|
||||
'Num_Flexium.OnDispose()
|
||||
Case NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||
m_bConnected = False
|
||||
Num_Axium_PCToolkit.CloseFxObjects()
|
||||
m_ResultCallbackDlg(CommandTypes.DISCONNECT, CommandStates.OK, ResultTypes.EXECUTED, "")
|
||||
' chiudo classe Num_Flexium
|
||||
Me.OnDispose()
|
||||
'Num_Flexium.OnDispose()
|
||||
End Select
|
||||
' termino thread di comunicazione
|
||||
MachineCommThread.StopThread()
|
||||
@@ -661,6 +917,10 @@ Public Class MachManaging
|
||||
Select Case CurrentMachine.NCType
|
||||
Case NCTypes.NUM_FLEXIUM
|
||||
Num_Flexium.SetMode(CNMode)
|
||||
Case NCTypes.NUM_AXIUM_APSERVER
|
||||
Num_Axium_APServer.SetMode(CNMode)
|
||||
Case NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||
Num_Axium_PCToolkit.SetMode(CNMode)
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
@@ -700,6 +960,10 @@ Public Class MachManaging
|
||||
m_ResultCallbackDlg(CommandTypes.START, If(bOk, CommandStates.OK, CommandStates.ERROR_), ResultTypes.EXECUTED, "")
|
||||
Case NCTypes.NUM_FLEXIUM
|
||||
Num_Flexium.Start()
|
||||
Case NCTypes.NUM_AXIUM_APSERVER
|
||||
Num_Axium_APServer.Start()
|
||||
Case NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||
Num_Axium_PCToolkit.Start()
|
||||
End Select
|
||||
' aggiorno stato bottoni in LeftPanel
|
||||
Map.refLeftPanelVM.UpdateButtonIsEnabledState()
|
||||
@@ -712,6 +976,10 @@ Public Class MachManaging
|
||||
m_ResultCallbackDlg(CommandTypes.STOP_, If(bOk, CommandStates.OK, CommandStates.ERROR_), ResultTypes.EXECUTED, "")
|
||||
Case NCTypes.NUM_FLEXIUM
|
||||
Num_Flexium.Stop_()
|
||||
Case NCTypes.NUM_AXIUM_APSERVER
|
||||
Num_Axium_APServer.Stop_()
|
||||
Case NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||
Num_Axium_PCToolkit.Stop_()
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
@@ -722,6 +990,10 @@ Public Class MachManaging
|
||||
m_ResultCallbackDlg(CommandTypes.RESET, If(bOk, CommandStates.OK, CommandStates.ERROR_), ResultTypes.EXECUTED, "")
|
||||
Case NCTypes.NUM_FLEXIUM
|
||||
Num_Flexium.Reset()
|
||||
Case NCTypes.NUM_AXIUM_APSERVER
|
||||
Num_Axium_APServer.Reset()
|
||||
Case NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||
Num_Axium_PCToolkit.Reset()
|
||||
End Select
|
||||
' aggiorno stato bottoni in LeftPanel
|
||||
Map.refLeftPanelVM.UpdateButtonIsEnabledState()
|
||||
@@ -744,6 +1016,10 @@ Public Class MachManaging
|
||||
m_ResultCallbackDlg(CommandTypes.SETPOINT, If(bOk, CommandStates.OK, CommandStates.ERROR_), ResultTypes.EXECUTED, "")
|
||||
Case NCTypes.NUM_FLEXIUM
|
||||
Map.refLeftPanelVM.SelOPMode = Map.refLeftPanelVM.OPModeList.Find(Function(x) x.Id = OPModes.Home)
|
||||
Case NCTypes.NUM_AXIUM_APSERVER
|
||||
Map.refLeftPanelVM.SelOPMode = Map.refLeftPanelVM.OPModeList.Find(Function(x) x.Id = OPModes.Home)
|
||||
Case NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||
Map.refLeftPanelVM.SelOPMode = Map.refLeftPanelVM.OPModeList.Find(Function(x) x.Id = OPModes.Home)
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
@@ -766,7 +1042,20 @@ Public Class MachManaging
|
||||
Num_Flexium.FileDownload(sFileType, ProgramPath)
|
||||
Num_Flexium.StartTransfer()
|
||||
Return True
|
||||
Case NCTypes.NUM_AXIUM_APSERVER
|
||||
Dim sFileType As String = "%" & ProgramId.ToString()
|
||||
Num_Axium_APServer.FileDownload(sFileType, ProgramPath)
|
||||
Num_Axium_APServer.StartTransfer()
|
||||
Return True
|
||||
Case NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||
EgtOutLog("Pre Download")
|
||||
Dim nFileType As Integer = 0
|
||||
If Integer.TryParse(ProgramId, nFileType) AndAlso nFileType > 0 Then
|
||||
Num_Axium_PCToolkit.FileDownload(nFileType * 10, ProgramPath)
|
||||
End If
|
||||
Return True
|
||||
End Select
|
||||
Return False
|
||||
End Function
|
||||
|
||||
Public Sub RemoveProgram(ProgramIndex As Integer, ProgramPath As String, ProgramType As String)
|
||||
@@ -786,6 +1075,11 @@ Public Class MachManaging
|
||||
Case NCTypes.NUM_FLEXIUM
|
||||
Num_Flexium.FileDelete(ProgramType, ProgramPath)
|
||||
Num_Flexium.StartTransfer()
|
||||
Case NCTypes.NUM_AXIUM_APSERVER
|
||||
Num_Axium_APServer.FileDelete(ProgramType, ProgramPath)
|
||||
Num_Axium_APServer.StartTransfer()
|
||||
Case NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||
Num_Axium_PCToolkit.FileDelete(ProgramType, ProgramPath)
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
@@ -805,6 +1099,28 @@ Public Class MachManaging
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Public Sub SetChannel(value As Integer)
|
||||
Select Case CurrentMachine.NCType
|
||||
Case NCTypes.NUM_FLEXIUM
|
||||
Num_Flexium.SetChannel(value)
|
||||
Case NCTypes.NUM_AXIUM_APSERVER
|
||||
Num_Axium_APServer.SetChannel(value)
|
||||
Case NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||
Num_Axium_PCToolkit.SetChannel(value)
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Public Sub SendMDI(value As String)
|
||||
Select Case CurrentMachine.NCType
|
||||
Case NCTypes.NUM_FLEXIUM
|
||||
Num_Flexium.MDI_Execute(value)
|
||||
Case NCTypes.NUM_AXIUM_APSERVER
|
||||
Num_Axium_APServer.MDI_Execute(value)
|
||||
Case NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||
Num_Axium_PCToolkit.MDI_Execute(value)
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Public Sub WriteVar(Address As String, Value As String, Type As CommVar.Types)
|
||||
Select Case CurrentMachine.NCType
|
||||
Case NCTypes.TPA
|
||||
@@ -816,6 +1132,20 @@ Public Class MachManaging
|
||||
Case CommVar.Types.CN
|
||||
Num_Flexium.WriteNCVariables(Address, Value)
|
||||
End Select
|
||||
Case NCTypes.NUM_AXIUM_APSERVER
|
||||
Select Case Type
|
||||
Case CommVar.Types.PLC
|
||||
Num_Axium_APServer.WritePlcVariables(Address, Value)
|
||||
Case CommVar.Types.CN
|
||||
Num_Axium_APServer.WriteNCVariables(Address, Value)
|
||||
End Select
|
||||
Case NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||
Select Case Type
|
||||
Case CommVar.Types.PLC
|
||||
Num_Axium_PCToolkit.WritePlcVariables(Address, Value)
|
||||
Case CommVar.Types.CN
|
||||
Num_Axium_PCToolkit.WriteNCVariables(Address, Value)
|
||||
End Select
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
@@ -827,7 +1157,12 @@ Public Class MachManaging
|
||||
Return RWVariableManager.InitVar(NewVar)
|
||||
Case NCTypes.NUM_FLEXIUM
|
||||
Return NUMFlexiumComm.InitVar(NewVar)
|
||||
Case NCTypes.NUM_AXIUM_APSERVER
|
||||
Return NUMAxiumComm.InitVar(NewVar)
|
||||
Case NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||
Return NUMAxiumPcToolkitComm.InitVar(NewVar)
|
||||
End Select
|
||||
Return Nothing
|
||||
End Function
|
||||
|
||||
Private Shared Function GetPrivateProfileVariable(IpAppName As String, IpKeyName As String, IpFileName As String) As CommVar
|
||||
@@ -835,7 +1170,7 @@ Public Class MachManaging
|
||||
EgtUILib.GetPrivateProfileString(IpAppName, IpKeyName, "", sVariable, IpFileName)
|
||||
If String.IsNullOrWhiteSpace(sVariable) Then Return Nothing
|
||||
Dim sVariableValues() As String = sVariable.Split(","c)
|
||||
If Not sVariableValues.Count >= 4 Then Return Nothing
|
||||
'If Not sVariableValues.Count >= 4 Then Return Nothing
|
||||
For Index As Integer = 0 To sVariableValues.Count - 1
|
||||
sVariableValues(Index) = sVariableValues(Index).Trim()
|
||||
Next
|
||||
@@ -866,7 +1201,56 @@ Public Class MachManaging
|
||||
Case S_OUTPUTVARIABLES
|
||||
Paragraph = Paragraphs.OUTPUT
|
||||
End Select
|
||||
Return New CommVar(sVariableValues(0), sVariableValues(1), ReadType, Type, Paragraph)
|
||||
Dim sDescription As String = ""
|
||||
If sVariableValues.Length >= 5 Then
|
||||
Dim nDescription As Integer
|
||||
If Integer.TryParse(sVariableValues(4), nDescription) Then
|
||||
Dim MsgParagraph As MsgParagraphs
|
||||
Select Case Paragraph
|
||||
Case Paragraphs.INPUT
|
||||
MsgParagraph = MsgParagraphs.INPUT
|
||||
Case Paragraphs.OUTPUT
|
||||
MsgParagraph = MsgParagraphs.OUTPUT
|
||||
Case Else
|
||||
MsgParagraph = MsgParagraphs.INPUT
|
||||
End Select
|
||||
sDescription = MachMsg(MsgParagraph, nDescription)
|
||||
Else
|
||||
sDescription = sVariableValues(4)
|
||||
End If
|
||||
End If
|
||||
Return New CommVar(sVariableValues(0), sVariableValues(1), ReadType, Type, Paragraph, sDescription)
|
||||
End Function
|
||||
|
||||
Private Sub ReadPLCMessages()
|
||||
Dim nPlc_Msg(5) As Integer
|
||||
For Index As Integer = 1 To 6
|
||||
Dim nIndex As Integer = Index
|
||||
Dim PLCMessagesVariable As Variable = Map.refMachCommandMessagePanelVM.MainVariablesList.FirstOrDefault(Function(x) x.sName = PLC_MESSAGES & nIndex)
|
||||
If IsNothing(PLCMessagesVariable) OrElse IsNothing(PLCMessagesVariable.sValue) Then Return
|
||||
Dim nTemp As Integer = 0
|
||||
Integer.TryParse(PLCMessagesVariable.sValue, nTemp)
|
||||
Dim Bytes As Byte() = BitConverter.GetBytes(nTemp)
|
||||
Dim NewBytes As Byte() = BitConverter.GetBytes(nTemp)
|
||||
For nBIndex = Bytes.Count - 1 To 0 Step -1
|
||||
NewBytes(Bytes.Count - 1 - nBIndex) = Bytes(nBIndex)
|
||||
Next
|
||||
Dim Res = BitConverter.ToInt32(NewBytes, 0)
|
||||
nPlc_Msg(nIndex - 1) = Res
|
||||
Next
|
||||
Dim BitArray As New BitArray(nPlc_Msg)
|
||||
Dim ErrorList As New List(Of Integer)
|
||||
For BitIndex = 0 To BitArray.Count - 1
|
||||
If BitIndex <= 169 AndAlso BitArray(BitIndex) Then
|
||||
ErrorList.Add(BitIndex)
|
||||
End If
|
||||
Next
|
||||
Select Case CurrentMachine.NCType
|
||||
Case NCTypes.NUM_AXIUM_APSERVER
|
||||
Num_Axium_APServer.objErrorHandler_ErrorFromActiveCnc2(ErrorList)
|
||||
Case NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||
Num_Axium_PCToolkit.objErrorHandler_ErrorFromActiveCnc2(ErrorList)
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
@@ -59,7 +59,7 @@ Public Class RWVariableManager
|
||||
|
||||
Public Shared Function InitVar(Name As String, Address As String, Type As CommVar.ReadTypes) As Integer
|
||||
Dim Index As Integer = Array.IndexOf(m_ReadingVars, Nothing)
|
||||
m_ReadingVars(Index) = New CommVar(Name, Address, Type, CommVar.Types.NULL, CommVar.Paragraphs.NULL)
|
||||
m_ReadingVars(Index) = New CommVar(Name, Address, Type, CommVar.Types.NULL, CommVar.Paragraphs.NULL, "")
|
||||
Return Index
|
||||
End Function
|
||||
|
||||
@@ -101,7 +101,7 @@ Public Class RWVariableManager
|
||||
Case S_OUTPUTVARIABLES
|
||||
Paragraph = Paragraphs.OUTPUT
|
||||
End Select
|
||||
Return New CommVar(sVariableValues(0), sVariableValues(1), Type, CommVar.Types.NULL, Paragraph)
|
||||
Return New CommVar(sVariableValues(0), sVariableValues(1), Type, CommVar.Types.NULL, Paragraph, "")
|
||||
End Function
|
||||
|
||||
Public Sub RefreshVar(Name As String)
|
||||
@@ -148,7 +148,7 @@ Public Class RWVariableManager
|
||||
Public Sub ReadVar(Name As String, ByRef Value As Double)
|
||||
Dim nIndex As Integer = GetIndexFromName(Name)
|
||||
If nIndex >= 0 Then
|
||||
Value = StringToDouble(m_ReadedVars(nIndex), 5)
|
||||
Value = StringToDoubleAdv(m_ReadedVars(nIndex), 5)
|
||||
Else
|
||||
Value = -999999999
|
||||
End If
|
||||
@@ -266,6 +266,7 @@ Public Class CommVar
|
||||
m_sName = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_sAddress As String
|
||||
Public Property sAddress As String
|
||||
Get
|
||||
@@ -275,12 +276,14 @@ Public Class CommVar
|
||||
m_sAddress = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_nReadType As ReadTypes
|
||||
Public ReadOnly Property nReadType As ReadTypes
|
||||
Get
|
||||
Return m_nReadType
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_nType As Types
|
||||
Public ReadOnly Property nType As Types
|
||||
Get
|
||||
@@ -298,9 +301,21 @@ Public Class CommVar
|
||||
Dim bNewValue As Boolean = m_sValue <> Value
|
||||
m_sValue = Value
|
||||
m_bReaded = True
|
||||
If CurrentMachine.NCType = NCTypes.NUM_FLEXIUM AndAlso (sName = MACHINDEX OrElse sName = TOOLINDEX OrElse sName = TOOLINDEX2) Then
|
||||
Map.refLeftPanelVM.NotifyPropertyChanged(NameOf(Map.refLeftPanelVM.sE80000))
|
||||
Map.refLeftPanelVM.NotifyPropertyChanged(NameOf(Map.refLeftPanelVM.sE80001))
|
||||
Map.refLeftPanelVM.NotifyPropertyChanged(NameOf(Map.refLeftPanelVM.sE80002))
|
||||
End If
|
||||
If bNewValue Then RaiseEvent NewValue(Me, New NewValueEventArgs(Value))
|
||||
End Sub
|
||||
|
||||
Private m_sDescription As String
|
||||
Public ReadOnly Property sDescription As String
|
||||
Get
|
||||
Return m_sDescription
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_bReaded As Boolean
|
||||
Public ReadOnly Property bReaded As Boolean
|
||||
Get
|
||||
@@ -319,12 +334,13 @@ Public Class CommVar
|
||||
' indice usato in liste lettura NUM
|
||||
Friend Index As Integer = -1
|
||||
|
||||
Sub New(Name As String, Address As String, ReadType As ReadTypes, Type As Types, Paragraph As Paragraphs)
|
||||
Sub New(Name As String, Address As String, ReadType As ReadTypes, Type As Types, Paragraph As Paragraphs, sDescription As String)
|
||||
m_sName = Name
|
||||
m_sAddress = Address
|
||||
m_nReadType = ReadType
|
||||
m_nType = Type
|
||||
m_Paragraph = Paragraph
|
||||
m_sDescription = sDescription
|
||||
End Sub
|
||||
|
||||
Friend Sub ResetReading()
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
<UserControl x:Class="MachineLogPageV"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.Supervisor"
|
||||
xmlns:EgtBEAMWALLCORE="clr-namespace:EgtBEAMWALL.Core;assembly=EgtBEAMWALL.Core">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid Visibility="Collapsed">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<!--<ComboBox ItemsSource="MachLogTypeList"
|
||||
SelectedItem="SelMachLogType"/>-->
|
||||
<Button Grid.Column="1"
|
||||
Command="{Binding Refresh_Command}"
|
||||
Margin="2.5,0,5,0"
|
||||
Style="{StaticResource ToolBar_Button}">
|
||||
<Image Source="/Resources/MDIPage/Send.png" Stretch="Uniform"/>
|
||||
</Button>
|
||||
</Grid>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Height="30">
|
||||
<TextBlock Text="Entità"
|
||||
Style="{StaticResource Log_TextBlock}"/>
|
||||
<ComboBox ItemsSource="{Binding EntityTypeList}"
|
||||
SelectedIndex="{Binding SelEntityType}"
|
||||
Width="70"
|
||||
Margin="0,0,2.5,0"
|
||||
Style="{StaticResource PartParam_ComboBox}"/>
|
||||
<TextBlock Text="Evento"
|
||||
Style="{StaticResource Log_TextBlock}"/>
|
||||
<ComboBox ItemsSource="{Binding PartEventTypeList}"
|
||||
SelectedIndex="{Binding SelPartEventType}"
|
||||
Width="70"
|
||||
Margin="0,0,2.5,0"
|
||||
Style="{StaticResource PartParam_ComboBox}"/>
|
||||
<TextBlock Text="Data"
|
||||
Style="{StaticResource Log_TextBlock}"/>
|
||||
<ComboBox ItemsSource="{Binding DayTypeList}"
|
||||
SelectedIndex="{Binding SelDayType}"
|
||||
Width="70"
|
||||
Margin="0,0,2.5,0"
|
||||
Style="{StaticResource PartParam_ComboBox}"/>
|
||||
<StackPanel Orientation="Horizontal" Visibility="{Binding Date_Visibility}">
|
||||
<TextBlock Text="Dal"
|
||||
Style="{StaticResource Log_TextBlock}"/>
|
||||
<DatePicker SelectedDate="{Binding dtStartDate}"
|
||||
Style="{StaticResource Log_DatePicker}"/>
|
||||
<TextBlock Text="Al"
|
||||
Style="{StaticResource Log_TextBlock}"/>
|
||||
<DatePicker SelectedDate="{Binding dtEndDate}"
|
||||
Style="{StaticResource Log_DatePicker}"/>
|
||||
</StackPanel>
|
||||
<!--<TextBox Text="{Binding MaxRowNumber}"/>-->
|
||||
<Button Grid.Column="1"
|
||||
Command="{Binding Refresh_Command}"
|
||||
Margin="2.5,0,5,0"
|
||||
Style="{StaticResource ToolBar_Button}">
|
||||
<Image Source="/Resources/MDIPage/Send.png" Stretch="Uniform"/>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
<EgtBEAMWALLCORE:EgtDataGrid ItemsSource="{Binding MachineLogList}"
|
||||
Grid.Row="1"
|
||||
AutoGenerateColumns="False"
|
||||
CanUserDeleteRows="False"
|
||||
CanUserResizeRows="False"
|
||||
SelectionMode="Single"
|
||||
ScrollViewer.CanContentScroll="True"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Auto"
|
||||
Margin="0,0,0,5"
|
||||
BindingColumns="{Binding MachineLogColumns}">
|
||||
<DataGrid.Resources>
|
||||
<!-- Data/ora -->
|
||||
<DataGridTextColumn x:Key="colDATETIME" Binding="{Binding sEventDateTime}"
|
||||
SortMemberPath="sEventTick">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=DataContext.EventDateTime_Msg,
|
||||
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:MachineLogPageV}}}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
</DataGridTextColumn>
|
||||
<!-- Type -->
|
||||
<DataGridTextColumn x:Key="colTYPE" Binding="{Binding sEventType}">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=DataContext.EventType_Msg,
|
||||
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:MachineLogPageV}}}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
</DataGridTextColumn>
|
||||
<!-- Descrizione -->
|
||||
<DataGridTextColumn x:Key="colDESCRIPTION" Binding="{Binding sEventValue}">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=DataContext.EventValue_Msg,
|
||||
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:MachineLogPageV}}}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
</DataGridTextColumn>
|
||||
<!-- SupervisorId -->
|
||||
<DataGridTextColumn x:Key="colSUPERVISORID" Binding="{Binding SupervisorId}">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=DataContext.SupervisorId_Msg,
|
||||
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:MachineLogPageV}}}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn x:Key="colPROD" Binding="{Binding ProdId}">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=DataContext.ProdId_Msg,
|
||||
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:MachineLogPageV}}}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn x:Key="colMACHGROUP" Binding="{Binding MachGroupId}">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=DataContext.MachGroupId_Msg,
|
||||
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:MachineLogPageV}}}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn x:Key="colPART" Binding="{Binding PartId}">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=DataContext.PartId_Msg,
|
||||
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:MachineLogPageV}}}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn x:Key="colSTATUS" Binding="{Binding Status}">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=DataContext.Status_Msg,
|
||||
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:MachineLogPageV}}}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
</DataGridTextColumn>
|
||||
</DataGrid.Resources>
|
||||
|
||||
</EgtBEAMWALLCORE:EgtDataGrid>
|
||||
|
||||
</Grid>
|
||||
|
||||
</UserControl>
|
||||
@@ -0,0 +1,3 @@
|
||||
Public Class MachineLogPageV
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,447 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports EgtWPFLib5
|
||||
Imports EgtUILib
|
||||
Imports EgtBEAMWALL.Core
|
||||
Imports System.Windows.Threading
|
||||
Imports EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
Imports EgtBEAMWALL.Core.MachLog
|
||||
|
||||
Public Class MachineLogPageVM
|
||||
Inherits VMBase
|
||||
|
||||
Private m_Lock_LogList As New Object
|
||||
|
||||
Private m_MachineLog_Timer As New DispatcherTimer
|
||||
|
||||
Private Enum DayTypes As Integer
|
||||
TODAY = 0
|
||||
YESTERDAY = 1
|
||||
PERIOD = 2
|
||||
End Enum
|
||||
|
||||
Private m_colMachineLog_Type As EgtDataGridColumn
|
||||
Public ReadOnly Property colMachineLog_Type As EgtDataGridColumn
|
||||
Get
|
||||
Return m_colMachineLog_Type
|
||||
End Get
|
||||
End Property
|
||||
Private m_colMachineLog_Description As EgtDataGridColumn
|
||||
Public ReadOnly Property colMachineLog_Description As EgtDataGridColumn
|
||||
Get
|
||||
Return m_colMachineLog_Description
|
||||
End Get
|
||||
End Property
|
||||
Private m_colMachineLog_SupervisorId As EgtDataGridColumn
|
||||
Public ReadOnly Property colMachineLog_SupervisorId As EgtDataGridColumn
|
||||
Get
|
||||
Return m_colMachineLog_SupervisorId
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_MachineLogColumns As New ObservableCollection(Of EgtDataGridColumn)
|
||||
Public Property MachineLogColumns As ObservableCollection(Of EgtDataGridColumn)
|
||||
Get
|
||||
Return m_MachineLogColumns
|
||||
End Get
|
||||
Set(value As ObservableCollection(Of EgtDataGridColumn))
|
||||
m_MachineLogColumns = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_MachineLogList_View As CollectionView = Nothing
|
||||
Private m_MachineLogList As New ObservableCollection(Of LogEvent)
|
||||
Public Property MachineLogList As ObservableCollection(Of LogEvent)
|
||||
Get
|
||||
Return m_MachineLogList
|
||||
End Get
|
||||
Set(value As ObservableCollection(Of LogEvent))
|
||||
m_MachineLogList = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_MachLogTypeList As New List(Of MachLogType)({New MachLogType(MachLogTypes.PART_STATUS, "PartStatus", True),
|
||||
New MachLogType(MachLogTypes.MACHGROUP_STATUS, "MachGroupStatus", True),
|
||||
New MachLogType(MachLogTypes.MACHINE_MODE, "MachineMode", True),
|
||||
New MachLogType(MachLogTypes.ALARM, "Alarm", True)})
|
||||
Public Property MachLogTypeList As List(Of MachLogType)
|
||||
Get
|
||||
Return m_MachLogTypeList
|
||||
End Get
|
||||
Set(value As List(Of MachLogType))
|
||||
m_MachLogTypeList = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_PartEventTypeList As New List(Of String)({"", "Inizio", "Fine"})
|
||||
Public ReadOnly Property PartEventTypeList As List(Of String)
|
||||
Get
|
||||
Return m_PartEventTypeList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_SelPartEventType As Integer
|
||||
Public Property SelPartEventType As Integer
|
||||
Get
|
||||
Return m_SelPartEventType
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_SelPartEventType = value
|
||||
WriteMainPrivateProfileString(S_MACHINELOGFILTER, K_PARTEVENTTYPE, m_SelPartEventType.ToString())
|
||||
m_MachineLogList_View.Refresh()
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_EntityTypeList As New List(Of String)({"", "Pezzo", "Barra"})
|
||||
Public ReadOnly Property EntityTypeList As List(Of String)
|
||||
Get
|
||||
Return m_EntityTypeList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_SelEntityType As Integer
|
||||
Public Property SelEntityType As Integer
|
||||
Get
|
||||
Return m_SelEntityType
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_SelEntityType = value
|
||||
WriteMainPrivateProfileString(S_MACHINELOGFILTER, K_ENTITYTYPE, m_SelEntityType.ToString())
|
||||
m_MachineLogList_View.Refresh()
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_DayTypeList As New List(Of String)({"Oggi", "Ieri", "Periodo"})
|
||||
Public ReadOnly Property DayTypeList As List(Of String)
|
||||
Get
|
||||
Return m_DayTypeList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_SelDayType As DayTypes = DayTypes.TODAY
|
||||
Public Property SelDayType As Integer
|
||||
Get
|
||||
Return m_SelDayType
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
Dim PrevSelDayType As DayTypes = m_SelDayType
|
||||
m_SelDayType = value
|
||||
WriteMainPrivateProfileString(S_MACHINELOGFILTER, K_DAYTYPE, Convert.ToInt32(m_SelDayType))
|
||||
m_Date_Visibility = If(m_SelDayType = DayTypes.PERIOD, Visibility.Visible, Visibility.Collapsed)
|
||||
If m_SelDayType = DayTypes.PERIOD Then
|
||||
m_dtStartDate = If(PrevSelDayType = DayTypes.TODAY, DateTime.Today, DateTime.Today - TimeSpan.FromDays(1))
|
||||
m_dtEndDate = If(PrevSelDayType = DayTypes.TODAY, DateTime.Today, DateTime.Today - TimeSpan.FromDays(1))
|
||||
NotifyPropertyChanged(NameOf(dtStartDate))
|
||||
NotifyPropertyChanged(NameOf(dtEndDate))
|
||||
End If
|
||||
NotifyPropertyChanged(NameOf(Date_Visibility))
|
||||
' aggiorno lista da Db
|
||||
UpdateMachineLogList(True)
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_dtStartDate As DateTime = DateTime.Today
|
||||
Public Property dtStartDate As DateTime
|
||||
Get
|
||||
Return m_dtStartDate
|
||||
End Get
|
||||
Set(value As DateTime)
|
||||
m_dtStartDate = value
|
||||
Dim lStartDate As Long = m_dtStartDate.ToFileTimeUtc()
|
||||
WriteMainPrivateProfileString(S_MACHINELOGFILTER, K_STARTDATE, lStartDate.ToString())
|
||||
' aggiorno lista da Db
|
||||
UpdateMachineLogList(True)
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_dtEndDate As DateTime = DateTime.Today
|
||||
Public Property dtEndDate As DateTime
|
||||
Get
|
||||
Return m_dtEndDate
|
||||
End Get
|
||||
Set(value As DateTime)
|
||||
m_dtEndDate = value
|
||||
Dim lEndDate As Long = m_dtEndDate.ToFileTimeUtc()
|
||||
WriteMainPrivateProfileString(S_MACHINELOGFILTER, K_ENDDATE, lEndDate.ToString())
|
||||
' aggiorno lista da Db
|
||||
UpdateMachineLogList(True)
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_Date_Visibility As Visibility = Visibility.Collapsed
|
||||
Public ReadOnly Property Date_Visibility As Visibility
|
||||
Get
|
||||
Return m_Date_Visibility
|
||||
End Get
|
||||
End Property
|
||||
|
||||
' Definizione comandi
|
||||
Private m_cmdRefresh As ICommand
|
||||
|
||||
#Region "Messages"
|
||||
|
||||
Public ReadOnly Property EventDateTime_Msg As String
|
||||
Get
|
||||
Return EgtMsg(62512)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property EventType_Msg As String
|
||||
Get
|
||||
Return EgtMsg(62513)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property EventValue_Msg As String
|
||||
Get
|
||||
Return EgtMsg(62514)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property SupervisorId_Msg As String
|
||||
Get
|
||||
Return EgtMsg(62515)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property ProdId_Msg As String
|
||||
Get
|
||||
Return EgtMsg(62516)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property MachGroupId_Msg As String
|
||||
Get
|
||||
Return EgtMsg(62517)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property PartId_Msg As String
|
||||
Get
|
||||
Return EgtMsg(62518)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Status_Msg As String
|
||||
Get
|
||||
Return EgtMsg(62519)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
|
||||
#End Region ' Messages
|
||||
|
||||
#Region "CONSTRUCTORS"
|
||||
|
||||
Sub New()
|
||||
' imposto riferimento in Map
|
||||
Map.SetRefMachineLogPageVM(Me)
|
||||
' carico le colonne della datagrid
|
||||
GetPrivateProfileColumns(S_MACHINELOG, MachineLogColumns)
|
||||
m_MachineLogList_View = CollectionViewSource.GetDefaultView(m_MachineLogList)
|
||||
m_MachineLogList_View.Filter = AddressOf MachineLogFilter
|
||||
' recupero riferimento a colonna StartCut
|
||||
m_colMachineLog_Type = m_MachineLogColumns.FirstOrDefault(Function(x) x.Name = COL_TYPE)
|
||||
m_colMachineLog_Description = m_MachineLogColumns.FirstOrDefault(Function(x) x.Name = COL_DESCRIPTION)
|
||||
m_colMachineLog_SupervisorId = m_MachineLogColumns.FirstOrDefault(Function(x) x.Name = COL_SUPERVISORID)
|
||||
' imposto valori filtri da ini
|
||||
m_SelPartEventType = GetMainPrivateProfileInt(S_MACHINELOGFILTER, K_PARTEVENTTYPE, 2)
|
||||
m_SelEntityType = GetMainPrivateProfileInt(S_MACHINELOGFILTER, K_ENTITYTYPE, 1)
|
||||
m_SelDayType = GetMainPrivateProfileInt(S_MACHINELOGFILTER, K_DAYTYPE, 0)
|
||||
Select Case m_SelDayType
|
||||
Case DayTypes.TODAY
|
||||
m_dtStartDate = DateTime.Today
|
||||
m_dtEndDate = DateTime.Today
|
||||
Case DayTypes.YESTERDAY
|
||||
m_dtStartDate = DateTime.Today - TimeSpan.FromDays(1)
|
||||
m_dtEndDate = DateTime.Today - TimeSpan.FromDays(1)
|
||||
Case DayTypes.PERIOD
|
||||
Dim sStartDate As String = "0"
|
||||
Dim lStartDate As Long = 0
|
||||
GetMainPrivateProfileString(S_MACHINELOGFILTER, K_STARTDATE, 0, sStartDate)
|
||||
Long.TryParse(sStartDate, lStartDate)
|
||||
m_dtStartDate = If(lStartDate > 0, DateTime.FromFileTimeUtc(lStartDate), DateTime.Today)
|
||||
Dim sEndDate As String = "0"
|
||||
Dim lEndDate As Long = 0
|
||||
GetMainPrivateProfileString(S_MACHINELOGFILTER, K_ENDDATE, 0, sEndDate)
|
||||
Long.TryParse(sEndDate, lEndDate)
|
||||
m_dtEndDate = If(lEndDate > 0, DateTime.FromFileTimeUtc(lEndDate), DateTime.Today)
|
||||
m_Date_Visibility = Visibility.Visible
|
||||
End Select
|
||||
m_MachineLog_Timer.Interval = TimeSpan.FromMilliseconds(100)
|
||||
AddHandler m_MachineLog_Timer.Tick, AddressOf MachineLog_Timer_Tick
|
||||
m_MachineLog_Timer.Start()
|
||||
End Sub
|
||||
|
||||
#End Region ' CONSTRUCTORS
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Private Function MachineLogFilter(CurrEvent As Object) As Boolean
|
||||
Dim CurrLogEvent As LogEvent = DirectCast(CurrEvent, LogEvent)
|
||||
Dim bOk As Boolean = True
|
||||
' se livello utente inferiore a 5, mostro solo eventi pezzo e machgroup
|
||||
If Map.refMainWindowVM.MainWindowM.nUserLevel < 5 Then
|
||||
If CurrLogEvent.EventType <> LogEvent.MachLogTypes.PART_STATUS AndAlso CurrLogEvent.EventType <> LogEvent.MachLogTypes.MACHGROUP_STATUS Then
|
||||
Return False
|
||||
End If
|
||||
End If
|
||||
Select Case m_SelEntityType
|
||||
Case 0 ' ""
|
||||
bOk = bOk And True
|
||||
Case 1 ' "Pezzo"
|
||||
bOk = bOk And CurrLogEvent.EventType = LogEvent.MachLogTypes.PART_STATUS
|
||||
Case 2 ' "Barra"
|
||||
bOk = bOk And CurrLogEvent.EventType = LogEvent.MachLogTypes.MACHGROUP_STATUS
|
||||
End Select
|
||||
If CurrLogEvent.EventType = LogEvent.MachLogTypes.PART_STATUS OrElse CurrLogEvent.EventType = LogEvent.MachLogTypes.MACHGROUP_STATUS Then
|
||||
Select Case m_SelPartEventType
|
||||
Case 0 ' ""
|
||||
bOk = bOk And True
|
||||
Case 1 ' "Inizio"
|
||||
bOk = bOk And CurrLogEvent.nStatus = 1
|
||||
Case 2 ' "Fine"
|
||||
bOk = bOk And CurrLogEvent.nStatus = 2
|
||||
End Select
|
||||
End If
|
||||
Return bOk
|
||||
End Function
|
||||
|
||||
Friend Sub LoadMachineLogList()
|
||||
If Map.refMainWindowVM.MainWindowM.nUserLevel < 5 Then
|
||||
m_colMachineLog_Type.ColumnVisibility = Visibility.Collapsed
|
||||
m_colMachineLog_Description.ColumnVisibility = Visibility.Collapsed
|
||||
m_colMachineLog_SupervisorId.ColumnVisibility = Visibility.Collapsed
|
||||
End If
|
||||
UpdateMachineLogList(True)
|
||||
m_MachineLogList_View = CollectionViewSource.GetDefaultView(m_MachineLogList)
|
||||
m_MachineLogList_View.Filter = AddressOf MachineLogFilter
|
||||
End Sub
|
||||
|
||||
' indice di aggiornamento della lista rispetto a Db
|
||||
Private m_nUpdateIndex As Integer
|
||||
' indice di ricaricamento completo della lista dal Db
|
||||
Private m_nRefreshIndex As Integer
|
||||
' indice dell'ultimo update/refresh
|
||||
Private m_nLastLogUpdate As Integer
|
||||
|
||||
Friend Sub UpdateMachineLogList(bRefresh As Boolean)
|
||||
Dim nMaxIndex As Integer = Math.Max(m_nUpdateIndex, m_nRefreshIndex)
|
||||
If bRefresh Then
|
||||
m_nRefreshIndex = nMaxIndex + 1
|
||||
Else
|
||||
m_nUpdateIndex = nMaxIndex + 1
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub MachineLog_Timer_Tick(sender As Object, e As EventArgs)
|
||||
SyncLock m_Lock_LogList
|
||||
Dim nRefresh As Integer = m_nRefreshIndex
|
||||
Dim nUpdate As Integer = m_nUpdateIndex
|
||||
If nRefresh > m_nLastLogUpdate Then
|
||||
m_nLastLogUpdate = nRefresh
|
||||
UpdateFromDb(True)
|
||||
ElseIf nUpdate > m_nLastLogUpdate Then
|
||||
m_nLastLogUpdate = nUpdate
|
||||
UpdateFromDb(False)
|
||||
End If
|
||||
End SyncLock
|
||||
End Sub
|
||||
|
||||
Friend Sub UpdateFromDb(bRefresh As Boolean)
|
||||
'm_MachineLogList = New ObservableCollection(Of LogEvent)(DbControllers.m_LogMachineController.GetCoreDesc(DateTime.Now - TimeSpan.FromDays(300), DateTime.Now).Select(Of LogEvent)(Function(x) New LogEvent(x)).ToList())
|
||||
Dim DbList As List(Of LogEvent)
|
||||
Select Case m_SelDayType
|
||||
Case DayTypes.PERIOD
|
||||
DbList = DbControllers.m_LogMachineController.GetCoreDesc(m_dtStartDate, m_dtEndDate + TimeSpan.FromDays(1)).Select(Of LogEvent)(Function(x) New LogEvent(x)).ToList()
|
||||
Case DayTypes.YESTERDAY
|
||||
DbList = DbControllers.m_LogMachineController.GetCoreDesc(DateTime.Today - TimeSpan.FromDays(1), DateTime.Today).Select(Of LogEvent)(Function(x) New LogEvent(x)).ToList()
|
||||
Case Else ' DayTypes.TODAY
|
||||
DbList = DbControllers.m_LogMachineController.GetCoreDesc(DateTime.Today, DateTime.Today + TimeSpan.FromDays(1)).Select(Of LogEvent)(Function(x) New LogEvent(x)).ToList()
|
||||
End Select
|
||||
If bRefresh OrElse m_MachineLogList.Count < 1 Then
|
||||
m_MachineLogList = New ObservableCollection(Of LogEvent)(DbList)
|
||||
Else
|
||||
' cerco in lista Db ultimo elemento della mia lista
|
||||
Dim LastItem As LogEvent = m_MachineLogList(0)
|
||||
Dim CommonItem As LogEvent = DbList.FirstOrDefault(Function(x) x.EventDateTime = LastItem.EventDateTime AndAlso x.EventType = LastItem.EventType AndAlso x.SupervisorId = LastItem.SupervisorId AndAlso x.Value = LastItem.Value)
|
||||
Dim nCommonItemIndex As Integer
|
||||
If Not IsNothing(CommonItem) Then
|
||||
nCommonItemIndex = DbList.IndexOf(CommonItem)
|
||||
End If
|
||||
' aggiorno i successivi
|
||||
If nCommonItemIndex >= 0 Then
|
||||
For Index = nCommonItemIndex - 1 To 0 Step -1
|
||||
m_MachineLogList.Insert(0, DbList(Index))
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
NotifyPropertyChanged(NameOf(MachineLogList))
|
||||
m_MachineLogList_View = CollectionViewSource.GetDefaultView(m_MachineLogList)
|
||||
m_MachineLogList_View.Filter = AddressOf MachineLogFilter
|
||||
End Sub
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
#Region "COMMANDS"
|
||||
|
||||
#Region "Refresh"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Open.
|
||||
''' </summary>
|
||||
Public ReadOnly Property Refresh_Command As ICommand
|
||||
Get
|
||||
If m_cmdRefresh Is Nothing Then
|
||||
m_cmdRefresh = New Command(AddressOf Refresh)
|
||||
End If
|
||||
Return m_cmdRefresh
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Open. This method is invoked by the OpenCommand.
|
||||
''' </summary>
|
||||
Friend Sub Refresh()
|
||||
UpdateMachineLogList(False)
|
||||
End Sub
|
||||
|
||||
#End Region ' Refresh
|
||||
|
||||
#End Region ' COMMANDS
|
||||
|
||||
End Class
|
||||
|
||||
Public Class MachLogType
|
||||
Inherits VMBase
|
||||
|
||||
Private m_nId As Integer
|
||||
Public ReadOnly Property nId As Integer
|
||||
Get
|
||||
Return m_nId
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_sName As String
|
||||
Public ReadOnly Property sName As String
|
||||
Get
|
||||
Return m_sName
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_bOn As Boolean = False
|
||||
Public Property bOn As Boolean
|
||||
Get
|
||||
Return m_bOn
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_bOn = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Sub New(nId As Integer, sName As String, bOn As Boolean)
|
||||
m_nId = nId
|
||||
m_sName = sName
|
||||
m_bOn = bOn
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -247,12 +247,12 @@ Public Class MainMenuVM
|
||||
End Function
|
||||
|
||||
Private Function ExitSUPERVISOR(bVerifyModification As Boolean) As Boolean
|
||||
''' verifico se progetto modificato, e chiedo se salvare
|
||||
''If bVerifyModification Then
|
||||
'' If Not ProjFileVM.VerifyProjectModification(Map.refProjManagerVM.CurrProj, ProjectType.PROJ) Then
|
||||
'' Return False
|
||||
'' End If
|
||||
''End If
|
||||
' verifico se progetto modificato, e chiedo se salvare
|
||||
'If bVerifyModification Then
|
||||
' If Not ProjFileVM.VerifyProjectModification(Map.refProjManagerVM.CurrProj, ProjectType.PROJ) Then
|
||||
' Return False
|
||||
' End If
|
||||
'End If
|
||||
Map.refProjectVM.SetBottomPanel_Visibility(False)
|
||||
Map.refProjectVM.SetLeftPanel_Visibility(True)
|
||||
Map.refProjectVM.SetPartManager_Visibility(False)
|
||||
|
||||
@@ -3,6 +3,7 @@ Imports System.Math
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
Imports EgtBEAMWALL.Core
|
||||
Imports System.IO
|
||||
|
||||
Public Class MainWindowM
|
||||
|
||||
@@ -18,6 +19,13 @@ Public Class MainWindowM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_sDataDir As String = String.Empty
|
||||
Friend ReadOnly Property sDataDir As String
|
||||
Get
|
||||
Return m_sDataDir
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_sConfigDir As String = String.Empty
|
||||
Public ReadOnly Property sConfigDir As String
|
||||
Get
|
||||
@@ -134,17 +142,19 @@ Public Class MainWindowM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_sProjsDir As String
|
||||
Friend ReadOnly Property sProjsDir As String
|
||||
Get
|
||||
Return m_sDataRoot & "\" & PROJS_DIR
|
||||
Return m_sProjsDir
|
||||
End Get
|
||||
End Property
|
||||
Private m_sProdsDir As String
|
||||
Friend ReadOnly Property sProdsDir As String
|
||||
Get
|
||||
Return m_sProdsDir
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Friend ReadOnly Property sProdsDir As String
|
||||
Get
|
||||
Return m_sDataRoot & "\" & PRODS_DIR
|
||||
End Get
|
||||
End Property
|
||||
Friend ReadOnly Property sZebraPrinterExe As String
|
||||
Get
|
||||
Dim sPrinterExe As String = ""
|
||||
@@ -188,6 +198,8 @@ Public Class MainWindowM
|
||||
IniFile.m_sIniFile = m_sConfigDir & "\" & Core.ConstIni.INI_FILE_NAME
|
||||
' Impostazione path BTL Ini File
|
||||
BTLIniFile.m_sBTLIniFile = m_sConfigDir & "\" & BTLFEATURES_FILE_NAME
|
||||
' Impostazione path Ini file DataGrid
|
||||
DataGridColumnsIniFile.m_sDataGridColumnsIniFile = m_sConfigDir & "\" & DATAGRIDCOLUMNS_FILE_NAME
|
||||
' Impostazione path Ini file Dimensioni
|
||||
DimensionsIniFile.m_sDimensionsIniFile = m_sConfigDir & "\" & ConstDims.DIMENSIONS_FILE_NAME
|
||||
' Impostazione path resources dir
|
||||
@@ -207,11 +219,10 @@ Public Class MainWindowM
|
||||
If GetMainPrivateProfileString(S_WALL, K_WALLBASEDIR, "", m_sWallRoot) = 0 Then
|
||||
m_sWallRoot = m_sDataRoot & "\" & WALL_DIR
|
||||
End If
|
||||
m_sWarehouseRoot = m_sDataRoot & "\" & WAREHOUSE_DIR
|
||||
' imposto cartelle dei progetti
|
||||
ProjectFileVM.Init(sProjsDir, sProdsDir)
|
||||
' Impostazione path Ini file DataGrid
|
||||
Core.DataGridColumnsIniFile.m_sDataGridColumnsIniFile = m_sConfigDir & "\" & DATAGRIDCOLUMNS_FILE_NAME
|
||||
' Impostazione direttorio magazzino grezzi
|
||||
If GetMainPrivateProfileString(S_GENERAL, K_DATADIR, "", m_sDataDir) = 0 Then
|
||||
m_sDataDir = m_sDataRoot
|
||||
End If
|
||||
' Verifico indice di istanza
|
||||
ManageInstance()
|
||||
' Imposto tipo di chiave
|
||||
@@ -228,9 +239,17 @@ Public Class MainWindowM
|
||||
EgtSetNestKey(sNestKey)
|
||||
' Verifico abilitazione nesting automatico
|
||||
m_bAutoNestOption = Not String.IsNullOrWhiteSpace(sNestKey)
|
||||
' Impostazioni per chiave di rete
|
||||
Dim bNetKey As Boolean = ( GetMainPrivateProfileInt( S_GENERAL, K_NETKEY, 0) = 1)
|
||||
EgtSetNetHwKey( bNetKey)
|
||||
Dim sLockId As String = ""
|
||||
EgtUILib.GetPrivateProfileString( S_LICENCE, K_LOCKID, "", sLockId, sLicFile)
|
||||
If Not String.IsNullOrEmpty( sLockId) Then
|
||||
EgtSetLockId( sLockId)
|
||||
End If
|
||||
' Recupero livello e opzioni della chiave
|
||||
Dim bKey As Boolean = EgtGetKeyLevel(5327, 2403, 1, m_nKeyLevel) And
|
||||
EgtGetKeyOptions(5327, 2403, 1, m_nKeyOptions)
|
||||
Dim bKey As Boolean = EgtGetKeyLevel(5327, 2505, 1, m_nKeyLevel) And
|
||||
EgtGetKeyOptions(5327, 2505, 1, m_nKeyOptions)
|
||||
' Inizializzazione generale di EgtInterface
|
||||
m_nDebug = GetMainPrivateProfileInt(S_GENERAL, K_DEBUG, 0)
|
||||
m_sLogFile = m_sTempDir & "\" & SUPGENLOG_FILE_NAME.Replace("#", m_nInstance.ToString())
|
||||
@@ -376,6 +395,37 @@ Public Class MainWindowM
|
||||
Return 1 ' Max(1, Min(nMaxInst, MAX_INST))
|
||||
End Function
|
||||
|
||||
Friend Sub UpdatePathForNetwork(sSharedFolder As String)
|
||||
m_sProjsDir = sSharedFolder & "\" & PROJS_DIR
|
||||
m_sProdsDir = sSharedFolder & "\" & PRODS_DIR
|
||||
' imposto cartelle dei progetti
|
||||
Core.ProjectFileVM.Init(sProjsDir, sProdsDir)
|
||||
End Sub
|
||||
|
||||
Friend Sub UpdatePathForKey(sKey As String)
|
||||
m_sProjsDir = m_sDataDir & "\" & sKey & "\" & PROJS_DIR
|
||||
m_sProdsDir = m_sDataDir & "\" & sKey & "\" & PRODS_DIR
|
||||
If Not Directory.Exists(m_sDataDir & "\" & sKey) Then
|
||||
Directory.CreateDirectory(m_sDataDir & "\" & sKey & "\" & PROJS_DIR)
|
||||
Directory.CreateDirectory(m_sDataDir & "\" & sKey & "\" & PRODS_DIR)
|
||||
End If
|
||||
' imposto cartelle dei progetti
|
||||
Core.ProjectFileVM.Init(sProjsDir, sProdsDir)
|
||||
End Sub
|
||||
|
||||
Friend Function GetKeyNumber() As Integer
|
||||
Dim sKey As String = ""
|
||||
Dim nKey As Integer = 0
|
||||
EgtGetKeyInfo(sKey)
|
||||
sKey = sKey.Replace(" ", "")
|
||||
If Not IsNothing(sKey) AndAlso sKey.Length > 11 Then
|
||||
If Integer.TryParse(sKey.Substring(3, 6), nKey) AndAlso nKey > 0 Then
|
||||
Return nKey
|
||||
End If
|
||||
End If
|
||||
Return -1
|
||||
End Function
|
||||
|
||||
Friend Sub Close()
|
||||
' Terminazione generale di EgtInterface
|
||||
EgtExit()
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
|
||||
Title="{Binding Title}" Icon="/Resources/EgtBEAMWALL.ico"
|
||||
MinHeight="600" MinWidth="800"
|
||||
ShowInTaskbar="True"
|
||||
AboutBoxCommand="{Binding AboutBox_Command}"
|
||||
CloseCommand="{Binding CloseApplication_Command,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}">
|
||||
<EgtWPFLib5:EgtCustomWindow.TitlePanel>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
Imports EgtWPFLib5
|
||||
Imports EgtBEAMWALL.Core
|
||||
|
||||
Class MainWindowV
|
||||
|
||||
@@ -11,9 +12,9 @@ Class MainWindowV
|
||||
InitializeComponent()
|
||||
' Assegno al riferimento locale al VM il VM preso dal DataContext
|
||||
m_MainWindowVM = DirectCast(Me.DataContext, MainWindowVM)
|
||||
'AddHandler Me.Loaded, AddressOf MainWindowV_Loaded
|
||||
AddHandler Me.Loaded, AddressOf MainWindowV_Loaded
|
||||
AddHandler Me.ContentRendered, AddressOf MainWindowV_ContentRendered
|
||||
'AddHandler Me.Closing, AddressOf MainWindowV_Closing
|
||||
AddHandler Me.Closing, AddressOf MainWindowV_Closing
|
||||
AddHandler Me.KeyDown, AddressOf MainWindowV_KeyDown
|
||||
End Sub
|
||||
|
||||
@@ -21,21 +22,21 @@ Class MainWindowV
|
||||
|
||||
#Region "EVENTS"
|
||||
|
||||
'Private Sub MainWindowV_Loaded(sender As Object, e As RoutedEventArgs)
|
||||
' ' Carico e imposto posizione finestra
|
||||
' WinPosFromIniToWindow(S_GENERAL, K_WINPLACE, Me)
|
||||
'End Sub
|
||||
Private Sub MainWindowV_Loaded(sender As Object, e As RoutedEventArgs)
|
||||
' Carico e imposto posizione finestra
|
||||
WinPosFromIniToWindow(S_GENERAL, K_SUPERVISORWINPLACE, Me)
|
||||
End Sub
|
||||
|
||||
Private Sub MainWindowV_ContentRendered(sender As Object, e As EventArgs)
|
||||
m_MainWindowVM.ContentRendered()
|
||||
End Sub
|
||||
|
||||
'Private Sub MainWindowV_Closing(sender As Object, e As System.ComponentModel.CancelEventArgs)
|
||||
' ' Salvo posizione finestra (se non minimizzata)
|
||||
' If WindowState <> WindowState.Minimized Then
|
||||
' WinPosFromWindowToIni(Me, S_GENERAL, K_WINPLACE)
|
||||
' End If
|
||||
'End Sub
|
||||
Private Sub MainWindowV_Closing(sender As Object, e As System.ComponentModel.CancelEventArgs)
|
||||
' Salvo posizione finestra (se non minimizzata)
|
||||
If WindowState <> WindowState.Minimized Then
|
||||
WinPosFromWindowToIni(Me, S_GENERAL, K_SUPERVISORWINPLACE)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub MainWindowV_KeyDown(sender As Object, e As KeyEventArgs)
|
||||
m_MainWindowVM.KeyDown(e.Key)
|
||||
|
||||
@@ -131,13 +131,24 @@ Public Class MainWindowVM
|
||||
Map.refLeftPanelVM.NotifyPropertyChanged(NameOf(Map.refLeftPanelVM.FeatureList_Visibility))
|
||||
|
||||
' inizializzo thread di aggiornamento e comunicazione con DB
|
||||
' creo thread gestione macchina
|
||||
' creo thread di comunicazione con ViewOptim
|
||||
m_ViewerOptimizerCommThread = New Thread(Sub()
|
||||
ViewerOptimizerCommThread.ViewerOptimizerCommThreadFunction()
|
||||
End Sub)
|
||||
m_ViewerOptimizerCommThread.SetApartmentState(ApartmentState.STA)
|
||||
' avvio thread di gestione della macchina che avvia la connessione
|
||||
' avvio thread di gestione comunicazione con ViewOptim
|
||||
m_ViewerOptimizerCommThread.Start()
|
||||
' se controllo axium, chiudo eventuale server di comunicazione rimasto aperto
|
||||
If CurrentMachine.NCType = NCTypes.NUM_AXIUM_APSERVER Then
|
||||
Dim ServerProcList As Process() = Process.GetProcessesByName("APServer")
|
||||
Dim LogProcList As Process() = Process.GetProcessesByName("APLog")
|
||||
For Each ServerProc In ServerProcList
|
||||
ServerProc.Kill()
|
||||
Next
|
||||
For Each LogProc In LogProcList
|
||||
LogProc.Kill()
|
||||
Next
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Friend Function ProcessCommandLine(ByRef nCommandType As Integer, ByRef nProdId As Integer) As Boolean
|
||||
@@ -153,6 +164,7 @@ Public Class MainWindowVM
|
||||
If Not Integer.TryParse(sProdId, nProdId) OrElse nProdId <= 0 Then Return False
|
||||
Return True
|
||||
End Select
|
||||
Return False
|
||||
End Function
|
||||
|
||||
Friend Sub KeyDown(PressedKey As Key)
|
||||
|
||||
@@ -11,11 +11,26 @@ Imports System.Windows
|
||||
|
||||
' Review the values of the assembly attributes
|
||||
|
||||
<Assembly: AssemblyTitle("EgtBEAMWALL.Supervisor")>
|
||||
<Assembly: AssemblyDescription("")>
|
||||
#If PLATFORM = "x64" Then
|
||||
#If DEBUG Then
|
||||
<Assembly: AssemblyTitle("EgtBEAMWALL.SupervisorD64.exe")>
|
||||
<Assembly: AssemblyDescription("EgtBEAMWALL S Debug 32 bit")>
|
||||
#Else
|
||||
<Assembly: AssemblyTitle("EgtBEAMWALL.SupervisorR64.exe")>
|
||||
<Assembly: AssemblyDescription("EgtBEAMWALL S 32 bit")>
|
||||
#End if
|
||||
#Else
|
||||
#If DEBUG Then
|
||||
<Assembly: AssemblyTitle("EgtBEAMWALL.SupervisorD32.exe")>
|
||||
<Assembly: AssemblyDescription("EgtBEAMWALL S Debug 32 bit")>
|
||||
#Else
|
||||
<Assembly: AssemblyTitle("EgtBEAMWALL.SupervisorR32.exe")>
|
||||
<Assembly: AssemblyDescription("EgtBEAMWALL S 32 bit")>
|
||||
#End if
|
||||
#End if
|
||||
<Assembly: AssemblyCompany("Egalware s.r.l.")>
|
||||
<Assembly: AssemblyProduct("EgtBEAMWALL.Supervisor")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2020-2022 by Egalware s.r.l.")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2020-2023 by Egalware s.r.l.")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
<Assembly: ComVisible(false)>
|
||||
|
||||
@@ -55,5 +70,5 @@ Imports System.Windows
|
||||
' by using the '*' as shown below:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("2.4.3.2")>
|
||||
<Assembly: AssemblyFileVersion("2.4.3.2")>
|
||||
<Assembly: AssemblyVersion("2.5.5.4")>
|
||||
<Assembly: AssemblyFileVersion("2.5.5.4")>
|
||||
|
||||
@@ -66,6 +66,11 @@
|
||||
<EgtBEAMWALL:MDIPageV DataContext="{StaticResource MDIPageVM}"/>
|
||||
</TabItem.Content>
|
||||
</TabItem>
|
||||
<TabItem Header="MACHINELOG">
|
||||
<TabItem.Content>
|
||||
<EgtBEAMWALL:MachineLogPageV DataContext="{StaticResource MachineLogPageVM}"/>
|
||||
</TabItem.Content>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
|
||||
</Grid>
|
||||
|
||||
@@ -11,6 +11,7 @@ Public Class ProjectVM
|
||||
Public Enum TabPages As Integer
|
||||
SCENE = 0
|
||||
MDI = 1
|
||||
MACHINELOG = 2
|
||||
End Enum
|
||||
|
||||
Private m_SelTabPage As TabPages
|
||||
@@ -23,8 +24,16 @@ Public Class ProjectVM
|
||||
End Set
|
||||
End Property
|
||||
Friend Sub SetSelTabPage(SelTabPage As TabPages)
|
||||
m_SelTabPage = SelTabPage
|
||||
NotifyPropertyChanged(NameOf(SelTabPage))
|
||||
If SelTabPage <> m_SelTabPage Then
|
||||
If m_SelTabPage = TabPages.MACHINELOG Then
|
||||
Map.refCALCPanelVM.SetMachineLog(False)
|
||||
End If
|
||||
If SelTabPage = TabPages.MACHINELOG Then
|
||||
Map.refMachineLogPageVM.LoadMachineLogList()
|
||||
End If
|
||||
m_SelTabPage = SelTabPage
|
||||
NotifyPropertyChanged(NameOf(SelTabPage))
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Property m_GridDims As New ObservableCollection(Of GridDimension)
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 812 B After Width: | Height: | Size: 1016 B |
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user