Parcourir la source

修复执行ExecutePhotoEx没有界面显示

KWD il y a 6 mois
Parent
commit
b2b72735bb
1 fichiers modifiés avec 41 ajouts et 3 suppressions
  1. 41 3
      TeamAAS-VM/Services/RemoteCommandService.cs

+ 41 - 3
TeamAAS-VM/Services/RemoteCommandService.cs

@@ -1615,7 +1615,7 @@ namespace TeamAAS_VP.Services
         /// <param name="outImage"></param>
         /// <param name="outImage"></param>
         /// <param name="outGraphicCollection"></param>
         /// <param name="outGraphicCollection"></param>
         /// <returns></returns>
         /// <returns></returns>
-        public bool ExecutePhotoEx(int index, ProcedureModel procedure, Dictionary<string, string> InputTerminal, out CogToolBlockTerminalCollection outputCollection, out ICogImage outImage, out CogGraphicCollection outGraphicCollection)
+        public bool ExecutePhotoEx(ProcedureModel procedure, Dictionary<string, string> InputTerminal, out CogToolBlockTerminalCollection outputCollection, out ICogImage outImage, out CogGraphicCollection outGraphicCollection)
         {
         {
             outImage = null;
             outImage = null;
             outGraphicCollection = null;
             outGraphicCollection = null;
@@ -1627,12 +1627,12 @@ namespace TeamAAS_VP.Services
                 bool succed = camera.SetExposureTime(procedure.ExposureTime);
                 bool succed = camera.SetExposureTime(procedure.ExposureTime);
                 if (!succed)
                 if (!succed)
                 {
                 {
-                    SendTaskMessage($"相机曝光设置失败!", MessageLevel.Error);
+                    SendTaskMessage(Lang.相机曝光设置失败, MessageLevel.Error);
                 }
                 }
                 succed = camera.SetGain(procedure.Gain);
                 succed = camera.SetGain(procedure.Gain);
                 if (!succed)
                 if (!succed)
                 {
                 {
-                    SendTaskMessage($"相机增益设置失败!", MessageLevel.Error);
+                    SendTaskMessage(Lang.相机增益设置失败, MessageLevel.Error);
                 }
                 }
                 DateTime nowtime = DateTime.Now;
                 DateTime nowtime = DateTime.Now;
                 LogHelper.WriteLogInfo("开始采集图像");
                 LogHelper.WriteLogInfo("开始采集图像");
@@ -1683,6 +1683,22 @@ namespace TeamAAS_VP.Services
                             record = item.Value as ICogRecord;
                             record = item.Value as ICogRecord;
                     }
                     }
                     outGraphicCollection = outputCollection["Graphic"].Value as CogGraphicCollection;
                     outGraphicCollection = outputCollection["Graphic"].Value as CogGraphicCollection;
+                    _eventAggregator.GetEvent<RenderUpdateNotification>().Publish(new ShowRender()
+                    {
+                        Id = procedure.Id,
+                        Image = (ICogImage)procedure.ToolBlock.Inputs["InputImage"].Value,
+                        Graphic = outputCollection["Graphic"].Value as CogGraphicCollection,
+                        Record = record,
+                        Result = (bool)(outputCollection["Found"].Value),
+                        IsShow = true,
+                        IsSaveImage = procedure.IsSaveImage,
+                        SaveImageModel = procedure.SaveImageModel,
+                        SaveImagePathModel = procedure.SaveImagePathModel,
+                        SavePath = procedure.SavePath,
+                        IsCompress = procedure.IsCompress,
+                        IsDelaySaveImage = procedure.IsDelaySaveImage,
+                        ProceductName = procedure.Name,
+                    });
                     return true;
                     return true;
                 }
                 }
                 else
                 else
@@ -1691,6 +1707,28 @@ namespace TeamAAS_VP.Services
                     SendTaskMessage(procedure.ToolBlock.RunStatus.Message, MessageLevel.Error);
                     SendTaskMessage(procedure.ToolBlock.RunStatus.Message, MessageLevel.Error);
                     outputCollection = null;
                     outputCollection = null;
                     outGraphicCollection = outputCollection["Graphic"].Value as CogGraphicCollection;
                     outGraphicCollection = outputCollection["Graphic"].Value as CogGraphicCollection;
+                    ICogRecord record = null;
+                    foreach (CogToolBlockTerminal item in outputCollection)
+                    {
+                        if (item.Value is ICogRecord)
+                            record = item.Value as ICogRecord;
+                    }
+                    _eventAggregator.GetEvent<RenderUpdateNotification>().Publish(new ShowRender()
+                    {
+                        Id = procedure.Id,
+                        Image = (ICogImage)procedure.ToolBlock.Inputs["InputImage"].Value,
+                        Graphic = outputCollection["Graphic"].Value as CogGraphicCollection,
+                        Record = record,
+                        Result = (bool)(outputCollection["Found"].Value),
+                        IsShow = true,
+                        IsSaveImage = procedure.IsSaveImage,
+                        SaveImageModel = procedure.SaveImageModel,
+                        SaveImagePathModel = procedure.SaveImagePathModel,
+                        SavePath = procedure.SavePath,
+                        IsCompress = procedure.IsCompress,
+                        IsDelaySaveImage = procedure.IsDelaySaveImage,
+                        ProceductName = procedure.Name,
+                    });
                     return false;
                     return false;
                 }
                 }
             }
             }