397 lines
14 KiB
C#
397 lines
14 KiB
C#
using System;
|
|
using System.Linq;
|
|
using BLL;
|
|
|
|
namespace FineUIPro.Web.common.ProjectSet
|
|
{
|
|
public partial class ProjectSysSet : PageBase
|
|
{
|
|
#region 页面加载
|
|
/// <summary>
|
|
/// 页面加载
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
GetButtonPower();
|
|
this.drpProjectId.DataTextField = "ProjectCode";
|
|
this.drpProjectId.DataValueField = "ProjectId";
|
|
this.drpProjectId.DataSource = BLL.Base_ProjectService.GetOnProjectListByUserId(this.CurrUser.UserId, "1");
|
|
this.drpProjectId.DataBind();
|
|
Funs.FineUIPleaseSelect(this.drpProjectId);
|
|
InitTreeMenu();
|
|
Show(this.CurrUser.LoginProjectId);
|
|
}
|
|
}
|
|
|
|
protected void drpProjectId_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
this.InitTreeMenu();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 树加载
|
|
/// </summary>
|
|
private void InitTreeMenu()
|
|
{
|
|
this.trWBS.Nodes.Clear();
|
|
this.trWBS.ShowBorder = false;
|
|
this.trWBS.ShowHeader = false;
|
|
this.trWBS.EnableIcons = true;
|
|
this.trWBS.AutoScroll = true;
|
|
this.trWBS.EnableSingleClickExpand = true;
|
|
|
|
TreeNode rootProjectNode1 = new TreeNode();
|
|
rootProjectNode1.Text = "管道安装";
|
|
rootProjectNode1.NodeID = "1";
|
|
rootProjectNode1.Expanded = true;
|
|
this.trWBS.Nodes.Add(rootProjectNode1);
|
|
|
|
TreeNode rootProjectNode2 = new TreeNode();
|
|
rootProjectNode2.Text = "压力容器";
|
|
rootProjectNode2.NodeID = "2";
|
|
rootProjectNode1.Expanded = true;
|
|
this.trWBS.Nodes.Add(rootProjectNode2);
|
|
|
|
BoundTree(rootProjectNode1.Nodes, "1");
|
|
BoundTree(rootProjectNode2.Nodes, "2");
|
|
}
|
|
|
|
private void BoundTree(TreeNodeCollection nodes, string projectSoft)
|
|
{
|
|
var projects = (from x in Funs.DB.Base_Project where x.ProjectSoft == projectSoft orderby x.ProjectCode descending select x).ToList();
|
|
if (this.drpProjectId.SelectedValue != null && this.drpProjectId.SelectedValue != "null" && projectSoft == "1")
|
|
{
|
|
projects = projects.Where(e => e.ProjectId == this.drpProjectId.SelectedValue).ToList();
|
|
}
|
|
if (projects.Count() > 0)
|
|
{
|
|
TreeNode tn = null;
|
|
foreach (var q in projects)
|
|
{
|
|
tn = new TreeNode();
|
|
tn.Text = q.ProjectCode + "-" + q.ProjectName;
|
|
tn.NodeID = q.ProjectId;
|
|
tn.EnableClickEvent = true;
|
|
nodes.Add(tn);
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region Tree点击事件
|
|
/// <summary>
|
|
/// Tree点击事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void trWBS_NodeCommand(object sender, TreeCommandEventArgs e)
|
|
{
|
|
string projectId = this.trWBS.SelectedNodeID;
|
|
Show(projectId);
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 判断按钮权限
|
|
/// <summary>
|
|
/// 判断按钮权限
|
|
/// </summary>
|
|
private void GetButtonPower()
|
|
{
|
|
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.SysSetMenuId, Const.BtnSave))
|
|
{
|
|
this.btnSave.Hidden = false;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 提交按钮
|
|
/// <summary>
|
|
/// 提交按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
string projectId = this.trWBS.SelectedNodeID;
|
|
if (projectId == "0" || string.IsNullOrEmpty(projectId))
|
|
{
|
|
ShowNotify("请选择项目!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
|
|
// 焊接
|
|
Model.Project_Sys_Set dayReport = BLL.Project_SysSetService.GetSysSetBySetId("1", projectId);
|
|
Model.Project_Sys_Set point = BLL.Project_SysSetService.GetSysSetBySetId("2", projectId);
|
|
Model.Project_Sys_Set trust = BLL.Project_SysSetService.GetSysSetBySetId("3", projectId);
|
|
Model.Project_Sys_Set pdms = BLL.Project_SysSetService.GetSysSetBySetId("4", projectId);
|
|
Model.Project_Sys_Set batch = BLL.Project_SysSetService.GetSysSetBySetId("5", projectId);
|
|
Model.Project_Sys_Set equipment = BLL.Project_SysSetService.GetSysSetBySetId("6", projectId);
|
|
if (this.ckbPdms.Checked)
|
|
{
|
|
pdms.IsAuto = true;
|
|
}
|
|
else
|
|
{
|
|
pdms.IsAuto = false;
|
|
}
|
|
|
|
if (ckbDayReport.Checked)
|
|
{
|
|
dayReport.IsAuto = true;
|
|
}
|
|
else
|
|
{
|
|
dayReport.IsAuto = false;
|
|
}
|
|
|
|
if (ckbPoint.Checked)
|
|
{
|
|
point.IsAuto = true;
|
|
}
|
|
else
|
|
{
|
|
point.IsAuto = false;
|
|
}
|
|
|
|
if (robStandard.SelectedValue == "1")
|
|
{
|
|
trust.IsAuto = true;
|
|
trust.SetValue = null;
|
|
}
|
|
else if (robStandard.SelectedValue == "2")
|
|
{
|
|
trust.IsAuto = false;
|
|
trust.SetValue = null;
|
|
}
|
|
else
|
|
{
|
|
trust.IsAuto = null;
|
|
trust.SetValue = robStandard.SelectedValue;
|
|
}
|
|
string lists = string.Empty;
|
|
if (cb1.Checked)
|
|
{
|
|
lists += "1|";
|
|
}
|
|
if (cb2.Checked)
|
|
{
|
|
lists += "2|";
|
|
}
|
|
if (cb3.Checked)
|
|
{
|
|
lists += "3|";
|
|
}
|
|
if (cb4.Checked)
|
|
{
|
|
lists += "4|";
|
|
}
|
|
if (cb5.Checked)
|
|
{
|
|
lists += "5|";
|
|
}
|
|
if (cb6.Checked)
|
|
{
|
|
lists += "6|";
|
|
}
|
|
if (cb7.Checked)
|
|
{
|
|
lists += "7|";
|
|
}
|
|
if (cb8.Checked)
|
|
{
|
|
lists += "8|";
|
|
}
|
|
if (cb9.Checked)
|
|
{
|
|
lists += "9|";
|
|
}
|
|
if (cb10.Checked)
|
|
{
|
|
lists += "10|";
|
|
}
|
|
if (cb11.Checked)
|
|
{
|
|
lists += "11|";
|
|
}
|
|
if (!string.IsNullOrEmpty(lists))
|
|
{
|
|
lists = lists.Substring(0, lists.LastIndexOf('|'));
|
|
batch.IsAuto = true;
|
|
batch.SetValue = lists;
|
|
}
|
|
|
|
BLL.Project_SysSetService.UpdateSet(dayReport);
|
|
BLL.Project_SysSetService.UpdateSet(point);
|
|
BLL.Project_SysSetService.UpdateSet(pdms);
|
|
BLL.Project_SysSetService.UpdateSet(trust);
|
|
BLL.Project_SysSetService.UpdateSet(batch);
|
|
if (equipment == null)
|
|
{
|
|
Model.Project_Sys_Set set = new Model.Project_Sys_Set();
|
|
set.SetId = "6";
|
|
set.ProjectId = projectId;
|
|
set.SetName = "硬度检测设备";
|
|
set.IsAuto = true;
|
|
if (this.drpEquipment.SelectedValue != BLL.Const._Null)
|
|
{
|
|
set.SetValue = this.drpEquipment.SelectedValue;
|
|
}
|
|
BLL.Project_SysSetService.AddSet(set);
|
|
}
|
|
else
|
|
{
|
|
if (this.drpEquipment.SelectedValue != BLL.Const._Null)
|
|
{
|
|
equipment.SetValue = this.drpEquipment.SelectedValue;
|
|
}
|
|
BLL.Project_SysSetService.UpdateSet(equipment);
|
|
}
|
|
this.Show(projectId);
|
|
|
|
BLL.Sys_LogService.AddLog(BLL.Const.System_1, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "提交项目环境设置");
|
|
Alert.ShowInTop("提交成功!", MessageBoxIcon.Success);
|
|
}
|
|
#endregion
|
|
|
|
#region 页面呈现
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
private void Show(string projectId)
|
|
{
|
|
this.drpEquipment.DataTextField = "EquipmentCode";
|
|
this.drpEquipment.DataValueField = "EquipmentId";
|
|
this.drpEquipment.DataSource = BLL.HJGL_EquipmentService.GetEquipmentList();
|
|
this.drpEquipment.DataBind();
|
|
Funs.FineUIPleaseSelect(this.drpEquipment);
|
|
var q = from x in BLL.Funs.DB.Project_Sys_Set where x.ProjectId == projectId select x;
|
|
if (q.Count() > 0)
|
|
{
|
|
foreach (var s in q)
|
|
{
|
|
if (s.SetId == "1")
|
|
{
|
|
if (s.IsAuto == true)
|
|
{
|
|
this.ckbDayReport.Checked = true;
|
|
}
|
|
else
|
|
{
|
|
this.ckbDayReport.Checked = false;
|
|
}
|
|
}
|
|
else if (s.SetId == "2")
|
|
{
|
|
if (s.IsAuto == true)
|
|
{
|
|
this.ckbPoint.Checked = true;
|
|
}
|
|
else
|
|
{
|
|
this.ckbPoint.Checked = false;
|
|
}
|
|
}
|
|
else if (s.SetId == "3")
|
|
{
|
|
if (s.IsAuto == true)
|
|
{
|
|
this.robStandard.SelectedValue = "1";
|
|
}
|
|
if (s.IsAuto == false)
|
|
{
|
|
this.robStandard.SelectedValue = "2";
|
|
}
|
|
if (s.SetValue == "3")
|
|
{
|
|
this.robStandard.SelectedValue = "3";
|
|
}
|
|
if (s.SetValue == "4")
|
|
{
|
|
this.robStandard.SelectedValue = "4";
|
|
}
|
|
}
|
|
else if (s.SetId == "4")
|
|
{
|
|
if (s.IsAuto == true)
|
|
{
|
|
this.ckbPdms.Checked = true;
|
|
}
|
|
else
|
|
{
|
|
this.ckbPdms.Checked = false;
|
|
}
|
|
}
|
|
else if (s.SetId == "5")
|
|
{
|
|
cb4.Checked = false;
|
|
cb5.Checked = false;
|
|
cb6.Checked = false;
|
|
cb7.Checked = false;
|
|
cb8.Checked = false;
|
|
cb9.Checked = false;
|
|
cb10.Checked = false;
|
|
cb11.Checked = false;
|
|
var lists = s.SetValue.Split('|');
|
|
foreach (var item in lists)
|
|
{
|
|
if (item == "1")
|
|
{
|
|
cb1.Checked = true;
|
|
}
|
|
else if (item == "2")
|
|
{
|
|
cb2.Checked = true;
|
|
}
|
|
else if (item == "3")
|
|
{
|
|
cb3.Checked = true;
|
|
}
|
|
else if (item == "4")
|
|
{
|
|
cb4.Checked = true;
|
|
}
|
|
else if (item == "5")
|
|
{
|
|
cb5.Checked = true;
|
|
}
|
|
else if (item == "6")
|
|
{
|
|
cb6.Checked = true;
|
|
}
|
|
else if (item == "7")
|
|
{
|
|
cb7.Checked = true;
|
|
}
|
|
else if (item == "8")
|
|
{
|
|
cb8.Checked = true;
|
|
}
|
|
else if (item == "9")
|
|
{
|
|
cb9.Checked = true;
|
|
}
|
|
else if (item == "10")
|
|
{
|
|
cb10.Checked = true;
|
|
}
|
|
else if (item == "11")
|
|
{
|
|
cb11.Checked = true;
|
|
}
|
|
}
|
|
}
|
|
else if (s.SetId == "6")
|
|
{
|
|
this.drpEquipment.SelectedValue = s.SetValue;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
} |