工具表定模块 使用科学计数法

This commit is contained in:
XingCheng3
2026-05-12 13:28:37 +08:00
parent 36a4084d3a
commit 08b0d4e5e3
9 changed files with 261 additions and 67 deletions

View File

@@ -177,7 +177,7 @@ namespace MesWork
int stIdx = WeighingPage?.GetStationIndex(opName) ?? 1;
if (!B_DB_Opera.QueryWorkpieceByOrderNo(orderNo, out string matchedModelNo, out decimal addOilQty, out decimal extractOilQty, out decimal density,
out decimal residualOilUpperLimit, out decimal residualOilLowerLimit))
out decimal residualOilUpperLimit, out decimal residualOilLowerLimit)) // 根据订货号 查询基本参数
{
WritePLC_IF(112, opName, 3); // 报警代码=3机型错误
B_DB_Opera.SaveLog_Response($"【{opName}】工件管理中未找到订货号[{orderNo}]的匹配规则,发动机={engineNo}", AID);
@@ -252,18 +252,26 @@ namespace MesWork
engineNo = parsedProductNo;
}
if (CurveCollector_TryGetStableWeight(opName, out decimal curveWeight, out int curvePointCount, out string curveMsg))
{
weight = curveWeight; // 优先使用曲线稳定段计算重量
B_DB_Opera.SaveLog_Response($"【{opName}】曲线重量={curveWeight:F3}kgPLC重量={plcWeight:F3}kg差值={(curveWeight - plcWeight):F3}kg点数={curvePointCount}", AID);
}
else
{
B_DB_Opera.SaveLog_Response($"【{opName}】曲线重量不可用使用PLC锁定重量={plcWeight:F3}kg原因={curveMsg}", AID);
}
long curveWeighingRecordId = 0;
B_DB_Opera.UpdateStationComplete(engineNo, opName, weight); // 过站记录保存最终采用重量
if (CurveCollector_TryGetStableWeight(opName, out decimal curveWeight, out int curvePointCount, out string curveMsg))
{
weight = curveWeight; // 曲线采样点已按工具标定公式处理,稳定重量不再二次标定
B_DB_Opera.SaveLog_Response($"【{opName}】标定曲线重量={curveWeight:F3}kgPLC锁定重量={plcWeight:F3}kg点数={curvePointCount}", AID);
}
else
{
B_DB_Opera.SaveLog_Response($"【{opName}】曲线重量不可用使用PLC锁定重量={plcWeight:F3}kg原因={curveMsg}", AID);
decimal rawWeight = plcWeight;
if (!WeightCalibrationHelper.Apply(opName, rawWeight, out decimal calibratedWeight, out string calibrationFormula, out string calibrationMsg))
{
throw new Exception($"工具标定公式处理失败:{calibrationMsg}");
}
weight = calibratedWeight;
B_DB_Opera.SaveLog_Response($"【{opName}】PLC锁定重量标定原始重量={rawWeight:F3}kg公式={calibrationFormula},标定后={weight:F3}kg", AID);
WeighingPage?.AppendLog($"[{opName}] PLC锁定重量标定原始={rawWeight:F3}kg公式={calibrationFormula},结果={weight:F3}kg");
}
long curveWeighingRecordId = 0;
B_DB_Opera.UpdateStationComplete(engineNo, opName, weight); // 过站记录保存最终采用重量
string weighType = GetWeighingType(opName);
decimal oilReleaseQty = 0;
decimal residualOilQty = 0;