706 lines
27 KiB
C#
706 lines
27 KiB
C#
using BLL;
|
|
using Model;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace FineUIPro.Web.CLGL
|
|
{
|
|
public partial class OutPlanMaster : PageBase
|
|
{
|
|
public int pageSize = PipelineService.pageSize;
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
if (!IsPostBack)
|
|
{
|
|
this.GetButtonPower();
|
|
InitDrpList();
|
|
this.InitTreeMenu();
|
|
|
|
}
|
|
}
|
|
|
|
|
|
private void InitDrpList()
|
|
{
|
|
drpWarehouse.DataTextField = "Key";
|
|
drpWarehouse.DataValueField = "Value";
|
|
drpWarehouse.DataSource = BLL.TwInOutplanmasterService.GetWarehouseCode(this.CurrUser.LoginProjectId);
|
|
drpWarehouse.DataBind();
|
|
Funs.FineUIPleaseSelect(this.drpWarehouse);
|
|
drpTypeInt.DataTextField = "Key";
|
|
drpTypeInt.DataValueField = "Value";
|
|
drpTypeInt.DataSource = BLL.TwConst.TypeIntMap.Where(x => x.Key.Contains("出库")); ;
|
|
drpTypeInt.DataBind();
|
|
Funs.FineUIPleaseSelect(this.drpTypeInt);
|
|
drpStates.DataTextField = "Key";
|
|
drpStates.DataValueField = "Value";
|
|
drpStates.DataSource = BLL.TwConst.StateMap;
|
|
drpStates.DataBind();
|
|
Funs.FineUIPleaseSelect(this.drpStates);
|
|
drpCategory.DataTextField = "Key";
|
|
drpCategory.DataValueField = "Value";
|
|
drpCategory.DataSource = BLL.TwConst.CategoryMap;
|
|
drpCategory.DataBind();
|
|
Funs.FineUIPleaseSelect(this.drpCategory);
|
|
|
|
}
|
|
#region 数据绑定
|
|
/// <summary>
|
|
/// 管线数据
|
|
/// </summary>
|
|
private void BindGrid()
|
|
{
|
|
Model.Tw_InOutMasterOutput table = new Model.Tw_InOutMasterOutput();
|
|
table.ProjectId = this.CurrUser.LoginProjectId;
|
|
table.InOutType = (int?)TwConst.InOutType.出库;
|
|
if (drpTypeInt.SelectedValue != Const._Null)
|
|
{
|
|
table.TypeInt = Convert.ToInt32(drpTypeInt.SelectedValue);
|
|
}
|
|
if (drpStates.SelectedValue != Const._Null)
|
|
{
|
|
table.State = Convert.ToInt32(drpStates.SelectedValue);
|
|
}
|
|
if (drpCategory.SelectedValue != Const._Null)
|
|
{
|
|
table.Category = Convert.ToInt32(drpCategory.SelectedValue);
|
|
}
|
|
if (drpWarehouse.SelectedValue != Const._Null)
|
|
{
|
|
table.WarehouseCode = drpWarehouse.SelectedValue;
|
|
}
|
|
if (!string.IsNullOrEmpty(tvControlItem.SelectedNodeID))
|
|
{
|
|
table.UnitWorkId = tvControlItem.SelectedNodeID;
|
|
}
|
|
var tb = BLL.TwInOutplanmasterService.GetListData(table);
|
|
Grid1.RecordCount = TwInOutplanmasterService.Count;
|
|
Grid1.DataSource = tb;
|
|
Grid1.DataBind();
|
|
|
|
Grid2.DataSource = null;
|
|
Grid2.DataBind();
|
|
|
|
Grid3.DataSource = null;
|
|
Grid3.DataBind();
|
|
}
|
|
|
|
private void BindDetailGrid(string inOutPlanMasterId)
|
|
{
|
|
Model.Tw_InOutDetailOutput table = new Model.Tw_InOutDetailOutput();
|
|
table.InOutPlanMasterId = inOutPlanMasterId;
|
|
var tb = BLL.TwInOutplandetailService.GetListData(table, Grid2);
|
|
Grid2.DataSource = tb;
|
|
Grid2.DataBind();
|
|
}
|
|
private void BindDetailRelationGrid(string inOutPlanMasterId)
|
|
{
|
|
var inOutPlanMasterModel = TwInOutplanmasterService.GetById(inOutPlanMasterId);
|
|
var tb = BLL.TwArrivalStatisticsService.GetMatMatchByOutPlanMasterId(inOutPlanMasterId);
|
|
|
|
if (inOutPlanMasterModel != null)
|
|
{
|
|
if (inOutPlanMasterModel.State == (int)TwConst.State.已完成 || inOutPlanMasterModel.State == (int)TwConst.State.已审核)
|
|
{
|
|
TabStrip2.Hidden = true;
|
|
TabStrip3.Hidden = false;
|
|
Grid4.DataSource = tb;
|
|
Grid4.DataBind();
|
|
|
|
}
|
|
else
|
|
{
|
|
TabStrip2.Hidden = false;
|
|
TabStrip3.Hidden = true;
|
|
Grid3.DataSource = tb;
|
|
Grid3.DataBind();
|
|
for (int i = 0; i < Grid3.Rows.Count; i++)
|
|
{
|
|
var model = Grid3.Rows[i].DataItem as Tw_PipeMatMatchOutput;
|
|
|
|
if (model?.MatchRate < 1 || model?.MatchRate == null)
|
|
{
|
|
Grid3.Rows[i].RowCssClass = "red";
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 排序
|
|
|
|
protected void Grid1_Sort(object sender, GridSortEventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 加载树装置-单位-工作区
|
|
|
|
/// <summary>
|
|
/// 加载树
|
|
/// </summary>
|
|
private void InitTreeMenu()
|
|
{
|
|
this.tvControlItem.Nodes.Clear();
|
|
|
|
TreeNode rootNode1 = new TreeNode();
|
|
rootNode1.NodeID = "1";
|
|
rootNode1.Text = "建筑工程";
|
|
rootNode1.CommandName = "建筑工程";
|
|
rootNode1.Selectable = false;
|
|
this.tvControlItem.Nodes.Add(rootNode1);
|
|
|
|
TreeNode rootNode2 = new TreeNode();
|
|
rootNode2.NodeID = "2";
|
|
rootNode2.Text = "安装工程";
|
|
rootNode2.CommandName = "安装工程";
|
|
rootNode2.Expanded = true;
|
|
this.tvControlItem.Nodes.Add(rootNode2);
|
|
|
|
var pUnits = (from x in Funs.DB.Project_ProjectUnit where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList();
|
|
// 获取当前用户所在单位
|
|
var currUnit = pUnits.FirstOrDefault(x => x.UnitId == this.CurrUser.UnitId);
|
|
|
|
var unitWorkList = (from x in Funs.DB.WBS_UnitWork
|
|
where x.ProjectId == this.CurrUser.LoginProjectId
|
|
&& x.SuperUnitWork == null && x.UnitId != null && x.ProjectType != null
|
|
select x).ToList();
|
|
|
|
List<Model.WBS_UnitWork> unitWork1 = null;
|
|
List<Model.WBS_UnitWork> unitWork2 = null;
|
|
|
|
//// 当前为施工单位,只能操作本单位的数据
|
|
//if (currUnit != null && currUnit.UnitType == Const.ProjectUnitType_2)
|
|
//{
|
|
// unitWork1 = (from x in unitWorkList
|
|
// where x.UnitId == this.CurrUser.UnitId && x.ProjectType == "1"
|
|
// select x).ToList();
|
|
// unitWork2 = (from x in unitWorkList
|
|
// where x.UnitId == this.CurrUser.UnitId && x.ProjectType == "2"
|
|
// select x).ToList();
|
|
//}
|
|
//else
|
|
//{
|
|
unitWork1 = (from x in unitWorkList where x.ProjectType == "1" select x).ToList();
|
|
unitWork2 = (from x in unitWorkList where x.ProjectType == "2" select x).ToList();
|
|
//}
|
|
|
|
if (unitWork1.Count() > 0)
|
|
{
|
|
foreach (var q in unitWork1)
|
|
{
|
|
|
|
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
|
|
TreeNode tn1 = new TreeNode();
|
|
tn1.NodeID = q.UnitWorkId;
|
|
tn1.Text = q.UnitWorkName;
|
|
tn1.ToolTip = "施工单位:" + unitNamesUnitIds;
|
|
tn1.EnableClickEvent = true;
|
|
rootNode1.Nodes.Add(tn1);
|
|
}
|
|
}
|
|
if (unitWork2.Count() > 0)
|
|
{
|
|
foreach (var q in unitWork2)
|
|
{
|
|
|
|
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
|
|
TreeNode tn2 = new TreeNode();
|
|
tn2.NodeID = q.UnitWorkId;
|
|
tn2.Text = q.UnitWorkName;
|
|
tn2.ToolTip = "施工单位:" + unitNamesUnitIds;
|
|
tn2.EnableClickEvent = true;
|
|
rootNode2.Nodes.Add(tn2);
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 点击TreeView
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
|
|
{
|
|
this.BindGrid();
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 树查询
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnTreeFind_Click(object sender, EventArgs e)
|
|
{
|
|
this.InitTreeMenu();
|
|
//this.BindGrid3(this.tvControlItem.SelectedNodeID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 维护事件
|
|
protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
|
|
{
|
|
if (e.CommandName == "btnInPlanMasterPrint")
|
|
{
|
|
Print(e.RowID);
|
|
}
|
|
}
|
|
private void Print(string Id)
|
|
{
|
|
BLL.FastReportService.ResetData();
|
|
if (string.IsNullOrEmpty(Id))
|
|
{
|
|
|
|
ShowNotify("请选择要打印的项", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
|
|
Tw_InOutMasterOutput queryModel = new Tw_InOutMasterOutput()
|
|
{
|
|
Id = Id
|
|
};
|
|
var result = TwInOutplanmasterService.GetListData(queryModel).FirstOrDefault();
|
|
List<Model.Tw_PrintMaster> tw_PrintMasters = new List<Model.Tw_PrintMaster>();
|
|
List<Model.Tw_PrintDetail> tw_PrintDetails = new List<Model.Tw_PrintDetail>();
|
|
Model.Tw_PrintMaster printMaster = new Model.Tw_PrintMaster
|
|
{
|
|
|
|
ReqUnitName = result.ReqUnitName,
|
|
CusBillCode = result.CusBillCode,
|
|
CreateDate = result.CreateDate.Value.ToString("yyyy-MM-dd"),
|
|
CreateManName = !string.IsNullOrEmpty(result.CreateMan) ? BLL.Person_PersonsService.getSignatureUrl(result.CreateMan) : "",
|
|
ProjectName = ProjectService.GetProjectNameByProjectId(result.ProjectId),
|
|
CategoryString = result.CategoryString,
|
|
BillName = TwConst.PlanPrintMap.Where(x => x.Value == result.TypeInt).Select(x => x.Key).FirstOrDefault(),
|
|
AuditManName = !string.IsNullOrEmpty(result.AuditMan) ? BLL.Person_PersonsService.getSignatureUrl(result.AuditMan) : "",
|
|
AuditDate = string.Format("{0:yyyy-MM-dd}", result.AuditDate),
|
|
AuditManName2 = !string.IsNullOrEmpty(result.AuditMan2) ? BLL.Person_PersonsService.getSignatureUrl(result.AuditMan2) : "",
|
|
AuditDate2 = string.Format("{0:yyyy-MM-dd}", result.AuditDate2),
|
|
WarehouseManName = !string.IsNullOrEmpty(result.WarehouseMan) ? BLL.Person_PersonsService.getSignatureUrl(result.WarehouseMan) : "",
|
|
WarehouseManAuditDate = string.Format("{0:yyyy-MM-dd}", result.WarehouseDate),
|
|
};
|
|
tw_PrintMasters.Add(printMaster);
|
|
DataTable Table1 = LINQToDataTable(tw_PrintMasters);
|
|
if (Table1 != null)
|
|
{
|
|
Table1.TableName = "Table1";
|
|
}
|
|
Tw_InOutPlanDetail_Relation queryModel2 = new Tw_InOutPlanDetail_Relation()
|
|
{
|
|
InOutPlanMasterId = Id
|
|
};
|
|
var ListDetailRelation = TwInoutplandetailRelationService.GetTw_InOutPlanDetail_RelationByModle(queryModel2).ToList();
|
|
int SortIndex = 1;
|
|
int SortIndex2 = 1;
|
|
var tw_PrintDetailRelation = (from x in ListDetailRelation
|
|
join y in Funs.DB.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
|
|
join z in Funs.DB.HJGL_Pipeline on x.PipelineId equals z.PipelineId
|
|
join m in Funs.DB.WBS_UnitWork on z.UnitWorkId equals m.UnitWorkId
|
|
select new Model.Tw_PrintDetail
|
|
{
|
|
SortIndex = SortIndex++,
|
|
PipelineCode = z.PipelineCode,
|
|
PipelineComponentCode = x.PrefabricatedComponents,
|
|
MaterialCode = y.MaterialCode,
|
|
MaterialDef = y.MaterialDef,
|
|
MaterialSpec = y.MaterialSpec,
|
|
MaterialUnit = y.MaterialUnit,
|
|
PlanNum = (x.Number ?? 0).ToString(),
|
|
UnitWorkName = m.UnitWorkName,
|
|
}).ToList();
|
|
var UnitWorkName = tw_PrintDetailRelation.FirstOrDefault()?.UnitWorkName;
|
|
Tw_PrintDetail tw_PrintDetailRelation2 = new Tw_PrintDetail
|
|
{
|
|
MaterialDef = "材料编码合计"
|
|
};
|
|
var tw_PrintDetail = (from x in Funs.DB.Tw_InOutPlanDetail
|
|
join y in Funs.DB.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
|
|
where x.InOutPlanMasterId == Id
|
|
select new Model.Tw_PrintDetail
|
|
{
|
|
SortIndex = 0,
|
|
PipelineCode = "-",
|
|
PipelineComponentCode = "-",
|
|
MaterialCode = y.MaterialCode,
|
|
MaterialDef = y.MaterialDef,
|
|
MaterialSpec = y.MaterialSpec,
|
|
MaterialUnit = y.MaterialUnit,
|
|
PlanNum = (x.PlanNum ?? 0).ToString(),
|
|
ActNum = (x.ActNum ?? 0).ToString(),
|
|
UnitWorkName = UnitWorkName,
|
|
}).ToList();
|
|
foreach (var item in tw_PrintDetail)
|
|
{
|
|
item.SortIndex = SortIndex2++;
|
|
}
|
|
if (result.TypeInt == (int)TwConst.TypeInt.散件出库)
|
|
{
|
|
tw_PrintDetails.AddRange(tw_PrintDetailRelation);
|
|
|
|
}
|
|
tw_PrintDetails.Add(tw_PrintDetailRelation2);
|
|
tw_PrintDetails.AddRange(tw_PrintDetail);
|
|
DataTable Data = LINQToDataTable(tw_PrintDetails);
|
|
if (Data != null)
|
|
{
|
|
Data.TableName = "Data";
|
|
}
|
|
BLL.FastReportService.ResetData();
|
|
BLL.FastReportService.AddFastreportTable(Table1);
|
|
BLL.FastReportService.AddFastreportTable(Data);
|
|
string initTemplatePath = "";
|
|
string rootPath = Server.MapPath("~/");
|
|
initTemplatePath = "File\\Fastreport\\材料出库计划单.frx";
|
|
|
|
if (File.Exists(rootPath + initTemplatePath))
|
|
{
|
|
PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("~/Controls/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath)));
|
|
|
|
}
|
|
}
|
|
protected void Grid1_RowClick(object sender, GridRowClickEventArgs e)
|
|
{
|
|
if (e.RowIndex >= 0)
|
|
{
|
|
string ID = Grid1.DataKeys[e.RowIndex][0].ToString();
|
|
BindDetailGrid(ID);
|
|
BindDetailRelationGrid(ID);
|
|
}
|
|
}
|
|
|
|
protected void btnSearch_Click(object sender, EventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
/// <summary>
|
|
/// 增加
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnNew_Click(object sender, EventArgs e)
|
|
{
|
|
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, Const.Tw_OutPlanMasterMenuId, Const.BtnAdd))
|
|
{
|
|
if (string.IsNullOrEmpty(tvControlItem.SelectedNodeID))
|
|
{
|
|
Alert.ShowInTop("请选择单位工程!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("OutPlanMasterEdit.aspx?UnitWorkId={0} ", tvControlItem.SelectedNodeID, "新增 - ")));
|
|
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
|
|
protected void btnMenuInOutPlanMasterDelete_Click(object sender, EventArgs e)
|
|
{
|
|
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, Const.Tw_OutPlanMasterMenuId, Const.BtnDelete))
|
|
{
|
|
if (Grid1.SelectedRowIndexArray.Length > 0)
|
|
{
|
|
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
|
|
{
|
|
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
|
|
var model = BLL.TwInOutplanmasterService.GetById(rowID);
|
|
if (model.State == (int)TwConst.State.已审核 || model.State == (int)TwConst.State.已完成)
|
|
{
|
|
Alert.ShowInTop("请选择有效的计划!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
BLL.TwInOutplanmasterService.DeleteById(rowID);
|
|
|
|
ShowNotify("删除数据成功!", MessageBoxIcon.Success);
|
|
}
|
|
}
|
|
BindGrid();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
|
|
protected void btnGenInOutMaster_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
{
|
|
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
string planId = Grid1.SelectedRowID;
|
|
var planMaster = BLL.TwInOutplanmasterService.GetById(planId);
|
|
if (planMaster.State != (int)TwConst.State.已审核)
|
|
{
|
|
Alert.ShowInTop("请选择有效的计划!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("OutPlanMasterOut.aspx?Id={0}", Grid1.SelectedRowID, "编辑 - ")));
|
|
|
|
}
|
|
}
|
|
|
|
protected void btnRevokeGenInOutMaster_Click(object sender, EventArgs e)
|
|
{
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
{
|
|
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
string planId = Grid1.SelectedRowID;
|
|
var planMaster = BLL.TwInOutplanmasterService.GetById(planId);
|
|
switch (planMaster.State)
|
|
{
|
|
case (int)TwConst.State.已审核:
|
|
planMaster.State = (int)TwConst.State.待审核;
|
|
planMaster.AuditMan = null;
|
|
planMaster.AuditDate = null;
|
|
TwInOutplanmasterService.Update(planMaster);
|
|
BindGrid();
|
|
ShowNotify("撤销审核成功!", MessageBoxIcon.Success);
|
|
|
|
break;
|
|
case (int)TwConst.State.已完成:
|
|
TwOutputmasterService.RevokeGenOutMasterByPlanId(planId);
|
|
BindGrid();
|
|
ShowNotify("撤销出库单成功!", MessageBoxIcon.Success);
|
|
break;
|
|
|
|
|
|
default:
|
|
Alert.ShowInTop("请选择有效的计划!", MessageBoxIcon.Warning);
|
|
break;
|
|
}
|
|
|
|
}
|
|
|
|
protected void btnMenuInOutPlanMasterEdit_Click(object sender, EventArgs e)
|
|
{
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
{
|
|
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
string planId = Grid1.SelectedRowID;
|
|
var planMaster = BLL.TwInOutplanmasterService.GetById(planId);
|
|
if (planMaster.State == (int)TwConst.State.待提交 && (planMaster.TypeInt == (int)TwConst.TypeInt.散件出库 || planMaster.TypeInt == (int)TwConst.TypeInt.其他出库))
|
|
{
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("OutPlanMasterEdit.aspx?UnitWorkId={0}&Id={1} ", tvControlItem.SelectedNodeID, planId, "新增 - ")));
|
|
|
|
}
|
|
else
|
|
{
|
|
|
|
Alert.ShowInTop("请选择有效的计划!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
|
|
}
|
|
protected void btnPassMaster_OnClick(object sender, EventArgs e)
|
|
{
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
{
|
|
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
string planId = Grid1.SelectedRowID;
|
|
var planMaster = BLL.TwInOutplanmasterService.GetById(planId);
|
|
if (planMaster.State != (int)TwConst.State.待审核)
|
|
{
|
|
Alert.ShowInTop("请选择有效的计划!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
//planMaster.State = (int)TwConst.State.已审核;
|
|
planMaster.AuditMan = this.CurrUser.PersonId;
|
|
planMaster.AuditDate = DateTime.Now;
|
|
TwInOutplanmasterService.Update(planMaster);
|
|
BindGrid();
|
|
ShowNotify("审核通过!", MessageBoxIcon.Success);
|
|
}
|
|
|
|
}
|
|
protected void btnPassMaster2_OnClick(object sender, EventArgs e)
|
|
{
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
{
|
|
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
string planId = Grid1.SelectedRowID;
|
|
var planMaster = BLL.TwInOutplanmasterService.GetById(planId);
|
|
if (planMaster.State != (int)TwConst.State.待审核)
|
|
{
|
|
Alert.ShowInTop("请选择有效的计划!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
if (string.IsNullOrEmpty(planMaster.AuditMan))
|
|
{
|
|
Alert.ShowInTop("请专工先进行预审核!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
planMaster.State = (int)TwConst.State.已审核;
|
|
planMaster.AuditMan2 = this.CurrUser.PersonId;
|
|
planMaster.AuditDate2 = DateTime.Now;
|
|
TwInOutplanmasterService.Update(planMaster);
|
|
BindGrid();
|
|
ShowNotify("审核通过!", MessageBoxIcon.Success);
|
|
}
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
#region 关闭弹出窗口及刷新页面
|
|
/// <summary>
|
|
/// 关闭弹出窗口
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
|
{
|
|
//this.InitTreeMenu();//加载树
|
|
//this.BindGrid3(this.tvControlItem.SelectedNodeID);
|
|
}
|
|
|
|
protected void Window2_Close(object sender, WindowCloseEventArgs e)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 选项卡改变事件
|
|
/// <summary>
|
|
/// 选项卡改变事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void TabStrip1_TabIndexChanged(object sender, EventArgs e)
|
|
{
|
|
if (this.TabStrip1.ActiveTabIndex == 0)
|
|
{
|
|
|
|
|
|
}
|
|
else if (this.TabStrip1.ActiveTabIndex == 1)
|
|
{
|
|
|
|
}
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#region 导出
|
|
/// <summary>
|
|
/// 导出方法
|
|
/// </summary>
|
|
/// <param name="grid"></param>
|
|
/// <returns></returns>
|
|
private string GetGridTableHtml(Grid grid)
|
|
{
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.Append("<meta http-equiv=\"content-type\" content=\"application/excel; charset=UTF-8\"/>");
|
|
sb.Append("<table cellspacing=\"0\" rules=\"all\" border=\"1\" style=\"border-collapse:collapse;\">");
|
|
sb.Append("<tr>");
|
|
foreach (GridColumn column in grid.Columns)
|
|
{
|
|
if (column.HeaderText != "序号")
|
|
{
|
|
sb.AppendFormat("<td>{0}</td>", column.HeaderText);
|
|
}
|
|
}
|
|
sb.Append("</tr>");
|
|
foreach (GridRow row in grid.Rows)
|
|
{
|
|
sb.Append("<tr>");
|
|
foreach (GridColumn column in grid.Columns)
|
|
{
|
|
string html = row.Values[column.ColumnIndex].ToString();
|
|
if (column.ColumnID != "tfNumber")
|
|
{
|
|
//html = (row.FindControl("lblNumber") as AspNet.Label).Text;
|
|
sb.AppendFormat("<td>{0}</td>", html);
|
|
}
|
|
//sb.AppendFormat("<td>{0}</td>", html);
|
|
}
|
|
|
|
sb.Append("</tr>");
|
|
}
|
|
|
|
sb.Append("</table>");
|
|
|
|
return sb.ToString();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 获取权限按钮
|
|
/// <summary>
|
|
/// 获取按钮权限
|
|
/// </summary>
|
|
/// <param name="button"></param>
|
|
/// <returns></returns>
|
|
private void GetButtonPower()
|
|
{
|
|
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, BLL.Const.Tw_OutPlanMasterMenuId);
|
|
if (buttonList.Count > 0)
|
|
{
|
|
if (buttonList.Contains(BLL.Const.BtnAdd))
|
|
{
|
|
this.btnNew.Hidden = false;
|
|
}
|
|
if (buttonList.Contains(BLL.Const.BtnModify))
|
|
{
|
|
this.btnGenInOutMaster.Hidden = false;
|
|
this.btnRevokeGenInOutMaster.Hidden = false;
|
|
// this.btnMenuInOutPlanMasterEdit.Hidden = false;
|
|
}
|
|
if (buttonList.Contains(BLL.Const.BtnDelete))
|
|
{
|
|
this.btnMenuInOutPlanMasterDelete.Hidden = false;
|
|
}
|
|
if (buttonList.Contains(BLL.Const.BtnAuditing))
|
|
{
|
|
this.btnPassMaster.Hidden = false;
|
|
this.btnPassMaster2.Hidden = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
} |