Commit 7e4f909c 刘韬

修正外部导入数据没有参数reelid拼接的问题

1 个父辈 e58e7e7d
using System;
using System.Net;
using System.Text;
using System.Collections.Generic;
using System.Web.Script.Serialization;
using Asa.FaceControl;
using Model;
using Asa;
using Newtonsoft.Json;
using System.Windows.Forms;
using System;
using System.Collections.Generic;
using System.IO;
using static BLL.Extension;
using System.Web.UI;
using Asa.FaceControl;
using System.Configuration;
using System.Linq;
using System.Web.Script.Serialization;
using System.Windows.Forms;
using static BLL.BLLCommon;
using static BLL.Replacekeywords;
using RestSharp;
using System.Web;
using Http = Model.Http;
using System.Drawing;
using DocumentFormat.OpenXml.Spreadsheet;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.ToolTip;
using DocumentFormat.OpenXml.Wordprocessing;
using DocumentFormat.OpenXml.Presentation;
using static BLL.BLLCommon;
using TcpKPIO;
namespace BLL
{
......@@ -44,19 +30,19 @@ namespace BLL
string[] lines = System.IO.File.ReadAllLines(FilePath.CONFIG_MACRO_KEY);
macroKey.AddRange(lines);
}
macroKeyValue= new();
macroKeyValue = new();
if (System.IO.File.Exists(FilePath.CONFIG_MACRO_Value))
{
string[] lines = System.IO.File.ReadAllLines(FilePath.CONFIG_MACRO_Value);
macroKeyValue.AddRange(lines);
}
}
private DebounceHelper<FaceComboBox,string> debounceHelper;
private DebounceHelper<FaceComboBox, string> debounceHelper;
public General(Config config)
{
this.config = config;
ReadMacro();
debounceHelper = new DebounceHelper<FaceComboBox,string>(500); // 设置抗抖动的间隔,单位为毫秒
debounceHelper = new DebounceHelper<FaceComboBox, string>(500); // 设置抗抖动的间隔,单位为毫秒
debounceHelper.DebouncedTextChanged += DebounceHelper_DebouncedTextChanged;
}
......@@ -102,7 +88,7 @@ namespace BLL
}
static bool mesResult = false;
bool islast=false;
bool islast = false;
Dictionary<string, string> lastkey = null;
// 用于存储上一次的 key
......@@ -112,7 +98,7 @@ namespace BLL
protected virtual void OnKeySet(string[] originalCode, Dictionary<string, string> key, bool hasMatch)
{
extension.set( originalCode, key, hasMatch);
extension.set(originalCode, key, hasMatch);
}
protected virtual void CheckText(string text)
{
......@@ -148,7 +134,7 @@ namespace BLL
var now = DateTime.Now;
// 比较当前 key 和上次的 key
bool isSame = false;
bool isFirstCapture=lastKeys==null;
bool isFirstCapture = lastKeys == null;
try
{
......@@ -202,23 +188,7 @@ namespace BLL
}
}
#endregion
// 添加或替换自增ID
string reelIdKeyWord = config.ReelIDKeyWord;
if (!string.IsNullOrEmpty(config.ReelIDKeyWord) && isdisplay)
{
var Reelidstr = GetReelid();
if (key.ContainsKey(config.ReelIDKeyWord))
{
key[config.ReelIDKeyWord] = Reelidstr;
}
else
{
key.Add(config.ReelIDKeyWord, Reelidstr);
}
}
//客户定制key
......@@ -353,7 +323,20 @@ namespace BLL
}
// 添加或替换自增ID
string reelIdKeyWord = config.ReelIDKeyWord;
if (!string.IsNullOrEmpty(config.ReelIDKeyWord) && isdisplay)
{
var Reelidstr = GetReelid();
if (key.ContainsKey(config.ReelIDKeyWord))
{
key[config.ReelIDKeyWord] = Reelidstr;
}
else
{
key.Add(config.ReelIDKeyWord, Reelidstr);
}
}
......@@ -555,7 +538,7 @@ namespace BLL
}
}
string finalText = processedPattern ;
string finalText = processedPattern;
LogNet.log.Info(string.Format("GetReelid pattern={0}, id={1}, text={2}", matchPattern, reelID, finalText));
......@@ -677,14 +660,15 @@ namespace BLL
{
if (BLLCommon.config.Language.Equals("English"))
{
bool result = MessageboxNeo.Show( "", "Whether to skip this operation?","NEO SCAN",true );
bool result = MessageboxNeo.Show("", "Whether to skip this operation?", "NEO SCAN", true);
if (result)
{
lastKeys = null;
BLLCommon.extension.labelText = "Waiting";
}
}else if (BLLCommon.config.Language.Equals("日语"))
}
else if (BLLCommon.config.Language.Equals("日语"))
{
bool result = MessageboxNeo.Show("",
"この操作をスキップしますか?",
......@@ -701,7 +685,7 @@ namespace BLL
}
else
{
bool result = MessageboxNeo.Show( "",
bool result = MessageboxNeo.Show("",
"是否跳过此操作?",
"NEO SCAN",
true);
......@@ -725,22 +709,22 @@ namespace BLL
private void ComboBoxTextChanged(object sender, EventArgs e)
{
var txt = ((FaceComboBox)sender).Text;
debounceHelper.HandleTextChanged((FaceComboBox)sender,txt);
debounceHelper.HandleTextChanged((FaceComboBox)sender, txt);
}
private Dictionary<string, string> UpdateLastKey( Dictionary<string, string> lastkey)
private Dictionary<string, string> UpdateLastKey(Dictionary<string, string> lastkey)
{
Dictionary<string, string> keyValues = new Dictionary<string, string>();
if (lastkey == null)
return null;
foreach(var temp in lastkey.Keys)
foreach (var temp in lastkey.Keys)
{
keyValues.Add(temp, lastkey[temp]);
if (temp.Contains(":"))
{
string date = temp.Split(':')[1];
if(int.TryParse(date, out int value)&&value==0&& int.TryParse(lastkey[temp], out int value2))
if (int.TryParse(date, out int value) && value == 0 && int.TryParse(lastkey[temp], out int value2))
{
keyValues[temp] = value2.ToString($"D{date.Length}");
}
......@@ -763,7 +747,7 @@ namespace BLL
else
lastkey.Add(extensions[i].Key, extensions[i].Control.Text);
}
lastkey= UpdateLastKey(lastkey);
lastkey = UpdateLastKey(lastkey);
LogNet.log.Info("lastkey:" + JsonConvert.SerializeObject(lastkey));
#region 判断指定关键字是否存在内容
List<string> strings = new List<string>();
......@@ -781,7 +765,7 @@ namespace BLL
}
}
}
LogNet.log.Info("DataSource_ForceMatching:"+string.Join(",", strings));
LogNet.log.Info("DataSource_ForceMatching:" + string.Join(",", strings));
#endregion
for (int i = 0; i < extensions.Count; i++)
{
......@@ -831,7 +815,7 @@ namespace BLL
/// <param name="errmsg"></param>
/// <param name="dic">返回请求后,替换完成的键值对</param>
/// <returns></returns>
private bool GetHttpReelID(Dictionary<string, string> key, out string errmsg,out Dictionary<string,object> dic)
private bool GetHttpReelID(Dictionary<string, string> key, out string errmsg, out Dictionary<string, object> dic)
{
errmsg = "";
dic = null;
......@@ -841,7 +825,7 @@ namespace BLL
{
errmsg = "Api error";
if (extensions != null && !extensions[0].Control.InvokeRequired)
MessageboxNeo.Show("BoxReelIDInfoMaintain", errmsg,"NEO SCAN",true);
MessageboxNeo.Show("BoxReelIDInfoMaintain", errmsg, "NEO SCAN", true);
// new FaceMessageBox("BoxReelIDInfoMaintain", errmsg, System.Windows.Forms.MessageBoxButtons.OK, true).ShowDialog();
return false;
......@@ -946,7 +930,7 @@ namespace BLL
var data = ExtraFileData.AllData[value];
foreach (var item in data)
{
var ext = extensions.Where(a =>( a.Type == "TextBox" || a.Type == "ComboBox" )&& a.Key == item.Key).ToList();
var ext = extensions.Where(a => (a.Type == "TextBox" || a.Type == "ComboBox") && a.Key == item.Key).ToList();
foreach (var Control in ext)
{
Control.Control.Text = item.Value;
......@@ -964,7 +948,7 @@ namespace BLL
}
public void DrawTextBackground(Dictionary<string, string> key)
{
if (extensions != null && extensions.Count>0&& !extensions[0].Control.InvokeRequired)
if (extensions != null && extensions.Count > 0 && !extensions[0].Control.InvokeRequired)
{
bool focused = false; // 用于跟踪是否已经聚焦到第一个匹配的文本框
for (int i = 0; i < extensions.Count; i++)
......@@ -1007,12 +991,12 @@ namespace BLL
public Dictionary<string, string> ReplaceData(Dictionary<string, string> key)
{
string err = null;
Dictionary<string, object> dic=new Dictionary<string, object>();
Dictionary<string, object> dic = new Dictionary<string, object>();
if (!GetHttpReelID(key, out err, out dic))
{
return key;
}
return dic?.ToDictionary(a=>a.Key,a=>a.Value.ToString());
return dic?.ToDictionary(a => a.Key, a => a.Value.ToString());
}
}
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!