Compare commits

...

2 Commits

Author SHA1 Message Date
CPL
3e28703c0a 禾欣等级排定改 2024-07-12 10:38:20 +08:00
CPL
2ec7eb4a68 V1.0.10 更新等级判断 2024-07-03 09:33:12 +08:00
28 changed files with 1544 additions and 420 deletions

View File

@ -471,7 +471,7 @@ namespace GeBoShi.SysCtrl
#region #region
#if Online #if Online
//采集图片 //采集图片
Acquisition acq = _LinecamDev1.GetFrames(1, 10); Acquisition acq = _LinecamDev1.GetFrames(10);
if (acq.GrabStatus == "GrabPass") if (acq.GrabStatus == "GrabPass")
{ {
//显示 //显示
@ -568,7 +568,7 @@ namespace GeBoShi.SysCtrl
#region #region
#if Online #if Online
//采集图片 //采集图片
Acquisition acq = _LinecamDev2.GetFrames(1, 10); AcquisitionMat acq = _LinecamDev2.GetFrames(10);
if (acq.GrabStatus == "GrabPass") if (acq.GrabStatus == "GrabPass")
{ {
//显示 //显示

View File

@ -20,7 +20,9 @@ namespace LeatherApp
public static JArray defectItemList; public static JArray defectItemList;
// //
public static JArray colorNameList;//, materialNameList; public static JArray colorNameList;//, materialNameList;
//
public static JArray materialNameList;//, materialNameList;
//CMDProcess目录下的命令JSON文件 //CMDProcess目录下的命令JSON文件
public static Dictionary<CMDName, JObject> CMDProcess; public static Dictionary<CMDName, JObject> CMDProcess;
@ -68,8 +70,21 @@ namespace LeatherApp
public static string ImagePath; public static string ImagePath;
public static bool IsSaveAllImage, IsSaveDefectSourceImage, IsSaveDefectCutImage; public static bool IsSaveAllImage, IsSaveDefectSourceImage, IsSaveDefectCutImage;
//材质Material //材质Material 1
public static string[] SuedeList = new string[0]; public static string[] SuedeList1 = new string[0];
//材质Material 2
public static string[] SuedeList2 = new string[0];
//材质Material 3
public static string[] SuedeList3 = new string[0];
//材质Material 4
public static string[] SuedeList4 = new string[0];
//材质Material 5
public static string[] SuedeList5 = new string[0];
//材质Material 6
public static string[] SuedeList6 = new string[0];
//忽略的等级判断项目
public static string[] SkipLabelGrade = new string[0];
//云端 //云端
public static string cloud_ip, cloud_username, cloud_password, CloudThisName; public static string cloud_ip, cloud_username, cloud_password, CloudThisName;
@ -96,7 +111,7 @@ namespace LeatherApp
LoadDefectItemList(); LoadDefectItemList();
LoadColorNameList(); LoadColorNameList();
//LoadMaterialNameList(); LoadMaterialNameList();
//---- //----
string lsCmdPath = appBasePath + "\\CMDProcess\\"; string lsCmdPath = appBasePath + "\\CMDProcess\\";
if (!Directory.Exists(lsCmdPath)) if (!Directory.Exists(lsCmdPath))
@ -162,7 +177,41 @@ namespace LeatherApp
// //
string lsTmp = ini.ReadString("Material", "SuedeList", "").Trim(); string lsTmp = ini.ReadString("Material", "SuedeList", "").Trim();
if(!string.IsNullOrWhiteSpace(lsTmp)) if(!string.IsNullOrWhiteSpace(lsTmp))
SuedeList=lsTmp.Split(new char[] { ',',';'}); SuedeList1=lsTmp.Split(new char[] { ',',';'});
else
SuedeList1 = new string[1] { ""};
lsTmp = ini.ReadString("Material", "SuedeList2", "").Trim();
if (!string.IsNullOrWhiteSpace(lsTmp))
SuedeList2 = lsTmp.Split(new char[] { ',', ';' });
else
SuedeList2 = new string[1] { "" };
lsTmp = ini.ReadString("Material", "SuedeList3", "").Trim();
if (!string.IsNullOrWhiteSpace(lsTmp))
SuedeList3= lsTmp.Split(new char[] { ',', ';' });
else
SuedeList3 = new string[1] { "" };
lsTmp = ini.ReadString("Material", "SuedeList4", "").Trim();
if (!string.IsNullOrWhiteSpace(lsTmp))
SuedeList4= lsTmp.Split(new char[] { ',', ';' });
else
SuedeList4 = new string[1] { "" };
lsTmp = ini.ReadString("Material", "SuedeList5", "").Trim();
if (!string.IsNullOrWhiteSpace(lsTmp))
SuedeList5 = lsTmp.Split(new char[] { ',', ';' });
else
SuedeList5 = new string[1] { "" };
lsTmp = ini.ReadString("Material", "SuedeList6", "").Trim();
if (!string.IsNullOrWhiteSpace(lsTmp))
SuedeList6 = lsTmp.Split(new char[] { ',', ';' });
else
SuedeList6 = new string[1] { "" };
lsTmp = ini.ReadString("SkipLabelGrade", "LabelGradeList", "").Trim();
if (!string.IsNullOrWhiteSpace(lsTmp))
SkipLabelGrade = lsTmp.Split(new char[] { ',', ';' });
else
SkipLabelGrade = new string[1] { "" };
} }
#region defectItemList <=> DefectItemList.json #region defectItemList <=> DefectItemList.json
@ -209,6 +258,13 @@ namespace LeatherApp
return ""; return "";
return ((JObject)item).Value<string>("name"); return ((JObject)item).Value<string>("name");
} }
public static string getDefectCode(string name)
{
var item = Config.defectItemList.FirstOrDefault(m => m.Value<string>("name") == name);
if (item == null)
return "";
return ((JObject)item).Value<string>("code");
}
#endregion #endregion
#region colorNameList <=> ColorNameList.json #region colorNameList <=> ColorNameList.json
@ -227,14 +283,14 @@ namespace LeatherApp
return null; return null;
return (JObject)item; return (JObject)item;
} }
//public static void LoadMaterialNameList() public static void LoadMaterialNameList()
//{ {
// if (string.IsNullOrWhiteSpace(appBasePath)) if (string.IsNullOrWhiteSpace(appBasePath))
// appBasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); appBasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
// string configPath = appBasePath + "\\MaterialName.json"; string configPath = appBasePath + "\\MaterialName.json";
// string lsTmp = File.ReadAllText(configPath); string lsTmp = File.ReadAllText(configPath);
// materialNameList = JArray.Parse(lsTmp); materialNameList = JArray.Parse(lsTmp);
//} }
//public static JObject getMaterialItem(string code) //public static JObject getMaterialItem(string code)
//{ //{
// var item = Config.materialNameList.FirstOrDefault(m => m.Value<string>("code") == code); // var item = Config.materialNameList.FirstOrDefault(m => m.Value<string>("code") == code);

View File

@ -107,6 +107,12 @@ namespace LeatherApp
if (!Config.StopLight && !devLight.start(int.Parse(Config.Light_PortName.Substring(3)))) throw new Exception("光源设备初始化失败!"); if (!Config.StopLight && !devLight.start(int.Parse(Config.Light_PortName.Substring(3)))) throw new Exception("光源设备初始化失败!");
if (!libPhoto.start()) throw new Exception("图像库初始化失败!"); if (!libPhoto.start()) throw new Exception("图像库初始化失败!");
WarningEvent?.Invoke(DateTime.Now,WarningEnum.Normal, "2"); WarningEvent?.Invoke(DateTime.Now,WarningEnum.Normal, "2");
if(libDefect == null)
{
WarningEvent?.Invoke(DateTime.Now, WarningEnum.Normal, "算法库为空,重新初始化");
libDefect = new DefectLib();
libDefect.WarningEvent = WarningEvent;
}
if (!libDefect.start()) throw new Exception("缺陷库初始化失败!"); if (!libDefect.start()) throw new Exception("缺陷库初始化失败!");
WarningEvent?.Invoke(DateTime.Now,WarningEnum.Normal, "3"); WarningEvent?.Invoke(DateTime.Now,WarningEnum.Normal, "3");
if (!File.Exists(appBasePath+ "\\DevCfg\\" + Config.Carmer1ConfigFilePath) || !File.Exists(appBasePath + "\\DevCfg\\" + Config.Carmer2ConfigFilePath)) if (!File.Exists(appBasePath+ "\\DevCfg\\" + Config.Carmer1ConfigFilePath) || !File.Exists(appBasePath + "\\DevCfg\\" + Config.Carmer2ConfigFilePath))

View File

@ -98,17 +98,17 @@ namespace LeatherApp.Device
} }
public bool start() public bool start()
{ {
List<DefectLabelInfo> DefectLabelInfoList = new List<DefectLabelInfo>(); //List<DefectLabelInfo> DefectLabelInfoList = new List<DefectLabelInfo>();
DefectLabelInfoList.Add(new DefectLabelInfo() { x = 1953, y = 429, w = 200, h = 200, classId = 1, confidence = 0.8, contrast = 0.9, i = 0, j = 0 }); //DefectLabelInfoList.Add(new DefectLabelInfo() { x = 1953, y = 429, w = 200, h = 200, classId = 1, confidence = 0.8, contrast = 0.9, i = 0, j = 0 });
DefectLabelInfoList.Add(new DefectLabelInfo() {x = 1953,y = 929,w=900,h = 400,classId = 11,confidence = 0.8, contrast = 0.9, i = 0,j = 0 }); //DefectLabelInfoList.Add(new DefectLabelInfo() {x = 1953,y = 929,w=900,h = 400,classId = 11,confidence = 0.8, contrast = 0.9, i = 0,j = 0 });
DefectLabelInfoList.Add(new DefectLabelInfo() { x = 3169, y = 1029, w = 900, h = 400, classId = 11, confidence = 0.8, contrast = 0.9, i = 1, j = 0 }); //DefectLabelInfoList.Add(new DefectLabelInfo() { x = 3169, y = 1029, w = 900, h = 400, classId = 11, confidence = 0.8, contrast = 0.9, i = 1, j = 0 });
DefectLabelInfoList.Add(new DefectLabelInfo() { x = 4721, y = 919, w = 900, h = 400, classId = 11, confidence = 0.8, contrast = 0.9, i = 2, j = 0 }); //DefectLabelInfoList.Add(new DefectLabelInfo() { x = 4721, y = 919, w = 900, h = 400, classId = 11, confidence = 0.8, contrast = 0.9, i = 2, j = 0 });
DefectLabelInfoList.Add(new DefectLabelInfo() { x = 6145, y = 829, w = 900, h = 400, classId = 11, confidence = 0.8, contrast = 0.9, i = 3, j = 0 }); //DefectLabelInfoList.Add(new DefectLabelInfo() { x = 6145, y = 829, w = 900, h = 400, classId = 11, confidence = 0.8, contrast = 0.9, i = 3, j = 0 });
DefectLabelInfoList.Add(new DefectLabelInfo() { x = 8073, y = 929, w = 900, h = 400, classId = 11, confidence = 0.8, contrast = 0.9, i = 4, j = 0 }); //DefectLabelInfoList.Add(new DefectLabelInfo() { x = 8073, y = 929, w = 900, h = 400, classId = 11, confidence = 0.8, contrast = 0.9, i = 4, j = 0 });
DefectLabelInfoList.Add(new DefectLabelInfo() { x = 9407, y = 929, w = 900, h = 400, classId = 11, confidence = 0.8, contrast = 0.9, i = 5, j = 0 }); //DefectLabelInfoList.Add(new DefectLabelInfo() { x = 9407, y = 929, w = 900, h = 400, classId = 11, confidence = 0.8, contrast = 0.9, i = 5, j = 0 });
DefectLabelInfoList.Add(new DefectLabelInfo() { x = 10801, y = 999, w = 900, h = 400, classId = 11, confidence = 0.8, contrast = 0.9, i = 6, j = 0 }); //DefectLabelInfoList.Add(new DefectLabelInfo() { x = 10801, y = 999, w = 900, h = 400, classId = 11, confidence = 0.8, contrast = 0.9, i = 6, j = 0 });
DefectLabelInfoList.Add(new DefectLabelInfo() { x = 12465, y = 629, w = 900, h = 800, classId = 11, confidence = 0.8, contrast = 0.9, i = 7, j = 0 }); //DefectLabelInfoList.Add(new DefectLabelInfo() { x = 12465, y = 629, w = 900, h = 800, classId = 11, confidence = 0.8, contrast = 0.9, i = 7, j = 0 });
DefectLabelInfoList = HeBingDefect(16384, DefectLabelInfoList); //DefectLabelInfoList = HeBingDefect(16384, DefectLabelInfoList);
try try
{ {
//detector = CreateDetector(Config.model_path, Config.labels_path, true, 6); //detector = CreateDetector(Config.model_path, Config.labels_path, true, 6);
@ -190,6 +190,7 @@ namespace LeatherApp.Device
public int GetWidthForResize(int sumWidth) public int GetWidthForResize(int sumWidth)
{ {
int count =(int) Math.Round(sumWidth * 1.0f / image_width, 0); int count =(int) Math.Round(sumWidth * 1.0f / image_width, 0);
count = 8;
return count * image_width; return count * image_width;
//int count = sumWidth / image_width; //int count = sumWidth / image_width;
@ -244,7 +245,7 @@ namespace LeatherApp.Device
{ {
if (taskList.Count < 1) if (taskList.Count < 1)
{ {
Thread.Sleep(0); Thread.Sleep(20);
continue; continue;
} }
@ -325,7 +326,7 @@ namespace LeatherApp.Device
{ {
if (taskOperationList.Count < 1) if (taskOperationList.Count < 1)
{ {
Thread.Sleep(0); Thread.Sleep(20);
continue; continue;
} }
@ -454,6 +455,16 @@ namespace LeatherApp.Device
List<int> xPos2 = new List<int>(); List<int> xPos2 = new List<int>();
List<double> ZXD2 = new List<double>(); List<double> ZXD2 = new List<double>();
List<DefectLabelInfo> HeBingList3 = new List<DefectLabelInfo>();
List<DefectLabelInfo> XcHeBingList3 = new List<DefectLabelInfo>();
List<int> xPos3 = new List<int>();
List<double> ZXD3 = new List<double>();
List<DefectLabelInfo> HeBingList4 = new List<DefectLabelInfo>();
List<DefectLabelInfo> XcHeBingList4 = new List<DefectLabelInfo>();
List<int> xPos4 = new List<int>();
List<double> ZXD4 = new List<double>();
DefectLabelInfo stpoint = DefectLabelInfoList[0]; DefectLabelInfo stpoint = DefectLabelInfoList[0];
int colNum = Width / image_width; int colNum = Width / image_width;
@ -467,7 +478,7 @@ namespace LeatherApp.Device
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]);
xPos.Add(DefectLabelInfoList[q].x); xPos.Add((DefectLabelInfoList[q].i % colNum) * image_width + DefectLabelInfoList[q].x);
ZXD.Add(DefectLabelInfoList[q].confidence); ZXD.Add(DefectLabelInfoList[q].confidence);
} }
else else
@ -480,29 +491,61 @@ namespace LeatherApp.Device
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]);
xPos2.Add(DefectLabelInfoList[q].x); xPos2.Add((DefectLabelInfoList[q].i % colNum) * image_width + DefectLabelInfoList[q].x);
ZXD2.Add(DefectLabelInfoList[q].confidence); ZXD2.Add(DefectLabelInfoList[q].confidence);
} }
else else
XcHeBingList2.Add(DefectLabelInfoList[q]); XcHeBingList2.Add(DefectLabelInfoList[q]);
} }
else if (Config.getDefectCode(DefectLabelInfoList[q].classId) == "jt")
{
int max = stpoint.y + 500;
int min = stpoint.y - 500 > 0 ? stpoint.y - 500 : 0;
if (DefectLabelInfoList[q].y >= min && DefectLabelInfoList[q].y <= max)
{
HeBingList3.Add(DefectLabelInfoList[q]);
xPos3.Add((DefectLabelInfoList[q].i % colNum) * image_width + DefectLabelInfoList[q].x);
ZXD3.Add(DefectLabelInfoList[q].confidence);
}
else
XcHeBingList3.Add(DefectLabelInfoList[q]);
}
else if (Config.getDefectCode(DefectLabelInfoList[q].classId) == "tcy")
{
int max = stpoint.y + 500;
int min = stpoint.y - 500 > 0 ? stpoint.y - 500 : 0;
if (DefectLabelInfoList[q].y >= min && DefectLabelInfoList[q].y <= max)
{
HeBingList4.Add(DefectLabelInfoList[q]);
xPos4.Add((DefectLabelInfoList[q].i % colNum) * image_width + DefectLabelInfoList[q].x);
ZXD4.Add(DefectLabelInfoList[q].confidence);
}
else
XcHeBingList4.Add(DefectLabelInfoList[q]);
}
else else
outList.Add(DefectLabelInfoList[q]); outList.Add(DefectLabelInfoList[q]);
} }
//递归下次合并数据 //递归下次合并数据
List<DefectLabelInfo> dg1 = new List<DefectLabelInfo>(); List<DefectLabelInfo> dg1 = new List<DefectLabelInfo>();
List<DefectLabelInfo> dg2 = new List<DefectLabelInfo>(); List<DefectLabelInfo> dg2 = new List<DefectLabelInfo>();
List<DefectLabelInfo> dg3 = new List<DefectLabelInfo>();
List<DefectLabelInfo> dg4 = new List<DefectLabelInfo>();
if (XcHeBingList.Count >0) if (XcHeBingList.Count >0)
dg1 = HeBingDefect(Width, XcHeBingList); dg1 = HeBingDefect(Width, XcHeBingList);
if (XcHeBingList2.Count > 0) if (XcHeBingList2.Count > 0)
dg2 = HeBingDefect(Width, XcHeBingList2); dg2 = HeBingDefect(Width, XcHeBingList2);
if (XcHeBingList3.Count > 0)
dg3 = HeBingDefect(Width, XcHeBingList3);
if (XcHeBingList4.Count > 0)
dg4 = HeBingDefect(Width, XcHeBingList4);
//多个jietou合并 //多个jietou合并
if (HeBingList.Count>0) if (HeBingList.Count>0)
{ {
var stIt = HeBingList.Find(x => x.x == xPos.Min()); var stIt = HeBingList.Find(x => (x.i % colNum) * image_width + x.x == xPos.Min());
var edIt = HeBingList.Find(x => 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;
outList.Add(new DefectLabelInfo() { outList.Add(new DefectLabelInfo() {
@ -522,8 +565,8 @@ namespace LeatherApp.Device
//多个hengdang合并 //多个hengdang合并
if (HeBingList2.Count > 0) if (HeBingList2.Count > 0)
{ {
var stIt = HeBingList2.Find(x => x.x == xPos2.Min()); var stIt = HeBingList2.Find(x => (x.i % colNum) * image_width + x.x == xPos2.Min());
var edIt = HeBingList2.Find(x => 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;
outList.Add(new DefectLabelInfo() outList.Add(new DefectLabelInfo()
@ -541,9 +584,54 @@ namespace LeatherApp.Device
j = stIt.j, j = stIt.j,
}); });
} }
//多个jt合并
if (HeBingList3.Count > 0)
{
var stIt = HeBingList3.Find(x => (x.i % colNum) * image_width + x.x == xPos3.Min());
var edIt = HeBingList3.Find(x => (x.i % colNum) * image_width + x.x == xPos3.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;
outList.Add(new DefectLabelInfo()
{
x = stIt.x,
y = edIt.y,
w = newW, //多图叠加
h = edIt.h,
classId = eZXD.classId,
confidence = eZXD.confidence,
contrast = eZXD.contrast,
cmH = Math.Round(edIt.h * 1.0 / Config.cm2px_y, 2),
cmW = Math.Round(newW * 1.0 / Config.cm2px_x, 2),
i = stIt.i,
j = stIt.j,
});
}
//多个tcy合并
if (HeBingList4.Count > 0)
{
var stIt = HeBingList4.Find(x => (x.i % colNum) * image_width + x.x == xPos4.Min());
var edIt = HeBingList4.Find(x => (x.i % colNum) * image_width + x.x == xPos4.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;
outList.Add(new DefectLabelInfo()
{
x = stIt.x,
y = edIt.y,
w = newW, //多图叠加
h = edIt.h,
classId = eZXD.classId,
confidence = eZXD.confidence,
contrast = eZXD.contrast,
cmH = Math.Round(edIt.h * 1.0 / Config.cm2px_y, 2),
cmW = Math.Round(newW * 1.0 / Config.cm2px_x, 2),
i = stIt.i,
j = stIt.j,
});
}
outList = outList.Concat(dg1).ToList<DefectLabelInfo>();//保留重复项 outList = outList.Concat(dg1).ToList<DefectLabelInfo>();//保留重复项
outList = outList.Concat(dg2).ToList<DefectLabelInfo>();//保留重复项 outList = outList.Concat(dg2).ToList<DefectLabelInfo>();//保留重复项
outList = outList.Concat(dg3).ToList<DefectLabelInfo>();//保留重复项
outList = outList.Concat(dg4).ToList<DefectLabelInfo>();//保留重复项
return outList; return outList;
} }
//打标 //打标
@ -554,7 +642,7 @@ namespace LeatherApp.Device
{ {
if (taskMakeTagList.Count < 1) if (taskMakeTagList.Count < 1)
{ {
Thread.Sleep(0); Thread.Sleep(20);
continue; continue;
} }
@ -806,16 +894,34 @@ namespace LeatherApp.Device
task.resultInfo += $" 判断为接头处横档,跳过! \n"; task.resultInfo += $" 判断为接头处横档,跳过! \n";
continue; continue;
} }
if (Config.getDefectCode(DefectLabelInfoListByClassID[q].classId) == "na")
{
task.resultInfo += $" 判断为正向标签na跳过 \n";
continue;
}
//WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low, $"判断是瑕疵类别ID:{classId} 置信度({confidence},[{qualifiedLimit.ZXD}]); isOr({qualifiedLimit.IsOR}); 面积({cmW * cmH},[{ qualifiedLimit.Area}]); 对比度({contrast},[{qualifiedLimit.ContrastLower}-{qualifiedLimit.ContrastTop}])"); //WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low, $"判断是瑕疵类别ID:{classId} 置信度({confidence},[{qualifiedLimit.ZXD}]); isOr({qualifiedLimit.IsOR}); 面积({cmW * cmH},[{ qualifiedLimit.Area}]); 对比度({contrast},[{qualifiedLimit.ContrastLower}-{qualifiedLimit.ContrastTop}])");
} }
} }
liStep++;//1 liStep++;//1
//打标 //打标
//计算打标框大小,进行调整
//int dw = 0;
//int dh = 0;
//if (DefectLabelInfoListByClassID[q].w / DefectLabelInfoListByClassID[q].h > 4)
//{
// dh = DefectLabelInfoListByClassID[q].w / 4;
//}
//if (DefectLabelInfoListByClassID[q].h / DefectLabelInfoListByClassID[q].w > 4)
//{
// dw = DefectLabelInfoListByClassID[q].h / 4;
//}
var point1 = new OpenCvSharp.Point((DefectLabelInfoListByClassID[q].i % colNum) * image_width + DefectLabelInfoListByClassID[q].x, (DefectLabelInfoListByClassID[q].i / colNum) * image_hight + DefectLabelInfoListByClassID[q].y); var point1 = new OpenCvSharp.Point((DefectLabelInfoListByClassID[q].i % colNum) * image_width + DefectLabelInfoListByClassID[q].x, (DefectLabelInfoListByClassID[q].i / colNum) * image_hight + DefectLabelInfoListByClassID[q].y);
var point2 = new OpenCvSharp.Point(point1.X + DefectLabelInfoListByClassID[q].w, point1.Y + DefectLabelInfoListByClassID[q].h); var point2 = new OpenCvSharp.Point(point1.X + DefectLabelInfoListByClassID[q].w, point1.Y + DefectLabelInfoListByClassID[q].h);
liStep++;//2 liStep++;//2
//task.resultInfo += $" 转换到大图坐标(px)p1={point1.X},{point1.Y}; p2={point2.X},{point2.Y}\n"; //task.resultInfo += $" 转换到大图坐标(px)p1={point1.X},{point1.Y}; p2={point2.X},{point2.Y}\n";
Cv2.Rectangle(task.bmpTag, point1, point2, new Scalar(0.0, 0.0, 255.0), 1);//画打标点 Cv2.Rectangle(task.bmpTag, point1, point2, new Scalar(0.0, 0.0, 255.0), 5);//画打标点
//WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low, $"保存第 {count} 行缺陷信息;"); //WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low, $"保存第 {count} 行缺陷信息;");
int px = (point1.X - task.xw) > 0 ? (point1.X - task.xw) : 0; int px = (point1.X - task.xw) > 0 ? (point1.X - task.xw) : 0;

View File

@ -118,7 +118,12 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<data name="textBox1.Text" xml:space="preserve"> <data name="textBox1.Text" xml:space="preserve">
<value>v1.0.2.9(2024-05-09) <value>v1.0.2.10(2024-06-25)
1、更新等比例缩放算法提速降内存
2、等级缺陷判断可以设置忽略项
v1.0.2.10(2024-06-18)
1、加入总和缺陷判定等级
v1.0.2.9(2024-05-09)
1、加入实时幅宽 1、加入实时幅宽
2、加入jietouhengdang标签合并 2、加入jietouhengdang标签合并
v1.0.2.8(2024-05-06) v1.0.2.8(2024-05-06)

View File

@ -171,6 +171,7 @@
</Reference> </Reference>
<Reference Include="System.Web" /> <Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" /> <Reference Include="System.Web.Extensions" />
<Reference Include="System.Windows.Forms.DataVisualization" />
<Reference Include="System.Xaml" /> <Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />

View File

@ -28,14 +28,14 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
this.uiPanel1 = new Sunny.UI.UIPanel(); this.uiPanel1 = new Sunny.UI.UIPanel();
this.lblLen = new Sunny.UI.UILabel(); this.lblLen = new Sunny.UI.UILabel();
this.lblSpeed = new Sunny.UI.UISymbolLabel(); this.lblSpeed = new Sunny.UI.UISymbolLabel();
@ -58,7 +58,6 @@
this.btnEnd = new Sunny.UI.UISymbolButton(); this.btnEnd = new Sunny.UI.UISymbolButton();
this.btnStart = new Sunny.UI.UISymbolButton(); this.btnStart = new Sunny.UI.UISymbolButton();
this.uiTitlePanel2 = new Sunny.UI.UITitlePanel(); this.uiTitlePanel2 = new Sunny.UI.UITitlePanel();
this.ucColorListDefect = new LeatherApp.UIExtend.UCColorList();
this.lineChartDefect = new Sunny.UI.UILineChart(); this.lineChartDefect = new Sunny.UI.UILineChart();
this.uiTitlePanel3 = new Sunny.UI.UITitlePanel(); this.uiTitlePanel3 = new Sunny.UI.UITitlePanel();
this.uiDataGridView1 = new Sunny.UI.UIDataGridView(); this.uiDataGridView1 = new Sunny.UI.UIDataGridView();
@ -81,7 +80,6 @@
this.lstboxLog = new Sunny.UI.UIListBox(); this.lstboxLog = new Sunny.UI.UIListBox();
this.uiTitlePanel6 = new Sunny.UI.UITitlePanel(); this.uiTitlePanel6 = new Sunny.UI.UITitlePanel();
this.uiPanel3 = new Sunny.UI.UIPanel(); this.uiPanel3 = new Sunny.UI.UIPanel();
this.picDefectImage = new LeatherApp.UIExtend.UCImageView();
this.pnlScannerImg = new Sunny.UI.UITitlePanel(); this.pnlScannerImg = new Sunny.UI.UITitlePanel();
this.picScanner2 = new System.Windows.Forms.PictureBox(); this.picScanner2 = new System.Windows.Forms.PictureBox();
this.picScanner1 = new System.Windows.Forms.PictureBox(); this.picScanner1 = new System.Windows.Forms.PictureBox();
@ -100,6 +98,8 @@
this.uiLabel8 = new Sunny.UI.UILabel(); this.uiLabel8 = new Sunny.UI.UILabel();
this.uiLabel7 = new Sunny.UI.UILabel(); this.uiLabel7 = new Sunny.UI.UILabel();
this.uiLabel6 = new Sunny.UI.UILabel(); this.uiLabel6 = new Sunny.UI.UILabel();
this.picDefectImage = new LeatherApp.UIExtend.UCImageView();
this.ucColorListDefect = new LeatherApp.UIExtend.UCColorList();
this.uiPanel1.SuspendLayout(); this.uiPanel1.SuspendLayout();
this.uiTitlePanel1.SuspendLayout(); this.uiTitlePanel1.SuspendLayout();
this.uiPanel2.SuspendLayout(); this.uiPanel2.SuspendLayout();
@ -633,29 +633,6 @@
this.uiTitlePanel2.TitleColor = System.Drawing.Color.White; this.uiTitlePanel2.TitleColor = System.Drawing.Color.White;
this.uiTitlePanel2.TitleForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138))))); this.uiTitlePanel2.TitleForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138)))));
// //
// ucColorListDefect
//
this.ucColorListDefect.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.ucColorListDefect.ColorChanged = null;
this.ucColorListDefect.FillColor = System.Drawing.Color.White;
this.ucColorListDefect.FillColor2 = System.Drawing.Color.White;
this.ucColorListDefect.FillDisableColor = System.Drawing.Color.White;
this.ucColorListDefect.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.ucColorListDefect.Location = new System.Drawing.Point(1, 38);
this.ucColorListDefect.MinimumSize = new System.Drawing.Size(1, 1);
this.ucColorListDefect.Name = "ucColorListDefect";
this.ucColorListDefect.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
this.ucColorListDefect.RectColor = System.Drawing.Color.White;
this.ucColorListDefect.RectDisableColor = System.Drawing.Color.White;
this.ucColorListDefect.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.Bottom;
this.ucColorListDefect.Size = new System.Drawing.Size(121, 42);
this.ucColorListDefect.Style = Sunny.UI.UIStyle.Custom;
this.ucColorListDefect.StyleCustomMode = true;
this.ucColorListDefect.TabIndex = 1;
this.ucColorListDefect.Text = "ucColorList1";
this.ucColorListDefect.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
//
// lineChartDefect // lineChartDefect
// //
this.lineChartDefect.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.lineChartDefect.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@ -705,21 +682,21 @@
// //
// uiDataGridView1 // uiDataGridView1
// //
dataGridViewCellStyle9.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(251)))), ((int)(((byte)(250))))); dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(251)))), ((int)(((byte)(250)))));
this.uiDataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle9; this.uiDataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
this.uiDataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.uiDataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.uiDataGridView1.BackgroundColor = System.Drawing.Color.White; this.uiDataGridView1.BackgroundColor = System.Drawing.Color.White;
this.uiDataGridView1.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single; this.uiDataGridView1.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle10.BackColor = System.Drawing.Color.Blue; dataGridViewCellStyle2.BackColor = System.Drawing.Color.Blue;
dataGridViewCellStyle10.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle10.ForeColor = System.Drawing.Color.White; dataGridViewCellStyle2.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle10.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138))))); dataGridViewCellStyle2.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138)))));
dataGridViewCellStyle10.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle10.WrapMode = System.Windows.Forms.DataGridViewTriState.True; dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.uiDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle10; this.uiDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
this.uiDataGridView1.ColumnHeadersHeight = 32; this.uiDataGridView1.ColumnHeadersHeight = 32;
this.uiDataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.uiDataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
this.uiDataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.uiDataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
@ -734,14 +711,14 @@
this.colArea, this.colArea,
this.colZXD, this.colZXD,
this.colTarget}); this.colTarget});
dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle14.BackColor = System.Drawing.Color.White; dataGridViewCellStyle6.BackColor = System.Drawing.Color.White;
dataGridViewCellStyle14.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle6.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle14.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); dataGridViewCellStyle6.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle14.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(242)))), ((int)(((byte)(238))))); dataGridViewCellStyle6.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(242)))), ((int)(((byte)(238)))));
dataGridViewCellStyle14.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); dataGridViewCellStyle6.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.False; dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.uiDataGridView1.DefaultCellStyle = dataGridViewCellStyle14; this.uiDataGridView1.DefaultCellStyle = dataGridViewCellStyle6;
this.uiDataGridView1.EnableHeadersVisualStyles = false; this.uiDataGridView1.EnableHeadersVisualStyles = false;
this.uiDataGridView1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.uiDataGridView1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiDataGridView1.GridColor = System.Drawing.Color.CornflowerBlue; this.uiDataGridView1.GridColor = System.Drawing.Color.CornflowerBlue;
@ -749,21 +726,21 @@
this.uiDataGridView1.MultiSelect = false; this.uiDataGridView1.MultiSelect = false;
this.uiDataGridView1.Name = "uiDataGridView1"; this.uiDataGridView1.Name = "uiDataGridView1";
this.uiDataGridView1.RectColor = System.Drawing.Color.DodgerBlue; this.uiDataGridView1.RectColor = System.Drawing.Color.DodgerBlue;
dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle15.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(251)))), ((int)(((byte)(250))))); dataGridViewCellStyle7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(251)))), ((int)(((byte)(250)))));
dataGridViewCellStyle15.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle7.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle15.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); dataGridViewCellStyle7.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
dataGridViewCellStyle15.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138))))); dataGridViewCellStyle7.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138)))));
dataGridViewCellStyle15.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); dataGridViewCellStyle7.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
dataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.True; dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.uiDataGridView1.RowHeadersDefaultCellStyle = dataGridViewCellStyle15; this.uiDataGridView1.RowHeadersDefaultCellStyle = dataGridViewCellStyle7;
this.uiDataGridView1.RowHeadersWidth = 62; this.uiDataGridView1.RowHeadersWidth = 62;
dataGridViewCellStyle16.BackColor = System.Drawing.Color.White; dataGridViewCellStyle8.BackColor = System.Drawing.Color.White;
dataGridViewCellStyle16.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle8.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle16.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); dataGridViewCellStyle8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
dataGridViewCellStyle16.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(242)))), ((int)(((byte)(238))))); dataGridViewCellStyle8.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(242)))), ((int)(((byte)(238)))));
dataGridViewCellStyle16.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); dataGridViewCellStyle8.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
this.uiDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle16; this.uiDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle8;
this.uiDataGridView1.RowTemplate.Height = 30; this.uiDataGridView1.RowTemplate.Height = 30;
this.uiDataGridView1.ScrollBarBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(251)))), ((int)(((byte)(250))))); this.uiDataGridView1.ScrollBarBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(251)))), ((int)(((byte)(250)))));
this.uiDataGridView1.ScrollBarColor = System.Drawing.Color.DodgerBlue; this.uiDataGridView1.ScrollBarColor = System.Drawing.Color.DodgerBlue;
@ -814,9 +791,9 @@
// colX // colX
// //
this.colX.DataPropertyName = "X"; this.colX.DataPropertyName = "X";
dataGridViewCellStyle11.Format = "N1"; dataGridViewCellStyle3.Format = "N1";
dataGridViewCellStyle11.NullValue = null; dataGridViewCellStyle3.NullValue = null;
this.colX.DefaultCellStyle = dataGridViewCellStyle11; this.colX.DefaultCellStyle = dataGridViewCellStyle3;
this.colX.HeaderText = "X(cm)"; this.colX.HeaderText = "X(cm)";
this.colX.MinimumWidth = 8; this.colX.MinimumWidth = 8;
this.colX.Name = "colX"; this.colX.Name = "colX";
@ -826,9 +803,9 @@
// colY // colY
// //
this.colY.DataPropertyName = "Y"; this.colY.DataPropertyName = "Y";
dataGridViewCellStyle12.Format = "N2"; dataGridViewCellStyle4.Format = "N2";
dataGridViewCellStyle12.NullValue = null; dataGridViewCellStyle4.NullValue = null;
this.colY.DefaultCellStyle = dataGridViewCellStyle12; this.colY.DefaultCellStyle = dataGridViewCellStyle4;
this.colY.HeaderText = "Y(米)"; this.colY.HeaderText = "Y(米)";
this.colY.MinimumWidth = 8; this.colY.MinimumWidth = 8;
this.colY.Name = "colY"; this.colY.Name = "colY";
@ -851,9 +828,9 @@
// //
// colArea // colArea
// //
dataGridViewCellStyle13.Format = "N2"; dataGridViewCellStyle5.Format = "N2";
dataGridViewCellStyle13.NullValue = null; dataGridViewCellStyle5.NullValue = null;
this.colArea.DefaultCellStyle = dataGridViewCellStyle13; this.colArea.DefaultCellStyle = dataGridViewCellStyle5;
this.colArea.HeaderText = "面积(mm²)"; this.colArea.HeaderText = "面积(mm²)";
this.colArea.MinimumWidth = 8; this.colArea.MinimumWidth = 8;
this.colArea.Name = "colArea"; this.colArea.Name = "colArea";
@ -1062,15 +1039,6 @@
this.uiPanel3.Text = null; this.uiPanel3.Text = null;
this.uiPanel3.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter; this.uiPanel3.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
// //
// picDefectImage
//
this.picDefectImage.Dock = System.Windows.Forms.DockStyle.Fill;
this.picDefectImage.Location = new System.Drawing.Point(0, 0);
this.picDefectImage.Margin = new System.Windows.Forms.Padding(0);
this.picDefectImage.Name = "picDefectImage";
this.picDefectImage.Size = new System.Drawing.Size(350, 226);
this.picDefectImage.TabIndex = 1;
//
// pnlScannerImg // pnlScannerImg
// //
this.pnlScannerImg.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.pnlScannerImg.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@ -1359,6 +1327,38 @@
this.uiLabel6.Text = "光源"; this.uiLabel6.Text = "光源";
this.uiLabel6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.uiLabel6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
// //
// picDefectImage
//
this.picDefectImage.Dock = System.Windows.Forms.DockStyle.Fill;
this.picDefectImage.Location = new System.Drawing.Point(0, 0);
this.picDefectImage.Margin = new System.Windows.Forms.Padding(0);
this.picDefectImage.Name = "picDefectImage";
this.picDefectImage.Size = new System.Drawing.Size(350, 226);
this.picDefectImage.TabIndex = 1;
//
// ucColorListDefect
//
this.ucColorListDefect.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.ucColorListDefect.ColorChanged = null;
this.ucColorListDefect.FillColor = System.Drawing.Color.White;
this.ucColorListDefect.FillColor2 = System.Drawing.Color.White;
this.ucColorListDefect.FillDisableColor = System.Drawing.Color.White;
this.ucColorListDefect.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.ucColorListDefect.Location = new System.Drawing.Point(1, 38);
this.ucColorListDefect.MinimumSize = new System.Drawing.Size(1, 1);
this.ucColorListDefect.Name = "ucColorListDefect";
this.ucColorListDefect.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
this.ucColorListDefect.RectColor = System.Drawing.Color.White;
this.ucColorListDefect.RectDisableColor = System.Drawing.Color.White;
this.ucColorListDefect.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.Bottom;
this.ucColorListDefect.Size = new System.Drawing.Size(121, 42);
this.ucColorListDefect.Style = Sunny.UI.UIStyle.Custom;
this.ucColorListDefect.StyleCustomMode = true;
this.ucColorListDefect.TabIndex = 1;
this.ucColorListDefect.Text = "ucColorList1";
this.ucColorListDefect.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
//
// FHome // FHome
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@ -1382,6 +1382,8 @@
this.StyleCustomMode = true; this.StyleCustomMode = true;
this.Load += new System.EventHandler(this.FHome_Load); this.Load += new System.EventHandler(this.FHome_Load);
this.Shown += new System.EventHandler(this.FHome_Shown); this.Shown += new System.EventHandler(this.FHome_Shown);
this.Paint += new System.Windows.Forms.PaintEventHandler(this.FHome_Paint);
this.Resize += new System.EventHandler(this.FHome_Resize);
this.uiPanel1.ResumeLayout(false); this.uiPanel1.ResumeLayout(false);
this.uiTitlePanel1.ResumeLayout(false); this.uiTitlePanel1.ResumeLayout(false);
this.uiTitlePanel1.PerformLayout(); this.uiTitlePanel1.PerformLayout();

View File

@ -1,5 +1,4 @@
 using IKapC.NET;
using IKapC.NET;
using LeatherApp.Device; using LeatherApp.Device;
using LeatherApp.Device.CamerUtil; using LeatherApp.Device.CamerUtil;
using LeatherApp.Interface; using LeatherApp.Interface;
@ -27,6 +26,8 @@ using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;
using static System.Windows.Forms.AxHost;
namespace LeatherApp.Page namespace LeatherApp.Page
{ {
@ -54,9 +55,15 @@ namespace LeatherApp.Page
//无产品编码时加载 //无产品编码时加载
FProductInfo frmProduct; FProductInfo frmProduct;
private double ThnDieLen = 0;
private Dictionary<int, Mat> defectTag = new Dictionary<int, Mat> ();
//云端 //云端
private CloudMgr cloudMgr = new CloudMgr(); private CloudMgr cloudMgr = new CloudMgr();
private bool init_Cloud; private bool init_Cloud;
//裁切偏移
private double OffsetCut = 0.2;
public FHome(FProductInfo frm) public FHome(FProductInfo frm)
{ {
InitializeComponent(); InitializeComponent();
@ -262,7 +269,7 @@ namespace LeatherApp.Page
/// <param name="lstDefectInfo">Records.DefectInfoList</param> /// <param name="lstDefectInfo">Records.DefectInfoList</param>
/// <param name="XSizeRange">幅宽</param> /// <param name="XSizeRange">幅宽</param>
/// <param name="YSizeRange">卷长度</param> /// <param name="YSizeRange">卷长度</param>
private void reDrawDefectPoints(List<DefectInfo> lstDefectInfo, double[] XSizeRange=null, double[] YSizeRange=null,bool addSelRect=true) private void reDrawDefectPoints(List<DefectInfo> lstDefectInfo, List<GradeDifferentiateInfo> listGrade, double[] XSizeRange=null, double[] YSizeRange=null,bool addSelRect=true)
{ {
UILineOption option; UILineOption option;
//AddTextEvent(DateTime.Now,$"绘图", $"缺陷分布, W={string.Join(", ", XSizeRange)},H={string.Join(", ", YSizeRange)}, LastData={JsonConvert.SerializeObject(lstDefectInfo[lstDefectInfo.Count - 1])}"); //AddTextEvent(DateTime.Now,$"绘图", $"缺陷分布, W={string.Join(", ", XSizeRange)},H={string.Join(", ", YSizeRange)}, LastData={JsonConvert.SerializeObject(lstDefectInfo[lstDefectInfo.Count - 1])}");
@ -352,7 +359,19 @@ namespace LeatherApp.Page
series.YAxisDecimalPlaces = 2; series.YAxisDecimalPlaces = 2;
//series.Add(1, 1); //series.Add(1, 1);
} }
if (listGrade != null)
{
//option = lineChartDefect.Option;
foreach (var item in listGrade)
{
// 设置裁切提示线
option.YAxisScaleLines.Add(new UIScaleLine() { Color = Color.DarkRed, Name = $"{item.GradeCode}-裁切起点-{item.StartY}", Value = item.StartY });
option.YAxisScaleLines.Add(new UIScaleLine() { Color = Color.DarkRed, Name = $"{item.GradeCode}-裁切终点-{item.EndY}", Value = item.EndY });
}
}
//==== //====
//option.GreaterWarningArea = new UILineWarningArea(3.5); //option.GreaterWarningArea = new UILineWarningArea(3.5);
//option.LessWarningArea = new UILineWarningArea(2.2, Color.Gold); //option.LessWarningArea = new UILineWarningArea(2.2, Color.Gold);
@ -363,6 +382,31 @@ namespace LeatherApp.Page
})); }));
} }
/// <summary>
/// 重新生成缺陷分布(cm2M在内部转换) 加入裁切位置
/// </summary>
/// <param name="lstDefectInfo"></param>
/// <param name="XSizeRange"></param>
/// <param name="YSizeRange"></param>
/// <param name="addSelRect"></param>
private void reDrawDefectPointsAndCut(double startY, double endY, string code)
{
if (lineChartDefect.Option != null )
{
UILineOption option;
option = lineChartDefect.Option;
// 设置裁切提示线
option.YAxisScaleLines.Add(new UIScaleLine() { Color = Color.DarkRed, Name = $"{code}-裁切起点-{startY}", Value = startY });
option.YAxisScaleLines.Add(new UIScaleLine() { Color = Color.DarkRed, Name = $"{code}-裁切终点-{endY}", Value = endY });
this.BeginInvoke(new System.Action(() =>
{
this.lineChartDefect.SetOption(option);
//series.UpdateYData();//按序号更新Y轴值(可设置值超出范围用于闪烁)
}));
}
}
/// <summary> /// <summary>
/// 重新门幅宽度 /// 重新门幅宽度
/// </summary> /// </summary>
@ -439,8 +483,8 @@ namespace LeatherApp.Page
})); }));
} }
private delegate void AddTextDelegate(DateTime time,string tag, string msg, WarningEnum level); private delegate void AddTextDelegate(DateTime time,string tag, string msg, WarningEnum level, bool Show);
private void AddTextEvent(DateTime now, string tag, string msg, WarningEnum level = WarningEnum.Normal) private void AddTextEvent(DateTime now, string tag, string msg, WarningEnum level = WarningEnum.Normal, bool Show = true)
{ {
try try
{ {
@ -451,7 +495,8 @@ namespace LeatherApp.Page
now, now,
tag, tag,
msg, msg,
level level,
Show
}); });
} }
else else
@ -471,12 +516,15 @@ namespace LeatherApp.Page
// cont = $"<color=\"{(type == 1 ? "Yellow" : "Red")}\">{cont}</color>"; // cont = $"<color=\"{(type == 1 ? "Yellow" : "Red")}\">{cont}</color>";
//msg = (level == WarningEnum.Normal ? "B" : level == WarningEnum.Low ? "Y" : "R") + msg; //msg = (level == WarningEnum.Normal ? "B" : level == WarningEnum.Low ? "Y" : "R") + msg;
msg = (level == WarningEnum.Normal ? "" : level == WarningEnum.Low ? "Y" : "R") + msg; if (Show)
//this.Invoke(new System.Action(() => {
//{ msg = (level == WarningEnum.Normal ? "" : level == WarningEnum.Low ? "Y" : "R") + msg;
//this.Invoke(new System.Action(() =>
//{
if (this.lstboxLog.Items.Count > 1000) if (this.lstboxLog.Items.Count > 1000)
this.lstboxLog.Items.Clear(); this.lstboxLog.Items.Clear();
lstboxLog.Items.Insert(0, msg); lstboxLog.Items.Insert(0, msg);
}
//})); //}));
//日志滚动 //日志滚动
//lstLog.SelectedIndex = lstLog.Items.Count - 1; //lstLog.SelectedIndex = lstLog.Items.Count - 1;
@ -538,6 +586,31 @@ namespace LeatherApp.Page
else else
AddTextEvent(DateTime.Now, "云端数据", "云端连接失败!", WarningEnum.Low); AddTextEvent(DateTime.Now, "云端数据", "云端连接失败!", WarningEnum.Low);
} }
////标记裁切位置
//this.BeginInvoke(new System.Action(() =>
//{
// List<DefectInfo> list = new List<DefectInfo>();
// list.Add(new DefectInfo()
// {
// X = 1,
// Y = 100,
// Width = 1,
// Height = 1,
// Code = "jiangbban"
// });
// list.Add(new DefectInfo()
// {
// X = 10,
// Y = 10000,
// Width = 1,
// Height = 1,
// Code = "jiangbban"
// });
// reDrawDefectPoints(list, new double[2] { 0, 160 });
// reDrawDefectPointsAndCut(10, 20);
//}));
} }
private void FHome_Shown(object sender, EventArgs e) private void FHome_Shown(object sender, EventArgs e)
{ {
@ -675,12 +748,26 @@ namespace LeatherApp.Page
errCode = 2; errCode = 2;
//加载新产品 //加载新产品
string pcode = "1-" + codes[2]; string pcode = "1-" + codes[2];
if (codes[1] == "0" || Config.SuedeList.Contains(codes[1])) if (codes[1] == "0" || Config.SuedeList1.Contains(codes[1]))
pcode = "0-" + codes[2]; pcode = "0-" + codes[2];
#if false
else else
#if false
pcode = codes[1] + "-" + codes[2]; pcode = codes[1] + "-" + codes[2];
#elif HX_LOD
else
pcode = "1-" + codes[2];
#else #else
else if (codes[1] == "1" || Config.SuedeList2.Contains(codes[1]))
pcode = "1-" + codes[2];
else if (codes[1] == "2" || Config.SuedeList3.Contains(codes[1]))
pcode = "2-" + codes[2];
else if (codes[1] == "3" || Config.SuedeList4.Contains(codes[1]))
pcode = "3-" + codes[2];
else if (codes[1] == "4" || Config.SuedeList5.Contains(codes[1]))
pcode = "4-" + codes[2];
else if (codes[1] == "5" || Config.SuedeList6.Contains(codes[1]))
pcode = "5-" + codes[2];
else
pcode = "1-" + codes[2]; pcode = "1-" + codes[2];
#endif #endif
@ -834,7 +921,7 @@ namespace LeatherApp.Page
}; };
devContainer.WarningEvent = (now,level, msg) => devContainer.WarningEvent = (now,level, msg) =>
{ {
AddTextEvent(DateTime.Now,$"设备事件{Thread.CurrentThread.ManagedThreadId}", msg, level); AddTextEvent(DateTime.Now,$"设备事件{Thread.CurrentThread.ManagedThreadId}", msg, level, false);
if (level == WarningEnum.High) if (level == WarningEnum.High)
Task.Run(() => warning(level, true)); Task.Run(() => warning(level, true));
}; };
@ -936,7 +1023,7 @@ namespace LeatherApp.Page
{ {
if (Config.Camer_Name == CamerDevNameEnum.) if (Config.Camer_Name == CamerDevNameEnum.)
{ {
AddTextEvent(DateTime.Now, $"拍照{Thread.CurrentThread.ManagedThreadId}", $"采集卡({devIndex}),图像({num})"); AddTextEvent(DateTime.Now, $"拍照{Thread.CurrentThread.ManagedThreadId}", $"采集卡({devIndex}),图像({num})", WarningEnum.Low, false);
Cv2.Flip(matone, matone, FlipMode.XY);//翻转 Cv2.Flip(matone, matone, FlipMode.XY);//翻转
Bitmap bitmap = BitmapConverter.ToBitmap(matone); Bitmap bitmap = BitmapConverter.ToBitmap(matone);
this.BeginInvoke(new Action(() => this.BeginInvoke(new Action(() =>
@ -980,7 +1067,7 @@ namespace LeatherApp.Page
Records curRecord = Hashtable.Synchronized(htTask)[currKey] as Records; Records curRecord = Hashtable.Synchronized(htTask)[currKey] as Records;
Device.PhotoLib.PhotoTask task; Device.PhotoLib.PhotoTask task;
Mat myMat = matone;//.Clone(); Mat myMat = matone;//.Clone();
AddTextEvent(DateTime.Now, $"拍照{Thread.CurrentThread.ManagedThreadId}", $"(图像{num})-采集卡({devIndex}),size:({myMat.Width}*{myMat.Height})({(myMat == null ? "A" : "B")})"); AddTextEvent(DateTime.Now, $"拍照{Thread.CurrentThread.ManagedThreadId}", $"(图像{num})-采集卡({devIndex}),size:({myMat.Width}*{myMat.Height})({(myMat == null ? "A" : "B")})", WarningEnum.Low, false);
//AddTextEvent(DateTime.Now,"拍照", $"Dev={devIndex},图像{num}-2"); //AddTextEvent(DateTime.Now,"拍照", $"Dev={devIndex},图像{num}-2");
lock (lockScanPhoto)//多线程操作 lock (lockScanPhoto)//多线程操作
{ {
@ -1056,19 +1143,43 @@ namespace LeatherApp.Page
//warning(WarningEnum.Low, true);//暂停 //warning(WarningEnum.Low, true);//暂停
} }
errStep = 6; errStep = 6;
//厚度检测提示
if (curRecord.ProductInfo.OpenThicknessDetection)
{
if ((curRecord.Len - ThnDieLen) > curRecord.ProductInfo.ThicknessDetectionStopDis)
{
ThnDieLen = curRecord.Len;
AddTextEvent(DateTime.Now, $"厚度检测{Thread.CurrentThread.ManagedThreadId}", $"位置:{curRecord.Len}; 上次位置:{ThnDieLen}");
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);
});
}
}
}
// //
AddTextEvent(DateTime.Now, $"拍照{Thread.CurrentThread.ManagedThreadId}", $"待处理图像队列:{curRecord.ScannerPhotoCount - curRecord.ScannerPhotoFinishCount}张"); AddTextEvent(DateTime.Now, $"拍照{Thread.CurrentThread.ManagedThreadId}", $"待处理图像队列:{curRecord.ScannerPhotoCount - curRecord.ScannerPhotoFinishCount}张", WarningEnum.Low, false);
if (task.scanPhotos0 != null && task.scanPhotos1 != null) if (task.scanPhotos0 != null && task.scanPhotos1 != null)
{ {
var scanPhoto = task.scanPhotos0 as ScanPhotoInfo; var scanPhoto = task.scanPhotos0 as ScanPhotoInfo;
curRecord.dicPhoto_Defect.TryAdd(scanPhoto.photoIndex, false);//加入索引,默认无瑕疵 curRecord.dicPhoto_Defect.TryAdd(scanPhoto.photoIndex, false);//加入索引,默认无瑕疵
AddTextEvent(DateTime.Now, $"拍照{Thread.CurrentThread.ManagedThreadId}", $"图像索引:{scanPhoto.photoIndex},标识数:{curRecord.dicPhoto_Defect.Count}"); AddTextEvent(DateTime.Now, $"拍照{Thread.CurrentThread.ManagedThreadId}", $"图像索引:{scanPhoto.photoIndex},标识数:{curRecord.dicPhoto_Defect.Count}", WarningEnum.Low, false);
errStep = 7; errStep = 7;
//暂停:瑕疵二次判断 //暂停:瑕疵二次判断
if (this.defectPauseForUser) if (this.defectPauseForUser)
{ {
int liPhotoIndex = scanPhoto.photoIndex - Config.defectPauseSkipPhotoCount; int liPhotoIndex = scanPhoto.photoIndex - Config.defectPauseSkipPhotoCount;
AddTextEvent(DateTime.Now, $"拍照{Thread.CurrentThread.ManagedThreadId}", $"Dev={devIndex},图像{scanPhoto.photoIndex} {liPhotoIndex}={scanPhoto.photoIndex}-{Config.defectPauseSkipPhotoCount}{JsonConvert.SerializeObject(curRecord.dicPhoto_Defect)}"); AddTextEvent(DateTime.Now, $"拍照{Thread.CurrentThread.ManagedThreadId}", $"Dev={devIndex},图像{scanPhoto.photoIndex} {liPhotoIndex}={scanPhoto.photoIndex}-{Config.defectPauseSkipPhotoCount}{JsonConvert.SerializeObject(curRecord.dicPhoto_Defect)}", WarningEnum.Low, false);
if (liPhotoIndex >= 0 && curRecord.dicPhoto_Defect[liPhotoIndex]) if (liPhotoIndex >= 0 && curRecord.dicPhoto_Defect[liPhotoIndex])
{ {
List<DefectInfo> lstEditDefect = curRecord.DefectInfoList.Where(m => m.PhotoIndex == liPhotoIndex).ToList(); List<DefectInfo> lstEditDefect = curRecord.DefectInfoList.Where(m => m.PhotoIndex == liPhotoIndex).ToList();
@ -1096,9 +1207,10 @@ namespace LeatherApp.Page
this.BeginInvoke(new System.Action(() => this.BeginInvoke(new System.Action(() =>
{ {
int liDefectCount = lstEditDefect.Count; int liDefectCount = lstEditDefect.Count;
FHome_Defect frmDefect = new FHome_Defect(lstEditDefect); FHome_Defect frmDefect = new FHome_Defect(lstEditDefect, defectTag[liPhotoIndex]);
if (frmDefect.ShowDialog() == DialogResult.OK) if (frmDefect.ShowDialog() == DialogResult.OK)
{ {
defectTag.Remove(liPhotoIndex);
string oldCode; string oldCode;
for (int i = 0; i < this.uiDataGridView1.Rows.Count; i++) for (int i = 0; i < this.uiDataGridView1.Rows.Count; i++)
{ {
@ -1108,7 +1220,7 @@ namespace LeatherApp.Page
long uid = (long)this.uiDataGridView1.Rows[i].Cells["colUid"].Value; long uid = (long)this.uiDataGridView1.Rows[i].Cells["colUid"].Value;
foreach (var row in lstEditDefect) foreach (var row in lstEditDefect)
{ {
AddTextEvent(DateTime.Now, $"暂停{Thread.CurrentThread.ManagedThreadId}", $"修改第({i + 1})行瑕疵名称,{uid} {row.uid}"); AddTextEvent(DateTime.Now, $"暂停{Thread.CurrentThread.ManagedThreadId}", $"修改第({i + 1})行瑕疵名称,{uid} {row.uid}", WarningEnum.Low, false);
if (row.uid == uid) if (row.uid == uid)
{ {
oldCode = this.uiDataGridView1.Rows[i].Cells["colCode"].Value.ToString(); oldCode = this.uiDataGridView1.Rows[i].Cells["colCode"].Value.ToString();
@ -1146,7 +1258,7 @@ namespace LeatherApp.Page
this.uiMiniPagination1.TotalCount = curRecord.DefectTotalCount = curRecord.DefectInfoList.Count; this.uiMiniPagination1.TotalCount = curRecord.DefectTotalCount = curRecord.DefectInfoList.Count;
// //
//double len = Math.Round((res.photoIndex + 1) * bmpHeight * 1.0d / Config.cm2px_y + 0.005f, 2); //double len = Math.Round((res.photoIndex + 1) * bmpHeight * 1.0d / Config.cm2px_y + 0.005f, 2);
this.reDrawDefectPoints(curRecord.DefectInfoList); this.reDrawDefectPoints(curRecord.DefectInfoList, curRecord.GradeDifferentiateInfoList);
errStep = 9; errStep = 9;
//自动继续运行设备(这里临时暂停后不能再急停,否则无法继续) //自动继续运行设备(这里临时暂停后不能再急停,否则无法继续)
if (!Config.StopPLC) if (!Config.StopPLC)
@ -1170,11 +1282,186 @@ namespace LeatherApp.Page
} }
} }
errStep = 10; errStep = 10;
//以下判定放置于二次判定之后,因为二次判定可能会忽略部分检测项!!
//暂停:缺陷超标
//每百米告警判断???在此还是在收到新照片时触发???
if (curRecord.ProductInfo.DefectCountLimit > 0 && curRecord.DefectTotalCount >= curRecord.ProductInfo.DefectCountLimit && curRecord.DefectInfoList != null)
{
int liPhotoIndex = scanPhoto.photoIndex - Config.defectPauseSkipPhotoCount; //二次判定完的图片index
int compLen = 100 * 100;//每百米 to cm
int compCount = compLen * Config.cm2px_y / scanPhoto.mat.Height; //100m图像张数
//从上次告警后重新开始计算长度及数量
int defectCount = curRecord.DefectInfoList.Where(m => m.PhotoIndex >= curRecord.preWarningPhotoIndex && m.PhotoIndex >= (liPhotoIndex + 1 - compCount) && m.PhotoIndex <= liPhotoIndex).Count();
if (defectCount >= curRecord.ProductInfo.DefectCountLimit)
{
curRecord.preWarningPhotoIndex = liPhotoIndex + 1;
AddTextEvent(DateTime.Now, $"告警{Thread.CurrentThread.ManagedThreadId}", $"每百米瑕疵数量达到阈值!({defectCount}>={curRecord.ProductInfo.DefectCountLimit})", WarningEnum.High);
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);
});
}
}
errStep = 11;
}
//暂停:每个缺陷项不同长度检测数量报警
if (curRecord.DefectTotalCount > 0 && curRecord.DefectInfoList != null)
{
#if true
//按缺陷计算没X米多少缺陷报警
for (int i = 0; i < curRecord.ProductInfo.QualifiedLimitList.Count; i++)
{
var defectWarn = curRecord.ProductInfo.QualifiedLimitList[i];
if (defectWarn.DefectWarnLength > 0 || defectWarn.DefectWarnCnt > 0)
{
errStep = 12;
int liPhotoIndex = scanPhoto.photoIndex - Config.defectPauseSkipPhotoCount; //二次判定完的图片index
int warnLen = defectWarn.DefectWarnLength * 100;//每米 to cm
int warnCount = warnLen * Config.cm2px_y / scanPhoto.mat.Height; //计算图像张数
//从上次告警后重新开始计算长度及数量
int warnDefectCount = curRecord.DefectInfoList.Where(m => m.PhotoIndex >= curRecord.preWarningPhotoIndexByLabel[i] && m.PhotoIndex >= (liPhotoIndex + 1 - warnCount) && m.PhotoIndex <= liPhotoIndex).Count();
if (warnDefectCount >= defectWarn.DefectWarnCnt)
{
curRecord.preWarningPhotoIndexByLabel[i] = liPhotoIndex + 1;
AddTextEvent(DateTime.Now, $"告警{Thread.CurrentThread.ManagedThreadId}", $"每{defectWarn.DefectWarnLength}米{Config.getDefectName(defectWarn.Code)}瑕疵数量达到阈值!({warnDefectCount}>={defectWarn.DefectWarnCnt})", WarningEnum.High);
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);
});
}
}
}
}
#endif
}
//暂停:按等级分卷
if (curRecord.DefectTotalCount > 0 && curRecord.ProductInfo.GradeLimitList != null && curRecord.ProductInfo.GradeLimitList.Count > 0 && curRecord.DefectInfoList != null)
{
errStep = 13;
//按缺陷计算每X米多少缺陷分等级
for (int i = 0; i < curRecord.ProductInfo.GradeLimitList.Count; i++)
{
if (curRecord.ProductInfo.GradeLimitList[i].JudgeLength > 0 )
{
errStep = 14;
int liPhotoIndex = scanPhoto.photoIndex - Config.defectPauseSkipPhotoCount; //二次判定完的图片index
double GrageLen = curRecord.ProductInfo.GradeLimitList[i].JudgeLength * 100;//每米 to cm
int warnCount =(int)(GrageLen * Config.cm2px_y) / scanPhoto.mat.Height; //计算图像张数
if (curRecord.GradeDifferentiateInfoList == null)
{
curRecord.GradeDifferentiateInfoList = new List<GradeDifferentiateInfo>();
}
GradeLimit item = curRecord.ProductInfo.GradeLimitList[i];
GradeDifferentiateInfo differentiateInfo = new GradeDifferentiateInfo();
//从上次告警后重新开始计算长度及数量
var allFind = curRecord.DefectInfoList.Where(m => m.PhotoIndex >= curRecord.preGradePhotoIndexByGradeIndex && m.PhotoIndex >= (liPhotoIndex + 1 - warnCount) && m.PhotoIndex <= liPhotoIndex).ToList();
int warnDefectCount = 0;
if(item.Code == "All")
warnDefectCount = allFind.Count();
else
{
warnDefectCount = allFind.Where(m => m.Code == item.Code).Count();
}
int GradeCount = 0;
if(item.E >0 && warnDefectCount > item.E)
{
GradeCount = item.E;
differentiateInfo.GradeCode = "E";
}
else if (item.D > 0 && warnDefectCount > item.D)
{
GradeCount = item.D;
differentiateInfo.GradeCode = "D";
}
else if (item.C > 0 && warnDefectCount > item.C)
{
GradeCount = item.C;
differentiateInfo.GradeCode = "C";
}
else if (item.B > 0 && warnDefectCount > item.B)
{
GradeCount = item.B;
differentiateInfo.GradeCode = "B";
}
else if (item.A > 0 && warnDefectCount > item.A)
{
GradeCount = item.A;
differentiateInfo.GradeCode = "A";
}
else
{
//不需要分级,下一条
continue;
}
differentiateInfo.UseGradeLimit = item;
differentiateInfo.DefectCnt = warnDefectCount;
differentiateInfo.StartPhotoIndex = allFind.Min(x=>x.PhotoIndex);
differentiateInfo.EndPhotoIndex = allFind.Max(x => x.PhotoIndex);
differentiateInfo.StartY = allFind.Min(x=>x.CentreY) / 100 - OffsetCut;
differentiateInfo.EndY = allFind.Max(x => x.CentreY) / 100 + OffsetCut;
differentiateInfo.CutLen = differentiateInfo.EndY - differentiateInfo.StartY;
//记录新的判定开始位置
curRecord.preGradePhotoIndexByGradeIndex = liPhotoIndex + 1;
AddTextEvent(DateTime.Now, $"提示{Thread.CurrentThread.ManagedThreadId}", $"每{curRecord.ProductInfo.GradeLimitList[i].JudgeLength}米,瑕疵数量达到分级阈值!({warnDefectCount}>={GradeCount})", WarningEnum.Low);
curRecord.GradeDifferentiateInfoList.Add(differentiateInfo);
//标记裁切位置
this.BeginInvoke(new System.Action(() =>
{
reDrawDefectPointsAndCut(differentiateInfo.StartY, differentiateInfo.EndY, differentiateInfo.GradeCode);
}));
//裁切暂停提示
if (curRecord.ProductInfo.IsHintCutting)
{
AddTextEvent(DateTime.Now, $"提示", $"裁切 起始{differentiateInfo.StartY}-终点{differentiateInfo.EndY}", WarningEnum.Low);
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);
});
}
}
}
}
}
task.record = curRecord; task.record = curRecord;
task.finishEvent = callBackPhotoEvent; task.finishEvent = callBackPhotoEvent;
devContainer.libPhoto.add(task); devContainer.libPhoto.add(task);
AddTextEvent(DateTime.Now, $"拍照{Thread.CurrentThread.ManagedThreadId}", $"Dev={devIndex},图像{scanPhoto.photoIndex},已加入图像处理队列"); AddTextEvent(DateTime.Now, $"拍照{Thread.CurrentThread.ManagedThreadId}", $"Dev={devIndex},图像{scanPhoto.photoIndex},已加入图像处理队列", WarningEnum.Low, false);
errStep = 11; errStep = 21;
Application.DoEvents(); Application.DoEvents();
} }
} }
@ -1191,7 +1478,7 @@ namespace LeatherApp.Page
ScanPhotoInfo scanPhotos1 = task.scanPhotos1 as ScanPhotoInfo; ScanPhotoInfo scanPhotos1 = task.scanPhotos1 as ScanPhotoInfo;
Stopwatch stopWatch = new Stopwatch(); Stopwatch stopWatch = new Stopwatch();
AddTextEvent(DateTime.Now,$"图像处理{Thread.CurrentThread.ManagedThreadId}", $"图像{scanPhotos0.photoIndex}ThreadId={Thread.CurrentThread.ManagedThreadId}"); AddTextEvent(DateTime.Now,$"图像处理{Thread.CurrentThread.ManagedThreadId}", $"图像{scanPhotos0.photoIndex}ThreadId={Thread.CurrentThread.ManagedThreadId}", WarningEnum.Low, false);
string time = ""; string time = "";
stopWatch.Start(); stopWatch.Start();
try try
@ -1245,7 +1532,7 @@ namespace LeatherApp.Page
} }
AddTextEvent(DateTime.Now,$"裁边{Thread.CurrentThread.ManagedThreadId}", AddTextEvent(DateTime.Now,$"裁边{Thread.CurrentThread.ManagedThreadId}",
$"(图像{scanPhotos0.photoIndex})-左图去重后:{mat0.Width}*{mat0.Height},右图:{mat1.Width}*{mat1.Height}" + $"(图像{scanPhotos0.photoIndex})-左图去重后:{mat0.Width}*{mat0.Height},右图:{mat1.Width}*{mat1.Height}" +
$"重复值:{Config.MiddleSuperposition},孔洞:{Config.MarginHoleWidth},cm2px{Config.cm2px_x},resizeWidth{resizeWidth}"); $"重复值:{Config.MiddleSuperposition},孔洞:{Config.MarginHoleWidth},cm2px{Config.cm2px_x},resizeWidth{resizeWidth}", WarningEnum.Low, false);
errStep = 4; errStep = 4;
//mat0 = OpenCVUtil.getMaxInsetRect(mat0); //mat0 = OpenCVUtil.getMaxInsetRect(mat0);
int marginWidth0, marginWidth1; int marginWidth0, marginWidth1;
@ -1260,7 +1547,7 @@ namespace LeatherApp.Page
time += $"->图2裁边({stopWatch.ElapsedMilliseconds})"; time += $"->图2裁边({stopWatch.ElapsedMilliseconds})";
//水平合并l //水平合并l
Mat mat = OpenCVUtil.mergeImage_sameSize(new Mat[] { mat0, mat1 });//这里相机反装,左右反转下 Mat mat = OpenCVUtil.mergeImage_sameSize(new Mat[] { mat0, mat1 });//这里相机反装,左右反转下
AddTextEvent(DateTime.Now,$"裁边{Thread.CurrentThread.ManagedThreadId}", $"(图像{scanPhotos0.photoIndex})-边缘宽度:(左图)={marginWidth0},(右图)={marginWidth1}; 裁边去孔洞后:({mat0.Width}+{mat1.Width}={mat0.Width+ mat1.Width});合并后(去孔洞){mat.Width}*{mat.Height}"); AddTextEvent(DateTime.Now,$"裁边{Thread.CurrentThread.ManagedThreadId}", $"(图像{scanPhotos0.photoIndex})-边缘宽度:(左图)={marginWidth0},(右图)={marginWidth1}; 裁边去孔洞后:({mat0.Width}+{mat1.Width}={mat0.Width+ mat1.Width});合并后(去孔洞){mat.Width}*{mat.Height}", WarningEnum.Low, false);
float widthRatio = mat.Width * 1.0f / resize.Width;//宽度比例 float widthRatio = mat.Width * 1.0f / resize.Width;//宽度比例
time += $"->图1+2合并({stopWatch.ElapsedMilliseconds})"; time += $"->图1+2合并({stopWatch.ElapsedMilliseconds})";
@ -1274,7 +1561,7 @@ namespace LeatherApp.Page
if (curRecord.FaceWidthMax < faceWidthY_cm) if (curRecord.FaceWidthMax < faceWidthY_cm)
curRecord.FaceWidthMax = faceWidthY_cm; curRecord.FaceWidthMax = faceWidthY_cm;
var point = new float[] { faceWidthX_cm, faceWidthY_cm };// new System.Drawing.PointF(faceWidthX_cm, faceWidthY_cm); var point = new float[] { faceWidthX_cm, faceWidthY_cm };// new System.Drawing.PointF(faceWidthX_cm, faceWidthY_cm);
AddTextEvent(DateTime.Now,$"门幅{Thread.CurrentThread.ManagedThreadId}", $"(图像{scanPhotos0.photoIndex})-({scanPhotos0.photoIndex})位置:{point[0]}; 幅宽:{point[1]}"); AddTextEvent(DateTime.Now,$"门幅{Thread.CurrentThread.ManagedThreadId}", $"(图像{scanPhotos0.photoIndex})-({scanPhotos0.photoIndex})位置:{point[0]}; 幅宽:{point[1]}", WarningEnum.Low, false);
curRecord.FacePointList.Add(point); curRecord.FacePointList.Add(point);
reDrawFaceWidth(curRecord.FacePointList, reDrawFaceWidth(curRecord.FacePointList,
new double[] { 0, Math.Round(point[0] + 0.005f, 2) }, new double[] { 0, Math.Round(point[0] + 0.005f, 2) },
@ -1295,14 +1582,14 @@ namespace LeatherApp.Page
this.lblLen.Tag = faceWidthX_cm; this.lblLen.Tag = faceWidthX_cm;
this.lblSpeed.Text = $"速度:{Math.Round(lenMi / curRecord.TimeLen, 2)}米/分"; this.lblSpeed.Text = $"速度:{Math.Round(lenMi / curRecord.TimeLen, 2)}米/分";
this.uilbKF.Text = $"当前幅宽:{faceWidthY_cm}cm"; this.uilbKF.Text = $"当前幅宽:{faceWidthY_cm}cm";
})); }));
// //
errStep = 9; errStep = 9;
time += $"->速度刷新({stopWatch.ElapsedMilliseconds})"; time += $"->速度刷新({stopWatch.ElapsedMilliseconds})";
//----缺陷队列 //----缺陷队列
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}"); AddTextEvent(DateTime.Now,$"图像处理{Thread.CurrentThread.ManagedThreadId}", $"(图像{scanPhotos0.photoIndex})-合成图resize后:{mat.Width}*{mat.Height}", 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,
@ -1328,7 +1615,7 @@ namespace LeatherApp.Page
} }
finally finally
{ {
AddTextEvent(DateTime.Now,$"图像处理{Thread.CurrentThread.ManagedThreadId}", $"(图像{scanPhotos0.photoIndex})-进度计时:{time}"); AddTextEvent(DateTime.Now,$"图像处理{Thread.CurrentThread.ManagedThreadId}", $"(图像{scanPhotos0.photoIndex})-进度计时:{time}", WarningEnum.Low, false);
scanPhotos0.mat.Dispose(); scanPhotos0.mat.Dispose();
scanPhotos1.mat.Dispose(); scanPhotos1.mat.Dispose();
scanPhotos0 = scanPhotos1 = null; scanPhotos0 = scanPhotos1 = null;
@ -1342,7 +1629,7 @@ namespace LeatherApp.Page
int step = 0; int step = 0;
try try
{ {
AddTextEvent(DateTime.Now,$"检测完成{Thread.CurrentThread.ManagedThreadId}", $"图像队列:{res.record.ScannerPhotoFinishCount+1}/{res.record.ScannerPhotoCount} (图像{res.photoIndex})检测结果:{res.isSucceed}"); AddTextEvent(DateTime.Now,$"检测完成{Thread.CurrentThread.ManagedThreadId}", $"图像队列:{res.record.ScannerPhotoFinishCount+1}/{res.record.ScannerPhotoCount} (图像{res.photoIndex})检测结果:{res.isSucceed}", WarningEnum.Low, false);
string dirPath = FileUtil.initFolder($"{Config.ImagePath}{res.record.BatchId}_{res.record.ReelId}\\"); string dirPath = FileUtil.initFolder($"{Config.ImagePath}{res.record.BatchId}_{res.record.ReelId}\\");
string dirSourcePath = FileUtil.initFolder($"{Config.ImagePath}{res.record.BatchId}_{res.record.ReelId}\\源图\\"); string dirSourcePath = FileUtil.initFolder($"{Config.ImagePath}{res.record.BatchId}_{res.record.ReelId}\\源图\\");
//Cv2.Flip(res.bmp, res.bmp, FlipMode.XY);//翻转 //Cv2.Flip(res.bmp, res.bmp, FlipMode.XY);//翻转
@ -1352,10 +1639,10 @@ namespace LeatherApp.Page
if (res.isSucceed) if (res.isSucceed)
{ {
step = 1; step = 1;
AddTextEvent(DateTime.Now,$"检测完成{Thread.CurrentThread.ManagedThreadId}", $"(图像{res.photoIndex})-瑕疵检测完成,共{res.excelTable.Rows.Count}个瑕疵!各环节用时:{string.Join(",",res.stopwatch)}"); AddTextEvent(DateTime.Now,$"检测完成{Thread.CurrentThread.ManagedThreadId}", $"(图像{res.photoIndex})-瑕疵检测完成,共{res.excelTable.Rows.Count}个瑕疵!各环节用时:{string.Join(",",res.stopwatch)}", WarningEnum.Low, false);
//AddTextEvent(DateTime.Now,$"打标完成", $"第 ({res.photoIndex}) 张照片,计算过程:{res.resultInfo}"); //AddTextEvent(DateTime.Now,$"打标完成", $"第 ({res.photoIndex}) 张照片,计算过程:{res.resultInfo}");
if (!Config.IsSaveAllImage && Config.IsSaveDefectSourceImage) //if (!Config.IsSaveAllImage && Config.IsSaveDefectSourceImage)
OpenCvSharp.Extensions.BitmapConverter.ToBitmap(res.bmp).Save($"{dirSourcePath}{res.photoIndex}.bmp", ImageFormat.Bmp); // OpenCvSharp.Extensions.BitmapConverter.ToBitmap(res.bmp).Save($"{dirSourcePath}{res.photoIndex}.bmp", ImageFormat.Bmp);
step = 2; step = 2;
if (res.excelTable.Rows.Count > 0) if (res.excelTable.Rows.Count > 0)
@ -1363,6 +1650,9 @@ namespace LeatherApp.Page
res.record.dicPhoto_Defect[res.photoIndex] = true;//改为此图有瑕疵 res.record.dicPhoto_Defect[res.photoIndex] = true;//改为此图有瑕疵
//有瑕疵打标图必需保存 Jpeg //有瑕疵打标图必需保存 Jpeg
OpenCvSharp.Extensions.BitmapConverter.ToBitmap(res.bmpTag).Save($"{dirPath}{res.photoIndex}_tag.jpg", ImageFormat.Jpeg); OpenCvSharp.Extensions.BitmapConverter.ToBitmap(res.bmpTag).Save($"{dirPath}{res.photoIndex}_tag.jpg", ImageFormat.Jpeg);
if (!Config.IsSaveAllImage && Config.IsSaveDefectSourceImage)
OpenCvSharp.Extensions.BitmapConverter.ToBitmap(res.bmp).Save($"{dirSourcePath}{res.photoIndex}.bmp", ImageFormat.Bmp);
step = 3; step = 3;
res.record.DefectTotalCount += res.excelTable.Rows.Count; res.record.DefectTotalCount += res.excelTable.Rows.Count;
if (res.record.DefectInfoList == null) if (res.record.DefectInfoList == null)
@ -1398,6 +1688,12 @@ namespace LeatherApp.Page
defectInfo.uid = preTicks++;// res.record.DefectInfoList.Count;//程序中的唯一索引,用于移除用索引 defectInfo.uid = preTicks++;// res.record.DefectInfoList.Count;//程序中的唯一索引,用于移除用索引
//AddTextEvent(DateTime.Now,$"打标完成", $"第{i}个缺陷:{ JsonConvert.SerializeObject(defectInfo)}; Y={res.photoIndex * res.bmp.Height * 1.0d / Config.cm2px_y}+{res.excelTable.Rows[i]["Y"].ToString()}"); //AddTextEvent(DateTime.Now,$"打标完成", $"第{i}个缺陷:{ JsonConvert.SerializeObject(defectInfo)}; Y={res.photoIndex * res.bmp.Height * 1.0d / Config.cm2px_y}+{res.excelTable.Rows[i]["Y"].ToString()}");
step = 7 + i * 10; step = 7 + i * 10;
if(!defectTag.ContainsKey(res.photoIndex))
{
defectTag.Add(res.photoIndex, res.bmpTag.Clone());
}
//保存打标小图 //保存打标小图
if (Config.IsSaveDefectCutImage) if (Config.IsSaveDefectCutImage)
{ {
@ -1424,9 +1720,23 @@ namespace LeatherApp.Page
if (res.record.ProductInfo.DefectAreaLimit > 0 && defectInfo.Area>=res.record.ProductInfo.DefectAreaLimit) if (res.record.ProductInfo.DefectAreaLimit > 0 && defectInfo.Area>=res.record.ProductInfo.DefectAreaLimit)
{ {
AddTextEvent(DateTime.Now,$"告警{Thread.CurrentThread.ManagedThreadId}", $"瑕疵面积达到阈值!({defectInfo.Area}>={res.record.ProductInfo.DefectAreaLimit})", WarningEnum.High); AddTextEvent(DateTime.Now,$"告警{Thread.CurrentThread.ManagedThreadId}", $"瑕疵面积达到阈值!({defectInfo.Area}>={res.record.ProductInfo.DefectAreaLimit})", WarningEnum.High);
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);
});
}
} }
} }
AddTextEvent(DateTime.Now,$"检测完成{Thread.CurrentThread.ManagedThreadId}", "更新UI"); AddTextEvent(DateTime.Now,$"检测完成{Thread.CurrentThread.ManagedThreadId}", "更新UI", WarningEnum.Low, false);
//更新UI //更新UI
int bmpHeight = res.bmp.Height; int bmpHeight = res.bmp.Height;
this.BeginInvoke(new System.Action(() => this.BeginInvoke(new System.Action(() =>
@ -1441,15 +1751,16 @@ namespace LeatherApp.Page
// //
double len = Math.Round((res.photoIndex + 1) * bmpHeight * 1.0d / Config.cm2px_y+0.005f, 2); double len = Math.Round((res.photoIndex + 1) * bmpHeight * 1.0d / Config.cm2px_y+0.005f, 2);
this.reDrawDefectPoints(res.record.DefectInfoList, new double[] { 0, Math.Round(res.record.FaceWidthMax+ 0.005f, 2) }, new double[] { 0, len }); this.reDrawDefectPoints(res.record.DefectInfoList, res.record.GradeDifferentiateInfoList, new double[] { 0, Math.Round(res.record.FaceWidthMax+ 0.005f, 2) }, new double[] { 0, len + OffsetCut * 100});
})); }));
step = 9; step = 9;
AddTextEvent(DateTime.Now,$"检测完成{Thread.CurrentThread.ManagedThreadId}", "保存CSV"); AddTextEvent(DateTime.Now,$"检测完成{Thread.CurrentThread.ManagedThreadId}", "保存CSV", WarningEnum.Low, false);
//保存CSV //保存CSV
bool b = Utils.ExcelUtil.DataTable2CSV($"{dirPath}{res.photoIndex}.csv", res.excelTable); bool b = Utils.ExcelUtil.DataTable2CSV($"{dirPath}{res.photoIndex}.csv", res.excelTable);
//AddTextEvent(DateTime.Now,$"打标完成", $"{res.tag}.xlsx {(b ? "保存成功!" : "保存失败!")}"); //AddTextEvent(DateTime.Now,$"打标完成", $"{res.tag}.xlsx {(b ? "保存成功!" : "保存失败!")}");
step = 10; step = 10;
#if
//每百米告警判断???在此还是在收到新照片时触发??? //每百米告警判断???在此还是在收到新照片时触发???
if (res.record.ProductInfo.DefectCountLimit > 0 && res.record.DefectTotalCount >= res.record.ProductInfo.DefectCountLimit) if (res.record.ProductInfo.DefectCountLimit > 0 && res.record.DefectTotalCount >= res.record.ProductInfo.DefectCountLimit)
{ {
@ -1461,9 +1772,23 @@ namespace LeatherApp.Page
{ {
res.record.preWarningPhotoIndex = res.photoIndex + 1; res.record.preWarningPhotoIndex = res.photoIndex + 1;
AddTextEvent(DateTime.Now,$"告警{Thread.CurrentThread.ManagedThreadId}", $"每百米瑕疵数量达到阈值!({defectCount}>={res.record.ProductInfo.DefectCountLimit})", WarningEnum.High); AddTextEvent(DateTime.Now,$"告警{Thread.CurrentThread.ManagedThreadId}", $"每百米瑕疵数量达到阈值!({defectCount}>={res.record.ProductInfo.DefectCountLimit})", WarningEnum.High);
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);
});
}
} }
step = 11; step = 11;
#if false #if true
//按缺陷计算没X米多少缺陷报警 //按缺陷计算没X米多少缺陷报警
for (int i = 0; i < res.record.ProductInfo.QualifiedLimitList.Count; i++) for (int i = 0; i < res.record.ProductInfo.QualifiedLimitList.Count; i++)
{ {
@ -1479,11 +1804,27 @@ namespace LeatherApp.Page
{ {
res.record.preWarningPhotoIndexByLabel[i] = res.photoIndex + 1; res.record.preWarningPhotoIndexByLabel[i] = res.photoIndex + 1;
AddTextEvent(DateTime.Now, $"告警{Thread.CurrentThread.ManagedThreadId}", $"每{defectWarn.DefectWarnLength}米{Config.getDefectName(defectWarn.Code)}瑕疵数量达到阈值!({warnDefectCount}>={defectWarn.DefectWarnCnt})", WarningEnum.High); AddTextEvent(DateTime.Now, $"告警{Thread.CurrentThread.ManagedThreadId}", $"每{defectWarn.DefectWarnLength}米{Config.getDefectName(defectWarn.Code)}瑕疵数量达到阈值!({warnDefectCount}>={defectWarn.DefectWarnCnt})", WarningEnum.High);
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);
});
}
} }
} }
} }
#endif #endif
} }
#endif
} }
} }
@ -1505,7 +1846,7 @@ namespace LeatherApp.Page
res.record.ScannerPhotoFinishCount++; res.record.ScannerPhotoFinishCount++;
int liScannerPhotoFinishCount = res.record.ScannerPhotoFinishCount; int liScannerPhotoFinishCount = res.record.ScannerPhotoFinishCount;
int liScannerPhotoCount = res.record.ScannerPhotoCount; int liScannerPhotoCount = res.record.ScannerPhotoCount;
AddTextEvent(DateTime.Now,$"检测完成{Thread.CurrentThread.ManagedThreadId}", $"{liScannerPhotoFinishCount}/{liScannerPhotoCount}"); AddTextEvent(DateTime.Now,$"检测完成{Thread.CurrentThread.ManagedThreadId}", $"{liScannerPhotoFinishCount}/{liScannerPhotoCount}", WarningEnum.Low, false);
//this.BeginInvoke(new System.Action(() => //this.BeginInvoke(new System.Action(() =>
//{ //{
// this.lblWaitImageCount.Text = $"{liScannerPhotoCount - liScannerPhotoFinishCount}"; // this.lblWaitImageCount.Text = $"{liScannerPhotoCount - liScannerPhotoFinishCount}";
@ -1550,21 +1891,52 @@ namespace LeatherApp.Page
{ {
step = 4; step = 4;
int count; int count;
foreach(GradeLimit item in gradeLimitList) //if (model.ProductInfo.IsAllDefectGetGradeLimit)
//{
// step = 5;
// if ((model.DefectInfoList != null) && (model.DefectInfoList.Count > 0))
// count = model.DefectInfoList.Count();
// else
// count = 0;
// step = 6;
// GradeLimit item = gradeLimitList.Find(x => x.Code == "All");
// if (item != null)
// {
// if (count <= item.A && model.Grade <= 1) model.Grade = 1;
// else if (count <= item.B && item.B > 0 && model.Grade <= 2) model.Grade = 2;
// else if (count <= item.C && item.C > 0 && model.Grade <= 3) model.Grade = 3;
// else if (count <= item.D && item.D > 0 && model.Grade <= 4) model.Grade = 4;
// else if (count <= item.E && item.E > 0 && model.Grade <= 5) model.Grade = 5;
// else if (count > 0) model.Grade = 6;//不合格
// AddTextEvent(DateTime.Now, "标准判断-总和缺陷", $"({key}) 批号({model.BatchId}),标准={(char)(model.Grade + 64)} [{item.Code}:{count};A<={item.A};B<={item.B};C<={item.C};D<={item.D};E<={item.E}]");
// }
//}
//else
//{
// foreach (GradeLimit item in gradeLimitList)
// {
// if ((model.DefectInfoList != null) && (model.DefectInfoList.Count > 0))
// count = model.DefectInfoList.Where(m => m.Code == item.Code).Count();
// else
// count = 0;
// if (count <= item.A && model.Grade <= 1) model.Grade = 1;
// else if (count <= item.B && item.B > 0 && model.Grade <= 2) model.Grade = 2;
// else if (count <= item.C && item.C > 0 && model.Grade <= 3) model.Grade = 3;
// else if (count <= item.D && item.D > 0 && model.Grade <= 4) model.Grade = 4;
// else if (count <= item.E && item.E > 0 && model.Grade <= 5) model.Grade = 5;
// else if (count > 0) model.Grade = 6;//不合格
// AddTextEvent(DateTime.Now, "标准判断-分缺陷", $"({key}) 批号({model.BatchId}),标准={(char)(model.Grade + 64)} [{item.Code}:{count};A<={item.A};B<={item.B};C<={item.C};D<={item.D};E<={item.E}]");
// }
//}
if (model.GradeDifferentiateInfoList != null)
{ {
if((model.DefectInfoList != null)&&(model.DefectInfoList.Count >0)) foreach (var item in model.GradeDifferentiateInfoList)
count = model.DefectInfoList.Where(m => m.Code == item.Code).Count(); {
else AddTextEvent(DateTime.Now, "分卷判断", $"({key}) 批号({model.BatchId}),等级={item.GradeCode} 位置[{item.StartY}-{item.EndY}],长度={item.CutLen},瑕疵数={item.DefectCnt}");
count = 0; }
if (count <= item.A && model.Grade <= 1) model.Grade = 1; }
else if (count <= item.B && item.B > 0 && model.Grade <= 2) model.Grade = 2; step = 7;
else if (count <= item.C && item.C > 0 && model.Grade <= 3) model.Grade = 3;
else if (count <= item.D && item.D > 0 && model.Grade <= 4) model.Grade = 4;
else if (count <= item.E && item.E > 0 && model.Grade <= 5) model.Grade = 5;
else if (count>0) model.Grade = 6;//不合格
AddTextEvent(DateTime.Now,"标准判断", $"({key}) 批号({model.BatchId}),标准={(char)(model.Grade + 64)} [{item.Code}:{count};A<={item.A};B<={item.B};C<={item.C};D<={item.D};E<={item.E}]");
}
step = 5;
} }
model.Qualified = (model.Grade < 6);//是否合格 model.Qualified = (model.Grade < 6);//是否合格
if (!svcRecord.InsertNav(model)) if (!svcRecord.InsertNav(model))
@ -1617,6 +1989,7 @@ namespace LeatherApp.Page
private void btnStart_Click(object sender, EventArgs e) private void btnStart_Click(object sender, EventArgs e)
{ {
AddTextEvent(DateTime.Now,"启动", "下发启动指令..."); AddTextEvent(DateTime.Now,"启动", "下发启动指令...");
//ThnDieLen = 0;
if (!Config.StopPLC) if (!Config.StopPLC)
this.devContainer.devPlc.runDev(); this.devContainer.devPlc.runDev();
else if (!Config.StopIO && devContainer.devIOCard.IsInit) else if (!Config.StopIO && devContainer.devIOCard.IsInit)
@ -1693,6 +2066,8 @@ namespace LeatherApp.Page
resetUIValue(); resetUIValue();
AddTextEvent(DateTime.Now,"启动", "等待扫码..."); AddTextEvent(DateTime.Now,"启动", "等待扫码...");
currentState = CurrentStateEnum.; currentState = CurrentStateEnum.;
defectTag.Clear();
ThnDieLen = 0;
} }
this.Invoke(new System.Action(() => this.Invoke(new System.Action(() =>
@ -1907,7 +2282,7 @@ namespace LeatherApp.Page
dt.Code = "jb"; dt.Code = "jb";
dt.image = Image.FromFile("C:\\Users\\fang\\Desktop\\123.png"); dt.image = Image.FromFile("C:\\Users\\fang\\Desktop\\123.png");
lstEditDefect.Add(dt); lstEditDefect.Add(dt);
FHome_Defect frmDefect = new FHome_Defect(lstEditDefect); FHome_Defect frmDefect = new FHome_Defect(lstEditDefect, null);
frmDefect.ShowDialog(); frmDefect.ShowDialog();
return; return;
Config.LoadAllConfig(); Config.LoadAllConfig();
@ -2104,5 +2479,15 @@ namespace LeatherApp.Page
record.ErpLen = val; record.ErpLen = val;
} }
} }
private void FHome_Resize(object sender, EventArgs e)
{
uilbKF.Top = 8;
}
private void FHome_Paint(object sender, PaintEventArgs e)
{
uilbKF.Top = 8;
}
} }
} }

View File

@ -29,14 +29,17 @@
private void InitializeComponent() private void InitializeComponent()
{ {
this.uiPanel1 = new Sunny.UI.UIPanel(); this.uiPanel1 = new Sunny.UI.UIPanel();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.btnOK = new Sunny.UI.UIButton(); this.btnOK = new Sunny.UI.UIButton();
this.btnCancel = new Sunny.UI.UIButton(); this.btnCancel = new Sunny.UI.UIButton();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.uiPanel1.SuspendLayout(); this.uiPanel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// uiPanel1 // uiPanel1
// //
this.uiPanel1.Controls.Add(this.pictureBox1);
this.uiPanel1.Controls.Add(this.flowLayoutPanel1); this.uiPanel1.Controls.Add(this.flowLayoutPanel1);
this.uiPanel1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.uiPanel1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiPanel1.Location = new System.Drawing.Point(4, 39); this.uiPanel1.Location = new System.Drawing.Point(4, 39);
@ -48,6 +51,17 @@
this.uiPanel1.Text = "uiPanel1"; this.uiPanel1.Text = "uiPanel1";
this.uiPanel1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter; this.uiPanel1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
// //
// flowLayoutPanel1
//
this.flowLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.flowLayoutPanel1.AutoScroll = true;
this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 303);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(1236, 613);
this.flowLayoutPanel1.TabIndex = 0;
//
// btnOK // btnOK
// //
this.btnOK.Cursor = System.Windows.Forms.Cursors.Hand; this.btnOK.Cursor = System.Windows.Forms.Cursors.Hand;
@ -75,13 +89,17 @@
this.btnCancel.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnCancel.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
// //
// flowLayoutPanel1 // pictureBox1
// //
this.flowLayoutPanel1.AutoScroll = true; this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 3); | System.Windows.Forms.AnchorStyles.Left)
this.flowLayoutPanel1.Name = "flowLayoutPanel1"; | System.Windows.Forms.AnchorStyles.Right)));
this.flowLayoutPanel1.Size = new System.Drawing.Size(1236, 913); this.pictureBox1.Location = new System.Drawing.Point(3, 3);
this.flowLayoutPanel1.TabIndex = 0; this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(1236, 294);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBox1.TabIndex = 1;
this.pictureBox1.TabStop = false;
// //
// FHome_Defect // FHome_Defect
// //
@ -99,6 +117,7 @@
this.ZoomScaleRect = new System.Drawing.Rectangle(22, 22, 800, 450); this.ZoomScaleRect = new System.Drawing.Rectangle(22, 22, 800, 450);
this.Load += new System.EventHandler(this.FHome_Defect_Load); this.Load += new System.EventHandler(this.FHome_Defect_Load);
this.uiPanel1.ResumeLayout(false); this.uiPanel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
@ -109,5 +128,6 @@
private Sunny.UI.UIButton btnOK; private Sunny.UI.UIButton btnOK;
private Sunny.UI.UIButton btnCancel; private Sunny.UI.UIButton btnCancel;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.PictureBox pictureBox1;
} }
} }

View File

@ -1,5 +1,7 @@
using LeatherApp.UIExtend; using LeatherApp.UIExtend;
using Models; using Models;
using OpenCvSharp;
using OpenCvSharp.Extensions;
using Sunny.UI; using Sunny.UI;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -17,10 +19,14 @@ namespace LeatherApp.Page
{ {
private List<DefectInfo> list; private List<DefectInfo> list;
public List<DefectInfo> lstDel = new List<DefectInfo>(); public List<DefectInfo> lstDel = new List<DefectInfo>();
public FHome_Defect(List<DefectInfo> lst)
private Mat Image;
public FHome_Defect(List<DefectInfo> lst, Mat img)
{ {
InitializeComponent(); InitializeComponent();
list = lst; list = lst;
Image = img;
pictureBox1.Image = Image.ToBitmap();
init(); init();
} }

View File

@ -28,17 +28,18 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle19 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle20 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle21 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle22 = new System.Windows.Forms.DataGridViewCellStyle();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FProductInfo));
this.uiTitlePanel2 = new Sunny.UI.UITitlePanel(); this.uiTitlePanel2 = new Sunny.UI.UITitlePanel();
this.tcbarTensionValue = new Sunny.UI.UITrackBar(); this.tcbarTensionValue = new Sunny.UI.UITrackBar();
this.tcbarGain = new Sunny.UI.UITrackBar(); this.tcbarGain = new Sunny.UI.UITrackBar();
@ -56,6 +57,9 @@
this.cmbModelName = new Sunny.UI.UIComboBox(); this.cmbModelName = new Sunny.UI.UIComboBox();
this.uiLabel1 = new Sunny.UI.UILabel(); this.uiLabel1 = new Sunny.UI.UILabel();
this.uiTitlePanel4 = new Sunny.UI.UITitlePanel(); this.uiTitlePanel4 = new Sunny.UI.UITitlePanel();
this.uiNumPadTextBox1 = new Sunny.UI.UINumPadTextBox();
this.uiSwitch1 = new Sunny.UI.UISwitch();
this.uiLabel11 = new Sunny.UI.UILabel();
this.btnDefectOption = new Sunny.UI.UISymbolButton(); this.btnDefectOption = new Sunny.UI.UISymbolButton();
this.swcDefectPauseForUser = new Sunny.UI.UISwitch(); this.swcDefectPauseForUser = new Sunny.UI.UISwitch();
this.numDefectCountLimit = new Sunny.UI.UINumPadTextBox(); this.numDefectCountLimit = new Sunny.UI.UINumPadTextBox();
@ -65,14 +69,16 @@
this.uiLabel7 = new Sunny.UI.UILabel(); this.uiLabel7 = new Sunny.UI.UILabel();
this.uiTitlePanel5 = new Sunny.UI.UITitlePanel(); this.uiTitlePanel5 = new Sunny.UI.UITitlePanel();
this.uiDataGridView1 = new Sunny.UI.UIDataGridView(); this.uiDataGridView1 = new Sunny.UI.UIDataGridView();
this.col_code = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.col_zxd = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.col_area = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.col_contrast_lower = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.col_contrast_top = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.col_IsOR = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.col_Len = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.col_Cnt = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.uiTitlePanel6 = new Sunny.UI.UITitlePanel(); this.uiTitlePanel6 = new Sunny.UI.UITitlePanel();
this.uiDataGridView2 = new Sunny.UI.UIDataGridView(); this.uiDataGridView2 = new Sunny.UI.UIDataGridView();
this.col2_code = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.col2_1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.col2_2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.col2_3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.col2_4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.col2_5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.uiPanel1 = new Sunny.UI.UIPanel(); this.uiPanel1 = new Sunny.UI.UIPanel();
this.uiFlowLayoutPanel1 = new Sunny.UI.UIFlowLayoutPanel(); this.uiFlowLayoutPanel1 = new Sunny.UI.UIFlowLayoutPanel();
this.btnSave = new Sunny.UI.UISymbolButton(); this.btnSave = new Sunny.UI.UISymbolButton();
@ -88,14 +94,17 @@
this.cmbColor = new Sunny.UI.UIComboBox(); this.cmbColor = new Sunny.UI.UIComboBox();
this.uiLabel3 = new Sunny.UI.UILabel(); this.uiLabel3 = new Sunny.UI.UILabel();
this.uiLabel2 = new Sunny.UI.UILabel(); this.uiLabel2 = new Sunny.UI.UILabel();
this.col_code = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.ckIsCut = new Sunny.UI.UICheckBox();
this.col_zxd = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.btnAddGrade = new Sunny.UI.UISymbolButton();
this.col_area = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.btnDelGrade = new Sunny.UI.UISymbolButton();
this.col_contrast_lower = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.col2_code = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.col_contrast_top = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.col2_Item = new System.Windows.Forms.DataGridViewComboBoxColumn();
this.col_IsOR = new System.Windows.Forms.DataGridViewCheckBoxColumn(); this.col2_1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.col_Len = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.col2_2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.col_Cnt = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.col2_3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.col2_4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.col2_5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.col2_6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.uiTitlePanel2.SuspendLayout(); this.uiTitlePanel2.SuspendLayout();
this.uiTitlePanel3.SuspendLayout(); this.uiTitlePanel3.SuspendLayout();
this.uiTitlePanel4.SuspendLayout(); this.uiTitlePanel4.SuspendLayout();
@ -373,6 +382,9 @@
// uiTitlePanel4 // uiTitlePanel4
// //
this.uiTitlePanel4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.uiTitlePanel4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.uiTitlePanel4.Controls.Add(this.uiNumPadTextBox1);
this.uiTitlePanel4.Controls.Add(this.uiSwitch1);
this.uiTitlePanel4.Controls.Add(this.uiLabel11);
this.uiTitlePanel4.Controls.Add(this.btnDefectOption); this.uiTitlePanel4.Controls.Add(this.btnDefectOption);
this.uiTitlePanel4.Controls.Add(this.swcDefectPauseForUser); this.uiTitlePanel4.Controls.Add(this.swcDefectPauseForUser);
this.uiTitlePanel4.Controls.Add(this.numDefectCountLimit); this.uiTitlePanel4.Controls.Add(this.numDefectCountLimit);
@ -396,6 +408,46 @@
this.uiTitlePanel4.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; this.uiTitlePanel4.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
this.uiTitlePanel4.TitleColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192))))); this.uiTitlePanel4.TitleColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192)))));
// //
// uiNumPadTextBox1
//
this.uiNumPadTextBox1.FillColor = System.Drawing.Color.White;
this.uiNumPadTextBox1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiNumPadTextBox1.Location = new System.Drawing.Point(96, 300);
this.uiNumPadTextBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiNumPadTextBox1.MinimumSize = new System.Drawing.Size(63, 0);
this.uiNumPadTextBox1.Name = "uiNumPadTextBox1";
this.uiNumPadTextBox1.NumPadType = Sunny.UI.NumPadType.Integer;
this.uiNumPadTextBox1.Padding = new System.Windows.Forms.Padding(0, 0, 30, 2);
this.uiNumPadTextBox1.Size = new System.Drawing.Size(119, 29);
this.uiNumPadTextBox1.Style = Sunny.UI.UIStyle.Custom;
this.uiNumPadTextBox1.TabIndex = 17;
this.uiNumPadTextBox1.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
this.uiNumPadTextBox1.Watermark = "";
//
// uiSwitch1
//
this.uiSwitch1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiSwitch1.Location = new System.Drawing.Point(9, 300);
this.uiSwitch1.MinimumSize = new System.Drawing.Size(1, 1);
this.uiSwitch1.Name = "uiSwitch1";
this.uiSwitch1.Size = new System.Drawing.Size(80, 29);
this.uiSwitch1.Style = Sunny.UI.UIStyle.Custom;
this.uiSwitch1.TabIndex = 16;
this.uiSwitch1.Text = "uiSwitch1";
//
// uiLabel11
//
this.uiLabel11.AutoSize = true;
this.uiLabel11.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiLabel11.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
this.uiLabel11.Location = new System.Drawing.Point(3, 263);
this.uiLabel11.Name = "uiLabel11";
this.uiLabel11.Size = new System.Drawing.Size(131, 21);
this.uiLabel11.Style = Sunny.UI.UIStyle.Custom;
this.uiLabel11.TabIndex = 15;
this.uiLabel11.Text = "固定距离暂停(m)";
this.uiLabel11.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// btnDefectOption // btnDefectOption
// //
this.btnDefectOption.Cursor = System.Windows.Forms.Cursors.Hand; this.btnDefectOption.Cursor = System.Windows.Forms.Cursors.Hand;
@ -518,21 +570,21 @@
// //
// uiDataGridView1 // uiDataGridView1
// //
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255))))); dataGridViewCellStyle12.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255)))));
this.uiDataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; this.uiDataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle12;
this.uiDataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.uiDataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.uiDataGridView1.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255))))); this.uiDataGridView1.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255)))));
this.uiDataGridView1.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single; this.uiDataGridView1.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); dataGridViewCellStyle13.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle13.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle2.ForeColor = System.Drawing.Color.White; dataGridViewCellStyle13.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); dataGridViewCellStyle13.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle13.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True; dataGridViewCellStyle13.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.uiDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; this.uiDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle13;
this.uiDataGridView1.ColumnHeadersHeight = 32; this.uiDataGridView1.ColumnHeadersHeight = 32;
this.uiDataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.uiDataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
this.uiDataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.uiDataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
@ -544,45 +596,110 @@
this.col_IsOR, this.col_IsOR,
this.col_Len, this.col_Len,
this.col_Cnt}); this.col_Cnt});
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle4.BackColor = System.Drawing.Color.White; dataGridViewCellStyle15.BackColor = System.Drawing.Color.White;
dataGridViewCellStyle4.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle15.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); dataGridViewCellStyle15.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
dataGridViewCellStyle4.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(236)))), ((int)(((byte)(255))))); dataGridViewCellStyle15.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(236)))), ((int)(((byte)(255)))));
dataGridViewCellStyle4.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); dataGridViewCellStyle15.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.False; dataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.uiDataGridView1.DefaultCellStyle = dataGridViewCellStyle4; this.uiDataGridView1.DefaultCellStyle = dataGridViewCellStyle15;
this.uiDataGridView1.EnableHeadersVisualStyles = false; this.uiDataGridView1.EnableHeadersVisualStyles = false;
this.uiDataGridView1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.uiDataGridView1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiDataGridView1.GridColor = System.Drawing.Color.FromArgb(((int)(((byte)(104)))), ((int)(((byte)(173)))), ((int)(((byte)(255))))); this.uiDataGridView1.GridColor = System.Drawing.Color.FromArgb(((int)(((byte)(104)))), ((int)(((byte)(173)))), ((int)(((byte)(255)))));
this.uiDataGridView1.Location = new System.Drawing.Point(3, 41); this.uiDataGridView1.Location = new System.Drawing.Point(3, 41);
this.uiDataGridView1.MultiSelect = false; this.uiDataGridView1.MultiSelect = false;
this.uiDataGridView1.Name = "uiDataGridView1"; this.uiDataGridView1.Name = "uiDataGridView1";
dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle16.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255))))); dataGridViewCellStyle16.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255)))));
dataGridViewCellStyle5.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle16.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); dataGridViewCellStyle16.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
dataGridViewCellStyle5.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); dataGridViewCellStyle16.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
dataGridViewCellStyle5.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); dataGridViewCellStyle16.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; dataGridViewCellStyle16.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.uiDataGridView1.RowHeadersDefaultCellStyle = dataGridViewCellStyle5; this.uiDataGridView1.RowHeadersDefaultCellStyle = dataGridViewCellStyle16;
this.uiDataGridView1.RowHeadersWidth = 62; this.uiDataGridView1.RowHeadersWidth = 62;
dataGridViewCellStyle6.BackColor = System.Drawing.Color.White; dataGridViewCellStyle17.BackColor = System.Drawing.Color.White;
dataGridViewCellStyle6.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle17.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle6.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); dataGridViewCellStyle17.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
dataGridViewCellStyle6.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(236)))), ((int)(((byte)(255))))); dataGridViewCellStyle17.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(236)))), ((int)(((byte)(255)))));
dataGridViewCellStyle6.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); dataGridViewCellStyle17.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
this.uiDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle6; this.uiDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle17;
this.uiDataGridView1.RowTemplate.Height = 30; this.uiDataGridView1.RowTemplate.Height = 30;
this.uiDataGridView1.SelectedIndex = -1; this.uiDataGridView1.SelectedIndex = -1;
this.uiDataGridView1.Size = new System.Drawing.Size(581, 308); this.uiDataGridView1.Size = new System.Drawing.Size(581, 308);
this.uiDataGridView1.Style = Sunny.UI.UIStyle.Custom; this.uiDataGridView1.Style = Sunny.UI.UIStyle.Custom;
this.uiDataGridView1.TabIndex = 21; this.uiDataGridView1.TabIndex = 21;
// //
// col_code
//
this.col_code.DataPropertyName = "Code";
this.col_code.HeaderText = "code";
this.col_code.MinimumWidth = 8;
this.col_code.Name = "col_code";
this.col_code.ReadOnly = true;
this.col_code.Visible = false;
this.col_code.Width = 150;
//
// col_zxd
//
this.col_zxd.DataPropertyName = "ZXD";
dataGridViewCellStyle14.NullValue = null;
this.col_zxd.DefaultCellStyle = dataGridViewCellStyle14;
this.col_zxd.HeaderText = "置信度";
this.col_zxd.MinimumWidth = 20;
this.col_zxd.Name = "col_zxd";
this.col_zxd.Width = 150;
//
// col_area
//
this.col_area.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.col_area.DataPropertyName = "Area";
this.col_area.HeaderText = "面积(mm^2)";
this.col_area.MinimumWidth = 20;
this.col_area.Name = "col_area";
//
// col_contrast_lower
//
this.col_contrast_lower.DataPropertyName = "Contrast";
this.col_contrast_lower.HeaderText = "对比度(下限)";
this.col_contrast_lower.MinimumWidth = 80;
this.col_contrast_lower.Name = "col_contrast_lower";
this.col_contrast_lower.Width = 120;
//
// col_contrast_top
//
this.col_contrast_top.HeaderText = "对比度(上限)";
this.col_contrast_top.MinimumWidth = 80;
this.col_contrast_top.Name = "col_contrast_top";
this.col_contrast_top.Width = 120;
//
// col_IsOR
//
this.col_IsOR.HeaderText = "或向选择";
this.col_IsOR.MinimumWidth = 8;
this.col_IsOR.Name = "col_IsOR";
this.col_IsOR.Width = 150;
//
// col_Len
//
this.col_Len.HeaderText = "报警长度(m)";
this.col_Len.MinimumWidth = 80;
this.col_Len.Name = "col_Len";
//
// col_Cnt
//
this.col_Cnt.HeaderText = "报警数量";
this.col_Cnt.MinimumWidth = 80;
this.col_Cnt.Name = "col_Cnt";
//
// uiTitlePanel6 // uiTitlePanel6
// //
this.uiTitlePanel6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.uiTitlePanel6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.uiTitlePanel6.Controls.Add(this.btnDelGrade);
this.uiTitlePanel6.Controls.Add(this.btnAddGrade);
this.uiTitlePanel6.Controls.Add(this.ckIsCut);
this.uiTitlePanel6.Controls.Add(this.uiDataGridView2); this.uiTitlePanel6.Controls.Add(this.uiDataGridView2);
this.uiTitlePanel6.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(251)))), ((int)(((byte)(250))))); this.uiTitlePanel6.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(251)))), ((int)(((byte)(250)))));
this.uiTitlePanel6.FillColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(251)))), ((int)(((byte)(250))))); this.uiTitlePanel6.FillColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(251)))), ((int)(((byte)(250)))));
@ -602,108 +719,68 @@
// //
// uiDataGridView2 // uiDataGridView2
// //
dataGridViewCellStyle7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255))))); dataGridViewCellStyle18.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255)))));
this.uiDataGridView2.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle7; this.uiDataGridView2.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle18;
this.uiDataGridView2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.uiDataGridView2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.uiDataGridView2.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255))))); this.uiDataGridView2.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255)))));
this.uiDataGridView2.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single; this.uiDataGridView2.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; dataGridViewCellStyle19.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle8.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); dataGridViewCellStyle19.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
dataGridViewCellStyle8.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle19.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle8.ForeColor = System.Drawing.Color.White; dataGridViewCellStyle19.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle8.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); dataGridViewCellStyle19.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
dataGridViewCellStyle8.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle19.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True; dataGridViewCellStyle19.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.uiDataGridView2.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle8; this.uiDataGridView2.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle19;
this.uiDataGridView2.ColumnHeadersHeight = 32; this.uiDataGridView2.ColumnHeadersHeight = 32;
this.uiDataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.uiDataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
this.uiDataGridView2.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.uiDataGridView2.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.col2_code, this.col2_code,
this.col2_Item,
this.col2_1, this.col2_1,
this.col2_2, this.col2_2,
this.col2_3, this.col2_3,
this.col2_4, this.col2_4,
this.col2_5}); this.col2_5,
dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; this.col2_6});
dataGridViewCellStyle9.BackColor = System.Drawing.Color.White; dataGridViewCellStyle20.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle9.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle20.BackColor = System.Drawing.Color.White;
dataGridViewCellStyle9.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); dataGridViewCellStyle20.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle9.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(236)))), ((int)(((byte)(255))))); dataGridViewCellStyle20.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
dataGridViewCellStyle9.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); dataGridViewCellStyle20.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(236)))), ((int)(((byte)(255)))));
dataGridViewCellStyle9.WrapMode = System.Windows.Forms.DataGridViewTriState.False; dataGridViewCellStyle20.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
this.uiDataGridView2.DefaultCellStyle = dataGridViewCellStyle9; dataGridViewCellStyle20.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.uiDataGridView2.DefaultCellStyle = dataGridViewCellStyle20;
this.uiDataGridView2.EnableHeadersVisualStyles = false; this.uiDataGridView2.EnableHeadersVisualStyles = false;
this.uiDataGridView2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.uiDataGridView2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiDataGridView2.GridColor = System.Drawing.Color.FromArgb(((int)(((byte)(104)))), ((int)(((byte)(173)))), ((int)(((byte)(255))))); this.uiDataGridView2.GridColor = System.Drawing.Color.FromArgb(((int)(((byte)(104)))), ((int)(((byte)(173)))), ((int)(((byte)(255)))));
this.uiDataGridView2.Location = new System.Drawing.Point(3, 41); this.uiDataGridView2.Location = new System.Drawing.Point(3, 41);
this.uiDataGridView2.MultiSelect = false; this.uiDataGridView2.MultiSelect = false;
this.uiDataGridView2.Name = "uiDataGridView2"; this.uiDataGridView2.Name = "uiDataGridView2";
dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle21.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle10.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255))))); dataGridViewCellStyle21.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255)))));
dataGridViewCellStyle10.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle21.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle10.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); dataGridViewCellStyle21.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
dataGridViewCellStyle10.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); dataGridViewCellStyle21.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
dataGridViewCellStyle10.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); dataGridViewCellStyle21.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
dataGridViewCellStyle10.WrapMode = System.Windows.Forms.DataGridViewTriState.True; dataGridViewCellStyle21.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.uiDataGridView2.RowHeadersDefaultCellStyle = dataGridViewCellStyle10; this.uiDataGridView2.RowHeadersDefaultCellStyle = dataGridViewCellStyle21;
this.uiDataGridView2.RowHeadersWidth = 62; this.uiDataGridView2.RowHeadersWidth = 62;
dataGridViewCellStyle11.BackColor = System.Drawing.Color.White; dataGridViewCellStyle22.BackColor = System.Drawing.Color.White;
dataGridViewCellStyle11.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle22.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle11.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); dataGridViewCellStyle22.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
dataGridViewCellStyle11.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(236)))), ((int)(((byte)(255))))); dataGridViewCellStyle22.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(236)))), ((int)(((byte)(255)))));
dataGridViewCellStyle11.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); dataGridViewCellStyle22.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
this.uiDataGridView2.RowsDefaultCellStyle = dataGridViewCellStyle11; this.uiDataGridView2.RowsDefaultCellStyle = dataGridViewCellStyle22;
this.uiDataGridView2.RowTemplate.Height = 30; this.uiDataGridView2.RowTemplate.Height = 30;
this.uiDataGridView2.SelectedIndex = -1; this.uiDataGridView2.SelectedIndex = -1;
this.uiDataGridView2.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.uiDataGridView2.Size = new System.Drawing.Size(488, 308); this.uiDataGridView2.Size = new System.Drawing.Size(488, 308);
this.uiDataGridView2.Style = Sunny.UI.UIStyle.Custom; this.uiDataGridView2.Style = Sunny.UI.UIStyle.Custom;
this.uiDataGridView2.TabIndex = 22; this.uiDataGridView2.TabIndex = 22;
// //
// col2_code
//
this.col2_code.HeaderText = "code";
this.col2_code.MinimumWidth = 8;
this.col2_code.Name = "col2_code";
this.col2_code.Visible = false;
this.col2_code.Width = 150;
//
// col2_1
//
this.col2_1.HeaderText = "A";
this.col2_1.MinimumWidth = 8;
this.col2_1.Name = "col2_1";
this.col2_1.Width = 80;
//
// col2_2
//
this.col2_2.HeaderText = "B";
this.col2_2.MinimumWidth = 8;
this.col2_2.Name = "col2_2";
this.col2_2.Width = 80;
//
// col2_3
//
this.col2_3.HeaderText = "C";
this.col2_3.MinimumWidth = 8;
this.col2_3.Name = "col2_3";
this.col2_3.Width = 80;
//
// col2_4
//
this.col2_4.HeaderText = "D";
this.col2_4.MinimumWidth = 8;
this.col2_4.Name = "col2_4";
this.col2_4.Width = 80;
//
// col2_5
//
this.col2_5.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.col2_5.HeaderText = "E";
this.col2_5.MinimumWidth = 8;
this.col2_5.Name = "col2_5";
//
// uiPanel1 // uiPanel1
// //
this.uiPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.uiPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
@ -957,67 +1034,110 @@
this.uiLabel2.Text = "产品颜色"; this.uiLabel2.Text = "产品颜色";
this.uiLabel2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.uiLabel2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
// //
// col_code // ckIsCut
// //
this.col_code.DataPropertyName = "Code"; this.ckIsCut.BackColor = System.Drawing.Color.Transparent;
this.col_code.HeaderText = "code"; this.ckIsCut.Cursor = System.Windows.Forms.Cursors.Hand;
this.col_code.MinimumWidth = 8; this.ckIsCut.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.col_code.Name = "col_code"; this.ckIsCut.ForeColor = System.Drawing.Color.White;
this.col_code.ReadOnly = true; this.ckIsCut.Location = new System.Drawing.Point(347, 2);
this.col_code.Visible = false; this.ckIsCut.MinimumSize = new System.Drawing.Size(1, 1);
this.col_code.Width = 150; this.ckIsCut.Name = "ckIsCut";
this.ckIsCut.Size = new System.Drawing.Size(132, 33);
this.ckIsCut.Style = Sunny.UI.UIStyle.Custom;
this.ckIsCut.TabIndex = 44;
this.ckIsCut.Text = "使用裁切提示";
this.ckIsCut.CheckedChanged += new System.EventHandler(this.ckGradeLimeIsAllDefectCnt_CheckedChanged);
// //
// col_zxd // btnAddGrade
// //
this.col_zxd.DataPropertyName = "ZXD"; this.btnAddGrade.BackColor = System.Drawing.Color.Transparent;
dataGridViewCellStyle3.NullValue = null; this.btnAddGrade.Cursor = System.Windows.Forms.Cursors.Hand;
this.col_zxd.DefaultCellStyle = dataGridViewCellStyle3; this.btnAddGrade.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.col_zxd.HeaderText = "置信度"; this.btnAddGrade.Image = ((System.Drawing.Image)(resources.GetObject("btnAddGrade.Image")));
this.col_zxd.MinimumWidth = 20; this.btnAddGrade.LightColor = System.Drawing.Color.FromArgb(((int)(((byte)(14)))), ((int)(((byte)(30)))), ((int)(((byte)(63)))));
this.col_zxd.Name = "col_zxd"; this.btnAddGrade.Location = new System.Drawing.Point(105, 3);
this.col_zxd.Width = 150; this.btnAddGrade.MinimumSize = new System.Drawing.Size(1, 1);
this.btnAddGrade.Name = "btnAddGrade";
this.btnAddGrade.Size = new System.Drawing.Size(86, 29);
this.btnAddGrade.Style = Sunny.UI.UIStyle.Custom;
this.btnAddGrade.Symbol = 61459;
this.btnAddGrade.TabIndex = 18;
this.btnAddGrade.Text = "新增";
this.btnAddGrade.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnAddGrade.Click += new System.EventHandler(this.btnAddGrade_Click);
// //
// col_area // btnDelGrade
// //
this.col_area.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.btnDelGrade.BackColor = System.Drawing.Color.Transparent;
this.col_area.DataPropertyName = "Area"; this.btnDelGrade.Cursor = System.Windows.Forms.Cursors.Hand;
this.col_area.HeaderText = "面积(mm^2)"; this.btnDelGrade.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.col_area.MinimumWidth = 20; this.btnDelGrade.Image = ((System.Drawing.Image)(resources.GetObject("btnDelGrade.Image")));
this.col_area.Name = "col_area"; this.btnDelGrade.LightColor = System.Drawing.Color.FromArgb(((int)(((byte)(14)))), ((int)(((byte)(30)))), ((int)(((byte)(63)))));
this.btnDelGrade.Location = new System.Drawing.Point(213, 3);
this.btnDelGrade.MinimumSize = new System.Drawing.Size(1, 1);
this.btnDelGrade.Name = "btnDelGrade";
this.btnDelGrade.Size = new System.Drawing.Size(86, 29);
this.btnDelGrade.Style = Sunny.UI.UIStyle.Custom;
this.btnDelGrade.Symbol = 61459;
this.btnDelGrade.TabIndex = 45;
this.btnDelGrade.Text = "删除";
this.btnDelGrade.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnDelGrade.Click += new System.EventHandler(this.btnDelGrade_Click);
// //
// col_contrast_lower // col2_code
// //
this.col_contrast_lower.DataPropertyName = "Contrast"; this.col2_code.HeaderText = "code";
this.col_contrast_lower.HeaderText = "对比度(下限)"; this.col2_code.MinimumWidth = 8;
this.col_contrast_lower.MinimumWidth = 80; this.col2_code.Name = "col2_code";
this.col_contrast_lower.Name = "col_contrast_lower"; this.col2_code.Visible = false;
this.col_contrast_lower.Width = 120; this.col2_code.Width = 120;
// //
// col_contrast_top // col2_Item
// //
this.col_contrast_top.HeaderText = "对比度(上限)"; this.col2_Item.HeaderText = "名称";
this.col_contrast_top.MinimumWidth = 80; this.col2_Item.Name = "col2_Item";
this.col_contrast_top.Name = "col_contrast_top";
this.col_contrast_top.Width = 120;
// //
// col_IsOR // col2_1
// //
this.col_IsOR.HeaderText = "或向选择"; this.col2_1.HeaderText = "A";
this.col_IsOR.MinimumWidth = 8; this.col2_1.MinimumWidth = 8;
this.col_IsOR.Name = "col_IsOR"; this.col2_1.Name = "col2_1";
this.col_IsOR.Width = 150; this.col2_1.Width = 60;
// //
// col_Len // col2_2
// //
this.col_Len.HeaderText = "报警长度(m)"; this.col2_2.HeaderText = "B";
this.col_Len.Name = "col_Len"; this.col2_2.MinimumWidth = 8;
this.col_Len.Visible = false; this.col2_2.Name = "col2_2";
this.col2_2.Width = 60;
// //
// col_Cnt // col2_3
// //
this.col_Cnt.HeaderText = "报警数量"; this.col2_3.HeaderText = "C";
this.col_Cnt.Name = "col_Cnt"; this.col2_3.MinimumWidth = 8;
this.col_Cnt.Visible = false; this.col2_3.Name = "col2_3";
this.col2_3.Width = 60;
//
// col2_4
//
this.col2_4.HeaderText = "D";
this.col2_4.MinimumWidth = 8;
this.col2_4.Name = "col2_4";
this.col2_4.Width = 60;
//
// col2_5
//
this.col2_5.HeaderText = "E";
this.col2_5.MinimumWidth = 8;
this.col2_5.Name = "col2_5";
this.col2_5.Width = 60;
//
// col2_6
//
this.col2_6.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.col2_6.HeaderText = "统计长度";
this.col2_6.Name = "col2_6";
// //
// FProductInfo // FProductInfo
// //
@ -1035,6 +1155,8 @@
this.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192))))); this.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192)))));
this.Style = Sunny.UI.UIStyle.Custom; this.Style = Sunny.UI.UIStyle.Custom;
this.Initialize += new System.EventHandler(this.FProductInfo_Initialize); this.Initialize += new System.EventHandler(this.FProductInfo_Initialize);
this.Shown += new System.EventHandler(this.FProductInfo_Shown);
this.Paint += new System.Windows.Forms.PaintEventHandler(this.FProductInfo_Paint);
this.uiTitlePanel2.ResumeLayout(false); this.uiTitlePanel2.ResumeLayout(false);
this.uiTitlePanel2.PerformLayout(); this.uiTitlePanel2.PerformLayout();
this.uiTitlePanel3.ResumeLayout(false); this.uiTitlePanel3.ResumeLayout(false);
@ -1080,12 +1202,6 @@
private Sunny.UI.UIFlowLayoutPanel uiFlowLayoutPanel1; private Sunny.UI.UIFlowLayoutPanel uiFlowLayoutPanel1;
private Sunny.UI.UIDataGridView uiDataGridView1; private Sunny.UI.UIDataGridView uiDataGridView1;
private Sunny.UI.UIDataGridView uiDataGridView2; private Sunny.UI.UIDataGridView uiDataGridView2;
private System.Windows.Forms.DataGridViewTextBoxColumn col2_code;
private System.Windows.Forms.DataGridViewTextBoxColumn col2_1;
private System.Windows.Forms.DataGridViewTextBoxColumn col2_2;
private System.Windows.Forms.DataGridViewTextBoxColumn col2_3;
private System.Windows.Forms.DataGridViewTextBoxColumn col2_4;
private System.Windows.Forms.DataGridViewTextBoxColumn col2_5;
private Sunny.UI.UITitlePanel uiTitlePanel1; private Sunny.UI.UITitlePanel uiTitlePanel1;
private Sunny.UI.UIComboBox cmbColor; private Sunny.UI.UIComboBox cmbColor;
private Sunny.UI.UILabel uiLabel3; private Sunny.UI.UILabel uiLabel3;
@ -1103,6 +1219,9 @@
private Sunny.UI.UIRadioButton rbMaterial4; private Sunny.UI.UIRadioButton rbMaterial4;
private Sunny.UI.UIRadioButton rbMaterial3; private Sunny.UI.UIRadioButton rbMaterial3;
private Sunny.UI.UIRadioButton rbMaterial2; private Sunny.UI.UIRadioButton rbMaterial2;
private Sunny.UI.UINumPadTextBox uiNumPadTextBox1;
private Sunny.UI.UISwitch uiSwitch1;
private Sunny.UI.UILabel uiLabel11;
private System.Windows.Forms.DataGridViewTextBoxColumn col_code; private System.Windows.Forms.DataGridViewTextBoxColumn col_code;
private System.Windows.Forms.DataGridViewTextBoxColumn col_zxd; private System.Windows.Forms.DataGridViewTextBoxColumn col_zxd;
private System.Windows.Forms.DataGridViewTextBoxColumn col_area; private System.Windows.Forms.DataGridViewTextBoxColumn col_area;
@ -1111,5 +1230,16 @@
private System.Windows.Forms.DataGridViewCheckBoxColumn col_IsOR; private System.Windows.Forms.DataGridViewCheckBoxColumn col_IsOR;
private System.Windows.Forms.DataGridViewTextBoxColumn col_Len; private System.Windows.Forms.DataGridViewTextBoxColumn col_Len;
private System.Windows.Forms.DataGridViewTextBoxColumn col_Cnt; private System.Windows.Forms.DataGridViewTextBoxColumn col_Cnt;
private Sunny.UI.UICheckBox ckIsCut;
private Sunny.UI.UISymbolButton btnAddGrade;
private Sunny.UI.UISymbolButton btnDelGrade;
private System.Windows.Forms.DataGridViewTextBoxColumn col2_code;
private System.Windows.Forms.DataGridViewComboBoxColumn col2_Item;
private System.Windows.Forms.DataGridViewTextBoxColumn col2_1;
private System.Windows.Forms.DataGridViewTextBoxColumn col2_2;
private System.Windows.Forms.DataGridViewTextBoxColumn col2_3;
private System.Windows.Forms.DataGridViewTextBoxColumn col2_4;
private System.Windows.Forms.DataGridViewTextBoxColumn col2_5;
private System.Windows.Forms.DataGridViewTextBoxColumn col2_6;
} }
} }

View File

@ -1,4 +1,7 @@
using LeatherApp.Device; using DocumentFormat.OpenXml.EMMA;
using DocumentFormat.OpenXml.Spreadsheet;
using DocumentFormat.OpenXml.Wordprocessing;
using LeatherApp.Device;
using LeatherApp.Interface; using LeatherApp.Interface;
using Models; using Models;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
@ -10,9 +13,11 @@ using System.Data;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Security.Policy;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using System.Xml.Linq;
namespace LeatherApp.Page namespace LeatherApp.Page
{ {
@ -30,7 +35,10 @@ namespace LeatherApp.Page
uiDataGridView1.AllowUserToResizeRows = uiDataGridView2.AllowUserToResizeRows=false;//用户调整行大小 uiDataGridView1.AllowUserToResizeRows = uiDataGridView2.AllowUserToResizeRows=false;//用户调整行大小
//dataGridView1.AllowUserToResizeColumns = false;//用户调整列大小 //dataGridView1.AllowUserToResizeColumns = false;//用户调整列大小
//显示行号与列宽度自动调整 //显示行号与列宽度自动调整
uiDataGridView1.RowHeadersVisible = uiDataGridView2.RowHeadersVisible = true; uiDataGridView1.RowHeadersVisible = true;
uiDataGridView2.RowHeadersVisible = false;
uiDataGridView1.RowHeadersWidth = uiDataGridView2.RowHeadersWidth = 50; uiDataGridView1.RowHeadersWidth = uiDataGridView2.RowHeadersWidth = 50;
uiDataGridView1.ColumnHeadersHeightSizeMode = uiDataGridView2.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; uiDataGridView1.ColumnHeadersHeightSizeMode = uiDataGridView2.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
uiDataGridView1.RowHeadersWidthSizeMode = uiDataGridView2.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders;//数据量过百绑定太变 uiDataGridView1.RowHeadersWidthSizeMode = uiDataGridView2.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders;//数据量过百绑定太变
@ -46,6 +54,13 @@ namespace LeatherApp.Page
//if (dataGridView1.RowHeadersVisible) dataGridView1.TopLeftHeaderCell.Value = "SPH/CYL"; //if (dataGridView1.RowHeadersVisible) dataGridView1.TopLeftHeaderCell.Value = "SPH/CYL";
#endregion #endregion
this.rbMaterial0.Text = Config.materialNameList.FirstOrDefault(x => x.Value<int>("code") == 0).Value<string>("name");
this.rbMaterial1.Text = Config.materialNameList.FirstOrDefault(x => x.Value<int>("code") == 1).Value<string>("name");
this.rbMaterial2.Text = Config.materialNameList.FirstOrDefault(x => x.Value<int>("code") == 2).Value<string>("name");
this.rbMaterial3.Text = Config.materialNameList.FirstOrDefault(x => x.Value<int>("code") == 3).Value<string>("name");
this.rbMaterial4.Text = Config.materialNameList.FirstOrDefault(x => x.Value<int>("code") == 4).Value<string>("name");
this.rbMaterial5.Text = Config.materialNameList.FirstOrDefault(x => x.Value<int>("code") == 5).Value<string>("name");
initData(); initData();
} }
private void initData() private void initData()
@ -112,7 +127,7 @@ namespace LeatherApp.Page
{ {
clear(resetAll); clear(resetAll);
string[] codes= pcode.Split('-'); string[] codes= pcode.Split('-');
if (codes[0]=="0" || Config.SuedeList.Contains(codes[0])) if (codes[0]=="0" || Config.SuedeList1.Contains(codes[0]))
this.rbMaterial0.Checked = true; this.rbMaterial0.Checked = true;
else if (codes[0] == "1") else if (codes[0] == "1")
this.rbMaterial1.Checked = true; this.rbMaterial1.Checked = true;
@ -124,6 +139,8 @@ namespace LeatherApp.Page
this.rbMaterial4.Checked = true; this.rbMaterial4.Checked = true;
else if (codes[0] == "5") else if (codes[0] == "5")
this.rbMaterial5.Checked = true; this.rbMaterial5.Checked = true;
else
this.rbMaterial1.Checked = true;
this.cmbColor.SelectedValue = int.Parse(codes[1]); this.cmbColor.SelectedValue = int.Parse(codes[1]);
} }
else else
@ -161,7 +178,7 @@ namespace LeatherApp.Page
private void loadProduct() private void loadProduct()
{ {
if (model == null) return; if (model == null) return;
if(model.Material=="0") if (model.Material == "0")
this.rbMaterial0.Checked = true; this.rbMaterial0.Checked = true;
else if (model.Material == "1") else if (model.Material == "1")
this.rbMaterial1.Checked = true; this.rbMaterial1.Checked = true;
@ -176,6 +193,8 @@ namespace LeatherApp.Page
this.cmbColor.SelectedValue = model.Color; this.cmbColor.SelectedValue = model.Color;
this.ckIsCut.Checked = model.IsHintCutting;
tcbarLightValue.Value = model.LightValue; tcbarLightValue.Value = model.LightValue;
tcbarExposureTime.Value = (int)model.ExposureTime; tcbarExposureTime.Value = (int)model.ExposureTime;
tcbarGain.Value = (int)model.Gain; tcbarGain.Value = (int)model.Gain;
@ -186,39 +205,81 @@ namespace LeatherApp.Page
numDefectCountLimit.Text = model.DefectCountLimit.ToString(); numDefectCountLimit.Text = model.DefectCountLimit.ToString();
swcDefectPauseForUser.Active = model.DefectPauseForUser; swcDefectPauseForUser.Active = model.DefectPauseForUser;
uiSwitch1.Active = model.OpenThicknessDetection;
uiNumPadTextBox1.Text = model.ThicknessDetectionStopDis.ToString();
//uiDataGridView fill //uiDataGridView fill
string code; string code;
QualifiedLimit item1; QualifiedLimit item1;
for (int i = 0; i < uiDataGridView1.Rows.Count; i++) for (int i = 0; i < uiDataGridView1.Rows.Count; i++)
{ {
code = uiDataGridView1.Rows[i].Cells["col_code"].Value.ToString(); code = uiDataGridView1.Rows[i].Cells["col_code"].Value.ToString();
item1 = model.QualifiedLimitList.FirstOrDefault(m=>m.Code == code); item1 = model.QualifiedLimitList.FirstOrDefault(m => m.Code == code);
if (item1 != null) if (item1 != null)
{ {
uiDataGridView1.Rows[i].Cells["col_zxd"].Value=item1.ZXD; uiDataGridView1.Rows[i].Cells["col_zxd"].Value = item1.ZXD;
uiDataGridView1.Rows[i].Cells["col_area"].Value = item1.Area * 100; uiDataGridView1.Rows[i].Cells["col_area"].Value = item1.Area * 100;
uiDataGridView1.Rows[i].Cells["col_contrast_top"].Value = ContrastToPercent(item1.ContrastTop); uiDataGridView1.Rows[i].Cells["col_contrast_top"].Value = ContrastToPercent(item1.ContrastTop);
uiDataGridView1.Rows[i].Cells["col_contrast_lower"].Value = ContrastToPercent(item1.ContrastLower); uiDataGridView1.Rows[i].Cells["col_contrast_lower"].Value = ContrastToPercent(item1.ContrastLower);
uiDataGridView1.Rows[i].Cells["col_IsOR"].Value = item1.IsOR; uiDataGridView1.Rows[i].Cells["col_IsOR"].Value = item1.IsOR;
//uiDataGridView1.Rows[i].Cells["col_Len"].Value = item1.DefectWarnLength; uiDataGridView1.Rows[i].Cells["col_Len"].Value = item1.DefectWarnLength;
//uiDataGridView1.Rows[i].Cells["col_Cnt"].Value = item1.DefectWarnCnt; uiDataGridView1.Rows[i].Cells["col_Cnt"].Value = item1.DefectWarnCnt;
}
}
GradeLimit item2;
for (int i = 0; i < uiDataGridView2.Rows.Count; i++)
{
code = uiDataGridView2.Rows[i].Cells["col2_code"].Value.ToString();
item2 = model.GradeLimitList.FirstOrDefault(m => m.Code == code);
if (item2 != null)
{
uiDataGridView2.Rows[i].Cells["col2_1"].Value = item2.A;
uiDataGridView2.Rows[i].Cells["col2_2"].Value = item2.B;
uiDataGridView2.Rows[i].Cells["col2_3"].Value = item2.C;
uiDataGridView2.Rows[i].Cells["col2_4"].Value = item2.D;
uiDataGridView2.Rows[i].Cells["col2_5"].Value = item2.E;
} }
} }
if (model.GradeLimitList != null)
{
uiDataGridView2.Rows.Clear();
for (int i = 0; i < model.GradeLimitList.Count; i++)
{
code = model.GradeLimitList[i].Code;
string name = model.GradeLimitList[i].CodeName;
//color = item.Value<string>("color");
int rpwIndex = uiDataGridView2.Rows.Add();
List<string> a1 = new List<string>();
int index = 0;
a1.Add("所有缺陷");
foreach (JObject item in Config.defectItemList)
{
if(!Config.SkipLabelGrade.Contains(item.Value<string>("code")))
a1.Add(item.Value<string>("name"));
}
DataGridViewComboBoxCell boxCell = uiDataGridView2.Rows[rpwIndex].Cells[1] as DataGridViewComboBoxCell;
boxCell.DataSource = null;
boxCell.Items.Clear();
boxCell.DataSource = a1;
//boxCell.DisplayMember = "Value";
//boxCell.ValueMember = "Value";
boxCell.Value = a1.FirstOrDefault();
uiDataGridView2.Rows[uiDataGridView2.RowCount - 1].HeaderCell.Value = name;
uiDataGridView2[0, uiDataGridView2.RowCount - 1].Value = code;
uiDataGridView2[1, uiDataGridView2.RowCount - 1].Value = name;
uiDataGridView2.Rows[uiDataGridView2.RowCount - 1].Cells["col2_1"].Value = model.GradeLimitList[i].A;
uiDataGridView2.Rows[uiDataGridView2.RowCount - 1].Cells["col2_2"].Value = model.GradeLimitList[i].B;
uiDataGridView2.Rows[uiDataGridView2.RowCount - 1].Cells["col2_3"].Value = model.GradeLimitList[i].C;
uiDataGridView2.Rows[uiDataGridView2.RowCount - 1].Cells["col2_4"].Value = model.GradeLimitList[i].D;
uiDataGridView2.Rows[uiDataGridView2.RowCount - 1].Cells["col2_5"].Value = model.GradeLimitList[i].E;
uiDataGridView2.Rows[uiDataGridView2.RowCount - 1].Cells["col2_6"].Value = model.GradeLimitList[i].JudgeLength;
}
}
//GradeLimit item2;
//for (int i = 0; i < uiDataGridView2.Rows.Count; i++)
//{
// string codeName = uiDataGridView2.Rows[i].Cells["col2_Item"].Value.ToString();
// item2 = model.GradeLimitList[i];
// if (item2 != null)
// {
// uiDataGridView2.Rows[i].Cells["col2_1"].Value = item2.A;
// uiDataGridView2.Rows[i].Cells["col2_2"].Value = item2.B;
// uiDataGridView2.Rows[i].Cells["col2_3"].Value = item2.C;
// uiDataGridView2.Rows[i].Cells["col2_4"].Value = item2.D;
// uiDataGridView2.Rows[i].Cells["col2_5"].Value = item2.E;
// uiDataGridView2.Rows[i].Cells["col2_6"].Value = item2.JudgeLength;
// }
//}
// //
this.btnSave.Visible = this.btnReload.Visible = true; this.btnSave.Visible = this.btnReload.Visible = true;
} }
@ -238,6 +299,7 @@ namespace LeatherApp.Page
this.btnSave.Visible = true; this.btnSave.Visible = true;
this.btnReload.Visible = false; this.btnReload.Visible = false;
this.ckIsCut.Checked = false;
// //
uiDataGridView1.Rows.Clear(); uiDataGridView1.Rows.Clear();
uiDataGridView2.Rows.Clear(); uiDataGridView2.Rows.Clear();
@ -273,15 +335,39 @@ namespace LeatherApp.Page
//uiDataGridView2.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable; //uiDataGridView2.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
uiDataGridView2.Columns[0].Visible = false; uiDataGridView2.Columns[0].Visible = false;
//加行 //加行
foreach (JObject item in Config.defectItemList) //if (!model.IsAllDefectGetGradeLimit)
//{
// foreach (JObject item in Config.defectItemList)
// {
// code = item.Value<string>("code");
// name = item.Value<string>("name");
// //color = item.Value<string>("color");
// uiDataGridView2.Rows.Add();
// uiDataGridView2.Rows[uiDataGridView2.RowCount - 1].HeaderCell.Value = name;
// uiDataGridView2[0, uiDataGridView2.RowCount - 1].Value = code;
// }
//}
//else
//{
// code = "All";
// name = "全部缺陷";
// //color = item.Value<string>("color");
// uiDataGridView2.Rows.Add();
// uiDataGridView2.Rows[uiDataGridView2.RowCount - 1].HeaderCell.Value = name;
// uiDataGridView2[0, uiDataGridView2.RowCount - 1].Value = code;
//}
if(model.GradeLimitList != null)
{ {
code = item.Value<string>("code"); for (int i = 0; i < model.GradeLimitList.Count; i++)
name = item.Value<string>("name"); {
//color = item.Value<string>("color"); code = model.GradeLimitList[i].Code;
uiDataGridView2.Rows.Add(); name = model.GradeLimitList[i].CodeName;
uiDataGridView2.Rows[uiDataGridView2.RowCount - 1].HeaderCell.Value = name; //color = item.Value<string>("color");
uiDataGridView2[0, uiDataGridView2.RowCount - 1].Value = code; uiDataGridView2.Rows.Add();
} uiDataGridView2.Rows[uiDataGridView2.RowCount - 1].HeaderCell.Value = name;
uiDataGridView2[0, uiDataGridView2.RowCount - 1].Value = code;
}
}
} }
private void FProductInfo_Initialize(object sender, EventArgs e) private void FProductInfo_Initialize(object sender, EventArgs e)
{ {
@ -327,6 +413,14 @@ namespace LeatherApp.Page
model.DefectCountLimit = int.Parse(numDefectCountLimit.Text.Trim()); model.DefectCountLimit = int.Parse(numDefectCountLimit.Text.Trim());
model.DefectPauseForUser = swcDefectPauseForUser.Active; model.DefectPauseForUser = swcDefectPauseForUser.Active;
model.OpenThicknessDetection = uiSwitch1.Active;
model.IsHintCutting = ckIsCut.Checked;
int ival;
if (int.TryParse(uiNumPadTextBox1.Text, out ival))
model.ThicknessDetectionStopDis = int.Parse(uiNumPadTextBox1.Text.Trim());
else
model.ThicknessDetectionStopDis = 0;
//datagrid //datagrid
if (model.QualifiedLimitList == null) if (model.QualifiedLimitList == null)
model.QualifiedLimitList = new List<Models.QualifiedLimit>(); model.QualifiedLimitList = new List<Models.QualifiedLimit>();
@ -344,8 +438,8 @@ namespace LeatherApp.Page
ContrastTop = Utils.Util.IsDecimal(uiDataGridView1.Rows[i].Cells["col_contrast_top"].Value) ? PercentToContrast(Convert.ToDouble(uiDataGridView1.Rows[i].Cells["col_contrast_top"].Value)) : 0, ContrastTop = Utils.Util.IsDecimal(uiDataGridView1.Rows[i].Cells["col_contrast_top"].Value) ? PercentToContrast(Convert.ToDouble(uiDataGridView1.Rows[i].Cells["col_contrast_top"].Value)) : 0,
IsOR = Convert.ToBoolean(uiDataGridView1.Rows[i].Cells["col_IsOR"].Value), IsOR = Convert.ToBoolean(uiDataGridView1.Rows[i].Cells["col_IsOR"].Value),
//DefectWarnLength = Utils.Util.IsDecimal(uiDataGridView1.Rows[i].Cells["col_Len"].Value) ? (int)Convert.ToDouble(uiDataGridView1.Rows[i].Cells["col_Len"].Value) : 0, DefectWarnLength = Utils.Util.IsDecimal(uiDataGridView1.Rows[i].Cells["col_Len"].Value) ? (int)Convert.ToDouble(uiDataGridView1.Rows[i].Cells["col_Len"].Value) : 0,
//DefectWarnCnt = Utils.Util.IsDecimal(uiDataGridView1.Rows[i].Cells["col_Cnt"].Value) ? (int)Convert.ToDouble(uiDataGridView1.Rows[i].Cells["col_Cnt"].Value) : 0, DefectWarnCnt = Utils.Util.IsDecimal(uiDataGridView1.Rows[i].Cells["col_Cnt"].Value) ? (int)Convert.ToDouble(uiDataGridView1.Rows[i].Cells["col_Cnt"].Value) : 0,
ModifyUserCode = Config.loginUser.Code, ModifyUserCode = Config.loginUser.Code,
CreateUserCode = Config.loginUser.Code CreateUserCode = Config.loginUser.Code
@ -364,12 +458,15 @@ namespace LeatherApp.Page
model.GradeLimitList.Add( model.GradeLimitList.Add(
new Models.GradeLimit() new Models.GradeLimit()
{ {
Code = uiDataGridView2.Rows[i].Cells["col2_code"].Value.ToString(), Code = uiDataGridView2.Rows[i].Cells["col2_Item"].Value.ToString() == "所有缺陷"? "All": Config.getDefectCode(uiDataGridView2.Rows[i].Cells["col2_Item"].Value.ToString()),
CodeName = uiDataGridView2.Rows[i].Cells["col2_Item"].Value.ToString(),
A = Utils.Util.IsNumber(uiDataGridView2.Rows[i].Cells["col2_1"].Value)? Convert.ToInt32(uiDataGridView2.Rows[i].Cells["col2_1"].Value) : 0, A = Utils.Util.IsNumber(uiDataGridView2.Rows[i].Cells["col2_1"].Value)? Convert.ToInt32(uiDataGridView2.Rows[i].Cells["col2_1"].Value) : 0,
B = Utils.Util.IsNumber(uiDataGridView2.Rows[i].Cells["col2_2"].Value) ? Convert.ToInt32(uiDataGridView2.Rows[i].Cells["col2_2"].Value) : 0, B = Utils.Util.IsNumber(uiDataGridView2.Rows[i].Cells["col2_2"].Value) ? Convert.ToInt32(uiDataGridView2.Rows[i].Cells["col2_2"].Value) : 0,
C = Utils.Util.IsNumber(uiDataGridView2.Rows[i].Cells["col2_3"].Value) ? Convert.ToInt32(uiDataGridView2.Rows[i].Cells["col2_3"].Value) : 0, C = Utils.Util.IsNumber(uiDataGridView2.Rows[i].Cells["col2_3"].Value) ? Convert.ToInt32(uiDataGridView2.Rows[i].Cells["col2_3"].Value) : 0,
D = Utils.Util.IsNumber(uiDataGridView2.Rows[i].Cells["col2_4"].Value) ? Convert.ToInt32(uiDataGridView2.Rows[i].Cells["col2_4"].Value) : 0, D = Utils.Util.IsNumber(uiDataGridView2.Rows[i].Cells["col2_4"].Value) ? Convert.ToInt32(uiDataGridView2.Rows[i].Cells["col2_4"].Value) : 0,
E = Utils.Util.IsNumber(uiDataGridView2.Rows[i].Cells["col2_5"].Value) ? Convert.ToInt32(uiDataGridView2.Rows[i].Cells["col2_5"].Value) : 0, E = Utils.Util.IsNumber(uiDataGridView2.Rows[i].Cells["col2_5"].Value) ? Convert.ToInt32(uiDataGridView2.Rows[i].Cells["col2_5"].Value) : 0,
JudgeLength = Utils.Util.IsDecimal(uiDataGridView2.Rows[i].Cells["col2_6"].Value) ? Convert.ToDouble(uiDataGridView2.Rows[i].Cells["col2_6"].Value) : 0,
ModifyUserCode = Config.loginUser.Code, ModifyUserCode = Config.loginUser.Code,
CreateUserCode = Config.loginUser.Code CreateUserCode = Config.loginUser.Code
}); });
@ -468,5 +565,114 @@ namespace LeatherApp.Page
{ {
btnDefectOption.Enabled = swcDefectPauseForUser.Active; btnDefectOption.Enabled = swcDefectPauseForUser.Active;
} }
private void ckGradeLimeIsAllDefectCnt_CheckedChanged(object sender, EventArgs e)
{
#if false
if(ckIsCut.Checked)
{
uiDataGridView2.Rows.Clear();
string code = "All";
string name = "全部缺陷";
//color = item.Value<string>("color");
uiDataGridView2.Rows.Add();
uiDataGridView2.Rows[uiDataGridView2.RowCount - 1].HeaderCell.Value = name;
uiDataGridView2[0, uiDataGridView2.RowCount - 1].Value = code;
}
else
{
uiDataGridView2.Rows.Clear();
foreach (JObject item in Config.defectItemList)
{
string code = item.Value<string>("code");
string name = item.Value<string>("name");
//color = item.Value<string>("color");
uiDataGridView2.Rows.Add();
uiDataGridView2.Rows[uiDataGridView2.RowCount - 1].HeaderCell.Value = name;
uiDataGridView2[0, uiDataGridView2.RowCount - 1].Value = code;
}
}
GradeLimit item2;
if (model != null && model.GradeLimitList!=null)
{
for (int i = 0; i < uiDataGridView2.Rows.Count; i++)
{
string code = uiDataGridView2.Rows[i].Cells["col2_code"].Value.ToString();
item2 = model.GradeLimitList.FirstOrDefault(m => m.Code == code);
if (item2 != null)
{
uiDataGridView2.Rows[i].Cells["col2_1"].Value = item2.A;
uiDataGridView2.Rows[i].Cells["col2_2"].Value = item2.B;
uiDataGridView2.Rows[i].Cells["col2_3"].Value = item2.C;
uiDataGridView2.Rows[i].Cells["col2_4"].Value = item2.D;
uiDataGridView2.Rows[i].Cells["col2_5"].Value = item2.E;
}
}
}
#endif
}
private void FProductInfo_Shown(object sender, EventArgs e)
{
ckIsCut.Top = 2;
btnAddGrade.Top = 3;
btnDelGrade.Top = 3;
}
/// <summary>
/// 新增判定条件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnAddGrade_Click(object sender, EventArgs e)
{
int rpwIndex = uiDataGridView2.AddRow();
List<string> a1 = new List<string>();
int index = 0;
a1.Add("所有缺陷");
foreach (JObject item in Config.defectItemList)
{
if (!Config.SkipLabelGrade.Contains(item.Value<string>("code")))
a1.Add(item.Value<string>("name"));
}
DataGridViewComboBoxCell boxCell = uiDataGridView2.Rows[rpwIndex].Cells[1] as DataGridViewComboBoxCell;
boxCell.DataSource = null;
boxCell.Items.Clear();
boxCell.DataSource = a1;
//boxCell.DisplayMember = "Value";
//boxCell.ValueMember = "Value";
boxCell.Value = a1.FirstOrDefault();
}
/// <summary>
/// 删除判断条件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
/// <exception cref="Exception"></exception>
private void btnDelGrade_Click(object sender, EventArgs e)
{
try
{
if (this.uiDataGridView2.SelectedRows.Count != 1)
throw new Exception("请选择要删除的判断条件!");
int liRowIndex = this.uiDataGridView2.SelectedRows[0].Index;
uiDataGridView2.Rows.RemoveAt(liRowIndex);
}
catch (Exception ex)
{
UIMessageTip.ShowError(ex.Message, 2000);
}
}
private void FProductInfo_Paint(object sender, PaintEventArgs e)
{
ckIsCut.Top = 2;
btnAddGrade.Top = 3;
btnDelGrade.Top = 3;
}
} }
} }

View File

@ -144,6 +144,9 @@
<metadata name="col2_code.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="col2_code.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="col2_Item.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="col2_1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="col2_1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
@ -159,4 +162,69 @@
<metadata name="col2_5.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="col2_5.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="col2_6.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="btnAddGrade.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAL2SURBVFhHvZfLTxNBHMd7MBSiAWw1Hkg8ocZ4qSZejBdjTAwxRgwXTYyRqFgL8rS8Ke+HvORV
ihXFt140SjiJJhrDG1pqKUX/mJ/zm91ZhmUGJqbdSb4Hkp1+PvPb3/52samuPbk2UA25PJtkH92YqIU/
7At7d40u4CFBicQtJjDxNwjjfwIwtjEM/vgADMZ6oH+tC7qjbbxAP4mLbkzUYgLBDT8E4kMwsv6Ywnuj
HfDodyt0RJqsERiND8Lweh8MxLoNePtqIzSH66wRGIr10pL3RNuhK9ICrasN0BSuhYaVSmsE+tY66ak7
I80U7gtVQ/2KF6qXy6wR2FJyAq9droCqpVKoWCyyRqBt1WeUHOHepWIoX/BAybzbGgG+5AgvW7gPD+YK
wDN7+/8EcINqEMCXvHTBDUVzd8E9mw8FMzcNAdUQfPbmyRSDp65YLKQlL5y7A+6ZW3B5+gKcnjwhvF4W
XcBjCLDBgl2OU411eWOoRlryS9PnwfX5CBx6vxcOvkvbOW/T4MCbNHC+SOUF+g0B82BpCdfT+1238tAo
OcKx5LnfLsLJL8fEIHMImMJfa3DHuF0swAYL63JfqMroclbyGz/z4MyUC7I+ZIhhonDw/U/tkDkqETCX
vGa53Ch58fw9yPl6Do5+zBJDZKHwVHBOMHgKpA+liAVkJc//dR3OTp1Su898eHjQDhl+DZ4+KBFgJa9c
KjFKfu3HFdpkQsBOQfgrDj6yCc8YlgiYS371ew4c/3RYDJAFwaTTEe54TuBPdPiAFoRnBiQ9oBohWI/o
elm2CKgGN4rAGDw5+2HVUAGy8NsNv+HwD2lwg0yAlZ072SRJkN8vCXLp1ytK4MtDGqEAu+cvtXvOCSA8
j98vifqH6zYBU8NljpmaSwMkbm0RIHD2qDmeafBtj1cyBYyTc3B8zKwRYCfXy87g2yZcsgToiwUnHA4Z
hBMwnXBk4Fgi4CQdjy8WOts5OApZIrBbkiqgGnJ54gXIUpqYehT/O7bZ/gFBYsFOotAh6wAAAABJRU5E
rkJggg==
</value>
</data>
<data name="btnDelGrade.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAhdSURBVFhHtZd5WNVlFsevcrlw4XLvBS6gXuGiKOXomAtuiBgolKW5IYqoCLlh7pa5lWVqzqNO
OWNazqO5pVJZimu5g47oTJbkPowLsuOIoNIT+fSd73nhIsii/tF5ns/jz9/9ved7znnPu6D5Iy3W19fE
fxpU8GwWb7OB/MLHAOKqXj6DjbbZTo9t0QJNnJ3b8b9G8vRBULjo7u59yPx8E5hFIV91IS7qx6cwiu85
MH0mSg8dhQTRyNn5Nb62V6Nuo3BDyVzEi1Z9iuJNW5G5bgNG+PqW8OfO5IlBUPzwfoqXJO1A3hvTUfr9
YYwLDESgwTCSP7uT2oOgsDbB3x+/nDqNO6vWoHDhhyh8fwnufr4Z+V8kgY5/42fdiEENqMX4zYWjs2aj
ZPtXyJs4DbkTpiB33CQ8OHAQE1u3RkuDIY6feZKaQUjmIn77g6Xl4u8tRuGCRSh89wMUffIZ7u37DnF+
fhJEMKnRExQ/+9PCxSjZsh25iVORO34ycse+gdwxE5GTMAEP9h7AGE6Hl5PTIH7+qBIU1pHS+weP4H/L
PlZZ24UL31mIgnnvoWDuAtxdux7XV6/FcF/f2xxWrScovnvv5Gkqc3vWSpzCOaPHIXvk68iOjceD5L1I
CAiAv6vrMA4zkwaahObNP90yIRGlh489ylqE57+vhAvmvIuCt+ejYNY83P1sHTJWrkJM06bSmEHEJc5m
27lr4mTc45xXzTo7fjyyR41RwlnDRuHWkFjcYYLHJk/FwMaNszm2BzFogj09A+JbtMi68NHfULL1y2pZ
F8x+RwnnvzUX+TNnI38G55ffpMyZh8FWa0aU1bprY1w87n+bXJ61lJvClVnHxOHW0JHIHBSDnMQpuLls
BUYFBj7kqthP8RHEm2j03k5OoSMCArLPr/gYxVu2Vcs6/805Sjh/+tvIm/oW8qa8iZLN23CczbYhbnS5
uGT9emK5cEXWSnhwDG72j0b2mETcWPIXRDdrVubh6HiMmh+SMCL7g2oGNzZH+KiAgIIMroDijV9Uyzp/
2iwlnDd5plpa0mTFG7bg/je7KptMxHMk6+GjcSt6BDIHDsPNfoORJRVhYlH+/g/dy8WXkkjiRRoSZRKE
gWt1YHzLlkU/L12G4vWbHmVdIVx1aVVmXaXkWVLyqOHI7D8E1/sMQFbcWGQsWIghzZr97q3TpVFjGXmJ
yFKsFLebBGFs7Ozcd7i/f046S1a8eSvyJs2ozPrxpaWEY0YjM7Ifrnfqgf8EtsWlxs2QbvLB1c49cHZw
NCIsljIPnS6VvpeTvkTmvYa43SQIs7tO1yvGZss+MXe+KvXjWd/qF4XrnUOR4d8KVwzeuKhxwXmNHufI
WY0zLrfpiP2hYQj38CgzarVH6VPK3of4EAdSr6mecNNqQ9jl11Jnz0Xxuo0q0xshvZFhex6XHU24RFE7
F0g6xX/UOOHynztiX0hPdDebSw1a7SH6Wkx6EwupM/PHTYKQ3S5IdsgSnglXLb7VRO1I9hLAOWb+bwaQ
N2Umwt3dYXBwkMwXkXBS65w/yRqM8vPb8ffgEBSyGWsTF0T8Z2b/EwP4FwO42LEb1rRqjfZubkX0kUCa
ii9x+EzG7TV5edt29YoL9vmXAM5odEjVOCK9TXt81PI5dHBzk237qU7RasbtdffqDp1QyPUvGVZFBAV7
AOeJVECa77QKQIfDDOKH51pjbas2CDIaJQi1bSvnTzKW/YdV7Toin0uu3LngrEQk03KqB2VvwDMkleIH
NVrsI2l+zTkdbRBsNP5K13KA1X+z4u3nQnJouFrj0lRS1h+JZCfIs7yX5XYzoi9yYhMq5l/PBiyvwHEG
8D3F92gcsIuctPohLSwSwSaT/Siv/T4xzGo9urZ9kNpCpZslm9MkjZyi4zQiAtJo13pGYGfPcKzh93LS
SWDy/p9VAkim+DfkK01DHDJ5Yk9QVwSbzfcpJZea6pUYarXuX966LU+tYUroBEmho2PkKJ0dIfIs764E
BSOpa3dEenndC7NYbq98oT1uDRiqgpUA5LvvVABaijtgOwNIIsd9rNjctgNCPTzuUPLRfWJokybLxnOt
54yfhJMVDg5xsDg5QAf7yT4i/z/jbUVKr0j0tlh+5SYjR+pfI7y8cv7BSmT0jKwcLxXYzTE7SJKiIb4m
517ohEUtAhHu6XmdYzsSveZFi6V7X29v/Jcn2ElXkxosguJAypjMgfKcarbgSEgoeri7lxkdHWWTWUgi
XR0cIhhQ1no27pWg7qpKh+lDAt/JsTIFX/L5W3IjKgZh3KRser2cDbFE3Qdc/FxcRorjS31ewyEnVwo2
ZAMJ5UEcM3riYJdgdDYay7hFi/gS0ovI3c5g0mpDmVXWOu4blzp0ZRW0KhEJQoIXP9cGDEE3oxE8Fc9y
zEryasV4tUVaGjs5TenCD25Ex6og9nKQkMoGOhP+EkLM5t/Njo4n+K0cLBHEvr3KLmfw0ukiIy2WO193
6oLL7BNpRqmETN1N+uRShI+TUzq/XUWiiOyQWqJMBeGr18/tZjIh/ZV+SNG74ZSHD1Je7I0Qd/eHlvLz
fAWRU+3xg0UdYBw/mEEUbOwQhKtdeqg9ISt+HHqazfIX0kV+s5pEk2ridhOHPk2dnWfwGP3t8tARSHu1
P3p7epbxJnOcv8llQs5zOVKrittNgjCxSi/38fbO2dK5K/J5ML3s5QXeMSRzEZfbsI3UELebnNU+bJLE
AY0aYSBh5il8J2WXm4w0TX3nuQRhZBDh/Rs1KhrE8U31eplzKbtkLuKOpF5T09HOZJrT0tV1G5/lPK+t
7HWZ6onnDYaYP7m5JfFZLqA15vxJJkKSrexasn3WVfa6TIKQPzzak+6kDnGN5v99JuudP3lCrAAAAABJ
RU5ErkJggg==
</value>
</data>
</root> </root>

View File

@ -17,6 +17,7 @@ using System.Linq.Expressions;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using static System.Windows.Forms.AxHost;
namespace LeatherApp.Page namespace LeatherApp.Page
{ {
@ -148,7 +149,7 @@ namespace LeatherApp.Page
//绘图1 //绘图1
double len = Math.Round(record.Len*100, 2);//cm double len = Math.Round(record.Len*100, 2);//cm
this.reDrawDefectPoints(record.DefectInfoList, new double[] { 0, Math.Round(record.FaceWidthMax + 0.005f, 2) }, new double[] { 0, len }); this.reDrawDefectPoints(record.DefectInfoList, new double[] { 0, Math.Round(record.FaceWidthMax + 0.005f, 2) }, new double[] { 0, len + 20 }, record.GradeDifferentiateInfoList);
//绘图2 //绘图2
//var points = Array.ConvertAll(record.FaceWidthListStr.Split(new[] { ',', }, StringSplitOptions.RemoveEmptyEntries),Double.Parse).ToList(); //var points = Array.ConvertAll(record.FaceWidthListStr.Split(new[] { ',', }, StringSplitOptions.RemoveEmptyEntries),Double.Parse).ToList();
//reDrawFaceWidth(record.FacePointList, //reDrawFaceWidth(record.FacePointList,
@ -747,7 +748,7 @@ namespace LeatherApp.Page
/// <param name="lstDefectInfo">Records.DefectInfoList</param> /// <param name="lstDefectInfo">Records.DefectInfoList</param>
/// <param name="XSizeRange">幅宽</param> /// <param name="XSizeRange">幅宽</param>
/// <param name="YSizeRange">卷长度</param> /// <param name="YSizeRange">卷长度</param>
private void reDrawDefectPoints(List<DefectInfo> lstDefectInfo, double[] XSizeRange, double[] YSizeRange) private void reDrawDefectPoints(List<DefectInfo> lstDefectInfo, double[] XSizeRange, double[] YSizeRange, List<GradeDifferentiateInfo> listGrade)
{ {
UILineOption option; UILineOption option;
//AddTextEvent($"绘图", $"缺陷分布, W={string.Join(", ", XSizeRange)},H={string.Join(", ", YSizeRange)}, LastData={JsonConvert.SerializeObject(lstDefectInfo[lstDefectInfo.Count - 1])}"); //AddTextEvent($"绘图", $"缺陷分布, W={string.Join(", ", XSizeRange)},H={string.Join(", ", YSizeRange)}, LastData={JsonConvert.SerializeObject(lstDefectInfo[lstDefectInfo.Count - 1])}");
@ -821,7 +822,16 @@ namespace LeatherApp.Page
} }
series.Add(item.CentreX, item.CentreY / 100); //cm -> m series.Add(item.CentreX, item.CentreY / 100); //cm -> m
} }
if (listGrade != null)
{
foreach (var item in listGrade)
{
// 设置裁切提示线
option.YAxisScaleLines.Add(new UIScaleLine() { Color = Color.DarkRed, Name = $"{item.GradeCode}-裁切起点-{item.StartY}", Value = item.StartY });
option.YAxisScaleLines.Add(new UIScaleLine() { Color = Color.DarkRed, Name = $"{item.GradeCode}-裁切终点-{item.EndY}", Value = item.EndY });
}
}
//==== //====
//option.GreaterWarningArea = new UILineWarningArea(3.5); //option.GreaterWarningArea = new UILineWarningArea(3.5);
//option.LessWarningArea = new UILineWarningArea(2.2, Color.Gold); //option.LessWarningArea = new UILineWarningArea(2.2, Color.Gold);

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示: //通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.2.9")] [assembly: AssemblyVersion("1.0.2.10")]
[assembly: AssemblyFileVersion("1.0.2.9")] [assembly: AssemblyFileVersion("1.0.2.10")]

View File

@ -1,9 +1,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Security.Cryptography;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Xaml; using System.Xaml;
using DocumentFormat.OpenXml.EMMA;
using DocumentFormat.OpenXml.Vml; using DocumentFormat.OpenXml.Vml;
using OpenCvSharp; using OpenCvSharp;
namespace LeatherApp.Utils namespace LeatherApp.Utils
@ -13,9 +15,14 @@ namespace LeatherApp.Utils
public static Mat resize(Mat mat, int width, int height, out int xw, out int xh) public static Mat resize(Mat mat, int width, int height, out int xw, out int xh)
{ {
OpenCvSharp.Size dsize = new OpenCvSharp.Size(width, height); OpenCvSharp.Size dsize = new OpenCvSharp.Size(width, height);
Mat mat2 = new Mat(); //Mat mat2 = new Mat();
//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;
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);
mat.CopyTo(new Mat(mat2, roi));
return mat2; return mat2;
} }
public static int ResizeUniform(Mat src, Size dst_size, out Mat dst, out int xw, out int xh) public static int ResizeUniform(Mat src, Size dst_size, out Mat dst, out int xw, out int xh)

View File

@ -44,3 +44,23 @@ Global捕获到未处理异常System.ArgumentException
在 System.Windows.Forms.Control.WndProc(Message& m) 在 System.Windows.Forms.Control.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) 在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
2024-06-19 16:06:47
Global捕获到未处理异常System.Threading.ThreadAbortException
异常信息:正在中止线程。
异常堆栈: 在 System.Windows.Forms.SafeNativeMethods.MessageBox(HandleRef hWnd, String text, String caption, Int32 type)
在 System.Windows.Forms.MessageBox.ShowCore(IWin32Window owner, String text, String caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, Boolean showHelp)
在 System.Windows.Forms.DataGridView.OnDataError(Boolean displayErrorDialogIfNoHandler, DataGridViewDataErrorEventArgs e)
在 System.Windows.Forms.DataGridViewComboBoxCell.GetFormattedValue(Object value, Int32 rowIndex, DataGridViewCellStyle& cellStyle, TypeConverter valueTypeConverter, TypeConverter formattedValueTypeConverter, DataGridViewDataErrorContexts context)
在 System.Windows.Forms.DataGridViewCell.GetEditedFormattedValue(Object value, Int32 rowIndex, DataGridViewCellStyle& dataGridViewCellStyle, DataGridViewDataErrorContexts context)
在 System.Windows.Forms.DataGridViewCell.PaintWork(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, Int32 rowIndex, DataGridViewElementStates cellState, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
在 System.Windows.Forms.DataGridViewRow.PaintCells(Graphics graphics, Rectangle clipBounds, Rectangle rowBounds, Int32 rowIndex, DataGridViewElementStates rowState, Boolean isFirstDisplayedRow, Boolean isLastVisibleRow, DataGridViewPaintParts paintParts)
在 System.Windows.Forms.DataGridViewRow.Paint(Graphics graphics, Rectangle clipBounds, Rectangle rowBounds, Int32 rowIndex, DataGridViewElementStates rowState, Boolean isFirstDisplayedRow, Boolean isLastVisibleRow)
在 System.Windows.Forms.DataGridView.PaintRows(Graphics g, Rectangle boundingRect, Rectangle clipRect, Boolean singleHorizontalBorderAdded)
在 System.Windows.Forms.DataGridView.PaintGrid(Graphics g, Rectangle gridBounds, Rectangle clipRect, Boolean singleVerticalBorderAdded, Boolean singleHorizontalBorderAdded)
在 System.Windows.Forms.DataGridView.OnPaint(PaintEventArgs e)
在 Sunny.UI.UIDataGridView.OnPaint(PaintEventArgs e)
在 System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
在 System.Windows.Forms.Control.WmPaint(Message& m)
在 System.Windows.Forms.Control.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

View File

@ -1,14 +1,26 @@
[ [
{ {
"code": "SHNY-PX", "code": 0,
"name": "超纤皮" "name": "绒面"
}, },
{ {
"code": "AGNY-ST", "code": 1,
"name": "纤皮" "name": "非绒面"
}, },
{ {
"code": "", "code": 2,
"name": "未知" "name": "未知1"
},
{
"code": 3,
"name": "未知2"
},
{
"code": 4,
"name": "未知3"
},
{
"code": 5,
"name": "未知4"
} }
] ]

View File

@ -25,6 +25,11 @@ ScannerReversalX=false
ScannerReversalY=true ScannerReversalY=true
[Material] [Material]
SuedeList=BSF,SF,SL,SD SuedeList=BSF,SF,SL,SD
SuedeList2=
SuedeList3=
SuedeList4=
SuedeList5=
SuedeList6=
[LIB] [LIB]
model_path=./models/best_0805_bs8.onnx model_path=./models/best_0805_bs8.onnx
labels_path=./models/hexin.names labels_path=./models/hexin.names
@ -43,3 +48,5 @@ ErpDBConStr=connectionString="Server=127.0.0.1;Database=testDB;User Id=sa;Passwo
ErpSql=select * from t2 where 1=1 ErpSql=select * from t2 where 1=1
[LOG] [LOG]
LogPath=F:\LeatherApp\log\ LogPath=F:\LeatherApp\log\
[SkipLabelGrade]
LabelGradeList=laji,wenchong,chongying

View File

@ -106,6 +106,12 @@ namespace Models
/// </summary> /// </summary>
[SugarColumn(IsNullable = true)] [SugarColumn(IsNullable = true)]
public double residueWarnningLen { get; set; } public double residueWarnningLen { get; set; }
/// <summary>
/// 等级判断提示裁切
/// </summary>
[SugarColumn(IsNullable = true)]
public bool IsHintCutting { get; set; }
} }
/// <summary> /// <summary>
@ -142,9 +148,8 @@ namespace Models
/// <summary> /// <summary>
/// 等级划分标准 /// 等级划分标准
/// </summary> /// </summary>
[SugarIndex("index_{table}_Pid_Code", [SugarIndex("index_{table}_Pid",
nameof(GradeLimit.Pid), OrderByType.Asc, nameof(GradeLimit.Pid), OrderByType.Asc, isUnique: true)]
nameof(GradeLimit.Code), OrderByType.Asc, isUnique: true)]
public class GradeLimit : BaseTable public class GradeLimit : BaseTable
{ {
public int Pid { get; set; } public int Pid { get; set; }
@ -152,7 +157,13 @@ namespace Models
/// dk,xws,... /// dk,xws,...
/// </summary> /// </summary>
public string Code { get; set; } public string Code { get; set; }
public string CodeName { get; set; }
/// <summary>
/// 等级判定长度 0no do
/// </summary>
public double JudgeLength { get; set; }
//此等级上限缺陷数 //此等级上限缺陷数
public int A { get; set; } public int A { get; set; }
public int B { get; set; } public int B { get; set; }

View File

@ -144,6 +144,19 @@ namespace Models
/// </summary> /// </summary>
[SugarColumn(IsIgnore = true)] [SugarColumn(IsIgnore = true)]
public int[] preWarningPhotoIndexByLabel { get; set; } = new int[50]; public int[] preWarningPhotoIndexByLabel { get; set; } = new int[50];
/// <summary>
/// 等级判定位置记录
/// </summary>
[SugarColumn(IsIgnore = true)]
public int preGradePhotoIndexByGradeIndex { get; set; } = 0;
/// <summary>
/// 整卷分级
/// </summary>
[Navigate(NavigateType.OneToMany, nameof(GradeDifferentiateInfo.Pid))]
public List<GradeDifferentiateInfo> GradeDifferentiateInfoList { get; set; }
} }
/// <summary> /// <summary>
@ -210,4 +223,52 @@ namespace Models
[SugarColumn(IsIgnore = true)] [SugarColumn(IsIgnore = true)]
public string TagFilePath { get; set; }//打标小图路径,用于二次瑕疵检测修改和忽略时的改名/删除 public string TagFilePath { get; set; }//打标小图路径,用于二次瑕疵检测修改和忽略时的改名/删除
} }
/// <summary>
/// 产品分级明细表
/// </summary>
[SugarIndex("index_{table}_pid", nameof(GradeDifferentiateInfo.Pid), OrderByType.Asc,
nameof(GradeDifferentiateInfo.GradeCode), OrderByType.Asc,
isUnique: false)]
public class GradeDifferentiateInfo : BaseTable
{
public int Pid { get; set; }
/// <summary>
/// 开始拍照id
/// </summary>
public int StartPhotoIndex { get; set; }//原图索引/文件名 0-n
/// <summary>
/// 结束拍照id
/// </summary>
public int EndPhotoIndex { get; set; }//原图索引/文件名 0-n
/// <summary>
/// 等级Code
/// </summary>
public string GradeCode { get; set; }
/// <summary>
/// 使用的区分规则
/// </summary>
public GradeLimit UseGradeLimit { get; set; }
/// <summary>
/// 缺陷数量
/// </summary>
public int DefectCnt { get; set; }
/// <summary>
/// 长度
/// </summary>
public double CutLen { get; set; }
/// <summary>
/// 开始截取位置
/// </summary>
public double StartY { get; set; }
/// <summary>
/// 结束截取位置
/// </summary>
public double EndY { get; set; }
}
} }

View File

@ -42,6 +42,7 @@ namespace Service
if (dropTable && db.DbMaintenance.IsAnyTable("GradeLimit", false)) db.DbMaintenance.DropTable("GradeLimit"); if (dropTable && db.DbMaintenance.IsAnyTable("GradeLimit", false)) db.DbMaintenance.DropTable("GradeLimit");
if (dropTable && db.DbMaintenance.IsAnyTable("Records", false)) db.DbMaintenance.DropTable("Records"); if (dropTable && db.DbMaintenance.IsAnyTable("Records", false)) db.DbMaintenance.DropTable("Records");
if (dropTable && db.DbMaintenance.IsAnyTable("DefectInfo", false)) db.DbMaintenance.DropTable("DefectInfo"); if (dropTable && db.DbMaintenance.IsAnyTable("DefectInfo", false)) db.DbMaintenance.DropTable("DefectInfo");
if (dropTable && db.DbMaintenance.IsAnyTable("GradeDifferentiateInfo", false)) db.DbMaintenance.DropTable("GradeDifferentiateInfo");
//===添加与更新表 //===添加与更新表
db.CodeFirst.InitTables<Models.Right>(); db.CodeFirst.InitTables<Models.Right>();
@ -54,6 +55,7 @@ namespace Service
db.CodeFirst.InitTables<Models.GradeLimit>(); db.CodeFirst.InitTables<Models.GradeLimit>();
db.CodeFirst.InitTables<Models.Records>(); db.CodeFirst.InitTables<Models.Records>();
db.CodeFirst.InitTables<Models.DefectInfo>(); db.CodeFirst.InitTables<Models.DefectInfo>();
db.CodeFirst.InitTables<Models.GradeDifferentiateInfo>();
//更改表数据 //更改表数据
try try

View File

@ -52,7 +52,8 @@ namespace Service
return base.AsSugarClient().Queryable<Records>() return base.AsSugarClient().Queryable<Records>()
//.Includes(m => m.ProductInfo.ToList(x => new Product() { Code = x.Code, Name = x.Name }))//,n=>n.ClassesInfo) //.Includes(m => m.ProductInfo.ToList(x => new Product() { Code = x.Code, Name = x.Name }))//,n=>n.ClassesInfo)
//.Includes(m => m.ProductInfo) //.Includes(m => m.ProductInfo)
.Includes(m => m.DefectInfoList) .Includes(m => m.DefectInfoList)
.Includes(m => m.GradeDifferentiateInfoList)
.First(m => m.Id == id); .First(m => m.Id == id);
} }
public List<Records> GetListNav(int pageNum, int pageSize, ref int totalCount, Expression<Func<Records, bool>> exp) public List<Records> GetListNav(int pageNum, int pageSize, ref int totalCount, Expression<Func<Records, bool>> exp)
@ -66,13 +67,15 @@ namespace Service
public bool InsertNav(Models.Records model) public bool InsertNav(Models.Records model)
{ {
return base.AsSugarClient().InsertNav(model) return base.AsSugarClient().InsertNav(model)
.Include(m => m.DefectInfoList) .Include(m => m.DefectInfoList)
.Include(m => m.GradeDifferentiateInfoList)
.ExecuteCommand(); .ExecuteCommand();
} }
public bool DelNav(Models.Records model) public bool DelNav(Models.Records model)
{ {
return base.AsSugarClient().DeleteNav(model) return base.AsSugarClient().DeleteNav(model)
.Include(a => a.DefectInfoList)//.ThenInclude(z1 => z1.RoomList) //插入2层 Root->ShoolA->RoomList .Include(a => a.DefectInfoList)//.ThenInclude(z1 => z1.RoomList) //插入2层 Root->ShoolA->RoomList
.Include(m => m.GradeDifferentiateInfoList)
.ExecuteCommand(); .ExecuteCommand();
} }