Commit 37eab955 贾鹏旭

tmp

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