/// <summary> /// 添加所有 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAddAll_Click(object sender, EventArgs e) { if (this.comboBox1.SelectedItem != null && this.comboBox2.Items.Count > 0) { for (int colIndex = 0; colIndex < this.comboBox2.Items.Count; colIndex++) { ListViewItem item = new ListViewItem(); for (int j = 0; j < this.listView1.Columns.Count; j++) { ListViewItem.ListViewSubItem temp = new ListViewItem.ListViewSubItem(); temp.Name = this.listView1.Columns[j].Name; item.SubItems.Add(temp); } OilDataSearchColEntity col = (OilDataSearchColEntity)this.comboBox1.SelectedItem; OilTableRowEntity row = (OilTableRowEntity)this.comboBox2.Items[colIndex]; bool Have = false; for (int i = 0; i < this.listView1.Items.Count; i++) { if (this.listView1.Items[i].SubItems[0].Text == col.OilTableName && this.listView1.Items[i].SubItems[2].Text == row.itemName) { Have = true; } } //for (int i = 0; i < this._TemplistView.Items.Count; i++) //{ // if (this._TemplistView.Items[i].SubItems[0].Text == col.OilTableName && this._TemplistView.Items[i].SubItems[2].Text == row.itemName) // { // Have = true; // } //} if (!Have) { item.SubItems[0].Text = col.OilTableName; item.SubItems[1].Text = ":"; item.SubItems[2].Text = row.itemName; item.SubItems[0].Tag = col.OilTableColID; item.SubItems[2].Tag = row.ID; this.listView1.Items.Add(item); } } } }
/// <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="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> /// 接口方式三 /// </summary> /// <param name="oilPropertyAPIEntity">定制的获取性质</param> /// <param name="cutMotheds">定制切割方案</param> /// <returns>原油数据</returns> public OilInfoBEntity GetCutResultAPI(OilPropertyAPIEntity oilPropertyAPIEntity, List <CutMothedAPIEntity> cutMotheds) { List <CutMothedEntity> cutMothedList = new List <CutMothedEntity>(); for (int index = 0; index < cutMotheds.Count; index++) { CutMothedEntity cutMothed = new CutMothedEntity(); cutMothed.ICP = cutMotheds[index].ICP; cutMothed.ECP = cutMotheds[index].ECP; cutMothed.Name = cutMotheds[index].Name.GetDescription(); cutMothedList.Add(cutMothed); } OilDataSearchColAccess oilDataColAccess = new OilDataSearchColAccess(); List <OilDataSearchColEntity> OilDataCols = oilDataColAccess.Get("1=1"); OilDataSearchRowAccess oilDataRowAccess = new OilDataSearchRowAccess(); List <OilDataSearchRowEntity> OilDataRows = oilDataRowAccess.Get("1=1"); IList <OilSimilarSearchEntity> oilSimilarSearchList = new List <OilSimilarSearchEntity>(); OilDataSearchColEntity wholeCol = OilDataCols.Where(o => o.OilTableName.Contains("原油性质")).FirstOrDefault(); if (wholeCol != null) { #region "原油性质" OilDataSearchRowEntity D20SearchRow = OilDataRows.Where(o => o.OilTableRow.itemCode == "D20" && o.OilDataColID == wholeCol.ID).FirstOrDefault(); OilDataSearchRowEntity WAXSearchRow = OilDataRows.Where(o => o.OilTableRow.itemCode == "WAX" && o.OilDataColID == wholeCol.ID).FirstOrDefault(); OilDataSearchRowEntity SULSearchRow = OilDataRows.Where(o => o.OilTableRow.itemCode == "SUL" && o.OilDataColID == wholeCol.ID).FirstOrDefault(); OilDataSearchRowEntity N2SearchRow = OilDataRows.Where(o => o.OilTableRow.itemCode == "N2" && o.OilDataColID == wholeCol.ID).FirstOrDefault(); OilDataSearchRowEntity CCRSearchRow = OilDataRows.Where(o => o.OilTableRow.itemCode == "CCR" && o.OilDataColID == wholeCol.ID).FirstOrDefault(); if (D20SearchRow != null && !oilPropertyAPIEntity.D20.Equals(float.NaN)) { OilSimilarSearchEntity D20OilSimilarSearch = new OilSimilarSearchEntity(); oilSimilarSearchList.Add(D20OilSimilarSearch); D20OilSimilarSearch.Fvalue = oilPropertyAPIEntity.D20; D20OilSimilarSearch.Weight = 10; D20OilSimilarSearch.ItemCode = "D20"; D20OilSimilarSearch.OilTableColID = wholeCol.OilTableColID; D20OilSimilarSearch.OilTableRowID = D20SearchRow.OilTableRowID; } if (WAXSearchRow != null && !oilPropertyAPIEntity.WAX.Equals(float.NaN)) { OilSimilarSearchEntity WAXOilSimilarSearch = new OilSimilarSearchEntity(); oilSimilarSearchList.Add(WAXOilSimilarSearch); WAXOilSimilarSearch.Fvalue = oilPropertyAPIEntity.WAX; WAXOilSimilarSearch.Weight = 1; WAXOilSimilarSearch.ItemCode = "WAX"; WAXOilSimilarSearch.OilTableColID = wholeCol.OilTableColID; WAXOilSimilarSearch.OilTableRowID = WAXSearchRow.OilTableRowID; } if (SULSearchRow != null && !oilPropertyAPIEntity.SUL.Equals(float.NaN)) { OilSimilarSearchEntity SULOilSimilarSearch = new OilSimilarSearchEntity(); oilSimilarSearchList.Add(SULOilSimilarSearch); SULOilSimilarSearch.Fvalue = oilPropertyAPIEntity.SUL; SULOilSimilarSearch.Weight = 1; SULOilSimilarSearch.ItemCode = "SUL"; SULOilSimilarSearch.OilTableColID = wholeCol.OilTableColID; SULOilSimilarSearch.OilTableRowID = SULSearchRow.OilTableRowID; } if (N2SearchRow != null && !oilPropertyAPIEntity.N2.Equals(float.NaN)) { OilSimilarSearchEntity N2OilSimilarSearch = new OilSimilarSearchEntity(); oilSimilarSearchList.Add(N2OilSimilarSearch); N2OilSimilarSearch.Fvalue = oilPropertyAPIEntity.N2; N2OilSimilarSearch.Weight = 1; N2OilSimilarSearch.ItemCode = "N2"; N2OilSimilarSearch.OilTableColID = wholeCol.OilTableColID; N2OilSimilarSearch.OilTableRowID = N2SearchRow.OilTableRowID; } if (CCRSearchRow != null && !oilPropertyAPIEntity.CCR.Equals(float.NaN)) { OilSimilarSearchEntity CCROilSimilarSearch = new OilSimilarSearchEntity(); oilSimilarSearchList.Add(CCROilSimilarSearch); CCROilSimilarSearch.Fvalue = oilPropertyAPIEntity.CCR; CCROilSimilarSearch.Weight = 1; CCROilSimilarSearch.ItemCode = "CCR"; CCROilSimilarSearch.OilTableColID = wholeCol.OilTableColID; CCROilSimilarSearch.OilTableRowID = CCRSearchRow.OilTableRowID; } #endregion } OilDataSearchColEntity Col15_140 = OilDataCols.Where(o => o.ICP == 15 && o.ECP == 140).FirstOrDefault(); OilDataSearchColEntity Col15_180 = OilDataCols.Where(o => o.ICP == 15 && o.ECP == 180).FirstOrDefault(); OilDataSearchColEntity Col140_240 = OilDataCols.Where(o => o.ICP == 140 && o.ECP == 240).FirstOrDefault(); OilDataSearchColEntity Col240_350 = OilDataCols.Where(o => o.ICP == 240 && o.ECP == 350).FirstOrDefault(); #region "TWY" if (Col15_140 != null) { OilDataSearchRowEntity DSearchRow15_140 = OilDataRows.Where(o => o.OilTableRow.itemCode == "TWY" && o.OilDataColID == Col15_140.ID).FirstOrDefault(); if (DSearchRow15_140 != null && !oilPropertyAPIEntity.TWY140.Equals(float.NaN)) { OilSimilarSearchEntity TWY15_140OilSimilarSearch = new OilSimilarSearchEntity(); oilSimilarSearchList.Add(TWY15_140OilSimilarSearch); TWY15_140OilSimilarSearch.Fvalue = oilPropertyAPIEntity.TWY140; TWY15_140OilSimilarSearch.Weight = 1; TWY15_140OilSimilarSearch.ItemCode = "TWY15_140"; TWY15_140OilSimilarSearch.OilTableColID = Col15_140.OilTableColID; TWY15_140OilSimilarSearch.OilTableRowID = DSearchRow15_140.OilTableRowID; } } if (Col15_180 != null) { OilDataSearchRowEntity DSearchRow15_180 = OilDataRows.Where(o => o.OilTableRow.itemCode == "TWY" && o.OilDataColID == Col15_180.ID).FirstOrDefault(); if (DSearchRow15_180 != null && !oilPropertyAPIEntity.TWY180.Equals(float.NaN)) { OilSimilarSearchEntity TWY15_180OilSimilarSearch = new OilSimilarSearchEntity(); oilSimilarSearchList.Add(TWY15_180OilSimilarSearch); TWY15_180OilSimilarSearch.Fvalue = oilPropertyAPIEntity.TWY180; TWY15_180OilSimilarSearch.Weight = 1; TWY15_180OilSimilarSearch.ItemCode = "TWY15_180"; TWY15_180OilSimilarSearch.OilTableColID = Col15_180.OilTableColID; TWY15_180OilSimilarSearch.OilTableRowID = DSearchRow15_180.OilTableRowID; } } if (Col140_240 != null) { OilDataSearchRowEntity DSearchRow140_240 = OilDataRows.Where(o => o.OilTableRow.itemCode == "TWY" && o.OilDataColID == Col140_240.ID).FirstOrDefault(); if (DSearchRow140_240 != null && !oilPropertyAPIEntity.TWY240.Equals(float.NaN)) { OilSimilarSearchEntity TWY140_240OilSimilarSearch = new OilSimilarSearchEntity(); oilSimilarSearchList.Add(TWY140_240OilSimilarSearch); TWY140_240OilSimilarSearch.Fvalue = oilPropertyAPIEntity.TWY240; TWY140_240OilSimilarSearch.Weight = 1; TWY140_240OilSimilarSearch.ItemCode = "TWY140_240"; TWY140_240OilSimilarSearch.OilTableColID = Col140_240.OilTableColID; TWY140_240OilSimilarSearch.OilTableRowID = DSearchRow140_240.OilTableRowID; } } if (Col240_350 != null) { OilDataSearchRowEntity DSearchRow240_350 = OilDataRows.Where(o => o.OilTableRow.itemCode == "TWY" && o.OilDataColID == Col240_350.ID).FirstOrDefault(); if (DSearchRow240_350 != null && !oilPropertyAPIEntity.TWY350.Equals(float.NaN)) { OilSimilarSearchEntity TWY240_350OilSimilarSearch = new OilSimilarSearchEntity(); oilSimilarSearchList.Add(TWY240_350OilSimilarSearch); TWY240_350OilSimilarSearch.Fvalue = oilPropertyAPIEntity.TWY350; TWY240_350OilSimilarSearch.Weight = 1; TWY240_350OilSimilarSearch.ItemCode = "TWY240_350"; TWY240_350OilSimilarSearch.OilTableColID = Col240_350.OilTableColID; TWY240_350OilSimilarSearch.OilTableRowID = DSearchRow240_350.OilTableRowID; } } #endregion OilApplyBll oilApplyBll = new OilApplyBll(); OilInfoBEntity oilB = oilApplyBll.GetCutResult(oilSimilarSearchList, cutMothedList); List <OilDataTableBAPIEntity> OilDataTableBAPIEntityList = new List <OilDataTableBAPIEntity>(); if (oilB != null) { if (oilB.CutDataEntityList != null) { #region "数据格式转换" foreach (CutDataEntity cutData in oilB.CutDataEntityList) { string strCal = cutData.CutData != null?cutData.CutData.ToString() : string.Empty; float fData = 0; if (strCal != string.Empty && float.TryParse(strCal, out fData)) { OilDataTableBAPIEntity oilDataTable = new OilDataTableBAPIEntity(); OilDataTableBAPIEntityList.Add(oilDataTable); oilDataTable.CalData = fData; oilDataTable.ItemCode = cutData.YItemCode; #region "CutTableName" CutTableName cutName = CutTableName.ChaiYou; string strName = cutData.CutName; if (strName == CutTableName.ChaiYou.GetDescription()) { cutName = CutTableName.ChaiYou; } else if (strName == CutTableName.LaYou.GetDescription()) { cutName = CutTableName.LaYou; } else if (strName == CutTableName.MeiYou.GetDescription()) { cutName = CutTableName.MeiYou; } else if (strName == CutTableName.ShiNaoYou.GetDescription()) { cutName = CutTableName.ShiNaoYou; } else if (strName == CutTableName.YuanYouXingZhi.GetDescription()) { cutName = CutTableName.YuanYouXingZhi; } else if (strName == CutTableName.ZhaYou.GetDescription()) { cutName = CutTableName.ZhaYou; } #endregion oilDataTable.cutTableName = cutName; } } #endregion } oilB.OilDataTableBAPIEntityList = OilDataTableBAPIEntityList; } return(oilB); }
/// <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); }