749 lines
32 KiB
C#
749 lines
32 KiB
C#
using BLL;
|
||
using MiniExcelLibs;
|
||
using Model;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Data;
|
||
using System.IO;
|
||
using System.Linq;
|
||
|
||
namespace FineUIPro.Web.HJGL.InfoQuery
|
||
{
|
||
public partial class PipelineQuery : PageBase
|
||
{
|
||
public string Line_No
|
||
{
|
||
get
|
||
{
|
||
return (string)ViewState["Completed_pipeline"];
|
||
}
|
||
set
|
||
{
|
||
ViewState["Completed_pipeline"] = value;
|
||
}
|
||
}
|
||
public static List<Model.View_HJGL_Pipeline> View_HJGL_Pipeline = new List<Model.View_HJGL_Pipeline>();
|
||
//public string Incomplete_pipeline
|
||
//{
|
||
// get
|
||
// {
|
||
// return (string)ViewState["Incomplete_pipeline"];
|
||
// }
|
||
// set
|
||
// {
|
||
// ViewState["Incomplete_pipeline"] = value;
|
||
// }
|
||
//}
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
//ctlAuditFlow.Url = BLL.Project_SysSetService.GetAvevaNetUrl(this.CurrUser.LoginProjectId);
|
||
|
||
if (!IsPostBack)
|
||
{
|
||
|
||
this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString();
|
||
this.InitTreeMenu();//加载树
|
||
}
|
||
}
|
||
|
||
#region 加载树装置-单位-工作区
|
||
/// <summary>
|
||
/// 加载树
|
||
/// </summary>
|
||
private void InitTreeMenu()
|
||
{
|
||
this.tvControlItem.Nodes.Clear();
|
||
|
||
TreeNode rootNode1 = new TreeNode();
|
||
rootNode1.NodeID = "1";
|
||
rootNode1.Text = "建筑工程";
|
||
rootNode1.CommandName = "建筑工程";
|
||
rootNode1.Selectable = false;
|
||
this.tvControlItem.Nodes.Add(rootNode1);
|
||
|
||
TreeNode rootNode2 = new TreeNode();
|
||
rootNode2.NodeID = "2";
|
||
rootNode2.Text = "安装工程";
|
||
rootNode2.CommandName = "安装工程";
|
||
rootNode2.Expanded = true;
|
||
this.tvControlItem.Nodes.Add(rootNode2);
|
||
|
||
var pUnits = (from x in Funs.DB.Project_ProjectUnit where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList();
|
||
// 获取当前用户所在单位
|
||
var currUnit = pUnits.FirstOrDefault(x => x.UnitId == this.CurrUser.UnitId);
|
||
|
||
var unitWorkList = (from x in Funs.DB.WBS_UnitWork
|
||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||
&& x.SuperUnitWork == null && x.UnitId != null && x.ProjectType != null
|
||
select x).ToList();
|
||
|
||
List<Model.WBS_UnitWork> unitWork1 = null;
|
||
List<Model.WBS_UnitWork> unitWork2 = null;
|
||
|
||
//// 当前为施工单位,只能操作本单位的数据
|
||
//if (currUnit != null && currUnit.UnitType == Const.ProjectUnitType_2)
|
||
//{
|
||
// unitWork1 = (from x in unitWorkList
|
||
// where x.UnitId == this.CurrUser.UnitId && x.ProjectType == "1"
|
||
// select x).ToList();
|
||
// unitWork2 = (from x in unitWorkList
|
||
// where x.UnitId == this.CurrUser.UnitId && x.ProjectType == "2"
|
||
// select x).ToList();
|
||
//}
|
||
//else
|
||
//{
|
||
unitWork1 = (from x in unitWorkList where x.ProjectType == "1" select x).ToList();
|
||
unitWork2 = (from x in unitWorkList where x.ProjectType == "2" select x).ToList();
|
||
//}
|
||
|
||
if (unitWork1.Count() > 0)
|
||
{
|
||
foreach (var q in unitWork1)
|
||
{
|
||
int a = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == q.UnitWorkId select x).Count();
|
||
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
|
||
TreeNode tn1 = new TreeNode();
|
||
tn1.NodeID = q.UnitWorkId;
|
||
tn1.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线";
|
||
tn1.ToolTip = "施工单位:" + unitNamesUnitIds;
|
||
tn1.EnableClickEvent = true;
|
||
rootNode1.Nodes.Add(tn1);
|
||
}
|
||
}
|
||
if (unitWork2.Count() > 0)
|
||
{
|
||
foreach (var q in unitWork2)
|
||
{
|
||
int a = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == q.UnitWorkId select x).Count();
|
||
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
|
||
TreeNode tn2 = new TreeNode();
|
||
tn2.NodeID = q.UnitWorkId;
|
||
tn2.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线";
|
||
tn2.ToolTip = "施工单位:" + unitNamesUnitIds;
|
||
tn2.EnableClickEvent = true;
|
||
rootNode2.Nodes.Add(tn2);
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 点击TreeView
|
||
/// <summary>
|
||
/// 点击TreeView
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
|
||
{
|
||
this.BindGrid();
|
||
|
||
|
||
}
|
||
#endregion
|
||
|
||
#region 数据绑定
|
||
/// <summary>
|
||
/// 数据绑定
|
||
/// </summary>
|
||
private void BindGrid()
|
||
{
|
||
// string strSql = @"SELECT ProjectId,UnitWorkId,PipelineId,PipelineCode,UnitName,MediumCode,MediumName,PipingClassCode,UnitWorkCode,SingleName,
|
||
// TestPressure,SingleNumber,DetectionRateCode,DetectionType,Remark,TestMediumCode,TotalDin,FinishSize,
|
||
// JointCount,PressurePipingClassCode,PipeLenth,DesignPress,DesignTemperature,LeakPressure,VacuumPressure,
|
||
// LeakMediumName,PCMediumName,MaterialCode,FinishedDate,
|
||
//(CASE WHEN IsFinished=1 THEN '已完成' ELSE '未完成' END) AS IsFinished
|
||
// FROM dbo.View_HJGL_Pipeline
|
||
// WHERE ProjectId= @ProjectId";
|
||
// List<SqlParameter> listStr = new List<SqlParameter>();
|
||
// listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
|
||
|
||
// strSql += " AND UnitWorkId =@UnitWorkId";
|
||
// listStr.Add(new SqlParameter("@UnitWorkId", this.tvControlItem.SelectedNodeID));
|
||
// if (!string.IsNullOrEmpty(this.txtPipelineCode.Text.Trim()))
|
||
// {
|
||
// strSql += " AND PipelineCode LIKE @PipelineCode";
|
||
// listStr.Add(new SqlParameter("@PipelineCode", "%" + this.txtPipelineCode.Text.Trim() + "%"));
|
||
// }
|
||
// if (drpIsFinish.SelectedValue == "1")
|
||
// {
|
||
// strSql += " AND pipe.IsFinished = 1";
|
||
// }
|
||
// if (drpIsFinish.SelectedValue == "0")
|
||
// {
|
||
// strSql += " AND (pipe.IsFinished IS NULL OR pipe.IsFinished = 0)";
|
||
// }
|
||
|
||
// SqlParameter[] parameter = listStr.ToArray();
|
||
// DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||
Model.View_HJGL_Pipeline view_HJGL_Pipeline = new Model.View_HJGL_Pipeline();
|
||
view_HJGL_Pipeline.ProjectId = this.CurrUser.LoginProjectId;
|
||
view_HJGL_Pipeline.UnitWorkId = this.tvControlItem.SelectedNodeID;
|
||
view_HJGL_Pipeline.PipelineCode = this.txtPipelineCode.Text.Trim();
|
||
view_HJGL_Pipeline.IsFinished = null;
|
||
if (drpIsFinish.SelectedValue == "1")
|
||
{
|
||
view_HJGL_Pipeline.IsFinished = true;
|
||
}
|
||
if (drpIsFinish.SelectedValue == "0")
|
||
{
|
||
view_HJGL_Pipeline.IsFinished = false;
|
||
}
|
||
var list = BLL.PipelineService.GetView_HJGL_Pipelines(view_HJGL_Pipeline);
|
||
View_HJGL_Pipeline = list;
|
||
get3DParmeter_pipeline(list);
|
||
// 2.获取当前分页数据
|
||
//var table = this.GetPagedDataTable(Grid1, tb1);
|
||
Grid1.RecordCount = list.Count;
|
||
//tb = GetFilteredTable(Grid1.FilteredData, tb);
|
||
var table = this.GetPagedDataTable(Grid1, list);
|
||
Grid1.DataSource = table;
|
||
Grid1.DataBind();
|
||
|
||
}
|
||
#endregion
|
||
private void get3DParmeter_pipeline(List<View_HJGL_Pipeline> view_HJGL_Pipelines)
|
||
{
|
||
if (view_HJGL_Pipelines.Any())
|
||
{
|
||
var q = view_HJGL_Pipelines.Where(x => x.IsFinished == true);//获取已完成管线
|
||
if (q.Any())
|
||
{
|
||
List<string> Completed_pipelineList = new List<string>();
|
||
|
||
foreach (var item in q)
|
||
{
|
||
Completed_pipelineList.Add("/" + item.PipelineCode);
|
||
}
|
||
Line_No = string.Join(",", Completed_pipelineList);
|
||
}
|
||
|
||
//var q1 = view_HJGL_Pipelines.Where(x => x.IsFinished != true);//获取未完成管线
|
||
//if (q1.Any())
|
||
//{
|
||
// List<string> Incomplete_pipelineList = new List<string>();
|
||
// foreach (var item in q1)
|
||
// {
|
||
// Incomplete_pipelineList.Add("/" + item.PipelineCode);
|
||
// }
|
||
// Incomplete_pipeline = string.Join(",", Incomplete_pipelineList);
|
||
//}
|
||
|
||
}
|
||
|
||
}
|
||
#region 分页排序
|
||
#region 页索引改变事件
|
||
/// <summary>
|
||
/// 页索引改变事件
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
||
{
|
||
Grid1.PageIndex = e.NewPageIndex;
|
||
BindGrid();
|
||
}
|
||
#endregion
|
||
|
||
#region 排序
|
||
/// <summary>
|
||
/// 排序
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Grid1_Sort(object sender, GridSortEventArgs e)
|
||
{
|
||
Grid1.SortDirection = e.SortDirection;
|
||
Grid1.SortField = e.SortField;
|
||
BindGrid();
|
||
}
|
||
#endregion
|
||
|
||
#region 分页选择下拉改变事件
|
||
/// <summary>
|
||
/// 分页选择下拉改变事件
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
||
{
|
||
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
|
||
BindGrid();
|
||
}
|
||
#endregion
|
||
#endregion
|
||
|
||
#region 查询页面
|
||
|
||
/// <summary>
|
||
/// 查询
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnQuery_Click(object sender, EventArgs e)
|
||
{
|
||
this.BindGrid();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查询
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Tree_TextChanged(object sender, EventArgs e)
|
||
{
|
||
this.InitTreeMenu();
|
||
this.BindGrid();
|
||
}
|
||
#endregion
|
||
|
||
#region 导出按钮
|
||
/// 导出按钮
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnOut_Click(object sender, EventArgs e)
|
||
{
|
||
string path = Funs.RootPath + @"File\Excel\Temp\pipelineQuery.xlsx";
|
||
path = path.Replace(".xlsx", string.Format("{0:yyyy-MM-dd-HH-mm}", DateTime.Now) + ".xlsx");
|
||
var q = (from x in View_HJGL_Pipeline
|
||
select new
|
||
{
|
||
管线号 = x.PipelineCode,
|
||
是否完成 = x.IsFinished,
|
||
完成日期 = x.FinishedDate,
|
||
完成达因 = x.FinishSize,
|
||
完成焊口 = x.FinishJointCount,
|
||
总达因数 = x.TotalDin,
|
||
总焊口量 = x.JointCount,
|
||
预制口量 = x.ShopJointCount,
|
||
管线划分 = x.PipeAreaStr,
|
||
无损检测类型 = x.DetectionTypeCode,
|
||
探伤比例 = x.DetectionRateCode,
|
||
介质名称 = x.MediumName,
|
||
管道等级 = x.PipingClassCode,
|
||
图纸名称 = x.SingleName,
|
||
单线图号 = x.SingleNumber,
|
||
设计压力 = x.DesignPress,
|
||
设计温度 = x.DesignTemperature,
|
||
压力试验介质 = x.TestMediumCode,
|
||
压力试验压力 = x.TestPressure,
|
||
压力管道级别 = x.PressurePipingClassCode,
|
||
管线长度 = x.PipeLenth,
|
||
泄露试验介质 = x.LeakMediumName,
|
||
泄露试验压力 = x.LeakPressure,
|
||
吹洗要求 = x.PCMediumName,
|
||
真空试验压力 = x.VacuumPressure,
|
||
材质 = x.MaterialCode,
|
||
备注 = x.Remark
|
||
}).ToList();
|
||
MiniExcel.SaveAs(path, q);
|
||
|
||
string fileName = "管线信息总览.xlsx";
|
||
FileInfo info = new FileInfo(path);
|
||
long fileSize = info.Length;
|
||
System.Web.HttpContext.Current.Response.Clear();
|
||
System.Web.HttpContext.Current.Response.ContentType = "application/x-zip-compressed";
|
||
System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
||
System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString());
|
||
System.Web.HttpContext.Current.Response.TransmitFile(path, 0, fileSize);
|
||
System.Web.HttpContext.Current.Response.Flush();
|
||
System.Web.HttpContext.Current.Response.Close();
|
||
File.Delete(path);
|
||
|
||
|
||
//Response.ClearContent();
|
||
//string filename = Funs.GetNewFileName();
|
||
//Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("管线信息总览" + filename, System.Text.Encoding.UTF8) + ".xls");
|
||
//Response.ContentType = "application/excel";
|
||
//Response.ContentEncoding = System.Text.Encoding.UTF8;
|
||
////this.Grid1.PageSize = this.;
|
||
//BindGrid();
|
||
//Response.Write(GetGridTableHtml(Grid1));
|
||
//Response.End();
|
||
}
|
||
|
||
//#pragma warning disable CS0108 // “PersonList.GetGridTableHtml(Grid)”隐藏继承的成员“PageBase.GetGridTableHtml(Grid)”。如果是有意隐藏,请使用关键字 new。
|
||
// /// <summary>
|
||
// /// 导出方法
|
||
// /// </summary>
|
||
// /// <param name="grid"></param>
|
||
// /// <returns></returns>
|
||
// private string GetGridTableHtml(Grid grid)
|
||
//#pragma warning restore CS0108 // “PersonList.GetGridTableHtml(Grid)”隐藏继承的成员“PageBase.GetGridTableHtml(Grid)”。如果是有意隐藏,请使用关键字 new。
|
||
// {
|
||
// StringBuilder sb = new StringBuilder();
|
||
// sb.Append("<meta http-equiv=\"content-type\" content=\"application/excel; charset=UTF-8\"/>");
|
||
// sb.Append("<table cellspacing=\"0\" rules=\"all\" border=\"1\" style=\"border-collapse:collapse;\">");
|
||
// sb.Append("<tr>");
|
||
// foreach (GridColumn column in grid.Columns)
|
||
// {
|
||
// sb.AppendFormat("<td>{0}</td>", column.HeaderText);
|
||
// }
|
||
// sb.Append("</tr>");
|
||
// foreach (GridRow row in grid.Rows)
|
||
// {
|
||
// sb.Append("<tr>");
|
||
// foreach (GridColumn column in grid.Columns)
|
||
// {
|
||
// string html = row.Values[column.ColumnIndex].ToString();
|
||
// if (column.ColumnID == "tfNumber")
|
||
// {
|
||
// html = (row.FindControl("labNumber") as AspNet.Label).Text;
|
||
// }
|
||
// if (column.ColumnID == "tfI")
|
||
// {
|
||
// html = (row.FindControl("lbI") as AspNet.Label).Text;
|
||
// }
|
||
// //sb.AppendFormat("<td>{0}</td>", html);
|
||
// sb.AppendFormat("<td style='vnd.ms-excel.numberformat:@;width:140px;'>{0}</td>", html);
|
||
// }
|
||
|
||
// sb.Append("</tr>");
|
||
// }
|
||
|
||
// sb.Append("</table>");
|
||
|
||
// return sb.ToString();
|
||
// }
|
||
|
||
/// <summary>
|
||
/// 管道数据表导出按钮
|
||
/// </summary>
|
||
protected void btnPipelineDataOut_Click(object sender, EventArgs e)
|
||
{
|
||
var pipelines = GetCurrentPipelineList();
|
||
if (pipelines.Count == 0)
|
||
{
|
||
ShowNotify("没有可导出的管线数据!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
|
||
string templatePath = Funs.RootPath + @"File\Excel\DataOut\管道数据表导出模板.xlsx";
|
||
if (!File.Exists(templatePath))
|
||
{
|
||
ShowNotify("导出模板不存在!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
|
||
string tempPath = Funs.RootPath + @"File\Excel\Temp\管道数据表.xlsx";
|
||
tempPath = tempPath.Replace(".xlsx", string.Format("{0:yyyy-MM-dd-HH-mm-ss}", DateTime.Now) + ".xlsx");
|
||
Directory.CreateDirectory(Path.GetDirectoryName(tempPath));
|
||
|
||
var pipelineIds = pipelines.Select(x => x.PipelineId).Where(x => !string.IsNullOrEmpty(x)).ToList();
|
||
var hotPipelineIds = Funs.DB.HJGL_WeldJoint
|
||
.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.PipelineId != null && pipelineIds.Contains(x.PipelineId) && x.IsHotProess == true)
|
||
.Select(x => x.PipelineId)
|
||
.Distinct()
|
||
.ToList();
|
||
var hotPipelineIdSet = new HashSet<string>(hotPipelineIds);
|
||
|
||
var pipelineData = pipelines.Select((x, index) => new
|
||
{
|
||
No = index + 1,
|
||
PipelineCode = SafeText(x.PipelineCode),
|
||
PipingClassCode = SafeText(x.PipingClassCode),
|
||
MediumName = SafeText(x.MediumName),
|
||
PressurePipingClassCode = SafeText(x.PressurePipingClassCode),
|
||
DesignPress = SafeText(x.DesignPress),
|
||
DesignTemperature = SafeText(x.DesignTemperature),
|
||
OperatePressure = "/",
|
||
OperateTemperature = "/",
|
||
PWHT = hotPipelineIdSet.Contains(x.PipelineId) ? "PWHT" : "/",
|
||
DetectionRateCode = SafeText(x.DetectionRateCode),
|
||
InsulationType = "/",
|
||
Tracing = "/",
|
||
TestType = "/",
|
||
TestMethod = SafeText(x.TestMediumCode),
|
||
TestPressure = SafeText(x.TestPressure)
|
||
}).ToList();
|
||
|
||
var weldJoints = Funs.DB.View_HJGL_WeldJoint
|
||
.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.PipelineId != null && pipelineIds.Contains(x.PipelineId))
|
||
.OrderBy(x => x.PipelineCode)
|
||
.ThenBy(x => x.WeldJointCode)
|
||
.ToList();
|
||
var weldJointIds = weldJoints.Select(x => x.WeldJointId).Where(x => !string.IsNullOrEmpty(x)).ToList();
|
||
var pointJointIds = Funs.DB.HJGL_Batch_PointBatchItem
|
||
.Where(x => x.WeldJointId != null && weldJointIds.Contains(x.WeldJointId) && x.PointState != null)
|
||
.Select(x => x.WeldJointId)
|
||
.Distinct()
|
||
.ToList();
|
||
var pointJointIdSet = new HashSet<string>(pointJointIds);
|
||
|
||
var weldJointData = weldJoints.Select((x, index) => new
|
||
{
|
||
No = index + 1,
|
||
SingleNumber = SafeText(x.PipelineCode),
|
||
WeldJointCode = SafeText(x.WeldJointCode),
|
||
Dia = x.Dia,
|
||
Thickness = x.Thickness,
|
||
MaterialCode = SafeText(x.MaterialCode),
|
||
WeldingDate = SafeText(x.WeldingDate),
|
||
WelderName = JoinTexts(x.BackingWelderName, x.CoverWelderName),
|
||
CertificateNo = "/",
|
||
WelderCode = JoinTexts(x.BackingWelderCode, x.CoverWelderCode),
|
||
WelderExamDate = "/",
|
||
TestJointDate = "/",
|
||
RootWeldingData = FormatWeldingData(x.WeldingMethodCode),
|
||
RemainingWeldingData = FormatWeldingData(x.WeldingMethodCode),
|
||
// P列和V列按“管线需要热处理”判断,不按单个焊口判断。
|
||
PWHT = hotPipelineIdSet.Contains(x.PipelineId) ? "PWHT" : "/",
|
||
HotProcessAccept = hotPipelineIdSet.Contains(x.PipelineId) ? "ACC." : "/",
|
||
// AB列按点口记录判断;AC列按管道等级1级判断,否则保持模板要求的“/”。
|
||
PointAccept = IsPointed(x.IsPoint, x.WeldJointId, pointJointIdSet) ? "ACC." : "/",
|
||
PipingClassAccept = IsFirstLevelPipingClass(x.PipingClassCode) ? "ACC." : "/"
|
||
}).ToList();
|
||
|
||
var value = new Dictionary<string, object>
|
||
{
|
||
["PipelineData"] = pipelineData,
|
||
["WeldJointData"] = weldJointData
|
||
};
|
||
|
||
MiniExcel.SaveAsByTemplate(tempPath, templatePath, value);
|
||
DownTempFile(tempPath, "管道数据表.xlsx");
|
||
}
|
||
|
||
/// <summary>
|
||
/// 按当前页面筛选条件重新获取导出管线,避免使用跨用户共享的静态缓存。
|
||
/// </summary>
|
||
private List<Model.View_HJGL_Pipeline> GetCurrentPipelineList()
|
||
{
|
||
Model.View_HJGL_Pipeline model = new Model.View_HJGL_Pipeline();
|
||
model.ProjectId = this.CurrUser.LoginProjectId;
|
||
model.UnitWorkId = this.tvControlItem.SelectedNodeID;
|
||
model.PipelineCode = this.txtPipelineCode.Text.Trim();
|
||
model.IsFinished = null;
|
||
if (drpIsFinish.SelectedValue == "1")
|
||
{
|
||
model.IsFinished = true;
|
||
}
|
||
if (drpIsFinish.SelectedValue == "0")
|
||
{
|
||
model.IsFinished = false;
|
||
}
|
||
return BLL.PipelineService.GetView_HJGL_Pipelines(model);
|
||
}
|
||
|
||
private void DownTempFile(string path, string fileName)
|
||
{
|
||
FileInfo info = new FileInfo(path);
|
||
long fileSize = info.Length;
|
||
System.Web.HttpContext.Current.Response.Clear();
|
||
System.Web.HttpContext.Current.Response.ContentType = "application/x-zip-compressed";
|
||
System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
||
System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString());
|
||
System.Web.HttpContext.Current.Response.TransmitFile(path, 0, fileSize);
|
||
System.Web.HttpContext.Current.Response.Flush();
|
||
System.Web.HttpContext.Current.Response.Close();
|
||
File.Delete(path);
|
||
}
|
||
|
||
private static string SafeText(object value)
|
||
{
|
||
if (value == null)
|
||
{
|
||
return "/";
|
||
}
|
||
string text = value.ToString();
|
||
return string.IsNullOrWhiteSpace(text) ? "/" : text.Trim();
|
||
}
|
||
|
||
private static string JoinTexts(params string[] values)
|
||
{
|
||
var texts = values
|
||
.Where(x => !string.IsNullOrWhiteSpace(x))
|
||
.Select(x => x.Trim())
|
||
.Distinct()
|
||
.ToList();
|
||
return texts.Count == 0 ? "/" : string.Join("/", texts);
|
||
}
|
||
|
||
private static string FormatWeldingData(params string[] values)
|
||
{
|
||
return JoinTexts(values);
|
||
}
|
||
|
||
private static bool IsPointed(string isPoint, string weldJointId, HashSet<string> pointJointIdSet)
|
||
{
|
||
return pointJointIdSet.Contains(weldJointId) || isPoint == "1" || isPoint == "是" || isPoint == "True";
|
||
}
|
||
|
||
private static bool IsFirstLevelPipingClass(string pipingClassCode)
|
||
{
|
||
if (string.IsNullOrWhiteSpace(pipingClassCode))
|
||
{
|
||
return false;
|
||
}
|
||
string code = pipingClassCode.Trim();
|
||
return code == "1" || code == "1级" || code == "一级" || code == "Ⅰ级" || code == "Ⅰ";
|
||
}
|
||
#endregion
|
||
|
||
protected string ConvertDetectionType(object detectionType)
|
||
{
|
||
string detectionName = string.Empty;
|
||
if (detectionType != null)
|
||
{
|
||
string[] types = detectionType.ToString().Split('|');
|
||
foreach (string t in types)
|
||
{
|
||
var type = BLL.Base_DetectionTypeService.GetDetectionTypeByDetectionTypeId(t);
|
||
if (type != null)
|
||
{
|
||
detectionName += type.DetectionTypeCode + ",";
|
||
}
|
||
}
|
||
}
|
||
if (detectionName != string.Empty)
|
||
{
|
||
return detectionName.Substring(0, detectionName.Length - 1);
|
||
}
|
||
else
|
||
{
|
||
return "";
|
||
}
|
||
}
|
||
protected string ConvertIsFinished(object IsFinished)
|
||
{
|
||
string IsFinishedValue = "未完成";
|
||
if (IsFinished != null)
|
||
{
|
||
if (IsFinished.ToString() == "True")
|
||
{
|
||
IsFinishedValue = "已完成";
|
||
}
|
||
|
||
}
|
||
return IsFinishedValue;
|
||
}
|
||
protected void btnGetChart_Click(object sender, EventArgs e)
|
||
{
|
||
decimal PipelineComplete = 0;
|
||
decimal PipelineNoComplete = 0;
|
||
if (!string.IsNullOrEmpty(tvControlItem.SelectedNodeID))
|
||
{
|
||
var allline = (from x in Funs.DB.HJGL_Pipeline where x.UnitWorkId == tvControlItem.SelectedNodeID select x).ToList().Count();
|
||
var Completeline = (from x in Funs.DB.HJGL_Pipeline where x.UnitWorkId == tvControlItem.SelectedNodeID && x.IsFinished == true select x).ToList().Count();
|
||
int NoCompleteline = allline - Completeline;
|
||
PipelineComplete = Completeline;
|
||
PipelineNoComplete = NoCompleteline;
|
||
}
|
||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PipelineQueryChart.aspx?PipelineComplete={0}&&PipelineNOComplete={1}", PipelineComplete, PipelineNoComplete, "编辑 - ")));
|
||
|
||
}
|
||
protected void btnJoinMarke_Click(object sender, EventArgs e)
|
||
{ //string httpUrl = @"FileUpload\HJGL_DataImport\095e9691-99c2-4f70-8e67-e70c8fa6be9c\2022-06\管道焊接工作记录.pdf";
|
||
//var newurl = Funs.SGGLUrl + httpUrl.Replace(Funs.RootPath, "");
|
||
var id = Grid1.SelectedRowID;
|
||
if (string.IsNullOrEmpty(id))
|
||
{
|
||
ShowNotify("请选择相对应的ISO轴测图", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
if (id != null)
|
||
{
|
||
|
||
PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("../JoinMarking/JoinMarking.aspx?ISO_ID={0}", id, "查看 -")));
|
||
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("请上传相关ISO轴测图", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
}
|
||
protected void btnSinglePreview_Click(object sender, EventArgs e)
|
||
{
|
||
//string httpUrl = @"FileUpload\HJGL_DataImport\095e9691-99c2-4f70-8e67-e70c8fa6be9c\2022-06\管道焊接工作记录.pdf";
|
||
//var newurl = Funs.SGGLUrl + httpUrl.Replace(Funs.RootPath, "");
|
||
var id = Grid1.SelectedRowID;
|
||
if (string.IsNullOrEmpty(id))
|
||
{
|
||
ShowNotify("请选择相对应的ISO轴测图", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
var SingleName = (from x in Funs.DB.View_HJGL_Pipeline where x.PipelineId == id select (x.SingleName)).FirstOrDefault();
|
||
var filemodel = BLL.HJGL_DataImportService.GetLatestFileByFileName(SingleName, "0", this.CurrUser.LoginProjectId);
|
||
if (filemodel != null)
|
||
{
|
||
string httpUrl = filemodel.FilePath;
|
||
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("~/AttachFile/Look.aspx?fileUrl={0}", httpUrl, "查看 -")));
|
||
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("请上传相关ISO轴测图", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
|
||
|
||
}
|
||
|
||
protected void Grid1_RowClick(object sender, GridRowClickEventArgs e)
|
||
{
|
||
var q = PipelineService.GetPipelineByPipelineId(Grid1.SelectedRowID);
|
||
var pipecode = "/" + q.PipelineCode;
|
||
Model.Parameter3D parameter3D = new Model.Parameter3D();
|
||
Model.ColorModel colorModel = new Model.ColorModel();
|
||
colorModel = BLL.Project_SysSetService.GetColorModel(this.CurrUser.LoginProjectId);
|
||
parameter3D.ColorModel = colorModel;
|
||
parameter3D.TagNum = pipecode;
|
||
parameter3D.ButtonType = "2";
|
||
parameter3D.ModelName = HJGL_DataImportService.Getlatest3DModelNameByUnitWorkId(tvControlItem.SelectedNodeID);
|
||
//parameter3D.Line_No = Line_No;
|
||
parameter3D.Transparency = colorModel.PipelineComplete;
|
||
parameter3D.Finished_color = colorModel.JointCompleteColor;
|
||
parameter3D.Incomplete_color = colorModel.JointNOCompleteColor;
|
||
|
||
//ctlAuditFlow.Url_item = BLL.Project_SysSetService.GetAvevaNetUrl_Item(this.CurrUser.LoginProjectId) + parameter3D.ModelName;
|
||
//ctlAuditFlow.data = parameter3D;
|
||
//ctlAuditFlow.BindData();
|
||
}
|
||
|
||
protected void btnSinglePreview_2_Click(object sender, EventArgs e)
|
||
{
|
||
var id = Grid1.SelectedRowID;
|
||
if (string.IsNullOrEmpty(id))
|
||
{
|
||
ShowNotify("请选择相对应的ISO施工轴测图", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
var SingleName = (from x in Funs.DB.View_HJGL_Pipeline where x.PipelineId == id select (x.SingleName)).FirstOrDefault();
|
||
var filemodel = BLL.HJGL_DataImportService.GetLatestFileByFileName(SingleName, "4", this.CurrUser.LoginProjectId);
|
||
if (filemodel != null)
|
||
{
|
||
string httpUrl = filemodel.FilePath;
|
||
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("~/AttachFile/Look.aspx?fileUrl={0}", httpUrl, "查看 -")));
|
||
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("请上传相关ISO施工轴测图", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
|
||
}
|
||
|
||
protected void btnrefresh_Click(object sender, EventArgs e)
|
||
{
|
||
Model.Parameter3D parameter3D = new Model.Parameter3D();
|
||
Model.ColorModel colorModel = new Model.ColorModel();
|
||
colorModel = BLL.Project_SysSetService.GetColorModel(this.CurrUser.LoginProjectId);
|
||
parameter3D.ColorModel = colorModel;
|
||
parameter3D.TagNum = Line_No;
|
||
parameter3D.ButtonType = "2";
|
||
parameter3D.ModelName = HJGL_DataImportService.Getlatest3DModelNameByUnitWorkId(tvControlItem.SelectedNodeID);
|
||
// parameter3D.Line_No = Line_No;
|
||
parameter3D.Transparency = colorModel.PipelineComplete;
|
||
parameter3D.Finished_color = colorModel.JointCompleteColor;
|
||
parameter3D.Incomplete_color = colorModel.JointNOCompleteColor;
|
||
|
||
//ctlAuditFlow.Url_item = BLL.Project_SysSetService.GetAvevaNetUrl_Item(this.CurrUser.LoginProjectId) + parameter3D.ModelName;
|
||
//ctlAuditFlow.data = parameter3D;
|
||
//ctlAuditFlow.BindData();
|
||
}
|
||
}
|
||
}
|