增加线性工件校准 增加信号变化日志记录
This commit is contained in:
@@ -13,7 +13,6 @@ namespace MesWork
|
||||
private class CalibrationCache
|
||||
{
|
||||
public string ToolName;
|
||||
public string CalibrationValue;
|
||||
public string Formula;
|
||||
public string Description;
|
||||
public DateTime LoadedAt;
|
||||
@@ -29,10 +28,17 @@ namespace MesWork
|
||||
formula = "x";
|
||||
message = "";
|
||||
|
||||
if (!TryGetConfig(opName, out CalibrationCache config, out string queryMsg))
|
||||
if (!TryGetConfig(opName, rawWeight, out CalibrationCache config, out string queryMsg))
|
||||
{
|
||||
message = string.IsNullOrWhiteSpace(queryMsg) ? "未找到工具标定配置" : queryMsg;
|
||||
return false;
|
||||
if (!string.IsNullOrWhiteSpace(queryMsg))
|
||||
{
|
||||
message = queryMsg;
|
||||
return false;
|
||||
}
|
||||
|
||||
formula = "x";
|
||||
calibratedWeight = rawWeight;
|
||||
return true;
|
||||
}
|
||||
|
||||
formula = NormalizeFormula(config.Formula);
|
||||
@@ -94,11 +100,12 @@ namespace MesWork
|
||||
}
|
||||
}
|
||||
|
||||
private static bool TryGetConfig(string opName, out CalibrationCache config, out string message)
|
||||
private static bool TryGetConfig(string opName, decimal rawWeight, out CalibrationCache config, out string message)
|
||||
{
|
||||
config = null;
|
||||
message = "";
|
||||
string key = string.IsNullOrWhiteSpace(opName) ? "" : opName.Trim();
|
||||
string station = string.IsNullOrWhiteSpace(opName) ? "" : opName.Trim();
|
||||
string key = station + "|" + rawWeight.ToString("F3", CultureInfo.InvariantCulture);
|
||||
|
||||
lock (CacheLock)
|
||||
{
|
||||
@@ -108,7 +115,7 @@ namespace MesWork
|
||||
}
|
||||
}
|
||||
|
||||
if (!B_DB_Opera.QueryToolCalibration(key, out string toolName, out string calibrationValue, out string formula, out string description, out message))
|
||||
if (!B_DB_Opera.QueryToolCalibration(station, rawWeight, out string toolName, out string formula, out string description, out message))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -116,7 +123,6 @@ namespace MesWork
|
||||
config = new CalibrationCache
|
||||
{
|
||||
ToolName = toolName,
|
||||
CalibrationValue = calibrationValue,
|
||||
Formula = formula,
|
||||
Description = description,
|
||||
LoadedAt = DateTime.Now
|
||||
|
||||
Reference in New Issue
Block a user