This commit is contained in:
@ -70,6 +70,9 @@
|
||||
<Reference Include="BouncyCastle.Crypto, Version=1.8.6.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Portable.BouncyCastle.1.8.6\lib\net40\BouncyCastle.Crypto.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="FastReport">
|
||||
<HintPath>..\DLL\FastReport.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ICSharpCode.SharpZipLib, Version=1.2.0.246, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SharpZipLib.1.2.0\lib\net45\ICSharpCode.SharpZipLib.dll</HintPath>
|
||||
</Reference>
|
||||
@ -112,6 +115,7 @@
|
||||
<Compile Include="EncryptHelper.cs" />
|
||||
<Compile Include="EnumHelper.cs" />
|
||||
<Compile Include="ExcelHelper.cs" />
|
||||
<Compile Include="FastReportHelper.cs" />
|
||||
<Compile Include="FileHelper.cs" />
|
||||
<Compile Include="HttpHelper.cs" />
|
||||
<Compile Include="JsonHelper.cs" />
|
||||
|
208
Common/FastReportHelper.cs
Normal file
208
Common/FastReportHelper.cs
Normal file
@ -0,0 +1,208 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using FastReport;
|
||||
using FastReport.Export.Pdf;
|
||||
namespace Epost.Common
|
||||
{
|
||||
public class FastReportHelper
|
||||
{
|
||||
#region 打印方法(winform)
|
||||
public static void Report_SKU(string filename, string batchid, string goodsname, string sku, string z_quantity, string quantity, string barcode, string z_unit, string unit, string block, string senddate, out Report reps/*,out MemoryStream strm1*/)
|
||||
{
|
||||
Report rep = null;
|
||||
try
|
||||
{
|
||||
if (block != "总分")
|
||||
{
|
||||
block = block + "通道";
|
||||
}
|
||||
rep = new Report();
|
||||
rep.Load(filename);//读取配置文件
|
||||
rep.SetParameterValue("batchid", batchid); // p1参数名
|
||||
rep.SetParameterValue("goodsname", goodsname); // p1参数名
|
||||
rep.SetParameterValue("sku", sku); // p1参数名
|
||||
rep.SetParameterValue("barcode", barcode); // p1参数名
|
||||
rep.SetParameterValue("z_quantity", z_quantity); // p1参数名
|
||||
rep.SetParameterValue("quantity", quantity); // p1参数名
|
||||
rep.SetParameterValue("z_unit", z_unit); // p1参数名
|
||||
rep.SetParameterValue("unit", unit); // p1参数名
|
||||
rep.SetParameterValue("block", block); // p1参数名
|
||||
rep.SetParameterValue("senddate", senddate); // p1参数名
|
||||
LogHelper.WriteLogInfo(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss开始打印\r\n"));
|
||||
rep.Prepare();
|
||||
rep.PrintSettings.ShowDialog = false;
|
||||
rep.Print();
|
||||
reps = rep;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
reps = null;
|
||||
LogHelper.WriteLogInfo(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ex.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region 打印方法(winform)
|
||||
public static void Report_Box(string filename, string boxno, string shopid, string shopname, string barcode, string orderid, string city, string orderway, string totalcount, string printstate, string senddate, string loc, out Report reps/*,out MemoryStream strm1*/)
|
||||
{
|
||||
Report rep = null;
|
||||
try
|
||||
{
|
||||
rep = new Report();
|
||||
rep.Load(filename);//读取配置文件
|
||||
rep.SetParameterValue("boxno", boxno); // p1参数名
|
||||
rep.SetParameterValue("shopid", shopid); // p1参数名
|
||||
rep.SetParameterValue("shopname", shopname); // p1参数名
|
||||
rep.SetParameterValue("barcode", barcode); // p1参数名
|
||||
rep.SetParameterValue("orderid", orderid); // p1参数名
|
||||
rep.SetParameterValue("city", city); // p1参数名
|
||||
rep.SetParameterValue("orderway", orderway); // p1参数名
|
||||
rep.SetParameterValue("totalcount", totalcount); // p1参数名
|
||||
rep.SetParameterValue("printstate", printstate); // p1参数名
|
||||
rep.SetParameterValue("senddate", senddate); // p1参数名
|
||||
rep.SetParameterValue("loc", loc); // p1参数名
|
||||
LogHelper.WriteLogInfo(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss开始打印\r\n"));
|
||||
rep.Prepare();
|
||||
rep.PrintSettings.ShowDialog = false;
|
||||
rep.Print();
|
||||
reps = rep;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
reps = null;
|
||||
LogHelper.WriteLogInfo(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ex.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region 打印方法(winform)
|
||||
public static void ReportSkuList(string filename, DataTable table, string boxcode, string boxno, string shopid, string shopname, string senddate, out Report reps/*,out MemoryStream strm1*/)
|
||||
{
|
||||
Report rep = null;
|
||||
try
|
||||
{
|
||||
rep = new Report();
|
||||
rep.Load(filename);//读取配置文件
|
||||
// DataTable table = new DataTable();//设置DataTable
|
||||
table.TableName = "RepList";//设置表名
|
||||
rep.SetParameterValue("boxcode", boxcode); // p1参数名
|
||||
rep.SetParameterValue("boxno", boxno); // p1参数名
|
||||
rep.SetParameterValue("shopid", shopid); // p1参数名
|
||||
rep.SetParameterValue("shopname", shopname); // p1参数名
|
||||
|
||||
rep.SetParameterValue("senddate", senddate); // p1参数名
|
||||
LogHelper.WriteLogInfo(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss开始打印\r\n"));
|
||||
rep.RegisterData(table, "RepList");
|
||||
rep.Prepare();
|
||||
rep.PrintSettings.ShowDialog = false;
|
||||
rep.Print();
|
||||
|
||||
reps = rep;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
reps = null;
|
||||
LogHelper.WriteLogInfo(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ex.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region 打印方法DN(winform)
|
||||
public static void ReportDNList(string filename, DataTable table, string orderwayname, string boxcount, string shopid, string shopname, string address, string city, string readtime, string senddate, string orderid, out Report reps/*,out MemoryStream strm1*/)
|
||||
{
|
||||
Report rep = null;
|
||||
try
|
||||
{
|
||||
rep = new Report();
|
||||
rep.Load(filename);//读取配置文件
|
||||
// DataTable table = new DataTable();//设置DataTable
|
||||
|
||||
rep.SetParameterValue("shopid", shopid); // p1参数名
|
||||
rep.SetParameterValue("shopname", shopname); // p1参数名
|
||||
rep.SetParameterValue("orderwayname", orderwayname); // p1参数名
|
||||
rep.SetParameterValue("boxcount", boxcount); // p1参数名
|
||||
rep.SetParameterValue("address", address); // p1参数名
|
||||
rep.SetParameterValue("lighttime", readtime); // p1参数名
|
||||
rep.SetParameterValue("city", city); // p1参数名
|
||||
rep.SetParameterValue("partcode", address); // p1参数名
|
||||
rep.SetParameterValue("orderid", orderid); // p1参数名
|
||||
var time = Convert.ToDateTime(senddate).ToString("yyyy/MM/dd");
|
||||
|
||||
|
||||
rep.SetParameterValue("senddate", time.Replace("-", "/")); // p1参数名
|
||||
table.TableName = "DNList";//设置表名
|
||||
LogHelper.WriteLogInfo(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss开始打印\r\n"));
|
||||
rep.RegisterData(table, "DNList");
|
||||
rep.Prepare();
|
||||
rep.PrintSettings.ShowDialog = false;
|
||||
rep.Print();
|
||||
reps = rep;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
reps = null;
|
||||
LogHelper.WriteLogInfo(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ex.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 打印方法DN(winform)
|
||||
public static void ReportDNList_PDF(string filename, DataTable table, string orderwayname, string boxcount, string shopid, string shopname, string address, string city, string readtime, string senddate, string orderid, out Report reps/*,out MemoryStream strm1*/)
|
||||
{
|
||||
Report rep = null;
|
||||
try
|
||||
{
|
||||
string PDF_File = ConfigurationManager.AppSettings["PDF_File"] + "\\" + DateTime.Now.ToString("yyyyMMdd");
|
||||
rep = new Report();
|
||||
rep.Load(filename);//读取配置文件
|
||||
// DataTable table = new DataTable();//设置DataTable
|
||||
|
||||
rep.SetParameterValue("shopid", shopid); // p1参数名
|
||||
rep.SetParameterValue("shopname", shopname); // p1参数名
|
||||
rep.SetParameterValue("orderwayname", orderwayname); // p1参数名
|
||||
rep.SetParameterValue("boxcount", boxcount); // p1参数名
|
||||
rep.SetParameterValue("address", address); // p1参数名
|
||||
rep.SetParameterValue("lighttime", readtime); // p1参数名
|
||||
rep.SetParameterValue("city", city); // p1参数名
|
||||
rep.SetParameterValue("partcode", address); // p1参数名
|
||||
rep.SetParameterValue("orderid", orderid); // p1参数名
|
||||
|
||||
rep.SetParameterValue("senddate", senddate); // p1参数名
|
||||
table.TableName = "DNList";//设置表名
|
||||
LogHelper.WriteLogInfo(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss开始打印\r\n"));
|
||||
rep.RegisterData(table, "DNList");
|
||||
rep.Prepare();
|
||||
//rep.PrintSettings.ShowDialog = false;
|
||||
//rep.Print();
|
||||
if (!Directory.Exists(PDF_File))
|
||||
{
|
||||
DirectoryInfo f = System.IO.Directory.CreateDirectory(PDF_File);
|
||||
|
||||
}
|
||||
PDFExport expPdf = new PDFExport();
|
||||
rep.Export(expPdf, PDF_File + "\\" + shopid + "_" + DateTime.Now.ToString("yyyyMMdd") + ".pdf");
|
||||
reps = rep;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
reps = null;
|
||||
LogHelper.WriteLogInfo(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ex.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user