Commit 1a150e20 刘韬

修正若干bug, 打印按钮不答应, 脚踏开关弹出文件选择对话框, 匹配数量bug

1 个父辈 34f6a115
...@@ -221,11 +221,11 @@ namespace BLL ...@@ -221,11 +221,11 @@ namespace BLL
{ {
if (key.ContainsKey("DateTime")) if (key.ContainsKey("DateTime"))
{ {
key["DateTime"] = DateTime.Now.ToString("dd-MM-yyyy"); key["DateTime"] = DateTime.Now.ToString(ConfigHelper.Config.Get("Ex_UserDataRule", "dd-MM-yyyy"));
} }
else else
{ {
key.Add("DateTime", DateTime.Now.ToString("dd-MM-yyyy")); key.Add("DateTime", DateTime.Now.ToString(ConfigHelper.Config.Get("Ex_UserDataRule", "dd-MM-yyyy")));
} }
} }
if (extensions != null && !extensions[0].Control.InvokeRequired) if (extensions != null && !extensions[0].Control.InvokeRequired)
...@@ -341,7 +341,7 @@ namespace BLL ...@@ -341,7 +341,7 @@ namespace BLL
// 如果有字段更新,则再次调用OnKeySet更新WPF界面 // 如果有字段更新,则再次调用OnKeySet更新WPF界面
LogNet.log.Info($"OnKeySet");
OnKeySet(originalCode, key, hasMatch); OnKeySet(originalCode, key, hasMatch);
if (lastKeys == null && !islast && BLLCommon.config.CheckFunction) if (lastKeys == null && !islast && BLLCommon.config.CheckFunction)
...@@ -394,7 +394,10 @@ namespace BLL ...@@ -394,7 +394,10 @@ namespace BLL
//else //else
//{ //{
if (!updatereelid(key, out errmsg)) if (!updatereelid(key, out errmsg))
{
LogNet.log.Info($"updatereelid false");
return false; return false;
}
// } // }
...@@ -435,6 +438,7 @@ namespace BLL ...@@ -435,6 +438,7 @@ namespace BLL
LogNet.log.Error("GetHttpReelID:" + errmsg); LogNet.log.Error("GetHttpReelID:" + errmsg);
return false; return false;
} }
LogNet.log.Error("GetHttpReelID:true" );
//key["ReelID"] = newid; //key["ReelID"] = newid;
} }
if (extensions != null && extensions.Count > 0 && !extensions[0].Control.InvokeRequired) if (extensions != null && extensions.Count > 0 && !extensions[0].Control.InvokeRequired)
...@@ -655,6 +659,7 @@ namespace BLL ...@@ -655,6 +659,7 @@ namespace BLL
private void GetHttpReelID(object sender, EventArgs e) private void GetHttpReelID(object sender, EventArgs e)
{ {
updatereelid(lastkey, out _); updatereelid(lastkey, out _);
LogNet.log.Info($"updatereelid GetHttpReelID");
} }
private void BtnSkip_Click(object sender, EventArgs e) private void BtnSkip_Click(object sender, EventArgs e)
{ {
...@@ -825,7 +830,7 @@ namespace BLL ...@@ -825,7 +830,7 @@ namespace BLL
{ {
errmsg = "Api error"; errmsg = "Api error";
if (extensions != null && !extensions[0].Control.InvokeRequired) if (extensions != null && !extensions[0].Control.InvokeRequired)
MessageboxNeo.Show("BoxReelIDInfoMaintain", errmsg, "NEO SCAN", true); return MessageboxNeo.Show("BoxReelIDInfoMaintain", errmsg, "NEO SCAN", true);
// new FaceMessageBox("BoxReelIDInfoMaintain", errmsg, System.Windows.Forms.MessageBoxButtons.OK, true).ShowDialog(); // new FaceMessageBox("BoxReelIDInfoMaintain", errmsg, System.Windows.Forms.MessageBoxButtons.OK, true).ShowDialog();
return false; return false;
...@@ -840,7 +845,7 @@ namespace BLL ...@@ -840,7 +845,7 @@ namespace BLL
{ {
errmsg = "Api parse error:\r\n" + json; errmsg = "Api parse error:\r\n" + json;
if (extensions != null && !extensions[0].Control.InvokeRequired) if (extensions != null && !extensions[0].Control.InvokeRequired)
MessageboxNeo.Show("BoxReelIDInfoMaintain", errmsg, "NEO SCAN", true); return MessageboxNeo.Show("BoxReelIDInfoMaintain", errmsg, "NEO SCAN", true);
//new FaceMessageBox("BoxReelIDInfoMaintain", errmsg, System.Windows.Forms.MessageBoxButtons.OK, true).ShowDialog(); //new FaceMessageBox("BoxReelIDInfoMaintain", errmsg, System.Windows.Forms.MessageBoxButtons.OK, true).ShowDialog();
return false; return false;
...@@ -849,7 +854,7 @@ namespace BLL ...@@ -849,7 +854,7 @@ namespace BLL
if (!dic.TryGetValue("CODE", out object value)) if (!dic.TryGetValue("CODE", out object value))
{ {
if (extensions != null && !extensions[0].Control.InvokeRequired) if (extensions != null && !extensions[0].Control.InvokeRequired)
MessageboxNeo.Show("BoxReelIDInfoMaintain", errmsg, "NEO SCAN", true); return MessageboxNeo.Show("BoxReelIDInfoMaintain", errmsg, "NEO SCAN", true);
//new FaceMessageBox("BoxReelIDInfoMaintain", "Api return data error:\r\n" + json, System.Windows.Forms.MessageBoxButtons.OK, true).ShowDialog(); //new FaceMessageBox("BoxReelIDInfoMaintain", "Api return data error:\r\n" + json, System.Windows.Forms.MessageBoxButtons.OK, true).ShowDialog();
else else
errmsg = "Api return data error:\r\n" + json; errmsg = "Api return data error:\r\n" + json;
...@@ -860,7 +865,7 @@ namespace BLL ...@@ -860,7 +865,7 @@ namespace BLL
{ {
errmsg = "Api parse error:\r\n" + dic["MSG"].ToString(); errmsg = "Api parse error:\r\n" + dic["MSG"].ToString();
if (extensions != null && !extensions[0].Control.InvokeRequired) if (extensions != null && !extensions[0].Control.InvokeRequired)
new FaceMessageBox("BoxReelIDInfoMaintain", errmsg, System.Windows.Forms.MessageBoxButtons.OK, true).ShowDialog(); return MessageboxNeo.Show("BoxReelIDInfoMaintain", errmsg, "NEO SCAN", true);
return false; return false;
} }
...@@ -977,7 +982,7 @@ namespace BLL ...@@ -977,7 +982,7 @@ namespace BLL
if (extensions != null && extensions.Count > 0 && !extensions[0].Control.InvokeRequired) if (extensions != null && extensions.Count > 0 && !extensions[0].Control.InvokeRequired)
{ {
//自动打印and模板匹配成功,只负责打印标签 //自动打印and模板匹配成功,只负责打印标签
if (config.AutoPrint && match) //if (config.AutoPrint && match)
{ {
isprint = true; isprint = true;
PrintLabel(true, EventArgs.Empty); PrintLabel(true, EventArgs.Empty);
......
...@@ -115,7 +115,9 @@ namespace SmartScan ...@@ -115,7 +115,9 @@ namespace SmartScan
// 订阅语言更改事件 // 订阅语言更改事件
MF_top.LanguageChanged += MF_top_LanguageChanged; MF_top.LanguageChanged += MF_top_LanguageChanged;
//拖动 //拖动
MF_top.DragRequested += MF_top_DragRequested; ; MF_top.DragRequested += MF_top_DragRequested;
} }
private bool isDragging = false; private bool isDragging = false;
private System.Drawing.Point dragStartPoint; private System.Drawing.Point dragStartPoint;
...@@ -185,7 +187,7 @@ namespace SmartScan ...@@ -185,7 +187,7 @@ namespace SmartScan
private void MF_top_LanguageChanged(object sender, string language) private void MF_top_LanguageChanged(object sender, string language)
{ {
// 处理语言变更 // 处理语言变更
if (BLLCommon.config.Language != language) //if (BLLCommon.config.Language != language)
{ {
Language.LoadLanguage(language); Language.LoadLanguage(language);
BLLCommon.config.Language = language; BLLCommon.config.Language = language;
...@@ -429,7 +431,6 @@ namespace SmartScan ...@@ -429,7 +431,6 @@ namespace SmartScan
// 确保它位于Z顺序的顶部 // 确保它位于Z顺序的顶部
host.BringToFront(); host.BringToFront();
} }
...@@ -463,6 +464,7 @@ namespace SmartScan ...@@ -463,6 +464,7 @@ namespace SmartScan
private void Ns_rigth_Load(object sender, EventArgs e) private void Ns_rigth_Load(object sender, EventArgs e)
{ {
InitializeWpfControl(); InitializeWpfControl();
MF_top_LanguageChanged(this, BLLCommon.config.Language);
} }
//private General generals; //private General generals;
...@@ -1060,7 +1062,7 @@ namespace SmartScan ...@@ -1060,7 +1062,7 @@ namespace SmartScan
private void OnBllKeySet(string[] originalCode, Dictionary<string, string> key, bool hasMatch) private void OnBllKeySet(string[] originalCode, Dictionary<string, string> key, bool hasMatch)
{ {
LogNet.log.Info($"OnBllKeySet hasMatch:{hasMatch}, key:" + JsonConvert.SerializeObject(key));
// 1. 更新UI显示原始码 // 1. 更新UI显示原始码
wpfControl.UpdateOriginalCodeDisplay(originalCode); wpfControl.UpdateOriginalCodeDisplay(originalCode);
...@@ -1113,6 +1115,7 @@ namespace SmartScan ...@@ -1113,6 +1115,7 @@ namespace SmartScan
private void CboLanguage_SelectedIndexChanged(object sender, EventArgs e) private void CboLanguage_SelectedIndexChanged(object sender, EventArgs e)
{ {
return;
if (BLLCommon.config.Language != CboLanguage.Text) if (BLLCommon.config.Language != CboLanguage.Text)
{ {
Language.LoadLanguage(CboLanguage.Text); Language.LoadLanguage(CboLanguage.Text);
......
...@@ -37,8 +37,7 @@ namespace SmartScan ...@@ -37,8 +37,7 @@ namespace SmartScan
menu.Add(BtnGenneralSetting, new UsrWpfPanel(new WPFWorkMode())); menu.Add(BtnGenneralSetting, new UsrWpfPanel(new WPFWorkMode()));
// menu.Add(aaa, new UsrWpfPanel(new WPF_MaterialTemplate())); // menu.Add(aaa, new UsrWpfPanel(new WPF_MaterialTemplate()));
Language.LoadLanguage(BLLCommon.config.Language);
Language.SetLanguage(this);
...@@ -57,6 +56,9 @@ namespace SmartScan ...@@ -57,6 +56,9 @@ namespace SmartScan
BtnKeyword.HoldPress = true; BtnKeyword.HoldPress = true;
menu[BtnKeyword].GetPanel().Visible = true; menu[BtnKeyword].GetPanel().Visible = true;
Maximize(); Maximize();
Language.LoadLanguage(BLLCommon.config.Language);
Language.SetLanguage(this);
} }
private void BtnMenu_Click(object sender, EventArgs e) private void BtnMenu_Click(object sender, EventArgs e)
......
...@@ -409,7 +409,8 @@ WPF_Software 软件设置 Software Settings ...@@ -409,7 +409,8 @@ WPF_Software 软件设置 Software Settings
WPF_API 数据源设置 API Setting WPF_API 数据源设置 API Setting
Serial_number 添加流水 Add the serial number Serial_number 添加流水 Add the serial number
xianshi 已选关键词(按显示顺序排列) Selected keywords (arranged according to display order) xianshi 已选关键词(按显示顺序排列) Selected keywords (arranged according to display order)
Dialog_NS_KetRight_Green 绿色 - 完全正确 微软雅黑,12,,
Dialog_NS_KetRight_yllow 黄色 - OCR识别结果,需要验证 微软雅黑,12,,
Dialog_NS_KetRight_Red 红色 - 无法识别或有问题 微软雅黑,12,,
Dialog_NS_KetRight_TextBlock 识别结果 微软雅黑,12,,
\ No newline at end of file \ No newline at end of file
Dialog_NS_KetRight_Green 绿色 - 完全正确 Green - Completely correct 微软雅黑,12,,
Dialog_NS_KetRight_yllow 黄色 - OCR识别结果,需要验证 OCR recognition result, needs verification 微软雅黑,12,,
Dialog_NS_KetRight_Red 红色 - 无法识别或有问题 Unrecognizable or problematic 微软雅黑,12,,
Dialog_NS_KetRight_TextBlock 识别结果 Result: 微软雅黑,12,,
NS_KetRight_Detect 已检测字段 Detected Fields 微软雅黑,12,,
\ No newline at end of file \ No newline at end of file
...@@ -190,7 +190,7 @@ UsrCodeExtractList_ChkMatchisnumber 璉瘚僎頧祆銝箸摮 摮璊 ...@@ -190,7 +190,7 @@ UsrCodeExtractList_ChkMatchisnumber 璉瘚僎頧祆銝箸摮 摮璊
UsrCodeExtractList_ChkMatchingSplit 条码分割字符 バーコードの分割キャラクタ 微软雅黑,12,, UsrCodeExtractList_ChkMatchingSplit 条码分割字符 バーコードの分割キャラクタ 微软雅黑,12,,
UsrCodeExtractList_LblSplitPart 获取分割部分 分割部分の取得 微软雅黑,12,, UsrCodeExtractList_LblSplitPart 获取分割部分 分割部分の取得 微软雅黑,12,,
UsrCodeExtractList_ChkCaseSensitivity 区分大小写 大文字と小文字を区別 微软雅黑,12,, UsrCodeExtractList_ChkCaseSensitivity 区分大小写 大文字と小文字を区別 微软雅黑,12,,
UsrCodeExtractList_Characteristicbarcode 特征码 特徴コード微软雅黑,12,, UsrCodeExtractList_Characteristicbarcode 特征码 特徴コード微软雅黑,12,, 微软雅黑,12,,
UsrCodeExtractList_ChkMinLength 最小长度 最小長さ 微软雅黑,12,, UsrCodeExtractList_ChkMinLength 最小长度 最小長さ 微软雅黑,12,,
UsrCodeExtractList_ChkMaxLength 最大长度 最大長さ 微软雅黑,12,, UsrCodeExtractList_ChkMaxLength 最大长度 最大長さ 微软雅黑,12,,
UsrCodeExtractList_LblKeyword 选择关键字 キーワードを選択 微软雅黑,12,, UsrCodeExtractList_LblKeyword 选择关键字 キーワードを選択 微软雅黑,12,,
...@@ -458,7 +458,29 @@ WPF_Software 頧臭辣霈曄蔭 身蝵 ...@@ -458,7 +458,29 @@ WPF_Software 頧臭辣霈曄蔭 身蝵
WPF_API API设置 API设置 WPF_API API设置 API设置
Serial_number 添加流水 シリアル値 Serial_number 添加流水 シリアル値
xianshi 已选关键词(按显示顺序排列) 選択されたキーワード(表示順に配列) xianshi 已选关键词(按显示顺序排列) 選択されたキーワード(表示順に配列)
Dialog_NS_KetRight_Green 绿色 - 完全正确 微软雅黑,12,,
Dialog_NS_KetRight_yllow 黄色 - OCR识别结果,需要验证 微软雅黑,12,,
Dialog_NS_KetRight_Red 红色 - 无法识别或有问题 微软雅黑,12,,
Dialog_NS_KetRight_TextBlock 识别结果 微软雅黑,12,,
\ No newline at end of file \ No newline at end of file
Dialog_NS_KetRight_Green 绿色 - 完全正确 緑色 - 完全に正確 微软雅黑,12,,
Dialog_NS_KetRight_yllow 黄色 - OCR识别结果,需要验证 黄色 - OCR認識結果、検証が必要 微软雅黑,12,,
Dialog_NS_KetRight_Red 红色 - 无法识别或有问题 赤色 - 認識不能または問題あり 微软雅黑,12,,
Dialog_NS_KetRight_TextBlock 识别结果 認識結果 微软雅黑,12,,
Dialog_NS_KetRight_Detect 已检测字段 検出されたフィールド 微软雅黑,12,,
FrmSet_ChkRecursive 遍历同目录 同じディレクトリを遍歴 微软雅黑,12,,
FrmSet_groupBox_lblkey 标签可用字段 ラベル可用フィールド 微软雅黑,12,,
FrmSet_BtnSelectFile 选择文件 ファイル選択 微软雅黑,12,,
FrmSet_faceLabel2 关键字匹配数据标题 キーワードマッチデータタイトル 微软雅黑,12,,
FrmSet_faceLabel1 识别关键词 キーワード認識 微软雅黑,12,,
FrmSet_LblFilestatus 文件状态: ファイル状態: 微软雅黑,12,,
FrmSet_LblContent 标签数据源 ラベルデータソース 微软雅黑,12,,
FrmSet_BtnAddLabel 新しいラベルを作成 新しいラベルを作成 微软雅黑,12,,
FrmSet_BtnDelLabel ラベル削除 ラベル削除 微软雅黑,12,,
FrmSet_facePanel7 フィールド操作 フィールド操作 微软雅黑,12,,
FrmSet_BtnAddField フィールド追加 フィールド追加 微软雅黑,12,,
FrmSet_BtnDelField フィールド削除 フィールド削除 微软雅黑,12,,
FrmSet_ChkFieldShowKey キーワード表示 キーワード表示 微软雅黑,12,,
FrmSet_BtnSetField フィールド内容設定 フィールド内容設定 微软雅黑,12,,
FrmSet_BtnPrintTest 印刷テスト 印刷テスト 微软雅黑,12,,
FrmSet_LblFieldType バーコード種類 バーコード種類 微软雅黑,12,,
FrmSet_pnLabelFieldPos フィールド位置 フィールド位置 微软雅黑,12,,
FrmSet_LblFieldSize 用紙サイズ 用紙サイズ 微软雅黑,12,,
FrmSet_pnlPrintTmpLstOp ラベルテンプレート操作 ラベルテンプレート操作 微软雅黑,12,,
Dialog_About_About 关于 About 微软雅黑,12,,
Dialog_About_mrs 物料注册系统 材料登録システム 微软雅黑,12,,
\ No newline at end of file \ No newline at end of file
...@@ -461,4 +461,5 @@ xianshi 已选关键词(按显示顺序排列) 已选关键词(按显示 ...@@ -461,4 +461,5 @@ xianshi 已选关键词(按显示顺序排列) 已选关键词(按显示
Dialog_NS_KetRight_Green 绿色 - 完全正确 绿色 - 完全正确 微软雅黑,12,, Dialog_NS_KetRight_Green 绿色 - 完全正确 绿色 - 完全正确 微软雅黑,12,,
Dialog_NS_KetRight_yllow 黄色 - OCR识别结果,需要验证 黄色 - OCR识别结果,需要验证 微软雅黑,12,, Dialog_NS_KetRight_yllow 黄色 - OCR识别结果,需要验证 黄色 - OCR识别结果,需要验证 微软雅黑,12,,
Dialog_NS_KetRight_Red 红色 - 无法识别或有问题 红色 - 无法识别或有问题 微软雅黑,12,, Dialog_NS_KetRight_Red 红色 - 无法识别或有问题 红色 - 无法识别或有问题 微软雅黑,12,,
Dialog_NS_KetRight_TextBlock 识别结果 微软雅黑,12,,
\ No newline at end of file \ No newline at end of file
Dialog_NS_KetRight_TextBlock 识别结果 识别结果 微软雅黑,12,,
NS_KetRight_Detect 已检测字段 已检测字段 微软雅黑,12,,
\ No newline at end of file \ No newline at end of file
...@@ -30,7 +30,7 @@ using System.Runtime.InteropServices; ...@@ -30,7 +30,7 @@ using System.Runtime.InteropServices;
// //
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示: //通过使用 "*",如下所示:
[assembly: AssemblyVersion("4.1.*")] [assembly: AssemblyVersion("4.2.*")]
//[assembly: AssemblyVersion("3.0.0.0")] //[assembly: AssemblyVersion("3.0.0.0")]
//[assembly: AssemblyFileVersion("3.0.0.0")] //[assembly: AssemblyFileVersion("3.0.0.0")]
......
...@@ -415,7 +415,7 @@ namespace SmartScan ...@@ -415,7 +415,7 @@ namespace SmartScan
{ {
LogNet.log.Info("Work GetCodeInfo"); LogNet.log.Info("Work GetCodeInfo");
if (BLLCommon.config.EnabledCamera && isstart==true) if (BLLCommon.config.EnabledCamera)// && isstart==true)
{ {
LogNet.log.Info("1"); LogNet.log.Info("1");
if (BLLCommon.config.TriggerOpenLight) if (BLLCommon.config.TriggerOpenLight)
...@@ -762,7 +762,7 @@ namespace SmartScan ...@@ -762,7 +762,7 @@ namespace SmartScan
string status = BLLCommon.extension.labelText.ToLower(); string status = BLLCommon.extension.labelText.ToLower();
needPrint = (status == "等待中" || status == "Waiting" || status == "待機中"); needPrint = (status == "等待中" || status == "Waiting" || status == "待機中");
} }
if (needPrint) if (needPrint && BLLCommon.config.AutoPrint)
{ {
if (workCodeKeyword.Any(a => a.Value.StartsWith("<OCR>"))) if (workCodeKeyword.Any(a => a.Value.StartsWith("<OCR>")))
{ {
...@@ -804,6 +804,7 @@ namespace SmartScan ...@@ -804,6 +804,7 @@ namespace SmartScan
} }
else else
{ {
if (hasMatch)
//打印 //打印
BLLCommon.extension.Print(hasMatch, pairs); BLLCommon.extension.Print(hasMatch, pairs);
} }
...@@ -838,6 +839,7 @@ namespace SmartScan ...@@ -838,6 +839,7 @@ namespace SmartScan
} }
else else
{ {
if (hasMatch)
BLLCommon.extension.Print(hasMatch, workCodeKeyword); BLLCommon.extension.Print(hasMatch, workCodeKeyword);
} }
//打印 //打印
......
...@@ -56,6 +56,8 @@ namespace SmartScan.SetControl.WPF ...@@ -56,6 +56,8 @@ namespace SmartScan.SetControl.WPF
string YU = BLLCommon.config.Language; string YU = BLLCommon.config.Language;
text1.Text = Asa.FaceControl.Language.Dialog("About_About", "关于"); text1.Text = Asa.FaceControl.Language.Dialog("About_About", "关于");
text2.Text = Asa.FaceControl.Language.Dialog("About_mrs", "物料注册系统"); text2.Text = Asa.FaceControl.Language.Dialog("About_mrs", "物料注册系统");
VersionInfo = BLLCommon.config.SoftVersion;
//if (YU == "English") //if (YU == "English")
//{ //{
// = "About"; // = "About";
......
...@@ -72,8 +72,7 @@ ...@@ -72,8 +72,7 @@
Background="Transparent" Background="Transparent"
Foreground="White" Foreground="White"
BorderBrush="#444444" BorderBrush="#444444"
FontSize="12" FontSize="12">
SelectionChanged="LanguageSelector_SelectionChanged">
<!-- 自定义ComboBox样式 --> <!-- 自定义ComboBox样式 -->
<ComboBox.Resources> <ComboBox.Resources>
......
using BLL; using BLL;
using SharpDocx.CodeBlocks;
using SmartScan.SetControl.WPF.Model; using SmartScan.SetControl.WPF.Model;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
...@@ -35,7 +36,6 @@ namespace SmartScan.SetControl.WPF ...@@ -35,7 +36,6 @@ namespace SmartScan.SetControl.WPF
InitializeComponent(); InitializeComponent();
// 从配置中获取当前语言 // 从配置中获取当前语言
string configLanguage = BLLCommon.config.Language; string configLanguage = BLLCommon.config.Language;
// 根据配置设置选择正确的ComboBoxItem // 根据配置设置选择正确的ComboBoxItem
SelectLanguageInUI(configLanguage); SelectLanguageInUI(configLanguage);
this.Loaded += (s, e) => { this.Loaded += (s, e) => {
......
...@@ -85,10 +85,11 @@ ...@@ -85,10 +85,11 @@
<Grid Margin="0,5,0,5"> <Grid Margin="0,5,0,5">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="24"/> <ColumnDefinition Width="24"/>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="3*"/>
<ColumnDefinition Width="13*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Rectangle Width="16" Height="16" Fill="#FFC107" RadiusX="2" RadiusY="2"/> <Rectangle Width="16" Height="16" Fill="#FFC107" RadiusX="2" RadiusY="2" Margin="4,1,4,1"/>
<TextBlock Grid.Column="1" x:Name="lbl_yellow" Text="黄色 - OCR识别结果,需要验证" FontSize="14" FontFamily="微软雅黑" VerticalAlignment="Center" Margin="10,0,0,0"/> <TextBlock Grid.Column="1" x:Name="lbl_yellow" Text="黄色 - OCR识别结果,需要验证" FontSize="14" FontFamily="微软雅黑" VerticalAlignment="Center" Margin="10,0,0,0" Grid.ColumnSpan="2"/>
</Grid> </Grid>
<Grid Margin="0,5,0,5"> <Grid Margin="0,5,0,5">
......
using BLL; using BLL;
using DocumentFormat.OpenXml.Office2016.Drawing.ChartDrawing;
using Model; using Model;
using Newtonsoft.Json;
using SmartScan.SetControl.WPF.Model; using SmartScan.SetControl.WPF.Model;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using static BLL.BLLCommon;
using static SmartScan.SetControl.WPF.Model.NeoAlertBox; using static SmartScan.SetControl.WPF.Model.NeoAlertBox;
using static SmartScan.WebCallWork;
using TextBlock = System.Windows.Controls.TextBlock; using TextBlock = System.Windows.Controls.TextBlock;
namespace SmartScan.SetControl.WPF namespace SmartScan.SetControl.WPF
...@@ -274,14 +264,14 @@ namespace SmartScan.SetControl.WPF ...@@ -274,14 +264,14 @@ namespace SmartScan.SetControl.WPF
// 打印标签按钮 // 打印标签按钮
printButton = new Button printButton = new Button
{ {
Content = BLLCommon.config.Language == "English" ? "Print Label" :BLLCommon.config.Language == "日语" ? "ラベル印刷" : "打印标签", Content = BLLCommon.config.Language == "English" ? "Print Label" : BLLCommon.config.Language == "日语" ? "ラベル印刷" : "打印标签",
Margin = new Thickness(0, 5, 0, 5), Margin = new Thickness(0, 5, 0, 5),
Padding = new Thickness(10, 5, 10, 5), Padding = new Thickness(10, 5, 10, 5),
//Background = new SolidColorBrush(Color.FromRgb(0, 120, 215)), //Background = new SolidColorBrush(Color.FromRgb(0, 120, 215)),
//Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#555555")), //Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#555555")),
Foreground = Brushes.White, Foreground = Brushes.White,
Height = 35, Height = 35,
Name="ns_Pring", Name = "ns_Pring",
}; };
// 创建用于显示结果的TextBlock // 创建用于显示结果的TextBlock
TextBlock resultTextBlock = new TextBlock TextBlock resultTextBlock = new TextBlock
...@@ -293,19 +283,19 @@ namespace SmartScan.SetControl.WPF ...@@ -293,19 +283,19 @@ namespace SmartScan.SetControl.WPF
FontSize = 14, FontSize = 14,
FontWeight = FontWeights.Bold, FontWeight = FontWeights.Bold,
HorizontalAlignment = HorizontalAlignment.Left, HorizontalAlignment = HorizontalAlignment.Left,
VerticalAlignment= VerticalAlignment.Center, VerticalAlignment = VerticalAlignment.Center,
Width= 80, Width = 80,
}; };
txtResults = resultTextBlock; txtResults = resultTextBlock;
// 创建跳过按钮 // 创建跳过按钮
skipButton = new Button skipButton = new Button
{ {
Content = BLLCommon.config.Language == "English" ? "Skip" :BLLCommon.config.Language == "日语" ? "スキップ" : "跳过", Content = BLLCommon.config.Language == "English" ? "Skip" : BLLCommon.config.Language == "日语" ? "スキップ" : "跳过",
Margin = new Thickness(10, 5, 0, 5), Margin = new Thickness(10, 5, 0, 5),
Padding = new Thickness(10, 5, 10, 5), Padding = new Thickness(10, 5, 10, 5),
Foreground = Brushes.White, Foreground = Brushes.White,
Height = 35, Height = 35,
Width= 150, Width = 150,
Name = "btnSkip", Name = "btnSkip",
}; };
// 为跳过按钮创建样式,和打印按钮类似 // 为跳过按钮创建样式,和打印按钮类似
...@@ -418,7 +408,7 @@ namespace SmartScan.SetControl.WPF ...@@ -418,7 +408,7 @@ namespace SmartScan.SetControl.WPF
if (skipButton != null) if (skipButton != null)
{ {
skipButton.Content = isEnglish ? "Skip" :BLLCommon.config.Language == "日语" ? "スキップ" : "跳过"; skipButton.Content = isEnglish ? "Skip" : BLLCommon.config.Language == "日语" ? "スキップ" : "跳过";
} }
// 更新识别结果标签 // 更新识别结果标签
...@@ -461,16 +451,17 @@ namespace SmartScan.SetControl.WPF ...@@ -461,16 +451,17 @@ namespace SmartScan.SetControl.WPF
} }
// 特殊处理包含 "/" 的格式(如 "PC/22") // 特殊处理包含 "/" 的格式(如 "PC/22")
if (key.Contains("/")) if (key.Contains("\t"))
{ {
string[] parts = key.Split('/'); string[] parts = key.Split('\t');
if (YU == "en-US")
if (!string.IsNullOrWhiteSpace(parts[1]))
{ {
return $"{parts[0]}"; return $"{parts[0]}({parts[1]})";
} }
else else
{ {
return $"{parts[1]}"; return $"{parts[0]}";
} }
} }
...@@ -595,9 +586,9 @@ namespace SmartScan.SetControl.WPF ...@@ -595,9 +586,9 @@ namespace SmartScan.SetControl.WPF
{ {
// 如果不在已匹配集合中,清空控件内容 // 如果不在已匹配集合中,清空控件内容
textBox.Text = string.Empty; textBox.Text = string.Empty;
ISPrint?.Invoke(this,null); ISPrint?.Invoke(this, null);
// 将未匹配到的控件设置为红色 // 将未匹配到的控件设置为红色
UpdateControlStyle(textBox, controlKey, false,false); // 未找到匹配的设为红色 UpdateControlStyle(textBox, controlKey, false, false); // 未找到匹配的设为红色
} }
} }
...@@ -613,6 +604,12 @@ namespace SmartScan.SetControl.WPF ...@@ -613,6 +604,12 @@ namespace SmartScan.SetControl.WPF
/// </summary> /// </summary>
private void AddFieldControl(string key, string value) private void AddFieldControl(string key, string value)
{ {
var innerKey = key;
if (innerKey.Contains("\t"))
{
string[] parts = key.Split('\t');
innerKey = parts[0];
}
// 创建容器 // 创建容器
StackPanel fieldContainer = new StackPanel StackPanel fieldContainer = new StackPanel
{ {
...@@ -646,7 +643,7 @@ namespace SmartScan.SetControl.WPF ...@@ -646,7 +643,7 @@ namespace SmartScan.SetControl.WPF
BorderThickness = new Thickness(1), BorderThickness = new Thickness(1),
BorderBrush = new SolidColorBrush(Colors.Gray), BorderBrush = new SolidColorBrush(Colors.Gray),
CornerRadius = new CornerRadius(3), CornerRadius = new CornerRadius(3),
Height=36, Height = 36,
Padding = new Thickness(1), Padding = new Thickness(1),
Margin = new Thickness(0, 0, 0, 0) // 确保没有外边距 Margin = new Thickness(0, 0, 0, 0) // 确保没有外边距
}; };
...@@ -695,11 +692,11 @@ namespace SmartScan.SetControl.WPF ...@@ -695,11 +692,11 @@ namespace SmartScan.SetControl.WPF
FieldsPanel.Children.Add(fieldContainer); FieldsPanel.Children.Add(fieldContainer);
// 保存引用 // 保存引用
fieldControls[key] = textBox; fieldControls[innerKey] = textBox;
fieldValidStatus[key] = !string.IsNullOrEmpty(value); fieldValidStatus[innerKey] = !string.IsNullOrEmpty(value);
// 添加事件 // 添加事件
textBox.TextChanged += (sender, e) => TextBox_TextChanged(sender, e, key); textBox.TextChanged += (sender, e) => TextBox_TextChanged(sender, e, innerKey);
} }
//private void AddFieldControl(string key, string value) //private void AddFieldControl(string key, string value)
...@@ -837,7 +834,7 @@ namespace SmartScan.SetControl.WPF ...@@ -837,7 +834,7 @@ namespace SmartScan.SetControl.WPF
fieldValidStatus[key] = isValid; fieldValidStatus[key] = isValid;
// 更新样式 // 更新样式
UpdateControlStyle(textBox, key, isValid,false); UpdateControlStyle(textBox, key, isValid, false);
// 更新结果 // 更新结果
UpdateRecognitionResults(ResultItemsPanel); UpdateRecognitionResults(ResultItemsPanel);
...@@ -857,9 +854,9 @@ namespace SmartScan.SetControl.WPF ...@@ -857,9 +854,9 @@ namespace SmartScan.SetControl.WPF
{ {
Asa.FaceControl.Language.LoadLanguage(BLLCommon.config.Language); Asa.FaceControl.Language.LoadLanguage(BLLCommon.config.Language);
lbl_Green.Text= Asa.FaceControl.Language.Dialog("Dialog_NS_KetRight_Green", "绿色 - 完全正确"); lbl_Green.Text = Asa.FaceControl.Language.Dialog("NS_KetRight_Green", "绿色 - 完全正确");
lbl_yellow.Text = Asa.FaceControl.Language.Dialog("Dialog_NS_KetRight_yllow", "黄色 - OCR识别结果,需要验证"); lbl_yellow.Text = Asa.FaceControl.Language.Dialog("NS_KetRight_yllow", "黄色 - OCR识别结果,需要验证");
lbl_red.Text = Asa.FaceControl.Language.Dialog("Dialog_NS_KetRight_Red", "红色 - 无法识别或有问题"); lbl_red.Text = Asa.FaceControl.Language.Dialog("NS_KetRight_Red", "红色 - 无法识别或有问题");
string YU = BLLCommon.config.Language; string YU = BLLCommon.config.Language;
...@@ -897,7 +894,7 @@ namespace SmartScan.SetControl.WPF ...@@ -897,7 +894,7 @@ namespace SmartScan.SetControl.WPF
TextBlock titleBlock = new TextBlock TextBlock titleBlock = new TextBlock
{ {
// Text = YU == "zh-CN" ? "识别结果" : (YU == "ja-JP" ? "認識結果" : "Recognition Result"), // Text = YU == "zh-CN" ? "识别结果" : (YU == "ja-JP" ? "認識結果" : "Recognition Result"),
Text= Asa.FaceControl.Language.Dialog("NS_KetRight_TextBlock", "识别结果"), Text = Asa.FaceControl.Language.Dialog("NS_KetRight_TextBlock", "识别结果"),
FontSize = 16, FontSize = 16,
Margin = new Thickness(0, 0, 0, 10), Margin = new Thickness(0, 0, 0, 10),
Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#f0f0f0")) Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#f0f0f0"))
...@@ -918,7 +915,8 @@ namespace SmartScan.SetControl.WPF ...@@ -918,7 +915,8 @@ namespace SmartScan.SetControl.WPF
// 添加状态标题 // 添加状态标题
TextBlock statusLabel = new TextBlock TextBlock statusLabel = new TextBlock
{ {
Text = YU == "zh-CN" ? $"已检测字段: {validFields}/{totalFields}" : (YU == "ja-JP" ? $"検出されたフィールド: {validFields}/{totalFields}" : $"Detected Fields: {validFields}/{totalFields}") , //Text = YU == "zh-CN" ? $"已检测字段: {validFields}/{totalFields}" : (YU == "ja-JP" ? $"検出されたフィールド: {validFields}/{totalFields}" : $"Detected Fields: {validFields}/{totalFields}"),
Text = Asa.FaceControl.Language.Dialog("NS_KetRight_Detect", "已检测字段") + $": {validFields}/{totalFields}",
FontWeight = FontWeights.Bold, FontWeight = FontWeights.Bold,
FontSize = 16, FontSize = 16,
Margin = new Thickness(0, 0, 0, 15), Margin = new Thickness(0, 0, 0, 15),
...@@ -954,8 +952,11 @@ namespace SmartScan.SetControl.WPF ...@@ -954,8 +952,11 @@ namespace SmartScan.SetControl.WPF
}; };
// 添加对号和字段名称列表 // 添加对号和字段名称列表
validFieldsBlock.Inlines.Add(new Run("✓ ")); foreach (var f in validFieldNames)
validFieldsBlock.Inlines.Add(new Run(string.Join(", ", validFieldNames))); {
validFieldsBlock.Text += "✓ " + f + "\r\n";
}
//validFieldsBlock.Inlines.Add(new Run(string.Join(", ", validFieldNames)));
mainPanel.Children.Add(validFieldsBlock); mainPanel.Children.Add(validFieldsBlock);
} }
...@@ -971,8 +972,11 @@ namespace SmartScan.SetControl.WPF ...@@ -971,8 +972,11 @@ namespace SmartScan.SetControl.WPF
}; };
// 添加错号和字段名称列表 // 添加错号和字段名称列表
invalidFieldsBlock.Inlines.Add(new Run("✗ ")); foreach (var f in invalidFieldNames)
invalidFieldsBlock.Inlines.Add(new Run(string.Join(", ", invalidFieldNames))); {
invalidFieldsBlock.Text += "✗ " + f + "\r\n";
}
//invalidFieldsBlock.Inlines.Add(new Run(string.Join(", ", invalidFieldNames)));
mainPanel.Children.Add(invalidFieldsBlock); mainPanel.Children.Add(invalidFieldsBlock);
} }
...@@ -1145,26 +1149,28 @@ namespace SmartScan.SetControl.WPF ...@@ -1145,26 +1149,28 @@ namespace SmartScan.SetControl.WPF
private void PrintLabel_Click(object sender, RoutedEventArgs e) private void PrintLabel_Click(object sender, RoutedEventArgs e)
{ {
// 检查是否所有字段都为空 // 检查是否所有字段都为空
bool allFieldsEmpty = recognizedData.Any(kvp => string.IsNullOrEmpty(kvp.Value) || kvp.Value.Trim() == ""); bool allFieldsEmpty = recognizedData.Any(kvp => string.IsNullOrWhiteSpace(kvp.Value));
if (allFieldsEmpty) if (allFieldsEmpty)
{ {
string YU = BLLCommon.config.Language; string YU = BLLCommon.config.Language;
bool result;
if (YU == "English") if (YU == "English")
{ {
bool result = NeoAlertBox.Show("", "Unable to print label, required fields contain no data", AlertType.Warning, "NEO SCAN", true); result = NeoAlertBox.Show("", "Unable to print label, required fields contain no data", AlertType.Warning, "NEO SCAN", true);
} }
else if (YU == "日语") else if (YU == "日语")
{ {
bool result = NeoAlertBox.Show("", "ラベルを印刷できません。フィールドにデータがありません", AlertType.Warning, "NEO SCAN", true); result = NeoAlertBox.Show("", "ラベルを印刷できません。フィールドにデータがありません", AlertType.Warning, "NEO SCAN", true);
} }
else else
{ {
bool result = NeoAlertBox.Show("", "无法打印标签,字段没有数据", AlertType.Warning, "NEO SCAN", true); result = NeoAlertBox.Show("", "无法打印标签,字段没有数据", AlertType.Warning, "NEO SCAN", true);
} }
LogNet.log.Info("无法打印标签: " + JsonConvert.SerializeObject(recognizedData.Where(kvp => string.IsNullOrWhiteSpace(kvp.Value))));
// System.Windows.MessageBox.Show("无法打印标签,字段没有数据", "警告", MessageBoxButton.OK, MessageBoxImage.Warning); // System.Windows.MessageBox.Show("无法打印标签,字段没有数据", "警告", MessageBoxButton.OK, MessageBoxImage.Warning);
//MessageBox.Show("无法打印标签,所有字段都没有数据", "警告", MessageBoxButton.OK, MessageBoxImage.Warning); //MessageBox.Show("无法打印标签,所有字段都没有数据", "警告", MessageBoxButton.OK, MessageBoxImage.Warning);
if (!result)
return; return;
} }
PrintLabelRequested?.Invoke(this, EventArgs.Empty); PrintLabelRequested?.Invoke(this, EventArgs.Empty);
......
...@@ -209,6 +209,6 @@ ...@@ -209,6 +209,6 @@
</WrapPanel> </WrapPanel>
</Grid> </Grid>
<TextBlock Text="等待运行" Visibility="Collapsed" FontFamily="微软雅黑" Name="ShowLog" FontSize="21" Foreground="Red" VerticalAlignment="Bottom" Margin="0 0 0 50" HorizontalAlignment="Center"/> <TextBlock Text="等待运行" Visibility="Collapsed" FontFamily="微软雅黑" Name="ShowLog" FontSize="21" Foreground="Red" VerticalAlignment="Bottom" Margin="0 0 0 50" HorizontalAlignment="Center"/>
<TextBlock Text="4.1.9233.34683" FontFamily="微软雅黑" FontSize="11" Foreground="#999999" VerticalAlignment="Bottom" Margin="0 0 0 10" HorizontalAlignment="Center"/> <TextBlock x:Name="txt_version" Text="4.1.9233.34683" FontFamily="微软雅黑" FontSize="11" Foreground="#999999" VerticalAlignment="Bottom" Margin="0 0 0 10" HorizontalAlignment="Center"/>
</Grid> </Grid>
</UserControl> </UserControl>
\ No newline at end of file \ No newline at end of file
...@@ -168,6 +168,7 @@ namespace SmartScan.SetControl.WPF ...@@ -168,6 +168,7 @@ namespace SmartScan.SetControl.WPF
public VerticalMenuControl() public VerticalMenuControl()
{ {
InitializeComponent(); InitializeComponent();
txt_version.Text = BLLCommon.config.SoftVersion;
string YU = BLLCommon.config.Language; string YU = BLLCommon.config.Language;
if (YU == "English") if (YU == "English")
{ {
......
...@@ -420,9 +420,9 @@ ...@@ -420,9 +420,9 @@
<ComboBox x:Name="ChoMatchMiddleType" Grid.Column="1" Style="{StaticResource DarkComboBoxStyle}" <ComboBox x:Name="ChoMatchMiddleType" Grid.Column="1" Style="{StaticResource DarkComboBoxStyle}"
Margin="10,0,0,0" SelectionChanged="MatchTextChanged"> Margin="10,0,0,0" SelectionChanged="MatchTextChanged">
<ComboBoxItem Name="Dialog_MatchType_max" Content="匹配数量等于" FontFamily="微软雅黑" FontSize="14"/> <ComboBoxItem Name="Dialog_MatchType_max" Content="匹配数量至多" FontFamily="微软雅黑" FontSize="14"/>
<ComboBoxItem Name="Dialog_MatchType_equals" Content="匹配数量于" FontFamily="微软雅黑" FontSize="14"/> <ComboBoxItem Name="Dialog_MatchType_equals" Content="匹配数量于" FontFamily="微软雅黑" FontSize="14"/>
<ComboBoxItem Name="Dialog_MatchType_min" Content="匹配数量小于" FontFamily="微软雅黑" FontSize="14"/> <ComboBoxItem Name="Dialog_MatchType_min" Content="匹配数量至少" FontFamily="微软雅黑" FontSize="14"/>
</ComboBox> </ComboBox>
</Grid> </Grid>
</StackPanel> </StackPanel>
......
...@@ -66,7 +66,7 @@ namespace SmartScan.SetControl.WPF ...@@ -66,7 +66,7 @@ namespace SmartScan.SetControl.WPF
TxtMatchingMiddleText.Text = matchShared.MiddleText; TxtMatchingMiddleText.Text = matchShared.MiddleText;
NudMiddleTextCount.Text = matchShared.MiddleTextCount.ToString(); NudMiddleTextCount.Text = matchShared.MiddleTextCount.ToString();
ChkCaseSensitivity.IsChecked = matchShared.CaseSensitive; ChkCaseSensitivity.IsChecked = matchShared.CaseSensitive;
ChoMatchMiddleType.SelectedIndex = matchShared.MatchMiddleType == -1 ? 0 : matchShared.MatchMiddleType; ChoMatchMiddleType.SelectedIndex = matchShared.MatchMiddleType + 1;
ChkCheckCodeType.IsChecked = matchShared.CheckCodeType; ChkCheckCodeType.IsChecked = matchShared.CheckCodeType;
Characteristicbarcode.IsChecked = matchShared.Characteristic; Characteristicbarcode.IsChecked = matchShared.Characteristic;
...@@ -587,16 +587,16 @@ namespace SmartScan.SetControl.WPF ...@@ -587,16 +587,16 @@ namespace SmartScan.SetControl.WPF
} }
// 根据选择的匹配类型比较 // 根据选择的匹配类型比较
switch (ChoMatchMiddleType.SelectedIndex) switch (ChoMatchMiddleType.SelectedIndex-1)
{ {
case -1: // 至多
ismatch = count <= targetCount;
break;
case 0: // 等于 case 0: // 等于
ismatch = count == targetCount; ismatch = count == targetCount;
break; break;
case 1: // 大于 case 1: // 至少
ismatch = count > targetCount; ismatch = count >= targetCount;
break;
case 2: // 小于
ismatch = count < targetCount;
break; break;
default: default:
ismatch = count == targetCount; ismatch = count == targetCount;
...@@ -891,7 +891,7 @@ namespace SmartScan.SetControl.WPF ...@@ -891,7 +891,7 @@ namespace SmartScan.SetControl.WPF
match.CaseSensitive = ChkCaseSensitivity.IsChecked == true; match.CaseSensitive = ChkCaseSensitivity.IsChecked == true;
match.CheckCodeType = ChkCheckCodeType.IsChecked == true; match.CheckCodeType = ChkCheckCodeType.IsChecked == true;
match.CodeType = codeType; match.CodeType = codeType;
match.MatchMiddleType = ChoMatchMiddleType.SelectedIndex; match.MatchMiddleType = ChoMatchMiddleType.SelectedIndex-1;
match.CodeID = codeID; match.CodeID = codeID;
match.Characteristic = Characteristicbarcode.IsChecked == true; match.Characteristic = Characteristicbarcode.IsChecked == true;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!