123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- using System;
- using System.Collections.Generic;
- using System.Data;
- using Aitex.Core.RT.DBCore;
- using Aitex.Core.RT.Log;
- using Aitex.Sorter.Common;
- using MECF.Framework.Common.CommonData;
- namespace MECF.Framework.Common.DBCore
- {
- public class WaferDataRecorder
- {
- public static void CreateWafer(string guid, string carrierGuid, string station, int slot, string waferId )
- {
- string sql = string.Format(
- "INSERT INTO \"wafer_data\"(\"guid\", \"create_time\", \"carrier_data_guid\", \"create_station\", \"wafer_id\",\"create_slot\" )VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}' );",
- guid,
- DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss.fff"),
- carrierGuid,
- station,
- waferId,
- slot+1 );
- DB.Insert(sql);
- }
- public static void SetProcessInfo(string guid, string processGuid )
- {
- string sql = string.Format("UPDATE \"wafer_data\" SET \"process_data_guid\"='{0}' WHERE \"guid\"='{1}';",
- processGuid,
- guid);
- DB.Insert(sql);
- }
- public static void SetPjInfo(string guid, string pjGuid)
- {
- string sql = string.Format("UPDATE \"wafer_data\" SET \"pj_data_guid\"='{0}' WHERE \"guid\"='{1}';",
- pjGuid,
- guid);
- DB.Insert(sql);
- }
- public static void SetWaferMarker(string guid, string marker )
- {
- string sql = string.Format("UPDATE \"wafer_data\" SET \"lasermarker1\"='{0}' WHERE \"guid\"='{1}';",
- marker,
- guid);
- DB.Insert(sql);
- }
- public static void SetWaferT7Code(string guid, string t7code )
- {
- string sql = string.Format("UPDATE \"wafer_data\" SET \"t7code1\"='{0}' WHERE \"guid\"='{1}';",
- t7code,
- guid);
- DB.Insert(sql);
- }
- public static void SetWaferId(string guid, string marker1, string marker2, string marker3, string t7code1, string t7code2, string t7code3)
- {
- string sql = string.Format("UPDATE \"wafer_data\" SET \"lasermarker1\"='{0}', \"t7code1\"='{1}' WHERE \"guid\"='{2}';",
- marker1,
- t7code1,
- guid);
- DB.Insert(sql);
- }
- public static void SetWaferLotId(string guid, string lotId,string sequence)
- {
- string sql = $"UPDATE \"wafer_data\" SET \"lot_id\"='{lotId}', \"sequence_name\"='{sequence}' WHERE \"guid\"='{guid}';";
- DB.Insert(sql);
- }
- public static void DeleteWafer(string guid )
- {
- string sql = string.Format("UPDATE \"wafer_data\" SET \"delete_time\"='{0}' WHERE \"guid\"='{1}';",
- DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss.fff"),
- guid);
- DB.Insert(sql);
- }
- public static List<HistoryWaferData> QueryDBWafer(string sql)
- {
- List<HistoryWaferData> result = new List<HistoryWaferData>();
- try
- {
- DataSet ds = DB.ExecuteDataset(sql);
- if (ds == null)
- return result;
- for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
- {
- HistoryWaferData ev = new HistoryWaferData();
- ev.Guid = ds.Tables[0].Rows[i]["guid"].ToString();
- ev.LaserMarker = ds.Tables[0].Rows[i]["lasermarker1"].ToString();
- ev.T7Code = ds.Tables[0].Rows[i]["t7code1"].ToString();
-
- if (!ds.Tables[0].Rows[i]["create_time"].Equals(DBNull.Value))
- ev.CreateTime = ((DateTime)ds.Tables[0].Rows[i]["create_time"]).ToString("yyyy/MM/dd HH:mm:ss.fff");
- if (!ds.Tables[0].Rows[i]["delete_time"].Equals(DBNull.Value))
- ev.DeleteTime = ((DateTime)ds.Tables[0].Rows[i]["delete_time"]).ToString("yyyy/MM/dd HH:mm:ss.fff");
- ev.Station = ds.Tables[0].Rows[i]["create_station"].ToString();
- ev.Slot = ds.Tables[0].Rows[i]["create_slot"].ToString();
- ev.CarrierGuid = ds.Tables[0].Rows[i]["carrier_data_guid"].ToString();
- ev.WaferId = ds.Tables[0].Rows[i]["wafer_id"].ToString();
- result.Add(ev);
- }
- result.Sort((x, y) => int.Parse(x.Slot) - int.Parse(y.Slot) );
- }
- catch (Exception ex)
- {
- LOG.Write(ex);
- }
- return result;
- }
- }
- }
|