public static WorkpieceInfoEntry ToEntry(this WorkpieceInfo workpieceInfo) { var id = new WorkpieceInfoEntry(); id.InjectFrom(workpieceInfo); return(id); }
public void AddWorkpieceInfo(WorkpieceInfo workpieceInfo) { Repository.Add(workpieceInfo); Repository.UnitOfWork.Commit(); EventBus.Publish(new WorkpieceInfoAddedDomainEvent() { WorkpieceInfo = workpieceInfo, }); }
public void HandleSurfaceInspectionInfo(SurfaceInspectInfo inspectInfo) { Debug.WriteLine("InspectionDomainService.HandleSurfaceInspectionInfo(): " + inspectInfo.SurfaceTypeIndex); lock (locker) { WorkpieceInfo wi; wi = _workpieceInfos.SingleOrDefault(x => x.Index == inspectInfo.WorkpieceIndex); if (wi == null) { wi = new WorkpieceInfo { Index = inspectInfo.WorkpieceIndex, InspectDateTime = DateTime.Now, }; Repository.Add(wi); Repository.UnitOfWork.Commit(); _workpieceInfos.Enqueue(wi); } _surfaceInspectInfos.Enqueue(inspectInfo); var siis = new List <StoredImageInfo>(); wi.InspectDateTime = DateTime.Now; wi.DefectInfos.AddRange(_surfaceInspectInfos.SelectMany(x => x.InspectInfo.DefectInfos)); wi.MeasurementInfos.AddRange(_surfaceInspectInfos.SelectMany(x => x.InspectInfo.MeasurementInfos)); if (MachineConfigProvider.MachineConfig.Reporting_StoreAcceptedImageEnabled && !wi.DefectInfos.Any()) { foreach (var surfaceInspectInfo in _surfaceInspectInfos) { var sii = surfaceInspectInfo.SaveImage(); siis.Add(sii); } } if (MachineConfigProvider.MachineConfig.Reporting_StoreRejectedImageEnabled && wi.DefectInfos.Any()) { foreach (var surfaceInspectInfo in _surfaceInspectInfos) { var sii = surfaceInspectInfo.SaveImage(); siis.Add(sii); } } wi.StoredImageInfo.AddRange(siis); Repository.Update(wi); Repository.UnitOfWork.Commit(); _surfaceInspectInfos.Clear(); } }