693 lines
30 KiB
C#
693 lines
30 KiB
C#
|
using BLL;
|
|||
|
using Newtonsoft.Json.Linq;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Web.UI.WebControls;
|
|||
|
|
|||
|
namespace FineUIPro.Web.HJGL.HotHardManage
|
|||
|
{
|
|||
|
public partial class HotHardManageEdit :PageBase
|
|||
|
{
|
|||
|
#region 定义项
|
|||
|
/// <summary>
|
|||
|
/// 主键
|
|||
|
/// </summary>
|
|||
|
public string HotHardID
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return (string)ViewState["HotHardID"];
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
ViewState["HotHardID"] = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 明细集合
|
|||
|
/// </summary>
|
|||
|
private static List<Model.View_HotHardItem> viewHotHardItems = new List<Model.View_HotHardItem>();
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 加载
|
|||
|
/// <summary>
|
|||
|
/// 加载页面
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void Page_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (!IsPostBack)
|
|||
|
{
|
|||
|
//单位、装置
|
|||
|
//if (BLL.UnitService.GetUnitByUnitId(this.CurrUser.UnitId) == null || BLL.UnitService.GetUnitByUnitId(this.CurrUser.UnitId).UnitTypeId == BLL.Const.ProjectUnitType_1)
|
|||
|
//{
|
|||
|
// BLL.UnitService.InitUnitNameByUnitTypeDropDownList(this.drpHotHardUnit, this.CurrUser.LoginProjectId, BLL.Const.ProjectUnitType_2, true);
|
|||
|
// BLL.Project_InstallationService.InitInstallationDropDownList(this.drpInstallationId, this.CurrUser.LoginProjectId, true);
|
|||
|
//}
|
|||
|
//else
|
|||
|
//{
|
|||
|
// BLL.UnitService.InitSubUnitNameDownList(this.drpHotHardUnit, this.CurrUser.LoginProjectId, this.CurrUser.UnitId, true);
|
|||
|
// BLL.Project_InstallationService.InitInstallationListDownList(this.drpInstallationId, this.CurrUser.LoginProjectId, this.CurrUser.UnitId, true);
|
|||
|
//}
|
|||
|
var pUnit = BLL.UnitService.GetUnitByProjectIdUnitTypeList(this.CurrUser.LoginProjectId, BLL.Const.ProjectUnitType_2);
|
|||
|
if (pUnit != null)
|
|||
|
{
|
|||
|
this.drpHotHardUnit.DataTextField = "UnitName";
|
|||
|
this.drpHotHardUnit.DataValueField = "UnitId";
|
|||
|
this.drpHotHardUnit.DataSource = pUnit;
|
|||
|
this.drpHotHardUnit.DataBind();
|
|||
|
this.drpHotHardUnit.SelectedValue = this.CurrUser.UnitId;
|
|||
|
|
|||
|
BLL.Project_InstallationService.InitInstallationListDownList(this.drpInstallationId, this.CurrUser.LoginProjectId, this.drpHotHardUnit.SelectedValue, true);
|
|||
|
this.drpInstallationId.SelectedIndex = 0;
|
|||
|
}
|
|||
|
BLL.UnitService.InitUnitByProjectIdUnitTypeDropDownList(this.drpCheckUnit, this.CurrUser.LoginProjectId, BLL.Const.ProjectUnitType_5, true);//检测单位
|
|||
|
BLL.UserService.InitUserDropDownList(this.drpHotHardMan, this.CurrUser.LoginProjectId, true);//委托人
|
|||
|
|
|||
|
this.txtReportDate.Text = string.Format("{0:yyyy-MM}", DateTime.Now);
|
|||
|
this.drpHotHardMan.SelectedValue = this.CurrUser.UserId;
|
|||
|
this.txtHotHardDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
|
|||
|
this.txtNDTMethod.Text = "硬度(HB)";
|
|||
|
this.txtNDTRate.Text = "100%";
|
|||
|
this.txtStandards.Text = "SH3501-2011";
|
|||
|
|
|||
|
InitTreeMenu();//加载树
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 加载树装置-单位-工作区
|
|||
|
/// <summary>
|
|||
|
/// 加载树
|
|||
|
/// </summary>
|
|||
|
private void InitTreeMenu()
|
|||
|
{
|
|||
|
if (!string.IsNullOrEmpty(this.txtReportDate.Text.Trim()))
|
|||
|
{
|
|||
|
DateTime? startTime = Funs.GetNewDateTime(this.txtReportDate.Text.Trim());
|
|||
|
DateTime? endTime = startTime.HasValue ? startTime.Value.AddMonths(1) : System.DateTime.Now;
|
|||
|
|
|||
|
this.tvControlItem.Nodes.Clear();
|
|||
|
TreeNode rootNode = new TreeNode();
|
|||
|
rootNode.Text = "单位-装置-月份";
|
|||
|
rootNode.NodeID = "0";
|
|||
|
rootNode.Expanded = true;
|
|||
|
this.tvControlItem.Nodes.Add(rootNode);
|
|||
|
|
|||
|
List<Model.Base_Unit> units = null;
|
|||
|
var unit = BLL.UnitService.GetUnitByUnitId(this.CurrUser.UnitId);
|
|||
|
if (unit == null || unit.UnitTypeId == BLL.Const.ProjectUnitType_1)
|
|||
|
{
|
|||
|
units = BLL.UnitService.GetUnitByProjectIdUnitTypeList(this.CurrUser.LoginProjectId, "2");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
units = (from x in Funs.DB.Base_Unit where x.UnitId == this.CurrUser.UnitId select x).ToList();
|
|||
|
}
|
|||
|
List<Model.HotHard> hotHardLists = new List<Model.HotHard>(); ///硬度委托
|
|||
|
hotHardLists = (from x in Funs.DB.HotHard
|
|||
|
where x.ProjectId == this.CurrUser.LoginProjectId && x.HotHardDate >= startTime && x.HotHardDate < endTime
|
|||
|
select x).ToList();
|
|||
|
|
|||
|
if (units != null)
|
|||
|
{
|
|||
|
foreach (var item in units)
|
|||
|
{
|
|||
|
TreeNode rootUnitNode = new TreeNode();//定义根节点
|
|||
|
rootUnitNode.Text = item.UnitName;
|
|||
|
rootUnitNode.NodeID = item.UnitId;
|
|||
|
rootUnitNode.Expanded = true;
|
|||
|
rootUnitNode.ToolTip = "施工单位";
|
|||
|
rootNode.Nodes.Add(rootUnitNode);
|
|||
|
var lists = hotHardLists.Where(x => x.HotHardUnit == item.UnitId).ToList();
|
|||
|
this.BindNodes(rootUnitNode, lists);
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
Alert.ShowInTop("请先增加施工单位!", MessageBoxIcon.Warning);
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
Alert.ShowInTop("请选择委托月份!", MessageBoxIcon.Warning);
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 绑定树节点
|
|||
|
/// <summary>
|
|||
|
/// 绑定树节点
|
|||
|
/// </summary>
|
|||
|
/// <param name="node"></param>
|
|||
|
private void BindNodes(TreeNode node, List<Model.HotHard> hotHardLists)
|
|||
|
{
|
|||
|
if (node.ToolTip == "施工单位")
|
|||
|
{
|
|||
|
var installId = (from x in hotHardLists select x.InstallationId).Distinct();
|
|||
|
if (installId.Count() > 0)
|
|||
|
{
|
|||
|
var install = from x in Funs.DB.Project_Installation where installId.Contains(x.InstallationId) orderby x.InstallationCode select x;
|
|||
|
foreach (var q in install)
|
|||
|
{
|
|||
|
TreeNode newNode = new TreeNode();
|
|||
|
newNode.Text = q.InstallationCode + q.InstallationName;
|
|||
|
newNode.NodeID = q.InstallationId + "|" + node.NodeID; ;
|
|||
|
newNode.ToolTip = "装置";
|
|||
|
newNode.Expanded = true;
|
|||
|
node.Nodes.Add(newNode);
|
|||
|
this.BindNodes(newNode, hotHardLists);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
else if (node.ToolTip == "装置")
|
|||
|
{
|
|||
|
string installationId = Funs.GetStrListByStr(node.NodeID, '|')[0];
|
|||
|
var hotListMonth = (from x in hotHardLists
|
|||
|
where x.InstallationId == installationId && x.HotHardUnit == node.ParentNode.NodeID
|
|||
|
select string.Format("{0:yyyy-MM}", x.HotHardDate)).Distinct();
|
|||
|
foreach (var item in hotListMonth)
|
|||
|
{
|
|||
|
TreeNode newNode = new TreeNode();
|
|||
|
newNode.Text = item;
|
|||
|
newNode.NodeID = item + "|" + node.NodeID; ;
|
|||
|
newNode.ToolTip = "月份";
|
|||
|
node.Nodes.Add(newNode);
|
|||
|
this.BindNodes(newNode, hotHardLists);
|
|||
|
}
|
|||
|
}
|
|||
|
else if (node.ToolTip == "月份")
|
|||
|
{
|
|||
|
string installationId = Funs.GetStrListByStr(node.ParentNode.NodeID, '|')[0];
|
|||
|
var days = (from x in hotHardLists
|
|||
|
where x.InstallationId == installationId && x.HotHardUnit == node.ParentNode.ParentNode.NodeID
|
|||
|
orderby x.HotHardDate descending
|
|||
|
select x.HotHardDate).Distinct();
|
|||
|
foreach (var item in days)
|
|||
|
{
|
|||
|
TreeNode newNode = new TreeNode();
|
|||
|
newNode.Text = string.Format("{0:yyyy-MM-dd}", item);
|
|||
|
newNode.NodeID = item.ToString() + "|" + node.NodeID; ;
|
|||
|
newNode.ToolTip = "日期";
|
|||
|
node.Nodes.Add(newNode);
|
|||
|
this.BindNodes(newNode, hotHardLists);
|
|||
|
}
|
|||
|
}
|
|||
|
else if (node.ToolTip == "日期")
|
|||
|
{
|
|||
|
string installationId = Funs.GetStrListByStr(node.ParentNode.ParentNode.NodeID, '|')[0];
|
|||
|
var dReports = from x in hotHardLists
|
|||
|
where x.InstallationId == installationId && x.HotHardUnit == node.ParentNode.ParentNode.ParentNode.NodeID
|
|||
|
&& x.HotHardDate == Funs.GetNewDateTime(node.Text)
|
|||
|
orderby x.HotHardCode descending
|
|||
|
select x;
|
|||
|
foreach (var item in dReports)
|
|||
|
{
|
|||
|
TreeNode newNode = new TreeNode();
|
|||
|
if (!string.IsNullOrEmpty(item.HotHardCode))
|
|||
|
{
|
|||
|
newNode.Text = item.HotHardCode;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
newNode.Text = "未知";
|
|||
|
}
|
|||
|
if (!item.AuditDate.HasValue || string.IsNullOrEmpty(item.AuditMan))
|
|||
|
{
|
|||
|
newNode.Text = "<font color='#FF7575'>" + newNode.Text + "</font>";
|
|||
|
node.Text = "<font color='#FF7575'>" + node.Text + "</font>";
|
|||
|
node.ParentNode.Text = "<font color='#FF7575'>" + node.ParentNode.Text + "</font>";
|
|||
|
}
|
|||
|
newNode.NodeID = item.HotHardID;
|
|||
|
newNode.EnableClickEvent = true;
|
|||
|
node.Nodes.Add(newNode);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 查询树节点
|
|||
|
protected void Tree_TextChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
this.InitTreeMenu();
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 点击树节点
|
|||
|
/// <summary>
|
|||
|
/// 点击树节点
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
|
|||
|
{
|
|||
|
viewHotHardItems = new List<Model.View_HotHardItem>();
|
|||
|
this.HotHardID = this.tvControlItem.SelectedNodeID;
|
|||
|
if (!string.IsNullOrEmpty(this.HotHardID))
|
|||
|
{
|
|||
|
Model.HotHard hotHard = BLL.HotHardManageEditService.GetHotHardByID(this.HotHardID);
|
|||
|
if (hotHard != null)
|
|||
|
{
|
|||
|
if (!string.IsNullOrEmpty(hotHard.HotHardUnit))
|
|||
|
{
|
|||
|
this.drpHotHardUnit.SelectedValue = hotHard.HotHardUnit;
|
|||
|
}
|
|||
|
if (!string.IsNullOrEmpty(hotHard.InstallationId))
|
|||
|
{
|
|||
|
this.drpInstallationId.SelectedValue = hotHard.InstallationId;
|
|||
|
}
|
|||
|
this.txtHotHardCode.Text = hotHard.HotHardCode;
|
|||
|
if (!string.IsNullOrEmpty(hotHard.CheckUnit))
|
|||
|
{
|
|||
|
this.drpCheckUnit.SelectedValue = hotHard.CheckUnit;
|
|||
|
}
|
|||
|
if (!string.IsNullOrEmpty(hotHard.HotHardMan))
|
|||
|
{
|
|||
|
this.drpHotHardMan.SelectedValue = hotHard.HotHardMan;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
this.drpHotHardMan.SelectedValue = this.CurrUser.UserId;
|
|||
|
}
|
|||
|
this.txtHotHardDate.Text = hotHard.HotHardDate.HasValue ? string.Format("{0:yyyy-MM-dd}", hotHard.HotHardDate) : string.Format("{0:yyyy-MM-dd}", DateTime.Now);
|
|||
|
this.txtNDTMethod.Text = hotHard.NDTMethod;
|
|||
|
this.txtNDTRate.Text = hotHard.NDTRate;
|
|||
|
this.txtStandards.Text = hotHard.Standards;
|
|||
|
this.txtInspectionNum.Text = hotHard.InspectionNum;
|
|||
|
this.txtCheckNum.Text = hotHard.CheckNum;
|
|||
|
this.txtTestWeldNum.Text = hotHard.TestWeldNum;
|
|||
|
this.cblDetectionTime.SelectedValueArray = hotHard.DetectionTime.Split(',');
|
|||
|
this.txtSendee.Text = hotHard.Sendee;
|
|||
|
|
|||
|
viewHotHardItems.Clear();
|
|||
|
viewHotHardItems = BLL.HotHardManageEditService.GetView_HotHardItemByHotHardID(this.HotHardID);
|
|||
|
if (viewHotHardItems.Count > 0)
|
|||
|
{
|
|||
|
this.Grid1.DataSource = viewHotHardItems;
|
|||
|
this.Grid1.DataBind();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
this.HotHardID = string.Empty;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 增加
|
|||
|
/// <summary>
|
|||
|
/// 增加按钮
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void btnAdd_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (this.GetButtonPower(BLL.Const.BtnAdd))
|
|||
|
{
|
|||
|
TextIsEmpty();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 初始化页面
|
|||
|
/// </summary>
|
|||
|
private void TextIsEmpty()
|
|||
|
{
|
|||
|
this.drpHotHardUnit.SelectedIndex = 0;
|
|||
|
this.drpInstallationId.SelectedIndex = 0;
|
|||
|
this.txtHotHardCode.Text = string.Empty;
|
|||
|
this.drpCheckUnit.SelectedIndex = 0;
|
|||
|
this.drpHotHardMan.Text = this.CurrUser.UserId;
|
|||
|
this.txtHotHardDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
|
|||
|
this.txtNDTMethod.Text = "硬度(HB)";
|
|||
|
this.txtNDTRate.Text = "100%";
|
|||
|
this.txtStandards.Text = "SH3501-2011";
|
|||
|
this.txtInspectionNum.Text = string.Empty;
|
|||
|
this.txtCheckNum.Text = string.Empty;
|
|||
|
this.txtTestWeldNum.Text = string.Empty;
|
|||
|
this.cblDetectionTime.SelectedIndexArray = new int[0];
|
|||
|
this.txtSendee.Text = string.Empty;
|
|||
|
|
|||
|
this.HotHardID = string.Empty;
|
|||
|
viewHotHardItems.Clear();
|
|||
|
this.Grid1.DataSource = viewHotHardItems;
|
|||
|
this.Grid1.DataBind();
|
|||
|
InitTreeMenu();
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 查找管线焊口
|
|||
|
/// <summary>
|
|||
|
/// 查找
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void btnSearch_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (this.GetButtonPower(BLL.Const.BtnSave))
|
|||
|
{
|
|||
|
if (this.drpHotHardUnit.SelectedValue == BLL.Const._Null || string.IsNullOrEmpty(this.drpHotHardUnit.SelectedValue))
|
|||
|
{
|
|||
|
Alert.ShowInTop("请选择委托单位!", MessageBoxIcon.Warning);
|
|||
|
return;
|
|||
|
}
|
|||
|
else if (this.drpInstallationId.SelectedValue == BLL.Const._Null || string.IsNullOrEmpty(this.drpInstallationId.SelectedValue))
|
|||
|
{
|
|||
|
Alert.ShowInTop("请选择装置名称!", MessageBoxIcon.Warning);
|
|||
|
return;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
string window = String.Format("ShowHotHardSearch.aspx?unitId={0}&&installationId={1}", this.drpHotHardUnit.SelectedValue, this.drpInstallationId.SelectedValue, "编辑 - ");
|
|||
|
PageContext.RegisterStartupScript(Window1.GetSaveStateReference(this.hdJOTID.ClientID)
|
|||
|
+ Window1.GetShowReference(window));
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 关闭弹出窗体
|
|||
|
/// <summary>
|
|||
|
/// 关闭弹出窗体
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
|||
|
{
|
|||
|
viewHotHardItems = new List<Model.View_HotHardItem>();
|
|||
|
|
|||
|
List<string> infos = Funs.GetStrListByStr(hdJOTID.Text, ',');
|
|||
|
foreach (var item in infos)
|
|||
|
{
|
|||
|
var info = BLL.HotHardManageEditService.GetView_HotHardItemByJotID(item, this.CurrUser.LoginProjectId);
|
|||
|
if (info != null)
|
|||
|
{
|
|||
|
info.Remark = null;
|
|||
|
viewHotHardItems.Add(info);
|
|||
|
}
|
|||
|
}
|
|||
|
if (viewHotHardItems.Count > 0)
|
|||
|
{
|
|||
|
this.txtCheckNum.Text = viewHotHardItems.Count.ToString();
|
|||
|
this.txtTestWeldNum.Text = viewHotHardItems.Count.ToString();
|
|||
|
|
|||
|
this.Grid1.DataSource = viewHotHardItems;
|
|||
|
this.Grid1.DataBind();
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 删除硬度委托
|
|||
|
/// <summary>
|
|||
|
/// 删除
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void btnDelete_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (this.GetButtonPower(BLL.Const.BtnDelete))
|
|||
|
{
|
|||
|
if (!string.IsNullOrEmpty(this.HotHardID))
|
|||
|
{
|
|||
|
var HotHard = BLL.HotHardManageEditService.GetHotHardByID(HotHardID);
|
|||
|
if (HotHard != null && !HotHard.AuditDate.HasValue)
|
|||
|
{
|
|||
|
BLL.HotHardManageEditService.DeleteHotHardItemByHotHardID(HotHardID);
|
|||
|
BLL.HotHardManageEditService.DeleteHotHardByHotHardID(HotHardID);
|
|||
|
ShowNotify("删除成功!", MessageBoxIcon.Success);
|
|||
|
TextIsEmpty();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
Alert.ShowInTop("此委托单已审核不能删除!", MessageBoxIcon.Warning);
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
Alert.ShowInTop("请选择要删除的委托记录!", MessageBoxIcon.Warning);
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 右键删除
|
|||
|
/// <summary>
|
|||
|
/// 右键删除
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void btnMenuDelete_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (this.GetButtonPower(BLL.Const.BtnDelete))
|
|||
|
{
|
|||
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|||
|
{
|
|||
|
Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning);
|
|||
|
return;
|
|||
|
}
|
|||
|
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
|
|||
|
{
|
|||
|
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
|
|||
|
var item =viewHotHardItems.FirstOrDefault(x => x.JOT_ID == rowID);
|
|||
|
if (item != null)
|
|||
|
{
|
|||
|
viewHotHardItems.RemoveAt(rowIndex);
|
|||
|
}
|
|||
|
}
|
|||
|
Grid1.DataSource = viewHotHardItems;
|
|||
|
Grid1.DataBind();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 保存热处理
|
|||
|
/// <summary>
|
|||
|
/// 保存
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void btnSave_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (this.GetButtonPower(BLL.Const.BtnSave))
|
|||
|
{
|
|||
|
if (viewHotHardItems.Count <= 0)
|
|||
|
{
|
|||
|
Alert.ShowInTop("请选择委托明细项!", MessageBoxIcon.Warning);
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
if (this.drpHotHardUnit.SelectedValue == BLL.Const._Null || string.IsNullOrEmpty(this.drpHotHardUnit.SelectedValue))
|
|||
|
{
|
|||
|
Alert.ShowInTop("请选择委托单位!", MessageBoxIcon.Warning);
|
|||
|
return;
|
|||
|
}
|
|||
|
if (this.drpInstallationId.SelectedValue == BLL.Const._Null || string.IsNullOrEmpty(this.drpInstallationId.SelectedValue))
|
|||
|
{
|
|||
|
Alert.ShowInTop("请选择装置名称!", MessageBoxIcon.Warning);
|
|||
|
return;
|
|||
|
}
|
|||
|
if (this.drpCheckUnit.SelectedValue==BLL.Const._Null||string.IsNullOrEmpty(this.drpCheckUnit.SelectedValue))
|
|||
|
{
|
|||
|
Alert.ShowInTop("请选择检测单位!", MessageBoxIcon.Warning);
|
|||
|
return;
|
|||
|
}
|
|||
|
if (this.drpHotHardMan.SelectedValue == BLL.Const._Null || string.IsNullOrEmpty(this.drpHotHardMan.SelectedValue))
|
|||
|
{
|
|||
|
Alert.ShowInTop("请选择委托人!", MessageBoxIcon.Warning);
|
|||
|
return;
|
|||
|
}
|
|||
|
Model.HotHard HotHard = new Model.HotHard();
|
|||
|
HotHard.HotHardCode = this.txtHotHardCode.Text.Trim();
|
|||
|
HotHard.HotHardUnit = this.drpHotHardUnit.SelectedValue;
|
|||
|
HotHard.HotHardDate = Funs.GetNewDateTime(this.txtHotHardDate.Text.Trim());
|
|||
|
HotHard.NDTRate = this.txtNDTRate.Text.Trim();
|
|||
|
HotHard.NDTMethod = this.txtNDTMethod.Text.Trim();
|
|||
|
HotHard.CheckUnit = this.drpCheckUnit.SelectedValue;
|
|||
|
HotHard.ProjectId = this.CurrUser.LoginProjectId;
|
|||
|
HotHard.InstallationId = this.drpInstallationId.SelectedValue;
|
|||
|
HotHard.DetectionTime = GetStringByArray(this.cblDetectionTime.SelectedValueArray);
|
|||
|
HotHard.Sendee = this.txtSendee.Text.Trim();
|
|||
|
HotHard.Standards = this.txtStandards.Text.Trim();
|
|||
|
HotHard.InspectionNum = this.txtInspectionNum.Text.Trim();
|
|||
|
HotHard.CheckNum = this.txtCheckNum.Text.Trim();
|
|||
|
HotHard.TestWeldNum = this.txtTestWeldNum.Text.Trim();
|
|||
|
HotHard.HotHardMan = this.drpHotHardMan.SelectedValue;
|
|||
|
|
|||
|
var updateHotHard = BLL.HotHardManageEditService.GetHotHardByID(HotHardID);
|
|||
|
if (updateHotHard != null && updateHotHard.AuditDate.HasValue)
|
|||
|
{
|
|||
|
Alert.ShowInTop("此条委托单已审核不能修改!", MessageBoxIcon.Warning);
|
|||
|
return;
|
|||
|
}
|
|||
|
if (updateHotHard != null && !string.IsNullOrEmpty(HotHardID))
|
|||
|
{
|
|||
|
HotHard.HotHardID = HotHardID;
|
|||
|
BLL.HotHardManageEditService.UpdateHotHard(HotHard);
|
|||
|
BLL.HotHardManageEditService.DeleteHotHardItemByHotHardID(HotHardID);
|
|||
|
//BLL.LogService.AddLog(this.CurrUser.UserId, "修改委托单信息");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
HotHard.HotHardID = SQLHelper.GetNewID(typeof(Model.HotHard));
|
|||
|
this.HotHardID = HotHard.HotHardID;
|
|||
|
BLL.HotHardManageEditService.AddHotHard(HotHard);
|
|||
|
//BLL.LogService.AddLog(this.CurrUser.UserId, "添加委托单信息");
|
|||
|
}
|
|||
|
|
|||
|
JArray mergedData = Grid1.GetMergedData();
|
|||
|
foreach (JObject mergedRow in mergedData)
|
|||
|
{
|
|||
|
string status = mergedRow.Value<string>("status");
|
|||
|
JObject values = mergedRow.Value<JObject>("values");
|
|||
|
|
|||
|
string rowID = values.Value<string>("JOT_ID").ToString();
|
|||
|
var item = viewHotHardItems.FirstOrDefault(x => x.JOT_ID == rowID);
|
|||
|
if (item != null)
|
|||
|
{
|
|||
|
item.HotHardID = this.HotHardID;
|
|||
|
item.JOT_ID = rowID;
|
|||
|
item.Remark = values.Value<string>("Remark");
|
|||
|
}
|
|||
|
}
|
|||
|
foreach (var item in viewHotHardItems)
|
|||
|
{
|
|||
|
Model.HotHardItem newHotHardItem = new Model.HotHardItem();
|
|||
|
newHotHardItem.HotHardID = this.HotHardID;
|
|||
|
newHotHardItem.JOT_ID = item.JOT_ID;
|
|||
|
newHotHardItem.Remark = item.Remark;
|
|||
|
BLL.HotHardManageEditService.AddHotHardItem(newHotHardItem);
|
|||
|
}
|
|||
|
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
|||
|
InitTreeMenu();
|
|||
|
viewHotHardItems.Clear();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region DropDownList下拉选择事件
|
|||
|
/// <summary>
|
|||
|
/// 单位下拉选择事件
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void drpHotHardUnit_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
this.drpInstallationId.Items.Clear();
|
|||
|
if (!string.IsNullOrEmpty(this.drpHotHardUnit.SelectedValue) && this.drpHotHardUnit.SelectedValue != BLL.Const._Null)
|
|||
|
{
|
|||
|
//if (BLL.WorkAreaService.IsSupervisor(this.CurrUser.UnitId, this.CurrUser.LoginProjectId))
|
|||
|
//{
|
|||
|
// BLL.Project_InstallationService.InitInstallationBySupervisorUnitIdListDownList(this.drpInstallationId, this.CurrUser.LoginProjectId, this.drpHotHardUnit.SelectedValue, this.CurrUser.UnitId, true);
|
|||
|
// this.drpInstallationId.SelectedIndex = 0;
|
|||
|
//}
|
|||
|
//else
|
|||
|
//{
|
|||
|
// BLL.Project_InstallationService.InitInstallationListDownList(this.drpInstallationId, this.CurrUser.LoginProjectId, this.drpHotHardUnit.SelectedValue, true);
|
|||
|
// this.drpInstallationId.SelectedIndex = 0;
|
|||
|
//}
|
|||
|
BLL.Project_InstallationService.InitInstallationListDownList(this.drpInstallationId, this.CurrUser.LoginProjectId, this.drpHotHardUnit.SelectedValue, true);
|
|||
|
this.drpInstallationId.SelectedIndex = 0;
|
|||
|
//加载编号
|
|||
|
string prefixCode = string.Empty;
|
|||
|
var tccCode = BLL.UnitService.GetUnitCodeByUnitId(BLL.Const.UnitId_CD);
|
|||
|
var unitCode = BLL.UnitService.GetUnitCodeByUnitId(this.drpHotHardUnit.SelectedValue);
|
|||
|
if (!string.IsNullOrEmpty(tccCode))
|
|||
|
{
|
|||
|
prefixCode = tccCode + "-" + unitCode + "-HB-";
|
|||
|
}
|
|||
|
this.txtHotHardCode.Text = BLL.SQLHelper.RunProcNewId("SpGetNewCode5ByProjectId", "dbo.HotHard", "HotHardCode", this.CurrUser.LoginProjectId, prefixCode);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
Funs.FineUIPleaseSelect(this.drpInstallationId);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 装置下拉选择事件
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void drpInstallationId_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (this.drpHotHardUnit.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpHotHardUnit.SelectedValue) && this.drpInstallationId.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpInstallationId.SelectedValue))
|
|||
|
{
|
|||
|
//加载编号
|
|||
|
string prefixCode = string.Empty;
|
|||
|
var tccCode = BLL.UnitService.GetUnitCodeByUnitId(BLL.Const.UnitId_CD);
|
|||
|
var unitCode = BLL.UnitService.GetUnitCodeByUnitId(this.drpHotHardUnit.SelectedValue);
|
|||
|
var area = BLL.WorkAreaService.GetWorkAreaByProjectIdAndInstalltionIdAndUnitId(this.CurrUser.LoginProjectId, this.drpInstallationId.SelectedValue, this.drpHotHardUnit.SelectedValue);
|
|||
|
if (!string.IsNullOrEmpty(tccCode))
|
|||
|
{
|
|||
|
prefixCode = tccCode + "-" + unitCode + "-" + area.WorkAreaCode + "-HB-";
|
|||
|
}
|
|||
|
this.txtHotHardCode.Text = BLL.SQLHelper.RunProcNewId("SpGetNewCode5ByProjectId", "dbo.HotHard", "HotHardCode", this.CurrUser.LoginProjectId, prefixCode);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 格式化字符串
|
|||
|
/// <summary>
|
|||
|
/// 获取多个值
|
|||
|
/// </summary>
|
|||
|
/// <param name="array"></param>
|
|||
|
/// <returns></returns>
|
|||
|
private string GetStringByArray(string[] array)
|
|||
|
{
|
|||
|
string str = string.Empty;
|
|||
|
foreach (var item in array)
|
|||
|
{
|
|||
|
if (item != BLL.Const._Null)
|
|||
|
{
|
|||
|
str += item + ",";
|
|||
|
}
|
|||
|
}
|
|||
|
if (!string.IsNullOrEmpty(str))
|
|||
|
{
|
|||
|
str = str.Substring(0, str.LastIndexOf(","));
|
|||
|
}
|
|||
|
return str;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 获取按钮权限
|
|||
|
/// <summary>
|
|||
|
/// 获取按钮权限
|
|||
|
/// </summary>
|
|||
|
/// <param name="button"></param>
|
|||
|
/// <returns></returns>
|
|||
|
private bool GetButtonPower(string button)
|
|||
|
{
|
|||
|
return BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.HJGL_HotHardManageMenuId, button);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|