Пример #1
0
        /// <summary>
        /// 添加点检项
        /// </summary>
        /// <param name="nodeKey"></param>
        /// <param name="itemID"></param>
        /// <param name="itemBw"></param>
        /// <param name="itemDesc"></param>
        /// <param name="itemContent"></param>
        /// <param name="itemObserve"></param>
        /// <param name="itemUnit"></param>
        /// <param name="itemType"></param>
        /// <param name="itemStatus"></param>
        /// <param name="itemStatusQJ"></param>
        /// <param name="itemUpper"></param>
        /// <param name="itemLower"></param>
        /// <param name="itemSpectrum"></param>
        /// <param name="itemStartTime"></param>
        /// <param name="itemPerValue"></param>
        /// <param name="itemPerType"></param>
        /// <returns></returns>
        public bool AddItem(string nodeKey, string itemBw, string itemDesc, string itemContent, string itemObserve, string itemUnit, string itemType, string itemStatus, string itemStatusQJ, string itemUpper, string itemLower, string itemSpectrum, string itemStartTime, string itemPerValue, string itemPerType, out string errMsg)
        {
            object obj   = null;
            bool   flag  = false;
            int    count = 0;

            errMsg = "";

            sql = "select T_ITEMID from T_BASE_ITEM where T_DEVICEID='" + nodeKey + "' order by ID_KEY DESC fetch first 1 rows only ";

            obj = DBdb2.GetSingle(sql);

            if (obj != null && obj.ToString() != "")
            {
                count = int.Parse(obj.ToString()) + 1;
            }
            else
            {
                count = 1;
            }

            sql  = "insert into T_BASE_ITEM ";
            sql += "(T_ITEMID,T_ITEMPOSITION,T_ITEMDESC,T_CONTENT,T_TYPE,I_STATUS,T_OBSERVE,T_UNIT,F_LOWER,F_UPPER,I_SPECTRUM,T_DEVICEID,T_STARTTIME,T_PERIODTYPE,T_PERIODVALUE,T_STATUS)";
            sql += " values ";
            sql += "('" + count + "','" + itemBw + "','" + itemDesc + "','" + itemContent + "','" + itemType + "'," + itemStatus + ",'" + itemObserve + "','" + itemUnit + "'," + double.Parse(itemLower) + "," + double.Parse(itemUpper) + "," + int.Parse(itemSpectrum) + ",'" + nodeKey + "','" + DateTime.Parse(itemStartTime).ToString("yyyy-MM-dd 0:00:00") + "'," + int.Parse(itemPerType) + "," + int.Parse(itemPerValue) + "," + int.Parse(itemStatusQJ) + ")";

            flag = DBdb2.RunNonQuery(sql, out errMsg);

            if (flag != true)
            {
                errMsg = "新建点检项失败!";
            }

            return(flag);
        }