Commit 2f575419 刘韬

Merge branch 'master' of http://106.15.194.121:8083/zdl/NS100

2 个父辈 f313cbeb 4bbefe4a
......@@ -368,6 +368,26 @@ namespace BLL
debounceHelper.HandleTextChanged((FaceComboBox)sender,txt);
}
private Dictionary<string, string> UpdateLastKey( Dictionary<string, string> lastkey)
{
Dictionary<string, string> keyValues = new Dictionary<string, string>();
if (lastkey == null)
return null;
foreach(var temp in lastkey.Keys)
{
keyValues.Add(temp, lastkey[temp]);
if (temp.Contains(":"))
{
string date = temp.Split(':')[1];
if(int.TryParse(date, out int value)&&value==0&& int.TryParse(lastkey[temp], out int value2))
{
keyValues[temp] = value2.ToString($"D{date.Length}");
}
}
}
return keyValues;
}
private void PrintLabel(object sender, EventArgs e)
{
LogNet.log.Info("Enter PrintLabel Method");
......@@ -383,6 +403,7 @@ namespace BLL
else
lastkey.Add(extensions[i].Key, extensions[i].Control.Text);
}
lastkey= UpdateLastKey(lastkey);
LogNet.log.Info("lastkey:" + JsonConvert.SerializeObject(lastkey));
#region 判断指定关键字是否存在内容
List<string> strings = new List<string>();
......
......@@ -144,6 +144,7 @@ namespace BLL
mateName = "";
keyword = null;
LogNet.log.Info($"code数量:{code.Count}");
code.ForEach((c) =>
{
LogNet.log.Info($"扫描到 {c.Angle}, {c.CodeType},{c.Text}");
......@@ -431,7 +432,8 @@ namespace BLL
Islable = false;
aMatch.IsCodeUsed[j] = true;
aMatch.Points= new Point((int)code[j].Center.X, (int)code[j].Center.Y);
aMatch.Angle = (int)code[j].Angle;
aMatch.Angle = (int)code[j].Angle;
aMatch.CodeType = code[j].CodeType;
}
MatchCodeIndex.Add(j);
keyword.Add(key, matchKey[key]);
......@@ -515,6 +517,7 @@ namespace BLL
//aMatch.IsCodeUsed[0] = true;
aMatch.Points = new Point((int)code[0].Center.X, (int)code[0].Center.Y);
aMatch.Angle = (int)code[0].Angle;
aMatch.CodeType = code[0].CodeType;
}
return true;
}
......
using MvCodeReaderSDKNet;
using MVIDCodeReaderNet;
using MvCodeReaderSDKNet;
using System;
using System.Collections.Generic;
using System.Drawing;
......@@ -430,9 +429,9 @@ namespace IDHIKCamera
MvCodeReader.MV_CODEREADER_IMAGE_OUT_INFO_EX2 stFrameInfoEx2 = new MvCodeReader.MV_CODEREADER_IMAGE_OUT_INFO_EX2();
pstFrameInfoEx2 = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(MvCodeReader.MV_CODEREADER_IMAGE_OUT_INFO_EX2)));
Marshal.StructureToPtr(stFrameInfoEx2, pstFrameInfoEx2, false);
for (int i = 0; i < 10; i++)
for (int i = 0; i < 4; i++)
{
nRet = cameraCurr[index].MV_CODEREADER_GetOneFrameTimeoutEx2_NET(ref pData, pstFrameInfoEx2, 2000);
nRet = cameraCurr[index].MV_CODEREADER_GetOneFrameTimeoutEx2_NET(ref pData, pstFrameInfoEx2, 1000);
if (nRet == MvCodeReader.MV_CODEREADER_OK)
{
......@@ -442,7 +441,7 @@ namespace IDHIKCamera
else
{
LibLogUtil.Error(" Can not grab one : "+ nRet);
Thread.Sleep(100);
Thread.Sleep(50);
}
}
List<Point[]> pts=new List<Point[]>();
......
......@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
......@@ -21,6 +22,11 @@ namespace Model
/// 第一个匹配条码的角度
/// </summary>
public int Angle { get; set; } = 0;
//
// 摘要:
// 条码类型
[DataMember]
public string CodeType { get; set; }
}
/// <summary>
......
......@@ -72,7 +72,7 @@
this.Controls.Add(this.faceButton1);
this.Icon = ((System.Drawing.Bitmap)(resources.GetObject("$this.Icon")));
this.Name = "FrmDrawText";
this.Text = "Using OCR result";
this.Text = "Using OCR Result";
this.Controls.SetChildIndex(this.faceButton1, 0);
this.Controls.SetChildIndex(this.faceButton2, 0);
this.ResumeLayout(false);
......
......@@ -125,6 +125,8 @@ namespace SmartScan
private void FrmRetrospect_Load(object sender, EventArgs e)
{
int SH = Screen.PrimaryScreen.Bounds.Height; //1080
int SW = Screen.PrimaryScreen.Bounds.Width; //1920
......@@ -137,11 +139,12 @@ namespace SmartScan
DtpUpper.Value = DateTime.Now.Date;
tableLayoutPanel1.Width = this.Width-20;
tableLayoutPanel1.Height = this.Height - 60;
if (ConfigHelper.Config.Get("Display_EnableGetData", "1181")=="1181")
if (ConfigHelper.Config.Get("Display_EnableGetData", "1181") == "1181")
{
butt_startserver.Visible = true;
}
this.StartPosition = FormStartPosition.CenterScreen;
}
private void BtnSelect_Click(object sender, EventArgs e)
......
......@@ -22,7 +22,7 @@ Dialog_RepeatPrint 该料盘标签已打印 The Label Has Been Printed
Dialog_MaterialScanning 拍照识别... In Recognition...
Dialog_MaterialTemplateMatching 模版匹配... Template Matching...
Dialog_MaterialProcessing 计算结果... Processing Results...
Dialog_PleaseWaiting 请稍后... Please Waiting...
Dialog_PleaseWaiting 请稍后... Please Wait...
Dialog_MatchType_max 匹配数量至多 Match Times At Most
Dialog_MatchType_equals 匹配数量等于 Match Times Equals
Dialog_MatchType_min 匹配数量至少 Match Times At Least
......@@ -158,11 +158,11 @@ UsrMaterialTemplate_pnlCodeOp 条码操作 Barcode Operation Arial,12,,
UsrMaterialTemplate_pnlImg 图片 Image Arial,12,,
UsrMaterialTemplate_pnlImgOp 图片操作 Image Operation Arial,12,,
UsrDataSource_UsrDataSource
UsrDataSource_ChkRecursive 遍历同目录 Traversal Same Catalogue Arial,12,,
UsrDataSource_groupBox_lblkey 标签可用字段 Label Available Fields Arial,12,,
UsrDataSource_ChkRecursive 遍历同目录 All files under current folder Arial,12,,
UsrDataSource_groupBox_lblkey 标签可用字段 Data string in the label Arial,12,,
UsrDataSource_BtnSelectFile 选择文件 Select File Arial,12,,
UsrDataSource_faceLabel2 关键字匹配数据标题 Keyword Matches The Data Title Arial,12,,
UsrDataSource_faceLabel1 识别关键词 Identify Keyword Arial,12,,
UsrDataSource_faceLabel2 关键字匹配数据标题 Keywords head Arial,12,,
UsrDataSource_faceLabel1 识别关键词 Keywords captured Arial,12,,
UsrDataSource_LblFilestatus 文件状态: File Status: Arial,12,,
UsrDataSource_LblContent 标签数据源 Label Data Source Arial,12,,
UsrMacro_UsrMacro
......@@ -264,3 +264,7 @@ UsrKeywordlabeling_UpdateLabel 修改关键字 Modify keywords Arial,12,,
UsrKeywordlabeling_SaveLabel 确认 Confirm Arial,12,,
FrmKeyCollection_FrmKeyCollection 选择关键字 Select keywords Arial,12,,
FrmKeyCollection_faceButton1 确认 Confirm Arial,12,,
FrmDataFilePreview_BtnCancel 取消 Cancel 微软雅黑,12,,
FrmDataFilePreview_BtnOK 确认 OK 微软雅黑,12,,
FrmDataFilePreview_LblEncoding 编码格式 Encoding Format 微软雅黑,12,,
FrmDataFilePreview_FrmDataFilePreview 文件预览 File Preview 微软雅黑,12,,
......@@ -263,3 +263,8 @@ UsrKeywordlabeling_UpdateLabel 修改关键字 修改关键字 微软雅黑,12,,
UsrKeywordlabeling_SaveLabel 确认 确认 微软雅黑,12,,
FrmKeyCollection_FrmKeyCollection 选择关键字 选择关键字 微软雅黑,12,,
FrmKeyCollection_faceButton1 确认 确认 微软雅黑,12,,
FrmDataFilePreview_BtnCancel 取消 取消 微软雅黑,12,,
FrmDataFilePreview_BtnOK 确认 确认 微软雅黑,12,,
FrmDataFilePreview_LblEncoding 编码格式 编码格式 微软雅黑,12,,
FrmDataFilePreview_FrmDataFilePreview 文件预览 文件预览 微软雅黑,12,,
......@@ -14,6 +14,7 @@ using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
......@@ -259,7 +260,7 @@ namespace SmartScan.PlusSettingFrm
item.key = "";
}
}
public static Point LabelingAngle(string keyvalue, AMatch aMatch, System.Drawing.Point centrality, bool isvaor, int PlateW, out int angle)
public static Point LabelingAngle(string keyvalue, AMatch aMatch, System.Drawing.Point centrality, bool isvaor, int PlateW, out int angle,bool isQRCode)
{
Point lable = aMatch.Points;
Point newpoint = aMatch.Points;
......@@ -276,7 +277,7 @@ namespace SmartScan.PlusSettingFrm
//X += Data.X; Y += Data.Y;
LogUtil.info($"关键字{Data.key}={Data.value};顺时针旋转角度={Data.ClockwiseAngle};xy偏移{Data.X};{Data.Y};标签角度:{Data.LabelAngle}");
}
newpoint = Overwritelabel(centrality, aMatch.Points, isvaor, PlateW, aMatch.Angle, RotateAngle, out angle);
newpoint = Overwritelabel(centrality, aMatch.Points, isvaor, PlateW, aMatch.Angle, RotateAngle, out angle, isQRCode);
//if (Data != null&&Data.LabelAngle > 0)
//{
// angle = Data.LabelAngle;
......@@ -291,12 +292,23 @@ namespace SmartScan.PlusSettingFrm
LogUtil.info($"处理后角度={angle};处理后贴标位置:{newpoint};标签变换角度:{Data.LabelAngle}");
return new Point(newpoint.X, newpoint.Y);
}
public static Point Overwritelabel(Point centrality, Point lable, bool isvaor, int PlateW, int Angle,int RotateAngle, out int angle)
public static Point Overwritelabel(Point centrality, Point lable, bool isvaor, int PlateW, int Angle,int RotateAngle, out int angle,bool isQRCode)
{
Point Points = LabelingPosition.ClockwiseRotation(lable, centrality, RotateAngle);
if (isvaor)
{
angle = ScanningCameraAngle(Angle, RotateAngle);
if (isQRCode)
{
int deg = Angle;
deg += 90;
if (deg > 360)
deg = deg - 360;
angle = ScanningCameraAngle(deg, RotateAngle);
}
else
{
angle = ScanningCameraAngle(Angle, RotateAngle);
}
}
else
{
......@@ -309,7 +321,7 @@ namespace SmartScan.PlusSettingFrm
{
//ID MVS相机, 右侧为正角度, 左侧为负角度
int angle;
int rotationAngle = RotateAngle+83;// 83;
int rotationAngle = RotateAngle+80;// 83;
if (angles < 0)
{
angle = angles * -1 + rotationAngle;
......
......@@ -338,7 +338,8 @@ namespace SmartScan
private void SetKey(bool hasMatch)
{
LogNet.log.Info("Work SetKey hasMatch:" + hasMatch);
//if (workCodeKeyword.Count == 0){ return;}
//if (workCodeKeyword.Count == 0){ return;}
//if(hasMatch)
BLLCommon.extension.SetKey(originalCodeText, workCodeKeyword, hasMatch, out _);
if (workCodeKeyword.Any(a => a.Value.StartsWith("<OCR>")))
{
......
......@@ -87,10 +87,10 @@ namespace SmartScan
this.LblEncoding.BorderStyle = Asa.FaceControl.ControlShape.Rectangle;
this.LblEncoding.BorderWidth = 0;
this.LblEncoding.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(230)))), ((int)(((byte)(230)))));
this.LblEncoding.Location = new System.Drawing.Point(354, 44);
this.LblEncoding.Location = new System.Drawing.Point(211, 44);
this.LblEncoding.Name = "LblEncoding";
this.LblEncoding.Padding = new System.Windows.Forms.Padding(3);
this.LblEncoding.Size = new System.Drawing.Size(139, 35);
this.LblEncoding.Size = new System.Drawing.Size(282, 35);
this.LblEncoding.TabIndex = 22;
this.LblEncoding.Text = "编码格式";
this.LblEncoding.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
......
......@@ -25,6 +25,8 @@ namespace SmartScan
FrmDataFilePreview frmDataFile = new FrmDataFilePreview();
frmDataFile.Filename = filename;
Encodingtxt = frmDataFile.EncodingTxt;
Asa.FaceControl.Language.SetLanguage(frmDataFile);
if (frmDataFile.ShowDialog() != DialogResult.OK)
return false;
......
......@@ -26,7 +26,6 @@ namespace SmartScan
changed = true;
Language.SetLanguage(this);
this.codeText = codeText;
this.codeType = codeType;
CboKeyword.Items.AddRange(BLLCommon.macroKey.ToArray());
......
......@@ -168,6 +168,7 @@ namespace SmartScan
BLLCommon.mateEdit.CurrntBitmap?.Dispose();
Bitmap bitmap = null;
MemoryStream stream = null;
bool isQRCode = false;
try
{
if (bitmapData == null)
......@@ -194,6 +195,7 @@ namespace SmartScan
{
return new WebResultCode() { ErrorCode = -1, Msg = "扫码相机未传来条码数据;" };
}
if (bitmapData.IsIDCamera)
{
bitmapData.BarCodeList.ForEach(barcode =>
......@@ -207,7 +209,14 @@ namespace SmartScan
CodeType = barcode.CodeType,
Distance = barcode.Distance,
});
//LogNet.log.Info($"条码数据类型为{barcode.CodeType}");
});
//LogNet.log.Info($"条码数据[0]类型为{bitmapData.BarCodeList[0].CodeType}");
//if (bitmapData.BarCodeList[0].CodeType== "QR Code")
//{
// isQRCode = true;
// LogNet.log.Info("条码数据为QR Code");
//}
}
else
{
......@@ -225,10 +234,17 @@ namespace SmartScan
LogNet.log.Info("模板匹配结果:" + rtn);
if (rtn)
{
if (aMatch.CodeType == "QR Code")
{
isQRCode = true;
LogNet.log.Info("条码数据为QR Code");
}
LogNet.log.Info($"条码数据类型为{aMatch.CodeType}");
string key = ConfigHelper.Config.Get("Label_Key", "");
workCodeKeyword.TryGetValue(key, out String Value);
LogNet.log.Info("模板匹配结果:" + rtn + $";关键字{key}:{Value};匹配成功条码xy:X={aMatch.Points.X};Y={aMatch.Points.Y},中心点x={bitmapData.X};y={bitmapData.Y},角度={aMatch.Angle},料盘尺寸={bitmapData.PlateW};匹配成功条码:{string.Join(", ", aMatch.IsCodeUsed)}");
point = UsrKeywordlabeling.LabelingAngle(Value, aMatch, new Point(bitmapData.X, bitmapData.Y), bitmapData.IsIDCamera, bitmapData.PlateW, out angle);
point = UsrKeywordlabeling.LabelingAngle(Value, aMatch, new Point(bitmapData.X, bitmapData.Y), bitmapData.IsIDCamera, bitmapData.PlateW, out angle, isQRCode);
//point =UsrCustomlabeling.LabelingAngle_New(mateName, aMatch, new Point(bitmapData.X, bitmapData.Y), bitmapData.IsIDCamera, bitmapData.PlateW, out angle);
}
Dictionary<string, string> keys = new Dictionary<string, string>();
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!