# Conflicts:
#	Myshipping.Application/Service/BookingOrder/BookingOrderService.cs
optimize
wanghaomei 2 years ago
commit 61326ee384

@ -1,5 +1,6 @@
using Myshipping.Application.EDI.ESL; using Myshipping.Application.EDI.ESL;
using MySqlX.XDevAPI.Common; using MySqlX.XDevAPI.Common;
using StackExchange.Profiling.Internal;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
@ -670,16 +671,25 @@ namespace Myshipping.Application.EDI.PIL
var SENDCODE = ""; var SENDCODE = "";
SENDCODE = InttrEdi.SENDCODE; SENDCODE = InttrEdi.SENDCODE;
// //
string filename = InttrEdi.filerpath + "\\" + InttrEdi.BSLIST[0].MBLNO + estr + ".pms";
string dir = InttrEdi.filerpath + "\\" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + "\\";
//string filename = + InttrEdi.BSLIST[0].MBLNO + estr + ".pms";
//如果是部署linux需要修改路径 //如果是部署linux需要修改路径
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
filename = filename.Replace("\\", "/"); dir = dir.Replace("\\", "/");
if (System.IO.File.Exists(filename)) if (!Directory.Exists(dir))
{ {
System.IO.File.Delete(filename); Directory.CreateDirectory(dir);
} }
string filename = dir + InttrEdi.BSLIST[0].MBLNO + estr + ".pms";
//if (System.IO.File.Exists(filename))
//{
// System.IO.File.Delete(filename);
//}
FileStream f = new FileStream(filename, FileMode.Create); FileStream f = new FileStream(filename, FileMode.Create);
StreamWriter r = new StreamWriter(f, Encoding.Default); StreamWriter r = new StreamWriter(f, Encoding.Default);
var icount = 0; var icount = 0;
@ -959,8 +969,8 @@ namespace Myshipping.Application.EDI.PIL
tempstr += GetSpaceStr("001", 3);//4 //Booking Party Code//O//X(3)//16 //18 //webcsm Partner Subcode//mandtory订舱单位代码(customer code) tempstr += GetSpaceStr("001", 3);//4 //Booking Party Code//O//X(3)//16 //18 //webcsm Partner Subcode//mandtory订舱单位代码(customer code)
} }
tempstr += GetSpaceStr("", 4);//5 //Filler//M//X(4)//19 //22 //Spaces tempstr += GetSpaceStr("", 4);//5 //Filler//M//X(4)//19 //22 //Spaces
int iLs = InttrEdi.ForWarderName.Length / 35; int iLs = (!string.IsNullOrWhiteSpace(InttrEdi.ForWarderName)?InttrEdi.ForWarderName.Length:0) / 35;
int iLs2 = InttrEdi.ForWarderName.Length % 35; int iLs2 = (!string.IsNullOrWhiteSpace(InttrEdi.ForWarderName)?InttrEdi.ForWarderName.Length:0) % 35;
int n = 0; int n = 0;
for (int i = 0; i < iLs; i++) for (int i = 0; i < iLs; i++)
{ {
@ -1669,7 +1679,7 @@ namespace Myshipping.Application.EDI.PIL
if (InttrEdi.filetype == "E") if (InttrEdi.filetype == "E")
{ {
//欧盟港口、伊朗港口、KHI //欧盟港口、伊朗港口、KHI
if (bill.cKHI != "") if (!string.IsNullOrWhiteSpace(bill.cKHI))
{ {
Shipping = bill.cKHI; Shipping = bill.cKHI;
List<System.String> ShippingListLs = formatlengthStr(Shipping, 120); List<System.String> ShippingListLs = formatlengthStr(Shipping, 120);
@ -1684,7 +1694,7 @@ namespace Myshipping.Application.EDI.PIL
} }
//南美东 //南美东
if (bill.cNCM != "") if (!string.IsNullOrWhiteSpace(bill.cNCM))
{ {
Shipping = bill.cNCM; Shipping = bill.cNCM;
List<System.String> ShippingListLs = formatlengthStr(Shipping, 120); List<System.String> ShippingListLs = formatlengthStr(Shipping, 120);
@ -1699,7 +1709,7 @@ namespace Myshipping.Application.EDI.PIL
} }
//巴西线的木质包装情况 //巴西线的木质包装情况
if (bill.wNCM != "") if (!string.IsNullOrWhiteSpace(bill.wNCM))
{ {
Shipping = bill.wNCM; Shipping = bill.wNCM;
List<System.String> ShippingListLs = formatlengthStr(Shipping, 120); List<System.String> ShippingListLs = formatlengthStr(Shipping, 120);

@ -727,10 +727,10 @@ namespace Myshipping.Application.EDI.TSL
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
filename = filename.Replace("\\", "/"); filename = filename.Replace("\\", "/");
if (System.IO.File.Exists(filename)) //if (System.IO.File.Exists(filename))
{ //{
System.IO.File.Delete(filename); // System.IO.File.Delete(filename);
} //}
FileStream f = new FileStream(filename, FileMode.Create); FileStream f = new FileStream(filename, FileMode.Create);
StreamWriter r = new StreamWriter(f, Encoding.Default); StreamWriter r = new StreamWriter(f, Encoding.Default);
var icount = 0; var icount = 0;
@ -1330,10 +1330,10 @@ namespace Myshipping.Application.EDI.TSL
string filename = InttrEdi.filerpath + "\\" + InttrEdi.BSLIST[0].MBLNO + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".txt"; string filename = InttrEdi.filerpath + "\\" + InttrEdi.BSLIST[0].MBLNO + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".txt";
if (System.IO.File.Exists(filename)) //if (System.IO.File.Exists(filename))
{ //{
System.IO.File.Delete(filename); // System.IO.File.Delete(filename);
} //}
FileStream f = new FileStream(filename, FileMode.Create); FileStream f = new FileStream(filename, FileMode.Create);
StreamWriter r = new StreamWriter(f, Encoding.Default); StreamWriter r = new StreamWriter(f, Encoding.Default);

@ -630,10 +630,10 @@ namespace Myshipping.Application.EDI.WY
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
filename = filename.Replace("\\", "/"); filename = filename.Replace("\\", "/");
if (System.IO.File.Exists(filename)) //if (System.IO.File.Exists(filename))
{ //{
System.IO.File.Delete(filename); // System.IO.File.Delete(filename);
} //}
FileStream f = new FileStream(filename, FileMode.Create); FileStream f = new FileStream(filename, FileMode.Create);
StreamWriter r = new StreamWriter(f, Encoding.Default); StreamWriter r = new StreamWriter(f, Encoding.Default);
var icount = 0; var icount = 0;

@ -656,10 +656,10 @@ namespace Myshipping.Application.EDI.YML
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
filename = filename.Replace("\\", "/"); filename = filename.Replace("\\", "/");
if (System.IO.File.Exists(filename)) //if (System.IO.File.Exists(filename))
{ //{
System.IO.File.Delete(filename); // System.IO.File.Delete(filename);
} //}
FileStream f = new FileStream(filename, FileMode.Create); FileStream f = new FileStream(filename, FileMode.Create);
StreamWriter r = new StreamWriter(f, Encoding.Default); StreamWriter r = new StreamWriter(f, Encoding.Default);
var icount = 0; var icount = 0;
@ -984,10 +984,14 @@ namespace Myshipping.Application.EDI.YML
string filename = InttrEdi.filerpath + "\\" + InttrEdi.BSLIST[0].MBLNO + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".txt"; string filename = InttrEdi.filerpath + "\\" + InttrEdi.BSLIST[0].MBLNO + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".txt";
if (System.IO.File.Exists(filename)) //如果是部署linux需要修改路径
{ if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
System.IO.File.Delete(filename); filename = filename.Replace("\\", "/");
}
//if (System.IO.File.Exists(filename))
//{
// System.IO.File.Delete(filename);
//}
FileStream f = new FileStream(filename, FileMode.Create); FileStream f = new FileStream(filename, FileMode.Create);
StreamWriter r = new StreamWriter(f, Encoding.Default); StreamWriter r = new StreamWriter(f, Encoding.Default);

@ -645,10 +645,10 @@ namespace Myshipping.Application.EDI.YT
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
filename = filename.Replace("\\", "/"); filename = filename.Replace("\\", "/");
if (System.IO.File.Exists(filename)) //if (System.IO.File.Exists(filename))
{ //{
System.IO.File.Delete(filename); // System.IO.File.Delete(filename);
} //}
FileStream f = new FileStream(filename, FileMode.Create); FileStream f = new FileStream(filename, FileMode.Create);
StreamWriter r = new StreamWriter(f, Encoding.Default); StreamWriter r = new StreamWriter(f, Encoding.Default);
var icount = 0; var icount = 0;

File diff suppressed because it is too large Load Diff

@ -53,6 +53,7 @@ using System.Xml.Linq;
using Myshipping.Application.Helper; using Myshipping.Application.Helper;
using System.Net; using System.Net;
using Furion.DistributedIDGenerator; using Furion.DistributedIDGenerator;
using System.Linq.Expressions;
namespace Myshipping.Application namespace Myshipping.Application
{ {
@ -69,7 +70,7 @@ namespace Myshipping.Application
private readonly SqlSugarRepository<BookingLogDetail> _bookinglogdetail; private readonly SqlSugarRepository<BookingLogDetail> _bookinglogdetail;
private readonly SqlSugarRepository<BookingRemark> _bookingremark; private readonly SqlSugarRepository<BookingRemark> _bookingremark;
private readonly SqlSugarRepository<BookingFile> _bookingfile; private readonly SqlSugarRepository<BookingFile> _bookingfile;
private readonly SqlSugarRepository<SysDictData> _dicdata;
private readonly SqlSugarRepository<BookingPrintTemplate> _repPrint; private readonly SqlSugarRepository<BookingPrintTemplate> _repPrint;
private readonly ILogger<BookingOrderService> _logger; private readonly ILogger<BookingOrderService> _logger;
private readonly ISysCacheService _cache; private readonly ISysCacheService _cache;
@ -112,7 +113,7 @@ namespace Myshipping.Application
this._bookingremark = bookingremark; this._bookingremark = bookingremark;
this._bookingfile = bookingfile; this._bookingfile = bookingfile;
this._repPrint = repPrint; this._repPrint = repPrint;
this._dicdata = dicdata;
this._cache = cache; this._cache = cache;
this._webAccountConfig = webAccountConfig; this._webAccountConfig = webAccountConfig;
this._repStatuslog = statuslog; this._repStatuslog = statuslog;
@ -141,6 +142,7 @@ namespace Myshipping.Application
public async Task<dynamic> Page([FromQuery] BookingOrderInput input) public async Task<dynamic> Page([FromQuery] BookingOrderInput input)
{ {
List<long> userlist = await DataFilterExtensions.GetDataScopeIdList(); List<long> userlist = await DataFilterExtensions.GetDataScopeIdList();
var entities = await _rep.AsQueryable().Where(x => x.ParentId == 0) var entities = await _rep.AsQueryable().Where(x => x.ParentId == 0)
.WhereIF(!string.IsNullOrWhiteSpace(input.BSNO), u => u.BSNO.Contains(input.BSNO)) .WhereIF(!string.IsNullOrWhiteSpace(input.BSNO), u => u.BSNO.Contains(input.BSNO))
.WhereIF(!string.IsNullOrWhiteSpace(input.BSSTATUS), u => u.BSSTATUS == input.BSSTATUS) .WhereIF(!string.IsNullOrWhiteSpace(input.BSSTATUS), u => u.BSSTATUS == input.BSSTATUS)
@ -288,11 +290,21 @@ namespace Myshipping.Application
.WhereIF(!string.IsNullOrWhiteSpace(input.LANENAME), u => u.LANENAME.Contains(input.LANENAME)) .WhereIF(!string.IsNullOrWhiteSpace(input.LANENAME), u => u.LANENAME.Contains(input.LANENAME))
.WhereIF(!string.IsNullOrWhiteSpace(input.FREIGHTPAYER), u => u.FREIGHTPAYER.Contains(input.FREIGHTPAYER)) .WhereIF(!string.IsNullOrWhiteSpace(input.FREIGHTPAYER), u => u.FREIGHTPAYER.Contains(input.FREIGHTPAYER))
.Where(u => userlist.Contains((long)u.CreatedUserId)) .Where(u => userlist.Contains((long)u.CreatedUserId))
.OrderBy(PageInputOrder.OrderBuilder(input.SortField,input.descSort))
.ToPagedListAsync(input.PageNo, input.PageSize); .ToPagedListAsync(input.PageNo, input.PageSize);
return entities.XnPagedResult(); var list = entities.Adapt<SqlSugarPagedList<PageBookingOrder>>();
}
foreach (var item in list.Items)
{
var sta = await _repBookingStatus.AsQueryable().Where(x => x.BookingId == item.Id).ToListAsync();
if (sta != null) { item.bookstatus = sta; }
}
return list;
}
[HttpPost("/BookingOrder/AddOrUpdate")] [HttpPost("/BookingOrder/AddOrUpdate")]
public async Task<long> AddOrUpdate(BookingOrderDto Dto) public async Task<long> AddOrUpdate(BookingOrderDto Dto)
{ {
@ -844,7 +856,7 @@ namespace Myshipping.Application
[NonAction] [NonAction]
public async Task SendTrace(string BusinessId, string YARDID, string YARD, string MBLNO) public async Task SendTrace(string BusinessId, string YARDID, string YARD, string MBLNO)
{ {
_logger.LogInformation("提单号:" + MBLNO + " 调用运踪接口"); _logger.LogInformation("调用运踪接口提单号:" + MBLNO + " 调用运踪接口");
var key = _webAccountConfig.GetAccountConfig("seae_billtraceurl", UserManager.UserId).Result; var key = _webAccountConfig.GetAccountConfig("seae_billtraceurl", UserManager.UserId).Result;
if (key == null) if (key == null)
{ {
@ -870,8 +882,9 @@ namespace Myshipping.Application
billdto.url = url.FirstOrDefault(x => x.TypeCode == "url_set" && x.Code == "response_seae_billtraceurl").Value; billdto.url = url.FirstOrDefault(x => x.TypeCode == "url_set" && x.Code == "response_seae_billtraceurl").Value;
billdto.Gid = UserManager.DjyUserId; billdto.Gid = UserManager.DjyUserId;
var json = billdto.ToJsonString(); var json = billdto.ToJsonString();
_logger.LogInformation("调用运踪接口发送josn" + json);
var html = await url.FirstOrDefault(x => x.TypeCode == "url_set" && x.Code == "request_seae_billtraceurl").Value.SetHttpMethod(HttpMethod.Post).SetQueries(new { msg = json }).SetRetryPolicy(3, 5000).SendAsAsync<RespCommon>(); var html = await url.FirstOrDefault(x => x.TypeCode == "url_set" && x.Code == "request_seae_billtraceurl").Value.SetHttpMethod(HttpMethod.Post).SetQueries(new { msg = json }).SetRetryPolicy(3, 5000).SendAsAsync<RespCommon>();
_logger.LogInformation("提单号:" + MBLNO + " 调用运踪接口返回" + html.ToJsonString()); _logger.LogInformation("调用运踪接口提单号:" + MBLNO + " 调用运踪接口返回" + html.ToJsonString());
} }
/// <summary> /// <summary>
@ -882,16 +895,17 @@ namespace Myshipping.Application
[HttpPost("/BookingOrder/AddBookingStatusLog")] [HttpPost("/BookingOrder/AddBookingStatusLog")]
public async Task AddBookingStatusLog(List<BookingStatusLogDto> all) public async Task AddBookingStatusLog(List<BookingStatusLogDto> all)
{ {
//清空原有数据
var old = await _repStatuslog.AsQueryable().Where(x => x.BookingId == all[0].BookingId && x.Category == "ship").ToListAsync();
await _repStatuslog.DeleteAsync(x => x.BookingId == all[0].BookingId && x.Category == "ship");
foreach (var ot in old)
{
await _statuslogdetail.DeleteAsync(x => x.PId == ot.Id);
}
var dicdatalist = _cache.GetAllDictData().Result;
foreach (var item in all) foreach (var item in all)
{ {
//清空原有数据
var old = await _repStatuslog.AsQueryable().Where(x => x.BookingId == item.BookingId && x.Category == "ship").ToListAsync();
await _repStatuslog.DeleteAsync(x => x.BookingId == item.BookingId && x.Category == "ship");
foreach (var ot in old)
{
await _statuslogdetail.DeleteAsync(x => x.PId == ot.Id);
}
//新增数据 //新增数据
var bookingStatusLog = new BookingStatusLog(); var bookingStatusLog = new BookingStatusLog();
bookingStatusLog.BookingId = item.BookingId; bookingStatusLog.BookingId = item.BookingId;
@ -901,7 +915,99 @@ namespace Myshipping.Application
bookingStatusLog.OpTime = item.OpTime; bookingStatusLog.OpTime = item.OpTime;
bookingStatusLog.MBLNO = item.MBLNO; bookingStatusLog.MBLNO = item.MBLNO;
await _repStatuslog.InsertAsync(bookingStatusLog); await _repStatuslog.InsertAsync(bookingStatusLog);
//var list=_repBookingStatus.AsQueryable().InnerJoin<List<SysDictData>>((d,t)=>d.StaCode==t.C) var list = await _repBookingStatus.AsQueryable().InnerJoin<SysDictData>((d, t) => d.StaCode == t.Code && d.StaCate == "book_sta_cate_billtrace" && d.BookingId == item.BookingId).Select((d, t) => new
{
BookingId = d.BookingId,
StaCode = d.StaCode,
StaName = d.StaName,
StaTime = d.StaTime,
Code = t.Code,
Value = t.Value
}).ToListAsync();
#region 订舱状态
if (item.Status == "舱单")
{
if (list.Where(x => x.Code == "sta_cangdan").FirstOrDefault() == null)
{
BookingStatus bookingStatus = new BookingStatus();
bookingStatus.BookingId = item.BookingId;
bookingStatus.StaCode = "sta_cangdan";
bookingStatus.StaName = dicdatalist.Where(x => x.Code == "sta_cangdan").Select(x => x.Value).FirstOrDefault();
bookingStatus.StaTime = item.OpTime;
bookingStatus.StaCate = "book_sta_cate_billtrace";
await _repBookingStatus.InsertAsync(bookingStatus);
}
}
if (item.Status == "报关")
{
if (list.Where(x => x.Code == "sta_haifang").FirstOrDefault() == null)
{
BookingStatus bookingStatus = new BookingStatus();
bookingStatus.BookingId = item.BookingId;
bookingStatus.StaCode = "sta_haifang";
bookingStatus.StaName = dicdatalist.Where(x => x.Code == "sta_haifang").Select(x => x.Value).FirstOrDefault();
bookingStatus.StaTime = item.OpTime;
bookingStatus.StaCate = "book_sta_cate_billtrace";
await _repBookingStatus.InsertAsync(bookingStatus);
}
}
if (item.Status == "装载")
{
if (list.Where(x => x.Code == "sta_zhuangzai").FirstOrDefault() == null)
{
BookingStatus bookingStatus = new BookingStatus();
bookingStatus.BookingId = item.BookingId;
bookingStatus.StaCode = "sta_zhuangzai";
bookingStatus.StaName = dicdatalist.Where(x => x.Code == "sta_zhuangzai").Select(x => x.Value).FirstOrDefault();
bookingStatus.StaTime = item.OpTime;
bookingStatus.StaCate = "book_sta_cate_billtrace";
await _repBookingStatus.InsertAsync(bookingStatus);
}
}
if (item.Status == "码放")
{
if (list.Where(x => x.Code == "sta_mafang").FirstOrDefault() == null)
{
BookingStatus bookingStatus = new BookingStatus();
bookingStatus.BookingId = item.BookingId;
bookingStatus.StaCode = "sta_mafang";
bookingStatus.StaName = dicdatalist.Where(x => x.Code == "sta_mafang").Select(x => x.Value).FirstOrDefault();
bookingStatus.StaTime = item.OpTime;
bookingStatus.StaCate = "book_sta_cate_billtrace";
await _repBookingStatus.InsertAsync(bookingStatus);
}
}
if (item.Status == "装船")
{
if (list.Where(x => x.Code == "sta_zhuangchuan").FirstOrDefault() == null)
{
BookingStatus bookingStatus = new BookingStatus();
bookingStatus.BookingId = item.BookingId;
bookingStatus.StaCode = "sta_zhuangchuan";
bookingStatus.StaName = dicdatalist.Where(x => x.Code == "sta_zhuangchuan").Select(x => x.Value).FirstOrDefault();
bookingStatus.StaTime = item.OpTime;
bookingStatus.StaCate = "book_sta_cate_billtrace";
await _repBookingStatus.InsertAsync(bookingStatus);
}
}
if (item.Status == "ATD")
{
if (list.Where(x => x.Code == "sta_atd").FirstOrDefault() == null)
{
BookingStatus bookingStatus = new BookingStatus();
bookingStatus.BookingId = item.BookingId;
bookingStatus.StaCode = "sta_atd";
bookingStatus.StaName = dicdatalist.Where(x => x.Code == "sta_atd").Select(x => x.Value).FirstOrDefault();
bookingStatus.StaTime = item.OpTime;
bookingStatus.StaCate = "book_sta_cate_billtrace";
await _repBookingStatus.InsertAsync(bookingStatus);
}
}
#endregion
if (item.detail != null && item.detail.Count > 0) if (item.detail != null && item.detail.Count > 0)
{ {
foreach (var dt in item.detail) foreach (var dt in item.detail)
@ -912,16 +1018,8 @@ namespace Myshipping.Application
BookingStatusLogDetail.CNTRNO = dt.CNTRNO; BookingStatusLogDetail.CNTRNO = dt.CNTRNO;
BookingStatusLogDetail.OPTime = dt.OPTime; BookingStatusLogDetail.OPTime = dt.OPTime;
await _statuslogdetail.InsertAsync(BookingStatusLogDetail); await _statuslogdetail.InsertAsync(BookingStatusLogDetail);
if (dt.Status == "舱单")
{
}
} }
} }
} }
@ -1011,6 +1109,23 @@ namespace Myshipping.Application
} }
} }
/// <summary>
/// 删除放舱
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
[SqlSugarUnitOfWork]
[HttpPost("/BookingLetteryard/LetterYardDelete")]
public async Task LetterYardDelete(long Id)
{
await _repLetterYard.DeleteAsync(x => x.BookingId == Id);
_logger.LogInformation(Id + "放舱删除成功!");
}
/// <summary> /// <summary>
/// 放舱发送 /// 放舱发送
/// </summary> /// </summary>
@ -1280,8 +1395,17 @@ namespace Myshipping.Application
{ {
throw Oops.Bah("类型参数不正确"); throw Oops.Bah("类型参数不正确");
} }
var mblno= await _rep.AsQueryable().Where(x=>x.Id==bookingId).Select(x=>x.MBLNO).FirstAsync();
string fileName = string.Empty;
if (string.IsNullOrWhiteSpace(mblno))
{
fileName = HttpUtility.UrlEncode($"{bookingId}_{DateTime.Now.Ticks}.{fileType}", Encoding.GetEncoding("UTF-8"));////名称
}
else {
var fileName = HttpUtility.UrlEncode($"{bookingId}_{DateTime.Now.Ticks}.{fileType}", Encoding.GetEncoding("UTF-8"));////名称 fileName = HttpUtility.UrlEncode($"{mblno}_{DateTime.Now.Ticks}.{fileType}", Encoding.GetEncoding("UTF-8"));////名称
}
//var result = new FileContentResult(bs, "application/octet-stream") { FileDownloadName = fileName }; //var result = new FileContentResult(bs, "application/octet-stream") { FileDownloadName = fileName };
var opt = App.GetOptions<TempFileOptions>().Path; var opt = App.GetOptions<TempFileOptions>().Path;
var serverpath = Path.Combine(App.WebHostEnvironment.WebRootPath, opt);//服务器路径 var serverpath = Path.Combine(App.WebHostEnvironment.WebRootPath, opt);//服务器路径
@ -2061,6 +2185,12 @@ namespace Myshipping.Application
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
[HttpPost("/BookingOrder/SendBookingOrClosingEDI")] [HttpPost("/BookingOrder/SendBookingOrClosingEDI")]
public async Task<string> SendBookingOrClosingEDI(BookingOrClosingEDIOrderDto model) public async Task<string> SendBookingOrClosingEDI(BookingOrClosingEDIOrderDto model)
{
return await InnerBookingOrClosingEDI(model);
}
#endregion
public async Task<string> InnerBookingOrClosingEDI(BookingOrClosingEDIOrderDto model)
{ {
string batchNo = IDGen.NextID().ToString(); string batchNo = IDGen.NextID().ToString();
@ -2122,8 +2252,6 @@ namespace Myshipping.Application
throw Oops.Bah($"CARRIERID={order.CARRIERID} 发送SO(SI)的船公司EDI代码未找到"); throw Oops.Bah($"CARRIERID={order.CARRIERID} 发送SO(SI)的船公司EDI代码未找到");
var ediModel = new EDIBaseModel(); var ediModel = new EDIBaseModel();
var ftpSet = _cache.GetAllEdiSetting().GetAwaiter().GetResult() var ftpSet = _cache.GetAllEdiSetting().GetAwaiter().GetResult()
@ -2144,10 +2272,28 @@ namespace Myshipping.Application
//读取文件配置 //读取文件配置
var fileCfg = App.GetOptions<BookingAttachOptions>(); var fileCfg = App.GetOptions<BookingAttachOptions>();
string filePath = $"{Path.Combine(!string.IsNullOrWhiteSpace(fileCfg.basePath) ? fileCfg.basePath : App.WebHostEnvironment.WebRootPath, fileCfg.relativePath)}\\edifiles\\{order.BOOKINGNO}"; string filePath = String.Empty;
string relativePath = string.Empty;
if(!model.send)
{
var opt = App.GetOptions<TempFileOptions>().Path;
filePath = $"{Path.Combine(App.WebHostEnvironment.WebRootPath, opt)}\\{order.BOOKINGNO}";//服务器路径
}
else
{
relativePath = $"{fileCfg.relativePath}\\edifiles\\{order.BOOKINGNO}";
filePath = $"{(!string.IsNullOrWhiteSpace(fileCfg.basePath) ? fileCfg.basePath : App.WebHostEnvironment.WebRootPath)}\\{relativePath}";
}
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
relativePath = relativePath.Replace("\\", "/");
filePath = filePath.Replace("\\", "/"); filePath = filePath.Replace("\\", "/");
}
_logger.LogInformation("批次={no} 生成文件保存路径完成 路由={filePath} 服务器系统={system}", batchNo, filePath, RuntimeInformation.OSDescription); _logger.LogInformation("批次={no} 生成文件保存路径完成 路由={filePath} 服务器系统={system}", batchNo, filePath, RuntimeInformation.OSDescription);
//预先创建目录 //预先创建目录
@ -2286,6 +2432,20 @@ namespace Myshipping.Application
if (model.send) if (model.send)
{ {
string currFilePath = string.Empty;
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
currFilePath = System.Text.RegularExpressions.Regex.Match(result.extra.ToString(), relativePath.Replace("/", "\\/") + ".*").Value;
}
else
{
currFilePath = System.Text.RegularExpressions.Regex.Match(result.extra.ToString(), relativePath.Replace("\\", "\\\\") + ".*").Value;
}
//这里先写入附件表
await SaveEDIFile(model.Id, currFilePath, new System.IO.FileInfo(currFilePath).Name);
_logger.LogInformation("批次={no} 直接发送FTP 文件访问地址={filepath}", batchNo, result.extra.ToString()); _logger.LogInformation("批次={no} 直接发送FTP 文件访问地址={filepath}", batchNo, result.extra.ToString());
DateTime bDate = DateTime.Now; DateTime bDate = DateTime.Now;
@ -2308,6 +2468,57 @@ namespace Myshipping.Application
return result.extra.ToString(); return result.extra.ToString();
} }
[NonAction]
private async Task SaveEDIFile(long boookId,string FilePath,string fileName,string fileTypeCode= "edi", string fileTypeName= "EDI文件")
{
/*
*/
//EDI文件
var bookFile = new BookingFile
{
Id = YitIdHelper.NextId(),
FileName = fileName,
FilePath = FilePath,
TypeCode = fileTypeCode,
TypeName = fileTypeName,
BookingId = boookId,
};
await _bookingfile.InsertAsync(bookFile);
}
#region 下载订舱、截单EDI
/// <summary>
/// 下载订舱、截单EDI
/// </summary>
/// <param name="id">订单主键</param>
/// <param name="orderNo">订单号</param>
/// <param name="useForwarderCode">是否使用货代代码</param>
/// <param name="forwarderName">货代代码</param>
/// <param name="fileRole">文件功能 (9原始,1 更新,5 退舱 )</param>
/// <param name="sendType">发送类型 B-订舱 E-截单</param>
/// <returns></returns>
[HttpGet("/BookingOrder/DownloadBookingOrClosingEDI")]
public IActionResult DownloadBookingOrClosingEDI([FromQuery] long id, [FromQuery] string orderNo, [FromQuery] bool useForwarderCode,
[FromQuery] string forwarderName, [FromQuery] string fileRole, [FromQuery] string sendType)
{
var model = new BookingOrClosingEDIOrderDto {
Id = id,
orderNo = orderNo,
useForwarderCode = useForwarderCode,
forwarderName = forwarderName,
fileRole = fileRole,
send = false,
sendType = sendType
};
var filePath = InnerBookingOrClosingEDI(model).GetAwaiter().GetResult();
var fileInfo = new FileInfo(filePath);
var result = new FileStreamResult(new FileStream(filePath, FileMode.Open), "application/octet-stream") { FileDownloadName = fileInfo.Name };
return result;
}
#endregion #endregion
#region 上传FTP #region 上传FTP
@ -2424,12 +2635,6 @@ namespace Myshipping.Application
result.succ = currRlt.succ; result.succ = currRlt.succ;
result.extra = currRlt.succ ? currRlt.extra.ToString() : ""; result.extra = currRlt.succ ? currRlt.extra.ToString() : "";
//鐩存帴鍙戦€佹姤鏂囧埌FTP鏈嶅姟鍣?
if (model.send)
{
}
} }
else if (ediRouteEnum == EDIRouteEnum.WY) else if (ediRouteEnum == EDIRouteEnum.WY)
{ {

@ -0,0 +1,759 @@
using Myshipping.Application.Entity;
using Myshipping.Core.Entity;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application.Service.BookingOrder.Dto
{
public class PageBookingOrder : DBEntityTenant
{
/// <summary>
/// 业务编号
/// </summary>
//[Description("业务编号")]
public string BSNO { get; set; }
/// <summary>
/// 业务状态
/// </summary>
//[Description("业务状态")]
public string BSSTATUS { get; set; }
/// <summary>
/// 业务状态名称
/// </summary>
//[Description("业务状态名称")]
public string BSSTATUSNAME { get; set; }
/// <summary>
/// 业务日期
/// </summary>
//[Description("业务日期")]
public DateTime? BSDATE { get; set; }
/// <summary>
/// 主提单号
/// </summary>
[Description("主提单号")]
public string MBLNO { get; set; }
/// <summary>
/// 分提单号
/// </summary>
[Description("分提单号")]
public string HBLNO { get; set; }
/// <summary>
/// 订舱编号
/// </summary>
[Description("订舱编号")]
public string BOOKINGNO { get; set; }
/// <summary>
/// 合约号
/// </summary>
[Description("合约号")]
public string CONTRACTNO { get; set; }
/// <summary>
/// 客户合同号
/// </summary>
[Description("客户合同号")]
public string SERVICECONTRACTNO { get; set; }
/// <summary>
/// 发货人代码
/// </summary>
//[Description("发货人代码")]
public string SHIPPERID { get; set; }
/// <summary>
/// 收货人代码
/// </summary>
//[Description("收货人代码")]
public string CONSIGNEEID { get; set; }
/// <summary>
/// 通知人代码
/// </summary>
//[Description("通知人代码")]
public string NOTIFYPARTYID { get; set; }
/// <summary>
/// 发货人
/// </summary>
[Description("发货人")]
public string SHIPPER { get; set; }
/// <summary>
/// 收货人
/// </summary>
[Description("收货人")]
public string CONSIGNEE { get; set; }
/// <summary>
/// 通知人
/// </summary>
[Description("通知人")]
public string NOTIFYPARTY { get; set; }
/// <summary>
/// 第二通知人
/// </summary>
[Description("第二通知人")]
public string NOTIFYPARTY2 { get; set; }
/// <summary>
/// 场站代码
/// </summary>
//[Description("场站代码")]
public string YARDID { get; set; }
/// <summary>
/// 场站
/// </summary>
[Description("场站")]
public string YARD { get; set; }
/// <summary>
/// 船舶呼号
/// </summary>
[Description("船舶呼号")]
public string VESSELID { get; set; }
/// <summary>
/// 船名
/// </summary>
[Description("船名")]
public string VESSEL { get; set; }
/// <summary>
/// 海关航次
/// </summary>
[Description("海关航次")]
public string VOYNO { get; set; }
/// <summary>
/// 内部航次
/// </summary>
[Description("内部航次")]
public string VOYNOINNER { get; set; }
/// <summary>
/// 开船日期
/// </summary>
[Description("开船日期")]
public DateTime? ETD { get; set; }
/// <summary>
/// 实际开船日期
/// </summary>
[Description("实际开船日期")]
public DateTime? ATD { get; set; }
/// <summary>
/// 截港日期
/// </summary>
[Description("截港日期")]
public DateTime? CLOSINGDATE { get; set; }
/// <summary>
/// 截单日期
/// </summary>
[Description("截单日期")]
public DateTime? CLOSEDOCDATE { get; set; }
/// <summary>
/// 截VGM时间
/// </summary>
[Description("截VGM时间")]
public DateTime? CLOSEVGMDATE { get; set; }
/// <summary>
/// 预计到港日期
/// </summary>
[Description("预计到港日期")]
public DateTime? ETA { get; set; }
/// <summary>
/// 收货地代码
/// </summary>
//[Description("收货地代码")]
public string PLACERECEIPTID { get; set; }
/// <summary>
/// 收货地
/// </summary>
[Description("收货地")]
public string PLACERECEIPT { get; set; }
/// <summary>
/// 起运港代码
/// </summary>
[Description("起运港代码")]
public string PORTLOADID { get; set; }
/// <summary>
/// 起运港
/// </summary>
[Description("起运港")]
public string PORTLOAD { get; set; }
/// <summary>
/// 卸货港代码
/// </summary>
[Description("卸货港代码")]
public string PORTDISCHARGEID { get; set; }
/// <summary>
/// 卸货港
/// </summary>
[Description("卸货港")]
public string PORTDISCHARGE { get; set; }
/// <summary>
/// 交货地代码
/// </summary>
[Description("交货地代码")]
public string PLACEDELIVERYID { get; set; }
/// <summary>
/// 交货地
/// </summary>
[Description("交货地")]
public string PLACEDELIVERY { get; set; }
/// <summary>
/// 目的地代码
/// </summary>
[Description("目的地代码")]
public string DESTINATIONID { get; set; }
/// <summary>
/// 目的地
/// </summary>
[Description("目的地")]
public string DESTINATION { get; set; }
/// <summary>
/// 提单份数
/// </summary>
[Description("提单份数")]
public string NOBILL { get; set; }
/// <summary>
/// 副本提单份数
/// </summary>
[Description("副本提单份数")]
public string COPYNOBILL { get; set; }
/// <summary>
/// 签单方式
/// </summary>
[Description("签单方式")]
public string ISSUETYPE { get; set; }
/// <summary>
/// 签单日期
/// </summary>
[Description("签单日期")]
public DateTime? ISSUEDATE { get; set; }
/// <summary>
/// 签单地点代码
/// </summary>
[Description("签单地点代码")]
public string ISSUEPLACEID { get; set; }
/// <summary>
/// 签单地点
/// </summary>
[Description("签单地点")]
public string ISSUEPLACE { get; set; }
/// <summary>
/// 付费方式
/// </summary>
[Description("付费方式")]
public string BLFRT { get; set; }
/// <summary>
/// 预付地点
/// </summary>
[Description("预付地点")]
public string PREPARDAT { get; set; }
/// <summary>
/// 到付地点
/// </summary>
[Description("到付地点")]
public string PAYABLEAT { get; set; }
/// <summary>
/// 运输条款
/// </summary>
[Description("运输条款")]
public string SERVICE { get; set; }
/// <summary>
/// 唛头
/// </summary>
[Description("唛头")]
public string MARKS { get; set; }
/// <summary>
/// HS代码
/// </summary>
[Description("HS代码")]
public string HSCODE { get; set; }
/// <summary>
/// 货描
/// </summary>
[Description("货描")]
public string DESCRIPTION { get; set; }
/// <summary>
/// 件数
/// </summary>
[Description("件数")]
public int? PKGS { get; set; }
/// <summary>
/// 包装
/// </summary>
[Description("包装")]
public string KINDPKGS { get; set; }
/// <summary>
/// 毛重
/// </summary>
[Description("毛重")]
public decimal? KGS { get; set; }
/// <summary>
/// 尺码
/// </summary>
[Description("尺码")]
public decimal? CBM { get; set; }
/// <summary>
/// 件数大写
/// </summary>
[Description("件数大写")]
public string TOTALNO { get; set; }
/// <summary>
/// 集装箱
/// </summary>
[Description("集装箱")]
public string CNTRTOTAL { get; set; }
/// <summary>
/// 船公司代号
/// </summary>
[Description("船公司代号")]
public string CARRIERID { get; set; }
/// <summary>
/// 船公司
/// </summary>
[Description("船公司")]
public string CARRIER { get; set; }
/// <summary>
/// 货物标识
/// </summary>
[Description("货物标识")]
public string CARGOID { get; set; }
/// <summary>
/// 危险品类别
/// </summary>
[Description("危险品类别")]
public string DCLASS { get; set; }
/// <summary>
/// 危险品编号
/// </summary>
[Description("危险品编号")]
public string DUNNO { get; set; }
/// <summary>
/// 危险品页号
/// </summary>
[Description("危险品页号")]
public string DPAGE { get; set; }
/// <summary>
/// 危险品标签
/// </summary>
[Description("危险品标签")]
public string DLABEL { get; set; }
/// <summary>
/// 危险品联系人
/// </summary>
[Description("危险品联系人")]
public string LINKMAN { get; set; }
/// <summary>
/// 温度单位
/// </summary>
[Description("温度单位")]
public string TEMPID { get; set; }
/// <summary>
/// 设置温度
/// </summary>
[Description("设置温度")]
public string TEMPSET { get; set; }
/// <summary>
/// 通风度
/// </summary>
[Description("通风度")]
public string REEFERF { get; set; }
/// <summary>
/// 湿度
/// </summary>
[Description("湿度")]
public string HUMIDITY { get; set; }
/// <summary>
/// 最低温度
/// </summary>
[Description("最低温度")]
public string TEMPMIN { get; set; }
/// <summary>
/// 最高温度
/// </summary>
[Description("最高温度")]
public string TEMPMAX { get; set; }
/// <summary>
/// 是否SOC箱
/// </summary>
[Description("是否SOC箱")]
public bool? ISCONTAINERSOC { get; set; }
/// <summary>
/// SO备注
/// </summary>
[Description("SO备注")]
public string SOREMARK { get; set; }
/// <summary>
/// SI备注
/// </summary>
[Description("SI备注")]
public string SIREMARK { get; set; }
/// <summary>
/// 场站备注
/// </summary>
[Description("场站备注")]
public string YARDREMARK { get; set; }
/// <summary>
/// 公司ID
/// </summary>
//[Description("公司ID")]
public string COMPID { get; set; }
/// <summary>
/// 公司名称
/// </summary>
[Description("公司名称")]
public string COMPNAME { get; set; }
/// <summary>
/// 发货人名称
/// </summary>
[Description("发货人名称")]
public string SHIPPERNAME { get; set; }
/// <summary>
/// 发货人地址1
/// </summary>
[Description("发货人地址1")]
public string SHIPPERADDR1 { get; set; }
/// <summary>
/// 发货人地址2
/// </summary>
[Description("发货人地址2")]
public string SHIPPERADDR2 { get; set; }
/// <summary>
/// 发货人地址3
/// </summary>
[Description("发货人地址3")]
public string SHIPPERADDR3 { get; set; }
/// <summary>
/// 发货人城市
/// </summary>
[Description("发货人城市")]
public string SHIPPERCITY { get; set; }
/// <summary>
/// 发货人省份代码
/// </summary>
[Description("发货人省份代码")]
public string SHIPPERPROVINCE { get; set; }
/// <summary>
/// 发货人邮编
/// </summary>
[Description("发货人邮编")]
public string SHIPPERPOSTCODE { get; set; }
/// <summary>
/// 发货人国家代码
/// </summary>
[Description("发货人国家代码")]
public string SHIPPERCOUNTRY { get; set; }
/// <summary>
/// 发货人联系人
/// </summary>
[Description("发货人联系人")]
public string SHIPPERATTN { get; set; }
/// <summary>
/// 发货人电话
/// </summary>
[Description("发货人电话")]
public string SHIPPERTEL { get; set; }
/// <summary>
/// 收货人名称
/// </summary>
[Description("收货人名称")]
public string CONSIGNEENAME { get; set; }
/// <summary>
/// 收货人地址1
/// </summary>
[Description("收货人地址1")]
public string CONSIGNEEADDR1 { get; set; }
/// <summary>
/// 收货人地址2
/// </summary>
[Description("收货人地址2")]
public string CONSIGNEEADDR2 { get; set; }
/// <summary>
/// 收货人地址3
/// </summary>
[Description("收货人地址3")]
public string CONSIGNEEADDR3 { get; set; }
/// <summary>
/// 收货人城市
/// </summary>
[Description("收货人城市")]
public string CONSIGNEECITY { get; set; }
/// <summary>
/// 收货人省份代码
/// </summary>
[Description("收货人省份代码")]
public string CONSIGNEEPROVINCE { get; set; }
/// <summary>
/// 收货人邮编
/// </summary>
[Description("收货人邮编")]
public string CONSIGNEEPOSTCODE { get; set; }
/// <summary>
/// 收货人国家代码
/// </summary>
[Description("收货人国家代码")]
public string CONSIGNEERCOUNTRY { get; set; }
/// <summary>
/// 收货人联系人
/// </summary>
[Description("收货人联系人")]
public string CONSIGNEEATTN { get; set; }
/// <summary>
/// 收货人电话
/// </summary>
[Description("收货人电话")]
public string CONSIGNEETEL { get; set; }
/// <summary>
/// 通知人名称
/// </summary>
[Description("通知人名称")]
public string NOTIFYPARTYNAME { get; set; }
/// <summary>
/// 通知人地址1
/// </summary>
[Description("通知人地址1")]
public string NOTIFYPARTYADDR1 { get; set; }
/// <summary>
/// 通知人地址2
/// </summary>
[Description("通知人地址2")]
public string NOTIFYPARTYADDR2 { get; set; }
/// <summary>
/// 通知人地址3
/// </summary>
[Description("通知人地址3")]
public string NOTIFYPARTYADDR3 { get; set; }
/// <summary>
/// 通知人城市
/// </summary>
[Description("通知人城市")]
public string NOTIFYPARTYCITY { get; set; }
/// <summary>
/// 通知人省份代码
/// </summary>
[Description("通知人省份代码")]
public string NOTIFYPARTYPROVINCE { get; set; }
/// <summary>
/// 通知人邮编
/// </summary>
[Description("通知人邮编")]
public string NOTIFYPARTYPOSTCODE { get; set; }
/// <summary>
/// 通知人国家代码
/// </summary>
[Description("通知人国家代码")]
public string NOTIFYPARTYCOUNTRY { get; set; }
/// <summary>
/// 通知人联系人
/// </summary>
[Description("通知人联系人")]
public string NOTIFYPARTYATTN { get; set; }
/// <summary>
/// 通知人电话
/// </summary>
[Description("通知人电话")]
public string NOTIFYPARTYTEL { get; set; }
/// <summary>
/// PO号
/// </summary>
[Description("PO号")]
public string PONO { get; set; }
/// <summary>
/// 操作id
/// </summary>
[Description("操作id")]
public string OPID { get; set; }
/// <summary>
/// 单证id
/// </summary>
[Description("单证id")]
public string DOCID { get; set; }
/// <summary>
/// 操作
/// </summary>
[Description("操作")]
public string OP { get; set; }
/// <summary>
/// 单证
/// </summary>
//[Description("单证")]
public string DOC { get; set; }
/// <summary>
/// 销售ID
/// </summary>
//[Description("销售ID")]
public string SALEID { get; set; }
/// <summary>
/// 销售
/// </summary>
[Description("销售")]
public string SALE { get; set; }
/// <summary>
/// 客服ID
/// </summary>
//[Description("客服ID")]
public string CUSTSERVICEID { get; set; }
/// <summary>
/// 客服
/// </summary>
[Description("客服")]
public string CUSTSERVICE { get; set; }
/// <summary>
/// 客户
/// </summary>
[Description("客户")]
public string CUSTOMERNAME { get; set; }
/// <summary>
/// 订舱代理
/// </summary>
[Description("订舱代理")]
public string FORWARDER { get; set; }
/// <summary>
/// 船代
/// </summary>
[Description("船代")]
public string SHIPAGENCY { get; set; }
/// <summary>
/// 报关行
/// </summary>
[Description("报关行")]
public string CUSTOMSER { get; set; }
/// <summary>
/// 车队
/// </summary>
[Description("车队")]
public string TRUCKER { get; set; }
/// <summary>
/// 国外代理
/// </summary>
[Description("国外代理")]
public string AGENTID { get; set; }
/// <summary>
/// 客户ID
/// </summary>
//[Description("客户ID")]
public long? CUSTOMERID { get; set; }
/// <summary>
/// 订舱代理ID
/// </summary>
[Description("订舱代理ID")]
public string FORWARDERID { get; set; }
/// <summary>
/// 船代ID
/// </summary>
//[Description("船代ID")]
public string SHIPAGENCYID { get; set; }
/// <summary>
/// 报关行ID
/// </summary>
[Description("报关行ID")]
public string CUSTOMSERID { get; set; }
/// <summary>
/// 车队ID
/// </summary>
//[Description("车队ID")]
public string TRUCKERID { get; set; }
/// <summary>
/// 国外代理名称
/// </summary>
[Description("国外代理名称")]
public string AGENTNAME { get; set; }
/// <summary>
/// 委托方
/// </summary>
[Description("委托方")]
public string WEITUO { get; set; }
/// <summary>
/// 收货人DOOR地址
/// </summary>
[Description("收货人DOOR地址")]
public string CONSIGNEEDOORADDR { get; set; }
/// <summary>
/// 发货人DOOR地址
/// </summary>
[Description("发货人DOOR地址")]
public string SHIPPERDOORADDR { get; set; }
/// <summary>
/// SCAC代码
/// </summary>
[Description("SCAC代码")]
public string SCACCODE { get; set; }
/// <summary>
/// ITN编号
/// </summary>
[Description("ITN编号")]
public string ITNCODE { get; set; }
/// <summary>
/// 预付地点ID
/// </summary>
//[Description("预付地点ID")]
public string PREPARDATID { get; set; }
/// <summary>
/// 到付地点ID
/// </summary>
//[Description("到付地点ID")]
public string PAYABLEATID { get; set; }
/// <summary>
/// 客户系统编号
/// </summary>
[Description("客户系统编号")]
public string CUSTNO { get; set; }
/// <summary>
/// 中转港代码
/// </summary>
[Description("中转港代码")]
public string TRANSPORTID { get; set; }
/// <summary>
/// 中转港
/// </summary>
[Description("中转港")]
public string TRANSPORT { get; set; }
/// <summary>
/// 第三付款地
/// </summary>
[Description("第三付款地")]
public string THIRDPAYADDR { get; set; }
/// <summary>
/// 场站联系人
/// </summary>
[Description("场站联系人")]
public string YARDCONTRACT { get; set; }
/// <summary>
/// 场站联系人电话
/// </summary>
[Description("场站联系人电话")]
public string YARDCONTRACTTEL { get; set; }
/// <summary>
/// 场站联系人邮箱
/// </summary>
[Description("场站联系人邮箱")]
public string YARDCONTRACTEMAIL { get; set; }
/// <summary>
/// 费用自结
/// </summary>
[Description("费用自结")]
public bool? FEESELF { get; set; }
/// <summary>
/// 航线代码
/// </summary>
[Description("航线代码")]
public string LANECODE { get; set; }
/// <summary>
/// 航线名称
/// </summary>
[Description("航线名称")]
public string LANENAME { get; set; }
/// <summary>
/// 付款方
/// </summary>
[Description("付款方")]
public string FREIGHTPAYER { get; set; }
/// <summary>
/// 租户名称
/// </summary>
//[Description("租户名称")]
public string TenantName { get; set; }
/// <summary>
/// 主单ID
/// </summary>
//[Description("主单ID")]
public long? ParentId { get; set; }
public List<BookingStatus> bookstatus { get; set; }
}
}

@ -9,6 +9,7 @@ using System.Threading.Tasks;
using Myshipping.Application.Entity; using Myshipping.Application.Entity;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Collections.Generic; using System.Collections.Generic;
using Furion.FriendlyException;
namespace Myshipping.Application namespace Myshipping.Application
{ {
@ -109,14 +110,16 @@ namespace Myshipping.Application
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost("/BookingOrderContact/savebatch"), SqlSugarUnitOfWork] [HttpPost("/BookingOrderContact/savebatch"), SqlSugarUnitOfWork]
public async Task SaveBatch(List<UpdateBookingOrderContactInput> input) public async Task SaveBatch(List<UpdateBookingOrderContactInput> input,long bookingId)
{ {
var bookingId = input.First().BookingId;
_rep.Delete(x => x.BookingId == bookingId); _rep.Delete(x => x.BookingId == bookingId);
foreach (var item in input) if (input!=null&&input.Count>0) {
{ foreach (var item in input)
await _rep.InsertAsync(item.Adapt<BookingOrderContact>()); {
await _rep.InsertAsync(item.Adapt<BookingOrderContact>());
}
} }
} }
///// <summary> ///// <summary>

@ -67,7 +67,7 @@ namespace Myshipping.Application
.Map(dest => dest.TotalNO, src => src.TOTALNO) .Map(dest => dest.TotalNO, src => src.TOTALNO)
.Map(dest => dest.CntrTotal, src => src.CNTRTOTAL) .Map(dest => dest.CntrTotal, src => src.CNTRTOTAL)
.Map(dest => dest.CarrierId, src => src.CARRIERID) .Map(dest => dest.CarrierId, src => src.CARRIERID)
.Map(dest => dest.Carrirer, src => src.CARRIER) .Map(dest => dest.Carrier, src => src.CARRIER)
.Map(dest => dest.CargoId, src => src.CARGOID) .Map(dest => dest.CargoId, src => src.CARGOID)
.Map(dest => dest.DClass, src => src.DCLASS) .Map(dest => dest.DClass, src => src.DCLASS)
.Map(dest => dest.DUnno, src => src.DUNNO) .Map(dest => dest.DUnno, src => src.DUNNO)
@ -204,7 +204,7 @@ namespace Myshipping.Application
.Map(dest => dest.TotalNO, src => src.TOTALNO) .Map(dest => dest.TotalNO, src => src.TOTALNO)
.Map(dest => dest.CntrTotal, src => src.CNTRTOTAL) .Map(dest => dest.CntrTotal, src => src.CNTRTOTAL)
.Map(dest => dest.CarrierId, src => src.CARRIERID) .Map(dest => dest.CarrierId, src => src.CARRIERID)
.Map(dest => dest.Carrirer, src => src.CARRIER) .Map(dest => dest.Carrier, src => src.CARRIER)
.Map(dest => dest.CargoId, src => src.CARGOID) .Map(dest => dest.CargoId, src => src.CARGOID)
.Map(dest => dest.DClass, src => src.DCLASS) .Map(dest => dest.DClass, src => src.DCLASS)
.Map(dest => dest.DUnno, src => src.DUNNO) .Map(dest => dest.DUnno, src => src.DUNNO)

@ -251,7 +251,7 @@ namespace Myshipping.Application
/// <summary> /// <summary>
/// 船公司 /// 船公司
/// </summary> /// </summary>
public string Carrirer { get; set; } public string Carrier { get; set; }
/// <summary> /// <summary>
/// 货物标识 /// 货物标识
/// </summary> /// </summary>
@ -645,7 +645,7 @@ namespace Myshipping.Application
/// <summary> /// <summary>
/// 卸货港国家代码 /// 卸货港国家代码
/// </summary> /// </summary>
public string PortDischargeNo { get; set; } public string PortDischargeCountryNo { get; set; }
/// <summary> /// <summary>
/// 卸货港国家英文 /// 卸货港国家英文
@ -657,6 +657,21 @@ namespace Myshipping.Application
/// </summary> /// </summary>
public string PortDischargeCN { get; set; } public string PortDischargeCN { get; set; }
/// <summary>
/// 中转港国家代码
/// </summary>
public string TransportCountryNo { get; set; }
/// <summary>
/// 中转港国家英文
/// </summary>
public string TransportEN { get; set; }
/// <summary>
/// 中转港国家中文
/// </summary>
public string TransportCN { get; set; }
/// <summary> /// <summary>
/// 箱信息 /// 箱信息
/// </summary> /// </summary>

@ -297,6 +297,8 @@ namespace Myshipping.Application
msgModel.Main.BusinessInfo = mainInfo; msgModel.Main.BusinessInfo = mainInfo;
List<CodePort> codePortList = new List<CodePort>();
//根据卸货港翻译航线信息 //根据卸货港翻译航线信息
if (!string.IsNullOrWhiteSpace(mainInfo.PortDischargeId)) if (!string.IsNullOrWhiteSpace(mainInfo.PortDischargeId))
{ {
@ -320,25 +322,53 @@ namespace Myshipping.Application
msgModel.Main.BusinessInfo.LaneName = lineModel?.CnName; msgModel.Main.BusinessInfo.LaneName = lineModel?.CnName;
} }
codePortList = _cache.GetAllCodePort().GetAwaiter().GetResult();
//翻译卸货港对应的国家 //翻译卸货港对应的国家
var portInfo = _cache.GetAllCodePort().GetAwaiter().GetResult().FirstOrDefault(t => t.Code.Equals(mainInfo.PortDischargeId, StringComparison.OrdinalIgnoreCase)); var portInfo = codePortList.FirstOrDefault(t => t.Code.Equals(mainInfo.PortDischargeId, StringComparison.OrdinalIgnoreCase));
_logger.LogInformation("批次={no} 检索港口完成 lane={lane} msg={msg}", batchNo, mainInfo.PortDischargeId, JSON.Serialize(portInfo)); _logger.LogInformation("批次={no} 检索港口完成 lane={lane} msg={msg}", batchNo, mainInfo.PortDischargeId, JSON.Serialize(portInfo));
if (portInfo == null || string.IsNullOrWhiteSpace(portInfo.CountryCode)) if (portInfo == null || string.IsNullOrWhiteSpace(portInfo.CountryCode))
throw Oops.Oh($"港口代码{mainInfo.PortDischargeId}获取港口基础数据失败"); throw Oops.Oh($"卸货港口代码{mainInfo.PortDischargeId}获取港口基础数据失败");
var countryInfo = _cache.GetAllCodeCountry().GetAwaiter().GetResult().FirstOrDefault(t => t.Code.Equals(portInfo.CountryCode, StringComparison.OrdinalIgnoreCase)); var countryInfo = _cache.GetAllCodeCountry().GetAwaiter().GetResult().FirstOrDefault(t => t.Code.Equals(portInfo.CountryCode, StringComparison.OrdinalIgnoreCase));
if (countryInfo == null || string.IsNullOrWhiteSpace(portInfo.EnName)) if (countryInfo == null || string.IsNullOrWhiteSpace(portInfo.EnName))
throw Oops.Oh($"国家代码{portInfo.CountryCode}获取国家基础数据失败"); throw Oops.Oh($"国家代码{portInfo.CountryCode}获取国家基础数据失败");
msgModel.Main.BusinessInfo.PortDischargeNo = countryInfo.Code; msgModel.Main.BusinessInfo.PortDischargeCountryNo = countryInfo.Code;
msgModel.Main.BusinessInfo.PortDischargeEN = countryInfo.EnName; msgModel.Main.BusinessInfo.PortDischargeEN = countryInfo.EnName;
msgModel.Main.BusinessInfo.PortDischargeCN = countryInfo.CnName; msgModel.Main.BusinessInfo.PortDischargeCN = countryInfo.CnName;
} }
//中转港
if (!string.IsNullOrWhiteSpace(mainInfo.TransportId))
{
if(codePortList.Count == 0)
{
codePortList = _cache.GetAllCodePort().GetAwaiter().GetResult();
}
//翻译中转港对应的国家
var portInfo = codePortList.FirstOrDefault(t => t.Code.Equals(mainInfo.TransportId, StringComparison.OrdinalIgnoreCase));
_logger.LogInformation("批次={no} 检索港口完成 port={lane} msg={msg}", batchNo, mainInfo.TransportId, JSON.Serialize(portInfo));
if (portInfo == null || string.IsNullOrWhiteSpace(portInfo.CountryCode))
throw Oops.Oh($"中转港口代码{mainInfo.TransportId}获取港口基础数据失败");
var countryInfo = _cache.GetAllCodeCountry().GetAwaiter().GetResult().FirstOrDefault(t => t.Code.Equals(portInfo.CountryCode, StringComparison.OrdinalIgnoreCase));
if (countryInfo == null || string.IsNullOrWhiteSpace(portInfo.EnName))
throw Oops.Oh($"国家代码{portInfo.CountryCode}获取国家基础数据失败");
msgModel.Main.BusinessInfo.TransportCountryNo = countryInfo.Code;
msgModel.Main.BusinessInfo.TransportEN = countryInfo.EnName;
msgModel.Main.BusinessInfo.TransportCN = countryInfo.CnName;
}
//对应签单方式 //对应签单方式
if (!string.IsNullOrWhiteSpace(mainInfo.IssueType)) if (!string.IsNullOrWhiteSpace(mainInfo.IssueType))
{ {

@ -9,6 +9,6 @@
"BookingAttach": { "BookingAttach": {
"basePath": "", //使 "basePath": "", //使
"relativePath": "BookingAttach", "relativePath": "BookingAttach",
"fileType": [ ".xls", ".xlsx", ".pdf" ] "fileType": [ ".xls", ".xlsx", ".pdf", ".txt", ".pms" ]
} }
} }

@ -59,12 +59,9 @@ public class PageInputBase
public virtual string SortField { get; set; } public virtual string SortField { get; set; }
/// <summary> /// <summary>
/// 排序方法,默认升序,否则降序(配合antd前端,约定参数为 Ascend,Dscend) /// 排序方法,默认降序
/// </summary> /// </summary>
public virtual string SortOrder { get; set; } public virtual bool descSort { get; set; } = true;
/// <summary>
/// 降序排序(不要问我为什么是descend不是desc前端约定参数就是这样)
/// </summary>
public virtual string DescStr { get; set; } = "descend";
} }

@ -8,18 +8,16 @@ public class PageInputOrder
/// <summary> /// <summary>
/// 排序方式(默认降序) /// 排序方式(默认降序)
/// </summary> /// </summary>
/// <param name="pageInput"></param>
/// <param name="descSort">是否降序</param>
/// <returns></returns> /// <returns></returns>
public static string OrderBuilder(PageInputBase pageInput, bool descSort = true) public static string OrderBuilder(string SortField,bool descSort = true)
{ {
// 约定默认每张表都有Id排序 // 约定默认每张表都有Id排序
var orderStr = descSort ? "Id Desc" : "Id Asc"; var orderStr = descSort ? "Id Desc" : "Id Asc";
// 排序是否可用-排序字段和排序顺序都为非空才启用排序 // 排序是否可用-排序字段和排序顺序都为非空才启用排序
if (!string.IsNullOrEmpty(pageInput.SortField) && !string.IsNullOrEmpty(pageInput.SortOrder)) if (!string.IsNullOrEmpty(SortField))
{ {
orderStr = $"{pageInput.SortField} {(pageInput.SortOrder == pageInput.DescStr ? "Desc" : "Asc")}"; orderStr = $"{SortField} {(descSort ? "Desc" : "Asc")}";
} }
return orderStr; return orderStr;
} }

@ -5087,14 +5087,9 @@
排序字段 排序字段
</summary> </summary>
</member> </member>
<member name="P:Myshipping.Core.PageInputBase.SortOrder"> <member name="P:Myshipping.Core.PageInputBase.descSort">
<summary> <summary>
排序方法,默认升序,否则降序(配合antd前端,约定参数为 Ascend,Dscend) 排序方法,默认降序
</summary>
</member>
<member name="P:Myshipping.Core.PageInputBase.DescStr">
<summary>
降序排序(不要问我为什么是descend不是desc前端约定参数就是这样)
</summary> </summary>
</member> </member>
<member name="M:Myshipping.Core.JsonExtension.GetJObjectValue(Newtonsoft.Json.Linq.JObject,System.String)"> <member name="M:Myshipping.Core.JsonExtension.GetJObjectValue(Newtonsoft.Json.Linq.JObject,System.String)">
@ -5172,12 +5167,10 @@
通用输入帮助类 通用输入帮助类
</summary> </summary>
</member> </member>
<member name="M:Myshipping.Core.PageInputOrder.OrderBuilder(Myshipping.Core.PageInputBase,System.Boolean)"> <member name="M:Myshipping.Core.PageInputOrder.OrderBuilder(System.String,System.Boolean)">
<summary> <summary>
排序方式(默认降序) 排序方式(默认降序)
</summary> </summary>
<param name="pageInput"></param>
<param name="descSort">是否降序</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="T:Myshipping.Core.PageResult"> <member name="T:Myshipping.Core.PageResult">

@ -1081,10 +1081,10 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
List<CodeLane> list = await _sysCacheService.GetAllCodeLane(); List<CodeLane> list = await _sysCacheService.GetAllCodeLane();
var queryList = list.WhereIF(!string.IsNullOrEmpty(input.KeyWord), var queryList = list.WhereIF(!string.IsNullOrEmpty(input.KeyWord),
x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) x => (!string.IsNullOrWhiteSpace(x.Code) && x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase))
|| x.EnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || (!string.IsNullOrWhiteSpace(x.EnName) && x.EnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase))
|| x.CnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || (!string.IsNullOrWhiteSpace(x.CnName) && x.CnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase))
|| x.LaneType.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || (!string.IsNullOrWhiteSpace(x.LaneType) && x.LaneType.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase))
); );
@ -1122,6 +1122,14 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
} }
else else
{ {
var model = _relaPortCarrierLaneRep.AsQueryable().Where(t => t.LaneCode == entity.LaneCode
&& t.Module == entity.Module
&& t.CarrierCode == entity.CarrierCode
&& t.PortCode == entity.PortCode).First();
if (model != null)
throw Oops.Bah(ErrorCode.D1006);
entity.GID = Guid.NewGuid().ToString(); entity.GID = Guid.NewGuid().ToString();
entity.CreateTime = DateTime.Now; entity.CreateTime = DateTime.Now;
entity.CreateUser = UserManager.DjyUserId; entity.CreateUser = UserManager.DjyUserId;
@ -1148,11 +1156,12 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
//{ //{
// throw Oops.Bah("参数过多,请传入模块查询"); // throw Oops.Bah("参数过多,请传入模块查询");
//} //}
var queryList = list.Where(x => x.Module == input.Module) var queryList = list
.WhereIF(!string.IsNullOrEmpty(input.LaneCode), x => x.LaneCode.Contains(input.LaneCode, System.StringComparison.CurrentCultureIgnoreCase)) .WhereIF(!string.IsNullOrEmpty(input.Module), x => !string.IsNullOrWhiteSpace(x.Module) && x.Module.Equals(input.LaneCode, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.CarrierCode), x => x.CarrierCode.Contains(input.CarrierCode, System.StringComparison.CurrentCultureIgnoreCase)) .WhereIF(!string.IsNullOrEmpty(input.LaneCode), x => !string.IsNullOrWhiteSpace(x.LaneCode) && x.LaneCode.Contains(input.LaneCode, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.PortCode), x => x.PortCode.Contains(input.PortCode, System.StringComparison.CurrentCultureIgnoreCase)) .WhereIF(!string.IsNullOrEmpty(input.CarrierCode), x => !string.IsNullOrWhiteSpace(x.CarrierCode) && x.CarrierCode.Contains(input.CarrierCode, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.Module), x => x.Module.Contains(input.Module, System.StringComparison.CurrentCultureIgnoreCase)); .WhereIF(!string.IsNullOrEmpty(input.PortCode), x => !string.IsNullOrWhiteSpace(x.PortCode) && x.PortCode.Contains(input.PortCode, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.Module), x => !string.IsNullOrWhiteSpace(x.Module) && x.Module.Contains(input.Module, System.StringComparison.CurrentCultureIgnoreCase));
return queryList.ToList(); return queryList.ToList();
} }
#endregion #endregion
@ -1177,7 +1186,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
if (model != null) if (model != null)
{ {
var checkModel = _codeCountryRep.AsQueryable().Where(t => t.Code == entity.Code && t.GID != entity.GID); var checkModel = _codeCountryRep.AsQueryable().Where(t => t.Code == entity.Code && t.GID != entity.GID).First();
if (checkModel != null) if (checkModel != null)
throw Oops.Bah(ErrorCode.D1006); throw Oops.Bah(ErrorCode.D1006);
@ -1194,7 +1203,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
} }
else else
{ {
var model = _codeCountryRep.AsQueryable().Where(t => t.Code == entity.Code); var model = _codeCountryRep.AsQueryable().Where(t => t.Code == entity.Code).First();
if (model != null) if (model != null)
throw Oops.Bah(ErrorCode.D1006); throw Oops.Bah(ErrorCode.D1006);
@ -1221,11 +1230,11 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
List<CodeCountry> list = await _sysCacheService.GetAllCodeCountry(); List<CodeCountry> list = await _sysCacheService.GetAllCodeCountry();
var queryList = list.WhereIF(!string.IsNullOrEmpty(input.KeyWord), var queryList = list.WhereIF(!string.IsNullOrEmpty(input.KeyWord),
x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) x => (!string.IsNullOrWhiteSpace(x.Code) && x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase))
|| x.EnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || (!string.IsNullOrWhiteSpace(x.EnName) && x.EnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase))
|| x.CnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || (!string.IsNullOrWhiteSpace(x.CnName) && x.CnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase))
|| x.Capital.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || (!string.IsNullOrWhiteSpace(x.Capital) && x.Capital.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase))
|| x.Continent.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || (!string.IsNullOrWhiteSpace(x.Continent) && x.Continent.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase))
); );
return queryList.ToList(); return queryList.ToList();

Loading…
Cancel
Save