Преглед на файлове

v1.0.2.10 修复缺陷X位置bug

master
CPL преди 1 година
родител
ревизия
c4ec0d9ff4
променени са 8 файла, в които са добавени 54 реда и са изтрити 16 реда
  1. Двоични данни
     
  2. Двоични данни
     
  3. +1
    -1
      LeatherProject/LeatherApp/Config.cs
  4. +16
    -12
      LeatherProject/LeatherApp/Device/DefectLib.cs
  5. +1
    -0
      LeatherProject/LeatherApp/Page/FHome.Designer.cs
  6. +32
    -2
      LeatherProject/LeatherApp/Page/FHome.cs
  7. +2
    -0
      LeatherProject/LeatherApp/Page/FProductInfo.cs
  8. +2
    -1
      LeatherProject/LeatherApp/Utils/OpenCVUtil.cs

Двоични данни
Целия файл


Двоични данни
Целия файл


+ 1
- 1
LeatherProject/LeatherApp/Config.cs Целия файл

@@ -26,7 +26,7 @@ namespace LeatherApp
public static Dictionary<CMDName, JObject> CMDProcess; public static Dictionary<CMDName, JObject> CMDProcess;
//剩余N米提示(M) //剩余N米提示(M)
public static int residueWarnningLen = 10;
public static int residueWarnningLen = 20;
//瑕疵暂停跳过几张图 //瑕疵暂停跳过几张图
public static int defectPauseSkipPhotoCount=5; public static int defectPauseSkipPhotoCount=5;


+ 16
- 12
LeatherProject/LeatherApp/Device/DefectLib.cs Целия файл

@@ -474,8 +474,8 @@ namespace LeatherApp.Device
{ {
if (Config.getDefectCode(DefectLabelInfoList[q].classId) == "jietou") if (Config.getDefectCode(DefectLabelInfoList[q].classId) == "jietou")
{ {
int max = stpoint.y + 500;
int min = stpoint.y - 500 > 0? stpoint.y - 500:0;
int max = stpoint.y + 2000;
int min = stpoint.y - 2000 > 0? stpoint.y - 2000 : 0;
if (DefectLabelInfoList[q].y >= min && DefectLabelInfoList[q].y <= max) if (DefectLabelInfoList[q].y >= min && DefectLabelInfoList[q].y <= max)
{ {
HeBingList.Add(DefectLabelInfoList[q]); HeBingList.Add(DefectLabelInfoList[q]);
@@ -487,8 +487,8 @@ namespace LeatherApp.Device
} }
else if (Config.getDefectCode(DefectLabelInfoList[q].classId) == "hengdang") else if (Config.getDefectCode(DefectLabelInfoList[q].classId) == "hengdang")
{ {
int max = stpoint.y + 500;
int min = stpoint.y - 500 > 0 ? stpoint.y - 500 : 0;
int max = stpoint.y + 2000;
int min = stpoint.y - 2000 > 0 ? stpoint.y - 2000 : 0;
if (DefectLabelInfoList[q].y >= min && DefectLabelInfoList[q].y <= max) if (DefectLabelInfoList[q].y >= min && DefectLabelInfoList[q].y <= max)
{ {
HeBingList2.Add(DefectLabelInfoList[q]); HeBingList2.Add(DefectLabelInfoList[q]);
@@ -500,8 +500,8 @@ namespace LeatherApp.Device
} }
else if (Config.getDefectCode(DefectLabelInfoList[q].classId) == "jt") else if (Config.getDefectCode(DefectLabelInfoList[q].classId) == "jt")
{ {
int max = stpoint.y + 500;
int min = stpoint.y - 500 > 0 ? stpoint.y - 500 : 0;
int max = stpoint.y + 2000;
int min = stpoint.y - 2000 > 0 ? stpoint.y - 2000 : 0;
if (DefectLabelInfoList[q].y >= min && DefectLabelInfoList[q].y <= max) if (DefectLabelInfoList[q].y >= min && DefectLabelInfoList[q].y <= max)
{ {
HeBingList3.Add(DefectLabelInfoList[q]); HeBingList3.Add(DefectLabelInfoList[q]);
@@ -513,8 +513,8 @@ namespace LeatherApp.Device
} }
else if (Config.getDefectCode(DefectLabelInfoList[q].classId) == "tcy") else if (Config.getDefectCode(DefectLabelInfoList[q].classId) == "tcy")
{ {
int max = stpoint.y + 500;
int min = stpoint.y - 500 > 0 ? stpoint.y - 500 : 0;
int max = stpoint.y + 2000;
int min = stpoint.y - 2000 > 0 ? stpoint.y - 2000 : 0;
if (DefectLabelInfoList[q].y >= min && DefectLabelInfoList[q].y <= max) if (DefectLabelInfoList[q].y >= min && DefectLabelInfoList[q].y <= max)
{ {
HeBingList4.Add(DefectLabelInfoList[q]); HeBingList4.Add(DefectLabelInfoList[q]);
@@ -548,11 +548,12 @@ namespace LeatherApp.Device
var edIt = HeBingList.Find(x => (x.i % colNum) * image_width + x.x == xPos.Max()); var edIt = HeBingList.Find(x => (x.i % colNum) * image_width + x.x == xPos.Max());
var eZXD = HeBingList.Find(x => x.confidence == ZXD.Max()); var eZXD = HeBingList.Find(x => x.confidence == ZXD.Max());
int newW = Math.Abs(((edIt.i % colNum) * image_width + edIt.x) - ((stIt.i % colNum) * image_width + stIt.x)) + edIt.w; int newW = Math.Abs(((edIt.i % colNum) * image_width + edIt.x) - ((stIt.i % colNum) * image_width + stIt.x)) + edIt.w;
int newh = Math.Abs(((edIt.i / colNum) * image_hight + edIt.y) - ((stIt.i / colNum) * image_hight + stIt.y)) + edIt.h;
outList.Add(new DefectLabelInfo() { outList.Add(new DefectLabelInfo() {
x=stIt.x, x=stIt.x,
y=edIt.y, y=edIt.y,
w = newW, //多图叠加 w = newW, //多图叠加
h = edIt.h,
h = newh,
classId = eZXD.classId, classId = eZXD.classId,
confidence = eZXD.confidence, confidence = eZXD.confidence,
contrast = eZXD.contrast, contrast = eZXD.contrast,
@@ -569,12 +570,13 @@ namespace LeatherApp.Device
var edIt = HeBingList2.Find(x => (x.i % colNum) * image_width + x.x == xPos2.Max()); var edIt = HeBingList2.Find(x => (x.i % colNum) * image_width + x.x == xPos2.Max());
var eZXD = HeBingList2.Find(x => x.confidence == ZXD2.Max()); var eZXD = HeBingList2.Find(x => x.confidence == ZXD2.Max());
int newW = Math.Abs(((edIt.i % colNum) * image_width + edIt.x) - ((stIt.i % colNum) * image_width + stIt.x)) + edIt.w; int newW = Math.Abs(((edIt.i % colNum) * image_width + edIt.x) - ((stIt.i % colNum) * image_width + stIt.x)) + edIt.w;
int newh = Math.Abs(((edIt.i / colNum) * image_hight + edIt.y) - ((stIt.i / colNum) * image_hight + stIt.y)) + edIt.h;
outList.Add(new DefectLabelInfo() outList.Add(new DefectLabelInfo()
{ {
x = stIt.x, x = stIt.x,
y = edIt.y, y = edIt.y,
w = newW, //多图叠加 w = newW, //多图叠加
h = edIt.h,
h = newh,
classId = eZXD.classId, classId = eZXD.classId,
confidence = eZXD.confidence, confidence = eZXD.confidence,
contrast = eZXD.contrast, contrast = eZXD.contrast,
@@ -591,12 +593,13 @@ namespace LeatherApp.Device
var edIt = HeBingList3.Find(x => (x.i % colNum) * image_width + x.x == xPos3.Max()); var edIt = HeBingList3.Find(x => (x.i % colNum) * image_width + x.x == xPos3.Max());
var eZXD = HeBingList3.Find(x => x.confidence == ZXD3.Max()); var eZXD = HeBingList3.Find(x => x.confidence == ZXD3.Max());
int newW = Math.Abs(((edIt.i % colNum) * image_width + edIt.x) - ((stIt.i % colNum) * image_width + stIt.x)) + edIt.w; int newW = Math.Abs(((edIt.i % colNum) * image_width + edIt.x) - ((stIt.i % colNum) * image_width + stIt.x)) + edIt.w;
int newh = Math.Abs(((edIt.i / colNum) * image_hight + edIt.y) - ((stIt.i / colNum) * image_hight + stIt.y)) + edIt.h;
outList.Add(new DefectLabelInfo() outList.Add(new DefectLabelInfo()
{ {
x = stIt.x, x = stIt.x,
y = edIt.y, y = edIt.y,
w = newW, //多图叠加 w = newW, //多图叠加
h = edIt.h,
h = newh,
classId = eZXD.classId, classId = eZXD.classId,
confidence = eZXD.confidence, confidence = eZXD.confidence,
contrast = eZXD.contrast, contrast = eZXD.contrast,
@@ -613,12 +616,13 @@ namespace LeatherApp.Device
var edIt = HeBingList4.Find(x => (x.i % colNum) * image_width + x.x == xPos4.Max()); var edIt = HeBingList4.Find(x => (x.i % colNum) * image_width + x.x == xPos4.Max());
var eZXD = HeBingList4.Find(x => x.confidence == ZXD4.Max()); var eZXD = HeBingList4.Find(x => x.confidence == ZXD4.Max());
int newW = Math.Abs(((edIt.i % colNum) * image_width + edIt.x) - ((stIt.i % colNum) * image_width + stIt.x)) + edIt.w; int newW = Math.Abs(((edIt.i % colNum) * image_width + edIt.x) - ((stIt.i % colNum) * image_width + stIt.x)) + edIt.w;
int newh = Math.Abs(((edIt.i / colNum) * image_hight + edIt.y) - ((stIt.i / colNum) * image_hight + stIt.y)) + edIt.h;
outList.Add(new DefectLabelInfo() outList.Add(new DefectLabelInfo()
{ {
x = stIt.x, x = stIt.x,
y = edIt.y, y = edIt.y,
w = newW, //多图叠加 w = newW, //多图叠加
h = edIt.h,
h = newh,
classId = eZXD.classId, classId = eZXD.classId,
confidence = eZXD.confidence, confidence = eZXD.confidence,
contrast = eZXD.contrast, contrast = eZXD.contrast,


+ 1
- 0
LeatherProject/LeatherApp/Page/FHome.Designer.cs Целия файл

@@ -448,6 +448,7 @@
this.button1.TabIndex = 1; this.button1.TabIndex = 1;
this.button1.Text = "button1"; this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true; this.button1.UseVisualStyleBackColor = true;
this.button1.Visible = false;
this.button1.Click += new System.EventHandler(this.button1_Click); this.button1.Click += new System.EventHandler(this.button1_Click);
// //
// btnPause // btnPause


+ 32
- 2
LeatherProject/LeatherApp/Page/FHome.cs Целия файл

@@ -62,6 +62,8 @@ namespace LeatherApp.Page
//云端 //云端
private CloudMgr cloudMgr = new CloudMgr(); private CloudMgr cloudMgr = new CloudMgr();
private bool init_Cloud; private bool init_Cloud;
//
private bool _residueWarnningLenStop;
public FHome(FProductInfo frm) public FHome(FProductInfo frm)
{ {
InitializeComponent(); InitializeComponent();
@@ -742,6 +744,8 @@ namespace LeatherApp.Page
errCode = 4; errCode = 4;
var now = DateTime.Now; var now = DateTime.Now;
currKey = now.Hour * 10000 + now.Minute * 100 + now.Second; currKey = now.Hour * 10000 + now.Minute * 100 + now.Second;
_residueWarnningLenStop = false;
//var materialItem = codes[0]+"-"+ codes[1]; //var materialItem = codes[0]+"-"+ codes[1];
var colorItem = Config.getColorItem(int.Parse(codes[2])); var colorItem = Config.getColorItem(int.Parse(codes[2]));
record = new Records() record = new Records()
@@ -1078,7 +1082,33 @@ namespace LeatherApp.Page
if (Config.residueWarnningLen > 0 && curRecord.ErpLen > 0 && Config.residueWarnningLen >= curRecord.ErpLen - curRecord.Len) if (Config.residueWarnningLen > 0 && curRecord.ErpLen > 0 && Config.residueWarnningLen >= curRecord.ErpLen - curRecord.Len)
{ {
AddTextEvent(DateTime.Now, $"告警{Thread.CurrentThread.ManagedThreadId}", $"已达剩余长度不足提醒!({curRecord.ErpLen - curRecord.Len}<={Config.residueWarnningLen})", WarningEnum.High); AddTextEvent(DateTime.Now, $"告警{Thread.CurrentThread.ManagedThreadId}", $"已达剩余长度不足提醒!({curRecord.ErpLen - curRecord.Len}<={Config.residueWarnningLen})", WarningEnum.High);
//warning(WarningEnum.Low, true);//暂停
#region 剩余提示暂停
if (!_residueWarnningLenStop)
{
_residueWarnningLenStop = true;
AddTextEvent(DateTime.Now, $"暂停{Thread.CurrentThread.ManagedThreadId}", $"已达剩余长度不足提醒!({curRecord.ErpLen - curRecord.Len}<={Config.residueWarnningLen}),进入暂停。");
if (!Config.StopPLC)
this.devContainer.devPlc.pauseDev();
else if (!Config.StopIO && devContainer.devIOCard.IsInit)
{
//只是设备暂停,APP没暂停
devContainer.io_output(CMDName.绿灯输出, false, true, 0);
devContainer.io_output(CMDName.黄灯输出);
devContainer.devIOCard.writeBitState(0, 1, true);
Task.Run(async () =>
{
await Task.Delay(500);
this.devContainer.devIOCard.writeBitState(0, 1, false);
});
}
this.BeginInvoke(new System.Action(() =>
{
//warning(WarningEnum.Low, true);//暂停
MessageBox.Show($"已达剩余长度不足提醒!({curRecord.ErpLen - curRecord.Len}<={Config.residueWarnningLen}),进入暂停。", "警告",MessageBoxButtons.OK, MessageBoxIcon.Warning);
}));
}
#endregion
} }
errStep = 6; errStep = 6;
//厚度检测提示 //厚度检测提示
@@ -1526,7 +1556,7 @@ namespace LeatherApp.Page
//----缺陷队列 //----缺陷队列
int oxw, oxh; int oxw, oxh;
mat = OpenCVUtil.resize(mat, resize.Width, resize.Height, out oxw, out oxh); mat = OpenCVUtil.resize(mat, resize.Width, resize.Height, out oxw, out oxh);
AddTextEvent(DateTime.Now,$"图像处理{Thread.CurrentThread.ManagedThreadId}", $"(图像{scanPhotos0.photoIndex})-合成图resize后:{mat.Width}*{mat.Height}", WarningEnum.Low, false);
AddTextEvent(DateTime.Now,$"图像处理{Thread.CurrentThread.ManagedThreadId}", $"(图像{scanPhotos0.photoIndex})-合成图resize后:{mat.Width}*{mat.Height}-{oxw}*{oxh}", WarningEnum.Low, false);
devContainer.libDefect.add(new Device.DefectLib.DefectTask() devContainer.libDefect.add(new Device.DefectLib.DefectTask()
{ {
modelName= curRecord.ProductInfo.ModelName, modelName= curRecord.ProductInfo.ModelName,


+ 2
- 0
LeatherProject/LeatherApp/Page/FProductInfo.cs Целия файл

@@ -196,6 +196,8 @@ namespace LeatherApp.Page
numDefectCountLimit.Text = model.DefectCountLimit.ToString(); numDefectCountLimit.Text = model.DefectCountLimit.ToString();
swcDefectPauseForUser.Active = model.DefectPauseForUser; swcDefectPauseForUser.Active = model.DefectPauseForUser;
this.uiSwitch1.Active = model.OpenThicknessDetection;
uiNumPadTextBox1.Text = model.ThicknessDetectionStopDis.ToString();
//uiDataGridView fill //uiDataGridView fill
string code; string code;
QualifiedLimit item1; QualifiedLimit item1;


+ 2
- 1
LeatherProject/LeatherApp/Utils/OpenCVUtil.cs Целия файл

@@ -162,7 +162,8 @@ namespace LeatherApp.Utils
//Cv2.Resize(mat, mat2, dsize); //Cv2.Resize(mat, mat2, dsize);
//ResizeUniform(mat, dsize, out mat2, out xw, out xh); //ResizeUniform(mat, dsize, out mat2, out xw, out xh);
xw = xh = 0;
xw = (width - mat.Cols) / 2;
xh = (height - mat.Rows) / 2;
Mat mat2 = new Mat(height, width, MatType.CV_8UC3, new Scalar(114, 114, 114)); Mat mat2 = new Mat(height, width, MatType.CV_8UC3, new Scalar(114, 114, 114));
Rect roi = new Rect((width - mat.Cols) / 2, (height - mat.Rows) / 2, mat.Cols, mat.Rows); Rect roi = new Rect((width - mat.Cols) / 2, (height - mat.Rows) / 2, mat.Cols, mat.Rows);
mat.CopyTo(new Mat(mat2, roi)); mat.CopyTo(new Mat(mat2, roi));


Зареждане…
Отказ
Запис