Commit 37eab955 贾鹏旭

tmp

1 个父辈 8e47d0b4
...@@ -244,7 +244,10 @@ namespace BLL ...@@ -244,7 +244,10 @@ namespace BLL
{ {
return currentExtension.SetKey(originalCode, key, hasMatch, out errmsg); return currentExtension.SetKey(originalCode, key, hasMatch, out errmsg);
} }
public void Print()
{
//currentExtension.Printing
}
public void DrawTextBackground(Dictionary<string, string> key) public void DrawTextBackground(Dictionary<string, string> key)
{ {
currentExtension.DrawTextBackground(key); currentExtension.DrawTextBackground(key);
......
...@@ -147,19 +147,20 @@ namespace BLL ...@@ -147,19 +147,20 @@ namespace BLL
return false; return false;
Application.DoEvents(); Application.DoEvents();
if (extensions != null && !extensions[0].Control.InvokeRequired)
{ //if (extensions != null && !extensions[0].Control.InvokeRequired)
if (config.AutoPrint && hasMatch) //{
{ // if ( && hasMatch)
//if (CanPrint()) // {
PrintLabel(null, EventArgs.Empty); // //if (CanPrint())
} // PrintLabel(null, EventArgs.Empty);
} // }
else //}
{ //else
//PrintLabel(null, EventArgs.Empty); //{
} // //PrintLabel(null, EventArgs.Empty);
SaveRetrospect?.Invoke(key); //}
SaveRetrospect?.Invoke(key);
return true; return true;
} }
bool updatereelid(Dictionary<string, string> key, out string errmsg) bool updatereelid(Dictionary<string, string> key, out string errmsg)
...@@ -248,7 +249,7 @@ namespace BLL ...@@ -248,7 +249,7 @@ namespace BLL
try try
{ {
var reelidfile = FilePath.CONFIG_REELID; var reelidfile = FilePath.CONFIG_REELID;
if (Config.REEL_ID_AutoResetStrategy==1) if (Config.REEL_ID_AutoResetStrategy == 1)
{ {
Directory.CreateDirectory(reelidfile + "_dir"); Directory.CreateDirectory(reelidfile + "_dir");
reelidfile = Path.Combine(FilePath.CONFIG_REELID + "_dir", DateTime.Now.ToString("yyyyMMdd")); reelidfile = Path.Combine(FilePath.CONFIG_REELID + "_dir", DateTime.Now.ToString("yyyyMMdd"));
...@@ -285,8 +286,9 @@ namespace BLL ...@@ -285,8 +286,9 @@ namespace BLL
{ {
updatereelid(lastkey, out _); updatereelid(lastkey, out _);
} }
private void PrintLabel(object sender, EventArgs e) public void PrintLabel(object sender, EventArgs e)
{ {
if (!config.AutoPrint) return;
LogNet.log.Debug("Enter PrintLabel Method"); LogNet.log.Debug("Enter PrintLabel Method");
if (lastkey == null) return; if (lastkey == null) return;
//Dictionary<string, string> key = new(); //Dictionary<string, string> key = new();
...@@ -368,7 +370,7 @@ namespace BLL ...@@ -368,7 +370,7 @@ namespace BLL
// 定义动态按钮点击事件处理方法 // 定义动态按钮点击事件处理方法
private void DynamicButtonClick(object sender, EventArgs e) private void DynamicButtonClick(object sender, EventArgs e)
{ {
var listexten= extensions.Where(a => a.Type == "TextBox").ToDictionary(kvp => kvp.Key, kvp => kvp.Control.Text); var listexten = extensions.Where(a => a.Type == "TextBox").ToDictionary(kvp => kvp.Key, kvp => kvp.Control.Text);
string jsondata = Replacekeywordss(listexten); string jsondata = Replacekeywordss(listexten);
ResponseDatas lists = JsonConvert.DeserializeObject<ResponseDatas>(jsondata); ResponseDatas lists = JsonConvert.DeserializeObject<ResponseDatas>(jsondata);
foreach (var responseItems in lists.Items) foreach (var responseItems in lists.Items)
...@@ -383,7 +385,7 @@ namespace BLL ...@@ -383,7 +385,7 @@ namespace BLL
} }
//items.Control.Text = item.Value.ToString(); //items.Control.Text = item.Value.ToString();
} }
} }
} }
} }
...@@ -532,7 +534,7 @@ namespace BLL ...@@ -532,7 +534,7 @@ namespace BLL
//} //}
#endregion #endregion
public void DrawTextBackground(Dictionary<string, string> key) public void DrawTextBackground(Dictionary<string, string> key)
{ {
if (extensions != null && !extensions[0].Control.InvokeRequired) if (extensions != null && !extensions[0].Control.InvokeRequired)
{ {
...@@ -544,7 +546,7 @@ namespace BLL ...@@ -544,7 +546,7 @@ namespace BLL
if (key[extensions[i].Key].StartsWith("<OCR>")) if (key[extensions[i].Key].StartsWith("<OCR>"))
{ {
extensions[i].Control.ForeColor = Color.Yellow; extensions[i].Control.ForeColor = Color.Yellow;
} }
if (!focused && key[extensions[i].Key].StartsWith("<OCR>")) if (!focused && key[extensions[i].Key].StartsWith("<OCR>"))
{ {
extensions[i].Control.Focus(); extensions[i].Control.Focus();
......
...@@ -74,12 +74,13 @@ namespace SmartScan ...@@ -74,12 +74,13 @@ namespace SmartScan
if (!isRun) return; if (!isRun) return;
if (isTouch) return; if (isTouch) return;
isTouch = true; isTouch = true;
btnMatchedName.Invoke(delegate() { btnMatchedName.Invoke(delegate ()
{
if (!BLL.Config.Backgrounder) if (!BLL.Config.Backgrounder)
btnMatchedName.Visible = false; btnMatchedName.Visible = false;
BLLCommon.extension.Clear(); BLLCommon.extension.Clear();
}); });
var t = Task.Run(() => var t = Task.Run(() =>
{ {
try try
...@@ -88,7 +89,7 @@ namespace SmartScan ...@@ -88,7 +89,7 @@ namespace SmartScan
workCodeKeyword = new(StringComparer.OrdinalIgnoreCase); workCodeKeyword = new(StringComparer.OrdinalIgnoreCase);
originalCodeText = null; originalCodeText = null;
originalCodeIsUsed = null; originalCodeIsUsed = null;
Common.frmMain.SetWaittingMsg(Language.Dialog("MaterialScanning"));//拍照识别... Common.frmMain.SetWaittingMsg(Language.Dialog("MaterialScanning"));//拍照识别...
if (!GetCodeInfo()) if (!GetCodeInfo())
{ {
...@@ -106,17 +107,29 @@ namespace SmartScan ...@@ -106,17 +107,29 @@ namespace SmartScan
Common.frmMain.Invoke(delegate () Common.frmMain.Invoke(delegate ()
{ {
SetKey(hasMatch); SetKey(hasMatch);
Common.frmMain.Invoke(delegate ()
{
if (workCodeKeyword.Any(a => a.Value.StartsWith("<OCR>")))
{
FrmDrawText frmDraw = new FrmDrawText();
if (frmDraw.ShowDialog() == DialogResult.OK)
{
BLLCommon.extension.pri BLLCommon.extension.DrawTextBackground(workCodeKeyword);
}
}
});
}); });
isTouch = false; isTouch = false;
LogNet.log.Info("Work scan is done"); LogNet.log.Info("Work scan is done");
} }
catch (Exception ex) catch (Exception ex)
{ {
LogNet.log.Error("Scan", ex); LogNet.log.Error("Scan", ex);
} }
finally { finally
{
isTouch = false; isTouch = false;
Common.frmMain.CloseWaittingDialog(); Common.frmMain.CloseWaittingDialog();
} }
...@@ -125,11 +138,11 @@ namespace SmartScan ...@@ -125,11 +138,11 @@ namespace SmartScan
{ {
Common.frmMain.ShowWaittingDialog(); Common.frmMain.ShowWaittingDialog();
}); });
} }
public void Scan(string[] code) public void Scan(string[] code)
{ {
try try
...@@ -236,7 +249,7 @@ namespace SmartScan ...@@ -236,7 +249,7 @@ namespace SmartScan
else else
{ {
string filename = ""; string filename = "";
Common.frmMain.Invoke(delegate() Common.frmMain.Invoke(delegate ()
{ {
OpenFileDialog dlg = new() { Filter = "图片文件|*.jpg;*.png;*.bmp;*.jpeg" }; OpenFileDialog dlg = new() { Filter = "图片文件|*.jpg;*.png;*.bmp;*.jpeg" };
DialogResult dr = dlg.ShowDialog(); DialogResult dr = dlg.ShowDialog();
...@@ -285,20 +298,10 @@ namespace SmartScan ...@@ -285,20 +298,10 @@ namespace SmartScan
LogNet.log.Info("Work MatchingTemplate"); LogNet.log.Info("Work MatchingTemplate");
if (workCodeInfo.Count == 0) return false; if (workCodeInfo.Count == 0) return false;
originalCodeText = BLLCommon.cameraVision.GetBarCodeText(workCodeInfo); originalCodeText = BLLCommon.cameraVision.GetBarCodeText(workCodeInfo);
bool rtn = BLLCommon.mateEdit.MatchingTemplate(workCodeInfo, BLLCommon.config.DefaultMaterialName,false, out string mateName, out workCodeKeyword, out originalCodeIsUsed); bool rtn = BLLCommon.mateEdit.MatchingTemplate(workCodeInfo, BLLCommon.config.DefaultMaterialName, false, out string mateName, out workCodeKeyword, out originalCodeIsUsed);
BLL.MatchAnalysis.ShowResult(); BLL.MatchAnalysis.ShowResult();
Common.frmMain.Invoke(delegate ()
{
if (workCodeKeyword.Any(a => a.Value.StartsWith("<OCR>")))
{
FrmDrawText frmDraw = new FrmDrawText();
if (frmDraw.ShowDialog() == DialogResult.OK)
{
BLLCommon.extension.DrawTextBackground(workCodeKeyword);
}
}
});
Common.frmMain.Invoke(delegate () Common.frmMain.Invoke(delegate ()
{ {
if (rtn) if (rtn)
...@@ -321,14 +324,14 @@ namespace SmartScan ...@@ -321,14 +324,14 @@ namespace SmartScan
fm.ShowDialog(Common.frmMain); fm.ShowDialog(Common.frmMain);
} }
} }
}); });
return rtn; return rtn;
} }
private void SetKey(bool hasMatch) private void SetKey(bool hasMatch)
{ {
LogNet.log.Info("Work SetKey hasMatch:"+ hasMatch); LogNet.log.Info("Work SetKey hasMatch:" + hasMatch);
BLLCommon.extension.SetKey(originalCodeText, workCodeKeyword, hasMatch,out _); BLLCommon.extension.SetKey(originalCodeText, workCodeKeyword, hasMatch, out _);
if (workCodeKeyword.Count == 0) return; if (workCodeKeyword.Count == 0) return;
if (BLLCommon.config.PromptAfterPrinting && !BLL.Config.Backgrounder) if (BLLCommon.config.PromptAfterPrinting && !BLL.Config.Backgrounder)
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!