Skip to content

Commit

Permalink
Fix bug with operations automation run switch list changes
Browse files Browse the repository at this point in the history
  • Loading branch information
danielboudreau authored and danielboudreau committed Mar 5, 2021
1 parent 01628f5 commit 35a3437
Show file tree
Hide file tree
Showing 13 changed files with 172 additions and 223 deletions.
Expand Up @@ -93,20 +93,17 @@ protected void doAction(boolean isChanged) {
finishAction(false);
return;
}
location.setStatus(Location.PRINTED);
location.setSwitchListState(Location.SW_PRINTED);
InstanceManager.getDefault(TrainCustomSwitchList.class).addCVSFile(csvFile);
}
}
// Processes the CSV Manifest files using an external custom program.
boolean status = InstanceManager.getDefault(TrainCustomSwitchList.class).process();
if (status) {
try {
status = InstanceManager.getDefault(TrainCustomSwitchList.class).waitForProcessToComplete(); // wait
// up
// to
// 60
// seconds
// per
// file
// wait up to 60 seconds per file
status = InstanceManager.getDefault(TrainCustomSwitchList.class).waitForProcessToComplete();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
log.error("Thread interrupeted while waiting", e);
Expand Down
@@ -1,13 +1,14 @@
package jmri.jmrit.operations.automation.actions;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import jmri.InstanceManager;
import jmri.jmrit.operations.setup.Control;
import jmri.jmrit.operations.setup.Setup;
import jmri.jmrit.operations.trains.Train;
import jmri.jmrit.operations.trains.excel.TrainCustomManifest;
import jmri.jmrit.operations.trains.excel.TrainCustomSwitchList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class RunTrainAction extends Action {

Expand Down Expand Up @@ -43,8 +44,7 @@ public void doAction() {
finishAction(false);
return;
}
// a train needs a route in order to be built
if (train.getRoute() == null || !train.isBuilt()) {
if (!train.isBuilt()) {
log.warn("Train ({}) needs to be built before creating a custom manifest", train.getName());
finishAction(false);
return;
Expand Down
Expand Up @@ -20,7 +20,7 @@ public String getName() {
public void doAction() {
if (getAutomationItem() != null) {
Train train = getAutomationItem().getTrain();
if (train != null && train.getRoute() != null && train.isBuilt()) {
if (train != null && train.isBuilt()) {
setRunning(true);
train.terminate();
finishAction(true);
Expand Down
Expand Up @@ -40,7 +40,7 @@ RouterRouteForCar = Itin\u00e9raire pour le wagon ({0}): ({1}, {2})
RouterFindTrack = Le routeur a trouv\u00e9 {0} voie pour le wagon ({1}) destination finale ({2}, {3})
RouterFoundTrack = Le routeur a trouv\u00e9 {0} voie ({1}, {2}) pour le wagon ({3})
RouterNotFindTrain = Le routeur n'a pas pu trouver un train pour acheminer le wagon de {0} ({1}, {2}) \u00e0 ({3} {4})
RouterTrainCanTransport = Le train ({0}) peut acheminer le wagon ({1}) de {2} ({3} {4}) \u00e0 ({5}, {6})
RouterTrainCanTransport = Le train ({0}) peut acheminer le wagon ({1}) de {2} ({3}, {4}) \u00e0 ({5}, {6})
RouterTrainCanNot = Le train ({0}) ne peut pas acheminer le wagon ({1}) de ({2}, {3}) \u00e0 ({4}, {5})
RouterBeginTwoTrain = Le routeur n'a pas pu trouver un train pouvant acheminer le wagon ({0}) directement \u00e0 partir de ({1}) \u00e0 ({2}) commence deux trains de routage
RouterTrainCanService = Le train ({0}) peut acheminer le wagon ({1}) de ({2}, {3}) \u00e0 {4} ({5}, {6})
Expand Down
Expand Up @@ -360,7 +360,7 @@ NeedToBuildBeforePrinting = Need to build train ({0}) before you can {1} manif
NeedToBuildBeforeOpenFile = Need to build train ({0}) before you can open the CSV manifest file
NeedToBuildBeforeRunFile = Need to build train ({0}) before you can run the Excel program (Manifest Creator)
ManifestCreatorNotFound = Manifest Creator Excel file not found!
DirectoryNameFileName = Directory name: {0}, File name: {1}
DirectoryNameFileName = Directory name: {0} \n File name: {1}
LoadDirectoryNameFileName = You need to load the Excel File that you want to run. Directory name: {0}, File name: {1}
CanNotPrintManifest = Cannot {0} manifest
WarningTrainManifestNotPrinted = Warning, train manifest hasn't been printed!
Expand Down Expand Up @@ -792,7 +792,7 @@ buildStagingTrackRoad = Staging track ({0}) does not accept road ({1})
buildStagingTrackAllLoads = Staging track ({0}) does not accept all loads
buildStagingTrackLoad = Staging track ({0}) does not accept load ({1})
buildRouteNoDropLocation = Route ({0}) id {1} no set outs at location ({2})
buildNoAvailableMovesDest = No moves left for route ({0}) id {1} destination ({2})
buildNoAvailableMovesDest = Used {0}/{1} moves for route ({2}) id {3} destination ({4})
buildTrainRoads = Train ({0}) {1} roads: {2}
buildTrainLoads = Train ({0}) {1} loads: {2}
buildTrainOwners = Train ({0}) {1} owners: {2}
Expand Down Expand Up @@ -874,8 +874,8 @@ buildUnableNewLoadStaging = Could not generate a custom load for car ({0}) dep
buildNoDestTrackSpace = Car ({0}) would overload track ({1}, {2}), currently {3} inbound cars, length ({4}) {5}, {6}% loading from staging
buildSearchForSpur = Find spur for car ({0}) type ({1}) custom load ({2}) at ({3})
buildCouldNotFindSpur = Could not find a reachable spur for car ({0}) custom load ({1})

buildTrackModePriority = Car ({0}) on {1} track ({2}) has service order {3}
buildSortCarsByLastDate = Sort cars on FIFO and LIFO tracks:
buildTrackModePriority = Car ({0}) on {1} track ({2}) has service order {3} last moved {4}
buildTrackModeCarPriority = {0} track ({1}) in mode {2}, car ({3}) last moved {4} has priority over car ({5}) last moved {6}
buildBypassCarServiceOrder = Bypass car ({0}) on track ({1}) service order {2}
buildTrackFullHasAlternate = Spur ({0}, {1}) full, has alternate track ({2})
Expand Down Expand Up @@ -907,7 +907,7 @@ buildNoStagingForCarCustom = Couldn''t find staging that would accept car ({0})
buildCanNotDropRsUsingTrain = Can''t set out rolling stock ({0}) using {1}bound train,
buildCanNotDropRsUsingTrain2 = destination track ({0}) does not service this direction
buildCanNotDropRsUsingTrain4 = final destination track ({0}) train direction ({1}) and alternate track ({2}) train direction ({3}) aren''t compatible
buildTrackSequentialMode = Track ({0}) at ({1}) is in sequential mode and {2}
buildTrackSequentialMode = Spur ({0}) at ({1}) is in sequential mode and {2}
buildAddLocosStatus = Train weight {0} tons, ({1}) HP assigned, grade {2}%, required HPT {4} at ({5}) id {6}
buildContinueAddLocos = Train requires {0} additional HP at ({1}) destination ({2}) {3} locos in consist, continue adding locos:
buildMaxNumberLocoAssigned = The maximum number of locos allowed ({0}) have been assigned to this train
Expand Down
Expand Up @@ -328,7 +328,7 @@ NeedToBuildBeforePrinting = Need to build train ({0}) before you can {1} manif
NeedToBuildBeforeOpenFile = Need to build train ({0}) before you can open the CSV manifest file
NeedToBuildBeforeRunFile = Need to build train ({0}) before you can run the Excel program (Manifest Creator)
ManifestCreatorNotFound = Manifest Creator Excel file not found!
DirectoryNameFileName = Directory name: {0}, File name: {1}
DirectoryNameFileName = Directory name: {0} \n File name: {1}
LoadDirectoryNameFileName = You need to load the Excel File that you want to run. Directory name: {0}, File name: {1}
CanNotPrintManifest = Can not {0} manifest
WarningTrainManifestNotPrinted = Warning, train manifest hasn't been printed!
Expand Down Expand Up @@ -732,7 +732,7 @@ buildStagingTrackRoad = Staging track ({0}) does not accept road ({1})
buildStagingTrackAllLoads = Staging track ({0}) does not accept all loads
buildStagingTrackLoad = Staging track ({0}) does not accept load ({1})
buildRouteNoDropLocation = Route ({0}) id {1} no set outs at location ({2})
buildNoAvailableMovesDest = No moves left for route ({0}) id {1} destination ({2})
buildNoAvailableMovesDest = Used {0}/{1} moves for route ({2}) id {3} destination ({4})
buildTrainRoads = Train ({0}) {1} roads: {2}
buildTrainLoads = Train ({0}) {1} loads: {2}
buildTrainOwners = Train ({0}) {1} owners: {2}
Expand Down Expand Up @@ -836,7 +836,7 @@ buildNoStagingForCarCustom = Couldn''t find staging that would accept car ({0})
buildCanNotDropRsUsingTrain = Can''t set out rolling stock ({0}) using {1}bound train,
buildCanNotDropRsUsingTrain2 = destination track ({0}) does not service this direction
buildCanNotDropRsUsingTrain4 = final destination track ({0}) train direction ({1}) and alternate track ({2}) train direction ({3}) aren''t compatible
buildTrackSequentialMode = Track ({0}) at ({1}) is in sequential mode and {2}
buildTrackSequentialMode = Spur ({0}) at ({1}) is in sequential mode and {2}
buildAddLocosStatus = Train weight {0} tons, {1} HP assigned, grade {2}%, required HPT {4} at ({5}) id {6}
buildContinueAddLocos = Train requires {0} additional HP at ({1}) destination ({2}) {3} locos in consist, continue adding locos:
buildMaxNumberLocoAssigned = The maximum number of locos allowed ({0}) have been assigned to this train
Expand Down
Expand Up @@ -332,7 +332,7 @@ NeedToBuildBeforePrinting = Need to build train ({0}) before you can {1} manif
NeedToBuildBeforeOpenFile = Need to build train ({0}) before you can open the CSV manifest file
NeedToBuildBeforeRunFile = Need to build train ({0}) before you can run the Excel program (Manifest Creator)
ManifestCreatorNotFound = Manifest Creator Excel file not found!
DirectoryNameFileName = Directory name: {0}, File name: {1}
DirectoryNameFileName = Directory name: {0} \n File name: {1}
LoadDirectoryNameFileName = You need to load the Excel File that you want to run. Directory name: {0}, File name: {1}
CanNotPrintManifest = Cannot {0} manifest
WarningTrainManifestNotPrinted = Warning, train manifest hasn't been printed!
Expand Down Expand Up @@ -746,7 +746,7 @@ buildStagingTrackRoad = Staging track ({0}) does not accept road ({1})
buildStagingTrackAllLoads = Staging track ({0}) does not accept all loads
buildStagingTrackLoad = Staging track ({0}) does not accept load ({1})
buildRouteNoDropLocation = Route ({0}) id {1} no set outs at location ({2})
buildNoAvailableMovesDest = No moves left for route ({0}) id {1} destination ({2})
buildNoAvailableMovesDest = Used {0}/{1} moves for route ({2}) id {3} destination ({4})
buildTrainRoads = Train ({0}) {1} roads: {2}
buildTrainLoads = Train ({0}) {1} loads: {2}
buildTrainOwners = Train ({0}) {1} owners: {2}
Expand Down Expand Up @@ -852,7 +852,7 @@ buildNoStagingForCarLoad = Couldn''t find staging that would accept car ({0})
buildCanNotDropRsUsingTrain = Can''t set out rolling stock ({0}) using {1}bound train,
buildCanNotDropRsUsingTrain2 = destination track ({0}) does not service this direction
buildCanNotDropRsUsingTrain4 = final destination track ({0}) train direction ({1}) and alternate track ({2}) train direction ({3}) aren''t compatible
buildTrackSequentialMode = Track ({0}) at ({1}) is in sequential mode and {2}
buildTrackSequentialMode = Spur ({0}) at ({1}) is in sequential mode and {2}
buildAddLocosStatus = Zug Gewicht {0} tonne, ({1}) PS zugewiesen, Steigung {2}%, HPT ben\u00f6tigt {4} auf ({5}) ID ({6})
buildContinueAddLocos = Train requires {0} additional HP at ({1}) destination ({2}) {3} locos in consist, continue adding locos:
buildMaxNumberLocoAssigned = The maximum number of locos allowed ({0}) have been assigned to this train
Expand Down
Expand Up @@ -337,7 +337,7 @@ NeedToBuildBeforePrinting = Il est n\u00e9cessaire d'assembler le train ({0})
NeedToBuildBeforeOpenFile = Il est n\u00e9cessaire d'assembler le train ({0}) avant de pouvoir ouvrir le fichier manifeste CSV
NeedToBuildBeforeRunFile = Il est n\u00e9cessaire d'assembler le train ({0}) avant de pouvoir ex\u00e9cuter le programme Excel (Manifest Cr\u00e9ateur)
ManifestCreatorNotFound = Fichier Excel Cr\u00e9ation Manifeste pas trouv\u00e9!
DirectoryNameFileName = Nom du r\u00e9pertoire: {0}, Nom du fichier: {1}
DirectoryNameFileName = Nom du r\u00e9pertoire: {0} \n Nom du fichier: {1}
LoadDirectoryNameFileName = Vous devez charger le fichier Exce lque vous voulez ex\u00e9cuter. Nom du R\u00e9pertoire: {0}, nom du Fichier: {1}
CanNotPrintManifest = Impossible de {0} manifeste
WarningTrainManifestNotPrinted = Attention, le manifeste du train n'a pas \u00e9t\u00e9 imprim\u00e9!
Expand Down Expand Up @@ -769,7 +769,7 @@ buildStagingTrackRoad = La voie en coulisse ({0}) n'accepte pas la LIGNE
buildStagingTrackAllLoads = La voie en coulisse ({0}) n'accepte pas toutes les charges
buildStagingTrackLoad = La voie en coulisse ({0}) n'accepte pas la charge ({1})
buildRouteNoDropLocation = Itin\u00e9raire ({0}) aucune d\u00e9pose \u00e0 l'emplacement ({1})
buildNoAvailableMovesDest = Pas de mouvements disponibles pour la destination ({0})
buildNoAvailableMovesDest = Pas de mouvements disponibles pour la destination ({4})
buildTrainRoads = Train ({0}) {1} lignes: {2}
buildTrainLoads = Train ({0}) {1} charges: {2}
buildTrainOwners = Train ({0}) {1} propri\u00e9taires: {2}
Expand Down
Expand Up @@ -306,7 +306,7 @@ NeedToBuildBeforePrinting = Occorre comporre il Treno ({0}) prima di {1} il fo
NeedToBuildBeforeOpenFile = Occorre comporre il Treno ({0}) prima di poter aprire il file CSV
NeedToBuildBeforeRunFile = Occorre comporre il Treno ({0}) prima di poter eseguire il programma Excel Manifest Creator
ManifestCreatorNotFound = Manifest Creator - File Excel non trovato!
DirectoryNameFileName = Nome Directory: {0}, Nome File: {1}
DirectoryNameFileName = Nome Directory: {0} \n Nome File: {1}
LoadDirectoryNameFileName = Occorre caricare Il file Excel che vuoi eseguire. Nome Directory: {0}, Nome File: {1}
CanNotPrintManifest = Non posso {0} il foglio Ordini
WarningTrainManifestNotPrinted = Attenzione, il foglio Ordini non \u00e8 stato stampato!
Expand Down Expand Up @@ -660,7 +660,7 @@ buildStagingTrackRoad = Binario Staging ({0}) non accetta Compagnia ({1})
buildStagingTrackAllLoads = Binario Staging ({0}) non accetta tutti i Carichi
buildStagingTrackLoad = Binario Staging ({0}) non accetta Carico ({1})
buildRouteNoDropLocation = Percorso ({0}) id {1} nessuna consegna carri in localit\u00e0 ({2})
buildNoAvailableMovesDest = Nessun movimento disponibile per la destinazione ({2}) percorso ({0}) id {1}
buildNoAvailableMovesDest = Nessun movimento disponibile per la destinazione ({4}) percorso ({2}) id {3}
buildNoSpurToSpurMove = Mossa non permessa da Raccordo Locale ({0}) a Raccordo ({1})
buildNoYardToYardMove = Mossa non permessa da Scalo Locale ({0}) a Scalo ({1})
buildNoInterchangeToInterchangeMove = Mossa non permessa da Interscambio Locale ({0}) a Interscambio ({1})
Expand Down

0 comments on commit 35a3437

Please sign in to comment.