SGGL_SHJ/SGGL/FineUIPro.Web/PHTGL/InvoiceManage/InvoiceOrderReviewEdit.aspx.cs

159 lines
7.1 KiB
C#

using BLL;
using Model;
using System;
using System.Linq;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.PHTGL.InvoiceManage
{
public partial class InvoiceOrderReviewEdit : PageBase
{
public string InvoiceId
{
get
{
return (string)ViewState["InvoiceId"];
}
set
{
ViewState["InvoiceId"] = value;
}
}
public string Type
{
get
{
return (string)ViewState["Type"];
}
set
{
ViewState["Type"] = value;
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
InvoiceId = Request.QueryString["InvoiceId"];
Type = Request.QueryString["Type"];
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
var model = PhtglInvoiceService.GetPHTGL_InvoiceById(InvoiceId);
int[] arr = new Int32[] { PhtglInvoiceService.StateCreate, PhtglInvoiceService.StateInPutApproveRefuse, PhtglInvoiceService.StateInPutApproveSuccess, PhtglInvoiceService.StateOutPutApproveRefuse, };
if (arr.ToList().Contains(model.State.Value))
{
if (model.State == PhtglInvoiceService.StateInPutApproveRefuse || model.State == PhtglInvoiceService.StateOutPutApproveRefuse)
{
btnSubmit.Text = "重新发起流程";
}
btnSubmit.Hidden = false;
}
if (Type == "0")
{
Panel_OrderIn.Hidden = false;
}
else if (Type == "1")
{
Panel_OrderOut.Hidden = false;
}
//入库下拉框
BLL.Person_PersonsService.InitUserProjectIdUnitIdRoleIdDropDownList(DropProfessionalEngineer, null, Const.UnitId_SEDIN, null, true);//专业工程师
BLL.Person_PersonsService.InitUserProjectIdUnitIdRoleIdDropDownList(DropConstructionManager, null, Const.UnitId_SEDIN, null, true);//施工经理
BLL.Person_PersonsService.InitUserProjectIdUnitIdRoleIdDropDownList(DropControlManager_In, null, Const.UnitId_SEDIN, null, true);//控制经理
BLL.Person_PersonsService.InitUserProjectIdUnitIdRoleIdDropDownList(DropProjectManager_In, null, Const.UnitId_SEDIN, null, true);//项目经理
//出库下拉框
BLL.Person_PersonsService.InitUserProjectIdUnitIdRoleIdDropDownList(DropPurchasingMan, null, Const.UnitId_SEDIN, null, true);//采购员
BLL.Person_PersonsService.InitUserProjectIdUnitIdRoleIdDropDownList(DropControlManager_Out, null, Const.UnitId_SEDIN, null, true);//控制经理
BLL.Person_PersonsService.InitUserProjectIdUnitIdRoleIdDropDownList(DropProjectManager_Out, null, Const.UnitId_SEDIN, null, true);//项目经理
BLL.Person_PersonsService.InitUserProjectIdUnitIdRoleIdDropDownList(DropConUnitMaterialOfficer, null, Const.UnitId_SEDIN, null, true);//施工单位材料经理
BLL.Person_PersonsService.InitUserProjectIdUnitIdRoleIdDropDownList(DropConUnitProjectManager, null, Const.UnitId_SEDIN, null, true);//施工单位项目经理
var invoiceApproveManEntity = PhtglInvoiceService.GetInvoiceApproveManEntity(InvoiceId);
//入库下拉框初始化值
DropProfessionalEngineer.SelectedValue = invoiceApproveManEntity.InputApproveMan?.ProjectManager;
DropConstructionManager.SelectedValue = invoiceApproveManEntity.InputApproveMan?.ConstructionManager;
DropControlManager_In.SelectedValue = invoiceApproveManEntity.InputApproveMan?.ControlManager;
DropProjectManager_In.SelectedValue = invoiceApproveManEntity.InputApproveMan?.ProjectManager;
//出库下拉框初始化值
DropPurchasingMan.SelectedValue = invoiceApproveManEntity.OutputApproveMan?.PurchasingMan;
DropControlManager_Out.SelectedValue = invoiceApproveManEntity.OutputApproveMan?.ControlManager;
DropProjectManager_Out.SelectedValue = invoiceApproveManEntity.OutputApproveMan?.ProjectManager;
DropConUnitMaterialOfficer.SelectedValue = invoiceApproveManEntity.OutputApproveMan?.ConUnitMaterialOfficer;
DropConUnitProjectManager.SelectedValue = invoiceApproveManEntity.OutputApproveMan?.ConUnitProjectManager;
}
}
private bool DropIsNull(Control c)
{
bool IsOk = true;
//遍历控件
//myDictionary.Clear();
foreach (Control childControl in c.Controls)
{
if (childControl is DropDownList)
{
DropDownList tb = (DropDownList)childControl;
if (tb.SelectedValue == Const._Null)
{
IsOk = false;
ShowNotify("请选择要审批的" + tb.Label, MessageBoxIcon.Warning);
return IsOk;
}
}
}
return IsOk;
}
protected void Save()
{
if (!DropIsNull(SimpleForm1))
{
return;
}
var model_In = new Inputapproveman()
{
ProfessionalEngineer = DropProfessionalEngineer.SelectedValue,
ConstructionManager = DropConstructionManager.SelectedValue,
ControlManager = DropControlManager_In.SelectedValue,
ProjectManager = DropProjectManager_In.SelectedValue
};
var model_Out = new Outputapproveman()
{
PurchasingMan = DropPurchasingMan.SelectedValue,
ControlManager = DropControlManager_Out.SelectedValue,
ProjectManager = DropProjectManager_Out.SelectedValue,
ConUnitMaterialOfficer = DropConUnitMaterialOfficer.SelectedValue,
ConUnitProjectManager = DropConUnitProjectManager.SelectedValue
};
if (Type == "0")
{
PhtglInvoiceService.SaveInputApproveManEntity(InvoiceId, model_In);
}
else if (Type == "1")
{
PhtglInvoiceService.SaveOutputApproveManEntity(InvoiceId, model_Out);
}
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
Save();
PhtglInvoiceService.StartApprovalProcess(InvoiceId);
OAWebSevice.Pushoa();
ShowNotify("提交成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHideReference());
}
protected void btnSave_Click(object sender, EventArgs e)
{
Save();
ShowNotify("保存成功!", MessageBoxIcon.Success);
}
}
}