SVN r1214

SVN-Revision: r1214
This commit is contained in:
cyf
2026-06-18 06:01:39 +00:00
parent 35107222be
commit 19ae29f016
2 changed files with 217 additions and 80 deletions
+189 -55
View File
@@ -89,10 +89,7 @@ namespace Lskj.PubBill
/// </summary>
private DataTable _detailColumns;
private bool IsCopying = false;
/// <summary>
/// 单据来源明细拖拽删除当前行数据集合
/// </summary>
private List<DataRow> RemoveRowitem = new List<DataRow>();
protected DataRow BillRowItem;
/// <summary>
@@ -244,6 +241,16 @@ namespace Lskj.PubBill
/// 当前操作的ImageEdit
/// </summary>
private LabelImageEdit _imageEdit;
/// <summary>
/// 当前来源明细中变色行
/// </summary>
private HashSet<int> ColorHandles = new HashSet<int>();
/// <summary>
/// 保存验证条件表
/// </summary>
public DataTable SaveCondTab = new DataTable();
public BillModule()
{
@@ -493,6 +500,11 @@ namespace Lskj.PubBill
{
return BaseModuleImpl.GetBaseGridRightMenus("BILLDETAIL_" + dynamicModel.ModuleCode);//设置表格右键菜单
}));
Task<DataTable> saveCondTabTask = cachesDic.AddTask(this, "SaveCondTab", new Task<DataTable>(() =>
{
return BaseModuleImpl.GetClientCond(dynamicModel.ModuleCode);
}));
#endregion
if (billModel.PanelWidth > 0)
{
@@ -1206,6 +1218,11 @@ namespace Lskj.PubBill
this.gcMain.GridView.ShowingEditor += new CancelEventHandler(OnGridViewShowingEditor);
}
if (!dataCaches.GetValue(this, "SaveCondTab", out this.SaveCondTab))
{
this.SaveCondTab = BaseModuleImpl.GetClientCond(this.SysModel.ModuleCode);
}
if (this.BillModel.DefaultAddEmptyRow)
{
@@ -1251,6 +1268,18 @@ namespace Lskj.PubBill
{
string unioright = sender + "";
DataRow rightrowitem = this.gcMain.gridViewRightMenu.MenuTable.Rows.Cast<DataRow>().FirstOrDefault(x => (x["orderid"] + "").Equals(unioright));
GridRightMenuModel model = new GridRightMenuModel(rightrowitem);
DataRow rowItem = this.gcMain.GetViewFocusedDataRow();
if (!string.IsNullOrWhiteSpace(model.MenuCond))
{
//判断条件
DataRow row = this.gcMain.GridView.GetFocusedDataRow();
string cond = ReplaceHelper.ReplaceRowParam(row, model.MenuCond);
bool condResult = ValidateCond(cond, null);
if (!condResult) return;
}
CommonMenu menu = new CommonMenu(this.SysModel, ControlObj, this.gcMain);
menu.Apply(rightrowitem);
}
@@ -1783,6 +1812,9 @@ namespace Lskj.PubBill
DataTable masterTable = htTable["master"] as DataTable;
DataTable detailTable = htTable["detail"] as DataTable;
/*
* 1. ,()+,.
* 2. ,.
@@ -1825,6 +1857,25 @@ 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;
@@ -2173,6 +2224,7 @@ namespace Lskj.PubBill
{
GridDragGrid dragDetailGrid = new GridDragGrid(gridDetail.GridView, this.gcMain.GridView);
dragDetailGrid.OnDragComplete += new GridFragGridCompleteEventHandler(OnDragDetailGridCompleted);
if (this.BillModel.IsSelectSourceColor) gridDetail.GridView.CustomDrawCell += GridView_CustomDrawCell;
}
}
@@ -2274,8 +2326,6 @@ namespace Lskj.PubBill
/// <summary>
/// 单据来源拖拽到主表明细中(树表格拖拽到树表格)
/// </summary>
@@ -3537,7 +3587,6 @@ namespace Lskj.PubBill
if (model.GridControlObj != null) this.RefreshSource(model);
if (BillModel.drgFinishHide == "1")
{
RemoveRowitem.Clear();
if (model.ModelObj.SourceType == 1)
{
string sqlValue = ReplaceHelper.ReplaceUserInfo(ReplaceHelper.ReplaceWhereCond(model.ModelObj.DetailSql));
@@ -3723,14 +3772,7 @@ namespace Lskj.PubBill
{
WaitForm.ShowForm();
unionModel.GridDetailControlObj.GridControl.DataSource = BillImpl.GetDataTableResult(sqlValue);
if (BillModel.drgFinishHide == "1")
{
//DataTable finishHideTb = unionModel.GridDetailControlObj.GridControl.DataSourceTable();
//foreach (DataRow drItem in RemoveRowitem)
//{
// if (finishHideTb.Select().Contains(drItem)) finishHideTb.Rows.Remove(drItem);
//}
}
this.ClearHighlightRows(unionModel.GridDetailControlObj.GridView);
}
catch (Exception ex)
{
@@ -3774,6 +3816,8 @@ namespace Lskj.PubBill
}
else
{
//有复选框的页签在刷新前清空选中行,否则合计在刷新数据源后不会自带改变
if (unionModel.GridDetailControlObj.GridView.OptionsSelection.MultiSelectMode == GridMultiSelectMode.CheckBoxRowSelect && unionModel.GridDetailControlObj.GridView.OptionsSelection.MultiSelect == true)
{
@@ -3783,6 +3827,7 @@ namespace Lskj.PubBill
unionModel.GridDetailControlObj.GridControl.DataSource = rowItem == null
? new DataTable() : BillImpl.GetDataTableResult(DetailSql);
this.ClearHighlightRows(unionModel.GridDetailControlObj.GridView);
}
@@ -4629,15 +4674,11 @@ namespace Lskj.PubBill
if (unionModel.GridDetailControlObj.GridControl.DataSourceTable().Rows.IndexOf(rowItem) >= 0)
{
unionModel.GridDetailControlObj.GridControl.DataSourceTable().Rows.Remove(rowItem);
//RemoveRowitem.Add(rowItem);
}
if (unionModel.GridDetailDetailControlObj != null && unionModel.GridDetailDetailControlObj.GridControl.DataSourceTable().Rows.IndexOf(rowItem) >= 0)
{
unionModel.GridDetailDetailControlObj.GridControl.DataSourceTable().Rows.Remove(rowItem);
//RemoveRowitem.Add(rowItem);
}
}
if (BillModel.DrgDetailAndSource && unionModel.GridControlObj != null)//移动明细主表数据到主表
{
@@ -5413,7 +5454,7 @@ namespace Lskj.PubBill
MessageUtil.Show("表格中数据内容重复,保存失败!");
return saveResult;
}
//if(!VerificationCond()) return saveResult;
WaitForm.ShowForm(ResourceKeys.DataSaving);
string billNo = this.lblOrderNo.Text.Trim();
@@ -5786,6 +5827,8 @@ namespace Lskj.PubBill
WaitForm.ShowForm();
try
{
string sqlValue = ReplaceHelper.ReplaceUserInfo(ReplaceHelper.ReplaceWhereCond(unionModel.ModelObj.DetailSql));
sqlValue = sqlValue.Replace("#", "");
sqlValue = this.ControlObj.ReplaceControlValue(sqlValue);
@@ -5799,16 +5842,9 @@ namespace Lskj.PubBill
else
{
unionModel.GridDetailControlObj.GridControl.DataSource = BillImpl.GetDataTableResult(sqlValue);
this.ClearHighlightRows(unionModel.GridDetailControlObj.GridView);
}
if (BillModel.drgFinishHide == "1" && unionModel.GridDetailControlObj != null)
{
DataTable finishHideTb = unionModel.GridDetailControlObj.GridControl.DataSourceTable();
//foreach (DataRow drItem in RemoveRowitem)
//{
// if (finishHideTb.Select().Contains(drItem)) finishHideTb.Rows.Remove(drItem);
//}
}
}
catch (Exception ex)
{
@@ -6643,21 +6679,24 @@ namespace Lskj.PubBill
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void OnGridDetailDoubleClick(object sender, EventArgs e)
{
DataTable table = this.gcMain.GridControl.DataSource as DataTable;
XtraTabPage tabPage = this.xtc_left_container.SelectedTabPage;
BillSourceUnionModel unionModel = tabPage.Tag as BillSourceUnionModel;
DataRow rowItem = unionModel.GridDetailControlObj.GridView.GetFocusedDataRow();
if (rowItem == null) return;
if (BillModel.IsSelectSourceColor && unionModel.GridDetailControlObj != null)
{
//选中行改变颜色
ColorHandles.Add(unionModel.GridDetailControlObj.GridView.GetFocusedDataSourceRowIndex());
unionModel.GridDetailControlObj.GridView.Invalidate();
}
//添加行到主表明细中
if (this.BillModel.DetailTreeTable)
{
if (this.CanAddTreeDetailRow())
{
DataTable table = this.gcMain.GridControl.DataSource as DataTable;
XtraTabPage tabPage = this.xtc_left_container.SelectedTabPage;
BillSourceUnionModel unionModel = tabPage.Tag as BillSourceUnionModel;
DataRow rowItem = unionModel.GridDetailControlObj.GridView.GetFocusedDataRow();
string Pid = "0";//默认给空值,添加到最后(不添加到选中行的下层)
//DataRow dataRow = (this.gcMain as TreeGridControlEx).GetViewFocusedDataRow();
//if (dataRow != null)
//{
// Pid = dataRow[(this.gcMain as TreeGridControlEx).TreeListObj.KeyFieldName] + "";
//}
if (rowItem == null) return;
//添加行
this.AddMultiRowTreeGridControl(new DataRow[] { rowItem }, Pid);
if (!string.IsNullOrWhiteSpace(unionModel.AddDataSql) && !string.IsNullOrWhiteSpace(unionModel.AddDataCondition) && this.ValidateCond(unionModel.AddDataCondition, rowItem))
@@ -6666,28 +6705,19 @@ namespace Lskj.PubBill
DataTable dataTable = MainImpl.GetDataTableResult(addSql);
DragAddTable(dataTable, (int.Parse((this.gcMain as TreeGridControlEx).GetNewNodesId()) - 1) + "");////上方的新增行的id默认是最大的
}
}
}
else
{
if (this.CanAddDetailRow())
{
DataTable table = this.gcMain.GridControl.DataSource as DataTable;
XtraTabPage tabPage = this.xtc_left_container.SelectedTabPage;
BillSourceUnionModel unionModel = tabPage.Tag as BillSourceUnionModel;
DataRow rowItem = unionModel.GridDetailControlObj.GridView.GetFocusedDataRow();
if (rowItem != null)
if (!this.BillModel.IsFastDragAddDetail)
{
if (!this.BillModel.IsFastDragAddDetail)
{
this.AddMultiRowToGridView(new DataRow[] { rowItem });
}
else
{
this.AddRowsToGridViewFast(new DataRow[] { rowItem });
}
this.AddMultiRowToGridView(new DataRow[] { rowItem });
}
else
{
this.AddRowsToGridViewFast(new DataRow[] { rowItem });
}
}
}
@@ -7007,6 +7037,16 @@ namespace Lskj.PubBill
DataRow row = e.SourceGridViewObj.GetDataRow(handle);
dragRows.Add(row);
}
if (BillModel.IsSelectSourceColor)
{
//选中行改变颜色
foreach (int h in rowHandles)
{
ColorHandles.Add(h);
}
e.SourceGridViewObj.Invalidate();
}
if (dragRows != null && dragRows.Count > 0)
{
if (!this.BillModel.IsFastDragAddDetail)
@@ -7167,7 +7207,7 @@ namespace Lskj.PubBill
this.OnBillSaveClick(null, null);
}
if (this.BillModel.SourceMainPushPullHide && DragRows.Count > 0)
if (this.BillModel.SourceMainPushPullHide && DragRows.Count > 0)
{
foreach (DataRow item in DragRows)
{
@@ -8504,6 +8544,18 @@ namespace Lskj.PubBill
XtraTabPage tabPage = this.xtc_left_container.SelectedTabPage;
BillSourceUnionModel unionModel = tabPage.Tag as BillSourceUnionModel;
int oldRowHandle = this.gcMain.GridView.FocusedRowHandle;
//改变选中行颜色
int[] rowHandles = e.GridViewObj.GetSelectedRows();
if (BillModel.IsSelectSourceColor)
{
//选中行改变颜色
foreach (int h in rowHandles)
{
ColorHandles.Add(h);
}
e.GridViewObj.Invalidate();
}
//拖拽行
foreach (DataRow rowItem in e.GridViewSelectRows)
{
//添加拖拽行
@@ -9871,4 +9923,86 @@ namespace Lskj.PubBill
/// </summary>
/// <param name="dataRow"></param>
public bool SetPrintButton(DataRow rowItem)
{
try
{
bool result = false;
//判断打印按钮条件
if (!string.IsNullOrWhiteSpace(this.BillModel.PrintingConditions))
{
if (rowItem == null) return result;
string cond = ReplaceHelper.ReplaceRowParam(rowItem, this.BillModel.PrintingConditions);
if (cond.StartsWith("@") || cond.StartsWith("!"))
{
result = "1".Equals(BaseImpl.GetDefaultValue(cond));
}
else
{
result = ReplaceHelper.ReplaceRowParamCond(rowItem, cond);
}
return result;
}
else
{
return true;
}
}
catch (Exception ex)
{
return false;
}
}
/// <summary>
/// 改变选中行的颜色
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void GridView_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
{
XtraTabPage tabPage = this.xtc_left_container.SelectedTabPage;
BillSourceUnionModel unionModel = tabPage.Tag as BillSourceUnionModel;
if (unionModel != null && unionModel.GridDetailControlObj.GridView != null)
{
int sourceIdx = unionModel.GridDetailControlObj.GridView.GetDataSourceRowIndex(e.RowHandle);
if (ColorHandles.Contains(sourceIdx))
e.Appearance.BackColor = ColorTranslator.FromHtml(this.BillModel.SelectSourceColor);
}
}
/// <summary>
/// 清空记录的选中行
/// </summary>
/// <param name="gridview"></param>
public void ClearHighlightRows(GridView gridview)
{
if (this.BillModel.IsSelectSourceColor && ColorHandles.Count > 0)
{
ColorHandles.Clear();
gridview.Invalidate();
}
}
public bool VerificationCond()
{
DataTable detailTable = this.gcMain.GridControl.DataSourceTable().TrimDeleteRows();
foreach (DataRow CondItem in SaveCondTab.Rows)
{
string condition = CondItem["condition"] + "";
if (!string.IsNullOrWhiteSpace(condition))
{
if (detailTable != null && detailTable.Rows.Count > 0)
{
condition = this.ControlObj.ReplaceParentControlValue(condition);
foreach (DataRow item in detailTable.Rows)
{
if (!ValidateCond(condition, item))
{
MessageUtil.Show(string.IsNullOrWhiteSpace(CondItem["hintmsg"] + "") ? "条件验证失败" : CondItem["hintmsg"] + "");
r