Commit c8aea94b 刘韬

修正关键字内容互相存在包含关系时填充错误的问题

1 个父辈 36ed10ef
...@@ -528,6 +528,8 @@ namespace SmartScan.SetControl.WPF ...@@ -528,6 +528,8 @@ namespace SmartScan.SetControl.WPF
/// </summary> /// </summary>
public void UpdateMultipleRecognitionData(Dictionary<string, string> newData) public void UpdateMultipleRecognitionData(Dictionary<string, string> newData)
{ {
LogNet.log.Info("UpdateMultipleRecognitionData:"+JsonConvert.SerializeObject(newData));
LogNet.log.Info("fieldControls keys:" + string.Join(",", fieldControls.Select(kvp => kvp.Key).ToList()));
// 创建一个新的字典来存储处理后的数据 // 创建一个新的字典来存储处理后的数据
Dictionary<string, string> cleanedData = new Dictionary<string, string>(); Dictionary<string, string> cleanedData = new Dictionary<string, string>();
// 创建一个集合记录哪些键来自OCR // 创建一个集合记录哪些键来自OCR
...@@ -548,6 +550,7 @@ namespace SmartScan.SetControl.WPF ...@@ -548,6 +550,7 @@ namespace SmartScan.SetControl.WPF
// 将处理后的值添加到新字典 // 将处理后的值添加到新字典
cleanedData[kvp.Key] = value ?? string.Empty; cleanedData[kvp.Key] = value ?? string.Empty;
} }
LogNet.log.Info("cleanedData:" + JsonConvert.SerializeObject(cleanedData));
// 创建一个集合记录在新数据中找到匹配的控件键 // 创建一个集合记录在新数据中找到匹配的控件键
HashSet<string> matchedControlKeys = new HashSet<string>(); HashSet<string> matchedControlKeys = new HashSet<string>();
Dictionary<string, bool> controlOcrStatus = new Dictionary<string, bool>(); Dictionary<string, bool> controlOcrStatus = new Dictionary<string, bool>();
...@@ -557,11 +560,11 @@ namespace SmartScan.SetControl.WPF ...@@ -557,11 +560,11 @@ namespace SmartScan.SetControl.WPF
string value = kvp.Value; string value = kvp.Value;
// 查找匹配的控件键 // 查找匹配的控件键
var matchingKey = fieldControls.Keys.FirstOrDefault(k => var matchingKey = fieldControls.Keys.FirstOrDefault(k =>k==key);
k.Contains(key) || key.Contains(k));
if (matchingKey != null && fieldControls.TryGetValue(matchingKey, out TextBox textBox)) if (matchingKey != null && fieldControls.TryGetValue(matchingKey, out TextBox textBox))
{ {
LogNet.log.Info($"matchingKey:{matchingKey},textBox:{textBox.Name}");
// 只设置控件文本内容,不更新recognizedData // 只设置控件文本内容,不更新recognizedData
textBox.Text = value; textBox.Text = value;
matchedControlKeys.Add(matchingKey); matchedControlKeys.Add(matchingKey);
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!