Пример #1
0
        public static Dictionary <string, EfficiencyStructure> CreateEfficiency()
        {
            Dictionary <string, EfficiencyStructure> result = new Dictionary <string, EfficiencyStructure>();
            DataTable mesModels = SqlOperations.GetMesModels();

            //MODEL_ID,A_PKG_QTY,B_PKG_QTY,CCT_CODE,SMT_Carrier_QTY

            foreach (DataRow row in mesModels.Rows)
            {
                string model       = row["MODEL_ID"].ToString().Replace("LLFML", "");
                string modelType   = model.Split('-')[0]; //K2, K1, G2, G1....
                string modelFamily = model.Substring(0, 6) + "XXX" + model.Substring(9, 1);

                if (result.ContainsKey(modelFamily))
                {
                    continue;
                }

                int rankAQty = int.Parse(row["A_PKG_QTY"].ToString());
                int rankBQty = int.Parse(row["B_PKG_QTY"].ToString());

                int CCT           = int.Parse(row["CCT_CODE"].ToString());
                int pcbPerCarrier = int.Parse(row["SMT_Carrier_QTY"].ToString());
                if (pcbPerCarrier < 5)  //less than 5 is square (given carrier for testing purposes)
                {
                    pcbPerCarrier = 1;
                }

                int ledQty  = Math.Max(rankAQty, rankBQty) * 2;
                int connQty = 2;
                if (modelType == "K2" || modelType == "G2")
                {
                    if (!IsOdd(CCT))
                    {
                        connQty = 4;
                    }
                }

                int length = 600;
                switch (modelType)
                {
                case "22":
                    length = 250;
                    break;

                case "33":
                    length = 270;
                    break;

                case "32":
                    length = 272;
                    break;

                case "53":
                    length = 540;
                    break;
                }

                //EfficiencyStructure newItem = new EfficiencyStructure()
                // result.Add(modelFamily, )
            }
            return(result);
        }