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
+51 -5
View File
@@ -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>
@@ -73,13 +80,12 @@ namespace Lskj.Control.Model
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
public bool Apply(DataRow rowItem)
{
bool resultValue = false;
if (rowItem == null || this._controlObj == null) return resultValue;
GridRightMenuModel model = new GridRightMenuModel(rowItem);
try
{
bool resultValue = false;
if (rowItem == null || this._controlObj == null) return resultValue;
GridRightMenuModel model = new GridRightMenuModel(rowItem);
//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);
}
}
}
}