|
|
@ -6,6 +6,7 @@ using Myshipping.Application.ConfigOption;
|
|
|
|
using Myshipping.Application.Entity;
|
|
|
|
using Myshipping.Application.Entity;
|
|
|
|
using Myshipping.Core;
|
|
|
|
using Myshipping.Core;
|
|
|
|
using Myshipping.Core.Entity;
|
|
|
|
using Myshipping.Core.Entity;
|
|
|
|
|
|
|
|
using Myshipping.Core.Helper;
|
|
|
|
using Myshipping.Core.Service;
|
|
|
|
using Myshipping.Core.Service;
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
using SqlSugar;
|
|
|
|
using SqlSugar;
|
|
|
@ -28,9 +29,11 @@ namespace Myshipping.Application.EDI
|
|
|
|
public static bool Send(
|
|
|
|
public static bool Send(
|
|
|
|
long bookingId, string filerole, out string msg)
|
|
|
|
long bookingId, string filerole, out string msg)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
var repUser = App.GetService<SqlSugarRepository<SysUser>>();
|
|
|
|
var repOrder = App.GetService<SqlSugarRepository<BookingOrder>>();
|
|
|
|
var repOrder = App.GetService<SqlSugarRepository<BookingOrder>>();
|
|
|
|
var repCtn = App.GetService<SqlSugarRepository<BookingCtn>>();
|
|
|
|
var repCtn = App.GetService<SqlSugarRepository<BookingCtn>>();
|
|
|
|
var repBookingFile = App.GetService<SqlSugarRepository<BookingFile>>();
|
|
|
|
var repBookingFile = App.GetService<SqlSugarRepository<BookingFile>>();
|
|
|
|
|
|
|
|
var repUserMail = App.GetService<SqlSugarRepository<DjyUserMailAccount>>();
|
|
|
|
|
|
|
|
|
|
|
|
var cacheService = App.GetService<ISysCacheService>();
|
|
|
|
var cacheService = App.GetService<ISysCacheService>();
|
|
|
|
|
|
|
|
|
|
|
@ -106,7 +109,7 @@ namespace Myshipping.Application.EDI
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Directory.CreateDirectory(ediPathAbs);
|
|
|
|
Directory.CreateDirectory(ediPathAbs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var ediSettints = cacheService.GetAllEdiSetting().Result;
|
|
|
|
//港联捷所有用户使用一个ftp用户名和密码发送报文,使用文件名中的下货纸代号进行区分
|
|
|
|
//港联捷所有用户使用一个ftp用户名和密码发送报文,使用文件名中的下货纸代号进行区分
|
|
|
|
var paraServer = cacheService.GetAllDictData().Result.FirstOrDefault(x => x.TypeCode == "booking_ftp_setting_glj" && x.Code == "ftp_server");
|
|
|
|
var paraServer = cacheService.GetAllDictData().Result.FirstOrDefault(x => x.TypeCode == "booking_ftp_setting_glj" && x.Code == "ftp_server");
|
|
|
|
var paraUser = cacheService.GetAllDictData().Result.FirstOrDefault(x => x.TypeCode == "booking_ftp_setting_glj" && x.Code == "username");
|
|
|
|
var paraUser = cacheService.GetAllDictData().Result.FirstOrDefault(x => x.TypeCode == "booking_ftp_setting_glj" && x.Code == "username");
|
|
|
@ -574,53 +577,53 @@ namespace Myshipping.Application.EDI
|
|
|
|
msg = "场站联系人邮箱不能为空";
|
|
|
|
msg = "场站联系人邮箱不能为空";
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// MailDataContext mailData = new MailDataContext();
|
|
|
|
|
|
|
|
// var userMail = mailData.UserAccounts.AsNoTracking().FirstOrDefault(ua => ua.UserId == order.USERID);
|
|
|
|
var userMail = repUserMail.FirstOrDefault(x=>x.CreatedUserId == order.CreatedUserId);
|
|
|
|
// if (userMail == null
|
|
|
|
if (userMail == null
|
|
|
|
// || string.IsNullOrEmpty(userMail.SmtpServer)
|
|
|
|
|| string.IsNullOrEmpty(userMail.SmtpServer)
|
|
|
|
// || userMail.SmtpPort == 0)
|
|
|
|
|| userMail.SmtpPort == 0)
|
|
|
|
// {
|
|
|
|
{
|
|
|
|
// msg = "发件邮箱未配置";
|
|
|
|
msg = "发件邮箱未配置";
|
|
|
|
// return false;
|
|
|
|
return false;
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// var userbase = sugerClient.Queryable<SysUser>().First(u => u.Id == order.CreatedUserId);
|
|
|
|
var userbase = repUser.FirstOrDefault(u => u.Id == order.CreatedUserId);
|
|
|
|
// var title = $"下货纸:{order.MBLNO}/{order.CARRIER}/{order.VESSEL}/{order.VOYNO}/{order.TenantName}";
|
|
|
|
var title = $"下货纸:{order.MBLNO}/{order.CARRIER}/{order.VESSEL}/{order.VOYNO}/{order.TenantName}";
|
|
|
|
|
|
|
|
|
|
|
|
// var bodyExt = string.Empty;
|
|
|
|
var bodyExt = string.Empty;
|
|
|
|
// if (order.CARGOID == "R")
|
|
|
|
if (order.CARGOID == "R")
|
|
|
|
// {
|
|
|
|
{
|
|
|
|
// bodyExt = $@"温度:{order.TEMPSET}{order.TEMPID}<br/>
|
|
|
|
bodyExt = $@"温度:{order.TEMPSET}{order.TEMPID}<br/>
|
|
|
|
//通风:{order.REEFERF}<br/>
|
|
|
|
通风:{order.REEFERF}<br/>
|
|
|
|
//湿度:{order.HUMIDITY}<br/>";
|
|
|
|
湿度:{order.HUMIDITY}<br/>";
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// else if (order.CARGOID == "D")
|
|
|
|
else if (order.CARGOID == "D")
|
|
|
|
// {
|
|
|
|
{
|
|
|
|
// bodyExt = $@"危险品等级:{order.DCLASS}<br/>
|
|
|
|
bodyExt = $@"危险品等级:{order.DCLASS}<br/>
|
|
|
|
//危险品编号:{order.DUNNO}<br/>
|
|
|
|
危险品编号:{order.DUNNO}<br/>
|
|
|
|
//危险品联系方式:{order.LINKMAN}<br/>";
|
|
|
|
危险品联系方式:{order.LINKMAN}<br/>";
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// var body = $@"提单号:{order.MBLNO}<br/>
|
|
|
|
var body = $@"提单号:{order.MBLNO}<br/>
|
|
|
|
//船名航次:{order.VESSEL}/{order.VOYNO}<br/>
|
|
|
|
船名航次:{order.VESSEL}/{order.VOYNO}<br/>
|
|
|
|
//起运港:{order.PORTLOAD},{order.PORTLOADID}<br/>
|
|
|
|
起运港:{order.PORTLOAD},{order.PORTLOADID}<br/>
|
|
|
|
//目的港:{order.PORTDISCHARGE},{order.PORTDISCHARGEID}<br/>
|
|
|
|
目的港:{order.PORTDISCHARGE},{order.PORTDISCHARGEID}<br/>
|
|
|
|
//目的地:{order.DESTINATION},{order.DESTINATIONID}<br/>
|
|
|
|
目的地:{order.DESTINATION},{order.DESTINATIONID}<br/>
|
|
|
|
//预计船期:{(order.ETD.HasValue ? order.ETD.Value.ToString("yyyy-MM-dd") : "")}<br/>
|
|
|
|
预计船期:{(order.ETD.HasValue ? order.ETD.Value.ToString("yyyy-MM-dd") : "")}<br/>
|
|
|
|
//箱型箱量:{order.CNTRTOTAL}<br/>
|
|
|
|
箱型箱量:{order.CNTRTOTAL}<br/>
|
|
|
|
//件重尺:{order.PKGS} {order.KINDPKGS}/{order.KGS}KGS/{order.CBM}CBM<br/>
|
|
|
|
件重尺:{order.PKGS} {order.KINDPKGS}/{order.KGS}KGS/{order.CBM}CBM<br/>
|
|
|
|
//货物描述:{order.DESCRIPTION}<br/>
|
|
|
|
货物描述:{order.DESCRIPTION}<br/>
|
|
|
|
//{bodyExt}
|
|
|
|
{bodyExt}
|
|
|
|
//备注:{order.YARDREMARK}<br/>
|
|
|
|
备注:{order.YARDREMARK}<br/>
|
|
|
|
//<br/>
|
|
|
|
<br/>
|
|
|
|
//订舱代理:{order.TenantName}<br/>
|
|
|
|
订舱代理:{order.TenantName}<br/>
|
|
|
|
//联系人:{order.CreatedUserName}<br/>
|
|
|
|
联系人:{order.CreatedUserName}<br/>
|
|
|
|
//电话:{userbase.Tel} 手机:{userbase.Phone}<br/>
|
|
|
|
电话:{userbase.Tel} 手机:{userbase.Phone}<br/>
|
|
|
|
//邮箱:{userbase.Email}<br/>
|
|
|
|
邮箱:{userbase.Email}<br/>
|
|
|
|
//";
|
|
|
|
";
|
|
|
|
|
|
|
|
|
|
|
|
// MailHelper.SendMail(userMail.GID, title, body, order.YardContractEmail, customerSend: true);
|
|
|
|
MailSendHelper.SendMail(userMail, title, body, order.YARDCONTRACTEMAIL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
msg = "已发送";
|
|
|
|
msg = "已发送";
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|