ab56a9bcf7
SVN-Revision: r240
534 lines
19 KiB
C#
534 lines
19 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using Lskj.Control;
|
|
using Lskj.Control.Model;
|
|
using Lskj.Util;
|
|
using Lskj.Data;
|
|
using Lskj.Business.Impl;
|
|
using DevExpress.XtraGrid.Columns;
|
|
using DevExpress.XtraGrid.Views.Grid;
|
|
using DevExpress.XtraGrid.Views.Base;
|
|
using Lskj.Business;
|
|
using System.Text.RegularExpressions;
|
|
using Lskj.Core;
|
|
using System.Diagnostics;
|
|
|
|
namespace Lskj.BaseAccraditation
|
|
{
|
|
public partial class FrmLookupData : BaseForm
|
|
{
|
|
#region 公有变量
|
|
/// <summary>
|
|
/// 审批模块编号
|
|
/// </summary>
|
|
public string ModuleCode;
|
|
/// <summary>
|
|
/// 审批模块单据类型
|
|
/// </summary>
|
|
public string BillType;
|
|
/// <summary>
|
|
/// 审批模块步骤
|
|
/// </summary>
|
|
public string StepCode;
|
|
/// <summary>
|
|
/// 审批模块对应编码
|
|
/// </summary>
|
|
public string nextSelectStepCode;
|
|
/// <summary>
|
|
/// 审批模块对应人员
|
|
/// </summary>
|
|
public string nextSelectStepOper;
|
|
|
|
#endregion
|
|
#region 私有变量
|
|
/// <summary>
|
|
/// The _id
|
|
/// </summary>
|
|
private string _id = "_id";
|
|
/// <summary>
|
|
/// 是否全部加载
|
|
/// </summary>
|
|
private bool isLoadBothStepCode;
|
|
/// <summary>
|
|
/// 审批模块对应编码
|
|
/// </summary>
|
|
private bool isLoadBothStepOper;
|
|
/// <summary>
|
|
/// 审批模块对应编码
|
|
/// </summary>
|
|
private bool isMultiAudit;
|
|
/// <summary>
|
|
/// 复选框字段名称
|
|
/// </summary>
|
|
private string _checkFieldName = "_check";
|
|
/// <summary>
|
|
/// 操作人员数组
|
|
/// </summary>
|
|
private string[] StepOper;
|
|
/// <summary>
|
|
/// 左侧步骤表
|
|
/// </summary>
|
|
private DataTable NextStepTab;
|
|
|
|
#endregion
|
|
public FrmLookupData()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:窗体加载时</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-12-14 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
protected override void OnLoad(EventArgs e)
|
|
{
|
|
WaitForm.ShowForm();
|
|
try
|
|
{
|
|
this.InitLoadStat();
|
|
this.InitNextStep();
|
|
this.InitNextStat();
|
|
this.gcMain.FocusedRowChanged += new DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventHandler(OnGridViewRowCellClick);
|
|
this.gcMain.RowCellClick += new RowCellClickEventHandler(OnGridViewRowCellClick);
|
|
this.gcDeatil.RowCellClick += new RowCellClickEventHandler(OnGridDetailRowCellClick);
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message,ex.Message);
|
|
|
|
LogHelper.Instance.WriteError(ex, ResourceKeys.BaseModuleAudit);
|
|
|
|
}
|
|
finally
|
|
{
|
|
WaitForm.HideForm();
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 全选步骤所有数据方法
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
public void StepSelectAll(){
|
|
try {
|
|
DataTable DataSource = this.gcMain.GetGridViewFilteredAndSortedDataToDataTable();
|
|
foreach (DataRow item in DataSource.Rows)
|
|
{
|
|
DataRow rowItem = this.NextStepTab.Select("1=1").FirstOrDefault(x => (item[_id] + "").Equals(x[_id] + ""));
|
|
rowItem[_checkFieldName] = 1;
|
|
rowItem.AcceptChanges();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message,ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// 全选人员所有数据
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
public void OperSelectAll()
|
|
{
|
|
try {
|
|
DataTable DataSource = this.gcDeatil.GetGridViewFilteredAndSortedDataToDataTable();
|
|
foreach (DataRow item in DataSource.Rows)
|
|
{
|
|
if ("False".Equals(item[_checkFieldName] + ""))
|
|
{
|
|
item[_checkFieldName] = 1;
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message,ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// 取消步骤所有数据方法
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
public void StepCancelAll()
|
|
{
|
|
try {
|
|
if (!isLoadBothStepCode) return;
|
|
DataTable dt = this.NextStepTab.Clone();
|
|
foreach (DataRow item in this.NextStepTab.Rows)
|
|
{
|
|
if ("True".Equals(item[_checkFieldName] + ""))
|
|
{
|
|
item[_checkFieldName] = 0;
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message,ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// 取消人员所有数据
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
public void OperCancelAll()
|
|
{
|
|
try {
|
|
DataTable DataSource = this.gcDeatil.GetGridViewFilteredAndSortedDataToDataTable();
|
|
foreach (DataRow item in DataSource.Rows)
|
|
{
|
|
if ("False".Equals(item[_checkFieldName] + ""))
|
|
{
|
|
item[_checkFieldName] = 1;
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogUtil.WriteError("取消人员所有数据出错!", ex);
|
|
MessageUtil.Show("取消人员所有数据出错!" + ex);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 全选所有数据
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void btn_selectAll_Click(object sender, EventArgs e)
|
|
{
|
|
StepSelectAll();
|
|
}
|
|
/// <summary>
|
|
/// 取消全选
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void btn_StepcancelAll_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
try
|
|
{
|
|
StepCancelAll();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message,ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 人员全选所有数据
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void btn_OperselectAll_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
OperSelectAll();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message,ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// 人员取消全选
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void btn_OpercancelAll_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
OperCancelAll();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message,ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:设置状态</para>
|
|
/// <para>创建人:王一帆</para>
|
|
/// <para>创建日期:2020-11-13 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs"/> instance containing the event data.</param>
|
|
private void InitNextStat() {
|
|
if (!isLoadBothStepCode) {
|
|
StepSelectAll();
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:选中行</para>
|
|
/// <para>创建人:王一帆</para>
|
|
/// <para>创建日期:2020-11-13 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs"/> instance containing the event data.</param>
|
|
private void OnGridViewRowCellClick(object sender, FocusedRowChangedEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
this.RefreshRightGrid();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message,ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:选中行</para>
|
|
/// <para>创建人:王一帆</para>
|
|
/// <para>创建日期:2020-11-13 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs"/> instance containing the event data.</param>
|
|
private void OnGridViewRowCellClick(object sender, RowCellClickEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
DataRow rowItem = this.gcMain.GetFocusedDataRow();
|
|
if (rowItem != null && e.Column.FieldName == _checkFieldName)
|
|
{
|
|
rowItem[_checkFieldName] = "True".Equals(rowItem[_checkFieldName] + "") && isLoadBothStepCode ? 0 : 1;
|
|
rowItem.AcceptChanges();
|
|
}
|
|
this.RefreshRightGrid();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message,ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:选中行</para>
|
|
/// <para>创建人:王一帆</para>
|
|
/// <para>创建日期:2020-11-13 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs"/> instance containing the event data.</param>
|
|
private void OnGridDetailRowCellClick(object sender, RowCellClickEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (!isLoadBothStepOper) return;
|
|
if (!isMultiAudit)
|
|
{
|
|
OperCancelAll();
|
|
}
|
|
DataRow rowItem = this.gcMain.GetFocusedDataRow();
|
|
DataRow rowDetail = this.gcDeatil.GetFocusedDataRow();
|
|
if (rowItem != null && rowDetail != null && e.Column.FieldName == _checkFieldName)
|
|
{
|
|
rowDetail[_checkFieldName] = "True".Equals(rowDetail[_checkFieldName] + "") ? 0 : 1;
|
|
|
|
rowItem["stepOper"] = string.Empty;
|
|
rowItem.AcceptChanges();
|
|
rowDetail.AcceptChanges();
|
|
DataRow[] rowItems = this.gridControl2.DataSourceTable().Select(_checkFieldName + "=True");
|
|
foreach (DataRow item in rowItems)
|
|
{
|
|
rowItem["stepOper"] += item["stepOper"] + ",";
|
|
rowItem.AcceptChanges();
|
|
}
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message,ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:选中行</para>
|
|
/// <para>创建人:王一帆</para>
|
|
/// <para>创建日期:2020-11-13 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs"/> instance containing the event data.</param>
|
|
private void RefreshRightGrid()
|
|
{
|
|
int num = this.gcMain.FocusedRowHandle;
|
|
string[] stepOpers = StepOper[num].Split(',');
|
|
DataTable operTable = new DataTable();
|
|
operTable.Columns.Add("stepOper");
|
|
for (int i = 0; i < operTable.Columns.Count; i++)
|
|
{
|
|
operTable.Rows[i]["stepOper"] = stepOpers[i] + "";
|
|
}
|
|
operTable.AcceptChanges();
|
|
this.gcDeatil.GridControl.DataSource = operTable;
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:设置新版审批的基础配置</para>
|
|
/// <para>创建人:王一帆</para>
|
|
/// <para>创建日期:2017-12-14 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
public void InitLoadStat()
|
|
{
|
|
DataRow NextStepFlag = BaseAuditImpl.SetUpNextStep(ModuleCode, BillType, StepCode);
|
|
if (NextStepFlag != null)
|
|
{
|
|
isLoadBothStepCode = "1".Equals(NextStepFlag["nextStepSelect"] + "");
|
|
isLoadBothStepOper = "1".Equals(NextStepFlag["nextOperSelect"] + "");
|
|
isMultiAudit = "1".Equals(NextStepFlag["multiAudit"] + "");
|
|
}
|
|
else
|
|
{
|
|
MessageUtil.Show("配置新版审批失败!" + "\r\n");
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:设置新版审批的数据</para>
|
|
/// <para>创建人:王一帆</para>
|
|
/// <para>创建日期:2017-12-14 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
public void InitNextStep()
|
|
{
|
|
this.gcMain.Columns.Clear();
|
|
NextStepTab = BaseAuditImpl.GetUpNextStepGrid(ModuleCode, nextSelectStepCode);
|
|
string[] StepOper = nextSelectStepOper.Split('~');
|
|
if (NextStepTab != null)
|
|
{
|
|
if (!NextStepTab.Columns.Contains(_checkFieldName))
|
|
{
|
|
NextStepTab.Columns.Add(_checkFieldName, typeof(bool));
|
|
NextStepTab.Columns.Add(_id, typeof(int));
|
|
|
|
for (int i = 0; i < NextStepTab.Rows.Count; i++)
|
|
{
|
|
NextStepTab.Rows[i][_checkFieldName] = 0;
|
|
NextStepTab.Rows[i][_id] = i;
|
|
}
|
|
}
|
|
|
|
GridColumn checkColumn = new GridColumn();
|
|
checkColumn.Name = checkColumn.FieldName = this._checkFieldName;
|
|
checkColumn.Caption = "选";
|
|
checkColumn.Width = 30;
|
|
checkColumn.Visible = true;
|
|
checkColumn.OptionsColumn.AllowEdit = false;
|
|
|
|
GridColumn valueColumn = new GridColumn();
|
|
valueColumn.FieldName = valueColumn.Name = "stepname";
|
|
valueColumn.Caption = "步骤名称";
|
|
valueColumn.Width = 200;
|
|
valueColumn.Visible = true;
|
|
valueColumn.OptionsColumn.AllowEdit = false;
|
|
|
|
GridColumn textColumn = new GridColumn();
|
|
textColumn.FieldName = textColumn.Name = "stepOper";
|
|
textColumn.Caption = "协助人员列表";
|
|
textColumn.Width = 350;
|
|
textColumn.Visible = true;
|
|
textColumn.OptionsColumn.AllowEdit = false;
|
|
|
|
this.gcMain.Columns.AddRange(new GridColumn[] { checkColumn, valueColumn, textColumn });
|
|
this.gcDeatil.Columns.AddRange(new GridColumn[] { checkColumn, textColumn });
|
|
this.gridControl1.DataSource = NextStepTab;
|
|
//this.gcDetail.SelectAll();
|
|
//this.gcDetail.DeleteSelectedRows();
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// 确认审批人
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void btnOk_Click(object sender, EventArgs e)
|
|
{
|
|
try {
|
|
nextSelectStepCode = string.Empty;
|
|
nextSelectStepOper = string.Empty;
|
|
DataRow[] rowItems = this.NextStepTab.Select(_checkFieldName + "=True");
|
|
foreach (DataRow item in rowItems)
|
|
{
|
|
nextSelectStepCode += item["stepname"] + ";";
|
|
nextSelectStepOper += item["stepOper"] + ";";
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message,ex.Message);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|