217 lines
8.5 KiB
C#
217 lines
8.5 KiB
C#
using BLL;
|
|
using BLL.Common;
|
|
|
|
using Newtonsoft.Json;
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
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;
|
|
}
|
|
}
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
|
|
ISO_ID = Request.Params["ISO_ID"];
|
|
FileId = Request.Params["FileId"];
|
|
URL = Funs.HJGLUrl + Request.Params["pdfurl"];
|
|
annotionData.Value = DrawingInfoService.GetDrawingJson(FileId) ?? "{}";
|
|
|
|
var iso = Funs.DB.HJGL_PW_IsoInfo.FirstOrDefault(x => x.ISO_ID == ISO_ID);
|
|
if (iso != null)
|
|
{
|
|
UnitName = Funs.DB.Base_Unit.FirstOrDefault(x => x.UnitId == iso.BSU_ID)?.UnitName;
|
|
}
|
|
|
|
var jotids = Funs.DB.HJGL_PW_JointInfo.Where(x => x.ISO_ID == ISO_ID && x.AttachSourceId == FileId).Select(x => x.JOT_ID).ToList();
|
|
|
|
string sqlData = @"select a.JOT_ID ,a.JOT_JointNo,c.WED_Code,JOT_Location,b.JOT_WeldDate ,'/' DetectionTypeCode ,'/' IsRepair,'/' IsHotProcess,x,y,x2,y2
|
|
,(case a.JOT_JointStatus
|
|
when '100' then '正常'
|
|
when '102' then '扩透'
|
|
when '101' then '点口'
|
|
when '104' then '已切除' end) as JOT_JointStatus from HJGL_PW_JointInfo a
|
|
left join HJGL_BO_WeldReportMain b on a.DReportID=b.DReportID
|
|
left join HJGL_bs_welder AS c ON a.JOT_FloorWelder = c.wed_id
|
|
WHERE a.ProjectId = @ProjectId and a.JOT_ID 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<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 tbCheck.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"] = "/";
|
|
}
|
|
}
|
|
}
|
|
|
|
annotionData.Value = ExtendDrawingJson(annotionData.Value, tb1);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 将焊口业务字段扩展到对应标注中。
|
|
/// </summary>
|
|
private static string ExtendDrawingJson(string drawingJson, DataTable jointTable)
|
|
{
|
|
JObject drawing = JObject.Parse(string.IsNullOrWhiteSpace(drawingJson) ? "{}" : drawingJson);
|
|
JObject annotations = drawing.Value<JObject>("annotations");
|
|
if (annotations == null || jointTable == null || jointTable.Rows.Count == 0)
|
|
{
|
|
return drawing.ToString(Formatting.None);
|
|
}
|
|
|
|
foreach (JObject annotation in annotations.Properties()
|
|
.SelectMany(x => (x.Value as JArray) ?? new JArray())
|
|
.OfType<JObject>())
|
|
{
|
|
string label = annotation.Value<string>("label");
|
|
DataRow jointRow = jointTable.Rows.Cast<DataRow>()
|
|
.FirstOrDefault(x => string.Equals(
|
|
x["JOT_JointNo"].ToString(),
|
|
label,
|
|
StringComparison.OrdinalIgnoreCase));
|
|
if (jointRow == null)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
annotation["JOT_ID"] = jointRow["JOT_ID"].ToString();
|
|
annotation["JOT_JointNo"] = jointRow["JOT_JointNo"].ToString();
|
|
annotation["WED_Code"] = jointRow["WED_Code"].ToString();
|
|
annotation["JOT_Location"] = jointRow["JOT_Location"].ToString();
|
|
annotation["JOT_WeldDate"] = jointRow["JOT_WeldDate"].ToString();
|
|
annotation["DetectionTypeCode"] = jointRow["DetectionTypeCode"].ToString();
|
|
annotation["IsRepair"] = jointRow["IsRepair"].ToString();
|
|
annotation["IsHotProcess"] = jointRow["IsHotProcess"].ToString();
|
|
annotation["JOT_JointStatus"] = jointRow["JOT_JointStatus"].ToString();
|
|
}
|
|
|
|
return drawing.ToString(Formatting.None);
|
|
}
|
|
|
|
}
|
|
}
|