11
This commit is contained in:
@@ -0,0 +1,109 @@
|
||||
using BLL;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace FineUIPro.Web.WeldingProcess.WeldingManage
|
||||
{
|
||||
public partial class MaterialCoodeEdit : PageBase
|
||||
{
|
||||
#region 定义项
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
public string MaterialCoodeId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["MaterialCoodeId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["MaterialCoodeId"] = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 加载
|
||||
/// <summary>
|
||||
/// 加载页面
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
this.txtCoode.Focus();
|
||||
btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
||||
this.MaterialCoodeId = Request.Params["MaterialCoodeId"];
|
||||
string flag = Request.Params["flag"];
|
||||
if (flag == "view")
|
||||
{
|
||||
this.btnSave.Hidden = true;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.MaterialCoodeId))
|
||||
{
|
||||
Model.Base_MaterialCoode Material = BLL.MaterialCoodeService.GetMaterialCoode(this.MaterialCoodeId, this.CurrUser.LoginProjectId);
|
||||
if (Material != null)
|
||||
{
|
||||
this.txtCoode.Text = Material.Coode;
|
||||
this.txtHeartNo.Text = Material.HeartNo;
|
||||
if (Material.Amount.HasValue)
|
||||
{
|
||||
txtAmount.Text = Material.Amount.Value.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 保存
|
||||
/// <summary>
|
||||
/// 保存按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
if (BLL.MaterialCoodeService.IsExistMaterialCoode(this.CurrUser.LoginProjectId, txtHeartNo.Text.Trim(), txtCoode.Text.Trim(), this.MaterialCoodeId))
|
||||
{
|
||||
Alert.ShowInTop("此物料码对应的炉批号已存在", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
Model.Base_MaterialCoode newCoode = new Model.Base_MaterialCoode
|
||||
{
|
||||
ProjectId = this.CurrUser.LoginProjectId,
|
||||
Coode = this.txtCoode.Text.Trim(),
|
||||
HeartNo = this.txtHeartNo.Text.Trim(),
|
||||
};
|
||||
if (this.txtAmount.Text != "")
|
||||
{
|
||||
newCoode.Amount = Convert.ToInt32(this.txtAmount.Text);
|
||||
}
|
||||
else
|
||||
{
|
||||
newCoode.Amount=null;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.MaterialCoodeId))
|
||||
{
|
||||
newCoode.MaterialCoodeId= this.MaterialCoodeId;
|
||||
BLL.MaterialCoodeService.UpdateMaterialCoode(newCoode);
|
||||
BLL.Sys_LogService.AddLog(Const.System_2, this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.MaterialCoodeMenuId, Const.BtnModify, this.MaterialCoodeId);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.MaterialCoodeId = SQLHelper.GetNewID(typeof(Model.Base_MaterialCoode));
|
||||
newCoode.MaterialCoodeId = this.MaterialCoodeId;
|
||||
BLL.MaterialCoodeService.AddMaterialCoode(newCoode);
|
||||
BLL.Sys_LogService.AddLog(Const.System_2, this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.MaterialCoodeMenuId, Const.BtnAdd, this.MaterialCoodeId);
|
||||
}
|
||||
|
||||
ShowNotify(Resources.Lan.SaveSuccessfully, MessageBoxIcon.Success);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user