5 Commits f8bfd9d826 ... cb7c2b7b1f

Auteur SHA1 Bericht Datum
  Yuli cb7c2b7b1f ~~ 1 maand geleden
  Yuli a8f96e5752 调整了各模块命名与依赖 1 maand geleden
  Yuli 525a04bd6b 调整Cnd模型到Motion/Model,调整视觉接口到Vision/SKV0 1 maand geleden
  Yuli b58e705181 调整视觉通讯协议放到Device/SKVision 1 maand geleden
  Yuli 259a3416bb 细节调整 1 maand geleden
46 gewijzigde bestanden met toevoegingen van 578 en 418 verwijderingen
  1. 0 0
      SKMC.API-v3.sln
  2. 23 24
      SKMC.API/Client/Access/ClientAccessCodes.cs
  3. 3 5
      SKMC.API/Client/ClientCacher.cs
  4. 3 0
      SKMC.API/Client/Config/ClientConstants.cs
  5. 88 0
      SKMC.API/Client/UI/ClientDialogs.cs
  6. 1 6
      SKMC.API/Client/UI/IShowDialog.cs
  7. 78 0
      SKMC.API/Client/Views/BaseEditorModel.cs
  8. 1 7
      SKMC.API/Client/Views/ExceptionViewModel.cs
  9. 0 5
      SKMC.API/Client/Views/MenuViewModel.cs
  10. 43 0
      SKMC.API/Common/CommonCacher.cs
  11. 3 3
      SKMC.API/Common/DB/SqlSugarTool.cs
  12. 3 2
      SKMC.API/Common/Exceptions/ExceptionBase.cs
  13. 1 21
      SKMC.API/Common/Exceptions/ExceptionConfig.cs
  14. 19 0
      SKMC.API/Common/Exceptions/ExceptionConfigStore.cs
  15. 1 7
      SKMC.API/Common/Exceptions/ExceptionShow.cs
  16. 69 0
      SKMC.API/Common/Exceptions/ExceptionWrapper.cs
  17. 3 5
      SKMC.API/Common/Tasks/Tasks.cs
  18. 17 6
      SKMC.API/Machine/Config/MachineConfigStore.cs
  19. 3 3
      SKMC.API/Machine/Config/MachineParamEnum.cs
  20. 8 19
      SKMC.API/Machine/MachineCacher.cs
  21. 0 1
      SKMC.API/Machine/Monitor/MachineActivity.cs
  22. 2 7
      SKMC.API/Machine/Monitor/MachineActivityMonitor.cs
  23. 0 4
      SKMC.API/Machine/Monitor/MachineLatchTask.cs
  24. 0 5
      SKMC.API/Machine/Monitor/MachineStateLatchMonitor.cs
  25. 1 1
      SKMC.API/Motion/Control/IMotionChecker.cs
  26. 67 14
      SKMC.API/Motion/Control/IMotionControl.cs
  27. 7 2
      SKMC.API/Motion/Driver/IMotionDriver.cs
  28. 1 2
      SKMC.API/Motion/Driver/IMotionDriverAdvance.cs
  29. 3 4
      SKMC.API/Motion/Model/AxisCnd.cs
  30. 1 1
      SKMC.API/Motion/Model/Cnds.cs
  31. 1 3
      SKMC.API/Motion/Model/DioCnd.cs
  32. 9 14
      SKMC.API/Motion/MotionCacher.cs
  33. 0 5
      SKMC.API/Process/Config/ProcessException.cs
  34. 1 6
      SKMC.API/Process/Control/IProcessLocker.cs
  35. 0 181
      SKMC.API/Process/Control/ProcessExceptions.cs
  36. 1 0
      SKMC.API/Process/Model/ProcessStep.cs
  37. 1 6
      SKMC.API/Recipe/Config/RecipeConfigManager.cs
  38. 28 14
      SKMC.API/Recipe/Config/RecipeConfigStore.cs
  39. 4 8
      SKMC.API/Recipe/Config/RecipeParamBase.cs
  40. 6 6
      SKMC.API/Recipe/Model/RecipeProfile.cs
  41. 57 0
      SKMC.API/Recipe/RecipeCacher.cs
  42. 18 10
      SKMC.API/SKMC.API.csproj
  43. 1 1
      SKMC.API/Vision/SKV0/SKVisionClient.cs
  44. 1 5
      SKMC.API/Vision/SKV0/SKVisionClientBase.cs
  45. 1 4
      SKMC.API/Vision/SKV0/SKVisionProtocol.cs
  46. 0 1
      SKMC.API/v3

+ 0 - 0
SKMC.API.sln → SKMC.API-v3.sln


+ 23 - 24
SKMC.API/Client/Access/ClientAccessCodes.cs

@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
+
 namespace SKMC.Api.Client.Access
 {
     /// <summary>
@@ -41,45 +36,49 @@ namespace SKMC.Api.Client.Access
         /// </summary>
         public static string MotionDoOper = "MotionDoOper";
         /// <summary>
-        /// 设备基础配置界面可视
+        /// 机台配置界面可视
+        /// </summary>
+        public static string MachineConfigView = "MachineConfigView";
+        /// <summary>
+        /// 机台配置界面可操作
         /// </summary>
-        public static string DeviceConfigView = "DeviceConfigView";
+        public static string MachineConfigOper = "MachineConfigOper";
         /// <summary>
-        /// 流程界面可视
+        /// 配方界面可视
         /// </summary>
-        public static string ProcessView = "ProcessView";
+        public static string RecipeView = "RecipeView";
         /// <summary>
-        /// 流程参数界面可视
+        /// 配方参数界面可视
         /// </summary>
-        public static string ProcessBaseConfigView = "ProcessBaseConfigView";
+        public static string RecipeBaseConfigView = "RecipeBaseConfigView";
         /// <summary>
-        /// 流程参数界面可操作
+        /// 配方参数界面可操作
         /// </summary>
-        public static string ProcessBaseConfigOper = "ProcessBaseConfigOper";
+        public static string RecipeBaseConfigOper = "RecipeBaseConfigOper";
         /// <summary>
-        /// 流程高级参数界面可视
+        /// 配方高级参数界面可视
         /// </summary>
-        public static string ProcessAdvConfigView = "ProcessAdvConfigView";
+        public static string RecipeAdvConfigView = "RecipeAdvConfigView";
         /// <summary>
-        /// 流程高级参数界面可操作
+        /// 配方高级参数界面可操作
         /// </summary>
-        public static string ProcessAdvConfigOper = "ProcessAdvConfigOper";
+        public static string RecipeAdvConfigOper = "RecipeAdvConfigOper";
         /// <summary>
-        /// 流程点位界面可视
+        /// 配方点位界面可视
         /// </summary>
-        public static string ProcessPointView = "ProcessPointView";
+        public static string RecipePointView = "RecipePointView";
         /// <summary>
-        /// 流程点位界面可操作
+        /// 配方点位界面可操作
         /// </summary>
-        public static string ProcessPointOper = "ProcessPointOper";
+        public static string RecipePointOper = "RecipePointOper";
         /// <summary>
         /// 速度设置界面可视
         /// </summary>
-        public static string ProcessSpeedView = "ProcessSpeedView";
+        public static string RecipeSpeedView = "RecipeSpeedView";
         /// <summary>
         /// 速度设置界面可操作
         /// </summary>
-        public static string ProcessSpeedOper = "ProcessSpeedOper";
+        public static string RecipeSpeedOper = "RecipeSpeedOper";
         /// <summary>
         /// 手动界面可视
         /// </summary>

+ 3 - 5
SKMC.API/Client/ClientCacher.cs

@@ -1,16 +1,14 @@
 using Prism.Mvvm;
 using Prism.Regions;
 using Prism.Services.Dialogs;
-using SKMC.Api.Client.Model;
 using SKMC.Api.Client.Access;
+using SKMC.Api.Client.Model;
+using SKMC.Api.Client.UI;
 using SKMC.Api.Client.Views;
 using SKMC.Api.Common.Exceptions;
 using System;
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 
 namespace SKMC.Api.Client
 {
@@ -37,7 +35,7 @@ namespace SKMC.Api.Client
         /// <summary>
         /// 异常窗口的抽象视图模型
         /// </summary>
-        public ExceptionsViewModel ExceptionsViewModel { get; set; }
+        public ExceptionViewModel ExceptionsViewModel { get; set; }
 
         /// <summary>
         /// 当前登录角色

+ 3 - 0
SKMC.API/Client/Config/ClientConstants.cs

@@ -12,5 +12,8 @@ namespace SKMC.Api.Client.Config
         public const string Operation_Ignore = "忽略";
         public const string Operation_Abort = "退出";
         public const string Catalog_ALL = "ALL";
+
+        public const string Views_CommonException = "CommonExceptionsView";
+        public const string Views_CommonNotification = "CommonNotificationView";
     }
 }

+ 88 - 0
SKMC.API/Client/UI/ClientDialogs.cs

@@ -0,0 +1,88 @@
+using Prism.Services.Dialogs;
+using SKMC.Api.Client.Config;
+using SKMC.Api.Client.Model;
+using SKMC.Api.Common;
+using SKMC.Api.Common.Exceptions;
+using System;
+using System.Windows;
+
+namespace SKMC.Api.Client.UI
+{
+    /// <summary>
+    /// 提供异常、通知等对话弹窗
+    /// </summary>
+    public class ClientDialogs
+    {
+        private readonly static CommonCacher commonCacher = ObjectFactory.Resolve<CommonCacher>();
+        private readonly static ClientCacher clientCacher = ObjectFactory.Resolve<ClientCacher>();
+        public const string DefaultViewName = ClientConstants.Views_CommonException;
+        public const string NoticeViewName = ClientConstants.Views_CommonNotification;
+
+        public static string CreateExceptionDialog(ExceptionShow exceptionShow, string dialogName = DefaultViewName)
+        {
+            if (exceptionShow == null) return null;
+            if (dialogName != null)
+            {
+                return clientCacher.ShowExceptionDialog(dialogName, exceptionShow);
+            }
+            else
+            {
+                CreateExceptionDialog(exceptionShow);
+                return null;
+            }
+        }
+
+        /// <summary>
+        /// 创建一个异常弹窗
+        /// </summary>
+        /// <param name="exceptionBase"></param>
+        /// <param name="dialogName"></param>
+        public static string CreateExceptionDialog(ExceptionBase exceptionBase, string dialogName = DefaultViewName)
+        {
+            if (exceptionBase == null) return null;
+            ExceptionShow exceptionShow = commonCacher.GetExceptionShow(exceptionBase);
+            return CreateExceptionDialog(exceptionShow, dialogName);
+        }
+
+        public static void CreateExceptionDialog(Exception exception)
+        {
+            MessageBox.Show($"出现未知异常: {exception.Message}, Detail: {exception.StackTrace}");
+        }
+
+        public static void CreateExceptionDialog(ExceptionShow exceptionShow)
+        {
+            MessageBox.Show($"出现异常, Code:{exceptionShow.Code}, Name: {exceptionShow.Name}, Level: {exceptionShow.Level}");
+        }
+
+        /// <summary>
+        /// 创建一个提醒弹窗
+        /// </summary>
+        /// <param name="title">提醒标题</param>
+        /// <param name="message">提醒内容</param>
+        public static string CreateNotificationDialog(string title, string message, byte level = 0)
+        {
+            DialogParameters parameters = new DialogParameters();
+            parameters.Add("model", new ClientNotification
+            {
+                Head = title,
+                Detail = message,
+                DateTime = DateTime.Now,
+                Level = level
+            });
+            return clientCacher.ShowCommonDialog(NoticeViewName, parameters, null, false);
+        }
+
+        public static bool IsDialogShow(string id) => clientCacher.IsDialogShow(id);
+
+        /// <summary>
+        /// 关闭特定Id的对话框
+        /// </summary>
+        /// <param name="id"></param>
+        public static void CloseDialog(string id) => clientCacher.CloseDialog(id);
+
+        /// <summary>
+        /// 关闭所有对话框
+        /// </summary>
+        public static void CloseAllDialogs() => clientCacher.CloseAllDialogs();
+    }
+}

+ 1 - 6
SKMC.API/Client/Views/IShowDialog.cs → SKMC.API/Client/UI/IShowDialog.cs

@@ -1,11 +1,6 @@
 using Prism.Services.Dialogs;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 
-namespace SKMC.Api.Client.Views
+namespace SKMC.Api.Client.UI
 {
     /// <summary>
     /// 可外部关闭的Dialog接口

+ 78 - 0
SKMC.API/Client/Views/BaseEditorModel.cs

@@ -0,0 +1,78 @@
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Services.Dialogs;
+using SKMC.Api.Client.UI;
+using SKMC.Api.Common;
+using System;
+
+namespace SKMC.Api.Client.Views
+{
+    /// <summary>
+    /// 封装Editor基础类
+    /// </summary>
+    /// <typeparam name="T"></typeparam>
+    public class BaseEditorModel<T> : BindableBase, IShowDialog
+    {
+        private readonly ClientCacher clientCacher = ObjectFactory.Resolve<ClientCacher>();
+
+        public string Id { get; set; }
+
+        public string Title { get; set; }
+
+        public event Action<IDialogResult> RequestClose;
+
+        public T Model { get; set; }
+
+        public DelegateCommand SaveCommand { get; set; }
+
+        public DelegateCommand CancelCommand { get; set; }
+
+        public bool CanCloseDialog() => true;
+
+        public BaseEditorModel()
+        {
+            SaveCommand = new DelegateCommand(() =>
+            {
+                DialogParameters parameters = new DialogParameters
+                {
+                    { "Id", Id }
+                };
+                if (Model != null) parameters.Add("result", Model);
+                RequestClose?.Invoke(new DialogResult(ButtonResult.OK, parameters));
+            });
+
+            CancelCommand = new DelegateCommand(() =>
+            {
+                DialogParameters parameters = new DialogParameters
+                {
+                    { "Id", Id }
+                };
+                RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel, parameters));
+            });
+        }
+
+        public void OnDialogClosed()
+        {
+        }
+
+        public void OnDialogOpened(IDialogParameters parameters)
+        {
+            if (parameters.GetValue<T>("model") != null)
+            {
+                Model = parameters.GetValue<T>("model");
+            }
+            Id = CommonUtil.StringId();
+            clientCacher.ShowCommonDialogs.Add(this);
+        }
+
+        public void CloseDialog()
+        {
+            DialogParameters parameters = new DialogParameters
+            {
+                { "Id", Id }
+            };
+            if (Model != null) parameters.Add("result", Model);
+            RequestClose?.Invoke(new DialogResult(ButtonResult.OK, parameters));
+        }
+    }
+}

+ 1 - 7
SKMC.API/Client/Views/ExceptionsViewModel.cs → SKMC.API/Client/Views/ExceptionViewModel.cs

@@ -1,18 +1,12 @@
 using Prism.Commands;
 using Prism.Mvvm;
-using Prism.Services.Dialogs;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 
 namespace SKMC.Api.Client.Views
 {
     /// <summary>
     /// 异常窗口的抽象视图模型
     /// </summary>
-    public class ExceptionsViewModel : BindableBase
+    public class ExceptionViewModel : BindableBase
     {
         /// <summary>
         /// 异常对话框是否已弹出

+ 0 - 5
SKMC.API/Client/Views/MenuViewModel.cs

@@ -3,11 +3,6 @@ using Prism.Mvvm;
 using Prism.Regions;
 using SKMC.Api.Client.Access;
 using SKMC.Api.Common;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 
 namespace SKMC.Api.Client.Views
 {

+ 43 - 0
SKMC.API/Common/CommonCacher.cs

@@ -0,0 +1,43 @@
+using SKMC.Api.Common.Exceptions;
+using System.Collections.Generic;
+
+namespace SKMC.Api.Common
+{
+    public abstract class CommonCacher
+    {
+        /// <summary>
+        /// 异常配置集
+        /// </summary>
+        public List<ExceptionConfig> Exceptions { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="exceptionBase"></param>
+        /// <returns></returns>
+        public abstract ExceptionConfig GetExceptionConfig(ExceptionBase exceptionBase);
+
+        /// <summary>
+        /// 获取异常配置对象
+        /// </summary>
+        /// <param name="code">异常码</param>
+        /// <param name="cloned">是否复制为新对象</param>
+        /// <returns></returns>
+        public abstract ExceptionConfig GetExceptionConfig(string code, bool cloned = false);
+
+        /// <summary>
+        /// 获取异常配置对象
+        /// </summary>
+        /// <param name="code">异常码</param>
+        /// <param name="cloned">是否复制为新对象</param>
+        /// <returns></returns>
+        public abstract ExceptionConfig GetExceptionConfig(int sysCode, bool cloned = false);
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="exceptionBase"></param>
+        /// <returns></returns>
+        public abstract ExceptionShow GetExceptionShow(ExceptionBase exceptionBase);
+    }
+}

+ 3 - 3
SKMC.API/Common/DB/SqlSugarTool.cs

@@ -1,5 +1,6 @@
-using SKMC.Api.Common.File;
-using Newtonsoft.Json;
+using Newtonsoft.Json;
+using SKMC.Api.Common.File;
+using SKMC.Api.Common.Logger;
 using SqlSugar;
 using System;
 using System.Collections.Generic;
@@ -8,7 +9,6 @@ using System.Linq;
 using System.Linq.Expressions;
 using System.Text;
 using DbType = SqlSugar.DbType;
-using SKMC.Api.Common.Logger;
 
 namespace SKMC.Api.Common.DB
 {

+ 3 - 2
SKMC.API/Common/Exceptions/ExceptionBase.cs

@@ -4,6 +4,7 @@ namespace SKMC.Api.Common.Exceptions
 {
     /// <summary>
     /// 基础异常模型
+    /// 机台运行中可抛出该类型对象或者子类对象
     /// </summary>
     public class ExceptionBase : Exception
     {
@@ -21,8 +22,8 @@ namespace SKMC.Api.Common.Exceptions
         /// 异常级别
         /// 0: 不影响运行的告警
         /// 1: 影响不大, 可暂时忽略
-        /// 2: 影响较大, 需设备告警并解决完毕后才可继续
-        /// 4: 影响非常大, 可能伤人或伤设备, 设备告警时系统会自动退出运行
+        /// 2: 影响较大, 需机台暂停并解决完毕后才可继续
+        /// 4: 影响非常大, 可能伤人或伤设备, 机台告警时流程退出运行
         /// </summary>
         public short Level { get; set; }
 

+ 1 - 21
SKMC.API/Common/Exceptions/ExceptionConfig.cs

@@ -5,32 +5,12 @@ namespace SKMC.Api.Common.Exceptions
 {
     /// <summary>
     /// 异常处理配置模型
+    /// 读取配置库中的表SKMC_COMMON_EXCEPTION并转换而成
     /// </summary>
     public class ExceptionConfig : BindableBase
     {
         public ExceptionConfig() { }
 
-        public ExceptionConfig(ExceptionConfig exceptionConfiger)
-        {
-            if (exceptionConfiger != null)
-            {
-                Id = exceptionConfiger.Id;
-                Code = exceptionConfiger.Code;
-                Type = exceptionConfiger.Type;
-                Level = exceptionConfiger.Level;
-                Group = exceptionConfiger.Group;
-                Name = exceptionConfiger.Name;
-                Note = exceptionConfiger.Note;
-                Tips = exceptionConfiger.Tips;
-                CanRetry = exceptionConfiger.CanRetry;
-                CanIgnore = exceptionConfiger.CanIgnore;
-                CanAbort = exceptionConfiger.CanAbort;
-                RetryMsg = exceptionConfiger.RetryMsg;
-                RetryMsgSuccess = exceptionConfiger.RetryMsgSuccess;
-                RetryMsgFailed = exceptionConfiger.RetryMsgFailed;
-            }
-        }
-
         protected long _id;
 
         public long Id

+ 19 - 0
SKMC.API/Common/Exceptions/ExceptionConfigStore.cs

@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SKMC.Api.Common.Exceptions
+{
+    public abstract class ExceptionConfigStore
+    {
+
+        /// <summary>
+        /// 查询所有的异常配置
+        /// </summary>
+        /// <returns></returns>
+        public abstract List<ExceptionConfig> QueryExceptions();
+
+    }
+}

+ 1 - 7
SKMC.API/Common/Exceptions/ExceptionShow.cs

@@ -1,17 +1,12 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 
 namespace SKMC.Api.Common.Exceptions
 {
     /// <summary>
-    /// 基于异常配置的异常展示模型
+    /// 异常的UI层展示模型
     /// </summary>
     public class ExceptionShow : ExceptionConfig, ICloneable
     {
-        public ExceptionShow(ExceptionConfig exceptionConfig) : base(exceptionConfig) { }
 
         private string _uid;
 
@@ -21,7 +16,6 @@ namespace SKMC.Api.Common.Exceptions
             set { _uid = value; }
         }
 
-
         private DateTime _encounterTime;
         /// <summary>
         /// 异常发生时间

+ 69 - 0
SKMC.API/Common/Exceptions/ExceptionWrapper.cs

@@ -0,0 +1,69 @@
+using SKMC.Api.Client.Config;
+using SKMC.Api.Client.UI;
+using SKMC.Api.Common.Logger;
+using SKMC.Api.Machine.Control;
+using System;
+
+namespace SKMC.Api.Common.Exceptions
+{
+    /// <summary>
+    /// 异常包装类
+    /// </summary>
+    public class ExceptionWrapper
+    {
+        private static readonly ILogger log = LogFactory.Get();
+        private static readonly IMachineBoardControl machineBoardControl = ObjectFactory.Resolve<IMachineBoardControl>();
+        private static readonly CommonCacher commonCacher = ObjectFactory.Resolve<CommonCacher>();
+
+        public static string Throws(Exception exception, string dialogViewName = ClientConstants.Views_CommonException)
+        {
+            if (exception == null) return null;
+            if (typeof(ExceptionBase).IsAssignableFrom(exception.GetType()))
+            {
+                ExceptionBase exceptionBase = exception as ExceptionBase;
+                ExceptionConfig exceptionConfig = commonCacher.GetExceptionConfig(exceptionBase);
+                exceptionBase.Level = exceptionConfig.Level;
+                // 停机异常
+                if (exceptionConfig.Level == 4)
+                {
+                    machineBoardControl.IsAlarm = true;
+                    machineBoardControl.StopAction.Invoke();
+                    log.Error($"严重异常: {exception}");
+                    return ClientDialogs.CreateExceptionDialog(exceptionBase, dialogViewName);
+                }
+                // 普通异常
+                if (exceptionConfig.Level == 2)
+                {
+                    machineBoardControl.IsAlarm = true;
+                    machineBoardControl.PauseAction.Invoke();
+                    log.Error($"普通异常: {exception},{exception.StackTrace}");
+                    return ClientDialogs.CreateExceptionDialog(exceptionBase, dialogViewName);
+                }
+                // 单站异常
+                if (exceptionConfig.Level == 1)
+                {
+                    if (exceptionBase.StationId > 0)
+                    {
+                        machineBoardControl.PauseOneAction.Invoke(exceptionBase.StationId);
+                    }
+                    log.Error($"单站异常: {exception}");
+                    return ClientDialogs.CreateExceptionDialog(exceptionBase, dialogViewName);
+                }
+                else
+                {
+                    log.Error($"其他异常: {exception}");
+                    return null;
+                }
+            }
+            // 未知异常
+            else
+            {
+                machineBoardControl.IsAlarm = true;
+                machineBoardControl.StopAction.Invoke();
+                log.Error($"未知异常: {exception.Message}", exception);
+                ClientDialogs.CreateExceptionDialog(exception);
+                return null;
+            }
+        }
+    }
+}

+ 3 - 5
SKMC.API/Common/Tasks/Tasks.cs

@@ -1,9 +1,7 @@
-using SKMC.Api.Common.Logger;
-using SKMC.Api.Process.Control;
+using SKMC.Api.Common.Exceptions;
+using SKMC.Api.Common.Logger;
 using System;
 using System.Collections.Generic;
-using System.Linq;
-using System.Text;
 using System.Threading.Tasks;
 
 namespace SKMC.Api.Common.Tasks
@@ -34,7 +32,7 @@ namespace SKMC.Api.Common.Tasks
                     }
                     catch (Exception e)
                     {
-                        ProcessExceptions.WrapThrows(e);
+                        ExceptionWrapper.Throws(e);
                     }
                 });
                 tasks.Add(task);

+ 17 - 6
SKMC.API/Machine/Config/MachineConfigStore.cs

@@ -1,14 +1,25 @@
-using SKMC.Api.Common.Exceptions;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Collections.ObjectModel;
 
 namespace SKMC.Api.Machine.Config
 {
     public abstract class MachineConfigStore
     {
+        /// <summary>
+        /// 查询机台参数集合
+        /// </summary>
+        /// <returns></returns>
+        public abstract ObservableCollection<MachineParamConfig> QueryParams();
 
+        /// <summary>
+        /// 查询机台分类集合
+        /// </summary>
+        /// <returns></returns>
+        public abstract ObservableCollection<MachineCatalogConfig> QueryCatalogs();
+
+        /// <summary>
+        /// 保存机台参数
+        /// </summary>
+        /// <param name="machineParamConfig"></param>
+        public abstract void SaveMachineParam(MachineParamConfig machineParamConfig);
     }
 }

+ 3 - 3
SKMC.API/Machine/Config/MachineParamEnum.cs

@@ -7,13 +7,13 @@ namespace SKMC.Api.Machine.Config
     public enum MachineParamEnum
     {
         /// <summary>
-        /// 设备
+        /// 机台
         /// 10
         /// </summary>
-        Device,
+        Machine,
 
         /// <summary>
-        /// 控组(电机与IO)
+        /// 控组(电机与IO)
         /// 11
         /// </summary>
         Motion,

+ 8 - 19
SKMC.API/Machine/MachineCacher.cs

@@ -1,5 +1,6 @@
 using SKMC.Api.Common.Exceptions;
 using SKMC.Api.Machine.Config;
+using System.Collections.Generic;
 using System.Collections.ObjectModel;
 
 namespace SKMC.Api.Machine
@@ -9,11 +10,15 @@ namespace SKMC.Api.Machine
     /// </summary>
     public abstract class MachineCacher
     {
-        // Catalog数据
+        /// <summary>
+        /// Catalog数据
+        /// </summary>
         public ObservableCollection<MachineCatalogConfig> MachineCatalogs { get; set; }
 
-        // Param数据
-        public ObservableCollection<MachineParamConfig> MachineParams { get; set; }
+        /// <summary>
+        /// Param数据
+        /// </summary>
+        public ObservableCollection<MachineParamConfig> MachineParams { get; set; }     
 
         /// <summary>
         /// 获取设备参数
@@ -49,21 +54,5 @@ namespace SKMC.Api.Machine
         /// <returns></returns>
         public abstract T GetMachineParamValue<T>(MachineParamEnum groupEnum, MachineParamEnum codeEnum);
 
-        /// <summary>
-        /// 获取异常配置对象
-        /// </summary>
-        /// <param name="code">异常码</param>
-        /// <param name="cloned">是否复制为新对象</param>
-        /// <returns></returns>
-        public abstract ExceptionConfig GetException(string code, bool cloned = false);
-
-        /// <summary>
-        /// 获取异常配置对象
-        /// </summary>
-        /// <param name="code">异常码</param>
-        /// <param name="cloned">是否复制为新对象</param>
-        /// <returns></returns>
-        public abstract ExceptionConfig GetException(int sysCode, bool cloned = false);
-
     }
 }

+ 0 - 1
SKMC.API/Machine/Monitor/MachineActivity.cs

@@ -1,5 +1,4 @@
 using System;
-using System.Collections.Generic;
 
 namespace SKMC.Api.Machine.Monitor
 {

+ 2 - 7
SKMC.API/Machine/Monitor/MachineActivityMonitor.cs

@@ -1,14 +1,9 @@
 using SKMC.Api.Common.Monitor;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 
 namespace SKMC.Api.Machine.Monitor
 {
     /// <summary>
-    /// 机台活动的观察服务接口
+    /// 机台活动监测器接口
     /// 用于持续的状态监控,例如开门报警、低压报警等
     /// </summary>
     public abstract class MachineActivityMonitor : BaseMonitor
@@ -17,7 +12,7 @@ namespace SKMC.Api.Machine.Monitor
         /// 添加需要观察的流程活动
         /// </summary>
         /// <param name="machineActivity"></param>
-        public abstract void Observe(MachineActivity machineActivity);
+        public abstract void Watch(MachineActivity machineActivity);
 
         /// <summary>
         /// 移除不需要观察的流程活动

+ 0 - 4
SKMC.API/Machine/Monitor/MachineLatchTask.cs

@@ -1,8 +1,4 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 
 namespace SKMC.Api.Machine.Monitor
 {

+ 0 - 5
SKMC.API/Machine/Monitor/MachineStateLatchMonitor.cs

@@ -1,10 +1,5 @@
 using SKMC.Api.Common.Monitor;
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Timers;
 
 namespace SKMC.Api.Machine.Monitor
 {

+ 1 - 1
SKMC.API/Motion/Control/IMotionChecker.cs

@@ -1,4 +1,4 @@
-using SKMC.Api.Process.Model;
+using SKMC.Api.Motion.Model;
 using System;
 using System.Collections.Generic;
 

+ 67 - 14
SKMC.API/Motion/Control/IMotionControl.cs

@@ -136,22 +136,22 @@ namespace SKMC.Api.Motion.Control
         /// <para>3.剩下返回true</para>
         /// </summary>
         /// <param name="pointCode">点位码</param>
-        /// <param name="axisIndex">绑定点位的电机序号, 0开头, 默认-1表示该点位的所有电机</param>
+        /// <param name="index">绑定点位的电机序号, 0开头, 默认-1表示该点位的所有电机</param>
         /// <param name="negativeOffset">大于该点位的负方向距离</param>
         /// <param name="positiveOffset">小于该点位的正方向距离</param>
         /// <returns>是否满足位置条件</returns>
-        bool CheckNear(string pointCode, short axisIndex = -1, double negativeOffset = 0.1, double positiveOffset = 0.1);
+        bool CheckNear(string pointCode, short index = -1, double negativeOffset = 0.1, double positiveOffset = 0.1);
 
         /// <summary>
         /// 通过点位码驱动对应的Axis运动, speedRadio表示每秒旋转圈数
         /// </summary>
         /// <param name="pointCode">点位码</param>
-        /// <param name="speedRadio">每秒旋转圈数</param>
+        /// <param name="speedRound">电机每秒旋转圈数</param>
         /// <param name="waiting">是否等待到位, 默认为true</param>
         /// <param name="inRange">整定范围, 单位毫米或者步距</param>
         /// <param name="onSuccess">运动完成后的回调动作</param>
         /// <param name="onTimeout">超时未完成的回调动作</param>
-        void MoveRound(string pointCode, double speedRadio, bool waiting = true, double inRange = -1,
+        void MoveRound(string pointCode, double speedRound, bool waiting = true, double inRange = -1,
             Action onSuccess = null, Action onTimeout = null);
 
         /// <summary>
@@ -178,6 +178,18 @@ namespace SKMC.Api.Motion.Control
         void MovePoint(RecipePoint recipePoint, RecipeSpeed recipeSpeed = null, bool waiting = true, double inRange = -1,
             Action onSuccess = null, Action onTimeout = null);
 
+        /// <summary>
+        /// 让绑定点位码的(多个)电机以指定速度运动到点位码
+        /// </summary>
+        /// <param name="recipePoint">点位对象</param>
+        /// <param name="speedCode">速度码, null表示使用该点配置的默认速度码</param>
+        /// <param name="waiting">是否等待到位, 默认为true</param>
+        /// <param name="inRange">整定范围, 单位毫米或者步距</param>
+        /// <param name="onSuccess">运动完成后的回调动作</param>
+        /// <param name="onTimeout">超时未完成的回调动作</param>
+        void MovePoint(RecipePoint recipePoint, string speedCode = null, bool waiting = true, double inRange = -1,
+            Action onSuccess = null, Action onTimeout = null);
+
         /// <summary>
         /// 让绑定点位码的(多个)电机以指定速度运动到点位码并能叠加指定偏移量
         /// </summary>
@@ -191,6 +203,19 @@ namespace SKMC.Api.Motion.Control
         void MovePointFix(string pointCode, double[] posOffsets, string speedCode = null, bool waiting = true, double inRange = -1,
             Action onSuccess = null, Action onTimeout = null);
 
+        /// <summary>
+        /// 让绑定点位码的(多个)电机以指定速度运动到点位码,并能叠加指定偏移量
+        /// </summary>
+        /// <param name="recipePoint">点位对象</param>
+        /// <param name="posOffsets">各个电机的偏移量数组, 需要按电机绑定顺序赋值</param>
+        /// <param name="speedCode">速度码, null表示使用该点配置的默认速度码</param>
+        /// <param name="waiting">是否等待到位, 默认为true</param>
+        /// <param name="inRange">整定范围, 单位毫米或者步距</param>
+        /// <param name="onSuccess">运动完成后的回调动作</param>
+        /// <param name="onTimeout">超时未完成的回调动作</param>
+        void MovePointFix(RecipePoint recipePoint, double[] posOffsets, string speedCode = null, bool waiting = true, double inRange = -1,
+            Action onSuccess = null, Action onTimeout = null);
+
         /// <summary>
         /// 让绑定点位码的(多个)电机以指定速度运动到点位码,并能叠加指定偏移量
         /// </summary>
@@ -208,13 +233,13 @@ namespace SKMC.Api.Motion.Control
         /// 让绑定点位码的指定单个电机以指定速度运动到点位码
         /// </summary>
         /// <param name="pointCode">点位码</param>
-        /// <param name="index">该点位绑定的轴序号, 例如绑定了x1,y1,需要x1移动时传0,需要y1移动时传1</param>
+        /// <param name="axisCode">指定电机的电机码</param>
         /// <param name="speedCode">速度码, null表示使用该点配置的默认速度码</param>
         /// <param name="waiting">是否等待到位, 默认为true</param>
         /// <param name="inRange">整定范围, 单位毫米或者步距</param>
         /// <param name="onSuccess">运动完成后的回调动作</param>
         /// <param name="onTimeout">超时未完成的回调动作</param>
-        void MovePointOne(string pointCode, short index = 0, string speedCode = null,
+        void MovePointOne(string pointCode, string axisCode, string speedCode = null,
             bool waiting = true, double inRange = -1,
             Action onSuccess = null, Action onTimeout = null);
 
@@ -222,13 +247,27 @@ namespace SKMC.Api.Motion.Control
         /// 让绑定点位码的指定单个电机以指定速度运动到点位码
         /// </summary>
         /// <param name="recipePoint">点位对象</param>
-        /// <param name="index">该点位绑定的轴序号, 例如绑定了x1,y1,需要x1移动时传0,需要y1移动时传1</param>
+        /// <param name="axisCode">指定电机的电机码</param>
+        /// <param name="speedCode">速度码, null表示使用该点配置的默认速度码</param>
+        /// <param name="waiting">是否等待到位, 默认为true</param>
+        /// <param name="inRange">整定范围, 单位毫米或者步距</param>
+        /// <param name="onSuccess">运动完成后的回调动作</param>
+        /// <param name="onTimeout">超时未完成的回调动作</param>
+        void MovePointOne(RecipePoint recipePoint, string axisCode, string speedCode = null,
+            bool waiting = true, double inRange = -1,
+            Action onSuccess = null, Action onTimeout = null);
+
+        /// <summary>
+        /// 让绑定点位码的指定单个电机以指定速度运动到点位码
+        /// </summary>
+        /// <param name="recipePoint">点位对象</param>
+        /// <param name="axisCode">指定电机的电机码</param>
         /// <param name="recipeSpeed">速度对象, null表示使用该点配置的默认速度</param>
         /// <param name="waiting">是否等待到位, 默认为true</param>
         /// <param name="inRange">整定范围, 单位毫米或者步距</param>
         /// <param name="onSuccess">运动完成后的回调动作</param>
         /// <param name="onTimeout">超时未完成的回调动作</param>
-        void MovePointOne(RecipePoint recipePoint, short index = 0, RecipeSpeed recipeSpeed = null,
+        void MovePointOne(RecipePoint recipePoint, string axisCode, RecipeSpeed recipeSpeed = null,
             bool waiting = true, double inRange = -1,
             Action onSuccess = null, Action onTimeout = null);
 
@@ -237,13 +276,13 @@ namespace SKMC.Api.Motion.Control
         /// </summary>
         /// <param name="pointCode">点位码</param>
         /// <param name="fixset">基于点位的偏移量(mm)</param>
-        /// <param name="index">该点位绑定的轴序号, 例如绑定了x1,y1,需要x1移动时传0,需要y1移动时传1</param>
+        /// <param name="axisCode">指定电机的电机码</param>
         /// <param name="speedCode">速度码, null表示使用该点配置的默认速度码</param>
         /// <param name="waiting">是否等待到位, 默认为true</param>
         /// <param name="inRange">整定范围, 单位毫米或者步距</param>
         /// <param name="onSuccess">运动完成后的回调动作</param>
         /// <param name="onTimeout">超时未完成的回调动作</param>
-        void MovePointOneFix(string pointCode, double fixset, short index = 0, string speedCode = null,
+        void MovePointOneFix(string pointCode, double fixset, string axisCode, string speedCode = null,
             bool waiting = true, double inRange = -1,
             Action onSuccess = null, Action onTimeout = null);
 
@@ -252,13 +291,28 @@ namespace SKMC.Api.Motion.Control
         /// </summary>
         /// <param name="recipePoint">点位对象</param>
         /// <param name="fixset">基于点位的偏移量(mm)</param>
-        /// <param name="index">该点位绑定的轴序号, 例如绑定了x1,y1,需要x1移动时传0,需要y1移动时传1</param>
+        /// <param name="axisCode">指定电机的电机码</param>
         /// <param name="recipeSpeed">速度对象, null表示使用该点配置的默认速度</param>
         /// <param name="waiting">是否等待到位, 默认为true</param>
         /// <param name="inRange">整定范围, 单位毫米或者步距</param>
         /// <param name="onSuccess">运动完成后的回调动作</param>
         /// <param name="onTimeout">超时未完成的回调动作</param>
-        void MovePointOneFix(RecipePoint recipePoint, double fixset, short index = 0, RecipeSpeed recipeSpeed = null,
+        void MovePointOneFix(RecipePoint recipePoint, double fixset, string axisCode, RecipeSpeed recipeSpeed = null,
+            bool waiting = true, double inRange = -1,
+            Action onSuccess = null, Action onTimeout = null);
+
+        /// <summary>
+        /// 让绑定点位码的指定单个电机以指定速度运动到点位码,并能叠加指定偏移量
+        /// </summary>
+        /// <param name="recipePoint">点位对象</param>
+        /// <param name="fixset">基于点位的偏移量(mm)</param>
+        /// <param name="axisCode">指定电机的电机码</param>
+        /// <param name="speedCode">速度码, null表示使用该点配置的默认速度码</param>
+        /// <param name="waiting">是否等待到位, 默认为true</param>
+        /// <param name="inRange">整定范围, 单位毫米或者步距</param>
+        /// <param name="onSuccess">运动完成后的回调动作</param>
+        /// <param name="onTimeout">超时未完成的回调动作</param>
+        void MovePointOneFix(RecipePoint recipePoint, double fixset, string axisCode, string speedCode = null,
             bool waiting = true, double inRange = -1,
             Action onSuccess = null, Action onTimeout = null);
 
@@ -332,8 +386,7 @@ namespace SKMC.Api.Motion.Control
         /// <param name="onSuccess">运动完成后的回调动作</param>
         /// <param name="onTimeout">超时未完成的回调动作</param>
         void WaitPoint(RecipePoint recipePoint, int timeout = 10000, double inRange = -1,
-            Func<bool> safeCnd = null, Action onSuccess = null, Action onTimeout = null,
-            Func<bool> checkCnd = null, Action onChecked = null);
+            Action onSuccess = null, Action onTimeout = null);
 
         /// <summary>
         /// 等待电机组所有电机到位

+ 7 - 2
SKMC.API/Motion/Driver/IMotionDriver.cs

@@ -1,5 +1,4 @@
-
-using SKMC.Api.Motion.Model;
+using SKMC.Api.Motion.Model;
 using System.Text;
 
 namespace SKMC.Api.Motion.Driver
@@ -272,6 +271,12 @@ namespace SKMC.Api.Motion.Driver
         /// <param name="axisNo">电机轴号</param>
         void ClearError(short axisNo);
 
+        /// <summary>
+        /// 映射IO点位与IO设备的关联
+        /// </summary>
+        /// <param name="motionIO"></param>
+        void MapIO(MotionIO motionIO);
+
         /// <summary>
         /// 获取一个DI点位数值
         /// </summary>

+ 1 - 2
SKMC.API/Motion/Driver/IMotionDriverAdvance.cs

@@ -1,5 +1,4 @@
-using SKMC.Api.Motion.Model;
-using System;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;

+ 3 - 4
SKMC.API/Process/Model/AxisCnd.cs → SKMC.API/Motion/Model/AxisCnd.cs

@@ -1,16 +1,15 @@
 using SKMC.Api.Common;
-using SKMC.Api.Motion;
-using SKMC.Api.Motion.Model;
+using SKMC.Api.Common.Logger;
 using System;
 
-namespace SKMC.Api.Process.Model
+namespace SKMC.Api.Motion.Model
 {
     /// <summary>
     /// 电机运行条件, 可作为触发动作的条件, 也可以作为告警状态的条件
     /// </summary>
     public class AxisCnd
     {
-        //static readonly ILogger log = LogFactory.Get(typeof(AxisCnd));
+        protected static readonly ILogger log = LogFactory.Get();
 
         private readonly MotionCacher motionCacher = ObjectFactory.Resolve<MotionCacher>();
 

+ 1 - 1
SKMC.API/Process/Model/Cnds.cs → SKMC.API/Motion/Model/Cnds.cs

@@ -1,6 +1,6 @@
 using System.Collections.Generic;
 
-namespace SKMC.Api.Process.Model
+namespace SKMC.Api.Motion.Model
 {
     /// <summary>
     /// 条件匹配帮助类

+ 1 - 3
SKMC.API/Process/Model/DioCnd.cs → SKMC.API/Motion/Model/DioCnd.cs

@@ -1,9 +1,7 @@
 using SKMC.Api.Common;
-using SKMC.Api.Motion;
-using SKMC.Api.Motion.Model;
 using System;
 
-namespace SKMC.Api.Process.Model
+namespace SKMC.Api.Motion.Model
 {
     /// <summary>
     /// IO条件, 可作为触发动作的条件, 也可以作为告警状态的条件

+ 9 - 14
SKMC.API/Motion/MotionCacher.cs

@@ -2,9 +2,7 @@
 using SKMC.Api.Motion.Control;
 using SKMC.Api.Motion.Driver;
 using SKMC.Api.Motion.Model;
-using System;
 using System.Collections.Generic;
-using System.Collections.ObjectModel;
 
 namespace SKMC.Api.Motion
 {
@@ -13,11 +11,19 @@ namespace SKMC.Api.Motion
     /// </summary>
     public abstract class MotionCacher : BindableBase
     {
-
+        /// <summary>
+        /// 运动控制卡接口层
+        /// </summary>
         public IMotionDriver MotionDriver { get; set; }
 
+        /// <summary>
+        /// 运动控制卡高级接口层
+        /// </summary>
         public IMotionDriverAdvance MotionDriverAdvance { get; set; }
 
+        /// <summary>
+        /// 运动控制高级接口
+        /// </summary>
         public IMotionControl MotionControl { get; set; }
 
 
@@ -46,11 +52,6 @@ namespace SKMC.Api.Motion
         /// </summary>
         public List<MotionAxis> MotionAxises { get; set; } = new List<MotionAxis>();
 
-        /// <summary>
-        /// Axis轨迹运动数据集
-        /// </summary>
-        //public List<MotionTraject> MotionTrajects { get; set; } = new List<MotionTraject>();
-
         /// <summary>
         /// DI 模块集
         /// </summary>
@@ -93,12 +94,6 @@ namespace SKMC.Api.Motion
 
         public abstract MotionPdo GetMotionReadPdo(string code);
 
-        [Obsolete("此方法已废弃")]
-        public abstract void SetMotionDi(string code, byte value, bool testMode = false);
-
-        [Obsolete("此方法已废弃")]
-        public abstract void SetMotionDo(string code, byte value, bool testMode = false);
-
         public abstract MotionAxis GetMotionAxis(string axisCode);
 
         public abstract MotionAxis GetMotionAxis(short axisNo);

+ 0 - 5
SKMC.API/Process/Config/ProcessException.cs

@@ -1,9 +1,4 @@
 using SKMC.Api.Common.Exceptions;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 
 namespace SKMC.Api.Process.Config
 {

+ 1 - 6
SKMC.API/Process/Control/IProcessLocker.cs

@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
+
 namespace SKMC.Api.Process.Control
 {
     /// <summary>

+ 0 - 181
SKMC.API/Process/Control/ProcessExceptions.cs

@@ -1,181 +0,0 @@
-using SKMC.Api.Client;
-using SKMC.Api.Client.Model;
-using SKMC.Api.Machine;
-using SKMC.Api.Machine.Control;
-using SKMC.Api.Common;
-using SKMC.Api.Common.Exceptions;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-using Prism.Services.Dialogs;
-using SKMC.Api.Common.Logger;
-
-namespace SKMC.Api.Process.Control
-{
-    /// <summary>
-    /// 异常处理工具集
-    /// </summary>
-    public class ProcessExceptions
-    {
-        private readonly static ILogger log = LogFactory.Get();
-        private readonly static IMachineBoardControl deviceBoardControl = ObjectFactory.Resolve<IMachineBoardControl>();
-        private readonly static ClientCacher clientCacher = ObjectFactory.Resolve<ClientCacher>();
-        private readonly static MachineCacher machineCacher = ObjectFactory.Resolve<MachineCacher>();
-        public const string DefaultViewName = "ProcessExceptionsView";
-        public const string NoticeViewName = "ProcessNotificationView";
-
-        public static string CreateExceptionDialog(ExceptionShow exceptionShow, string dialogName = DefaultViewName)
-        {
-            if (exceptionShow == null) return null;
-            if (dialogName != null)
-            {
-                return clientCacher.ShowExceptionDialog(dialogName, exceptionShow);
-            }
-            else
-            {
-                CreateExceptionDialog(exceptionShow);
-                return null;
-            }
-        }
-
-        /// <summary>
-        /// 创建一个异常弹窗
-        /// </summary>
-        /// <param name="exceptionBase"></param>
-        /// <param name="exceptionConfig"></param>
-        /// <param name="dialogName"></param>
-        public static string CreateExceptionDialog(ExceptionBase exceptionBase, ExceptionConfig exceptionConfig, string dialogName = DefaultViewName)
-        {
-            if (exceptionBase == null) return null;
-            if (exceptionConfig == null) exceptionConfig = GetExceptionConfiger(exceptionBase);
-            ExceptionShow exceptionShow = Convert(exceptionBase, exceptionConfig);
-            return CreateExceptionDialog(exceptionShow, dialogName);
-        }
-
-        public static void CreateExceptionDialog(Exception exception)
-        {
-            MessageBox.Show($"出现未知异常: {exception.Message}, Detail: {exception.StackTrace}");
-        }
-
-        public static void CreateExceptionDialog(ExceptionShow exceptionShow)
-        {
-            MessageBox.Show($"出现异常, Code:{exceptionShow.Code}, Name: {exceptionShow.Name}, Level: {exceptionShow.Level}");
-        }
-
-        /// <summary>
-        /// 创建一个提醒弹窗
-        /// </summary>
-        /// <param name="title">提醒标题</param>
-        /// <param name="message">提醒内容</param>
-        public static string CreateNotificationDialog(string title, string message, byte level = 0)
-        {
-            DialogParameters parameters = new DialogParameters();
-            parameters.Add("model", new ClientNotification
-            {
-                Head = title,
-                Detail = message,
-                DateTime = DateTime.Now,
-                Level = level
-            });
-            return clientCacher.ShowCommonDialog(NoticeViewName, parameters, null, false);
-        }
-
-        public static bool IsDialogShow(string id) => clientCacher.IsDialogShow(id);
-
-        /// <summary>
-        /// 关闭特定Id的对话框
-        /// </summary>
-        /// <param name="id"></param>
-        public static void CloseDialog(string id) => clientCacher.CloseDialog(id);
-
-        /// <summary>
-        /// 关闭所有对话框
-        /// </summary>
-        public static void CloseAllDialogs() => clientCacher.CloseAllDialogs();
-
-        private static ExceptionShow Convert(ExceptionBase exceptionBase, ExceptionConfig exceptionConfig)
-        {
-            ExceptionShow exceptionShow = new ExceptionShow(exceptionConfig)
-            {
-                Uid = Guid.NewGuid().ToString(),
-                EncounterTime = DateTime.Now,
-                RetryAction = exceptionBase.RetryAction,
-                IgnoreAction = exceptionBase.IgnoreAction,
-                AbortAction = exceptionBase.AbortAction,
-                Level = exceptionBase.Level,
-                Detail = exceptionBase.Detail
-            };
-            return exceptionShow;
-        }
-
-        private static ExceptionConfig GetExceptionConfiger(ExceptionBase exceptionBase)
-        {
-            // 先根据内部异常Type关联
-            ExceptionConfig exceptionConfiger = machineCacher.GetException(exceptionBase.Type);
-            // 再根据项目异常Code关联
-            if (exceptionConfiger == null) exceptionConfiger = machineCacher.GetException(exceptionBase.Code);
-            return exceptionConfiger;
-        }
-
-        public static string WrapThrows(Exception exception, string dialogViewName = DefaultViewName)
-        {
-            if (exception == null) return null;
-            //deviceStatus.StatusBeforeAlarm = deviceStatus.Status;
-            if (typeof(ExceptionBase).IsAssignableFrom(exception.GetType()))
-            {
-                ExceptionBase exceptionBase = exception as ExceptionBase;
-                ExceptionConfig exceptionConfiger = GetExceptionConfiger(exceptionBase);
-                exceptionBase.Level = exceptionConfiger.Level;
-                // 停机异常
-                if (exceptionConfiger.Level == 4)
-                {
-                    deviceBoardControl.IsAlarm = true;
-                    deviceBoardControl.StopAction.Invoke();
-                    log.Error($"严重异常: {exception}");
-                    //if (deviceStatus.Status == (byte)DeviceStatusEnum.START)
-                    //{
-                    //}
-                    return CreateExceptionDialog(exceptionBase, exceptionConfiger, dialogViewName);
-                }
-                // 普通异常
-                if (exceptionConfiger.Level == 2)
-                {
-                    //if (deviceStatus.Status == (byte)DeviceStatusEnum.START)
-                    //{
-                    //}
-                    deviceBoardControl.IsAlarm = true;
-                    deviceBoardControl.PauseAction.Invoke();
-                    log.Error($"普通异常: {exception},{exception.StackTrace}");
-                    return CreateExceptionDialog (exceptionBase, exceptionConfiger, dialogViewName);
-                }
-                // 单站异常
-                if (exceptionConfiger.Level == 1)
-                {
-                    if (exceptionBase.StationId > 0)
-                    {
-                        deviceBoardControl.PauseOneAction.Invoke(exceptionBase.StationId);
-                    }
-                    log.Error($"单站异常: {exception}");
-                    return CreateExceptionDialog (exceptionBase, exceptionConfiger, dialogViewName);
-                }
-                else
-                {
-                    log.Error($"其他异常: {exception}");
-                    return null;
-                }
-            }
-            // 未知异常
-            else
-            {
-                deviceBoardControl.IsAlarm = true;
-                deviceBoardControl.StopAction.Invoke();
-                log.Error($"未知异常: {exception.Message}", exception);
-                CreateExceptionDialog(exception);
-                return null;
-            }
-        }
-    }
-}

+ 1 - 0
SKMC.API/Process/Model/ProcessStep.cs

@@ -1,4 +1,5 @@
 using SKMC.Api.Common.Logger;
+using SKMC.Api.Motion.Model;
 using System;
 using System.Collections.Generic;
 using System.Diagnostics;

+ 1 - 6
SKMC.API/Recipe/Config/RecipeConfigManager.cs

@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
+
 namespace SKMC.Api.Recipe.Config
 {
     /// <summary>

+ 28 - 14
SKMC.API/Recipe/Config/RecipeConfigStore.cs

@@ -1,10 +1,5 @@
 using SKMC.Api.Recipe.Model;
-using System;
-using System.Collections.Generic;
 using System.Collections.ObjectModel;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 
 namespace SKMC.Api.Recipe.Config
 {
@@ -23,28 +18,47 @@ namespace SKMC.Api.Recipe.Config
         /// 获取单个产品配方
         /// </summary>
         /// <returns></returns>
-        public abstract ObservableCollection<RecipeProfile> FetchRecipeProfile(int recipeId);
+        public abstract RecipeProfile FetchRecipeProfile(int recipeId);
+
+        /// <summary>
+        /// 查询配方参数
+        /// </summary>
+        /// <param name="isPrivate">是否高级参数</param>
+        /// <param name="isSwtich">是否开关类型</param>
+        /// <returns></returns>
+        public abstract ObservableCollection<RecipeParam> QueryRecipeParams(short isPrivate = 0, short isSwtich = 0);
 
         /// <summary>
         /// 保存配方参数集
         /// </summary>
-        /// <param name="recipeId">产品配方Id</param>
         /// <param name="recipeParams">产品配方参数集</param>
-        public abstract void SaveRecipeParams(int recipeId, ObservableCollection<RecipeParam> recipeParams);
+        /// <param name="recipeId">产品配方Id, -1表示当前</param>
+        public abstract void SaveRecipeParams(ObservableCollection<RecipeParam> recipeParams, int recipeId = -1);
 
         /// <summary>
-        /// 保存配方速度集
+        /// 查询配方点位组
         /// </summary>
-        /// <param name="recipeId">产品配方Id</param>
-        /// <param name="recipeSpeeds">产品配方速度集</param>
-        public abstract void SaveRecipeSpeeds(int recipeId, ObservableCollection<RecipeSpeed> recipeSpeeds);
+        /// <returns></returns>
+        public abstract ObservableCollection<RecipePointGroup> QueryRecipePointGroups();
 
         /// <summary>
         /// 保存配方点位集
         /// </summary>
-        /// <param name="recipeId">产品配方Id</param>
         /// <param name="recipePoints">产品配方点位集</param>
-        public abstract void SaveRecipePoints(int recipeId, ObservableCollection<RecipePoint> recipePoints);
+        /// <param name="recipeId">产品配方Id, -1表示当前</param>
+        public abstract void SaveRecipePoints(ObservableCollection<RecipePoint> recipePoints, int recipeId = -1);
 
+        /// <summary>
+        /// 查询配方速度
+        /// </summary>
+        /// <returns></returns>
+        public abstract ObservableCollection<RecipeSpeed> QueryRecipeSpeeds();   
+
+        /// <summary>
+        /// 保存配方速度集
+        /// </summary>
+        /// <param name="recipeSpeeds">产品配方速度集</param>
+        /// <param name="recipeId">产品配方Id, -1表示当前</param>
+        public abstract void SaveRecipeSpeeds(ObservableCollection<RecipeSpeed> recipeSpeeds, int recipeId = -1);
     }
 }

+ 4 - 8
SKMC.API/Recipe/Config/RecipeParamBase.cs

@@ -1,10 +1,6 @@
 using SKMC.Api.Common;
 using System;
-using System.Collections.Generic;
-using System.Linq;
 using System.Reflection;
-using System.Text;
-using System.Threading.Tasks;
 
 namespace SKMC.Api.Recipe.Config
 {
@@ -19,19 +15,19 @@ namespace SKMC.Api.Recipe.Config
 
         public void InitLoad()
         {
-            foreach (RecipeParam param in recipeCacher.RecipeProfile.RecipePublicSwitchParams)
+            foreach (RecipeParam param in recipeCacher.RecipeProfile.RecipeBaseModParams)
             {
                 SetParameter(param);
             }
-            foreach (RecipeParam param in recipeCacher.RecipeProfile.RecipePublicValueParams)
+            foreach (RecipeParam param in recipeCacher.RecipeProfile.RecipeBaseValueParams)
             {
                 SetParameter(param);
             }
-            foreach (RecipeParam param in recipeCacher.RecipeProfile.RecipePrivateSwitchParams)
+            foreach (RecipeParam param in recipeCacher.RecipeProfile.RecipeAdvModParams)
             {
                 SetParameter(param);
             }
-            foreach (RecipeParam param in recipeCacher.RecipeProfile.RecipePrivateValueParams)
+            foreach (RecipeParam param in recipeCacher.RecipeProfile.RecipeAdvValueParams)
             {
                 SetParameter(param);
             }

+ 6 - 6
SKMC.API/Recipe/Model/RecipeProfile.cs

@@ -71,22 +71,22 @@ namespace SKMC.Api.Recipe.Model
         /// <summary>
         /// 流程参数配置集(基础开关型)
         /// </summary>
-        public ObservableCollection<RecipeParam> RecipePublicSwitchParams { get; set; }
+        public ObservableCollection<RecipeParam> RecipeBaseModParams { get; set; }
 
         /// <summary>
         /// 流程参数配置集(基础数值型)
         /// </summary>
-        public ObservableCollection<RecipeParam> RecipePublicValueParams { get; set; }
+        public ObservableCollection<RecipeParam> RecipeBaseValueParams { get; set; }
 
         /// <summary>
-        /// 流程参数配置集(内部开关型)
+        /// 流程参数配置集(高级开关型)
         /// </summary>
-        public ObservableCollection<RecipeParam> RecipePrivateSwitchParams { get; set; }
+        public ObservableCollection<RecipeParam> RecipeAdvModParams { get; set; }
 
         /// <summary>
-        /// 流程参数配置集(内部数值型)
+        /// 流程参数配置集(高级数值型)
         /// </summary>
-        public ObservableCollection<RecipeParam> RecipePrivateValueParams { get; set; }
+        public ObservableCollection<RecipeParam> RecipeAdvValueParams { get; set; }
 
         /// <summary>
         /// 速度配置集

+ 57 - 0
SKMC.API/Recipe/RecipeCacher.cs

@@ -16,6 +16,63 @@ namespace SKMC.Api.Recipe
         /// </summary>
         public RecipeProfile RecipeProfile { get; set; }
 
+        /// <summary>
+        /// 获取流程参数配置集
+        /// </summary>
+        /// <param name="isAdv">是否高级类型</param>
+        /// <param name="isMod">是否开关类型</param>
+        /// <returns></returns>
+        public ObservableCollection<RecipeParam> GetRecipeParams(short isAdv, short isMod)
+        {
+            if (isAdv == 0 && isMod == 0)
+            {
+                return GetRecipeBaseValueParams();
+            }
+            if (isAdv == 0 && isMod == 1)
+            {
+                return GetRecipeBaseModParams();
+            }
+            if (isAdv == 1 && isMod == 0)
+            {
+                return GetRecipeAdvValueParams();
+            }
+            if (isAdv == 1 && isMod == 1)
+            {
+                return GetRecipeAdvModParams();
+            }
+            return null;
+        }
+
+        /// <summary>
+        /// 流程参数配置集(基础开关型)
+        /// </summary>
+        public ObservableCollection<RecipeParam> GetRecipeBaseModParams() => RecipeProfile.RecipeBaseModParams;
+
+        /// <summary>
+        /// 流程参数配置集(基础数值型)
+        /// </summary>
+        public ObservableCollection<RecipeParam> GetRecipeBaseValueParams() => RecipeProfile.RecipeBaseValueParams;
+
+        /// <summary>
+        /// 流程参数配置集(内部开关型)
+        /// </summary>
+        public ObservableCollection<RecipeParam> GetRecipeAdvModParams() => RecipeProfile.RecipeAdvModParams;
+
+        /// <summary>
+        /// 流程参数配置集(内部数值型)
+        /// </summary>
+        public ObservableCollection<RecipeParam> GetRecipeAdvValueParams() => RecipeProfile.RecipeAdvValueParams;
+
+        /// <summary>
+        /// 速度配置集
+        /// </summary>
+        public ObservableCollection<RecipeSpeed> GetRecipeSpeeds() => RecipeProfile.RecipeSpeeds;
+
+        /// <summary>
+        /// 点位配置集
+        /// </summary>
+        public ObservableCollection<RecipePointGroup> GetRecipePointGroups() => RecipeProfile.RecipePointGroups;
+
         /// <summary>
         /// 获取流程参数对象
         /// </summary>

+ 18 - 10
SKMC.API/SKMC.API.csproj

@@ -85,15 +85,20 @@
     <Compile Include="Client\ClientCacher.cs" />
     <Compile Include="Client\Config\ClientConstants.cs" />
     <Compile Include="Client\Config\ClientException.cs" />
+    <Compile Include="Client\Views\BaseEditorModel.cs" />
+    <Compile Include="Common\CommonCacher.cs" />
     <Compile Include="Common\DB\IModelConverter.cs" />
     <Compile Include="Client\Access\ClientAccess.cs" />
     <Compile Include="Client\Access\ClientRole.cs" />
     <Compile Include="Client\Access\IClientRoleAccesser.cs" />
+    <Compile Include="Client\UI\ClientDialogs.cs" />
+    <Compile Include="Common\Exceptions\ExceptionConfigStore.cs" />
+    <Compile Include="Common\Exceptions\ExceptionWrapper.cs" />
     <Compile Include="Common\ObjectFactory.cs" />
     <Compile Include="Client\Extension\IMouseTracer.cs" />
     <Compile Include="Client\Model\ClientMessage.cs" />
-    <Compile Include="Client\Views\ExceptionsViewModel.cs" />
-    <Compile Include="Client\Views\IShowDialog.cs" />
+    <Compile Include="Client\Views\ExceptionViewModel.cs" />
+    <Compile Include="Client\UI\IShowDialog.cs" />
     <Compile Include="Client\Views\MenuViewModel.cs" />
     <Compile Include="Client\Model\ClientNotification.cs" />
     <Compile Include="Client\UI\StyleManager.cs" />
@@ -128,9 +133,9 @@
     <Compile Include="Common\Tcp\TcpClientBase.cs" />
     <Compile Include="Machine\Monitor\MachineLatchTask.cs" />
     <Compile Include="Machine\Monitor\MachineStateLatchMonitor.cs" />
-    <Compile Include="Machine\Adapter\SKVision\SKVisionClient.cs" />
-    <Compile Include="Machine\Adapter\SKVision\SKVisionProtocol.cs" />
-    <Compile Include="Machine\Adapter\SKVision\SKVisionClientBase.cs" />
+    <Compile Include="Vision\SKV0\SKVisionClient.cs" />
+    <Compile Include="Vision\SKV0\SKVisionProtocol.cs" />
+    <Compile Include="Vision\SKV0\SKVisionClientBase.cs" />
     <Compile Include="Machine\Config\MachineConfigStore.cs" />
     <Compile Include="Machine\Control\IMachineBoardControl.cs" />
     <Compile Include="Machine\Control\IMachineButtonControl.cs" />
@@ -150,7 +155,6 @@
     <Compile Include="Recipe\Model\RecipePointGroup.cs" />
     <Compile Include="Recipe\Model\RecipeProfile.cs" />
     <Compile Include="Process\Control\IProcessLocker.cs" />
-    <Compile Include="Process\Control\ProcessExceptions.cs" />
     <Compile Include="Common\Types\MessageQueue.cs" />
     <Compile Include="Common\Datetime\MicroTimer.cs" />
     <Compile Include="Common\Types\ObservableConcurrentList.cs" />
@@ -191,9 +195,9 @@
     <Compile Include="Motion\MotionCacher.cs" />
     <Compile Include="Motion\Model\MotionCnd.cs" />
     <Compile Include="Motion\Config\MotionException.cs" />
-    <Compile Include="Process\Model\AxisCnd.cs" />
-    <Compile Include="Process\Model\Cnds.cs" />
-    <Compile Include="Process\Model\DioCnd.cs" />
+    <Compile Include="Motion\Model\AxisCnd.cs" />
+    <Compile Include="Motion\Model\Cnds.cs" />
+    <Compile Include="Motion\Model\DioCnd.cs" />
     <Compile Include="Process\Model\ProcessStep.cs" />
     <Compile Include="Recipe\RecipeCacher.cs" />
     <Compile Include="Common\Exceptions\ExceptionConfig.cs" />
@@ -208,7 +212,11 @@
     <Compile Include="Common\Vision\IResultParser.cs" />
     <Compile Include="Common\Vision\VisionException.cs" />
   </ItemGroup>
-  <ItemGroup />
+  <ItemGroup>
+    <Folder Include="Device\Ethercats\Config\" />
+    <Folder Include="Device\External\" />
+    <Folder Include="Vision\SKV1\" />
+  </ItemGroup>
   <ItemGroup>
     <None Include="app.config" />
     <None Include="packages.config" />

+ 1 - 1
SKMC.API/Machine/Adapter/SKVision/SKVisionClient.cs → SKMC.API/Vision/SKV0/SKVisionClient.cs

@@ -5,7 +5,7 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 
-namespace SKMC.Api.Device.Adapter.SKVision
+namespace SKMC.Api.Vision.SKV0
 {
     /// <summary>
     /// 视觉通讯协议基础客户端

+ 1 - 5
SKMC.API/Machine/Adapter/SKVision/SKVisionClientBase.cs → SKMC.API/Vision/SKV0/SKVisionClientBase.cs

@@ -2,12 +2,8 @@
 using SKMC.Api.Common.Tcp;
 using SKMC.Api.Common.Vision;
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 
-namespace SKMC.Api.Device.Adapter.SKVision
+namespace SKMC.Api.Vision.SKV0
 {
     /// <summary>
     /// 视觉客户端通用基类

+ 1 - 4
SKMC.API/Machine/Adapter/SKVision/SKVisionProtocol.cs → SKMC.API/Vision/SKV0/SKVisionProtocol.cs

@@ -1,11 +1,8 @@
 using SKMC.Api.Common.Vision;
 using System;
 using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 
-namespace SKMC.Api.Device.Adapter.SKVision
+namespace SKMC.Api.Vision.SKV0
 {
     /// <summary>
     /// SKVision通讯协议(V0)

+ 0 - 1
SKMC.API/v3

@@ -1 +0,0 @@
-