SVN-Revision: r689
This commit is contained in:
cyf
2025-06-08 09:40:43 +00:00
parent 80aba3227d
commit d2f527a7a1
2 changed files with 300 additions and 109 deletions
+210 -14
View File
@@ -421,6 +421,18 @@ namespace Lskj.Control
/// 作为明细时对应的标签名
/// </summary>
public string TagName;
/// <summary>
/// 上方提示框是否创建
/// </summary>
public bool CreatePromptBox = false;
/// <summary>
/// 上方提示框
/// </summary>
public LabelRemarkEdit PromptBox = null;
/// <summary>
/// 上方高度
/// </summary>
public int TopHeight = 0;
/// <summary>
/// 点击搜索时,判断当前表的明细是否有修改或新增状态的行
@@ -3272,6 +3284,40 @@ namespace Lskj.Control
}
}
}
/// <summary>
/// 传入模块号打印完成需要参数
/// </summary>
private void GetPrintOtherParam(string ModeCond)
{
//取得打印完成后的参数
if (!string.IsNullOrEmpty(ModeCond) )
{
DataRow item = AttachImpl.GetSystemModule(ModeCond);
string tableName = item["TableName"] + "";
string modetype = item["modType"] + "";
string comprefix = BaseImpl.GetColumnPrefix(tableName);
string primaryKey = modetype == "1" ? BaseImpl.GetBasePrimaryKey(ModeCond) : comprefix + "billdocument_id";
//表名,列前缀,主键字段,主键值,模块编号,主打印Sql
_printSaveParams = new List<string>() { tableName, comprefix, primaryKey, "", ModeCond, _mainPrintSql };
//判断是否直接打印 modetype 区别单据和基础档案模块
switch (modetype)
{
case "1":
ModuleModel mode = new ModuleModel(MainImpl.GetSystemdllTab(ModeCond));
if (mode != null) _isExcPrint = mode.PrintType == 3;
break;
case "2":
BaseAccraditationModel model = new BaseAccraditationModel(BillAuditImpl.GetPubAuditProperty(ModeCond));
if (model != null) _isExcPrint = model.BillPrintType == 3;
break;
}
}
}
#endregion
#region public method
@@ -3903,7 +3949,7 @@ namespace Lskj.Control
string printType = printRowItem["printType"] + "";
string sourceType = printRowItem["sourceType"] + "";
string printPath = PubUtil.PrintFileAbsolutelyPath70;
string modid= printRowItem["modid"] + "";
if (!File.Exists(printPath))
{
MessageUtil.Show(ResourceKeys.NotFoundPrintFile);
@@ -3912,23 +3958,89 @@ namespace Lskj.Control
try
{
if ("2".Equals(sourceType) || "3".Equals(sourceType))
if (printFile.Contains(PrintUtil.TemplateFlag))
{
//int[] rows = this.gcMain.GridView.GetSelectedRows();
//List<DataRow> rowList = new List<DataRow>();
//for (int i = 0; i < rows.Length; i++)
//{
// rowList.Add(this.gcMain.GridView.GetDataRow(rows[i]));
//}
DataRow[] dataRows = this.gcMain.GetViewFocusedDataRows();
printParams = dataRows != null && dataRows.Length > 0 ? dataRows.CopyToDataTable().ToJsonArray() : "";
this.GetPrintOtherParam(modid);
DataRow dataRow = gcMain.GetViewFocusedDataRow();
string ids = string.Empty;
string tmpSql = printRowItem["printSQL"] + "";
string tmpSql1 = printRowItem["printSQL1"] + "";
string tmpSql2 = printRowItem["printSQL2"] + "";
tmpSql = this.SearchObj.ReplaceParentControlValue(tmpSql);
tmpSql1 = this.SearchObj.ReplaceParentControlValue(tmpSql1);
tmpSql2 = this.SearchObj.ReplaceParentControlValue(tmpSql2);
//目前固定替换焦点行数据,数据来源类型(sourceType)和Delphi里的用法有冲突,先不考虑
tmpSql = ReplaceHelper.ReplaceRowParam(dataRow, tmpSql);
tmpSql1 = ReplaceHelper.ReplaceRowParam(dataRow, tmpSql1);
tmpSql2 = ReplaceHelper.ReplaceRowParam(dataRow, tmpSql2);
//替换左侧数据
if (this.LeftTreeViewEx != null || this.LeftGridEx != null)
{
string nodeKey = string.Empty;
if (this.LeftTreeViewEx != null)
{
nodeKey = this.LeftTreeViewEx.GetSelectNodeValue();
ids = LeftTreeViewEx.GetCheckValues();
}
if (this.LeftGridEx != null)
{
nodeKey = this.LeftGridEx.GetViewFocusedDataRow()[ParentKeyField] + "";
if (LeftGridEx is TreeGridControlEx) nodeKey = LeftGridEx.GetViewFocusedDataRow()[ParentKeyField] + "";
}
nodeKey = string.IsNullOrEmpty(ids) ? nodeKey : ids;
// select语句追加条件
tmpSql = ReplaceHelper.ReplaceTreeViewParentKeyCond(tmpSql, nodeKey);
tmpSql1 = ReplaceHelper.ReplaceTreeViewParentKeyCond(tmpSql1, nodeKey);
tmpSql2 = ReplaceHelper.ReplaceTreeViewParentKeyCond(tmpSql2, nodeKey);
}
//主Sql
string mainSql = string.Empty;
List<string> tmpSqls = new List<string>();
tmpSqls.Add(tmpSql);
tmpSqls.Add(tmpSql1);
tmpSqls.AddRange(tmpSql2.Split(';').ToList());
if (_printSaveParams != null && _printSaveParams.Count > 0)
{
_printSaveParams[5] = tmpSql+ tmpSql1+ tmpSql2;
_printSaveParams[3] = dataRow[_printSaveParams[2]] + "";
}
if (printFile.Contains(PrintUtil.TemplateFlag))
{
PrintUtil.OnAfterPrint -= new EventHandler(OnReportPrintAfter);
PrintUtil.OnAfterPrint += new EventHandler(OnReportPrintAfter);
PrintUtil.FastReportPrint(tmpSqls, printFile, _isExcPrint);
}
}
else
{
if ("2".Equals(sourceType) || "3".Equals(sourceType))
{
//int[] rows = this.gcMain.GridView.GetSelectedRows();
//List<DataRow> rowList = new List<DataRow>();
//for (int i = 0; i < rows.Length; i++)
//{
// rowList.Add(this.gcMain.GridView.GetDataRow(rows[i]));
//}
DataRow[] dataRows = this.gcMain.GetViewFocusedDataRows();
printParams = dataRows != null && dataRows.Length > 0 ? dataRows.CopyToDataTable().ToJsonArray() : "";
}
else
{
printParams = ReplaceHelper.ReplaceRowParam(this.gcMain.GetViewFocusedDataRow(), printParams);
printParams = ReplaceHelper.ReplaceRowParam(this.gcMain.GetViewFocusedDataRow(), printParams);
}
DelphiHelper.LoadDelphiDll(printPath, printPath, this.Model.ModuleCode, printName, printParams, Convert.ToInt32(printType), "");
}
DelphiHelper.LoadDelphiDll(printPath, printPath, this.Model.ModuleCode, printName, printParams, Convert.ToInt32(printType), "");
}
catch (Exception ex)
{
@@ -4249,7 +4361,7 @@ namespace Lskj.Control
{
LogUtil.WriteError("基础档案明细保存失败", ex);
}
IsApi: if (isExec)
IsApi: if (isExec)
{
this.SaveGridRecord();
if (OnSaveGridCallBack != null)
@@ -5228,4 +5340,88 @@ namespace Lskj.Control
public void SelectTheSpecifiedRow()
{
if (!string.IsNullOrWhiteSpace(this.TagName) && ParentGridEx != null && ParentGridEx.GridView.OptionsSelection.MultiSelect == true && GridControlObj.GridView.OptionsSelection.MultiSelect == true && this.P
if (!string.IsNullOrWhiteSpace(this.TagName) && ParentGridEx != null && ParentGridEx.GridView.OptionsSelection.MultiSelect == true && GridControlObj.GridView.OptionsSelection.MultiSelect == true && this.ParentControlEx.DetailSelection.ContainsKey(this.TagName))
{
DataRow rowItem = this.ParentGridEx.GridView.GetFocusedDataRow();
Dictionary<DataRow, string> dictionary = this.ParentControlEx.DetailSelection[this.TagName];
if (dictionary.ContainsKey(rowItem))
{
DataTable dataTable = GridControlObj.GridControl.DataSource as DataTable;
string value = dictionary[rowItem];
for (int rowHandle = 0; rowHandle < GridControlObj.GridView.RowCount; rowHandle++)
{
string cellValue = GridControlObj.GridView.GetRowCellValue(rowHandle, ParmaryKey) + "";
if (value.Split(',').Contains(cellValue))
{
GridControlObj.GridView.SelectRow(rowHandle); // 勾选
}
}
}
}
}
/// <summary>
/// 设置动态列提示信息
/// </summary>
/// <param name="ColumnName"></param>
public void SetDisplayColumns(string text,int ForceSize, string ForceColor)
{
if (!this.SysModel.SearchEnable)
{
//不能搜索,并且传入提示值
this.pl_top_fix_search.Visible = false;
this.TipsPanel.Visible = true;
//提示内容有值的情况下,隐藏右侧按钮
if (string.IsNullOrWhiteSpace(text))
{
this.pl_top_right.Visible = true;
}
else
{
this.pl_top_right.Visible = false;
}
if (!CreatePromptBox)
{
this.TopHeight = this.pl_top.Height;
//代码的方式创建,直接拖的控件会提示线程问题
this.TipsPanel.Controls.Clear();
this.PromptBox = new LabelRemarkEdit();
this.PromptBox.Dock = DockStyle.Fill;
this.PromptBox.Padding = new Padding(3, 5, 0, 0);
this.PromptBox.FontSize = ForceSize;
this.PromptBox.LabelText = "";
this.PromptBox.TextEdit.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
this.PromptBox.TextEdit.BackColor = Color.FromArgb(173, 216, 230);
this.TipsPanel.BackColor = Color.FromArgb(173, 216, 230);
if (!string.IsNullOrWhiteSpace(ForceColor))
{
this.PromptBox.TextEdit.ForeColor = ColorTranslator.FromHtml(ForceColor);
}
this.PromptBox.TextEdit.ReadOnly = true;
this.TipsPanel.Controls.Add(this.PromptBox);
CreatePromptBox = true;
}
PromptBox.EditText = text;
int textHeight = this.GetFirstThreeLinesHeight(PromptBox.TextEdit)+4;
if (textHeight > this.TopHeight)
{
this.pl_top.Height = textHeight;
}
else
{
this.pl_top.Height = this.TopHeight;
}
}
}
public int GetFirstThreeLinesHeight(MemoEdit memoEdit)
{
if (string.IsNullOrEmpty(memoEdit.Te