WaferMoveHistoryRecorder.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data;
  4. using Aitex.Core.RT.DBCore;
  5. using Aitex.Core.RT.Log;
  6. using Aitex.Sorter.Common;
  7. using MECF.Framework.Common.CommonData;
  8. namespace MECF.Framework.Common.DBCore
  9. {
  10. /*
  11. *
  12. guid text NOT NULL,
  13. wafer_data_guid text,
  14. arrive_time timestamp without time zone,
  15. station timestamp without time zone,
  16. slot text,
  17. status text,
  18. CONSTRAINT wafer_move_history_pkey PRIMARY KEY (guid)
  19. *
  20. *
  21. *
  22. *
  23. */
  24. public class WaferMoveHistoryRecorder
  25. {
  26. public static void WaferMoved(string guid, string station, int slot, string status )
  27. {
  28. string sql = string.Format("INSERT INTO \"wafer_move_history\"(\"wafer_data_guid\", \"arrive_time\", \"station\", \"slot\", \"status\" )VALUES ('{0}', '{1}', '{2}', '{3}', '{4}' );",
  29. guid,
  30. DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss.fff"),
  31. station,
  32. slot+1,
  33. status);
  34. DB.Insert(sql);
  35. }
  36. public static List<HistoryMoveData> QueryDBMovement(string sql)
  37. {
  38. List<HistoryMoveData> result = new List<HistoryMoveData>();
  39. try
  40. {
  41. DataSet ds = DB.ExecuteDataset(sql);
  42. if (ds == null)
  43. return result;
  44. for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
  45. {
  46. HistoryMoveData ev = new HistoryMoveData();
  47. ev.WaferGuid = ds.Tables[0].Rows[i]["wafer_data_guid"].ToString();
  48. ev.Station = ds.Tables[0].Rows[i]["station"].ToString();
  49. ev.Slot = ds.Tables[0].Rows[i]["slot"].ToString();
  50. ev.Result = ds.Tables[0].Rows[i]["status"].ToString();
  51. if (!ds.Tables[0].Rows[i]["arrive_time"].Equals(DBNull.Value))
  52. ev.ArriveTime = ((DateTime)ds.Tables[0].Rows[i]["arrive_time"]).ToString("yyyy/MM/dd HH:mm:ss.fff");
  53. result.Add(ev);
  54. }
  55. }
  56. catch (Exception ex)
  57. {
  58. LOG.WriteExeption(ex);
  59. }
  60. return result;
  61. }
  62. }
  63. }