Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
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());
        }
Ejemplo n.º 3
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());
        }
Ejemplo n.º 4
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;
        }
Ejemplo n.º 5
0
 public MahloHub()
 {
     this.mahloServer = Program.Container.GetInstance <IMahloServer>();
     this.dbMfg       = Program.Container.GetInstance <IDbMfg>();
 }
Ejemplo n.º 6
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();
        }