焊接管理,补充公司级树
This commit is contained in:
@@ -1,20 +1,32 @@
|
||||
using BLL;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.IO;
|
||||
using NPOI.XSSF.UserModel;
|
||||
using NPOI.SS.UserModel;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace FineUIPro.Web.HJGL.CheckManage
|
||||
{
|
||||
public partial class CheckManageStatic : PageBase
|
||||
{
|
||||
|
||||
#region 定义项
|
||||
/// <summary>
|
||||
/// 项目主键
|
||||
/// </summary>
|
||||
public string ProjectId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["ProjectId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["ProjectId"] = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region 加载
|
||||
/// <summary>
|
||||
/// 加载页面
|
||||
@@ -25,13 +37,43 @@ namespace FineUIPro.Web.HJGL.CheckManage
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
this.ProjectId = this.CurrUser.LoginProjectId;
|
||||
if (!string.IsNullOrEmpty(Request.Params["projectId"]) && Request.Params["projectId"] != this.CurrUser.LoginProjectId)
|
||||
{
|
||||
this.ProjectId = Request.Params["projectId"];
|
||||
}
|
||||
this.ucTree.UnitId = this.CurrUser.UnitId;
|
||||
this.ucTree.ProjectId = this.ProjectId;
|
||||
if (!string.IsNullOrEmpty(this.ProjectId))
|
||||
{
|
||||
this.panelLeftRegion.Hidden = true;
|
||||
////权限按钮方法
|
||||
//this.GetButtonPower();
|
||||
}
|
||||
this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString();
|
||||
this.txtMonth.Text = string.Format("{0:yyyy-MM}", DateTime.Now);
|
||||
|
||||
this.InitTreeMenu();//加载树
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 公司级树加载
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void changeTree(object sender, EventArgs e)
|
||||
{
|
||||
this.ProjectId = this.ucTree.ProjectId;
|
||||
|
||||
//if (string.IsNullOrEmpty(this.ProjectId))
|
||||
//{
|
||||
// btnNew.Hidden = true;
|
||||
//}
|
||||
//this.GetButtonPower();
|
||||
this.InitTreeMenu();
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -43,7 +85,7 @@ namespace FineUIPro.Web.HJGL.CheckManage
|
||||
/// <param name="e"></param>
|
||||
protected void btnImport_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.HJGL_CheckManageStaticMenuId, BLL.Const.BtnSave))
|
||||
if (BLL.CommonService.GetAllButtonPowerList(this.ProjectId, this.CurrUser.UserId, BLL.Const.HJGL_CheckManageStaticMenuId, BLL.Const.BtnSave))
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CheckManageDataIn.aspx", "导入 - ")));
|
||||
}
|
||||
@@ -60,6 +102,10 @@ namespace FineUIPro.Web.HJGL.CheckManage
|
||||
/// </summary>
|
||||
private void InitTreeMenu()
|
||||
{
|
||||
if (string.IsNullOrEmpty(this.ProjectId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
string SelectedNodeID = this.tvControlItem.SelectedNodeID;
|
||||
this.tvControlItem.Nodes.Clear();
|
||||
|
||||
@@ -73,10 +119,10 @@ namespace FineUIPro.Web.HJGL.CheckManage
|
||||
FROM [dbo].[CH_CheckStatic]
|
||||
where [ReportDate]>=@dateA and [ReportDate]<@dateZ and ProjectId = @projectId
|
||||
order by [DetectionTypeCode],[ReportDate] desc";
|
||||
|
||||
|
||||
List<SqlParameter> listStr = new List<SqlParameter>
|
||||
{
|
||||
new SqlParameter("@projectId", this.CurrUser.LoginProjectId),
|
||||
new SqlParameter("@projectId", this.ProjectId),
|
||||
new SqlParameter("@dateA", this.txtMonth.Text+"-01"),
|
||||
new SqlParameter("@dateZ", DateUtil.ToDateTime( this.txtMonth.Text+"-01").Value.AddMonths(1).ToString("yyyy-MM-dd")),
|
||||
};
|
||||
@@ -137,16 +183,16 @@ namespace FineUIPro.Web.HJGL.CheckManage
|
||||
{
|
||||
}
|
||||
|
||||
#region 点击TreeView
|
||||
/// <summary>
|
||||
/// 点击TreeView
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
#region 点击TreeView
|
||||
/// <summary>
|
||||
/// 点击TreeView
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
|
||||
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
|
||||
{
|
||||
var p = this.tvControlItem.SelectedNodeID;
|
||||
var p = this.tvControlItem.SelectedNodeID;
|
||||
|
||||
this.BindGrid();
|
||||
}
|
||||
@@ -158,6 +204,10 @@ namespace FineUIPro.Web.HJGL.CheckManage
|
||||
/// </summary>
|
||||
private void BindGrid()
|
||||
{
|
||||
if (string.IsNullOrEmpty(this.ProjectId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
string strSql = @"SELECT [CheckStaticId]
|
||||
,[Installation_ID]
|
||||
,[InstallationName]
|
||||
@@ -217,28 +267,28 @@ namespace FineUIPro.Web.HJGL.CheckManage
|
||||
,[DetectionTypeCode]
|
||||
,[DefectCode]
|
||||
FROM [dbo].[CH_CheckStatic] where ProjectId = @projectId ";
|
||||
|
||||
|
||||
List<SqlParameter> listStr = new List<SqlParameter>
|
||||
{
|
||||
new SqlParameter("@projectId", this.CurrUser.LoginProjectId)
|
||||
new SqlParameter("@projectId", this.ProjectId)
|
||||
};
|
||||
if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID))
|
||||
{
|
||||
string[] SelectedNodes = this.tvControlItem.SelectedNodeID.Split('|');
|
||||
|
||||
|
||||
if (SelectedNodes.Length > 0)
|
||||
{
|
||||
strSql += " and ReportNo = @ReportNo ";
|
||||
listStr.Add(new SqlParameter("@ReportNo", SelectedNodes[0]));
|
||||
}
|
||||
if (SelectedNodes.Length > 1)
|
||||
{
|
||||
{
|
||||
strSql += " and ReportDate >= @ReportDateA and ReportDate<=@ReportDateZ ";
|
||||
listStr.Add(new SqlParameter("@ReportDateA", SelectedNodes[1]));
|
||||
listStr.Add(new SqlParameter("@ReportDateZ", SelectedNodes[1] + " 23:59:59"));
|
||||
}
|
||||
if (SelectedNodes.Length > 2)
|
||||
{
|
||||
{
|
||||
strSql += " and DetectionTypeCode = @DetectionTypeCode ";
|
||||
|
||||
listStr.Add(new SqlParameter("@DetectionTypeCode", SelectedNodes[2]));
|
||||
@@ -247,12 +297,12 @@ namespace FineUIPro.Web.HJGL.CheckManage
|
||||
if (!string.IsNullOrEmpty(txtJOT_JointNo.Text))
|
||||
{
|
||||
strSql += " and CH_TrustCode like @CH_TrustCode ";
|
||||
listStr.Add(new SqlParameter("@CH_TrustCode", "%"+this.txtJOT_JointNo.Text+"%"));
|
||||
listStr.Add(new SqlParameter("@CH_TrustCode", "%" + this.txtJOT_JointNo.Text + "%"));
|
||||
|
||||
}
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
|
||||
// 2.获取当前分页数据
|
||||
//var table = this.GetPagedDataTable(Grid1, tb1);
|
||||
Grid1.RecordCount = tb.Rows.Count;
|
||||
@@ -311,7 +361,7 @@ namespace FineUIPro.Web.HJGL.CheckManage
|
||||
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
|
||||
{
|
||||
if (GetButtonPower(Const.BtnModify))
|
||||
{
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CheckManageStaticEdit.aspx?CheckStaticId={0}", Grid1.SelectedRowID, "编辑 - ")));
|
||||
}
|
||||
else
|
||||
@@ -320,7 +370,7 @@ namespace FineUIPro.Web.HJGL.CheckManage
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 焊口信息编辑
|
||||
@@ -373,7 +423,7 @@ namespace FineUIPro.Web.HJGL.CheckManage
|
||||
var checkStatic = Funs.DB.CH_CheckStatic.FirstOrDefault(x => x.CheckStaticId == rowID);
|
||||
Funs.DB.CH_CheckStatic.DeleteOnSubmit(checkStatic);
|
||||
Funs.DB.SubmitChanges();
|
||||
//BLL.Sys_LogService.AddLog(BLL.Const.System_7, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "删除焊口信息");
|
||||
//BLL.Sys_LogService.AddLog(BLL.Const.System_7, this.ProjectId, this.CurrUser.UserId, "删除焊口信息");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -460,7 +510,7 @@ namespace FineUIPro.Web.HJGL.CheckManage
|
||||
|
||||
List<SqlParameter> listStr = new List<SqlParameter>
|
||||
{
|
||||
new SqlParameter("@projectId", this.CurrUser.LoginProjectId)
|
||||
new SqlParameter("@projectId", this.ProjectId)
|
||||
};
|
||||
if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID))
|
||||
{
|
||||
@@ -488,7 +538,7 @@ namespace FineUIPro.Web.HJGL.CheckManage
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
|
||||
var projectName = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId);
|
||||
var projectName = BLL.ProjectService.GetProjectNameByProjectId(this.ProjectId);
|
||||
|
||||
Dictionary<string, string> keyValuePairs = new Dictionary<string, string>();
|
||||
keyValuePairs.Add("ProjectName", projectName);
|
||||
@@ -518,18 +568,18 @@ namespace FineUIPro.Web.HJGL.CheckManage
|
||||
BLL.Common.FastReportService.AddFastreportTable(tb);
|
||||
|
||||
string initTemplatePath = "";
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string rootPath = Server.MapPath("~/");
|
||||
initTemplatePath = "File\\Fastreport\\管道MT报告模板.frx";
|
||||
if (this.tvControlItem.SelectedNodeID.Split('|').Length > 2)
|
||||
{
|
||||
string type = this.tvControlItem.SelectedNodeID.Split('|')[2] ;
|
||||
string type = this.tvControlItem.SelectedNodeID.Split('|')[2];
|
||||
switch (type)
|
||||
{
|
||||
case "RT\\UT":
|
||||
case "RT": initTemplatePath = "File\\Fastreport\\管道RT报告模板.frx"; break;
|
||||
case "PT":
|
||||
initTemplatePath = "File\\Fastreport\\管道PT报告模板.frx";
|
||||
break;
|
||||
break;
|
||||
case "UT":
|
||||
initTemplatePath = "File\\Fastreport\\管道UT报告模板.frx";
|
||||
break;
|
||||
@@ -537,9 +587,9 @@ namespace FineUIPro.Web.HJGL.CheckManage
|
||||
case "TOFD\\UT\\MT":
|
||||
case "TOFD\\MT":
|
||||
case "3D-TFM":
|
||||
case "TOFD": initTemplatePath = "File\\Fastreport\\管道TOFD报告模板.frx"; break;
|
||||
|
||||
|
||||
case "TOFD": initTemplatePath = "File\\Fastreport\\管道TOFD报告模板.frx"; break;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
if (File.Exists(rootPath + initTemplatePath))
|
||||
@@ -629,7 +679,7 @@ namespace FineUIPro.Web.HJGL.CheckManage
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
#region 获取按钮权限
|
||||
/// <summary>
|
||||
@@ -639,7 +689,7 @@ namespace FineUIPro.Web.HJGL.CheckManage
|
||||
/// <returns></returns>
|
||||
private bool GetButtonPower(string button)
|
||||
{
|
||||
return BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.HJGL_JointInfoMenuId, button);
|
||||
return BLL.CommonService.GetAllButtonPowerList(this.ProjectId, this.CurrUser.UserId, BLL.Const.HJGL_JointInfoMenuId, button);
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -656,7 +706,7 @@ namespace FineUIPro.Web.HJGL.CheckManage
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user