Beispiel #1
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);
            //}
        }
Beispiel #2
0
        public static InductionDowntimeProcessCodeSummary ReadDowntimeEvents(InductionDowntimeRequestObject req)
        {
            const string uri = "InductionDowntime";


            InductionDowntimeRequestObject obj = new InductionDowntimeRequestObject
            {
                StartDate   = req.StartDate,
                EndDate     = req.EndDate,
                LineNumber  = req.LineNumber,
                JobNumber   = req.JobNumber,
                ProcessCode = req.ProcessCode,
            };

            string qs      = "?" + StrUtils.GetQueryString(obj);
            string fullurl = $"{Properties.Settings.Default.PortalUrl}{uri}{qs}";

            ServicePointManager.ServerCertificateValidationCallback = CertificateValidationCallback;
            HttpClient httpclient = new HttpClient();

            HttpResponseMessage response;

            try
            {
                response = httpclient.GetAsync(fullurl).Result;
                if (response != null && response.IsSuccessStatusCode && response.Content != null)
                {
                    return(JsonConvert.DeserializeObject <InductionDowntimeProcessCodeSummary>(response.Content.ReadAsStringAsync().Result));
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
            return(null);
        }
Beispiel #3
0
        public static List <int> ReadFurnaceLines()
        {
            const string uri = "InductionDowntime/Distinctfurnacelines/";


            InductionDowntimeRequestObject obj = new InductionDowntimeRequestObject
            {
                StartDate   = Convert.ToDateTime("2017-01-01"),
                EndDate     = Convert.ToDateTime("2100-01-01"),
                LineNumber  = null,
                JobNumber   = null,
                ProcessCode = null
            };

            string qs      = "?" + StrUtils.GetQueryString(obj);
            string fullurl = $"{Properties.Settings.Default.PortalUrl}{uri}{qs}";

            ServicePointManager.ServerCertificateValidationCallback = CertificateValidationCallback;
            HttpClient httpclient = new HttpClient();

            HttpResponseMessage response = null;

            try
            {
                response = httpclient.GetAsync(fullurl).Result;
                if (response != null && response.IsSuccessStatusCode && response.Content != null)
                {
                    return(JsonConvert.DeserializeObject <List <int> >(response.Content.ReadAsStringAsync().Result));
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
            return(null);
        }