-reconnait les groupements avec CCTT

This commit is contained in:
2020-06-06 21:06:39 +02:00
parent 6b77eed770
commit b978cb6b10

View File

@@ -124,6 +124,9 @@ $A = import-csv -Path $CSVFileName -Delimiter ";" -Header $header
#$planches = $A | Where-Object planche -Match "^AK*|^BF*"
# On sélectionne uniquement les lignes dont le champ Voie/Catenaire est "V"
$planches = $A | Where-Object VC -eq "V"
#$planches = $A | Where-Object { $_.VC -eq "V" -and $_.zep -NotLike '*CCTT*' }
#$planches
$long = $planches.length
Write-host "$long planches trouvées ..."
@@ -150,8 +153,20 @@ $ope = $($operation.planche).Split(" ")[1]
# ZEP/Groupement
# ZEP 305 / GROUPEMENT 8704
#CCTT 8948 "ZEP DJ20948" (702+712+714+720+722+724+726+728)
$zep = $($operation.zep).Split(" ")[1]
# CCTT 8948 "ZEP DJ20948" (702+712+714+720+722+724+726+728)
# Zep "LAMO" CCTT 8950
# Commence par (ZEP ou Groupement) ET ne contient pas CCTT
#$zep = $($operation.zep).Split(" ")[1]
$C = $($operation.zep)
If ($C -Match '^ZEP|^Groupement' -and $C -NotLike '*CCTT*') {
#Write-host "^ZEP|^Groupement"
$zep = $C.Split(" ")[1]
}
Elseif ($C -Match '^ZEP|^Groupement' -and $C -Like '*CCTT*') {
#Write-host "CCTT"
$zep = $C
}
#$zep
# Debut
@@ -195,8 +210,16 @@ $encadrant
# Dernière ZEP
if (![string]::IsNullOrWhitespace($encadrant)) {
$derniere_zep = $($zep).Split("+")[1]
$derniere_zep
#$derniere_zep = $($zep).Split("+")[1]
#$derniere_zep
if ($zep -Match '^[0-9]') {
#$derniere_zep = $($zep).Split("+")[1]
#$derniere_zep
$derniere_zep = $($zep).Substring(0,3)
$derniere_zep
}
}
# Rptx
@@ -224,7 +247,7 @@ $ligne = "$($ope)|1|$($zep)|$($voie)|$($debut)|$($fin)|$($rptx)|$($cp)|$($tel)$t
#$dat_file = "$env:USERPROFILE\Desktop\$($filename).dat"
# On supprime les lignes dont 1 des champs est nul: rptx, cp, ope
if (![string]::IsNullOrWhitespace($rptx) -And ![string]::IsNullOrWhitespace($cp) -And ![string]::IsNullOrWhitespace($ope)) {
if (![string]::IsNullOrWhitespace($rptx) -And ![string]::IsNullOrWhitespace($cp) -And ![string]::IsNullOrWhitespace($ope) -And ![string]::IsNullOrWhitespace($zep)) {
Write-host $ligne
Add-Content $dat_file $ligne
}
@@ -234,6 +257,12 @@ $i++
Write-host "Le fichier ajt $dat_file a été crée sur le bureau."
# On choisit d'ouvrir le .dat dans Notepad pour le corriger
[string]$Open = Read-Host "Voulez-vous ouvrir le fichier ajt dans Notepad ? [o/n]"
IF ($Open -eq "o") {
#Get-Item $dat_file | notepad $dat_file
notepad $dat_file
}
[string]$Export = Read-Host "Voulez-vous exporter le fichier ajt ? [o/n]"