ZHJA_HJGL/HJGL_ZH/FineUIPro.Web/WeldMat/Stock/StockInCheckEdit.aspx.cs

156 lines
6.3 KiB
C#
Raw Normal View History

2024-05-08 17:17:11 +08:00
using System;
using BLL;
namespace FineUIPro.Web.WeldMat.Stock
{
public partial class StockInCheckEdit : PageBase
{
#region
/// <summary>
/// 主键
/// </summary>
private string StockInId
{
get
{
return (string)ViewState["StockInId"];
}
set
{
ViewState["StockInId"] = value;
}
}
#endregion
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
this.drpReviewMan.DataValueField = "UserId";
this.drpReviewMan.DataTextField = "UserName";
this.drpReviewMan.DataSource = BLL.Sys_UserService.GetUserList();
this.drpReviewMan.DataBind();
this.drpReviewMan.SelectedValue = this.CurrUser.UserId;
this.txtReviewDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
this.StockInId = Request.Params["StockInId"];
if (!string.IsNullOrEmpty(this.StockInId))
{
Model.Weld_StockIn stockIn = BLL.StockInService.GetStockInById(this.StockInId);
if (stockIn != null)
{
if (!string.IsNullOrEmpty(stockIn.WeldId))
{
var weld = BLL.WeldInfoService.GetWeldInfoById(stockIn.WeldId);
if (weld != null)
{
this.lblWeldCode.Text = weld.WeldCode;
this.lblWeldName.Text = weld.WeldName;
this.lblWeldSpec.Text = weld.WeldSpec;
if (!string.IsNullOrEmpty(weld.WeldTypeId))
{
var weldType = BLL.WeldTypeService.GetWeldTypeById(weld.WeldTypeId);
if (weldType!=null)
{
this.lblWeldType.Text = weldType.WeldTypeName;
this.lblWeldUnit.Text = weldType.WeldUnit;
}
}
}
if (stockIn.Amount.HasValue)
{
this.lblAmount.Text = stockIn.Amount.ToString();
}
if (stockIn.Weight.HasValue)
{
this.lblWeight.Text = stockIn.Weight.ToString();
}
if (!string.IsNullOrEmpty(stockIn.Materialman))
{
var user = BLL.Sys_UserService.GetUsersByUserId(stockIn.Materialman);
if (user != null)
{
this.lblMaterialman.Text = user.UserName;
}
}
if (stockIn.InStockDate.HasValue)
{
this.lblInStockDate.Text = string.Format("{0:yyyy-MM-dd}", stockIn.InStockDate);
}
if (!string.IsNullOrEmpty(stockIn.ReviewMan))
{
this.drpReviewMan.SelectedValue = stockIn.ReviewMan;
}
if (stockIn.ReviewDate.HasValue)
{
this.txtReviewDate.Text = string.Format("{0:yyyy-MM-dd}", stockIn.ReviewDate);
}
this.rblReviewResult.SelectedValue = stockIn.ReviewResult == "0" ? "0" : "1";
this.lblWarrantybook.Text = stockIn.Warrantybook;
}
}
}
}
}
#endregion
#region
/// <summary>
/// 保存按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
SaveData();
ShowNotify("保存成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
/// <summary>
/// 保存数据
/// </summary>
private void SaveData()
{
Model.Weld_StockIn stockIn = new Model.Weld_StockIn();
stockIn.ReviewMan = this.drpReviewMan.SelectedValue;
stockIn.ReviewDate = Funs.GetNewDateTime(this.txtReviewDate.Text.Trim());
stockIn.ReviewResult = this.rblReviewResult.SelectedValue;
if (!string.IsNullOrEmpty(this.StockInId))
{
stockIn.StockInId = this.StockInId;
BLL.StockInService.UpdateStockInCheck(stockIn);
BLL.Sys_LogService.AddLog(Const.System_7, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "修改焊材入库复验");
}
}
#endregion
#region
/// <summary>
/// 上传附件资源
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnAttachUrl_Click(object sender, EventArgs e)
{
string edit = "0"; // 表示能打开附件上传窗口,但不能上传附件
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.CLGL_StockInCheckMenuId, BLL.Const.BtnSave))
{
//edit = "1";
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/WeldMat/StockIn&menuId={1}&edit={2}", this.StockInId, Const.CLGL_StockInMenuId, edit)));
}
}
#endregion
}
}