532 lines
19 KiB
C#
532 lines
19 KiB
C#
using BLL;
|
|
using Model;
|
|
using Newtonsoft.Json.Linq;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Data.Linq.SqlClient;
|
|
using System.Data.SqlClient;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
|
|
namespace FineUIPro.Web.Customization.CNCCG.HSSE.Problem
|
|
{
|
|
public partial class ProblemReplyManagerEdit : PageBase
|
|
{
|
|
#region 定义项
|
|
/// <summary>
|
|
/// 主键
|
|
/// </summary>
|
|
public string ProNoticeId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["ProNoticeId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["ProNoticeId"] = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
///受检单位负责人签名附件路径
|
|
/// </summary>
|
|
public string SignatureUrl
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["SignatureUrl"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["SignatureUrl"] = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 检查组签名附件路径
|
|
/// </summary>
|
|
public string SignatureUrl1
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["SignatureUrl1"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["SignatureUrl1"] = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 复查人签名附件路径
|
|
/// </summary>
|
|
public string SignatureUrl2
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["SignatureUrl2"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["SignatureUrl2"] = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 分管领导签名附件路径
|
|
/// </summary>
|
|
public string SignatureUrl3
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["SignatureUrl3"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["SignatureUrl3"] = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 类型 1查看
|
|
/// </summary>
|
|
public string Types
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["Types"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["Types"] = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 定义集合
|
|
/// </summary>
|
|
private static List<ProblemNoticeItems> details = new List<ProblemNoticeItems>();
|
|
#endregion
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
|
ProNoticeId = Request.Params["ProNoticeId"];
|
|
Types = Request.Params["Type"];
|
|
if (!string.IsNullOrEmpty(ProNoticeId))
|
|
{
|
|
var model = Funs.DB.Problem_Notice.FirstOrDefault(x => x.ProNoticeId == ProNoticeId);
|
|
if (model != null)
|
|
{
|
|
txtProjectName.Text = BLL.ProjectService.GetProjectByProjectId(model.ProjectId).ProjectName;
|
|
//受检单位负责人签名
|
|
if (!string.IsNullOrEmpty(model.TestedUnitManSignature))
|
|
{
|
|
this.SignatureUrl = model.TestedUnitManSignature;
|
|
this.Image2.ImageUrl = "~/" + this.SignatureUrl;
|
|
|
|
}
|
|
txtTestedUnitManOpinions.Text = model.TestedUnitManOpinions;
|
|
//复查人签名
|
|
if (!string.IsNullOrEmpty(model.ReviewSignature))
|
|
{
|
|
this.SignatureUrl2 = model.ReviewSignature;
|
|
this.Image3.ImageUrl = "~/" + this.SignatureUrl2;
|
|
|
|
}
|
|
txtReviewOpinions.Text = model.ReviewOpinions;
|
|
//分管领导签名
|
|
if (!string.IsNullOrEmpty(model.LeaderSignature))
|
|
{
|
|
this.SignatureUrl3 = model.LeaderSignature;
|
|
this.Image4.ImageUrl = "~/" + this.SignatureUrl3;
|
|
|
|
}
|
|
txtLeaderOpinions.Text = model.LeaderOpinions;
|
|
//检查组签名
|
|
if (!string.IsNullOrEmpty(model.InspectionUnitSignature))
|
|
{
|
|
this.SignatureUrl1 = model.InspectionUnitSignature;
|
|
this.Image1.ImageUrl = "~/" + this.SignatureUrl1;
|
|
|
|
}
|
|
txtInspectionUnitOpinions.Text = model.InspectionUnitOpinions;
|
|
//根据状态隐藏字段
|
|
if (model.State=="3")
|
|
{
|
|
sjdwFr.Hidden = false;
|
|
fileSignature.Hidden = true;
|
|
txtTestedUnitManOpinions.Readonly = true;
|
|
fcrFr.Hidden = false;
|
|
}
|
|
else if (model.State== "4")
|
|
{
|
|
sjdwFr.Hidden = false;
|
|
fileSignature.Hidden = true;
|
|
txtTestedUnitManOpinions.Readonly = true;
|
|
fcrFr.Hidden = false;
|
|
fileSignature2.Hidden = true;
|
|
txtReviewOpinions.Readonly = true;
|
|
|
|
ffgldFr.Hidden = false;
|
|
}
|
|
else if (model.State=="5")
|
|
{
|
|
sjdwFr.Hidden = false;
|
|
fileSignature.Hidden = true;
|
|
txtTestedUnitManOpinions.Readonly = true;
|
|
fcrFr.Hidden = false;
|
|
fileSignature2.Hidden = true;
|
|
txtReviewOpinions.Readonly = true;
|
|
ffgldFr.Hidden = false;
|
|
fileSignature3.Hidden = true;
|
|
txtLeaderOpinions.Readonly = true;
|
|
|
|
jczFr.Hidden = false;
|
|
}
|
|
|
|
#region 加载检查项
|
|
var strSql = @"select F.ProNoticeCId,F.QueDescribe,F.ReSituation,F.QueType as QueTypeName,F.RiskLevel as RiskLevelName
|
|
,F.SortIndex from Problem_Notice_C F
|
|
|
|
where ProNoticeId='" + model.ProNoticeId + "' order by SortIndex";
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
|
|
Grid1.RecordCount = tb.Rows.Count;
|
|
|
|
|
|
var table = this.GetPagedDataTable(Grid1, tb);
|
|
|
|
details = GetList<ProblemNoticeItems>(table);
|
|
|
|
Grid1.DataSource = table;
|
|
Grid1.DataBind();
|
|
#endregion
|
|
}
|
|
}
|
|
if (Types == "1")
|
|
{
|
|
btnSave.Hidden = true;
|
|
btnSubmit.Hidden = true;
|
|
fileSignature.Hidden = true;
|
|
fileSignature1.Hidden = true;
|
|
fileSignature2.Hidden = true;
|
|
fileSignature3.Hidden = true;
|
|
sjdwFr.Hidden = false;
|
|
fcrFr.Hidden = false;
|
|
ffgldFr.Hidden = false;
|
|
jczFr.Hidden = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
#region datable转换list
|
|
public class ProblemNoticeItems
|
|
{
|
|
public string ProNoticeCId { get; set; }
|
|
public string QueDescribe { get; set; }
|
|
public string Requirements { get; set; }
|
|
public string QueTypeName { get; set; }
|
|
public string RiskLevelName { get; set; }
|
|
public DateTime? CheckDatetime { get; set; }
|
|
public string ReDay { get; set; }
|
|
|
|
public int SortIndex { get; set; }
|
|
}
|
|
public List<T> GetList<T>(DataTable table)
|
|
{
|
|
List<T> list = new List<T>();
|
|
T t = default(T);
|
|
PropertyInfo[] propertypes = null;
|
|
string tempName = string.Empty;
|
|
foreach (DataRow row in table.Rows)
|
|
{
|
|
t = Activator.CreateInstance<T>();
|
|
propertypes = t.GetType().GetProperties();
|
|
foreach (PropertyInfo pro in propertypes)
|
|
{
|
|
tempName = pro.Name;
|
|
if (table.Columns.Contains(tempName))
|
|
{
|
|
object value = row[tempName];
|
|
if (!value.ToString().Equals(""))
|
|
{
|
|
pro.SetValue(t, value, null);
|
|
}
|
|
}
|
|
}
|
|
list.Add(t);
|
|
}
|
|
return list.Count == 0 ? null : list;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 上传签名
|
|
/// <summary>
|
|
/// 受检单位负责人签名上传签名
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSignature_Click(object sender, EventArgs e)
|
|
{
|
|
if (fileSignature.HasFile)
|
|
{
|
|
string fileName = fileSignature.ShortFileName;
|
|
if (!ValidateFileType(fileName))
|
|
{
|
|
ShowNotify("无效的文件类型!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
this.SignatureUrl = UploadFileService.UploadAttachment(Funs.RootPath, this.fileSignature, this.SignatureUrl, UploadFileService.ProblemFilePath);
|
|
this.Image2.ImageUrl = "~/" + this.SignatureUrl;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 检查组签名上传签名
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSignature_Click1(object sender, EventArgs e)
|
|
{
|
|
if (fileSignature1.HasFile)
|
|
{
|
|
string fileName = fileSignature1.ShortFileName;
|
|
if (!ValidateFileType(fileName))
|
|
{
|
|
ShowNotify("无效的文件类型!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
this.SignatureUrl1 = UploadFileService.UploadAttachment(Funs.RootPath, this.fileSignature1, this.SignatureUrl1, UploadFileService.ProblemFilePath);
|
|
this.Image1.ImageUrl = "~/" + this.SignatureUrl1;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 复查人签名
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSignature_Click2(object sender, EventArgs e)
|
|
{
|
|
if (fileSignature2.HasFile)
|
|
{
|
|
string fileName = fileSignature2.ShortFileName;
|
|
if (!ValidateFileType(fileName))
|
|
{
|
|
ShowNotify("无效的文件类型!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
this.SignatureUrl2 = UploadFileService.UploadAttachment(Funs.RootPath, this.fileSignature2, this.SignatureUrl2, UploadFileService.ProblemFilePath);
|
|
this.Image3.ImageUrl = "~/" + this.SignatureUrl2;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 分管领导签名
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSignature_Click3(object sender, EventArgs e)
|
|
{
|
|
if (fileSignature3.HasFile)
|
|
{
|
|
string fileName = fileSignature3.ShortFileName;
|
|
if (!ValidateFileType(fileName))
|
|
{
|
|
ShowNotify("无效的文件类型!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
this.SignatureUrl3 = UploadFileService.UploadAttachment(Funs.RootPath, this.fileSignature3, this.SignatureUrl3, UploadFileService.ProblemFilePath);
|
|
this.Image4.ImageUrl = "~/" + this.SignatureUrl3;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 检查项
|
|
|
|
protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
|
|
{
|
|
string itemId = Grid1.DataKeys[e.RowIndex][0].ToString();
|
|
|
|
if (e.CommandName == "attchUrlSee")
|
|
{
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/Problem&menuId={1}&type=-1", itemId, BLL.Const.ProblemNoticeManagerMenuId)));
|
|
}
|
|
else if (e.CommandName == "attchUrl")
|
|
{
|
|
if (Types == "1")
|
|
{
|
|
//整改后照片编辑
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/Problem&menuId={1}&type=-1", itemId + "ZGH", BLL.Const.ProblemNoticeManagerMenuId)));
|
|
}
|
|
else
|
|
{
|
|
//整改后照片编辑
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/Problem&menuId={1}&type=0", itemId + "ZGH", BLL.Const.ProblemNoticeManagerMenuId)));
|
|
}
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 保存
|
|
/// <summary>
|
|
/// 保存
|
|
/// </summary>
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
this.SaveData(Const.BtnSave);
|
|
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 提交
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSubmit_Click(object sender, EventArgs e)
|
|
{
|
|
this.SaveData(Const.BtnSubmit);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 保存提交方法
|
|
/// </summary>
|
|
/// <param name="type"></param>
|
|
private void SaveData(string type)
|
|
{
|
|
var newModel = Funs.DB.Problem_Notice.FirstOrDefault(x => x.ProNoticeId == ProNoticeId);
|
|
Model.Problem_Notice model = new Model.Problem_Notice
|
|
{
|
|
State = newModel.State
|
|
};
|
|
if (type == Const.BtnSubmit)
|
|
{
|
|
model.State =(Convert.ToInt32(newModel.State) + 1).ToString();
|
|
#region 根据状态判断签名是否上传
|
|
if (newModel.State=="2")
|
|
{
|
|
if (string.IsNullOrEmpty(this.SignatureUrl)) {
|
|
ShowNotify("受检单位负责人签名不能为空!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
}
|
|
else if (newModel.State == "3")
|
|
{
|
|
if (string.IsNullOrEmpty(this.SignatureUrl2)) {
|
|
ShowNotify("复查人签名不能为空!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
}
|
|
else if (newModel.State == "4")
|
|
{
|
|
if (string.IsNullOrEmpty(this.SignatureUrl3)) {
|
|
ShowNotify("分管领导签名不能为空!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
}
|
|
else if (newModel.State == "5")
|
|
{
|
|
if (string.IsNullOrEmpty(this.SignatureUrl1)) {
|
|
ShowNotify("检查组签名不能为空!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
|
|
//受检单位负责人签名
|
|
if (!string.IsNullOrEmpty(this.SignatureUrl))
|
|
{
|
|
model.TestedUnitManSignature = SignatureUrl;
|
|
model.TestedUnitManDatetime = DateTime.Now;
|
|
|
|
}
|
|
model.TestedUnitManOpinions = txtTestedUnitManOpinions.Text;
|
|
//复查人签名
|
|
if (!string.IsNullOrEmpty(this.SignatureUrl2))
|
|
{
|
|
model.ReviewSignature = SignatureUrl2;
|
|
model.ReviewDatetime = DateTime.Now;
|
|
|
|
}
|
|
model.ReviewOpinions = txtReviewOpinions.Text;
|
|
//分管领导签名
|
|
if (!string.IsNullOrEmpty(this.SignatureUrl3))
|
|
{
|
|
model.LeaderSignature = SignatureUrl3;
|
|
model.LeaderDatetime = DateTime.Now;
|
|
|
|
}
|
|
model.LeaderOpinions = txtLeaderOpinions.Text;
|
|
//检查组签名
|
|
if (!string.IsNullOrEmpty(this.SignatureUrl1))
|
|
{
|
|
model.InspectionUnitSignature = SignatureUrl1;
|
|
model.InspectionUnitDatetime = DateTime.Now;
|
|
|
|
}
|
|
model.InspectionUnitOpinions = txtInspectionUnitOpinions.Text;
|
|
if (!string.IsNullOrEmpty(this.ProNoticeId))
|
|
{
|
|
model.ProNoticeId = ProNoticeId;
|
|
BLL.ProblemNoticeService.Reply(model);
|
|
BLL.LogService.AddSys_Log(this.CurrUser, model.ProCode, model.ProNoticeId, BLL.Const.ProblemReplyManagerMenuId, BLL.Const.BtnModify);
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("数据有误,请刷新页面", MessageBoxIcon.Error);
|
|
}
|
|
this.SaveDetail(model.ProNoticeId);
|
|
if (type == Const.BtnSubmit)
|
|
{
|
|
ShowNotify("提交成功。", MessageBoxIcon.Success);
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("保存成功。", MessageBoxIcon.Success);
|
|
}
|
|
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
|
}
|
|
|
|
/// <summary>
|
|
/// 保存明细项
|
|
/// </summary>
|
|
private void SaveDetail(string objId)
|
|
{
|
|
List<Model.Problem_Notice_C> detailLists = new List<Model.Problem_Notice_C>();
|
|
JArray teamGroupData = Grid1.GetMergedData();
|
|
foreach (JObject teamGroupRow in teamGroupData)
|
|
{
|
|
JObject values = teamGroupRow.Value<JObject>("values");
|
|
int rowIndex = teamGroupRow.Value<int>("index");
|
|
Model.Problem_Notice_C newDetail = new Model.Problem_Notice_C
|
|
{
|
|
//整改情况
|
|
ReSituation = values.Value<string>("ReSituation"),
|
|
ReSituationTime = DateTime.Now
|
|
};
|
|
if (Grid1.Rows[rowIndex].DataKeys.Length > 0)
|
|
{
|
|
newDetail.ProNoticeCId = Grid1.Rows[rowIndex].DataKeys[0].ToString();
|
|
}
|
|
//循环修改明细
|
|
BLL.ProblemNoticeService.UpdateDetail(newDetail);
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
}
|
|
} |