Compare commits
259 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2b8342111a | |||
| d57dd30fa0 | |||
| 06d3c53122 | |||
| 5a20897641 | |||
| ae65d448a9 | |||
| df9395e808 | |||
| 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 | |||
| 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 | |||
| 370b270d95 | |||
| 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 | |||
| 2d1de6ccf3 | |||
| 457da42970 | |||
| 527a3bc3b9 | |||
| e6047e51c6 | |||
| 77f225f866 | |||
| 0e662a8799 | |||
| ca2828958d | |||
| 97d6b26df5 | |||
| e01104dba3 | |||
| 443f72d86a | |||
| 794b45e4f3 | |||
| 456a4e6fb0 | |||
| 52b111aff3 | |||
| e3a436ff4d | |||
| cc04872cc1 | |||
| 4075563e9f | |||
| c68efe69be | |||
| bb0a838d91 | |||
| 217a3b6fcc | |||
| a7de0d3b1e | |||
| 77be897037 | |||
| 2ef75b21d0 | |||
| b5066816e1 | |||
| 34e5b6ec55 | |||
| 14e3fa908a | |||
| 81427b38b3 | |||
| d95bd48d9e | |||
| 342472c625 | |||
| 694feab56e | |||
| d7262bfbb6 | |||
| 1f510bfae8 | |||
| a054c472cf | |||
| 24827b336a | |||
| d9681dbcb5 | |||
| dd9ff98329 | |||
| 3fe0400219 | |||
| 5cf6343518 | |||
| 69a2905d9b | |||
| b1254c3247 | |||
| c2a3fdfbd4 | |||
| fd92dbbe23 | |||
| 0218880d93 | |||
| 057d31ab49 | |||
| 1ec1e4539f | |||
| 1c2f87d79f | |||
| 5d0a7705d5 | |||
| e357e54152 | |||
| e598c7af90 | |||
| ab930e2e90 | |||
| 3752846faa | |||
| 7deafdde51 | |||
| 145ba2afda | |||
| 31822c78a4 | |||
| a36313b9b2 | |||
| 9e7be2740e | |||
| 5f6572d0ef | |||
| ce794f55dc | |||
| bd13256399 | |||
| 76bdc0bb19 | |||
| 83bfe07c50 | |||
| cd940ccf7e | |||
| ae7474445d | |||
| ebec1bb583 | |||
| 3ddc441674 | |||
| acd66d7738 | |||
| 7be48bd00a | |||
| 136de45c47 | |||
| 93c4e02633 | |||
| f47bf047b8 | |||
| b0c6bb52f8 | |||
| 7642884442 | |||
| f8dc8d075b | |||
| 927f171cd6 | |||
| 5ca6f13899 | |||
| b68f6bfeee | |||
| cefff881f5 | |||
| 923f1ab7ff | |||
| f1b2e66b97 | |||
| b5daa71abf | |||
| ee558cecd6 | |||
| c87210873f | |||
| 0535036d36 | |||
| 77333dfc9e | |||
| a6b9fcd2ba | |||
| 568e98aec8 | |||
| 4548e468a1 | |||
| a73af5928f | |||
| 5385547af6 | |||
| 46f2db3415 | |||
| 2aa61e5141 | |||
| 007c9c0edc | |||
| ba807e89bc | |||
| 53ca42389e | |||
| 35cc8959da | |||
| 467284d008 | |||
| 51a2cbf17c | |||
| 8e8d1c2a91 | |||
| 7a2c45fc4b | |||
| 19b1b8d984 | |||
| 1767aa7f97 | |||
| 652ce25a83 | |||
| 6c2d3bb7b5 | |||
| 4257a92486 | |||
| ac621d9dc0 | |||
| 6f56ae6686 | |||
| e19032f3cb | |||
| 92b770f448 | |||
| 27d8eb37e8 | |||
| dfb3774943 | |||
| a9b003d9ec | |||
| 8c9f2ce613 | |||
| b833d6c4ec | |||
| 21a91b5202 | |||
| c1fba27b1f | |||
| 7225bad678 | |||
| f95ce8d671 | |||
| 54ed7dc11c | |||
| 69beb83764 | |||
| faa8aada54 | |||
| 4dcd4a1fa0 |
@@ -327,3 +327,4 @@ _UpgradeReport_Files/
|
|||||||
Backup*/
|
Backup*/
|
||||||
UpgradeLog*.XML
|
UpgradeLog*.XML
|
||||||
|
|
||||||
|
.ionide/symbolCache.db
|
||||||
|
|||||||
+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
|
||||||
|
|
||||||
@@ -174,7 +174,7 @@ Public Class BTLFeatureM
|
|||||||
Protected m_sCALC_MSG As String
|
Protected m_sCALC_MSG As String
|
||||||
Public Property sCALC_MSG As String
|
Public Property sCALC_MSG As String
|
||||||
Get
|
Get
|
||||||
Return m_sCALC_MSG
|
Return MessageFromLuaMsg(m_sCALC_MSG)
|
||||||
End Get
|
End Get
|
||||||
Set(value As String)
|
Set(value As String)
|
||||||
m_sCALC_MSG = value
|
m_sCALC_MSG = value
|
||||||
@@ -397,10 +397,14 @@ Public Class BTLFeatureM
|
|||||||
If Param.bIsP Then
|
If Param.bIsP Then
|
||||||
Param.SetValue(dParamValue)
|
Param.SetValue(dParamValue)
|
||||||
Else
|
Else
|
||||||
' se è un parametro Q verifico nel progetto se sia un valore custom
|
' recupero info Custom
|
||||||
Dim nCustom As Integer = 0
|
Dim nCustom As Integer = 0
|
||||||
EgtGetInfo(nFeatureId, Param.sName & "A", nCustom)
|
EgtGetInfo(nFeatureId, Param.sName & "A", nCustom)
|
||||||
If nCustom = 1 Then
|
'se pezzo parent di tipo Part
|
||||||
|
If TypeOf m_ParentPart Is PartM Then
|
||||||
|
Param.SetValue(dParamValue)
|
||||||
|
' se è un parametro Q verifico nel progetto se sia un valore custom
|
||||||
|
ElseIf nCustom = 1 Then
|
||||||
Param.SetValue(dParamValue)
|
Param.SetValue(dParamValue)
|
||||||
Param.bCustom = True
|
Param.bCustom = True
|
||||||
' altrimenti lo setto al valore di default
|
' altrimenti lo setto al valore di default
|
||||||
|
|||||||
@@ -666,7 +666,7 @@ Public Class BTLPartM
|
|||||||
Private m_sCALC_MSG As String
|
Private m_sCALC_MSG As String
|
||||||
Public Property sCALC_MSG As String
|
Public Property sCALC_MSG As String
|
||||||
Get
|
Get
|
||||||
Return m_sCALC_MSG
|
Return MessageFromLuaMsg(m_sCALC_MSG)
|
||||||
End Get
|
End Get
|
||||||
Set(value As String)
|
Set(value As String)
|
||||||
m_sCALC_MSG = value
|
m_sCALC_MSG = value
|
||||||
@@ -703,6 +703,16 @@ Public Class BTLPartM
|
|||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
Private m_nFeaturesGlobalState As CalcStates
|
||||||
|
Public Property nFeaturesGlobalState As CalcStates
|
||||||
|
Get
|
||||||
|
Return m_nFeaturesGlobalState
|
||||||
|
End Get
|
||||||
|
Set(value As CalcStates)
|
||||||
|
m_nFeaturesGlobalState = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
Private m_nCALC_GlobalERR As Integer
|
Private m_nCALC_GlobalERR As Integer
|
||||||
Public Property nCALC_GlobalERR As Integer
|
Public Property nCALC_GlobalERR As Integer
|
||||||
Get
|
Get
|
||||||
@@ -803,8 +813,8 @@ Public Class BTLPartM
|
|||||||
ind = ind + 1
|
ind = ind + 1
|
||||||
End While
|
End While
|
||||||
EgtGetInfo(nPartId, BTL_PRT_CAMBER, sValue)
|
EgtGetInfo(nPartId, BTL_PRT_CAMBER, sValue)
|
||||||
sValArray = sValue.Split(New String() {": ", " P"}, StringSplitOptions.RemoveEmptyEntries)
|
sValArray = sValue.Split(New String() {":", "P"}, StringSplitOptions.RemoveEmptyEntries)
|
||||||
If sValArray.Count() >= 5 Then
|
If sValArray.Count() >= 10 Then
|
||||||
StringToLen(sValArray(3), NewBTLPart.m_dCamberLen1)
|
StringToLen(sValArray(3), NewBTLPart.m_dCamberLen1)
|
||||||
StringToLen(sValArray(5), NewBTLPart.m_dCamberLen2)
|
StringToLen(sValArray(5), NewBTLPart.m_dCamberLen2)
|
||||||
StringToLen(sValArray(7), NewBTLPart.m_dCamberLen3)
|
StringToLen(sValArray(7), NewBTLPart.m_dCamberLen3)
|
||||||
@@ -818,8 +828,8 @@ Public Class BTLPartM
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
EgtGetInfo(nPartId, BTL_PRT_PARTOFFSET, sValue)
|
EgtGetInfo(nPartId, BTL_PRT_PARTOFFSET, sValue)
|
||||||
sValArray = sValue.Split(New String() {": ", " P"}, StringSplitOptions.RemoveEmptyEntries)
|
sValArray = sValue.Split(New String() {":", "P"}, StringSplitOptions.RemoveEmptyEntries)
|
||||||
If sValArray.Count() >= 5 Then
|
If sValArray.Count() >= 10 Then
|
||||||
StringToLen(sValArray(3), NewBTLPart.m_dPartOffsetSide1)
|
StringToLen(sValArray(3), NewBTLPart.m_dPartOffsetSide1)
|
||||||
StringToLen(sValArray(5), NewBTLPart.m_dPartOffsetSide2)
|
StringToLen(sValArray(5), NewBTLPart.m_dPartOffsetSide2)
|
||||||
StringToLen(sValArray(7), NewBTLPart.m_dPartOffsetSide3)
|
StringToLen(sValArray(7), NewBTLPart.m_dPartOffsetSide3)
|
||||||
|
|||||||
@@ -11,6 +11,13 @@ Public Class BTLStructureM
|
|||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
Private m_nAsseBaseId As Integer = GDB_ID.NULL
|
||||||
|
Public ReadOnly Property nAsseBaseId As Integer
|
||||||
|
Get
|
||||||
|
Return m_nAsseBaseId
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
' pezzi da BTL
|
' pezzi da BTL
|
||||||
Public m_BTLPartMList As List(Of BTLPartM)
|
Public m_BTLPartMList As List(Of BTLPartM)
|
||||||
Public Property BTLPartMList As List(Of BTLPartM)
|
Public Property BTLPartMList As List(Of BTLPartM)
|
||||||
@@ -384,7 +391,20 @@ Public Class BTLStructureM
|
|||||||
End If
|
End If
|
||||||
nBTLInfoLayerId = EgtGetNextName(nBTLInfoLayerId, BTLINFO)
|
nBTLInfoLayerId = EgtGetNextName(nBTLInfoLayerId, BTLINFO)
|
||||||
End While
|
End While
|
||||||
|
' cerco tra gli AsseBase
|
||||||
|
Dim nAsseBaseLayerId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, ASSEBASE)
|
||||||
|
While nAsseBaseLayerId <> GDB_ID.NULL
|
||||||
|
' verifico se il layer appartiene al ProjId
|
||||||
|
Dim nAsseBaseLayerProjId As Integer
|
||||||
|
EgtGetInfo(nAsseBaseLayerId, BTL_PRT_PROJ, nAsseBaseLayerProjId)
|
||||||
|
If nAsseBaseLayerProjId = ProjId Then
|
||||||
|
NewBTLStructure.m_nAsseBaseId = nAsseBaseLayerId
|
||||||
|
Exit While
|
||||||
|
End If
|
||||||
|
nAsseBaseLayerId = EgtGetNextName(nAsseBaseLayerId, ASSEBASE)
|
||||||
|
End While
|
||||||
Else
|
Else
|
||||||
|
NewBTLStructure.m_nAsseBaseId = EgtGetFirstNameInGroup(GDB_ID.ROOT, ASSEBASE)
|
||||||
NewBTLStructure.m_nBTLInfoId = EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO)
|
NewBTLStructure.m_nBTLInfoId = EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO)
|
||||||
End If
|
End If
|
||||||
EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_PROJNUM, NewBTLStructure.m_sPROJNUM)
|
EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_PROJNUM, NewBTLStructure.m_sPROJNUM)
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ Public Module CalcIntegration
|
|||||||
Public Event Calc_ProcessResult As EventHandler(Of CalcResultEventArgs)
|
Public Event Calc_ProcessResult As EventHandler(Of CalcResultEventArgs)
|
||||||
Public Event Calc_ProcessEnd As EventHandler(Of CalcProcessEndEventArgs)
|
Public Event Calc_ProcessEnd As EventHandler(Of CalcProcessEndEventArgs)
|
||||||
|
|
||||||
|
Private m_bIsSupervisor As Boolean = False
|
||||||
|
|
||||||
Public Enum CmdTypes As Integer
|
Public Enum CmdTypes As Integer
|
||||||
GENERATE = 0
|
GENERATE = 0
|
||||||
MODIFY = 1
|
MODIFY = 1
|
||||||
@@ -38,8 +40,9 @@ Public Module CalcIntegration
|
|||||||
|
|
||||||
Delegate Sub CallbackDlg(dProgress As Double, sProgress As String, ByRef bCancel As Boolean)
|
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()
|
_thread = New Thread(Sub()
|
||||||
|
m_bIsSupervisor = bIsSupervisor
|
||||||
DoJob(vBar, sProjDirPath, callback)
|
DoJob(vBar, sProjDirPath, callback)
|
||||||
End Sub)
|
End Sub)
|
||||||
_thread.Start()
|
_thread.Start()
|
||||||
@@ -162,7 +165,8 @@ Public Module CalcIntegration
|
|||||||
If vBar(nCurrBar).nCmdType = CmdTypes.CHECK OrElse vBar(nCurrBar).nCmdType = CmdTypes.CHECKGEN Then
|
If vBar(nCurrBar).nCmdType = CmdTypes.CHECK OrElse vBar(nCurrBar).nCmdType = CmdTypes.CHECKGEN Then
|
||||||
RaiseEvent Calc_ProcessResult(Nothing, New CalcResultEventArgs(vBar(nCurrBar))) 'ProcessResults(vBar(nCurrBar))
|
RaiseEvent Calc_ProcessResult(Nothing, New CalcResultEventArgs(vBar(nCurrBar))) 'ProcessResults(vBar(nCurrBar))
|
||||||
ElseIf vBar(nCurrBar).nCmdType = CmdTypes.GENERATE Then
|
ElseIf vBar(nCurrBar).nCmdType = CmdTypes.GENERATE Then
|
||||||
RaiseEvent Calc_ProcessEnd(Nothing, New CalcProcessEndEventArgs(vBar(nCurrBar))) 'ProcessResults(vBar(nCurrBar))
|
RaiseEvent Calc_ProcessResult(Nothing, New CalcResultEventArgs(vBar(nCurrBar))) 'ProcessResults(vBar(nCurrBar))
|
||||||
|
'RaiseEvent Calc_ProcessEnd(Nothing, New CalcProcessEndEventArgs(vBar(nCurrBar))) 'ProcessResults(vBar(nCurrBar))
|
||||||
End If
|
End If
|
||||||
bDone = True
|
bDone = True
|
||||||
nCurrBar += 1
|
nCurrBar += 1
|
||||||
@@ -177,7 +181,8 @@ Public Module CalcIntegration
|
|||||||
If vBar(vProc(j).nBar).nCmdType = CmdTypes.CHECK OrElse vBar(vProc(j).nBar).nCmdType = CmdTypes.CHECKGEN Then
|
If vBar(vProc(j).nBar).nCmdType = CmdTypes.CHECK OrElse vBar(vProc(j).nBar).nCmdType = CmdTypes.CHECKGEN Then
|
||||||
RaiseEvent Calc_ProcessResult(Nothing, New CalcResultEventArgs(vBar(vProc(j).nBar))) ' ProcessResults(vBar(vProc(j).nBar))
|
RaiseEvent Calc_ProcessResult(Nothing, New CalcResultEventArgs(vBar(vProc(j).nBar))) ' ProcessResults(vBar(vProc(j).nBar))
|
||||||
ElseIf vBar(vProc(j).nBar).nCmdType = CmdTypes.GENERATE Then
|
ElseIf vBar(vProc(j).nBar).nCmdType = CmdTypes.GENERATE Then
|
||||||
RaiseEvent Calc_ProcessEnd(Nothing, New CalcProcessEndEventArgs(vBar(vProc(j).nBar))) 'ProcessResults(vBar(nCurrBar))
|
RaiseEvent Calc_ProcessResult(Nothing, New CalcResultEventArgs(vBar(vProc(j).nBar))) ' ProcessResults(vBar(vProc(j).nBar))
|
||||||
|
'RaiseEvent Calc_ProcessEnd(Nothing, New CalcProcessEndEventArgs(vBar(vProc(j).nBar))) 'ProcessResults(vBar(nCurrBar))
|
||||||
End If
|
End If
|
||||||
bDone = True
|
bDone = True
|
||||||
vProc(j).nBar = -1
|
vProc(j).nBar = -1
|
||||||
@@ -199,7 +204,8 @@ Public Module CalcIntegration
|
|||||||
If vBar(vProc(j).nBar).nCmdType = CmdTypes.CHECK OrElse vBar(vProc(j).nBar).nCmdType = CmdTypes.CHECKGEN Then
|
If vBar(vProc(j).nBar).nCmdType = CmdTypes.CHECK OrElse vBar(vProc(j).nBar).nCmdType = CmdTypes.CHECKGEN Then
|
||||||
RaiseEvent Calc_ProcessResult(Nothing, New CalcResultEventArgs(vBar(vProc(j).nBar))) ' ProcessResults(vBar(vProc(j).nBar))
|
RaiseEvent Calc_ProcessResult(Nothing, New CalcResultEventArgs(vBar(vProc(j).nBar))) ' ProcessResults(vBar(vProc(j).nBar))
|
||||||
ElseIf vBar(vProc(j).nBar).nCmdType = CmdTypes.GENERATE Then
|
ElseIf vBar(vProc(j).nBar).nCmdType = CmdTypes.GENERATE Then
|
||||||
RaiseEvent Calc_ProcessEnd(Nothing, New CalcProcessEndEventArgs(vBar(vProc(j).nBar))) 'ProcessResults(vBar(nCurrBar))
|
RaiseEvent Calc_ProcessResult(Nothing, New CalcResultEventArgs(vBar(vProc(j).nBar))) ' ProcessResults(vBar(vProc(j).nBar))
|
||||||
|
'RaiseEvent Calc_ProcessEnd(Nothing, New CalcProcessEndEventArgs(vBar(vProc(j).nBar))) 'ProcessResults(vBar(nCurrBar))
|
||||||
End If
|
End If
|
||||||
bDone = True
|
bDone = True
|
||||||
vProc(j).nBar = -1
|
vProc(j).nBar = -1
|
||||||
@@ -260,6 +266,7 @@ Public Module CalcIntegration
|
|||||||
Result = CalcEndEventArgs.Results.OK
|
Result = CalcEndEventArgs.Results.OK
|
||||||
End If
|
End If
|
||||||
RaiseEvent Calc_Ended(Nothing, New CalcEndEventArgs(CmdTypes.EDIT, Result))
|
RaiseEvent Calc_Ended(Nothing, New CalcEndEventArgs(CmdTypes.EDIT, Result))
|
||||||
|
Return
|
||||||
Else
|
Else
|
||||||
' Dialog con Progress Bar
|
' Dialog con Progress Bar
|
||||||
nDoneBar += 1
|
nDoneBar += 1
|
||||||
@@ -349,26 +356,27 @@ Public Module CalcIntegration
|
|||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Function CreateNewProjectFromMachGroup(nMachGroupId As Integer, sProjDirPath As String) As String
|
Private Function CreateNewProjectFromMachGroup(nMachGroupId As Integer, sProjDirPath As String) As String
|
||||||
|
If Not m_bIsSupervisor Then
|
||||||
' Aggiorno identificativi per segnalazione errori
|
' Aggiorno identificativi per segnalazione errori
|
||||||
Dim nOldMachGroup As Integer = EgtGetCurrMachGroup()
|
Dim nOldMachGroup As Integer = EgtGetCurrMachGroup()
|
||||||
If nMachGroupId <> nOldMachGroup Then EgtSetCurrMachGroup(nMachGroupId)
|
If nMachGroupId <> nOldMachGroup Then EgtSetCurrMachGroup(nMachGroupId)
|
||||||
Dim nRawId As Integer = EgtGetFirstRawPart()
|
Dim nRawId As Integer = EgtGetFirstRawPart()
|
||||||
While nRawId <> GDB_ID.NULL
|
While nRawId <> GDB_ID.NULL
|
||||||
If EgtVerifyRawPartPhase(nRawId, 1) Then
|
If EgtVerifyRawPartPhase(nRawId, 1) Then
|
||||||
Dim nPartId As Integer = EgtGetFirstPartInRawPart(nRawId)
|
Dim nPartId As Integer = EgtGetFirstPartInRawPart(nRawId)
|
||||||
While nPartId <> GDB_ID.NULL
|
While nPartId <> GDB_ID.NULL
|
||||||
UpdateCutIdAndTaskId(nPartId)
|
UpdateCutIdAndTaskId(nPartId)
|
||||||
nPartId = EgtGetNextPartInRawPart(nPartId)
|
nPartId = EgtGetNextPartInRawPart(nPartId)
|
||||||
End While
|
End While
|
||||||
End If
|
End If
|
||||||
nRawId = EgtGetNextRawPart(nRawId)
|
nRawId = EgtGetNextRawPart(nRawId)
|
||||||
End While
|
End While
|
||||||
If nMachGroupId <> nOldMachGroup Then
|
If nMachGroupId <> nOldMachGroup Then
|
||||||
If nOldMachGroup <> GDB_ID.NULL Then
|
If nOldMachGroup <> GDB_ID.NULL Then
|
||||||
EgtSetCurrMachGroup(nOldMachGroup)
|
EgtSetCurrMachGroup(nOldMachGroup)
|
||||||
Else
|
Else
|
||||||
EgtResetCurrMachGroup()
|
EgtResetCurrMachGroup()
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|||||||
@@ -126,6 +126,8 @@
|
|||||||
|
|
||||||
' layer per assemblato
|
' layer per assemblato
|
||||||
Public Const ASSEBASE As String = "AsseBase"
|
Public Const ASSEBASE As String = "AsseBase"
|
||||||
|
' info parametri assemblato
|
||||||
|
Public Const BTL_ASSEBASE_N As String = "N"
|
||||||
|
|
||||||
' info parametri BTL
|
' info parametri BTL
|
||||||
Public Const BTL_PRT_PROJ As String = "PROJ"
|
Public Const BTL_PRT_PROJ As String = "PROJ"
|
||||||
@@ -284,6 +286,7 @@
|
|||||||
Public Const WRH_CURRENT As String = "Current"
|
Public Const WRH_CURRENT As String = "Current"
|
||||||
Public Const WRH_STARTOFFSET As String = "StartOffset"
|
Public Const WRH_STARTOFFSET As String = "StartOffset"
|
||||||
Public Const WRH_OFFSET As String = "Offset"
|
Public Const WRH_OFFSET As String = "Offset"
|
||||||
|
Public Const WRH_RANGE As String = "Range"
|
||||||
Public Const WRH_QUANTITY As String = "Quantity"
|
Public Const WRH_QUANTITY As String = "Quantity"
|
||||||
Public Const WRH_L As String = "L"
|
Public Const WRH_L As String = "L"
|
||||||
Public Const WRH_KERF As String = "Kerf"
|
Public Const WRH_KERF As String = "Kerf"
|
||||||
@@ -296,4 +299,7 @@
|
|||||||
Public Const EXP_PART As String = "ImportExport"
|
Public Const EXP_PART As String = "ImportExport"
|
||||||
Public Const EXP_MACHINE As String = "Machine"
|
Public Const EXP_MACHINE As String = "Machine"
|
||||||
|
|
||||||
|
' parametri modifica percorsi free contour
|
||||||
|
Public Const PATH_SIDEANGLAYER As String = "SideAngLayer"
|
||||||
|
|
||||||
End Module
|
End Module
|
||||||
|
|||||||
@@ -4,11 +4,16 @@
|
|||||||
Public Const COL_VALUE As String = "colVALUE"
|
Public Const COL_VALUE As String = "colVALUE"
|
||||||
Public Const COL_CUSTOM As String = "colCUSTOM"
|
Public Const COL_CUSTOM As String = "colCUSTOM"
|
||||||
Public Const COL_STARTCUT As String = "colSTARTCUT"
|
Public Const COL_STARTCUT As String = "colSTARTCUT"
|
||||||
|
Public Const COL_W As String = "colW"
|
||||||
|
Public Const COL_L As String = "colL"
|
||||||
Public Const COL_ROT As String = "colROT"
|
Public Const COL_ROT As String = "colROT"
|
||||||
Public Const COL_FLIP As String = "colFLIP"
|
Public Const COL_FLIP As String = "colFLIP"
|
||||||
Public Const COL_POSX As String = "colPOSX"
|
Public Const COL_POSX As String = "colPOSX"
|
||||||
Public Const COL_POSY As String = "colPOSY"
|
Public Const COL_POSY As String = "colPOSY"
|
||||||
Public Const COL_OFFSET As String = "colOFFSET"
|
Public Const COL_OFFSET As String = "colOFFSET"
|
||||||
Public Const COL_REDO As String = "colREDO"
|
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"
|
||||||
|
|
||||||
End Module
|
End Module
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
Public Const S_PARTINRAWPARTLIST_WALL As String = "DG_PartInRawPartList_WALL"
|
Public Const S_PARTINRAWPARTLIST_WALL As String = "DG_PartInRawPartList_WALL"
|
||||||
Public Const S_PARAMETERLIST_P As String = "DG_ParameterList_P"
|
Public Const S_PARAMETERLIST_P As String = "DG_ParameterList_P"
|
||||||
Public Const S_PARAMETERLIST_Q As String = "DG_ParameterList_Q"
|
Public Const S_PARAMETERLIST_Q As String = "DG_ParameterList_Q"
|
||||||
|
Public Const S_DUPLOPARAMETERLIST_Q As String = "DG_DuploParameterList_Q"
|
||||||
Public Const S_RAWPARTLIST_SUPERVISOR As String = "DG_RawPartList_SUPERVISOR"
|
Public Const S_RAWPARTLIST_SUPERVISOR As String = "DG_RawPartList_SUPERVISOR"
|
||||||
Public Const S_PARTINRAWPARTLIST_SUPERVISOR As String = "DG_PartInRawPartList_SUPERVISOR"
|
Public Const S_PARTINRAWPARTLIST_SUPERVISOR As String = "DG_PartInRawPartList_SUPERVISOR"
|
||||||
Public Const S_FEATUREINPARTINRAWPARTLIST_SUPERVISOR As String = "DG_FeatureInPartInRawPartList_SUPERVISOR"
|
Public Const S_FEATUREINPARTINRAWPARTLIST_SUPERVISOR As String = "DG_FeatureInPartInRawPartList_SUPERVISOR"
|
||||||
@@ -26,5 +27,9 @@
|
|||||||
Public Const S_SECTXMATLIST_WALL As String = "DG_SectXMatList_WALL"
|
Public Const S_SECTXMATLIST_WALL As String = "DG_SectXMatList_WALL"
|
||||||
Public Const S_VARIABLESLIST As String = "DG_VariablesList"
|
Public Const S_VARIABLESLIST As String = "DG_VariablesList"
|
||||||
Public Const S_MDICOMMANDS As String = "DG_MDICommands"
|
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"
|
||||||
|
|
||||||
End Module
|
End Module
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ Public Module ConstGen
|
|||||||
NESTING_AUTO = 4
|
NESTING_AUTO = 4
|
||||||
SUPERVISOR = 8
|
SUPERVISOR = 8
|
||||||
NETWORK = 16
|
NETWORK = 16
|
||||||
|
ANY_DB = 32
|
||||||
End Enum
|
End Enum
|
||||||
|
|
||||||
' File di log generale
|
' File di log generale
|
||||||
|
|||||||
@@ -21,19 +21,29 @@ Public Module ConstIni
|
|||||||
'Public Const K_USERLEVEL As String = "UserLevel"
|
'Public Const K_USERLEVEL As String = "UserLevel"
|
||||||
'Public Const K_MAXINST As String = "MaxInstances"
|
'Public Const K_MAXINST As String = "MaxInstances"
|
||||||
Public Const K_MAXCAMINST As String = "MaxCamInstances"
|
Public Const K_MAXCAMINST As String = "MaxCamInstances"
|
||||||
'Public Const K_INSTANCES As String = "Instances"
|
Public Const K_VIEWOPTIM_INSTANCES As String = "ViewOptimInstances"
|
||||||
|
Public Const K_SUPERVISOR_INSTANCES As String = "SupervisorInstances"
|
||||||
'Public Const K_COMMANDLOG As String = "CommandLog"
|
'Public Const K_COMMANDLOG As String = "CommandLog"
|
||||||
'Public Const K_MESSAGESDIR As String = "MessagesDir"
|
'Public Const K_MESSAGESDIR As String = "MessagesDir"
|
||||||
'Public Const K_MESSAGES As String = "Messages"
|
'Public Const K_MESSAGES As String = "Messages"
|
||||||
'Public Const K_WINPLACE As String = "WinPlace"
|
'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_LASTPROJ As String = "LastProj"
|
||||||
'Public Const K_AUTOLOADLASTPROJ As String = "AutoLoadLastProj"
|
'Public Const K_AUTOLOADLASTPROJ As String = "AutoLoadLastProj"
|
||||||
Public Const K_LASTIMPDIR As String = "LastImpDir"
|
Public Const K_LASTIMPDIR As String = "LastImpDir"
|
||||||
|
Public Const K_LASTNGEXPDIR As String = "LastNgexpDir"
|
||||||
|
Public Const K_LASTUPDATEDIR As String = "LastUpdateDir"
|
||||||
Public Const K_PROJSINDEX As String = "ProjsIndex"
|
Public Const K_PROJSINDEX As String = "ProjsIndex"
|
||||||
Public Const K_PRODSINDEX As String = "ProdsIndex"
|
Public Const K_PRODSINDEX As String = "ProdsIndex"
|
||||||
'Public Const K_SUPPORT As String = "Support"
|
'Public Const K_SUPPORT As String = "Support"
|
||||||
Public Const K_WAREHOUSE As String = "Warehouse"
|
|
||||||
Public Const K_DBADDRESS As String = "DbAddress"
|
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 S_LANGUAGES As String = "Languages"
|
'Public Const S_LANGUAGES As String = "Languages"
|
||||||
'Public Const K_LANGUAGE As String = "Language"
|
'Public Const K_LANGUAGE As String = "Language"
|
||||||
@@ -91,6 +101,7 @@ Public Module ConstIni
|
|||||||
'Public Const K_CURRMACH As String = "CurrMach"
|
'Public Const K_CURRMACH As String = "CurrMach"
|
||||||
Public Const K_SUPERVISORMACH As String = "SupervisorMach"
|
Public Const K_SUPERVISORMACH As String = "SupervisorMach"
|
||||||
Public Const K_PASSWORD As String = "Password"
|
Public Const K_PASSWORD As String = "Password"
|
||||||
|
Public Const K_CHANGEMACH As String = "ChangeMach"
|
||||||
|
|
||||||
'Public Const S_SIMUL As String = "Simul"
|
'Public Const S_SIMUL As String = "Simul"
|
||||||
'Public Const K_SLIDERX As String = "SliderX"
|
'Public Const K_SLIDERX As String = "SliderX"
|
||||||
@@ -133,4 +144,8 @@ Public Module ConstIni
|
|||||||
Public Const S_BEAM_LIST As String = "Beam_List"
|
Public Const S_BEAM_LIST As String = "Beam_List"
|
||||||
Public Const S_WALL_LIST As String = "Wall_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
|
End Module
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
Public Module ConstMachIni
|
Public Module ConstMachIni
|
||||||
|
|
||||||
Public Const MACH_INI_FILE_NAME As String = "MachData.ini"
|
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 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_NCTYPE As String = "NCType"
|
||||||
|
Public Const K_CONNECTIONSTRING As String = "ConnectionString"
|
||||||
|
|
||||||
Public Const S_CHANNELS As String = "Channels"
|
Public Const S_CHANNELS As String = "Channels"
|
||||||
|
|
||||||
|
|||||||
@@ -47,18 +47,17 @@
|
|||||||
<OptionInfer>On</OptionInfer>
|
<OptionInfer>On</OptionInfer>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="EgtUILib, Version=2.3.6.2, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="EgtUILib">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<HintPath>..\ExtLibs\EgtUILib.dll</HintPath>
|
||||||
<HintPath>..\..\..\EgtProg\Dll32\EgtUILib.dll</HintPath>
|
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="EgtWPFLib5, Version=2.3.4.3, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="EgtWPFLib5">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<HintPath>..\ExtLibs\EgtWPFLib5.dll</HintPath>
|
||||||
<HintPath>..\..\..\..\..\..\EgtProg\Dll32\EgtWPFLib5.dll</HintPath>
|
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="PresentationCore" />
|
<Reference Include="PresentationCore" />
|
||||||
<Reference Include="PresentationFramework" />
|
<Reference Include="PresentationFramework" />
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Drawing" />
|
||||||
<Reference Include="System.Windows.Forms" />
|
<Reference Include="System.Windows.Forms" />
|
||||||
<Reference Include="System.Xaml" />
|
<Reference Include="System.Xaml" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
@@ -108,12 +107,18 @@
|
|||||||
<Compile Include="BTLModel\BTLPartM.vb" />
|
<Compile Include="BTLModel\BTLPartM.vb" />
|
||||||
<Compile Include="BTLModel\BTLStructureM.vb" />
|
<Compile Include="BTLModel\BTLStructureM.vb" />
|
||||||
<Compile Include="Constants\ConstBeam.vb" />
|
<Compile Include="Constants\ConstBeam.vb" />
|
||||||
|
<Compile Include="LoadingWnd\LoadingWndHelper.vb" />
|
||||||
|
<Compile Include="LoadingWnd\LoadingWndV.xaml.vb">
|
||||||
|
<DependentUpon>LoadingWndV.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="LoadingWnd\LoadingWndVM.vb" />
|
||||||
<Compile Include="Utility\DimensionsIniFile.vb" />
|
<Compile Include="Utility\DimensionsIniFile.vb" />
|
||||||
<Compile Include="Utility\Enum.vb" />
|
<Compile Include="Utility\Enum.vb" />
|
||||||
<Compile Include="MachGroupPanel\MyMachGroupPanelVM.vb" />
|
<Compile Include="MachGroupPanel\MyMachGroupPanelVM.vb" />
|
||||||
<Compile Include="MachGroupPanel\MyMachGroupVM.vb" />
|
<Compile Include="MachGroupPanel\MyMachGroupVM.vb" />
|
||||||
<Compile Include="MachGroupPanel\PartVM.vb" />
|
<Compile Include="MachGroupPanel\PartVM.vb" />
|
||||||
<Compile Include="Utility\GridDimension.vb" />
|
<Compile Include="Utility\GridDimension.vb" />
|
||||||
|
<Compile Include="Utility\LuaMsgManager.vb" />
|
||||||
<Compile Include="Utility\MachLog.vb" />
|
<Compile Include="Utility\MachLog.vb" />
|
||||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||||
<Compile Include="My Project\Application.Designer.vb">
|
<Compile Include="My Project\Application.Designer.vb">
|
||||||
@@ -135,6 +140,7 @@
|
|||||||
<Compile Include="Lib\MachGroupM.vb" />
|
<Compile Include="Lib\MachGroupM.vb" />
|
||||||
<Compile Include="Lib\MachGroupPanelM.vb" />
|
<Compile Include="Lib\MachGroupPanelM.vb" />
|
||||||
<Compile Include="MachGroupModel\MyMachGroupPanelM.vb" />
|
<Compile Include="MachGroupModel\MyMachGroupPanelM.vb" />
|
||||||
|
<Compile Include="Utility\ManageWindow.vb" />
|
||||||
<Compile Include="Utility\MyMachine.vb" />
|
<Compile Include="Utility\MyMachine.vb" />
|
||||||
<Compile Include="OpenProjectFileDialog\OpenProjectFileDialogV.xaml.vb">
|
<Compile Include="OpenProjectFileDialog\OpenProjectFileDialogV.xaml.vb">
|
||||||
<DependentUpon>OpenProjectFileDialogV.xaml</DependentUpon>
|
<DependentUpon>OpenProjectFileDialogV.xaml</DependentUpon>
|
||||||
@@ -180,6 +186,10 @@
|
|||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="LoadingWnd\LoadingWndV.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>XamlIntelliSenseFileGenerator</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="OpenProjectFileDialog\OpenProjectFileDialogV.xaml">
|
<Page Include="OpenProjectFileDialog\OpenProjectFileDialogV.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
Imports System.Collections.ObjectModel
|
Imports System.Collections.ObjectModel
|
||||||
Imports System.Windows.Controls
|
Imports System.Windows.Controls
|
||||||
|
Imports System.Windows.Forms
|
||||||
Imports EgtUILib
|
Imports EgtUILib
|
||||||
Imports EgtWPFLib5
|
Imports EgtWPFLib5
|
||||||
|
|
||||||
@@ -31,7 +32,8 @@ Public Module DataGridColumnsIniFile
|
|||||||
Integer.TryParse(sColumnParams(6), WidthType)
|
Integer.TryParse(sColumnParams(6), WidthType)
|
||||||
Dim bVisible As Boolean = sColumnParams(7).Equals("1")
|
Dim bVisible As Boolean = sColumnParams(7).Equals("1")
|
||||||
Dim bCanUserEditVisible As Boolean = sColumnParams(8).Equals("1")
|
Dim bCanUserEditVisible As Boolean = sColumnParams(8).Equals("1")
|
||||||
ocColumns.Add(New EgtDataGridColumn(ParentDGName, sName, bReorder, bResize, bSort, bIsReadOnly, New DataGridLength(Width, WidthType), bVisible, bCanUserEditVisible))
|
Dim nSortDirection As SortOrder = If(sColumnParams.Count >= 10, CInt(sColumnParams(9)), 0)
|
||||||
|
ocColumns.Add(New EgtDataGridColumn(ParentDGName, sName, bReorder, bResize, bSort, bIsReadOnly, New DataGridLength(Width, WidthType), bVisible, bCanUserEditVisible, nSortDirection))
|
||||||
End If
|
End If
|
||||||
colIndex += 1
|
colIndex += 1
|
||||||
End While
|
End While
|
||||||
@@ -67,7 +69,8 @@ Public Module DataGridColumnsIniFile
|
|||||||
Integer.TryParse(sColumnParams(6), WidthType)
|
Integer.TryParse(sColumnParams(6), WidthType)
|
||||||
Dim bVisible As Boolean = sColumnParams(7).Equals("1")
|
Dim bVisible As Boolean = sColumnParams(7).Equals("1")
|
||||||
Dim bCanUserEditVisible As Boolean = sColumnParams(8).Equals("1")
|
Dim bCanUserEditVisible As Boolean = sColumnParams(8).Equals("1")
|
||||||
Column = New EgtDataGridColumn(ParentDGName, sName, bReorder, bResize, bSort, bIsReadOnly, New DataGridLength(Width, WidthType), bVisible, bCanUserEditVisible)
|
Dim nSortDirection As SortOrder = If(sColumnParams.Count >= 10, CInt(sColumnParams(9)), 0)
|
||||||
|
Column = New EgtDataGridColumn(ParentDGName, sName, bReorder, bResize, bSort, bIsReadOnly, New DataGridLength(Width, WidthType), bVisible, bCanUserEditVisible, nSortDirection)
|
||||||
Exit While
|
Exit While
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|||||||
@@ -2,12 +2,16 @@
|
|||||||
x:Name="CurrDataGrid"
|
x:Name="CurrDataGrid"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
<DataGrid.ColumnHeaderStyle>
|
<DataGrid.ColumnHeaderStyle>
|
||||||
<Style TargetType="DataGridColumnHeader">
|
<Style TargetType="DataGridColumnHeader">
|
||||||
<EventSetter Event="SizeChanged" Handler="Cell_SizedChanged" />
|
<Setter Property="HorizontalContentAlignment"
|
||||||
<EventSetter Event="FrameworkElement.Loaded" Handler="DataGridColumnHeader_Loaded"/>
|
Value="Stretch" />
|
||||||
</Style>
|
<EventSetter Event="SizeChanged"
|
||||||
</DataGrid.ColumnHeaderStyle>
|
Handler="Cell_SizedChanged" />
|
||||||
|
<EventSetter Event="MouseRightButtonDown"
|
||||||
|
Handler="Cell_MouseRightButtonDown" />
|
||||||
|
</Style>
|
||||||
|
</DataGrid.ColumnHeaderStyle>
|
||||||
|
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
Imports System.Collections.ObjectModel
|
Imports System.Collections.ObjectModel
|
||||||
Imports System.Collections.Specialized
|
Imports System.Collections.Specialized
|
||||||
|
Imports System.ComponentModel
|
||||||
Imports System.Windows
|
Imports System.Windows
|
||||||
Imports System.Windows.Controls
|
Imports System.Windows.Controls
|
||||||
|
Imports System.Windows.Data
|
||||||
Imports System.Windows.Controls.Primitives
|
Imports System.Windows.Controls.Primitives
|
||||||
Imports System.Windows.Input
|
Imports System.Windows.Input
|
||||||
Imports System.Windows.Media
|
Imports System.Windows.Media
|
||||||
@@ -10,6 +12,16 @@ Imports EgtWPFLib5
|
|||||||
|
|
||||||
Public Class EgtDataGrid
|
Public Class EgtDataGrid
|
||||||
|
|
||||||
|
' vecchio indice da salvare per il Reorder delle colonne
|
||||||
|
Public OldIndex As Integer = 0
|
||||||
|
' indice header su cui è aperto il ContextMenu per gestione check/uncheck LockTable
|
||||||
|
Private HeaderDispIndex As Integer = 0
|
||||||
|
' somma delle larghezze delle colonne di EgtDataGrid
|
||||||
|
Private columnsWidth As Double = 0
|
||||||
|
|
||||||
|
' larghezza minima dell'ultima colonna per attivare/disattivare ScrollBar orizzontale
|
||||||
|
Private Const LASTCOLUMN_MINWIDTH As Double = 40
|
||||||
|
|
||||||
Sub New()
|
Sub New()
|
||||||
InitializeComponent()
|
InitializeComponent()
|
||||||
End Sub
|
End Sub
|
||||||
@@ -119,7 +131,127 @@ Public Class EgtDataGrid
|
|||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public OldIndex As Integer = 0
|
Private Sub DataGrid_SizedChanged(sender As Object, e As SizeChangedEventArgs) Handles CurrDataGrid.SizeChanged
|
||||||
|
' confronto la larghezza effettiva della EgtDataGrid con la somma delle larghezze delle colonne
|
||||||
|
UpdateColumnsWidth()
|
||||||
|
If BindingColumns.Count > 0 Then
|
||||||
|
If CurrDataGrid.ActualWidth - LASTCOLUMN_MINWIDTH > columnsWidth Then
|
||||||
|
' nascondo la ScrollBar orizzontale e setto lo UnitType dell'ultima colonna visibile a Star
|
||||||
|
ScrollViewer.SetHorizontalScrollBarVisibility(CurrDataGrid, ScrollBarVisibility.Hidden)
|
||||||
|
BindingColumns.Last(Function(x) x.Visible = True).Width = New DataGridLength(1, DataGridLengthUnitType.Star)
|
||||||
|
Else
|
||||||
|
' mostro la ScrollBar orizzontale e se UnitType delle colonne è Star lo setto a Pixel
|
||||||
|
ScrollViewer.SetHorizontalScrollBarVisibility(CurrDataGrid, ScrollBarVisibility.Visible)
|
||||||
|
For Each bc In BindingColumns
|
||||||
|
If bc.Width.IsStar Then
|
||||||
|
bc.Width = New DataGridLength(bc.ActualWidth, DataGridLengthUnitType.Pixel)
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
' scrivo nell'INI la Width dell'ultima colonna visibile
|
||||||
|
BindingColumns.Last(Function(x) x.Visible = True).SaveDataGridColumn()
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Sub UpdateColumnsWidth()
|
||||||
|
' ricalcolo la somma delle larghezze delle colonne visibili
|
||||||
|
columnsWidth = 0
|
||||||
|
For Each col In BindingColumns
|
||||||
|
If col.ColumnVisibility = Visibility.Visible Then
|
||||||
|
columnsWidth += col.ActualWidth
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
' alla somma calcolata tolgo la larghezza dell'ultima colonna visibile e aggiungo LASTCOLUMN_MINWIDTH
|
||||||
|
' (in questo modo si attiva/disattiva la ScrollBar orizzontale non appena l'ultima colonna viene ristretta/estesa a LASTCOLUMN_MINWIDTH px)
|
||||||
|
If BindingColumns.Count > 0 AndAlso
|
||||||
|
BindingColumns.Any(Function(x) x.Visible = True) Then
|
||||||
|
columnsWidth = columnsWidth - BindingColumns.Last(Function(x) x.Visible = True).ActualWidth + LASTCOLUMN_MINWIDTH
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub Cell_MouseRightButtonDown(sender As Object, e As RoutedEventArgs)
|
||||||
|
Dim nDispIndex As Integer = sender.DisplayIndex
|
||||||
|
' creo il ContextMenu con gli item checkabili
|
||||||
|
Dim cm As ContextMenu = New ContextMenu()
|
||||||
|
Dim miReorder As MenuItem = New MenuItem()
|
||||||
|
Dim miResize As MenuItem = New MenuItem()
|
||||||
|
Dim miSort As MenuItem = New MenuItem()
|
||||||
|
Dim sep1 As Separator = New Separator()
|
||||||
|
Dim miVis As MenuItem = New MenuItem()
|
||||||
|
Dim sep2 As Separator = New Separator()
|
||||||
|
Dim miLock As MenuItem = New MenuItem()
|
||||||
|
Dim miResetSort As MenuItem = New MenuItem()
|
||||||
|
miReorder.Header = NameOf(EgtDataGridColumn.CanUserReorder)
|
||||||
|
miResize.Header = NameOf(EgtDataGridColumn.CanUserResize)
|
||||||
|
miSort.Header = NameOf(EgtDataGridColumn.CanUserSort)
|
||||||
|
miVis.Header = "Columns Visibility"
|
||||||
|
miLock.Header = "Lock Table"
|
||||||
|
miResetSort.Header = "Reset Sort"
|
||||||
|
miReorder.IsCheckable = True
|
||||||
|
miResize.IsCheckable = True
|
||||||
|
miSort.IsCheckable = True
|
||||||
|
miLock.IsCheckable = True
|
||||||
|
miResetSort.IsCheckable = False
|
||||||
|
miReorder.StaysOpenOnClick = True
|
||||||
|
miResize.StaysOpenOnClick = True
|
||||||
|
miSort.StaysOpenOnClick = True
|
||||||
|
miLock.StaysOpenOnClick = True
|
||||||
|
miResetSort.StaysOpenOnClick = True
|
||||||
|
' setto il binding
|
||||||
|
Dim miReorderBinding As Binding = New Binding(NameOf(EgtDataGridColumn.CanUserReorder))
|
||||||
|
Dim miResizeBinding As Binding = New Binding(NameOf(EgtDataGridColumn.CanUserResize))
|
||||||
|
Dim miSortBinding As Binding = New Binding(NameOf(EgtDataGridColumn.CanUserSort))
|
||||||
|
miReorderBinding.Mode = BindingMode.TwoWay
|
||||||
|
miResizeBinding.Mode = BindingMode.TwoWay
|
||||||
|
miSortBinding.Mode = BindingMode.TwoWay
|
||||||
|
miReorder.DataContext = BindingColumns(nDispIndex)
|
||||||
|
miResize.DataContext = BindingColumns(nDispIndex)
|
||||||
|
miSort.DataContext = BindingColumns(nDispIndex)
|
||||||
|
miReorder.SetBinding(MenuItem.IsCheckedProperty, miReorderBinding)
|
||||||
|
miResize.SetBinding(MenuItem.IsCheckedProperty, miResizeBinding)
|
||||||
|
miSort.SetBinding(MenuItem.IsCheckedProperty, miSortBinding)
|
||||||
|
' setto check e enable associati a LockTable
|
||||||
|
miLock.IsChecked = (GetPrivateProfileInt(BindingColumns(nDispIndex).ParentDataGridName, K_LOCKTABLE, 0, m_sDataGridColumnsIniFile) > 0)
|
||||||
|
miReorder.IsChecked = If(miLock.IsChecked, False, BindingColumns(nDispIndex).CanUserReorder)
|
||||||
|
miResize.IsChecked = If(miLock.IsChecked, False, BindingColumns(nDispIndex).CanUserResize)
|
||||||
|
miReorder.IsEnabled = Not miLock.IsChecked
|
||||||
|
miResize.IsEnabled = Not miLock.IsChecked
|
||||||
|
HeaderDispIndex = nDispIndex
|
||||||
|
AddHandler miLock.Checked, AddressOf miLock_Checked
|
||||||
|
AddHandler miLock.Unchecked, AddressOf miLock_Unchecked
|
||||||
|
AddHandler miResetSort.Click, AddressOf miResetSort_Click
|
||||||
|
' aggiungo i MenuItem al ContextMenu
|
||||||
|
cm.Items.Add(miReorder)
|
||||||
|
cm.Items.Add(miResize)
|
||||||
|
cm.Items.Add(miSort)
|
||||||
|
cm.Items.Add(sep1)
|
||||||
|
cm.Items.Add(miVis)
|
||||||
|
cm.Items.Add(sep2)
|
||||||
|
cm.Items.Add(miLock)
|
||||||
|
cm.Items.Add(miResetSort)
|
||||||
|
' creo e aggiungo gli item figli di Columns Visibility
|
||||||
|
For Each Column In BindingColumns
|
||||||
|
Dim mi As MenuItem = New MenuItem()
|
||||||
|
mi.Header = Column.Name
|
||||||
|
mi.IsCheckable = True
|
||||||
|
Dim miBinding As Binding = New Binding(NameOf(EgtDataGridColumn.Visible))
|
||||||
|
miBinding.Mode = BindingMode.TwoWay
|
||||||
|
mi.DataContext = Column
|
||||||
|
mi.SetBinding(MenuItem.IsCheckedProperty, miBinding)
|
||||||
|
mi.StaysOpenOnClick = True
|
||||||
|
mi.IsEnabled = Column.CanUserEditVisible
|
||||||
|
miVis.Items.Add(mi)
|
||||||
|
Next
|
||||||
|
' disabilito Columns Visibility se tutti i suoi figli sono disabilitati
|
||||||
|
Dim bIsEnabled As Boolean = False
|
||||||
|
For Each visMenuItem In miVis.Items
|
||||||
|
bIsEnabled = visMenuItem.IsEnabled
|
||||||
|
Next
|
||||||
|
cm.Items(4).IsEnabled = bIsEnabled
|
||||||
|
|
||||||
|
cm.PlacementTarget = TryCast(sender, Button)
|
||||||
|
cm.IsOpen = True
|
||||||
|
End Sub
|
||||||
|
|
||||||
Private Sub CurrDataGrid_ColumnReordering(sender As Object, e As DataGridColumnEventArgs) Handles CurrDataGrid.ColumnReordering
|
Private Sub CurrDataGrid_ColumnReordering(sender As Object, e As DataGridColumnEventArgs) Handles CurrDataGrid.ColumnReordering
|
||||||
' conservo il vecchio indice in modo da effettuare lo scambio in BindingColumns una volta riordinate graficamente
|
' conservo il vecchio indice in modo da effettuare lo scambio in BindingColumns una volta riordinate graficamente
|
||||||
@@ -139,96 +271,99 @@ Public Class EgtDataGrid
|
|||||||
Next
|
Next
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Const LEFT As String = "PART_LeftHeaderGripper"
|
Private Sub miLock_Checked(sender As Object, e As RoutedEventArgs)
|
||||||
Private Const RIGHT As String = "PART_RightHeaderGripper"
|
Dim miLock = DirectCast(sender, MenuItem)
|
||||||
Private startPoint As Point
|
' disabilito Reorder e Resize di tutte le colonne salvandone prima il valore
|
||||||
Private startWidth As Double
|
For Each Column In BindingColumns
|
||||||
Private adjacentStartWidth As Double
|
Column.OldCanUserReorder = Column.CanUserReorder
|
||||||
'Private startUnitType As DataGridLengthUnitType
|
Column.OldCanUserResize = Column.CanUserResize
|
||||||
'Private adjacentUnitType As DataGridLengthUnitType
|
Column.CanUserReorder = False
|
||||||
Private targetColumn As DataGridColumn
|
Column.CanUserResize = False
|
||||||
Private adjacentColumn As DataGridColumn
|
Next
|
||||||
|
' aggiorno il ContextMenu correntemente aperto
|
||||||
Private Sub DataGridColumnHeader_Loaded(sender As Object, e As RoutedEventArgs)
|
Dim miReorder As MenuItem = TryCast(miLock.Parent, ContextMenu).Items(0)
|
||||||
Dim header = DirectCast(sender, DataGridColumnHeader)
|
Dim miResize As MenuItem = TryCast(miLock.Parent, ContextMenu).Items(1)
|
||||||
|
miReorder.IsChecked = False
|
||||||
Dim thumbLeft As Thumb = header.Template.FindName(LEFT, header)
|
miResize.IsChecked = False
|
||||||
thumbLeft.AddHandler(Thumb.DragStartedEvent, CType(AddressOf Thumb_DragStarted, DragStartedEventHandler), True) ' thumbLeft.AddHandler(Thumb.DragStartedEvent, New DragStartedEventHandler(AddressOf Thumb_DragStarted), True)
|
miReorder.IsEnabled = False
|
||||||
thumbLeft.AddHandler(Thumb.DragCompletedEvent, CType(AddressOf Thumb_DragCompleted, DragCompletedEventHandler), True)
|
miResize.IsEnabled = False
|
||||||
|
' scrivo il valore di LockTable nell'INI
|
||||||
Dim thumbRight As Thumb = header.Template.FindName(RIGHT, header)
|
WritePrivateProfileString(BindingColumns(HeaderDispIndex).ParentDataGridName, K_LOCKTABLE, 1, m_sDataGridColumnsIniFile)
|
||||||
thumbRight.AddHandler(Thumb.DragStartedEvent, CType(AddressOf Thumb_DragStarted, DragStartedEventHandler), True) ' thumbRight.AddHandler(Thumb.DragStartedEvent, New DragStartedEventHandler(AddressOf Thumb_DragStarted), True)
|
|
||||||
thumbRight.AddHandler(Thumb.DragCompletedEvent, CType(AddressOf Thumb_DragCompleted, DragCompletedEventHandler), True)
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub Thumb_DragStarted(sender As Object, e As DragStartedEventArgs)
|
Private Sub miLock_Unchecked(sender As Object, e As RoutedEventArgs)
|
||||||
Dim thumb = CType(sender, Thumb)
|
Dim miLock = DirectCast(sender, MenuItem)
|
||||||
Dim dg As DataGrid = GetParent(Of DataGrid)(thumb)
|
' abilito Reorder e Resize di tutte le colonne ripristinando il valore precedente, se presente
|
||||||
startPoint = Mouse.GetPosition(dg)
|
For Each Column In BindingColumns
|
||||||
|
If Not IsNothing(Column.OldCanUserReorder) Then Column.CanUserReorder = Column.OldCanUserReorder
|
||||||
|
If Not IsNothing(Column.OldCanUserResize) Then Column.CanUserResize = Column.OldCanUserResize
|
||||||
|
Next
|
||||||
|
' aggiorno il ContextMenu correntemente aperto
|
||||||
|
Dim miReorder As MenuItem = TryCast(miLock.Parent, ContextMenu).Items(0)
|
||||||
|
Dim miResize As MenuItem = TryCast(miLock.Parent, ContextMenu).Items(1)
|
||||||
|
miReorder.IsChecked = If(IsNothing(BindingColumns(HeaderDispIndex).OldCanUserReorder), BindingColumns(HeaderDispIndex).CanUserReorder, BindingColumns(HeaderDispIndex).OldCanUserReorder)
|
||||||
|
miResize.IsChecked = If(IsNothing(BindingColumns(HeaderDispIndex).OldCanUserResize), BindingColumns(HeaderDispIndex).CanUserResize, BindingColumns(HeaderDispIndex).OldCanUserResize)
|
||||||
|
miReorder.IsEnabled = True
|
||||||
|
miResize.IsEnabled = True
|
||||||
|
' scrivo il valore di LockTable nell'INI
|
||||||
|
WritePrivateProfileString(BindingColumns(HeaderDispIndex).ParentDataGridName, K_LOCKTABLE, 0, m_sDataGridColumnsIniFile)
|
||||||
|
End Sub
|
||||||
|
|
||||||
Dim header As DataGridColumnHeader = GetParent(Of DataGridColumnHeader)(thumb)
|
Private Sub miResetSort_Click(sender As Object, e As RoutedEventArgs)
|
||||||
|
' resetto le SortDirection di tutte le colonne della datagrid
|
||||||
|
ResetSortDirections()
|
||||||
|
End Sub
|
||||||
|
|
||||||
If thumb.Name = RIGHT Then
|
Private Sub CurrDataGrid_Loaded(sender As Object, e As RoutedEventArgs) Handles CurrDataGrid.Loaded
|
||||||
targetColumn = header.Column
|
' setto la SortDirection, se attiva, sulla colonna su cui è attiva
|
||||||
Dim Index As Integer = header.Column.DisplayIndex + 1
|
Dim colIndex As Integer = 0
|
||||||
If (Index < BindingColumns.Count) Then
|
For Each col In BindingColumns
|
||||||
adjacentColumn = dg.Columns.FirstOrDefault(Function(x) x.DisplayIndex = Index)
|
If col.SortDirection > 0 Then
|
||||||
|
CurrDataGrid.Items.SortDescriptions.Add(New SortDescription(CurrDataGrid.Columns(colIndex).SortMemberPath, col.SortDirection - 1))
|
||||||
|
Exit For
|
||||||
End If
|
End If
|
||||||
|
colIndex += 1
|
||||||
|
Next
|
||||||
|
' calcolo la somma delle larghezze delle colonne visibili
|
||||||
|
For Each col In BindingColumns
|
||||||
|
If col.ColumnVisibility = Visibility.Visible Then
|
||||||
|
columnsWidth += col.ActualWidth
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub CurrDataGrid_Sorting(sender As Object, e As DataGridSortingEventArgs) Handles CurrDataGrid.Sorting
|
||||||
|
' salvo la SortDirection corrente della colonna prima di resettarla per tutte le colonne
|
||||||
|
Dim CurrSortDirection As ListSortDirection? = e.Column.SortDirection
|
||||||
|
ResetSortDirections(True)
|
||||||
|
' ora applico la SortDirection corretta
|
||||||
|
Select Case CurrSortDirection
|
||||||
|
Case ListSortDirection.Ascending
|
||||||
|
BindingColumns(e.Column.DisplayIndex).SortDirection = 2 ' la setto a Descending
|
||||||
|
Case ListSortDirection.Descending
|
||||||
|
BindingColumns(e.Column.DisplayIndex).SortDirection = 1 ' la setto a Ascending
|
||||||
|
Case Else
|
||||||
|
BindingColumns(e.Column.DisplayIndex).SortDirection = 1 ' la setto a Ascending
|
||||||
|
End Select
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub ResetSortDirections(Optional bUserClick As Boolean = False)
|
||||||
|
If bUserClick Then
|
||||||
|
' nel caso di click dell'utente sulla colonna da sortare occorre solamente settare a 0 la SortDirection di tutte le colonne
|
||||||
|
For Each column In BindingColumns
|
||||||
|
column.SortDirection = 0
|
||||||
|
Next
|
||||||
Else
|
Else
|
||||||
Dim Index As Integer = header.Column.DisplayIndex - 1
|
' altrimenti (caso ResetSort da ContextMenu) è necessatio un Clear più ampio e anche grafico
|
||||||
If (Index >= 0) Then
|
CurrDataGrid.Items.SortDescriptions.Clear()
|
||||||
adjacentColumn = dg.Columns.FirstOrDefault(Function(x) x.DisplayIndex = Index + 1)
|
For Each column In BindingColumns
|
||||||
End If
|
column.SortDirection = 0
|
||||||
targetColumn = dg.Columns.FirstOrDefault(Function(x) x.DisplayIndex = Index)
|
' resetto graficamente anche l'header della colonna
|
||||||
|
CurrDataGrid.Columns(column.DisplayIndex).SortDirection = Nothing
|
||||||
|
Next
|
||||||
End If
|
End If
|
||||||
startWidth = targetColumn.ActualWidth
|
|
||||||
'startUnitType = targetColumn.Width.UnitType
|
|
||||||
If Not IsNothing(adjacentColumn) Then
|
|
||||||
adjacentStartWidth = adjacentColumn.ActualWidth
|
|
||||||
'adjacentUnitType = adjacentColumn.Width.UnitType
|
|
||||||
End If
|
|
||||||
AddHandler thumb.PreviewMouseMove, AddressOf Thumb_PreviewMouseMove
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub Thumb_PreviewMouseMove(sender As Object, e As MouseEventArgs)
|
|
||||||
Dim thumb = CType(sender, Thumb)
|
|
||||||
If (Not thumb.IsDragging Or IsNothing(targetColumn)) Then Return
|
|
||||||
|
|
||||||
e.Handled = True
|
|
||||||
|
|
||||||
Dim dg As DataGrid = GetParent(Of DataGrid)(thumb)
|
|
||||||
Dim currentPoint As Point = Mouse.GetPosition(dg)
|
|
||||||
Dim diffX As Double = (currentPoint - startPoint).X
|
|
||||||
Dim newWidth As Double = Math.Max(targetColumn.MinWidth, Math.Min(startWidth + diffX, targetColumn.MaxWidth))
|
|
||||||
Dim length = New DataGridLength(newWidth)
|
|
||||||
|
|
||||||
targetColumn.SetValue(DataGridColumn.WidthProperty, length)
|
|
||||||
|
|
||||||
If Not IsNothing(adjacentColumn) Then
|
|
||||||
newWidth = Math.Max(adjacentColumn.MinWidth, Math.Min(adjacentStartWidth - diffX, adjacentColumn.MaxWidth))
|
|
||||||
length = New DataGridLength(newWidth)
|
|
||||||
adjacentColumn.SetValue(DataGridColumn.WidthProperty, length)
|
|
||||||
End If
|
|
||||||
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Private Sub Thumb_DragCompleted(sender As Object, e As DragCompletedEventArgs)
|
|
||||||
RemoveHandler CType(sender, Thumb).PreviewMouseMove, AddressOf Thumb_PreviewMouseMove
|
|
||||||
targetColumn = Nothing
|
|
||||||
adjacentColumn = Nothing
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Private Function GetParent(Of T As DependencyObject)(d As DependencyObject) As T
|
|
||||||
Dim tObj As T = Nothing
|
|
||||||
|
|
||||||
While IsNothing(tObj)
|
|
||||||
tObj = TryCast(d, T)
|
|
||||||
d = VisualTreeHelper.GetParent(d)
|
|
||||||
End While
|
|
||||||
|
|
||||||
Return tObj
|
|
||||||
End Function
|
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
|
|
||||||
Public Class EgtDataGridColumn
|
Public Class EgtDataGridColumn
|
||||||
@@ -269,6 +404,12 @@ Public Class EgtDataGridColumn
|
|||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
Public ReadOnly Property ActualWidth As Double
|
||||||
|
Get
|
||||||
|
Return m_dgColumn.ActualWidth
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
Private Property m_DisplayIndex As Integer
|
Private Property m_DisplayIndex As Integer
|
||||||
Public Property DisplayIndex As Integer
|
Public Property DisplayIndex As Integer
|
||||||
Get
|
Get
|
||||||
@@ -297,6 +438,7 @@ Public Class EgtDataGridColumn
|
|||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
Friend OldCanUserReorder As Boolean?
|
||||||
Private m_CanUserReorder As Boolean
|
Private m_CanUserReorder As Boolean
|
||||||
Public Property CanUserReorder As Boolean
|
Public Property CanUserReorder As Boolean
|
||||||
Get
|
Get
|
||||||
@@ -312,6 +454,7 @@ Public Class EgtDataGridColumn
|
|||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
Friend OldCanUserResize As Boolean?
|
||||||
Private m_CanUserResize As Boolean
|
Private m_CanUserResize As Boolean
|
||||||
Public Property CanUserResize As Boolean
|
Public Property CanUserResize As Boolean
|
||||||
Get
|
Get
|
||||||
@@ -363,6 +506,17 @@ Public Class EgtDataGridColumn
|
|||||||
m_ColumnVisibility = value
|
m_ColumnVisibility = value
|
||||||
If Not IsNothing(m_dgColumn) Then
|
If Not IsNothing(m_dgColumn) Then
|
||||||
m_dgColumn.Visibility = value
|
m_dgColumn.Visibility = value
|
||||||
|
' ricavo la EgtDataGrid a cui appartiene la DataGridColumn
|
||||||
|
Dim propertyInfo As Reflection.PropertyInfo = m_dgColumn.GetType().GetProperty("DataGridOwner",
|
||||||
|
Reflection.BindingFlags.Instance Or
|
||||||
|
Reflection.BindingFlags.NonPublic)
|
||||||
|
Dim dg As EgtDataGrid = propertyInfo.GetValue(m_dgColumn, Nothing)
|
||||||
|
' ogni colonna visibile con UnitType a Star tranne l'ultima verrà settata a Pixel
|
||||||
|
For Each bc In dg.BindingColumns
|
||||||
|
If bc.Width.IsStar And Not bc.Name = dg.BindingColumns.Last(Function(x) x.Visible = True).Name Then
|
||||||
|
bc.Width = New DataGridLength(bc.ActualWidth, DataGridLengthUnitType.Pixel)
|
||||||
|
End If
|
||||||
|
Next
|
||||||
End If
|
End If
|
||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
@@ -378,11 +532,30 @@ Public Class EgtDataGridColumn
|
|||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
Private m_SortDirection As Forms.SortOrder = Forms.SortOrder.None
|
||||||
|
Public Property SortDirection As Forms.SortOrder
|
||||||
|
Get
|
||||||
|
Return m_SortDirection 'If(IsNothing(m_dgColumn.SortDirection), 0, m_dgColumn.SortDirection + 1)
|
||||||
|
End Get
|
||||||
|
Set(value As Forms.SortOrder)
|
||||||
|
'If Not IsNothing(m_dgColumn) Then
|
||||||
|
' If value = 0 Then
|
||||||
|
' m_dgColumn.SortDirection = Nothing
|
||||||
|
' Else
|
||||||
|
' m_dgColumn.SortDirection = value - 1
|
||||||
|
' End If
|
||||||
|
'Else
|
||||||
|
m_SortDirection = value
|
||||||
|
'End If
|
||||||
|
SaveDataGridColumn()
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
Sub New(sName As String)
|
Sub New(sName As String)
|
||||||
m_Name = sName
|
m_Name = sName
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Sub New(sParentDG As String, sName As String, bCanUserReorder As Boolean, bCanUserResize As Boolean, bCanUserSort As Boolean, bIsReadOnly As Boolean, Width As DataGridLength, bVisible As Boolean, bCanUserEditVisible As Boolean)
|
Sub New(sParentDG As String, sName As String, bCanUserReorder As Boolean, bCanUserResize As Boolean, bCanUserSort As Boolean, bIsReadOnly As Boolean, Width As DataGridLength, bVisible As Boolean, bCanUserEditVisible As Boolean, nSortDirection As Integer)
|
||||||
m_ParentDataGridName = sParentDG
|
m_ParentDataGridName = sParentDG
|
||||||
m_Name = sName
|
m_Name = sName
|
||||||
m_CanUserReorder = bCanUserReorder
|
m_CanUserReorder = bCanUserReorder
|
||||||
@@ -392,6 +565,7 @@ Public Class EgtDataGridColumn
|
|||||||
m_Width = Width
|
m_Width = Width
|
||||||
m_Visible = bVisible
|
m_Visible = bVisible
|
||||||
m_CanUserEditVisible = bCanUserEditVisible
|
m_CanUserEditVisible = bCanUserEditVisible
|
||||||
|
m_SortDirection = nSortDirection
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Friend Sub InitColumn(dgColumn As DataGridColumn)
|
Friend Sub InitColumn(dgColumn As DataGridColumn)
|
||||||
@@ -403,13 +577,18 @@ Public Class EgtDataGridColumn
|
|||||||
'm_dgColumn.DisplayIndex = m_DisplayIndex
|
'm_dgColumn.DisplayIndex = m_DisplayIndex
|
||||||
m_dgColumn.Width = m_Width
|
m_dgColumn.Width = m_Width
|
||||||
m_dgColumn.Visibility = m_ColumnVisibility
|
m_dgColumn.Visibility = m_ColumnVisibility
|
||||||
|
If CInt(m_SortDirection) > 0 Then
|
||||||
|
m_dgColumn.SortDirection = m_SortDirection - 1 'If(CInt(m_SortDirection) = 0, Nothing, m_SortDirection - 1)
|
||||||
|
Else
|
||||||
|
m_dgColumn.SortDirection = Nothing
|
||||||
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
' funzione per calcolare e scrivere la stringa dei parametri della colonna nell'INI
|
' funzione per calcolare e scrivere la stringa dei parametri della colonna nell'INI
|
||||||
Public Function SaveDataGridColumn() As Boolean
|
Public Function SaveDataGridColumn() As Boolean
|
||||||
Dim bOk As Boolean
|
Dim bOk As Boolean
|
||||||
Dim sColumnParams = String.Empty
|
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)
|
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)
|
||||||
bOk = WriteColumnPrivateProfileParam(ParentDataGridName, DisplayIndex, sColumnParams)
|
bOk = WriteColumnPrivateProfileParam(ParentDataGridName, DisplayIndex, sColumnParams)
|
||||||
Return bOk
|
Return bOk
|
||||||
End Function
|
End Function
|
||||||
|
|||||||
@@ -94,8 +94,6 @@ Public Class NewMachGroupPanelVM
|
|||||||
AddHandler m_MachGroupPanelM.MachGroupAdded, AddressOf OnMachGroupAdded
|
AddHandler m_MachGroupPanelM.MachGroupAdded, AddressOf OnMachGroupAdded
|
||||||
If Not MachGroupPanelM.IsMultiMachGroup Then SetMachGroupPanelVisibility(False)
|
If Not MachGroupPanelM.IsMultiMachGroup Then SetMachGroupPanelVisibility(False)
|
||||||
CreateMachGroupVMList()
|
CreateMachGroupVMList()
|
||||||
' Creo riferimento a questa classe in LibMap
|
|
||||||
'''LibMap.SetRefMachGroupPanelVM(Me)
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
#End Region ' CONSTRUCTOR
|
#End Region ' CONSTRUCTOR
|
||||||
|
|||||||
@@ -0,0 +1,99 @@
|
|||||||
|
Imports System.Threading
|
||||||
|
Imports System.Windows.Threading
|
||||||
|
|
||||||
|
Public Module LoadingWndHelper
|
||||||
|
|
||||||
|
Public Enum ActiveIds As Integer
|
||||||
|
OPENPROJ = 1
|
||||||
|
SAVEPROJ = 2
|
||||||
|
IMPORTBTL = 3
|
||||||
|
GOTOPROD = 4
|
||||||
|
OPENPROD = 5
|
||||||
|
SAVEPROD = 6
|
||||||
|
GOTOPROJ = 7
|
||||||
|
EXPORTPROJECT = 8
|
||||||
|
IMPORTPROJECT = 9
|
||||||
|
CHANGEPARAM = 10
|
||||||
|
CREATINGPDF = 11
|
||||||
|
CHANGEMATERIAL = 12
|
||||||
|
End Enum
|
||||||
|
|
||||||
|
Dim m_MainWindow As Windows.Window
|
||||||
|
Public Sub SetMainWindow(MainWindow As Windows.Window)
|
||||||
|
m_MainWindow = MainWindow
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private m_bMainWindow_IsActive As Boolean = True
|
||||||
|
Public Sub SetMainWindowIsActive(IsActive As Boolean)
|
||||||
|
m_bMainWindow_IsActive = IsActive
|
||||||
|
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)
|
||||||
|
|
||||||
|
Private m_thread As Thread
|
||||||
|
Private m_LoadingWndVM As Core.LoadingWndVM
|
||||||
|
Private m_CurrStep As Integer
|
||||||
|
Private m_StepText As String
|
||||||
|
Private m_nProgress As Integer
|
||||||
|
Private m_nNextProgress As Integer
|
||||||
|
Private m_bClose As Boolean
|
||||||
|
Private m_bActiveId As Integer = -1
|
||||||
|
|
||||||
|
Public Function OpenLoadingWnd(Id As Integer, nSteps As Integer, TotText As String, FirstStepText As String, nNextProgress As Integer) As Boolean
|
||||||
|
If m_bActiveId > 0 Then Return False
|
||||||
|
m_bActiveId = Id
|
||||||
|
m_LoadingWndVM = Nothing
|
||||||
|
m_CurrStep = 1
|
||||||
|
m_StepText = FirstStepText
|
||||||
|
m_nProgress = 1
|
||||||
|
m_nNextProgress = nNextProgress
|
||||||
|
m_bClose = False
|
||||||
|
Dim Top As Double = m_MainWindow.Top + (m_MainWindow.Height / 2) - 100
|
||||||
|
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.CenterOwner
|
||||||
|
End If
|
||||||
|
m_thread = New Thread(Sub()
|
||||||
|
m_LoadingWndVM = New Core.LoadingWndVM(nSteps, TotText, AddressOf LoadingCallback)
|
||||||
|
m_LoadingWndVM.UpdateProgress(m_CurrStep, m_StepText, m_nProgress, m_nNextProgress)
|
||||||
|
Dim LoadingWnd As New LoadingWndV(Nothing, m_LoadingWndVM)
|
||||||
|
' posiziono la finestra
|
||||||
|
If WindowStartupLocation = Windows.WindowStartupLocation.CenterScreen Then
|
||||||
|
LoadingWnd.WindowStartupLocation = Windows.WindowStartupLocation.CenterScreen
|
||||||
|
Else
|
||||||
|
LoadingWnd.Top = Top
|
||||||
|
LoadingWnd.Left = Left
|
||||||
|
End If
|
||||||
|
LoadingWnd.Show()
|
||||||
|
Dispatcher.Run()
|
||||||
|
End Sub)
|
||||||
|
m_thread.SetApartmentState(ApartmentState.STA)
|
||||||
|
m_thread.Start()
|
||||||
|
Return True
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Private Sub LoadingCallback(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)
|
||||||
|
CurrStep = m_CurrStep
|
||||||
|
StepText = m_StepText
|
||||||
|
nProgress = m_nProgress
|
||||||
|
nNextProgress = m_nNextProgress
|
||||||
|
m_bMainWindow_IsActive = MainWindow_IsActive
|
||||||
|
bClose = m_bClose
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Sub UpdateLoadingWnd(Id As Integer, CurrStep As Integer, StepText As String, nProgress As Integer, nNextProgress As Integer)
|
||||||
|
If Id <> m_bActiveId Then Return
|
||||||
|
m_CurrStep = CurrStep
|
||||||
|
m_StepText = StepText
|
||||||
|
m_nProgress = nProgress
|
||||||
|
m_nNextProgress = nNextProgress
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Sub CloseLoadingWnd(Id As Integer)
|
||||||
|
If Id <> m_bActiveId Then Return
|
||||||
|
m_bClose = True
|
||||||
|
m_bActiveId = -1
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
End Module
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
<EgtWPFLib5:EgtCustomWindow x:Class="LoadingWndV"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
|
||||||
|
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
|
||||||
|
Height="200" Width="300"
|
||||||
|
TitleBarHeight="0"
|
||||||
|
ResizeMode="NoResize" WindowStyle="None"
|
||||||
|
IsClosable="False" IsMinimizable="False"
|
||||||
|
WindowStartupLocation="Manual" ShowInTaskbar="False">
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="1*"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="1*"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="1*"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="1*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock Grid.Row="1"
|
||||||
|
Text="{Binding TotText_Msg}"
|
||||||
|
TextAlignment="Center"/>
|
||||||
|
<TextBlock Grid.Row="2"
|
||||||
|
Text="{Binding StepText_Msg}"
|
||||||
|
TextAlignment="Center"
|
||||||
|
Visibility="{Binding StepText_Visibility}"/>
|
||||||
|
<Grid Grid.Row="3"
|
||||||
|
Visibility="{Binding StepProgress_Visibility}">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="1*"/>
|
||||||
|
<RowDefinition Height="1*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid Height="20"/>
|
||||||
|
<ProgressBar Grid.Row="1"
|
||||||
|
Minimum="0"
|
||||||
|
Maximum="100"
|
||||||
|
Value="{Binding StepProgress_Value}"
|
||||||
|
Height="20"
|
||||||
|
Margin="40,0,40,0"/>
|
||||||
|
</Grid>
|
||||||
|
<ProgressBar Grid.Row="5"
|
||||||
|
Minimum="0"
|
||||||
|
Maximum="100"
|
||||||
|
Value="{Binding TotProgress_Value}"
|
||||||
|
Height="20"
|
||||||
|
Margin="40,0,40,0"/>
|
||||||
|
<TextBlock Grid.Row="7"
|
||||||
|
Text="{Binding TotProgress_Msg}"
|
||||||
|
TextAlignment="Center"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
</EgtWPFLib5:EgtCustomWindow>
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
Imports System.Windows
|
||||||
|
Imports System.Windows.Input
|
||||||
|
|
||||||
|
Public Class LoadingWndV
|
||||||
|
|
||||||
|
Private WithEvents m_LoadingWndVM As LoadingWndVM
|
||||||
|
|
||||||
|
Sub New(Owner As Window, LoadingWndVM As LoadingWndVM)
|
||||||
|
MyBase.New(Owner)
|
||||||
|
' This call is required by the designer.
|
||||||
|
InitializeComponent()
|
||||||
|
Me.DataContext = LoadingWndVM
|
||||||
|
' Assegno al riferimento locale al VM il VM preso dal DataContext
|
||||||
|
m_LoadingWndVM = LoadingWndVM
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub CloseWindow(bDialogResult As Boolean) Handles m_LoadingWndVM.m_CloseWindow
|
||||||
|
Me.Close()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub ActivateWindow() Handles m_LoadingWndVM.m_ActivateWindow
|
||||||
|
Me.Activate()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub Me_ContentRendered() Handles Me.ContentRendered
|
||||||
|
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
|
||||||
@@ -0,0 +1,233 @@
|
|||||||
|
Imports System.Timers
|
||||||
|
Imports System.Windows
|
||||||
|
Imports System.Windows.Input
|
||||||
|
Imports System.Windows.Threading
|
||||||
|
Imports EgtBEAMWALL.Core
|
||||||
|
Imports EgtUILib
|
||||||
|
Imports EgtWPFLib5
|
||||||
|
|
||||||
|
Public Class LoadingWndVM
|
||||||
|
Inherits VMBase
|
||||||
|
|
||||||
|
#Region "FIELDS & PROPERTIES"
|
||||||
|
|
||||||
|
Enum LoadingTypes As Integer
|
||||||
|
NULL = 0
|
||||||
|
OPEN = 1
|
||||||
|
IMPORT = 2
|
||||||
|
End Enum
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
Friend Event m_CloseWindow(bDialogResult As Boolean)
|
||||||
|
Friend Event m_ActivateWindow()
|
||||||
|
|
||||||
|
Private m_CallbackLoading As CallbackLoadingDlg
|
||||||
|
Private m_Waiting_Timer As New DispatcherTimer
|
||||||
|
|
||||||
|
' numero di passaggi di caricamento
|
||||||
|
Private m_nSteps As Integer
|
||||||
|
' titolo testo di caricamento
|
||||||
|
Private m_TotText As String
|
||||||
|
' numero passaggio corrente
|
||||||
|
Private m_CurrStep As Integer
|
||||||
|
' testo del passaggio corrente
|
||||||
|
Private m_StepText As String
|
||||||
|
' indice d'inizio di questo passaggio
|
||||||
|
Private m_nStartProgress As Integer
|
||||||
|
' indice d'inizio del prossimo passaggio
|
||||||
|
Private m_nNextProgress As Integer
|
||||||
|
' variabile che indica richiesta chiusura della finestra
|
||||||
|
Private m_bClosing As Boolean = False
|
||||||
|
Private m_bMainWindow_IsActive As Boolean = True
|
||||||
|
|
||||||
|
Private m_StepProgress_Value As Double = 0
|
||||||
|
Public Property StepProgress_Value As Double
|
||||||
|
Get
|
||||||
|
Return m_StepProgress_Value
|
||||||
|
End Get
|
||||||
|
Set(value As Double)
|
||||||
|
m_StepProgress_Value = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Private m_TotProgress_Value As Double = 0
|
||||||
|
Public Property TotProgress_Value As Double
|
||||||
|
Get
|
||||||
|
Return Math.Floor(m_TotProgress_Value)
|
||||||
|
End Get
|
||||||
|
Set(value As Double)
|
||||||
|
m_TotProgress_Value = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Private m_StepText_Visibility As Visibility
|
||||||
|
Public ReadOnly Property StepText_Visibility As Visibility
|
||||||
|
Get
|
||||||
|
Return m_StepText_Visibility
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Private m_StepProgress_Visibility As Visibility
|
||||||
|
Public ReadOnly Property StepProgress_Visibility As Visibility
|
||||||
|
Get
|
||||||
|
Return m_StepProgress_Visibility
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
#Region "Messages"
|
||||||
|
|
||||||
|
Public ReadOnly Property TotText_Msg As String
|
||||||
|
Get
|
||||||
|
Return If(m_nSteps > 0, m_TotText & " (" & m_CurrStep & "/" & m_nSteps & ")", m_TotText)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Public ReadOnly Property StepText_Msg As String
|
||||||
|
Get
|
||||||
|
Return m_StepText
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Public ReadOnly Property TotProgress_Msg As String
|
||||||
|
Get
|
||||||
|
Return m_TotProgress_Value.ToString("0.#") & "%"
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
#End Region ' Messages
|
||||||
|
|
||||||
|
' Definizione comandi
|
||||||
|
Private m_cmdCancel As ICommand
|
||||||
|
|
||||||
|
#End Region ' FIELDS & PROPERTIES
|
||||||
|
|
||||||
|
Sub New(Steps As Integer, TotText As String, callback As CallbackLoadingDlg)
|
||||||
|
m_nSteps = Steps
|
||||||
|
m_TotText = TotText
|
||||||
|
m_CallbackLoading = callback
|
||||||
|
m_bClosing = False
|
||||||
|
If Steps = 1 Then
|
||||||
|
m_StepText_Visibility = Visibility.Collapsed
|
||||||
|
m_StepProgress_Visibility = Visibility.Collapsed
|
||||||
|
Else
|
||||||
|
m_StepText_Visibility = Visibility.Visible
|
||||||
|
m_StepProgress_Visibility = Visibility.Visible
|
||||||
|
End If
|
||||||
|
' imposto contatore
|
||||||
|
m_Waiting_Timer.Interval = TimeSpan.FromMilliseconds(200)
|
||||||
|
AddHandler m_Waiting_Timer.Tick, AddressOf WaitingTimer_Tick
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Sub UpdateProgress(CurrStep As Integer, StepText As String, nStartProgress As Integer, nNextProgress As Integer)
|
||||||
|
m_CurrStep = CurrStep
|
||||||
|
m_StepText = StepText
|
||||||
|
m_StepProgress_Value = nStartProgress
|
||||||
|
m_nNextProgress = nNextProgress
|
||||||
|
NotifyPropertyChanged(NameOf(StepText_Msg))
|
||||||
|
NotifyPropertyChanged(NameOf(TotText_Msg))
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Overridable Sub StartFunction()
|
||||||
|
m_Waiting_Timer.Start()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Protected Overridable Sub WaitingTimer_Tick()
|
||||||
|
' leggo eventuali nuovi valori
|
||||||
|
Dim CurrStep As Integer = 0
|
||||||
|
Dim StepText As String = ""
|
||||||
|
Dim nStartProgress As Integer = 0
|
||||||
|
Dim nNextProgress As Integer = 0
|
||||||
|
Dim bMainWindow_IsActive As Boolean = True
|
||||||
|
Dim bClose As Boolean = False
|
||||||
|
m_CallbackLoading(CurrStep, StepText, nStartProgress, nNextProgress, bMainWindow_IsActive, bClose)
|
||||||
|
If bMainWindow_IsActive <> m_bMainWindow_IsActive Then
|
||||||
|
RaiseEvent m_ActivateWindow()
|
||||||
|
End If
|
||||||
|
If m_bClosing Then
|
||||||
|
Close()
|
||||||
|
Dispatcher.CurrentDispatcher.InvokeShutdown()
|
||||||
|
Return
|
||||||
|
ElseIf bClose Then
|
||||||
|
m_bClosing = True
|
||||||
|
' mostro completamento caricamento
|
||||||
|
m_CurrStep = m_nSteps
|
||||||
|
m_StepProgress_Value = 100
|
||||||
|
m_TotProgress_Value = 100
|
||||||
|
m_Waiting_Timer.Interval = TimeSpan.FromMilliseconds(1000)
|
||||||
|
Else
|
||||||
|
If m_CurrStep <> CurrStep Then
|
||||||
|
If m_StepProgress_Value < 100 Then
|
||||||
|
m_StepProgress_Value = 100
|
||||||
|
ElseIf m_StepProgress_Value = 100 Then
|
||||||
|
m_StepProgress_Value = 0
|
||||||
|
m_CurrStep = CurrStep
|
||||||
|
m_StepText = StepText
|
||||||
|
m_nStartProgress = nStartProgress
|
||||||
|
m_nNextProgress = nNextProgress
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
' incremento Step corrente
|
||||||
|
If m_StepProgress_Value < 80 Then
|
||||||
|
m_StepProgress_Value += 1
|
||||||
|
ElseIf m_StepProgress_Value < 90 Then
|
||||||
|
m_StepProgress_Value += 0.4
|
||||||
|
ElseIf m_StepProgress_Value < 98 Then
|
||||||
|
m_StepProgress_Value += 0.1
|
||||||
|
Else
|
||||||
|
m_StepProgress_Value += 0.01
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
' calcolo totale
|
||||||
|
Dim dStepStart As Double = If(m_CurrStep > 1, m_nStartProgress, 0)
|
||||||
|
Dim dStepEnd As Double = m_nNextProgress
|
||||||
|
m_TotProgress_Value = dStepStart + ((dStepEnd - dStepStart) / 100 * m_StepProgress_Value)
|
||||||
|
End If
|
||||||
|
' aggiorno grafica
|
||||||
|
NotifyPropertyChanged(NameOf(StepText_Msg))
|
||||||
|
NotifyPropertyChanged(NameOf(TotText_Msg))
|
||||||
|
NotifyPropertyChanged(NameOf(StepProgress_Value))
|
||||||
|
NotifyPropertyChanged(NameOf(TotProgress_Value))
|
||||||
|
NotifyPropertyChanged(NameOf(TotProgress_Msg))
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Sub Close()
|
||||||
|
' fermo timer
|
||||||
|
m_Waiting_Timer.Stop()
|
||||||
|
' chiudo finestra
|
||||||
|
RaiseEvent m_CloseWindow(True)
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
#Region "COMMANDS"
|
||||||
|
|
||||||
|
#Region "Cancel"
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Returns a command that do Open.
|
||||||
|
''' </summary>
|
||||||
|
Public ReadOnly Property Cancel_Command As ICommand
|
||||||
|
Get
|
||||||
|
If m_cmdCancel Is Nothing Then
|
||||||
|
m_cmdCancel = New Command(AddressOf Cancel)
|
||||||
|
End If
|
||||||
|
Return m_cmdCancel
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Execute the Open. This method is invoked by the OpenCommand.
|
||||||
|
''' </summary>
|
||||||
|
Friend Sub Cancel()
|
||||||
|
'' chiedo conferma
|
||||||
|
'If MessageBox.Show("Are you sure you want to stop the nesting?", "Warning", MessageBoxButton.YesNo, MessageBoxImage.Warning) = MessageBoxResult.No Then Return
|
||||||
|
'' fermo il nesting
|
||||||
|
'Map.refOptimizePanelVM.m_StopNesting = True
|
||||||
|
'' fermo timer e chiudo finestra
|
||||||
|
'CloseNesting()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
#End Region ' Cancel
|
||||||
|
|
||||||
|
#End Region ' COMMANDS
|
||||||
|
|
||||||
|
End Class
|
||||||
@@ -176,7 +176,7 @@ Public Class MyMachGroupM
|
|||||||
Private m_sCALC_MSG As String
|
Private m_sCALC_MSG As String
|
||||||
Public Property sCALC_MSG As String
|
Public Property sCALC_MSG As String
|
||||||
Get
|
Get
|
||||||
Return m_sCALC_MSG
|
Return MessageFromLuaMsg(m_sCALC_MSG)
|
||||||
End Get
|
End Get
|
||||||
Set(value As String)
|
Set(value As String)
|
||||||
m_sCALC_MSG = value
|
m_sCALC_MSG = value
|
||||||
@@ -213,6 +213,16 @@ Public Class MyMachGroupM
|
|||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
Private m_bCALC_PartsGlobalState As CalcStates
|
||||||
|
Public Property bCALC_PartsGlobalState As CalcStates
|
||||||
|
Get
|
||||||
|
Return m_bCALC_PartsGlobalState
|
||||||
|
End Get
|
||||||
|
Set(value As CalcStates)
|
||||||
|
m_bCALC_PartsGlobalState = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
Private m_nCALC_GlobalERR As Integer
|
Private m_nCALC_GlobalERR As Integer
|
||||||
Public Property nCALC_GlobalERR As Integer
|
Public Property nCALC_GlobalERR As Integer
|
||||||
Get
|
Get
|
||||||
@@ -290,11 +300,11 @@ Public Class MyMachGroupM
|
|||||||
EgtGetInfo(NewMachGroupM.m_Id, MGR_RPT_BARLEN, NewMachGroupM.m_dL)
|
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_BARHEIGHT, NewMachGroupM.m_dH)
|
||||||
EgtGetInfo(NewMachGroupM.m_Id, MGR_RPT_BARWIDTH, NewMachGroupM.m_dW)
|
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)
|
NewMachGroupM.m_PartMList = LoadParts(NewMachGroupM)
|
||||||
For Each Part In NewMachGroupM.m_PartMList
|
For Each Part In NewMachGroupM.m_PartMList
|
||||||
Part.UpdateOffset()
|
Part.UpdateOffset()
|
||||||
NewMachGroupM.m_dMatForPart += Part.dVolume
|
NewMachGroupM.m_dTotMat += Part.dL + Part.dOffset
|
||||||
|
NewMachGroupM.m_dMatForPart += Part.dL
|
||||||
Next
|
Next
|
||||||
Else
|
Else
|
||||||
NewMachGroupM.m_nRawPartId = EgtGetFirstRawPart()
|
NewMachGroupM.m_nRawPartId = EgtGetFirstRawPart()
|
||||||
@@ -326,7 +336,7 @@ Public Class MyMachGroupM
|
|||||||
NewMachGroupM.m_PartMList = LoadParts(NewMachGroupM)
|
NewMachGroupM.m_PartMList = LoadParts(NewMachGroupM)
|
||||||
For Each Part In NewMachGroupM.m_PartMList
|
For Each Part In NewMachGroupM.m_PartMList
|
||||||
Part.UpdateOffset()
|
Part.UpdateOffset()
|
||||||
NewMachGroupM.m_dMatForPart += Part.dVolume
|
NewMachGroupM.m_dMatForPart += Part.dL + Part.dOffset
|
||||||
Next
|
Next
|
||||||
Else
|
Else
|
||||||
NewMachGroupM.m_nRawPartId = EgtGetFirstRawPart()
|
NewMachGroupM.m_nRawPartId = EgtGetFirstRawPart()
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ Public Class MyMachGroupPanelM
|
|||||||
EgtOutLog("Machine incompatible with beam & wall machining!!")
|
EgtOutLog("Machine incompatible with beam & wall machining!!")
|
||||||
Else
|
Else
|
||||||
Dim nBTLInfoLayerId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO)
|
Dim nBTLInfoLayerId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO)
|
||||||
Dim nPROJTYPE As Integer = BWType.NULL
|
Dim nPROJTYPE As Integer = BWType.NULL
|
||||||
EgtGetInfo(nBTLInfoLayerId, BTL_GEN_PROJTYPE, nPROJTYPE)
|
EgtGetInfo(nBTLInfoLayerId, BTL_GEN_PROJTYPE, nPROJTYPE)
|
||||||
If nPROJTYPE = BWType.BEAM Or nPROJTYPE = BWType.WALL Then
|
If nPROJTYPE = BWType.BEAM Or nPROJTYPE = BWType.WALL Then
|
||||||
TempList.Add(MyMachGroupM.CreateMyMachGroup(nPROJTYPE, nId, sName, sMachine))
|
TempList.Add(MyMachGroupM.CreateMyMachGroup(nPROJTYPE, nId, sName, sMachine))
|
||||||
@@ -168,44 +168,157 @@ Public Class MyMachGroupPanelM
|
|||||||
|
|
||||||
' funzione che fa l'update di tutte le copie dei pezzi modificati
|
' funzione che fa l'update di tutte le copie dei pezzi modificati
|
||||||
Public Shared Sub UpdateDuplo()
|
Public Shared Sub UpdateDuplo()
|
||||||
|
' verifico tipo di progetto
|
||||||
|
Dim nBtlInfoId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO)
|
||||||
|
Dim nBWType As Integer = 0
|
||||||
|
EgtGetInfo(nBtlInfoId, BTL_GEN_PROJTYPE, nBWType)
|
||||||
|
' ciclo sui pezzi
|
||||||
Dim bTotIsModified As Boolean = False
|
Dim bTotIsModified As Boolean = False
|
||||||
Dim nPartId As Integer = EgtGetFirstPart()
|
Dim nPartId As Integer = EgtGetFirstPart()
|
||||||
While nPartId <> GDB_ID.NULL
|
While nPartId <> GDB_ID.NULL
|
||||||
Dim bIsModified As Boolean = False
|
Dim bIsModified As Boolean = False
|
||||||
If EgtDuploGetModified(nPartId, bIsModified) AndAlso bIsModified Then
|
If EgtDuploGetModified(nPartId, bIsModified) AndAlso bIsModified Then
|
||||||
|
' verifico se c'é PRID sugli outline
|
||||||
|
Dim nPRId As Integer = 1
|
||||||
|
Dim nOutlineLayer As Integer = EgtGetFirstNameInGroup(nPartId, OUTLINE)
|
||||||
|
If nOutlineLayer <> GDB_ID.NULL Then
|
||||||
|
Dim nOutlineId As Integer = EgtGetFirstInGroup(nOutlineLayer)
|
||||||
|
While nOutlineId <> GDB_ID.NULL
|
||||||
|
' verifico che sia feature
|
||||||
|
If EgtExistsInfo(nOutlineId, MGR_FTR_PRC) Then
|
||||||
|
If EgtExistsInfo(nOutlineId, MGR_FTR_PRID) Then
|
||||||
|
nOutlineId = EgtGetNext(nOutlineId)
|
||||||
|
Continue While
|
||||||
|
Else
|
||||||
|
EgtSetInfo(nOutlineId, MGR_FTR_PRID, nPRId)
|
||||||
|
nPRId += 1
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
nOutlineId = EgtGetNext(nOutlineId)
|
||||||
|
End While
|
||||||
|
End If
|
||||||
bTotIsModified = True
|
bTotIsModified = True
|
||||||
Dim DuploList As New List(Of Integer)
|
Dim DuploList As New List(Of Integer)
|
||||||
EgtDuploList(nPartId, DuploList)
|
EgtDuploList(nPartId, DuploList)
|
||||||
Dim DuploArray() As Integer
|
Dim DuploArray() As Integer
|
||||||
Dim RotArray(DuploList.Count) As Integer
|
Dim RotArray(DuploList.Count) As Integer
|
||||||
Dim FlipArray(DuploList.Count) As Integer
|
Dim FlipArray(DuploList.Count) As Integer
|
||||||
|
Dim QArray(DuploList.Count) As Dictionary(Of String, Dictionary(Of String, String))
|
||||||
DuploArray = DuploList.ToArray()
|
DuploArray = DuploList.ToArray()
|
||||||
' recupero ROT e FLIP per non perderli
|
' recupero ROT (gradi) e FLIP (0/1) per non perderli
|
||||||
For Duploindex = 0 To DuploArray.Length - 1
|
For Duploindex = 0 To DuploArray.Length - 1
|
||||||
|
RotArray(Duploindex) = 0
|
||||||
EgtGetInfo(DuploArray(Duploindex), MGR_PRT_ROT, RotArray(Duploindex))
|
EgtGetInfo(DuploArray(Duploindex), MGR_PRT_ROT, RotArray(Duploindex))
|
||||||
|
FlipArray(Duploindex) = 0
|
||||||
EgtGetInfo(DuploArray(Duploindex), MGR_PRT_FLIP, FlipArray(Duploindex))
|
EgtGetInfo(DuploArray(Duploindex), MGR_PRT_FLIP, FlipArray(Duploindex))
|
||||||
|
If FlipArray(Duploindex) <> 0 Then FlipArray(Duploindex) = 180
|
||||||
|
If nBWType = BWType.WALL Then
|
||||||
|
' salvo parametri Q
|
||||||
|
QArray(Duploindex) = New Dictionary(Of String, Dictionary(Of String, String))
|
||||||
|
' ciclo sugli outline
|
||||||
|
nOutlineLayer = EgtGetFirstNameInGroup(DuploArray(Duploindex), OUTLINE)
|
||||||
|
If nOutlineLayer <> GDB_ID.NULL Then
|
||||||
|
Dim nGlobPRId As Integer = 1
|
||||||
|
Dim nOutlineId As Integer = EgtGetFirstInGroup(nOutlineLayer)
|
||||||
|
While nOutlineId <> GDB_ID.NULL
|
||||||
|
' verifico che sia feature
|
||||||
|
Dim nPRC As Integer
|
||||||
|
If EgtGetInfo(nOutlineId, MGR_FTR_PRC, nPRC) Then
|
||||||
|
nPRId = 0
|
||||||
|
If Not EgtGetInfo(nOutlineId, MGR_FTR_PRID, nPRId) Then
|
||||||
|
EgtSetInfo(nOutlineId, MGR_FTR_PRID, nGlobPRId)
|
||||||
|
nPRId = nGlobPRId
|
||||||
|
nGlobPRId += 1
|
||||||
|
End If
|
||||||
|
Dim sKey As String = nPRId & "." & nPRC
|
||||||
|
QArray(Duploindex).Add(sKey, New Dictionary(Of String, String))
|
||||||
|
For QIndex = 1 To 10
|
||||||
|
Dim QKey As String = "Q" & QIndex.ToString("D2")
|
||||||
|
Dim QValue As Integer = 0
|
||||||
|
If EgtGetInfo(nOutlineId, QKey, QValue) Then
|
||||||
|
QArray(Duploindex)(sKey).Add(QKey, QValue)
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
nOutlineId = EgtGetNext(nOutlineId)
|
||||||
|
End While
|
||||||
|
End If
|
||||||
|
' ciclo sulle feature
|
||||||
|
Dim nFeatureLayer As Integer = EgtGetFirstNameInGroup(DuploArray(Duploindex), PROCESSINGS)
|
||||||
|
If nFeatureLayer <> GDB_ID.NULL Then
|
||||||
|
Dim nFeatureId As Integer = EgtGetFirstInGroup(nFeatureLayer)
|
||||||
|
While nFeatureId <> GDB_ID.NULL
|
||||||
|
' verifico che sia feature
|
||||||
|
Dim nPRC As Integer
|
||||||
|
If EgtGetInfo(nFeatureId, MGR_FTR_PRC, nPRC) Then
|
||||||
|
nPRId = 0
|
||||||
|
EgtGetInfo(nFeatureId, MGR_FTR_PRID, nPRId)
|
||||||
|
Dim sKey As String = nPRId & "." & nPRC
|
||||||
|
QArray(Duploindex).Add(sKey, New Dictionary(Of String, String))
|
||||||
|
For QIndex = 1 To 10
|
||||||
|
Dim QKey As String = "Q" & QIndex.ToString("D2")
|
||||||
|
Dim QValue As Integer = 0
|
||||||
|
If EgtGetInfo(nFeatureId, QKey, QValue) Then
|
||||||
|
QArray(Duploindex)(sKey).Add(QKey, QValue)
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
nFeatureId = EgtGetNext(nFeatureId)
|
||||||
|
End While
|
||||||
|
End If
|
||||||
|
End If
|
||||||
Next
|
Next
|
||||||
' aggiornamento dei Duplo
|
' aggiornamento dei Duplo
|
||||||
EgtDuploUpdate(nPartId)
|
EgtDuploUpdate(nPartId)
|
||||||
' recupero flip e rot dell'originale
|
|
||||||
Dim OrigRot As Integer
|
|
||||||
Dim OrigFlip As Integer
|
|
||||||
Dim DeltaRot As Integer
|
|
||||||
Dim DeltaFlip As Integer
|
|
||||||
EgtGetInfo(nPartId, BTL_PRT_ROTATED, OrigRot)
|
|
||||||
EgtGetInfo(nPartId, BTL_PRT_INVERTED, OrigFlip)
|
|
||||||
' ripristino i valori di ROT e FLIP
|
' ripristino i valori di ROT e FLIP
|
||||||
For Duploindex = 0 To DuploArray.Length - 1
|
For Duploindex = 0 To DuploArray.Length - 1
|
||||||
' recupero box del pezzo
|
' ripristino info rot e flip
|
||||||
Dim b3Part As New BBox3d
|
|
||||||
EgtGetBBoxGlob(nPartId, GDB_BB.STANDARD, b3Part)
|
|
||||||
' faccio flip e rotazione rispetto all'originale che ha sovrascritto posizione del duplo
|
|
||||||
DeltaRot = RotArray(Duploindex) - OrigRot
|
|
||||||
EgtRotate(DuploArray(Duploindex), b3Part.Center, -Vector3d.Z_AX, DeltaRot)
|
|
||||||
DeltaFlip = FlipArray(Duploindex) - OrigFlip
|
|
||||||
EgtRotate(DuploArray(Duploindex), b3Part.Center, Vector3d.X_AX, DeltaFlip)
|
|
||||||
EgtSetInfo(DuploArray(Duploindex), MGR_PRT_ROT, RotArray(Duploindex))
|
EgtSetInfo(DuploArray(Duploindex), MGR_PRT_ROT, RotArray(Duploindex))
|
||||||
EgtSetInfo(DuploArray(Duploindex), MGR_PRT_FLIP, FlipArray(Duploindex))
|
EgtSetInfo(DuploArray(Duploindex), MGR_PRT_FLIP, FlipArray(Duploindex))
|
||||||
|
If nBWType = BWType.WALL Then
|
||||||
|
' ciclo sugli outline
|
||||||
|
nOutlineLayer = EgtGetFirstNameInGroup(DuploArray(Duploindex), OUTLINE)
|
||||||
|
If nOutlineLayer <> GDB_ID.NULL Then
|
||||||
|
Dim nOutlineId As Integer = EgtGetFirstInGroup(nOutlineLayer)
|
||||||
|
While nOutlineId <> GDB_ID.NULL
|
||||||
|
' verifico che sia feature
|
||||||
|
Dim nPRC As Integer
|
||||||
|
If EgtGetInfo(nOutlineId, MGR_FTR_PRC, nPRC) Then
|
||||||
|
nPRId = 0
|
||||||
|
EgtGetInfo(nOutlineId, MGR_FTR_PRID, nPRId)
|
||||||
|
Dim sKey As String = nPRId & "." & nPRC
|
||||||
|
' ripristino parametri Q
|
||||||
|
If QArray(Duploindex).ContainsKey(sKey) Then
|
||||||
|
For Each QPar In QArray(Duploindex)(sKey)
|
||||||
|
EgtSetInfo(nOutlineId, QPar.Key, QPar.Value)
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
nOutlineId = EgtGetNext(nOutlineId)
|
||||||
|
End While
|
||||||
|
End If
|
||||||
|
' ciclo sulle feature
|
||||||
|
Dim nFeatureLayer As Integer = EgtGetFirstNameInGroup(DuploArray(Duploindex), PROCESSINGS)
|
||||||
|
If nFeatureLayer <> GDB_ID.NULL Then
|
||||||
|
Dim nFeatureId As Integer = EgtGetFirstInGroup(nFeatureLayer)
|
||||||
|
While nFeatureId <> GDB_ID.NULL
|
||||||
|
' verifico che sia feature
|
||||||
|
Dim nPRC As Integer
|
||||||
|
If EgtGetInfo(nFeatureId, MGR_FTR_PRC, nPRC) Then
|
||||||
|
nPRId = 0
|
||||||
|
EgtGetInfo(nFeatureId, MGR_FTR_PRID, nPRId)
|
||||||
|
Dim sKey As String = nPRId & "." & nPRC
|
||||||
|
' ripristino parametri Q
|
||||||
|
If QArray(Duploindex).ContainsKey(sKey) Then
|
||||||
|
For Each QPar In QArray(Duploindex)(sKey)
|
||||||
|
EgtSetInfo(nFeatureId, QPar.Key, QPar.Value)
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
nFeatureId = EgtGetNext(nFeatureId)
|
||||||
|
End While
|
||||||
|
End If
|
||||||
|
End If
|
||||||
Next
|
Next
|
||||||
End If
|
End If
|
||||||
nPartId = EgtGetNextPart(nPartId)
|
nPartId = EgtGetNextPart(nPartId)
|
||||||
@@ -217,8 +330,16 @@ Public Class MyMachGroupPanelM
|
|||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Class DuploFeature
|
||||||
|
' Id geometrico della feature
|
||||||
|
Friend nFeatureId As Integer
|
||||||
|
Friend nPRC As Integer
|
||||||
|
Friend nPRID As Integer
|
||||||
|
End Class
|
||||||
|
|
||||||
' funzione che cancella tutti i pezzi segnati da eliminare
|
' 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
|
' reset necessario per poter accedere direttamente al grezzo dalle info pezzo e al MachGroup tramite la gerarchia Db geometrico
|
||||||
EgtResetCurrMachGroup()
|
EgtResetCurrMachGroup()
|
||||||
Dim nPartId As Integer = EgtGetFirstPart()
|
Dim nPartId As Integer = EgtGetFirstPart()
|
||||||
@@ -236,16 +357,37 @@ Public Class MyMachGroupPanelM
|
|||||||
Dim nRawPartId As Integer = DuploGetRawPart(nDuploId)
|
Dim nRawPartId As Integer = DuploGetRawPart(nDuploId)
|
||||||
' recupero gruppo di lavorazione
|
' recupero gruppo di lavorazione
|
||||||
Dim nMachGroupId As Integer = EgtGetParent(EgtGetParent(EgtGetParent(nRawPartId)))
|
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
|
' lo setto come corrente
|
||||||
EgtSetCurrMachGroup(nMachGroupId)
|
EgtSetCurrMachGroup(nMachGroupId)
|
||||||
' elimino pezzo copia
|
' elimino pezzo copia
|
||||||
EgtRemovePartFromRawPart(nDuploId)
|
EgtRemovePartFromRawPart(nDuploId)
|
||||||
EgtErase(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
|
Next
|
||||||
End If
|
End If
|
||||||
DuploResetToDelete(nPartId)
|
DuploResetToDelete(nPartId)
|
||||||
@@ -253,7 +395,7 @@ Public Class MyMachGroupPanelM
|
|||||||
nPartId = EgtGetNextPart(nPartId)
|
nPartId = EgtGetNextPart(nPartId)
|
||||||
End While
|
End While
|
||||||
EgtResetCurrMachGroup()
|
EgtResetCurrMachGroup()
|
||||||
End Sub
|
End Function
|
||||||
|
|
||||||
Friend Shared Function DuploGetToDelete(nSouId As Integer, ByRef bToDelete As Boolean) As Boolean
|
Friend Shared Function DuploGetToDelete(nSouId As Integer, ByRef bToDelete As Boolean) As Boolean
|
||||||
If IsNothing(nSouId) Then Return False
|
If IsNothing(nSouId) Then Return False
|
||||||
@@ -282,12 +424,23 @@ Public Class MyMachGroupPanelM
|
|||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Shared Function DuploGetRawPart(nDuploId As Integer) As Integer
|
Public Shared Function DuploGetRawPart(nDuploId As Integer) As Integer
|
||||||
Dim nRawId As Integer = GDB_ID.NULL
|
Dim nSwapItem As Integer = GDB_ID.NULL
|
||||||
If EgtGetInfo(nDuploId, GDB_SI_LIST, nRawId) AndAlso nRawId > 0 Then
|
Dim sSwapItem As String = String.Empty
|
||||||
Return nRawId
|
EgtGetInfo(nDuploId, "!LST", sSwapItem)
|
||||||
Else
|
Dim LSTValues() As String = sSwapItem.Split(","c)
|
||||||
Return GDB_ID.NULL
|
If Not IsNothing(LSTValues(LSTValues.Count - 1)) AndAlso Integer.TryParse(LSTValues(LSTValues.Count - 1), nSwapItem) AndAlso nSwapItem > 0 Then
|
||||||
|
Return EgtGetParent(nSwapItem)
|
||||||
End If
|
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 Function
|
||||||
|
|
||||||
#End Region ' METHODS
|
#End Region ' METHODS
|
||||||
|
|||||||
@@ -139,21 +139,28 @@ Public Class PartM
|
|||||||
Public Property dPOSX As Double
|
Public Property dPOSX As Double
|
||||||
Get
|
Get
|
||||||
If nType = BWType.WALL Then
|
If nType = BWType.WALL Then
|
||||||
' recupero box pezzo
|
' verifico che sia attivo MachGroup di questo pezzo
|
||||||
Dim b3Part As New BBox3d
|
If EgtGetCurrMachGroup() = ParentMachGroup.Id Then
|
||||||
EgtGetBBoxGlob(nPartId, GDB_BB.ONLY_VISIBLE + GDB_BB.IGNORE_TEXT + GDB_BB.IGNORE_DIM, b3Part)
|
' recupero box pezzo
|
||||||
' recupero layer del box
|
Dim b3Part As New BBox3d
|
||||||
Dim nBoxLayerId As Integer = EgtGetFirstNameInGroup(nPartId, "Box")
|
EgtGetBBoxGlob(nPartId, GDB_BB.ONLY_VISIBLE + GDB_BB.IGNORE_TEXT + GDB_BB.IGNORE_DIM, b3Part)
|
||||||
' recupero box del layer box
|
' recupero layer del box
|
||||||
Dim b3Box As New BBox3d
|
Dim nBoxLayerId As Integer = EgtGetFirstNameInGroup(nPartId, "Box")
|
||||||
EgtGetBBoxGlob(nBoxLayerId, GDB_BB.STANDARD, b3Box)
|
' recupero box del layer box
|
||||||
' recupero origine grezzo
|
Dim b3Box As New BBox3d
|
||||||
Dim nrawPartId As Integer = EgtGetRawPartFromPart(nPartId)
|
EgtGetBBoxGlob(nBoxLayerId, GDB_BB.STANDARD, b3Box)
|
||||||
Dim b3Raw As New BBox3d
|
' recupero origine grezzo
|
||||||
EgtGetRawPartBBox(nrawPartId, b3Raw)
|
Dim nrawPartId As Integer = EgtGetRawPartFromPart(nPartId)
|
||||||
' calcolo distanza tra origine pezzo e tavolo
|
Dim b3Raw As New BBox3d
|
||||||
Dim vtPartRef As New Vector3d(b3Box.Min() - b3Raw.Min())
|
EgtGetRawPartBBox(nrawPartId, b3Raw)
|
||||||
Return vtPartRef.x
|
' calcolo distanza tra origine pezzo e tavolo
|
||||||
|
Dim vtPartRef As New Vector3d(b3Box.Min() - b3Raw.Min())
|
||||||
|
m_dPOSX = vtPartRef.x
|
||||||
|
Return vtPartRef.x
|
||||||
|
' altrimenti restituisco valore salvato (per quando viene clickato un BTLPart)
|
||||||
|
Else
|
||||||
|
Return m_dPOSX
|
||||||
|
End If
|
||||||
Else ' nType = BWType.BEAM
|
Else ' nType = BWType.BEAM
|
||||||
Return m_dPOSX
|
Return m_dPOSX
|
||||||
End If
|
End If
|
||||||
@@ -203,6 +210,16 @@ Public Class PartM
|
|||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
Public m_sSTOREY As String
|
||||||
|
Public Property sSTOREY As String
|
||||||
|
Get
|
||||||
|
Return m_sSTOREY
|
||||||
|
End Get
|
||||||
|
Set(value As String)
|
||||||
|
m_sSTOREY = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
Public m_sGROUP As String
|
Public m_sGROUP As String
|
||||||
Public Property sGROUP As String
|
Public Property sGROUP As String
|
||||||
Get
|
Get
|
||||||
@@ -260,21 +277,28 @@ Public Class PartM
|
|||||||
Protected m_dPOSY As Double
|
Protected m_dPOSY As Double
|
||||||
Public Property dPOSY As Double
|
Public Property dPOSY As Double
|
||||||
Get
|
Get
|
||||||
' recupero box pezzo
|
' verifico che sia attivo MachGroup di questo pezzo
|
||||||
Dim b3Part As New BBox3d
|
If EgtGetCurrMachGroup() = ParentMachGroup.Id Then
|
||||||
EgtGetBBoxGlob(nPartId, GDB_BB.ONLY_VISIBLE + GDB_BB.IGNORE_TEXT + GDB_BB.IGNORE_DIM, b3Part)
|
' recupero box pezzo
|
||||||
' recupero layer del box
|
Dim b3Part As New BBox3d
|
||||||
Dim nBoxLayerId As Integer = EgtGetFirstNameInGroup(nPartId, "Box")
|
EgtGetBBoxGlob(nPartId, GDB_BB.ONLY_VISIBLE + GDB_BB.IGNORE_TEXT + GDB_BB.IGNORE_DIM, b3Part)
|
||||||
' recupero box del layer box
|
' recupero layer del box
|
||||||
Dim b3Box As New BBox3d
|
Dim nBoxLayerId As Integer = EgtGetFirstNameInGroup(nPartId, "Box")
|
||||||
EgtGetBBoxGlob(nBoxLayerId, GDB_BB.STANDARD, b3Box)
|
' recupero box del layer box
|
||||||
' recupero origine grezzo
|
Dim b3Box As New BBox3d
|
||||||
Dim nrawPartId As Integer = EgtGetRawPartFromPart(nPartId)
|
EgtGetBBoxGlob(nBoxLayerId, GDB_BB.STANDARD, b3Box)
|
||||||
Dim b3Raw As New BBox3d
|
' recupero origine grezzo
|
||||||
EgtGetRawPartBBox(nrawPartId, b3Raw)
|
Dim nrawPartId As Integer = EgtGetRawPartFromPart(nPartId)
|
||||||
' calcolo distanza tra origine pezzo e tavolo
|
Dim b3Raw As New BBox3d
|
||||||
Dim vtPartRef As New Vector3d(b3Box.Min() - b3Raw.Min())
|
EgtGetRawPartBBox(nrawPartId, b3Raw)
|
||||||
Return vtPartRef.y
|
' calcolo distanza tra origine pezzo e tavolo
|
||||||
|
Dim vtPartRef As New Vector3d(b3Box.Min() - b3Raw.Min())
|
||||||
|
m_dPOSY = vtPartRef.y
|
||||||
|
Return vtPartRef.y
|
||||||
|
' altrimenti restituisco valore salvato (per quando viene clickato un BTLPart)
|
||||||
|
Else
|
||||||
|
Return m_dPOSY
|
||||||
|
End If
|
||||||
'Return m_dPOSY
|
'Return m_dPOSY
|
||||||
End Get
|
End Get
|
||||||
Set(value As Double)
|
Set(value As Double)
|
||||||
@@ -292,13 +316,13 @@ Public Class PartM
|
|||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
Protected m_bFLIP As Boolean
|
Protected m_nFLIP As Integer
|
||||||
Public Property bFLIP As Boolean
|
Public Property nFLIP As Integer
|
||||||
Get
|
Get
|
||||||
Return m_bFLIP
|
Return m_nFLIP
|
||||||
End Get
|
End Get
|
||||||
Set(value As Boolean)
|
Set(value As Integer)
|
||||||
m_bFLIP = value
|
m_nFLIP = value
|
||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
@@ -359,7 +383,7 @@ Public Class PartM
|
|||||||
Protected m_sCALC_MSG As String = String.Empty
|
Protected m_sCALC_MSG As String = String.Empty
|
||||||
Public Property sCALC_MSG As String
|
Public Property sCALC_MSG As String
|
||||||
Get
|
Get
|
||||||
Return m_sCALC_MSG
|
Return MessageFromLuaMsg(m_sCALC_MSG)
|
||||||
End Get
|
End Get
|
||||||
Set(value As String)
|
Set(value As String)
|
||||||
m_sCALC_MSG = value
|
m_sCALC_MSG = value
|
||||||
@@ -456,6 +480,7 @@ Public Class PartM
|
|||||||
EgtGetInfo(nPartId, BTL_PRT_H, NewPartM.m_dBtlH)
|
EgtGetInfo(nPartId, BTL_PRT_H, NewPartM.m_dBtlH)
|
||||||
EgtGetInfo(nPartId, BTL_PRT_CNT, NewPartM.m_nCNT)
|
EgtGetInfo(nPartId, BTL_PRT_CNT, NewPartM.m_nCNT)
|
||||||
EgtGetInfo(nPartId, BTL_PRT_GROUP, NewPartM.m_sGROUP)
|
EgtGetInfo(nPartId, BTL_PRT_GROUP, NewPartM.m_sGROUP)
|
||||||
|
EgtGetInfo(nPartId, BTL_PRT_STOREY, NewPartM.m_sSTOREY)
|
||||||
EgtGetInfo(nPartId, BTL_PRT_MATERIAL, NewPartM.m_sMATERIAL)
|
EgtGetInfo(nPartId, BTL_PRT_MATERIAL, NewPartM.m_sMATERIAL)
|
||||||
Dim nTemp As Integer = 0
|
Dim nTemp As Integer = 0
|
||||||
If Not EgtGetInfo(nPartId, BTL_PRT_ROTATED, nTemp) Then
|
If Not EgtGetInfo(nPartId, BTL_PRT_ROTATED, nTemp) Then
|
||||||
@@ -490,7 +515,7 @@ Public Class PartM
|
|||||||
EgtGetInfo(nPartId, MGR_PRT_POSX, NewPartM.m_dPOSX)
|
EgtGetInfo(nPartId, MGR_PRT_POSX, NewPartM.m_dPOSX)
|
||||||
EgtGetInfo(nPartId, MGR_PRT_POSY, NewPartM.m_dPOSY)
|
EgtGetInfo(nPartId, MGR_PRT_POSY, NewPartM.m_dPOSY)
|
||||||
EgtGetInfo(nPartId, MGR_PRT_ROT, NewPartM.m_dROT)
|
EgtGetInfo(nPartId, MGR_PRT_ROT, NewPartM.m_dROT)
|
||||||
EgtGetInfo(nPartId, MGR_PRT_FLIP, NewPartM.m_bFLIP)
|
EgtGetInfo(nPartId, MGR_PRT_FLIP, NewPartM.m_nFLIP)
|
||||||
End If
|
End If
|
||||||
' leggo volume
|
' leggo volume
|
||||||
If Not EgtGetInfo(nPartId, BTL_PRT_VOLUME, NewPartM.dVolume) Then
|
If Not EgtGetInfo(nPartId, BTL_PRT_VOLUME, NewPartM.dVolume) Then
|
||||||
|
|||||||
@@ -47,6 +47,18 @@ Public MustInherit Class MyMachGroupPanelVM
|
|||||||
End Get
|
End Get
|
||||||
End Property
|
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
|
Public ReadOnly Property dRemainingTime As String
|
||||||
Get
|
Get
|
||||||
Return m_MachGroupVMList.Sum(CType(Function(x As MyMachGroupVM) If(x.nProduction_State < ItemState.Produced, x.nCALC_TIME, 0), Func(Of MachGroupVM, Double)))
|
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
|
Return True
|
||||||
End Function
|
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()
|
'Public Overrides Sub AddMachGroup()
|
||||||
' Dim MyMachGroupM As MyMachGroupM = m_MyMachGroupPanelM.NewMyMachGroup(CurrentMachine.sMachineName, Map.refProjectVM.BTLStructureVM.nPROJTYPE)
|
' Dim MyMachGroupM As MyMachGroupM = m_MyMachGroupPanelM.NewMyMachGroup(CurrentMachine.sMachineName, Map.refProjectVM.BTLStructureVM.nPROJTYPE)
|
||||||
' ' e lo seleziono
|
' ' e lo seleziono
|
||||||
@@ -113,7 +140,7 @@ Public MustInherit Class MyMachGroupPanelVM
|
|||||||
SelMachGroup.SelPart = Nothing
|
SelMachGroup.SelPart = Nothing
|
||||||
' Imposto vista solo tavola
|
' Imposto vista solo tavola
|
||||||
EgtSetMachineLook(MCH_LOOK.TAB)
|
EgtSetMachineLook(MCH_LOOK.TAB)
|
||||||
Core.ViewPanelVM.BWSetView(VT.TOP, False)
|
Core.ViewPanelVM.BWSetView(If(ViewPanelVM.Type = BWType.BEAM, VT.ISO_SW, VT.TOP), False)
|
||||||
EgtZoom(ZM.ALL)
|
EgtZoom(ZM.ALL)
|
||||||
Return True
|
Return True
|
||||||
End Function
|
End Function
|
||||||
|
|||||||
@@ -85,13 +85,13 @@ Public MustInherit Class MyMachGroupVM
|
|||||||
|
|
||||||
Public ReadOnly Property dUsage As Double
|
Public ReadOnly Property dUsage As Double
|
||||||
Get
|
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 Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
Public ReadOnly Property dWaste As Double
|
Public ReadOnly Property dWaste As Double
|
||||||
Get
|
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 Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ Public MustInherit Class MyMachGroupVM
|
|||||||
|
|
||||||
Public ReadOnly Property sWaste As String
|
Public ReadOnly Property sWaste As String
|
||||||
Get
|
Get
|
||||||
Return DoubleToString(dWaste, 3)
|
Return LenToString(dWaste, 3)
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
@@ -235,6 +235,12 @@ Public MustInherit Class MyMachGroupVM
|
|||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
Public ReadOnly Property nPartsGlobalState As CalcStates
|
||||||
|
Get
|
||||||
|
Return MyMachGroupM.bCALC_PartsGlobalState
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
Public Property nCALC_State As CalcStates
|
Public Property nCALC_State As CalcStates
|
||||||
Get
|
Get
|
||||||
Return MyMachGroupM.nCALC_State
|
Return MyMachGroupM.nCALC_State
|
||||||
@@ -431,18 +437,6 @@ Public MustInherit Class MyMachGroupVM
|
|||||||
Public Sub SetSupervisorId(SupervisorId As String)
|
Public Sub SetSupervisorId(SupervisorId As String)
|
||||||
m_SupervisorId = SupervisorId
|
m_SupervisorId = SupervisorId
|
||||||
End Sub
|
End Sub
|
||||||
Public Sub ResetSupervisorId()
|
|
||||||
' resetto stato per MachGroup
|
|
||||||
nProduction_State = ItemState.ND
|
|
||||||
m_SupervisorId = ""
|
|
||||||
NotifyPropertyChanged(NameOf(IsReadOnly))
|
|
||||||
NotifyPropertyChanged(NameOf(Background))
|
|
||||||
' resetto stato per tutti i Part
|
|
||||||
For Each Part In PartVMList
|
|
||||||
Part.nProduction_State = ItemState.ND
|
|
||||||
Part.NotifyPropertyChanged(NameOf(Part.Background))
|
|
||||||
Next
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Private m_cc As StateChangeEventArgs
|
Private m_cc As StateChangeEventArgs
|
||||||
|
|
||||||
@@ -487,13 +481,25 @@ Public MustInherit Class MyMachGroupVM
|
|||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Sub UpdateUsage()
|
Public Sub UpdateUsage()
|
||||||
MyMachGroupM.SetTotMat(dL * dH * dW)
|
If nType = BWType.BEAM Then
|
||||||
MyMachGroupM.SetMatForPart(0)
|
MyMachGroupM.SetMatForPart(0)
|
||||||
Dim dPartVolume As Double
|
Dim dPartLength As Double
|
||||||
For Each Part In PartVMList
|
Dim dPartOffsetLength As Double
|
||||||
dPartVolume += Part.dVolume
|
For Each Part In PartVMList
|
||||||
Next
|
dPartOffsetLength += Part.dL + Part.dOffset
|
||||||
MyMachGroupM.SetMatForPart(dPartVolume)
|
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(sUsage))
|
||||||
NotifyPropertyChanged(NameOf(sWaste))
|
NotifyPropertyChanged(NameOf(sWaste))
|
||||||
End Sub
|
End Sub
|
||||||
@@ -551,6 +557,8 @@ Public MustInherit Class MyMachGroupVM
|
|||||||
Public Overridable Sub CalcGlobalUpdate()
|
Public Overridable Sub CalcGlobalUpdate()
|
||||||
MyMachGroupM.nCALC_GlobalERR = nCALC_ERR
|
MyMachGroupM.nCALC_GlobalERR = nCALC_ERR
|
||||||
MyMachGroupM.nCALC_GlobalState = nCALC_State
|
MyMachGroupM.nCALC_GlobalState = nCALC_State
|
||||||
|
' stato globale dei pezzi
|
||||||
|
MyMachGroupM.bCALC_PartsGlobalState = CalcStates.NOTCALCULATED
|
||||||
For Each Part In MyMachGroupM.PartMList
|
For Each Part In MyMachGroupM.PartMList
|
||||||
If Part.nCALC_GlobalState = CalcStates.NOTCALCULATED And nCALC_State < CalcStates.ERROR_ Then
|
If Part.nCALC_GlobalState = CalcStates.NOTCALCULATED And nCALC_State < CalcStates.ERROR_ Then
|
||||||
MyMachGroupM.nCALC_GlobalState = Part.nCALC_GlobalState
|
MyMachGroupM.nCALC_GlobalState = Part.nCALC_GlobalState
|
||||||
@@ -560,6 +568,9 @@ Public MustInherit Class MyMachGroupVM
|
|||||||
MyMachGroupM.nCALC_GlobalState = Part.nCALC_GlobalState
|
MyMachGroupM.nCALC_GlobalState = Part.nCALC_GlobalState
|
||||||
MyMachGroupM.nCALC_GlobalERR = Part.nCALC_GlobalERR
|
MyMachGroupM.nCALC_GlobalERR = Part.nCALC_GlobalERR
|
||||||
End If
|
End If
|
||||||
|
If Part.nCALC_GlobalState > MyMachGroupM.bCALC_PartsGlobalState Then
|
||||||
|
MyMachGroupM.bCALC_PartsGlobalState = Part.nCALC_GlobalState
|
||||||
|
End If
|
||||||
If Part.nCALC_ROT <> 0 Then
|
If Part.nCALC_ROT <> 0 Then
|
||||||
MyMachGroupM.m_nCALC_ROT = Part.nCALC_ROT
|
MyMachGroupM.m_nCALC_ROT = Part.nCALC_ROT
|
||||||
End If
|
End If
|
||||||
@@ -567,6 +578,7 @@ Public MustInherit Class MyMachGroupVM
|
|||||||
MyMachGroupM.nCALC_FALL = Part.nCALC_FALL
|
MyMachGroupM.nCALC_FALL = Part.nCALC_FALL
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
|
|
||||||
NotifyPropertyChanged(NameOf(Calc_Background))
|
NotifyPropertyChanged(NameOf(Calc_Background))
|
||||||
NotifyPropertyChanged(NameOf(CALC_FALL_Visibility))
|
NotifyPropertyChanged(NameOf(CALC_FALL_Visibility))
|
||||||
NotifyPropertyChanged(NameOf(CALC_ROT_Visibility))
|
NotifyPropertyChanged(NameOf(CALC_ROT_Visibility))
|
||||||
|
|||||||
@@ -162,6 +162,18 @@ Public MustInherit Class PartVM
|
|||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
Public ReadOnly Property sSTOREY As String
|
||||||
|
Get
|
||||||
|
Return m_PartM.sSTOREY
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Public ReadOnly Property sGROUP As String
|
||||||
|
Get
|
||||||
|
Return m_PartM.sGROUP
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
Public ReadOnly Property dVolume As Double
|
Public ReadOnly Property dVolume As Double
|
||||||
Get
|
Get
|
||||||
Return m_PartM.dVolume
|
Return m_PartM.dVolume
|
||||||
@@ -248,12 +260,12 @@ Public MustInherit Class PartVM
|
|||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
Public Overridable Property bFLIP As Boolean
|
Public Overridable Property nFLIP As Integer
|
||||||
Get
|
Get
|
||||||
Return m_PartM.bFLIP
|
Return m_PartM.nFLIP
|
||||||
End Get
|
End Get
|
||||||
Set(value As Boolean)
|
Set(value As Integer)
|
||||||
m_PartM.bFLIP = value
|
m_PartM.nFLIP = value
|
||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
|||||||
@@ -35,5 +35,5 @@ Imports System.Runtime.InteropServices
|
|||||||
' by using the '*' as shown below:
|
' by using the '*' as shown below:
|
||||||
' <Assembly: AssemblyVersion("1.0.*")>
|
' <Assembly: AssemblyVersion("1.0.*")>
|
||||||
|
|
||||||
<Assembly: AssemblyVersion("2.4.1.3")>
|
<Assembly: AssemblyVersion("2.4.7.1")>
|
||||||
<Assembly: AssemblyFileVersion("2.4.1.3")>
|
<Assembly: AssemblyFileVersion("2.4.7.1")>
|
||||||
|
|||||||
@@ -65,7 +65,7 @@
|
|||||||
SelectionMode="Single"
|
SelectionMode="Single"
|
||||||
ScrollViewer.CanContentScroll="True"
|
ScrollViewer.CanContentScroll="True"
|
||||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||||
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
|
ScrollViewer.HorizontalScrollBarVisibility="Auto"
|
||||||
Margin="5"
|
Margin="5"
|
||||||
BindingColumns="{Binding ProjectColumns}">
|
BindingColumns="{Binding ProjectColumns}">
|
||||||
<DataGrid.Resources>
|
<DataGrid.Resources>
|
||||||
@@ -154,6 +154,7 @@
|
|||||||
</ListBox.ItemTemplate>-->
|
</ListBox.ItemTemplate>-->
|
||||||
<DataGrid.RowStyle>
|
<DataGrid.RowStyle>
|
||||||
<Style TargetType="DataGridRow">
|
<Style TargetType="DataGridRow">
|
||||||
|
<Setter Property="IsEnabled" Value="{Binding bIsEnabled}"/>
|
||||||
<EventSetter Event="MouseDoubleClick" Handler="ProjectList_MouseDoubleClick"/>
|
<EventSetter Event="MouseDoubleClick" Handler="ProjectList_MouseDoubleClick"/>
|
||||||
</Style>
|
</Style>
|
||||||
</DataGrid.RowStyle>
|
</DataGrid.RowStyle>
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ Public MustInherit Class OpenProjectFileDialogVM
|
|||||||
' ora setto il valore scelto come Tipo Filtro
|
' ora setto il valore scelto come Tipo Filtro
|
||||||
m_SelSearchColumn = value
|
m_SelSearchColumn = value
|
||||||
Select Case m_SelSearchColumn.Id
|
Select Case m_SelSearchColumn.Id
|
||||||
Case OpenProjFileColumn.ID, OpenProjFileColumn.BTLFILENAME, OpenProjFileColumn.LISTNAME
|
Case OpenProjFileColumn.ID, OpenProjFileColumn.BTLFILENAME, OpenProjFileColumn.LISTNAME, OpenProjFileColumn.MACHINE
|
||||||
SearchText_Visibility = Visibility.Visible
|
SearchText_Visibility = Visibility.Visible
|
||||||
SearchDate_Visibility = Visibility.Collapsed
|
SearchDate_Visibility = Visibility.Collapsed
|
||||||
Case OpenProjFileColumn.EXPORTDATE, OpenProjFileColumn.CREATEDATE
|
Case OpenProjFileColumn.EXPORTDATE, OpenProjFileColumn.CREATEDATE
|
||||||
@@ -168,6 +168,7 @@ Public MustInherit Class OpenProjectFileDialogVM
|
|||||||
LISTNAME = 3
|
LISTNAME = 3
|
||||||
EXPORTDATE = 4
|
EXPORTDATE = 4
|
||||||
CREATEDATE = 5
|
CREATEDATE = 5
|
||||||
|
MACHINE = 6
|
||||||
End Enum
|
End Enum
|
||||||
|
|
||||||
#Region "Messages"
|
#Region "Messages"
|
||||||
@@ -257,7 +258,8 @@ Public MustInherit Class OpenProjectFileDialogVM
|
|||||||
New IdNameStruct(OpenProjFileColumn.BTLFILENAME, BTLFileName_Msg),
|
New IdNameStruct(OpenProjFileColumn.BTLFILENAME, BTLFileName_Msg),
|
||||||
New IdNameStruct(OpenProjFileColumn.LISTNAME, ListName_Msg),
|
New IdNameStruct(OpenProjFileColumn.LISTNAME, ListName_Msg),
|
||||||
New IdNameStruct(OpenProjFileColumn.EXPORTDATE, ExportDate_Msg),
|
New IdNameStruct(OpenProjFileColumn.EXPORTDATE, ExportDate_Msg),
|
||||||
New IdNameStruct(OpenProjFileColumn.CREATEDATE, CreateDate_Msg)})
|
New IdNameStruct(OpenProjFileColumn.CREATEDATE, CreateDate_Msg),
|
||||||
|
New IdNameStruct(OpenProjFileColumn.MACHINE, Machine_Msg)})
|
||||||
ElseIf ProjectType = ProjectType.PROD Then
|
ElseIf ProjectType = ProjectType.PROD Then
|
||||||
' carico le colonne della datagrid
|
' carico le colonne della datagrid
|
||||||
GetPrivateProfileColumns(S_OPENPROJFILEDLG_PROD, ProjectColumns)
|
GetPrivateProfileColumns(S_OPENPROJFILEDLG_PROD, ProjectColumns)
|
||||||
@@ -265,18 +267,27 @@ Public MustInherit Class OpenProjectFileDialogVM
|
|||||||
m_SearchColumnList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(OpenProjFileColumn.NULL, ""),
|
m_SearchColumnList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(OpenProjFileColumn.NULL, ""),
|
||||||
New IdNameStruct(OpenProjFileColumn.ID, Id_Msg),
|
New IdNameStruct(OpenProjFileColumn.ID, Id_Msg),
|
||||||
New IdNameStruct(OpenProjFileColumn.BTLFILENAME, BTLFileName_Msg),
|
New IdNameStruct(OpenProjFileColumn.BTLFILENAME, BTLFileName_Msg),
|
||||||
New IdNameStruct(OpenProjFileColumn.CREATEDATE, CreateDate_Msg)})
|
New IdNameStruct(OpenProjFileColumn.CREATEDATE, CreateDate_Msg),
|
||||||
|
New IdNameStruct(OpenProjFileColumn.MACHINE, Machine_Msg)})
|
||||||
End If
|
End If
|
||||||
|
' setto la visibilità delle colonne delle EgtDataGrid
|
||||||
|
For Each col In ProjectColumns
|
||||||
|
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
|
||||||
|
Next
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Friend Function VerifySelected() As Boolean
|
Friend Function VerifySelected() As Boolean
|
||||||
If IsNothing(SelProject) Then Return False
|
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 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
|
' verifico se esiste ProdId
|
||||||
AllFilesInDir = IO.Directory.EnumerateFiles(SelProject.sProjDirPath)
|
AllFilesInDir = Directory.EnumerateFiles(SelProject.sProjDirPath)
|
||||||
ElseIf m_ProjectType = Core.ConstBeam.ProjectType.PROD Then
|
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
|
End If
|
||||||
For Each File In AllFilesInDir
|
For Each File In AllFilesInDir
|
||||||
If Path.GetExtension(File).ToLower() = ".nge" Then
|
If Path.GetExtension(File).ToLower() = ".nge" Then
|
||||||
@@ -296,14 +307,16 @@ Public MustInherit Class OpenProjectFileDialogVM
|
|||||||
If m_SelSearchColumn.Id <> OpenProjFileColumn.NULL AndAlso m_SearchText <> String.Empty AndAlso (
|
If m_SelSearchColumn.Id <> OpenProjFileColumn.NULL AndAlso m_SearchText <> String.Empty AndAlso (
|
||||||
(m_SelSearchColumn.Id = OpenProjFileColumn.ID AndAlso CurrProj.sProjId.ToString.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
|
(m_SelSearchColumn.Id = OpenProjFileColumn.ID AndAlso CurrProj.sProjId.ToString.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
|
||||||
(m_SelSearchColumn.Id = OpenProjFileColumn.BTLFILENAME AndAlso CurrProj.sBTLFileName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
|
(m_SelSearchColumn.Id = OpenProjFileColumn.BTLFILENAME AndAlso CurrProj.sBTLFileName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
|
||||||
(m_SelSearchColumn.Id = OpenProjFileColumn.LISTNAME AndAlso CurrProj.sListName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) Then bProjectOk = False
|
(m_SelSearchColumn.Id = OpenProjFileColumn.LISTNAME AndAlso CurrProj.sListName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
|
||||||
|
(m_SelSearchColumn.Id = OpenProjFileColumn.MACHINE AndAlso CurrProj.sMachine.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) Then bProjectOk = False
|
||||||
ElseIf m_ProjectType = ProjectType.PROD Then
|
ElseIf m_ProjectType = ProjectType.PROD Then
|
||||||
Dim CurrProj As ProdFileVM = DirectCast(Proj, ProdFileVM)
|
Dim CurrProj As ProdFileVM = DirectCast(Proj, ProdFileVM)
|
||||||
If m_SelSearchColumn.Id <> OpenProjFileColumn.NULL AndAlso (
|
If m_SelSearchColumn.Id <> OpenProjFileColumn.NULL AndAlso (
|
||||||
(m_SelSearchColumn.Id = OpenProjFileColumn.CREATEDATE AndAlso Not SearchDate.Contains(CurrProj.dtCreateDate.Date))) Then bProjectOk = False
|
(m_SelSearchColumn.Id = OpenProjFileColumn.CREATEDATE AndAlso Not SearchDate.Contains(CurrProj.dtCreateDate.Date))) Then bProjectOk = False
|
||||||
If m_SelSearchColumn.Id <> OpenProjFileColumn.NULL AndAlso m_SearchText <> String.Empty AndAlso (
|
If m_SelSearchColumn.Id <> OpenProjFileColumn.NULL AndAlso m_SearchText <> String.Empty AndAlso (
|
||||||
(m_SelSearchColumn.Id = OpenProjFileColumn.ID AndAlso CurrProj.sProdId.ToString.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
|
(m_SelSearchColumn.Id = OpenProjFileColumn.ID AndAlso CurrProj.sProdId.ToString.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
|
||||||
(m_SelSearchColumn.Id = OpenProjFileColumn.BTLFILENAME AndAlso CurrProj.sBTLFileName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) Then bProjectOk = False
|
(m_SelSearchColumn.Id = OpenProjFileColumn.BTLFILENAME AndAlso CurrProj.sBTLFileName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
|
||||||
|
(m_SelSearchColumn.Id = OpenProjFileColumn.MACHINE AndAlso CurrProj.sMachine.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) Then bProjectOk = False
|
||||||
End If
|
End If
|
||||||
Return bProjectOk
|
Return bProjectOk
|
||||||
End Function
|
End Function
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ Public Class ProdFileM
|
|||||||
Return New ProdFileM
|
Return New ProdFileM
|
||||||
End Function
|
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
|
Dim NewProjectFileM As New ProdFileM
|
||||||
NewProjectFileM.m_nProdId = nProdId
|
NewProjectFileM.m_nProdId = nProdId
|
||||||
NewProjectFileM.m_nProjIdList = nProjIdList
|
NewProjectFileM.m_nProjIdList = nProjIdList
|
||||||
@@ -35,6 +36,8 @@ Public Class ProdFileM
|
|||||||
NewProjectFileM.m_sName = sName
|
NewProjectFileM.m_sName = sName
|
||||||
NewProjectFileM.m_nType = nType
|
NewProjectFileM.m_nType = nType
|
||||||
NewProjectFileM.m_sMachine = sMachine
|
NewProjectFileM.m_sMachine = sMachine
|
||||||
|
NewProjectFileM.m_sLockedBy = sLockedBy
|
||||||
|
NewProjectFileM.m_dtLock = dtLock
|
||||||
Return NewProjectFileM
|
Return NewProjectFileM
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
|||||||
@@ -74,6 +74,26 @@ Public Class ProjectFileM
|
|||||||
End Set
|
End Set
|
||||||
End Property
|
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"
|
#Region "CONSTRUCTORS"
|
||||||
|
|
||||||
#End Region ' CONSTRUCTORS
|
#End Region ' CONSTRUCTORS
|
||||||
|
|||||||
@@ -58,6 +58,11 @@ Public Enum StatusMapOpType
|
|||||||
SupervisorReleaseStop = 11
|
SupervisorReleaseStop = 11
|
||||||
ResetPartStart = 12
|
ResetPartStart = 12
|
||||||
ResetPartEnd = 13
|
ResetPartEnd = 13
|
||||||
|
SetPartScrapped = 14
|
||||||
|
ChangeProdInSupervisorRequest = 15
|
||||||
|
ChangeProdInProdRequest = 16
|
||||||
|
OpenPageInViewOptimRequest = 17
|
||||||
|
MachGroupValidationUpdate = 18
|
||||||
End Enum
|
End Enum
|
||||||
|
|
||||||
Public Enum DimensionType
|
Public Enum DimensionType
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ Imports EgtWPFLib5
|
|||||||
Public Class GridDimension
|
Public Class GridDimension
|
||||||
Inherits VMBase
|
Inherits VMBase
|
||||||
|
|
||||||
|
Private Shared m_SoftwareModActive As Boolean = False
|
||||||
|
|
||||||
Private Property m_GridName As String
|
Private Property m_GridName As String
|
||||||
Public Property GridName As String
|
Public Property GridName As String
|
||||||
Get
|
Get
|
||||||
@@ -43,7 +45,7 @@ Public Class GridDimension
|
|||||||
End Get
|
End Get
|
||||||
Set(value As GridLength)
|
Set(value As GridLength)
|
||||||
m_GridLen = value
|
m_GridLen = value
|
||||||
DimensionsIniFile.SaveGridDimensions(GridName, GridDimensions)
|
If Not m_SoftwareModActive Then DimensionsIniFile.SaveGridDimensions(GridName, GridDimensions)
|
||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
@@ -64,4 +66,8 @@ Public Class GridDimension
|
|||||||
m_GridLen = GridLen
|
m_GridLen = GridLen
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Public Shared Sub SetSoftwareMod(bActive As Boolean)
|
||||||
|
m_SoftwareModActive = bActive
|
||||||
|
End Sub
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
Imports EgtUILib
|
||||||
|
|
||||||
|
Public Module LuaMsgManager
|
||||||
|
|
||||||
|
Public Function MessageFromLuaMsg(LuaMsg As String) As String
|
||||||
|
' verifico se inizia con $$
|
||||||
|
If Not String.IsNullOrWhiteSpace(LuaMsg) AndAlso LuaMsg.Length >= 2 AndAlso LuaMsg.Substring(0, 2) = "$$" Then
|
||||||
|
Dim sMsgArgs() As String = LuaMsg.Substring(2).Split(",")
|
||||||
|
Dim nMsg As Integer = -1
|
||||||
|
If sMsgArgs.Count > 1 AndAlso Integer.TryParse(sMsgArgs(0), nMsg) AndAlso nMsg > 0 Then
|
||||||
|
If sMsgArgs.Count > 1 Then
|
||||||
|
Dim sArgs() As String = sMsgArgs.Skip(1).ToArray()
|
||||||
|
Dim sMsg As String = String.Format(EgtMsg(65000 + nMsg), sArgs)
|
||||||
|
If Not String.IsNullOrWhiteSpace(sMsg) Then
|
||||||
|
Return sMsg
|
||||||
|
Else
|
||||||
|
Return EgtMsg(65000 + nMsg)
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
Return EgtMsg(65000 + nMsg)
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
Return LuaMsg
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
Return LuaMsg
|
||||||
|
End If
|
||||||
|
Return ""
|
||||||
|
End Function
|
||||||
|
|
||||||
|
End Module
|
||||||
@@ -2,6 +2,19 @@
|
|||||||
|
|
||||||
#Region "Private Fields"
|
#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_AlarmCode As String
|
||||||
Private m_AlarmDateTime As DateTime
|
Private m_AlarmDateTime As DateTime
|
||||||
Private m_AlarmMessage As String
|
Private m_AlarmMessage As String
|
||||||
@@ -11,15 +24,74 @@
|
|||||||
Private m_CommandState As CommandStates
|
Private m_CommandState As CommandStates
|
||||||
Private m_CommandType As LogCommandTypes
|
Private m_CommandType As LogCommandTypes
|
||||||
Private m_Description As String
|
Private m_Description As String
|
||||||
|
|
||||||
Private m_newOpState As Integer
|
Private m_newOpState As Integer
|
||||||
|
|
||||||
Private m_ResultType As ResultTypes
|
Private m_ResultType As ResultTypes
|
||||||
|
|
||||||
Private m_VarAddress As String
|
Private m_VarAddress As String
|
||||||
|
|
||||||
Private m_VarValue 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
|
#End Region
|
||||||
|
|
||||||
#Region "Protected Constructors"
|
#Region "Protected Constructors"
|
||||||
@@ -165,11 +237,20 @@
|
|||||||
Return NewMachLog
|
Return NewMachLog
|
||||||
End Function
|
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
|
#End Region
|
||||||
|
|
||||||
#Region "Public Methods"
|
#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
|
Dim NewMachLog As New MachLog
|
||||||
NewMachLog.m_AlarmCode = AlarmCode
|
NewMachLog.m_AlarmCode = AlarmCode
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
Imports System.Runtime.InteropServices
|
Imports System.Runtime.InteropServices
|
||||||
|
|
||||||
Module ManageWindow
|
Public Module ManageWindow
|
||||||
|
|
||||||
|
|
||||||
<DllImport("user32.dll")>
|
<DllImport("user32.dll")>
|
||||||
@@ -41,7 +41,7 @@ Module ManageWindow
|
|||||||
Public rcNormalPosition As System.Drawing.Rectangle
|
Public rcNormalPosition As System.Drawing.Rectangle
|
||||||
End Structure
|
End Structure
|
||||||
|
|
||||||
Friend Sub BringWindowToFront(wdwIntPtr As IntPtr)
|
Public Sub BringWindowToFront(wdwIntPtr As IntPtr)
|
||||||
'Dim wdwIntPtr As IntPtr = FindWindow(Nothing, "0016 - EgtBEAMWALL")
|
'Dim wdwIntPtr As IntPtr = FindWindow(Nothing, "0016 - EgtBEAMWALL")
|
||||||
Dim placement As Windowplacement = New Windowplacement()
|
Dim placement As Windowplacement = New Windowplacement()
|
||||||
GetWindowPlacement(wdwIntPtr, placement)
|
GetWindowPlacement(wdwIntPtr, placement)
|
||||||
@@ -6,71 +6,91 @@ Public Class ViewPanelVM
|
|||||||
|
|
||||||
' Tipo di progetto aperto
|
' Tipo di progetto aperto
|
||||||
Private Shared m_Type As BWType
|
Private Shared m_Type As BWType
|
||||||
|
Public Shared ReadOnly Property Type As BWType
|
||||||
|
Get
|
||||||
|
Return m_Type
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
' Posizione vista
|
' Posizione vista
|
||||||
Private Shared m_nViewDir As VT
|
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
|
' condizioni che cambiano la vista del progetto
|
||||||
Select Case m_Type
|
'Select Case m_Type
|
||||||
Case BWType.BEAM
|
' Case BWType.BEAM
|
||||||
EgtSetView(VT.ISO_SW, bRedraw)
|
' Select Case nView
|
||||||
Case BWType.WALL
|
' Case VT.TOP
|
||||||
Select Case nView
|
' EgtSetView(VT.TOP, bRedraw)
|
||||||
Case VT.TOP
|
' Case VT.FRONT
|
||||||
Select Case m_nViewDir
|
' EgtSetView(VT.FRONT, bRedraw)
|
||||||
Case VT.ISO_SW, VT.ISO_SE
|
' Case VT.BACK
|
||||||
EgtSetGenericView(0, -90, bRedraw) ' equivalente a vista TOP
|
' EgtSetView(VT.BACK, bRedraw)
|
||||||
Case VT.ISO_NW, VT.ISO_NE
|
' Case VT.RIGHT
|
||||||
EgtSetGenericView(0, 90, bRedraw) ' equivalente a vista TOP ruotata di 180 su Z
|
' EgtSetView(VT.RIGHT, bRedraw)
|
||||||
End Select
|
' Case VT.LEFT
|
||||||
Case VT.FRONT
|
' EgtSetView(VT.LEFT, bRedraw)
|
||||||
Select Case m_nViewDir
|
' Case VT.ISO_SW
|
||||||
Case VT.ISO_SW, VT.ISO_SE
|
' EgtSetView(VT.ISO_SW, bRedraw)
|
||||||
EgtSetGenericView(90, -90, bRedraw) ' equivalente a vista FRONT
|
' Case Else ' VT.ISO_SW
|
||||||
Case VT.ISO_NW, VT.ISO_NE
|
' EgtSetView(VT.ISO_SW, bRedraw)
|
||||||
EgtSetGenericView(90, 90, bRedraw) ' equivalente a vista FRONT ruotata di 180 su Z
|
' End Select
|
||||||
End Select
|
' Case BWType.WALL
|
||||||
Case VT.BACK
|
Select Case nView
|
||||||
Select Case m_nViewDir
|
Case VT.TOP
|
||||||
Case VT.ISO_SW, VT.ISO_SE
|
Select Case m_nViewDir
|
||||||
EgtSetGenericView(-90, -90, bRedraw) ' equivalente a vista BACK
|
Case VT.ISO_SW, VT.ISO_SE
|
||||||
Case VT.ISO_NW, VT.ISO_NE
|
EgtSetGenericView(0, -90, bRedraw) ' equivalente a vista TOP
|
||||||
EgtSetGenericView(-90, 90, bRedraw) ' equivalente a vista BACK ruotata di 180 su Z
|
Case VT.ISO_NW, VT.ISO_NE
|
||||||
End Select
|
EgtSetGenericView(0, 90, bRedraw) ' equivalente a vista TOP ruotata di 180 su Z
|
||||||
Case VT.RIGHT
|
End Select
|
||||||
Select Case m_nViewDir
|
Case VT.FRONT
|
||||||
Case VT.ISO_SW, VT.ISO_SE
|
Select Case m_nViewDir
|
||||||
EgtSetGenericView(90, 0, bRedraw) ' equivalente a vista RIGHT
|
Case VT.ISO_SW, VT.ISO_SE
|
||||||
Case VT.ISO_NW, VT.ISO_NE
|
EgtSetGenericView(90, -90, bRedraw) ' equivalente a vista FRONT
|
||||||
EgtSetGenericView(-90, 0, bRedraw) ' equivalente a vista RIGHT ruotata di 180 su Z
|
Case VT.ISO_NW, VT.ISO_NE
|
||||||
End Select
|
EgtSetGenericView(90, 90, bRedraw) ' equivalente a vista FRONT ruotata di 180 su Z
|
||||||
Case VT.LEFT
|
End Select
|
||||||
Select Case m_nViewDir
|
Case VT.BACK
|
||||||
Case VT.ISO_SW, VT.ISO_SE
|
Select Case m_nViewDir
|
||||||
EgtSetGenericView(-90, 0, bRedraw) ' equivalente a vista LEFT
|
Case VT.ISO_SW, VT.ISO_SE
|
||||||
Case VT.ISO_NW, VT.ISO_NE
|
EgtSetGenericView(-90, -90, bRedraw) ' equivalente a vista BACK
|
||||||
EgtSetGenericView(90, 0, bRedraw) ' equivalente a vista LEFT ruotata di 180 su Z
|
Case VT.ISO_NW, VT.ISO_NE
|
||||||
End Select
|
EgtSetGenericView(-90, 90, bRedraw) ' equivalente a vista BACK ruotata di 180 su Z
|
||||||
Case VT.ISO_SW
|
End Select
|
||||||
Select Case m_nViewDir
|
Case VT.RIGHT
|
||||||
Case VT.ISO_SW, VT.ISO_SE
|
Select Case m_nViewDir
|
||||||
EgtSetGenericView(60, 225, bRedraw) ' equivalente a vista ISO_SW
|
Case VT.ISO_SW, VT.ISO_SE
|
||||||
Case VT.ISO_NW, VT.ISO_NE
|
EgtSetGenericView(90, 0, bRedraw) ' equivalente a vista RIGHT
|
||||||
EgtSetGenericView(60, 45, bRedraw) ' equivalente a vista ISO_SW ruotata di 180 su Z
|
Case VT.ISO_NW, VT.ISO_NE
|
||||||
End Select
|
EgtSetGenericView(-90, 0, bRedraw) ' equivalente a vista RIGHT ruotata di 180 su Z
|
||||||
Case Else ' VT.ISO_SW
|
End Select
|
||||||
Select Case m_nViewDir
|
Case VT.LEFT
|
||||||
Case VT.ISO_SW, VT.ISO_SE
|
Select Case m_nViewDir
|
||||||
EgtSetGenericView(60, 225, bRedraw) ' equivalente a vista ISO_SW
|
Case VT.ISO_SW, VT.ISO_SE
|
||||||
Case VT.ISO_NW, VT.ISO_NE
|
EgtSetGenericView(-90, 0, bRedraw) ' equivalente a vista LEFT
|
||||||
EgtSetGenericView(60, 45, bRedraw) ' equivalente a vista ISO_SW ruotata di 180 su Z
|
Case VT.ISO_NW, VT.ISO_NE
|
||||||
End Select
|
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 Select
|
End Select
|
||||||
End Function
|
'End Select
|
||||||
|
End Sub
|
||||||
|
|
||||||
Public Shared Sub UpdateMachParam(ViewDir As Integer)
|
Public Shared Sub UpdateMachParam(ViewDir As VT)
|
||||||
m_nViewDir = ViewDir
|
m_nViewDir = ViewDir
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|||||||
@@ -1,26 +1,21 @@
|
|||||||
using System;
|
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||||
using System.Collections.Generic;
|
using EgtBEAMWALL.DataLayer.Migrations;
|
||||||
|
using MySql.Data.EntityFramework;
|
||||||
|
using System;
|
||||||
using System.Data.Entity;
|
using System.Data.Entity;
|
||||||
using System.Data.Entity.Migrations;
|
using System.Data.Entity.Migrations;
|
||||||
using MySql.Data.Entity;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
|
||||||
using EgtBEAMWALL.DataLayer.Migrations;
|
|
||||||
using System.ServiceProcess;
|
using System.ServiceProcess;
|
||||||
using System.IO;
|
|
||||||
using System.Data.Entity.Infrastructure;
|
|
||||||
|
|
||||||
namespace EgtBEAMWALL.DataLayer
|
namespace EgtBEAMWALL.DataLayer
|
||||||
{
|
{
|
||||||
[DbConfigurationType(typeof(MySqlEFConfiguration))]
|
[DbConfigurationType(typeof(MySqlEFConfiguration))]
|
||||||
//[DbConfigurationType(typeof(aMySqlConfiguration))]
|
|
||||||
public class AdminContext : DbContext
|
public class AdminContext : DbContext
|
||||||
{
|
{
|
||||||
#region Public Constructors
|
#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.")]
|
[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; }
|
public DbSet<UserPriv> UserList { get; set; }
|
||||||
|
|
||||||
#endregion Public Properties
|
#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,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<configSections>
|
<configSections>
|
||||||
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
|
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
|
||||||
@@ -8,21 +8,37 @@
|
|||||||
<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6" />
|
<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6" />
|
||||||
<providers>
|
<providers>
|
||||||
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
|
<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>
|
<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>
|
</entityFramework>
|
||||||
<connectionStrings>
|
<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" />
|
<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>
|
</connectionStrings>
|
||||||
<runtime>
|
<runtime>
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
|
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-6.10.9.0" newVersion="6.10.9.0" />
|
<bindingRedirect oldVersion="0.0.0.0-8.0.29.0" newVersion="8.0.29.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Google.Protobuf" publicKeyToken="a7d26565bac4d604" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-3.19.4.0" newVersion="3.19.4.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="K4os.Compression.LZ4.Streams" publicKeyToken="2186fa9121ef231d" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-1.2.6.0" newVersion="1.2.6.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="BouncyCastle.Crypto" publicKeyToken="0e99375e54769942" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-1.8.5.0" newVersion="1.8.5.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
</runtime>
|
</runtime>
|
||||||
|
|
||||||
<startup>
|
<startup>
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||||
</startup>
|
</startup>
|
||||||
|
|||||||
@@ -1,25 +1,17 @@
|
|||||||
using System;
|
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||||
|
using NLog;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
|
||||||
|
|
||||||
namespace EgtBEAMWALL.DataLayer.Controllers
|
namespace EgtBEAMWALL.DataLayer.Controllers
|
||||||
{
|
{
|
||||||
public class BTLPartController : IDisposable
|
public class BTLPartController : IDisposable
|
||||||
{
|
{
|
||||||
#region Private Fields
|
|
||||||
|
|
||||||
private DatabaseContext dbCtx;
|
|
||||||
|
|
||||||
#endregion Private Fields
|
|
||||||
|
|
||||||
#region Public Constructors
|
#region Public Constructors
|
||||||
|
|
||||||
public BTLPartController()
|
public BTLPartController()
|
||||||
{
|
{
|
||||||
// Initialize database context
|
|
||||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Public Constructors
|
#endregion Public Constructors
|
||||||
@@ -105,15 +97,19 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Add to database
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
dbCtx.BTLPartList.AddRange(partData);
|
{
|
||||||
// Commit changes
|
// Add to database
|
||||||
dbCtx.SaveChanges();
|
localDbCtx.BTLPartList.AddRange(partData);
|
||||||
ResetController();
|
// Commit changes
|
||||||
|
localDbCtx.SaveChanges();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception exc)
|
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;
|
return partData;
|
||||||
}
|
}
|
||||||
@@ -147,15 +143,19 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Add to database
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
dbCtx.BTLPartList.AddRange(partData);
|
{
|
||||||
// Commit changes
|
// Add to database
|
||||||
dbCtx.SaveChanges();
|
localDbCtx.BTLPartList.AddRange(partData);
|
||||||
ResetController();
|
// Commit changes
|
||||||
|
localDbCtx.SaveChanges();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception exc)
|
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;
|
return partData;
|
||||||
@@ -169,22 +169,26 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
public bool Delete(int PartDbId)
|
public bool Delete(int PartDbId)
|
||||||
{
|
{
|
||||||
bool done = false;
|
bool done = false;
|
||||||
var item2del = dbCtx
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
|
{
|
||||||
|
var item2del = localDbCtx
|
||||||
.BTLPartList
|
.BTLPartList
|
||||||
.Where(x => x.BTLPartDbId == PartDbId)
|
.Where(x => x.BTLPartDbId == PartDbId)
|
||||||
.SingleOrDefault();
|
.SingleOrDefault();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Add to database
|
// Add to database
|
||||||
dbCtx.BTLPartList.Remove(item2del);
|
localDbCtx.BTLPartList.Remove(item2del);
|
||||||
// Commit changes
|
// Commit changes
|
||||||
dbCtx.SaveChanges();
|
localDbCtx.SaveChanges();
|
||||||
ResetController();
|
done = true;
|
||||||
done = true;
|
}
|
||||||
}
|
catch (Exception exc)
|
||||||
catch (Exception exc)
|
{
|
||||||
{
|
string errMessage = $"EXCEPTION on BTLPart.Delete: {Environment.NewLine}{exc}";
|
||||||
Console.WriteLine($"EXCEPTION on Delete: {exc}");
|
Console.WriteLine(errMessage);
|
||||||
|
Log.Error(errMessage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return done;
|
return done;
|
||||||
}
|
}
|
||||||
@@ -197,29 +201,31 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
public bool DeleteByProject(int ProjDbId)
|
public bool DeleteByProject(int ProjDbId)
|
||||||
{
|
{
|
||||||
bool done = false;
|
bool done = false;
|
||||||
var items2del = dbCtx
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
|
{
|
||||||
|
var items2del = localDbCtx
|
||||||
.BTLPartList
|
.BTLPartList
|
||||||
.Where(x => x.ProjDbId == ProjDbId);
|
.Where(x => x.ProjDbId == ProjDbId);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Add to database
|
// Add to database
|
||||||
dbCtx.BTLPartList.RemoveRange(items2del);
|
localDbCtx.BTLPartList.RemoveRange(items2del);
|
||||||
// Commit changes
|
// Commit changes
|
||||||
dbCtx.SaveChanges();
|
localDbCtx.SaveChanges();
|
||||||
ResetController();
|
done = true;
|
||||||
done = true;
|
}
|
||||||
}
|
catch (Exception exc)
|
||||||
catch (Exception exc)
|
{
|
||||||
{
|
string errMessage = $"EXCEPTION on BTLPart.DeleteByProject: {Environment.NewLine}{exc}";
|
||||||
Console.WriteLine($"EXCEPTION on DeleteByProject: {exc}");
|
Console.WriteLine(errMessage);
|
||||||
|
Log.Error(errMessage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return done;
|
return done;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
// Clear database context
|
|
||||||
dbCtx.Dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -229,10 +235,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public BTLPartModel FindByDbId(int PartDbId)
|
public BTLPartModel FindByDbId(int PartDbId)
|
||||||
{
|
{
|
||||||
return dbCtx
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
|
{
|
||||||
|
return localDbCtx
|
||||||
.BTLPartList
|
.BTLPartList
|
||||||
.Where(x => x.BTLPartDbId == PartDbId)
|
.Where(x => x.BTLPartDbId == PartDbId)
|
||||||
.SingleOrDefault();
|
.SingleOrDefault();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -242,10 +251,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public BTLPartModel FindByPartId(int PartId)
|
public BTLPartModel FindByPartId(int PartId)
|
||||||
{
|
{
|
||||||
return dbCtx
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
|
{
|
||||||
|
return localDbCtx
|
||||||
.BTLPartList
|
.BTLPartList
|
||||||
.Where(x => x.PartId == PartId)
|
.Where(x => x.PartId == PartId)
|
||||||
.SingleOrDefault();
|
.SingleOrDefault();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -256,10 +268,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public BTLPartModel FindByPartIdProjDbId(int PartId, int ProjDbId)
|
public BTLPartModel FindByPartIdProjDbId(int PartId, int ProjDbId)
|
||||||
{
|
{
|
||||||
return dbCtx
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
|
{
|
||||||
|
return localDbCtx
|
||||||
.BTLPartList
|
.BTLPartList
|
||||||
.Where(x => x.PartId == PartId && x.ProjDbId == ProjDbId)
|
.Where(x => x.PartId == PartId && x.ProjDbId == ProjDbId)
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -269,12 +284,15 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<BTLPartModel> GetByProjectAsc(int ProjDbId)
|
public List<BTLPartModel> GetByProjectAsc(int ProjDbId)
|
||||||
{
|
{
|
||||||
// retrieve
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
return dbCtx
|
{
|
||||||
|
// retrieve
|
||||||
|
return localDbCtx
|
||||||
.BTLPartList
|
.BTLPartList
|
||||||
.Where(x => x.ProjDbId == ProjDbId)
|
.Where(x => x.ProjDbId == ProjDbId)
|
||||||
.OrderBy(x => x.BTLPartDbId)
|
.OrderBy(x => x.BTLPartDbId)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -284,12 +302,15 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<BTLPartModel> GetByProjectDesc(int ProjDbId)
|
public List<BTLPartModel> GetByProjectDesc(int ProjDbId)
|
||||||
{
|
{
|
||||||
// retrieve
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
return dbCtx
|
{
|
||||||
|
// retrieve
|
||||||
|
return localDbCtx
|
||||||
.BTLPartList
|
.BTLPartList
|
||||||
.Where(x => x.ProjDbId == ProjDbId)
|
.Where(x => x.ProjDbId == ProjDbId)
|
||||||
.OrderByDescending(x => x.BTLPartDbId)
|
.OrderByDescending(x => x.BTLPartDbId)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -300,17 +321,22 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<BTLPartModel> GetPaginatedAsc(int PartDbIdStart, int numRecord)
|
public List<BTLPartModel> GetPaginatedAsc(int PartDbIdStart, int numRecord)
|
||||||
{
|
{
|
||||||
|
List<BTLPartModel> answ = new List<BTLPartModel>();
|
||||||
int numEnd = PartDbIdStart - numRecord;
|
int numEnd = PartDbIdStart - numRecord;
|
||||||
// check numEnd
|
// check numEnd
|
||||||
if (numEnd < 0)
|
if (numEnd < 0)
|
||||||
numEnd = 0;
|
numEnd = 0;
|
||||||
// retrieve
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
return dbCtx
|
{
|
||||||
.BTLPartList
|
// retrieve
|
||||||
.Where(x => x.BTLPartDbId <= PartDbIdStart)
|
answ = localDbCtx
|
||||||
.OrderBy(x => x.BTLPartDbId)
|
.BTLPartList
|
||||||
.Take(numRecord)
|
.Where(x => x.BTLPartDbId <= PartDbIdStart)
|
||||||
.ToList();
|
.OrderBy(x => x.BTLPartDbId)
|
||||||
|
.Take(numRecord)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
return answ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -321,26 +347,22 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<BTLPartModel> GetPaginatedDesc(int PartDbIdStart, int numRecord)
|
public List<BTLPartModel> GetPaginatedDesc(int PartDbIdStart, int numRecord)
|
||||||
{
|
{
|
||||||
|
List<BTLPartModel> answ = new List<BTLPartModel>();
|
||||||
int numEnd = PartDbIdStart - numRecord;
|
int numEnd = PartDbIdStart - numRecord;
|
||||||
// check numEnd
|
// check numEnd
|
||||||
if (numEnd < 0)
|
if (numEnd < 0)
|
||||||
numEnd = 0;
|
numEnd = 0;
|
||||||
// retrieve
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
return dbCtx
|
{
|
||||||
.BTLPartList
|
// retrieve
|
||||||
.Where(x => x.BTLPartDbId <= PartDbIdStart)
|
answ = localDbCtx
|
||||||
.OrderByDescending(x => x.BTLPartDbId)
|
.BTLPartList
|
||||||
.Take(numRecord)
|
.Where(x => x.BTLPartDbId <= PartDbIdStart)
|
||||||
.ToList();
|
.OrderByDescending(x => x.BTLPartDbId)
|
||||||
}
|
.Take(numRecord)
|
||||||
|
.ToList();
|
||||||
/// <summary>
|
}
|
||||||
/// Reinizializzaizone del controller
|
return answ;
|
||||||
/// </summary>
|
|
||||||
public void ResetController()
|
|
||||||
{
|
|
||||||
// Re-Initialize database context
|
|
||||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -351,32 +373,44 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
public bool Update(BTLPartModel updItem)
|
public bool Update(BTLPartModel updItem)
|
||||||
{
|
{
|
||||||
bool done = false;
|
bool done = false;
|
||||||
var item2update = dbCtx
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
|
{
|
||||||
|
var item2update = localDbCtx
|
||||||
.BTLPartList
|
.BTLPartList
|
||||||
.Where(x => x.BTLPartDbId == updItem.BTLPartDbId)
|
.Where(x => x.BTLPartDbId == updItem.BTLPartDbId)
|
||||||
.SingleOrDefault();
|
.SingleOrDefault();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// update, vers 1...
|
// update, vers 1...
|
||||||
dbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||||
|
|
||||||
//// update, vers 2
|
//// update, vers 2
|
||||||
//dbCtx.BTLPartList.Remove(item2del);
|
//localDbCtx.BTLPartList.Remove(item2del);
|
||||||
//dbCtx.BTLPartList.Add(updItem);
|
//localDbCtx.BTLPartList.Add(updItem);
|
||||||
|
|
||||||
// Commit changes
|
// Commit changes
|
||||||
dbCtx.SaveChanges();
|
localDbCtx.SaveChanges();
|
||||||
done = true;
|
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;
|
return done;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Public Methods
|
#endregion Public Methods
|
||||||
|
|
||||||
|
#region Private Fields
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Istanza logger
|
||||||
|
/// </summary>
|
||||||
|
private NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,97 +1,128 @@
|
|||||||
using System;
|
using NLog;
|
||||||
using System.Collections.Generic;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Threading;
|
||||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
|
||||||
|
|
||||||
namespace EgtBEAMWALL.DataLayer.Controllers
|
namespace EgtBEAMWALL.DataLayer.Controllers
|
||||||
{
|
{
|
||||||
public class DbController : IDisposable
|
public class DbController : IDisposable
|
||||||
{
|
{
|
||||||
#region Private Fields
|
#region Public Fields
|
||||||
|
|
||||||
private AdminContext adbCtx;
|
/// <summary>
|
||||||
|
/// Singleton gestione
|
||||||
|
/// </summary>
|
||||||
|
public static DbController man = new DbController();
|
||||||
|
|
||||||
#endregion Private Fields
|
#endregion Public Fields
|
||||||
|
|
||||||
#region Public Fields
|
#region Public Constructors
|
||||||
|
|
||||||
/// <summary>
|
public DbController()
|
||||||
/// Singleton gestione
|
{
|
||||||
/// </summary>
|
// Initialize database context for ADMIN
|
||||||
public static DbController man = new DbController();
|
adbCtx = new AdminContext(DbConfig.ADMIN_CONNECTION_STRING);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion Public Fields
|
#endregion Public Constructors
|
||||||
|
|
||||||
#region Public Constructors
|
#region Public Methods
|
||||||
|
|
||||||
public DbController()
|
/// <summary>
|
||||||
{
|
/// Verifica necessità creazione utente (locale o in rete)
|
||||||
// Initialize database context for ADMIN
|
/// </summary>
|
||||||
adbCtx = new AdminContext(DbConfig.ADMIN_CONNECTION_STRING);
|
/// <param name="username"></param>
|
||||||
}
|
/// <param name="pwd"></param>
|
||||||
|
/// <param name="isNetwork"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool checkCreateUser(string username, string pwd, bool isNetwork)
|
||||||
|
{
|
||||||
|
bool answ = false;
|
||||||
|
string domain = isNetwork ? "%" : "localhost";
|
||||||
|
// ricerca utente...
|
||||||
|
var numUser = adbCtx
|
||||||
|
.UserList
|
||||||
|
.Where(x => x.User == username)
|
||||||
|
.ToList()
|
||||||
|
.Count;
|
||||||
|
if (numUser > 0)
|
||||||
|
{
|
||||||
|
answ = true;
|
||||||
|
}
|
||||||
|
if (!answ)
|
||||||
|
{
|
||||||
|
// creo utente
|
||||||
|
string sqlCommand = "FLUSH PRIVILEGES;";
|
||||||
|
//string sqlCommand = $"CREATE USER '{username}'@'{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);
|
||||||
|
Thread.Sleep(100);
|
||||||
|
sqlCommand = $"CREATE USER '{username}'@'{domain}' IDENTIFIED BY '{pwd}';";
|
||||||
|
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
|
||||||
|
Thread.Sleep(100);
|
||||||
|
sqlCommand = $"GRANT ALL ON *.* 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);
|
||||||
|
}
|
||||||
|
return answ;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion Public Constructors
|
/// <summary>
|
||||||
|
/// Migrazione esplicita del DB da parte dell'admin controller
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool checkMigrateDb()
|
||||||
|
{
|
||||||
|
return adbCtx.SetUpDbConnectionAndDbConfig();
|
||||||
|
}
|
||||||
|
|
||||||
#region Public Methods
|
public void Dispose()
|
||||||
|
{
|
||||||
|
// Clear database context
|
||||||
|
adbCtx.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
public bool checkCreateUser(string username, string pwd)
|
/// <summary>
|
||||||
{
|
/// ATTENZIONE!!!! Procedura di Reset del DB
|
||||||
bool answ = false;
|
/// </summary>
|
||||||
// ricerca utente...
|
/// <returns></returns>
|
||||||
var numUser = adbCtx
|
public bool ResetDb()
|
||||||
.UserList
|
{
|
||||||
.Where(x => x.User == username)
|
bool answ = false;
|
||||||
.ToList()
|
|
||||||
.Count;
|
|
||||||
if (numUser > 0)
|
|
||||||
{
|
|
||||||
answ = true;
|
|
||||||
}
|
|
||||||
if (!answ)
|
|
||||||
{
|
|
||||||
// creo utente
|
|
||||||
string sqlCommand = "FLUSH PRIVILEGES;";
|
|
||||||
//string sqlCommand = $"CREATE USER '{username}'@'localhost' IDENTIFIED BY '{pwd}'; GRANT ALL ON *.* TO '{username}'@'localhost'; FLUSH PRIVILEGES;";
|
|
||||||
//string sqlCommand = $"CREATE USER '{username}'@'localhost' IDENTIFIED BY '{pwd}'; GRANT ALL ON *.* TO '{username}'@'localhost'; FLUSH PRIVILEGES;";
|
|
||||||
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
|
|
||||||
sqlCommand = $"CREATE USER '{username}'@'localhost' IDENTIFIED BY '{pwd}';";
|
|
||||||
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
|
|
||||||
sqlCommand = $"GRANT ALL ON *.* TO '{username}'@'localhost';";
|
|
||||||
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
|
|
||||||
sqlCommand = "FLUSH PRIVILEGES;";
|
|
||||||
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
|
|
||||||
}
|
|
||||||
return answ;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
try
|
||||||
{
|
{
|
||||||
// Clear database context
|
adbCtx
|
||||||
adbCtx.Dispose();
|
.Database
|
||||||
}
|
.SqlQuery<int>("CALL stp_ResetDb()");
|
||||||
|
answ = true;
|
||||||
|
|
||||||
public bool ResetDb()
|
adbCtx.SaveChanges();
|
||||||
{
|
}
|
||||||
bool answ = false;
|
catch (Exception exc)
|
||||||
|
{
|
||||||
|
string errMessage = $"EXCEPTION on DbController.ResetDb: {Environment.NewLine}{exc}";
|
||||||
|
Console.WriteLine(errMessage);
|
||||||
|
Log.Error(errMessage);
|
||||||
|
}
|
||||||
|
|
||||||
try
|
return answ;
|
||||||
{
|
}
|
||||||
adbCtx
|
|
||||||
.Database
|
|
||||||
.SqlQuery<int>("CALL stp_ResetDb()");
|
|
||||||
answ = true;
|
|
||||||
|
|
||||||
adbCtx.SaveChanges();
|
#endregion Public Methods
|
||||||
}
|
|
||||||
catch (Exception exc)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"EXCEPTION on ResetDb: {exc}");
|
|
||||||
}
|
|
||||||
|
|
||||||
return answ;
|
#region Private Fields
|
||||||
}
|
|
||||||
|
|
||||||
#endregion Public Methods
|
private AdminContext adbCtx;
|
||||||
}
|
|
||||||
|
/// <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.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
|
||||||
|
|
||||||
namespace EgtBEAMWALL.DataLayer.Controllers
|
namespace EgtBEAMWALL.DataLayer.Controllers
|
||||||
{
|
{
|
||||||
public class LogMachineController : IDisposable
|
public class LogMachineController : IDisposable
|
||||||
{
|
{
|
||||||
#region Private Fields
|
|
||||||
|
|
||||||
private DatabaseContext dbCtx;
|
|
||||||
|
|
||||||
#endregion Private Fields
|
|
||||||
|
|
||||||
#region Public Constructors
|
#region Public Constructors
|
||||||
|
|
||||||
public LogMachineController()
|
public LogMachineController()
|
||||||
{
|
{
|
||||||
// Initialize database context
|
|
||||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Public Constructors
|
#endregion Public Constructors
|
||||||
@@ -63,7 +55,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static Core.MachLog ConvertToCore(LogMachineModel dbLog)
|
public static Core.MachLog ConvertToCore(LogMachineModel dbLog)
|
||||||
{
|
{
|
||||||
var newRecord = Core.MachLog.CreateMacLog(dbLog.AlarmCode, dbLog.AlarmDatetime, dbLog.AlarmMessage, dbLog.AlarmOperation, dbLog.AlarmType, dbLog.CommandExecutedCorrectly, dbLog.CommandState, dbLog.CommandType, dbLog.Description, dbLog.NewOpState, dbLog.ResultType, dbLog.VarAddress, dbLog.VarValue);
|
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;
|
return newRecord;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,18 +71,19 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (var currDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
using (var locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
{
|
{
|
||||||
// Add to database
|
// Add to database
|
||||||
currDbCtx.LogMachineList.Add(newLogMac);
|
locallocalDbCtx.LogMachineList.Add(newLogMac);
|
||||||
// Commit changes
|
// Commit changes
|
||||||
currDbCtx.SaveChanges();
|
locallocalDbCtx.SaveChanges();
|
||||||
ResetController();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception exc)
|
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
|
catch
|
||||||
@@ -117,29 +110,31 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
public bool DeleteByKey(int LogDbId)
|
public bool DeleteByKey(int LogDbId)
|
||||||
{
|
{
|
||||||
bool done = false;
|
bool done = false;
|
||||||
var items2del = dbCtx
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
|
{
|
||||||
|
var items2del = localDbCtx
|
||||||
.LogMachineList
|
.LogMachineList
|
||||||
.Where(x => x.LogDbId == LogDbId);
|
.Where(x => x.LogDbId == LogDbId);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Add to database
|
// Add to database
|
||||||
dbCtx.LogMachineList.RemoveRange(items2del);
|
localDbCtx.LogMachineList.RemoveRange(items2del);
|
||||||
// Commit changes
|
// Commit changes
|
||||||
dbCtx.SaveChanges();
|
localDbCtx.SaveChanges();
|
||||||
ResetController();
|
done = true;
|
||||||
done = true;
|
}
|
||||||
}
|
catch (Exception exc)
|
||||||
catch (Exception exc)
|
{
|
||||||
{
|
string errMessage = $"EXCEPTION on LogMachine.DeleteByKey: {Environment.NewLine}{exc}";
|
||||||
Console.WriteLine($"EXCEPTION on DeleteByKey: {exc}");
|
Console.WriteLine(errMessage);
|
||||||
|
Log.Error(errMessage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return done;
|
return done;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
// Clear database context
|
|
||||||
dbCtx.Dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -149,10 +144,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public LogMachineModel FindByDbId(int LogDbId)
|
public LogMachineModel FindByDbId(int LogDbId)
|
||||||
{
|
{
|
||||||
return dbCtx
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
|
{
|
||||||
|
return localDbCtx
|
||||||
.LogMachineList
|
.LogMachineList
|
||||||
.Where(x => x.LogDbId == LogDbId)
|
.Where(x => x.LogDbId == LogDbId)
|
||||||
.SingleOrDefault();
|
.SingleOrDefault();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -163,12 +161,41 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<LogMachineModel> GetAsc(DateTime dtStart, DateTime dtEnd)
|
public List<LogMachineModel> GetAsc(DateTime dtStart, DateTime dtEnd)
|
||||||
{
|
{
|
||||||
// retrieve
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
return dbCtx
|
{
|
||||||
|
// retrieve
|
||||||
|
return localDbCtx
|
||||||
.LogMachineList
|
.LogMachineList
|
||||||
.Where(x => x.AlarmDatetime >= dtStart && x.AlarmDatetime <= dtEnd)
|
.Where(x => x.AlarmDatetime >= dtStart && x.AlarmDatetime <= dtEnd)
|
||||||
.OrderBy(x => x.AlarmDatetime)
|
.OrderBy(x => x.AlarmDatetime)
|
||||||
.ToList();
|
.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>
|
/// <summary>
|
||||||
@@ -179,21 +206,15 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<LogMachineModel> GetDesc(DateTime dtStart, DateTime dtEnd)
|
public List<LogMachineModel> GetDesc(DateTime dtStart, DateTime dtEnd)
|
||||||
{
|
{
|
||||||
// retrieve
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
return dbCtx
|
{
|
||||||
|
// retrieve
|
||||||
|
return localDbCtx
|
||||||
.LogMachineList
|
.LogMachineList
|
||||||
.Where(x => x.AlarmDatetime >= dtStart && x.AlarmDatetime <= dtEnd)
|
.Where(x => x.AlarmDatetime >= dtStart && x.AlarmDatetime <= dtEnd)
|
||||||
.OrderByDescending(x => x.AlarmDatetime)
|
.OrderByDescending(x => x.AlarmDatetime)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Reinizializzaizone del controller
|
|
||||||
/// </summary>
|
|
||||||
public void ResetController()
|
|
||||||
{
|
|
||||||
// Re-Initialize database context
|
|
||||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -204,27 +225,40 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
public bool Update(LogMachineModel updItem)
|
public bool Update(LogMachineModel updItem)
|
||||||
{
|
{
|
||||||
bool done = false;
|
bool done = false;
|
||||||
var item2update = dbCtx
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
|
{
|
||||||
|
var item2update = localDbCtx
|
||||||
.LogMachineList
|
.LogMachineList
|
||||||
.Where(x => x.LogDbId == updItem.LogDbId)
|
.Where(x => x.LogDbId == updItem.LogDbId)
|
||||||
.SingleOrDefault();
|
.SingleOrDefault();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// update, vers 1...
|
// update, vers 1...
|
||||||
dbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||||
|
|
||||||
// Commit changes
|
// Commit changes
|
||||||
dbCtx.SaveChanges();
|
localDbCtx.SaveChanges();
|
||||||
ResetController();
|
done = true;
|
||||||
done = true;
|
}
|
||||||
}
|
catch (Exception exc)
|
||||||
catch (Exception exc)
|
{
|
||||||
{
|
string errMessage = $"EXCEPTION on LogMachine.Update: {Environment.NewLine}{exc}";
|
||||||
Console.WriteLine($"EXCEPTION on Update: {exc}");
|
Console.WriteLine(errMessage);
|
||||||
|
Log.Error(errMessage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return done;
|
return done;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Public Methods
|
#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.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
|
||||||
|
|
||||||
namespace EgtBEAMWALL.DataLayer.Controllers
|
namespace EgtBEAMWALL.DataLayer.Controllers
|
||||||
{
|
{
|
||||||
public class LogSupportController : IDisposable
|
public class LogSupportController : IDisposable
|
||||||
{
|
{
|
||||||
#region Private Fields
|
|
||||||
|
|
||||||
private DatabaseContext dbCtx;
|
|
||||||
|
|
||||||
#endregion Private Fields
|
|
||||||
|
|
||||||
#region Public Constructors
|
#region Public Constructors
|
||||||
|
|
||||||
public LogSupportController()
|
public LogSupportController()
|
||||||
{
|
{
|
||||||
// Initialize database context
|
|
||||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Public Constructors
|
#endregion Public Constructors
|
||||||
@@ -41,24 +33,28 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
public bool Create(DateTime dtCreated, Core.LogSupportLevel level, Core.LogSupportTarget target, string message)
|
public bool Create(DateTime dtCreated, Core.LogSupportLevel level, Core.LogSupportTarget target, string message)
|
||||||
{
|
{
|
||||||
bool fatto = false;
|
bool fatto = false;
|
||||||
try
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
LogSupportModel newItem = new LogSupportModel() { DtEvent = dtCreated, Level = level, Target = target, Message = message };
|
try
|
||||||
// Add to database
|
{
|
||||||
dbCtx.LogSupportList.Add(newItem);
|
LogSupportModel newItem = new LogSupportModel() { DtEvent = dtCreated, Level = level, Target = target, Message = message };
|
||||||
// Commit changes
|
// Add to database
|
||||||
dbCtx.SaveChanges();
|
localDbCtx.LogSupportList.Add(newItem);
|
||||||
ResetController();
|
// Commit changes
|
||||||
}
|
localDbCtx.SaveChanges();
|
||||||
catch (Exception exc)
|
}
|
||||||
{
|
catch (Exception exc)
|
||||||
Console.WriteLine($"EXCEPTION on Create LogSupport: {exc}");
|
{
|
||||||
|
string errMessage = $"EXCEPTION on LogSupport.Create: {Environment.NewLine}{exc}";
|
||||||
|
Console.WriteLine(errMessage);
|
||||||
|
Log.Error(errMessage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
catch
|
||||||
|
{ }
|
||||||
}
|
}
|
||||||
catch
|
|
||||||
{ }
|
|
||||||
return fatto;
|
return fatto;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,29 +66,31 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
public bool DeleteByKey(int LogDbId)
|
public bool DeleteByKey(int LogDbId)
|
||||||
{
|
{
|
||||||
bool done = false;
|
bool done = false;
|
||||||
var items2del = dbCtx
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
.LogSupportList
|
|
||||||
.Where(x => x.LogDbId == LogDbId);
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
// Add to database
|
var items2del = localDbCtx
|
||||||
dbCtx.LogSupportList.RemoveRange(items2del);
|
.LogSupportList
|
||||||
// Commit changes
|
.Where(x => x.LogDbId == LogDbId);
|
||||||
dbCtx.SaveChanges();
|
try
|
||||||
ResetController();
|
{
|
||||||
done = true;
|
// Add to database
|
||||||
}
|
localDbCtx.LogSupportList.RemoveRange(items2del);
|
||||||
catch (Exception exc)
|
// Commit changes
|
||||||
{
|
localDbCtx.SaveChanges();
|
||||||
Console.WriteLine($"EXCEPTION on DeleteByKey: {exc}");
|
done = true;
|
||||||
|
}
|
||||||
|
catch (Exception exc)
|
||||||
|
{
|
||||||
|
string errMessage = $"EXCEPTION on LogSupport.DeleteByKey: {Environment.NewLine}{exc}";
|
||||||
|
Console.WriteLine(errMessage);
|
||||||
|
Log.Error(errMessage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return done;
|
return done;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
// Clear database context
|
|
||||||
dbCtx.Dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -102,10 +100,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public LogSupportModel FindByDbId(int LogDbId)
|
public LogSupportModel FindByDbId(int LogDbId)
|
||||||
{
|
{
|
||||||
return dbCtx
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
.LogSupportList
|
{
|
||||||
.Where(x => x.LogDbId == LogDbId)
|
return localDbCtx
|
||||||
.SingleOrDefault();
|
.LogSupportList
|
||||||
|
.Where(x => x.LogDbId == LogDbId)
|
||||||
|
.SingleOrDefault();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -117,11 +118,14 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
public List<LogSupportModel> GetPaginatedAsc(DateTime dtStart, DateTime dtEnd)
|
public List<LogSupportModel> GetPaginatedAsc(DateTime dtStart, DateTime dtEnd)
|
||||||
{
|
{
|
||||||
// retrieve
|
// retrieve
|
||||||
return dbCtx
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
|
{
|
||||||
|
return localDbCtx
|
||||||
.LogSupportList
|
.LogSupportList
|
||||||
.Where(x => x.DtEvent >= dtStart && x.DtEvent <= dtEnd)
|
.Where(x => x.DtEvent >= dtStart && x.DtEvent <= dtEnd)
|
||||||
.OrderBy(x => x.DtEvent)
|
.OrderBy(x => x.DtEvent)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -133,20 +137,14 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
public List<LogSupportModel> GetPaginatedDesc(DateTime dtStart, DateTime dtEnd)
|
public List<LogSupportModel> GetPaginatedDesc(DateTime dtStart, DateTime dtEnd)
|
||||||
{
|
{
|
||||||
// retrieve
|
// retrieve
|
||||||
return dbCtx
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
|
{
|
||||||
|
return localDbCtx
|
||||||
.LogSupportList
|
.LogSupportList
|
||||||
.Where(x => x.DtEvent >= dtStart && x.DtEvent <= dtEnd)
|
.Where(x => x.DtEvent >= dtStart && x.DtEvent <= dtEnd)
|
||||||
.OrderByDescending(x => x.DtEvent)
|
.OrderByDescending(x => x.DtEvent)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Reinizializzaizone del controller
|
|
||||||
/// </summary>
|
|
||||||
public void ResetController()
|
|
||||||
{
|
|
||||||
// Re-Initialize database context
|
|
||||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -157,27 +155,40 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
public bool Update(LogSupportModel updItem)
|
public bool Update(LogSupportModel updItem)
|
||||||
{
|
{
|
||||||
bool done = false;
|
bool done = false;
|
||||||
var item2update = dbCtx
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
|
{
|
||||||
|
var item2update = localDbCtx
|
||||||
.LogSupportList
|
.LogSupportList
|
||||||
.Where(x => x.LogDbId == updItem.LogDbId)
|
.Where(x => x.LogDbId == updItem.LogDbId)
|
||||||
.SingleOrDefault();
|
.SingleOrDefault();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// update, vers 1...
|
// update, vers 1...
|
||||||
dbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||||
|
|
||||||
// Commit changes
|
// Commit changes
|
||||||
dbCtx.SaveChanges();
|
localDbCtx.SaveChanges();
|
||||||
ResetController();
|
done = true;
|
||||||
done = true;
|
}
|
||||||
}
|
catch (Exception exc)
|
||||||
catch (Exception exc)
|
{
|
||||||
{
|
string errMessage = $"EXCEPTION on LogSupport.Update: {Environment.NewLine}{exc}";
|
||||||
Console.WriteLine($"EXCEPTION on Update: {exc}");
|
Console.WriteLine(errMessage);
|
||||||
|
Log.Error(errMessage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return done;
|
return done;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Public Methods
|
#endregion Public 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
@@ -1,19 +1,12 @@
|
|||||||
using System;
|
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||||
using System.Collections.Generic;
|
using NLog;
|
||||||
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
|
||||||
|
|
||||||
namespace EgtBEAMWALL.DataLayer.Controllers
|
namespace EgtBEAMWALL.DataLayer.Controllers
|
||||||
{
|
{
|
||||||
public class PartController : IDisposable
|
public class PartController : IDisposable
|
||||||
{
|
{
|
||||||
#region Private Fields
|
|
||||||
|
|
||||||
private DatabaseContext dbCtx;
|
|
||||||
|
|
||||||
#endregion Private Fields
|
|
||||||
|
|
||||||
#region Public Fields
|
#region Public Fields
|
||||||
|
|
||||||
public static PartController man = new PartController();
|
public static PartController man = new PartController();
|
||||||
@@ -24,82 +17,10 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
|
|
||||||
public PartController()
|
public PartController()
|
||||||
{
|
{
|
||||||
// Initialize database context
|
|
||||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Public Constructors
|
#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
|
#region Public Methods
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -151,24 +72,28 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
public bool Delete(int ProdId, int MachGroupId, int PartId)
|
public bool Delete(int ProdId, int MachGroupId, int PartId)
|
||||||
{
|
{
|
||||||
bool done = false;
|
bool done = false;
|
||||||
var item2del = dbCtx
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
.PartList
|
|
||||||
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
|
|
||||||
.SingleOrDefault();
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
// Remove from database
|
var item2del = localDbCtx
|
||||||
dbCtx.PartList.Remove(item2del);
|
.PartList
|
||||||
// Commit changes
|
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
|
||||||
dbCtx.SaveChanges();
|
.SingleOrDefault();
|
||||||
ResetController();
|
try
|
||||||
done = true;
|
{
|
||||||
// aggiorno info sullo status
|
// Remove from database
|
||||||
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
|
localDbCtx.PartList.Remove(item2del);
|
||||||
}
|
// Commit changes
|
||||||
catch (Exception exc)
|
localDbCtx.SaveChanges();
|
||||||
{
|
done = true;
|
||||||
Console.WriteLine($"EXCEPTION on Delete: ProdId: {ProdId} | MachGroupId: {MachGroupId} | PartId: {PartId}{Environment.NewLine}{exc}");
|
// aggiorno info sullo status
|
||||||
|
StatusMapController.man.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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return done;
|
return done;
|
||||||
}
|
}
|
||||||
@@ -181,22 +106,26 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
public bool Delete(int PartDbId)
|
public bool Delete(int PartDbId)
|
||||||
{
|
{
|
||||||
bool done = false;
|
bool done = false;
|
||||||
var item2del = dbCtx
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
.PartList
|
|
||||||
.Where(x => x.PartDbId == PartDbId)
|
|
||||||
.SingleOrDefault();
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
// Add to database
|
var item2del = localDbCtx
|
||||||
dbCtx.PartList.Remove(item2del);
|
.PartList
|
||||||
// Commit changes
|
.Where(x => x.PartDbId == PartDbId)
|
||||||
dbCtx.SaveChanges();
|
.SingleOrDefault();
|
||||||
ResetController();
|
try
|
||||||
done = true;
|
{
|
||||||
}
|
// Add to database
|
||||||
catch (Exception exc)
|
localDbCtx.PartList.Remove(item2del);
|
||||||
{
|
// Commit changes
|
||||||
Console.WriteLine($"EXCEPTION on Delete: {exc}");
|
localDbCtx.SaveChanges();
|
||||||
|
done = true;
|
||||||
|
}
|
||||||
|
catch (Exception exc)
|
||||||
|
{
|
||||||
|
string errMessage = $"EXCEPTION on Part.Delete: {Environment.NewLine}{exc}";
|
||||||
|
Console.WriteLine(errMessage);
|
||||||
|
Log.Error(errMessage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return done;
|
return done;
|
||||||
}
|
}
|
||||||
@@ -209,29 +138,31 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
public bool DeleteByMachGroup(int MachGroupDbId)
|
public bool DeleteByMachGroup(int MachGroupDbId)
|
||||||
{
|
{
|
||||||
bool done = false;
|
bool done = false;
|
||||||
var items2del = dbCtx
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
.PartList
|
|
||||||
.Where(x => x.MachGroupDbId == MachGroupDbId);
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
// Add to database
|
var items2del = localDbCtx
|
||||||
dbCtx.PartList.RemoveRange(items2del);
|
.PartList
|
||||||
// Commit changes
|
.Where(x => x.MachGroupDbId == MachGroupDbId);
|
||||||
dbCtx.SaveChanges();
|
try
|
||||||
ResetController();
|
{
|
||||||
done = true;
|
// Add to database
|
||||||
}
|
localDbCtx.PartList.RemoveRange(items2del);
|
||||||
catch (Exception exc)
|
// Commit changes
|
||||||
{
|
localDbCtx.SaveChanges();
|
||||||
Console.WriteLine($"EXCEPTION on DeleteByMachGroup: {exc}");
|
done = true;
|
||||||
|
}
|
||||||
|
catch (Exception exc)
|
||||||
|
{
|
||||||
|
string errMessage = $"EXCEPTION on Part.DeleteByMachGroup: {Environment.NewLine}{exc}";
|
||||||
|
Console.WriteLine(errMessage);
|
||||||
|
Log.Error(errMessage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return done;
|
return done;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
// Clear database context
|
|
||||||
dbCtx.Dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -241,10 +172,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public PartModel FindByDbId(int PartDbId)
|
public PartModel FindByDbId(int PartDbId)
|
||||||
{
|
{
|
||||||
return dbCtx
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
.PartList
|
{
|
||||||
.Where(x => x.PartDbId == PartDbId)
|
return localDbCtx
|
||||||
.SingleOrDefault();
|
.PartList
|
||||||
|
.Where(x => x.PartDbId == PartDbId)
|
||||||
|
.SingleOrDefault();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -254,19 +188,15 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public PartModel FindByPartId(int ProdId, int PartId)
|
public PartModel FindByPartId(int ProdId, int PartId)
|
||||||
{
|
{
|
||||||
return dbCtx
|
PartModel answ = null;
|
||||||
.PartList
|
using (DatabaseContext locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.PartId == PartId)
|
{
|
||||||
.SingleOrDefault();
|
answ = locallocalDbCtx
|
||||||
}
|
.PartList
|
||||||
|
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.PartId == PartId)
|
||||||
/// <summary>
|
.FirstOrDefault();
|
||||||
/// Reinizializzaizone del controller
|
}
|
||||||
/// </summary>
|
return answ;
|
||||||
public void ResetController()
|
|
||||||
{
|
|
||||||
// Re-Initialize database context
|
|
||||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -277,28 +207,34 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
public bool Update(PartModel updItem)
|
public bool Update(PartModel updItem)
|
||||||
{
|
{
|
||||||
bool done = false;
|
bool done = false;
|
||||||
var item2update = dbCtx
|
using (DatabaseContext locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
.PartList
|
|
||||||
.Where(x => x.PartDbId == updItem.PartDbId)
|
|
||||||
.SingleOrDefault();
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
// update, vers 1...
|
var item2update = locallocalDbCtx
|
||||||
dbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
.PartList
|
||||||
|
.Where(x => x.PartDbId == updItem.PartDbId)
|
||||||
|
.SingleOrDefault();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// update, vers 1...
|
||||||
|
locallocalDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||||
|
|
||||||
//// update, vers 2
|
//// update, vers 2
|
||||||
//dbCtx.PartList.Remove(item2del);
|
//localDbCtx.PartList.Remove(item2del);
|
||||||
//dbCtx.PartList.Add(updItem);
|
//localDbCtx.PartList.Add(updItem);
|
||||||
|
|
||||||
// Commit changes
|
// Commit changes
|
||||||
dbCtx.SaveChanges();
|
locallocalDbCtx.SaveChanges();
|
||||||
ResetController();
|
done = true;
|
||||||
done = true;
|
// aggiorno info sullo status
|
||||||
// aggiorno info sullo status
|
StatusMapController.man.UpdateAction("", updItem.MachGroup.Prod.ProdId, updItem.PartId, Core.StatusMapItemType.Part, Core.StatusMapOpType.MachGroupMod, "");
|
||||||
StatusMapController.man.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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch
|
|
||||||
{ }
|
|
||||||
return done;
|
return done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,26 +247,29 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
public bool UpdateEnd(int ProdId, int MachGroupId, int PartId, DateTime DtEnd)
|
public bool UpdateEnd(int ProdId, int MachGroupId, int PartId, DateTime DtEnd)
|
||||||
{
|
{
|
||||||
bool done = false;
|
bool done = false;
|
||||||
try
|
using (DatabaseContext locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
{
|
{
|
||||||
// aggiorno
|
try
|
||||||
dbCtx
|
{
|
||||||
.PartList
|
// aggiorno
|
||||||
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
|
locallocalDbCtx
|
||||||
.FirstOrDefault()
|
.PartList
|
||||||
.DtEnd = DtEnd;
|
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
|
||||||
// Commit changes
|
.FirstOrDefault()
|
||||||
dbCtx.SaveChanges();
|
.DtEnd = DtEnd;
|
||||||
ResetController();
|
// Commit changes
|
||||||
done = true;
|
locallocalDbCtx.SaveChanges();
|
||||||
// aggiorno info sullo status
|
done = true;
|
||||||
StatusMapController.man.UpdateAction("", ProdId, PartId, Core.StatusMapItemType.Part, DtEnd == DateTime.MinValue ? Core.StatusMapOpType.ResetPartEnd : Core.StatusMapOpType.PartEnd, "");
|
// aggiorno info sullo status
|
||||||
|
StatusMapController.man.UpdateAction("", ProdId, PartId, Core.StatusMapItemType.Part, DtEnd == DateTime.MinValue ? Core.StatusMapOpType.ResetPartEnd : Core.StatusMapOpType.PartEnd, "");
|
||||||
|
}
|
||||||
|
catch (Exception exc)
|
||||||
|
{
|
||||||
|
string errMessage = $"EXCEPTION on Part.UpdateEnd: {Environment.NewLine}{exc}";
|
||||||
|
Console.WriteLine(errMessage);
|
||||||
|
Log.Error(errMessage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception exc)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"EXCEPTION on UpdateStatus: {exc}");
|
|
||||||
}
|
|
||||||
|
|
||||||
return done;
|
return done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -343,24 +282,28 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
public bool UpdateStart(int ProdId, int MachGroupId, int PartId, DateTime DtStart)
|
public bool UpdateStart(int ProdId, int MachGroupId, int PartId, DateTime DtStart)
|
||||||
{
|
{
|
||||||
bool done = false;
|
bool done = false;
|
||||||
try
|
using (DatabaseContext locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
{
|
{
|
||||||
// aggiorno
|
try
|
||||||
dbCtx
|
{
|
||||||
.PartList
|
// aggiorno
|
||||||
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
|
locallocalDbCtx
|
||||||
.FirstOrDefault()
|
.PartList
|
||||||
.DtStart = DtStart;
|
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
|
||||||
// Commit changes
|
.FirstOrDefault()
|
||||||
dbCtx.SaveChanges();
|
.DtStart = DtStart;
|
||||||
ResetController();
|
// Commit changes
|
||||||
done = true;
|
locallocalDbCtx.SaveChanges();
|
||||||
// aggiorno info sullo status
|
done = true;
|
||||||
StatusMapController.man.UpdateAction("", ProdId, PartId, Core.StatusMapItemType.Part, DtStart == DateTime.MinValue ? Core.StatusMapOpType.ResetPartStart : Core.StatusMapOpType.PartStart, "");
|
// aggiorno info sullo status
|
||||||
}
|
StatusMapController.man.UpdateAction("", ProdId, PartId, Core.StatusMapItemType.Part, DtStart == DateTime.MinValue ? Core.StatusMapOpType.ResetPartStart : Core.StatusMapOpType.PartStart, "");
|
||||||
catch (Exception exc)
|
}
|
||||||
{
|
catch (Exception exc)
|
||||||
Console.WriteLine($"EXCEPTION on UpdateStatus: {exc}");
|
{
|
||||||
|
string errMessage = $"EXCEPTION on Part.UpdateStart: {Environment.NewLine}{exc}";
|
||||||
|
Console.WriteLine(errMessage);
|
||||||
|
Log.Error(errMessage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return done;
|
return done;
|
||||||
@@ -375,29 +318,96 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
public bool UpdateStatus(int ProdId, int MachGroupId, int PartId, Core.ItemState newState)
|
public bool UpdateStatus(int ProdId, int MachGroupId, int PartId, Core.ItemState newState)
|
||||||
{
|
{
|
||||||
bool done = false;
|
bool done = false;
|
||||||
try
|
using (DatabaseContext locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
{
|
{
|
||||||
// aggiorno
|
try
|
||||||
dbCtx
|
{
|
||||||
.PartList
|
// aggiorno
|
||||||
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
|
locallocalDbCtx
|
||||||
.FirstOrDefault()
|
.PartList
|
||||||
.State = newState;
|
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
|
||||||
// Commit changes
|
.FirstOrDefault()
|
||||||
dbCtx.SaveChanges();
|
.State = newState;
|
||||||
ResetController();
|
// Commit changes
|
||||||
done = true;
|
locallocalDbCtx.SaveChanges();
|
||||||
// aggiorno info sullo status
|
done = true;
|
||||||
StatusMapController.man.UpdateAction("", ProdId, PartId, Core.StatusMapItemType.Part, Core.StatusMapOpType.MachGroupMod, "");
|
// aggiorno info sullo status
|
||||||
}
|
StatusMapController.man.UpdateAction("", ProdId, PartId, Core.StatusMapItemType.Part, newState == Core.ItemState.Scrapped ? Core.StatusMapOpType.SetPartScrapped : Core.StatusMapOpType.MachGroupMod, "");
|
||||||
catch (Exception exc)
|
}
|
||||||
{
|
catch (Exception exc)
|
||||||
Console.WriteLine($"EXCEPTION on UpdateStatus: {exc}");
|
{
|
||||||
|
string errMessage = $"EXCEPTION on Part.UpdateStatus: {Environment.NewLine}{exc}";
|
||||||
|
Console.WriteLine(errMessage);
|
||||||
|
Log.Error(errMessage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return done;
|
return done;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Public Methods
|
#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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,20 +1,14 @@
|
|||||||
using System;
|
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||||
|
using NLog;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
|
||||||
using static EgtBEAMWALL.Core.ConstBeam;
|
using static EgtBEAMWALL.Core.ConstBeam;
|
||||||
|
|
||||||
namespace EgtBEAMWALL.DataLayer.Controllers
|
namespace EgtBEAMWALL.DataLayer.Controllers
|
||||||
{
|
{
|
||||||
public class ProdController : IDisposable
|
public class ProdController : IDisposable
|
||||||
{
|
{
|
||||||
#region Private Fields
|
|
||||||
|
|
||||||
private DatabaseContext dbCtx;
|
|
||||||
|
|
||||||
#endregion Private Fields
|
|
||||||
|
|
||||||
#region Public Fields
|
#region Public Fields
|
||||||
|
|
||||||
public static ProdController man = new ProdController();
|
public static ProdController man = new ProdController();
|
||||||
@@ -25,84 +19,47 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
|
|
||||||
public ProdController()
|
public ProdController()
|
||||||
{
|
{
|
||||||
// Initialize database context
|
Log.Info("ProdController istance Started");
|
||||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Public Constructors
|
#endregion Public Constructors
|
||||||
|
|
||||||
#region Protected Methods
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Helper conversione modelli
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="currProd"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
protected Core.ProdFileM coreConv(ProdModel currProd)
|
|
||||||
{
|
|
||||||
Core.ProdFileM answ = Core.ProdFileM.CreateProdFileM(currProd.ProdId, ProjIdByProd(currProd.ProdId), currProd.DtCreated, currProd.Description, currProd.PType, currProd.Machine);
|
|
||||||
return answ;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get LAST paginated data from DB (DESC ordered)
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="numRecord"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
protected List<ProdModel> GetLastDbModelDesc(int numRecord)
|
|
||||||
{
|
|
||||||
// se numRecord = 0 --> passo tutti
|
|
||||||
if (numRecord == 0)
|
|
||||||
{
|
|
||||||
numRecord = dbCtx.ProdList.Count();
|
|
||||||
}
|
|
||||||
// retrieve
|
|
||||||
return dbCtx
|
|
||||||
.ProdList
|
|
||||||
.OrderByDescending(x => x.ProdId)
|
|
||||||
.Take(numRecord)
|
|
||||||
.ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected List<int> ProjIdByProd(int ProdId)
|
|
||||||
{
|
|
||||||
return DbManager.obj.ProjCtr.GetByProdAsc(ProdId).Select(y => y.nProjId).ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion Protected Methods
|
|
||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Aggiunta di un PROJ ad un PROD
|
/// Aggiunta di un PROJ ad un PROD
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ProdId"></param>
|
/// <param name="ProdId">ID Prod</param>
|
||||||
/// <param name="ProjId"></param>
|
/// <param name="ProjId">ID Proj</param>
|
||||||
|
/// <param name="UserKey">User ID / Key number</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool AddProj(int ProdId, int ProjId)
|
public bool AddProj(int ProdId, int ProjId, string UserKey = "USER01")
|
||||||
{
|
{
|
||||||
bool done = false;
|
bool done = false;
|
||||||
|
|
||||||
// cerco Prod
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
var currProd = dbCtx
|
{
|
||||||
.ProdList
|
// cerco Prod
|
||||||
.Where(x => x.ProdId == ProdId)
|
var currProd = localDbCtx
|
||||||
.FirstOrDefault();
|
.ProdList
|
||||||
|
.Where(x => x.ProdId == ProdId)
|
||||||
|
.FirstOrDefault();
|
||||||
|
|
||||||
// cerco Proj
|
// cerco Proj
|
||||||
var currProj = dbCtx
|
var currProj = localDbCtx
|
||||||
.ProjList
|
.ProjList
|
||||||
.Where(x => x.ProjId == ProjId)
|
.Where(x => x.ProjId == ProjId)
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
|
|
||||||
// lo aggiorno
|
// lo aggiorno
|
||||||
currProj.ProdDbId = currProd.ProdDbId;
|
currProj.ProdDbId = currProd.ProdDbId;
|
||||||
currProj.Locked = true;
|
currProj.Locked = true;
|
||||||
|
currProj.LockDate = DateTime.Now;
|
||||||
// salvo
|
currProj.LockedBy = UserKey;
|
||||||
dbCtx.SaveChanges();
|
|
||||||
ResetController();
|
|
||||||
|
|
||||||
|
// salvo
|
||||||
|
localDbCtx.SaveChanges();
|
||||||
|
}
|
||||||
return done;
|
return done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,59 +67,64 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
{
|
{
|
||||||
bool done = false;
|
bool done = false;
|
||||||
|
|
||||||
var currProd = FindByProdId(ProdId);
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
|
|
||||||
// sel dei proj da aggiornare...
|
|
||||||
var proj2update = dbCtx
|
|
||||||
.ProjList
|
|
||||||
.Where(x => x.ProdDbId == currProd.ProdDbId)
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
// sel dei MachGroup da prod
|
|
||||||
var machGroup2del = dbCtx
|
|
||||||
.MachGroupList
|
|
||||||
.Where(x => x.ProdDbId == currProd.ProdDbId)
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
// selezione dei part da machgroup
|
|
||||||
var part2del = dbCtx
|
|
||||||
.PartList
|
|
||||||
.Where(x => x.MachGroup.ProdDbId == currProd.ProdDbId)
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
// update proj...
|
var currProd = localDbCtx
|
||||||
foreach (var item in proj2update)
|
.ProdList
|
||||||
|
.Where(x => x.ProdId == ProdId)
|
||||||
|
.SingleOrDefault();
|
||||||
|
|
||||||
|
// sel dei proj da aggiornare...
|
||||||
|
var proj2update = localDbCtx
|
||||||
|
.ProjList
|
||||||
|
.Where(x => x.ProdDbId == currProd.ProdDbId)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
// sel dei MachGroup da prod
|
||||||
|
var machGroup2del = localDbCtx
|
||||||
|
.MachGroupList
|
||||||
|
.Where(x => x.ProdDbId == currProd.ProdDbId)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
// selezione dei part da machgroup
|
||||||
|
var part2del = localDbCtx
|
||||||
|
.PartList
|
||||||
|
.Where(x => x.MachGroup.ProdDbId == currProd.ProdDbId)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
item.ProdDbId = null;
|
// update proj...
|
||||||
|
foreach (var item in proj2update)
|
||||||
|
{
|
||||||
|
item.ProdDbId = null;
|
||||||
|
}
|
||||||
|
//// salvo
|
||||||
|
//localDbCtx.SaveChanges();
|
||||||
|
// remove from database
|
||||||
|
localDbCtx.PartList.RemoveRange(part2del);
|
||||||
|
//// salvo
|
||||||
|
//localDbCtx.SaveChanges();
|
||||||
|
localDbCtx.MachGroupList.RemoveRange(machGroup2del);
|
||||||
|
//// salvo
|
||||||
|
//localDbCtx.SaveChanges();
|
||||||
|
localDbCtx.ProdList.Remove(currProd);
|
||||||
|
// salvo
|
||||||
|
localDbCtx.SaveChanges();
|
||||||
|
done = true;
|
||||||
|
}
|
||||||
|
catch (Exception exc)
|
||||||
|
{
|
||||||
|
string errMessage = $"EXCEPTION on Prod.DeleteProd: {Environment.NewLine}{exc}";
|
||||||
|
Console.WriteLine(errMessage);
|
||||||
|
Log.Error(errMessage);
|
||||||
}
|
}
|
||||||
//// salvo
|
|
||||||
//dbCtx.SaveChanges();
|
|
||||||
// remove from database
|
|
||||||
dbCtx.PartList.RemoveRange(part2del);
|
|
||||||
//// salvo
|
|
||||||
//dbCtx.SaveChanges();
|
|
||||||
dbCtx.MachGroupList.RemoveRange(machGroup2del);
|
|
||||||
//// salvo
|
|
||||||
//dbCtx.SaveChanges();
|
|
||||||
dbCtx.ProdList.Remove(currProd);
|
|
||||||
// salvo
|
|
||||||
dbCtx.SaveChanges();
|
|
||||||
ResetController();
|
|
||||||
done = true;
|
|
||||||
}
|
|
||||||
catch (Exception exc)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"EXCEPTION on DeleteProd: {exc}");
|
|
||||||
}
|
}
|
||||||
return done;
|
return done;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
// Clear database context
|
|
||||||
dbCtx.Dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -172,14 +134,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public ProdModel FindByProdDbId(int ProdDbId)
|
public ProdModel FindByProdDbId(int ProdDbId)
|
||||||
{
|
{
|
||||||
var answ = dbCtx
|
ProdModel answ;
|
||||||
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
|
{
|
||||||
|
answ = localDbCtx
|
||||||
.ProdList
|
.ProdList
|
||||||
.Where(x => x.ProdDbId == ProdDbId)
|
.Where(x => x.ProdDbId == ProdDbId)
|
||||||
.SingleOrDefault();
|
.SingleOrDefault();
|
||||||
// forzo rilettura
|
|
||||||
if (answ != null)
|
|
||||||
{
|
|
||||||
dbCtx.Entry(answ).Reload();
|
|
||||||
}
|
}
|
||||||
return answ;
|
return answ;
|
||||||
}
|
}
|
||||||
@@ -191,14 +152,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public ProdModel FindByProdId(int ProdId)
|
public ProdModel FindByProdId(int ProdId)
|
||||||
{
|
{
|
||||||
var answ = dbCtx
|
ProdModel answ;
|
||||||
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
|
{
|
||||||
|
answ = localDbCtx
|
||||||
.ProdList
|
.ProdList
|
||||||
.Where(x => x.ProdId == ProdId)
|
.Where(x => x.ProdId == ProdId)
|
||||||
.SingleOrDefault();
|
.SingleOrDefault();
|
||||||
// forzo rilettura
|
|
||||||
if (answ != null)
|
|
||||||
{
|
|
||||||
dbCtx.Entry(answ).Reload();
|
|
||||||
}
|
}
|
||||||
return answ;
|
return answ;
|
||||||
}
|
}
|
||||||
@@ -215,7 +175,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return Core.ProdFileM.CreateProdFileM(currProd.ProdId, ProjIdByProd(ProdId), currProd.DtCreated, currProd.Description, currProd.PType, currProd.Machine);
|
return Core.ProdFileM.CreateProdFileM(currProd.ProdId, ProjIdByProd(ProdId), currProd.DtCreated, currProd.Description, currProd.PType, currProd.Machine, currProd.LockedBy, currProd.LockDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -228,152 +188,159 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
List<Core.ProdFileM> result = new List<Core.ProdFileM>();
|
List<Core.ProdFileM> result = new List<Core.ProdFileM>();
|
||||||
var dbResult = GetLastDbModelDesc(numRecord);
|
var dbResult = GetLastDbModelDesc(numRecord);
|
||||||
// conversione
|
// conversione
|
||||||
result = dbResult.Select(x => Core.ProdFileM.CreateProdFileM(x.ProdId, ProjIdByProd(x.ProdId), x.DtCreated, x.Description, x.PType, x.Machine)).ToList();
|
result = dbResult.Select(x => Core.ProdFileM.CreateProdFileM(x.ProdId, ProjIdByProd(x.ProdId), x.DtCreated, x.Description, x.PType, x.Machine, x.LockedBy, x.LockDate)).ToList();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fornisce nuovo indice VUOTO da usare (allocando sul DB)
|
/// Fornisce nuovo indice VUOTO da usare (allocando sul DB)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ProjId"></param>
|
/// <param name="ProjId">ID Proj</param>
|
||||||
|
/// <param name="UserKey">User ID / Key number</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public int GetNextIndex(int ProjId)
|
public int GetNextIndex(int ProjId, string UserKey = "USER01")
|
||||||
{
|
{
|
||||||
int nextId = 0;
|
int nextId = 0;
|
||||||
|
|
||||||
// cerco se ne ho ALMENO 1....
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
var numRec = dbCtx.ProdList.Count();
|
|
||||||
if (numRec == 0)
|
|
||||||
{
|
{
|
||||||
nextId = 1;
|
// cerco se ne ho ALMENO 1....
|
||||||
}
|
var numRec = localDbCtx.ProdList.Count();
|
||||||
else
|
if (numRec == 0)
|
||||||
{
|
{
|
||||||
// retrieve ultimo...
|
nextId = 1;
|
||||||
var maxRecord = dbCtx
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// retrieve ultimo...
|
||||||
|
var maxRecord = localDbCtx
|
||||||
|
.ProdList
|
||||||
|
.OrderByDescending(x => x.ProdId)
|
||||||
|
.Take(1)
|
||||||
|
.FirstOrDefault();
|
||||||
|
// incremento
|
||||||
|
nextId = maxRecord.ProdId + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// creo nuovo PROD...
|
||||||
|
var newProd = localDbCtx
|
||||||
.ProdList
|
.ProdList
|
||||||
.OrderByDescending(x => x.ProdId)
|
.Add(new ProdModel() { ProdId = nextId, Locked = true, DtCreated = DateTime.Now });
|
||||||
.Take(1)
|
|
||||||
|
// cerco Proj
|
||||||
|
var currProj = localDbCtx
|
||||||
|
.ProjList
|
||||||
|
.Where(x => x.ProjId == ProjId)
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
// incremento
|
|
||||||
nextId = maxRecord.ProdId + 1;
|
// aggiungo proj-prod
|
||||||
|
currProj.ProdDbId = newProd.ProdDbId;
|
||||||
|
currProj.Locked = true;
|
||||||
|
currProj.LockDate = DateTime.Now;
|
||||||
|
currProj.LockedBy = UserKey;
|
||||||
|
|
||||||
|
// Commit changes
|
||||||
|
localDbCtx.SaveChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
// creo nuovo PROD...
|
|
||||||
var newProd = dbCtx
|
|
||||||
.ProdList
|
|
||||||
.Add(new ProdModel() { ProdId = nextId, Locked = true, DtCreated = DateTime.Now });
|
|
||||||
|
|
||||||
// cerco Proj
|
|
||||||
var currProj = dbCtx
|
|
||||||
.ProjList
|
|
||||||
.Where(x => x.ProjId == ProjId)
|
|
||||||
.FirstOrDefault();
|
|
||||||
|
|
||||||
// aggiungo proj-prod
|
|
||||||
currProj.ProdDbId = newProd.ProdDbId;
|
|
||||||
currProj.Locked = true;
|
|
||||||
|
|
||||||
// Commit changes
|
|
||||||
dbCtx.SaveChanges();
|
|
||||||
|
|
||||||
return nextId;
|
return nextId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Verifica prod assegnato a supervisor:
|
/// Verifica prod assegnato a supervisor: ...se c'e' anche un solo machgroup del prod
|
||||||
/// ...se c'e' anche un solo machgroup del prod assegnato ad un supervisor o in stato 0 (dovrebbe essere la stessa cosa?)
|
/// assegnato ad un supervisor o in stato 0 (dovrebbe essere la stessa cosa?)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ProdId"></param>
|
/// <param name="ProdId"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool IsAnyInSupervisor(int ProdId)
|
public bool IsAnyInSupervisor(int ProdId)
|
||||||
{
|
{
|
||||||
// cerco se ci siano assegnati a supervisor
|
int numAssigned = 0;
|
||||||
var numAssigned = dbCtx
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
.MachGroupList
|
{
|
||||||
.Where(x => x.Prod.ProdId == ProdId && (!string.IsNullOrEmpty(x.SupervisorId) || x.State >= 0))
|
// cerco se ci siano assegnati a supervisor
|
||||||
.Count();
|
numAssigned = localDbCtx
|
||||||
|
.MachGroupList
|
||||||
|
.Where(x => x.Prod.ProdId == ProdId && (!string.IsNullOrEmpty(x.SupervisorId) || x.State >= 0))
|
||||||
|
.Count();
|
||||||
|
}
|
||||||
return numAssigned > 0;
|
return numAssigned > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary> Return Lock by ProdId (proj & prod) </summary> <param name="ProdId"></param> <returns></returns>
|
||||||
/// Manage Lock by ProdId (proj & prod)
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="ProdId">ProjID</param>
|
|
||||||
/// <param name="Locked">Stato Lock da impostare</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public ProdModel LockByProdId(int ProdId, bool Locked)
|
|
||||||
{
|
|
||||||
// seleziono il prod...
|
|
||||||
var currProd = dbCtx
|
|
||||||
.ProdList
|
|
||||||
.Where(x => x.ProdId == ProdId)
|
|
||||||
.SingleOrDefault();
|
|
||||||
|
|
||||||
if (currProd != null)
|
|
||||||
{
|
|
||||||
currProd.Locked = Locked;
|
|
||||||
dbCtx.Entry(currProd).State = System.Data.Entity.EntityState.Modified;
|
|
||||||
|
|
||||||
var currProj = dbCtx
|
|
||||||
.ProjList
|
|
||||||
.Where(x => x.ProdDbId == currProd.ProdDbId)
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
//currProj.ForEach(x => x.Locked = Locked);
|
|
||||||
foreach (var item in currProj)
|
|
||||||
{
|
|
||||||
item.Locked = Locked;
|
|
||||||
dbCtx.Entry(item).State = System.Data.Entity.EntityState.Modified;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dbCtx.SaveChanges();
|
|
||||||
ResetController();
|
|
||||||
|
|
||||||
return currProd;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Return Lock by ProdId (proj & prod)
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="ProdId">ProjID</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public bool IsLockByProdId(int ProdId)
|
public bool IsLockByProdId(int ProdId)
|
||||||
{
|
{
|
||||||
// seleziono il prod...
|
bool bIsLock = false;
|
||||||
var currProd = dbCtx
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
.ProdList
|
|
||||||
.Where(x => x.ProdId == ProdId)
|
|
||||||
.FirstOrDefault();
|
|
||||||
|
|
||||||
var bIsLock = false;
|
|
||||||
if (currProd != null)
|
|
||||||
{
|
{
|
||||||
bIsLock = currProd.Locked;
|
// seleziono il prod...
|
||||||
|
var currProd = localDbCtx
|
||||||
|
.ProdList
|
||||||
|
.Where(x => x.ProdId == ProdId)
|
||||||
|
.FirstOrDefault();
|
||||||
|
|
||||||
var currProj = dbCtx
|
if (currProd != null)
|
||||||
.ProjList
|
|
||||||
.Where(x => x.ProdDbId == currProd.ProdDbId)
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
if (currProj != null && !bIsLock)
|
|
||||||
{
|
{
|
||||||
bIsLock = currProj.Any(x => x.Locked);
|
bIsLock = currProd.Locked;
|
||||||
|
|
||||||
|
var currProj = localDbCtx
|
||||||
|
.ProjList
|
||||||
|
.Where(x => x.ProdDbId == currProd.ProdDbId)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
if (currProj != null && !bIsLock)
|
||||||
|
{
|
||||||
|
bIsLock = currProj.Any(x => x.Locked);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return bIsLock;
|
return bIsLock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary> Manage Lock by ProdId (proj & prod) </summary> <param name="ProdId"></param>
|
||||||
|
/// <param name="Locked">Stato Lock da impostare</param> <param name="UserKey">User ID / Key
|
||||||
|
/// number</param> <returns></returns>
|
||||||
|
public ProdModel LockByProdId(int ProdId, bool Locked, string UserKey = "USER01")
|
||||||
|
{
|
||||||
|
ProdModel currProd;
|
||||||
|
// seleziono il prod...
|
||||||
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
|
{
|
||||||
|
currProd = localDbCtx
|
||||||
|
.ProdList
|
||||||
|
.Where(x => x.ProdId == ProdId)
|
||||||
|
.SingleOrDefault();
|
||||||
|
|
||||||
|
if (currProd != null)
|
||||||
|
{
|
||||||
|
currProd.Locked = Locked;
|
||||||
|
currProd.LockDate = DateTime.Now;
|
||||||
|
currProd.LockedBy = Locked ? UserKey : "";
|
||||||
|
localDbCtx.Entry(currProd).State = System.Data.Entity.EntityState.Modified;
|
||||||
|
|
||||||
|
var currProj = localDbCtx
|
||||||
|
.ProjList
|
||||||
|
.Where(x => x.ProdDbId == currProd.ProdDbId)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
//currProj.ForEach(x => x.Locked = Locked);
|
||||||
|
foreach (var item in currProj)
|
||||||
|
{
|
||||||
|
item.Locked = Locked;
|
||||||
|
item.LockDate = DateTime.Now;
|
||||||
|
item.LockedBy = Locked ? UserKey : "";
|
||||||
|
localDbCtx.Entry(item).State = System.Data.Entity.EntityState.Modified;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
localDbCtx.SaveChanges();
|
||||||
|
}
|
||||||
|
return currProd;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reinizializzaizone del controller
|
/// Reinizializzaizone del controller
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void ResetController()
|
public void ResetController()
|
||||||
{
|
{
|
||||||
// Re-Initialize database context
|
|
||||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -384,26 +351,28 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
public bool Update(ProdModel updItem)
|
public bool Update(ProdModel updItem)
|
||||||
{
|
{
|
||||||
bool done = false;
|
bool done = false;
|
||||||
var item2update = dbCtx
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
.ProdList
|
|
||||||
.Where(x => x.ProdDbId == updItem.ProdDbId)
|
|
||||||
.SingleOrDefault();
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
// update, vers 1...
|
var item2update = localDbCtx
|
||||||
dbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
.ProdList
|
||||||
|
.Where(x => x.ProdDbId == updItem.ProdDbId)
|
||||||
|
.SingleOrDefault();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// update, vers 1...
|
||||||
|
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||||
|
|
||||||
//// update, vers 2
|
//// update, vers 2
|
||||||
//dbCtx.PartList.Remove(item2del);
|
//localDbCtx.PartList.Remove(item2del);
|
||||||
//dbCtx.PartList.Add(updItem);
|
//localDbCtx.PartList.Add(updItem);
|
||||||
|
|
||||||
// Commit changes
|
// Commit changes
|
||||||
dbCtx.SaveChanges();
|
localDbCtx.SaveChanges();
|
||||||
ResetController();
|
done = true;
|
||||||
done = true;
|
}
|
||||||
|
catch
|
||||||
|
{ }
|
||||||
}
|
}
|
||||||
catch
|
|
||||||
{ }
|
|
||||||
return done;
|
return done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -418,173 +387,267 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public ProdModel UpdateMachGroup(int ProdId, List<Core.MyMachGroupM> MachGroupList)
|
public ProdModel UpdateMachGroup(int ProdId, List<Core.MyMachGroupM> MachGroupList)
|
||||||
{
|
{
|
||||||
// Recupero il PROD
|
ProdModel currData = new ProdModel();
|
||||||
ProdModel currData = FindByProdId(ProdId);
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
// preparo elenco
|
// Recupero il PROD nel contesto DB attuale
|
||||||
List<MachGroupModel> itemsMG2Add = new List<MachGroupModel>();
|
currData = localDbCtx
|
||||||
|
.ProdList
|
||||||
|
.Where(x => x.ProdId == ProdId)
|
||||||
|
.SingleOrDefault();
|
||||||
|
|
||||||
List<Core.MyMachGroupM> MachGroupList2Add = new List<Core.MyMachGroupM>();
|
try
|
||||||
List<PartModel> PartList2Add = new List<PartModel>();
|
|
||||||
// cerco le MG esistenti --> aggiorno
|
|
||||||
foreach (var item in MachGroupList)
|
|
||||||
{
|
{
|
||||||
#if false
|
// preparo elenco
|
||||||
var currMG = dbCtx
|
List<MachGroupModel> itemsMG2Add = new List<MachGroupModel>();
|
||||||
.MachGroupList
|
|
||||||
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == item.Id)
|
|
||||||
.SingleOrDefault();
|
|
||||||
#endif
|
|
||||||
var currMG = MachGroupController.man.FindByMachGroupId(ProdId, item.Id);
|
|
||||||
var convCurrMG = MachGroupController.ConvertFromCore(item, currData.ProdDbId);
|
|
||||||
if (currMG != null)
|
|
||||||
{
|
|
||||||
// se non identico x equality limitata a ViewOptim...
|
|
||||||
if (!currMG.ViewOptimEquals(convCurrMG))
|
|
||||||
{
|
|
||||||
// aggiorno con nuovi valori ricevuti
|
|
||||||
currMG.H = convCurrMG.H;
|
|
||||||
currMG.L = convCurrMG.L;
|
|
||||||
currMG.W = convCurrMG.W;
|
|
||||||
currMG.Material = convCurrMG.Material;
|
|
||||||
currMG.Name = convCurrMG.Name;
|
|
||||||
// salvo
|
|
||||||
dbCtx.SaveChanges();
|
|
||||||
// registro modifica StatusMap
|
|
||||||
StatusMapController.man.UpdateAction(currMG.SupervisorId, ProdId, currMG.MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
itemsMG2Add.Add(convCurrMG);
|
|
||||||
// registro modifica StatusMap
|
|
||||||
StatusMapController.man.UpdateAction("", ProdId, item.Id, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupAdd, "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// aggiungo MachGroup
|
|
||||||
dbCtx.MachGroupList.AddRange(itemsMG2Add);
|
|
||||||
// Commit changes
|
|
||||||
dbCtx.SaveChanges();
|
|
||||||
|
|
||||||
// verifico di nuovo l'elenco delle MG x le relative PART...
|
List<Core.MyMachGroupM> MachGroupList2Add = new List<Core.MyMachGroupM>();
|
||||||
foreach (var item in MachGroupList)
|
List<PartModel> PartList2Add = new List<PartModel>();
|
||||||
{
|
// cerco le MG esistenti --> aggiorno
|
||||||
var currMG = MachGroupController.man.FindByMachGroupId(ProdId, item.Id);
|
foreach (var item in MachGroupList)
|
||||||
int MachGroupDbId = currMG.MachGroupDbId;
|
|
||||||
bool modMg = false;
|
|
||||||
// verifico se uguali o meno...
|
|
||||||
foreach (var currPartM in item.PartMList)
|
|
||||||
{
|
{
|
||||||
var currPart = dbCtx
|
var currMG = MachGroupController.man.FindByMachGroupId(ProdId, item.Id);
|
||||||
.PartList
|
var convCurrMG = MachGroupController.ConvertFromCore(item, currData.ProdDbId);
|
||||||
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == item.Id && x.PartId == currPartM.nPartId)
|
if (currMG != null)
|
||||||
.SingleOrDefault();
|
|
||||||
var convCurrPartM = PartController.ConvertFromCore(currPartM, MachGroupDbId);
|
|
||||||
if (currPart != null)
|
|
||||||
{
|
{
|
||||||
// se non identico x equality limitata a ViewOptim...
|
// se non identico x equality limitata a ViewOptim...
|
||||||
if (!currPart.ViewOptimEquals(convCurrPartM))
|
if (!currMG.ViewOptimEquals(convCurrMG))
|
||||||
{
|
{
|
||||||
// aggiorno con nuovi valori ricevuti
|
// aggiorno con nuovi valori ricevuti
|
||||||
currPart.H = convCurrPartM.H;
|
currMG.H = convCurrMG.H;
|
||||||
currPart.L = convCurrPartM.L;
|
currMG.L = convCurrMG.L;
|
||||||
currPart.W = convCurrPartM.W;
|
currMG.W = convCurrMG.W;
|
||||||
currPart.Material = convCurrPartM.Material;
|
currMG.Material = convCurrMG.Material;
|
||||||
currPart.CALC_State = convCurrPartM.CALC_State;
|
currMG.Name = convCurrMG.Name;
|
||||||
currPart.ROT = convCurrPartM.ROT;
|
|
||||||
currPart.PDN = convCurrPartM.PDN;
|
|
||||||
currPart.NAM = convCurrPartM.NAM;
|
|
||||||
// salvo
|
// salvo
|
||||||
dbCtx.SaveChanges();
|
localDbCtx.SaveChanges();
|
||||||
modMg = true;
|
// registro modifica StatusMap
|
||||||
|
StatusMapController.man.UpdateAction(currMG.SupervisorId, ProdId, currMG.MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PartList2Add.Add(convCurrPartM);
|
itemsMG2Add.Add(convCurrMG);
|
||||||
modMg = true;
|
// registro modifica StatusMap
|
||||||
|
StatusMapController.man.UpdateAction("", ProdId, item.Id, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupAdd, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// verifico se salvare...
|
// aggiungo MachGroup
|
||||||
if (modMg)
|
localDbCtx.MachGroupList.AddRange(itemsMG2Add);
|
||||||
|
// Commit changes
|
||||||
|
localDbCtx.SaveChanges();
|
||||||
|
|
||||||
|
// verifico di nuovo l'elenco delle MG x le relative PART...
|
||||||
|
foreach (var item in MachGroupList)
|
||||||
{
|
{
|
||||||
StatusMapController.man.UpdateAction(currMG.SupervisorId, ProdId, currMG.MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
|
var currMG = MachGroupController.man.FindByMachGroupId(ProdId, item.Id);
|
||||||
|
int MachGroupDbId = currMG.MachGroupDbId;
|
||||||
|
bool modMg = false;
|
||||||
|
// verifico se uguali o meno...
|
||||||
|
foreach (var currPartM in item.PartMList)
|
||||||
|
{
|
||||||
|
var currPart = localDbCtx
|
||||||
|
.PartList
|
||||||
|
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == item.Id && x.PartId == currPartM.nPartId)
|
||||||
|
.SingleOrDefault();
|
||||||
|
var convCurrPartM = PartController.ConvertFromCore(currPartM, MachGroupDbId);
|
||||||
|
if (currPart != null)
|
||||||
|
{
|
||||||
|
// se non identico x equality limitata a ViewOptim...
|
||||||
|
if (!currPart.ViewOptimEquals(convCurrPartM))
|
||||||
|
{
|
||||||
|
// aggiorno con nuovi valori ricevuti
|
||||||
|
currPart.H = convCurrPartM.H;
|
||||||
|
currPart.L = convCurrPartM.L;
|
||||||
|
currPart.W = convCurrPartM.W;
|
||||||
|
currPart.Material = convCurrPartM.Material;
|
||||||
|
currPart.CALC_State = convCurrPartM.CALC_State;
|
||||||
|
currPart.ROT = convCurrPartM.ROT;
|
||||||
|
currPart.PDN = convCurrPartM.PDN;
|
||||||
|
currPart.NAM = convCurrPartM.NAM;
|
||||||
|
// salvo
|
||||||
|
localDbCtx.SaveChanges();
|
||||||
|
modMg = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PartList2Add.Add(convCurrPartM);
|
||||||
|
modMg = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// verifico se salvare...
|
||||||
|
if (modMg)
|
||||||
|
{
|
||||||
|
StatusMapController.man.UpdateAction(currMG.SupervisorId, ProdId, currMG.MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// aggiungo PartList
|
||||||
|
localDbCtx.PartList.AddRange(PartList2Add);
|
||||||
|
// Commit changes
|
||||||
|
localDbCtx.SaveChanges();
|
||||||
|
|
||||||
|
// sel dei MachGroup da prod OLD
|
||||||
|
List<MachGroupModel> itemsMGOld = localDbCtx
|
||||||
|
.MachGroupList
|
||||||
|
.Where(x => x.Prod.ProdId == ProdId)
|
||||||
|
.ToList();
|
||||||
|
// elenco degli ID del MachGroup NON trovati
|
||||||
|
List<int> MgId2rem = itemsMGOld.Select(x => x.MachGroupId).Except(MachGroupList.Select(y => y.Id)).ToList();
|
||||||
|
// processo i MachGroup eliminati
|
||||||
|
foreach (var item in MgId2rem)
|
||||||
|
{
|
||||||
|
MachGroupController.man.Delete(ProdId, item);
|
||||||
|
}
|
||||||
|
|
||||||
|
// aggiorno valore isNew a false x PROD
|
||||||
|
currData.IsNew = false;
|
||||||
|
|
||||||
|
// Commit changes
|
||||||
|
localDbCtx.SaveChanges();
|
||||||
}
|
}
|
||||||
|
catch (Exception exc)
|
||||||
// aggiungo PartList
|
|
||||||
dbCtx.PartList.AddRange(PartList2Add);
|
|
||||||
// Commit changes
|
|
||||||
dbCtx.SaveChanges();
|
|
||||||
|
|
||||||
// sel dei MachGroup da prod OLD
|
|
||||||
List<MachGroupModel> itemsMGOld = dbCtx
|
|
||||||
.MachGroupList
|
|
||||||
.Where(x => x.Prod.ProdId == ProdId)
|
|
||||||
.ToList();
|
|
||||||
// elenco degli ID del MachGroup NON trovati
|
|
||||||
List<int> MgId2rem = itemsMGOld.Select(x => x.MachGroupId).Except(MachGroupList.Select(y => y.Id)).ToList();
|
|
||||||
// processo i MachGroup eliminati
|
|
||||||
foreach (var item in MgId2rem)
|
|
||||||
{
|
{
|
||||||
MachGroupController.man.Delete(ProdId, item);
|
string errMessage = $"EXCEPTION on Prod.UpdateMachGroup: {Environment.NewLine}{exc}";
|
||||||
|
Console.WriteLine(errMessage);
|
||||||
|
Log.Error(errMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
// aggiorno valore isNew a false x PROD
|
|
||||||
currData.IsNew = false;
|
|
||||||
|
|
||||||
// Commit changes
|
|
||||||
dbCtx.SaveChanges();
|
|
||||||
ResetController();
|
|
||||||
}
|
}
|
||||||
catch (Exception exc)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"EXCEPTION on UpdateMachGroup: {exc}");
|
|
||||||
}
|
|
||||||
|
|
||||||
return currData;
|
return currData;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update record su DB x PType
|
/// Update record su DB x PType
|
||||||
/// </summary>
|
|
||||||
/// <param name="ProdId"></param>
|
|
||||||
/// <param name="PType"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public Core.ProdFileM UpdatePType(int ProdId, BWType PType)
|
|
||||||
{
|
|
||||||
var currData = FindByProdId(ProdId);
|
|
||||||
// aggiorno valore BTL
|
|
||||||
currData.PType = PType;
|
|
||||||
|
|
||||||
// Commit changes
|
|
||||||
dbCtx.SaveChanges();
|
|
||||||
ResetController();
|
|
||||||
|
|
||||||
return coreConv(currData);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Update record su DB x PType
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ProdId"></param>
|
/// <param name="ProdId"></param>
|
||||||
/// <param name="Machine"></param>
|
/// <param name="Machine"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Core.ProdFileM UpdateMachine(int ProdId, String Machine)
|
public Core.ProdFileM UpdateMachine(int ProdId, String Machine)
|
||||||
{
|
{
|
||||||
var currData = FindByProdId(ProdId);
|
ProdModel currData;
|
||||||
// aggiorno valore BTL
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
currData.Machine = Machine;
|
{
|
||||||
|
currData = localDbCtx
|
||||||
// Commit changes
|
.ProdList
|
||||||
dbCtx.SaveChanges();
|
.Where(x => x.ProdId == ProdId)
|
||||||
ResetController();
|
.SingleOrDefault();
|
||||||
|
// aggiorno valore BTL
|
||||||
|
currData.Machine = Machine;
|
||||||
|
|
||||||
|
// Commit changes
|
||||||
|
localDbCtx.SaveChanges();
|
||||||
|
}
|
||||||
return coreConv(currData);
|
return coreConv(currData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update record su DB x PType
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ProdId"></param>
|
||||||
|
/// <param name="PType"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public Core.ProdFileM UpdatePType(int ProdId, BWType PType)
|
||||||
|
{
|
||||||
|
ProdModel currData;
|
||||||
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
|
{
|
||||||
|
currData = localDbCtx
|
||||||
|
.ProdList
|
||||||
|
.Where(x => x.ProdId == ProdId)
|
||||||
|
.SingleOrDefault();
|
||||||
|
// aggiorno valore BTL
|
||||||
|
currData.PType = PType;
|
||||||
|
|
||||||
|
// Commit changes
|
||||||
|
localDbCtx.SaveChanges();
|
||||||
|
}
|
||||||
|
return coreConv(currData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary> Return User Code/Key that Locks by ProdId (proj & prod) </summary> <param
|
||||||
|
/// name="ProdId"></param> <returns></returns>
|
||||||
|
public string UserLockByProdId(int ProdId)
|
||||||
|
{
|
||||||
|
string LockBy = "";
|
||||||
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
|
{
|
||||||
|
// seleziono il prod...
|
||||||
|
var currProd = localDbCtx
|
||||||
|
.ProdList
|
||||||
|
.Where(x => x.ProdId == ProdId)
|
||||||
|
.FirstOrDefault();
|
||||||
|
|
||||||
|
if (currProd != null)
|
||||||
|
{
|
||||||
|
LockBy = currProd.LockedBy;
|
||||||
|
|
||||||
|
var currProj = localDbCtx
|
||||||
|
.ProjList
|
||||||
|
.Where(x => x.ProdDbId == currProd.ProdDbId)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
if (currProj != null && string.IsNullOrEmpty(LockBy))
|
||||||
|
{
|
||||||
|
LockBy = currProj.FirstOrDefault(x => !string.IsNullOrEmpty(x.LockedBy)).LockedBy;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return LockBy;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion Public Methods
|
#endregion Public Methods
|
||||||
|
|
||||||
|
#region Protected Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper conversione modelli
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="currProd"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected Core.ProdFileM coreConv(ProdModel currProd)
|
||||||
|
{
|
||||||
|
Core.ProdFileM answ = Core.ProdFileM.CreateProdFileM(currProd.ProdId, ProjIdByProd(currProd.ProdId), currProd.DtCreated, currProd.Description, currProd.PType, currProd.Machine, currProd.LockedBy, currProd.LockDate);
|
||||||
|
return answ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get LAST paginated data from DB (DESC ordered)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="numRecord"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected List<ProdModel> GetLastDbModelDesc(int numRecord)
|
||||||
|
{
|
||||||
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
|
{
|
||||||
|
// se numRecord = 0 --> passo tutti
|
||||||
|
if (numRecord == 0)
|
||||||
|
{
|
||||||
|
numRecord = localDbCtx.ProdList.Count();
|
||||||
|
}
|
||||||
|
// retrieve
|
||||||
|
return localDbCtx
|
||||||
|
.ProdList
|
||||||
|
.OrderByDescending(x => x.ProdId)
|
||||||
|
.Take(numRecord)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected List<int> ProjIdByProd(int ProdId)
|
||||||
|
{
|
||||||
|
return DbManager.obj.ProjCtr.GetByProdAsc(ProdId).Select(y => y.nProjId).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Protected Methods
|
||||||
|
|
||||||
|
#region Private Fields
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Istanza logger
|
||||||
|
/// </summary>
|
||||||
|
private NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,127 +1,134 @@
|
|||||||
using System;
|
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||||
|
using NLog;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
|
||||||
using static EgtBEAMWALL.Core.ConstBeam;
|
using static EgtBEAMWALL.Core.ConstBeam;
|
||||||
|
|
||||||
namespace EgtBEAMWALL.DataLayer.Controllers
|
namespace EgtBEAMWALL.DataLayer.Controllers
|
||||||
{
|
{
|
||||||
public class ProjController : IDisposable
|
public class ProjController : IDisposable
|
||||||
{
|
{
|
||||||
#region Private Fields
|
|
||||||
|
|
||||||
private DatabaseContext dbCtx;
|
|
||||||
|
|
||||||
#endregion Private Fields
|
|
||||||
|
|
||||||
#region Public Constructors
|
#region Public Constructors
|
||||||
|
|
||||||
public ProjController()
|
public ProjController()
|
||||||
{
|
{
|
||||||
// Initialize database context
|
|
||||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Public Constructors
|
#endregion Public Constructors
|
||||||
|
|
||||||
#region Protected Methods
|
#region Public Methods
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Helper conversione modelli
|
/// Search for already imported BTL from FileName (only)
|
||||||
|
/// =0 : NOT found >0 : ProjId (already present) for overwrite
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="currProj"></param>
|
/// <param name="BTLFileName"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
protected Core.ProjFileM coreConv(ProjModel currProj)
|
public int AlreadyImported(string BTLFileName)
|
||||||
{
|
|
||||||
Core.ProjFileM answ = null;
|
|
||||||
if (currProj != null)
|
|
||||||
{
|
|
||||||
answ = Core.ProjFileM.CreateProjFileM(currProj.ProjId, ProdIdByProdDbId(currProj.ProdDbId), currProj.DtCreated, currProj.DtExported, currProj.ListName, currProj.BTLFileName, currProj.IsNew, currProj.Locked, currProj.PType, currProj.Machine);
|
|
||||||
}
|
|
||||||
return answ;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get LAST paginated data from DB (DESC ordered)
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="numRecord"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
protected List<ProjModel> GetLastDbModelDesc(int numRecord)
|
|
||||||
{
|
|
||||||
// se numRecord = 0 --> passo tutti
|
|
||||||
if (numRecord == 0)
|
|
||||||
{
|
|
||||||
numRecord = dbCtx.ProjList.Count();
|
|
||||||
}
|
|
||||||
// retrieve
|
|
||||||
return dbCtx
|
|
||||||
.ProjList
|
|
||||||
.OrderByDescending(x => x.ProjId)
|
|
||||||
.Take(numRecord)
|
|
||||||
.ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get ProdId by ProdDbId, 0 se non trovato
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="ProdDbId"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
protected int ProdIdByProdDbId(int? ProdDbId)
|
|
||||||
{
|
{
|
||||||
int answ = 0;
|
int answ = 0;
|
||||||
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
if (ProdDbId != null)
|
|
||||||
{
|
{
|
||||||
var prodRecord = dbCtx
|
var dbResult = localDbCtx
|
||||||
.ProdList
|
.ProjList
|
||||||
.Where(x => x.ProdDbId == ProdDbId)
|
.Where(x => x.BTLFileName == BTLFileName)
|
||||||
.SingleOrDefault();
|
.FirstOrDefault();
|
||||||
|
|
||||||
if (prodRecord != null)
|
//se avesse trovato-- > riporto id...
|
||||||
|
if (dbResult != null && dbResult.ProjId > 0)
|
||||||
{
|
{
|
||||||
answ = prodRecord.ProdId;
|
answ = dbResult.ProjId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return answ;
|
return answ;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Protected Methods
|
/// <summary>
|
||||||
|
/// Delete Proj on DB by ProjId
|
||||||
#region Public Methods
|
/// </summary>
|
||||||
|
/// <param name="ProjId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public bool DeleteProj(int ProjId)
|
public bool DeleteProj(int ProjId)
|
||||||
{
|
{
|
||||||
bool done = false;
|
bool done = false;
|
||||||
|
|
||||||
var currProj = FindByProjId(ProjId);
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
|
|
||||||
// sel delle BTLParts da proj
|
|
||||||
var parts2del = dbCtx
|
|
||||||
.BTLPartList
|
|
||||||
.Where(x => x.ProjDbId == currProj.ProjDbId);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
// remove from database
|
var currProj = localDbCtx
|
||||||
dbCtx.BTLPartList.RemoveRange(parts2del);
|
.ProjList
|
||||||
dbCtx.ProjList.Remove(currProj);
|
.Where(x => x.ProjId == ProjId)
|
||||||
// Commit changes
|
.SingleOrDefault();
|
||||||
dbCtx.SaveChanges();
|
// sel delle BTLParts da proj
|
||||||
ResetController();
|
var parts2del = localDbCtx
|
||||||
done = true;
|
.BTLPartList
|
||||||
}
|
.Where(x => x.ProjDbId == currProj.ProjDbId);
|
||||||
catch (Exception exc)
|
|
||||||
{
|
try
|
||||||
Console.WriteLine($"EXCEPTION on DeleteProj: {exc}");
|
{
|
||||||
|
// remove from database
|
||||||
|
localDbCtx.BTLPartList.RemoveRange(parts2del);
|
||||||
|
localDbCtx.ProjList.Remove(currProj);
|
||||||
|
// Commit changes
|
||||||
|
localDbCtx.SaveChanges();
|
||||||
|
done = true;
|
||||||
|
}
|
||||||
|
catch (Exception exc)
|
||||||
|
{
|
||||||
|
string errMessage = $"EXCEPTION on Proj.DeleteProj: {Environment.NewLine}{exc}";
|
||||||
|
Console.WriteLine(errMessage);
|
||||||
|
Log.Error(errMessage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return done;
|
return done;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
// Clear database context
|
}
|
||||||
dbCtx.Dispose();
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get records filtered by BtlPartName matching regexp BtlFileName[_number]
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="BtlFileName">Base name to search for (=starts by BtlFileName%)</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public List<ProjModel> FindByBtlFileName(string BtlFileName)
|
||||||
|
{
|
||||||
|
List<ProjModel> searchResult = new List<ProjModel>();
|
||||||
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
|
{
|
||||||
|
// in primi cerco il record "parent" generale, se non ci fosse inutile proseguire...
|
||||||
|
ProjModel parentRec = localDbCtx
|
||||||
|
.ProjList
|
||||||
|
.Where(x => x.BTLFileName == BtlFileName)
|
||||||
|
.FirstOrDefault();
|
||||||
|
if (parentRec != null && parentRec.ProjId > 0)
|
||||||
|
{
|
||||||
|
// inserisco nei risultati
|
||||||
|
searchResult.Add(parentRec);
|
||||||
|
// cerco eventuali dati "child" puliti
|
||||||
|
var childRec = localDbCtx
|
||||||
|
.ProjList
|
||||||
|
.Where(x => x.BTLFileName.StartsWith(BtlFileName + "_"))
|
||||||
|
.ToList();
|
||||||
|
// faccio filtro con ricerca regexp x scartare "falsi positivi" come BtlFileName_nonNumero...
|
||||||
|
if (childRec.Count > 0)
|
||||||
|
{
|
||||||
|
// ciclo nei risultati x verificare se si tratti di PURO NUMERO...
|
||||||
|
foreach (var item in childRec)
|
||||||
|
{
|
||||||
|
string maybeNumber = item.BTLFileName.Replace($"{BtlFileName}_", "");
|
||||||
|
int index = 0;
|
||||||
|
bool isNumber = int.TryParse(maybeNumber, out index);
|
||||||
|
if (isNumber)
|
||||||
|
{
|
||||||
|
searchResult.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return searchResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -131,14 +138,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public ProjModel FindByProjDbId(int ProjDbId)
|
public ProjModel FindByProjDbId(int ProjDbId)
|
||||||
{
|
{
|
||||||
ProjModel answ = dbCtx
|
ProjModel answ;
|
||||||
.ProjList
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
.Where(x => x.ProjDbId == ProjDbId)
|
|
||||||
.SingleOrDefault();
|
|
||||||
// forzo rilettura
|
|
||||||
if (answ != null)
|
|
||||||
{
|
{
|
||||||
dbCtx.Entry(answ).Reload();
|
answ = localDbCtx
|
||||||
|
.ProjList
|
||||||
|
.Where(x => x.ProjDbId == ProjDbId)
|
||||||
|
.SingleOrDefault();
|
||||||
}
|
}
|
||||||
return answ;
|
return answ;
|
||||||
}
|
}
|
||||||
@@ -150,14 +156,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public ProjModel FindByProjId(int ProjId)
|
public ProjModel FindByProjId(int ProjId)
|
||||||
{
|
{
|
||||||
var answ = dbCtx
|
ProjModel answ;
|
||||||
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
|
{
|
||||||
|
answ = localDbCtx
|
||||||
.ProjList
|
.ProjList
|
||||||
.Where(x => x.ProjId == ProjId)
|
.Where(x => x.ProjId == ProjId)
|
||||||
.SingleOrDefault();
|
.SingleOrDefault();
|
||||||
// forzo rilettura
|
|
||||||
if (answ != null)
|
|
||||||
{
|
|
||||||
dbCtx.Entry(answ).Reload();
|
|
||||||
}
|
}
|
||||||
return answ;
|
return answ;
|
||||||
}
|
}
|
||||||
@@ -181,29 +186,34 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
{
|
{
|
||||||
List<Core.ProjFileM> answ = new List<Core.ProjFileM>();
|
List<Core.ProjFileM> answ = new List<Core.ProjFileM>();
|
||||||
int ProdDbId = 0;
|
int ProdDbId = 0;
|
||||||
try
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
{
|
{
|
||||||
var currProd = dbCtx
|
try
|
||||||
.ProdList
|
|
||||||
.Where(x => x.ProdId == ProdId)
|
|
||||||
.FirstOrDefault();
|
|
||||||
if (currProd != null)
|
|
||||||
{
|
{
|
||||||
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 Proj.GetByProdAsc: {Environment.NewLine}{exc}";
|
||||||
|
Console.WriteLine(errMessage);
|
||||||
|
Log.Error(errMessage);
|
||||||
|
}
|
||||||
|
// retrieve
|
||||||
|
var dbRes = localDbCtx
|
||||||
|
.ProjList
|
||||||
|
.Where(x => x.ProdDbId == ProdDbId)
|
||||||
|
.OrderBy(x => x.ProdDbId)
|
||||||
|
.ToList();
|
||||||
|
// conversione
|
||||||
|
answ = dbRes.Select(x => coreConv(x)).ToList();
|
||||||
}
|
}
|
||||||
catch (Exception exc)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"EXCEPTION on GetByProdAsc: {exc}");
|
|
||||||
}
|
|
||||||
// retrieve
|
|
||||||
var dbRes = dbCtx
|
|
||||||
.ProjList
|
|
||||||
.Where(x => x.ProdDbId == ProdDbId)
|
|
||||||
.OrderBy(x => x.ProdDbId)
|
|
||||||
.ToList();
|
|
||||||
// conversione
|
|
||||||
answ = dbRes.Select(x => coreConv(x)).ToList();
|
|
||||||
return answ;
|
return answ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,29 +226,34 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
{
|
{
|
||||||
List<Core.ProjFileM> answ = new List<Core.ProjFileM>();
|
List<Core.ProjFileM> answ = new List<Core.ProjFileM>();
|
||||||
int ProdDbId = 0;
|
int ProdDbId = 0;
|
||||||
try
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
{
|
{
|
||||||
var currProd = dbCtx
|
try
|
||||||
.ProdList
|
|
||||||
.Where(x => x.ProdId == ProdId)
|
|
||||||
.FirstOrDefault();
|
|
||||||
if (currProd != null)
|
|
||||||
{
|
{
|
||||||
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 Proj.GetByProdDesc: {Environment.NewLine}{exc}";
|
||||||
|
Console.WriteLine(errMessage);
|
||||||
|
Log.Error(errMessage);
|
||||||
|
}
|
||||||
|
// retrieve
|
||||||
|
var dbRes = localDbCtx
|
||||||
|
.ProjList
|
||||||
|
.Where(x => x.ProdDbId == ProdDbId)
|
||||||
|
.OrderByDescending(x => x.ProdDbId)
|
||||||
|
.ToList();
|
||||||
|
// conversione
|
||||||
|
answ = dbRes.Select(x => coreConv(x)).ToList();
|
||||||
}
|
}
|
||||||
catch (Exception exc)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"EXCEPTION on GetByProdAsc: {exc}");
|
|
||||||
}
|
|
||||||
// retrieve
|
|
||||||
var dbRes = dbCtx
|
|
||||||
.ProjList
|
|
||||||
.Where(x => x.ProdDbId == ProdDbId)
|
|
||||||
.OrderByDescending(x => x.ProdDbId)
|
|
||||||
.ToList();
|
|
||||||
// conversione
|
|
||||||
answ = dbRes.Select(x => coreConv(x)).ToList();
|
|
||||||
return answ;
|
return answ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -271,105 +286,125 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
{
|
{
|
||||||
List<Core.ProjFileM> answ = new List<Core.ProjFileM>();
|
List<Core.ProjFileM> answ = new List<Core.ProjFileM>();
|
||||||
|
|
||||||
// se numRecord = 0 --> passo tutti
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
if (numRecord == 0)
|
|
||||||
{
|
{
|
||||||
numRecord = dbCtx.ProjList.Count();
|
// se numRecord = 0 --> passo tutti
|
||||||
|
if (numRecord == 0)
|
||||||
|
{
|
||||||
|
numRecord = localDbCtx.ProjList.Count();
|
||||||
|
}
|
||||||
|
// retrieve
|
||||||
|
var dbRes = localDbCtx
|
||||||
|
.ProjList
|
||||||
|
.OrderByDescending(x => x.ProjId)
|
||||||
|
.Take(numRecord)
|
||||||
|
.ToList();
|
||||||
|
// conversione
|
||||||
|
answ = dbRes.Select(x => coreConv(x)).ToList();
|
||||||
}
|
}
|
||||||
// retrieve
|
|
||||||
var dbRes = dbCtx
|
|
||||||
.ProjList
|
|
||||||
.OrderByDescending(x => x.ProjId)
|
|
||||||
.Take(numRecord)
|
|
||||||
.ToList();
|
|
||||||
// conversione
|
|
||||||
answ = dbRes.Select(x => coreConv(x)).ToList();
|
|
||||||
return answ;
|
return answ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fornisce nuovo indice VUOTO da usare (allocando sul DB)
|
/// Fornisce nuovo indice VUOTO da usare (allocando sul DB)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="UserKey">User ID / Key number</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public int GetNextIndex()
|
public int GetNextIndex(string UserKey = "USER01")
|
||||||
{
|
{
|
||||||
int nextId = 0;
|
int nextId = 0;
|
||||||
|
|
||||||
// cerco se ne ho ALMENO 1....
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
var numRec = dbCtx.ProjList.Count();
|
|
||||||
if (numRec == 0)
|
|
||||||
{
|
{
|
||||||
nextId = 1;
|
// cerco se ne ho ALMENO 1....
|
||||||
}
|
var numRec = localDbCtx.ProjList.Count();
|
||||||
else
|
if (numRec == 0)
|
||||||
{
|
{
|
||||||
// retrieve ultimo...
|
nextId = 1;
|
||||||
var maxRecord = dbCtx
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// retrieve ultimo...
|
||||||
|
var maxRecord = localDbCtx
|
||||||
|
.ProjList
|
||||||
|
.OrderByDescending(x => x.ProjId)
|
||||||
|
.Take(1)
|
||||||
|
.FirstOrDefault();
|
||||||
|
// incremento
|
||||||
|
nextId = maxRecord.ProjId + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// creo nuovo...
|
||||||
|
var newRec = localDbCtx
|
||||||
.ProjList
|
.ProjList
|
||||||
.OrderByDescending(x => x.ProjId)
|
.Add(new ProjModel()
|
||||||
.Take(1)
|
{
|
||||||
.FirstOrDefault();
|
ProjId = nextId,
|
||||||
// incremento
|
BTLFileName = "",
|
||||||
nextId = maxRecord.ProjId + 1;
|
IsNew = true,
|
||||||
|
Locked = true,
|
||||||
|
LockedBy = UserKey,
|
||||||
|
LockDate = DateTime.Now,
|
||||||
|
DtCreated = DateTime.Now
|
||||||
|
});
|
||||||
|
|
||||||
|
// Commit changes
|
||||||
|
localDbCtx.SaveChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
// creo nuovo...
|
|
||||||
var newRec = dbCtx
|
|
||||||
.ProjList
|
|
||||||
.Add(new ProjModel() { ProjId = nextId, BTLFileName = "", IsNew = true, Locked = true, DtCreated = DateTime.Now });
|
|
||||||
|
|
||||||
// Commit changes
|
|
||||||
dbCtx.SaveChanges();
|
|
||||||
|
|
||||||
return nextId;
|
return nextId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary> Manage Lock by ProjId (proj & prod) </summary> <param name="ProjId">ID
|
||||||
/// Manage Lock by ProjId (proj & prod)
|
/// Proj</param> <param name="Locked">Stato Lock da impostare</param> <param
|
||||||
/// </summary>
|
/// name="UserKey">User ID / Key number</param> <returns></returns>
|
||||||
/// <param name="ProjId">ProjID</param>
|
public Core.ProjFileM LockByProjId(int ProjId, bool Locked, string UserKey = "USER01")
|
||||||
/// <param name="Locked">Stato Lock da impostare</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public Core.ProjFileM LockByProjId(int ProjId, bool Locked)
|
|
||||||
{
|
{
|
||||||
var currProj = dbCtx
|
ProjModel currProj;
|
||||||
.ProjList
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
.Where(x => x.ProjId == ProjId)
|
|
||||||
.SingleOrDefault();
|
|
||||||
// aggiorno stato del proj
|
|
||||||
currProj.Locked = Locked;
|
|
||||||
dbCtx.Entry(currProj).State = System.Data.Entity.EntityState.Modified;
|
|
||||||
|
|
||||||
// seleziono il prod e lo blocco...
|
|
||||||
var currProd = dbCtx
|
|
||||||
.ProdList
|
|
||||||
.Where(x => x.ProdDbId == currProj.ProdDbId)
|
|
||||||
.SingleOrDefault();
|
|
||||||
|
|
||||||
if (currProd != null)
|
|
||||||
{
|
{
|
||||||
// blocco prod corrente
|
currProj = localDbCtx
|
||||||
currProd.Locked = Locked;
|
.ProjList
|
||||||
dbCtx.Entry(currProd).State = System.Data.Entity.EntityState.Modified;
|
.Where(x => x.ProjId == ProjId)
|
||||||
|
.SingleOrDefault();
|
||||||
|
// aggiorno stato del proj
|
||||||
|
currProj.Locked = Locked;
|
||||||
|
currProj.LockDate = DateTime.Now;
|
||||||
|
currProj.LockedBy = Locked ? UserKey : "";
|
||||||
|
localDbCtx.Entry(currProj).State = System.Data.Entity.EntityState.Modified;
|
||||||
|
|
||||||
// ora blocco altri proj del prod...
|
// seleziono il prod e lo blocco...
|
||||||
var currProjs = dbCtx
|
var currProd = localDbCtx
|
||||||
.ProjList
|
.ProdList
|
||||||
.Where(x => x.ProdDbId == currProd.ProdDbId && x.ProjId != ProjId)
|
.Where(x => x.ProdDbId == currProj.ProdDbId)
|
||||||
.ToList();
|
.SingleOrDefault();
|
||||||
|
|
||||||
//currProjs.ForEach(x => x.Locked = Locked);
|
if (currProd != null)
|
||||||
foreach (var item in currProjs)
|
|
||||||
{
|
{
|
||||||
//item.ProdDbId = currProd.ProdDbId;
|
// blocco prod corrente
|
||||||
item.Locked = Locked;
|
currProd.Locked = Locked;
|
||||||
dbCtx.Entry(item).State = System.Data.Entity.EntityState.Modified;
|
currProd.LockDate = DateTime.Now;
|
||||||
}
|
currProd.LockedBy = Locked ? UserKey : "";
|
||||||
}
|
localDbCtx.Entry(currProd).State = System.Data.Entity.EntityState.Modified;
|
||||||
// salvataggio
|
|
||||||
dbCtx.SaveChanges();
|
|
||||||
ResetController();
|
|
||||||
|
|
||||||
|
// ora blocco altri proj del prod...
|
||||||
|
var currProjs = localDbCtx
|
||||||
|
.ProjList
|
||||||
|
.Where(x => x.ProdDbId == currProd.ProdDbId && x.ProjId != ProjId)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
//currProjs.ForEach(x => x.Locked = Locked);
|
||||||
|
foreach (var item in currProjs)
|
||||||
|
{
|
||||||
|
//item.ProdDbId = currProd.ProdDbId;
|
||||||
|
item.Locked = Locked;
|
||||||
|
item.LockDate = DateTime.Now;
|
||||||
|
item.LockedBy = Locked ? UserKey : "";
|
||||||
|
localDbCtx.Entry(item).State = System.Data.Entity.EntityState.Modified;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// salvataggio
|
||||||
|
localDbCtx.SaveChanges();
|
||||||
|
}
|
||||||
return coreConv(currProj);
|
return coreConv(currProj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -378,8 +413,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void ResetController()
|
public void ResetController()
|
||||||
{
|
{
|
||||||
// Re-Initialize database context
|
|
||||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -390,16 +423,18 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Core.ProjFileM ResetNew(int ProjId)
|
public Core.ProjFileM ResetNew(int ProjId)
|
||||||
{
|
{
|
||||||
var currProj = dbCtx
|
ProjModel currProj;
|
||||||
.ProjList
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
.Where(x => x.ProjId == ProjId)
|
{
|
||||||
.SingleOrDefault();
|
currProj = localDbCtx
|
||||||
|
.ProjList
|
||||||
// aggiorno stato
|
.Where(x => x.ProjId == ProjId)
|
||||||
currProj.IsNew = false;
|
.SingleOrDefault();
|
||||||
dbCtx.SaveChanges();
|
|
||||||
ResetController();
|
|
||||||
|
|
||||||
|
// aggiorno stato
|
||||||
|
currProj.IsNew = false;
|
||||||
|
localDbCtx.SaveChanges();
|
||||||
|
}
|
||||||
return coreConv(currProj);
|
return coreConv(currProj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -411,27 +446,29 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
public bool Update(ProjModel updItem)
|
public bool Update(ProjModel updItem)
|
||||||
{
|
{
|
||||||
bool done = false;
|
bool done = false;
|
||||||
var item2update = dbCtx
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
.ProjList
|
|
||||||
.Where(x => x.ProjId == updItem.ProjId)
|
|
||||||
.SingleOrDefault();
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
updItem.ProjDbId = item2update.ProjDbId;
|
var item2update = localDbCtx
|
||||||
// update, vers 1...
|
.ProjList
|
||||||
dbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
.Where(x => x.ProjId == updItem.ProjId)
|
||||||
|
.SingleOrDefault();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
updItem.ProjDbId = item2update.ProjDbId;
|
||||||
|
// update, vers 1...
|
||||||
|
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||||
|
|
||||||
//// update, vers 2
|
//// update, vers 2
|
||||||
//dbCtx.PartList.Remove(item2del);
|
//dbCtx.PartList.Remove(item2del);
|
||||||
//dbCtx.PartList.Add(updItem);
|
//dbCtx.PartList.Add(updItem);
|
||||||
|
|
||||||
// Commit changes
|
// Commit changes
|
||||||
dbCtx.SaveChanges();
|
localDbCtx.SaveChanges();
|
||||||
ResetController();
|
done = true;
|
||||||
done = true;
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{ }
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
|
||||||
{ }
|
|
||||||
return done;
|
return done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -446,78 +483,80 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
// record del proj corrente
|
// record del proj corrente
|
||||||
var currData = FindByProjId(ProjId);
|
var currData = FindByProjId(ProjId);
|
||||||
|
|
||||||
// 2021.05.03 modifica update: esistenti le MODIFICO, nuove aggiungo, inesistenti elimino in cascata con Part
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
|
|
||||||
// sel delle BTLParts del proj
|
|
||||||
List<BTLPartModel> oldBtlParts = dbCtx
|
|
||||||
.BTLPartList
|
|
||||||
.Where(x => x.ProjDbId == currData.ProjDbId)
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
// converto le BtlParts da core --> DB
|
|
||||||
List<BTLPartModel> newBtlParts = BtlPartList.Select(x => BTLPartController.ConvertFromCore(x, currData.ProjDbId)).ToList();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
// elementi BtlPartId NON + presenti da eliminare
|
// 2021.05.03 modifica update: esistenti le MODIFICO, nuove aggiungo, inesistenti
|
||||||
List<int> bpi2rem = oldBtlParts.Select(x => x.PartId).Except(newBtlParts.Select(y => y.PartId)).ToList();
|
// elimino in cascata con Part
|
||||||
List<int> bpi2add = newBtlParts.Select(x => x.PartId).Except(oldBtlParts.Select(y => y.PartId)).ToList();
|
|
||||||
List<int> bpiExis = newBtlParts.Select(x => x.PartId).Intersect(oldBtlParts.Select(y => y.PartId)).ToList();
|
|
||||||
|
|
||||||
// aggiorno existing...
|
// sel delle BTLParts del proj
|
||||||
foreach (var currPartId in bpiExis)
|
List<BTLPartModel> oldBtlParts = localDbCtx
|
||||||
|
.BTLPartList
|
||||||
|
.Where(x => x.ProjDbId == currData.ProjDbId)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
// converto le BtlParts da core --> DB
|
||||||
|
List<BTLPartModel> newBtlParts = BtlPartList.Select(x => BTLPartController.ConvertFromCore(x, currData.ProjDbId)).ToList();
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
// recupero item da aggiornare...
|
// elementi BtlPartId NON + presenti da eliminare
|
||||||
var oldItem = oldBtlParts.Where(x => x.PartId == currPartId).FirstOrDefault();
|
List<int> bpi2rem = oldBtlParts.Select(x => x.PartId).Except(newBtlParts.Select(y => y.PartId)).ToList();
|
||||||
// dati nuovo item
|
List<int> bpi2add = newBtlParts.Select(x => x.PartId).Except(oldBtlParts.Select(y => y.PartId)).ToList();
|
||||||
var newItem = newBtlParts.Where(x => x.PartId == currPartId).FirstOrDefault();
|
List<int> bpiExis = newBtlParts.Select(x => x.PartId).Intersect(oldBtlParts.Select(y => y.PartId)).ToList();
|
||||||
if (newItem != null && oldItem != null)
|
|
||||||
|
// aggiorno existing...
|
||||||
|
foreach (var currPartId in bpiExis)
|
||||||
{
|
{
|
||||||
oldItem.CALC_State = newItem.CALC_State;
|
// recupero item da aggiornare...
|
||||||
oldItem.CNT = newItem.CNT;
|
var oldItem = oldBtlParts.Where(x => x.PartId == currPartId).FirstOrDefault();
|
||||||
oldItem.DO = newItem.DO;
|
// dati nuovo item
|
||||||
oldItem.H = newItem.H;
|
var newItem = newBtlParts.Where(x => x.PartId == currPartId).FirstOrDefault();
|
||||||
oldItem.L = newItem.L;
|
if (newItem != null && oldItem != null)
|
||||||
oldItem.W = newItem.W;
|
{
|
||||||
oldItem.Material = newItem.Material;
|
oldItem.CALC_State = newItem.CALC_State;
|
||||||
oldItem.NAM = newItem.NAM;
|
oldItem.CNT = newItem.CNT;
|
||||||
oldItem.PDN = newItem.PDN;
|
oldItem.DO = newItem.DO;
|
||||||
|
oldItem.H = newItem.H;
|
||||||
|
oldItem.L = newItem.L;
|
||||||
|
oldItem.W = newItem.W;
|
||||||
|
oldItem.Material = newItem.Material;
|
||||||
|
oldItem.NAM = newItem.NAM;
|
||||||
|
oldItem.PDN = newItem.PDN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// aggiungo le nuove part
|
||||||
|
foreach (var newPartId in bpi2add)
|
||||||
|
{
|
||||||
|
var newItem = newBtlParts.Where(x => x.PartId == newPartId).FirstOrDefault();
|
||||||
|
localDbCtx.BTLPartList.Add(newItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
// elimino dal DB i non + esistenti
|
||||||
|
foreach (var oldPartId in bpi2rem)
|
||||||
|
{
|
||||||
|
// elimino parts nei MachGroup
|
||||||
|
var oldIstPartList = localDbCtx.PartList.Where(x => x.BTLPart.PartId == oldPartId).ToList();
|
||||||
|
localDbCtx.PartList.RemoveRange(oldIstPartList);
|
||||||
|
// elimino BtlParts
|
||||||
|
var oldItem = oldBtlParts.Where(x => x.PartId == oldPartId).FirstOrDefault();
|
||||||
|
localDbCtx.BTLPartList.Remove(oldItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch
|
||||||
|
{ }
|
||||||
|
|
||||||
// aggiungo le nuove part
|
// aggiorno valore isNew a false
|
||||||
foreach (var newPartId in bpi2add)
|
currData.IsNew = false;
|
||||||
{
|
|
||||||
var newItem = newBtlParts.Where(x => x.PartId == newPartId).FirstOrDefault();
|
|
||||||
dbCtx.BTLPartList.Add(newItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
// elimino dal DB i non + esistenti
|
// Commit changes
|
||||||
foreach (var oldPartId in bpi2rem)
|
localDbCtx.SaveChanges();
|
||||||
{
|
|
||||||
// elimino parts nei MachGroup
|
|
||||||
var oldIstPartList = dbCtx.PartList.Where(x => x.BTLPart.PartId == oldPartId).ToList();
|
|
||||||
dbCtx.PartList.RemoveRange(oldIstPartList);
|
|
||||||
// elimino BtlParts
|
|
||||||
var oldItem = oldBtlParts.Where(x => x.PartId == oldPartId).FirstOrDefault();
|
|
||||||
dbCtx.BTLPartList.Remove(oldItem);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch
|
|
||||||
{ }
|
|
||||||
|
|
||||||
// aggiorno valore isNew a false
|
|
||||||
currData.IsNew = false;
|
|
||||||
|
|
||||||
// Commit changes
|
|
||||||
dbCtx.SaveChanges();
|
|
||||||
ResetController();
|
|
||||||
|
|
||||||
return currData;
|
return currData;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update record su DB x nomeBTL, ListName, ExportDate
|
/// Update record su DB x nomeBTL, ListName, ExportDate
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ProjId"></param>
|
/// <param name="ProjId"></param>
|
||||||
/// <param name="BTLFileName"></param>
|
/// <param name="BTLFileName"></param>
|
||||||
@@ -526,59 +565,189 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Core.ProjFileM UpdateInfo(int ProjId, string BTLFileName, string ListName, DateTime DtExported, BWType PType, string Machine)
|
public Core.ProjFileM UpdateInfo(int ProjId, string BTLFileName, string ListName, DateTime DtExported, BWType PType, string Machine)
|
||||||
{
|
{
|
||||||
var currData = FindByProjId(ProjId);
|
// cerco specifico Proj
|
||||||
// aggiorno valore BTL
|
ProjModel currData;
|
||||||
currData.BTLFileName = BTLFileName;
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
currData.DtExported = DtExported;
|
{
|
||||||
currData.ListName = ListName;
|
currData = localDbCtx
|
||||||
currData.PType = PType;
|
.ProjList
|
||||||
currData.Machine = Machine;
|
.Where(x => x.ProjId == ProjId)
|
||||||
|
.SingleOrDefault();
|
||||||
|
|
||||||
// Commit changes
|
// 2022.01.24: verifico UNIVOCITA' nel nome del file: SE fosse duplicato --> nuovo
|
||||||
dbCtx.SaveChanges();
|
// nome, nel formato nomeOriginale_idx, dove idx è il contatore libero successivo
|
||||||
ResetController();
|
var duplicateList = FindByBtlFileName(BTLFileName);
|
||||||
|
// devo verificare SOLO SE la lista non è vuota
|
||||||
|
if (duplicateList != null && duplicateList.Count > 0)
|
||||||
|
{
|
||||||
|
// se ne ho esattamente 1 nel DB allora DEVE essere il record Parent
|
||||||
|
if (duplicateList.Count == 1)
|
||||||
|
{
|
||||||
|
// verifico se ProjId variato
|
||||||
|
if (!duplicateList[0].ProjId.Equals(currData.ProjId))
|
||||||
|
{
|
||||||
|
// in questo caso ho il PRIMO duplicato
|
||||||
|
BTLFileName = $"{BTLFileName}_1";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// se ne ho + di 1 --> so che il maxId interno avrò il valore ULTIMO x prendere
|
||||||
|
// il successivo
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var lastRec = duplicateList.OrderByDescending(x => x.ProjDbId).FirstOrDefault();
|
||||||
|
// cerco indice
|
||||||
|
string maybeNumber = lastRec.BTLFileName.Replace($"{BTLFileName}_", "");
|
||||||
|
int index = 0;
|
||||||
|
bool isNumber = int.TryParse(maybeNumber, out index);
|
||||||
|
// fasccio comunque verifica sia numerico
|
||||||
|
if (isNumber)
|
||||||
|
{
|
||||||
|
// in questo caso ho il l'ULTIMO duplicato e faccio +1
|
||||||
|
BTLFileName = $"{BTLFileName}_{index + 1}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// aggiorno valore BTL
|
||||||
|
currData.BTLFileName = BTLFileName;
|
||||||
|
currData.DtExported = DtExported;
|
||||||
|
currData.ListName = ListName;
|
||||||
|
currData.PType = PType;
|
||||||
|
currData.Machine = Machine;
|
||||||
|
|
||||||
|
// Commit changes
|
||||||
|
localDbCtx.SaveChanges();
|
||||||
|
}
|
||||||
|
|
||||||
return coreConv(currData);
|
return coreConv(currData);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update record su DB x nomeBTL, ListName, ExportDate
|
/// Update record su DB x nomeBTL, ListName, ExportDate
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ProjId"></param>
|
/// <param name="ProjId"></param>
|
||||||
/// <param name="ListName"></param>
|
/// <param name="ListName"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Core.ProjFileM UpdateListName(int ProjId, string ListName)
|
public Core.ProjFileM UpdateListName(int ProjId, string ListName)
|
||||||
{
|
{
|
||||||
var currData = FindByProjId(ProjId);
|
ProjModel currData;
|
||||||
// aggiorno valore BTL
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
currData.ListName = ListName;
|
{
|
||||||
|
currData = localDbCtx
|
||||||
// Commit changes
|
.ProjList
|
||||||
dbCtx.SaveChanges();
|
.Where(x => x.ProjId == ProjId)
|
||||||
ResetController();
|
.SingleOrDefault();
|
||||||
|
// aggiorno valore BTL
|
||||||
|
currData.ListName = ListName;
|
||||||
|
|
||||||
|
// Commit changes
|
||||||
|
localDbCtx.SaveChanges();
|
||||||
|
}
|
||||||
return coreConv(currData);
|
return coreConv(currData);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update record su DB x PType
|
/// Update record su DB x PType
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ProjId"></param>
|
/// <param name="ProjId"></param>
|
||||||
/// <param name="Machine"></param>
|
/// <param name="Machine"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Core.ProjFileM UpdateMachine(int ProjId, String Machine)
|
public Core.ProjFileM UpdateMachine(int ProjId, String Machine)
|
||||||
{
|
{
|
||||||
var currData = FindByProjId(ProjId);
|
ProjModel currData;
|
||||||
// aggiorno valore BTL
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
currData.Machine = Machine;
|
{
|
||||||
|
currData = localDbCtx
|
||||||
|
.ProjList
|
||||||
|
.Where(x => x.ProjId == ProjId)
|
||||||
|
.SingleOrDefault();
|
||||||
|
// aggiorno valore BTL
|
||||||
|
currData.Machine = Machine;
|
||||||
|
|
||||||
// Commit changes
|
// Commit changes
|
||||||
dbCtx.SaveChanges();
|
localDbCtx.SaveChanges();
|
||||||
ResetController();
|
}
|
||||||
|
return coreConv(currData);
|
||||||
return coreConv(currData);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Public Methods
|
#endregion Public Methods
|
||||||
|
|
||||||
|
#region Protected Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper conversione modelli
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="currProj"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected Core.ProjFileM coreConv(ProjModel currProj)
|
||||||
|
{
|
||||||
|
Core.ProjFileM answ = null;
|
||||||
|
if (currProj != null)
|
||||||
|
{
|
||||||
|
answ = Core.ProjFileM.CreateProjFileM(currProj.ProjId, ProdIdByProdDbId(currProj.ProdDbId), currProj.DtCreated, currProj.DtExported, currProj.ListName, currProj.BTLFileName, currProj.IsNew, currProj.Locked, currProj.PType, currProj.Machine);
|
||||||
|
}
|
||||||
|
return answ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get LAST paginated data from DB (DESC ordered)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="numRecord"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected List<ProjModel> GetLastDbModelDesc(int numRecord)
|
||||||
|
{
|
||||||
|
// se numRecord = 0 --> passo tutti
|
||||||
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
|
{
|
||||||
|
if (numRecord == 0)
|
||||||
|
{
|
||||||
|
numRecord = localDbCtx.ProjList.Count();
|
||||||
|
}
|
||||||
|
// retrieve
|
||||||
|
return localDbCtx
|
||||||
|
.ProjList
|
||||||
|
.OrderByDescending(x => x.ProjId)
|
||||||
|
.Take(numRecord)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get ProdId by ProdDbId, 0 se non trovato
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ProdDbId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected int ProdIdByProdDbId(int? ProdDbId)
|
||||||
|
{
|
||||||
|
int answ = 0;
|
||||||
|
|
||||||
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
|
{
|
||||||
|
if (ProdDbId != null)
|
||||||
|
{
|
||||||
|
var prodRecord = localDbCtx
|
||||||
|
.ProdList
|
||||||
|
.Where(x => x.ProdDbId == ProdDbId)
|
||||||
|
.SingleOrDefault();
|
||||||
|
|
||||||
|
if (prodRecord != null)
|
||||||
|
{
|
||||||
|
answ = prodRecord.ProdId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return answ;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Protected Methods
|
||||||
|
|
||||||
|
#region Private Fields
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Istanza logger
|
||||||
|
/// </summary>
|
||||||
|
private NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,19 +1,13 @@
|
|||||||
using System;
|
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||||
|
using NLog;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
|
||||||
|
|
||||||
namespace EgtBEAMWALL.DataLayer.Controllers
|
namespace EgtBEAMWALL.DataLayer.Controllers
|
||||||
{
|
{
|
||||||
public class StatusMapController : IDisposable
|
public class StatusMapController : IDisposable
|
||||||
{
|
{
|
||||||
#region Private Fields
|
|
||||||
|
|
||||||
private DatabaseContext dbCtx;
|
|
||||||
|
|
||||||
#endregion Private Fields
|
|
||||||
|
|
||||||
#region Public Fields
|
#region Public Fields
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -27,8 +21,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
|
|
||||||
public StatusMapController()
|
public StatusMapController()
|
||||||
{
|
{
|
||||||
// Initialize database context
|
|
||||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Public Constructors
|
#endregion Public Constructors
|
||||||
@@ -38,7 +30,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Elimina i dati di una sessione (SupervisorId) precedente
|
/// Elimina i dati di una sessione (SupervisorId) precedente
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="Session">Se vuoto --> tutti</param>
|
/// <param name="Session">Se vuoto --> tutti</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool DeleteSession(string Session)
|
public bool DeleteSession(string Session)
|
||||||
{
|
{
|
||||||
@@ -46,41 +38,42 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
DateTime adesso = DateTime.Now;
|
DateTime adesso = DateTime.Now;
|
||||||
List<StatusMapModel> SM2Del = new List<StatusMapModel>();
|
List<StatusMapModel> SM2Del = new List<StatusMapModel>();
|
||||||
|
|
||||||
// svuoto la tab mappa precedente (da rivalutare in futuro)
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
if (string.IsNullOrEmpty(Session))
|
|
||||||
{
|
{
|
||||||
SM2Del = dbCtx
|
// svuoto la tab mappa precedente (da rivalutare in futuro)
|
||||||
.StatusMapList
|
if (string.IsNullOrEmpty(Session))
|
||||||
.ToList();
|
{
|
||||||
|
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;
|
return done;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
// Clear database context
|
|
||||||
dbCtx.Dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -88,67 +81,78 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="Session"></param>
|
/// <param name="Session"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<StatusMapModel> GetBySession(string Session = "")
|
public List<StatusMapModel> GetBySession(string Session)
|
||||||
{
|
{
|
||||||
// retrieve
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
return dbCtx
|
{
|
||||||
|
// retrieve
|
||||||
|
return localDbCtx
|
||||||
.StatusMapList
|
.StatusMapList
|
||||||
.Where(x => x.Session == Session)
|
.Where(x => x.Session == Session)
|
||||||
.OrderByDescending(x => x.Index)
|
.OrderByDescending(x => x.Index)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get data for session where Index > minIndex ordered by index DESC
|
/// Get data for session where Index > minIndex ordered by index DESC
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="Session"></param>
|
||||||
/// <param name="minIndex"></param>
|
/// <param name="minIndex"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<StatusMapModel> GetFrom(int minIndex = 0)
|
public List<StatusMapModel> GetFrom(string Session, int minIndex = 0)
|
||||||
{
|
{
|
||||||
ResetController();
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
// retrieve
|
{
|
||||||
return dbCtx
|
// retrieve
|
||||||
|
return localDbCtx
|
||||||
.StatusMapList
|
.StatusMapList
|
||||||
.Where(x => x.Index >= minIndex)
|
.Where(x => x.Session == Session && x.Index >= minIndex)
|
||||||
.OrderBy(x => x.Index)
|
.OrderBy(x => x.Index)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get PROD data for session
|
/// Get PROD (all)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="Session"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<StatusMapModel> GetProd()
|
public List<StatusMapModel> GetProd()
|
||||||
{
|
{
|
||||||
List<StatusMapModel> answ = new List<StatusMapModel>();
|
List<StatusMapModel> answ = new List<StatusMapModel>();
|
||||||
// Initialize database context
|
// Initialize database context
|
||||||
using (DatabaseContext myDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
{
|
{
|
||||||
// retrieve
|
// retrieve
|
||||||
answ = myDbCtx
|
answ = localDbCtx
|
||||||
.StatusMapList
|
.StatusMapList
|
||||||
.Where(x => x.ItemType == Core.StatusMapItemType.Prod)
|
.Where(x => x.ItemType == Core.StatusMapItemType.Prod)
|
||||||
.OrderByDescending(x => x.Index)
|
.OrderByDescending(x => x.Index)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
return answ;
|
return answ;
|
||||||
#if false
|
|
||||||
// retrieve
|
|
||||||
return dbCtx
|
|
||||||
.StatusMapList
|
|
||||||
.Where(x => x.ItemType == Core.StatusMapItemType.Prod)
|
|
||||||
.OrderByDescending(x => x.Index)
|
|
||||||
.ToList();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reinizializzaizone del controller
|
/// Get PROD for session
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void ResetController()
|
/// <param name="Session"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public List<StatusMapModel> GetProd(string Session)
|
||||||
{
|
{
|
||||||
// Re-Initialize database context
|
List<StatusMapModel> answ = new List<StatusMapModel>();
|
||||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
// 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>
|
/// <summary>
|
||||||
@@ -162,10 +166,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
bool done = false;
|
bool done = false;
|
||||||
DateTime adesso = DateTime.Now;
|
DateTime adesso = DateTime.Now;
|
||||||
|
|
||||||
#if false
|
|
||||||
// svuoto dati precedenti IN BLOCCO
|
|
||||||
done = DeleteSession("");
|
|
||||||
#endif
|
|
||||||
// gestione corretta x multi-supervisors
|
// gestione corretta x multi-supervisors
|
||||||
done = DeleteSession(SupervisorId);
|
done = DeleteSession(SupervisorId);
|
||||||
|
|
||||||
@@ -176,22 +176,25 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
done = false;
|
done = false;
|
||||||
// inserisco dato prod
|
// inserisco dato prod
|
||||||
StatusMapModel prodSMRecord = new StatusMapModel() { Session = SupervisorId, Index = 0, ItemId = ProdId, ItemType = Core.StatusMapItemType.Prod, Operation = Core.StatusMapOpType.Startup, DtEvent = adesso, Val = "" };
|
StatusMapModel prodSMRecord = new StatusMapModel() { Session = SupervisorId, Index = 0, ItemId = ProdId, ItemType = Core.StatusMapItemType.Prod, Operation = Core.StatusMapOpType.Startup, DtEvent = adesso, Val = "" };
|
||||||
// aggiungo
|
// Initialize database context
|
||||||
dbCtx.StatusMapList.Add(prodSMRecord);
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
|
{
|
||||||
|
// aggiungo
|
||||||
|
localDbCtx.StatusMapList.Add(prodSMRecord);
|
||||||
|
|
||||||
// recupero MachGroup da PROD
|
// recupero MachGroup da PROD
|
||||||
var MGList = dbCtx
|
var MGList = localDbCtx
|
||||||
.MachGroupList
|
.MachGroupList
|
||||||
.Where(x => x.Prod.ProdId == ProdId)
|
.Where(x => x.Prod.ProdId == ProdId)
|
||||||
.ToList();
|
.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();
|
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
|
// aggiungo
|
||||||
dbCtx.StatusMapList.AddRange(mgSMRecords);
|
localDbCtx.StatusMapList.AddRange(mgSMRecords);
|
||||||
|
|
||||||
// salvo
|
// salvo
|
||||||
dbCtx.SaveChanges();
|
localDbCtx.SaveChanges();
|
||||||
ResetController();
|
}
|
||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
return done;
|
return done;
|
||||||
@@ -207,56 +210,70 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
/// <param name="Operation"></param>
|
/// <param name="Operation"></param>
|
||||||
/// <param name="Value"></param>
|
/// <param name="Value"></param>
|
||||||
/// <returns></returns>
|
/// <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;
|
bool fatto = false;
|
||||||
// Recupero il record PROD (che è ultimo indice)
|
// Recupero il record PROD (che è ultimo indice)
|
||||||
StatusMapModel prodData = new StatusMapModel();
|
StatusMapModel prodData = new StatusMapModel();
|
||||||
// se è un prod --> vado x ID
|
// Initialize database context
|
||||||
if (Session == "")
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
{
|
{
|
||||||
prodData = dbCtx
|
// se è un prod --> vado x ID
|
||||||
.StatusMapList
|
if (Session == "")
|
||||||
.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
|
|
||||||
{
|
{
|
||||||
// aggiorno indice PROD
|
prodData = localDbCtx
|
||||||
prodData.Index++;
|
.StatusMapList
|
||||||
// se session è nulla ma ho un PROD --> calcolo da li la sessione
|
.Where(x => x.ItemType == Core.StatusMapItemType.Prod && x.ItemId == ProdId)
|
||||||
if (string.IsNullOrEmpty(Session))
|
.FirstOrDefault();
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
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;
|
return fatto;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Public Methods
|
#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 EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||||
using System.Collections.Generic;
|
using MySql.Data.EntityFramework;
|
||||||
|
using System;
|
||||||
using System.Data.Entity;
|
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.Data.Entity.Infrastructure;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
namespace EgtBEAMWALL.DataLayer
|
namespace EgtBEAMWALL.DataLayer
|
||||||
{
|
{
|
||||||
@@ -33,15 +27,13 @@ namespace EgtBEAMWALL.DataLayer
|
|||||||
#region Public Constructors
|
#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.")]
|
[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)
|
public DatabaseContext(string connectionString) : base(connectionString)
|
||||||
{
|
{
|
||||||
//Database.CreateIfNotExists();
|
Database.CreateIfNotExists();
|
||||||
////Database.SetInitializer(new MigrateDatabaseToLatestVersion<StratonLocalizerDatabase, Migrations.Configuration>());
|
|
||||||
//Database.Initialize(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Public Constructors
|
#endregion Public Constructors
|
||||||
@@ -90,24 +82,6 @@ namespace EgtBEAMWALL.DataLayer
|
|||||||
|
|
||||||
#endregion Public Properties
|
#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
|
#region Public Methods
|
||||||
|
|
||||||
public static DatabaseContext Create()
|
public static DatabaseContext Create()
|
||||||
@@ -115,44 +89,6 @@ namespace EgtBEAMWALL.DataLayer
|
|||||||
return new DatabaseContext(DbConfig.CONNECTION_STRING);
|
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
|
#endregion Public Methods
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -98,12 +98,5 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
|||||||
|
|
||||||
#endregion Public Properties
|
#endregion Public Properties
|
||||||
|
|
||||||
#if false
|
|
||||||
/// <summary>
|
|
||||||
/// MachineId del BTL
|
|
||||||
/// </summary>
|
|
||||||
[Column("MachineId")]
|
|
||||||
public string MachineId { get; set; } = "";
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -32,11 +32,23 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
|||||||
public bool IsNew { get; set; } = true;
|
public bool IsNew { get; set; } = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stato locked (quando aperto da un dispositivo in rete)
|
/// Stato locked, quando aperto da un dispositivo in rete
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Column("Lock")]
|
[Column("Lock")]
|
||||||
public bool Locked { get; set; } = false;
|
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>
|
/// <summary>
|
||||||
/// Macchina
|
/// Macchina
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -49,6 +49,18 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
|||||||
[Column("Lock")]
|
[Column("Lock")]
|
||||||
public bool Locked { get; set; } = false;
|
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>
|
/// <summary>
|
||||||
/// Macchina
|
/// Macchina
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
using System;
|
using System.IO;
|
||||||
using System.Collections.Generic;
|
using System.Reflection;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace EgtBEAMWALL.DataLayer
|
namespace EgtBEAMWALL.DataLayer
|
||||||
{
|
{
|
||||||
@@ -37,23 +35,67 @@ namespace EgtBEAMWALL.DataLayer
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
public static void InitDb(string server, string nKey, string sKey)
|
/// <summary>
|
||||||
|
/// Effettua migrazione esplicita del DB
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static bool CheckMigrateDb()
|
||||||
{
|
{
|
||||||
DATABASE_SERV = server;
|
// esecuzione script di migrations del DB
|
||||||
DATABASE_NAME = $"EgtBwDb_{nKey}";
|
return Controllers.DbController.man.checkMigrateDb();
|
||||||
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";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool CheckUser(string nKey, string sKey)
|
/// <summary>
|
||||||
{
|
/// Effettua verifica presenza utente
|
||||||
// esecuzione script di install locale
|
/// </summary>
|
||||||
return Controllers.DbController.man.checkCreateUser(DATABASE_USER, DATABASE_PWD);
|
/// <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);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion Public Methods
|
/// <summary>
|
||||||
}
|
/// Metodo di init standard per DB in rete con Master_Key
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="server">Indirizzo del server (tipicamente indirizzo di rete)</param>
|
||||||
|
/// <param name="nKey">Numero chiave</param>
|
||||||
|
/// <param name="sKey">Codice/pwd associato a chaive</param>
|
||||||
|
/// <param name="masterKey">Numero di chiave master con cui è creato il DB</param>
|
||||||
|
public static void InitDb(string server, string nKey, string sKey, string masterKey = "")
|
||||||
|
{
|
||||||
|
// se nulla metto amster come nKey...
|
||||||
|
masterKey = string.IsNullOrEmpty(masterKey) ? nKey : masterKey;
|
||||||
|
DATABASE_SERV = server;
|
||||||
|
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";
|
||||||
|
// 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";
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Aggiorna conf NLog x target DIR
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="logDir"></param>
|
||||||
|
public static void SetupLogDir(string logDir)
|
||||||
|
{
|
||||||
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -37,8 +37,11 @@
|
|||||||
<Prefer32Bit>false</Prefer32Bit>
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Reference Include="BouncyCastle.Crypto, Version=1.8.5.0, Culture=neutral, PublicKeyToken=0e99375e54769942">
|
||||||
|
<HintPath>..\packages\BouncyCastle.1.8.5\lib\BouncyCastle.Crypto.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="EgtWPFLib5">
|
<Reference Include="EgtWPFLib5">
|
||||||
<HintPath>..\..\..\EgtProg\DllD32\EgtWPFLib5.dll</HintPath>
|
<HintPath>..\ExtLibs\EgtWPFLib5.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
<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>
|
<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">
|
<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>
|
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="MySql.Data, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
<Reference Include="Google.Protobuf, Version=3.19.4.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\MySql.Data.6.10.9\lib\net452\MySql.Data.dll</HintPath>
|
<HintPath>..\packages\Google.Protobuf.3.19.4\lib\net45\Google.Protobuf.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="MySql.Data.Entity.EF6, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
<Reference Include="K4os.Compression.LZ4, Version=1.2.6.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\MySql.Data.Entity.6.10.9\lib\net452\MySql.Data.Entity.EF6.dll</HintPath>
|
<HintPath>..\packages\K4os.Compression.LZ4.1.2.6\lib\net46\K4os.Compression.LZ4.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="K4os.Compression.LZ4.Streams, Version=1.2.6.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\K4os.Compression.LZ4.Streams.1.2.6\lib\net46\K4os.Compression.LZ4.Streams.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="K4os.Hash.xxHash, Version=1.0.6.0, Culture=neutral, PublicKeyToken=32cd54395057cec3, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\K4os.Hash.xxHash.1.0.6\lib\net46\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>
|
||||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
<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>
|
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||||
</Reference>
|
</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" />
|
||||||
|
<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" />
|
||||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||||
<Reference Include="System.Configuration" />
|
<Reference Include="System.Configuration" />
|
||||||
@@ -63,7 +87,18 @@
|
|||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
<Reference Include="System.Drawing.Design" />
|
<Reference Include="System.Drawing.Design" />
|
||||||
|
<Reference Include="System.IO.Compression" />
|
||||||
<Reference Include="System.Management" />
|
<Reference Include="System.Management" />
|
||||||
|
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Memory.4.5.4\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=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System.Security" />
|
<Reference Include="System.Security" />
|
||||||
<Reference Include="System.ServiceModel" />
|
<Reference Include="System.ServiceModel" />
|
||||||
<Reference Include="System.ServiceProcess" />
|
<Reference Include="System.ServiceProcess" />
|
||||||
@@ -73,6 +108,12 @@
|
|||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Xml" />
|
<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>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="AdminContext.cs" />
|
<Compile Include="AdminContext.cs" />
|
||||||
@@ -121,12 +162,19 @@
|
|||||||
<Compile Include="Migrations\202109141058345_AddMachine2ProjProd.designer.cs">
|
<Compile Include="Migrations\202109141058345_AddMachine2ProjProd.designer.cs">
|
||||||
<DependentUpon>202109141058345_AddMachine2ProjProd.cs</DependentUpon>
|
<DependentUpon>202109141058345_AddMachine2ProjProd.cs</DependentUpon>
|
||||||
</Compile>
|
</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="Migrations\Configuration.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Utils.cs" />
|
<Compile Include="Utils.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="App.config" />
|
<None Include="App.config" />
|
||||||
|
<None Include="NLog.config">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -154,6 +202,9 @@
|
|||||||
<EmbeddedResource Include="Migrations\202109141058345_AddMachine2ProjProd.resx">
|
<EmbeddedResource Include="Migrations\202109141058345_AddMachine2ProjProd.resx">
|
||||||
<DependentUpon>202109141058345_AddMachine2ProjProd.cs</DependentUpon>
|
<DependentUpon>202109141058345_AddMachine2ProjProd.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="Migrations\202207051703296_UpgradeLockModel.resx">
|
||||||
|
<DependentUpon>202207051703296_UpgradeLockModel.cs</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<PropertyGroup>
|
<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
|
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||||
{
|
{
|
||||||
using System;
|
|
||||||
using System.Data.Entity;
|
|
||||||
using System.Data.Entity.Migrations;
|
using System.Data.Entity.Migrations;
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
internal sealed class Configuration : DbMigrationsConfiguration<EgtBEAMWALL.DataLayer.DatabaseContext>
|
internal sealed class Configuration : DbMigrationsConfiguration<EgtBEAMWALL.DataLayer.DatabaseContext>
|
||||||
{
|
{
|
||||||
@@ -12,7 +9,6 @@ namespace EgtBEAMWALL.DataLayer.Migrations
|
|||||||
public Configuration()
|
public Configuration()
|
||||||
{
|
{
|
||||||
AutomaticMigrationsEnabled = true;
|
AutomaticMigrationsEnabled = true;
|
||||||
//AutomaticMigrationsEnabled = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Public Constructors
|
#endregion Public Constructors
|
||||||
@@ -21,18 +17,14 @@ namespace EgtBEAMWALL.DataLayer.Migrations
|
|||||||
|
|
||||||
protected override void Seed(EgtBEAMWALL.DataLayer.DatabaseContext context)
|
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
|
// You can use the DbSet<T>.AddOrUpdate() helper extension method to avoid creating
|
||||||
// to avoid creating duplicate seed data. E.g.
|
// 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" }
|
|
||||||
// );
|
|
||||||
//
|
//
|
||||||
|
// context.People.AddOrUpdate( p => p.FullName, new Person { FullName = "Andrew Peters"
|
||||||
|
// }, new Person { FullName = "Brice Lambson" }, new Person { FullName = "Rowan Miller"
|
||||||
|
// } );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Protected Methods
|
#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>
|
||||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("2.4.1.3")]
|
[assembly: AssemblyVersion("2.4.7.1")]
|
||||||
[assembly: AssemblyFileVersion("2.4.1.3")]
|
[assembly: AssemblyFileVersion("2.4.7.1")]
|
||||||
|
|||||||
@@ -1,7 +1,18 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
|
<package id="BouncyCastle" version="1.8.5" targetFramework="net472" />
|
||||||
<package id="EntityFramework" version="6.4.4" targetFramework="net452" />
|
<package id="EntityFramework" version="6.4.4" targetFramework="net452" />
|
||||||
<package id="MySql.Data" version="6.10.9" targetFramework="net452" />
|
<package id="Google.Protobuf" version="3.19.4" targetFramework="net472" />
|
||||||
<package id="MySql.Data.Entity" version="6.10.9" targetFramework="net452" />
|
<package id="K4os.Compression.LZ4" version="1.2.6" targetFramework="net472" />
|
||||||
|
<package id="K4os.Compression.LZ4.Streams" version="1.2.6" targetFramework="net472" />
|
||||||
|
<package id="K4os.Hash.xxHash" version="1.0.6" 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="Newtonsoft.Json" version="13.0.1" targetFramework="net452" />
|
||||||
|
<package id="NLog" version="5.0.1" 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.Memory" version="4.5.4" targetFramework="net472" />
|
||||||
|
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
|
||||||
|
<package id="System.Runtime.CompilerServices.Unsafe" version="5.0.0" targetFramework="net472" />
|
||||||
</packages>
|
</packages>
|
||||||
@@ -35,8 +35,20 @@
|
|||||||
<Prefer32Bit>false</Prefer32Bit>
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<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" />
|
||||||
<Reference Include="System.Core" />
|
<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.Xml.Linq" />
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
@@ -71,6 +83,7 @@
|
|||||||
<DependentUpon>StressTest.cs</DependentUpon>
|
<DependentUpon>StressTest.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<None Include="App.config" />
|
<None Include="App.config" />
|
||||||
|
<None Include="packages.config" />
|
||||||
<None Include="Properties\Settings.settings">
|
<None Include="Properties\Settings.settings">
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ namespace EgtBEAMWALL.StressTest
|
|||||||
List<DataLayer.DatabaseModels.BTLPartModel> currPartList = new List<DataLayer.DatabaseModels.BTLPartModel>();
|
List<DataLayer.DatabaseModels.BTLPartModel> currPartList = new List<DataLayer.DatabaseModels.BTLPartModel>();
|
||||||
List<Core.MyMachGroupM> currMachGroupList = new List<Core.MyMachGroupM>();
|
List<Core.MyMachGroupM> currMachGroupList = new List<Core.MyMachGroupM>();
|
||||||
List<Core.PartM> currMGPartList = new List<Core.PartM>();
|
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..
|
// genero le BTLParts ed assegno..
|
||||||
for (int j = 0; j < currRandom.BtlPart2Proj; j++)
|
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
|
// FixME!!! non può creare x loop in CreateBeamDL che vuole nParentMachGroup
|
||||||
// genero le Part x MachGroup ed assegno
|
// 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(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 });
|
//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>
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
Class Application
|
Imports EgtUILib
|
||||||
|
|
||||||
|
Class Application
|
||||||
|
|
||||||
' Application-level events, such as Startup, Exit, and DispatcherUnhandledException
|
' Application-level events, such as Startup, Exit, and DispatcherUnhandledException
|
||||||
' can be handled in this file.
|
' can be handled in this file.
|
||||||
@@ -11,4 +13,9 @@
|
|||||||
Me.MainWindow.Show()
|
Me.MainWindow.Show()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Public Sub ManageUnhandledException(sender As Object, e As System.Windows.Threading.DispatcherUnhandledExceptionEventArgs) Handles Me.DispatcherUnhandledException
|
||||||
|
EgtOutLog(e.Exception.ToString)
|
||||||
|
e.Handled = True
|
||||||
|
End Sub
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="clr-namespace:EgtCOMMTest"
|
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800">
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
<ItemsControl ItemsSource="{Binding AxesList}">
|
<ItemsControl ItemsSource="{Binding AxesList}">
|
||||||
|
|||||||
@@ -101,27 +101,35 @@ Public Class Axis
|
|||||||
Public ReadOnly Property sValue As String
|
Public ReadOnly Property sValue As String
|
||||||
Get
|
Get
|
||||||
Dim nDec As Integer = 0
|
Dim nDec As Integer = 0
|
||||||
Select Case Type
|
If CurrentMachine.NCType = NCTypes.TPA Then
|
||||||
Case AxisTypes.LINEAR
|
nDec = -3
|
||||||
nDec = -3
|
Else
|
||||||
Case AxisTypes.ROTATIONAL
|
Select Case Type
|
||||||
nDec = -4
|
Case AxisTypes.LINEAR
|
||||||
Case Else
|
nDec = -3
|
||||||
nDec = 0
|
Case AxisTypes.ROTATIONAL
|
||||||
End Select
|
nDec = -4
|
||||||
|
Case Else
|
||||||
|
nDec = 0
|
||||||
|
End Select
|
||||||
|
End If
|
||||||
Return DoubleToString(m_dValue, nDec)
|
Return DoubleToString(m_dValue, nDec)
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
Friend Sub SetValue(value As Double)
|
Friend Sub SetValue(value As Double)
|
||||||
Select Case Type
|
If CurrentMachine.NCType = NCTypes.TPA Then
|
||||||
Case AxisTypes.LINEAR
|
m_dValue = value
|
||||||
m_dValue = value / 1000
|
Else
|
||||||
Case AxisTypes.ROTATIONAL
|
Select Case Type
|
||||||
m_dValue = value / 10000
|
Case AxisTypes.LINEAR
|
||||||
Case Else
|
m_dValue = value / 1000
|
||||||
m_dValue = value
|
Case AxisTypes.ROTATIONAL
|
||||||
End Select
|
m_dValue = value / 10000
|
||||||
|
Case Else
|
||||||
|
m_dValue = value
|
||||||
|
End Select
|
||||||
|
End If
|
||||||
NotifyPropertyChanged(NameOf(sValue))
|
NotifyPropertyChanged(NameOf(sValue))
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|||||||
@@ -16,11 +16,34 @@ Public Class CALCPanelVM
|
|||||||
End Set
|
End Set
|
||||||
End Property
|
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
|
' Definizione comandi
|
||||||
Private m_cmdVerify As ICommand
|
Private m_cmdVerify As ICommand
|
||||||
Private m_cmdVerifyAll As ICommand
|
Private m_cmdVerifyAll As ICommand
|
||||||
Private m_cmdSimulate As ICommand
|
Private m_cmdSimulate As ICommand
|
||||||
|
|
||||||
|
Private m_ProcessResultList As New List(Of Integer)
|
||||||
|
|
||||||
#Region "Messages"
|
#Region "Messages"
|
||||||
|
|
||||||
Public ReadOnly Property Verify_ToolTip As String
|
Public ReadOnly Property Verify_ToolTip As String
|
||||||
@@ -58,6 +81,7 @@ Public Class CALCPanelVM
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub Calc_ProcessResult(sender As Object, e As CalcResultEventArgs)
|
Private Sub Calc_ProcessResult(sender As Object, e As CalcResultEventArgs)
|
||||||
|
m_ProcessResultList.Add(e.m_Result.nBarId)
|
||||||
ProcessResults(e.m_Result)
|
ProcessResults(e.m_Result)
|
||||||
Dim nRawid As Integer = e.m_Result.nBarId
|
Dim nRawid As Integer = e.m_Result.nBarId
|
||||||
If nRawid <= 0 Then Return
|
If nRawid <= 0 Then Return
|
||||||
@@ -69,19 +93,35 @@ Public Class CALCPanelVM
|
|||||||
If e.End_ <> CalcEndEventArgs.Results.OK Then
|
If e.End_ <> CalcEndEventArgs.Results.OK Then
|
||||||
MessageBox.Show("Execution error (all processes are disabled)")
|
MessageBox.Show("Execution error (all processes are disabled)")
|
||||||
End If
|
End If
|
||||||
|
' ciclo sui pezzi
|
||||||
|
Dim bNotOkFound As Boolean = False
|
||||||
|
Dim MachGroupList As List(Of MachGroupVM) = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Where(Function(x) m_ProcessResultList.Contains(x.Id)).ToList()
|
||||||
|
For Each MachGroup As MyMachGroupVM In MachGroupList
|
||||||
|
' se trovo pezzo errato, resetto tutti i successivi
|
||||||
|
If Not bNotOkFound AndAlso MachGroup.MyMachGroupM.m_nCALC_GlobalState <> CalcStates.OK AndAlso MachGroup.MyMachGroupM.m_nCALC_GlobalState <> CalcStates.INFO Then
|
||||||
|
bNotOkFound = True
|
||||||
|
End If
|
||||||
|
If bNotOkFound Then MachGroup.ResetProduce()
|
||||||
|
Next
|
||||||
|
m_ProcessResultList = New List(Of Integer)
|
||||||
Map.refProjectVM.ManageIsEnabled(True)
|
Map.refProjectVM.ManageIsEnabled(True)
|
||||||
Map.refMyStatusBarVM.ResetStopProgress()
|
Map.refMyStatusBarVM.ResetStopProgress()
|
||||||
|
' riabilito bottoni di comunicazione a fine invio programma
|
||||||
|
Map.refMachCommandMessagePanelVM.SetCommBtnIsEnabled(True)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub Calc_ProcessEnded(sender As Object, e As CalcProcessEndEventArgs)
|
Private Sub Calc_ProcessEnded(sender As Object, e As CalcProcessEndEventArgs)
|
||||||
Dim nRawid As Integer = e.m_Result.nBarId
|
'Dim nRawid As Integer = e.m_Result.nBarId
|
||||||
If nRawid <= 0 Then Return
|
'If nRawid <= 0 Then Return
|
||||||
Dim Machgroup As MyMachGroupVM = GetMachgroupVMFromMachgroupId(nRawid)
|
'Dim Machgroup As MyMachGroupVM = GetMachgroupVMFromMachgroupId(nRawid)
|
||||||
Machgroup.CALCEnd()
|
'Machgroup.CALCEnd()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Shared Sub ProcessResults(Bar As Bar)
|
Private Shared Sub ProcessResults(Bar As Bar)
|
||||||
|
|
||||||
|
' disabilito impostazione modificato
|
||||||
|
Dim DisableMgr As New DisableModifiedMgr
|
||||||
|
|
||||||
Dim BtlPath As String = Bar.sBarPath
|
Dim BtlPath As String = Bar.sBarPath
|
||||||
Dim ResPath As String = Path.ChangeExtension(BtlPath, ".txt")
|
Dim ResPath As String = Path.ChangeExtension(BtlPath, ".txt")
|
||||||
Dim bErrors As Boolean = False
|
Dim bErrors As Boolean = False
|
||||||
@@ -102,7 +142,6 @@ Public Class CALCPanelVM
|
|||||||
Dim cutId As Integer = 0
|
Dim cutId As Integer = 0
|
||||||
Dim taskId As Integer = 0
|
Dim taskId As Integer = 0
|
||||||
Dim prevCutId As Integer = GDB_ID.NULL
|
Dim prevCutId As Integer = GDB_ID.NULL
|
||||||
Dim currPart As PartVM
|
|
||||||
|
|
||||||
Dim lines As String() = System.IO.File.ReadAllLines(ResPath)
|
Dim lines As String() = System.IO.File.ReadAllLines(ResPath)
|
||||||
For Each line As String In lines
|
For Each line As String In lines
|
||||||
@@ -153,9 +192,9 @@ Public Class CALCPanelVM
|
|||||||
Machgroup.CalcMachGroupUpdate(0, 0, "")
|
Machgroup.CalcMachGroupUpdate(0, 0, "")
|
||||||
' Ciclo ...
|
' Ciclo ...
|
||||||
Dim nCUTID As Integer = -1
|
Dim nCUTID As Integer = -1
|
||||||
Dim CurrPartVM As PartVM
|
Dim CurrPartVM As PartVM = Nothing
|
||||||
Dim CurrMachgroupVM As MyMachGroupVM
|
Dim CurrMachgroupVM As MyMachGroupVM = Nothing
|
||||||
Dim CurrBTLFeatureVM As BTLFeatureVM
|
Dim CurrBTLFeatureVM As BTLFeatureVM = Nothing
|
||||||
For Each Line In ProcessResultList
|
For Each Line In ProcessResultList
|
||||||
' se necessario recupero part
|
' se necessario recupero part
|
||||||
If Line.nCUTID <> 0 Then
|
If Line.nCUTID <> 0 Then
|
||||||
@@ -197,12 +236,17 @@ Public Class CALCPanelVM
|
|||||||
|
|
||||||
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
|
Else
|
||||||
bErrors = True
|
bErrors = True
|
||||||
nLastErr = 25
|
nLastErr = 25
|
||||||
sLastMsg = "Execution Error"
|
sLastMsg = "Execution Error"
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
' ripristino precedente impostazione modificato
|
||||||
|
DisableMgr.ReEnable()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Shared Function GetVal(sText As String, sKey As String) As Integer?
|
Private Shared Function GetVal(sText As String, sKey As String) As Integer?
|
||||||
@@ -218,7 +262,7 @@ Public Class CALCPanelVM
|
|||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Shared Sub ProcessResultAdd(PRList As List(Of ProcessResult), NewPR As ProcessResult, Bar As Bar)
|
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
|
Select Case NewPR.Type
|
||||||
Case ProcessResult.ProcessResultTypes.BAR
|
Case ProcessResult.ProcessResultTypes.BAR
|
||||||
If Bar.nProgramPage = ProjectType.PROJ Then
|
If Bar.nProgramPage = ProjectType.PROJ Then
|
||||||
@@ -250,6 +294,7 @@ Public Class CALCPanelVM
|
|||||||
Dim PartVM As PartVM = MachGroupVM.PartVMList.FirstOrDefault(Function(x) x.nPartId = nPartId)
|
Dim PartVM As PartVM = MachGroupVM.PartVMList.FirstOrDefault(Function(x) x.nPartId = nPartId)
|
||||||
If Not IsNothing(PartVM) Then Return PartVM
|
If Not IsNothing(PartVM) Then Return PartVM
|
||||||
Next
|
Next
|
||||||
|
Return Nothing
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Shared Function GetMachgroupVMFromMachgroupId(nMachGroupId As Integer) As MyMachGroupVM
|
Private Shared Function GetMachgroupVMFromMachgroupId(nMachGroupId As Integer) As MyMachGroupVM
|
||||||
@@ -337,8 +382,6 @@ Public Class CALCPanelVM
|
|||||||
Case Core.CalcStates.OK, Core.CalcStates.INFO
|
Case Core.CalcStates.OK, Core.CalcStates.INFO
|
||||||
Bar.nCmdType = CalcIntegration.CmdTypes.GENERATE
|
Bar.nCmdType = CalcIntegration.CmdTypes.GENERATE
|
||||||
Case Else
|
Case Else
|
||||||
Dim sMachGroupFilePath As String = Map.refSupervisorManagerVM.CurrProd.sProdDirPath & "\" & MachGroup.Name.ToString() & ".ori.bwe"
|
|
||||||
If File.Exists(sMachGroupFilePath) Then File.Delete(sMachGroupFilePath)
|
|
||||||
Bar.nCmdType = CalcIntegration.CmdTypes.CHECKGEN
|
Bar.nCmdType = CalcIntegration.CmdTypes.CHECKGEN
|
||||||
End Select
|
End Select
|
||||||
TempBarList(MachGroupIndex) = Bar
|
TempBarList(MachGroupIndex) = Bar
|
||||||
@@ -350,7 +393,7 @@ Public Class CALCPanelVM
|
|||||||
' disabilito interfaccia
|
' disabilito interfaccia
|
||||||
Map.refProjectVM.ManageIsEnabled(False)
|
Map.refProjectVM.ManageIsEnabled(False)
|
||||||
' lancio calcolo
|
' 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
|
End Sub
|
||||||
|
|
||||||
' funzione che gestisce risposta da thread di verifica, aggiorna progress e segnala comando di interruzione
|
' funzione che gestisce risposta da thread di verifica, aggiorna progress e segnala comando di interruzione
|
||||||
|
|||||||
@@ -29,5 +29,10 @@
|
|||||||
IsEnabled="{Binding CALCPanel_IsEnabled}">
|
IsEnabled="{Binding CALCPanel_IsEnabled}">
|
||||||
<Image Source="/Resources/CALCPanel/Simulate.png" Stretch="Uniform"/>
|
<Image Source="/Resources/CALCPanel/Simulate.png" Stretch="Uniform"/>
|
||||||
</Button>
|
</Button>
|
||||||
|
<ToggleButton ToolTip="{Binding MachineLog_ToolTip}"
|
||||||
|
Content="Log"
|
||||||
|
IsChecked="{Binding bMachineLog}"
|
||||||
|
Style="{StaticResource ToolBar_ToggleButton}">
|
||||||
|
</ToggleButton>
|
||||||
|
|
||||||
</EgtFloating:EgtFloatingPanel>
|
</EgtFloating:EgtFloatingPanel>
|
||||||
|
|||||||
@@ -0,0 +1,844 @@
|
|||||||
|
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
|
||||||
|
StringToDouble(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))
|
||||||
|
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
@@ -529,13 +529,14 @@ Public Class NUMFlexiumComm
|
|||||||
Dim AplErrorAdditional As Object() = CType(ErrorAdditional, Object())
|
Dim AplErrorAdditional As Object() = CType(ErrorAdditional, Object())
|
||||||
|
|
||||||
For index As Integer = 0 To numberOfError - 1
|
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
|
Dim NewMessageInList As ReadMessages = m_ReadFXMessages.FirstOrDefault(Function(x) x.CMsgCncNumber = AplCnCNumber AndAlso
|
||||||
x.CMsgErrorType = AplErrorType(index).ToString() AndAlso
|
x.CMsgErrorType = AplErrorType(nIndex).ToString() AndAlso
|
||||||
x.CMsgErrorIndex = AplErrorIndex(index).ToString() AndAlso
|
x.CMsgErrorIndex = AplErrorIndex(nIndex).ToString() AndAlso
|
||||||
x.CMsgErrorNumber = AplErrorNumber(index).ToString() AndAlso
|
x.CMsgErrorNumber = AplErrorNumber(nIndex).ToString() AndAlso
|
||||||
x.CMsgErrorLine = AplErrorLine(index).ToString() AndAlso
|
x.CMsgErrorLine = AplErrorLine(nIndex).ToString() AndAlso
|
||||||
x.CMsgErrorMessage = AplErrorMessage(index).ToString() AndAlso
|
x.CMsgErrorMessage = AplErrorMessage(nIndex).ToString() AndAlso
|
||||||
x.CMsgErrorAdditional = AplErrorAdditional(index).ToString())
|
x.CMsgErrorAdditional = AplErrorAdditional(nIndex).ToString())
|
||||||
' se il messaggio e' gia' in lista
|
' se il messaggio e' gia' in lista
|
||||||
If Not IsNothing(NewMessageInList) Then
|
If Not IsNothing(NewMessageInList) Then
|
||||||
' lo segno come trovato
|
' lo segno come trovato
|
||||||
@@ -889,12 +890,13 @@ Public Class NUMFlexiumComm
|
|||||||
Dim objLine As Object() = CType(line, Object())
|
Dim objLine As Object() = CType(line, Object())
|
||||||
Dim OpMsgErrType As Integer = 30
|
Dim OpMsgErrType As Integer = 30
|
||||||
For index As Integer = 0 To objMsgNumber.Length - 1
|
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
|
Dim NewMessageInList As ReadMessages = m_ReadOperatorMessages.FirstOrDefault(Function(x) x.CMsgCncNumber = 0 AndAlso
|
||||||
x.CMsgErrorType = OpMsgErrType.ToString() AndAlso
|
x.CMsgErrorType = OpMsgErrType.ToString() AndAlso
|
||||||
x.CMsgErrorIndex = "" AndAlso
|
x.CMsgErrorIndex = "" AndAlso
|
||||||
x.CMsgErrorNumber = objMsgNumber(index).ToString() AndAlso
|
x.CMsgErrorNumber = objMsgNumber(nIndex).ToString() AndAlso
|
||||||
x.CMsgErrorLine = "" AndAlso
|
x.CMsgErrorLine = "" AndAlso
|
||||||
x.CMsgErrorMessage = objLine(index).ToString() AndAlso
|
x.CMsgErrorMessage = objLine(nIndex).ToString() AndAlso
|
||||||
x.CMsgErrorAdditional = "")
|
x.CMsgErrorAdditional = "")
|
||||||
' se il messaggio e' gia' in lista
|
' se il messaggio e' gia' in lista
|
||||||
If Not IsNothing(NewMessageInList) Then
|
If Not IsNothing(NewMessageInList) Then
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ Public Class TPAComm
|
|||||||
Private m_Proxy_ListInfoEventHandler As New ListInfoEventHandler(AddressOf RemoteObject_ListInfoResponse)
|
Private m_Proxy_ListInfoEventHandler As New ListInfoEventHandler(AddressOf RemoteObject_ListInfoResponse)
|
||||||
Private m_Proxy_RPCUpdateEventHandler As New RPCUpdateEventHandler(AddressOf RemoteObject_RPCUpdate)
|
Private m_Proxy_RPCUpdateEventHandler As New RPCUpdateEventHandler(AddressOf RemoteObject_RPCUpdate)
|
||||||
Private m_Proxy_VariableCommandExecutedEventHandler As New VariableCommandExecutedEventHandler(AddressOf RemoteObject_VariableCommandExecuted)
|
Private m_Proxy_VariableCommandExecutedEventHandler As New VariableCommandExecutedEventHandler(AddressOf RemoteObject_VariableCommandExecuted)
|
||||||
Private m_Proxy_TickUpdateEventHandler As New TickUpdateEventHandler(AddressOf RemoteObject_TickUpdate)
|
'Private m_Proxy_TickUpdateEventHandler As New TickUpdateEventHandler(AddressOf RemoteObject_TickUpdate)
|
||||||
Private m_Rem_CommandExecutedEventHandler As CommandExecutedEventHandler
|
Private m_Rem_CommandExecutedEventHandler As CommandExecutedEventHandler
|
||||||
Private m_Rem_ServerErrorEventHandler As ServerErrorEventHandler
|
Private m_Rem_ServerErrorEventHandler As ServerErrorEventHandler
|
||||||
Private m_Rem_AxesCoordinatesUpdateEventHandler As AxesCoordinatesUpdateEventHandler
|
Private m_Rem_AxesCoordinatesUpdateEventHandler As AxesCoordinatesUpdateEventHandler
|
||||||
@@ -77,7 +77,7 @@ Public Class TPAComm
|
|||||||
Private m_Rem_ListInfoEventHandler As ListInfoEventHandler
|
Private m_Rem_ListInfoEventHandler As ListInfoEventHandler
|
||||||
Private m_Rem_RPCUpdateEventHandler As RPCUpdateEventHandler
|
Private m_Rem_RPCUpdateEventHandler As RPCUpdateEventHandler
|
||||||
Private m_Rem_VariableCommandExecutedEventHandler As VariableCommandExecutedEventHandler
|
Private m_Rem_VariableCommandExecutedEventHandler As VariableCommandExecutedEventHandler
|
||||||
|
'Private m_Rem_TickUpdateEventHandler As TickUpdateEventHandler
|
||||||
|
|
||||||
<SecurityPermission(SecurityAction.Demand)>
|
<SecurityPermission(SecurityAction.Demand)>
|
||||||
Public Sub New(MachManaging As MachManaging)
|
Public Sub New(MachManaging As MachManaging)
|
||||||
@@ -93,7 +93,7 @@ Public Class TPAComm
|
|||||||
System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(channel, False)
|
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)
|
Dim remoteType As System.Runtime.Remoting.WellKnownClientTypeEntry = New System.Runtime.Remoting.WellKnownClientTypeEntry(GetType(ISOCNC.Remoting_Server), serverURI)
|
||||||
System.Runtime.Remoting.RemotingConfiguration.RegisterWellKnownClientType(remoteType)
|
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)
|
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)
|
Console.WriteLine("The URI of the message sink is {0}.", objectUri)
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ Public Class TPAComm
|
|||||||
AddHandler m_eventProxy.ListInfoResponse, m_Proxy_ListInfoEventHandler
|
AddHandler m_eventProxy.ListInfoResponse, m_Proxy_ListInfoEventHandler
|
||||||
AddHandler m_eventProxy.RPCUpdate, m_Proxy_RPCUpdateEventHandler
|
AddHandler m_eventProxy.RPCUpdate, m_Proxy_RPCUpdateEventHandler
|
||||||
AddHandler m_eventProxy.VariableCommandExecuted, m_Proxy_VariableCommandExecutedEventHandler
|
AddHandler m_eventProxy.VariableCommandExecuted, m_Proxy_VariableCommandExecutedEventHandler
|
||||||
AddHandler m_eventProxy.TickUpdate, m_Proxy_TickUpdateEventHandler
|
'AddHandler m_eventProxy.TickUpdate, m_Proxy_TickUpdateEventHandler
|
||||||
|
|
||||||
_remObject = CType(Activator.GetObject(GetType(ISOCNC.Remoting_Server), serverURI), ISOCNC.Remoting_Server)
|
_remObject = CType(Activator.GetObject(GetType(ISOCNC.Remoting_Server), serverURI), ISOCNC.Remoting_Server)
|
||||||
Try
|
Try
|
||||||
@@ -122,6 +122,7 @@ Public Class TPAComm
|
|||||||
m_Rem_ListInfoEventHandler = New ListInfoEventHandler(AddressOf m_eventProxy.LocallyHandleListInfo)
|
m_Rem_ListInfoEventHandler = New ListInfoEventHandler(AddressOf m_eventProxy.LocallyHandleListInfo)
|
||||||
m_Rem_RPCUpdateEventHandler = New RPCUpdateEventHandler(AddressOf m_eventProxy.LocallyHandleRPCUpdate)
|
m_Rem_RPCUpdateEventHandler = New RPCUpdateEventHandler(AddressOf m_eventProxy.LocallyHandleRPCUpdate)
|
||||||
m_Rem_VariableCommandExecutedEventHandler = New VariableCommandExecutedEventHandler(AddressOf m_eventProxy.LocallyHandleVariableCommandExecuted)
|
m_Rem_VariableCommandExecutedEventHandler = New VariableCommandExecutedEventHandler(AddressOf m_eventProxy.LocallyHandleVariableCommandExecuted)
|
||||||
|
'm_Rem_TickUpdateEventHandler = New TickUpdateEventHandler(AddressOf m_eventProxy.LocallyHandleTickUpdate)
|
||||||
AddHandler _remObject.CommandExecuted, m_Rem_CommandExecutedEventHandler
|
AddHandler _remObject.CommandExecuted, m_Rem_CommandExecutedEventHandler
|
||||||
AddHandler _remObject.ServerError, m_Rem_ServerErrorEventHandler
|
AddHandler _remObject.ServerError, m_Rem_ServerErrorEventHandler
|
||||||
AddHandler _remObject.AxisCoordinatesUpdate, m_Rem_AxesCoordinatesUpdateEventHandler
|
AddHandler _remObject.AxisCoordinatesUpdate, m_Rem_AxesCoordinatesUpdateEventHandler
|
||||||
@@ -130,6 +131,7 @@ Public Class TPAComm
|
|||||||
AddHandler _remObject.ListInfoResponse, m_Rem_ListInfoEventHandler
|
AddHandler _remObject.ListInfoResponse, m_Rem_ListInfoEventHandler
|
||||||
AddHandler _remObject.RPCUpdate, m_Rem_RPCUpdateEventHandler
|
AddHandler _remObject.RPCUpdate, m_Rem_RPCUpdateEventHandler
|
||||||
AddHandler _remObject.VariableCommandExecuted, m_Rem_VariableCommandExecutedEventHandler
|
AddHandler _remObject.VariableCommandExecuted, m_Rem_VariableCommandExecutedEventHandler
|
||||||
|
'AddHandler _remObject.TickUpdate, m_Rem_TickUpdateEventHandler
|
||||||
Catch ex As System.Runtime.Remoting.RemotingException
|
Catch ex As System.Runtime.Remoting.RemotingException
|
||||||
Dim dR As MessageBoxResult = MessageBox.Show(ex.Message)
|
Dim dR As MessageBoxResult = MessageBox.Show(ex.Message)
|
||||||
End Try
|
End Try
|
||||||
@@ -154,9 +156,10 @@ Public Class TPAComm
|
|||||||
RemoveHandler m_eventProxy.ListInfoResponse, m_Proxy_ListInfoEventHandler
|
RemoveHandler m_eventProxy.ListInfoResponse, m_Proxy_ListInfoEventHandler
|
||||||
RemoveHandler m_eventProxy.RPCUpdate, m_Proxy_RPCUpdateEventHandler
|
RemoveHandler m_eventProxy.RPCUpdate, m_Proxy_RPCUpdateEventHandler
|
||||||
RemoveHandler m_eventProxy.VariableCommandExecuted, m_Proxy_VariableCommandExecutedEventHandler
|
RemoveHandler m_eventProxy.VariableCommandExecuted, m_Proxy_VariableCommandExecutedEventHandler
|
||||||
RemoveHandler m_eventProxy.TickUpdate, m_Proxy_TickUpdateEventHandler
|
'RemoveHandler m_eventProxy.TickUpdate, m_Proxy_TickUpdateEventHandler
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
Private Sub RemoteObject_OpStateUpdate(ByVal newOpState As ISOCNC.Remoting.MachineOperatingState)
|
Private Sub RemoteObject_OpStateUpdate(ByVal newOpState As ISOCNC.Remoting.MachineOperatingState)
|
||||||
' resetto stato pending iniziale
|
' resetto stato pending iniziale
|
||||||
If Map.refMachManaging.StartPending AndAlso newOpState = MachineOperatingState.Pending Then
|
If Map.refMachManaging.StartPending AndAlso newOpState = MachineOperatingState.Pending Then
|
||||||
@@ -239,6 +242,7 @@ Public Class TPAComm
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub RemoteObject_TickUpdate(ByVal newTick As ULong)
|
Private Sub RemoteObject_TickUpdate(ByVal newTick As ULong)
|
||||||
|
'EgtUILib.EgtOutLog("Tick: " & newTick)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
@@ -243,7 +243,7 @@
|
|||||||
SelectionMode="Single"
|
SelectionMode="Single"
|
||||||
ScrollViewer.CanContentScroll="True"
|
ScrollViewer.CanContentScroll="True"
|
||||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||||
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
|
ScrollViewer.HorizontalScrollBarVisibility="Auto"
|
||||||
Margin="5"
|
Margin="5"
|
||||||
BindingColumns="{Binding VariablesColumns}">
|
BindingColumns="{Binding VariablesColumns}">
|
||||||
<DataGrid.Resources>
|
<DataGrid.Resources>
|
||||||
@@ -289,50 +289,6 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
</TabItem.Content>
|
</TabItem.Content>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem Header="Colonne tabelle">
|
|
||||||
<TabItem.Content>
|
|
||||||
<Grid>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="1*"/>
|
|
||||||
<ColumnDefinition Width="1*"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="1*"/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<EgtBEAMWALL:DGColumnsListV DataContext="{Binding}"
|
|
||||||
ItemsSource="{Binding DGColumnsList}"
|
|
||||||
SelectedItem="{Binding SelDGColumn}"
|
|
||||||
Grid.Column="0"
|
|
||||||
Margin="5">
|
|
||||||
<DataGrid.GroupStyle>
|
|
||||||
<GroupStyle>
|
|
||||||
<GroupStyle.ContainerStyle>
|
|
||||||
<Style TargetType="{x:Type GroupItem}">
|
|
||||||
<Setter Property="Template">
|
|
||||||
<Setter.Value>
|
|
||||||
<ControlTemplate TargetType="{x:Type GroupItem}">
|
|
||||||
<Expander IsExpanded="True">
|
|
||||||
<Expander.Background>
|
|
||||||
<SolidColorBrush Color="LightGray"></SolidColorBrush>
|
|
||||||
</Expander.Background>
|
|
||||||
<Expander.Header>
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<TextBlock Text="{Binding Path=Name}" />
|
|
||||||
</StackPanel>
|
|
||||||
</Expander.Header>
|
|
||||||
<ItemsPresenter />
|
|
||||||
</Expander>
|
|
||||||
</ControlTemplate>
|
|
||||||
</Setter.Value>
|
|
||||||
</Setter>
|
|
||||||
</Style>
|
|
||||||
</GroupStyle.ContainerStyle>
|
|
||||||
</GroupStyle>
|
|
||||||
</DataGrid.GroupStyle>
|
|
||||||
</EgtBEAMWALL:DGColumnsListV>
|
|
||||||
</Grid>
|
|
||||||
</TabItem.Content>
|
|
||||||
</TabItem>
|
|
||||||
</TabControl>
|
</TabControl>
|
||||||
|
|
||||||
<Button Command="{Binding SaveCommand}"
|
<Button Command="{Binding SaveCommand}"
|
||||||
|
|||||||
@@ -55,18 +55,6 @@ Public Class ConfigurationPageVM
|
|||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
' lista delle colonne con le relative proprietà della DataGrid
|
|
||||||
Private m_DGColumnsList_View As CollectionView = Nothing
|
|
||||||
Protected m_DGColumnsList As New ObservableCollection(Of IniDataGridColumn)
|
|
||||||
Public Property DGColumnsList As ObservableCollection(Of IniDataGridColumn)
|
|
||||||
Get
|
|
||||||
Return m_DGColumnsList
|
|
||||||
End Get
|
|
||||||
Set(value As ObservableCollection(Of IniDataGridColumn))
|
|
||||||
m_DGColumnsList = value
|
|
||||||
End Set
|
|
||||||
End Property
|
|
||||||
|
|
||||||
Protected m_VariablesColumns As New ObservableCollection(Of EgtDataGridColumn)
|
Protected m_VariablesColumns As New ObservableCollection(Of EgtDataGridColumn)
|
||||||
Public Property VariablesColumns As ObservableCollection(Of EgtDataGridColumn)
|
Public Property VariablesColumns As ObservableCollection(Of EgtDataGridColumn)
|
||||||
Get
|
Get
|
||||||
@@ -252,11 +240,6 @@ Public Class ConfigurationPageVM
|
|||||||
Exit For
|
Exit For
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
' carico la lista delle colonne delle DataGrid in ConfigurationPage
|
|
||||||
LoadConfigDGColumns()
|
|
||||||
' setto il grouping ad 1 livello per la DataGrid
|
|
||||||
m_DGColumnsList_View = CollectionViewSource.GetDefaultView(m_DGColumnsList)
|
|
||||||
m_DGColumnsList_View.GroupDescriptions.Add(New PropertyGroupDescription(NameOf(IniDataGridColumn.VisParentDataGridName)))
|
|
||||||
' carico la lista delle colonne delle variabili della macchina in ConfigurationPage
|
' carico la lista delle colonne delle variabili della macchina in ConfigurationPage
|
||||||
GetPrivateProfileColumns(S_VARIABLESLIST, VariablesColumns)
|
GetPrivateProfileColumns(S_VARIABLESLIST, VariablesColumns)
|
||||||
' carico le Variables della macchina
|
' carico le Variables della macchina
|
||||||
@@ -284,7 +267,6 @@ Public Class ConfigurationPageVM
|
|||||||
''' </summary>
|
''' </summary>
|
||||||
Public Sub Save()
|
Public Sub Save()
|
||||||
WriteVariables()
|
WriteVariables()
|
||||||
WriteDataGridColumns()
|
|
||||||
WriteMainPrivateProfileString(S_GENERAL, K_MESSAGES, m_SelectedLanguage.Name)
|
WriteMainPrivateProfileString(S_GENERAL, K_MESSAGES, m_SelectedLanguage.Name)
|
||||||
WriteMainPrivateProfileString(S_SCENE, K_MMUNITS, SelMeasureUnit.ToString())
|
WriteMainPrivateProfileString(S_SCENE, K_MMUNITS, SelMeasureUnit.ToString())
|
||||||
End Sub
|
End Sub
|
||||||
@@ -330,54 +312,8 @@ Public Class ConfigurationPageVM
|
|||||||
|
|
||||||
' funzione che verifica la modifica dei valori in Configurazione e ne chiede il salvataggio
|
' funzione che verifica la modifica dei valori in Configurazione e ne chiede il salvataggio
|
||||||
Friend Sub VerifyConfigPageModification()
|
Friend Sub VerifyConfigPageModification()
|
||||||
' verifico se i valori delle colonne DataGrid sono stati modificati
|
' qui veniva verificata solamente la modifica delle proprietà delle colonne delle EgtDataGrid
|
||||||
For Each DGColumnItem In DGColumnsList
|
|
||||||
If DGColumnItem.IsModified Then
|
|
||||||
If MessageBox.Show(EgtMsg(61882), "", MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.Yes Then
|
|
||||||
' scrivo i valori delle colonne DataGrid modificate
|
|
||||||
WriteDataGridColumns()
|
|
||||||
Else
|
|
||||||
' se da non salvare li resetto ed esco dai For
|
|
||||||
LoadConfigDGColumns()
|
|
||||||
Exit For
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
' funzione che carica la DataGrid di configurazione delle colonne delle EgtDataGrid
|
|
||||||
Public Sub LoadConfigDGColumns()
|
|
||||||
DGColumnsList.Clear()
|
|
||||||
GetPrivateProfileIniColumns(S_OPENPROJFILEDLG_PROD, DGColumnsList)
|
|
||||||
GetPrivateProfileIniColumns(S_RAWPARTLIST_SUPERVISOR, DGColumnsList)
|
|
||||||
GetPrivateProfileIniColumns(S_PARTINRAWPARTLIST_SUPERVISOR, DGColumnsList)
|
|
||||||
GetPrivateProfileIniColumns(S_FEATUREINPARTINRAWPARTLIST_SUPERVISOR, DGColumnsList)
|
|
||||||
GetPrivateProfileIniColumns(S_VARIABLESLIST, DGColumnsList)
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
' funzione per calcolare e scrivere la stringhe dei parametri delle colonne relative ad una ParentDataGridName nell'INI
|
|
||||||
Public Sub SaveDataGridColumns(ParentDataGridName As String, DGColumnsList As ObservableCollection(Of IniDataGridColumn))
|
|
||||||
For Each ColumnItem In DGColumnsList
|
|
||||||
If ColumnItem.ParentDataGridName = ParentDataGridName Then
|
|
||||||
Dim sColumnParams = String.Empty
|
|
||||||
sColumnParams = ColumnItem.Name & "," & If(ColumnItem.CanUserReorder, 1, 0) & "," & If(ColumnItem.CanUserResize, 1, 0) & "," &
|
|
||||||
If(ColumnItem.CanUserSort, 1, 0) & "," & If(ColumnItem.IsReadOnly, 1, 0) & "," & DoubleToString(ColumnItem.Width.Value, 6) & "," &
|
|
||||||
ColumnItem.Width.UnitType & "," & If(ColumnItem.Visible, 1, 0) & "," & If(ColumnItem.CanUserEditVisible, 1, 0)
|
|
||||||
WriteColumnPrivateProfileParam(ParentDataGridName, ColumnItem.m_DisplayIndex, sColumnParams)
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
' funzione che scrive i valori delle proprietà delle colonne customizzate delle EgtDataGrid nell'INI
|
|
||||||
Public Sub WriteDataGridColumns()
|
|
||||||
SaveDataGridColumns(S_OPENPROJFILEDLG_PROD, DGColumnsList)
|
|
||||||
SaveDataGridColumns(S_RAWPARTLIST_SUPERVISOR, DGColumnsList)
|
|
||||||
SaveDataGridColumns(S_PARTINRAWPARTLIST_SUPERVISOR, DGColumnsList)
|
|
||||||
SaveDataGridColumns(S_FEATUREINPARTINRAWPARTLIST_SUPERVISOR, DGColumnsList)
|
|
||||||
SaveDataGridColumns(S_VARIABLESLIST, DGColumnsList)
|
|
||||||
For Each DGColumnItem In DGColumnsList
|
|
||||||
DGColumnItem.IsModifiedReset()
|
|
||||||
Next
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
' funzione che legge le variabili della macchina dall'INI
|
' funzione che legge le variabili della macchina dall'INI
|
||||||
@@ -421,239 +357,6 @@ Public Class ConfigurationPageVM
|
|||||||
|
|
||||||
End Class
|
End Class
|
||||||
|
|
||||||
Public Class IniDataGridColumn
|
|
||||||
|
|
||||||
Private Property m_ParentDataGridName As String
|
|
||||||
Public Property ParentDataGridName As String
|
|
||||||
Get
|
|
||||||
Return m_ParentDataGridName
|
|
||||||
End Get
|
|
||||||
Set(value As String)
|
|
||||||
m_ParentDataGridName = value
|
|
||||||
End Set
|
|
||||||
End Property
|
|
||||||
|
|
||||||
' Nome datagrid di cui fa parte la colonna visualizzato nell'interfaccia
|
|
||||||
Public ReadOnly Property VisParentDataGridName As String
|
|
||||||
Get
|
|
||||||
Return ParentDataGridName.Replace(ParentDataGridName.Substring(0, 3), "").Trim()
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
Private Property m_Name As String
|
|
||||||
Public Property Name As String
|
|
||||||
Get
|
|
||||||
Return m_Name
|
|
||||||
End Get
|
|
||||||
Set(value As String)
|
|
||||||
m_Name = value
|
|
||||||
End Set
|
|
||||||
End Property
|
|
||||||
|
|
||||||
' Nome colonna visualizzato nell'interfaccia
|
|
||||||
Public ReadOnly Property VisName As String
|
|
||||||
Get
|
|
||||||
Return Name.Replace(Name.Substring(0, 3), "").Trim()
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
Private Property m_Width As DataGridLength
|
|
||||||
Public Property Width As DataGridLength
|
|
||||||
Get
|
|
||||||
Return m_Width
|
|
||||||
End Get
|
|
||||||
Set(value As DataGridLength)
|
|
||||||
m_Width = value
|
|
||||||
End Set
|
|
||||||
End Property
|
|
||||||
|
|
||||||
Private m_IsModifiedDisplayIndex
|
|
||||||
Friend Property m_DisplayIndex As Integer
|
|
||||||
Public Property DisplayIndex As Integer
|
|
||||||
Get
|
|
||||||
Return If(Visible, m_DisplayIndex, -1)
|
|
||||||
End Get
|
|
||||||
Set(value As Integer)
|
|
||||||
m_DisplayIndex = value
|
|
||||||
m_IsModifiedDisplayIndex = (m_Name <>
|
|
||||||
GetPrivateProfileIniColumnProperty(ParentDataGridName, Map.refConfigurationPageVM.DGColumnsList, m_DisplayIndex, EgtDGColumnProperty.NAME))
|
|
||||||
' se DisplayIndex viene settato ad un valore che corrisponde a quello che aveva inizialmente aggiorno gli IsModified
|
|
||||||
' delle altre proprietà utilizzando il DisplayIndex attuale
|
|
||||||
If Not m_IsModifiedDisplayIndex Then
|
|
||||||
m_IsModifiedIsReadOnly = (m_IsReadOnly <>
|
|
||||||
GetPrivateProfileIniColumnProperty(ParentDataGridName, Map.refConfigurationPageVM.DGColumnsList, m_DisplayIndex, EgtDGColumnProperty.ISREADONLY))
|
|
||||||
m_IsModifiedCanUserReorder = (m_CanUserReorder <>
|
|
||||||
GetPrivateProfileIniColumnProperty(ParentDataGridName, Map.refConfigurationPageVM.DGColumnsList, m_DisplayIndex, EgtDGColumnProperty.REORDER))
|
|
||||||
m_IsModifiedCanUserResize = (m_CanUserResize <>
|
|
||||||
GetPrivateProfileIniColumnProperty(ParentDataGridName, Map.refConfigurationPageVM.DGColumnsList, m_DisplayIndex, EgtDGColumnProperty.RESIZE))
|
|
||||||
m_IsModifiedCanUserSort = (m_CanUserSort <>
|
|
||||||
GetPrivateProfileIniColumnProperty(ParentDataGridName, Map.refConfigurationPageVM.DGColumnsList, m_DisplayIndex, EgtDGColumnProperty.SORT))
|
|
||||||
m_IsModifiedVisible = (m_Visible <>
|
|
||||||
GetPrivateProfileIniColumnProperty(ParentDataGridName, Map.refConfigurationPageVM.DGColumnsList, m_DisplayIndex, EgtDGColumnProperty.VISIBLE))
|
|
||||||
End If
|
|
||||||
End Set
|
|
||||||
End Property
|
|
||||||
|
|
||||||
Private m_IsModifiedIsReadOnly As Boolean = False
|
|
||||||
Private Property m_IsReadOnly As Boolean = True
|
|
||||||
Public Property IsReadOnly As Boolean
|
|
||||||
Get
|
|
||||||
Return m_IsReadOnly
|
|
||||||
End Get
|
|
||||||
Set(value As Boolean)
|
|
||||||
m_IsReadOnly = value
|
|
||||||
m_IsModifiedIsReadOnly = (m_IsReadOnly <>
|
|
||||||
GetPrivateProfileIniColumnProperty(ParentDataGridName, Map.refConfigurationPageVM.DGColumnsList, m_DisplayIndex, EgtDGColumnProperty.ISREADONLY))
|
|
||||||
End Set
|
|
||||||
End Property
|
|
||||||
|
|
||||||
Private m_IsModifiedCanUserReorder As Boolean = False
|
|
||||||
Private m_CanUserReorder As Boolean
|
|
||||||
Public Property CanUserReorder As Boolean
|
|
||||||
Get
|
|
||||||
Return m_CanUserReorder
|
|
||||||
End Get
|
|
||||||
Set(value As Boolean)
|
|
||||||
m_CanUserReorder = value
|
|
||||||
m_IsModifiedCanUserReorder = (m_CanUserReorder <>
|
|
||||||
GetPrivateProfileIniColumnProperty(ParentDataGridName, Map.refConfigurationPageVM.DGColumnsList, m_DisplayIndex, EgtDGColumnProperty.REORDER))
|
|
||||||
End Set
|
|
||||||
End Property
|
|
||||||
|
|
||||||
Private m_IsModifiedCanUserResize As Boolean = False
|
|
||||||
Private m_CanUserResize As Boolean
|
|
||||||
Public Property CanUserResize As Boolean
|
|
||||||
Get
|
|
||||||
Return m_CanUserResize
|
|
||||||
End Get
|
|
||||||
Set(value As Boolean)
|
|
||||||
m_CanUserResize = value
|
|
||||||
m_IsModifiedCanUserResize = (m_CanUserResize <>
|
|
||||||
GetPrivateProfileIniColumnProperty(ParentDataGridName, Map.refConfigurationPageVM.DGColumnsList, m_DisplayIndex, EgtDGColumnProperty.RESIZE))
|
|
||||||
End Set
|
|
||||||
End Property
|
|
||||||
|
|
||||||
Private m_IsModifiedCanUserSort As Boolean = False
|
|
||||||
Private m_CanUserSort As Boolean
|
|
||||||
Public Property CanUserSort As Boolean
|
|
||||||
Get
|
|
||||||
Return m_CanUserSort
|
|
||||||
End Get
|
|
||||||
Set(value As Boolean)
|
|
||||||
m_CanUserSort = value
|
|
||||||
m_IsModifiedCanUserSort = (m_CanUserSort <>
|
|
||||||
GetPrivateProfileIniColumnProperty(ParentDataGridName, Map.refConfigurationPageVM.DGColumnsList, m_DisplayIndex, EgtDGColumnProperty.SORT))
|
|
||||||
End Set
|
|
||||||
End Property
|
|
||||||
|
|
||||||
Private m_IsModifiedVisible As Boolean = False
|
|
||||||
Private m_Visible As Boolean
|
|
||||||
Public Property Visible As Boolean
|
|
||||||
Get
|
|
||||||
Return m_Visible
|
|
||||||
End Get
|
|
||||||
Set(value As Boolean)
|
|
||||||
m_Visible = value
|
|
||||||
' Utilizzo OldDGIndex e NewDGIndex per muovere la Column tra il gruppo dei Visible (in alto) o il gruppo
|
|
||||||
' dei non Visible (in basso): in ambo i casi verrà sempre spostata in mezzo ai due raggruppamenti
|
|
||||||
Dim OldDGIndex As Integer = Map.refConfigurationPageVM.DGColumnsList.IndexOf(Me)
|
|
||||||
If value Then
|
|
||||||
Dim NewDGIndex As Integer = Map.refConfigurationPageVM.DGColumnsList.IndexOf(Map.refConfigurationPageVM.DGColumnsList.FirstOrDefault(
|
|
||||||
Function(x) x.ParentDataGridName = ParentDataGridName AndAlso
|
|
||||||
x.Visible = False))
|
|
||||||
' se NewDGIndex = -1 (ovvero ho settato l'ultima Column rimasta non Visible a Visible) oppure
|
|
||||||
' se il nuovo indice è subito dopo il vecchio non la sposto altrimenti viene spostata in maniera sbagliata
|
|
||||||
If NewDGIndex <> -1 AndAlso NewDGIndex <> OldDGIndex + 1 Then Map.refConfigurationPageVM.DGColumnsList.Move(OldDGIndex, NewDGIndex)
|
|
||||||
Else
|
|
||||||
Dim NewDGIndex As Integer = Map.refConfigurationPageVM.DGColumnsList.IndexOf(Map.refConfigurationPageVM.DGColumnsList.FirstOrDefault(
|
|
||||||
Function(x) x.ParentDataGridName = ParentDataGridName AndAlso
|
|
||||||
x.Visible = False AndAlso
|
|
||||||
x.Name <> Name))
|
|
||||||
' se NewDGIndex = -1 vuol dire che erano tutte settate a Visible perciò devo calcolare l'indice
|
|
||||||
' dell'ultima Column con quel ParentDataGridName e spostarlo lì
|
|
||||||
If NewDGIndex = -1 Then
|
|
||||||
Dim FirstIndex As Integer = Map.refConfigurationPageVM.DGColumnsList.IndexOf(Map.refConfigurationPageVM.DGColumnsList.FirstOrDefault(
|
|
||||||
Function(x) x.ParentDataGridName = ParentDataGridName))
|
|
||||||
Dim LastIndex = FirstIndex
|
|
||||||
While LastIndex < Map.refConfigurationPageVM.DGColumnsList.Count AndAlso Map.refConfigurationPageVM.DGColumnsList(LastIndex).ParentDataGridName = ParentDataGridName
|
|
||||||
LastIndex += 1
|
|
||||||
End While
|
|
||||||
NewDGIndex = LastIndex
|
|
||||||
End If
|
|
||||||
Map.refConfigurationPageVM.DGColumnsList.Move(OldDGIndex, NewDGIndex - 1)
|
|
||||||
End If
|
|
||||||
' aggiorno i DisplayIndex di ciascuna Column della ParentDataGridName in questione
|
|
||||||
Dim index = 0
|
|
||||||
For Each DGColumnItem In Map.refConfigurationPageVM.DGColumnsList
|
|
||||||
If DGColumnItem.ParentDataGridName = ParentDataGridName Then
|
|
||||||
DGColumnItem.DisplayIndex = index
|
|
||||||
index += 1
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
' uso il Move col medesimo valore per i 2 argomenti per refreshare i DisplayIndex delle Column
|
|
||||||
' della ParentDataGridName in questione appena riordinate
|
|
||||||
For index = 0 To Map.refConfigurationPageVM.DGColumnsList.Count - 1
|
|
||||||
If Map.refConfigurationPageVM.DGColumnsList(index).ParentDataGridName = ParentDataGridName Then
|
|
||||||
Map.refConfigurationPageVM.DGColumnsList.Move(index, index)
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
' setto se il valore è stato modificato, a partire dalla verifica che il Nome e DisplayIndex combacino (altrimenti è per forza modificato)
|
|
||||||
m_IsModifiedVisible = (m_Name <>
|
|
||||||
GetPrivateProfileIniColumnProperty(ParentDataGridName, Map.refConfigurationPageVM.DGColumnsList, m_DisplayIndex, EgtDGColumnProperty.NAME)) OrElse
|
|
||||||
(If(m_Visible, 1, 0) <>
|
|
||||||
GetPrivateProfileIniColumnProperty(ParentDataGridName, Map.refConfigurationPageVM.DGColumnsList, m_DisplayIndex, EgtDGColumnProperty.VISIBLE))
|
|
||||||
End Set
|
|
||||||
End Property
|
|
||||||
|
|
||||||
Private m_CanUserEditVisible As Boolean
|
|
||||||
Public Property CanUserEditVisible As Boolean
|
|
||||||
Get
|
|
||||||
Return m_CanUserEditVisible
|
|
||||||
End Get
|
|
||||||
Set(value As Boolean)
|
|
||||||
m_CanUserEditVisible = value
|
|
||||||
End Set
|
|
||||||
End Property
|
|
||||||
|
|
||||||
Public ReadOnly Property IsModified() As Boolean
|
|
||||||
Get
|
|
||||||
Return m_IsModifiedDisplayIndex OrElse
|
|
||||||
m_IsModifiedIsReadOnly OrElse
|
|
||||||
m_IsModifiedCanUserReorder OrElse
|
|
||||||
m_IsModifiedCanUserResize OrElse
|
|
||||||
m_IsModifiedCanUserSort OrElse
|
|
||||||
m_IsModifiedVisible
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
Public Sub IsModifiedReset()
|
|
||||||
m_IsModifiedDisplayIndex = False
|
|
||||||
m_IsModifiedIsReadOnly = False
|
|
||||||
m_IsModifiedCanUserReorder = False
|
|
||||||
m_IsModifiedCanUserResize = False
|
|
||||||
m_IsModifiedCanUserSort = False
|
|
||||||
m_IsModifiedVisible = False
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Sub New(sName As String)
|
|
||||||
m_Name = sName
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Sub New(sParentDG As String, nDisplayIndex As Integer, sName As String, bCanUserReorder As Boolean, bCanUserResize As Boolean, bCanUserSort As Boolean, bIsReadOnly As Boolean, Width As DataGridLength, bVisible As Boolean, bCanUserEditVisible As Boolean)
|
|
||||||
m_ParentDataGridName = sParentDG
|
|
||||||
m_DisplayIndex = nDisplayIndex
|
|
||||||
m_Name = sName
|
|
||||||
m_CanUserReorder = bCanUserReorder
|
|
||||||
m_CanUserResize = bCanUserResize
|
|
||||||
m_CanUserSort = bCanUserSort
|
|
||||||
m_IsReadOnly = bIsReadOnly
|
|
||||||
m_Width = Width
|
|
||||||
m_Visible = bVisible
|
|
||||||
m_CanUserEditVisible = bCanUserEditVisible
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
End Class
|
|
||||||
|
|
||||||
Public Class ConfigVariable
|
Public Class ConfigVariable
|
||||||
|
|
||||||
Private m_sName As String
|
Private m_sName As String
|
||||||
@@ -712,67 +415,3 @@ End Class
|
|||||||
' LENGTH = 4
|
' LENGTH = 4
|
||||||
' CHECKBOX = 5
|
' CHECKBOX = 5
|
||||||
'End Enum
|
'End Enum
|
||||||
|
|
||||||
Public Module IniDataGridColumnFunctions
|
|
||||||
|
|
||||||
' funzione per ottenere dal file INI le colonne da caricare nella DataGrid usata per customizzare le proprietà delle colonne delle EgtDataGrid del programma
|
|
||||||
Public Function GetPrivateProfileIniColumns(ParentDGName As String, ByRef ocColumns As ObservableCollection(Of IniDataGridColumn)) As Boolean
|
|
||||||
Dim colIndex As Integer = 0
|
|
||||||
Dim str = String.Empty
|
|
||||||
While EgtUILib.GetPrivateProfileString(ParentDGName, colIndex, String.Empty, str, m_sDataGridColumnsIniFile) > 0
|
|
||||||
Dim sColumnParams() As String = str.Split(","c)
|
|
||||||
' verifico numero minimo di parametri
|
|
||||||
If sColumnParams.Count >= 9 Then
|
|
||||||
' cancello spazi
|
|
||||||
For index = 0 To sColumnParams.Count - 1
|
|
||||||
sColumnParams(index) = sColumnParams(index).Trim()
|
|
||||||
Next
|
|
||||||
' creo colonna
|
|
||||||
Dim sName = sColumnParams(0)
|
|
||||||
Dim bReorder As Boolean = sColumnParams(1).Equals("1")
|
|
||||||
Dim bResize As Boolean = sColumnParams(2).Equals("1")
|
|
||||||
Dim bSort As Boolean = sColumnParams(3).Equals("1")
|
|
||||||
Dim bIsReadOnly As Boolean = sColumnParams(4).Equals("1")
|
|
||||||
Dim Width As Double
|
|
||||||
Dim WidthType As DataGridLengthUnitType
|
|
||||||
StringToDouble(sColumnParams(5), Width)
|
|
||||||
Integer.TryParse(sColumnParams(6), WidthType)
|
|
||||||
Dim bVisible As Boolean = sColumnParams(7).Equals("1")
|
|
||||||
Dim bCanUserEditVisible As Boolean = sColumnParams(8).Equals("1")
|
|
||||||
ocColumns.Add(New IniDataGridColumn(ParentDGName, colIndex, sName, bReorder, bResize, bSort, bIsReadOnly, New DataGridLength(Width, WidthType), bVisible, bCanUserEditVisible))
|
|
||||||
End If
|
|
||||||
colIndex += 1
|
|
||||||
End While
|
|
||||||
Return ocColumns.Count > 0
|
|
||||||
End Function
|
|
||||||
|
|
||||||
' funzione che ottiene dal file INI la singola proprietà legata ad una specifica colonna
|
|
||||||
Public Function GetPrivateProfileIniColumnProperty(ParentDGName As String, ocColumns As ObservableCollection(Of IniDataGridColumn), DisplayIndex As Integer, PropertyIndex As EgtDGColumnProperty) As String
|
|
||||||
Dim str = String.Empty
|
|
||||||
If EgtUILib.GetPrivateProfileString(ParentDGName, DisplayIndex, String.Empty, str, m_sDataGridColumnsIniFile) > 0 Then
|
|
||||||
Dim sColumnParams() As String = str.Split(","c)
|
|
||||||
' verifico numero minimo di parametri
|
|
||||||
If sColumnParams.Count >= 9 Then
|
|
||||||
' cancello spazi
|
|
||||||
For index = 0 To sColumnParams.Count - 1
|
|
||||||
sColumnParams(index) = sColumnParams(index).Trim()
|
|
||||||
Next
|
|
||||||
If PropertyIndex > -1 AndAlso PropertyIndex < sColumnParams.Count Then Return sColumnParams(PropertyIndex)
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
Return ""
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Public Enum EgtDGColumnProperty
|
|
||||||
NAME = 0
|
|
||||||
REORDER = 1
|
|
||||||
RESIZE = 2
|
|
||||||
SORT = 3
|
|
||||||
ISREADONLY = 4
|
|
||||||
WIDTH = 5
|
|
||||||
WIDTHTYPE = 6
|
|
||||||
VISIBLE = 7
|
|
||||||
EDITVISIBLE = 8
|
|
||||||
End Enum
|
|
||||||
|
|
||||||
End Module
|
|
||||||
|
|||||||
@@ -1,89 +0,0 @@
|
|||||||
<DataGrid x:Class="DGColumnsListV"
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.ViewerOptimizer"
|
|
||||||
AutoGenerateColumns="False"
|
|
||||||
CanUserSortColumns="False"
|
|
||||||
CanUserResizeColumns="False"
|
|
||||||
CanUserResizeRows="False"
|
|
||||||
CanUserReorderColumns="False"
|
|
||||||
SelectionMode="Single"
|
|
||||||
ScrollViewer.CanContentScroll="False"
|
|
||||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
|
||||||
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
|
|
||||||
Margin="0,0,0,5">
|
|
||||||
|
|
||||||
<DataGrid.Columns>
|
|
||||||
<!--Indice-->
|
|
||||||
<!--<DataGridTextColumn Binding="{Binding DisplayIndex}"
|
|
||||||
Width="Auto"
|
|
||||||
IsReadOnly="True">
|
|
||||||
<DataGridTextColumn.HeaderTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<TextBlock Text="{Binding DataContext.DisplayIndex_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
|
|
||||||
</DataTemplate>
|
|
||||||
</DataGridTextColumn.HeaderTemplate>
|
|
||||||
</DataGridTextColumn>-->
|
|
||||||
<!--Nome colonna-->
|
|
||||||
<DataGridTextColumn Binding="{Binding VisName}"
|
|
||||||
Width="Auto"
|
|
||||||
IsReadOnly="True">
|
|
||||||
<DataGridTextColumn.HeaderTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<TextBlock Text="{Binding DataContext.ColumnName_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
|
|
||||||
</DataTemplate>
|
|
||||||
</DataGridTextColumn.HeaderTemplate>
|
|
||||||
</DataGridTextColumn>
|
|
||||||
<!--CanUserReorder-->
|
|
||||||
<DataGridCheckBoxColumn Binding="{Binding CanUserReorder, UpdateSourceTrigger=PropertyChanged}"
|
|
||||||
Width="Auto">
|
|
||||||
<DataGridCheckBoxColumn.HeaderTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<TextBlock Text="{Binding DataContext.CanUserReorder_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
|
|
||||||
</DataTemplate>
|
|
||||||
</DataGridCheckBoxColumn.HeaderTemplate>
|
|
||||||
</DataGridCheckBoxColumn>
|
|
||||||
<!--CanUserResize-->
|
|
||||||
<DataGridCheckBoxColumn Binding="{Binding CanUserResize, UpdateSourceTrigger=PropertyChanged}"
|
|
||||||
Width="Auto">
|
|
||||||
<DataGridCheckBoxColumn.HeaderTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<TextBlock Text="{Binding DataContext.CanUserResize_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
|
|
||||||
</DataTemplate>
|
|
||||||
</DataGridCheckBoxColumn.HeaderTemplate>
|
|
||||||
</DataGridCheckBoxColumn>
|
|
||||||
<!--CanUserSort-->
|
|
||||||
<DataGridCheckBoxColumn Binding="{Binding CanUserSort, UpdateSourceTrigger=PropertyChanged}"
|
|
||||||
Width="Auto">
|
|
||||||
<DataGridCheckBoxColumn.HeaderTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<TextBlock Text="{Binding DataContext.CanUserSort_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
|
|
||||||
</DataTemplate>
|
|
||||||
</DataGridCheckBoxColumn.HeaderTemplate>
|
|
||||||
</DataGridCheckBoxColumn>
|
|
||||||
<!--IsReadOnly-->
|
|
||||||
<!--<DataGridCheckBoxColumn Binding="{Binding IsReadOnly, UpdateSourceTrigger=PropertyChanged}"
|
|
||||||
Width="Auto">
|
|
||||||
<DataGridCheckBoxColumn.HeaderTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<TextBlock Text="{Binding DataContext.IsReadOnly_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
|
|
||||||
</DataTemplate>
|
|
||||||
</DataGridCheckBoxColumn.HeaderTemplate>
|
|
||||||
</DataGridCheckBoxColumn>-->
|
|
||||||
<!--Visible-->
|
|
||||||
<DataGridCheckBoxColumn Binding="{Binding Visible, UpdateSourceTrigger=PropertyChanged}"
|
|
||||||
Width="Auto">
|
|
||||||
<DataGridCheckBoxColumn.HeaderTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<TextBlock Text="{Binding DataContext.Visible_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
|
|
||||||
</DataTemplate>
|
|
||||||
</DataGridCheckBoxColumn.HeaderTemplate>
|
|
||||||
<DataGridCheckBoxColumn.CellStyle>
|
|
||||||
<Style TargetType="DataGridCell">
|
|
||||||
<Setter Property="IsEnabled" Value="{Binding CanUserEditVisible}" />
|
|
||||||
</Style>
|
|
||||||
</DataGridCheckBoxColumn.CellStyle>
|
|
||||||
</DataGridCheckBoxColumn>
|
|
||||||
</DataGrid.Columns>
|
|
||||||
|
|
||||||
</DataGrid>
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
Public Class DGColumnsListV
|
|
||||||
|
|
||||||
End Class
|
|
||||||
@@ -17,6 +17,8 @@ Module ConstCommVar
|
|||||||
NULL = 0
|
NULL = 0
|
||||||
TPA = 1
|
TPA = 1
|
||||||
NUM_FLEXIUM = 2
|
NUM_FLEXIUM = 2
|
||||||
|
NUM_AXIUM_APSERVER = 3
|
||||||
|
NUM_AXIUM_PCTOOLKIT = 4
|
||||||
End Enum
|
End Enum
|
||||||
|
|
||||||
' Assi
|
' Assi
|
||||||
@@ -44,6 +46,14 @@ Module ConstCommVar
|
|||||||
Public Const RUNNING As String = "Running"
|
Public Const RUNNING As String = "Running"
|
||||||
' indice della lavorazione in corso (pareti NUM)
|
' indice della lavorazione in corso (pareti NUM)
|
||||||
Public Const MACHINDEX As String = "MachIndex"
|
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
|
Public Enum OPStates
|
||||||
Start = 1
|
Start = 1
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
Module ConstMachMsg
|
||||||
|
|
||||||
|
Public Const MDI_MSG As String = "MDI"
|
||||||
|
Public Const PLC_MSG As String = "PLC"
|
||||||
|
Public Const CNC_MSG As String = "CNC"
|
||||||
|
|
||||||
|
End Module
|
||||||
@@ -100,19 +100,27 @@
|
|||||||
<Prefer32Bit>false</Prefer32Bit>
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="BouncyCastle.Crypto, Version=1.8.2.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
|
<Reference Include="APLog">
|
||||||
<HintPath>..\packages\Portable.BouncyCastle.1.8.2\lib\net40\BouncyCastle.Crypto.dll</HintPath>
|
<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.8.5.0, Culture=neutral, PublicKeyToken=0e99375e54769942">
|
||||||
|
<HintPath>..\packages\BouncyCastle.1.8.5\lib\BouncyCastle.Crypto.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Csv, Version=1.0.31.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="Csv, Version=1.0.31.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Csv.1.0.31\lib\net40\Csv.dll</HintPath>
|
<HintPath>..\packages\Csv.1.0.31\lib\net40\Csv.dll</HintPath>
|
||||||
</Reference>
|
</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>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\..\..\..\..\EgtProg\Dll32\EgtUILib.dll</HintPath>
|
<HintPath>..\ExtLibs\EgtUILib.dll</HintPath>
|
||||||
</Reference>
|
</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>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\..\..\..\..\EgtProg\Dll32\EgtWPFLib5.dll</HintPath>
|
<HintPath>..\ExtLibs\EgtWPFLib5.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
<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>
|
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
|
||||||
@@ -123,16 +131,31 @@
|
|||||||
<Reference Include="FluentFTP, Version=19.2.2.0, Culture=neutral, PublicKeyToken=f4af092b1d8df44f, processorArchitecture=MSIL">
|
<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>
|
<HintPath>..\packages\FluentFTP.19.2.2\lib\net45\FluentFTP.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="Google.Protobuf, Version=3.19.4.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Google.Protobuf.3.19.4\lib\net45\Google.Protobuf.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="Interop.FXLog">
|
<Reference Include="Interop.FXLog">
|
||||||
<HintPath>..\..\..\EgtProg\EgtBEAMWALL\Interop.FXLog.dll</HintPath>
|
<HintPath>..\ExtLibs\Interop.FXLog.dll</HintPath>
|
||||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Interop.FXServer">
|
<Reference Include="Interop.FXServer">
|
||||||
<HintPath>..\..\..\EgtProg\EgtBEAMWALL\Interop.FXServer.dll</HintPath>
|
<HintPath>..\ExtLibs\Interop.FXServer.dll</HintPath>
|
||||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||||
</Reference>
|
</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">
|
<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.2.6.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\K4os.Compression.LZ4.1.2.6\lib\net46\K4os.Compression.LZ4.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="K4os.Compression.LZ4.Streams, Version=1.2.6.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\K4os.Compression.LZ4.Streams.1.2.6\lib\net46\K4os.Compression.LZ4.Streams.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="K4os.Hash.xxHash, Version=1.0.6.0, Culture=neutral, PublicKeyToken=32cd54395057cec3, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\K4os.Hash.xxHash.1.0.6\lib\net46\K4os.Hash.xxHash.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<Reference Include="Microsoft.DotNet.PlatformAbstractions, Version=2.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.DotNet.PlatformAbstractions, Version=2.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
@@ -141,15 +164,21 @@
|
|||||||
<Reference Include="Microsoft.Extensions.DependencyModel, Version=2.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
<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>
|
<HintPath>..\packages\Microsoft.Extensions.DependencyModel.2.1.0\lib\net451\Microsoft.Extensions.DependencyModel.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="MySql.Data, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
<Reference Include="MySql.Data, Version=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\MySql.Data.6.10.9\lib\net452\MySql.Data.dll</HintPath>
|
<HintPath>..\packages\MySql.Data.8.0.21\lib\net452\MySql.Data.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="MySql.Data.Entity.EF6, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
<Reference Include="MySql.Data.EntityFramework, Version=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\MySql.Data.Entity.6.10.9\lib\net452\MySql.Data.Entity.EF6.dll</HintPath>
|
<HintPath>..\packages\MySql.Data.EntityFramework.8.0.21\lib\net452\MySql.Data.EntityFramework.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
<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>
|
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||||
</Reference>
|
</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">
|
<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>
|
<HintPath>..\packages\Zebra.Printer.SDK.2.15.2634\lib\net471\SdkApi.Core.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
@@ -162,6 +191,9 @@
|
|||||||
<Reference Include="SharpSnmpLib, Version=10.0.9.0, Culture=neutral, PublicKeyToken=4c00852d3788e005, processorArchitecture=MSIL">
|
<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>
|
<HintPath>..\packages\Lextm.SharpSnmpLib.10.0.9\lib\net452\SharpSnmpLib.dll</HintPath>
|
||||||
</Reference>
|
</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">
|
<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>
|
<HintPath>..\packages\System.Collections.Specialized.4.3.0\lib\net46\System.Collections.Specialized.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
@@ -174,7 +206,11 @@
|
|||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
<Reference Include="System.Drawing.Design" />
|
<Reference Include="System.Drawing.Design" />
|
||||||
|
<Reference Include="System.IO.Compression" />
|
||||||
<Reference Include="System.Management" />
|
<Reference Include="System.Management" />
|
||||||
|
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System.Net.NameResolution, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<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>
|
<HintPath>..\packages\System.Net.NameResolution.4.3.0\lib\net46\System.Net.NameResolution.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
@@ -185,6 +221,13 @@
|
|||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</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=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<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>
|
<HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.0.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
@@ -208,6 +251,9 @@
|
|||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</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="WindowsBase" />
|
||||||
<Reference Include="PresentationCore" />
|
<Reference Include="PresentationCore" />
|
||||||
<Reference Include="PresentationFramework" />
|
<Reference Include="PresentationFramework" />
|
||||||
@@ -215,6 +261,9 @@
|
|||||||
<Reference Include="ZebraPrinterSdk, Version=2.15.2634.0, Culture=neutral, processorArchitecture=MSIL">
|
<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>
|
<HintPath>..\packages\Zebra.Printer.SDK.2.15.2634\lib\net471\ZebraPrinterSdk.dll</HintPath>
|
||||||
</Reference>
|
</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>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ApplicationDefinition Include="Application.xaml">
|
<ApplicationDefinition Include="Application.xaml">
|
||||||
@@ -233,8 +282,15 @@
|
|||||||
<DependentUpon>CalcPanelV.xaml</DependentUpon>
|
<DependentUpon>CalcPanelV.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="CALCPanel\CALCPanelVM.vb" />
|
<Compile Include="CALCPanel\CALCPanelVM.vb" />
|
||||||
|
<Compile Include="Comms\NUMAxiumComm.vb" />
|
||||||
|
<Compile Include="Comms\NUMAxiumPcToolkitComm.vb" />
|
||||||
<Compile Include="Comms\NUMFlexiumComm.vb" />
|
<Compile Include="Comms\NUMFlexiumComm.vb" />
|
||||||
<Compile Include="Comms\TPAComm.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">
|
<Compile Include="MDIPage\MDIPageV.xaml.vb">
|
||||||
<DependentUpon>MDIPageV.xaml</DependentUpon>
|
<DependentUpon>MDIPageV.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -251,9 +307,6 @@
|
|||||||
<DependentUpon>ConfigurationPageV.xaml</DependentUpon>
|
<DependentUpon>ConfigurationPageV.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="ConfigurationPage\ConfigurationPageVM.vb" />
|
<Compile Include="ConfigurationPage\ConfigurationPageVM.vb" />
|
||||||
<Compile Include="ConfigurationPage\DGColumnsListV.xaml.vb">
|
|
||||||
<DependentUpon>DGColumnsListV.xaml</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Constants\ConstCommVar.vb" />
|
<Compile Include="Constants\ConstCommVar.vb" />
|
||||||
<Compile Include="ItemParamList\FeatureInPartInRawPartListV.xaml.vb">
|
<Compile Include="ItemParamList\FeatureInPartInRawPartListV.xaml.vb">
|
||||||
<DependentUpon>FeatureInPartInRawPartListV.xaml</DependentUpon>
|
<DependentUpon>FeatureInPartInRawPartListV.xaml</DependentUpon>
|
||||||
@@ -320,6 +373,7 @@
|
|||||||
<DependentUpon>Dictionary.xaml</DependentUpon>
|
<DependentUpon>Dictionary.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Utility\DisableModifiedMgr.vb" />
|
<Compile Include="Utility\DisableModifiedMgr.vb" />
|
||||||
|
<Compile Include="Utility\LogEvent.vb" />
|
||||||
<Compile Include="Utility\LuaExec.vb" />
|
<Compile Include="Utility\LuaExec.vb" />
|
||||||
<Compile Include="Utility\ManageBTLParts.vb" />
|
<Compile Include="Utility\ManageBTLParts.vb" />
|
||||||
<Compile Include="Utility\Map.vb" />
|
<Compile Include="Utility\Map.vb" />
|
||||||
@@ -349,6 +403,10 @@
|
|||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="MachineLogPage\MachineLogPageV.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Include="MDIPage\MDIPageV.xaml">
|
<Page Include="MDIPage\MDIPageV.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
@@ -365,10 +423,6 @@
|
|||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="ConfigurationPage\DGColumnsListV.xaml">
|
|
||||||
<Generator>MSBuild:Compile</Generator>
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
</Page>
|
|
||||||
<Page Include="ItemParamList\FeatureInPartInRawPartListV.xaml">
|
<Page Include="ItemParamList\FeatureInPartInRawPartListV.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
@@ -509,17 +563,6 @@
|
|||||||
<Resource Include="Resources\EgtBEAMWALL.ico" />
|
<Resource Include="Resources\EgtBEAMWALL.ico" />
|
||||||
<Resource Include="Resources\TreeView\Folder.png" />
|
<Resource Include="Resources\TreeView\Folder.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<Resource Include="Resources\ProjectManager\DxfOut.png" />
|
|
||||||
<Resource Include="Resources\ProjectManager\Export.png" />
|
|
||||||
<Resource Include="Resources\ProjectManager\Import.png" />
|
|
||||||
<Resource Include="Resources\ProjectManager\New.png" />
|
|
||||||
<Resource Include="Resources\ProjectManager\Open.png" />
|
|
||||||
<Resource Include="Resources\ProjectManager\Options.png" />
|
|
||||||
<Resource Include="Resources\ProjectManager\Save.png" />
|
|
||||||
<Resource Include="Resources\ProjectManager\SaveAs.png" />
|
|
||||||
<Resource Include="Resources\ProjectManager\Send.png" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Resource Include="Resources\ShowPanel\RenderingHL.png" />
|
<Resource Include="Resources\ShowPanel\RenderingHL.png" />
|
||||||
<Resource Include="Resources\ShowPanel\RenderingSH.png" />
|
<Resource Include="Resources\ShowPanel\RenderingSH.png" />
|
||||||
@@ -564,6 +607,27 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Resource Include="Resources\MDIPage\Send.png" />
|
<Resource Include="Resources\MDIPage\Send.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Resource Include="Resources\ProjectManager\GoToProd.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Resource Include="Resources\ProjectManager\Open.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<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" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
|||||||
@@ -16,13 +16,12 @@
|
|||||||
CanUserAddRows="False"
|
CanUserAddRows="False"
|
||||||
AutoGenerateColumns="False"
|
AutoGenerateColumns="False"
|
||||||
CanUserSortColumns="False"
|
CanUserSortColumns="False"
|
||||||
CanUserResizeColumns="False"
|
|
||||||
CanUserResizeRows="False"
|
CanUserResizeRows="False"
|
||||||
CanUserReorderColumns="False"
|
CanUserReorderColumns="False"
|
||||||
SelectionMode="Single"
|
SelectionMode="Single"
|
||||||
ScrollViewer.CanContentScroll="True"
|
ScrollViewer.CanContentScroll="True"
|
||||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||||
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
|
ScrollViewer.HorizontalScrollBarVisibility="Auto"
|
||||||
Margin="0,0,0,5"
|
Margin="0,0,0,5"
|
||||||
BindingColumns="{Binding FeatureInPartInRawPartColumns}"
|
BindingColumns="{Binding FeatureInPartInRawPartColumns}"
|
||||||
Style="{StaticResource DataGrid_CustomHighLight}">
|
Style="{StaticResource DataGrid_CustomHighLight}">
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
SelectionMode="Single"
|
SelectionMode="Single"
|
||||||
ScrollViewer.CanContentScroll="True"
|
ScrollViewer.CanContentScroll="True"
|
||||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||||
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
|
ScrollViewer.HorizontalScrollBarVisibility="Auto"
|
||||||
Margin="0,0,0,5"
|
Margin="0,0,0,5"
|
||||||
BindingColumns="{Binding PartInRawPartColumns}"
|
BindingColumns="{Binding PartInRawPartColumns}"
|
||||||
Style="{StaticResource DataGrid_CustomHighLight}">
|
Style="{StaticResource DataGrid_CustomHighLight}">
|
||||||
@@ -156,6 +156,18 @@
|
|||||||
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:PartInRawPartListV}}}"/>
|
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:PartInRawPartListV}}}"/>
|
||||||
</DataGridTextColumn.Header>
|
</DataGridTextColumn.Header>
|
||||||
</DataGridTextColumn>
|
</DataGridTextColumn>
|
||||||
|
<!--GRP - Gruppo-->
|
||||||
|
<DataGridTextColumn x:Key="colGROUP" Binding="{Binding sGROUP}">
|
||||||
|
<DataGridTextColumn.Header>
|
||||||
|
<TextBlock Text="{Binding Path=DataContext.GRP_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:PartInRawPartListV}}}"/>
|
||||||
|
</DataGridTextColumn.Header>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
<!--STOREY - Sottogruppo-->
|
||||||
|
<DataGridTextColumn x:Key="colSTOREY" Binding="{Binding sSTOREY}">
|
||||||
|
<DataGridTextColumn.Header>
|
||||||
|
<TextBlock Text="{Binding Path=DataContext.STOREY_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:PartInRawPartListV}}}"/>
|
||||||
|
</DataGridTextColumn.Header>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
|
||||||
</DataGrid.Resources>
|
</DataGrid.Resources>
|
||||||
<DataGrid.RowStyle>
|
<DataGrid.RowStyle>
|
||||||
|
|||||||
@@ -113,6 +113,18 @@ Public Class PartInRawPartListVM
|
|||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
Public ReadOnly Property GRP_Msg As String
|
||||||
|
Get
|
||||||
|
Return EgtMsg(61624)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Public ReadOnly Property STOREY_Msg As String
|
||||||
|
Get
|
||||||
|
Return EgtMsg(61623)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
#End Region ' Messages
|
#End Region ' Messages
|
||||||
|
|
||||||
#Region "CONSTRUCTOR"
|
#Region "CONSTRUCTOR"
|
||||||
@@ -130,6 +142,10 @@ Public Class PartInRawPartListVM
|
|||||||
m_colPartInRawPart_Flip = m_PartInRawPartColumns.FirstOrDefault(Function(x) x.Name = COL_FLIP)
|
m_colPartInRawPart_Flip = m_PartInRawPartColumns.FirstOrDefault(Function(x) x.Name = COL_FLIP)
|
||||||
m_colPartInRawPart_PosX = m_PartInRawPartColumns.FirstOrDefault(Function(x) x.Name = COL_POSX)
|
m_colPartInRawPart_PosX = m_PartInRawPartColumns.FirstOrDefault(Function(x) x.Name = COL_POSX)
|
||||||
m_colPartInRawPart_PosY = m_PartInRawPartColumns.FirstOrDefault(Function(x) x.Name = COL_POSY)
|
m_colPartInRawPart_PosY = m_PartInRawPartColumns.FirstOrDefault(Function(x) x.Name = COL_POSY)
|
||||||
|
' aggiorno la visibilità delle colonne
|
||||||
|
For Each col In PartInRawPartColumns
|
||||||
|
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
|
||||||
|
Next
|
||||||
' nascondo colonna redo
|
' nascondo colonna redo
|
||||||
If Not IsNothing(colPartInRawPart_Redo) Then
|
If Not IsNothing(colPartInRawPart_Redo) Then
|
||||||
colPartInRawPart_Redo.ColumnVisibility = Visibility.Collapsed
|
colPartInRawPart_Redo.ColumnVisibility = Visibility.Collapsed
|
||||||
@@ -143,6 +159,13 @@ Public Class PartInRawPartListVM
|
|||||||
If Not IsNothing(m_colPartInRawPart_Offset) Then
|
If Not IsNothing(m_colPartInRawPart_Offset) Then
|
||||||
m_colPartInRawPart_Offset.ColumnVisibility = Visibility.Visible
|
m_colPartInRawPart_Offset.ColumnVisibility = Visibility.Visible
|
||||||
End If
|
End If
|
||||||
|
' aggiorno la visibilità delle colonne
|
||||||
|
For Each col In PartInRawPartColumns
|
||||||
|
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
|
||||||
|
Next
|
||||||
|
If Not IsNothing(colPartInRawPart_Redo) Then
|
||||||
|
colPartInRawPart_Redo.ColumnVisibility = Visibility.Collapsed
|
||||||
|
End If
|
||||||
If Not IsNothing(m_colPartInRawPart_Rot) Then
|
If Not IsNothing(m_colPartInRawPart_Rot) Then
|
||||||
m_colPartInRawPart_Rot.ColumnVisibility = Visibility.Collapsed
|
m_colPartInRawPart_Rot.ColumnVisibility = Visibility.Collapsed
|
||||||
End If
|
End If
|
||||||
@@ -158,9 +181,6 @@ Public Class PartInRawPartListVM
|
|||||||
'PartInRawPartColumns.Clear()
|
'PartInRawPartColumns.Clear()
|
||||||
'GetPrivateProfileColumns(S_PARTINRAWPARTLIST_BEAM, PartInRawPartColumns)
|
'GetPrivateProfileColumns(S_PARTINRAWPARTLIST_BEAM, PartInRawPartColumns)
|
||||||
ElseIf nMachType = MachineType.WALL Then
|
ElseIf nMachType = MachineType.WALL Then
|
||||||
If Not IsNothing(m_colPartInRawPart_Offset) Then
|
|
||||||
m_colPartInRawPart_Offset.ColumnVisibility = Visibility.Collapsed
|
|
||||||
End If
|
|
||||||
If Not IsNothing(m_colPartInRawPart_Rot) Then
|
If Not IsNothing(m_colPartInRawPart_Rot) Then
|
||||||
m_colPartInRawPart_Rot.ColumnVisibility = Visibility.Visible
|
m_colPartInRawPart_Rot.ColumnVisibility = Visibility.Visible
|
||||||
End If
|
End If
|
||||||
@@ -173,6 +193,16 @@ Public Class PartInRawPartListVM
|
|||||||
If Not IsNothing(m_colPartInRawPart_PosY) Then
|
If Not IsNothing(m_colPartInRawPart_PosY) Then
|
||||||
m_colPartInRawPart_PosY.ColumnVisibility = Visibility.Visible
|
m_colPartInRawPart_PosY.ColumnVisibility = Visibility.Visible
|
||||||
End If
|
End If
|
||||||
|
' aggiorno la visibilità delle colonne
|
||||||
|
For Each col In PartInRawPartColumns
|
||||||
|
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
|
||||||
|
Next
|
||||||
|
If Not IsNothing(colPartInRawPart_Redo) Then
|
||||||
|
colPartInRawPart_Redo.ColumnVisibility = Visibility.Collapsed
|
||||||
|
End If
|
||||||
|
If Not IsNothing(m_colPartInRawPart_Offset) Then
|
||||||
|
m_colPartInRawPart_Offset.ColumnVisibility = Visibility.Collapsed
|
||||||
|
End If
|
||||||
' PartInRawPartColumns.Clear()
|
' PartInRawPartColumns.Clear()
|
||||||
'GetPrivateProfileColumns(S_PARTINRAWPARTLIST_WALL, PartInRawPartColumns)
|
'GetPrivateProfileColumns(S_PARTINRAWPARTLIST_WALL, PartInRawPartColumns)
|
||||||
End If
|
End If
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
SelectionMode="Single"
|
SelectionMode="Single"
|
||||||
ScrollViewer.CanContentScroll="True"
|
ScrollViewer.CanContentScroll="True"
|
||||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||||
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
|
ScrollViewer.HorizontalScrollBarVisibility="Auto"
|
||||||
Margin="0,0,0,5"
|
Margin="0,0,0,5"
|
||||||
BindingColumns="{Binding RawPartColumns}"
|
BindingColumns="{Binding RawPartColumns}"
|
||||||
Style="{StaticResource DataGrid_CustomHighLight}">
|
Style="{StaticResource DataGrid_CustomHighLight}">
|
||||||
@@ -82,7 +82,7 @@
|
|||||||
</DataGridTextColumn.Header>
|
</DataGridTextColumn.Header>
|
||||||
</DataGridTextColumn>
|
</DataGridTextColumn>
|
||||||
<!--MAT - Materiale-->
|
<!--MAT - Materiale-->
|
||||||
<DataGridTextColumn x:Key="colMATERIAL" Binding="{Binding dL}">
|
<DataGridTextColumn x:Key="colMATERIAL" Binding="{Binding sMATERIAL}">
|
||||||
<DataGridTextColumn.Header>
|
<DataGridTextColumn.Header>
|
||||||
<TextBlock Text="{Binding Path=DataContext.Material_Msg,
|
<TextBlock Text="{Binding Path=DataContext.Material_Msg,
|
||||||
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:RawPartListV}}}"/>
|
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:RawPartListV}}}"/>
|
||||||
@@ -106,6 +106,7 @@
|
|||||||
<DataGrid.RowStyle>
|
<DataGrid.RowStyle>
|
||||||
<Style TargetType="DataGridRow" BasedOn="{StaticResource RowDataGrid_CustomHighLight}">
|
<Style TargetType="DataGridRow" BasedOn="{StaticResource RowDataGrid_CustomHighLight}">
|
||||||
<Setter Property="Background" Value="{Binding Production_Background}"/>
|
<Setter Property="Background" Value="{Binding Production_Background}"/>
|
||||||
|
<EventSetter Event="PreviewMouseDown" Handler="RawPartRow_PreviewMouseDown"/>
|
||||||
</Style>
|
</Style>
|
||||||
</DataGrid.RowStyle>
|
</DataGrid.RowStyle>
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,15 @@
|
|||||||
Public Class RawPartListV
|
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
|
End Class
|
||||||
|
|||||||
@@ -97,7 +97,15 @@ Public Class RawPartListVM
|
|||||||
End If
|
End If
|
||||||
'RawPartColumns.Clear()
|
'RawPartColumns.Clear()
|
||||||
'GetPrivateProfileColumns(S_RAWPARTLIST_BEAM, RawPartColumns)
|
'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
|
||||||
ElseIf nMachType = MachineType.WALL Then
|
ElseIf nMachType = MachineType.WALL Then
|
||||||
|
' 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
|
If Not IsNothing(m_colRawPart_StartCut) Then
|
||||||
m_colRawPart_StartCut.ColumnVisibility = Visibility.Collapsed
|
m_colRawPart_StartCut.ColumnVisibility = Visibility.Collapsed
|
||||||
End If
|
End If
|
||||||
|
|||||||
@@ -10,18 +10,19 @@
|
|||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="{Binding GridDims[0].GridLen, Mode=TwoWay}"/>
|
<RowDefinition Height="{Binding GridDims[0].GridLen, Mode=TwoWay}"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="{Binding GridDims[1].GridLen, Mode=TwoWay}"/>
|
<RowDefinition Height="{Binding GridDims[1].GridLen, Mode=TwoWay}"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<GroupBox Header="Channel"
|
<GroupBox Header="{Binding Channel_Msg}"
|
||||||
Visibility="{Binding Channel_Visibility}">
|
Visibility="{Binding Channel_Visibility}">
|
||||||
<ComboBox ItemsSource="{Binding ChannelList}"
|
<ComboBox ItemsSource="{Binding ChannelList}"
|
||||||
SelectedItem="{Binding SelChannel}"
|
SelectedItem="{Binding SelChannel}"
|
||||||
DisplayMemberPath="Name"/>
|
DisplayMemberPath="Name"/>
|
||||||
</GroupBox>
|
</GroupBox>
|
||||||
|
|
||||||
<GroupBox Grid.Row="1" Header="OPMode"
|
<GroupBox Grid.Row="1" Header="{Binding OPMode_Msg}"
|
||||||
Visibility="{Binding OPMode_Visibility}">
|
Visibility="{Binding OPMode_Visibility}">
|
||||||
<ComboBox ItemsSource="{Binding OPModeList}"
|
<ComboBox ItemsSource="{Binding OPModeList}"
|
||||||
SelectedItem="{Binding SelOPMode}"
|
SelectedItem="{Binding SelOPMode}"
|
||||||
@@ -32,12 +33,28 @@
|
|||||||
<TextBlock Text="OPState"/>
|
<TextBlock Text="OPState"/>
|
||||||
<TextBlock Text="{Binding SelOPState.Name}"/>
|
<TextBlock Text="{Binding SelOPState.Name}"/>
|
||||||
</UniformGrid>
|
</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">
|
Header="Axis">
|
||||||
<EgtBEAMWALL:AxesPanelV DataContext="{StaticResource AxesPanelVM}"/>
|
<EgtBEAMWALL:AxesPanelV DataContext="{StaticResource AxesPanelVM}"/>
|
||||||
</Expander>
|
</Expander>
|
||||||
|
|
||||||
<Grid Grid.Row="4">
|
|
||||||
|
<Grid Grid.Row="5">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="1*"/>
|
<RowDefinition Height="1*"/>
|
||||||
@@ -45,52 +62,50 @@
|
|||||||
<StackPanel Grid.Row="0"
|
<StackPanel Grid.Row="0"
|
||||||
Orientation="Horizontal"
|
Orientation="Horizontal"
|
||||||
HorizontalAlignment="Right">
|
HorizontalAlignment="Right">
|
||||||
<Button ToolTip="˄"
|
<Button Command="{Binding MoveUpRawPart_Command}"
|
||||||
Command="{Binding MoveUpRawPart_Command}"
|
IsEnabled="{Binding MoveRawPart_IsEnabled}"
|
||||||
IsEnabled="{Binding MoveRawPart_IsEnabled}"
|
Style="{StaticResource LeftPanel_Button}">
|
||||||
Style="{StaticResource LeftPanel_Button}">
|
|
||||||
<Image Source="/Resources/LeftPanel/MoveUp.png" Stretch="Uniform"/>
|
<Image Source="/Resources/LeftPanel/MoveUp.png" Stretch="Uniform"/>
|
||||||
</Button>
|
</Button>
|
||||||
<Button ToolTip="˅"
|
<Button Command="{Binding MoveDownRawPart_Command}"
|
||||||
Command="{Binding MoveDownRawPart_Command}"
|
IsEnabled="{Binding MoveRawPart_IsEnabled}"
|
||||||
IsEnabled="{Binding MoveRawPart_IsEnabled}"
|
Style="{StaticResource LeftPanel_Button}">
|
||||||
Style="{StaticResource LeftPanel_Button}">
|
|
||||||
<Image Source="/Resources/LeftPanel/MoveDown.png" Stretch="Uniform"/>
|
<Image Source="/Resources/LeftPanel/MoveDown.png" Stretch="Uniform"/>
|
||||||
</Button>
|
</Button>
|
||||||
<Button ToolTip="P"
|
<Button ToolTip="{Binding ProduceAll_ToolTip}"
|
||||||
Command="{Binding ProduceAll_Command}"
|
Command="{Binding ProduceAll_Command}"
|
||||||
IsEnabled="{Binding LeftPanel_IsEnabled}"
|
IsEnabled="{Binding LeftPanel_IsEnabled}"
|
||||||
Style="{StaticResource LeftPanel_Button}">
|
Style="{StaticResource LeftPanel_Button}">
|
||||||
<Image Source="/Resources/LeftPanel/ProduceAll.png" Stretch="Uniform"/>
|
<Image Source="/Resources/LeftPanel/ProduceAll.png" Stretch="Uniform"/>
|
||||||
</Button>
|
</Button>
|
||||||
<Button ToolTip="D"
|
<Button ToolTip="{Binding DoneRawPart_ToolTip}"
|
||||||
Command="{Binding DoneRawPart_Command}"
|
Command="{Binding DoneRawPart_Command}"
|
||||||
IsEnabled="{Binding DoneRawPart_IsEnabled}"
|
IsEnabled="{Binding DoneRawPart_IsEnabled}"
|
||||||
Style="{StaticResource LeftPanel_Button}">
|
Style="{StaticResource LeftPanel_Button}">
|
||||||
<Image Source="/Resources/LeftPanel/DoneRawPart.png" Stretch="Uniform"/>
|
<Image Source="/Resources/LeftPanel/DoneRawPart.png" Stretch="Uniform"/>
|
||||||
</Button>
|
</Button>
|
||||||
<Button ToolTip="R"
|
<Button ToolTip="{Binding ResetRawPart_ToolTip}"
|
||||||
Command="{Binding ResetRawPart_Command}"
|
Command="{Binding ResetRawPart_Command}"
|
||||||
IsEnabled="{Binding ResetRawPart_IsEnabled}"
|
IsEnabled="{Binding ResetRawPart_IsEnabled}"
|
||||||
Style="{StaticResource LeftPanel_Button}">
|
Style="{StaticResource LeftPanel_Button}">
|
||||||
<Image Source="/Resources/LeftPanel/ResetRawPart.png" Stretch="Uniform"/>
|
<Image Source="/Resources/LeftPanel/ResetRawPart.png" Stretch="Uniform"/>
|
||||||
</Button>
|
</Button>
|
||||||
<Button ToolTip="-"
|
<Button ToolTip="{Binding DeleteRawPart_ToolTip}"
|
||||||
Command="{Binding DeleteRawPart_Command}"
|
Command="{Binding DeleteRawPart_Command}"
|
||||||
IsEnabled="{Binding DeleteRawPart_IsEnabled}"
|
IsEnabled="{Binding DeleteRawPart_IsEnabled}"
|
||||||
Style="{StaticResource LeftPanel_Button}">
|
Style="{StaticResource LeftPanel_Button}">
|
||||||
<Image Source="/Resources/LeftPanel/DeleteRawPart.png" Stretch="Uniform"/>
|
<Image Source="/Resources/LeftPanel/DeleteRawPart.png" Stretch="Uniform"/>
|
||||||
</Button>
|
</Button>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<EgtBEAMWALL:RawPartListV Grid.Row="1"
|
<EgtBEAMWALL:RawPartListV Grid.Row="1"
|
||||||
DataContext="{StaticResource RawPartListVM}"
|
DataContext="{StaticResource RawPartListVM}"
|
||||||
Tag="{Binding Tag, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LeftPanelV}}}"/>
|
Tag="{Binding Tag, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LeftPanelV}}}"/>
|
||||||
</Grid>
|
</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>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="1*"/>
|
<RowDefinition Height="1*"/>
|
||||||
@@ -98,14 +113,14 @@
|
|||||||
<StackPanel Grid.Row="0"
|
<StackPanel Grid.Row="0"
|
||||||
Orientation="Horizontal"
|
Orientation="Horizontal"
|
||||||
HorizontalAlignment="Right">
|
HorizontalAlignment="Right">
|
||||||
<Button ToolTip="P"
|
<Button ToolTip="{Binding PrintLabel_ToolTip}"
|
||||||
Command="{Binding PrintLabel_Command}"
|
Command="{Binding PrintLabel_Command}"
|
||||||
IsEnabled="{Binding LeftPanel_IsEnabled}"
|
IsEnabled="{Binding LeftPanel_IsEnabled}"
|
||||||
Visibility="{Binding PrintLabel_Visibility}"
|
Visibility="{Binding PrintLabel_Visibility}"
|
||||||
Style="{StaticResource LeftPanel_Button}">
|
Style="{StaticResource LeftPanel_Button}">
|
||||||
<Image Source="/Resources/LeftPanel/PrintLabel.png" Stretch="Uniform"/>
|
<Image Source="/Resources/LeftPanel/PrintLabel.png" Stretch="Uniform"/>
|
||||||
</Button>
|
</Button>
|
||||||
<Button ToolTip="D"
|
<Button ToolTip="{Binding DonePart_ToolTip}"
|
||||||
Command="{Binding DonePart_Command}"
|
Command="{Binding DonePart_Command}"
|
||||||
IsEnabled="{Binding LeftPanel_IsEnabled}"
|
IsEnabled="{Binding LeftPanel_IsEnabled}"
|
||||||
Visibility="{Binding DonePart_Visibility}"
|
Visibility="{Binding DonePart_Visibility}"
|
||||||
@@ -114,7 +129,10 @@
|
|||||||
</Button>
|
</Button>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<Grid Grid.Row="1">
|
<Grid Grid.Row="1" x:Name="PartFeatureGrid">
|
||||||
|
<Grid.Resources>
|
||||||
|
<EgtBEAMWALL:FeatureDataGridHeightConverter x:Key="FeatureDataGridHeightConverter"/>
|
||||||
|
</Grid.Resources>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="1*"/>
|
<RowDefinition Height="1*"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
@@ -122,7 +140,7 @@
|
|||||||
<EgtBEAMWALL:PartInRawPartListV DataContext="{StaticResource PartInRawPartListVM}"
|
<EgtBEAMWALL:PartInRawPartListV DataContext="{StaticResource PartInRawPartListVM}"
|
||||||
Tag="{Binding Tag.SelectedMachGroup, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LeftPanelV}}}"/>
|
Tag="{Binding Tag.SelectedMachGroup, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LeftPanelV}}}"/>
|
||||||
<EgtBEAMWALL:FeatureInPartInRawPartListV Grid.Row="1"
|
<EgtBEAMWALL:FeatureInPartInRawPartListV Grid.Row="1"
|
||||||
Height="80"
|
Height="{Binding ActualHeight, ElementName=PartFeatureGrid, Converter={StaticResource FeatureDataGridHeightConverter}}"
|
||||||
DataContext="{StaticResource FeatureInPartInRawPartListVM}"
|
DataContext="{StaticResource FeatureInPartInRawPartListVM}"
|
||||||
Tag="{Binding Tag.SelectedMachGroup.SelPart, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LeftPanelV}}}"
|
Tag="{Binding Tag.SelectedMachGroup.SelPart, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LeftPanelV}}}"
|
||||||
Visibility="{Binding DataContext.FeatureList_Visibility, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LeftPanelV}}}"/>
|
Visibility="{Binding DataContext.FeatureList_Visibility, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LeftPanelV}}}"/>
|
||||||
|
|||||||
@@ -90,6 +90,9 @@ Public Class LeftPanelVM
|
|||||||
If value.Id = OPModes.Mdi Then
|
If value.Id = OPModes.Mdi Then
|
||||||
' mostro pagina comandi MDI
|
' mostro pagina comandi MDI
|
||||||
Map.refProjectVM.SetSelTabPage(ProjectVM.TabPages.MDI)
|
Map.refProjectVM.SetSelTabPage(ProjectVM.TabPages.MDI)
|
||||||
|
ElseIf Map.refCALCPanelVM.bMachineLog Then
|
||||||
|
' mostro log macchina
|
||||||
|
Map.refProjectVM.SetSelTabPage(ProjectVM.TabPages.MACHINELOG)
|
||||||
Else
|
Else
|
||||||
' mostro scena
|
' mostro scena
|
||||||
Map.refProjectVM.SetSelTabPage(ProjectVM.TabPages.SCENE)
|
Map.refProjectVM.SetSelTabPage(ProjectVM.TabPages.SCENE)
|
||||||
@@ -98,9 +101,50 @@ Public Class LeftPanelVM
|
|||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
Friend Sub SetOPMode(value As OPState)
|
Friend Sub SetOPMode(value As OPState)
|
||||||
|
' se MDI
|
||||||
|
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)
|
||||||
|
End If
|
||||||
m_SelOPMode = value
|
m_SelOPMode = value
|
||||||
NotifyPropertyChanged(NameOf(SelOPMode))
|
NotifyPropertyChanged(NameOf(SelOPMode))
|
||||||
End Sub
|
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
|
Private m_bRestart As Boolean = False
|
||||||
Public Property bRestart As Boolean
|
Public Property bRestart As Boolean
|
||||||
@@ -147,7 +191,7 @@ Public Class LeftPanelVM
|
|||||||
|
|
||||||
Public ReadOnly Property MoveRawPart_IsEnabled As Boolean
|
Public ReadOnly Property MoveRawPart_IsEnabled As Boolean
|
||||||
Get
|
Get
|
||||||
If IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM) Then
|
If IsNothing(Map.refProjectVM) OrElse IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM) Then
|
||||||
Return False
|
Return False
|
||||||
ElseIf m_SelOPState.Id <> OPStates.End AndAlso m_SelOPState.Id <> OPStates.Unspecified Then
|
ElseIf m_SelOPState.Id <> OPStates.End AndAlso m_SelOPState.Id <> OPStates.Unspecified Then
|
||||||
Return False
|
Return False
|
||||||
@@ -164,7 +208,7 @@ Public Class LeftPanelVM
|
|||||||
|
|
||||||
Public ReadOnly Property DoneRawPart_IsEnabled As Boolean
|
Public ReadOnly Property DoneRawPart_IsEnabled As Boolean
|
||||||
Get
|
Get
|
||||||
If IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM) Then
|
If IsNothing(Map.refProjectVM) OrElse IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM) Then
|
||||||
Return False
|
Return False
|
||||||
ElseIf m_SelOPState.Id <> OPStates.End AndAlso m_SelOPState.Id <> OPStates.Unspecified Then
|
ElseIf m_SelOPState.Id <> OPStates.End AndAlso m_SelOPState.Id <> OPStates.Unspecified Then
|
||||||
Return False
|
Return False
|
||||||
@@ -172,7 +216,7 @@ Public Class LeftPanelVM
|
|||||||
Return False
|
Return False
|
||||||
ElseIf Not IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM.SelectedMachGroup) Then
|
ElseIf Not IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM.SelectedMachGroup) Then
|
||||||
Dim SelMachgroup As MyMachGroupVM = DirectCast(Map.refProjectVM.SupervisorMachGroupPanelVM.SelectedMachGroup, MyMachGroupVM)
|
Dim SelMachgroup As MyMachGroupVM = DirectCast(Map.refProjectVM.SupervisorMachGroupPanelVM.SelectedMachGroup, MyMachGroupVM)
|
||||||
Return SelMachgroup.nProduction_State <= ItemState.Confirmed
|
Return SelMachgroup.nProduction_State <= ItemState.WIP
|
||||||
Else
|
Else
|
||||||
Return m_LeftPanel_IsEnabled
|
Return m_LeftPanel_IsEnabled
|
||||||
End If
|
End If
|
||||||
@@ -181,7 +225,7 @@ Public Class LeftPanelVM
|
|||||||
|
|
||||||
Public ReadOnly Property ResetRawPart_IsEnabled As Boolean
|
Public ReadOnly Property ResetRawPart_IsEnabled As Boolean
|
||||||
Get
|
Get
|
||||||
If IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM) Then
|
If IsNothing(Map.refProjectVM) OrElse IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM) Then
|
||||||
Return False
|
Return False
|
||||||
ElseIf m_SelOPState.Id <> OPStates.End AndAlso m_SelOPState.Id <> OPStates.Unspecified Then
|
ElseIf m_SelOPState.Id <> OPStates.End AndAlso m_SelOPState.Id <> OPStates.Unspecified Then
|
||||||
Return False
|
Return False
|
||||||
@@ -198,7 +242,7 @@ Public Class LeftPanelVM
|
|||||||
|
|
||||||
Public ReadOnly Property DeleteRawPart_IsEnabled As Boolean
|
Public ReadOnly Property DeleteRawPart_IsEnabled As Boolean
|
||||||
Get
|
Get
|
||||||
If IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM) Then
|
If IsNothing(Map.refProjectVM) OrElse IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM) Then
|
||||||
Return False
|
Return False
|
||||||
ElseIf m_SelOPState.Id <> OPStates.End AndAlso m_SelOPState.Id <> OPStates.Unspecified Then
|
ElseIf m_SelOPState.Id <> OPStates.End AndAlso m_SelOPState.Id <> OPStates.Unspecified Then
|
||||||
Return False
|
Return False
|
||||||
@@ -221,7 +265,7 @@ Public Class LeftPanelVM
|
|||||||
|
|
||||||
Public ReadOnly Property OPMode_Visibility As Visibility
|
Public ReadOnly Property OPMode_Visibility As Visibility
|
||||||
Get
|
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 Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
@@ -234,10 +278,63 @@ Public Class LeftPanelVM
|
|||||||
|
|
||||||
Public ReadOnly Property DonePart_Visibility As Visibility
|
Public ReadOnly Property DonePart_Visibility As Visibility
|
||||||
Get
|
Get
|
||||||
|
' per test -> 'Return Visibility.Visible
|
||||||
Return If(Not IsNothing(Map.refSupervisorManagerVM.CurrProd) AndAlso Map.refSupervisorManagerVM.CurrProd.nType = BWType.BEAM, Visibility.Visible, Visibility.Collapsed)
|
Return If(Not IsNothing(Map.refSupervisorManagerVM.CurrProd) AndAlso Map.refSupervisorManagerVM.CurrProd.nType = BWType.BEAM, Visibility.Visible, Visibility.Collapsed)
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
#Region "Messages"
|
||||||
|
|
||||||
|
Public ReadOnly Property Channel_Msg As String
|
||||||
|
Get
|
||||||
|
Return EgtMsg(62501)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Public ReadOnly Property OPMode_Msg As String
|
||||||
|
Get
|
||||||
|
Return EgtMsg(62502)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Public ReadOnly Property ProduceAll_ToolTip As String
|
||||||
|
Get
|
||||||
|
Return EgtMsg(62503)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Public ReadOnly Property DoneRawPart_ToolTip As String
|
||||||
|
Get
|
||||||
|
Return EgtMsg(62504)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Public ReadOnly Property ResetRawPart_ToolTip As String
|
||||||
|
Get
|
||||||
|
Return EgtMsg(62505)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Public ReadOnly Property DeleteRawPart_ToolTip As String
|
||||||
|
Get
|
||||||
|
Return EgtMsg(62506)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Public ReadOnly Property PrintLabel_ToolTip As String
|
||||||
|
Get
|
||||||
|
Return EgtMsg(62507)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Public ReadOnly Property DonePart_ToolTip As String
|
||||||
|
Get
|
||||||
|
Return EgtMsg(62508)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
#End Region ' Messages
|
||||||
|
|
||||||
' Definizione comandi
|
' Definizione comandi
|
||||||
Private m_cmdDeleteRawPart As ICommand
|
Private m_cmdDeleteRawPart As ICommand
|
||||||
Private m_cmdMoveUpRawPart As ICommand
|
Private m_cmdMoveUpRawPart As ICommand
|
||||||
@@ -280,7 +377,7 @@ Public Class LeftPanelVM
|
|||||||
' carico stati della macchina
|
' carico stati della macchina
|
||||||
Select Case NCType
|
Select Case NCType
|
||||||
Case NCTypes.TPA
|
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)
|
m_ChannelList = New List(Of IdNameStruct)
|
||||||
Dim ChannelIndex As Integer = 1
|
Dim ChannelIndex As Integer = 1
|
||||||
Dim ChannelString As String = ""
|
Dim ChannelString As String = ""
|
||||||
@@ -329,7 +426,7 @@ Public Class LeftPanelVM
|
|||||||
New OPState("Pending", OPStates.Pending),
|
New OPState("Pending", OPStates.Pending),
|
||||||
New OPState("Unspecified", OPStates.Unspecified)
|
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 {
|
m_OPStateList = New List(Of OPState) From {
|
||||||
New OPState("Start", OPStates.Start),
|
New OPState("Start", OPStates.Start),
|
||||||
New OPState("Stop", OPStates.Stop),
|
New OPState("Stop", OPStates.Stop),
|
||||||
@@ -349,10 +446,7 @@ Public Class LeftPanelVM
|
|||||||
m_OPModeList = New List(Of OPState) From {
|
m_OPModeList = New List(Of OPState) From {
|
||||||
New OPState("Manual", OPModes.Manual)
|
New OPState("Manual", OPModes.Manual)
|
||||||
}
|
}
|
||||||
' imposto stato manuale
|
Case NCTypes.NUM_FLEXIUM, NCTypes.NUM_AXIUM_APSERVER, NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||||
Dim ManualMode As OPState = m_OPModeList.FirstOrDefault(Function(x) x.Id = OPModes.Manual)
|
|
||||||
SetOPState(ManualMode)
|
|
||||||
Case NCTypes.NUM_FLEXIUM
|
|
||||||
m_OPModeList = New List(Of OPState) From {
|
m_OPModeList = New List(Of OPState) From {
|
||||||
New OPState("Auto", OPModes.Auto),
|
New OPState("Auto", OPModes.Auto),
|
||||||
New OPState("Single", OPModes.Single),
|
New OPState("Single", OPModes.Single),
|
||||||
@@ -363,6 +457,28 @@ Public Class LeftPanelVM
|
|||||||
End Select
|
End Select
|
||||||
End Sub
|
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()
|
Friend Sub UpdateButtonIsEnabledState()
|
||||||
NotifyPropertyChanged(NameOf(MoveRawPart_IsEnabled))
|
NotifyPropertyChanged(NameOf(MoveRawPart_IsEnabled))
|
||||||
NotifyPropertyChanged(NameOf(DoneRawPart_IsEnabled))
|
NotifyPropertyChanged(NameOf(DoneRawPart_IsEnabled))
|
||||||
@@ -392,8 +508,9 @@ Public Class LeftPanelVM
|
|||||||
''' </summary>
|
''' </summary>
|
||||||
Public Sub ProduceAll()
|
Public Sub ProduceAll()
|
||||||
If IsNothing(Map.refSupervisorManagerVM.CurrProd) Then Return
|
If IsNothing(Map.refSupervisorManagerVM.CurrProd) Then Return
|
||||||
If IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Count = 0) Then Return
|
If IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList) OrElse Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Count = 0 Then Return
|
||||||
If Not Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Any(Function(x As MyMachGroupVM) x.nProduction_State <= 1) Then Return
|
If Not Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Any(Function(x As MyMachGroupVM) x.nProduction_State <= ItemState.Confirmed) Then Return
|
||||||
|
If Not Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Any(Function(x As MyMachGroupVM) x.dtStartTime = DateTime.MinValue) Then Return
|
||||||
Dim ToDoList As List(Of MachGroupVM) = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Where(Function(x As MyMachGroupVM) x.nProduction_State <= 1 AndAlso Not x.bResetWhileCutting AndAlso x.dtStartTime = DateTime.MinValue AndAlso Not x.bToBeProduced).ToList()
|
Dim ToDoList As List(Of MachGroupVM) = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Where(Function(x As MyMachGroupVM) x.nProduction_State <= 1 AndAlso Not x.bResetWhileCutting AndAlso x.dtStartTime = DateTime.MinValue AndAlso Not x.bToBeProduced).ToList()
|
||||||
If Not IsNothing(ToDoList) AndAlso ToDoList.Count > 0 Then
|
If Not IsNothing(ToDoList) AndAlso ToDoList.Count > 0 Then
|
||||||
MyMachGroupVM.Produce(ToDoList)
|
MyMachGroupVM.Produce(ToDoList)
|
||||||
@@ -422,14 +539,23 @@ Public Class LeftPanelVM
|
|||||||
Public Sub DoneRawPart()
|
Public Sub DoneRawPart()
|
||||||
If IsNothing(Map.refSupervisorManagerVM.CurrProd) Then Return
|
If IsNothing(Map.refSupervisorManagerVM.CurrProd) Then Return
|
||||||
If IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM.SelectedMachGroup) Then Return
|
If IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM.SelectedMachGroup) Then Return
|
||||||
If (Not IsNothing(Map.refMachManaging) AndAlso Map.refMachManaging.bConnected AndAlso m_SelOPState.Id <> OPStates.End) OrElse
|
|
||||||
Map.refSupervisorMachGroupPanelVM.MachGroupVMList.Any(Function(x As MyMachGroupVM) x.bToBeProduced) Then Return
|
|
||||||
Dim SelMachGroup As MyMachGroupVM = Map.refProjectVM.SupervisorMachGroupPanelVM.SelectedMachGroup
|
Dim SelMachGroup As MyMachGroupVM = Map.refProjectVM.SupervisorMachGroupPanelVM.SelectedMachGroup
|
||||||
|
If (Not IsNothing(Map.refMachManaging) AndAlso Map.refMachManaging.bConnected AndAlso m_SelOPState.Id <> OPStates.End) OrElse
|
||||||
|
Map.refSupervisorMachGroupPanelVM.MachGroupVMList.Any(Function(x As MyMachGroupVM) (x.bToBeProduced AndAlso x.Id <> SelMachGroup.Id) OrElse
|
||||||
|
(x.nProduction_State = ItemState.WIP AndAlso x.Id <> SelMachGroup.Id) OrElse
|
||||||
|
(x.dtStartTime <> DateTime.MinValue AndAlso x.dtEndTime = DateTime.MinValue AndAlso x.Id <> SelMachGroup.Id)) Then Return
|
||||||
' scrivo tutti pezzi completati
|
' scrivo tutti pezzi completati
|
||||||
For PartIndex = 0 To SelMachGroup.PartVMList.Count - 1
|
For PartIndex = 0 To SelMachGroup.PartVMList.Count - 1
|
||||||
Dim Part As PartVM = SelMachGroup.PartVMList(PartIndex)
|
Dim Part As PartVM = SelMachGroup.PartVMList(PartIndex)
|
||||||
SetDonePart(SelMachGroup, Part)
|
SetDonePart(SelMachGroup, Part)
|
||||||
Next
|
Next
|
||||||
|
' riseleziono il gruppo
|
||||||
|
Map.refSupervisorMachGroupPanelVM.SelectedMachGroup = SelMachGroup
|
||||||
|
' aggiorno bottoni
|
||||||
|
NotifyPropertyChanged(NameOf(DeleteRawPart_IsEnabled))
|
||||||
|
NotifyPropertyChanged(NameOf(DoneRawPart_IsEnabled))
|
||||||
|
NotifyPropertyChanged(NameOf(MoveRawPart_IsEnabled))
|
||||||
|
NotifyPropertyChanged(NameOf(ResetRawPart_IsEnabled))
|
||||||
' se avanzamento singolo, sblocco produzione di tutti gli altri
|
' se avanzamento singolo, sblocco produzione di tutti gli altri
|
||||||
If CurrentMachine.Flow = FlowTypes.ONEBYONE Then
|
If CurrentMachine.Flow = FlowTypes.ONEBYONE Then
|
||||||
MyMachGroupVM.UpdateProduceIsEnabledForAll()
|
MyMachGroupVM.UpdateProduceIsEnabledForAll()
|
||||||
@@ -517,32 +643,13 @@ Public Class LeftPanelVM
|
|||||||
DbControllers.m_MachGroupController.UpdateOrder(Map.refSupervisorManagerVM.CurrProd.nProdId, SelMachGroup.Id, SelMachGroup.nProductionIndex)
|
DbControllers.m_MachGroupController.UpdateOrder(Map.refSupervisorManagerVM.CurrProd.nProdId, SelMachGroup.Id, SelMachGroup.nProductionIndex)
|
||||||
Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Move(OldIndex, NewIndex - 1)
|
Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Move(OldIndex, NewIndex - 1)
|
||||||
|
|
||||||
|
' riseleziono il gruppo
|
||||||
|
Map.refSupervisorMachGroupPanelVM.SelectedMachGroup = SelMachGroup
|
||||||
|
' aggiorno bottoni
|
||||||
'' scrivo tutti pezzi completati
|
NotifyPropertyChanged(NameOf(DeleteRawPart_IsEnabled))
|
||||||
'For PartIndex = 0 To SelMachGroup.PartVMList.Count - 1
|
NotifyPropertyChanged(NameOf(DoneRawPart_IsEnabled))
|
||||||
' Dim Part As PartVM = SelMachGroup.PartVMList(PartIndex)
|
NotifyPropertyChanged(NameOf(MoveRawPart_IsEnabled))
|
||||||
' ' reset start, end e stato pezzo
|
NotifyPropertyChanged(NameOf(ResetRawPart_IsEnabled))
|
||||||
' DbControllers.m_PartController.UpdateStart(Map.refSupervisorManagerVM.CurrProd.nProdId, SelMachGroup.Id, Part.nPartId, DateTime.MinValue)
|
|
||||||
' DbControllers.m_PartController.UpdateEnd(Map.refSupervisorManagerVM.CurrProd.nProdId, SelMachGroup.Id, Part.nPartId, DateTime.MinValue)
|
|
||||||
' DbControllers.m_PartController.UpdateStatus(Map.refSupervisorManagerVM.CurrProd.nProdId, SelMachGroup.Id, Part.nPartId, ItemState.ND)
|
|
||||||
' Part.dtStartTime = DateTime.MinValue
|
|
||||||
' Part.dtEndTime = DateTime.MinValue
|
|
||||||
' Part.nProduction_State = ItemState.ND
|
|
||||||
|
|
||||||
' Part.NotifyPropertyChanged(NameOf(Part.Production_Background))
|
|
||||||
'Next
|
|
||||||
'' reset start, end e stato MachGroup
|
|
||||||
'DbControllers.m_MachGroupController.UpdateStart(Map.refSupervisorManagerVM.CurrProd.nProdId, SelMachGroup.Id, Time)
|
|
||||||
'DbControllers.m_MachGroupController.UpdateEnd(Map.refSupervisorManagerVM.CurrProd.nProdId, SelMachGroup.Id, Time)
|
|
||||||
'DbControllers.m_MachGroupController.UpdateStatus(Map.refSupervisorManagerVM.CurrProd.nProdId, SelMachGroup.Id, ItemState.WIP)
|
|
||||||
'SelMachGroup.dtStartTime = DateTime.MinValue
|
|
||||||
'SelMachGroup.dtEndTime = DateTime.MinValue
|
|
||||||
'SelMachGroup.nProduction_State = ItemState.ND
|
|
||||||
'SelMachGroup.NotifyPropertyChanged(NameOf(SelMachGroup.Production_Background))
|
|
||||||
'SelMachGroup.NotifyPropertyChanged(NameOf(SelMachGroup.Produce_IsEnabled))
|
|
||||||
|
|
||||||
' se avanzamento singolo, sblocco produzione di tutti gli altri
|
' se avanzamento singolo, sblocco produzione di tutti gli altri
|
||||||
If CurrentMachine.Flow = FlowTypes.ONEBYONE Then
|
If CurrentMachine.Flow = FlowTypes.ONEBYONE Then
|
||||||
MyMachGroupVM.UpdateProduceIsEnabledForAll()
|
MyMachGroupVM.UpdateProduceIsEnabledForAll()
|
||||||
@@ -553,6 +660,12 @@ Public Class LeftPanelVM
|
|||||||
If IsNothing(MachGroup) OrElse IsNothing(Part) Then Return
|
If IsNothing(MachGroup) OrElse IsNothing(Part) Then Return
|
||||||
' se ora d'inizio non e' gia' fissata
|
' se ora d'inizio non e' gia' fissata
|
||||||
Dim Time As DateTime = DateTime.Now()
|
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
|
If Part.dtStartTime <> DateTime.MinValue Then
|
||||||
DbControllers.m_PartController.UpdateStart(Map.refSupervisorManagerVM.CurrProd.nProdId, MachGroup.Id, Part.nPartId, DateTime.MinValue)
|
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)
|
DbControllers.m_PartController.UpdateEnd(Map.refSupervisorManagerVM.CurrProd.nProdId, MachGroup.Id, Part.nPartId, DateTime.MinValue)
|
||||||
@@ -635,10 +748,15 @@ Public Class LeftPanelVM
|
|||||||
For Each Part In SelMachGroup.PartVMList
|
For Each Part In SelMachGroup.PartVMList
|
||||||
DbControllers.m_PartController.UpdateStatus(Map.refSupervisorManagerVM.CurrProd.nProdId, SelMachGroup.Id, Part.nPartId, ItemState.ND)
|
DbControllers.m_PartController.UpdateStatus(Map.refSupervisorManagerVM.CurrProd.nProdId, SelMachGroup.Id, Part.nPartId, ItemState.ND)
|
||||||
Next
|
Next
|
||||||
|
Dim nRemovedIndex As Integer = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.IndexOf(SelMachGroup)
|
||||||
' se rimozione da Db ok, lo rimuovo da lista
|
' se rimozione da Db ok, lo rimuovo da lista
|
||||||
Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Remove(SelMachGroup)
|
Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Remove(SelMachGroup)
|
||||||
If Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Count = 0 Then
|
If Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Count = 0 Then
|
||||||
|
EgtResetCurrMachGroup()
|
||||||
ManageBTLParts.HideAll()
|
ManageBTLParts.HideAll()
|
||||||
|
Else
|
||||||
|
If nRemovedIndex >= Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Count Then nRemovedIndex = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Count - 1
|
||||||
|
Map.refProjectVM.SupervisorMachGroupPanelVM.SelectedMachGroup = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList(nRemovedIndex)
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
@@ -680,6 +798,7 @@ Public Class LeftPanelVM
|
|||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
SetDonePart(SelMachGroup, SelMachGroup.SelPart)
|
SetDonePart(SelMachGroup, SelMachGroup.SelPart)
|
||||||
|
Map.refProjectVM.SupervisorMachGroupPanelVM.SelectedMachGroup = SelMachGroup
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Sub SetDonePart(MachGroup As MyMachGroupVM, Part As PartVM)
|
Public Sub SetDonePart(MachGroup As MyMachGroupVM, Part As PartVM)
|
||||||
@@ -701,6 +820,14 @@ Public Class LeftPanelVM
|
|||||||
' sposto MachGroup in lista come ultimo dei pronti da produrre
|
' sposto MachGroup in lista come ultimo dei pronti da produrre
|
||||||
Dim OldIndex As Integer = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.IndexOf(MachGroup)
|
Dim OldIndex As Integer = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.IndexOf(MachGroup)
|
||||||
MachGroup.SetProductionIndex(NewIndex + 1)
|
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)
|
DbControllers.m_MachGroupController.UpdateOrder(Map.refSupervisorManagerVM.CurrProd.nProdId, MachGroup.Id, MachGroup.nProductionIndex)
|
||||||
Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Move(OldIndex, NewIndex)
|
Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Move(OldIndex, NewIndex)
|
||||||
End If
|
End If
|
||||||
@@ -727,6 +854,13 @@ Public Class LeftPanelVM
|
|||||||
MachGroup.nProduction_State = ItemState.Produced
|
MachGroup.nProduction_State = ItemState.Produced
|
||||||
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.Production_Background))
|
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.Production_Background))
|
||||||
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.Produce_IsEnabled))
|
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.Produce_IsEnabled))
|
||||||
|
' reset delle variabili di invio alla macchina
|
||||||
|
MachGroup.ResetProduce()
|
||||||
|
' aggiorno bottoni
|
||||||
|
NotifyPropertyChanged(NameOf(DeleteRawPart_IsEnabled))
|
||||||
|
NotifyPropertyChanged(NameOf(DoneRawPart_IsEnabled))
|
||||||
|
NotifyPropertyChanged(NameOf(MoveRawPart_IsEnabled))
|
||||||
|
NotifyPropertyChanged(NameOf(ResetRawPart_IsEnabled))
|
||||||
' se avanzamento singolo, sblocco produzione di tutti gli altri
|
' se avanzamento singolo, sblocco produzione di tutti gli altri
|
||||||
If CurrentMachine.Flow = FlowTypes.ONEBYONE Then
|
If CurrentMachine.Flow = FlowTypes.ONEBYONE Then
|
||||||
MyMachGroupVM.UpdateProduceIsEnabledForAll()
|
MyMachGroupVM.UpdateProduceIsEnabledForAll()
|
||||||
@@ -902,4 +1036,22 @@ Public Class OPState
|
|||||||
m_Id = Id
|
m_Id = Id
|
||||||
End Sub
|
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
|
||||||
|
|||||||
@@ -17,24 +17,28 @@
|
|||||||
SelectionMode="Single"
|
SelectionMode="Single"
|
||||||
ScrollViewer.CanContentScroll="True"
|
ScrollViewer.CanContentScroll="True"
|
||||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||||
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
|
ScrollViewer.HorizontalScrollBarVisibility="Auto"
|
||||||
Margin="0,0,0,5"
|
Margin="0,0,0,5"
|
||||||
BindingColumns="{Binding MDICommandColumns}"
|
BindingColumns="{Binding MDICommandColumns}"
|
||||||
Style="{StaticResource DataGrid_CustomHighLight}">
|
Style="{StaticResource DataGrid_CustomHighLight}">
|
||||||
<DataGrid.Resources>
|
<DataGrid.Resources>
|
||||||
<!-- Command -->
|
<!-- Command -->
|
||||||
<DataGridTextColumn x:Key="colCOMMAND" Binding="{Binding sCommand}">
|
<DataGridTextColumn x:Key="colCOMMAND" Binding="{Binding sCommand}">
|
||||||
<DataGridTextColumn.Header>
|
<DataGridTextColumn.HeaderTemplate>
|
||||||
<TextBlock Text="{Binding Path=DataContext.Command_Msg,
|
<DataTemplate>
|
||||||
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:MDIPageV}}}"/>
|
<TextBlock Text="{Binding Path=DataContext.Command_Msg,
|
||||||
</DataGridTextColumn.Header>
|
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:MDIPageV}}}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTextColumn.HeaderTemplate>
|
||||||
</DataGridTextColumn>
|
</DataGridTextColumn>
|
||||||
<!-- Descrizione -->
|
<!-- Descrizione -->
|
||||||
<DataGridTextColumn x:Key="colDESCRIPTION" Binding="{Binding sDescription}">
|
<DataGridTextColumn x:Key="colDESCRIPTION" Binding="{Binding sDescription}">
|
||||||
<DataGridTextColumn.Header>
|
<DataGridTextColumn.HeaderTemplate>
|
||||||
|
<DataTemplate>
|
||||||
<TextBlock Text="{Binding Path=DataContext.Description_Msg,
|
<TextBlock Text="{Binding Path=DataContext.Description_Msg,
|
||||||
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:MDIPageV}}}"/>
|
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:MDIPageV}}}"/>
|
||||||
</DataGridTextColumn.Header>
|
</DataTemplate>
|
||||||
|
</DataGridTextColumn.HeaderTemplate>
|
||||||
</DataGridTextColumn>
|
</DataGridTextColumn>
|
||||||
</DataGrid.Resources>
|
</DataGrid.Resources>
|
||||||
|
|
||||||
@@ -48,6 +52,7 @@
|
|||||||
<TextBox Text="{Binding sMDICommand_Text, UpdateSourceTrigger=PropertyChanged}"
|
<TextBox Text="{Binding sMDICommand_Text, UpdateSourceTrigger=PropertyChanged}"
|
||||||
Background="{Binding MDIText_Background}"
|
Background="{Binding MDIText_Background}"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
|
CharacterCasing="Upper"
|
||||||
Margin="5,0,2.5,0"/>
|
Margin="5,0,2.5,0"/>
|
||||||
<Button Grid.Column="1"
|
<Button Grid.Column="1"
|
||||||
Command="{Binding SendMDI_Command}"
|
Command="{Binding SendMDI_Command}"
|
||||||
@@ -57,5 +62,5 @@
|
|||||||
</Button>
|
</Button>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -78,13 +78,13 @@ Public Class MDIPageVM
|
|||||||
|
|
||||||
Public ReadOnly Property Command_Msg As String
|
Public ReadOnly Property Command_Msg As String
|
||||||
Get
|
Get
|
||||||
Return "Command"
|
Return EgtMsg(62510)
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
Public ReadOnly Property Description_Msg As String
|
Public ReadOnly Property Description_Msg As String
|
||||||
Get
|
Get
|
||||||
Return "Description"
|
Return EgtMsg(62511)
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ Public Class MDIPageVM
|
|||||||
If MDICommand.Length() >= 2 Then
|
If MDICommand.Length() >= 2 Then
|
||||||
Dim nDescription As Integer
|
Dim nDescription As Integer
|
||||||
If Integer.TryParse(MDICommand(1), nDescription) Then
|
If Integer.TryParse(MDICommand(1), nDescription) Then
|
||||||
MDICommand(1) = EgtMsg(nDescription)
|
MDICommand(1) = MachMsg(MsgParagraphs.MDI, nDescription)
|
||||||
End If
|
End If
|
||||||
MDICommandList.Add(New MDICommand(MDICommand(0), MDICommand(1)))
|
MDICommandList.Add(New MDICommand(MDICommand(0), MDICommand(1)))
|
||||||
End If
|
End If
|
||||||
|
|||||||
@@ -11,9 +11,6 @@
|
|||||||
Background="{Binding Message_Foreground}"/>
|
Background="{Binding Message_Foreground}"/>
|
||||||
<TextBlock Text="{Binding sErrSystem}"
|
<TextBlock Text="{Binding sErrSystem}"
|
||||||
Background="{Binding ErrSystem_Foreground}"/>
|
Background="{Binding ErrSystem_Foreground}"/>
|
||||||
<Button Content="CANCELLA ALLARMI"
|
|
||||||
Command="{Binding DeleteAlarms_Command}"
|
|
||||||
Visibility="Collapsed"/>
|
|
||||||
<WrapPanel Orientation="Horizontal" Width="{Binding ActualWidth, ElementName=TOPTRAY}">
|
<WrapPanel Orientation="Horizontal" Width="{Binding ActualWidth, ElementName=TOPTRAY}">
|
||||||
<Button Content="CONNECT"
|
<Button Content="CONNECT"
|
||||||
Command="{Binding Connect_Command}"
|
Command="{Binding Connect_Command}"
|
||||||
@@ -21,23 +18,28 @@
|
|||||||
Style="{StaticResource ToolBar_TextButton}"/>
|
Style="{StaticResource ToolBar_TextButton}"/>
|
||||||
<Button Content="START"
|
<Button Content="START"
|
||||||
Command="{Binding Start_Command}"
|
Command="{Binding Start_Command}"
|
||||||
Style="{StaticResource ToolBar_TextButton}"/>
|
Style="{StaticResource ToolBar_TextButton}"
|
||||||
|
IsEnabled="{Binding CommBtn_IsEnabled}"/>
|
||||||
<Button Content="STOP"
|
<Button Content="STOP"
|
||||||
Command="{Binding Stop_Command}"
|
Command="{Binding Stop_Command}"
|
||||||
Style="{StaticResource ToolBar_TextButton}"/>
|
Style="{StaticResource ToolBar_TextButton}"
|
||||||
|
IsEnabled="{Binding CommBtn_IsEnabled}"/>
|
||||||
<Button Content="RESET"
|
<Button Content="RESET"
|
||||||
Command="{Binding Reset_Command}"
|
Command="{Binding Reset_Command}"
|
||||||
Style="{StaticResource ToolBar_TextButton}"/>
|
Style="{StaticResource ToolBar_TextButton}"
|
||||||
<Button Content="STEP"
|
IsEnabled="{Binding CommBtn_IsEnabled}"/>
|
||||||
|
<!--<Button Content="STEP"
|
||||||
Command="{Binding Step_Command}"
|
Command="{Binding Step_Command}"
|
||||||
Style="{StaticResource ToolBar_TextButton}"/>
|
Style="{StaticResource ToolBar_TextButton}"/>-->
|
||||||
<Button Content="SET POINT"
|
<Button Content="SET POINT"
|
||||||
Command="{Binding SetPoint_Command}"
|
Command="{Binding SetPoint_Command}"
|
||||||
Style="{StaticResource ToolBar_TextButton}"/>
|
Style="{StaticResource ToolBar_TextButton}"
|
||||||
|
IsEnabled="{Binding CommBtn_IsEnabled}"/>
|
||||||
<Button Content="DELETE ALARMS"
|
<Button Content="DELETE ALARMS"
|
||||||
Command="{Binding DeleteAlarms_Command}"
|
Command="{Binding DeleteAlarms_Command}"
|
||||||
Visibility="{Binding DeleteAlarm_Visibility}"
|
Visibility="{Binding DeleteAlarm_Visibility}"
|
||||||
Style="{StaticResource ToolBar_TextButton}"/>
|
Style="{StaticResource ToolBar_TextButton}"
|
||||||
|
IsEnabled="{Binding CommBtn_IsEnabled}"/>
|
||||||
</WrapPanel>
|
</WrapPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ Imports System.Windows.Threading
|
|||||||
Imports EgtBEAMWALL.Core.ConstMachComm
|
Imports EgtBEAMWALL.Core.ConstMachComm
|
||||||
Imports EgtBEAMWALL.Core
|
Imports EgtBEAMWALL.Core
|
||||||
Imports EgtWPFLib5
|
Imports EgtWPFLib5
|
||||||
|
Imports EgtUILib
|
||||||
|
|
||||||
Public Class MachCommandMessagePanelVM
|
Public Class MachCommandMessagePanelVM
|
||||||
Inherits VMBase
|
Inherits VMBase
|
||||||
@@ -141,6 +142,8 @@ Public Class MachCommandMessagePanelVM
|
|||||||
' End Get
|
' End Get
|
||||||
'End Property
|
'End Property
|
||||||
|
|
||||||
|
Friend bMsgTranslationActive As Boolean = False
|
||||||
|
|
||||||
Private m_ErrCycle As New List(Of Alarm)
|
Private m_ErrCycle As New List(Of Alarm)
|
||||||
Private m_ErrCycleCount As Integer = 0
|
Private m_ErrCycleCount As Integer = 0
|
||||||
Public ReadOnly Property sErrCycle As String
|
Public ReadOnly Property sErrCycle As String
|
||||||
@@ -150,7 +153,7 @@ Public Class MachCommandMessagePanelVM
|
|||||||
Select Case CurrentMachine.NCType
|
Select Case CurrentMachine.NCType
|
||||||
Case NCTypes.TPA
|
Case NCTypes.TPA
|
||||||
Return If(Not IsNothing(ShownErr), ShownErr.sCode & ": " & ShownErr.sMessage, "")
|
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, "")
|
Return If(Not IsNothing(ShownErr), ShownErr.sMessage, "")
|
||||||
Case Else
|
Case Else
|
||||||
Return ""
|
Return ""
|
||||||
@@ -172,7 +175,7 @@ Public Class MachCommandMessagePanelVM
|
|||||||
Select Case CurrentMachine.NCType
|
Select Case CurrentMachine.NCType
|
||||||
Case NCTypes.TPA
|
Case NCTypes.TPA
|
||||||
Return If(Not IsNothing(ShownErr), ShownErr.sCode & ": " & ShownErr.sMessage, "")
|
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, "")
|
Return If(Not IsNothing(ShownErr), ShownErr.sMessage, "")
|
||||||
Case Else
|
Case Else
|
||||||
Return ""
|
Return ""
|
||||||
@@ -194,7 +197,7 @@ Public Class MachCommandMessagePanelVM
|
|||||||
Select Case CurrentMachine.NCType
|
Select Case CurrentMachine.NCType
|
||||||
Case NCTypes.TPA
|
Case NCTypes.TPA
|
||||||
Return If(Not IsNothing(ShownErr), ShownErr.sCode & ": " & ShownErr.sMessage, "")
|
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, "")
|
Return If(Not IsNothing(ShownErr), ShownErr.sMessage, "")
|
||||||
Case Else
|
Case Else
|
||||||
Return ""
|
Return ""
|
||||||
@@ -216,7 +219,7 @@ Public Class MachCommandMessagePanelVM
|
|||||||
Select Case CurrentMachine.NCType
|
Select Case CurrentMachine.NCType
|
||||||
Case NCTypes.TPA
|
Case NCTypes.TPA
|
||||||
Return If(Not IsNothing(ShownErr), ShownErr.sCode & ": " & ShownErr.sMessage, "")
|
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, "")
|
Return If(Not IsNothing(ShownErr), ShownErr.sMessage, "")
|
||||||
Case Else
|
Case Else
|
||||||
Return ""
|
Return ""
|
||||||
@@ -234,6 +237,18 @@ Public Class MachCommandMessagePanelVM
|
|||||||
Return If(CurrentMachine.NCType = NCTypes.TPA, Visibility.Visible, Visibility.Collapsed)
|
Return If(CurrentMachine.NCType = NCTypes.TPA, Visibility.Visible, Visibility.Collapsed)
|
||||||
End Get
|
End Get
|
||||||
End Property
|
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
|
' definizione comandi
|
||||||
Private m_cmdConnect As ICommand
|
Private m_cmdConnect As ICommand
|
||||||
Private m_cmdDisconnect As ICommand
|
Private m_cmdDisconnect As ICommand
|
||||||
@@ -518,7 +533,13 @@ Public Class MachCommandMessagePanelVM
|
|||||||
_Connected = True
|
_Connected = True
|
||||||
NotifyPropertyChanged(NameOf(Connect_Background))
|
NotifyPropertyChanged(NameOf(Connect_Background))
|
||||||
If ResultType = ResultTypes.EXECUTED Then
|
If ResultType = ResultTypes.EXECUTED Then
|
||||||
|
' avvio tick di comunicazione con la macchina
|
||||||
|
MachineCommThread.StartTick()
|
||||||
|
' inizializzo variabili
|
||||||
Init()
|
Init()
|
||||||
|
If CurrentMachine.NCType = NCTypes.NUM_AXIUM_APSERVER Then
|
||||||
|
Map.refMachManaging.Num_Axium_APServer.GetGeneralFunctions()
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
Case CommandTypes.DISCONNECT
|
Case CommandTypes.DISCONNECT
|
||||||
@@ -546,9 +567,9 @@ Public Class MachCommandMessagePanelVM
|
|||||||
Select Case AlarmType
|
Select Case AlarmType
|
||||||
Case CInt(ISOCNC.Remoting.AlarmType.Cycle)
|
Case CInt(ISOCNC.Remoting.AlarmType.Cycle)
|
||||||
If AlarmOperation = CInt(ISOCNC.Remoting.AlarmOperation.Addition) Then
|
If AlarmOperation = CInt(ISOCNC.Remoting.AlarmOperation.Addition) Then
|
||||||
m_ErrCycle.Add(Alarm.CreateAlarm(AlarmCode, AlarmMessage))
|
m_Iso.Add(Alarm.CreateAlarm(AlarmCode, AlarmMessage))
|
||||||
Else
|
Else
|
||||||
m_ErrCycle.RemoveAll(Function(x) x.sCode = AlarmCode)
|
m_Iso.RemoveAll(Function(x) x.sCode = AlarmCode)
|
||||||
'Dim ToRemove As Alarm = m_ErrCycle.FirstOrDefault(Function(x) x.sCode = AlarmCode)
|
'Dim ToRemove As Alarm = m_ErrCycle.FirstOrDefault(Function(x) x.sCode = AlarmCode)
|
||||||
'If Not IsNothing(ToRemove) Then
|
'If Not IsNothing(ToRemove) Then
|
||||||
' m_ErrCycle.Remove(ToRemove)
|
' m_ErrCycle.Remove(ToRemove)
|
||||||
@@ -556,9 +577,9 @@ Public Class MachCommandMessagePanelVM
|
|||||||
End If
|
End If
|
||||||
Case CInt(ISOCNC.Remoting.AlarmType.ISO)
|
Case CInt(ISOCNC.Remoting.AlarmType.ISO)
|
||||||
If AlarmOperation = CInt(ISOCNC.Remoting.AlarmOperation.Addition) Then
|
If AlarmOperation = CInt(ISOCNC.Remoting.AlarmOperation.Addition) Then
|
||||||
m_Iso.Add(Alarm.CreateAlarm(AlarmCode, AlarmMessage))
|
m_ErrSystem.Add(Alarm.CreateAlarm(AlarmCode, AlarmMessage))
|
||||||
Else
|
Else
|
||||||
m_Iso.RemoveAll(Function(x) x.sCode = AlarmCode)
|
m_ErrSystem.RemoveAll(Function(x) x.sCode = AlarmCode)
|
||||||
'Dim ToRemove As Alarm = m_Iso.FirstOrDefault(Function(x) x.sCode = AlarmCode)
|
'Dim ToRemove As Alarm = m_Iso.FirstOrDefault(Function(x) x.sCode = AlarmCode)
|
||||||
'If Not IsNothing(ToRemove) Then
|
'If Not IsNothing(ToRemove) Then
|
||||||
' m_Iso.Remove(ToRemove)
|
' m_Iso.Remove(ToRemove)
|
||||||
@@ -577,9 +598,9 @@ Public Class MachCommandMessagePanelVM
|
|||||||
Case CInt(ISOCNC.Remoting.AlarmType.None)
|
Case CInt(ISOCNC.Remoting.AlarmType.None)
|
||||||
Case CInt(ISOCNC.Remoting.AlarmType.System)
|
Case CInt(ISOCNC.Remoting.AlarmType.System)
|
||||||
If AlarmOperation = CInt(ISOCNC.Remoting.AlarmOperation.Addition) Then
|
If AlarmOperation = CInt(ISOCNC.Remoting.AlarmOperation.Addition) Then
|
||||||
m_ErrSystem.Add(Alarm.CreateAlarm(AlarmCode, AlarmMessage))
|
m_ErrCycle.Add(Alarm.CreateAlarm(AlarmCode, AlarmMessage))
|
||||||
Else
|
Else
|
||||||
m_ErrSystem.RemoveAll(Function(x) x.sCode = AlarmCode)
|
m_ErrCycle.RemoveAll(Function(x) x.sCode = AlarmCode)
|
||||||
'Dim ToRemove As Alarm = m_ErrSystem.FirstOrDefault(Function(x) x.sCode = AlarmCode)
|
'Dim ToRemove As Alarm = m_ErrSystem.FirstOrDefault(Function(x) x.sCode = AlarmCode)
|
||||||
'If Not IsNothing(ToRemove) Then
|
'If Not IsNothing(ToRemove) Then
|
||||||
' m_ErrSystem.Remove(ToRemove)
|
' m_ErrSystem.Remove(ToRemove)
|
||||||
@@ -665,14 +686,26 @@ Public Class MachCommandMessagePanelVM
|
|||||||
NUM_ErrorTypes.PLC_Message_Reaction_Class_6,
|
NUM_ErrorTypes.PLC_Message_Reaction_Class_6,
|
||||||
NUM_ErrorTypes.PLC_Message_Reaction_Class_7,
|
NUM_ErrorTypes.PLC_Message_Reaction_Class_7,
|
||||||
NUM_ErrorTypes.PLC_Message_Reaction_Class_8
|
NUM_ErrorTypes.PLC_Message_Reaction_Class_8
|
||||||
|
Dim sErrorMessage As String = ErrorMessage
|
||||||
|
If bMsgTranslationActive Then
|
||||||
|
Dim sTranslatedMsg = MachMsg(MsgParagraphs.PLC, nErrorNumber)
|
||||||
|
If Not String.IsNullOrWhiteSpace(sTranslatedMsg) Then
|
||||||
|
sErrorMessage = sTranslatedMsg
|
||||||
|
End If
|
||||||
|
End If
|
||||||
ErrorNumberMsg = "PLC"
|
ErrorNumberMsg = "PLC"
|
||||||
ErrorTypMsg = "Classe"
|
ErrorTypMsg = "Classe"
|
||||||
AlarmMessage = If(nErrorIndex <> 0, ErrorIndexMsg & ": " & nErrorIndex & " - ", "") &
|
If CurrentMachine.NCType = NCTypes.NUM_AXIUM_PCTOOLKIT OrElse CurrentMachine.NCType = NCTypes.NUM_AXIUM_APSERVER Then
|
||||||
If(nErrorNumber <> 0, ErrorNumberMsg & ": " & nErrorNumber & " - ", "") &
|
AlarmMessage = If(nErrorNumber <> 0, ErrorNumberMsg & ": " & nErrorNumber & " - ", "") &
|
||||||
If(nErrorExtNumber <> 0, " - " & ErrorExtNumberMsg & ": " & nErrorExtNumber, "") &
|
sErrorMessage
|
||||||
ErrorTypMsg & ": " & nErrorTyp - 5 &
|
Else
|
||||||
If(nErrorLine <> 0, " - " & ErrorLineMsg & ": " & nErrorLine, "") &
|
AlarmMessage = If(nErrorIndex <> 0, ErrorIndexMsg & ": " & nErrorIndex & " - ", "") &
|
||||||
" " & ErrorMessage & If(nErrorAdditional <> 0, " - " & ErrorAdditionalMsg & ": " & nErrorAdditional, "")
|
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.HMI_Message
|
||||||
Case NUM_ErrorTypes.RTS_Message
|
Case NUM_ErrorTypes.RTS_Message
|
||||||
Case NUM_ErrorTypes.Drive_Warning
|
Case NUM_ErrorTypes.Drive_Warning
|
||||||
@@ -739,7 +772,7 @@ Public Class MachCommandMessagePanelVM
|
|||||||
Select Case CurrentMachine.NCType
|
Select Case CurrentMachine.NCType
|
||||||
Case NCTypes.TPA
|
Case NCTypes.TPA
|
||||||
m_ErrSystem.RemoveAll(Function(x) x.sCode = AlarmCode)
|
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)
|
m_ErrSystem.RemoveAll(Function(x) x.sMessage = AlarmMessage)
|
||||||
End Select
|
End Select
|
||||||
End If
|
End If
|
||||||
@@ -772,7 +805,7 @@ Public Class MachCommandMessagePanelVM
|
|||||||
Next
|
Next
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
Case NCTypes.NUM_FLEXIUM
|
Case NCTypes.NUM_FLEXIUM, NCTypes.NUM_AXIUM_APSERVER, NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||||
Map.refLeftPanelVM.SetOPState(NewState)
|
Map.refLeftPanelVM.SetOPState(NewState)
|
||||||
End Select
|
End Select
|
||||||
DbControllers.m_LogMachineController.Create(MachLog.CreateOPStateLog(newOpState))
|
DbControllers.m_LogMachineController.Create(MachLog.CreateOPStateLog(newOpState))
|
||||||
@@ -780,8 +813,12 @@ Public Class MachCommandMessagePanelVM
|
|||||||
|
|
||||||
Friend Sub OpModeCallbackDlg(newOpState As Integer)
|
Friend Sub OpModeCallbackDlg(newOpState As Integer)
|
||||||
Dim NewState As OPState = Map.refLeftPanelVM.OPModeList.FirstOrDefault(Function(x) x.Id = newOpState)
|
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
|
Select Case CurrentMachine.NCType
|
||||||
Case NCTypes.NUM_FLEXIUM
|
Case NCTypes.NUM_FLEXIUM, NCTypes.NUM_AXIUM_APSERVER, NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||||
Map.refLeftPanelVM.SetOPMode(NewState)
|
Map.refLeftPanelVM.SetOPMode(NewState)
|
||||||
End Select
|
End Select
|
||||||
DbControllers.m_LogMachineController.Create(MachLog.CreateOPStateLog(newOpState))
|
DbControllers.m_LogMachineController.Create(MachLog.CreateOPStateLog(newOpState))
|
||||||
@@ -790,7 +827,7 @@ Public Class MachCommandMessagePanelVM
|
|||||||
Friend Sub ChannelCallbackDlg(NewChannelId As Short)
|
Friend Sub ChannelCallbackDlg(NewChannelId As Short)
|
||||||
Dim NewChannel As IdNameStruct = Map.refLeftPanelVM.ChannelList.FirstOrDefault(Function(x) x.Id = NewChannelId)
|
Dim NewChannel As IdNameStruct = Map.refLeftPanelVM.ChannelList.FirstOrDefault(Function(x) x.Id = NewChannelId)
|
||||||
Select Case CurrentMachine.NCType
|
Select Case CurrentMachine.NCType
|
||||||
Case NCTypes.NUM_FLEXIUM
|
Case NCTypes.NUM_FLEXIUM, NCTypes.NUM_AXIUM_APSERVER, NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||||
Map.refLeftPanelVM.SetChannel(NewChannel)
|
Map.refLeftPanelVM.SetChannel(NewChannel)
|
||||||
End Select
|
End Select
|
||||||
'DbControllers.m_LogMachineController.Create(MachLog.CreateOPStateLog(NewChannelId))
|
'DbControllers.m_LogMachineController.Create(MachLog.CreateOPStateLog(NewChannelId))
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ Public Class MyMachGroupPanelVM
|
|||||||
' Imposto vista solo tavola
|
' Imposto vista solo tavola
|
||||||
EgtSetMachineLook(MCH_LOOK.TAB)
|
EgtSetMachineLook(MCH_LOOK.TAB)
|
||||||
Map.refFeatureInPartInRawPartListVM.SetFeatureListVisibility(SelMachGroup.bResetWhileCutting)
|
Map.refFeatureInPartInRawPartListVM.SetFeatureListVisibility(SelMachGroup.bResetWhileCutting)
|
||||||
Core.ViewPanelVM.BWSetView(VT.TOP, False)
|
Core.ViewPanelVM.BWSetView(If(Core.ViewPanelVM.Type = BWType.BEAM, VT.ISO_SW, VT.TOP), False)
|
||||||
EgtZoom(ZM.ALL)
|
EgtZoom(ZM.ALL)
|
||||||
Return True
|
Return True
|
||||||
End Function
|
End Function
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ Public Class MyMachGroupVM
|
|||||||
' se c'e', attivo solo il pezzo non finito
|
' se c'e', attivo solo il pezzo non finito
|
||||||
Return Not (Not IsNothing(ToBeRestartedPart) AndAlso Not ToBeRestartedPart Is Me)
|
Return Not (Not IsNothing(ToBeRestartedPart) AndAlso Not ToBeRestartedPart Is Me)
|
||||||
Else
|
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
|
Select Case nProduction_State
|
||||||
Case ItemState.Assigned, ItemState.Confirmed, ItemState.WIP
|
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)
|
Return Not m_bToBeProduced AndAlso Not m_bSentToMachine AndAlso Not Map.refSupervisorMachGroupPanelVM.MachGroupVMList.Any(Function(x As MyMachGroupVM) x.bToBeProduced)
|
||||||
@@ -106,6 +106,7 @@ Public Class MyMachGroupVM
|
|||||||
CurrMachGroup.NotifyPropertyChanged(NameOf(CurrMachGroup.Produce_IsEnabled))
|
CurrMachGroup.NotifyPropertyChanged(NameOf(CurrMachGroup.Produce_IsEnabled))
|
||||||
Next
|
Next
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
#End Region ' Machgroup
|
#End Region ' Machgroup
|
||||||
|
|
||||||
#Region "Parts"
|
#Region "Parts"
|
||||||
@@ -123,7 +124,19 @@ Public Class MyMachGroupVM
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Overrides Sub RefreshPartList()
|
Public Overrides Sub RefreshPartList()
|
||||||
|
If nType = BWType.BEAM Then
|
||||||
|
' leggo StartCut da posizione primo pezzo
|
||||||
|
Dim sInfo As String = ""
|
||||||
|
Dim sSplitInfo() As String
|
||||||
|
Dim bFound As Boolean = False
|
||||||
|
EgtGetInfo(Id, MGR_RPT_PART & 1, sInfo)
|
||||||
|
If Not String.IsNullOrWhiteSpace(sInfo) Then
|
||||||
|
sSplitInfo = sInfo.Split(","c)
|
||||||
|
StringToDouble(sSplitInfo(1), MyMachGroupM.dStartCut)
|
||||||
|
Else
|
||||||
|
MyMachGroupM.dStartCut = 0
|
||||||
|
End If
|
||||||
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
#End Region ' Parts
|
#End Region ' Parts
|
||||||
@@ -133,8 +146,13 @@ Public Class MyMachGroupVM
|
|||||||
Public Overrides Sub CALCEnd()
|
Public Overrides Sub CALCEnd()
|
||||||
' aggiorno stato per lancio in macchina
|
' aggiorno stato per lancio in macchina
|
||||||
If MyMachGroupM.m_nCALC_GlobalState = Core.CalcStates.OK OrElse MyMachGroupM.m_nCALC_GlobalState = Core.CalcStates.INFO Then
|
If MyMachGroupM.m_nCALC_GlobalState = Core.CalcStates.OK OrElse MyMachGroupM.m_nCALC_GlobalState = Core.CalcStates.INFO Then
|
||||||
m_bCNReCalculated = True
|
If m_bToBeProduced AndAlso Not m_bCNReCalculated Then
|
||||||
NotifyPropertyChanged(NameOf(Production_Background))
|
m_bCNReCalculated = True
|
||||||
|
NotifyPropertyChanged(NameOf(Production_Background))
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
ResetProduce()
|
||||||
|
UpdateProduceIsEnabledForAll()
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@@ -150,6 +168,8 @@ Public Class MyMachGroupVM
|
|||||||
Public Overrides Sub ProduceMachGroup()
|
Public Overrides Sub ProduceMachGroup()
|
||||||
' se gia' in produzione, non devo fare nulla
|
' se gia' in produzione, non devo fare nulla
|
||||||
If m_bToBeProduced Then Return
|
If m_bToBeProduced Then Return
|
||||||
|
' disabilito bottoni di comunicazione durante invio programma
|
||||||
|
Map.refMachCommandMessagePanelVM.SetCommBtnIsEnabled(False)
|
||||||
' macchina bloccata con reset PER TEST!!!!
|
' macchina bloccata con reset PER TEST!!!!
|
||||||
'SetResetWhileCutting(True)
|
'SetResetWhileCutting(True)
|
||||||
' se ripartenza
|
' se ripartenza
|
||||||
@@ -163,6 +183,8 @@ Public Class MyMachGroupVM
|
|||||||
Dim WaitingWnd As New WaitingWndV(Application.Current.MainWindow, New WaitingWndVM)
|
Dim WaitingWnd As New WaitingWndV(Application.Current.MainWindow, New WaitingWndVM)
|
||||||
Dim WaitingResult As Boolean = WaitingWnd.ShowDialog()
|
Dim WaitingResult As Boolean = WaitingWnd.ShowDialog()
|
||||||
If Not WaitingResult Then
|
If Not WaitingResult Then
|
||||||
|
' riabilito bottoni di comunicazione a fine invio programma
|
||||||
|
Map.refMachCommandMessagePanelVM.SetCommBtnIsEnabled(True)
|
||||||
Return
|
Return
|
||||||
End If
|
End If
|
||||||
' ricarico progetto corrente
|
' ricarico progetto corrente
|
||||||
@@ -170,6 +192,10 @@ Public Class MyMachGroupVM
|
|||||||
End If
|
End If
|
||||||
' creo nuova barra
|
' creo nuova barra
|
||||||
Dim RedoMachGroupVM As MyMachGroupVM = RedoRawPart()
|
Dim RedoMachGroupVM As MyMachGroupVM = RedoRawPart()
|
||||||
|
If IsNothing(RedoMachGroupVM) Then
|
||||||
|
MessageBox.Show("New RawPart creation failed!")
|
||||||
|
Return
|
||||||
|
End If
|
||||||
' salvo progetto con nuova barra
|
' salvo progetto con nuova barra
|
||||||
Map.refSceneHostVM.SaveProject()
|
Map.refSceneHostVM.SaveProject()
|
||||||
Dim MyMachGroupList As New List(Of MyMachGroupM)
|
Dim MyMachGroupList As New List(Of MyMachGroupM)
|
||||||
@@ -191,23 +217,34 @@ Public Class MyMachGroupVM
|
|||||||
End If
|
End If
|
||||||
' riabilito produzione di tutti gli altri
|
' riabilito produzione di tutti gli altri
|
||||||
MyMachGroupVM.UpdateProduceIsEnabledForAll()
|
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
|
Return
|
||||||
End If
|
End If
|
||||||
' se progetto travi e lavorazione interrotta da reset
|
' 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
|
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
|
' 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
|
Select Case bRedo
|
||||||
Case MessageBoxResult.Yes
|
Case MessageBoxResult.Yes
|
||||||
' segno da rifare pezzi non completamente lavorati
|
' segno da rifare pezzi non completamente lavorati
|
||||||
For Each Part As PartVM In PartVMList
|
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))
|
'Part.NotifyPropertyChanged(NameOf(Part.bRedo))
|
||||||
Next
|
Next
|
||||||
' se ripresa, mostro lista feature e colonne Redo
|
' se ripresa, mostro lista feature e colonne Redo
|
||||||
Map.refLeftPanelVM.bRestart = True
|
Map.refLeftPanelVM.bRestart = True
|
||||||
' blocco produzione di tutti gli altri
|
' blocco produzione di tutti gli altri
|
||||||
MyMachGroupVM.UpdateProduceIsEnabledForAll()
|
MyMachGroupVM.UpdateProduceIsEnabledForAll()
|
||||||
|
' riabilito bottoni di comunicazione a fine invio programma
|
||||||
|
Map.refMachCommandMessagePanelVM.SetCommBtnIsEnabled(True)
|
||||||
Return
|
Return
|
||||||
Case MessageBoxResult.No
|
Case MessageBoxResult.No
|
||||||
' annullo stati dei pezzi gia' fatti
|
' annullo stati dei pezzi gia' fatti
|
||||||
@@ -263,6 +300,7 @@ Public Class MyMachGroupVM
|
|||||||
|
|
||||||
' lancio produzione pezzo
|
' lancio produzione pezzo
|
||||||
Produce(New List(Of MachGroupVM)({Me}))
|
Produce(New List(Of MachGroupVM)({Me}))
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Friend Shared Sub Produce(MachGroupList As List(Of MachGroupVM))
|
Friend Shared Sub Produce(MachGroupList As List(Of MachGroupVM))
|
||||||
@@ -271,6 +309,11 @@ Public Class MyMachGroupVM
|
|||||||
For Each MachGroup As MyMachGroupVM In MachGroupList
|
For Each MachGroup As MyMachGroupVM In MachGroupList
|
||||||
' cerco primo indice di pezzo non in produzione
|
' cerco primo indice di pezzo non in produzione
|
||||||
Dim NewIndex As Integer = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.IndexOf(Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.FirstOrDefault(Function(x) DirectCast(x, MyMachGroupVM).dtStartTime = DateTime.MinValue AndAlso DirectCast(x, MyMachGroupVM).bToBeProduced = False))
|
Dim NewIndex As Integer = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.IndexOf(Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.FirstOrDefault(Function(x) DirectCast(x, MyMachGroupVM).dtStartTime = DateTime.MinValue AndAlso DirectCast(x, MyMachGroupVM).bToBeProduced = False))
|
||||||
|
' se pezzo da produrre gia' iniziato
|
||||||
|
If MachGroup.dtStartTime <> DateTime.MinValue Then
|
||||||
|
' decremento indice di 1
|
||||||
|
NewIndex -= 1
|
||||||
|
End If
|
||||||
' segno pezzo da produrre
|
' segno pezzo da produrre
|
||||||
MachGroup.m_bToBeProduced = True
|
MachGroup.m_bToBeProduced = True
|
||||||
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.Production_Background))
|
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.Production_Background))
|
||||||
@@ -302,6 +345,8 @@ Public Class MyMachGroupVM
|
|||||||
|
|
||||||
Public Function RedoRawPart() As MyMachGroupVM
|
Public Function RedoRawPart() As MyMachGroupVM
|
||||||
If IsNothing(Map.refSupervisorManagerVM.CurrProd) Then Return Nothing
|
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
|
' creo nuovo gruppo di lavorazione
|
||||||
Map.refProjectVM.ProdMachGroupPanelVM.AddMachGroup()
|
Map.refProjectVM.ProdMachGroupPanelVM.AddMachGroup()
|
||||||
Dim nCurrMachGroup As Integer = EgtGetCurrMachGroup()
|
Dim nCurrMachGroup As Integer = EgtGetCurrMachGroup()
|
||||||
@@ -330,6 +375,12 @@ Public Class MyMachGroupVM
|
|||||||
For Index = 0 To m_PartVMList.Count - 1
|
For Index = 0 To m_PartVMList.Count - 1
|
||||||
Dim CurrPart As PartVM = m_PartVMList(Index)
|
Dim CurrPart As PartVM = m_PartVMList(Index)
|
||||||
If CurrPart.bDO Then
|
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
|
nDone += 1
|
||||||
' creo copia del pezzo
|
' creo copia del pezzo
|
||||||
Dim nPartDuploId As Integer = EgtDuploNew(PartList(Index).nPartId)
|
Dim nPartDuploId As Integer = EgtDuploNew(PartList(Index).nPartId)
|
||||||
@@ -345,7 +396,7 @@ Public Class MyMachGroupVM
|
|||||||
EgtBeamEnableProcess(Feature.nFeatureId, bOk)
|
EgtBeamEnableProcess(Feature.nFeatureId, bOk)
|
||||||
Next
|
Next
|
||||||
' scrivo dati costruzione grezzo in gruppo di lavorazione
|
' scrivo dati costruzione grezzo in gruppo di lavorazione
|
||||||
EgtSetInfo(nCurrMachGroup, MGR_RPT_PART & nDone, nPartDuploId & "," & CurrPart.sPOSX - dInitialCutOut)
|
EgtSetInfo(nCurrMachGroup, MGR_RPT_PART & nDone, nPartDuploId & "," & DoubleToString(CurrPart.dPOSX - dInitialCutOut, 3))
|
||||||
Else
|
Else
|
||||||
dInitialCutOut += CurrPart.dOffset + CurrPart.dL
|
dInitialCutOut += CurrPart.dOffset + CurrPart.dL
|
||||||
End If
|
End If
|
||||||
@@ -363,14 +414,15 @@ Public Class MyMachGroupVM
|
|||||||
End If
|
End If
|
||||||
Return Nothing
|
Return Nothing
|
||||||
End If
|
End If
|
||||||
|
' aggiorno anticipo di pinzaggio in primo pezzo
|
||||||
|
EgtSetInfo(EgtGetFirstRawPart(), "HCING", dHCING)
|
||||||
'aggiorno lista pezzi
|
'aggiorno lista pezzi
|
||||||
BeamMachGroup.MyMachGroupM.RefreshPartList()
|
BeamMachGroup.MyMachGroupM.RefreshPartList()
|
||||||
BeamMachGroup.MyMachGroupM.RefreshGroupData()
|
BeamMachGroup.MyMachGroupM.RefreshGroupData()
|
||||||
''' aggiorno dati utilizzo barra
|
Core.ViewPanelVM.BWSetView(VT.ISO_SW, False)
|
||||||
''BeamMachGroup.UpdateUsage()
|
|
||||||
Core.ViewPanelVM.BWSetView(VT.TOP, False)
|
|
||||||
' salvo nuovo grezzo nel progetto
|
' salvo nuovo grezzo nel progetto
|
||||||
Map.refSupervisorManagerVM.Save()
|
Map.refSupervisorManagerVM.Save()
|
||||||
|
Dim LastDonePart As PartVM = Nothing
|
||||||
' segno pezzi non completati come scrap
|
' segno pezzi non completati come scrap
|
||||||
For Index = 0 To m_PartVMList.Count - 1
|
For Index = 0 To m_PartVMList.Count - 1
|
||||||
Dim CurrPart As PartVM = m_PartVMList(Index)
|
Dim CurrPart As PartVM = m_PartVMList(Index)
|
||||||
@@ -387,15 +439,22 @@ Public Class MyMachGroupVM
|
|||||||
Part.NotifyPropertyChanged(NameOf(Part.nProduction_State))
|
Part.NotifyPropertyChanged(NameOf(Part.nProduction_State))
|
||||||
' resetto stato redo
|
' resetto stato redo
|
||||||
Part.bRedo = False
|
Part.bRedo = False
|
||||||
' scrivo data end su Db barra
|
Else
|
||||||
DbControllers.m_MachGroupController.UpdateEnd(nP_Prod, nP_Machgroup, DateTime.MinValue)
|
LastDonePart = CurrPart
|
||||||
DbControllers.m_MachGroupController.UpdateStatus(nP_Prod, nP_Machgroup, ItemState.Produced)
|
|
||||||
' scrivo stato end
|
|
||||||
MyMachGroupM.SetProductionState(ItemState.Produced)
|
|
||||||
dtEndTime = DateTime.MinValue
|
|
||||||
NotifyPropertyChanged(NameOf(nProduction_State))
|
|
||||||
End If
|
End If
|
||||||
Next
|
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))
|
NotifyPropertyChanged(NameOf(Produce_IsEnabled))
|
||||||
MachGroup = BeamMachGroup
|
MachGroup = BeamMachGroup
|
||||||
ElseIf Map.refSupervisorManagerVM.CurrProd.nType = BWType.WALL Then
|
ElseIf Map.refSupervisorManagerVM.CurrProd.nType = BWType.WALL Then
|
||||||
@@ -433,7 +492,7 @@ Public Class MyMachGroupVM
|
|||||||
'WallMachGroup.UpdateUsage()
|
'WallMachGroup.UpdateUsage()
|
||||||
'EgtSetView(VT.TOP, False)
|
'EgtSetView(VT.TOP, False)
|
||||||
End If
|
End If
|
||||||
' aggiorno dati ultilizzo grezzo
|
' aggiorno dati utilizzo grezzo
|
||||||
MachGroup.UpdateUsage()
|
MachGroup.UpdateUsage()
|
||||||
'passo machgroup a supervisor su Db
|
'passo machgroup a supervisor su Db
|
||||||
DbControllers.m_MachGroupController.UpdateSupervisor(Map.refSupervisorManagerVM.CurrProd.nProdId, MachGroup.Id, DbControllers.m_SupervisorId)
|
DbControllers.m_MachGroupController.UpdateSupervisor(Map.refSupervisorManagerVM.CurrProd.nProdId, MachGroup.Id, DbControllers.m_SupervisorId)
|
||||||
@@ -441,6 +500,18 @@ Public Class MyMachGroupVM
|
|||||||
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.Background))
|
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.Background))
|
||||||
' assegno a nuova barra indice successivo a quella di partenza
|
' assegno a nuova barra indice successivo a quella di partenza
|
||||||
MachGroup.SetProductionIndex(m_nProductionIndex + 1)
|
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
|
' aggiorno indice di tutte le barre in coda
|
||||||
For Each CurrMachGroup As MyMachGroupVM In Map.refSupervisorMachGroupPanelVM.MachGroupVMList
|
For Each CurrMachGroup As MyMachGroupVM In Map.refSupervisorMachGroupPanelVM.MachGroupVMList
|
||||||
If Not (CurrMachGroup Is MachGroup) AndAlso CurrMachGroup.nProductionIndex >= MachGroup.nProductionIndex AndAlso CurrMachGroup.nProductionIndex < 5000 Then
|
If Not (CurrMachGroup Is MachGroup) AndAlso CurrMachGroup.nProductionIndex >= MachGroup.nProductionIndex AndAlso CurrMachGroup.nProductionIndex < 5000 Then
|
||||||
@@ -454,10 +525,28 @@ Public Class MyMachGroupVM
|
|||||||
If Not IsNothing(MachGroup) Then Map.refProjectVM.SupervisorMachGroupPanelVM.AddMachGroupToSupervisor(MachGroup)
|
If Not IsNothing(MachGroup) Then Map.refProjectVM.SupervisorMachGroupPanelVM.AddMachGroupToSupervisor(MachGroup)
|
||||||
' lo posiziono subito dopo il gruppo di ripartenza
|
' 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)
|
Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Move(Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Count - 1, Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.IndexOf(Me) + 1)
|
||||||
|
EgtResetCurrMachGroup()
|
||||||
EgtZoom(ZM.ALL)
|
EgtZoom(ZM.ALL)
|
||||||
Return MachGroup
|
Return MachGroup
|
||||||
End Function
|
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 ' ProduceMachGroup
|
||||||
|
|
||||||
#End Region ' COMMANDS
|
#End Region ' COMMANDS
|
||||||
|
|||||||
@@ -32,6 +32,15 @@ Public Class PartVM
|
|||||||
NotifyPropertyChanged(NameOf(bDO))
|
NotifyPropertyChanged(NameOf(bDO))
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Public Property bFLIP As Boolean
|
||||||
|
Get
|
||||||
|
Return m_PartM.nFLIP <> 0
|
||||||
|
End Get
|
||||||
|
Set(value As Boolean)
|
||||||
|
Return
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
#End Region ' Supervisor
|
#End Region ' Supervisor
|
||||||
|
|
||||||
#End Region ' FIELDS & PROPERTIES
|
#End Region ' FIELDS & PROPERTIES
|
||||||
|
|||||||
@@ -12,6 +12,15 @@ Public Class SupervisorMachGroupPanelVM
|
|||||||
|
|
||||||
#Region "FIELDS & PROPERTIES"
|
#Region "FIELDS & PROPERTIES"
|
||||||
|
|
||||||
|
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
|
' lock per aggiunta elemento a lista MachGroup
|
||||||
Private m_Lock_AddMachGroup As New Object
|
Private m_Lock_AddMachGroup As New Object
|
||||||
|
|
||||||
@@ -37,8 +46,8 @@ Public Class SupervisorMachGroupPanelVM
|
|||||||
Map.SetRefSupervisorMachGroupPanelVM(Me)
|
Map.SetRefSupervisorMachGroupPanelVM(Me)
|
||||||
BindingOperations.EnableCollectionSynchronization(m_MachGroupVMList, m_Lock_AddMachGroup)
|
BindingOperations.EnableCollectionSynchronization(m_MachGroupVMList, m_Lock_AddMachGroup)
|
||||||
m_ReloadProj_Timer.Interval = TimeSpan.FromMilliseconds(500)
|
m_ReloadProj_Timer.Interval = TimeSpan.FromMilliseconds(500)
|
||||||
m_ReloadProj_Timer.Start()
|
|
||||||
AddHandler m_ReloadProj_Timer.Tick, AddressOf ReloadProject_Tick
|
AddHandler m_ReloadProj_Timer.Tick, AddressOf ReloadProject_Tick
|
||||||
|
m_ReloadProj_Timer.Start()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
#End Region ' CONSTRUCTOR
|
#End Region ' CONSTRUCTOR
|
||||||
@@ -49,26 +58,27 @@ Public Class SupervisorMachGroupPanelVM
|
|||||||
If MachGroupVMList.Count = 0 Then
|
If MachGroupVMList.Count = 0 Then
|
||||||
ManageBTLParts.ShowAll()
|
ManageBTLParts.ShowAll()
|
||||||
End If
|
End If
|
||||||
SyncLock (m_Lock_AddMachGroup)
|
If Not MachGroupVMList.Contains(MachGroup) Then
|
||||||
MachGroupVMList.Add(MachGroup)
|
SyncLock (m_Lock_AddMachGroup)
|
||||||
End SyncLock
|
MachGroupVMList.Add(MachGroup)
|
||||||
|
End SyncLock
|
||||||
|
End If
|
||||||
' notifico stato
|
' notifico stato
|
||||||
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.Produce_IsEnabled))
|
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.Produce_IsEnabled))
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private m_bReloadProj As Boolean = False
|
|
||||||
Private m_ReloadProj_Timer As New DispatcherTimer
|
|
||||||
|
|
||||||
Public Sub ReloadProjectFile()
|
Public Sub ReloadProjectFile()
|
||||||
m_bReloadProj = True
|
m_bReloadProj = True
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Sub ReloadProject_Tick()
|
Public Sub ReloadProject_Tick()
|
||||||
If Not m_bReloadProj Then Return
|
If Not m_bReloadProj Then Return
|
||||||
|
m_bReloadingProj = True
|
||||||
m_bReloadProj = False
|
m_bReloadProj = False
|
||||||
Map.refSceneHostVM.MainController.ResetModified()
|
Map.refSceneHostVM.MainController.ResetModified()
|
||||||
Map.refSceneHostVM.MainController.OpenProject(Map.refSupervisorManagerVM.CurrProd.sProdPath, False)
|
Map.refSceneHostVM.MainController.OpenProject(Map.refSupervisorManagerVM.CurrProd.sProdPath, False)
|
||||||
RefreshSupervisorMachGroups(Map.refMachinePanelVM.MachineList.ToList())
|
RefreshSupervisorMachGroups(Map.refMachinePanelVM.MachineList.ToList())
|
||||||
|
m_bReloadingProj = False
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
#End Region ' CONSTRUCTOR
|
#End Region ' CONSTRUCTOR
|
||||||
|
|||||||
@@ -36,6 +36,16 @@ Public Class MachManaging
|
|||||||
Return m_CN
|
Return m_CN
|
||||||
End Get
|
End Get
|
||||||
End Property
|
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)
|
Private Shared WithEvents m_CommandList As New ObservableCollection(Of ThreadCommand)
|
||||||
Public Shared ReadOnly Property CommandList As ObservableCollection(Of ThreadCommand)
|
Public Shared ReadOnly Property CommandList As ObservableCollection(Of ThreadCommand)
|
||||||
@@ -212,7 +222,7 @@ Public Class MachManaging
|
|||||||
' Threading.Thread.Sleep(300)
|
' Threading.Thread.Sleep(300)
|
||||||
' End If
|
' End If
|
||||||
' 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
|
' eseguo ciclo principale
|
||||||
Dim nReset_State As Integer
|
Dim nReset_State As Integer
|
||||||
Dim nStart_State As Boolean
|
Dim nStart_State As Boolean
|
||||||
@@ -272,6 +282,168 @@ Public Class MachManaging
|
|||||||
If nCurrMachIndex > 0 AndAlso nReset_State = 0 Then
|
If nCurrMachIndex > 0 AndAlso nReset_State = 0 Then
|
||||||
m_nMachIndex = nCurrMachIndex
|
m_nMachIndex = nCurrMachIndex
|
||||||
End If
|
End If
|
||||||
|
Case NCTypes.NUM_AXIUM_APSERVER
|
||||||
|
Dim dTemp As Double = 0
|
||||||
|
Dim nTemp As Integer = 0
|
||||||
|
If Not IsNothing(ResetVariable.sValue) Then
|
||||||
|
StringToDouble(ResetVariable.sValue, dTemp)
|
||||||
|
Integer.TryParse(dTemp, nReset_State)
|
||||||
|
Else
|
||||||
|
nReset_State = 1
|
||||||
|
End If
|
||||||
|
If Not IsNothing(StartVariable.sValue) Then
|
||||||
|
StringToDouble(StartVariable.sValue, dTemp)
|
||||||
|
Integer.TryParse(dTemp, nTemp)
|
||||||
|
nStart_State = (nTemp = 1)
|
||||||
|
Else
|
||||||
|
nStart_State = -1
|
||||||
|
End If
|
||||||
|
If Not IsNothing(StopVariable.sValue) Then
|
||||||
|
StringToDouble(StopVariable.sValue, dTemp)
|
||||||
|
Integer.TryParse(dTemp, nTemp)
|
||||||
|
nStop_State = (nTemp = 1)
|
||||||
|
Else
|
||||||
|
nStop_State = -1
|
||||||
|
End If
|
||||||
|
If Not IsNothing(ProdVariable.sValue) Then
|
||||||
|
StringToDouble(ProdVariable.sValue, dTemp)
|
||||||
|
Integer.TryParse(dTemp, nP_Prod)
|
||||||
|
Else
|
||||||
|
nP_Prod = -1
|
||||||
|
End If
|
||||||
|
If Not IsNothing(MachGroupVariable.sValue) Then
|
||||||
|
StringToDouble(MachGroupVariable.sValue, dTemp)
|
||||||
|
Integer.TryParse(dTemp, nP_Machgroup)
|
||||||
|
Else
|
||||||
|
nP_Machgroup = -1
|
||||||
|
End If
|
||||||
|
If Not IsNothing(PartVariable.sValue) Then
|
||||||
|
StringToDouble(PartVariable.sValue, dTemp)
|
||||||
|
Integer.TryParse(dTemp, nP_Part)
|
||||||
|
Else
|
||||||
|
nP_Part = -1
|
||||||
|
End If
|
||||||
|
If Not IsNothing(StateVariable.sValue) Then
|
||||||
|
StringToDouble(StateVariable.sValue, dTemp)
|
||||||
|
Integer.TryParse(dTemp, nP_State)
|
||||||
|
Else
|
||||||
|
nP_State = -1
|
||||||
|
End If
|
||||||
|
If Not IsNothing(ISONumVariable.sValue) Then
|
||||||
|
StringToDouble(ISONumVariable.sValue, dTemp)
|
||||||
|
Integer.TryParse(dTemp, nISO_Num)
|
||||||
|
Else
|
||||||
|
nISO_Num = -1
|
||||||
|
End If
|
||||||
|
If Not IsNothing(ISOSentVariable.sValue) Then
|
||||||
|
StringToDouble(ISOSentVariable.sValue, dTemp)
|
||||||
|
Integer.TryParse(dTemp, nISO_Sent)
|
||||||
|
Else
|
||||||
|
nISO_Sent = -1
|
||||||
|
End If
|
||||||
|
If Not IsNothing(RunningVariable.sValue) Then
|
||||||
|
StringToDouble(RunningVariable.sValue, dTemp)
|
||||||
|
Integer.TryParse(dTemp, nRunning)
|
||||||
|
Else
|
||||||
|
nRunning = -1
|
||||||
|
End If
|
||||||
|
If Not IsNothing(MachIndexVariable.sValue) Then
|
||||||
|
StringToDouble(MachIndexVariable.sValue, dTemp)
|
||||||
|
Integer.TryParse(dTemp, 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
|
||||||
|
StringToDouble(ResetVariable.sValue, dTemp)
|
||||||
|
Integer.TryParse(dTemp, nReset_State)
|
||||||
|
Else
|
||||||
|
nReset_State = 1
|
||||||
|
End If
|
||||||
|
If Not IsNothing(StartVariable.sValue) Then
|
||||||
|
StringToDouble(StartVariable.sValue, dTemp)
|
||||||
|
Integer.TryParse(dTemp, nTemp)
|
||||||
|
nStart_State = (nTemp = 1)
|
||||||
|
Else
|
||||||
|
nStart_State = -1
|
||||||
|
End If
|
||||||
|
If Not IsNothing(StopVariable.sValue) Then
|
||||||
|
StringToDouble(StopVariable.sValue, dTemp)
|
||||||
|
Integer.TryParse(dTemp, nTemp)
|
||||||
|
nStop_State = (nTemp = 1)
|
||||||
|
Else
|
||||||
|
nStop_State = -1
|
||||||
|
End If
|
||||||
|
If Not IsNothing(ProdVariable.sValue) Then
|
||||||
|
StringToDouble(ProdVariable.sValue, dTemp)
|
||||||
|
Integer.TryParse(dTemp, nP_Prod)
|
||||||
|
Else
|
||||||
|
nP_Prod = -1
|
||||||
|
End If
|
||||||
|
If Not IsNothing(MachGroupVariable.sValue) Then
|
||||||
|
StringToDouble(MachGroupVariable.sValue, dTemp)
|
||||||
|
Integer.TryParse(dTemp, nP_Machgroup)
|
||||||
|
Else
|
||||||
|
nP_Machgroup = -1
|
||||||
|
End If
|
||||||
|
If Not IsNothing(PartVariable.sValue) Then
|
||||||
|
StringToDouble(PartVariable.sValue, dTemp)
|
||||||
|
Integer.TryParse(dTemp, nP_Part)
|
||||||
|
Else
|
||||||
|
nP_Part = -1
|
||||||
|
End If
|
||||||
|
If Not IsNothing(StateVariable.sValue) Then
|
||||||
|
StringToDouble(StateVariable.sValue, dTemp)
|
||||||
|
Integer.TryParse(dTemp, nP_State)
|
||||||
|
Else
|
||||||
|
nP_State = -1
|
||||||
|
End If
|
||||||
|
If Not IsNothing(ISONumVariable.sValue) Then
|
||||||
|
StringToDouble(ISONumVariable.sValue, dTemp)
|
||||||
|
Integer.TryParse(dTemp, nISO_Num)
|
||||||
|
Else
|
||||||
|
nISO_Num = -1
|
||||||
|
End If
|
||||||
|
If Not IsNothing(ISOSentVariable.sValue) Then
|
||||||
|
StringToDouble(ISOSentVariable.sValue, dTemp)
|
||||||
|
Integer.TryParse(dTemp, nISO_Sent)
|
||||||
|
Else
|
||||||
|
nISO_Sent = -1
|
||||||
|
End If
|
||||||
|
If Not IsNothing(RunningVariable.sValue) Then
|
||||||
|
StringToDouble(RunningVariable.sValue, dTemp)
|
||||||
|
Integer.TryParse(dTemp, nRunning)
|
||||||
|
Else
|
||||||
|
nRunning = -1
|
||||||
|
End If
|
||||||
|
If Not IsNothing(MachIndexVariable.sValue) Then
|
||||||
|
StringToDouble(MachIndexVariable.sValue, dTemp)
|
||||||
|
Integer.TryParse(dTemp, 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
|
End Select
|
||||||
' se NUM aggiorno stato della macchina
|
' se NUM aggiorno stato della macchina
|
||||||
If CurrentMachine.NCType = NCTypes.NUM_FLEXIUM Then
|
If CurrentMachine.NCType = NCTypes.NUM_FLEXIUM Then
|
||||||
@@ -286,14 +458,34 @@ Public Class MachManaging
|
|||||||
If OpState <> Map.refLeftPanelVM.SelOPState.Id Then
|
If OpState <> Map.refLeftPanelVM.SelOPState.Id Then
|
||||||
m_OpStateCallbackDlg(OpState)
|
m_OpStateCallbackDlg(OpState)
|
||||||
End If
|
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 OpState <> Map.refLeftPanelVM.SelOPState.Id Then
|
||||||
|
m_OpStateCallbackDlg(OpState)
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
' se TPA e non ancora fatto, preparo variabili barra successiva
|
' 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
|
If CurrentMachine.NCType = NCTypes.TPA AndAlso CurrentMachine.Flow = FlowTypes.CONTINUOUS AndAlso m_NextBarId = 0 Then
|
||||||
SetNextBarVars()
|
SetNextBarVars()
|
||||||
' se macchina NUM, non sto gia' spedendo e variabile spedizione me lo permette
|
' 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
|
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
|
' verifico se c'e' un programma da lanciare
|
||||||
SendNextProgram()
|
SendNextProgram()
|
||||||
End If
|
End If
|
||||||
@@ -356,6 +548,8 @@ Public Class MachManaging
|
|||||||
Part.nProduction_State = ItemState.WIP
|
Part.nProduction_State = ItemState.WIP
|
||||||
Part.dtStartTime = dtStart
|
Part.dtStartTime = dtStart
|
||||||
Part.NotifyPropertyChanged(NameOf(Part.nProduction_State))
|
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
|
Next
|
||||||
Else
|
Else
|
||||||
' scrivo data start su Db pezzo
|
' scrivo data start su Db pezzo
|
||||||
@@ -367,12 +561,14 @@ Public Class MachManaging
|
|||||||
Part.nProduction_State = ItemState.WIP
|
Part.nProduction_State = ItemState.WIP
|
||||||
Part.dtStartTime = dtStart
|
Part.dtStartTime = dtStart
|
||||||
Part.NotifyPropertyChanged(NameOf(Part.nProduction_State))
|
Part.NotifyPropertyChanged(NameOf(Part.nProduction_State))
|
||||||
|
' 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
|
End If
|
||||||
' azzero variabile per far ripartire macchina
|
' azzero variabile per far ripartire macchina
|
||||||
Select Case CurrentMachine.NCType
|
Select Case CurrentMachine.NCType
|
||||||
Case NCTypes.TPA
|
Case NCTypes.TPA
|
||||||
Tpa.RWVariableManager.WriteVarByName(P_STATE, 0)
|
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"
|
StateVariable.sValue = "0"
|
||||||
End Select
|
End Select
|
||||||
' se nessun pezzo della barra diverso da quello corrente e' in start
|
' se nessun pezzo della barra diverso da quello corrente e' in start
|
||||||
@@ -384,6 +580,8 @@ Public Class MachManaging
|
|||||||
MachGroup.MyMachGroupM.SetProductionState(ItemState.WIP)
|
MachGroup.MyMachGroupM.SetProductionState(ItemState.WIP)
|
||||||
MachGroup.dtStartTime = dtStart
|
MachGroup.dtStartTime = dtStart
|
||||||
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.nProduction_State))
|
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.nProduction_State))
|
||||||
|
' scrivo evento inizio MachGroup su DB
|
||||||
|
DbControllers.m_LogMachineController.Create(LogEvent.CreateMachGroupStateLog(dtStart, nP_Prod, nP_Machgroup, nP_State, DbControllers.SupervisorId))
|
||||||
End If
|
End If
|
||||||
' attesa per essere sicuro che abbia scritto e riletto variabili
|
' attesa per essere sicuro che abbia scritto e riletto variabili
|
||||||
Threading.Thread.Sleep(300)
|
Threading.Thread.Sleep(300)
|
||||||
@@ -403,6 +601,15 @@ Public Class MachManaging
|
|||||||
Part.NotifyPropertyChanged(NameOf(Part.nProduction_State))
|
Part.NotifyPropertyChanged(NameOf(Part.nProduction_State))
|
||||||
' resetto stato redo
|
' resetto stato redo
|
||||||
Part.bRedo = False
|
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
|
Next
|
||||||
Else
|
Else
|
||||||
' scrivo data end su Db pezzo
|
' scrivo data end su Db pezzo
|
||||||
@@ -416,13 +623,9 @@ Public Class MachManaging
|
|||||||
Part.NotifyPropertyChanged(NameOf(Part.nProduction_State))
|
Part.NotifyPropertyChanged(NameOf(Part.nProduction_State))
|
||||||
' resetto stato redo
|
' resetto stato redo
|
||||||
Part.bRedo = False
|
Part.bRedo = False
|
||||||
|
' 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
|
End If
|
||||||
'Select Case CurrentMachine.NCType
|
|
||||||
' Case NCTypes.TPA
|
|
||||||
' Tpa.RWVariableManager.WriteVar(P_STATE, 0)
|
|
||||||
' Case NCTypes.NUM_FLEXIUM
|
|
||||||
' StateVariable.sValue = "0"
|
|
||||||
'End Select
|
|
||||||
|
|
||||||
' se tutti i pezzi della barra sono in end
|
' se tutti i pezzi della barra sono in end
|
||||||
If MachGroup.PartVMList.All(Function(x) x.nProduction_State >= 2) Then
|
If MachGroup.PartVMList.All(Function(x) x.nProduction_State >= 2) Then
|
||||||
@@ -433,20 +636,31 @@ Public Class MachManaging
|
|||||||
MachGroup.MyMachGroupM.SetProductionState(ItemState.Produced)
|
MachGroup.MyMachGroupM.SetProductionState(ItemState.Produced)
|
||||||
MachGroup.dtEndTime = dtEnd
|
MachGroup.dtEndTime = dtEnd
|
||||||
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.nProduction_State))
|
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
|
' azzero tutte le variabilli per iniziare barra successiva
|
||||||
ProdVariable.sValue = "0"
|
ProdVariable.sValue = "0"
|
||||||
MachGroupVariable.sValue = "0"
|
MachGroupVariable.sValue = "0"
|
||||||
PartVariable.sValue = "0"
|
PartVariable.sValue = "0"
|
||||||
StateVariable.sValue = "0"
|
StateVariable.sValue = "0"
|
||||||
' azzero variabile per far ripartire macchina
|
|
||||||
'Select Case CurrentMachine.NCType
|
|
||||||
' 'Case NCTypes.TPA
|
|
||||||
' ' Tpa.RWVariableManager.WriteVar(P_PROD, 0)
|
|
||||||
' ' Tpa.RWVariableManager.WriteVar(P_MACHGROUP, 0)
|
|
||||||
' ' Tpa.RWVariableManager.WriteVar(P_PART, 0)
|
|
||||||
' ' Tpa.RWVariableManager.WriteVar(P_STATE, 0)
|
|
||||||
'End Select
|
|
||||||
|
|
||||||
|
' se non impostata data start
|
||||||
|
If MachGroup.dtStartTime = DateTime.MinValue Then
|
||||||
|
EgtOutLog("Start date not set on Prod " & nP_Prod & " Machgroup " & nP_Machgroup)
|
||||||
|
Dim dtStart As DateTime = MachGroup.dtEndTime - TimeSpan.FromSeconds(60)
|
||||||
|
' provo a recuperare tempo stimato
|
||||||
|
If MachGroup.nCALC_TIME > 0 Then
|
||||||
|
Dim MinPartStart As DateTime = MachGroup.PartVMList.Min(Function(x) x.dtStartTime)
|
||||||
|
If MinPartStart > DateTime.MinValue Then
|
||||||
|
dtStart = New DateTime(Math.Min((MachGroup.dtEndTime - TimeSpan.FromSeconds(MachGroup.nCALC_TIME)).Ticks, MinPartStart.Ticks))
|
||||||
|
Else
|
||||||
|
dtStart = MachGroup.dtEndTime - TimeSpan.FromSeconds(MachGroup.nCALC_TIME)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
' scrivo data start su Db barra
|
||||||
|
DbControllers.m_MachGroupController.UpdateStart(nP_Prod, nP_Machgroup, dtStart)
|
||||||
|
MachGroup.dtStartTime = dtStart
|
||||||
|
End If
|
||||||
' resetto stati di produzione
|
' resetto stati di produzione
|
||||||
MachGroup.ResetProduce()
|
MachGroup.ResetProduce()
|
||||||
' se partenza pezzi uno a uno
|
' se partenza pezzi uno a uno
|
||||||
@@ -458,7 +672,7 @@ Public Class MachManaging
|
|||||||
' azzero variabile per far ripartire macchina
|
' azzero variabile per far ripartire macchina
|
||||||
StateVariable.sValue = "0"
|
StateVariable.sValue = "0"
|
||||||
End If
|
End If
|
||||||
' se pezzo = -1 devo dare end a tutti i pezzi del MachGroup
|
' se pezzo = -1 stampo etichette di tutti i pezzi del MachGroup
|
||||||
If nP_Part = -1 Then
|
If nP_Part = -1 Then
|
||||||
For Each Part In MachGroup.PartVMList
|
For Each Part In MachGroup.PartVMList
|
||||||
Map.refLeftPanelVM.PrintLabel(MachGroup, Part)
|
Map.refLeftPanelVM.PrintLabel(MachGroup, Part)
|
||||||
@@ -496,7 +710,9 @@ Public Class MachManaging
|
|||||||
Next
|
Next
|
||||||
' li scrivo nel CN
|
' li scrivo nel CN
|
||||||
For Index As Integer = 1 To 10
|
For Index As Integer = 1 To 10
|
||||||
Tpa.RWVariableManager.WriteVarByName(VPAR & Index.ToString(), dVPars(Index))
|
Dim sValue As String = ""
|
||||||
|
DoubleToString(dVPars(Index), sValue)
|
||||||
|
Tpa.RWVariableManager.WriteVarByName(VPAR & Index.ToString(), sValue)
|
||||||
Next
|
Next
|
||||||
m_NextBarId = MyMachGroup.Id
|
m_NextBarId = MyMachGroup.Id
|
||||||
Return True
|
Return True
|
||||||
@@ -510,36 +726,47 @@ Public Class MachManaging
|
|||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Function SendNextProgram() As Boolean
|
Private Function SendNextProgram() As Boolean
|
||||||
|
EgtOutLog("Inizio SendNextProgram")
|
||||||
Dim bSent As Boolean = False
|
Dim bSent As Boolean = False
|
||||||
If (CurrentMachine.NCType = NCTypes.TPA AndAlso Not m_bStartPending AndAlso Tpa.opState = MachineOperatingState.Pending) OrElse
|
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
|
' verifico se c'e' un programma da lanciare
|
||||||
If Not IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM) Then
|
If Not IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM) Then
|
||||||
EgtOutLog("Start " & DateTime.Now())
|
EgtOutLog("Start " & DateTime.Now())
|
||||||
|
Dim bMachGroupNotReady As Boolean = False
|
||||||
SyncLock m_Lock_SendProgram
|
SyncLock m_Lock_SendProgram
|
||||||
For Each MyMachGroup As MyMachGroupVM In Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList
|
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
|
If Not MyMachGroup.bSentToMachine AndAlso (MyMachGroup.dtStartTime = DateTime.MinValue OrElse
|
||||||
(Map.refSupervisorManagerVM.CurrProd.nType = BWType.WALL AndAlso MyMachGroup.bResetWhileCutting)) Then
|
(Map.refSupervisorManagerVM.CurrProd.nType = BWType.WALL AndAlso MyMachGroup.bResetWhileCutting)) Then
|
||||||
|
EgtOutLog(MyMachGroup.Name & " id: " & MyMachGroup.Id & " è da fare")
|
||||||
' verifico se ricalcolo finito
|
' 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
|
' lo lancio
|
||||||
bSent = SendProgram(MyMachGroup.CnFilePath(), MyMachGroup.Name)
|
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
|
Select Case CurrentMachine.NCType
|
||||||
Case NCTypes.TPA
|
Case NCTypes.TPA
|
||||||
MyMachGroup.SetSentToMachine(bSent)
|
MyMachGroup.SetSentToMachine(bSent)
|
||||||
Case NCTypes.NUM_FLEXIUM
|
Case NCTypes.NUM_FLEXIUM, NCTypes.NUM_AXIUM_APSERVER, NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||||
MyMachGroup.SetSendingToMachine(bSent)
|
MyMachGroup.SetSendingToMachine(bSent)
|
||||||
End Select
|
End Select
|
||||||
m_NextBarId = 0
|
m_NextBarId = 0
|
||||||
Exit For
|
Exit For
|
||||||
Else
|
Else
|
||||||
' programma non ancora pronto, esco per attendere
|
' 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
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
End SyncLock
|
End SyncLock
|
||||||
|
If bMachGroupNotReady Then Return False
|
||||||
EgtOutLog("End " & DateTime.Now())
|
EgtOutLog("End " & DateTime.Now())
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
@@ -592,9 +819,9 @@ Public Class MachManaging
|
|||||||
Num_Flexium.CloseReadList()
|
Num_Flexium.CloseReadList()
|
||||||
Num_Flexium.CloseReadELS()
|
Num_Flexium.CloseReadELS()
|
||||||
Case CommandTypes.MDI
|
Case CommandTypes.MDI
|
||||||
Num_Flexium.MDI_Execute(Command.sVariable)
|
SendMDI(Command.sVariable)
|
||||||
Case CommandTypes.SETCHANNEL
|
Case CommandTypes.SETCHANNEL
|
||||||
Num_Flexium.SetChannel(Command.nVariable)
|
SetChannel(Command.nVariable)
|
||||||
End Select
|
End Select
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@@ -605,6 +832,9 @@ Public Class MachManaging
|
|||||||
m_CN = New TPAComm(Me)
|
m_CN = New TPAComm(Me)
|
||||||
m_bConnected = Tpa.remObject.OnConnect()
|
m_bConnected = Tpa.remObject.OnConnect()
|
||||||
m_ResultCallbackDlg(CommandTypes.CONNECT, CommandStates.OK, ResultTypes.EXECUTED, "")
|
m_ResultCallbackDlg(CommandTypes.CONNECT, CommandStates.OK, ResultTypes.EXECUTED, "")
|
||||||
|
' imposto stato manuale
|
||||||
|
Dim ManualMode As OPState = Map.refLeftPanelVM.OPModeList.FirstOrDefault(Function(x) x.Id = OPModes.Manual)
|
||||||
|
Map.refLeftPanelVM.SetOPMode(ManualMode)
|
||||||
' creo classe di gestione variabili
|
' creo classe di gestione variabili
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
m_ResultCallbackDlg(CommandTypes.CONNECT, CommandStates.ERROR_, ResultTypes.EXECUTED, "Errore: impossibile connettersi!")
|
m_ResultCallbackDlg(CommandTypes.CONNECT, CommandStates.ERROR_, ResultTypes.EXECUTED, "Errore: impossibile connettersi!")
|
||||||
@@ -620,6 +850,31 @@ Public Class MachManaging
|
|||||||
m_ResultCallbackDlg(CommandTypes.CONNECT, CommandStates.ERROR_, ResultTypes.EXECUTED, "Errore: impossibile connettersi!")
|
m_ResultCallbackDlg(CommandTypes.CONNECT, CommandStates.ERROR_, ResultTypes.EXECUTED, "Errore: impossibile connettersi!")
|
||||||
Return
|
Return
|
||||||
End Try
|
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 Select
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@@ -638,6 +893,20 @@ Public Class MachManaging
|
|||||||
' chiudo classe Num_Flexium
|
' chiudo classe Num_Flexium
|
||||||
Me.OnDispose()
|
Me.OnDispose()
|
||||||
'Num_Flexium.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
|
End Select
|
||||||
' termino thread di comunicazione
|
' termino thread di comunicazione
|
||||||
MachineCommThread.StopThread()
|
MachineCommThread.StopThread()
|
||||||
@@ -647,6 +916,10 @@ Public Class MachManaging
|
|||||||
Select Case CurrentMachine.NCType
|
Select Case CurrentMachine.NCType
|
||||||
Case NCTypes.NUM_FLEXIUM
|
Case NCTypes.NUM_FLEXIUM
|
||||||
Num_Flexium.SetMode(CNMode)
|
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 Select
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@@ -686,6 +959,10 @@ Public Class MachManaging
|
|||||||
m_ResultCallbackDlg(CommandTypes.START, If(bOk, CommandStates.OK, CommandStates.ERROR_), ResultTypes.EXECUTED, "")
|
m_ResultCallbackDlg(CommandTypes.START, If(bOk, CommandStates.OK, CommandStates.ERROR_), ResultTypes.EXECUTED, "")
|
||||||
Case NCTypes.NUM_FLEXIUM
|
Case NCTypes.NUM_FLEXIUM
|
||||||
Num_Flexium.Start()
|
Num_Flexium.Start()
|
||||||
|
Case NCTypes.NUM_AXIUM_APSERVER
|
||||||
|
Num_Axium_APServer.Start()
|
||||||
|
Case NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||||
|
Num_Axium_PCToolkit.Start()
|
||||||
End Select
|
End Select
|
||||||
' aggiorno stato bottoni in LeftPanel
|
' aggiorno stato bottoni in LeftPanel
|
||||||
Map.refLeftPanelVM.UpdateButtonIsEnabledState()
|
Map.refLeftPanelVM.UpdateButtonIsEnabledState()
|
||||||
@@ -698,6 +975,10 @@ Public Class MachManaging
|
|||||||
m_ResultCallbackDlg(CommandTypes.STOP_, If(bOk, CommandStates.OK, CommandStates.ERROR_), ResultTypes.EXECUTED, "")
|
m_ResultCallbackDlg(CommandTypes.STOP_, If(bOk, CommandStates.OK, CommandStates.ERROR_), ResultTypes.EXECUTED, "")
|
||||||
Case NCTypes.NUM_FLEXIUM
|
Case NCTypes.NUM_FLEXIUM
|
||||||
Num_Flexium.Stop_()
|
Num_Flexium.Stop_()
|
||||||
|
Case NCTypes.NUM_AXIUM_APSERVER
|
||||||
|
Num_Axium_APServer.Stop_()
|
||||||
|
Case NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||||
|
Num_Axium_PCToolkit.Stop_()
|
||||||
End Select
|
End Select
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@@ -708,6 +989,10 @@ Public Class MachManaging
|
|||||||
m_ResultCallbackDlg(CommandTypes.RESET, If(bOk, CommandStates.OK, CommandStates.ERROR_), ResultTypes.EXECUTED, "")
|
m_ResultCallbackDlg(CommandTypes.RESET, If(bOk, CommandStates.OK, CommandStates.ERROR_), ResultTypes.EXECUTED, "")
|
||||||
Case NCTypes.NUM_FLEXIUM
|
Case NCTypes.NUM_FLEXIUM
|
||||||
Num_Flexium.Reset()
|
Num_Flexium.Reset()
|
||||||
|
Case NCTypes.NUM_AXIUM_APSERVER
|
||||||
|
Num_Axium_APServer.Reset()
|
||||||
|
Case NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||||
|
Num_Axium_PCToolkit.Reset()
|
||||||
End Select
|
End Select
|
||||||
' aggiorno stato bottoni in LeftPanel
|
' aggiorno stato bottoni in LeftPanel
|
||||||
Map.refLeftPanelVM.UpdateButtonIsEnabledState()
|
Map.refLeftPanelVM.UpdateButtonIsEnabledState()
|
||||||
@@ -730,6 +1015,10 @@ Public Class MachManaging
|
|||||||
m_ResultCallbackDlg(CommandTypes.SETPOINT, If(bOk, CommandStates.OK, CommandStates.ERROR_), ResultTypes.EXECUTED, "")
|
m_ResultCallbackDlg(CommandTypes.SETPOINT, If(bOk, CommandStates.OK, CommandStates.ERROR_), ResultTypes.EXECUTED, "")
|
||||||
Case NCTypes.NUM_FLEXIUM
|
Case NCTypes.NUM_FLEXIUM
|
||||||
Map.refLeftPanelVM.SelOPMode = Map.refLeftPanelVM.OPModeList.Find(Function(x) x.Id = OPModes.Home)
|
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 Select
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@@ -752,7 +1041,20 @@ Public Class MachManaging
|
|||||||
Num_Flexium.FileDownload(sFileType, ProgramPath)
|
Num_Flexium.FileDownload(sFileType, ProgramPath)
|
||||||
Num_Flexium.StartTransfer()
|
Num_Flexium.StartTransfer()
|
||||||
Return True
|
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
|
End Select
|
||||||
|
Return False
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Sub RemoveProgram(ProgramIndex As Integer, ProgramPath As String, ProgramType As String)
|
Public Sub RemoveProgram(ProgramIndex As Integer, ProgramPath As String, ProgramType As String)
|
||||||
@@ -772,6 +1074,11 @@ Public Class MachManaging
|
|||||||
Case NCTypes.NUM_FLEXIUM
|
Case NCTypes.NUM_FLEXIUM
|
||||||
Num_Flexium.FileDelete(ProgramType, ProgramPath)
|
Num_Flexium.FileDelete(ProgramType, ProgramPath)
|
||||||
Num_Flexium.StartTransfer()
|
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 Select
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@@ -791,6 +1098,28 @@ Public Class MachManaging
|
|||||||
End Select
|
End Select
|
||||||
End Sub
|
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)
|
Public Sub WriteVar(Address As String, Value As String, Type As CommVar.Types)
|
||||||
Select Case CurrentMachine.NCType
|
Select Case CurrentMachine.NCType
|
||||||
Case NCTypes.TPA
|
Case NCTypes.TPA
|
||||||
@@ -802,6 +1131,20 @@ Public Class MachManaging
|
|||||||
Case CommVar.Types.CN
|
Case CommVar.Types.CN
|
||||||
Num_Flexium.WriteNCVariables(Address, Value)
|
Num_Flexium.WriteNCVariables(Address, Value)
|
||||||
End Select
|
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 Select
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@@ -813,7 +1156,12 @@ Public Class MachManaging
|
|||||||
Return RWVariableManager.InitVar(NewVar)
|
Return RWVariableManager.InitVar(NewVar)
|
||||||
Case NCTypes.NUM_FLEXIUM
|
Case NCTypes.NUM_FLEXIUM
|
||||||
Return NUMFlexiumComm.InitVar(NewVar)
|
Return NUMFlexiumComm.InitVar(NewVar)
|
||||||
|
Case NCTypes.NUM_AXIUM_APSERVER
|
||||||
|
Return NUMAxiumComm.InitVar(NewVar)
|
||||||
|
Case NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||||
|
Return NUMAxiumPcToolkitComm.InitVar(NewVar)
|
||||||
End Select
|
End Select
|
||||||
|
Return Nothing
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Shared Function GetPrivateProfileVariable(IpAppName As String, IpKeyName As String, IpFileName As String) As CommVar
|
Private Shared Function GetPrivateProfileVariable(IpAppName As String, IpKeyName As String, IpFileName As String) As CommVar
|
||||||
@@ -855,4 +1203,37 @@ Public Class MachManaging
|
|||||||
Return New CommVar(sVariableValues(0), sVariableValues(1), ReadType, Type, Paragraph)
|
Return New CommVar(sVariableValues(0), sVariableValues(1), ReadType, Type, Paragraph)
|
||||||
End Function
|
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 dTemp As Double = 0
|
||||||
|
Dim nTemp As Integer = 0
|
||||||
|
StringToDouble(PLCMessagesVariable.sValue, dTemp)
|
||||||
|
Integer.TryParse(dTemp, 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
|
End Class
|
||||||
|
|||||||
@@ -4,10 +4,14 @@ Class MachineCommThread
|
|||||||
|
|
||||||
' variabile che ferma il ciclo
|
' variabile che ferma il ciclo
|
||||||
Private Shared m_Stop As Boolean = False
|
Private Shared m_Stop As Boolean = False
|
||||||
|
Private Shared m_StartTick As Boolean = False
|
||||||
|
|
||||||
Friend Shared Sub StopThread()
|
Friend Shared Sub StopThread()
|
||||||
m_Stop = True
|
m_Stop = True
|
||||||
End Sub
|
End Sub
|
||||||
|
Friend Shared Sub StartTick()
|
||||||
|
m_StartTick = True
|
||||||
|
End Sub
|
||||||
|
|
||||||
' variabile in cui ci sono stati inizio e fine pezzo
|
' variabile in cui ci sono stati inizio e fine pezzo
|
||||||
Private Shared sP1VarName As String = "0.FUNM.E81295"
|
Private Shared sP1VarName As String = "0.FUNM.E81295"
|
||||||
@@ -37,7 +41,9 @@ Class MachineCommThread
|
|||||||
|
|
||||||
While Not m_Stop
|
While Not m_Stop
|
||||||
' eseguo ciclo principale che tiene vivo il thread
|
' eseguo ciclo principale che tiene vivo il thread
|
||||||
m_MachManaging.Timer_Tick()
|
If m_StartTick Then
|
||||||
|
m_MachManaging.Timer_Tick()
|
||||||
|
End If
|
||||||
Threading.Thread.Sleep(TimeSpan.FromMilliseconds(1000))
|
Threading.Thread.Sleep(TimeSpan.FromMilliseconds(1000))
|
||||||
End While
|
End While
|
||||||
|
|
||||||
|
|||||||
@@ -298,6 +298,11 @@ Public Class CommVar
|
|||||||
Dim bNewValue As Boolean = m_sValue <> Value
|
Dim bNewValue As Boolean = m_sValue <> Value
|
||||||
m_sValue = Value
|
m_sValue = Value
|
||||||
m_bReaded = True
|
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))
|
If bNewValue Then RaiseEvent NewValue(Me, New NewValueEventArgs(Value))
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user