ChengDa_English/SGGL/FineUIPro.Web/HJGL/WeldingManage/PointManage.aspx.cs

791 lines
35 KiB
C#

using BLL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.HJGL.WeldingManage
{
public partial class PointManage : PageBase
{
#region
/// <summary>
/// 点口管理主键
/// </summary>
public string PW_PointID
{
get
{
return (string)ViewState["PW_PointID"];
}
set
{
ViewState["PW_PointID"] = value;
}
}
/// <summary>
/// 焊口集合
/// </summary>
private static List<Model.View_JointInfo> jointInfos = new List<Model.View_JointInfo>();
#endregion
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.txtPointManageDate.Text = string.Format("{0:yyyy-MM}", System.DateTime.Now);
this.InitTreeMenu();//加载树
#region
BLL.UserService.InitUserDropDownList(this.drpTabler, this.CurrUser.LoginProjectId, true);//制单人
//var unit = BLL.UnitService.GetUnitByUnitId(this.CurrUser.UnitId);//单位
//if (unit == null || unit.UnitTypeId == BLL.Const.ProjectUnitType_1 || unit.UnitTypeId == BLL.Const.ProjectUnitType_3)
//{
// if (BLL.WorkAreaService.IsSupervisor(this.CurrUser.UnitId, this.CurrUser.LoginProjectId))
// {
// BLL.UnitService.InitSubUnitNameDownList(this.drpUnit, this.CurrUser.LoginProjectId, this.CurrUser.UnitId, true);
// }
// else
// {
// BLL.UnitService.InitUnitNameByUnitTypeDropDownList(this.drpUnit, this.CurrUser.LoginProjectId, BLL.Const.ProjectUnitType_2, true);
// }
//}
//else
//{
// BLL.UnitService.InitSubUnitNameListDownList(this.drpUnit, this.CurrUser.LoginProjectId, this.CurrUser.UnitId, true);
//}
var pUnit = BLL.UnitService.GetUnitByProjectIdUnitTypeList(this.CurrUser.LoginProjectId, BLL.Const.ProjectUnitType_2);
if (pUnit != null)
{
this.drpUnit.DataTextField = "UnitName";
this.drpUnit.DataValueField = "UnitId";
this.drpUnit.DataSource = pUnit;
this.drpUnit.DataBind();
this.drpUnit.SelectedValue = this.CurrUser.UnitId;
if(this.CurrUser.UnitId!=Const.UnitId_CD && this.CurrUser.UserId!=Const.hfnbdId)
{
this.drpUnit.Enabled = false;
}
BLL.Project_InstallationService.InitInstallationListDownList(this.drpInstallationId, this.CurrUser.LoginProjectId, this.drpUnit.SelectedValue, true);
this.drpInstallationId.SelectedIndex = 0;
}
//Funs.FineUIPleaseSelect(this.drpInstallationId);
this.drpTabler.SelectedValue = this.CurrUser.UserId;
this.txtTableDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
this.txtPointDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
//if (BLL.Project_SysSetService.IsAuto("2", this.CurrUser.LoginProjectId) == true)
var set = BLL.Project_SysSetService.GetSysSetBySetId("2", this.CurrUser.LoginProjectId);
if (set != null && set.IsAuto == true)
{
string date = this.txtPointDate.Text.Trim().Replace("-", "");
this.txtPointID.Text = BLL.SQLHelper.RunProcNewId("SpGetNewCode3ByProjectPrefix", "dbo.BO_Point", "PW_PointNo", this.CurrUser.LoginProjectId, date + "-");
}
else
{
this.txtPointID.Readonly = false;
}
#endregion
}
}
#endregion
#region --
/// <summary>
/// 加载树
/// </summary>
private void InitTreeMenu()
{
if (!string.IsNullOrEmpty(this.txtPointManageDate.Text.Trim()))
{
DateTime? startTime = Funs.GetNewDateTime(this.txtPointManageDate.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 = Funs.DB.Project_ProjectUnit.FirstOrDefault(x=>x.UnitId==this.CurrUser.UnitId);
if (unit == null || unit.UnitType == BLL.Const.ProjectUnitType_1 || unit.UnitType == BLL.Const.ProjectUnitType_3)
{
if (BLL.WorkAreaService.IsSupervisor(this.CurrUser.UnitId, this.CurrUser.LoginProjectId))
{
units = (from x in Funs.DB.Base_Unit
join y in Funs.DB.ProjectData_WorkArea on x.UnitId equals y.UnitId
where (x.UnitId == this.CurrUser.UnitId || y.SupervisorUnitId == this.CurrUser.UnitId) && y.ProjectId == this.CurrUser.LoginProjectId
select x).Distinct().ToList();
}
else
{
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.BO_Point> pointLists = new List<Model.BO_Point>(); ///点口单
if (!this.txtPointManageDate.Hidden)
{
pointLists = (from x in Funs.DB.BO_Point
where x.ProjectId == this.CurrUser.LoginProjectId && x.PW_PointDate >= startTime && x.PW_PointDate < endTime
select x).ToList();
}
else
{
pointLists = (from x in Funs.DB.BO_Point
where x.ProjectId == this.CurrUser.LoginProjectId && x.PW_PointNo.Contains(this.txtSearchCode.Text.Trim())
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 pointList = pointLists.Where(x => x.UnitId == item.UnitId).ToList();
this.BindNodes(rootUnitNode, pointList);
}
}
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.BO_Point> pointList)
{
if (node.ToolTip == "施工单位")
{
var installId = (from x in pointList 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.InstallationName;
newNode.NodeID = q.InstallationId + "|" + node.NodeID; ;
newNode.ToolTip = "装置";
newNode.Expanded = true;
node.Nodes.Add(newNode);
this.BindNodes(newNode, pointList);
}
}
}
else if (node.ToolTip == "装置")
{
string installationId = Funs.GetStrListByStr(node.NodeID, '|')[0];
var pointListMonth = (from x in pointList
where x.InstallationId == installationId && x.UnitId == node.ParentNode.NodeID
select string.Format("{0:yyyy-MM}", x.PW_PointDate)).Distinct();
foreach (var item in pointListMonth)
{
TreeNode newNode = new TreeNode();
newNode.Text = item;
newNode.NodeID = item + "|" + node.NodeID; ;
newNode.ToolTip = "月份";
node.Nodes.Add(newNode);
this.BindNodes(newNode, pointList);
}
}
else if (node.ToolTip == "月份")
{
string installationId = Funs.GetStrListByStr(node.ParentNode.NodeID, '|')[0];
var days = (from x in pointList
where x.InstallationId == installationId && x.UnitId == node.ParentNode.ParentNode.NodeID
orderby x.PW_PointDate descending
select x.PW_PointDate).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, pointList);
}
}
else if (node.ToolTip == "日期")
{
string installationId = Funs.GetStrListByStr(node.ParentNode.ParentNode.NodeID, '|')[0];
var dReports = from x in pointList
where x.InstallationId == installationId && x.UnitId == node.ParentNode.ParentNode.ParentNode.NodeID
&& x.PW_PointDate == Funs.GetNewDateTime(node.Text)
orderby x.PW_PointNo descending
select x;
foreach (var item in dReports)
{
TreeNode newNode = new TreeNode();
if (!string.IsNullOrEmpty(item.PW_PointNo))
{
newNode.Text = item.PW_PointNo;
}
else
{
newNode.Text = "未知";
}
var infos = Funs.DB.PW_JointInfo.FirstOrDefault(x => x.PW_PointID == item.PW_PointID && x.JOT_TrustFlag != null && x.JOT_TrustFlag != "00");
if (infos == null)
{
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.PW_PointID;
newNode.EnableClickEvent = true;
node.Nodes.Add(newNode);
}
}
}
#endregion
#region DropDownList下拉选择事件
/// <summary>
/// 单位下拉选择事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void drpUnit_SelectedIndexChanged(object sender, EventArgs e)
{
this.drpInstallationId.Items.Clear();
if (!string.IsNullOrEmpty(this.drpUnit.SelectedValue) && this.drpUnit.SelectedValue != BLL.Const._Null)
{
//if (BLL.WorkAreaService.IsSupervisor(this.CurrUser.UnitId, this.CurrUser.LoginProjectId))
//{
// BLL.Project_InstallationService.InitInstallationBySupervisorUnitIdListDownList(this.drpInstallationId, this.CurrUser.LoginProjectId, this.drpUnit.SelectedValue, this.CurrUser.UnitId, true);
// this.drpInstallationId.SelectedIndex = 0;
//}
//else
//{
// BLL.Project_InstallationService.InitInstallationListDownList(this.drpInstallationId, this.CurrUser.LoginProjectId, this.drpUnit.SelectedValue, true);
// this.drpInstallationId.SelectedIndex = 0;
//}
BLL.Project_InstallationService.InitInstallationListDownList(this.drpInstallationId, this.CurrUser.LoginProjectId, this.drpUnit.SelectedValue, true);
this.drpInstallationId.SelectedIndex = 0;
}
else
{
Funs.FineUIPleaseSelect(this.drpInstallationId);
}
}
#endregion
#region
/// <summary>
/// 按月份/按单号查询
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ckFind_SelectedIndexChanged(object sender, EventArgs e)
{
if (this.ckFind.SelectedValue == "0")
{
this.txtPointManageDate.Hidden = false;
this.txtSearchCode.Hidden = true;
if (string.IsNullOrEmpty(this.txtPointManageDate.Text))
{
this.txtPointManageDate.Text = string.Format("{0:yyyy-MM}", DateTime.Now);
}
}
else
{
this.txtPointManageDate.Hidden = true;
this.txtSearchCode.Hidden = false;
}
this.InitTreeMenu();
}
/// <summary>
/// 查询
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Tree_TextChanged(object sender, EventArgs e)
{
this.InitTreeMenu();
}
#endregion
#region Tree点击事件
/// <summary>
/// Tree点击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
{
jointInfos = new List<Model.View_JointInfo>();
this.PW_PointID = this.tvControlItem.SelectedNodeID;
if (!string.IsNullOrEmpty(this.PW_PointID))
{
Model.BO_Point point = BLL.PointManageService.GetPointByPointID(PW_PointID);
this.txtPointID.Text = point.PW_PointNo;
if (!string.IsNullOrEmpty(point.UnitId))
{
this.drpUnit.SelectedValue = point.UnitId;
}
if (!string.IsNullOrEmpty(point.InstallationId))
{
drpUnit_SelectedIndexChanged(null, null);//选择单位加载装置
this.drpInstallationId.SelectedValue = point.InstallationId;
}
this.txtPointDate.Text = point.PW_PointDate.HasValue ? string.Format("{0:yyyy-MM-dd}", point.PW_PointDate) : "";
if (!string.IsNullOrEmpty(point.PW_Tabler))
{
this.drpTabler.SelectedValue = point.PW_Tabler;
}
this.txtTableDate.Text = point.PW_TablerDate.HasValue ? string.Format("{0:yyyy-MM-dd}", point.PW_TablerDate) : "";
this.txtRemark.Text = point.PW_Remark;
jointInfos = BLL.PW_JointInfoService.GetDistinctViewJointInfosByPointID(this.PW_PointID);
if (jointInfos!=null)
{
this.Grid1.DataSource = jointInfos;
this.Grid1.DataBind();
}
}
}
#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))
{
this.PW_PointID = null;
//drpInstallationId.Items.Clear();
// Funs.FineUIPleaseSelect(this.drpInstallationId);
this.drpUnit.SelectedValue = CurrUser.UnitId;
this.drpInstallationId.SelectedIndex = 0;
this.drpTabler.SelectedIndex = 0;
jointInfos.Clear();
jointInfos = new List<Model.View_JointInfo>();
this.Grid1.DataSource = null;
this.Grid1.DataBind();
this.drpTabler.SelectedValue = this.CurrUser.UserId;
this.txtTableDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
this.txtPointDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
//if (BLL.Project_SysSetService.IsAuto("2", this.CurrUser.LoginProjectId) == true)
var set = BLL.Project_SysSetService.GetSysSetBySetId("2", this.CurrUser.LoginProjectId);
if (set != null && set.IsAuto == true)
{
string date = this.txtPointDate.Text.Trim().Replace("-", "");
this.txtPointID.Text = BLL.SQLHelper.RunProcNewId("SpGetNewCode3ByProjectPrefix", "dbo.BO_Point", "PW_PointNo", this.CurrUser.LoginProjectId, date + "-");
}
else
{
this.txtPointID.Readonly = false;
}
}
else
{
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
}
}
#endregion
#region 线
/// <summary>
/// 查找按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSearch_Click(object sender, EventArgs e)
{
if (GetButtonPower(BLL.Const.BtnSave))
{
if (this.drpUnit.SelectedValue == BLL.Const._Null || string.IsNullOrEmpty(this.drpUnit.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("PointShowSearch.aspx?unitId={0}&&installationId={1}", this.drpUnit.SelectedValue, this.drpInstallationId.SelectedValue, "编辑 - ");
PageContext.RegisterStartupScript(Window1.GetSaveStateReference(this.hdJOTID.ClientID)
+ Window1.GetShowReference(window));
}
}
else
{
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
return;
}
}
#endregion
#region
/// <summary>
/// 关闭弹出窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window1_Close(object sender, WindowCloseEventArgs e)
{
jointInfos = new List<Model.View_JointInfo>();
List<string> lists = Funs.GetStrListByStr(hdJOTID.Text, ',');
foreach (var item in lists)
{
var jointInfo = BLL.PW_JointInfoService.GetViewJointInfoByJotId(item);
if (jointInfo != null)
{
Model.View_JointInfo newJoint = new Model.View_JointInfo();
newJoint.JOT_ID = item;
newJoint.ISO_ID = jointInfo.ISO_ID;
newJoint.WorkAreaCode = jointInfo.WorkAreaCode;
newJoint.ISO_IsoNo = jointInfo.ISO_IsoNo;
newJoint.JOT_JointNo = jointInfo.JOT_JointNo;
newJoint.WED_Code1 = jointInfo.WED_Code1;
jointInfos.Add(newJoint);
}
}
if (!string.IsNullOrEmpty(this.PW_PointID))
{
List<Model.View_JointInfo> infos = BLL.PW_JointInfoService.GetDistinctViewJointInfosByPointID(this.PW_PointID);
if (infos.Count > 0)
{
foreach (var info in infos)
{
Model.View_JointInfo newJoint = new Model.View_JointInfo();
newJoint.JOT_ID = info.JOT_ID;
newJoint.ISO_ID = info.ISO_ID;
newJoint.WorkAreaCode = info.WorkAreaCode;
newJoint.ISO_IsoNo = info.ISO_IsoNo;
newJoint.JOT_JointNo = info.JOT_JointNo;
newJoint.WED_Code1 = info.WED_Code1;
jointInfos.Add(newJoint);
}
}
}
Grid1.DataSource = jointInfos;
Grid1.DataBind();
}
#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 i = BLL.TrustManageEditService.GetCH_TrustItemByJOT_ID(rowID);
if (i.Count() == 0)
{
jointInfos.RemoveAt(rowIndex);
Model.PW_JointInfo joint = BLL.PW_JointInfoService.GetJointInfoByJotID(rowID);
if (joint != null)
{
joint.PW_PointID = null;
joint.JOT_JointStatus = "100";
BLL.PW_JointInfoService.UpdateJointInfo(joint);
}
}
else
{
Alert.ShowInTop("此焊口已委托,不能删除!", MessageBoxIcon.Warning);
return;
}
}
Grid1.DataSource = jointInfos;
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 (jointInfos.Count > 0)
{
if (this.drpUnit.SelectedValue == BLL.Const._Null || string.IsNullOrEmpty(this.drpUnit.SelectedValue))
{
Alert.ShowInTop("请选择单位!", MessageBoxIcon.Warning);
return;
}
if (this.drpInstallationId.SelectedValue == BLL.Const._Null || string.IsNullOrEmpty(this.drpInstallationId.SelectedValue))
{
Alert.ShowInTop("请选择装置!", MessageBoxIcon.Warning);
return;
}
Model.BO_Point point = new Model.BO_Point();
point.PW_PointNo = this.txtPointID.Text.Trim();
point.ProjectId = this.CurrUser.LoginProjectId;
point.UnitId = this.drpUnit.SelectedValue;
point.InstallationId = this.drpInstallationId.SelectedValue;
point.PW_PointDate = Funs.GetNewDateTime(this.txtPointDate.Text);
if (this.drpTabler.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpTabler.SelectedValue))
{
point.PW_Tabler = this.drpTabler.SelectedValue;
}
point.PW_TablerDate = Funs.GetNewDateTime(this.txtTableDate.Text);
point.PW_Remark = this.txtRemark.Text.Trim();
if (!string.IsNullOrEmpty(PW_PointID))
{
point.PW_PointID = PW_PointID;
BLL.PointManageService.UpdatePoint(point);
//BLL.LogService.AddLog(this.CurrUser.UserId, "修改点口信息!");
}
else
{
if (!string.IsNullOrEmpty(this.txtPointID.Text.Trim()))
{
if (!BLL.PointManageService.IsExistPointNO(this.txtPointID.Text,this.CurrUser.LoginProjectId))
{
point.PW_PointNo = this.txtPointID.Text.Trim();
}
else
{
Alert.ShowInTop("点口编号已存在,请重新录入!", MessageBoxIcon.Warning);
return;
}
point.PW_PointID = SQLHelper.GetNewID(typeof(Model.BO_Point));
BLL.PointManageService.AddPoint(point);
PW_PointID = point.PW_PointID;
//BLL.LogService.AddLog(this.CurrUser.UserId, "添加点口信息!");
}
}
foreach (var item in jointInfos)
{
var joint = BLL.PW_JointInfoService.GetJointInfoByJotID(item.JOT_ID);
if (joint != null)
{
joint.JOT_JointStatus = "101";
joint.PW_PointID = point.PW_PointID;
BLL.PW_JointInfoService.UpdateJointPoint(joint);
}
}
jointInfos.Clear();
InitTreeMenu();
ShowNotify("保存成功!", MessageBoxIcon.Success);
}
else
{
Alert.ShowInTop("焊口信息不能为空!", MessageBoxIcon.Warning);
return;
}
}
else
{
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
}
}
#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))
{
this.PW_PointID = this.tvControlItem.SelectedNodeID;
if (!string.IsNullOrEmpty(this.PW_PointID))
{
List<Model.PW_JointInfo> info = BLL.PW_JointInfoService.GetJointInfosAllByPointID(PW_PointID);
bool isTrust = false;
foreach (var item in info)
{
if (!String.IsNullOrEmpty(item.JOT_TrustFlag) && item.JOT_TrustFlag != "00" && item.JOT_JointStatus != "104")
{
isTrust = true;
break;
}
}
if (isTrust == false)
{
foreach (var item in info)
{
item.PW_PointID = null;
if (item.JOT_JointStatus != "104")
{
item.JOT_JointStatus = "100";
}
BLL.PW_JointInfoService.UpdateJointInfo(item);
}
BLL.PointManageService.DeletePoint(PW_PointID);
//BLL.LogService.AddLog(this.CurrUser.UserId, "删除点口管理");
ShowNotify("删除成功!", MessageBoxIcon.Success);
this.txtPointID.Text = string.Empty;
this.drpUnit.SelectedIndex = 0;
this.drpInstallationId.SelectedIndex = 0;
this.txtPointDate.Text = string.Empty;
this.drpTabler.SelectedIndex = 0;
this.txtTableDate.Text = string.Empty;
this.txtRemark.Text = string.Empty;
this.Grid1.DataSource = null;
this.Grid1.DataBind();
InitTreeMenu();
}
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 btnGenerate_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(this.PW_PointID))
{
var bo_Point = BLL.PointManageService.GetPointByPointID(this.PW_PointID); ////获取点口信息
if (bo_Point == null)
{
Alert.ShowInTop("点口单未保存不能生成委托单!", MessageBoxIcon.Warning);
return;
}
var jointInfos = BLL.PW_JointInfoService.GetDistinctViewJointInfosByPointID(this.PW_PointID); ////获取点口中的焊口信息
if (jointInfos.Count > 0)
{
var ios = BLL.PW_IsoInfoService.GetIsoInfoByIsoInfoId(jointInfos[0].ISO_ID);
if (!ios.Is_Standard)
{
foreach (var pitem in jointInfos)
{
var CH_TrustItem = BLL.TrustManageEditService.GetCH_TrustItemByJOT_ID(pitem.JOT_ID);
if (CH_TrustItem.Count() > 0)
{
Alert.ShowInTop("点口单下的焊口已生成委托单!", MessageBoxIcon.Warning);
return;
}
}
}
}
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("../TrustManage/TrustManageSet.aspx?PW_PointID={0}", this.PW_PointID, "编辑 - ")));
}
else
{
Alert.ShowInTop("请选择要生成委托单的点口记录!", MessageBoxIcon.Warning);
}
}
#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_PointManageMenuId, button);
}
#endregion
#region
/// <summary>
/// 打印
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnPrint_Click(object sender, EventArgs e)
{
string pointID = this.tvControlItem.SelectedNode.NodeID;
var q = BLL.PointManageService.GetPointByPointID(pointID);
if (q != null)
{
string varValue = string.Empty;
var projectName = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId);
var installationName = BLL.Project_InstallationService.GetInstallationByInstallationId(q.InstallationId).InstallationName;
var unitName = BLL.UnitService.GetUnitNameByUnitId(q.UnitId);
varValue = installationName + "|" + unitName + "|" + projectName + "|" + q.PW_PointDate.Value.ToString("yyyy-MM-dd") + "|" + q.PW_PointNo;
if (!string.IsNullOrEmpty(varValue))
{
varValue = Microsoft.JScript.GlobalObject.escape(varValue.Replace("/", ","));
}
PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("../../ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId={3}", BLL.Const.PointReportDayReportId, pointID, varValue, this.CurrUser.LoginProjectId)));
}
else
{
Alert.ShowInTop("请选择点口编号!", MessageBoxIcon.Warning);
return;
}
}
#endregion
}
}