|
|
@ -1,10 +1,13 @@
|
|
|
|
using Furion;
|
|
|
|
using Furion;
|
|
|
|
using Furion.Logging;
|
|
|
|
using Furion.Logging;
|
|
|
|
|
|
|
|
using Furion.RemoteRequest.Extensions;
|
|
|
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
using Myshipping.Application.ConfigOption;
|
|
|
|
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.Service;
|
|
|
|
using Myshipping.Core.Service;
|
|
|
|
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
using SqlSugar;
|
|
|
|
using SqlSugar;
|
|
|
|
using System;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.Generic;
|
|
|
@ -13,25 +16,25 @@ using System.Linq;
|
|
|
|
using System.Text;
|
|
|
|
using System.Text;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Myshipping.Application.EDI.Yard
|
|
|
|
namespace Myshipping.Application.EDI
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 下货纸辅助类
|
|
|
|
/// 下货纸辅助类
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public static class XiahuozhiHelpler
|
|
|
|
public static class XiahuozhiHelpler
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
private static readonly string EdiFilePath = "XHZ";
|
|
|
|
|
|
|
|
|
|
|
|
public static bool Send(
|
|
|
|
public static bool Send(
|
|
|
|
//SqlSugarRepository<BookingOrder> repOrder,
|
|
|
|
long bookingId, string filerole, out string msg)
|
|
|
|
//SqlSugarRepository<BookingCtn> repCtn,
|
|
|
|
|
|
|
|
//SqlSugarRepository<SysDictType> repDictType,
|
|
|
|
|
|
|
|
//SqlSugarRepository<SysDictData> repDictData,
|
|
|
|
|
|
|
|
//SqlSugarRepository<BookingFile> repBookingFile,
|
|
|
|
|
|
|
|
//SqlSugarRepository<DjyEdiSetting> repEdiSetting,
|
|
|
|
|
|
|
|
long bookingId, string filerole, out string msg, string attShowName = "系统")
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var sugerClient = App.GetService<ISqlSugarClient>();
|
|
|
|
var repOrder = App.GetService<SqlSugarRepository<BookingOrder>>();
|
|
|
|
|
|
|
|
var repCtn = App.GetService<SqlSugarRepository<BookingCtn>>();
|
|
|
|
|
|
|
|
var repBookingFile = App.GetService<SqlSugarRepository<BookingFile>>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var cacheService = App.GetService<ISysCacheService>();
|
|
|
|
|
|
|
|
|
|
|
|
var order = sugerClient.Queryable<BookingOrder>().First(o => o.Id == bookingId);
|
|
|
|
var order = repOrder.FirstOrDefault(o => o.Id == bookingId);
|
|
|
|
if (order == null)
|
|
|
|
if (order == null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
msg = "订舱信息未找到";
|
|
|
|
msg = "订舱信息未找到";
|
|
|
@ -64,9 +67,9 @@ namespace Myshipping.Application.EDI.Yard
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var fileOpt = App.GetOptions<BookingAttachOptions>();
|
|
|
|
var fileOpt = App.GetOptions<BookingAttachOptions>();
|
|
|
|
if (!Directory.Exists(fileOpt.basePath))
|
|
|
|
if (string.IsNullOrEmpty(fileOpt.basePath))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Directory.CreateDirectory(fileOpt.basePath);
|
|
|
|
fileOpt.basePath = AppDomain.CurrentDomain.BaseDirectory;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -91,20 +94,23 @@ namespace Myshipping.Application.EDI.Yard
|
|
|
|
var paraXHZ = GetAllTenantParam().Result.FirstOrDefault(p => p.TenantId == order.TenantId && p.ParaCode == "CODE_GLJ_XHZ");
|
|
|
|
var paraXHZ = GetAllTenantParam().Result.FirstOrDefault(p => p.TenantId == order.TenantId && p.ParaCode == "CODE_GLJ_XHZ");
|
|
|
|
if (paraXHZ == null || string.IsNullOrEmpty(paraXHZ.ItemCode))
|
|
|
|
if (paraXHZ == null || string.IsNullOrEmpty(paraXHZ.ItemCode))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
msg = "下货纸代号未找到或配置有误";
|
|
|
|
msg = $"{order.TenantName} 港联捷场站 下货纸代号未找到或配置有误";
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var ediFileName = $"{paraXHZ.ItemCode}_{order.MBLNO}_{DateTime.Now.Ticks}.txt";
|
|
|
|
var ediFileName = $"{paraXHZ.ItemCode}_{order.MBLNO}_{DateTime.Now.Ticks}.txt";
|
|
|
|
var ediFileRela = Path.Combine("XHZ", ediFileName);
|
|
|
|
var ediFileRela = Path.Combine(EdiFilePath, ediFileName);
|
|
|
|
var ediFileAbs = Path.Combine(fileOpt.basePath, ediFileRela);
|
|
|
|
var ediPathAbs = Path.Combine(fileOpt.basePath, EdiFilePath);
|
|
|
|
|
|
|
|
var ediFileAbs = Path.Combine(ediPathAbs, ediFileRela);
|
|
|
|
|
|
|
|
if (!Directory.Exists(ediPathAbs))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Directory.CreateDirectory(ediPathAbs);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//港联捷所有用户使用一个ftp用户名和密码发送报文,使用文件名中的下货纸代号进行区分
|
|
|
|
//港联捷所有用户使用一个ftp用户名和密码发送报文,使用文件名中的下货纸代号进行区分
|
|
|
|
var dicTypeGLJ = repDictType.FirstOrDefault(x => x.Code == "booking_ftp_setting_glj");
|
|
|
|
var paraServer = cacheService.GetAllDictData().Result.FirstOrDefault(x => x.TypeCode == "booking_ftp_setting_glj" && x.Code == "ftp_server");
|
|
|
|
var dicDataGLJ = repDictData.Where(x => x.TypeId == dicTypeGLJ.Id).ToList();
|
|
|
|
var paraUser = cacheService.GetAllDictData().Result.FirstOrDefault(x => x.TypeCode == "booking_ftp_setting_glj" && x.Code == "username");
|
|
|
|
var paraServer = dicDataGLJ.FirstOrDefault(x => x.Code == "ftp_server").Value;
|
|
|
|
var paraPwd = cacheService.GetAllDictData().Result.FirstOrDefault(x => x.TypeCode == "booking_ftp_setting_glj" && x.Code == "pwd");
|
|
|
|
var paraUser = dicDataGLJ.FirstOrDefault(x => x.Code == "username").Value;
|
|
|
|
|
|
|
|
var paraPwd = dicDataGLJ.FirstOrDefault(x => x.Code == "pwd").Value;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (paraServer == null || paraUser == null || paraPwd == null)
|
|
|
|
if (paraServer == null || paraUser == null || paraPwd == null)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -132,7 +138,7 @@ namespace Myshipping.Application.EDI.Yard
|
|
|
|
var ctnCodes = GetAllCodeCtn().Result.Select(x => new { x.Code, x.Size }).ToList();
|
|
|
|
var ctnCodes = GetAllCodeCtn().Result.Select(x => new { x.Code, x.Size }).ToList();
|
|
|
|
var ctnEdiList = GetAllMappingCtn().Result.AsQueryable().Where(x => x.Module == "XHZ_GLJ" && x.CarrierCode == order.CARRIERID).ToList();
|
|
|
|
var ctnEdiList = GetAllMappingCtn().Result.AsQueryable().Where(x => x.Module == "XHZ_GLJ" && x.CarrierCode == order.CARRIERID).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
var ctns = sugerClient.Queryable<BookingCtn>().Where(c => c.BILLID == bookingId).ToList();
|
|
|
|
var ctns = repCtn.Where(c => c.BILLID == bookingId).ToList();
|
|
|
|
foreach (var ctn in ctns)
|
|
|
|
foreach (var ctn in ctns)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var ctnFind = ctnCodes.FirstOrDefault(c => c.Code == ctn.CTNCODE);
|
|
|
|
var ctnFind = ctnCodes.FirstOrDefault(c => c.Code == ctn.CTNCODE);
|
|
|
@ -156,15 +162,27 @@ namespace Myshipping.Application.EDI.Yard
|
|
|
|
File.WriteAllText(ediFileAbs, sbData.ToString());
|
|
|
|
File.WriteAllText(ediFileAbs, sbData.ToString());
|
|
|
|
|
|
|
|
|
|
|
|
//发送ftp
|
|
|
|
//发送ftp
|
|
|
|
//BackgroundTaskFtp ftpTask = new BackgroundTaskFtp();
|
|
|
|
var ftpPostObj = new
|
|
|
|
//ftpTask.GID = Guid.NewGuid().ToString();
|
|
|
|
{
|
|
|
|
//ftpTask.FtpHost = paraServer.PARAMVALUE;
|
|
|
|
host = paraServer.Value,
|
|
|
|
//ftpTask.FtpUser = paraUser.PARAMVALUE;
|
|
|
|
username = paraUser.Value,
|
|
|
|
//ftpTask.FtpPassword = paraPwd.PARAMVALUE;
|
|
|
|
pwd = paraPwd.Value,
|
|
|
|
//ftpTask.FtpData = FtpTaskHelper.GenTaskJson("", ediFile, null);
|
|
|
|
path = "/"
|
|
|
|
//ftpTask.Type = BackgroundTaskFtp.TypeFtpUpload;
|
|
|
|
};
|
|
|
|
//commonData.BackgroundTaskFtp.Add(ftpTask);
|
|
|
|
var ftpSpiderUrl = cacheService.GetAllDictData().Result.FirstOrDefault(x => x.TypeCode == "url_set" && x.Code == "booking_edi_ftp_server").Value;
|
|
|
|
//commonData.SaveChanges();
|
|
|
|
Log.Information($"准备请求发送ftp:{ftpSpiderUrl} ,参数:{ftpPostObj.ToJsonString()},文件:{ediFileName}");
|
|
|
|
|
|
|
|
var res = ftpSpiderUrl
|
|
|
|
|
|
|
|
.SetContentType("multipart/form-data")
|
|
|
|
|
|
|
|
.SetBody(ftpPostObj)
|
|
|
|
|
|
|
|
.SetBodyBytes(("file", Encoding.UTF8.GetBytes(sbData.ToString()), ediFileName))
|
|
|
|
|
|
|
|
.PostAsStringAsync();
|
|
|
|
|
|
|
|
Log.Information($"发送ftp返回:{res}");
|
|
|
|
|
|
|
|
var jobjRetn = JObject.Parse(res.Result);
|
|
|
|
|
|
|
|
if (jobjRetn.GetStringValue("status") != "1")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
msg = $"ftp发送失败:{jobjRetn.GetStringValue("message")}";
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//挂载附件
|
|
|
|
//挂载附件
|
|
|
|
var attFile = new BookingFile();
|
|
|
|
var attFile = new BookingFile();
|
|
|
@ -174,7 +192,7 @@ namespace Myshipping.Application.EDI.Yard
|
|
|
|
attFile.TypeCode = "xiahuozhi";
|
|
|
|
attFile.TypeCode = "xiahuozhi";
|
|
|
|
attFile.TypeName = "下货纸";
|
|
|
|
attFile.TypeName = "下货纸";
|
|
|
|
attFile.TenantName = order.TenantName;
|
|
|
|
attFile.TenantName = order.TenantName;
|
|
|
|
sugerClient.Insertable(attFile).ExecuteCommand();
|
|
|
|
repBookingFile.Insert(attFile);
|
|
|
|
|
|
|
|
|
|
|
|
msg = "已发送";
|
|
|
|
msg = "已发送";
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
@ -209,17 +227,22 @@ namespace Myshipping.Application.EDI.Yard
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var ediFileName = $"{order.VESSEL}_{order.VOYNO}_{order.MBLNO}_{DateTime.Now.Ticks}.txt";
|
|
|
|
var ediFileName = $"{order.VESSEL}_{order.VOYNO}_{order.MBLNO}_{DateTime.Now.Ticks}.txt";
|
|
|
|
var ediFileRela = Path.Combine("XHZ", ediFileName);
|
|
|
|
var ediFileRela = Path.Combine(EdiFilePath, ediFileName);
|
|
|
|
var ediFileAbs = Path.Combine(fileOpt.basePath, ediFileRela);
|
|
|
|
var ediPathAbs = Path.Combine(fileOpt.basePath, EdiFilePath);
|
|
|
|
|
|
|
|
var ediFileAbs = Path.Combine(ediPathAbs, ediFileRela);
|
|
|
|
|
|
|
|
if (!Directory.Exists(ediPathAbs))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Directory.CreateDirectory(ediPathAbs);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DjyEdiSetting ftpset = null;
|
|
|
|
DjyEdiSetting ftpset = null;
|
|
|
|
if (order.YARD == "港捷丰场站")
|
|
|
|
if (order.YARD == "港捷丰场站")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ftpset = repEdiSetting.FirstOrDefault(f => f.EDINAME == "XHZ_GJF" && f.TenantId == order.TenantId);
|
|
|
|
ftpset = cacheService.GetAllEdiSetting().Result.FirstOrDefault(f => f.EDINAME == "XHZ_GJF" && f.TenantId == order.TenantId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (order.YARD == "捷丰场站")
|
|
|
|
else if (order.YARD == "捷丰场站")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ftpset = repEdiSetting.FirstOrDefault(f => f.EDINAME == "XHZ_JIEFENG" && f.TenantId == order.TenantId);
|
|
|
|
ftpset = cacheService.GetAllEdiSetting().Result.FirstOrDefault(f => f.EDINAME == "XHZ_JIEFENG" && f.TenantId == order.TenantId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (ftpset == null)
|
|
|
|
if (ftpset == null)
|
|
|
@ -406,15 +429,27 @@ namespace Myshipping.Application.EDI.Yard
|
|
|
|
File.WriteAllText(ediFileAbs, strJoin, Encoding.Default);
|
|
|
|
File.WriteAllText(ediFileAbs, strJoin, Encoding.Default);
|
|
|
|
|
|
|
|
|
|
|
|
//后续发送
|
|
|
|
//后续发送
|
|
|
|
//BackgroundTaskFtp ftpTask = new BackgroundTaskFtp();
|
|
|
|
var ftpPostObj = new
|
|
|
|
//ftpTask.GID = Guid.NewGuid().ToString();
|
|
|
|
{
|
|
|
|
//ftpTask.FtpHost = ftpset.SERVERIP;
|
|
|
|
host = ftpset.SERVERIP,
|
|
|
|
//ftpTask.FtpUser = ftpset.USERNAME;
|
|
|
|
username = ftpset.USERNAME,
|
|
|
|
//ftpTask.FtpPassword = ftpset.PASSWORD;
|
|
|
|
pwd = ftpset.PASSWORD,
|
|
|
|
//ftpTask.FtpData = FtpTaskHelper.GenTaskJson(ftpset.FOLDERNAME, ediFile, null);
|
|
|
|
path = ftpset.FOLDERNAME
|
|
|
|
//ftpTask.Type = BackgroundTaskFtp.TypeFtpUpload;
|
|
|
|
};
|
|
|
|
//commonData.BackgroundTaskFtp.Add(ftpTask);
|
|
|
|
var ftpSpiderUrl = cacheService.GetAllDictData().Result.FirstOrDefault(x => x.TypeCode == "url_set" && x.Code == "booking_edi_ftp_server").Value;
|
|
|
|
//commonData.SaveChanges();
|
|
|
|
Log.Information($"准备请求发送ftp:{ftpSpiderUrl} ,参数:{ftpPostObj.ToJsonString()},文件:{ediFileName}");
|
|
|
|
|
|
|
|
var res = ftpSpiderUrl
|
|
|
|
|
|
|
|
.SetContentType("multipart/form-data")
|
|
|
|
|
|
|
|
.SetBody(ftpPostObj)
|
|
|
|
|
|
|
|
.SetBodyBytes(("file", Encoding.UTF8.GetBytes(strJoin), ediFileName))
|
|
|
|
|
|
|
|
.PostAsStringAsync();
|
|
|
|
|
|
|
|
Log.Information($"发送ftp返回:{res}");
|
|
|
|
|
|
|
|
var jobjRetn = JObject.Parse(res.Result);
|
|
|
|
|
|
|
|
if (jobjRetn.GetStringValue("status") != "1")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
msg = $"ftp发送失败:{jobjRetn.GetStringValue("message")}";
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//挂载附件
|
|
|
|
//挂载附件
|
|
|
@ -439,7 +474,7 @@ namespace Myshipping.Application.EDI.Yard
|
|
|
|
var pGlxEdi = GetAllTenantParam().Result.FirstOrDefault(p => p.TenantId == order.TenantId && p.ParaCode == "XIAHUOZHI_GLX_SEND_TYPE");
|
|
|
|
var pGlxEdi = GetAllTenantParam().Result.FirstOrDefault(p => p.TenantId == order.TenantId && p.ParaCode == "XIAHUOZHI_GLX_SEND_TYPE");
|
|
|
|
if (order.YARD == "港联欣场站" && pGlxEdi != null && pGlxEdi.ItemCode == "EDI_GLJ")
|
|
|
|
if (order.YARD == "港联欣场站" && pGlxEdi != null && pGlxEdi.ItemCode == "EDI_GLJ")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var ftpset = repEdiSetting.FirstOrDefault(f => f.EDINAME == "XHZ_GLX" && f.TenantId == order.TenantId);
|
|
|
|
var ftpset = cacheService.GetAllEdiSetting().Result.FirstOrDefault(f => f.EDINAME == "XHZ_GLX" && f.TenantId == order.TenantId);
|
|
|
|
if (ftpset == null)
|
|
|
|
if (ftpset == null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
msg = "港联欣下货纸ftp设置未找到";
|
|
|
|
msg = "港联欣下货纸ftp设置未找到";
|
|
|
@ -454,8 +489,13 @@ namespace Myshipping.Application.EDI.Yard
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var ediFileName = $"{paraXHZ.ItemCode}_{order.MBLNO}_{DateTime.Now.Ticks}.txt";
|
|
|
|
var ediFileName = $"{paraXHZ.ItemCode}_{order.MBLNO}_{DateTime.Now.Ticks}.txt";
|
|
|
|
var ediFileRela = Path.Combine("XHZ", ediFileName);
|
|
|
|
var ediFileRela = Path.Combine(EdiFilePath, ediFileName);
|
|
|
|
var ediFileAbs = Path.Combine(fileOpt.basePath, ediFileRela);
|
|
|
|
var ediPathAbs = Path.Combine(fileOpt.basePath, EdiFilePath);
|
|
|
|
|
|
|
|
var ediFileAbs = Path.Combine(ediPathAbs, ediFileRela);
|
|
|
|
|
|
|
|
if (!Directory.Exists(ediPathAbs))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Directory.CreateDirectory(ediPathAbs);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
StringBuilder sbData = new StringBuilder();
|
|
|
|
StringBuilder sbData = new StringBuilder();
|
|
|
|
sbData.AppendLine($"01:{order.VESSEL}:{order.VOYNO}"); //船名 航次
|
|
|
|
sbData.AppendLine($"01:{order.VESSEL}:{order.VOYNO}"); //船名 航次
|
|
|
@ -495,15 +535,27 @@ namespace Myshipping.Application.EDI.Yard
|
|
|
|
File.WriteAllText(ediFileAbs, sbData.ToString());
|
|
|
|
File.WriteAllText(ediFileAbs, sbData.ToString());
|
|
|
|
|
|
|
|
|
|
|
|
//后续发送
|
|
|
|
//后续发送
|
|
|
|
//BackgroundTaskFtp ftpTask = new BackgroundTaskFtp();
|
|
|
|
var ftpPostObj = new
|
|
|
|
//ftpTask.GID = Guid.NewGuid().ToString();
|
|
|
|
{
|
|
|
|
//ftpTask.FtpHost = ftpset.SERVERIP;
|
|
|
|
host = ftpset.SERVERIP,
|
|
|
|
//ftpTask.FtpUser = ftpset.USERNAME;
|
|
|
|
username = ftpset.USERNAME,
|
|
|
|
//ftpTask.FtpPassword = ftpset.PASSWORD;
|
|
|
|
pwd = ftpset.PASSWORD,
|
|
|
|
//ftpTask.FtpData = FtpTaskHelper.GenTaskJson("", ediFile, null);
|
|
|
|
path = ftpset.FOLDERNAME
|
|
|
|
//ftpTask.Type = BackgroundTaskFtp.TypeFtpUpload;
|
|
|
|
};
|
|
|
|
//commonData.BackgroundTaskFtp.Add(ftpTask);
|
|
|
|
var ftpSpiderUrl = cacheService.GetAllDictData().Result.FirstOrDefault(x => x.TypeCode == "url_set" && x.Code == "booking_edi_ftp_server").Value;
|
|
|
|
//commonData.SaveChanges();
|
|
|
|
Log.Information($"准备请求发送ftp:{ftpSpiderUrl} ,参数:{ftpPostObj.ToJsonString()},文件:{ediFileName}");
|
|
|
|
|
|
|
|
var res = ftpSpiderUrl
|
|
|
|
|
|
|
|
.SetContentType("multipart/form-data")
|
|
|
|
|
|
|
|
.SetBody(ftpPostObj)
|
|
|
|
|
|
|
|
.SetBodyBytes(("file", Encoding.UTF8.GetBytes(sbData.ToString()), ediFileName))
|
|
|
|
|
|
|
|
.PostAsStringAsync();
|
|
|
|
|
|
|
|
Log.Information($"发送ftp返回:{res}");
|
|
|
|
|
|
|
|
var jobjRetn = JObject.Parse(res.Result);
|
|
|
|
|
|
|
|
if (jobjRetn.GetStringValue("status") != "1")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
msg = $"ftp发送失败:{jobjRetn.GetStringValue("message")}";
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//挂载附件
|
|
|
|
//挂载附件
|
|
|
|
var attFile = new BookingFile();
|
|
|
|
var attFile = new BookingFile();
|
|
|
@ -522,53 +574,53 @@ namespace Myshipping.Application.EDI.Yard
|
|
|
|
msg = "场站联系人邮箱不能为空";
|
|
|
|
msg = "场站联系人邮箱不能为空";
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// MailDataContext mailData = new MailDataContext();
|
|
|
|
// MailDataContext mailData = new MailDataContext();
|
|
|
|
// var userMail = mailData.UserAccounts.AsNoTracking().FirstOrDefault(ua => ua.UserId == order.USERID);
|
|
|
|
// var userMail = mailData.UserAccounts.AsNoTracking().FirstOrDefault(ua => ua.UserId == order.USERID);
|
|
|
|
// 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 = sugerClient.Queryable<SysUser>().First(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);
|
|
|
|
// MailHelper.SendMail(userMail.GID, title, body, order.YardContractEmail, customerSend: true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
msg = "已发送";
|
|
|
|
msg = "已发送";
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|