合并最新

This commit is contained in:
2022-12-20 09:32:32 +08:00
parent 844e9f1488
commit 1abdaa9476
654 changed files with 73563 additions and 9746 deletions
@@ -1,5 +1,4 @@
using BLL;
using Model;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
@@ -39,25 +38,12 @@ namespace FineUIPro.Web.HSSE.Check
ViewState["ProjectId"] = value;
}
}
//public List<View_CheckSpecialDetail> details
//{
// get
// {
// return (List<View_CheckSpecialDetail>)ViewState["details"];
// }
// set
// {
// ViewState["details"] = value;
// }
//}
/// <summary>
/// 定义集合
/// </summary>
private static List<Model.View_CheckSpecialDetail> details = new List<Model.View_CheckSpecialDetail>();
//private static List<Model.View_CheckSpecialDetail> checkSpecialDetails = new List<Model.View_CheckSpecialDetail>();
#endregion
// public List<View_CheckSpecialDetail> details = new List<View_CheckSpecialDetail>();
#region
/// <summary>
/// 加载页面
@@ -74,11 +60,8 @@ namespace FineUIPro.Web.HSSE.Check
this.InitCheckItemSetDropDownList();
this.CheckSpecialId = Request.Params["CheckSpecialId"];
var checkSpecial = Check_CheckSpecialService.GetCheckSpecialByCheckSpecialId(this.CheckSpecialId);
Technique_CheckItemSetService.InitCheckItemSetNameDropDownList(this.drpSupCheckItemSet, "2", "0", false);
if (checkSpecial != null)
{
details.Clear();
this.ProjectId = checkSpecial.ProjectId;
if (this.ProjectId != this.CurrUser.LoginProjectId)
{
@@ -87,7 +70,7 @@ namespace FineUIPro.Web.HSSE.Check
if (!String.IsNullOrEmpty(checkSpecial.CheckType))
{
this.drpType.SelectedValue = checkSpecial.CheckType;
this.rbType.SelectedValue = checkSpecial.CheckType;
}
this.InitCheckItemSetDropDownList();
this.txtCheckSpecialCode.Text = CodeRecordsService.ReturnCodeByDataId(this.CheckSpecialId);
@@ -112,11 +95,10 @@ namespace FineUIPro.Web.HSSE.Check
if (checkSpecialDetails.Count() > 0)
{
this.drpSupCheckItemSet.Readonly = true;
this.drpType.Readonly = true;
this.rbType.Readonly = true;
}
details = checkSpecialDetails;
Grid1.DataSource = details;
Grid1.DataSource = checkSpecialDetails;
Grid1.DataBind();
}
else
@@ -125,54 +107,41 @@ namespace FineUIPro.Web.HSSE.Check
this.txtCheckSpecialCode.Text = CodeRecordsService.ReturnCodeByMenuIdProjectId(BLL.Const.ProjectCheckSpecialMenuId, this.ProjectId, this.CurrUser.UnitId);
this.txtCheckDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
this.drpSupCheckItemSet.SelectedIndex = 0;
this.drpSupCheckItemSet.SelectedIndex = 0;
}
// 删除选中单元格的客户端脚本
string deleteScript = GetDeleteScript();
// 新增数据初始值
JObject defaultObj = new JObject
{
{ "CheckAreaName", "" },
{ "UnitName", "" },
{ "Unqualified", "" },
{ "CheckItemName", "" },
{ "CompleteStatusName", "" },
{ "HandleStepStr", "" },
{ "HiddenHazardTypeName", "" },
{ "Delete", String.Format("<a href=\"javascript:;\" onclick=\"{0}\"><img src=\"{1}\"/></a>", deleteScript, IconHelper.GetResolvedIconUrl(Icon.Delete)) }
};
// 在第一行新增一条数据
btnNew.OnClientClick = Grid1.GetAddNewRecordReference(defaultObj, true);
}
}
#endregion
protected void btnAdd_Click(object sender, EventArgs e)
{
//JObject defaultObj = new JObject
// { { "CheckSpecialDetailId",Guid.NewGuid() },
// { "CheckAreaName", "" },
// { "UnitName", "" },
// { "HSEManage",""},
// { "Unqualified", "" },
// { "attchUrl","上传" },
// {"RiskLevel","" },
// { "CompleteStatusName", "" },
// {"LimitedDate","" },
// { "Suggestions",""},
// { "HandleStepStr", "" },
// { "Delete", String.Format("<a href=\"javascript:;\" onclick=\"{0}\"><img src=\"{1}\"/></a>", deleteScript, IconHelper.GetResolvedIconUrl(Icon.Delete)) }
// };
//details = (from x in Funs.DB.View_CheckSpecialDetail
// where x.CheckSpecialId == this.CheckSpecialId
// orderby x.UnitName, x.SortIndex
// select x).ToList();
if (details == null)
details = new List<View_CheckSpecialDetail>();
View_CheckSpecialDetail d = new View_CheckSpecialDetail();
d.CheckSpecialDetailId = Guid.NewGuid().ToString();
details.Add(d);
Grid1.DataSource= details;
Grid1.DataBind();
// 在第一行新增一条数据
//btnNew.OnClientClick = Grid1.GetAddNewRecordReference(defaultObj, true);
}
/// <summary>
/// 行点击
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
{
string itemId = Grid1.DataKeys[e.RowIndex][0].ToString();
if (e.CommandName == "attchUrl")
{
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/CheckSpecial&menuId={1}&edit=1", itemId, BLL.Const.ProjectCheckSpecialMenuId)));
}
}
/// <summary>
@@ -180,21 +149,11 @@ namespace FineUIPro.Web.HSSE.Check
/// </summary>
private void InitDropDownList()
{
ListItem[] item = new ListItem[4];
item[0] = new ListItem("专项检查", "0");
item[1] = new ListItem("安全周检", "1");
item[2] = new ListItem("安全月检", "2");
item[3] = new ListItem("节前节后安全检查", "3");
this.drpType.DataValueField = "Value";
this.drpType.DataTextField = "Text";
this.drpType.DataSource = item;
this.drpType.DataBind();
//检查组成员
UserService.InitUserDropDownList(this.drpPartInPersons, this.ProjectId, true);
// ConstValue.InitConstNameDropDownList(this.drpHandleStep, ConstValue.Group_HandleStep, true);
ConstValue.InitConstNameDropDownList(this.drpHandleStep, ConstValue.Group_HandleStep, true);
///责任单位
UnitService.InitUnitNameByProjectIdUnitTypeDropDownList(this.drpWorkUnit, this.ProjectId, Const.ProjectUnitType_2, true);
UnitService.InitUnitNameByProjectIdUnitTypeDropDownList(this.drpWorkUnit, this.ProjectId, Const.ProjectUnitType_2, false);
///单位工程
UnitWorkService.InitUnitWorkNameDropDownList(this.drpCheckArea, this.ProjectId, false);
}
@@ -208,7 +167,7 @@ namespace FineUIPro.Web.HSSE.Check
{
Model.Check_CheckSpecial checkSpecial = new Model.Check_CheckSpecial
{
CheckSpecialId = SQLHelper.GetNewID(typeof(Model.Check_CheckSpecial)),
CheckSpecialId = SQLHelper.GetNewID(),
CheckSpecialCode = this.txtCheckSpecialCode.Text.Trim(),
ProjectId = this.ProjectId,
CompileMan=this.CurrUser.UserId,
@@ -251,7 +210,7 @@ namespace FineUIPro.Web.HSSE.Check
/// <param name="e"></param>
protected void btnSubmit_Click(object sender, EventArgs e)
{
if (this.drpType.SelectedValue == "0" && (string.IsNullOrEmpty(this.drpSupCheckItemSet.SelectedValue) || this.drpSupCheckItemSet.SelectedValue == Const._Null))
if (this.rbType.SelectedValue == "0" && (string.IsNullOrEmpty(this.drpSupCheckItemSet.SelectedValue) || this.drpSupCheckItemSet.SelectedValue == Const._Null))
{
ShowNotify("请选择检查类别!", MessageBoxIcon.Warning);
return;
@@ -260,17 +219,7 @@ namespace FineUIPro.Web.HSSE.Check
this.SaveData(Const.BtnSubmit);
}
#endregion
public string ConvertDate(object date)
{
if (date != null)
{
return string.Format("{0:yyyy-MM-dd}", Convert.ToDateTime(date));
}
else
{
return null;
}
}
#region
/// <summary>
/// 保存按钮
@@ -279,7 +228,7 @@ namespace FineUIPro.Web.HSSE.Check
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
if (this.drpType.SelectedValue == "0" && (string.IsNullOrEmpty(this.drpSupCheckItemSet.SelectedValue) || this.drpSupCheckItemSet.SelectedValue == Const._Null))
if (this.rbType.SelectedValue == "0" && (string.IsNullOrEmpty(this.drpSupCheckItemSet.SelectedValue) || this.drpSupCheckItemSet.SelectedValue == Const._Null))
{
ShowNotify("请选择检查类别!", MessageBoxIcon.Warning);
return;
@@ -302,7 +251,7 @@ namespace FineUIPro.Web.HSSE.Check
PartInPersonNames = this.txtPartInPersonNames.Text.Trim(),
CheckTime = Funs.GetNewDateTime(this.txtCheckDate.Text.Trim()),
CompileMan=this.CurrUser.UserId,
CheckType=this.drpType.SelectedValue,
CheckType=this.rbType.SelectedValue,
////单据状态
States = Const.State_0,
};
@@ -323,28 +272,23 @@ namespace FineUIPro.Web.HSSE.Check
checkSpecial.PartInPersonIds = partInPersonIds.Substring(0, partInPersonIds.LastIndexOf(","));
checkSpecial.PartInPersons = partInPersons.Substring(0, partInPersons.LastIndexOf(","));
}
var getCheckItem = Funs.DB.Technique_CheckItemSet.FirstOrDefault(x => x.CheckItemName == this.drpSupCheckItemSet.SelectedValue);
if (getCheckItem != null)
if (!string.IsNullOrEmpty(this.drpSupCheckItemSet.SelectedValue) && this.drpSupCheckItemSet.SelectedValue != Const._Null)
{
checkSpecial.CheckItemSetId = getCheckItem.CheckItemSetId;
checkSpecial.CheckItemSetId = this.drpSupCheckItemSet.SelectedValue;
}
//if (!string.IsNullOrEmpty(this.drpSupCheckItemSet.SelectedValue) && this.drpSupCheckItemSet.SelectedValue != Const._Null)
//{
// checkSpecial.CheckItemSetId = this.drpSupCheckItemSet.SelectedValue;
//}
if (!string.IsNullOrEmpty(this.CheckSpecialId))
{
checkSpecial.CheckSpecialId = this.CheckSpecialId;
Check_CheckSpecialService.UpdateCheckSpecial(checkSpecial);
LogService.AddSys_Log(this.CurrUser, checkSpecial.CheckSpecialCode, checkSpecial.CheckSpecialId, BLL.Const.ProjectCheckSpecialMenuId, BLL.Const.BtnModify);
// Check_CheckSpecialDetailService.DeleteCheckSpecialDetails(this.CheckSpecialId);
Check_CheckSpecialDetailService.DeleteCheckSpecialDetails(this.CheckSpecialId);
}
else
{
checkSpecial.CheckSpecialId = SQLHelper.GetNewID(typeof(Model.Check_CheckSpecial));
this.CheckSpecialId = checkSpecial.CheckSpecialId;
checkSpecial.CompileMan = this.CurrUser.UserId;
Check_CheckSpecialService.AddCheckSpecial(checkSpecial);
LogService.AddSys_Log(this.CurrUser, checkSpecial.CheckSpecialCode, checkSpecial.CheckSpecialId, BLL.Const.ProjectCheckSpecialMenuId, BLL.Const.BtnAdd);
}
@@ -373,28 +317,19 @@ namespace FineUIPro.Web.HSSE.Check
{
JObject values = teamGroupRow.Value<JObject>("values");
int rowIndex = teamGroupRow.Value<int>("index");
string CheckSpecialDetailId = values.Value<string>("CheckSpecialDetailId");
if (string.IsNullOrEmpty(CheckSpecialDetailId))
{
CheckSpecialDetailId = SQLHelper.GetNewID();
}
Model.Check_CheckSpecialDetail newDetail = new Model.Check_CheckSpecialDetail
{
CheckSpecialDetailId = values.Value<string>("CheckSpecialDetailId"),
CheckSpecialDetailId = CheckSpecialDetailId,
CheckSpecialId = this.CheckSpecialId,
CheckContent = values.Value<string>("CheckItemName"),
Unqualified = values.Value<string>("Unqualified"),
Suggestions = values.Value<string>("Suggestions"),
RectifyOpinion = values.Value<string>("RectifyOpinion"),
// WorkArea = values.Value<string>("WorkArea"),
};
if (!string.IsNullOrEmpty(values.Value<string>("RectifyOpinion")))
{
if(values.Value<string>("RectifyOpinion")=="")
newDetail.HandleStep = "";
}
if (!string.IsNullOrEmpty(values.Value<string>("LimitedDate")))
{
newDetail.LimitedDate = values.Value<DateTime>("LimitedDate");
}
var HSE = Funs.DB.Sys_User.FirstOrDefault(x=>x.UserName== values.Value<string>("HSE"));
var getUnit = Funs.DB.Base_Unit.FirstOrDefault(x => x.UnitName == values.Value<string>("UnitName"));
if (getUnit != null)
{
@@ -413,17 +348,36 @@ namespace FineUIPro.Web.HSSE.Check
//{
// newDetail.CheckArea = getUnitWork.UnitWorkId;
//}
if (!string.IsNullOrEmpty(values.Value<string>("HSEManage")))
string[] strs = values.Value<string>("HandleStepStr").Split(',');
string handleStep = string.Empty;
foreach (var item in strs)
{
string hsemange = values.Value<string>("HSEManage").Split('-')[0];
Sys_User user = Funs.DB.Sys_User.FirstOrDefault(x => x.UserCode == hsemange);
if (user != null)
var getHandleStep = Funs.DB.Sys_Const.FirstOrDefault(x => x.GroupId == ConstValue.Group_HandleStep && x.ConstText == item);
if (getHandleStep != null)
{
newDetail.HSEManage = user.UserId;
handleStep += getHandleStep.ConstValue + ",";
}
}
if (!string.IsNullOrEmpty(handleStep))
{
handleStep = handleStep.Substring(0, handleStep.LastIndexOf(","));
}
newDetail.HandleStep = handleStep;
if (newDetail.HandleStep.Contains("1"))
{
if (values.Value<string>("HiddenHazardTypeName") == "较大")
{
newDetail.HiddenHazardType = "2";
}
else if (values.Value<string>("HiddenHazardTypeName") == "重大")
{
newDetail.HiddenHazardType = "3";
}
else
{
newDetail.HiddenHazardType = "1";
}
}
if (values.Value<string>("CompleteStatusName") == "已整改")
{
newDetail.CompleteStatus = true;
@@ -433,41 +387,28 @@ namespace FineUIPro.Web.HSSE.Check
{
newDetail.CompleteStatus = false;
}
var getCheckItem = Funs.DB.HSSE_Hazard_HazardRegisterTypes.FirstOrDefault(x => x.RegisterTypesName == values.Value<string>("CheckItemName") );
var getCheckItem = Funs.DB.Technique_CheckItemSet.FirstOrDefault(x => x.SupCheckItem == this.drpSupCheckItemSet.SelectedValue && x.CheckItemName == newDetail.CheckContent);
if (getCheckItem != null)
{
newDetail.CheckItem = getCheckItem.RegisterTypesId;
newDetail.CheckItem = getCheckItem.CheckItemSetId;
}
newDetail.SortIndex = rowIndex;
if (Grid1.Rows[rowIndex].DataKeys.Length > 0)
{
newDetail.CheckSpecialDetailId = Grid1.Rows[rowIndex].DataKeys[0].ToString();
}
switch (values.Value<string>("RiskLevel"))
{
case "低": newDetail.RiskLevel = "0"; break;
case "一般": newDetail.RiskLevel = "1"; break;
case "较高": newDetail.RiskLevel = "2"; break;
case "高": newDetail.RiskLevel = "3"; break;
}
if (string.IsNullOrEmpty(newDetail.CheckSpecialDetailId))
{
Check_CheckSpecialDetailService.AddCheckSpecialDetail(newDetail);
}
else
{
Check_CheckSpecialDetailService.UpdateCheckSpecialDetail(newDetail);
}
Check_CheckSpecialDetailService.AddCheckSpecialDetail(newDetail);
detailLists.Add(newDetail);
}
if (type == Const.BtnSubmit)
{
var getDails = detailLists.Where(x => x.CompleteStatus == false);
if (getDails.Count() > 0)
{
info = Check_CheckSpecialService.IssueRectification(getDails.ToList(), checkSpecial);
if (getDails.FirstOrDefault(x => x.HandleStep == null) != null)
{
info = "存在待整改问题,没有处理措施!";
}
else
{
info = Check_CheckSpecialService.IssueRectification(getDails.ToList(), checkSpecial);
}
}
else
{
@@ -528,52 +469,11 @@ namespace FineUIPro.Web.HSSE.Check
/// <param name="e"></param>
protected void drpSupCheckItemSet_SelectedIndexChanged(object sender, EventArgs e)
{
//this.drpCheckItem.Items.Clear();
//Technique_CheckItemSetService.InitCheckItemSetNameDropDownList(this.drpCheckItem, "2", this.drpSupCheckItemSet.SelectedValue, false);
this.drpCheckItem.Items.Clear();
Technique_CheckItemSetService.InitCheckItemSetNameDropDownList(this.drpCheckItem, "2", this.drpSupCheckItemSet.SelectedValue, false);
}
protected void drpWorkUnit_SelectedIndexChanged(object sender, EventArgs e)
{
//for (int i = 0; i < this.Grid1.Rows.Count; i++)
//{
// DropDownList drpUnitWork = (DropDownList)Grid1.Rows[i].FindControl("drpUnitWork");
// if(((DropDownList)sender).ID == drpUnitWork.ID)
// {
//DropDownList drpHSE = (DropDownList)Grid1.Rows[i].FindControl("drpHSE");
string unitName = ((DropDownList)sender).SelectedValue;
string id = "";
if(unitName != BLL.Const._Null)
{
var unit = Funs.DB.Base_Unit.FirstOrDefault(x=>x.UnitName == unitName);
if(unit != null)
{
id = unit.UnitId;
}
}
var sysUser = BLL.ProjectUserService.GetProjectUserByUnitidAndProjectId(CurrUser.LoginProjectId, id, Const.HSSEManager);
List<ListItem> lists = new List<ListItem>();
foreach(var item in sysUser)
{
lists.Add(new ListItem(item.UserName, item.UserName));
}
drpHSE.Items.Clear();
drpHSE.DataValueField = "Value";
drpHSE.DataTextField = "Value";
drpHSE.DataSource = lists;
drpHSE.DataBind();
// }
//}
//this.drpHSE.Items.Clear();
//this.drpHSE.DataValueField = "UserId";
//this.drpHSE.DataTextField = "UserId";
//this.drpHSE.DataSource=BLL.ProjectUserService.GetProjectUserByProjectId(CurrUser.LoginProjectId, Const.HSSEManager);
}
protected void drpPartInPersons_SelectedIndexChanged(object sender, EventArgs e)
protected void drpPartInPersons_SelectedIndexChanged(object sender, EventArgs e)
{
this.drpPartInPersons.SelectedValueArray = Funs.RemoveDropDownListNull(this.drpPartInPersons.SelectedValueArray);
@@ -589,26 +489,28 @@ namespace FineUIPro.Web.HSSE.Check
/// </summary>
private void InitCheckItemSetDropDownList()
{
this.drpCheckItem.DataTextField = "RegisterTypesName";
this.drpCheckItem.DataValueField = "RegisterTypesName";
this.drpCheckItem.DataSource = BLL.HSSE_Hazard_HazardRegisterTypesService.GetHazardRegisterTypesList("1"); //安全巡检类型
this.drpCheckItem.DataBind();
//this.drpCheckItem.SelectedValue = null;
ListItem[] item = new ListItem[4];
this.drpSupCheckItemSet.Items.Clear();
this.drpCheckItem.Items.Clear();
if (this.rbType.SelectedValue == "1")
{
this.drpSupCheckItemSet.SelectedIndex = 0;
this.drpSupCheckItemSet.Readonly = true;
Technique_CheckItemSetService.InitCheckItemSetNameDropDownList(this.drpCheckItem, "6", "0", false);
}
else
{
this.drpSupCheckItemSet.Readonly = false;
Technique_CheckItemSetService.InitCheckItemSetDropDownList(this.drpSupCheckItemSet, "2", "0", false);
this.drpSupCheckItemSet.SelectedIndex = 0;
Technique_CheckItemSetService.InitCheckItemSetNameDropDownList(this.drpCheckItem, "2", this.drpSupCheckItemSet.SelectedValue, false);
}
item[0] = new ListItem("低", "低");
item[1] = new ListItem("一般", "一般");
item[2] = new ListItem("较高", "较高");
item[3] = new ListItem("高", "高");
this.drpRiskLevel.DataValueField = "Value";
this.drpRiskLevel.DataTextField = "Text";
this.drpRiskLevel.DataSource = item;
this.drpRiskLevel.DataBind();
}
this.drpCheckItem.SelectedValue = null;
}
protected void drpCheckItem_SelectedIndexChanged(object sender, EventArgs e)
{
// this.drpCheckItem.SelectedValueArray = Funs.RemoveDropDownListNull(this.drpCheckItem.SelectedValueArray);
this.drpCheckItem.SelectedValueArray = Funs.RemoveDropDownListNull(this.drpCheckItem.SelectedValueArray);
}
protected void Grid1_Sort(object sender, GridSortEventArgs e)
@@ -620,10 +522,10 @@ namespace FineUIPro.Web.HSSE.Check
if (checkSpecialDetails.Count() > 0)
{
this.drpSupCheckItemSet.Readonly = true;
this.drpType.Readonly = true;
this.rbType.Readonly = true;
}
details = checkSpecialDetails;
Grid1.DataSource = details;
Grid1.DataSource = checkSpecialDetails;
Grid1.DataBind();
}
}