Exemple #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;
        }
Exemple #2
0
        public FormSim(
            IDbMfg dbMfg,
            IMahloSrc mahloSrc,
            IBowAndSkewSrc bowAndSkewSrc,
            IPatternRepeatSrc patternRepeatSrc,
            IProgramState programState)
        {
            this.InitializeComponent();

            this.dbMfgSim         = (IDbMfgSim)dbMfg;
            this.mahloSrc         = mahloSrc;
            this.bowAndSkewSrc    = bowAndSkewSrc;
            this.patternRepeatSrc = patternRepeatSrc;
            this.programState     = programState;

            this.simInfo = new SimInfo(this.dbMfgSim, this.programState);
            this.srcSimInfo.DataSource = this.simInfo;
            this.srcFormSim.DataSource = this;
            this.srcGrid.DataSource    = this.dbMfgSim.SewinQueue;
        }
Exemple #3
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;
        }