河北专项检查和移动端
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using BLL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
@@ -42,11 +43,11 @@ namespace FineUIPro.Web.HSSE.Check
|
||||
GetButtonPower();
|
||||
this.ItemSelectedList = new List<string>();
|
||||
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
|
||||
//this.drpStates.DataValueField = "Id";
|
||||
//this.drpStates.DataTextField = "Name";
|
||||
//this.drpStates.DataSource = BLL.HSSE_Hazard_HazardRegisterService.GetStatesList(); ;
|
||||
//this.drpStates.DataBind();
|
||||
//Funs.FineUIPleaseSelect(this.drpStates);
|
||||
SetProblemTypes();
|
||||
SetUnitProject();
|
||||
SetResponsibleUnit();
|
||||
this.txtStartTime.Text = DateTime.Today.ToString("yyyy-MM-dd");
|
||||
this.txtEndTime.Text = DateTime.Today.ToString("yyyy-MM-dd");
|
||||
// 绑定表格
|
||||
BindGrid();
|
||||
}
|
||||
@@ -59,69 +60,44 @@ namespace FineUIPro.Web.HSSE.Check
|
||||
{
|
||||
|
||||
|
||||
string strSql = "SELECT a.CheckSpecialCode,(CASE WHEN a.States='2' THEN '已完成' WHEN a.States='1' THEN '待整改' ELSE '待提交' END) AS StatesName,a.CheckTime,b.* FROM Check_CheckSpecial a right join View_CheckSpecialDetail b on a.CheckSpecialId=b.CheckSpecialId WHERE ";
|
||||
string strSql = "SELECT a.InspectionId,a.InspectionCode,a.ProjectId,(SELECT ProjectName FROM Base_Project as p WHERE p.ProjectId = a.ProjectId) as ProjectName, a.PersonResponsible,(SELECT UserName FROM Sys_User as u WHERE u.UserID = a.PersonResponsible) as PersonResponsibleName, (CASE WHEN a.States = '1' THEN '待检查' WHEN a.States = '2' THEN '待审核/整改' WHEN a.States = '3' THEN '已闭环' END ) as Status, a.CheckMan, a.CreateTime, a.ProblemTypeName,b.CompileTime as CheckTime, " +
|
||||
"b.InspectionItemId,b.BeforelUrl,b.AfterUrl, (CASE WHEN b.States = '1'and a.States = '1' THEN '待提交' WHEN a.States = '2' and b.States = '1' THEN '待审核' WHEN a.States = '2' and b.States = '2' THEN '待整改' WHEN a.States = '2' and b.States = '3' THEN '已闭环' WHEN a.States = '3' THEN '已闭环' END) as itemStates," +
|
||||
"a.Place FROM Inspect_InspectionItem as b LEFT JOIN Inspect_Inspection as a on b.InspectionId = a.InspectionId WHERE a.InspectType = '1'";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
|
||||
{
|
||||
strSql += " a.ProjectId = @ProjectId";
|
||||
strSql += "and a.ProjectId = @ProjectId";
|
||||
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtCheckMan.Text.Trim()))
|
||||
{
|
||||
strSql += " AND a.PartInPersons LIKE @CheckMan";
|
||||
strSql += " AND a.CheckMan LIKE @CheckMan";
|
||||
listStr.Add(new SqlParameter("@CheckMan", "%" + this.txtCheckMan.Text.Trim() + "%"));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtType.Text.Trim()))
|
||||
if (this.txtType.SelectedText.Trim() != "请选择" && !string.IsNullOrEmpty(this.txtType.SelectedText.Trim()))
|
||||
{
|
||||
strSql += " AND b.CheckItemName LIKE @Type";
|
||||
listStr.Add(new SqlParameter("@Type", "%" + this.txtType.Text.Trim() + "%"));
|
||||
strSql += " AND a.ProblemTypeName = @Type";
|
||||
listStr.Add(new SqlParameter("@Type", this.txtType.SelectedText.Trim()));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtWorkAreaName.SelectedText) && this.txtWorkAreaName.SelectedText.Trim() != "请选择")
|
||||
{
|
||||
strSql += " AND a.Place = @Place";
|
||||
listStr.Add(new SqlParameter("@Place", this.txtWorkAreaName.SelectedText.Trim()));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtWorkAreaName.Text.Trim()))
|
||||
{
|
||||
strSql += " AND b.CheckAreaName LIKE @WorkAreaName";
|
||||
listStr.Add(new SqlParameter("@WorkAreaName", "%" + this.txtWorkAreaName.Text.Trim() + "%"));
|
||||
}
|
||||
//if (this.ckType.SelectedValue != "0")
|
||||
//{
|
||||
// strSql += " AND CheckCycle=@CheckCycle";
|
||||
// listStr.Add(new SqlParameter("@CheckCycle", this.ckType.SelectedValue));
|
||||
//}
|
||||
if (!string.IsNullOrEmpty(this.txtResponsibilityUnitName.Text.Trim()))
|
||||
{
|
||||
strSql += " AND ResponsibilityUnitName LIKE @ResponsibilityUnitName";
|
||||
listStr.Add(new SqlParameter("@ResponsibilityUnitName", "%" + this.txtResponsibilityUnitName.Text.Trim() + "%"));
|
||||
strSql += " AND a.Place LIKE @Place";
|
||||
listStr.Add(new SqlParameter("@Place", "%" + this.txtWorkAreaName.Text.Trim() + "%"));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(txtStartTime.Text.Trim()))
|
||||
{
|
||||
strSql += " AND CheckTime >= @StartTime";
|
||||
listStr.Add(new SqlParameter("@StartTime", this.txtStartTime.Text.Trim()));
|
||||
strSql += " AND b.CompileTime >= @StartTime";
|
||||
listStr.Add(new SqlParameter("@StartTime", string.Format("{0} {1}", this.txtStartTime.Text.Trim(), "00:00:00")));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtEndTime.Text.Trim()))
|
||||
{
|
||||
strSql += " AND CheckTime <= @EndTime";
|
||||
listStr.Add(new SqlParameter("@EndTime", this.txtEndTime.Text.Trim()));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(txtStartRectificationTime.Text.Trim()))
|
||||
{
|
||||
strSql += " AND RectificationTime >= @StartRectificationTime";
|
||||
listStr.Add(new SqlParameter("@StartRectificationTime", this.txtStartRectificationTime.Text.Trim()));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtEndRectificationTime.Text.Trim()))
|
||||
{
|
||||
strSql += " AND RectificationTime <= @EndRectificationTime";
|
||||
listStr.Add(new SqlParameter("@EndRectificationTime", this.txtEndRectificationTime.Text.Trim()));
|
||||
}
|
||||
|
||||
if (this.drpStates.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
strSql += " AND a.States LIKE @States";
|
||||
listStr.Add(new SqlParameter("@States", "%" + this.drpStates.SelectedValue + "%"));
|
||||
}
|
||||
if (!CommonService.IsMainUnitOrAdmin(this.CurrUser.UserId))
|
||||
{
|
||||
strSql += " AND (UnitId = @ResponsibleUnit OR ProposeUnitId =@SendUnitId)";
|
||||
listStr.Add(new SqlParameter("@ResponsibleUnit", this.CurrUser.UnitId));
|
||||
listStr.Add(new SqlParameter("@SendUnitId", this.CurrUser.UnitId));
|
||||
strSql += " AND b.CompileTime <= @EndTime";
|
||||
listStr.Add(new SqlParameter("@EndTime", string.Format("{0} {1}", this.txtEndTime.Text.Trim(), "23:59:59")));
|
||||
}
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
@@ -134,6 +110,72 @@ namespace FineUIPro.Web.HSSE.Check
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region 问题类型下拉框赋值
|
||||
public void SetProblemTypes()
|
||||
{
|
||||
txtType.DataValueField = "RectifyId";
|
||||
txtType.DataTextField = "RectifyName";
|
||||
List<Model.Technique_Rectify> list = (from x in Funs.DB.Technique_Rectify select x).ToList();
|
||||
list.Insert(0, new Model.Technique_Rectify()
|
||||
{
|
||||
RectifyId = "-1",
|
||||
RectifyName = "请选择"
|
||||
});
|
||||
txtType.DataSource = list;
|
||||
txtType.DataBind();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 单位工程下拉框赋值
|
||||
public void SetUnitProject()
|
||||
{
|
||||
List<Model.WBS_UnitWork> list = new List<Model.WBS_UnitWork>() {
|
||||
new Model.WBS_UnitWork()
|
||||
{
|
||||
UnitWorkId = "-1",
|
||||
UnitWorkName = "请选择"
|
||||
}
|
||||
};
|
||||
if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
|
||||
{
|
||||
list.AddRange((from x in Funs.DB.WBS_UnitWork where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList());
|
||||
}
|
||||
txtWorkAreaName.DataValueField = "UnitWorkId";
|
||||
txtWorkAreaName.DataTextField = "UnitWorkName";
|
||||
txtWorkAreaName.DataSource = list;
|
||||
txtWorkAreaName.DataBind();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 责任单位下拉框赋值
|
||||
public void SetResponsibleUnit()
|
||||
{
|
||||
List<Model.UnitItem> list = new List<Model.UnitItem>() {
|
||||
new Model.UnitItem()
|
||||
{
|
||||
UnitId = "-1",
|
||||
UnitName = "请选择"
|
||||
}
|
||||
};
|
||||
if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
|
||||
{
|
||||
list.AddRange((from x in Funs.DB.Project_ProjectUnit
|
||||
join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
select new Model.UnitItem()
|
||||
{
|
||||
UnitId = y.UnitId,
|
||||
UnitName = y.UnitName
|
||||
}).ToList());
|
||||
}
|
||||
txtResponsibilityUnitName.DataValueField = "UnitId";
|
||||
txtResponsibilityUnitName.DataTextField = "UnitName";
|
||||
txtResponsibilityUnitName.DataSource = list;
|
||||
txtResponsibilityUnitName.DataBind();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 表排序、分页、关闭窗口
|
||||
/// <summary>
|
||||
/// 分页
|
||||
@@ -204,10 +246,10 @@ namespace FineUIPro.Web.HSSE.Check
|
||||
return;
|
||||
}
|
||||
string RegistrationId = Grid1.SelectedRowID;
|
||||
var registration = BLL.HSSE_Hazard_HazardRegisterService.GetHazardRegisterByHazardRegisterId(RegistrationId);
|
||||
if (registration != null)
|
||||
|
||||
if (RegistrationId != null)
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("HiddenRectificationView.aspx?HazardRegisterId={0}", RegistrationId, "查看 - ")));
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CheckSpecialView.aspx?InspectionItemId={0}", RegistrationId, "查看 - ")));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -385,10 +427,7 @@ namespace FineUIPro.Web.HSSE.Check
|
||||
}
|
||||
}
|
||||
}
|
||||
if (e.CommandName == "attchUrl")
|
||||
{
|
||||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/CheckSpecial&menuId={1}&edit=1&type=-1", RegistrationId, BLL.Const.ProjectCheckSpecialMenuId)));
|
||||
}
|
||||
|
||||
if (e.CommandName == "del")
|
||||
{
|
||||
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.HSSE_HiddenRectificationListMenuId, BLL.Const.BtnDelete))
|
||||
@@ -419,135 +458,36 @@ namespace FineUIPro.Web.HSSE.Check
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 删除
|
||||
/// <summary>
|
||||
/// 右键删除事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnMenuDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.HSSE_HiddenRectificationListMenuId, BLL.Const.BtnDelete))
|
||||
{
|
||||
if (Grid1.SelectedRowIndexArray.Length > 0)
|
||||
{
|
||||
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
|
||||
{
|
||||
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
|
||||
Model.HSSE_Hazard_HazardRegister hazardRegister = BLL.HSSE_Hazard_HazardRegisterService.GetHazardRegisterByHazardRegisterId(rowID);
|
||||
if (hazardRegister.States == Const.State_3 || this.CurrUser.UserId == BLL.Const.hfnbdId) //待整改
|
||||
{
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, hazardRegister.HazardCode, hazardRegister.HazardRegisterId, BLL.Const.HSSE_HiddenRectificationListMenuId, BLL.Const.BtnDelete);
|
||||
BLL.HSSE_Hazard_HazardRegisterService.DeleteHazardRegisterByHazardRegisterId(rowID);
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("已闭环,无法删除!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
}
|
||||
BindGrid();
|
||||
ShowNotify("删除成功!", MessageBoxIcon.Success);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 格式化字符串
|
||||
/// <summary>
|
||||
/// 获取整改前图片
|
||||
/// </summary>
|
||||
/// <param name="registrationId"></param>
|
||||
/// <returns></returns>
|
||||
protected string ConvertImageUrl(object registrationId)
|
||||
{
|
||||
string url = string.Empty;
|
||||
if (registrationId != null)
|
||||
{
|
||||
var registration = BLL.HSSE_Hazard_HazardRegisterService.GetHazardRegisterByHazardRegisterId(registrationId.ToString());
|
||||
if (registration != null)
|
||||
{
|
||||
url = BLL.UploadAttachmentService.ShowAttachment("../../", registration.ImageUrl);
|
||||
}
|
||||
}
|
||||
return url;
|
||||
}
|
||||
protected string ConvertProblemTypes(object registrationId)
|
||||
{
|
||||
string url = string.Empty;
|
||||
if (registrationId != null)
|
||||
{
|
||||
if (registrationId.ToString() == "1")
|
||||
{
|
||||
return "日常巡检";
|
||||
}
|
||||
else if (registrationId.ToString() == "2")
|
||||
{
|
||||
return "专项检查";
|
||||
}
|
||||
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取整改前图片(放于Img中)
|
||||
/// </summary>
|
||||
/// <param name="registrationId"></param>
|
||||
/// <returns></returns>
|
||||
protected string ConvertImageUrlByImage(object registrationId)
|
||||
{
|
||||
string url = string.Empty;
|
||||
if (registrationId != null)
|
||||
{
|
||||
var registration = BLL.HSSE_Hazard_HazardRegisterService.GetHazardRegisterByHazardRegisterId(registrationId.ToString());
|
||||
if (registration != null)
|
||||
{
|
||||
url = BLL.UploadAttachmentService.ShowImage("../../", registration.ImageUrl);
|
||||
}
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取整改后图片
|
||||
/// </summary>
|
||||
/// <param name="registrationId"></param>
|
||||
/// <returns></returns>
|
||||
#region 整改后图片
|
||||
protected string ConvertImgUrl(object registrationId)
|
||||
{
|
||||
string url = string.Empty;
|
||||
if (registrationId != null)
|
||||
{
|
||||
var registration = BLL.HSSE_Hazard_HazardRegisterService.GetHazardRegisterByHazardRegisterId(registrationId.ToString());
|
||||
if (registration != null)
|
||||
var imgUrl = Funs.DB.Inspect_InspectionItem.FirstOrDefault(x => x.InspectionItemId == registrationId.ToString()).AfterUrl;
|
||||
if (imgUrl != null)
|
||||
{
|
||||
url = BLL.UploadAttachmentService.ShowAttachment("../../", registration.RectificationImageUrl);
|
||||
url = BLL.UploadAttachmentService.ShowImage(ConfigurationManager.AppSettings["CEMS_IMG_URL"], imgUrl);
|
||||
}
|
||||
}
|
||||
return url;
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 获取整改后图片(放于Img中)
|
||||
/// </summary>
|
||||
/// <param name="registrationId"></param>
|
||||
/// <returns></returns>
|
||||
#region 整改前图片
|
||||
protected string ConvertImgUrlByImage(object registrationId)
|
||||
{
|
||||
string url = string.Empty;
|
||||
if (registrationId != null)
|
||||
{
|
||||
var registration = BLL.HSSE_Hazard_HazardRegisterService.GetHazardRegisterByHazardRegisterId(registrationId.ToString());
|
||||
if (registration != null)
|
||||
var imgUrl = Funs.DB.Inspect_InspectionItem.FirstOrDefault(x => x.InspectionItemId == registrationId.ToString()).BeforelUrl;
|
||||
if (imgUrl != null)
|
||||
{
|
||||
url = BLL.UploadAttachmentService.ShowImage("../../", registration.RectificationImageUrl);
|
||||
url = BLL.UploadAttachmentService.ShowImage(ConfigurationManager.AppSettings["CEMS_IMG_URL"], imgUrl);
|
||||
}
|
||||
}
|
||||
return url;
|
||||
@@ -636,14 +576,6 @@ namespace FineUIPro.Web.HSSE.Check
|
||||
/// <param name="e"></param>
|
||||
protected void TextBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.txtStartRectificationTime.Text.Trim()) && !string.IsNullOrEmpty(this.txtEndRectificationTime.Text.Trim()))
|
||||
{
|
||||
if (Funs.GetNewDateTime(this.txtStartRectificationTime.Text.Trim()) > Funs.GetNewDateTime(this.txtEndRectificationTime.Text.Trim()))
|
||||
{
|
||||
Alert.ShowInTop("开始时间不能大于结束时间!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.BindGrid();
|
||||
}
|
||||
#endregion
|
||||
@@ -666,9 +598,6 @@ namespace FineUIPro.Web.HSSE.Check
|
||||
{
|
||||
hazardRegisterIds = hazardRegisterIds.Substring(0, hazardRegisterIds.LastIndexOf(","));
|
||||
}
|
||||
// PageContext.RegisterStartupScript(Window4.GetShowReference(String.Format("HiddenRectificationPrint.aspx?HazardRegisterIds={0}&CheckType={1}", hazardRegisterIds,"0", "查看 - ")));
|
||||
this.hdRemark.Text = string.Empty;
|
||||
//}
|
||||
}
|
||||
|
||||
#region 获取按钮权限
|
||||
@@ -684,23 +613,7 @@ namespace FineUIPro.Web.HSSE.Check
|
||||
return;
|
||||
}
|
||||
var buttonList = CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HSSE_HiddenRectificationListMenuId);
|
||||
if (buttonList.Count() > 0)
|
||||
{
|
||||
if (buttonList.Contains(Const.BtnAdd))
|
||||
{
|
||||
this.btnNew.Hidden = false;
|
||||
this.btnRectify.Hidden = false;
|
||||
this.btnConfirm.Hidden = false;
|
||||
}
|
||||
if (buttonList.Contains(Const.BtnModify))
|
||||
{
|
||||
this.btnModify.Hidden = false;
|
||||
}
|
||||
if (buttonList.Contains(Const.BtnDelete))
|
||||
{
|
||||
this.btnMenuDelete.Hidden = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
Reference in New Issue
Block a user