예제 #1
0
        public SimInfo(IDbMfgSim dbMfgSim, IProgramState programState)
        {
            this.dbMfgSim     = dbMfgSim;
            this.programState = programState;
            this.SetCheckRollLength();

            this.FeetPerMinute = programState.GetSubState(nameof(SimInfo)).Get <double?>(nameof(this.FeetPerMinute)) ?? this.FeetPerMinute;
        }
예제 #2
0
        public OpcSrcSim(
            IDbMfgSim dbMfg,
            ISewinQueue sewinQueue,
            IUserAttentions <Model> userAttentions,
            ICriticalStops <Model> criticalStops,
            IOpcSettings mahloSettings,
            IProgramState programState,
            SynchronizationContext synchronizationContext,
            ILogger logger,
            IServiceSettings settings)
        {
            this.dbMfg          = dbMfg;
            this.sewinQueue     = sewinQueue;
            this.userAttentions = userAttentions;
            this.criticalStops  = criticalStops;
            this.mahloSettings  = mahloSettings;
            //this.seamSettings = seamSettings;
            this.synchronizationContext = synchronizationContext;
            this.programState           = programState;
            this.log      = logger;
            this.settings = settings;

            this.disposables.AddRange(new IDisposable[]
            {
                Observable.FromEventPattern <PropertyChangedEventHandler, PropertyChangedEventArgs>(
                    h => ((INotifyPropertyChanged)this.criticalStops).PropertyChanged += h,
                    h => ((INotifyPropertyChanged)this.criticalStops).PropertyChanged -= h)
                .Where(args => args.EventArgs.PropertyName == nameof(CriticalStops <Model> .Any))
                .Subscribe(_ => this.SetCriticalAlarmIndicator(this.criticalStops.Any)),

                Observable.FromEventPattern <PropertyChangedEventHandler, PropertyChangedEventArgs>(
                    h => ((INotifyPropertyChanged)this.userAttentions).PropertyChanged += h,
                    h => ((INotifyPropertyChanged)this.userAttentions).PropertyChanged -= h)
                .Where(args => args.EventArgs.PropertyName == nameof(UserAttentions <Model> .Any))
                .Subscribe(_ => this.SetStatusIndicator(this.userAttentions.Any)),
            });

            var state = programState.GetSubState(nameof(OpcSrcSim <Model>), typeof(Model).Name);

            this.cutRollCount           = state.Get <int?>(nameof(this.cutRollCount)) ?? 0;
            this.rollIndex              = state.Get <int?>(nameof(this.rollIndex)) ?? 0;
            this.FeetCounter            = state.Get <double?>(nameof(this.FeetCounter)) ?? this.FeetCounter;
            this.feetCounterAtRollStart = state.Get <double?>(nameof(this.feetCounterAtRollStart)) ?? this.feetCounterAtRollStart;

            //
            state = this.programState.GetSubState(nameof(MeterLogic <MahloModel>), typeof(Model).Name);
            string rollNo = state.Get <string>(nameof(GreigeRoll.RollNo)) ?? string.Empty;

            if (!string.IsNullOrEmpty(rollNo))
            {
                var currentRoll = this.sewinQueue.Rolls.FirstOrDefault(item => item.RollNo == rollNo) ?? new GreigeRoll();
                this.rollIndex = this.sewinQueue.Rolls.IndexOf(currentRoll);
            }

            programState.Saving += ps =>
            {
                ps.GetSubState(nameof(OpcSrcSim <Model>))
                .Set(typeof(Model).Name, new
                {
                    this.cutRollCount,
                    this.rollIndex,
                    this.FeetCounter,
                    this.feetCounterAtRollStart,
                });
            };

            this.isCheckRollEndSeamNeeded = this.sewinQueue.Rolls.FirstOrDefault()?.IsCheckRoll ?? false;
        }
예제 #3
0
 public void RestoreState(IProgramState state)
 {
     state           = state.GetSubState(nameof(DelayLine <T>));
     this.delayItems = state.Get <List <DelayItem> >(nameof(this.delayItems)) ?? new List <DelayItem>();
 }
예제 #4
0
 public void SaveState(IProgramState state)
 {
     state = state.GetSubState(nameof(DelayLine <T>));
     state.Set(nameof(this.delayItems), this.delayItems);
 }