From 655481176b286fa91ef9d171fd8cbfac2be2545a Mon Sep 17 00:00:00 2001 From: kingno <30263@KINGNO> Date: 星期四, 10 四月 2025 10:43:02 +0800 Subject: [PATCH] 打印机,数据库格式更新 --- src/Bro.M141.Process/M141Process_ImageCheck.cs | 33 +++++++++++++++++++++++++-------- 1 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/Bro.M141.Process/M141Process_ImageCheck.cs b/src/Bro.M141.Process/M141Process_ImageCheck.cs index 78e0296..222cddc 100644 --- a/src/Bro.M141.Process/M141Process_ImageCheck.cs +++ b/src/Bro.M141.Process/M141Process_ImageCheck.cs @@ -3,10 +3,12 @@ using Bro.Common.Interface; using Bro.Common.Model; using Bro.M135.Common; +using Bro.M135.DBManager; using HalconDotNet; using Microsoft.VisualBasic; using Newtonsoft.Json; using Newtonsoft.Json.Linq; +using NPOI.Util; using Sunny.UI; using System.Data; using System.Data.SqlTypes; @@ -28,6 +30,9 @@ Dictionary<string, List<double>> dicdate = new Dictionary<string, List<double>>(); ManualResetEvent set1 = new ManualResetEvent(false); ManualResetEvent set2 = new ManualResetEvent(false); + + + public event Action<string> StartPrinter; [ProcessMethod("ImageCheck", "ImageCheckOperation", "閫氱敤鍥剧墖妫�娴嬫搷浣�", InvokeType.TestInvoke)] public ResponseMessage ImageCheckOperation(IOperationConfig config, IDevice invokeDevice, IDevice sourceDevice) @@ -436,8 +441,6 @@ } - - [ProcessMethod("", "ProductDataUpload", "浜у搧鏁版嵁姹囨��", InvokeType.TestInvoke)] public ResponseMessage ProductDataUpload(IOperationConfig config, IDevice invokeDevice, IDevice sourceDevice) { @@ -501,6 +504,22 @@ + [ProcessMethod("printer", "printer", "鎵撳嵃鏈烘墦鍗�", InvokeType.TestInvoke)] + public ResponseMessage Printer(IOperationConfig config, IDevice invokeDevice, IDevice sourceDevice) + { + ResponseMessage msg = new ResponseMessage(); + + Plc2 = invokeDevice as PLCBase; + string message = ""; + StartPrinter.Invoke(message); + return msg; + } + + + public void PlcwritePrinter(int add,int value) + { + Plc2.WriteSingleAddress(add,value,out _); + } @@ -515,9 +534,10 @@ var spec = M141Config.SpecCollection.FirstOrDefault(s => s.Code == u.SpecCode); if (spec != null) { - var temp = spec.Copy<Spec>(); + var temp = spec.Copy(); temp.ActualValue = null; temp.MeasureResult = null; + temp.Source = ""; specList.Add(temp); } }); @@ -592,7 +612,7 @@ resultList.ForEach(u => u.SetResult()); var defects = resultList.GetDefectDescList(); - var ngSpecCodes = p.Details.SelectMany(u => u.SpecList ?? new List<Spec>()).Where(u => u.MeasureResult != true).Select(u => u.Code); + var ngSpecCodes = p.Details.SelectMany(u => u.SpecList ?? new List<ISpec>()).Where(u => u.MeasureResult != true).Select(u => u.Code); var ngDefectDescList = p.Details.SelectMany(u => u.DefectList ?? new List<string>()).ToList(); defects.AddRange(ngSpecCodes); @@ -638,10 +658,7 @@ _taskFactory.StartNew(() => { - if (string.IsNullOrWhiteSpace(_csvHead)) - { - _csvHead = p.GetCSVHead(ref _specHeadList, ref _positionList); - } + _csvHead = p.GetCSVHead(ref _specHeadList, ref _positionList); CSVRecordAsync($"ProductRecord_{DateTime.Now.ToString("yyyyMMdd")}.csv", p.GetCSVData(_specHeadList, _positionList), _csvHead); //_manager_P_Product.UpdateProductResult(p.ID, p.PID, p.SN, p.Result); }); -- Gitblit v1.8.0