SVN r1174
SVN-Revision: r1174
This commit is contained in:
@@ -33,6 +33,7 @@ using System.Text.RegularExpressions;
|
|||||||
using Lskj.Core;
|
using Lskj.Core;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
namespace Lskj.BaseAccraditation
|
namespace Lskj.BaseAccraditation
|
||||||
{
|
{
|
||||||
@@ -146,7 +147,22 @@ namespace Lskj.BaseAccraditation
|
|||||||
/// 是否有明细必填
|
/// 是否有明细必填
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool DetailsRequired = false;
|
public bool DetailsRequired = false;
|
||||||
|
/// <summary>
|
||||||
|
/// 打印完成后添加数据用到的参数: 表名,列前缀,主键字段,主键值,模块编号,主打印Sql
|
||||||
|
/// </summary>
|
||||||
|
private List<string> _printSaveParams;
|
||||||
|
/// <summary>
|
||||||
|
/// 主打印Sql
|
||||||
|
/// </summary>
|
||||||
|
private string _mainPrintSql;
|
||||||
|
/// <summary>
|
||||||
|
/// 打印主sql中关联打印次数返回条件
|
||||||
|
/// </summary>
|
||||||
|
private string _printModeCond;
|
||||||
|
/// <summary>
|
||||||
|
/// 是否直接打印
|
||||||
|
/// </summary>
|
||||||
|
private bool _isExcPrint;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -246,7 +262,7 @@ namespace Lskj.BaseAccraditation
|
|||||||
this.InitializeControl();
|
this.InitializeControl();
|
||||||
this.InitSpliterPosition();
|
this.InitSpliterPosition();
|
||||||
this.InitPrint();
|
this.InitPrint();
|
||||||
|
this.GetPrintOtherParam();
|
||||||
if (this.ModuleModelObj.DisplayScroll)
|
if (this.ModuleModelObj.DisplayScroll)
|
||||||
{
|
{
|
||||||
this.pl_main.AutoScroll = true;
|
this.pl_main.AutoScroll = true;
|
||||||
@@ -547,7 +563,7 @@ namespace Lskj.BaseAccraditation
|
|||||||
if (!string.IsNullOrWhiteSpace(fileName))
|
if (!string.IsNullOrWhiteSpace(fileName))
|
||||||
{
|
{
|
||||||
BarButtonItem itemPrint = new BarButtonItem();
|
BarButtonItem itemPrint = new BarButtonItem();
|
||||||
itemPrint.Caption = fileName.Replace(".rmf", "");
|
itemPrint.Caption = fileName.Replace(".rmf", "").Replace(".frx", "");
|
||||||
itemPrint.Tag = files[i];
|
itemPrint.Tag = files[i];
|
||||||
itemPrint.ItemClick += new ItemClickEventHandler(itemPrint_ItemClick);
|
itemPrint.ItemClick += new ItemClickEventHandler(itemPrint_ItemClick);
|
||||||
pMprint.AddItem(itemPrint);
|
pMprint.AddItem(itemPrint);
|
||||||
@@ -1644,6 +1660,56 @@ namespace Lskj.BaseAccraditation
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region 打印
|
#region 打印
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>说明:打印完成需要参数</para>
|
||||||
|
/// <para>创建人:龚宇超</para>
|
||||||
|
/// <para>创建日期:2018-07-09 </para>
|
||||||
|
/// <para>修改人:</para>
|
||||||
|
/// <para>修改日期:</para>
|
||||||
|
/// <para>修改备注:</para>
|
||||||
|
/// <para>版本:1.0</para>
|
||||||
|
/// </summary>
|
||||||
|
private void GetPrintOtherParam()
|
||||||
|
{
|
||||||
|
//取得打印完成后的参数
|
||||||
|
if (this.ModuleModelObj.PrintSql.Contains("<<"))
|
||||||
|
{
|
||||||
|
string[] strs = this.ModuleModelObj.PrintSql.Split(new[] { ">>" }, 2, StringSplitOptions.None);
|
||||||
|
_mainPrintSql = strs[1];
|
||||||
|
_printModeCond = strs[0].Replace("<<", "");
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrEmpty(_printModeCond) && _printModeCond.IndexOf(';') > 0)
|
||||||
|
{
|
||||||
|
string[] str = _printModeCond.Split(';');
|
||||||
|
DataRow item = AttachImpl.GetSystemModule(str[0]);
|
||||||
|
string tableName = item["TableName"] + "";
|
||||||
|
string modetype = item["modType"] + "";
|
||||||
|
string comprefix = BaseImpl.GetColumnPrefix(tableName);
|
||||||
|
string primaryKey = modetype == "1" ? BaseImpl.GetBasePrimaryKey(str[0]) : comprefix + "billdocument_id";
|
||||||
|
//表名,列前缀,主键字段,主键值,模块编号,主打印Sql
|
||||||
|
_printSaveParams = new List<string>() { tableName, comprefix, primaryKey, str[1], str[0], _mainPrintSql };
|
||||||
|
|
||||||
|
//判断是否直接打印 modetype 区别单据和基础档案模块
|
||||||
|
switch (modetype)
|
||||||
|
{
|
||||||
|
case "1":
|
||||||
|
ModuleModel mode = new ModuleModel(MainImpl.GetSystemdllTab(str[0]));
|
||||||
|
if (mode != null) _isExcPrint = mode.PrintType == 3;
|
||||||
|
break;
|
||||||
|
case "2":
|
||||||
|
BaseAccraditationModel model = new BaseAccraditationModel(BillAuditImpl.GetPubAuditProperty(str[0]));
|
||||||
|
if (model != null) _isExcPrint = model.BillPrintType == 3;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <para>说明:打印事件</para>
|
/// <para>说明:打印事件</para>
|
||||||
/// <para>创建人:龚宇超</para>
|
/// <para>创建人:龚宇超</para>
|
||||||
@@ -1659,8 +1725,14 @@ namespace Lskj.BaseAccraditation
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
string printFile = e.Item.Tag + "";
|
||||||
this._flowRowData = BaseAuditImpl.GetCurrentFlowRowData(this.ModuleModelObj.MenuTable, this.ModuleModelObj.ParmaryKey, this.SysModel.PrimaryValue);
|
this._flowRowData = BaseAuditImpl.GetCurrentFlowRowData(this.ModuleModelObj.MenuTable, this.ModuleModelObj.ParmaryKey, this.SysModel.PrimaryValue);
|
||||||
string printPath = PubUtil.PrintFileAbsolutelyPath;
|
string printPath = PubUtil.PrintFileAbsolutelyPath;
|
||||||
|
if (!File.Exists(printPath))
|
||||||
|
{
|
||||||
|
MessageUtil.Show(ResourceKeys.NotFoundPrintFile);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (_flowRowData == null)
|
if (_flowRowData == null)
|
||||||
{
|
{
|
||||||
MessageUtil.Show(ResourceKeys.DataNotFount);
|
MessageUtil.Show(ResourceKeys.DataNotFount);
|
||||||
@@ -1675,8 +1747,63 @@ namespace Lskj.BaseAccraditation
|
|||||||
string tmpSql = ReplaceHelper.ReplaceRowParam(_flowRowData, this.ModuleModelObj.PrintSql);
|
string tmpSql = ReplaceHelper.ReplaceRowParam(_flowRowData, this.ModuleModelObj.PrintSql);
|
||||||
string tmpSql1 = ReplaceHelper.ReplaceRowParam(_flowRowData, this.ModuleModelObj.PrintSql1);
|
string tmpSql1 = ReplaceHelper.ReplaceRowParam(_flowRowData, this.ModuleModelObj.PrintSql1);
|
||||||
string tmpSql2 = ReplaceHelper.ReplaceRowParam(_flowRowData, this.ModuleModelObj.PrintSql2);
|
string tmpSql2 = ReplaceHelper.ReplaceRowParam(_flowRowData, this.ModuleModelObj.PrintSql2);
|
||||||
DelphiHelper.LoadDelphiDll(printPath, printPath, e.Item.Tag + "", tmpSql, tmpSql1, this.ModuleModelObj.PrintType, tmpSql2);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//主Sql
|
||||||
|
string mainSql = string.Empty;
|
||||||
|
List<string> tmpSqls = new List<string>();
|
||||||
|
if (_printSaveParams != null && _printSaveParams.Count > 0)
|
||||||
|
{
|
||||||
|
_printSaveParams[5] = mainSql = ReplaceHelper.ReplaceRowParam(_flowRowData, _mainPrintSql);
|
||||||
|
_printSaveParams[3] = _flowRowData[_printSaveParams[2]] + "";
|
||||||
|
tmpSqls.Add(mainSql);
|
||||||
|
tmpSqls.Add(tmpSql1);
|
||||||
|
tmpSqls.AddRange(tmpSql2.Split(';').ToList());
|
||||||
|
}
|
||||||
|
if (printFile.Contains(PrintUtil.TemplateFlag))
|
||||||
|
{
|
||||||
|
PrintUtil.OnAfterPrint -= new EventHandler(OnReportPrintAfter);
|
||||||
|
PrintUtil.OnAfterPrint += new EventHandler(OnReportPrintAfter);
|
||||||
|
PrintUtil.FastReportPrint(tmpSqls, printFile, _isExcPrint);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DelphiHelper.LoadDelphiDll(printPath, printPath, printFile, tmpSql, tmpSql1, this.ModuleModelObj.PrintType, tmpSql2);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||||
|
MessageUtil.Show(Message, ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>说明:打印完成后回调</para>
|
||||||
|
/// <para>创建人:龚宇超</para>
|
||||||
|
/// <para>创建日期:2018-07-05 </para>
|
||||||
|
/// <para>修改人:</para>
|
||||||
|
/// <para>修改日期:</para>
|
||||||
|
/// <para>修改备注:</para>
|
||||||
|
/// <para>版本:1.0</para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender">The sender.</param>
|
||||||
|
/// <param name="e">The e.</param>
|
||||||
|
protected void OnReportPrintAfter(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_printSaveParams != null && _printSaveParams.Count > 0)
|
||||||
|
{
|
||||||
|
//打印完成后添加数据库
|
||||||
|
int result = BaseModuleImpl.SavePrintRecord(_printSaveParams[0], _printSaveParams[1], _printSaveParams[2], _printSaveParams[3], _printSaveParams[4]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user