YZ_BSF/HJGL/FineUIPro.Web/common/WelderManage/WelderItemEdit.aspx.cs

366 lines
15 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Linq;
using BLL;
namespace FineUIPro.Web.common.WelderManage
{
public partial class WelderItemEdit : PageBase
{
#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.hdWelderId.Text = Request.Params["welderId"];
string welderQualifyId = Request.Params["WelderQualifyId"];
if (!string.IsNullOrEmpty(welderQualifyId))
{
Model.Welder_WelderQualify welderQualify = BLL.WelderQualifyService.GetWelderQualifyById(welderQualifyId);
if (welderQualify != null)
{
this.hdWelderId.Text = welderQualify.WelderId;
this.txtQualificationItem.Text = welderQualify.QualificationItem;
txtWeldingLocation.Text = welderQualify.WeldingLocation;
if (welderQualify.CheckDate.HasValue)
{
this.txtCheckDate.Text = string.Format("{0:yyyy-MM-dd}", welderQualify.CheckDate);
}
if (welderQualify.LimitDate.HasValue)
{
this.txtLimitDate.Text = string.Format("{0:yyyy-MM-dd}", welderQualify.LimitDate);
}
txtWeldingMethod.Text = welderQualify.WeldingMethod;
txtMaterialType.Text = welderQualify.MaterialType;
txtWeldType.Text = welderQualify.WeldType;
if (welderQualify.ThicknessMax.HasValue)
{
this.txtThicknessMax.Text = welderQualify.ThicknessMax.ToString();
}
if (welderQualify.SizesMin.HasValue)
{
this.txtSizesMin.Text = welderQualify.SizesMin.ToString();
}
this.txtRemark.Text = welderQualify.Remark;
if (welderQualify.IsPrintShow == true)
{
ckbIsPrintShow.Checked = true;
}
else
{
ckbIsPrintShow.Checked = false;
}
}
else
{
ckbIsPrintShow.Checked = true;
}
}
var w = BLL.WelderService.GetWelderById(this.hdWelderId.Text);
if (w != null)
{
this.txtWelderCode.Text = w.WelderCode;
}
}
}
#endregion
#region
/// <summary>
/// 保存按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
string welderQualifyId = Request.Params["WelderQualifyId"];
Model.Welder_WelderQualify welderQualify = new Model.Welder_WelderQualify();
welderQualify.WelderId = this.hdWelderId.Text;
welderQualify.QualificationItem = txtQualificationItem.Text;
welderQualify.CheckDate = Funs.GetNewDateTime(this.txtCheckDate.Text.Trim());
welderQualify.LimitDate = Funs.GetNewDateTime(this.txtLimitDate.Text.Trim());
welderQualify.IsPrintShow = ckbIsPrintShow.Checked;
welderQualify.WeldingMethod = txtWeldingMethod.Text.Trim();
welderQualify.MaterialType = txtMaterialType.Text.Trim();
welderQualify.WeldingLocation = txtWeldingLocation.Text.Trim();
welderQualify.WeldType = txtWeldType.Text.Trim();
welderQualify.ThicknessMax = Funs.GetNewDecimal(this.txtThicknessMax.Text.Trim());
welderQualify.SizesMin = Funs.GetNewDecimal(this.txtSizesMin.Text.Trim());
welderQualify.Remark = txtRemark.Text.Trim();
if (!string.IsNullOrEmpty(welderQualifyId))
{
welderQualify.WelderQualifyId = welderQualifyId;
BLL.WelderQualifyService.UpdateWelderQualify(welderQualify);
}
else
{
welderQualify.WelderQualifyId = SQLHelper.GetNewID(typeof(Model.Welder_WelderQualify));
BLL.WelderQualifyService.AddWelderQualify(welderQualify);
}
ShowNotify("保存成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
#endregion
protected void txtQualificationItem_OnBlur(object sender, EventArgs e)
{
string weldMethod = string.Empty;
string materialType = string.Empty;
string location = string.Empty;
string weldType = string.Empty;
//bool isCanWeldG = true;
decimal thicknessMax = 0; // 0表示不限
decimal sizesMin = 0; // 0表示不限
string[] queProject = txtQualificationItem.Text.Trim().Split('-');
try
{
// 焊接方法和钢材类型
weldMethod = queProject[0];
if (queProject.Count() > 1)
{
if (queProject[1].Trim() == ("FeI") || queProject[1].Trim() == ("Fe"))
{
materialType = "Fe";
}
else if (queProject[1].Trim() == ("FeII") || queProject[1].Trim() == ("FeⅡ"))
{
materialType = "FeⅡ,Fe";
}
else if (queProject[1].Trim() == ("FeIII") || queProject[1].Trim() == ("FeⅢ"))
{
//materialType = "FeⅢ,FeⅡ,Fe";
if (weldMethod.Contains("GTAW"))
{
materialType = "FeⅢ";
}
else
{
materialType = "FeⅢ,FeⅡ,Fe";
}
}
else if (queProject[1].Trim() == ("FeIV") || queProject[1].Trim() == ("FeⅣ"))
{
materialType = "FeⅣ";
}
// 铜不可兼
else if (queProject[1].Trim() == ("CuI") || queProject[1].Trim() == ("Cu"))
{
materialType = "Cu";
}
else if (queProject[1].Trim() == ("CuII") || queProject[1].Trim() == ("CuⅡ"))
{
materialType = "CuⅡ";
}
else if (queProject[1].Trim() == ("CuIII") || queProject[1].Trim() == ("CuⅢ"))
{
materialType = "CuⅢ";
}
else if (queProject[1].Trim() == ("CuIV") || queProject[1].Trim() == ("CuⅣ"))
{
materialType = "CuⅣ";
}
else if (queProject[1].Trim() == ("CuV") || queProject[1].Trim() == ("Cu"))
{
materialType = "Cu";
}
// 镍可兼
else if (queProject[1].Trim() == ("NiI") || queProject[1].Trim() == ("Ni"))
{
materialType = "Ni,NiⅡ,NiⅢ,NiⅣ,Ni";
}
else if (queProject[1].Trim() == ("NiII") || queProject[1].Trim() == ("NiⅡ"))
{
materialType = "Ni,NiⅡ,NiⅢ,NiⅣ,Ni";
}
else if (queProject[1].Trim() == ("NiIII") || queProject[1].Trim() == ("NiⅢ"))
{
materialType = "Ni,NiⅡ,NiⅢ,NiⅣ,Ni";
}
else if (queProject[1].Trim() == ("NiIV") || queProject[1].Trim() == ("NiⅣ"))
{
materialType = "Ni,NiⅡ,NiⅢ,NiⅣ,Ni";
}
else if (queProject[1].Trim() == ("NiV") || queProject[1].Trim() == ("Ni"))
{
materialType = "Ni,NiⅡ,NiⅢ,NiⅣ,Ni";
}
// 铝可兼
else if(queProject[1].Trim() == ("AII") || queProject[1].Trim() == ("AI"))
{
materialType = "AI,AIⅡ,AIⅢ,Ⅳ";
}
else if (queProject[1].Trim() == ("AIII") || queProject[1].Trim() == ("AIⅡ"))
{
materialType = "AI,AIⅡ,AIⅢ,Ⅳ";
}
else if (queProject[1].Trim() == ("AIIII") || queProject[1].Trim() == ("AIⅢ"))
{
materialType = "AI,AIⅡ,AIⅢ,Ⅳ";
}
else if (queProject[1].Trim() == ("AIIV") || queProject[1].Trim() == ("AIⅣ"))
{
materialType = "AI,AIⅡ,AIⅢ,Ⅳ";
}
// 钛可兼
else if(queProject[1].Trim() == ("TiI") || queProject[1].Trim() == ("Ti"))
{
materialType = "Ti,TiⅡ";
}
else if (queProject[1].Trim() == ("TiII") || queProject[1].Trim() == ("TiⅡ"))
{
materialType = "Ti,TiⅡ";
}
else
{
materialType = queProject[1].Trim();
}
}
if (queProject.Count() > 2)
{
// 焊接位置
if (queProject[2].Contains("6G"))
{
location = "ALL";
}
else if (queProject[2].Contains("2G"))
{
location = "1G,2G";
}
else if (queProject[2].Contains("3G"))
{
location = "1G,2G,3G";
}
else if (queProject[2].Contains("4G"))
{
location = "1G,3G,4G";
}
else if (queProject[2].Contains("5G"))
{
location = "1G,2G,3G,5G";
}
else if (queProject[2].Contains("6FG"))
{
location = "ALL";
}
else if (queProject[2].Contains("5FG"))
{
location = "2FG,5FG";
}
else if (queProject[2].Contains("4FG"))
{
location = "2FG,4FG";
}
else
{
location = queProject[2];
}
//if (queProject[2].Contains("1G") || queProject[2].Contains("1F") || queProject[2].Contains("2FR") || queProject[2].Contains("2FRG"))
//{
// isCanWeldG = false;
//}
//1 - 对接2 - 角焊缝3 - 支管连接焊缝
if (queProject[2].Contains("FG"))
{
weldType = "角焊缝,支管连接焊缝";
}
else
{
if (queProject[2]==("6G"))
{
weldType = "对接焊缝,角焊缝,支管连接焊缝";
}
else
{
weldType = "对接焊缝,角焊缝";
}
}
}
if (queProject.Count() > 3)
{
// 壁厚和外径
string[] thickSize = queProject[3].Split('/');
if (weldMethod != "OFW")
{
if (thickSize.Count() == 2)
{
decimal thick = Convert.ToDecimal(thickSize[0]);
if (thick < 12)
{
//thicknessMax = "≤" + thick * 2;
thicknessMax = thick * 2;
}
else
{
thicknessMax = 0;
}
decimal size = Convert.ToDecimal(thickSize[1]);
if (size < 25)
{
//sizesMin = "≥" + size;
sizesMin = size;
}
else if (size >= 25 && size < 76)
{
//sizesMin = "≥25";
sizesMin = 25;
}
else
{
//sizesMin = "≥76";
sizesMin = 76;
}
}
else if (thickSize.Count() == 1)
{
thicknessMax = 0;
//sizesMin = "≥76";
sizesMin = 76;
}
}
else
{
decimal thick = Convert.ToDecimal(thickSize[0]);
thicknessMax = thick;
sizesMin = 0;
}
}
txtWeldingMethod.Text = weldMethod;
txtMaterialType.Text = materialType;
txtWeldingLocation.Text = location;
txtThicknessMax.Text = thicknessMax.ToString();
txtSizesMin.Text = sizesMin.ToString();
txtWeldType.Text = weldType;
//ckbIsCanWeldG.Checked = isCanWeldG;
}
catch
{
ShowNotify("请录入规范数据!", MessageBoxIcon.Warning);
}
}
}
}