diff --git a/LeatherProject/.vs/LeatherApp/FileContentIndex/1f77c647-ee08-4001-9a36-e7c45492a0af.vsidx b/LeatherProject/.vs/LeatherApp/FileContentIndex/1f77c647-ee08-4001-9a36-e7c45492a0af.vsidx deleted file mode 100644 index e265543..0000000 Binary files a/LeatherProject/.vs/LeatherApp/FileContentIndex/1f77c647-ee08-4001-9a36-e7c45492a0af.vsidx and /dev/null differ diff --git a/LeatherProject/.vs/LeatherApp/FileContentIndex/2865db31-fea4-4e65-8e2e-c78b5d7e8f8f.vsidx b/LeatherProject/.vs/LeatherApp/FileContentIndex/2865db31-fea4-4e65-8e2e-c78b5d7e8f8f.vsidx new file mode 100644 index 0000000..d4c0e5b Binary files /dev/null and b/LeatherProject/.vs/LeatherApp/FileContentIndex/2865db31-fea4-4e65-8e2e-c78b5d7e8f8f.vsidx differ diff --git a/LeatherProject/.vs/LeatherApp/FileContentIndex/2eaf4d9d-4bd8-4252-b924-61dcb944494c.vsidx b/LeatherProject/.vs/LeatherApp/FileContentIndex/2eaf4d9d-4bd8-4252-b924-61dcb944494c.vsidx deleted file mode 100644 index 2974237..0000000 Binary files a/LeatherProject/.vs/LeatherApp/FileContentIndex/2eaf4d9d-4bd8-4252-b924-61dcb944494c.vsidx and /dev/null differ diff --git a/LeatherProject/.vs/LeatherApp/FileContentIndex/334983ad-2e9a-45e3-8e27-e10cb1641111.vsidx b/LeatherProject/.vs/LeatherApp/FileContentIndex/334983ad-2e9a-45e3-8e27-e10cb1641111.vsidx deleted file mode 100644 index cf2deb1..0000000 Binary files a/LeatherProject/.vs/LeatherApp/FileContentIndex/334983ad-2e9a-45e3-8e27-e10cb1641111.vsidx and /dev/null differ diff --git a/LeatherProject/.vs/LeatherApp/FileContentIndex/51b1d98f-624a-4632-86a3-0e1aed712bd5.vsidx b/LeatherProject/.vs/LeatherApp/FileContentIndex/51b1d98f-624a-4632-86a3-0e1aed712bd5.vsidx new file mode 100644 index 0000000..062673f Binary files /dev/null and b/LeatherProject/.vs/LeatherApp/FileContentIndex/51b1d98f-624a-4632-86a3-0e1aed712bd5.vsidx differ diff --git a/LeatherProject/.vs/LeatherApp/FileContentIndex/5cfb1fc0-c3ef-401d-a9b2-0bba4af3b6a3.vsidx b/LeatherProject/.vs/LeatherApp/FileContentIndex/5cfb1fc0-c3ef-401d-a9b2-0bba4af3b6a3.vsidx new file mode 100644 index 0000000..c2f20bb Binary files /dev/null and b/LeatherProject/.vs/LeatherApp/FileContentIndex/5cfb1fc0-c3ef-401d-a9b2-0bba4af3b6a3.vsidx differ diff --git a/LeatherProject/.vs/LeatherApp/FileContentIndex/6b0d4daa-4cdd-497d-b720-53918bd7c3b6.vsidx b/LeatherProject/.vs/LeatherApp/FileContentIndex/6b0d4daa-4cdd-497d-b720-53918bd7c3b6.vsidx new file mode 100644 index 0000000..ad9c12f Binary files /dev/null and b/LeatherProject/.vs/LeatherApp/FileContentIndex/6b0d4daa-4cdd-497d-b720-53918bd7c3b6.vsidx differ diff --git a/LeatherProject/.vs/LeatherApp/FileContentIndex/fd572fcf-5d30-4ba2-8bb8-7b47269abcc3.vsidx b/LeatherProject/.vs/LeatherApp/FileContentIndex/fd572fcf-5d30-4ba2-8bb8-7b47269abcc3.vsidx deleted file mode 100644 index e60a8a4..0000000 Binary files a/LeatherProject/.vs/LeatherApp/FileContentIndex/fd572fcf-5d30-4ba2-8bb8-7b47269abcc3.vsidx and /dev/null differ diff --git a/LeatherProject/GeBoShi/GeBoShi.csproj b/LeatherProject/GeBoShi/GeBoShi.csproj index 864a51f..60762d0 100644 --- a/LeatherProject/GeBoShi/GeBoShi.csproj +++ b/LeatherProject/GeBoShi/GeBoShi.csproj @@ -22,6 +22,7 @@ DEBUG;TRACE prompt 4 + true AnyCPU @@ -33,8 +34,7 @@ 4 - - + Ge.ico @@ -43,6 +43,7 @@ ..\..\..\..\..\..\模块化\Code\MaiMuControl\MaiMuControl\bin\x64\Debug\CSkin.dll + ..\..\..\..\..\版博士\源码\V2.0\halftoneproject-master\BanBoShi\Dlls\HZH_Controls.dll @@ -53,12 +54,14 @@ False ..\Models\bin\Debug\Models.dll + ..\packages\OpenCvSharp4.4.8.0.20230708\lib\net48\OpenCvSharp.dll ..\packages\OpenCvSharp4.Extensions.4.7.0.20230115\lib\net48\OpenCvSharp.Extensions.dll + ..\Service\bin\Debug\Service.dll @@ -112,8 +115,10 @@ + + Form @@ -181,5 +186,8 @@ + + + \ No newline at end of file diff --git a/LeatherProject/GeBoShi/ImageDefect/DefectLib.cs b/LeatherProject/GeBoShi/ImageDefect/DefectLib.cs index b587514..bf235db 100644 --- a/LeatherProject/GeBoShi/ImageDefect/DefectLib.cs +++ b/LeatherProject/GeBoShi/ImageDefect/DefectLib.cs @@ -1,7 +1,10 @@ -using HZH_Controls.Controls; +using CCWin.Win32.Const; +using GeBoShi.SysCtrl; +using HZH_Controls.Controls; using MaiMuControl.Device; using Models; using OpenCvSharp; +using S7.Net.Types; using System; using System.Collections.Generic; using System.Data; @@ -180,6 +183,22 @@ namespace GeBoShi.ImageDefect return array; } + public static string ToGB2312(int codepage, string str) + { + try + { + Encoding cp850 = Encoding.GetEncoding(codepage); + Encoding gb2312 = Encoding.GetEncoding("gb2312");//Encoding.Default ,936 + byte[] temp = cp850.GetBytes(str); + return Encoding.GetEncoding("gb2312").GetString(temp, 0, temp.Length); + } + catch (Exception ex)//(UnsupportedEncodingException ex) + { + Console.Write(ex.Message); + return null; + } + } + private void runStep() { int step = 0; @@ -211,9 +230,11 @@ namespace GeBoShi.ImageDefect detector = IntPtr.Zero; } step = 5; - detector = CreateDetector($"./models/{task.modelName}"); + string modelPath = $"{ConfMgr.Instance.SysConfigParams.AIModelPath}\\{task.modelName}"; + + detector = CreateDetector(modelPath); if (detector == IntPtr.Zero) - throw new Exception($"模型({task.modelName})初始化失败!"); + throw new Exception($"模型({modelPath})初始化失败!"); step = 6; preModelName = task.modelName; } @@ -379,8 +400,8 @@ namespace GeBoShi.ImageDefect //y = image_hight-y-h;//转到右下角为原点 count++; - var cmW = Math.Round(w * task.widthRatio / task.cm2px_x, 2); - var cmH = Math.Round(h * task.widthRatio / task.cm2px_y, 2); + //var cmW = Math.Round(w * task.widthRatio / task.cm2px_x, 2); + //var cmH = Math.Round(h * task.widthRatio / task.cm2px_y, 2); // 打印输出信息 task.resultInfo += $"----{i}----col:{i % colNum}/{colNum} row:{i / colNum}/{colNum}-----------\n目标:{j + 1} 类别ID:{classId} 置信度:{confidence} 对比度:{contrast} 坐标:({x},{y})-({x + w},{y + h}) 宽高:w={w},h={h}; \n"; @@ -403,6 +424,12 @@ namespace GeBoShi.ImageDefect #endregion } + #region 合并接头横档 + if(DefectLabelInfoList.Count >0) + DefectLabelInfoList = HeBingDefect(task.bmp.Width, "jietou", DefectLabelInfoList); + if (DefectLabelInfoList.Count > 0) + DefectLabelInfoList = HeBingDefect(task.bmp.Width, "hengdang", DefectLabelInfoList); + #endregion //结果过滤 #region 结果过滤 //降序排序,先得到是否有接头检出 @@ -465,12 +492,14 @@ namespace GeBoShi.ImageDefect liStep++;//2 task.resultInfo += $" 转换到大图坐标(px):p1={point1.X},{point1.Y}; p2={point2.X},{point2.Y}\n"; Cv2.Rectangle(task.bmpTag, point1, point2, new Scalar(0.0, 0.0, 255.0), 1);//画打标点 - //WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low, $"保存第 {count} 行缺陷信息;"); - var cmX = Math.Round(point1.X * task.widthRatio / task.cm2px_x, 2); + + //WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low, $"保存第 {count} 行缺陷信息;"); + int px = (point1.X - task.xw) > 0 ? (point1.X - task.xw) : 0; + var cmX = Math.Round(px * task.widthRatio / task.cm2px_x, 2); var cmY = Math.Round((task.bmp.Height - point1.Y - DefectLabelInfoList[q].h) * task.widthRatio / task.cm2px_y, 2);//外面计Y从右下角为原点 liStep++;//3 task.resultInfo += $" 转换到大图坐标(cm)[widthRatio={task.widthRatio}]:x={cmX},y={cmY}; w={DefectLabelInfoList[q].cmW},h={DefectLabelInfoList[q].cmH}\n"; - task.excelTable.Rows.Add($"{task.photoIndex}", cmX, cmY, DefectLabelInfoList[q].cmW, DefectLabelInfoList[q].cmH, DefectLabelInfoList[q].j + 1, DefectLabelInfoList[q].classId, DefectLabelInfoList[q].confidence, DefectLabelInfoList[q].contrast); + task.excelTable.Rows.Add($"{task.photoIndex}", cmX, cmY, DefectLabelInfoList[q].cmW, DefectLabelInfoList[q].cmH, DefectLabelInfoList[q].j + 1, DefectLabelInfoList[q].classId, DefectLabelInfoList[q].confidence, Utils.ContrastToPercent(DefectLabelInfoList[q].contrast)); liStep++;//4 //切缺陷小图 @@ -522,6 +551,73 @@ namespace GeBoShi.ImageDefect } } + #region 词条合并 + private List HeBingDefect(int Width, string label, List DefectLabelInfoList) + { + int fw = 500; + List outList = new List(); + + List HeBingList = new List(); + List XcHeBingList = new List(); + List xPos = new List(); + List xZXD = new List(); + + DefectLabelInfo stpoint = DefectLabelInfoList[0]; + + int colNum = Width / image_width; + //寻找在一条线上 + for (int q = 0; q < DefectLabelInfoList.Count; q++) + { + if (SysMgr.Instance.GetDefectCode()[DefectLabelInfoList[q].classId] == label) + { + int max = stpoint.y + fw; + int min = stpoint.y - fw > 0 ? stpoint.y - fw : 0; + if (DefectLabelInfoList[q].y >= min && DefectLabelInfoList[q].y <= max) + { + HeBingList.Add(DefectLabelInfoList[q]); + xPos.Add(DefectLabelInfoList[q].x); + xZXD.Add(DefectLabelInfoList[q].confidence); + } + else + XcHeBingList.Add(DefectLabelInfoList[q]); + } + else + outList.Add(DefectLabelInfoList[q]); + } + //递归下次合并数据 + List dg1 = new List(); + if (XcHeBingList.Count > 0) + dg1 = HeBingDefect(Width, label, XcHeBingList); + + + //多个jietou合并 + if (HeBingList.Count > 0) + { + var stIt = HeBingList.Find(x => x.x == xPos.Min()); + var edIt = HeBingList.Find(x => x.x == xPos.Max()); + var eZXD = HeBingList.Find(x => x.confidence == xZXD.Max()); + int newW = Math.Abs((edIt.i % colNum) * image_width + edIt.x) - ((stIt.i % colNum) * image_width + stIt.x) + edIt.w; + outList.Add(new DefectLabelInfo() + { + x = stIt.x, + y = edIt.y, + w = newW, //多图叠加 + h = edIt.h, + classId = eZXD.classId, + confidence = eZXD.confidence, + contrast = eZXD.contrast, + cmH = Math.Round(edIt.h * 1.0 / ConfMgr.Instance.SysConfigParams.Cm2px_y, 2), + cmW = Math.Round(newW * 1.0 / ConfMgr.Instance.SysConfigParams.Cm2px_x, 2), + i = stIt.i, + j = stIt.j, + }); + } + + outList = outList.Concat(dg1).ToList();//保留重复项 + return outList; + } + #endregion + #region 结果回调 private void callback(DefectTask task) { @@ -693,5 +789,10 @@ namespace GeBoShi.ImageDefect /// public DataTable excelTable = new DataTable(); public long[] stopwatch = new long[4]; + + /// + /// 等比例填充的宽度 + /// + public int xw; } } diff --git a/LeatherProject/GeBoShi/Main.Designer.cs b/LeatherProject/GeBoShi/Main.Designer.cs index 3c3ab2f..298860f 100644 --- a/LeatherProject/GeBoShi/Main.Designer.cs +++ b/LeatherProject/GeBoShi/Main.Designer.cs @@ -30,17 +30,17 @@ { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Main)); - System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea5 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); - System.Windows.Forms.DataVisualization.Charting.Legend legend5 = new System.Windows.Forms.DataVisualization.Charting.Legend(); - System.Windows.Forms.DataVisualization.Charting.Series series5 = new System.Windows.Forms.DataVisualization.Charting.Series(); - System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea6 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); - System.Windows.Forms.DataVisualization.Charting.Legend legend6 = new System.Windows.Forms.DataVisualization.Charting.Legend(); - System.Windows.Forms.DataVisualization.Charting.Series series6 = new System.Windows.Forms.DataVisualization.Charting.Series(); - 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 dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); + System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend(); + System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); + System.Windows.Forms.DataVisualization.Charting.Legend legend2 = new System.Windows.Forms.DataVisualization.Charting.Legend(); + System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = 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(); this.toolStrip1 = new System.Windows.Forms.ToolStrip(); this.toolStripSeparator10 = new System.Windows.Forms.ToolStripSeparator(); this.tsbtnImpStop = new System.Windows.Forms.ToolStripButton(); @@ -120,15 +120,27 @@ this.groupBox1 = new System.Windows.Forms.GroupBox(); this.panel4 = new System.Windows.Forms.Panel(); this.skinDataGridView1 = new CCWin.SkinControl.SkinDataGridView(); - this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.tsAxisState = new System.Windows.Forms.ToolStripStatusLabel(); this.tsslLoginTime = new System.Windows.Forms.ToolStripStatusLabel(); this.tsslLoginInfo = new System.Windows.Forms.ToolStripStatusLabel(); this.tslabelTime = new System.Windows.Forms.ToolStripStatusLabel(); this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components); + this.colUid = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colCode = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colIndex = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colDefectName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colX = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colY = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colW = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colH = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colArea = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colZXD = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colTarget = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker(); this.uiTitel1 = new MaiMuControl.UIKits.MaiMuMenu.UITitel(); + this.lblDefectSpeed = new System.Windows.Forms.Label(); + this.lblDefectLen = new System.Windows.Forms.Label(); this.toolStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); @@ -214,6 +226,7 @@ this.tsbtnImpStop.Size = new System.Drawing.Size(60, 53); this.tsbtnImpStop.Text = "结束验布"; this.tsbtnImpStop.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText; + this.tsbtnImpStop.Click += new System.EventHandler(this.tsbtnImpStop_Click); // // tsbtnStart // @@ -225,6 +238,7 @@ this.tsbtnStart.Size = new System.Drawing.Size(60, 53); this.tsbtnStart.Text = "开始验布"; this.tsbtnStart.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText; + this.tsbtnStart.Click += new System.EventHandler(this.tsbtnStart_Click); // // tsbtnStop // @@ -236,6 +250,7 @@ this.tsbtnStop.Size = new System.Drawing.Size(52, 53); this.tsbtnStop.Text = " 暂停 "; this.tsbtnStop.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText; + this.tsbtnStop.Click += new System.EventHandler(this.tsbtnStop_Click); // // toolStripSeparator2 // @@ -252,6 +267,7 @@ this.tsbtnWarning.Size = new System.Drawing.Size(60, 53); this.tsbtnWarning.Text = "解除报警"; this.tsbtnWarning.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText; + this.tsbtnWarning.Click += new System.EventHandler(this.tsbtnWarning_Click); // // toolStripSeparator3 // @@ -268,6 +284,8 @@ this.tsbtnReset.Size = new System.Drawing.Size(52, 53); this.tsbtnReset.Text = " 复位 "; this.tsbtnReset.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText; + this.tsbtnReset.Visible = false; + this.tsbtnReset.Click += new System.EventHandler(this.tsbtnReset_Click); // // tsbGoHome // @@ -279,6 +297,7 @@ this.tsbGoHome.Size = new System.Drawing.Size(60, 53); this.tsbGoHome.Text = "硬件重启"; this.tsbGoHome.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText; + this.tsbGoHome.Click += new System.EventHandler(this.tsbGoHome_Click); // // menuStrip1 // @@ -314,20 +333,20 @@ this.tsmPdtMgr.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.tsmPdtMgr.Image = ((System.Drawing.Image)(resources.GetObject("tsmPdtMgr.Image"))); this.tsmPdtMgr.Name = "tsmPdtMgr"; - this.tsmPdtMgr.Size = new System.Drawing.Size(124, 22); + this.tsmPdtMgr.Size = new System.Drawing.Size(180, 22); this.tsmPdtMgr.Text = "检测管理"; this.tsmPdtMgr.Click += new System.EventHandler(this.tsmPdtMgr_Click); // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(121, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(177, 6); // // 退出ToolStripMenuItem // this.退出ToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("退出ToolStripMenuItem.Image"))); this.退出ToolStripMenuItem.Name = "退出ToolStripMenuItem"; - this.退出ToolStripMenuItem.Size = new System.Drawing.Size(124, 22); + this.退出ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.退出ToolStripMenuItem.Text = "退出"; this.退出ToolStripMenuItem.Click += new System.EventHandler(this.退出ToolStripMenuItem_Click); // @@ -393,21 +412,22 @@ // this.tsmSysSet.Image = ((System.Drawing.Image)(resources.GetObject("tsmSysSet.Image"))); this.tsmSysSet.Name = "tsmSysSet"; - this.tsmSysSet.Size = new System.Drawing.Size(124, 22); + this.tsmSysSet.Size = new System.Drawing.Size(180, 22); this.tsmSysSet.Text = "系统设置"; this.tsmSysSet.Click += new System.EventHandler(this.tsmSysSet_Click); // // toolStripSeparator5 // this.toolStripSeparator5.Name = "toolStripSeparator5"; - this.toolStripSeparator5.Size = new System.Drawing.Size(121, 6); + this.toolStripSeparator5.Size = new System.Drawing.Size(177, 6); // // tsmDebug // this.tsmDebug.Image = ((System.Drawing.Image)(resources.GetObject("tsmDebug.Image"))); this.tsmDebug.Name = "tsmDebug"; - this.tsmDebug.Size = new System.Drawing.Size(124, 22); + this.tsmDebug.Size = new System.Drawing.Size(180, 22); this.tsmDebug.Text = "调试"; + this.tsmDebug.Click += new System.EventHandler(this.tsmDebug_Click); // // tsmHelp // @@ -428,32 +448,32 @@ // this.tsmReadLog.Image = ((System.Drawing.Image)(resources.GetObject("tsmReadLog.Image"))); this.tsmReadLog.Name = "tsmReadLog"; - this.tsmReadLog.Size = new System.Drawing.Size(148, 22); + this.tsmReadLog.Size = new System.Drawing.Size(180, 22); this.tsmReadLog.Text = "日志查询"; // // toolStripSeparator6 // this.toolStripSeparator6.Name = "toolStripSeparator6"; - this.toolStripSeparator6.Size = new System.Drawing.Size(145, 6); + this.toolStripSeparator6.Size = new System.Drawing.Size(177, 6); // // tsmHelpInfo // this.tsmHelpInfo.Image = ((System.Drawing.Image)(resources.GetObject("tsmHelpInfo.Image"))); this.tsmHelpInfo.Name = "tsmHelpInfo"; - this.tsmHelpInfo.Size = new System.Drawing.Size(148, 22); + this.tsmHelpInfo.Size = new System.Drawing.Size(180, 22); this.tsmHelpInfo.Text = "帮助"; // // tsmInfoUS // this.tsmInfoUS.Image = ((System.Drawing.Image)(resources.GetObject("tsmInfoUS.Image"))); this.tsmInfoUS.Name = "tsmInfoUS"; - this.tsmInfoUS.Size = new System.Drawing.Size(148, 22); + this.tsmInfoUS.Size = new System.Drawing.Size(180, 22); this.tsmInfoUS.Text = "关于"; // // tsmSoftFile // this.tsmSoftFile.Name = "tsmSoftFile"; - this.tsmSoftFile.Size = new System.Drawing.Size(148, 22); + this.tsmSoftFile.Size = new System.Drawing.Size(180, 22); this.tsmSoftFile.Text = "软件使用说明"; // // splitContainer1 @@ -485,9 +505,9 @@ this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.RowCount = 3; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 244F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 120F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 251F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 144F)); this.tableLayoutPanel1.Size = new System.Drawing.Size(381, 496); this.tableLayoutPanel1.TabIndex = 0; // @@ -502,7 +522,7 @@ this.gpbProductInfo.Margin = new System.Windows.Forms.Padding(2); this.gpbProductInfo.Name = "gpbProductInfo"; this.gpbProductInfo.Padding = new System.Windows.Forms.Padding(2); - this.gpbProductInfo.Size = new System.Drawing.Size(377, 240); + this.gpbProductInfo.Size = new System.Drawing.Size(377, 247); this.gpbProductInfo.TabIndex = 4; this.gpbProductInfo.TabStop = false; this.gpbProductInfo.Text = "产品信息"; @@ -526,7 +546,7 @@ this.panel1.Location = new System.Drawing.Point(2, 16); this.panel1.Margin = new System.Windows.Forms.Padding(2); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(373, 222); + this.panel1.Size = new System.Drawing.Size(373, 229); this.panel1.TabIndex = 0; // // cbDefectCode @@ -703,9 +723,9 @@ // this.panel2.Controls.Add(this.groupBox2); this.panel2.Dock = System.Windows.Forms.DockStyle.Fill; - this.panel2.Location = new System.Drawing.Point(3, 247); + this.panel2.Location = new System.Drawing.Point(3, 254); this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(375, 100); + this.panel2.Size = new System.Drawing.Size(375, 95); this.panel2.TabIndex = 5; // // groupBox2 @@ -721,7 +741,7 @@ this.groupBox2.Margin = new System.Windows.Forms.Padding(2); this.groupBox2.Name = "groupBox2"; this.groupBox2.Padding = new System.Windows.Forms.Padding(2); - this.groupBox2.Size = new System.Drawing.Size(375, 100); + this.groupBox2.Size = new System.Drawing.Size(375, 95); this.groupBox2.TabIndex = 8; this.groupBox2.TabStop = false; this.groupBox2.Text = "检测控制"; @@ -730,7 +750,7 @@ // this.label7.AutoSize = true; this.label7.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label7.Location = new System.Drawing.Point(37, 65); + this.label7.Location = new System.Drawing.Point(39, 59); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(93, 20); this.label7.TabIndex = 8; @@ -753,9 +773,9 @@ this.ucSwitch1.FalseColor = System.Drawing.Color.FromArgb(((int)(((byte)(189)))), ((int)(((byte)(189)))), ((int)(((byte)(189))))); this.ucSwitch1.FalseTextColr = System.Drawing.Color.Black; this.ucSwitch1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.ucSwitch1.Location = new System.Drawing.Point(187, 59); + this.ucSwitch1.Location = new System.Drawing.Point(177, 53); this.ucSwitch1.Name = "ucSwitch1"; - this.ucSwitch1.Size = new System.Drawing.Size(83, 31); + this.ucSwitch1.Size = new System.Drawing.Size(80, 28); this.ucSwitch1.SwitchType = HZH_Controls.Controls.SwitchType.Ellipse; this.ucSwitch1.TabIndex = 0; this.ucSwitch1.Texts = new string[] { @@ -786,9 +806,9 @@ // this.panel3.Controls.Add(this.gpbLog); this.panel3.Dock = System.Windows.Forms.DockStyle.Fill; - this.panel3.Location = new System.Drawing.Point(3, 353); + this.panel3.Location = new System.Drawing.Point(3, 355); this.panel3.Name = "panel3"; - this.panel3.Size = new System.Drawing.Size(375, 140); + this.panel3.Size = new System.Drawing.Size(375, 138); this.panel3.TabIndex = 6; // // gpbLog @@ -803,7 +823,7 @@ this.gpbLog.Margin = new System.Windows.Forms.Padding(2); this.gpbLog.Name = "gpbLog"; this.gpbLog.Padding = new System.Windows.Forms.Padding(2); - this.gpbLog.Size = new System.Drawing.Size(375, 119); + this.gpbLog.Size = new System.Drawing.Size(375, 117); this.gpbLog.TabIndex = 7; this.gpbLog.TabStop = false; this.gpbLog.Text = "日志信息"; @@ -817,8 +837,9 @@ this.lstLog.ItemHeight = 16; this.lstLog.Location = new System.Drawing.Point(2, 16); this.lstLog.Name = "lstLog"; - this.lstLog.Size = new System.Drawing.Size(371, 101); + this.lstLog.Size = new System.Drawing.Size(371, 99); this.lstLog.TabIndex = 27; + this.lstLog.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.lstLog_DrawItem); // // splitContainer2 // @@ -834,7 +855,7 @@ // this.splitContainer2.Panel2.Controls.Add(this.tableLayoutPanel3); this.splitContainer2.Size = new System.Drawing.Size(760, 496); - this.splitContainer2.SplitterDistance = 483; + this.splitContainer2.SplitterDistance = 482; this.splitContainer2.TabIndex = 0; // // splitContainer3 @@ -851,7 +872,7 @@ // splitContainer3.Panel2 // this.splitContainer3.Panel2.Controls.Add(this.skinTabImage); - this.splitContainer3.Size = new System.Drawing.Size(483, 496); + this.splitContainer3.Size = new System.Drawing.Size(482, 496); this.splitContainer3.SplitterDistance = 245; this.splitContainer3.TabIndex = 0; // @@ -866,7 +887,7 @@ this.groupBox3.Margin = new System.Windows.Forms.Padding(2); this.groupBox3.Name = "groupBox3"; this.groupBox3.Padding = new System.Windows.Forms.Padding(2); - this.groupBox3.Size = new System.Drawing.Size(483, 245); + this.groupBox3.Size = new System.Drawing.Size(482, 245); this.groupBox3.TabIndex = 6; this.groupBox3.TabStop = false; this.groupBox3.Text = "瑕疵分布"; @@ -879,23 +900,38 @@ this.panel5.Location = new System.Drawing.Point(2, 16); this.panel5.Margin = new System.Windows.Forms.Padding(2); this.panel5.Name = "panel5"; - this.panel5.Size = new System.Drawing.Size(479, 227); + this.panel5.Size = new System.Drawing.Size(478, 227); this.panel5.TabIndex = 0; // // chart1 // - chartArea5.Name = "ChartArea1"; - this.chart1.ChartAreas.Add(chartArea5); + chartArea1.AxisX.LabelStyle.Format = "N0"; + chartArea1.AxisX.Maximum = 160D; + chartArea1.AxisX.Minimum = 0D; + chartArea1.AxisY.Interval = 5D; + chartArea1.AxisY.LabelStyle.Format = "N0"; + chartArea1.AxisY.MaximumAutoSize = 90F; + chartArea1.AxisY.Minimum = 0D; + chartArea1.AxisY.ScaleView.MinSize = 1D; + chartArea1.AxisY.ScaleView.Size = 20D; + chartArea1.AxisY.ScaleView.Zoomable = false; + chartArea1.AxisY.ScrollBar.BackColor = System.Drawing.Color.WhiteSmoke; + chartArea1.AxisY.ScrollBar.ButtonColor = System.Drawing.Color.LightGray; + chartArea1.AxisY.ScrollBar.ButtonStyle = System.Windows.Forms.DataVisualization.Charting.ScrollBarButtonStyles.SmallScroll; + chartArea1.AxisY.ScrollBar.IsPositionedInside = false; + chartArea1.AxisY.ScrollBar.LineColor = System.Drawing.Color.Gray; + chartArea1.Name = "ChartArea1"; + this.chart1.ChartAreas.Add(chartArea1); this.chart1.Dock = System.Windows.Forms.DockStyle.Fill; - legend5.Name = "Legend1"; - this.chart1.Legends.Add(legend5); + legend1.Name = "Legend1"; + this.chart1.Legends.Add(legend1); this.chart1.Location = new System.Drawing.Point(0, 0); this.chart1.Name = "chart1"; - series5.ChartArea = "ChartArea1"; - series5.Legend = "Legend1"; - series5.Name = "Series1"; - this.chart1.Series.Add(series5); - this.chart1.Size = new System.Drawing.Size(479, 227); + series1.ChartArea = "ChartArea1"; + series1.Legend = "Legend1"; + series1.Name = "Series1"; + this.chart1.Series.Add(series1); + this.chart1.Size = new System.Drawing.Size(478, 227); this.chart1.TabIndex = 0; this.chart1.Text = "chart1"; // @@ -910,7 +946,7 @@ this.skinTabImage.Controls.Add(this.skinTabPage2); this.skinTabImage.HeadBack = null; this.skinTabImage.ImgTxtOffset = new System.Drawing.Point(0, 0); - this.skinTabImage.ItemSize = new System.Drawing.Size(240, 36); + this.skinTabImage.ItemSize = new System.Drawing.Size(239, 36); this.skinTabImage.ItemStretch = true; this.skinTabImage.Location = new System.Drawing.Point(0, 0); this.skinTabImage.Name = "skinTabImage"; @@ -925,8 +961,8 @@ this.skinTabImage.PageImagePosition = CCWin.SkinControl.SkinTabControl.ePageImagePosition.Left; this.skinTabImage.PageNorml = null; this.skinTabImage.PageNormlTxtColor = System.Drawing.Color.White; - this.skinTabImage.SelectedIndex = 0; - this.skinTabImage.Size = new System.Drawing.Size(483, 222); + this.skinTabImage.SelectedIndex = 1; + this.skinTabImage.Size = new System.Drawing.Size(482, 222); this.skinTabImage.SizeMode = System.Windows.Forms.TabSizeMode.Fixed; this.skinTabImage.TabIndex = 0; // @@ -938,7 +974,7 @@ this.skinTabPage1.ForeColor = System.Drawing.SystemColors.ButtonHighlight; this.skinTabPage1.Location = new System.Drawing.Point(0, 36); this.skinTabPage1.Name = "skinTabPage1"; - this.skinTabPage1.Size = new System.Drawing.Size(483, 186); + this.skinTabPage1.Size = new System.Drawing.Size(482, 186); this.skinTabPage1.TabIndex = 0; this.skinTabPage1.TabItemImage = null; this.skinTabPage1.Text = "实时采集图像"; @@ -955,7 +991,7 @@ this.tableLayoutPanel2.Name = "tableLayoutPanel2"; this.tableLayoutPanel2.RowCount = 1; this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel2.Size = new System.Drawing.Size(483, 186); + this.tableLayoutPanel2.Size = new System.Drawing.Size(482, 186); this.tableLayoutPanel2.TabIndex = 0; // // pictureBox3 @@ -966,7 +1002,7 @@ this.pictureBox3.Location = new System.Drawing.Point(243, 2); this.pictureBox3.Margin = new System.Windows.Forms.Padding(2); this.pictureBox3.Name = "pictureBox3"; - this.pictureBox3.Size = new System.Drawing.Size(238, 182); + this.pictureBox3.Size = new System.Drawing.Size(237, 182); this.pictureBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox3.TabIndex = 12; this.pictureBox3.TabStop = false; @@ -992,7 +1028,7 @@ this.skinTabPage2.ForeColor = System.Drawing.SystemColors.ButtonHighlight; this.skinTabPage2.Location = new System.Drawing.Point(0, 36); this.skinTabPage2.Name = "skinTabPage2"; - this.skinTabPage2.Size = new System.Drawing.Size(483, 186); + this.skinTabPage2.Size = new System.Drawing.Size(482, 186); this.skinTabPage2.TabIndex = 1; this.skinTabPage2.TabItemImage = null; this.skinTabPage2.Text = "处理合并图像"; @@ -1005,7 +1041,7 @@ this.pictureBox1.Location = new System.Drawing.Point(0, 0); this.pictureBox1.Margin = new System.Windows.Forms.Padding(2); this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(483, 186); + this.pictureBox1.Size = new System.Drawing.Size(482, 186); this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox1.TabIndex = 10; this.pictureBox1.TabStop = false; @@ -1024,7 +1060,7 @@ this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 40F)); this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 30F)); this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 30F)); - this.tableLayoutPanel3.Size = new System.Drawing.Size(273, 496); + this.tableLayoutPanel3.Size = new System.Drawing.Size(274, 496); this.tableLayoutPanel3.TabIndex = 0; // // panel8 @@ -1033,7 +1069,7 @@ this.panel8.Dock = System.Windows.Forms.DockStyle.Fill; this.panel8.Location = new System.Drawing.Point(3, 349); this.panel8.Name = "panel8"; - this.panel8.Size = new System.Drawing.Size(267, 144); + this.panel8.Size = new System.Drawing.Size(443, 144); this.panel8.TabIndex = 8; // // groupBox5 @@ -1049,7 +1085,7 @@ this.groupBox5.Margin = new System.Windows.Forms.Padding(2); this.groupBox5.Name = "groupBox5"; this.groupBox5.Padding = new System.Windows.Forms.Padding(2); - this.groupBox5.Size = new System.Drawing.Size(267, 122); + this.groupBox5.Size = new System.Drawing.Size(443, 122); this.groupBox5.TabIndex = 7; this.groupBox5.TabStop = false; this.groupBox5.Text = "幅宽"; @@ -1062,23 +1098,30 @@ this.panel9.Location = new System.Drawing.Point(2, 16); this.panel9.Margin = new System.Windows.Forms.Padding(2); this.panel9.Name = "panel9"; - this.panel9.Size = new System.Drawing.Size(263, 104); + this.panel9.Size = new System.Drawing.Size(439, 104); this.panel9.TabIndex = 0; // // chart3 // - chartArea6.Name = "ChartArea1"; - this.chart3.ChartAreas.Add(chartArea6); + chartArea2.AxisX.LabelStyle.Format = "N0"; + chartArea2.AxisX.MaximumAutoSize = 100F; + chartArea2.AxisX.Minimum = 0D; + chartArea2.AxisX.ScaleView.Size = 10D; + chartArea2.AxisX.ScaleView.Zoomable = false; + chartArea2.AxisX.ScrollBar.ButtonStyle = System.Windows.Forms.DataVisualization.Charting.ScrollBarButtonStyles.SmallScroll; + chartArea2.AxisY.LabelStyle.Format = "N0"; + chartArea2.Name = "ChartArea1"; + this.chart3.ChartAreas.Add(chartArea2); this.chart3.Dock = System.Windows.Forms.DockStyle.Fill; - legend6.Name = "Legend1"; - this.chart3.Legends.Add(legend6); + legend2.Name = "Legend1"; + this.chart3.Legends.Add(legend2); this.chart3.Location = new System.Drawing.Point(0, 0); this.chart3.Name = "chart3"; - series6.ChartArea = "ChartArea1"; - series6.Legend = "Legend1"; - series6.Name = "Series1"; - this.chart3.Series.Add(series6); - this.chart3.Size = new System.Drawing.Size(263, 104); + series2.ChartArea = "ChartArea1"; + series2.Legend = "Legend1"; + series2.Name = "Series1"; + this.chart3.Series.Add(series2); + this.chart3.Size = new System.Drawing.Size(439, 104); this.chart3.TabIndex = 0; this.chart3.Text = "chart3"; // @@ -1088,7 +1131,7 @@ this.panel6.Dock = System.Windows.Forms.DockStyle.Fill; this.panel6.Location = new System.Drawing.Point(3, 201); this.panel6.Name = "panel6"; - this.panel6.Size = new System.Drawing.Size(267, 142); + this.panel6.Size = new System.Drawing.Size(443, 142); this.panel6.TabIndex = 7; // // groupBox4 @@ -1102,7 +1145,7 @@ this.groupBox4.Margin = new System.Windows.Forms.Padding(2); this.groupBox4.Name = "groupBox4"; this.groupBox4.Padding = new System.Windows.Forms.Padding(2); - this.groupBox4.Size = new System.Drawing.Size(267, 142); + this.groupBox4.Size = new System.Drawing.Size(443, 142); this.groupBox4.TabIndex = 6; this.groupBox4.TabStop = false; this.groupBox4.Text = "瑕疵信息"; @@ -1115,7 +1158,7 @@ this.panel7.Location = new System.Drawing.Point(2, 16); this.panel7.Margin = new System.Windows.Forms.Padding(2); this.panel7.Name = "panel7"; - this.panel7.Size = new System.Drawing.Size(263, 124); + this.panel7.Size = new System.Drawing.Size(439, 124); this.panel7.TabIndex = 0; // // pictureBox4 @@ -1126,7 +1169,7 @@ this.pictureBox4.Location = new System.Drawing.Point(0, 0); this.pictureBox4.Margin = new System.Windows.Forms.Padding(2); this.pictureBox4.Name = "pictureBox4"; - this.pictureBox4.Size = new System.Drawing.Size(263, 124); + this.pictureBox4.Size = new System.Drawing.Size(439, 124); this.pictureBox4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox4.TabIndex = 13; this.pictureBox4.TabStop = false; @@ -1142,7 +1185,7 @@ this.groupBox1.Margin = new System.Windows.Forms.Padding(2); this.groupBox1.Name = "groupBox1"; this.groupBox1.Padding = new System.Windows.Forms.Padding(2); - this.groupBox1.Size = new System.Drawing.Size(269, 194); + this.groupBox1.Size = new System.Drawing.Size(445, 194); this.groupBox1.TabIndex = 5; this.groupBox1.TabStop = false; this.groupBox1.Text = "瑕疵列表"; @@ -1155,38 +1198,47 @@ this.panel4.Location = new System.Drawing.Point(2, 16); this.panel4.Margin = new System.Windows.Forms.Padding(2); this.panel4.Name = "panel4"; - this.panel4.Size = new System.Drawing.Size(265, 176); + this.panel4.Size = new System.Drawing.Size(441, 176); this.panel4.TabIndex = 0; // // skinDataGridView1 // - dataGridViewCellStyle11.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(231)))), ((int)(((byte)(246)))), ((int)(((byte)(253))))); - this.skinDataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle11; + dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(231)))), ((int)(((byte)(246)))), ((int)(((byte)(253))))); + this.skinDataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; this.skinDataGridView1.BackgroundColor = System.Drawing.SystemColors.Window; this.skinDataGridView1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.skinDataGridView1.ColumnFont = null; this.skinDataGridView1.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single; - dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle12.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(246)))), ((int)(((byte)(239))))); - dataGridViewCellStyle12.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle12.ForeColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle12.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle12.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.skinDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle12; + dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(246)))), ((int)(((byte)(239))))); + dataGridViewCellStyle2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.skinDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; this.skinDataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.skinDataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.Column1, - this.Column2}); + this.colUid, + this.colCode, + this.colIndex, + this.colDefectName, + this.colX, + this.colY, + this.colW, + this.colH, + this.colArea, + this.colZXD, + this.colTarget}); this.skinDataGridView1.ColumnSelectForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle13.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle13.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle13.ForeColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle13.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(188)))), ((int)(((byte)(240))))); - dataGridViewCellStyle13.SelectionForeColor = System.Drawing.Color.White; - dataGridViewCellStyle13.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.skinDataGridView1.DefaultCellStyle = dataGridViewCellStyle13; + dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle3.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle3.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(188)))), ((int)(((byte)(240))))); + dataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.White; + dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.skinDataGridView1.DefaultCellStyle = dataGridViewCellStyle3; this.skinDataGridView1.Dock = System.Windows.Forms.DockStyle.Fill; this.skinDataGridView1.EnableHeadersVisualStyles = false; this.skinDataGridView1.GridColor = System.Drawing.SystemColors.GradientActiveCaption; @@ -1196,39 +1248,27 @@ this.skinDataGridView1.Location = new System.Drawing.Point(0, 0); this.skinDataGridView1.Name = "skinDataGridView1"; this.skinDataGridView1.RowHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; - dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle14.BackColor = System.Drawing.SystemColors.ButtonHighlight; - dataGridViewCellStyle14.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle14.ForeColor = System.Drawing.SystemColors.MenuText; - dataGridViewCellStyle14.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle14.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.skinDataGridView1.RowHeadersDefaultCellStyle = dataGridViewCellStyle14; + dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.ButtonHighlight; + dataGridViewCellStyle4.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.MenuText; + dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.skinDataGridView1.RowHeadersDefaultCellStyle = dataGridViewCellStyle4; this.skinDataGridView1.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; - dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle15.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle15.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle15.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - this.skinDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle15; + dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + this.skinDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle5; this.skinDataGridView1.RowTemplate.Height = 23; - this.skinDataGridView1.Size = new System.Drawing.Size(265, 176); + this.skinDataGridView1.Size = new System.Drawing.Size(441, 176); this.skinDataGridView1.TabIndex = 0; this.skinDataGridView1.TitleBack = null; this.skinDataGridView1.TitleBackColorBegin = System.Drawing.SystemColors.HotTrack; this.skinDataGridView1.TitleBackColorEnd = System.Drawing.SystemColors.HotTrack; // - // Column1 - // - this.Column1.HeaderText = "图号"; - this.Column1.Name = "Column1"; - this.Column1.ReadOnly = true; - // - // Column2 - // - this.Column2.HeaderText = "名称"; - this.Column2.Name = "Column2"; - this.Column2.ReadOnly = true; - // // statusStrip1 // this.statusStrip1.BackColor = System.Drawing.SystemColors.HotTrack; @@ -1276,6 +1316,84 @@ this.tslabelTime.Size = new System.Drawing.Size(103, 17); this.tslabelTime.Text = "实时测试:360.00s"; // + // colUid + // + this.colUid.HeaderText = "Uid"; + this.colUid.Name = "colUid"; + this.colUid.ReadOnly = true; + this.colUid.Visible = false; + // + // colCode + // + this.colCode.HeaderText = "Code"; + this.colCode.Name = "colCode"; + this.colCode.ReadOnly = true; + this.colCode.Visible = false; + // + // colIndex + // + this.colIndex.DataPropertyName = "Index"; + this.colIndex.HeaderText = "图号"; + this.colIndex.Name = "colIndex"; + this.colIndex.ReadOnly = true; + // + // colDefectName + // + this.colDefectName.DataPropertyName = "Name"; + this.colDefectName.HeaderText = "名称"; + this.colDefectName.Name = "colDefectName"; + this.colDefectName.ReadOnly = true; + // + // colX + // + this.colX.DataPropertyName = "X"; + this.colX.HeaderText = "X(cm)"; + this.colX.Name = "colX"; + this.colX.ReadOnly = true; + // + // colY + // + this.colY.DataPropertyName = "Y"; + this.colY.HeaderText = "Y(m)"; + this.colY.Name = "colY"; + this.colY.ReadOnly = true; + // + // colW + // + this.colW.HeaderText = "宽(cm)"; + this.colW.Name = "colW"; + this.colW.ReadOnly = true; + // + // colH + // + this.colH.HeaderText = "高(cm)"; + this.colH.Name = "colH"; + this.colH.ReadOnly = true; + // + // colArea + // + this.colArea.HeaderText = "面积(cm)"; + this.colArea.Name = "colArea"; + this.colArea.ReadOnly = true; + // + // colZXD + // + this.colZXD.DataPropertyName = "ZXD"; + this.colZXD.HeaderText = "置信度"; + this.colZXD.Name = "colZXD"; + this.colZXD.ReadOnly = true; + // + // colTarget + // + this.colTarget.DataPropertyName = "Contrast"; + this.colTarget.HeaderText = "对比度"; + this.colTarget.Name = "colTarget"; + this.colTarget.ReadOnly = true; + // + // backgroundWorker1 + // + this.backgroundWorker1.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorker1_DoWork); + // // uiTitel1 // this.uiTitel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(8)))), ((int)(((byte)(31)))), ((int)(((byte)(120))))); @@ -1286,11 +1404,41 @@ this.uiTitel1.Size = new System.Drawing.Size(1145, 46); this.uiTitel1.TabIndex = 21; // + // lblDefectSpeed + // + this.lblDefectSpeed.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.lblDefectSpeed.AutoSize = true; + this.lblDefectSpeed.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(33)))), ((int)(((byte)(51)))), ((int)(((byte)(122))))); + this.lblDefectSpeed.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.lblDefectSpeed.ForeColor = System.Drawing.Color.LimeGreen; + this.lblDefectSpeed.Location = new System.Drawing.Point(939, 118); + this.lblDefectSpeed.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.lblDefectSpeed.Name = "lblDefectSpeed"; + this.lblDefectSpeed.Size = new System.Drawing.Size(171, 16); + this.lblDefectSpeed.TabIndex = 30; + this.lblDefectSpeed.Text = "检测速度: 0 米/分钟"; + // + // lblDefectLen + // + this.lblDefectLen.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.lblDefectLen.AutoSize = true; + this.lblDefectLen.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(33)))), ((int)(((byte)(51)))), ((int)(((byte)(122))))); + this.lblDefectLen.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.lblDefectLen.ForeColor = System.Drawing.Color.LimeGreen; + this.lblDefectLen.Location = new System.Drawing.Point(939, 98); + this.lblDefectLen.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.lblDefectLen.Name = "lblDefectLen"; + this.lblDefectLen.Size = new System.Drawing.Size(128, 16); + this.lblDefectLen.TabIndex = 29; + this.lblDefectLen.Text = "检测长度: 0 米"; + // // Main // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1145, 641); + this.Controls.Add(this.lblDefectSpeed); + this.Controls.Add(this.lblDefectLen); this.Controls.Add(this.statusStrip1); this.Controls.Add(this.splitContainer1); this.Controls.Add(this.toolStrip1); @@ -1435,8 +1583,6 @@ private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.Panel panel4; private CCWin.SkinControl.SkinDataGridView skinDataGridView1; - private System.Windows.Forms.DataGridViewTextBoxColumn Column1; - private System.Windows.Forms.DataGridViewTextBoxColumn Column2; private System.Windows.Forms.Panel panel8; private System.Windows.Forms.GroupBox groupBox5; private System.Windows.Forms.Panel panel9; @@ -1447,6 +1593,20 @@ private System.Windows.Forms.PictureBox pictureBox4; private System.Windows.Forms.ComboBox cbDefectCode; private System.Windows.Forms.Label label8; + private System.Windows.Forms.DataGridViewTextBoxColumn colUid; + private System.Windows.Forms.DataGridViewTextBoxColumn colCode; + private System.Windows.Forms.DataGridViewTextBoxColumn colIndex; + private System.Windows.Forms.DataGridViewTextBoxColumn colDefectName; + private System.Windows.Forms.DataGridViewTextBoxColumn colX; + private System.Windows.Forms.DataGridViewTextBoxColumn colY; + private System.Windows.Forms.DataGridViewTextBoxColumn colW; + private System.Windows.Forms.DataGridViewTextBoxColumn colH; + private System.Windows.Forms.DataGridViewTextBoxColumn colArea; + private System.Windows.Forms.DataGridViewTextBoxColumn colZXD; + private System.Windows.Forms.DataGridViewTextBoxColumn colTarget; + private System.ComponentModel.BackgroundWorker backgroundWorker1; + private System.Windows.Forms.Label lblDefectSpeed; + private System.Windows.Forms.Label lblDefectLen; } } diff --git a/LeatherProject/GeBoShi/Main.cs b/LeatherProject/GeBoShi/Main.cs index 0f68154..e50458f 100644 --- a/LeatherProject/GeBoShi/Main.cs +++ b/LeatherProject/GeBoShi/Main.cs @@ -3,22 +3,42 @@ using GeBoShi.UI; using GeBoShi.UI.Load; using GeBoShi.UI.Product; using GeBoShi.UI.SysSet; +using HZH_Controls; +using HZH_Controls.Controls; using HZH_Controls.Forms; +using MaiMuControl.Device; +using MaiMuControl.Device.CamDev; +using Models; +using OpenCvSharp.Extensions; using System; +using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; +using System.IO; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; +using System.Web.UI.WebControls.WebParts; using System.Windows.Forms; +using System.Windows.Forms.DataVisualization.Charting; namespace GeBoShi { public partial class Main : Form { + object AddTextLock = new object(); + bool backgroundWorkerDo; + /// + /// 显示颜色现在对应30色,确保label在30个以内 + /// + Color[] ChartColor = new Color[30] { Color.Red, Color.Blue, Color.Green, Color.YellowGreen, Color.Orange, + Color.Peru, Color.DarkRed,Color.AliceBlue, Color.Pink , Color.Brown, + Color.CadetBlue, Color.OrangeRed, Color.Cyan, Color.Lime, Color.Magenta, Color.Tan, Color.Sienna, + Color.AliceBlue, Color.SaddleBrown, Color.DarkBlue, Color.Firebrick,Color.Gainsboro,Color.Honeydew,Color.Khaki,Color.Lavender, + Color.LightGoldenrodYellow,Color.Navy, Color.Khaki, Color.IndianRed,Color.Lavender}; public Main() { InitializeComponent(); @@ -33,6 +53,32 @@ namespace GeBoShi SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); // 禁止擦除背景. SetStyle(ControlStyles.DoubleBuffer, true); // 双缓冲 + + SysMgr.Instance.MainRuning += main_running; + SysMgr.Instance.AutoRuning += auto_runing; + + #region dataGridView设置 + skinDataGridView1.AllowUserToAddRows = skinDataGridView1.AllowUserToDeleteRows = false;//用户添加删除行 + skinDataGridView1.AllowUserToResizeRows = false;//用户调整行大小 //显示行号与列宽度自动调整 + skinDataGridView1.RowHeadersVisible = true; + skinDataGridView1.RowHeadersWidth = 50; + //dataGridView1.ColumnHeadersHeightSizeMode = dataGridView2.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; + skinDataGridView1.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders;//数据量过百绑定太变 + skinDataGridView1.RowTemplate.Height = 30; + + //skinDataGridView1.RowPostPaint += (sender, e) =>//序号列头 + //{ + // showRowNum_onDataGrid_RowPostPaint(this.skinDataGridView1, sender, e); + //}; + for (int i = 0; i < skinDataGridView1.Columns.Count; i++)//禁止点击列头排序 + skinDataGridView1.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable; + this.skinDataGridView1.CellClick += skinDataGridView1_CellClick; ; + #endregion + + this.lblDefectLen.Top = toolStrip1.Top + 10; + this.lblDefectLen.Left = toolStrip1.Width - 300; + this.lblDefectSpeed.Top = toolStrip1.Top + 10 + lblDefectLen.Height + 5; + this.lblDefectSpeed.Left = toolStrip1.Width - 300; } #region 初始化 @@ -60,6 +106,11 @@ namespace GeBoShi #endregion #region 界面刷新 + private void showRowNum_onDataGrid_RowPostPaint(DataGridView dgv, object sender, DataGridViewRowPostPaintEventArgs e) + { + Rectangle rectangle = new Rectangle(e.RowBounds.Location.X, e.RowBounds.Location.Y, dgv.RowHeadersWidth - 4, e.RowBounds.Height); + TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(), dgv.RowHeadersDefaultCellStyle.Font, rectangle, dgv.RowHeadersDefaultCellStyle.ForeColor, TextFormatFlags.VerticalCenter | TextFormatFlags.Right); + } private void ResetUI(bool clearSN) { @@ -80,8 +131,40 @@ namespace GeBoShi this.cbProductReelNum.Enabled = true; this.cbProductNum.Enabled = true; - tslabelTime.Text = "实时测试:0.00s"; + this.pictureBox1.Image = null; + pictureBox1.Refresh(); + this.pictureBox2.Image = null; + pictureBox2.Refresh(); + this.pictureBox3.Image = null; + pictureBox3.Refresh(); + this.pictureBox4.Image = null; + pictureBox4.Refresh(); + //tslabelTime.Text = "实时测试:0.00s"; + skinDataGridView1.DataSource = null; + + this.skinDataGridView1.Rows.Clear(); + chart1.Series.Clear(); + chart1.Series.Add("SELECT"); + chart1.Series["SELECT"].ChartType = SeriesChartType.Point; + chart1.Series["SELECT"].MarkerSize = 25; + chart1.Series["SELECT"].MarkerColor = Color.Black; + chart1.Series["SELECT"].MarkerStyle = MarkerStyle.Star6; + //chart1.Series["SELECT"].Enabled = false; + chart1.ChartAreas[0].AxisX.Title = "宽度(cm)"; + chart1.ChartAreas[0].AxisY.Title = "长度(m)"; + + chart3.Series.Clear(); + chart3.Series.Add("面宽"); + chart3.ChartAreas[0].AxisX.Title = "长度(m)"; + chart3.ChartAreas[0].AxisY.Title = "宽度(cm)"; + chart3.Series["面宽"].ChartType = SeriesChartType.Line; + chart3.Series["面宽"].MarkerSize = 5; + chart3.Series["面宽"].MarkerColor = Color.Blue; + chart3.Series["面宽"].MarkerStyle = MarkerStyle.Circle; + + lblDefectLen.Text = $"检测长度: 0 米"; + lblDefectSpeed.Text = $"检测速度: 0 米/分钟"; this.Refresh(); } #endregion @@ -165,18 +248,17 @@ namespace GeBoShi //backgroundWorker1.RunWorkerAsync(); //s_BackWorker = true; //backgroundWorker.RunWorkerAsync(); - + //开启云端连接 //SysMgr.Instance.InitCloudConnect(); //开启产品服务 //SysMgr.Instance.InitPdtService(); //开启处理事件反馈 - //SysMgr.Instance.InitDefectEvent(); + SysMgr.Instance.InitDefectEvent(); //加载产品料号 - //SysMgr.Instance.LoadProductCodeList(); + SysMgr.Instance.LoadProductCodeList(); //加载产品选择 - //LoadPdtList(SysMgr.Instance.ProductCodeList); - //LoadSNList(SysMgr.Instance.ProductSNList); + LoadPdtList(SysMgr.Instance.ProductCodeList); this.Cursor = Cursors.Default; //运行前检测磁盘空间 @@ -275,6 +357,10 @@ namespace GeBoShi } } + private void tsmDebug_Click(object sender, EventArgs e) + { + + } #endregion #endregion @@ -285,7 +371,24 @@ namespace GeBoShi private void LoadPdtList(List list) { this.cbDefectCode.Items.Clear(); + while (true) + { + bool bk = true; + for (int i = 0; i < list.Count; i++) + { + if (list[i] == null || string.IsNullOrEmpty(list[i])) + { + list.Remove(list[i]); + bk = false; + } + } + if (bk) + { + break; + } + } this.pdtlistData = list.ToArray(); + cbDefectCode.Items.AddRange(pdtlistData);//比使用DataSource速度要快一些 cbDefectCode.TextUpdate += cobList_TextUpdate;//重新绑定事件 cbDefectCode.KeyDown += CobList_KeyDown; @@ -344,5 +447,514 @@ namespace GeBoShi } } #endregion + + #region 按钮 + + private void tsbtnStart_Click(object sender, EventArgs e) + { + if (!SysMgr.Instance.IsRuning) + { + //低报警自动复位 + if (SysMgr.Instance.StatusMgr.Status == SystemStsEnum.Warning) + { + if (SysMgr.Instance.StatusMgr.Warning == WarningEnum.Low) + { + SysMgr.Instance.StatusMgr.ClearWarning(); + SysMgr.Instance.StatusMgr.GotoNormalStandby(); + } + } + //提示正在报警中 + if (SysMgr.Instance.StatusMgr.Status == SystemStsEnum.Warning) + { + FrmDialog.ShowDialog(this, "系统报警中!无法启动运行!", "警告", false); + return; + } + this.Cursor = Cursors.WaitCursor; + System.Windows.Forms.Application.DoEvents(); + if (SysMgr.Instance.StatusMgr.Status != SystemStsEnum.Pause) + { + ResetUI(false); + AddTextEvent("运行", $"启动自动检测流程"); + this.lstLog.Refresh(); + string name = this.cbProductCode.Text; + string batch = this.cbProductBatch.Text; + string reel = this.cbProductReelNum.Text; + string len = this.cbProductNum.Text; + string defname = this.cbDefectCode.Text; + if (SysMgr.Instance.StartRun(this, this.cbPdtSN.Text, ref defname, ref name, ref batch, ref reel, ref len)) + { + this.tsbtnImpStop.Enabled = true; + this.tsbtnStop.Enabled = true; + this.tsbtnStart.Enabled = false; + //锁定信息 + this.cbPdtSN.Enabled = false; + this.cbProductCode.Enabled = false; + this.cbProductBatch.Enabled = false; + this.cbProductReelNum.Enabled = false; + this.cbProductNum.Enabled = false; + this.cbDefectCode.Enabled = false; + //记录开始运行时间 + //RunStartTime.Restart(); + + //重新显示 + this.cbProductCode.Text = name; + this.cbProductBatch.Text = batch; + this.cbProductReelNum.Text = reel; + this.cbProductNum.Text = len; + this.cbDefectCode.Text = defname; + + + } + } + else //暂停状态开始 + { + if (SysMgr.Instance.ReStartRun()) + { + this.tsbtnStop.Enabled = true; + this.tsbtnStart.Enabled = false; + } + } + this.Cursor = Cursors.Default; + } + } + + private void tsbtnReset_Click(object sender, EventArgs e) + { + + } + private void tsbtnStop_Click(object sender, EventArgs e) + { + AddTextEvent("暂停", "手动暂停"); + this.tsbtnStart.Enabled = true; + SysMgr.Instance.StatusMgr.GotoPause(); + SysMgr.Instance.SendStatus(); + SysMgr.Instance.LedPause(); + } + + private void tsbtnWarning_Click(object sender, EventArgs e) + { + if (SysMgr.Instance.StatusMgr.Warning != WarningEnum.Normal) + { + AddTextEvent("清除", "手动清除报警"); + SysMgr.Instance.StatusMgr.ClearWarning(); + SysMgr.Instance.LedReady(); + if (SysMgr.Instance.IsAuto) + SysMgr.Instance.StatusMgr.GotoPause(); + else + SysMgr.Instance.StatusMgr.GotoNormalStandby(); + SysMgr.Instance.SendStatus(); + } + } + /// + /// 结束验布 + /// + /// + /// + private void tsbtnImpStop_Click(object sender, EventArgs e) + { + AddTextEvent("结束验布", "手动结束验布"); + SysMgr.Instance.DefectEnd(this); + } + + int cnnnt = 10; + private void tsbGoHome_Click(object sender, EventArgs e) + { +#if false + //测试散点 + chart1.Series.Clear(); + chart1.ChartAreas[0].AxisX.Title = "宽度(cm)"; + chart1.ChartAreas[0].AxisY.Title = "长度(m)"; + + chart1.Series.Add("皱印"); + chart1.Series["皱印"].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point; + chart1.Series["皱印"].MarkerSize = 10; + chart1.Series["皱印"].MarkerColor = Color.Red; + chart1.Series["皱印"].MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle; + for (int i = 0; i < cnnnt; i++) + this.chart1.Series["皱印"].Points.AddXY(i%5,i); + + chart1.Series.Add("划伤"); + chart1.Series["划伤"].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point; + chart1.Series["划伤"].MarkerSize = 10; + chart1.Series["划伤"].MarkerColor = Color.Blue; + chart1.Series["划伤"].MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle; + for (int i = 0; i < cnnnt; i++) + this.chart1.Series["划伤"].Points.AddXY(i % 5 + 0.5, i + 0.3); + + chart1.ChartAreas[0].AxisY.Maximum = ((int)(this.chart1.Series["划伤"].Points.FindMaxByValue().YValues.Max() /10) + 1) * 10 + 5; + chart1.ChartAreas[0].AxisY.ScaleView.Scroll(System.Windows.Forms.DataVisualization.Charting.ScrollType.Last); + cnnnt +=20; + + MemoryStream ms = new MemoryStream(); + chart1.SaveImage(ms, ChartImageFormat.Bmp); + Bitmap bmp = new Bitmap(ms); + bmp.Save("111.jpg"); + ms.Close(); +#endif + //测试散点 + chart3.Series.Clear(); + chart3.ChartAreas[0].AxisX.Title = "长度(m)"; + chart3.ChartAreas[0].AxisY.Title = "宽度(cm)"; + + chart3.Series.Add("面宽"); + + string tt = "面宽"; + if (chart3.Series.FindByName(tt) == null) + chart3.Series.Add("面宽"); + else + { + chart3.Series["面宽"].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; + chart3.Series["面宽"].MarkerSize = 5; + chart3.Series["面宽"].MarkerColor = Color.Blue; + chart3.Series["面宽"].MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle; + + Random rm = new Random(); + for (int i = 0; i < cnnnt; i++) + this.chart3.Series["面宽"].Points.AddXY(i, rm.Next(140, 160)); + cnnnt += 20; + } + //chart3.Series[0].f + chart3.ChartAreas["ChartArea1"].AxisX.ScaleView.Scroll(ScrollType.Last); + } +#endregion + + #region 显示图像和消息 + private void lstLog_DrawItem(object sender, DrawItemEventArgs e) + { + e.DrawBackground(); + if (e.Index < 0) return; + + try + { + string str = lstLog.Items[e.Index].ToString(); + e.Graphics.DrawString(str.Substring(1), e.Font, + new SolidBrush(str[0] == 'R' ? Color.Red : (str[0] == 'Y' ? Color.Orange : Color.Black)), + e.Bounds); + } + catch (Exception ex) + { + e.Graphics.DrawString(ex.Message, e.Font, + new SolidBrush(Color.Red), + e.Bounds); + } + } + + /// + /// 异步输出日志 + /// + /// 模板标识 + /// 内容 + /// + private void AddTextEvent(string tag, string msg, WarningEnum level = WarningEnum.Normal) + { + lock (AddTextLock) + { + if (tag != null && tag != "") + tag = $" - [{tag}]"; + + var now = DateTime.Now; + msg = now.ToString("HH:mm:ss fff") + tag + " - " + msg; + + msg = (level == WarningEnum.Normal ? "B" : level == WarningEnum.Low ? "Y" : "R") + msg; + + if (this.lstLog.Items.Count > 1000) + this.lstLog.Items.Clear(); + lstLog.Items.Insert(0, msg); + + } + } + + private void main_running(object sender, MainEventArgs e) + { + ShowMessage(e); + } + private delegate void ShowMessageDelegate(MainEventArgs e); + private void ShowMessage(MainEventArgs e) + { + if (InvokeRequired) + { + ShowMessageDelegate smd = new ShowMessageDelegate(ShowMessage); + this.BeginInvoke(smd, e); + } + else + { + AddTextEvent(e.Tag, e.Message, e.Warning); + } + } + + /// + /// 自动运行流程显示 + /// + /// + /// + private void auto_runing(object sender, RunEventArgs e) + { + ShowUIEvent(e); + } + + private delegate void ShowUIEventDelegate(RunEventArgs e); + Bitmap bmp0; + Bitmap bmp1; + Bitmap bmp2; + private void ShowUIEvent(RunEventArgs e) + { + if (InvokeRequired) + { + ShowUIEventDelegate smd = new ShowUIEventDelegate(ShowUIEvent); + this.BeginInvoke(smd, e); + } + else + { + try + { + if (e.Cmd == 6) //显示主图 + { + if (e.PicIndex == 1) + { + bmp1 = (Bitmap)CamDev.HImageToBitmap(e.Pic).Clone(); + this.pictureBox2.Image = bmp1; + this.pictureBox2.Refresh(); + } + else if (e.PicIndex == 2) + { + bmp2 = (Bitmap)CamDev.HImageToBitmap(e.Pic).Clone(); + this.pictureBox3.Image = bmp2; + this.pictureBox3.Refresh(); + } + else if(e.PicIndex == 0) + { + bmp0 = (Bitmap)CamDev.HImageToBitmap(e.Pic).Clone(); + this.pictureBox1.Image = bmp0; + this.pictureBox1.Refresh(); + } + } + else if (e.Cmd == 10) //测试结束 + { + this.tsbtnStart.Enabled = true; + this.tsbtnStop.Enabled = false; + this.tsbtnImpStop.Enabled = false; + + this.cbPdtSN.Enabled = true; + this.cbProductCode.Enabled = true; + this.cbProductBatch.Enabled = true; + this.cbProductReelNum.Enabled = true; + this.cbProductNum.Enabled = true; + this.cbDefectCode.Enabled = true; + } + else if (e.Cmd == 11) //显示缺陷列表 + { + foreach (var rowItem in e.DataRowlist) + { + this.skinDataGridView1.Rows.Insert(0, rowItem); + if (chart1.Series.FindByName((string)rowItem[3]) == null)//rowItem[3] 为name + { + chart1.Series.Add((string)rowItem[3]); + var obj = SysMgr.Instance.GetDefectLabel((string)rowItem[3]); + int labelIndex = obj.Value("id"); + chart1.Series[(string)rowItem[3]].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point; + chart1.Series[(string)rowItem[3]].MarkerSize = 5; + chart1.Series[(string)rowItem[3]].MarkerColor = ChartColor[labelIndex]; + chart1.Series[(string)rowItem[3]].MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle; + } + chart1.Series[(string)rowItem[3]].Points.AddXY(rowItem[4], rowItem[5]); + } + //chart1.ChartAreas[0].AxisY.Maximum = ((int)(this.chart1.Series["划伤"].Points.FindMaxByValue().YValues.Max() / 10) + 1) * 10 + 5; + chart1.ChartAreas[0].AxisY.ScaleView.Scroll(System.Windows.Forms.DataVisualization.Charting.ScrollType.Last); + } + else if(e.Cmd == 12) //显示处理图 + { + bmp0 = (Bitmap)e.Defectimg.Clone(); + this.pictureBox1.Image = bmp0; + this.pictureBox1.Refresh(); + } + else if (e.Cmd == 13) //显示门幅 + { + //this.BeginInvoke(new System.Action(() => + //{ + List ydata = new List(); + foreach (var Item in e.Points) + { + ydata.Add(Item[1]); + float x = Item[0] / 100; //cm -> m + this.chart3.Series["面宽"].Points.AddXY((float)Math.Round(x, 2), (float)Math.Round(Item[1], 2)); + } + chart3.ChartAreas[0].AxisY.Maximum = Math.Round(ydata.Max() + 10, 0); + chart3.ChartAreas[0].AxisY.Minimum = Math.Round(ydata.Max() - 10, 0); + chart3.ChartAreas["ChartArea1"].AxisX.ScaleView.Scroll(ScrollType.Last); + //})); + } + else if (e.Cmd == 14) //显示速度 + { + //this.BeginInvoke(new System.Action(() => + //{ + lblDefectLen.Text = $"检测长度: {e.Len} 米"; + lblDefectSpeed.Text = $"检测速度: {e.Speed} 米/分钟"; + //})); + } + else if (e.Cmd == 15) //显示处理图 new + { + bmp0 = (Bitmap)e.DefectMat.ToBitmap(); + this.pictureBox1.Image = bmp0; + this.pictureBox1.Refresh(); + } + Application.DoEvents(); + } + catch { } + } + } + #endregion + + #region 后台 + GetPN pn = new GetPN(); + private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) + { + while (backgroundWorkerDo) + { + try + { + this.Invoke(new MethodInvoker(() => + { + this.tsslLoginTime.Text = $" 当前时间:{DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss")}"; + })); + //检测按钮和实时状态 + if (SysMgr.Instance.IsInit) + { + bool sts = SysMgr.Instance.WarningShowLed(false); + if (sts) + { + this.Invoke(new MethodInvoker(() => + { + this.tsbtnStart.Enabled = true; + this.tsbtnStop.Enabled = false; + })); + } + int stsno = 0; + stsno = SysMgr.Instance.ButtonIOTrg(false); + if (stsno == 1) + { + this.Invoke(new MethodInvoker(() => + { + tsbtnStart_Click(null, null); + })); + } + else if (stsno == 2) + { + this.Invoke(new MethodInvoker(() => + { + this.tsbtnStart.Enabled = true; + })); + SysMgr.Instance.LedPause(); + } + else if (stsno == 3) + { + this.Invoke(new MethodInvoker(() => + { + tsbtnReset_Click(null, null); + })); + + } + } + //if (pn.P(SysMgr.Instance.IsRuning)) + //{ + // //继续计时 + // RunStartTime.Start(); + //} + //if (pn.N(SysMgr.Instance.IsRuning)) + //{ + // //停止计时 + // RunStartTime.Stop(); + //} + //if (SysMgr.Instance.IsRuning) + //{ + // //实时显示 + // RunStartTime.Stop(); + // this.Invoke(new MethodInvoker(() => + // { + // tslabelTime.Text = "实时测试:" + ((double)RunStartTime.ElapsedMilliseconds / 1000.0).ToString("0.000") + "s"; + // //this.Refresh(); + // })); + // RunStartTime.Start(); + //} + Thread.Sleep(100); + Application.DoEvents(); + } + catch { } + } + } + /// + /// 信号上升沿下降沿捕获 + /// + class GetPN + { + bool _P = false; + bool _N = false; + /// + /// 判断上升沿 + /// + /// + /// + public bool P(bool Value) + { + if (Value && !_P) + { + _P = true; + return true; + } + + if (!Value) + _P = false; + + return false; + } + /// + /// 判断下降沿 + /// + /// + /// + public bool N(bool Value) + { + if (!Value && _N) + { + _N = false; + return true; + } + + if (Value) + _N = true; + return false; + } + } + + + + + #endregion + + #region 表格点击 + private void skinDataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) + { + if (e.RowIndex < 0) + return; + var defectInfo = SysMgr.Instance.GetDefectInfo((long)this.skinDataGridView1.CurrentRow.Cells["colUid"].Value); + if (defectInfo == null) + { + DialogResult dr = DialogResult.Cancel; + dr = FrmDialog.ShowDialog(this, "此记录已不存在!", "警告", true); + return; + } + this.pictureBox4.Image = (defectInfo.image); + + //选中 + this.Invoke(new System.Action(() => + { + if (chart1.Series != null && chart1.Series.FindByName("SELECT") != null) + { + chart1.Series["SELECT"].Points.Clear(); + chart1.Series["SELECT"].Points.AddXY(defectInfo.CentreX, defectInfo.CentreY / 100); + chart1.Refresh(); + } + })); + } + #endregion } } diff --git a/LeatherProject/GeBoShi/Main.resx b/LeatherProject/GeBoShi/Main.resx index d084cc5..b6f73f1 100644 --- a/LeatherProject/GeBoShi/Main.resx +++ b/LeatherProject/GeBoShi/Main.resx @@ -431,10 +431,37 @@ b1AAAAAASUVORK5CYII= - + True - + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + True @@ -443,4 +470,7 @@ 597, 17 + + 743, 17 + \ No newline at end of file diff --git a/LeatherProject/GeBoShi/SysCtrl/ConfMgr.cs b/LeatherProject/GeBoShi/SysCtrl/ConfMgr.cs index 921a990..6f02ccc 100644 --- a/LeatherProject/GeBoShi/SysCtrl/ConfMgr.cs +++ b/LeatherProject/GeBoShi/SysCtrl/ConfMgr.cs @@ -1,7 +1,10 @@ using MaiMuControl.SysStatusMgr.UserMgr; +using Newtonsoft.Json.Linq; +using SqlSugar; using System; using System.Collections; using System.Collections.Generic; +using System.Data; using System.IO; using System.Linq; using System.Text; @@ -47,8 +50,6 @@ namespace GeBoShi.SysCtrl private readonly string _rootPath; private readonly string _configFile; private readonly string _projectDir; - private readonly string _pointsPath; - private readonly string _markPicPath; #endregion private ConfMgr() @@ -57,8 +58,6 @@ namespace GeBoShi.SysCtrl _configFile = Path.Combine(_rootPath, "SysParamsConfig.ini"); _devConfigPath = Path.Combine(_rootPath, "DevParamsConfig.ini"); _projectDir = Path.Combine(_rootPath, "Project"); - _pointsPath = Path.Combine(_rootPath, "PointsConfig.ini"); - _markPicPath = Path.Combine(_rootPath, "MarkPic"); _specificationPath = Path.Combine(_rootPath, "革博士软件操作说明.docx"); DBConStr = "server = localhost; Database = LeatherDB; Uid = root; Pwd = " + ConteolUserDB.GetSqlDBCode() + "; AllowLoadLocalInfile = true;"; @@ -83,43 +82,20 @@ namespace GeBoShi.SysCtrl //public string ProjectDir { get { return _projectDir; } } public string ProjectDir { get { return SysConfigParams.ProductPath; } } - public string MarkPicPath { get { return _markPicPath; } } - + /// + /// 配置文件根路径 + /// + public string ConfigDir { get { return _rootPath; } } /// /// 说明书路径 /// public string SpecificationPath { get { return _specificationPath; } } private string _specificationPath; - /// - /// 上料位X1 - /// - public double LoadPoint_X1 { get; set; } - /// - /// 上料位X2 - /// - public double LoadPoint_X2 { get; set; } - /// - /// 上料位Y - /// - public double LoadPoint_Y { get; set; } - /// - /// 上料位Z - /// - public double LoadPoint_Z { get; set; } - - /// - /// 测厚气缸到位等待时间 - /// - public int HeightDoWait { get; set; } - /// - /// 加紧气缸到位等待时间 - /// - public int ProductDoWait { get; set; } #endregion #region 公开文件操作 - + #region 系统配置参数 /// /// 写入ini @@ -162,6 +138,16 @@ namespace GeBoShi.SysCtrl iniHelper.WriteString("Dev", "IODevName", SysParams.IODevName); iniHelper.WriteString("Dev", "IOCfgPath", SysParams.IOCfgPath); + iniHelper.WriteString("Dev", "PLC_IP", SysParams.PLC_IP); + iniHelper.WriteInteger("Dev", "PLC_Rack", SysParams.PLC_Rack); + iniHelper.WriteInteger("Dev", "PLC_Solt", SysParams.PLC_Solt); + iniHelper.WriteString("Dev", "CamPath_1", SysParams.CamPath_1); + iniHelper.WriteInteger("Dev", "CamDev_1", SysParams.CamDev_1); + iniHelper.WriteInteger("Dev", "CamIndex_1", SysParams.CamIndex_1); + iniHelper.WriteString("Dev", "CamPath_2", SysParams.CamPath_2); + iniHelper.WriteInteger("Dev", "CamDev_2", SysParams.CamDev_2); + iniHelper.WriteInteger("Dev", "CamIndex_2", SysParams.CamIndex_2); + iniHelper.WriteString("Sys", "AIModelPath", SysParams.AIModelPath); iniHelper.WriteString("Sys", "ProductPath", SysParams.ProductPath); @@ -188,6 +174,24 @@ namespace GeBoShi.SysCtrl iniHelper.WriteBool("ExcelPrint", "EnableExcelPrint", SysParams.EnableExcelPrint); iniHelper.WriteString("ExcelPrint", "ExcelPrinterName", SysParams.ExcelPrinterName); + iniHelper.WriteString("ERP", "ErpDBConStr", SysParams.ErpDBConStr); + iniHelper.WriteString("ERP", "ErpSql", SysParams.ErpSql); + + iniHelper.WriteString("Customer", "CustomerName", SysParams.CustomerName); + + iniHelper.WriteBool("FLIP", "Cam1_flipX", SysParams.Cam1_flipX); + iniHelper.WriteBool("FLIP", "Cam1_flipY", SysParams.Cam1_flipY); + iniHelper.WriteBool("FLIP", "Cam2_flipX", SysParams.Cam2_flipX); + iniHelper.WriteBool("FLIP", "Cam2_flipY", SysParams.Cam2_flipY); + + iniHelper.WriteInteger("CMPX", "Cm2px_x", SysParams.Cm2px_x); + iniHelper.WriteInteger("CMPX", "Cm2px_y", SysParams.Cm2px_y); + iniHelper.WriteInteger("CMPX", "MidCoin", SysParams.MidCoin); + iniHelper.WriteInteger("CMPX", "HolePx", SysParams.HolePx); + iniHelper.WriteInteger("CMPX", "LCrop", SysParams.LCrop); + iniHelper.WriteInteger("CMPX", "RCrop", SysParams.RCrop); + iniHelper.WriteInteger("CMPX", "Expand_pixel", SysParams.Expand_pixel); + SysConfigParams = SysParams; } /// @@ -208,6 +212,63 @@ namespace GeBoShi.SysCtrl //iniHelper.ReadBool("SaveAllImg", "SaveAllImg", out bValue); //sysParams.SaveAllImg = bValue; + iniHelper.ReadBool("SysFunction", "OpenBuzzer", out bValue); + sysParams.OpenBuzzer = bValue; + iniHelper.ReadBool("SysFunction", "OpenDoor", out bValue); + sysParams.OpenDoor = bValue; + iniHelper.ReadBool("SysFunction", "OpenIO", out bValue); + sysParams.OpenIO = bValue; + iniHelper.ReadBool("SysFunction", "OpenPLC", out bValue); + sysParams.OpenPLC = bValue; + + iniHelper.ReadString("Dev", "LightCom", out sValue); + sysParams.LightCom = sValue.Replace("\0", ""); + iniHelper.ReadInteger("Dev", "LightComBaud", out iValue); + sysParams.LightComBaud = iValue; + iniHelper.ReadString("Dev", "IODevName", out sValue); + sysParams.IODevName = sValue.Replace("\0", ""); + iniHelper.ReadString("Dev", "IOCfgPath", out sValue); + sysParams.IOCfgPath = sValue.Replace("\0", ""); + iniHelper.ReadString("Dev", "PLC_IP", out sValue); + sysParams.PLC_IP = sValue.Replace("\0", ""); + iniHelper.ReadInteger("Dev", "PLC_Rack", out iValue); + sysParams.PLC_Rack = iValue; + iniHelper.ReadInteger("Dev", "PLC_Solt", out iValue); + sysParams.PLC_Solt = iValue; + iniHelper.ReadString("Dev", "CamPath_1", out sValue); + sysParams.CamPath_1 = sValue.Replace("\0", ""); + iniHelper.ReadInteger("Dev", "CamDev_1", out iValue); + sysParams.CamDev_1 = iValue; + iniHelper.ReadInteger("Dev", "CamIndex_1", out iValue); + sysParams.CamIndex_1 = iValue; + iniHelper.ReadString("Dev", "CamPath_2", out sValue); + sysParams.CamPath_2 = sValue.Replace("\0", ""); + iniHelper.ReadInteger("Dev", "CamDev_2", out iValue); + sysParams.CamDev_2 = iValue; + iniHelper.ReadInteger("Dev", "CamIndex_2", out iValue); + sysParams.CamIndex_2 = iValue; + + iniHelper.ReadBool("CloudAndMES", "OpenCloud", out bValue); + sysParams.OpenCloud = bValue; + iniHelper.ReadString("CloudAndMES", "CloudThisName", out sValue); + sysParams.CloudThisName = sValue.Replace("\0", string.Empty); + iniHelper.ReadString("CloudAndMES", "CloudServerIP", out sValue); + sysParams.CloudServerIP = sValue; + iniHelper.ReadInteger("CloudAndMES", "CloudServerPort", out iValue); + sysParams.CloudServerPort = iValue; + iniHelper.ReadString("CloudAndMES", "CloudUser", out sValue); + sysParams.CloudUser = sValue; + iniHelper.ReadString("CloudAndMES", "CloudPassword", out sValue); + sysParams.CloudPassword = sValue; + iniHelper.ReadBool("CloudAndMES", "OpenPdtServer", out bValue); + sysParams.OpenPdtServer = bValue; + iniHelper.ReadString("CloudAndMES", "PdtServerIP", out sValue); + sysParams.PdtServerIP = sValue; + iniHelper.ReadInteger("CloudAndMES", "PdtServerPort", out iValue); + sysParams.PdtServerPort = iValue; + iniHelper.ReadBool("CloudAndMES", "IsPdtServer", out bValue); + sysParams.IsPdtServer = bValue; + iniHelper.ReadString("DefectSrcImag", "SavePath", out sValue); sysParams.DefectSrcImag.SavePath = sValue.Replace("\0", ""); iniHelper.ReadBool("DefectSrcImag", "AutoSave", out bValue); @@ -233,7 +294,13 @@ namespace GeBoShi.SysCtrl iniHelper.ReadBool("DefectSplicImag", "AutoDelete", out bValue); sysParams.DefectSplicImag.AutoDelete = bValue; iniHelper.ReadDouble("DefectSplicImag", "AutoDeleteDays", out dValue); - sysParams.DefectSplicImag.AutoDeleteDays = dValue; + sysParams.DefectSplicImag.AutoDeleteDays = dValue; + + + iniHelper.ReadString("Sys", "AIModelPath", out sValue); + sysParams.AIModelPath = sValue.Replace("\0", ""); + iniHelper.ReadString("Sys", "ProductPath", out sValue); + sysParams.ProductPath = sValue.Replace("\0", ""); iniHelper.ReadString("Log", "SavePath", out sValue); sysParams.LogPath = sValue.Replace("\0", ""); @@ -242,31 +309,6 @@ namespace GeBoShi.SysCtrl iniHelper.ReadDouble("Log", "AutoDeleteDays", out dValue); sysParams.AutoDeleteLogData = dValue; - iniHelper.ReadBool("SysFunction", "OpenBuzzer", out bValue); - sysParams.OpenBuzzer = bValue; - iniHelper.ReadBool("SysFunction", "OpenDoor", out bValue); - sysParams.OpenDoor = bValue; - iniHelper.ReadBool("SysFunction", "OpenIO", out bValue); - sysParams.OpenIO = bValue; - iniHelper.ReadBool("SysFunction", "OpenPLC", out bValue); - sysParams.OpenPLC = bValue; - - iniHelper.ReadString("Dev", "LightCom", out sValue); - sysParams.LightCom = sValue.Replace("\0", ""); - iniHelper.ReadInteger("Dev", "LightComBaud", out iValue); - sysParams.LightComBaud = iValue; - - iniHelper.ReadString("Dev", "IODevName", out sValue); - sysParams.IODevName = sValue.Replace("\0", ""); - iniHelper.ReadString("Dev", "IOCfgPath", out sValue); - sysParams.IOCfgPath = sValue.Replace("\0", ""); - - iniHelper.ReadString("Sys", "AIModelPath", out sValue); - sysParams.AIModelPath = sValue.Replace("\0", ""); - iniHelper.ReadString("Sys", "ProductPath", out sValue); - sysParams.ProductPath = sValue.Replace("\0", ""); - iniHelper.ReadString("Sys", "HttpServerIP", out sValue); - iniHelper.ReadBool("ShowMainWin", "ShowResetBtn", out bValue); sysParams.ShowResetBtn = bValue; iniHelper.ReadBool("ShowMainWin", "ShowBuzz", out bValue); @@ -274,27 +316,30 @@ namespace GeBoShi.SysCtrl iniHelper.ReadBool("ShowMainWin", "ShowDoorAlm", out bValue); sysParams.ShowDoorAlm = bValue; - iniHelper.ReadBool("CloudAndMES", "OpenCloud", out bValue); - sysParams.OpenCloud = bValue; - iniHelper.ReadString("CloudAndMES", "CloudThisName", out sValue); - sysParams.CloudThisName = sValue.Replace("\0", string.Empty); - iniHelper.ReadString("CloudAndMES", "CloudServerIP", out sValue); - sysParams.CloudServerIP = sValue; - iniHelper.ReadInteger("CloudAndMES", "CloudServerPort", out iValue); - sysParams.CloudServerPort = iValue; - iniHelper.ReadString("CloudAndMES", "CloudUser", out sValue); - sysParams.CloudUser = sValue; - iniHelper.ReadString("CloudAndMES", "CloudPassword", out sValue); - sysParams.CloudPassword = sValue; + iniHelper.ReadBool("FLIP", "Cam1_flipX", out bValue); + sysParams.Cam1_flipX = bValue; + iniHelper.ReadBool("FLIP", "Cam1_flipY", out bValue); + sysParams.Cam1_flipY = bValue; + iniHelper.ReadBool("FLIP", "Cam2_flipX", out bValue); + sysParams.Cam2_flipX = bValue; + iniHelper.ReadBool("FLIP", "Cam2_flipY", out bValue); + sysParams.Cam2_flipY = bValue; + + iniHelper.ReadInteger("CMPX", "Cm2px_x", out iValue); + sysParams.Cm2px_x = iValue; + iniHelper.ReadInteger("CMPX", "Cm2px_y", out iValue); + sysParams.Cm2px_y = iValue; + iniHelper.ReadInteger("CMPX", "MidCoin", out iValue); + sysParams.MidCoin = iValue; + iniHelper.ReadInteger("CMPX", "HolePx", out iValue); + sysParams.HolePx = iValue; + iniHelper.ReadInteger("CMPX", "LCrop", out iValue); + sysParams.LCrop = iValue; + iniHelper.ReadInteger("CMPX", "RCrop", out iValue); + sysParams.RCrop = iValue; + iniHelper.ReadInteger("CMPX", "Expand_pixel", out iValue); + sysParams.Expand_pixel = iValue; - iniHelper.ReadBool("CloudAndMES", "OpenPdtServer", out bValue); - sysParams.OpenPdtServer = bValue; - iniHelper.ReadString("CloudAndMES", "PdtServerIP", out sValue); - sysParams.PdtServerIP = sValue; - iniHelper.ReadInteger("CloudAndMES", "PdtServerPort", out iValue); - sysParams.PdtServerPort = iValue; - iniHelper.ReadBool("CloudAndMES", "IsPdtServer", out bValue); - sysParams.IsPdtServer = bValue; iniHelper.ReadBool("LabelPrint", "EnableLabelPrint", out bValue); sysParams.EnableLabelPrint = bValue; @@ -304,7 +349,20 @@ namespace GeBoShi.SysCtrl iniHelper.ReadBool("ExcelPrint", "EnableExcelPrint", out bValue); sysParams.EnableExcelPrint = bValue; iniHelper.ReadString("ExcelPrint", "ExcelPrinterName", out sValue); - sysParams.ExcelPrinterName = sValue; + sysParams.ExcelPrinterName = sValue; + + iniHelper.ReadString("ERP", "ErpDBConStr", out sValue); + sysParams.ErpDBConStr = sValue; + iniHelper.ReadString("ERP", "ErpSql", out sValue); + sysParams.ErpSql = sValue; + + iniHelper.ReadString("Customer", "CustomerName", out sValue); + sysParams.CustomerName = sValue; + + iniHelper.ReadString("Material", "SuedeList", out sValue); + if (!string.IsNullOrWhiteSpace(sValue)) + sysParams.SuedeList = sValue.Split(new char[] { ',', ';' }); + SysConfigParams = sysParams; return sysParams; @@ -532,6 +590,49 @@ namespace GeBoShi.SysCtrl } #endregion + #region ERP数据库 + private SqlSugarClient db; + + public SqlSugarClient getErpDBCon(SqlSugar.DbType dbType = SqlSugar.DbType.SqlServer) + { + if (string.IsNullOrEmpty(SysConfigParams.ErpDBConStr)) + return null; + if (db != null) return db; + + db = new SqlSugarClient(new ConnectionConfig() + { + ConnectionString = SysConfigParams.ErpDBConStr, + DbType = dbType, + IsAutoCloseConnection = true + }, + db => + { + db.Aop.OnLogExecuting = (sql, pars) => + { + Console.WriteLine(sql);//输出sql,查看执行sql 性能无影响 + + //获取原生SQL推荐 5.1.4.63 性能OK + //UtilMethods.GetNativeSql(sql,pars) + + //获取无参数化SQL 对性能有影响,特别大的SQL参数多的,调试使用 + //UtilMethods.GetSqlString(DbType.SqlServer,sql,pars) + }; + + }); + return db; + } + public DataTable execSql(string sql, List parameters, SqlSugar.DbType dbType = SqlSugar.DbType.SqlServer) + { + //查询表的所有 + var mydb = getErpDBCon(dbType); + if (mydb == null) return null; + + if (!mydb.Ado.IsValidConnection()) + mydb.Ado.Open(); + return mydb.Ado.GetDataTable(sql, parameters); + } + #endregion + #endregion } @@ -720,6 +821,23 @@ namespace GeBoShi.SysCtrl /// 右侧裁剪 /// public int RCrop = 0; + + /// + /// 相机1X翻转 + /// + public bool Cam1_flipX { get; set; } + /// + /// 相机1Y翻转 + /// + public bool Cam1_flipY { get; set; } + /// + /// 相机2X翻转 + /// + public bool Cam2_flipX { get; set; } + /// + /// 相机2Y翻转 + /// + public bool Cam2_flipY { get; set; } #endregion #region Http/MES @@ -771,6 +889,29 @@ namespace GeBoShi.SysCtrl public string ExcelPrinterName { get; set; } #endregion + #region ERP + /// + /// 禾欣ERP数据库 + /// + public string ErpDBConStr { get; set; } + /// + /// 禾欣ERP数据读取 + /// + public string ErpSql { get; set; } + #endregion + + #region 客户 + /// + /// 客户名 + /// + public string CustomerName { get; set; } + #endregion + + #region 材质配合禾欣 + //材质Material + public string[] SuedeList = new string[0]; + #endregion + public SysConfigParams() { DefectSrcImag = new ImageSaveParam("D:\\Image\\DefectSrcImag"); @@ -825,6 +966,16 @@ namespace GeBoShi.SysCtrl PdtServerIP = "127.0.0.1"; PdtServerPort = 10573; IsPdtServer = true; + + ErpDBConStr = ""; + ErpSql = ""; + + CustomerName = ""; + + Cam1_flipX = false; + Cam1_flipY = false; + Cam2_flipX = false; + Cam2_flipY = false; } } #endregion diff --git a/LeatherProject/GeBoShi/SysCtrl/OpencvUtils.cs b/LeatherProject/GeBoShi/SysCtrl/OpencvUtils.cs new file mode 100644 index 0000000..79c47ba --- /dev/null +++ b/LeatherProject/GeBoShi/SysCtrl/OpencvUtils.cs @@ -0,0 +1,463 @@ +using OpenCvSharp; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace GeBoShi.SysCtrl +{ + public static class OpencvUtils + { + public static int image_width = 2048; + public static int image_height = 2048; + #region 图像预处理 + public static Mat Resize(Mat mat, int width, int height, out int xw) + { + OpenCvSharp.Size dsize = new OpenCvSharp.Size(width, height); + Mat mat2 = new Mat(); + //Cv2.Resize(mat, mat2, dsize); + ResizeUniform(mat, dsize, out mat2, out xw); + return mat2; + } + /// + /// 等比例缩放 + /// + /// + /// + /// + /// + public static int ResizeUniform(Mat src, Size dst_size, out Mat dst, out int xw) + { + xw = 0; + int w = src.Cols; + int h = src.Rows; + int dst_w = dst_size.Width; + int dst_h = dst_size.Height; + //std::cout << "src: (" << h << ", " << w << ")" << std::endl; + dst = new Mat(dst_h, dst_w, MatType.CV_8UC3, new Scalar(114, 114, 114)); + + float[] ratio = new float[2]; + float ratio_src = w * 1.0f / h; + float ratio_dst = dst_w * 1.0f / dst_h; + + int tmp_w = 0; + int tmp_h = 0; + if (ratio_src > ratio_dst) + { + tmp_w = dst_w; + tmp_h = (int)(dst_w * 1.0f / w) * h; + + ratio[0] = (float)w / (float)tmp_w; + ratio[1] = (float)h / (float)tmp_h; + } + else if (ratio_src < ratio_dst) + { + tmp_h = dst_h; + tmp_w = (int)((dst_h * 1.0f / h) * w); + + ratio[0] = (float)w / (float)tmp_w; + ratio[1] = (float)h / (float)tmp_h; + } + else + { + Cv2.Resize(src, dst, dst_size); + + ratio[0] = (float)w / (float)tmp_w; + ratio[1] = (float)h / (float)tmp_h; + return 0; + } + + //std::cout << "tmp: (" << tmp_h << ", " << tmp_w << ")" << std::endl; + Mat tmp = new Mat(); + Cv2.Resize(src, tmp, new Size(tmp_w, tmp_h)); + + unsafe + { + if (tmp_w != dst_w) + { //高对齐,宽没对齐 + int index_w = (int)((dst_w - tmp_w) / 2.0); + xw = index_w; + //std::cout << "index_w: " << index_w << std::endl; + for (int i = 0; i < dst_h; i++) + { + Buffer.MemoryCopy(IntPtr.Add(tmp.Data, i * tmp_w * 3).ToPointer(), IntPtr.Add(dst.Data, i * dst_w * 3 + index_w * 3).ToPointer(), tmp_w * 3, tmp_w * 3); + } + } + else if (tmp_h != dst_h) + { //宽对齐, 高没有对齐 + int index_h = (int)((dst_h - tmp_h) / 2.0); + //std::cout << "index_h: " << index_h << std::endl; + Buffer.MemoryCopy(tmp.Data.ToPointer(), IntPtr.Add(dst.Data, index_h * dst_w * 3).ToPointer(), tmp_w * tmp_h * 3, tmp_w * tmp_h * 3); + } + else + { + } + } + return 0; + } + public static Mat ResizeMat(Mat mat, int width, int height) + { + OpenCvSharp.Size dsize = new OpenCvSharp.Size(width, height); + Mat mat2 = new Mat(); + Cv2.Resize(mat, mat2, dsize); + return mat2; + } + + /// + /// 计算合理宽幅 + /// + /// 多个相机图像总宽(外部去除重合部分) + /// + public static int GetWidthForResize(int sumWidth) + { + //保证计算8x2 16个小图 + int count = (int)Math.Round(sumWidth * 1.0f / image_width, 0); + count = 8; + return count * image_width; + + //int count = sumWidth / image_width; + ////int remainder = sumWidth % image_width; + //if (count % 2 == 0) + // return count * image_width; + //else + // return count * image_width+ image_width; + } + /// + /// 裁切指定区域 + /// + /// + /// + /// + /// + /// + /// + public static Mat CutImage(Mat mat, int x, int y, int width, int height) + { + Rect roi = new Rect(x, y, width, height); + return new Mat(mat, roi).Clone(); + } + #endregion + + #region 裁边 + /// + /// 裁边 + /// + /// + /// + /// + /// + /// + public static Mat getMaxInsetRect2(Mat mat_rgb, bool isLeft, int marginHoleWidth, out int marginWidth) + { + int bian = 3500; + Rect Roi; + if (!isLeft) + Roi = new Rect(mat_rgb.Width - bian, 0, bian, mat_rgb.Height); + else + Roi = new Rect(0, 0, bian, mat_rgb.Height); + int type = isLeft ? 1 : 0; + 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(); + Cv2.CvtColor(mat_rgb, image_gray, ColorConversionCodes.BGR2GRAY); + //cvtColor(image_RGB, image, COLOR_RGB2GRAY); + int height = image_gray.Rows; + int width = image_gray.Cols; + + // 算法定义:取均分5段图片的五条横线,经过一系列处理之后,二值化,找到沿边位置,然后取均值作为直边,在缩进一段有针眼的位置 + // 定义每段的行数 + int num_rows = 5; + int segment_height = height / num_rows - 1; + + // 定义空数组保存结果 + int[] total = new int[num_rows]; + + // 平均截取5行数据并处理图像 + for (int i = 0; i < num_rows; i++) + { + // 截取当前行的图像 + int start_row = i * segment_height; + Rect roi = new Rect(0, start_row, width, 1); + Mat current_segment = image_gray.Clone(roi); + + // 对当前行的图像进行平滑处理 + Mat smoothed_image = new Mat(); + Cv2.GaussianBlur(current_segment, smoothed_image, new Size(5, 1), 0); + + // 计算当前行的灰度直方图 + Mat absolute_histo = new Mat(); + Cv2.CalcHist(new Mat[] { smoothed_image }, new int[] { 0 }, new Mat(), absolute_histo, 1, new int[] { 256 }, new Rangef[] { new Rangef(0, 256) }); + Cv2.GaussianBlur(current_segment, smoothed_image, new Size(19, 1), 0); + + // 对图片进行分割i+1 + //double otsu_threshold; + //threshold(smoothed_image, smoothed_image, 0, 255, THRESH_BINARY + THRESH_OTSU, &otsu_threshold); + Cv2.Threshold(smoothed_image, smoothed_image, 0, 255, ThresholdTypes.Binary | ThresholdTypes.Otsu); + + // 使用形态学操作进行孔洞填充 + Mat kernel = Cv2.GetStructuringElement(MorphShapes.Rect, new Size(25, 1)); + Mat filled_image = new Mat(); + Cv2.MorphologyEx(smoothed_image, filled_image, MorphTypes.Close, kernel); + + // 取较长的一个值作为皮革的宽度 + int num_255 = Cv2.CountNonZero(filled_image); + int length_t = (num_255 > width / 2) ? num_255 : width - num_255; + total[i] = (length_t); + API.OutputDebugString($"getMaxInsetRect2: 【{i + 1}】{length_t}={num_255}|{width}"); + } + // 取平均值作为宽度 + int length = (int)total.Average(); + marginWidth = width-length; +#endif + int length = (len > mat_rgb.Width / 2) ? len : mat_rgb.Width - len; + marginWidth = mat_rgb.Width - length; + // 判断数据是否异常,判断当前线段的宽度是否大于设定像素的偏差 + //int abnormal_pxl = 200; + //for (int i = 0; i < num_rows; i++) + //{ + // if (Math.Abs(total[i] - length) > abnormal_pxl) + // throw new Exception("数据异常,当段图片的宽度有问题!"); + //} + + //右侧相机,拍摄产品,边缘位于右侧判断,缩进100像素,去点针眼 + //Cv2.Line(mat_rgb, new Point(length - 100, 0), new Point(length - 100, height), new Scalar(255, 0, 0), 20); + ////左侧相机,拍摄产品,边缘位于左侧判断,缩进100像素,去点针眼 + //Cv2.Line(mat_rgb, new Point(width - length + 100, 0), new Point(width - length + 100, height), new Scalar(0, 255, 0), 20); + + //int decWidth = width - length + marginHoleWidth; + //if (isLeft) + // return cutImage(mat_rgb, decWidth, 0, width- decWidth, height); + //else + // return cutImage(mat_rgb, 0, 0, width - decWidth, height); + + //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); + else + return CutImage(mat_rgb, 0, 0, length - marginHoleWidth, mat_rgb.Height); + } + + /// + /// 寻边算法 + /// + /// + /// + /// + /// + /// + public static int EdgeClipping2(Mat image, int FindType, Rect Roi, bool IsLeft) + { + DateTimeOffset startTime = DateTimeOffset.Now; + 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 sf_height = height / sf; + int sf_width = width / sf; + Cv2.Resize(mat_rgb, mat_rgb, new Size(sf_width, sf_height), 0, 0, InterpolationFlags.Linear); + Mat himg = new Mat(); + himg = mat_rgb.Clone(); + DateTimeOffset endTime = DateTimeOffset.Now; + //Console.WriteLine("图片缩小(ms): " + (endTime - startTime).TotalMilliseconds.ToString("0.000")); + startTime = DateTimeOffset.Now; + + //滤过去除多余噪声 + //Cv2.EdgePreservingFilter(himg, himg, EdgePreservingMethods.NormconvFilter); + //Cv2.PyrMeanShiftFiltering(himg, himg, 1, 2, 1); + Cv2.PyrMeanShiftFiltering(himg, himg, 10, 17, 2); + //himg.ImWrite("himg.jpg"); + endTime = DateTimeOffset.Now; + //Console.WriteLine("滤过去除多余噪声(ms): " + (endTime - startTime).TotalMilliseconds.ToString("0.000")); + + startTime = DateTimeOffset.Now; + //转灰度图 + Mat image_gray = new Mat(); + Cv2.CvtColor(himg, image_gray, ColorConversionCodes.BGR2GRAY); + //image_gray.ImWrite("image_gray.jpg"); + + Mat image_Canny = new Mat(); + Cv2.Canny(image_gray, image_Canny, 32, 64); + //image_Canny.ImWrite("image_Canny.jpg"); + + + //二值化 + Mat image_Otsu = new Mat(); + int hDis = sf_height / (pointNum + 2); //去除边缘两点 +#if false //二值算法 + List LeftAvg = new List(); + List RightAvg = new List(); + //double thb = Cv2.Threshold(image_gray, image_Otsu, 0, 255, ThresholdTypes.Binary | ThresholdTypes.Otsu); + #region 多点获取二值化均值 + for (int i = 0; i < pointNum; i++) + { + Rect roiLeft = new Rect(0, hDis + hDis * i, pix, pix); + Mat current_segmentL = image_gray.Clone(roiLeft); + //Scalar ttr = current_segmentL.Mean(); + LeftAvg.Add(current_segmentL.Mean().Val0); + + Rect roiRight = new Rect(sf_width - pix, hDis + hDis * i, pix, pix); + Mat current_segmentR = image_gray.Clone(roiRight); + RightAvg.Add(current_segmentR.Mean().Val0); + } + double thres = 0; + if (IsLeft) + { + if (LeftAvg.Average() > RightAvg.Average()) + thres = RightAvg.Max() + offsetGray; + else + thres = RightAvg.Min() - offsetGray; + } + else + { + if (LeftAvg.Average() > RightAvg.Average()) + thres = LeftAvg.Min() - offsetGray; + else + thres = LeftAvg.Max() + offsetGray; + } + //double thres = (RightAvg.Average() + )/2; + #endregion +#endif +#if false + double min, max; + + image_gray.MinMaxLoc(out min, out max); + double thres = (min + max) / 2; +#endif + +#if false //二值化图片 + //Cv2.Threshold(image_gray, image_Otsu, 0, 255, ThresholdTypes.Otsu); + double thb = Cv2.Threshold(image_gray, image_Otsu, thres, 255, ThresholdTypes.Binary); + image_Otsu.ImWrite("Otsu1.jpg"); + Cv2.MedianBlur(image_Otsu, image_Otsu, 21); + image_Otsu.ImWrite("Otsu2.jpg"); + endTime = DateTimeOffset.Now; + Console.WriteLine("灰度图二值化(ms): " + (endTime - startTime).TotalMilliseconds.ToString("0.000")); + startTime = DateTimeOffset.Now; +#else + image_Otsu = image_Canny; +#endif + // 定义空数组保存结果 + int[] total = new int[pointNum]; + List total_t = new List(); + bool isLeft = FindType == 0 ? true : false; + // 平均截取pointNum行数据并处理图像 + for (int i = 0; i < pointNum; i++) + { + // 截取当前行的图像 + Rect roi = new Rect(0, hDis + hDis * i, sf_width, 1); + Mat current_segment = image_Otsu.Clone(roi); + +#if false + #region 预处理 + // 对当前行的图像进行平滑处理 + Mat smoothed_image2 = new Mat(); + Cv2.GaussianBlur(current_segment, smoothed_image2, new Size(5, 1), 0); + + // 计算当前行的灰度直方图 + Mat absolute_histo2 = new Mat(); + + Cv2.CalcHist(new Mat[] { smoothed_image2 }, new int[] { 0 }, new Mat(), absolute_histo2, 1, new int[] { 256 }, new Rangef[] { new Rangef(0, 256) }); + Cv2.GaussianBlur(current_segment, smoothed_image2, new Size(9, 1), 0); + + // 对图片进行分割 + //double otsu_threshold; + //threshold(smoothed_image, smoothed_image, 0, 255, THRESH_BINARY + THRESH_OTSU, &otsu_threshold); + double otsu_threshold2 = Cv2.Threshold(smoothed_image2, smoothed_image2, 0, 255, ThresholdTypes.Binary | ThresholdTypes.Otsu); + + // 使用形态学操作进行孔洞填充 + Mat kernel3 = Cv2.GetStructuringElement(MorphShapes.Rect, new Size(5, 1)); + Mat filled_image3 = new Mat(); + Cv2.MorphologyEx(smoothed_image2, filled_image3, MorphTypes.Close, kernel3); + #endregion +#else + //Mat filled_image3 = current_segment.Clone(); + Mat filled_image3 = current_segment; +#endif +#if true + //从左到右判断边和从右到左判断边 + int numX = 0; + byte tempVal = 0; + if (isLeft) + { + tempVal = filled_image3.At(0, 0); + for (int j = 0; j < filled_image3.Cols; j++) + { + if (filled_image3.At(0, j) != tempVal) + { + numX = j; + break; + } + } + } + else + { + tempVal = filled_image3.At(0, filled_image3.Cols - 1); + for (int j = filled_image3.Cols - 1; j >= 0; j--) + { + if (filled_image3.At(0, j) != tempVal) + { + numX = j; + break; + } + } + } +#else + int numX = Cv2.CountNonZero(filled_image3); +#endif + //int length_t = (numX > (sf_width / 2)) ? numX :sf_width - numX; + int 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(); + + endTime = DateTimeOffset.Now; + //Console.WriteLine("计算边(ms): " + (endTime - startTime).TotalMilliseconds.ToString("0.000")); + + // 判断数据是否异常,判断当前线段的宽度是否大于设定像素的偏差 + //int abnormal_pxl = 100 / 4; + //for (int i = 0; i < pointNum; i++) + //{ + // if (Math.Abs(total[i] - length) > abnormal_pxl) + // Console.WriteLine("数据异常!"); + // //出现数据异常,当段图片的宽度有问题 + //} + + //乘上换算系数还原 + length = length * sf + Roi.X; + return length; + } + #endregion + + #region 合并 + /// + /// 合并MAT(宽高必需一致) + /// + /// + /// + /// + public static Mat MergeImage_sameSize(Mat[] mats, bool isHorizontal = true) + { + Mat matOut = new Mat(); + if (isHorizontal) + Cv2.HConcat(mats, matOut);//横向拼接 + else + Cv2.VConcat(mats, matOut);//纵向拼接 + return matOut; + } + #endregion + } +} diff --git a/LeatherProject/GeBoShi/SysCtrl/SysEnum.cs b/LeatherProject/GeBoShi/SysCtrl/SysEnum.cs index b54f747..898a4a9 100644 --- a/LeatherProject/GeBoShi/SysCtrl/SysEnum.cs +++ b/LeatherProject/GeBoShi/SysCtrl/SysEnum.cs @@ -24,48 +24,25 @@ namespace GeBoShi.SysCtrl } public enum DOName { - 三色灯红灯 = 0, - 三色灯绿灯 = 1, - 三色灯黄灯 = 2, - 三色灯蜂鸣器 = 3, + 三色灯红灯 = 10, + 三色灯绿灯 = 11, + 三色灯黄灯 = 12, + 三色灯蜂鸣器 = 13, + + 启动 = 0, + 复位 = 9, + 停止 = 1, - 测厚气缸 = 4, - 加紧气缸 = 5, - - 双手启动绿灯 = 7, - 启动按钮绿灯 = 8, - 复位按钮黄灯 = 9, - 停止按钮红灯 = 10, - - 触发张力按钮灯 = 11, - - 日光灯 = 12, - - X1回原 = 13, - X2回原 = 14, - - Y轴回原点 = 15 + 日光灯 = 15, } public enum DIName { 启动按钮 = 14, - 暂停按钮 = 3, + 暂停按钮 = 1, 复位按钮 = 2, - 触发张力 = 4, - - 产品有无 = 5, - - 右夹紧缩回 = 6, - 右夹紧伸出 = 7, - 前夹紧缩回 = 8, - 前夹紧伸出 = 9, - 侧推伸出 = 0, - 侧推缩回 = 1, - - 双手启动 = 10, + 门磁 = 11, - Y轴回原点完成 = 15 } } diff --git a/LeatherProject/GeBoShi/SysCtrl/SysMgr.cs b/LeatherProject/GeBoShi/SysCtrl/SysMgr.cs index 752282e..2c7a5e2 100644 --- a/LeatherProject/GeBoShi/SysCtrl/SysMgr.cs +++ b/LeatherProject/GeBoShi/SysCtrl/SysMgr.cs @@ -1,22 +1,41 @@ -using BarTenderPrint; +#define Online +using BarTenderPrint; +using CCWin.Win32.Const; using GeBoShi.ImageDefect; +using HalconDotNet; using HZH_Controls.Forms; using MaiMuControl.Device; +using MaiMuControl.Device.CamDev; using MaiMuControl.Device.IOCardDev; using MaiMuControl.Device.IOCardDev.Advantech; using MaiMuControl.Device.LightDev; using MaiMuControl.Device.LightDev.CST; using MaiMuControl.Device.LightDev.Rsee; +using MaiMuControl.Device.PlcDev; using MaiMuControl.SysStatusMgr.CloudMgr; using MaiMuControl.SysStatusMgr.StatusMgr; using MaiMuControl.SysStatusMgr.UserMgr; +using MaiMuControl.Utils; +using Models; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using OpenCvSharp; +using OpenCvSharp.Extensions; +using S7.Net; +using SqlSugar; using System; +using System.Collections; using System.Collections.Generic; +using System.Data; +using System.Diagnostics; using System.Drawing; +using System.Drawing.Imaging; +using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; +using System.Windows.Forms.DataVisualization.Charting; using ToolKits.Disk; namespace GeBoShi.SysCtrl @@ -71,7 +90,63 @@ namespace GeBoShi.SysCtrl private List productIdList = new List(); public List ProductIdList { get { return productIdList; } } - Service.ProductService PdtService = new Service.ProductService(); + /// + /// 当前产品 + /// + private Models.Product CurrProductModel = null; + + //数据锁 + private object lockCurrKey = new object(); + //当前运行数据key + private int currKey = 0; + //线程管控 + private Hashtable htTask = new Hashtable();//默认单线程写入不用lock, 多线程安全同步读取用Synchronized + + //是否处理完成 + private bool _isDefect = false; + //计算速度用,暂停时停止计数 + private Stopwatch pStopWatch = new Stopwatch(); + + //图片队列 + private int listCntMax = 5; + private int Cam1Cnt = 0; + private int Cam2Cnt = 0; + #region 处理类型 + private class ScanPhotoInfo + { + /// + /// + /// + /// + /// 1-n 第1张会把1改为0 + /// + public ScanPhotoInfo(int _devIndex, int _photoIndex, string _path) + { + devIndex = _devIndex; + photoIndex = _photoIndex; + path = _path; + } + public ScanPhotoInfo(int _devIndex, int _photoIndex, Mat _mat) + { + devIndex = _devIndex; + photoIndex = _photoIndex; + mat = _mat; + } + public int devIndex { get; set; } + /// + /// 0-n + /// + public int photoIndex { get; set; } + public string path { get; set; } + public Mat mat { get; set; } + + } + #endregion + private Queue _matList1 = new Queue(); + private Queue _matList2 = new Queue(); + + private Service.ProductService PdtService = new Service.ProductService(); + private Service.RecordsService RecordService = new Service.RecordsService(); #endregion #region 公开字段 @@ -96,6 +171,8 @@ namespace GeBoShi.SysCtrl #region 私有流程 //主流程 private Thread _mainThread; + private Thread _Cam1Thread; + private Thread _Cam2Thread; private CancellationTokenSource _cts; #endregion @@ -121,6 +198,10 @@ namespace GeBoShi.SysCtrl init_Cloud = false; cloudMgr = new CloudMgr(); DailyOutput = 0; + + Service.InitDB.ConnectionString = confMgr.DBConStr; + PdtService = new Service.ProductService(); + RecordService = new Service.RecordsService(); } #region 本地云上传 @@ -254,6 +335,7 @@ namespace GeBoShi.SysCtrl SendStatus(); //Thread.Sleep(200); + // 硬件初始化 if (!InitAllDev()) { @@ -269,10 +351,9 @@ namespace GeBoShi.SysCtrl } InitLog("加载硬件驱动参数完成!"); //Thread.Sleep(200); - // 处理运行 InitLog("AI算法核心初始化..."); - + defectLib = new DefectLib(); if (!defectLib.start()) throw new Exception("外观检测核心初始化失败..."); InitLog("AI算法核心初始化完成!"); @@ -305,11 +386,15 @@ namespace GeBoShi.SysCtrl /// public bool InitDefectEvent() { - defectLib.WarningEvent = (warning, msg) => + if (defectLib != null) { - Log("缺陷检测", msg, warning); - }; - return true; + defectLib.WarningEvent = (warning, msg) => + { + Log("缺陷检测", msg, warning); + }; + return true; + } + return false; } public bool InitCloudConnect() @@ -339,6 +424,20 @@ namespace GeBoShi.SysCtrl }); _mainThread.IsBackground = true; _mainThread.Start(); + + _Cam1Thread = new Thread(() => + { + Cam1ThreadFunction(); + }); + _Cam1Thread.IsBackground = true; + _Cam1Thread.Start(); + + _Cam2Thread = new Thread(() => + { + Cam2ThreadFunction(); + }); + _Cam2Thread.IsBackground = true; + _Cam2Thread.Start(); } #endregion @@ -352,6 +451,200 @@ namespace GeBoShi.SysCtrl return statusMgr.Status == SystemStsEnum.Pause || statusMgr.Warning == WarningEnum.High; } /// + /// 相机1采图预处理 + /// + private void Cam1ThreadFunction() + { + while (true) + { + try + { + if (_cts.IsCancellationRequested) + break; + + if (IsRuning) + { + ////暂停开始 + //stopWatch.Start(); + do + { + #region 实时采图 +#if Online + //采集图片 + Acquisition acq = _LinecamDev1.GetFrames(1, 10); + if (acq.GrabStatus == "GrabPass") + { + //显示 + OnAutoRuning(new RunEventArgs(1, acq.Image)); + lock (lockCurrKey) + { + //存在数据队列 + if (currKey != 0 || htTask.ContainsKey(currKey)) + { + Mat img = CamDev.HImageToMat(acq.Image.CopyObj(1, -1)); + if (_matList1.Count > listCntMax) + { + _matList1.Dequeue(); + System.GC.Collect(); + } + //预处理 + Stopwatch stopWatch = new Stopwatch(); + Log($"图像预处理", $"相机1-{Cam1Cnt}"); + string time = ""; + stopWatch.Start(); + int errStep = 0; + Mat mat = img; + try + { + errStep = 1; + + //反转+相机索引调换 + + //裁边,两侧和中间重合部分 + if (confMgr.SysConfigParams.MidCoin > 0)//中间重合部分 + { + errStep = 3; + int width = mat.Width - confMgr.SysConfigParams.MidCoin / 2; + mat = OpencvUtils.CutImage(mat, 0, 0, width, mat.Height); + time += $"->相机1-去重({stopWatch.ElapsedMilliseconds})"; + } + Log($"裁边", $"(相机1-图像{Cam1Cnt})-左图去重后:{mat.Width}*{mat.Height}," + $"重复值:{confMgr.SysConfigParams.MidCoin / 2}"); + errStep = 4; + //左裁边 + int marginWidth0; + mat = OpencvUtils.getMaxInsetRect2(mat, true, confMgr.SysConfigParams.HolePx, out marginWidth0); + errStep = 5; + time += $"->相机1裁边({stopWatch.ElapsedMilliseconds})"; + } + catch (Exception e) + { + Log($"图像处理", $"异常({errStep}):(相机1-图像{Cam1Cnt})-{e.Message}", WarningEnum.High); + } + //Cv2.Flip(img, img, FlipMode.XY);//翻转 + _matList1.Enqueue(new ScanPhotoInfo(0, Cam1Cnt++, mat.Clone())); + } + else + Log($"相机1", $"(图像)-未扫码,图像丢弃!", WarningEnum.Low); + } + + } +#endif + #endregion + Thread.Sleep(50); + } while (!isBreakProcessRun()); + //暂停中断 + //stopWatch.Stop(); + pStopWatch.Stop(); + //_isRuning = false; + } + Thread.Sleep(10); + } + catch (Exception e) + { + _isRuning = false; + + Log("运行报警", "相机1流程运行出错:" + e.Message + "\n", WarningEnum.High); + } + } + } + /// + /// 相机2采图预处理 + /// + private void Cam2ThreadFunction() + { + while (true) + { + try + { + if (_cts.IsCancellationRequested) + break; + + if (IsRuning) + { + ////暂停开始 + //stopWatch.Start(); + do + { + #region 实时采图 +#if Online + //采集图片 + Acquisition acq = _LinecamDev2.GetFrames(1, 10); + if (acq.GrabStatus == "GrabPass") + { + //显示 + OnAutoRuning(new RunEventArgs(2, acq.Image)); + lock (lockCurrKey) + { + //存在数据队列 + if (currKey != 0 || htTask.ContainsKey(currKey)) + { + Mat img = CamDev.HImageToMat(acq.Image.CopyObj(1, -1)); + if (_matList2.Count > listCntMax) + { + _matList2.Dequeue(); + System.GC.Collect(); + } + //预处理 + Stopwatch stopWatch = new Stopwatch(); + Log($"图像预处理", $"相机2-{Cam2Cnt}"); + string time = ""; + stopWatch.Start(); + int errStep = 0; + Mat mat = img; + try + { + errStep = 1; + + //反转+相机索引调换 + + //裁边,两侧和中间重合部分 + if (confMgr.SysConfigParams.MidCoin > 0)//中间重合部分 + { + errStep = 3; + int width = mat.Width - confMgr.SysConfigParams.MidCoin / 2; + mat = OpencvUtils.CutImage(mat, confMgr.SysConfigParams.MidCoin / 2, 0, width, mat.Height); + time += $"->相机2-去重({stopWatch.ElapsedMilliseconds})"; + } + Log($"裁边", $"(相机2-图像{Cam2Cnt})-右图去重后:{mat.Width}*{mat.Height}," + $"重复值:{confMgr.SysConfigParams.MidCoin / 2}"); + errStep = 4; + //右裁边 + int marginWidth0; + mat = OpencvUtils.getMaxInsetRect2(mat, false, confMgr.SysConfigParams.HolePx, out marginWidth0); + errStep = 5; + time += $"->相机2裁边({stopWatch.ElapsedMilliseconds})"; + } + catch (Exception e) + { + Log($"图像处理", $"异常({errStep}):(相机2-图像{Cam2Cnt})-{e.Message}", WarningEnum.High); + } + //Cv2.Flip(img, img, FlipMode.XY);//翻转 + _matList2.Enqueue(new ScanPhotoInfo(1, Cam2Cnt++, mat.Clone())); + } + else + Log($"相机2", $"(图像)-未扫码,图像丢弃!", WarningEnum.Low); + } + + } +#endif +#endregion + Thread.Sleep(50); + } while (!isBreakProcessRun()); + //暂停中断 + //stopWatch.Stop(); + pStopWatch.Stop(); + //_isRuning = false; + } + Thread.Sleep(10); + } + catch (Exception e) + { + _isRuning = false; + + Log("运行报警", "相机1流程运行出错:" + e.Message + "\n", WarningEnum.High); + } + } + } + /// /// 后台运行主线程 /// private void MainThreadFunction() @@ -367,13 +660,184 @@ namespace GeBoShi.SysCtrl { ////暂停开始 //stopWatch.Start(); - //do - //{ - // CurrProcessIndex = nextProcess(CurrProductModel, CurrProcessIndex); - //} while (CurrProcessIndex >= 0 && !isBreakProcessRun()); - ////暂停中断 - //stopWatch.Stop(); + do + { + #region 长度剩余提醒 + //长度剩余提醒 + Records curRecord = Hashtable.Synchronized(htTask)[currKey] as Records; + if (CurrProductModel.residueWarnningLen > 0 && curRecord.ErpLen > 0 && CurrProductModel.residueWarnningLen >= curRecord.ErpLen - curRecord.Len) + { + Log($"长度告警", $"已达剩余长度不足提醒!({curRecord.ErpLen - curRecord.Len}<={CurrProductModel.residueWarnningLen})", WarningEnum.Low); + } + #endregion + #region 处理2次判定 + //处理2次判定 + #endregion + + #region 图像裁边预处理 + //预处理,队列都有数据,且数据长度一致 +#if Online + if (_matList1.Count > 0 && _matList2.Count > 0 && (_matList1.Count == _matList2.Count)) + { + Stopwatch stopWatch = new Stopwatch(); + ScanPhotoInfo scanPhotos0 = _matList1.Dequeue(); + ScanPhotoInfo scanPhotos1 = _matList2.Dequeue(); + Log($"图像拼接处理", $"相机1-{scanPhotos0.photoIndex},相机2-{scanPhotos1.photoIndex}"); + string time = ""; + stopWatch.Start(); + int errStep = 0; + try + { + if (scanPhotos0.mat.Height != scanPhotos1.mat.Height) + { + Log($"警告", $"两相机采集图高度不一致({scanPhotos0.photoIndex}),dev1.Height={scanPhotos0.mat.Height},dev2.Height={scanPhotos1.mat.Height},重新resize...", WarningEnum.Low); + if (scanPhotos0.mat.Height > scanPhotos1.mat.Height) + scanPhotos1.mat = OpencvUtils.ResizeMat(scanPhotos1.mat, scanPhotos0.mat.Width, scanPhotos0.mat.Height); + else + scanPhotos0.mat = OpencvUtils.ResizeMat(scanPhotos0.mat, scanPhotos1.mat.Width, scanPhotos1.mat.Height); + } + errStep = 1; + + //反转+相机索引调换 + Mat mat0 = scanPhotos1.mat; + Mat mat1 = scanPhotos0.mat; + + //水平合并l + Mat mat = OpencvUtils.MergeImage_sameSize(new Mat[] { mat0, mat1 });//这里相机反装,左右反转下 + Log($"合并", $"(图像{scanPhotos0.photoIndex})-裁边去孔洞后:({mat0.Width}+{mat1.Width});合并后(去孔洞):{mat.Width}*{mat.Height}"); + //float widthRatio = mat.Width * 1.0f / resize.Width;//宽度比例 + time += $"->图1+2合并({stopWatch.ElapsedMilliseconds})"; + + //门幅更新(含两侧孔洞)x,y cm + float faceWidthX_cm = (float)Math.Round((scanPhotos0.photoIndex + 1) * mat.Height * 1.0f / confMgr.SysConfigParams.Cm2px_y, 2); + float faceWidthY_cm = (float)Math.Round((mat.Width + confMgr.SysConfigParams.HolePx * 2) * 1.0f / confMgr.SysConfigParams.Cm2px_x, 2); +#else + string imgfilePath = "E:\\CPL\\测试代码\\革测试\\1-1\\现场原图"; + + if (!Directory.Exists(imgfilePath)) + { + Log($"图像处理", $"模拟错误-路径错误{imgfilePath}", WarningEnum.High); + break; + } + string[] files = Directory.GetFiles(imgfilePath, $"*.bmp", SearchOption.TopDirectoryOnly); + + if (files.Length > 0 && Cam1Cnt < files.Length) + { + Stopwatch stopWatch = new Stopwatch(); + + string time = ""; + //stopWatch.Start(); + + ScanPhotoInfo scanPhotos0 = new ScanPhotoInfo(0, Cam1Cnt, new Mat(4096, 4096 * 2, MatType.CV_8UC3, new Scalar(0, 0, 0))); + ScanPhotoInfo scanPhotos1 = new ScanPhotoInfo(1, Cam1Cnt, new Mat(4096, 4096 * 2, MatType.CV_8UC3, new Scalar(0, 0, 0))); + + stopWatch.Start(); + int errStep = 0; + try + { + Log($"图像处理", $"模拟{files[Cam1Cnt]}"); + Mat mat = new Mat(files[Cam1Cnt]); + Cam1Cnt++; + Mat mat0 = scanPhotos1.mat; + Mat mat1 = scanPhotos0.mat; + + float faceWidthX_cm = (float)Math.Round((scanPhotos0.photoIndex + 1) * mat.Height * 1.0f / confMgr.SysConfigParams.Cm2px_y, 2); + float faceWidthY_cm = (float)Math.Round((mat.Width + confMgr.SysConfigParams.HolePx * 2) * 1.0f / confMgr.SysConfigParams.Cm2px_x, 2); +#endif + //显示图片 + OnAutoRuning(new RunEventArgs(mat.Clone())); + + faceWidthX_cm = (float)Math.Round(faceWidthX_cm, 2); + faceWidthY_cm = (float)Math.Round(faceWidthY_cm, 2); + if (curRecord.FaceWidthMin == 0 || curRecord.FaceWidthMin > faceWidthY_cm) + curRecord.FaceWidthMin = faceWidthY_cm; + if (curRecord.FaceWidthMax < faceWidthY_cm) + curRecord.FaceWidthMax = faceWidthY_cm; + var point = new float[] { faceWidthX_cm, faceWidthY_cm };// new System.Drawing.PointF(faceWidthX_cm, faceWidthY_cm); + Log($"门幅", $"(图像{scanPhotos0.photoIndex})-({scanPhotos0.photoIndex})位置:{point[0]}; 幅宽:{point[1]}"); + curRecord.FacePointList.Add(point); + + //判定门幅 + //if (x < XSizeRange[0]) + // Log($"绘图", $"门幅宽度超限 1!!!! {x}<{XSizeRange[0]}", WarningEnum.High); + //if (x > XSizeRange[1]) + // Log($"绘图", $"门幅宽度超限 2!!!! {x}>{XSizeRange[1]}", WarningEnum.High); + //if (item[1] < YSizeRange[0]) + // Log($"绘图", $"门幅宽度超限 3!!!! {item[1]}<{YSizeRange[0]}", WarningEnum.High); + //if (item[1] > YSizeRange[1]) + // Log($"绘图", $"门幅宽度超限 4!!!! {item[1]}>{YSizeRange[1]}", WarningEnum.High); + + //显示门幅绘图 + OnAutoRuning(new RunEventArgs(curRecord.FacePointList)); + errStep = 7; + time += $"->门幅刷新({stopWatch.ElapsedMilliseconds})"; + //去除两侧孔洞(门幅计算时不能去除) + //if (Config.MarginHoleWidth > 0) + // mat = OpenCVUtil.cutImage(mat, Config.MarginHoleWidth, 0, mat.Width - Config.MarginHoleWidth * 2, mat.Height); + + //计算速度 + double lenMi = Math.Round(faceWidthX_cm / 100, 2); + curRecord.Len = lenMi; + curRecord.TimeLen = pStopWatch.ElapsedMilliseconds / 1000.0d / 60.0d;//总时间 分 + //显示速度 + OnAutoRuning(new RunEventArgs(lenMi, Math.Round(lenMi / curRecord.TimeLen, 2))); + + errStep = 9; + time += $"->速度刷新({stopWatch.ElapsedMilliseconds})"; + //----缺陷队列 + //比例缩放图片 + int xw; + int resizeWidth = OpencvUtils.GetWidthForResize(mat0.Width + mat1.Width - confMgr.SysConfigParams.MidCoin); + if (resizeWidth == 0) + throw new Exception("GetWidthForResize result 0 失败!"); + var resize = new System.Drawing.Size(resizeWidth, OpencvUtils.image_height * 2);//固定8192*2张*4096 + mat = OpencvUtils.Resize(mat, resize.Width, resize.Height, out xw); + Log($"图像处理", $"(图像{scanPhotos0.photoIndex})-合成图resize后:{mat.Width}*{mat.Height}"); + defectLib.add(new DefectTask() + { + modelName = curRecord.ProductInfo.ModelName, + record = curRecord, + bmp = mat, + bmpTag = mat.Clone(), + photoIndex = scanPhotos0.photoIndex,//0-n 首张必需为0,因下面计算长度是从0开始 + widthRatio = 1.0f,//等比例缩放,高度不变 + qualifiedLimitList = curRecord.ProductInfo.QualifiedLimitList, + labelDic = GetDefectCode(), + finishEvent = callBackDefectEvent, + xw = xw, + cm2px_x = confMgr.SysConfigParams.Cm2px_x, + cm2px_y = confMgr.SysConfigParams.Cm2px_y, + expand_pixel = confMgr.SysConfigParams.Expand_pixel, + }); + errStep = 10; + time += $"->加入瑕疵待检队列({stopWatch.ElapsedMilliseconds})"; + } + catch (Exception ex) + { + curRecord.ScannerPhotoFinishCount++;//失败时不能因数量不一致无法保存 + Log( $"图像处理", $"异常({errStep}):(图像{scanPhotos0.photoIndex})-{ex.Message}", WarningEnum.High); + //string dirPath = FileUtil.initFolder($"{Config.ImagePath}{curRecord.BatchId}_{curRecord.ReelId}\\Err\\"); + //OpenCvSharp.Extensions.BitmapConverter.ToBitmap(scanPhotos0.mat).Save($"{dirPath}{scanPhotos0.photoIndex}_0_Step{errStep}.bmp", ImageFormat.Bmp); + //OpenCvSharp.Extensions.BitmapConverter.ToBitmap(scanPhotos1.mat).Save($"{dirPath}{scanPhotos1.photoIndex}_1_Step{errStep}.bmp", ImageFormat.Bmp); + } + finally + { + Log($"图像处理", $"(图像{scanPhotos0.photoIndex})-进度计时:{time}"); + scanPhotos0.mat.Dispose(); + scanPhotos1.mat.Dispose(); + scanPhotos0 = scanPhotos1 = null; + //task = null; + System.GC.Collect(); + } + } +#endregion + + Thread.Sleep(50); + } while (!isBreakProcessRun()); + //暂停中断 + //stopWatch.Stop(); + pStopWatch.Stop(); _isRuning = false; } Thread.Sleep(10); @@ -386,6 +850,317 @@ namespace GeBoShi.SysCtrl } } } +#endregion + + #region 模型label + private JArray _defectItemList; + /// + /// 获取模型对应标签信息 + /// + private void GetDefectAllLabel() + { + string labels = CurrProductModel.ModelName.Replace(".trt", ".json"); + string configPath = confMgr.SysConfigParams.AIModelPath + $"\\{labels}"; + string lsTmp = File.ReadAllText(configPath); + JArray defectItemList = JArray.Parse(lsTmp); + _defectItemList = defectItemList; + //var item = defectItemList.FirstOrDefault(m => m.Value("id") == id); + //if (item == null) + // return null; + //return (JObject)item; + } + /// + /// 根据id获取标签信息 + /// + /// + /// + public JObject GetDefectLabel(int id) + { + if (_defectItemList != null && _defectItemList.Count > 0) + { + var item = _defectItemList.FirstOrDefault(m => m.Value("id") == id); + if (item == null) + return null; + return (JObject)item; + } + else + return null; + } + /// + /// 根据name获取标签信息 + /// + /// + /// + public JObject GetDefectLabel(string name) + { + if (_defectItemList != null && _defectItemList.Count > 0) + { + var item = _defectItemList.FirstOrDefault(m => m.Value("name") == name); + if (item == null) + return null; + return (JObject)item; + } + else + return null; + } + public string GetDefectName(string code) + { + if (_defectItemList != null && _defectItemList.Count > 0) + { + var item = _defectItemList.FirstOrDefault(m => m.Value("code") == code); + if (item == null) + return null; + return item.Value("name"); + } + else + return null; + } + public Dictionary GetDefectCode() + { + Dictionary dic = new Dictionary(); + for (int i = 0; i < _defectItemList.Count; i++) + { + var tt = _defectItemList[i]; + dic.Add(tt.Value("id"), tt.Value("code")); + } + return dic; + } + #endregion + + #region 推理完成处理 + private void callBackDefectEvent(DefectTask res) + { + { + int step = 0; + try + { + Log($"检测完成", $"图像队列:{res.record.ScannerPhotoFinishCount + 1}/{res.record.ScannerPhotoCount} (图像{res.photoIndex})检测结果:{res.isSucceed}"); + //string dirPath = FileUtil.initFolder($"{Config.ImagePath}{res.record.BatchId}_{res.record.ReelId}\\"); + //string dirSourcePath = FileUtil.initFolder($"{Config.ImagePath}{res.record.BatchId}_{res.record.ReelId}\\源图\\"); + //Cv2.Flip(res.bmp, res.bmp, FlipMode.XY);//翻转 + string dirPath = Util.CreateSubDir(confMgr.SysConfigParams.DefectSrcImag.SavePath, new List { $"{ res.record.BatchId }_{ res.record.ReelId }" }); + if (confMgr.SysConfigParams.DefectSrcImag.AutoSave)//保存所有原图 + OpenCvSharp.Extensions.BitmapConverter.ToBitmap(res.bmp).Save($"{dirPath}+{res.photoIndex}.bmp", ImageFormat.Bmp); + + if (res.isSucceed) + { + step = 1; + Log($"检测完成", $"(图像{res.photoIndex})-瑕疵检测完成,共{res.excelTable.Rows.Count}个瑕疵!各环节用时:{string.Join(",", res.stopwatch)}"); + //AddTextEvent(DateTime.Now,$"打标完成", $"第 ({res.photoIndex}) 张照片,计算过程:{res.resultInfo}"); + //if (!Config.IsSaveAllImage && Config.IsSaveDefectSourceImage) + // OpenCvSharp.Extensions.BitmapConverter.ToBitmap(res.bmp).Save($"{dirSourcePath}{res.photoIndex}.bmp", ImageFormat.Bmp); + + step = 2; + if (res.excelTable.Rows.Count > 0) + { + res.record.dicPhoto_Defect[res.photoIndex] = true;//改为此图有瑕疵 + //有瑕疵打标图必需保存 Jpeg + dirPath = Util.CreateSubDir(confMgr.SysConfigParams.DefectSplicImag.SavePath, new List { $"{res.record.BatchId}_{res.record.ReelId}" }); + if (confMgr.SysConfigParams.DefectSplicImag.AutoSave)//保存瑕疵图 + OpenCvSharp.Extensions.BitmapConverter.ToBitmap(res.bmpTag).Save($"{dirPath}{res.photoIndex}_tag.jpg", ImageFormat.Jpeg); + step = 3; + res.record.DefectTotalCount += res.excelTable.Rows.Count; + if (res.record.DefectInfoList == null) + res.record.DefectInfoList = new List(); + + step = 4; + JObject defectNameInfo; + DefectInfo defectInfo = null; + List dataRowlist = new List(); + long preTicks = pStopWatch.ElapsedMilliseconds;// DateTime.Now.Ticks; + for (int i = 0; i < res.lstDefectBmp.Count; i++) + { + step = 5 + i * 10; + defectNameInfo = GetDefectLabel(int.Parse(res.excelTable.Rows[i]["类别"].ToString())); + if(defectNameInfo == null) + { + Log($"告警", $"模型标签为空,或未找到标签!", WarningEnum.High); + continue; + } + defectInfo = new DefectInfo + { + PhotoIndex = res.photoIndex, + Code = defectNameInfo.Value("code"), + Name = defectNameInfo.Value("name"), + X = double.Parse(res.excelTable.Rows[i]["X"].ToString()),//cm + Y = Math.Round((res.photoIndex * res.bmp.Height * 1.0d / confMgr.SysConfigParams.Cm2px_y + double.Parse(res.excelTable.Rows[i]["Y"].ToString())), 2),//cm + Width = double.Parse(res.excelTable.Rows[i]["W"].ToString()),//cm + Height = double.Parse(res.excelTable.Rows[i]["H"].ToString()),//cm + ZXD = double.Parse(res.excelTable.Rows[i]["置信度"].ToString()), + Contrast = double.Parse(res.excelTable.Rows[i]["对比度"].ToString()), + Target = int.Parse(res.excelTable.Rows[i]["目标"].ToString()), + image = BitmapConverter.ToBitmap(res.lstDefectBmp[i]) + }; + defectInfo.ModifyUserCode = defectInfo.CreateUserCode = res.record.CreateUserCode; + step = 6 + i * 10; + res.record.DefectInfoList.Add(defectInfo); + defectInfo.uid = preTicks++;// res.record.DefectInfoList.Count;//程序中的唯一索引,用于移除用索引 + //AddTextEvent(DateTime.Now,$"打标完成", $"第{i}个缺陷:{ JsonConvert.SerializeObject(defectInfo)}; Y={res.photoIndex * res.bmp.Height * 1.0d / Config.cm2px_y}+{res.excelTable.Rows[i]["Y"].ToString()}"); + step = 7 + i * 10; + //保存打标小图 + if (confMgr.SysConfigParams.DefectSmallImag.AutoSave) + { + dirPath = Util.CreateSubDir(confMgr.SysConfigParams.DefectSmallImag.SavePath, new List { $"{res.record.BatchId}_{res.record.ReelId}" }); + string filename = $"{dirPath}{res.photoIndex}_X{defectInfo.X}_Y{defectInfo.Y}_W{defectInfo.Width}_H{defectInfo.Height}_目标{defectInfo.Target}_类别{defectInfo.Code}_置信度{defectInfo.ZXD}.jpg"; + OpenCvSharp.Extensions.BitmapConverter.ToBitmap(res.lstDefectBmp[i]).Save(filename, ImageFormat.Jpeg); + defectInfo.TagFilePath = filename; + } + step = 8 + i * 10; + + res.lstDefectBmp[i].Dispose(); + dataRowlist.Add(new object[]{ defectInfo.uid,defectInfo.Code, defectInfo.PhotoIndex,defectInfo.Name, + defectInfo.CentreX, defectInfo.CentreY / 100,defectInfo.Width * 10,defectInfo.Height * 10, defectInfo.Area * 100, defectInfo.ZXD, defectInfo.Contrast}); + + step = 9 + i * 10; + //告警判断???在此还是在收到新照片时触发??? + if (res.record.ProductInfo.DefectAreaLimit > 0 && defectInfo.Area >= res.record.ProductInfo.DefectAreaLimit) + { + Log($"告警", $"瑕疵面积达到阈值!({defectInfo.Area}>={res.record.ProductInfo.DefectAreaLimit})", WarningEnum.High); + } + } + Log($"检测完成", "更新UI"); + //更新UI + int bmpHeight = res.bmp.Height; + //显示图片 + //OnAutoRuning(new RunEventArgs(defectInfo.image)); + //显示瑕疵图 + OnAutoRuning(new RunEventArgs(dataRowlist)); + + step = 9; + Log($"检测完成", "保存CSV"); + //保存CSV + dirPath = Util.CreateSubDir(confMgr.SysConfigParams.DefectSrcImag.SavePath, new List { $"{res.record.BatchId}_{res.record.ReelId}" }); + bool b = Utils.ExcelUtil.DataTable2CSV($"{dirPath}{res.photoIndex}.csv", res.excelTable); + //AddTextEvent(DateTime.Now,$"打标完成", $"{res.tag}.xlsx {(b ? "保存成功!" : "保存失败!")}"); + step = 10; + + //每百米告警判断???在此还是在收到新照片时触发??? + if (res.record.ProductInfo.DefectCountLimit > 0 && res.record.DefectTotalCount >= res.record.ProductInfo.DefectCountLimit) + { + int compLen = 100 * 100;//每百米 to cm + int compCount = compLen * confMgr.SysConfigParams.Cm2px_y / res.bmp.Height; + //从上次告警后重新开始计算长度及数量 + int defectCount = res.record.DefectInfoList.Where(m => m.PhotoIndex >= res.record.preWarningPhotoIndex && m.PhotoIndex >= res.photoIndex + 1 - compCount).Count(); + if (defectCount >= res.record.ProductInfo.DefectCountLimit) + { + res.record.preWarningPhotoIndex = res.photoIndex + 1; + Log($"告警", $"每百米瑕疵数量达到阈值!({defectCount}>={res.record.ProductInfo.DefectCountLimit})", WarningEnum.High); + } + step = 11; + //按缺陷计算没X米多少缺陷报警 + for (int i = 0; i < res.record.ProductInfo.QualifiedLimitList.Count; i++) + { + var defectWarn = res.record.ProductInfo.QualifiedLimitList[i]; + if (defectWarn.DefectWarnLength > 0 || defectWarn.DefectWarnCnt > 0) + { + step = 12; + int warnLen = defectWarn.DefectWarnLength * 100;//每百米 to cm + int warnCount = warnLen * confMgr.SysConfigParams.Cm2px_y / res.bmp.Height; + //从上次告警后重新开始计算长度及数量 + int warnDefectCount = res.record.DefectInfoList.Where(m => m.PhotoIndex >= res.record.preWarningPhotoIndexByLabel[i] && m.PhotoIndex >= res.photoIndex + 1 - warnCount).Count(); + if (warnDefectCount >= defectWarn.DefectWarnCnt) + { + res.record.preWarningPhotoIndexByLabel[i] = res.photoIndex + 1; + Log($"告警{Thread.CurrentThread.ManagedThreadId}", $"每{defectWarn.DefectWarnLength}米{GetDefectName(defectWarn.Code)}瑕疵数量达到阈值!({warnDefectCount}>={defectWarn.DefectWarnCnt})", WarningEnum.High); + } + } + } + } + } + + } + else + { + Log($"打标失败", $"(图像{res.photoIndex})-瑕疵检测失败", WarningEnum.Low); + } + res.bmp.Dispose(); + res.bmpTag.Dispose(); + res.bmps_cut = null; + res.excelTable.Dispose(); + } + catch (Exception ex) + { + Log($"打标失败", $"(图像{res.photoIndex})-瑕疵检测异常({step}):{ex.Message}"); + } + finally + { + res.record.ScannerPhotoFinishCount++; + int liScannerPhotoFinishCount = res.record.ScannerPhotoFinishCount; + int liScannerPhotoCount = res.record.ScannerPhotoCount; + Log($"检测完成", $"{liScannerPhotoFinishCount}/{liScannerPhotoCount}"); + //this.BeginInvoke(new System.Action(() => + //{ + // this.lblWaitImageCount.Text = $"{liScannerPhotoCount - liScannerPhotoFinishCount}"; + //})); + res = null; + System.GC.Collect(); + } + } + } + #endregion + + #region 结束验布 + public bool DefectEnd(Form fatherFrm) + { + Log("结束验布", "结束验布!"); + if (confMgr.SysConfigParams.OpenPLC) + { + if (plcDev.IsInit()) + { + plcDev.WriteCoil("DB3.DBX0.0", false);//zt + plcDev.WriteCoil("DB3.DBX0.1", true); + } + else + { + Log("运行", "PLC连接异常!", WarningEnum.High); + return false; + } + } + else if (confMgr.SysConfigParams.OpenIO) + { + ioCardDev.WriteBitState((int)DOName.停止, (int)DOName.停止, true); + Task.Run(async () => + { + await Task.Delay(500); + ioCardDev.WriteBitState((int)DOName.停止, (int)DOName.停止, false); + }); + } + //CurrentState = CurrentStateEnum.初始; + + if (currKey > 0 ) + { + if (FrmDialog.ShowDialog(fatherFrm, $"是否保存当前检测结果?", "提示", true) == DialogResult.OK) + { + string szBatchId, szReelId; + double ldErpLen; + //szBatchId = ; + //szReelId = txtReelId.Text.Trim(); + //ldErpLen = numErpLen.IsEmpty ? 0 : Convert.ToDouble(numErpLen.Text.Trim()); + + int myKey = currKey; + Task.Run(() => { saveCurrRecord(myKey); }); + //resetUIValue(); + + pStopWatch.Stop(); + _isAuto = false; + //this.btnStart.Enabled = true; + //this.btnEnd.Enabled = this.btnPause.Enabled = false;//这里有问题,应该是devPlc回调设置 + OnAutoRuning(new RunEventArgs(_isAuto)); + } + else + { + Log("结束验布", "不保存数据结束验布!"); + return false; + } + } + else + { + Log("结束验布", "无数据结束验布!"); + _isDefect = false; + return false; + } + return true; + } #endregion #region IO解析 @@ -411,11 +1186,6 @@ namespace GeBoShi.SysCtrl ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.三色灯黄灯), GetIOBitIndex((int)DOName.三色灯黄灯), false); ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.三色灯红灯), GetIOBitIndex((int)DOName.三色灯红灯), false); ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.三色灯蜂鸣器), GetIOBitIndex((int)DOName.三色灯蜂鸣器), false); - - ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.启动按钮绿灯), GetIOBitIndex((int)DOName.启动按钮绿灯), false); - ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.复位按钮黄灯), GetIOBitIndex((int)DOName.复位按钮黄灯), false); - ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.停止按钮红灯), GetIOBitIndex((int)DOName.停止按钮红灯), false); - ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.双手启动绿灯), GetIOBitIndex((int)DOName.双手启动绿灯), false); } } /// @@ -429,11 +1199,6 @@ namespace GeBoShi.SysCtrl ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.三色灯黄灯), GetIOBitIndex((int)DOName.三色灯黄灯), false); ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.三色灯红灯), GetIOBitIndex((int)DOName.三色灯红灯), false); ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.三色灯蜂鸣器), GetIOBitIndex((int)DOName.三色灯蜂鸣器), false); - - ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.启动按钮绿灯), GetIOBitIndex((int)DOName.启动按钮绿灯), true); - ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.复位按钮黄灯), GetIOBitIndex((int)DOName.复位按钮黄灯), false); - ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.停止按钮红灯), GetIOBitIndex((int)DOName.停止按钮红灯), false); - ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.双手启动绿灯), GetIOBitIndex((int)DOName.双手启动绿灯), false); } } /// @@ -447,11 +1212,6 @@ namespace GeBoShi.SysCtrl ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.三色灯黄灯), GetIOBitIndex((int)DOName.三色灯黄灯), false); ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.三色灯红灯), GetIOBitIndex((int)DOName.三色灯红灯), true); ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.三色灯蜂鸣器), GetIOBitIndex((int)DOName.三色灯蜂鸣器), false); - - ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.启动按钮绿灯), GetIOBitIndex((int)DOName.启动按钮绿灯), false); - ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.复位按钮黄灯), GetIOBitIndex((int)DOName.复位按钮黄灯), false); - ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.停止按钮红灯), GetIOBitIndex((int)DOName.停止按钮红灯), true); - ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.双手启动绿灯), GetIOBitIndex((int)DOName.双手启动绿灯), false); } } //控制黄灯闪烁 @@ -472,16 +1232,113 @@ namespace GeBoShi.SysCtrl ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.三色灯红灯), GetIOBitIndex((int)DOName.三色灯红灯), false); ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.三色灯蜂鸣器), GetIOBitIndex((int)DOName.三色灯蜂鸣器), false); - ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.启动按钮绿灯), GetIOBitIndex((int)DOName.启动按钮绿灯), false); - ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.复位按钮黄灯), GetIOBitIndex((int)DOName.复位按钮黄灯), val); - ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.停止按钮红灯), GetIOBitIndex((int)DOName.停止按钮红灯), false); - ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.双手启动绿灯), GetIOBitIndex((int)DOName.双手启动绿灯), false); Blink = val; BlinkCnt = 0; } } #endregion + #region 报警等、按钮IO + /// + /// 三色灯报警状态显示 + /// + /// + public bool WarningShowLed(bool DisEnableBuzz) + { + bool sts = false; + if (statusMgr.Warning == WarningEnum.Normal) + { + if (statusMgr.Status == SystemStsEnum.Auto) + ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.三色灯绿灯), GetIOBitIndex((int)DOName.三色灯绿灯), true); + else + ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.三色灯绿灯), GetIOBitIndex((int)DOName.三色灯绿灯), false); + if (statusMgr.Status == SystemStsEnum.Pause) + ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.三色灯红灯), GetIOBitIndex((int)DOName.三色灯红灯), true); + else + ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.三色灯红灯), GetIOBitIndex((int)DOName.三色灯红灯), false); + ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.三色灯蜂鸣器), GetIOBitIndex((int)DOName.三色灯蜂鸣器), false); + BuzzCnt = 0; + //判断黄灯是否需要闪烁,调用200ms一次 + if (Blink) + { + if (BlinkCnt < 3) + ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.三色灯黄灯), GetIOBitIndex((int)DOName.三色灯黄灯), true); + else if (BlinkCnt < 6) + ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.三色灯黄灯), GetIOBitIndex((int)DOName.三色灯黄灯), false); + BlinkCnt++; + if (BlinkCnt == 6) + BlinkCnt = 0; + } + else + ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.三色灯黄灯), GetIOBitIndex((int)DOName.三色灯黄灯), false); + } + if (statusMgr.Warning == WarningEnum.Low) + { + //ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.启动按钮绿灯), GetIOBitIndex((int)DOName.启动按钮绿灯), false); + //ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.停止按钮红灯), GetIOBitIndex((int)DOName.停止按钮红灯), true); + ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.三色灯红灯), GetIOBitIndex((int)DOName.三色灯红灯), true); + //ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.三色灯绿灯), GetIOBitIndex((int)DOName.三色灯绿灯), false); + //sts = true; + } + if (statusMgr.Warning == WarningEnum.High) + { + sts = true; + ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.三色灯红灯), GetIOBitIndex((int)DOName.三色灯红灯), true); + ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.三色灯绿灯), GetIOBitIndex((int)DOName.三色灯绿灯), false); + if (confMgr.SysConfigParams.OpenBuzzer && !DisEnableBuzz) + { + if (BuzzCnt < 3) + ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.三色灯蜂鸣器), GetIOBitIndex((int)DOName.三色灯蜂鸣器), true); + else if (BuzzCnt < 6) + ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.三色灯蜂鸣器), GetIOBitIndex((int)DOName.三色灯蜂鸣器), false); + BuzzCnt++; + if (BuzzCnt == 6) + BuzzCnt = 0; + } + } + return sts; + } + /// + /// 按钮IO检测 + /// + /// + public int ButtonIOTrg(bool DisEnableDoorAlm) + { + int ret = 0; + bool sts; + if (confMgr.SysConfigParams.OpenDoor && !DisEnableDoorAlm) + { + ioCardDev.GetDIBitState(GetIOPortIndex((int)DIName.门磁), GetIOBitIndex((int)DIName.门磁), out sts); + if ((!sts) && (statusMgr.Status == SystemStsEnum.Auto)) + { + Log("暂停", "门磁报警-门打开", WarningEnum.Low); + statusMgr.GotoPause(); + SendStatus(); + ret = 2; + } + } + ioCardDev.GetDIBitState(GetIOPortIndex((int)DIName.暂停按钮), GetIOBitIndex((int)DIName.暂停按钮), out sts); + if (sts) + { + Log("暂停", "手动暂停"); + statusMgr.GotoPause(); + SendStatus(); + ret = 2; + } + ioCardDev.GetDIBitState(GetIOPortIndex((int)DIName.复位按钮), GetIOBitIndex((int)DIName.复位按钮), out sts); + if (sts) + { + ret = 3; + + } + ioCardDev.GetDIBitState(GetIOPortIndex((int)DIName.启动按钮), GetIOBitIndex((int)DIName.启动按钮), out sts); + if (sts) + ret = 1; + + return ret; + } + #endregion + #region 系统关闭 /// /// 关闭 @@ -498,10 +1355,18 @@ namespace GeBoShi.SysCtrl { _mainThread.Join(1000); } - + if (null != _Cam1Thread) + { + _Cam1Thread.Join(1000); + } + if (null != _Cam2Thread) + { + _Cam2Thread.Join(1000); + } //关闭相机 - + LineCamDev1.CloseCamera(); + LineCamDev2.CloseCamera(); //关闭光源 for (int i = 0; i < LightChCount; i++) @@ -563,6 +1428,16 @@ namespace GeBoShi.SysCtrl #endregion #region 硬件字段 + private CamDev _LinecamDev1; + /// + /// io控制卡 + /// + public CamDev LineCamDev1 { get { return _LinecamDev1; } } + private CamDev _LinecamDev2; + /// + /// io控制卡 + /// + public CamDev LineCamDev2 { get { return _LinecamDev2; } } private IOCardDev ioCardDev; /// @@ -578,6 +1453,12 @@ namespace GeBoShi.SysCtrl public string LightName { get { return "Light"; } } public int LightChCount = 6;//美尚4通道,其他6通道 + private PlcDev plcDev; + /// + /// PLC控制 + /// + public PlcDev PlcDev { get { return plcDev; } } + private PrintControl printControl; /// /// 打印机模块 @@ -589,12 +1470,17 @@ namespace GeBoShi.SysCtrl private void InitDev() { ioCardDev = new AdvantechIO(); + + //CpuType.S71200 = 30 + plcDev = new PlcDev(CpuType.S71200, confMgr.SysConfigParams.PLC_IP, (short)confMgr.SysConfigParams.PLC_Rack, (short)confMgr.SysConfigParams.PLC_Solt); + + _LinecamDev1 = new CamDev(CameraEnumType.IKap, confMgr.SysConfigParams.CamIndex_1.ToString(), confMgr.SysConfigParams.CamPath_1, confMgr.SysConfigParams.CamDev_1); + _LinecamDev2 = new CamDev(CameraEnumType.IKap, confMgr.SysConfigParams.CamIndex_2.ToString(), confMgr.SysConfigParams.CamPath_2, confMgr.SysConfigParams.CamDev_2); + if (SysUseLight == LightDevNameEnum.CST) lightDev = new CSTLight(LightName, LightChCount); else - lightDev = new RseeLight(SysUseLight, LightName); - - defectLib = new DefectLib(); + lightDev = new RseeLight(SysUseLight, LightName); } /// /// 初始化硬件 @@ -604,7 +1490,7 @@ namespace GeBoShi.SysCtrl { bool ret = false; InitDev(); - +#if Online //打印机模块初始化 InitLog("打印机模块初始化..."); try @@ -622,7 +1508,11 @@ namespace GeBoShi.SysCtrl { //PLC初始化 InitLog("PLC连接初始化..."); - + if(!plcDev.OpenDev()) + { + InitLog("PLC连接初始化失败!", "初始化", WarningEnum.High); + return ret; + } InitLog("PLC连接成功!"); } if (confMgr.SysConfigParams.OpenIO) @@ -647,6 +1537,32 @@ namespace GeBoShi.SysCtrl InitLog("初始化IO板卡成功!"); } + //相机初始化 + if(!_LinecamDev1.InitCamera()) + { + InitLog("相机1初始化失败!", "初始化", WarningEnum.High); + return ret; + } + if(!_LinecamDev1.OpenCamera()) + { + InitLog("相机1打开失败!", "初始化", WarningEnum.High); + return ret; + } + _LinecamDev1.IsMirrorX = confMgr.SysConfigParams.Cam1_flipX; + _LinecamDev1.IsMirrorY = confMgr.SysConfigParams.Cam1_flipY; + if (!_LinecamDev2.InitCamera()) + { + InitLog("相机2初始化失败!", "初始化", WarningEnum.High); + return ret; + } + if (!_LinecamDev2.OpenCamera()) + { + InitLog("相机2打开失败!", "初始化", WarningEnum.High); + return ret; + } + _LinecamDev2.IsMirrorX = confMgr.SysConfigParams.Cam2_flipX; + _LinecamDev2.IsMirrorY = confMgr.SysConfigParams.Cam2_flipY; + //光源初始化 InitLog("光源控制器初始化..."); int com_num = int.Parse(confMgr.SysConfigParams.LightCom.Remove(0, 3)); @@ -660,8 +1576,8 @@ namespace GeBoShi.SysCtrl for (int i = 0; i < LightChCount; i++) { lightDev.CloseLight(i + 1); - } - + } +#endif ret = true; return ret; } @@ -680,8 +1596,8 @@ namespace GeBoShi.SysCtrl return true; } - #endregion - #endregion +#endregion +#endregion #region 硬盘检测 public static bool CheckDisk(IWin32Window owner, int max = 10) @@ -734,6 +1650,21 @@ namespace GeBoShi.SysCtrl MainRuning(this, e); } } + + /// + /// 流程回调 + /// + /// + /// + public delegate void RunEventHandler(Object sender, RunEventArgs e); + public event RunEventHandler AutoRuning; + protected virtual void OnAutoRuning(RunEventArgs e) + { + if (null != AutoRuning) + { + AutoRuning(this, e); + } + } #endregion #region 加载测试列表 @@ -744,8 +1675,8 @@ namespace GeBoShi.SysCtrl { try { - productCodeList = PdtService.GetList().Select(m => m.Code).ToList(); - productIdList = PdtService.GetList().Select(m => m.Id).ToList(); + productCodeList = PdtService.GetListNav().Select(m => m.Name).ToList(); + productIdList = PdtService.GetListNav().Select(m => m.Id).ToList(); } catch (Exception ex) { @@ -844,46 +1775,477 @@ namespace GeBoShi.SysCtrl } #endregion + + #region 启动 + /// + /// 加载ERP数据库数据 + /// + /// + /// + private DataRow loadErpData(string barCode) + { + var paramList = new List() { + new SugarParameter("@code", barCode) + }; + Stopwatch stopwatch = Stopwatch.StartNew(); + var data = confMgr.execSql(confMgr.SysConfigParams.ErpSql, paramList); + if (data != null && data.Rows.Count < 1) + { + Log("Erp查询结果", $"{barCode}: 时长={stopwatch.ElapsedMilliseconds}ms, 无数据!", WarningEnum.Normal); + return null; + } + + Log("Erp查询结果", $"{barCode}: 时长={stopwatch.ElapsedMilliseconds}ms, {JsonConvert.SerializeObject(data.Rows[0])}", WarningEnum.Normal); + return data.Rows[0]; + } + /// + /// 自动运行 + /// + /// + public bool StartRun(Form fatherFrm, string sn, ref string DefectName, ref string name, ref string batch, ref string reel, ref string cnt) + { + bool ret = true; + + string barCodeName = "", len = "0", batchId = "", reelId = ""; + if(string.IsNullOrEmpty(name)) + name = "未找到"; + //运行前清除过期图片文件 + //DateTime st = DateTime.Now; + DelectPictureFile(); + if ((statusMgr.Status != SystemStsEnum.Standby) && (statusMgr.Status != SystemStsEnum.Pause)) + { + Log("运行", "系统非可运行状态", WarningEnum.Low); + return false; + } + + if (string.IsNullOrEmpty(sn)) + { + Log("运行", "产品条码为空!", WarningEnum.Low); + return false; + } + + //禾欣数据 sn,长度数量, 批号, 卷号 + if (!string.IsNullOrWhiteSpace(confMgr.SysConfigParams.ErpDBConStr) && !string.IsNullOrWhiteSpace(confMgr.SysConfigParams.ErpSql) && !string.IsNullOrWhiteSpace(sn)) + { + Log("扫码", $"产品条码({sn})到ERP查询对应数据...", WarningEnum.Normal); + var rowData = this.loadErpData(sn); + if (rowData == null) + { + Log("扫码", $"产品条码({sn})无对应ERP数据,不做响应!", WarningEnum.High); + return false; + } + + barCodeName = rowData[0].ToString(); + if (rowData.ItemArray.Length > 1) len = rowData[1].ToString(); + if (rowData.ItemArray.Length > 2) batchId = rowData[2].ToString(); + if (rowData.ItemArray.Length > 3) reelId = rowData[3].ToString(); + } + else + barCodeName = sn;//没有ERP对应关系时直接使用条码做为品名 + + //Log("调试", $"time1:{(DateTime.Now - st).Milliseconds}"); + //st = DateTime.Now; + int errStep = 0; + try + { + Product model; + //禾欣客户使用 + if(confMgr.SysConfigParams.CustomerName == "hexin") + { + errStep = 1; + //SHNY-PX-6-*** + string[] codes = barCodeName.Split(new char[] { '-' }); + if (codes.Length < 4) + { + Log("扫码", $"产品品名({barCodeName})格式错误,不做响应!", WarningEnum.Low); + return false; + } + errStep = 2; + //加载新产品 + string pcode = "1-" + codes[2]; + if (codes[1] == "0" || confMgr.SysConfigParams.SuedeList.Contains(codes[1])) + pcode = "0-" + codes[2]; + model = PdtService.GetModelNav(pcode); //frmProduct.loadProduct(code); + + name = barCodeName; + batch = batchId; + reel = reelId; + cnt = len; + } + else + { + if (string.IsNullOrEmpty(name) || name == "未找到") + { + Log("运行", "产品品名为空!", WarningEnum.Low); + return false; + } + if (string.IsNullOrEmpty(DefectName)) + { + Log("运行", "检测标准未选择!", WarningEnum.Low); + return false; + } + if (string.IsNullOrEmpty(batch)) + { + Log("运行", "批号为空!", WarningEnum.Low); + return false; + } + if (string.IsNullOrEmpty(reel)) + { + Log("运行", "卷号为空!", WarningEnum.Low); + return false; + } + barCodeName = name; + batchId = batch; + reelId = reel; + double t; + cnt = double.TryParse(cnt, out t) ?cnt:"0"; + model = PdtService.GetModelNavByName(DefectName); + } + if (model == null) + { + Log("扫码", $"编码({sn})对应配方不存在,请先添加产品配方设置,暂停设备!", WarningEnum.High); + return false; + } + DefectName = model.Name; + + //数据处理 + Records record; + lock (lockCurrKey) + { + errStep = 3; + //保存,这里队列图片可能还未检测完 + if (currKey > 0) + { + string szBatchId, szReelId; + double ldErpLen; + szBatchId = batch; + szReelId = reel; + ldErpLen = Convert.ToDouble(cnt); + //BatchId = code,//code[2] + //ReelId = "1",//code[3] + int mykey = currKey; + Task.Run(() => { saveCurrRecord(mykey); }); + currKey = 0; + } + + errStep = 4; + var now = DateTime.Now; + currKey = now.Hour * 10000 + now.Minute * 100 + now.Second; + //var materialItem = codes[0]+"-"+ codes[1]; + //var colorItem = Config.getColorItem(int.Parse(codes[2])); + record = new Records() + { + currKey = currKey, + ProductId = model.Id, + ProductInfo = model,//后面计算合格时用 + Color = model.ColorName, + Material = model.Material,//codes[0] + "-" + codes[1],// (materialItem == null ? "未知" : materialItem["name"].ToString()), + BarCode = sn, + BarCodeName = barCodeName, + ErpLen = double.Parse(len), + BatchId = batchId, + ReelId = reelId, + ModifyUserCode = userMgr.LoginUser.Code, + CreateUserCode = userMgr.LoginUser.Code, + }; + htTask.Add(currKey, record); + } + errStep = 8; + // + errStep = 9; + Log("扫码", $"品名({barCodeName}),加载产品信息({model.Code})完成,加载配方(光源={model.LightValue},曝光={model.ExposureTime},增益={model.Gain})..."); + errStep = 10; +#if Online + if (model.LightValue > 0)//光源 - 通道0 + lightDev.SetLightDigitalValue(1, model.LightValue); + errStep = 11; + if (model.ExposureTime > 0 || model.Gain > 0)//相机曝光 增益 + { + LineCamDev1.SetExposure((float)(model.ExposureTime > 0 ? model.ExposureTime : 0)); + LineCamDev1.SetGain((float)(model.Gain > 0 ? model.Gain : 0)); + + LineCamDev2.SetExposure((float)(model.ExposureTime > 0 ? model.ExposureTime : 0)); + LineCamDev2.SetGain((float)(model.Gain > 0 ? model.Gain : 0)); + } +#endif + errStep = 15; + Log("扫码", $"品名({barCodeName}),配方设置完成:光源={model.LightValue},曝光={model.ExposureTime}"); + + Log("启动", "下发启动指令..."); + if (confMgr.SysConfigParams.OpenPLC) + { + if (plcDev.IsInit()) + { + plcDev.WriteCoil("DB3.DBX0.1", false); + plcDev.WriteCoil("DB3.DBX0.0", true);//启动 + } + else + { + Log("运行", "PLC连接异常!", WarningEnum.High); + return false; + } + } + else if (confMgr.SysConfigParams.OpenIO) + { + bool sts; + ioCardDev.GetDIBitState(GetIOPortIndex((int)DIName.暂停按钮), GetIOBitIndex((int)DIName.暂停按钮), out sts); + if (!sts) + { + ioCardDev.WriteBitState((int)DOName.启动, (int)DOName.启动, true); + Task.Run(async () => + { + await Task.Delay(500); + ioCardDev.WriteBitState((int)DOName.启动, (int)DOName.启动, false); + }); + } + else + Log("运行", "存在暂停信号!", WarningEnum.Low); + } + + pStopWatch.Restart(); + _matList1.Clear(); + _matList2.Clear(); + Cam1Cnt = 0; + Cam2Cnt = 0; + + System.GC.Collect(); + errStep = 16; + LedRun(); + _isRuning = true; + _isAuto = true; + statusMgr.GotoAuto(); + SendStatus(); + CurrProductModel = model; + + //获取模型label + GetDefectAllLabel(); + } + catch (Exception ex) + { + Log("运行", $"程序错误-{errStep}:" + ex.Message + "\n", WarningEnum.High); + } + + return ret; + } + /// + /// 暂停重启 + /// + /// + public bool ReStartRun() + { + bool ret = false; + + Log("启动", "下发启动指令..."); + if (confMgr.SysConfigParams.OpenPLC) + { + if (plcDev.IsInit()) + { + plcDev.WriteCoil("DB3.DBX0.1", false); + plcDev.WriteCoil("DB3.DBX0.0", true);//启动 + } + else + { + Log("运行", "PLC连接异常!", WarningEnum.High); + return false; + } + } + else if (confMgr.SysConfigParams.OpenIO) + { + bool sts; + ioCardDev.GetDIBitState(GetIOPortIndex((int)DIName.暂停按钮), GetIOBitIndex((int)DIName.暂停按钮), out sts); + if (!sts) + { + ioCardDev.WriteBitState((int)DOName.启动, (int)DOName.启动, true); + Task.Run(async () => + { + await Task.Delay(500); + ioCardDev.WriteBitState((int)DOName.启动, (int)DOName.启动, false); + }); + } + } + + pStopWatch.Start(); + Log("启动", $"暂停 -> 继续"); + LedRun(); + _isRuning = true; + statusMgr.GotoAuto(); + SendStatus(); + ret = true; + + return ret; + } +#endregion + + #region 文件删除 + public void DelectPictureFile() + { + //删除文件 + Task.Factory.StartNew(() => + { + //图片 + if (confMgr.SysConfigParams.DefectSrcImag.AutoDelete) + statusMgr.DeleteFiles(confMgr.SysConfigParams.DefectSrcImag.SavePath, confMgr.SysConfigParams.DefectSrcImag.AutoDeleteDays, true); + if (confMgr.SysConfigParams.DefectSmallImag.AutoDelete) + statusMgr.DeleteFiles(confMgr.SysConfigParams.DefectSmallImag.SavePath, confMgr.SysConfigParams.DefectSmallImag.AutoDeleteDays, true); + if (confMgr.SysConfigParams.DefectSplicImag.AutoDelete) + statusMgr.DeleteFiles(confMgr.SysConfigParams.DefectSplicImag.SavePath, confMgr.SysConfigParams.DefectSplicImag.AutoDeleteDays, true); + + //日志 + if (confMgr.SysConfigParams.AutoDeleteLog) + statusMgr.DeleteFiles(confMgr.SysConfigParams.LogPath, confMgr.SysConfigParams.AutoDeleteLogData, true); + }); + } + + #region 数据保存 + + private async void saveCurrRecord(int key) + { + Records model = null; + int step = 0; + try + { + _isDefect = true; + Log( "入库", $"准备入库key={key}"); + //foreach (int itemKey in htTask.Keys) + // AddTextEvent(DateTime.Now,"入库", $"htTask {itemKey}"); + + step = 1; + model = Hashtable.Synchronized(htTask)[key] as Records; + //model = htTask[key] as Records; + step = 2; + if (model.Len == 0) + { + _isDefect = false; + return; + } + + //model.BatchId = batchId; + //model.ReelId = reelId; + //model.ErpLen = erpLen; + while (model.ScannerPhotoCount > model.ScannerPhotoFinishCount) + await Task.Delay(100); + step = 3; + //计算等级标准 + List gradeLimitList = model.ProductInfo.GradeLimitList; + if (gradeLimitList != null && gradeLimitList.Count > 0) + { + step = 4; + int count; + foreach (GradeLimit item in gradeLimitList) + { + count = model.DefectInfoList.Where(m => m.Code == item.Code).Count(); + 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;//不合格 + Log("标准判断", $"({key}) 批号({model.BatchId}),标准={(char)(model.Grade + 64)} [{item.Code}:{count};A<={item.A};B<={item.B};C<={item.C};D<={item.D};E<={item.E}]"); + } + step = 5; + } + model.Qualified = (model.Grade < 6);//是否合格 + if (!RecordService.InsertNav(model)) + throw new Exception("写库失败!"); + Log("入库完成", $"({key}) 批号({model.BatchId})已完成检测。"); + htTask.Remove(key); + _isDefect = false; + } + catch (Exception ex) + { + _isDefect = false; + if (model == null) + Log("入库失败", $"记录({key})不存在{step}!" + ex.Message, WarningEnum.High); + else + Log("入库失败", $"({key}) 批号({model.BatchId})检测完成,但保存检测记录失败{step}:" + ex.Message, WarningEnum.High); + } + } + #endregion + + #endregion + + #region 表格事件查询 + public DefectInfo GetDefectInfo(long uid) + { + if (currKey == 0) + return null; + Records record = Hashtable.Synchronized(htTask)[currKey] as Records; + //var defectInfo = record.DefectInfoList[record.DefectInfoList.Count - e.RowIndex-1];//按顺序索引引用 + var defectInfo = record.DefectInfoList.FirstOrDefault(m => m.uid == uid); + return defectInfo; + } + #endregion } #region 系统事件 /// - /// 显图事件 + /// 流程事件 /// - public class ImgEventArgs : EventArgs + public class RunEventArgs : EventArgs { - //private Bitmap[] _bmps; - //public Bitmap[] Bitmaps { get { return _bmps; } } + private int _cmd; + public int Cmd { get { return _cmd; } } - //private Mat[] _bmps_cut; - //public Mat[] Bmps_cut { get { return _bmps_cut; } } + private int _picIndex; + public int PicIndex { get { return _picIndex; } } + private HObject _pic; + public HObject Pic { get { return _pic; } } + public RunEventArgs(int index, HObject pic) + { + this._cmd = 6; + this._picIndex = index; + this._pic = pic.Clone(); + } - //private double _x; - //public double X { get { return _x; } } - //private double _y; - //public double Y { get { return _y; } } + private bool _over; + public bool Over { get { return _over; } } + public RunEventArgs(bool ov) + { + this._cmd = 10; + this._over = ov; + } - //private List[]>> _info; - //public List[]>> Info - //{ - // get { return _info; } - //} + private List _dataRowlist = new List(); + public List DataRowlist { get { return _dataRowlist; } } + public RunEventArgs(List dataRowlist) + { + this._cmd = 11; + this._dataRowlist = dataRowlist; + } - //public ImgEventArgs(Bitmap[] bmps, Mat[] bmps_cut, double Xmm, double Ymm, List[]>> info) - //{ - // this._bmps = new Bitmap[bmps.Length]; - // for (int i = 0; i < bmps.Length; i++) - // { - // this._bmps[i] = (Bitmap)bmps[i].Clone(); - // } - // this._bmps_cut = new Mat[bmps_cut.Length]; - // for (int i = 0; i < bmps_cut.Length; i++) - // { - // this._bmps_cut[i] = bmps_cut[i].Clone(); - // } - // this._x = Xmm; - // this._y = Ymm; - // this._info = info; - //} + private Image _defectimg; + public Image Defectimg { get { return _defectimg; } } + public RunEventArgs(Image defectimg) + { + this._cmd = 12; + this._defectimg = defectimg; + } + + private List _points; + public List Points { get { return _points; } } + public RunEventArgs(List pints) + { + this._cmd = 13; + this._points = pints; + } + + private double _len; + public double Len { get { return _len; } } + private double _speed; + public double Speed { get { return _speed; } } + public RunEventArgs(double len, double spd) + { + this._cmd = 14; + this._len = len; + this._speed = spd; + } + + private Mat _Matimg; + public Mat DefectMat { get { return _Matimg; } } + public RunEventArgs(Mat defectimg) + { + this._cmd = 15; + this._Matimg = defectimg; + } } /// /// 主窗体事件 diff --git a/LeatherProject/GeBoShi/SysCtrl/Utils.cs b/LeatherProject/GeBoShi/SysCtrl/Utils.cs new file mode 100644 index 0000000..0fb5e09 --- /dev/null +++ b/LeatherProject/GeBoShi/SysCtrl/Utils.cs @@ -0,0 +1,213 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.IO; +using System.Linq; +using System.Security.Cryptography; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; + +namespace GeBoShi.SysCtrl +{ + public static class Utils + { + private static Regex RegNumber = new Regex("^[0-9]+$"); //匹配 整数(不可以带正负号) + + private static Regex RegDecimal = new Regex("^(-?\\d+)(\\.\\d+)?$"); //浮点 (可以带正负号) + + public static bool IsDecimal(object inputData) + { + if (inputData == null) return false; + Match m = RegDecimal.Match(inputData.ToString()); + return m.Success; + } + + public static bool IsNumber(object inputData) + { + if (inputData == null) return false; + Match m = RegNumber.Match(inputData.ToString()); + return m.Success; + } + + private static double ContrastLow = 0.8; + private static double ContrastTop = 1.2; + /// + /// 获取对比度百分比 0-100 对应0.6-1.4 + /// + /// + /// + public static double ContrastToPercent(double val) + { + if (val < ContrastLow) + return 0; + else if (val > ContrastTop) + return 100; + double temp = 100 / (ContrastTop - ContrastLow); + return Math.Round(temp * (val - ContrastLow), 2); + } + public static double PercentToContrast(double val) + { + double tt = 1; + if (val > 100) + tt = 100; + else if (val < 0) + tt = 0; + else + tt = val; + double temp = tt / 100 * (ContrastTop - ContrastLow); + return temp + ContrastLow; + } + public class ExcelUtil + { + public static DataTable ConvertToDataTable(IList data, List lstColName) + { + PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(typeof(T)); + DataTable table = new DataTable(); + foreach (PropertyDescriptor prop in properties) + { + if (lstColName.Contains(prop.Name)) + table.Columns.Add(prop.Name, Nullable.GetUnderlyingType(prop.PropertyType) ?? prop.PropertyType); + } + foreach (T item in data) + { + DataRow row = table.NewRow(); + foreach (PropertyDescriptor prop in properties) + { + if (lstColName.Contains(prop.Name)) + row[prop.Name] = prop.GetValue(item) ?? DBNull.Value; + } + table.Rows.Add(row); + } + return table; + } + public static bool DataTable2CSV(string saveFilePath, System.Data.DataTable dt) + { + //MessageBox.Show(AbosultedFilePath); + System.IO.FileStream fs = new FileStream(saveFilePath, System.IO.FileMode.Create, System.IO.FileAccess.Write); + StreamWriter sw = new StreamWriter(fs, new System.Text.UnicodeEncoding()); + //Tabel header + for (int i = 0; i < dt.Columns.Count; i++) + { + sw.Write(dt.Columns[i].ColumnName); + sw.Write("\t"); + } + sw.WriteLine(""); + //Table body + for (int i = 0; i < dt.Rows.Count; i++) + { + for (int j = 0; j < dt.Columns.Count; j++) + { + sw.Write(DelQuota(dt.Rows[i][j].ToString())); + sw.Write("\t"); + } + sw.WriteLine(""); + } + sw.Flush(); + sw.Close(); + return true; + } + public static string DelQuota(string str) + { + string result = str; + string[] strQuota = { "~", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "`", ";", "'", ",", "/", ":", "/,", "<", ">", "?" };//".", + for (int i = 0; i < strQuota.Length; i++) + { + if (result.IndexOf(strQuota[i]) > -1) + result = result.Replace(strQuota[i], ""); + } + return result; + } + + + //public static bool saveFile(string saveFilePath, DataTable dataTable) + //{ + // try + // { + // //// 创建一个 DataTable 对象来存储数据 + // //DataTable dataTable = new DataTable("MyData"); + // //// 添加列到 DataTable + // //dataTable.Columns.Add("Name", typeof(string)); + // //dataTable.Columns.Add("Age", typeof(int)); + // //// 向 DataTable 中添加数据行 + // //dataTable.Rows.Add("John Doe", 30); + // //dataTable.Rows.Add("Jane Smith", 25); + // // 使用 ClosedXML 组件导出 Excel 文件 + // using (XLWorkbook workbook = new XLWorkbook()) + // { + // IXLWorksheet worksheet = workbook.AddWorksheet("MySheet"); + // int row = 1; //行从1开始 + // for (int i = 0; i < dataTable.Rows.Count; i++) + // { + // for (int j = 0; j < dataTable.Columns.Count; j++) + // { + // if (row == 1)//头标题 + // worksheet.Cell(1, j + 1).Value = dataTable.Columns[j].ColumnName; + + // //内容 + // worksheet.Cell(row + 1, j + 1).Value = dataTable.Rows[i][j].ToString(); + // // 设置单元格样式 + // //worksheet.Cell(row, 2).Style.Font.Bold = true; + // //worksheet.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + + // } + // row++; + // } + // // 将 Excel 文件保存到磁盘 + // //string fileName = @"C:\temp\MyExcelFile.xlsx"; + // workbook.SaveAs(saveFilePath); + // // 释放资源 + // workbook.Dispose(); + // } + // return true; + // } + // catch (Exception ex) + // { + // throw ex; + // } + //} + //public static bool test(string saveFilePath, DataTable dataTable1) + //{ + // try + // { + // // 创建一个 DataTable 对象来存储数据 + // DataTable dataTable = new DataTable("MyData"); + // // 添加列到 DataTable + // dataTable.Columns.Add("Name", typeof(string)); + // dataTable.Columns.Add("Age", typeof(int)); + // // 向 DataTable 中添加数据行 + // dataTable.Rows.Add("John Doe", 30); + // dataTable.Rows.Add("Jane Smith", 25); + // // 使用 ClosedXML 组件导出 Excel 文件 + // using (XLWorkbook workbook = new XLWorkbook()) + // { + // IXLWorksheet worksheet = workbook.AddWorksheet("MySheet"); + // int row = 1; + // foreach (DataRow dataRow in dataTable.Rows) + // { + // worksheet.Cell(row, 1).Value = dataRow["Name"].ToString(); + // worksheet.Cell(row, 2).Value = Convert.ToInt32(dataRow["Age"]); + // // 设置单元格样式 + // worksheet.Cell(row, 2).Style.Font.Bold = true; + // worksheet.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + // row++; + // } + // // 将 Excel 文件保存到磁盘 + // //string fileName = @"C:\temp\MyExcelFile.xlsx"; + // workbook.SaveAs(saveFilePath); + // // 释放资源 + // workbook.Dispose(); + // } + // return true; + // } + // catch (Exception ex) + // { + // return false; + // } + //} + } + } + +} diff --git a/LeatherProject/GeBoShi/UI/Product/ProductInfoFrm.Designer.cs b/LeatherProject/GeBoShi/UI/Product/ProductInfoFrm.Designer.cs index d2d92de..4deea53 100644 --- a/LeatherProject/GeBoShi/UI/Product/ProductInfoFrm.Designer.cs +++ b/LeatherProject/GeBoShi/UI/Product/ProductInfoFrm.Designer.cs @@ -37,6 +37,13 @@ this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.numericUpDown4 = new System.Windows.Forms.NumericUpDown(); + this.numericUpDown3 = new System.Windows.Forms.NumericUpDown(); + this.numericUpDown2 = new System.Windows.Forms.NumericUpDown(); + this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); + this.numStopDis = new System.Windows.Forms.NumericUpDown(); + this.label13 = new System.Windows.Forms.Label(); + this.cbGetHD = new System.Windows.Forms.CheckBox(); this.label9 = new System.Windows.Forms.Label(); this.TrackBarTensionValue = new HZH_Controls.Controls.UCTrackBar(); this.label10 = new System.Windows.Forms.Label(); @@ -46,6 +53,7 @@ this.label12 = new System.Windows.Forms.Label(); this.TrackBarLightValue = new HZH_Controls.Controls.UCTrackBar(); this.groupBox5 = new System.Windows.Forms.GroupBox(); + this.btnColor = new System.Windows.Forms.Button(); this.tbLabelFile = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); this.cmbDefectModelFile = new System.Windows.Forms.ComboBox(); @@ -59,13 +67,15 @@ this.cmbClasses = new System.Windows.Forms.ComboBox(); this.label17 = new System.Windows.Forms.Label(); this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.numericUpDown3 = new System.Windows.Forms.NumericUpDown(); - this.numericUpDown2 = new System.Windows.Forms.NumericUpDown(); - this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); + this.numReelLen = new System.Windows.Forms.NumericUpDown(); + this.label14 = new System.Windows.Forms.Label(); + this.numDefectAreaLimit = new System.Windows.Forms.NumericUpDown(); + this.numDefectCntLength = new System.Windows.Forms.NumericUpDown(); + this.numDefectCountLimit = new System.Windows.Forms.NumericUpDown(); this.btnClearDefect_Path = new System.Windows.Forms.PictureBox(); - this.button1 = new System.Windows.Forms.Button(); - this.textBox4 = new System.Windows.Forms.TextBox(); - this.comboBox1 = new System.Windows.Forms.ComboBox(); + this.btnAddWarn = new System.Windows.Forms.Button(); + this.tbWarnDefect = new System.Windows.Forms.TextBox(); + this.cbDefectName = new System.Windows.Forms.ComboBox(); this.label8 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); @@ -79,16 +89,16 @@ this.DBDL = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.DBDH = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.OrAnd = new System.Windows.Forms.DataGridViewCheckBoxColumn(); + this.DefectLength = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.DefectWarn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.groupBox4 = new System.Windows.Forms.GroupBox(); this.dataGridView2 = new System.Windows.Forms.DataGridView(); this.Code2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.Name2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.A = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.B = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.C = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.D = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.E = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.btnColor = new System.Windows.Forms.Button(); this.toolStrip1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); @@ -96,11 +106,17 @@ this.splitContainer1.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); this.groupBox2.SuspendLayout(); - this.groupBox5.SuspendLayout(); - this.groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numStopDis)).BeginInit(); + this.groupBox5.SuspendLayout(); + this.groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numReelLen)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numDefectAreaLimit)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numDefectCntLength)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numDefectCountLimit)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.btnClearDefect_Path)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit(); this.splitContainer2.Panel1.SuspendLayout(); @@ -184,7 +200,7 @@ // this.splitContainer1.Panel2.Controls.Add(this.splitContainer2); this.splitContainer1.Size = new System.Drawing.Size(1224, 554); - this.splitContainer1.SplitterDistance = 327; + this.splitContainer1.SplitterDistance = 379; this.splitContainer1.TabIndex = 40; // // tableLayoutPanel1 @@ -201,7 +217,7 @@ this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.RowCount = 1; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(1224, 327); + this.tableLayoutPanel1.Size = new System.Drawing.Size(1224, 379); this.tableLayoutPanel1.TabIndex = 0; // // groupBox2 @@ -210,6 +226,13 @@ | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.groupBox2.BackColor = System.Drawing.Color.White; + this.groupBox2.Controls.Add(this.numericUpDown4); + this.groupBox2.Controls.Add(this.numericUpDown3); + this.groupBox2.Controls.Add(this.numericUpDown2); + this.groupBox2.Controls.Add(this.numericUpDown1); + this.groupBox2.Controls.Add(this.numStopDis); + this.groupBox2.Controls.Add(this.label13); + this.groupBox2.Controls.Add(this.cbGetHD); this.groupBox2.Controls.Add(this.label9); this.groupBox2.Controls.Add(this.TrackBarTensionValue); this.groupBox2.Controls.Add(this.label10); @@ -224,15 +247,131 @@ this.groupBox2.Margin = new System.Windows.Forms.Padding(2); this.groupBox2.Name = "groupBox2"; this.groupBox2.Padding = new System.Windows.Forms.Padding(2); - this.groupBox2.Size = new System.Drawing.Size(403, 323); + this.groupBox2.Size = new System.Drawing.Size(403, 375); this.groupBox2.TabIndex = 38; this.groupBox2.TabStop = false; this.groupBox2.Text = "参数设置"; // + // numericUpDown4 + // + this.numericUpDown4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.numericUpDown4.Increment = new decimal(new int[] { + 5, + 0, + 0, + 0}); + this.numericUpDown4.Location = new System.Drawing.Point(324, 199); + this.numericUpDown4.Maximum = new decimal(new int[] { + 10000, + 0, + 0, + 0}); + this.numericUpDown4.Name = "numericUpDown4"; + this.numericUpDown4.Size = new System.Drawing.Size(74, 26); + this.numericUpDown4.TabIndex = 66; + this.numericUpDown4.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged); + // + // numericUpDown3 + // + this.numericUpDown3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.numericUpDown3.Increment = new decimal(new int[] { + 5, + 0, + 0, + 0}); + this.numericUpDown3.Location = new System.Drawing.Point(324, 144); + this.numericUpDown3.Maximum = new decimal(new int[] { + 10000, + 0, + 0, + 0}); + this.numericUpDown3.Name = "numericUpDown3"; + this.numericUpDown3.Size = new System.Drawing.Size(74, 26); + this.numericUpDown3.TabIndex = 65; + this.numericUpDown3.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged); + // + // numericUpDown2 + // + this.numericUpDown2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.numericUpDown2.Increment = new decimal(new int[] { + 5, + 0, + 0, + 0}); + this.numericUpDown2.Location = new System.Drawing.Point(324, 89); + this.numericUpDown2.Maximum = new decimal(new int[] { + 10000, + 0, + 0, + 0}); + this.numericUpDown2.Name = "numericUpDown2"; + this.numericUpDown2.Size = new System.Drawing.Size(74, 26); + this.numericUpDown2.TabIndex = 64; + this.numericUpDown2.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged); + // + // numericUpDown1 + // + this.numericUpDown1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.numericUpDown1.Increment = new decimal(new int[] { + 5, + 0, + 0, + 0}); + this.numericUpDown1.Location = new System.Drawing.Point(324, 34); + this.numericUpDown1.Maximum = new decimal(new int[] { + 10000, + 0, + 0, + 0}); + this.numericUpDown1.Name = "numericUpDown1"; + this.numericUpDown1.Size = new System.Drawing.Size(74, 26); + this.numericUpDown1.TabIndex = 63; + this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged); + // + // numStopDis + // + this.numStopDis.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.numStopDis.Increment = new decimal(new int[] { + 5, + 0, + 0, + 0}); + this.numStopDis.Location = new System.Drawing.Point(206, 287); + this.numStopDis.Maximum = new decimal(new int[] { + 10000, + 0, + 0, + 0}); + this.numStopDis.Name = "numStopDis"; + this.numStopDis.Size = new System.Drawing.Size(122, 26); + this.numStopDis.TabIndex = 62; + // + // label13 + // + this.label13.AutoSize = true; + this.label13.Location = new System.Drawing.Point(32, 289); + this.label13.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(145, 20); + this.label13.TabIndex = 56; + this.label13.Text = "厚度检测暂停距离(米)"; + // + // cbGetHD + // + this.cbGetHD.AutoSize = true; + this.cbGetHD.Location = new System.Drawing.Point(36, 248); + this.cbGetHD.Name = "cbGetHD"; + this.cbGetHD.Size = new System.Drawing.Size(140, 24); + this.cbGetHD.TabIndex = 54; + this.cbGetHD.Text = "开启暂停厚度检测"; + this.cbGetHD.UseVisualStyleBackColor = true; + // // label9 // this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(32, 253); + this.label9.Location = new System.Drawing.Point(32, 199); this.label9.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(37, 20); @@ -248,21 +387,22 @@ this.TrackBarTensionValue.IsShowTips = true; this.TrackBarTensionValue.LineColor = System.Drawing.Color.Silver; this.TrackBarTensionValue.LineWidth = 10F; - this.TrackBarTensionValue.Location = new System.Drawing.Point(111, 243); + this.TrackBarTensionValue.Location = new System.Drawing.Point(111, 184); this.TrackBarTensionValue.MaxValue = 999F; this.TrackBarTensionValue.MinValue = 0F; this.TrackBarTensionValue.Name = "TrackBarTensionValue"; - this.TrackBarTensionValue.Size = new System.Drawing.Size(249, 30); + this.TrackBarTensionValue.Size = new System.Drawing.Size(207, 52); this.TrackBarTensionValue.TabIndex = 52; this.TrackBarTensionValue.Text = "ucTrackBar5"; this.TrackBarTensionValue.TipsFormat = null; this.TrackBarTensionValue.Value = 0F; this.TrackBarTensionValue.ValueColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(255))))); + this.TrackBarTensionValue.ValueChanged += new System.EventHandler(this.TrackBarLightValue_ValueChanged); // // label10 // this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(32, 192); + this.label10.Location = new System.Drawing.Point(32, 144); this.label10.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(37, 20); @@ -278,21 +418,22 @@ this.TrackBarGain.IsShowTips = true; this.TrackBarGain.LineColor = System.Drawing.Color.Silver; this.TrackBarGain.LineWidth = 10F; - this.TrackBarGain.Location = new System.Drawing.Point(111, 182); - this.TrackBarGain.MaxValue = 999F; + this.TrackBarGain.Location = new System.Drawing.Point(111, 131); + this.TrackBarGain.MaxValue = 20F; this.TrackBarGain.MinValue = 0F; this.TrackBarGain.Name = "TrackBarGain"; - this.TrackBarGain.Size = new System.Drawing.Size(249, 30); + this.TrackBarGain.Size = new System.Drawing.Size(207, 49); this.TrackBarGain.TabIndex = 50; this.TrackBarGain.Text = "ucTrackBar6"; this.TrackBarGain.TipsFormat = null; this.TrackBarGain.Value = 0F; this.TrackBarGain.ValueColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(255))))); + this.TrackBarGain.ValueChanged += new System.EventHandler(this.TrackBarLightValue_ValueChanged); // // label11 // this.label11.AutoSize = true; - this.label11.Location = new System.Drawing.Point(32, 127); + this.label11.Location = new System.Drawing.Point(32, 89); this.label11.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size(65, 20); @@ -308,21 +449,22 @@ this.TrackBarExposureTime.IsShowTips = true; this.TrackBarExposureTime.LineColor = System.Drawing.Color.Silver; this.TrackBarExposureTime.LineWidth = 10F; - this.TrackBarExposureTime.Location = new System.Drawing.Point(111, 117); - this.TrackBarExposureTime.MaxValue = 10000F; - this.TrackBarExposureTime.MinValue = 3F; + this.TrackBarExposureTime.Location = new System.Drawing.Point(111, 75); + this.TrackBarExposureTime.MaxValue = 1000F; + this.TrackBarExposureTime.MinValue = 0F; this.TrackBarExposureTime.Name = "TrackBarExposureTime"; - this.TrackBarExposureTime.Size = new System.Drawing.Size(249, 30); + this.TrackBarExposureTime.Size = new System.Drawing.Size(207, 52); this.TrackBarExposureTime.TabIndex = 48; this.TrackBarExposureTime.Text = "TrackBarExposureTime"; this.TrackBarExposureTime.TipsFormat = null; - this.TrackBarExposureTime.Value = 50F; + this.TrackBarExposureTime.Value = 0F; this.TrackBarExposureTime.ValueColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(255))))); + this.TrackBarExposureTime.ValueChanged += new System.EventHandler(this.TrackBarLightValue_ValueChanged); // // label12 // this.label12.AutoSize = true; - this.label12.Location = new System.Drawing.Point(32, 68); + this.label12.Location = new System.Drawing.Point(32, 34); this.label12.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label12.Name = "label12"; this.label12.Size = new System.Drawing.Size(65, 20); @@ -338,16 +480,17 @@ this.TrackBarLightValue.IsShowTips = true; this.TrackBarLightValue.LineColor = System.Drawing.Color.Silver; this.TrackBarLightValue.LineWidth = 10F; - this.TrackBarLightValue.Location = new System.Drawing.Point(111, 58); + this.TrackBarLightValue.Location = new System.Drawing.Point(111, 22); this.TrackBarLightValue.MaxValue = 255F; this.TrackBarLightValue.MinValue = 0F; this.TrackBarLightValue.Name = "TrackBarLightValue"; - this.TrackBarLightValue.Size = new System.Drawing.Size(249, 30); + this.TrackBarLightValue.Size = new System.Drawing.Size(207, 50); this.TrackBarLightValue.TabIndex = 46; this.TrackBarLightValue.Text = "ucTrackBar8"; this.TrackBarLightValue.TipsFormat = null; this.TrackBarLightValue.Value = 0F; this.TrackBarLightValue.ValueColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(255))))); + this.TrackBarLightValue.ValueChanged += new System.EventHandler(this.TrackBarLightValue_ValueChanged); // // groupBox5 // @@ -372,17 +515,30 @@ this.groupBox5.Margin = new System.Windows.Forms.Padding(2); this.groupBox5.Name = "groupBox5"; this.groupBox5.Padding = new System.Windows.Forms.Padding(2); - this.groupBox5.Size = new System.Drawing.Size(403, 323); + this.groupBox5.Size = new System.Drawing.Size(403, 375); this.groupBox5.TabIndex = 37; this.groupBox5.TabStop = false; this.groupBox5.Text = "检测标准信息"; // + // btnColor + // + this.btnColor.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnColor.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnColor.BackgroundImage"))); + this.btnColor.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; + this.btnColor.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnColor.Location = new System.Drawing.Point(328, 122); + this.btnColor.Name = "btnColor"; + this.btnColor.Size = new System.Drawing.Size(30, 25); + this.btnColor.TabIndex = 60; + this.btnColor.UseVisualStyleBackColor = true; + this.btnColor.Click += new System.EventHandler(this.btnColor_Click); + // // tbLabelFile // this.tbLabelFile.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.tbLabelFile.Location = new System.Drawing.Point(125, 257); + this.tbLabelFile.Location = new System.Drawing.Point(125, 265); this.tbLabelFile.Margin = new System.Windows.Forms.Padding(2); this.tbLabelFile.Name = "tbLabelFile"; this.tbLabelFile.ReadOnly = true; @@ -392,7 +548,7 @@ // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(54, 260); + this.label3.Location = new System.Drawing.Point(54, 268); this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(65, 20); @@ -513,13 +669,15 @@ // groupBox1 // this.groupBox1.BackColor = System.Drawing.Color.White; - this.groupBox1.Controls.Add(this.numericUpDown3); - this.groupBox1.Controls.Add(this.numericUpDown2); - this.groupBox1.Controls.Add(this.numericUpDown1); + this.groupBox1.Controls.Add(this.numReelLen); + this.groupBox1.Controls.Add(this.label14); + this.groupBox1.Controls.Add(this.numDefectAreaLimit); + this.groupBox1.Controls.Add(this.numDefectCntLength); + this.groupBox1.Controls.Add(this.numDefectCountLimit); this.groupBox1.Controls.Add(this.btnClearDefect_Path); - this.groupBox1.Controls.Add(this.button1); - this.groupBox1.Controls.Add(this.textBox4); - this.groupBox1.Controls.Add(this.comboBox1); + this.groupBox1.Controls.Add(this.btnAddWarn); + this.groupBox1.Controls.Add(this.tbWarnDefect); + this.groupBox1.Controls.Add(this.cbDefectName); this.groupBox1.Controls.Add(this.label8); this.groupBox1.Controls.Add(this.label7); this.groupBox1.Controls.Add(this.label6); @@ -531,98 +689,129 @@ this.groupBox1.Margin = new System.Windows.Forms.Padding(2); this.groupBox1.Name = "groupBox1"; this.groupBox1.Padding = new System.Windows.Forms.Padding(2); - this.groupBox1.Size = new System.Drawing.Size(406, 323); + this.groupBox1.Size = new System.Drawing.Size(406, 375); this.groupBox1.TabIndex = 35; this.groupBox1.TabStop = false; this.groupBox1.Text = "告警配置"; // - // numericUpDown3 + // numReelLen // - this.numericUpDown3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + this.numReelLen.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.numericUpDown3.Location = new System.Drawing.Point(184, 49); - this.numericUpDown3.Maximum = new decimal(new int[] { + this.numReelLen.DecimalPlaces = 2; + this.numReelLen.Location = new System.Drawing.Point(184, 32); + this.numReelLen.Maximum = new decimal(new int[] { 10000, 0, 0, 0}); - this.numericUpDown3.Name = "numericUpDown3"; - this.numericUpDown3.Size = new System.Drawing.Size(122, 26); - this.numericUpDown3.TabIndex = 63; + this.numReelLen.Name = "numReelLen"; + this.numReelLen.Size = new System.Drawing.Size(122, 26); + this.numReelLen.TabIndex = 65; // - // numericUpDown2 + // label14 // - this.numericUpDown2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + this.label14.AutoSize = true; + this.label14.Location = new System.Drawing.Point(26, 34); + this.label14.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label14.Name = "label14"; + this.label14.Size = new System.Drawing.Size(106, 20); + this.label14.TabIndex = 64; + this.label14.Text = "换卷长度提醒m"; + // + // numDefectAreaLimit + // + this.numDefectAreaLimit.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.numericUpDown2.Location = new System.Drawing.Point(184, 108); - this.numericUpDown2.Maximum = new decimal(new int[] { + this.numDefectAreaLimit.DecimalPlaces = 2; + this.numDefectAreaLimit.Location = new System.Drawing.Point(184, 78); + this.numDefectAreaLimit.Maximum = new decimal(new int[] { 10000, 0, 0, 0}); - this.numericUpDown2.Name = "numericUpDown2"; - this.numericUpDown2.Size = new System.Drawing.Size(122, 26); - this.numericUpDown2.TabIndex = 62; + this.numDefectAreaLimit.Name = "numDefectAreaLimit"; + this.numDefectAreaLimit.Size = new System.Drawing.Size(122, 26); + this.numDefectAreaLimit.TabIndex = 63; // - // numericUpDown1 + // numDefectCntLength // - this.numericUpDown1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + this.numDefectCntLength.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.numericUpDown1.Location = new System.Drawing.Point(184, 173); - this.numericUpDown1.Maximum = new decimal(new int[] { + this.numDefectCntLength.DecimalPlaces = 2; + this.numDefectCntLength.Location = new System.Drawing.Point(184, 126); + this.numDefectCntLength.Maximum = new decimal(new int[] { 10000, 0, 0, 0}); - this.numericUpDown1.Name = "numericUpDown1"; - this.numericUpDown1.Size = new System.Drawing.Size(122, 26); - this.numericUpDown1.TabIndex = 61; + this.numDefectCntLength.Name = "numDefectCntLength"; + this.numDefectCntLength.Size = new System.Drawing.Size(122, 26); + this.numDefectCntLength.TabIndex = 62; + // + // numDefectCountLimit + // + this.numDefectCountLimit.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.numDefectCountLimit.Location = new System.Drawing.Point(184, 173); + this.numDefectCountLimit.Maximum = new decimal(new int[] { + 10000, + 0, + 0, + 0}); + this.numDefectCountLimit.Name = "numDefectCountLimit"; + this.numDefectCountLimit.Size = new System.Drawing.Size(122, 26); + this.numDefectCountLimit.TabIndex = 61; // // btnClearDefect_Path // this.btnClearDefect_Path.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btnClearDefect_Path.Image = ((System.Drawing.Image)(resources.GetObject("btnClearDefect_Path.Image"))); - this.btnClearDefect_Path.Location = new System.Drawing.Point(371, 233); + this.btnClearDefect_Path.Location = new System.Drawing.Point(344, 237); this.btnClearDefect_Path.Margin = new System.Windows.Forms.Padding(2); this.btnClearDefect_Path.Name = "btnClearDefect_Path"; this.btnClearDefect_Path.Size = new System.Drawing.Size(21, 19); this.btnClearDefect_Path.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.btnClearDefect_Path.TabIndex = 60; this.btnClearDefect_Path.TabStop = false; + this.btnClearDefect_Path.Click += new System.EventHandler(this.btnClearDefect_Path_Click); // - // button1 + // btnAddWarn // - this.button1.Location = new System.Drawing.Point(290, 266); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(75, 31); - this.button1.TabIndex = 59; - this.button1.Text = "添加"; - this.button1.UseVisualStyleBackColor = true; + this.btnAddWarn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnAddWarn.Location = new System.Drawing.Point(290, 266); + this.btnAddWarn.Name = "btnAddWarn"; + this.btnAddWarn.Size = new System.Drawing.Size(75, 31); + this.btnAddWarn.TabIndex = 59; + this.btnAddWarn.Text = "添加"; + this.btnAddWarn.UseVisualStyleBackColor = true; + this.btnAddWarn.Click += new System.EventHandler(this.btnAddWarn_Click); // - // textBox4 + // tbWarnDefect // - this.textBox4.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + this.tbWarnDefect.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.textBox4.Location = new System.Drawing.Point(123, 233); - this.textBox4.Margin = new System.Windows.Forms.Padding(2); - this.textBox4.Name = "textBox4"; - this.textBox4.ReadOnly = true; - this.textBox4.Size = new System.Drawing.Size(244, 26); - this.textBox4.TabIndex = 58; + this.tbWarnDefect.Location = new System.Drawing.Point(123, 233); + this.tbWarnDefect.Margin = new System.Windows.Forms.Padding(2); + this.tbWarnDefect.Name = "tbWarnDefect"; + this.tbWarnDefect.ReadOnly = true; + this.tbWarnDefect.Size = new System.Drawing.Size(183, 26); + this.tbWarnDefect.TabIndex = 58; // - // comboBox1 + // cbDefectName // - this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.comboBox1.FormattingEnabled = true; - this.comboBox1.Location = new System.Drawing.Point(123, 269); - this.comboBox1.Margin = new System.Windows.Forms.Padding(2); - this.comboBox1.Name = "comboBox1"; - this.comboBox1.Size = new System.Drawing.Size(141, 28); - this.comboBox1.TabIndex = 57; + this.cbDefectName.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbDefectName.FormattingEnabled = true; + this.cbDefectName.Location = new System.Drawing.Point(123, 269); + this.cbDefectName.Margin = new System.Windows.Forms.Padding(2); + this.cbDefectName.Name = "cbDefectName"; + this.cbDefectName.Size = new System.Drawing.Size(141, 28); + this.cbDefectName.TabIndex = 57; // // label8 // @@ -647,7 +836,7 @@ // label6 // this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(26, 110); + this.label6.Location = new System.Drawing.Point(26, 128); this.label6.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(134, 20); @@ -657,7 +846,7 @@ // label5 // this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(26, 51); + this.label5.Location = new System.Drawing.Point(26, 80); this.label5.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(97, 20); @@ -677,7 +866,7 @@ // splitContainer2.Panel2 // this.splitContainer2.Panel2.Controls.Add(this.groupBox4); - this.splitContainer2.Size = new System.Drawing.Size(1224, 223); + this.splitContainer2.Size = new System.Drawing.Size(1224, 171); this.splitContainer2.SplitterDistance = 634; this.splitContainer2.TabIndex = 0; // @@ -692,7 +881,7 @@ this.groupBox3.Margin = new System.Windows.Forms.Padding(2); this.groupBox3.Name = "groupBox3"; this.groupBox3.Padding = new System.Windows.Forms.Padding(2); - this.groupBox3.Size = new System.Drawing.Size(634, 223); + this.groupBox3.Size = new System.Drawing.Size(634, 171); this.groupBox3.TabIndex = 35; this.groupBox3.TabStop = false; this.groupBox3.Text = "检测标准设置"; @@ -709,14 +898,15 @@ this.Area, this.DBDL, this.DBDH, - this.OrAnd}); + this.OrAnd, + this.DefectLength, + this.DefectWarn}); this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill; this.dataGridView1.Location = new System.Drawing.Point(2, 21); this.dataGridView1.Name = "dataGridView1"; - this.dataGridView1.ReadOnly = true; this.dataGridView1.RowTemplate.Height = 23; this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.dataGridView1.Size = new System.Drawing.Size(630, 200); + this.dataGridView1.Size = new System.Drawing.Size(630, 148); this.dataGridView1.TabIndex = 49; // // Code @@ -724,36 +914,46 @@ this.Code.HeaderText = "名称"; this.Code.Name = "Code"; this.Code.ReadOnly = true; + this.Code.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; // // ZXD // this.ZXD.HeaderText = "置信度"; this.ZXD.Name = "ZXD"; - this.ZXD.ReadOnly = true; + this.ZXD.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; // // Area // - this.Area.HeaderText = "面积"; + this.Area.HeaderText = "面积(mm)"; this.Area.Name = "Area"; - this.Area.ReadOnly = true; + this.Area.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; // // DBDL // this.DBDL.HeaderText = "对比度(下限)"; this.DBDL.Name = "DBDL"; - this.DBDL.ReadOnly = true; + this.DBDL.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; // // DBDH // this.DBDH.HeaderText = "对比度(上限)"; this.DBDH.Name = "DBDH"; - this.DBDH.ReadOnly = true; + this.DBDH.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; // // OrAnd // this.OrAnd.HeaderText = "或向选择"; this.OrAnd.Name = "OrAnd"; - this.OrAnd.ReadOnly = true; + // + // DefectLength + // + this.DefectLength.HeaderText = "分布长度(m)"; + this.DefectLength.Name = "DefectLength"; + // + // DefectWarn + // + this.DefectWarn.HeaderText = "报警个数"; + this.DefectWarn.Name = "DefectWarn"; // // groupBox4 // @@ -766,7 +966,7 @@ this.groupBox4.Margin = new System.Windows.Forms.Padding(2); this.groupBox4.Name = "groupBox4"; this.groupBox4.Padding = new System.Windows.Forms.Padding(2); - this.groupBox4.Size = new System.Drawing.Size(586, 223); + this.groupBox4.Size = new System.Drawing.Size(586, 171); this.groupBox4.TabIndex = 36; this.groupBox4.TabStop = false; this.groupBox4.Text = "等级判定"; @@ -779,7 +979,6 @@ this.dataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView2.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.Code2, - this.Name2, this.A, this.B, this.C, @@ -788,70 +987,49 @@ this.dataGridView2.Dock = System.Windows.Forms.DockStyle.Fill; this.dataGridView2.Location = new System.Drawing.Point(2, 21); this.dataGridView2.Name = "dataGridView2"; - this.dataGridView2.ReadOnly = true; this.dataGridView2.RowTemplate.Height = 23; this.dataGridView2.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.dataGridView2.Size = new System.Drawing.Size(582, 200); + this.dataGridView2.Size = new System.Drawing.Size(582, 148); this.dataGridView2.TabIndex = 49; // // Code2 // - this.Code2.HeaderText = "Code"; + this.Code2.HeaderText = "名称"; this.Code2.Name = "Code2"; this.Code2.ReadOnly = true; - this.Code2.Visible = false; - // - // Name2 - // - this.Name2.HeaderText = "名称"; - this.Name2.Name = "Name2"; - this.Name2.ReadOnly = true; + this.Code2.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; // // A // this.A.HeaderText = "A"; this.A.Name = "A"; - this.A.ReadOnly = true; + this.A.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; // // B // this.B.HeaderText = "B"; this.B.Name = "B"; - this.B.ReadOnly = true; + this.B.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; // // C // this.C.HeaderText = "C"; this.C.Name = "C"; - this.C.ReadOnly = true; + this.C.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; // // D // this.D.HeaderText = "D"; this.D.Name = "D"; - this.D.ReadOnly = true; + this.D.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; // // E // this.E.HeaderText = "E"; this.E.Name = "E"; - this.E.ReadOnly = true; this.E.Resizable = System.Windows.Forms.DataGridViewTriState.True; this.E.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; // - // btnColor - // - this.btnColor.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnColor.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnColor.BackgroundImage"))); - this.btnColor.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; - this.btnColor.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.btnColor.Location = new System.Drawing.Point(328, 122); - this.btnColor.Name = "btnColor"; - this.btnColor.Size = new System.Drawing.Size(30, 25); - this.btnColor.TabIndex = 60; - this.btnColor.UseVisualStyleBackColor = true; - this.btnColor.Click += new System.EventHandler(this.btnColor_Click); - // // ProductInfoFrm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); @@ -873,13 +1051,19 @@ this.tableLayoutPanel1.ResumeLayout(false); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numStopDis)).EndInit(); this.groupBox5.ResumeLayout(false); this.groupBox5.PerformLayout(); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numReelLen)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numDefectAreaLimit)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numDefectCntLength)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numDefectCountLimit)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.btnClearDefect_Path)).EndInit(); this.splitContainer2.Panel1.ResumeLayout(false); this.splitContainer2.Panel2.ResumeLayout(false); @@ -928,32 +1112,42 @@ private System.Windows.Forms.Label label4; private System.Windows.Forms.ComboBox cmbClasses; private System.Windows.Forms.Label label17; - private System.Windows.Forms.NumericUpDown numericUpDown3; - private System.Windows.Forms.NumericUpDown numericUpDown2; - private System.Windows.Forms.NumericUpDown numericUpDown1; + private System.Windows.Forms.NumericUpDown numDefectAreaLimit; + private System.Windows.Forms.NumericUpDown numDefectCntLength; + private System.Windows.Forms.NumericUpDown numDefectCountLimit; private System.Windows.Forms.PictureBox btnClearDefect_Path; - private System.Windows.Forms.Button button1; - private System.Windows.Forms.TextBox textBox4; - private System.Windows.Forms.ComboBox comboBox1; + private System.Windows.Forms.Button btnAddWarn; + private System.Windows.Forms.TextBox tbWarnDefect; + private System.Windows.Forms.ComboBox cbDefectName; private System.Windows.Forms.Label label8; private System.Windows.Forms.Label label7; private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label5; private System.Windows.Forms.DataGridView dataGridView1; + private System.Windows.Forms.DataGridView dataGridView2; + private System.Windows.Forms.Button btnColor; + private System.Windows.Forms.DataGridViewTextBoxColumn Code2; + private System.Windows.Forms.DataGridViewTextBoxColumn A; + private System.Windows.Forms.DataGridViewTextBoxColumn B; + private System.Windows.Forms.DataGridViewTextBoxColumn C; + private System.Windows.Forms.DataGridViewTextBoxColumn D; + private System.Windows.Forms.DataGridViewTextBoxColumn E; + private System.Windows.Forms.CheckBox cbGetHD; + private System.Windows.Forms.Label label13; + private System.Windows.Forms.NumericUpDown numStopDis; private System.Windows.Forms.DataGridViewTextBoxColumn Code; private System.Windows.Forms.DataGridViewTextBoxColumn ZXD; private System.Windows.Forms.DataGridViewTextBoxColumn Area; private System.Windows.Forms.DataGridViewTextBoxColumn DBDL; private System.Windows.Forms.DataGridViewTextBoxColumn DBDH; private System.Windows.Forms.DataGridViewCheckBoxColumn OrAnd; - private System.Windows.Forms.DataGridView dataGridView2; - private System.Windows.Forms.DataGridViewTextBoxColumn Code2; - private System.Windows.Forms.DataGridViewTextBoxColumn Name2; - private System.Windows.Forms.DataGridViewTextBoxColumn A; - private System.Windows.Forms.DataGridViewTextBoxColumn B; - private System.Windows.Forms.DataGridViewTextBoxColumn C; - private System.Windows.Forms.DataGridViewTextBoxColumn D; - private System.Windows.Forms.DataGridViewTextBoxColumn E; - private System.Windows.Forms.Button btnColor; + private System.Windows.Forms.DataGridViewTextBoxColumn DefectLength; + private System.Windows.Forms.DataGridViewTextBoxColumn DefectWarn; + private System.Windows.Forms.NumericUpDown numericUpDown4; + private System.Windows.Forms.NumericUpDown numericUpDown3; + private System.Windows.Forms.NumericUpDown numericUpDown2; + private System.Windows.Forms.NumericUpDown numericUpDown1; + private System.Windows.Forms.NumericUpDown numReelLen; + private System.Windows.Forms.Label label14; } } \ No newline at end of file diff --git a/LeatherProject/GeBoShi/UI/Product/ProductInfoFrm.cs b/LeatherProject/GeBoShi/UI/Product/ProductInfoFrm.cs index 0723a7e..5768e65 100644 --- a/LeatherProject/GeBoShi/UI/Product/ProductInfoFrm.cs +++ b/LeatherProject/GeBoShi/UI/Product/ProductInfoFrm.cs @@ -1,5 +1,7 @@ using GeBoShi.SysCtrl; using HZH_Controls.Controls; +using Models; +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.ComponentModel; @@ -7,9 +9,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 static System.Windows.Forms.VisualStyles.VisualStyleElement; namespace GeBoShi.UI.Product { @@ -34,7 +38,7 @@ namespace GeBoShi.UI.Product dataGridView1.RowHeadersWidth = dataGridView2.RowHeadersWidth = 50; //dataGridView1.ColumnHeadersHeightSizeMode = dataGridView2.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; dataGridView1.RowHeadersWidthSizeMode = dataGridView2.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders;//数据量过百绑定太变 - + dataGridView1.RowTemplate.Height = dataGridView2.RowTemplate.Height = 30; #endregion initData(); @@ -50,11 +54,29 @@ namespace GeBoShi.UI.Product cmbClasses.Text = model.Material; tbColorName.Text = model.ColorName; int[] rgb = new int[3]; - for (int i = 0; i < rgb.Length; i++) - rgb[i] = Convert.ToInt32(model.ColorValue.Split(',')[i]); - tbColorName.ForeColor = Color.FromArgb(rgb[0], rgb[1], rgb[2]); + if (!string.IsNullOrEmpty(model.ColorValue)) + { + for (int i = 0; i < rgb.Length; i++) + rgb[i] = Convert.ToInt32(model.ColorValue.Split(',')[i]); + tbColorName.ForeColor = Color.FromArgb(rgb[0], rgb[1], rgb[2]); + } tbSpec.Text = model.Spec; + + TrackBarLightValue.Value = model.LightValue; + TrackBarExposureTime.Value = (int)model.ExposureTime; + TrackBarGain.Value = (int)model.Gain; + TrackBarTensionValue.Value = (int)model.TensionValue; + + numStopDis.Value = (decimal)model.ThicknessDetectionStopDis; + numReelLen.Value = (decimal)model.residueWarnningLen; + numDefectAreaLimit.Value = (decimal)model.DefectAreaLimit; + numDefectCntLength.Value = (decimal)model.DefectCntLength; + numDefectCountLimit.Value = (decimal)model.DefectCountLimit; + tbWarnDefect.Text = model.WarnDefect; + + cbGetHD.Checked = model.OpenThicknessDetection; + numStopDis.Value = (int)model.ThicknessDetectionStopDis; } } @@ -86,6 +108,22 @@ namespace GeBoShi.UI.Product } if (!string.IsNullOrEmpty(errorStr)) MessageBox.Show("模型缺少词典文件:" + errorStr, "警告"); + + //加载材质 + string configPath = ConfMgr.Instance.ConfigDir + $"\\material.json"; + if (File.Exists(configPath)) + { + string lsTmp = File.ReadAllText(configPath); + JArray defectItemList = JArray.Parse(lsTmp); + cmbClasses.Items.Clear(); + foreach (JObject item in defectItemList) + { + string name = item.Value("name"); + cmbClasses.Items.Add(name); + } + } + else + MessageBox.Show("模型材质文件:" + configPath, "警告"); } private void cmbClasses_SelectedIndexChanged(object sender, EventArgs e) @@ -117,12 +155,179 @@ namespace GeBoShi.UI.Product private void tsbtnSave_Click(object sender, EventArgs e) { + try + { + if (this.cmbClasses.SelectedIndex < 0) throw new Exception("请选择材质!"); + if (string.IsNullOrEmpty(this.txtName.Text)) throw new Exception("请填写名称!"); + if (string.IsNullOrEmpty(this.tbColorName.Text)) throw new Exception("请填写颜色!"); + if (this.cmbDefectModelFile.SelectedIndex < 0) throw new Exception("请选择模型!"); + model.Name = txtName.Text; + model.Material = cmbClasses.Text; + model.ColorName = tbColorName.Text; + model.ModelName = cmbDefectModelFile.Text; + model.Spec = tbSpec.Text; + + model.LightValue = (int)TrackBarLightValue.Value; + model.ExposureTime = (double)TrackBarExposureTime.Value; + model.Gain = (double)TrackBarGain.Value; + model.TensionValue = (double)TrackBarTensionValue.Value; + + model.OpenThicknessDetection = cbGetHD.Checked; + model.ThicknessDetectionStopDis = (int)numStopDis.Value; + + model.DefectAreaLimit = (int)numDefectAreaLimit.Value; + model.DefectCntLength = (double)numDefectCntLength.Value; + model.DefectCountLimit = (int)numDefectCountLimit.Value; + model.WarnDefect = tbWarnDefect.Text; + model.residueWarnningLen = (double)numReelLen.Value; + //缺陷阈值 + if (model.QualifiedLimitList == null) + model.QualifiedLimitList = new List(); + else + model.QualifiedLimitList.Clear(); + QualifiedLimit qualifiedLimit = new QualifiedLimit(); + + string configPath = ConfMgr.Instance.SysConfigParams.AIModelPath + $"\\{tbLabelFile.Text}"; + string lsTmp = File.ReadAllText(configPath); + JArray defectItemList = JArray.Parse(lsTmp); + + for (int i = 0; i < dataGridView1.Rows.Count; i++) + { + string code2 = dataGridView1.Rows[i].Cells["Code"].Value.ToString(); + string nameCode = defectItemList.FirstOrDefault(x => x.Value("code") == code2).Value("name"); + qualifiedLimit = new Models.QualifiedLimit() + { + Code = dataGridView1.Rows[i].Cells["Code"].Value.ToString(), + ZXD = Utils.IsDecimal(dataGridView1.Rows[i].Cells["ZXD"].Value) ? Convert.ToDouble(dataGridView1.Rows[i].Cells["ZXD"].Value) : 0, + Area = Utils.IsDecimal(dataGridView1.Rows[i].Cells["Area"].Value) ? Convert.ToDouble(dataGridView1.Rows[i].Cells["Area"].Value) : 0, + ContrastLower = Utils.IsDecimal(dataGridView1.Rows[i].Cells["DBDL"].Value) ? Utils.PercentToContrast(Convert.ToDouble(dataGridView1.Rows[i].Cells["DBDL"].Value)) : 0, + ContrastTop = Utils.IsDecimal(dataGridView1.Rows[i].Cells["DBDH"].Value) ? Utils.PercentToContrast(Convert.ToDouble(dataGridView1.Rows[i].Cells["DBDH"].Value)) : 0, + IsOR = Convert.ToBoolean(dataGridView1.Rows[i].Cells["OrAnd"].Value), + + NameCode = nameCode, + DefectWarnLength = Utils.IsNumber(dataGridView1.Rows[i].Cells["DefectLength"].Value) ? Convert.ToInt32(dataGridView1.Rows[i].Cells["DefectLength"].Value) : 0, + DefectWarnCnt = Utils.IsDecimal(dataGridView1.Rows[i].Cells["DefectWarn"].Value) ? Convert.ToInt32(dataGridView1.Rows[i].Cells["DefectWarn"].Value) : 0, + + ModifyUserCode = SysMgr.Instance.UserMgr.LoginUser.Code, + CreateUserCode = SysMgr.Instance.UserMgr.LoginUser.Code + }; + if (qualifiedLimit.ContrastLower + qualifiedLimit.ContrastTop > 0 && qualifiedLimit.ContrastTop < qualifiedLimit.ContrastLower) + throw new Exception($"检测标准中第{i + 1}行中对比度上限值({qualifiedLimit.ContrastTop})不可小于下限值({qualifiedLimit.ContrastLower})!"); + model.QualifiedLimitList.Add(qualifiedLimit); + } + //产品等级 + if (model.GradeLimitList == null) + model.GradeLimitList = new List(); + else + model.GradeLimitList.Clear(); + for (int i = 0; i < dataGridView2.Rows.Count; i++) + { + model.GradeLimitList.Add( + new Models.GradeLimit() + { + Code = dataGridView2.Rows[i].Cells["Code2"].Value.ToString(), + A = Utils.IsNumber(dataGridView2.Rows[i].Cells["A"].Value) ? Convert.ToInt32(dataGridView2.Rows[i].Cells["A"].Value) : 0, + B = Utils.IsNumber(dataGridView2.Rows[i].Cells["B"].Value) ? Convert.ToInt32(dataGridView2.Rows[i].Cells["B"].Value) : 0, + C = Utils.IsNumber(dataGridView2.Rows[i].Cells["C"].Value) ? Convert.ToInt32(dataGridView2.Rows[i].Cells["C"].Value) : 0, + D = Utils.IsNumber(dataGridView2.Rows[i].Cells["D"].Value) ? Convert.ToInt32(dataGridView2.Rows[i].Cells["D"].Value) : 0, + E = Utils.IsNumber(dataGridView2.Rows[i].Cells["E"].Value) ? Convert.ToInt32(dataGridView2.Rows[i].Cells["E"].Value) : 0, + ModifyUserCode = SysMgr.Instance.UserMgr.LoginUser.Code, + CreateUserCode = SysMgr.Instance.UserMgr.LoginUser.Code + }); + } + // + model.ModifyUserCode = SysMgr.Instance.UserMgr.LoginUser.Code; + bool result; + if (model.Id == 0) + { + model.CreateUserCode = SysMgr.Instance.UserMgr.LoginUser.Code; + result = service.InsertNav(model); + } + else + { + result = service.UpdateNav(model); + } + if (!result) + throw new Exception("数据保存失败!"); + else + MessageBox.Show("保存成功!", "保存"); + } + catch (Exception ex) + { + MessageBox.Show("保存出错:" + ex.Message, "警告"); + } } private void cmbDefectModelFile_TextChanged(object sender, EventArgs e) { - tbLabelFile.Text = cmbDefectModelFile.Text.Replace(".trt", ".json"); + try + { + tbLabelFile.Text = cmbDefectModelFile.Text.Replace(".trt", ".json"); + //加载缺陷 + string configPath = ConfMgr.Instance.SysConfigParams.AIModelPath + $"\\{tbLabelFile.Text}"; + string lsTmp = File.ReadAllText(configPath); + JArray defectItemList = JArray.Parse(lsTmp); + //加行 + dataGridView1.Rows.Clear(); + dataGridView2.Rows.Clear(); + cbDefectName.Items.Clear(); + foreach (JObject item in defectItemList) + { + string code = item.Value("code"); + string name = item.Value("name"); + //color = item.Value("color"); + dataGridView1.Rows.Add(); + dataGridView1.Rows[dataGridView1.RowCount - 1].HeaderCell.Value = name; + dataGridView1[0, dataGridView1.RowCount - 1].Value = code; + + dataGridView2.Rows.Add(); + dataGridView2.Rows[dataGridView2.RowCount - 1].HeaderCell.Value = name; + dataGridView2[0, dataGridView2.RowCount - 1].Value = code; + + cbDefectName.Items.Add(name); + } + //模型是否是产品模型 + if (model.ModelName == cmbDefectModelFile.Text) + { + //加载参数 + string code; + QualifiedLimit item1; + for (int i = 0; i < dataGridView1.Rows.Count; i++) + { + code = dataGridView1.Rows[i].Cells["Code"].Value.ToString(); + item1 = model.QualifiedLimitList.FirstOrDefault(m => m.Code == code); + if (item1 != null) + { + dataGridView1.Rows[i].Cells["ZXD"].Value = item1.ZXD; + dataGridView1.Rows[i].Cells["Area"].Value = item1.Area; + dataGridView1.Rows[i].Cells["DBDH"].Value = Utils.ContrastToPercent(item1.ContrastTop); + dataGridView1.Rows[i].Cells["DBDL"].Value = Utils.ContrastToPercent(item1.ContrastLower); + dataGridView1.Rows[i].Cells["OrAnd"].Value = item1.IsOR; + dataGridView1.Rows[i].Cells["DefectLength"].Value = item1.DefectWarnLength; + dataGridView1.Rows[i].Cells["DefectWarn"].Value = item1.DefectWarnCnt; + } + } + GradeLimit item2; + for (int i = 0; i < dataGridView2.Rows.Count; i++) + { + code = dataGridView2.Rows[i].Cells["Code2"].Value.ToString(); + item2 = model.GradeLimitList.FirstOrDefault(m => m.Code == code); + if (item2 != null) + { + dataGridView2.Rows[i].Cells["A"].Value = item2.A; + dataGridView2.Rows[i].Cells["B"].Value = item2.B; + dataGridView2.Rows[i].Cells["C"].Value = item2.C; + dataGridView2.Rows[i].Cells["D"].Value = item2.D; + dataGridView2.Rows[i].Cells["E"].Value = item2.E; + } + } + } + } + catch (Exception ex) + { + MessageBox.Show("载入出错:" + ex.Message, "警告"); + } } private void btnColor_Click(object sender, EventArgs e) @@ -137,5 +342,62 @@ namespace GeBoShi.UI.Product tbColorName.ForeColor = selectedColor; } } + + private void btnClearDefect_Path_Click(object sender, EventArgs e) + { + tbWarnDefect.Text = ""; + } + + private void btnAddWarn_Click(object sender, EventArgs e) + { + if(tbWarnDefect.Text == "") + { + tbWarnDefect.Text += cbDefectName.Text; + } + else + tbWarnDefect.Text += $",{cbDefectName.Text}"; + } + + private void TrackBarLightValue_ValueChanged(object sender, EventArgs e) + { + UCTrackBar trackBar = (UCTrackBar)sender; + if(trackBar.Name == "TrackBarLightValue") + { + numericUpDown1.Value = (decimal)trackBar.Value; + } + else if (trackBar.Name == "TrackBarExposureTime") + { + numericUpDown2.Value = (decimal)trackBar.Value; + } + else if (trackBar.Name == "TrackBarGain") + { + numericUpDown3.Value = (decimal)trackBar.Value; + } + else if (trackBar.Name == "TrackBarTensionValue") + { + numericUpDown4.Value = (decimal)trackBar.Value; + } + } + + private void numericUpDown1_ValueChanged(object sender, EventArgs e) + { + NumericUpDown num = (NumericUpDown)sender; + if (num.Name == "numericUpDown1") + { + TrackBarLightValue.Value = (float)num.Value > TrackBarLightValue.MaxValue? TrackBarLightValue.MaxValue : (float)num.Value; + } + else if (num.Name == "numericUpDown2") + { + TrackBarExposureTime.Value = (float)num.Value > TrackBarExposureTime.MaxValue ? TrackBarExposureTime.MaxValue : (float)num.Value; + } + else if (num.Name == "numericUpDown3") + { + TrackBarGain.Value = (float)num.Value > TrackBarGain.MaxValue ? TrackBarGain.MaxValue : (float)num.Value; + } + else if (num.Name == "numericUpDown4") + { + TrackBarTensionValue.Value = (float)num.Value > TrackBarTensionValue.MaxValue ? TrackBarTensionValue.MaxValue : (float)num.Value; + } + } } } diff --git a/LeatherProject/GeBoShi/UI/Product/ProductInfoFrm.resx b/LeatherProject/GeBoShi/UI/Product/ProductInfoFrm.resx index 63e5034..a3a89eb 100644 --- a/LeatherProject/GeBoShi/UI/Product/ProductInfoFrm.resx +++ b/LeatherProject/GeBoShi/UI/Product/ProductInfoFrm.resx @@ -140,6 +140,23 @@ /iY4EZIJDhw19sXw0xxiqQlOgmTCeYGY3xWcAMmE83aHTAF2XzgBkgl2uD1uK4xHAKspnAQpjHhNr/il xRVOhBRCfPyLK5wMaTfWQYSPluECSCHGZ+9ZXEndgKKTwNt1/tHAJlI0sHnsTJIGIh5c7Lq/f9Aa9oDs Z3ZiBQO2fqQo3R8T+TKw9dOPUDZPgkk0emXD9mCFLPsAVd5Z/YQOzbIAAAAASUVORK5CYII= + + + + + iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL + DAAACwwBP0AiyAAAAB90RVh0U29mdHdhcmUATWFjcm9tZWRpYSBGaXJld29ya3MgOLVo0ngAAAJRSURB + VFhHxZfNTsMwEISBtyoXKM3TwIUDTa9U4h8BT8CDAiphd+J118nENlCEpU9q7dmZrZ2mzZ6Mg38mfdN1 + XUTGfpjfBfsDbx06HwVY+Fgujjbt4vR9uTgcCH8DvN+Wi9mmbc4k49h5Q4DuPtvmpVs1nfG5aq530ATC + 4ZV6v5r3gb6QT3zsBU54o+tBzAImsTp4EG/JnIuuF8q2nzORYjvxnSZcePLJPZop2rgDMyYy5HiwE2HQ + UEcfrjXEy9BM1WpBfw1kulU2q+a2ogmEQ0s8DNtVHUnh1HkZ8qnuVBeKffB221VDag1k9PUYY4PCTsj6 + qAlXWwofXk/bBmxCF2ULSztxH0wwEK5zRGvAc1sT83w4UFEwzJ9j2zw67SPTGPAK2kFe8iYSjctbeqmw + NQMePFwZTURqm8hRCFfoZCQ2UThfBmry4QqdTIhNrPLn7IG2HK7QyRGuiex5K9DUhSt0coRrYM1CPdDs + sgEX/swCGdDWNUEnIz8JNyqboJPAhSd/VL4DavNN0MnqcPmqrRW2ZhSaGE1sw9vmiRkafovxmmgMeAXt + IC95g4lgmL+3h3AbVU2Ee0MYMS+G62IwemAGhqyPttTV5o9MvdPa2IAZZG+5LNyw+Yomkp9yLba/ZFes + wJD1qXOM2Dq0xMNAVu/TF71fnBwyoSEFtfd230T2OtJM0fcFhb/lw3Mr4pqYvJ6Gf8unHkxqflIprgl6 + XWmm6CDGEOGrF8h3F+f0k3AjNqFe3luyZB0jEcqD41wfIN8u/uDhVDzDw+m8z+v2vgCLN08Z7ifCRgAA + AABJRU5ErkJggg== @@ -169,23 +186,6 @@ K2cfqLqgmoeQmwnBQPckpQbPu4oKsh9+Tv3Nx3OKr6JkG7ZfcBPBQEMOZXcTB48zIDJnZPldDxkoFd8p oxowUlwRNwPIGMJqMCzeD//pp5k9LCMAZiCMNfDs0V5KtnVxQYA2xgQUPzadTyxcHDCCV2fG51U2fHLl fcD67BdP+ZbfV4mf5xA9xM9zSfoH/G0ZLUBVVuQAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL - DAAACwwBP0AiyAAAAB90RVh0U29mdHdhcmUATWFjcm9tZWRpYSBGaXJld29ya3MgOLVo0ngAAAJRSURB - VFhHxZfNTsMwEISBtyoXKM3TwIUDTa9U4h8BT8CDAiphd+J118nENlCEpU9q7dmZrZ2mzZ6Mg38mfdN1 - XUTGfpjfBfsDbx06HwVY+Fgujjbt4vR9uTgcCH8DvN+Wi9mmbc4k49h5Q4DuPtvmpVs1nfG5aq530ATC - 4ZV6v5r3gb6QT3zsBU54o+tBzAImsTp4EG/JnIuuF8q2nzORYjvxnSZcePLJPZop2rgDMyYy5HiwE2HQ - UEcfrjXEy9BM1WpBfw1kulU2q+a2ogmEQ0s8DNtVHUnh1HkZ8qnuVBeKffB221VDag1k9PUYY4PCTsj6 - qAlXWwofXk/bBmxCF2ULSztxH0wwEK5zRGvAc1sT83w4UFEwzJ9j2zw67SPTGPAK2kFe8iYSjctbeqmw - NQMePFwZTURqm8hRCFfoZCQ2UThfBmry4QqdTIhNrPLn7IG2HK7QyRGuiex5K9DUhSt0coRrYM1CPdDs - sgEX/swCGdDWNUEnIz8JNyqboJPAhSd/VL4DavNN0MnqcPmqrRW2ZhSaGE1sw9vmiRkafovxmmgMeAXt - IC95g4lgmL+3h3AbVU2Ee0MYMS+G62IwemAGhqyPttTV5o9MvdPa2IAZZG+5LNyw+Yomkp9yLba/ZFes - wJD1qXOM2Dq0xMNAVu/TF71fnBwyoSEFtfd230T2OtJM0fcFhb/lw3Mr4pqYvJ6Gf8unHkxqflIprgl6 - XWmm6CDGEOGrF8h3F+f0k3AjNqFe3luyZB0jEcqD41wfIN8u/uDhVDzDw+m8z+v2vgCLN08Z7ifCRgAA - AABJRU5ErkJggg== @@ -206,10 +206,55 @@ True + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + True - + + True + + + True + + + True + + + True + + + True + + True diff --git a/LeatherProject/GeBoShi/UI/SysSet/SysSetFrm.Designer.cs b/LeatherProject/GeBoShi/UI/SysSet/SysSetFrm.Designer.cs index febda9b..92676a4 100644 --- a/LeatherProject/GeBoShi/UI/SysSet/SysSetFrm.Designer.cs +++ b/LeatherProject/GeBoShi/UI/SysSet/SysSetFrm.Designer.cs @@ -110,6 +110,12 @@ this.tbDefectPath = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.skinTabPage6 = new CCWin.SkinControl.SkinTabPage(); + this.groupBox9 = new System.Windows.Forms.GroupBox(); + this.panel10 = new System.Windows.Forms.Panel(); + this.cbMY2 = new System.Windows.Forms.CheckBox(); + this.cbMX2 = new System.Windows.Forms.CheckBox(); + this.cbMY1 = new System.Windows.Forms.CheckBox(); + this.cbMX1 = new System.Windows.Forms.CheckBox(); this.groupBox23 = new System.Windows.Forms.GroupBox(); this.panel23 = new System.Windows.Forms.Panel(); this.tbPdtPath = new System.Windows.Forms.TextBox(); @@ -210,6 +216,8 @@ ((System.ComponentModel.ISupportInitialize)(this.btnClearDefect_Path)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numDefect_Path_AutoClear)).BeginInit(); this.skinTabPage6.SuspendLayout(); + this.groupBox9.SuspendLayout(); + this.panel10.SuspendLayout(); this.groupBox23.SuspendLayout(); this.panel23.SuspendLayout(); this.groupBox14.SuspendLayout(); @@ -264,7 +272,7 @@ this.skinTabControl1.PageNorml = null; this.skinTabControl1.PageNormlTxtColor = System.Drawing.Color.White; this.skinTabControl1.SelectedIndex = 1; - this.skinTabControl1.Size = new System.Drawing.Size(819, 477); + this.skinTabControl1.Size = new System.Drawing.Size(819, 517); this.skinTabControl1.SizeMode = System.Windows.Forms.TabSizeMode.Fixed; this.skinTabControl1.TabIndex = 25; // @@ -278,7 +286,7 @@ this.skinTabPage1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.skinTabPage1.Location = new System.Drawing.Point(0, 36); this.skinTabPage1.Name = "skinTabPage1"; - this.skinTabPage1.Size = new System.Drawing.Size(819, 441); + this.skinTabPage1.Size = new System.Drawing.Size(819, 481); this.skinTabPage1.TabIndex = 0; this.skinTabPage1.TabItemImage = null; this.skinTabPage1.Text = "功能设置"; @@ -334,7 +342,7 @@ this.skinTabPage2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.skinTabPage2.Location = new System.Drawing.Point(0, 36); this.skinTabPage2.Name = "skinTabPage2"; - this.skinTabPage2.Size = new System.Drawing.Size(819, 441); + this.skinTabPage2.Size = new System.Drawing.Size(819, 481); this.skinTabPage2.TabIndex = 1; this.skinTabPage2.TabItemImage = null; this.skinTabPage2.Text = "设备与通信"; @@ -375,11 +383,6 @@ // numCamDev2 // this.numCamDev2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.numCamDev2.Increment = new decimal(new int[] { - 100, - 0, - 0, - 0}); this.numCamDev2.Location = new System.Drawing.Point(373, 9); this.numCamDev2.Maximum = new decimal(new int[] { 1000000000, @@ -405,11 +408,6 @@ // numCamIndex2 // this.numCamIndex2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.numCamIndex2.Increment = new decimal(new int[] { - 100, - 0, - 0, - 0}); this.numCamIndex2.Location = new System.Drawing.Point(103, 9); this.numCamIndex2.Maximum = new decimal(new int[] { 1000000000, @@ -491,11 +489,6 @@ // numCamDev // this.numCamDev.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.numCamDev.Increment = new decimal(new int[] { - 100, - 0, - 0, - 0}); this.numCamDev.Location = new System.Drawing.Point(373, 9); this.numCamDev.Maximum = new decimal(new int[] { 1000000000, @@ -521,11 +514,6 @@ // numCamIndex // this.numCamIndex.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.numCamIndex.Increment = new decimal(new int[] { - 100, - 0, - 0, - 0}); this.numCamIndex.Location = new System.Drawing.Point(103, 9); this.numCamIndex.Maximum = new decimal(new int[] { 1000000000, @@ -791,7 +779,7 @@ this.skinTabPage3.Dock = System.Windows.Forms.DockStyle.Fill; this.skinTabPage3.Location = new System.Drawing.Point(0, 36); this.skinTabPage3.Name = "skinTabPage3"; - this.skinTabPage3.Size = new System.Drawing.Size(819, 441); + this.skinTabPage3.Size = new System.Drawing.Size(819, 481); this.skinTabPage3.TabIndex = 6; this.skinTabPage3.TabItemImage = null; this.skinTabPage3.Text = "云端与MES上传"; @@ -970,7 +958,7 @@ this.skinTabPage4.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.skinTabPage4.Location = new System.Drawing.Point(0, 36); this.skinTabPage4.Name = "skinTabPage4"; - this.skinTabPage4.Size = new System.Drawing.Size(819, 441); + this.skinTabPage4.Size = new System.Drawing.Size(819, 481); this.skinTabPage4.TabIndex = 3; this.skinTabPage4.TabItemImage = null; this.skinTabPage4.Text = "图像保存"; @@ -1335,6 +1323,7 @@ // skinTabPage6 // this.skinTabPage6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(8)))), ((int)(((byte)(31)))), ((int)(((byte)(120))))); + this.skinTabPage6.Controls.Add(this.groupBox9); this.skinTabPage6.Controls.Add(this.groupBox23); this.skinTabPage6.Controls.Add(this.groupBox14); this.skinTabPage6.Controls.Add(this.groupBox13); @@ -1344,11 +1333,90 @@ this.skinTabPage6.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.skinTabPage6.Location = new System.Drawing.Point(0, 36); this.skinTabPage6.Name = "skinTabPage6"; - this.skinTabPage6.Size = new System.Drawing.Size(819, 441); + this.skinTabPage6.Size = new System.Drawing.Size(819, 481); this.skinTabPage6.TabIndex = 5; this.skinTabPage6.TabItemImage = null; this.skinTabPage6.Text = "系统设置"; // + // groupBox9 + // + this.groupBox9.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox9.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(8)))), ((int)(((byte)(31)))), ((int)(((byte)(120))))); + this.groupBox9.Controls.Add(this.panel10); + this.groupBox9.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.groupBox9.ForeColor = System.Drawing.SystemColors.ControlLightLight; + this.groupBox9.Location = new System.Drawing.Point(2, 408); + this.groupBox9.Margin = new System.Windows.Forms.Padding(2); + this.groupBox9.Name = "groupBox9"; + this.groupBox9.Padding = new System.Windows.Forms.Padding(2); + this.groupBox9.Size = new System.Drawing.Size(807, 66); + this.groupBox9.TabIndex = 38; + this.groupBox9.TabStop = false; + this.groupBox9.Text = "相机采图"; + // + // panel10 + // + this.panel10.BackColor = System.Drawing.Color.White; + this.panel10.Controls.Add(this.cbMY2); + this.panel10.Controls.Add(this.cbMX2); + this.panel10.Controls.Add(this.cbMY1); + this.panel10.Controls.Add(this.cbMX1); + this.panel10.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel10.Location = new System.Drawing.Point(2, 16); + this.panel10.Margin = new System.Windows.Forms.Padding(2); + this.panel10.Name = "panel10"; + this.panel10.Size = new System.Drawing.Size(803, 48); + this.panel10.TabIndex = 0; + // + // cbMY2 + // + this.cbMY2.AutoSize = true; + this.cbMY2.ForeColor = System.Drawing.SystemColors.ControlText; + this.cbMY2.Location = new System.Drawing.Point(557, 19); + this.cbMY2.Margin = new System.Windows.Forms.Padding(2); + this.cbMY2.Name = "cbMY2"; + this.cbMY2.Size = new System.Drawing.Size(132, 16); + this.cbMY2.TabIndex = 11; + this.cbMY2.Text = "相机2图像Y方向翻转"; + this.cbMY2.UseVisualStyleBackColor = true; + // + // cbMX2 + // + this.cbMX2.AutoSize = true; + this.cbMX2.ForeColor = System.Drawing.SystemColors.ControlText; + this.cbMX2.Location = new System.Drawing.Point(397, 19); + this.cbMX2.Margin = new System.Windows.Forms.Padding(2); + this.cbMX2.Name = "cbMX2"; + this.cbMX2.Size = new System.Drawing.Size(132, 16); + this.cbMX2.TabIndex = 10; + this.cbMX2.Text = "相机2图像X方向翻转"; + this.cbMX2.UseVisualStyleBackColor = true; + // + // cbMY1 + // + this.cbMY1.AutoSize = true; + this.cbMY1.ForeColor = System.Drawing.SystemColors.ControlText; + this.cbMY1.Location = new System.Drawing.Point(239, 19); + this.cbMY1.Margin = new System.Windows.Forms.Padding(2); + this.cbMY1.Name = "cbMY1"; + this.cbMY1.Size = new System.Drawing.Size(132, 16); + this.cbMY1.TabIndex = 9; + this.cbMY1.Text = "相机1图像Y方向翻转"; + this.cbMY1.UseVisualStyleBackColor = true; + // + // cbMX1 + // + this.cbMX1.AutoSize = true; + this.cbMX1.ForeColor = System.Drawing.SystemColors.ControlText; + this.cbMX1.Location = new System.Drawing.Point(79, 19); + this.cbMX1.Margin = new System.Windows.Forms.Padding(2); + this.cbMX1.Name = "cbMX1"; + this.cbMX1.Size = new System.Drawing.Size(132, 16); + this.cbMX1.TabIndex = 8; + this.cbMX1.Text = "相机1图像X方向翻转"; + this.cbMX1.UseVisualStyleBackColor = true; + // // groupBox23 // this.groupBox23.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) @@ -1867,7 +1935,7 @@ this.skinTabPage8.Dock = System.Windows.Forms.DockStyle.Fill; this.skinTabPage8.Location = new System.Drawing.Point(0, 36); this.skinTabPage8.Name = "skinTabPage8"; - this.skinTabPage8.Size = new System.Drawing.Size(819, 441); + this.skinTabPage8.Size = new System.Drawing.Size(819, 481); this.skinTabPage8.TabIndex = 8; this.skinTabPage8.TabItemImage = null; this.skinTabPage8.Text = "打印设置"; @@ -2218,7 +2286,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(819, 579); + this.ClientSize = new System.Drawing.Size(819, 619); this.Controls.Add(this.skinTabControl1); this.Controls.Add(this.toolStrip1); this.Controls.Add(this.uiTitel1); @@ -2271,6 +2339,9 @@ ((System.ComponentModel.ISupportInitialize)(this.btnClearDefect_Path)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numDefect_Path_AutoClear)).EndInit(); this.skinTabPage6.ResumeLayout(false); + this.groupBox9.ResumeLayout(false); + this.panel10.ResumeLayout(false); + this.panel10.PerformLayout(); this.groupBox23.ResumeLayout(false); this.panel23.ResumeLayout(false); this.panel23.PerformLayout(); @@ -2454,5 +2525,11 @@ private System.Windows.Forms.CheckBox chkSave3; private System.Windows.Forms.CheckBox chkSave2; private System.Windows.Forms.CheckBox chkSave1; + private System.Windows.Forms.GroupBox groupBox9; + private System.Windows.Forms.Panel panel10; + private System.Windows.Forms.CheckBox cbMY1; + private System.Windows.Forms.CheckBox cbMX1; + private System.Windows.Forms.CheckBox cbMY2; + private System.Windows.Forms.CheckBox cbMX2; } } \ No newline at end of file diff --git a/LeatherProject/GeBoShi/UI/SysSet/SysSetFrm.cs b/LeatherProject/GeBoShi/UI/SysSet/SysSetFrm.cs index 83df32d..2c4300a 100644 --- a/LeatherProject/GeBoShi/UI/SysSet/SysSetFrm.cs +++ b/LeatherProject/GeBoShi/UI/SysSet/SysSetFrm.cs @@ -130,6 +130,11 @@ namespace GeBoShi.UI.SysSet tbCloudPassword.Text = ConfMgr.Instance.SysConfigParams.CloudPassword; //////////////////////////////////////// + /// + this.cbMX1.Checked = ConfMgr.Instance.SysConfigParams.Cam1_flipX; + this.cbMY1.Checked = ConfMgr.Instance.SysConfigParams.Cam1_flipY; + this.cbMX2.Checked = ConfMgr.Instance.SysConfigParams.Cam2_flipX; + this.cbMY2.Checked = ConfMgr.Instance.SysConfigParams.Cam2_flipY; } private void GetParamsSave() @@ -209,6 +214,13 @@ namespace GeBoShi.UI.SysSet configParams.CloudUser = this.tbCloudUser.Text; configParams.CloudPassword = this.tbCloudPassword.Text; /////////////////////////////////////////// + /// + configParams.Cam1_flipX = this.cbMX1.Checked; + configParams.Cam1_flipY = this.cbMY1.Checked; + configParams.Cam2_flipX = this.cbMX2.Checked; + configParams.Cam2_flipY = this.cbMY2.Checked; + + ConfMgr.Instance.WriteSysConfParams(configParams); } diff --git a/LeatherProject/GeBoShi/UI/SysSet/SysSetFrm.resx b/LeatherProject/GeBoShi/UI/SysSet/SysSetFrm.resx index 63baf93..01fd96e 100644 --- a/LeatherProject/GeBoShi/UI/SysSet/SysSetFrm.resx +++ b/LeatherProject/GeBoShi/UI/SysSet/SysSetFrm.resx @@ -255,17 +255,17 @@ iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAJWSURBVFhHvZc9SyNRGIXzI/wBa7OoCGGIO34zfkVIcP2K - YEQWP4ogKggusrCgsbRIodultt5mwcLKwkbE/2BlZScKosjVZ5xXrpOZZJLc2QNnYDL3nnPm3vtOeBP1 - YnLtl5Vd3i698dTJ5G56Z5bu28eyz6lUSgkHHOeF3/pHM0+MGcr9uGRO8Uq1eDL1I51f+2vb9uPg+HcF - F3bLavP4yuXOyY3L4oVyKfc8Wz38544dzxfccGig5cnWxsjcSkef4zxgipiYNEJCoUEYNNH2bMLBQN4k - SLAZEgRtzyYcLFuQgAmi7dmEg0H6/poimpEDsP/TG/tGgrCdaKEZOQAT2TOpAA6RVAGhhLoR91IFUEyZ - yz1j6grgF5bSklCQsUIxwxhi6g/5KUAymfzy9sO1LiJEzD/ZBNH27N8hIVpnds4SR0oJe7fKsYSoCAD+ - Vwh0AgOAsBDdG3+aDlFRBVyq8Wu28BEAtk9tKrunT839LJmpAveiGURhV6GkegaH1GhuyRUV6sHFrGYV - NBIAmjgTTQWwfr9/mIKEo7LhACbMWbmPANXYOTxt1LyiCoJAGVqWddaWnj/XzVsXD9Q3u9s9XLH9F4SZ - y5uLsPH/AlDLXJ9sgp8CiLn+FsI4zCHann04GORfOhNEM3IAVoB9NBEkUhXoYBATOURMgrFWgR8SwC8c - SxUEwR/AJCMFGJ6aveVtgwSaIasYqTEx2ZpBtoGtQbM/PZHxbKqDb8Tk+l55ZDZ/p+8tgfSDqJtAnunn - hSWvuzn1Q9pzWu6w9hzq7TmtfHB7nki8Av1aq01yIVmPAAAAAElFTkSuQmCC + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAJYSURBVFhHvZc9SyNRGIXzI/wBplk/EMIQHb9Wxo+NkKBG + jWAWWXS3CKKC4CLCwuqWW6RQu9TWNoKFlYWNiP/Bymq7RUFclqvPOK9cJzPJJLnjgTMwmXvPOXPvfSe8 + iUYxs7pj5Va2ys88c7KF28G55buOT7l/6XRaCT86zn9+G57IPjJmtPDlijl716rNk2kcmeLqsW3bDyOT + 0wp+/llRG0fXLrdPb13uXSqXcs+zb/sn7tjJYskNhwZanmx9jC987R5ynHtMEROTZkgoNAiDJtqeTTgY + yJsECbZCgqDt2YSDZQsSMEG0PZtwMEjfX1NEM3IA9n92/ZeRIGwnWmhGDsBE9kwqgEMkVUAooW7EvVQB + FFPmcs+YhgL4haW0JBRkrFDMMIaY+kO+CZBKpdqff7jRRYSI+SebINqe/QskRHJu+zxxoJRwcLMSS4iq + AOC9QqATGACEhehfP2w5RFUVcKnFD7nSawDYld9Q9sCQWvheNlMF7kUziMLeUlkNjIyqicKyKyrUg4tZ + 3SpoJgA0cSZaCmD9ePkwBQlHZdMBTJizcq8BarFnbNaoeVUVBIEytCzrvDOzeKGbJ5d+qz673z1csf0X + hJnLm4uw8f8CUM9cn2yCbwKIuf4WwjjMIdqefTgY5F86E0QzcgBWgH00ESRSFehgEBM5REyCsVaBHxLA + LxxLFQTBH8AkIwUYy8//4W2DBFohqxipMTHZmkG2ga1BczgzlfVsaoNvxMzabmV8vvhX31sC6QdRN4E8 + 088LS95wc+qHtOe03GHtOdTbc1r54PY8kXgCvU6rRS9l/GkAAAAASUVORK5CYII= diff --git a/LeatherProject/GeBoShi/bin/Debug/ConfigFiles/Models/best6_0411_bs16.fp16.json b/LeatherProject/GeBoShi/bin/Debug/ConfigFiles/Models/best6_0411_bs16.fp16.json new file mode 100644 index 0000000..8c872ac --- /dev/null +++ b/LeatherProject/GeBoShi/bin/Debug/ConfigFiles/Models/best6_0411_bs16.fp16.json @@ -0,0 +1,74 @@ +[ + { + "id": 0, + "code": "jb", + "name": "浆斑", + "color": "Red" + }, + { + "id": 1, + "code": "wy", + "name": "污印", + "color": "Lime" + }, + { + "id": 2, + "code": "mj", + "name": "棉结", + "color": "DarkViolet" + }, + { + "id": 3, + "code": "hy", + "name": "黄印", + "color": "Magenta" + }, + { + "id": 4, + "code": "lj", + "name": "垃圾", + "color": "Orange" + }, + { + "id": 5, + "code": "yss", + "name": "异色丝", + "color": "Brown" + }, + { + "id": 6, + "code": "zy", + "name": "皱印", + "color": "Olive" + }, + { + "id": 7, + "code": "wc", + "name": "蚊虫", + "color": "PaleGreen" + }, + { + "id": 8, + "code": "cs", + "name": "擦伤", + "color": "CadetBlue" + }, + { + "id": 9, + "code": "cy", + "name": "重影", + "color": "Aqua" + }, + { + "id": 10, + "code": "tcy", + "name": "停车印", + "color": "YellowGreen" + }, + { + "id": 11, + "code": "jt", + "name": "接头", + "color": "Blue" + } +] \ No newline at end of file diff --git a/LeatherProject/GeBoShi/bin/Debug/ConfigFiles/Models/best6_0411_bs16.fp16.trt b/LeatherProject/GeBoShi/bin/Debug/ConfigFiles/Models/best6_0411_bs16.fp16.trt new file mode 100644 index 0000000..d26cbdf Binary files /dev/null and b/LeatherProject/GeBoShi/bin/Debug/ConfigFiles/Models/best6_0411_bs16.fp16.trt differ diff --git a/LeatherProject/GeBoShi/bin/Debug/ConfigFiles/Models/best_0507_bs16.fp16.json b/LeatherProject/GeBoShi/bin/Debug/ConfigFiles/Models/best_0507_bs16.fp16.json new file mode 100644 index 0000000..8c872ac --- /dev/null +++ b/LeatherProject/GeBoShi/bin/Debug/ConfigFiles/Models/best_0507_bs16.fp16.json @@ -0,0 +1,74 @@ +[ + { + "id": 0, + "code": "jb", + "name": "浆斑", + "color": "Red" + }, + { + "id": 1, + "code": "wy", + "name": "污印", + "color": "Lime" + }, + { + "id": 2, + "code": "mj", + "name": "棉结", + "color": "DarkViolet" + }, + { + "id": 3, + "code": "hy", + "name": "黄印", + "color": "Magenta" + }, + { + "id": 4, + "code": "lj", + "name": "垃圾", + "color": "Orange" + }, + { + "id": 5, + "code": "yss", + "name": "异色丝", + "color": "Brown" + }, + { + "id": 6, + "code": "zy", + "name": "皱印", + "color": "Olive" + }, + { + "id": 7, + "code": "wc", + "name": "蚊虫", + "color": "PaleGreen" + }, + { + "id": 8, + "code": "cs", + "name": "擦伤", + "color": "CadetBlue" + }, + { + "id": 9, + "code": "cy", + "name": "重影", + "color": "Aqua" + }, + { + "id": 10, + "code": "tcy", + "name": "停车印", + "color": "YellowGreen" + }, + { + "id": 11, + "code": "jt", + "name": "接头", + "color": "Blue" + } +] \ No newline at end of file diff --git a/LeatherProject/GeBoShi/bin/Debug/ConfigFiles/Models/best_0507_bs16.fp16.trt b/LeatherProject/GeBoShi/bin/Debug/ConfigFiles/Models/best_0507_bs16.fp16.trt new file mode 100644 index 0000000..598f98d Binary files /dev/null and b/LeatherProject/GeBoShi/bin/Debug/ConfigFiles/Models/best_0507_bs16.fp16.trt differ diff --git a/LeatherProject/GeBoShi/bin/Debug/ConfigFiles/SysParamsConfig.ini b/LeatherProject/GeBoShi/bin/Debug/ConfigFiles/SysParamsConfig.ini index 9a9e7fe..f604f0f 100644 --- a/LeatherProject/GeBoShi/bin/Debug/ConfigFiles/SysParamsConfig.ini +++ b/LeatherProject/GeBoShi/bin/Debug/ConfigFiles/SysParamsConfig.ini @@ -3,17 +3,17 @@ SaveAllImg=False [DefectSrcImag] SavePath=D:\Image\DefectSrcImag -AutoSave=True +AutoSave=False AutoDelete=True AutoDeleteDays=3 [DefectSmallImag] SavePath=D:\Image\DefectSmallImag -AutoSave=True +AutoSave=False AutoDelete=True AutoDeleteDays=3 [DefectSplicImag] SavePath=D:\Image\DefectSplicImag -AutoSave=True +AutoSave=False AutoDelete=True AutoDeleteDays=3 [Log] @@ -23,16 +23,18 @@ AutoDeleteDays=0 [SysFunction] OpenBuzzer=True OpenDoor=True +OpenIO=False +OpenPLC=True [Dev] LightCom=COM1 LightComBaud=9600 -IODevName= +IODevName=1111 IOCfgPath=E:\CPL\Ŀ\2023\ﲩʿ\Դ\V1.0\LeatherProject\GeBoShi\bin\Debug\ConfigFiles\IOCard_default.xml [Sys] -AIModelPath=E:\CPL\Ŀ\2023\ﲩʿ\Դ\V1.0\LeatherProject\GeBoShi\bin\Debug\ConfigFiles\Models +AIModelPath=E:\D\Models ProductPath=E:\CPL\Ŀ\2023\ﲩʿ\Դ\V1.0\LeatherProject\GeBoShi\bin\Debug\ConfigFiles\Project [ShowMainWin] -ShowResetBtn=True +ShowResetBtn=False ShowBuzz=False ShowDoorAlm=False [CloudAndMES] @@ -52,3 +54,21 @@ LabelPrinterName= [ExcelPrint] EnableExcelPrint=False ExcelPrinterName= +[ERP] +ErpDBConStr= +ErpSql= +[Customer] +CustomerName= +[FLIP] +Cam1_flipX=False +Cam1_flipY=False +Cam2_flipX=False +Cam2_flipY=False +[CMPX] +Cm2px_x=90 +Cm2px_y=90 +MidCoin=100 +HolePx=100 +LCrop=0 +RCrop=0 +Expand_pixel=50 diff --git a/LeatherProject/GeBoShi/bin/Debug/ConfigFiles/material.json b/LeatherProject/GeBoShi/bin/Debug/ConfigFiles/material.json new file mode 100644 index 0000000..9ce00e9 --- /dev/null +++ b/LeatherProject/GeBoShi/bin/Debug/ConfigFiles/material.json @@ -0,0 +1,20 @@ +[ + { + "id": 0, + "code": "rm", + "name": "绒面", + "color": "Red" + }, + { + "id": 1, + "code": "frm", + "name": "非绒面", + "color": "Lime" + }, + { + "id": 2, + "code": "gh", + "name": "光滑", + "color": "Black" + } +] \ No newline at end of file diff --git a/LeatherProject/GeBoShi/bin/Debug/ConfigFiles/主卡.vlcf b/LeatherProject/GeBoShi/bin/Debug/ConfigFiles/主卡.vlcf new file mode 100644 index 0000000..f73879f --- /dev/null +++ b/LeatherProject/GeBoShi/bin/Debug/ConfigFiles/主卡.vlcf @@ -0,0 +1,132 @@ +[GENERAL] +VLCF_REV =01010025 + +[SIGNAL DESCRIPTION] +PIXEL_DEPTH =24 +SCAN_TYPE =0 +TAP_NUMBER =3 +TAP_ARRANGEMENT =1 +BAYER_PATTERN =0 +PIXEL_CLOCK =80.00 +DATA_VALID_ENABLE =0 +CC1_SOURCE =1 +CC2_SOURCE =0 +CC3_SOURCE =0 +CC4_SOURCE =0 + +[IMAGE] +IMAGE_WIDTH =8190 +IMAGE_HEIGHT =4096 +IMAGE_TYPE =1 + +[IO CONTROL] +GRAB_MODE =0 +INTERNAL_TRIGGER_FREQUENCY =9000.0 +GENERAL_INPUT1_SAMPLE_MODE =0 +GENERAL_INPUT2_SAMPLE_MODE =0 +GENERAL_INPUT1_PROTECT_MODE =0 +GENERAL_INPUT2_PROTECT_MODE =0 +GENERAL_INPUT1_MINIMUM_INTERVAL =1.00 +GENERAL_INPUT2_MINIMUM_INTERVAL =1.00 +SHAFTENCODER1_PULSE_DROP =10 +SHAFTENCODER1_PROTECT_MODE =0 +SHAFTENCODER1_MINIMUM_INTERVAL =1.00 +INTEGRATION_TRIGGER_SOURCE =5 +STROBE_TRIGGER_SOURCE =1 +BOARD_SYNC_OUTPUT1_SOURCE =2 +BOARD_SYNC_OUTPUT2_SOURCE =5 +GRAB_TRIGGER_SOURCE =0 +GENERAL_OUTPUT1_SOURCE =3 +GENERAL_OUTPUT2_SOURCE =6 + +[ADVANCED IO CONTROL] +INTEGRATION_METHOD =0 +INTEGRATION_PARAM1 =0 +INTEGRATION_PARAM2 =5 +INTEGRATION_PARAM3 =0 +INTEGRATION_PARAM4 =1 +INTEGRATION_POLARITY1 =0 +INTEGRATION_POLARITY2 =0 +STROBE_METHOD =0 +STROBE_PARAM1 =0.0 +STROBE_PARAM2 =1.0 +STROBE_PARAM3 =0.0 +STROBE_PARAM4 =1.0 +STROBE_POLARITY1 =0 +GENERALOUTPUT1_POLARITY =0 +GENERALOUTPUT1_DELAY =0.0 +GENERALOUTPUT2_POLARITY =0 +GENERALOUTPUT2_DELAY =0.0 +TIMEOUT =300000 +GENERALINPUT1_TRIGGER_MODE =0 +GENERALINPUT2_TRIGGER_MODE =0 +BOARD_SYNC1_TRIGGER_MODE =0 +BOARD_SYNC2_TRIGGER_MODE =0 +SHAFT_ENCODER_CHANNEL =0 +SHAFT_ENCODER_MULTIPLY_FACTOR =2 +IMAGE_OFFSET_X =0 +GENERAL_INPUT1_POLARITY =0 +GENERAL_INPUT1_MIN_WIDTH =1000 +GENERAL_INPUT2_POLARITY =0 +GENERAL_INPUT2_MIN_WIDTH =1000 +SOFTWARE_TRIGGER_WIDTH =8 +SOFTWARE_TRIGGER_PERIOD =10 +SOFTWARE_TRIGGER_COUNT =1 +SOFTWARE_TRIGGER_DELAY =0 +SOFTWARE_TRIGGER_POLARITY =0 +CHECK_FVAL_SIGNAL =0 +SOFTWARE_TRIGGER_SYNC_MODE =1 +HARDWARE_TRIGGER_GENERAL_INPUT1_DELAY =0 +HARDWARE_TRIGGER_GENERAL_INPUT2_DELAY =0 +IMAGE_ROI_OFFSET_X =0 +CXP_TRIGGER_OUTPUT_SELECTOR =0 +CXP_TEST_IMAGE =0 +SHAFT_ENCODER1_MIN_WIDTH=50 +SHAFT_ENCODER1_VALID_DIRECTION=1 +SHAFT_ENCODER1_REVERSE_COMPENSATION=0 +GRABBER_OUTTER_MODE_FRAME_COUNT=1 +GENERAL_OUTPUT1_THRESHOLD =0 +GENERAL_OUTPUT2_THRESHOLD =0 +SHAFT_ENCODER_DEBOUNCE =2000 +SHAFT_ENCODER_TICK_MODE =0 +SHAFT_ENCODER_TICK_MAX =65535 +SHAFT_ENCODER_TICK_REVERSE_MODE =0 +SHAFT_ENCODER_TICK_REVERSE_MAX =0 +GENERAL_INPUT_THRESHOLD =0 +HARDWARE_TRIGGER_GENERAL_INPUT_DELAY_MODE =1 +HARDWARE_TRIGGER_GENERAL_INPUT1_DELAY_LINES =0 +HARDWARE_TRIGGER_GENERAL_INPUT2_DELAY_LINES =0 +GENERAL_OUTPUT1_SOURCE_CHANNEL =0 +GENERAL_OUTPUT2_SOURCE_CHANNEL =0 +GENERAL_INPUT1_TYPE =1 +GENERAL_INPUT2_TYPE =1 +EXERNAL_LINE_TIMEOUT_FACTOR =256 +SHAFT_ENCODER_QUAD_FREQUENCY_SOURCE_TYPE =0 +LINE_VALID_FILTER =0 +FRAME_ACTIVE_MODE =0 +JPEG_COMPRESS_ENABLE =0 +JPEG_COMPRESS_QUALITY =50 +RECV_INVALID_DATA_IN_FRAME_TRIG_MODE =0 +SHAFT_ENCODER1_REVERSE_COMPENSATION_LIMIT=2000 +FRAME_BURST_COUNT =0 +FRAME_BURST_PERIOD =1000 +SHAFT_ENCODER1_CLOCK_DUTY_TYPE =0 +SHAFT_ENCODER1_CLOCK_DUTY_WIDTH =0 +VALID_COLUMN =0 +SIGNAL_ENHANCE_MODE =3 +LONG_DISTANCE_TRANSMISSION =0 +TRIG_EDGE_MODE =0 +DATA_PACKED_TRANSFER =0 +CXP_TRIG_LEVEL =0 +CL_ENABLE_AUTO_WINDOW =0 +BOARD_SYNC1_POLARITY =0 +BOARD_SYNC2_POLARITY =0 +WATCHDOG_TIMEOUT =1000 +WATCHDOG_OUTPUT_TIME =1000 +MULTIPLE_LIGHT_COUNT =1 +THUMBNAIL_SIZE_FACTOR =0 +RGBD_EXTENDED_MODE =0 +CXP_CAMERA_SYNC_TRIGGER_SOURCE =0 +CXP_CAMERA_SYNC_TRIGGER_SOURCE_CHANNEL =0 +==========================prm_map================================ + \ No newline at end of file diff --git a/LeatherProject/GeBoShi/bin/Debug/ConfigFiles/副卡.vlcf b/LeatherProject/GeBoShi/bin/Debug/ConfigFiles/副卡.vlcf new file mode 100644 index 0000000..96bee7e --- /dev/null +++ b/LeatherProject/GeBoShi/bin/Debug/ConfigFiles/副卡.vlcf @@ -0,0 +1,132 @@ +[GENERAL] +VLCF_REV =01010025 + +[SIGNAL DESCRIPTION] +PIXEL_DEPTH =24 +SCAN_TYPE =0 +TAP_NUMBER =3 +TAP_ARRANGEMENT =1 +BAYER_PATTERN =0 +PIXEL_CLOCK =80.00 +DATA_VALID_ENABLE =0 +CC1_SOURCE =9 +CC2_SOURCE =0 +CC3_SOURCE =0 +CC4_SOURCE =0 + +[IMAGE] +IMAGE_WIDTH =8190 +IMAGE_HEIGHT =4096 +IMAGE_TYPE =1 + +[IO CONTROL] +GRAB_MODE =0 +INTERNAL_TRIGGER_FREQUENCY =9000.0 +GENERAL_INPUT1_SAMPLE_MODE =0 +GENERAL_INPUT2_SAMPLE_MODE =0 +GENERAL_INPUT1_PROTECT_MODE =0 +GENERAL_INPUT2_PROTECT_MODE =0 +GENERAL_INPUT1_MINIMUM_INTERVAL =1.00 +GENERAL_INPUT2_MINIMUM_INTERVAL =1.00 +SHAFTENCODER1_PULSE_DROP =10 +SHAFTENCODER1_PROTECT_MODE =0 +SHAFTENCODER1_MINIMUM_INTERVAL =1.00 +INTEGRATION_TRIGGER_SOURCE =5 +STROBE_TRIGGER_SOURCE =1 +BOARD_SYNC_OUTPUT1_SOURCE =0 +BOARD_SYNC_OUTPUT2_SOURCE =0 +GRAB_TRIGGER_SOURCE =3 +GENERAL_OUTPUT1_SOURCE =6 +GENERAL_OUTPUT2_SOURCE =6 + +[ADVANCED IO CONTROL] +INTEGRATION_METHOD =0 +INTEGRATION_PARAM1 =0 +INTEGRATION_PARAM2 =5 +INTEGRATION_PARAM3 =0 +INTEGRATION_PARAM4 =1 +INTEGRATION_POLARITY1 =0 +INTEGRATION_POLARITY2 =0 +STROBE_METHOD =0 +STROBE_PARAM1 =0.0 +STROBE_PARAM2 =1.0 +STROBE_PARAM3 =0.0 +STROBE_PARAM4 =1.0 +STROBE_POLARITY1 =0 +GENERALOUTPUT1_POLARITY =0 +GENERALOUTPUT1_DELAY =0.0 +GENERALOUTPUT2_POLARITY =0 +GENERALOUTPUT2_DELAY =0.0 +TIMEOUT =300000 +GENERALINPUT1_TRIGGER_MODE =0 +GENERALINPUT2_TRIGGER_MODE =0 +BOARD_SYNC1_TRIGGER_MODE =0 +BOARD_SYNC2_TRIGGER_MODE =0 +SHAFT_ENCODER_CHANNEL =0 +SHAFT_ENCODER_MULTIPLY_FACTOR =2 +IMAGE_OFFSET_X =0 +GENERAL_INPUT1_POLARITY =0 +GENERAL_INPUT1_MIN_WIDTH =1000 +GENERAL_INPUT2_POLARITY =0 +GENERAL_INPUT2_MIN_WIDTH =1000 +SOFTWARE_TRIGGER_WIDTH =8 +SOFTWARE_TRIGGER_PERIOD =10 +SOFTWARE_TRIGGER_COUNT =1 +SOFTWARE_TRIGGER_DELAY =0 +SOFTWARE_TRIGGER_POLARITY =0 +CHECK_FVAL_SIGNAL =0 +SOFTWARE_TRIGGER_SYNC_MODE =1 +HARDWARE_TRIGGER_GENERAL_INPUT1_DELAY =0 +HARDWARE_TRIGGER_GENERAL_INPUT2_DELAY =0 +IMAGE_ROI_OFFSET_X =0 +CXP_TRIGGER_OUTPUT_SELECTOR =0 +CXP_TEST_IMAGE =0 +SHAFT_ENCODER1_MIN_WIDTH=50 +SHAFT_ENCODER1_VALID_DIRECTION=1 +SHAFT_ENCODER1_REVERSE_COMPENSATION=0 +GRABBER_OUTTER_MODE_FRAME_COUNT=1 +GENERAL_OUTPUT1_THRESHOLD =0 +GENERAL_OUTPUT2_THRESHOLD =0 +SHAFT_ENCODER_DEBOUNCE =2000 +SHAFT_ENCODER_TICK_MODE =0 +SHAFT_ENCODER_TICK_MAX =65535 +SHAFT_ENCODER_TICK_REVERSE_MODE =0 +SHAFT_ENCODER_TICK_REVERSE_MAX =0 +GENERAL_INPUT_THRESHOLD =0 +HARDWARE_TRIGGER_GENERAL_INPUT_DELAY_MODE =1 +HARDWARE_TRIGGER_GENERAL_INPUT1_DELAY_LINES =0 +HARDWARE_TRIGGER_GENERAL_INPUT2_DELAY_LINES =0 +GENERAL_OUTPUT1_SOURCE_CHANNEL =0 +GENERAL_OUTPUT2_SOURCE_CHANNEL =0 +GENERAL_INPUT1_TYPE =1 +GENERAL_INPUT2_TYPE =1 +EXERNAL_LINE_TIMEOUT_FACTOR =256 +SHAFT_ENCODER_QUAD_FREQUENCY_SOURCE_TYPE =0 +LINE_VALID_FILTER =0 +FRAME_ACTIVE_MODE =0 +JPEG_COMPRESS_ENABLE =0 +JPEG_COMPRESS_QUALITY =50 +RECV_INVALID_DATA_IN_FRAME_TRIG_MODE =0 +SHAFT_ENCODER1_REVERSE_COMPENSATION_LIMIT=2000 +FRAME_BURST_COUNT =0 +FRAME_BURST_PERIOD =1000 +SHAFT_ENCODER1_CLOCK_DUTY_TYPE =0 +SHAFT_ENCODER1_CLOCK_DUTY_WIDTH =0 +VALID_COLUMN =0 +SIGNAL_ENHANCE_MODE =3 +LONG_DISTANCE_TRANSMISSION =0 +TRIG_EDGE_MODE =0 +DATA_PACKED_TRANSFER =0 +CXP_TRIG_LEVEL =0 +CL_ENABLE_AUTO_WINDOW =0 +BOARD_SYNC1_POLARITY =0 +BOARD_SYNC2_POLARITY =0 +WATCHDOG_TIMEOUT =1000 +WATCHDOG_OUTPUT_TIME =1000 +MULTIPLE_LIGHT_COUNT =1 +THUMBNAIL_SIZE_FACTOR =0 +RGBD_EXTENDED_MODE =0 +CXP_CAMERA_SYNC_TRIGGER_SOURCE =0 +CXP_CAMERA_SYNC_TRIGGER_SOURCE_CHANNEL =0 +==========================prm_map================================ + \ No newline at end of file diff --git a/LeatherProject/GeBoShi/bin/Debug/ErrorLog.txt b/LeatherProject/GeBoShi/bin/Debug/ErrorLog.txt new file mode 100644 index 0000000..43e30be --- /dev/null +++ b/LeatherProject/GeBoShi/bin/Debug/ErrorLog.txt @@ -0,0 +1,50 @@ +2024-04-29 13:30:48 +Global捕获到未处理异常:System.ArgumentException +异常信息:未能找到名为 Code2 的列。 +参数名: columnName +异常堆栈: 在 System.Windows.Forms.DataGridViewCellCollection.get_Item(String columnName) + 在 GeBoShi.UI.Product.ProductInfoFrm.cmbDefectModelFile_TextChanged(Object sender, EventArgs e) 位置 E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\GeBoShi\UI\Product\ProductInfoFrm.cs:行号 287 + 在 System.Windows.Forms.Control.OnTextChanged(EventArgs e) + 在 System.Windows.Forms.ComboBox.OnTextChanged(EventArgs e) + 在 System.Windows.Forms.Control.set_Text(String value) + 在 System.Windows.Forms.ComboBox.set_Text(String value) + 在 System.Windows.Forms.ComboBox.UpdateText() + 在 System.Windows.Forms.ComboBox.set_SelectedIndex(Int32 value) + 在 System.Windows.Forms.ComboBox.set_SelectedItem(Object value) + 在 GeBoShi.UI.Product.ProductInfoFrm..ctor(Product m) 位置 E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\GeBoShi\UI\Product\ProductInfoFrm.cs:行号 50 + 在 GeBoShi.UI.Product.ProductListFrm.dataGridView1_CellDoubleClick(Object sender, DataGridViewCellEventArgs e) 位置 E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\GeBoShi\UI\Product\ProductListFrm.cs:行号 156 + 在 System.Windows.Forms.DataGridView.OnCellDoubleClick(DataGridViewCellEventArgs e) + 在 System.Windows.Forms.DataGridView.OnDoubleClick(EventArgs e) + 在 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) + 在 System.Windows.Forms.Control.WndProc(Message& m) + 在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) + +2024-05-08 15:53:36 +Global捕获到未处理异常:System.ArgumentOutOfRangeException +异常信息:InvalidArgument=“0”的值对于“index”无效。 +参数名: index +异常堆栈: 在 System.Windows.Forms.ComboBox.ObjectCollection.get_Item(Int32 index) + 在 System.Windows.Forms.ComboBox.get_Text() + 在 System.Windows.Forms.ComboBox.WmReflectCommand(Message& m) + 在 System.Windows.Forms.ComboBox.WndProc(Message& m) + 在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) + +2024-05-08 15:53:51 +Global捕获到未处理异常:System.ArgumentOutOfRangeException +异常信息:InvalidArgument=“0”的值对于“index”无效。 +参数名: index +异常堆栈: 在 System.Windows.Forms.ComboBox.ObjectCollection.get_Item(Int32 index) + 在 System.Windows.Forms.ComboBox.get_Text() + 在 GeBoShi.Main.cobList_TextUpdate(Object sender, EventArgs e) 位置 E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\GeBoShi\Main.cs:行号 424 + 在 System.Windows.Forms.ComboBox.OnTextUpdate(EventArgs e) + 在 System.Windows.Forms.ComboBox.WmReflectCommand(Message& m) + 在 System.Windows.Forms.ComboBox.WndProc(Message& m) + 在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) + +2024-05-08 16:01:27 +Global捕获到未处理异常:System.InvalidOperationException +异常信息:集合已修改;可能无法执行枚举操作。 +异常堆栈: 在 System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource) + 在 System.Collections.Generic.List`1.Enumerator.MoveNextRare() + 在 GeBoShi.Main.<>c__DisplayClass40_0.b__0() + diff --git a/LeatherProject/GeBoShi/bin/Debug/GeBoShi.exe.config b/LeatherProject/GeBoShi/bin/Debug/GeBoShi.exe.config index 24f7929..a4b9d2b 100644 --- a/LeatherProject/GeBoShi/bin/Debug/GeBoShi.exe.config +++ b/LeatherProject/GeBoShi/bin/Debug/GeBoShi.exe.config @@ -4,12 +4,30 @@ + + + + + + + + + + + + + + + + + + @@ -22,12 +40,6 @@ - - - - - - diff --git a/LeatherProject/GeBoShi/bin/Debug/Newtonsoft.Json.xml b/LeatherProject/GeBoShi/bin/Debug/Newtonsoft.Json.xml deleted file mode 100644 index 80cb43c..0000000 --- a/LeatherProject/GeBoShi/bin/Debug/Newtonsoft.Json.xml +++ /dev/null @@ -1,11363 +0,0 @@ - - - - Newtonsoft.Json - - - - - Represents a BSON Oid (object id). - - - - - Gets or sets the value of the Oid. - - The value of the Oid. - - - - Initializes a new instance of the class. - - The Oid value. - - - - Represents a reader that provides fast, non-cached, forward-only access to serialized BSON data. - - - - - Gets or sets a value indicating whether binary data reading should be compatible with incorrect Json.NET 3.5 written binary. - - - true if binary data reading will be compatible with incorrect Json.NET 3.5 written binary; otherwise, false. - - - - - Gets or sets a value indicating whether the root object will be read as a JSON array. - - - true if the root object will be read as a JSON array; otherwise, false. - - - - - Gets or sets the used when reading values from BSON. - - The used when reading values from BSON. - - - - Initializes a new instance of the class. - - The containing the BSON data to read. - - - - Initializes a new instance of the class. - - The containing the BSON data to read. - - - - Initializes a new instance of the class. - - The containing the BSON data to read. - if set to true the root object will be read as a JSON array. - The used when reading values from BSON. - - - - Initializes a new instance of the class. - - The containing the BSON data to read. - if set to true the root object will be read as a JSON array. - The used when reading values from BSON. - - - - Reads the next JSON token from the underlying . - - - true if the next token was read successfully; false if there are no more tokens to read. - - - - - Changes the reader's state to . - If is set to true, the underlying is also closed. - - - - - Represents a writer that provides a fast, non-cached, forward-only way of generating BSON data. - - - - - Gets or sets the used when writing values to BSON. - When set to no conversion will occur. - - The used when writing values to BSON. - - - - Initializes a new instance of the class. - - The to write to. - - - - Initializes a new instance of the class. - - The to write to. - - - - Flushes whatever is in the buffer to the underlying and also flushes the underlying stream. - - - - - Writes the end. - - The token. - - - - Writes a comment /*...*/ containing the specified text. - - Text to place inside the comment. - - - - Writes the start of a constructor with the given name. - - The name of the constructor. - - - - Writes raw JSON. - - The raw JSON to write. - - - - Writes raw JSON where a value is expected and updates the writer's state. - - The raw JSON to write. - - - - Writes the beginning of a JSON array. - - - - - Writes the beginning of a JSON object. - - - - - Writes the property name of a name/value pair on a JSON object. - - The name of the property. - - - - Closes this writer. - If is set to true, the underlying is also closed. - If is set to true, the JSON is auto-completed. - - - - - Writes a value. - An error will raised if the value cannot be written as a single JSON token. - - The value to write. - - - - Writes a null value. - - - - - Writes an undefined value. - - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a [] value. - - The [] value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a [] value that represents a BSON object id. - - The Object ID value to write. - - - - Writes a BSON regex. - - The regex pattern. - The regex options. - - - - Specifies how constructors are used when initializing objects during deserialization by the . - - - - - First attempt to use the public default constructor, then fall back to a single parameterized constructor, then to the non-public default constructor. - - - - - Json.NET will use a non-public default constructor before falling back to a parameterized constructor. - - - - - Converts a binary value to and from a base 64 string value. - - - - - Writes the JSON representation of the object. - - The to write to. - The value. - The calling serializer. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The existing value of object being read. - The calling serializer. - The object value. - - - - Determines whether this instance can convert the specified object type. - - Type of the object. - - true if this instance can convert the specified object type; otherwise, false. - - - - - Converts a to and from JSON and BSON. - - - - - Writes the JSON representation of the object. - - The to write to. - The value. - The calling serializer. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The existing value of object being read. - The calling serializer. - The object value. - - - - Determines whether this instance can convert the specified object type. - - Type of the object. - - true if this instance can convert the specified object type; otherwise, false. - - - - - Creates a custom object. - - The object type to convert. - - - - Writes the JSON representation of the object. - - The to write to. - The value. - The calling serializer. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The existing value of object being read. - The calling serializer. - The object value. - - - - Creates an object which will then be populated by the serializer. - - Type of the object. - The created object. - - - - Determines whether this instance can convert the specified object type. - - Type of the object. - - true if this instance can convert the specified object type; otherwise, false. - - - - - Gets a value indicating whether this can write JSON. - - - true if this can write JSON; otherwise, false. - - - - - Converts a to and from JSON. - - - - - Writes the JSON representation of the object. - - The to write to. - The value. - The calling serializer. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The existing value of object being read. - The calling serializer. - The object value. - - - - Determines whether this instance can convert the specified value type. - - Type of the value. - - true if this instance can convert the specified value type; otherwise, false. - - - - - Converts a to and from JSON. - - - - - Writes the JSON representation of the object. - - The to write to. - The value. - The calling serializer. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The existing value of object being read. - The calling serializer. - The object value. - - - - Determines whether this instance can convert the specified value type. - - Type of the value. - - true if this instance can convert the specified value type; otherwise, false. - - - - - Provides a base class for converting a to and from JSON. - - - - - Determines whether this instance can convert the specified object type. - - Type of the object. - - true if this instance can convert the specified object type; otherwise, false. - - - - - Converts a F# discriminated union type to and from JSON. - - - - - Writes the JSON representation of the object. - - The to write to. - The value. - The calling serializer. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The existing value of object being read. - The calling serializer. - The object value. - - - - Determines whether this instance can convert the specified object type. - - Type of the object. - - true if this instance can convert the specified object type; otherwise, false. - - - - - Converts an Entity Framework to and from JSON. - - - - - Writes the JSON representation of the object. - - The to write to. - The value. - The calling serializer. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The existing value of object being read. - The calling serializer. - The object value. - - - - Determines whether this instance can convert the specified object type. - - Type of the object. - - true if this instance can convert the specified object type; otherwise, false. - - - - - Converts an to and from JSON. - - - - - Writes the JSON representation of the object. - - The to write to. - The value. - The calling serializer. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The existing value of object being read. - The calling serializer. - The object value. - - - - Determines whether this instance can convert the specified object type. - - Type of the object. - - true if this instance can convert the specified object type; otherwise, false. - - - - - Gets a value indicating whether this can write JSON. - - - true if this can write JSON; otherwise, false. - - - - - Converts a to and from the ISO 8601 date format (e.g. "2008-04-12T12:53Z"). - - - - - Gets or sets the date time styles used when converting a date to and from JSON. - - The date time styles used when converting a date to and from JSON. - - - - Gets or sets the date time format used when converting a date to and from JSON. - - The date time format used when converting a date to and from JSON. - - - - Gets or sets the culture used when converting a date to and from JSON. - - The culture used when converting a date to and from JSON. - - - - Writes the JSON representation of the object. - - The to write to. - The value. - The calling serializer. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The existing value of object being read. - The calling serializer. - The object value. - - - - Converts a to and from a JavaScript Date constructor (e.g. new Date(52231943)). - - - - - Writes the JSON representation of the object. - - The to write to. - The value. - The calling serializer. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The existing property value of the JSON that is being converted. - The calling serializer. - The object value. - - - - Converts a to and from JSON. - - - - - Writes the JSON representation of the object. - - The to write to. - The value. - The calling serializer. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The existing value of object being read. - The calling serializer. - The object value. - - - - Determines whether this instance can convert the specified object type. - - Type of the object. - - true if this instance can convert the specified object type; otherwise, false. - - - - - Converts a to and from JSON and BSON. - - - - - Writes the JSON representation of the object. - - The to write to. - The value. - The calling serializer. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The existing value of object being read. - The calling serializer. - The object value. - - - - Determines whether this instance can convert the specified object type. - - Type of the object. - - true if this instance can convert the specified object type; otherwise, false. - - - - - Converts an to and from its name string value. - - - - - Gets or sets a value indicating whether the written enum text should be camel case. - The default value is false. - - true if the written enum text will be camel case; otherwise, false. - - - - Gets or sets the naming strategy used to resolve how enum text is written. - - The naming strategy used to resolve how enum text is written. - - - - Gets or sets a value indicating whether integer values are allowed when serializing and deserializing. - The default value is true. - - true if integers are allowed when serializing and deserializing; otherwise, false. - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - true if the written enum text will be camel case; otherwise, false. - - - - Initializes a new instance of the class. - - The naming strategy used to resolve how enum text is written. - true if integers are allowed when serializing and deserializing; otherwise, false. - - - - Initializes a new instance of the class. - - The of the used to write enum text. - - - - Initializes a new instance of the class. - - The of the used to write enum text. - - The parameter list to use when constructing the described by . - If null, the default constructor is used. - When non-null, there must be a constructor defined in the that exactly matches the number, - order, and type of these parameters. - - - - - Initializes a new instance of the class. - - The of the used to write enum text. - - The parameter list to use when constructing the described by . - If null, the default constructor is used. - When non-null, there must be a constructor defined in the that exactly matches the number, - order, and type of these parameters. - - true if integers are allowed when serializing and deserializing; otherwise, false. - - - - Writes the JSON representation of the object. - - The to write to. - The value. - The calling serializer. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The existing value of object being read. - The calling serializer. - The object value. - - - - Determines whether this instance can convert the specified object type. - - Type of the object. - - true if this instance can convert the specified object type; otherwise, false. - - - - - Converts a to and from Unix epoch time - - - - - Gets or sets a value indicating whether the dates before Unix epoch - should converted to and from JSON. - - - true to allow converting dates before Unix epoch to and from JSON; - false to throw an exception when a date being converted to or from JSON - occurred before Unix epoch. The default value is false. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - - true to allow converting dates before Unix epoch to and from JSON; - false to throw an exception when a date being converted to or from JSON - occurred before Unix epoch. The default value is false. - - - - - Writes the JSON representation of the object. - - The to write to. - The value. - The calling serializer. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The existing property value of the JSON that is being converted. - The calling serializer. - The object value. - - - - Converts a to and from a string (e.g. "1.2.3.4"). - - - - - Writes the JSON representation of the object. - - The to write to. - The value. - The calling serializer. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The existing property value of the JSON that is being converted. - The calling serializer. - The object value. - - - - Determines whether this instance can convert the specified object type. - - Type of the object. - - true if this instance can convert the specified object type; otherwise, false. - - - - - Converts XML to and from JSON. - - - - - Gets or sets the name of the root element to insert when deserializing to XML if the JSON structure has produced multiple root elements. - - The name of the deserialized root element. - - - - Gets or sets a value to indicate whether to write the Json.NET array attribute. - This attribute helps preserve arrays when converting the written XML back to JSON. - - true if the array attribute is written to the XML; otherwise, false. - - - - Gets or sets a value indicating whether to write the root JSON object. - - true if the JSON root object is omitted; otherwise, false. - - - - Gets or sets a value indicating whether to encode special characters when converting JSON to XML. - If true, special characters like ':', '@', '?', '#' and '$' in JSON property names aren't used to specify - XML namespaces, attributes or processing directives. Instead special characters are encoded and written - as part of the XML element name. - - true if special characters are encoded; otherwise, false. - - - - Writes the JSON representation of the object. - - The to write to. - The calling serializer. - The value. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The existing value of object being read. - The calling serializer. - The object value. - - - - Checks if the is a namespace attribute. - - Attribute name to test. - The attribute name prefix if it has one, otherwise an empty string. - true if attribute name is for a namespace attribute, otherwise false. - - - - Determines whether this instance can convert the specified value type. - - Type of the value. - - true if this instance can convert the specified value type; otherwise, false. - - - - - Specifies how dates are formatted when writing JSON text. - - - - - Dates are written in the ISO 8601 format, e.g. "2012-03-21T05:40Z". - - - - - Dates are written in the Microsoft JSON format, e.g. "\/Date(1198908717056)\/". - - - - - Specifies how date formatted strings, e.g. "\/Date(1198908717056)\/" and "2012-03-21T05:40Z", are parsed when reading JSON text. - - - - - Date formatted strings are not parsed to a date type and are read as strings. - - - - - Date formatted strings, e.g. "\/Date(1198908717056)\/" and "2012-03-21T05:40Z", are parsed to . - - - - - Date formatted strings, e.g. "\/Date(1198908717056)\/" and "2012-03-21T05:40Z", are parsed to . - - - - - Specifies how to treat the time value when converting between string and . - - - - - Treat as local time. If the object represents a Coordinated Universal Time (UTC), it is converted to the local time. - - - - - Treat as a UTC. If the object represents a local time, it is converted to a UTC. - - - - - Treat as a local time if a is being converted to a string. - If a string is being converted to , convert to a local time if a time zone is specified. - - - - - Time zone information should be preserved when converting. - - - - - The default JSON name table implementation. - - - - - Initializes a new instance of the class. - - - - - Gets a string containing the same characters as the specified range of characters in the given array. - - The character array containing the name to find. - The zero-based index into the array specifying the first character of the name. - The number of characters in the name. - A string containing the same characters as the specified range of characters in the given array. - - - - Adds the specified string into name table. - - The string to add. - This method is not thread-safe. - The resolved string. - - - - Specifies default value handling options for the . - - - - - - - - - Include members where the member value is the same as the member's default value when serializing objects. - Included members are written to JSON. Has no effect when deserializing. - - - - - Ignore members where the member value is the same as the member's default value when serializing objects - so that it is not written to JSON. - This option will ignore all default values (e.g. null for objects and nullable types; 0 for integers, - decimals and floating point numbers; and false for booleans). The default value ignored can be changed by - placing the on the property. - - - - - Members with a default value but no JSON will be set to their default value when deserializing. - - - - - Ignore members where the member value is the same as the member's default value when serializing objects - and set members to their default value when deserializing. - - - - - Specifies float format handling options when writing special floating point numbers, e.g. , - and with . - - - - - Write special floating point values as strings in JSON, e.g. "NaN", "Infinity", "-Infinity". - - - - - Write special floating point values as symbols in JSON, e.g. NaN, Infinity, -Infinity. - Note that this will produce non-valid JSON. - - - - - Write special floating point values as the property's default value in JSON, e.g. 0.0 for a property, null for a of property. - - - - - Specifies how floating point numbers, e.g. 1.0 and 9.9, are parsed when reading JSON text. - - - - - Floating point numbers are parsed to . - - - - - Floating point numbers are parsed to . - - - - - Specifies formatting options for the . - - - - - No special formatting is applied. This is the default. - - - - - Causes child objects to be indented according to the and settings. - - - - - Provides an interface for using pooled arrays. - - The array type content. - - - - Rent an array from the pool. This array must be returned when it is no longer needed. - - The minimum required length of the array. The returned array may be longer. - The rented array from the pool. This array must be returned when it is no longer needed. - - - - Return an array to the pool. - - The array that is being returned. - - - - Provides an interface to enable a class to return line and position information. - - - - - Gets a value indicating whether the class can return line information. - - - true if and can be provided; otherwise, false. - - - - - Gets the current line number. - - The current line number or 0 if no line information is available (for example, when returns false). - - - - Gets the current line position. - - The current line position or 0 if no line information is available (for example, when returns false). - - - - Instructs the how to serialize the collection. - - - - - Gets or sets a value indicating whether null items are allowed in the collection. - - true if null items are allowed in the collection; otherwise, false. - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class with a flag indicating whether the array can contain null items. - - A flag indicating whether the array can contain null items. - - - - Initializes a new instance of the class with the specified container Id. - - The container Id. - - - - Instructs the to use the specified constructor when deserializing that object. - - - - - Instructs the how to serialize the object. - - - - - Gets or sets the id. - - The id. - - - - Gets or sets the title. - - The title. - - - - Gets or sets the description. - - The description. - - - - Gets or sets the collection's items converter. - - The collection's items converter. - - - - The parameter list to use when constructing the described by . - If null, the default constructor is used. - When non-null, there must be a constructor defined in the that exactly matches the number, - order, and type of these parameters. - - - - [JsonContainer(ItemConverterType = typeof(MyContainerConverter), ItemConverterParameters = new object[] { 123, "Four" })] - - - - - - Gets or sets the of the . - - The of the . - - - - The parameter list to use when constructing the described by . - If null, the default constructor is used. - When non-null, there must be a constructor defined in the that exactly matches the number, - order, and type of these parameters. - - - - [JsonContainer(NamingStrategyType = typeof(MyNamingStrategy), NamingStrategyParameters = new object[] { 123, "Four" })] - - - - - - Gets or sets a value that indicates whether to preserve object references. - - - true to keep object reference; otherwise, false. The default is false. - - - - - Gets or sets a value that indicates whether to preserve collection's items references. - - - true to keep collection's items object references; otherwise, false. The default is false. - - - - - Gets or sets the reference loop handling used when serializing the collection's items. - - The reference loop handling. - - - - Gets or sets the type name handling used when serializing the collection's items. - - The type name handling. - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class with the specified container Id. - - The container Id. - - - - Provides methods for converting between .NET types and JSON types. - - - - - - - - Gets or sets a function that creates default . - Default settings are automatically used by serialization methods on , - and and on . - To serialize without using any default settings create a with - . - - - - - Represents JavaScript's boolean value true as a string. This field is read-only. - - - - - Represents JavaScript's boolean value false as a string. This field is read-only. - - - - - Represents JavaScript's null as a string. This field is read-only. - - - - - Represents JavaScript's undefined as a string. This field is read-only. - - - - - Represents JavaScript's positive infinity as a string. This field is read-only. - - - - - Represents JavaScript's negative infinity as a string. This field is read-only. - - - - - Represents JavaScript's NaN as a string. This field is read-only. - - - - - Converts the to its JSON string representation. - - The value to convert. - A JSON string representation of the . - - - - Converts the to its JSON string representation using the specified. - - The value to convert. - The format the date will be converted to. - The time zone handling when the date is converted to a string. - A JSON string representation of the . - - - - Converts the to its JSON string representation. - - The value to convert. - A JSON string representation of the . - - - - Converts the to its JSON string representation using the specified. - - The value to convert. - The format the date will be converted to. - A JSON string representation of the . - - - - Converts the to its JSON string representation. - - The value to convert. - A JSON string representation of the . - - - - Converts the to its JSON string representation. - - The value to convert. - A JSON string representation of the . - - - - Converts the to its JSON string representation. - - The value to convert. - A JSON string representation of the . - - - - Converts the to its JSON string representation. - - The value to convert. - A JSON string representation of the . - - - - Converts the to its JSON string representation. - - The value to convert. - A JSON string representation of the . - - - - Converts the to its JSON string representation. - - The value to convert. - A JSON string representation of the . - - - - Converts the to its JSON string representation. - - The value to convert. - A JSON string representation of the . - - - - Converts the to its JSON string representation. - - The value to convert. - A JSON string representation of the . - - - - Converts the to its JSON string representation. - - The value to convert. - A JSON string representation of the . - - - - Converts the to its JSON string representation. - - The value to convert. - A JSON string representation of the . - - - - Converts the to its JSON string representation. - - The value to convert. - A JSON string representation of the . - - - - Converts the to its JSON string representation. - - The value to convert. - A JSON string representation of the . - - - - Converts the to its JSON string representation. - - The value to convert. - A JSON string representation of the . - - - - Converts the to its JSON string representation. - - The value to convert. - A JSON string representation of the . - - - - Converts the to its JSON string representation. - - The value to convert. - A JSON string representation of the . - - - - Converts the to its JSON string representation. - - The value to convert. - A JSON string representation of the . - - - - Converts the to its JSON string representation. - - The value to convert. - A JSON string representation of the . - - - - Converts the to its JSON string representation. - - The value to convert. - A JSON string representation of the . - - - - Converts the to its JSON string representation. - - The value to convert. - The string delimiter character. - A JSON string representation of the . - - - - Converts the to its JSON string representation. - - The value to convert. - The string delimiter character. - The string escape handling. - A JSON string representation of the . - - - - Converts the to its JSON string representation. - - The value to convert. - A JSON string representation of the . - - - - Serializes the specified object to a JSON string. - - The object to serialize. - A JSON string representation of the object. - - - - Serializes the specified object to a JSON string using formatting. - - The object to serialize. - Indicates how the output should be formatted. - - A JSON string representation of the object. - - - - - Serializes the specified object to a JSON string using a collection of . - - The object to serialize. - A collection of converters used while serializing. - A JSON string representation of the object. - - - - Serializes the specified object to a JSON string using formatting and a collection of . - - The object to serialize. - Indicates how the output should be formatted. - A collection of converters used while serializing. - A JSON string representation of the object. - - - - Serializes the specified object to a JSON string using . - - The object to serialize. - The used to serialize the object. - If this is null, default serialization settings will be used. - - A JSON string representation of the object. - - - - - Serializes the specified object to a JSON string using a type, formatting and . - - The object to serialize. - The used to serialize the object. - If this is null, default serialization settings will be used. - - The type of the value being serialized. - This parameter is used when is to write out the type name if the type of the value does not match. - Specifying the type is optional. - - - A JSON string representation of the object. - - - - - Serializes the specified object to a JSON string using formatting and . - - The object to serialize. - Indicates how the output should be formatted. - The used to serialize the object. - If this is null, default serialization settings will be used. - - A JSON string representation of the object. - - - - - Serializes the specified object to a JSON string using a type, formatting and . - - The object to serialize. - Indicates how the output should be formatted. - The used to serialize the object. - If this is null, default serialization settings will be used. - - The type of the value being serialized. - This parameter is used when is to write out the type name if the type of the value does not match. - Specifying the type is optional. - - - A JSON string representation of the object. - - - - - Deserializes the JSON to a .NET object. - - The JSON to deserialize. - The deserialized object from the JSON string. - - - - Deserializes the JSON to a .NET object using . - - The JSON to deserialize. - - The used to deserialize the object. - If this is null, default serialization settings will be used. - - The deserialized object from the JSON string. - - - - Deserializes the JSON to the specified .NET type. - - The JSON to deserialize. - The of object being deserialized. - The deserialized object from the JSON string. - - - - Deserializes the JSON to the specified .NET type. - - The type of the object to deserialize to. - The JSON to deserialize. - The deserialized object from the JSON string. - - - - Deserializes the JSON to the given anonymous type. - - - The anonymous type to deserialize to. This can't be specified - traditionally and must be inferred from the anonymous type passed - as a parameter. - - The JSON to deserialize. - The anonymous type object. - The deserialized anonymous type from the JSON string. - - - - Deserializes the JSON to the given anonymous type using . - - - The anonymous type to deserialize to. This can't be specified - traditionally and must be inferred from the anonymous type passed - as a parameter. - - The JSON to deserialize. - The anonymous type object. - - The used to deserialize the object. - If this is null, default serialization settings will be used. - - The deserialized anonymous type from the JSON string. - - - - Deserializes the JSON to the specified .NET type using a collection of . - - The type of the object to deserialize to. - The JSON to deserialize. - Converters to use while deserializing. - The deserialized object from the JSON string. - - - - Deserializes the JSON to the specified .NET type using . - - The type of the object to deserialize to. - The object to deserialize. - - The used to deserialize the object. - If this is null, default serialization settings will be used. - - The deserialized object from the JSON string. - - - - Deserializes the JSON to the specified .NET type using a collection of . - - The JSON to deserialize. - The type of the object to deserialize. - Converters to use while deserializing. - The deserialized object from the JSON string. - - - - Deserializes the JSON to the specified .NET type using . - - The JSON to deserialize. - The type of the object to deserialize to. - - The used to deserialize the object. - If this is null, default serialization settings will be used. - - The deserialized object from the JSON string. - - - - Populates the object with values from the JSON string. - - The JSON to populate values from. - The target object to populate values onto. - - - - Populates the object with values from the JSON string using . - - The JSON to populate values from. - The target object to populate values onto. - - The used to deserialize the object. - If this is null, default serialization settings will be used. - - - - - Serializes the to a JSON string. - - The node to serialize. - A JSON string of the . - - - - Serializes the to a JSON string using formatting. - - The node to serialize. - Indicates how the output should be formatted. - A JSON string of the . - - - - Serializes the to a JSON string using formatting and omits the root object if is true. - - The node to serialize. - Indicates how the output should be formatted. - Omits writing the root object. - A JSON string of the . - - - - Deserializes the from a JSON string. - - The JSON string. - The deserialized . - - - - Deserializes the from a JSON string nested in a root element specified by . - - The JSON string. - The name of the root element to append when deserializing. - The deserialized . - - - - Deserializes the from a JSON string nested in a root element specified by - and writes a Json.NET array attribute for collections. - - The JSON string. - The name of the root element to append when deserializing. - - A value to indicate whether to write the Json.NET array attribute. - This attribute helps preserve arrays when converting the written XML back to JSON. - - The deserialized . - - - - Deserializes the from a JSON string nested in a root element specified by , - writes a Json.NET array attribute for collections, and encodes special characters. - - The JSON string. - The name of the root element to append when deserializing. - - A value to indicate whether to write the Json.NET array attribute. - This attribute helps preserve arrays when converting the written XML back to JSON. - - - A value to indicate whether to encode special characters when converting JSON to XML. - If true, special characters like ':', '@', '?', '#' and '$' in JSON property names aren't used to specify - XML namespaces, attributes or processing directives. Instead special characters are encoded and written - as part of the XML element name. - - The deserialized . - - - - Serializes the to a JSON string. - - The node to convert to JSON. - A JSON string of the . - - - - Serializes the to a JSON string using formatting. - - The node to convert to JSON. - Indicates how the output should be formatted. - A JSON string of the . - - - - Serializes the to a JSON string using formatting and omits the root object if is true. - - The node to serialize. - Indicates how the output should be formatted. - Omits writing the root object. - A JSON string of the . - - - - Deserializes the from a JSON string. - - The JSON string. - The deserialized . - - - - Deserializes the from a JSON string nested in a root element specified by . - - The JSON string. - The name of the root element to append when deserializing. - The deserialized . - - - - Deserializes the from a JSON string nested in a root element specified by - and writes a Json.NET array attribute for collections. - - The JSON string. - The name of the root element to append when deserializing. - - A value to indicate whether to write the Json.NET array attribute. - This attribute helps preserve arrays when converting the written XML back to JSON. - - The deserialized . - - - - Deserializes the from a JSON string nested in a root element specified by , - writes a Json.NET array attribute for collections, and encodes special characters. - - The JSON string. - The name of the root element to append when deserializing. - - A value to indicate whether to write the Json.NET array attribute. - This attribute helps preserve arrays when converting the written XML back to JSON. - - - A value to indicate whether to encode special characters when converting JSON to XML. - If true, special characters like ':', '@', '?', '#' and '$' in JSON property names aren't used to specify - XML namespaces, attributes or processing directives. Instead special characters are encoded and written - as part of the XML element name. - - The deserialized . - - - - Converts an object to and from JSON. - - - - - Writes the JSON representation of the object. - - The to write to. - The value. - The calling serializer. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The existing value of object being read. - The calling serializer. - The object value. - - - - Determines whether this instance can convert the specified object type. - - Type of the object. - - true if this instance can convert the specified object type; otherwise, false. - - - - - Gets a value indicating whether this can read JSON. - - true if this can read JSON; otherwise, false. - - - - Gets a value indicating whether this can write JSON. - - true if this can write JSON; otherwise, false. - - - - Converts an object to and from JSON. - - The object type to convert. - - - - Writes the JSON representation of the object. - - The to write to. - The value. - The calling serializer. - - - - Writes the JSON representation of the object. - - The to write to. - The value. - The calling serializer. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The existing value of object being read. - The calling serializer. - The object value. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The existing value of object being read. If there is no existing value then null will be used. - The existing value has a value. - The calling serializer. - The object value. - - - - Determines whether this instance can convert the specified object type. - - Type of the object. - - true if this instance can convert the specified object type; otherwise, false. - - - - - Instructs the to use the specified when serializing the member or class. - - - - - Gets the of the . - - The of the . - - - - The parameter list to use when constructing the described by . - If null, the default constructor is used. - - - - - Initializes a new instance of the class. - - Type of the . - - - - Initializes a new instance of the class. - - Type of the . - Parameter list to use when constructing the . Can be null. - - - - Represents a collection of . - - - - - Instructs the how to serialize the collection. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class with the specified container Id. - - The container Id. - - - - The exception thrown when an error occurs during JSON serialization or deserialization. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class - with a specified error message. - - The error message that explains the reason for the exception. - - - - Initializes a new instance of the class - with a specified error message and a reference to the inner exception that is the cause of this exception. - - The error message that explains the reason for the exception. - The exception that is the cause of the current exception, or null if no inner exception is specified. - - - - Initializes a new instance of the class. - - The that holds the serialized object data about the exception being thrown. - The that contains contextual information about the source or destination. - The parameter is null. - The class name is null or is zero (0). - - - - Instructs the to deserialize properties with no matching class member into the specified collection - and write values during serialization. - - - - - Gets or sets a value that indicates whether to write extension data when serializing the object. - - - true to write extension data when serializing the object; otherwise, false. The default is true. - - - - - Gets or sets a value that indicates whether to read extension data when deserializing the object. - - - true to read extension data when deserializing the object; otherwise, false. The default is true. - - - - - Initializes a new instance of the class. - - - - - Instructs the not to serialize the public field or public read/write property value. - - - - - Base class for a table of atomized string objects. - - - - - Gets a string containing the same characters as the specified range of characters in the given array. - - The character array containing the name to find. - The zero-based index into the array specifying the first character of the name. - The number of characters in the name. - A string containing the same characters as the specified range of characters in the given array. - - - - Instructs the how to serialize the object. - - - - - Gets or sets the member serialization. - - The member serialization. - - - - Gets or sets the missing member handling used when deserializing this object. - - The missing member handling. - - - - Gets or sets how the object's properties with null values are handled during serialization and deserialization. - - How the object's properties with null values are handled during serialization and deserialization. - - - - Gets or sets a value that indicates whether the object's properties are required. - - - A value indicating whether the object's properties are required. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class with the specified member serialization. - - The member serialization. - - - - Initializes a new instance of the class with the specified container Id. - - The container Id. - - - - Instructs the to always serialize the member with the specified name. - - - - - Gets or sets the type used when serializing the property's collection items. - - The collection's items type. - - - - The parameter list to use when constructing the described by . - If null, the default constructor is used. - When non-null, there must be a constructor defined in the that exactly matches the number, - order, and type of these parameters. - - - - [JsonProperty(ItemConverterType = typeof(MyContainerConverter), ItemConverterParameters = new object[] { 123, "Four" })] - - - - - - Gets or sets the of the . - - The of the . - - - - The parameter list to use when constructing the described by . - If null, the default constructor is used. - When non-null, there must be a constructor defined in the that exactly matches the number, - order, and type of these parameters. - - - - [JsonProperty(NamingStrategyType = typeof(MyNamingStrategy), NamingStrategyParameters = new object[] { 123, "Four" })] - - - - - - Gets or sets the null value handling used when serializing this property. - - The null value handling. - - - - Gets or sets the default value handling used when serializing this property. - - The default value handling. - - - - Gets or sets the reference loop handling used when serializing this property. - - The reference loop handling. - - - - Gets or sets the object creation handling used when deserializing this property. - - The object creation handling. - - - - Gets or sets the type name handling used when serializing this property. - - The type name handling. - - - - Gets or sets whether this property's value is serialized as a reference. - - Whether this property's value is serialized as a reference. - - - - Gets or sets the order of serialization of a member. - - The numeric order of serialization. - - - - Gets or sets a value indicating whether this property is required. - - - A value indicating whether this property is required. - - - - - Gets or sets the name of the property. - - The name of the property. - - - - Gets or sets the reference loop handling used when serializing the property's collection items. - - The collection's items reference loop handling. - - - - Gets or sets the type name handling used when serializing the property's collection items. - - The collection's items type name handling. - - - - Gets or sets whether this property's collection items are serialized as a reference. - - Whether this property's collection items are serialized as a reference. - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class with the specified name. - - Name of the property. - - - - Represents a reader that provides fast, non-cached, forward-only access to serialized JSON data. - - - - - Asynchronously reads the next JSON token from the source. - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous read. The - property returns true if the next token was read successfully; false if there are no more tokens to read. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously skips the children of the current token. - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously reads the next JSON token from the source as a of . - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous read. The - property returns the of . This result will be null at the end of an array. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously reads the next JSON token from the source as a []. - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous read. The - property returns the []. This result will be null at the end of an array. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously reads the next JSON token from the source as a of . - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous read. The - property returns the of . This result will be null at the end of an array. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously reads the next JSON token from the source as a of . - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous read. The - property returns the of . This result will be null at the end of an array. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously reads the next JSON token from the source as a of . - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous read. The - property returns the of . This result will be null at the end of an array. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously reads the next JSON token from the source as a of . - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous read. The - property returns the of . This result will be null at the end of an array. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously reads the next JSON token from the source as a of . - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous read. The - property returns the of . This result will be null at the end of an array. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously reads the next JSON token from the source as a . - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous read. The - property returns the . This result will be null at the end of an array. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Specifies the state of the reader. - - - - - A read method has not been called. - - - - - The end of the file has been reached successfully. - - - - - Reader is at a property. - - - - - Reader is at the start of an object. - - - - - Reader is in an object. - - - - - Reader is at the start of an array. - - - - - Reader is in an array. - - - - - The method has been called. - - - - - Reader has just read a value. - - - - - Reader is at the start of a constructor. - - - - - Reader is in a constructor. - - - - - An error occurred that prevents the read operation from continuing. - - - - - The end of the file has been reached successfully. - - - - - Gets the current reader state. - - The current reader state. - - - - Gets or sets a value indicating whether the source should be closed when this reader is closed. - - - true to close the source when this reader is closed; otherwise false. The default is true. - - - - - Gets or sets a value indicating whether multiple pieces of JSON content can - be read from a continuous stream without erroring. - - - true to support reading multiple pieces of JSON content; otherwise false. - The default is false. - - - - - Gets the quotation mark character used to enclose the value of a string. - - - - - Gets or sets how time zones are handled when reading JSON. - - - - - Gets or sets how date formatted strings, e.g. "\/Date(1198908717056)\/" and "2012-03-21T05:40Z", are parsed when reading JSON. - - - - - Gets or sets how floating point numbers, e.g. 1.0 and 9.9, are parsed when reading JSON text. - - - - - Gets or sets how custom date formatted strings are parsed when reading JSON. - - - - - Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a . - A null value means there is no maximum. - The default value is 64. - - - - - Gets the type of the current JSON token. - - - - - Gets the text value of the current JSON token. - - - - - Gets the .NET type for the current JSON token. - - - - - Gets the depth of the current token in the JSON document. - - The depth of the current token in the JSON document. - - - - Gets the path of the current JSON token. - - - - - Gets or sets the culture used when reading JSON. Defaults to . - - - - - Initializes a new instance of the class. - - - - - Reads the next JSON token from the source. - - true if the next token was read successfully; false if there are no more tokens to read. - - - - Reads the next JSON token from the source as a of . - - A of . This method will return null at the end of an array. - - - - Reads the next JSON token from the source as a . - - A . This method will return null at the end of an array. - - - - Reads the next JSON token from the source as a []. - - A [] or null if the next JSON token is null. This method will return null at the end of an array. - - - - Reads the next JSON token from the source as a of . - - A of . This method will return null at the end of an array. - - - - Reads the next JSON token from the source as a of . - - A of . This method will return null at the end of an array. - - - - Reads the next JSON token from the source as a of . - - A of . This method will return null at the end of an array. - - - - Reads the next JSON token from the source as a of . - - A of . This method will return null at the end of an array. - - - - Reads the next JSON token from the source as a of . - - A of . This method will return null at the end of an array. - - - - Skips the children of the current token. - - - - - Sets the current token. - - The new token. - - - - Sets the current token and value. - - The new token. - The value. - - - - Sets the current token and value. - - The new token. - The value. - A flag indicating whether the position index inside an array should be updated. - - - - Sets the state based on current token type. - - - - - Releases unmanaged and - optionally - managed resources. - - true to release both managed and unmanaged resources; false to release only unmanaged resources. - - - - Changes the reader's state to . - If is set to true, the source is also closed. - - - - - The exception thrown when an error occurs while reading JSON text. - - - - - Gets the line number indicating where the error occurred. - - The line number indicating where the error occurred. - - - - Gets the line position indicating where the error occurred. - - The line position indicating where the error occurred. - - - - Gets the path to the JSON where the error occurred. - - The path to the JSON where the error occurred. - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class - with a specified error message. - - The error message that explains the reason for the exception. - - - - Initializes a new instance of the class - with a specified error message and a reference to the inner exception that is the cause of this exception. - - The error message that explains the reason for the exception. - The exception that is the cause of the current exception, or null if no inner exception is specified. - - - - Initializes a new instance of the class. - - The that holds the serialized object data about the exception being thrown. - The that contains contextual information about the source or destination. - The parameter is null. - The class name is null or is zero (0). - - - - Initializes a new instance of the class - with a specified error message, JSON path, line number, line position, and a reference to the inner exception that is the cause of this exception. - - The error message that explains the reason for the exception. - The path to the JSON where the error occurred. - The line number indicating where the error occurred. - The line position indicating where the error occurred. - The exception that is the cause of the current exception, or null if no inner exception is specified. - - - - Instructs the to always serialize the member, and to require that the member has a value. - - - - - The exception thrown when an error occurs during JSON serialization or deserialization. - - - - - Gets the line number indicating where the error occurred. - - The line number indicating where the error occurred. - - - - Gets the line position indicating where the error occurred. - - The line position indicating where the error occurred. - - - - Gets the path to the JSON where the error occurred. - - The path to the JSON where the error occurred. - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class - with a specified error message. - - The error message that explains the reason for the exception. - - - - Initializes a new instance of the class - with a specified error message and a reference to the inner exception that is the cause of this exception. - - The error message that explains the reason for the exception. - The exception that is the cause of the current exception, or null if no inner exception is specified. - - - - Initializes a new instance of the class. - - The that holds the serialized object data about the exception being thrown. - The that contains contextual information about the source or destination. - The parameter is null. - The class name is null or is zero (0). - - - - Initializes a new instance of the class - with a specified error message, JSON path, line number, line position, and a reference to the inner exception that is the cause of this exception. - - The error message that explains the reason for the exception. - The path to the JSON where the error occurred. - The line number indicating where the error occurred. - The line position indicating where the error occurred. - The exception that is the cause of the current exception, or null if no inner exception is specified. - - - - Serializes and deserializes objects into and from the JSON format. - The enables you to control how objects are encoded into JSON. - - - - - Occurs when the errors during serialization and deserialization. - - - - - Gets or sets the used by the serializer when resolving references. - - - - - Gets or sets the used by the serializer when resolving type names. - - - - - Gets or sets the used by the serializer when resolving type names. - - - - - Gets or sets the used by the serializer when writing trace messages. - - The trace writer. - - - - Gets or sets the equality comparer used by the serializer when comparing references. - - The equality comparer. - - - - Gets or sets how type name writing and reading is handled by the serializer. - The default value is . - - - should be used with caution when your application deserializes JSON from an external source. - Incoming types should be validated with a custom - when deserializing with a value other than . - - - - - Gets or sets how a type name assembly is written and resolved by the serializer. - The default value is . - - The type name assembly format. - - - - Gets or sets how a type name assembly is written and resolved by the serializer. - The default value is . - - The type name assembly format. - - - - Gets or sets how object references are preserved by the serializer. - The default value is . - - - - - Gets or sets how reference loops (e.g. a class referencing itself) is handled. - The default value is . - - - - - Gets or sets how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization. - The default value is . - - - - - Gets or sets how null values are handled during serialization and deserialization. - The default value is . - - - - - Gets or sets how default values are handled during serialization and deserialization. - The default value is . - - - - - Gets or sets how objects are created during deserialization. - The default value is . - - The object creation handling. - - - - Gets or sets how constructors are used during deserialization. - The default value is . - - The constructor handling. - - - - Gets or sets how metadata properties are used during deserialization. - The default value is . - - The metadata properties handling. - - - - Gets a collection that will be used during serialization. - - Collection that will be used during serialization. - - - - Gets or sets the contract resolver used by the serializer when - serializing .NET objects to JSON and vice versa. - - - - - Gets or sets the used by the serializer when invoking serialization callback methods. - - The context. - - - - Indicates how JSON text output is formatted. - The default value is . - - - - - Gets or sets how dates are written to JSON text. - The default value is . - - - - - Gets or sets how time zones are handled during serialization and deserialization. - The default value is . - - - - - Gets or sets how date formatted strings, e.g. "\/Date(1198908717056)\/" and "2012-03-21T05:40Z", are parsed when reading JSON. - The default value is . - - - - - Gets or sets how floating point numbers, e.g. 1.0 and 9.9, are parsed when reading JSON text. - The default value is . - - - - - Gets or sets how special floating point numbers, e.g. , - and , - are written as JSON text. - The default value is . - - - - - Gets or sets how strings are escaped when writing JSON text. - The default value is . - - - - - Gets or sets how and values are formatted when writing JSON text, - and the expected date format when reading JSON text. - The default value is "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK". - - - - - Gets or sets the culture used when reading JSON. - The default value is . - - - - - Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a . - A null value means there is no maximum. - The default value is 64. - - - - - Gets a value indicating whether there will be a check for additional JSON content after deserializing an object. - The default value is false. - - - true if there will be a check for additional JSON content after deserializing an object; otherwise, false. - - - - - Initializes a new instance of the class. - - - - - Creates a new instance. - The will not use default settings - from . - - - A new instance. - The will not use default settings - from . - - - - - Creates a new instance using the specified . - The will not use default settings - from . - - The settings to be applied to the . - - A new instance using the specified . - The will not use default settings - from . - - - - - Creates a new instance. - The will use default settings - from . - - - A new instance. - The will use default settings - from . - - - - - Creates a new instance using the specified . - The will use default settings - from as well as the specified . - - The settings to be applied to the . - - A new instance using the specified . - The will use default settings - from as well as the specified . - - - - - Populates the JSON values onto the target object. - - The that contains the JSON structure to read values from. - The target object to populate values onto. - - - - Populates the JSON values onto the target object. - - The that contains the JSON structure to read values from. - The target object to populate values onto. - - - - Deserializes the JSON structure contained by the specified . - - The that contains the JSON structure to deserialize. - The being deserialized. - - - - Deserializes the JSON structure contained by the specified - into an instance of the specified type. - - The containing the object. - The of object being deserialized. - The instance of being deserialized. - - - - Deserializes the JSON structure contained by the specified - into an instance of the specified type. - - The containing the object. - The type of the object to deserialize. - The instance of being deserialized. - - - - Deserializes the JSON structure contained by the specified - into an instance of the specified type. - - The containing the object. - The of object being deserialized. - The instance of being deserialized. - - - - Serializes the specified and writes the JSON structure - using the specified . - - The used to write the JSON structure. - The to serialize. - - - - Serializes the specified and writes the JSON structure - using the specified . - - The used to write the JSON structure. - The to serialize. - - The type of the value being serialized. - This parameter is used when is to write out the type name if the type of the value does not match. - Specifying the type is optional. - - - - - Serializes the specified and writes the JSON structure - using the specified . - - The used to write the JSON structure. - The to serialize. - - The type of the value being serialized. - This parameter is used when is Auto to write out the type name if the type of the value does not match. - Specifying the type is optional. - - - - - Serializes the specified and writes the JSON structure - using the specified . - - The used to write the JSON structure. - The to serialize. - - - - Specifies the settings on a object. - - - - - Gets or sets how reference loops (e.g. a class referencing itself) are handled. - The default value is . - - Reference loop handling. - - - - Gets or sets how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization. - The default value is . - - Missing member handling. - - - - Gets or sets how objects are created during deserialization. - The default value is . - - The object creation handling. - - - - Gets or sets how null values are handled during serialization and deserialization. - The default value is . - - Null value handling. - - - - Gets or sets how default values are handled during serialization and deserialization. - The default value is . - - The default value handling. - - - - Gets or sets a collection that will be used during serialization. - - The converters. - - - - Gets or sets how object references are preserved by the serializer. - The default value is . - - The preserve references handling. - - - - Gets or sets how type name writing and reading is handled by the serializer. - The default value is . - - - should be used with caution when your application deserializes JSON from an external source. - Incoming types should be validated with a custom - when deserializing with a value other than . - - The type name handling. - - - - Gets or sets how metadata properties are used during deserialization. - The default value is . - - The metadata properties handling. - - - - Gets or sets how a type name assembly is written and resolved by the serializer. - The default value is . - - The type name assembly format. - - - - Gets or sets how a type name assembly is written and resolved by the serializer. - The default value is . - - The type name assembly format. - - - - Gets or sets how constructors are used during deserialization. - The default value is . - - The constructor handling. - - - - Gets or sets the contract resolver used by the serializer when - serializing .NET objects to JSON and vice versa. - - The contract resolver. - - - - Gets or sets the equality comparer used by the serializer when comparing references. - - The equality comparer. - - - - Gets or sets the used by the serializer when resolving references. - - The reference resolver. - - - - Gets or sets a function that creates the used by the serializer when resolving references. - - A function that creates the used by the serializer when resolving references. - - - - Gets or sets the used by the serializer when writing trace messages. - - The trace writer. - - - - Gets or sets the used by the serializer when resolving type names. - - The binder. - - - - Gets or sets the used by the serializer when resolving type names. - - The binder. - - - - Gets or sets the error handler called during serialization and deserialization. - - The error handler called during serialization and deserialization. - - - - Gets or sets the used by the serializer when invoking serialization callback methods. - - The context. - - - - Gets or sets how and values are formatted when writing JSON text, - and the expected date format when reading JSON text. - The default value is "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK". - - - - - Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a . - A null value means there is no maximum. - The default value is 64. - - - - - Indicates how JSON text output is formatted. - The default value is . - - - - - Gets or sets how dates are written to JSON text. - The default value is . - - - - - Gets or sets how time zones are handled during serialization and deserialization. - The default value is . - - - - - Gets or sets how date formatted strings, e.g. "\/Date(1198908717056)\/" and "2012-03-21T05:40Z", are parsed when reading JSON. - The default value is . - - - - - Gets or sets how special floating point numbers, e.g. , - and , - are written as JSON. - The default value is . - - - - - Gets or sets how floating point numbers, e.g. 1.0 and 9.9, are parsed when reading JSON text. - The default value is . - - - - - Gets or sets how strings are escaped when writing JSON text. - The default value is . - - - - - Gets or sets the culture used when reading JSON. - The default value is . - - - - - Gets a value indicating whether there will be a check for additional content after deserializing an object. - The default value is false. - - - true if there will be a check for additional content after deserializing an object; otherwise, false. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class - using values copied from the passed in . - - - - - Represents a reader that provides fast, non-cached, forward-only access to JSON text data. - - - - - Asynchronously reads the next JSON token from the source. - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous read. The - property returns true if the next token was read successfully; false if there are no more tokens to read. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously reads the next JSON token from the source as a of . - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous read. The - property returns the of . This result will be null at the end of an array. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously reads the next JSON token from the source as a []. - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous read. The - property returns the []. This result will be null at the end of an array. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously reads the next JSON token from the source as a of . - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous read. The - property returns the of . This result will be null at the end of an array. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously reads the next JSON token from the source as a of . - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous read. The - property returns the of . This result will be null at the end of an array. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously reads the next JSON token from the source as a of . - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous read. The - property returns the of . This result will be null at the end of an array. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously reads the next JSON token from the source as a of . - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous read. The - property returns the of . This result will be null at the end of an array. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously reads the next JSON token from the source as a of . - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous read. The - property returns the of . This result will be null at the end of an array. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously reads the next JSON token from the source as a . - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous read. The - property returns the . This result will be null at the end of an array. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Initializes a new instance of the class with the specified . - - The containing the JSON data to read. - - - - Gets or sets the reader's property name table. - - - - - Gets or sets the reader's character buffer pool. - - - - - Reads the next JSON token from the underlying . - - - true if the next token was read successfully; false if there are no more tokens to read. - - - - - Reads the next JSON token from the underlying as a of . - - A of . This method will return null at the end of an array. - - - - Reads the next JSON token from the underlying as a of . - - A of . This method will return null at the end of an array. - - - - Reads the next JSON token from the underlying as a . - - A . This method will return null at the end of an array. - - - - Reads the next JSON token from the underlying as a []. - - A [] or null if the next JSON token is null. This method will return null at the end of an array. - - - - Reads the next JSON token from the underlying as a of . - - A of . This method will return null at the end of an array. - - - - Reads the next JSON token from the underlying as a of . - - A of . This method will return null at the end of an array. - - - - Reads the next JSON token from the underlying as a of . - - A of . This method will return null at the end of an array. - - - - Reads the next JSON token from the underlying as a of . - - A of . This method will return null at the end of an array. - - - - Changes the reader's state to . - If is set to true, the underlying is also closed. - - - - - Gets a value indicating whether the class can return line information. - - - true if and can be provided; otherwise, false. - - - - - Gets the current line number. - - - The current line number or 0 if no line information is available (for example, returns false). - - - - - Gets the current line position. - - - The current line position or 0 if no line information is available (for example, returns false). - - - - - Represents a writer that provides a fast, non-cached, forward-only way of generating JSON data. - - - - - Asynchronously flushes whatever is in the buffer to the destination and also flushes the destination. - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes the JSON value delimiter. - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes the specified end token. - - The end token to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously closes this writer. - If is set to true, the destination is also closed. - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes the end of the current JSON object or array. - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes indent characters. - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes an indent space. - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes raw JSON without changing the writer's state. - - The raw JSON to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a null value. - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes the property name of a name/value pair of a JSON object. - - The name of the property. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes the property name of a name/value pair of a JSON object. - - The name of the property. - A flag to indicate whether the text should be escaped when it is written as a JSON property name. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes the beginning of a JSON array. - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes the beginning of a JSON object. - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes the start of a constructor with the given name. - - The name of the constructor. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes an undefined value. - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes the given white space. - - The string of white space characters. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a of value. - - The of value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a of value. - - The of value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a [] value. - - The [] value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a of value. - - The of value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a of value. - - The of value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a of value. - - The of value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a of value. - - The of value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a of value. - - The of value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a of value. - - The of value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a of value. - - The of value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a of value. - - The of value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a of value. - - The of value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a of value. - - The of value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a of value. - - The of value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a of value. - - The of value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a of value. - - The of value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a of value. - - The of value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a of value. - - The of value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes a comment /*...*/ containing the specified text. - - Text to place inside the comment. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes the end of an array. - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes the end of a constructor. - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes the end of a JSON object. - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Asynchronously writes raw JSON where a value is expected and updates the writer's state. - - The raw JSON to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - Derived classes must override this method to get asynchronous behaviour. Otherwise it will - execute synchronously, returning an already-completed task. - - - - Gets or sets the writer's character array pool. - - - - - Gets or sets how many s to write for each level in the hierarchy when is set to . - - - - - Gets or sets which character to use to quote attribute values. - - - - - Gets or sets which character to use for indenting when is set to . - - - - - Gets or sets a value indicating whether object names will be surrounded with quotes. - - - - - Initializes a new instance of the class using the specified . - - The to write to. - - - - Flushes whatever is in the buffer to the underlying and also flushes the underlying . - - - - - Closes this writer. - If is set to true, the underlying is also closed. - If is set to true, the JSON is auto-completed. - - - - - Writes the beginning of a JSON object. - - - - - Writes the beginning of a JSON array. - - - - - Writes the start of a constructor with the given name. - - The name of the constructor. - - - - Writes the specified end token. - - The end token to write. - - - - Writes the property name of a name/value pair on a JSON object. - - The name of the property. - - - - Writes the property name of a name/value pair on a JSON object. - - The name of the property. - A flag to indicate whether the text should be escaped when it is written as a JSON property name. - - - - Writes indent characters. - - - - - Writes the JSON value delimiter. - - - - - Writes an indent space. - - - - - Writes a value. - An error will raised if the value cannot be written as a single JSON token. - - The value to write. - - - - Writes a null value. - - - - - Writes an undefined value. - - - - - Writes raw JSON. - - The raw JSON to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a of value. - - The of value to write. - - - - Writes a value. - - The value to write. - - - - Writes a of value. - - The of value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a [] value. - - The [] value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a comment /*...*/ containing the specified text. - - Text to place inside the comment. - - - - Writes the given white space. - - The string of white space characters. - - - - Specifies the type of JSON token. - - - - - This is returned by the if a read method has not been called. - - - - - An object start token. - - - - - An array start token. - - - - - A constructor start token. - - - - - An object property name. - - - - - A comment. - - - - - Raw JSON. - - - - - An integer. - - - - - A float. - - - - - A string. - - - - - A boolean. - - - - - A null token. - - - - - An undefined token. - - - - - An object end token. - - - - - An array end token. - - - - - A constructor end token. - - - - - A Date. - - - - - Byte data. - - - - - - Represents a reader that provides validation. - - - JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details. - - - - - - Sets an event handler for receiving schema validation errors. - - - - - Gets the text value of the current JSON token. - - - - - - Gets the depth of the current token in the JSON document. - - The depth of the current token in the JSON document. - - - - Gets the path of the current JSON token. - - - - - Gets the quotation mark character used to enclose the value of a string. - - - - - - Gets the type of the current JSON token. - - - - - - Gets the .NET type for the current JSON token. - - - - - - Initializes a new instance of the class that - validates the content returned from the given . - - The to read from while validating. - - - - Gets or sets the schema. - - The schema. - - - - Gets the used to construct this . - - The specified in the constructor. - - - - Changes the reader's state to . - If is set to true, the underlying is also closed. - - - - - Reads the next JSON token from the underlying as a of . - - A of . - - - - Reads the next JSON token from the underlying as a []. - - - A [] or null if the next JSON token is null. - - - - - Reads the next JSON token from the underlying as a of . - - A of . - - - - Reads the next JSON token from the underlying as a of . - - A of . - - - - Reads the next JSON token from the underlying as a of . - - A of . - - - - Reads the next JSON token from the underlying as a . - - A . This method will return null at the end of an array. - - - - Reads the next JSON token from the underlying as a of . - - A of . This method will return null at the end of an array. - - - - Reads the next JSON token from the underlying as a of . - - A of . - - - - Reads the next JSON token from the underlying . - - - true if the next token was read successfully; false if there are no more tokens to read. - - - - - Represents a writer that provides a fast, non-cached, forward-only way of generating JSON data. - - - - - Asynchronously closes this writer. - If is set to true, the destination is also closed. - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously flushes whatever is in the buffer to the destination and also flushes the destination. - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes the specified end token. - - The end token to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes indent characters. - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes the JSON value delimiter. - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes an indent space. - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes raw JSON without changing the writer's state. - - The raw JSON to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes the end of the current JSON object or array. - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes the end of an array. - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes the end of a constructor. - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes the end of a JSON object. - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a null value. - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes the property name of a name/value pair of a JSON object. - - The name of the property. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes the property name of a name/value pair of a JSON object. - - The name of the property. - A flag to indicate whether the text should be escaped when it is written as a JSON property name. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes the beginning of a JSON array. - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a comment /*...*/ containing the specified text. - - Text to place inside the comment. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes raw JSON where a value is expected and updates the writer's state. - - The raw JSON to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes the start of a constructor with the given name. - - The name of the constructor. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes the beginning of a JSON object. - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes the current token. - - The to read the token from. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes the current token. - - The to read the token from. - A flag indicating whether the current token's children should be written. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes the token and its value. - - The to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes the token and its value. - - The to write. - - The value to write. - A value is only required for tokens that have an associated value, e.g. the property name for . - null can be passed to the method for tokens that don't have a value, e.g. . - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a of value. - - The of value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a of value. - - The of value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a [] value. - - The [] value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a of value. - - The of value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a of value. - - The of value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a of value. - - The of value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a of value. - - The of value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a of value. - - The of value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a of value. - - The of value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a of value. - - The of value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a of value. - - The of value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a of value. - - The of value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a of value. - - The of value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a of value. - - The of value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a of value. - - The of value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a of value. - - The of value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a of value. - - The of value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a value. - - The value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes a of value. - - The of value to write. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes an undefined value. - - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously writes the given white space. - - The string of white space characters. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Asynchronously ets the state of the . - - The being written. - The value being written. - The token to monitor for cancellation requests. The default value is . - A that represents the asynchronous operation. - The default behaviour is to execute synchronously, returning an already-completed task. Derived - classes can override this behaviour for true asynchronicity. - - - - Gets or sets a value indicating whether the destination should be closed when this writer is closed. - - - true to close the destination when this writer is closed; otherwise false. The default is true. - - - - - Gets or sets a value indicating whether the JSON should be auto-completed when this writer is closed. - - - true to auto-complete the JSON when this writer is closed; otherwise false. The default is true. - - - - - Gets the top. - - The top. - - - - Gets the state of the writer. - - - - - Gets the path of the writer. - - - - - Gets or sets a value indicating how JSON text output should be formatted. - - - - - Gets or sets how dates are written to JSON text. - - - - - Gets or sets how time zones are handled when writing JSON text. - - - - - Gets or sets how strings are escaped when writing JSON text. - - - - - Gets or sets how special floating point numbers, e.g. , - and , - are written to JSON text. - - - - - Gets or sets how and values are formatted when writing JSON text. - - - - - Gets or sets the culture used when writing JSON. Defaults to . - - - - - Initializes a new instance of the class. - - - - - Flushes whatever is in the buffer to the destination and also flushes the destination. - - - - - Closes this writer. - If is set to true, the destination is also closed. - If is set to true, the JSON is auto-completed. - - - - - Writes the beginning of a JSON object. - - - - - Writes the end of a JSON object. - - - - - Writes the beginning of a JSON array. - - - - - Writes the end of an array. - - - - - Writes the start of a constructor with the given name. - - The name of the constructor. - - - - Writes the end constructor. - - - - - Writes the property name of a name/value pair of a JSON object. - - The name of the property. - - - - Writes the property name of a name/value pair of a JSON object. - - The name of the property. - A flag to indicate whether the text should be escaped when it is written as a JSON property name. - - - - Writes the end of the current JSON object or array. - - - - - Writes the current token and its children. - - The to read the token from. - - - - Writes the current token. - - The to read the token from. - A flag indicating whether the current token's children should be written. - - - - Writes the token and its value. - - The to write. - - The value to write. - A value is only required for tokens that have an associated value, e.g. the property name for . - null can be passed to the method for tokens that don't have a value, e.g. . - - - - - Writes the token. - - The to write. - - - - Writes the specified end token. - - The end token to write. - - - - Writes indent characters. - - - - - Writes the JSON value delimiter. - - - - - Writes an indent space. - - - - - Writes a null value. - - - - - Writes an undefined value. - - - - - Writes raw JSON without changing the writer's state. - - The raw JSON to write. - - - - Writes raw JSON where a value is expected and updates the writer's state. - - The raw JSON to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a of value. - - The of value to write. - - - - Writes a of value. - - The of value to write. - - - - Writes a of value. - - The of value to write. - - - - Writes a of value. - - The of value to write. - - - - Writes a of value. - - The of value to write. - - - - Writes a of value. - - The of value to write. - - - - Writes a of value. - - The of value to write. - - - - Writes a of value. - - The of value to write. - - - - Writes a of value. - - The of value to write. - - - - Writes a of value. - - The of value to write. - - - - Writes a of value. - - The of value to write. - - - - Writes a of value. - - The of value to write. - - - - Writes a of value. - - The of value to write. - - - - Writes a of value. - - The of value to write. - - - - Writes a of value. - - The of value to write. - - - - Writes a of value. - - The of value to write. - - - - Writes a of value. - - The of value to write. - - - - Writes a [] value. - - The [] value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - An error will raised if the value cannot be written as a single JSON token. - - The value to write. - - - - Writes a comment /*...*/ containing the specified text. - - Text to place inside the comment. - - - - Writes the given white space. - - The string of white space characters. - - - - Releases unmanaged and - optionally - managed resources. - - true to release both managed and unmanaged resources; false to release only unmanaged resources. - - - - Sets the state of the . - - The being written. - The value being written. - - - - The exception thrown when an error occurs while writing JSON text. - - - - - Gets the path to the JSON where the error occurred. - - The path to the JSON where the error occurred. - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class - with a specified error message. - - The error message that explains the reason for the exception. - - - - Initializes a new instance of the class - with a specified error message and a reference to the inner exception that is the cause of this exception. - - The error message that explains the reason for the exception. - The exception that is the cause of the current exception, or null if no inner exception is specified. - - - - Initializes a new instance of the class. - - The that holds the serialized object data about the exception being thrown. - The that contains contextual information about the source or destination. - The parameter is null. - The class name is null or is zero (0). - - - - Initializes a new instance of the class - with a specified error message, JSON path and a reference to the inner exception that is the cause of this exception. - - The error message that explains the reason for the exception. - The path to the JSON where the error occurred. - The exception that is the cause of the current exception, or null if no inner exception is specified. - - - - Specifies how JSON comments are handled when loading JSON. - - - - - Ignore comments. - - - - - Load comments as a with type . - - - - - Specifies how duplicate property names are handled when loading JSON. - - - - - Replace the existing value when there is a duplicate property. The value of the last property in the JSON object will be used. - - - - - Ignore the new value when there is a duplicate property. The value of the first property in the JSON object will be used. - - - - - Throw a when a duplicate property is encountered. - - - - - Contains the LINQ to JSON extension methods. - - - - - Returns a collection of tokens that contains the ancestors of every token in the source collection. - - The type of the objects in source, constrained to . - An of that contains the source collection. - An of that contains the ancestors of every token in the source collection. - - - - Returns a collection of tokens that contains every token in the source collection, and the ancestors of every token in the source collection. - - The type of the objects in source, constrained to . - An of that contains the source collection. - An of that contains every token in the source collection, the ancestors of every token in the source collection. - - - - Returns a collection of tokens that contains the descendants of every token in the source collection. - - The type of the objects in source, constrained to . - An of that contains the source collection. - An of that contains the descendants of every token in the source collection. - - - - Returns a collection of tokens that contains every token in the source collection, and the descendants of every token in the source collection. - - The type of the objects in source, constrained to . - An of that contains the source collection. - An of that contains every token in the source collection, and the descendants of every token in the source collection. - - - - Returns a collection of child properties of every object in the source collection. - - An of that contains the source collection. - An of that contains the properties of every object in the source collection. - - - - Returns a collection of child values of every object in the source collection with the given key. - - An of that contains the source collection. - The token key. - An of that contains the values of every token in the source collection with the given key. - - - - Returns a collection of child values of every object in the source collection. - - An of that contains the source collection. - An of that contains the values of every token in the source collection. - - - - Returns a collection of converted child values of every object in the source collection with the given key. - - The type to convert the values to. - An of that contains the source collection. - The token key. - An that contains the converted values of every token in the source collection with the given key. - - - - Returns a collection of converted child values of every object in the source collection. - - The type to convert the values to. - An of that contains the source collection. - An that contains the converted values of every token in the source collection. - - - - Converts the value. - - The type to convert the value to. - A cast as a of . - A converted value. - - - - Converts the value. - - The source collection type. - The type to convert the value to. - A cast as a of . - A converted value. - - - - Returns a collection of child tokens of every array in the source collection. - - The source collection type. - An of that contains the source collection. - An of that contains the values of every token in the source collection. - - - - Returns a collection of converted child tokens of every array in the source collection. - - An of that contains the source collection. - The type to convert the values to. - The source collection type. - An that contains the converted values of every token in the source collection. - - - - Returns the input typed as . - - An of that contains the source collection. - The input typed as . - - - - Returns the input typed as . - - The source collection type. - An of that contains the source collection. - The input typed as . - - - - Represents a collection of objects. - - The type of token. - - - - Gets the of with the specified key. - - - - - - Represents a JSON array. - - - - - - - - Writes this token to a asynchronously. - - A into which this method will write. - The token to monitor for cancellation requests. - A collection of which will be used when writing the token. - A that represents the asynchronous write operation. - - - - Asynchronously loads a from a . - - A that will be read for the content of the . - If this is null, default load settings will be used. - The token to monitor for cancellation requests. The default value is . - A representing the asynchronous load. The property contains the JSON that was read from the specified . - - - - Asynchronously loads a from a . - - A that will be read for the content of the . - The used to load the JSON. - If this is null, default load settings will be used. - The token to monitor for cancellation requests. The default value is . - A representing the asynchronous load. The property contains the JSON that was read from the specified . - - - - Gets the container's children tokens. - - The container's children tokens. - - - - Gets the node type for this . - - The type. - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class from another object. - - A object to copy from. - - - - Initializes a new instance of the class with the specified content. - - The contents of the array. - - - - Initializes a new instance of the class with the specified content. - - The contents of the array. - - - - Loads an from a . - - A that will be read for the content of the . - A that contains the JSON that was read from the specified . - - - - Loads an from a . - - A that will be read for the content of the . - The used to load the JSON. - If this is null, default load settings will be used. - A that contains the JSON that was read from the specified . - - - - Load a from a string that contains JSON. - - A that contains JSON. - A populated from the string that contains JSON. - - - - - - - Load a from a string that contains JSON. - - A that contains JSON. - The used to load the JSON. - If this is null, default load settings will be used. - A populated from the string that contains JSON. - - - - - - - Creates a from an object. - - The object that will be used to create . - A with the values of the specified object. - - - - Creates a from an object. - - The object that will be used to create . - The that will be used to read the object. - A with the values of the specified object. - - - - Writes this token to a . - - A into which this method will write. - A collection of which will be used when writing the token. - - - - Gets the with the specified key. - - The with the specified key. - - - - Gets or sets the at the specified index. - - - - - - Determines the index of a specific item in the . - - The object to locate in the . - - The index of if found in the list; otherwise, -1. - - - - - Inserts an item to the at the specified index. - - The zero-based index at which should be inserted. - The object to insert into the . - - is not a valid index in the . - - - - - Removes the item at the specified index. - - The zero-based index of the item to remove. - - is not a valid index in the . - - - - - Returns an enumerator that iterates through the collection. - - - A of that can be used to iterate through the collection. - - - - - Adds an item to the . - - The object to add to the . - - - - Removes all items from the . - - - - - Determines whether the contains a specific value. - - The object to locate in the . - - true if is found in the ; otherwise, false. - - - - - Copies the elements of the to an array, starting at a particular array index. - - The array. - Index of the array. - - - - Gets a value indicating whether the is read-only. - - true if the is read-only; otherwise, false. - - - - Removes the first occurrence of a specific object from the . - - The object to remove from the . - - true if was successfully removed from the ; otherwise, false. This method also returns false if is not found in the original . - - - - - Represents a JSON constructor. - - - - - Writes this token to a asynchronously. - - A into which this method will write. - The token to monitor for cancellation requests. - A collection of which will be used when writing the token. - A that represents the asynchronous write operation. - - - - Asynchronously loads a from a . - - A that will be read for the content of the . - The token to monitor for cancellation requests. The default value is . - - A that represents the asynchronous load. The - property returns a that contains the JSON that was read from the specified . - - - - Asynchronously loads a from a . - - A that will be read for the content of the . - The used to load the JSON. - If this is null, default load settings will be used. - The token to monitor for cancellation requests. The default value is . - - A that represents the asynchronous load. The - property returns a that contains the JSON that was read from the specified . - - - - Gets the container's children tokens. - - The container's children tokens. - - - - Gets or sets the name of this constructor. - - The constructor name. - - - - Gets the node type for this . - - The type. - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class from another object. - - A object to copy from. - - - - Initializes a new instance of the class with the specified name and content. - - The constructor name. - The contents of the constructor. - - - - Initializes a new instance of the class with the specified name and content. - - The constructor name. - The contents of the constructor. - - - - Initializes a new instance of the class with the specified name. - - The constructor name. - - - - Writes this token to a . - - A into which this method will write. - A collection of which will be used when writing the token. - - - - Gets the with the specified key. - - The with the specified key. - - - - Loads a from a . - - A that will be read for the content of the . - A that contains the JSON that was read from the specified . - - - - Loads a from a . - - A that will be read for the content of the . - The used to load the JSON. - If this is null, default load settings will be used. - A that contains the JSON that was read from the specified . - - - - Represents a token that can contain other tokens. - - - - - Occurs when the list changes or an item in the list changes. - - - - - Occurs before an item is added to the collection. - - - - - Occurs when the items list of the collection has changed, or the collection is reset. - - - - - Gets the container's children tokens. - - The container's children tokens. - - - - Raises the event. - - The instance containing the event data. - - - - Raises the event. - - The instance containing the event data. - - - - Raises the event. - - The instance containing the event data. - - - - Gets a value indicating whether this token has child tokens. - - - true if this token has child values; otherwise, false. - - - - - Get the first child token of this token. - - - A containing the first child token of the . - - - - - Get the last child token of this token. - - - A containing the last child token of the . - - - - - Returns a collection of the child tokens of this token, in document order. - - - An of containing the child tokens of this , in document order. - - - - - Returns a collection of the child values of this token, in document order. - - The type to convert the values to. - - A containing the child values of this , in document order. - - - - - Returns a collection of the descendant tokens for this token in document order. - - An of containing the descendant tokens of the . - - - - Returns a collection of the tokens that contain this token, and all descendant tokens of this token, in document order. - - An of containing this token, and all the descendant tokens of the . - - - - Adds the specified content as children of this . - - The content to be added. - - - - Adds the specified content as the first children of this . - - The content to be added. - - - - Creates a that can be used to add tokens to the . - - A that is ready to have content written to it. - - - - Replaces the child nodes of this token with the specified content. - - The content. - - - - Removes the child nodes from this token. - - - - - Merge the specified content into this . - - The content to be merged. - - - - Merge the specified content into this using . - - The content to be merged. - The used to merge the content. - - - - Gets the count of child JSON tokens. - - The count of child JSON tokens. - - - - Represents a collection of objects. - - The type of token. - - - - An empty collection of objects. - - - - - Initializes a new instance of the struct. - - The enumerable. - - - - Returns an enumerator that can be used to iterate through the collection. - - - A that can be used to iterate through the collection. - - - - - Gets the of with the specified key. - - - - - - Determines whether the specified is equal to this instance. - - The to compare with this instance. - - true if the specified is equal to this instance; otherwise, false. - - - - - Determines whether the specified is equal to this instance. - - The to compare with this instance. - - true if the specified is equal to this instance; otherwise, false. - - - - - Returns a hash code for this instance. - - - A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. - - - - - Represents a JSON object. - - - - - - - - Writes this token to a asynchronously. - - A into which this method will write. - The token to monitor for cancellation requests. - A collection of which will be used when writing the token. - A that represents the asynchronous write operation. - - - - Asynchronously loads a from a . - - A that will be read for the content of the . - The token to monitor for cancellation requests. The default value is . - - A that represents the asynchronous load. The - property returns a that contains the JSON that was read from the specified . - - - - Asynchronously loads a from a . - - A that will be read for the content of the . - The used to load the JSON. - If this is null, default load settings will be used. - The token to monitor for cancellation requests. The default value is . - - A that represents the asynchronous load. The - property returns a that contains the JSON that was read from the specified . - - - - Gets the container's children tokens. - - The container's children tokens. - - - - Occurs when a property value changes. - - - - - Occurs when a property value is changing. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class from another object. - - A object to copy from. - - - - Initializes a new instance of the class with the specified content. - - The contents of the object. - - - - Initializes a new instance of the class with the specified content. - - The contents of the object. - - - - Gets the node type for this . - - The type. - - - - Gets an of of this object's properties. - - An of of this object's properties. - - - - Gets a with the specified name. - - The property name. - A with the specified name or null. - - - - Gets the with the specified name. - The exact name will be searched for first and if no matching property is found then - the will be used to match a property. - - The property name. - One of the enumeration values that specifies how the strings will be compared. - A matched with the specified name or null. - - - - Gets a of of this object's property values. - - A of of this object's property values. - - - - Gets the with the specified key. - - The with the specified key. - - - - Gets or sets the with the specified property name. - - - - - - Loads a from a . - - A that will be read for the content of the . - A that contains the JSON that was read from the specified . - - is not valid JSON. - - - - - Loads a from a . - - A that will be read for the content of the . - The used to load the JSON. - If this is null, default load settings will be used. - A that contains the JSON that was read from the specified . - - is not valid JSON. - - - - - Load a from a string that contains JSON. - - A that contains JSON. - A populated from the string that contains JSON. - - is not valid JSON. - - - - - - - - Load a from a string that contains JSON. - - A that contains JSON. - The used to load the JSON. - If this is null, default load settings will be used. - A populated from the string that contains JSON. - - is not valid JSON. - - - - - - - - Creates a from an object. - - The object that will be used to create . - A with the values of the specified object. - - - - Creates a from an object. - - The object that will be used to create . - The that will be used to read the object. - A with the values of the specified object. - - - - Writes this token to a . - - A into which this method will write. - A collection of which will be used when writing the token. - - - - Gets the with the specified property name. - - Name of the property. - The with the specified property name. - - - - Gets the with the specified property name. - The exact property name will be searched for first and if no matching property is found then - the will be used to match a property. - - Name of the property. - One of the enumeration values that specifies how the strings will be compared. - The with the specified property name. - - - - Tries to get the with the specified property name. - The exact property name will be searched for first and if no matching property is found then - the will be used to match a property. - - Name of the property. - The value. - One of the enumeration values that specifies how the strings will be compared. - true if a value was successfully retrieved; otherwise, false. - - - - Adds the specified property name. - - Name of the property. - The value. - - - - Determines whether the JSON object has the specified property name. - - Name of the property. - true if the JSON object has the specified property name; otherwise, false. - - - - Removes the property with the specified name. - - Name of the property. - true if item was successfully removed; otherwise, false. - - - - Tries to get the with the specified property name. - - Name of the property. - The value. - true if a value was successfully retrieved; otherwise, false. - - - - Returns an enumerator that can be used to iterate through the collection. - - - A that can be used to iterate through the collection. - - - - - Raises the event with the provided arguments. - - Name of the property. - - - - Raises the event with the provided arguments. - - Name of the property. - - - - Returns the responsible for binding operations performed on this object. - - The expression tree representation of the runtime value. - - The to bind this object. - - - - - Represents a JSON property. - - - - - Writes this token to a asynchronously. - - A into which this method will write. - The token to monitor for cancellation requests. - A collection of which will be used when writing the token. - A that represents the asynchronous write operation. - - - - Asynchronously loads a from a . - - A that will be read for the content of the . - The token to monitor for cancellation requests. The default value is . - A representing the asynchronous creation. The - property returns a that contains the JSON that was read from the specified . - - - - Asynchronously loads a from a . - - A that will be read for the content of the . - The used to load the JSON. - If this is null, default load settings will be used. - The token to monitor for cancellation requests. The default value is . - A representing the asynchronous creation. The - property returns a that contains the JSON that was read from the specified . - - - - Gets the container's children tokens. - - The container's children tokens. - - - - Gets the property name. - - The property name. - - - - Gets or sets the property value. - - The property value. - - - - Initializes a new instance of the class from another object. - - A object to copy from. - - - - Gets the node type for this . - - The type. - - - - Initializes a new instance of the class. - - The property name. - The property content. - - - - Initializes a new instance of the class. - - The property name. - The property content. - - - - Writes this token to a . - - A into which this method will write. - A collection of which will be used when writing the token. - - - - Loads a from a . - - A that will be read for the content of the . - A that contains the JSON that was read from the specified . - - - - Loads a from a . - - A that will be read for the content of the . - The used to load the JSON. - If this is null, default load settings will be used. - A that contains the JSON that was read from the specified . - - - - Represents a view of a . - - - - - Initializes a new instance of the class. - - The name. - - - - When overridden in a derived class, returns whether resetting an object changes its value. - - - true if resetting the component changes its value; otherwise, false. - - The component to test for reset capability. - - - - When overridden in a derived class, gets the current value of the property on a component. - - - The value of a property for a given component. - - The component with the property for which to retrieve the value. - - - - When overridden in a derived class, resets the value for this property of the component to the default value. - - The component with the property value that is to be reset to the default value. - - - - When overridden in a derived class, sets the value of the component to a different value. - - The component with the property value that is to be set. - The new value. - - - - When overridden in a derived class, determines a value indicating whether the value of this property needs to be persisted. - - - true if the property should be persisted; otherwise, false. - - The component with the property to be examined for persistence. - - - - When overridden in a derived class, gets the type of the component this property is bound to. - - - A that represents the type of component this property is bound to. - When the or - - methods are invoked, the object specified might be an instance of this type. - - - - - When overridden in a derived class, gets a value indicating whether this property is read-only. - - - true if the property is read-only; otherwise, false. - - - - - When overridden in a derived class, gets the type of the property. - - - A that represents the type of the property. - - - - - Gets the hash code for the name of the member. - - - - The hash code for the name of the member. - - - - - Represents a raw JSON string. - - - - - Asynchronously creates an instance of with the content of the reader's current token. - - The reader. - The token to monitor for cancellation requests. The default value is . - A representing the asynchronous creation. The - property returns an instance of with the content of the reader's current token. - - - - Initializes a new instance of the class from another object. - - A object to copy from. - - - - Initializes a new instance of the class. - - The raw json. - - - - Creates an instance of with the content of the reader's current token. - - The reader. - An instance of with the content of the reader's current token. - - - - Specifies the settings used when cloning JSON. - - - - - Initializes a new instance of the class. - - - - - Gets or sets a flag that indicates whether to copy annotations when cloning a . - The default value is true. - - - A flag that indicates whether to copy annotations when cloning a . - - - - - Specifies the settings used when loading JSON. - - - - - Initializes a new instance of the class. - - - - - Gets or sets how JSON comments are handled when loading JSON. - The default value is . - - The JSON comment handling. - - - - Gets or sets how JSON line info is handled when loading JSON. - The default value is . - - The JSON line info handling. - - - - Gets or sets how duplicate property names in JSON objects are handled when loading JSON. - The default value is . - - The JSON duplicate property name handling. - - - - Specifies the settings used when merging JSON. - - - - - Initializes a new instance of the class. - - - - - Gets or sets the method used when merging JSON arrays. - - The method used when merging JSON arrays. - - - - Gets or sets how null value properties are merged. - - How null value properties are merged. - - - - Gets or sets the comparison used to match property names while merging. - The exact property name will be searched for first and if no matching property is found then - the will be used to match a property. - - The comparison used to match property names while merging. - - - - Specifies the settings used when selecting JSON. - - - - - Gets or sets a timeout that will be used when executing regular expressions. - - The timeout that will be used when executing regular expressions. - - - - Gets or sets a flag that indicates whether an error should be thrown if - no tokens are found when evaluating part of the expression. - - - A flag that indicates whether an error should be thrown if - no tokens are found when evaluating part of the expression. - - - - - Represents an abstract JSON token. - - - - - Writes this token to a asynchronously. - - A into which this method will write. - The token to monitor for cancellation requests. - A collection of which will be used when writing the token. - A that represents the asynchronous write operation. - - - - Writes this token to a asynchronously. - - A into which this method will write. - A collection of which will be used when writing the token. - A that represents the asynchronous write operation. - - - - Asynchronously creates a from a . - - An positioned at the token to read into this . - The token to monitor for cancellation requests. The default value is . - - A that represents the asynchronous creation. The - property returns a that contains - the token and its descendant tokens - that were read from the reader. The runtime type of the token is determined - by the token type of the first token encountered in the reader. - - - - - Asynchronously creates a from a . - - An positioned at the token to read into this . - The used to load the JSON. - If this is null, default load settings will be used. - The token to monitor for cancellation requests. The default value is . - - A that represents the asynchronous creation. The - property returns a that contains - the token and its descendant tokens - that were read from the reader. The runtime type of the token is determined - by the token type of the first token encountered in the reader. - - - - - Asynchronously creates a from a . - - A positioned at the token to read into this . - The token to monitor for cancellation requests. The default value is . - - A that represents the asynchronous creation. The - property returns a that contains the token and its descendant tokens - that were read from the reader. The runtime type of the token is determined - by the token type of the first token encountered in the reader. - - - - - Asynchronously creates a from a . - - A positioned at the token to read into this . - The used to load the JSON. - If this is null, default load settings will be used. - The token to monitor for cancellation requests. The default value is . - - A that represents the asynchronous creation. The - property returns a that contains the token and its descendant tokens - that were read from the reader. The runtime type of the token is determined - by the token type of the first token encountered in the reader. - - - - - Gets a comparer that can compare two tokens for value equality. - - A that can compare two nodes for value equality. - - - - Gets or sets the parent. - - The parent. - - - - Gets the root of this . - - The root of this . - - - - Gets the node type for this . - - The type. - - - - Gets a value indicating whether this token has child tokens. - - - true if this token has child values; otherwise, false. - - - - - Compares the values of two tokens, including the values of all descendant tokens. - - The first to compare. - The second to compare. - true if the tokens are equal; otherwise false. - - - - Gets the next sibling token of this node. - - The that contains the next sibling token. - - - - Gets the previous sibling token of this node. - - The that contains the previous sibling token. - - - - Gets the path of the JSON token. - - - - - Adds the specified content immediately after this token. - - A content object that contains simple content or a collection of content objects to be added after this token. - - - - Adds the specified content immediately before this token. - - A content object that contains simple content or a collection of content objects to be added before this token. - - - - Returns a collection of the ancestor tokens of this token. - - A collection of the ancestor tokens of this token. - - - - Returns a collection of tokens that contain this token, and the ancestors of this token. - - A collection of tokens that contain this token, and the ancestors of this token. - - - - Returns a collection of the sibling tokens after this token, in document order. - - A collection of the sibling tokens after this tokens, in document order. - - - - Returns a collection of the sibling tokens before this token, in document order. - - A collection of the sibling tokens before this token, in document order. - - - - Gets the with the specified key. - - The with the specified key. - - - - Gets the with the specified key converted to the specified type. - - The type to convert the token to. - The token key. - The converted token value. - - - - Get the first child token of this token. - - A containing the first child token of the . - - - - Get the last child token of this token. - - A containing the last child token of the . - - - - Returns a collection of the child tokens of this token, in document order. - - An of containing the child tokens of this , in document order. - - - - Returns a collection of the child tokens of this token, in document order, filtered by the specified type. - - The type to filter the child tokens on. - A containing the child tokens of this , in document order. - - - - Returns a collection of the child values of this token, in document order. - - The type to convert the values to. - A containing the child values of this , in document order. - - - - Removes this token from its parent. - - - - - Replaces this token with the specified token. - - The value. - - - - Writes this token to a . - - A into which this method will write. - A collection of which will be used when writing the token. - - - - Returns the indented JSON for this token. - - - ToString() returns a non-JSON string value for tokens with a type of . - If you want the JSON for all token types then you should use . - - - The indented JSON for this token. - - - - - Returns the JSON for this token using the given formatting and converters. - - Indicates how the output should be formatted. - A collection of s which will be used when writing the token. - The JSON for this token using the given formatting and converters. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to of . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to of . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to of . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to of . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to of . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to of . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to of . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to of . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to of . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to of . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to of . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to of . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to of . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to of . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to of . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to of . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to of . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to []. - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to of . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to of . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an implicit conversion from to . - - The value to create a from. - The initialized with the specified value. - - - - Performs an implicit conversion from to . - - The value to create a from. - The initialized with the specified value. - - - - Performs an implicit conversion from to . - - The value to create a from. - The initialized with the specified value. - - - - Performs an implicit conversion from of to . - - The value to create a from. - The initialized with the specified value. - - - - Performs an implicit conversion from to . - - The value to create a from. - The initialized with the specified value. - - - - Performs an implicit conversion from of to . - - The value to create a from. - The initialized with the specified value. - - - - Performs an implicit conversion from of to . - - The value to create a from. - The initialized with the specified value. - - - - Performs an implicit conversion from of to . - - The value to create a from. - The initialized with the specified value. - - - - Performs an implicit conversion from of to . - - The value to create a from. - The initialized with the specified value. - - - - Performs an implicit conversion from of to . - - The value to create a from. - The initialized with the specified value. - - - - Performs an implicit conversion from of to . - - The value to create a from. - The initialized with the specified value. - - - - Performs an implicit conversion from of to . - - The value to create a from. - The initialized with the specified value. - - - - Performs an implicit conversion from to . - - The value to create a from. - The initialized with the specified value. - - - - Performs an implicit conversion from to . - - The value to create a from. - The initialized with the specified value. - - - - Performs an implicit conversion from to . - - The value to create a from. - The initialized with the specified value. - - - - Performs an implicit conversion from of to . - - The value to create a from. - The initialized with the specified value. - - - - Performs an implicit conversion from to . - - The value to create a from. - The initialized with the specified value. - - - - Performs an implicit conversion from of to . - - The value to create a from. - The initialized with the specified value. - - - - Performs an implicit conversion from of to . - - The value to create a from. - The initialized with the specified value. - - - - Performs an implicit conversion from to . - - The value to create a from. - The initialized with the specified value. - - - - Performs an implicit conversion from of to . - - The value to create a from. - The initialized with the specified value. - - - - Performs an implicit conversion from of to . - - The value to create a from. - The initialized with the specified value. - - - - Performs an implicit conversion from of to . - - The value to create a from. - The initialized with the specified value. - - - - Performs an implicit conversion from of to . - - The value to create a from. - The initialized with the specified value. - - - - Performs an implicit conversion from to . - - The value to create a from. - The initialized with the specified value. - - - - Performs an implicit conversion from to . - - The value to create a from. - The initialized with the specified value. - - - - Performs an implicit conversion from to . - - The value to create a from. - The initialized with the specified value. - - - - Performs an implicit conversion from to . - - The value to create a from. - The initialized with the specified value. - - - - Performs an implicit conversion from to . - - The value to create a from. - The initialized with the specified value. - - - - Performs an implicit conversion from [] to . - - The value to create a from. - The initialized with the specified value. - - - - Performs an implicit conversion from to . - - The value to create a from. - The initialized with the specified value. - - - - Performs an implicit conversion from to . - - The value to create a from. - The initialized with the specified value. - - - - Performs an implicit conversion from of to . - - The value to create a from. - The initialized with the specified value. - - - - Performs an implicit conversion from to . - - The value to create a from. - The initialized with the specified value. - - - - Performs an implicit conversion from of to . - - The value to create a from. - The initialized with the specified value. - - - - Creates a for this token. - - A that can be used to read this token and its descendants. - - - - Creates a from an object. - - The object that will be used to create . - A with the value of the specified object. - - - - Creates a from an object using the specified . - - The object that will be used to create . - The that will be used when reading the object. - A with the value of the specified object. - - - - Creates an instance of the specified .NET type from the . - - The object type that the token will be deserialized to. - The new object created from the JSON value. - - - - Creates an instance of the specified .NET type from the . - - The object type that the token will be deserialized to. - The new object created from the JSON value. - - - - Creates an instance of the specified .NET type from the using the specified . - - The object type that the token will be deserialized to. - The that will be used when creating the object. - The new object created from the JSON value. - - - - Creates an instance of the specified .NET type from the using the specified . - - The object type that the token will be deserialized to. - The that will be used when creating the object. - The new object created from the JSON value. - - - - Creates a from a . - - A positioned at the token to read into this . - - A that contains the token and its descendant tokens - that were read from the reader. The runtime type of the token is determined - by the token type of the first token encountered in the reader. - - - - - Creates a from a . - - An positioned at the token to read into this . - The used to load the JSON. - If this is null, default load settings will be used. - - A that contains the token and its descendant tokens - that were read from the reader. The runtime type of the token is determined - by the token type of the first token encountered in the reader. - - - - - Load a from a string that contains JSON. - - A that contains JSON. - A populated from the string that contains JSON. - - - - Load a from a string that contains JSON. - - A that contains JSON. - The used to load the JSON. - If this is null, default load settings will be used. - A populated from the string that contains JSON. - - - - Creates a from a . - - A positioned at the token to read into this . - The used to load the JSON. - If this is null, default load settings will be used. - - A that contains the token and its descendant tokens - that were read from the reader. The runtime type of the token is determined - by the token type of the first token encountered in the reader. - - - - - Creates a from a . - - A positioned at the token to read into this . - - A that contains the token and its descendant tokens - that were read from the reader. The runtime type of the token is determined - by the token type of the first token encountered in the reader. - - - - - Selects a using a JSONPath expression. Selects the token that matches the object path. - - - A that contains a JSONPath expression. - - A , or null. - - - - Selects a using a JSONPath expression. Selects the token that matches the object path. - - - A that contains a JSONPath expression. - - A flag to indicate whether an error should be thrown if no tokens are found when evaluating part of the expression. - A . - - - - Selects a using a JSONPath expression. Selects the token that matches the object path. - - - A that contains a JSONPath expression. - - The used to select tokens. - A . - - - - Selects a collection of elements using a JSONPath expression. - - - A that contains a JSONPath expression. - - An of that contains the selected elements. - - - - Selects a collection of elements using a JSONPath expression. - - - A that contains a JSONPath expression. - - A flag to indicate whether an error should be thrown if no tokens are found when evaluating part of the expression. - An of that contains the selected elements. - - - - Selects a collection of elements using a JSONPath expression. - - - A that contains a JSONPath expression. - - The used to select tokens. - An of that contains the selected elements. - - - - Returns the responsible for binding operations performed on this object. - - The expression tree representation of the runtime value. - - The to bind this object. - - - - - Returns the responsible for binding operations performed on this object. - - The expression tree representation of the runtime value. - - The to bind this object. - - - - - Creates a new instance of the . All child tokens are recursively cloned. - - A new instance of the . - - - - Creates a new instance of the . All child tokens are recursively cloned. - - A object to configure cloning settings. - A new instance of the . - - - - Adds an object to the annotation list of this . - - The annotation to add. - - - - Get the first annotation object of the specified type from this . - - The type of the annotation to retrieve. - The first annotation object that matches the specified type, or null if no annotation is of the specified type. - - - - Gets the first annotation object of the specified type from this . - - The of the annotation to retrieve. - The first annotation object that matches the specified type, or null if no annotation is of the specified type. - - - - Gets a collection of annotations of the specified type for this . - - The type of the annotations to retrieve. - An that contains the annotations for this . - - - - Gets a collection of annotations of the specified type for this . - - The of the annotations to retrieve. - An of that contains the annotations that match the specified type for this . - - - - Removes the annotations of the specified type from this . - - The type of annotations to remove. - - - - Removes the annotations of the specified type from this . - - The of annotations to remove. - - - - Compares tokens to determine whether they are equal. - - - - - Determines whether the specified objects are equal. - - The first object of type to compare. - The second object of type to compare. - - true if the specified objects are equal; otherwise, false. - - - - - Returns a hash code for the specified object. - - The for which a hash code is to be returned. - A hash code for the specified object. - The type of is a reference type and is null. - - - - Represents a reader that provides fast, non-cached, forward-only access to serialized JSON data. - - - - - Gets the at the reader's current position. - - - - - Initializes a new instance of the class. - - The token to read from. - - - - Initializes a new instance of the class. - - The token to read from. - The initial path of the token. It is prepended to the returned . - - - - Reads the next JSON token from the underlying . - - - true if the next token was read successfully; false if there are no more tokens to read. - - - - - Gets the path of the current JSON token. - - - - - Specifies the type of token. - - - - - No token type has been set. - - - - - A JSON object. - - - - - A JSON array. - - - - - A JSON constructor. - - - - - A JSON object property. - - - - - A comment. - - - - - An integer value. - - - - - A float value. - - - - - A string value. - - - - - A boolean value. - - - - - A null value. - - - - - An undefined value. - - - - - A date value. - - - - - A raw JSON value. - - - - - A collection of bytes value. - - - - - A Guid value. - - - - - A Uri value. - - - - - A TimeSpan value. - - - - - Represents a writer that provides a fast, non-cached, forward-only way of generating JSON data. - - - - - Gets the at the writer's current position. - - - - - Gets the token being written. - - The token being written. - - - - Initializes a new instance of the class writing to the given . - - The container being written to. - - - - Initializes a new instance of the class. - - - - - Flushes whatever is in the buffer to the underlying . - - - - - Closes this writer. - If is set to true, the JSON is auto-completed. - - - Setting to true has no additional effect, since the underlying is a type that cannot be closed. - - - - - Writes the beginning of a JSON object. - - - - - Writes the beginning of a JSON array. - - - - - Writes the start of a constructor with the given name. - - The name of the constructor. - - - - Writes the end. - - The token. - - - - Writes the property name of a name/value pair on a JSON object. - - The name of the property. - - - - Writes a value. - An error will be raised if the value cannot be written as a single JSON token. - - The value to write. - - - - Writes a null value. - - - - - Writes an undefined value. - - - - - Writes raw JSON. - - The raw JSON to write. - - - - Writes a comment /*...*/ containing the specified text. - - Text to place inside the comment. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a [] value. - - The [] value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Represents a value in JSON (string, integer, date, etc). - - - - - Writes this token to a asynchronously. - - A into which this method will write. - The token to monitor for cancellation requests. - A collection of which will be used when writing the token. - A that represents the asynchronous write operation. - - - - Initializes a new instance of the class from another object. - - A object to copy from. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Gets a value indicating whether this token has child tokens. - - - true if this token has child values; otherwise, false. - - - - - Creates a comment with the given value. - - The value. - A comment with the given value. - - - - Creates a string with the given value. - - The value. - A string with the given value. - - - - Creates a null value. - - A null value. - - - - Creates a undefined value. - - A undefined value. - - - - Gets the node type for this . - - The type. - - - - Gets or sets the underlying token value. - - The underlying token value. - - - - Writes this token to a . - - A into which this method will write. - A collection of s which will be used when writing the token. - - - - Indicates whether the current object is equal to another object of the same type. - - - true if the current object is equal to the parameter; otherwise, false. - - An object to compare with this object. - - - - Determines whether the specified is equal to the current . - - The to compare with the current . - - true if the specified is equal to the current ; otherwise, false. - - - - - Serves as a hash function for a particular type. - - - A hash code for the current . - - - - - Returns a that represents this instance. - - - ToString() returns a non-JSON string value for tokens with a type of . - If you want the JSON for all token types then you should use . - - - A that represents this instance. - - - - - Returns a that represents this instance. - - The format. - - A that represents this instance. - - - - - Returns a that represents this instance. - - The format provider. - - A that represents this instance. - - - - - Returns a that represents this instance. - - The format. - The format provider. - - A that represents this instance. - - - - - Returns the responsible for binding operations performed on this object. - - The expression tree representation of the runtime value. - - The to bind this object. - - - - - Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object. - - An object to compare with this instance. - - A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has these meanings: - Value - Meaning - Less than zero - This instance is less than . - Zero - This instance is equal to . - Greater than zero - This instance is greater than . - - - is not of the same type as this instance. - - - - - Specifies how line information is handled when loading JSON. - - - - - Ignore line information. - - - - - Load line information. - - - - - Specifies how JSON arrays are merged together. - - - - Concatenate arrays. - - - Union arrays, skipping items that already exist. - - - Replace all array items. - - - Merge array items together, matched by index. - - - - Specifies how null value properties are merged. - - - - - The content's null value properties will be ignored during merging. - - - - - The content's null value properties will be merged. - - - - - Specifies the member serialization options for the . - - - - - All public members are serialized by default. Members can be excluded using or . - This is the default member serialization mode. - - - - - Only members marked with or are serialized. - This member serialization mode can also be set by marking the class with . - - - - - All public and private fields are serialized. Members can be excluded using or . - This member serialization mode can also be set by marking the class with - and setting IgnoreSerializableAttribute on to false. - - - - - Specifies metadata property handling options for the . - - - - - Read metadata properties located at the start of a JSON object. - - - - - Read metadata properties located anywhere in a JSON object. Note that this setting will impact performance. - - - - - Do not try to read metadata properties. - - - - - Specifies missing member handling options for the . - - - - - Ignore a missing member and do not attempt to deserialize it. - - - - - Throw a when a missing member is encountered during deserialization. - - - - - Specifies null value handling options for the . - - - - - - - - - Include null values when serializing and deserializing objects. - - - - - Ignore null values when serializing and deserializing objects. - - - - - Specifies how object creation is handled by the . - - - - - Reuse existing objects, create new objects when needed. - - - - - Only reuse existing objects. - - - - - Always create new objects. - - - - - Specifies reference handling options for the . - Note that references cannot be preserved when a value is set via a non-default constructor such as types that implement . - - - - - - - - Do not preserve references when serializing types. - - - - - Preserve references when serializing into a JSON object structure. - - - - - Preserve references when serializing into a JSON array structure. - - - - - Preserve references when serializing. - - - - - Specifies reference loop handling options for the . - - - - - Throw a when a loop is encountered. - - - - - Ignore loop references and do not serialize. - - - - - Serialize loop references. - - - - - Indicating whether a property is required. - - - - - The property is not required. The default state. - - - - - The property must be defined in JSON but can be a null value. - - - - - The property must be defined in JSON and cannot be a null value. - - - - - The property is not required but it cannot be a null value. - - - - - - Contains the JSON schema extension methods. - - - JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details. - - - - - - - Determines whether the is valid. - - - JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details. - - - The source to test. - The schema to test with. - - true if the specified is valid; otherwise, false. - - - - - - Determines whether the is valid. - - - JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details. - - - The source to test. - The schema to test with. - When this method returns, contains any error messages generated while validating. - - true if the specified is valid; otherwise, false. - - - - - - Validates the specified . - - - JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details. - - - The source to test. - The schema to test with. - - - - - Validates the specified . - - - JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details. - - - The source to test. - The schema to test with. - The validation event handler. - - - - - An in-memory representation of a JSON Schema. - - - JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details. - - - - - - Gets or sets the id. - - - - - Gets or sets the title. - - - - - Gets or sets whether the object is required. - - - - - Gets or sets whether the object is read-only. - - - - - Gets or sets whether the object is visible to users. - - - - - Gets or sets whether the object is transient. - - - - - Gets or sets the description of the object. - - - - - Gets or sets the types of values allowed by the object. - - The type. - - - - Gets or sets the pattern. - - The pattern. - - - - Gets or sets the minimum length. - - The minimum length. - - - - Gets or sets the maximum length. - - The maximum length. - - - - Gets or sets a number that the value should be divisible by. - - A number that the value should be divisible by. - - - - Gets or sets the minimum. - - The minimum. - - - - Gets or sets the maximum. - - The maximum. - - - - Gets or sets a flag indicating whether the value can not equal the number defined by the minimum attribute (). - - A flag indicating whether the value can not equal the number defined by the minimum attribute (). - - - - Gets or sets a flag indicating whether the value can not equal the number defined by the maximum attribute (). - - A flag indicating whether the value can not equal the number defined by the maximum attribute (). - - - - Gets or sets the minimum number of items. - - The minimum number of items. - - - - Gets or sets the maximum number of items. - - The maximum number of items. - - - - Gets or sets the of items. - - The of items. - - - - Gets or sets a value indicating whether items in an array are validated using the instance at their array position from . - - - true if items are validated using their array position; otherwise, false. - - - - - Gets or sets the of additional items. - - The of additional items. - - - - Gets or sets a value indicating whether additional items are allowed. - - - true if additional items are allowed; otherwise, false. - - - - - Gets or sets whether the array items must be unique. - - - - - Gets or sets the of properties. - - The of properties. - - - - Gets or sets the of additional properties. - - The of additional properties. - - - - Gets or sets the pattern properties. - - The pattern properties. - - - - Gets or sets a value indicating whether additional properties are allowed. - - - true if additional properties are allowed; otherwise, false. - - - - - Gets or sets the required property if this property is present. - - The required property if this property is present. - - - - Gets or sets the a collection of valid enum values allowed. - - A collection of valid enum values allowed. - - - - Gets or sets disallowed types. - - The disallowed types. - - - - Gets or sets the default value. - - The default value. - - - - Gets or sets the collection of that this schema extends. - - The collection of that this schema extends. - - - - Gets or sets the format. - - The format. - - - - Initializes a new instance of the class. - - - - - Reads a from the specified . - - The containing the JSON Schema to read. - The object representing the JSON Schema. - - - - Reads a from the specified . - - The containing the JSON Schema to read. - The to use when resolving schema references. - The object representing the JSON Schema. - - - - Load a from a string that contains JSON Schema. - - A that contains JSON Schema. - A populated from the string that contains JSON Schema. - - - - Load a from a string that contains JSON Schema using the specified . - - A that contains JSON Schema. - The resolver. - A populated from the string that contains JSON Schema. - - - - Writes this schema to a . - - A into which this method will write. - - - - Writes this schema to a using the specified . - - A into which this method will write. - The resolver used. - - - - Returns a that represents the current . - - - A that represents the current . - - - - - - Returns detailed information about the schema exception. - - - JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details. - - - - - - Gets the line number indicating where the error occurred. - - The line number indicating where the error occurred. - - - - Gets the line position indicating where the error occurred. - - The line position indicating where the error occurred. - - - - Gets the path to the JSON where the error occurred. - - The path to the JSON where the error occurred. - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class - with a specified error message. - - The error message that explains the reason for the exception. - - - - Initializes a new instance of the class - with a specified error message and a reference to the inner exception that is the cause of this exception. - - The error message that explains the reason for the exception. - The exception that is the cause of the current exception, or null if no inner exception is specified. - - - - Initializes a new instance of the class. - - The that holds the serialized object data about the exception being thrown. - The that contains contextual information about the source or destination. - The parameter is null. - The class name is null or is zero (0). - - - - - Generates a from a specified . - - - JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details. - - - - - - Gets or sets how undefined schemas are handled by the serializer. - - - - - Gets or sets the contract resolver. - - The contract resolver. - - - - Generate a from the specified type. - - The type to generate a from. - A generated from the specified type. - - - - Generate a from the specified type. - - The type to generate a from. - The used to resolve schema references. - A generated from the specified type. - - - - Generate a from the specified type. - - The type to generate a from. - Specify whether the generated root will be nullable. - A generated from the specified type. - - - - Generate a from the specified type. - - The type to generate a from. - The used to resolve schema references. - Specify whether the generated root will be nullable. - A generated from the specified type. - - - - - Resolves from an id. - - - JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details. - - - - - - Gets or sets the loaded schemas. - - The loaded schemas. - - - - Initializes a new instance of the class. - - - - - Gets a for the specified reference. - - The id. - A for the specified reference. - - - - - The value types allowed by the . - - - JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details. - - - - - - No type specified. - - - - - String type. - - - - - Float type. - - - - - Integer type. - - - - - Boolean type. - - - - - Object type. - - - - - Array type. - - - - - Null type. - - - - - Any type. - - - - - - Specifies undefined schema Id handling options for the . - - - JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details. - - - - - - Do not infer a schema Id. - - - - - Use the .NET type name as the schema Id. - - - - - Use the assembly qualified .NET type name as the schema Id. - - - - - - Returns detailed information related to the . - - - JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details. - - - - - - Gets the associated with the validation error. - - The JsonSchemaException associated with the validation error. - - - - Gets the path of the JSON location where the validation error occurred. - - The path of the JSON location where the validation error occurred. - - - - Gets the text description corresponding to the validation error. - - The text description. - - - - - Represents the callback method that will handle JSON schema validation events and the . - - - JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details. - - - - - - A camel case naming strategy. - - - - - Initializes a new instance of the class. - - - A flag indicating whether dictionary keys should be processed. - - - A flag indicating whether explicitly specified property names should be processed, - e.g. a property name customized with a . - - - - - Initializes a new instance of the class. - - - A flag indicating whether dictionary keys should be processed. - - - A flag indicating whether explicitly specified property names should be processed, - e.g. a property name customized with a . - - - A flag indicating whether extension data names should be processed. - - - - - Initializes a new instance of the class. - - - - - Resolves the specified property name. - - The property name to resolve. - The resolved property name. - - - - Resolves member mappings for a type, camel casing property names. - - - - - Initializes a new instance of the class. - - - - - Resolves the contract for a given type. - - The type to resolve a contract for. - The contract for a given type. - - - - Used by to resolve a for a given . - - - - - Gets a value indicating whether members are being get and set using dynamic code generation. - This value is determined by the runtime permissions available. - - - true if using dynamic code generation; otherwise, false. - - - - - Gets or sets the default members search flags. - - The default members search flags. - - - - Gets or sets a value indicating whether compiler generated members should be serialized. - - - true if serialized compiler generated members; otherwise, false. - - - - - Gets or sets a value indicating whether to ignore the interface when serializing and deserializing types. - - - true if the interface will be ignored when serializing and deserializing types; otherwise, false. - - - - - Gets or sets a value indicating whether to ignore the attribute when serializing and deserializing types. - - - true if the attribute will be ignored when serializing and deserializing types; otherwise, false. - - - - - Gets or sets a value indicating whether to ignore IsSpecified members when serializing and deserializing types. - - - true if the IsSpecified members will be ignored when serializing and deserializing types; otherwise, false. - - - - - Gets or sets a value indicating whether to ignore ShouldSerialize members when serializing and deserializing types. - - - true if the ShouldSerialize members will be ignored when serializing and deserializing types; otherwise, false. - - - - - Gets or sets the naming strategy used to resolve how property names and dictionary keys are serialized. - - The naming strategy used to resolve how property names and dictionary keys are serialized. - - - - Initializes a new instance of the class. - - - - - Resolves the contract for a given type. - - The type to resolve a contract for. - The contract for a given type. - - - - Gets the serializable members for the type. - - The type to get serializable members for. - The serializable members for the type. - - - - Creates a for the given type. - - Type of the object. - A for the given type. - - - - Creates the constructor parameters. - - The constructor to create properties for. - The type's member properties. - Properties for the given . - - - - Creates a for the given . - - The matching member property. - The constructor parameter. - A created for the given . - - - - Resolves the default for the contract. - - Type of the object. - The contract's default . - - - - Creates a for the given type. - - Type of the object. - A for the given type. - - - - Creates a for the given type. - - Type of the object. - A for the given type. - - - - Creates a for the given type. - - Type of the object. - A for the given type. - - - - Creates a for the given type. - - Type of the object. - A for the given type. - - - - Creates a for the given type. - - Type of the object. - A for the given type. - - - - Creates a for the given type. - - Type of the object. - A for the given type. - - - - Creates a for the given type. - - Type of the object. - A for the given type. - - - - Determines which contract type is created for the given type. - - Type of the object. - A for the given type. - - - - Creates properties for the given . - - The type to create properties for. - /// The member serialization mode for the type. - Properties for the given . - - - - Creates the used by the serializer to get and set values from a member. - - The member. - The used by the serializer to get and set values from a member. - - - - Creates a for the given . - - The member's parent . - The member to create a for. - A created for the given . - - - - Resolves the name of the property. - - Name of the property. - Resolved name of the property. - - - - Resolves the name of the extension data. By default no changes are made to extension data names. - - Name of the extension data. - Resolved name of the extension data. - - - - Resolves the key of the dictionary. By default is used to resolve dictionary keys. - - Key of the dictionary. - Resolved key of the dictionary. - - - - Gets the resolved name of the property. - - Name of the property. - Name of the property. - - - - The default naming strategy. Property names and dictionary keys are unchanged. - - - - - Resolves the specified property name. - - The property name to resolve. - The resolved property name. - - - - The default serialization binder used when resolving and loading classes from type names. - - - - - Initializes a new instance of the class. - - - - - When overridden in a derived class, controls the binding of a serialized object to a type. - - Specifies the name of the serialized object. - Specifies the name of the serialized object. - - The type of the object the formatter creates a new instance of. - - - - - When overridden in a derived class, controls the binding of a serialized object to a type. - - The type of the object the formatter creates a new instance of. - Specifies the name of the serialized object. - Specifies the name of the serialized object. - - - - Represents a trace writer that writes to the application's instances. - - - - - Gets the that will be used to filter the trace messages passed to the writer. - For example a filter level of will exclude messages and include , - and messages. - - - The that will be used to filter the trace messages passed to the writer. - - - - - Writes the specified trace level, message and optional exception. - - The at which to write this trace. - The trace message. - The trace exception. This parameter is optional. - - - - Get and set values for a using dynamic methods. - - - - - Initializes a new instance of the class. - - The member info. - - - - Sets the value. - - The target to set the value on. - The value to set on the target. - - - - Gets the value. - - The target to get the value from. - The value. - - - - Provides information surrounding an error. - - - - - Gets the error. - - The error. - - - - Gets the original object that caused the error. - - The original object that caused the error. - - - - Gets the member that caused the error. - - The member that caused the error. - - - - Gets the path of the JSON location where the error occurred. - - The path of the JSON location where the error occurred. - - - - Gets or sets a value indicating whether this is handled. - - true if handled; otherwise, false. - - - - Provides data for the Error event. - - - - - Gets the current object the error event is being raised against. - - The current object the error event is being raised against. - - - - Gets the error context. - - The error context. - - - - Initializes a new instance of the class. - - The current object. - The error context. - - - - Get and set values for a using dynamic methods. - - - - - Initializes a new instance of the class. - - The member info. - - - - Sets the value. - - The target to set the value on. - The value to set on the target. - - - - Gets the value. - - The target to get the value from. - The value. - - - - Provides methods to get attributes. - - - - - Returns a collection of all of the attributes, or an empty collection if there are no attributes. - - When true, look up the hierarchy chain for the inherited custom attribute. - A collection of s, or an empty collection. - - - - Returns a collection of attributes, identified by type, or an empty collection if there are no attributes. - - The type of the attributes. - When true, look up the hierarchy chain for the inherited custom attribute. - A collection of s, or an empty collection. - - - - Used by to resolve a for a given . - - - - - - - - - Resolves the contract for a given type. - - The type to resolve a contract for. - The contract for a given type. - - - - Used to resolve references when serializing and deserializing JSON by the . - - - - - Resolves a reference to its object. - - The serialization context. - The reference to resolve. - The object that was resolved from the reference. - - - - Gets the reference for the specified object. - - The serialization context. - The object to get a reference for. - The reference to the object. - - - - Determines whether the specified object is referenced. - - The serialization context. - The object to test for a reference. - - true if the specified object is referenced; otherwise, false. - - - - - Adds a reference to the specified object. - - The serialization context. - The reference. - The object to reference. - - - - Allows users to control class loading and mandate what class to load. - - - - - When implemented, controls the binding of a serialized object to a type. - - Specifies the name of the serialized object. - Specifies the name of the serialized object - The type of the object the formatter creates a new instance of. - - - - When implemented, controls the binding of a serialized object to a type. - - The type of the object the formatter creates a new instance of. - Specifies the name of the serialized object. - Specifies the name of the serialized object. - - - - Represents a trace writer. - - - - - Gets the that will be used to filter the trace messages passed to the writer. - For example a filter level of will exclude messages and include , - and messages. - - The that will be used to filter the trace messages passed to the writer. - - - - Writes the specified trace level, message and optional exception. - - The at which to write this trace. - The trace message. - The trace exception. This parameter is optional. - - - - Provides methods to get and set values. - - - - - Sets the value. - - The target to set the value on. - The value to set on the target. - - - - Gets the value. - - The target to get the value from. - The value. - - - - Contract details for a used by the . - - - - - Gets the of the collection items. - - The of the collection items. - - - - Gets a value indicating whether the collection type is a multidimensional array. - - true if the collection type is a multidimensional array; otherwise, false. - - - - Gets or sets the function used to create the object. When set this function will override . - - The function used to create the object. - - - - Gets a value indicating whether the creator has a parameter with the collection values. - - true if the creator has a parameter with the collection values; otherwise, false. - - - - Initializes a new instance of the class. - - The underlying type for the contract. - - - - Contract details for a used by the . - - - - - Gets or sets the default collection items . - - The converter. - - - - Gets or sets a value indicating whether the collection items preserve object references. - - true if collection items preserve object references; otherwise, false. - - - - Gets or sets the collection item reference loop handling. - - The reference loop handling. - - - - Gets or sets the collection item type name handling. - - The type name handling. - - - - Initializes a new instance of the class. - - The underlying type for the contract. - - - - Handles serialization callback events. - - The object that raised the callback event. - The streaming context. - - - - Handles serialization error callback events. - - The object that raised the callback event. - The streaming context. - The error context. - - - - Sets extension data for an object during deserialization. - - The object to set extension data on. - The extension data key. - The extension data value. - - - - Gets extension data for an object during serialization. - - The object to set extension data on. - - - - Contract details for a used by the . - - - - - Gets the underlying type for the contract. - - The underlying type for the contract. - - - - Gets or sets the type created during deserialization. - - The type created during deserialization. - - - - Gets or sets whether this type contract is serialized as a reference. - - Whether this type contract is serialized as a reference. - - - - Gets or sets the default for this contract. - - The converter. - - - - Gets the internally resolved for the contract's type. - This converter is used as a fallback converter when no other converter is resolved. - Setting will always override this converter. - - - - - Gets or sets all methods called immediately after deserialization of the object. - - The methods called immediately after deserialization of the object. - - - - Gets or sets all methods called during deserialization of the object. - - The methods called during deserialization of the object. - - - - Gets or sets all methods called after serialization of the object graph. - - The methods called after serialization of the object graph. - - - - Gets or sets all methods called before serialization of the object. - - The methods called before serialization of the object. - - - - Gets or sets all method called when an error is thrown during the serialization of the object. - - The methods called when an error is thrown during the serialization of the object. - - - - Gets or sets the default creator method used to create the object. - - The default creator method used to create the object. - - - - Gets or sets a value indicating whether the default creator is non-public. - - true if the default object creator is non-public; otherwise, false. - - - - Contract details for a used by the . - - - - - Gets or sets the dictionary key resolver. - - The dictionary key resolver. - - - - Gets the of the dictionary keys. - - The of the dictionary keys. - - - - Gets the of the dictionary values. - - The of the dictionary values. - - - - Gets or sets the function used to create the object. When set this function will override . - - The function used to create the object. - - - - Gets a value indicating whether the creator has a parameter with the dictionary values. - - true if the creator has a parameter with the dictionary values; otherwise, false. - - - - Initializes a new instance of the class. - - The underlying type for the contract. - - - - Contract details for a used by the . - - - - - Gets the object's properties. - - The object's properties. - - - - Gets or sets the property name resolver. - - The property name resolver. - - - - Initializes a new instance of the class. - - The underlying type for the contract. - - - - Contract details for a used by the . - - - - - Gets or sets the object constructor. - - The object constructor. - - - - Initializes a new instance of the class. - - The underlying type for the contract. - - - - Contract details for a used by the . - - - - - Initializes a new instance of the class. - - The underlying type for the contract. - - - - Contract details for a used by the . - - - - - Gets or sets the object member serialization. - - The member object serialization. - - - - Gets or sets the missing member handling used when deserializing this object. - - The missing member handling. - - - - Gets or sets a value that indicates whether the object's properties are required. - - - A value indicating whether the object's properties are required. - - - - - Gets or sets how the object's properties with null values are handled during serialization and deserialization. - - How the object's properties with null values are handled during serialization and deserialization. - - - - Gets the object's properties. - - The object's properties. - - - - Gets a collection of instances that define the parameters used with . - - - - - Gets or sets the function used to create the object. When set this function will override . - This function is called with a collection of arguments which are defined by the collection. - - The function used to create the object. - - - - Gets or sets the extension data setter. - - - - - Gets or sets the extension data getter. - - - - - Gets or sets the extension data value type. - - - - - Gets or sets the extension data name resolver. - - The extension data name resolver. - - - - Initializes a new instance of the class. - - The underlying type for the contract. - - - - Contract details for a used by the . - - - - - Initializes a new instance of the class. - - The underlying type for the contract. - - - - Maps a JSON property to a .NET member or constructor parameter. - - - - - Gets or sets the name of the property. - - The name of the property. - - - - Gets or sets the type that declared this property. - - The type that declared this property. - - - - Gets or sets the order of serialization of a member. - - The numeric order of serialization. - - - - Gets or sets the name of the underlying member or parameter. - - The name of the underlying member or parameter. - - - - Gets the that will get and set the during serialization. - - The that will get and set the during serialization. - - - - Gets or sets the for this property. - - The for this property. - - - - Gets or sets the type of the property. - - The type of the property. - - - - Gets or sets the for the property. - If set this converter takes precedence over the contract converter for the property type. - - The converter. - - - - Gets or sets the member converter. - - The member converter. - - - - Gets or sets a value indicating whether this is ignored. - - true if ignored; otherwise, false. - - - - Gets or sets a value indicating whether this is readable. - - true if readable; otherwise, false. - - - - Gets or sets a value indicating whether this is writable. - - true if writable; otherwise, false. - - - - Gets or sets a value indicating whether this has a member attribute. - - true if has a member attribute; otherwise, false. - - - - Gets the default value. - - The default value. - - - - Gets or sets a value indicating whether this is required. - - A value indicating whether this is required. - - - - Gets a value indicating whether has a value specified. - - - - - Gets or sets a value indicating whether this property preserves object references. - - - true if this instance is reference; otherwise, false. - - - - - Gets or sets the property null value handling. - - The null value handling. - - - - Gets or sets the property default value handling. - - The default value handling. - - - - Gets or sets the property reference loop handling. - - The reference loop handling. - - - - Gets or sets the property object creation handling. - - The object creation handling. - - - - Gets or sets or sets the type name handling. - - The type name handling. - - - - Gets or sets a predicate used to determine whether the property should be serialized. - - A predicate used to determine whether the property should be serialized. - - - - Gets or sets a predicate used to determine whether the property should be deserialized. - - A predicate used to determine whether the property should be deserialized. - - - - Gets or sets a predicate used to determine whether the property should be serialized. - - A predicate used to determine whether the property should be serialized. - - - - Gets or sets an action used to set whether the property has been deserialized. - - An action used to set whether the property has been deserialized. - - - - Returns a that represents this instance. - - - A that represents this instance. - - - - - Gets or sets the converter used when serializing the property's collection items. - - The collection's items converter. - - - - Gets or sets whether this property's collection items are serialized as a reference. - - Whether this property's collection items are serialized as a reference. - - - - Gets or sets the type name handling used when serializing the property's collection items. - - The collection's items type name handling. - - - - Gets or sets the reference loop handling used when serializing the property's collection items. - - The collection's items reference loop handling. - - - - A collection of objects. - - - - - Initializes a new instance of the class. - - The type. - - - - When implemented in a derived class, extracts the key from the specified element. - - The element from which to extract the key. - The key for the specified element. - - - - Adds a object. - - The property to add to the collection. - - - - Gets the closest matching object. - First attempts to get an exact case match of and then - a case insensitive match. - - Name of the property. - A matching property if found. - - - - Gets a property by property name. - - The name of the property to get. - Type property name string comparison. - A matching property if found. - - - - Contract details for a used by the . - - - - - Initializes a new instance of the class. - - The underlying type for the contract. - - - - Lookup and create an instance of the type described by the argument. - - The type to create. - Optional arguments to pass to an initializing constructor of the JsonConverter. - If null, the default constructor is used. - - - - A kebab case naming strategy. - - - - - Initializes a new instance of the class. - - - A flag indicating whether dictionary keys should be processed. - - - A flag indicating whether explicitly specified property names should be processed, - e.g. a property name customized with a . - - - - - Initializes a new instance of the class. - - - A flag indicating whether dictionary keys should be processed. - - - A flag indicating whether explicitly specified property names should be processed, - e.g. a property name customized with a . - - - A flag indicating whether extension data names should be processed. - - - - - Initializes a new instance of the class. - - - - - Resolves the specified property name. - - The property name to resolve. - The resolved property name. - - - - Represents a trace writer that writes to memory. When the trace message limit is - reached then old trace messages will be removed as new messages are added. - - - - - Gets the that will be used to filter the trace messages passed to the writer. - For example a filter level of will exclude messages and include , - and messages. - - - The that will be used to filter the trace messages passed to the writer. - - - - - Initializes a new instance of the class. - - - - - Writes the specified trace level, message and optional exception. - - The at which to write this trace. - The trace message. - The trace exception. This parameter is optional. - - - - Returns an enumeration of the most recent trace messages. - - An enumeration of the most recent trace messages. - - - - Returns a of the most recent trace messages. - - - A of the most recent trace messages. - - - - - A base class for resolving how property names and dictionary keys are serialized. - - - - - A flag indicating whether dictionary keys should be processed. - Defaults to false. - - - - - A flag indicating whether extension data names should be processed. - Defaults to false. - - - - - A flag indicating whether explicitly specified property names, - e.g. a property name customized with a , should be processed. - Defaults to false. - - - - - Gets the serialized name for a given property name. - - The initial property name. - A flag indicating whether the property has had a name explicitly specified. - The serialized property name. - - - - Gets the serialized name for a given extension data name. - - The initial extension data name. - The serialized extension data name. - - - - Gets the serialized key for a given dictionary key. - - The initial dictionary key. - The serialized dictionary key. - - - - Resolves the specified property name. - - The property name to resolve. - The resolved property name. - - - - Hash code calculation - - - - - - Object equality implementation - - - - - - - Compare to another NamingStrategy - - - - - - - Represents a method that constructs an object. - - The object type to create. - - - - When applied to a method, specifies that the method is called when an error occurs serializing an object. - - - - - Provides methods to get attributes from a , , or . - - - - - Initializes a new instance of the class. - - The instance to get attributes for. This parameter should be a , , or . - - - - Returns a collection of all of the attributes, or an empty collection if there are no attributes. - - When true, look up the hierarchy chain for the inherited custom attribute. - A collection of s, or an empty collection. - - - - Returns a collection of attributes, identified by type, or an empty collection if there are no attributes. - - The type of the attributes. - When true, look up the hierarchy chain for the inherited custom attribute. - A collection of s, or an empty collection. - - - - Get and set values for a using reflection. - - - - - Initializes a new instance of the class. - - The member info. - - - - Sets the value. - - The target to set the value on. - The value to set on the target. - - - - Gets the value. - - The target to get the value from. - The value. - - - - A snake case naming strategy. - - - - - Initializes a new instance of the class. - - - A flag indicating whether dictionary keys should be processed. - - - A flag indicating whether explicitly specified property names should be processed, - e.g. a property name customized with a . - - - - - Initializes a new instance of the class. - - - A flag indicating whether dictionary keys should be processed. - - - A flag indicating whether explicitly specified property names should be processed, - e.g. a property name customized with a . - - - A flag indicating whether extension data names should be processed. - - - - - Initializes a new instance of the class. - - - - - Resolves the specified property name. - - The property name to resolve. - The resolved property name. - - - - Specifies how strings are escaped when writing JSON text. - - - - - Only control characters (e.g. newline) are escaped. - - - - - All non-ASCII and control characters (e.g. newline) are escaped. - - - - - HTML (<, >, &, ', ") and control characters (e.g. newline) are escaped. - - - - - Indicates the method that will be used during deserialization for locating and loading assemblies. - - - - - In simple mode, the assembly used during deserialization need not match exactly the assembly used during serialization. Specifically, the version numbers need not match as the LoadWithPartialName method of the class is used to load the assembly. - - - - - In full mode, the assembly used during deserialization must match exactly the assembly used during serialization. The Load method of the class is used to load the assembly. - - - - - Specifies type name handling options for the . - - - should be used with caution when your application deserializes JSON from an external source. - Incoming types should be validated with a custom - when deserializing with a value other than . - - - - - Do not include the .NET type name when serializing types. - - - - - Include the .NET type name when serializing into a JSON object structure. - - - - - Include the .NET type name when serializing into a JSON array structure. - - - - - Always include the .NET type name when serializing. - - - - - Include the .NET type name when the type of the object being serialized is not the same as its declared type. - Note that this doesn't include the root serialized object by default. To include the root object's type name in JSON - you must specify a root type object with - or . - - - - - Determines whether the collection is null or empty. - - The collection. - - true if the collection is null or empty; otherwise, false. - - - - - Adds the elements of the specified collection to the specified generic . - - The list to add to. - The collection of elements to add. - - - - Converts the value to the specified type. If the value is unable to be converted, the - value is checked whether it assignable to the specified type. - - The value to convert. - The culture to use when converting. - The type to convert or cast the value to. - - The converted type. If conversion was unsuccessful, the initial value - is returned if assignable to the target type. - - - - - Helper method for generating a MetaObject which calls a - specific method on Dynamic that returns a result - - - - - Helper method for generating a MetaObject which calls a - specific method on Dynamic, but uses one of the arguments for - the result. - - - - - Helper method for generating a MetaObject which calls a - specific method on Dynamic, but uses one of the arguments for - the result. - - - - - Returns a Restrictions object which includes our current restrictions merged - with a restriction limiting our type - - - - - Helper class for serializing immutable collections. - Note that this is used by all builds, even those that don't support immutable collections, in case the DLL is GACed - https://github.com/JamesNK/Newtonsoft.Json/issues/652 - - - - - Gets the type of the typed collection's items. - - The type. - The type of the typed collection's items. - - - - Gets the member's underlying type. - - The member. - The underlying type of the member. - - - - Determines whether the property is an indexed property. - - The property. - - true if the property is an indexed property; otherwise, false. - - - - - Gets the member's value on the object. - - The member. - The target object. - The member's value on the object. - - - - Sets the member's value on the target object. - - The member. - The target. - The value. - - - - Determines whether the specified MemberInfo can be read. - - The MemberInfo to determine whether can be read. - /// if set to true then allow the member to be gotten non-publicly. - - true if the specified MemberInfo can be read; otherwise, false. - - - - - Determines whether the specified MemberInfo can be set. - - The MemberInfo to determine whether can be set. - if set to true then allow the member to be set non-publicly. - if set to true then allow the member to be set if read-only. - - true if the specified MemberInfo can be set; otherwise, false. - - - - - Builds a string. Unlike this class lets you reuse its internal buffer. - - - - - Determines whether the string is all white space. Empty string will return false. - - The string to test whether it is all white space. - - true if the string is all white space; otherwise, false. - - - - - Specifies the state of the . - - - - - An exception has been thrown, which has left the in an invalid state. - You may call the method to put the in the Closed state. - Any other method calls result in an being thrown. - - - - - The method has been called. - - - - - An object is being written. - - - - - An array is being written. - - - - - A constructor is being written. - - - - - A property is being written. - - - - - A write method has not been called. - - - - Specifies that an output will not be null even if the corresponding type allows it. - - - Specifies that when a method returns , the parameter will not be null even if the corresponding type allows it. - - - Initializes the attribute with the specified return value condition. - - The return value condition. If the method returns this value, the associated parameter will not be null. - - - - Gets the return value condition. - - - Specifies that an output may be null even if the corresponding type disallows it. - - - Specifies that null is allowed as an input even if the corresponding type disallows it. - - - - Specifies that the method will not return if the associated Boolean parameter is passed the specified value. - - - - - Initializes a new instance of the class. - - - The condition parameter value. Code after the method will be considered unreachable by diagnostics if the argument to - the associated parameter matches this value. - - - - Gets the condition parameter value. - - - diff --git a/LeatherProject/GeBoShi/bin/Debug/e1.ico b/LeatherProject/GeBoShi/bin/Debug/e1.ico new file mode 100644 index 0000000..9db3674 Binary files /dev/null and b/LeatherProject/GeBoShi/bin/Debug/e1.ico differ diff --git a/LeatherProject/GeBoShi/e1.ico b/LeatherProject/GeBoShi/e1.ico new file mode 100644 index 0000000..9db3674 Binary files /dev/null and b/LeatherProject/GeBoShi/e1.ico differ diff --git a/LeatherProject/GeBoShi/obj/Debug/GeBoShi.UI.SysSet.SysSetFrm.resources b/LeatherProject/GeBoShi/obj/Debug/GeBoShi.UI.SysSet.SysSetFrm.resources index 24458af..c34d554 100644 Binary files a/LeatherProject/GeBoShi/obj/Debug/GeBoShi.UI.SysSet.SysSetFrm.resources and b/LeatherProject/GeBoShi/obj/Debug/GeBoShi.UI.SysSet.SysSetFrm.resources differ diff --git a/LeatherProject/GeBoShi/obj/Debug/GeBoShi.csproj.FileListAbsolute.txt b/LeatherProject/GeBoShi/obj/Debug/GeBoShi.csproj.FileListAbsolute.txt index ebd06cd..621172a 100644 --- a/LeatherProject/GeBoShi/obj/Debug/GeBoShi.csproj.FileListAbsolute.txt +++ b/LeatherProject/GeBoShi/obj/Debug/GeBoShi.csproj.FileListAbsolute.txt @@ -3,10 +3,8 @@ E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\GeBoShi\bin\ E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\GeBoShi\bin\Debug\GeBoShi.pdb E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\GeBoShi\bin\Debug\CSkin.dll E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\GeBoShi\bin\Debug\MaiMuControl.dll -E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\GeBoShi\bin\Debug\S7.Net.dll E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\GeBoShi\bin\Debug\MQTTnet.dll E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\GeBoShi\bin\Debug\ImageBox.dll -E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\GeBoShi\bin\Debug\halcondotnet.dll E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\GeBoShi\bin\Debug\OpenCvSharp.dll E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\GeBoShi\bin\Debug\Yolo5.dll E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\GeBoShi\bin\Debug\Newtonsoft.Json.dll @@ -40,7 +38,6 @@ E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\GeBoShi\bin\ E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\GeBoShi\bin\Debug\ImageBox.xml E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\GeBoShi\bin\Debug\ImageBox.dll.config E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\GeBoShi\bin\Debug\OpenCvSharp.xml -E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\GeBoShi\bin\Debug\Newtonsoft.Json.xml E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\GeBoShi\bin\Debug\BouncyCastle.Crypto.xml E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\GeBoShi\bin\Debug\MySql.Data.xml E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\GeBoShi\bin\Debug\System.Memory.xml @@ -84,3 +81,4 @@ E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\GeBoShi\obj\ E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\GeBoShi\obj\Debug\GeBoShi.UI.Product.ProductListFrm.resources E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\GeBoShi\bin\Debug\BouncyCastle.Cryptography.dll E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\GeBoShi\bin\Debug\BouncyCastle.Cryptography.xml +E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\GeBoShi\bin\Debug\SixLabors.Fonts.dll diff --git a/LeatherProject/GeBoShi/obj/Debug/GeBoShi.exe.config b/LeatherProject/GeBoShi/obj/Debug/GeBoShi.exe.config index 24f7929..a4b9d2b 100644 --- a/LeatherProject/GeBoShi/obj/Debug/GeBoShi.exe.config +++ b/LeatherProject/GeBoShi/obj/Debug/GeBoShi.exe.config @@ -4,12 +4,30 @@ + + + + + + + + + + + + + + + + + + @@ -22,12 +40,6 @@ - - - - - - diff --git a/LeatherProject/LeatherApp/Device/DefectLib.cs b/LeatherProject/LeatherApp/Device/DefectLib.cs index 8a18768..aa00ad4 100644 --- a/LeatherProject/LeatherApp/Device/DefectLib.cs +++ b/LeatherProject/LeatherApp/Device/DefectLib.cs @@ -14,6 +14,7 @@ using LeatherApp.Utils; using Models; using OpenCvSharp; using OpenCvSharp.Extensions; +using SqlSugar; namespace LeatherApp.Device { @@ -97,6 +98,17 @@ namespace LeatherApp.Device } public bool start() { + List DefectLabelInfoList = new List(); + DefectLabelInfoList.Add(new DefectLabelInfo() { x = 1953, y = 429, w = 200, h = 200, classId = 1, confidence = 0.8, contrast = 0.9, i = 0, j = 0 }); + DefectLabelInfoList.Add(new DefectLabelInfo() {x = 1953,y = 929,w=900,h = 400,classId = 11,confidence = 0.8, contrast = 0.9, i = 0,j = 0 }); + DefectLabelInfoList.Add(new DefectLabelInfo() { x = 3169, y = 1029, w = 900, h = 400, classId = 11, confidence = 0.8, contrast = 0.9, i = 1, j = 0 }); + DefectLabelInfoList.Add(new DefectLabelInfo() { x = 4721, y = 919, w = 900, h = 400, classId = 11, confidence = 0.8, contrast = 0.9, i = 2, j = 0 }); + DefectLabelInfoList.Add(new DefectLabelInfo() { x = 6145, y = 829, w = 900, h = 400, classId = 11, confidence = 0.8, contrast = 0.9, i = 3, j = 0 }); + DefectLabelInfoList.Add(new DefectLabelInfo() { x = 8073, y = 929, w = 900, h = 400, classId = 11, confidence = 0.8, contrast = 0.9, i = 4, j = 0 }); + DefectLabelInfoList.Add(new DefectLabelInfo() { x = 9407, y = 929, w = 900, h = 400, classId = 11, confidence = 0.8, contrast = 0.9, i = 5, j = 0 }); + DefectLabelInfoList.Add(new DefectLabelInfo() { x = 10801, y = 999, w = 900, h = 400, classId = 11, confidence = 0.8, contrast = 0.9, i = 6, j = 0 }); + DefectLabelInfoList.Add(new DefectLabelInfo() { x = 12465, y = 629, w = 900, h = 800, classId = 11, confidence = 0.8, contrast = 0.9, i = 7, j = 0 }); + DefectLabelInfoList = HeBingDefect(16384, DefectLabelInfoList); try { //detector = CreateDetector(Config.model_path, Config.labels_path, true, 6); @@ -301,7 +313,8 @@ namespace LeatherApp.Device task.isSucceed = false; task.resultInfo = ex.Message; callback(task); - } + } + Thread.Sleep(5); } } //推理 @@ -368,7 +381,8 @@ namespace LeatherApp.Device task.isSucceed = false; task.resultInfo = ex.Message; callback(task); - } + } + Thread.Sleep(5); } } @@ -388,7 +402,150 @@ namespace LeatherApp.Device public int i { get; set; }//小图index public int j { get; set; }//缺陷index } - + + private double ContrastLow = 0.8; + private double ContrastTop = 1.2; + //private double ContrastToPercent(double val) + //{ + // if (val < ContrastLow) + // return 0; + // else if (val > ContrastTop) + // return 100; + // double temp = 100 / (ContrastTop - ContrastLow); + // return temp * (val - ContrastLow); + //} + //private double PercentToContrast(double val) + //{ + // double temp = val * (ContrastTop - ContrastLow); + // return temp + ContrastLow; + //} + private double ContrastToPercent(double val) + { + if (val < ContrastLow) + return 0; + else if (val > ContrastTop) + return 100; + double temp = 100 / (ContrastTop - ContrastLow); + return Math.Round(temp * (val - ContrastLow), 2); + } + private double PercentToContrast(double val) + { + double tt = 1; + if (val > 100) + tt = 100; + else if (val < 0) + tt = 0; + else + tt = val; + double temp = tt / 100 * (ContrastTop - ContrastLow); + return temp + ContrastLow; + } + private List HeBingDefect(int Width, List DefectLabelInfoList) + { + List outList = new List(); + + List HeBingList = new List(); + List XcHeBingList = new List(); + List xPos = new List(); + List ZXD = new List(); + + List HeBingList2 = new List(); + List XcHeBingList2 = new List(); + List xPos2 = new List(); + List ZXD2 = new List(); + + DefectLabelInfo stpoint = DefectLabelInfoList[0]; + + int colNum = Width / image_width; + //寻找在一条线上 + for (int q = 0; q < DefectLabelInfoList.Count; q++) + { + if (Config.getDefectCode(DefectLabelInfoList[q].classId) == "jietou") + { + 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]); + xPos.Add(DefectLabelInfoList[q].x); + ZXD.Add(DefectLabelInfoList[q].confidence); + } + else + XcHeBingList.Add(DefectLabelInfoList[q]); + } + else if (Config.getDefectCode(DefectLabelInfoList[q].classId) == "hengdang") + { + 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]); + xPos2.Add(DefectLabelInfoList[q].x); + ZXD2.Add(DefectLabelInfoList[q].confidence); + } + else + XcHeBingList2.Add(DefectLabelInfoList[q]); + } + else + outList.Add(DefectLabelInfoList[q]); + } + //递归下次合并数据 + List dg1 = new List(); + List dg2 = new List(); + if (XcHeBingList.Count >0) + dg1 = HeBingDefect(Width, XcHeBingList); + if (XcHeBingList2.Count > 0) + dg2 = HeBingDefect(Width, XcHeBingList2); + + + //多个jietou合并 + if (HeBingList.Count>0) + { + var stIt = HeBingList.Find(x => x.x == xPos.Min()); + var edIt = HeBingList.Find(x => 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; + outList.Add(new DefectLabelInfo() { + x=stIt.x, + y=edIt.y, + w = newW, //多图叠加 + h = edIt.h, + classId = eZXD.classId, + confidence = eZXD.confidence, + contrast = eZXD.contrast, + cmH = Math.Round(edIt.h * 1.0 / Config.cm2px_y, 2), + cmW = Math.Round(newW * 1.0 / Config.cm2px_x, 2), + i = stIt.i, + j = stIt.j, + }); + } + //多个hengdang合并 + if (HeBingList2.Count > 0) + { + var stIt = HeBingList2.Find(x => x.x == xPos2.Min()); + var edIt = HeBingList2.Find(x => 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; + outList.Add(new DefectLabelInfo() + { + x = stIt.x, + y = edIt.y, + w = newW, //多图叠加 + h = edIt.h, + classId = eZXD.classId, + confidence = eZXD.confidence, + contrast = eZXD.contrast, + cmH = Math.Round(edIt.h * 1.0 / Config.cm2px_y, 2), + cmW = Math.Round(newW * 1.0 / Config.cm2px_x, 2), + i = stIt.i, + j = stIt.j, + }); + } + + outList = outList.Concat(dg1).ToList();//保留重复项 + outList = outList.Concat(dg2).ToList();//保留重复项 + return outList; + } //打标 private void run3() { @@ -442,8 +599,10 @@ namespace LeatherApp.Device //y = image_hight-y-h;//转到右下角为原点 count++; - var cmW = Math.Round(w * task.widthRatio / Config.cm2px_x, 2); - var cmH = Math.Round(h * task.widthRatio / Config.cm2px_y, 2); + //var cmW = Math.Round(w * task.widthRatio / Config.cm2px_x, 2); + //var cmH = Math.Round(h * task.widthRatio / Config.cm2px_y, 2); + var cmW = Math.Round(w * 1.0 / Config.cm2px_x, 2); + var cmH = Math.Round(h * 1.0 / Config.cm2px_y, 2); // 打印输出信息 //task.resultInfo += $"----{i}----col:{i % colNum}/{colNum} row:{i / colNum}/{colNum}-----------\n目标:{j + 1} 类别ID:{classId} 置信度:{confidence} 对比度:{contrast} 坐标:({x},{y})-({x + w},{y + h}) 宽高:w={w},h={h}; \n"; @@ -455,15 +614,17 @@ namespace LeatherApp.Device h = (int)task.output[index + 3], classId = (int)task.output[index + 4], confidence = Math.Round(task.output[index + 5], 2), //置信度 - contrast = Math.Round(task.output[index + 6], 3),//对比度 - cmW = Math.Round(w * task.widthRatio / Config.cm2px_x, 2), - cmH = Math.Round(h * task.widthRatio / Config.cm2px_y, 2), + contrast = ContrastToPercent( Math.Round(task.output[index + 6], 3)),//对比度 + //cmW = Math.Round(w * task.widthRatio / Config.cm2px_x, 2), + //cmH = Math.Round(h * task.widthRatio / Config.cm2px_y, 2), + cmW = Math.Round(w * 1.0 / Config.cm2px_x, 2), + cmH = Math.Round(h * 1.0 / Config.cm2px_y, 2), i = i, j = j, }); } - #endregion + #endregion #if false for (int j = 0; j < task.output_num[i]; j++)//缺陷数 { @@ -581,6 +742,13 @@ namespace LeatherApp.Device #endif } + #region 合并接头横档 + liStep++; + if (DefectLabelInfoList.Count >0) + DefectLabelInfoList = HeBingDefect(task.bmp.Width, DefectLabelInfoList); + liStep++; + #endregion + //结果过滤 #region 结果过滤 //降序排序,先得到是否有接头检出 @@ -609,25 +777,27 @@ namespace LeatherApp.Device var ContrastTotal = qualifiedLimit.ContrastTop + qualifiedLimit.ContrastLower; if (qualifiedLimit.IsOR) { - if (!( - (qualifiedLimit.Area <= 0 || DefectLabelInfoListByClassID[q].cmW * DefectLabelInfoListByClassID[q].cmH >= qualifiedLimit.Area) || - (ContrastTotal <= 0 || (DefectLabelInfoListByClassID[q].contrast < qualifiedLimit.ContrastLower || DefectLabelInfoListByClassID[q].contrast > qualifiedLimit.ContrastTop)))) + //if (!( + // (ContrastTotal <= 0 || (PercentToContrast(DefectLabelInfoListByClassID[q].contrast) < qualifiedLimit.ContrastLower || PercentToContrast(DefectLabelInfoListByClassID[q].contrast) > qualifiedLimit.ContrastTop)))) + //{ + // task.resultInfo += $" 不满足此产品瑕疵标准,跳过! \n"; + // //WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low, $"判断不是瑕疵:类别ID:{classId}; 置信度({confidence},[{qualifiedLimit.ZXD}]); isOr({qualifiedLimit.IsOR}); 面积({cmW * cmH},[{ qualifiedLimit.Area}]); 对比度({contrast},[{qualifiedLimit.ContrastLower}-{qualifiedLimit.ContrastTop}])"); + // continue; + //} + } + else + { + if (!(ContrastTotal <= 0 || (PercentToContrast(DefectLabelInfoListByClassID[q].contrast) < qualifiedLimit.ContrastLower || PercentToContrast(DefectLabelInfoListByClassID[q].contrast) > qualifiedLimit.ContrastTop))) { task.resultInfo += $" 不满足此产品瑕疵标准,跳过! \n"; //WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low, $"判断不是瑕疵:类别ID:{classId}; 置信度({confidence},[{qualifiedLimit.ZXD}]); isOr({qualifiedLimit.IsOR}); 面积({cmW * cmH},[{ qualifiedLimit.Area}]); 对比度({contrast},[{qualifiedLimit.ContrastLower}-{qualifiedLimit.ContrastTop}])"); continue; } } - else + if(qualifiedLimit.Area > 0 && DefectLabelInfoListByClassID[q].cmW * DefectLabelInfoListByClassID[q].cmH < qualifiedLimit.Area) { - if (!( - (qualifiedLimit.Area <= 0 || DefectLabelInfoListByClassID[q].cmW * DefectLabelInfoListByClassID[q].cmH >= qualifiedLimit.Area) && - (ContrastTotal <= 0 || (DefectLabelInfoListByClassID[q].contrast < qualifiedLimit.ContrastLower || DefectLabelInfoListByClassID[q].contrast > qualifiedLimit.ContrastTop)))) - { - task.resultInfo += $" 不满足此产品瑕疵标准,跳过! \n"; - //WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low, $"判断不是瑕疵:类别ID:{classId}; 置信度({confidence},[{qualifiedLimit.ZXD}]); isOr({qualifiedLimit.IsOR}); 面积({cmW * cmH},[{ qualifiedLimit.Area}]); 对比度({contrast},[{qualifiedLimit.ContrastLower}-{qualifiedLimit.ContrastTop}])"); - continue; - } + task.resultInfo += $" 不满足此产品瑕疵标准面积,跳过! \n"; + continue; } if (Config.getDefectCode(DefectLabelInfoListByClassID[q].classId) == "jietou") haveJieTou = true; @@ -646,9 +816,13 @@ namespace LeatherApp.Device liStep++;//2 //task.resultInfo += $" 转换到大图坐标(px):p1={point1.X},{point1.Y}; p2={point2.X},{point2.Y}\n"; Cv2.Rectangle(task.bmpTag, point1, point2, new Scalar(0.0, 0.0, 255.0), 1);//画打标点 - //WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low, $"保存第 {count} 行缺陷信息;"); - var cmX = Math.Round(point1.X * task.widthRatio / Config.cm2px_x, 2); - var cmY = Math.Round((task.bmp.Height - point1.Y - DefectLabelInfoListByClassID[q].h) * task.widthRatio / Config.cm2px_y, 2);//外面计Y从右下角为原点 + + //WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low, $"保存第 {count} 行缺陷信息;"); + int px = (point1.X - task.xw) > 0 ? (point1.X - task.xw) : 0; + //var cmX = Math.Round(px * task.widthRatio / Config.cm2px_x, 2); + var cmX = Math.Round((double)px / Config.cm2px_x, 2); + //var cmY = Math.Round((task.bmp.Height - point1.Y - DefectLabelInfoListByClassID[q].h) * task.widthRatio / Config.cm2px_y, 2);//外面计Y从右下角为原点 + var cmY = Math.Round((task.bmp.Height - point1.Y - DefectLabelInfoListByClassID[q].h) * 1.0 / Config.cm2px_y, 2);//外面计Y从右下角为原点 liStep++;//3 //task.resultInfo += $" 转换到大图坐标(cm)[widthRatio={task.widthRatio}]:x={cmX},y={cmY}; w={DefectLabelInfoList[q].cmW},h={DefectLabelInfoList[q].cmH}\n"; task.excelTable.Rows.Add($"{task.photoIndex}", cmX, cmY, DefectLabelInfoListByClassID[q].cmW, DefectLabelInfoListByClassID[q].cmH, DefectLabelInfoListByClassID[q].j + 1, DefectLabelInfoListByClassID[q].classId, DefectLabelInfoListByClassID[q].confidence, DefectLabelInfoListByClassID[q].contrast); @@ -700,6 +874,7 @@ namespace LeatherApp.Device task.resultInfo = ex.Message; callback(task); } + Thread.Sleep(5); } } private void callback(DefectTask task) @@ -807,6 +982,8 @@ namespace LeatherApp.Device /// public DataTable excelTable=new DataTable(); public long[] stopwatch = new long[4]; + + public int xw; } public void add(DefectTask task) diff --git a/LeatherProject/LeatherApp/FrmMain.Designer.cs b/LeatherProject/LeatherApp/FrmMain.Designer.cs index 7efc145..dfb4713 100644 --- a/LeatherProject/LeatherApp/FrmMain.Designer.cs +++ b/LeatherProject/LeatherApp/FrmMain.Designer.cs @@ -58,9 +58,9 @@ this.uiTabControl1.MainPage = ""; this.uiTabControl1.Name = "uiTabControl1"; this.uiTabControl1.SelectedIndex = 0; - this.uiTabControl1.Size = new System.Drawing.Size(1222, 626); + this.uiTabControl1.Size = new System.Drawing.Size(1008, 572); this.uiTabControl1.SizeMode = System.Windows.Forms.TabSizeMode.Fixed; - this.uiTabControl1.Style = Sunny.UI.UIStyle.Red; + this.uiTabControl1.Style = Sunny.UI.UIStyle.Custom; this.uiTabControl1.TabIndex = 7; this.uiTabControl1.TabSelectedForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80))))); this.uiTabControl1.TabSelectedHighColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80))))); @@ -72,10 +72,10 @@ // this.picLogo.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138))))); this.picLogo.Image = ((System.Drawing.Image)(resources.GetObject("picLogo.Image"))); - this.picLogo.Location = new System.Drawing.Point(21, 20); + this.picLogo.Location = new System.Drawing.Point(5, 13); this.picLogo.Name = "picLogo"; this.picLogo.Padding = new System.Windows.Forms.Padding(9); - this.picLogo.Size = new System.Drawing.Size(274, 42); + this.picLogo.Size = new System.Drawing.Size(232, 48); this.picLogo.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.picLogo.TabIndex = 7; this.picLogo.TabStop = false; @@ -89,12 +89,12 @@ this.uiNavBar1.Controls.Add(this.uiLine1); this.uiNavBar1.Controls.Add(this.btnExit); this.uiNavBar1.Controls.Add(this.btnHide); - this.uiNavBar1.Controls.Add(this.btnLockUI); this.uiNavBar1.Controls.Add(this.btnHead3); this.uiNavBar1.Controls.Add(this.btnHead2); this.uiNavBar1.Controls.Add(this.btnHead1); this.uiNavBar1.Controls.Add(this.btnHead0); this.uiNavBar1.Controls.Add(this.picLogo); + this.uiNavBar1.Controls.Add(this.btnLockUI); this.uiNavBar1.Dock = System.Windows.Forms.DockStyle.Top; this.uiNavBar1.DropMenuFont = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.uiNavBar1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); @@ -106,8 +106,8 @@ this.uiNavBar1.Name = "uiNavBar1"; this.uiNavBar1.SelectedForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80))))); this.uiNavBar1.SelectedHighColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80))))); - this.uiNavBar1.Size = new System.Drawing.Size(1222, 73); - this.uiNavBar1.Style = Sunny.UI.UIStyle.Red; + this.uiNavBar1.Size = new System.Drawing.Size(1008, 73); + this.uiNavBar1.Style = Sunny.UI.UIStyle.Custom; this.uiNavBar1.TabIndex = 0; this.uiNavBar1.Text = "uiNavBar1"; this.uiNavBar1.MenuItemClick += new Sunny.UI.UINavBar.OnMenuItemClick(this.uiNavBar1_MenuItemClick); @@ -117,9 +117,9 @@ this.lblVer.AutoSize = true; this.lblVer.Font = new System.Drawing.Font("微软雅黑", 7F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lblVer.LinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); - this.lblVer.Location = new System.Drawing.Point(301, 37); + this.lblVer.Location = new System.Drawing.Point(243, 46); this.lblVer.Name = "lblVer"; - this.lblVer.Size = new System.Drawing.Size(65, 19); + this.lblVer.Size = new System.Drawing.Size(46, 15); this.lblVer.TabIndex = 10; this.lblVer.TabStop = true; this.lblVer.Text = "v1.0.0.0"; @@ -132,10 +132,11 @@ this.uiLine3.Direction = Sunny.UI.UILine.LineDirection.Vertical; this.uiLine3.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138))))); this.uiLine3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.uiLine3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); this.uiLine3.LineColor = System.Drawing.Color.White; this.uiLine3.LineColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); this.uiLine3.LineSize = 2; - this.uiLine3.Location = new System.Drawing.Point(804, 27); + this.uiLine3.Location = new System.Drawing.Point(682, 23); this.uiLine3.MinimumSize = new System.Drawing.Size(1, 1); this.uiLine3.Name = "uiLine3"; this.uiLine3.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None; @@ -151,10 +152,11 @@ this.uiLine2.Direction = Sunny.UI.UILine.LineDirection.Vertical; this.uiLine2.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138))))); this.uiLine2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.uiLine2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); this.uiLine2.LineColor = System.Drawing.Color.White; this.uiLine2.LineColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); this.uiLine2.LineSize = 2; - this.uiLine2.Location = new System.Drawing.Point(628, 27); + this.uiLine2.Location = new System.Drawing.Point(547, 23); this.uiLine2.MinimumSize = new System.Drawing.Size(1, 1); this.uiLine2.Name = "uiLine2"; this.uiLine2.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None; @@ -170,10 +172,11 @@ this.uiLine1.Direction = Sunny.UI.UILine.LineDirection.Vertical; this.uiLine1.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138))))); this.uiLine1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.uiLine1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); this.uiLine1.LineColor = System.Drawing.Color.White; this.uiLine1.LineColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); this.uiLine1.LineSize = 2; - this.uiLine1.Location = new System.Drawing.Point(452, 27); + this.uiLine1.Location = new System.Drawing.Point(407, 24); this.uiLine1.MinimumSize = new System.Drawing.Size(1, 1); this.uiLine1.Name = "uiLine1"; this.uiLine1.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None; @@ -188,7 +191,7 @@ this.btnExit.Cursor = System.Windows.Forms.Cursors.Hand; this.btnExit.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnExit.ForeColor = System.Drawing.Color.White; - this.btnExit.Location = new System.Drawing.Point(1138, 23); + this.btnExit.Location = new System.Drawing.Point(914, 19); this.btnExit.MinimumSize = new System.Drawing.Size(1, 1); this.btnExit.Name = "btnExit"; this.btnExit.Size = new System.Drawing.Size(82, 34); @@ -208,7 +211,7 @@ this.btnHide.Cursor = System.Windows.Forms.Cursors.Hand; this.btnHide.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnHide.ForeColor = System.Drawing.Color.White; - this.btnHide.Location = new System.Drawing.Point(1038, 23); + this.btnHide.Location = new System.Drawing.Point(826, 18); this.btnHide.MinimumSize = new System.Drawing.Size(1, 1); this.btnHide.Name = "btnHide"; this.btnHide.Size = new System.Drawing.Size(82, 34); @@ -228,7 +231,7 @@ this.btnLockUI.Cursor = System.Windows.Forms.Cursors.Hand; this.btnLockUI.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnLockUI.ForeColor = System.Drawing.Color.White; - this.btnLockUI.Location = new System.Drawing.Point(1050, 23); + this.btnLockUI.Location = new System.Drawing.Point(738, 22); this.btnLockUI.MinimumSize = new System.Drawing.Size(1, 1); this.btnLockUI.Name = "btnLockUI"; this.btnLockUI.Size = new System.Drawing.Size(82, 34); @@ -249,10 +252,10 @@ this.btnHead3.Cursor = System.Windows.Forms.Cursors.Hand; this.btnHead3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnHead3.ForeColor = System.Drawing.Color.White; - this.btnHead3.Location = new System.Drawing.Point(831, 22); + this.btnHead3.Location = new System.Drawing.Point(706, 22); this.btnHead3.MinimumSize = new System.Drawing.Size(1, 1); this.btnHead3.Name = "btnHead3"; - this.btnHead3.Size = new System.Drawing.Size(144, 35); + this.btnHead3.Size = new System.Drawing.Size(114, 30); this.btnHead3.Style = Sunny.UI.UIStyle.Custom; this.btnHead3.StyleCustomMode = true; this.btnHead3.Symbol = 61459; @@ -270,10 +273,10 @@ this.btnHead2.Cursor = System.Windows.Forms.Cursors.Hand; this.btnHead2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnHead2.ForeColor = System.Drawing.Color.White; - this.btnHead2.Location = new System.Drawing.Point(655, 22); + this.btnHead2.Location = new System.Drawing.Point(568, 22); this.btnHead2.MinimumSize = new System.Drawing.Size(1, 1); this.btnHead2.Name = "btnHead2"; - this.btnHead2.Size = new System.Drawing.Size(144, 35); + this.btnHead2.Size = new System.Drawing.Size(114, 30); this.btnHead2.Style = Sunny.UI.UIStyle.Custom; this.btnHead2.StyleCustomMode = true; this.btnHead2.Symbol = 61952; @@ -291,10 +294,10 @@ this.btnHead1.Cursor = System.Windows.Forms.Cursors.Hand; this.btnHead1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnHead1.ForeColor = System.Drawing.Color.White; - this.btnHead1.Location = new System.Drawing.Point(479, 22); + this.btnHead1.Location = new System.Drawing.Point(430, 23); this.btnHead1.MinimumSize = new System.Drawing.Size(1, 1); this.btnHead1.Name = "btnHead1"; - this.btnHead1.Size = new System.Drawing.Size(144, 35); + this.btnHead1.Size = new System.Drawing.Size(114, 30); this.btnHead1.Style = Sunny.UI.UIStyle.Custom; this.btnHead1.StyleCustomMode = true; this.btnHead1.Symbol = 61641; @@ -312,10 +315,10 @@ this.btnHead0.Cursor = System.Windows.Forms.Cursors.Hand; this.btnHead0.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnHead0.ForeColor = System.Drawing.Color.White; - this.btnHead0.Location = new System.Drawing.Point(303, 22); + this.btnHead0.Location = new System.Drawing.Point(292, 23); this.btnHead0.MinimumSize = new System.Drawing.Size(1, 1); this.btnHead0.Name = "btnHead0"; - this.btnHead0.Size = new System.Drawing.Size(144, 35); + this.btnHead0.Size = new System.Drawing.Size(114, 30); this.btnHead0.Style = Sunny.UI.UIStyle.Custom; this.btnHead0.StyleCustomMode = true; this.btnHead0.Symbol = 57589; @@ -332,21 +335,20 @@ this.AllowShowTitle = false; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(243)))), ((int)(((byte)(243))))); - this.ClientSize = new System.Drawing.Size(1222, 699); + this.ClientSize = new System.Drawing.Size(1008, 645); this.ControlBoxFillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(115)))), ((int)(((byte)(115))))); this.Controls.Add(this.uiTabControl1); this.Controls.Add(this.uiNavBar1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.MaximumSize = new System.Drawing.Size(2160, 1440); + this.MaximumSize = new System.Drawing.Size(1920, 1080); this.Name = "FrmMain"; this.Padding = new System.Windows.Forms.Padding(0); this.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80))))); this.ShowFullScreen = true; - this.ShowRadius = false; this.ShowRect = false; this.ShowTitle = false; this.ShowTitleIcon = true; - this.Style = Sunny.UI.UIStyle.Red; + this.Style = Sunny.UI.UIStyle.Custom; this.Text = "革博士AI检验系统"; this.TitleColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80))))); this.WindowState = System.Windows.Forms.FormWindowState.Maximized; diff --git a/LeatherProject/LeatherApp/FrmVerList.resx b/LeatherProject/LeatherApp/FrmVerList.resx index 8add597..1ce7492 100644 --- a/LeatherProject/LeatherApp/FrmVerList.resx +++ b/LeatherProject/LeatherApp/FrmVerList.resx @@ -118,7 +118,15 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - v1.0.2.6(2024-04-26) + v1.0.2.9(2024-05-09) +1、加入实时幅宽 +2、加入jietou,hengdang标签合并 +v1.0.2.8(2024-05-06) +1、加入新材质 +v1.0.2.7(2024-04-29) +1、修改导出报表 +2、对比度改为0-100对应0.8-1.2 +v1.0.2.6(2024-04-26) 1、修复裁剪之后图片拉伸 v1.0.2.6(2024-04-12) 1、修复打印报表有数据没显示 diff --git a/LeatherProject/LeatherApp/Page/FHome.Designer.cs b/LeatherProject/LeatherApp/Page/FHome.Designer.cs index 8be9343..7586b65 100644 --- a/LeatherProject/LeatherApp/Page/FHome.Designer.cs +++ b/LeatherProject/LeatherApp/Page/FHome.Designer.cs @@ -28,14 +28,14 @@ /// 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 dataGridViewCellStyle6 = 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 dataGridViewCellStyle3 = 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 dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = 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 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(); this.uiPanel1 = new Sunny.UI.UIPanel(); this.lblLen = new Sunny.UI.UILabel(); this.lblSpeed = new Sunny.UI.UISymbolLabel(); @@ -58,6 +58,7 @@ this.btnEnd = new Sunny.UI.UISymbolButton(); this.btnStart = new Sunny.UI.UISymbolButton(); this.uiTitlePanel2 = new Sunny.UI.UITitlePanel(); + this.ucColorListDefect = new LeatherApp.UIExtend.UCColorList(); this.lineChartDefect = new Sunny.UI.UILineChart(); this.uiTitlePanel3 = new Sunny.UI.UITitlePanel(); this.uiDataGridView1 = new Sunny.UI.UIDataGridView(); @@ -74,11 +75,13 @@ this.colTarget = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.uiMiniPagination1 = new Sunny.UI.UIMiniPagination(); this.uiTitlePanel4 = new Sunny.UI.UITitlePanel(); + this.uilbKF = new Sunny.UI.UILabel(); this.lineChartFaceWidth = new Sunny.UI.UILineChart(); this.uiTitlePanel5 = new Sunny.UI.UITitlePanel(); this.lstboxLog = new Sunny.UI.UIListBox(); this.uiTitlePanel6 = new Sunny.UI.UITitlePanel(); this.uiPanel3 = new Sunny.UI.UIPanel(); + this.picDefectImage = new LeatherApp.UIExtend.UCImageView(); this.pnlScannerImg = new Sunny.UI.UITitlePanel(); this.picScanner2 = new System.Windows.Forms.PictureBox(); this.picScanner1 = new System.Windows.Forms.PictureBox(); @@ -97,8 +100,6 @@ this.uiLabel8 = new Sunny.UI.UILabel(); this.uiLabel7 = new Sunny.UI.UILabel(); this.uiLabel6 = new Sunny.UI.UILabel(); - this.picDefectImage = new LeatherApp.UIExtend.UCImageView(); - this.ucColorListDefect = new LeatherApp.UIExtend.UCColorList(); this.uiPanel1.SuspendLayout(); this.uiTitlePanel1.SuspendLayout(); this.uiPanel2.SuspendLayout(); @@ -128,7 +129,7 @@ this.uiPanel1.MinimumSize = new System.Drawing.Size(1, 1); this.uiPanel1.Name = "uiPanel1"; this.uiPanel1.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138))))); - this.uiPanel1.Size = new System.Drawing.Size(286, 67); + this.uiPanel1.Size = new System.Drawing.Size(212, 67); this.uiPanel1.Style = Sunny.UI.UIStyle.Custom; this.uiPanel1.StyleCustomMode = true; this.uiPanel1.TabIndex = 0; @@ -141,7 +142,7 @@ this.lblLen.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138))))); this.lblLen.Location = new System.Drawing.Point(3, 5); this.lblLen.Name = "lblLen"; - this.lblLen.Size = new System.Drawing.Size(275, 30); + this.lblLen.Size = new System.Drawing.Size(206, 30); this.lblLen.Style = Sunny.UI.UIStyle.Custom; this.lblLen.StyleCustomMode = true; this.lblLen.TabIndex = 0; @@ -155,7 +156,7 @@ this.lblSpeed.Location = new System.Drawing.Point(3, 34); this.lblSpeed.MinimumSize = new System.Drawing.Size(1, 1); this.lblSpeed.Name = "lblSpeed"; - this.lblSpeed.Size = new System.Drawing.Size(275, 28); + this.lblSpeed.Size = new System.Drawing.Size(206, 28); this.lblSpeed.Style = Sunny.UI.UIStyle.Custom; this.lblSpeed.StyleCustomMode = true; this.lblSpeed.Symbol = 362942; @@ -426,13 +427,13 @@ this.uiPanel2.FillColor2 = System.Drawing.Color.White; this.uiPanel2.FillDisableColor = System.Drawing.Color.White; this.uiPanel2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.uiPanel2.Location = new System.Drawing.Point(298, 8); + this.uiPanel2.Location = new System.Drawing.Point(224, 8); this.uiPanel2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.uiPanel2.MinimumSize = new System.Drawing.Size(1, 1); this.uiPanel2.Name = "uiPanel2"; this.uiPanel2.RectColor = System.Drawing.Color.White; this.uiPanel2.RectDisableColor = System.Drawing.Color.White; - this.uiPanel2.Size = new System.Drawing.Size(888, 67); + this.uiPanel2.Size = new System.Drawing.Size(962, 67); this.uiPanel2.Style = Sunny.UI.UIStyle.Custom; this.uiPanel2.StyleCustomMode = true; this.uiPanel2.TabIndex = 0; @@ -492,7 +493,7 @@ this.btnClose.FillPressColor = System.Drawing.Color.Blue; this.btnClose.FillSelectedColor = System.Drawing.Color.Blue; this.btnClose.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnClose.Location = new System.Drawing.Point(760, 9); + this.btnClose.Location = new System.Drawing.Point(834, 9); this.btnClose.MinimumSize = new System.Drawing.Size(1, 1); this.btnClose.Name = "btnClose"; this.btnClose.Radius = 50; @@ -523,7 +524,7 @@ this.btnOpen.FillPressColor = System.Drawing.Color.Blue; this.btnOpen.FillSelectedColor = System.Drawing.Color.Blue; this.btnOpen.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnOpen.Location = new System.Drawing.Point(641, 9); + this.btnOpen.Location = new System.Drawing.Point(715, 9); this.btnOpen.MinimumSize = new System.Drawing.Size(1, 1); this.btnOpen.Name = "btnOpen"; this.btnOpen.Radius = 50; @@ -632,6 +633,29 @@ this.uiTitlePanel2.TitleColor = System.Drawing.Color.White; this.uiTitlePanel2.TitleForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138))))); // + // ucColorListDefect + // + this.ucColorListDefect.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.ucColorListDefect.ColorChanged = null; + this.ucColorListDefect.FillColor = System.Drawing.Color.White; + this.ucColorListDefect.FillColor2 = System.Drawing.Color.White; + this.ucColorListDefect.FillDisableColor = System.Drawing.Color.White; + this.ucColorListDefect.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.ucColorListDefect.Location = new System.Drawing.Point(1, 38); + this.ucColorListDefect.MinimumSize = new System.Drawing.Size(1, 1); + this.ucColorListDefect.Name = "ucColorListDefect"; + this.ucColorListDefect.RadiusSides = Sunny.UI.UICornerRadiusSides.None; + this.ucColorListDefect.RectColor = System.Drawing.Color.White; + this.ucColorListDefect.RectDisableColor = System.Drawing.Color.White; + this.ucColorListDefect.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.Bottom; + this.ucColorListDefect.Size = new System.Drawing.Size(121, 42); + this.ucColorListDefect.Style = Sunny.UI.UIStyle.Custom; + this.ucColorListDefect.StyleCustomMode = true; + this.ucColorListDefect.TabIndex = 1; + this.ucColorListDefect.Text = "ucColorList1"; + this.ucColorListDefect.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter; + // // lineChartDefect // this.lineChartDefect.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -681,21 +705,21 @@ // // uiDataGridView1 // - dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(251)))), ((int)(((byte)(250))))); - this.uiDataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle9.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(251)))), ((int)(((byte)(250))))); + this.uiDataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle9; 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.White; this.uiDataGridView1.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single; - dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle2.BackColor = System.Drawing.Color.Blue; - 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)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138))))); - dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.uiDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle10.BackColor = System.Drawing.Color.Blue; + dataGridViewCellStyle10.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle10.ForeColor = System.Drawing.Color.White; + dataGridViewCellStyle10.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138))))); + dataGridViewCellStyle10.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle10.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.uiDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle10; this.uiDataGridView1.ColumnHeadersHeight = 32; this.uiDataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.uiDataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { @@ -710,36 +734,36 @@ this.colArea, this.colZXD, this.colTarget}); - dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - 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.White; - dataGridViewCellStyle6.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(242)))), ((int)(((byte)(238))))); - dataGridViewCellStyle6.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); - dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.uiDataGridView1.DefaultCellStyle = dataGridViewCellStyle6; + dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle14.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle14.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle14.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); + dataGridViewCellStyle14.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(242)))), ((int)(((byte)(238))))); + dataGridViewCellStyle14.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); + dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.uiDataGridView1.DefaultCellStyle = dataGridViewCellStyle14; 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.CornflowerBlue; - this.uiDataGridView1.Location = new System.Drawing.Point(3, 31); + this.uiDataGridView1.Location = new System.Drawing.Point(3, 36); this.uiDataGridView1.MultiSelect = false; this.uiDataGridView1.Name = "uiDataGridView1"; this.uiDataGridView1.RectColor = System.Drawing.Color.DodgerBlue; - dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(251)))), ((int)(((byte)(250))))); - dataGridViewCellStyle7.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle7.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); - dataGridViewCellStyle7.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138))))); - dataGridViewCellStyle7.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); - dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.uiDataGridView1.RowHeadersDefaultCellStyle = dataGridViewCellStyle7; + dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle15.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(251)))), ((int)(((byte)(250))))); + dataGridViewCellStyle15.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle15.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); + dataGridViewCellStyle15.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138))))); + dataGridViewCellStyle15.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); + dataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.uiDataGridView1.RowHeadersDefaultCellStyle = dataGridViewCellStyle15; this.uiDataGridView1.RowHeadersWidth = 62; - dataGridViewCellStyle8.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle8.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); - dataGridViewCellStyle8.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(242)))), ((int)(((byte)(238))))); - dataGridViewCellStyle8.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); - this.uiDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle8; + dataGridViewCellStyle16.BackColor = System.Drawing.Color.White; + 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)(204)))), ((int)(((byte)(242)))), ((int)(((byte)(238))))); + dataGridViewCellStyle16.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); + this.uiDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle16; this.uiDataGridView1.RowTemplate.Height = 30; this.uiDataGridView1.ScrollBarBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(251)))), ((int)(((byte)(250))))); this.uiDataGridView1.ScrollBarColor = System.Drawing.Color.DodgerBlue; @@ -790,9 +814,9 @@ // colX // this.colX.DataPropertyName = "X"; - dataGridViewCellStyle3.Format = "N1"; - dataGridViewCellStyle3.NullValue = null; - this.colX.DefaultCellStyle = dataGridViewCellStyle3; + dataGridViewCellStyle11.Format = "N1"; + dataGridViewCellStyle11.NullValue = null; + this.colX.DefaultCellStyle = dataGridViewCellStyle11; this.colX.HeaderText = "X(cm)"; this.colX.MinimumWidth = 8; this.colX.Name = "colX"; @@ -802,9 +826,9 @@ // colY // this.colY.DataPropertyName = "Y"; - dataGridViewCellStyle4.Format = "N2"; - dataGridViewCellStyle4.NullValue = null; - this.colY.DefaultCellStyle = dataGridViewCellStyle4; + dataGridViewCellStyle12.Format = "N2"; + dataGridViewCellStyle12.NullValue = null; + this.colY.DefaultCellStyle = dataGridViewCellStyle12; this.colY.HeaderText = "Y(米)"; this.colY.MinimumWidth = 8; this.colY.Name = "colY"; @@ -827,9 +851,9 @@ // // colArea // - dataGridViewCellStyle5.Format = "N2"; - dataGridViewCellStyle5.NullValue = null; - this.colArea.DefaultCellStyle = dataGridViewCellStyle5; + dataGridViewCellStyle13.Format = "N2"; + dataGridViewCellStyle13.NullValue = null; + this.colArea.DefaultCellStyle = dataGridViewCellStyle13; this.colArea.HeaderText = "面积(mm²)"; this.colArea.MinimumWidth = 8; this.colArea.Name = "colArea"; @@ -884,6 +908,7 @@ // this.uiTitlePanel4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.uiTitlePanel4.BackColor = System.Drawing.Color.White; + this.uiTitlePanel4.Controls.Add(this.uilbKF); this.uiTitlePanel4.Controls.Add(this.lineChartFaceWidth); this.uiTitlePanel4.FillColor = System.Drawing.Color.White; this.uiTitlePanel4.FillColor2 = System.Drawing.Color.White; @@ -906,6 +931,20 @@ this.uiTitlePanel4.TitleColor = System.Drawing.Color.White; this.uiTitlePanel4.TitleForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138))))); // + // uilbKF + // + this.uilbKF.AutoSize = true; + this.uilbKF.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.uilbKF.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138))))); + this.uilbKF.Location = new System.Drawing.Point(132, 36); + this.uilbKF.Name = "uilbKF"; + this.uilbKF.Size = new System.Drawing.Size(90, 21); + this.uilbKF.Style = Sunny.UI.UIStyle.Custom; + this.uilbKF.StyleCustomMode = true; + this.uilbKF.TabIndex = 18; + this.uilbKF.Text = "当前幅宽:"; + this.uilbKF.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // // lineChartFaceWidth // this.lineChartFaceWidth.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -1023,6 +1062,15 @@ this.uiPanel3.Text = null; this.uiPanel3.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter; // + // picDefectImage + // + this.picDefectImage.Dock = System.Windows.Forms.DockStyle.Fill; + this.picDefectImage.Location = new System.Drawing.Point(0, 0); + this.picDefectImage.Margin = new System.Windows.Forms.Padding(0); + this.picDefectImage.Name = "picDefectImage"; + this.picDefectImage.Size = new System.Drawing.Size(350, 226); + this.picDefectImage.TabIndex = 1; + // // pnlScannerImg // this.pnlScannerImg.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -1311,38 +1359,6 @@ this.uiLabel6.Text = "光源"; this.uiLabel6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // - // picDefectImage - // - this.picDefectImage.Dock = System.Windows.Forms.DockStyle.Fill; - this.picDefectImage.Location = new System.Drawing.Point(0, 0); - this.picDefectImage.Margin = new System.Windows.Forms.Padding(0); - this.picDefectImage.Name = "picDefectImage"; - this.picDefectImage.Size = new System.Drawing.Size(350, 226); - this.picDefectImage.TabIndex = 1; - // - // ucColorListDefect - // - this.ucColorListDefect.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.ucColorListDefect.ColorChanged = null; - this.ucColorListDefect.FillColor = System.Drawing.Color.White; - this.ucColorListDefect.FillColor2 = System.Drawing.Color.White; - this.ucColorListDefect.FillDisableColor = System.Drawing.Color.White; - this.ucColorListDefect.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.ucColorListDefect.Location = new System.Drawing.Point(1, 38); - this.ucColorListDefect.MinimumSize = new System.Drawing.Size(1, 1); - this.ucColorListDefect.Name = "ucColorListDefect"; - this.ucColorListDefect.RadiusSides = Sunny.UI.UICornerRadiusSides.None; - this.ucColorListDefect.RectColor = System.Drawing.Color.White; - this.ucColorListDefect.RectDisableColor = System.Drawing.Color.White; - this.ucColorListDefect.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.Bottom; - this.ucColorListDefect.Size = new System.Drawing.Size(121, 42); - this.ucColorListDefect.Style = Sunny.UI.UIStyle.Custom; - this.ucColorListDefect.StyleCustomMode = true; - this.ucColorListDefect.TabIndex = 1; - this.ucColorListDefect.Text = "ucColorList1"; - this.ucColorListDefect.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter; - // // FHome // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -1374,6 +1390,7 @@ this.uiTitlePanel3.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.uiDataGridView1)).EndInit(); this.uiTitlePanel4.ResumeLayout(false); + this.uiTitlePanel4.PerformLayout(); this.uiTitlePanel5.ResumeLayout(false); this.uiTitlePanel6.ResumeLayout(false); this.uiPanel3.ResumeLayout(false); @@ -1451,5 +1468,6 @@ private System.Windows.Forms.DataGridViewTextBoxColumn colArea; private System.Windows.Forms.DataGridViewTextBoxColumn colZXD; private System.Windows.Forms.DataGridViewTextBoxColumn colTarget; + private Sunny.UI.UILabel uilbKF; } } diff --git a/LeatherProject/LeatherApp/Page/FHome.cs b/LeatherProject/LeatherApp/Page/FHome.cs index ed64c8a..20c141a 100644 --- a/LeatherProject/LeatherApp/Page/FHome.cs +++ b/LeatherProject/LeatherApp/Page/FHome.cs @@ -152,6 +152,7 @@ namespace LeatherApp.Page { lblLen.Text = "0米"; lblSpeed.Text = "速度:0米/分"; + this.uilbKF.Text = $"当前幅宽:0cm"; txtBarCodeName.Text = txtBatchId.Text = txtReelId.Text = ""; numErpLen.Text = "0"; @@ -544,6 +545,8 @@ namespace LeatherApp.Page //picScanner2.BackColor = Color.Green; picScanner1.Width = picScanner2.Width = pnlScannerImg.ClientSize.Width / 2 - 5; picScanner2.Left = picScanner1.Width + 5; + + uilbKF.Top = 8; } //开机 private void btnOpen_Click(object sender, EventArgs e) @@ -557,6 +560,9 @@ namespace LeatherApp.Page ThreadPool.SetMinThreads(25, minIOC); //ThreadPool.SetMaxThreads(256, 256); + //DefectLib dl = new DefectLib(); + //dl.start(); + this.btnOpen.Enabled = false; this.resetUIValue(); @@ -671,6 +677,13 @@ namespace LeatherApp.Page string pcode = "1-" + codes[2]; if (codes[1] == "0" || Config.SuedeList.Contains(codes[1])) pcode = "0-" + codes[2]; + else +#if false + pcode = codes[1] + "-" + codes[2]; +#else + pcode = "1-" + codes[2]; +#endif + var productInfo = svcProduct.GetModelNav(pcode); //frmProduct.loadProduct(code); Records record; lock (lockCurrKey) @@ -1162,6 +1175,7 @@ namespace LeatherApp.Page devContainer.libPhoto.add(task); AddTextEvent(DateTime.Now, $"拍照{Thread.CurrentThread.ManagedThreadId}", $"Dev={devIndex},图像{scanPhoto.photoIndex},已加入图像处理队列"); errStep = 11; + Application.DoEvents(); } } catch (Exception e) @@ -1184,11 +1198,12 @@ namespace LeatherApp.Page { if (scanPhotos0.mat.Height != scanPhotos1.mat.Height) { + int xw, xh; AddTextEvent(DateTime.Now,$"警告{Thread.CurrentThread.ManagedThreadId}", $"两相机采集图高度不一致({scanPhotos0.photoIndex}),dev1.Height={scanPhotos0.mat.Height},dev2.Height={scanPhotos1.mat.Height},重新resize...", WarningEnum.Low); if (scanPhotos0.mat.Height > scanPhotos1.mat.Height) - scanPhotos1.mat = OpenCVUtil.resize(scanPhotos1.mat, scanPhotos0.mat.Width, scanPhotos0.mat.Height); + scanPhotos1.mat = OpenCVUtil.resize(scanPhotos1.mat, scanPhotos0.mat.Width, scanPhotos0.mat.Height,out xw, out xh); else - scanPhotos0.mat = OpenCVUtil.resize(scanPhotos0.mat, scanPhotos1.mat.Width, scanPhotos1.mat.Height); + scanPhotos0.mat = OpenCVUtil.resize(scanPhotos0.mat, scanPhotos1.mat.Width, scanPhotos1.mat.Height, out xw, out xh); } //saveMatTest(scanPhotos0.mat, 1); //saveMatTest(scanPhotos1.mat, 2); @@ -1220,9 +1235,13 @@ namespace LeatherApp.Page if (Config.MiddleSuperposition > 0)//中间重合部分 { errStep = 3; - int width = mat0.Width - Config.MiddleSuperposition; + int width = mat0.Width - Config.MiddleSuperposition /2 ; mat0 = OpenCVUtil.cutImage(mat0, 0, 0, width, mat0.Height); time += $"->图1去重({stopWatch.ElapsedMilliseconds})"; + + width = mat1.Width - Config.MiddleSuperposition / 2; + mat1 = OpenCVUtil.cutImage(mat1, Config.MiddleSuperposition / 2, 0, width, mat1.Height); + time += $"->图2去重({stopWatch.ElapsedMilliseconds})"; } AddTextEvent(DateTime.Now,$"裁边{Thread.CurrentThread.ManagedThreadId}", $"(图像{scanPhotos0.photoIndex})-左图去重后:{mat0.Width}*{mat0.Height},右图:{mat1.Width}*{mat1.Height}," + @@ -1275,12 +1294,14 @@ namespace LeatherApp.Page this.lblLen.Text = $"{lenMi}米"; 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})"; //----缺陷队列 - mat = OpenCVUtil.resize(mat, resize.Width, resize.Height); + 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}"); devContainer.libDefect.add(new Device.DefectLib.DefectTask() { @@ -1292,6 +1313,7 @@ namespace LeatherApp.Page widthRatio = widthRatio, qualifiedLimitList = curRecord.ProductInfo.QualifiedLimitList, finishEvent = callBackDefectEvent, + xw = oxw, }); errStep = 10; time += $"->加入瑕疵待检队列({stopWatch.ElapsedMilliseconds})"; @@ -1440,6 +1462,27 @@ namespace LeatherApp.Page res.record.preWarningPhotoIndex = res.photoIndex + 1; AddTextEvent(DateTime.Now,$"告警{Thread.CurrentThread.ManagedThreadId}", $"每百米瑕疵数量达到阈值!({defectCount}>={res.record.ProductInfo.DefectCountLimit})", WarningEnum.High); } + step = 11; +#if false + //按缺陷计算没X米多少缺陷报警 + for (int i = 0; i < res.record.ProductInfo.QualifiedLimitList.Count; i++) + { + var defectWarn = res.record.ProductInfo.QualifiedLimitList[i]; + if (defectWarn.DefectWarnLength > 0 || defectWarn.DefectWarnCnt >0) + { + step = 12; + int warnLen = defectWarn.DefectWarnLength * 100;//每百米 to cm + int warnCount = warnLen * Config.cm2px_y / res.bmp.Height; + //从上次告警后重新开始计算长度及数量 + int warnDefectCount = res.record.DefectInfoList.Where(m => m.PhotoIndex >= res.record.preWarningPhotoIndexByLabel[i] && m.PhotoIndex >= res.photoIndex + 1 - warnCount).Count(); + if (warnDefectCount >= defectWarn.DefectWarnCnt) + { + res.record.preWarningPhotoIndexByLabel[i] = res.photoIndex + 1; + AddTextEvent(DateTime.Now, $"告警{Thread.CurrentThread.ManagedThreadId}", $"每{defectWarn.DefectWarnLength}米{Config.getDefectName(defectWarn.Code)}瑕疵数量达到阈值!({warnDefectCount}>={defectWarn.DefectWarnCnt})", WarningEnum.High); + } + } + } +#endif } } diff --git a/LeatherProject/LeatherApp/Page/FProductInfo.Designer.cs b/LeatherProject/LeatherApp/Page/FProductInfo.Designer.cs index 3faf4e1..0efc6d9 100644 --- a/LeatherProject/LeatherApp/Page/FProductInfo.Designer.cs +++ b/LeatherProject/LeatherApp/Page/FProductInfo.Designer.cs @@ -78,6 +78,10 @@ this.btnSave = new Sunny.UI.UISymbolButton(); this.btnReload = new Sunny.UI.UISymbolButton(); this.uiTitlePanel1 = new Sunny.UI.UITitlePanel(); + this.rbMaterial5 = new Sunny.UI.UIRadioButton(); + this.rbMaterial4 = new Sunny.UI.UIRadioButton(); + this.rbMaterial3 = new Sunny.UI.UIRadioButton(); + this.rbMaterial2 = new Sunny.UI.UIRadioButton(); this.rbMaterial1 = new Sunny.UI.UIRadioButton(); this.rbMaterial0 = new Sunny.UI.UIRadioButton(); this.cmbMaterial = new Sunny.UI.UIComboBox(); @@ -90,6 +94,8 @@ this.col_contrast_lower = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.col_contrast_top = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.col_IsOR = new System.Windows.Forms.DataGridViewCheckBoxColumn(); + this.col_Len = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.col_Cnt = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.uiTitlePanel2.SuspendLayout(); this.uiTitlePanel3.SuspendLayout(); this.uiTitlePanel4.SuspendLayout(); @@ -535,7 +541,9 @@ this.col_area, this.col_contrast_lower, this.col_contrast_top, - this.col_IsOR}); + 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))); @@ -781,6 +789,10 @@ // // uiTitlePanel1 // + this.uiTitlePanel1.Controls.Add(this.rbMaterial5); + this.uiTitlePanel1.Controls.Add(this.rbMaterial4); + this.uiTitlePanel1.Controls.Add(this.rbMaterial3); + this.uiTitlePanel1.Controls.Add(this.rbMaterial2); this.uiTitlePanel1.Controls.Add(this.rbMaterial1); this.uiTitlePanel1.Controls.Add(this.rbMaterial0); this.uiTitlePanel1.Controls.Add(this.cmbMaterial); @@ -803,6 +815,54 @@ this.uiTitlePanel1.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; this.uiTitlePanel1.TitleColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192))))); // + // rbMaterial5 + // + this.rbMaterial5.Cursor = System.Windows.Forms.Cursors.Hand; + this.rbMaterial5.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.rbMaterial5.Location = new System.Drawing.Point(119, 155); + this.rbMaterial5.MinimumSize = new System.Drawing.Size(1, 1); + this.rbMaterial5.Name = "rbMaterial5"; + this.rbMaterial5.Size = new System.Drawing.Size(110, 29); + this.rbMaterial5.TabIndex = 27; + this.rbMaterial5.Text = "细纹理"; + this.rbMaterial5.CheckedChanged += new System.EventHandler(this.cmbMaterial_SelectedIndexChanged); + // + // rbMaterial4 + // + this.rbMaterial4.Cursor = System.Windows.Forms.Cursors.Hand; + this.rbMaterial4.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.rbMaterial4.Location = new System.Drawing.Point(10, 155); + this.rbMaterial4.MinimumSize = new System.Drawing.Size(1, 1); + this.rbMaterial4.Name = "rbMaterial4"; + this.rbMaterial4.Size = new System.Drawing.Size(85, 29); + this.rbMaterial4.TabIndex = 28; + this.rbMaterial4.Text = "粗纹理"; + this.rbMaterial4.CheckedChanged += new System.EventHandler(this.cmbMaterial_SelectedIndexChanged); + // + // rbMaterial3 + // + this.rbMaterial3.Cursor = System.Windows.Forms.Cursors.Hand; + this.rbMaterial3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.rbMaterial3.Location = new System.Drawing.Point(119, 120); + this.rbMaterial3.MinimumSize = new System.Drawing.Size(1, 1); + this.rbMaterial3.Name = "rbMaterial3"; + this.rbMaterial3.Size = new System.Drawing.Size(110, 29); + this.rbMaterial3.TabIndex = 25; + this.rbMaterial3.Text = "大花纹"; + this.rbMaterial3.CheckedChanged += new System.EventHandler(this.cmbMaterial_SelectedIndexChanged); + // + // rbMaterial2 + // + this.rbMaterial2.Cursor = System.Windows.Forms.Cursors.Hand; + this.rbMaterial2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.rbMaterial2.Location = new System.Drawing.Point(10, 120); + this.rbMaterial2.MinimumSize = new System.Drawing.Size(1, 1); + this.rbMaterial2.Name = "rbMaterial2"; + this.rbMaterial2.Size = new System.Drawing.Size(85, 29); + this.rbMaterial2.TabIndex = 26; + this.rbMaterial2.Text = "荔枝纹"; + this.rbMaterial2.CheckedChanged += new System.EventHandler(this.cmbMaterial_SelectedIndexChanged); + // // rbMaterial1 // this.rbMaterial1.Cursor = System.Windows.Forms.Cursors.Hand; @@ -836,7 +896,7 @@ this.cmbMaterial.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.cmbMaterial.ItemHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(155)))), ((int)(((byte)(200)))), ((int)(((byte)(255))))); this.cmbMaterial.ItemSelectForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255))))); - this.cmbMaterial.Location = new System.Drawing.Point(10, 221); + this.cmbMaterial.Location = new System.Drawing.Point(10, 294); this.cmbMaterial.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.cmbMaterial.MinimumSize = new System.Drawing.Size(63, 0); this.cmbMaterial.Name = "cmbMaterial"; @@ -858,7 +918,7 @@ this.cmbColor.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.cmbColor.ItemHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(155)))), ((int)(((byte)(200)))), ((int)(((byte)(255))))); this.cmbColor.ItemSelectForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255))))); - this.cmbColor.Location = new System.Drawing.Point(9, 158); + this.cmbColor.Location = new System.Drawing.Point(9, 231); this.cmbColor.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.cmbColor.MinimumSize = new System.Drawing.Size(63, 0); this.cmbColor.Name = "cmbColor"; @@ -889,7 +949,7 @@ this.uiLabel2.AutoSize = true; this.uiLabel2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.uiLabel2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); - this.uiLabel2.Location = new System.Drawing.Point(3, 122); + this.uiLabel2.Location = new System.Drawing.Point(3, 195); this.uiLabel2.Name = "uiLabel2"; this.uiLabel2.Size = new System.Drawing.Size(74, 21); this.uiLabel2.Style = Sunny.UI.UIStyle.Custom; @@ -947,6 +1007,18 @@ this.col_IsOR.Name = "col_IsOR"; this.col_IsOR.Width = 150; // + // col_Len + // + this.col_Len.HeaderText = "报警长度(m)"; + this.col_Len.Name = "col_Len"; + this.col_Len.Visible = false; + // + // col_Cnt + // + this.col_Cnt.HeaderText = "报警数量"; + this.col_Cnt.Name = "col_Cnt"; + this.col_Cnt.Visible = false; + // // FProductInfo // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -1027,11 +1099,17 @@ private Sunny.UI.UITrackBar tcbarTensionValue; private Sunny.UI.UILabel uiLabel9; private Sunny.UI.UILabel lblTensionValue; + private Sunny.UI.UIRadioButton rbMaterial5; + private Sunny.UI.UIRadioButton rbMaterial4; + private Sunny.UI.UIRadioButton rbMaterial3; + private Sunny.UI.UIRadioButton rbMaterial2; private System.Windows.Forms.DataGridViewTextBoxColumn col_code; private System.Windows.Forms.DataGridViewTextBoxColumn col_zxd; private System.Windows.Forms.DataGridViewTextBoxColumn col_area; private System.Windows.Forms.DataGridViewTextBoxColumn col_contrast_lower; private System.Windows.Forms.DataGridViewTextBoxColumn col_contrast_top; private System.Windows.Forms.DataGridViewCheckBoxColumn col_IsOR; + private System.Windows.Forms.DataGridViewTextBoxColumn col_Len; + private System.Windows.Forms.DataGridViewTextBoxColumn col_Cnt; } } diff --git a/LeatherProject/LeatherApp/Page/FProductInfo.cs b/LeatherProject/LeatherApp/Page/FProductInfo.cs index 67483dc..809c61f 100644 --- a/LeatherProject/LeatherApp/Page/FProductInfo.cs +++ b/LeatherProject/LeatherApp/Page/FProductInfo.cs @@ -114,20 +114,66 @@ namespace LeatherApp.Page string[] codes= pcode.Split('-'); if (codes[0]=="0" || Config.SuedeList.Contains(codes[0])) this.rbMaterial0.Checked = true; - else + else if (codes[0] == "1") this.rbMaterial1.Checked = true; + else if (codes[0] == "2") + this.rbMaterial2.Checked = true; + else if (codes[0] == "3") + this.rbMaterial3.Checked = true; + else if (codes[0] == "4") + this.rbMaterial4.Checked = true; + else if (codes[0] == "5") + this.rbMaterial5.Checked = true; this.cmbColor.SelectedValue = int.Parse(codes[1]); } else loadProduct(); } + + private double ContrastLow = 0.8; + private double ContrastTop = 1.2; + /// + /// 获取对比度百分比 0-100 对应0.6-1.4 + /// + /// + /// + private double ContrastToPercent(double val) + { + if (val < ContrastLow) + return 0; + else if (val > ContrastTop) + return 100; + double temp = 100 /(ContrastTop - ContrastLow) ; + return Math.Round(temp * (val - ContrastLow),2); + } + private double PercentToContrast(double val) + { + double tt = 1; + if (val > 100) + tt = 100; + else if (val < 0) + tt = 0; + else + tt = val; + double temp = tt / 100 * (ContrastTop - ContrastLow); + return temp + ContrastLow; + } private void loadProduct() { if (model == null) return; if(model.Material=="0") this.rbMaterial0.Checked = true; - else + else if (model.Material == "1") this.rbMaterial1.Checked = true; + else if (model.Material == "2") + this.rbMaterial2.Checked = true; + else if (model.Material == "3") + this.rbMaterial3.Checked = true; + else if (model.Material == "4") + this.rbMaterial4.Checked = true; + else if (model.Material == "5") + this.rbMaterial5.Checked = true; + this.cmbColor.SelectedValue = model.Color; tcbarLightValue.Value = model.LightValue; @@ -151,9 +197,11 @@ namespace LeatherApp.Page { 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 = item1.ContrastTop; - uiDataGridView1.Rows[i].Cells["col_contrast_lower"].Value = item1.ContrastLower; + 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; @@ -258,11 +306,14 @@ namespace LeatherApp.Page { try { - if (!this.rbMaterial0.Checked && !rbMaterial1.Checked) throw new Exception("请选择材质!"); + if (!this.rbMaterial0.Checked && !rbMaterial1.Checked + && !rbMaterial2.Checked && !rbMaterial3.Checked + && !rbMaterial4.Checked && !rbMaterial5.Checked + ) throw new Exception("请选择材质!"); if (this.cmbColor.SelectedIndex < 0) throw new Exception("请选择颜色!"); if (this.cmbModelName.SelectedIndex < 0) throw new Exception("请选择模型!"); - model.Material = rbMaterial0.Checked ? "0" : "1"; + model.Material = GetMaterialIndex(); model.Color = (int)cmbColor.SelectedValue; model.Code = model.Material+"-"+ model.Color; @@ -289,15 +340,18 @@ namespace LeatherApp.Page Code = uiDataGridView1.Rows[i].Cells["col_code"].Value.ToString(), ZXD = Utils.Util.IsDecimal(uiDataGridView1.Rows[i].Cells["col_zxd"].Value) ? Convert.ToDouble(uiDataGridView1.Rows[i].Cells["col_zxd"].Value) : 0, Area = Utils.Util.IsDecimal(uiDataGridView1.Rows[i].Cells["col_area"].Value) ? Convert.ToDouble(uiDataGridView1.Rows[i].Cells["col_area"].Value) / 100 : 0, - ContrastLower = Utils.Util.IsDecimal(uiDataGridView1.Rows[i].Cells["col_contrast_lower"].Value) ? Convert.ToDouble(uiDataGridView1.Rows[i].Cells["col_contrast_lower"].Value) : 0, - ContrastTop = Utils.Util.IsDecimal(uiDataGridView1.Rows[i].Cells["col_contrast_top"].Value) ? Convert.ToDouble(uiDataGridView1.Rows[i].Cells["col_contrast_top"].Value) : 0, + ContrastLower = Utils.Util.IsDecimal(uiDataGridView1.Rows[i].Cells["col_contrast_lower"].Value) ? PercentToContrast(Convert.ToDouble(uiDataGridView1.Rows[i].Cells["col_contrast_lower"].Value)) : 0, + ContrastTop = Utils.Util.IsDecimal(uiDataGridView1.Rows[i].Cells["col_contrast_top"].Value) ? PercentToContrast(Convert.ToDouble(uiDataGridView1.Rows[i].Cells["col_contrast_top"].Value)) : 0, IsOR = Convert.ToBoolean(uiDataGridView1.Rows[i].Cells["col_IsOR"].Value), + //DefectWarnLength = Utils.Util.IsDecimal(uiDataGridView1.Rows[i].Cells["col_Len"].Value) ? (int)Convert.ToDouble(uiDataGridView1.Rows[i].Cells["col_Len"].Value) : 0, + //DefectWarnCnt = Utils.Util.IsDecimal(uiDataGridView1.Rows[i].Cells["col_Cnt"].Value) ? (int)Convert.ToDouble(uiDataGridView1.Rows[i].Cells["col_Cnt"].Value) : 0, + ModifyUserCode = Config.loginUser.Code, CreateUserCode = Config.loginUser.Code }; if (qualifiedLimit.ContrastLower + qualifiedLimit.ContrastTop > 0 && qualifiedLimit.ContrastTop < qualifiedLimit.ContrastLower) - throw new Exception($"检测标准中第{i+1}行中对比度上限值({qualifiedLimit.ContrastTop})不可小于下限值({qualifiedLimit.ContrastLower})!"); + throw new Exception($"检测标准中第{i+1}行中对比度上限值({ContrastToPercent(qualifiedLimit.ContrastTop)})不可小于下限值({ContrastToPercent(qualifiedLimit.ContrastLower)})!"); model.QualifiedLimitList.Add(qualifiedLimit); } // @@ -366,14 +420,31 @@ namespace LeatherApp.Page this.clear(true); } + string GetMaterialIndex() + { + if (this.rbMaterial0.Checked) + return "0"; + else if (this.rbMaterial1.Checked) + return "1"; + else if (this.rbMaterial2.Checked) + return "2"; + else if (this.rbMaterial3.Checked) + return "3"; + else if (this.rbMaterial4.Checked) + return "4"; + else + return "5"; + } private void cmbMaterial_SelectedIndexChanged(object sender, EventArgs e) { //if (this.cmbMaterial.SelectedIndex < 0 || this.cmbColor.SelectedIndex < 0) // return; - if ((!this.rbMaterial0.Checked && !this.rbMaterial1.Checked) || this.cmbColor.SelectedIndex < 0) + if ((!this.rbMaterial0.Checked && !this.rbMaterial1.Checked && !this.rbMaterial2.Checked + && !this.rbMaterial3.Checked && !this.rbMaterial4.Checked && !this.rbMaterial5.Checked) + || this.cmbColor.SelectedIndex < 0) return; - this.loadProduct((this.rbMaterial0.Checked?"0":"1") + "-" + this.cmbColor.SelectedValue.ToString()); + this.loadProduct(GetMaterialIndex() + "-" + this.cmbColor.SelectedValue.ToString()); } private void btnDefectOption_Click(object sender, EventArgs e) diff --git a/LeatherProject/LeatherApp/Page/FProductInfo.resx b/LeatherProject/LeatherApp/Page/FProductInfo.resx index 201b0dd..aca10e9 100644 --- a/LeatherProject/LeatherApp/Page/FProductInfo.resx +++ b/LeatherProject/LeatherApp/Page/FProductInfo.resx @@ -135,6 +135,12 @@ True + + True + + + True + True diff --git a/LeatherProject/LeatherApp/Page/FReport.cs b/LeatherProject/LeatherApp/Page/FReport.cs index 1344b72..bf89476 100644 --- a/LeatherProject/LeatherApp/Page/FReport.cs +++ b/LeatherProject/LeatherApp/Page/FReport.cs @@ -23,6 +23,8 @@ namespace LeatherApp.Page public partial class FReport : UIPage { RecordsService service=new RecordsService(); + ProductService productService =new ProductService(); + public FReport( ) { InitializeComponent(); @@ -181,6 +183,10 @@ namespace LeatherApp.Page 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(); + + data.Pdt = productService.GetModelNav(record.ProductId); + data.xyPix = $"X:{Config.cm2px_x},Y:{Config.cm2px_y}"; + var image1 = captureControl(this.lineChartDefect); var image2 = captureControl(this.lineChartFaceWidth); var filePath = $"{path}缺陷列表_{record.BatchId}_{record.ReelId}.xlsx"; @@ -392,126 +398,187 @@ namespace LeatherApp.Page row3_cell9.Style = row2_cell2.Style; #endregion - #region 第四行 + #region 第四第五行 rowIndex++; + var row4_cell1 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex); + row4_cell1.Value = "设备参数"; + row4_cell1.Style = row2_cell1.Style; + row4_cell1.Style.Font.Bold = true; + row4_cell1.Style.Font.FontSize = 10; + row4_cell1.Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + var mergeRange_row4 = wsDefectsDetail.Range("A4:A5").Column(1).Merge(); + mergeRange_row4.Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + + var row4_cell2 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 1); + row4_cell2.Value = "光源亮度"; + row4_cell2.Style = row2_cell1.Style; + var row4_cell3 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 2); + row4_cell3.Value = "曝光时间"; + row4_cell3.Style = row2_cell1.Style; + var row4_cell4 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 3); + row4_cell4.Value = "增益"; + row4_cell4.Style = row2_cell1.Style; + var row4_cell5 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 4); + row4_cell5.Value = "行频比"; + row4_cell5.Style = row2_cell1.Style; + var row4_cell6 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 5); + row4_cell6.Value = "物面分辨率"; + row4_cell6.Style = row2_cell1.Style; + var row4_cell7 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 6); + row4_cell7.Value = "触发计数"; + row4_cell7.Style = row2_cell1.Style; + var row4_cell8 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 7); + row4_cell8.Value = "采集计数"; + row4_cell8.Style = row2_cell1.Style; + var row4_cell9 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 8); + row4_cell9.Value = ""; + row4_cell9.Style = row2_cell1.Style; + + rowIndex++; + var row5_cell2 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 1); + row5_cell2.Value = ProductDefects.Pdt.LightValue; + row5_cell2.Style = row2_cell1.Style; + var row5_cell3 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 2); + row5_cell3.Value = ProductDefects.Pdt.ExposureTime; + row5_cell3.Style = row2_cell1.Style; + var row5_cell4 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 3); + row5_cell4.Value = ProductDefects.Pdt.Gain; + row5_cell4.Style = row2_cell1.Style; + var row5_cell5 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 4); + row5_cell5.Value = ""; + row5_cell5.Style = row2_cell1.Style; + var row5_cell6 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 5); + row5_cell6.Value = ProductDefects.xyPix; + row5_cell6.Style = row2_cell1.Style; + var row5_cell7 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 6); + row5_cell7.Value = ""; + row5_cell7.Style = row2_cell1.Style; + var row5_cell8 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 7); + row5_cell8.Value = ""; + row5_cell8.Style = row2_cell1.Style; + var row5_cell9 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 8); + row5_cell9.Value = ""; + row5_cell9.Style = row2_cell1.Style; + #endregion + + #region 第六行后 + rowIndex++; if (ProductDefects.DefectTotal != null && ProductDefects.DefectTotal.Count > 0) { cellIndex = 1; int DefectTotalCount = ProductDefects.DefectTotal.Count; //最少5行,固定4列 - if (DefectTotalCount <= 20) + var row6_cell1 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex); + + row6_cell1.Value = "检测参数"; + row6_cell1.Style.Font.Bold = true; + row6_cell1.Style.Font.FontSize = 10; + row6_cell1.Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + + string cellstr = $"A6:A{7 + ProductDefects.DefectTotal.Count}"; + var mergeRange_row6 = wsDefectsDetail.Range(cellstr).Column(1).Merge(); + mergeRange_row6.Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + + + var row6_cell2 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 1); + + row6_cell2.Value = "筛选标准"; + row6_cell2.Style.Font.Bold = true; + row6_cell2.Style.Font.FontSize = 10; + row6_cell2.Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + + var mergeRange_row6_2 = wsDefectsDetail.Range($"B6:I6").Row(1).Merge(); + mergeRange_row6_2.Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + + //第七行 + rowIndex++; + var row7_cell2 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 1); + row7_cell2.Value = "缺陷类型"; + row7_cell2.Style = row2_cell1.Style; + var row7_cell3 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 2); + row7_cell3.Value = "置信度"; + row7_cell3.Style = row2_cell1.Style; + var row7_cell4 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 3); + row7_cell4.Value = "面积"; + row7_cell4.Style = row2_cell1.Style; + var row7_cell5 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 4); + row7_cell5.Value = "对比度下限"; + row7_cell5.Style = row2_cell1.Style; + var row7_cell6 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 5); + row7_cell6.Value = "对比度上限"; + row7_cell6.Style = row2_cell1.Style; + var row7_cell7 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 6); + row7_cell7.Value = "所用模型版本"; + row7_cell7.Style = row2_cell1.Style; + var row7_cell8 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 7); + row7_cell8.Value = "或向选择"; + row7_cell8.Style = row2_cell1.Style; + var row7_cell9 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 8); + row7_cell9.Value = "本次检出数量"; + row7_cell9.Style = row2_cell1.Style; + + //第八行之后 + rowIndex++; + for (int j = 1; j <= ProductDefects.DefectTotal.Count; j++) // 行 { - var row4_cell1 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex); + var temprowcel2 = wsDefectsDetail.Row(rowIndex + j - 1).Cell(cellIndex + 1); + var temprowcel3 = wsDefectsDetail.Row(rowIndex + j - 1).Cell(cellIndex + 2); + var temprowcel4 = wsDefectsDetail.Row(rowIndex + j - 1).Cell(cellIndex + 3); + var temprowcel5 = wsDefectsDetail.Row(rowIndex + j - 1).Cell(cellIndex + 4); + var temprowcel6 = wsDefectsDetail.Row(rowIndex + j - 1).Cell(cellIndex + 5); + var temprowcel7 = wsDefectsDetail.Row(rowIndex + j - 1).Cell(cellIndex + 6); + var temprowcel8 = wsDefectsDetail.Row(rowIndex + j - 1).Cell(cellIndex + 7); + var temprowcel9 = wsDefectsDetail.Row(rowIndex + j - 1).Cell(cellIndex + 8); + var tempItemDefectTotal = ProductDefects.DefectTotal[j - 1]; + temprowcel2.Value = tempItemDefectTotal.Name; + temprowcel2.Style.Font.Bold = true; + temprowcel2.Style.Font.FontSize = 10; + temprowcel2.Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - row4_cell1.Value = "疵点统计"; - row4_cell1.Style.Font.Bold = true; - row4_cell1.Style.Font.FontSize = 10; - row4_cell1.Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + var temp = ProductDefects.Pdt.QualifiedLimitList.Find(x => Config.getDefectName(x.Code) == tempItemDefectTotal.Name); + temprowcel3.Value = temp.ZXD; + temprowcel3.Style.Font.Bold = true; + temprowcel3.Style.Font.FontSize = 10; + temprowcel3.Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - var mergeRange_row4 = wsDefectsDetail.Range("A4:A8").Column(1).Merge(); - mergeRange_row4.Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + temprowcel4.Value = temp.Area; + temprowcel4.Style.Font.Bold = true; + temprowcel4.Style.Font.FontSize = 10; + temprowcel4.Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - for (int i = 1; i <= 4; i++) - { - for (int j = 1; j <= 5; j++) - { - var temprowcell = wsDefectsDetail.Row(rowIndex + j - 1).Cell(cellIndex + i * 2 - 1); - var temprowcell_1 = wsDefectsDetail.Row(rowIndex + j - 1).Cell(cellIndex + i * 2); - if ((i - 1) * 5 + j <= DefectTotalCount) - { - var tempItemDefectTotal = ProductDefects.DefectTotal[(i - 1) * 5 + j - 1]; - temprowcell.Value = tempItemDefectTotal.Name; - temprowcell.Style.Font.Bold = true; - temprowcell.Style.Font.FontSize = 10; - temprowcell.Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + temprowcel5.Value = ContrastToPercent(temp.ContrastLower); + temprowcel5.Style.Font.Bold = true; + temprowcel5.Style.Font.FontSize = 10; + temprowcel5.Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - temprowcell_1.Value = tempItemDefectTotal.Count; - temprowcell_1.Style.Font.FontSize = 10; - temprowcell_1.Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + temprowcel6.Value = ContrastToPercent(temp.ContrastTop); + temprowcel6.Style.Font.Bold = true; + temprowcel6.Style.Font.FontSize = 10; + temprowcel6.Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - } - else - { - temprowcell.Style.Font.Bold = true; - temprowcell.Style.Font.FontSize = 10; - temprowcell.Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + temprowcel7.Value = ProductDefects.Pdt.ModelName; + temprowcel7.Style.Font.Bold = true; + temprowcel7.Style.Font.FontSize = 10; + temprowcel7.Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - temprowcell_1.Style.Font.FontSize = 10; - temprowcell_1.Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - } - } - } + temprowcel8.Value = temp.IsOR; + temprowcel8.Style.Font.Bold = true; + temprowcel8.Style.Font.FontSize = 10; + temprowcel8.Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - //补齐最后一列空列 - //for (int i = 0; i < 5; i++) - //{ - // var temprowcell = wsDefectsDetail.Row(rowIndex + i).Cell(8); - // temprowcell.Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - //} + temprowcel9.Value = tempItemDefectTotal.Count; + temprowcel9.Style.Font.FontSize = 10; + temprowcel9.Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + } - //更新行号 - rowIndex = rowIndex + 5; - } - else //>20 - { - var row4_cell1 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex); - - row4_cell1.Value = "疵点统计"; - row4_cell1.Style.Font.Bold = true; - row4_cell1.Style.Font.FontSize = 10; - row4_cell1.Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - - int DefectTotalRowCount = (int)(ProductDefects.DefectTotal.Count / 4.0f + 0.5); - - var mergeRange_row4 = wsDefectsDetail.Range($"A{rowIndex}:A{rowIndex+ DefectTotalRowCount-1}").Column(1).Merge(); - mergeRange_row4.Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - - for (int i = 1; i <= 4; i++) - { - for (int j = 1; j <= DefectTotalRowCount; j++) - { - var temprowcell = wsDefectsDetail.Row(rowIndex + j - 1).Cell(cellIndex + i * 2 - 1); - var temprowcell_1 = wsDefectsDetail.Row(rowIndex + j - 1).Cell(cellIndex + i * 2); - if ((i - 1) * DefectTotalRowCount + j <= DefectTotalCount) - { - var tempItemDefectTotal = ProductDefects.DefectTotal[(i - 1) * DefectTotalRowCount + j - 1]; - temprowcell.Value = tempItemDefectTotal.Name; - temprowcell.Style.Font.Bold = true; - temprowcell.Style.Font.FontSize = 10; - temprowcell.Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - - temprowcell_1.Value = tempItemDefectTotal.Count; - temprowcell_1.Style.Font.FontSize = 10; - temprowcell_1.Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - - } - else - { - temprowcell.Style.Font.Bold = true; - temprowcell.Style.Font.FontSize = 10; - temprowcell.Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - - temprowcell_1.Style.Font.FontSize = 10; - temprowcell_1.Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - } - } - } - - //补齐最后一列空列 - //for (int i = 0; i < DefectTotalRowCount; i++) - //{ - // var temprowcell = wsDefectsDetail.Row(rowIndex + i).Cell(8); - // temprowcell.Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - //} - - //更新行号 - rowIndex = rowIndex + DefectTotalRowCount; - } + //更新行号 + rowIndex = rowIndex + ProductDefects.DefectTotal.Count; + } #endregion - #region 第五行 + #region 最后 //rowIndex++; if (ProductDefects.DefectDetail != null && ProductDefects.DefectDetail.Count > 0) { @@ -595,6 +662,17 @@ namespace LeatherApp.Page //} } + private double ContrastLow = 0.8; + private double ContrastTop = 1.2; + private double ContrastToPercent(double val) + { + if (val < ContrastLow) + return 0; + else if (val > ContrastTop) + return 100; + double temp = 100 / (ContrastTop - ContrastLow); + return Math.Round(temp * (val - ContrastLow), 2); + } public static Image getImageBase64(string imgBase64) { byte[] imgByte = Convert.FromBase64String(imgBase64); @@ -623,7 +701,13 @@ namespace LeatherApp.Page public string DateTime { get; set; } [Description("疵点统计")] public List DefectTotal = new List(); - public List DefectDetail = new List(); + public List DefectDetail = new List(); + + [Description("检测设置")] + public Product Pdt { get; set; } + + [Description("物面分辨率")] + public string xyPix { get; set; } } public class JDefectTotal { diff --git a/LeatherProject/LeatherApp/Properties/AssemblyInfo.cs b/LeatherProject/LeatherApp/Properties/AssemblyInfo.cs index d7eba3a..fc44940 100644 --- a/LeatherProject/LeatherApp/Properties/AssemblyInfo.cs +++ b/LeatherProject/LeatherApp/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //通过使用 "*",如下所示: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.2.6")] -[assembly: AssemblyFileVersion("1.0.2.6")] +[assembly: AssemblyVersion("1.0.2.9")] +[assembly: AssemblyFileVersion("1.0.2.9")] diff --git a/LeatherProject/LeatherApp/Utils/OpenCVUtil.cs b/LeatherProject/LeatherApp/Utils/OpenCVUtil.cs index e958a58..a5357d9 100644 --- a/LeatherProject/LeatherApp/Utils/OpenCVUtil.cs +++ b/LeatherProject/LeatherApp/Utils/OpenCVUtil.cs @@ -3,22 +3,24 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Xaml; using DocumentFormat.OpenXml.Vml; using OpenCvSharp; namespace LeatherApp.Utils { public class OpenCVUtil { - public static Mat resize(Mat mat, int width, int height) + public static Mat resize(Mat mat, int width, int height, out int xw, out int xh) { OpenCvSharp.Size dsize = new OpenCvSharp.Size(width, height); Mat mat2 = new Mat(); //Cv2.Resize(mat, mat2, dsize); - ResizeUniform(mat, dsize, out mat2); + ResizeUniform(mat, dsize, out mat2, out xw, out xh); return mat2; } - public static int ResizeUniform(Mat src, Size dst_size, out Mat dst) + public static int ResizeUniform(Mat src, Size dst_size, out Mat dst, out int xw, out int xh) { + xw = xh = 0; int w = src.Cols; int h = src.Rows; int dst_w = dst_size.Width; @@ -66,6 +68,7 @@ namespace LeatherApp.Utils if (tmp_w != dst_w) { //高对齐,宽没对齐 int index_w = (int)((dst_w - tmp_w) / 2.0); + xw = index_w; //std::cout << "index_w: " << index_w << std::endl; for (int i = 0; i < dst_h; i++) { @@ -75,6 +78,7 @@ namespace LeatherApp.Utils else if (tmp_h != dst_h) { //宽对齐, 高没有对齐 int index_h = (int)((dst_h - tmp_h) / 2.0); + xh = index_h; //std::cout << "index_h: " << index_h << std::endl; Buffer.MemoryCopy(tmp.Data.ToPointer(), IntPtr.Add(dst.Data, index_h * dst_w * 3).ToPointer(), tmp_w * tmp_h * 3, tmp_w * tmp_h * 3); } diff --git a/LeatherProject/LeatherApp/bin/Debug/DefectItemList - 副本.json b/LeatherProject/LeatherApp/bin/Debug/DefectItemList - 副本.json new file mode 100644 index 0000000..01cde67 --- /dev/null +++ b/LeatherProject/LeatherApp/bin/Debug/DefectItemList - 副本.json @@ -0,0 +1,56 @@ +[ + { + "id": 0, + "code": "bmss", + "name": "表面损伤", + "color": "Red" + }, + { + "id": 1, + "code": "lj", + "name": "垃圾", + "color": "Lime" + }, + { + "id": 2, + "code": "zmty", + "name": "脏面条印", + "color": "DarkViolet" + }, + { + "id": 3, + "code": "zy", + "name": "皱印", + "color": "Magenta" + }, + { + "id": 4, + "code": "cq", + "name": "串气", + "color": "Orange" + }, + { + "id": 5, + "code": "jt", + "name": "接头", + "color": "Brown" + }, + { + "id": 6, + "code": "bj", + "name": "布接", + "color": "Olive" + }, + { + "id": 7, + "code": "zyc", + "name": "纸异常", + "color": "PaleGreen" + }, + { + "id": 8, + "code": "hd", + "name": "横档", + "color": "CadetBlue" + } +] \ No newline at end of file diff --git a/LeatherProject/LeatherApp/bin/Debug/DefectItemList.json b/LeatherProject/LeatherApp/bin/Debug/DefectItemList.json index 8c872ac..f2f91a7 100644 --- a/LeatherProject/LeatherApp/bin/Debug/DefectItemList.json +++ b/LeatherProject/LeatherApp/bin/Debug/DefectItemList.json @@ -1,74 +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": "hengdang", + "name": "横档", + "color": "Blue" + }, + { + "id": 13, + "code": "jiangyin", + "name": "浆印", + "color": "Blue" } ] \ No newline at end of file diff --git a/LeatherProject/LeatherApp/bin/Debug/DefectItemList3.json b/LeatherProject/LeatherApp/bin/Debug/DefectItemList3.json new file mode 100644 index 0000000..8c872ac --- /dev/null +++ b/LeatherProject/LeatherApp/bin/Debug/DefectItemList3.json @@ -0,0 +1,74 @@ +[ + { + "id": 0, + "code": "jb", + "name": "浆斑", + "color": "Red" + }, + { + "id": 1, + "code": "wy", + "name": "污印", + "color": "Lime" + }, + { + "id": 2, + "code": "mj", + "name": "棉结", + "color": "DarkViolet" + }, + { + "id": 3, + "code": "hy", + "name": "黄印", + "color": "Magenta" + }, + { + "id": 4, + "code": "lj", + "name": "垃圾", + "color": "Orange" + }, + { + "id": 5, + "code": "yss", + "name": "异色丝", + "color": "Brown" + }, + { + "id": 6, + "code": "zy", + "name": "皱印", + "color": "Olive" + }, + { + "id": 7, + "code": "wc", + "name": "蚊虫", + "color": "PaleGreen" + }, + { + "id": 8, + "code": "cs", + "name": "擦伤", + "color": "CadetBlue" + }, + { + "id": 9, + "code": "cy", + "name": "重影", + "color": "Aqua" + }, + { + "id": 10, + "code": "tcy", + "name": "停车印", + "color": "YellowGreen" + }, + { + "id": 11, + "code": "jt", + "name": "接头", + "color": "Blue" + } +] \ No newline at end of file diff --git a/LeatherProject/LeatherApp/bin/Debug/ErrorLog.txt b/LeatherProject/LeatherApp/bin/Debug/ErrorLog.txt index 0978976..9eb3723 100644 --- a/LeatherProject/LeatherApp/bin/Debug/ErrorLog.txt +++ b/LeatherProject/LeatherApp/bin/Debug/ErrorLog.txt @@ -14,3 +14,33 @@ Global捕获到未处理异常:System.FormatException 在 Sunny.UI.ListBoxEx.WndProc(Message& m) 在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) +2024-04-29 15:10:38 +Global捕获到未处理异常:System.ArgumentNullException +异常信息:值不能为 null。 +参数名: source +异常堆栈: 在 System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate) + 在 LeatherApp.Page.FProductInfo.loadProduct() 位置 E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\LeatherApp\Page\FProductInfo.cs:行号 149 + 在 LeatherApp.Page.FProductInfo.loadProduct(String pcode, Boolean resetAll) 位置 E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\LeatherApp\Page\FProductInfo.cs:行号 122 + 在 LeatherApp.Page.FProductInfo.cmbMaterial_SelectedIndexChanged(Object sender, EventArgs e) 位置 E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\LeatherApp\Page\FProductInfo.cs:行号 376 + 在 Sunny.UI.UIRadioButton.set_Checked(Boolean value) + 在 Sunny.UI.UIRadioButton.OnClick(EventArgs e) + 在 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) + 在 System.Windows.Forms.Control.WndProc(Message& m) + 在 Sunny.UI.UIControl.WndProc(Message& m) + 在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) + +2024-05-07 10:44:46 +Global捕获到未处理异常:System.ArgumentException +异常信息:对象的类型必须是 String。 +异常堆栈: 在 System.String.CompareTo(Object value) + 在 System.Windows.Forms.DataGridViewRowCollection.RowComparer.CompareObjects(Object value1, Object value2, Int32 rowIndex1, Int32 rowIndex2) + 在 System.Windows.Forms.DataGridViewRowCollection.RowArrayList.Pivot(Int32 left, Int32 center, Int32 right) + 在 System.Windows.Forms.DataGridViewRowCollection.RowArrayList.CustomQuickSort(Int32 left, Int32 right) + 在 System.Windows.Forms.DataGridViewRowCollection.Sort(IComparer customComparer, Boolean ascending) + 在 System.Windows.Forms.DataGridView.SortInternal(IComparer comparer, DataGridViewColumn dataGridViewColumn, ListSortDirection direction) + 在 System.Windows.Forms.DataGridView.OnColumnHeaderMouseClick(DataGridViewCellMouseEventArgs e) + 在 System.Windows.Forms.DataGridView.OnMouseClick(MouseEventArgs e) + 在 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) + 在 System.Windows.Forms.Control.WndProc(Message& m) + 在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) + diff --git a/LeatherProject/LeatherApp/obj/Debug/LeatherApp.FrmVerList.resources b/LeatherProject/LeatherApp/obj/Debug/LeatherApp.FrmVerList.resources index 37058e1..76d6a14 100644 Binary files a/LeatherProject/LeatherApp/obj/Debug/LeatherApp.FrmVerList.resources and b/LeatherProject/LeatherApp/obj/Debug/LeatherApp.FrmVerList.resources differ diff --git a/LeatherProject/Models/Product.cs b/LeatherProject/Models/Product.cs index c581a83..769f88a 100644 --- a/LeatherProject/Models/Product.cs +++ b/LeatherProject/Models/Product.cs @@ -73,12 +73,39 @@ namespace Models [SugarColumn(IsNullable = true)] public string ModelName { get; set; } - //告警limit + //告警limit public double DefectAreaLimit { get; set; }//面积 public int DefectCountLimit { get; set; }//瑕疵数 public bool DefectPauseForUser { get; set; }//瑕疵二次确认 [SqlSugar.SugarColumn(IsJson = true, IsNullable = true)]//, ColumnDataType = StaticConfig.CodeFirst_BigString)] public List DefectPauseOption { get; set; } = new List();//二次确认过滤瑕疵 + + /// + /// 缺陷计数长度 + /// + [SugarColumn(IsNullable = true)] + public double DefectCntLength { get; set; } + /// + /// 缺陷警告 + /// + [SugarColumn(IsNullable = true)] + public string WarnDefect { get; set; } + + /// + /// 开启厚度检测 + /// + [SugarColumn(IsNullable = true)] + public bool OpenThicknessDetection { get; set; } + /// + /// 厚度检测暂停距离m + /// + [SugarColumn(IsNullable = true)] + public int ThicknessDetectionStopDis { get; set; } + /// + /// 剩余长度提醒 + /// + [SugarColumn(IsNullable = true)] + public double residueWarnningLen { get; set; } } /// @@ -102,7 +129,15 @@ namespace Models //临时显示用 [SugarColumn(IsIgnore = true)] - public string Name { get; set; } + public string Name { get; set; } + + + [SugarColumn(IsNullable = true)] + public string NameCode { get; set; } + [SugarColumn(IsNullable = true)] + public int DefectWarnLength { get; set; } + [SugarColumn(IsNullable = true)] + public int DefectWarnCnt { get; set; } } /// /// 等级划分标准 diff --git a/LeatherProject/Models/Records.cs b/LeatherProject/Models/Records.cs index f046ccf..3162e06 100644 --- a/LeatherProject/Models/Records.cs +++ b/LeatherProject/Models/Records.cs @@ -138,7 +138,12 @@ namespace Models /// [SugarColumn(IsIgnore = true)] public ConcurrentDictionary dicPhoto_Defect { get; set; } = new ConcurrentDictionary(); - + + /// + /// 单一缺陷报警位置记录,预留50 + /// + [SugarColumn(IsIgnore = true)] + public int[] preWarningPhotoIndexByLabel { get; set; } = new int[50]; } /// diff --git a/LeatherProject/Service/ProductService.cs b/LeatherProject/Service/ProductService.cs index 72e5c7f..48398c6 100644 --- a/LeatherProject/Service/ProductService.cs +++ b/LeatherProject/Service/ProductService.cs @@ -54,6 +54,14 @@ namespace Service .Includes(m => m.GradeLimitList) .First(m => m.Code == code); } + public Product GetModelNavByName(string name) + { + return base.AsSugarClient().Queryable() + //.Includes(m => m.ClassesInfo) + .Includes(m => m.QualifiedLimitList) + .Includes(m => m.GradeLimitList) + .First(m => m.Name == name); + } public bool InsertNav(Models.Product model) { return base.AsSugarClient().InsertNav(model) diff --git a/LeatherProject/Service/RecordsService.cs b/LeatherProject/Service/RecordsService.cs index c6b8727..2cd1e45 100644 --- a/LeatherProject/Service/RecordsService.cs +++ b/LeatherProject/Service/RecordsService.cs @@ -51,6 +51,7 @@ namespace Service { return base.AsSugarClient().Queryable() //.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) .First(m => m.Id == id); } diff --git a/LeatherProject/Service/obj/Debug/Service.csproj.FileListAbsolute.txt b/LeatherProject/Service/obj/Debug/Service.csproj.FileListAbsolute.txt index 2d607b5..ea52c5c 100644 --- a/LeatherProject/Service/obj/Debug/Service.csproj.FileListAbsolute.txt +++ b/LeatherProject/Service/obj/Debug/Service.csproj.FileListAbsolute.txt @@ -124,7 +124,6 @@ E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\Service\bin\ E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\Service\bin\Debug\System.Diagnostics.DiagnosticSource.dll E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\Service\bin\Debug\System.IO.Pipelines.dll E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\Service\bin\Debug\ZstdSharp.dll -E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\Service\bin\Debug\ZstdNet.dll E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\Service\bin\Debug\BouncyCastle.Cryptography.xml E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\Service\bin\Debug\Google.Protobuf.pdb E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\Service\bin\Debug\Google.Protobuf.xml