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

331 lines
11 KiB
C#
Raw Normal View History

2026-05-29 08:59:59 +08:00
using BLL;
using BLL.Common;
2026-05-30 11:36:22 +08:00
using FineUIPro.Web.HJGL.WeldingManage;
2026-05-29 08:59:59 +08:00
using Newtonsoft.Json.Linq;
using NPOI.POIFS.Properties;
using Org.BouncyCastle.Asn1.Tsp;
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 PDFMarking : PageBase
{
2026-05-30 11:36:22 +08:00
public static Dictionary<string, List<Model.HJGL_WeldJoint>> WeldJointlist = new Dictionary<string, List<Model.HJGL_WeldJoint>>();
2026-05-29 08:59:59 +08:00
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 URL
{
get
{
return (string)ViewState["URL"];
}
set
{
ViewState["URL"] = value;
}
}
#region
/// <summary>
/// 是否PDMS
/// </summary>
private string IsPDMS
{
get
{
return (string)ViewState["IsPDMS"];
}
set
{
ViewState["IsPDMS"] = value;
}
}
#endregion
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"];
this.IsPDMS = "0";
2026-05-30 11:36:22 +08:00
if (!WeldJointlist.ContainsKey(CurrUser.PersonId))
{
WeldJointlist.Add(CurrUser.PersonId, new List<Model.HJGL_WeldJoint>());
}
else
{
WeldJointlist[ CurrUser.PersonId]= new List<Model.HJGL_WeldJoint>();
}
2026-05-29 08:59:59 +08:00
}
}
#region
/// <summary>
/// 绑定数据
/// </summary>
private void BindGrid()
{
2026-05-30 14:21:55 +08:00
if (WeldJointlist.ContainsKey(CurrUser.PersonId))
2026-05-30 11:36:22 +08:00
{
Grid1.RecordCount = WeldJointlist[CurrUser.PersonId].Count;
Grid1.DataSource = WeldJointlist[CurrUser.PersonId];
}
else
{
Grid1.RecordCount = 0;
Grid1.DataSource = null;
}
Grid1.DataBind();
2026-05-29 08:59:59 +08:00
}
#endregion
#region
/// <summary>
/// Grid行双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop("请选择一条记录", MessageBoxIcon.Warning);
return;
}
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, Const.HJGL_DataInMenuId, Const.BtnIn))
{
2026-05-30 11:36:22 +08:00
DataInEdit.dic[Grid1.SelectedRowID] = WeldJointlist[CurrUser.PersonId].FirstOrDefault(x => x.WeldJointId == Grid1.SelectedRowID);
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("DataInEdit.aspx?WeldJointId={0}", Grid1.SelectedRowID, "维护 - ")));
2026-05-29 08:59:59 +08:00
}
else
{
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
}
}
#endregion
#region
/// <summary>
/// 导入信息编辑
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuEdit_Click(object sender, EventArgs e)
{
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, BLL.Const.HJGL_DataInMenuId, BLL.Const.BtnIn))
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop("请选择一条记录", MessageBoxIcon.Warning);
return;
}
2026-05-30 11:36:22 +08:00
DataInEdit.dic[Grid1.SelectedRowID] = WeldJointlist[CurrUser.PersonId].FirstOrDefault(x=>x.WeldJointId == Grid1.SelectedRowID);
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("DataInEdit.aspx?WeldJointId={0}", Grid1.SelectedRowID, "维护 - ")));
2026-05-29 08:59:59 +08:00
}
else
{
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
}
}
/// <summary>
/// 删除按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuDelete_Click(object sender, EventArgs e)
{
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, Const.HJGL_DataInMenuId, Const.BtnIn))
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning);
return;
}
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
{
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
2026-05-30 11:36:22 +08:00
var WeldJoint = WeldJointlist[CurrUser.PersonId].FirstOrDefault(x => x.WeldJointId == rowID);
WeldJointlist[CurrUser.PersonId].Remove(WeldJoint);
2026-05-29 08:59:59 +08:00
}
ShowNotify("删除成功!", MessageBoxIcon.Success);
this.BindGrid();
}
else
{
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
return;
}
}
#endregion
#region
/// <summary>
/// 分页
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
{
BindGrid();
}
/// <summary>
/// 排序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
{
BindGrid();
}
#endregion
#region
/// <summary>
/// 保存审核事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
btnSaveMethod(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, this.IsPDMS);
this.BindGrid();
}
protected void btnRefresh_Click(object sender, EventArgs e)
{
this.BindGrid();
}
protected void btnSaveMethod(string LoginProjectId, string UserId, string IsPDMS)
{
//beginProgress();
2026-05-30 11:36:22 +08:00
Funs.DB.HJGL_WeldJoint.InsertAllOnSubmit(WeldJointlist[CurrUser.PersonId]);
2026-05-29 08:59:59 +08:00
Funs.DB.SubmitChanges();
2026-05-30 11:36:22 +08:00
WeldJointlist.Remove(CurrUser.PersonId);
2026-05-29 08:59:59 +08:00
}
#endregion
protected void btnNext_Click(object sender, EventArgs e)
{
btnImport.Hidden = false;
Grid1.Hidden = false;
contentPanel.Hidden = true;
btnNext.Hidden = true;
btnClear.Hidden = false;
var json = hdworkRecord.Value;
if (json != "{}")
{
var jsonObc = JObject.Parse(json);
var jsonArray = jsonObc.Value<JObject>("annotations").Value<JArray>("1");
var iso = Funs.DB.HJGL_Pipeline.FirstOrDefault(x => x.PipelineId == ISO_ID);
if (iso != null)
{
var unit = Funs.DB.Base_Unit.FirstOrDefault(x => x.UnitId == iso.UnitId);
2026-05-30 11:36:22 +08:00
WeldJointlist[CurrUser.PersonId] = new List<Model.HJGL_WeldJoint>();
2026-05-29 08:59:59 +08:00
for (int i = 0; i < jsonArray.Count; i++)
{
JObject item = jsonArray[i] as JObject;
Model.HJGL_WeldJoint newDataInTemp = new Model.HJGL_WeldJoint();
newDataInTemp.WeldJointId = SQLHelper.GetNewID(typeof(Model.HJGL_WeldJoint));
newDataInTemp.ProjectId = this.CurrUser.LoginProjectId;
newDataInTemp.PipelineId = iso.PipelineId;
newDataInTemp.PipelineCode = iso.PipelineCode;
newDataInTemp.WeldJointCode = item.Value<string>("label");
newDataInTemp.X = item.Value<string>("x");
newDataInTemp.Y = item.Value<string>("y");
newDataInTemp.X2 = item.Value<string>("x2");
newDataInTemp.Y2 = item.Value<string>("y2");
2026-05-30 10:09:22 +08:00
newDataInTemp.AttachSourceId = FileId;
2026-05-29 08:59:59 +08:00
newDataInTemp.WeldingMode = "手动";
2026-05-30 11:36:22 +08:00
WeldJointlist[CurrUser.PersonId].Add(newDataInTemp);
2026-05-29 08:59:59 +08:00
}
}
}
BindGrid();
}
public static string ConvertMaterial(object MaterialId)
{
if (MaterialId != null)
{
var material = Funs.DB.Base_Material.FirstOrDefault(x => x.MaterialId == MaterialId.ToString());
if (material != null)
{
return material.MaterialCode;
}
}
return null;
}
public static string ConvertWeldType(object WeldTypeId)
{
if (WeldTypeId != null)
{
var weldType = Funs.DB.Base_WeldType.FirstOrDefault(x => x.WeldTypeId == WeldTypeId.ToString());
if (weldType != null)
{
return weldType.WeldTypeCode;
}
}
return null;
}
protected void Window1_Close(object sender, WindowCloseEventArgs e)
{
BindGrid();
}
protected void btnClear_Click(object sender, EventArgs e)
{ ////先删除临时表中 该人员以前导入的数据
WeldJointlist.Clear();
this.BindGrid();
ShowNotify("删除成功!", MessageBoxIcon.Success);
}
}
}