新增管道颜色标识导入功能及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
@@ -22,6 +22,7 @@
<f:TextBox ID="txtPipelineCode" runat="server" Label="管线号"
EmptyText="输入查询条件" Width="280px" LabelWidth="80px" LabelAlign="Right">
</f:TextBox>
<f:HiddenField runat="server" ID="hdUnitWorkId"></f:HiddenField>
</Items>
</f:Toolbar>
@@ -56,6 +57,11 @@
EmptyText="输入查询条件"
Width="240px" LabelWidth="100px" LabelAlign="Right">
</f:TextBox>
<f:DropDownList ID="drpTypeStr" runat="server" Label="类型" Width="280px" LabelWidth="80px" LabelAlign="Right">
<f:ListItem Text="全部" Value=""></f:ListItem>
<f:ListItem Text="预制组件" Value="预制组件"></f:ListItem>
<f:ListItem Text="预制散件" Value="预制散件"></f:ListItem>
</f:DropDownList>
<f:ToolbarFill ID="ToolbarFill2" runat="server">
</f:ToolbarFill>
<f:Button ID="btnSearch" Icon="SystemSearch" Text="查询"
@@ -69,9 +75,9 @@
</Toolbars>
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="组件信息" ForceFit="false"
EnableCollapse="true" runat="server" BoxFlex="1" DataKeyNames="id" AllowCellEditing="true"
AllowColumnLocking="true" EnableColumnLines="true" ClicksToEdit="2" DataIDField="id"
AllowSorting="true" SortField="PipelineCode,PipelineComponentCode" SortDirection="ASC" OnSort="Grid1_Sort" EnableTextSelection="true"
EnableCollapse="true" runat="server" BoxFlex="1" DataKeyNames="Id" AllowCellEditing="true"
AllowColumnLocking="true" EnableColumnLines="true" ClicksToEdit="2" DataIDField="Id"
AllowSorting="true" SortField="PipelineCode,Code" SortDirection="ASC" OnSort="Grid1_Sort" EnableTextSelection="true"
AllowPaging="true" IsDatabasePaging="true" PageSize="15" OnPageIndexChange="Grid1_PageIndexChange">
<Columns>
<f:RowNumberField EnablePagingNumber="true" HeaderText="序号"
@@ -80,15 +86,15 @@
FieldType="String" HeaderText="管线号" HeaderTextAlign="Center"
TextAlign="Left" Locked="true">
</f:RenderField>
<f:RenderField Width="100px" ColumnID="Stype" DataField="Stype" SortField="Stype"
<f:RenderField Width="100px" ColumnID="TypeStr" DataField="TypeStr" SortField="TypeStr"
FieldType="String" HeaderText="类型" HeaderTextAlign="Center"
TextAlign="Left" Locked="true">
</f:RenderField>
<f:RenderField Width="120px" ColumnID="PipelineComponentCode" DataField="PipelineComponentCode" SortField="PipelineComponentCode"
FieldType="String" HeaderText="组件编号" HeaderTextAlign="Center"
<f:RenderField Width="120px" ColumnID="Code" DataField="Code" SortField="Code"
FieldType="String" HeaderText="组件编号/材料编码" HeaderTextAlign="Center"
TextAlign="Left" Locked="true">
</f:RenderField>
<f:RenderField Width="320px" ColumnID="matdef" DataField="matdef"
<f:RenderField Width="320px" ColumnID="Matdef" DataField="Matdef"
FieldType="String" HeaderText="预制散件材料描述" HeaderTextAlign="Center"
TextAlign="Left">
</f:RenderField>
@@ -104,7 +110,7 @@
FieldType="String" HeaderText="车次" HeaderTextAlign="Center"
TextAlign="Left">
</f:RenderField>
<f:RenderField Width="150px" ColumnID="FlowingSection" DataField="FlowingSection"
<f:RenderField Width="150px" ColumnID="FlowingSection" DataField="FlowingSection"
FieldType="String" HeaderText="流水段" HeaderTextAlign="Center"
TextAlign="Left">
</f:RenderField>
@@ -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");
@@ -131,6 +131,15 @@ namespace FineUIPro.Web.HJGL.PreDesign
/// </remarks>
protected global::FineUIPro.TextBox txtPipelineComponentCode;
/// <summary>
/// drpTypeStr 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpTypeStr;
/// <summary>
/// ToolbarFill2 控件。
/// </summary>
@@ -43,6 +43,9 @@
<f:RenderField Width="250px" ColumnID="PackagingCode" DataField="PackagingCode"
FieldType="String" HeaderText="包装编号" HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField>
<f:RenderField Width="100px" ColumnID="CategoryString" DataField="CategoryString"
FieldType="String" HeaderText="包装分类" HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField>
<f:RenderField Width="100px" ColumnID="TypeString" DataField="TypeString"
FieldType="String" HeaderText="货物类型" HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField>
@@ -17,11 +17,19 @@
<f:TextBox ID="txtPackagingCode" runat="server" Label="包装编号" LabelAlign="Right"
LabelWidth="140px">
</f:TextBox>
<f:DropDownList ID="drpTypeInt" runat="server" Label="货物类型" ColumnWidth="20%" OnSelectedIndexChanged="drpTypeInt_SelectedIndexChanged" AutoPostBack="true"
LabelWidth="140px" LabelAlign="Right" Width="170px">
</f:DropDownList>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:DropDownList ID="droCategoryInt" runat="server" Label="包装分类" ColumnWidth="20%" AutoSelectFirstItem="false" EmptyText="-请选择-" Required="true" ShowRedStar="true"
LabelWidth="140px" LabelAlign="Right" Width="170px">
</f:DropDownList>
<f:DropDownList ID="drpTypeInt" runat="server" Label="货物类型" ColumnWidth="20%" OnSelectedIndexChanged="drpTypeInt_SelectedIndexChanged" AutoPostBack="true"
LabelWidth="140px" LabelAlign="Right" Width="170px" EmptyText="-请选择-" >
</f:DropDownList>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:DropDownBox runat="server" ID="dropPipelineComponentCode" EmptyText="请从下拉表格中选择" Label="预制组件" LabelWidth="140px" LabelAlign="Right" EnableMultiSelect="true" MatchFieldWidth="false" Hidden="true">
@@ -77,7 +85,7 @@
<%-- <f:TextBox ID="txtTrainNumber" runat="server" Label="车次" LabelAlign="Right"
LabelWidth="180px">
</f:TextBox>--%>
<f:DropDownList runat="server" ID="drpTrainNumber" EnableEdit="true" ForceSelection="false" Label="车次" LabelWidth="140px" LabelAlign="Right">
<f:DropDownList runat="server" ID="drpTrainNumber" EnableEdit="true" ForceSelection="false" Label="发货编号" LabelWidth="140px" LabelAlign="Right" AutoSelectFirstItem="false" EmptyText="-请选择-">
</f:DropDownList>
</Items>
</f:FormRow>
@@ -30,7 +30,10 @@ namespace FineUIPro.Web.HJGL.PreDesign
drpTypeInt.DataSource = HJGLPackagingmanageService.TypeIntMap;
drpTypeInt.DataBind();
droCategoryInt.DataTextField = "Key";
droCategoryInt.DataValueField = "Value";
droCategoryInt.DataSource = HJGLPackagingmanageService.CategoryIntMap;
droCategoryInt.DataBind();
btnClose.OnClientClick = ActiveWindow.GetHideReference();
if (!string.IsNullOrEmpty(PackagingManageId))
{
@@ -41,6 +44,7 @@ namespace FineUIPro.Web.HJGL.PreDesign
txtStackingPosition.Text = model.StackingPosition;
drpTrainNumber.SelectedValue = model.TrainNumberId;
drpTypeInt.SelectedValue = model.TypeInt.ToString();
droCategoryInt.SelectedValue = model.CategoryInt.ToString();
if (model.State == HJGLPackagingmanageService.state_0)
{
btnSave.Hidden = false;
@@ -92,6 +96,7 @@ namespace FineUIPro.Web.HJGL.PreDesign
//table.ContactPhone = txtContactPhone.Text;
table.TrainNumberId = drpTrainNumber.SelectedValue;
table.TypeInt = int.Parse(drpTypeInt.SelectedValue);
table.CategoryInt = int.Parse(droCategoryInt.SelectedValue);
table.CompileMan = this.CurrUser.PersonId;
table.CompileDate = DateTime.Now;
if (drpTypeInt.SelectedValue == ((int)HJGLPackagingmanageService.TypeInt.).ToString())
@@ -115,6 +120,7 @@ namespace FineUIPro.Web.HJGL.PreDesign
//table.ContactPhone =txtContactPhone.Text;
table.TrainNumberId = drpTrainNumber.SelectedValue;
table.TypeInt = int.Parse(drpTypeInt.SelectedValue);
table.CategoryInt = int.Parse(droCategoryInt.SelectedValue);
if (drpTypeInt.SelectedValue == ((int)HJGLPackagingmanageService.TypeInt.).ToString())
{
table.PipelineComponentId = string.Join(",", dropPipelineComponentCode.Values);
@@ -50,6 +50,15 @@ namespace FineUIPro.Web.HJGL.PreDesign
/// </remarks>
protected global::FineUIPro.TextBox txtPackagingCode;
/// <summary>
/// droCategoryInt 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList droCategoryInt;
/// <summary>
/// drpTypeInt 控件。
/// </summary>
@@ -17,7 +17,7 @@
<Rows>
<f:FormRow>
<Items>
<f:TextBox ID="txtTrainNumber" runat="server" Label="车次" MaxLength="200">
<f:TextBox ID="txtTrainNumber" runat="server" Label="发货编号" MaxLength="200">
</f:TextBox>
<f:TextBox ID="txtLicensePlateNumber" runat="server" Label="车牌号" MaxLength="200">
</f:TextBox>
@@ -50,7 +50,7 @@ namespace FineUIPro.Web.HJGL.PreDesign
}
else
{
this.txtTrainNumber.Text = TrainNumberManageService.GetNewTrainNumber(this.CurrUser.LoginProjectId);
this.txtTrainNumber.Text = TrainNumberManageService.GetNewTrainNumber(this.CurrUser.LoginProjectId);
}
}
}
@@ -58,7 +58,7 @@
</f:TemplateField>
<f:RenderField Width="150px" ColumnID="TrainNumber" DataField="TrainNumber" SortField="TrainNumber"
FieldType="String" HeaderText="车次" TextAlign="Left" HeaderTextAlign="Center">
FieldType="String" HeaderText="发货编号" TextAlign="Left" HeaderTextAlign="Center">
</f:RenderField>
<f:RenderField Width="150px" ColumnID="DriverName" DataField="DriverName" SortField="DriverName"
FieldType="String" HeaderText="驾驶员姓名" TextAlign="Left" HeaderTextAlign="Center">
@@ -31,7 +31,7 @@ namespace FineUIPro.Web.HJGL.PreDesign
{
Model.HJGL_TrainNumberManage table = new Model.HJGL_TrainNumberManage();
table.ProjectId = this.CurrUser.LoginProjectId;
var tb = BLL.TrainNumberManageService.GetListByQueryModle(table, Grid1.PageIndex, Grid1.PageSize);
var tb = BLL.TrainNumberManageService.GetListByQueryModle(table, Grid1.PageIndex+1, Grid1.PageSize);
Grid1.RecordCount = tb.Total;
Grid1.DataSource = tb.Data;
Grid1.DataBind();