2024-05-08 16:27:28 +08:00
|
|
|
|
using BLL;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Data.SqlClient;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Web;
|
|
|
|
|
using System.Web.UI;
|
|
|
|
|
using System.Web.UI.WebControls;
|
|
|
|
|
|
|
|
|
|
namespace FineUIPro.Web.WelderManage
|
|
|
|
|
{
|
|
|
|
|
public partial class QualifiedProject : PageBase
|
|
|
|
|
{
|
|
|
|
|
//定义变量
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 上传预设的虚拟路径
|
|
|
|
|
/// </summary>
|
|
|
|
|
private string initPath = Const.ExcelUrl;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 错误集合
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static string errorInfos = string.Empty;
|
|
|
|
|
|
|
|
|
|
#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.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);
|
|
|
|
|
|
|
|
|
|
List<Model.Welder_Welder> welders = new List<Model.Welder_Welder>();
|
|
|
|
|
List<Model.Base_Unit> units = (from x in Funs.DB.Base_Unit select x).ToList();
|
|
|
|
|
if (this.drpUnitId.SelectedValue != BLL.Const._Null)
|
|
|
|
|
{
|
|
|
|
|
units = units.Where(e => e.UnitId == this.drpUnitId.SelectedValue).ToList();
|
|
|
|
|
}
|
|
|
|
|
foreach (var item in units)
|
|
|
|
|
{
|
|
|
|
|
TreeNode rootProjectNode = new TreeNode();//定义根节点
|
|
|
|
|
rootProjectNode.Text = item.UnitName;
|
|
|
|
|
rootProjectNode.NodeID = item.UnitId;
|
|
|
|
|
//rootProjectNode.Expanded = true;
|
|
|
|
|
rootProjectNode.ToolTip = "单位";
|
|
|
|
|
rootNode.Nodes.Add(rootProjectNode);
|
|
|
|
|
|
|
|
|
|
welders = (from x in Funs.DB.Welder_Welder
|
|
|
|
|
where x.UnitId == item.UnitId
|
|
|
|
|
select x).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.BindNodes(rootProjectNode, welders);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 绑定树节点
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 绑定树节点
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="node"></param>
|
|
|
|
|
private void BindNodes(TreeNode node, List<Model.Welder_Welder> welders)
|
|
|
|
|
{
|
|
|
|
|
if (node.ToolTip == "单位")
|
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrEmpty(this.txtWelderCodeS.Text.Trim()))
|
|
|
|
|
{
|
|
|
|
|
welders = welders.Where(e => e.WelderCode.Contains(this.txtWelderCodeS.Text.Trim())).ToList();
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(txtWelderNameS.Text.Trim()))
|
|
|
|
|
{
|
|
|
|
|
welders = welders.Where(e => e.WelderName.Contains(this.txtWelderNameS.Text.Trim())).ToList();
|
|
|
|
|
}
|
|
|
|
|
foreach (var item in welders)
|
|
|
|
|
{
|
|
|
|
|
TreeNode newNode = new TreeNode();
|
|
|
|
|
newNode.Text = item.WelderName;
|
|
|
|
|
newNode.NodeID = item.WelderId;
|
|
|
|
|
newNode.ToolTip = item.WelderCode;
|
|
|
|
|
newNode.EnableClickEvent = true;
|
|
|
|
|
node.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)
|
|
|
|
|
{
|
|
|
|
|
this.BindGrid();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Grid 绑定
|
|
|
|
|
private void BindGrid()
|
|
|
|
|
{
|
|
|
|
|
var welder = BLL.WelderService.GetWelderById(this.tvControlItem.SelectedNodeID);
|
|
|
|
|
if (welder != null)
|
|
|
|
|
{
|
|
|
|
|
this.lblCode.Text = welder.WelderCode;
|
|
|
|
|
this.lblName.Text = welder.WelderName;
|
|
|
|
|
}
|
|
|
|
|
string strSql = @"SELECT que.WelderQualifiedProjectId,
|
|
|
|
|
que.WelderId,
|
|
|
|
|
que.QualifiedProjectCode,
|
|
|
|
|
que.LimitDate,
|
|
|
|
|
que.CheckDate,
|
|
|
|
|
que.CertificateNo,
|
|
|
|
|
que.WeldingMethodId,
|
|
|
|
|
que.MaterialType,
|
|
|
|
|
que.WeldingLocationId,
|
|
|
|
|
que.WeldType,que.ExamProject,
|
|
|
|
|
(CASE WHEN que.IsPass=1 THEN '是' ELSE '否' END) AS IsPass ,
|
|
|
|
|
(CASE WHEN que.ThicknessMax >0 THEN '≤'+CONVERT(VARCHAR(5),que.ThicknessMax)
|
|
|
|
|
WHEN que.ThicknessMax=0 THEN '不限'
|
|
|
|
|
WHEN que.ThicknessMax IS NULL THEN '' END) AS ThicknessMax,
|
|
|
|
|
(CASE WHEN que.SizesMin >0 THEN '≥'+CONVERT(VARCHAR(5),que.SizesMin)
|
|
|
|
|
WHEN que.SizesMin=0 THEN '不限'
|
|
|
|
|
WHEN que.SizesMin IS NULL THEN '' END) AS SizesMin
|
|
|
|
|
FROM Welder_WelderQualify AS que
|
|
|
|
|
WHERE que.WelderId=@WelderId";
|
|
|
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
|
|
|
listStr.Add(new SqlParameter("@WelderId", this.tvControlItem.SelectedNodeID));
|
|
|
|
|
|
|
|
|
|
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.WelderQualifiedService.DeleteWelderQualifiedProjectByWelderQualifiedProjectId(rowID);
|
|
|
|
|
//BLL.Sys_LogService.AddLog(Const.System_1, 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();
|
|
|
|
|
}
|
|
|
|
|
#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
|
|
|
|
|
|
|
|
|
|
protected void btnQualificationAnalysis_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID))
|
|
|
|
|
{
|
|
|
|
|
var que = from x in Funs.DB.Welder_WelderQualify where x.WelderId == 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];
|
|
|
|
|
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
|
|
|
|
|
{
|
|
|
|
|
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];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//1 - 对接,2 - 角焊缝,3 - 支管连接焊缝
|
|
|
|
|
if (queProject[2].Contains("FG"))
|
|
|
|
|
{
|
|
|
|
|
weldType = "2,3";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (queProject[2] == ("6G"))
|
|
|
|
|
{
|
|
|
|
|
weldType = "1,2,3";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
weldType = "1,2";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (queProject.Count() > 3)
|
|
|
|
|
{
|
|
|
|
|
// 壁厚和外径
|
|
|
|
|
string[] thickSize = queProject[3].Split('/');
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Model.Welder_WelderQualify updateQue = new Model.Welder_WelderQualify();
|
|
|
|
|
updateQue.WelderQualifiedProjectId = q.WelderQualifiedProjectId;
|
|
|
|
|
updateQue.WelderId = q.WelderId;
|
|
|
|
|
updateQue.QualifiedProjectCode = q.QualifiedProjectCode;
|
|
|
|
|
updateQue.LimitDate = q.LimitDate;
|
|
|
|
|
updateQue.WeldingMethodId = weldMethod;
|
|
|
|
|
updateQue.MaterialType = materialType;
|
|
|
|
|
updateQue.WeldingLocationId = location;
|
|
|
|
|
updateQue.ThicknessMax = thicknessMax;
|
|
|
|
|
updateQue.SizesMin = sizesMin;
|
|
|
|
|
updateQue.MaterialTypeName = materialTypeName;
|
|
|
|
|
updateQue.WeldType = weldType;
|
2024-07-01 09:29:35 +08:00
|
|
|
|
updateQue.IsPass = q.IsPass;
|
2024-05-08 16:27:28 +08:00
|
|
|
|
BLL.WelderQualifiedService.UpdateWelderQualifiedProject(updateQue);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInTop("请选择一名焊工!", MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 模板下载
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 模板下载
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnDownLoad_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
string rootPath = Server.MapPath("~/");
|
|
|
|
|
string uploadfilepath = rootPath + Const.WelderQueTemplateUrl;
|
|
|
|
|
string filePath = Const.WelderQueTemplateUrl;
|
|
|
|
|
string fileName = Path.GetFileName(filePath);
|
|
|
|
|
FileInfo info = new FileInfo(uploadfilepath);
|
|
|
|
|
long fileSize = info.Length;
|
|
|
|
|
Response.ClearContent();
|
|
|
|
|
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
|
|
|
|
Response.ContentType = "excel/plain";
|
|
|
|
|
Response.ContentEncoding = System.Text.Encoding.UTF8;
|
|
|
|
|
Response.AddHeader("Content-Length", fileSize.ToString().Trim());
|
|
|
|
|
Response.TransmitFile(uploadfilepath, 0, fileSize);
|
|
|
|
|
Response.End();
|
|
|
|
|
//PageContext.RegisterStartupScript(Confirm.GetShowReference("确定要下载焊工资质导入模板?", String.Empty, MessageBoxIcon.Question, PageManager1.GetCustomEventReference(false, "Confirm_OK"), PageManager1.GetCustomEventReference("Confirm_Cancel")));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 下载导入模板
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void PageManager1_CustomEvent(object sender, CustomEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (e.EventArgument == "Confirm_OK")
|
|
|
|
|
{
|
|
|
|
|
string rootPath = Server.MapPath("~/");
|
|
|
|
|
string uploadfilepath = rootPath + Const.WelderQueTemplateUrl;
|
|
|
|
|
string filePath = Const.WelderQueTemplateUrl;
|
|
|
|
|
string fileName = Path.GetFileName(filePath);
|
|
|
|
|
FileInfo info = new FileInfo(uploadfilepath);
|
|
|
|
|
long fileSize = info.Length;
|
|
|
|
|
Response.ClearContent();
|
|
|
|
|
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
|
|
|
|
Response.ContentType = "excel/plain";
|
|
|
|
|
Response.ContentEncoding = System.Text.Encoding.UTF8;
|
|
|
|
|
Response.AddHeader("Content-Length", fileSize.ToString().Trim());
|
|
|
|
|
Response.TransmitFile(uploadfilepath, 0, fileSize);
|
|
|
|
|
Response.End();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
protected void btnImport_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
string message = string.Empty;
|
|
|
|
|
errorInfos = string.Empty;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (this.fileUpload.HasFile == false)
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("请选择Excel文件!", MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
string IsXls = Path.GetExtension(this.fileUpload.FileName).ToString().Trim().ToLower();
|
|
|
|
|
if (IsXls != ".xls" && IsXls != ".xlsx")
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("只能选择Excel文件!", MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string rootPath = Server.MapPath("~/");
|
|
|
|
|
string initFullPath = rootPath + initPath;
|
|
|
|
|
if (!Directory.Exists(initFullPath))
|
|
|
|
|
{
|
|
|
|
|
Directory.CreateDirectory(initFullPath);
|
|
|
|
|
}
|
|
|
|
|
//指定上传文件名称
|
|
|
|
|
this.hidFileName.Text = BLL.Funs.GetNewFileName() + IsXls;
|
|
|
|
|
//上传文件路径
|
|
|
|
|
string filePath = initFullPath + this.hidFileName.Text;
|
|
|
|
|
//文件上传服务器
|
|
|
|
|
this.fileUpload.PostedFile.SaveAs(filePath);
|
|
|
|
|
//文件上传服务器后的名称
|
|
|
|
|
string fileName = rootPath + initPath + this.hidFileName.Text;
|
|
|
|
|
//读取Excel
|
|
|
|
|
DataSet ds = NPOIHelper.ExcelToDataSet(fileName, out errorInfos, true);
|
|
|
|
|
//验证Excel读取是否有误
|
|
|
|
|
if (!string.IsNullOrEmpty(errorInfos))
|
|
|
|
|
{
|
|
|
|
|
ShowNotify(errorInfos, MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ds.Tables.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
List<Model.Welder_WelderQualify> welderQueList = new List<Model.Welder_WelderQualify>();
|
|
|
|
|
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
Model.Welder_WelderQualify welderQue = new Model.Welder_WelderQualify();
|
|
|
|
|
#region 数据验证
|
|
|
|
|
string welderQueId = SQLHelper.GetNewID(typeof(Model.Welder_WelderQualify));
|
|
|
|
|
welderQue.WelderQualifiedProjectId = welderQueId;
|
|
|
|
|
|
|
|
|
|
if (ds.Tables[0].Rows[i]["焊工姓名"] != null && !string.IsNullOrEmpty(ds.Tables[0].Rows[i]["焊工姓名"].ToString()))
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
errorInfos += (i + 2) + "行, 焊工姓名不能为空!</br>";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string insId = string.Empty;
|
|
|
|
|
if (ds.Tables[0].Rows[i]["焊工号"] != null && !string.IsNullOrEmpty(ds.Tables[0].Rows[i]["焊工号"].ToString()))
|
|
|
|
|
{
|
|
|
|
|
var welder = from x in Funs.DB.Welder_Welder
|
|
|
|
|
where x.WelderCode == ds.Tables[0].Rows[i]["焊工号"].ToString()
|
|
|
|
|
&& x.WelderName == ds.Tables[0].Rows[i]["焊工姓名"].ToString()
|
|
|
|
|
select x;
|
|
|
|
|
|
|
|
|
|
if (welder.Count()>0)
|
|
|
|
|
{
|
|
|
|
|
welderQue.WelderId = welder.First().WelderId;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
errorInfos += (i + 2) + "行, 该焊工信息不存在!</br>";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
errorInfos += (i + 2) + "行, 焊工号不能为空!</br>";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ds.Tables[0].Rows[i]["焊工合格项目"] != null && !string.IsNullOrEmpty(ds.Tables[0].Rows[i]["焊工合格项目"].ToString()))
|
|
|
|
|
{
|
|
|
|
|
string strQue = ds.Tables[0].Rows[i]["焊工合格项目"].ToString();
|
|
|
|
|
var que = from x in Funs.DB.Welder_WelderQualify
|
|
|
|
|
where x.WelderId == welderQue.WelderId
|
|
|
|
|
&& x.QualifiedProjectCode == strQue
|
|
|
|
|
select x;
|
|
|
|
|
|
|
|
|
|
if (que.Count() == 0)
|
|
|
|
|
{
|
|
|
|
|
welderQue.QualifiedProjectCode = strQue;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
errorInfos += (i + 2) + "行, 该焊工合格项目已存在!</br>";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
errorInfos += (i + 2) + "行, 焊工合格项目不能为空!</br>";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ds.Tables[0].Rows[i]["有效日期"] != null && !string.IsNullOrEmpty(ds.Tables[0].Rows[i]["有效日期"].ToString()))
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
DateTime b = Convert.ToDateTime(ds.Tables[0].Rows[i]["有效日期"].ToString());
|
|
|
|
|
welderQue.LimitDate = b;
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
errorInfos += (i + 2) + "行,有效日期格式不正确!</br>";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-01 09:29:35 +08:00
|
|
|
|
welderQue.IsPass = true;
|
2024-05-08 16:27:28 +08:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
welderQueList.Add(welderQue);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 数据验证错误,返回
|
|
|
|
|
if (!string.IsNullOrEmpty(errorInfos))
|
|
|
|
|
{
|
|
|
|
|
ShowNotify(errorInfos, MessageBoxIcon.Warning, 10000);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
foreach (var item in welderQueList)
|
|
|
|
|
{
|
|
|
|
|
BLL.WelderQualifiedService.AddWelderQualifiedProject(item);
|
|
|
|
|
}
|
|
|
|
|
ShowNotify("焊工资质导入成功!", MessageBoxIcon.Success);
|
|
|
|
|
this.BindGrid();
|
|
|
|
|
//PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ShowAlert("没有数据!", MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
ShowAlert("'" + ex.Message + "'", MessageBoxIcon.Warning);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 格式化字符串
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 转换热处理类型
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="pt"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
protected string ConvertWeldType(object weldType)
|
|
|
|
|
{
|
|
|
|
|
string weldTypeNames = string.Empty;
|
|
|
|
|
if (weldType != null)
|
|
|
|
|
{
|
|
|
|
|
string[] type = weldType.ToString().Split(',');
|
|
|
|
|
foreach (string r in type)
|
|
|
|
|
{
|
|
|
|
|
if (r == "1")
|
|
|
|
|
{
|
|
|
|
|
weldTypeNames = weldTypeNames + "对接焊缝,";
|
|
|
|
|
}
|
|
|
|
|
if (r == "2")
|
|
|
|
|
{
|
|
|
|
|
weldTypeNames = weldTypeNames + "承插焊缝,";
|
|
|
|
|
}
|
|
|
|
|
if (r == "3")
|
|
|
|
|
{
|
|
|
|
|
weldTypeNames = weldTypeNames + "支管连接焊缝,";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (weldTypeNames.Length > 0)
|
|
|
|
|
{
|
|
|
|
|
weldTypeNames = weldTypeNames.Substring(0, weldTypeNames.Length - 1);
|
|
|
|
|
}
|
|
|
|
|
return weldTypeNames;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
private string GetTypeName(string type)
|
|
|
|
|
{
|
|
|
|
|
string typeName = string.Empty;
|
|
|
|
|
if (type == "FeI" || type== "FeⅠ")
|
|
|
|
|
{
|
|
|
|
|
typeName = "碳钢";
|
|
|
|
|
}
|
|
|
|
|
else if (type == "FeII" || type== "FeⅡ")
|
|
|
|
|
{
|
|
|
|
|
typeName = "不锈钢";
|
|
|
|
|
}
|
|
|
|
|
else if (type == "FeIII" || type== "FeⅢ")
|
|
|
|
|
{
|
|
|
|
|
typeName = "合金钢";
|
|
|
|
|
}
|
|
|
|
|
else if (type == "FeIV" || type== "FeⅣ")
|
|
|
|
|
{
|
|
|
|
|
typeName = "铬钼钢";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
typeName = "其它";
|
|
|
|
|
}
|
|
|
|
|
return typeName;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|