|
@@ -219,7 +219,7 @@ namespace MeterVision.db
|
|
|
return isEqual;
|
|
|
}
|
|
|
|
|
|
- public int GetEqualFlag(double standValue, long finalValue)
|
|
|
+ public int GetEqualFlag2(string strStandValue,double standValue, long finalValue)
|
|
|
{
|
|
|
bool isEqual = false;
|
|
|
//比较结果值与标准值是否相等
|
|
@@ -256,15 +256,33 @@ namespace MeterVision.db
|
|
|
//全指针
|
|
|
//数字+指针(只比较数字部分)
|
|
|
//获取真正数据部分的值
|
|
|
- int standValue1 = (int)Math.Ceiling(standValue / LastUnit);
|
|
|
- int finalValue1 = (int)(finalValue / (FaConstant.CUBE_VALUE * LastUnit));
|
|
|
- isEqual = (standValue1 == finalValue1);
|
|
|
+ int standValue1; // = (int)Math.Ceiling(standValue / LastUnit);
|
|
|
+ int finalValue1; // = (int)(finalValue / (FaConstant.CUBE_VALUE * LastUnit));
|
|
|
+
|
|
|
+ //isEqual = (standValue1 == finalValue1);
|
|
|
+
|
|
|
//isEqual = (standValue * FaConstant.CUBE_VALUE) == finalValue;
|
|
|
|
|
|
/*if(finalValue == 22066060)
|
|
|
{
|
|
|
Console.WriteLine("测试");
|
|
|
}*/
|
|
|
+
|
|
|
+ if (strStandValue.Contains("."))
|
|
|
+ {
|
|
|
+ //标准值带有小数则全比较
|
|
|
+ standValue1 = (int)Math.Ceiling(standValue / LastUnit);
|
|
|
+ finalValue1 = (int)(finalValue / (FaConstant.CUBE_VALUE * LastUnit));
|
|
|
+ isEqual = (Math.Abs(standValue1 - finalValue1) <= 1);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //标准值没有小数则只比较整数部分
|
|
|
+ standValue1 = (int)standValue;
|
|
|
+ finalValue1 = (int)(finalValue / FaConstant.CUBE_VALUE);
|
|
|
+ isEqual = (Math.Abs(standValue1 - finalValue1) <= 1);
|
|
|
+ }
|
|
|
+
|
|
|
return isEqual ? 1 : 0;
|
|
|
}
|
|
|
else if (MeterType == 3)
|
|
@@ -286,6 +304,42 @@ namespace MeterVision.db
|
|
|
}
|
|
|
|
|
|
|
|
|
+ public int GetEqualFlag(double standValue, long finalValue)
|
|
|
+ {
|
|
|
+ bool isEqual = false;
|
|
|
+ //比较结果值与标准值是否相等
|
|
|
+ if (MeterType == ResultMeter)
|
|
|
+ {
|
|
|
+ if (MeterType == 1 || MeterType == 3)
|
|
|
+ {
|
|
|
+ //数字+指针(只比较数字部分)
|
|
|
+ //获取真正数据部分的值
|
|
|
+ int standValue1 = (int)Math.Ceiling(standValue / LastUnit);
|
|
|
+ int finalValue1 = (int)(finalValue / (FaConstant.CUBE_VALUE * LastUnit));
|
|
|
+ //isEqual = (standValue1 == finalValue1);
|
|
|
+
|
|
|
+ //判断如何按最后一个单位差1,也认为正确(比如0.1单位,则差0.1是正确的,10单位的,差10也是正确的)
|
|
|
+
|
|
|
+ //上面的值,也就规划为数字的整数
|
|
|
+ isEqual = (Math.Abs(standValue1 - finalValue1) <= 1);
|
|
|
+
|
|
|
+
|
|
|
+ return isEqual ? 1 : 0;
|
|
|
+ }
|
|
|
+ else if (MeterType == 2)
|
|
|
+ {
|
|
|
+ int standValue1 = (int)standValue;
|
|
|
+ int finalValue1 = (int)(finalValue / FaConstant.CUBE_VALUE);
|
|
|
+
|
|
|
+ isEqual = (Math.Abs(standValue1 - finalValue1) <= 1);
|
|
|
+
|
|
|
+ return isEqual ? 1 : 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 2;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//恢复运行时的默认值
|
|
|
public void ResetRunValue()
|
|
|
{
|