Example #1
0
        /// <summary>
        /// 找出A库中已经存在的值不用计算
        /// </summary>
        /// <param name="cutDataList"></param>
        /// <returns></returns>
        private List <OilDataSearchEntity> findOilDataSearch(OilInfoEntity oilA, OilInfoBEntity oilB)
        {
            List <OilDataSearchEntity> dataSearchList = new List <OilDataSearchEntity>();//需要返回的查找数据

            OilDataSearchRowAccess        dataSearchRowAccess = new OilDataSearchRowAccess();
            List <OilDataSearchRowEntity> dataSearchRows      = dataSearchRowAccess.Get("1=1").ToList();
            OilDataSearchColAccess        dataSearchColAccess = new OilDataSearchColAccess();
            List <OilDataSearchColEntity> dataSearchCols      = dataSearchColAccess.Get("1=1").ToList();

            #region "A库中查找"
            #region "原油信息表的查找数据"
            List <OilDataSearchColEntity> infoDataSearchCols = dataSearchCols.Where(o => o.OilTableName == "原油信息").ToList();
            int infoOilTalbeColID = infoDataSearchCols[0].OilTableColID;
            List <OilDataSearchRowEntity> oilDataRowEntityList = dataSearchRows.Where(o => o.OilTableRow.oilTableTypeID == (int)EnumTableType.Info).ToList();

            foreach (OilDataSearchRowEntity e in oilDataRowEntityList)
            {
                OilDataSearchEntity infoDataSearch = new OilDataSearchEntity();
                dataSearchList.Add(infoDataSearch);
                infoDataSearch.oilInfoID     = this._oilB.ID;
                infoDataSearch.oilTableColID = infoOilTalbeColID;
                infoDataSearch.oilTableRowID = e.OilTableRowID;
                #region
                if (e.OilTableRow.itemCode == "CNA")
                {
                    infoDataSearch.calData = oilA.crudeName;
                }
                else if (e.OilTableRow.itemCode == "ENA")
                {
                    infoDataSearch.calData = oilA.englishName;
                }
                else if (e.OilTableRow.itemCode == "IDC")
                {
                    infoDataSearch.calData = oilA.crudeIndex;
                }
                else if (e.OilTableRow.itemCode == "COU")
                {
                    infoDataSearch.calData = oilA.country;
                }
                else if (e.OilTableRow.itemCode == "GRC")
                {
                    infoDataSearch.calData = oilA.region;
                }
                else if (e.OilTableRow.itemCode == "ADA")
                {
                    infoDataSearch.calData = oilA.receiveDate != null?oilA.assayDate.ToString() : string.Empty;
                }
                else if (e.OilTableRow.itemCode == "ALA")
                {
                    infoDataSearch.calData = oilA.assayLab;
                }
                #endregion

                #region
                else if (e.OilTableRow.itemCode == "AER")
                {
                    infoDataSearch.calData = oilA.assayer;
                }
                else if (e.OilTableRow.itemCode == "SR")
                {
                    infoDataSearch.calData = oilA.sourceRef;
                }
                else if (e.OilTableRow.itemCode == "ASC")
                {
                    infoDataSearch.calData = oilA.assayCustomer;
                }
                else if (e.OilTableRow.itemCode == "RIN")
                {
                    infoDataSearch.calData = oilA.reportIndex;
                }
                else if (e.OilTableRow.itemCode == "CLA")
                {
                    infoDataSearch.calData = oilA.type;
                }
                else if (e.OilTableRow.itemCode == "TYP")
                {
                    infoDataSearch.calData = oilA.classification;
                }
                else if (e.OilTableRow.itemCode == "SCL")
                {
                    infoDataSearch.calData = oilA.sulfurLevel;
                }
                #endregion
            }
            #endregion

            #region "原油性质表的查找数据"
            OilDataSearchColEntity        wholeSearchCol = dataSearchCols.Where(o => o.OilTableName == "原油性质").FirstOrDefault();
            List <OilDataSearchRowEntity> wholeRowList   = wholeSearchCol.OilDataRowList;
            foreach (OilDataSearchRowEntity wholeRow in wholeRowList)
            {
                OilDataEntity wholeData = oilA.OilDatas.Where(o => o.oilTableRowID == wholeRow.OilTableRowID).FirstOrDefault();
                float         temp      = 0;
                if (wholeData != null && !string.IsNullOrWhiteSpace(wholeData.calData) && float.TryParse(wholeData.calData, out temp))
                {
                    OilDataSearchEntity DataSearch = new OilDataSearchEntity();
                    dataSearchList.Add(DataSearch);
                    DataSearch.oilInfoID     = this._oilB.ID;
                    DataSearch.oilTableColID = wholeSearchCol.OilTableColID;
                    DataSearch.oilTableRowID = wholeRow.OilTableRowID;
                    DataSearch.calData       = wholeData.calData;
                }
            }
            #endregion

            #region "宽馏分表和渣油表"
            foreach (CutMothedEntity cutMothed in this._cutMothedEntityList)
            {
                int oilTableColID = 0;
                #region "取出列代码"
                if (cutMothed.ECP <= 1500)
                {
                    List <OilDataEntity> ICPList = oilA.OilDatas.Where(o => o.OilTableRow.itemCode == "ICP" && o.calShowData.ToString() == cutMothed.ICP.ToString() && o.OilTableTypeID == (int)EnumTableType.Wide).ToList();
                    List <OilDataEntity> ECPList = oilA.OilDatas.Where(o => o.OilTableRow.itemCode == "ECP" && o.calShowData.ToString() == cutMothed.ECP.ToString() && o.OilTableTypeID == (int)EnumTableType.Wide).ToList();

                    foreach (OilDataEntity ICP in ICPList)
                    {
                        foreach (OilDataEntity ECP in ECPList)
                        {
                            if (ICP.OilTableCol.colCode == ECP.OilTableCol.colCode)
                            {
                                oilTableColID = ECP.oilTableColID;
                                break;
                            }
                        }
                    }
                }
                else if (cutMothed.ECP > 1500)
                {
                    OilDataEntity ICP = oilA.OilDatas.Where(o => o.OilTableRow.itemCode == "ICP" && o.calShowData == cutMothed.ICP.ToString() && o.OilTableTypeID == (int)EnumTableType.Residue).FirstOrDefault();
                    if (ICP != null)
                    {
                        oilTableColID = ICP.oilTableColID;
                    }
                }
                #endregion

                OilDataSearchColEntity        dataSearchCol      = dataSearchCols.Where(o => o.OilTableName == cutMothed.Name).FirstOrDefault();
                List <OilDataSearchRowEntity> wideDataSearchRows = dataSearchCol.OilDataRowList;
                if (oilTableColID > 0)
                {
                    foreach (OilDataSearchRowEntity dataSearchRow in wideDataSearchRows)
                    {
                        OilDataEntity data = oilA.OilDatas.Where(o => o.oilTableRowID == dataSearchRow.OilTableRowID && o.oilTableColID == oilTableColID).FirstOrDefault();
                        float         temp = 0;
                        if (data != null && !string.IsNullOrWhiteSpace(data.calData) && float.TryParse(data.calData, out temp))
                        {
                            OilDataSearchEntity DataSearch = new OilDataSearchEntity();
                            dataSearchList.Add(DataSearch);
                            DataSearch.oilInfoID     = this._oilB.ID;
                            DataSearch.oilTableColID = dataSearchCol.OilTableColID;
                            DataSearch.oilTableRowID = dataSearchRow.OilTableRowID;
                            DataSearch.calData       = data.calData;
                        }
                    }
                }
            }
            #endregion
            #endregion

            #region "B库中查找"
            #region "原油信息表的查找数据"

            foreach (OilDataSearchRowEntity e in oilDataRowEntityList)
            {
                OilDataSearchEntity dataSearchEntity = dataSearchList.Where(o => o.oilTableColID == infoOilTalbeColID && o.oilTableRowID == e.OilTableRowID).FirstOrDefault();

                if (dataSearchEntity == null)
                {
                    OilDataSearchEntity wholeDataSearch = new OilDataSearchEntity();
                    dataSearchList.Add(wholeDataSearch);
                    wholeDataSearch.oilInfoID     = this._oilB.ID;
                    wholeDataSearch.oilTableColID = infoOilTalbeColID;
                    wholeDataSearch.oilTableRowID = e.OilTableRowID;


                    #region
                    if (e.OilTableRow.itemCode == "CNA")
                    {
                        wholeDataSearch.calData = oilB.crudeName;
                    }
                    else if (e.OilTableRow.itemCode == "ENA")
                    {
                        wholeDataSearch.calData = oilB.englishName;
                    }
                    else if (e.OilTableRow.itemCode == "IDC")
                    {
                        wholeDataSearch.calData = oilB.crudeIndex;
                    }
                    else if (e.OilTableRow.itemCode == "COU")
                    {
                        wholeDataSearch.calData = oilB.country;
                    }
                    else if (e.OilTableRow.itemCode == "GRC")
                    {
                        wholeDataSearch.calData = oilB.region;
                    }
                    else if (e.OilTableRow.itemCode == "ADA")
                    {
                        wholeDataSearch.calData = oilB.receiveDate != null?oilB.receiveDate.ToString() : string.Empty;
                    }
                    else if (e.OilTableRow.itemCode == "ALA")
                    {
                        wholeDataSearch.calData = oilB.assayLab;
                    }
                    #endregion

                    #region
                    if (e.OilTableRow.itemCode == "AER")
                    {
                        wholeDataSearch.calData = oilB.assayer;
                    }
                    else if (e.OilTableRow.itemCode == "SR")
                    {
                        wholeDataSearch.calData = oilB.sourceRef;
                    }
                    else if (e.OilTableRow.itemCode == "ASC")
                    {
                        wholeDataSearch.calData = oilB.assayCustomer;
                    }
                    else if (e.OilTableRow.itemCode == "RIN")
                    {
                        wholeDataSearch.calData = oilB.reportIndex;
                    }
                    else if (e.OilTableRow.itemCode == "CLA")
                    {
                        wholeDataSearch.calData = oilB.type;
                    }
                    else if (e.OilTableRow.itemCode == "TYP")
                    {
                        wholeDataSearch.calData = oilB.classification;
                    }
                    else if (e.OilTableRow.itemCode == "SCL")
                    {
                        wholeDataSearch.calData = oilB.sulfurLevel;
                    }
                    #endregion
                }
                else if (dataSearchEntity != null && string.IsNullOrWhiteSpace(dataSearchEntity.calData))
                {
                    OilDataSearchEntity wholeDataSearch = new OilDataSearchEntity();
                    dataSearchList.Add(wholeDataSearch);
                    wholeDataSearch.oilInfoID     = this._oilB.ID;
                    wholeDataSearch.oilTableColID = infoOilTalbeColID;
                    wholeDataSearch.oilTableRowID = e.OilTableRowID;


                    #region
                    if (e.OilTableRow.itemCode == "CNA")
                    {
                        wholeDataSearch.calData = oilB.crudeName;
                    }
                    else if (e.OilTableRow.itemCode == "ENA")
                    {
                        wholeDataSearch.calData = oilB.englishName;
                    }
                    else if (e.OilTableRow.itemCode == "IDC")
                    {
                        wholeDataSearch.calData = oilB.crudeIndex;
                    }
                    else if (e.OilTableRow.itemCode == "COU")
                    {
                        wholeDataSearch.calData = oilB.country;
                    }
                    else if (e.OilTableRow.itemCode == "GRC")
                    {
                        wholeDataSearch.calData = oilB.region;
                    }
                    else if (e.OilTableRow.itemCode == "ADA")
                    {
                        wholeDataSearch.calData = oilB.receiveDate != null?oilB.receiveDate.ToString() : string.Empty;
                    }
                    else if (e.OilTableRow.itemCode == "ALA")
                    {
                        wholeDataSearch.calData = oilB.assayLab;
                    }
                    #endregion

                    #region
                    if (e.OilTableRow.itemCode == "AER")
                    {
                        wholeDataSearch.calData = oilB.assayer;
                    }
                    else if (e.OilTableRow.itemCode == "SR")
                    {
                        wholeDataSearch.calData = oilB.sourceRef;
                    }
                    else if (e.OilTableRow.itemCode == "ASC")
                    {
                        wholeDataSearch.calData = oilB.assayCustomer;
                    }
                    else if (e.OilTableRow.itemCode == "RIN")
                    {
                        wholeDataSearch.calData = oilB.reportIndex;
                    }
                    else if (e.OilTableRow.itemCode == "CLA")
                    {
                        wholeDataSearch.calData = oilB.type;
                    }
                    else if (e.OilTableRow.itemCode == "TYP")
                    {
                        wholeDataSearch.calData = oilB.classification;
                    }
                    else if (e.OilTableRow.itemCode == "SCL")
                    {
                        wholeDataSearch.calData = oilB.sulfurLevel;
                    }
                    #endregion
                }
            }
            #endregion

            #region "原油性质表的查找数据"
            for (int wholeIndex = 0; wholeIndex < wholeRowList.Count; wholeIndex++)
            {
                OilDataSearchEntity dataSearchEntity = dataSearchList.Where(o => o.oilTableColID == wholeSearchCol.OilTableColID && o.oilTableRowID == wholeRowList[wholeIndex].OilTableRowID).FirstOrDefault();

                OilDataBEntity wholeData = oilB.OilDatas.Where(o => o.oilTableRowID == wholeRowList[wholeIndex].OilTableRowID).FirstOrDefault();
                if (dataSearchEntity == null)
                {
                    if (wholeData != null && !string.IsNullOrWhiteSpace(wholeData.calData))
                    {
                        OilDataSearchEntity wholeDataSearch = new OilDataSearchEntity();
                        dataSearchList.Add(wholeDataSearch);
                        wholeDataSearch.oilInfoID     = this._oilB.ID;
                        wholeDataSearch.oilTableColID = wholeSearchCol.OilTableColID;
                        wholeDataSearch.oilTableRowID = wholeRowList[wholeIndex].OilTableRowID;
                        wholeDataSearch.calData       = wholeData.calData;
                    }
                }
                else if (dataSearchEntity != null && string.IsNullOrWhiteSpace(dataSearchEntity.calData))
                {
                    if (wholeData != null && !string.IsNullOrWhiteSpace(wholeData.calData))
                    {
                        dataSearchEntity.oilInfoID     = this._oilB.ID;
                        dataSearchEntity.oilTableColID = wholeSearchCol.OilTableColID;
                        dataSearchEntity.oilTableRowID = wholeRowList[wholeIndex].OilTableRowID;
                        dataSearchEntity.calData       = wholeData.calData;
                    }
                }
            }
            #endregion

            #region "宽馏分表和渣油表"
            for (int cutIndex = 0; cutIndex < this._cutMothedEntityList.Count; cutIndex++)
            {
                OilDataSearchColEntity        dataSearchCol      = dataSearchCols.Where(o => o.OilTableName == this._cutMothedEntityList[cutIndex].Name).FirstOrDefault();
                List <OilDataSearchRowEntity> wideDataSearchRows = dataSearchCol.OilDataRowList;
                if (dataSearchCol.OilTableColID > 0)
                {
                    for (int rowIndex = 0; rowIndex < wideDataSearchRows.Count; rowIndex++)
                    {
                        CutDataEntity       cutData          = oilB.CutDataEntityList.Where(o => o.CutName == this._cutMothedEntityList[cutIndex].Name && o.YItemCode == wideDataSearchRows[rowIndex].OilTableRow.itemCode).FirstOrDefault();
                        OilDataSearchEntity dataSearchEntity = dataSearchList.Where(o => o.oilTableColID == dataSearchCol.OilTableColID && o.oilTableRowID == wideDataSearchRows[rowIndex].OilTableRowID).FirstOrDefault();
                        if (dataSearchEntity == null)
                        {
                            if (cutData != null && cutData.CutData != null)
                            {
                                OilDataSearchEntity DataSearch = new OilDataSearchEntity();
                                dataSearchList.Add(DataSearch);
                                DataSearch.oilInfoID     = this._oilB.ID;
                                DataSearch.oilTableColID = dataSearchCol.OilTableColID;
                                DataSearch.oilTableRowID = wideDataSearchRows[rowIndex].OilTableRowID;
                                DataSearch.calData       = cutData.CutData.ToString();
                            }
                        }
                        else if (dataSearchEntity != null && string.IsNullOrWhiteSpace(dataSearchEntity.calData))
                        {
                            if (cutData != null && cutData.CutData != null)
                            {
                                OilDataSearchEntity DataSearch = new OilDataSearchEntity();
                                dataSearchList.Add(DataSearch);
                                DataSearch.oilInfoID     = this._oilB.ID;
                                DataSearch.oilTableColID = dataSearchCol.OilTableColID;
                                DataSearch.oilTableRowID = wideDataSearchRows[rowIndex].OilTableRowID;
                                DataSearch.calData       = cutData.CutData.ToString();
                            }
                        }
                    }
                }
            }
            #endregion

            #endregion
            return(dataSearchList);
        }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="cutDataList"></param>
        /// <returns></returns>
        private List <OilDataSearchEntity> findOilDataSearch(List <CutDataEntity> cutDataList)
        {
            List <OilDataSearchEntity> dataSearchList = new List <OilDataSearchEntity>();//需要返回的查找数据

            OilDataSearchRowAccess        dataSearchRowAccess = new OilDataSearchRowAccess();
            List <OilDataSearchRowEntity> dataSearchRows      = dataSearchRowAccess.Get("1=1").ToList();
            OilDataSearchColAccess        dataSearchColAccess = new OilDataSearchColAccess();
            List <OilDataSearchColEntity> dataSearchCols      = dataSearchColAccess.Get("1=1").ToList();

            #region "原油信息表的查找数据"
            List <OilDataSearchColEntity> infoDataSearchCols = dataSearchCols.Where(o => o.OilTableName == "原油信息").ToList();
            int infoOilTalbeColID = infoDataSearchCols[0].OilTableColID;
            List <OilDataSearchRowEntity> oilDataRowEntityList = dataSearchRows.Where(o => o.OilTableRow.oilTableTypeID == (int)EnumTableType.Info).ToList();

            foreach (OilDataSearchRowEntity e in oilDataRowEntityList)
            {
                OilDataSearchEntity wholeDataSearch = new OilDataSearchEntity();
                dataSearchList.Add(wholeDataSearch);
                wholeDataSearch.oilInfoID     = this._oilB.ID;
                wholeDataSearch.oilTableColID = infoOilTalbeColID;
                wholeDataSearch.oilTableRowID = e.OilTableRowID;
                #region
                if (e.OilTableRow.itemCode == "CNA")
                {
                    wholeDataSearch.calData = this._oilB.crudeName;
                }
                else if (e.OilTableRow.itemCode == "ENA")
                {
                    wholeDataSearch.calData = this._oilB.englishName;
                }
                else if (e.OilTableRow.itemCode == "IDC")
                {
                    wholeDataSearch.calData = this._oilB.crudeIndex;
                }
                else if (e.OilTableRow.itemCode == "COU")
                {
                    wholeDataSearch.calData = this._oilB.country;
                }
                else if (e.OilTableRow.itemCode == "GRC")
                {
                    wholeDataSearch.calData = this._oilB.region;
                }
                else if (e.OilTableRow.itemCode == "ADA")
                {
                    wholeDataSearch.calData = this._oilB.receiveDate != null?this._oilB.receiveDate.ToString() : string.Empty;
                }
                else if (e.OilTableRow.itemCode == "ALA")
                {
                    wholeDataSearch.calData = this._oilB.assayLab;
                }
                #endregion

                #region
                if (e.OilTableRow.itemCode == "AER")
                {
                    wholeDataSearch.calData = this._oilB.assayer;
                }
                else if (e.OilTableRow.itemCode == "SR")
                {
                    wholeDataSearch.calData = this._oilB.sourceRef;
                }
                else if (e.OilTableRow.itemCode == "ASC")
                {
                    wholeDataSearch.calData = this._oilB.assayCustomer;
                }
                else if (e.OilTableRow.itemCode == "RIN")
                {
                    wholeDataSearch.calData = this._oilB.reportIndex;
                }
                else if (e.OilTableRow.itemCode == "CLA")
                {
                    wholeDataSearch.calData = this._oilB.type;
                }
                else if (e.OilTableRow.itemCode == "TYP")
                {
                    wholeDataSearch.calData = this._oilB.classification;
                }
                else if (e.OilTableRow.itemCode == "SCL")
                {
                    wholeDataSearch.calData = this._oilB.sulfurLevel;
                }
                #endregion
            }
            #endregion

            #region "原油性质表的查找数据"
            OilDataSearchColEntity        wholeSearchCol = dataSearchCols.Where(o => o.OilTableName == "原油性质").FirstOrDefault();
            List <OilDataSearchRowEntity> wholeRowList   = wholeSearchCol.OilDataRowList;
            for (int wholeIndex = 0; wholeIndex < wholeRowList.Count; wholeIndex++)
            {
                OilDataBEntity wholeData = this._oilB.OilDatas.Where(o => o.oilTableRowID == wholeRowList[wholeIndex].OilTableRowID).FirstOrDefault();

                if (wholeData != null)
                {
                    OilDataSearchEntity wholeDataSearch = new OilDataSearchEntity();
                    dataSearchList.Add(wholeDataSearch);
                    wholeDataSearch.oilInfoID     = this._oilB.ID;
                    wholeDataSearch.oilTableColID = wholeSearchCol.OilTableColID;
                    wholeDataSearch.oilTableRowID = wholeRowList[wholeIndex].OilTableRowID;
                    wholeDataSearch.calData       = wholeData.calData;
                }
            }
            #endregion

            #region "宽馏分表和渣油表"
            for (int cutIndex = 0; cutIndex < this._cutMothedEntityList.Count; cutIndex++)
            {
                OilDataSearchColEntity        dataSearchCol      = dataSearchCols.Where(o => o.OilTableName == this._cutMothedEntityList[cutIndex].Name).FirstOrDefault();
                List <OilDataSearchRowEntity> wideDataSearchRows = dataSearchCol.OilDataRowList;

                for (int rowIndex = 0; rowIndex < wideDataSearchRows.Count; rowIndex++)
                {
                    CutDataEntity cutData = cutDataList.Where(o => o.CutName == this._cutMothedEntityList[cutIndex].Name && o.YItemCode == wideDataSearchRows[rowIndex].OilTableRow.itemCode).FirstOrDefault();

                    if (cutData != null && cutData.CutData != null)
                    {
                        OilDataSearchEntity wholeDataSearch = new OilDataSearchEntity();
                        dataSearchList.Add(wholeDataSearch);
                        wholeDataSearch.oilInfoID     = this._oilB.ID;
                        wholeDataSearch.oilTableColID = dataSearchCol.OilTableColID;
                        wholeDataSearch.oilTableRowID = wideDataSearchRows[rowIndex].OilTableRowID;
                        wholeDataSearch.calData       = cutData.CutData.ToString();
                    }
                }
            }
            #endregion

            return(dataSearchList);
        }
Example #3
0
        /// <summary>
        /// 初始化普通切割曲线数据
        /// </summary>
        /// <param name="dataGridView"></param>
        /// <param name="Datas"></param>
        private void initData(DataGridView dataGridView, List <ShowCurveEntity> showCurves, IList <CutMothedEntity> cutMotheds)
        {
            if (showCurves == null)
            {
                return;
            }

            #region "设置列实体  "


            Dictionary <string, int> rowIDDic = new Dictionary <string, int>(); //表的行和oiltableRowID对应
            int rowID = 0;                                                      //设置行ID=0
            foreach (var temp in showCurves)
            {
                if (!rowIDDic.Keys.Contains(temp.PropertyY))
                {
                    rowIDDic.Add(temp.PropertyY, rowID);
                    rowID++;
                }
            }
            #endregion

            Dictionary <string, string> rowDic = new Dictionary <string, string>();

            #region "初列:序号、项目、代码"
            dataGridView.ReadOnly = true;
            dataGridView.Columns.Clear();
            DataGridViewTextBoxColumn colID = new DataGridViewTextBoxColumn()
            {
                Name         = "序号",
                AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells,
                ReadOnly     = true
            };
            DataGridViewTextBoxColumn Code = new DataGridViewTextBoxColumn()
            {
                Name         = "代码",
                AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells,
                ReadOnly     = true
            };
            DataGridViewTextBoxColumn Name = new DataGridViewTextBoxColumn()
            {
                Name         = "名称",
                AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells,
                ReadOnly     = true
            };

            dataGridView.Columns.Add(colID);
            dataGridView.Columns.Add(Code);
            dataGridView.Columns.Add(Name);

            rowDic.Add("序号", null);
            rowDic.Add("代码", null);
            rowDic.Add("名称", null);

            foreach (var temp in cutMotheds)
            {
                DataGridViewTextBoxColumn column = new DataGridViewTextBoxColumn
                {
                    HeaderText = temp.Name,
                    Name       = temp.Name,
                    Tag        = temp.Name
                };
                dataGridView.Columns.Add(column);
                rowDic.Add(temp.Name, string.Empty);
            }
            #endregion

            #region "初始化所有行"
            dataGridView.Rows.Clear();
            List <string> KeyList = rowDic.Keys.ToList();
            foreach (string strKey in KeyList)
            {
                if (strKey.Equals("序号"))
                {
                    rowDic[strKey] = "0";
                }
                else if (strKey.Equals("代码"))
                {
                    rowDic[strKey] = "ICP";
                }
                else if (strKey.Equals("名称"))
                {
                    rowDic[strKey] = "初切点";
                }
                else
                {
                    CutMothedEntity cutMothed = cutMotheds.Where(o => o.Name == strKey).FirstOrDefault();
                    rowDic[strKey] = cutMothed.ICP == -2000 ? string.Empty : cutMothed.ICP.ToString();
                }
            }
            dataGridView.Rows.Add(rowDic.Values.ToArray());

            foreach (string strKey in KeyList)
            {
                if (strKey.Equals("序号"))
                {
                    rowDic[strKey] = "1";
                }
                else if (strKey.Equals("代码"))
                {
                    rowDic[strKey] = "ECP";
                }
                else if (strKey.Equals("名称"))
                {
                    rowDic[strKey] = "终切点";
                }
                else
                {
                    CutMothedEntity cutMothed = cutMotheds.Where(o => o.Name == strKey).FirstOrDefault();
                    rowDic[strKey] = cutMothed.ECP == 2000 ? string.Empty : cutMothed.ECP.ToString();
                }
            }
            dataGridView.Rows.Add(rowDic.Values.ToArray());
            #endregion

            #region "赋值"
            for (int i = 0; i < showCurves.Count; i++)
            {
                foreach (string strKey in KeyList)
                {
                    if (strKey.Equals("序号"))
                    {
                        rowDic[strKey] = (i + 2).ToString();
                    }
                    else if (strKey.Equals("代码"))
                    {
                        rowDic[strKey] = showCurves[i].PropertyY;
                    }
                    else if (strKey.Equals("名称"))
                    {
                        rowDic[strKey] = showCurves[i].ItemName;
                    }
                    else
                    {
                        CutDataEntity cutData = showCurves[i].CutDatas.Where(o => o.CutName == strKey).FirstOrDefault();
                        rowDic[strKey] = cutData == null ? string.Empty : cutData.ShowCutData;
                    }
                }
                dataGridView.Rows.Add(rowDic.Values.ToArray());
            }
            #endregion
        }