Commit 6fd78454 贾鹏旭

修改按钮关联回车,识别结束不进行追溯记录,不含ocr识别不自动打印等问题

1 个父辈 27df0cbb
......@@ -196,8 +196,11 @@ namespace BLL
};
if (!string.IsNullOrEmpty(config.HttpReelID))
listrow.Add(new object[] { A });
if (BLLCommon.config.SelectHttpPN == true)
#region 显示替换数据按钮
string pnkey = ConfigHelper.Config.Get("SelectHttpPN_KeyWords", "");
string pnurl=ConfigHelper.Config.Get("SelectHttpPN_Url","");
if (BLLCommon.config.SelectHttpPN == true&&
!string.IsNullOrEmpty(pnkey)&&!string.IsNullOrEmpty(pnurl))
{
Dictionary<string, object> C = new(){
{ "Type", "Button" },
......@@ -216,8 +219,9 @@ namespace BLL
}
}
};
listrow.Add(new object[] { C }); // Insert the button before the "B" button
listrow.Add(new object[] { C });
}
#endregion
listrow.Add(new object[] { B });
rows = listrow.ToArray();
}
......
......@@ -78,12 +78,13 @@ namespace BLL
errmsg = "";
lastkey = key;
mesResult = false;
var now = DateTime.Now;
var now = DateTime.Now;
if (extensions != null && !extensions[0].Control.InvokeRequired)
{
//第一次刷新界面
for (int i = 0; i < extensions.Count; i++)
{
extensions[i].Control.ForeColor = Color.White;
if (key.ContainsKey(extensions[i].Key))
extensions[i].Control.Text = key[extensions[i].Key].Replace("<OCR>", "");/*.Replace("<OCR>","")*/;
//if (key.ContainsKey(extensions[i].Key))
......@@ -94,7 +95,7 @@ namespace BLL
// }
// extensions[i].Control.Text = key[extensions[i].Key].Replace("<OCR>", "");
//}
}
}
Application.DoEvents();
......@@ -131,6 +132,7 @@ namespace BLL
//第二次刷新界面
for (int i = 0; i < extensions.Count; i++)
{
extensions[i].Control.ForeColor = Color.White;
if (key.ContainsKey(extensions[i].Key))
extensions[i].Control.Text = key[extensions[i].Key].Replace("<OCR>", "");/*.Replace("<OCR>", "");*/
//if (key.ContainsKey(extensions[i].Key))
......@@ -302,7 +304,7 @@ namespace BLL
//var keys =new List<string>(lastkey.Keys);
Printing?.Invoke(lastkey);
SaveRetrospect?.Invoke(lastkey);
}
private bool GetHttpReelID(Dictionary<string, string> key, out string errmsg)
{
......
......@@ -137,8 +137,7 @@ namespace BLL
//请求正常数据
public string Url { get; set; } = ConfigHelper.Config.Get("SelectHttpPN_Url", "");
//关键字,请用,号分割
public string[] KeyWords { get; set; } = ConfigHelper.Config.Get("SelectHttpPN_KeyWords", "grn_num,vend_num,grn_line,infobar=0").Split(',');
public string[] KeyWords { get; set; } = ConfigHelper.Config.Get("SelectHttpPN_KeyWords", "").Split(',');
/// <summary>
/// 此字段在需要存放,请求数据的键值对
......
......@@ -15,8 +15,20 @@ namespace SmartScan.Form
public FrmDrawText()
{
InitializeComponent();
}
// 启用窗体的 KeyPreview
this.KeyPreview = true;
// 添加 KeyDown 事件处理程序
this.KeyDown += YourForm_KeyDown;
}
private void YourForm_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
// 执行 FaceButton1 的点击事件代码
faceButton1_Click(sender, e);
}
}
private void faceButton1_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.OK;
......@@ -25,7 +37,7 @@ namespace SmartScan.Form
private void faceButton2_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.OK;
this.DialogResult = DialogResult.Cancel;
this.Close();
}
}
......
......@@ -131,7 +131,7 @@ namespace SmartScan
this.BtnExportAll.BorderWidth = 2;
this.BtnExportAll.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(230)))), ((int)(((byte)(230)))));
this.BtnExportAll.HoldPress = false;
this.BtnExportAll.Location = new System.Drawing.Point(15, 442);
this.BtnExportAll.Location = new System.Drawing.Point(13, 443);
this.BtnExportAll.Margin = new System.Windows.Forms.Padding(4);
this.BtnExportAll.Name = "BtnExportAll";
this.BtnExportAll.Padding = new System.Windows.Forms.Padding(4);
......@@ -270,12 +270,12 @@ namespace SmartScan
this.LstRecord.BorderStyle = Asa.FaceControl.ControlShape.Rectangle;
this.LstRecord.BorderWidth = 2;
this.LstRecord.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(230)))), ((int)(((byte)(230)))));
this.LstRecord.Location = new System.Drawing.Point(15, 568);
this.LstRecord.Location = new System.Drawing.Point(15, 569);
this.LstRecord.Margin = new System.Windows.Forms.Padding(4);
this.LstRecord.Name = "LstRecord";
this.LstRecord.Padding = new System.Windows.Forms.Padding(4);
this.LstRecord.SelectedIndex = -1;
this.LstRecord.Size = new System.Drawing.Size(293, 206);
this.LstRecord.Size = new System.Drawing.Size(293, 205);
this.LstRecord.TabIndex = 19;
this.LstRecord.SelectedIndexChanged += new System.EventHandler(this.LstRecord_SelectedIndexChanged);
//
......@@ -316,12 +316,12 @@ namespace SmartScan
this.butt_getData.BorderWidth = 2;
this.butt_getData.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(230)))), ((int)(((byte)(230)))));
this.butt_getData.HoldPress = false;
this.butt_getData.Location = new System.Drawing.Point(17, 505);
this.butt_getData.Location = new System.Drawing.Point(14, 506);
this.butt_getData.Name = "butt_getData";
this.butt_getData.Padding = new System.Windows.Forms.Padding(3);
this.butt_getData.Size = new System.Drawing.Size(292, 56);
this.butt_getData.TabIndex = 22;
this.butt_getData.Text = "获取数据";
this.butt_getData.Text = "启动服务";
this.butt_getData.Visible = false;
this.butt_getData.Click += new System.EventHandler(this.butt_startservice_Click);
//
......
......@@ -15,6 +15,7 @@ using BLL;
using System.Configuration;
using System.Diagnostics;
using System.IO;
using System.Xml.Linq;
namespace SmartScan
{
......@@ -133,7 +134,7 @@ namespace SmartScan
{
DtpLower.Value = DateTime.Now.Date;
DtpUpper.Value = DateTime.Now.Date;
if (ConfigHelper.Config.Get("Func_EnableGetData",false))
if (ConfigHelper.Config.Get("Display_EnableGetData", "1181")=="1181")
{
butt_getData.Visible = true;
LstRecord.Height = 206;
......@@ -423,20 +424,31 @@ namespace SmartScan
private void butt_startservice_Click(object sender, EventArgs e)
{
Process p = new Process();
var pss = Process.GetProcessesByName(ConfigHelper.Config.Get("GetDataAppName"));
if (pss.Length > 0)
return;
var f = ConfigurationManager.AppSettings["GetDataAppPath"];
if (!File.Exists(f))
throw new Exception("未找到服务文件!");
p.StartInfo = new ProcessStartInfo
try
{
FileName = f,
Verb = "runas" // 这里设置为 "runas" 表示以管理员身份运行
};
p.Start();
Process proes = new Process();
string servicename = ConfigHelper.Config.Get("Display_GetDataAppName");
var pss = Process.GetProcessesByName(servicename);
if (pss.Length > 0)
return;
var f = ConfigHelper.Config.Get("Display_GetDataAppPath");
if (!File.Exists(f))
throw new Exception("未找到服务文件!");
proes.StartInfo = new ProcessStartInfo
{
FileName = f,
WorkingDirectory = Path.Combine(Environment.CurrentDirectory, "ASTI"),
Verb = "runas" // 这里设置为 "runas" 表示以管理员身份运行
};
proes.StartInfo.UseShellExecute = false;
proes.Start();
}
catch (Exception)
{
throw;
}
}
}
}
......@@ -76,6 +76,8 @@
<PnlExtension Text="Print Info." Font="Arial,14,," />
<!--原文:打印标签-->
<BtnPrint Text="Print" Font="Arial,12,," />
<!--原文:替换数据-->
<DynamicButton Text="ReplaceData" Font="微软雅黑,12,," />
</FrmMain>
<FrmSet Text="Setting" Font="Arial,20,B,">
<BtnGenneralSetting Text="General" Font="Arial,12,B," />
......@@ -291,7 +293,7 @@
<BtnSelect Text="Search" Font="Arial,12,," />
<BtnExport Text="Export" Font="Arial,12,," />
<BtnExportAll Text="Export All" Font="Arial,12,," />
<butt_getData Text="Get Data" Font="Arial,12,," />
<butt_getData Text="Start Service" Font="Arial,12,," />
<LblAllCode Text="Original" Font="Arial,12,," />
<LblAllLabel Text="Extracted Info." Font="Arial,12,," />
</FrmRetrospect>
......
......@@ -57,7 +57,7 @@
<ConflictLength>最大长度必须大于最小长度</ConflictLength>
<ResetidByNone>序号不重置</ResetidByNone>
<ResetidByDay>序号每日重置</ResetidByDay>
<ResetidByMonth>序号每月重置</ResetidByMonth>
<ResetidByMonth>序号每月重置</ResetidByMonth>
</Dialog>
<FrmUsersLogin Text="登录" Font="微软雅黑,20,B,">
<LblUser Text="用户名:" Font="微软雅黑,11,," />
......@@ -76,6 +76,7 @@
<!--原文:简体中文-->
<CboLanguage Text="简体中文" Font="微软雅黑,12,," />
<BtnPrint Text="打印标签" Font="Arial,12,," />
<DynamicButton Text="替换数据" Font="微软雅黑,12,," />
</FrmMain>
<FrmSet Text="设置" Font="微软雅黑,20,B,">
<BtnGenneralSetting Text="通用设置" Font="微软雅黑,12,B," />
......@@ -307,7 +308,7 @@
<BtnSelect Text="查询" Font="微软雅黑,12,," />
<BtnExport Text="导出" Font="微软雅黑,12,," />
<BtnExportAll Text="导出所有" Font="微软雅黑,12,," />
<butt_getData Text="获取数据" Font="微软雅黑,12,," />
<butt_getData Text="启动服务" Font="微软雅黑,12,," />
<LblAllCode Text="物料条码" Font="微软雅黑,12,," />
<LblAllLabel Text="标签内容" Font="微软雅黑,12,," />
</FrmRetrospect>
......
......@@ -103,23 +103,12 @@ namespace SmartScan
});
Common.frmMain.SetWaittingMsg(Language.Dialog("MaterialTemplateMatching"));//模版匹配...
bool hasMatch = MatchingTemplate();
//Common.frmMain.SetWaittingMsg(Language.Dialog("MaterialProcessing"));//计算结果...
Common.frmMain.SetWaittingMsg(Language.Dialog("MaterialProcessing"));//计算结果...
Common.frmMain.Invoke(delegate ()
{
SetKey(hasMatch);
if (workCodeKeyword.Any(a => a.Value.StartsWith("<OCR>")))
{
FrmDrawText frmDraw = new FrmDrawText();
if (frmDraw.ShowDialog() == DialogResult.OK)
{
//打印
BLLCommon.extension.Print(hasMatch,workCodeKeyword);
BLLCommon.extension.DrawTextBackground(workCodeKeyword);
}
}
SetKey(hasMatch);
});
isTouch = false;
LogNet.log.Info("Work scan is done");
......@@ -333,7 +322,20 @@ namespace SmartScan
LogNet.log.Info("Work SetKey hasMatch:" + hasMatch);
BLLCommon.extension.SetKey(originalCodeText, workCodeKeyword, hasMatch, out _);
if (workCodeKeyword.Count == 0) return;
if (workCodeKeyword.Any(a => a.Value.StartsWith("<OCR>")))
{
BLLCommon.extension.DrawTextBackground(workCodeKeyword);
FrmDrawText frmDraw = new FrmDrawText();
if (frmDraw.ShowDialog() == DialogResult.OK)
{
//打印
BLLCommon.extension.Print(hasMatch, workCodeKeyword);
}
}
else
{
BLLCommon.extension.Print(hasMatch, workCodeKeyword);
}
if (BLLCommon.config.PromptAfterPrinting && !BLL.Config.Backgrounder)
{
string text = Language.Dialog("SelectPrintContent");
......
......@@ -453,6 +453,7 @@ namespace SmartScan
}
LstCode.Items.AddRange(FormatCode());
LstCode.SelectedIndex = codeIndex = -1;
}
#region 模板验证
private void BtnTemplateValite_Click(object sender, EventArgs e)
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!