| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- using SHJX.Service.Control.Repository;
- namespace SHJX.Service.Control.Service
- {
- public class WorkFlowService : IWorkFlowService
- {
- private readonly Repositorys _repositorys;
- public WorkFlowService(Repositorys repositorys) : base()
- {
- _repositorys = repositorys;
- Messager<WorkFlowEventArgs>.Register("CustomMove", ExecuteCustomMove);
- }
- #region MessageMethod
- private void ExecuteCustomMove(WorkFlowEventArgs arg)
- {
- List<string> steps = new();
- foreach (CustomMoveStep item in arg.MoveSteps)
- {
- if (item.CurrentStep.BeIn("开始", "结束"))
- {
- continue;
- }
- string step = Convert(item.CurrentStep);
- steps.Add(step);
- }
- EquipmentTask task = new()
- {
- From = arg.Position,
- To = arg.Position,
- Target = "From"
- };
- _repositorys.ExecuteTaskByVirtualPipe(task, steps);
- }
- #endregion
- private string Convert(string name)
- {
- string convertStr = name switch
- {
- "X轴" => NodeName.AXIS_MOVEMENT_BY_X,
- "Y轴" => NodeName.AXIS_MOVEMENT_BY_Y,
- "Z轴" => NodeName.AXIS_MOVEMENT_BY_Z,
- "Z轴原点" => NodeName.AXIS_GOBACK_BY_Z,
- "杯抓" => NodeName.TONGS_GRAB,
- "杯松" => NodeName.TONGS_LOOSEN,
- _ => throw new ArgumentNullException(name),
- };
- return convertStr;
- }
- }
- }
|