Compare commits

..

1 Commits

Author SHA1 Message Date
CPL
2ec7eb4a68 V1.0.10 更新等级判断 2024-07-03 09:33:12 +08:00
38 changed files with 964 additions and 7517 deletions

View File

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

View File

@ -22,11 +22,12 @@ namespace LeatherApp
public static JArray colorNameList;//, materialNameList;
//
public static JArray materialNameList;//, materialNameList;
//CMDProcess目录下的命令JSON文件
public static Dictionary<CMDName, JObject> CMDProcess;
//剩余N米提示(M)
public static int residueWarnningLen = 20;
public static int residueWarnningLen = 10;
//瑕疵暂停跳过几张图
public static int defectPauseSkipPhotoCount=5;
@ -85,7 +86,6 @@ namespace LeatherApp
//忽略的等级判断项目
public static string[] SkipLabelGrade = new string[0];
//云端
public static string cloud_ip, cloud_username, cloud_password, CloudThisName;
public static int cloud_port, cloud_open;
@ -176,10 +176,10 @@ namespace LeatherApp
//
string lsTmp = ini.ReadString("Material", "SuedeList", "").Trim();
if (!string.IsNullOrWhiteSpace(lsTmp))
SuedeList1 = lsTmp.Split(new char[] { ',', ';' });
if(!string.IsNullOrWhiteSpace(lsTmp))
SuedeList1=lsTmp.Split(new char[] { ',',';'});
else
SuedeList1 = new string[1] { "" };
SuedeList1 = new string[1] { ""};
lsTmp = ini.ReadString("Material", "SuedeList2", "").Trim();
if (!string.IsNullOrWhiteSpace(lsTmp))
@ -188,12 +188,12 @@ namespace LeatherApp
SuedeList2 = new string[1] { "" };
lsTmp = ini.ReadString("Material", "SuedeList3", "").Trim();
if (!string.IsNullOrWhiteSpace(lsTmp))
SuedeList3 = lsTmp.Split(new char[] { ',', ';' });
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[] { ',', ';' });
SuedeList4= lsTmp.Split(new char[] { ',', ';' });
else
SuedeList4 = new string[1] { "" };
lsTmp = ini.ReadString("Material", "SuedeList5", "").Trim();
@ -232,56 +232,38 @@ namespace LeatherApp
}
public static JObject getDefectItem(string code)
{
try
{
var item = Config.defectItemList.FirstOrDefault(m => m.Value<string>("code") == code);
if (item == null)
return null;
return (JObject)item;
}
catch { return null; }
var item=Config.defectItemList.FirstOrDefault(m => m.Value<string>("code")==code);
if(item==null)
return null;
return (JObject)item;
}
public static JObject getDefectItem(int id)
{
try
{
var item = Config.defectItemList.FirstOrDefault(m => m.Value<int>("id") == id);
var item = Config.defectItemList.FirstOrDefault(m => m.Value<int>("id") == id);
if (item == null)
return null;
return (JObject)item;
}
catch { return null; }
}
public static string getDefectCode(int id)
{
try
{
var item = Config.defectItemList.FirstOrDefault(m => m.Value<int>("id") == id);
if (item == null)
return "";
return ((JObject)item).Value<string>("code");
}
catch { return ""; }
var item = Config.defectItemList.FirstOrDefault(m => m.Value<int>("id") == id);
if (item == null)
return "";
return ((JObject)item).Value<string>("code");
}
public static string getDefectName(string code)
{
try {
var item = Config.defectItemList.FirstOrDefault(m => m.Value<string>("code") == code);
if (item == null)
return "";
return ((JObject)item).Value<string>("name");
}
catch { return ""; }
var item = Config.defectItemList.FirstOrDefault(m => m.Value<string>("code") == code);
if (item == null)
return "";
return ((JObject)item).Value<string>("name");
}
public static string getDefectCode(string name)
{
try {
var item = Config.defectItemList.FirstOrDefault(m => m.Value<string>("name") == name);
if (item == null)
return "";
return ((JObject)item).Value<string>("code");
}
catch { return ""; }
var item = Config.defectItemList.FirstOrDefault(m => m.Value<string>("name") == name);
if (item == null)
return "";
return ((JObject)item).Value<string>("code");
}
#endregion

View File

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

View File

@ -610,14 +610,13 @@ namespace LeatherApp.Device
CopyMemory(m_pUserBuffer, hPtr, m_nBufferSize);
m_bUpdateImage = true;
Mat mat = new Mat(m_nHeight, m_nWidth, MatType.CV_8UC3, m_pUserBuffer);
//var bmp = hBuffer.toBmp(m_pUserBuffer);
//Mat mat = OpenCvSharp.Extensions.BitmapConverter.ToMat(bmp);
//bmp.Dispose();
//bmp = null;
var bmp = hBuffer.toBmp(m_pUserBuffer);
Mat mat = OpenCvSharp.Extensions.BitmapConverter.ToMat(bmp);
bmp.Dispose();
bmp = null;
//Monitor.Enter(frameQueue);
lock (frameQueue)
frameQueue.Enqueue(new MyData(index, mat.Clone()));
frameQueue.Enqueue(new MyData(index, mat));
PhotoNumCacheEvent?.BeginInvoke(frameQueue.Count, null, null);
}
}

View File

@ -190,7 +190,6 @@ namespace LeatherApp.Device
public int GetWidthForResize(int sumWidth)
{
int count =(int) Math.Round(sumWidth * 1.0f / image_width, 0);
count = 8;
return count * image_width;
//int count = sumWidth / image_width;
@ -465,7 +464,6 @@ namespace LeatherApp.Device
List<int> xPos4 = new List<int>();
List<double> ZXD4 = new List<double>();
DefectLabelInfo stpoint = DefectLabelInfoList[0];
int colNum = Width / image_width;
@ -474,8 +472,8 @@ namespace LeatherApp.Device
{
if (Config.getDefectCode(DefectLabelInfoList[q].classId) == "jietou")
{
int max = stpoint.y + 2000;
int min = stpoint.y - 2000 > 0? stpoint.y - 2000 : 0;
int max = stpoint.y + 500;
int min = stpoint.y - 500 > 0? stpoint.y - 500:0;
if (DefectLabelInfoList[q].y >= min && DefectLabelInfoList[q].y <= max)
{
HeBingList.Add(DefectLabelInfoList[q]);
@ -487,8 +485,8 @@ namespace LeatherApp.Device
}
else if (Config.getDefectCode(DefectLabelInfoList[q].classId) == "hengdang")
{
int max = stpoint.y + 2000;
int min = stpoint.y - 2000 > 0 ? stpoint.y - 2000 : 0;
int max = stpoint.y + 500;
int min = stpoint.y - 500 > 0 ? stpoint.y - 500 : 0;
if (DefectLabelInfoList[q].y >= min && DefectLabelInfoList[q].y <= max)
{
HeBingList2.Add(DefectLabelInfoList[q]);
@ -500,8 +498,8 @@ namespace LeatherApp.Device
}
else if (Config.getDefectCode(DefectLabelInfoList[q].classId) == "jt")
{
int max = stpoint.y + 2000;
int min = stpoint.y - 2000 > 0 ? stpoint.y - 2000 : 0;
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]);
@ -513,8 +511,8 @@ namespace LeatherApp.Device
}
else if (Config.getDefectCode(DefectLabelInfoList[q].classId) == "tcy")
{
int max = stpoint.y + 2000;
int min = stpoint.y - 2000 > 0 ? stpoint.y - 2000 : 0;
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]);
@ -541,6 +539,7 @@ namespace LeatherApp.Device
if (XcHeBingList4.Count > 0)
dg4 = HeBingDefect(Width, XcHeBingList4);
//多个jietou合并
if (HeBingList.Count>0)
{
@ -548,12 +547,11 @@ namespace LeatherApp.Device
var edIt = HeBingList.Find(x => (x.i % colNum) * image_width + x.x == xPos.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 newh = Math.Abs(((edIt.i / colNum) * image_hight + edIt.y) - ((stIt.i / colNum) * image_hight + stIt.y)) + edIt.h;
outList.Add(new DefectLabelInfo() {
x=stIt.x,
y=edIt.y,
w = newW, //多图叠加
h = newh,
h = edIt.h,
classId = eZXD.classId,
confidence = eZXD.confidence,
contrast = eZXD.contrast,
@ -570,13 +568,12 @@ namespace LeatherApp.Device
var edIt = HeBingList2.Find(x => (x.i % colNum) * image_width + x.x == xPos2.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 newh = Math.Abs(((edIt.i / colNum) * image_hight + edIt.y) - ((stIt.i / colNum) * image_hight + stIt.y)) + edIt.h;
outList.Add(new DefectLabelInfo()
{
x = stIt.x,
y = edIt.y,
w = newW, //多图叠加
h = newh,
h = edIt.h,
classId = eZXD.classId,
confidence = eZXD.confidence,
contrast = eZXD.contrast,
@ -593,13 +590,12 @@ namespace LeatherApp.Device
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;
int newh = Math.Abs(((edIt.i / colNum) * image_hight + edIt.y) - ((stIt.i / colNum) * image_hight + stIt.y)) + edIt.h;
outList.Add(new DefectLabelInfo()
{
x = stIt.x,
y = edIt.y,
w = newW, //多图叠加
h = newh,
h = edIt.h,
classId = eZXD.classId,
confidence = eZXD.confidence,
contrast = eZXD.contrast,
@ -616,13 +612,12 @@ namespace LeatherApp.Device
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;
int newh = Math.Abs(((edIt.i / colNum) * image_hight + edIt.y) - ((stIt.i / colNum) * image_hight + stIt.y)) + edIt.h;
outList.Add(new DefectLabelInfo()
{
x = stIt.x,
y = edIt.y,
w = newW, //多图叠加
h = newh,
h = edIt.h,
classId = eZXD.classId,
confidence = eZXD.confidence,
contrast = eZXD.contrast,
@ -835,7 +830,7 @@ namespace LeatherApp.Device
}
#region
liStep = 3000;
liStep++;
if (DefectLabelInfoList.Count >0)
DefectLabelInfoList = HeBingDefect(task.bmp.Width, DefectLabelInfoList);
liStep++;
@ -898,6 +893,7 @@ namespace LeatherApp.Device
task.resultInfo += $" 判断为接头处横档,跳过! \n";
continue;
}
if (Config.getDefectCode(DefectLabelInfoListByClassID[q].classId) == "na")
{
task.resultInfo += $" 判断为正向标签na跳过 \n";
@ -908,6 +904,18 @@ namespace LeatherApp.Device
}
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 point2 = new OpenCvSharp.Point(point1.X + DefectLabelInfoListByClassID[q].w, point1.Y + DefectLabelInfoListByClassID[q].h);
liStep++;//2

View File

@ -118,9 +118,11 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="textBox1.Text" xml:space="preserve">
<value>v1.0.2.10(2024-08-05)
1、修复bug优化显示
2、加入模型裁边
<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、加入实时幅宽
2、加入jietouhengdang标签合并

View File

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

View File

@ -1,5 +1,4 @@

using IKapC.NET;
using IKapC.NET;
using LeatherApp.Device;
using LeatherApp.Device.CamerUtil;
using LeatherApp.Interface;
@ -27,6 +26,8 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;
using static System.Windows.Forms.AxHost;
namespace LeatherApp.Page
{
@ -56,14 +57,13 @@ namespace LeatherApp.Page
private double ThnDieLen = 0;
private Dictionary<int, Mat> defectTag = new Dictionary<int, Mat>();
//裁切偏移
private double OffsetCut = 0.2;
private Dictionary<int, Mat> defectTag = new Dictionary<int, Mat> ();
//云端
private CloudMgr cloudMgr = new CloudMgr();
private bool init_Cloud;
//
private bool _residueWarnningLenStop;
//裁切偏移
private double OffsetCut = 0.2;
public FHome(FProductInfo frm)
{
InitializeComponent();
@ -269,7 +269,7 @@ namespace LeatherApp.Page
/// <param name="lstDefectInfo">Records.DefectInfoList</param>
/// <param name="XSizeRange">幅宽</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;
//AddTextEvent(DateTime.Now,$"绘图", $"缺陷分布, W={string.Join(", ", XSizeRange)},H={string.Join(", ", YSizeRange)}, LastData={JsonConvert.SerializeObject(lstDefectInfo[lstDefectInfo.Count - 1])}");
@ -359,7 +359,19 @@ namespace LeatherApp.Page
series.YAxisDecimalPlaces = 2;
//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.LessWarningArea = new UILineWarningArea(2.2, Color.Gold);
@ -370,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>
@ -477,17 +514,18 @@ namespace LeatherApp.Page
//
//if (type > 0)
// cont = $"<color=\"{(type == 1 ? "Yellow" : "Red")}\">{cont}</color>";
//msg = (level == WarningEnum.Normal ? "B" : level == WarningEnum.Low ? "Y" : "R") + msg;
if (Show)
{
//msg = (level == WarningEnum.Normal ? "B" : level == WarningEnum.Low ? "Y" : "R") + msg;
msg = (level == WarningEnum.Normal ? "" : level == WarningEnum.Low ? "Y" : "R") + msg;
//this.Invoke(new System.Action(() =>
//{
if (this.lstboxLog.Items.Count > 1000)
this.lstboxLog.Items.Clear();
lstboxLog.Items.Insert(0, msg);
//}));
}
//}));
//日志滚动
//lstLog.SelectedIndex = lstLog.Items.Count - 1;
@ -548,6 +586,31 @@ namespace LeatherApp.Page
else
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)
{
@ -572,8 +635,6 @@ namespace LeatherApp.Page
//DefectLib dl = new DefectLib();
//dl.start();
//加载寻边模型
OpenCVUtil.LoadEdgeMode();
this.btnOpen.Enabled = false;
@ -689,7 +750,6 @@ namespace LeatherApp.Page
string pcode = "1-" + codes[2];
if (codes[1] == "0" || Config.SuedeList1.Contains(codes[1]))
pcode = "0-" + codes[2];
#if false
else
pcode = codes[1] + "-" + codes[2];
@ -744,8 +804,6 @@ namespace LeatherApp.Page
errCode = 4;
var now = DateTime.Now;
currKey = now.Hour * 10000 + now.Minute * 100 + now.Second;
_residueWarnningLenStop = false;
//var materialItem = codes[0]+"-"+ codes[1];
var colorItem = Config.getColorItem(int.Parse(codes[2]));
record = new Records()
@ -1082,33 +1140,7 @@ namespace LeatherApp.Page
if (Config.residueWarnningLen > 0 && curRecord.ErpLen > 0 && Config.residueWarnningLen >= curRecord.ErpLen - curRecord.Len)
{
AddTextEvent(DateTime.Now, $"告警{Thread.CurrentThread.ManagedThreadId}", $"已达剩余长度不足提醒!({curRecord.ErpLen - curRecord.Len}<={Config.residueWarnningLen})", WarningEnum.High);
#region
if (!_residueWarnningLenStop)
{
_residueWarnningLenStop = true;
AddTextEvent(DateTime.Now, $"暂停{Thread.CurrentThread.ManagedThreadId}", $"已达剩余长度不足提醒!({curRecord.ErpLen - curRecord.Len}<={Config.residueWarnningLen}),进入暂停。");
if (!Config.StopPLC)
this.devContainer.devPlc.pauseDev();
else if (!Config.StopIO && devContainer.devIOCard.IsInit)
{
//只是设备暂停APP没暂停
devContainer.io_output(CMDName.绿, false, true, 0);
devContainer.io_output(CMDName.);
devContainer.devIOCard.writeBitState(0, 1, true);
Task.Run(async () =>
{
await Task.Delay(500);
this.devContainer.devIOCard.writeBitState(0, 1, false);
});
}
this.BeginInvoke(new System.Action(() =>
{
//warning(WarningEnum.Low, true);//暂停
MessageBox.Show($"已达剩余长度不足提醒!({curRecord.ErpLen - curRecord.Len}<={Config.residueWarnningLen}),进入暂停。", "警告",MessageBoxButtons.OK, MessageBoxIcon.Warning);
}));
}
#endregion
//warning(WarningEnum.Low, true);//暂停
}
errStep = 6;
//厚度检测提示
@ -1142,6 +1174,7 @@ namespace LeatherApp.Page
curRecord.dicPhoto_Defect.TryAdd(scanPhoto.photoIndex, false);//加入索引,默认无瑕疵
AddTextEvent(DateTime.Now, $"拍照{Thread.CurrentThread.ManagedThreadId}", $"图像索引:{scanPhoto.photoIndex},标识数:{curRecord.dicPhoto_Defect.Count}", WarningEnum.Low, false);
errStep = 7;
//暂停:瑕疵二次判断
if (this.defectPauseForUser)
{
@ -1225,7 +1258,7 @@ namespace LeatherApp.Page
this.uiMiniPagination1.TotalCount = curRecord.DefectTotalCount = curRecord.DefectInfoList.Count;
//
//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;
//自动继续运行设备(这里临时暂停后不能再急停,否则无法继续)
if (!Config.StopPLC)
@ -1249,6 +1282,7 @@ namespace LeatherApp.Page
}
}
errStep = 10;
//以下判定放置于二次判定之后,因为二次判定可能会忽略部分检测项!!
//暂停:缺陷超标
@ -1321,7 +1355,7 @@ namespace LeatherApp.Page
}
#endif
}
#if false
//暂停:按等级分卷
if (curRecord.DefectTotalCount > 0 && curRecord.ProductInfo.GradeLimitList != null && curRecord.ProductInfo.GradeLimitList.Count > 0 && curRecord.DefectInfoList != null)
{
@ -1329,31 +1363,31 @@ namespace LeatherApp.Page
//按缺陷计算每X米多少缺陷分等级
for (int i = 0; i < curRecord.ProductInfo.GradeLimitList.Count; i++)
{
if (curRecord.ProductInfo.GradeLimitList[i].JudgeLength > 0)
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; //计算图像张数
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")
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)
if(item.E >0 && warnDefectCount > item.E)
{
GradeCount = item.E;
differentiateInfo.GradeCode = "E";
@ -1386,9 +1420,9 @@ namespace LeatherApp.Page
differentiateInfo.UseGradeLimit = item;
differentiateInfo.DefectCnt = warnDefectCount;
differentiateInfo.StartPhotoIndex = allFind.Min(x => x.PhotoIndex);
differentiateInfo.StartPhotoIndex = allFind.Min(x=>x.PhotoIndex);
differentiateInfo.EndPhotoIndex = allFind.Max(x => x.PhotoIndex);
differentiateInfo.StartY = allFind.Min(x => x.CentreY) / 100 - OffsetCut;
differentiateInfo.StartY = allFind.Min(x=>x.CentreY) / 100 - OffsetCut;
differentiateInfo.EndY = allFind.Max(x => x.CentreY) / 100 + OffsetCut;
differentiateInfo.CutLen = differentiateInfo.EndY - differentiateInfo.StartY;
//记录新的判定开始位置
@ -1419,17 +1453,16 @@ namespace LeatherApp.Page
});
}
}
}
}
}
#endif
task.record = curRecord;
task.finishEvent = callBackPhotoEvent;
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 = 21;
//Application.DoEvents();
Application.DoEvents();
}
}
catch (Exception e)
@ -1549,14 +1582,14 @@ namespace LeatherApp.Page
this.lblLen.Tag = faceWidthX_cm;
this.lblSpeed.Text = $"速度:{Math.Round(lenMi / curRecord.TimeLen, 2)}米/分";
this.uilbKF.Text = $"当前幅宽:{faceWidthY_cm}cm";
}));
}));
//
errStep = 9;
time += $"->速度刷新({stopWatch.ElapsedMilliseconds})";
//----缺陷队列
int oxw, 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}-{oxw}*{oxh}", WarningEnum.Low, false);
AddTextEvent(DateTime.Now,$"图像处理{Thread.CurrentThread.ManagedThreadId}", $"(图像{scanPhotos0.photoIndex})-合成图resize后:{mat.Width}*{mat.Height}", WarningEnum.Low, false);
devContainer.libDefect.add(new Device.DefectLib.DefectTask()
{
modelName= curRecord.ProductInfo.ModelName,
@ -1587,7 +1620,7 @@ namespace LeatherApp.Page
scanPhotos1.mat.Dispose();
scanPhotos0 = scanPhotos1 = null;
task = null;
//System.GC.Collect();
System.GC.Collect();
}
}
private void callBackDefectEvent(Device.DefectLib.DefectTask res)
@ -1619,6 +1652,7 @@ namespace LeatherApp.Page
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;
res.record.DefectTotalCount += res.excelTable.Rows.Count;
if (res.record.DefectInfoList == null)
@ -1655,10 +1689,11 @@ namespace LeatherApp.Page
//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;
if (!defectTag.ContainsKey(res.photoIndex))
if(!defectTag.ContainsKey(res.photoIndex))
{
defectTag.Add(res.photoIndex, res.bmpTag.Clone());
}
//保存打标小图
if (Config.IsSaveDefectCutImage)
{
@ -1716,7 +1751,7 @@ namespace LeatherApp.Page
//
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;
AddTextEvent(DateTime.Now,$"检测完成{Thread.CurrentThread.ManagedThreadId}", "保存CSV", WarningEnum.Low, false);
@ -1724,6 +1759,7 @@ namespace LeatherApp.Page
bool b = Utils.ExcelUtil.DataTable2CSV($"{dirPath}{res.photoIndex}.csv", res.excelTable);
//AddTextEvent(DateTime.Now,$"打标完成", $"{res.tag}.xlsx {(b ? "保存成功!" : "保存失败!")}");
step = 10;
#if
//每百米告警判断???在此还是在收到新照片时触发???
if (res.record.ProductInfo.DefectCountLimit > 0 && res.record.DefectTotalCount >= res.record.ProductInfo.DefectCountLimit)
@ -1736,9 +1772,23 @@ namespace LeatherApp.Page
{
res.record.preWarningPhotoIndex = res.photoIndex + 1;
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;
#if false
#if true
//按缺陷计算没X米多少缺陷报警
for (int i = 0; i < res.record.ProductInfo.QualifiedLimitList.Count; i++)
{
@ -1754,11 +1804,26 @@ namespace LeatherApp.Page
{
res.record.preWarningPhotoIndexByLabel[i] = res.photoIndex + 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
}
#endif
}
@ -1826,21 +1891,52 @@ namespace LeatherApp.Page
{
step = 4;
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))
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}]");
}
step = 5;
foreach (var item in model.GradeDifferentiateInfoList)
{
AddTextEvent(DateTime.Now, "分卷判断", $"({key}) 批号({model.BatchId}),等级={item.GradeCode} 位置[{item.StartY}-{item.EndY}],长度={item.CutLen},瑕疵数={item.DefectCnt}");
}
}
step = 7;
}
model.Qualified = (model.Grade < 6);//是否合格
if (!svcRecord.InsertNav(model))
@ -1893,6 +1989,7 @@ namespace LeatherApp.Page
private void btnStart_Click(object sender, EventArgs e)
{
AddTextEvent(DateTime.Now,"启动", "下发启动指令...");
//ThnDieLen = 0;
if (!Config.StopPLC)
this.devContainer.devPlc.runDev();
else if (!Config.StopIO && devContainer.devIOCard.IsInit)
@ -2179,55 +2276,14 @@ namespace LeatherApp.Page
private void button1_Click(object sender, EventArgs e)
{
//List<DefectInfo> lstEditDefect = new List<DefectInfo>();
//DefectInfo dt = new DefectInfo();
//dt.Name = "123";
//dt.Code = "wuyin";
//dt.image = Image.FromFile("C:\\Users\\fang\\Desktop\\123.png");
//lstEditDefect.Add(dt);
//Mat mtt = new Mat("C:\\Users\\fang\\Desktop\\新建文件夹\\mx\\636.bmp");
//FHome_Defect frmDefect = new FHome_Defect(lstEditDefect, mtt);
//frmDefect.ShowDialog();
Config.LoadAllConfig();
//设置程序最小/大线程池
// Get the current settings.
int minWorker, minIOC;
ThreadPool.GetMinThreads(out minWorker, out minIOC);
ThreadPool.SetMinThreads(25, minIOC);
Mat matt = new Mat("C:\\Users\\fang\\Desktop\\新建文件夹\\287.bmp");
//OpenCVUtil.LoadEdgeMode();
//int tt = 0;
//var mty = OpenCVUtil.getMaxInsetRect2(matt, false, 0,out tt);
//mty.SaveImage("edge.bmp");
List<QualifiedLimit> qlist = new List<QualifiedLimit>();
qlist.Add(new QualifiedLimit() { Code = "laji", ZXD = 0.3, Area = 0.04, ContrastLower = 0.98, ContrastTop = 1.02 });
qlist.Add(new QualifiedLimit() { Code = "wuyin", ZXD = 0.3, Area = 0.09, ContrastLower = 0.93, ContrastTop = 1.07 });
qlist.Add(new QualifiedLimit() { Code = "jiangyin", ZXD = 0.3, Area = 0.04, ContrastLower = 0.96, ContrastTop = 1.04 });
qlist.Add(new QualifiedLimit() { Code = "zhouyin", ZXD = 0.3, Area = 0.09, ContrastLower = 0.94, ContrastTop = 1.06 });
qlist.Add(new QualifiedLimit() { Code = "hengdang", ZXD = 0.3, Area = 0.08, ContrastLower = 0.99, ContrastTop = 1.01 });
qlist.Add(new QualifiedLimit() { Code = "jietou", ZXD = 0.3, Area = 0.04, ContrastLower = 0.99, ContrastTop = 1.01 });
qlist.Add(new QualifiedLimit() { Code = "chongying", ZXD = 0.3, Area = 2, ContrastLower = 0.99, ContrastTop = 1.01 });
qlist.Add(new QualifiedLimit() { Code = "aokeng", ZXD = 0.3, Area = 0.05, ContrastLower = 0.99, ContrastTop = 1.01 });
qlist.Add(new QualifiedLimit() { Code = "bmss", ZXD = 0.3, Area = 2, ContrastLower = 0.99, ContrastTop = 1.01 });
DefectLib dlt = new DefectLib();
dlt.start();
dlt.add(new Device.DefectLib.DefectTask()
{
modelName = "CYG_0706.trt",
record = null,
bmp = matt,
bmpTag = matt.Clone(),
photoIndex = 0,//0-n 首张必需为0因下面计算长度是从0开始
widthRatio = 1,
qualifiedLimitList = qlist,
finishEvent = callBackDefectEvent,
xw = 0,
});
List<DefectInfo> lstEditDefect = new List<DefectInfo>();
DefectInfo dt = new DefectInfo();
dt.Name = "123";
dt.Code = "jb";
dt.image = Image.FromFile("C:\\Users\\fang\\Desktop\\123.png");
lstEditDefect.Add(dt);
FHome_Defect frmDefect = new FHome_Defect(lstEditDefect, null);
frmDefect.ShowDialog();
return;
Config.LoadAllConfig();
DefectLib dl = new DefectLib();

View File

@ -39,23 +39,27 @@
//
// uiPanel1
//
this.uiPanel1.Controls.Add(this.pictureBox1);
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.Location = new System.Drawing.Point(4, 221);
this.uiPanel1.Location = new System.Drawing.Point(4, 39);
this.uiPanel1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiPanel1.MinimumSize = new System.Drawing.Size(1, 1);
this.uiPanel1.Name = "uiPanel1";
this.uiPanel1.Size = new System.Drawing.Size(1242, 737);
this.uiPanel1.Size = new System.Drawing.Size(1242, 919);
this.uiPanel1.TabIndex = 0;
this.uiPanel1.Text = "uiPanel1";
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, 3);
this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 303);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(1236, 731);
this.flowLayoutPanel1.Size = new System.Drawing.Size(1236, 613);
this.flowLayoutPanel1.TabIndex = 0;
//
// btnOK
@ -90,11 +94,11 @@
this.pictureBox1.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.pictureBox1.Location = new System.Drawing.Point(4, 38);
this.pictureBox1.Location = new System.Drawing.Point(3, 3);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(1242, 180);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox1.TabIndex = 2;
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
@ -102,7 +106,6 @@
this.AcceptButton = this.btnOK;
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(1250, 1014);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.uiPanel1);

View File

@ -19,6 +19,7 @@ namespace LeatherApp.Page
{
private List<DefectInfo> list;
public List<DefectInfo> lstDel = new List<DefectInfo>();
private Mat Image;
public FHome_Defect(List<DefectInfo> lst, Mat img)
{

View File

@ -28,17 +28,18 @@
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle19 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle20 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle21 = 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.tcbarTensionValue = new Sunny.UI.UITrackBar();
this.tcbarGain = new Sunny.UI.UITrackBar();
@ -56,6 +57,9 @@
this.cmbModelName = new Sunny.UI.UIComboBox();
this.uiLabel1 = new Sunny.UI.UILabel();
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.swcDefectPauseForUser = new Sunny.UI.UISwitch();
this.numDefectCountLimit = new Sunny.UI.UINumPadTextBox();
@ -75,12 +79,6 @@
this.col_Cnt = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.uiTitlePanel6 = new Sunny.UI.UITitlePanel();
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.uiFlowLayoutPanel1 = new Sunny.UI.UIFlowLayoutPanel();
this.btnSave = new Sunny.UI.UISymbolButton();
@ -96,9 +94,17 @@
this.cmbColor = new Sunny.UI.UIComboBox();
this.uiLabel3 = new Sunny.UI.UILabel();
this.uiLabel2 = new Sunny.UI.UILabel();
this.uiSwitch1 = new Sunny.UI.UISwitch();
this.uiLabel11 = new Sunny.UI.UILabel();
this.uiNumPadTextBox1 = new Sunny.UI.UINumPadTextBox();
this.ckIsCut = new Sunny.UI.UICheckBox();
this.btnAddGrade = new Sunny.UI.UISymbolButton();
this.btnDelGrade = new Sunny.UI.UISymbolButton();
this.col2_code = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.col2_Item = new System.Windows.Forms.DataGridViewComboBoxColumn();
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.col2_6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.uiTitlePanel2.SuspendLayout();
this.uiTitlePanel3.SuspendLayout();
this.uiTitlePanel4.SuspendLayout();
@ -377,8 +383,8 @@
//
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.uiLabel11);
this.uiTitlePanel4.Controls.Add(this.uiSwitch1);
this.uiTitlePanel4.Controls.Add(this.uiLabel11);
this.uiTitlePanel4.Controls.Add(this.btnDefectOption);
this.uiTitlePanel4.Controls.Add(this.swcDefectPauseForUser);
this.uiTitlePanel4.Controls.Add(this.numDefectCountLimit);
@ -402,6 +408,46 @@
this.uiTitlePanel4.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
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
//
this.btnDefectOption.Cursor = System.Windows.Forms.Cursors.Hand;
@ -524,21 +570,21 @@
//
// uiDataGridView1
//
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255)))));
this.uiDataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
dataGridViewCellStyle12.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255)))));
this.uiDataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle12;
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.Right)));
this.uiDataGridView1.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255)))));
this.uiDataGridView1.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle2.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)));
dataGridViewCellStyle2.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.uiDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle13.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
dataGridViewCellStyle13.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle13.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle13.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
dataGridViewCellStyle13.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle13.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.uiDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle13;
this.uiDataGridView1.ColumnHeadersHeight = 32;
this.uiDataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
this.uiDataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
@ -550,35 +596,35 @@
this.col_IsOR,
this.col_Len,
this.col_Cnt});
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle4.BackColor = System.Drawing.Color.White;
dataGridViewCellStyle4.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)))));
dataGridViewCellStyle4.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)))));
dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.uiDataGridView1.DefaultCellStyle = dataGridViewCellStyle4;
dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle15.BackColor = System.Drawing.Color.White;
dataGridViewCellStyle15.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)))));
dataGridViewCellStyle15.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(236)))), ((int)(((byte)(255)))));
dataGridViewCellStyle15.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
dataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.uiDataGridView1.DefaultCellStyle = dataGridViewCellStyle15;
this.uiDataGridView1.EnableHeadersVisualStyles = false;
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.Location = new System.Drawing.Point(3, 41);
this.uiDataGridView1.MultiSelect = false;
this.uiDataGridView1.Name = "uiDataGridView1";
dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle5.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)));
dataGridViewCellStyle5.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)))));
dataGridViewCellStyle5.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.uiDataGridView1.RowHeadersDefaultCellStyle = dataGridViewCellStyle5;
dataGridViewCellStyle16.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle16.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255)))));
dataGridViewCellStyle16.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)))));
dataGridViewCellStyle16.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
dataGridViewCellStyle16.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
dataGridViewCellStyle16.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.uiDataGridView1.RowHeadersDefaultCellStyle = dataGridViewCellStyle16;
this.uiDataGridView1.RowHeadersWidth = 62;
dataGridViewCellStyle6.BackColor = System.Drawing.Color.White;
dataGridViewCellStyle6.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)))));
dataGridViewCellStyle6.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)))));
this.uiDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle6;
dataGridViewCellStyle17.BackColor = System.Drawing.Color.White;
dataGridViewCellStyle17.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle17.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
dataGridViewCellStyle17.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(236)))), ((int)(((byte)(255)))));
dataGridViewCellStyle17.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
this.uiDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle17;
this.uiDataGridView1.RowTemplate.Height = 30;
this.uiDataGridView1.SelectedIndex = -1;
this.uiDataGridView1.Size = new System.Drawing.Size(581, 308);
@ -598,8 +644,8 @@
// col_zxd
//
this.col_zxd.DataPropertyName = "ZXD";
dataGridViewCellStyle3.NullValue = null;
this.col_zxd.DefaultCellStyle = dataGridViewCellStyle3;
dataGridViewCellStyle14.NullValue = null;
this.col_zxd.DefaultCellStyle = dataGridViewCellStyle14;
this.col_zxd.HeaderText = "置信度";
this.col_zxd.MinimumWidth = 20;
this.col_zxd.Name = "col_zxd";
@ -638,19 +684,22 @@
// col_Len
//
this.col_Len.HeaderText = "报警长度(m)";
this.col_Len.MinimumWidth = 80;
this.col_Len.Name = "col_Len";
this.col_Len.Visible = false;
//
// col_Cnt
//
this.col_Cnt.HeaderText = "报警数量";
this.col_Cnt.MinimumWidth = 80;
this.col_Cnt.Name = "col_Cnt";
this.col_Cnt.Visible = false;
//
// uiTitlePanel6
//
this.uiTitlePanel6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| 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.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)))));
@ -670,108 +719,68 @@
//
// uiDataGridView2
//
dataGridViewCellStyle7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255)))));
this.uiDataGridView2.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle7;
dataGridViewCellStyle18.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255)))));
this.uiDataGridView2.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle18;
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.Right)));
this.uiDataGridView2.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255)))));
this.uiDataGridView2.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle8.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)));
dataGridViewCellStyle8.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle8.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
dataGridViewCellStyle8.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.uiDataGridView2.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle8;
dataGridViewCellStyle19.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle19.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
dataGridViewCellStyle19.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle19.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle19.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
dataGridViewCellStyle19.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle19.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.uiDataGridView2.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle19;
this.uiDataGridView2.ColumnHeadersHeight = 32;
this.uiDataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
this.uiDataGridView2.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.col2_code,
this.col2_Item,
this.col2_1,
this.col2_2,
this.col2_3,
this.col2_4,
this.col2_5});
dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle9.BackColor = System.Drawing.Color.White;
dataGridViewCellStyle9.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle9.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
dataGridViewCellStyle9.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(236)))), ((int)(((byte)(255)))));
dataGridViewCellStyle9.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
dataGridViewCellStyle9.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.uiDataGridView2.DefaultCellStyle = dataGridViewCellStyle9;
this.col2_5,
this.col2_6});
dataGridViewCellStyle20.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle20.BackColor = System.Drawing.Color.White;
dataGridViewCellStyle20.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle20.ForeColor = 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)))));
dataGridViewCellStyle20.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
dataGridViewCellStyle20.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.uiDataGridView2.DefaultCellStyle = dataGridViewCellStyle20;
this.uiDataGridView2.EnableHeadersVisualStyles = false;
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.Location = new System.Drawing.Point(3, 41);
this.uiDataGridView2.MultiSelect = false;
this.uiDataGridView2.Name = "uiDataGridView2";
dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle10.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)));
dataGridViewCellStyle10.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)))));
dataGridViewCellStyle10.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
dataGridViewCellStyle10.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.uiDataGridView2.RowHeadersDefaultCellStyle = dataGridViewCellStyle10;
dataGridViewCellStyle21.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle21.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255)))));
dataGridViewCellStyle21.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle21.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
dataGridViewCellStyle21.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
dataGridViewCellStyle21.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
dataGridViewCellStyle21.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.uiDataGridView2.RowHeadersDefaultCellStyle = dataGridViewCellStyle21;
this.uiDataGridView2.RowHeadersWidth = 62;
dataGridViewCellStyle11.BackColor = System.Drawing.Color.White;
dataGridViewCellStyle11.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)))));
dataGridViewCellStyle11.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)))));
this.uiDataGridView2.RowsDefaultCellStyle = dataGridViewCellStyle11;
dataGridViewCellStyle22.BackColor = System.Drawing.Color.White;
dataGridViewCellStyle22.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle22.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
dataGridViewCellStyle22.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(236)))), ((int)(((byte)(255)))));
dataGridViewCellStyle22.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
this.uiDataGridView2.RowsDefaultCellStyle = dataGridViewCellStyle22;
this.uiDataGridView2.RowTemplate.Height = 30;
this.uiDataGridView2.SelectedIndex = -1;
this.uiDataGridView2.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.uiDataGridView2.Size = new System.Drawing.Size(488, 308);
this.uiDataGridView2.Style = Sunny.UI.UIStyle.Custom;
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
//
this.uiPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
@ -1025,45 +1034,110 @@
this.uiLabel2.Text = "产品颜色";
this.uiLabel2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// uiSwitch1
// ckIsCut
//
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, 294);
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 = 15;
this.uiSwitch1.Text = "uiSwitch1";
this.ckIsCut.BackColor = System.Drawing.Color.Transparent;
this.ckIsCut.Cursor = System.Windows.Forms.Cursors.Hand;
this.ckIsCut.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.ckIsCut.ForeColor = System.Drawing.Color.White;
this.ckIsCut.Location = new System.Drawing.Point(347, 2);
this.ckIsCut.MinimumSize = new System.Drawing.Size(1, 1);
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);
//
// uiLabel11
// btnAddGrade
//
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(5, 268);
this.uiLabel11.Name = "uiLabel11";
this.uiLabel11.Size = new System.Drawing.Size(106, 21);
this.uiLabel11.Style = Sunny.UI.UIStyle.Custom;
this.uiLabel11.TabIndex = 16;
this.uiLabel11.Text = "厚度检测判断";
this.uiLabel11.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnAddGrade.BackColor = System.Drawing.Color.Transparent;
this.btnAddGrade.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnAddGrade.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnAddGrade.Image = ((System.Drawing.Image)(resources.GetObject("btnAddGrade.Image")));
this.btnAddGrade.LightColor = System.Drawing.Color.FromArgb(((int)(((byte)(14)))), ((int)(((byte)(30)))), ((int)(((byte)(63)))));
this.btnAddGrade.Location = new System.Drawing.Point(105, 3);
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);
//
// uiNumPadTextBox1
// btnDelGrade
//
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, 294);
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(132, 29);
this.uiNumPadTextBox1.Style = Sunny.UI.UIStyle.Custom;
this.uiNumPadTextBox1.TabIndex = 17;
this.uiNumPadTextBox1.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
this.uiNumPadTextBox1.Watermark = "";
this.btnDelGrade.BackColor = System.Drawing.Color.Transparent;
this.btnDelGrade.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnDelGrade.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnDelGrade.Image = ((System.Drawing.Image)(resources.GetObject("btnDelGrade.Image")));
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);
//
// 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 = 120;
//
// col2_Item
//
this.col2_Item.HeaderText = "名称";
this.col2_Item.Name = "col2_Item";
//
// col2_1
//
this.col2_1.HeaderText = "A";
this.col2_1.MinimumWidth = 8;
this.col2_1.Name = "col2_1";
this.col2_1.Width = 60;
//
// col2_2
//
this.col2_2.HeaderText = "B";
this.col2_2.MinimumWidth = 8;
this.col2_2.Name = "col2_2";
this.col2_2.Width = 60;
//
// col2_3
//
this.col2_3.HeaderText = "C";
this.col2_3.MinimumWidth = 8;
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
//
@ -1081,6 +1155,8 @@
this.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192)))));
this.Style = Sunny.UI.UIStyle.Custom;
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.PerformLayout();
this.uiTitlePanel3.ResumeLayout(false);
@ -1126,12 +1202,6 @@
private Sunny.UI.UIFlowLayoutPanel uiFlowLayoutPanel1;
private Sunny.UI.UIDataGridView uiDataGridView1;
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.UIComboBox cmbColor;
private Sunny.UI.UILabel uiLabel3;
@ -1149,6 +1219,9 @@
private Sunny.UI.UIRadioButton rbMaterial4;
private Sunny.UI.UIRadioButton rbMaterial3;
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_zxd;
private System.Windows.Forms.DataGridViewTextBoxColumn col_area;
@ -1157,8 +1230,16 @@
private System.Windows.Forms.DataGridViewCheckBoxColumn col_IsOR;
private System.Windows.Forms.DataGridViewTextBoxColumn col_Len;
private System.Windows.Forms.DataGridViewTextBoxColumn col_Cnt;
private Sunny.UI.UINumPadTextBox uiNumPadTextBox1;
private Sunny.UI.UILabel uiLabel11;
private Sunny.UI.UISwitch uiSwitch1;
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 Models;
using Newtonsoft.Json.Linq;
@ -10,9 +13,11 @@ using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Linq;
namespace LeatherApp.Page
{
@ -30,7 +35,10 @@ namespace LeatherApp.Page
uiDataGridView1.AllowUserToResizeRows = uiDataGridView2.AllowUserToResizeRows=false;//用户调整行大小
//dataGridView1.AllowUserToResizeColumns = false;//用户调整列大小
//显示行号与列宽度自动调整
uiDataGridView1.RowHeadersVisible = uiDataGridView2.RowHeadersVisible = true;
uiDataGridView1.RowHeadersVisible = true;
uiDataGridView2.RowHeadersVisible = false;
uiDataGridView1.RowHeadersWidth = uiDataGridView2.RowHeadersWidth = 50;
uiDataGridView1.ColumnHeadersHeightSizeMode = uiDataGridView2.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
uiDataGridView1.RowHeadersWidthSizeMode = uiDataGridView2.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders;//数据量过百绑定太变
@ -133,7 +141,6 @@ namespace LeatherApp.Page
this.rbMaterial5.Checked = true;
else
this.rbMaterial1.Checked = true;
this.cmbColor.SelectedValue = int.Parse(codes[1]);
}
else
@ -171,7 +178,7 @@ namespace LeatherApp.Page
private void loadProduct()
{
if (model == null) return;
if(model.Material=="0")
if (model.Material == "0")
this.rbMaterial0.Checked = true;
else if (model.Material == "1")
this.rbMaterial1.Checked = true;
@ -186,6 +193,8 @@ namespace LeatherApp.Page
this.cmbColor.SelectedValue = model.Color;
this.ckIsCut.Checked = model.IsHintCutting;
tcbarLightValue.Value = model.LightValue;
tcbarExposureTime.Value = (int)model.ExposureTime;
tcbarGain.Value = (int)model.Gain;
@ -196,7 +205,7 @@ namespace LeatherApp.Page
numDefectCountLimit.Text = model.DefectCountLimit.ToString();
swcDefectPauseForUser.Active = model.DefectPauseForUser;
this.uiSwitch1.Active = model.OpenThicknessDetection;
uiSwitch1.Active = model.OpenThicknessDetection;
uiNumPadTextBox1.Text = model.ThicknessDetectionStopDis.ToString();
//uiDataGridView fill
string code;
@ -204,33 +213,73 @@ namespace LeatherApp.Page
for (int i = 0; i < uiDataGridView1.Rows.Count; i++)
{
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)
{
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_contrast_top"].Value = ContrastToPercent(item1.ContrastTop);
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_Len"].Value = item1.DefectWarnLength;
//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;
uiDataGridView1.Rows[i].Cells["col_Len"].Value = item1.DefectWarnLength;
uiDataGridView1.Rows[i].Cells["col_Cnt"].Value = item1.DefectWarnCnt;
}
}
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;
}
@ -250,6 +299,7 @@ namespace LeatherApp.Page
this.btnSave.Visible = true;
this.btnReload.Visible = false;
this.ckIsCut.Checked = false;
//
uiDataGridView1.Rows.Clear();
uiDataGridView2.Rows.Clear();
@ -285,15 +335,39 @@ namespace LeatherApp.Page
//uiDataGridView2.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
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");
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;
}
for (int i = 0; i < model.GradeLimitList.Count; i++)
{
code = model.GradeLimitList[i].Code;
name = model.GradeLimitList[i].CodeName;
//color = item.Value<string>("color");
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)
{
@ -340,6 +414,8 @@ namespace LeatherApp.Page
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());
@ -382,12 +458,15 @@ namespace LeatherApp.Page
model.GradeLimitList.Add(
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,
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,
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,
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,
CreateUserCode = Config.loginUser.Code
});
@ -486,5 +565,114 @@ namespace LeatherApp.Page
{
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">
<value>True</value>
</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">
<value>True</value>
</metadata>
@ -159,4 +162,69 @@
<metadata name="col2_5.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</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>

View File

@ -17,6 +17,7 @@ using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.AxHost;
namespace LeatherApp.Page
{
@ -127,10 +128,8 @@ namespace LeatherApp.Page
private void btnExport_Click(object sender, EventArgs e)
{
int err = 0;
try
{
if (this.uiDataGridView1.CurrentRow == null)
return;
@ -142,7 +141,6 @@ namespace LeatherApp.Page
if (string.IsNullOrWhiteSpace(path))
return;
err = 1;
//var list = uiDataGridView1.DataSource as List<Records>;
//var table = ExcelUtil.ConvertToDataTable<Records>(list);
@ -151,8 +149,7 @@ namespace LeatherApp.Page
//绘图1
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 });
err = 2;
this.reDrawDefectPoints(record.DefectInfoList, new double[] { 0, Math.Round(record.FaceWidthMax + 0.005f, 2) }, new double[] { 0, len + 20 }, record.GradeDifferentiateInfoList);
//绘图2
//var points = Array.ConvertAll(record.FaceWidthListStr.Split(new[] { ',', }, StringSplitOptions.RemoveEmptyEntries),Double.Parse).ToList();
//reDrawFaceWidth(record.FacePointList,
@ -161,13 +158,13 @@ namespace LeatherApp.Page
reDrawFaceWidth(record.FacePointList,
new double[] { 0, Math.Round(len + 0.005f, 2) },
new double[] { 130, 160 });
err = 3;
//
foreach (var item in list) {
item.Name = Config.getDefectName(item.Code);
//item.Height = item.Height / 100; //单位错误,保证单位一致
}
err = 4;
//
string Grade = "";
if (record.Grade < 1) Grade = "";
@ -183,21 +180,18 @@ namespace LeatherApp.Page
Grade= Grade,
DateTime = record.CreateTime.ToString("yyyy年MM月dd日 HH:mm")
};
err = 5;
data.DefectTotal = record.DefectInfoList.GroupBy(x => x.Name).Select(g => new JDefectTotal { Name = g.Key,Count=g.Count() }).ToList();
data.DefectDetail = record.DefectInfoList.Select(x => new JDefectDetail {
Index=x.PhotoIndex,Name=x.Name, X=x.X,Y=Math.Round(x.Y/100.0d,2),Width=x.Width * 10,Height=x.Height * 10,ZXD=x.ZXD,Area=x.Area * 100,Contrast=x.Contrast })
.OrderBy(x=>x.Index).ThenBy(x=>x.Y).ToList();
err = 6;
data.Pdt = productService.GetModelNav(record.ProductId);
data.xyPix = $"X:{Config.cm2px_x},Y:{Config.cm2px_y}";
err = 7;
var image1 = captureControl(this.lineChartDefect);
var image2 = captureControl(this.lineChartFaceWidth);
var filePath = $"{path}缺陷列表_{record.BatchId}_{record.ReelId}.xlsx";
err = 8;
exportTabel(data, image1, image2, filePath);
exportTabel(data, image1, image2, filePath);
//if (!res)
// throw new Exception("导出失败!");
UIMessageTip.ShowOk("导出成功!", 1000);
@ -206,7 +200,7 @@ namespace LeatherApp.Page
}
catch (Exception ex)
{
UIMessageTip.ShowError($"err:{err} + {ex.Message}", 2000);
UIMessageTip.ShowError(ex.Message, 2000);
API.OutputDebugString(ex.StackTrace);
}
}
@ -754,7 +748,7 @@ namespace LeatherApp.Page
/// <param name="lstDefectInfo">Records.DefectInfoList</param>
/// <param name="XSizeRange">幅宽</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;
//AddTextEvent($"绘图", $"缺陷分布, W={string.Join(", ", XSizeRange)},H={string.Join(", ", YSizeRange)}, LastData={JsonConvert.SerializeObject(lstDefectInfo[lstDefectInfo.Count - 1])}");
@ -826,10 +820,18 @@ namespace LeatherApp.Page
//series.Smooth = false;
}
if(series != null)
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.LessWarningArea = new UILineWarningArea(2.2, Color.Gold);

View File

@ -1,160 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using System.Xaml;
using DocumentFormat.OpenXml.EMMA;
using DocumentFormat.OpenXml.Vml;
using OpenCvSharp;
using OpenCvSharp.XImgProc;
namespace LeatherApp.Utils
{
public class OpenCVUtil
{
#region
private static StructuredEdgeDetection _edgeDetect;
public static void LoadEdgeMode()
{
if (_edgeDetect == null)
_edgeDetect = OpenCvSharp.XImgProc.CvXImgProc.CreateStructuredEdgeDetection("model.yml");
}
/// <summary>
/// 模型寻边
/// </summary>
/// <param name="image"></param>
/// <param name="FindType"></param>
/// <param name="Roi"></param>
/// <param name="IsLeft"></param>
/// <returns></returns>
private static int EdgeClipping3(Mat image, int FindType, Rect Roi, bool IsLeft)
{
Mat mat_rgb = image.Clone(Roi);
int height = mat_rgb.Rows;
int width = mat_rgb.Cols;
int sf = 10; //缩放比例
int pix = 5; //获取均值区域长宽像素
int pointNum = 15; //获取找遍点数
int offsetGray = 5; //二值化偏差
int length_t = 0;
List<int> lines = new List<int>();
List<int> total_t = new List<int>();
//按比例缩放
double sf_height = height / sf;
double sf_width = width / sf;
Cv2.Resize(mat_rgb, mat_rgb, new Size(sf_width, sf_height), 0, 0, InterpolationFlags.Linear);
Mat himg = new Mat();
Mat edgeimg = new Mat();
Cv2.CvtColor(mat_rgb, edgeimg, ColorConversionCodes.BGR2RGB);
Mat edges = new Mat();
edgeimg.ConvertTo(edgeimg, MatType.CV_32F, 1 / 255.0);
if (_edgeDetect == null)
LoadEdgeMode();
//Cv2.Normalize(edgeimg, edgeimg, 1.0, 0, NormTypes.L2, -1);
_edgeDetect.DetectEdges(edgeimg, edges);
Mat image_Otsu = new Mat();
int hDis = (int)sf_height / (pointNum + 2); //去除边缘两点
edges.ConvertTo(image_Otsu, MatType.CV_8U, 255.0);
Cv2.Threshold(image_Otsu, image_Otsu, 0, 255, ThresholdTypes.Otsu);
// 定义空数组保存结果
int[] total = new int[pointNum];
// 平均截取pointNum行数据并处理图像
for (int i = 0; i < pointNum; i++)
{
// 截取当前行的图像
Rect roi = new Rect(0, hDis + hDis * i, (int)sf_width, 1);
Mat current_segment = image_Otsu.Clone(roi);
//Mat filled_image3 = current_segment.Clone();
Mat filled_image3 = current_segment;
#if true
//从左到右判断边和从右到左判断边
int numX = 0;
int tm = 0;
byte tempVal = 0;
bool findOne = false;
if (!IsLeft)
{
tempVal = filled_image3.At<byte>(0, 0);
//filled_image3.
for (int j = 0; j < filled_image3.Cols; j++)
{
if (filled_image3.At<byte>(0, j) != tempVal)
{
if (!findOne)
{
tm = j;
findOne = true;
tempVal = filled_image3.At<byte>(0, j);
}
else
{
//numX = j;
numX = (tm + j) / 2;
break;
}
}
}
}
else
{
tempVal = filled_image3.At<byte>(0, filled_image3.Cols - 1);
for (int j = filled_image3.Cols - 1; j >= 0; j--)
{
if (filled_image3.At<byte>(0, j) != tempVal)
{
if (!findOne)
{
tm = j;
findOne = true;
tempVal = filled_image3.At<byte>(0, j);
}
else
{
//numX = j;
numX = (tm + j) / 2;
break;
}
}
}
}
#else
int numX = Cv2.CountNonZero(filled_image3);
#endif
//length_t = (numX > (sf_width / 2)) ? numX :(int)(sf_width - numX);
length_t = numX;
total[i] = (length_t);
if (length_t > 0)
total_t.Add(length_t);
}
// 取平均值作为宽度
int length = 0;
if (total_t.Count > 0)
{
length = (int)total_t.Average();
if (IsLeft)
length = length - 0;
else
length = length + 0;
}
//乘上换算系数还原
length = length * sf + Roi.X;
return length;
}
#endregion
{
public static Mat resize(Mat mat, int width, int height, out int xw, out int xh)
{
OpenCvSharp.Size dsize = new OpenCvSharp.Size(width, height);
@ -162,8 +19,7 @@ namespace LeatherApp.Utils
//Cv2.Resize(mat, mat2, dsize);
//ResizeUniform(mat, dsize, out mat2, out xw, out xh);
xw = (width - mat.Cols) / 2;
xh = (height - mat.Rows) / 2;
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));
@ -519,7 +375,7 @@ namespace LeatherApp.Utils
else
Roi = new Rect(0, 0, bian, mat_rgb.Height);
int type = isLeft ? 1 : 0;
int len = EdgeClipping3(mat_rgb, type, Roi, isLeft);
int len = EdgeClipping2(mat_rgb, type, Roi, isLeft);
#if false
//Mat mat_rgb = new Mat("E:\\CPL\\测试代码\\边缘检测\\test\\test\\test\\img\\19.bmp");
Mat image_gray = new Mat();
@ -596,13 +452,9 @@ namespace LeatherApp.Utils
API.OutputDebugString($"getMaxInsetRect2:margin={marginWidth}length={length}({marginHoleWidth}),isLeft={isLeft},mat_rgb={mat_rgb.Width}*{mat_rgb.Height},w={length - marginHoleWidth},h={mat_rgb.Height}");
if (isLeft)
return cutImage(mat_rgb, mat_rgb.Width - length + marginHoleWidth, 0, length - marginHoleWidth, mat_rgb.Height);
return cutImage(mat_rgb, mat_rgb.Width - length+ marginHoleWidth, 0, length- marginHoleWidth, mat_rgb.Height);
else
return cutImage(mat_rgb, 0, 0, length - marginHoleWidth, mat_rgb.Height);
//if (isLeft)
// return cutImage(mat_rgb, length + marginHoleWidth, 0, length - marginHoleWidth, mat_rgb.Height);
//else
// return cutImage(mat_rgb, 0, 0, length - marginHoleWidth, mat_rgb.Height);
return cutImage(mat_rgb, 0, 0, length- marginHoleWidth, mat_rgb.Height);
}
/// <summary>

View File

@ -1,68 +0,0 @@
[
{
"id": 0,
"code": "laji",
"name": "垃圾",
"color": "#0080FF"
},
{
"id": 1,
"code": "liangdian",
"name": "亮点",
"color": "Lime"
},
{
"id": 2,
"code": "wuyin",
"name": "污印",
"color": "DarkViolet"
},
{
"id": 3,
"code": "jietou",
"name": "接头",
"color": "Magenta"
},
{
"id": 4,
"code": "bmss",
"name": "表面损伤",
"color": "Orange"
},
{
"id": 5,
"code": "qipi",
"name": "起皮",
"color": "Blue"
},
{
"id": 6,
"code": "tiaohen",
"name": "条痕",
"color": "Red"
},
{
"id": 7,
"code": "yayin",
"name": "压印",
"color": "Green"
},
{
"id": 8,
"code": "zhouyin",
"name": "皱印",
"color": "Yellow"
},
{
"id": 9,
"code": "yisesi",
"name": "异色丝",
"color": "CadetBlue"
},
{
"id": 10,
"code": "chongying",
"name": "重影",
"color": "Salmon"
}
]

View File

@ -1,80 +1,86 @@
[
{
"id": 0,
"code": "jb",
"code": "jiangbban",
"name": "浆斑",
"color": "Red"
},
{
"id": 1,
"code": "wy",
"code": "wuyin",
"name": "污印",
"color": "Lime"
},
{
"id": 2,
"code": "mj",
"code": "mianjie",
"name": "棉结",
"color": "DarkViolet"
},
{
"id": 3,
"code": "hy",
"code": "huangyin",
"name": "黄印",
"color": "Magenta"
},
{
"id": 4,
"code": "lj",
"code": "laji",
"name": "垃圾",
"color": "Orange"
},
{
"id": 5,
"code": "yss",
"code": "yisesi",
"name": "异色丝",
"color": "Brown"
},
{
"id": 6,
"code": "zy",
"code": "zhouyin",
"name": "皱印",
"color": "Olive"
},
{
"id": 7,
"code": "wc",
"code": "wenchong",
"name": "蚊虫",
"color": "PaleGreen"
},
{
"id": 8,
"code": "cs",
"code": "cashang",
"name": "擦伤",
"color": "CadetBlue"
},
{
"id": 9,
"code": "cy",
"code": "chongying",
"name": "重影",
"color": "Aqua"
},
{
"id": 10,
"code": "tcy",
"code": "tingcheyin",
"name": "停车印",
"color": "YellowGreen"
},
{
"id": 11,
"code": "jt",
"code": "jietou",
"name": "接头",
"color": "Blue"
},
{
"id": 12,
"code": "na",
"name": "荆条",
"color": "pink"
"code": "hengdang",
"name": "横档",
"color": "Blue"
},
{
"id": 13,
"code": "jiangyin",
"name": "浆印",
"color": "Blue"
}
]

View File

@ -1,68 +0,0 @@
[
{
"id": 0,
"code": "laji",
"name": "垃圾",
"color": "#0080FF"
},
{
"id": 1,
"code": "liangdian",
"name": "亮点",
"color": "Lime"
},
{
"id": 2,
"code": "wuyin",
"name": "污印",
"color": "DarkViolet"
},
{
"id": 3,
"code": "jietou",
"name": "接头",
"color": "Magenta"
},
{
"id": 4,
"code": "bmss",
"name": "表面损伤",
"color": "Orange"
},
{
"id": 5,
"code": "qipi",
"name": "起皮",
"color": "Blue"
},
{
"id": 6,
"code": "tiaohen",
"name": "条痕",
"color": "Red"
},
{
"id": 7,
"code": "yayin",
"name": "压印",
"color": "Green"
},
{
"id": 7,
"code": "zhouyin",
"name": "皱印",
"color": "Yellow"
},
{
"id": 8,
"code": "yisesi",
"name": "异色丝",
"color": "CadetBlue"
},
{
"id": 7,
"code": "chongying",
"name": "重影",
"color": "Salmon"
},
]

View File

@ -1,56 +0,0 @@
[
{
"id": 0,
"code": "laji",
"name": "垃圾",
"color": "#0080FF"
},
{
"id": 1,
"code": "wuyin",
"name": "污印",
"color": "Lime"
},
{
"id": 2,
"code": "jiangyin",
"name": "浆印",
"color": "DarkViolet"
},
{
"id": 3,
"code": "zhouyin",
"name": "皱印",
"color": "Magenta"
},
{
"id": 4,
"code": "hengdang",
"name": "横档",
"color": "Orange"
},
{
"id": 5,
"code": "jietou",
"name": "接头",
"color": "Blue"
},
{
"id": 6,
"code": "chongying",
"name": "重影",
"color": "Lime"
},
{
"id": 7,
"code": "aokeng",
"name": "凹坑",
"color": "Lime"
},
{
"id": 8,
"code": "bmss",
"name": "表面损伤",
"color": "Lime"
}
]

View File

@ -44,93 +44,23 @@ Global捕获到未处理异常System.ArgumentException
在 System.Windows.Forms.Control.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
2024-07-25 10:08:02
Global捕获到未处理异常System.NullReferenceException
异常信息:未将对象引用设置到对象的实例。
异常堆栈: 在 LeatherApp.UIExtend.UIDefectImage.uiComboBox1_SelectedIndexChanged(Object sender, EventArgs e) 位置 E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\LeatherApp\UIExtend\UIDefectImage.cs:行号 60
在 Sunny.UI.UIComboBox.Box_SelectedIndexChanged(Object sender, EventArgs e)
在 System.EventHandler.Invoke(Object sender, EventArgs e)
在 System.Windows.Forms.ListBox.OnSelectedIndexChanged(EventArgs e)
在 Sunny.UI.ListBoxEx.OnSelectedIndexChanged(EventArgs e)
在 System.Windows.Forms.ListBox.ClearSelected()
在 System.Windows.Forms.ListBox.set_SelectedIndex(Int32 value)
在 System.Windows.Forms.ListControl.set_SelectedValue(Object value)
在 Sunny.UI.UIComboBox.set_SelectedValue(Object value)
在 LeatherApp.UIExtend.UIDefectImage.set_Code(String value) 位置 E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\LeatherApp\UIExtend\UIDefectImage.cs:行号 45
在 LeatherApp.Page.FHome_Defect.<init>b__4_0(DefectInfo item) 位置 E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\LeatherApp\Page\FHome_Defect.cs:行号 36
在 System.Collections.Generic.List`1.ForEach(Action`1 action)
在 LeatherApp.Page.FHome_Defect.init() 位置 E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\LeatherApp\Page\FHome_Defect.cs:行号 35
在 LeatherApp.Page.FHome_Defect..ctor(List`1 lst, Mat img) 位置 E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\LeatherApp\Page\FHome_Defect.cs:行号 29
在 LeatherApp.Page.FHome.button1_Click(Object sender, EventArgs e) 位置 E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\LeatherApp\Page\FHome.cs:行号 2157
在 System.Windows.Forms.Control.OnClick(EventArgs e)
在 System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
在 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
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.ButtonBase.WndProc(Message& m)
在 System.Windows.Forms.Button.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
2024-07-25 10:08:55
Global捕获到未处理异常System.NullReferenceException
异常信息:未将对象引用设置到对象的实例。
异常堆栈: 在 LeatherApp.UIExtend.UIDefectImage.uiComboBox1_SelectedIndexChanged(Object sender, EventArgs e) 位置 E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\LeatherApp\UIExtend\UIDefectImage.cs:行号 60
在 Sunny.UI.UIComboBox.Box_SelectedIndexChanged(Object sender, EventArgs e)
在 System.EventHandler.Invoke(Object sender, EventArgs e)
在 System.Windows.Forms.ListBox.OnSelectedIndexChanged(EventArgs e)
在 Sunny.UI.ListBoxEx.OnSelectedIndexChanged(EventArgs e)
在 System.Windows.Forms.ListBox.ClearSelected()
在 System.Windows.Forms.ListBox.set_SelectedIndex(Int32 value)
在 System.Windows.Forms.ListControl.set_SelectedValue(Object value)
在 Sunny.UI.UIComboBox.set_SelectedValue(Object value)
在 LeatherApp.UIExtend.UIDefectImage.set_Code(String value) 位置 E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\LeatherApp\UIExtend\UIDefectImage.cs:行号 45
在 LeatherApp.Page.FHome_Defect.<init>b__4_0(DefectInfo item) 位置 E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\LeatherApp\Page\FHome_Defect.cs:行号 36
在 System.Collections.Generic.List`1.ForEach(Action`1 action)
在 LeatherApp.Page.FHome_Defect.init() 位置 E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\LeatherApp\Page\FHome_Defect.cs:行号 35
在 LeatherApp.Page.FHome_Defect..ctor(List`1 lst, Mat img) 位置 E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\LeatherApp\Page\FHome_Defect.cs:行号 29
在 LeatherApp.Page.FHome.button1_Click(Object sender, EventArgs e) 位置 E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\LeatherApp\Page\FHome.cs:行号 2157
在 System.Windows.Forms.Control.OnClick(EventArgs e)
在 System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
在 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
在 System.Windows.Forms.Control.WndProc(Message& m)
在 System.Windows.Forms.ButtonBase.WndProc(Message& m)
在 System.Windows.Forms.Button.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
2024-07-25 10:10:27
Global捕获到未处理异常System.NullReferenceException
异常信息:未将对象引用设置到对象的实例。
异常堆栈: 在 LeatherApp.UIExtend.UIDefectImage.uiComboBox1_SelectedIndexChanged(Object sender, EventArgs e) 位置 E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\LeatherApp\UIExtend\UIDefectImage.cs:行号 60
在 Sunny.UI.UIComboBox.Box_SelectedIndexChanged(Object sender, EventArgs e)
在 System.EventHandler.Invoke(Object sender, EventArgs e)
在 System.Windows.Forms.ListBox.OnSelectedIndexChanged(EventArgs e)
在 Sunny.UI.ListBoxEx.OnSelectedIndexChanged(EventArgs e)
在 System.Windows.Forms.ListBox.ClearSelected()
在 System.Windows.Forms.ListBox.set_SelectedIndex(Int32 value)
在 System.Windows.Forms.ListControl.set_SelectedValue(Object value)
在 Sunny.UI.UIComboBox.set_SelectedValue(Object value)
在 LeatherApp.UIExtend.UIDefectImage.set_Code(String value) 位置 E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\LeatherApp\UIExtend\UIDefectImage.cs:行号 45
在 LeatherApp.Page.FHome_Defect.<init>b__4_0(DefectInfo item) 位置 E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\LeatherApp\Page\FHome_Defect.cs:行号 36
在 System.Collections.Generic.List`1.ForEach(Action`1 action)
在 LeatherApp.Page.FHome_Defect.init() 位置 E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\LeatherApp\Page\FHome_Defect.cs:行号 35
在 LeatherApp.Page.FHome_Defect..ctor(List`1 lst, Mat img) 位置 E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\LeatherApp\Page\FHome_Defect.cs:行号 29
在 LeatherApp.Page.FHome.button1_Click(Object sender, EventArgs e) 位置 E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\LeatherApp\Page\FHome.cs:行号 2157
在 System.Windows.Forms.Control.OnClick(EventArgs e)
在 System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
在 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
在 System.Windows.Forms.Control.WndProc(Message& m)
在 System.Windows.Forms.ButtonBase.WndProc(Message& m)
在 System.Windows.Forms.Button.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
2024-07-25 10:49:30
Global捕获到未处理异常System.NullReferenceException
异常信息:未将对象引用设置到对象的实例。
异常堆栈: 在 LeatherApp.Page.FHome.button1_Click(Object sender, EventArgs e) 位置 E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\LeatherApp\Page\FHome.cs:行号 2174
在 System.Windows.Forms.Control.OnClick(EventArgs e)
在 System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
在 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
在 System.Windows.Forms.Control.WndProc(Message& m)
在 System.Windows.Forms.ButtonBase.WndProc(Message& m)
在 System.Windows.Forms.Button.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

View File

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

View File

@ -25,6 +25,11 @@ ScannerReversalX=false
ScannerReversalY=true
[Material]
SuedeList=BSF,SF,SL,SD
SuedeList2=
SuedeList3=
SuedeList4=
SuedeList5=
SuedeList6=
[LIB]
model_path=./models/best_0805_bs8.onnx
labels_path=./models/hexin.names
@ -34,13 +39,6 @@ ImagePath=F:\LeatherApp\images\
SaveAllImage=False
SaveDefectSourceImage=False
SaveDefectCutImage=False
cm2px_x=90
cm2px_y=90
MarginHoleWidth=0
MiddleSuperposition=0
IsSaveAllImage=False
IsSaveDefectSourceImage=False
IsSaveDefectCutImage=False
[DB]
DBConStr=server=localhost;Database=LeatherDB;Uid=root;Pwd=123456; AllowLoadLocalInfile=true
[ErpDB]
@ -50,3 +48,5 @@ ErpDBConStr=connectionString="Server=127.0.0.1;Database=testDB;User Id=sa;Passwo
ErpSql=select * from t2 where 1=1
[LOG]
LogPath=F:\LeatherApp\log\
[SkipLabelGrade]
LabelGradeList=laji,wenchong,chongying

Binary file not shown.

Before

Width:  |  Height:  |  Size: 158 MiB

File diff suppressed because one or more lines are too long

View File

@ -106,6 +106,12 @@ namespace Models
/// </summary>
[SugarColumn(IsNullable = true)]
public double residueWarnningLen { get; set; }
/// <summary>
/// 等级判断提示裁切
/// </summary>
[SugarColumn(IsNullable = true)]
public bool IsHintCutting { get; set; }
}
/// <summary>
@ -142,9 +148,8 @@ namespace Models
/// <summary>
/// 等级划分标准
/// </summary>
[SugarIndex("index_{table}_Pid_Code",
nameof(GradeLimit.Pid), OrderByType.Asc,
nameof(GradeLimit.Code), OrderByType.Asc, isUnique: true)]
[SugarIndex("index_{table}_Pid",
nameof(GradeLimit.Pid), OrderByType.Asc, isUnique: true)]
public class GradeLimit : BaseTable
{
public int Pid { get; set; }
@ -152,7 +157,13 @@ namespace Models
/// dk,xws,...
/// </summary>
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 B { get; set; }

View File

@ -144,6 +144,19 @@ namespace Models
/// </summary>
[SugarColumn(IsIgnore = true)]
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>
@ -210,4 +223,52 @@ namespace Models
[SugarColumn(IsIgnore = true)]
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("Records", false)) db.DbMaintenance.DropTable("Records");
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>();
@ -54,6 +55,7 @@ namespace Service
db.CodeFirst.InitTables<Models.GradeLimit>();
db.CodeFirst.InitTables<Models.Records>();
db.CodeFirst.InitTables<Models.DefectInfo>();
db.CodeFirst.InitTables<Models.GradeDifferentiateInfo>();
//更改表数据
try

View File

@ -52,7 +52,8 @@ namespace Service
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)
.Includes(m => m.DefectInfoList)
.Includes(m => m.DefectInfoList)
.Includes(m => m.GradeDifferentiateInfoList)
.First(m => m.Id == id);
}
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)
{
return base.AsSugarClient().InsertNav(model)
.Include(m => m.DefectInfoList)
.Include(m => m.DefectInfoList)
.Include(m => m.GradeDifferentiateInfoList)
.ExecuteCommand();
}
public bool DelNav(Models.Records model)
{
return base.AsSugarClient().DeleteNav(model)
.Include(a => a.DefectInfoList)//.ThenInclude(z1 => z1.RoomList) //插入2层 Root->ShoolA->RoomList
.Include(m => m.GradeDifferentiateInfoList)
.ExecuteCommand();
}