Procházet zdrojové kódy

调整了Machine/Monitor相关接口;调整了Recipe相关接口;调整了IMotionControl的方法与参数;

Yuli před 1 měsícem
rodič
revize
f8bfd9d826

+ 21 - 3
SKMC.API/Common/Monitor/BaseMonitor.cs

@@ -7,14 +7,26 @@ using System.Threading.Tasks;
 
 namespace SKMC.Api.Common.Monitor
 {
-    public class BaseMonitor
+    /// <summary>
+    /// 检测器基类
+    /// </summary>
+    public class BaseMonitor : IDisposable
     {
         public Timer timer;
 
+        /// <summary>
+        /// 轮询周期 ms
+        /// </summary>
         public int CT { get; set; } = 100;
 
+        /// <summary>
+        /// 是否运行中
+        /// </summary>
         public bool IsRunning { get; set; }
 
+        /// <summary>
+        /// 启动监测
+        /// </summary>
         public void Start()
         {
             if (!IsRunning)
@@ -24,12 +36,18 @@ namespace SKMC.Api.Common.Monitor
             }
         }
 
-        public void Close()
+        /// <summary>
+        /// 停止监测
+        /// </summary>
+        public void Stop()
         {
             IsRunning = false;
         }
 
-        public void Destroy()
+        /// <summary>
+        /// 关闭监测
+        /// </summary>
+        public void Dispose()
         {
             timer.Dispose();
         }

+ 0 - 186
SKMC.API/Common/Monitor/StateLatchManager.cs

@@ -1,186 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Timers;
-
-namespace SKMC.Api.Common.Monitor
-{
-    /// <summary>
-    /// 状态锁存管理器, 用于低频的状态判断并锁定
-    /// 例如总线连接状态、设备物料状态、是否长时间无人操作等
-    /// </summary>
-    public class StateLatchManager : IDisposable
-    {
-        private readonly Dictionary<string, LatchTask> _tasks = new Dictionary<string, LatchTask>();
-        private readonly Timer _timer;
-
-        /// <summary>
-        /// 监测并锁定的状态
-        /// </summary>
-        private static readonly int LATCH_VAL = -1;
-
-        public StateLatchManager(int interval = 5000)
-        {
-            _timer = new Timer(interval);
-            _timer.Elapsed += (s, e) => RunAllTasks();
-            // 没有限制重入
-            _timer.AutoReset = true;
-        }
-
-        /// <summary>
-        /// 添加任务,支持返回 bool 或可转换为 int 的数值类型
-        /// </summary>
-        public void AddTask<T>(string key, Func<T> task, Action callback = null, LatchMode mode = LatchMode.OpenMode)
-        {
-            _tasks[key] = new LatchTask
-            {
-                Task = task,
-                Callback = callback,
-                Mode = mode
-            };
-        }
-
-        /// <summary>
-        /// 获取任务信息
-        /// </summary>
-        /// <param name="key"></param>
-        /// <returns></returns>
-        public LatchTask GetTask(string key)
-        {
-            return _tasks.ContainsKey(key) ? _tasks[key] : null;
-        }
-
-        /// <summary>
-        /// 获取累计结果
-        /// </summary>
-        public int GetResult(string key)
-        {
-            // TODO 如果获取结果的时间戳与当前时间戳差距较大则无效
-            return _tasks.ContainsKey(key) ? _tasks[key].LatchResult : 0;
-        }
-
-        /// <summary>
-        /// 重置任务结果
-        /// </summary>
-        public void ResetResult(string key)
-        {
-            if (_tasks.ContainsKey(key))
-            {
-                _tasks[key].LatchResult = 0;
-                _tasks[key].ErrorInfo = null;
-                _tasks[key].Initialized = false;
-            }
-        }
-
-        public void Start() => _timer.Start();
-        public void Stop() => _timer.Stop();
-
-        private void RunAllTasks()
-        {
-            foreach (var task in _tasks)
-            {
-                if (task.Value.LatchResult != LATCH_VAL && task.Value.ErrorInfo == null)
-                {
-                    try
-                    {
-                        var rawResult = task.Value.Task.DynamicInvoke();
-                        int result = ConvertToInt(rawResult);
-
-                        if (task.Value.Mode == LatchMode.CloseMode)
-                        {
-                            if (task.Value.Initialized)
-                            {
-                                task.Value.LatchResult &= result;
-                                task.Value.LatchResult = task.Value.LatchResult == 0 ? -1 : 1;
-                            }
-                            else
-                            {
-                                task.Value.LatchResult = result == 0 ? -1 : 1;
-                                task.Value.Initialized = true;
-                            }
-                        }
-                        else if (task.Value.Mode == LatchMode.OpenMode)
-                        {
-                            if (task.Value.Initialized)
-                            {
-                                task.Value.LatchResult &= result;
-                                task.Value.LatchResult = task.Value.LatchResult == 0 ? 1 : -1;
-                            }
-                            else
-                            {
-                                task.Value.LatchResult = result == 0 ? 1 : -1;
-                                task.Value.Initialized = true;
-                            }
-                        }
-                        if (task.Value.LatchResult == LATCH_VAL)
-                        {
-                            task.Value.LatchTime = DateTime.Now;
-                            task.Value.Callback?.Invoke();
-                        }
-                    }
-                    catch(Exception e)
-                    {
-                        task.Value.ErrorInfo = $"ErrorInfo: {e.Message}, Datetime: {DateTime.Now}";
-                    }
-                }
-            }
-        }
-
-        private int ConvertToInt(object value)
-        {
-            if (value is bool b)
-                return b ? 1 : 0;
-            return Convert.ToInt32(value);
-        }
-
-        public void Dispose() => _timer?.Dispose();
-    }
-
-    public class LatchTask
-    {
-        /// <summary>
-        /// 监测任务
-        /// </summary>
-        public Delegate Task { get; set; }
-        /// <summary>
-        /// 是否已初始化
-        /// </summary>
-        public bool Initialized { get; set; }
-        /// <summary>
-        /// 当前结果
-        /// </summary>
-        public int LatchResult { get; set; }
-        /// <summary>
-        /// 锁存模式
-        /// </summary>
-        public LatchMode Mode { get; set; }
-        /// <summary>
-        /// 触发时间
-        /// </summary>
-        public DateTime LatchTime { get; set; }
-        /// <summary>
-        /// 异常信息
-        /// </summary>
-        public string ErrorInfo { get; set; }
-        /// <summary>
-        /// 触发后回调动作
-        /// </summary>
-        public Action Callback { get; set; }
-    }
-
-    public enum LatchMode
-    {
-        /// <summary>
-        /// 适用常闭模式:11101/11001返回-1,11111返回1
-        /// </summary>
-        CloseMode,
-
-        /// <summary>
-        /// 适用常开模式:00010/00110返回-1,00000返回1
-        /// </summary>
-        OpenMode
-    }
-
-}

+ 3 - 3
SKMC.API/Machine/MachineCacher.cs

@@ -9,11 +9,11 @@ namespace SKMC.Api.Machine
     /// </summary>
     public abstract class MachineCacher
     {
-        // Module数据
-        public ObservableCollection<MachineCatalogConfig> DeviceCatalogs { get; set; }
+        // Catalog数据
+        public ObservableCollection<MachineCatalogConfig> MachineCatalogs { get; set; }
 
         // Param数据
-        public ObservableCollection<MachineParamConfig> DeviceParams { get; set; }
+        public ObservableCollection<MachineParamConfig> MachineParams { get; set; }
 
         /// <summary>
         /// 获取设备参数

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

@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+
+namespace SKMC.Api.Machine.Monitor
+{
+    /// <summary>
+    /// 机台(部件)活动模型
+    /// 可用于机台按钮、安全门等
+    /// </summary>
+    public class MachineActivity
+    {
+        /// <summary>
+        /// 触发条件
+        /// </summary>
+        public Func<bool> TriggerCnd { get; set; }
+
+        /// <summary>
+        /// 是否已触发
+        /// </summary>
+        public bool IsTriggered { get; set; }
+
+        /// <summary>
+        /// 是否活动中
+        /// </summary>
+        public bool InAction { get; set; }
+
+        /// <summary>
+        /// 验证通过后执行
+        /// </summary>
+        public Action OnPassed;
+
+        /// <summary>
+        /// 验证失败后执行
+        /// </summary>
+        public Action OnFailed;
+
+    }
+}

+ 29 - 0
SKMC.API/Machine/Monitor/MachineActivityMonitor.cs

@@ -0,0 +1,29 @@
+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
+    {
+        /// <summary>
+        /// 添加需要观察的流程活动
+        /// </summary>
+        /// <param name="machineActivity"></param>
+        public abstract void Observe(MachineActivity machineActivity);
+
+        /// <summary>
+        /// 移除不需要观察的流程活动
+        /// </summary>
+        /// <param name="machineActivity"></param>
+        public abstract void Remove(MachineActivity machineActivity);
+
+    }
+}

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

@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SKMC.Api.Machine.Monitor
+{
+    /// <summary>
+    /// 机台锁存任务
+    /// </summary>
+    public class MachineLatchTask
+    {
+        /// <summary>
+        /// 监测任务
+        /// </summary>
+        public Delegate Task { get; set; }
+        /// <summary>
+        /// 是否已初始化
+        /// </summary>
+        public bool Initialized { get; set; }
+        /// <summary>
+        /// 当前结果
+        /// </summary>
+        public int LatchResult { get; set; }
+        /// <summary>
+        /// 锁存模式
+        /// </summary>
+        public LatchMode Mode { get; set; }
+        /// <summary>
+        /// 触发时间
+        /// </summary>
+        public DateTime LatchTime { get; set; }
+        /// <summary>
+        /// 异常信息
+        /// </summary>
+        public string ErrorInfo { get; set; }
+        /// <summary>
+        /// 触发后回调动作
+        /// </summary>
+        public Action Callback { get; set; }
+    }
+}

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

@@ -0,0 +1,53 @@
+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
+{
+    /// <summary>
+    /// 状态锁存管理器, 用于低频的状态判断并锁定
+    /// 例如总线连接状态、设备物料状态、是否长时间无人操作等
+    /// </summary>
+    public abstract class MachineStateLatchMonitor : BaseMonitor
+    {
+        /// <summary>
+        /// 添加任务,支持返回 bool 或可转换为 int 的数值类型
+        /// </summary>
+        public abstract void AddTask<T>(string key, Func<T> task, Action callback = null, LatchMode mode = LatchMode.OpenMode);
+
+        /// <summary>
+        /// 获取任务信息
+        /// </summary>
+        /// <param name="key"></param>
+        /// <returns></returns>
+        public abstract MachineLatchTask GetTask(string key);
+
+        /// <summary>
+        /// 获取累计结果
+        /// </summary>
+        public abstract int GetResult(string key);
+
+        /// <summary>
+        /// 重置任务结果
+        /// </summary>
+        public abstract void ResetResult(string key);
+    }
+
+    public enum LatchMode
+    {
+        /// <summary>
+        /// 适用常闭模式:11101/11001返回-1,11111返回1
+        /// </summary>
+        CloseMode,
+
+        /// <summary>
+        /// 适用常开模式:00010/00110返回-1,00000返回1
+        /// </summary>
+        OpenMode
+    }
+
+}

+ 103 - 118
SKMC.API/Motion/Control/IMotionControl.cs

@@ -95,7 +95,7 @@ namespace SKMC.Api.Motion.Control
         /// <param name="onSuccess"></param>
         /// <param name="onTimeout"></param>
         /// <param name="timeout">超时时间(毫秒)</param>
-        void HomeAxis(string axisCode, bool waiting = true, Func<bool> safeCnd = null, Action onSuccess = null, Action onTimeout = null, int timeout = 60000);
+        void Home(string axisCode, bool waiting = true, Func<bool> safeCnd = null, Action onSuccess = null, Action onTimeout = null, int timeout = 60000);
 
         /// <summary>
         /// 指定轴快速回零, 该轴必须是闭环电机, 如果是开环电机则降级为普通的HomeAxis回零
@@ -110,7 +110,7 @@ namespace SKMC.Api.Motion.Control
         /// <param name="onSuccess"></param>
         /// <param name="onTimeout"></param>
         /// <param name="timeout">超时时间(毫秒)</param>
-        void HomeAxisFast(string axisCode, string speedCode, bool stateCheck, bool waiting = true,
+        void HomeFast(string axisCode, string speedCode, bool stateCheck, bool waiting = true,
             Func<bool> safeCnd = null, Action onSuccess = null, Action onTimeout = null, int timeout = 60000);
 
         /// <summary>
@@ -125,7 +125,7 @@ namespace SKMC.Api.Motion.Control
         /// <param name="onSuccess"></param>
         /// <param name="onTimeout"></param>
         /// <param name="timeout">超时时间(毫秒)</param>
-        void HomeAxisReverse(string axisCode, short homeMode, double maxPos, bool waiting = true,
+        void HomeReverse(string axisCode, short homeMode, double maxPos, bool waiting = true,
             Func<bool> safeCnd = null, Action onSuccess = null, Action onTimeout = null, int timeout = 60000);
 
         /// <summary>
@@ -139,10 +139,8 @@ namespace SKMC.Api.Motion.Control
         /// <param name="axisIndex">绑定点位的电机序号, 0开头, 默认-1表示该点位的所有电机</param>
         /// <param name="negativeOffset">大于该点位的负方向距离</param>
         /// <param name="positiveOffset">小于该点位的正方向距离</param>
-        /// <param name="onPassed">满足条件后的动作</param>
-        /// <param name="onFailed">未满足条件后的动作</param>
         /// <returns>是否满足位置条件</returns>
-        bool CheckAxisNearPoint(string pointCode, short axisIndex = -1, double negativeOffset = 0.1, double positiveOffset = 0.1);
+        bool CheckNear(string pointCode, short axisIndex = -1, double negativeOffset = 0.1, double positiveOffset = 0.1);
 
         /// <summary>
         /// 通过点位码驱动对应的Axis运动, speedRadio表示每秒旋转圈数
@@ -150,13 +148,10 @@ namespace SKMC.Api.Motion.Control
         /// <param name="pointCode">点位码</param>
         /// <param name="speedRadio">每秒旋转圈数</param>
         /// <param name="waiting">是否等待到位, 默认为true</param>
-        /// <param name="inRange">可偏移的范围, 单位毫米或者步距</param>
+        /// <param name="inRange">整定范围, 单位毫米或者步距</param>
         /// <param name="onSuccess">运动完成后的回调动作</param>
         /// <param name="onTimeout">超时未完成的回调动作</param>
-        /// <param name="checkCnd">检测的条件</param>
-        /// <param name="onChecked">满足检测条件的动作</param>
-        void MoveAxisRound(string pointCode, double speedRadio,
-            bool waiting = true, double inRange = -1,
+        void MoveRound(string pointCode, double speedRadio, bool waiting = true, double inRange = -1,
             Action onSuccess = null, Action onTimeout = null);
 
         /// <summary>
@@ -165,28 +160,23 @@ namespace SKMC.Api.Motion.Control
         /// <param name="pointCode">点位码</param>
         /// <param name="speedCode">速度码, null表示使用该点配置的默认速度码</param>
         /// <param name="waiting">是否等待到位, 默认为true</param>
-        /// <param name="inRange">可偏移的范围, 单位毫米或者步距</param>
-        /// <param name="sync">如果2个轴同时移动,是否需要同时达到(直线轨迹)</param>
+        /// <param name="inRange">整定范围, 单位毫米或者步距</param>
         /// <param name="onSuccess">运动完成后的回调动作</param>
         /// <param name="onTimeout">超时未完成的回调动作</param>
-        void MoveAxisPoint(string pointCode, string speedCode = null,
-            bool waiting = true, double inRange = -1,
-            Action onSuccess = null, Action onTimeout = null, bool sync = false);
+        void MovePoint(string pointCode, string speedCode = null, bool waiting = true, double inRange = -1,
+            Action onSuccess = null, Action onTimeout = null);
 
         /// <summary>
         /// 让绑定点位码的(多个)电机以指定速度运动到点位码
         /// </summary>
-        /// <param name="processPoint">点位对象</param>
-        /// <param name="speedCode">速度码, null表示使用该点配置的默认速度码</param>
+        /// <param name="recipePoint">点位对象</param>
+        /// <param name="recipeSpeed">速度对象, null表示使用该点配置的默认速度</param>
         /// <param name="waiting">是否等待到位, 默认为true</param>
-        /// <param name="inRange">可偏移的范围, 单位毫米或者步距</param>
-        /// <param name="sync">如果2个轴同时移动,是否需要同时达到(直线轨迹)</param>
+        /// <param name="inRange">整定范围, 单位毫米或者步距</param>
         /// <param name="onSuccess">运动完成后的回调动作</param>
         /// <param name="onTimeout">超时未完成的回调动作</param>
-        void MoveAxisPoint(RecipePoint processPoint, string speedCode = null,
-            bool waiting = true, double inRange = -1,
-            Action onSuccess = null, Action onTimeout = null,
-            bool sync = false);
+        void MovePoint(RecipePoint recipePoint, RecipeSpeed recipeSpeed = null, bool waiting = true, double inRange = -1,
+            Action onSuccess = null, Action onTimeout = null);
 
         /// <summary>
         /// 让绑定点位码的(多个)电机以指定速度运动到点位码并能叠加指定偏移量
@@ -195,95 +185,108 @@ namespace SKMC.Api.Motion.Control
         /// <param name="posOffsets">各个电机的偏移量数组, 需要按电机绑定顺序赋值</param>
         /// <param name="speedCode">速度码, null表示使用该点配置的默认速度码</param>
         /// <param name="waiting">是否等待到位, 默认为true</param>
-        /// <param name="distanceUnit">是否距离单位, true:毫米, false:电机步距</param>
-        /// <param name="inRange">可偏移的范围, 单位毫米或者步距</param>
-        /// <param name="sync">如果2个轴同时移动,是否需要同时达到(直线轨迹)</param>
-        /// <param name="safeCnd">安全条件, 运动中如果不满足该安全条件立即停止并报警</param>
+        /// <param name="inRange">整定范围, 单位毫米或者步距</param>
         /// <param name="onSuccess">运动完成后的回调动作</param>
         /// <param name="onTimeout">超时未完成的回调动作</param>
-        /// <param name="checkCnd">检测的条件</param>
-        /// <param name="onChecked">满足检测条件的动作</param>
-        void MoveAxisPointFixset(string pointCode, double[] posOffsets, string speedCode = null,
-            bool waiting = true, double inRange = -1,
-            Action onSuccess = null, Action onTimeout = null,
-            bool sync = false);
+        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="processPoint">点位对象</param>
+        /// <param name="recipePoint">点位对象</param>
         /// <param name="posOffsets">各个电机的偏移量数组, 需要按电机绑定顺序赋值</param>
-        /// <param name="speedCode">速度码, null表示使用该点配置的默认速度码</param>
+        /// <param name="recipeSpeed">速度对象, null表示使用该点配置的默认速度</param>
         /// <param name="waiting">是否等待到位, 默认为true</param>
-        /// <param name="inRange">可偏移的范围, 单位毫米或者步距</param>
-        /// <param name="sync">如果2个轴同时移动,是否需要同时达到(直线轨迹)</param>
+        /// <param name="inRange">整定范围, 单位毫米或者步距</param>
         /// <param name="onSuccess">运动完成后的回调动作</param>
         /// <param name="onTimeout">超时未完成的回调动作</param>
-        void MoveAxisPointFixset(RecipePoint processPoint, double[] posOffsets, string speedCode = null,
-            bool waiting = true, double inRange = -1,
-            Action onSuccess = null, Action onTimeout = null,
-            bool sync = false);
+        void MovePointFix(RecipePoint recipePoint, double[] posOffsets, RecipeSpeed recipeSpeed = null, bool waiting = true, double inRange = -1,
+            Action onSuccess = null, Action onTimeout = null);
 
         /// <summary>
         /// 让绑定点位码的指定单个电机以指定速度运动到点位码
         /// </summary>
         /// <param name="pointCode">点位码</param>
-        /// <param name="axisCode">电机码</param>
+        /// <param name="index">该点位绑定的轴序号, 例如绑定了x1,y1,需要x1移动时传0,需要y1移动时传1</param>
         /// <param name="speedCode">速度码, null表示使用该点配置的默认速度码</param>
         /// <param name="waiting">是否等待到位, 默认为true</param>
-        /// <param name="inRange">可偏移的范围, 单位毫米或者步距</param>
+        /// <param name="inRange">整定范围, 单位毫米或者步距</param>
         /// <param name="onSuccess">运动完成后的回调动作</param>
         /// <param name="onTimeout">超时未完成的回调动作</param>
-        void MoveAxisPointOne(string pointCode, string axisCode, string speedCode = null,
+        void MovePointOne(string pointCode, short index = 0, string speedCode = null,
             bool waiting = true, double inRange = -1,
             Action onSuccess = null, Action onTimeout = null);
 
-
-        void MoveAxisPointOneFixset(string pointCode, string axisCode, double fixset, string speedCode = null,
+        /// <summary>
+        /// 让绑定点位码的指定单个电机以指定速度运动到点位码
+        /// </summary>
+        /// <param name="recipePoint">点位对象</param>
+        /// <param name="index">该点位绑定的轴序号, 例如绑定了x1,y1,需要x1移动时传0,需要y1移动时传1</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,
             bool waiting = true, double inRange = -1,
             Action onSuccess = null, Action onTimeout = null);
 
         /// <summary>
-        /// 让绑定点位码的指定单个电机以指定速度运动到点位码
+        /// 让绑定点位码的指定单个电机以指定速度运动到点位码,并能叠加指定偏移量
         /// </summary>
-        /// <param name="processPoint">点位对象</param>
-        /// <param name="axisCode">电机码</param>
+        /// <param name="pointCode">点位码</param>
+        /// <param name="fixset">基于点位的偏移量(mm)</param>
+        /// <param name="index">该点位绑定的轴序号, 例如绑定了x1,y1,需要x1移动时传0,需要y1移动时传1</param>
         /// <param name="speedCode">速度码, null表示使用该点配置的默认速度码</param>
         /// <param name="waiting">是否等待到位, 默认为true</param>
-        /// <param name="inRange">可偏移的范围, 单位毫米或者步距</param>
+        /// <param name="inRange">整定范围, 单位毫米或者步距</param>
         /// <param name="onSuccess">运动完成后的回调动作</param>
         /// <param name="onTimeout">超时未完成的回调动作</param>
-        void MoveAxisPointOne(RecipePoint processPoint, string axisCode, string speedCode = null,
+        void MovePointOneFix(string pointCode, double fixset, short index = 0, string speedCode = null,
             bool waiting = true, double inRange = -1,
             Action onSuccess = null, Action onTimeout = null);
 
         /// <summary>
-        /// 聚合多个点位码并同时运动, 注意: 每个点位的运动速度来自各自的点位(ProcessPoint)中的速度码
+        /// 让绑定点位码的指定单个电机以指定速度运动到点位码,并能叠加指定偏移量
         /// </summary>
-        /// <param name="processPoints">需要聚合运动的点位对象集合</param>
+        /// <param name="recipePoint">点位对象</param>
+        /// <param name="fixset">基于点位的偏移量(mm)</param>
+        /// <param name="index">该点位绑定的轴序号, 例如绑定了x1,y1,需要x1移动时传0,需要y1移动时传1</param>
+        /// <param name="recipeSpeed">速度对象, null表示使用该点配置的默认速度</param>
         /// <param name="waiting">是否等待到位, 默认为true</param>
-        /// <param name="inRange">可偏移的范围, 单位毫米或者步距</param>
+        /// <param name="inRange">整定范围, 单位毫米或者步距</param>
         /// <param name="onSuccess">运动完成后的回调动作</param>
         /// <param name="onTimeout">超时未完成的回调动作</param>
-        void MoveAxisAssemblePoints(List<RecipePoint> processPoints,
+        void MovePointOneFix(RecipePoint recipePoint, double fixset, short index = 0, RecipeSpeed recipeSpeed = null,
             bool waiting = true, double inRange = -1,
             Action onSuccess = null, Action onTimeout = null);
 
         /// <summary>
-        /// 聚合多个点位码并同时运动, 注意: 每个点位的运动速度优先使用speedCode, 如果speedCode为空则使用各自的点位中设置的速度码
+        /// 聚合多个点位码并同时运动
+        /// </summary>
+        /// <param name="recipePoints">需要聚合运动的点位对象集合</param>
+        /// <param name="waiting">是否等待到位, 默认为true</param>
+        /// <param name="inRange">整定范围, 单位毫米或者步距</param>
+        /// <param name="sync">是否同步到达,false: 使用recipeSpeed的速度,true:以recipeSpeed为基准,调整各点位速度</param>
+        /// <param name="onSuccess">运动完成后的回调动作</param>
+        /// <param name="onTimeout">超时未完成的回调动作</param>
+        void MovePoints(List<RecipePoint> recipePoints, RecipeSpeed recipeSpeed,
+            bool waiting = true, double inRange = -1, bool sync = false,
+            Action onSuccess = null, Action onTimeout = null);
+
+        /// <summary>
+        /// 聚合多个点位码并同时运动
         /// </summary>
         /// <param name="pointCodes">需要聚合运动的点位码集合</param>
         /// <param name="speedCode">速度码, null表示使用各点位的默认速度码</param>
         /// <param name="waiting">是否等待到位, 默认为true</param>
-        /// <param name="distanceUnit">是否距离单位, true:毫米, false:电机步距</param>
-        /// <param name="inRange">可偏移的范围, 单位毫米或者步距</param>
-        /// <param name="safeCnd">安全条件, 运动中如果不满足该安全条件立即停止并报警</param>
+        /// <param name="inRange">整定范围, 单位毫米或者步距</param>
+        /// <param name="sync">是否同步到达,false: 使用各自的点位中的速度,true:以speedCode为基准,调整各点位速度</param>
         /// <param name="onSuccess">运动完成后的回调动作</param>
         /// <param name="onTimeout">超时未完成的回调动作</param>
-        /// <param name="checkCnd">检测的条件</param>
-        /// <param name="onChecked">满足检测条件的动作</param>
-        void MoveAxisAssemblePoints(string[] pointCodes, string speedCode = null,
-            bool waiting = true, double inRange = -1,
+        void MovePoints(string[] pointCodes, string speedCode = null,
+            bool waiting = true, double inRange = -1, bool sync = false,
             Action onSuccess = null, Action onTimeout = null);
 
         /// <summary>
@@ -291,13 +294,10 @@ namespace SKMC.Api.Motion.Control
         /// </summary>
         /// <param name="axisCode">电机码</param>
         /// <param name="timeout">超时时间</param>
-        /// <param name="inRange">可偏移的范围, 单位毫米或者步距</param>
-        /// <param name="safeCnd">安全条件, 运动中如果不满足该安全条件立即停止并报警</param>
+        /// <param name="inRange">整定范围, 单位毫米或者步距</param>
         /// <param name="onSuccess">运动完成后的回调动作</param>
         /// <param name="onTimeout">超时未完成的回调动作</param>
-        /// <param name="checkCnd">检测的条件</param>
-        /// <param name="onChecked">满足检测条件的动作</param>
-        void WaitAxisDone(string axisCode, int timeout = 10000, double inRange = -1,
+        void WaitAxis(string axisCode, int timeout = 10000, double inRange = -1,
             Action onSuccess = null, Action onTimeout = null);
 
         /// <summary>
@@ -305,10 +305,10 @@ namespace SKMC.Api.Motion.Control
         /// </summary>
         /// <param name="motionAxis">电机对象</param>
         /// <param name="timeout">超时时间</param>
-        /// <param name="inRange">可偏移的范围, 单位毫米或者步距</param>
+        /// <param name="inRange">整定范围, 单位毫米或者步距</param>
         /// <param name="onSuccess">运动完成后的回调动作</param>
         /// <param name="onTimeout">超时未完成的回调动作</param>
-        void WaitAxisDone(MotionAxis motionAxis, int timeout = 10000, double inRange = -1,
+        void WaitAxis(MotionAxis motionAxis, int timeout = 10000, double inRange = -1,
             Action onSuccess = null, Action onTimeout = null);
 
         /// <summary>
@@ -316,22 +316,22 @@ namespace SKMC.Api.Motion.Control
         /// </summary>
         /// <param name="pointCode">点位码</param>
         /// <param name="timeout">超时时间</param>
-        /// <param name="inRange">可偏移的范围, 单位毫米或者步距</param>
+        /// <param name="inRange">整定范围, 单位毫米或者步距</param>
         /// <param name="onSuccess">运动完成后的回调动作</param>
         /// <param name="onTimeout">超时未完成的回调动作</param>
-        void WaitAxisPointDone(string pointCode, int timeout = 10000, double inRange = -1,
+        void WaitPoint(string pointCode, int timeout = 10000, double inRange = -1,
             Action onSuccess = null, Action onTimeout = null);
 
         /// <summary>
         /// 等待点位上所有电机到位
         /// </summary>
-        /// <param name="processPoint">点位对象</param>
+        /// <param name="recipePoint">点位对象</param>
         /// <param name="timeout">超时时间</param>
-        /// <param name="inRange">可偏移的范围, 单位毫米或者步距</param>
+        /// <param name="inRange">整定范围, 单位毫米或者步距</param>
         /// <param name="safeCnd">安全条件, 运动中如果不满足该安全条件立即停止并报警</param>
         /// <param name="onSuccess">运动完成后的回调动作</param>
         /// <param name="onTimeout">超时未完成的回调动作</param>
-        void WaitAxisPointDone(RecipePoint processPoint, int timeout = 10000, double inRange = -1,
+        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);
 
@@ -340,7 +340,7 @@ namespace SKMC.Api.Motion.Control
         /// </summary>
         /// <param name="axisCodes">电机码集合</param>
         /// <param name="timeout">超时时间</param>
-        void WaitAxisGroupDone(List<string> axisCodes, int timeout = 10000);
+        void WaitGroup(List<string> axisCodes, int timeout = 10000);
 
         /// <summary>
         /// 等待并阻塞当前线程, 直到满足特定条件
@@ -348,8 +348,7 @@ namespace SKMC.Api.Motion.Control
         /// <param name="cndDone">完成条件 (满足后释放阻塞)</param>
         /// <param name="onTimeout">超时动作</param>
         /// <param name="timeout">超时时间(ms)</param>
-        /// <param name="interval">监测条件的间隔时间(ms)</param>
-        void WaitCndDone(Func<bool> cndDone, Action onTimeout, int timeout, int interval = 25);
+        void WaitCnd(Func<bool> cndDone, Action onTimeout, int timeout);
 
         /// <summary>
         /// 电机按一定速度持续运动, 非阻塞
@@ -357,7 +356,7 @@ namespace SKMC.Api.Motion.Control
         /// <param name="axisCode">电机码</param>
         /// <param name="speedCode">速度码</param>
         /// <param name="direction">方向</param>
-        void MoveKeepAxis(string axisCode, string speedCode, ushort direction);
+        void MoveKeep(string axisCode, string speedCode, ushort direction);
 
         /// <summary>
         /// 电机相对运动
@@ -366,7 +365,7 @@ namespace SKMC.Api.Motion.Control
         /// <param name="speedCode">速度码</param>
         /// <param name="distance">距离</param>
         /// <param name="waiting">是否等待</param>
-        void MoveAxisRel(string axisCode, string speedCode, double distance, bool waiting = true);
+        void MoveRel(string axisCode, string speedCode, double distance, bool waiting = true);
 
 
         /// <summary>
@@ -376,95 +375,83 @@ namespace SKMC.Api.Motion.Control
         /// <param name="speedCode">速度码</param>
         /// <param name="position">坐标</param>
         /// <param name="waiting">是否等待</param>
-        void MoveAxisAbs(string axisCode, string speedCode, double position, bool waiting = false);
+        void MoveAbs(string axisCode, string speedCode, double position, bool waiting = false);
 
         /// <summary>
         /// 电机绝对运动,确保回零后调用
         /// </summary>
         /// <param name="axisCode">电机码</param>
-        /// <param name="processSpeed">速度对象</param>
+        /// <param name="recipeSpeed">速度对象</param>
         /// <param name="position">坐标</param>
         /// <param name="waiting">是否等待</param>
-        void MoveAxisAbs(string axisCode, RecipeSpeed processSpeed, double position, bool waiting = false);
+        void MoveAbs(string axisCode, RecipeSpeed recipeSpeed, double position, bool waiting = false);
 
 
         /// <summary>
         /// 停止单个电机
         /// </summary>
         /// <param name="axisCode">电机码</param>
-        void StopAxis(string axisCode, bool waiting = false);
+        void Stop(string axisCode, bool waiting = false);
 
         /// <summary>
         /// 停止多个电机
         /// </summary>
         /// <param name="axisCodes">电机码集合</param>
-        void StopAxises(List<string> axisCodes);
+        void Stop(List<string> axisCodes);
 
         /// <summary>
         /// 点位上多个电机停止运动
         /// </summary>
         /// <param name="pointCode">点位码</param>
-        void StopAxisPoint(string pointCode);
-
-        /// <summary>
-        /// 点位上多个电机急停
-        /// </summary>
-        /// <param name="pointCode">点位码</param>
-        void StopAxisPointEmg(string pointCode);
-
-        /// <summary>
-        /// 多个电机急停
-        /// </summary>
-        /// <param name="axisCodes">电机码集合</param>
-        void StopAxisesEmg(List<string> axisCodes);
+        void StopPoint(string pointCode);
 
         /// <summary>
         /// 所有电机停止
         /// </summary>
-        void StopAxisAll();
+        void StopAll();
 
         /// <summary>
         /// 暂停一个电机运动
         /// </summary>
         /// <param name="axisCode">电机码</param>
-        void PauseAxis(string axisCode);
+        void Pause(string axisCode);
 
         /// <summary>
         /// 暂停一个点位上多个电机运动
         /// </summary>
         /// <param name="pointCode">点位码</param>
-        void PauseAxisPoint(string pointCode);
+        void PausePoint(string pointCode);
 
         /// <summary>
         /// 恢复一个电机运动
         /// </summary>
         /// <param name="axisCode">电机码</param>
-        void ResumeAxis(string axisCode);
+        void Resume(string axisCode);
 
         /// <summary>
         /// 暂停一个点位上多个电机运行
         /// </summary>
         /// <param name="pointCode">点位码</param>
-        void ResumeAxisPoint(string pointCode);
+        void ResumePoint(string pointCode);
 
         /// <summary>
         /// 清除电机计数(反馈值与目标值)
         /// </summary>
         /// <param name="axisCode">电机码</param>
-        void ClearAxisCounter(string axisCode);
+        void ClearCounter(string axisCode);
 
         /// <summary>
         /// 清除电机驱动器报警(部分驱动器可能无效)
         /// </summary>
         /// <param name="axisCode">电机码</param>
-        void ClearAxisError(string axisCode);
+        void ClearError(string axisCode);
 
         /// <summary>
         /// 更新电机持续运行时的速度
         /// </summary>
         /// <param name="axisCode">电机码</param>
         /// <param name="speedCode">速度码</param>
-        void UpdateAxisKeepSpeed(string axisCode, string speedCode);
+        void UpdateKeepSpeed(string axisCode, string speedCode);
 
         /// <summary>
         /// 更新电机持续运行时的速度.
@@ -472,14 +459,14 @@ namespace SKMC.Api.Motion.Control
         /// </summary>
         /// <param name="axisCode">电机码</param>
         /// <param name="recipeSpeed">速度对象, 至少需要MaxVel、Acc、Dec 这3个属性</param>
-        void UpdateAxisKeepSpeed(string axisCode, RecipeSpeed recipeSpeed);
+        void UpdateKeepSpeed(string axisCode, RecipeSpeed recipeSpeed);
 
         /// <summary>
         /// 更新电机点对点移动时的速度
         /// </summary>
         /// <param name="axisCode">电机码</param>
         /// <param name="speedCode">速度码</param>
-        void UpdateAxisMoveSpeed(string axisCode, string speedCode);
+        void UpdateMoveSpeed(string axisCode, string speedCode);
 
         /// <summary>
         /// 更新电机点对点移动时的速度.
@@ -487,41 +474,41 @@ namespace SKMC.Api.Motion.Control
         /// </summary>
         /// <param name="axisCode">电机码</param>
         /// <param name="recipeSpeed">速度对象, 至少需要MaxVel、Acc、Dec 这3个属性</param>
-        void UpdateAxisMoveSpeed(string axisCode, RecipeSpeed recipeSpeed);
+        void UpdateMoveSpeed(string axisCode, RecipeSpeed recipeSpeed);
 
         /// <summary>
         /// 开始监测电机步距
         /// </summary>
         /// <param name="axisCode">电机码</param>
         /// <param name="ticks">时间周期, -1表示当前</param>
-        void StartAxisWatch(string axisCode, long ticks = -1);
+        void StartWatch(string axisCode, long ticks = -1);
 
         /// <summary>
         /// 读取电机状态并获取对象
         /// </summary>
         /// <param name="axisCode">电机码</param>
         /// <returns>电机对象</returns>
-        MotionAxis ReadAxisStatus(string axisCode);
+        MotionAxis ReadStatus(string axisCode);
 
         /// <summary>
         /// 读取电机状态
         /// </summary>
         /// <param name="motionAxis">电机对象</param>
-        void ReadAxisStatus(MotionAxis motionAxis);
+        void ReadStatus(MotionAxis motionAxis);
 
         /// <summary>
         /// 电机到位判断
         /// </summary>
         /// <param name="axisCode">电机码</param>
         /// <returns>是否到位</returns>
-        bool AxisDoneCheck(string axisCode);
+        bool CheckDone(string axisCode);
 
         /// <summary>
         /// 多个电机到位判断, 如果其中一个电机未到位返回false
         /// </summary>
         /// <param name="axisCodes">电机码</param>
         /// <returns>是否到位</returns>
-        bool AxisDoneCheck(List<string> axisCodes);
+        bool CheckDone(List<string> axisCodes);
 
 
         /// <summary>
@@ -618,7 +605,5 @@ namespace SKMC.Api.Motion.Control
         /// </summary>
         /// <param name="adIndex">AD序号</param>
         void ReadAdValue(short adIndex);
-
     }
-
 }

+ 21 - 0
SKMC.API/Motion/Driver/IMotionDriver.cs

@@ -373,12 +373,33 @@ namespace SKMC.Api.Motion.Driver
         /// <returns>读取的PDO数据长度</returns>
         int ReadPdoData(MotionPdo motionPdo);
 
+        /// <summary>
+        /// 写入自定义数据码
+        /// </summary>
+        /// <param name="data"></param>
+        /// <returns></returns>
         uint WriteUserCode(string data);
 
+        /// <summary>
+        /// 验证自定义数据码
+        /// </summary>
+        /// <param name="data"></param>
+        /// <returns></returns>
         uint CheckUserCode(string data);
 
+        /// <summary>
+        /// 写入自定义数据
+        /// </summary>
+        /// <param name="data"></param>
+        /// <returns></returns>
         uint WriteUserData(string data);
 
+        /// <summary>
+        /// 读取自定义数据
+        /// </summary>
+        /// <param name="dataBuilder"></param>
+        /// <param name="len"></param>
+        /// <returns></returns>
         uint ReadUserData(ref StringBuilder dataBuilder, short len);
     }
 }

+ 0 - 31
SKMC.API/Process/Control/ProcessActivityObserver.cs

@@ -1,31 +0,0 @@
-using SKMC.Api.Common.Monitor;
-using SKMC.Api.Process.Model;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace SKMC.Api.Process.Control
-{
-    /// <summary>
-    /// 流程活动的观察服务接口
-    /// 可用于持续的状态监控
-    /// 例如开门报警、低压报警等
-    /// </summary>
-    public abstract class ProcessActivityObserver : BaseMonitor
-    {
-        /// <summary>
-        /// 添加需要观察的流程活动
-        /// </summary>
-        /// <param name="processActivity"></param>
-        public abstract void Observe(ProcessActivity processActivity);
-
-        /// <summary>
-        /// 移除不需要观察的流程活动
-        /// </summary>
-        /// <param name="processActivity"></param>
-        public abstract void Remove(ProcessActivity processActivity);
-
-    }
-}

+ 0 - 45
SKMC.API/Process/Model/Activity.cs

@@ -1,45 +0,0 @@
-using SKMC.Api.Common.Logger;
-using System.Collections.Generic;
-
-namespace SKMC.Api.Process.Model
-{
-    /// <summary>
-    /// 流程活动模型
-    /// </summary>
-    public class Activity
-    {
-
-        protected static readonly ILogger log = LogFactory.Get();
-
-        /// <summary>
-        /// 活动Id
-        /// </summary>
-        public int Id { get; set; }
-
-        /// <summary>
-        /// 活动名称
-        /// </summary>
-        public string Name { get; set; }
-
-        /// <summary>
-        /// 是否活动中
-        /// </summary>
-        public bool InAction { get; set; }
-
-        /// <summary>
-        /// Di触发条件集合
-        /// </summary>
-        public List<DioCnd> TriggerDiCnds { get; set; } = new List<DioCnd>();
-
-        /// <summary>
-        /// 电机触发条件集合
-        /// </summary>
-        public List<AxisCnd> TriggerAxisCnds { get; set; } = new List<AxisCnd>();
-
-        /// <summary>
-        /// 流程站点
-        /// </summary>
-        public ProcessStation ProcessStation { get; set; }
-
-    }
-}

+ 0 - 31
SKMC.API/Process/Model/ProcessActivity.cs

@@ -1,31 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace SKMC.Api.Process.Model
-{
-    /// <summary>
-    /// 持续活动模型
-    /// 用于持续观测、监控设备变化
-    /// </summary>
-    public class ProcessActivity : Activity
-    {
-
-        public Func<bool> ActivityCnd { get; set; }
-
-        /// <summary>
-        /// 验证通过后执行
-        /// </summary>
-        public Action OnPassed;
-
-        /// <summary>
-        /// 验证失败后执行
-        /// </summary>
-        public Action OnFailed;
-
-        /// <summary>
-        /// 是否已触发
-        /// </summary>
-        public bool Triggered { get; set; }
-
-    }
-}

+ 37 - 4
SKMC.API/Process/Model/ProcessStep.cs

@@ -1,4 +1,5 @@
-using System;
+using SKMC.Api.Common.Logger;
+using System;
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.Threading;
@@ -8,18 +9,50 @@ namespace SKMC.Api.Process.Model
     /// <summary>
     /// 流程步骤
     /// </summary>
-    public class ProcessStep : Activity
+    public class ProcessStep
     {
+        protected static readonly ILogger log = LogFactory.Get();
 
         /// <summary>
-        /// 是否开启高速触发模式, 高速模式下会直接读取一次AlarmDiCnds、AlarmAxisCnds相关的数值, 而非高速模式下将从MotionCache读取
+        /// 活动Id
         /// </summary>
-        public bool TriggerFastMode { get; set; } = false;
+        public int Id { get; set; }
 
+        /// <summary>
+        /// 活动名称
+        /// </summary>
+        public string Name { get; set; }
+
+        /// <summary>
+        /// 是否活动中
+        /// </summary>
+        public bool InAction { get; set; }
+
+        /// <summary>
+        /// Di触发条件集合
+        /// </summary>
+        public List<DioCnd> TriggerDiCnds { get; set; } = new List<DioCnd>();
+
+        /// <summary>
+        /// 电机触发条件集合
+        /// </summary>
+        public List<AxisCnd> TriggerAxisCnds { get; set; } = new List<AxisCnd>();
+
+        /// <summary>
+        /// 
+        /// </summary>
         public List<DioCnd> AlarmDiCnds { get; set; } = new List<DioCnd>();
 
+        /// <summary>
+        /// 
+        /// </summary>
         public List<AxisCnd> AlarmAxisCnds { get; set; } = new List<AxisCnd>();
 
+        /// <summary>
+        /// 流程站点
+        /// </summary>
+        public ProcessStation ProcessStation { get; set; }
+
         // 跳过条件判断(一次)
         public bool SkipCndOnce { get; set; }
 

+ 21 - 0
SKMC.API/Recipe/Config/RecipeConfigManager.cs

@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SKMC.Api.Recipe.Config
+{
+    /// <summary>
+    /// 配方数据管理器
+    /// </summary>
+    public abstract class RecipeConfigManager
+    {
+        /// <summary>
+        /// 加载配方数据到配方缓存中
+        /// </summary>
+        /// <param name="recipeId">配方Id</param>
+        public abstract void LoadRecipeProfile(int recipeId = -1);
+
+    }
+}

+ 31 - 13
SKMC.API/Recipe/Config/RecipeConfigStore.cs

@@ -9,24 +9,42 @@ using System.Threading.Tasks;
 namespace SKMC.Api.Recipe.Config
 {
     /// <summary>
-    /// 配方参数存储接口
+    /// 配方数据存储器
     /// </summary>
     public abstract class RecipeConfigStore
     {
-
+        /// <summary>
+        /// 查询所有的产品配方对象
+        /// </summary>
+        /// <returns></returns>
         public abstract ObservableCollection<RecipeProfile> QueryRecipeProfiles();
 
-        public abstract ObservableCollection<RecipeParam> QueryRecipeParams(short isInner = 0, short isSwtich = 0);
-
-        public abstract void SaveOrUpdateParams(ObservableCollection<RecipeParam> recipeParamConfigers);
-
-        public abstract ObservableCollection<RecipeSpeed> QueryRecipeSpeeds();
-
-        public abstract void SaveOrUpdateSpeeds(ObservableCollection<RecipeSpeed> recipeSpeedConfigers);
-
-        public abstract ObservableCollection<RecipePointGroup> QueryRecipePointGroups();
-
-        public abstract void SaveOrUpdatePoints(ObservableCollection<RecipePoint> recipePoints);
+        /// <summary>
+        /// 获取单个产品配方
+        /// </summary>
+        /// <returns></returns>
+        public abstract ObservableCollection<RecipeProfile> FetchRecipeProfile(int recipeId);
+
+        /// <summary>
+        /// 保存配方参数集
+        /// </summary>
+        /// <param name="recipeId">产品配方Id</param>
+        /// <param name="recipeParams">产品配方参数集</param>
+        public abstract void SaveRecipeParams(int recipeId, ObservableCollection<RecipeParam> recipeParams);
+
+        /// <summary>
+        /// 保存配方速度集
+        /// </summary>
+        /// <param name="recipeId">产品配方Id</param>
+        /// <param name="recipeSpeeds">产品配方速度集</param>
+        public abstract void SaveRecipeSpeeds(int recipeId, ObservableCollection<RecipeSpeed> recipeSpeeds);
+
+        /// <summary>
+        /// 保存配方点位集
+        /// </summary>
+        /// <param name="recipeId">产品配方Id</param>
+        /// <param name="recipePoints">产品配方点位集</param>
+        public abstract void SaveRecipePoints(int recipeId, ObservableCollection<RecipePoint> recipePoints);
 
     }
 }

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

@@ -19,19 +19,19 @@ namespace SKMC.Api.Recipe.Config
 
         public void InitLoad()
         {
-            foreach (RecipeParam param in recipeCacher.RecipePublicSwitchParams)
+            foreach (RecipeParam param in recipeCacher.RecipeProfile.RecipePublicSwitchParams)
             {
                 SetParameter(param);
             }
-            foreach (RecipeParam param in recipeCacher.RecipePublicValueParams)
+            foreach (RecipeParam param in recipeCacher.RecipeProfile.RecipePublicValueParams)
             {
                 SetParameter(param);
             }
-            foreach (RecipeParam param in recipeCacher.RecipePrivateSwitchParams)
+            foreach (RecipeParam param in recipeCacher.RecipeProfile.RecipePrivateSwitchParams)
             {
                 SetParameter(param);
             }
-            foreach (RecipeParam param in recipeCacher.RecipePrivateValueParams)
+            foreach (RecipeParam param in recipeCacher.RecipeProfile.RecipePrivateValueParams)
             {
                 SetParameter(param);
             }

+ 11 - 0
SKMC.API/Recipe/Model/RecipePoint.cs

@@ -42,6 +42,17 @@ namespace SKMC.Api.Recipe.Model
             set { speedCode = value; RaisePropertyChanged(); }
         }
 
+        private bool syncArrival;
+        /// <summary>
+        /// 多轴是否同步到达
+        /// </summary>
+        public bool SyncArrival
+        {
+            get { return syncArrival; }
+            set { syncArrival = value; }
+        }
+
+
         private double[] fixset;
 
         /// <summary>

+ 36 - 2
SKMC.API/Recipe/Model/RecipeProfile.cs

@@ -1,13 +1,18 @@
 using Prism.Mvvm;
+using SKMC.Api.Recipe.Config;
 using System;
+using System.Collections.ObjectModel;
 
 namespace SKMC.Api.Recipe.Model
 {
+    /// <summary>
+    /// 产品配方模型
+    /// </summary>
     public class RecipeProfile : BindableBase
     {
-        private long _id;
+        private int _id;
 
-        public long Id
+        public int Id
         {
             get { return _id; }
             set { _id = value; }
@@ -63,5 +68,34 @@ namespace SKMC.Api.Recipe.Model
             set { _updateTime = value; }
         }
 
+        /// <summary>
+        /// 流程参数配置集(基础开关型)
+        /// </summary>
+        public ObservableCollection<RecipeParam> RecipePublicSwitchParams { get; set; }
+
+        /// <summary>
+        /// 流程参数配置集(基础数值型)
+        /// </summary>
+        public ObservableCollection<RecipeParam> RecipePublicValueParams { get; set; }
+
+        /// <summary>
+        /// 流程参数配置集(内部开关型)
+        /// </summary>
+        public ObservableCollection<RecipeParam> RecipePrivateSwitchParams { get; set; }
+
+        /// <summary>
+        /// 流程参数配置集(内部数值型)
+        /// </summary>
+        public ObservableCollection<RecipeParam> RecipePrivateValueParams { get; set; }
+
+        /// <summary>
+        /// 速度配置集
+        /// </summary>
+        public ObservableCollection<RecipeSpeed> RecipeSpeeds { get; set; }
+
+        /// <summary>
+        /// 点位配置集
+        /// </summary>
+        public ObservableCollection<RecipePointGroup> RecipePointGroups { get; set; }
     }
 }

+ 0 - 1
SKMC.API/Recipe/Model/RecipeSpeed.cs

@@ -1,5 +1,4 @@
 using Prism.Mvvm;
-using SKMC.Api.Motion.Model;
 
 namespace SKMC.Api.Recipe.Model
 {

+ 7 - 34
SKMC.API/Recipe/RecipeCacher.cs

@@ -6,41 +6,15 @@ using System.Collections.ObjectModel;
 namespace SKMC.Api.Recipe
 {
     /// <summary>
-    /// 流程数据及对象缓存器
+    /// 配方数据缓存器
     /// </summary>
     public abstract class RecipeCacher
     {
-        public ObservableCollection<RecipeProfile> RecipeProfiles { get; set; }
 
         /// <summary>
-        /// 流程参数配置集(基础开关型)
+        /// 当前使用的配方
         /// </summary>
-        public ObservableCollection<RecipeParam> RecipePublicSwitchParams { get; set; }
-
-        /// <summary>
-        /// 流程参数配置集(基础数值型)
-        /// </summary>
-        public ObservableCollection<RecipeParam> RecipePublicValueParams { get; set; }
-
-        /// <summary>
-        /// 流程参数配置集(内部开关型)
-        /// </summary>
-        public ObservableCollection<RecipeParam> RecipePrivateSwitchParams { get; set; }
-
-        /// <summary>
-        /// 流程参数配置集(内部数值型)
-        /// </summary>
-        public ObservableCollection<RecipeParam> RecipePrivateValueParams { get; set; }
-
-        /// <summary>
-        /// 速度配置集
-        /// </summary>
-        public ObservableCollection<RecipeSpeed> RecipeSpeeds { get; set; }
-
-        /// <summary>
-        /// 点位配置集
-        /// </summary>
-        public ObservableCollection<RecipePointGroup> RecipePointGroups { get; set; }
+        public RecipeProfile RecipeProfile { get; set; }
 
         /// <summary>
         /// 获取流程参数对象
@@ -52,7 +26,6 @@ namespace SKMC.Api.Recipe
         /// <summary>
         /// 获取流程参数配置(根据数据库配置加载)
         /// </summary>
-        /// <typeparam name="T"></typeparam>
         /// <param name="paramCode"></param>
         /// <returns></returns>
         public abstract T GetRecipeParamValue<T>(string paramCode);
@@ -75,16 +48,16 @@ namespace SKMC.Api.Recipe
         /// <summary>
         /// 获取流程点位的轴位置数值
         /// </summary>
-        /// <param name="processPoint">点位对象</param>
+        /// <param name="recipePoint">点位对象</param>
         /// <param name="index">点位中多个轴位置的序号, 默认为第一个</param>
         /// <returns></returns>
-        public abstract double GetRecipePointVal(RecipePoint processPoint, int index = 0);
+        public abstract double GetRecipePointVal(RecipePoint recipePoint, int index = 0);
 
         /// <summary>
         /// 获取速度配置对象
         /// </summary>
-        /// <param name="code">速度码</param>
+        /// <param name="speedCode">速度码</param>
         /// <returns></returns>
-        public abstract RecipeSpeed GetRecipeSpeed(string code);
+        public abstract RecipeSpeed GetRecipeSpeed(string speedCode);
     }
 }

+ 5 - 4
SKMC.API/SKMC.API.csproj

@@ -126,7 +126,8 @@
     <Compile Include="Common\Tasks\Tasks.cs" />
     <Compile Include="Common\Tcp\TCPClient.cs" />
     <Compile Include="Common\Tcp\TcpClientBase.cs" />
-    <Compile Include="Common\Monitor\StateLatchManager.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" />
@@ -141,9 +142,10 @@
     <Compile Include="Motion\Model\MotionPosition.cs" />
     <Compile Include="Motion\Model\MotionPdo.cs" />
     <Compile Include="Motion\Config\MotionConstants.cs" />
+    <Compile Include="Recipe\Config\RecipeConfigManager.cs" />
     <Compile Include="Recipe\Config\RecipeParamBase.cs" />
     <Compile Include="Product\Record\ProductionBoard.cs" />
-    <Compile Include="Process\Control\ProcessActivityObserver.cs" />
+    <Compile Include="Machine\Monitor\MachineActivityMonitor.cs" />
     <Compile Include="Recipe\Config\RecipeConfigStore.cs" />
     <Compile Include="Recipe\Model\RecipePointGroup.cs" />
     <Compile Include="Recipe\Model\RecipeProfile.cs" />
@@ -189,7 +191,6 @@
     <Compile Include="Motion\MotionCacher.cs" />
     <Compile Include="Motion\Model\MotionCnd.cs" />
     <Compile Include="Motion\Config\MotionException.cs" />
-    <Compile Include="Process\Model\Activity.cs" />
     <Compile Include="Process\Model\AxisCnd.cs" />
     <Compile Include="Process\Model\Cnds.cs" />
     <Compile Include="Process\Model\DioCnd.cs" />
@@ -200,7 +201,7 @@
     <Compile Include="Recipe\Model\RecipePointPosition.cs" />
     <Compile Include="Recipe\Model\RecipePoint.cs" />
     <Compile Include="Recipe\Model\RecipeSpeed.cs" />
-    <Compile Include="Process\Model\ProcessActivity.cs" />
+    <Compile Include="Machine\Monitor\MachineActivity.cs" />
     <Compile Include="Common\Tasks\TaskToken.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="Loader.cs" />