Пример #1
0
        private static List <Weld> CreateWelds(List <long> pipeIDs)
        {
            List <Weld> welds = new List <Weld>();

            using (StreamWriter sw = File.CreateText(WELD_FILE))
            {
                int p = 0;

                for (int i = 0; i < parsedArgs.NumWelds; i++)
                {
                    long pipe1ID = pipeIDs[p];
                    p = (p + 1) % pipeIDs.Count;
                    long pipe2ID = pipeIDs[p];
                    Weld weld    = GenerateWeld(pipe1ID, pipe2ID);
                    welds.Add(weld);
                }
            }

            foreach (Weld weld in welds)
            {
                List <WeldPart> parts = new List <WeldPart>();

                for (int j = 0; j < NUM_WELD_PASSES; j++)
                {
                    WeldPart part = GenerateWeldPart(weld.WeldID);
                    parts.Add(part);
                }

                weld.WeldParts = parts.ToArray();
            }

            foreach (Weld weld in welds)
            {
                List <WeldInspection> inspections = new List <WeldInspection>();

                for (int j = 0; j < NUM_WELD_INSPECTIONS; j++)
                {
                    WeldInspection insp = GenerateWeldInspection(weld.WeldID);
                    inspections.Add(insp);
                }

                weld.WeldInspections = inspections.ToArray();
            }

            return(welds);
        }
Пример #2
0
        private static WeldInspection GenerateWeldInspection(long weldID)
        {
            long inspectionID = GetNextID();

            WeldInspection inspection = new WeldInspection()
            {
                WeldInspectionID = inspectionID,
                WeldID           = weldID,
                JobID            = parsedArgs.JobID,
                DateCreated      = DateTime.Now,
                LastUpdated      = DateTime.Now,
                InspectionType   = "NDE",
                Spread           = "spread 1",
                Rig           = "rig 1",
                Crew          = "crew 1",
                DatePerformed = DateTime.Now,
                InspectorName = "Lance Uppercut",
                Passed        = true,
                Delayed       = false
            };

            inspection.WeldInspectionDocuments = new WeldInspectionDocument[1];

            //half of the documents will be reference docs
            if (rand.Next() % 2 == 0)
            {
                string refNum = "refnum_" + GetNextID();
                inspection.WeldInspectionDocuments[0] = GenerateWeldInspectionDoc(inspectionID, refNum);
            }
            else
            {
                inspection.WeldInspectionDocuments[0] = GenerateWeldInspectionDoc(inspectionID);
            }

            return(inspection);
        }