ExtendEquipment.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using SHJX.Service.Control.Common.Assets;
  2. namespace SHJX.Service.Control.Extends
  3. {
  4. public static class ExtendEquipment
  5. {
  6. public static void ReleaseArea(this EquipmentTask task)
  7. {
  8. List<EquipmentArea> areas = DataManagerInstance.GetEquipmentAreas(task.To, task.From);
  9. areas.ForEach(area =>
  10. {
  11. area.Enable = true;
  12. DataManagerInstance.Update(area);
  13. });
  14. List<PositionHotlist> positions = DataManagerInstance.GetPositionHotlists(task.To, task.From);
  15. positions.ForEach(position =>
  16. {
  17. position.CurrentOccupy = string.Empty;
  18. position.Enable = true;
  19. DataManagerInstance.Update(position);
  20. });
  21. }
  22. public static void ReleaseAxis(this EquipmentTask task)
  23. {
  24. List<RouteCache> caches = DataManagerInstance.GetCaches(task.Source);
  25. if (caches.Any())
  26. {
  27. if (caches.Count == 1)
  28. {
  29. DataManagerInstance.Delete(caches.FirstOrDefault());
  30. }
  31. else
  32. {
  33. foreach (RouteCache cache in caches)
  34. {
  35. if (cache.RouteStep != task.RouteStep)
  36. {
  37. DataManagerInstance.Delete(cache);
  38. }
  39. }
  40. }
  41. }
  42. DataManagerInstance.DecreaseLock(StateMachineName.MOTOR_LOCK);
  43. }
  44. }
  45. }