Пример #1
0
        /// <summary>
        /// 处理换型添加记录
        /// </summary>
        /// <param name="unit"></param>
        /// <returns></returns>
        public int ProcessAcqLineData(string lineID, string unitid, EMSUnit unit)
        {
            int ret = 0;

            try
            {
                ChangeTimeDAL dal = new ChangeTimeDAL();
                ChangeTimeMDL mdl = new ChangeTimeMDL();

                unit.SetTime = DateTime.Now;

                mdl.SetTID(unit.SetTime, lineID, unit.EMS, 0);
                mdl.PLID     = lineID;
                mdl.UNITID   = unitid;
                mdl.PER_PN   = this.ems.EMS.ToString();
                mdl.CUR_PN   = unit.EMS.ToString();
                mdl.TIME_MIG = TimeRange.ExecDateDiffSecond(this.ems.SetTime, unit.SetTime);
                mdl.PER_TIME = this.ems.SetTime;
                mdl.CUR_TIME = DateTime.Now;


                int count = dal.IsUionCOUint(unitid, lineID);

                if (count <= 0)
                {
                    mdl.SetTID(unit.SetTime, lineID, unit.EMS, 1);
                    ret = dal.AddChangeUnitItem(mdl);
                }
                else
                {
                    count += 1;
                    mdl.SetTID(unit.SetTime, lineID, unit.EMS, count);
                    ret = dal.AddChangeUnitItem(mdl);
                }


                LoadEMS(unit);

                return(ret);
            }
            catch
            {
                throw;
            }
        }
Пример #2
0
        private void IntialPalnData()
        {
            ProductLineCaculator plc = new ProductLineCaculator();

            plc.ReLoad();

            int line = Convert.ToInt32(BaseVariable.LineID);

            string plainid = DateTime.Now.ToString("yyyyMMdd") + string.Format("{0:D2}", line);

            this.planMDL = ReloadNewPlan(plainid);

            this.planMDL.PLINE = string.Format("{0:D2}", line);


            GraphPane myPane = zg1.GraphPane;

            myPane.Fill = new Fill(Color.Black);

            myPane.XAxis.Title.Text = "Section of plan";
            myPane.XAxis.Title.FontSpec.FontColor = Color.White;
            myPane.XAxis.Type         = AxisType.Date;
            myPane.XAxis.Scale.Format = "HH:mm";



            myPane.YAxis.Title.Text = "Changeover Time";
            myPane.YAxis.Title.FontSpec.FontColor = Color.White;


            int type = 1;

            List <OPMDL> opItems = null;

            if (!planMDL.GetTimeRange(1).IsInRange(DateTime.Now))
            {
                opItems = this.planMDL.OP2_ITEMS;
                type    = 2;
            }
            else
            {
                opItems = this.planMDL.OP1_ITEMS;
            }

            LineDTDAL dtDal = new LineDTDAL();

            ChangeTimeDAL ctDal = new ChangeTimeDAL();

            TimeRange tRange = new TimeRange(opItems[0].IIME_RANGE.StartTime, opItems[opItems.Count - 1].IIME_RANGE.EndTime);

            List <TimeRange> dtrangs = dtDal.GetTimeRangeByRange(this.planMDL.PLINE, tRange);



            PointPairList list       = new PointPairList();
            PointPairList changelist = new PointPairList();



            Color changeColor = Color.White;



            for (int i = 0; i < opItems.Count; i++)
            {
                int haveDt = 0;

                if (dtrangs != null && dtrangs.Count > 0)
                {
                    foreach (TimeRange item in dtrangs)
                    {
                        if (item.IsInFullRange(opItems[i].IIME_RANGE.StartTime, opItems[i].IIME_RANGE.EndTime))
                        {
                            haveDt = 1;
                            continue;
                        }
                    }
                }


                // double x = (double)i * 5.0;
                double x = (double)new XDate(opItems[i].IIME_RANGE.StartTime);

                int count = 0;

                if (haveDt <= 0)
                {
                    count = ctDal.GetChangeTime(opItems[i].LINEID.Substring(opItems[i].LINEID.Length - 2, 2), opItems[i].IIME_RANGE);
                }


                double changeOver = 0;

                if (count > 0)
                {
                    //除以分钟
                    changeOver = Math.Round((double)count / (double)60, 2);

                    if (changeOver > 18)
                    {
                        changeOver = 18;
                    }

                    if (changeOver > 10)
                    {
                        changeColor = Color.Red;
                    }
                }

                double y = 5;

                changelist.Add(x, changeOver);
                list.Add(x, y);
            }

            LineItem defualtCurve = myPane.AddCurve("Standard",
                                                    list, Color.Yellow, SymbolType.None);

            LineItem changeOverCurve = myPane.AddCurve("ChangeOver",
                                                       changelist, changeColor, SymbolType.Circle);

            // changeOverCurve.Symbol.Fill.Color = Color.White;
            changeOverCurve.Line.Width  = 2;
            changeOverCurve.Symbol.Fill = new Fill(changeColor);


            defualtCurve.Label.IsVisible    = false;
            changeOverCurve.Label.IsVisible = false;

            myPane.XAxis.Scale.FontSpec.FontColor = Color.White;
            myPane.XAxis.Title.FontSpec.FontColor = Color.White;

            myPane.XAxis.MajorGrid.IsVisible      = true;
            myPane.YAxis.Scale.FontSpec.FontColor = Color.White;
            myPane.YAxis.Title.FontSpec.FontColor = Color.White;
            myPane.YAxis.Scale.Max = 18;
            myPane.YAxis.Scale.Min = -1;



            //// Fill the axis background with a gradient
            myPane.Chart.Fill = new Fill(Color.Black, Color.Black, 45.0f);


            //// Enable scrollbars if needed
            zg1.IsShowHScrollBar  = false;
            zg1.IsShowVScrollBar  = false;
            zg1.IsAutoScrollRange = true;
            zg1.IsScrollY2        = true;

            //// OPTIONAL: Show tooltips when the mouse hovers over a point
            zg1.IsShowPointValues = true;
            zg1.PointValueEvent  += new ZedGraphControl.PointValueHandler(MyPointValueHandler);


            SetSize();

            //// Tell ZedGraph to calculate the axis ranges
            //// Note that you MUST call this after enabling IsAutoScrollRange, since AxisChange() sets
            //// up the proper scrolling parameters
            zg1.AxisChange();
            zg1.IsEnableHZoom     = false;
            zg1.IsEnableVZoom     = false;
            zg1.IsEnableWheelZoom = false;
            //// Make sure the Graph gets redrawn
            zg1.Invalidate();
        }