Exemple #1
0
        public static StatusReport GetLookOverInfo(string ztCode, string func, string period)
        {
            string condition = period == "day" ?
                               " where (分类 = @分类 and 巡检业务 = @巡检业务 and convert(varchar(8),工作日期,112) = convert(varchar(8),getDate(),112) and 巡检周期 = '日') " :
                               " where (分类 = @分类 and 巡检业务 = @巡检业务 and datediff(day,工作日期 ,getDate()) < 7 and 巡检周期 = '周')";
            string sqlString =
                " SELECT ID, 巡检业务, 巡检对象, 巡检项目, 巡检周期, 巡检时间 " +
                " FROM dbo.基础资料_巡检记录 " +
                condition +
                " order by 巡检对象, 巡检项目, 巡检周期 ";
            DataTable dt = SQLHelper.ExecuteQuery("wyt", sqlString, new SqlParameter("@分类", ztCode), new SqlParameter("@巡检业务", func));

            if (dt.Rows.Count == 0)
            {
                return(new StatusReport().SetFail());
            }
            List <LookOver> loList = new List <LookOver>();

            foreach (DataRow dr in dt.Rows)
            {
                LookOver lo = new LookOver();
                lo.id         = DataTypeHelper.GetStringValue(dr["ID"]);
                lo.business   = DataTypeHelper.GetStringValue(dr["巡检业务"]);
                lo.objectName = DataTypeHelper.GetStringValue(dr["巡检对象"]);
                lo.item       = DataTypeHelper.GetStringValue(dr["巡检项目"]);
                lo.period     = DataTypeHelper.GetStringValue(dr["巡检周期"]);
                string time = DataTypeHelper.GetDateStringValue(dr["巡检时间"]);
                lo.isLook = string.IsNullOrEmpty(time) ?  false : true;
                loList.Add(lo);
            }
            return(new StatusReport(loList.ToArray()));
        }
Exemple #2
0
        public static StatusReport GetLookOverInfo(string ztCode, string func, string route, string name)
        {
            string sqlString =
                " SELECT ID, 巡检业务, 巡检点, 巡检项目, 巡检时间 " +
                " FROM dbo.基础资料_巡检记录 where 分类 = @分类 and 巡检业务 = @巡检业务 and 巡检路线 = @巡检路线 and 巡检人 like '%' + @巡检人 + '%' and 工作日期 = @工作日期 ";
            //condition +
            //" order by 巡检对象, 巡检项目, 巡检周期 ";
            DataTable dt = SQLHelper.ExecuteQuery("wyt", sqlString,
                                                  new SqlParameter("@分类", ztCode),
                                                  new SqlParameter("@巡检业务", func),
                                                  new SqlParameter("@巡检路线", route),
                                                  new SqlParameter("@工作日期", DateTime.Now.Date),
                                                  new SqlParameter("@巡检人", name));

            if (dt.Rows.Count == 0)
            {
                return(new StatusReport().SetFail());
            }
            List <LookOver> loList = new List <LookOver>();

            foreach (DataRow dr in dt.Rows)
            {
                LookOver lo = new LookOver();
                lo.id         = DataTypeHelper.GetStringValue(dr["ID"]);
                lo.business   = DataTypeHelper.GetStringValue(dr["巡检业务"]);
                lo.objectName = DataTypeHelper.GetStringValue(dr["巡检点"]);
                lo.item       = DataTypeHelper.GetStringValue(dr["巡检项目"]);
                //lo.period = DataTypeHelper.GetStringValue(dr["巡检周期"]);
                string time = DataTypeHelper.GetDateStringValue(dr["巡检时间"]);
                lo.isLook = string.IsNullOrEmpty(time) ?  false : true;
                loList.Add(lo);
            }
            return(new StatusReport(loList.ToArray()));
        }