This commit is contained in:
2024-05-12 14:50:57 +08:00
parent 3351bc42ce
commit e30929f61d
3 changed files with 116 additions and 37 deletions
@@ -8,6 +8,7 @@ using System.Web;
using System.Collections;
using Model;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
using FineUIPro.Web.common.ProjectSet;
namespace FineUIPro.Web.WeldingProcess.PMI
{
@@ -48,8 +49,6 @@ namespace FineUIPro.Web.WeldingProcess.PMI
{
if (!string.IsNullOrEmpty(this.txtNDEDateMonth.Text.Trim()))
{
DateTime startTime = Convert.ToDateTime(this.txtNDEDateMonth.Text.Trim() + "-01");
DateTime endTime = startTime.AddMonths(1);
this.tvControlItem.Nodes.Clear();
List<Model.Base_Unit> units = new List<Model.Base_Unit>();
Model.Project_Unit pUnit = BLL.Project_UnitService.GetProject_UnitByProjectIdUnitId(this.CurrUser.LoginProjectId, this.CurrUser.UnitId);
@@ -96,30 +95,20 @@ namespace FineUIPro.Web.WeldingProcess.PMI
/// <param name="node"></param>
private void BindNodes(TreeNode node)
{
DateTime startTime = Convert.ToDateTime(this.txtNDEDateMonth.Text.Trim() + "-01");
DateTime endTime = startTime.AddMonths(1);
string searchCode = this.txtSearchCode.Text.Trim();
if (node.ToolTip == "Unit")
{
///装置
var install = (from x in Funs.DB.Project_Installation
join y in Funs.DB.PMI_Delegation on x.InstallationId equals y.InstallationId
where y.UnitId == node.NodeID && x.ProjectId == this.CurrUser.LoginProjectId
orderby x.InstallationCode
select x).Distinct();
foreach (var q in install)
{
TreeNode newNode = new TreeNode();
newNode.Text = q.InstallationName;
newNode.NodeID = q.InstallationId + "|" + node.NodeID;
newNode.ToolTip = "Installation";
node.Nodes.Add(newNode);
BindNodes(newNode);
}
}
else if (node.ToolTip == "Installation")
{
string[] unitAndInstallationArr= node.NodeID.Split('|');
var ndt = from x in Funs.DB.PMI_Delegation where x.UnitId == unitAndInstallationArr[1]
&& x.InstallationId == unitAndInstallationArr[0]
&& x.ProjectId == this.CurrUser.LoginProjectId select x;
string unitId = node.NodeID;
var ndt = from x in Funs.DB.PMI_Delegation
where x.UnitId == unitId
&& x.ProjectId == this.CurrUser.LoginProjectId
&& x.DelegationDate >= startTime && x.DelegationDate <= endTime
&&( x.DelegationNo.Contains(searchCode)|| searchCode=="")
select x;
//if (!string.IsNullOrWhiteSpace(searchCode))
// ndt = ndt.Where(q => q.DelegationNo.Contains(searchCode));
foreach (var q in ndt)
{
@@ -130,8 +119,8 @@ namespace FineUIPro.Web.WeldingProcess.PMI
newNode.EnableClickEvent = true;
node.Nodes.Add(newNode);
BindNodes(newNode);
}
}
}
}
}
#endregion
@@ -162,12 +151,51 @@ namespace FineUIPro.Web.WeldingProcess.PMI
{
if (!string.IsNullOrWhiteSpace(this.hdPMIId.Text) && this.tvControlItem.SelectedNode.ToolTip == "DelegationNo")
{
string strSql = string.Empty;
List<SqlParameter> listStr = new List<SqlParameter>();
this.SetTextTemp();
this.PageInfoLoad(); ///页面输入提交信息
if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID))
{
var result = Funs.DB.PMI_Delegation.FirstOrDefault(t => t.Id == this.tvControlItem.SelectedNodeID);
if (result != null)
{
this.PMIID = result.Id;
strSql = @"SELECT *,
(case status when 0 then '合格' else '不合格' end) StatusText
FROM [View_PMI_DelegationDetails] WHERE ProjectId= @ProjectId AND PMIID=@PMIDelegationId ";
listStr.Add(new SqlParameter("@ProjectId", result != null ? result.ProjectId : this.CurrUser.LoginProjectId));
listStr.Add(new SqlParameter("@PMIDelegationId", this.PMIID));
if (!string.IsNullOrEmpty(this.txtIsoNo.Text.Trim()))
{
strSql += @" and PipelineCode like '%'+@PipelineCode+'%' ";
listStr.Add(new SqlParameter("@PipelineCode", this.txtIsoNo.Text.Trim()));
}
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
// 2.获取当前分页数据
//var table = this.GetPagedDataTable(Grid1, tb1);
Grid1.RecordCount = tb.Rows.Count;
//tb = GetFilteredTable(Grid1.FilteredData, tb);
var table = this.GetPagedDataTable(Grid1, tb);
Grid1.DataSource = table;
Grid1.DataBind();
}
}
}
}
private string StatusText(int status) {
if (status == 0)
return "合格";
else
return "不合格";
}
#region
/// <summary>
/// 加载页面输入提交信息
@@ -185,9 +213,10 @@ namespace FineUIPro.Web.WeldingProcess.PMI
DelegationDate=x.DelegationDate,
InstallationName=n.InstallationName,
UnitName=y.UnitName,
DetectionMethod="待定",
DetectionMethod="PMI光谱分析",
Tabler=x.Tabler,
Remark=x.Remark,
DetectionStandard=x.DetectionStandard,
}).ToList();
if (pageInfo.Count>0)
{
@@ -198,6 +227,7 @@ namespace FineUIPro.Web.WeldingProcess.PMI
this.txtDetectionMethod.Text = pageInfo[0].DetectionMethod;
this.txtTabler.Text = pageInfo[0].Tabler;
this.txtRemark.Text = pageInfo[0].Remark;
this.txtDetectionStandard.Text= pageInfo[0].DetectionStandard;
}
}
#endregion
@@ -214,6 +244,7 @@ namespace FineUIPro.Web.WeldingProcess.PMI
this.txtDetectionMethod.Text = string.Empty;
this.txtTabler.Text = string.Empty;
this.txtRemark.Text = string.Empty;
this.txtDetectionStandard.Text = string.Empty;
}
#endregion