1 文件已重命名
2个文件已添加
2个文件已删除
9个文件已修改
| | |
| | | |
| | | public bool IsPreStationOK { get; set; } = false; |
| | | |
| | | [JsonIgnore] |
| | | public List<string> ImagePaths { get; set; } = new List<string>(); |
| | | |
| | | public List<Netdefectdetail> Netdefectdetails = new List<Netdefectdetail>(); |
| | | |
| | | public List<double> Centermatrix { get; set; } = new List<double>(); |
| | | |
| | | public DateTime? EndTime { get; set; } = null; |
| | | |
| | |
| | | #endregion |
| | | |
| | | #region PositionCheckTimes |
| | | public void InitialPositionCheckList(string positionName, List<int> checkTimes,string stationName) |
| | | public void InitialPositionCheckList(string positionName, List<int> checkTimes, string stationName) |
| | | { |
| | | lock (_checkResultLock) |
| | | { |
| | |
| | | TimeoutTimer = null; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | public class Netdefectdetail |
| | | { |
| | | public string name { get; set; } |
| | | |
| | | public double centerX { get; set; } |
| | | public double centerY { get; set; } |
| | | |
| | | |
| | | |
| | | |
| | | public static double GetDistance(double x1, double y1, double x2, double y2) |
| | | { |
| | | double dx = x2 - x1; |
| | | double dy = y2 - y1; |
| | | return Math.Sqrt(dx * dx + dy * dy); |
| | | } |
| | | public static bool operator ==(Netdefectdetail a, Netdefectdetail b) |
| | | { |
| | | if (GetDistance(a.centerX, a.centerY, b.centerX, b.centerY) < 50) |
| | | { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | public static bool operator !=(Netdefectdetail a, Netdefectdetail b) |
| | | { |
| | | return !(a == b); |
| | | } |
| | | } |
| | | } |
| | |
| | | <Exec Command="Copy $(SolutionDir)libs\PFW $(OutDir)
Copy $(SolutionDir)libs\SafetyDog $(OutDir)
Copy $(SolutionDir)libs\Nuget $(OutDir)
Copy $(SolutionDir)libs\halcon12 $(OutDir)
Copy $(SolutionDir)libs\HikCamera $(OutDir)
Copy $(SolutionDir)libs\IKAPCamera $(OutDir)
Copy $(SolutionDir)libs\InsCamera $(OutDir)
Copy $(SolutionDir)libs\WebServiceDll $(OutDir)" /> |
| | | </Target> |
| | | |
| | | |
| | | <!--<ItemGroup> |
| | | <Compile Include="M141Process_Mysql.cs" /> |
| | | </ItemGroup>--> |
| | |
| | | { |
| | | public class M141Config : ProcessConfigBase |
| | | { |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | [Category("打印机配置")] |
| | | [Description("打印机配置集合")] |
| | | [DisplayName("打印机配置集合")] |
| | | [TypeConverter(typeof(CollectionCountConvert))] |
| | | [Editor(typeof(ComplexCollectionEditor<Printer>), typeof(UITypeEditor))] |
| | | public List<Printer> Printers { get; set; } = new List<Printer>(); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | [Category("检测异常指示")] |
| | | [Description("选择某个Spec,其表示检测过程中异常")] |
| | | [DisplayName("异常指示标准")] |
| | | [TypeConverter(typeof(SpecCodeSelectorConverter))] |
| | | [TypeConverter(typeof(SpecCodeSelectorConverter))] |
| | | public string CheckErrorSpecCode { get; set; } = ""; |
| | | |
| | | |
| | | [Category("特定缺陷配置")] |
| | | [Description("S3和S5共同判断缺陷")] |
| | | [DisplayName("缺陷名称")] |
| | | [TypeConverter(typeof(GlobalDefectNameConverter))] |
| | | public string defectname { get; set; } = ""; |
| | | |
| | | private class GlobalDefectNameConverter : StringConverter |
| | | { |
| | | public override bool GetStandardValuesExclusive(ITypeDescriptorContext? context) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | public override bool GetStandardValuesSupported(ITypeDescriptorContext? context) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | public override StandardValuesCollection? GetStandardValues(ITypeDescriptorContext? context) |
| | | { |
| | | using (var scope = GlobalVar.Container.BeginLifetimeScope()) |
| | | { |
| | | var config = scope.Resolve<IProcessConfig>(); |
| | | |
| | | return new StandardValuesCollection((config as IDefectSwitcher).DefectSwitchCollection.Select(u => u.DefectName).ToList()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | [Category("位置度设置")] |
| | | [Description("产品测量点位集合")] |
| | | [DisplayName("产品测量点位集合")] |
| | |
| | | using ScottPlot.Drawing.Colormaps; |
| | | using Sunny.UI; |
| | | using Sunny.UI.Win32; |
| | | using System; |
| | | using System.Collections.Concurrent; |
| | | using System.Collections.Generic; |
| | | using System.Drawing.Imaging; |
| | |
| | | |
| | | //volatile int _productIndex = 0; |
| | | |
| | | M141Process_Mysql mysqlhelper = new M141Process_Mysql(); |
| | | public M141Process_Mysql mysqlhelper = new M141Process_Mysql(); |
| | | |
| | | public event Action RerefreshBasketcodeUI; |
| | | |
| | | public void RerefreshBasketcode() |
| | | { |
| | | RerefreshBasketcodeUI?.Invoke(); |
| | | } |
| | | |
| | | |
| | | |
| | | public override void InitialProcessMethods() |
| | |
| | | _positionSpecHeads.Clear(); |
| | | |
| | | mysqlhelper.IniDBIP(M141Config.IPforall); |
| | | |
| | | RerefreshBasketcode(); |
| | | } |
| | | |
| | | |
| | |
| | | throw new Exception($"产品{string.Join(",", pidList)}检测{measureBind.GetDisplayText()}未能获取图片对象"); |
| | | } |
| | | |
| | | RunCustomizedMethod(products, triggerText, triggerSource, imgSet, measureBind.CustomizedMonitorId, resultList); |
| | | RunCustomizedMethod(products, triggerText, triggerSource, imgSet, measureBind.CustomizedCombineMethodId, resultList); |
| | | |
| | | //检测顺序 ML->自定义检测 |
| | | if (!string.IsNullOrWhiteSpace(measureBind.DetectionId)) |
| | | { |
| | | string detectionName = (ML.InitialConfig as MLInitialConfigBase).DetectionConfigs.FirstOrDefault(u => u.Id == measureBind.DetectionId)?.Name; |
| | | |
| | | |
| | | //List<string> pidList2 = new List<string>();//pidList.Select(u => u.Split('_')[u.Split('_').Length - 1]).ToList(); |
| | | //Dictionary<string, string> dicpid = new Dictionary<string, string>(); |
| | | |
| | | //for (int i = 0; i < pidList.Count; i++) |
| | | //{ |
| | | // var tem = pidList[i].Split('_')[pidList[i].Split('_').Length - 1]; |
| | | // pidList2.Add(tem); |
| | | // dicpid[tem] = pidList[i]; |
| | | //} |
| | | List<DetectResult> detectResults = ML?.RunMLDetectionSync(imgSet, pidList, measureBind.DetectionId, false, null, null, "", products[0].ImagePaths); |
| | | |
| | | //var c=products[0].ImagePaths; |
| | | List<DetectResult> detectResults = ML?.RunMLDetectionSync(imgSet, pidList, measureBind.DetectionId,false,null,null,"", products[0].ImagePaths); |
| | | |
| | | |
| | | if (measureBind.WorkPosition == "P1" && M141Config.StationCode == "S5" && detectResults.GetDefectDescList().Count == 0) |
| | | { |
| | | var defecttem = detectResults.SelectMany(u => u.NetResults.SelectMany(m => m.DetectDetails)).Where(u => u.NetName == M141Config.defectname).ToList(); |
| | | List<Netdefectdetail> Netdefectdetails = mysqlhelper.GetNetdefectdetails(products[0].SEQUENCE); |
| | | |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Detail, $"{products[0].SN} 进入S3S5检测 S3数据{Netdefectdetails.Count} S5数据{defecttem.Count}"); |
| | | |
| | | int num = 0; |
| | | foreach (var item1 in defecttem) |
| | | { |
| | | double x1 = item1.Rect.Point_LU.X + item1.Rect.Width / 2.0; |
| | | double y1 = item1.Rect.Point_LU.Y + item1.Rect.Height / 2.0; |
| | | num++; |
| | | //HOperatorSet.AffineTransPoint2d(new HTuple(products[0].Centermatrix.ToArray()), x1, y1, out HTuple qx, out HTuple qy); |
| | | //HOperatorSet.ProjectiveTransPixel(new HTuple(products[0].Centermatrix.ToArray()), x1, y1, out HTuple qx, out HTuple qy); |
| | | |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Detail, $"{products[0].SN}原坐标{num} {x1},{y1}"); |
| | | HOperatorSet.ProjectiveTransPixel(new HTuple(products[0].Centermatrix.ToArray()), x1, y1, out HTuple qx, out HTuple qy); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Detail, $"{products[0].SN}新坐标{num} {qx},{qy}"); |
| | | |
| | | |
| | | Netdefectdetail temc = new Netdefectdetail() |
| | | { |
| | | centerX = qx, |
| | | centerY = qy, |
| | | name = M141Config.defectname, |
| | | }; |
| | | if (Netdefectdetails.Any(u => u == temc)) |
| | | { |
| | | item1.IsAbandoned = false; |
| | | item1.FinalResult = ResultState.NG; |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Action, $"产品{products[0].PID}_{products[0].SEQUENCE}工位{measureBind.WorkPosition} S3S5组合检测检出缺陷:{item1.NetName}"); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | List<DetectResult> ngResults = new List<DetectResult>(); |
| | | |
| | | |
| | | //for (int i = 0; i < detectResults.Count; i++) |
| | | //{ |
| | | // detectResults[i].PID = dicpid[detectResults[i].PID]; |
| | | //} |
| | | |
| | | |
| | | detectResults.GroupBy(u => u.PID).ToList().ForEach(u => |
| | | { |
| | | if (u.ToList().Count > 0 && u.ToList().Any(m => m.ResultState != EnumHelper.ResultState.OK)) |
| | |
| | | detectResults.AddRange(ngResults); |
| | | resultList.AddRange(detectResults); |
| | | } |
| | | RunCustomizedMethod(products, triggerText, triggerSource, imgSet, measureBind.CustomizedMonitorId, resultList); |
| | | RunCustomizedMethod(products, triggerText, triggerSource, imgSet, measureBind.CustomizedCombineMethodId, resultList); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | if (positionSet.IsLastPosition) |
| | | { |
| | | UpdateProductResultAsync(p); |
| | | mysqlhelper.NewForAll(p, M141Config.StationCode); |
| | | mysqlhelper.NewForAll(p, M141Config.StationCode, M141Config.defectname); |
| | | if (M141Config.IsfinDevice) |
| | | { |
| | | SummaryAllprodata(p); |
| | |
| | | newp.Details.AddRange(item.Details); |
| | | } |
| | | } |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Error, $"AllDeviceProductRecord从数据库获取到数据{p.SEQUENCE} plist数量{plist.Count} Details数量{newp.Details.Count}"); |
| | | //LogAsync(DateTime.Now, EnumHelper.LogLevel.Error, $"AllDeviceProductRecord从数据库获取到数据{p.SEQUENCE} plist数量{plist.Count} Details数量{newp.Details.Count}"); |
| | | |
| | | //newp.Details.AddRange(p.Details); |
| | | |
| | |
| | | using Bro.Common.Interface; |
| | | using Bro.Common.Model; |
| | | using Bro.M135.Common; |
| | | using HalconDotNet; |
| | | using MySql.Data.MySqlClient; |
| | | using Newtonsoft.Json; |
| | | using Sunny.UI; |
| | |
| | | using System.Threading.Tasks; |
| | | using Windows.Globalization.PhoneNumberFormatting; |
| | | using Windows.Media.Ocr; |
| | | using static Bro.Common.Helper.EnumHelper; |
| | | using static NPOI.HSSF.Util.HSSFColor; |
| | | using static Org.BouncyCastle.Math.EC.ECCurve; |
| | | using static System.Windows.Forms.VisualStyles.VisualStyleElement.ListView; |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | public void NewForAll(ProductModel pro, string devicestr) |
| | | public void NewForAll(ProductModel pro, string devicestr, string netname) |
| | | { |
| | | Task.Run(() => |
| | | { |
| | |
| | | //string destr = "delete from forall where id not in (select id from (select id from forall order BY id desc limit 1000) as subquery)"; |
| | | //Operatoremysql(destr, connStrAll); |
| | | |
| | | if (pro.Details != null) |
| | | if (string.IsNullOrEmpty(netname) /*|| devicestr != "S3" */) |
| | | { |
| | | foreach (var item in pro.Details) |
| | | if (pro.Details != null) |
| | | { |
| | | if (item != null) |
| | | foreach (var item in pro.Details) |
| | | { |
| | | var defects = item.ResultList.GetDefectDescList(); |
| | | var ngSpecCodes = item.SpecList.Where(u => u.MeasureResult != true).Select(u => u.Code); |
| | | defects.AddRange(ngSpecCodes); |
| | | item.DefectList.AddRange(defects.Distinct()); |
| | | item.DefectList = item.DefectList.Distinct().ToList(); |
| | | if (item != null) |
| | | { |
| | | var defects = item.ResultList.GetDefectDescList(); |
| | | var ngSpecCodes = item.SpecList.Where(u => u.MeasureResult != true).Select(u => u.Code); |
| | | defects.AddRange(ngSpecCodes); |
| | | item.DefectList.AddRange(defects.Distinct()); |
| | | item.DefectList = item.DefectList.Distinct().ToList(); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | List<Netdefectdetail> allnetdetail = new List<Netdefectdetail>(); |
| | | if (pro.Details != null) |
| | | { |
| | | foreach (var item in pro.Details) |
| | | { |
| | | if (item != null) |
| | | { |
| | | var defects = item.ResultList.GetDefectDescList(); |
| | | var ngSpecCodes = item.SpecList.Where(u => u.MeasureResult != true).Select(u => u.Code); |
| | | defects.AddRange(ngSpecCodes); |
| | | item.DefectList.AddRange(defects.Distinct()); |
| | | item.DefectList = item.DefectList.Distinct().ToList(); |
| | | |
| | | var defecttem = item.ResultList.SelectMany(u => u.AllNetResults.SelectMany(m => m.DetectDetails)).Where(u => u.ClassName == netname).ToList(); |
| | | |
| | | //CommonLogger.LogAsync(DateTime.Now, EnumHelper.LogLevel.Exception, $"{netname}个数{defecttem.Count}"); |
| | | |
| | | int num = 0; |
| | | foreach (var item1 in defecttem) |
| | | { |
| | | double x1 = item1.Rect.Point_LU.X + item1.Rect.Width / 2.0; |
| | | double y1 = item1.Rect.Point_LU.Y + item1.Rect.Height / 2.0; |
| | | num++; |
| | | //HOperatorSet.AffineTransPoint2d(new HTuple(pro.Centermatrix.ToArray()), x1, y1, out HTuple qx, out HTuple qy); |
| | | |
| | | CommonLogger.LogAsync(DateTime.Now, EnumHelper.LogLevel.Detail, $"sql {pro.SN}原坐标{num} {x1},{y1}"); |
| | | HOperatorSet.ProjectiveTransPixel(new HTuple(pro.Centermatrix.ToArray()), x1, y1, out HTuple qx, out HTuple qy); |
| | | CommonLogger.LogAsync(DateTime.Now, EnumHelper.LogLevel.Detail, $"sql {pro.SN}新坐标{num} {qx},{qy}"); |
| | | |
| | | Netdefectdetail temc = new Netdefectdetail() |
| | | { |
| | | centerX = qx, |
| | | centerY = qy, |
| | | name = netname, |
| | | }; |
| | | allnetdetail.Add(temc); |
| | | } |
| | | } |
| | | } |
| | | |
| | | pro.Netdefectdetails = allnetdetail; |
| | | } |
| | | } |
| | | |
| | | |
| | | string strtem = "select * from forall where plcnum='" + pro.SEQUENCE + "' and device='" + devicestr + "' "; |
| | | |
| | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | public List<Netdefectdetail> GetNetdefectdetails(string plcnum) |
| | | { |
| | | try |
| | | { |
| | | string mysqlstr = $"select data from forall where plcnum='{plcnum}' && device='S3' order by id desc limit 1"; |
| | | string str = selectmysql(mysqlstr, connStrAll); |
| | | if (string.IsNullOrEmpty(str)) |
| | | { |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | ProductModel p = null; |
| | | p = JsonConvert.DeserializeObject<ProductModel>(str, new JsonSerializerSettings() { TypeNameHandling = TypeNameHandling.All }); |
| | | return p.Netdefectdetails; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | CommonLogger.LogAsync(DateTime.Now, EnumHelper.LogLevel.Exception, $"数据库forlocal获取对象异常 {e.ToString()}"); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public string Getbasketcode(string plcnum, out string sn) |
| | | { |
| | | sn = "Noread"; |
| | |
| | | List<ProductModel> plist = new List<ProductModel>(); |
| | | for (int i = 0; i < dt.Rows.Count; i++) |
| | | { |
| | | ProductModel p = JsonConvert.DeserializeObject<ProductModel>(dt.Rows[i][0].ToString(), new JsonSerializerSettings() { TypeNameHandling = TypeNameHandling.All }); |
| | | string strjson = dt.Rows[i][0].ToString(); |
| | | strjson = strjson.Replace(@"\", @"\\"); |
| | | ProductModel p = JsonConvert.DeserializeObject<ProductModel>(strjson, new JsonSerializerSettings() { TypeNameHandling = TypeNameHandling.All }); |
| | | |
| | | //JsonConvert.DeserializeObject<IProcessConfig>(_configBackupStr, new JsonSerializerSettings() { TypeNameHandling = TypeNameHandling.All }); |
| | | plist.Add(p); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | public DataTable getBasketCode() |
| | | { |
| | | try |
| | | { |
| | | string mysqlstr = $"select id,code,time from basketcode order by id desc limit 200"; |
| | | var dt = selectdt(mysqlstr, connStrAll); |
| | | if (dt == null) |
| | | { |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | return dt; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | CommonLogger.LogAsync(DateTime.Now, EnumHelper.LogLevel.Exception, $"数据库forall数据异常 {e.ToString()}"); |
| | | } |
| | | return null; |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | public void NewBasketcode(string code) |
| | | { |
| | | try |
| | | { |
| | | string mysqlstr = $"insert into basketcode(code,time) values('{code}','{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}')"; |
| | | if (Operatoremysql(mysqlstr, connStrAll)) |
| | | { |
| | | CommonLogger.LogAsync(DateTime.Now, EnumHelper.LogLevel.Action, $"数据库basketcode插入数据成功"); |
| | | } |
| | | else |
| | | { |
| | | CommonLogger.LogAsync(DateTime.Now, EnumHelper.LogLevel.Error, $"数据库basketcode插入数据异失败 {mysqlstr}"); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | CommonLogger.LogAsync(DateTime.Now, EnumHelper.LogLevel.Exception, $"数据库basketcode插入数据异常 {e.ToString()}"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | namespace Bro.M141.Process |
| | | { |
| | | partial class BasketCodeUI |
| | | { |
| | | /// <summary> |
| | | /// 必需的设计器变量。 |
| | | /// </summary> |
| | | private System.ComponentModel.IContainer components = null; |
| | | |
| | | /// <summary> |
| | | /// 清理所有正在使用的资源。 |
| | | /// </summary> |
| | | /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param> |
| | | protected override void Dispose(bool disposing) |
| | | { |
| | | if (disposing && (components != null)) |
| | | { |
| | | components.Dispose(); |
| | | } |
| | | base.Dispose(disposing); |
| | | } |
| | | |
| | | #region 组件设计器生成的代码 |
| | | |
| | | /// <summary> |
| | | /// 设计器支持所需的方法 - 不要修改 |
| | | /// 使用代码编辑器修改此方法的内容。 |
| | | /// </summary> |
| | | private void InitializeComponent() |
| | | { |
| | | DataGridViewCellStyle dataGridViewCellStyle1 = new DataGridViewCellStyle(); |
| | | DataGridViewCellStyle dataGridViewCellStyle2 = new DataGridViewCellStyle(); |
| | | DataGridViewCellStyle dataGridViewCellStyle3 = new DataGridViewCellStyle(); |
| | | DataGridViewCellStyle dataGridViewCellStyle4 = new DataGridViewCellStyle(); |
| | | Codesdataview = new Sunny.UI.UIDataGridView(); |
| | | Column5 = new DataGridViewTextBoxColumn(); |
| | | Column6 = new DataGridViewTextBoxColumn(); |
| | | ((System.ComponentModel.ISupportInitialize)Codesdataview).BeginInit(); |
| | | SuspendLayout(); |
| | | // |
| | | // Codesdataview |
| | | // |
| | | Codesdataview.AllowUserToAddRows = false; |
| | | Codesdataview.AllowUserToDeleteRows = false; |
| | | dataGridViewCellStyle1.BackColor = Color.FromArgb(235, 243, 255); |
| | | Codesdataview.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; |
| | | Codesdataview.BackgroundColor = Color.White; |
| | | Codesdataview.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single; |
| | | dataGridViewCellStyle2.Alignment = DataGridViewContentAlignment.MiddleCenter; |
| | | dataGridViewCellStyle2.BackColor = Color.FromArgb(80, 160, 255); |
| | | dataGridViewCellStyle2.Font = new Font("微软雅黑", 12F, FontStyle.Regular, GraphicsUnit.Point); |
| | | dataGridViewCellStyle2.ForeColor = Color.White; |
| | | dataGridViewCellStyle2.SelectionBackColor = SystemColors.Highlight; |
| | | dataGridViewCellStyle2.SelectionForeColor = SystemColors.HighlightText; |
| | | dataGridViewCellStyle2.WrapMode = DataGridViewTriState.True; |
| | | Codesdataview.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; |
| | | Codesdataview.ColumnHeadersHeight = 32; |
| | | Codesdataview.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; |
| | | Codesdataview.Columns.AddRange(new DataGridViewColumn[] { Column5, Column6 }); |
| | | Codesdataview.Dock = DockStyle.Fill; |
| | | Codesdataview.EnableHeadersVisualStyles = false; |
| | | Codesdataview.Font = new Font("微软雅黑", 12F, FontStyle.Regular, GraphicsUnit.Point); |
| | | Codesdataview.GridColor = Color.FromArgb(80, 160, 255); |
| | | Codesdataview.Location = new Point(0, 0); |
| | | Codesdataview.Name = "Codesdataview"; |
| | | Codesdataview.ReadOnly = true; |
| | | dataGridViewCellStyle3.Alignment = DataGridViewContentAlignment.MiddleLeft; |
| | | dataGridViewCellStyle3.BackColor = Color.FromArgb(235, 243, 255); |
| | | dataGridViewCellStyle3.Font = new Font("微软雅黑", 12F, FontStyle.Regular, GraphicsUnit.Point); |
| | | dataGridViewCellStyle3.ForeColor = Color.FromArgb(48, 48, 48); |
| | | dataGridViewCellStyle3.SelectionBackColor = Color.FromArgb(80, 160, 255); |
| | | dataGridViewCellStyle3.SelectionForeColor = Color.White; |
| | | dataGridViewCellStyle3.WrapMode = DataGridViewTriState.True; |
| | | Codesdataview.RowHeadersDefaultCellStyle = dataGridViewCellStyle3; |
| | | Codesdataview.RowHeadersWidth = 51; |
| | | Codesdataview.RowHeight = 25; |
| | | dataGridViewCellStyle4.BackColor = Color.White; |
| | | Codesdataview.RowsDefaultCellStyle = dataGridViewCellStyle4; |
| | | Codesdataview.RowTemplate.Height = 25; |
| | | Codesdataview.SelectedIndex = -1; |
| | | Codesdataview.ShowGridLine = true; |
| | | Codesdataview.Size = new Size(887, 576); |
| | | Codesdataview.TabIndex = 4; |
| | | // |
| | | // Column5 |
| | | // |
| | | Column5.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; |
| | | Column5.DataPropertyName = "code"; |
| | | Column5.HeaderText = "篮具码"; |
| | | Column5.MinimumWidth = 6; |
| | | Column5.Name = "Column5"; |
| | | Column5.ReadOnly = true; |
| | | // |
| | | // Column6 |
| | | // |
| | | Column6.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; |
| | | Column6.DataPropertyName = "time"; |
| | | Column6.HeaderText = "读码时间"; |
| | | Column6.MinimumWidth = 6; |
| | | Column6.Name = "Column6"; |
| | | Column6.ReadOnly = true; |
| | | // |
| | | // BasketCodeUI |
| | | // |
| | | AutoScaleDimensions = new SizeF(6F, 13F); |
| | | AutoScaleMode = AutoScaleMode.Font; |
| | | Controls.Add(Codesdataview); |
| | | Margin = new Padding(2); |
| | | Name = "BasketCodeUI"; |
| | | Size = new Size(887, 576); |
| | | ((System.ComponentModel.ISupportInitialize)Codesdataview).EndInit(); |
| | | ResumeLayout(false); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | private Sunny.UI.UIDataGridView Codesdataview; |
| | | private DataGridViewTextBoxColumn Column5; |
| | | private DataGridViewTextBoxColumn Column6; |
| | | } |
| | | } |
New file |
| | |
| | | using Bro.Common.Helper; |
| | | using Bro.UI.Model.Winform; |
| | | using NPOI.SS.Formula.Functions; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel; |
| | | using System.Data; |
| | | using System.Drawing; |
| | | using System.Drawing.Printing; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using System.Windows.Forms; |
| | | |
| | | namespace Bro.M141.Process |
| | | { |
| | | [MenuNode("篮具码界面", "篮具码界面", 2, EnumHelper.TopMenu.SystemInfo, MenuNodeType.Form)] |
| | | public partial class BasketCodeUI : MenuFormBase |
| | | { |
| | | public BasketCodeUI() |
| | | { |
| | | InitializeComponent(); |
| | | } |
| | | M141Config Config141 => Process.IConfig as M141Config; |
| | | M141Process Process141 => Process as M141Process; |
| | | |
| | | public override void OnProcessUpdated() |
| | | { |
| | | base.OnProcessUpdated(); |
| | | |
| | | Process141.RerefreshBasketcodeUI += RerefreshUI; |
| | | RerefreshUI(); |
| | | } |
| | | |
| | | |
| | | M141Process_Mysql mysqlhelper = new M141Process_Mysql(); |
| | | |
| | | public void RerefreshUI() |
| | | { |
| | | mysqlhelper.IniDBIP(Config141.IPforall); |
| | | DataTable dt = mysqlhelper.getBasketCode(); |
| | | List<codedata> codes = new List<codedata>(); |
| | | |
| | | if (dt != null) |
| | | { |
| | | for (int i = 0; i < dt.Rows.Count; i++) |
| | | { |
| | | codes.Add(new codedata |
| | | { |
| | | code = dt.Rows[i][1].ToString(), |
| | | time = dt.Rows[i][2].ToString(), |
| | | }); |
| | | } |
| | | } |
| | | |
| | | this.Invoke(()=> |
| | | { |
| | | Codesdataview.DataSource = codes; |
| | | Codesdataview.Refresh(); |
| | | }); |
| | | } |
| | | |
| | | |
| | | public class codedata |
| | | { |
| | | public string code { get; set; } |
| | | public string time { get; set; } |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
File was renamed from src/Bro.M141.Process/UI/UI.resx |
| | |
| | | <resheader name="writer"> |
| | | <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
| | | </resheader> |
| | | <metadata name="Column5.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> |
| | | <value>True</value> |
| | | </metadata> |
| | | <metadata name="Column6.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> |
| | | <value>True</value> |
| | | </metadata> |
| | | </root> |
| | |
| | | // |
| | | // button2 |
| | | // |
| | | button2.Location = new Point(180, 90); |
| | | button2.Location = new Point(154, 69); |
| | | button2.Margin = new Padding(3, 2, 3, 2); |
| | | button2.Name = "button2"; |
| | | button2.Size = new Size(108, 60); |
| | | button2.Size = new Size(93, 46); |
| | | button2.TabIndex = 1; |
| | | button2.Text = "预览"; |
| | | button2.UseVisualStyleBackColor = true; |
| | |
| | | // |
| | | // button1 |
| | | // |
| | | button1.Location = new Point(32, 90); |
| | | button1.Location = new Point(27, 69); |
| | | button1.Margin = new Padding(3, 2, 3, 2); |
| | | button1.Name = "button1"; |
| | | button1.Size = new Size(108, 60); |
| | | button1.Size = new Size(93, 46); |
| | | button1.TabIndex = 2; |
| | | button1.Text = "打印"; |
| | | button1.UseVisualStyleBackColor = true; |
| | |
| | | // |
| | | // textBox1 |
| | | // |
| | | textBox1.Location = new Point(125, 38); |
| | | textBox1.Location = new Point(96, 26); |
| | | textBox1.Margin = new Padding(3, 2, 3, 2); |
| | | textBox1.Name = "textBox1"; |
| | | textBox1.Size = new Size(175, 23); |
| | | textBox1.Size = new Size(151, 21); |
| | | textBox1.TabIndex = 3; |
| | | // |
| | | // label1 |
| | | // |
| | | label1.AutoSize = true; |
| | | label1.Location = new Point(52, 38); |
| | | label1.Location = new Point(27, 29); |
| | | label1.Name = "label1"; |
| | | label1.Size = new Size(56, 17); |
| | | label1.Size = new Size(55, 13); |
| | | label1.TabIndex = 4; |
| | | label1.Text = "打印内容"; |
| | | // |
| | | // button3 |
| | | // |
| | | button3.Location = new Point(32, 218); |
| | | button3.Margin = new Padding(2, 2, 2, 2); |
| | | button3.Location = new Point(27, 167); |
| | | button3.Margin = new Padding(2); |
| | | button3.Name = "button3"; |
| | | button3.Size = new Size(81, 43); |
| | | button3.Size = new Size(69, 33); |
| | | button3.TabIndex = 5; |
| | | button3.Text = "获取状态"; |
| | | button3.UseVisualStyleBackColor = true; |
| | |
| | | // |
| | | // textBox2 |
| | | // |
| | | textBox2.Location = new Point(32, 266); |
| | | textBox2.Location = new Point(27, 221); |
| | | textBox2.Margin = new Padding(3, 2, 3, 2); |
| | | textBox2.Name = "textBox2"; |
| | | textBox2.Size = new Size(313, 23); |
| | | textBox2.Size = new Size(269, 21); |
| | | textBox2.TabIndex = 6; |
| | | // |
| | | // UIPrinter |
| | | // |
| | | AutoScaleDimensions = new SizeF(7F, 17F); |
| | | AutoScaleDimensions = new SizeF(6F, 13F); |
| | | AutoScaleMode = AutoScaleMode.Font; |
| | | Controls.Add(textBox2); |
| | | Controls.Add(button3); |
| | |
| | | Controls.Add(textBox1); |
| | | Controls.Add(button1); |
| | | Controls.Add(button2); |
| | | Margin = new Padding(2, 3, 2, 3); |
| | | Margin = new Padding(2, 2, 2, 2); |
| | | Name = "UIPrinter"; |
| | | Size = new Size(356, 362); |
| | | Size = new Size(305, 277); |
| | | ResumeLayout(false); |
| | | PerformLayout(); |
| | | } |
| | |
| | | Plc1.WriteSingleAddress(1514, 1, out _); |
| | | ConfigAOI1.basketcode = barcode; |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Action, $"获取到栏具码为{barcode}"); |
| | | |
| | | mysqlhelper.NewBasketcode(barcode); |
| | | RerefreshBasketcode(); |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | [ProcessMethod("ImageCheck", "GetMatrix", "获取矩阵", InvokeType.TestInvoke)] |
| | | public ResponseMessage GetMatrix(IOperationConfig config, IDevice invokeDevice, IDevice sourceDevice) |
| | | { |
| | | ResponseMessage msg = new ResponseMessage(); |
| | | if (config is IImageCheckOperationConfig opConfig) |
| | | { |
| | | var tool = GetHalconTool(null, "", opConfig.AlgorithemPath); |
| | | var ret = tool.RunProcedure(null, new Dictionary<string, HalconDotNet.HObject>() { { "INPUT_Image", opConfig.ImageSet.HImage } }, new List<string>() { "OUTPUT_Results" }, null); |
| | | |
| | | |
| | | if (ret == null) |
| | | { |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Exception, $"脚本{opConfig.AlgorithemPath}运行异常,返回值为null"); |
| | | } |
| | | else if (!ret.Item1) |
| | | { |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Exception, $"脚本{opConfig.AlgorithemPath}运行异常,{ret.Item4}"); |
| | | } |
| | | else |
| | | { |
| | | List<double> datas = ret.Item2["OUTPUT_Results"].HTupleToDouble(); |
| | | opConfig.Products[0].Centermatrix = datas; |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Action, $"产品{opConfig.Products[0].PID}矩阵获取为 {string.Join(',', datas)}"); |
| | | } |
| | | } |
| | | return msg; |
| | | } |
| | | |
| | | |
| | | } |
| | | } |