老师, 程序运行出错,可检查没有问题:
报错提示:
.NET Framework 版本:4.0.30319.42000
Foxtable 版本:2022.8.18.1
错误所在事件:
详细错误信息:
The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 3 (""): The supplied value is not a valid instance of data type real. Check the source data for invalid values. An example of an invalid value is data of numeric type with scale greater than precision.
.运行语句,出错的语句如下黄色:
For Each dr2 As DataRow In dr2s
Dim pnop As String = dr2("PartNumber") & "|" & dr2("OP")
If d1.ContainsKey(pnop) Then
Dim dr1 = d1(PNOp)
'Output.Show(PNOP)
If dr1("WO_2") > 0.5 Then '调试次数
dr2("自去年来工序生产状态_次数") = dr1("WO_2")
'Output.Show(pnop & " " & dr1("WO_2"))
Dim Sh As Single = Round2( (dr1("TotalMachineHours_2") - dr1("BREAKHours_2")) / dr1("WO_2") * 60, 0)
If sh > 0 Then
If dr2("自去年来工序生产状态_平均每次调试分钟") <> Sh Then
dr2("自去年来工序生产状态_平均每次调试分钟") = Sh '单精度小数
dr2.Save
End If
End If
End If
If dr1("WO_1") > 0.5 Then '运行数量
dr2("自去年来工序生产状态_生产数量") = dr1("GOODQty_1")
'Output.Show(pnop & " " & dr1("GOODQty_1"))
Dim Sh As Single = Round2((dr1("TotalMachineHours_1") - dr1("BREAKHours_1")) / dr1("GoodQty_1") * 60, 1)
If Sh <> dr2("自去年来工序生产状态_单件平均工时单位") Then
dr2("自去年来工序生产状态_单件平均工时单位") = Sh '单精度小数
dr2.Save
End If
End If
End If
Next
检查被除数>0.5 ,然后进行计算, 但还是报错
1、把这些列都改为高精度
2、If dr1("WO_1") > 0.5 Then '运行数量
改为
If dr1("GoodQty_1") > 0.5 Then '运行数量
刚刚我在另一个程序中运行, 其除数为0.66, 结果出现了"无穷大"的报错:
.NET Framework 版本:4.0.30319.42000
Foxtable 版本:2022.8.18.1
错误所在事件:自定义函数,ProductionEfficiencySta
详细错误信息:
Exception has been thrown by the target of an invocation.
Value was either too large or too small for a Decimal.Couldn't store <∞> in Efficiency Column. Expected type is Decimal.
Value was either too large or too small for a Decimal.
"无穷大"就是出现了除以0。
另外如果被除数过大,除数过小,除的结果可能会超出高精度能够表示的范围。