コード例 #1
0
        public ParaData Clone()
        {
            ParaData data = new ParaData();

            data.paraName  = this.paraName;
            data.paraType  = this.paraType;
            data.paraUnit  = this.paraUnit;
            data.strRemark = this.strRemark;
            return(data);
        }
コード例 #2
0
        /// <summary>
        /// 求解修正因子
        /// </summary>
        /// <param name="strOprType"></param>
        /// <returns></returns>
        public static List <ParaData> GetlstCalculateRatio(string strOprType, WeightSortData tempWeightSortData1st, WeightSortData tempWeightSortData2nd)
        {
            List <ParaData> lstTempPara = null;

            WeightData        tempWeightData1 = null;
            WeightData        tempWeightData2 = null;
            List <WeightData> lstWeightData1  = null;
            List <WeightData> lstWeightData2  = null;


            WeightData tempWeightData = null;

            // 检查操作类型
            if (strOprType != "技术因子" && strOprType != "校核因子")
            {
                return(lstTempPara);
            }

            // 检查重量分类
            if (tempWeightSortData1st == null || tempWeightSortData1st.lstWeightData.Count == 0)
            {
                return(lstTempPara);
            }
            if (tempWeightSortData2nd == null || tempWeightSortData2nd.lstWeightData.Count == 0)
            {
                return(lstTempPara);
            }
            // 检查重量分类是否一致
            if (WeightSortData.blIsSame(tempWeightSortData1st, tempWeightSortData2nd))
            {
                lstTempPara = new List <ParaData>();
                // 计算修正因子
                lstWeightData1 = GetListWeightData(tempWeightSortData1st);
                lstWeightData2 = GetListWeightData(tempWeightSortData2nd);

                for (int i = 0; i < lstWeightData1.Count; i = i + 1)
                {
                    StringBuilder tempPath1 = new StringBuilder();
                    StringBuilder tempPath2 = new StringBuilder();

                    tempWeightData1 = lstWeightData1[i];
                    for (int j = 0; j < lstWeightData2.Count; j = j + 1)
                    {
                        tempWeightData2 = lstWeightData2[j];
                        if (tempWeightData1.weightName == tempWeightData2.weightName && tempWeightData1.weightUnit == tempWeightData2.weightUnit)
                        {
                            tempPath1.Append("\\" + tempWeightData1.weightName);

                            // 获取根
                            bool triger   = true;
                            int  intInner = tempWeightData1.nID;
                            while (triger)
                            {
                                tempWeightData = WeightSortData.getParentNode(tempWeightSortData1st, intInner);
                                if (tempWeightData != null && tempWeightData.nParentID != -1)
                                {
                                    intInner = tempWeightData.nID;
                                    tempPath1.Insert(0, "\\" + tempWeightData.weightName);
                                }
                                else if (tempWeightData != null && tempWeightData.nParentID == -1)
                                {
                                    tempPath1.Insert(0, tempWeightData.weightName);
                                    triger = false;
                                }
                                else
                                {
                                    triger = false;
                                }
                            }
                            // 获取根
                            tempPath2.Append("\\" + tempWeightData2.weightName);

                            triger   = true;
                            intInner = tempWeightData2.nID;
                            while (triger)
                            {
                                tempWeightData = WeightSortData.getParentNode(tempWeightSortData2nd, intInner);
                                if (tempWeightData != null && tempWeightData.nParentID != -1)
                                {
                                    intInner = tempWeightData.nID;
                                    tempPath2.Insert(0, "\\" + tempWeightData.weightName);
                                }
                                else if (tempWeightData != null && tempWeightData.nParentID == -1)
                                {
                                    tempPath2.Insert(0, tempWeightData.weightName);
                                    triger = false;
                                }
                                else
                                {
                                    triger = false;
                                }
                            }
                            if (tempPath1.ToString() == tempPath2.ToString())
                            {
                                ParaData tempParaData = new ParaData();
                                if (strOprType == "技术因子")
                                {
                                    tempParaData.paraName = "技术因子-" + tempWeightData1.weightName;
                                }
                                else if (strOprType == "校核因子")
                                {
                                    tempParaData.paraName = "校核因子-" + tempWeightData1.weightName;
                                }
                                tempParaData.paraUnit  = "无量纲";
                                tempParaData.strRemark = tempPath1.ToString();
                                if (tempWeightData1.weightValue == 0)
                                {
                                    tempParaData.paraValue = 0.0;
                                }
                                else if (tempWeightData2.weightValue == 0)
                                {
                                    tempParaData.paraValue = -1.0;
                                }
                                else
                                {
                                    tempParaData.paraValue = tempWeightData1.weightValue / tempWeightData2.weightValue;
                                }
                                lstTempPara.Add(tempParaData);
                            }
                        }
                    }
                }
                return(lstTempPara);
            }
            else
            {
                return(lstTempPara);
            }
        }