试压管理修改

This commit is contained in:
2025-08-18 10:15:28 +08:00
parent b81501713e
commit edebefa3c9
26 changed files with 1351 additions and 1315 deletions
@@ -1,9 +1,11 @@
using BLL;
using FineUIPro.Web.ProjectData;
using MiniExcelLibs;
using NPOI.POIFS.Crypt.Dsig;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Web;
@@ -58,52 +60,11 @@ namespace FineUIPro.Web.HJGL.TestPackage
PipelineList.Clear();
}
errorInfos = string.Empty;
//lbVersion.Text = BLL.HJGL_DesignBasisDataImportService.GetNowVersionByUnitWorkId(Request.Params["UnitWorkId"], DataClassification).ToString();
//BindGrid2();
}
}
#endregion
//void BindGrid2()
//{
// string strSql = @" select Import.DesignBasisDataImportId
// ,Import.ProjectId
// ,Import.UnitWorkId
// ,(Case Import.ImportType when '0' then '补充导入'
// when '1' then '更新导入' end) as ImportType
// ,Import.FileName
// ,Import.FilePath
// ,Import.DataClassification
// ,Import.FileType
// ,Import.FileSize
// ,Import.FileId
// ,Import.Version
// ,Import.Remark
// ,Import.CreateMan
// ,Import.CreateDate
// , Users.PersonName
// from HJGL_DesignBasisDataImport as Import
// left join Person_Persons as Users on Users.PersonId=Import.CreateMan
// where Import.UnitWorkId=@UnitWorkId and Import.ProjectId=@ProjectId and Import.DataClassification=@DataClassification
// order by Import.CreateDate";
// List<SqlParameter> listStr = new List<SqlParameter>();
// listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
// listStr.Add(new SqlParameter("@UnitWorkId", Request.Params["UnitWorkId"]));
// //listStr.Add(new SqlParameter("@DataClassification", DataClassification));
// SqlParameter[] parameter = listStr.ToArray();
// DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
// // 2.获取当前分页数据
// //var table = this.GetPagedDataTable(Grid1, tb1);
// Grid2.RecordCount = tb.Rows.Count;
// tb = GetFilteredTable(Grid2.FilteredData, tb);
// var table = this.GetPagedDataTable(Grid2, tb);
// Grid2.DataSource = table;
// Grid2.DataBind();
// drpVersion.DataSource = BLL.HJGL_DesignBasisDataImportService.GetListVersionByUnitWorkId(Request.Params["UnitWorkId"], DataClassification);
// drpVersion.DataBind();
//}
#region
/// <summary>
/// 审核
@@ -207,7 +168,7 @@ namespace FineUIPro.Web.HJGL.TestPackage
// string result = string.Empty;
List<string> result = new List<string>();
//pds = BLL.Funs.FilterBlankLines(pds);
if (count < 5)
if (count < 11)
{
responeData.code = 0;
responeData.message = "导入Excel格式错误!Excel只有" + count.ToString().Trim() + "列";
@@ -255,7 +216,15 @@ namespace FineUIPro.Web.HJGL.TestPackage
}
if (pds[i].C != null)
{
string col2 = pds[i].C.ToString();
pipeline.AdjustTestPressure = pds[i].C.ToString();//调整试验压力
}
if (pds[i].D != null)
{
pipeline.Remark = pds[i].D.ToString(); //备注
}
if (pds[i].E != null) //管线号
{
string col2 = pds[i].E.ToString();
if (string.IsNullOrEmpty(col2))
{
result.Add("第" + (i + 1).ToString() + "行," + "管线号" + "," + "此项为必填项!" + "|");
@@ -286,14 +255,7 @@ namespace FineUIPro.Web.HJGL.TestPackage
{
result.Add("第" + (i + 1).ToString() + "行," + "管线号" + "," + "此项为必填项!" + "|");
}
if (pds[i].D != null)
{
pipeline.AdjustTestPressure = pds[i].D.ToString();
}
if (pds[i].E != null)
{
pipeline.Remark = pds[i].E.ToString();
}
pipeline.Tabler = this.CurrUser.PersonId;
pipeline.TableDate = DateTime.Now;
@@ -395,51 +357,12 @@ namespace FineUIPro.Web.HJGL.TestPackage
if (DrpType.SelectedValue == "1")//更新导入
{
//BLL.PipelineMatService.DeletePipeLineMatByUnitWorkId(unitworkId);//删除原有管线对应材料
//BLL.WeldJointService.DeleteWeldJointByUnitWorkId(unitworkId);////删除原有管线对应焊口
//BLL.PipelineService.DeletePipelineByUnitworkId(unitworkId);//删除原有管线
AddView_TestPackage_PipelineList(PipelineList);//导入数据
//Model.HJGL_DesignBasisDataImport hJGL_DesignBasisDataImport = new Model.HJGL_DesignBasisDataImport();
//hJGL_DesignBasisDataImport.DesignBasisDataImportId = SQLHelper.GetNewID();
//hJGL_DesignBasisDataImport.ProjectId = this.CurrUser.LoginProjectId;
//hJGL_DesignBasisDataImport.UnitWorkId = unitworkId;
//hJGL_DesignBasisDataImport.ImportType = "1";
//hJGL_DesignBasisDataImport.DataClassification = DataClassification;
//hJGL_DesignBasisDataImport.FileName = FileName;
//hJGL_DesignBasisDataImport.FilePath = filePath.Replace(rootPath, "");
//hJGL_DesignBasisDataImport.FileType = BLL.HJGL_DesignBasisDataImportService.GetFileType(FileName);
//hJGL_DesignBasisDataImport.Version = BLL.HJGL_DesignBasisDataImportService.GetNewVersionByUnitWorkId(unitworkId, DataClassification);
//hJGL_DesignBasisDataImport.Remark = txtRemark.Text;
//hJGL_DesignBasisDataImport.CreateMan = this.CurrUser.PersonId;
//hJGL_DesignBasisDataImport.CreateDate = DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss");
//BLL.HJGL_DesignBasisDataImportService.AddHJGL_DesignBasisDataImport(hJGL_DesignBasisDataImport);
//BLL.HJGL_DesignBasisDataImportVerSionLogService.UpdateVersion(this.CurrUser.LoginProjectId, unitworkId, (decimal)hJGL_DesignBasisDataImport.Version, DataClassification);
}
else //补充导入
{
AddView_TestPackage_PipelineList(PipelineList);
//Model.HJGL_DesignBasisDataImport hJGL_DesignBasisDataImport = new Model.HJGL_DesignBasisDataImport();
//hJGL_DesignBasisDataImport.DesignBasisDataImportId = SQLHelper.GetNewID();
//hJGL_DesignBasisDataImport.ProjectId = this.CurrUser.LoginProjectId;
//hJGL_DesignBasisDataImport.UnitWorkId = unitworkId;
//hJGL_DesignBasisDataImport.ImportType = "0";
//hJGL_DesignBasisDataImport.DataClassification = DataClassification;
//hJGL_DesignBasisDataImport.FileName = FileName;
//hJGL_DesignBasisDataImport.FilePath = filePath.Replace(rootPath, ""); ;
//hJGL_DesignBasisDataImport.FileType = BLL.HJGL_DesignBasisDataImportService.GetFileType(FileName);
//hJGL_DesignBasisDataImport.Version = BLL.HJGL_DesignBasisDataImportService.GetNowVersionByUnitWorkId(unitworkId, DataClassification);
//hJGL_DesignBasisDataImport.Remark = txtRemark.Text;
//hJGL_DesignBasisDataImport.CreateMan = this.CurrUser.PersonId;
//hJGL_DesignBasisDataImport.CreateDate = DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss");
//BLL.HJGL_DesignBasisDataImportService.AddHJGL_DesignBasisDataImport(hJGL_DesignBasisDataImport);
//BLL.HJGL_DesignBasisDataImportVerSionLogService.UpdateVersion(this.CurrUser.LoginProjectId, unitworkId, (decimal)hJGL_DesignBasisDataImport.Version, DataClassification);
}
ShowNotify("导入成功!", MessageBoxIcon.Success);
@@ -562,85 +485,9 @@ namespace FineUIPro.Web.HJGL.TestPackage
{
BLL.TestPackageEditService.AddPipelineLists(pipelineList_add);
}
//Model.SGGLDB db2 = Funs.DB;
//List<Model.PTP_PipelineList> delJoints = new List<Model.PTP_PipelineList>();
//var allWeldJoints2 = from x in db2.PTP_PipelineList
// join y in db2.PTP_TestPackage on x.PTP_ID equals y.PTP_ID
// where y.UnitWorkId == Request.Params["UnitWorkId"]
// select x;
//foreach (var pipelineCode in pipelineCodes)
//{
// var pipelineWeldJointCodes = weldJoints.Where(x => x.PTP_ID == pipelineCode).Select(x => x.PipelineId).ToList();
// var q = allWeldJoints2.Where(x => x.PTP_ID == pipelineCode && !pipelineWeldJointCodes.Contains(x.PipelineId)).ToList();
// delJoints.AddRange(q);
//}
//if (delJoints.Count() > 0)
//{
// try
// {
// db2.PTP_PipelineList.DeleteAllOnSubmit(delJoints);
// db2.SubmitChanges();
// }
// catch (Exception)
// {
// string weldJointCodes = string.Empty;
// foreach (var item in delJoints)
// {
// weldJointCodes += item.PipelineId + ",";
// }
// Alert.ShowInParent(weldJointCodes, MessageBoxIcon.Warning);
// }
//}
}
#endregion
/// <summary>
/// 恢复版本
/// </summary>
/// <param name="unitworkId"></param>
/// <param name="version"></param>
private void RestoreVersion(string unitworkId, decimal version)
{
//var model = BLL.HJGL_DesignBasisDataImportService.GetDataByUnitWorkIdAndVersion(unitworkId, version, DataClassification);
//if (model != null && model.Count > 0)
//{
// foreach (var item in model)
// {
// string rootPath = Server.MapPath("~/");
// // initFullPath = rootPath + initPath;
// string filePath = rootPath + item.FilePath;
// ImportXlsToData(filePath);
// BLL.PipelineMatService.DeletePipeLineMatByUnitWorkId(unitworkId);//删除原有管线对应材料
// BLL.WeldJointService.DeleteWeldJointByUnitWorkId(unitworkId);////删除原有管线对应焊口
// BLL.PipelineService.DeletePipelineByUnitworkId(unitworkId);//删除原有管线
// AddView_HJGL_WeldJoint(PipelineList);//导入数据
// PipelineList.Clear();
// }
// BLL.HJGL_DesignBasisDataImportVerSionLogService.UpdateVersion(this.CurrUser.LoginProjectId, unitworkId, version, DataClassification);
// PipelineService.RestPipelineAndJoints(this.CurrUser.LoginProjectId);
// ShowNotify("恢复成功!");
//}
}
protected void btnRestore_Click(object sender, EventArgs e)
{
//if (string.IsNullOrEmpty(drpVersion.SelectedValue))
//{
// ShowNotify("请选择版本");
//}
//else
//{
// PageContext.RegisterStartupScript(Confirm.GetShowReference("确定恢复至该版本吗?", String.Empty, MessageBoxIcon.Question, PageManager1.GetCustomEventReference(false, "Confirm_Restore"), PageManager1.GetCustomEventReference("Confirm_Cancel")));
//}
}
#region
/// <summary>
/// 下载模板按钮
@@ -651,7 +498,10 @@ namespace FineUIPro.Web.HJGL.TestPackage
{
PageContext.RegisterStartupScript(Confirm.GetShowReference("确定下载导入模板吗?", String.Empty, MessageBoxIcon.Question, PageManager1.GetCustomEventReference(false, "Confirm_OK"), PageManager1.GetCustomEventReference("Confirm_Cancel")));
}
protected void btnDownLoadLine_Click(object sender, EventArgs e)
{
PageContext.RegisterStartupScript(Confirm.GetShowReference("确定下载导入模板吗?", String.Empty, MessageBoxIcon.Question, PageManager1.GetCustomEventReference(false, "DownLine_Confirm_OK"), PageManager1.GetCustomEventReference("Confirm_Cancel")));
}
/// <summary>
/// 下载导入模板
/// </summary>
@@ -659,31 +509,59 @@ namespace FineUIPro.Web.HJGL.TestPackage
/// <param name="e"></param>
protected void PageManager1_CustomEvent(object sender, CustomEventArgs e)
{
if (e.EventArgument == "Confirm_OK")
string rootPath = Server.MapPath("~/");
string uploadfilepath = rootPath + Const.TestPackageTemplateUrl;
string path = uploadfilepath.Replace(".xlsx", string.Format("{0:yyyy-MM-dd-HH-mm}", DateTime.Now) + ".xlsx");
string fileName = Path.GetFileName(uploadfilepath);
if (e.EventArgument == "DownLine_Confirm_OK")
{
string rootPath = Server.MapPath("~/");
string uploadfilepath = rootPath + Const.TestPackageTemplateUrl;
string filePath = Const.TestPackageTemplateUrl;
string fileName = Path.GetFileName(filePath);
FileInfo info = new FileInfo(uploadfilepath);
long fileSize = info.Length;
Response.ClearContent();
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
Response.ContentType = "excel/plain";
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.AddHeader("Content-Length", fileSize.ToString().Trim());
Response.TransmitFile(uploadfilepath, 0, fileSize);
Response.End();
string UnitWorkId = Request.Params["UnitWorkId"];
var queryList = from x in Funs.DB.View_HJGL_Pipeline
join y in Funs.DB.PTP_PipelineList on x.PipelineId equals y.PipelineId into yGroup
from y in yGroup.DefaultIfEmpty()
where x.UnitWorkId == UnitWorkId && y==null
select new
{
x.PipelineId,
x.PipelineCode,
x.PipingClassCode,
x.MediumName,
x.DesignPress,
x.DesignTemperature,
x.TestMediumCode,
x.TestPressure
};
var value = new
{
model = queryList.ToList()
};
MiniExcel.SaveAsByTemplate(path, uploadfilepath, value);
}
//else if (e.EventArgument == "Confirm_Restore")
//{
// var unitworkid = Request.Params["UnitWorkId"];
// decimal version = decimal.Parse(drpVersion.SelectedValue);
// RestoreVersion(unitworkid, version);
//}
else if (e.EventArgument == "Confirm_OK")
{
var value = new
{
model = ""
};
MiniExcel.SaveAsByTemplate(path, uploadfilepath, value);
}
FileInfo info = new FileInfo(path);
long fileSize = info.Length;
System.Web.HttpContext.Current.Response.ClearContent();
System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
System.Web.HttpContext.Current.Response.ContentType = "excel/plain";
System.Web.HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8;
System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString().Trim());
System.Web.HttpContext.Current.Response.TransmitFile(path, 0, fileSize);
System.Web.HttpContext.Current.Response.Flush();
File.Delete(path);
System.Web.HttpContext.Current.Response.End();
}
#endregion
#region
/// <summary>
/// 分页选择下拉改变事件