| | |
| | | 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; |
| | |
| | | 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) |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | [ProcessMethod("", "ProductDataUpload", "产品数据汇总", InvokeType.TestInvoke)] |
| | | public ResponseMessage ProductDataUpload(IOperationConfig config, IDevice invokeDevice, IDevice sourceDevice) |
| | | { |
| | |
| | | |
| | | |
| | | |
| | | [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 _); |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | 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); |
| | | } |
| | | }); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"产品{pid}检测项{s.Code}赋值{s.GetMeasureValueStr()},结果{s.GetMeasureResultStr()}"); |
| | | } |
| | | else |
| | |
| | | { |
| | | isOK = false; |
| | | |
| | | int num = 0; |
| | | |
| | | while (p.Details.Any(u => !u.IsDone) && num < 10) |
| | | { |
| | | num++; |
| | | Thread.Sleep(500); |
| | | } |
| | | |
| | | |
| | | p.InitialDetailSpecs(); |
| | | var resultList = p.Details.SelectMany(u => u.ResultList).ToList(); |
| | | 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); |
| | |
| | | { |
| | | defects.Add("TBD"); |
| | | } |
| | | |
| | | |
| | | defects = defects.Distinct().ToList(); |
| | | |
| | | isOK = defects.Count <= 0; |
| | | |
| | | UpdateDefectAsync(defects); |
| | | var defectClass = GetDefectClassFromDefectList(defects); |
| | | UpdateResult(DateTime.Now, p.SN, defectClass.ClassName, ""); |
| | | UpdateResult(DateTime.Now, p.SN, defectClass.ClassName, "",p.ImagePaths); |
| | | |
| | | //产品序号+1 |
| | | Interlocked.Increment(ref _productIndex); |
| | | //Interlocked.Increment(ref _productIndex); |
| | | |
| | | List<ISpec> specList = new List<ISpec>(); |
| | | specList.AddRange(p.Details.SelectMany(u => u.SpecList).ToList().ConvertAll(u => (ISpec)u)); |
| | |
| | | |
| | | _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); |
| | | }); |