/// <summary> /// 获取C库的校正值 /// </summary> /// <param name="rangeSearchEntity"></param> /// <param name="oilInfoID">oilInfoID</param> /// <param name="value">查询的物性是否为原油信息表(true代表是)</param> /// <returns></returns> private static string getCalValueFromOilDataSearch(OilRangeSearchEntity rangeSearchEntity, int oilInfoID, EnumTableType tableType = EnumTableType.Info) { string result = string.Empty; OilDataSearchAccess oilDataSearchAccess = new OilDataSearchAccess(); string sqlWhere = " oilInfoId ='" + oilInfoID.ToString() + "'" + "and oilTableRowID='" + rangeSearchEntity.OilTableRowID.ToString() + "'" + " and oilTableColId='" + rangeSearchEntity.OilTableColID + "'" + " and calData!=''"; List <OilDataSearchEntity> oilDataSearchEntityList = oilDataSearchAccess.Get(sqlWhere);//获取对应物性的校正值 if (oilDataSearchEntityList.Count != 0) { result = oilDataSearchEntityList.FirstOrDefault().calData; } //List<OilDataSearchEntity> calList = new List<OilDataSearchEntity>(); //if (tableType == EnumTableType.Info) //{ // string itemCode = rangeSearchEntity.itemCode; // string oilTableRowID = OilBll.GetOilTableRowIDFromOilTableRowByItemCode(itemCode, tableType).ToString(); // string sqlWhere = " oilInfoId ='" + oilInfoID.ToString() + "'" + "and oilTableRowID='" + oilTableRowID + "'" + " and oilTableColId='" + rangeSearchEntity.OilTableColID + "'" + " and calData!=''"; // calList = oilDataSearchAccess.Get(sqlWhere);//获取对应物性的校正值 //} //else //{ // string sqlWhere = " oilInfoId ='" + oilInfoID.ToString() + "'" + "and oilTableRowID='" + rangeSearchEntity.OilTableRowID.ToString() + "'" + " and oilTableColId='" + rangeSearchEntity.OilTableColID + "'" + " and calData!=''"; // calList = oilDataSearchAccess.Get(sqlWhere);//获取对应物性的校正值 //} return(result); }
/// <summary> /// 获取原油信息表的相应物性上下限值 /// </summary> /// <param name="searchEntity"></param> /// <returns></returns> private static List <string> oilInfoDataUpDown(OilRangeSearchEntity searchEntity) { List <string> result = new List <string>(); result.Add(searchEntity.downLimit); result.Add(searchEntity.upLimit); return(result); }
/// <summary> /// 获取除原油信息表外的相应物性上下限值 /// </summary> /// <param name="searchEntity"></param> /// <returns></returns> private static List <double> dataUpDown(OilRangeSearchEntity searchEntity) { List <double> Result = new List <double>(); double down = 0, up = 0; if (double.TryParse(searchEntity.downLimit, out down) && double.TryParse(searchEntity.upLimit, out up)) { Result.Add(up); Result.Add(down); } else { Result.Add(0); Result.Add(0); } return(Result); }
/// <summary> /// 范围查询中的确定按钮事件,目的进行数据范围查询 /// </summary> public override void btnRangeSubmit_Click(object sender, EventArgs e) { if (this.rangeListView.Items.Count <= 0) { return; } this._rangeSearchList = new List <OilRangeSearchEntity>(); try { this.StartWaiting(); #region "显示条件集合" foreach (ListViewItem item in this.rangeListView.Items) { OilRangeSearchEntity rangeSearch = new OilRangeSearchEntity(); rangeSearch.itemCode = item.Tag.ToString(); rangeSearch.LeftParenthesis = item.SubItems[0].Tag.ToString(); rangeSearch.OilTableColID = Convert.ToInt32(item.SubItems[1].Tag.ToString()); rangeSearch.OilTableRowID = item.SubItems[3].Tag.ToString(); rangeSearch.downLimit = item.SubItems[5].Tag.ToString(); rangeSearch.upLimit = item.SubItems[7].Tag.ToString(); rangeSearch.RightParenthesis = item.SubItems[8].Tag.ToString(); rangeSearch.FracitonName = item.SubItems[1].Text; rangeSearch.ItemName = item.SubItems[3].Text; if (this.rangeListView.Items.Count == 1) { rangeSearch.IsAnd = true; } else { rangeSearch.IsAnd = item.SubItems[9].Tag.ToString() == "And" ? true : false; } this._rangeSearchList.Add(rangeSearch); } #endregion #region "当前显示原油的集合" List <CrudeIndexIDAEntity> currentCrudeIndexIDList = new List <CrudeIndexIDAEntity>(); foreach (DataGridViewRow row in this.gridList.Rows) { CrudeIndexIDAEntity tempCrudeIndexIDAEntity = new CrudeIndexIDAEntity(); tempCrudeIndexIDAEntity.ID = Convert.ToInt32(row.Cells["ID"].Value.ToString()); tempCrudeIndexIDAEntity.crudeIndex = row.Cells["原油编号"].Value.ToString(); tempCrudeIndexIDAEntity.crudeName = row.Cells["原油名称"].Value.ToString(); currentCrudeIndexIDList.Add(tempCrudeIndexIDAEntity); } #endregion OilBll oilBll = new OilBll(); this.tempRanSumDic = oilBll.GetRangOilInfoCrudeIndex(this._rangeSearchList); //从C库获取满足条件的原油编号 GetRangeSearchResult(this.tempRanSumDic, currentCrudeIndexIDList); //绑定控件 } catch (Exception ex) { Log.Error("原油B库范围查找错误:" + ex.ToString()); return; } finally { this.StopWaiting(); } }
private void butRemarkFind_Click(object sender, EventArgs e) { if (this.gridOilListViewRemark.Items.Count <= 0) { return; } List <OilRangeSearchEntity> rangeSearchList = new List <OilRangeSearchEntity>(); #region "查询条件集合" foreach (ListViewItem item in this.gridOilListViewRemark.Items) { OilRangeSearchEntity rangeSearch = new OilRangeSearchEntity(); rangeSearch.LeftParenthesis = item.SubItems[0].Tag.ToString(); rangeSearch.TableTypeID = Convert.ToInt32(item.SubItems[1].Tag.ToString()); rangeSearch.OilTableRowID = item.SubItems[3].Tag.ToString(); rangeSearch.ItemName = item.SubItems[3].Text; rangeSearch.RemarkKeyWord = item.SubItems[5].Text; rangeSearch.downLimit = item.SubItems[7].Tag.ToString(); rangeSearch.RightParenthesis = item.SubItems[8].Tag.ToString(); if (this.gridOilListViewRemark.Items.Count == 1) { rangeSearch.IsAnd = true; } else { rangeSearch.IsAnd = item.SubItems[9].Tag.ToString() == "And" ? true : false; } rangeSearchList.Add(rangeSearch); } #endregion try { StartWaiting(); this.dgvResult.BringToFront(); List <QueryEntity> showQueryEntityList = new List <QueryEntity>(); #region "显示" if (this._tempShowViewList != null) { foreach (ListViewItem currentItem in this._tempShowViewList.Items) { string tableName = currentItem.SubItems[0].Text; int tableTypeID = Convert.ToInt32(currentItem.SubItems[0].Tag.ToString()); string itemName = currentItem.SubItems[2].Text; string valueType = currentItem.SubItems[4].Text; if (tableName != string.Empty && itemName != string.Empty && valueType != string.Empty) { showQueryEntityList.Add(new QueryEntity((EnumTableType)tableTypeID, itemName, valueType, true)); } } } #endregion Dictionary <string, List <RemarkEntity> > queryResult = GetRemarkQueryResult(rangeSearchList);//查询 List <string> rowHeader = getRemarkTableHeader(); setRemarkDgvColumn(rowHeader, this.dgvResult); setRemarkDgvRow(queryResult, this.dgvResult); outExcelInit(); } catch (Exception ex) { Log.Error("工具箱的查找:" + ex.ToString()); } finally { StopWaiting(); } }