/***********************
* 说明:基础档案审批弹出窗口模块
* 创建人:龚宇超
* 创建日期:2017-12-14
* 修改人:
* 修改日期:
* 修改备注:
* 版本:1.0.0.0
***********************/
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.Model;
using Lskj.Business.Impl;
using DevExpress.XtraTab;
using DevExpress.XtraBars;
using DevExpress.XtraEditors;
using DevExpress.XtraGrid.Views.Grid;
using Lskj.Business;
using Lskj.Control.MultiGridLookUp;
using System.Collections;
using DevExpress.XtraGrid.Columns;
using System.Text.RegularExpressions;
using Lskj.Core;
using System.Diagnostics;
using System.Threading.Tasks;
using System.IO;
namespace Lskj.BaseAccraditation
{
public partial class FrmBaseAccraditation : BaseForm
{
#region 公用变量
///
/// 审批模型
///
public Dictionary isModifyPage = new Dictionary();
///
/// 审批模型
///
public AccraditationModel AccditModelObj;
///
/// 基础审批用表模型
///
public BaseAuditCommonModel BaseAuditModelObj = new BaseAuditCommonModel();
///
/// 基础档案模型
///
public BaseAuditModel ModuleModelObj;
///
/// 系统模块配置
///
public DynamicBaseAccraditionPopModel SysModel;
///
/// 主表控件
///
public MyControl ControlObj;
private bool mResourcesReleased;
#endregion
#region 私有变量
///
/// 表格列头颜色
///
protected string HeaderColor = "#A0A0A0";
///
/// 推送模块
///
private int _beforeId;
///
/// 主面板高度记录
///
private int _mainPanelHeight;
///
/// 初始化完成
///
private bool _isInitFinish;
///
/// 返退意见
///
private string _auditAdvic;
///
/// 推送菜单名
///
private string _beforeMenuName;
///
/// 推送操作人员
///
private string _beforeUsers;
///
/// 当前窗体控件数据来源(配置的)
///
private DataRow _baseRowData;
///
/// 当前流转数据
///
private DataRow _flowRowData;
///
/// 基本数据
///
private DataTable _baseTabList;
///
/// 操作字段
///
private DataTable _dtFileds;
///
/// 分组控件字段
///
private DataTable _dtAddGroup;
///
/// 流转步骤模型
///
private FlowTypeStepModel _flowTypeStepModel;
///
/// 单据水印
///
private WaterMark _waterMark;
private DataRow mRowItem;
///
/// 获取所有控件的x轴
///
private ArrayList LocationX = new ArrayList();
///
/// 是否执行了加载储存过程
///
public bool ProcessExists = false;
///
/// 是否是已完成单据
///
public bool IsFinishPage = false;
///
/// 关闭当前审核界面,刷新打开界面
///
/// The sender.
public event RefreshThePage refreshThePage;
public delegate void RefreshThePage(string promptInformation, string id);
///
/// 是否有明细必填
///
public bool DetailsRequired = false;
///
/// 打印完成后添加数据用到的参数: 表名,列前缀,主键字段,主键值,模块编号,主打印Sql
///
private List _printSaveParams;
///
/// 主打印Sql
///
private string _mainPrintSql;
///
/// 打印主sql中关联打印次数返回条件
///
private string _printModeCond;
///
/// 是否直接打印
///
private bool _isExcPrint;
#endregion
#region 初始化分割条位置
///
/// 说明:初始化分割条位置
/// 创建人:龚宇超
/// 创建日期:2017-12-15
/// 修改人:
/// 修改日期:
/// 修改备注:
/// 版本:1.0
///
private void InitSpliterPosition()
{
string spliterPosition = IniHelper.Read(string.Format("base_SplitterPositionLeft_{0}", this.SysModel.ModuleCode));
string splitterLeftPosition = IniHelper.Read(string.Format("base_spliterPositionMain_{0}", this.SysModel.ModuleCode));
if (!string.IsNullOrEmpty(spliterPosition)) this.splitContainer.SplitterPosition = Convert.ToInt32(spliterPosition);
if (!string.IsNullOrEmpty(splitterLeftPosition)) this.splitMain.SplitterPosition = Convert.ToInt32(splitterLeftPosition);
}
#endregion
#region 初始化控件
public FrmBaseAccraditation()
{
InitializeComponent();
}
private void ReleaseResourcesForDispose()
{
if (mResourcesReleased)
{
return;
}
mResourcesReleased = true;
PrintUtil.OnAfterPrint -= OnReportPrintAfter;
MyControl control = ControlObj;
ControlObj = null;
if (control != null)
{
control.OnDataSourceBindCallBack -=
OnControlObjOnDataSourceBindCallBack;
control.Dispose();
}
try
{
if (tab_basicInfo != null)
{
tab_basicInfo.ParentControlEx = null;
}
if (SysModel != null && SysModel.DataCaches != null)
{
SysModel.DataCaches.RemoveCache(this);
}
}
catch
{
// A partially disposed child must not stop form cleanup.
}
}
public override void SetFormSize()
{
this.WindowState = FormWindowState.Normal;
DataRow drSize = null;
this.mRowItem = MainImpl.GetSystemdllTab(this.SysModel.ModuleCode);
if (mRowItem == null)
{
throw new Exception("模块编号[" + this.SysModel.ModuleCode + "],配置错误!\r\n该模块信息未找到!");
}
this.ModuleModelObj = new BaseAuditModel(this.mRowItem);
drSize = BaseModuleImpl.GetControlParentSize(this.ModuleModelObj.FormKey);
if (drSize != null)
{
int height = Convert.ToInt32(drSize["height"]);
int width = Convert.ToInt32(drSize["width"]);
this.Height = height + 150;
this.splitContainer.SplitterPosition = height > 0 ? height : 0;
this.Width = (width > 0 ? width : this.Width) + 250;
}
this._mainPanelHeight = this.splitContainer.Panel1.Height;
this.Width = this.Width > Screen.PrimaryScreen.WorkingArea.Width ? Screen.PrimaryScreen.WorkingArea.Width : this.Width;
this.Height = this.Height > Screen.PrimaryScreen.WorkingArea.Height ? Screen.PrimaryScreen.WorkingArea.Height : this.Height;
this.Left = (Screen.PrimaryScreen.WorkingArea.Width - this.Width) / 2;
this.Top = (Screen.PrimaryScreen.WorkingArea.Height - this.Height) / 2;
if (this.ModuleModelObj.popupIsMax)
{
this.WindowState = FormWindowState.Maximized;
}
}
///
/// 说明:窗体加载时
/// 创建人:龚宇超
/// 创建日期:2017-12-14
/// 修改人:
/// 修改日期:
/// 修改备注:
/// 版本:1.0
///
/// The instance containing the event data.
protected override void OnLoad(EventArgs e)
{
this.Opacity = 0;
WaitForm.ShowForm();
try
{
//SysModel.Privilege = SysModel.ModuleId > 0 ? BaseImpl.GetUserPurviewsByMenuId(SysModel.ModuleId + "") + "" : BaseImpl.GetUserPurviewsByMenuCode(SysModel.ModuleCode) + "";
//if (!this.SysModel.HasPrivilege())
//{
// MessageUtil.Show(ResourceKeys.UnPurview);
// this.Close();
//}
string results = BaseImpl.GetResult("IF EXISTS(SELECT *FROM SYSOBJECTS WHERE NAME ='p_Get_NewDesignPlatform_BasicFileAudit' AND TYPE = 'P') begin select 1 end else Begin select 2 end").ToString();
if (results.Equals("1") && SystemInfo.Instance.isExecload && false)//GetTabDetails()方法中获取选项卡数据有2个循环,存储过程中无法按顺序获取数据,此模块不使用存储过程
{
System.Data.DataSet dsConfig = ReportImpl.GetNewDesignPlatformBasicFileAudit(SysModel, Lskj.Data.ResourceKeys.SettingTableName); //BillImpl.GetNewDesignPlatformDocumentsReview(SysModel, Lskj.Data.ResourceKeys.SettingTableName);
Lskj.Data.Caches.CacheSYSConfig.Instance().SetData(dsConfig);
ProcessExists = true;
}
this._isInitFinish = false;
this.splitMain.Visible = false;
this.InitializeSetting();
this.InitPushOpers();
this.InitializeControl();
this.InitSpliterPosition();
this.InitPrint();
this.GetPrintOtherParam();
if (this.ModuleModelObj.DisplayScroll)
{
this.pl_main.AutoScroll = true;
this.pl_main.VerticalScroll.Visible = true;
this.pl_main.HorizontalScroll.Visible = false;//设置禁止水平滚动条
}
if (SystemInfo.Instance.ReviewCommentsRequired)
{
label_auditPerson.ForeColor = string.IsNullOrEmpty(SystemInfo.Instance.ControlRequiredColor) ? Color.Blue : ColorTranslator.FromHtml(SystemInfo.Instance.ControlRequiredColor);
this.txt_remark.Text = "";
}
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message, ex.Message);
LogHelper.Instance.WriteError(ex, ResourceKeys.BaseModuleAudit);
this.Close();
}
finally
{
WaitForm.HideForm();
this._isInitFinish = true;
this.splitMain.Visible = true;
this.InitButLocation();
if (!SystemInfo.Instance.PageOpen) //以页签模式显示不用计算宽度
{
int leftMaxWidth = 0;
if (this.ControlObj != null) leftMaxWidth = this.ControlObj._models.Max(n => n.Location.X + n.Size.Width);
int bestWidth = leftMaxWidth + 45 + this.splitMain.Panel2.Width;
this.Width = bestWidth > Screen.PrimaryScreen.WorkingArea.Width ? Screen.PrimaryScreen.WorkingArea.Width : bestWidth;
}
}
}
///
/// 获取数据源缓存
///
///
public void GetDataCaches(Dictionary