374 lines
13 KiB
C#
374 lines
13 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Data;
|
|||
|
|
using System.Linq;
|
|||
|
|
using BLL;
|
|||
|
|
|
|||
|
|
namespace FineUIPro.Web.WeldingProcess.WeldingManage
|
|||
|
|
{
|
|||
|
|
public partial class WeldReportItemEdit : PageBase
|
|||
|
|
{
|
|||
|
|
#region 定义项
|
|||
|
|
/// <summary>
|
|||
|
|
/// 单位主键
|
|||
|
|
/// </summary>
|
|||
|
|
public string UnitId
|
|||
|
|
{
|
|||
|
|
get
|
|||
|
|
{
|
|||
|
|
return (string)ViewState["UnitId"];
|
|||
|
|
}
|
|||
|
|
set
|
|||
|
|
{
|
|||
|
|
ViewState["UnitId"] = value;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 装置主键
|
|||
|
|
/// </summary>
|
|||
|
|
public string InstallationId
|
|||
|
|
{
|
|||
|
|
get
|
|||
|
|
{
|
|||
|
|
return (string)ViewState["InstallationId"];
|
|||
|
|
}
|
|||
|
|
set
|
|||
|
|
{
|
|||
|
|
ViewState["InstallationId"] = value;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 焊口主键
|
|||
|
|
/// </summary>
|
|||
|
|
public string WeldJointId
|
|||
|
|
{
|
|||
|
|
get
|
|||
|
|
{
|
|||
|
|
return (string)ViewState["WeldJointId"];
|
|||
|
|
}
|
|||
|
|
set
|
|||
|
|
{
|
|||
|
|
ViewState["WeldJointId"] = value;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 日报主键
|
|||
|
|
/// </summary>
|
|||
|
|
public string WeldingDailyId
|
|||
|
|
{
|
|||
|
|
get
|
|||
|
|
{
|
|||
|
|
return (string)ViewState["WeldingDailyId"];
|
|||
|
|
}
|
|||
|
|
set
|
|||
|
|
{
|
|||
|
|
ViewState["WeldingDailyId"] = value;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 被选择项列表
|
|||
|
|
/// </summary>
|
|||
|
|
public List<string> SelectedList
|
|||
|
|
{
|
|||
|
|
get
|
|||
|
|
{
|
|||
|
|
return (List<string>)ViewState["SelectedList"];
|
|||
|
|
}
|
|||
|
|
set
|
|||
|
|
{
|
|||
|
|
ViewState["SelectedList"] = value;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 加载页面
|
|||
|
|
/// <summary>
|
|||
|
|
/// 加载页面
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
protected void Page_Load(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (!IsPostBack)
|
|||
|
|
{
|
|||
|
|
this.SelectedList = new List<string>();
|
|||
|
|
//this.NoSelectedList = new List<string>();
|
|||
|
|
|
|||
|
|
string strList = Request.Params["strList"];
|
|||
|
|
List<string> list = Funs.GetStrListByStr(strList, '|');
|
|||
|
|
if (list.Count() == 3)
|
|||
|
|
{
|
|||
|
|
this.InstallationId = list[0];
|
|||
|
|
this.UnitId = list[1];
|
|||
|
|
this.WeldingDailyId = list[2];
|
|||
|
|
string projectId = string.Empty;
|
|||
|
|
//Model.Project_Installation installation = BLL.Project_InstallationService.GetProject_InstallationByInstallationId(this.InstallationId);
|
|||
|
|
//if (installation != null)
|
|||
|
|
//{
|
|||
|
|
// projectId = installation.ProjectId;
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
///盖面焊工
|
|||
|
|
BLL.WelderService.InitProjectWelderDropDownList(this.drpCoverWelderId, true, CurrUser.LoginProjectId, this.UnitId, Resources.Lan.PleaseSelect);
|
|||
|
|
///打底焊工
|
|||
|
|
BLL.WelderService.InitProjectWelderDropDownList(this.drpBackingWelderId, true, CurrUser.LoginProjectId, this.UnitId, Resources.Lan.PleaseSelect);
|
|||
|
|
}
|
|||
|
|
this.InitTreeMenu();//加载树
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 加载树
|
|||
|
|
/// <summary>
|
|||
|
|
/// 加载树
|
|||
|
|
/// </summary>
|
|||
|
|
private void InitTreeMenu()
|
|||
|
|
{
|
|||
|
|
this.tvControlItem.Nodes.Clear();
|
|||
|
|
TreeNode rootNode = new TreeNode();
|
|||
|
|
rootNode.Text = Resources.Lan.Area + "-" + Resources.Lan.PipelineCode;
|
|||
|
|
rootNode.NodeID = "0";
|
|||
|
|
rootNode.Expanded = true;
|
|||
|
|
this.tvControlItem.Nodes.Add(rootNode);
|
|||
|
|
|
|||
|
|
var workArea = BLL.Project_WorkAreaService.GetProject_WorkAreaLists(this.CurrUser.LoginProjectId, this.InstallationId, null, null);
|
|||
|
|
var iso = (from x in Funs.DB.View_Pipeline_NoWeldingPipeline where x.InstallationId == this.InstallationId && x.UnitId == this.UnitId select x).ToList();
|
|||
|
|
if (!string.IsNullOrEmpty(this.txtPipelineCode.Text))
|
|||
|
|
{
|
|||
|
|
iso = (from x in iso where x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim()) select x).ToList();
|
|||
|
|
}
|
|||
|
|
foreach (var area in workArea)
|
|||
|
|
{
|
|||
|
|
TreeNode areaNode = new TreeNode();
|
|||
|
|
areaNode.Text = area.WorkAreaCode;
|
|||
|
|
areaNode.NodeID = area.WorkAreaId;
|
|||
|
|
//areaNode.EnableClickEvent = true;
|
|||
|
|
areaNode.EnableExpandEvent = true;
|
|||
|
|
rootNode.Nodes.Add(areaNode);
|
|||
|
|
|
|||
|
|
var areaIso = (from x in iso where x.WorkAreaId == area.WorkAreaId orderby x.PipelineCode select x);
|
|||
|
|
if (areaIso.Count() > 0)
|
|||
|
|
{
|
|||
|
|
TreeNode newNode = new TreeNode();
|
|||
|
|
newNode.Text = "加载...";
|
|||
|
|
newNode.NodeID = "加载...";
|
|||
|
|
areaNode.Nodes.Add(newNode);
|
|||
|
|
}
|
|||
|
|
//var areaIso = (from x in iso where x.WorkAreaId == area.WorkAreaId orderby x.PipelineCode select x);
|
|||
|
|
//foreach (var item in areaIso)
|
|||
|
|
//{
|
|||
|
|
// TreeNode tn = new TreeNode();
|
|||
|
|
// tn.Text = item.PipelineCode;
|
|||
|
|
// tn.NodeID = item.PipelineId;
|
|||
|
|
// tn.ToolTip = item.PipelineCode;
|
|||
|
|
// tn.EnableClickEvent = true;
|
|||
|
|
// areaNode.Nodes.Add(tn);
|
|||
|
|
//}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
protected void tvControlItem_TreeNodeExpanded(object sender, TreeNodeEventArgs e)
|
|||
|
|
{
|
|||
|
|
e.Node.Nodes.Clear();
|
|||
|
|
string workAreaId = e.Node.NodeID;
|
|||
|
|
|
|||
|
|
var iso = (from x in Funs.DB.View_Pipeline_NoWeldingPipeline where x.InstallationId == this.InstallationId && x.UnitId == this.UnitId select x).ToList();
|
|||
|
|
if (!string.IsNullOrEmpty(this.txtPipelineCode.Text))
|
|||
|
|
{
|
|||
|
|
iso = (from x in iso where x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim()) select x).ToList();
|
|||
|
|
}
|
|||
|
|
var areaIso = (from x in iso where x.WorkAreaId == workAreaId orderby x.PipelineCode select x);
|
|||
|
|
foreach (var item in areaIso)
|
|||
|
|
{
|
|||
|
|
TreeNode tn = new TreeNode();
|
|||
|
|
tn.Text = item.PipelineCode;
|
|||
|
|
tn.NodeID = item.PipelineId;
|
|||
|
|
tn.ToolTip = item.PipelineCode;
|
|||
|
|
tn.EnableClickEvent = true;
|
|||
|
|
e.Node.Nodes.Add(tn);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 数据绑定
|
|||
|
|
/// <summary>
|
|||
|
|
/// 数据绑定
|
|||
|
|
/// </summary>
|
|||
|
|
private void BindGrid()
|
|||
|
|
{
|
|||
|
|
string pipelineId = this.tvControlItem.SelectedNodeID;
|
|||
|
|
|
|||
|
|
List<Model.SpWeldingDailyItem> toDoMatterList = BLL.Pipeline_WeldingDailyService.GetWeldReportItemFind(this.InstallationId, this.WeldingDailyId, pipelineId);
|
|||
|
|
//string weldJoints = Request.Params["weldJoints"];
|
|||
|
|
string weldJoints = string.Empty;
|
|||
|
|
object weldreportEdit = CacheGet("weldreportEdit" + CurrUser.UserId);
|
|||
|
|
if (weldreportEdit != null)
|
|||
|
|
{
|
|||
|
|
weldJoints = weldreportEdit.ToString();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (!string.IsNullOrEmpty(weldJoints))
|
|||
|
|
{
|
|||
|
|
// jotInfo
|
|||
|
|
string[] jotInfo = weldJoints.Split('@');
|
|||
|
|
foreach (string jots in jotInfo)
|
|||
|
|
{
|
|||
|
|
string[] jot = jots.Split('|');
|
|||
|
|
Model.SpWeldingDailyItem item = toDoMatterList.FirstOrDefault(e => e.WeldJointId == jot[0]);
|
|||
|
|
if (item != null)
|
|||
|
|
{
|
|||
|
|
toDoMatterList.Remove(item);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (drpWeldType.SelectedValue == "0")
|
|||
|
|
{
|
|||
|
|
toDoMatterList = (from x in toDoMatterList where !x.WeldTypeCode.Contains("SOB") select x).ToList();
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
toDoMatterList = (from x in toDoMatterList where x.WeldTypeCode.Contains("SOB") select x).ToList();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
DataTable tb = this.LINQToDataTable(toDoMatterList);
|
|||
|
|
// 2.获取当前分页数据
|
|||
|
|
//var table = this.GetPagedDataTable(GridNewDynamic, tb1);
|
|||
|
|
Grid1.RecordCount = tb.Rows.Count;
|
|||
|
|
tb = GetFilteredTable(Grid1.FilteredData, tb);
|
|||
|
|
var table = this.GetPagedDataTable(Grid1, tb);
|
|||
|
|
|
|||
|
|
Grid1.DataSource = table;
|
|||
|
|
Grid1.DataBind();
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 管线查询
|
|||
|
|
/// <summary>
|
|||
|
|
/// 查询
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
protected void btnQuery_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
this.InitTreeMenu();
|
|||
|
|
this.BindGrid();
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 点击TreeView
|
|||
|
|
/// <summary>
|
|||
|
|
/// 点击TreeView
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
|
|||
|
|
{
|
|||
|
|
//string[] selectRowId = Grid1.SelectedRowIDArray;
|
|||
|
|
//for (int i = 0; i < this.Grid1.Rows.Count; i++)
|
|||
|
|
//{
|
|||
|
|
// string rowId = this.Grid1.Rows[i].DataKeys[0].ToString();
|
|||
|
|
// if (selectRowId.Contains(rowId))
|
|||
|
|
// {
|
|||
|
|
// SelectedList.Add(rowId);
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
this.BindGrid();
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region DropDownList下拉事件
|
|||
|
|
/// <summary>
|
|||
|
|
/// 盖面、打底焊工一致
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
protected void drpCoverWelderId_OnSelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
this.drpBackingWelderId.SelectedValue = this.drpCoverWelderId.SelectedValue;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
protected void drpWeldType_OnSelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
this.BindGrid();
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 排序
|
|||
|
|
/// <summary>
|
|||
|
|
/// 排序
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
protected void Grid1_Sort(object sender, GridSortEventArgs e)
|
|||
|
|
{
|
|||
|
|
this.BindGrid();
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 提交按钮
|
|||
|
|
/// <summary>
|
|||
|
|
/// 提交按钮
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
protected void btnAccept_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
string itemsString = string.Empty;
|
|||
|
|
//string weldJoints = Request.Params["weldJoints"];
|
|||
|
|
|
|||
|
|
string weldJoints = string.Empty;
|
|||
|
|
object weldreportEdit = CacheGet("weldreportEdit" + CurrUser.UserId);
|
|||
|
|
if (weldreportEdit != null)
|
|||
|
|
{
|
|||
|
|
weldJoints = weldreportEdit.ToString();
|
|||
|
|
}
|
|||
|
|
if (!string.IsNullOrEmpty(weldJoints))
|
|||
|
|
{
|
|||
|
|
itemsString = weldJoints + "@";
|
|||
|
|
}
|
|||
|
|
string[] selectRowId = Grid1.SelectedRowIDArray;
|
|||
|
|
|
|||
|
|
if (drpWeldType.SelectedValue == "0")
|
|||
|
|
{
|
|||
|
|
if (this.drpCoverWelderId.SelectedValue != Const._Null && this.drpBackingWelderId.SelectedValue != Const._Null)
|
|||
|
|
{
|
|||
|
|
for (int i = 0; i < this.Grid1.Rows.Count; i++)
|
|||
|
|
{
|
|||
|
|
string rowId = this.Grid1.Rows[i].DataKeys[0].ToString();
|
|||
|
|
if (selectRowId.Contains(rowId))
|
|||
|
|
{
|
|||
|
|
itemsString = itemsString + rowId + "|" + this.drpCoverWelderId.SelectedValue + "|" + this.drpBackingWelderId.SelectedValue + "|" + "null" + "|" + "null" + "|" + "null" + "|" + "null" + "|" + "null" + "|" + "null" + "@";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
ShowNotify(Resources.Lan.PleaseSelectWelder, MessageBoxIcon.Warning);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
for (int i = 0; i < this.Grid1.Rows.Count; i++)
|
|||
|
|
{
|
|||
|
|
string rowId = this.Grid1.Rows[i].DataKeys[0].ToString();
|
|||
|
|
if (selectRowId.Contains(rowId))
|
|||
|
|
{
|
|||
|
|
itemsString = itemsString + rowId + "|" + "null" + "|" + "null" + "|" + "null" + "|" + "null" + "|" + "null" + "|" + "null" + "|" + "null" + "|" + "null" + "@";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (itemsString.Length > 0)
|
|||
|
|
{
|
|||
|
|
itemsString = itemsString.Substring(0, itemsString.Length - 1);
|
|||
|
|
}
|
|||
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(itemsString)
|
|||
|
|
+ ActiveWindow.GetHidePostBackReference());
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
}
|