feat: 更新控件及相关业务功能

This commit is contained in:
cyf
2026-08-04 13:49:05 +08:00
parent 4fe8844e86
commit 66cab000ea
22 changed files with 424 additions and 90 deletions
+15 -6
View File
@@ -162,18 +162,27 @@ namespace Lskj.AutoWordFile
} }
private DataSet Worddata(string modid, int tagid, int mid) private DataSet Worddata(string modid, int tagid, int mid)
{ {
SqlParameter[] param = try
{ {
SqlParameter[] param =
{
new SqlParameter("@modid",SqlDbType.VarChar,15), new SqlParameter("@modid",SqlDbType.VarChar,15),
new SqlParameter("@tagid",SqlDbType.Int), new SqlParameter("@tagid",SqlDbType.Int),
new SqlParameter("@Mid",SqlDbType.Int) new SqlParameter("@Mid",SqlDbType.Int)
}; };
param[0].Value = modid; param[0].Value = modid;
param[1].Value = tagid; param[1].Value = tagid;
param[2].Value = mid; param[2].Value = mid;
DataSet ds = SqlHelper.ExecuteDataSet(CommandType.StoredProcedure, "pr_system_File01", "#ba_firstpage", param); DataSet ds = SqlHelper.ExecuteDataSet(CommandType.StoredProcedure, "pr_system_File01", "#ba_firstpage", param);
return ds; return ds;
}
catch (Exception ex)
{
throw;
}
} }
public void Mulu() public void Mulu()
{ {
@@ -615,7 +615,7 @@ namespace Lskj.BaseAccraditation
{ {
this._flowRowData = BaseAuditImpl.GetCurrentFlowRowData(this.ModuleModelObj.MenuTable, this.ModuleModelObj.ParmaryKey, this.SysModel.PrimaryValue); this._flowRowData = BaseAuditImpl.GetCurrentFlowRowData(this.ModuleModelObj.MenuTable, this.ModuleModelObj.ParmaryKey, this.SysModel.PrimaryValue);
} }
this.UpdateCirculationData();
string billType = this._flowRowData != null ? _flowRowData[this.ModuleModelObj.BillType] + "" : ""; string billType = this._flowRowData != null ? _flowRowData[this.ModuleModelObj.BillType] + "" : "";
if (string.IsNullOrEmpty(billType) || billType == "0") if (string.IsNullOrEmpty(billType) || billType == "0")
{ {
@@ -1733,6 +1733,7 @@ namespace Lskj.BaseAccraditation
{ {
string printFile = e.Item.Tag + ""; string printFile = e.Item.Tag + "";
this._flowRowData = BaseAuditImpl.GetCurrentFlowRowData(this.ModuleModelObj.MenuTable, this.ModuleModelObj.ParmaryKey, this.SysModel.PrimaryValue); this._flowRowData = BaseAuditImpl.GetCurrentFlowRowData(this.ModuleModelObj.MenuTable, this.ModuleModelObj.ParmaryKey, this.SysModel.PrimaryValue);
this.UpdateCirculationData();
string printPath = PubUtil.PrintFileAbsolutelyPath; string printPath = PubUtil.PrintFileAbsolutelyPath;
if (!File.Exists(printPath)) if (!File.Exists(printPath))
{ {
@@ -1911,6 +1912,7 @@ namespace Lskj.BaseAccraditation
if (this.ModuleModelObj.SaveSuccessfullyRefresh && !isSuccess) return;//保存成功才刷新 if (this.ModuleModelObj.SaveSuccessfullyRefresh && !isSuccess) return;//保存成功才刷新
// 刷新主表 // 刷新主表
this._flowRowData = BaseAuditImpl.GetCurrentFlowRowData(this.ModuleModelObj.MenuTable, this.ModuleModelObj.ParmaryKey, this.SysModel.PrimaryValue); 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); 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; if (this._baseRowData == null) this._baseRowData = this._flowRowData;
this.ControlObj.CanExecControl = false; this.ControlObj.CanExecControl = false;
@@ -2915,5 +2917,25 @@ namespace Lskj.BaseAccraditation
} }
} }
/// <summary>
/// 更新当前流转数据
/// </summary>
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;
}
}
} }
} }
+9 -2
View File
@@ -66,6 +66,9 @@ namespace Lskj.Business
if (item.Table.Columns.Contains("UpdateAddressXp") && ERPInfo.Instance.SystemVersion.Contains("Windows XP")) if (item.Table.Columns.Contains("UpdateAddressXp") && ERPInfo.Instance.SystemVersion.Contains("Windows XP"))
Instance.UpdateAddress = !string.IsNullOrEmpty(item["UpdateAddressXp"] + "") ? item["UpdateAddressXp"] + "" : ""; Instance.UpdateAddress = !string.IsNullOrEmpty(item["UpdateAddressXp"] + "") ? item["UpdateAddressXp"] + "" : "";
//内网对应的升级地址
Instance.UpdateAddress = DBConfig.Instance.IsInternalNetwork && item.Table.Columns.Contains("InternalUpdateAddress") && !string.IsNullOrEmpty(item["InternalUpdateAddress"] + "") ? item["InternalUpdateAddress"] + "" : Instance.UpdateAddress;
Instance.OAUrl = DBConfig.Instance.Internet && item.Table.Columns.Contains("localOAUrl") && !string.IsNullOrEmpty(item["localOAUrl"] + "") ? item["localOAUrl"] + "" : item["OAUrl"] + ""; Instance.OAUrl = DBConfig.Instance.Internet && item.Table.Columns.Contains("localOAUrl") && !string.IsNullOrEmpty(item["localOAUrl"] + "") ? item["localOAUrl"] + "" : item["OAUrl"] + "";
@@ -336,6 +339,7 @@ namespace Lskj.Business
{ {
ResourceDynamic.PubBrower = System.Environment.OSVersion.Version.Major == 5 && (System.Environment.OSVersion.Version.Minor == 1 || System.Environment.OSVersion.Version.Minor == 2) ? "Lskj.PubBrowerXp.dll" : "Lskj.PubBrower2.dll"; ResourceDynamic.PubBrower = System.Environment.OSVersion.Version.Major == 5 && (System.Environment.OSVersion.Version.Minor == 1 || System.Environment.OSVersion.Version.Minor == 2) ? "Lskj.PubBrowerXp.dll" : "Lskj.PubBrower2.dll";
} }
Instance.IsSpecialAuditSave = item.Table.Columns.Contains("IsSpecialAuditSave") && !string.IsNullOrEmpty(item["IsSpecialAuditSave"] + "") ? "1".Equals(item["IsSpecialAuditSave"] + "") : false;
} }
/// <summary> /// <summary>
/// 高拍仪AccessKey /// 高拍仪AccessKey
@@ -1161,9 +1165,12 @@ namespace Lskj.Business
/// </summary> /// </summary>
public string DeadlockPrompt; public string DeadlockPrompt;
/// <summary> /// <summary>
/// 附件浏览器自带逻辑 /// 附件按钮打开Lskj.PubBrower2.dll
/// </summary> /// </summary>
public bool SpecialAttachmentBrowser; public bool SpecialAttachmentBrowser;
/// <summary>
/// 特殊审核保存模式(修改语句只拼接修改后的控件)
/// </summary>
public bool IsSpecialAuditSave;
} }
} }
+16 -1
View File
@@ -2016,7 +2016,7 @@ namespace Lskj.Control
} }
//选中上一次选中行行号 //选中上一次选中行行号
if (SelectGridControlEx != null && oldRowHandle > 0) if (SelectGridControlEx != null && oldRowHandle >= 0)
{ {
SelectGridControlEx.GridView.SelectRowHandler(oldRowHandle); SelectGridControlEx.GridView.SelectRowHandler(oldRowHandle);
OnPcgridRowCellClick(SelectGridControlEx.GridView, null); OnPcgridRowCellClick(SelectGridControlEx.GridView, null);
@@ -2057,10 +2057,25 @@ namespace Lskj.Control
string fieldValue = this.ControlObj.GetControlValue(model); string fieldValue = this.ControlObj.GetControlValue(model);
if (fieldValue == "****") continue; if (fieldValue == "****") continue;
if (SystemInfo.Instance.IsSpecialAuditSave &&
this._drBillInfoMsg != null &&
this._drBillInfoMsg.Table != null &&
this._drBillInfoMsg.Table.Columns.Contains(model.FieldName) &&
AuditChangeLog.IsSameValue(this._drBillInfoMsg[model.FieldName] + "", fieldValue))
{
continue;
}
//updateBuilder.AppendFormat("{0}='{1}',", model.FieldName, fieldValue); //updateBuilder.AppendFormat("{0}='{1}',", model.FieldName, fieldValue);
updateBuilder.Append(string.IsNullOrEmpty(fieldValue) ? string.Format("{0}={1}", model.FieldName, this.ControlObj.GetNullValue(model)) : string.Format("{0}=N'{1}',", model.FieldName, fieldValue.Contains("'") ? fieldValue.Replace("'", "''") : fieldValue)); updateBuilder.Append(string.IsNullOrEmpty(fieldValue) ? string.Format("{0}={1}", model.FieldName, this.ControlObj.GetNullValue(model)) : string.Format("{0}=N'{1}',", model.FieldName, fieldValue.Contains("'") ? fieldValue.Replace("'", "''") : fieldValue));
} }
} }
string updateFields = updateBuilder.ToString().TrimEnd(',');
if (string.IsNullOrEmpty(updateFields))
{
return string.Empty;
}
return string.Format("update {0} set {1} where {2}='{3}'", this.BillModelObj.MasterTable, updateBuilder.ToString().TrimEnd(','), BillModelObj.PrimaryKey, this.SysModel.BillDocumentId); return string.Format("update {0} set {1} where {2}='{3}'", this.BillModelObj.MasterTable, updateBuilder.ToString().TrimEnd(','), BillModelObj.PrimaryKey, this.SysModel.BillDocumentId);
} }
#endregion #endregion
@@ -258,7 +258,8 @@ namespace Lskj.Control
DataRow gridRow = this.GridView.GetDataRow(e.RowHandle); DataRow gridRow = this.GridView.GetDataRow(e.RowHandle);
foreach (DataRow item in this.GridRowColorsTable.Rows) foreach (DataRow item in this.GridRowColorsTable.Rows)
{ {
string cond = ReplaceHelper.ReplaceRowParam(gridRow, item["condition"] + ""); //string cond = ReplaceHelper.ReplaceRowParam(gridRow, item["condition"] + "");
string cond = ReplaceHelper.ReplaceRowParamEmptyWrapQuote(gridRow, item["condition"] + "");
try try
{ {
if (!string.IsNullOrWhiteSpace(cond) && ReplaceHelper.EvalCond(cond)) if (!string.IsNullOrWhiteSpace(cond) && ReplaceHelper.EvalCond(cond))
@@ -360,7 +361,8 @@ namespace Lskj.Control
continue; continue;
} }
} }
cond = ReplaceHelper.ReplaceRowParam(gridRow, item["condition"] + "").ReplaceColumnParam(e.Column.Name, e.Column.Caption, e.CellValue + ""); //cond = ReplaceHelper.ReplaceRowParam(gridRow, item["condition"] + "").ReplaceColumnParam(e.Column.Name, e.Column.Caption, e.CellValue + "");
cond = ReplaceHelper.ReplaceRowParamEmptyWrapQuote(gridRow, item["condition"] + "").ReplaceColumnParam(e.Column.Name, e.Column.Caption, e.CellValue + "");
try try
{ {
if (!string.IsNullOrWhiteSpace(cond) && ReplaceHelper.EvalCond(cond) && (!string.IsNullOrEmpty(e.CellValue + "") || isLaterDatePresent|| SystemInfo.Instance.isBlankCellColor)) if (!string.IsNullOrWhiteSpace(cond) && ReplaceHelper.EvalCond(cond) && (!string.IsNullOrEmpty(e.CellValue + "") || isLaterDatePresent|| SystemInfo.Instance.isBlankCellColor))
+3 -4
View File
@@ -31,11 +31,10 @@ namespace Lskj.Control
{ {
this.SuspendLayout(); this.SuspendLayout();
// //
// FrmWebBrowser // FrmWebBrowser2
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Name = "FrmWebBrowser2";
this.Name = "FrmWebBrowser";
this.Size = new System.Drawing.Size(800, 450); this.Size = new System.Drawing.Size(800, 450);
this.ResumeLayout(false); this.ResumeLayout(false);
+17 -2
View File
@@ -1205,6 +1205,19 @@ namespace Lskj.Control
} }
} }
/// <summary> /// <summary>
/// <para>说明:设置列格式化</para> /// <para>说明:设置列格式化</para>
/// <para>创建人:龚宇超</para> /// <para>创建人:龚宇超</para>
@@ -6608,7 +6621,8 @@ namespace Lskj.Control
DataRow gridRow = this.gridView.GetDataRow(e.RowHandle); DataRow gridRow = this.gridView.GetDataRow(e.RowHandle);
foreach (DataRow item in this.GridRowColorsTable.Rows) foreach (DataRow item in this.GridRowColorsTable.Rows)
{ {
string cond = ReplaceHelper.ReplaceRowParam(gridRow, item["condition"] + "").ReplaceColumnParam(e.Column.Name, e.Column.Caption, e.CellValue + ""); // string cond = ReplaceHelper.ReplaceRowParam(gridRow, item["condition"] + "").ReplaceColumnParam(e.Column.Name, e.Column.Caption, e.CellValue + "");
string cond = ReplaceHelper.ReplaceRowParamEmptyWrapQuote(gridRow, item["condition"] + "").ReplaceColumnParam(e.Column.Name, e.Column.Caption, e.CellValue + "");
try try
{ {
@@ -6669,7 +6683,8 @@ namespace Lskj.Control
DataRow gridRow = this.gridView.GetDataRow(e.RowHandle); DataRow gridRow = this.gridView.GetDataRow(e.RowHandle);
foreach (DataRow item in this.GridRowColorsTable.Rows) foreach (DataRow item in this.GridRowColorsTable.Rows)
{ {
string cond = ReplaceHelper.ReplaceRowParam(gridRow, item["condition"] + ""); //string cond = ReplaceHelper.ReplaceRowParam(gridRow, item["condition"] + "");
string cond = ReplaceHelper.ReplaceRowParamEmptyWrapQuote(gridRow, item["condition"] + "");
try try
{ {
if (!string.IsNullOrWhiteSpace(cond) && ReplaceHelper.EvalCond(cond)) if (!string.IsNullOrWhiteSpace(cond) && ReplaceHelper.EvalCond(cond))
@@ -182,7 +182,10 @@ namespace Lskj.Control.Model
/// 判断两个值是否相同。 /// 判断两个值是否相同。
/// 优先按日期、数字进行值比较,最后再按普通字符串比较。 /// 优先按日期、数字进行值比较,最后再按普通字符串比较。
/// </summary> /// </summary>
private static bool IsSameValue(string oldValue, string newValue) /// <param name="oldValue">原始值</param>
/// <param name="newValue">当前值</param>
/// <returns>两个值在统一格式后是否相同</returns>
public static bool IsSameValue(string oldValue, string newValue)
{ {
oldValue = NormalizeValue(oldValue); oldValue = NormalizeValue(oldValue);
newValue = NormalizeValue(newValue); newValue = NormalizeValue(newValue);
+51 -5
View File
@@ -22,6 +22,7 @@ using System.IO;
using System.Data.SqlClient; using System.Data.SqlClient;
using Lskj.Business; using Lskj.Business;
using DevExpress.XtraGrid.Views.Grid; using DevExpress.XtraGrid.Views.Grid;
using Lskj.Core;
namespace Lskj.Control.Model namespace Lskj.Control.Model
{ {
@@ -38,6 +39,12 @@ namespace Lskj.Control.Model
/// </summary> /// </summary>
private MyControl _controlObj; private MyControl _controlObj;
public bool issuccess = true; public bool issuccess = true;
/// <summary>
/// 最初账套版本
/// </summary>
public DataRow AccountItem;
/// <summary> /// <summary>
/// Occurs when [apply before]. /// Occurs when [apply before].
/// </summary> /// </summary>
@@ -73,13 +80,12 @@ namespace Lskj.Control.Model
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns> /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
public bool Apply(DataRow rowItem) public bool Apply(DataRow rowItem)
{ {
bool resultValue = false;
if (rowItem == null || this._controlObj == null) return resultValue;
GridRightMenuModel model = new GridRightMenuModel(rowItem);
try try
{ {
bool resultValue = false;
if (rowItem == null || this._controlObj == null) return resultValue;
GridRightMenuModel model = new GridRightMenuModel(rowItem);
//if (!string.IsNullOrWhiteSpace(model.MenuCond)) //if (!string.IsNullOrWhiteSpace(model.MenuCond))
//{ //{
// try // try
@@ -103,6 +109,18 @@ namespace Lskj.Control.Model
// } // }
//} //}
if (!string.IsNullOrEmpty(model.UnionZTid))
{
string UnionZTid = ReplaceHelper.ReplaceRowParam(BaseGridView.GetFocusedDataRow(), model.UnionZTid);
string condition = string.Format("where ShowName ='{0}'", ERPInfo.Instance.AccountBook);
DataTable dt = MainImpl.GetLedgerList(condition);
DataRow RT = BaseImpl.GetDataRowResult($"select * from p_sydbGroupTab where ID={UnionZTid}");
AccountItem = dt.Rows[0];
AccountItem["IP"] = DBConfig.Instance.ServerName;
ToDBatching(RT, AccountItem);
}
if (!string.IsNullOrWhiteSpace(model.BeforeMsg)) if (!string.IsNullOrWhiteSpace(model.BeforeMsg))
{ {
@@ -186,6 +204,10 @@ namespace Lskj.Control.Model
string Message = ErrorMessage.PromptErrorMessage(ex); string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message, ex.Message); MessageUtil.Show(Message, ex.Message);
} }
finally
{
if (!string.IsNullOrEmpty(model.UnionZTid)) ToDBatching(AccountItem, AccountItem);
}
return true; return true;
} }
/// <summary> /// <summary>
@@ -507,5 +529,29 @@ namespace Lskj.Control.Model
} }
return false; return false;
} }
/// <summary>
/// 启动账套数据源刷新
/// </summary>
protected void ToDBatching(DataRow RT, DataRow firstrow)
{
string serverIP = RT["IP"] + "";
string dbName = RT["DBName"] + "";
string dataBook = RT["ShowName"] + "";
bool isInternal = RT.Table.Columns.Contains("IsInternalNetwork") && !string.IsNullOrEmpty(RT["IsInternalNetwork"] + "") ? "1".Equals(RT["IsInternalNetwork"] + "") : false;
DBConfig.Instance.DataBook = dataBook;
DBConfig.Instance.ServerName = serverIP;
DBConfig.Instance.DataBase = dbName;
DBConfig.Instance.IsInternalNetwork = isInternal;
if (!DBConfig.Instance.CreateConnection())
{
ToDBatching(firstrow, firstrow);
}
}
} }
} }
@@ -501,6 +501,23 @@ namespace Lskj.Control.Model
/// </summary> /// </summary>
public const int LabSearchReturnIdExtended = 174; public const int LabSearchReturnIdExtended = 174;
///// <summary>
///// 快速搜索框返回id(字典模式)
///// </summary>
//public const int DictionarySearchBoxToId = 181;
///// <summary>
///// 快速搜索框返回text(字典模式)
///// </summary>
//public const int DictionarySearchBoxToText = 182;
///// <summary>
///// 快速搜索框返回id 带参数(字典模式)
///// </summary>
//public const int DictionarySearchBoxToIdParam = 183;
///// <summary>
///// 快速搜索框返回text 带参数(字典模式)
///// </summary>
//public const int DictionarySearchBoxToTextParam = 184;
/// <summary> /// <summary>
/// <para>说明:是否为Value类型</para> /// <para>说明:是否为Value类型</para>
/// <para>创建人:龚宇超</para> /// <para>创建人:龚宇超</para>
@@ -307,6 +307,11 @@ namespace Lskj.Control.Model
/// </summary> /// </summary>
public bool AddHideBottomPanel; public bool AddHideBottomPanel;
/// <summary>
/// 禁用条件
/// </summary>
public string VisibleCond;
/// <summary> /// <summary>
/// 主模块编号 /// 主模块编号
/// </summary> /// </summary>
@@ -379,6 +384,7 @@ namespace Lskj.Control.Model
this.IgnoreAssociatedFields = item.Table.Columns.Contains("IgnoreAssociatedFields") ? "1".Equals(item["IgnoreAssociatedFields"] + "") : false; this.IgnoreAssociatedFields = item.Table.Columns.Contains("IgnoreAssociatedFields") ? "1".Equals(item["IgnoreAssociatedFields"] + "") : false;
this.Library = item.Table.Columns.Contains("Library") ? item["Library"] + "" : ""; this.Library = item.Table.Columns.Contains("Library") ? item["Library"] + "" : "";
this.AddHideBottomPanel = item.Table.Columns.Contains("AddHideBottomPanel") ? "1".Equals(item["AddHideBottomPanel"] + "") : false; this.AddHideBottomPanel = item.Table.Columns.Contains("AddHideBottomPanel") ? "1".Equals(item["AddHideBottomPanel"] + "") : false;
this.VisibleCond = item.Table.Columns.Contains("VisibleCond") ? item["VisibleCond"] + "" : "";
} }
} }
} }
@@ -36,54 +36,62 @@ namespace Lskj.Control.Model.MenuStrip
} }
protected override void MenuStripOpening(object sender, System.ComponentModel.CancelEventArgs e) protected override void MenuStripOpening(object sender, System.ComponentModel.CancelEventArgs e)
{ {
int[] mSelectRows = this._gridView.GetSelectedRows(); int[] mSelectRows = this._gridView.GetSelectedRows() ?? new int[0];
if (mSelectRows == null || mSelectRows.Length == 0) return;
DataRow mSelectRow = this._gridView.GetDataRow(mSelectRows[0]); DataRow[] dataRows = new DataRow[mSelectRows.Length];
for (int i = 0; i < mSelectRows.Length; i++)
{
dataRows[i] = this._gridView.GetDataRow(mSelectRows[i]);
}
ContextMenuStrip cmsMenu = (ContextMenuStrip)sender; ContextMenuStrip cmsMenu = (ContextMenuStrip)sender;
cmsMenu.Items.Clear(); cmsMenu.Items.Clear();
cmsMenu.Items.AddRange(this.RightMenuItems.ToArray()); cmsMenu.Items.AddRange(this.RightMenuItems.ToArray());
// 创建QQ、浏览器右键菜单 if (mSelectRows.Length > 0)
List<ToolStripMenuItem> mQQArray = new List<ToolStripMenuItem>();
List<ToolStripMenuItem> mBrowerArray = new List<ToolStripMenuItem>();
foreach (GridColumn column in this._gridView.Columns)
{ {
if (!mSelectRow.Table.Columns.Contains(column.Name)) DataRow mSelectRow = this._gridView.GetDataRow(mSelectRows[0]);
continue;
string rowValue = mSelectRow[column.Name] + ""; // 创建QQ、浏览器右键菜单
if (!string.IsNullOrWhiteSpace(rowValue)) List<ToolStripMenuItem> mQQArray = new List<ToolStripMenuItem>();
List<ToolStripMenuItem> mBrowerArray = new List<ToolStripMenuItem>();
foreach (GridColumn column in this._gridView.Columns)
{ {
GridColumnModel model = column.Tag as GridColumnModel; if (!mSelectRow.Table.Columns.Contains(column.Name))
if (model == null) continue; continue;
string rowValue = mSelectRow[column.Name] + "";
if (model.FieldType == ControlType.LabQQ) if (!string.IsNullOrWhiteSpace(rowValue))
{ {
ToolStripMenuItem item = new ToolStripMenuItem("(" + column.Caption + ")" + rowValue, Resources.qq); GridColumnModel model = column.Tag as GridColumnModel;
item.Tag = mSelectRow[column.Name] + ""; if (model == null) continue;
item.Click += new EventHandler(QQItemClick);
mQQArray.Add(item);
}
if (model.FieldType == ControlType.LabWWW || if (model.FieldType == ControlType.LabQQ)
rowValue.StartsWith("www.") || {
rowValue.StartsWith("http://") || ToolStripMenuItem item = new ToolStripMenuItem("(" + column.Caption + ")" + rowValue, Resources.qq);
rowValue.StartsWith("https://") || item.Tag = mSelectRow[column.Name] + "";
rowValue.StartsWith("ftp://") || item.Click += new EventHandler(QQItemClick);
rowValue.StartsWith("file://")) mQQArray.Add(item);
{ }
ToolStripMenuItem item = new ToolStripMenuItem("(" + column.Caption + ")" + rowValue, Resources.qq);
item.Tag = mSelectRow[column.Name] + ""; if (model.FieldType == ControlType.LabWWW ||
item.Click += new EventHandler(BrowerItemClick); rowValue.StartsWith("www.") ||
mBrowerArray.Add(item); rowValue.StartsWith("http://") ||
rowValue.StartsWith("https://") ||
rowValue.StartsWith("ftp://") ||
rowValue.StartsWith("file://"))
{
ToolStripMenuItem item = new ToolStripMenuItem("(" + column.Caption + ")" + rowValue, Resources.qq);
item.Tag = mSelectRow[column.Name] + "";
item.Click += new EventHandler(BrowerItemClick);
mBrowerArray.Add(item);
}
} }
} }
}
cmsMenu.Items.AddRange(mQQArray.ToArray()); cmsMenu.Items.AddRange(mQQArray.ToArray());
cmsMenu.Items.AddRange(mBrowerArray.ToArray()); cmsMenu.Items.AddRange(mBrowerArray.ToArray());
}
// 判断右键菜单是否可用 // 判断右键菜单是否可用
foreach (ToolStripItem cms in cmsMenu.Items) foreach (ToolStripItem cms in cmsMenu.Items)
@@ -95,34 +103,83 @@ namespace Lskj.Control.Model.MenuStrip
{ {
try try
{ {
string cond = string.Empty; bool condResult = false;
if (this._control != null) StringBuilder condBuilder = new StringBuilder();
cond = _control.ReplaceParentControlValue(model.MenuCond); StringBuilder sqlCondBuilder = new StringBuilder();
cond = ReplaceHelper.ReplaceRowParam(mSelectRow, model.MenuCond); GridCell[] cells = this._gridView.GetSelectedCells();
if (this._gridView != null) DataRow focusedRow = this.BaseGridView.GetFocusedDataRow();
DataRow[] conditionRows = dataRows;
if (model.AllowNullExec && conditionRows.Length == 0)
{ {
GridCell[] cells = this._gridView.GetSelectedCells(); conditionRows = new DataRow[] { new DataTable().NewRow() };
if (cells != null && cells.Length > 0 && cond.Contains("{COLUMN_")) }
foreach (DataRow selectRow in conditionRows)
{
string cond = ReplaceHelper.ReplaceUserInfo(model.MenuCond);
cond = RaiseBeforeHandleParamsCallback(model.ParamList, conditionRows, model.MenuCond, selectRow, cond);
if (this._control != null)
{ {
GridCell cell = cells[0]; cond = _control.ReplaceParentControlValue(cond);
DataRow focusedRow = this.BaseGridView.GetFocusedDataRow(); }
string colValue = focusedRow == null || !focusedRow.Table.Columns.Contains(cell.Column.Name) ? "" : focusedRow[cell.Column.Name] + ""; //cond = ReplaceHelper.ReplaceRowParam(selectRow, cond);
cond = cond.ReplaceColumnParam(cell.Column.Name, cell.Column.Caption, colValue); cond = ReplaceHelper.ReplaceRowParamEmptyWrapQuote(selectRow, cond);
if (model.Mergeexec && cond.StartsWith("@"))
{
//替换[],替换的是多选行中的数据
cond = ReplaceHelper.ReplaceRowParam(conditionRows, cond.Replace("[", "{").Replace("]", "}"), "", "");
}
if (this._gridView != null)
{
if (cells != null && cells.Length > 0 && cond.Contains("{COLUMN_"))
{
GridCell cell = cells[0];
string colValue = focusedRow == null || !focusedRow.Table.Columns.Contains(cell.Column.Name) ? "" : focusedRow[cell.Column.Name] + "";
cond = cond.ReplaceColumnParam(cell.Column.Name, cell.Column.Caption, colValue);
}
}
if (ControlObj != null)
{
cond = ControlObj.ReplaceParentControlValue(cond);
}
if (cond.StartsWith("@"))
{
sqlCondBuilder.Append($"({cond.TrimStart('@')}) = '1' and ");
}
else
{
condBuilder.Append($"({cond}) and ");
} }
} }
if (ControlObj != null) string condStr = model.MenuCond;
cond = ControlObj.ReplaceParentControlValue(cond); if (!string.IsNullOrWhiteSpace(sqlCondBuilder.ToString()) || !string.IsNullOrWhiteSpace(condBuilder.ToString()))
{
if (model.MenuCond.StartsWith("@"))
{
condStr = $"@if({sqlCondBuilder.ToString().TrimEnd().TrimEnd('d', 'n', 'a')}) begin select '1' end else begin select '0' end";
}
else
{
condStr = condBuilder.ToString().TrimEnd().TrimEnd('d', 'n', 'a');
}
}
condResult = ValidateCond(condStr, null);
//cms.Enabled = ReplaceHelper.EvalCond(cond); //cms.Enabled = ReplaceHelper.EvalCond(cond);
if (model.ForbiddenDisplay) if (model.ForbiddenDisplay)
{ {
cms.Visible = ValidateCond(cond, null); ; cms.Visible = condResult;
} }
cms.Enabled = ValidateCond(cond, null); ; cms.Enabled = condResult;
} }
catch (Exception ex) catch (Exception ex)
{ {
string Message = ErrorMessage.PromptErrorMessage(ex); string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(ResourceKeys.SetRightMenuCondFault + "\r\n" + Message); MessageUtil.Show(ResourceKeys.SetRightMenuCondFault + "\r\n" + Message);
e.Cancel = true;
break; break;
} }
} }
@@ -50,6 +50,7 @@ namespace Lskj.Control.Model
/// 最初账套版本 /// 最初账套版本
/// </summary> /// </summary>
public DataRow AccountItem; public DataRow AccountItem;
public DataTable MenuTable; public DataTable MenuTable;
public DynamicModel Model; public DynamicModel Model;
public MyControl ControlObj; public MyControl ControlObj;
@@ -267,7 +268,7 @@ namespace Lskj.Control.Model
public bool ValidateCond(string cond, DataRow dataRow) public bool ValidateCond(string cond, DataRow dataRow)
{ {
bool result = false; bool result = false;
cond = ReplaceHelper.ReplaceRowParam(dataRow, cond); cond = ReplaceHelper.ReplaceRowParamEmptyWrapQuote(dataRow, cond);
if (cond.StartsWith("@") || cond.StartsWith("!")) if (cond.StartsWith("@") || cond.StartsWith("!"))
{ {
result = "1".Equals(BaseImpl.GetDefaultValue(cond)); result = "1".Equals(BaseImpl.GetDefaultValue(cond));
@@ -147,8 +147,8 @@ namespace Lskj.Control.Model
{ {
cond = _control.ReplaceParentControlValue(cond); cond = _control.ReplaceParentControlValue(cond);
} }
cond = ReplaceHelper.ReplaceRowParam(selectRow, cond); //cond = ReplaceHelper.ReplaceRowParam(selectRow, cond);
cond = ReplaceHelper.ReplaceRowParamEmptyWrapQuote(selectRow, cond);
if (model.Mergeexec&& cond.StartsWith("@")) if (model.Mergeexec&& cond.StartsWith("@"))
{ {
//替换[],替换的是多选行中的数据 //替换[],替换的是多选行中的数据
@@ -156,8 +156,8 @@ namespace Lskj.Control.Model.MenuStrip
cond = RaiseBeforeHandleParamsCallback(model.ParamList, conditionRows, model.MenuCond, selectRow, cond); cond = RaiseBeforeHandleParamsCallback(model.ParamList, conditionRows, model.MenuCond, selectRow, cond);
if (this._control != null) if (this._control != null)
cond = _control.ReplaceParentControlValue(cond); cond = _control.ReplaceParentControlValue(cond);
cond = ReplaceHelper.ReplaceRowParam(selectRow, cond); //cond = ReplaceHelper.ReplaceRowParam(selectRow, cond);
cond = ReplaceHelper.ReplaceRowParamEmptyWrapQuote(selectRow, cond);
if (model.Mergeexec && cond.StartsWith("@")) if (model.Mergeexec && cond.StartsWith("@"))
{ {
//替换[],替换的是多选行中的数据 //替换[],替换的是多选行中的数据
+25 -1
View File
@@ -265,6 +265,12 @@ namespace Lskj.Control.Model
///特殊左侧表 ///特殊左侧表
/// </summary> /// </summary>
public GridControlEx SpecialLeftTable; public GridControlEx SpecialLeftTable;
/// <summary>
///修改前的数据源
/// </summary>
public DataRow beforeData;
/// <summary> /// <summary>
/// 控件Panel对象 /// 控件Panel对象
/// </summary> /// </summary>
@@ -3048,6 +3054,8 @@ namespace Lskj.Control.Model
} }
else else
{ {
// 修改记录 // 修改记录
foreach (ControlModel model in this.ControlModels) foreach (ControlModel model in this.ControlModels)
{ {
@@ -3064,6 +3072,16 @@ namespace Lskj.Control.Model
if (userControl != null) if (userControl != null)
{ {
string fieldValue = this.GetControlValue(model); string fieldValue = this.GetControlValue(model);
if (beforeData != null &&
beforeData.Table != null &&
beforeData.Table.Columns.Contains(model.FieldName) &&
AuditChangeLog.IsSameValue(beforeData[model.FieldName] + "", fieldValue))
{
continue;
}
if (fieldValue == "****") continue; if (fieldValue == "****") continue;
if (model.FieldType == 7) if (model.FieldType == 7)
{ {
@@ -4373,6 +4391,8 @@ namespace Lskj.Control.Model
model.FieldType = 161; model.FieldType = 161;
model.IsRadio = true; model.IsRadio = true;
} }
return model; return model;
} }
/// <summary> /// <summary>
@@ -4727,7 +4747,11 @@ namespace Lskj.Control.Model
multiAutoEdit.ValueField = model.ValueMember; multiAutoEdit.ValueField = model.ValueMember;
multiAutoEdit.TextField = model.TextMember; multiAutoEdit.TextField = model.TextMember;
multiAutoEdit.ControlObj = this; multiAutoEdit.ControlObj = this;
multiAutoEdit.CurrentOperColumnKey= Model.ModuleCode + "_" + model.FieldName; if (Model != null)
{
multiAutoEdit.CurrentOperColumnKey = Model.ModuleCode + "_" + model.FieldName;
}
//multiAutoEdit.SetDataSource(dataSource); //multiAutoEdit.SetDataSource(dataSource);
multiAutoEdit.TextBoxProhibition = model.TextBoxProhibition; multiAutoEdit.TextBoxProhibition = model.TextBoxProhibition;
multiAutoEdit.TextEdit.KeyDown += new KeyEventHandler(OnTextEditKeyDown); multiAutoEdit.TextEdit.KeyDown += new KeyEventHandler(OnTextEditKeyDown);
+1 -1
View File
@@ -2081,7 +2081,7 @@ namespace Lskj.Control
{ {
if (this.gridLeft.Visible) this.OnGridViewRowClick(null, null); if (this.gridLeft.Visible) this.OnGridViewRowClick(null, null);
if (this.treeGridLeft.Visible) this.TreeListObj_Click(null, null); if (this.treeGridLeft.Visible) this.TreeListObj_Click(null, null);
if (this.treeLeft.Visible) if (this.treeLeft.Visible&& this.treeLeft.TreeView.SelectedNode!=null)
{ {
TreeViewEventArgs treeViewEventArgs = new TreeViewEventArgs(this.treeLeft.TreeView.SelectedNode); TreeViewEventArgs treeViewEventArgs = new TreeViewEventArgs(this.treeLeft.TreeView.SelectedNode);
this.OnTreeLeftTreeNodeSelected(null, treeViewEventArgs); this.OnTreeLeftTreeNodeSelected(null, treeViewEventArgs);
@@ -707,6 +707,13 @@ namespace Lskj.Control
} }
} }
if (model!=null&& !string.IsNullOrWhiteSpace(model.VisibleCond))
{
tabPage.PageVisible = !ValidateCond(model.VisibleCond, rowItem);
if (!tabPage.PageVisible) return;
}
if (IsDynamicDetailType) if (IsDynamicDetailType)
{ {
@@ -1464,7 +1471,46 @@ namespace Lskj.Control
} }
/// <summary>
/// <para>说明:检查可用条件</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-11-09 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="cond">The cond.</param>
/// <param name="dataRow">The data row.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
private bool ValidateCond(string cond, DataRow dataRow)
{
bool result = false;
string condition = cond;
try
{
if (string.IsNullOrWhiteSpace(cond)) return true;//如果值是空格或者空行,默认正确
cond = ReplaceHelper.ReplaceRowParamEmptyWrapQuote(dataRow, cond);
if (cond.StartsWith("@") || cond.StartsWith("!"))
{
result = "1".Equals(BaseImpl.GetDefaultValue(cond));
}
else if (dataRow == null)
{
result = ReplaceHelper.EvalCond(cond);
}
else
{
result = ReplaceHelper.ReplaceRowParamCond(dataRow, cond);
}
return result;
}
catch (Exception ex)
{
}
return result;
}
+11 -6
View File
@@ -538,6 +538,14 @@ namespace Lskj.Control
if (fixedQuery) if (fixedQuery)
{ {
//固定条件不显示,隐藏上方。(只显示表格)
if (SystemInfo.Instance.HideFixedConditions)
{
this.pl_top.Visible = false;
return;
}
this.pl_top_fix_search.Visible = true; this.pl_top_fix_search.Visible = true;
// 加载固定查询条件 // 加载固定查询条件
@@ -560,11 +568,7 @@ namespace Lskj.Control
this.SearchObj.InitDefaultSearchControl(table, this.pl_top_fix_search, false); this.SearchObj.InitDefaultSearchControl(table, this.pl_top_fix_search, false);
else else
this.SearchObj.InitDefaultSearchControl(table, this.pl_top_fix_search); this.SearchObj.InitDefaultSearchControl(table, this.pl_top_fix_search);
//固定条件不显示,隐藏上方。(只显示表格)
if (SystemInfo.Instance.HideFixedConditions)
{
this.pl_top.Visible = false;
}
} }
else else
{ {
@@ -1680,7 +1684,8 @@ namespace Lskj.Control
} }
else else
{ {
cond = ReplaceHelper.ReplaceRowParam(dataRow, cond); //cond = ReplaceHelper.ReplaceRowParam(dataRow, cond);
cond = ReplaceHelper.ReplaceRowParamEmptyWrapQuote(dataRow, cond);
if (cond.StartsWith("@") || cond.StartsWith("!")) if (cond.StartsWith("@") || cond.StartsWith("!"))
{ {
result = "1".Equals(BaseImpl.GetDefaultValue(cond)); result = "1".Equals(BaseImpl.GetDefaultValue(cond));
+4 -2
View File
@@ -396,7 +396,8 @@ namespace Lskj.Control
DataRow gridRow = dataRowView != null ? dataRowView.Row : null; DataRow gridRow = dataRowView != null ? dataRowView.Row : null;
foreach (DataRow item in this.GridRowColorsTable.Rows) foreach (DataRow item in this.GridRowColorsTable.Rows)
{ {
string cond = ReplaceHelper.ReplaceRowParam(gridRow, item["condition"] + ""); //string cond = ReplaceHelper.ReplaceRowParam(gridRow, item["condition"] + "");
string cond = ReplaceHelper.ReplaceRowParamEmptyWrapQuote(gridRow, item["condition"] + "");
try try
{ {
if (!string.IsNullOrWhiteSpace(cond) && ReplaceHelper.EvalCond(cond)) if (!string.IsNullOrWhiteSpace(cond) && ReplaceHelper.EvalCond(cond))
@@ -448,7 +449,8 @@ namespace Lskj.Control
DataRow gridRow = dataRowView != null ? dataRowView.Row : null; DataRow gridRow = dataRowView != null ? dataRowView.Row : null;
foreach (DataRow item in this.GridRowColorsTable.Rows) foreach (DataRow item in this.GridRowColorsTable.Rows)
{ {
string cond = ReplaceHelper.ReplaceRowParam(gridRow, item["condition"] + "").ReplaceColumnParam(e.Column.Name, e.Column.Caption, e.CellValue + ""); //string cond = ReplaceHelper.ReplaceRowParam(gridRow, item["condition"] + "").ReplaceColumnParam(e.Column.Name, e.Column.Caption, e.CellValue + "");
string cond = ReplaceHelper.ReplaceRowParamEmptyWrapQuote(gridRow, item["condition"] + "").ReplaceColumnParam(e.Column.Name, e.Column.Caption, e.CellValue + "");
try try
{ {
if (!string.IsNullOrWhiteSpace(cond) && ReplaceHelper.EvalCond(cond)) if (!string.IsNullOrWhiteSpace(cond) && ReplaceHelper.EvalCond(cond))
@@ -3665,6 +3665,15 @@ namespace Lskj.PubAccraditation
string newfieldValue = fieldValue; string newfieldValue = fieldValue;
if (fieldValue == "****") continue; if (fieldValue == "****") continue;
if (SystemInfo.Instance.IsSpecialAuditSave &&
this._drBillInfoMsg != null &&
this._drBillInfoMsg.Table != null &&
this._drBillInfoMsg.Table.Columns.Contains(model.FieldName) &&
AuditChangeLog.IsSameValue(this._drBillInfoMsg[model.FieldName] + "", fieldValue))
{
continue;
}
if ((model.FieldType == ControlType.LabDate || if ((model.FieldType == ControlType.LabDate ||
model.FieldType == ControlType.LabDate || model.FieldType == ControlType.LabDate ||
model.FieldType == ControlType.LabDate || model.FieldType == ControlType.LabDate ||
@@ -3683,7 +3692,12 @@ namespace Lskj.PubAccraditation
} }
} }
SaveErrorMessage = errorMessage; SaveErrorMessage = errorMessage;
return string.Format("update {0} set {1} where {2}='{3}'", this.BillModelObj.MasterTable, updateBuilder.ToString().TrimEnd(','), BillModelObj.PrimaryKey, this.SysModel.BillDocumentId); string updateFields = updateBuilder.ToString().TrimEnd(',');
if (string.IsNullOrEmpty(updateFields))
{
return string.Empty;
}
return string.Format("update {0} set {1} where {2}='{3}'", this.BillModelObj.MasterTable, updateFields, BillModelObj.PrimaryKey, this.SysModel.BillDocumentId);
} }
#endregion #endregion
+44
View File
@@ -528,6 +528,50 @@ namespace Lskj.Util
} }
return param; return param;
} }
/// <summary>
/// 说明:说明:替换"{字段}"格式字符串,已替换操作员等信息,其中替换后空值会加上引号
/// {xxx}=0 原本替换 =0 现在替换 ''=0
/// </summary>
/// <param name="row"></param>
/// <param name="param"></param>
/// <returns></returns>
public static string ReplaceRowParamEmptyWrapQuote(DataRow row, string param)
{
param = ReplaceUserInfo(param);
if (row == null) return param;
param = param.Replace(_rightLineStatus, (int)row.RowState + "", true);
List<string> condition = GetParamFields(param);
foreach (string item in condition)
{
string field = item.Replace("{", "").Replace("}", "");
string value = row.Table.Columns.Contains(field) ? row[field] + "" : item;
if (!string.IsNullOrEmpty(value) || value == item)
{
param = param.Replace(item, value);
continue;
}
string sourceParam = param;
param = Regex.Replace(sourceParam, Regex.Escape(item), match =>
{
int rightIndex = match.Index + match.Length;
bool isWrappedBySingleQuote = match.Index > 0 && rightIndex < sourceParam.Length &&
sourceParam[match.Index - 1] == '\'' && sourceParam[rightIndex] == '\'';
bool isWrappedByDoubleQuote = match.Index > 0 && rightIndex < sourceParam.Length &&
sourceParam[match.Index - 1] == '"' && sourceParam[rightIndex] == '"';
return isWrappedBySingleQuote || isWrappedByDoubleQuote ? string.Empty : "''";
});
}
return param;
}
/// <summary> /// <summary>
/// <para>说明:说明:替换"{字段}"格式字符串,已替换操作员等信息</para> /// <para>说明:说明:替换"{字段}"格式字符串,已替换操作员等信息</para>
/// <para>创建人:龚宇超</para> /// <para>创建人:龚宇超</para>