aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/App.config
blob: 158702ed32b19c0095cba8d46422f57d2ca85333 (plain)
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.BL.Entities;
using Tango.BL.Enumerations;

namespace Tango.MachineStudio.Statistics.Models
{
    public class JobRunModel
    {
        public JobRun JobRun { get; set; }

        public Machine Machine { get; set; }

        public User User { get; set; }

        public TimeSpan? UploadDuration { get; set; }

        public TimeSpan? HeatingDuration { get; set; }

        public RmlModel Rml { get; set; }

        public String Gen
        {
            get
            {
                return JobRun.MachineTypeEnum.ToShortName();
            }
        }

        public double ActualStartPosition
        {
            get { return JobRun.MachineTypeEnum == MachineTypes.Eureka ? JobRun.ActualStartPosition * 4 : JobRun.ActualStartPosition; }
        }

        public double ActualEndPosition
        {
            get
            {
                if (JobRun.ActualEndPosition > 0)
                {
                    return JobRun.MachineTypeEnum == MachineTypes.Eureka ? JobRun.ActualEndPosition * 4 : JobRun.ActualEndPosition;
                }
                else
                {
                    return JobRun.MachineTypeEnum == MachineTypes.Eureka ? JobRun.EndPosition * 4 : JobRun.EndPosition;
                }
            }
        }

        public double Distance
        {
            get
            {
                return ActualEndPosition - ActualStartPosition;
            }
        }

        public double LogicalLengthMeters
        {
            get
            {
                return (JobRun.MachineTypeEnum == MachineTypes.Eureka ? JobRun.JobLogicalLength * 4 : JobRun.JobLogicalLength);
            }
        }

        public double ActualLength
        {
            get { return LogicalLengthMeters * JobRun.NumberOfUnits; }
        }

        public void Init()
        {
            if (JobRun.HeatingStartDate != null)
            {
                UploadDuration = JobRun.HeatingStartDate - JobRun.StartDate;
            }

            if (JobRun.ActualStartDate != null && JobRun.HeatingStartDate != null)
            {
                HeatingDuration = JobRun.ActualStartDate - JobRun.HeatingStartDate;
            }

            if (JobRun.MachineTypeEnum == MachineTypes.Eureka)
            {
                JobRun.JobLogicalLength *= 4;
                JobRun.JobLength *= 4;
                JobRun.EndPosition *= 4;
            }
        }
    }
}