/// <summary> /// 单元格的范围判断 /// </summary> /// <param name="oilData"></param> /// <param name="row"></param> /// <param name="errType"></param> /// <returns></returns> private string wideCellRangeCheck(OilDataEntity oilData, OilDataEntity wctOilData, enumCheckExpericencType errType) { OilDataCheck oilDataCheck = new OilDataCheck(); Dictionary <string, string> WideWCTDic = new Dictionary <string, string>(); WideWCTDic.Add("石脑油", "石脑油表"); WideWCTDic.Add("重整料", "石脑油表"); WideWCTDic.Add("溶剂油", "石脑油表"); WideWCTDic.Add("乙烯料", "石脑油表"); WideWCTDic.Add("航煤", "航煤表"); WideWCTDic.Add("煤油", "航煤表"); WideWCTDic.Add("柴油", "柴油表"); WideWCTDic.Add("蜡油", "VGO表"); WideWCTDic.Add("脱蜡油", "VGO表"); WideWCTDic.Add("精制油1", "VGO表"); WideWCTDic.Add("精制油2", "VGO表"); WideWCTDic.Add("精制油3", "VGO表"); StringBuilder sbAlert = new StringBuilder(); string strEmpty = string.Empty; if (oilData == null || wctOilData == null) { return(strEmpty); } string strTableType = string.Empty; if (WideWCTDic.Keys.Contains(wctOilData.calData)) { strTableType = WideWCTDic[wctOilData.calData]; } else { return(strEmpty); } OilTableTypeComparisonTableAccess oilTableTypeComparisonTableAccess = new OilTableTypeComparisonTableAccess(); List <OilTableTypeComparisonTableEntity> OilTableTypeComparisonTableList = oilTableTypeComparisonTableAccess.Get("1=1"); RangeParmTableAccess trendParmTableAccess = new RangeParmTableAccess(); List <RangeParmTableEntity> trendParmList = trendParmTableAccess.Get("1=1"); OilTableTypeComparisonTableEntity comparisonTableEntity = OilTableTypeComparisonTableList.Where(o => o.tableName == strTableType).FirstOrDefault(); List <RangeParmTableEntity> trendParmTableList = trendParmList.Where(o => o.OilTableTypeComparisonTableID == comparisonTableEntity.ID).ToList(); RangeParmTableEntity TrendParm = trendParmTableList.Where(o => o.itemCode == oilData.OilTableRow.itemCode).FirstOrDefault(); if (TrendParm == null) { return(strEmpty); } float tempValue = 0; if (float.TryParse(oilData.calData, out tempValue)) //如果是浮点数 { float TrendParmAlertDownLimit = 0, TrendParmAlertUpLimit = 0; if (TrendParm.alertDownLimit == strEmpty && TrendParm.alertUpLimit != strEmpty) { if (float.TryParse(TrendParm.alertUpLimit, out TrendParmAlertUpLimit)) { if (tempValue <= TrendParmAlertUpLimit)//无下限,有上限,则校正值<=上限,数据正常;否则有疑问。 { return(strEmpty); } else { return(DataCheck.OilDataCheck.ExperienceCheckMetion((EnumTableType)oilData.OilTableTypeID, oilData.OilTableRow, oilData.OilTableCol, enumCheckExpericencType.Limit)); } } } else if (TrendParm.alertDownLimit != strEmpty && TrendParm.alertUpLimit == strEmpty) { if (float.TryParse(TrendParm.alertDownLimit, out TrendParmAlertDownLimit)) { if (tempValue >= TrendParmAlertDownLimit) //无上限,有下限,则校正值>=下限,数据正常;否则有疑问。 { return(strEmpty); } else { return(DataCheck.OilDataCheck.ExperienceCheckMetion((EnumTableType)oilData.OilTableTypeID, oilData.OilTableRow, oilData.OilTableCol, enumCheckExpericencType.Limit)); } } } else if (TrendParm.alertDownLimit != strEmpty && TrendParm.alertUpLimit != strEmpty) { if (float.TryParse(TrendParm.alertDownLimit, out TrendParmAlertDownLimit) && float.TryParse(TrendParm.alertUpLimit, out TrendParmAlertUpLimit)) { if (tempValue >= TrendParmAlertDownLimit && tempValue <= TrendParmAlertUpLimit) //有上、下限,则上限>=校正值>=下限,数据正常;否则有疑问。 { return(strEmpty); } else { return(DataCheck.OilDataCheck.ExperienceCheckMetion((EnumTableType)oilData.OilTableTypeID, oilData.OilTableRow, oilData.OilTableCol, enumCheckExpericencType.Limit)); } } } else if (TrendParm.alertDownLimit == strEmpty && TrendParm.alertUpLimit == strEmpty) { //无上、下限,则不作判断。 } } else { //return oilDataCheck.CheckMetion(oilData.OilTableRow.itemName, oilData.OilTableRow.RowIndex, enumCheckErrType.TypeError); } return(strEmpty); }
/// <summary> /// 单元格的范围判断 /// </summary> /// <param name="oilData"></param> /// <param name="row"></param> /// <param name="errType"></param> /// <returns></returns> private string cellRangeCheck(OilDataEntity oilData, RangeParmTableEntity TrendParm, enumCheckExpericencType errType) { StringBuilder sbAlert = new StringBuilder(); string strEmpty = string.Empty; float tempValue = 0; if (float.TryParse(oilData.calData, out tempValue)) //如果是浮点数 { float TrendParmAlertDownLimit = 0, TrendParmAlertUpLimit = 0; if (TrendParm.alertDownLimit == strEmpty && TrendParm.alertUpLimit != strEmpty) { if (float.TryParse(TrendParm.alertUpLimit, out TrendParmAlertUpLimit)) { if (tempValue <= TrendParmAlertUpLimit)//无下限,有上限,则校正值<=上限,数据正常;否则有疑问。 { return(strEmpty); } else { return(DataCheck.OilDataCheck.ExperienceCheckMetion((EnumTableType)oilData.OilTableTypeID, oilData.OilTableRow, oilData.OilTableCol, enumCheckExpericencType.Limit)); } } } else if (TrendParm.alertDownLimit != strEmpty && TrendParm.alertUpLimit == strEmpty) { if (float.TryParse(TrendParm.alertDownLimit, out TrendParmAlertDownLimit)) { if (tempValue >= TrendParmAlertDownLimit) //无上限,有下限,则校正值>=下限,数据正常;否则有疑问。 { return(strEmpty); } else { return(DataCheck.OilDataCheck.ExperienceCheckMetion((EnumTableType)oilData.OilTableTypeID, oilData.OilTableRow, oilData.OilTableCol, enumCheckExpericencType.Limit)); } } } else if (TrendParm.alertDownLimit != strEmpty && TrendParm.alertUpLimit != strEmpty) { if (float.TryParse(TrendParm.alertDownLimit, out TrendParmAlertDownLimit) && float.TryParse(TrendParm.alertUpLimit, out TrendParmAlertUpLimit)) { if (tempValue >= TrendParmAlertDownLimit && tempValue <= TrendParmAlertUpLimit) //有上、下限,则上限>=校正值>=下限,数据正常;否则有疑问。 { return(strEmpty); } else { return(DataCheck.OilDataCheck.ExperienceCheckMetion((EnumTableType)oilData.OilTableTypeID, oilData.OilTableRow, oilData.OilTableCol, enumCheckExpericencType.Limit)); } } } else if (TrendParm.alertDownLimit == strEmpty && TrendParm.alertUpLimit == strEmpty) { //无上、下限,则不作判断。 } } else { //return DataCheck.OilDataCheck.CheckMetion(oilData.OilTableRow.itemName, oilData.OilTableRow.RowIndex, enumCheckErrType.TypeError); } return(strEmpty); }