| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 | 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{    /*     *  guid text NOT NULL,  wafer_data_guid text,  arrive_time timestamp without time zone,  station timestamp without time zone,  slot text,  status text,  CONSTRAINT wafer_move_history_pkey PRIMARY KEY (guid)     *     *     *     *     */    public class WaferMoveHistoryRecorder    {        public static void WaferMoved(string guid, string station, int slot, string status )        {            string sql = string.Format("INSERT INTO \"wafer_move_history\"(\"wafer_data_guid\", \"arrive_time\", \"station\", \"slot\", \"status\" )VALUES ('{0}', '{1}', '{2}', '{3}', '{4}' );",                guid,                DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss.fff"),                station,                slot+1,                status);            DB.Insert(sql);        }        public static List<HistoryMoveData> QueryDBMovement(string sql)        {            List<HistoryMoveData> result = new List<HistoryMoveData>();            try            {                DataSet ds = DB.ExecuteDataset(sql);                if (ds == null)                    return result;                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)                {                    HistoryMoveData ev = new HistoryMoveData();                    ev.WaferGuid = ds.Tables[0].Rows[i]["wafer_data_guid"].ToString();                    ev.Station = ds.Tables[0].Rows[i]["station"].ToString();                    ev.Slot = ds.Tables[0].Rows[i]["slot"].ToString();                    ev.Result = ds.Tables[0].Rows[i]["status"].ToString();                    if (!ds.Tables[0].Rows[i]["arrive_time"].Equals(DBNull.Value))                        ev.ArriveTime = ((DateTime)ds.Tables[0].Rows[i]["arrive_time"]).ToString("yyyy/MM/dd HH:mm:ss.fff");                     result.Add(ev);                }            }            catch (Exception ex)            {                LOG.WriteExeption(ex);            }            return result;        }    }}
 |