Exemplo n.º 1
0
        /// <summary>
        /// This constructor creates an follow up RG report based on an existing RG Report for the same RT No.
        /// </summary>
        /// <param name="reportNo"> </param>
        /// <param name="ctx">Database Context with reference which to create the object</param>
        /// <param name="parentRGReports"> </param>
        public RGReport(List <RGReport> parentRGReports, String reportNo, RadiographyContext ctx)
        {
            if (reportNo == null)
            {
                throw new ArgumentNullException("reportNo");
            }
            var latestParent = parentRGReports.OrderByDescending(p => p.ReportDate).First();

            //all rows with some remark
            var rows = from r in parentRGReports.SelectMany(p => p.RGReportRows)
                       where r.Remark != null
                       select r;

            //latest row for each location and segment combination
            var latestRows = rows.Where(p => rows != null && !rows.Any(r => r.Location == p.Location &&
                                                                       r.Segment == p.Segment &&
                                                                       r.RGReport.ReportDate > p.RGReport.ReportDate));

            //all those that are not yet acceptable
            var neededRows = latestRows
                             .Where(p => p.Remark.Value != "ACCEPTABLE")
                             .OrderBy(p => p.FPSLNo);

            latestParent.CopyTo(this, "ID,ReportDate,RGReportRows");
            this.ReportDate   = DateTime.Now;
            this.ReportNo     = reportNo;
            this.RGReportRows = new List <RGReportRow>();
            this.RowsDeleted  = false;

            //since this is at least the second report
            this.First = false;

            //categorize this report as reshoot, and assign reshoot number
            this.ReportType      = "Reshoot";
            this.ReshootNo       = parentRGReports.Max(p => p.ReshootNo) + 1;
            this.ReportTypeAndNo = this.ReportType + "-" + this.ReshootNo.ToString();

            //only those rows to be copied from entire history which do not have acceptable against that particular location and segment
            var slNo = 1;

            foreach (var row in neededRows)
            {
                if (row.Remark.Value == "ACCEPTABLE")
                {
                    continue;
                }

                //row type for this row depends on the corresponding parent rows remarks
                var reportRow = new RGReportRow()
                {
                    RowType      = RGReportRowType.getRowType(row.Remark.Value, ctx),
                    Observations = " "
                };
                row.CopyTo(reportRow,
                           "ID,RGReport,Observations,Remark,RemarkText,ObservationsText," +
                           "Technician,TechnicianText,Welder,WelderText,RowType,ReportNo");
                reportRow.SlNo = slNo++;
                this.RGReportRows.Add(reportRow);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// This constructor creates an initial RGReport based on an existing fpTemplate. It does not check whether
        /// an existing RG Report exists, so make sure of that before calling this method
        /// </summary>
        /// <param name="fpTemplate"></param>
        /// <param name="ctx">Database Context with reference which to create the object</param>
        public RGReport(FixedPatternTemplate fpTemplate, string RTNo, string ReportNo, RadiographyContext ctx)
        {
            //shallow copy properties
            fpTemplate.CopyTo(this, "ID");
            this.DateOfTest = this.ReportDate = DateTime.Now;
            this.Shift = Shift.getShift("DAY", ctx); //defaulting so it can be saved
            this.Status = RGStatus.getStatus("CASTING UNDER REPAIR", ctx);
            this.RTNo = RTNo;
            this.ReportNo = ReportNo;

            RGReportRowType freshRowType = RGReportRowType.getRowType("FRESH", ctx);
            if (fpTemplate.FPTemplateRows == null) return;

            this.RGReportRows = new List<RGReportRow>();

            //some default values as suggested by Shankaran (10-Apr-2012)
            this.Film = "AGFA D7";
            if (fpTemplate.FixedPattern.Customer.FoundryID == 7)
            {
                this.LeadScreen = "0.25mm"; //Default for Leadscreen changed as per NEW requirements shared on 07-Jun-14.
                this.LeadScreenBack = "0.25mm"; //Default for Leadscreen changed as per NEW requirements shared on 07-Jun-14.
            }
            else if (fpTemplate.FixedPattern.Customer.FoundryID == 6)
            {
                this.LeadScreen = "0.125mm"; //Default for Leadscreen changed as per NEW requirements shared on 07-Jun-14.
                this.LeadScreenBack = "0.125mm"; //Default for Leadscreen changed as per NEW requirements shared on 07-Jun-14.
            }
            this.ReportTypeAndNo = this.ReportType = "Fresh";
            this.ReshootNo = 0; //explicitly setting this, even though this is the default value

            //since this is the first report for this FP and RT No
            this.First = true;
            this.RowsDeleted = false;
            foreach (var row in fpTemplate.FPTemplateRows.OrderBy(p => p.SlNo))
            {
                var rgReportRow = new RGReportRow
                                            {
                                                RowType = freshRowType,
                                                Energy = Energy.getEnergyForThickness(row.Thickness, ctx),
                                                Observations = " ", //for grid to work fine
                                                FilmCount = 1 // default for the new film count
                                            };
                row.CopyTo(rgReportRow, "ID,FilmSizeString");

                //for future reports, so that ordering can be done on this basis
                rgReportRow.FPSLNo = row.SlNo;

                this.RGReportRows.Add(rgReportRow);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// This constructor creates an initial RGReport based on an existing fpTemplate. It does not check whether
        /// an existing RG Report exists, so make sure of that before calling this method
        /// </summary>
        /// <param name="fpTemplate"></param>
        /// <param name="ctx">Database Context with reference which to create the object</param>
        public RGReport(FixedPatternTemplate fpTemplate, string RTNo, string ReportNo, RadiographyContext ctx)
        {
            //shallow copy properties
            fpTemplate.CopyTo(this, "ID");
            this.DateOfTest = this.ReportDate = DateTime.Now;
            this.Shift      = Shift.getShift("DAY", ctx); //defaulting so it can be saved
            this.Status     = RGStatus.getStatus("PENDING", ctx);
            this.RTNo       = RTNo;
            this.ReportNo   = ReportNo;

            RGReportRowType freshRowType = RGReportRowType.getRowType("FRESH", ctx);

            if (fpTemplate.FPTemplateRows == null)
            {
                return;
            }

            this.RGReportRows = new List <RGReportRow>();

            //some default values as suggested by Shankaran (10-Apr-2012)
            this.Film            = "AGFA D7";
            this.LeadScreen      = "0.125mm/0.25mm"; //Default for Leadscreen changed as per requirements shared on 30-Jun-12.
            this.ReportTypeAndNo = this.ReportType = "Fresh";
            this.ReshootNo       = 0;                //explicitly setting this, even though this is the default value

            //since this is the first report for this FP and RT No
            this.First       = true;
            this.RowsDeleted = false;

            foreach (var row in fpTemplate.FPTemplateRows.OrderBy(p => p.SlNo))
            {
                var rgReportRow = new RGReportRow
                {
                    RowType      = freshRowType,
                    Energy       = Energy.getEnergyForThickness(row.Thickness, ctx),
                    Observations = " ",                       //for grid to work fine
                    FilmCount    = 1                          // default for the new film count
                };
                row.CopyTo(rgReportRow, "ID,FilmSizeString");

                //for future reports, so that ordering can be done on this basis
                rgReportRow.FPSLNo = row.SlNo;

                this.RGReportRows.Add(rgReportRow);
            }
        }
        public override void AddOperation(object sender, RoutedEventArgs e)
        {
            //also give a few default empty string values so that UI copy operation is possible
            var rgReportRow = new RGReportRow
                {
                    RGReport = this.RGReport,
                    //auto increment sl no for each additional row
                    SlNo = RGReportRows.Max(p => p.SlNo) + 1,
                    Density = " ",
                    Designation = " ",
                    Location = " ",
                    Segment = " ",
                    Sensitivity = " ",
                    FilmSizeString = " ",
                    RemarkText = " ",
                    TechnicianText = " ",
                    WelderText = " ",
                    FilmCount = 1, //default value for film counts
                    RowType = ((RadiographyContext)DomainSource.DomainContext)
                        .RGReportRowTypes
                        .FirstOrDefault(p => p.Value == "FRESH")
                };

            RGReportRows.Add(rgReportRow);
            OnPropertyChanged("RGReportRows");
        }
Exemplo n.º 5
0
 private bool FilterRGReportRows(RGReportRow entity)
 {
     return (entity.RGReportID == this.ID);
 }
Exemplo n.º 6
0
 private void DetachRGReportRows(RGReportRow entity)
 {
     entity.RGReport = null;
 }
Exemplo n.º 7
0
 private void AttachRGReportRows(RGReportRow entity)
 {
     entity.RGReport = this;
 }
Exemplo n.º 8
0
        /// <summary>
        /// This constructor creates an follow up RG report based on an existing RG Report for the same RT No. 
        /// </summary>
        /// <param name="reportNo"> </param>
        /// <param name="ctx">Database Context with reference which to create the object</param>
        /// <param name="parentRGReports"> </param>
        public RGReport(List<RGReport> parentRGReports, String reportNo, RadiographyContext ctx)
        {
            if (reportNo == null) throw new ArgumentNullException("reportNo");
            var latestParent = parentRGReports.OrderByDescending(p => p.ReportDate).First();

            //all rows with some remark
            var rows = from r in parentRGReports.SelectMany(p => p.RGReportRows)
                       where r.Remark != null
                       select r;

            //latest row for each location and segment combination
            var latestRows = rows.Where(p => rows != null && !rows.Any(r => r.Location == p.Location &&
                                                                            r.Segment == p.Segment &&
                                                                            r.RGReport.ReportDate > p.RGReport.ReportDate));

            //all those that are not yet acceptable
            var neededRows = latestRows
                             .Where(p => p.Remark.Value != "ACCEPTABLE")
                             .OrderBy(p => p.FPSLNo);

            latestParent.CopyTo(this, "ID,ReportDate,RGReportRows");
            this.ReportDate = DateTime.Now;
            this.ReportNo = reportNo;
            this.RGReportRows = new List<RGReportRow>();
            this.RowsDeleted = false;

            //since this is at least the second report
            this.First = false;

            //categorize this report as reshoot, and assign reshoot number
            this.ReportType = "Reshoot";
            this.ReshootNo = parentRGReports.Max(p => p.ReshootNo) + 1;
            this.ReportTypeAndNo = this.ReportType + "-" + this.ReshootNo.ToString();

            //only those rows to be copied from entire history which do not have acceptable against that particular location and segment
            var slNo = 1;

            foreach (var row in neededRows)
            {
                if (row.Remark.Value == "ACCEPTABLE") continue;

                //row type for this row depends on the corresponding parent rows remarks
                var reportRow = new RGReportRow()
                {
                    RowType = RGReportRowType.getRowType(row.Remark.Value, ctx),
                    Observations = " "
                };
                row.CopyTo(reportRow,
                    "ID,RGReport,Observations,Remark,RemarkText,ObservationsText," +
                    "Technician,TechnicianText,Welder,WelderText,RowType,ReportNo");
                reportRow.SlNo = slNo++;
                this.RGReportRows.Add(reportRow);
            }
        }