提交单据管理和修改密码功能

This commit is contained in:
cyf
2026-07-28 10:16:51 +08:00
parent e4b40a32d7
commit b893e8d8e4
75 changed files with 16227 additions and 309 deletions
+332 -195
View File
@@ -611,58 +611,67 @@ namespace Lskj.PubBill
#endregion
#region
GridControlEx gridDetail = new GridControlEx();
if (model.sourceDetailType.Equals("1"))
if (!string.IsNullOrWhiteSpace(model.DetailModeCode))
{
//明细为树表格
gridDetail = new TreeGridControlEx();
billModuleModel.SourceDetailControl = gridDetail;
//创建表格列
cachesDic.AddTask(gridDetail, "DynamicModel", dynamicModelTask);
gridDetail.GetDataCaches(cachesDic, GridCustomColumnStruct.BillSourceDetailGridView + model.FormKey);
Task<DataTable> detailGridRowColorsTask = cachesDic.AddTask(gridDetail, "BaseGridRowColors", new Task<DataTable>(() =>
{
return BaseModuleImpl.GetBaseGridRowColors("SOURCEDETAIL_" + model.FormKey);
}));
Task<DataTable> detailGridRightMenusTask = cachesDic.AddTask(gridDetail, "BaseGridRightMenus", new Task<DataTable>(() =>
{
return BaseModuleImpl.GetBaseGridRightMenus("BILLSOURCEDT_" + model.FormKey);
}));
}
else
else
{
gridDetail = new GridControlEx();
billModuleModel.SourceDetailControl = gridDetail;
//创建表格列
cachesDic.AddTask(gridDetail, "DynamicModel", dynamicModelTask);
gridDetail.GetDataCaches(cachesDic, GridCustomColumnStruct.BillSourceDetailGridView + model.FormKey);
Task<DataTable> detailGridRowColorsTask = cachesDic.AddTask(gridDetail, "BaseGridRowColors", new Task<DataTable>(() =>
if (model.sourceDetailType.Equals("1"))
{
return BaseModuleImpl.GetBaseGridRowColors("SOURCEDETAIL_" + model.FormKey);
}));
Task<DataTable> detailGridRightMenusTask = cachesDic.AddTask(gridDetail, "BaseGridRightMenus", new Task<DataTable>(() =>
{
return BaseModuleImpl.GetBaseGridRightMenus("BILLSOURCEDT_" + model.FormKey);
}));
//明细的明细(明细分成左右2个)
if (!string.IsNullOrEmpty(model.SourceDetailsDetailsSql))
{
GridControlEx gridDetail_Details = new GridControlEx();
billModuleModel.SourceDetailDetailControl = gridDetail_Details;
//创建只读列
Task<DataTable> detailDetailsTask = cachesDic.AddTask(gridDetail_Details, "DetailDetails", new Task<DataTable>(() =>
{
return BaseModuleImpl.getDetail_Details(model.FormKey);
}));
//明细为树表格
gridDetail = new TreeGridControlEx();
billModuleModel.SourceDetailControl = gridDetail;
//创建表格列
cachesDic.AddTask(gridDetail_Details, "DynamicModel", dynamicModelTask);
gridDetail_Details.GetDataCaches(cachesDic);
Task<DataTable> detailDetailsGridRightMenusTask = cachesDic.AddTask(gridDetail_Details, "BaseGridRightMenus", new Task<DataTable>(() =>
cachesDic.AddTask(gridDetail, "DynamicModel", dynamicModelTask);
gridDetail.GetDataCaches(cachesDic, GridCustomColumnStruct.BillSourceDetailGridView + model.FormKey);
Task<DataTable> detailGridRowColorsTask = cachesDic.AddTask(gridDetail, "BaseGridRowColors", new Task<DataTable>(() =>
{
return BaseModuleImpl.GetBaseGridRightMenus("BILLSOURCEDTX_" + model.FormKey);
return BaseModuleImpl.GetBaseGridRowColors("SOURCEDETAIL_" + model.FormKey);
}));
Task<DataTable> detailGridRightMenusTask = cachesDic.AddTask(gridDetail, "BaseGridRightMenus", new Task<DataTable>(() =>
{
return BaseModuleImpl.GetBaseGridRightMenus("BILLSOURCEDT_" + model.FormKey);
}));
}
}
else
{
gridDetail = new GridControlEx();
billModuleModel.SourceDetailControl = gridDetail;
//创建表格列
cachesDic.AddTask(gridDetail, "DynamicModel", dynamicModelTask);
gridDetail.GetDataCaches(cachesDic, GridCustomColumnStruct.BillSourceDetailGridView + model.FormKey);
Task<DataTable> detailGridRowColorsTask = cachesDic.AddTask(gridDetail, "BaseGridRowColors", new Task<DataTable>(() =>
{
return BaseModuleImpl.GetBaseGridRowColors("SOURCEDETAIL_" + model.FormKey);
}));
Task<DataTable> detailGridRightMenusTask = cachesDic.AddTask(gridDetail, "BaseGridRightMenus", new Task<DataTable>(() =>
{
return BaseModuleImpl.GetBaseGridRightMenus("BILLSOURCEDT_" + model.FormKey);
}));
//明细的明细(明细分成左右2个)
if (!string.IsNullOrEmpty(model.SourceDetailsDetailsSql))
{
GridControlEx gridDetail_Details = new GridControlEx();
billModuleModel.SourceDetailDetailControl = gridDetail_Details;
//创建只读列
Task<DataTable> detailDetailsTask = cachesDic.AddTask(gridDetail_Details, "DetailDetails", new Task<DataTable>(() =>
{
return BaseModuleImpl.getDetail_Details(model.FormKey);
}));
//创建表格列
cachesDic.AddTask(gridDetail_Details, "DynamicModel", dynamicModelTask);
gridDetail_Details.GetDataCaches(cachesDic);
Task<DataTable> detailDetailsGridRightMenusTask = cachesDic.AddTask(gridDetail_Details, "BaseGridRightMenus", new Task<DataTable>(() =>
{
return BaseModuleImpl.GetBaseGridRightMenus("BILLSOURCEDTX_" + model.FormKey);
}));
}
}
}
#endregion
BillModuleModelDic.Add(sourceModelRow, billModuleModel);
#region
@@ -825,6 +834,9 @@ namespace Lskj.PubBill
this.gcMain.Dock = DockStyle.Fill;
this.pl_main_center_detail.Controls.Add(this.gcMain);
(this.gcMain as TreeGridControlEx).Expansion = this.BillModel.DetailTreeTableExpansion;
(this.gcMain as TreeGridControlEx).UseSegmentedNodeId = this.BillModel.NewNodeRules;
(this.gcMain as TreeGridControlEx).TreeNumberNodes = this.BillModel.TreeNumberNodes;
(this.gcMain as TreeGridControlEx).BillPaste = true;
(this.gcMain as TreeGridControlEx).AddRightButton();
//节点编号
(this.gcMain as TreeGridControlEx).TreeListObj.KeyFieldName = "tap_id";
@@ -1881,25 +1893,6 @@ namespace Lskj.PubBill
controls = BaseModuleImpl.GetCustomQueryFields(model.FormKey);
}
if (false)
{
string menuCode = string.Empty;
DataRow modelRow = MainImpl.GetSystemdllTab(menuCode);//获取模块信息
ModuleModel sysModel = new ModuleModel(modelRow);
//设置主表sql
//model.SourceSql = sysModel.MenuSql;
//获取主表列
DataTable dtSourceColumns = BaseModuleImpl.GetBaseGridColumns(sysModel.ModeCode);
//获取明细消息
//明细sql
//model.DetailSql
}
XtraTabPage tabPage = new XtraTabPage();
tabPage.Text = model.UserName;
@@ -1924,42 +1917,21 @@ namespace Lskj.PubBill
GridControlEx gridControl = null;
TreeViewEx treeView = null;
if (model.SourceType == 1)
DataTable SourceMainColumns = new DataTable();
if (!string.IsNullOrWhiteSpace(model.SourceModeCode))
{
// 来源为树类型
treeView = sourceControl != null ? (TreeViewEx)sourceControl : new TreeViewEx();
treeView.BorderStyle = BorderStyle.None;
treeView.Dock = DockStyle.Fill;
treeView.TreeNodeKeyField = model.SourceKeyField;
treeView.TreeNodeTextField = model.SourceResult;
if (!dataCaches.GetValue(treeView, "BindTreeTable", out DataTable bindTreeTable))
{
bindTreeTable = BaseImpl.GetDataTableResult(model.SourceSql);
}
treeView.TreeInhibitSort = model.TreeInhibitSort;
treeView.BindTreeView(bindTreeTable);
treeView.TreeNodeSelectAfter += new TreeViewEventHandler(OnTreeNodeSelectAfter);
string menuCode = model.SourceModeCode;
DataRow modelRow = MainImpl.GetSystemdllTab(menuCode);//获取模块信息
ModuleModel sysModel = new ModuleModel(modelRow);
//设置主表sql
model.ChangeSourceSql(sysModel.MenuSql);
//主表主键
string parmaryKey = BaseImpl.GetBasePrimaryKey(sysModel.ModeCode);//获取主键
unionModel.ParmaryKey = parmaryKey;
tabPage.Controls.Add(treeView);
}
else if (model.SourceType == 5)
{
model.ChangeSourceType(2);//单据来源显示条数
this.IsBillShowCount = true;
}
else if (model.SourceType == 3 || model.SourceType == 4)
{
//类型为3,是树表格类型的单据管理。
//类型为4,是树表格类型的数据来源
gridControl = sourceControl != null ? (TreeGridControlEx)sourceControl : new TreeGridControlEx();
gridControl.Dock = DockStyle.Fill;
gridControl.BorderStyle = System.Windows.Forms.BorderStyle.None;
gridControl.Model = this.SysModel;
if (!dataCaches.GetValue(gridControl, "SourceColumns", out DataTable dtSourceColumns))
{
dtSourceColumns = BillImpl.GetSourceColumns(model.Id);
}
//获取主表列
SourceMainColumns = BaseModuleImpl.GetBaseGridColumns(sysModel.ModeCode);
if (!dataCaches.GetValue(gridControl, "BaseGridRowColors", out DataTable dtBaseGridRowColors))
{
dtBaseGridRowColors = BaseModuleImpl.GetBaseGridRowColors("BILLSOURCE_" + model.FormKey);
@@ -1968,27 +1940,48 @@ namespace Lskj.PubBill
{
dtBaseGridRightMenus = BaseModuleImpl.GetBaseGridRightMenus("BILLSOURCE_" + model.FormKey);
}
if (model.SourceType == 3 || model.SourceType == 4)
{
gridControl = sourceControl != null ? (TreeGridControlEx)sourceControl : new TreeGridControlEx();
gridControl.Dock = DockStyle.Fill;
gridControl.BorderStyle = System.Windows.Forms.BorderStyle.None;
gridControl.Model = this.SysModel;
}
else
{
// 来源为表格类型
gridControl = sourceControl != null ? (GridControlEx)sourceControl : new GridControlEx();
gridControl.BorderStyle = BorderStyle.None;
gridControl.Model = this.SysModel;
gridControl.Dock = DockStyle.Fill;
gridControl.ExportPermission = this.BillModel.ExportPermission;
}
//节点编号
if (!string.IsNullOrWhiteSpace(model.SourceKeyFieldName)) (gridControl as TreeGridControlEx).TreeListObj.KeyFieldName = model.SourceKeyFieldName;
//父节点编号
if (!string.IsNullOrWhiteSpace(model.SourceParentFieldName)) (gridControl as TreeGridControlEx).TreeListObj.ParentFieldName = model.SourceParentFieldName;
gridControl.SetReadOnlyColumns(dtSourceColumns, GridCustomColumnStruct.BillSourceGridView + model.FormKey);
gridControl.SetReadOnlyColumns(SourceMainColumns, GridCustomColumnStruct.BillSourceGridView + model.FormKey);
gridControl.SetGridRowColors(dtBaseGridRowColors);
//gridControl.SetGridRightMenus(dtBaseGridRightMenus, this.SysModel, OnGridControlRightCallback);
(gridControl as TreeGridControlEx).SetGridRightMenus(dtBaseGridRightMenus, this.SysModel, OnGridControlRightCallback);
unionModel.TreeGridControlObj = gridControl as TreeGridControlEx;
unionModel.TreeGridControlObj.TreeListObj.FocusedNodeChanged += new DevExpress.XtraTreeList.FocusedNodeChangedEventHandler(OnTreeListObjFocusedNodeChanged);
gridControl.SetGridRightMenus(dtBaseGridRightMenus, this.SysModel, OnGridControlRightCallback);
//基础ModuleGridEx
// DynamicModuleModel dyncModel = new DynamicModuleModel(new[]
//{ sysModel.MenuName, ERPInfo.Instance.UserId, ERPInfo.Instance.UserName,
// this.SysModel.Privilege, sysModel.ModeCode, "0" });
// ModuleGridEx MainGridEx = new ModuleGridEx();
// MainGridEx.Dock = DockStyle.Fill;
// MainGridEx.VisibleSearchPanel = false;//禁止上方搜索
// MainGridEx.InitializeControl(sysModel, dyncModel);
// gridControl = MainGridEx.GridControlObj;
if (BillModel.IsBillSourceCheck == 1)
{
GridDragGrid.TreeListAddCheckBox((gridControl as TreeGridControlEx).TreeListObj);
GridDragGrid.GridAddCheckBox(gridControl.GridView);
}
if (model.SourceType == 4)
if (sysModel.TreeAutoMultiHeader == 1)
{
//模块为树表格
model.ChangeSourceType(4);
unionModel.TreeGridControlObj = gridControl as TreeGridControlEx;
unionModel.TreeGridControlObj.TreeListObj.FocusedNodeChanged += new DevExpress.XtraTreeList.FocusedNodeChangedEventHandler(OnTreeListObjFocusedNodeChanged);
//来源拖拽到主表
if (this.BillModel.DetailTreeTable)
{
@@ -2003,55 +1996,9 @@ namespace Lskj.PubBill
treeGridDragGrid.OnDragComplete += TreeGridDragGrid_OnDragComplete;
}
}
tabPage.Controls.Add(gridControl);
}
else
{
// 来源为表格类型
gridControl = sourceControl != null ? (GridControlEx)sourceControl : new GridControlEx();
gridControl.BorderStyle = BorderStyle.None;
gridControl.Model = this.SysModel;
gridControl.Dock = DockStyle.Fill;
gridControl.ExportPermission = this.BillModel.ExportPermission;
if (model.LoadFilter)
{
gridControl.GridView.OptionsView.ShowAutoFilterRow = true;
}
if (!dataCaches.GetValue(gridControl, "SourceColumns", out DataTable dtSourceColumns))
{
dtSourceColumns = BillImpl.GetSourceColumns(model.Id);
}
if (!dataCaches.GetValue(gridControl, "BaseGridRowColors", out DataTable dtBaseGridRowColors))
{
dtBaseGridRowColors = BaseModuleImpl.GetBaseGridRowColors("BILLSOURCE_" + model.FormKey);
}
if (!dataCaches.GetValue(gridControl, "BaseGridRightMenus", out DataTable dtBaseGridRightMenus))
{
dtBaseGridRightMenus = BaseModuleImpl.GetBaseGridRightMenus("BILLSOURCE_" + model.FormKey);
}
gridControl.SetReadOnlyColumns(dtSourceColumns, GridCustomColumnStruct.BillSourceGridView + model.FormKey);
gridControl.SetGridRowColors(dtBaseGridRowColors);
gridControl.SetGridRightMenus(dtBaseGridRightMenus, this.SysModel, OnGridControlRightCallback);
//gridControl.GridView.SelectionChanged += new SelectionChangedEventHandler(OnGridControlSelectionChanged);
//gridControl.GridView.FocusedRowObjectChanged += OnFocusedRowObjectChanged;
if (model.DetailsDoubleClick)
{
gridControl.GridView.DoubleClick += OnSourceGridViewDoubleClick; // 2023-3-11 增加双击配置
}
else
{
gridControl.GridView.RowCellClick += OnGridViewRowCellClick; // 2019-11-12 cmd提出改为行点击事件,否则会出现保存提交后,单据管理无法查询出数据
}
if (BillModel.IsBillSourceCheck == 1)
{
GridDragGrid.GridAddCheckBox(gridControl.GridView);
}
if (model.SourceType == 0)
else
{
gridControl.GridView.RowCellClick += OnGridViewRowCellClick;
//来源拖拽到主表
if (this.BillModel.DetailTreeTable)
{
@@ -2067,8 +2014,177 @@ namespace Lskj.PubBill
}
}
tabPage.Controls.Add(gridControl);
//获取明细信息,第一个为对应的来源明细
DataTable table = BaseModuleImpl.GetBaseDetailPages(sysModel.ModeCode);//
if (table != null && table.Rows.Count > 0)
{
DataRow detailsRow = table.Rows[0];
GridDetailModel gridDetailModel = new GridDetailModel(detailsRow, new DataTable(), GridCustomColumnStruct.BaseDetailGridView);
//第一个页签的模块号 赋值给 来源明细模块号。后续来源明细会根据模块号加载
model.DetailModeCode = gridDetailModel.UnionModule;
DataRow Detail = MainImpl.GetSystemdllTab(gridDetailModel.UnionModule);//获取模块信息
ModuleModel DetailModel = new ModuleModel(Detail);
//明细sql gridDetailModel.IsReadOnly || gridDetailModel.IsChart ? gridDetailModel.DetailSql : DetailModel.MenuSql
model.ChangeSourceDetailSql(DetailModel.MenuSql);
unionModel.GridDetailModel = gridDetailModel;
}
}
else
{
if (model.SourceType == 1)
{
// 来源为树类型
treeView = sourceControl != null ? (TreeViewEx)sourceControl : new TreeViewEx();
treeView.BorderStyle = BorderStyle.None;
treeView.Dock = DockStyle.Fill;
treeView.TreeNodeKeyField = model.SourceKeyField;
treeView.TreeNodeTextField = model.SourceResult;
if (!dataCaches.GetValue(treeView, "BindTreeTable", out DataTable bindTreeTable))
{
bindTreeTable = BaseImpl.GetDataTableResult(model.SourceSql);
}
treeView.TreeInhibitSort = model.TreeInhibitSort;
treeView.BindTreeView(bindTreeTable);
treeView.TreeNodeSelectAfter += new TreeViewEventHandler(OnTreeNodeSelectAfter);
tabPage.Controls.Add(treeView);
}
else if (model.SourceType == 5)
{
model.ChangeSourceType(2);//单据来源显示条数
this.IsBillShowCount = true;
}
else if (model.SourceType == 3 || model.SourceType == 4)
{
//类型为3,是树表格类型的单据管理。
//类型为4,是树表格类型的数据来源
gridControl = sourceControl != null ? (TreeGridControlEx)sourceControl : new TreeGridControlEx();
gridControl.Dock = DockStyle.Fill;
gridControl.BorderStyle = System.Windows.Forms.BorderStyle.None;
gridControl.Model = this.SysModel;
if (!dataCaches.GetValue(gridControl, "SourceColumns", out DataTable dtSourceColumns))
{
dtSourceColumns = BillImpl.GetSourceColumns(model.Id);
}
if (!dataCaches.GetValue(gridControl, "BaseGridRowColors", out DataTable dtBaseGridRowColors))
{
dtBaseGridRowColors = BaseModuleImpl.GetBaseGridRowColors("BILLSOURCE_" + model.FormKey);
}
if (!dataCaches.GetValue(gridControl, "BaseGridRightMenus", out DataTable dtBaseGridRightMenus))
{
dtBaseGridRightMenus = BaseModuleImpl.GetBaseGridRightMenus("BILLSOURCE_" + model.FormKey);
}
//节点编号
if (!string.IsNullOrWhiteSpace(model.SourceKeyFieldName)) (gridControl as TreeGridControlEx).TreeListObj.KeyFieldName = model.SourceKeyFieldName;
//父节点编号
if (!string.IsNullOrWhiteSpace(model.SourceParentFieldName)) (gridControl as TreeGridControlEx).TreeListObj.ParentFieldName = model.SourceParentFieldName;
gridControl.SetReadOnlyColumns(dtSourceColumns, GridCustomColumnStruct.BillSourceGridView + model.FormKey);
gridControl.SetGridRowColors(dtBaseGridRowColors);
//gridControl.SetGridRightMenus(dtBaseGridRightMenus, this.SysModel, OnGridControlRightCallback);
(gridControl as TreeGridControlEx).SetGridRightMenus(dtBaseGridRightMenus, this.SysModel, OnGridControlRightCallback);
unionModel.TreeGridControlObj = gridControl as TreeGridControlEx;
unionModel.TreeGridControlObj.TreeListObj.FocusedNodeChanged += new DevExpress.XtraTreeList.FocusedNodeChangedEventHandler(OnTreeListObjFocusedNodeChanged);
if (BillModel.IsBillSourceCheck == 1)
{
GridDragGrid.TreeListAddCheckBox((gridControl as TreeGridControlEx).TreeListObj);
}
if (model.SourceType == 4)
{
//来源拖拽到主表
if (this.BillModel.DetailTreeTable)
{
TreeGridDragTree treeGridDragTree = new TreeGridDragTree((gridControl as TreeGridControlEx).TreeListObj, (this.gcMain as TreeGridControlEx).TreeListObj);
treeGridDragTree.CanDragParentNode = true;
treeGridDragTree.NeglectingNodes = true;
treeGridDragTree.OnDragComplete += TreeGridDragTree_OnDragComplete;
}
else
{
TreeGridDragGrid treeGridDragGrid = new TreeGridDragGrid((gridControl as TreeGridControlEx).TreeListObj, this.gcMain.GridView);
treeGridDragGrid.OnDragComplete += TreeGridDragGrid_OnDragComplete;
}
}
tabPage.Controls.Add(gridControl);
}
else
{
// 来源为表格类型
gridControl = sourceControl != null ? (GridControlEx)sourceControl : new GridControlEx();
gridControl.BorderStyle = BorderStyle.None;
gridControl.Model = this.SysModel;
gridControl.Dock = DockStyle.Fill;
gridControl.ExportPermission = this.BillModel.ExportPermission;
if (model.LoadFilter)
{
gridControl.GridView.OptionsView.ShowAutoFilterRow = true;
}
if (!dataCaches.GetValue(gridControl, "SourceColumns", out DataTable dtSourceColumns))
{
dtSourceColumns = BillImpl.GetSourceColumns(model.Id);
}
if (!dataCaches.GetValue(gridControl, "BaseGridRowColors", out DataTable dtBaseGridRowColors))
{
dtBaseGridRowColors = BaseModuleImpl.GetBaseGridRowColors("BILLSOURCE_" + model.FormKey);
}
if (!dataCaches.GetValue(gridControl, "BaseGridRightMenus", out DataTable dtBaseGridRightMenus))
{
dtBaseGridRightMenus = BaseModuleImpl.GetBaseGridRightMenus("BILLSOURCE_" + model.FormKey);
}
gridControl.SetReadOnlyColumns(dtSourceColumns, GridCustomColumnStruct.BillSourceGridView + model.FormKey);
gridControl.SetGridRowColors(dtBaseGridRowColors);
gridControl.SetGridRightMenus(dtBaseGridRightMenus, this.SysModel, OnGridControlRightCallback);
//gridControl.GridView.SelectionChanged += new SelectionChangedEventHandler(OnGridControlSelectionChanged);
//gridControl.GridView.FocusedRowObjectChanged += OnFocusedRowObjectChanged;
if (model.DetailsDoubleClick)
{
gridControl.GridView.DoubleClick += OnSourceGridViewDoubleClick; // 2023-3-11 增加双击配置
}
else
{
gridControl.GridView.RowCellClick += OnGridViewRowCellClick; // 2019-11-12 cmd提出改为行点击事件,否则会出现保存提交后,单据管理无法查询出数据
}
if (BillModel.IsBillSourceCheck == 1)
{
GridDragGrid.GridAddCheckBox(gridControl.GridView);
}
if (model.SourceType == 0)
{
//来源拖拽到主表
if (this.BillModel.DetailTreeTable)
{
GridDragTreeGrid dragDetailGrid = new GridDragTreeGrid(gridControl.GridView, (this.gcMain as TreeGridControlEx).TreeListObj);
dragDetailGrid.CanDragParentNode = true;
dragDetailGrid.NeglectingNodes = true;
dragDetailGrid.OnDragComplete += DragDetailGrid_OnDragMainGridCompleted;
}
else
{
GridDragGrid dragMainGrid = new GridDragGrid(gridControl.GridView, this.gcMain.GridView);
dragMainGrid.OnDragComplete += new GridFragGridCompleteEventHandler(OnDragMainGridCompleted);
}
}
tabPage.Controls.Add(gridControl);
}
}
#endregion
#region
@@ -2089,22 +2205,19 @@ namespace Lskj.PubBill
if (!string.IsNullOrWhiteSpace(model.DetailMenuCode))
if (!string.IsNullOrWhiteSpace(model.DetailModeCode))
{
//来源明细配置了模块号,根据模块号创建对应的ModuleGridEx
//ModuleGridEx主要是用保存的功能,数据源sql还是根据配置的为准
DataRow modelRow = MainImpl.GetSystemdllTab(model.DetailMenuCode);//获取模块信息
DataRow modelRow = MainImpl.GetSystemdllTab(model.DetailModeCode);//获取模块信息
if (modelRow == null)
{
MessageUtil.Show($"没有找到编号为 {model.DetailMenuCode} 的模块信息");
MessageUtil.Show($"没有找到编号为 {model.DetailModeCode} 的模块信息");
gridDetail.Parent = gridDetail;
continue;
}
ModuleModel sysModel = new ModuleModel(modelRow);
//设置主表sql
//model.SourceSql = sysModel.MenuSql;
DynamicModuleModel dyncModel = new DynamicModuleModel(new[]
{ sysModel.MenuName, ERPInfo.Instance.UserId, ERPInfo.Instance.UserName,
this.SysModel.Privilege, sysModel.ModeCode, "0" });
@@ -3942,6 +4055,14 @@ namespace Lskj.PubBill
}
else
{
if (unionModel.GridDetailModel != null && !string.IsNullOrWhiteSpace(unionModel.ParmaryKey)&& rowItem!=null)
{
//来源主表配置的模块,来源明细sql要拼接条件
string fieldName = !string.IsNullOrEmpty(unionModel.GridDetailModel.UnionParentField) && rowItem.Table.Columns.Contains(unionModel.GridDetailModel.UnionParentField) ? unionModel.GridDetailModel.UnionParentField : unionModel.ParmaryKey;
DetailSql = ReplaceHelper.ReplaceWhereCond(DetailSql) + string.Format(" and {0}='{1}'", unionModel.GridDetailModel.UnionValue, rowItem[fieldName]+"");
}
//有复选框的页签在刷新前清空选中行,否则合计在刷新数据源后不会自带改变
@@ -6927,7 +7048,7 @@ namespace Lskj.PubBill
{
string addSql = ReplaceHelper.ReplaceRowParam(rowItem, ReplaceHelper.ReplaceUserInfo(unionModel.AddDataSql));
DataTable dataTable = MainImpl.GetDataTableResult(addSql);
DragAddTable(dataTable, (int.Parse((this.gcMain as TreeGridControlEx).GetNewNodesId()) - 1) + "");////上方的新增行的id默认是最大的
DragAddTable(dataTable, (this.gcMain as TreeGridControlEx).GetLastNodesId(Pid));////上方的新增行的id默认是最大的
}
}
}
@@ -8795,7 +8916,7 @@ namespace Lskj.PubBill
//添加拖拽行对应的数据源
string addSql = ReplaceHelper.ReplaceRowParam(e.GridViewSelectRows, ReplaceHelper.ReplaceUserInfo(unionModel.AddDataSql));
DataTable dataTable = MainImpl.GetDataTableResult(addSql);
DragAddTable(dataTable, (int.Parse((this.gcMain as TreeGridControlEx).GetNewNodesId()) - 1) + "");//上方的新增行的id默认是最大的
DragAddTable(dataTable, (this.gcMain as TreeGridControlEx).GetLastNodesId(Pid));//上方的新增行的id默认是最大的
}
}
this.gcMain.GridView.SelectRowHandler(oldRowHandle);
@@ -8833,36 +8954,46 @@ namespace Lskj.PubBill
//数据源的id和pid全部加上目标节点(加上后当前数据源就是目标节点的子节点数据源)
if (dataTable.Columns.Contains(ParentFieldName) && dataTable.Columns.Contains(KeyFieldName))
{
//当前树表格中最大的id号
int NodeId = int.Parse((this.gcMain as TreeGridControlEx).GetNewNodesId()) - 1;
//当前树表格中如果id为null,要赋值的id值(节点id不能为null)
int NewNodeId = int.Parse((this.gcMain as TreeGridControlEx).GetNewNodesId());
if (this.BillModel.NewNodeRules)
{
dataTable = (this.gcMain as TreeGridControlEx).PrepareNodeIdsForInsert(dataTable, Pid);
}
else
{
//当前树表格中最大的id号
int NodeId = int.Parse((this.gcMain as TreeGridControlEx).GetNewNodesId()) - 1;
//当前树表格中如果id为null,要赋值的id值(节点id不能为null)
int NewNodeId = int.Parse((this.gcMain as TreeGridControlEx).GetNewNodesId());
//根据当前的节点号,改变新增数据源中的节点号
foreach (DataRow rowItem in dataTable.Rows)
{
// 新增表格中的数据id全部加上最大id号,如果是空就默认去赋最大id+1的值
if (!string.IsNullOrWhiteSpace(rowItem[KeyFieldName] + ""))
{
rowItem[KeyFieldName] = int.Parse(rowItem[KeyFieldName] + "") + NodeId;
}
else
{
rowItem[KeyFieldName] = NewNodeId;
NewNodeId++;
}
//pid为0或者null的改成目标节点的节点号,有值的默认加上最大id值
if (string.IsNullOrWhiteSpace(rowItem[ParentFieldName] + "") || int.Parse(rowItem[ParentFieldName] + "") == 0)
{
rowItem[ParentFieldName] = Pid;
}
else if (int.Parse(rowItem[ParentFieldName] + "") > 0)
{
rowItem[ParentFieldName] = int.Parse(rowItem[ParentFieldName] + "") + NodeId;
}
}
}
//根据当前的节点号,改变新增数据源中的节点号
foreach (DataRow rowItem in dataTable.Rows)
{
// 新增表格中的数据id全部加上最大id号,如果是空就默认去赋最大id+1的值
if (!string.IsNullOrWhiteSpace(rowItem[KeyFieldName] + ""))
{
rowItem[KeyFieldName] = int.Parse(rowItem[KeyFieldName] + "") + NodeId;
}
else
{
rowItem[KeyFieldName] = NewNodeId;
NewNodeId++;
}
//pid为0或者null的改成目标节点的节点号,有值的默认加上最大id值
if (string.IsNullOrWhiteSpace(rowItem[ParentFieldName] + "") || int.Parse(rowItem[ParentFieldName] + "") == 0)
{
rowItem[ParentFieldName] = Pid;
}
else if (int.Parse(rowItem[ParentFieldName] + "") > 0)
{
rowItem[ParentFieldName] = int.Parse(rowItem[ParentFieldName] + "") + NodeId;
}
DataRow newRow = TreeTable.NewRow();
newRow.BeginEdit();
// 赋值明细字段
@@ -9171,9 +9302,9 @@ namespace Lskj.PubBill
}
}
(this.gcMain as TreeGridControlEx).TreeListObj.EndUpdate();
if (string.IsNullOrWhiteSpace(newRow[(this.gcMain as TreeGridControlEx).TreeListObj.KeyFieldName] + ""))
if (this.BillModel.NewNodeRules || string.IsNullOrWhiteSpace(newRow[(this.gcMain as TreeGridControlEx).TreeListObj.KeyFieldName] + ""))
{
newRow[(this.gcMain as TreeGridControlEx).TreeListObj.KeyFieldName] = (this.gcMain as TreeGridControlEx).GetNewNodesId();//节点id为空,就默认给当前数据源最大id+1
newRow[(this.gcMain as TreeGridControlEx).TreeListObj.KeyFieldName] = (this.gcMain as TreeGridControlEx).GetNewNodesId(Pid);//节点id为空,就默认生成节点id
}
if (!string.IsNullOrWhiteSpace(Pid))
@@ -9338,7 +9469,13 @@ namespace Lskj.PubBill
LogHelper.Instance.WriteError(ex);
}
}
// newRow[(this.gcMain as TreeGridControlEx).TreeListObj.KeyFieldName] = (this.gcMain as TreeGridControlEx).GetNewNodesId();//节点id
if (this.BillModel.NewNodeRules)
{
string keyFieldName = (this.gcMain as TreeGridControlEx).TreeListObj.KeyFieldName;
string parentFieldName = (this.gcMain as TreeGridControlEx).TreeListObj.ParentFieldName;
newRow[keyFieldName] = (this.gcMain as TreeGridControlEx).GetNewNodesId("0", gridTable);
newRow[parentFieldName] = "0";
}
newRow.EndEdit();
gridTable.Rows.Add(newRow);
@@ -10336,4 +10473,4 @@ namespace Lskj.PubBill
}
}
}