ZHJA_HJGL/HJGL_ZH/FineUIPro.Web/HJGL/WeldingManage/WeldHotProcessCardEdit.aspx.cs

315 lines
15 KiB
C#

using System;
using System.Linq;
using BLL;
namespace FineUIPro.Web.HJGL.WeldingManage
{
public partial class WeldHotProcessCardEdit : PageBase
{
#region
/// <summary>
/// 主键
/// </summary>
private string WeldHpcId
{
get
{
return (string)ViewState["WeldHpcId"];
}
set
{
ViewState["WeldHpcId"] = value;
}
}
/// <summary>
/// 测温点布置示意图
/// </summary>
public string CewendianshcAttachUrl
{
get
{
return (string)ViewState["CewendianshcAttachUrl"];
}
set
{
ViewState["CewendianshcAttachUrl"] = value;
}
}
/// <summary>
/// 理论焊后热处理曲线
/// </summary>
public string LilunhanhouAttachUrl
{
get
{
return (string)ViewState["LilunhanhouAttachUrl"];
}
set
{
ViewState["LilunhanhouAttachUrl"] = value;
}
}
#endregion
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.drpUnitId.DataTextField = "UnitName";
this.drpUnitId.DataValueField = "UnitId";
this.drpUnitId.DataSource = BLL.Base_UnitService.GetUnitsByProjectUnitType(this.CurrUser.LoginProjectId, BLL.Const.UnitType_3);
this.drpUnitId.DataBind();
Funs.FineUIPleaseSelect(this.drpUnitId);
this.drpHpcId.DataTextField = "Shejiwj";
this.drpHpcId.DataValueField = "HpcId";
this.drpHpcId.DataSource = BLL.HJGL_HotProcessCardService.GetHotProcessCardList();
this.drpHpcId.DataBind();
Funs.FineUIPleaseSelect(this.drpHpcId);
this.drpguandaocz.DataValueField = "STE_ID";
this.drpguandaocz.DataTextField = "STE_Name";
this.drpguandaocz.DataSource = BLL.HJGL_MaterialService.GetSteelList();
this.drpguandaocz.DataBind();
Funs.FineUIPleaseSelect(this.drpguandaocz);
this.WeldHpcId = Request.Params["weldHpcId"];
if (!string.IsNullOrEmpty(this.WeldHpcId))
{
Model.HJGL_WeldingProcedure_WeldHotProcessCard weldHotProcessCard = BLL.HJGL_WeldHotProcessCardService.GetWeldHotProcessCardById(this.WeldHpcId);
if (weldHotProcessCard!=null)
{
if (!string.IsNullOrEmpty(weldHotProcessCard.ProjectId))
{
this.txtProjectName.Text = BLL.Base_ProjectService.GetProjectByProjectId(weldHotProcessCard.ProjectId).ProjectName;
}
this.txtHpcCode.Text = weldHotProcessCard.HpcCode;
if (!string.IsNullOrEmpty(weldHotProcessCard.UnitId))
{
this.drpUnitId.SelectedValue = weldHotProcessCard.UnitId;
}
if (!string.IsNullOrEmpty(weldHotProcessCard.HpcId))
{
this.drpHpcId.SelectedValue = weldHotProcessCard.HpcId;
}
if (!string.IsNullOrEmpty(weldHotProcessCard.Guandaocz))
{
this.drpguandaocz.SelectedValue = weldHotProcessCard.Guandaocz;
}
this.txtguandaogg.Text = weldHotProcessCard.Guandaogg;
this.txtjietouxs.Text = weldHotProcessCard.Jietouxs;
this.txtyijuhanpin.Text = weldHotProcessCard.Yijuhanpin;
this.txtkzxtxh.Text = weldHotProcessCard.Kzxtxh;
this.txtjiareqixh.Text = weldHotProcessCard.Jiareqixh;
this.txtcewenyq.Text = weldHotProcessCard.Cewenyq;
this.txtbuchangdx.Text = weldHotProcessCard.Buchangdx;
this.txtjiaredaigd.Text = weldHotProcessCard.Jiaredaigd;
this.txtbwkuandu.Text = weldHotProcessCard.Bwkuandu;
this.txtbwcailao.Text = weldHotProcessCard.Bwcailao;
this.txtbwdianshu.Text = weldHotProcessCard.Bwdianshu;
if (!string.IsNullOrEmpty(weldHotProcessCard.Hanhouchl))
{
this.cblhanhouchl.SelectedValueArray = weldHotProcessCard.Hanhouchl.Split(',');
}
this.txtjiaresd.Text = weldHotProcessCard.Jiaresd;
this.txtbwwendu.Text = weldHotProcessCard.Bwwendu;
this.txtbwshijian.Text = weldHotProcessCard.Bwshijian;
this.txtlenquesd.Text = weldHotProcessCard.Lenquesd;
this.txtewailq.Text = weldHotProcessCard.Ewailq;
this.txtqishuyq.Text = weldHotProcessCard.Qishuyq;
if (!string.IsNullOrEmpty(weldHotProcessCard.Cewendianshc))
{
this.CewendianshcAttachUrl = weldHotProcessCard.Cewendianshc;
this.imgCewendianshc.ImageUrl = "~/" + this.CewendianshcAttachUrl;
}
if (!string.IsNullOrEmpty(weldHotProcessCard.Lilunhanhou))
{
this.LilunhanhouAttachUrl = weldHotProcessCard.Lilunhanhou;
this.imgLilunhanhou.ImageUrl = "~/" + this.LilunhanhouAttachUrl;
}
}
}
else
{
this.txtProjectName.Text = BLL.Base_ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId).ProjectName;
this.drpUnitId.SelectedValue = this.CurrUser.UnitId;
}
}
}
#endregion
#region
/// <summary>
/// 提交按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
Model.HJGL_WeldingProcedure_WeldHotProcessCard weldHotProcessCard = new Model.HJGL_WeldingProcedure_WeldHotProcessCard();
weldHotProcessCard.ProjectId = this.CurrUser.LoginProjectId;
weldHotProcessCard.HpcCode = this.txtHpcCode.Text.Trim();
if (this.drpUnitId.SelectedValue != BLL.Const._Null)
{
weldHotProcessCard.UnitId = this.drpUnitId.SelectedValue;
}
if (this.drpguandaocz.SelectedValue != BLL.Const._Null)
{
weldHotProcessCard.Guandaocz = this.drpguandaocz.SelectedValue;
}
weldHotProcessCard.Guandaogg = this.txtguandaogg.Text.Trim();
weldHotProcessCard.BzPerson = this.CurrUser.UserId;
if (this.drpHpcId.SelectedValue != BLL.Const._Null)
{
weldHotProcessCard.HpcId = this.drpHpcId.SelectedValue;
weldHotProcessCard.Shejiwj = this.drpHpcId.SelectedText;
}
weldHotProcessCard.Jietouxs = this.txtjietouxs.Text.Trim();
weldHotProcessCard.Yijuhanpin = this.txtyijuhanpin.Text.Trim();
weldHotProcessCard.Kzxtxh = this.txtkzxtxh.Text.Trim();
weldHotProcessCard.Jiareqixh = this.txtjiareqixh.Text.Trim();
weldHotProcessCard.Cewenyq = this.txtcewenyq.Text.Trim();
weldHotProcessCard.Buchangdx = this.txtbuchangdx.Text.Trim();
weldHotProcessCard.Jiaredaigd = this.txtjiaredaigd.Text.Trim();
weldHotProcessCard.Bwkuandu = this.txtbwkuandu.Text.Trim();
weldHotProcessCard.Bwcailao = this.txtbwcailao.Text.Trim();
weldHotProcessCard.Bwdianshu = this.txtbwdianshu.Text.Trim();
string hcl =string.Empty;
foreach (var item in this.cblhanhouchl.SelectedValueArray)
{
hcl += item + ",";
}
if(!string.IsNullOrEmpty(hcl))
{
weldHotProcessCard.Hanhouchl = hcl.Substring(0, hcl.LastIndexOf(','));
}
weldHotProcessCard.Jiaresd = this.txtjiaresd.Text.Trim();
weldHotProcessCard.Bwwendu = this.txtbwwendu.Text.Trim();
weldHotProcessCard.Bwshijian = this.txtbwshijian.Text.Trim();
weldHotProcessCard.Lenquesd = this.txtlenquesd.Text.Trim();
weldHotProcessCard.Ewailq = this.txtewailq.Text.Trim();
weldHotProcessCard.Cewendianshc = this.CewendianshcAttachUrl;
weldHotProcessCard.Lilunhanhou = this.LilunhanhouAttachUrl;
weldHotProcessCard.Qishuyq = this.txtqishuyq.Text.Trim();
if (!string.IsNullOrEmpty(this.WeldHpcId))
{
weldHotProcessCard.WeldHpcId = this.WeldHpcId;
BLL.HJGL_WeldHotProcessCardService.UpdateWeldHotProcessCard(weldHotProcessCard);
BLL.Sys_LogService.AddLog(Const.System_3, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "修改热处理工艺卡");
}
else
{
this.WeldHpcId = SQLHelper.GetNewID(typeof(Model.HJGL_WeldingProcedure_WeldHotProcessCard));
weldHotProcessCard.WeldHpcId = this.WeldHpcId;
BLL.HJGL_WeldHotProcessCardService.AddWeldHotProcessCard(weldHotProcessCard);
BLL.Sys_LogService.AddLog(Const.System_3, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "添加热处理工艺卡");
}
Alert.ShowInTop("提交成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
}
#endregion
#region DropDownList下拉选择事件
/// <summary>
/// 设计文件、标准或合同要求下拉选择事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void drpHpcId_SelectedIndexChanged(object sender, EventArgs e)
{
if (this.drpHpcId.SelectedValue != BLL.Const._Null)
{
Model.HJGL_Base_HotProcessCard hotProcessCard = BLL.HJGL_HotProcessCardService.GetHotProcessCardById(this.drpHpcId.SelectedValue);
if (hotProcessCard != null)
{
var steel = Funs.DB.HJGL_BS_Steel.FirstOrDefault(x => x.STE_Name == hotProcessCard.Guandaocz);
if (steel != null)
{
this.drpguandaocz.SelectedValue = steel.STE_ID;
}
else
{
this.drpguandaocz.SelectedValue = hotProcessCard.Guandaocz;
}
this.txtguandaogg.Text = hotProcessCard.Guandaogg;
this.txtjietouxs.Text = hotProcessCard.Jietouxs;
this.txtyijuhanpin.Text = hotProcessCard.Yijuhanpin;
this.txtkzxtxh.Text = hotProcessCard.Kzxtxh;
this.txtjiareqixh.Text = hotProcessCard.Jiareqixh;
this.txtcewenyq.Text = hotProcessCard.Cewenyq;
this.txtbuchangdx.Text = hotProcessCard.Buchangdx;
this.txtjiaredaigd.Text = hotProcessCard.Jiaredaigd;
this.txtbwkuandu.Text = hotProcessCard.Bwkuandu;
this.txtbwcailao.Text = hotProcessCard.Bwcailao;
this.txtbwdianshu.Text = hotProcessCard.Bwdianshu;
if (!string.IsNullOrEmpty(hotProcessCard.Hanhouchl))
{
var a = hotProcessCard.Hanhouchl.Split(',');
this.cblhanhouchl.SelectedValueArray = a;
}
imgCewendianshc.ImageUrl = "~/" + hotProcessCard.Cewendianshc;
CewendianshcAttachUrl = hotProcessCard.Cewendianshc;
this.txtjiaresd.Text = hotProcessCard.Jiaresd;
this.txtbwwendu.Text = hotProcessCard.Bwwendu;
this.txtbwshijian.Text = hotProcessCard.Bwshijian;
this.txtlenquesd.Text = hotProcessCard.Lenquesd;
this.txtewailq.Text = hotProcessCard.Ewailq;
imgLilunhanhou.ImageUrl = "~/" + hotProcessCard.Lilunhanhou;
LilunhanhouAttachUrl = hotProcessCard.Lilunhanhou;
this.txtqishuyq.Text = hotProcessCard.Qishuyq;
}
}
}
#endregion
#region
/// <summary>
/// 测温点布置示意图
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void FileUpload1_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFile)
{
string fileName = FileUpload1.ShortFileName;
if (!ValidateFileType(fileName))
{
ShowNotify("无效的文件类型!", MessageBoxIcon.Warning);
return;
}
this.CewendianshcAttachUrl = BLL.UploadFileService.UploadAttachment(BLL.Funs.RootPath, this.FileUpload1, this.CewendianshcAttachUrl, UploadFileService.CewendianshcFilePath);
this.imgCewendianshc.ImageUrl = "~/" + this.CewendianshcAttachUrl;
}
}
/// <summary>
/// 理论焊后热处理曲线
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void FileUpload2_Click(object sender, EventArgs e)
{
if (FileUpload2.HasFile)
{
string fileName = FileUpload2.ShortFileName;
if (!ValidateFileType(fileName))
{
ShowNotify("无效的文件类型!", MessageBoxIcon.Warning);
return;
}
this.LilunhanhouAttachUrl = BLL.UploadFileService.UploadAttachment(BLL.Funs.RootPath, this.FileUpload2, this.LilunhanhouAttachUrl, UploadFileService.LilunhanhouFilePath);
this.imgLilunhanhou.ImageUrl = "~/" + this.LilunhanhouAttachUrl;
}
}
#endregion
}
}