Exemple #1
0
        public MachineTimeLine(BeamCutDevice device, DateTime date, int totalCutQty, int totalCutTime)
        {
            InitializeComponent();
            ViewDate    = date;
            BDevice     = device;
            Timer.Tick += Timer_Tick;
            Timer.Start();
            var Record = BeamCutQuery.GetBMachineStatistic(BDevice.id, ViewDate);

            lbBegin.Text      = ((DateTime)Record.StartTime).ToString("hh:mm:ss tt");
            lbLastUpdate.Text = ((DateTime)Record.StopTime).ToString("hh:mm:ss tt");
            UpdateCurrentDateStatistic(device, date, totalCutQty, totalCutTime);
        }
Exemple #2
0
 private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         SelectedDevice        = (listBox1.SelectedItem as BeamCutDevice);
         MachineProgressViewer = new MachineProgressViewer(SelectedDevice);
         OrderLoader.Controls.Clear();
         OrderLoader.Controls.Add(MachineProgressViewer);
         MachineProgressViewer.Dock = DockStyle.Fill;
         UpdateChart();
     }
     catch (Exception ex)
     { }
 }
Exemple #3
0
        private void UpdateChart()
        {
            if ((StartTime.Value - StopTime.Value).TotalDays > 0.2)
            {
                MessageBox.Show("Invalid time value");
                return;
            }

            try
            {
                SelectedDevice = (listBox1.SelectedItem as BeamCutDevice);
                StatisticLoader.Controls.Clear();
                BDeviceChart bDeviceChart = new BDeviceChart(StartTime.Value, StopTime.Value, SelectedDevice);
                StatisticLoader.Controls.Add(bDeviceChart);
                bDeviceChart.Dock = DockStyle.Fill;
            }
            catch { }
        }
Exemple #4
0
        public MachineProgressViewer(BeamCutDevice bmachine)
        {
            try
            {
                InitializeComponent();
                bdevice      = new BeamCutDevice();
                bdevice      = bmachine;
                BeamCutQuery = new BeamCutQuery(_SERVER.ServerName.Database);

                var orders = BeamCutQuery.GetAllBDeviceOrders(bmachine.id);
                OrderTab.Controls.Clear();
                OrderDetail = new OrderDetail(orders);
                OrderTab.Controls.Add(OrderDetail);
                OrderDetail.Dock = DockStyle.Fill;

                if (startTime.Value.DayOfYear > stopTime.Value.DayOfYear)
                {
                    return;
                }

                UpdateProgress();
            }
            catch { }
        }
Exemple #5
0
        public BDeviceChart(DateTime start, DateTime stop, BeamCutDevice device)
        {
            InitializeComponent();
            Device = device;
            MachineTimeLineForm = new MachineTimeLine();

            ZedGraphControl.GraphPane.Title.Text = $"Device: {Device.Name}";
            ZedGraphControl.MouseDoubleClick    += ZedGraphControl_MouseDoubleClick;
            ZedGraphControl.IsShowPointValues    = true;

            ZedGraphControl.GraphPane.XAxis.Title.Text = "Date";
            ZedGraphControl.GraphPane.YAxis.Title.Text = "Cut quantity (ps), Cut times (t)";

            var RecordList = BeamCutQuery.GetBDeviceStatistic(start, stop, device);

            if (RecordList == null)
            {
                return;
            }

            var pane = ZedGraphControl.GraphPane;

            pane.XAxis.MajorGrid.DashOn = 2.0F;
            pane.XAxis.MajorGrid.Color  = System.Drawing.Color.LightGray;
            pane.YAxis.MajorGrid.DashOn = 2.0F;
            pane.YAxis.MajorGrid.Color  = System.Drawing.Color.LightGray;

            pane.XAxis.Scale.IsVisible = true;
            pane.YAxis.Scale.IsVisible = true;

            pane.XAxis.MajorGrid.IsVisible = true;
            pane.YAxis.MajorGrid.IsVisible = true;


            //var pointsCurve;
            pane.XAxis.Scale.TextLabels = RecordList.Select(i => i.Date).ToArray();
            pane.XAxis.Type             = ZedGraph.AxisType.Text;

            LineItem CutQuantity = pane.AddCurve("Quantity", null, RecordList.Select(i => (double)i.TotalCutQty).ToArray(), System.Drawing.Color.DarkRed);
            LineItem CutTimes    = pane.AddCurve("Cut Times", null, RecordList.Select(i => (double)i.TotalCuttime).ToArray(), System.Drawing.Color.Blue);

            CutQuantity.Line.IsVisible = true;
            CutQuantity.Line.Width     = 1.0F;
            //Create your own scale of colors.

            CutQuantity.Symbol.Fill             = new Fill(new System.Drawing.Color[] { System.Drawing.Color.Blue, System.Drawing.Color.Green, System.Drawing.Color.Red });
            CutQuantity.Symbol.Fill.Type        = FillType.Solid;
            CutQuantity.Symbol.Type             = SymbolType.Circle;
            CutQuantity.Symbol.Border.IsVisible = true;

            CutTimes.Line.IsVisible          = true;
            CutTimes.Line.Width              = 1.0F;
            CutTimes.Symbol.Fill             = new Fill(new System.Drawing.Color[] { System.Drawing.Color.Black, System.Drawing.Color.Black, System.Drawing.Color.Black });
            CutTimes.Symbol.Fill.Type        = FillType.Solid;
            CutTimes.Symbol.Type             = SymbolType.Diamond;
            CutTimes.Symbol.Border.IsVisible = true;

            for (int i = 0; i < CutQuantity.Points.Count; i++)
            {
                var    pt   = CutQuantity.Points[i];
                string date = ZedGraphControl.GraphPane.XAxis.Scale.TextLabels[i];

                TextObj text1 = new TextObj(
                    $"{pt.Y}", pt.X, pt.Y + 0.1,
                    CoordType.AxisXYScale, AlignH.Left, AlignV.Top);
                text1.ZOrder         = ZOrder.A_InFront;
                text1.FontSpec.Angle = 0;

                pane.GraphObjList.Add(text1);

                pt = CutTimes.Points[i];
                TextObj text2 = new TextObj(
                    $"{pt.Y}", pt.X, pt.Y + 0.1,
                    CoordType.AxisXYScale, AlignH.Left, AlignV.Center);
                text2.ZOrder         = ZOrder.A_InFront;
                text2.FontSpec.Angle = 0;
                pane.GraphObjList.Add(text2);
            }

            pane.AxisChange();
            ZedGraphControl.Refresh();
            this.Controls.Add(ZedGraphControl);
            ZedGraphControl.Dock = DockStyle.Fill;
            ZedGraphControl.BringToFront();
        }
Exemple #6
0
        public List <BMachineStatistic> GetBDeviceStatistic(DateTime StartDate, DateTime StopDate, BeamCutDevice device)
        {
            try
            {
                if (StartDate == null || StopDate == null)
                {
                    return(null);
                }

                StartDate = new DateTime(StartDate.Year, StartDate.Month, StartDate.Day, 0, 0, 0);
                StopDate  = new DateTime(StopDate.Year, StopDate.Month, StopDate.Day, 23, 0, 0);

                using (BeamCutContext = new BeamCutContext(database))
                {
                    return(BeamCutContext.BMachineStatistices
                           .Where(i => (DateTime)i.StartTime >= StartDate &&
                                  StopDate >= (DateTime)i.StartTime &&
                                  i.BeamCutDevice_Id == device.id)
                           .ToList());
                }
            }
            catch { return(null); }
        }
Exemple #7
0
        void UpdateCurrentDateStatistic(BeamCutDevice device, DateTime date, int totalCutQty, int totalCutTime)
        {
            lbDate.Text         = $"Date: {date.ToString("dd/MM/yyyy")}";
            lbTotalCut.Text     = totalCutQty.ToString();
            lbTotalCutTime.Text = totalCutTime.ToString();

            var timeLine = BeamCutQuery.GetBeamCutDeviceTimeLineRecorde(device.id, date);

            ZedGraphControl ZedGraphControl = new ZedGraphControl();

            ZedGraphControl.IsShowPointValues = true;

            ZedGraphControl.GraphPane.XAxis.Title.Text = "Date";
            ZedGraphControl.GraphPane.YAxis.Title.Text = "Confirm (ps), Cut times (t)";

            var pane = ZedGraphControl.GraphPane;

            pane.XAxis.MajorGrid.DashOn = 2.0F;
            pane.XAxis.MajorGrid.Color  = Color.LightGray;
            pane.YAxis.MajorGrid.DashOn = 2.0F;
            pane.YAxis.MajorGrid.Color  = Color.LightGray;

            pane.XAxis.Scale.IsVisible = true;
            pane.YAxis.Scale.IsVisible = true;

            pane.XAxis.MajorGrid.IsVisible = true;
            pane.YAxis.MajorGrid.IsVisible = true;


            //var pointsCurve;
            pane.XAxis.Scale.TextLabels = timeLine.Select(i => i.Date).ToArray();
            pane.XAxis.Type             = ZedGraph.AxisType.Text;

            List <double> pointVal1 = new List <double>();
            List <double> pointVal2 = new List <double>();

            int index = 0;

            foreach (var item in timeLine)
            {
                pointVal1.Add(0);
                pointVal2.Add(0);

                if (item.ConfirmQuantity != null)
                {
                    pointVal1[index] = (double)item.ConfirmQuantity;
                }

                if (item.TotalCutTime != null)
                {
                    pointVal2[index] = (double)item.TotalCutTime;
                }

                index++;
            }

            LineItem ConfirmQty = pane.AddCurve("Confirm Quantity", null, pointVal1.ToArray(), Color.DarkRed, SymbolType.VDash);
            LineItem CutTimes   = pane.AddCurve("Cut Times", null, pointVal2.ToArray(), Color.Blue, SymbolType.Plus);

            ConfirmQty.Line.IsVisible = true;
            ConfirmQty.Line.Width     = 1.0F;
            //Create your own scale of colors.

            ConfirmQty.Symbol.Fill             = new Fill(new System.Drawing.Color[] { Color.DarkRed, Color.DarkRed, Color.DarkRed });
            ConfirmQty.Symbol.Fill.Type        = FillType.Solid;
            ConfirmQty.Symbol.Type             = SymbolType.Circle;
            ConfirmQty.Symbol.Border.IsVisible = true;

            CutTimes.Line.IsVisible          = true;
            CutTimes.Line.Width              = 1.0F;
            CutTimes.Symbol.Fill             = new Fill(new Color[] { Color.Blue, Color.Blue, Color.Blue });
            CutTimes.Symbol.Fill.Type        = FillType.Solid;
            CutTimes.Symbol.Type             = SymbolType.Diamond;
            CutTimes.Symbol.Border.IsVisible = true;

            pane.AxisChange();
            ZedGraphControl.Refresh();
            panel2.Controls.Clear();
            this.panel2.Controls.Add(ZedGraphControl);
            ZedGraphControl.Dock = DockStyle.Fill;
            ZedGraphControl.BringToFront();
        }