8fac982e19
SVN-Revision: r262
406 lines
19 KiB
C#
406 lines
19 KiB
C#
/***********************
|
|
* 说明:单据审批
|
|
* 创建人:龚宇超
|
|
* 创建日期:2017-12-27
|
|
* 修改人:
|
|
* 修改日期:
|
|
* 修改备注:
|
|
* 版本:1.0.0.1
|
|
***********************/
|
|
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.Business.Impl;
|
|
using Lskj.Data;
|
|
using Lskj.Model;
|
|
using Lskj.Util;
|
|
using DevExpress.XtraGrid.Views.Grid;
|
|
using DevExpress.XtraTab;
|
|
using DevExpress.Utils;
|
|
using Lskj.Business;
|
|
using System.Threading.Tasks;
|
|
using System.Collections;
|
|
|
|
namespace Lskj.PubAccraditation
|
|
{
|
|
public partial class FrmMain : BaseForm
|
|
{
|
|
public FrmMain()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
/// <summary>
|
|
/// 审批配置对象
|
|
/// </summary>
|
|
public BaseAccraditationModel BaseAccraditModelObj;
|
|
/// <summary>
|
|
/// 审批公共model
|
|
/// </summary>
|
|
public BillAuditCommonModel BillComModelObj;
|
|
/// <summary>
|
|
/// 系统模块配置
|
|
/// </summary>
|
|
public DynamicPubAccraditionModel SysModel;
|
|
|
|
/// <summary>
|
|
/// <para>说明:窗体加载时</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-30 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:2018-04-19</para>
|
|
/// <para>修改备注:1. 取消模块权限验证,点击菜单时候已验证.右键菜单无需验证</para>
|
|
/// <para>版本:1.1</para>
|
|
/// </summary>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
protected override void OnLoad(EventArgs e)
|
|
{
|
|
WaitForm.ShowForm();
|
|
this.auditPanelEx.Visible = false;
|
|
try
|
|
{
|
|
this.InitializeSetting();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.Instance.WriteError(ex, ResourceKeys.BaseModuleAudit);
|
|
//MessageUtil.Show(ex);
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
finally
|
|
{
|
|
Lskj.Control.Model.AutoSizeChange.ControllInitializeSize(this);
|
|
WaitForm.HideForm();
|
|
this.auditPanelEx.Visible = true;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:初始化属性</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-02-05</para>
|
|
/// <para>修改人:龚宇超</para>
|
|
/// <para>修改日期:2018-04-19</para>
|
|
/// <para>修改备注:1. menuCondRow有为空的情况,需要判断.</para>
|
|
/// <para>版本:1.1</para>
|
|
/// </summary>
|
|
private void InitializeSetting()
|
|
{
|
|
Dictionary<object, Hashtable> dataCaches = SysModel != null ? SysModel.DataCaches : null;
|
|
if (!dataCaches.GetValue(this, "AccraditationModelRow", out DataRow modelRow))
|
|
{
|
|
modelRow = BillAuditImpl.GetPubAuditProperty(this.SysModel.ModuleCode);//获取单个模块信息
|
|
}
|
|
if (modelRow == null)
|
|
{
|
|
throw new Exception("模块编号[" + this.SysModel.ModuleCode + "],配置错误!\r\n该模块信息未找到!");
|
|
}
|
|
|
|
//审批模型
|
|
if (!dataCaches.GetValue(this, "BaseAccraditationModel", out this.BaseAccraditModelObj))
|
|
{
|
|
this.BaseAccraditModelObj = new BaseAccraditationModel(modelRow);
|
|
}
|
|
|
|
//处理终审反退中的角色
|
|
if (!dataCaches.GetValue(this, "GetAllPersonnel", out string personnel))
|
|
{
|
|
personnel = this.BaseAccraditModelObj.OverBackOper;
|
|
personnel = PowerImpl.getAllPersonnel(personnel);
|
|
}
|
|
this.BaseAccraditModelObj.OverBackOper = personnel;
|
|
|
|
if (!dataCaches.GetValue(this, "MenuConfigTab", out DataRow menuCondRow))
|
|
{
|
|
menuCondRow = BaseImpl.GetMenuConfigTab(this.SysModel.ModuleId);
|
|
}
|
|
|
|
this.BaseAccraditModelObj.MenuCond = menuCondRow != null && menuCondRow.Table.Columns.Contains("StepCodeCond") ? menuCondRow["StepCodeCond"] + "" : "";
|
|
if (!dataCaches.GetValue(this, "ColumnPrefix", out string columnPrefix))
|
|
{
|
|
columnPrefix = BaseImpl.GetColumnPrefix(this.BaseAccraditModelObj.BillTable);
|
|
}
|
|
this.BaseAccraditModelObj.ColumnPrefix = columnPrefix;
|
|
|
|
if (!dataCaches.GetValue(this, "BillAuditCommonModel", out this.BillComModelObj))
|
|
{
|
|
this.BillComModelObj = new BillAuditCommonModel();
|
|
}
|
|
if (!dataCaches.GetValue(this, "FlowStepCode", out DataRow flowStepCode))
|
|
{
|
|
flowStepCode = BaseAuditImpl.GetFlowStepCode(this.SysModel.ModuleCode);
|
|
}
|
|
this.auditPanelEx.SectionAccradit = flowStepCode;
|
|
if (!dataCaches.GetValue(this, "ParmaryKey", out string parmaryKey))
|
|
{
|
|
parmaryKey = this.BaseAccraditModelObj.GetParmaryKey(ModuleType.BillAudit);
|
|
}
|
|
this.auditPanelEx.KeyValue = parmaryKey;
|
|
this.auditPanelEx.InitializeSetting(this.BillComModelObj, SysModel, BaseAccraditModelObj);
|
|
this.auditPanelEx.OnGridViewDoubleCallBack += new EventHandler(GridViewDoubleEvent);
|
|
this.auditPanelEx.OnGridFinshViewDoubleCallBack += new EventHandler(GridFinshViewDoubleEvent);
|
|
this.auditPanelEx.OnBtnSearchCallBack += new BtnSearchGridFinishEventHandler(GridFinshSerachEvent);
|
|
}
|
|
|
|
public void GetDataCaches(Dictionary<object, Hashtable> cachesDic)
|
|
{
|
|
//全局数据
|
|
Task<DynamicModel> dynamicModelTask = cachesDic.AddTask(this, "DynamicModel", new Task<DynamicModel>(() =>
|
|
{
|
|
return SysModel;//动态链接库对象
|
|
}));
|
|
Task<DataRow> accraditationModelRowTask = cachesDic.AddTask(this, "AccraditationModelRow", new Task<DataRow>(() =>
|
|
{
|
|
return BillAuditImpl.GetPubAuditProperty(dynamicModelTask.Result.ModuleCode);//获取单个模块信息
|
|
}));
|
|
Task<BaseAccraditationModel> baseAccraditationModelTask = cachesDic.AddTask(this, "BaseAccraditationModel", new Task<BaseAccraditationModel>(() =>
|
|
{
|
|
BaseAccraditationModel baseAccraditationModel = new BaseAccraditationModel(accraditationModelRowTask.Result);
|
|
Task<string> columnPrefixTask = cachesDic.AddTask(this, "ColumnPrefix", new Task<string>(() =>
|
|
{
|
|
return BaseImpl.GetColumnPrefix(baseAccraditationModel.BillTable);
|
|
}));
|
|
baseAccraditationModel.ColumnPrefix = columnPrefixTask.Result;
|
|
Task<string> parmaryKeyTask = cachesDic.AddTask(this, "ParmaryKey", new Task<string>(() =>
|
|
{
|
|
return baseAccraditationModel.GetParmaryKey(ModuleType.BillAudit);
|
|
}));
|
|
return baseAccraditationModel;//系统模块实体对象
|
|
}));
|
|
Task<string> getAllPersonnelTask = cachesDic.AddTask(this, "GetAllPersonnel", new Task<string>(() =>
|
|
{
|
|
return PowerImpl.getAllPersonnel(baseAccraditationModelTask.Result.OverBackOper);
|
|
}));
|
|
Task<DataRow> menuConfigTabTask = cachesDic.AddTask(this, "MenuConfigTab", new Task<DataRow>(() =>
|
|
{
|
|
return BaseImpl.GetMenuConfigTab(dynamicModelTask.Result.ModuleId);
|
|
}));
|
|
Task<BillAuditCommonModel> billAuditCommonModelTask = cachesDic.AddTask(this, "BillAuditCommonModel", new Task<BillAuditCommonModel>(() =>
|
|
{
|
|
return new BillAuditCommonModel();
|
|
}));
|
|
Task<DataRow> flowStepCodeTask = cachesDic.AddTask(this, "FlowStepCode", new Task<DataRow>(() =>
|
|
{
|
|
return BaseAuditImpl.GetFlowStepCode(dynamicModelTask.Result.ModuleCode);
|
|
}));
|
|
//添加数据到mControl
|
|
cachesDic.AddTask(auditPanelEx, "DynamicModel", dynamicModelTask);
|
|
cachesDic.AddTask(auditPanelEx, "BillAuditCommonModel", billAuditCommonModelTask);
|
|
cachesDic.AddTask(auditPanelEx, "BaseAccraditationModel", baseAccraditationModelTask);
|
|
//获取mControl控件的数据
|
|
auditPanelEx.GetDataCaches(cachesDic);
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 搜索数据
|
|
/// </summary>
|
|
/// <param name="sender">The sender.</param>
|
|
/// <param name="e">The e.</param>
|
|
private void GridFinshSerachEvent(object sender, BtnSearchGridFinishArgs e)
|
|
{
|
|
try
|
|
{
|
|
this.auditPanelEx.FinishGridObj.SetGridViewDataSource(BillAuditImpl.GetGridFinishData(this.BaseAccraditModelObj, e.CancelFlag, e.Cond));
|
|
|
|
//已完成单据刷新选中状态
|
|
DataTable completedTable = this.auditPanelEx.FinishGridObj.gridControl.DataSource as DataTable;
|
|
if (completedTable != null && !completedTable.Columns.Contains("_check") && (BaseAccraditModelObj.MuitlAuditFlag || BaseAccraditModelObj.MuitlAuditBackFlag))
|
|
{
|
|
completedTable.Columns.Add("_check", typeof(bool));
|
|
foreach (DataRow row in completedTable.Rows)
|
|
{
|
|
row["_check"] = 0;
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:表格双击弹出模块</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-30 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
private void GridViewDoubleEvent(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
GridView gc = sender as GridView;
|
|
DataRow dr = gc.GetFocusedDataRow();
|
|
if (dr == null) return;
|
|
|
|
//单据审批弹出模块
|
|
string[] defaultArgs = string.Format(ModuleArgs.DefaultArgs, this.SysModel.FormText, ERPInfo.Instance.UserId, ERPInfo.Instance.UserName, this.SysModel.Privilege, this.SysModel.ModuleCode).Split('~');
|
|
string[] menuArgs = { this.SysModel.ModuleId + "", "", dr[this.BaseAccraditModelObj.TmpStepField] + "", dr[this.BaseAccraditModelObj.TmpParmaryField] + "", "", "0" };
|
|
string[] args = defaultArgs.Concat(menuArgs).ToArray();
|
|
FrmAccraditation frm = new FrmAccraditation();
|
|
frm.SysModel = new DynamicPubAccraditionPopModel(args);
|
|
if (SystemInfo.Instance.OptimizationSpeed) frm.GetDataCaches(frm.SysModel.DataCaches);
|
|
frm.Text = this.Text;
|
|
|
|
if (SystemInfo.Instance.PageOpen)
|
|
{
|
|
|
|
foreach (XtraTabPage tablepage in ERPInfo.Instance.PageControl.TabPages)
|
|
{
|
|
int interceptionLocation = tablepage.Text.Length - frm.SysModel.BillDocumentId.Length - 1;
|
|
if (interceptionLocation > 0 && tablepage.Text.Length > frm.SysModel.BillDocumentId.Length)
|
|
{
|
|
string documentNo = tablepage.Text.Substring(tablepage.Text.Length - frm.SysModel.BillDocumentId.Length - 1);
|
|
documentNo = documentNo.Substring(0, documentNo.Length - 1);
|
|
if (documentNo.Equals(frm.SysModel.BillDocumentId))
|
|
{
|
|
MessageUtil.Show("已设置不能打开多个相同模块!");
|
|
ERPInfo.Instance.PageControl.SelectedTabPage = tablepage;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
DllModule module = new DllModule
|
|
{
|
|
DllName = "",
|
|
Id = SysModel.ModuleId + "",
|
|
Name = SysModel.FormText,
|
|
BeforePage = ERPInfo.Instance.PageControl.SelectedTabPage
|
|
};
|
|
frm.refreshThePage += new FrmAccraditation.RefreshThePage(refreshThePage);
|
|
string guid = Guid.NewGuid().ToString();
|
|
XtraTabPage tp = new XtraTabPage();
|
|
tp.Tag = guid;
|
|
// 这个必须有不然会提示:"不能向tabControl中添加顶级控件"
|
|
frm.TopLevel = false;
|
|
frm.Location = new Point(0, 0);
|
|
frm.Dock = DockStyle.Fill;
|
|
frm.FormBorderStyle = FormBorderStyle.None;
|
|
tp.AutoScroll = true;
|
|
tp.Controls.Add(frm);
|
|
tp.ShowCloseButton = DefaultBoolean.True;
|
|
tp.Dock = DockStyle.Fill;
|
|
ERPInfo.Instance.PageControl.TabPages.Add(tp);
|
|
ERPInfo.Instance.PageControl.SelectedTabPage = tp;
|
|
frm.Show();
|
|
tp.Text = frm.Text;
|
|
ERPInfo.Instance.ModuleForms.Add(guid, module);
|
|
}
|
|
else
|
|
{
|
|
|
|
DialogResult drr = frm.ShowDialog();
|
|
this.auditPanelEx.RefreshTabPage();
|
|
frm.Dispose();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:已完成表格双击弹出模块</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-30 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The sender.</param>
|
|
private void GridFinshViewDoubleEvent(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
GridView gc = sender as GridView;
|
|
DataRow dr = gc.GetFocusedDataRow();
|
|
if (dr == null) return;
|
|
//单据审批弹出模块加载
|
|
string[] defaultArgs = string.Format(ModuleArgs.DefaultArgs, this.SysModel.FormText, ERPInfo.Instance.UserId, ERPInfo.Instance.UserName, this.SysModel.Privilege, this.SysModel.ModuleCode).Split('~');
|
|
string[] menuArgs = { this.SysModel.ModuleId + "", "", dr[this.auditPanelEx.TmpPrefix + this.BaseAccraditModelObj.DefaultStepField] + "", dr[this.auditPanelEx.TmpPrefix + this.BaseAccraditModelObj.DefaultParmaryField] + "", "", "1" };
|
|
string[] args = defaultArgs.Concat(menuArgs).ToArray();
|
|
FrmAccraditation frm = new FrmAccraditation();
|
|
frm.SysModel = new DynamicPubAccraditionPopModel(args);
|
|
frm.Text = this.Text;
|
|
|
|
if (SystemInfo.Instance.PageOpen)
|
|
{
|
|
foreach (XtraTabPage tablepage in ERPInfo.Instance.PageControl.TabPages)
|
|
{
|
|
int interceptionLocation = tablepage.Text.Length - frm.SysModel.BillDocumentId.Length - 1;
|
|
if (interceptionLocation > 0 && tablepage.Text.Length > frm.SysModel.BillDocumentId.Length)
|
|
{
|
|
string documentNo = tablepage.Text.Substring(tablepage.Text.Length - frm.SysModel.BillDocumentId.Length - 1);
|
|
documentNo = documentNo.Substring(0, documentNo.Length - 1);
|
|
if (documentNo.Equals(frm.SysModel.BillDocumentId))
|
|
{
|
|
MessageUtil.Show("已设置不能打开多个相同模块!");
|
|
ERPInfo.Instance.PageControl.SelectedTabPage = tablepage;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
DllModule module = new DllModule
|
|
{
|
|
DllName = "",
|
|
Id = SysModel.ModuleId + "",
|
|
Name = SysModel.FormText,
|
|
BeforePage = ERPInfo.Instance.PageControl.SelectedTabPage
|
|
};
|
|
frm.refreshThePage += new FrmAccraditation.RefreshThePage(refreshThePage);
|
|
string guid = Guid.NewGuid().ToString();
|
|
XtraTabPage tp = new XtraTabPage();
|
|
tp.Tag = guid;
|
|
// 这个必须有不然会提示:"不能向tabControl中添加顶级控件"
|
|
frm.TopLevel = false;
|
|
frm.Location = new Point(0, 0);
|
|
frm.Dock = DockStyle.Fill;
|
|
frm.FormBorderStyle = FormBorderStyle.None;
|
|
tp.AutoScroll = true;
|
|
tp.AutoScroll = true;
|
|
tp.Controls.Add(frm);
|
|
tp.ShowCloseButton = DefaultBoolean.True;
|
|
tp.Dock = DockStyle.Fill;
|
|
ERPInfo.Instance.PageControl.TabPages.Add(tp);
|
|
ERPInfo.Instance.PageControl.SelectedTabPage = tp;
|
|
frm.Show();
|
|
tp.Text = frm.Text;
|
|
ERPInfo.Instance.ModuleForms.Add(guid, module);
|
|
|
|
}
|
|
else
|
|
{
|
|
DialogResult drr = frm.ShowDialog();
|
|
frm.Dispose();
|
|
this.auditPanelEx.RefreshTabPage();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:page打开审核界面完成操作后刷新当前界面</para>
|
|
/// <para>创建人:曹屹峰</para>
|
|
/// <para>创建日期:2021-11-23 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <p |