901 lines
40 KiB
C#
901 lines
40 KiB
C#
using BLL;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Data;
|
||
using System.Data.SqlClient;
|
||
using System.Linq;
|
||
using System.Web;
|
||
using System.Web.UI;
|
||
using System.Web.UI.WebControls;
|
||
|
||
namespace FineUIPro.Web.Welder
|
||
{
|
||
public partial class QualifiedProject : PageBase
|
||
{
|
||
#region 加载
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
if (!IsPostBack)
|
||
{
|
||
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
|
||
|
||
this.drpUnitId.DataTextField = "UnitName";
|
||
this.drpUnitId.DataValueField = "UnitId";
|
||
this.drpUnitId.DataSource = (from x in Funs.DB.Base_Unit select x).ToList();
|
||
this.drpUnitId.DataBind();
|
||
Funs.FineUIPleaseSelect(this.drpUnitId);
|
||
|
||
this.drpType.DataTextField = "Text";
|
||
this.drpType.DataValueField = "Value";
|
||
this.drpType.DataSource = BLL.DropListService.HJGL_Welder_PrintTypeItem();
|
||
this.drpType.DataBind();
|
||
Funs.FineUIPleaseSelect(this.drpType);
|
||
|
||
this.InitTreeMenu();//加载树
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 加载树
|
||
/// </summary>
|
||
private void InitTreeMenu()
|
||
{
|
||
this.tvControlItem.Nodes.Clear();
|
||
TreeNode rootNode = new TreeNode();
|
||
rootNode.Text = "单位-焊工";
|
||
rootNode.ToolTip = "单位";
|
||
rootNode.NodeID = "0";
|
||
rootNode.Expanded = true;
|
||
this.tvControlItem.Nodes.Add(rootNode);
|
||
|
||
var welders = from x in Funs.DB.HJGL_BS_Welder
|
||
join y in Funs.DB.Base_Unit on x.WED_Unit equals y.UnitId
|
||
where x.IsOAM == true
|
||
select new { x.WED_Unit, x.WED_ID, x.WED_Name,x.WED_Code, y.UnitName };
|
||
|
||
if (this.drpUnitId.SelectedValue != BLL.Const._Null)
|
||
{
|
||
welders = from x in welders where x.WED_Unit == drpUnitId.SelectedValue select x;
|
||
}
|
||
if (!string.IsNullOrEmpty(this.txtWelderCodeS.Text.Trim()))
|
||
{
|
||
welders = from x in welders
|
||
where x.WED_Code.Contains(this.txtWelderCodeS.Text.Trim())
|
||
select x;
|
||
}
|
||
|
||
if (!string.IsNullOrEmpty(txtWelderNameS.Text.Trim()))
|
||
{
|
||
welders = from x in welders
|
||
where x.WED_Name.Contains(this.txtWelderNameS.Text.Trim())
|
||
select x;
|
||
}
|
||
|
||
var units = (from x in welders select new { x.WED_Unit, x.UnitName }).Distinct();
|
||
|
||
foreach (var unit in units)
|
||
{
|
||
TreeNode rootProjectNode = new TreeNode();//定义根节点
|
||
rootProjectNode.Text = unit.UnitName;
|
||
rootProjectNode.NodeID = unit.WED_Unit;
|
||
//rootProjectNode.Expanded = true;
|
||
//rootProjectNode.ToolTip = "单位";
|
||
rootNode.Nodes.Add(rootProjectNode);
|
||
|
||
var welderList = welders.Where(e => e.WED_Unit == unit.WED_Unit);
|
||
foreach (var item in welderList)
|
||
{
|
||
TreeNode newNode = new TreeNode();
|
||
newNode.Text = item.WED_Name + "【" + item.WED_Code + "】";
|
||
newNode.NodeID = item.WED_ID;
|
||
//newNode.ToolTip = item.WED_Code;
|
||
newNode.EnableClickEvent = true;
|
||
rootProjectNode.Nodes.Add(newNode);
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 点击TreeView
|
||
/// <summary>
|
||
/// 点击TreeView
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
|
||
{
|
||
QualificationAnalysis();
|
||
}
|
||
#endregion
|
||
|
||
#region Grid 绑定
|
||
private void BindGrid()
|
||
{
|
||
var welder = BLL.HJGL_PersonManageService.GetWelderByWenId(this.tvControlItem.SelectedNodeID);
|
||
if (welder != null)
|
||
{
|
||
this.lblCode.Text = welder.WED_Code;
|
||
this.lblName.Text = welder.WED_Name;
|
||
}
|
||
string strSql = @"SELECT que.WelderQualifiedProjectId,
|
||
que.WED_ID,
|
||
que.QualifiedProjectCode,
|
||
que.LimitDate,
|
||
que.CheckDate,
|
||
que.CertificateNo,
|
||
que.WeldingMethodId,
|
||
que.MaterialType,
|
||
que.WeldingLocationId,
|
||
(CASE WHEN que.ThicknessMax >0 THEN '≤'+ CONVERT(VARCHAR(5),CAST(que.ThicknessMax AS REAL))
|
||
WHEN que.ThicknessMax=0 THEN '不限'
|
||
WHEN que.ThicknessMax IS NULL THEN '' END) AS ThicknessMax,
|
||
(CASE WHEN que.SizesMin >0 THEN '≥'+ CONVERT(VARCHAR(5),CAST(que.SizesMin AS REAL))
|
||
WHEN que.SizesMin=0 THEN '不限'
|
||
WHEN que.SizesMin IS NULL THEN '' END) AS SizesMin,
|
||
(CASE WHEN que.IsSteelStru=1 THEN '是' ELSE '否' END) AS IsSteelStru,
|
||
(CASE WHEN que.IsDemoteUse=1 THEN '是' ELSE '否' END) AS IsDemoteUse
|
||
FROM HJGL_BS_WelderQualifiedProject AS que
|
||
WHERE que.WED_ID=@WED_ID";
|
||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||
listStr.Add(new SqlParameter("@WED_ID", this.tvControlItem.SelectedNodeID));
|
||
if (drpIsLimit.Checked == true)
|
||
{
|
||
strSql += " AND que.LimitDate >=GETDATE() ";
|
||
}
|
||
else
|
||
{
|
||
strSql += " AND que.LimitDate < GETDATE() ";
|
||
}
|
||
SqlParameter[] parameter = listStr.ToArray();
|
||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||
|
||
// 2.获取当前分页数据
|
||
//var table = this.GetPagedDataTable(Grid1, tb1);
|
||
Grid1.RecordCount = tb.Rows.Count;
|
||
tb = GetFilteredTable(Grid1.FilteredData, tb);
|
||
var table = this.GetPagedDataTable(Grid1, tb);
|
||
|
||
Grid1.DataSource = table;
|
||
Grid1.DataBind();
|
||
}
|
||
#endregion
|
||
|
||
#region 双击事件
|
||
/// <summary>
|
||
/// Grid行双击事件
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
|
||
{
|
||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||
{
|
||
Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.Welder_QualifiedProjectMenuId, Const.BtnAdd))
|
||
{
|
||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("QualifiedProjectEdit.aspx?WelderQualifiedProjectId={0}", Grid1.SelectedRowID, "维护 - ")));
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 右键编辑、删除
|
||
protected void btnMenuEdit_Click(object sender, EventArgs e)
|
||
{
|
||
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.Welder_QualifiedProjectMenuId, BLL.Const.BtnModify))
|
||
{
|
||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||
{
|
||
Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("QualifiedProjectEdit.aspx?WelderQualifiedProjectId={0}", Grid1.SelectedRowID, "维护 - ")));
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 删除
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnMenuDelete_Click(object sender, EventArgs e)
|
||
{
|
||
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.Welder_QualifiedProjectMenuId, Const.BtnDelete))
|
||
{
|
||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||
{
|
||
Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
|
||
bool isShow = true;
|
||
if (Grid1.SelectedRowIndexArray.Length > 1)
|
||
{
|
||
isShow = false;
|
||
}
|
||
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
|
||
{
|
||
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
|
||
if (judgementDelete(rowID, isShow))
|
||
{
|
||
BLL.HJGL_WelderQualifiedProjectService.DeleteWelderQualifiedProjectByWelderQualifiedProjectId(rowID);
|
||
BLL.Sys_LogService.AddLog(Const.System_6, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "删除合格项目焊工");
|
||
}
|
||
}
|
||
|
||
ShowNotify("删除成功!", MessageBoxIcon.Success);
|
||
this.BindGrid();
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 判断是否可删除
|
||
/// <summary>
|
||
/// 判断是否可以删除
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
private bool judgementDelete(string id, bool isShow)
|
||
{
|
||
string content = string.Empty;
|
||
|
||
if (string.IsNullOrEmpty(content))
|
||
{
|
||
return true;
|
||
}
|
||
else
|
||
{
|
||
if (isShow)
|
||
{
|
||
Alert.ShowInTop(content, MessageBoxIcon.Error);
|
||
}
|
||
return false;
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 弹出编辑窗口关闭事件
|
||
/// <summary>
|
||
/// 弹出编辑窗体关闭事件
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
||
{
|
||
BindGrid();
|
||
}
|
||
#endregion
|
||
|
||
#region 分页 排序
|
||
/// <summary>
|
||
/// 分页
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
||
{
|
||
Grid1.PageIndex = e.NewPageIndex;
|
||
BindGrid();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 分页显示条数下拉框
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
||
{
|
||
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
|
||
BindGrid();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 排序
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
|
||
{
|
||
Grid1.SortDirection = e.SortDirection;
|
||
Grid1.SortField = e.SortField;
|
||
BindGrid();
|
||
}
|
||
#endregion
|
||
|
||
#region 查询
|
||
/// <summary>
|
||
/// 查询
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void TextBox_TextChanged(object sender, EventArgs e)
|
||
{
|
||
this.InitTreeMenu();
|
||
this.BindGrid();
|
||
}
|
||
|
||
protected void drpIsLimit_CheckedChanged(object sender, EventArgs e)
|
||
{
|
||
this.BindGrid();
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 增加
|
||
/// <summary>
|
||
/// 增加
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnAdd_Click(object sender, EventArgs e)
|
||
{
|
||
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.Welder_QualifiedProjectMenuId, Const.BtnAdd))
|
||
{
|
||
if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID))
|
||
{
|
||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("QualifiedProjectEdit.aspx?WED_ID={0}", this.tvControlItem.SelectedNodeID, "新增 - ")));
|
||
}
|
||
else
|
||
{
|
||
Alert.ShowInTop("请选择一名焊工!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
private void QualificationAnalysis()
|
||
{
|
||
if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID))
|
||
{
|
||
var que = from x in Funs.DB.HJGL_BS_WelderQualifiedProject where x.WED_ID == this.tvControlItem.SelectedNodeID select x;
|
||
if (que.Count() > 0)
|
||
{
|
||
foreach (var q in que)
|
||
{
|
||
string weldMethod = string.Empty;
|
||
string materialType = string.Empty;
|
||
string location = string.Empty;
|
||
string weldType = string.Empty;
|
||
decimal thicknessMax = 0; // 0表示不限
|
||
decimal sizesMin = 0; // 0表示不限
|
||
string materialTypeName = string.Empty;
|
||
|
||
string[] queProject = q.QualifiedProjectCode.Split('-');
|
||
|
||
// 焊接方法和钢材类型
|
||
weldMethod = queProject[0].Trim();
|
||
if (queProject.Count() > 1)
|
||
{
|
||
if (q.IsDemoteUse == true)
|
||
{
|
||
string[] demoteUseSteelType = q.DemoteUseSteelType.Split(',');
|
||
if (demoteUseSteelType.Count() > 0)
|
||
{
|
||
foreach (string type in demoteUseSteelType)
|
||
{
|
||
if (type == "FeIV" || type == "FeⅣ")
|
||
{
|
||
materialType = materialType+"FeⅣ" +",";
|
||
materialTypeName = materialTypeName+"铬钼钢" +",";
|
||
}
|
||
if (type == "FeIII" || type == "FeⅢ")
|
||
{
|
||
materialType = materialType + "FeⅢ" + ",";
|
||
materialTypeName = materialTypeName + "合金钢" + ",";
|
||
}
|
||
if (type == "FeII" || type == "FeⅡ")
|
||
{
|
||
materialType = materialType + "FeⅡ" + ",";
|
||
materialTypeName = materialTypeName + "不锈钢" + ",";
|
||
}
|
||
if (type == "FeI" || type == "FeⅠ")
|
||
{
|
||
materialType = materialType + "FeⅠ" + ",";
|
||
materialTypeName = materialTypeName + "碳钢" + ",";
|
||
}
|
||
}
|
||
|
||
if (materialType.Length > 0 && materialTypeName.Length > 0)
|
||
{
|
||
materialType = materialType.Substring(0, materialType.Length - 1);
|
||
materialTypeName = materialTypeName.Substring(0, materialTypeName.Length - 1);
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (weldMethod.Contains("GTAW"))
|
||
{
|
||
if (queProject[1].Trim() == ("FeI") || queProject[1].Trim() == ("FeⅠ"))
|
||
{
|
||
materialType = "FeⅠ";
|
||
materialTypeName = "碳钢";
|
||
}
|
||
|
||
else if (queProject[1].Trim() == ("FeII") || queProject[1].Trim() == ("FeⅡ"))
|
||
{
|
||
materialType = "FeⅡ,FeⅠ";
|
||
materialTypeName = "不锈钢,碳钢";
|
||
}
|
||
else if (queProject[1].Trim() == ("FeIII") || queProject[1].Trim() == ("FeⅢ"))
|
||
{
|
||
materialType = "FeⅢ";
|
||
materialTypeName = "合金钢";
|
||
}
|
||
else if (queProject[1].Trim() == ("FeIV") || queProject[1].Trim() == ("FeⅣ"))
|
||
{
|
||
materialType = "FeⅣ";
|
||
materialTypeName = "铬钼钢";
|
||
}
|
||
else
|
||
{
|
||
materialType = queProject[1].Trim();
|
||
materialTypeName = "其它";
|
||
}
|
||
}
|
||
else if (weldMethod.Contains("SMAW"))
|
||
{
|
||
if (queProject[1].Trim() == ("FeI") || queProject[1].Trim() == ("FeⅠ"))
|
||
{
|
||
materialType = "FeⅠ";
|
||
materialTypeName = "碳钢";
|
||
}
|
||
|
||
else if (queProject[1].Trim() == ("FeII") || queProject[1].Trim() == ("FeⅡ"))
|
||
{
|
||
materialType = "FeⅡ,FeⅠ";
|
||
materialTypeName = "不锈钢,碳钢";
|
||
}
|
||
else if (queProject[1].Trim() == ("FeIII") || queProject[1].Trim() == ("FeⅢ"))
|
||
{
|
||
materialType = "FeⅢ,FeⅡ,FeⅠ";
|
||
materialTypeName = "合金钢,不锈钢,碳钢";
|
||
}
|
||
else if (queProject[1].Trim() == ("FeIV") || queProject[1].Trim() == ("FeⅣ"))
|
||
{
|
||
materialType = "FeⅣ";
|
||
materialTypeName = "铬钼钢";
|
||
}
|
||
else
|
||
{
|
||
materialType = queProject[1].Trim();
|
||
materialTypeName = "其它";
|
||
}
|
||
}
|
||
else
|
||
{
|
||
materialType = queProject[1].Trim();
|
||
materialTypeName = "其它";
|
||
}
|
||
}
|
||
}
|
||
|
||
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];
|
||
}
|
||
|
||
// 1-对接,2-角焊缝,3-支管连接焊缝
|
||
if (queProject[2].Contains("FG"))
|
||
{
|
||
weldType = "2,3";
|
||
}
|
||
else
|
||
{
|
||
weldType = "1,2";
|
||
}
|
||
}
|
||
|
||
if (queProject.Count() > 3)
|
||
{
|
||
// 壁厚和外径
|
||
string[] thickSize = queProject[3].Split('/');
|
||
if (thickSize.Count() == 2)
|
||
{
|
||
double t = 0.0;
|
||
double s = 0.0;
|
||
if (double.TryParse(thickSize[0], out t))
|
||
{
|
||
decimal thick = Convert.ToDecimal(t);
|
||
if (thick < 12)
|
||
{
|
||
//thicknessMax = "≤" + thick * 2;
|
||
thicknessMax = thick * 2;
|
||
}
|
||
else
|
||
{
|
||
thicknessMax = 0;
|
||
}
|
||
}
|
||
|
||
if (double.TryParse(thickSize[1], out s))
|
||
{
|
||
decimal size = Convert.ToDecimal(s);
|
||
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;
|
||
}
|
||
}
|
||
|
||
Model.HJGL_BS_WelderQualifiedProject updateQue = new Model.HJGL_BS_WelderQualifiedProject();
|
||
updateQue.WelderQualifiedProjectId = q.WelderQualifiedProjectId;
|
||
updateQue.WED_ID = q.WED_ID;
|
||
updateQue.QualifiedProjectCode = q.QualifiedProjectCode;
|
||
updateQue.LimitDate = q.LimitDate;
|
||
updateQue.WeldingMethodId = weldMethod;
|
||
updateQue.MaterialType = materialType;
|
||
updateQue.WeldingLocationId = location;
|
||
updateQue.WeldType = weldType;
|
||
updateQue.ThicknessMax = thicknessMax;
|
||
updateQue.SizesMin = sizesMin;
|
||
updateQue.MaterialTypeName = materialTypeName;
|
||
BLL.HJGL_WelderQualifiedProjectService.UpdateWelderQualifiedProject(updateQue);
|
||
}
|
||
}
|
||
BindGrid();
|
||
}
|
||
}
|
||
|
||
protected void btnQualificationAnalysis_Click(object sender, EventArgs e)
|
||
{
|
||
if (this.CurrUser.Account == "gly")
|
||
{
|
||
var que = from x in Funs.DB.HJGL_BS_WelderQualifiedProject select x;
|
||
if (que.Count() > 0)
|
||
{
|
||
foreach (var q in que)
|
||
{
|
||
string weldMethod = string.Empty;
|
||
string materialType = string.Empty;
|
||
string location = string.Empty;
|
||
string weldType = string.Empty;
|
||
decimal thicknessMax = 0; // 0表示不限
|
||
decimal sizesMin = 0; // 0表示不限
|
||
string materialTypeName = string.Empty;
|
||
|
||
string[] queProject = q.QualifiedProjectCode.Split('-');
|
||
|
||
// 焊接方法和钢材类型
|
||
weldMethod = queProject[0].Trim();
|
||
|
||
if (queProject.Count() > 1)
|
||
{
|
||
if (q.IsDemoteUse == true)
|
||
{
|
||
string[] demoteUseSteelType = q.DemoteUseSteelType.Split(',');
|
||
if (demoteUseSteelType.Count() > 0)
|
||
{
|
||
foreach (string type in demoteUseSteelType)
|
||
{
|
||
if (type == "FeIV" || type == "FeⅣ")
|
||
{
|
||
materialType = materialType + "FeⅣ" + ",";
|
||
materialTypeName = materialTypeName + "铬钼钢" + ",";
|
||
}
|
||
if (type == "FeIII" || type == "FeⅢ")
|
||
{
|
||
materialType = materialType + "FeⅢ" + ",";
|
||
materialTypeName = materialTypeName + "合金钢" + ",";
|
||
}
|
||
if (type == "FeII" || type == "FeⅡ")
|
||
{
|
||
materialType = materialType + "FeⅡ" + ",";
|
||
materialTypeName = materialTypeName + "不锈钢" + ",";
|
||
}
|
||
if (type == "FeI" || type == "FeⅠ")
|
||
{
|
||
materialType = materialType + "FeⅠ" + ",";
|
||
materialTypeName = materialTypeName + "碳钢" + ",";
|
||
}
|
||
}
|
||
|
||
if (materialType.Length > 0 && materialTypeName.Length > 0)
|
||
{
|
||
materialType = materialType.Substring(0, materialType.Length - 1);
|
||
materialTypeName = materialTypeName.Substring(0, materialTypeName.Length - 1);
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (weldMethod.Contains("GTAW"))
|
||
{
|
||
if (queProject[1].Trim() == ("FeI") || queProject[1].Trim() == ("FeⅠ"))
|
||
{
|
||
materialType = "FeⅠ";
|
||
materialTypeName = "碳钢";
|
||
}
|
||
|
||
else if (queProject[1].Trim() == ("FeII") || queProject[1].Trim() == ("FeⅡ"))
|
||
{
|
||
materialType = "FeⅡ,FeⅠ";
|
||
materialTypeName = "不锈钢,碳钢";
|
||
}
|
||
else if (queProject[1].Trim() == ("FeIII") || queProject[1].Trim() == ("FeⅢ"))
|
||
{
|
||
materialType = "FeⅢ";
|
||
materialTypeName = "合金钢";
|
||
}
|
||
else if (queProject[1].Trim() == ("FeIV") || queProject[1].Trim() == ("FeⅣ"))
|
||
{
|
||
materialType = "FeⅣ";
|
||
materialTypeName = "铬钼钢";
|
||
}
|
||
else
|
||
{
|
||
materialType = queProject[1];
|
||
materialTypeName = "其它";
|
||
}
|
||
}
|
||
else if (weldMethod.Contains("SMAW"))
|
||
{
|
||
if (queProject[1].Trim() == ("FeI") || queProject[1].Trim() == ("FeⅠ"))
|
||
{
|
||
materialType = "FeⅠ";
|
||
materialTypeName = "碳钢";
|
||
}
|
||
|
||
else if (queProject[1].Trim() == ("FeII") || queProject[1].Trim() == ("FeⅡ"))
|
||
{
|
||
materialType = "FeⅡ,FeⅠ";
|
||
materialTypeName = "不锈钢,碳钢";
|
||
}
|
||
else if (queProject[1].Trim() == ("FeIII") || queProject[1].Trim() == ("FeⅢ"))
|
||
{
|
||
materialType = "FeⅢ,FeⅡ,FeⅠ";
|
||
materialTypeName = "合金钢,不锈钢,碳钢";
|
||
}
|
||
else if (queProject[1].Trim() == ("FeIV") || queProject[1].Trim() == ("FeⅣ"))
|
||
{
|
||
materialType = "FeⅣ";
|
||
materialTypeName = "铬钼钢";
|
||
}
|
||
else
|
||
{
|
||
materialType = queProject[1].Trim();
|
||
materialTypeName = "其它";
|
||
}
|
||
}
|
||
else
|
||
{
|
||
materialType = queProject[1].Trim();
|
||
materialTypeName = "其它";
|
||
}
|
||
}
|
||
}
|
||
|
||
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];
|
||
}
|
||
|
||
// 1-对接,2-角焊缝,3-支管连接焊缝
|
||
if (queProject[2].Contains("FG"))
|
||
{
|
||
weldType = "2,3";
|
||
}
|
||
else
|
||
{
|
||
weldType = "1,2";
|
||
}
|
||
}
|
||
|
||
if (queProject.Count() > 3)
|
||
{
|
||
// 壁厚和外径
|
||
string[] thickSize = queProject[3].Split('/');
|
||
if (thickSize.Count() == 2)
|
||
{
|
||
double t = 0.0;
|
||
double s = 0.0;
|
||
if (double.TryParse(thickSize[0], out t))
|
||
{
|
||
decimal thick = Convert.ToDecimal(t);
|
||
if (thick < 12)
|
||
{
|
||
//thicknessMax = "≤" + thick * 2;
|
||
thicknessMax = thick * 2;
|
||
}
|
||
else
|
||
{
|
||
thicknessMax = 0;
|
||
}
|
||
}
|
||
|
||
if (double.TryParse(thickSize[1], out s))
|
||
{
|
||
decimal size = Convert.ToDecimal(s);
|
||
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;
|
||
}
|
||
}
|
||
|
||
Model.HJGL_BS_WelderQualifiedProject updateQue = new Model.HJGL_BS_WelderQualifiedProject();
|
||
updateQue.WelderQualifiedProjectId = q.WelderQualifiedProjectId;
|
||
updateQue.WED_ID = q.WED_ID;
|
||
updateQue.QualifiedProjectCode = q.QualifiedProjectCode;
|
||
updateQue.LimitDate = q.LimitDate;
|
||
updateQue.WeldingMethodId = weldMethod;
|
||
updateQue.MaterialType = materialType;
|
||
updateQue.WeldType = weldType;
|
||
updateQue.WeldingLocationId = location;
|
||
updateQue.ThicknessMax = thicknessMax;
|
||
updateQue.SizesMin = sizesMin;
|
||
updateQue.MaterialTypeName = materialTypeName;
|
||
BLL.HJGL_WelderQualifiedProjectService.UpdateWelderQualifiedProject(updateQue);
|
||
}
|
||
}
|
||
Alert.ShowInTop("资质分析完成!", MessageBoxIcon.Success);
|
||
|
||
}
|
||
else
|
||
{
|
||
Alert.ShowInTop("只有管理员有权限!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
}
|
||
|
||
#region 焊工证打印
|
||
/// <summary>
|
||
/// 焊工证打印
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnPrint_Click(object sender, EventArgs e)
|
||
{
|
||
if (this.drpType.SelectedValue != BLL.Const._Null)
|
||
{
|
||
if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID))
|
||
{
|
||
if (this.drpType.SelectedValue == "1")
|
||
{
|
||
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("WelderCardPrint1.aspx?WED_ID={0}", this.tvControlItem.SelectedNodeID, "编辑 - ")));
|
||
}
|
||
else
|
||
{
|
||
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("WelderCardPrint2.aspx?WED_ID={0}", this.tvControlItem.SelectedNodeID, "编辑 - ")));
|
||
}
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("请选择焊工!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("请选择打印类型!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
}
|
||
#endregion
|
||
}
|
||
} |