Beispiel #1
0
        /// <summary>
        /// 往FRAME表里写东西
        /// </summary>
        /// <param name="mModel"></param>
        /// <returns></returns>
        public static int InsertModel_FRAME(Model_FRAME mModel)
        {
            lock (_lock)
            {
                Init();
                using (SQLiteConnection sqliteConn = new SQLiteConnection("Data Source=" + mDbPath))
                {
                    sqliteConn.Open();
                    using (SQLiteCommand cmd = sqliteConn.CreateCommand())
                    {
                        try
                        {
                            //cmd.CommandText = SQLString;
                            string strSql = "INSERT INTO REP_FRAME(lotGUID,trayIndex,frameIndex,unitContent) VALUES(@lotGUID,@trayIndex,@frameIndex,@unitContent)";
                            cmd.CommandText = strSql;
                            SQLiteParameter[] parameters =
                            {
                                new SQLiteParameter("@lotGUID",     mModel.lotGUID),
                                new SQLiteParameter("@trayIndex",   mModel.trayIndex),
                                new SQLiteParameter("@frameIndex",  mModel.frameIndex),
                                new SQLiteParameter("@unitContent", mModel.unitContent),
                            };

                            foreach (var param in parameters)
                            {
                                cmd.Parameters.Add(param);
                            }

                            int rows = cmd.ExecuteNonQuery();

                            return(rows);
                        }
                        catch (SQLiteException ex)
                        {
                            throw ex;
                        }
                        finally
                        {
                            sqliteConn.Close();
                        }
                    }
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// 一个lot跑完了 记录数据啥的
        /// </summary>
        private void EndLot()
        {
            videofrm.listBoxShowMessage("Lot完成");


            //写Lot Summary
            Tools.WriteLotSummary();
            videofrm.listBoxShowMessage("已写入Lot Summary");

            Global.mMState = MachineState.Free; //工作停止

            Global.ready2Go = false;            //开始按钮不再有用

            Global.endTime = DateTime.Now;
            //弹出个对话框 显示一些信息

            using (EndLotFrm endLotFrm = new EndLotFrm())
            {
                if (endLotFrm.ShowDialog() == DialogResult.OK)
                {
                    //啥都不干
                }
            }

            //记录时间
            Global.endLotTime = DateTime.Now;

            //下面的100代表产品数量,99pass数量 1fail数等  需要修正
            string s1 = Global.TotalFrame + "," + 100 + "," + "99" + "," + 1 + "," + 0 + "," + "1" + "," + 99;

            Global.attrib = s1;

            //这边记录下frame里排列组合啥样,需要显示根据这个来
            string s2 = Global.ImageXNum + "," + Global.ImageYNum + "," + Global.FrameXNum + "," + Global.FrameYNum;

            Global.runAttrib = s2;

            //保存INST数据
            Model_INST model1 = new Model_INST();

            model1.lotGUID    = Global.lotGUID;
            model1.lotNo      = Global.LotNum;
            model1.startTime  = Global.startTime;
            model1.endTime    = Global.endTime;
            model1.endLotTime = Global.endLotTime;
            model1.operatorID = Global.OperatorID;
            model1.attrib     = Global.attrib;
            model1.runAttrib  = Global.runAttrib;
            model1.reportType = Global.reportType;
            DataBaseTools.InsertModel_INST(model1);


            Global.frameIndex = 0;
            //保存frame数据
            foreach (var resultList in Global.AllFrameReslut)
            {
                Global.frameIndex++;
                Global.trayIndex = Global.frameIndex;  //反正就是一个list一个index
                foreach (var result in resultList)
                {
                    StringBuilder ss = new StringBuilder();
                    foreach (var t in result)
                    {
                        ss.Append(t + ",");
                    }
                    string      frameResult = ss.ToString();
                    Model_FRAME model2      = new Model_FRAME();
                    model2.lotGUID     = Global.lotGUID;
                    model2.trayIndex   = Global.trayIndex;
                    model2.frameIndex  = Global.frameIndex;
                    model2.unitContent = frameResult;
                    DataBaseTools.InsertModel_FRAME(model2);
                }
            }

            videofrm.listBoxShowMessage("数据已写入数据库");
        }