WaferStatusImp.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using MECF.Framework.Common.DataCenter;
  7. using OpenSEMI.ClientBase.Handlers;
  8. using OpenSEMI.ClientBase;
  9. using ACC = Aitex.Core.Common;
  10. namespace VirgoUI.Client.Models.Sys
  11. {
  12. public class WaferStatusImp
  13. {
  14. public WaferStatusImp(IQueryDataService dataService)
  15. {
  16. DataService = dataService;
  17. }
  18. public List<WaferInfo> GetWaferStatus(string moduleID)
  19. {
  20. List<WaferInfo> result = new List<WaferInfo>();
  21. string param = moduleID + ".ModuleWaferList";
  22. ACC.WaferInfo[] wafers = QueryDataClient.Instance.Service.GetData(param) as ACC.WaferInfo[];
  23. if (wafers != null)
  24. {
  25. for (int i = 0; i < wafers.Length; i++)
  26. {
  27. result.Add(WaferInfoConverter(wafers[i], moduleID, i));
  28. }
  29. }
  30. return result;
  31. }
  32. private WaferInfo WaferInfoConverter(ACC.WaferInfo awafer, string modid, int slotid)
  33. {
  34. WaferInfo wafer = new WaferInfo();
  35. wafer.ModuleID = modid;
  36. wafer.SlotID = slotid;
  37. wafer.SlotIndex = slotid + 1;
  38. wafer.WaferID = awafer.WaferID;
  39. wafer.SourceName = awafer.WaferOrigin;
  40. wafer.WaferStatus = WaferStatusConverter(awafer);
  41. return wafer;
  42. }
  43. //0: trans?
  44. //1:goden
  45. //2:blue
  46. //3:cyan
  47. //4:green
  48. //5:error
  49. private int WaferStatusConverter(ACC.WaferInfo awafer)
  50. {
  51. if (awafer.Status == ACC.WaferStatus.Empty)
  52. return 0;
  53. if (awafer.Status == ACC.WaferStatus.Normal)
  54. {
  55. switch (awafer.ProcessState)
  56. {
  57. case ACC.EnumWaferProcessStatus.InProcess: return 3;
  58. case ACC.EnumWaferProcessStatus.Completed: return 4;
  59. case ACC.EnumWaferProcessStatus.Failed: return 5;
  60. case ACC.EnumWaferProcessStatus.Idle: return awafer.ProcessJob == null ? 1 : 2;
  61. }
  62. }
  63. if (awafer.Status == ACC.WaferStatus.Dummy)
  64. {
  65. return 1;
  66. }
  67. return 5;
  68. }
  69. private IQueryDataService DataService;
  70. }
  71. }