SVN r1173
SVN-Revision: r1173
This commit is contained in:
@@ -34,6 +34,7 @@ using DevExpress.Utils;
|
||||
using DevExpress.Data;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.IO;
|
||||
|
||||
namespace Lskj.PubAccraditation
|
||||
{
|
||||
@@ -170,6 +171,22 @@ namespace Lskj.PubAccraditation
|
||||
/// 模块对应的权限表信息
|
||||
/// </summary>
|
||||
public DataTable AuthorityTable;
|
||||
/// <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
|
||||
|
||||
/// <summary>
|
||||
@@ -1069,7 +1086,7 @@ namespace Lskj.PubAccraditation
|
||||
|
||||
this.SetBillControl(this.AuditModelObj.BillModifyFields, this.AuditModelObj.RequiredFields);
|
||||
this.InitPrint();
|
||||
|
||||
this.GetPrintOtherParam();
|
||||
//加载分配
|
||||
this.dbpFP.Click += new System.EventHandler(this.OnBtnFPOldClick);
|
||||
BarButtonItem itemFPBatch = new BarButtonItem();
|
||||
@@ -1590,7 +1607,7 @@ namespace Lskj.PubAccraditation
|
||||
if (!string.IsNullOrWhiteSpace(fileName))
|
||||
{
|
||||
BarButtonItem itemPrint = new BarButtonItem();
|
||||
itemPrint.Caption = fileName.Replace(".rmf", "");
|
||||
itemPrint.Caption = fileName.Replace(".rmf", "").Replace(".frx", "");
|
||||
itemPrint.Tag = files[i];
|
||||
itemPrint.ItemClick += new ItemClickEventHandler(itemPrint_ItemClick);
|
||||
pMprint.AddItem(itemPrint);
|
||||
@@ -1600,6 +1617,60 @@ namespace Lskj.PubAccraditation
|
||||
#endregion
|
||||
|
||||
#region 打印
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:打印完成需要参数</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2018-07-09 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
protected void GetPrintOtherParam()
|
||||
{
|
||||
Dictionary<object, Hashtable> dataCaches = SysModel != null ? SysModel.DataCaches : null;
|
||||
//取得打印完成后的参数
|
||||
if (!string.IsNullOrEmpty(this.BillModelObj.PrintSql) && this.BillModelObj.PrintSql.Contains("<<"))
|
||||
{
|
||||
string[] strs = this.BillModelObj.PrintSql.Split(new[] { ">>" }, 2, StringSplitOptions.None);
|
||||
_mainPrintSql = strs[1];
|
||||
_printModeCond = strs[0].Replace("<<", "");
|
||||
}
|
||||
if (!string.IsNullOrEmpty(_printModeCond) && _printModeCond.IndexOf(';') > 0)
|
||||
{
|
||||
string[] str = _printModeCond.Split(';');
|
||||
if (!dataCaches.GetValue(this, "PrintOtherSystemRow", out DataRow item))
|
||||
{
|
||||
item = AttachImpl.GetSystemModule(str[0]);
|
||||
}
|
||||
if (item == null) return;
|
||||
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>
|
||||
/// <para>说明:打印事件</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
@@ -1617,6 +1688,14 @@ namespace Lskj.PubAccraditation
|
||||
{
|
||||
string billNo = txt_billDocumentId.EditText;
|
||||
string printPath = PubUtil.PrintFileAbsolutelyPath;
|
||||
string printFile = e.Item.Tag + "";
|
||||
|
||||
if (!File.Exists(printPath))
|
||||
{
|
||||
MessageUtil.Show(ResourceKeys.NotFoundPrintFile);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(billNo))
|
||||
{
|
||||
DataRow masterRow = BillImpl.GetDataRowResult(ReplaceHelper.ReplaceParamToValue(this.BillModelObj.MasterSql, billNo));
|
||||
@@ -1634,7 +1713,36 @@ namespace Lskj.PubAccraditation
|
||||
string tmpSql = ReplaceHelper.ReplaceRowParam(masterRow, this.BillModelObj.PrintSql);
|
||||
string tmpSql1 = ReplaceHelper.ReplaceRowParam(masterRow, this.BillModelObj.PrintSql1);
|
||||
string tmpSql2 = ReplaceHelper.ReplaceRowParam(masterRow, this.BillModelObj.PrintSql2);
|
||||
DelphiHelper.LoadDelphiDll(printPath, printPath, e.Item.Tag + "", tmpSql, tmpSql1, this.BillModelObj.PrintFileType, tmpSql2);
|
||||
|
||||
|
||||
|
||||
if (printFile.Contains(PrintUtil.TemplateFlag))
|
||||
{
|
||||
//主Sql
|
||||
string mainSql = string.Empty;
|
||||
List<string> tmpSqls = new List<string>();
|
||||
if (_printSaveParams != null && _printSaveParams.Count > 0)
|
||||
{
|
||||
_printSaveParams[5] = mainSql = ReplaceHelper.ReplaceRowParam(masterRow, _mainPrintSql);
|
||||
_printSaveParams[3] = masterRow.Table.Columns.Contains(_printSaveParams[2] + "") ? masterRow[_printSaveParams[2]] + "" : masterRow[BillModelObj.PrimaryKey] + "";
|
||||
tmpSqls.Add(mainSql);
|
||||
tmpSqls.Add(tmpSql1);
|
||||
tmpSqls.AddRange(tmpSql2.Split(';').ToList());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(tmpSql)) tmpSqls.Add(tmpSql);
|
||||
if (!string.IsNullOrWhiteSpace(tmpSql1)) tmpSqls.Add(tmpSql1);
|
||||
if (!string.IsNullOrWhiteSpace(tmpSql2)) tmpSqls.AddRange(tmpSql2.Split(';').ToList());
|
||||
}
|
||||
PrintUtil.OnAfterPrint -= new EventHandler(OnReportPrintAfter);
|
||||
PrintUtil.OnAfterPrint += new EventHandler(OnReportPrintAfter);
|
||||
PrintUtil.FastReportPrint(tmpSqls, printFile, _isExcPrint);
|
||||
}
|
||||
else
|
||||
{
|
||||
DelphiHelper.LoadDelphiDll(printPath, printPath, printFile, tmpSql, tmpSql1, this.BillModelObj.PrintFileType, tmpSql2);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -1643,6 +1751,28 @@ namespace Lskj.PubAccraditation
|
||||
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>
|
||||
private void OnReportPrintAfter(object sender, EventArgs e)
|
||||
{
|
||||
//打印完成后添加数据库
|
||||
if (_printSaveParams != null && _printSaveParams.Count > 0)
|
||||
{
|
||||
int result = BaseModuleImpl.SavePrintRecord(_printSaveParams[0], _printSaveParams[1], _printSaveParams[2], _printSaveParams[3], _printSaveParams[4]);
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 绘制水印
|
||||
@@ -1689,7 +1819,7 @@ namespace Lskj.PubAccraditation
|
||||
{
|
||||
e.Graphics.DrawRectangle(pen, new Rectangle(-45, -19, 90, 32));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
e.Graphics.ResetTransform();
|
||||
if (!string.IsNullOrEmpty(this._waterMark.Print))
|
||||
@@ -1712,7 +1842,7 @@ namespace Lskj.PubAccraditation
|
||||
{
|
||||
e.Graphics.DrawRectangle(pen, new Rectangle(-60, -19, 120, 32));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
e.Graphics.ResetTransform();
|
||||
if (!string.IsNullOrEmpty(this._waterMark.Collect))
|
||||
@@ -1735,7 +1865,7 @@ namespace Lskj.PubAccraditation
|
||||
{
|
||||
e.Graphics.DrawRectangle(pen, new Rectangle(-45, -19, 90, 32));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -4367,30 +4497,4 @@ namespace Lskj.PubAccraditation
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public void SaveAdditionalModules()
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (XtraTabPage tabPage in this.tab_basicInfo.TabControlObj.TabPages)
|
||||
{
|
||||
GridDetailModel model = this.tab_basicInfo.GetGridDetailModel(tabPage);
|
||||
|
||||
Object moduleObject = tabPage.Controls.Cast<Object>().FirstOrDefault();
|
||||
if (moduleObject is ModuleGridEx)
|
||||
{
|
||||
ModuleGridEx moduleGridEx = moduleObject as ModuleGridEx;
|
||||
if (moduleGridEx.GridControlObj.IsDataNotSaved() && moduleGridEx.BtnSave.Visible && moduleGridEx.BtnSave.Enabled)
|
||||
{
|
||||
moduleGridEx.BtnSave.PerformClick();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show(Message, ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
{
|
||||
Reference in New Issue
Block a user