/// <summary> /// APP账号信息查询 /// </summary> /// <param name="Data_Tag">查询标记,表示是否全部接收数据;0为全部接收,1为接收未上传数据</param> /// <param name="Error">错误号</param> /// <param name="ErrorMessage">错误信息</param> /// <param name="AccountModel">APP账号信息</param> public void SelectAccount(int Data_Tag, out int Error, out string ErrorMessage, out List <AccountModel> AccountModel) { Error = 0; ErrorMessage = ""; AccountModel = new List <DSTP_DAL.AccountModel>(); string SQLString = "select Account_ID,Account_Name,Account_Password,Account_Time,Name,TEL,Company,Account_Picture,Account_Permission,Last_Operate_Date,Last_Operate_Type,Account_IsUse from Account "; SQLString += " where Account_Permission <> 2 "; if (Data_Tag == 1) { SQLString += " and Sign=1 "; } else if (Data_Tag == 0) { SQLString += " and 1=1 "; } try { DataTable dt = MySQLHelper.ExecuteDataTable(SQLString); if (dt.Rows.Count == 0) { Error = 0; ErrorMessage = "未查询到信息"; } else { AccountModel = ModelConvertHelper <AccountModel> .ConvertToModel(dt); Error = 0; ErrorMessage = ""; } } catch (Exception ex) { Error = 1; ErrorMessage = "数据处理异常,重新尝试"; } }
/// <summary> /// 工程日志上传 /// </summary> /// <param name="RTU_No">RTU编号</param> /// <param name="Construction_Well_ID">井号</param> /// <param name="Start_Date">施工开始时间</param> /// <param name="Start_Time">施工时间</param> /// <param name="End_Time">施工时间</param> /// <param name="Data_Tag">查询标记,表示是否全部接收数据;0为全部接收,1为接收未上传数据</param> /// <param name="Error">错误号</param> /// <param name="ErrorMessage">错误信息</param> /// <param name="ListLog">返回查询到的工程日志数据</param> public void SelectProject_Log(int RTU_No, string Construction_Well_ID, DateTime Start_Date, DateTime Start_Time, DateTime End_Time, int Data_Tag, out int Error, out string ErrorMessage, out List <Project_LogModels> ListLog) { Error = 0; ErrorMessage = ""; ListLog = new List <Project_LogModels>(); //先看看是不是按照工程信息查询工程日志,是则查出工程信息ID,以Start_Date是否为最小日期为标识 string Project_ID = ""; if (Start_Date != DateTime.MinValue) { Project_ID = SelProject_ID(Start_Date, RTU_No, Construction_Well_ID); } //将Start_Time以及End_Time格式标准化 if (Start_Time == End_Time && Start_Time == DateTime.MinValue) { Start_Time = DateTime.MinValue; End_Time = DateTime.MaxValue; } if (Start_Time == End_Time) { End_Time = End_Time.AddDays(1); } string SQLString = "select "; SQLString += "Project_Log_ID,Project_ID,Construction_Time,Pressure,Displacement,Displacement_Acc,Slug_Name,Formula,Events,Last_Operate_Type,Last_Operate_Date "; SQLString += "from Project_Log where "; if (Project_ID != "") { SQLString += "Project_ID=@Project_ID and "; } SQLString += "Construction_Time >= @Start_Time and Construction_Time <= @End_Time and "; if (Data_Tag == 1) { SQLString += " Sign=1 "; } else if (Data_Tag == 0) { SQLString += " 1=1 "; } SQLString += " UNION ALL "; SQLString += "select "; SQLString += "Project_Log_ID,Project_ID,Construction_Time,Pressure,Displacement,Displacement_Acc,Slug_Name,Formula,Events,Last_Operate_Type,Last_Operate_Date "; SQLString += "from project_log_history where "; if (Project_ID != "") { SQLString += "Project_ID=@Project_ID and "; } SQLString += "Construction_Time >= @Start_Time and Construction_Time <= @End_Time and "; if (Data_Tag == 1) { SQLString += " Sign=1 "; } else if (Data_Tag == 0) { SQLString += " 1=1 "; } MySqlParameter[] comParamerer = new MySqlParameter[] { new MySqlParameter("@Project_ID", Project_ID), new MySqlParameter("@Start_Time", Start_Time), new MySqlParameter("@End_Time", End_Time) }; try { DataTable dt = MySQLHelper.ExecuteDataTable(SQLString, comParamerer); if (dt.Rows.Count == 0) { Error = 0; ErrorMessage = "未查询到信息"; } else { ListLog = ModelConvertHelper <Project_LogModels> .ConvertToModel(dt); Error = 0; ErrorMessage = ""; } } catch (Exception ex) { Error = 1; ErrorMessage = "数据处理异常,重新尝试"; } }
/// <summary> /// RTU图片上传 /// </summary> /// <param name="RTU_No">RTU编号</param> /// <param name="Start_Time">检测时间</param> /// <param name="End_Time">检测时间</param> /// <param name="Data_Tag">查询标记,表示是否全部接收数据;0为全部接收,1为接收未上传数据</param> /// <param name="Error">错误号</param> /// <param name="ErrorMessage">错误信息</param> /// <param name="ListRtuData">返回查询到的RTU图片</param> public void SelRtuPic(int RTU_No, DateTime Start_Time, DateTime End_Time, int Data_Tag, out int Error, out string ErrorMessage, out List <RtuPicModel> ListRtuPic) { Error = 0; ErrorMessage = ""; ListRtuPic = new List <RtuPicModel>(); //先将时间标准化 if (Start_Time == End_Time && Start_Time == DateTime.MinValue) { Start_Time = DateTime.MinValue; End_Time = DateTime.MaxValue; } if (Start_Time == End_Time) { End_Time = End_Time.AddDays(1); } string SQLString = "select "; SQLString += "RTU_Pic_ID,"; SQLString += "Pic_Name,"; SQLString += "RTU_No,"; SQLString += "RTU_Pic_Address,"; SQLString += "Detect_Time,"; SQLString += "Upload_Time "; SQLString += "from RTU_Pic where "; if (RTU_No != 0) { SQLString += "RTU_No=@RTU_No and "; } SQLString += "Detect_Time >= @Start_Time and Detect_Time <= @End_Time and "; if (Data_Tag == 1) { SQLString += " Sign=1 "; } else if (Data_Tag == 0) { SQLString += " 1=1 "; } SQLString += " UNION ALL "; SQLString += "select "; SQLString += "RTU_Pic_ID,"; SQLString += "Pic_Name,"; SQLString += "RTU_No,"; SQLString += "RTU_Pic_Address,"; SQLString += "Detect_Time,"; SQLString += "Upload_Time "; SQLString += "from rtu_pic_history where "; if (RTU_No != 0) { SQLString += "RTU_No=@RTU_No and "; } SQLString += "Detect_Time >= @Start_Time and Detect_Time <= @End_Time and "; if (Data_Tag == 1) { SQLString += " Sign=1 "; } else if (Data_Tag == 0) { SQLString += " 1=1 "; } MySqlParameter[] comParamerer = new MySqlParameter[] { new MySqlParameter("@RTU_No", RTU_No), new MySqlParameter("@Start_Time", Start_Time), new MySqlParameter("@End_Time", End_Time) }; try { DataTable dt = MySQLHelper.ExecuteDataTable(SQLString, comParamerer); if (dt.Rows.Count == 0) { Error = 0; ErrorMessage = "未查询到信息"; } else { ListRtuPic = ModelConvertHelper <RtuPicModel> .ConvertToModel(dt); Error = 0; ErrorMessage = ""; } } catch (Exception ex) { Error = 1; ErrorMessage = "数据处理异常,重新尝试"; } }
/// <summary> /// 工程信息查询 /// </summary> /// <param name="RTU_No">RTU编号</param> /// <param name="Construction_Well_ID">井号</param> /// <param name="Start_Time">施工开始时间</param> /// <param name="End_Time">施工结束时间</param> /// <param name="Data_Tag">查询标记,表示是否全部接收数据;0为全部接收,1为接收未上传数据</param> /// <param name="Error">错误号</param> /// <param name="ErrorMessage">错误信息</param> /// <param name="ProjectModel">返回工程信息数据</param> public void SelectProject(int RTU_No, string Construction_Well_ID, DateTime Start_Time, DateTime End_Time, int Data_Tag, out int Error, out string ErrorMessage, out List <ProjectModel> ProjectModel) { Error = 0; ErrorMessage = ""; ProjectModel = new List <DSTP_DAL.ProjectModel>(); string SQLString = "select "; SQLString += "Project_ID,Account_ID,Start_Date,"; SQLString += "Jar_Shape,Jar_Size,Jar_Volume,"; SQLString += "RTU_No,Construction_Name,Construction_Well_ID,Oil_Factory,Area,Place,Company_Name,"; SQLString += "Team_Leader_Name,Team_Leader_Tel,Team_Leader_Picture,"; SQLString += "Team_Worker_Name,Team_Worker_Tel,Team_Worker_Picture,"; SQLString += "Con_Begin_Pic1,Con_Begin_Pic2,Con_Begin_Pic3,Con_Begin_Pic4,Con_Begin_Pic5,Con_Begin_Pic6,Con_Begin_Pic7,Con_Begin_Pic8,Con_Begin_Pic9,"; SQLString += "Con_Begin_OilPressure,Con_Begin_CasingPressure,Con_Begin_Dayinflow,Con_Begin_IsSeparate,Con_Begin_SepPresure,"; SQLString += "End_Date,"; SQLString += "Con_End_OilPressure,Con_End_CasingPressure,Con_End_Dayinflow,CasPre_Cause,Con_End_Pic1,"; SQLString += "Last_Operate_Type,Last_Operate_Date "; SQLString += "from Project where "; if (RTU_No != 0) { SQLString += "RTU_No=@RTU_No and "; } if (Construction_Well_ID != "" && Construction_Well_ID != null) { SQLString += "Construction_Well_ID=@Construction_Well_ID and "; } if (Start_Time == End_Time && Start_Time == DateTime.MinValue) { Start_Time = DateTime.MinValue; End_Time = DateTime.MaxValue; } if (Start_Time == End_Time) { End_Time = End_Time.AddDays(1); } SQLString += "Start_Date >= @Start_Time and Start_Date <= @End_Time and "; if (Data_Tag == 1) { SQLString += " Sign=1 "; } else if (Data_Tag == 0) { SQLString += " 1=1 "; } SQLString += " UNION ALL "; SQLString += "select "; SQLString += "Project_ID,Account_ID,Start_Date,"; SQLString += "Jar_Shape,Jar_Size,Jar_Volume,"; SQLString += "RTU_No,Construction_Name,Construction_Well_ID,Oil_Factory,Area,Place,Company_Name,"; SQLString += "Team_Leader_Name,Team_Leader_Tel,Team_Leader_Picture,"; SQLString += "Team_Worker_Name,Team_Worker_Tel,Team_Worker_Picture,"; SQLString += "Con_Begin_Pic1,Con_Begin_Pic2,Con_Begin_Pic3,Con_Begin_Pic4,Con_Begin_Pic5,Con_Begin_Pic6,Con_Begin_Pic7,Con_Begin_Pic8,Con_Begin_Pic9,"; SQLString += "Con_Begin_OilPressure,Con_Begin_CasingPressure,Con_Begin_Dayinflow,Con_Begin_IsSeparate,Con_Begin_SepPresure,"; SQLString += "End_Date,"; SQLString += "Con_End_OilPressure,Con_End_CasingPressure,Con_End_Dayinflow,CasPre_Cause,Con_End_Pic1,"; SQLString += "Last_Operate_Type,Last_Operate_Date "; SQLString += "from project_history where "; if (RTU_No != 0) { SQLString += "RTU_No=@RTU_No and "; } if (Construction_Well_ID != "" && Construction_Well_ID != null) { SQLString += "Construction_Well_ID=@Construction_Well_ID and "; } if (Start_Time == End_Time && Start_Time == DateTime.MinValue) { Start_Time = DateTime.MinValue; End_Time = DateTime.MaxValue; } if (Start_Time == End_Time) { End_Time = End_Time.AddDays(1); } SQLString += "Start_Date >= @Start_Time and Start_Date <= @End_Time and "; if (Data_Tag == 1) { SQLString += " Sign=1 "; } else if (Data_Tag == 0) { SQLString += " 1=1 "; } MySqlParameter[] comParamerer = new MySqlParameter[] { new MySqlParameter("@RTU_No", RTU_No), new MySqlParameter("@Construction_Well_ID", Construction_Well_ID), new MySqlParameter("@Start_Time", Start_Time), new MySqlParameter("@End_Time", End_Time) }; try { DataTable dt = MySQLHelper.ExecuteDataTable(SQLString, comParamerer); if (dt.Rows.Count == 0) { Error = 0; ErrorMessage = "未查询到信息"; } else { ProjectModel = ModelConvertHelper <ProjectModel> .ConvertToModel(dt); Error = 0; ErrorMessage = ""; } } catch (Exception ex) { Error = 1; ErrorMessage = "数据处理异常,重新尝试"; } }