Exemplo n.º 1
0
 public ParetoDataType(SPC.Controls.Base.CanChooseDataGridView view, string param, int groupType, int cuType)
 {
     this.View = view;
     this.Param = param;
     this.GroupType = groupType;
     this.CuType = cuType;
 }
Exemplo n.º 2
0
        //---------------------------------------------------------------------------
        public void fn_LotEnd()
        {
            m_tEndTime = DateTime.Now;

            //Lot Data Save...


            fn_WriteLog(string.Format($"[Lot End] Recipe : {m_sRecipeName} / LOT : {m_sLotNo}"), EN_LOG_TYPE.ltLot);

            m_dLotEndTime = TICK._GetTickTime();

            double dRunTotal = (double)TICK.ConvTimetoSec(m_dLotEndTime - m_dLotStartTime);

            m_sLogMsg = string.Format($"[Lot Run Time] {TICK.ConvTimeTickToStr(m_dLotEndTime - m_dLotStartTime)} / {dRunTotal} sec");
            fn_WriteLog(m_sLogMsg, EN_LOG_TYPE.ltLot);
            Console.WriteLine(m_sLogMsg);

            m_sLogMsg = string.Format($" -------------- UPH : {SPC.CalUPH(dRunTotal, 1).ToString("0.0000")} -------------- ");
            fn_WriteLog(m_sLogMsg, EN_LOG_TYPE.ltLot);
            Console.WriteLine(m_sLogMsg);

            //Clear Lot info
            m_bLotOpen    = false;
            m_sRecipeName = string.Empty;
            //m_sLotNo      = string.Empty;
        }
Exemplo n.º 3
0
 public MonitorSourceDataType(SPC.Controls.Base.CanChooseDataGridView view, string param, int groupType, string spectrumWith)
 {
     this.View = view;
     this.Param = param;
     this.GroupType = groupType;
     this.SpectrumWith = spectrumWith;
 }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            var spc     = new SPC();
            var serasa  = new Serasa();
            var credito = new Credito();

            var cliente = new Cliente("12345678911", "Fulano");

            var restricao = false;

            restricao = spc.Consulta(cliente.CPF);
            restricao = serasa.Consulta(cliente.CPF);

            if (restricao)
            {
                Console.WriteLine("Cliente com restrição...");
                return;
            }

            var limiteCredito = credito.LimiteCredito(cliente.CPF);

            Console.WriteLine("Cliente {0} possui limite de crédito no valor de: {1}", cliente.Nome, limiteCredito);


            /*
             * veja a complexisdade que ficou o método acima. O objetivo do Facade/Fachada é limpar isso, abstraindo
             * as operações em um nível mais alto para o usuário.
             *
             * Implementar esse padrão será como implementar um Handler/Manipulador, como fazemos ao aplicar o Domain
             * Driven Design (DDD).
             */
        }
Exemplo n.º 5
0
        /// <summary>
        /// Compares this option series to another one by its attributes.
        /// Expiration takes precedence in comparison.
        /// </summary>
        /// <param name="other">another option series to compare with.</param>
        /// <returns>result of comparison.</returns>
        public int CompareTo(OptionSeries other)
        {
            if (Expiration < other.Expiration)
            {
                return(-1);
            }
            if (Expiration > other.Expiration)
            {
                return(1);
            }
            if (LastTrade < other.LastTrade)
            {
                return(-1);
            }
            if (LastTrade > other.LastTrade)
            {
                return(1);
            }
            int i = Multiplier.CompareTo(other.Multiplier);

            if (i != 0)
            {
                return(i);
            }
            i = SPC.CompareTo(other.SPC);
            if (i != 0)
            {
                return(i);
            }
            i = AdditionalUnderlyings.CompareTo(other.AdditionalUnderlyings);
            if (i != 0)
            {
                return(i);
            }
            i = MMY.CompareTo(other.MMY);
            if (i != 0)
            {
                return(i);
            }
            i = OptionType.CompareTo(other.OptionType);
            if (i != 0)
            {
                return(i);
            }
            i = ExpirationStyle.CompareTo(other.ExpirationStyle);
            if (i != 0)
            {
                return(i);
            }
            i = SettlementStyle.CompareTo(other.SettlementStyle);
            if (i != 0)
            {
                return(i);
            }
            return(CFI.CompareTo(other.CFI));
        }
Exemplo n.º 6
0
 public object GetInfoValue(SPC key)
 {
     if (useInfo == null)
     {
         return(0f);
     }
     if (!useInfo.ContainsKey((int)key))
     {
         return(0f);
     }
     return(useInfo[(int)key]);
 }
Exemplo n.º 7
0
 public static double[] Count(SPC.Base.Interface.IDataTable<DataRow> input, string[] columns)
 {
     int count = input.RowCount;
     int length = columns.Length;
     double[] result = new double[length];
     int i;
     for (i = 0; i < length; i++)
     {
         result[i] = count;
     }
     return result;
 }
Exemplo n.º 8
0
 public void Init(DataSet result,SPC.Base.Interface.IDataTable<DataRow> data)
 {
     this.Result = result;
     this.Data = data;
     this.gridControl2.DataSource = Result;
     this.gridControl2.DataMember = "Results";
     this.gridControl1.DataSource = Result;
     this.gridControl1.DataMember = "OverView";
     this.gridView2.Columns.ColumnByFieldName("序号").Visible = false;
     this.gridView2.GroupSummary.Clear();
     this.gridView2.GroupSummary.Add(new DevExpress.XtraGrid.GridGroupSummaryItem(DevExpress.Data.SummaryItemType.Count, this.gridView2.Columns[0].FieldName, null, "Count:{0}"));
     gridView1.FocusedRowHandle = 0;
     (this.gridView2.DataSource as DataView).RowFilter = "序号 = " + gridView1.GetDataRow(0)[0].ToString();
 }
Exemplo n.º 9
0
        public void ParseInfo(Hashtable info)
        {
            if (members == null)
            {
                members = new Dictionary <string, GuildMember>();
            }
            members.Clear();

            SPC lastParameter = SPC.Id;

            try {
                ownerCharacterID = info.GetValue <string>((int)SPC.Id, string.Empty);

                lastParameter = SPC.GuildRating;
                rating        = info.GetValue <int>((int)SPC.GuildRating, 0);

                lastParameter = SPC.Race;
                guildRace     = info.GetValue <int>((int)SPC.Race, (int)Race.None);

                lastParameter = SPC.Description;
                description   = info.GetValue <string>((int)SPC.Description, string.Empty);

                lastParameter = SPC.Name;
                name          = info.GetValue <string>((int)SPC.Name, string.Empty);

                lastParameter = SPC.ModerCount;
                moderCount    = info.GetValue <int>((int)SPC.ModerCount, 0);

                lastParameter = SPC.MaxModerCount;
                maxModerCount = info.GetValue <int>((int)SPC.MaxModerCount, 0);
            } catch (Exception exception) {
                throw new NebulaException(string.Format("last not handled key = {0}", lastParameter));
            }

            opened = info.GetValue <bool>((int)SPC.Opened, true);

            Hashtable membersHash = info.Value <Hashtable>((int)SPC.Members) as Hashtable;

            if (membersHash == null)
            {
                return;
            }

            foreach (DictionaryEntry entry in membersHash)
            {
                string    memberCharacterID   = entry.Key.ToString();
                Hashtable memberCharacterInfo = entry.Value as Hashtable;
                members.Add(memberCharacterID, new GuildMember(memberCharacterInfo));
            }
        }
Exemplo n.º 10
0
 public static double[] IsNull(SPC.Base.Interface.IDataTable<DataRow> input, string[] columns)
 {
     int count = input.RowCount;
     int length = columns.Length;
     double[] result = new double[length];
     int i, j;
     DataRow temprow;
     for (i = 0; i < count; i++)
     {
         temprow = input[i];
         for (j = 0; j < length; j++)
         {
             if (temprow[columns[j]] == null || temprow[columns[j]] == DBNull.Value)
                 result[j]++;
         }
     }
     return result;
 }
Exemplo n.º 11
0
 public static double[] Avg(SPC.Base.Interface.IDataTable<DataRow> input, string[] columns)
 {
     int count = input.RowCount;
     int length = columns.Length;
     double[] result = new double[length];
     int i, j;
     DataRow temprow;
     for (i = 0; i < count; i++)
     {
         temprow = input[i];
         for (j = 0; j < length; j++)
         {
             result[j] += temprow[columns[j]].ConvertToDouble();
         }
     }
     for (j = 0; j < length; j++)
     {
         result[j] = result[j]/count;
     }
     return result;
 }
Exemplo n.º 12
0
        /// <summary>
        /// Indicates whether some other object is equal to this option series by its attributes.
        /// </summary>
        /// <param name="o"></param>
        /// <returns>another object to compare with.</returns>
        public override bool Equals(object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (!(o is OptionSeries))
            {
                return(false);
            }
            OptionSeries that = (OptionSeries)o;

            return(Expiration == that.Expiration &&
                   LastTrade == that.LastTrade &&
                   Multiplier.CompareTo(that.Multiplier) == 0 &&
                   SPC.CompareTo(that.SPC) == 0 &&
                   AdditionalUnderlyings.Equals(that.AdditionalUnderlyings) &&
                   ExpirationStyle.Equals(that.ExpirationStyle) &&
                   MMY.Equals(that.MMY) &&
                   OptionType.Equals(that.OptionType) &&
                   CFI.Equals(that.CFI) &&
                   SettlementStyle.Equals(that.SettlementStyle));
        }
Exemplo n.º 13
0
 public static double[] Max(SPC.Base.Interface.IDataTable<DataRow> input, string[] columns)
 {
     int count = input.RowCount;
     int length = columns.Length;
     double[] result = new double[length];
     int i, j;
     double temp;
     DataRow temprow;
     for (j = 0; j < length; j++)
     {
         result[j] = double.MinValue;
     }
     for (i = 0; i < count; i++)
     {
         temprow = input[i];
         for (j = 0; j < length; j++)
         {
             temp = temprow[columns[j]].ConvertToDouble();
             if (temp > result[j])
                 result[j] = temp;
         }
     }
     return result;
 }
Exemplo n.º 14
0
 public static double[] Stdev(SPC.Base.Interface.IDataTable<DataRow> input, string[] columns)
 {
     int count = input.RowCount;
     double[] result = new double[count];
     int length = columns.Length;
     int i, j;
     double sum;
     double avg;
     double std;
     DataRow temprow;
     for (i = 0; i < count; i++)
     {
         sum = 0;
         temprow = input[i];
         for (j = 0; j < length; j++)
         {
             sum += temprow[columns[j]].ConvertToDouble();
         }
         avg = sum / length;
         std = 0;
         for (j = 0; j < length; j++)
         {
             std += Math.Pow(temprow[columns[j]].ConvertToDouble() - avg, 2);
         }
         result[i] = Math.Pow(std / length, 0.5);
     }
     return result;
 }
Exemplo n.º 15
0
 public Facade(Serasa serasa, SPC spc, Credito credito)
 {
     _serasa  = serasa;
     _spc     = spc;
     _credito = credito;
 }
Exemplo n.º 16
0
 public SPCDetermineDataType(SPC.Controls.Base.CanChooseDataGridView view, string param, double ucl, double lcl, double standard, List<SPCCommandbase> commands)
 {
     this.View = view;
     this.Param = param;
     this.UCL = ucl;
     this.LCL = lcl;
     this.Standard = standard;
     this.Commands = commands;
 }
Exemplo n.º 17
0
 public static void ZScore(SPC.Base.Interface.IDataTable<DataRow> sourcedata,string[] sourcecolumns,string[] targetcolumns)
 {
     var avgs = ColumnCalculate.Avg(sourcedata, sourcecolumns);
     var stdevs = ColumnCalculate.Stdev(sourcedata, sourcecolumns,avgs);
     int rowcount = sourcedata.RowCount;
     int columncount = sourcecolumns.Length;
     int i,j;
     DataRow temprow;
     foreach(var targetcolumn in targetcolumns)
     {
         if (!sourcedata.ContainsColumn(targetcolumn))
         {
             sourcedata.AddColumn(targetcolumn, typeof(double));
         }
     }
     for(i = 0;i<rowcount;i++)
     {
         temprow = sourcedata[i];
         for(j=0;j<columncount;j++)
         {
             temprow[targetcolumns[j]] = (temprow[sourcecolumns[j]].ConvertToDouble() - avgs[j]) / stdevs[j];
         }
     }
 }
Exemplo n.º 18
0
 public SPCDetermineData(SPC.Controls.Base.CanChooseDataGridView view, string param, double ucl, double lcl, double standard, List<SPCCommandbase> commands, System.Drawing.Color color, List<IDrawBoard<DevExpress.XtraCharts.ChartControl>> drawBoards)
 {
     SourceData = new SPCDetermineDataType(view, param, ucl,lcl,standard,commands);
     this.Name =param + "_" + DateTime.Now.ToBinary();
     this.SeriesColor = color;
     this.DrawBoards = drawBoards;
     List<SPCDetermineData> templist;
     foreach (var drawboard in drawBoards)
     {
         if (drawboard.Tag == null || (templist = drawboard.Tag as List<SPCDetermineData>) == null)
             drawboard.Tag = new List<SPCDetermineData>() { this };
         else
             templist.Add(this);
     }
     InitSeriesManagers();
 }
Exemplo n.º 19
0
 public void Init(SPC.Base.Interface.IDataTable<DataRow> data)
 {
     this.Data = data;
     this.listBoxControl1.Items.Clear();
     this.columnList = Data.GetColumnsList();
     foreach (string column in columnList)
     {
         this.listBoxControl1.Items.Add(column);
     }
 }
Exemplo n.º 20
0
 protected int SPCKEY(SPC code)
 {
     return((int)code);
 }
Exemplo n.º 21
0
 public MonitorSeriesData(SPC.Controls.Base.CanChooseDataGridView view, string param, int groupType, string spectrumWith, System.Drawing.Color color, List<IDrawBoard<DevExpress.XtraCharts.ChartControl>> drawBoards)
 {
     SourceData = new MonitorSourceDataType(view, param, groupType, spectrumWith);
     this.Name = param + "_" + groupType.ToString() + "_" + DateTime.Now.ToBinary();
     this.SeriesColor = color;
     this.DrawBoards = drawBoards;
      List<MonitorSeriesData> templist;
     foreach(var drawboard in drawBoards)
     {
         if (drawboard.Tag == null || (templist = drawboard.Tag as List<MonitorSeriesData>)==null)
             drawboard.Tag = new List<MonitorSeriesData>() { this };
         else
             templist.Add(this);
     }
     InitSeriesManagers();
 }
Exemplo n.º 22
0
 public static double[] Range(SPC.Base.Interface.IDataTable<DataRow> input, string[] columns)
 {
     int count = input.RowCount;
     double[] result = new double[count];
     int length = columns.Length;
     int i, j;
     double max, min, temp;
     DataRow temprow;
     for (i = 0; i < count; i++)
     {
         max = double.MinValue;
         min = double.MaxValue;
         temprow = input[i];
         for (j = 0; j < length; j++)
         {
             temp = temprow[columns[j]].ConvertToDouble();
             if (temp > max)
                 max = temp;
             if (temp < min)
                 min = temp;
         }
         result[i] = max - min;
     }
     return result;
 }
Exemplo n.º 23
0
 public static double[] QuadraticSum(SPC.Base.Interface.IDataTable<DataRow> input, string[] columns)
 {
     int count = input.RowCount;
     double[] result = new double[count];
     int length = columns.Length;
     int i, j;
     DataRow temprow;
     for (i = 0; i < count; i++)
     {
         temprow = input[i];
         for (j = 0; j < length; j++)
         {
             result[i] += Math.Pow(temprow[columns[j]].ConvertToDouble(), 2);
         }
     }
     return result;
 }
Exemplo n.º 24
0
 public static double[] Mid(SPC.Base.Interface.IDataTable<DataRow> input, string[] columns)
 {
     int count = input.RowCount;
     double[] result = new double[count];
     int length = columns.Length;
     int i, j;
     double temp;
     DataRow temprow;
     SortedList<double, double> list;
     for (i = 0; i < count; i++)
     {
         temprow = input[i];
         list = new SortedList<double, double>();
         for (j = 0; j < length; j++)
         {
             temp = temprow[columns[j]].ConvertToDouble();
             list.Add(temp, temp);
         }
         if (length % 2 == 0)
             result[i] = (list.Keys[length / 2] + list.Keys[length / 2 - 1]) / 2;
         else
             result[i] = list.Keys[length / 2];
     }
     return result;
 }
Exemplo n.º 25
0
        public static double[] Mid(SPC.Base.Interface.IDataTable<DataRow> input, string[] columns)
        {
            int count = input.RowCount;
            int length = columns.Length;
            double[] result = new double[length];
            int i, j;
            double temp;
            DataRow temprow;
            SortedList<double, double>[] list = new SortedList<double, double>[length];
            for (j = 0; j < length; j++)
            {
                list[j] = new SortedList<double, double>();
            }
            for (i = 0; i < count; i++)
            {
                temprow = input[i];
                for (j = 0; j < length; j++)
                {
                    temp = temprow[columns[j]].ConvertToDouble();
                    list[j].Add(temp, temp);
                }

            }
            if (count % 2 == 0)
            {
                for (j = 0; j < length; j++)
                {

                    result[j] = (list[j].Keys[count / 2] + list[j].Keys[count / 2 - 1]) / 2;
                }
            }
            else
            {
                for (j = 0; j < length; j++)
                {

                    result[j] = list[j].Keys[count / 2];
                }
            }
            return result;
        }
Exemplo n.º 26
0
 public static double[] Stdev(SPC.Base.Interface.IDataTable<DataRow> input, string[] columns,double[] avgs)
 {
     int count = input.RowCount;
     int length = columns.Length;
     if(avgs.Length!=length)
     {
         return Stdev(input, columns);
     }
     double[] result = new double[length];
     int i, j;
     DataRow temprow;
     for (i = 0; i < count; i++)
     {
         temprow = input[i];
         for (j = 0; j < length; j++)
         {
             result[j] += Math.Pow(temprow[columns[j]].ConvertToDouble() - avgs[j], 2);
         }
     }
     for (j = 0; j < length; j++)
     {
         result[j] = Math.Pow(result[j] / count, 0.5);
     }
     return result;
 }
Exemplo n.º 27
0
        private void Paint()
        {
            if (Combx2.SelectedIndex < 0 || Combx4_Month_Ed.SelectedIndex <= Combx4_Month_ST.SelectedIndex)
            {
                return;
            }
            SPCtype spctype;

            if (Combx2.SelectedIndex == 0)
            {
                spctype = SPCtype.P;
            }
            else
            {
                spctype = (SPCtype)Combx2.SelectedIndex;
            }

            var ctdata = GMeasures.FirstOrDefault(o => o.MeasureID == this.Combx1.SelectedValue.ToString()).Records;

            if (ctdata == null || ctdata.Count < 3)
            {
                return;
            }
            var ctdatatake = ctdata.Reverse().ToDictionary(o => o.Key, o => o.Value);
            SPC spcdatas;

            if (Ck_Sep.IsChecked == true)
            {
                if (Combx4_Month_ST.SelectedIndex < 3)
                {
                    return;
                }
                var data1 = new SPC(ctdatatake.Take(Combx4_Month_ST.SelectedIndex + 1).ToDictionary(o => o.Key, o => o.Value), spctype);
                var data2 = new SPC(ctdatatake.Skip(Combx4_Month_ST.SelectedIndex + 1).Take(Combx4_Month_Ed.SelectedIndex - Combx4_Month_ST.SelectedIndex).ToDictionary(o => o.Key, o => o.Value), spctype);
                spcdatas = data1 + data2;
                if ((Combx4_Month_Ed.Items.Count - Combx4_Month_Ed.SelectedIndex - 1) > 3)
                {
                    var data3 = new SPC(ctdatatake.Skip(Combx4_Month_Ed.SelectedIndex + 1).Take(Combx4_Month_Ed.Items.Count - Combx4_Month_Ed.SelectedIndex - 1).ToDictionary(o => o.Key, o => o.Value), spctype);
                    spcdatas += data3;
                }
            }
            else
            {
                if (Combx4_Month_Ed.SelectedIndex - Combx4_Month_ST.SelectedIndex < 3)
                {
                    return;
                }
                spcdatas = new SPC(ctdatatake.Skip(Combx4_Month_ST.SelectedIndex).Take(Combx4_Month_Ed.SelectedIndex - Combx4_Month_ST.SelectedIndex + 1).ToDictionary(o => o.Key, o => o.Value), spctype);
            }
            double amply = 1;

            if (spctype != SPCtype.C && spctype != SPCtype.nP && spctype != SPCtype.I_MR)
            {
                amply = Permil == 2 ? 1000 : 100;
            }
            int roundlevel = spcdatas.Average.Select(o => o * amply).Average() <= 0.1 ? 4 : 2;

            /*
             * line1.Title = Combx1.SelectedValue.ToString();
             * line1.Values = new ChartValues<double>(spcdatas.Measures.Select(o => Math.Round(o * amply, roundlevel)));
             * line2.Values = new ChartValues<double>(spcdatas.Average.Select(o => Math.Round(o * amply, roundlevel)));
             * line3.Values = new ChartValues<double>(spcdatas.UCL.Select(o => Math.Round(o * amply, roundlevel)));
             * line4.Values = new ChartValues<double>(spcdatas.UUCL.Select(o => Math.Round(o * amply, roundlevel)));
             * line5.Values = new ChartValues<double>(spcdatas.LCL.Select(o => Math.Round(o * amply, roundlevel)));
             * line6.Values = new ChartValues<double>(spcdatas.LLCL.Select(o => Math.Round(o * amply, roundlevel)));
             */
            cartesianchart1.Series.Clear();

            cartesianchart1.Series.Add(new LineSeries
            {
                DataLabels        = true,
                LineSmoothness    = 0,
                PointGeometrySize = 10,
                PointForeground   = (SolidColorBrush)(new BrushConverter().ConvertFrom("#222E31")),
                StrokeThickness   = 4,
                StrokeDashArray   = new System.Windows.Media.DoubleCollection {
                    2
                },
                Stroke = (SolidColorBrush)(new BrushConverter().ConvertFrom("#6BBA45")),
                Fill   = Brushes.Transparent,
                Title  = Combx1.SelectedValue.ToString(),
                Values = new ChartValues <double>(spcdatas.Measures.Select(o => Math.Round(o * amply, roundlevel)))
            });
            cartesianchart1.Series.Add(new LineSeries
            {
                LineSmoothness  = 0,
                PointGeometry   = null,
                StrokeDashArray = new System.Windows.Media.DoubleCollection {
                    1
                },
                Stroke = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FF3333")),
                Fill   = Brushes.Transparent,
                Title  = "管制圖上限(3α)",
                Values = new ChartValues <double>(spcdatas.UCL.Select(o => Math.Round(o * amply, roundlevel)))
            });
            cartesianchart1.Series.Add(new LineSeries
            {
                LineSmoothness  = 0,
                PointGeometry   = null,
                StrokeDashArray = new System.Windows.Media.DoubleCollection {
                    1
                },
                Stroke = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FFAD33")),
                Fill   = Brushes.Transparent,
                Title  = "管制圖上限(2α)",
                Values = new ChartValues <double>(spcdatas.UUCL.Select(o => Math.Round(o * amply, roundlevel)))
            });
            cartesianchart1.Series.Add(new LineSeries
            {
                LineSmoothness  = 1,
                PointGeometry   = null,
                StrokeDashArray = new System.Windows.Media.DoubleCollection {
                    2
                },
                Stroke = (SolidColorBrush)(new BrushConverter().ConvertFrom("#1C8FC5")),
                Fill   = Brushes.Transparent,
                Title  = "平均值",
                Values = new ChartValues <double>(spcdatas.Average.Select(o => Math.Round(o * amply, roundlevel)))
            });
            cartesianchart1.Series.Add(new LineSeries
            {
                LineSmoothness  = 0,
                PointGeometry   = null,
                StrokeDashArray = new System.Windows.Media.DoubleCollection {
                    1
                },
                Stroke = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FFAD33")),
                Fill   = Brushes.Transparent,
                Title  = "管制圖下限(2α)",
                Values = new ChartValues <double>(spcdatas.LLCL.Select(o => Math.Round(o * amply, roundlevel)))
            });
            cartesianchart1.Series.Add(new LineSeries
            {
                LineSmoothness  = 0,
                PointGeometry   = null,
                StrokeDashArray = new System.Windows.Media.DoubleCollection {
                    1
                },
                Stroke = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FF3333")),
                Fill   = Brushes.Transparent,
                Title  = "管制圖下限(3α)",
                Values = new ChartValues <double>(spcdatas.LCL.Select(o => Math.Round(o * amply, roundlevel)))
            });
            ///加入閾值及同儕值
            if (Ck_Thresh.IsChecked == true && spcdatas.Threshold.Count > 0 &&
                spcdatas.Type != SPCtype.C && spcdatas.Type != SPCtype.nP && spcdatas.Type != SPCtype.I_MR)
            {
                cartesianchart1.Series.Add(new LineSeries
                {
                    LineSmoothness = 0,
                    PointGeometry  = null,
                    //StrokeThickness = 3,
                    //StrokeDashArray = new System.Windows.Media.DoubleCollection { 2 },
                    Stroke = (SolidColorBrush)(new BrushConverter().ConvertFrom("#3366FF")),
                    Fill   = Brushes.Transparent,
                    Title  = "閾值",
                    Values = new ChartValues <double>(spcdatas.Threshold.Select(o => Math.Round(o, roundlevel)))
                });
                if (Ck_Peer.IsChecked == true && spcdatas.Peervalue.Count > 0)
                {
                    cartesianchart1.Series.Add(new LineSeries
                    {
                        LineSmoothness = 0,
                        PointGeometry  = null,
                        //StrokeThickness = 3,
                        //StrokeDashArray = new System.Windows.Media.DoubleCollection { 2 },
                        Stroke = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FF3333")),
                        Fill   = Brushes.Transparent,
                        Title  = "同儕值",
                        Values = new ChartValues <double>(spcdatas.Peervalue.Select(o => Math.Round(o, roundlevel)))
                    });
                }
            }

            axisx.Sections.Clear();
            axisx.Labels = new List <string>(spcdatas.Title);
            if (Ck_Sep.IsChecked == true)
            {
                axisx.Sections.Add(new AxisSection()
                {
                    Value = Combx4_Month_ST.SelectedIndex + 1,
                    //Fill = Brushes.Transparent,
                    Fill    = (SolidColorBrush)(new BrushConverter().ConvertFrom("#f9ffe6")),
                    Opacity = 7,
                    Stroke  = Brushes.Transparent,
                    //StrokeThickness = 3,
                    //Stroke = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FFFF33")),
                    //StrokeDashArray = new System.Windows.Media.DoubleCollection { 4 },
                    SectionWidth = Combx4_Month_Ed.SelectedIndex - Combx4_Month_ST.SelectedIndex >= 3 ? Combx4_Month_Ed.SelectedIndex - Combx4_Month_ST.SelectedIndex - 1 : 0
                });

                /*
                 * if (Combx4_Month_Ed.SelectedIndex - Combx4_Month_ST.SelectedIndex >= 3)
                 * {
                 *  axisx.Sections.Add(new AxisSection()
                 *  {
                 *      Value = Combx4_Month_Ed.SelectedIndex,
                 *      Fill = Brushes.Transparent,
                 *      Opacity = 6,
                 *      StrokeThickness = 3,
                 *      Stroke = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FFFF33")),
                 *      StrokeDashArray = new System.Windows.Media.DoubleCollection { 4 },
                 *      //SectionWidth = Combx4_Month_Ed.SelectedIndex - Combx4_Month_ST.SelectedIndex
                 *  });
                 * }
                 */
                /*
                 * axisx.Labels = new List<string>();
                 * foreach (var x in ctdatatake)
                 *  axisx.Labels.Add(x.Key);
                 * var data2 = new SPC(ctdatatake.Skip(Combx4_Month_ST.SelectedIndex + 1).Take(Combx4_Month_Ed.SelectedIndex - Combx4_Month_ST.SelectedIndex).ToDictionary(o => o.Key, o => o.Value), spctype);
                 * for (int i = 0; i < Combx4_Month_ST.SelectedIndex + 1; i++)
                 * {
                 *  data2.Title.Insert(0, string.Empty);
                 *  data2.Measures.Insert(0, double.NaN);
                 *  data2.Average.Insert(0, double.NaN);
                 *  data2.UCL.Insert(0, double.NaN);
                 *  data2.UUCL.Insert(0, double.NaN);
                 *  data2.LCL.Insert(0, double.NaN);
                 *  data2.LLCL.Insert(0, double.NaN);
                 * }
                 * cartesianchart1.Series.Add(new LineSeries
                 * {
                 *  DataLabels = true,
                 *  PointGeometrySize = 10,
                 *  PointForeground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#222E31")),
                 *  StrokeThickness = 4,
                 *  StrokeDashArray = new System.Windows.Media.DoubleCollection { 2 },
                 *  Stroke = (SolidColorBrush)(new BrushConverter().ConvertFrom("#6BBA45")),
                 *  Fill = Brushes.Transparent,
                 *  Title = null,
                 *  Values = new ChartValues<double>(data2.Measures.Select(o => Math.Round(o * amply, roundlevel)))
                 * });
                 * cartesianchart1.Series.Add(new LineSeries
                 * {
                 *  PointGeometry = null,
                 *  StrokeDashArray = new System.Windows.Media.DoubleCollection { 2 },
                 *  Stroke = (SolidColorBrush)(new BrushConverter().ConvertFrom("#1C8FC5")),
                 *  Fill = Brushes.Transparent,
                 *  Title = null,
                 *  Values = new ChartValues<double>(data2.Average.Select(o => Math.Round(o * amply, roundlevel)))
                 * });
                 * cartesianchart1.Series.Add(new LineSeries
                 * {
                 *  PointGeometry = null,
                 *  StrokeDashArray = new System.Windows.Media.DoubleCollection { 1 },
                 *  Stroke = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FF3333")),
                 *  Fill = Brushes.Transparent,
                 *  Values = new ChartValues<double>(data2.UCL.Select(o => Math.Round(o * amply, roundlevel)))
                 * });
                 * cartesianchart1.Series.Add(new LineSeries
                 * {
                 *  PointGeometry = null,
                 *  StrokeDashArray = new System.Windows.Media.DoubleCollection { 1 },
                 *  Stroke = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FFAD33")),
                 *  Fill = Brushes.Transparent,
                 *  Values = new ChartValues<double>(data2.UUCL.Select(o => Math.Round(o * amply, roundlevel)))
                 * });
                 * cartesianchart1.Series.Add(new LineSeries
                 * {
                 *  PointGeometry = null,
                 *  StrokeDashArray = new System.Windows.Media.DoubleCollection { 1 },
                 *  Stroke = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FF3333")),
                 *  Fill = Brushes.Transparent,
                 *  Values = new ChartValues<double>(data2.LCL.Select(o => Math.Round(o * amply, roundlevel)))
                 * });
                 * cartesianchart1.Series.Add(new LineSeries
                 * {
                 *  PointGeometry = null,
                 *  StrokeDashArray = new System.Windows.Media.DoubleCollection { 1 },
                 *  Stroke = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FFAD33")),
                 *  Fill = Brushes.Transparent,
                 *  Values = new ChartValues<double>(data2.LLCL.Select(o => Math.Round(o * amply, roundlevel)))
                 * });
                 */
            }

            //YFormatter = value => value.ToString(roundlevel == 4 ? "F4" : "F2");

            cartesianchart1.AxisY[0].LabelFormatter = value => value.ToString(roundlevel == 4 ? "F4" : "F2");
            DataContext = this;
            cartesianchart1.Update();
            this.Combx1.Focus();
        }
Exemplo n.º 28
0
        public void ParseInfo(Hashtable info)
        {
            if (members == null)
            {
                members = new Dictionary <string, GuildMember>();
            }
            members.Clear();

            SPC lastParameter = SPC.Id;

            try {
                ownerCharacterID = info.GetValueString((int)SPC.Id);

                lastParameter = SPC.GuildRating;
                rating        = info.GetValueInt((int)SPC.GuildRating);

                lastParameter = SPC.Race;
                guildRace     = info.GetValueInt((int)SPC.Race, (int)Race.None);

                lastParameter = SPC.Description;
                description   = info.GetValueString((int)SPC.Description);

                lastParameter = SPC.Name;
                name          = info.GetValueString((int)SPC.Name);

                lastParameter = SPC.ModerCount;
                moderCount    = info.GetValueInt((int)SPC.ModerCount);

                lastParameter = SPC.MaxModerCount;
                maxModerCount = info.GetValueInt((int)SPC.MaxModerCount);

                depositedCredits = info.GetValueInt((int)SPC.Credits);

                depositedPvpPoints = info.GetValueInt((int)SPC.PvpPoints);
            } catch (Exception exception) {
                throw new NebulaException(string.Format("last not handled key = {0}", lastParameter));
            }

            opened = info.GetValueBool((int)SPC.Opened, true);

            Hashtable membersHash = info.GetValueHash((int)SPC.Members) as Hashtable;

            if (membersHash == null)
            {
                return;
            }

            foreach (System.Collections.DictionaryEntry entry in membersHash)
            {
                string    memberCharacterID   = entry.Key.ToString();
                Hashtable memberCharacterInfo = entry.Value as Hashtable;
                members.Add(memberCharacterID, new GuildMember(memberCharacterInfo));
            }

            poster = info.GetValueString((int)SPC.DayPoster);

            if (info.ContainsKey((int)SPC.Transactions))
            {
                Hashtable[] arr = info[(int)SPC.Transactions] as Hashtable[];
                if (arr != null)
                {
                    transactions = new List <CoalitionTransaction>();
                    foreach (Hashtable h in arr)
                    {
                        var transaction = CoalitionTransaction.Parse(h);
                        if (transaction != null)
                        {
                            transactions.Add(transaction);
                        }
                    }
                }
            }
        }
Exemplo n.º 29
0
        //---------------------------------------------------------------------------
        //Update Timer
        private void fn_tmUpdate(object sender, EventArgs e)
        {
            //m_UpdateTimer.Stop();

            //
            switch (m_nStep)
            {
            case 0:

                tbLoadMsg.Text = " Now Loading System Data...";

                if (!m_tDelayTimer.OnDelay(true, 300))
                {
                    return;
                }
                m_tDelayTimer.Clear();
                m_nStep++;
                break;

            case 1:
                //Load Default file Info.
                tbLoadMsg.Text = " Loading the Information..."; FM.fn_LoadLastInfo(true);
                tbLoadMsg.Text = " Loading the Project Info..."; FM.fn_LoadProject(true, FM._sCurrJob);
                tbLoadMsg.Text = " Loading the System Option..."; FM.fn_LoadSysOptn(true);
                tbLoadMsg.Text = " Loading the Master Option..."; FM.fn_LoadMastOptn(true);
                tbLoadMsg.Text = " Loading the Recipe Data..."; FM.fn_LoadRecipeInfo(true, FM._sRecipeName);
                tbLoadMsg.Text = " Loading the Password..."; FM.fn_LoadPassWord(true);

                tbLoadMsg.Text = " Loading SPC Data..."; SPC.Load(true);

                m_tDelayTimer.Clear();

                m_nStep++;
                break;

            case 2:
                if (!m_tDelayTimer.OnDelay(true, 100))
                {
                    return;
                }
                tbLoadMsg.Text = " Loading the IO List..."; IO.fn_LoadIO(true);
                tbLoadMsg.Text = " Loading the Lamp/Buzzer Data..."; LAMP.fn_Load(true);
                tbLoadMsg.Text = " Loading the Actuator Data..."; ACTR.fn_Load(true);

                //tbLoadMsg.Text = " ACS IO Connection...(SIM)"        ; IO.fn_ACSConnect(UserConst.ACS_CON_SIM);
                tbLoadMsg.Text = " ACS IO Connection..."; IO.fn_ACSConnect(UserConst.ACS_CON_NOR);

                m_tDelayTimer.Clear();

                m_nStep++;
                break;

            case 3:
                //if (!m_tDelayTimer.OnDelay(true, 100)) return;

                tbLoadMsg.Text = " Loading the Error List..."; EPU.fn_LoadErrorData(true);
                tbLoadMsg.Text = " Loading the Lamp/Buzzer Data..."; EPU.fn_LoadLampData(true);

                m_tDelayTimer.Clear();

                m_nStep++;
                break;


            case 4:
                if (!m_tDelayTimer.OnDelay(true, 500))
                {
                    return;
                }
                //tbLoadMsg.Text = " Loading the Motor List...(SIM)"; MOTR.fn_InitMotor(UserConst.ACS_CON_SIM);
                tbLoadMsg.Text = " Loading the Motor List..."; MOTR.fn_InitMotor(UserConst.ACS_CON_NOR);

                tbLoadMsg.Text = " Loading the Vision Recipe..."; g_VisionManager.fn_LoadVision(FM._sRecipeName);


                //tbLoadMsg.Text = " Loading the Motor Data..."       ; FM.fn_LoadMastOptn(true);
                //tbLoadMsg.Text = " Loading the Motor DSTB..."       ; MOTR.fn_LoadMotrDisturb(true);

                m_tDelayTimer.Clear();

                m_nStep++;
                break;


            case 5:
                //if (!m_tDelayTimer.OnDelay(true, 500)) return;
                tbLoadMsg.Text = " Loading the Data Manager Map Data..."; DM.fn_LoadMap(true);
                tbLoadMsg.Text = " Loading the Sequence Data..."; SEQ.fn_LoadWorkInfo(true);

                m_tDelayTimer.Clear();

                m_nStep++;
                break;

            case 6:

                //Row, Col Setting...
                tbLoadMsg.Text = " Apply Project..."; FM.ApplyProject(FM._sCurrJob);

                m_nStep++;
                break;

            case 7:
                //LoadCell
                tbLoadMsg.Text = " Initial Load Cell ...";
                LDCBTM.fn_SetParam();
                LDCBTM.fn_Open(LDCBTM._sSerialNo); //LDCBTM.fn_Open    (FM.m_stMasterOpt.sLoadCellSN);

                LDCBTM.fn_Close();                 //JUNG/201014/Retry
                LDCBTM.fn_Open(LDCBTM._sSerialNo);

                //PMC, Slurry Init
                //tbLoadMsg.Text = " Initial PMC IP,Port ..."              ; PMC.fn_SetIpAddress(FM.m_stSystemOpt.sPMCIp, FM.m_stSystemOpt.nPMCPort);
                tbLoadMsg.Text = " Initial REST API ..."; REST.fn_SetURL(FM.m_stSystemOpt.sRestApiUrl);

                tbLoadMsg.Text = " Initial RFID Reader ...";
                m_nStep++;
                break;

            case 8:
                if (IO._bConnect)
                {
                    //RFID
                    tbLoadMsg.Text = " Initial RFID Reader ..."; RFID.fn_Connect();
                }

                m_nStep++;
                break;

            case 9:
                //if (!m_tDelayTimer.OnDelay(true, 500)) return;

                //Main Load
                fn_MainFormLoad();

                m_UpdateTimer.Stop();

                m_nStep++;
                break;


            default:
                break;
            }

            //Step Inc.
            pbStep.Value = m_nStep * 10;

            //m_UpdateTimer.Start();
        }
Exemplo n.º 30
0
        public static void F1T2(SPC.Base.Interface.IDataTable<DataRow> sourcedata, string[] sourcecolumns, string[] targetcolumns,double arg_1,double arg_2)
        {
            var mins = ColumnCalculate.Min(sourcedata, sourcecolumns);
            var maxs = ColumnCalculate.Max(sourcedata, sourcecolumns);
            int rowcount = sourcedata.RowCount;
            int columncount = sourcecolumns.Length;

            double[] ranges = new double[columncount];
            int i, j;
            DataRow temprow;
            double r = arg_2 - arg_1;
            for (j = 0; j < columncount; j++)
            {
                if (!sourcedata.ContainsColumn(targetcolumns[j]))
                {
                    sourcedata.AddColumn(targetcolumns[j], typeof(double));
                }
                ranges[j] = maxs[j]-mins[j];
            }

            for (i = 0; i < rowcount; i++)
            {
                temprow = sourcedata[i];
                for (j = 0; j < columncount; j++)
                {
                    temprow[targetcolumns[j]] = ((temprow[sourcecolumns[j]].ConvertToDouble() - mins[j])*r) / ranges[j]+arg_1;
                }
            }
        }
Exemplo n.º 31
0
 public XYRelationData(SPC.Controls.Base.CanChooseDataGridView view, string paramY, string paramX, System.Drawing.Color color, List<IDrawBoard<DevExpress.XtraCharts.ChartControl>> drawBoards)
 {
     SourceData = new XYRelationSourceDataType(view, paramX, paramY);
     this.Name ="X:"+ paramX + "_Y:" + paramY + "_" + DateTime.Now.ToBinary();
     this.SeriesColor = color;
     this.DrawBoards = drawBoards;
     List<XYRelationData> templist;
     foreach (var drawboard in drawBoards)
     {
         if (drawboard.Tag == null || (templist = drawboard.Tag as List<XYRelationData>) == null)
             drawboard.Tag = new List<XYRelationData>() { this };
         else
             templist.Add(this);
     }
     InitSeriesManagers();
 }
Exemplo n.º 32
0
 public static void M1D2(SPC.Base.Interface.IDataTable<DataRow> sourcedata, string[] sourcecolumns, string[] targetcolumns,double arg_1,double arg_2)
 {
     int rowcount = sourcedata.RowCount;
     int columncount = sourcecolumns.Length;
     int i, j;
     DataRow temprow;
     foreach (var targetcolumn in targetcolumns)
     {
         if (!sourcedata.ContainsColumn(targetcolumn))
         {
             sourcedata.AddColumn(targetcolumn, typeof(double));
         }
     }
     for (i = 0; i < rowcount; i++)
     {
         temprow = sourcedata[i];
         for (j = 0; j < columncount; j++)
         {
             temprow[targetcolumns[j]] = (temprow[sourcecolumns[j]].ConvertToDouble() - arg_1) / arg_2;
         }
     }
 }
Exemplo n.º 33
0
 public static double[] Sum(SPC.Base.Interface.IDataTable<DataRow> input, string[] columns)
 {
     int count = input.RowCount;
     double[] result = new double[count];
     int length = columns.Length;
     int i, j;
     double sum;
     DataRow temprow;
     for (i = 0; i < count; i++)
     {
         sum = 0;
         temprow = input[i];
         for (j = 0; j < length; j++)
         {
             sum += temprow[columns[j]].ConvertToDouble();
         }
         result[i] = sum;
     }
     return result;
 }
Exemplo n.º 34
0
 public XYZRelationSourceDataType(SPC.Controls.Base.CanChooseDataGridView view, string paramX, string paramY, string paramZ)
 {
     this.View = view;
     this.ParamX = paramX;
     this.ParamY = paramY;
     this.ParamZ = paramZ;
 }