SGGL_SHJ/SGGL/FineUIPro.Web/HJGL/JoinMarking/PDFShow.aspx.cs

191 lines
7.0 KiB
C#
Raw Normal View History

2026-05-29 08:59:59 +08:00
using BLL;
using BLL.Common;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.OleDb;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Threading;
namespace FineUIPro.Web.HJGL.JoinMarking
{
public partial class PDFShow : PageBase
{
private string ISO_ID
{
get
{
return (string)ViewState["ISO_ID"];
}
set
{
ViewState["ISO_ID"] = value;
}
}
private string FileId
{
get
{
return (string)ViewState["FileId"];
}
set
{
ViewState["FileId"] = value;
}
}
public string UnitName
{
get
{
return (string)ViewState["UnitName"];
}
set
{
ViewState["UnitName"] = value;
}
}
public string URL
{
get
{
return (string)ViewState["URL"];
}
set
{
ViewState["URL"] = value;
}
}
public string JointData
{
get
{
return (string)ViewState["JointData"];
}
set
{
ViewState["JointData"] = value;
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ISO_ID = Request.Params["ISO_ID"];
FileId = Request.Params["FileId"];
URL = Funs.SGGLUrl + Request.Params["pdfurl"];
var iso = Funs.DB.HJGL_Pipeline.FirstOrDefault(x => x.PipelineId == ISO_ID);
if (iso != null)
{
UnitName = Funs.DB.Base_Unit.FirstOrDefault(x => x.UnitId == iso.UnitId)?.UnitName;
}
var jotids = Funs.DB.HJGL_WeldJoint.Where(x => x.PipelineId == ISO_ID && x.AttachSourceId == FileId).Select(x => x.WeldJointId).ToList();
string sqlData = @"select a.WeldJointId JOT_ID ,a.WeldJointCode JOT_JointNo,c.WelderCode WED_Code,a.WeldingLocationId JOT_Location,b.WeldingDate JOT_WeldDate ,'/' DetectionTypeCode ,'/' IsRepair,'/' IsHotProcess,x,y,x2,y2
,(case PointState
when '100' then ''
when '102' then ''
when '101' then ''
when '104' then '' end) as JOT_JointStatus from HJGL_WeldJoint a
left join HJGL_WeldingDaily b on a.WeldingDailyId=b.WeldingDailyId
left join SitePerson_Person AS c ON a.BackingWelderId = c.SitePersonId
LEFT JOIN dbo.HJGL_Batch_PointBatchItem pointItem ON pointItem.WeldJointId = a.WeldJointId
WHERE a.ProjectId = @ProjectId and a.WeldJointId in ('" + string.Join("','", jotids) + "') ";
SqlParameter[] parameter1 = new SqlParameter[] { new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId) };
DataTable tb1 = SQLHelper.GetDataTableRunText(sqlData, parameter1);
2026-05-30 12:34:20 +08:00
string sqlTrust = @"select a.WeldJointId, c.DetectionTypeCode,b.TrustType from HJGL_Batch_BatchTrustItem AS a
LEFT JOIN HJGL_Batch_BatchTrust AS b ON a.TrustBatchId = b.TrustBatchId
left join Base_DetectionType c on b.DetectionTypeId = c.DetectionTypeId
where a.WeldJointId in ('" + string.Join("','", jotids) + "') ";
2026-05-29 08:59:59 +08:00
DataTable tbTrust = SQLHelper.GetDataTableRunText(sqlTrust, null);
Dictionary<string, string> DetectionTypeDic = new Dictionary<string, string>();
Dictionary<string, string> TrustTypeDic = new Dictionary<string, string>();
if (tbTrust != null)
{
foreach (DataRow row in tbTrust.Rows)
{
string JOT_ID = row["JOT_ID"].ToString();
string DetectionTypeCode = row["DetectionTypeCode"].ToString();
string CH_TrustType = row["CH_TrustType"].ToString();
if (!DetectionTypeDic.ContainsKey(JOT_ID))
{
DetectionTypeDic.Add(JOT_ID, DetectionTypeCode);
}
if (!TrustTypeDic.ContainsKey(JOT_ID)&& CH_TrustType=="2")
{
TrustTypeDic.Add(JOT_ID, CH_TrustType);
}
}
}
string sqlCheck = @"
select HotProessTrustId ,WeldJointId from HJGL_HotProess_TrustItem
where WeldJointId in ('" + string.Join("','", jotids) + "') ";
DataTable tbCheck = SQLHelper.GetDataTableRunText(sqlCheck, null);
Dictionary<string, string> HotProessDic = new Dictionary<string, string>();
if (tbCheck != null)
{
foreach (DataRow row in tbTrust.Rows)
{
string WeldJointId = row["WeldJointId"].ToString();
string HotProessTrustId = row["HotProessTrustId"].ToString();
if(!HotProessDic.ContainsKey(WeldJointId))
{
HotProessDic.Add(WeldJointId, HotProessTrustId);
}
}
}
if (tb1 != null)
{
foreach (DataRow row in tb1.Rows)
{
string JOT_ID = row["JOT_ID"].ToString();
if (DetectionTypeDic.ContainsKey(JOT_ID))
{
row["DetectionTypeCode"] = DetectionTypeDic[JOT_ID];
}
else
{
row["DetectionTypeCode"] = "/";
}
if (TrustTypeDic.ContainsKey(JOT_ID))
{
row["IsRepair"] = "是";
}
else
{
row["IsRepair"] = "/";
}
if (HotProessDic.ContainsKey(JOT_ID))
{
row["IsHotProcess"] ="是";
}
else
{
row["IsHotProcess"] = "/";
}
}
}
JointData = JsonConvert.SerializeObject(tb1);
}
}
}
}