Beispiel #1
0
        public PatternRepeatLogic(
            IDbLocal dbLocal,
            CutRollList cutRolls,
            InspectionAreaList inspectionAreaList,
            ISapRollAssigner sapRollAssigner,
            IPatternRepeatSrc srcData,
            ISewinQueue sewinQueue,
            IServiceSettings serviceSettings,
            IUserAttentions <PatternRepeatModel> userAttentions,
            ICriticalStops <PatternRepeatModel> criticalStops,
            IProgramState programState,
            IScheduler scheduler)
            : base(dbLocal, srcData, sewinQueue, serviceSettings, userAttentions, criticalStops, programState, scheduler)
        {
            this.dbLocal            = dbLocal;
            this.cutRolls           = cutRolls;
            this.inspectionAreaList = inspectionAreaList;
            this.sapRollAssigner    = sapRollAssigner;
            this.serviceSettings    = serviceSettings;
            this.srcData            = srcData;
            this.sewinQueue         = sewinQueue;
            this.programState       = programState;

            this.nextCutRollId = dbLocal.GetNextCutRollId();

            this.SeamDelayLine.DelayTicks = serviceSettings.SeamToCutKnife;

            programState.Saving += this.SaveState;

            this.KeepBowAndSkewUpToDateAsync().NoWait();
        }
 public SapRollAssignerTests()
 {
     this.dbLocal = Substitute.For <IDbLocal>();
     this.dbMfg   = Substitute.For <IDbMfg>();
     this.dbMfg.GetCutRollFromHostAsync().Returns(Task.FromResult <decimal?>(1));
     this.target = new SapRollAssigner(this.dbMfg, this.dbLocal, this.scheduler);
 }
Beispiel #3
0
        public SapRollAssigner(IDbMfg dbMfg, IDbLocal dbLocal, IScheduler scheduler)
        {
            this.dbMfg     = dbMfg;
            this.dbLocal   = dbLocal;
            this.scheduler = scheduler;
            this.InitializePriorSapRollAsync().NoWait();

            this.subscription = Observable
                                .Interval(this.TryInterval, this.scheduler)
                                .Where(_ => this.cutRoll != null)
                                .Subscribe(_ => this.AssignSapRollAsync().NoWait());
        }
Beispiel #4
0
 public MahloLogic(
     IDbLocal dbLocal,
     IMahloSrc mahloSrc,
     ISewinQueue sewinQueue,
     IServiceSettings appInfo,
     IUserAttentions <MahloModel> userAttentions,
     ICriticalStops <MahloModel> criticalStops,
     IProgramState programState,
     IScheduler scheduler)
     : base(dbLocal, mahloSrc, sewinQueue, appInfo, userAttentions, criticalStops, programState, scheduler)
 {
     this.dbLocal = dbLocal;
 }
Beispiel #5
0
 public DbMfgSim(IDbLocal dbLocal)
 {
     this.SewinQueue.AddRange(dbLocal.GetRecentGreigeRolls(0));
     this.nextRollNo = dbLocal.GetNextGreigeRollId() + 1000000;
     if (this.SewinQueue.Count == 0)
     {
         this.SewinQueue.Add(new GreigeRoll
         {
             RollNo     = GreigeRoll.CheckRollId,
             RollLength = 600,
             RollWidth  = 144,
         });
     }
 }
Beispiel #6
0
 public BowAndSkewLogic(
     IDbLocal dbLocal,
     IBowAndSkewSrc dataSrc,
     ISewinQueue sewinQueue,
     IServiceSettings appInfo,
     IUserAttentions <BowAndSkewModel> userAttentions,
     ICriticalStops <BowAndSkewModel> criticalStops,
     IProgramState programState,
     IScheduler scheduler)
     : base(dbLocal, dataSrc, sewinQueue, appInfo, userAttentions, criticalStops, programState, scheduler)
 {
     this.dbLocal = dbLocal;
     this.dataSrc = dataSrc;
     this.SeamDelayLine.DelayTicks = appInfo.SeamToBowAndSkew;
 }
Beispiel #7
0
        public SewinQueue(IScheduler scheduler, IDbLocal dbLocal, IDbMfg dbMfg, IServiceSettings settings, ILogger logger)
        {
            this.dbLocal  = dbLocal;
            this.dbMfg    = dbMfg;
            this.settings = settings;
            this.logger   = logger;

            this.nextRollId     = this.dbLocal.GetNextGreigeRollId();
            this.maxRollsToKeep = settings.MaxSewinQueueRolls;
            this.Rolls.AddRange(this.dbLocal.GetRecentGreigeRolls(this.maxRollsToKeep));

            var ignoredResultTask = this.RefreshIfChangedAsync();

            this.timer = Observable
                         .Interval(RefreshInterval, scheduler)
                         .Subscribe(_ => this.RefreshIfChangedAsync().NoWait());
        }
Beispiel #8
0
 public MahloBowAndSkew(IDbLocal dbLocal)
 {
 }
Beispiel #9
0
 public Runner(IDbLocal dbLocal)
 {
     this.dbLocal = dbLocal;
 }
Beispiel #10
0
 public ProductionLine(IDbLocal dbLocal, ISewinQueue sewinQueue, IMahlo2 machlo2, IBowAndSkew bowAndSkew, IPatternRepeat patternRepeat, )
 {
     this.dbLocal    = dbLocal;
     this.sewinQueue = sewinQueue;
 }
Beispiel #11
0
        public MeterLogicTests()
        {
            const int roll1Length = 100;
            const int roll2Length = 200;
            const int roll3Length = 300;
            const int roll4Length = 400;
            const int roll5Length = 400;
            const int roll6Length = 400;
            const int roll7Length = 400;

            this.srcData        = new MockMeterSrc <MahloModel>();
            this.sewinQueue     = Substitute.For <ISewinQueue>();
            this.dbMfg          = Substitute.For <IDbMfg>();
            this.dbLocal        = Substitute.For <IDbLocal>();
            this.appInfo        = Substitute.For <IServiceSettings>();
            this.userAttentions = Substitute.For <IUserAttentions <MahloModel> >();
            this.criticalStops  = Substitute.For <ICriticalStops <MahloModel> >();

            this.appInfo.MinRollLengthForStyleAndRollCounting = 1;
            this.appInfo.MinRollLengthForLengthChecking       = 1;

            var stateProvider = Substitute.For <IProgramStateProvider>();

            stateProvider.GetProgramState().Returns("{}");
            this.programState = new ProgramState(stateProvider);

            var roll1 = new MahloService.Models.GreigeRoll()
            {
                Id         = 1,
                RollNo     = "12345",
                RollLength = roll1Length,
            };

            var roll2 = new MahloService.Models.GreigeRoll()
            {
                Id         = 2,
                RollNo     = "12346",
                RollLength = roll2Length,
            };

            var roll3 = new MahloService.Models.GreigeRoll()
            {
                Id         = 3,
                RollNo     = "12347",
                RollLength = roll3Length,
            };

            var roll4 = new MahloService.Models.GreigeRoll()
            {
                Id         = 4,
                RollNo     = "12348",
                RollLength = roll4Length,
            };

            var roll5 = new MahloService.Models.GreigeRoll()
            {
                Id         = 5,
                RollNo     = "12349",
                RollLength = roll5Length,
            };

            var roll6 = new MahloService.Models.GreigeRoll()
            {
                Id         = 6,
                RollNo     = "12350",
                RollLength = roll6Length,
            };

            var roll7 = new MahloService.Models.GreigeRoll()
            {
                Id         = 7,
                RollNo     = "12351",
                RollLength = roll7Length,
            };

            this.greigeRolls = new List <GreigeRoll> {
                roll1, roll2, roll3, roll4, roll5, roll6, roll7
            };

            this.sewinQueue.Rolls.Returns(new BindingList <GreigeRoll>(this.greigeRolls));

            this.target = new MahloLogic(this.dbLocal, this.srcData, this.sewinQueue, this.appInfo, this.userAttentions, this.criticalStops, this.programState, this.testSchedulers)
            {
                CurrentRoll = this.sewinQueue.Rolls[0]
            };

            this.sewinQueue.QueueChanged += Raise.Event <Action>();
            Assert.True(this.userAttentions.VerifyRollSequence);
            Assert.NotNull(this.target.CurrentRoll);
            this.userAttentions.ClearAll();
            this.target.Start();
        }
Beispiel #12
0
        public MeterLogic(
            IDbLocal dbLocal,
            IMeterSrc <Model> srcData,
            ISewinQueue sewinQueue,
            IServiceSettings appInfo,
            IUserAttentions <Model> userAttentions,
            ICriticalStops <Model> criticalStops,
            IProgramState programState,
            IScheduler scheduler)
        {
            this.dbLocal         = dbLocal;
            this.sewinQueue      = sewinQueue;
            this.srcData         = srcData;
            this.appInfo         = appInfo;
            this.UserAttentions  = userAttentions;
            this.CriticalStops   = criticalStops;
            this.programState    = programState;
            programState.Saving += this.SaveState;
            this.Disposables     = new List <IDisposable>
            {
                Observable
                .FromEventPattern <PropertyChangedEventHandler, PropertyChangedEventArgs>(
                    h => ((INotifyPropertyChanged)this.srcData).PropertyChanged += h,
                    h => ((INotifyPropertyChanged)this.srcData).PropertyChanged -= h)
                .Subscribe(args => this.OpcValueChanged(args.EventArgs.PropertyName)),

                Observable
                .Interval(TimeSpan.FromSeconds(1), scheduler)
                .Subscribe(_ =>
                {
                    this.Recipe       = this.srcData.Recipe;
                    this.IsManualMode = this.srcData.IsAutoMode;
                }),

                Observable
                .FromEvent(
                    h => this.sewinQueue.QueueChanged += h,
                    h => this.sewinQueue.QueueChanged -= h)
                .Subscribe(_ => this.SewinQueueChanged()),

                Observable
                .FromEventPattern <CancelEventHandler, CancelEventArgs>(
                    h => this.sewinQueue.CanRemoveRollQuery += h,
                    h => this.sewinQueue.CanRemoveRollQuery -= h)
                .Subscribe(args => args.EventArgs.Cancel    |= args.Sender == this.currentRoll),

                Observable
                .FromEventPattern <PropertyChangedEventHandler, PropertyChangedEventArgs>(
                    h => ((INotifyPropertyChanged)this.UserAttentions).PropertyChanged += h,
                    h => ((INotifyPropertyChanged)this.UserAttentions).PropertyChanged -= h)
                .Subscribe(_ =>
                {
                    this.IsMapValid &= this.UserAttentions.Any;
                    this.IsChanged   = true;
                }),

                Observable
                .FromEventPattern <PropertyChangedEventHandler, PropertyChangedEventArgs>(
                    h => ((INotifyPropertyChanged)this.CriticalStops).PropertyChanged += h,
                    h => ((INotifyPropertyChanged)this.CriticalStops).PropertyChanged -= h)
                .Subscribe(_ =>
                {
                    this.IsMapValid &= this.CriticalStops.Any;
                    this.IsChanged   = true;
                }),

                Observable
                .FromEventPattern <PropertyChangedEventHandler, PropertyChangedEventArgs>(
                    h => ((INotifyPropertyChanged)this.sewinQueue).PropertyChanged += h,
                    h => ((INotifyPropertyChanged)this.sewinQueue).PropertyChanged -= h)
                .Where(args => args.EventArgs.PropertyName == nameof(this.sewinQueue.Message))
                .Subscribe(args => this.QueueMessage = this.sewinQueue.Message),
            };
        }