|
|
|
@ -9,6 +9,11 @@ using iTextSharp.text.pdf;
|
|
|
|
|
using DSWeb.Common.DB;
|
|
|
|
|
using System.Data.Entity.Migrations;
|
|
|
|
|
using HcUtility.Comm;
|
|
|
|
|
using DSWeb.MvcShipping.DAL.MsInfoClient;
|
|
|
|
|
using DSWeb.MvcShipping.DAL.MsOpSeaeDAL;
|
|
|
|
|
using NPOI.OpenXmlFormats;
|
|
|
|
|
using DSWeb.MvcShipping.Models.MsOpSeae;
|
|
|
|
|
using NPOI.SS.Formula.Functions;
|
|
|
|
|
|
|
|
|
|
namespace DSWeb.Areas.CommMng.DAL
|
|
|
|
|
{
|
|
|
|
@ -78,17 +83,37 @@ namespace DSWeb.Areas.CommMng.DAL
|
|
|
|
|
//幼圆
|
|
|
|
|
//BaseFont bfComic = BaseFont.CreateFont("c://windows//fonts//SIMYOU.TTF", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
|
|
|
|
|
|
|
|
|
|
var companyinfo = cdc.company.FirstOrDefault(x => x.GID == head.CORPID);
|
|
|
|
|
|
|
|
|
|
iTextSharp.text.Font title = new iTextSharp.text.Font(bfComic, 24, iTextSharp.text.Font.BOLD, iTextSharp.text.BaseColor.BLACK);
|
|
|
|
|
var stlinfo = MsInfoClientDAL.GetSTLNAME(head.CUSTOMERNAME, "海运出口", DateTime.Now.ToString("yyyy-MM-dd"), "");
|
|
|
|
|
|
|
|
|
|
var BodyList = cdc.BillCheckOut_Detail.Where(x => x.LINKGID == head.GID).ToList();
|
|
|
|
|
var firstbsno = BodyList[0].BSNO;
|
|
|
|
|
var firstopseae = cdc.v_op_bs.FirstOrDefault(x => x.BSNO == firstbsno);
|
|
|
|
|
var 操作 = firstopseae.OP;
|
|
|
|
|
var 操作user = cdc.VW_user.FirstOrDefault(x => x.SHOWNAME == 操作 );
|
|
|
|
|
var 操作baseinfo = BasicDataRefDAL.GetUserLinkRefList($" u.showname='{操作}'", firstopseae.SALECORPID);
|
|
|
|
|
|
|
|
|
|
//标题字体 黑色26
|
|
|
|
|
iTextSharp.text.Font title = new iTextSharp.text.Font(bfComic, 26, iTextSharp.text.Font.BOLD, iTextSharp.text.BaseColor.BLACK);
|
|
|
|
|
|
|
|
|
|
//公司名称 黑色加粗22
|
|
|
|
|
iTextSharp.text.Font companyname = new iTextSharp.text.Font(bfComic, 20, iTextSharp.text.Font.BOLD, iTextSharp.text.BaseColor.BLACK);
|
|
|
|
|
|
|
|
|
|
//表格抬头字体 黑色加粗12
|
|
|
|
|
iTextSharp.text.Font heads = new iTextSharp.text.Font(bfComic, 12, iTextSharp.text.Font.BOLD, iTextSharp.text.BaseColor.BLACK);
|
|
|
|
|
|
|
|
|
|
//内容文字字体 黑色11
|
|
|
|
|
iTextSharp.text.Font infos = new iTextSharp.text.Font(bfComic, 11, 0, iTextSharp.text.BaseColor.BLACK);
|
|
|
|
|
//抬头地址字体 黑色11 下划线
|
|
|
|
|
iTextSharp.text.Font address = new iTextSharp.text.Font(bfComic, 14, Font.UNDERLINE, iTextSharp.text.BaseColor.BLACK);
|
|
|
|
|
|
|
|
|
|
var 标题 = new iTextSharp.text.Paragraph("--总标题--", title);
|
|
|
|
|
//红色内容 红色11
|
|
|
|
|
iTextSharp.text.Font redinfos = new iTextSharp.text.Font(bfComic, 12, 0, iTextSharp.text.BaseColor.RED);
|
|
|
|
|
|
|
|
|
|
标题.Alignment = iTextSharp.text.Element.ALIGN_CENTER;
|
|
|
|
|
标题.Leading = 50;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 条码号
|
|
|
|
|
BarCodeDrawing _Code39 = new BarCodeDrawing();
|
|
|
|
|
_Code39.Height = 50;
|
|
|
|
|
_Code39.Magnify = 1;
|
|
|
|
@ -103,24 +128,71 @@ namespace DSWeb.Areas.CommMng.DAL
|
|
|
|
|
_codeImage.Save(markPath);
|
|
|
|
|
|
|
|
|
|
iTextSharp.text.Image im = iTextSharp.text.Image.GetInstance(markPath);
|
|
|
|
|
im.SetAbsolutePosition(width - 280, height - 60);
|
|
|
|
|
im.SetAbsolutePosition(width - 280, height - 60-80);
|
|
|
|
|
im.ScaleAbsolute(260, 40);
|
|
|
|
|
|
|
|
|
|
//document.Add(im);
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 抬头
|
|
|
|
|
//公司标志图片放置在../../UploadFiles/MailFile/companyid.png
|
|
|
|
|
var 公司标志图片路径 = path + "\\" + companyinfo.GID + ".png";
|
|
|
|
|
iTextSharp.text.Image 公司标志 = iTextSharp.text.Image.GetInstance(公司标志图片路径);
|
|
|
|
|
公司标志.SetAbsolutePosition(40, height - 60-8);
|
|
|
|
|
公司标志.ScaleAbsolute(160, 48);
|
|
|
|
|
//document.Add(公司标志);
|
|
|
|
|
|
|
|
|
|
var 公司名称 = new iTextSharp.text.Paragraph(companyinfo.FULLNAME, companyname);
|
|
|
|
|
|
|
|
|
|
公司名称.Alignment = iTextSharp.text.Element.ALIGN_CENTER;
|
|
|
|
|
公司名称.Leading = 24;
|
|
|
|
|
公司名称.Add(im);
|
|
|
|
|
公司名称.Add(公司标志);
|
|
|
|
|
document.Add(公司名称);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var 英文名称 = new iTextSharp.text.Paragraph(companyinfo.ENNAME, companyname);
|
|
|
|
|
|
|
|
|
|
英文名称.Alignment = iTextSharp.text.Element.ALIGN_CENTER;
|
|
|
|
|
英文名称.Leading = 24;
|
|
|
|
|
document.Add(英文名称);
|
|
|
|
|
|
|
|
|
|
var 地址 = new iTextSharp.text.Paragraph(" " + companyinfo.PRTHEADXML5+ " ", address);
|
|
|
|
|
|
|
|
|
|
地址.Alignment = iTextSharp.text.Element.ALIGN_CENTER;
|
|
|
|
|
地址.Leading = 22;
|
|
|
|
|
document.Add(地址);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
document.Add(标题);
|
|
|
|
|
|
|
|
|
|
document.Add(im);
|
|
|
|
|
var 标题 = new iTextSharp.text.Paragraph("领单申请书", title);
|
|
|
|
|
|
|
|
|
|
标题.Alignment = iTextSharp.text.Element.ALIGN_CENTER;
|
|
|
|
|
标题.Leading = 35;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
document.Add(标题);
|
|
|
|
|
|
|
|
|
|
var body = cdc.VW_BillCheckOut_Detail.Where(x => x.LINKGID == head.GID).ToList();
|
|
|
|
|
|
|
|
|
|
var newinfo1 = new iTextSharp.text.Paragraph($"客户名称:{head.CUSTOMERNAME} 客户类型: 联系人:{head.SENDER} 联系电话:" , infos);
|
|
|
|
|
var newinfo1 = new iTextSharp.text.Paragraph($"客户名称:{head.CUSTOMERNAME} 客户类型:{stlinfo.STLNAME} 联系人:{操作} 联系电话:{操作baseinfo[0].Tel}" , infos);
|
|
|
|
|
newinfo1.FirstLineIndent = 100;
|
|
|
|
|
newinfo1.Leading = 30;
|
|
|
|
|
newinfo1.Leading = 20;
|
|
|
|
|
document.Add(newinfo1);
|
|
|
|
|
|
|
|
|
|
//有效期至
|
|
|
|
|
var newinfo2 = new iTextSharp.text.Paragraph($"有效期:自收到48小时内({DateTime.Now.AddDays(2).ToString("yyyy-MM-dd HH:mm")})", heads);
|
|
|
|
|
newinfo2.FirstLineIndent = 100;
|
|
|
|
|
newinfo2.Leading = 20;
|
|
|
|
|
document.Add(newinfo2);
|
|
|
|
|
|
|
|
|
|
var blankline = new iTextSharp.text.Paragraph($" ", infos);
|
|
|
|
|
//blankline.FirstLineIndent = 100;
|
|
|
|
|
blankline.Leading = 30;
|
|
|
|
|
blankline.Leading = 10;
|
|
|
|
|
document.Add(blankline);
|
|
|
|
|
|
|
|
|
|
PdfPTable table = new PdfPTable(6);
|
|
|
|
@ -136,6 +208,14 @@ namespace DSWeb.Areas.CommMng.DAL
|
|
|
|
|
table.AddCell(new Phrase("提单签入日期", heads));
|
|
|
|
|
table.AddCell(new Phrase("二次改单", heads));
|
|
|
|
|
|
|
|
|
|
var bsnolist = body.Select(s => s.BSNO).ToList();
|
|
|
|
|
//var bsnolistStr = "'" + string.Join("','", bsnolist) + "'";
|
|
|
|
|
var billlist = new List<MsOpSeae>();
|
|
|
|
|
foreach (var bsno in bsnolist) {
|
|
|
|
|
var rec = MsOpSeaeDAL.GetData($"B.BSNO='{bsno}'");
|
|
|
|
|
billlist.Add(rec);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (var item in body)
|
|
|
|
|
{
|
|
|
|
|
var MBLNO = new iTextSharp.text.Paragraph(item.MBLNO, infos);
|
|
|
|
@ -147,13 +227,30 @@ namespace DSWeb.Areas.CommMng.DAL
|
|
|
|
|
var VOYNO = new iTextSharp.text.Paragraph(item.VOYNO, infos);
|
|
|
|
|
table.AddCell(VOYNO);
|
|
|
|
|
|
|
|
|
|
var ISSUETYPE = new iTextSharp.text.Paragraph("", infos);
|
|
|
|
|
var bill = billlist.First(x => x.BSNO == item.BSNO);
|
|
|
|
|
|
|
|
|
|
var ISSUETYPE = new iTextSharp.text.Paragraph(bill.ISSUETYPE, infos);
|
|
|
|
|
table.AddCell(ISSUETYPE);
|
|
|
|
|
|
|
|
|
|
var CHECKINDATE = new iTextSharp.text.Paragraph("", infos);
|
|
|
|
|
|
|
|
|
|
var CHECKINDATE = new iTextSharp.text.Paragraph(bill.ISSUEDATE, infos);
|
|
|
|
|
table.AddCell(CHECKINDATE);
|
|
|
|
|
|
|
|
|
|
var ECGD = new iTextSharp.text.Paragraph("", infos);
|
|
|
|
|
var workloglist = cdc.VW_BILL_BLISSUE_WORKLOG.Where(x => x.BSNO == item.BSNO).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var 二次改单 = "";
|
|
|
|
|
var 提单签入次数 = 0;
|
|
|
|
|
if (workloglist != null && workloglist.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
提单签入次数 = workloglist.Where(x => x.ACTNAME == "提单签入").ToList().Count();
|
|
|
|
|
if (提单签入次数 > 1)
|
|
|
|
|
{
|
|
|
|
|
二次改单 = ((DateTime)workloglist.Where(x => x.ACTNAME == "提单签入").Select(s => s.OPDATE).Max()).ToString("yyyy-MM-dd");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var ECGD = new iTextSharp.text.Paragraph(二次改单, infos);
|
|
|
|
|
table.AddCell(ECGD);
|
|
|
|
|
|
|
|
|
|
//newinfo.FirstLineIndent = 100;
|
|
|
|
@ -163,13 +260,26 @@ namespace DSWeb.Areas.CommMng.DAL
|
|
|
|
|
|
|
|
|
|
document.Add(table);
|
|
|
|
|
|
|
|
|
|
var footer = new iTextSharp.text.Paragraph("结尾落款", infos);
|
|
|
|
|
//感谢
|
|
|
|
|
var newinfo3 = new iTextSharp.text.Paragraph($"感谢您对我司的支持与信任,聚焦专注,用心服务", heads);
|
|
|
|
|
newinfo3.FirstLineIndent = 100;
|
|
|
|
|
newinfo3.Leading = 30;
|
|
|
|
|
document.Add(newinfo3);
|
|
|
|
|
|
|
|
|
|
var footer = new iTextSharp.text.Paragraph("签字 ", infos);
|
|
|
|
|
//footer.FirstLineIndent = 150;
|
|
|
|
|
|
|
|
|
|
footer.Leading = 60;
|
|
|
|
|
footer.Leading = 30;
|
|
|
|
|
footer.Alignment = iTextSharp.text.Element.ALIGN_RIGHT;
|
|
|
|
|
document.Add(footer);
|
|
|
|
|
|
|
|
|
|
var footer2 = new iTextSharp.text.Paragraph($"时间 ", infos);
|
|
|
|
|
//footer.FirstLineIndent = 150;
|
|
|
|
|
|
|
|
|
|
footer2.Leading = 30;
|
|
|
|
|
footer2.Alignment = iTextSharp.text.Element.ALIGN_RIGHT;
|
|
|
|
|
document.Add(footer2);
|
|
|
|
|
|
|
|
|
|
document.Close();
|
|
|
|
|
|
|
|
|
|
File.Delete(markPath);
|
|
|
|
|