Commit 8d2fe4df 张东亮

新UI更新

1 个父辈 70e21b44
...@@ -212,6 +212,17 @@ namespace SmartScan ...@@ -212,6 +212,17 @@ namespace SmartScan
foreach (FaceButton btn in matchButton.Keys) foreach (FaceButton btn in matchButton.Keys)
{ {
MaterialCodeMatch match = matchButton[btn].GetMatch(); MaterialCodeMatch match = matchButton[btn].GetMatch();
match.MatchStart = ChkMatchingStart.Checked;
match.StartText = TxtMatchingStartText.Text;
match.MatchEnd = ChkMatchingEnd.Checked;
match.EndText = TxtMatchingEndText.Text;
match.MatchMiddle = ChkMatchingMiddle.Checked;
match.MiddleText = TxtMatchingMiddleText.Text;
match.MiddleTextCount = Convert.ToInt32(NudMiddleTextCount.Value);
match.CaseSensitive = ChkCaseSensitivity.Checked;
match.CheckCodeType = ChkCheckCodeType.Checked;
match.CodeType = LblCodeType.Text;
match.MatchMiddleType = ChoMatchMiddleType.SelectedIndex - 1;
match.CodeID = codeID; match.CodeID = codeID;
var hasmatchselect = match.MatchISNumber || match.CheckCodeType || match.MatchEnd || match.MatchMaxLength || match.MatchMiddle || match.MatchMinLength || match.MatchSplit || match.MatchStart; var hasmatchselect = match.MatchISNumber || match.CheckCodeType || match.MatchEnd || match.MatchMaxLength || match.MatchMiddle || match.MatchMinLength || match.MatchSplit || match.MatchStart;
......
...@@ -16,7 +16,7 @@ namespace SmartScan ...@@ -16,7 +16,7 @@ namespace SmartScan
public event KeyChangedHandler KeyChanged; public event KeyChangedHandler KeyChanged;
public delegate void KeyChangedHandler(object sender, string key); public delegate void KeyChangedHandler(object sender, string key);
public UsrCodeExtractList(string codeText,string codeType, int codeLength, Model.MaterialCodeMatch match) public UsrCodeExtractList(string codeText, string codeType, int codeLength, Model.MaterialCodeMatch match)
{ {
InitializeComponent(); InitializeComponent();
faceTextBox1.Tag = "not"; faceTextBox1.Tag = "not";
...@@ -68,17 +68,9 @@ namespace SmartScan ...@@ -68,17 +68,9 @@ namespace SmartScan
{ {
Model.MaterialCodeMatch match = new() Model.MaterialCodeMatch match = new()
{ {
//MatchStart = ChkMatchingStart.Checked,
//StartText = TxtMatchingStartText.Text,
//MatchEnd = ChkMatchingEnd.Checked,
//EndText = TxtMatchingEndText.Text,
//MatchMiddle = ChkMatchingMiddle.Checked,
//MiddleText = TxtMatchingMiddleText.Text,
//MiddleTextCount = Convert.ToInt32(NudMiddleTextCount.Value),
MatchSplit = ChkMatchingSplit.Checked, MatchSplit = ChkMatchingSplit.Checked,
SplitText = CboMatchingSplit.Text, SplitText = CboMatchingSplit.Text,
SplitPart = Convert.ToInt32(NudSplitPart.Value), SplitPart = Convert.ToInt32(NudSplitPart.Value),
//CaseSensitive = ChkCaseSensitivity.Checked,
MatchMinLength = ChkMinLength.Checked, MatchMinLength = ChkMinLength.Checked,
MinLength = Convert.ToInt32(NudMinLength.Value), MinLength = Convert.ToInt32(NudMinLength.Value),
MatchMaxLength = ChkMaxLength.Checked, MatchMaxLength = ChkMaxLength.Checked,
...@@ -86,9 +78,6 @@ namespace SmartScan ...@@ -86,9 +78,6 @@ namespace SmartScan
Keyword = CboKeyword.SelectedText, Keyword = CboKeyword.SelectedText,
SubstringStart = Convert.ToInt32(NudStart.Value), SubstringStart = Convert.ToInt32(NudStart.Value),
SubstringLength = ChkLengthEnd.Checked ? -1 : Convert.ToInt32(NudLength.Value), SubstringLength = ChkLengthEnd.Checked ? -1 : Convert.ToInt32(NudLength.Value),
//CheckCodeType = ChkCheckCodeType.Checked,
// CodeType = LblCodeType.Text,
// MatchMiddleType = ChoMatchMiddleType.SelectedIndex - 1,
MatchISNumber = ChkMatchisnumber.Checked MatchISNumber = ChkMatchisnumber.Checked
}; };
return match; return match;
...@@ -102,7 +91,7 @@ namespace SmartScan ...@@ -102,7 +91,7 @@ namespace SmartScan
private void ShowPreview() public void ShowPreview(string txt = "")
{ {
if (changed) return; if (changed) return;
string text = codeText; string text = codeText;
...@@ -171,11 +160,6 @@ namespace SmartScan ...@@ -171,11 +160,6 @@ namespace SmartScan
} }
faceTextBox1.Text = text; faceTextBox1.Text = text;
} }
private void ChkLengthEnd_CheckedChanged(object sender, EventArgs e) private void ChkLengthEnd_CheckedChanged(object sender, EventArgs e)
......
...@@ -93,6 +93,7 @@ namespace SmartScan ...@@ -93,6 +93,7 @@ namespace SmartScan
this.BtnOcrCode.Size = new System.Drawing.Size(227, 56); this.BtnOcrCode.Size = new System.Drawing.Size(227, 56);
this.BtnOcrCode.TabIndex = 19; this.BtnOcrCode.TabIndex = 19;
this.BtnOcrCode.Text = "OCR"; this.BtnOcrCode.Text = "OCR";
this.BtnOcrCode.Click += new System.EventHandler(this.BtnOcrCode_Click_1);
// //
// BtnSaveImage // BtnSaveImage
// //
......
...@@ -19,6 +19,12 @@ namespace SmartScan ...@@ -19,6 +19,12 @@ namespace SmartScan
{ {
InitializeComponent(); InitializeComponent();
BtnOcrCode.Visible = Config.Func_EnabledOCR; BtnOcrCode.Visible = Config.Func_EnabledOCR;
if (!Config.Func_EnabledOCR)
BtnScanCode.Width = 461;
if(!BtnTemplateValite.Visible)
{
BtnExtractCode.Width = 461;
}
LstMate.Items.AddRange(BLLCommon.mateEdit.Name); LstMate.Items.AddRange(BLLCommon.mateEdit.Name);
mateCopy = BLLCommon.mateEdit.ToCopy(); mateCopy = BLLCommon.mateEdit.ToCopy();
Language.SetLanguage(this); Language.SetLanguage(this);
...@@ -239,7 +245,6 @@ namespace SmartScan ...@@ -239,7 +245,6 @@ namespace SmartScan
private void BtnScanCode_Click(object sender, EventArgs e) private void BtnScanCode_Click(object sender, EventArgs e)
{ {
if (bmp == null) return; if (bmp == null) return;
string text = Language.Dialog(LanguageDialogKey.REMIND_CLEARTEMPLATE, "Recognizing code will reset the template.Are you sure to perform the action?"); string text = Language.Dialog(LanguageDialogKey.REMIND_CLEARTEMPLATE, "Recognizing code will reset the template.Are you sure to perform the action?");
DialogResult dialogResult = new FaceMessageBox(mateCopy[mateIndex].Name, text, MessageBoxButtons.YesNo).ShowDialog(); DialogResult dialogResult = new FaceMessageBox(mateCopy[mateIndex].Name, text, MessageBoxButtons.YesNo).ShowDialog();
...@@ -277,25 +282,7 @@ namespace SmartScan ...@@ -277,25 +282,7 @@ namespace SmartScan
mateCopy[mateIndex].Code.Add(code); mateCopy[mateIndex].Code.Add(code);
lst[i] = info[i].Center; lst[i] = info[i].Center;
} }
if (Config.Func_EnabledOCR)
{
//保存需要识别ocr的区域
bmp?.Save(@"ocrt.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
string[] regOcrCodes = PaddleOCRHelper.StartTest("..\\ocrt.jpg").Split(';');
int startidx = BLLCommon.mateMaxCodeID + 1;
foreach (var ocr in regOcrCodes)
{
if (string.IsNullOrEmpty(ocr)) continue;
MaterialCode code = new()
{
ID = startidx,
Text = ocr,
CodeType = Setting_Str.OCR
};
mateCopy[mateIndex].Code.Add(code);
startidx++;
}
}
if (mateCopy[mateIndex].Code.Count == 0) if (mateCopy[mateIndex].Code.Count == 0)
{ {
text = Language.Dialog(LanguageDialogKey.CODE_COUNT); text = Language.Dialog(LanguageDialogKey.CODE_COUNT);
...@@ -311,7 +298,7 @@ namespace SmartScan ...@@ -311,7 +298,7 @@ namespace SmartScan
{ {
if (codeIndex == -1) if (codeIndex == -1)
{ {
string text = Language.Dialog(LanguageDialogKey.REMIND_SELECTCODE,"请选择一个条码!"); string text = Language.Dialog(LanguageDialogKey.REMIND_SELECTCODE, "请选择一个条码!");
new FaceMessageBox("", text, MessageBoxButtons.OK).ShowDialog(); new FaceMessageBox("", text, MessageBoxButtons.OK).ShowDialog();
return; return;
} }
...@@ -446,5 +433,29 @@ namespace SmartScan ...@@ -446,5 +433,29 @@ namespace SmartScan
{ {
} }
private void BtnOcrCode_Click_1(object sender, EventArgs e)
{
if (bmp == null) return;
LstCode.Items.Clear();
//保存需要识别ocr的区域
bmp?.Save(@"ocrt.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
string[] regOcrCodes = PaddleOCRHelper.StartTest("..\\ocrt.jpg").Split(';');
int startidx = BLLCommon.mateMaxCodeID + 1;
foreach (var ocr in regOcrCodes)
{
if (string.IsNullOrEmpty(ocr)) continue;
MaterialCode code = new()
{
ID = startidx,
Text = ocr,
CodeType = Setting_Str.OCR
};
mateCopy[mateIndex].Code.Add(code);
startidx++;
}
LstCode.Items.AddRange(FormatCode());
LstCode.SelectedIndex = codeIndex = -1;
}
} }
} }
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!