Anexo de documentación Autor: Daniel Hernández Jané Tutor: Juan Carlos Hernández Palacín
Índice 1. Orden de fabricación... 2 1.1. Convertidor ÖBB... 2 1.2. Convertidor Civia... 5 1.3. Convertidor Desiro... 8 2. Hojas de ruta (HR)... 11 2.1. Convertidor ÖBB... 11 2.2. Convertidor CIVIA... 15 2.3. Convertidor Desiro... 18 3. Lista de materiales... 21 4. Programación de la interfaz gráfica del Workflow... 34 1
1. Orden de fabricación 1.1. Convertidor ÖBB Figura 1: ejemplo de orden de fabricación extraída de SAP, pestaña general. Figura 2: ejemplo de orden de fabricación extraída de SAP, pestaña Asignación. 2
Figura 3: ejemplo de orden de fabricación extraída de SAP, pestaña Entrada de mercancías. Figura 4: ejemplo de orden de fabricación extraída de SAP, pestaña Control. 3
Figura 5: ejemplo de orden de fabricación extraída de SAP, pestaña Fechas / Cantidad. Figura 6: ejemplo de orden de fabricación extraída de SAP, pestaña Datos maestros. 4
1.2. Convertidor Civia Figura 7: ejemplo de orden de fabricación extraída de SAP, pestaña general. (Civia) Figura 8: ejemplo de orden de fabricación extraída de SAP, pestaña Asignación. (Civia) 5
Figura 9: ejemplo de orden de fabricación extraída de SAP, pestaña Entradas mercancías. (Civia) Figura 10: ejemplo de orden de fabricación extraída de SAP, pestaña Control. (Civia) 6
Figura 11: ejemplo de orden de fabricación extraída de SAP, pestaña Fechas / Cantidad. (Civia) Figura 12: ejemplo de orden de fabricación extraída de SAP, pestaña Datos maestros. (Civia) 7
1.3. Convertidor Desiro Figura 13: ejemplo de orden de fabricación extraída de SAP, pestaña general. (Desiro) Figura 14: ejemplo de orden de fabricación extraída de SAP, pestaña Asignación. (Desiro) 8
Figura 15: ejemplo de orden de fabricación extraída de SAP, pestaña Entrada mercancías. (Desiro) Figura 16: ejemplo de orden de fabricación extraída de SAP, pestaña Control. (Desiro) 9
Figura 17: ejemplo de orden de fabricación extraída de SAP, pestaña Fechas / Cantidad. (Desiro) Figura 18: ejemplo de orden de fabricación extraída de SAP, pestaña Datos maestros. (Desiro) 10
2. Hojas de ruta (HR) 2.1. Convertidor ÖBB HR 1: subproceso Pruebas y expedición. HR 2: subproceso Montaje. 11
HR 3: subproceso FK1 (Cable de mando). HR 4: subproceso FK2 (Cable de mando). 12
HR 5: subproceso FK3 (Cable de mando). HR 6: subproceso FK4 (Cable de mando). HR 7: subproceso FK5 (Cable de mando). 13
HR 8: subproceso FK Puentes. HR 9: subproceso Cables de potencia. HR 10: subproceso Premontajes. 14
2.2. Convertidor CIVIA HR 1: subproceso Montaje, pruebas y expedición HR 2: subproceso FK1 (Cable de mando) 15
HR 3: subproceso FK2 (Cable de mando) HR 4: subproceso FK3 (Cable de mando) HR 5: subproceso FK Puentes 16
HR 6: subproceso Cables de potencia HR 7: subproceso Premontajes 17
2.3. Convertidor Desiro HR 1: subproceso Montaje, pruebas y expedición 18
HR 2: subproceso FK1 (Cable de mando) HR 3: subproceso FK2 (Cable de mando) 19
HR 4: subproceso Cables de potencia HR 5: subproceso Premontajes 20
3. Lista de materiales Convertidor ÖBB Extracto de materiales de montaje 21
Convertidor ÖBB Extracto de materiales de cables de mando 22
Convertidor ÖBB Extracto de materiales de FK puentes 23
Convertidor ÖBB Extracto de materiales de cables de potencia 24
Convertidor ÖBB Extracto de materiales de premontajes 25
Convertidor CIVIA Extracto de materiales de montaje 26
Convertidor CIVIA Extracto de materiales de cables de mando 27
Convertidor CIVIA Extracto de materiales de FK puentes 28
Convertidor CIVIA Extracto de materiales de cables de potencia 29
Convertidor CIVIA Extracto de materiales de premontajes 30
Convertidor DESIRO Extracto de materiales de montaje 31
Convertidor DESIRO Extracto de materiales de cables de mando y FK puentes Convertidor DESIRO Extracto de materiales de cables de potencia 32
Convertidor DESIRO Extracto de materiales de premontajes 33
4. Programación de la interfaz gráfica del Workflow Seguidamente, se presenta el código resultante de la programación con Visual Studio 2010 de la interfaz gráfica sobre la que se ejecuta el Workflow (véase figura). Figura 19: Captura de la reproducción del Workflow sobre la interfaz de reproducción. using System; using System.Activities; using System.Activities.Core.Presentation; using System.Activities.Debugger; using System.Activities.Presentation; using System.Activities.Presentation.Debug; using System.Activities.Presentation.Services; using System.Activities.Tracking; using System.Activities.XamlIntegration; using System.Collections.Generic; using System.Threading; using System.Windows; using System.Windows.Controls; using System.Windows.Threading; namespace Microsoft.Samples.VisualWorkflowTracking /// <summary> /// Interaction logic for WorkflowDesignerHost.xaml /// </summary> public partial class WorkflowDesignerHost : UserControl public WorkflowDesigner WorkflowDesigner get; set; public IDesignerDebugView DebuggerService get; set; 34
TextBox tx; Dictionary<int, SourceLocation> textlinetosourcelocationmap; int i = 0; public WorkflowDesignerHost() InitializeComponent(); RegisterMetadata(); AddWorkflowDesigner(); AddTrackingTextbox(); private void RegisterMetadata() (new DesignerMetadata()).Register(); private void AddWorkflowDesigner() this.workflowdesigner = new WorkflowDesigner(); this.debuggerservice = this.workflowdesigner.debugmanagerview; this.workflowdesigner.load("workflow.xaml"); //this.workflowdesigner.load("prompt.xaml"); this.rehostgrid.children.add(this.workflowdesigner.view); //Run the Workflow with the tracking participant public void RunWorkflow() tx.text = ""; WorkflowInvoker instance = new WorkflowInvoker(GetRuntimeExecutionRoot()); //Mapping between the Object and Line No. Dictionary<object, SourceLocation> wfelementtosourcelocationmap = UpdateSourceLocationMappingInDebuggerService(); //Mapping between the Object and the Instance Id Dictionary<string, Activity> activityidtowfelementmap = BuildActivityIdToWfElementMap(wfElementToSourceLocationMap); # region Set up Custom Tracking const String all = "*"; VisualTrackingParticipant simtracker = new VisualTrackingParticipant() TrackingProfile = new TrackingProfile() Name = "CustomTrackingProfile", Queries = new CustomTrackingQuery() Name = all, ActivityName = all, new WorkflowInstanceQuery() 35
// Limit workflow instance tracking records for started and completed workflow states States = WorkflowInstanceStates.Started, WorkflowInstanceStates.Completed,, new ActivityStateQuery() // Subscribe for track records from all activities for all states ActivityName = all, States = all, // Extract workflow variables and arguments as a part of the activity tracking record // VariableName = "*" allows for extraction of all variables in the scope // of the activity Variables = all ; # endregion simtracker.activityidtoworkflowelementmap = activityidtowfelementmap; //As the tracking events are received simtracker.trackingrecordreceived += (trackingparticpant, trackingeventargs) => if (trackingeventargs.activity!= null) System.Diagnostics.Debug.WriteLine( String.Format("<+=+=+=+> Activity Tracking Record Received for ActivityId: 0, record: 1 ", trackingeventargs.activity.id, trackingeventargs.record ) ); ShowDebug(wfElementToSourceLocationMap[trackingEventArgs.Activity]); (Action)(() => this.dispatcher.invoke(dispatcherpriority.systemidle, //Textbox Updates //tx.appendtext(trackingeventargs.activity.displayname + " " + ((ActivityStateRecord)trackingEventArgs.Record).State + "\n"); if (((ActivityStateRecord)trackingEventArgs.Record).State == "Executing") tx.appendtext("ejecutando " + trackingeventargs.activity.displayname + "\n"); 36
else tx.appendtext(trackingeventargs.activity.displayname + " finalizado" + "\n"); if (trackingeventargs.activity.gettype().fullname.equals(typeof(system.activities.st atements.writeline).fullname) && ((ActivityStateRecord)trackingEventArgs.Record).State == "Executing") tx.appendtext(((system.activities.statements.writeline)(trackingeventargs.activit y)).text.expression.tostring() + "\n"); if (((ActivityStateRecord)trackingEventArgs.Record).State == "Closed") tx.appendtext("******************\n"); textlinetosourcelocationmap.add(i, wfelementtosourcelocationmap[trackingeventargs.activity]); i = i + 2; tx.scrolltoend(); visible to the user //Add a sleep so that the debug adornments are System.Threading.Thread.Sleep(1000); )); ; instance.extensions.add(simtracker); ThreadPool.QueueUserWorkItem(new WaitCallback((context) => //Invoking the Workflow Instance with Input Arguments instance.invoke(new Dictionary<string, object> "decisionvar", true, "testvar", "Prova", new TimeSpan(1, 0, 0)); //This is to remove the final debug adornment this.dispatcher.invoke(dispatcherpriority.render, (Action)(() => this.workflowdesigner.debugmanagerview.currentlocation = new SourceLocation("Workflow.xaml",1,1,1,10); //this.workflowdesigner.debugmanagerview.currentlocation = new SourceLocation("Prompt.xaml", 1, 1, 1, 10); )); )); void ShowDebug(SourceLocation srcloc) 37
this.dispatcher.invoke(dispatcherpriority.render, (Action)(() => this.workflowdesigner.debugmanagerview.currentlocation = srcloc; )); //Provide Debug Adornment on the Activity being executed void textbox1_selectionchanged(object sender, RoutedEventArgs e) string text = this.tx.text; int index = 0; int lineclicked = 0; while (index < text.length) if (text[index] == '\n') lineclicked++; if (this.tx.selectionstart <= index) break; index++; this.dispatcher.invoke(dispatcherpriority.normal, (Action)(() => try //Tell Debug Service that the Line Clicked is this.workflowdesigner.debugmanagerview.currentlocation = textlinetosourcelocationmap[lineclicked]; catch (Exception) //If the user clicks other than on the tracking records themselves. this.workflowdesigner.debugmanagerview.currentlocation = new SourceLocation("Workflow.xaml", 1, 1, 1, 10); //this.workflowdesigner.debugmanagerview.currentlocation = new SourceLocation("Prompt.xaml", 1, 1, 1, 10); )); private Dictionary<string, Activity> BuildActivityIdToWfElementMap(Dictionary<object, SourceLocation> wfelementtosourcelocationmap) Dictionary<string, Activity> map = new Dictionary<string, Activity>(); Activity wfelement; foreach (object instance in wfelementtosourcelocationmap.keys) wfelement = instance as Activity; if (wfelement!= null) 38
map.add(wfelement.id, wfelement); return map; Dictionary<object, SourceLocation> UpdateSourceLocationMappingInDebuggerService() object rootinstance = GetRootInstance(); Dictionary<object, SourceLocation> sourcelocationmapping = new Dictionary<object, SourceLocation>(); Dictionary<object, SourceLocation> designersourcelocationmapping = new Dictionary<object, SourceLocation>(); if (rootinstance!= null) Activity documentrootelement = GetRootWorkflowElement(rootInstance); SourceLocationProvider.CollectMapping(GetRootRuntimeWorkflowElement(), documentrootelement, sourcelocationmapping, this.workflowdesigner.context.items.getvalue<workflowfileitem>().loadedfile); SourceLocationProvider.CollectMapping(documentRootElement, documentrootelement, designersourcelocationmapping, this.workflowdesigner.context.items.getvalue<workflowfileitem>().loadedfile); // Notify the DebuggerService of the new sourcelocationmapping. // When rootinstance == null, it'll just reset the mapping. //DebuggerService debuggerservice = debuggerservice as DebuggerService; if (this.debuggerservice!= null) ((DebuggerService)this.DebuggerService).UpdateSourceLocations(designerSourceLocat ionmapping); return sourcelocationmapping; # region Helper Methods object GetRootInstance() ModelService modelservice = this.workflowdesigner.context.services.getservice<modelservice>(); if (modelservice!= null) return modelservice.root.getcurrentvalue(); else return null; 39
// Get root WorkflowElement. Currently only handle when the object is ActivitySchemaType or WorkflowElement. // May return null if it does not know how to get the root activity. Activity GetRootWorkflowElement(object rootmodelobject) System.Diagnostics.Debug.Assert(rootModelObject!= null, "Cannot pass null as rootmodelobject"); Activity rootworkflowelement; IDebuggableWorkflowTree debuggableworkflowtree = rootmodelobject as IDebuggableWorkflowTree; if (debuggableworkflowtree!= null) rootworkflowelement = debuggableworkflowtree.getworkflowroot(); else // Loose xaml case. rootworkflowelement = rootmodelobject as Activity; return rootworkflowelement; Activity GetRuntimeExecutionRoot() Activity root = ActivityXamlServices.Load("Workflow.xaml"); //Activity root = ActivityXamlServices.Load("Prompt.xaml"); WorkflowInspectionServices.CacheMetadata(root); return root; Activity GetRootRuntimeWorkflowElement() Activity root = ActivityXamlServices.Load("Workflow.xaml"); //Activity root = ActivityXamlServices.Load("Prompt.xaml"); WorkflowInspectionServices.CacheMetadata(root); IEnumerator<Activity> enumerator1 = WorkflowInspectionServices.GetActivities(root).GetEnumerator(); //Get the first child of the x:class enumerator1.movenext(); root = enumerator1.current; return root; void AddTrackingTextbox() tx = new TextBox(); tx.verticalscrollbarvisibility = ScrollBarVisibility.Visible; Grid.SetRow(tx, 1); Label trackrecords = new Label(); trackrecords.fontsize = 11; trackrecords.fontweight = FontWeights.Bold; trackrecords.content = "Tracking Records: "; Grid.SetRow(trackRecords, 0); this.trackingrecord.children.add(trackrecords); this.trackingrecord.children.add(tx); 40
//For Tracking Records displayed and to check which activity those records corresponds to. this.tx.selectionchanged += new RoutedEventHandler(textBox1_SelectionChanged); textlinetosourcelocationmap = new Dictionary<int, SourceLocation>(); # endregion 41