| | |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | AutoResetEvent _jobDoneHandle = new AutoResetEvent(false); |
| | | [ProcessMethod("ManualTest", "ManualTest", "手动测试", InvokeType.TestInvoke)] |
| | | public ProcessResponse ManualTest(IOperationConfig config, IDevice invokeDevice, IDevice sourceDevice) |
| | | { |
| | | if (config is ManualTestOperationConfig opConfig) |
| | | { |
| | | Task.Run(async () => |
| | | { |
| | | for (int i = 0; i < opConfig.RepeatTimes; i++) |
| | | { |
| | | BarCode = $"Test_{i + 1}"; |
| | | StartJob(null, null, null); |
| | | |
| | | if (_jobDoneHandle.WaitOne(20000)) |
| | | { |
| | | LogAsync(DateTime.Now, $"第{i + 1}次任务完成", ""); |
| | | await Task.Delay(500); |
| | | } |
| | | else |
| | | { |
| | | LogAsync(DateTime.Now, $"第{i + 1}次任务超时", ""); |
| | | break; |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | return new ProcessResponse(true); |
| | | } |
| | | |
| | | object productionLock = new object(); |
| | | List<ProductionMeasurement> productionList = new List<ProductionMeasurement>(); |
| | | |
| | |
| | | |
| | | private void StartCheck() |
| | | { |
| | | |
| | | if (isRightStart && isLeftStart) |
| | | { |
| | | if (_isdoing) |
| | |
| | | } |
| | | } |
| | | |
| | | _jobDoneHandle.Set(); |
| | | |
| | | var measurementUnitResultAndKeyUnitDataSet = GetMeasurementUnitResultAndKeyUnitData(pMeasure); |
| | | |
| | | if (pMeasure.PResult != "NA") |
| | |
| | | //} |
| | | |
| | | static object excelExportLock = new object(); |
| | | string fileName = ""; |
| | | private async void ExportProductionInColumns(ProductionMeasurementUnitResultAndKeyUnitDataSet exportData) |
| | | { |
| | | if (!Config.IsCSVOutputEnabled) |
| | |
| | | { |
| | | Directory.CreateDirectory(Config.LogPath); |
| | | } |
| | | var fileName = Path.Combine(Config.LogPath, $"LDSData_{DateTime.Now.ToString("yyyyMMdd")}.xlsx"); |
| | | |
| | | if (string.IsNullOrWhiteSpace(fileName)) |
| | | { |
| | | fileName = Path.Combine(Config.LogPath, $"LDSData_{DateTime.Now.ToString("yyyyMMdd_HHmmss")}.xlsx"); |
| | | } |
| | | |
| | | try |
| | | { |
| | |
| | | catch (Exception ex) |
| | | { |
| | | LogAsync(DateTime.Now, "Excel日志异常", ex.GetExceptionMessage()); |
| | | string bkFileName = Path.Combine(Config.LogPath, $"{Path.GetFileNameWithoutExtension(fileName)}_bk_{DateTime.Now.ToString("HHmmss")}.xlsx"); |
| | | File.Copy(fileName, bkFileName); |
| | | File.Delete(fileName); |
| | | fileName = Path.Combine(Config.LogPath, $"LDSData_{DateTime.Now.ToString("yyyyMMdd_HHmmss")}.xlsx"); |
| | | //string bkFileName = Path.Combine(Config.LogPath, $"{Path.GetFileNameWithoutExtension(fileName)}_bk_{DateTime.Now.ToString("HHmmss")}.xlsx"); |
| | | //File.Copy(fileName, bkFileName); |
| | | //File.Delete(fileName); |
| | | } |
| | | } |
| | | }); |
| | |
| | | } |
| | | #endregion |
| | | |
| | | static object _resultCalcLock = new object(); |
| | | |
| | | private async void RunImageHandle(IOperationConfig opConfig, IImageSet imgSet, string snapshotId, string snapshotName, List<MeasurementUnit> measureList) |
| | | { |
| | | await Task.Run(() => |
| | |
| | | // Directory.CreateDirectory(dir); |
| | | //} |
| | | |
| | | lock (_resultCalcLock) |
| | | { |
| | | //Parallel.For(1, count.I + 1, (i) => |
| | | for (int i = 1; i <= count.I; i++) |
| | | { |
| | |
| | | image = null; |
| | | } |
| | | //); |
| | | } |
| | | |
| | | imgSet.HImage.Dispose(); |
| | | imgSet.HImage = null; |