1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
|
using Ionic.Zip;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.BL;
using Tango.BL.Builders;
using Tango.BL.Entities;
using Tango.Core;
using Tango.Core.Commands;
using Tango.Explorer;
using Tango.Integration.Operation;
using Tango.Logging;
using Tango.PMR.Diagnostics;
using Tango.PMR.IFS;
using Tango.PMR.MachineStatus;
using Tango.PMR.ThreadLoading;
using Tango.PPC.Common;
using Tango.PPC.Maintenance.Commands;
using Tango.PPC.Maintenance.Dialogs;
using Tango.PPC.Maintenance.Helpers;
using Tango.PPC.Maintenance.Models;
using Tango.PPC.Maintenance.Views;
using Tango.PPC.Storage;
using Tango.Settings;
namespace Tango.PPC.Maintenance.ViewModels
{
public class MaintenanceViewVM : PPCViewModel
{
public enum Boards
{
//[Description("Main")]
//Main = 1,
[Description("Heads")]
Heads = 1,
[Description("Dryer")]
Dryer = 2,
[Description("Mid tanks")]
Midtanks = 3,
[Description("Lubricant")]
Lubricant = 4,
[Description("Dispenser 1")]
Dispenser_1 = 5,
[Description("Dispenser 2")]
Dispenser_2 = 6,
[Description("Dispenser 3")]
Dispenser_3 = 7,
[Description("Dispenser 4")]
Dispenser_4 = 8,
//[Description("Dispenser 5")]
//Dispenser_5 = 9,
//[Description("Dispenser 6")]
//Dispenser_6 = 10,
[Description("Winder 1")]
Winder_1 = 11,
[Description("Winder 2")]
Winder_2 = 12,
[Description("Winder 3")]
Winder_3 = 13,
[Description("Winder 4")]
Winder_4 = 14,
}
public class WasteStateModel : ExtendedObject
{
public class RMLDisplayModel
{
public String Name { get; set; }
public String Guid { get; set; }
public String FinalName { get; set; }
}
private CartridgeState _state;
public CartridgeState State
{
get { return _state; }
set { _state = value; RaisePropertyChangedAuto(); }
}
public CartridgeSlot Slot { get; set; }
}
public ObservableCollection<GuideBase> Guides { get; set; }
public RelayCommand<GuideBase> OpenGuideCommand { get; set; }
private List<MidTankLevelModel> _midTankLevels;
public List<MidTankLevelModel> MidTankLevels
{
get { return _midTankLevels; }
set { _midTankLevels = value; RaisePropertyChangedAuto(); }
}
private OverallTemperatureModel _overallTemperature;
public OverallTemperatureModel OverallTemperature
{
get { return _overallTemperature; }
set { _overallTemperature = value; RaisePropertyChangedAuto(); }
}
private String _totalDyeTime;
public String TotalDyeTime
{
get { return _totalDyeTime; }
set { _totalDyeTime = value; RaisePropertyChangedAuto(); }
}
private String _totalDyeMeters;
public String TotalDyeMeters
{
get { return _totalDyeMeters; }
set { _totalDyeMeters = value; RaisePropertyChangedAuto(); }
}
private SpoolState _spoolState;
public SpoolState SpoolState
{
get { return _spoolState; }
set
{
if (_spoolState != value)
{
_spoolState = value;
RaisePropertyChangedAuto();
}
}
}
private List<WasteStateModel> _wasteStates;
public List<WasteStateModel> WasteStates
{
get { return _wasteStates; }
set { _wasteStates = value; RaisePropertyChangedAuto(); }
}
private bool _isInkAutoFillingEnabled;
public bool IsInkAutoFillingEnabled
{
get { return _isInkAutoFillingEnabled; }
set { _isInkAutoFillingEnabled = value; RaisePropertyChangedAuto(); OnInkAutoFillingChanged(); }
}
public List<Boards> ListBoards { get { return typeof(Boards).GetEnumValues().Cast<Boards>().ToList(); } }
private Boards _selectedBoard;
public Boards SelecteadBoard
{
get { return _selectedBoard; }
set
{
_selectedBoard = value;
RaisePropertyChangedAuto();
}
}
public List<Rml> Rmls { get; set; }
private ObservableCollection<WasteStateModel.RMLDisplayModel> _RMLDisplayList;
public ObservableCollection<WasteStateModel.RMLDisplayModel> RMLDisplayList
{
get { return _RMLDisplayList; }
set
{
_RMLDisplayList = value;
RaisePropertyChangedAuto();
}
}
private WasteStateModel.RMLDisplayModel _selectedRML;
public WasteStateModel.RMLDisplayModel SelectedRML
{
get { return _selectedRML; }
set
{
if (_selectedRML != value)
{
_selectedRML = value;
RaisePropertyChangedAuto();
}
}
}
private String _threadLoadingStatus;
public String ThreadLoadingStatus
{
get { return _threadLoadingStatus; }
set
{
_threadLoadingStatus = value;
RaisePropertyChangedAuto();
}
}
private bool _readyForLoading;
public bool ReadyForLoading
{
get { return _readyForLoading; }
set
{
_readyForLoading = value;
RaisePropertyChangedAuto();
}
}
private bool _startedDryerWinding;
public bool StartedDryerWinding
{
get { return _startedDryerWinding; }
set
{
_startedDryerWinding = value;
RaisePropertyChangedAuto();
}
}
private bool _enableHeaters;
public bool EnableHeaters
{
get { return _enableHeaters; }
set
{
if (_enableHeaters != value)
{
_enableHeaters = value;
OnHeatersStateChanged();
RaisePropertyChangedAuto();
}
}
}
public RelayCommand ExportLogsCommand { get; set; }
public OpenCloseDyeingHeadCommand OpenCloseDyeingHeadCommand { get; set; }
public OpenCloseLeftLeadingWheelsCommand OpenCloseLeftLeadingWheelsCommand { get; set; }
public OpenCloseRightLeadingWheelsCommand OpenCloseRightLeadingWheelsCommand { get; set; }
public ResetThreadLoadingCommand ResetThreadLoadingCommand { get; set; }
public RelayCommand HeadCleaningCommand { get; set; }
public RelayCommand StartThreadLoadingCommand { get; set; }
public RelayCommand StartThreadBreakCommand { get; set; }
public RelayCommand DispenseCleanerLiquidCommand { get; set; }
public RelayCommand ViewBitResultsCommand { get; set; }
public RelayCommand ResetBoardCommand { get; set; }
public RelayCommand MoveToLoadPositionCommand { get; set; }
public RelayCommand StartDryerWindingCommand { get; set; }
public RelayCommand AbortThreadLoadingCommand { get; set; }
private bool _canAbortThreadLoading;
public bool CanAbortThreadLoading
{
get { return _canAbortThreadLoading; }
set { _canAbortThreadLoading = value; RaisePropertyChangedAuto(); }
}
public MaintenanceViewVM()
{
Guides = new ObservableCollection<GuideBase>(GuideHelper.CreateAllGuides());
OverallTemperature = new OverallTemperatureModel();
OpenGuideCommand = new RelayCommand<GuideBase>(OpenGuide);
ExportLogsCommand = new RelayCommand(ExportLogsToStorage);
OpenCloseDyeingHeadCommand = new OpenCloseDyeingHeadCommand();
OpenCloseLeftLeadingWheelsCommand = new OpenCloseLeftLeadingWheelsCommand();
OpenCloseRightLeadingWheelsCommand = new OpenCloseRightLeadingWheelsCommand();
ResetThreadLoadingCommand = new ResetThreadLoadingCommand();
HeadCleaningCommand = new RelayCommand(PerformHeadCleaning, () => MachineProvider.MachineOperator.CanPrint);
StartThreadLoadingCommand = new RelayCommand(StartThreadLoadingWizard, () => MachineProvider.MachineOperator.CanPrint);
StartThreadBreakCommand = new RelayCommand(StartThreadBreakWizard, () => MachineProvider.MachineOperator.CanPrint);
ViewBitResultsCommand = new RelayCommand(ViewBitResult, () => MachineProvider.MachineOperator.IsConnected);
ResetBoardCommand = new RelayCommand(RunReset, () => MachineProvider.MachineOperator.IsConnected);
MoveToLoadPositionCommand = new RelayCommand(MoveToLoadPosition, () => { return MachineProvider.MachineOperator.IsConnected && MachineProvider.MachineOperator.CanPrint && false == StartedDryerWinding; });
StartDryerWindingCommand = new RelayCommand(StartDryerWinding, () => ReadyForLoading);
WasteStates = new List<WasteStateModel>()
{
new WasteStateModel() { Slot = CartridgeSlot.WasteMiddle, State = CartridgeState.Absent },
new WasteStateModel() { Slot = CartridgeSlot.WasteLower, State = CartridgeState.Absent }
};
SelecteadBoard = Boards.Dryer;
ReadyForLoading = false;
AbortThreadLoadingCommand = new RelayCommand(AbortThreadLoading);
}
public override void OnApplicationStarted()
{
MachineProvider.MachineOperator.InkFillingStatusChanged += MachineOperator_InkFillingStatusChanged;
MachineProvider.MachineOperator.MachineStatusChanged += MachineOperator_MachineStatusChanged;
MachineProvider.MachineOperator.MachineEventsStateProvider.EventsChanged += MachineEventsStateProvider_EventsChanged;
MachineProvider.MachineOperator.ThreadLoadingStatusChanged += MachineOperator_ThreadLoadingStatusChanged;
DispenseCleanerLiquidCommand = new RelayCommand(DispenseCleanerLiquid, () =>
{
if (MachineProvider.Machine.MachineHeadType == BL.Enumerations.HeadTypes.Arc)
{
return MachineProvider.MachineOperator.MachineEventsStateProvider.Events.Any(x => x.Type == BL.Enumerations.EventTypes.DYEING_HEAD_ARC_LID_IS_OPEN);
}
else
{
return MachineProvider.MachineOperator.MachineEventsStateProvider.Events.Any(x => x.Type == BL.Enumerations.EventTypes.DYEING_HEAD_COVER_IS_OPEN);
}
});
RaisePropertyChanged(nameof(DispenseCleanerLiquidCommand));
_enableHeaters = true;
RaisePropertyChanged(nameof(EnableHeaters));
}
public async void CresteRMLS()
{
using (ObservablesContext db = ObservablesContext.CreateDefault())
{
LogManager.Log("Loading RMLS...");
Rmls = (await new RmlsCollectionBuilder(db).SetAll().WithActiveParametersGroup().ForHeadType(MachineProvider.Machine.MachineHeadType).ForSite(MachineProvider.Machine.SiteGuid).BuildAsync()).OrderBy(x => x.FinalName).ToList();
//Rmls = (await new RmlsCollectionBuilder(db).SetAll().WithActiveParametersGroup().BuildAsync()).OrderBy(x => x.FinalName).ToList();
RMLDisplayList = Rmls.Select(p => new WasteStateModel.RMLDisplayModel { Guid = p.Guid, Name = p.Name, FinalName = p.FinalName }).OrderBy(x => x.FinalName).ToObservableCollection();
SelectedRML = RMLDisplayList.FirstOrDefault();
}
}
public override void OnApplicationReady()
{
base.OnApplicationReady();
MidTankLevels = MachineProvider.Machine.Configuration.NoneEmptyIdsPacks.Where(x => x.MidTankType.HasLevelMeasure).OrderBy(x => x.PackIndex).Select(x => new MidTankLevelModel()
{
Max = MachineOperator.MAX_MIDTANK_LITERS,
IDSPack = x,
}).OrderBy(y => y.IDSPack.LiquidType.Code).ToList();
if (Rmls == null)
CresteRMLS();
}
private void MachineEventsStateProvider_EventsChanged(object sender, IEnumerable<BL.Entities.MachinesEvent> e)
{
OpenCloseDyeingHeadCommand.IsEnabled = !e.Any(x => x.Type == BL.Enumerations.EventTypes.DRYER_DOOR_OPEN);
InvokeUI(() =>
{
DispenseCleanerLiquidCommand.RaiseCanExecuteChanged();
});
}
private void MachineOperator_MachineStatusChanged(object sender, MachineStatus status)
{
UpdateMidTankLevels(status);
OverallTemperature.Temperature = status.OverallTemperature;
SpoolState = status.SpoolState;
_isInkAutoFillingEnabled = status.AutoInkFillingEnabled;
RaisePropertyChanged(nameof(IsInkAutoFillingEnabled));
InvalidateRelayCommands();
}
private void MachineOperator_InkFillingStatusChanged(object sender, InkFillingStatusChangedEventArgs e)
{
foreach (var cartridge in e.Status.CartridgesStatuses.Where(x => x.Cartridge.Slot != CartridgeSlot.Ink))
{
var wasteState = WasteStates.SingleOrDefault(x => x.Slot == cartridge.Cartridge.Slot);
if (wasteState != null)
{
wasteState.State = cartridge.State;
}
}
}
private void MachineOperator_ThreadLoadingStatusChanged(object sender, StartThreadLoadingResponse e)
{
if (e != null)
{
var State = e.State;
switch (e.State)
{
case ThreadLoadingState.Preparing:
{
ThreadLoadingStatus = "Moving to load position";
break;
}
case ThreadLoadingState.ReadyForLoading:
{
ReadyForLoading = true;
ThreadLoadingStatus = "Ready for thread loading.";
break;
}
case ThreadLoadingState.PreparationError:
{
ThreadLoadingStatus = "Failed to move. Please inspect and try again.";
break;
}
case ThreadLoadingState.Finalizing:
{
ThreadLoadingStatus = "Thread loading is running.";
ReadyForLoading = false;
break;
}
case ThreadLoadingState.FinalizationError:
{
ThreadLoadingStatus = $"Thread loading failed.{e.ErrorReason}";
ReadyForLoading = false;
StartedDryerWinding = false;
break;
}
case ThreadLoadingState.Completed:
{
ReadyForLoading = false;
StartedDryerWinding = false;
ThreadLoadingStatus = "Thread loading completed successfully.";
break;
}
default:
{
ThreadLoadingStatus = "";
StartedDryerWinding = false;
return;
}
};
if (e.State != ThreadLoadingState.None && e.State != ThreadLoadingState.Completed)
{
CanAbortThreadLoading = true;
}
}
}
public async void OpenGuide(GuideBase guide)
{
await NavigationManager.NavigateWithObject<MaintenanceModule, GeneralGuideView, GuideBase>(guide);
}
private void UpdateMidTankLevels(MachineStatus status)
{
if (IsVisible)
{
foreach (var item in status.IDSPacksLevels)
{
var model = MidTankLevels.SingleOrDefault(x => x.IDSPack.PackIndex == item.Index);
if (model != null)
{
model.Level = item.MidTankLevel;
}
}
}
}
private async void ExportLogsToStorage()
{
var result = await NavigationManager.
NavigateForResult<StorageModule,
Storage.Views.MainView, ExplorerFileItem,
Storage.Models.StorageNavigationRequest>(
new Storage.Models.StorageNavigationRequest()
{
Intent = Storage.Models.StorageNavigationIntent.SaveFile,
DefaultFileName = $"Tango-Logs-{DateTime.Now.ToFileName()}",
Filter = "do not display anything",
Title = "Export System Logs",
});
if (result != null)
{
String file = result.Path + ".zip";
IsFree = false;
try
{
NotificationProvider.SetGlobalBusyMessage("Exporting system logs...");
var appFileLogger = LogManager.RegisteredLoggers.FirstOrDefault(x => x is FileLogger) as FileLogger;
await Task.Factory.StartNew(() =>
{
using (ZipFile zip = new ZipFile(file))
{
zip.Password = "1Creativity";
if (appFileLogger != null)
{
zip.AddDirectory(appFileLogger.Folder);
}
zip.ParallelDeflateThreshold = -1;
zip.Save();
}
});
NotificationProvider.ReleaseGlobalBusyMessage();
await NotificationProvider.ShowSuccess("System logs exported successfully.");
}
catch (Exception ex)
{
NotificationProvider.ReleaseGlobalBusyMessage();
LogManager.Log(ex, "Error exporting system logs.");
await NotificationProvider.ShowError($"An error occurred while trying to export the system logs.\n{ex.FlattenMessage()}");
}
finally
{
NotificationProvider.ReleaseGlobalBusyMessage();
IsFree = true;
}
}
}
public async override void OnNavigatedTo()
{
base.OnNavigatedTo();
try
{
using (ObservablesContext db = ObservablesContext.CreateDefault())
{
var jobRuns = await db.JobRuns.Select(x => new { x.StartDate, x.EndDate, x.EndPosition }).ToListAsync();
TotalDyeTime = TimeSpan.FromHours(jobRuns.Select(x => x.EndDate - x.StartDate).Sum(x => x.TotalHours)).ToStringUnlimitedHours();
int meters = (int)jobRuns.Select(x => x.EndPosition).Sum();
TotalDyeMeters = $"{meters.ToString("N0")} meters";
}
}
catch (Exception ex)
{
LogManager.Log(ex, "Error loading machine counters.");
TotalDyeTime = "error!";
TotalDyeMeters = "error!";
}
}
private async void PerformHeadCleaning()
{
await NotificationProvider.ShowDialog<HeadCleaningViewVM>();
}
private void StartThreadLoadingWizard()
{
ThreadLoadingService.StartThreadLoadingWizard();
}
private void StartThreadBreakWizard()
{
ThreadLoadingService.StartThreadBreakWizard();
}
private async void DispenseCleanerLiquid()
{
await NotificationProvider.ShowDialog<CleanerDispensingViewVM>();
}
private async void OnInkAutoFillingChanged()
{
if (IsInkAutoFillingEnabled)
{
try
{
NotificationProvider.SetGlobalBusyMessage("Enabling auto ink filling...");
await MachineProvider.MachineOperator.SendRequest<SetInkAutoFillingModeRequest, SetInkAutoFillingModeResponse>(new SetInkAutoFillingModeRequest()
{
Enable = true
});
}
catch (Exception ex)
{
LogManager.Log(ex, "Error enabling auto ink filling.");
_isInkAutoFillingEnabled = false;
RaisePropertyChanged(nameof(IsInkAutoFillingEnabled));
await NotificationProvider.ShowError($"Error enabling auto ink filling.\n{ex.Message}");
}
finally
{
NotificationProvider.ReleaseGlobalBusyMessage();
}
}
else
{
try
{
NotificationProvider.SetGlobalBusyMessage("Disabling auto ink filling...");
await MachineProvider.MachineOperator.SendRequest<SetInkAutoFillingModeRequest, SetInkAutoFillingModeResponse>(new SetInkAutoFillingModeRequest()
{
Enable = false
});
}
catch (Exception ex)
{
LogManager.Log(ex, "Error disabling auto ink filling.");
_isInkAutoFillingEnabled = true;
RaisePropertyChanged(nameof(IsInkAutoFillingEnabled));
await NotificationProvider.ShowError($"Error disabling auto ink filling.\n{ex.Message}");
}
finally
{
NotificationProvider.ReleaseGlobalBusyMessage();
}
}
}
private async void ViewBitResult()
{
await BitManager.ShowBitResultsDialog();
}
private async void RunReset()
{
try
{
await MachineProvider.MachineOperator.ResetCard(SelecteadBoard.ToInt32());
await NotificationProvider.ShowInfo($"The {SelecteadBoard.ToDescription()} was reset successfully!");
}
catch (Exception ex)
{
await NotificationProvider.ShowError($"We could not reset the {SelecteadBoard.ToDescription()}.\n{ex.FlattenMessage()}");
}
}
private void MoveToLoadPosition()
{
MachineProvider.MachineOperator.StartThreadLoading();
}
private async void AbortThreadLoading()
{
if (CanAbortThreadLoading)
{
try
{
CanAbortThreadLoading = false;
ThreadLoadingStatus = "Aborting thread loading...";
await MachineProvider.MachineOperator.AbortThreadLoading();
await Task.Delay(1000);
ThreadLoadingStatus = "Thread loading aborted";
}
catch (Exception ex)
{
LogManager.Log(ex, "Error aborting thread loading.");
CanAbortThreadLoading = true;
}
}
}
private void StartDryerWinding()
{
try
{
var rml = Rmls.Where(x => x.Guid == SelectedRML.Guid).FirstOrDefault();
if (rml != null && rml.GetActiveProcessGroup() != null)
{
var processParametersTable = rml.GetActiveProcessGroup().ProcessParametersTables.FirstOrDefault();
if (processParametersTable != null)
{
StartedDryerWinding = true;
MachineProvider.MachineOperator.ContinueThreadLoading(processParametersTable.Clone());
}
}
}
catch (Exception)
{
StartedDryerWinding = false;
}
}
private async void OnHeatersStateChanged()
{
if (EnableHeaters == false)//turn off heaters
{
try
{
await MachineProvider.MachineOperator.UploadProcessParameters(new ProcessParametersTable());
}
catch (Exception ex)
{
LogManager.Log(ex, "Error resetting process parameters.");
}
}
else
{
try
{
var currentProcessParameters = MachineProvider.MachineOperator.CurrentProcessParameters;
if (currentProcessParameters == null || currentProcessParameters.Guid == null)
{
var settings = SettingsManager.Default.GetOrCreate<MaitenanceModuleSettings>();
var defRmlGuid = Settings.DefaultRmlGuid ?? Rmls.First().Guid;
var rml = Rmls.Where(x => x.Guid == defRmlGuid).FirstOrDefault();
if (rml != null && rml.GetActiveProcessGroup() != null)
{
currentProcessParameters = rml.GetActiveProcessGroup().ProcessParametersTables.FirstOrDefault();
}
}
if (currentProcessParameters != null)
{
await MachineProvider.MachineOperator.UploadProcessParameters(currentProcessParameters);
}
}
catch (Exception ex)
{
LogManager.Log(ex, "Error upload process parameters.");
}
}
}
}
}
|