DS7_JinGang
hanxuntao 2 years ago
commit 23f0f7bd56

@ -2419,6 +2419,32 @@ namespace DSWeb.Common.DB
public string VOYNO { get; set; }
}
[Table("VW_BILL_BLISSUE_WORKLOG")]
public partial class VW_BILL_BLISSUE_WORKLOG_md
{
[Key]
public string GID { get; set; }
public string DOBSNO { get; set; }
public DateTime? OPDATE { get; set; }
public string ACTNAME { get; set; }
public string REMARK { get; set; }
public string BSNO { get; set; }
}
[Table("WorkLog")]
public partial class WorkLog_md
{
[Key]
public string GID { get; set; }
public string BSNO { get; set; }
public string OP { get; set; }
public DateTime? OPDATE { get; set; }
public string ACTNAME { get; set; }
public string REMARK { get; set; }
public string ACTRESULT { get; set; }
}
public static class StrHelper
{
#region 将一个dictionary转化为用;;和::隔开的文本

@ -84,7 +84,12 @@ namespace DSWeb.Common.DB
public DbSet<BillCheckOut_md> BillCheckOut { get; set; }
public DbSet<BillCheckOut_Detail_md> BillCheckOut_Detail { get; set; }
public DbSet<VW_BillCheckOut_Detail_md> VW_BillCheckOut_Detail { get; set; }
public DbSet<VW_BILL_BLISSUE_WORKLOG_md> VW_BILL_BLISSUE_WORKLOG { get; set; }
public DbSet<WorkLog_md> WorkLog { get; set; }
}

@ -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);

@ -371,6 +371,12 @@ namespace DSWeb.MvcShipping.Controllers
return BasicDataRefDAL.GetContentResult(result);
}
/// <summary>
/// 签字板签名完成后,记录签名后文档
/// </summary>
/// <param name="GID"></param>
/// <param name="Base64Str"></param>
/// <returns></returns>
public ContentResult SaveSignPdf(string GID,string Base64Str)
{
var canlogin = BasicDataRefDAL.CheckLogin(Session);

@ -333,7 +333,7 @@ namespace DSWeb.MvcShipping.DAL.BillCheckOut
}
}
cdc.SaveChanges();
result.OK("发送成功");
return result;
}
@ -401,7 +401,7 @@ namespace DSWeb.MvcShipping.DAL.BillCheckOut
var filename = result.Message;
//2作为附件发出
result = SendCheckOutEmail(head);
result = SendCheckOutEmail(head, path);
return result;
@ -418,7 +418,7 @@ namespace DSWeb.MvcShipping.DAL.BillCheckOut
return result;
}
public static DBResult SendCheckOutEmail(BillCheckOut_md head)
public static DBResult SendCheckOutEmail(BillCheckOut_md head,string path)
{
var cdc = new CommonDataContext();
var result = new DBResult(true, "");
@ -427,11 +427,11 @@ namespace DSWeb.MvcShipping.DAL.BillCheckOut
head = cdc.BillCheckOut.FirstOrDefault(x => x.GID == head.GID);
var mailtitle = "签单表";
var mailtitle = "领单申请书";
var Body = new StringBuilder();
Body.Append("<html> <Body>");
Body.Append("<br />签单表内容:<br />业务编号:");
Body.Append("<br />领单申请书:<br />具体内容请查看附件");
//Body.Append("<br />客户名称:" + headData.CUSTOMERNAME);
//Body.Append("<br />揽货人" + headData.SALE);
//Body.Append("<br />录入人" + headData.INPUTBY);
@ -471,7 +471,66 @@ namespace DSWeb.MvcShipping.DAL.BillCheckOut
// result = MsSeaeOrderDAL.SendMailWithFile(mailtitle, Body.ToString(), filepath, mailto, Convert.ToString(Session["SHOWNAME"]));
//}
result = MsSeaeOrderDAL.MsSeaeOrderDAL.SendMailWithFile(mailtitle, Body.ToString(), head.MAILPDFURL, mailto, head.SENDER);
//20230328 首先trycatch删除 head.MAILPDFURL_*的文件
//然后复制一个head.MAILPDFURL文件至head.MAILPDFURL_yyyyMMddHHmm.pdf
//DirectoryInfo direction = new DirectoryInfo(filepath);
//var allfilename = head.MAILPDFURL.Replace(".pdf", "_*");
//FileInfo[] files= direction.GetFiles(allfilename,SearchOption.AllDirectories);
//if (files != null && files.Length > 0) {
// for (int i = 0; i < files.Length; i++)
// {
// try {
// File.Delete(files[i].FullName);
// }
// catch(Exception ex)
// {
// }
// }
//}
var filedic = GetLogicInfo(head.GID, "filename");
var upddic = new Dictionary<string,string>();
if (filedic!=null && filedic.Count>0)
foreach (var item in filedic) {
if (item.Value == "1") {
try
{
File.Delete(path+"/" + item.Key);
upddic.Add(item.Key, "0");
}
catch(Exception ex)
{
}
}
}
string sourceFile = path+"/" + head.CHECKOUTNO+".pdf";
string filelastname = DateTime.Now.ToString("yyyyMMddHHmmss") + ".pdf";
string destinationFile = sourceFile.Replace(".pdf","_") + filelastname ;
//记录复制的附件到
if (System.IO.File.Exists(sourceFile))
{
// true is overwrite
System.IO.File.Copy(sourceFile, destinationFile, true);
}
upddic.Add(head.CHECKOUTNO + "_" + filelastname , "1");
SaveLogicInfo(head.GID, "filename", upddic);
var sendpath = destinationFile.Replace(path, "../../UploadFiles/MailFile");
result = MsSeaeOrderDAL.MsSeaeOrderDAL.SendMailWithFile(mailtitle, Body.ToString(), sendpath, mailto, head.SENDER);
result.OK("发送成功");
}

@ -2696,6 +2696,49 @@ namespace DSWeb.MvcShipping.DAL.MsInfoClient
#endregion
#region 根据业务类型和业务日期判断客户账期类型(月结/票结)
static public STLDATEmb GetSTLNAME(string CUSTOMERNAME, string OPLBNAME, string BUSDATE, string SALE)
{
var strcondition = new StringBuilder();
strcondition.Append(" LINKGID=(SELECT GID from info_client where Shortname='" + CUSTOMERNAME
+ "') and Convert(datetime,'" + BUSDATE + "') between BGNDATE and ENDDATE and (OPLBNAME='" + OPLBNAME + "' or ISNULL(OPLBNAME,'')='') ");
if (!string.IsNullOrEmpty(SALE))
{
strcondition.Append(" and (isnull(SALE,'')='" + SALE + "' or isnull(SALE,'')='') ");
}
else
{
strcondition.Append(" and isnull(SALE,'')='' ");
}
strcondition.Append(" order by SALE desc,BGNDATE ASC ");
var ClientACCDATEList = GetACCDATEList(strcondition.ToString());
if (ClientACCDATEList.Count == 0)
{
var _r = new STLDATEmb();
_r.STLDATE = BUSDATE;
_r.STLNAME = "";
_r.BSSOURCE = "";
return _r;
}
else
{
var CA = ClientACCDATEList[0];
var _r = new STLDATEmb();
_r.STLNAME = CA.ACCTYPE;
_r.BSSOURCE = CA.BSSOURCE;
return _r;
}
}
#endregion
#region 往来单位审核
public static DBResult IC_Start ( List<MsClient> _List, string USERID ) //申请签入

Loading…
Cancel
Save