Exemple #1
0
        public void QueueTablesCorrectlyCreated()
        {
            var now   = new DateTime(2018, 7, 12, 5, 6, 7, DateTimeKind.Utc);
            var matId = _log.AllocateMaterialID("uuu5", "part5", 1);
            var mat   = new LogMaterial(matId, "uuu5", 1, "part5", 1, "", "", "");

            _log.RecordAddMaterialToQueue(JobLogDB.EventLogMaterial.FromLogMat(mat), "queue", 5, now.AddHours(2));

            _log.GetMaterialInQueue("queue").Should().BeEquivalentTo(new[] {
                new JobLogDB.QueuedMaterial()
                {
                    MaterialID   = matId,
                    Queue        = "queue",
                    Position     = 0,
                    Unique       = "uuu5",
                    PartName     = "part5",
                    NumProcesses = 1,
                }
            });
        }
Exemple #2
0
        public void ConvertsMaterialFromV17()
        {
            // existing v17 file has the following data in it
            var now = new DateTime(2018, 7, 12, 5, 6, 7, DateTimeKind.Utc);

            var mat1_1 = new LogMaterial(1, "uuu1", 1, "part1", 2, "serial1", "work1", face: "A");
            var mat1_2 = new LogMaterial(1, "uuu1", 2, "part1", 2, "serial1", "work1", face: "B");
            var mat2_1 = new LogMaterial(2, "uuu1", 1, "part1", 2, "serial2", "", face: "C");
            var mat2_2 = new LogMaterial(2, "uuu1", 1, "part1", 2, "serial2", "", face: "D");
            var mat3   = new LogMaterial(3, "uuu2", 1, "part2", 1, "", "work3", face: "E");

            _log.GetLogEntries(now, now.AddDays(1)).Should().BeEquivalentTo(new[] {
                new LogEntry(
                    cntr: -1,
                    mat: new [] { mat1_1, mat2_1 },
                    pal: "3",
                    ty: LogType.MachineCycle,
                    locName: "MC",
                    locNum: 1,
                    prog: "proggg",
                    start: false,
                    endTime: now,
                    result: "result",
                    endOfRoute: false
                    ),
                new LogEntry(
                    cntr: -1,
                    mat: new [] { mat1_2, mat2_2 },
                    pal: "5",
                    ty: LogType.MachineCycle,
                    locName: "MC",
                    locNum: 1,
                    prog: "proggg2",
                    start: false,
                    endTime: now.AddMinutes(10),
                    result: "result2",
                    endOfRoute: false
                    ),
                new LogEntry(
                    cntr: -1,
                    mat: new [] { mat1_1 },
                    pal: "",
                    ty: LogType.PartMark,
                    locName: "Mark",
                    locNum: 1,
                    prog: "MARK",
                    start: false,
                    endTime: now.AddMinutes(20),
                    result: "serial1",
                    endOfRoute: false
                    ),
                new LogEntry(
                    cntr: -1,
                    mat: new [] { mat1_1 },
                    pal: "",
                    ty: LogType.OrderAssignment,
                    locName: "Order",
                    locNum: 1,
                    prog: "",
                    start: false,
                    endTime: now.AddMinutes(30),
                    result: "work1",
                    endOfRoute: false
                    ),
                new LogEntry(
                    cntr: -1,
                    mat: new [] { mat2_2 },
                    pal: "",
                    ty: LogType.PartMark,
                    locName: "Mark",
                    locNum: 1,
                    prog: "MARK",
                    start: false,
                    endTime: now.AddMinutes(40),
                    result: "serial2",
                    endOfRoute: false
                    ),
                new LogEntry(
                    cntr: -1,
                    mat: new [] { mat3 },
                    pal: "1",
                    ty: LogType.LoadUnloadCycle,
                    locName: "L/U",
                    locNum: 5,
                    prog: "LOAD",
                    start: false,
                    endTime: now.AddMinutes(50),
                    result: "LOAD",
                    endOfRoute: false
                    ),
                new LogEntry(
                    cntr: -1,
                    mat: new [] { mat3 },
                    pal: "",
                    ty: LogType.OrderAssignment,
                    locName: "Order",
                    locNum: 1,
                    prog: "",
                    start: false,
                    endTime: now.AddMinutes(60),
                    result: "work3",
                    endOfRoute: false
                    ),
            }, options =>
                                                                            options.Excluding(x => x.Counter)
                                                                            );

            _log.GetMaterialDetails(1).Should().BeEquivalentTo(new MaterialDetails()
            {
                MaterialID   = 1,
                JobUnique    = "uuu1",
                PartName     = "part1",
                NumProcesses = 2,
                Workorder    = "work1",
                Serial       = "serial1",
                Paths        = new System.Collections.Generic.Dictionary <int, int>()
            });
            _log.GetMaterialDetails(2).Should().BeEquivalentTo(new MaterialDetails()
            {
                MaterialID   = 2,
                JobUnique    = "uuu1",
                PartName     = "part1",
                NumProcesses = 2,
                Workorder    = null,
                Serial       = "serial2",
                Paths        = new System.Collections.Generic.Dictionary <int, int>()
            });
            _log.GetMaterialDetails(3).Should().BeEquivalentTo(new MaterialDetails()
            {
                MaterialID   = 3,
                JobUnique    = "uuu2",
                PartName     = "part2",
                NumProcesses = 1,
                Workorder    = "work3",
                Serial       = null,
                Paths        = new System.Collections.Generic.Dictionary <int, int>()
            });
        }