feat(HJGL): 新增材料仓库管理并优化管线划分页面

**新增功能:**
   - 添加材料仓库管理模块(增删改查)
   - 管线划分页面支持按流水段和管线划分筛选
   - 管线划分页面支持批量设置仓库

   **技术改进:**
   - 新增 Base_Warehouse 表和模型
   - 扩展 HJGL_Pipeline 模型添加 WarehouseId 字段
   - 优化管线查询支持多条件组合
This commit is contained in:
2026-03-05 19:26:36 +08:00
parent 5b89af7fa0
commit b9f4db1a04
18 changed files with 1533 additions and 13 deletions
@@ -53,6 +53,15 @@ namespace FineUIPro.Web.HJGL.PreDesign
this.InitTreeMenu();//加载树
PipelineComplete = 0;
PipelineNOComplete = 0;
// 初始化仓库下拉框
Base_WarehouseService.InitWarehouseDropDownList(this.ddlWarehouse, this.CurrUser.LoginProjectId, true, "-请选择-");
// 初始化流水段下拉框
this.InitFlowingSectionDropDownList();
// 初始化管线划分下拉框
this.InitPipeAreaDropDownList();
}
}
@@ -150,6 +159,7 @@ namespace FineUIPro.Web.HJGL.PreDesign
/// <param name="e"></param>
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
{
InitFlowingSectionDropDownList();
this.BindGrid();
// var q = view_HJGL_Pipelines.Where(x => x.PipeArea == PipelineService.PipeArea_SHOP);
// if (q.Any())
@@ -190,13 +200,26 @@ namespace FineUIPro.Web.HJGL.PreDesign
view_HJGL_Pipeline.SingleName = this.txtSingleName.Text.Trim();
// view_HJGL_Pipeline.MaterialCode=this.txtMaterialCode.Text.Trim();
var list = BLL.PipelineService.GetHJGL_PipelineList(view_HJGL_Pipeline);
if (!string.IsNullOrEmpty(this.txtMaterialCode.Text.Trim()))
/* if (!string.IsNullOrEmpty(this.txtMaterialCode.Text.Trim()))
{
list = (from x in list
join y in Funs.DB.HJGL_PipeLineMat on x.PipelineId equals y.PipelineId
where y.MaterialCode.Contains(txtMaterialCode.Text.Trim())
select x).Distinct().ToList();
}*/
// 流水段查询
if ( this.ddlFlowingSection.SelectedValue != Const._Null)
{
list = list.Where(x => x.FlowingSection == this.ddlFlowingSection.SelectedValue).ToList();
}
// 管线划分查询
if (this.ddlPipeArea.SelectedValue!=Const._Null)
{
list = list.Where(x => x.PipeArea == this.ddlPipeArea.SelectedValue).ToList();
}
view_HJGL_Pipelines = list;
// 2.获取当前分页数据
Grid1.RecordCount = list.Count();
@@ -205,8 +228,23 @@ namespace FineUIPro.Web.HJGL.PreDesign
// 3.绑定到Grid
// 获取仓库名称
var warehouseList = Base_WarehouseService.GetWarehouseList(this.CurrUser.LoginProjectId);
var listWithWarehouse = (from x in list
join y in warehouseList on x.WarehouseId equals y.WarehouseId into temp
from z in temp.DefaultIfEmpty()
select new
{
x.PipelineId,
x.PipelineCode,
x.FlowingSection,
x.PipeArea,
x.UnitWorkId,
x.ProjectId,
WarehouseName = z != null ? z.WarehouseName : ""
}).ToList();
var table = this.GetPagedDataTable(Grid1, list);
var table = this.GetPagedDataTable(Grid1, listWithWarehouse);
Grid1.DataSource = table;
Grid1.DataBind();
//lbSinglePreRate.Text= GetSinglePreRateByUnitWork(this.tvControlItem.SelectedNodeID);
@@ -364,11 +402,47 @@ namespace FineUIPro.Web.HJGL.PreDesign
BindGrid();
}
/// <summary>
/// 仓库设置按钮
/// </summary>
protected void btnSetWarehouse_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
return;
}
string warehouseId = this.ddlWarehouse.SelectedValue;
if (string.IsNullOrEmpty(warehouseId))
{
Alert.ShowInTop("请选择仓库!", MessageBoxIcon.Warning);
return;
}
// 批量更新
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
{
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
var pipeline = PipelineService.GetPipelineByPipelineId(rowID);
if (pipeline != null)
{
pipeline.WarehouseId = warehouseId;
PipelineService.UpdatePipeline(pipeline);
}
}
BindGrid();
ShowNotify("批量设置仓库成功!", MessageBoxIcon.Success);
}
protected void btnRset_Click(object sender, EventArgs e)
{
txtPipelineCode.Text = String.Empty;
txtSingleName.Text = String.Empty;
txtMaterialCode.Text = String.Empty;
//txtMaterialCode.Text = String.Empty;
ddlFlowingSection.SelectedValue = Const._Null;
ddlPipeArea.SelectedValue = String.Empty;
BindGrid();
}
@@ -392,6 +466,49 @@ namespace FineUIPro.Web.HJGL.PreDesign
}
return PipeAreaValue;
}
#region
/// <summary>
/// 初始化流水段下拉框
/// </summary>
private void InitFlowingSectionDropDownList()
{
var baseQuery = from x in Funs.DB.HJGL_Pipeline
where x.ProjectId == this.CurrUser.LoginProjectId
select new {
x.FlowingSection ,
x.UnitWorkId
};
if (!string.IsNullOrEmpty(tvControlItem.SelectedNodeID))
{
baseQuery = baseQuery.Where(x => x.UnitWorkId == tvControlItem.SelectedNodeID);
}
var flowingSections = baseQuery.Select(x=>x.FlowingSection).Distinct().OrderBy(x => x).ToList();
this.ddlFlowingSection.DataValueField = "FlowingSection";
this.ddlFlowingSection.DataTextField = "FlowingSection";
this.ddlFlowingSection.DataSource = flowingSections.Select(x => new { FlowingSection = x }).ToList();
this.ddlFlowingSection.DataBind();
Funs.FineUIPleaseSelect(this.ddlFlowingSection, "-请选择-");
}
/// <summary>
/// 初始化管线划分下拉框
/// </summary>
private void InitPipeAreaDropDownList()
{
List<System.Web.UI.WebControls.ListItem> pipeAreaList = new List<System.Web.UI.WebControls.ListItem>();
pipeAreaList.Add(new System.Web.UI.WebControls.ListItem("工厂预制", PipelineService.PipeArea_SHOP));
pipeAreaList.Add(new System.Web.UI.WebControls.ListItem("现场施工", PipelineService.PipeArea_FIELD));
this.ddlPipeArea.DataValueField = "Value";
this.ddlPipeArea.DataTextField = "Text";
this.ddlPipeArea.DataSource = pipeAreaList;
this.ddlPipeArea.DataBind();
Funs.FineUIPleaseSelect(this.ddlPipeArea, "-请选择-");
}
#endregion
/// <summary>
/// 获取图纸预制率(工厂预制管线的预制达因/工厂预制管线的总达因)
/// </summary>