feat: 更新控件及相关业务功能
This commit is contained in:
@@ -161,6 +161,8 @@ namespace Lskj.AutoWordFile
|
||||
catch { }
|
||||
}
|
||||
private DataSet Worddata(string modid, int tagid, int mid)
|
||||
{
|
||||
try
|
||||
{
|
||||
SqlParameter[] param =
|
||||
{
|
||||
@@ -174,6 +176,13 @@ namespace Lskj.AutoWordFile
|
||||
param[2].Value = mid;
|
||||
DataSet ds = SqlHelper.ExecuteDataSet(CommandType.StoredProcedure, "pr_system_File01", "#ba_firstpage", param);
|
||||
return ds;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
public void Mulu()
|
||||
{
|
||||
|
||||
@@ -615,7 +615,7 @@ namespace Lskj.BaseAccraditation
|
||||
{
|
||||
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")
|
||||
{
|
||||
@@ -1733,6 +1733,7 @@ namespace Lskj.BaseAccraditation
|
||||
{
|
||||
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))
|
||||
{
|
||||
@@ -1911,6 +1912,7 @@ namespace Lskj.BaseAccraditation
|
||||
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;
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,6 +66,9 @@ namespace Lskj.Business
|
||||
|
||||
if (item.Table.Columns.Contains("UpdateAddressXp") && ERPInfo.Instance.SystemVersion.Contains("Windows XP"))
|
||||
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"] + "";
|
||||
@@ -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";
|
||||
}
|
||||
Instance.IsSpecialAuditSave = item.Table.Columns.Contains("IsSpecialAuditSave") && !string.IsNullOrEmpty(item["IsSpecialAuditSave"] + "") ? "1".Equals(item["IsSpecialAuditSave"] + "") : false;
|
||||
}
|
||||
/// <summary>
|
||||
/// 高拍仪AccessKey
|
||||
@@ -1161,9 +1165,12 @@ namespace Lskj.Business
|
||||
/// </summary>
|
||||
public string DeadlockPrompt;
|
||||
/// <summary>
|
||||
/// 附件浏览器自带逻辑
|
||||
/// 附件按钮打开Lskj.PubBrower2.dll
|
||||
/// </summary>
|
||||
public bool SpecialAttachmentBrowser;
|
||||
|
||||
/// <summary>
|
||||
/// 特殊审核保存模式(修改语句只拼接修改后的控件)
|
||||
/// </summary>
|
||||
public bool IsSpecialAuditSave;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2016,7 +2016,7 @@ namespace Lskj.Control
|
||||
}
|
||||
|
||||
//选中上一次选中行行号
|
||||
if (SelectGridControlEx != null && oldRowHandle > 0)
|
||||
if (SelectGridControlEx != null && oldRowHandle >= 0)
|
||||
{
|
||||
SelectGridControlEx.GridView.SelectRowHandler(oldRowHandle);
|
||||
OnPcgridRowCellClick(SelectGridControlEx.GridView, null);
|
||||
@@ -2057,10 +2057,25 @@ namespace Lskj.Control
|
||||
string fieldValue = this.ControlObj.GetControlValue(model);
|
||||
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.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);
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -258,7 +258,8 @@ namespace Lskj.Control
|
||||
DataRow gridRow = this.GridView.GetDataRow(e.RowHandle);
|
||||
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
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(cond) && ReplaceHelper.EvalCond(cond))
|
||||
@@ -360,7 +361,8 @@ namespace Lskj.Control
|
||||
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
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(cond) && ReplaceHelper.EvalCond(cond) && (!string.IsNullOrEmpty(e.CellValue + "") || isLaterDatePresent|| SystemInfo.Instance.isBlankCellColor))
|
||||
|
||||
+3
-4
@@ -31,11 +31,10 @@ namespace Lskj.Control
|
||||
{
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// FrmWebBrowser
|
||||
// FrmWebBrowser2
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Name = "FrmWebBrowser";
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.Name = "FrmWebBrowser2";
|
||||
this.Size = new System.Drawing.Size(800, 450);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
|
||||
@@ -1205,6 +1205,19 @@ namespace Lskj.Control
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:设置列格式化</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
@@ -6608,7 +6621,8 @@ namespace Lskj.Control
|
||||
DataRow gridRow = this.gridView.GetDataRow(e.RowHandle);
|
||||
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
|
||||
{
|
||||
|
||||
@@ -6669,7 +6683,8 @@ namespace Lskj.Control
|
||||
DataRow gridRow = this.gridView.GetDataRow(e.RowHandle);
|
||||
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
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(cond) && ReplaceHelper.EvalCond(cond))
|
||||
|
||||
@@ -182,7 +182,10 @@ namespace Lskj.Control.Model
|
||||
/// 判断两个值是否相同。
|
||||
/// 优先按日期、数字进行值比较,最后再按普通字符串比较。
|
||||
/// </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);
|
||||
newValue = NormalizeValue(newValue);
|
||||
|
||||
@@ -22,6 +22,7 @@ using System.IO;
|
||||
using System.Data.SqlClient;
|
||||
using Lskj.Business;
|
||||
using DevExpress.XtraGrid.Views.Grid;
|
||||
using Lskj.Core;
|
||||
|
||||
namespace Lskj.Control.Model
|
||||
{
|
||||
@@ -38,6 +39,12 @@ namespace Lskj.Control.Model
|
||||
/// </summary>
|
||||
private MyControl _controlObj;
|
||||
public bool issuccess = true;
|
||||
|
||||
/// <summary>
|
||||
/// 最初账套版本
|
||||
/// </summary>
|
||||
public DataRow AccountItem;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when [apply before].
|
||||
/// </summary>
|
||||
@@ -72,14 +79,13 @@ namespace Lskj.Control.Model
|
||||
/// <param name="rowItem">当前选中按钮绑定的数据源行</param>
|
||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
||||
public bool Apply(DataRow rowItem)
|
||||
{
|
||||
try
|
||||
{
|
||||
bool resultValue = false;
|
||||
if (rowItem == null || this._controlObj == null) return resultValue;
|
||||
|
||||
GridRightMenuModel model = new GridRightMenuModel(rowItem);
|
||||
|
||||
try
|
||||
{
|
||||
//if (!string.IsNullOrWhiteSpace(model.MenuCond))
|
||||
//{
|
||||
// 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))
|
||||
{
|
||||
@@ -186,6 +204,10 @@ namespace Lskj.Control.Model
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show(Message, ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (!string.IsNullOrEmpty(model.UnionZTid)) ToDBatching(AccountItem, AccountItem);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/// <summary>
|
||||
@@ -507,5 +529,29 @@ namespace Lskj.Control.Model
|
||||
}
|
||||
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>
|
||||
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>
|
||||
/// <para>说明:是否为Value类型</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
|
||||
@@ -307,6 +307,11 @@ namespace Lskj.Control.Model
|
||||
/// </summary>
|
||||
public bool AddHideBottomPanel;
|
||||
|
||||
/// <summary>
|
||||
/// 禁用条件
|
||||
/// </summary>
|
||||
public string VisibleCond;
|
||||
|
||||
/// <summary>
|
||||
/// 主模块编号
|
||||
/// </summary>
|
||||
@@ -379,6 +384,7 @@ namespace Lskj.Control.Model
|
||||
this.IgnoreAssociatedFields = item.Table.Columns.Contains("IgnoreAssociatedFields") ? "1".Equals(item["IgnoreAssociatedFields"] + "") : false;
|
||||
this.Library = item.Table.Columns.Contains("Library") ? item["Library"] + "" : "";
|
||||
this.AddHideBottomPanel = item.Table.Columns.Contains("AddHideBottomPanel") ? "1".Equals(item["AddHideBottomPanel"] + "") : false;
|
||||
this.VisibleCond = item.Table.Columns.Contains("VisibleCond") ? item["VisibleCond"] + "" : "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,15 +36,22 @@ namespace Lskj.Control.Model.MenuStrip
|
||||
}
|
||||
protected override void MenuStripOpening(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
int[] mSelectRows = this._gridView.GetSelectedRows();
|
||||
if (mSelectRows == null || mSelectRows.Length == 0) return;
|
||||
int[] mSelectRows = this._gridView.GetSelectedRows() ?? new int[0];
|
||||
|
||||
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;
|
||||
cmsMenu.Items.Clear();
|
||||
cmsMenu.Items.AddRange(this.RightMenuItems.ToArray());
|
||||
|
||||
if (mSelectRows.Length > 0)
|
||||
{
|
||||
DataRow mSelectRow = this._gridView.GetDataRow(mSelectRows[0]);
|
||||
|
||||
// 创建QQ、浏览器右键菜单
|
||||
List<ToolStripMenuItem> mQQArray = new List<ToolStripMenuItem>();
|
||||
List<ToolStripMenuItem> mBrowerArray = new List<ToolStripMenuItem>();
|
||||
@@ -84,6 +91,7 @@ namespace Lskj.Control.Model.MenuStrip
|
||||
|
||||
cmsMenu.Items.AddRange(mQQArray.ToArray());
|
||||
cmsMenu.Items.AddRange(mBrowerArray.ToArray());
|
||||
}
|
||||
|
||||
// 判断右键菜单是否可用
|
||||
foreach (ToolStripItem cms in cmsMenu.Items)
|
||||
@@ -95,34 +103,83 @@ namespace Lskj.Control.Model.MenuStrip
|
||||
{
|
||||
try
|
||||
{
|
||||
string cond = string.Empty;
|
||||
bool condResult = false;
|
||||
StringBuilder condBuilder = new StringBuilder();
|
||||
StringBuilder sqlCondBuilder = new StringBuilder();
|
||||
GridCell[] cells = this._gridView.GetSelectedCells();
|
||||
DataRow focusedRow = this.BaseGridView.GetFocusedDataRow();
|
||||
|
||||
DataRow[] conditionRows = dataRows;
|
||||
if (model.AllowNullExec && conditionRows.Length == 0)
|
||||
{
|
||||
conditionRows = new DataRow[] { new DataTable().NewRow() };
|
||||
}
|
||||
|
||||
foreach (DataRow selectRow in conditionRows)
|
||||
{
|
||||
string cond = ReplaceHelper.ReplaceUserInfo(model.MenuCond);
|
||||
cond = RaiseBeforeHandleParamsCallback(model.ParamList, conditionRows, model.MenuCond, selectRow, cond);
|
||||
if (this._control != null)
|
||||
cond = _control.ReplaceParentControlValue(model.MenuCond);
|
||||
cond = ReplaceHelper.ReplaceRowParam(mSelectRow, model.MenuCond);
|
||||
{
|
||||
cond = _control.ReplaceParentControlValue(cond);
|
||||
}
|
||||
//cond = ReplaceHelper.ReplaceRowParam(selectRow, cond);
|
||||
cond = ReplaceHelper.ReplaceRowParamEmptyWrapQuote(selectRow, cond);
|
||||
if (model.Mergeexec && cond.StartsWith("@"))
|
||||
{
|
||||
//替换[],替换的是多选行中的数据
|
||||
cond = ReplaceHelper.ReplaceRowParam(conditionRows, cond.Replace("[", "{").Replace("]", "}"), "", "");
|
||||
}
|
||||
|
||||
if (this._gridView != null)
|
||||
{
|
||||
GridCell[] cells = this._gridView.GetSelectedCells();
|
||||
if (cells != null && cells.Length > 0 && cond.Contains("{COLUMN_"))
|
||||
{
|
||||
GridCell cell = cells[0];
|
||||
DataRow focusedRow = this.BaseGridView.GetFocusedDataRow();
|
||||
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 ");
|
||||
}
|
||||
}
|
||||
string condStr = model.MenuCond;
|
||||
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);
|
||||
if (model.ForbiddenDisplay)
|
||||
{
|
||||
cms.Visible = ValidateCond(cond, null); ;
|
||||
cms.Visible = condResult;
|
||||
}
|
||||
cms.Enabled = ValidateCond(cond, null); ;
|
||||
cms.Enabled = condResult;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show(ResourceKeys.SetRightMenuCondFault + "\r\n" + Message);
|
||||
e.Cancel = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ namespace Lskj.Control.Model
|
||||
/// 最初账套版本
|
||||
/// </summary>
|
||||
public DataRow AccountItem;
|
||||
|
||||
public DataTable MenuTable;
|
||||
public DynamicModel Model;
|
||||
public MyControl ControlObj;
|
||||
@@ -267,7 +268,7 @@ namespace Lskj.Control.Model
|
||||
public bool ValidateCond(string cond, DataRow dataRow)
|
||||
{
|
||||
bool result = false;
|
||||
cond = ReplaceHelper.ReplaceRowParam(dataRow, cond);
|
||||
cond = ReplaceHelper.ReplaceRowParamEmptyWrapQuote(dataRow, cond);
|
||||
if (cond.StartsWith("@") || cond.StartsWith("!"))
|
||||
{
|
||||
result = "1".Equals(BaseImpl.GetDefaultValue(cond));
|
||||
|
||||
@@ -147,8 +147,8 @@ namespace Lskj.Control.Model
|
||||
{
|
||||
cond = _control.ReplaceParentControlValue(cond);
|
||||
}
|
||||
cond = ReplaceHelper.ReplaceRowParam(selectRow, cond);
|
||||
|
||||
//cond = ReplaceHelper.ReplaceRowParam(selectRow, cond);
|
||||
cond = ReplaceHelper.ReplaceRowParamEmptyWrapQuote(selectRow, cond);
|
||||
if (model.Mergeexec&& cond.StartsWith("@"))
|
||||
{
|
||||
//替换[],替换的是多选行中的数据
|
||||
|
||||
@@ -156,8 +156,8 @@ namespace Lskj.Control.Model.MenuStrip
|
||||
cond = RaiseBeforeHandleParamsCallback(model.ParamList, conditionRows, model.MenuCond, selectRow, cond);
|
||||
if (this._control != null)
|
||||
cond = _control.ReplaceParentControlValue(cond);
|
||||
cond = ReplaceHelper.ReplaceRowParam(selectRow, cond);
|
||||
|
||||
//cond = ReplaceHelper.ReplaceRowParam(selectRow, cond);
|
||||
cond = ReplaceHelper.ReplaceRowParamEmptyWrapQuote(selectRow, cond);
|
||||
if (model.Mergeexec && cond.StartsWith("@"))
|
||||
{
|
||||
//替换[],替换的是多选行中的数据
|
||||
|
||||
@@ -265,6 +265,12 @@ namespace Lskj.Control.Model
|
||||
///特殊左侧表
|
||||
/// </summary>
|
||||
public GridControlEx SpecialLeftTable;
|
||||
/// <summary>
|
||||
///修改前的数据源
|
||||
/// </summary>
|
||||
public DataRow beforeData;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 控件Panel对象
|
||||
/// </summary>
|
||||
@@ -3048,6 +3054,8 @@ namespace Lskj.Control.Model
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
// 修改记录
|
||||
foreach (ControlModel model in this.ControlModels)
|
||||
{
|
||||
@@ -3064,6 +3072,16 @@ namespace Lskj.Control.Model
|
||||
if (userControl != null)
|
||||
{
|
||||
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 (model.FieldType == 7)
|
||||
{
|
||||
@@ -4373,6 +4391,8 @@ namespace Lskj.Control.Model
|
||||
model.FieldType = 161;
|
||||
model.IsRadio = true;
|
||||
}
|
||||
|
||||
|
||||
return model;
|
||||
}
|
||||
/// <summary>
|
||||
@@ -4727,7 +4747,11 @@ namespace Lskj.Control.Model
|
||||
multiAutoEdit.ValueField = model.ValueMember;
|
||||
multiAutoEdit.TextField = model.TextMember;
|
||||
multiAutoEdit.ControlObj = this;
|
||||
if (Model != null)
|
||||
{
|
||||
multiAutoEdit.CurrentOperColumnKey = Model.ModuleCode + "_" + model.FieldName;
|
||||
}
|
||||
|
||||
//multiAutoEdit.SetDataSource(dataSource);
|
||||
multiAutoEdit.TextBoxProhibition = model.TextBoxProhibition;
|
||||
multiAutoEdit.TextEdit.KeyDown += new KeyEventHandler(OnTextEditKeyDown);
|
||||
|
||||
@@ -2081,7 +2081,7 @@ namespace Lskj.Control
|
||||
{
|
||||
if (this.gridLeft.Visible) this.OnGridViewRowClick(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);
|
||||
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)
|
||||
{
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -538,6 +538,14 @@ namespace Lskj.Control
|
||||
|
||||
if (fixedQuery)
|
||||
{
|
||||
|
||||
//固定条件不显示,隐藏上方。(只显示表格)
|
||||
if (SystemInfo.Instance.HideFixedConditions)
|
||||
{
|
||||
this.pl_top.Visible = false;
|
||||
return;
|
||||
}
|
||||
|
||||
this.pl_top_fix_search.Visible = true;
|
||||
|
||||
// 加载固定查询条件
|
||||
@@ -560,11 +568,7 @@ namespace Lskj.Control
|
||||
this.SearchObj.InitDefaultSearchControl(table, this.pl_top_fix_search, false);
|
||||
else
|
||||
this.SearchObj.InitDefaultSearchControl(table, this.pl_top_fix_search);
|
||||
//固定条件不显示,隐藏上方。(只显示表格)
|
||||
if (SystemInfo.Instance.HideFixedConditions)
|
||||
{
|
||||
this.pl_top.Visible = false;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1680,7 +1684,8 @@ namespace Lskj.Control
|
||||
}
|
||||
else
|
||||
{
|
||||
cond = ReplaceHelper.ReplaceRowParam(dataRow, cond);
|
||||
//cond = ReplaceHelper.ReplaceRowParam(dataRow, cond);
|
||||
cond = ReplaceHelper.ReplaceRowParamEmptyWrapQuote(dataRow, cond);
|
||||
if (cond.StartsWith("@") || cond.StartsWith("!"))
|
||||
{
|
||||
result = "1".Equals(BaseImpl.GetDefaultValue(cond));
|
||||
|
||||
@@ -396,7 +396,8 @@ namespace Lskj.Control
|
||||
DataRow gridRow = dataRowView != null ? dataRowView.Row : null;
|
||||
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
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(cond) && ReplaceHelper.EvalCond(cond))
|
||||
@@ -448,7 +449,8 @@ namespace Lskj.Control
|
||||
DataRow gridRow = dataRowView != null ? dataRowView.Row : null;
|
||||
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
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(cond) && ReplaceHelper.EvalCond(cond))
|
||||
|
||||
@@ -3665,6 +3665,15 @@ namespace Lskj.PubAccraditation
|
||||
string newfieldValue = fieldValue;
|
||||
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 ||
|
||||
model.FieldType == ControlType.LabDate ||
|
||||
model.FieldType == ControlType.LabDate ||
|
||||
@@ -3683,7 +3692,12 @@ namespace Lskj.PubAccraditation
|
||||
}
|
||||
}
|
||||
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
|
||||
|
||||
|
||||
@@ -528,6 +528,50 @@ namespace Lskj.Util
|
||||
}
|
||||
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>
|
||||
/// <para>说明:说明:替换"{字段}"格式字符串,已替换操作员等信息</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
|
||||
Reference in New Issue
Block a user