355 lines
16 KiB
C#
355 lines
16 KiB
C#
using System;
|
||
using System.Linq;
|
||
using System.Collections.Generic;
|
||
using BLL;
|
||
|
||
namespace FineUIPro.Web.PublicInfo.WPQ
|
||
{
|
||
public partial class WPQEdit : PageBase
|
||
{
|
||
#region 加载
|
||
/// <summary>
|
||
/// 加载页面
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
if (!IsPostBack)
|
||
{
|
||
ckbWelders.DataValueField = "WelderId";
|
||
ckbWelders.DataTextField = "WelderCode";
|
||
ckbWelders.DataSource = from x in Funs.DB.Welder_Welder
|
||
join y in Funs.DB.Welder_ProjectWelder on x.WelderId equals y.WelderId
|
||
orderby x.WelderCode
|
||
where y.ProjectId == CurrUser.LoginProjectId
|
||
select x;
|
||
ckbWelders.DataBind();
|
||
|
||
this.ckbSteel1.DataTextField = "MaterialCode";
|
||
ckbSteel1.DataValueField = "MaterialId";
|
||
ckbSteel1.DataSource = BLL.Base_MaterialService.GetMaterialList();
|
||
ckbSteel1.DataBind();
|
||
|
||
this.ckbSteel2.DataTextField = "MaterialCode";
|
||
ckbSteel2.DataValueField = "MaterialId";
|
||
ckbSteel2.DataSource = BLL.Base_MaterialService.GetMaterialList();
|
||
ckbSteel2.DataBind();
|
||
|
||
Base_ConsumablesService.InitConsumablesDropDownList(this.drpWeldMat, true, "2", Resources.Lan.PleaseSelect);
|
||
|
||
this.ckbWeldSilk.DataTextField = "ConsumablesCode";
|
||
ckbWeldSilk.DataValueField = "ConsumablesId";
|
||
ckbWeldSilk.DataSource = BLL.Base_ConsumablesService.GetConsumablesListByConsumablesType("1");
|
||
ckbWeldSilk.DataBind();
|
||
|
||
//BLL.Base_MaterialService.InitMaterialDropDownList(this.drpSteel1, true, Resources.Lan.PleaseSelect);//材质1
|
||
//BLL.Base_MaterialService.InitMaterialDropDownList(this.drpSteel2, true, Resources.Lan.PleaseSelect);//材质2
|
||
|
||
BLL.Base_WeldingMethodService.InitWeldingMethodDropDownList(this.drpWeldingMethodId, true, Resources.Lan.PleaseSelect);//焊接方法
|
||
btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
||
string wpqId = Request.Params["WPQId"];
|
||
if (!string.IsNullOrEmpty(wpqId))
|
||
{
|
||
Model.WPQ_WPQList wpq = BLL.WPQListServiceService.GetWPQById(wpqId);
|
||
if (wpq != null)
|
||
{
|
||
this.txtWeldingProcedureCode.Text = wpq.WPQCode;
|
||
if (wpq.CompileDate != null)
|
||
{
|
||
this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", wpq.CompileDate);
|
||
}
|
||
|
||
if (wpq.MaterialId1 != null)
|
||
{
|
||
string[] materialId1s = wpq.MaterialId1.Split('|');
|
||
drpSteel1.Values = materialId1s;
|
||
}
|
||
if (wpq.MaterialId2 != null)
|
||
{
|
||
string[] materialId2s = wpq.MaterialId2.Split('|');
|
||
drpSteel2.Values = materialId2s;
|
||
}
|
||
|
||
//if (!string.IsNullOrEmpty(wpq.MaterialId1))
|
||
//{
|
||
// this.drpSteel1.SelectedValue = wpq.MaterialId1;
|
||
// var mat1 = BLL.Base_MaterialService.GetMaterialByMaterialId(wpq.MaterialId1);
|
||
// if (mat1 != null)
|
||
// {
|
||
// if (!string.IsNullOrEmpty(mat1.MaterialClass))
|
||
// {
|
||
// this.txtMaterialClass1.Text = mat1.MaterialClass;
|
||
// }
|
||
// if (!string.IsNullOrEmpty(mat1.MaterialGroup))
|
||
// {
|
||
// this.txtMaterialGroup1.Text = mat1.MaterialGroup;
|
||
// }
|
||
// }
|
||
//}
|
||
//if (!string.IsNullOrEmpty(wpq.MaterialId2))
|
||
//{
|
||
// this.drpSteel2.SelectedValue = wpq.MaterialId2;
|
||
// var mat2 = BLL.Base_MaterialService.GetMaterialByMaterialId(wpq.MaterialId2);
|
||
// if (mat2 != null)
|
||
// {
|
||
// if (!string.IsNullOrEmpty(mat2.MaterialClass))
|
||
// {
|
||
// this.txtMaterialClass2.Text = mat2.MaterialClass;
|
||
// }
|
||
// if (!string.IsNullOrEmpty(mat2.MaterialGroup))
|
||
// {
|
||
// this.txtMaterialGroup2.Text = mat2.MaterialGroup;
|
||
// }
|
||
// }
|
||
//}
|
||
|
||
//this.txtWeldingModel.Text = wpq.WeldingModel;
|
||
//this.txtWeldingGrade.Text = wpq.WeldingGrade;
|
||
//this.txtWeldingSpecifications.Text = wpq.WeldingSpecifications;
|
||
|
||
if (!string.IsNullOrEmpty(wpq.WeldMatId))
|
||
{
|
||
this.drpWeldMat.SelectedValue = wpq.WeldMatId;
|
||
}
|
||
|
||
if (wpq.WeldSilkId != null)
|
||
{
|
||
string[] WeldSilkIds = wpq.WeldSilkId.Split('|');
|
||
drpWeldSilk.Values = WeldSilkIds;
|
||
}
|
||
|
||
this.txtSpecifications.Text = wpq.Specifications;
|
||
this.txtWeldingPosition.Text = wpq.WeldingPosition;
|
||
if (!string.IsNullOrEmpty(wpq.WeldingMethodId))
|
||
{
|
||
this.drpWeldingMethodId.SelectedValue = wpq.WeldingMethodId;
|
||
}
|
||
if (wpq.MinImpactDia != null)
|
||
{
|
||
this.txtMinImpactDia.Text = Convert.ToString(wpq.MinImpactDia);
|
||
}
|
||
if (wpq.MaxImpactDia != null)
|
||
{
|
||
this.txtMaxImpactDia.Text = Convert.ToString(wpq.MaxImpactDia);
|
||
}
|
||
if (wpq.MinImpactThickness != null)
|
||
{
|
||
this.txtMinImpactThickness.Text = Convert.ToString(wpq.MinImpactThickness);
|
||
}
|
||
if (wpq.MaxImpactThickness != null)
|
||
{
|
||
this.txtMaxImpactThickness.Text = Convert.ToString(wpq.MaxImpactThickness);
|
||
}
|
||
if (wpq.NoMinImpactThickness != null)
|
||
{
|
||
this.txtNoMinImpactThickness.Text = Convert.ToString(wpq.NoMinImpactThickness);
|
||
}
|
||
if (wpq.NoMaxImpactThickness != null)
|
||
{
|
||
this.txtNoMaxImpactThickness.Text = Convert.ToString(wpq.NoMaxImpactThickness);
|
||
}
|
||
this.txtWPQStandard.Text = wpq.WPQStandard;
|
||
if (wpq.IsHotProess == true)
|
||
{
|
||
this.cbkIsHotTreatment.Checked = true;
|
||
}
|
||
else
|
||
{
|
||
this.cbkIsHotTreatment.Checked = false;
|
||
}
|
||
this.txtRemark.Text = wpq.Remark;
|
||
this.txtJointType.Text = wpq.JointType;
|
||
this.txtMotorization.Text = wpq.Motorization;
|
||
this.txtProtectiveGas.Text = wpq.ProtectiveGas;
|
||
this.txtStretching.Text = wpq.Stretching;
|
||
this.txtBend.Text = wpq.Bend;
|
||
this.txtToAttack.Text = wpq.ToAttack;
|
||
this.txtOthers.Text = wpq.Others;
|
||
|
||
if (wpq.WelderIds != null)
|
||
{
|
||
string[] welderIds = wpq.WelderIds.Split('|');
|
||
drpWelders.Values = welderIds;
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 提交
|
||
/// <summary>
|
||
/// 提交按钮
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnSave_Click(object sender, EventArgs e)
|
||
{
|
||
if (this.drpSteel1.Values.Count()==0)
|
||
{
|
||
Alert.ShowInTop("材质1不能为空!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
string id = SaveData();
|
||
ShowNotify("提交成功!", MessageBoxIcon.Success);
|
||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||
}
|
||
|
||
/// <summary>
|
||
/// 提交数据
|
||
/// </summary>
|
||
private string SaveData()
|
||
{
|
||
Model.WPQ_WPQList wpq = new Model.WPQ_WPQList();
|
||
wpq.WPQCode = this.txtWeldingProcedureCode.Text.Trim();
|
||
wpq.CompileDate = Funs.GetNewDateTime(this.txtCompileDate.Text.Trim());
|
||
|
||
wpq.MaterialId1 = String.Join("|", drpSteel1.Values);
|
||
wpq.MaterialId2 = String.Join("|", drpSteel2.Values);
|
||
//if (this.drpSteel1.SelectedValue != BLL.Const._Null)
|
||
//{
|
||
// wpq.MaterialId1 = this.drpSteel1.SelectedValue;
|
||
//}
|
||
//if (this.drpSteel2.SelectedValue != BLL.Const._Null)
|
||
//{
|
||
// wpq.MaterialId2 = this.drpSteel2.SelectedValue;
|
||
//}
|
||
|
||
//wpq.WeldingModel = this.txtWeldingModel.Text.Trim();
|
||
//wpq.WeldingGrade = this.txtWeldingGrade.Text.Trim();
|
||
//wpq.WeldingSpecifications = this.txtWeldingSpecifications.Text.Trim();
|
||
|
||
if (this.drpWeldMat.SelectedValue != BLL.Const._Null)
|
||
{
|
||
wpq.WeldMatId = this.drpWeldMat.SelectedValue;
|
||
}
|
||
wpq.WeldSilkId = String.Join("|", drpWeldSilk.Values);
|
||
|
||
wpq.Specifications = this.txtSpecifications.Text.Trim();
|
||
wpq.WeldingPosition = this.txtWeldingPosition.Text.Trim();
|
||
if (this.drpWeldingMethodId.SelectedValue != BLL.Const._Null)
|
||
{
|
||
wpq.WeldingMethodId = this.drpWeldingMethodId.SelectedValue;
|
||
}
|
||
wpq.Remark = this.txtRemark.Text.Trim();
|
||
wpq.MinImpactThickness = Funs.GetNewDecimal(this.txtMinImpactThickness.Text.Trim());
|
||
wpq.MaxImpactThickness = Funs.GetNewDecimal(this.txtMaxImpactThickness.Text.Trim());
|
||
wpq.NoMinImpactThickness = Funs.GetNewDecimal(this.txtNoMinImpactThickness.Text.Trim());
|
||
wpq.NoMaxImpactThickness = Funs.GetNewDecimal(this.txtNoMaxImpactThickness.Text.Trim());
|
||
if (this.cbkIsHotTreatment.Checked == true)
|
||
{
|
||
wpq.IsHotProess = true;
|
||
}
|
||
else
|
||
{
|
||
wpq.IsHotProess = false;
|
||
}
|
||
wpq.MinImpactDia = Funs.GetNewDecimal(this.txtMinImpactDia.Text.Trim());
|
||
wpq.MaxImpactDia = Funs.GetNewDecimal(this.txtMaxImpactDia.Text.Trim());
|
||
wpq.WPQStandard = this.txtWPQStandard.Text.Trim();
|
||
wpq.JointType = this.txtJointType.Text.Trim();
|
||
wpq.Motorization = this.txtMotorization.Text.Trim();
|
||
wpq.ProtectiveGas = this.txtProtectiveGas.Text.Trim();
|
||
wpq.Stretching = this.txtStretching.Text.Trim();
|
||
wpq.Bend = this.txtBend.Text.Trim();
|
||
wpq.ToAttack = this.txtToAttack.Text.Trim();
|
||
wpq.Others = this.txtOthers.Text.Trim();
|
||
wpq.ProjectId = this.CurrUser.LoginProjectId;
|
||
wpq.WelderIds = String.Join("|", drpWelders.Values);
|
||
|
||
string wpqId = Request.Params["WPQId"];
|
||
if (!string.IsNullOrEmpty(wpqId))
|
||
{
|
||
wpq.WPQId = wpqId;
|
||
BLL.WPQListServiceService.UpdateWPQ(wpq);
|
||
//BLL.Sys_LogService.AddLog(Const.System_2, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "修改焊接工艺评定台账");
|
||
}
|
||
else
|
||
{
|
||
string newId = SQLHelper.GetNewID(typeof(Model.WPQ_WPQList));
|
||
wpq.WPQId = newId;
|
||
BLL.WPQListServiceService.AddWPQ(wpq);
|
||
//BLL.Sys_LogService.AddLog(Const.System_2, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "添加焊接工艺评定台账");
|
||
}
|
||
return wpq.WPQId;
|
||
}
|
||
#endregion
|
||
|
||
#region 附件上传
|
||
/// <summary>
|
||
/// 上传附件资源
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnAttachUrl_Click(object sender, EventArgs e)
|
||
{
|
||
string wpqId = Request.Params["WPQId"];
|
||
string edit = "0"; // 表示能打开附件上传窗口,但不能上传附件
|
||
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.WPQListMenuId, BLL.Const.BtnSave))
|
||
{
|
||
if (string.IsNullOrEmpty(wpqId))
|
||
{
|
||
wpqId = SaveData();
|
||
}
|
||
edit = "1";
|
||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/HJGLServer/WeldingManage&menuId={1}&edit={2}", wpqId, Const.WPQListMenuId, edit)));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region DropDownList下拉选择事件
|
||
/// <summary>
|
||
/// 材质1下拉列表选择事件
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
//protected void drpSteel1_SelectedIndexChanged(object sender, EventArgs e)
|
||
//{
|
||
// if (this.drpSteel1.SelectedValue != BLL.Const._Null)
|
||
// {
|
||
// var mat1 = BLL.Base_MaterialService.GetMaterialByMaterialId(this.drpSteel1.SelectedValue);
|
||
// if (mat1 != null)
|
||
// {
|
||
// if (!string.IsNullOrEmpty(mat1.MaterialClass))
|
||
// {
|
||
// this.txtMaterialClass1.Text = mat1.MaterialClass;
|
||
// }
|
||
// if (!string.IsNullOrEmpty(mat1.MaterialGroup))
|
||
// {
|
||
// this.txtMaterialGroup1.Text = mat1.MaterialGroup;
|
||
// }
|
||
// }
|
||
// }
|
||
//}
|
||
|
||
/// <summary>
|
||
/// 材质2下拉列表选择事件
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void drpSteel2_SelectedIndexChanged(object sender, EventArgs e)
|
||
{
|
||
//if (this.drpSteel2.SelectedValue != BLL.Const._Null)
|
||
//{
|
||
// var mat2 = BLL.Base_MaterialService.GetMaterialByMaterialId(this.drpSteel2.SelectedValue);
|
||
// if (mat2 != null)
|
||
// {
|
||
// if (!string.IsNullOrEmpty(mat2.MaterialClass))
|
||
// {
|
||
// this.txtMaterialClass1.Text = mat2.MaterialClass;
|
||
// }
|
||
// if (!string.IsNullOrEmpty(mat2.MaterialGroup))
|
||
// {
|
||
// this.txtMaterialGroup1.Text = mat2.MaterialGroup;
|
||
// }
|
||
// }
|
||
//}
|
||
}
|
||
#endregion
|
||
}
|
||
} |