/*********************** * 说明:基础档案审批弹出窗口模块 * 创建人:龚宇超 * 创建日期: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; #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(); } 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 cachesDic) { //全局数据 Task dynamicModelTask = cachesDic.AddTask(this, "DynamicModel", new Task(() => { return SysModel;//动态链接库对象 })); DynamicBaseAccraditionPopModel dynamicModel = (DynamicBaseAccraditionPopModel)dynamicModelTask.Result; Task accraditationModelRowTask = cachesDic.AddTask(this, "AccraditationModelRow", new Task(() => { return MainImpl.GetSystemdllTab(dynamicModel.ModuleCode);//获取单个模块信息 })); Task BaseAuditModelTask = cachesDic.AddTask(this, "BaseAuditModel", new Task(() => { BaseAuditModel BaseAuditModel = new BaseAuditModel(accraditationModelRowTask.Result); Task PrefixKeyTask = cachesDic.AddTask(this, "PrefixKey", new Task(() => { return BaseImpl.GetColumnPrefix(BaseAuditModel.MenuTable); })); Task ParmaryKeyTask = cachesDic.AddTask(this, "ParmaryKey", new Task(() => { return BaseImpl.GetBasePrimaryKey(dynamicModel.ModuleCode); })); BaseAuditModel.PrefixKey = PrefixKeyTask.Result; BaseAuditModel.ParmaryKey = ParmaryKeyTask.Result; return BaseAuditModel;//系统模块实体对象 })); Task flowRowDataTask = cachesDic.AddTask(this, "flowRowData", new Task(() => { return BaseAuditImpl.GetCurrentFlowRowData(BaseAuditModelTask.Result.MenuTable, BaseAuditModelTask.Result.ParmaryKey, dynamicModel.PrimaryValue); })); Task AccditModelObjTask = cachesDic.AddTask(this, "AccditModelObj", new Task(() => { AccraditationModel accraditationModel = new AccraditationModel(BaseAuditImpl.GetCurrentStepFlow(dynamicModel.ModuleCode, dynamicModel.StepCode)); return accraditationModel; })); Task BaseRowDataTask = cachesDic.AddTask(this, "BaseRowData", new Task(() => { return BaseAuditImpl.GetCurrentControlData(ReplaceHelper.ReplaceWhereCond(ReplaceHelper.ReplaceUserInfo(BaseAuditModelTask.Result.MenuSql)), BaseAuditModelTask.Result.ParmaryKey, dynamicModel.PrimaryValue); ; })); Task BtnFileMangerTask = cachesDic.AddTask(this, "BtnFileManger", new Task(() => { return "(" + AttachImpl.GetFileCount(BaseAuditModelTask.Result.MenuDirId + "", dynamicModel.PrimaryValue) + ")"; })); Task PushMessageTask = cachesDic.AddTask(this, "PushMessage", new Task(() => { return BaseAuditImpl.GetPushedOpers(dynamicModel.PrimaryValue, dynamicModel.StepCode); })); Task ReadOnlyColumnsTask = cachesDic.AddTask(gridFlowRecord, "ReadOnlyColumns", new Task(() => { return BaseAuditImpl.GetFlowRecordColumn(); })); Task GridViewDataSourceTask = cachesDic.AddTask(gridFlowRecord, "GridViewDataSource", new Task(() => { return BaseAuditImpl.GetFlowRecordData(this.BaseAuditModelObj.SystemTabFlowStep, dynamicModel.PrimaryValue, dynamicModel.ModuleCode); })); Task GetCurrentFlowStepTask = cachesDic.AddTask(this, "GetCurrentFlowStep", new Task(() => { DataRow GetCurrentFlowStep = BaseAuditImpl.GetCurrentFlowStep(dynamicModel.ModuleCode, flowRowDataTask.Result[BaseAuditModelTask.Result.BillType] + "", dynamicModel.StepCode); if (GetCurrentFlowStep != null) { Task FlowTypeStepModelTask = cachesDic.AddTask(this, "FlowTypeStepModel", new Task(() => { FlowTypeStepModel flowTypeStepModel = new FlowTypeStepModel(GetCurrentFlowStep); return flowTypeStepModel; })); Task GetDataRowResultTask = cachesDic.AddTask(this, "GetDataRowResult", new Task(() => { DataRow getDataRowResult = BaseImpl.GetDataRowResult(AccditModelObjTask.Result.FlowOperSql); string operUser = FlowTypeStepModelTask.Result.OperUser; if (getDataRowResult != null) { Task GetFlowOperatorsTask = cachesDic.AddTask(this, "GetFlowOperators", new Task(() => { DataRow GetFlowOperators = BaseAuditImpl.GetFlowOperators(dynamicModel.ModuleCode, dynamicModel.PrimaryValue, dynamicModel.StepCode); if (GetFlowOperators != null) { operUser = GetFlowOperators["operators"] + ""; if (operUser.StartsWith("@")) { string sql = string.Format("select count(1) from p_employeetab where ({0}) and employeeid='{1}'", ReplaceHelper.ReplaceRowParam(flowRowDataTask.Result, ReplaceHelper.ReplaceUserInfo(operUser)).Replace("@", "").Replace("''", "'"), ERPInfo.Instance.UserId); Task numberTask = cachesDic.AddTask(this, "Number", new Task(() => { return BaseImpl.GetResult(sql) + ""; })); } } return GetFlowOperators; })); } //Task operatorsTask = cachesDic.AddTask(this, "operUsers", new Task(() => //{ // return operUser; //})); return getDataRowResult; })); //代理权限 Task agencyAuthorityTask = cachesDic.AddTask(this, "AgencyAuthority", new Task(() => { return BaseAuditImpl.GetAgencyAuthority(dynamicModel.ModuleCode); })); } return GetCurrentFlowStep; })); //动态创建控件 Task GetControlLocationTask = cachesDic.AddTask(this, "GetControlLocation", new Task(() => { return BaseModuleImpl.GetControlLocation(BaseAuditModelTask.Result.FormKey, dynamicModel.ModuleCode); })); Task GetAddGroupDataTask = cachesDic.AddTask(this, "GetAddGroupData", new Task(() => { return BaseModuleImpl.GetAddGroupData(BaseAuditModelTask.Result.FormKey); })); //加载提醒记录 Task GetRemindColumnTask = cachesDic.AddTask(this, "GetRemindColumn", new Task(() => { return BaseAuditImpl.GetRemindColumn(); })); Task GetRemindinRecordTask = cachesDic.AddTask(this, "GetRemindinRecord", new Task(() => { return BaseAuditImpl.GetRemindinRecord(this.BaseAuditModelObj.FlowStepTable, this.BaseAuditModelObj.ComfrimTable, dynamicModel.PrimaryValue, dynamicModel.ModuleCode); })); //加载会签记录 Task GetSignRecordTask = cachesDic.AddTask(this, "GetSignRecord", new Task(() => { DataTable dt = BaseAuditImpl.GetSignRecord(this.BaseAuditModelObj.ComfrimTable, dynamicModel.PrimaryValue, dynamicModel.ModuleCode); if (dt.Rows.Count > 0) { Task GetSignRecordCoulumnTask = cachesDic.AddTask(this, "GetSignRecordCoulumn", new Task(() => { return BaseAuditImpl.GetSignRecordCoulumn(); })); } return dt; })); //获取选项卡数据 Task> detailTask = cachesDic.AddTask(this, "Details", new Task>(() => { List details = new List(); DataTable table = BaseAuditImpl.GetAttachTabs(dynamicModel.ModuleCode, dynamicModel.StepCode); DataTable Detailtable = AttachImpl.GetAttachDetilTab(dynamicModel.ModuleCode, dynamicModel.StepCode); foreach (DataRow item in table.Rows) { DataTable dtGridColumns = BaseAuditImpl.GetBottomBasicInformation(item["formKey"] + ""); GridDetailModel gridDeatilModel = new GridDetailModel(item, dtGridColumns, GridCustomColumnStruct.AuditPopupDetailGridView + item["formKey"] + ""); //控制只读 //gridDeatilModel.DetailSql = "1"; //url需要替换主表中控件的值 if (gridDeatilModel.IsWebView) { gridDeatilModel.DetailSql = ReplaceHelper.ReplaceRowParam(_baseRowData, ReplaceHelper.ReplaceUserInfo(gridDeatilModel.DetailSql)); } details.Add(gridDeatilModel); } foreach (DataRow item in Detailtable.Rows) { DataRow dtGridColumns = BaseAuditImpl.GetBottomDetailModel(item["detailKey"] + ""); if (dtGridColumns == null) continue; DataTable gridColumns = ReportImpl.GetReportDetailColumns(dtGridColumns["tab"] + "", dtGridColumns["id"] + ""); GridDetailModel gridDeatilModel = new GridDetailModel(dtGridColumns, gridColumns, GridCustomColumnStruct.AuditPopupDetailGridView + item["detailKey"] + ""); //控制只读 //gridDeatilModel.DetailSql = "1"; details.Add(gridDeatilModel); } return details; })); cachesDic.AddTask(tab_basicInfo, "DynamicModel", dynamicModelTask); cachesDic.AddTask(tab_basicInfo, "Details", detailTask); tab_basicInfo.GetDataCaches(cachesDic); //初始化常用工具 Task GetBaseGridRightMenusTask = cachesDic.AddTask(this, "GetBaseGridRightMenus", new Task(() => { return BaseModuleImpl.GetBaseGridRightMenus(dynamicModel.ModuleCode, ModuleType.BaseAudit); })); } #region 初始化记录所有按钮的位置 /// /// 说明:录所有按钮的位置 /// 创建人:王一帆 /// 创建日期:2020-11-25 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void InitButLocation() { LocationX.Clear(); int newlocationX = 0; foreach (System.Windows.Forms.Control control in pl_bottom.Controls) { int x = control.Location.X; bool isvisbel = control.Visible; if (!control.Visible) { LocationX.Add(x); } } foreach (System.Windows.Forms.Control control in pl_bottom.Controls) { int x = control.Location.X; newlocationX = control.Location.X; foreach (int b in LocationX) { if (x < b) { newlocationX += 87; } } control.Location = new Point(newlocationX, control.Location.Y); } if (!btnRemindAccradit.Visible) { combox_Suggestion.Width = btnRemindAccradit.Location.X + btnRemindAccradit.Width - combox_Suggestion.Location.X; } if (!btnRemindBack.Visible) { labeltxt_managerAudit.Width = btnRemindBack.Location.X + btnRemindBack.Width - labeltxt_managerAudit.Location.X; if (!btnReturnd.Visible) { labeltxt_managerAudit.Width = btnReturnd.Location.X + btnReturnd.Width - labeltxt_managerAudit.Location.X; } } if (!btnClose.Visible) { labeldate_happendTime.Width = btnClose.Location.X + btnClose.Width - labeldate_happendTime.Location.X; } } #endregion #region 初始化打印 /// /// 说明:创建打印 /// 创建人:龚宇超 /// 创建日期:2018-01-04 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void InitPrint() { string[] files = this.ModuleModelObj.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", "").Replace(".frx", ""); itemPrint.Tag = files[i]; itemPrint.ItemClick += new ItemClickEventHandler(itemPrint_ItemClick); pMprint.AddItem(itemPrint); } } } #endregion /// /// 说明:初始化属性配置 /// 创建人:龚宇超 /// 创建日期:2017-12-15 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void InitializeSetting() { Dictionary dataCaches = SysModel != null ? SysModel.DataCaches : null; if (!dataCaches.GetValue(this, "AccraditationModelRow", out this.mRowItem)) { this.mRowItem = MainImpl.GetSystemdllTab(this.SysModel.ModuleCode);//获取单个模块信息 } if (!dataCaches.GetValue(this, "BaseAuditModel", out this.ModuleModelObj)) { this.ModuleModelObj = new BaseAuditModel(this.mRowItem); } if (string.IsNullOrEmpty(this.ModuleModelObj.FormKey)) { //MessageUtil.Show(ResourceKeys.ModuleConfigError); //return; throw new Exception(ResourceKeys.ModuleConfigError); } if (!dataCaches.GetValue(this, "PrefixKey", out string PrefixKey)) { PrefixKey = BaseImpl.GetColumnPrefix(this.ModuleModelObj.MenuTable); } this.ModuleModelObj.PrefixKey = PrefixKey; if (!dataCaches.GetValue(this, "ParmaryKey", out string ParmaryKey)) { ParmaryKey = BaseImpl.GetBasePrimaryKey(this.SysModel.ModuleCode); } this.ModuleModelObj.ParmaryKey = ParmaryKey; if (!dataCaches.GetValue(this, "flowRowData", out this._flowRowData)) { this._flowRowData = BaseAuditImpl.GetCurrentFlowRowData(this.ModuleModelObj.MenuTable, this.ModuleModelObj.ParmaryKey, this.SysModel.PrimaryValue); } this.UpdateCirculationData(); string billType = this._flowRowData != null ? _flowRowData[this.ModuleModelObj.BillType] + "" : ""; if (string.IsNullOrEmpty(billType) || billType == "0") { //MessageUtil.Show(ResourceKeys.NotSetFlowType); throw new Exception(ResourceKeys.NotSetFlowType); } if (!dataCaches.GetValue(this, "AccditModelObj", out this.AccditModelObj)) { this.AccditModelObj = new AccraditationModel(BaseAuditImpl.GetCurrentStepFlow(this.SysModel.ModuleCode, this.SysModel.StepCode)); } if (!dataCaches.GetValue(this, "BaseRowData", out this._baseRowData)) { this._baseRowData = BaseAuditImpl.GetCurrentControlData(ReplaceHelper.ReplaceWhereCond(ReplaceHelper.ReplaceUserInfo(this.ModuleModelObj.MenuSql)), this.ModuleModelObj.ParmaryKey, this.SysModel.PrimaryValue); } if (!dataCaches.GetValue(this, "BaseRowData", out string FileManger)) { FileManger = "(" + AttachImpl.GetFileCount(this.ModuleModelObj.MenuDirId + "", this.SysModel.PrimaryValue) + ")"; } this.btnFileManger.Text += FileManger; this.btnReturnd.Text = this.AccditModelObj.StepBackText; if (this._baseRowData == null) this._baseRowData = this._flowRowData; } /// /// 说明:初始化控件 /// 创建人:龚宇超 /// 创建日期:2017-12-15 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void InitializeControl() { Dictionary dataCaches = SysModel != null ? SysModel.DataCaches : null; //设置控件文本属性 this.Text = this.SysModel.FormText; this.btnAudit.Text = this.AccditModelObj.StepApplyText; this.btnClose.Text = this.AccditModelObj.StepCloseText; this.labeltxt_managerAudit.EditText = this.SysModel.UserName; ////设置流转记录的列 this.gridFlowRecord.GridView.RowStyle += new RowStyleEventHandler(gridFlowRecord_RowStyle); if (!dataCaches.GetValue(gridFlowRecord, "ReadOnlyColumns", out DataTable dtReadOnlyColumns)) { dtReadOnlyColumns = BaseAuditImpl.GetFlowRecordColumn(); } if (!dataCaches.GetValue(gridFlowRecord, "GridViewDataSource", out DataTable dtridViewDataSource)) { dtridViewDataSource = BaseAuditImpl.GetFlowRecordData(this.BaseAuditModelObj.SystemTabFlowStep, this.SysModel.PrimaryValue, this.SysModel.ModuleCode); } this.gridFlowRecord.SetReadOnlyColumns(dtReadOnlyColumns, GridCustomColumnStruct.AuditPopupAttachGridView + this.ModuleModelObj.FormKey); this.gridFlowRecord.gridControl.Paint += new PaintEventHandler(gridFlow_Panint); this.gridFlowRecord.SetGridViewDataSource(dtridViewDataSource); //初始化流转标题 this.label_auditPerson.Text = this.labeltxt_managerAudit.LabelText = this.AccditModelObj.CurstepName; this.combox_Suggestion.ValueField = this.combox_Suggestion.TextField = "Mix_apellation"; this.combox_Suggestion.SetDataSource(BaseImpl.GetDataTableResult(this.AccditModelObj.SuggestionSql)); this.combox_Suggestion.TextEdit.SelectedIndex = 0; this.combox_Suggestion.TextEdit.SelectedValueChanged += new EventHandler(OnSelectValueChanged); if (!string.IsNullOrWhiteSpace(this.AccditModelObj.StepApplyContent)) this.txt_remark.Text = this.AccditModelObj.StepApplyContent; //单据水印 this._waterMark = new WaterMark(this.ModuleModelObj.PrefixKey, this._baseRowData); //this.SetFormSizeNew(); this.SetButtonStatus(); this.CreateAccraditationControl(); this.LoadRemindRecord(); this.LoadSignRecord(); this.BindTab(); this.InitCommonTools(); } /// /// 说明:审核意见下拉框事件 /// 创建人:王一帆 /// 创建日期:2021-02-25 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The source of the event. /// The instance containing the event data. protected void OnSelectValueChanged(object sender, EventArgs e) { try { this.txt_remark.Text = this.combox_Suggestion.EditText; } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } /// /// 说明:初始化本次推送人员 /// 创建人:龚宇超 /// 创建日期:2018-05-22 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void InitPushOpers() { Dictionary dataCaches = SysModel != null ? SysModel.DataCaches : null; if (!dataCaches.GetValue(this, "PushMessage", out DataRow rowItem)) { rowItem = BaseAuditImpl.GetPushedOpers(this.SysModel.PrimaryValue, this.SysModel.StepCode); } if (rowItem != null) { //记录本次操作信息 this._beforeMenuName = rowItem["menuname"] + ""; this._beforeUsers = rowItem["operators"] + ""; this._beforeId = Convert.ToInt32(rowItem["id"]); } } #endregion #region 加载选项卡数据 /// /// 说明:加载选项卡数据 /// 创建人:龚宇超 /// 创建日期:2017-12-15 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void InitTabData() { isModifyPage.Clear(); foreach (XtraTabPage tabPage in this.tab_basicInfo.TabControlObj.TabPages) { GridDetailModel model = this.tab_basicInfo.GetGridDetailModel(tabPage); bool isDetailAttach = (model.IsReadOnly || model.IsChart); if (tabPage.Tag is ModuleWebView) { // 加载网页 string url = ReplaceHelper.ReplaceRowParam(this._baseRowData, ReplaceHelper.ReplaceUserInfo(model.DetailSql)); url = url.StartsWith("http") ? url : SystemInfo.Instance.OAUrl + url; ModuleWebView webView = tabPage.Tag as ModuleWebView; webView.Dock = DockStyle.Fill; webView.Tag = model; webView.Navigate(url); } else if (tabPage.Tag is FrmWebBrowser) { // 加载网页 string url = ReplaceHelper.ReplaceRowParam(this._baseRowData, ReplaceHelper.ReplaceUserInfo(model.DetailSql)); url = url.StartsWith("http") ? url : SystemInfo.Instance.OAUrl + url; FrmWebBrowser webView = tabPage.Tag as FrmWebBrowser; webView.Dock = DockStyle.Fill; webView.Tag = model; webView.LoadUrl(url); } else if (tabPage.Tag is FrmMiniBlink) { // 加载网页 string url = ReplaceHelper.ReplaceRowParam(this._baseRowData, ReplaceHelper.ReplaceUserInfo(model.DetailSql)); url = url.StartsWith("http") ? url : SystemInfo.Instance.OAUrl + url; FrmMiniBlink webView = tabPage.Tag as FrmMiniBlink; webView.Dock = DockStyle.Fill; webView.Tag = model; webView.LoadUrl(url); } else if (tabPage.Tag is GridControlEx) { string sqlValue = isDetailAttach ? model.DetailSql : GetSearchSql(model); GridControlEx grdExMain = (tabPage.Tag as GridControlEx); if (!isDetailAttach) grdExMain.LastSearchSql = sqlValue; this.tab_basicInfo.SetGridDataSource(tabPage, MainImpl.GetDataTableResult(ReplaceHelper.ReplaceRowParam(this._baseRowData, sqlValue))); if (!model.IsReadOnly) isModifyPage.Add(model.FormKey, tabPage); } else if (tabPage.Tag is TabMultipledetails) { TabMultipledetails tabMultipledetails = tabPage.Tag as TabMultipledetails; tabMultipledetails.SetConditionValues(this._baseRowData); GridControlEx grdExMain = (tabMultipledetails.SplitMain.Panel1.Tag as GridControlEx); GridDetailModel MainModel = grdExMain.Tag as GridDetailModel; string searchMainSql = ReplaceHelper.ReplaceRowParam(this._baseRowData, isDetailAttach ? MainModel.DetailSql : GetSearchSql(MainModel)); DataTable firstTable = MainImpl.GetDataTableResult(searchMainSql); grdExMain.LastSearchSql = searchMainSql; grdExMain.SetGridViewDataSource(firstTable); if (tabMultipledetails.SplitMain.Panel2.Tag is GridControlEx) { GridControlEx grdExAdditional = (tabMultipledetails.SplitMain.Panel2.Tag as GridControlEx); GridDetailModel AdditionalModel = grdExAdditional.Tag as GridDetailModel; string searchAddSql = ReplaceHelper.ReplaceRowParam(this._baseRowData, isDetailAttach ? AdditionalModel.DetailSql : GetSearchSql(AdditionalModel)); if (!MainModel.IsUnioDetail) { grdExAdditional.LastSearchSql = searchAddSql; grdExAdditional.SetGridViewDataSource(MainImpl.GetDataTableResult(searchAddSql)); } //右侧是左侧的明细,左侧没有数据时。右侧赋空值(因为无法触发左侧行改变事件) if (MainModel.IsUnioDetail && firstTable.Rows.Count == 0) { grdExAdditional.LastSearchSql = ""; grdExAdditional.SetGridViewDataSource(new DataTable()); } } else if (tabMultipledetails.SplitMain.Panel2.Tag is ChartControlEx) { ChartControlEx grdExAdditional = (tabMultipledetails.SplitMain.Panel2.Tag as ChartControlEx); GridDetailModel AdditionalModel = grdExAdditional.Tag as GridDetailModel; string searchAddSql = this.GetSearchSql(AdditionalModel); DataTable table = MainImpl.GetDataTableResult(searchAddSql); grdExAdditional.CreateChart(table); } } else { string sqlValue = isDetailAttach ? model.DetailSql : GetSearchSql(model); this.tab_basicInfo.SetGridDataSource(tabPage, MainImpl.GetDataTableResult(this.ControlObj.ReplaceControlValue(sqlValue))); } } } #endregion #region 加载选项卡数据 /// /// 说明:加载选项卡数据 /// 创建人:龚宇超 /// 创建日期:2017-12-15 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void InitEditTabControl() { DataTable Detailtable = AttachImpl.GetAttachDetilTab(this.SysModel.ModuleCode, this.SysModel.StepCode); foreach (DataRow rt in Detailtable.Rows) { string key = rt["detailKey"].ToString().ToLower(); if (!isModifyPage.Keys.Contains(key)) continue; XtraTabPage tabpage = isModifyPage[key]; GridDetailModel model = this.tab_basicInfo.GetGridDetailModel(tabpage); //修改字段 GridControlEx gridControl = tabpage.Tag as GridControlEx; string DetailModifyFields = rt["modifyFields"] + ""; string DetailRequiredFields = Detailtable.Columns.Contains("requiredFields") ? rt["requiredFields"] + "" : ""; bool isEditable = string.IsNullOrEmpty(DetailModifyFields); if (!string.IsNullOrWhiteSpace(DetailRequiredFields)) DetailsRequired = true; gridControl.GridView.OptionsBehavior.Editable = !isEditable; GridColumnCollection gc = gridControl.GridView.Columns; //设置表格可编辑列和必填列 gridControl.SetReadOnlyAllColumn(); gridControl.SetFieldStatus(DetailModifyFields, DetailRequiredFields); //if (isEditable) continue; //DetailModifyFields = DetailModifyFields + ","; //foreach (GridColumn item in gc) //{ // GridColumnModel gcmodel = item.Tag as GridColumnModel; // item.OptionsColumn.AllowEdit = DetailModifyFields.IndexOf(item.FieldName + ",", StringComparison.OrdinalIgnoreCase) != -1; // item.OptionsColumn.ReadOnly = !item.OptionsColumn.AllowEdit; // if (!item.OptionsColumn.AllowEdit) // { // item.AppearanceHeader.Options.UseForeColor = true; // item.AppearanceHeader.ForeColor = ColorTranslator.FromHtml(HeaderColor); // } // else // { // item.AppearanceHeader.Options.UseForeColor = true; // item.AppearanceHeader.ForeColor = Color.Black; // } // if (gcmodel.FieldType == ControlType.LabMemoEdit) item.OptionsColumn.AllowEdit = true; //} } } #endregion #region 流转表格行样式 /// /// 说明:流转表格行样式 /// 创建人:龚宇超 /// 创建日期:2017-12-15 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void gridFlowRecord_RowStyle(object sender, RowStyleEventArgs e) { try { if (e.RowHandle > 0) { DataRow dr = this.gridFlowRecord.GridView.GetDataRow(e.RowHandle); if (dr["sh"] + "" == "审") e.Appearance.ForeColor = Color.Blue; } } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } #endregion #region 初始化常用工具 /// /// 说明:初始化常用工具 /// 创建人:龚宇超 /// 创建日期:2017-12-15 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void InitCommonTools() { Dictionary dataCaches = SysModel != null ? SysModel.DataCaches : null; if (!dataCaches.GetValue(this, "GetBaseGridRightMenus", out DataTable tableCommon)) { tableCommon = BaseModuleImpl.GetBaseGridRightMenus(this.SysModel.ModuleCode, ModuleType.BaseAudit); } foreach (DataRow item in tableCommon.Rows) { BarButtonItem itemCommon = new BarButtonItem(); itemCommon.Caption = item["menuname"] + ""; itemCommon.Tag = item; itemCommon.ItemClick += new ItemClickEventHandler(itemCommon_ItemClick); p_menu.AddItem(itemCommon); } } /// /// 说明:验证可操作条件 /// 创建人:龚宇超 /// 创建日期:2018-03-07 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The source of the event. /// The instance containing the event data. protected void dpbTools_Click(object sender, EventArgs e) { foreach (BarItemLink itemLink in this.p_menu.ItemLinks) { DataRow rowItem = itemLink.Item.Tag as DataRow; if (rowItem != null) { string menuCond = rowItem["MenuCond"] + ""; string menuCaption = itemLink.Caption; if (!string.IsNullOrEmpty(menuCond)) { try { bool result = true; menuCond = ReplaceHelper.ReplaceParamToValue(menuCond, "{" + this.ModuleModelObj.ParmaryKey + "}"); if (menuCond.StartsWith("@") || menuCond.StartsWith("!")) { result = "1".Equals(BaseImpl.GetDefaultValue(menuCond)); } else { menuCond = this.ControlObj.ReplaceControlValue(menuCond); menuCond = ReplaceHelper.ReplaceParamToValue(menuCond, "0"); // 未替换的参数所有替换为0 result = ReplaceHelper.EvalCond(menuCond); } itemLink.Item.Enabled = result; } catch (Exception ex) { MessageUtil.Show("[" + menuCaption + "] " + ResourceKeys.SetRightMenuCondFault); LogHelper.Instance.WriteError(ex); LogUtil.WriteError("验证可操作条件出错!", ex); } } } } } /// /// 说明:常用工具点击 /// 创建人:龚宇超 /// 创建日期:2017-12-21 /// 修改人: /// 修改日期: /// 修改备注: /// 版本: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 加载提醒记录 /// /// 说明:加载提醒记录 /// 创建人:龚宇超 /// 创建日期:2017-12-20 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void LoadRemindRecord() { Dictionary dataCaches = SysModel != null ? SysModel.DataCaches : null; //加载提醒 if (!string.IsNullOrEmpty(this._flowTypeStepModel.RemindSelect)) { if (!dataCaches.GetValue(this, "GetRemindColumn", out DataTable DefaultColumns)) { DefaultColumns = BaseAuditImpl.GetRemindColumn(); } this.gridRemind.SetReadOnlyColumns(DefaultColumns); if (!dataCaches.GetValue(this, "GetRemindinRecord", out DataTable dt)) { dt = BaseAuditImpl.GetRemindinRecord(this.BaseAuditModelObj.FlowStepTable, this.BaseAuditModelObj.ComfrimTable, this.SysModel.PrimaryValue, this.SysModel.ModuleCode); } if (dt.Rows.Count > 0) { this.gridRemind.SetGridViewDataSource(dt); this.tabpage_remind.Text = this.tabpage_remind.Text + "(" + dt.Rows.Count + ")"; } else { this.tabMain.TabPages.Remove(this.tabpage_remind); } } } #endregion #region 加载会签记录 /// /// 说明:加载会签记录 /// 创建人:龚宇超 /// 创建日期:2017-12-20 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void LoadSignRecord() { Dictionary dataCaches = SysModel != null ? SysModel.DataCaches : null; if (!dataCaches.GetValue(this, "GetSignRecord", out DataTable dt)) { dt = BaseAuditImpl.GetSignRecord(this.BaseAuditModelObj.ComfrimTable, this.SysModel.PrimaryValue, this.SysModel.ModuleCode); } if (dt.Rows.Count > 0) { if (!dataCaches.GetValue(this, "GetSignRecordCoulumn", out DataTable RecordCoulumns)) { RecordCoulumns = BaseAuditImpl.GetSignRecordCoulumn(); } this.gridSign.SetReadOnlyColumns(RecordCoulumns); this.gridSign.SetGridViewDataSource(dt); this.tabpage_sign.Text = this.tabpage_sign.Text + "(" + dt.Rows.Count + ")"; } else { this.tabMain.TabPages.Remove(this.tabpage_sign); } } #endregion #region 绑定选项卡 /// /// 说明:绑定选项卡 /// 创建人:龚宇超 /// 创建日期:2017-12-20 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void BindTab() { //this._baseTabList = BaseAuditImpl.GetAttachTabs(this.SysModel.ModuleCode, this.SysModel.StepCode); Dictionary dataCaches = SysModel != null ? SysModel.DataCaches : null; this.tab_basicInfo.Model = this.SysModel; this.tab_basicInfo.ParentControlEx = this.ControlObj; if (!dataCaches.GetValue(tab_basicInfo, "Details", out List details)) { details = GetTabDetails(); } this.tab_basicInfo.InitTabPages(details); this.tab_basicInfo.OnRightCallback += new EventHandler(tabBasicInfo_OnRightCallback); //设置高度 SetTabHeight(); } /// /// 说明:单据右键菜单执行后刷新数据 /// 创建人:龚宇超 /// 创建日期:2018-01-15 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The source of the event. /// The instance containing the event data. protected void tabBasicInfo_OnRightCallback(object sender, EventArgs e) { try { foreach (XtraTabPage page in this.tab_basicInfo.TabControlObj.TabPages) { GridDetailModel model = this.tab_basicInfo.GetGridDetailModel(page); //this.tab_basicInfo.SetGridDataSource(page, MainImpl.GetDataTableResult(ReplaceHelper.ReplaceRowParam(this._baseRowData, model.DetailSql))); bool isDetailAttach = (model.IsReadOnly || model.IsChart); if (page.Tag is GridControlEx) { string sqlValue = isDetailAttach ? model.DetailSql : GetSearchSql(model); GridControlEx grdExMain = (page.Tag as GridControlEx); if (!isDetailAttach) grdExMain.LastSearchSql = sqlValue; this.tab_basicInfo.SetGridDataSource(page, MainImpl.GetDataTableResult(ReplaceHelper.ReplaceRowParam(this._baseRowData, sqlValue))); } else if (page.Tag is TabMultipledetails) { TabMultipledetails tabMultipledetails = page.Tag as TabMultipledetails; tabMultipledetails.SetConditionValues(this._baseRowData); GridControlEx grdExMain = (tabMultipledetails.SplitMain.Panel1.Tag as GridControlEx); GridDetailModel MainModel = grdExMain.Tag as GridDetailModel; string searchMainSql = ReplaceHelper.ReplaceRowParam(this._baseRowData, isDetailAttach ? MainModel.DetailSql : GetSearchSql(MainModel)); DataTable firstTable = MainImpl.GetDataTableResult(searchMainSql); grdExMain.LastSearchSql = searchMainSql; grdExMain.SetGridViewDataSource(firstTable); if (tabMultipledetails.SplitMain.Panel2.Tag is GridControlEx) { GridControlEx grdExAdditional = (tabMultipledetails.SplitMain.Panel2.Tag as GridControlEx); GridDetailModel AdditionalModel = grdExAdditional.Tag as GridDetailModel; string searchAddSql = ReplaceHelper.ReplaceRowParam(this._baseRowData, isDetailAttach ? AdditionalModel.DetailSql : GetSearchSql(AdditionalModel)); if (!MainModel.IsUnioDetail) { grdExAdditional.LastSearchSql = searchAddSql; grdExAdditional.SetGridViewDataSource(MainImpl.GetDataTableResult(searchAddSql)); } //右侧是左侧的明细,左侧没有数据时。右侧赋空值(因为无法触发左侧行改变事件) if (MainModel.IsUnioDetail && firstTable.Rows.Count == 0) { grdExAdditional.LastSearchSql = ""; grdExAdditional.SetGridViewDataSource(new DataTable()); } } else if (tabMultipledetails.SplitMain.Panel2.Tag is ChartControlEx) { ChartControlEx grdExAdditional = (tabMultipledetails.SplitMain.Panel2.Tag as ChartControlEx); GridDetailModel AdditionalModel = grdExAdditional.Tag as GridDetailModel; string searchAddSql = this.GetSearchSql(AdditionalModel); DataTable table = MainImpl.GetDataTableResult(searchAddSql); grdExAdditional.CreateChart(table); } } } } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } /// /// 说明:获取选项卡数据 /// 创建人:龚宇超 /// 创建日期:2018-01-15 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private List GetTabDetails() { List details = new List(); DataTable table = BaseAuditImpl.GetAttachTabs(this.SysModel.ModuleCode, this.SysModel.StepCode); DataTable Detailtable = AttachImpl.GetAttachDetilTab(this.SysModel.ModuleCode, this.SysModel.StepCode); foreach (DataRow item in table.Rows) { DataTable dtGridColumns = BaseAuditImpl.GetBottomBasicInformation(item["formKey"] + ""); GridDetailModel gridDeatilModel = new GridDetailModel(item, dtGridColumns, GridCustomColumnStruct.AuditPopupDetailGridView + item["formKey"] + ""); //控制只读 //gridDeatilModel.DetailSql = "1"; //url需要替换主表中控件的值 if (gridDeatilModel.IsWebView) { gridDeatilModel.DetailSql = ReplaceHelper.ReplaceRowParam(_baseRowData, ReplaceHelper.ReplaceUserInfo(gridDeatilModel.DetailSql)); } details.Add(gridDeatilModel); } foreach (DataRow item in Detailtable.Rows) { DataRow dtGridColumns = BaseAuditImpl.GetBottomDetailModel(item["detailKey"] + ""); if (dtGridColumns == null) continue; DataTable gridColumns = ReportImpl.GetReportDetailColumns(dtGridColumns["tab"] + "", dtGridColumns["id"] + ""); GridDetailModel gridDeatilModel = new GridDetailModel(dtGridColumns, gridColumns, GridCustomColumnStruct.AuditPopupDetailGridView + item["detailKey"] + ""); //控制只读 //gridDeatilModel.DetailSql = "1"; details.Add(gridDeatilModel); } return details; } #endregion #region 设置控件高度 /// /// 说明:设置控件容器高度 /// 创建人:龚宇超 /// 创建日期:2017-12-20 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void SetTabHeight() { if (this.tab_basicInfo.TabControlObj.TabPages.Count > 0) { this.Height = this.Height + 200; this.pl_main.Height = this.pl_main.Height < 350 ? 350 : this.pl_main.Height; this.Height = splitContainer.Height = this.pl_main.Height + 300; this.Height = this.pl_main.Height + 300 > Screen.PrimaryScreen.WorkingArea.Height ? Screen.PrimaryScreen.WorkingArea.Height : this.Height; this.pl_main.Height = this.Height - 350; } else { this.Height = this.Height - 50; this.Height = this._mainPanelHeight > 600 ? this._mainPanelHeight : this.Height; this.splitContainer.PanelVisibility = SplitPanelVisibility.Panel1; } this.Top = (Screen.PrimaryScreen.WorkingArea.Height - this.Height) / 2; } #endregion #region 设置窗口大小 /// /// 说明:设置弹出窗体大小 /// 创建人:龚宇超 /// 创建日期:2017-12-15 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void SetFormSizeNew() { this.WindowState = FormWindowState.Normal; DataRow drSize = null; if (ProcessExists) { drSize = Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContentRow(); } else { 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; //this.Width = Screen.PrimaryScreen.WorkingArea.Width; //this.Height = Screen.PrimaryScreen.WorkingArea.Height; //this.Left = (Screen.PrimaryScreen.WorkingArea.Width / 2) - (this.Width / 2); //this.Top = (Screen.PrimaryScreen.WorkingArea.Height / 2) - (this.Height / 2); } } #endregion #region 设置按钮状态 /// /// 说明:初始化设置按钮状态 /// 创建人:龚宇超 /// 创建日期:2017-12-15 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void SetButtonStatus() { Dictionary dataCaches = SysModel != null ? SysModel.DataCaches : null; //获取当前流转步骤 if (!dataCaches.GetValue(this, "GetCurrentFlowStep", out DataRow currentFlowStep)) { currentFlowStep = BaseAuditImpl.GetCurrentFlowStep(this.SysModel.ModuleCode, this._flowRowData[this.ModuleModelObj.BillType] + "", this.SysModel.StepCode); } if (currentFlowStep == null) { MessageUtil.Show(ResourceKeys.FlowStepConfigError); return; } if (!dataCaches.GetValue(this, "FlowTypeStepModel", out this._flowTypeStepModel)) { this._flowTypeStepModel = new FlowTypeStepModel(currentFlowStep); } string operUser = this._flowTypeStepModel.OperUser; if (!dataCaches.GetValue(this, "GetDataRowResult", out DataRow getDataRowResult)) { getDataRowResult = BaseImpl.GetDataRowResult(this.AccditModelObj.FlowOperSql); } if (getDataRowResult != null) { if (!dataCaches.GetValue(this, "GetFlowOperators", out DataRow flowOper)) { flowOper = BaseAuditImpl.GetFlowOperators(this.SysModel.ModuleCode, this.SysModel.PrimaryValue, this.SysModel.StepCode); } operUser = flowOper == null ? operUser : flowOper["operators"] + ""; } //确认权限判断 this.btnRemindAccradit.Visible = this.btnRemindBack.Visible = this._flowTypeStepModel.RemindSelect == "1"; this.btnClose.Visible = this.btnClose.Enabled = this._flowTypeStepModel.StepClosed == 1; if (operUser.StartsWith("@")) { if (!dataCaches.GetValue(this, "Number", out string number)) { string sql = string.Format("select count(1) from p_employeetab where ({0}) and employeeid='{1}' ", ReplaceHelper.ReplaceRowParam(_flowRowData, ReplaceHelper.ReplaceUserInfo(operUser)).Replace("@", "").Replace("''", "'"), ERPInfo.Instance.UserId); number = MainImpl.GetResult(sql) + ""; } this.btnAudit.Enabled = this.btnReturnd.Enabled = this.btnSave.Enabled = this.btnClose.Enabled = int.Parse(string.IsNullOrWhiteSpace(number + "") ? "0" : number + "") > 0; } else { this.btnAudit.Enabled = this.btnReturnd.Enabled = this.btnSave.Enabled = this.btnClose.Enabled = operUser.Contains(this.SysModel.UserName); } //代理权限 if (!dataCaches.GetValue(this, "AgencyAuthority", out DataRow agency)) { agency = BaseAuditImpl.GetAgencyAuthority(this.SysModel.ModuleCode); } if (agency != null) { string sourceuser = agency["sourceuser"] + ""; foreach (string item in sourceuser.Split(',')) { if (operUser.Contains(item)) { this.btnAudit.Enabled = this.btnReturnd.Enabled = this.btnSave.Enabled = this.btnClose.Enabled = true; break; } } } if (SysModel.HasReadPrivilege()) { this.btnSave.Enabled = false; } //如果已经终审按钮为窗口默认设置,否则 if (this.SysModel.StepOver == "1") { this.combox_Suggestion.Enabled = false; this.btnAudit.Enabled = false; this.btnRemindAccradit.Enabled = false; this.pl_bottom.Visible = true; } if (this.SysModel.ConfirmId == "1") { this.btnAudit.Enabled = true; this.btnClose.Visible = this.btnRemindAccradit.Visible = this.btnRemindBack.Visible = this.btnSave.Visible = this.btnReturnd.Visible = false; this.btnAudit.Text = "确认(&Y)"; this.label_auditPerson.Text = "确认意见"; this.labeltxt_managerAudit.Text = "会签人"; this.txt_remark.Text = "确认"; } } #endregion #region 动态创建控件 /// /// 说明:动态创建控件 /// 创建人:龚宇超 /// 创建日期:2017-12-15 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void CreateAccraditationControl() { Dictionary dataCaches = SysModel != null ? SysModel.DataCaches : null; if (!dataCaches.GetValue(this, "GetControlLocation", out this._dtFileds)) { this._dtFileds = BaseModuleImpl.GetControlLocation(this.ModuleModelObj.FormKey, this.SysModel.ModuleCode); } if (!dataCaches.GetValue(this, "GetAddGroupData", out this._dtAddGroup)) { this._dtAddGroup = BaseModuleImpl.GetAddGroupData(this.ModuleModelObj.FormKey); } this.ControlObj = new MyControl(); this.ControlObj.PrimaryValue = this.SysModel.PrimaryValue; this.ControlObj.isAuditMain = true; this.ControlObj.InitControl(this._dtFileds, pl_main, this._dtAddGroup); if (SystemInfo.Instance.AuditAutoScroll) this.pl_main.AutoScroll = true; this.ControlObj.OnDataSourceBindCallBack += new EventHandler(OnControlObjOnDataSourceBindCallBack); if (this.AccditModelObj.BillModifyFields != "-1") this.ControlObj.SetReadOnlyAllControl(true); DataTable AuthorityTable = PowerImpl.GetModuleAuthorityEnable(this.SysModel.ModuleCode); //改变控件状态 必填字段 (先设置必填字段,后面设置操作字段时可以改变颜色) string RequiredFields = this.AccditModelObj.RequiredFields.Trim(','); if (!string.IsNullOrEmpty(RequiredFields) && RequiredFields != "-1") { foreach (DataRow dr in this._dtFileds.Rows) { string fieldName = dr["fieldName"] + ""; this.ControlObj.SetRequiredControl(fieldName, RequiredFields.Split(',').Contains(fieldName), false); } } string OperationField = this.AccditModelObj.BillModifyFields.Trim(','); //改变控件状态 操作字段 if (!string.IsNullOrEmpty(OperationField) && OperationField != "-1") { foreach (string item in OperationField.Split(',')) { BaseUserControl control = this.ControlObj.FindControl(item); if (control == null) continue; if (string.IsNullOrWhiteSpace(control.Model.PrivilegeOper)) { //没有人员权限,转成可编辑 this.ControlObj.SetReadOnlyControl(item, false, false); } else { List targetPrivTypeIds = new List(); foreach (string permission in control.Model.PrivilegeOper.Split(',')) { if (!string.IsNullOrWhiteSpace(permission)) targetPrivTypeIds.Add(int.Parse(permission)); } //获取权限对应的人员名称 string userString = string.Join(",", AuthorityTable.AsEnumerable() .Where(row => targetPrivTypeIds.Contains(row.Field("privTypeId"))) .Select(row => row.Field("userList")) .Where(value => value != null) .ToList()); //有权限的字段,转成可编辑 if (userString.Split(',').Contains(ERPInfo.Instance.UserName)) this.ControlObj.SetReadOnlyControl(item, false, false); } } //foreach (DataRow dr in this._dtFileds.Rows) //{ // string fieldName = dr["fieldName"] + ""; // this.ControlObj.SetReadOnlyControl(fieldName, !OperationField.Split(',').Contains(fieldName), true); //} } } /// /// 说明:数据源绑定完成后执行 /// 创建人:龚宇超 /// 创建日期: /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The sender. /// The instance containing the event data. void OnControlObjOnDataSourceBindCallBack(object sender, EventArgs e) { try { this.ControlObj.CanExecControl = false; this.ControlObj.SetAllControlValue(this._baseRowData); this.ControlObj.CanExecControl = true; this.InitTabData(); this.InitEditTabControl(); this.Opacity = 1; this.SetColor(); } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } #endregion #region 绘制水印 /// /// 说明:绘制水印 /// 创建人:龚宇超 /// 创建日期:2017-12-21 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void gridFlow_Panint(object sender, PaintEventArgs e) { try { if (this._waterMark != null) { System.Windows.Forms.Control control = sender as System.Windows.Forms.Control; GraphicsText graphicsText = new GraphicsText(); graphicsText.Graphics = e.Graphics; // 绘制围绕点旋转的文本 StringFormat format = new StringFormat(); format.Alignment = StringAlignment.Center; format.LineAlignment = StringAlignment.Center; int x = (control.Width - 90) / 2; int y = (control.Height - 32) / 2; // 绘制单据状态文本 if (!string.IsNullOrEmpty(this._waterMark.Text)) { graphicsText.DrawString(this._waterMark.Text, new Font("宋体", 20, FontStyle.Bold), new SolidBrush(Color.Red), new PointF(x, y), format, -20f); e.Graphics.TranslateTransform(x, y); e.Graphics.RotateTransform(-20f); if (Business.Impl.LanguageTranslation.Translatable) { // 1. 测量文本尺寸 SizeF textSize = e.Graphics.MeasureString(this._waterMark.Collect, new Font("宋体", 20, FontStyle.Bold), new SizeF(float.MaxValue, float.MaxValue), format); // 2. 计算边框矩形的尺寸和位置 int rectWidth = (int)textSize.Width + 10; e.Graphics.DrawRectangle(new Pen(Color.Red, 2f), new Rectangle(-rectWidth / 2, -19, rectWidth, 32)); } else { e.Graphics.DrawRectangle(new Pen(Color.Red, 2f), new Rectangle(-45, -19, 90, 32)); } } } } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } #endregion #region 附件 /// /// 说明:附件操作 /// 创建人:龚宇超 /// 创建日期:2017-12-21 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void btnAttach_Click(object sender, EventArgs e) { try { if (string.IsNullOrWhiteSpace(this.SysModel.PrimaryValue)) { MessageUtil.Show(ResourceKeys.NotFoundMaterielNo); } 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.PrimaryValue, this.btnSave.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[] { string.Format(ModuleArgs.PubPhotoViewArgs, this.SysModel.PrimaryValue), "0", this.ModuleModelObj.MenuDirId + "", "" }; string[] args = defaultArgs.Concat(menuArgs).ToArray(); IForm form = FormHelper.LoadDllForm(SystemInfo.Instance.BsAttachFlag.Equals("1") ? ResourceDynamic.PubBrower : ResourceDynamic.PhotoView, args); DialogResult result = form.SubForm.ShowDialog(); } } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } #endregion #region 打印 /// /// 说明:打印完成需要参数 /// 创建人:龚宇超 /// 创建日期:2018-07-09 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void GetPrintOtherParam() { //取得打印完成后的参数 if (this.ModuleModelObj.PrintSql.Contains("<<")) { string[] strs = this.ModuleModelObj.PrintSql.Split(new[] { ">>" }, 2, StringSplitOptions.None); _mainPrintSql = strs[1]; _printModeCond = strs[0].Replace("<<", ""); } if (!string.IsNullOrEmpty(_printModeCond) && _printModeCond.IndexOf(';') > 0) { string[] str = _printModeCond.Split(';'); DataRow item = AttachImpl.GetSystemModule(str[0]); string tableName = item["TableName"] + ""; string modetype = item["modType"] + ""; string comprefix = BaseImpl.GetColumnPrefix(tableName); string primaryKey = modetype == "1" ? BaseImpl.GetBasePrimaryKey(str[0]) : comprefix + "billdocument_id"; //表名,列前缀,主键字段,主键值,模块编号,主打印Sql _printSaveParams = new List() { tableName, comprefix, primaryKey, str[1], str[0], _mainPrintSql }; //判断是否直接打印 modetype 区别单据和基础档案模块 switch (modetype) { case "1": ModuleModel mode = new ModuleModel(MainImpl.GetSystemdllTab(str[0])); if (mode != null) _isExcPrint = mode.PrintType == 3; break; case "2": BaseAccraditationModel model = new BaseAccraditationModel(BillAuditImpl.GetPubAuditProperty(str[0])); if (model != null) _isExcPrint = model.BillPrintType == 3; break; } } } /// /// 说明:打印事件 /// 创建人:龚宇超 /// 创建日期: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 printFile = e.Item.Tag + ""; this._flowRowData = BaseAuditImpl.GetCurrentFlowRowData(this.ModuleModelObj.MenuTable, this.ModuleModelObj.ParmaryKey, this.SysModel.PrimaryValue); this.UpdateCirculationData(); string printPath = PubUtil.PrintFileAbsolutelyPath; if (!File.Exists(printPath)) { MessageUtil.Show(ResourceKeys.NotFoundPrintFile); return; } if (_flowRowData == null) { MessageUtil.Show(ResourceKeys.DataNotFount); return; } if (!ReplaceHelper.ReplaceRowParamCond(_flowRowData, this.ModuleModelObj.PrintCond)) { MessageUtil.Show(ResourceKeys.DisSatisfyPrintCond); return; } string tmpSql = ReplaceHelper.ReplaceRowParam(_flowRowData, this.ModuleModelObj.PrintSql); string tmpSql1 = ReplaceHelper.ReplaceRowParam(_flowRowData, this.ModuleModelObj.PrintSql1); string tmpSql2 = ReplaceHelper.ReplaceRowParam(_flowRowData, this.ModuleModelObj.PrintSql2); //主Sql string mainSql = string.Empty; List tmpSqls = new List(); if (_printSaveParams != null && _printSaveParams.Count > 0) { _printSaveParams[5] = mainSql = ReplaceHelper.ReplaceRowParam(_flowRowData, _mainPrintSql); _printSaveParams[3] = _flowRowData[_printSaveParams[2]] + ""; tmpSqls.Add(mainSql); tmpSqls.Add(tmpSql1); tmpSqls.AddRange(tmpSql2.Split(';').ToList()); } if (printFile.Contains(PrintUtil.TemplateFlag)) { PrintUtil.OnAfterPrint -= new EventHandler(OnReportPrintAfter); PrintUtil.OnAfterPrint += new EventHandler(OnReportPrintAfter); PrintUtil.FastReportPrint(tmpSqls, printFile, _isExcPrint); } else { DelphiHelper.LoadDelphiDll(printPath, printPath, printFile, tmpSql, tmpSql1, this.ModuleModelObj.PrintType, tmpSql2); } } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } /// /// 说明:打印完成后回调 /// 创建人:龚宇超 /// 创建日期:2018-07-05 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The sender. /// The e. protected void OnReportPrintAfter(object sender, EventArgs e) { try { if (_printSaveParams != null && _printSaveParams.Count > 0) { //打印完成后添加数据库 int result = BaseModuleImpl.SavePrintRecord(_printSaveParams[0], _printSaveParams[1], _printSaveParams[2], _printSaveParams[3], _printSaveParams[4]); } } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } #endregion #region 更改保存 /// /// 说明:更新保存操作 /// 创建人:龚宇超 /// 创建日期:2017-12-21 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The source of the event. /// The instance containing the event data. private void btnSave_Click(object sender, EventArgs e) { try { bool isSuccess = false;//是否保存成功 if (this.ControlObj.VerifyNull()) { if (this.ControlObj.VerifyUpdated()) { if (this.ControlObj.SaveBaseModuleData(this.SysModel.ModuleCode, this.ModuleModelObj.MenuTable, this.ModuleModelObj.ParmaryKey, ref this.SysModel.PrimaryValue, false, "", true, ModuleModelObj.NewVer)) { AuditChangeLog.SaveHeaderChangeLog(this._baseRowData, this.ControlObj, this.SysModel.PrimaryValue, this.SysModel.StepCode, ERPInfo.Instance.UserId); isSuccess = true; foreach (XtraTabPage item in this.tab_basicInfo.TabControlObj.TabPages) { XtraTabPage tabPage = item as XtraTabPage; GridDetailModel detailModel = this.tab_basicInfo.GetGridDetailModel(tabPage); //this.tab_basicInfo.SetGridDataSource(tabPage, MainImpl.GetDataTableResult(ReplaceHelper.ReplaceRowParam(this._baseRowData, detailModel.DetailSql))); bool isDetailAttach = (detailModel.IsReadOnly || detailModel.IsChart); if (tabPage.Tag is GridControlEx) { string sqlValue = isDetailAttach ? detailModel.DetailSql : GetSearchSql(detailModel); GridControlEx grdExMain = (tabPage.Tag as GridControlEx); if (!isDetailAttach) grdExMain.LastSearchSql = sqlValue; this.tab_basicInfo.SetGridDataSource(tabPage, MainImpl.GetDataTableResult(ReplaceHelper.ReplaceRowParam(this._baseRowData, sqlValue))); } else if (tabPage.Tag is TabMultipledetails) { TabMultipledetails tabMultipledetails = tabPage.Tag as TabMultipledetails; tabMultipledetails.SetConditionValues(this._baseRowData); GridControlEx grdExMain = (tabMultipledetails.SplitMain.Panel1.Tag as GridControlEx); GridDetailModel MainModel = grdExMain.Tag as GridDetailModel; string searchMainSql = ReplaceHelper.ReplaceRowParam(this._baseRowData, isDetailAttach ? MainModel.DetailSql : GetSearchSql(MainModel)); DataTable firstTable = MainImpl.GetDataTableResult(searchMainSql); grdExMain.LastSearchSql = searchMainSql; grdExMain.SetGridViewDataSource(firstTable); if (tabMultipledetails.SplitMain.Panel2.Tag is GridControlEx) { GridControlEx grdExAdditional = (tabMultipledetails.SplitMain.Panel2.Tag as GridControlEx); GridDetailModel AdditionalModel = grdExAdditional.Tag as GridDetailModel; string searchAddSql = ReplaceHelper.ReplaceRowParam(this._baseRowData, isDetailAttach ? AdditionalModel.DetailSql : GetSearchSql(AdditionalModel)); if (!MainModel.IsUnioDetail) { grdExAdditional.LastSearchSql = searchAddSql; grdExAdditional.SetGridViewDataSource(MainImpl.GetDataTableResult(searchAddSql)); } //右侧是左侧的明细,左侧没有数据时。右侧赋空值(因为无法触发左侧行改变事件) if (MainModel.IsUnioDetail && firstTable.Rows.Count == 0) { grdExAdditional.LastSearchSql = ""; grdExAdditional.SetGridViewDataSource(new DataTable()); } } else if (tabMultipledetails.SplitMain.Panel2.Tag is ChartControlEx) { ChartControlEx grdExAdditional = (tabMultipledetails.SplitMain.Panel2.Tag as ChartControlEx); GridDetailModel AdditionalModel = grdExAdditional.Tag as GridDetailModel; string searchAddSql = this.GetSearchSql(AdditionalModel); DataTable table = MainImpl.GetDataTableResult(searchAddSql); grdExAdditional.CreateChart(table); } } } } } else { MessageUtil.Show(ResourceKeys.UnUpdateData); } } if (this.ModuleModelObj.SaveSuccessfullyRefresh && !isSuccess) return;//保存成功才刷新 // 刷新主表 this._flowRowData = BaseAuditImpl.GetCurrentFlowRowData(this.ModuleModelObj.MenuTable, this.ModuleModelObj.ParmaryKey, this.SysModel.PrimaryValue); this.UpdateCirculationData(); this._baseRowData = BaseAuditImpl.GetCurrentControlData(ReplaceHelper.ReplaceWhereCond(ReplaceHelper.ReplaceUserInfo(this.ModuleModelObj.MenuSql)), this.ModuleModelObj.ParmaryKey, this.SysModel.PrimaryValue); if (this._baseRowData == null) this._baseRowData = this._flowRowData; this.ControlObj.CanExecControl = false; this.ControlObj.SetAllControlValue(this._baseRowData);//刷新表头数据 this.ControlObj.CanExecControl = true; } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } #endregion #region 退出表单 /// /// 说明:退出表单 /// 创建人:龚宇超 /// 创建日期:2017-12-21 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The source of the event. /// The instance containing the event data. private void btnCancel_Click(object sender, EventArgs e) { try { this.DialogResult = DialogResult.No; } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } #endregion #region 审核 /// /// 说明:提醒审核审核 /// 创建人:王一帆 /// 创建日期:2020-08-20 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The source of the event. /// The instance containing the event data. private void btnRemindAudit_Click(object sender, EventArgs e) { try { if (VerificationRequired()) return; if (this.SysModel.ConfirmId == "1") { if (BaseAuditImpl.SetBaseFlowComfirm(this.SysModel.UserId, this.SysModel.ModuleCode, this.SysModel.PrimaryValue, this.txt_remark.Text) > 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; FrmRemindSelectForm formRemind = new FrmRemindSelectForm(); formRemind.KeyValue = this.SysModel.PrimaryValue; formRemind.MenuCode = this.SysModel.ModuleCode; isAudit = formRemind.ShowDialog() == DialogResult.Yes; confirmOpers = formRemind.ConfirmOpers; remindOpers = formRemind.RemindOpers; if (isAudit) { if (this.ControlObj.VerifyNull()) { if (!this.ControlObj.isRequiredFields(this.AccditModelObj.RequiredFields)) return; string parmaryValue = this.SysModel.PrimaryValue; if (this.ControlObj.SaveBaseModuleData(this.SysModel.ModuleCode, this.ModuleModelObj.MenuTable, this.ModuleModelObj.ParmaryKey, ref parmaryValue, false, "", false, this.ModuleModelObj.NewVer)) { AuditChangeLog.SaveHeaderChangeLog(this._baseRowData, this.ControlObj, parmaryValue, this.SysModel.StepCode, ERPInfo.Instance.UserId); //string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, this.SysModel, this.SysModel.StepCode, this.SysModel.PrimaryValue, "", this.BaseAuditModelObj.ProcedureName, "F", this._flowTypeStepModel.RemindSelect, this.txt_remark.Text, remindOpers, confirmOpers); //string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, out string msgText,this.SysModel, this.SysModel.StepCode, this.SysModel.PrimaryValue, "", this.BaseAuditModelObj.ProcedureName, "F", this._flowTypeStepModel.RemindSelect, this.txt_remark.Text, remindOpers, confirmOpers); string result = this.AuditMethod(out nextSelectStepCode, out nextSelectStepOper, out string msgText, this.SysModel, this.SysModel.StepCode, this.SysModel.PrimaryValue, "", this.BaseAuditModelObj.ProcedureName, "F", this._flowTypeStepModel.RemindSelect, this.txt_remark.Text, remindOpers, confirmOpers); if ("1".Equals(result)) { //推送消息 PushHelper push = new PushHelper(this.SysModel.PrimaryValue, this.SysModel.StepCode, this.SysModel.ModuleCode, this._beforeUsers, this._beforeMenuName, this._beforeId); push.Push_Base_Oper_Message(); this.DialogResult = DialogResult.OK; if (refreshThePage != null) { refreshThePage("审核成功", ERPInfo.Instance.PageControl.SelectedTabPage.Tag + ""); } else { //上一次点开page 当前打开page删除后要选中的page if (ERPInfo.Instance.PageControl != null) { string id = ERPInfo.Instance.PageControl.SelectedTabPage.Tag + ""; XtraTabPage beforePage = ERPInfo.Instance.ModuleForms[id].BeforePage; if (beforePage != null) { //MessageUtil.Show("审核成功"); //要删除的page XtraTabPage removePage = new XtraTabPage(); ERPInfo.Instance.ModuleForms.Remove(id); foreach (XtraTabPage tablepage in ERPInfo.Instance.PageControl.TabPages) { if (tablepage.Tag == null) continue; if (tablepage.Tag.ToString().Equals(id)) removePage = tablepage; if (tablepage == beforePage) ERPInfo.Instance.PageControl.SelectedTabPage = beforePage; } ERPInfo.Instance.PageControl.TabPages.Remove(removePage); removePage.Dispose(); } } } } else { if (!"9".Equals(result)) MessageUtil.Show(ResourceKeys.AuditFail + "\r\n" + msgText); } } } } } } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } /// /// 说明:审核 /// 创建人:龚宇超 /// 创建日期:2017-12-21 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The source of the event. /// The instance containing the event data. private void btnAudit_Click(object sender, EventArgs e) { try { //下方页签保存 if (this.ModuleModelObj.ReviewSaveAdditional) { this.SaveAdditionalModules(); } if (this.DetailsRequired) { foreach (XtraTabPage page in this.tab_basicInfo.TabControlObj.TabPages) { GridDetailModel model = this.tab_basicInfo.GetGridDetailModel(page); bool isDetailAttach = (model.IsReadOnly || model.IsChart); if (page.Tag is GridControlEx) { string sqlValue = isDetailAttach ? model.DetailSql : GetSearchSql(model); GridControlEx grdExMain = (page.Tag as GridControlEx); if (!isDetailAttach) grdExMain.LastSearchSql = sqlValue; this.tab_basicInfo.SetGridDataSource(page, MainImpl.GetDataTableResult(ReplaceHelper.ReplaceRowParam(this._baseRowData, sqlValue))); if(!string.IsNullOrWhiteSpace(grdExMain.RequiredFields) &&!grdExMain.GridControl.isRequiredFields(grdExMain.RequiredFields, grdExMain.GridView)) return; } } } if (VerificationRequired()) return; WaitForm.ShowForm(ResourceKeys.Handing); string nextSelectStepCode = string.Empty; string nextSelectStepOper = string.Empty; if (this.SysModel.ConfirmId == "1") { if (BaseAuditImpl.SetBaseFlowComfirm(this.SysModel.UserId, this.SysModel.ModuleCode, this.SysModel.PrimaryValue, this.txt_remark.Text) > 0) { MessageUtil.Show(ResourceKeys.ConfirmSuccess); this.Close(); } else { MessageUtil.Show(ResourceKeys.ConfirmFail); } } else { string confirmOpers = string.Empty, remindOpers = string.Empty; if (SystemInfo.Instance.auditComfirmOpers.Split(',').Contains(ERPInfo.Instance.UserName) || "1".Equals(SystemInfo.Instance.auditComfirmOpers)) { if (MessageUtil.Show(string.Format(ResourceKeys.ConfirmIsAudit), MessageBoxButtons.YesNo) == DialogResult.No) { return; } } if (this.ControlObj.VerifyNull()) { if (!this.ControlObj.isRequiredFields(this.AccditModelObj.RequiredFields)) return; string parmaryValue = this.SysModel.PrimaryValue; if (this.ControlObj.SaveBaseModuleData(this.SysModel.ModuleCode, this.ModuleModelObj.MenuTable, this.ModuleModelObj.ParmaryKey, ref parmaryValue, false, "", false, this.ModuleModelObj.NewVer)) { AuditChangeLog.SaveHeaderChangeLog(this._baseRowData, this.ControlObj, parmaryValue, this.SysModel.StepCode, ERPInfo.Instance.UserId); string opinion = this.txt_remark.Text;//审核意见 if (this.combox_Suggestion.EditText.Equals("不同意")) { opinion = this.combox_Suggestion.EditText + "^" + opinion; } //审核前调用Api if (ApiHelper.IsExecEventApi(Interface.Api.OperateEvent.BeforeModuleAuditStateChange, this.SysModel.ModuleCode, 0)) { ApiHelper apiHelper = new ApiHelper(this.SysModel.ModuleCode, parmaryValue, this.ModuleModelObj.ParmaryKey, this.ModuleModelObj.MenuTable, 0); apiHelper.OnEvent(Interface.Api.OperateEvent.BeforeModuleAuditStateChange, Interface.Api.ActionType.Audit);//审核 if (!string.IsNullOrEmpty(apiHelper.apiResutMsg)) { DialogResult dialogResult = MessageUtil.Show(ResourceKeys.AuditFail + "\r\n" + apiHelper.apiResutMsg, MessageBoxButtons.YesNo); return; } } #region 审核前如果存在签章右键则执行上传 if (BaseImpl.HasExistsTable("p_fm_signFileTab") && tab_basicInfo.TabControlObj.TabPages.Count > 0) { XtraTabPage xtraTabPage = tab_basicInfo.TabControlObj.TabPages[0]; System.Windows.Forms.Control control = xtraTabPage.Controls.Find("GridControlEx", true).FirstOrDefault(); if (control != null && control is GridControlEx) { GridControlEx gridControlEx = control as GridControlEx; if (gridControlEx.GridControl.ContextMenuStrip != null) { ToolStripMenuItem singMenu = gridControlEx.GridControl.ContextMenuStrip.Items.Cast().Where(n => n.Tag != null && n.Tag is GridRightMenuModel && (n.Tag as GridRightMenuModel).DllName.Equals("Lskj.PubPdfSign.dll", StringComparison.OrdinalIgnoreCase)).FirstOrDefault(); if (singMenu != null) { GridRightMenuModel menuModel = singMenu.Tag as GridRightMenuModel; DataTable dataTable = gridControlEx.GridControl.DataSourceTable(); if (dataTable.Rows.Count > 0) { DataRow dataRow = dataTable.Rows[0]; string[] args = { menuModel.MenuName, ERPInfo.Instance.UserId, ERPInfo.Instance.UserName, "3", ModuleModelObj.ModeCode, menuModel.DllParam1, AccditModelObj.StepCode, ReplaceHelper.ReplaceRowParam(dataRow, menuModel.DllParam3), ReplaceHelper.ReplaceRowParam(dataRow, menuModel.DllParam4), "2", IsFinishPage ? "1" : "0" }; IForm form = FormHelper.LoadDllForm("Lskj.PubPdfSign.dll", args); if (form != null && form.SubForm != null) { form.SubForm.ShowDialog(); } } } } } } #endregion //string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, this.SysModel, this.SysModel.StepCode, this.SysModel.PrimaryValue, "", this.BaseAuditModelObj.ProcedureName, "F", this._flowTypeStepModel.RemindSelect, opinion, remindOpers, confirmOpers); //string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, out string msgText, this.SysModel, this.SysModel.StepCode, this.SysModel.PrimaryValue, "", this.BaseAuditModelObj.ProcedureName, "F", this._flowTypeStepModel.RemindSelect, opinion, remindOpers, confirmOpers); string result = this.AuditMethod(out nextSelectStepCode, out nextSelectStepOper, out string msgText, this.SysModel, this.SysModel.StepCode, this.SysModel.PrimaryValue, "", this.BaseAuditModelObj.ProcedureName, "F", this._flowTypeStepModel.RemindSelect, opinion, remindOpers, confirmOpers); WaitForm.HideForm(); if ("1".Equals(result)) { //推送消息 PushHelper push = new PushHelper(this.SysModel.PrimaryValue, this.SysModel.StepCode, this.SysModel.ModuleCode, this._beforeUsers, this._beforeMenuName, this._beforeId); push.Push_Base_Oper_Message(); #region 审核成功后调用API if (ApiHelper.IsExecEventApi(Interface.Api.OperateEvent.AfterModuleAuditStateChange, this.SysModel.ModuleCode, 0)) { ApiHelper apiHelper = new ApiHelper(this.SysModel.ModuleCode, parmaryValue, this.ModuleModelObj.ParmaryKey, this.ModuleModelObj.MenuTable, 0); apiHelper.OnEvent(Interface.Api.OperateEvent.AfterModuleAuditStateChange, Interface.Api.ActionType.Audit);//审核 if (!string.IsNullOrEmpty(apiHelper.apiResutMsg)) MessageUtil.Show(apiHelper.apiResutMsg); } #endregion this.DialogResult = DialogResult.OK; if (refreshThePage != null) { refreshThePage("审核成功", ERPInfo.Instance.PageControl.SelectedTabPage.Tag + ""); } else { //上一次点开page 当前打开page删除后要选中的page if (ERPInfo.Instance.PageControl != null) { string id = ERPInfo.Instance.PageControl.SelectedTabPage.Tag + ""; XtraTabPage beforePage = ERPInfo.Instance.ModuleForms[id].BeforePage; if (beforePage != null) { //MessageUtil.Show("审核成功"); //要删除的page XtraTabPage removePage = new XtraTabPage(); ERPInfo.Instance.ModuleForms.Remove(id); foreach (XtraTabPage tablepage in ERPInfo.Instance.PageControl.TabPages) { if (tablepage.Tag == null) continue; if (tablepage.Tag.ToString().Equals(id)) removePage = tablepage; if (tablepage == beforePage) ERPInfo.Instance.PageControl.SelectedTabPage = beforePage; } ERPInfo.Instance.PageControl.TabPages.Remove(removePage); removePage.Dispose(); } } } } else if ("-10".Equals(result)) { DataRow NextStepFlag = BaseAuditImpl.SetUpNextStep(this.SysModel.ModuleCode, this.ModuleModelObj.BillType, this.SysModel.StepCode); if (NextStepFlag != null) { FrmLookupData lookup = new FrmLookupData(); lookup.ModuleCode = this.SysModel.ModuleCode; lookup.BillType = this.ModuleModelObj.BillType; lookup.StepCode = this.SysModel.StepCode; lookup.nextSelectStepCode = nextSelectStepCode; lookup.nextSelectStepCode = nextSelectStepCode; bool isAginAudit = lookup.ShowDialog() == DialogResult.Yes; nextSelectStepCode = lookup.nextSelectStepCode; nextSelectStepCode = lookup.nextSelectStepCode; if (isAginAudit) { //string Aginresult = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, this.SysModel, this.SysModel.StepCode, this.SysModel.PrimaryValue, "", this.BaseAuditModelObj.ProcedureName, "F", this._flowTypeStepModel.RemindSelect, this.txt_remark.Text, remindOpers, confirmOpers, false, 0, 1); string Aginresult = this.AuditMethod(out nextSelectStepCode, out nextSelectStepOper, out msgText, this.SysModel, this.SysModel.StepCode, this.SysModel.PrimaryValue, "", this.BaseAuditModelObj.ProcedureName, "F", this._flowTypeStepModel.RemindSelect, this.txt_remark.Text, remindOpers, confirmOpers, false, 0, 1); } } else { MessageUtil.Show("配置新版审批失败!" + "\r\n" + msgText); } } else { if (!"9".Equals(result)) MessageUtil.Show(ResourceKeys.AuditFail + "\r\n" + msgText); } } } } } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } finally { WaitForm.HideForm(); } } #endregion #region 返退操作 /// /// 说明:提醒返退 /// 创建人:王一帆 /// 创建日期:2020-08-20 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The source of the event. /// The instance containing the event data. private void btnRemindReturn_Click(object sender, EventArgs e) { try { if (VerificationRequired()) return; string nextSelectStepCode = string.Empty; string nextSelectStepOper = string.Empty; int returnd = ExecuteBackSelect(this._baseRowData); if (returnd == -9) return; _auditAdvic = string.IsNullOrWhiteSpace(_auditAdvic) ? txt_remark.Text : string.Empty; if (this.SysModel.StepOver == "1") { //确认审核不通过并反退该单据? if (MessageUtil.Show(string.Format(ResourceKeys.ConfimAuditFailAndReturnBill), MessageBoxButtons.YesNo) == DialogResult.Yes) { //string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, this.SysModel, this.SysModel.StepCode, this.SysModel.PrimaryValue, "", this.BaseAuditModelObj.ProcedureName, "F", this._flowTypeStepModel.RemindSelect, this.txt_remark.Text, "", "", false, returnd, 0, true); //string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, out string msgText, this.SysModel, this.SysModel.StepCode, this.SysModel.PrimaryValue, "", this.BaseAuditModelObj.ProcedureName, "F", this._flowTypeStepModel.RemindSelect, this.txt_remark.Text, "", "", false, returnd, 0, true); string result = this.AuditMethod(out nextSelectStepCode, out nextSelectStepOper, out string msgText, this.SysModel, this.SysModel.StepCode, this.SysModel.PrimaryValue, "", this.BaseAuditModelObj.ProcedureName, "F", this._flowTypeStepModel.RemindSelect, this.txt_remark.Text, "", "", false, returnd, 0, true); if ("1".Equals(result)) { MessageUtil.Show(ResourceKeys.ForcedSuccess); //暂未推送消息 PushHelper push = new PushHelper(this.SysModel.PrimaryValue, this.SysModel.StepCode, this.SysModel.ModuleCode, this._beforeUsers, this._beforeMenuName, this._beforeId); push.Push_Base_Oper_Message(); this.DialogResult = DialogResult.OK; if (refreshThePage != null) { refreshThePage("", ERPInfo.Instance.PageControl.SelectedTabPage.Tag + ""); } else { //上一次点开page 当前打开page删除后要选中的page if (ERPInfo.Instance.PageControl != null) { string id = ERPInfo.Instance.PageControl.SelectedTabPage.Tag + ""; XtraTabPage beforePage = ERPInfo.Instance.ModuleForms[id].BeforePage; if (beforePage != null) { //MessageUtil.Show("审核成功"); //要删除的page XtraTabPage removePage = new XtraTabPage(); ERPInfo.Instance.ModuleForms.Remove(id); foreach (XtraTabPage tablepage in ERPInfo.Instance.PageControl.TabPages) { if (tablepage.Tag == null) continue; if (tablepage.Tag.ToString().Equals(id)) removePage = tablepage; if (tablepage == beforePage) ERPInfo.Instance.PageControl.SelectedTabPage = beforePage; } ERPInfo.Instance.PageControl.TabPages.Remove(removePage); removePage.Dispose(); } } } } else { if (!"9".Equals(result)) MessageUtil.Show(ResourceKeys.ForcedFail + "\r\n" + msgText); } } } else { bool isAudit = true; string confirmOpers = string.Empty, remindOpers = string.Empty; FrmRemindSelectForm formRemind = new FrmRemindSelectForm(); formRemind.KeyValue = this.SysModel.PrimaryValue; formRemind.MenuCode = this.SysModel.ModuleCode; isAudit = formRemind.ShowDialog() == DialogResult.Yes; confirmOpers = formRemind.ConfirmOpers; remindOpers = formRemind.RemindOpers; if (isAudit) { //string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, this.SysModel, this.SysModel.StepCode, this.SysModel.PrimaryValue, "", this.BaseAuditModelObj.ProcedureName, "R", "", _auditAdvic, remindOpers, confirmOpers, true, returnd); //string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, out string msgText,this.SysModel, this.SysModel.StepCode, this.SysModel.PrimaryValue, "", this.BaseAuditModelObj.ProcedureName, "R", "", _auditAdvic, remindOpers, confirmOpers, true, returnd); string result = this.AuditMethod(out nextSelectStepCode, out nextSelectStepOper, out string msgText, this.SysModel, this.SysModel.StepCode, this.SysModel.PrimaryValue, "", this.BaseAuditModelObj.ProcedureName, "R", "", _auditAdvic, remindOpers, confirmOpers, true, returnd); if (result == "1") { MessageUtil.Show(ResourceKeys.ForcedSuccess); //推送消息 PushHelper push = new PushHelper(this.SysModel.PrimaryValue, this.SysModel.StepCode, this.SysModel.ModuleCode, this._beforeUsers, this._beforeMenuName, this._beforeId); push.Push_Base_Oper_Message(); this.DialogResult = DialogResult.OK; if (refreshThePage != null) { refreshThePage("", ERPInfo.Instance.PageControl.SelectedTabPage.Tag + ""); } else { //上一次点开page 当前打开page删除后要选中的page if (ERPInfo.Instance.PageControl != null) { string id = ERPInfo.Instance.PageControl.SelectedTabPage.Tag + ""; XtraTabPage beforePage = ERPInfo.Instance.ModuleForms[id].BeforePage; if (beforePage != null) { //MessageUtil.Show("审核成功"); //要删除的page XtraTabPage removePage = new XtraTabPage(); ERPInfo.Instance.ModuleForms.Remove(id); foreach (XtraTabPage tablepage in ERPInfo.Instance.PageControl.TabPages) { if (tablepage.Tag == null) continue; if (tablepage.Tag.ToString().Equals(id)) removePage = tablepage; if (tablepage == beforePage) ERPInfo.Instance.PageControl.SelectedTabPage = beforePage; } ERPInfo.Instance.PageControl.TabPages.Remove(removePage); removePage.Dispose(); } } } } else { if (!"9".Equals(result)) MessageUtil.Show(string.Format(ResourceKeys.ForcedFail, msgText)); } } } } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } /// /// 说明:返退 /// 创建人:龚宇超 /// 创建日期:2017-12-22 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The source of the event. /// The instance containing the event data. private void btnReturnd_Click(object sender, EventArgs e) { try { if (!string.IsNullOrWhiteSpace(SystemInfo.Instance.AntiAuditUrl) && this.ModuleModelObj.NewVer == 1) { //string url = string.Format("/pages/app/app.html?stepcode=200&id=YQPS250610001&xtype=plugins.BaseAccraditation.AuditBackBox&username={0}&password={1}&dllcoid=", ERPInfo.Instance.UserName, "2383C0ADDCD699FB2CB45079ABB39E3CEF242D98"); string url = ReplaceHelper.ReplaceUserInfo(SystemInfo.Instance.AntiAuditUrl); url = url.Replace("{stepcode}", this.SysModel.StepCode).Replace("{primaryvalue}", this.SysModel.PrimaryValue).Replace("{remark}", txt_remark.Text); string[] defaultArgs = string.Format(ModuleArgs.DefaultArgs, this.SysModel.FormText, this.SysModel.UserId, this.SysModel.UserName, this.SysModel.Privilege, this.SysModel.ModuleCode).Split('~'); string[] menuArgs = new string[] { "", "", url }; string[] args = defaultArgs.Concat(menuArgs).ToArray(); IForm form = FormHelper.LoadDllForm(ResourceDynamic.PubBrower, args); form.SubForm.WindowState = FormWindowState.Normal; DialogResult result = form.SubForm.ShowDialog(); if (result == DialogResult.OK) { this.DialogResult = DialogResult.OK; if (refreshThePage != null) { refreshThePage("", ERPInfo.Instance.PageControl.SelectedTabPage.Tag + ""); } else { //上一次点开page 当前打开page删除后要选中的page if (ERPInfo.Instance.PageControl != null) { string id = ERPInfo.Instance.PageControl.SelectedTabPage.Tag + ""; XtraTabPage beforePage = ERPInfo.Instance.ModuleForms[id].BeforePage; if (beforePage != null) { //MessageUtil.Show("审核成功"); //要删除的page XtraTabPage removePage = new XtraTabPage(); ERPInfo.Instance.ModuleForms.Remove(id); foreach (XtraTabPage tablepage in ERPInfo.Instance.PageControl.TabPages) { if (tablepage.Tag == null) continue; if (tablepage.Tag.ToString().Equals(id)) removePage = tablepage; if (tablepage == beforePage) ERPInfo.Instance.PageControl.SelectedTabPage = beforePage; } ERPInfo.Instance.PageControl.TabPages.Remove(removePage); removePage.Dispose(); } } } } return; } if (VerificationRequired()) return; int returnd = ExecuteBackSelect(this._baseRowData); if (returnd == -9) return; string nextSelectStepCode = string.Empty; string nextSelectStepOper = string.Empty; _auditAdvic = string.IsNullOrWhiteSpace(_auditAdvic) ? txt_remark.Text : _auditAdvic; if (this.SysModel.StepOver == "1") { //确认审核不通过并反退该单据? if (MessageUtil.Show(string.Format(ResourceKeys.ConfimAuditFailAndReturnBill), MessageBoxButtons.YesNo) == DialogResult.Yes) { string parmaryValue = this.SysModel.PrimaryValue; if (this.ControlObj.SaveBaseModuleData(this.SysModel.ModuleCode, this.ModuleModelObj.MenuTable, this.ModuleModelObj.ParmaryKey, ref parmaryValue, false, "", false, this.ModuleModelObj.NewVer)) { AuditChangeLog.SaveHeaderChangeLog(this._baseRowData, this.ControlObj, parmaryValue, this.SysModel.StepCode, ERPInfo.Instance.UserId); //反审前调用Api if (ApiHelper.IsExecEventApi(Interface.Api.OperateEvent.BeforeModuleAuditStateChange, this.SysModel.ModuleCode, 0)) { ApiHelper apiHelper = new ApiHelper(this.SysModel.ModuleCode, parmaryValue, this.ModuleModelObj.ParmaryKey, this.ModuleModelObj.MenuTable, 0); apiHelper.OnEvent(Interface.Api.OperateEvent.BeforeModuleAuditStateChange, Interface.Api.ActionType.AuditBack); if (!string.IsNullOrEmpty(apiHelper.apiResutMsg)) { DialogResult dialogResult = MessageUtil.Show(ResourceKeys.ForcedFail + "\r\n" + apiHelper.apiResutMsg, MessageBoxButtons.YesNo); return; } } //string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, this.SysModel, this.SysModel.StepCode, this.SysModel.PrimaryValue, "", this.BaseAuditModelObj.ProcedureName, "R", "", _auditAdvic, "", "", true, returnd, 0, true); //string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, out string msgText,this.SysModel, this.SysModel.StepCode, this.SysModel.PrimaryValue, "", this.BaseAuditModelObj.ProcedureName, "R", "", _auditAdvic, "", "", true, returnd, 0, true); string result = this.AuditMethod(out nextSelectStepCode, out nextSelectStepOper, out string msgText, this.SysModel, this.SysModel.StepCode, this.SysModel.PrimaryValue, "", this.BaseAuditModelObj.ProcedureName, "R", "", _auditAdvic, "", "", true, returnd, 0, true); if ("1".Equals(result)) { MessageUtil.Show(ResourceKeys.ForcedSuccess); //暂未推送消息 PushHelper push = new PushHelper(this.SysModel.PrimaryValue, this.SysModel.StepCode, this.SysModel.ModuleCode, this._beforeUsers, this._beforeMenuName, this._beforeId); push.Push_Base_Oper_Message(); //反审后调用Api if (ApiHelper.IsExecEventApi(Interface.Api.OperateEvent.AfterModuleAuditStateChange, this.SysModel.ModuleCode, 0)) { ApiHelper apiHelper = new ApiHelper(this.SysModel.ModuleCode, parmaryValue, this.ModuleModelObj.ParmaryKey, this.ModuleModelObj.MenuTable, 0); apiHelper.OnEvent(Interface.Api.OperateEvent.AfterModuleAuditStateChange, Interface.Api.ActionType.AuditBack); if (!string.IsNullOrEmpty(apiHelper.apiResutMsg)) { MessageUtil.Show(apiHelper.apiResutMsg); } } this.DialogResult = DialogResult.OK; if (refreshThePage != null) { refreshThePage("", ERPInfo.Instance.PageControl.SelectedTabPage.Tag + ""); } else { //上一次点开page 当前打开page删除后要选中的page if (ERPInfo.Instance.PageControl != null) { string id = ERPInfo.Instance.PageControl.SelectedTabPage.Tag + ""; XtraTabPage beforePage = ERPInfo.Instance.ModuleForms[id].BeforePage; if (beforePage != null) { //MessageUtil.Show("审核成功"); //要删除的page XtraTabPage removePage = new XtraTabPage(); ERPInfo.Instance.ModuleForms.Remove(id); foreach (XtraTabPage tablepage in ERPInfo.Instance.PageControl.TabPages) { if (tablepage.Tag == null) continue; if (tablepage.Tag.ToString().Equals(id)) removePage = tablepage; if (tablepage == beforePage) ERPInfo.Instance.PageControl.SelectedTabPage = beforePage; } ERPInfo.Instance.PageControl.TabPages.Remove(removePage); removePage.Dispose(); } } } } else { if (!"9".Equals(result)) MessageUtil.Show(ResourceKeys.ForcedFail + "\r\n" + msgText); } } } } else { if (SystemInfo.Instance.backAuditComfirmOpers.Split(',').Contains(ERPInfo.Instance.UserName) || "1".Equals(SystemInfo.Instance.backAuditComfirmOpers)) { if (MessageUtil.Show(string.Format(ResourceKeys.ConfimAuditFailAndReturnBill), MessageBoxButtons.YesNo) == DialogResult.No) { return; } } string confirmOpers = string.Empty, remindOpers = string.Empty; //string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, this.SysModel, this.SysModel.StepCode, this.SysModel.PrimaryValue, "", this.BaseAuditModelObj.ProcedureName, "R", "", _auditAdvic, remindOpers, confirmOpers, true, returnd); //string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, out string msgText, this.SysModel, this.SysModel.StepCode, this.SysModel.PrimaryValue, "", this.BaseAuditModelObj.ProcedureName, "R", "", _auditAdvic, remindOpers, confirmOpers, true, returnd); string result = this.AuditMethod(out nextSelectStepCode, out nextSelectStepOper, out string msgText, this.SysModel, this.SysModel.StepCode, this.SysModel.PrimaryValue, "", this.BaseAuditModelObj.ProcedureName, "R", "", _auditAdvic, remindOpers, confirmOpers, true, returnd); if (result == "1") { MessageUtil.Show(ResourceKeys.ForcedSuccess); //推送消息 PushHelper push = new PushHelper(this.SysModel.PrimaryValue, this.SysModel.StepCode, this.SysModel.ModuleCode, this._beforeUsers, this._beforeMenuName, this._beforeId); push.Push_Base_Oper_Message(); this.DialogResult = DialogResult.OK; if (refreshThePage != null) { refreshThePage("", ERPInfo.Instance.PageControl.SelectedTabPage.Tag + ""); } else { //上一次点开page 当前打开page删除后要选中的page if (ERPInfo.Instance.PageControl != null) { string id = ERPInfo.Instance.PageControl.SelectedTabPage.Tag + ""; XtraTabPage beforePage = ERPInfo.Instance.ModuleForms[id].BeforePage; if (beforePage != null) { //MessageUtil.Show("审核成功"); //要删除的page XtraTabPage removePage = new XtraTabPage(); ERPInfo.Instance.ModuleForms.Remove(id); foreach (XtraTabPage tablepage in ERPInfo.Instance.PageControl.TabPages) { if (tablepage.Tag == null) continue; if (tablepage.Tag.ToString().Equals(id)) removePage = tablepage; if (tablepage == beforePage) ERPInfo.Instance.PageControl.SelectedTabPage = beforePage; } ERPInfo.Instance.PageControl.TabPages.Remove(removePage); removePage.Dispose(); } } } } else { if (!"9".Equals(result)) MessageUtil.Show(string.Format(ResourceKeys.ForcedFail, msgText)); } } } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } /// /// 说明:执行返退选择 /// 创建人:龚宇超 /// 创建日期:2017-12-22 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The row. /// System.Int32. private int ExecuteBackSelect(DataRow row) { if (row == null) { MessageUtil.Show(ResourceKeys.NoFindAntiauditBill); return -9; } if (this.ModuleModelObj.BackSelected == "0") return -1; if (this.SysModel.StepCode == "100") { FrmBackSelect frmBackSelNew = new FrmBackSelect(); //frmBackSelNew.FrmBackSelectEx.StepSelection.Hide(); frmBackSelNew.Sysmodel = this.SysModel; frmBackSelNew.ModuleModelObj = this.ModuleModelObj; frmBackSelNew.FrmBackSelectEx.LabelAdvice.EditText = this.combox_Suggestion.EditText; frmBackSelNew.InitControlSpecial(); if (frmBackSelNew.ShowDialog() != DialogResult.OK) return -9; this._auditAdvic = frmBackSelNew.ComfirmMsg; return 0; } FrmBackSelect frmBackSel = new FrmBackSelect(); frmBackSel.Sysmodel = this.SysModel; frmBackSel.ModuleModelObj = this.ModuleModelObj; frmBackSel.FrmBackSelectEx.LabelAdvice.EditText = this.combox_Suggestion.EditText; frmBackSel.InitControl(); if (frmBackSel.ShowDialog() != DialogResult.OK) return -9; this._auditAdvic = frmBackSel.ComfirmMsg; return frmBackSel.SelectStepCode; } #endregion #region 关闭操作 /// /// 说明:关闭操作 /// 创建人:龚宇超 /// 创建日期:2017-12-21 /// 修改人: /// 修改日期: /// 修改备注: /// 版本: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.AccditModelObj.StepCloseTip) ? MessageUtil.Show(string.Format(this.AccditModelObj.StepCloseTip), MessageBoxButtons.YesNo) == DialogResult.Yes : true) { string nextSelectStepCode = string.Empty; string nextSelectStepOper = string.Empty; //string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, this.SysModel, this.SysModel.StepCode, this.SysModel.PrimaryValue, "", this.BaseAuditModelObj.ProcedureName, "Q", ""); //string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, out string msgText, this.SysModel, this.SysModel.StepCode, this.SysModel.PrimaryValue, "", this.BaseAuditModelObj.ProcedureName, "Q", ""); string result = this.AuditMethod(out nextSelectStepCode, out nextSelectStepOper, out string msgText, this.SysModel, this.SysModel.StepCode, this.SysModel.PrimaryValue, "", this.BaseAuditModelObj.ProcedureName, "Q", ""); if ("1".Equals(result)) { MessageUtil.Show(ResourceKeys.CloseSuccess); this.DialogResult = DialogResult.OK; } else { if (!"9".Equals(result)) MessageUtil.Show(ResourceKeys.CloseFail + "\r\n" + msgText); } } } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } #endregion #region 分割条位置改变 /// /// 说明:分割条位置改变事件 /// 创建人:龚宇超 /// 创建日期:2017-12-21 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void splitContainer_SplitterPositionChanged(object sender, EventArgs e) { try { if (_isInitFinish) { IniHelper.Write(string.Format("base_SplitterPositionLeft_{0}", this.SysModel.ModuleCode), this.splitContainer.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 #region 分割条位置改变 /// /// 说明:获取查询条件 /// 创建人:王一帆 /// 创建日期:2021-01-22 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The model. /// The row item. /// System.String. protected string GetSearchSql(GridDetailModel model) { string unionPatentValue = !string.IsNullOrEmpty(model.UnionParentField) && _baseRowData != null && _baseRowData.Table.Columns.Contains(model.UnionParentField) ? _baseRowData[model.UnionParentField] + "" : this.ModuleModelObj.ParmaryKey; string sqlValue = model.IsReadOnly || model.IsChart ? model.DetailSql : model.SystemModel.MenuSql; if (ReplaceHelper.IsSelect(sqlValue) && !string.IsNullOrEmpty(model.UnionValue)) { sqlValue = ReplaceHelper.ReplaceWhereCond(sqlValue) + string.Format(" and {0}='{1}'", model.UnionValue, unionPatentValue); } if (!string.IsNullOrEmpty(model.UnionCond)) { string UnionCond = ReplaceHelper.ReplaceRowParam(this._baseRowData, model.UnionCond); sqlValue +=UnionCond; } return sqlValue; } #endregion private void simpleButton1_Click(object sender, EventArgs e) { try { WebBrowserUtil.StartWebBrowser(this.SysModel.ModuleCode, mRowItem["ToolsName"] + ""); } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } private bool VerificationRequired() { bool results = false; if (SystemInfo.Instance.ReviewCommentsRequired && string.IsNullOrWhiteSpace(this.txt_remark.Text)) { MessageUtil.Show("请输入审核意见"); results = true; } return results; } /// /// 审核或反审 /// public string AuditMethod(out string nextSelectStepCode, out string nextSelectStepOper, out string msgText, DynamicModel sysModel, string stepCode, string billDocumentId, string message, string storedName, string accractFlag, string remindSelect, string remarkText = "", string remindOpers = "", string confirmOpers = "", bool ret = false, int returnd = 0, int selectConfirmFlag = 0, bool IsStepOver = false, int comfirm = 0 ) { string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, out msgText, sysModel, stepCode, billDocumentId, message, storedName, accractFlag, remindSelect, remarkText, remindOpers, confirmOpers, ret, returnd, selectConfirmFlag, IsStepOver, comfirm); if ("9".Equals(result)) { // 继续执行保存 //if (string.IsNullOrWhiteSpace(msgText)) msgText = "失败"; if (MessageUtil.Show(msgText, MessageBoxButtons.YesNo) == DialogResult.Yes) result = AuditMethod(out nextSelectStepCode, out nextSelectStepOper, out msgText, sysModel, stepCode, billDocumentId, message, storedName, accractFlag, remindSelect, remarkText, remindOpers, confirmOpers, ret, returnd, selectConfirmFlag, IsStepOver, 1); } return result; } /// /// 保存所有附加模块 /// /// public void SaveAdditionalModules() { try { foreach (XtraTabPage tabPage in this.tab_basicInfo.TabControlObj.TabPages) { GridDetailModel model = this.tab_basicInfo.GetGridDetailModel(tabPage); Object moduleObject = tabPage.Controls.Cast().FirstOrDefault(); if (moduleObject is ModuleGridEx) { ModuleGridEx moduleGridEx = moduleObject as ModuleGridEx; if (moduleGridEx.GridControlObj.IsDataNotSaved() && moduleGridEx.BtnSave.Visible && moduleGridEx.BtnSave.Enabled) { moduleGridEx.BtnSave.PerformClick(); } } } } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } /// /// 设置修改过的控件颜色 /// public void SetColor() { List FieldList = AuditChangeLog.GetChangeLogFields(this.SysModel.PrimaryValue); foreach (string item in FieldList) { this.ControlObj.SetBackgroundColor(item); } } /// /// 更新当前流转数据 /// public void UpdateCirculationData() { if (SystemInfo.Instance.IsSpecialAuditSave) { DataTable snapshotTable = this._flowRowData.Table.Clone(); DataRow snapshotRow = snapshotTable.NewRow(); snapshotRow.ItemArray = (object[])this._flowRowData.ItemArray.Clone(); snapshotTable.Rows.Add(snapshotRow); snapshotTable.AcceptChanges(); this.ControlObj.beforeData = snapshotRow; } } } }