示例#1
0
        public List <UploadField> GetDynoData(UploadField FieldUL, int iCNLenb)
        {
            List <UploadField> resultList = new List <UploadField>();
            string             strSQL     = "select [VIN], [JCLSH] from [已检车辆库] where [Upload] = '0' and [Skip] = '0' and [JCJG] = '合格' and [JCLX] = '初检'";

            m_log.TraceInfo("==> T-SQL: " + strSQL);
            string[,] cars = SelectDB(strSQL);
            if (cars != null)
            {
                m_log.TraceInfo(cars.GetLength(0) + " record(s) will upload");
                for (int i = 0; i < cars.GetLength(0); i++)
                {
                    UploadField result = new UploadField {
                        VIN   = cars[i, 0],
                        JCLSH = cars[i, 1]
                    };
                    string strLog = "===== Record " + (i + 1).ToString() + ": [VIN: " + result.VIN + ", JCLSH: " + result.JCLSH + "] =====";
                    m_log.TraceInfo(strLog);
                    GetUploadData(FieldUL, iCNLenb, result);
                    resultList.Add(result);
                }
            }
            else
            {
                m_log.TraceError("SelectDB() return null");
            }
            return(resultList);
        }
示例#2
0
        private void SetDataTable3Oracle(string strKeyID, DataTable dt, UploadField result)
        {
            dt.Columns.Add("ID", typeof(string));                       // 0
            dt.Columns.Add("WQPF_ID", typeof(string));                  // 1

            dt.Columns.Add("TESTTYPE", typeof(string));                 // 2
            dt.Columns.Add("TESTNO", typeof(string));                   // 3
            dt.Columns.Add("TESTDATE", typeof(string));                 // 4
            dt.Columns.Add("APASS", typeof(string));                    // 5
            dt.Columns.Add("OPASS", typeof(string));                    // 6
            dt.Columns.Add("OTESTDATE", typeof(string));                // 7
            dt.Columns.Add("EPASS", typeof(string));                    // 8
            dt.Columns.Add("RESULT", typeof(string));                   // 9

            dt.Columns.Add("CREATIONTIME", typeof(DateTime));           // 10
            dt.Columns.Add("CREATOR", typeof(string));                  // 11
            dt.Columns.Add("LASTMODIFICATIONTIME", typeof(DateTime));   // 12
            dt.Columns.Add("LASTMODIFIER", typeof(string));             // 13
            dt.Columns.Add("DELETIONTIME", typeof(DateTime));           // 14
            dt.Columns.Add("ISDELETED", typeof(string));                // 15
            dt.Columns.Add("DELETER", typeof(string));                  // 16

            DataRow dr = dt.NewRow();

            dr[1] = strKeyID;
            dr[2] = result.TESTTYPE;
            dr[4] = result.TESTDATE;
            dr[8] = result.EPASS;
            //dr[9] = result.EPASS;

            dr[12] = DateTime.Now.ToLocalTime();
            dr[13] = m_cfg.DB.Name;
            dr[15] = "0";
            dt.Rows.Add(dr);
            int iRet;

            try {
                string[] strVals = m_dbOracle.GetValue(dt.TableName, "ID", "WQPF_ID", strKeyID);
                if (strVals.Length == 0)
                {
                    iRet = m_dbOracle.InsertRecords(dt.TableName, dt);
                }
                else
                {
                    iRet = m_dbOracle.UpdateRecords(dt.TableName, dt, "ID", strVals);
                }
            } catch (Exception) {
                throw;
            }
            if (iRet <= 0)
            {
                throw new Exception("插入或更新 MES 数据出错,返回的影响行数: " + iRet.ToString());
            }
        }
示例#3
0
        private void SetDataTable6Oracle(string strKeyID, DataTable dt, UploadField result)
        {
            dt.Columns.Add("ID", typeof(string));                       // 0
            dt.Columns.Add("WQPF_ID", typeof(string));                  // 1

            dt.Columns.Add("ANALYMANUF", typeof(string));               // 2
            dt.Columns.Add("ANALYNAME", typeof(string));                // 3
            dt.Columns.Add("ANALYMODEL", typeof(string));               // 4
            dt.Columns.Add("ANALYDATE", typeof(string));                // 5
            dt.Columns.Add("DYNOMODEL", typeof(string));                // 6
            dt.Columns.Add("DYNOMANUF", typeof(string));                // 7

            dt.Columns.Add("CREATIONTIME", typeof(DateTime));           // 8
            dt.Columns.Add("CREATOR", typeof(string));                  // 9
            dt.Columns.Add("LASTMODIFICATIONTIME", typeof(DateTime));   // 10
            dt.Columns.Add("LASTMODIFIER", typeof(string));             // 11
            dt.Columns.Add("DELETIONTIME", typeof(DateTime));           // 12
            dt.Columns.Add("ISDELETED", typeof(string));                // 13
            dt.Columns.Add("DELETER", typeof(string));                  // 14

            DataRow dr = dt.NewRow();

            dr[1] = strKeyID;
            dr[2] = result.ANALYMANUF;
            dr[3] = result.ANALYNAME;
            dr[4] = result.ANALYMODEL;
            dr[5] = result.ANALYDATE;
            dr[6] = result.DYNOMODEL;
            dr[7] = result.DYNOMANUF;

            dr[10] = DateTime.Now.ToLocalTime();
            dr[11] = m_cfg.DB.Name;
            dr[13] = "0";
            dt.Rows.Add(dr);
            int iRet;

            try {
                string[] strVals = m_dbOracle.GetValue(dt.TableName, "ID", "WQPF_ID", strKeyID);
                if (strVals.Length == 0)
                {
                    iRet = m_dbOracle.InsertRecords(dt.TableName, dt);
                }
                else
                {
                    iRet = m_dbOracle.UpdateRecords(dt.TableName, dt, "ID", strVals);
                }
            } catch (Exception) {
                throw;
            }
            if (iRet <= 0)
            {
                throw new Exception("插入或更新 MES 数据出错,返回的影响行数: " + iRet.ToString());
            }
        }
示例#4
0
        public Dictionary <string, string> GetDevice(UploadField FieldUL, int iCNLenb)
        {
            Dictionary <string, string> ret = new Dictionary <string, string>();

            string[] deviceInfo = GetDeviceInfo(FieldUL, iCNLenb);
            ret.Add("分析仪制造厂", deviceInfo[0]);
            ret.Add("分析仪名称", deviceInfo[1]);
            ret.Add("分析仪型号", deviceInfo[2]);
            ret.Add("测功机型号", deviceInfo[3]);
            ret.Add("测功机生产厂", deviceInfo[4]);
            return(ret);
        }
示例#5
0
        public Dictionary <string, string> Get53(UploadField FieldUL, string JCLSH)
        {
            Dictionary <string, string> ret = new Dictionary <string, string> {
                { "HC结果(g/km)", GetFieldValue(FieldUL.VRHC, JCLSH, true, 3, 2) },
                { "HC限值(g/km)", GetFieldValue(FieldUL.VLHC, JCLSH, true, 3, 2) },
                { "CO结果(g/km)", GetFieldValue(FieldUL.VRCO_53, JCLSH, true, 3, 2) },
                { "CO限值(g/km)", GetFieldValue(FieldUL.VLCO_53, JCLSH, true, 3, 2) },
                { "NOx结果(g/km)", GetFieldValue(FieldUL.VRNOX, JCLSH, true, 3, 2) },
                { "NOx限值(g/km)", GetFieldValue(FieldUL.VLNOX, JCLSH, true, 3, 2) }
            };

            return(ret);
        }
示例#6
0
        private string[] GetDeviceInfo(UploadField FieldUL, int iCNLenb)
        {
            string[] ret        = new string[5];
            string   strTable   = FieldUL.ANALYMANUF.Split('.')[0];
            string   ANALYMANUF = FieldUL.ANALYMANUF.Split('.')[1];
            string   ANALYNAME  = FieldUL.ANALYNAME.Split('.')[1];
            string   ANALYMODEL = FieldUL.ANALYMODEL.Split('.')[1];
            string   DYNOMODEL  = FieldUL.DYNOMODEL.Split('.')[1];
            string   DYNOMANUF  = FieldUL.DYNOMANUF.Split('.')[1];

            string strSQL = "select [" + ANALYMANUF + "], ";

            strSQL += "[" + ANALYNAME + "], ";
            strSQL += "[" + ANALYMODEL + "], ";
            strSQL += "[" + DYNOMODEL + "], ";
            strSQL += "[" + DYNOMANUF + "] from [" + strTable + "]";

            //m_log.TraceInfo("==> T-SQL: " + strSQL);
            string[,] vals = SelectDB(strSQL);
            if (vals != null && vals.GetLength(0) > 0)
            {
                for (int i = 0; i < vals.GetLength(1); i++)
                {
                    ret[i] = vals[0, i];
                }
            }
            if (ret[0].Length > 30 / iCNLenb)
            {
                ret[0] = ret[0].Substring(0, 30 / iCNLenb);
            }
            if (ret[1].Length > 30 / iCNLenb)
            {
                ret[1] = ret[0].Substring(0, 30 / iCNLenb);
            }
            if (ret[2].Length > 50)
            {
                ret[2] = ret[0].Substring(0, 50);
            }
            if (ret[3].Length > 50)
            {
                ret[3] = ret[0].Substring(0, 50);
            }
            if (ret[4].Length > 50 / iCNLenb)
            {
                ret[4] = ret[0].Substring(0, 50 / iCNLenb);
            }
            return(ret);
        }
示例#7
0
        public Dictionary <string, string> Get54(UploadField FieldUL, string JCLSH)
        {
            Dictionary <string, string> ret = new Dictionary <string, string> {
                { "额定转速上限(r/min)", GetFieldValue(FieldUL.RATEREVUP, JCLSH, true, 5) },
                { "额定转速下限(r/min)", GetFieldValue(FieldUL.RATEREVDOWN, JCLSH, true, 5) },
                { "实测转速(r/min)", GetFieldValue(FieldUL.REV100, JCLSH, true, 5) },
                { "实测最大轮边功率(kw)", GetFieldValue(FieldUL.MAXPOWER, JCLSH, true, 4, 1) },
                { "最大轮边功率限值(kw)", GetFieldValue(FieldUL.MAXPOWERLIMIT, JCLSH, true, 4, 1) },
                { "100%点烟度(1/m)", GetFieldValue(FieldUL.SMOKE100, JCLSH, true, 3, 2) },
                { "80%点烟度(1/m)", GetFieldValue(FieldUL.SMOKE80, JCLSH, true, 3, 2) },
                { "烟度限值(1/m)", GetFieldValue(FieldUL.SMOKELIMIT, JCLSH, true, 3, 2) },
                { "氮氧化物测量值(10^-6)", GetFieldValue(FieldUL.NOX, JCLSH, true, 4) },
                { "氮氧化物限值(10^-6)", GetFieldValue(FieldUL.NOXLIMIT, JCLSH, true, 4) }
            };

            return(ret);
        }
示例#8
0
        private void SetDataTable56Oracle(string strKeyID, DataTable dt, UploadField result)
        {
            dt.Columns.Add("ID", typeof(string));                       // 0
            dt.Columns.Add("WQPF_ID", typeof(string));                  // 1

            dt.Columns.Add("VRCO", typeof(string));                     // 2
            dt.Columns.Add("VLCO", typeof(string));                     // 3
            dt.Columns.Add("VRHCNOX", typeof(string));                  // 4
            dt.Columns.Add("VLHCNOX", typeof(string));                  // 5

            dt.Columns.Add("CREATIONTIME", typeof(DateTime));           // 6
            dt.Columns.Add("CREATOR", typeof(string));                  // 7
            dt.Columns.Add("LASTMODIFICATIONTIME", typeof(DateTime));   // 8
            dt.Columns.Add("LASTMODIFIER", typeof(string));             // 9
            dt.Columns.Add("DELETIONTIME", typeof(DateTime));           // 10
            dt.Columns.Add("ISDELETED", typeof(string));                // 11
            dt.Columns.Add("DELETER", typeof(string));                  // 12
        }
示例#9
0
        public Dictionary <string, string> Get51(UploadField FieldUL, string JCLSH)
        {
            Dictionary <string, string> ret = new Dictionary <string, string> {
                { "过量空气系数结果", GetFieldValue(FieldUL.REAC, JCLSH, true, 3, 2) },
                { "双怠速过量空气系数上限", GetFieldValue(FieldUL.LEACMAX, JCLSH, true, 3, 2) },
                { "双怠速过量空气系数下限", GetFieldValue(FieldUL.LEACMIN, JCLSH, true, 3, 2) },
                { "低怠速CO结果(%)", GetFieldValue(FieldUL.LRCO, JCLSH, true, 3, 2) },
                { "低怠速CO限值(%)", GetFieldValue(FieldUL.LLCO, JCLSH, true, 3, 2) },
                { "低怠速HC结果(10^-6)", GetFieldValue(FieldUL.LRHC, JCLSH, true, 4) },
                { "低怠速HC限值(10^-6)", GetFieldValue(FieldUL.LLHC, JCLSH, true, 4) },
                { "高怠速CO结果(%)", GetFieldValue(FieldUL.HRCO, JCLSH, true, 3, 2) },
                { "高怠速CO限值(%)", GetFieldValue(FieldUL.HLCO, JCLSH, true, 3, 2) },
                { "高怠速HC结果(10^-6)", GetFieldValue(FieldUL.HRHC, JCLSH, true, 4) },
                { "高怠速HC限值(10^-6)", GetFieldValue(FieldUL.HLHC, JCLSH, true, 4) }
            };

            return(ret);
        }
示例#10
0
        private void ManualUpload()
        {
            UploadField result = null;

            try {
                result = m_db.GetDynoDataByVIN(m_cfg.FieldUL.Data, m_iCNLenb, this.txtBoxVIN.Text);
            } catch (Exception ex) {
                m_log.TraceError("GetDynoData error: " + ex.Message);
            }
            if (result == null)
            {
                this.Invoke((EventHandler) delegate {
                    this.txtBoxManualUpload.BackColor = Color.Red;
                    this.txtBoxManualUpload.ForeColor = Color.White;
                    this.txtBoxManualUpload.Text      = "VIN[" + this.txtBoxVIN.Text + "]未获取到排放数据";
                });
            }
            else
            {
                if (Upload(result, out string errorMsg))
                {
                    this.Invoke((EventHandler) delegate {
                        this.txtBoxManualUpload.BackColor = Color.LightGreen;
                        this.txtBoxManualUpload.ForeColor = m_foreColor;
                        this.txtBoxManualUpload.Text      = "VIN[" + result.VIN + "]数据已手动上传";
                    });
                }
                else
                {
                    if (errorMsg.Contains("Exception|"))
                    {
                        MessageBox.Show(errorMsg.Split('|')[1], "上传出错", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        this.Invoke((EventHandler) delegate {
                            this.txtBoxManualUpload.BackColor = Color.Red;
                            this.txtBoxManualUpload.ForeColor = Color.White;
                            this.txtBoxManualUpload.Text      = "VIN[" + result.VIN + "]" + errorMsg;
                        });
                    }
                }
            }
        }
示例#11
0
        public UploadField GetDynoDataByVIN(UploadField FieldUL, int iCNLenb, string strVIN)
        {
            UploadField result = null;
            string      strSQL = "select [VIN], [JCLSH] from [已检车辆库] where [VIN] = '" + strVIN + "'";

            m_log.TraceInfo("==> T-SQL: " + strSQL);
            string[,] cars = SelectDB(strSQL);
            if (cars != null && cars.GetLength(0) > 0)
            {
                result = new UploadField {
                    VIN   = cars[0, 0],
                    JCLSH = cars[0, 1]
                };
                string strLog = "===== GetDynoDataByVIN: [VIN: " + result.VIN + ", JCLSH: " + result.JCLSH + "] =====";
                m_log.TraceInfo(strLog);
                GetUploadData(FieldUL, iCNLenb, result);
            }
            return(result);
        }
示例#12
0
        public Dictionary <string, string> Get52(UploadField FieldUL, string JCLSH)
        {
            Dictionary <string, string> ret = new Dictionary <string, string> {
                { "5025HC结果(10^-6)", GetFieldValue(FieldUL.ARHC5025, JCLSH, true, 4) },
                { "5025HC限值(10^-6)", GetFieldValue(FieldUL.ALHC5025, JCLSH, true, 4) },
                { "5025CO结果(%)", GetFieldValue(FieldUL.ARCO5025, JCLSH, true, 3, 2) },
                { "5025CO限值(%)", GetFieldValue(FieldUL.ALCO5025, JCLSH, true, 3, 2) },
                { "5025NO结果(10^-6)", GetFieldValue(FieldUL.ARNOX5025, JCLSH, true, 4) },
                { "5025NO限值(10^-6)", GetFieldValue(FieldUL.ALNOX5025, JCLSH, true, 4) },
                { "2540HC结果(10^-6)", GetFieldValue(FieldUL.ARHC2540, JCLSH, true, 4) },
                { "2540HC限值(10^-6)", GetFieldValue(FieldUL.ALHC2540, JCLSH, true, 4) },
                { "2540CO结果(%)", GetFieldValue(FieldUL.ARCO2540, JCLSH, true, 3, 2) },
                { "2540CO限值(%)", GetFieldValue(FieldUL.ALCO2540, JCLSH, true, 3, 2) },
                { "2540NO结果(10^-6)", GetFieldValue(FieldUL.ARNOX2540, JCLSH, true, 4) },
                { "2540NO限值(10^-6)", GetFieldValue(FieldUL.ALNOX2540, JCLSH, true, 4) }
            };

            return(ret);
        }
示例#13
0
        private void SetDataTable55Oracle(string strKeyID, DataTable dt, UploadField result)
        {
            dt.Columns.Add("ID", typeof(string));                       // 0
            dt.Columns.Add("WQPF_ID", typeof(string));                  // 1

            dt.Columns.Add("RATEREV", typeof(string));                  // 2
            dt.Columns.Add("REV", typeof(string));                      // 3
            dt.Columns.Add("SMOKEK1", typeof(string));                  // 4
            dt.Columns.Add("SMOKEK2", typeof(string));                  // 5
            dt.Columns.Add("SMOKEK3", typeof(string));                  // 6
            dt.Columns.Add("SMOKEAVG", typeof(string));                 // 7
            dt.Columns.Add("SMOKEKLIMIT", typeof(string));              // 8

            dt.Columns.Add("CREATIONTIME", typeof(DateTime));           // 9
            dt.Columns.Add("CREATOR", typeof(string));                  // 10
            dt.Columns.Add("LASTMODIFICATIONTIME", typeof(DateTime));   // 11
            dt.Columns.Add("LASTMODIFIER", typeof(string));             // 12
            dt.Columns.Add("DELETIONTIME", typeof(DateTime));           // 13
            dt.Columns.Add("ISDELETED", typeof(string));                // 14
            dt.Columns.Add("DELETER", typeof(string));                  // 15
        }
示例#14
0
        public Dictionary <string, string> GetResult(UploadField FieldUL, string JCLSH)
        {
            Dictionary <string, string> ret = new Dictionary <string, string>();
            string TESTTYPE = GetFieldValue(FieldUL.TESTTYPE, JCLSH);

            TESTTYPE = GetTestType(TESTTYPE);
            string TESTDATE = GetFieldValue(FieldUL.TESTDATE, JCLSH);

            if (TESTDATE.Length == 0)
            {
                TESTDATE = DateTime.Now.ToLocalTime().ToString("yyyyMMdd");
            }
            else
            {
                TESTDATE = TESTDATE.Substring(0, 10).Replace("-", "");
            }
            string EPASS = GetFieldValue(FieldUL.EPASS, JCLSH);

            EPASS = (EPASS == "合格") ? "1" : "0";
            ret.Add("检测方法", TESTTYPE);
            ret.Add("检测日期", TESTDATE);
            ret.Add("检测结果", EPASS);
            return(ret);
        }
示例#15
0
        private bool Upload(UploadField result, out string errorMsg)
        {
            bool bRet = false;

            errorMsg = "";
            if (result.EPASS != "1")
            {
                m_log.TraceInfo("Skip this VIN[" + result.VIN + "] because of EPASS != 1");
                errorMsg = "排放结果不合格,数据不上传";
                return(bRet);
            }
            DataTable dt2  = new DataTable("IF_EM_WQPF_2");
            DataTable dt3  = new DataTable("IF_EM_WQPF_3");
            DataTable dt51 = new DataTable("IF_EM_WQPF_5_1");
            DataTable dt52 = new DataTable("IF_EM_WQPF_5_2");
            DataTable dt53 = new DataTable("IF_EM_WQPF_5_3");
            DataTable dt54 = new DataTable("IF_EM_WQPF_5_4");
            DataTable dt6  = new DataTable("IF_EM_WQPF_6");

            try {
                string[] ID_MES = m_dbOracle.GetValue("IF_EM_WQPF_1", "ID", "VIN", result.VIN);
                if (ID_MES != null && ID_MES.Length > 0)
                {
                    SetDataTable2Oracle(ID_MES[0], dt2, result);
                    SetDataTable3Oracle(ID_MES[0], dt3, result);
                    switch (result.TESTTYPE)
                    {
                    case "1":
                        SetDataTable51Oracle(ID_MES[0], dt51, result);
                        break;

                    case "2":
                        SetDataTable52Oracle(ID_MES[0], dt52, result);
                        break;

                    case "3":
                        SetDataTable53Oracle(ID_MES[0], dt53, result);
                        break;

                    case "4":
                        SetDataTable54Oracle(ID_MES[0], dt54, result);
                        break;

                    default:
                        break;
                    }
                    SetDataTable6Oracle(ID_MES[0], dt6, result);
                    m_db.SetUpload(1, result.JCLSH);
                    bRet = true;
                }
                else
                {
                    m_log.TraceWarning("Skip this VIN[" + result.VIN + "] because it is not in MES");
                    errorMsg = "在MES中未检测到记录,数据不上传";
                }
            } catch (Exception ex) {
                m_log.TraceError("Upload error: " + ex.Message);
                errorMsg = "Exception|" + ex.Message;
            } finally {
                dt2.Dispose();
                dt3.Dispose();
                dt51.Dispose();
                dt52.Dispose();
                dt53.Dispose();
                dt54.Dispose();
                dt6.Dispose();
            }
            return(bRet);
        }
示例#16
0
        private void SetDataTable54Oracle(string strKeyID, DataTable dt, UploadField result)
        {
            dt.Columns.Add("ID", typeof(string));                       // 0
            dt.Columns.Add("WQPF_ID", typeof(string));                  // 1

            dt.Columns.Add("RATEREVUP", typeof(string));                // 2
            dt.Columns.Add("RATEREVDOWN", typeof(string));              // 3
            dt.Columns.Add("REV100", typeof(string));                   // 4
            dt.Columns.Add("MAXPOWER", typeof(string));                 // 5
            dt.Columns.Add("MAXPOWERLIMIT", typeof(string));            // 6
            dt.Columns.Add("SMOKE100", typeof(string));                 // 7
            dt.Columns.Add("SMOKE80", typeof(string));                  // 8
            dt.Columns.Add("SMOKELIMIT", typeof(string));               // 9
            dt.Columns.Add("NOX", typeof(string));                      // 10
            dt.Columns.Add("NOXLIMIT", typeof(string));                 // 11

            dt.Columns.Add("CREATIONTIME", typeof(DateTime));           // 12
            dt.Columns.Add("CREATOR", typeof(string));                  // 13
            dt.Columns.Add("LASTMODIFICATIONTIME", typeof(DateTime));   // 14
            dt.Columns.Add("LASTMODIFIER", typeof(string));             // 15
            dt.Columns.Add("DELETIONTIME", typeof(DateTime));           // 16
            dt.Columns.Add("ISDELETED", typeof(string));                // 17
            dt.Columns.Add("DELETER", typeof(string));                  // 18

            DataRow dr = dt.NewRow();

            dr[1]  = strKeyID;
            dr[2]  = result.RATEREVUP;
            dr[3]  = result.RATEREVDOWN;
            dr[4]  = result.REV100;
            dr[5]  = result.MAXPOWER;
            dr[6]  = result.MAXPOWERLIMIT;
            dr[7]  = result.SMOKE100;
            dr[8]  = result.SMOKE80;
            dr[9]  = result.SMOKELIMIT;
            dr[10] = result.NOX;
            dr[11] = result.NOXLIMIT;

            dr[14] = DateTime.Now.ToLocalTime();
            dr[15] = m_cfg.DB.Name;
            dr[17] = "0";
            dt.Rows.Add(dr);
            int iRet;

            try {
                string[] strVals = m_dbOracle.GetValue(dt.TableName, "ID", "WQPF_ID", strKeyID);
                if (strVals.Length == 0)
                {
                    iRet = m_dbOracle.InsertRecords(dt.TableName, dt);
                }
                else
                {
                    iRet = m_dbOracle.UpdateRecords(dt.TableName, dt, "ID", strVals);
                }
            } catch (Exception) {
                throw;
            }
            if (iRet <= 0)
            {
                throw new Exception("插入或更新 MES 数据出错,返回的影响行数: " + iRet.ToString());
            }
        }
示例#17
0
        private void SetDataTable51Oracle(string strKeyID, DataTable dt, UploadField result)
        {
            dt.Columns.Add("ID", typeof(string));                       // 0
            dt.Columns.Add("WQPF_ID", typeof(string));                  // 1

            dt.Columns.Add("REAC", typeof(string));                     // 2
            dt.Columns.Add("LEACMAX", typeof(string));                  // 3
            dt.Columns.Add("LEACMIN", typeof(string));                  // 4
            dt.Columns.Add("LRCO", typeof(string));                     // 5
            dt.Columns.Add("LLCO", typeof(string));                     // 6
            dt.Columns.Add("LRHC", typeof(string));                     // 7
            dt.Columns.Add("LLHC", typeof(string));                     // 8
            dt.Columns.Add("HRCO", typeof(string));                     // 9
            dt.Columns.Add("HLCO", typeof(string));                     // 10
            dt.Columns.Add("HRHC", typeof(string));                     // 11
            dt.Columns.Add("HLHC", typeof(string));                     // 12

            dt.Columns.Add("CREATIONTIME", typeof(DateTime));           // 13
            dt.Columns.Add("CREATOR", typeof(string));                  // 14
            dt.Columns.Add("LASTMODIFICATIONTIME", typeof(DateTime));   // 15
            dt.Columns.Add("LASTMODIFIER", typeof(string));             // 16
            dt.Columns.Add("DELETIONTIME", typeof(DateTime));           // 17
            dt.Columns.Add("ISDELETED", typeof(string));                // 18
            dt.Columns.Add("DELETER", typeof(string));                  // 19

            DataRow dr = dt.NewRow();

            dr[1]  = strKeyID;
            dr[2]  = result.REAC;
            dr[3]  = result.LEACMAX;
            dr[4]  = result.LEACMIN;
            dr[5]  = result.LRCO;
            dr[6]  = result.LLCO;
            dr[7]  = result.LRHC;
            dr[8]  = result.LLHC;
            dr[9]  = result.HRCO;
            dr[10] = result.HLCO;
            dr[11] = result.HRHC;
            dr[12] = result.HLHC;

            dr[15] = DateTime.Now.ToLocalTime();
            dr[16] = m_cfg.DB.Name;
            dr[18] = "0";
            dt.Rows.Add(dr);
            int iRet;

            try {
                string[] strVals = m_dbOracle.GetValue(dt.TableName, "ID", "WQPF_ID", strKeyID);
                if (strVals.Length == 0)
                {
                    iRet = m_dbOracle.InsertRecords(dt.TableName, dt);
                }
                else
                {
                    iRet = m_dbOracle.UpdateRecords(dt.TableName, dt, "ID", strVals);
                }
            } catch (Exception) {
                throw;
            }
            if (iRet <= 0)
            {
                throw new Exception("插入或更新 MES 数据出错,返回的影响行数: " + iRet.ToString());
            }
        }
示例#18
0
        private void GetUploadData(UploadField FieldUL, int iCNLenb, UploadField result_out)
        {
            // IF_EM_WQPF_2
            string[] env = GetEnvValue(result_out.JCLSH);
            result_out.RH = env[0];
            result_out.ET = env[1];
            result_out.AP = env[2];
            string strLog = "IF_EM_WQPF_2 Data: [RH: " + result_out.RH + ", ET: " + result_out.ET + ", AP: " + result_out.AP + "]";

            m_log.TraceInfo(strLog);

            // IF_EM_WQPF_3
            result_out.TESTTYPE = GetFieldValue(FieldUL.TESTTYPE, result_out.JCLSH);
            result_out.TESTTYPE = GetTestType(result_out.TESTTYPE);
            result_out.TESTDATE = GetFieldValue(FieldUL.TESTDATE, result_out.JCLSH);
            if (result_out.TESTDATE.Length == 0)
            {
                result_out.TESTDATE = DateTime.Now.ToLocalTime().ToString("yyyyMMdd");
            }
            else
            {
                result_out.TESTDATE = result_out.TESTDATE.Substring(0, 10).Replace("-", "");
            }
            result_out.EPASS = GetFieldValue(FieldUL.EPASS, result_out.JCLSH);
            result_out.EPASS = result_out.EPASS == "合格" ? "1" : "0";
            strLog           = "IF_EM_WQPF_3 Data: [TESTTYPE: " + result_out.TESTTYPE + ", TESTDATE: " + result_out.TESTDATE + ", EPASS: "******"]";
            m_log.TraceInfo(strLog);

            // IF_EM_WQPF_5_1
            result_out.REAC    = GetFieldValue(FieldUL.REAC, result_out.JCLSH, true, 3, 2);
            result_out.LEACMAX = GetFieldValue(FieldUL.LEACMAX, result_out.JCLSH, true, 3, 2);
            result_out.LEACMIN = GetFieldValue(FieldUL.LEACMIN, result_out.JCLSH, true, 3, 2);
            result_out.LRCO    = GetFieldValue(FieldUL.LRCO, result_out.JCLSH, true, 3, 2);
            result_out.LLCO    = GetFieldValue(FieldUL.LLCO, result_out.JCLSH, true, 3, 2);
            result_out.LRHC    = GetFieldValue(FieldUL.LRHC, result_out.JCLSH, true, 4);
            result_out.LLHC    = GetFieldValue(FieldUL.LLHC, result_out.JCLSH, true, 4);
            result_out.HRCO    = GetFieldValue(FieldUL.HRCO, result_out.JCLSH, true, 3, 2);
            result_out.HLCO    = GetFieldValue(FieldUL.HLCO, result_out.JCLSH, true, 3, 2);
            result_out.HRHC    = GetFieldValue(FieldUL.HRHC, result_out.JCLSH, true, 4);
            result_out.HLHC    = GetFieldValue(FieldUL.HLHC, result_out.JCLSH, true, 4);
            strLog             = "IF_EM_WQPF_5_1 Data: [REAC: " + result_out.REAC + ", LEACMAX: " + result_out.LEACMAX + ", LEACMIN: " + result_out.LEACMIN;
            strLog            += ", LRCO: " + result_out.LRCO;
            strLog            += ", LLCO: " + result_out.LLCO;
            strLog            += ", LRHC: " + result_out.LRHC;
            strLog            += ", LLHC: " + result_out.LLHC;
            strLog            += ", HRCO: " + result_out.HRCO;
            strLog            += ", HLCO: " + result_out.HLCO;
            strLog            += ", HRHC: " + result_out.HRHC;
            strLog            += ", HLHC: " + result_out.HLHC + "]";
            m_log.TraceInfo(strLog);

            // IF_EM_WQPF_5_2
            result_out.ARHC5025  = GetFieldValue(FieldUL.ARHC5025, result_out.JCLSH, true, 4);
            result_out.ALHC5025  = GetFieldValue(FieldUL.ALHC5025, result_out.JCLSH, true, 4);
            result_out.ARCO5025  = GetFieldValue(FieldUL.ARCO5025, result_out.JCLSH, true, 3, 2);
            result_out.ALCO5025  = GetFieldValue(FieldUL.ALCO5025, result_out.JCLSH, true, 3, 2);
            result_out.ARNOX5025 = GetFieldValue(FieldUL.ARNOX5025, result_out.JCLSH, true, 4);
            result_out.ALNOX5025 = GetFieldValue(FieldUL.ALNOX5025, result_out.JCLSH, true, 4);
            result_out.ARHC2540  = GetFieldValue(FieldUL.ARHC2540, result_out.JCLSH, true, 4);
            result_out.ALHC2540  = GetFieldValue(FieldUL.ALHC2540, result_out.JCLSH, true, 4);
            result_out.ARCO2540  = GetFieldValue(FieldUL.ARCO2540, result_out.JCLSH, true, 3, 2);
            result_out.ALCO2540  = GetFieldValue(FieldUL.ALCO2540, result_out.JCLSH, true, 3, 2);
            result_out.ARNOX2540 = GetFieldValue(FieldUL.ARNOX2540, result_out.JCLSH, true, 4);
            result_out.ALNOX2540 = GetFieldValue(FieldUL.ALNOX2540, result_out.JCLSH, true, 4);
            strLog  = "IF_EM_WQPF_5_2 Data: [ARHC5025: " + result_out.ARHC5025;
            strLog += ", ALHC5025: " + result_out.ALHC5025;
            strLog += ", ARCO5025: " + result_out.ARCO5025;
            strLog += ", ALCO5025: " + result_out.ALCO5025;
            strLog += ", ARNOX5025: " + result_out.ARNOX5025;
            strLog += ", ALNOX5025: " + result_out.ALNOX5025;
            strLog += ", ARHC2540: " + result_out.ARHC2540;
            strLog += ", ALHC2540: " + result_out.ALHC2540;
            strLog += ", ARCO2540: " + result_out.ARCO2540;
            strLog += ", ALCO2540: " + result_out.ALCO2540;
            strLog += ", ARNOX2540: " + result_out.ARNOX2540;
            strLog += ", ALNOX2540: " + result_out.ALNOX2540 + "]";
            m_log.TraceInfo(strLog);

            // IF_EM_WQPF_5_3
            result_out.VRHC    = GetFieldValue(FieldUL.VRHC, result_out.JCLSH, true, 3, 2);
            result_out.VLHC    = GetFieldValue(FieldUL.VLHC, result_out.JCLSH, true, 3, 2);
            result_out.VRCO_53 = GetFieldValue(FieldUL.VRCO_53, result_out.JCLSH, true, 3, 2);
            result_out.VLCO_53 = GetFieldValue(FieldUL.VLCO_53, result_out.JCLSH, true, 3, 2);
            result_out.VRNOX   = GetFieldValue(FieldUL.VRNOX, result_out.JCLSH, true, 3, 2);
            result_out.VLNOX   = GetFieldValue(FieldUL.VLNOX, result_out.JCLSH, true, 3, 2);
            strLog             = "IF_EM_WQPF_5_3 Data: [VRHC: " + result_out.VRHC;
            strLog            += ", VLHC: " + result_out.VLHC;
            strLog            += ", VRCO_53: " + result_out.VRCO_53;
            strLog            += ", VLCO_53: " + result_out.VLCO_53;
            strLog            += ", VRNOX: " + result_out.VRNOX;
            strLog            += ", VLNOX: " + result_out.VLNOX + "]";
            m_log.TraceInfo(strLog);

            // IF_EM_WQPF_5_4
            result_out.RATEREVUP     = GetFieldValue(FieldUL.RATEREVUP, result_out.JCLSH, true, 5);
            result_out.RATEREVDOWN   = GetFieldValue(FieldUL.RATEREVDOWN, result_out.JCLSH, true, 5);
            result_out.REV100        = GetFieldValue(FieldUL.REV100, result_out.JCLSH, true, 5);
            result_out.MAXPOWER      = GetFieldValue(FieldUL.MAXPOWER, result_out.JCLSH, true, 4, 1);
            result_out.MAXPOWERLIMIT = GetFieldValue(FieldUL.MAXPOWERLIMIT, result_out.JCLSH, true, 4, 1);
            result_out.SMOKE100      = GetFieldValue(FieldUL.SMOKE100, result_out.JCLSH, true, 3, 2);
            result_out.SMOKE80       = GetFieldValue(FieldUL.SMOKE80, result_out.JCLSH, true, 3, 2);
            result_out.SMOKELIMIT    = GetFieldValue(FieldUL.SMOKELIMIT, result_out.JCLSH, true, 3, 2);
            result_out.NOX           = GetFieldValue(FieldUL.NOX, result_out.JCLSH, true, 4);
            result_out.NOXLIMIT      = GetFieldValue(FieldUL.NOXLIMIT, result_out.JCLSH, true, 4);
            strLog  = "IF_EM_WQPF_5_4 Data: [RATEREVUP: " + result_out.RATEREVUP;
            strLog += ", RATEREVDOWN: " + result_out.RATEREVDOWN;
            strLog += ", REV100: " + result_out.REV100;
            strLog += ", MAXPOWER: " + result_out.MAXPOWER;
            strLog += ", MAXPOWERLIMIT: " + result_out.MAXPOWERLIMIT;
            strLog += ", SMOKE100: " + result_out.SMOKE100;
            strLog += ", SMOKE80: " + result_out.SMOKE80;
            strLog += ", SMOKELIMIT: " + result_out.SMOKELIMIT;
            strLog += ", NOX: " + result_out.NOX;
            strLog += ", NOXLIMIT: " + result_out.NOXLIMIT + "]";
            m_log.TraceInfo(strLog);

            // IF_EM_WQPF_6
            string[] deviceInfo = GetDeviceInfo(FieldUL, iCNLenb);
            result_out.ANALYMANUF = deviceInfo[0];
            result_out.ANALYNAME  = deviceInfo[1];
            result_out.ANALYMODEL = deviceInfo[2];
            result_out.DYNOMODEL  = deviceInfo[3];
            result_out.DYNOMANUF  = deviceInfo[4];
            strLog  = "IF_EM_WQPF_6 Data: [ANALYMANUF: " + result_out.ANALYMANUF;
            strLog += ", ANALYNAME: " + result_out.ANALYNAME;
            strLog += ", ANALYMODEL: " + result_out.ANALYMODEL;
            strLog += ", DYNOMODEL: " + result_out.DYNOMODEL;
            strLog += ", DYNOMANUF: " + result_out.DYNOMANUF + "]";
            m_log.TraceInfo(strLog);
        }