|
|
@ -14,6 +14,7 @@ using DSWeb.MvcShipping.DAL.MsOpSeaeDAL;
|
|
|
|
using NPOI.OpenXmlFormats;
|
|
|
|
using NPOI.OpenXmlFormats;
|
|
|
|
using DSWeb.MvcShipping.Models.MsOpSeae;
|
|
|
|
using DSWeb.MvcShipping.Models.MsOpSeae;
|
|
|
|
using NPOI.SS.Formula.Functions;
|
|
|
|
using NPOI.SS.Formula.Functions;
|
|
|
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
|
|
|
|
|
|
|
namespace DSWeb.Areas.CommMng.DAL
|
|
|
|
namespace DSWeb.Areas.CommMng.DAL
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -31,7 +32,7 @@ namespace DSWeb.Areas.CommMng.DAL
|
|
|
|
public DBResult MakePdf_BillCheckOut(BillCheckOut_md head,string path)
|
|
|
|
public DBResult MakePdf_BillCheckOut(BillCheckOut_md head,string path)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var result = new DBResult();
|
|
|
|
var result = new DBResult();
|
|
|
|
|
|
|
|
var errorindex = 0.0;
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
@ -110,7 +111,7 @@ namespace DSWeb.Areas.CommMng.DAL
|
|
|
|
//内容文字字体 黑色11
|
|
|
|
//内容文字字体 黑色11
|
|
|
|
iTextSharp.text.Font infos = new iTextSharp.text.Font(bfComic, 11, 0, iTextSharp.text.BaseColor.BLACK);
|
|
|
|
iTextSharp.text.Font infos = new iTextSharp.text.Font(bfComic, 11, 0, iTextSharp.text.BaseColor.BLACK);
|
|
|
|
//抬头地址字体 黑色11 下划线
|
|
|
|
//抬头地址字体 黑色11 下划线
|
|
|
|
iTextSharp.text.Font address = new iTextSharp.text.Font(bfComic, 14, Font.UNDERLINE, iTextSharp.text.BaseColor.BLACK);
|
|
|
|
iTextSharp.text.Font address = new iTextSharp.text.Font(bfComic, 14, iTextSharp.text.Font.UNDERLINE, iTextSharp.text.BaseColor.BLACK);
|
|
|
|
|
|
|
|
|
|
|
|
//红色内容 红色11
|
|
|
|
//红色内容 红色11
|
|
|
|
iTextSharp.text.Font redinfos = new iTextSharp.text.Font(bfComic, 12, 0, iTextSharp.text.BaseColor.RED);
|
|
|
|
iTextSharp.text.Font redinfos = new iTextSharp.text.Font(bfComic, 12, 0, iTextSharp.text.BaseColor.RED);
|
|
|
@ -126,15 +127,27 @@ namespace DSWeb.Areas.CommMng.DAL
|
|
|
|
var 条码号 = head.CHECKOUTNO;
|
|
|
|
var 条码号 = head.CHECKOUTNO;
|
|
|
|
|
|
|
|
|
|
|
|
System.Drawing.Image _codeImage = _Code39.GetCodeImage(条码号, BarCodeDrawing.BarCodeDrawingModel.BarCodeDrawingNormal, true);
|
|
|
|
System.Drawing.Image _codeImage = _Code39.GetCodeImage(条码号, BarCodeDrawing.BarCodeDrawingModel.BarCodeDrawingNormal, true);
|
|
|
|
|
|
|
|
errorindex = 1;
|
|
|
|
System.IO.MemoryStream _Stream = new System.IO.MemoryStream();
|
|
|
|
System.IO.MemoryStream _Stream = new System.IO.MemoryStream();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
errorindex = 1.1;
|
|
|
|
|
|
|
|
ImageConverter imgconv = new ImageConverter();
|
|
|
|
_codeImage.Save(_Stream, System.Drawing.Imaging.ImageFormat.Jpeg);
|
|
|
|
_codeImage.Save(_Stream, System.Drawing.Imaging.ImageFormat.Jpeg);
|
|
|
|
string markPath = System.Environment.CurrentDirectory + $"\\temp{条码号}.jpg";
|
|
|
|
byte[] bytes = (byte[])imgconv.ConvertTo(_codeImage, typeof(byte[]));
|
|
|
|
_codeImage.Save(markPath);
|
|
|
|
Stream stream = new MemoryStream(bytes);
|
|
|
|
|
|
|
|
errorindex = 1.2;
|
|
|
|
|
|
|
|
//string markPath = System.Environment.CurrentDirectory + $"\\temp{条码号}.jpg";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//_codeImage.Save(markPath);
|
|
|
|
|
|
|
|
|
|
|
|
iTextSharp.text.Image im = iTextSharp.text.Image.GetInstance(markPath);
|
|
|
|
//_codeImage.Dispose();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
iTextSharp.text.Image im = iTextSharp.text.Image.GetInstance(stream);
|
|
|
|
|
|
|
|
errorindex = 1.3;
|
|
|
|
im.SetAbsolutePosition(width - 280, height - 60 - 80);
|
|
|
|
im.SetAbsolutePosition(width - 280, height - 60 - 80);
|
|
|
|
|
|
|
|
errorindex = 1.4;
|
|
|
|
im.ScaleAbsolute(260, 40);
|
|
|
|
im.ScaleAbsolute(260, 40);
|
|
|
|
|
|
|
|
errorindex = 1.5;
|
|
|
|
//document.Add(im);
|
|
|
|
//document.Add(im);
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
@ -168,7 +181,7 @@ namespace DSWeb.Areas.CommMng.DAL
|
|
|
|
地址.Leading = 22;
|
|
|
|
地址.Leading = 22;
|
|
|
|
document.Add(地址);
|
|
|
|
document.Add(地址);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
errorindex = 2;
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -221,6 +234,8 @@ namespace DSWeb.Areas.CommMng.DAL
|
|
|
|
billlist.Add(rec);
|
|
|
|
billlist.Add(rec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
errorindex = 3;
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var item in body)
|
|
|
|
foreach (var item in body)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var MBLNO = new iTextSharp.text.Paragraph(item.MBLNO, infos);
|
|
|
|
var MBLNO = new iTextSharp.text.Paragraph(item.MBLNO, infos);
|
|
|
@ -263,6 +278,8 @@ namespace DSWeb.Areas.CommMng.DAL
|
|
|
|
//document.Add(newinfo);
|
|
|
|
//document.Add(newinfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
errorindex = 4;
|
|
|
|
|
|
|
|
|
|
|
|
document.Add(table);
|
|
|
|
document.Add(table);
|
|
|
|
|
|
|
|
|
|
|
|
//感谢
|
|
|
|
//感谢
|
|
|
@ -287,7 +304,7 @@ namespace DSWeb.Areas.CommMng.DAL
|
|
|
|
|
|
|
|
|
|
|
|
document.Close();
|
|
|
|
document.Close();
|
|
|
|
|
|
|
|
|
|
|
|
File.Delete(markPath);
|
|
|
|
//File.Delete(markPath);
|
|
|
|
|
|
|
|
|
|
|
|
head.MAILPDFURL = SaveUrlName;
|
|
|
|
head.MAILPDFURL = SaveUrlName;
|
|
|
|
|
|
|
|
|
|
|
@ -295,10 +312,19 @@ namespace DSWeb.Areas.CommMng.DAL
|
|
|
|
|
|
|
|
|
|
|
|
cdc.SaveChanges();
|
|
|
|
cdc.SaveChanges();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
errorindex = 5;
|
|
|
|
|
|
|
|
|
|
|
|
result.OK(filename);
|
|
|
|
result.OK(filename);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
catch (Exception ex) {
|
|
|
|
catch (Exception ex) {
|
|
|
|
result.SetErrorInfo(ex.Message);
|
|
|
|
var innermsg = "";
|
|
|
|
|
|
|
|
if (ex.InnerException != null) {
|
|
|
|
|
|
|
|
if (ex.InnerException.Message != null) {
|
|
|
|
|
|
|
|
innermsg = ex.InnerException.Message;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
result.SetErrorInfo($"PDFHelper{errorindex}:"+ex.Message+$"[{innermsg}]");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|