feat(HJGL): 新增材料仓库管理并优化管线划分页面
**新增功能:** - 添加材料仓库管理模块(增删改查) - 管线划分页面支持按流水段和管线划分筛选 - 管线划分页面支持批量设置仓库 **技术改进:** - 新增 Base_Warehouse 表和模型 - 扩展 HJGL_Pipeline 模型添加 WarehouseId 字段 - 优化管线查询支持多条件组合
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
using BLL;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace FineUIPro.Web.HJGL.BaseInfo
|
||||
{
|
||||
public partial class WarehouseEdit : PageBase
|
||||
{
|
||||
#region 定义项
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
public string WarehouseId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["WarehouseId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["WarehouseId"] = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 加载
|
||||
/// <summary>
|
||||
/// 加载页面
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
this.txtWarehouseName.Focus();
|
||||
btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
||||
this.WarehouseId = Request.Params["WarehouseId"];
|
||||
if (!string.IsNullOrEmpty(this.WarehouseId))
|
||||
{
|
||||
Model.Base_Warehouse warehouse = BLL.Base_WarehouseService.GetWarehouseByWarehouseId(this.WarehouseId);
|
||||
if (warehouse != null)
|
||||
{
|
||||
this.txtWarehouseName.Text = warehouse.WarehouseName;
|
||||
this.txtRemark.Text = warehouse.Remark;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 保存
|
||||
/// <summary>
|
||||
/// 保存按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
// 唯一性检查:仓库名称在项目内不能重复
|
||||
var q = Funs.DB.Base_Warehouse.FirstOrDefault(x => x.WarehouseName == this.txtWarehouseName.Text.Trim()
|
||||
&& (x.WarehouseId != this.WarehouseId || (this.WarehouseId == null && x.WarehouseId != null))
|
||||
&& x.ProjectId == this.CurrUser.LoginProjectId);
|
||||
if (q != null)
|
||||
{
|
||||
Alert.ShowInTop("此仓库名称已存在!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
Model.Base_Warehouse newWarehouse = new Model.Base_Warehouse
|
||||
{
|
||||
WarehouseName = this.txtWarehouseName.Text.Trim(),
|
||||
Remark = this.txtRemark.Text.Trim(),
|
||||
ProjectId = this.CurrUser.LoginProjectId,
|
||||
ModifyUserId = this.CurrUser.PersonId,
|
||||
ModifyTime = DateTime.Now
|
||||
};
|
||||
|
||||
if (!string.IsNullOrEmpty(this.WarehouseId))
|
||||
{
|
||||
// 更新
|
||||
newWarehouse.WarehouseId = this.WarehouseId;
|
||||
BLL.Base_WarehouseService.UpdateWarehouse(newWarehouse);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 新增
|
||||
this.WarehouseId = SQLHelper.GetNewID(typeof(Model.Base_Warehouse));
|
||||
newWarehouse.WarehouseId = this.WarehouseId;
|
||||
newWarehouse.CreateUserId = this.CurrUser.PersonId;
|
||||
newWarehouse.CreateTime = DateTime.Now;
|
||||
BLL.Base_WarehouseService.AddWarehouse(newWarehouse);
|
||||
}
|
||||
|
||||
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user