diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 00000000..56bfaac7 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,165 @@ +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' + NEXUS_PATH: 'MAPO/IOB-WIN-NEXT' + APP_NAME: 'IOB-WIN-NEXT' + VERS_MAIN: '3.5' + NEW_REL: '' + OUTPUT_DIR: '' + +# helper x fix pacchetti nuget da repo locale nexus.steamware.net +.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 x fix version number +.version-fix: &version-fix + - | + $env:NEW_REL = $env:VERS_MAIN+"."+(get-date –format yyMM)+"."+(get-date –format ddHH) + $contenuto = Get-Content -path 'VersGen\VersGen.cs' -Raw + $newContenuto = $contenuto -replace '0.0.0.0', $env:NEW_REL + $newContenuto | Set-Content -Path 'VersGen\VersGen.cs' + echo "Set vers: $env:NEW_REL" + +# helper pulizia files zip +.cleanup-zip: &cleanup-zip + - | + $env:OUTPUT_DIR = "Releases\" + $CI_COMMIT_BRANCH + "\*" + if ((Test-Path $env:OUTPUT_DIR)) + { + Remove-Item $env:OUTPUT_DIR -Force -Recurse -ErrorAction Ignore + } + echo "Clening ZIP dir: $env:OUTPUT_DIR" + +# helper creazione files zip +.zipper: &zipper + - | + $7zipPath = $env:ProgramFiles+"\7-Zip\7z.exe" + if (-not (Test-Path -Path $7zipPath -PathType Leaf)) { + throw "7 zip file '$7zipPath' not found" + } + Set-Alias 7zip $7zipPath + $Target = "Releases\" + $CI_COMMIT_BRANCH + "\" + $env:APP_NAME + ".zip" + $Source = "$env:APP_NAME\bin\*" + 7zip a -tzip $Target $Source + echo "called ZIP $Source --> $Target" + +# 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" + +# helper x send su NEXUS + # $File2Send = "Releases\" + $CI_COMMIT_BRANCH + "\" + $env:APP_NAME + ".zip" + # mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File2Send https://nexus.steamware.net/repository/utility/$env:NEXUS_PATH/$version/$env:APP_NAME-$version.zip + # mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File2Send".md5" https://nexus.steamware.net/repository/utility/$env:NEXUS_PATH/$version/$env:APP_NAME-$version.zip".md5" + # mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File2Send".sha1" https://nexus.steamware.net/repository/utility/$env:NEXUS_PATH/$version/$env:APP_NAME-$version.zip".sha1" +.nexusUpload: &nexusUpload + - | + Set-Alias mCurl C:\Windows\system32\curl.exe + if($CI_COMMIT_BRANCH -eq "master") + { + $version = "stable" + } + else + { + $version = "unstable" + } + $File2Send = "Releases\" + $CI_COMMIT_BRANCH + "\" + $env:APP_NAME + ".*" + ForEach ($File in $File2Send) { + $FileName = Split-Path $File -leaf + mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/$FileName + mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/ARCHIVE/$VersNumb/$FileName + } + mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "Resources\manifest.xml" https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/manifest.xml + mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "Resources\ChangeLog.html" https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/ChangeLog.html + +# mCurl -v -u $env:NEXUS_USER:$env:NEXUS_PASSWD --upload-file bin/release/$env:APP_NAME.zip $env:NEXUS_SERVER/utility/$env:NEXUS_PATH/$version/$env:APP_NAME-$version.zip + +stages: + - build +# - deploy + +# IOB:build: +# stage: build +# tags: +# - win +# variables: +# APP_NAME: IOB-WIN +# before_script: +# - *nuget-fix +# - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"-verbosity quiet' +# - *version-fix +# script: +# - '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=Release /p:Platform="x86" /p:OutputPath=bin/ /verbosity:minimal /m' + +IOB-NEXT:build: + stage: build + tags: + - win + variables: + APP_NAME: IOB-WIN-NEXT + before_script: + - *nuget-fix + - echo "Chiamata comando nuget-restore" + - echo "'& "$env:NUGET_PATH" restore "$env:APP_NAME.sln" -verbosity quiet'" + # - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"' + - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln" -verbosity quiet' + - *version-fix + script: + - '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=Release /p:Platform="x86" /p:OutputPath=bin/ /verbosity:minimal /m' + +# IOB:deploy: +# stage: deploy +# tags: +# - win +# variables: +# APP_NAME: IOB-WIN +# before_script: +# - *nuget-fix +# - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"-verbosity quiet' +# - *version-fix +# - *cleanup-zip +# script: +# - '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=Release /p:Platform="x86" /p:OutputPath=bin/ /verbosity:minimal /m' +# - *zipper +# - *hashBuild +# - *nexusUpload +# needs: ["IOB:build"] + +# IOB-NEXT:deploy: +# stage: deploy +# tags: +# - win +# variables: +# APP_NAME: IOB-WIN-NEXT +# before_script: +# - *nuget-fix +# - echo "Chiamata comando nuget-restore" +# - echo "'& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"-verbosity quiet'" +# - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"-verbosity quiet' +# - *version-fix +# - *cleanup-zip +# script: +# - '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=Release /p:Platform="x86" /p:OutputPath=bin/ /verbosity:minimal /m' +# - *zipper +# - *hashBuild +# - *nexusUpload +# needs: ["IOB-NEXT:build"] \ No newline at end of file diff --git a/CVCncLib/CVCncLib.dll b/CVCncLib/CVCncLib.dll index 77ac5221..ae705099 100644 Binary files a/CVCncLib/CVCncLib.dll and b/CVCncLib/CVCncLib.dll differ diff --git a/IOB-WIN-NEXT/DATA/CONF/PIZ04.ini b/IOB-WIN-NEXT/DATA/CONF/PIZ04.ini index b2c6e223..5bb1ff68 100644 --- a/IOB-WIN-NEXT/DATA/CONF/PIZ04.ini +++ b/IOB-WIN-NEXT/DATA/CONF/PIZ04.ini @@ -55,6 +55,8 @@ MAX_SEND_PZC_BLOCK=100 ; GEST DATI DYN ENABLE_DYN_DATA=TRUE FORCE_DYN_DATA=TRUE +; gestione delta minimo accettabile tra min/MAX +DELTA_VAL=0.1 ; clock base (da 10ms) timerIntMs=100 diff --git a/IOB-WIN-NEXT/DATA/CONF/PIZ05.ini b/IOB-WIN-NEXT/DATA/CONF/PIZ05.ini index 2c2f56ef..115e8aff 100644 --- a/IOB-WIN-NEXT/DATA/CONF/PIZ05.ini +++ b/IOB-WIN-NEXT/DATA/CONF/PIZ05.ini @@ -55,6 +55,8 @@ MAX_SEND_PZC_BLOCK=100 ; GEST DATI DYN ENABLE_DYN_DATA=TRUE FORCE_DYN_DATA=TRUE +; gestione delta minimo accettabile tra min/MAX +DELTA_VAL=0.1 ; clock base (da 10ms) timerIntMs=100 diff --git a/IOB-WIN-NEXT/IobModbusTCP.cs b/IOB-WIN-NEXT/IobModbusTCP.cs index ef5ade76..cbf13c13 100644 --- a/IOB-WIN-NEXT/IobModbusTCP.cs +++ b/IOB-WIN-NEXT/IobModbusTCP.cs @@ -21,6 +21,15 @@ namespace IOB_WIN_NEXT public class IobModbusTCP : IobGeneric { + #region Private Fields + + /// + /// Valore delta x gestione min/MAX e valore rilevato + /// + private double deltaVal = 0; + + #endregion Private Fields + #region Protected Fields protected ModbusClient currPLC; @@ -222,8 +231,8 @@ namespace IOB_WIN_NEXT default: break; } - // verifica limite... - dataOk = (valore > item.Value.minVal && valore < item.Value.maxVal); + // verifica limite... con delta da impianto + dataOk = (valore > (item.Value.minVal + deltaVal) && valore < (item.Value.maxVal - deltaVal)); if (dataOk) { // moltiplico x fattore conversione... @@ -496,6 +505,12 @@ namespace IOB_WIN_NEXT parentForm.commPlcActive = false; // carico conf vettore memoria... loadMemConf(); + // aggiungo DELTA x calcolo min/MAX... + string deltaValStr = getOptPar("DELTA_VAL"); + if (!string.IsNullOrEmpty(deltaValStr)) + { + double.TryParse(deltaValStr, out deltaVal); + } bool enableByApp = utils.CRB("enableContapezzi"); bool enableByIob = (getOptPar("ENABLE_PZCOUNT") == "TRUE"); bool disableByIob = (getOptPar("DISABLE_PZCOUNT") == "TRUE"); @@ -686,6 +701,11 @@ namespace IOB_WIN_NEXT { readErrorList = getDataDictionary(readErrorList, false, ref outVal); } + // se avessi acnora errori --> disconnetto + if (readErrorList.Count > 0) + { + tryDisconnect(); + } } else {