/// <summary> /// 为OilDataSearchEntity的快速查询库的数据赋值 /// </summary> /// <param name="oilInfoEntity"></param> /// <param name="oilInfoOut"></param> /// <param name="oilTableRows"></param> /// <param name="oilTableCols"></param> public void toOilDataSearchs(ref OilInfoBEntity oilInfoEntity, OilInfoOut oilInfoOut) { foreach (OilDataSearchOut oilDataSearchOut in oilInfoOut.oilDataSearchOuts) //插入原油数据 { OilDataSearchEntity oilDataSearch = new OilDataSearchEntity(); //新建OilDataSearch实体 oilDataSearch.oilInfoID = oilInfoEntity.ID; oilDataSearch.oilTableColID = oilDataSearchOut.oilTableColID; oilDataSearch.oilTableRowID = oilDataSearchOut.oilTableRowID; oilDataSearch.labData = oilDataSearchOut.labData; oilDataSearch.calData = oilDataSearchOut.calData; oilInfoEntity.OilDataSearchs.Add(oilDataSearch); } }
/// <summary> /// /// </summary> /// <param name="dataGridView"></param> /// <param name="strValue"></param> /// <param name="_columnIndex"></param> /// <param name="_rowIndex"></param> public void CPaste(DataGridView dataGridView, string strValue, int _columnIndex, int _rowIndex) { if (strValue == string.Empty) { return; } if (_columnIndex < 0 || _columnIndex >= dataGridView.Columns.Count) { return; } if (_rowIndex < 0 || _rowIndex >= dataGridView.Rows.Count) { return; } OilDataSearchEntity searchData = null; int oilTableColID = 0, oilTableRowID = 0; string colTag = dataGridView.Columns[_columnIndex].Tag == null ? string.Empty : dataGridView.Columns[_columnIndex].Tag.ToString(); string rowTag = dataGridView.Rows[_rowIndex].Tag == null ? string.Empty : dataGridView.Rows[_rowIndex].Tag.ToString(); if (colTag != string.Empty && rowTag != string.Empty) { if (int.TryParse(dataGridView.Columns[_columnIndex].Tag.ToString(), out oilTableColID) && int.TryParse(dataGridView.Rows[_rowIndex].Tag.ToString(), out oilTableRowID)) { searchData = new OilDataSearchEntity(); searchData.calData = strValue; searchData.oilInfoID = this._COilID; searchData.oilTableColID = oilTableColID; searchData.oilTableRowID = oilTableRowID; OilDataSearchAccess dataSearch = new OilDataSearchAccess(); OilDataSearchEntity temp = dataSearch.Get("oilInfoID = " + this._COilID + "and oilTableColID = " + oilTableColID + "and oilTableRowID = " + oilTableRowID).FirstOrDefault(); if (temp == null) { dataSearch.Insert(searchData); } else { dataSearch.Update(searchData, temp.ID.ToString()); } } } }
/// <summary> /// 显示相似查找的基础值 /// </summary> /// <param name="oil"></param> private void selectOilData() { string crudeIndex = this.gridList.CurrentRow != null ? this.gridList.CurrentRow.Cells["原油编号"].Value.ToString() : string.Empty; OilInfoBAccess oilInfoB = new OilInfoBAccess(); OilInfoBEntity tempOilInfoB = oilInfoB.Get("crudeIndex = '" + crudeIndex + "'").FirstOrDefault(); if (tempOilInfoB == null) { return; } int oilInfoID = tempOilInfoB.ID; OilTableRowEntity selectOiltableRowEntity = (OilTableRowEntity)cmbSimilarItem.SelectedItem; //获取物性下拉菜单选择项实体 int oilTableRowID = selectOiltableRowEntity.ID; OilDataSearchColEntity selectedItem = (OilDataSearchColEntity)this.cmbSimilarFraction.SelectedItem; //确定当前菜单中的数据 int oilTableColID = selectedItem.OilTableColID; OilDataSearchAccess oilDataSearchAccess = new OilDataSearchAccess(); OilDataSearchEntity oilData = oilDataSearchAccess.Get("oilInfoID = " + oilInfoID + " and oilTableColID = " + oilTableColID + " and oilTableRowID =" + oilTableRowID).FirstOrDefault(); if (oilData != null) { if (oilData.calData != string.Empty && oilData.calData != "非数字" && oilData.calData != "正无穷大" && oilData.calData != "负无穷大") { float temp = 0; if (float.TryParse(oilData.calData, out temp)) { this.txtSimilarFoundationValue.Text = oilData.calData; } else { this.txtSimilarFoundationValue.Text = string.Empty; } } else { this.txtSimilarFoundationValue.Text = string.Empty; } } else { this.txtSimilarFoundationValue.Text = string.Empty; } }
/// <summary> /// 保存 /// </summary> /// <param name="dataGridView"></param> public void CSave(DataGridView dataGridView) { dataGridView.EndEdit(); for (int colIndex = 3; colIndex < dataGridView.Columns.Count; colIndex++) { for (int rowIndex = 0; rowIndex < dataGridView.Rows.Count; rowIndex++) { OilDataSearchEntity searchData = null; int oilTableColID = 0, oilTableRowID = 0; string colTag = dataGridView.Columns[colIndex].Tag == null ? string.Empty : dataGridView.Columns[colIndex].Tag.ToString(); string rowTag = dataGridView.Rows[rowIndex].Tag == null ? string.Empty : dataGridView.Rows[rowIndex].Tag.ToString(); string strValue = dataGridView.Rows[rowIndex].Cells[colIndex].Value == null ? string.Empty : dataGridView.Rows[rowIndex].Cells[colIndex].Value.ToString(); if (colTag != string.Empty && rowTag != string.Empty) { if (int.TryParse(colTag, out oilTableColID) && int.TryParse(rowTag, out oilTableRowID)) { OilDataSearchAccess dataSearch = new OilDataSearchAccess(); OilDataSearchEntity temp = dataSearch.Get("oilInfoID = " + this._COilID + "and oilTableColID = " + oilTableColID + "and oilTableRowID = " + oilTableRowID).FirstOrDefault(); if (temp == null) { searchData = new OilDataSearchEntity(); searchData.calData = strValue; searchData.oilInfoID = this._COilID; searchData.oilTableColID = oilTableColID; searchData.oilTableRowID = oilTableRowID; dataSearch.Insert(searchData); } else if (temp.calData != strValue) { searchData = new OilDataSearchEntity(); searchData.calData = strValue; searchData.oilInfoID = this._COilID; searchData.oilTableColID = oilTableColID; searchData.oilTableRowID = oilTableRowID; dataSearch.Update(searchData, temp.ID.ToString()); } } } } } }
/// <summary> /// 显示列表 /// </summary> /// <param name="listView"></param> /// <param name="Dic"></param> public override void InitSimilarList(ListView showListView, IDictionary <string, double> Dic) { if (Dic == null) { return; } if (Dic.Count <= 0) { return; } #region "建立simListView" ListView simListView = new ListView(); ColumnHeader columnHeader1 = new ColumnHeader(); ColumnHeader columnHeader2 = new ColumnHeader(); ColumnHeader columnHeader3 = new ColumnHeader(); simListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { columnHeader1, columnHeader2, columnHeader3 }); #region "查询条件" foreach (var item in this._similarSearchList) { string strTableName = item.FracitonName; string strItemName = item.ItemName; if (strTableName.Equals("原油信息") && (strItemName.Equals("原油编号") || strItemName.Equals("原油名称"))) { continue; } ListViewItem listViewItem = new ListViewItem(); for (int j = 0; j < simListView.Columns.Count; j++) { ListViewItem.ListViewSubItem temp = new ListViewItem.ListViewSubItem(); temp.Name = simListView.Columns[j].Name; listViewItem.SubItems.Add(temp); } listViewItem.SubItems[0].Text = item.FracitonName; listViewItem.SubItems[1].Text = ":"; listViewItem.SubItems[2].Text = item.ItemName; listViewItem.SubItems[0].Tag = item.OilTableColID; listViewItem.SubItems[2].Tag = item.OilTableRowID; simListView.Items.Add(listViewItem); } #endregion #region "显示条件" if (showListView != null) { foreach (ListViewItem item in showListView.Items) { string strTableName = item.SubItems[0].Text; string strItemName = item.SubItems[2].Text; if (strTableName.Equals("原油信息") && (strItemName.Equals("原油编号") || strItemName.Equals("原油名称"))) { continue; } bool haveItem = false; foreach (ListViewItem simItem in simListView.Items) { if (item.SubItems[0].Text == simItem.SubItems[0].Text && item.SubItems[2].Text == simItem.SubItems[2].Text) { haveItem = true; } } if (!haveItem) { ListViewItem listViewItem = new ListViewItem(); for (int j = 0; j < simListView.Columns.Count; j++) { ListViewItem.ListViewSubItem temp = new ListViewItem.ListViewSubItem(); temp.Name = simListView.Columns[j].Name; listViewItem.SubItems.Add(temp); } listViewItem.SubItems[0].Text = item.SubItems[0].Text; listViewItem.SubItems[1].Text = ":"; listViewItem.SubItems[2].Text = item.SubItems[2].Text; listViewItem.SubItems[0].Tag = item.SubItems[0].Tag; listViewItem.SubItems[2].Tag = item.SubItems[2].Tag; simListView.Items.Add(listViewItem); } } } #endregion #endregion #region "添加列" this.gridList.Columns.Clear(); this.gridList.Rows.Clear(); this.gridList.Columns.Add(new DataGridViewTextBoxColumn() { Name = "ID", HeaderText = "ID", AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells, Visible = false }); this.gridList.Columns.Add(new DataGridViewTextBoxColumn() { Name = "相似度总和", HeaderText = "相似度总和", AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells }); this.gridList.Columns.Add(new DataGridViewTextBoxColumn() { Name = "原油编号", HeaderText = "原油编号", AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells }); this.gridList.Columns.Add(new DataGridViewTextBoxColumn() { Name = "原油名称", HeaderText = "原油名称", AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells }); foreach (ListViewItem item in simListView.Items) { string strTableName = item.SubItems[0].Text; string strItemName = item.SubItems[2].Text; this.gridList.Columns.Add(new DataGridViewTextBoxColumn() { Name = strTableName, HeaderText = strTableName + ":" + strItemName, AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells }); } #endregion foreach (string key in Dic.Keys) { CrudeIndexIDBEntity crudeIndexIDBEntity = new OilInfoBCrudeIndexIDAccess().Get("crudeIndex = '" + key + "'").FirstOrDefault(); if (crudeIndexIDBEntity == null) { continue; } this._openOilCollection.Add(crudeIndexIDBEntity); object[] rowValue = null; List <object> tempList = new List <object>(); //tempList.Add(false); tempList.Add(crudeIndexIDBEntity.ID.ToString()); tempList.Add(Dic[key].ToString()); tempList.Add(crudeIndexIDBEntity.crudeIndex); tempList.Add(crudeIndexIDBEntity.crudeName); foreach (ListViewItem item in simListView.Items) { int oilDataSearchColID = Convert.ToInt32(item.SubItems[0].Tag.ToString()); int oilDataSearchRowID = Convert.ToInt32(item.SubItems[2].Tag.ToString()); OilDataSearchEntity dataSearchEntity = crudeIndexIDBEntity.OilDataSearchs.Where(o => o.oilTableColID == oilDataSearchColID && o.oilTableRowID == oilDataSearchRowID).FirstOrDefault(); if (dataSearchEntity == null) { tempList.Add(""); } else { tempList.Add(dataSearchEntity.calData); } } rowValue = tempList.ToArray(); this.gridList.Rows.Add(rowValue); } this.gridList.Sort(this.gridList.Columns["相似度总和"], ListSortDirection.Descending); }
/// <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); }
/// <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); }