/*********************** * 说明:单据审批弹出模块 * 创建人:龚宇超 * 创建日期:2018-01-02 * 修改人: * 修改日期: * 修改备注: * 版本: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.XtraEditors; using DevExpress.XtraTab; using DevExpress.XtraGrid.Columns; using DevExpress.XtraGrid.Views.Grid; using Lskj.Business; using DevExpress.XtraBars; namespace Lskj.PubAccraditation2 { /// /// 单据审批弹出模块 /// public partial class FrmAccraditation : BaseForm { public FrmAccraditation() { InitializeComponent(); } #region 公有变量 /// /// 单据结构明细 /// public AccraditationModel AuditModelObj; /// /// 单据模型 /// public BillAuditModel BillModelObj; /// /// 单据审批表模型 /// public BillAuditCommonModel BillAuditComObj; /// /// 单据入口参数模型 /// public DynamicPubAccraditionPopModel SysModel; /// /// 主表控件 /// public MyControl ControlObj; #endregion /// /// 调用动态链接库默认传递参数 /// public DynamicModel syModel { get; private set; } #region 私有变量 /// /// id(推送记录) /// private int _beforeId; /// /// 是否初始化完成 /// private bool _isInitFinish; /// /// 意见 /// private string _auditAdvice; /// /// 菜单模块名(推送记录) /// private string _beforeMenuName; /// /// 用户(推送记录) /// private string _beforeUsers; /// /// 单据类别值 /// private string _mainBillTypeValue; /// /// 单据信息 /// private DataRow _drBillInfoMsg; /// /// 明细数据 /// private DataTable _dtSourceData; /// /// 单据类别 /// private DataTable _dtBillType; /// /// 单据明细列表 /// private DataTable _dtBillAttachList; /// /// 单据billInfo /// private DataTable _dtBillInfoFiled; /// /// 分单数据 /// private DataTable _dtSpareSourceData; /// /// 审批流转模型 /// private FlowTypeStepModel _flowTypeStepModel; /// /// 单据水印 /// private WaterMark _waterMark; #endregion /// /// 说明:窗体加载时 /// 创建人:龚宇超 /// 创建日期:2018-01-02 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The instance containing the event data. protected override void OnLoad(EventArgs e) { WaitForm.ShowForm(); try { this._isInitFinish = false; this.splitMain.Visible = false; this.InitializeSetting(); this.InitializeControl(); this.InitializeSplitterPosition(); } catch (Exception ex) { LogHelper.Instance.WriteError(ex, ResourceKeys.BaseModule); LogUtil.WriteError("单据审批初始化出错!", ex); //MessageUtil.Show(ex); string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } finally { //默认一开始不加载明细数据 if (string.IsNullOrEmpty(this.BillModelObj.AuditLoadDetailFlag) || this.BillModelObj.AuditLoadDetailFlag == "0") { this.gridBillInfo.GridView.SelectionChanged += new DevExpress.Data.SelectionChangedEventHandler(gridBillInfo_SelectionChanged); } else { this.gridBillInfo.GridView.DoubleClick += new EventHandler(gridView_DoubleClick); } WaitForm.HideForm(); this._isInitFinish = true; this.splitMain.Visible = true; } } #region 初始化属性设置 /// /// 说明:初始化属性设置 /// 创建人:龚宇超 /// 创建日期:2018-01-03 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void InitializeSetting() { DataRow modelRow = BillImpl.GetBillInfo(this.SysModel.ModuleCode);//获取单个模块信息 if (modelRow == null) { throw new Exception("模块编号[" + this.SysModel.ModuleCode + "],配置错误!\r\n该模块信息未找到!"); } this.AuditModelObj = new AccraditationModel(BillAuditImpl.GetBillFlowData(this.SysModel.ModuleCode, this.SysModel.StepCode)); this.BillModelObj = new BillAuditModel(modelRow); this.BillAuditComObj = new BillAuditCommonModel(); this.BillModelObj.MasterPreFix = BaseImpl.GetColumnPrefix(this.BillModelObj.MasterTable); this.BillModelObj.DetailPreFix = BaseImpl.GetColumnPrefix(this.BillModelObj.DetailTable);// 明细表列前缀 this.BillModelObj.DetailOrderField = this.BillModelObj.DetailPreFix + "lsidx_id";// 单据来源id if (SystemInfo.Instance.IsNotBillDetailOrder)//禁用排序 this.BillModelObj.DetailOrderField = string.Empty; this.Text = this.SysModel.FormText + "—" + this.AuditModelObj.CurstepName + " " + string.Format(ResourceKeys.BillNoTitle, this.SysModel.BillDocumentId); this.btnAccradit.Text = this.AuditModelObj.StepApplyText; this.btnBack.Text = this.AuditModelObj.StepBackText; this.btnClose.Text = this.AuditModelObj.StepCloseText; this.btnSpare.Enabled = this.AuditModelObj.StepDivide > 0; this.label_auditPerson.Text = this.label_managerAudit.LabelText = this.AuditModelObj.CurstepName; this.label_managerAudit.EditText = this.SysModel.UserName; this.btnAttach.Text += "(" + AttachImpl.GetFileCount(this.BillModelObj.DirId + "", this.SysModel.BillDocumentId) + ")"; //记录推送用户 this.GetPushOpers(); this.gridFlow.GridView.RowStyle += new RowStyleEventHandler(gridFlowInfo_RowStyle); this.gridBillInfo.gridControl.Paint += new PaintEventHandler(gridBillInfo_Panint); this.gridBillInfo.GridView.ShowingEditor += new CancelEventHandler(OnGridViewShowingEditor); this._dtBillInfoFiled = BillAuditImpl.GetBillInfoData(this.SysModel.ModuleCode); } #endregion #region 表格是否可以编辑设置 /// /// 说明:表格编辑时,判断是否是否编辑 /// 创建人:王一帆 /// 创建日期:2020-03-27 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The source of the event. /// The instance containing the event data. protected void OnGridViewShowingEditor(object sender, CancelEventArgs e) { try { DataRow rowItem = this.gridBillInfo.GridView.GetDataRow(this.gridBillInfo.GridView.FocusedRowHandle); if (!string.IsNullOrWhiteSpace(BillModelObj.UpdateDetailCond)) { string UpdateCond = this.ControlObj.ReplaceParentControlValue(BillModelObj.UpdateDetailCond); UpdateCond = ReplaceHelper.ReplaceRowParam(rowItem, UpdateCond); if (!ReplaceHelper.EvalCond(UpdateCond)) { e.Cancel = true;//该行不可编辑 } } } catch (Exception ex) { LogHelper.Instance.WriteError(ex); string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } #endregion #region 流转表格设置行颜色 /// /// 说明:流转表格行颜色区分 /// 创建人:龚宇超 /// 创建日期:2018-01-03 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void gridFlowInfo_RowStyle(object sender, RowStyleEventArgs e) { try { if (e.RowHandle > 0) { DataRow dr = this.gridFlow.GridView.GetDataRow(e.RowHandle); if (dr["sh"].ToString() == "审") e.Appearance.ForeColor = Color.Blue; } } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } #endregion #region 初始化控件 /// /// 说明:初始化控件 /// 创建人:龚宇超 /// 创建日期:2018-01-03 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void InitializeControl() { this.gridFlow.SetReadOnlyColumns(BaseAuditImpl.GetFlowRecordColumn(), GridCustomColumnStruct.AuditPopupAttachGridView + this.BillModelObj.FormKey); this.gridFlow.SetGridViewDataSource(BaseAuditImpl.GetFlowRecordData(this.BillAuditComObj.SystemTabFlowStep, this.SysModel.BillDocumentId, this.SysModel.ModuleCode)); this.SetFormSize(); this.BindTab(); this.BindBill(); this.LoadRemindRecord(); this.LoadSignRecord(); this.InitCommonMenu(); this.InitOtherParms(); } #endregion #region 初始化常用菜单 /// /// 说明:设置初始化常用菜单 /// 创建人:龚宇超 /// 创建日期:2018-01-08 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void InitCommonMenu() { DataTable tableCommon = BaseModuleImpl.GetBaseGridRightMenus(this.SysModel.ModuleCode, ModuleType.BillDetail); if (tableCommon == null && tableCommon.Rows.Count <= 0) { dpb_Tools.Enabled = false; return; } foreach (DataRow item in tableCommon.Rows) { BarButtonItem itemCommon = new BarButtonItem(); itemCommon.Caption = item["menuname"] + ""; itemCommon.Tag = item; itemCommon.ItemClick += new ItemClickEventHandler(itemCommon_ItemClick); this.pMenu.AddItem(itemCommon); } } #endregion #region 常用工具 /// /// 说明:常用工具点击 /// 创建人:龚宇超 /// 创建日期:2017-01-08 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The source of the event. /// The instance containing the event data. protected void itemCommon_ItemClick(object sender, ItemClickEventArgs e) { try { DataRow rowItem = e.Item.Tag as DataRow; CommonMenu menu = new CommonMenu(this.SysModel, this.ControlObj); menu.Apply(rowItem); } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } #endregion #region 设置窗体大小 /// /// 说明:设置窗体大小 /// 创建人:龚宇超 /// 创建日期:2018-01-03 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void SetFormSize() { int panelWidth = this.BillModelObj.PanelWidth + this.gridFlow.Width; this.Width = panelWidth < Screen.PrimaryScreen.WorkingArea.Width ? panelWidth : Screen.PrimaryScreen.WorkingArea.Width; this.Left = (Screen.PrimaryScreen.WorkingArea.Width / 2) - (this.Width / 2); this.Top = (Screen.PrimaryScreen.WorkingArea.Height / 2) - (this.Height / 2); } #endregion #region 绑定选项卡 /// /// 说明:绑定选项卡 /// 创建人:龚宇超 /// 创建日期:2018-01-03 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void BindTab() { this.tab_basicInfo.Model = this.SysModel; this.tab_basicInfo.InitTabPages(GetTabDetails()); this.splitLeft.PanelVisibility = tab_basicInfo.TabControlObj.TabPages.Count == 0 ? SplitPanelVisibility.Panel1 : SplitPanelVisibility.Both; this.tab_basicInfo.OnRightCallback += new EventHandler(AuditTab_OnRightCallback); } /// /// 说明:获取选项卡数据 /// 创建人:龚宇超 /// 创建日期:2018-01-15 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// List<GridDetailModel>. private List GetTabDetails() { List details = new List(); DataTable table = BaseAuditImpl.GetAttachTabs(this.SysModel.ModuleCode, this.SysModel.StepCode); foreach (DataRow item in table.Rows) { DataTable dtGridColumns = BaseAuditImpl.GetBottomBasicInformation(item["formKey"] + ""); details.Add(new GridDetailModel(item, dtGridColumns, GridCustomColumnStruct.AuditPopupDetailGridView + item["formKey"] + "")); } return details; } #endregion #region 绑定审批单据 /// /// 说明:单据管理 /// 创建人:龚宇超 /// 创建日期:2018-01-04 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void BindBill() { // 初始化表头 this.ControlObj = new MyControl(); this.ControlObj.InitControl(BaseModuleImpl.GetControlLocation(this.BillModelObj.FormKey, this.SysModel.ModuleCode), this.pl_left_top); this.pl_left_top.Height = this.BillModelObj.ParentHeight - 36 > this.pl_left_top.Height ? this.pl_left_top.Height : this.BillModelObj.ParentHeight; //初始明细数据 this.gridBillInfo.Model = this.SysModel; this.gridBillInfo.SetEditColumns(BillImpl.GetDetailColumns(this.SysModel.ModuleCode), GridCustomColumnStruct.AuditPopupDetailGridView + this.BillModelObj.FormKey); this.gridBillInfo.ParentControl = this.ControlObj; this._dtSourceData = BillImpl.GetDataTableResult(ReplaceHelper.ReplaceParamToValue(this.BillModelObj.DetailSql, this.SysModel.BillDocumentId)); this._dtSourceData.OrderBy(this.BillModelObj.DetailOrderField); this.gridBillInfo.SetGridViewDataSource(_dtSourceData); if (_dtSourceData != null) this._dtSpareSourceData = this._dtSourceData.Clone(); this.gridBillInfo.SetGridRightMenus(BaseModuleImpl.GetBaseGridRightMenus(this.AuditModelObj.BillGridMenuFlag + this.SysModel.ModuleCode, ModuleType.BillAuditDetail), this.SysModel, OnGridViewRightCallBack); this.gridBillInfo.SetGridRowColors(BaseModuleImpl.GetBaseGridRowColors("BILLDETAIL_" + this.BillModelObj.FormKey)); //修改字段 if (!string.IsNullOrEmpty(this.AuditModelObj.DetailModifyFields)) { gridBillInfo.GridView.OptionsBehavior.Editable = true; this.AuditModelObj.DetailModifyFields = this.AuditModelObj.DetailModifyFields + ","; GridColumnCollection gc = this.gridBillInfo.GridView.Columns; foreach (GridColumn item in gc) { item.OptionsColumn.AllowEdit = this.AuditModelObj.DetailModifyFields.IndexOf(item.FieldName + ",", StringComparison.OrdinalIgnoreCase) != -1; item.OptionsColumn.ReadOnly = !item.OptionsColumn.AllowEdit; } } this.SetBillControl(this.AuditModelObj.BillModifyFields); this.InitPrint(); } #endregion #region 右键菜单执行后刷新 /// /// 说明:右键菜单执行后刷新单据数据 /// 创建人:龚宇超 /// 创建日期:2018-03-19 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The sender. /// The instance containing the event data. protected void OnGridViewRightCallBack(object sender, EventArgs e) { try { // 刷新主表 this._drBillInfoMsg = BaseAuditImpl.GetCurrentFlowRowData(this.BillModelObj.MasterTable, this.BillModelObj.PrimaryKey, this.SysModel.BillDocumentId); this.ControlObj.SetAllControlValue(this._drBillInfoMsg); // 刷新明细表 this._dtSourceData = BillImpl.GetDataTableResult(ReplaceHelper.ReplaceParamToValue(this.BillModelObj.DetailSql, this.SysModel.BillDocumentId)); this._dtSourceData.OrderBy(this.BillModelObj.DetailOrderField); this.gridBillInfo.SetGridViewDataSource(_dtSourceData); } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } /// /// 说明:单据右键菜单执行后刷新Tab标签数据 /// 创建人:龚宇超 /// 创建日期:2018-01-15 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The source of the event. /// The instance containing the event data. protected void AuditTab_OnRightCallback(object sender, EventArgs e) { try { GridDetailModel model = this.tab_basicInfo.GetFocusTabPageGridDetailModel(); string sqlValue = ReplaceHelper.ReplaceRowParam(this.gridBillInfo.GridView.GetFocusedDataRow(), model.DetailSql); this.tab_basicInfo.SetGridDataSource(MainImpl.GetDataTableResult(sqlValue)); } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } #endregion #region 初始化打印 /// /// 说明:创建打印 /// 创建人:龚宇超 /// 创建日期:2018-01-04 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void InitPrint() { string[] files = this.BillModelObj.PrintFile.Split('|'); for (int i = 0; i < files.Length; i++) { string fileName = files[i]; if (!string.IsNullOrWhiteSpace(fileName)) { BarButtonItem itemPrint = new BarButtonItem(); itemPrint.Caption = fileName.Replace(".rmf", ""); itemPrint.Tag = files[i]; itemPrint.ItemClick += new ItemClickEventHandler(itemPrint_ItemClick); pMprint.AddItem(itemPrint); } } } #endregion #region 打印 /// /// 说明:打印事件 /// 创建人:龚宇超 /// 创建日期:2018-01-05 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The source of the event. /// The instance containing the event data. protected void itemPrint_ItemClick(object sender, ItemClickEventArgs e) { try { string billNo = txt_billDocumentId.EditText; string printPath = PubUtil.PrintFileAbsolutelyPath; if (!string.IsNullOrEmpty(billNo)) { DataRow masterRow = BillImpl.GetDataRowResult(ReplaceHelper.ReplaceParamToValue(this.BillModelObj.MasterSql, billNo)); if (masterRow == null) { MessageUtil.Show(ResourceKeys.DataNotFount); return; } if (!ReplaceHelper.ReplaceRowParamCond(masterRow, this.BillModelObj.PrintCond)) { MessageUtil.Show(ResourceKeys.DisSatisfyPrintCond); return; } string tmpSql = ReplaceHelper.ReplaceRowParam(masterRow, this.BillModelObj.PrintSql); string tmpSql1 = ReplaceHelper.ReplaceRowParam(masterRow, this.BillModelObj.PrintSql1); string tmpSql2 = ReplaceHelper.ReplaceRowParam(masterRow, this.BillModelObj.PrintSql2); DelphiHelper.LoadDelphiDll(printPath, printPath, e.Item.Tag + "", tmpSql, tmpSql1, this.BillModelObj.PrintFileType, tmpSql2); } } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } #endregion #region 绘制水印 /// /// 说明:绘制水印 /// 创建人:龚宇超 /// 创建日期:2018-01-05 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void gridBillInfo_Panint(object sender, PaintEventArgs e) { try { if (this.SysModel.StepOver != "1") return; GraphicsText graphicsText = new GraphicsText(); graphicsText.Graphics = e.Graphics; StringFormat format = new StringFormat(); format.Alignment = StringAlignment.Center; format.LineAlignment = StringAlignment.Center; Pen pen = new Pen(Color.Red, 2f); SolidBrush brush = new SolidBrush(Color.Red); if (!string.IsNullOrEmpty(this._waterMark.Text)) { int x = (this.gridBillInfo.Width - 90) / 2; int y = (this.gridBillInfo.Height - 32) / 2; graphicsText.DrawString(this._waterMark.Text, new Font("宋体", 20, FontStyle.Bold), brush, new PointF(x, y), format, -20f); e.Graphics.TranslateTransform(x, y); e.Graphics.RotateTransform(-20f); e.Graphics.DrawRectangle(pen, new Rectangle(-45, -19, 90, 32)); } e.Graphics.ResetTransform(); if (!string.IsNullOrEmpty(this._waterMark.Print)) { int x1 = (this.gridBillInfo.Width - 120) / 2; int y1 = (this.gridBillInfo.Height - 90) / 2 + 100; graphicsText.DrawString(this._waterMark.Print, new Font("宋体", 18, FontStyle.Bold), brush, new PointF(x1, y1), format, -20f); e.Graphics.TranslateTransform(x1, y1); e.Graphics.RotateTransform(-20f); e.Graphics.DrawRectangle(pen, new Rectangle(-60, -19, 120, 32)); } e.Graphics.ResetTransform(); if (!string.IsNullOrEmpty(this._waterMark.Collect)) { int x2 = (this.gridBillInfo.Width - 90) / 2; int y2 = (this.gridBillInfo.Height - 90) / 2 - 40; graphicsText.DrawString(this._waterMark.Collect, new Font("宋体", 20, FontStyle.Bold), brush, new PointF(x2, y2), format, -20f); e.Graphics.TranslateTransform(x2, y2); e.Graphics.RotateTransform(-20f); e.Graphics.DrawRectangle(pen, new Rectangle(-45, -19, 90, 32)); } } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } #endregion #region 审批单据管理 /// /// 说明:单据管理 /// 创建人:龚宇超 /// 创建日期:2018-01-04 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void SetBillControl(string billFields) { this._drBillInfoMsg = BaseAuditImpl.GetCurrentFlowRowData(this.BillModelObj.MasterTable, this.BillModelObj.PrimaryKey, this.SysModel.BillDocumentId); if (this._drBillInfoMsg == null) { MessageUtil.Show(ResourceKeys.NotFindAuditRecord); return; } this._mainBillTypeValue = this._drBillInfoMsg[this.BillModelObj.BillType] + ""; if (string.IsNullOrEmpty(this._mainBillTypeValue) || this._mainBillTypeValue == "0") { MessageUtil.Show(ResourceKeys.NotSetFlowType); return; } this._waterMark = new WaterMark(this.BillModelObj.MasterPreFix, this._drBillInfoMsg); this.SetButtonsStatus(); this.ControlObj.CanExecControl = false; this.ControlObj.SetAllControlValue(this._drBillInfoMsg); this.ControlObj.CanExecControl = true; foreach (DataRow dr in this._dtBillInfoFiled.Rows) { string fieldName = dr["fieldName"] + ""; this.ControlObj.SetReadOnlyControl(fieldName, !billFields.Contains(fieldName), false); } } #endregion #region 设置按钮状态 /// /// 说明:设置按钮状态 /// 创建人:龚宇超 /// 创建日期:2018-01-04 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void SetButtonsStatus() { DataRow dr = BillAuditImpl.GetBillFlowStep(this.SysModel.ModuleCode, this._mainBillTypeValue, this.SysModel.StepCode); if (dr == null) { MessageUtil.Show(ResourceKeys.FlowStepConfigError); return; } this._flowTypeStepModel = new FlowTypeStepModel(dr); string operUser = this._flowTypeStepModel.OperUser; DataRow drOper = BillAuditImpl.GetOperators(this.SysModel.ModuleCode, this.SysModel.BillDocumentId, this.SysModel.StepCode); operUser = drOper != null ? drOper["operators"] + "" : operUser; operUser.Contains(this.SysModel.UserName); this.btnSave.Enabled = this.btnClose.Enabled = this.pl_right_bottom.Enabled = this.btnBack.Enabled = this.btnAccradit.Enabled = operUser.Contains(this.SysModel.UserName); //代理权限 DataRow agency = BillAuditImpl.GetAgencyAuthority(this.SysModel.ModuleCode); if (agency != null) { string sourceuser = agency["sourceuser"] + ""; foreach (string item in sourceuser.Split(',')) { if (operUser.Contains(item)) { this.btnSave.Enabled = this.btnClose.Enabled = this.btnBack.Enabled = this.btnAccradit.Enabled = this.pl_right_bottom.Enabled = true; break; } } } this.btnClose.Visible = this._flowTypeStepModel.StepClosed == 1; this.btnAccradit.Visible = BillAuditImpl.GetBillComfirm(this.SysModel.ConfirmId) < 0; //终审 if (this.SysModel.StepOver == "1") { this.btnSave.Visible = this.btnClose.Visible = this.btnBack.Visible = this.txtRemark.Visible = this.pl_right_bottom.Visible = this.label_auditPerson.Visible = false; this.p_right_bottom.Height = 60; this.btnPrint.Parent = this.p_right_bottom; this.btnPrint.Visible = true; this.btnPrint.Left = 15; this.btnPrint.Top = 20; this.btnPrint.Height = 30; this.btnPrint.Width = this.p_right_bottom.Width - 40; this.btnAccradit.Text = "确认(&Y)"; this.label_auditPerson.Text = "确认意见"; this.label_date.EditText = "会签人"; this.txtRemark.Text = "确认"; } } #endregion #region 加载提醒记录 /// /// 说明:加载提醒记录 /// 创建人:龚宇超 /// 创建日期:2018-01-08 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void LoadRemindRecord() { if (!string.IsNullOrEmpty(this._flowTypeStepModel.RemindSelect)) { DataTable dt = BaseAuditImpl.GetRemindinRecord(this.BillAuditComObj.FlowStepTable, this.BillAuditComObj.ComfrimTable, this.SysModel.BillDocumentId, this.SysModel.ModuleCode); if (dt != null && dt.Rows.Count > 0) { this.gridRemind.SetReadOnlyColumns(BaseAuditImpl.GetRemindColumn()); this.gridRemind.SetGridViewDataSource(dt); this.tabpage_remind.Text = this.tabpage_remind.Text + "(" + dt.Rows.Count + ")"; } else { this.TabControl.TabPages.Remove(this.tabpage_remind); } } } #endregion #region 加载会签记录 /// /// 说明:加载会签记录 /// 创建人:龚宇超 /// 创建日期:2018-01-08 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void LoadSignRecord() { DataTable dt = BaseAuditImpl.GetSignRecord(this.BillAuditComObj.ComfrimTable, this.SysModel.BillDocumentId, this.SysModel.ModuleCode); if (dt != null && dt.Rows.Count > 0) { this.gridSign.SetReadOnlyColumns(BaseAuditImpl.GetSignRecordCoulumn()); this.gridSign.SetGridViewDataSource(dt); this.tabpage_sign.Text = this.tabpage_sign.Text + "(" + dt.Rows.Count + ")"; } else { this.TabControl.TabPages.Remove(this.tabpage_sign); } } #endregion #region 加载其他属性 /// /// 说明:加载其他属性 /// 创建人:龚宇超 /// 创建日期:2018-01-08 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void InitOtherParms() { this.CheckSuggestion.ValueField = this.CheckSuggestion.TextField = "Mix_apellation"; this.CheckSuggestion.SetDataSource(BaseImpl.GetDataTableResult(this.AuditModelObj.SuggestionSql)); this.CheckSuggestion.TextEdit.SelectedIndex = 0; this.CheckSuggestion.TextEdit.SelectedValueChanged += new EventHandler(CheckSuggestion_Click); this.txt_billDocumentId.EditText = this.SysModel.BillDocumentId; this.label_date.EditText = DateTime.Now.ToString(); if (!string.IsNullOrWhiteSpace(this.AuditModelObj.StepApplyContent)) this.txtRemark.Text = this.AuditModelObj.StepApplyContent; } #endregion #region 常用意见 /// /// 说明:常用意见下拉框事件 /// 创建人:龚宇超 /// 创建日期:2018-01-08 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The source of the event. /// The instance containing the event data. protected void CheckSuggestion_Click(object sender, EventArgs e) { try { this.txtRemark.Text = this.CheckSuggestion.EditText; } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } #endregion #region 表格双击事件 /// /// 说明:双击表格 /// 创建人:龚宇超 /// 创建日期:2018-01-08 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void gridView_DoubleClick(object sender, EventArgs e) { try { GridViewClick(); } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } #endregion #region 表格选中双击共用函数 /// /// 说明:gridBillInfo点击事件共用函数 /// 创建人:龚宇超 /// 创建日期:2018-01-08 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void GridViewClick() { foreach (XtraTabPage tabPage in this.tab_basicInfo.TabControlObj.TabPages) { GridDetailModel model = this.tab_basicInfo.GetGridDetailModel(tabPage); string sqlValue = ReplaceHelper.ReplaceRowParam(this.gridBillInfo.GridView.GetFocusedDataRow(), model.DetailSql); this.tab_basicInfo.SetGridDataSource(tabPage, MainImpl.GetDataTableResult(sqlValue)); } } #endregion #region 表格选中改变事件 /// /// 说明:gridBillInfo选中事件 /// 创建人:龚宇超 /// 创建日期:2018-01-08 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void gridBillInfo_SelectionChanged(object sender, DevExpress.Data.SelectionChangedEventArgs e) { try { GridViewClick(); } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } #endregion #region 关闭 /// /// 说明:关闭 /// 创建人:龚宇超 /// 创建日期:2018-01-08 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The source of the event. /// The instance containing the event data. private void btnClose_Click(object sender, EventArgs e) { try { if (!string.IsNullOrEmpty(this.AuditModelObj.StepCloseTip) && MessageUtil.Show(this.AuditModelObj.StepCloseTip, MessageBoxButtons.YesNo) == DialogResult.Yes) { this._auditAdvice = txtRemark.Text; string nextSelectStepCode = string.Empty; string nextSelectStepOper = string.Empty; string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, this.SysModel, this.SysModel.StepCode, this.SysModel.BillDocumentId, "", "p_BillAudit", "Q", "0", this.txtRemark.Text, "", "", true, -1); if ("1".Equals(result)) { MessageUtil.Show(ResourceKeys.CloseSuccess); this.DialogResult = DialogResult.OK; } else { MessageUtil.Show(ResourceKeys.CloseFail + "\r\n" + result); } } } catch (Exception ex) { LogUtil.WriteError("关闭出错!", ex); //MessageUtil.Show("关闭出错!" + ex); string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } #endregion #region 返回审核 /// /// 说明:返回审核 /// 创建人:龚宇超 /// 创建日期:2018-01-09 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The row. /// System.Int32. private int ExecuteBackSelect(DataRow row) { if (row == null) { MessageUtil.Show(ResourceKeys.NoFindAntiauditBill); return -9; } if (this.BillModelObj.BackSelected == "0") return -1; if (this.SysModel.StepCode == "100") return 0; FrmBackSelect frmBackSel = new FrmBackSelect(); frmBackSel.SysModel = this.SysModel; frmBackSel.BillModelObj = this.BillModelObj; frmBackSel.InitControl(); if (frmBackSel.ShowDialog() != DialogResult.OK) return -9; this._auditAdvice = frmBackSel.ComfirmMsg; return frmBackSel.SelectStepCode; } #endregion #region 审核事件 /// /// 说明:审核事件 /// 创建人:龚宇超 /// 创建日期:2018-01-09 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The source of the event. /// The instance containing the event data. private void btnAccradit_Click(object sender, EventArgs e) { try { WaitForm.ShowForm(ResourceKeys.Handing); if (this.SysModel.StepOver == "1") { if (BillAuditImpl.ConfirmAudit(this.SysModel.UserId, this.txtRemark.Text, this.SysModel.ModuleCode, this.SysModel.BillDocumentId) > 0) { MessageUtil.Show(ResourceKeys.ConfirmSuccess); this.Close(); } else { MessageUtil.Show(ResourceKeys.ConfirmFail); } } else { bool isAudit = true; string confirmOpers = string.Empty, remindOpers = string.Empty; string nextSelectStepCode = string.Empty; string nextSelectStepOper = string.Empty; if (this._flowTypeStepModel.RemindSelect == "1") { FrmRemindSelectForm formRemind = new FrmRemindSelectForm(); formRemind.FieldValue = this.SysModel.BillDocumentId; formRemind.MenuCode = this.SysModel.ModuleCode; isAudit = formRemind.ShowDialog() == DialogResult.Yes; confirmOpers = formRemind.ConfirmOpers; remindOpers = formRemind.RemindOpers; } if (isAudit) { //确认是否审批 if (MessageUtil.Show(string.Format(ResourceKeys.ConfirmIsAudit), MessageBoxButtons.YesNo) == DialogResult.Yes) { if (!SaveBillData(0, false)) return; string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, this.SysModel, this.SysModel.StepCode, this.SysModel.BillDocumentId, "", this.BillAuditComObj.ProcedureName, "F", this._flowTypeStepModel.RemindSelect, this.txtRemark.Text, remindOpers, confirmOpers); WaitForm.HideForm(); if ("1".Equals(result)) { MessageUtil.Show(ResourceKeys.AuditSuccess); PushHelper push = new PushHelper(this.SysModel.BillDocumentId, this.SysModel.StepCode, this.SysModel.ModuleCode, this._beforeUsers, this._beforeMenuName, this._beforeId); push.Push_Bill_Oper_Message(); this.DialogResult = DialogResult.OK; } else { MessageUtil.Show(ResourceKeys.AuditFail + "\r\n" + result); } } } } } catch (Exception ex) { LogUtil.WriteError("审核事件出错!", ex); //MessageUtil.Show("审核事件出错!" + ex); string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } finally { WaitForm.HideForm(); } } #endregion #region 分单 /// /// 说明:分单 /// 创建人:龚宇超 /// 创建日期:2018-01-09 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The source of the event. /// The instance containing the event data. private void btnSpare_Click(object sender, EventArgs e) { try { FrmSpare spare = new FrmSpare(); spare.SysModel = this.SysModel; spare.BillModel = this.BillModelObj; spare.DtSource = this._dtSourceData; spare.DetailSql = this.BillModelObj.DetailSql; spare.DtNewSource = this._dtSpareSourceData; DialogResult result = spare.ShowDialog(); this._dtSpareSourceData = spare.DtNewSource; if (result == DialogResult.OK) checkBillSplite(); } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } #endregion #region 检查分单 /// /// 说明:检查分单 /// 创建人:龚宇超 /// 创建日期:2018-01-09 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// System.Boolean. private bool checkBillSplite() { bool createResult = false; try { if (this._dtSourceData.Rows.Count > 0) { createSourceBillId(); //复制单据数据 createResult = createBill(); if (createResult) { this.gridBillInfo.SetGridViewDataSource(_dtSourceData); } } } catch (Exception ex) { //MessageUtil.Show(ex); string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } return createResult; } #endregion #region 单据来源 /// /// 说明:单据来源 /// 创建人:龚宇超 /// 创建日期:2018-01-09 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void createSourceBillId() { try { BillAuditImpl.CreateSourceBillId(this.BillModelObj.MasterTable); } catch (Exception ex) { //MessageUtil.Show(ex); string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } #endregion #region 导出单据明细 private void btnExport_Click(object sender, EventArgs e) { try { this.gridBillInfo.GridControl.ToExcel(this.SysModel.FormText); } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } #endregion #region 分单创建单据 /// /// 说明:分单创建单据 /// 创建人:龚宇超 /// 创建日期:2018-01-10 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private bool createBill() { string billNo = BillImpl.GetBillNo(this.BillModelObj.BillSeq); //构造表头 string masterSql = this.GetBillHearder(billNo); //构造明细 string detailSql = this.GetBillDetail(billNo); //分单处理 string msg = string.Empty; int returnValue = BillAuditImpl.SpliteBill(out msg, masterSql, detailSql, billNo, this.SysModel.ModuleCode, this.SysModel.BillDocumentId); if (returnValue == 1) { MessageUtil.Show(ResourceKeys.SpliterBillSuccess); this._dtSourceData.Clear(); return true; } else if (returnValue != 9) { MessageUtil.Show(string.Format(ResourceKeys.SpliterBillFail, returnValue, msg)); } return false; } #endregion #region 构造表头 /// /// 说明:构造表头 /// 创建人:龚宇超 /// 创建日期:2018-01-09 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private string GetBillHearder(string billNo) { StringBuilder fieldBuilder = new StringBuilder(); StringBuilder valueBuilder = new StringBuilder(); foreach (ControlModel model in this.ControlObj.ControlModels) { if (!model.IsSave || model.FieldName.Equals(BillModelObj.PrimaryKey, StringComparison.OrdinalIgnoreCase) || model.FieldType == ControlType.LabPic || model.FieldType == ControlType.LabPicEx) continue; string fieldValue = this.ControlObj.GetControlValue(model); fieldBuilder.Append(model.FieldName + ","); valueBuilder.AppendFormat("'{0}',", fieldValue); } fieldBuilder.Append(this.BillModelObj.PrimaryKey + ","); valueBuilder.AppendFormat("'{0}',", billNo); return string.Format(@"insert into {0} ({1})values({2})", this.BillModelObj.MasterTable, fieldBuilder.ToString().TrimEnd(','), valueBuilder.ToString().TrimEnd(',')); } #endregion #region 构造明细 /// /// 说明:构造明细 /// 创建人:龚宇超 /// 创建日期:2018-01-09 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// 单据编号. private string GetBillDetail(string billNo) { string ids = string.Empty; string detailPrefix = BaseImpl.GetColumnPrefix(this.BillModelObj.DetailTable); string sourceId = detailPrefix + "id"; foreach (DataRow item in _dtSpareSourceData.Rows) { ids += item[sourceId] + ","; } return string.Format("update {0} set {1}Billdocument_id='{2}' where {4} in ({3})", this.BillModelObj.DetailTable, detailPrefix, billNo, ids.TrimEnd(','), sourceId); } #endregion #region 返退 /// /// 说明:返回审核 /// 创建人:龚宇超 /// 创建日期:2018-01-09 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The source of the event. /// The instance containing the event data. private void btnReturn_Click(object sender, EventArgs e) { try { this._auditAdvice = txtRemark.Text; int ret = ExecuteBackSelect(this._drBillInfoMsg); if (ret == -9) return; string nextSelectStepCode = string.Empty; string nextSelectStepOper = string.Empty; if (MessageUtil.Show(ResourceKeys.ConfimAuditFailAndReturnBill, MessageBoxButtons.YesNo) == DialogResult.Yes) { string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, this.SysModel, this.SysModel.StepCode, this.SysModel.BillDocumentId, "", this.BillAuditComObj.ProcedureName, "R", "0", this._auditAdvice, "", "", true, ret); if (result == "1") { MessageUtil.Show(ResourceKeys.ForcedSuccess); PushHelper push = new PushHelper(this.SysModel.BillDocumentId, this.SysModel.StepCode, this.SysModel.ModuleCode, this._beforeUsers, this._beforeMenuName, this._beforeId); push.Push_Bill_Oper_Message(); this.DialogResult = DialogResult.OK; } else { MessageUtil.Show(string.Format(ResourceKeys.ForcedFail, result)); } } } catch (Exception ex) { LogUtil.WriteError("返回审核出错!", ex); //MessageUtil.Show("返回审核出错!" + ex); string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } #endregion #region 记录本次推送人员 /// /// 说明:记录本次推送人员 /// 创建人:龚宇超 /// 创建日期:2018-01-09 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void GetPushOpers() { DataRow beforeOpers = BillAuditImpl.GetPushedOpers(this.SysModel.BillDocumentId, this.SysModel.StepCode); if (beforeOpers != null) { //记录本次操作信息 this._beforeMenuName = beforeOpers["menuname"] + ""; this._beforeUsers = beforeOpers["operators"] + ""; this._beforeId = Convert.ToInt32(beforeOpers["id"]); } } #endregion #region 保存单据 /// /// 说明:保存单据 /// 创建人:龚宇超 /// 创建日期:2018-01-10 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void btnSave_Click(object sender, EventArgs e) { try { SaveBillData(); } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } /// /// 说明:保存单据 /// 创建人:龚宇超 /// 创建日期:2018-01-10 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// 保存确认标记 private bool SaveBillData(int confirmFlag = 0, bool showMsg = true) { bool save = false; try { string guid = Guid.NewGuid().ToString(); string masterSql = GetUpdateBillHeader(); string detailSql = GetDetailRecord(guid); if (string.IsNullOrEmpty(detailSql) && !this.BillModelObj.SaveNullDetail) { MessageUtil.Show(ResourceKeys.BillDetailIsNotNull); return false; } string tipMsg = string.Empty; if (!this.ControlObj.VerifyNull()) return false; int result = BillImpl.BillSave(masterSql, detailSql, this.BillModelObj.DetailTable, ref this.SysModel.BillDocumentId, guid, this.BillModelObj.BillSeq, 2, confirmFlag, out tipMsg, 1, this.BillModelObj.NewVer); switch (result) { case 1: if (showMsg) MessageUtil.Show(ResourceKeys.SaveSuccess); save = true; break; case 9: if (MessageUtil.Show(tipMsg, MessageBoxButtons.YesNo) == DialogResult.Yes) save = SaveBillData(1, showMsg); break; default: MessageUtil.Show(string.Format(ResourceKeys.OperateFail, result, tipMsg)); break; } } catch (Exception ex) { MessageUtil.Show(ex.Message); } return save; } #endregion #region 修改表头 /// /// 说明:获取修改表头 /// 创建人:龚宇超 /// 创建日期:2018-01-10 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// System.String. private string GetUpdateBillHeader() { StringBuilder updateBuilder = new StringBuilder(); foreach (ControlModel model in this.ControlObj.ControlModels) { if (!model.IsSave || model.FieldType == ControlType.LabPic || model.FieldType == ControlType.LabPicEx) continue; if (this.ControlObj.FindControl(model) != null) { string fieldValue = this.ControlObj.GetControlValue(model); if (fieldValue == "****") continue; updateBuilder.AppendFormat("{0}=N'{1}',", model.FieldName, fieldValue); } } return string.Format("update {0} set {1} where {2}='{3}'", this.BillModelObj.MasterTable, updateBuilder.ToString().TrimEnd(','), BillModelObj.PrimaryKey, this.SysModel.BillDocumentId); } #endregion #region 获取明细 /// /// 说明:获取明细 /// 创建人:龚宇超 /// 创建日期:2017-01-10 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// System.String. private string GetDetailRecord(string guid) { // 构造明细 StringBuilder detailBuilder = new StringBuilder(); DataTable detailTable = this.gridBillInfo.GridControl.DataSourceTable().TrimDeleteRows(); if (detailTable.Rows.Count > 0) { foreach (DataRow dataRow in detailTable.Rows) { StringBuilder fields = new StringBuilder(); StringBuilder values = new StringBuilder(); string detailSql = @"insert into " + BillModelObj.DetailTable + "_temp" + "({0}) values({1})"; fields.Append("sysstr,"); values.Append("'" + guid + "',"); foreach (DataColumn item in detailTable.Columns) { fields.Append(item.ColumnName + ","); string fieldValue = dataRow[item] + ""; if (!string.IsNullOrWhiteSpace(fieldValue)) { values.Append(item.DataType == typeof(DateTime) ? "N'" + Convert.ToDateTime(fieldValue).ToString("yyyy-MM-dd HH:mm:ss") + "'," : "N'" + fieldValue + "',"); } else { if (item.DataType == typeof(Decimal) || item.DataType == typeof(Double) || item.DataType == typeof(Int16) || item.DataType == typeof(Int32) || item.DataType == typeof(Int64)) values.Append("0,"); else if (item.DataType == typeof(DateTime)) values.Append("NULL,"); else values.Append("'',"); } } detailBuilder.AppendFormat(detailSql, fields.ToString().Trim(','), values.ToString().Trim(',')); } } return detailBuilder.ToString(); } #endregion #region 附件管理 /// /// 说明:附件管理 /// 创建人:龚宇超 /// 创建日期:2017-01-25 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// System.String. private void btnAttach_Click(object sender, EventArgs e) { try { if (string.IsNullOrWhiteSpace(this.SysModel.BillDocumentId)) { MessageUtil.Show(ResourceKeys.NotFoundBillNo); } else { string url = string.Format("pages/PhotoView.html?left=1&username={0}&password={1}&id={2}&isview={3}&dllcoid=", ERPInfo.Instance.UserName, ERPInfo.Instance.Password, this.SysModel.BillDocumentId, this.btnAccradit.Enabled ? "0" : "1"); // 固定传入参数(窗口标题、操作员ID、操作员名称、权限、模版编号) string[] defaultArgs = string.Format(ModuleArgs.DefaultArgs, this.SysModel.FormText, this.SysModel.UserId, this.SysModel.UserName, this.SysModel.Privilege, this.SysModel.ModuleCode).Split('~'); string[] menuArgs = SystemInfo.Instance.BsAttachFlag.Equals("1") ? new string[] { "", "", url } : new string[] { this.SysModel.BillDocumentId, "0", this.BillModelObj.DirId + "", "" }; string[] args = defaultArgs.Concat(menuArgs).ToArray(); IForm form = FormHelper.LoadDllForm(SystemInfo.Instance.BsAttachFlag.Equals("1") ? ResourceDynamic.PubBrower : ResourceDynamic.PhotoView, args); form.SubForm.StartPosition = FormStartPosition.CenterScreen; DialogResult result = form.SubForm.ShowDialog(); } } catch (Exception ex) { LogUtil.WriteError("附件管理出错!", ex); //MessageUtil.Show("附件管理出错!" + ex); string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } #endregion #region 记载分割条位置 private void splitLeft_SplitterPositionChanged(object sender, EventArgs e) { try { if (this._isInitFinish) { IniHelper.Write(string.Format("base_spliterPositionLeft_{0}", this.SysModel.ModuleCode), this.splitLeft.SplitterPosition + ""); } } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } private void splitMain_SplitterPositionChanged(object sender, EventArgs e) { try { if (this._isInitFinish) { IniHelper.Write(string.Format("base_spliterPositionMain_{0}", this.SysModel.ModuleCode), this.splitMain.SplitterPosition + ""); } } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } #endregion /// /// 说明:初始化分割条位置 /// 创建人:龚宇超 /// 创建日期:2017-01-25 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void InitializeSplitterPosition() { try { string splitterMainPosition = IniHelper.Read(string.Format("base_spliterPositionMain_{0}", this.SysModel.ModuleCode)); if (!string.IsNullOrEmpty(splitterMainPosition)) this.splitMain.SplitterPosition = Convert.ToInt32(splitterMainPosition); string splitterLeftPosition = IniHelper.Read(string.Format("base_spliterPositionLeft_{0}", this.SysModel.ModuleCode)); if (!string.IsNullOrEmpty(splitterLeftPosition)) this.splitLeft.SplitterPosition = Convert.ToInt32(splitterLeftPosition); } catch (Exception ex) { LogHelper.Instance.WriteError(ex); string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } } }