From 97bc417be4beca6fb5eee6e6db490c8611097823 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Sat, 8 Apr 2023 11:12:38 +0200 Subject: [PATCH] update gestione ricette --- IOB-WIN-NEXT/DATA/RECIPE/FixRecipeContent.ps1 | 20 --- IOB-WIN-NEXT/IOB-WIN-NEXT.csproj | 166 ------------------ IOB-WIN-NEXT/IobGeneric.cs | 11 +- IOB-WIN-NEXT/IobModbusTCPFimat.cs | 6 +- IOB-WIN-NEXT/IobSimula.cs | 6 +- 5 files changed, 16 insertions(+), 193 deletions(-) delete mode 100644 IOB-WIN-NEXT/DATA/RECIPE/FixRecipeContent.ps1 diff --git a/IOB-WIN-NEXT/DATA/RECIPE/FixRecipeContent.ps1 b/IOB-WIN-NEXT/DATA/RECIPE/FixRecipeContent.ps1 deleted file mode 100644 index 895a0f9e..00000000 --- a/IOB-WIN-NEXT/DATA/RECIPE/FixRecipeContent.ps1 +++ /dev/null @@ -1,20 +0,0 @@ -## cambio DIR -#cd "C:\Users\samuele.steamw\source\Mapo-IOB-WIN\IOB-WIN-NEXT\DATA\RECIPE\FIMAT" - -# leggo ogni file -$fileList = Get-Childitem *.xml #99999.xml - -foreach($file in $fileList) -{ - # nome ricetta (senza xml... - $fileName=$file | Select-Object Name - $recName = $fileName.Name.Replace('.xml','') - #$recName - $contenuto = Get-Content $file -Raw - $find = "(.|\n)*?" - $replace = ''+$recName+'' - $newContenuto = $contenuto -replace $find,$replace - $newContenuto = $newContenuto.Trim() - #$newContenuto - Set-Content -Path $file -Value $newContenuto -} diff --git a/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj b/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj index 7b0e5f0d..92252e0a 100644 --- a/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj +++ b/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj @@ -472,172 +472,6 @@ Always - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Always diff --git a/IOB-WIN-NEXT/IobGeneric.cs b/IOB-WIN-NEXT/IobGeneric.cs index e0ae8c04..af16410e 100644 --- a/IOB-WIN-NEXT/IobGeneric.cs +++ b/IOB-WIN-NEXT/IobGeneric.cs @@ -6038,16 +6038,16 @@ namespace IOB_WIN_NEXT var rowStart = rawData.Where(x => x.Contains(tokenSearch)).FirstOrDefault(); if (rowStart != null) { - rawVal = rowPodl.Trim().Replace(tokenSearch, "").Replace("", ""); + rawVal = rowStart.Trim().Replace(tokenSearch, "").Replace("", ""); DateTime.TryParse(rawVal, out dtStartPOdl); } // leggo durata commessa tokenSearch = ""; var rowDurSec = rawData.Where(x => x.Contains(tokenSearch)).FirstOrDefault(); - if (rowStart != null) + if (rowDurSec != null) { - rawVal = rowPodl.Trim().Replace(tokenSearch, "").Replace("", ""); + rawVal = rowDurSec.Trim().Replace(tokenSearch, "").Replace("", ""); int.TryParse(rawVal, out duration); dtEndPOdl = dtStartPOdl.AddSeconds(duration); } @@ -6065,10 +6065,11 @@ namespace IOB_WIN_NEXT } - // registra COMUNQUE ogni record di consumo materiale + // registra COMUNQUE ogni record di consumo materiale SU REDIS e su file (???) per + // nome file | ColourCode | Description | quantità dosata (gr) bool okSync = RecipeDoSyncRecipe(""); - // archivio file in area settimanale corrispondente + // archivio file processato in area settimanale corrispondente //week = cal.GetWeekOfYear(adesso, CalendarWeekRule.FirstDay, DayOfWeek.Monday); //archPath = Path.Combine(archBasePath, $"{adesso:yyyy}", $"{week:00}"); //baseUtils.checkDir(archPath); diff --git a/IOB-WIN-NEXT/IobModbusTCPFimat.cs b/IOB-WIN-NEXT/IobModbusTCPFimat.cs index 935efb48..e91661b3 100644 --- a/IOB-WIN-NEXT/IobModbusTCPFimat.cs +++ b/IOB-WIN-NEXT/IobModbusTCPFimat.cs @@ -187,8 +187,12 @@ namespace IOB_WIN_NEXT protected override void processDataSync() { DateTime adesso = DateTime.Now; + Calendar cal = new CultureInfo("it-IT").Calendar; + int week = 0; string tempPath = Path.Combine(pathList["path-locBase"], pathList["path-01-Temp"]); - string archPath = Path.Combine(pathList["path-locBase"], pathList["path-02-Sent"], $"{adesso:yyyy}", $"{adesso:MM}"); + week = cal.GetWeekOfYear(adesso, CalendarWeekRule.FirstDay, DayOfWeek.Monday); + //string archPath = Path.Combine(pathList["path-locBase"], pathList["path-02-Sent"], $"{adesso:yyyy}", $"{adesso:MM}"); + string archPath = Path.Combine(pathList["path-locBase"], pathList["path-02-Sent"], $"{adesso:yyyy}", $"{week:00}"); string remoPath = Path.Combine(pathList["path-locBase"], pathList["path-04-remW"]); baseUtils.checkDir(tempPath); baseUtils.checkDir(archPath); diff --git a/IOB-WIN-NEXT/IobSimula.cs b/IOB-WIN-NEXT/IobSimula.cs index d60bf34f..6281ca9d 100644 --- a/IOB-WIN-NEXT/IobSimula.cs +++ b/IOB-WIN-NEXT/IobSimula.cs @@ -3,6 +3,7 @@ using MapoSDK; using Newtonsoft.Json; using System; using System.Collections.Generic; +using System.Globalization; using System.IO; using System.Linq; using static IOB_UT_NEXT.CustomObj; @@ -104,8 +105,11 @@ namespace IOB_WIN_NEXT // test ricetta if (hasRecipe) { + Calendar cal = new CultureInfo("it-IT").Calendar; + int week = cal.GetWeekOfYear(adesso, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday); string tempPath = Path.Combine(pathList["path-locBase"], pathList["path-01-Temp"]); - string archPath = Path.Combine(pathList["path-locBase"], pathList["path-02-Sent"], $"{adesso:yyyy}", $"{adesso:MM}"); + //string archPath = Path.Combine(pathList["path-locBase"], pathList["path-02-Sent"], $"{adesso:yyyy}", $"{adesso:MM}"); + string archPath = Path.Combine(pathList["path-locBase"], pathList["path-02-Sent"], $"{adesso:yyyy}", $"{week:00}"); string remoPath = Path.Combine(pathList["path-locBase"], pathList["path-04-remW"]); baseUtils.checkDir(tempPath); baseUtils.checkDir(archPath);