コード例 #1
0
        public static QRMQC_MES QRstring2MQCFormat(string QRstr)
        {
            QRMQC_MES qRMQC_MES = new QRMQC_MES();

            if (QRstr.Length > 0)
            {
                QRstr = QRstr.Trim();
                if (QRstr.Substring(0, 1) == "s" && QRstr.Substring((QRstr.Length - 1), 1) == "e")
                {
                    var QRArray = QRstr.Substring(1, QRstr.Length - 2).Split(';');
                    if (QRArray.Count() == 10)
                    {
                        qRMQC_MES.PO      = QRArray[2];
                        qRMQC_MES.Product = QRArray[3];
                        //  qRMQC_MES.Unit = QRArray[4];
                        qRMQC_MES.quantity = int.Parse(QRArray[4], NumberStyles.AllowThousands);
                        qRMQC_MES.dateTime = QRArray[5];
                        qRMQC_MES.str1     = QRArray[6];
                        qRMQC_MES.str2     = QRArray[7];
                        qRMQC_MES.str3     = QRArray[8];
                        qRMQC_MES.str4     = QRArray[9];
                    }
                }
            }
            return(qRMQC_MES);
        }
コード例 #2
0
        public bool InsertToMQCMES_Realtime(string QRMES, string QRID, string line, string item, string data, string Remark)
        {
            try
            {
                string datetimeserno = DateTime.Now.ToString("yyyyMMdd_HHmmss");
                string serno         = QRMES;
                string site          = "B01";
                string factory       = "TECHLINK";
                string process       = "MQC";

                string status    = "";
                string date_     = DateTime.Now.ToString("yyyy-MM-dd");
                string time_     = DateTime.Now.ToString("HH:mm:ss");
                string sqlQuerry = "";

                // string model = GetModelFromLot(lot,setting);
                QRMQC_MES qRMQC_MES = QRSpilittoClass.QRstring2MQCFormat(QRMES);
                QRIDMES   qRIDMES   = QRSpilittoClass.QRstring2IDFormat(QRID);
                sqlQuerry += "insert into m_ERPMQC_REALTIME (serno, lot, model, site, factory, line, process,item,inspectdate,inspecttime, data, judge,status,remark ) values( '";
                sqlQuerry += serno + "', '" + qRMQC_MES.PO + "', '" + qRMQC_MES.Product + "', '" + site + "', '" + factory + "', '" + line +
                             "', '" + process + "', '" + item + "', '" + date_ + "', '" + time_ + "', '" + data + "', '" + qRIDMES.ID + "', '" + status + "', '" + Remark + "' )";
                sqlCON localPLC = new sqlCON();
                return(localPLC.sqlExecuteNonQuery(sqlQuerry, false));
            }
            catch (Exception ex)
            {
                SystemLog.Output(SystemLog.MSG_TYPE.Err, "InsertToMQC_Realtime(string lot, string line, string item, string data, string Remark, int judge)", ex.Message);
                return(false);
            }
        }