| | |
| | | return; |
| | | } |
| | | |
| | | RunImageHandle(camera, s.CameraOp.OpConfig, set, s.Id, s.Name, pMeasure.Measurements); |
| | | RunImageHandle(s.CameraOp.OpConfig, set, s.Id, s.Name, pMeasure.Measurements); |
| | | }); |
| | | |
| | | BarCode = ""; |
| | |
| | | { |
| | | int slantStartCol = slantSheet.Dimension.Columns; |
| | | |
| | | var barcodeCell = slantSheet.Cells[1, slantStartCol + 1, 1, slantStartCol + 2]; |
| | | barcodeCell.Merge = true; |
| | | //var barcodeCell = slantSheet.Cells[1, slantStartCol + 1, 1, slantStartCol + 2]; |
| | | //barcodeCell.Merge = true; |
| | | //barcodeCell.Value = exportData.ProductionMeasurementRecord.ProductionBarcode; |
| | | //SetTitleCell(barcodeCell); |
| | | |
| | | var barcodeCell = slantSheet.Cells[1, slantStartCol + 1]; |
| | | barcodeCell.Value = exportData.ProductionMeasurementRecord.ProductionBarcode; |
| | | SetTitleCell(barcodeCell); |
| | | |
| | |
| | | valueCell.Value = "Value"; |
| | | SetTitleCell(valueCell); |
| | | |
| | | var resultCell = slantSheet.Cells[2, slantStartCol + 2]; |
| | | resultCell.Value = "Result"; |
| | | SetTitleCell(resultCell); |
| | | //var resultCell = slantSheet.Cells[2, slantStartCol + 2]; |
| | | //resultCell.Value = "Result"; |
| | | //SetTitleCell(resultCell); |
| | | |
| | | slantMeasures.ForEach(m => |
| | | { |
| | |
| | | } |
| | | |
| | | var cellValue = slantSheet.Cells[rowIndex + 1 + 2, slantStartCol + 1]; |
| | | var cellResult = slantSheet.Cells[rowIndex + 1 + 2, slantStartCol + 2]; |
| | | //var cellResult = slantSheet.Cells[rowIndex + 1 + 2, slantStartCol + 2]; |
| | | |
| | | cellValue.Value = m.MeasurementValue; |
| | | cellResult.Value = m.MeasurementResult; |
| | | //cellResult.Value = m.MeasurementResult; |
| | | |
| | | if (m.MeasurementResult != "OK") |
| | | { |
| | | SetNGCell(cellValue); |
| | | SetNGCell(cellResult); |
| | | //SetNGCell(cellResult); |
| | | } |
| | | }); |
| | | } |
| | |
| | | keysList.Add($"{keys}_{position}"); |
| | | } |
| | | |
| | | var barcodeCell = alignmentSheet.Cells[1, aligneStartCol + 1, 1, aligneStartCol + 2]; |
| | | barcodeCell.Merge = true; |
| | | //var barcodeCell = alignmentSheet.Cells[1, aligneStartCol + 1, 1, aligneStartCol + 2]; |
| | | //barcodeCell.Merge = true; |
| | | //barcodeCell.Value = exportData.ProductionMeasurementRecord.ProductionBarcode; |
| | | //SetTitleCell(barcodeCell); |
| | | |
| | | var barcodeCell = alignmentSheet.Cells[1, aligneStartCol + 1]; |
| | | barcodeCell.Value = exportData.ProductionMeasurementRecord.ProductionBarcode; |
| | | SetTitleCell(barcodeCell); |
| | | |
| | |
| | | valueCell.Value = "Value"; |
| | | SetTitleCell(valueCell); |
| | | |
| | | var resultCell = alignmentSheet.Cells[2, aligneStartCol + 2]; |
| | | resultCell.Value = "Result"; |
| | | SetTitleCell(resultCell); |
| | | //var resultCell = alignmentSheet.Cells[2, aligneStartCol + 2]; |
| | | //resultCell.Value = "Result"; |
| | | //SetTitleCell(resultCell); |
| | | |
| | | alignmentMeasures.ForEach(a => |
| | | { |
| | |
| | | } |
| | | |
| | | var cellValue = alignmentSheet.Cells[rowIndex + 1 + 2, aligneStartCol + 1]; |
| | | var cellResult = alignmentSheet.Cells[rowIndex + 1 + 2, aligneStartCol + 2]; |
| | | //var cellResult = alignmentSheet.Cells[rowIndex + 1 + 2, aligneStartCol + 2]; |
| | | |
| | | cellValue.Value = a.MeasurementValue; |
| | | cellResult.Value = a.MeasurementResult; |
| | | //cellResult.Value = a.MeasurementResult; |
| | | |
| | | if (a.MeasurementResult != "OK") |
| | | { |
| | | SetNGCell(cellValue); |
| | | SetNGCell(cellResult); |
| | | //SetNGCell(cellResult); |
| | | } |
| | | }); |
| | | } |
| | |
| | | keysList.Add($"{keys}_{position}"); |
| | | } |
| | | |
| | | var barcodeCell = rowAlignmentSheet.Cells[1, aligneStartCol + 1, 1, aligneStartCol + 2]; |
| | | barcodeCell.Merge = true; |
| | | //var barcodeCell = rowAlignmentSheet.Cells[1, aligneStartCol + 1, 1, aligneStartCol + 2]; |
| | | //barcodeCell.Merge = true; |
| | | //barcodeCell.Value = exportData.ProductionMeasurementRecord.ProductionBarcode; |
| | | //SetTitleCell(barcodeCell); |
| | | |
| | | var barcodeCell = rowAlignmentSheet.Cells[1, aligneStartCol + 1]; |
| | | barcodeCell.Value = exportData.ProductionMeasurementRecord.ProductionBarcode; |
| | | SetTitleCell(barcodeCell); |
| | | |
| | |
| | | valueCell.Value = "Value"; |
| | | SetTitleCell(valueCell); |
| | | |
| | | var resultCell = rowAlignmentSheet.Cells[2, aligneStartCol + 2]; |
| | | resultCell.Value = "Result"; |
| | | SetTitleCell(resultCell); |
| | | //var resultCell = rowAlignmentSheet.Cells[2, aligneStartCol + 2]; |
| | | //resultCell.Value = "Result"; |
| | | //SetTitleCell(resultCell); |
| | | |
| | | rowAlignmentMeasures.ForEach(a => |
| | | { |
| | |
| | | } |
| | | |
| | | var cellValue = rowAlignmentSheet.Cells[rowIndex + 1 + 2, aligneStartCol + 1]; |
| | | var cellResult = rowAlignmentSheet.Cells[rowIndex + 1 + 2, aligneStartCol + 2]; |
| | | //var cellResult = rowAlignmentSheet.Cells[rowIndex + 1 + 2, aligneStartCol + 2]; |
| | | |
| | | cellValue.Value = a.MeasurementValue; |
| | | cellResult.Value = a.MeasurementResult; |
| | | //cellResult.Value = a.MeasurementResult; |
| | | |
| | | if (a.MeasurementResult != "OK") |
| | | { |
| | | SetNGCell(cellValue); |
| | | SetNGCell(cellResult); |
| | | //SetNGCell(cellResult); |
| | | } |
| | | }); |
| | | } |
| | |
| | | |
| | | private void SetNGCell(ExcelRange cell) |
| | | { |
| | | cell.Style.Font.Color.SetColor(Color.White); |
| | | cell.Style.Font.Color.SetColor(Color.Red); |
| | | cell.Style.Font.Bold = true; |
| | | cell.Style.Fill.PatternType = ExcelFillStyle.Solid; |
| | | cell.Style.Fill.BackgroundColor.SetColor(Color.Red); |
| | | //cell.Style.Fill.PatternType = ExcelFillStyle.Solid; |
| | | //cell.Style.Fill.BackgroundColor.SetColor(Color.Red); |
| | | } |
| | | |
| | | private void SetTitleCell(ExcelRange cell, bool isCenterAlign = true) |
| | |
| | | } |
| | | #endregion |
| | | |
| | | private async void RunImageHandle(CameraBase camera, IOperationConfig opConfig, IImageSet imgSet, string snapshotId, string snapshotName, List<MeasurementUnit> measureList) |
| | | private async void RunImageHandle(IOperationConfig opConfig, IImageSet imgSet, string snapshotId, string snapshotName, List<MeasurementUnit> measureList) |
| | | { |
| | | await Task.Run(() => |
| | | { |
| | |
| | | HOperatorSet.SelectObj(images, out HObject image, i); |
| | | |
| | | string fileName = Path.Combine(dir, $"{i}.tif"); |
| | | image.ConvertHObjectToHImage().WriteImage("tiff", 0, fileName); |
| | | using (HImage temp = image.ConvertHObjectToHImage()) |
| | | { |
| | | temp.WriteImage("tiff", 0, fileName); |
| | | } |
| | | |
| | | keys.Where(u => u.ImageSeq == i).ToList().ForEach(k => |
| | | { |
| | |
| | | _halconToolDict[keyToolKey].InputImageDic["INPUT_Image"] = image; |
| | | _halconToolDict[keyToolKey].InputTupleDic["INPUT_Resolution_X"] = scanParam.Resolution_X / 1000000.0; |
| | | _halconToolDict[keyToolKey].InputTupleDic["INPUT_Resolution_Z"] = scanParam.Resolution_Z / 1000000.0; |
| | | _halconToolDict[keyToolKey].InputTupleDic["INPUT_ImageId"] = $"{k.AliasName}_{DateTime.Now.ToString("HHmmssfff")}.tif"; |
| | | if (!_halconToolDict[keyToolKey].RunProcedure(out string error)) |
| | | { |
| | | LogAsync(DateTime.Now, $"{k.AliasName}检测算法异常,{error}", ""); |
| | |
| | | { |
| | | //results = results.Select(u => double.Parse(u.ToString("f2"))).ToList(); |
| | | LogAsync(DateTime.Now, $"{k.AliasName}原始数据", $"{string.Join(" ", results)}"); |
| | | |
| | | results.ForEach(u => u = u - Config.PlanCompensation); |
| | | resultDict = k.KeyResultList.ToDictionary(u => u, u => |
| | | { |
| | | int index = k.KeyResultList.IndexOf(u); |
| | |
| | | }); |
| | | }); |
| | | |
| | | //image.Dispose(); |
| | | image.Dispose(); |
| | | } |
| | | //); |
| | | |