Basf_TCC7/HJGL/FineUIPro.Web/WeldingProcess/TestPackageManage/selectJointCode.aspx.cs

95 lines
3.1 KiB
C#
Raw Normal View History

2024-05-23 01:05:28 +08:00
using BLL;
using Model;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.WeldingProcess.TestPackageManage
{
public partial class selectJointCode : PageBase
{
private string rowId=string.Empty;
private string jointcode=string.Empty;
2024-05-23 13:29:09 +08:00
private string ptpId=string.Empty;
2024-05-23 01:05:28 +08:00
protected void Page_Load(object sender, EventArgs e)
{
this.rowId = Request.Params["rowId"];
this.jointcode = Request.Params["jointcode"];
2024-05-23 13:29:09 +08:00
this.ptpId = Request.Params["ptpId"];
2024-05-23 01:05:28 +08:00
if (string.IsNullOrEmpty(this.rowId))
{
ShowNotify("请先选择某条管线信息!", MessageBoxIcon.Warning);
return;
}
if (!IsPostBack)
{
btnClose.OnClientClick = ActiveWindow.GetHideReference();
this.BindGridDataSource();
this.InitGridDataChecked();
}
}
void InitGridDataChecked()
{
List<int> list = new List<int>();
if (!string.IsNullOrEmpty(this.jointcode))
{
string[] arr=this.jointcode.Split(',');
for (int i = 0;i<Grid1.Rows.Count;i++)
{
string key = Grid1.DataKeys[i][0].ToString();
if (arr.Contains(key))
{
list.Add(i);
}
}
}
Grid1.SelectedRowIndexArray = list.ToArray();
}
void BindGridDataSource()
{
this.Grid1.DataSource = GetDataJointGrid2(this.rowId);
this.Grid1.DataBind();
}
private List<Pipeline_WeldJoint> GetDataJointGrid2(string PipelineID)
{
2024-05-23 11:20:42 +08:00
List<string> listData = new List<string>();
2024-05-24 07:49:29 +08:00
var tempData = Funs.DB.PTP_PipelineList.Where(t => t.PipelineId == PipelineID && t.IsAll == false)
.AsQueryable();
2024-05-23 01:05:28 +08:00
2024-05-24 07:49:29 +08:00
if (!string.IsNullOrEmpty(this.ptpId))
{
tempData = tempData.Where(t => t.PTP_ID != this.ptpId);
}
var newData = tempData.Select(t => t.WeldJonintCode).ToList();
foreach (var item in newData)
2024-05-23 01:05:28 +08:00
{
2024-05-23 11:20:42 +08:00
if (!string.IsNullOrEmpty(item))
{
string[] strcode = item.Split(',');
for (int i = 0; i < strcode.Length; i++)
{
if (!listData.Contains(strcode[i]))
{
listData.Add(strcode[i]);
}
}
}
2024-05-23 01:05:28 +08:00
}
var query = Funs.DB.Pipeline_WeldJoint.Where(t => t.PipelineId == PipelineID)
.OrderBy(t => t.WeldJointCode).AsQueryable();
2024-05-24 07:49:29 +08:00
if (listData.Count>0 )
2024-05-23 01:05:28 +08:00
{
2024-05-23 11:20:42 +08:00
query = query.Where(t => !listData.Contains(t.WeldJointCode));
2024-05-23 01:05:28 +08:00
}
2024-05-31 20:08:20 +08:00
return query.OrderBy(t=>t.WeldJointCode).ToList();
2024-05-23 01:05:28 +08:00
}
}
}