Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            FT_MES_STEP_INFOModel m = new FT_MES_STEP_INFOModel();

            m.RECID         = System.Guid.NewGuid().ToString();
            m.SERIAL_NUMBER = "71125800010L411606101238";
            m.STEP_NUMBER   = "RQ-ZA041";
            m.TRX_TIME      = System.DateTime.Now;
            m.STATUS        = 0;
            m.CHECK_RESULT  = 1;
            this.mesDA.AddMesBaseinfo(m);
        }
Ejemplo n.º 2
0
        protected bool UploadMesbasicData(LOCAL_MES_STEP_INFOModel m)
        {
            //if (mesDA.MesBaseExist(m.RECID)) //?
            //{
            //    m.RECID = System.Guid.NewGuid().ToString();
            //}

            FT_MES_STEP_INFOModel ftM = new FT_MES_STEP_INFOModel();

            ftM.CHECK_RESULT     = m.CHECK_RESULT;
            ftM.DEFECT_CODES     = m.DEFECT_CODES;
            ftM.LAST_MODIFY_TIME = m.LAST_MODIFY_TIME;
            ftM.REASON           = m.REASON;
            ftM.RECID            = m.RECID;
            ftM.SERIAL_NUMBER    = m.SERIAL_NUMBER;
            ftM.STATUS           = m.STATUS;
            ftM.STEP_MARK        = m.STEP_MARK;
            ftM.STEP_NUMBER      = m.STEP_NUMBER;
            ftM.TRX_TIME         = m.TRX_TIME;
            ftM.USER_NAME        = m.USER_NAME;
            try
            {
                int reTryMax     = 10;
                int reTryCounter = 0;
                while (!mesDA.AddMesBaseinfo(ftM))
                {
                    Thread.Sleep(1000);
                    reTryCounter++;
                    if (reTryCounter > reTryMax)
                    {
                        logRecorder.AddDebugLog(this.nodeName, string.Format("上传基本数据到MES失败,条码:{0},工位:{1}", ftM.SERIAL_NUMBER, ftM.STEP_NUMBER));
                        return(false);
                    }
                }

                logRecorder.AddDebugLog(this.nodeName, string.Format("上传基本数据到MES成功,条码:{0},工位:{1}", ftM.SERIAL_NUMBER, ftM.STEP_NUMBER));
                if (!mesDA.MesBaseExist(ftM.RECID))
                {
                    logRecorder.AddDebugLog(this.nodeName, string.Format("MES数据未存在,条码:{0},工位:{1}", ftM.SERIAL_NUMBER, ftM.STEP_NUMBER));
                }
                return(true);
            }
            catch (Exception ex)
            {
                logRecorder.AddDebugLog(this.nodeName, string.Format("上传基本数据到MES,数据库访问异常,条码:{0},工位:{1},{2}", ftM.SERIAL_NUMBER, ftM.STEP_NUMBER, ex.Message));
                return(false);
            }
        }