VenusSequenceFileContext.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Xml;
  7. using Aitex.Common.Util;
  8. using Aitex.Core.RT.Event;
  9. using Aitex.Core.RT.Log;
  10. using Aitex.Core.RT.SCCore;
  11. using Aitex.Core.Util;
  12. using MECF.Framework.Common.Equipment;
  13. using MECF.Framework.Common.RecipeCenter;
  14. namespace Venus_RT.Modules.PMs
  15. {
  16. public class VenusSequenceFileContext : ISequenceFileContext
  17. {
  18. public string GetConfigXml()
  19. {
  20. try
  21. {
  22. string configContent = PathManager.GetCfgDir() + @"\SequenceFormat.xml";
  23. if (ModuleHelper.IsInstalled(ModuleName.VCE1))
  24. {
  25. configContent = PathManager.GetCfgDir() + @"\SESequenceFormat.xml";
  26. }
  27. XmlDocument xmlDom = new XmlDocument();
  28. xmlDom.Load(configContent);
  29. CustomSequenceItem(xmlDom);
  30. return xmlDom.OuterXml;
  31. }
  32. catch (Exception ex)
  33. {
  34. LOG.WriteExeption(ex);
  35. return "";
  36. }
  37. }
  38. public virtual bool Validation(string content)
  39. {
  40. try
  41. {
  42. XmlDocument xmlDom = new XmlDocument();
  43. xmlDom.LoadXml(content);
  44. CustomValidation(xmlDom);
  45. return CustomValidation(xmlDom);
  46. }
  47. catch (Exception ex)
  48. {
  49. LOG.WriteExeption(ex);
  50. EV.PostWarningLog("Recipe", "sequence file not valid, " + ex.Message);
  51. return false;
  52. }
  53. }
  54. public bool EnableEdit(string sequencePathName)
  55. {
  56. //if (Singleton<RouteManager>.Instance.CheckSequenceUsedInJob(sequencePathName))
  57. //{
  58. // EV.PostWarningLog("System", "Sequence is used in auto running jobs, can not be modified");
  59. // return false;
  60. //}
  61. return true;
  62. }
  63. public virtual void CustomSequenceItem(XmlDocument xmlContent)
  64. {
  65. }
  66. public virtual bool CustomValidation(XmlDocument xmlContent)
  67. {
  68. return true;
  69. }
  70. }
  71. }