新增管道颜色标识导入功能及API控制器

更新了多个服务和页面,增加了导入管道颜色标识数据的功能,并实现了包装管理、车次管理、管道组件和焊口信息的API控制器。修正了文件路径错误,优化了分页和排序逻辑,删除了不再使用的API方法。
This commit is contained in:
2025-10-24 10:04:03 +08:00
parent 55b798135c
commit c23d113eae
55 changed files with 1502 additions and 817 deletions
@@ -1,5 +1,6 @@
using BLL;
using MiniExcelLibs;
using Model;
using System;
using System.Collections.Generic;
using System.Data;
@@ -12,7 +13,7 @@ namespace FineUIPro.Web.HJGL.PreDesign
public partial class InstallList : PageBase
{
public int pageSize = 20;
public static DataTable GridDataTable = new DataTable();
public static IQueryable<View_HJGL_InstallData> GridDataTable = null;
protected void Page_Load(object sender, EventArgs e)
{
@@ -213,11 +214,10 @@ namespace FineUIPro.Web.HJGL.PreDesign
private void BindGrid()
{
if (tvControlItem.SelectedNode == null) return;
DataTable tb = BindData();
GridDataTable = tb;
// 2.获取当前分页数据
Grid1.RecordCount = tb.Rows.Count;
var table = this.GetPagedDataTable(Grid1, tb);
var view_HJGL_InstallDatas = BindData(Grid1.PageIndex+1, Grid1.PageSize,out int totalCount);
// 2.获取当前分页数据
Grid1.RecordCount = totalCount;
var table = view_HJGL_InstallDatas;
Grid1.DataSource = table;
Grid1.DataBind();
}
@@ -226,63 +226,33 @@ namespace FineUIPro.Web.HJGL.PreDesign
/// 查询数据
/// </summary>
/// <returns></returns>
private DataTable BindData()
private List<View_HJGL_InstallData> BindData(int pageIndex, int pageSize, out int totalCount)
{
string strSql = @"WITH cte as (select newid()as id,pipeline.PipelineCode as PipelineCode,
comonent.PipelineComponentCode as PipelineComponentCode,
'预制组件' as Stype,
'' as matdef,
packdetail.Number as Number,
pack.PackagingCode as PackagingCode,
trainnumber.TrainNumber as TrainNumber,
pipeline.FlowingSection as FlowingSection,
pipeline.UnitWorkId as UnitWorkId
from HJGL_Pipeline pipeline
left join HJGL_PackagingManageDetail packdetail on pipeline.PipelineId = packdetail.PipelineId
left join HJGL_Pipeline_Component comonent
on packdetail.PipelineComponentId = comonent.PipelineComponentId
left join HJGL_PackagingManage pack on packdetail.PackagingManageId = pack.PackagingManageId
left join HJGL_TrainNumberManage trainnumber on pack.TrainNumberId = TrainNumber.Id
where (packdetail.PipelineComponentId is not null or packdetail.PipelineComponentId != '')
union all
select newid()as id,pipeline.PipelineCode as PipelineCode,
packdetail.MaterialCode as PipelineComponentCode,
'预制散件' as Stype,
matlib.MaterialDef as matdef,
packdetail.Number as Number,
pack.PackagingCode as PackagingCode,
trainnumber.TrainNumber as TrainNumber,
pipeline.FlowingSection as FlowingSection,
pipeline.UnitWorkId as UnitWorkId
from HJGL_Pipeline pipeline
left join HJGL_PackagingManageDetail packdetail on pipeline.PipelineId = packdetail.PipelineId
left join HJGL_MaterialCodeLib matlib on packdetail.MaterialCode = matlib.MaterialCode
left join HJGL_PackagingManage pack on packdetail.PackagingManageId = pack.PackagingManageId
left join HJGL_TrainNumberManage trainnumber on pack.TrainNumberId = TrainNumber.Id
where (packdetail.PipelineComponentId is null or packdetail.PipelineComponentId = ''))
SELECT * FROM cte WHERE 1=1 ";
List<SqlParameter> listStr = new List<SqlParameter>();
var baseQuery=from x in Funs.DB.View_HJGL_InstallData
where x.ProjectId == this.CurrUser.LoginProjectId
select x;
if (tvControlItem.SelectedNode.CommandName.Split('|').Length == 2)
{
strSql += " and cte.UnitWorkId =@UnitWorkId";
listStr.Add(new SqlParameter("@UnitWorkId", this.tvControlItem.SelectedNodeID));
baseQuery = baseQuery.Where(x => x.UnitWorkId == tvControlItem.SelectedNode.NodeID);
}
else if (tvControlItem.SelectedNode.CommandName == "流水段")
{
strSql += " and cte.FlowingSection = @FlowingSection ";
listStr.Add(new SqlParameter("@FlowingSection", this.tvControlItem.SelectedNode.Text));
}
baseQuery = baseQuery.Where(x => x.UnitWorkId == tvControlItem.SelectedNode.ParentNode.NodeID && x.FlowingSection == tvControlItem.SelectedNode.Text);
}
if (!string.IsNullOrEmpty(txtPipelineCode2.Text))
{
strSql += " AND cte.PipelineCode like @PipelineCode";
listStr.Add(new SqlParameter("@PipelineCode", "%" + this.txtPipelineCode2.Text.Trim() + "%"));
}
baseQuery = baseQuery.Where(x => x.PipelineCode.Contains(txtPipelineCode2.Text.Trim()));
}
if (!string.IsNullOrEmpty(txtPipelineComponentCode.Text))
{
strSql += " AND cte.PipelineComponentCode like @PipelineComponentCode";
listStr.Add(new SqlParameter("@PipelineComponentCode", "%" + this.txtPipelineComponentCode.Text.Trim() + "%"));
baseQuery = baseQuery.Where(x => x.Code.Contains(txtPipelineComponentCode.Text.Trim()));
}
if (!string.IsNullOrEmpty(drpTypeStr.SelectedValue))
{
baseQuery = baseQuery.Where(x => x.TypeStr.Contains(drpTypeStr.SelectedValue));
}
//if (!string.IsNullOrEmpty(drpFlowingSection.SelectedValue) && drpFlowingSection.SelectedValue != Const._Null)
//{
@@ -291,13 +261,17 @@ namespace FineUIPro.Web.HJGL.PreDesign
//}
if (!string.IsNullOrEmpty(txtPipelineCode.Text))
{
strSql += " AND cte.PipelineCode like @pipeline";
listStr.Add(new SqlParameter("@pipeline", "%" + this.txtPipelineCode.Text.Trim() + "%"));
}
strSql += " ORDER BY PipelineCode,PipelineComponentCode ";
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
return tb;
baseQuery = baseQuery.Where(x => x.PipelineCode.Contains(txtPipelineCode.Text.Trim()));
}
baseQuery = baseQuery.OrderBy(x => x.PipelineCode).ThenBy(x => x.Code);
totalCount = baseQuery.Count();
GridDataTable = baseQuery;
// 分页保护
if (pageIndex <= 0) pageIndex = 1;
if (pageSize <= 0) pageSize = 10;
var query = baseQuery.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList();
return query;
}
#endregion
@@ -392,17 +366,17 @@ namespace FineUIPro.Web.HJGL.PreDesign
{
if (GridDataTable != null)
{
var q = (from x in GridDataTable.AsEnumerable()
var q = (from x in GridDataTable
select new
{
线 = x.Field<string>("PipelineCode"),
= x.Field<string>("Stype"),
= x.Field<string>("PipelineComponentCode"),
= !string.IsNullOrWhiteSpace(x.Field<string>("matdef")) ? x.Field<string>("matdef") : "-",
= x.Field<decimal?>("Number"),
= x.Field<string>("PackagingCode"),
= x.Field<string>("TrainNumber"),
= x.Field<string>("FlowingSection")
线 = x.PipelineCode,
= x.TypeStr,
= x.Code,
= x.Matdef??"-",
= x.Number,
= x.PackagingCode,
= x.TrainNumber,
= x.FlowingSection
});
string path = Funs.RootPath + @"File\Excel\Temp\PrePipelineInstallList.xlsx";
path = path.Replace(".xlsx", string.Format("{0:yyyy-MM-dd}", DateTime.Now) + ".xlsx");