コード例 #1
0
        private void SaveArea(string areaName, string areaCd)
        {
            int    count;
            string info = "";
            bool   flag = false;

            //判断射频卡ID 是否重复
            sql = "select count(*) from T_BASE_AREA where T_AREACD='" + areaCd + "'";

            object obj = DBdb2.RunSingle(sql, out errMsg);

            sql = "select count(*) from T_BASE_AREA where T_AREANAME='" + areaName + "'";

            object obj1 = DBdb2.RunSingle(sql, out errMsg);

            if (obj.ToString() == "0" && obj1.ToString() == "0")
            {
                sql = "select T_AREAID from T_BASE_AREA order by ID_KEY desc FETCH FIRST 1 ROWS ONLY";

                obj = DBdb2.RunSingle(sql, out errMsg);

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

                sql = @"insert into T_BASE_AREA (T_AREAID,T_AREANAME,T_AREACD) values('"
                      + count + "','"
                      + areaName + "','"
                      + areaCd + "')";

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

                if (errMsg == "")
                {
                    info = "新增区域成功!";
                }
                else
                {
                    info = "新增区域失败!";
                }
            }
            else
            {
                info = "射频卡编码和区域名称已存在";
            }

            obj = new
            {
                msg = info
            };
            string result = JsonConvert.SerializeObject(obj);

            Response.Write(result);
            Response.End();
        }
コード例 #2
0
ファイル: DALManRoute.cs プロジェクト: paddy235/YCJN
        /// <summary>
        /// 新建线路
        /// </summary>
        /// <param name="lName">线路名称</param>
        /// <param name="lType">线路类型</param>
        /// <param name="lGw">线路岗位</param>
        /// <param name="lPID">线路父ID</param>
        public bool AddLineInfo(string lName, string lType, string lGw, string lPID, out string errMsg)
        {
            int    count = 1;
            object obj   = null;
            bool   flag  = false;

            sql = "select * from T_BASE_ROUTE as b inner join T_INFO_ROUTE as i on b.T_ROUTEID=i.T_NODEID where i.T_NODEKEY='" + lPID + "'";

            DataRow drIS = DBdb2.RunDataRow(sql, out errMsg);

            if (drIS == null)
            {
                sql = "select * from T_BASE_ROUTE where T_ROUTENANME='" + lName + "'";

                DataRow dr = DBdb2.RunDataRow(sql, out errMsg);

                if (dr == null)
                {
                    int countBase = 1;

                    sql = "select T_ROUTEID from T_BASE_ROUTE order by ID_KEY DESC fetch first 1 rows only ";// "select * from T_BASE_ROUTE where T_ROUTENAME='" + lName + "'";

                    obj = DBdb2.RunSingle(sql, out errMsg);

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

                    sql = "select T_NODEKEY from T_INFO_ROUTE 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;
                    }

                    sql = "insert into T_BASE_ROUTE (T_ROUTEID,T_ROUTENAME,T_ORGID,I_TYPE) values ('" + countBase + "','" + lName + "','" + lGw + "'," + lType + ")";
                    string sql1 = "insert into T_INFO_ROUTE (T_NODEID,T_NODEKEY,T_PARAENTID,T_DESC) values ('" + countBase + "','" + count.ToString() + "','" + lPID + "','XL')";

                    flag = DBdb2.RunNonQuery(sql, out errMsg);
                    DBdb2.RunNonQuery(sql1, out errMsg);
                }
                else
                {
                    errMsg = "此线路已被添加!";
                }
            }
            else
            {
                errMsg = "线路下不允许在新建线路!";
            }
            return(flag);
        }
コード例 #3
0
ファイル: DALManRoute.cs プロジェクト: paddy235/YCJN
        public string RetStatusBySID(string sid)
        {
            object obj = null;
            string res = "";

            if (sid != "")
            {
                sql = "select T_STATUSDESC from T_BASE_STATUS where I_STATUSID=" + sid;
                obj = DBdb2.RunSingle(sql, out errMsg);

                if (obj != null)
                {
                    res = obj.ToString();
                }
            }

            return(res);
        }
コード例 #4
0
ファイル: DALManRoute.cs プロジェクト: paddy235/YCJN
        /// <summary>
        /// 设备表判断是否有字节点
        /// </summary>
        /// <param name="dID0"></param>
        /// <returns></returns>
        public bool RetGetNodeBy(string dID)
        {
            bool flag = false;

            sql = "select count(*) from T_BASE_DEVICE where T_PARENTID='" + dID + "'";

            object obj = DBdb2.RunSingle(sql, out errMsg);

            if (obj != null && obj.ToString() != "")
            {
                if (int.Parse(obj.ToString()) > 0)
                {
                    flag = true;
                }
            }

            return(flag);
        }
コード例 #5
0
ファイル: DALManRoute.cs プロジェクト: paddy235/YCJN
        /// <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;

            //添加 T_INFO_ROUTE 信息
            sql = "select T_NODEKEY from T_INFO_ROUTE 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;
            }

            sql = "insert into T_INFO_ROUTE (T_NODEID,T_NODEKEY,T_PARAENTID) values ('1','" + count + "','" + nodeKey + "')";

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

            if (flag == true)
            {
                sql = "select T_NODEID from T_INFO_ROUTE where T_NODEKEY='" + nodeKey + "'";

                obj = DBdb2.RunSingle(sql, out errMsg);

                if (obj != null && obj.ToString() != "")
                {
                    sql  = "insert into T_BASE_ITEM ";
                    sql += "(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 += "('" + itemBw + "','" + itemDesc + "','" + itemContent + "','" + itemType + "'," + itemStatus + ",'" + itemObserve + "','" + itemUnit + "'," + double.Parse(itemLower) + "," + double.Parse(itemUpper) + "," + int.Parse(itemSpectrum) + ",'" + obj.ToString() + "','" + 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)
                    {
                        //调用接口生成任务
                        //ManageQuestcomplete(string[] routeId, string[] area, string[] deviceId, string[] itemId, string[] judge, string[] sTimes, string[] type, string[] count, string[] deviceState, string[] state)
                        string[] route    = new string[1];
                        string[] area     = new string[1];
                        string[] device   = new string[1];
                        string[] item     = new string[1];
                        string[] judge    = new string[1]; //操作类型:创建点检项关系 删除点检项关系 编辑点检项  编辑设备状态
                        string[] sTimes   = new string[1];
                        string[] type     = new string[1];
                        string[] count1   = new string[1];
                        string[] devState = new string[1];
                        string[] state    = new string[1];

                        DataRow drRou  = null;
                        DataRow drDev  = null;
                        DataRow drArea = null;

                        sql = "SELECT T_NODEID,T_PARAENTID FROM T_INFO_ROUTE where T_NODEKEY='" + nodeKey + "'";

                        drDev = DBdb2.RunDataRow(sql, out errMsg);

                        if (drDev != null)
                        {
                            sql = "SELECT T_NODEID,T_PARAENTID FROM T_INFO_ROUTE where T_NODEKEY='" + drDev["T_PARAENTID"] + "'";

                            drArea = DBdb2.RunDataRow(sql, out errMsg);

                            if (drArea != null)
                            {
                                sql = "SELECT T_NODEID,T_PARAENTID FROM T_INFO_ROUTE where T_NODEKEY='" + drArea["T_PARAENTID"] + "' and T_DESC='XL'";

                                drRou = DBdb2.RunDataRow(sql, out errMsg);
                            }

                            route[0]    = drRou["T_NODEID"].ToString();
                            area[0]     = drArea["T_NODEID"].ToString();
                            device[0]   = drDev["T_NODEID"].ToString();
                            item[0]     = "1";           //itemID;
                            judge[0]    = "0";           //操作类型:创建点检项关系 0 删除点检项关系 1 编辑点检项 2  编辑设备状态3
                            sTimes[0]   = itemStartTime; //T_STARTTIME
                            type[0]     = itemPerType;   //
                            count1[0]   = itemPerValue;
                            devState[0] = itemStatus;
                            state[0]    = itemStatusQJ;
                        }

                        flag = qc.ManageQuestcomplete(route, area, device, item, judge, sTimes, type, count1, devState, state);
                    }
                    else
                    {
                        errMsg = "新建点检项失败!";
                    }
                }
            }
            else
            {
                errMsg = "添加T_INFO_ROUTE表关系错误!";
            }

            return(flag);
        }