2025-03-27 15:05:14 +08:00

258 lines
11 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using HZQR.Common;
using SuperMap.RealEstate.CoreFrameWork;
using SuperMap.RealEstate.ServiceModel;
using SuperMap.RealEstate.Web.UI;
using SuperMap.RealEstate.Web.UI.WebControls;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SRFB = SuperMap.RealEstate.FrameWork.Business;
using WFSB = SuperMap.RealEstate.WorkFlow.Support.Business;
using Hwsb = SuperMap.RealEstate.HighWay.Storage.Business;
using PSSB = SuperMap.RealEstate.Personnel.Storage.Business;
namespace SuperMap.RealEstate.HighWay.Running.SXDocument
{
public partial class INITIATIONDOCUMENTSign : UserControl<Business.INITIATION_DOCUMENT>
{
Running.Business.HIGHWAYPROINST _HighWayProInst = null;
protected override void OnInit(EventArgs e)
{
Common.PageHelper.CreateHeaderStyle(Page);
_HighWayProInst = Running.Business.HIGHWAYPROINST.CreateInstance(Page);
this.ButtonVisible = false;
//隐藏打印受理单按钮
((IWorkFlowPage)Page).SetAcceptBillButton(false);//.SetAcceptBill("打印受理单", _Url);
base.OnInit(e);
}
//载入数据
public override bool LoadData()
{
//如果是工作流组件请自行修改载入的逻辑,以下是功能模块的默认代码
CurrObject.AddSearchParameter("PROINST_ID", _HighWayProInst.HIGHWAYPROINST_ID);
if (CurrObject.Search())
{
BindObjectToControl();
}
return true;
}
public override void InitializeWebControl()
{
STAFF_ID.Items.Clear();
Hwsb.CommonHelper.BingUserList(Transaction, Page.PassportInfo.ID.ToString(), STAFF_ID.Items);
}
#region ->
//2020/07/27姚金杰修改新增会签环节选择组件(隐藏显示),自动获取下一环节内码
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack) { return; }
if (ModifyType == ModifyTypeEnum.ReadOnly || ModifyType == ModifyTypeEnum.ReadOnlyVisible)
{
ButtonSave.Visible = false;
}
#region
ACTDEF_ID.Items.Clear();
if (ModifyType == ModifyTypeEnum.ReadOnly || ModifyType == ModifyTypeEnum.ReadOnlyVisible)
{
WorkFlow.Support.Business.ActDef _ActDef = new WFSB.ActDef(CurrObject);
_ActDef.ActDef_ID = _HighWayProInst.ProInst.NowActInst.ActDef_ID;
if (_ActDef.Select())
{
ListItemEx _ListItemEx = new ListItemEx();
_ListItemEx.Text = _ActDef.ActDef_Name;
_ListItemEx.Value = _ActDef.ActDef_ID.ToString();
ACTDEF_ID.Items.Add(_ListItemEx);
}
}
else
{
foreach (WorkFlow.Support.Business.ActDef _ActDef in new WorkFlow.Support.Business.ActDef(CurrObject).FillCollection(
"WHERE ACTDEF_ID IN (SELECT NEXTACTDEF_ID FROM WORKFLOW_SUPPORT.T_ROUTE WHERE ACTDEF_ID = " +
_HighWayProInst.ProInst.NowActInst.ActDef_ID + ")"))
{
if (_ActDef.ActDef_Type.ToInt32() == 3020)
{
foreach (WFSB.ActDef _NextActDef in new WFSB.ActDef(CurrObject).FillCollection(
"WHERE ACTDEF_ID IN (SELECT NEXTACTDEF_ID FROM WORKFLOW_SUPPORT.T_ROUTE WHERE ACTDEF_ID = " +
_ActDef.ActDef_ID + ")"))
{
ListItemEx _ListItemEx = new ListItemEx();
_ListItemEx.Text = _NextActDef.ActDef_Name;
_ListItemEx.Value = _NextActDef.ActDef_ID.ToString();
ACTDEF_ID.Items.Add(_ListItemEx);
}
}
else
{
ListItemEx _ListItemEx = new ListItemEx();
_ListItemEx.Text = _ActDef.ActDef_Name;
_ListItemEx.Value = _ActDef.ActDef_ID.ToString();
ACTDEF_ID.Items.Add(_ListItemEx);
}
}
}
#endregion
#region
if (!string.IsNullOrEmpty(ACTDEF_ID.SelectedValue))
{
string strUserIds = string.Empty;
Business.JOINTLYSIGN _JOINTLYSIGN = new Business.JOINTLYSIGN(Transaction);
_JOINTLYSIGN.AddSearchParameter("HIGHWAYPROINST_ID", _HighWayProInst.HIGHWAYPROINST_ID);
_JOINTLYSIGN.AddSearchParameter("ACTDEF_ID", ACTDEF_ID.SelectedValue);
if (_JOINTLYSIGN.Search())
{
strUserIds = _JOINTLYSIGN.USER_IDS;
}
UserIds.Clear();
foreach (DataRow _DataRow in _HighWayProInst.ExecuteDataTable(@"SELECT * FROM PLATFORM_FRAMEWORK.T_USER A
WHERE EXISTS(SELECT 1 FROM WORKFLOW_SUPPORT.T_ROLE B,WORKFLOW_SUPPORT.T_USERROLE C
WHERE A.USER_ID = C.USER_ID AND B.ROLE_ID = C.ROLE_ID AND B.ACTDEF_ID = " + ACTDEF_ID.SelectedValue + ")").Rows)
{
ListItemEx _ListItem = new ListItemEx();
_ListItem.Text = _DataRow["USER_NAME"].ToString();
_ListItem.Value = _DataRow["USER_ID"].ToString();
UserIds.Items.Add(_ListItem);
}
UserIds.SelectedValue = strUserIds;
}
#endregion
PSSB.STAFF _STAFF = new PSSB.STAFF(Transaction);
_STAFF.AddSearchParameter("USER_ID", Page.PassportInfo.ID);
if (_STAFF.Search())
{
Hwsb.SERVERPART _SERVERPART = new Hwsb.SERVERPART(Transaction);
_SERVERPART.SERVERPART_ID = _STAFF.SERVERPART_ID;
if (_SERVERPART.Select())
{
STAFF_UNIT_NAME.Text = _SERVERPART.SERVERPART_NAME;
}
}
if (CurrObject.PropertyObject != null && CurrObject.STAFF_ID == null)
{
STAFF_ID.SelectedValue = Page.PassportInfo.ID.ToString();
}
}
#endregion
public override void OnDataAction_BeforeSave(DataActionEventArgs<Business.INITIATION_DOCUMENT> e)
{
CurrObject.OPERATE_DATE = DateTime.Now;
if (string.IsNullOrEmpty(UserIds.SelectedValue))
{
throw new Exception("会签人员不能为空!");
}
e.CurrObject.PROINST_ID = _HighWayProInst.HIGHWAYPROINST_ID;
base.OnDataAction_BeforeSave(e);
}
//2020/07/27姚金杰修改会签时若会签人员与上次不一致则删除之前会签意见,重新填写
public override void OnDataAction_AfterSave(DataActionEventArgs<Business.INITIATION_DOCUMENT> e)
{
Business.JOINTLYSIGN _JOINTLYSIGN = new Business.JOINTLYSIGN(Transaction);
_JOINTLYSIGN.AddSearchParameter("HIGHWAYPROINST_ID", _HighWayProInst.HIGHWAYPROINST_ID);
//_JOINTLYSIGN.AddSearchParameter("TENDER_ID", e.CurrObject.INITIATION_DOCUMENT_ID);
_JOINTLYSIGN.AddSearchParameter("ACTDEF_ID", ACTDEF_ID.SelectedValue);
if (_JOINTLYSIGN.Search())
{
string _USER_NAMES = "";
foreach (FrameWork.Business.User _User in new FrameWork.Business.User(CurrObject).FillCollection(
"WHERE USER_ID IN (" + _JOINTLYSIGN.USER_IDS + ")"))
{
_USER_NAMES += (string.IsNullOrEmpty(_USER_NAMES) ? "" : ",") + _User.User_Name;
}
if (_JOINTLYSIGN.USER_IDS != UserIds.SelectedValue && !string.IsNullOrEmpty(_JOINTLYSIGN.APPROVED_TYPE.ToString()))
{
foreach (Running.Business.APPROVED _APPROVED in new Running.Business.APPROVED(CurrObject).FillCollection(
"WHERE HIGHWAYPROINST_ID = " + _JOINTLYSIGN.HIGHWAYPROINST_ID + " AND APPROVED_TYPE = " + _JOINTLYSIGN.APPROVED_TYPE))
{
_APPROVED.Delete();
}
_JOINTLYSIGN.APPROVED_IDS = "";
}
_JOINTLYSIGN.USER_IDS = UserIds.SelectedValue;
_JOINTLYSIGN.ACTDEF_ID = ACTDEF_ID.SelectedValue.TryParseToInt();
_JOINTLYSIGN.USER_NAMES = _USER_NAMES;
_JOINTLYSIGN.Update();
}
else
{
_JOINTLYSIGN.ResetProperty();
_JOINTLYSIGN.HIGHWAYPROINST_ID = _HighWayProInst.HIGHWAYPROINST_ID;
_JOINTLYSIGN.TENDER_ID = e.CurrObject.INITIATION_DOCUMENT_ID;
_JOINTLYSIGN.ACTDEF_ID = ACTDEF_ID.SelectedValue.TryParseToInt();
_JOINTLYSIGN.USER_IDS = UserIds.SelectedValue;
string _USER_NAMES = "";
foreach (FrameWork.Business.User _User in new FrameWork.Business.User(CurrObject).FillCollection(
"WHERE USER_ID IN (" + _JOINTLYSIGN.USER_IDS + ")"))
{
_USER_NAMES += (string.IsNullOrEmpty(_USER_NAMES) ? "" : ",") + _User.User_Name;
}
_JOINTLYSIGN.USER_NAMES = _USER_NAMES;
_JOINTLYSIGN.Insert();
}
try
{
#region
WorkFlow.Instance.Business.ProInst _ProInst = _HighWayProInst.ProInst;
_ProInst.ProInst_Name = I_DOCUMENT_TITLE.Text;
_ProInst.Update();
#endregion
}
catch (Exception ex)
{
}
base.OnDataAction_AfterSave(e);
}
protected void ButtonSave_Click(object sender, EventArgs e)
{
try
{
base.Save();
Page.RefreshOpener();
Page.Alert("保存成功!", 3);
}
catch (Exception ex)
{
Transaction.Rollback();
Page.Alert(ex.Message);
}
}
protected void ACTDEF_ID_CallBackSetControl(object sender, ClientSetEventArgs e)
{
UserIds.Clear();
if (!string.IsNullOrEmpty(e.Argument))
{
foreach (DataRow _DataRow in _HighWayProInst.ExecuteDataTable(@"SELECT * FROM PLATFORM_FRAMEWORK.T_USER A
WHERE A.USER_STATUS = 1 AND EXISTS(SELECT 1 FROM WORKFLOW_SUPPORT.T_ROLE B,WORKFLOW_SUPPORT.T_USERROLE C
WHERE A.USER_ID = C.USER_ID AND B.ROLE_ID = C.ROLE_ID AND B.ACTDEF_ID = " + ACTDEF_ID.SelectedValue + ")").Rows)
{
ListItemEx _ListItem = new ListItemEx();
_ListItem.Text = _DataRow["USER_NAME"].ToString();
_ListItem.Value = _DataRow["USER_ID"].ToString();
UserIds.Items.Add(_ListItem);
}
e.SetDropDownListEx(UserIds);
}
}
}
}