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); string sqlTrust = @"select a.JOT_ID, c.DetectionTypeCode,b.CH_TrustType from CH_TrustItem AS a LEFT JOIN CH_Trust AS b ON a.CH_TrustID = b.CH_TrustID left join Base_DetectionType c on b.CH_NDTMethod = c.DetectionTypeId where a.JOT_ID in ('" + string.Join("','", jotids) + "') "; DataTable tbTrust = SQLHelper.GetDataTableRunText(sqlTrust, null); Dictionary DetectionTypeDic = new Dictionary(); Dictionary TrustTypeDic = new Dictionary(); 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 HotProessDic = new Dictionary(); 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); } } } }