public IHttpActionResult Get(DateTime startdate, DateTime enddate, int?lineNumber = null, int?jobNumber = null,
                                     int?processCode = null)
        {
            InductionDowntimeResponseDto dto = _inductiondowntimedomainlogic.GetInductionDowntimeData(
                startdate, enddate, lineNumber, jobNumber, processCode);

            InductionDowntimeProcessCodeSummary summary = _inductiondowntimedomainlogic.GetProcessCodeSummary(startdate, enddate,
                                                                                                              lineNumber, jobNumber, processCode);

            return(Ok(summary));
        }
Esempio n. 2
0
        private void btnRefineSearch_Click(object sender, EventArgs e)
        {
            int?jobnumber = StrUtils.CvtStrToInt(txtJobNumber.Text, 0);

            if (jobnumber == 0)
            {
                jobnumber = null;
            }

            int?processcode = StrUtils.CvtStrToInt(txtProcessCode.Text, 0);

            if (processcode == 0)
            {
                processcode = null;
            }

            InductionDowntimeRequestObject req = new InductionDowntimeRequestObject
            {
                StartDate   = dtFrom.Value.Date,
                EndDate     = dtTo.Value.Date.AddDays(1),
                LineNumber  = StrUtils.CvtStrToInt(comboLineNumber.Text, 0),
                JobNumber   = jobnumber,
                ProcessCode = processcode
            };

            InductionDowntimeProcessCodeSummary summary = DataAccessLayer.ReadDowntimeEvents(req);

            if (summary?.DowntimeEvents != null)
            {
                PopulateEventsGrid(summary.DowntimeEvents);
            }

            if (summary != null && summary.ReportBytes != null)
            {
                SaveAndOpenReports(summary);
            }


            ////store events list locally
            //PopulateEventsGrid(resp.Orders);

            ////get loads and store them locally

            //List<long> orderpkeys = resp.Orders.Select(o => o.Pkey).ToList();

            //if (orderpkeys.Count > 0)
            //{
            //    LoadsReadRequest lreq = new LoadsReadRequest { OrderPkeys = orderpkeys, ReturnImages = true, ReturnImagesAsThumbnails = true, ReturnStatistics = false };
            //    LoadsReadResponse lresp = DAL.ReadLoads(lreq);
            //    PopulateLoadsGrid(lresp.Loads);
            //}
        }
Esempio n. 3
0
 protected ReportBase(InductionDowntimeProcessCodeSummary pcodesumm)
 {
     Config = new PdfReportConfig();
     Config.ReportCreationDateTime = DateTime.Now;
     Config.PcSumm = pcodesumm;
     if (pcodesumm.FirstDate != null)
     {
         Config.StartDate = (DateTime)pcodesumm.FirstDate;
     }
     if (pcodesumm.LastDate != null)
     {
         Config.EndDate = (DateTime)pcodesumm.LastDate;
     }
 }
Esempio n. 4
0
        private void SaveAndOpenReports(InductionDowntimeProcessCodeSummary summ)
        {
            CleanTemporaryDirectory();

            string directory = Properties.Settings.Default.TempDirectory;

            if (!Directory.Exists(directory))
            {
                Directory.CreateDirectory(directory);
            }

            string path = Path.Combine(directory, $"{summ.FurnaceLine}F-{DateTime.Now.ToFileTime()}.pdf");

            File.WriteAllBytes(path, summ.ReportBytes);
            Process.Start(path);
            Cursor = Cursors.Default;
        }
Esempio n. 5
0
        public InductionDowntimeProcessCodeSummary GetProcessCodeSummary(DateTime startdate, DateTime enddate, int?lineNumber, int?jobNumber, int?processCode)
        {
            InductionDowntimeProcessCodeSummary summary = new InductionDowntimeProcessCodeSummary();

            summary.RequestStartDate = startdate;
            summary.RequestEndDate   = enddate;
            summary.RequestJobNumber = "ALL";
            if (jobNumber != null)
            {
                summary.RequestJobNumber = jobNumber.ToString();
            }
            summary.FurnaceLine    = lineNumber ?? 0;
            summary.DowntimeEvents = _inductionDowntimeRepository.GetDownTimeEvents(
                startdate, enddate, lineNumber, jobNumber, processCode).OrderBy(x => x.SmallDateTime).ToList();
            summary.JobNumbersProcessed = summary.DowntimeEvents.Select(x => x.JobNumber).Distinct().ToList();
            summary.JobNumbersProcessed.Sort();

            InductionDownTime first = summary.DowntimeEvents.FirstOrDefault();
            InductionDownTime last  = summary.DowntimeEvents.LastOrDefault();

            if (first != null)
            {
                summary.FirstDate = first.SmallDateTime.AddHours(-first.HoursDown);
                summary.FirstDate = ((DateTime)(summary.FirstDate)).AddMinutes(-first.MinutesDown);
            }
            if (last != null)
            {
                summary.LastDate = last.SmallDateTime;
            }

            if (summary.LastDate != null && summary.FirstDate != null)
            {
                summary.TotalTimeSpan = ((DateTime)summary.LastDate).Subtract((DateTime)summary.FirstDate);
            }

            summary.ProcessCodeSummaries = _inductionDowntimeRepository.GetProcessCodeSummary(startdate, enddate, lineNumber, jobNumber, processCode);
            summary.CalculateOrderCounts();
            summary.CalculateTimeSpans();

            IndDownProcCodeSummRpt rpt = new IndDownProcCodeSummRpt(summary);

            summary.ReportBytes = rpt.BuildPdf();

            return(summary);
        }
Esempio n. 6
0
 public IndDownProcCodeSummRpt(InductionDowntimeProcessCodeSummary data)
     : base(data)
 {
     ;
 }