From 50d6f08cb6faf57da51125e9ed4903492ed8b911 Mon Sep 17 00:00:00 2001 From: cyf Date: Mon, 5 Jan 2026 02:02:39 +0000 Subject: [PATCH] SVN r1089 SVN-Revision: r1089 --- 插件库/Lskj.Control/Model/CommonMenu.cs | 87 ++++++++++----- 插件库/Lskj.Control/Model/ControlType.cs | 11 ++ 插件库/Lskj.Control/Model/GridExtend.cs | 68 +++++++----- .../Model/MenuStrip/BaseMenuStrip.cs | 48 +++++++-- .../Model/MenuStrip/GridViewMenuStrip.cs | 9 +- 插件库/Lskj.Control/Model/MyControl.cs | 100 +++++++++++++++--- 插件库/Lskj.Control/Model/StaticControl.cs | 18 +++- 7 files changed, 258 insertions(+), 83 deletions(-) diff --git a/插件库/Lskj.Control/Model/CommonMenu.cs b/插件库/Lskj.Control/Model/CommonMenu.cs index 7c117ad..76d7974 100644 --- a/插件库/Lskj.Control/Model/CommonMenu.cs +++ b/插件库/Lskj.Control/Model/CommonMenu.cs @@ -80,6 +80,30 @@ namespace Lskj.Control.Model GridRightMenuModel model = new GridRightMenuModel(rowItem); + //if (!string.IsNullOrWhiteSpace(model.MenuCond)) + //{ + // try + // { + // string cond = ReplaceHelper.ReplaceUserInfo(model.MenuCond); + // if (this._controlObj != null) + // { + // cond = _controlObj.ReplaceControlValue(model.MenuCond); + // } + // if (BaseGridView != null && BaseGridView.GetFocusedDataRow() != null) + // { + // DataRow parentitem = BaseGridView.GetFocusedDataRow(); + // cond = ReplaceHelper.ReplaceRowParam(parentitem, cond) + ""; + // } + // bool result = ReplaceHelper.EvalCond(cond); + // if (!result) return false; + // } + // catch (Exception) + // { + // MessageUtil.Show(ResourceKeys.SetRightMenuCondFault); + // } + //} + + if (!string.IsNullOrWhiteSpace(model.BeforeMsg)) { string prompt = this._controlObj.ReplaceControlValue(model.BeforeMsg); @@ -108,6 +132,12 @@ namespace Lskj.Control.Model if (applyArgs.CancelFlag) return false; List paramList = HandleRightMenuParams(model.ParamList); + string maintabFocusedRowJson = ""; + if (BaseGridView != null && BaseGridView.GetFocusedDataRow() != null) + { + maintabFocusedRowJson = BaseGridView.GetFocusedDataRow().ToJsonObject(); // 假设 ToJsonObject() 是将对象转换为 JSON 字符串的方法 + } + paramList.Add(maintabFocusedRowJson); string dllName = this._controlObj.ReplaceControlValue(model.DllName).Trim(); if (BaseGridView != null && BaseGridView.GetFocusedDataRow() != null) { @@ -310,9 +340,9 @@ namespace Lskj.Control.Model } break; default: - if (ReturnStoredProcedureValue != null) + if (ReturnStoredProcedureValue != null) { - ReturnStoredProcedureValue(pMsg.Value+""); + ReturnStoredProcedureValue(pMsg.Value + ""); } MessageUtil.Show(ResourceKeys.OperSuccess); break; @@ -355,7 +385,7 @@ namespace Lskj.Control.Model /// 版本:1.0 /// /// true if XXXX, false otherwise. - private bool ExecDynamicLinkLibary(GridRightMenuModel model, List paramList, DataRow rowItem,string dllname) + private bool ExecDynamicLinkLibary(GridRightMenuModel model, List paramList, DataRow rowItem, string dllname) { issuccess = true; if (string.IsNullOrWhiteSpace(dllname)) @@ -388,30 +418,33 @@ namespace Lskj.Control.Model break; default: List str = new List - { - _model.FormText, - ERPInfo.Instance.UserId, - ERPInfo.Instance.UserName, - "3", - _model.ModuleCode, - paramList[0], - paramList[1], - paramList[2], - paramList[3], - paramList[4], - paramList[5], - paramList[6], - paramList[7], - paramList[8], - paramList[9] - }; - string maintabFocusedRowJson = ""; - if (BaseGridView != null && BaseGridView.GetFocusedDataRow() != null) - { - maintabFocusedRowJson = BaseGridView.GetFocusedDataRow().ToJsonObject(); // 假设 ToJsonObject() 是将对象转换为 JSON 字符串的方法 - } - str.Add(maintabFocusedRowJson); // 现在可以添加元素了,因为 str 是 List - // 假设你需要将 List 转回字符串数组,可以这样操作 + { + _model.FormText, + ERPInfo.Instance.UserId, + ERPInfo.Instance.UserName, + "3", + _model.ModuleCode, + paramList[0], + paramList[1], + paramList[2], + paramList[3], + paramList[4], + paramList[5], + paramList[6], + paramList[7], + paramList[8], + paramList[9], + paramList[10], + paramList[11], + paramList[12]//固定添加行数据json字符串 + }; + //string maintabFocusedRowJson = ""; + //if (BaseGridView != null && BaseGridView.GetFocusedDataRow() != null) + //{ + // maintabFocusedRowJson = BaseGridView.GetFocusedDataRow().ToJsonObject(); // 假设 ToJsonObject() 是将对象转换为 JSON 字符串的方法 + //} + //str.Add(maintabFocusedRowJson); // 现在可以添加元素了,因为 str 是 List + // // 假设你需要将 List 转回字符串数组,可以这样操作 string[] strArray = str.ToArray(); IForm form = FormHelper.LoadDllForm(dllname, strArray); if (form == null) diff --git a/插件库/Lskj.Control/Model/ControlType.cs b/插件库/Lskj.Control/Model/ControlType.cs index 6d92ae0..8cc8174 100644 --- a/插件库/Lskj.Control/Model/ControlType.cs +++ b/插件库/Lskj.Control/Model/ControlType.cs @@ -188,6 +188,17 @@ namespace Lskj.Control.Model /// public const int LabCheckAutoSeacherText = 26; + /// + /// 自动搜索框(带复选框,带参数),保存Value值,显示Text值 + /// + public const int LabAutoCompleteCheckParamValue = 215; + /// + /// 自动搜索框(带复选框,带参数),保存Text值,显示Text值 + /// + public const int LabAutoCompleteCheckParamText = 216; + + + /// /// 计算器 /// diff --git a/插件库/Lskj.Control/Model/GridExtend.cs b/插件库/Lskj.Control/Model/GridExtend.cs index b0e1e0c..e63c48b 100644 --- a/插件库/Lskj.Control/Model/GridExtend.cs +++ b/插件库/Lskj.Control/Model/GridExtend.cs @@ -49,6 +49,7 @@ using DevExpress.Data; using DevExpress.Data.Filtering; using System.Data.SqlClient; using DevExpress.Utils; +using System.Data.Common; namespace Lskj.Control.Model { @@ -472,11 +473,13 @@ namespace Lskj.Control.Model { try { - if (!BaseImpl.HasExistsColumn(ResourceKeys.SettingTableName, "IfFixColumn")) + DataTable dataTable = BaseImpl.GetTableColumns(ResourceKeys.SettingTableName); + + if (!dataTable.Columns.Contains("IfFixColumn")) { BaseImpl.ExecSqlValue("alter table " + ResourceKeys.SettingTableName + " add IfFixColumn bit"); } - if (!BaseImpl.HasExistsColumn(ResourceKeys.SettingTableName, "FieldText")) + if (!dataTable.Columns.Contains("FieldText")) { BaseImpl.ExecSqlValue("alter table " + ResourceKeys.SettingTableName + " add FieldText varchar(100)"); } @@ -488,20 +491,20 @@ namespace Lskj.Control.Model bool isDisplayFiltering = false; string saveFieldName = string.Empty; //分组号 - if (BaseImpl.HasExistsColumn(ResourceKeys.SettingTableName, "GroupIndex")) + if (dataTable.Columns.Contains("GroupIndex")) { isGroupIndex = true; saveFieldName = ",GroupIndex"; } //列筛选条件 - if (BaseImpl.HasExistsColumn(ResourceKeys.SettingTableName, "FilterInfo")) + if (dataTable.Columns.Contains("FilterInfo")) { isFilterInfo = true; saveFieldName += ",FilterInfo"; } //是否显示筛选行 - if (BaseImpl.HasExistsColumn(ResourceKeys.SettingTableName, "DisplayFiltering")) + if (dataTable.Columns.Contains("DisplayFiltering")) { isDisplayFiltering = true; saveFieldName += ",DisplayFiltering"; @@ -554,14 +557,18 @@ namespace Lskj.Control.Model public static bool UpdateCustomColumnToDatabase(this BandedGridView gridView, string key) { if (string.IsNullOrEmpty(key)) return false; - if (!BaseImpl.HasExistsColumn(ResourceKeys.SettingTableName, "IfFixColumn")) + + DataTable dataTable = BaseImpl.GetTableColumns(ResourceKeys.SettingTableName); + + if (!dataTable.Columns.Contains("IfFixColumn")) { BaseImpl.ExecSqlValue("alter table " + ResourceKeys.SettingTableName + " add IfFixColumn bit"); } - if (!BaseImpl.HasExistsColumn(ResourceKeys.SettingTableName, "FieldText")) + if (!dataTable.Columns.Contains("FieldText")) { BaseImpl.ExecSqlValue("alter table " + ResourceKeys.SettingTableName + " add FieldText varchar(100)"); } + string sqlValue = string.Format("select * from {0} where formKey='{1}' and OperatorId='{2}'", ResourceKeys.SettingTableName, key, ERPInfo.Instance.UserId); DataTable customTable = SqlHelper.ExecuteDataTable(sqlValue); StringBuilder sBuilder = new StringBuilder(); @@ -584,7 +591,7 @@ namespace Lskj.Control.Model saveFieldName += ",FilterInfo"; } //是否显示筛选行 - if (BaseImpl.HasExistsColumn(ResourceKeys.SettingTableName, "DisplayFiltering")) + if (customTable.Columns.Contains("DisplayFiltering")) { isDisplayFiltering = true; saveFieldName += ",DisplayFiltering"; @@ -636,7 +643,9 @@ namespace Lskj.Control.Model { try { - if (!BaseImpl.HasExistsColumn(ResourceKeys.SettingTableName, "IfFixColumn")) + DataTable dataTable = BaseImpl.GetTableColumns(ResourceKeys.SettingTableName); + + if (!dataTable.Columns.Contains("IfFixColumn")) { BaseImpl.ExecSqlValue("alter table " + ResourceKeys.SettingTableName + " add IfFixColumn bit"); } @@ -648,20 +657,20 @@ namespace Lskj.Control.Model bool isDisplayFiltering = false; string saveFieldName = string.Empty; //分组号 - if (BaseImpl.HasExistsColumn(ResourceKeys.SettingTableName, "GroupIndex")) + if (dataTable.Columns.Contains("GroupIndex")) { isGroupIndex = true; saveFieldName = ",GroupIndex"; } //列筛选条件 - if (BaseImpl.HasExistsColumn(ResourceKeys.SettingTableName, "FilterInfo")) + if (dataTable.Columns.Contains("FilterInfo")) { isFilterInfo = true; saveFieldName += ",FilterInfo"; } //是否显示筛选行 - if (BaseImpl.HasExistsColumn(ResourceKeys.SettingTableName, "DisplayFiltering")) + if (dataTable.Columns.Contains("DisplayFiltering")) { isDisplayFiltering = true; saveFieldName += ",DisplayFiltering"; @@ -767,7 +776,7 @@ namespace Lskj.Control.Model saveFieldName += ",FilterInfo"; } //是否显示筛选行 - if (BaseImpl.HasExistsColumn(ResourceKeys.SettingTableName, "DisplayFiltering")) + if (customTable.Columns.Contains("DisplayFiltering")) { isDisplayFiltering = true; saveFieldName += ",DisplayFiltering"; @@ -1436,7 +1445,6 @@ namespace Lskj.Control.Model //} - switch (fileExt) { case ".xls": @@ -1452,6 +1460,7 @@ namespace Lskj.Control.Model } else { + newControl.ExportToXls(dialog.FileName, xlsOptionsEx); //control.ExportToXls(dialog.FileName); } @@ -2043,7 +2052,8 @@ namespace Lskj.Control.Model /// 版本:1.0.0.3 /// /// The col fields. - public static DataTable ToExcelDataTable(this GridView gridView, string fileName, string colFields, bool isDirectImport = false, bool isBillImport = false) + /// 导入时是否触发关联计算(模块配置) + public static DataTable ToExcelDataTable(this GridView gridView, string fileName, string colFields, bool isDirectImport = false, bool isBillImport = false,bool AutoImportCalMode = false) { DataTable table = new DataTable(); int index = gridView is BandedGridView ? 1 : 0; @@ -2054,7 +2064,6 @@ namespace Lskj.Control.Model int CurrentColumn = 0;//当前列数 string columnName = string.Empty;//当前列名 bool ToAssignment = false;//是否在给新表赋值 - try { ISheet sheet = ExcelHelper.GetSheet(fileName); @@ -2130,7 +2139,8 @@ namespace Lskj.Control.Model if (colFields.IndexOf("lskjimport_errorFlag") != -1 && !table.Columns.Contains("lskjimport_errorFlag")) table.Columns.Add("lskjimport_errorFlag"); - bool AutoImportCal = SystemInfo.Instance.AutoImportCal;//是否执行 关联和计算公式 + + bool AutoImportCal = SystemInfo.Instance.AutoImportCal|| AutoImportCalMode;//是否执行 关联和计算公式 //bool ImportDefaultValue= SystemInfo.Instance.ImportDefaultValue;//是否为空单元格添加默认值 //bool isImportRows = true;//是否是导入行(如果是合计行就不触发默认值) // 添加行 @@ -2239,8 +2249,8 @@ namespace Lskj.Control.Model } else { - dataRow[col.FieldName] = cell.NumericCellValue; - + string customFormattedValue = string.Format("{0:" + "#################0.#################" + "}", cell.NumericCellValue); + dataRow[col.FieldName] = customFormattedValue; if (AutoImportCal) { if (!string.IsNullOrEmpty(model.UnionFields)) @@ -2410,7 +2420,7 @@ namespace Lskj.Control.Model catch (IOException exe) { //string Message = ErrorMessage.PromptErrorMessage(exe); - //MessageUtil.Show(Message, exe.Message); + //MessageUtil.Show(exe.Message); MessageUtil.Show(string.Format(ResourceKeys.UseingFile, Path.GetFileName(fileName))); } catch (Exception ex) @@ -2435,7 +2445,8 @@ namespace Lskj.Control.Model /// 版本:1.0.0.3 /// /// The col fields. - public static DataTable ToExcelTreeDataTable(this TreeList treeList, string fileName, string colFields, bool isDirectImport = false, bool isBillImport = false) + /// 导入时是否触发关联计算(模块配置) + public static DataTable ToExcelTreeDataTable(this TreeList treeList, string fileName, string colFields, bool isDirectImport = false, bool isBillImport = false, bool AutoImportCalMode = false) { DataTable table = new DataTable(); isBillImport = isBillImport; @@ -2495,7 +2506,7 @@ namespace Lskj.Control.Model if (colFields.IndexOf("lskjimport_errorFlag") != -1 && !table.Columns.Contains("lskjimport_errorFlag")) table.Columns.Add("lskjimport_errorFlag"); - bool AutoImportCal = SystemInfo.Instance.AutoImportCal;//是否执行 计算公式 + bool AutoImportCal = SystemInfo.Instance.AutoImportCal|| AutoImportCalMode;//是否执行 计算公式 //bool ImportDefaultValue= SystemInfo.Instance.ImportDefaultValue;//是否为空单元格添加默认值 //bool isImportRows = true;//是否是导入行(如果是合计行就不触发默认值) // 添加行 @@ -2846,7 +2857,7 @@ namespace Lskj.Control.Model string fileName = dialog.FileName; string colFields = gridControlEx.GridView.Columns.ToString(','); - ImportTable = gridControlEx.GridView.ToExcelDataTable(fileName, colFields, true); + ImportTable = gridControlEx.GridView.ToExcelDataTable(fileName, colFields, true,false, SysModel.AutoImportCalMode); if (ImportTable == null && ImportTable.Rows.Count < 1) @@ -2948,8 +2959,11 @@ namespace Lskj.Control.Model try { string sql = "select * from " + SysModel.MenuTable + " where 1<>1"; - SqlDataAdapter dat = BaseImpl.GetAdapterResult(sql); - SqlCommandBuilder scb = new SqlCommandBuilder(dat); + + DbDataAdapter dat = BaseImpl.GetAdapterResult(sql); + DbCommandBuilder cb = SqlHelper.dbFactory.CreateCommandBuilder(); + cb.DataAdapter = dat; + // SqlCommandBuilder scb = new SqlCommandBuilder(dat); DataTable datatb = new DataTable(); DataTable failedData = new DataTable(); dat.Fill(datatb); @@ -3185,7 +3199,7 @@ namespace Lskj.Control.Model string sqlValue = string.Format("update {0} set {1}='0' ", SysModel.MenuTable, _importFlag); sqlValue = string.Format("update {0} set {1}='0' where {1}!='0' ", SysModel.MenuTable, _importFlag); SqlHelper.ExecuteNonQuery(sqlValue); - + if (!string.IsNullOrWhiteSpace(SysModel.afterimportSql2) && failed == 0 && datatb.Rows.Count > 0) { try @@ -3668,7 +3682,7 @@ namespace Lskj.Control.Model // MessageUtil.Show(string.Format("明细列:{0}不能为空!", gridView.Columns[requiredField].Caption)); // return false; //} - + for (int i = 0; i < dt.Rows.Count; i++) { if (string.IsNullOrWhiteSpace(gridView.GetRowCellDisplayText(i, requiredField))) diff --git a/插件库/Lskj.Control/Model/MenuStrip/BaseMenuStrip.cs b/插件库/Lskj.Control/Model/MenuStrip/BaseMenuStrip.cs index 42c612c..e8caa66 100644 --- a/插件库/Lskj.Control/Model/MenuStrip/BaseMenuStrip.cs +++ b/插件库/Lskj.Control/Model/MenuStrip/BaseMenuStrip.cs @@ -9,6 +9,7 @@ ******************************/ using DevExpress.Utils; using DevExpress.Utils.Menu; +using DevExpress.XtraGrid.Columns; using DevExpress.XtraGrid.Views.Base; using DevExpress.XtraGrid.Views.Grid; using DevExpress.XtraTab; @@ -97,7 +98,24 @@ namespace Lskj.Control.Model this.Model = model; this.ControlObj = control; - if ((table == null || table.Rows.Count == 0) && menu == null) return; + //判断是否存在网址框(需要绑定右键打开事件判断是否生成 网址框右键) + bool existLabWWW = false; + if (view is GridControlEx) + { + GridControlEx grid= view as GridControlEx; + foreach (GridColumn item in grid.GridView.Columns) + { + if (item.Tag is GridColumnModel) + { + GridColumnModel gridColumnModel = item.Tag as GridColumnModel; + if (gridColumnModel.FieldType == ControlType.LabWWW) existLabWWW = true; + } + + } + } + + + if (((table == null || table.Rows.Count == 0) && menu == null)&& !existLabWWW) return; ContextMenuStrip cmsMenu = new ContextMenuStrip(); cmsMenu.Opening += new CancelEventHandler(MenuStripOpening); @@ -618,14 +636,32 @@ namespace Lskj.Control.Model public bool OpenFrmcCover(GridRightMenuModel model, List paramList) { - if (string.IsNullOrWhiteSpace(paramList[1]) || string.IsNullOrWhiteSpace(paramList[2])) + + bool importIntoDatabase = false; + if (string.IsNullOrWhiteSpace(paramList[0]) || paramList[0] + "" == "0") { - MessageUtil.Show("模块编号或主键名称未配置"); - return false; + //模式1,把导入的数据反写到主界面上 + if (string.IsNullOrWhiteSpace(paramList[1]) || string.IsNullOrWhiteSpace(paramList[2])) + { + MessageUtil.Show("模块编号或主键名称未配置"); + return false; + } } + else + { + //模式2,保存到数据库中,在执行保存后sql + importIntoDatabase = true; + if (string.IsNullOrWhiteSpace(paramList[1]) ) + { + MessageUtil.Show("模块编号未配置"); + return false; + } + } + + string primaryKey = paramList[2]; - FrmCover frmCover = new FrmCover(paramList[1], paramList[2]); - if (frmCover.ShowDialog() == DialogResult.OK) + FrmCover frmCover = new FrmCover(importIntoDatabase,paramList[1], paramList[2], paramList[3]); + if (frmCover.ShowDialog() == DialogResult.OK&& !importIntoDatabase) { //反写数据源 DataTable ReverseData = frmCover.ReverseData; diff --git a/插件库/Lskj.Control/Model/MenuStrip/GridViewMenuStrip.cs b/插件库/Lskj.Control/Model/MenuStrip/GridViewMenuStrip.cs index a796318..2da6e34 100644 --- a/插件库/Lskj.Control/Model/MenuStrip/GridViewMenuStrip.cs +++ b/插件库/Lskj.Control/Model/MenuStrip/GridViewMenuStrip.cs @@ -72,14 +72,9 @@ namespace Lskj.Control.Model mQQArray.Add(item); } - if (model.FieldType == ControlType.LabWWW && - (rowValue.StartsWith("www.") || - rowValue.StartsWith("http://") || - rowValue.StartsWith("https://") || - rowValue.StartsWith("ftp://") || - rowValue.StartsWith("file://"))) + if (model.FieldType == ControlType.LabWWW && !string.IsNullOrWhiteSpace(rowValue)) { - ToolStripMenuItem item = new ToolStripMenuItem("(" + column.Caption + ")" + rowValue, Resources.qq); + ToolStripMenuItem item = new ToolStripMenuItem("(" + column.Caption + ")" + rowValue, Resources.www); item.Tag = mSelectRow[column.Name] + ""; item.Click += new EventHandler(BrowerItemClick); mBrowerArray.Add(item); diff --git a/插件库/Lskj.Control/Model/MyControl.cs b/插件库/Lskj.Control/Model/MyControl.cs index 43f6cb3..782e85b 100644 --- a/插件库/Lskj.Control/Model/MyControl.cs +++ b/插件库/Lskj.Control/Model/MyControl.cs @@ -236,6 +236,10 @@ namespace Lskj.Control.Model /// public Dictionary ModuleResultDic = new Dictionary(); /// + /// 带参数控件修改数据源字典 + /// + public Dictionary> ParaContrlsDic = new Dictionary>(); + /// /// 控件值改变动态刷新表格列 /// public event KeyEventHandler OnDataFileRefrshCallBack; @@ -1458,8 +1462,8 @@ namespace Lskj.Control.Model model.SourceSql += "and 1<>1"; } DataTable table = new DataTable(); - - if ((!ControlType.IsNotLoadData(model.FieldType)|| model.ModuleFrameDisplayText && (model.FieldType == 160|| model.FieldType == 161)) && model.FieldType != ControlType.LabTreeType) + + if ((!ControlType.IsNotLoadData(model.FieldType) || model.ModuleFrameDisplayText && (model.FieldType == 160 || model.FieldType == 161)) && model.FieldType != ControlType.LabTreeType) { if (mControlSourceDic.ContainsKey(model)) { @@ -1528,6 +1532,25 @@ namespace Lskj.Control.Model // 智能搜索框 LabelAutoGridLook autoiGridEdit = ctr as LabelAutoGridLook; autoiGridEdit.SetDataSource(table); + if (autoiGridEdit.Isparameters) + { + List condition = ReplaceHelper.GetParamFields(model.SourceSql); + foreach (string item in condition) + { + string filename = item.Trim('{', '}'); + if (ParaContrlsDic.ContainsKey(filename)) + { + if (!ParaContrlsDic[filename].Contains(model.FieldName)) + { + ParaContrlsDic[filename].Add(model.FieldName); + } + } + else + { + ParaContrlsDic[filename] = new List() { model.FieldName }; + } + } + } break; case ControlType.LabMultiSelectText: case ControlType.LabMultiSelectTextNew: @@ -1561,6 +1584,8 @@ namespace Lskj.Control.Model break; case ControlType.LabCheckAutoSeacherValue: case ControlType.LabCheckAutoSeacherText: + case ControlType.LabAutoCompleteCheckParamValue: + case ControlType.LabAutoCompleteCheckParamText: // 带复选框自动搜索框 LabelCheckAutoTextEdit checkAutoTextEdit = ctr as LabelCheckAutoTextEdit; checkAutoTextEdit.AutoTextEdit.SetDataSource(table); @@ -1573,7 +1598,7 @@ namespace Lskj.Control.Model case ControlType.LabSelectReturnIdNew: case ControlType.LabSelectReturnTextNew: LabelMultiAutoTextEdit4 moduleReturnsIdnew = ctr as LabelMultiAutoTextEdit4; - moduleReturnsIdnew.DataSource=table; + moduleReturnsIdnew.DataSource = table; break; case ControlType.DynamicallyGeneratedSql: LabelMultiAutoTextEdit3 moduleSqlGenerated = ctr as LabelMultiAutoTextEdit3; @@ -1711,7 +1736,7 @@ namespace Lskj.Control.Model } else if (model.FieldName.EndsWith("operatedate", StringComparison.OrdinalIgnoreCase)) { - controlValue = SqlHelper.ExecuteScalar("select getdate()")+"";//DateTime.Now.ToString(); + controlValue = SqlHelper.ExecuteScalar("select getdate()") + "";//DateTime.Now.ToString(); } else { @@ -2095,6 +2120,8 @@ namespace Lskj.Control.Model break; case ControlType.LabCheckAutoSeacherValue: case ControlType.LabCheckAutoSeacherText: + case ControlType.LabAutoCompleteCheckParamValue: + case ControlType.LabAutoCompleteCheckParamText: // 带复选框自动搜索框 LabelCheckAutoTextEdit checkAutoTextEdit = ctr as LabelCheckAutoTextEdit; if (checkAutoTextEdit.CheckEdit.Checked) @@ -2130,7 +2157,7 @@ namespace Lskj.Control.Model //数字编辑框 case ControlType.LabTextInt: LabelTextEdit textIntEdit = ctr as LabelTextEdit; - if (textIntEdit != null) value = string.IsNullOrEmpty(textIntEdit.EditText) ? "0" : textIntEdit.EditText; + if (textIntEdit != null) value = string.IsNullOrEmpty(textIntEdit.EditText) ? "0" : textIntEdit.EditText.Replace(",", ""); break; case ControlType.LabComboxPopupValue: case ControlType.LabComboxPopupText: @@ -2575,7 +2602,7 @@ namespace Lskj.Control.Model } else if (model.FieldName.EndsWith("operatedate", StringComparison.OrdinalIgnoreCase)) { - string date = SqlHelper.ExecuteScalar("select getdate()") + ""; + string date = SqlHelper.ExecuteScalar("select getdate()") + ""; control.EditText = date; //DateTime.Now.ToString(); control.Model.Text = date; //DateTime.Now.ToString(); } @@ -3533,6 +3560,10 @@ namespace Lskj.Control.Model if (baseControl is LabelImageEdit) { LabelImageEdit imageEdit = baseControl as LabelImageEdit; + if (imageEdit.TextEdit.Image != null) + { + imageEdit.TextEdit.Image.Dispose(); + } imageEdit.LoadImage(controlValue + ""); } else if (baseControl is LabelPictureEdit) @@ -3915,7 +3946,7 @@ namespace Lskj.Control.Model foreach (DataRow item in _schemes.Rows) { BarButtonItem bbi_item = new BarButtonItem(); - bbi_item.Caption = item["ProjectName"] + ""; + bbi_item.Caption = Business.Impl.LanguageTranslation.Translatable ? Business.Impl.LanguageTranslation.GetTranslatedText(item["ProjectName"] + "") : item["ProjectName"] + ""; bbi_item.Tag = item["SearchValue"] + ""; bbi_item.ItemClick += new ItemClickEventHandler(OnPopupItemClick); @@ -3923,11 +3954,11 @@ namespace Lskj.Control.Model } BarButtonItem bbi_save = new BarButtonItem(); - bbi_save.Caption = "保存方案"; + bbi_save.Caption = Business.Impl.LanguageTranslation.Translatable ? Business.Impl.LanguageTranslation.GetTranslatedText("保存方案") : "保存方案"; bbi_save.ItemClick += new ItemClickEventHandler(OnPopupSaveItemClick); BarButtonItem bbi_manager = new BarButtonItem(); - bbi_manager.Caption = "方案管理"; + bbi_manager.Caption = Business.Impl.LanguageTranslation.Translatable ? Business.Impl.LanguageTranslation.GetTranslatedText("方案管理") : "方案管理"; bbi_manager.ItemClick += new ItemClickEventHandler(OnPopupManagerItemClick); _popupMenu.AddItem(bbi_save); @@ -4417,6 +4448,8 @@ namespace Lskj.Control.Model break; case ControlType.LabCheckAutoSeacherValue: case ControlType.LabCheckAutoSeacherText: + case ControlType.LabAutoCompleteCheckParamValue: + case ControlType.LabAutoCompleteCheckParamText: // 带复选框自动搜索框 LabelCheckAutoTextEdit checkAutoTextEdit = new LabelCheckAutoTextEdit(); checkAutoTextEdit.clickAfterEmpty = model.clickAfterEmpty; @@ -4424,6 +4457,7 @@ namespace Lskj.Control.Model checkAutoTextEdit.AutoTextEdit.ValueField = model.ValueMember; checkAutoTextEdit.AutoTextEdit.TextField = model.TextMember; //checkAutoTextEdit.AutoTextEdit.SetDataSource(dataSource); + if(ControlType.LabAutoCompleteCheckParamValue == model.FieldType || ControlType.LabAutoCompleteCheckParamText == model.FieldType) checkAutoTextEdit.TextEdit.ControlObj = this; checkAutoTextEdit.TextEdit.SourceSQL = model.SourceSql; checkAutoTextEdit.TextEdit.KeyDown += new KeyEventHandler(OnTextEditKeyDown); @@ -4571,7 +4605,7 @@ namespace Lskj.Control.Model model.SourceSql = ""; //设置了ModuleFrameDisplayText(显示text值),就把配置的模块sql传给model.SourceSql - if (model.ModuleFrameDisplayText) + if (model.ModuleFrameDisplayText) { moduleReturnsIdNew.ModuleFrameDisplayText = true; model.SourceSql = moduleReturnsIdNew._lookUpForm.SysModel.MenuSql; @@ -4629,9 +4663,9 @@ namespace Lskj.Control.Model billSourceComboxEdit.Button.Visible = true; billSourceComboxEdit.OpenDocumentSource += new EventHandler(OpenDocumentSource); - + billSourceComboxEdit.clickAfterEmpty = model.clickAfterEmpty; - billSourceComboxEdit.ValueMember =model.ValueMember; + billSourceComboxEdit.ValueMember = model.ValueMember; billSourceComboxEdit.ValueField = model.ValueMember; billSourceComboxEdit.TextField = model.TextMember; billSourceComboxEdit.FormKey = model.FieldName + "_" + model.FormKey; @@ -4658,6 +4692,7 @@ namespace Lskj.Control.Model LabelTextEdit textEdit = new LabelTextEdit(); if (model.FieldType == ControlType.LabTextInt) { + textEdit.TextEdit.Tag = model; textEdit.TextEdit.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.OnIntKeyPress); textEdit.TextEdit.EditValueChanging += new DevExpress.XtraEditors.Controls.ChangingEventHandler(this.OnIntEditValueChanging); } @@ -4749,8 +4784,17 @@ namespace Lskj.Control.Model private void OnIntEditValueChanging(object sender, DevExpress.XtraEditors.Controls.ChangingEventArgs e) { string newText = e.NewValue as string; - - + if (sender is TextEdit) + { + TextEdit textEdit = sender as TextEdit; + if (textEdit.Tag is ControlModel) + { + //没有浏览权限默认显示**** + ControlModel model = textEdit.Tag as ControlModel; + if (model.Visible && newText.Equals("****")) return; + } + } + // 第一个输入负号不会取消,出现了千位分隔符不会取消更改,末尾为百分号不会取消 if (!newText.Equals("-") && !string.IsNullOrEmpty(newText) && !Regex.IsMatch(newText, @"^(?:-(?:[0-9]+(?:,[0-9]{3})*(?:\.[0-9]*)?)|[0-9]+(?:,[0-9]{3})*(?:\.[0-9]*)?)(?:%)?$")) { @@ -5199,6 +5243,31 @@ namespace Lskj.Control.Model } } /// + /// 刷新带参数数据源 + /// + /// + private void RefushParaSource(BaseUserControl baseControl) + { + + if (baseControl != null && baseControl.Model != null) + { + if (ParaContrlsDic.ContainsKey(baseControl.Model.FieldName)) + { + List controlNames = ParaContrlsDic[baseControl.Model.FieldName]; + foreach (string controlName in controlNames) + { + BaseUserControl baseUserControl = FindControl(controlName.Trim('{', '}')); + if (baseUserControl == null) continue; + if (baseUserControl.Model == null) continue; + if (baseUserControl is LabelAutoGridLook labelAutoGridLook) + { + labelAutoGridLook.HandPopupSqlValue(labelAutoGridLook.SourceSQL); + } + } + } + } + } + /// /// 说明:设置控件禁编或隐藏 /// 创建人:龚宇超 /// 创建日期:2019-01-22 @@ -5213,7 +5282,7 @@ namespace Lskj.Control.Model { ControlModel[] controls = this._models.Where(x => x.DisableCond.Contains("{" + model.FieldName + "}")).ToArray(); ControlModel[] requiredcontrols = this._models.Where(x => x.RequiredCond.Contains("{" + model.FieldName + "}")).ToArray(); - if ((controls == null || controls.Length == 0)&&(requiredcontrols == null || requiredcontrols.Length == 0)) return; + if ((controls == null || controls.Length == 0) && (requiredcontrols == null || requiredcontrols.Length == 0)) return; string fieldValue = GetControlValue(model); foreach (ControlModel item in requiredcontrols) @@ -5577,6 +5646,7 @@ namespace Lskj.Control.Model { BaseUserControl baseControl = (sender as System.Windows.Forms.Control).ToBaseUserControl(); this.SetUnionAncCalcControl(baseControl); + this.RefushParaSource(baseControl); if (baseControl.Model != null && baseControl.Model.IsRefreshSource == 1 && OnSourceRefrshCallBack != null) { this.RefreshControl = baseControl.Model.FieldName;//条件表刷新上表的关键字段名 diff --git a/插件库/Lskj.Control/Model/StaticControl.cs b/插件库/Lskj.Control/Model/StaticControl.cs index 978d9f8..c640e40 100644 --- a/插件库/Lskj.Control/Model/StaticControl.cs +++ b/插件库/Lskj.Control/Model/StaticControl.cs @@ -4,6 +4,7 @@ using Lskj.Control.ZKFinger; using Lskj.Util; using System; using System.Collections.Generic; +using System.Data; using System.Diagnostics; using System.Linq; using System.Text; @@ -33,4 +34,19 @@ namespace Lskj.Control.Model /// /// 当前拖拽源表格 /// - public static GridView SourceD \ No newline at end of file + public static GridView SourceDragGridView; + /// + /// 指纹识别模块 + /// + public static FingerHelper fingerHelper; + ///// + ///// 外部exe进程 + ///// + //public static Dictionary loadExeProcess = new Dictionary(); + /// + /// 打开的Add模块对应的父表格控件(模块编号,GridControlEx) + /// + public static KeyValuePair AddParentGrid = new KeyValuePair(); + /// + /// 当前右键点击时的表格 + ///