2023-06-06 17:01:34 +08:00
|
|
|
|
using BLL;
|
2025-11-17 20:31:53 +08:00
|
|
|
|
using FineUIPro.Web.SmartSite;
|
2023-06-06 17:01:34 +08:00
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Data;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
|
|
namespace FineUIPro.Web.HSSE.CostGoods
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class CostManageAudit : PageBase
|
|
|
|
|
|
{
|
|
|
|
|
|
#region 定义项
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 主键
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private string CostManageId
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return (string)ViewState["CostManageId"];
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
ViewState["CostManageId"] = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 项目主键
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public string ProjectId
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return (string)ViewState["ProjectId"];
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
ViewState["ProjectId"] = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 当前办理步骤
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private static Model.CostGoods_CostManageFlowOperate NowFlow = new Model.CostGoods_CostManageFlowOperate();
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 下一步办理步骤
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private static Model.CostGoods_CostManageFlowOperate NextFlow = new Model.CostGoods_CostManageFlowOperate();
|
|
|
|
|
|
|
|
|
|
|
|
#region 加载
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 加载页面
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!IsPostBack)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.btnClose.OnClientClick = ActiveWindow.GetHideRefreshReference();
|
2025-10-10 14:33:21 +08:00
|
|
|
|
this.ProjectId = this.CurrUser.LoginProjectId;
|
2023-06-06 17:01:34 +08:00
|
|
|
|
this.CostManageId = Request.Params["CostManageId"];
|
|
|
|
|
|
var costManage = BLL.CostManageService.GetCostManageById(this.CostManageId);
|
|
|
|
|
|
if (costManage != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.ProjectId = costManage.ProjectId;
|
|
|
|
|
|
this.drpUnit.Text = UnitService.GetUnitNameByUnitId(costManage.UnitId);
|
2025-10-10 14:33:21 +08:00
|
|
|
|
|
2023-06-06 17:01:34 +08:00
|
|
|
|
this.txtContractNum.Text = costManage.ContractNum;
|
|
|
|
|
|
this.txtCostManageDate.Text = string.Format("{0:yyyy-MM-dd}", costManage.CostManageDate);
|
|
|
|
|
|
BindGrid();
|
|
|
|
|
|
this.txtProjectName.Text = ProjectService.GetProjectNameByProjectId(this.ProjectId);
|
|
|
|
|
|
this.txtHseCost.Text = ProjectUnitService.GetSumHSECost(this.ProjectId, costManage.UnitId).ToString();
|
2025-10-10 14:33:21 +08:00
|
|
|
|
this.txtGetCost.Text = CostManageService.GetSumHSECost(this.ProjectId, costManage.UnitId, this.CostManageId).ToString();
|
2023-06-06 17:01:34 +08:00
|
|
|
|
NowFlow = CostManageService.getNowCostManageFlowOperateList(costManage.CostManageId);
|
|
|
|
|
|
if (NowFlow != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.txtOpinion.Text = NowFlow.Opinion;
|
|
|
|
|
|
}
|
2025-10-10 14:33:21 +08:00
|
|
|
|
|
|
|
|
|
|
NextFlow = CostManageService.getNextCostManageFlowOperateList(costManage.CostManageId, this.CurrUser.PersonId);
|
2023-06-06 17:01:34 +08:00
|
|
|
|
if (NextFlow != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
Person_PersonsService.InitFlowOperateControlUserDropDownList(this.drpNextMan, this.ProjectId, NextFlow.UnitId, true);
|
|
|
|
|
|
this.drpNextMan.Label = NextFlow.AuditFlowName;
|
|
|
|
|
|
if (!string.IsNullOrEmpty(NextFlow.OperaterId))
|
|
|
|
|
|
{
|
|
|
|
|
|
this.drpNextMan.SelectedValue = NextFlow.OperaterId;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
this.Label1.Text = "审核完成";
|
|
|
|
|
|
this.drpNextMan.Hidden = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
BindGrid2();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 绑定Grid
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 绑定Grid
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private void BindGrid()
|
|
|
|
|
|
{
|
|
|
|
|
|
var costManageItems = BLL.CostManageItemService.GetCostManageItemByCostManageId(this.CostManageId);
|
|
|
|
|
|
this.Grid1.DataSource = costManageItems;
|
|
|
|
|
|
this.Grid1.PageIndex = 0;
|
|
|
|
|
|
this.Grid1.DataBind();
|
|
|
|
|
|
OutputSummaryData(costManageItems);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OutputSummaryData(List<Model.CostGoods_CostManageItem> getItem)
|
|
|
|
|
|
{
|
|
|
|
|
|
JObject summary = new JObject();
|
|
|
|
|
|
summary.Add("InvestCostProject", "本次申请合计金额(元)");
|
2025-10-10 14:33:21 +08:00
|
|
|
|
summary.Add("PriceMoney", getItem.Sum(x => x.PriceMoney ?? 0));
|
2023-06-06 17:01:34 +08:00
|
|
|
|
Grid1.SummaryData = summary;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 关闭弹出窗口
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void Window1_Close(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
BindGrid();
|
2025-10-10 14:33:21 +08:00
|
|
|
|
}
|
2023-06-06 17:01:34 +08:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region BindGrid2
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 绑定Grid
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private void BindGrid2()
|
|
|
|
|
|
{
|
|
|
|
|
|
var FlowOperates = from x in Funs.DB.CostGoods_CostManageFlowOperate
|
2025-10-10 14:33:21 +08:00
|
|
|
|
where x.CostManageId == this.CostManageId
|
2023-06-06 17:01:34 +08:00
|
|
|
|
select new
|
|
|
|
|
|
{
|
|
|
|
|
|
x.FlowOperateId,
|
|
|
|
|
|
x.CostManageId,
|
|
|
|
|
|
x.AuditFlowName,
|
|
|
|
|
|
x.SortIndex,
|
|
|
|
|
|
x.UnitId,
|
2025-10-10 14:33:21 +08:00
|
|
|
|
UnitName = Funs.DB.Base_Unit.First(u => u.UnitId == x.UnitId).UnitName,
|
2023-06-06 17:01:34 +08:00
|
|
|
|
x.OperaterId,
|
2025-10-10 14:33:21 +08:00
|
|
|
|
OperaterName = Funs.DB.Person_Persons.First(u => u.PersonId == x.OperaterId).PersonName,
|
2023-06-06 17:01:34 +08:00
|
|
|
|
x.OperaterTime,
|
|
|
|
|
|
x.IsAgree,
|
|
|
|
|
|
x.Opinion,
|
|
|
|
|
|
x.IsClosed
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
this.Grid2.DataSource = FlowOperates.OrderByDescending(x => x.SortIndex);
|
|
|
|
|
|
this.Grid2.PageIndex = 0;
|
|
|
|
|
|
this.Grid2.DataBind();
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 提交
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 提交按钮
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void btnSubmit_Click(object sender, EventArgs e)
|
2025-10-10 14:33:21 +08:00
|
|
|
|
{
|
2023-06-06 17:01:34 +08:00
|
|
|
|
if (this.drpNextMan.SelectedValue == BLL.Const._Null && this.rblIsAgree.SelectedValue == "1" && NextFlow != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
Alert.ShowInTop("请选择" + this.drpNextMan.Label + "!", MessageBoxIcon.Warning);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
this.SaveData();
|
2025-10-10 14:33:21 +08:00
|
|
|
|
|
2023-06-06 17:01:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 保存数据
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="type"></param>
|
|
|
|
|
|
private void SaveData()
|
2025-10-10 14:33:21 +08:00
|
|
|
|
{
|
2023-06-06 17:01:34 +08:00
|
|
|
|
var getCost = CostManageService.GetCostManageById(this.CostManageId);
|
|
|
|
|
|
if (getCost != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
bool isAgree = true;
|
|
|
|
|
|
if (this.rblIsAgree.SelectedValue == "0") ///不同意 直接打回编制人
|
|
|
|
|
|
{
|
|
|
|
|
|
isAgree = false;
|
2025-10-10 14:33:21 +08:00
|
|
|
|
NowFlow.Opinion = this.rblIsAgree.SelectedItem.Text + "," + this.txtOpinion.Text;
|
2023-06-06 17:01:34 +08:00
|
|
|
|
getCost.States = BLL.Const.State_0;
|
2023-06-13 16:30:08 +08:00
|
|
|
|
getCost.NextManId = getCost.CompileMan;
|
2023-06-06 17:01:34 +08:00
|
|
|
|
BLL.CostManageService.UpdateCostManage(getCost);
|
|
|
|
|
|
CostManageService.updateOpenCostManageFlowOperate(this.CostManageId);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2025-10-10 14:33:21 +08:00
|
|
|
|
NowFlow.Opinion = this.rblIsAgree.SelectedItem.Text + "。";
|
2023-06-06 17:01:34 +08:00
|
|
|
|
NowFlow.IsClosed = true;
|
|
|
|
|
|
if (NextFlow != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
NextFlow.OperaterId = this.drpNextMan.SelectedValue;
|
|
|
|
|
|
BLL.CostManageService.updateCostManageFlowOperate(NextFlow);
|
2023-06-13 16:30:08 +08:00
|
|
|
|
|
|
|
|
|
|
getCost.NextManId = this.drpNextMan.SelectedValue;
|
2025-10-10 14:33:21 +08:00
|
|
|
|
BLL.CostManageService.UpdateCostManage(getCost);
|
2023-06-06 17:01:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2023-06-13 16:30:08 +08:00
|
|
|
|
getCost.NextManId = null;
|
2023-06-06 17:01:34 +08:00
|
|
|
|
getCost.States = BLL.Const.State_2;
|
|
|
|
|
|
BLL.CostManageService.UpdateCostManage(getCost);
|
2025-11-17 20:31:53 +08:00
|
|
|
|
|
|
|
|
|
|
string messaage = CostManageService.PushDataToHSE(this.CurrUser.LoginProjectId, getCost.ContractNum, getCost.CostManageId);
|
|
|
|
|
|
if (string.IsNullOrEmpty(messaage))
|
|
|
|
|
|
{
|
|
|
|
|
|
Alert.ShowInTop("推送成功!", MessageBoxIcon.Success);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
Alert.ShowInTop(messaage, MessageBoxIcon.Warning);
|
|
|
|
|
|
}
|
2023-06-06 17:01:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NowFlow.IsAgree = isAgree;
|
2025-10-10 14:33:21 +08:00
|
|
|
|
NowFlow.OperaterTime = DateTime.Now;
|
2023-06-06 17:01:34 +08:00
|
|
|
|
BLL.CostManageService.updateCostManageFlowOperate(NowFlow);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
2025-10-10 14:33:21 +08:00
|
|
|
|
}
|
2023-06-06 17:01:34 +08:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 附件上传
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 上传附件
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void btnAttachUrl_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!string.IsNullOrEmpty(this.CostManageId))
|
|
|
|
|
|
{
|
|
|
|
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/CostManageAttachUrl&menuId={1}&type=-1", this.CostManageId, BLL.Const.ProjectCostManageMenuId)));
|
2025-10-10 14:33:21 +08:00
|
|
|
|
}
|
2023-06-06 17:01:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 是否同意
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void rblIsAgree_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (this.rblIsAgree.SelectedValue == "1")
|
|
|
|
|
|
{
|
|
|
|
|
|
this.trO.Hidden = true;
|
|
|
|
|
|
this.trN.Hidden = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
this.trO.Hidden = false;
|
|
|
|
|
|
this.trN.Hidden = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (NextFlow == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.Label1.Text = "审核完成";
|
|
|
|
|
|
this.drpNextMan.Hidden = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|