using BLL; using BLL.Common; 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 { public List WeldJointlist { get { return (List)ViewState["ISO_ID"]; } set { ViewState["ISO_ID"] = value; } } 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 定义项 /// /// 是否PDMS /// 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"; WeldJointlist = new List(); } } #region 绑定数据 /// /// 绑定数据 /// private void BindGrid() { Grid1.RecordCount = WeldJointlist.Count; Grid1.DataSource = WeldJointlist; Grid1.DataBind(); } #endregion #region 双击事件 /// /// Grid行双击事件 /// /// /// 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)) { PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("DataInEdit.aspx?TempId={0}", Grid1.SelectedRowID, "维护 - "))); } else { ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning); } } #endregion #region 导入信息 维护 /// /// 导入信息编辑 /// /// /// 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; } PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("DataInEdit.aspx?TempId={0}", Grid1.SelectedRowID, "维护 - "))); } else { ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning); } } /// /// 删除按钮 /// /// /// 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(); var WeldJoint = WeldJointlist.FirstOrDefault(x => x.WeldJointId == rowID); WeldJointlist.Remove(WeldJoint); } ShowNotify("删除成功!", MessageBoxIcon.Success); this.BindGrid(); } else { Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning); return; } } #endregion #region 分页 排序 /// /// 分页 /// /// /// protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) { BindGrid(); } /// /// 排序 /// /// /// protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e) { BindGrid(); } #endregion #region 保存审核事件 /// /// 保存审核事件 /// /// /// 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(); Funs.DB.HJGL_WeldJoint.InsertAllOnSubmit(WeldJointlist); Funs.DB.SubmitChanges(); } #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("annotations").Value("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); WeldJointlist = new List(); 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("label"); newDataInTemp.X = item.Value("x"); newDataInTemp.Y = item.Value("y"); newDataInTemp.X2 = item.Value("x2"); newDataInTemp.Y2 = item.Value("y2"); newDataInTemp.AttachSourceId = FileId; newDataInTemp.WeldingMode = "手动"; WeldJointlist.Add(newDataInTemp); } } } 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); } } }